1
0

Added the "collect pickup" sound to 1.3.2

git-svn-id: http://mc-server.googlecode.com/svn/trunk@923 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-10-03 18:44:42 +00:00
parent c19a0f3da6
commit 5bbeeb3d66
2 changed files with 23 additions and 0 deletions

View File

@ -14,6 +14,7 @@
#include "../Player.h" #include "../Player.h"
#include "../Mobs/Monster.h" #include "../Mobs/Monster.h"
#include "../UI/Window.h" #include "../UI/Window.h"
#include "../Pickup.h"
@ -56,6 +57,7 @@ enum
PACKET_ENTITY_EQUIPMENT = 0x05, PACKET_ENTITY_EQUIPMENT = 0x05,
PACKET_COMPASS = 0x06, PACKET_COMPASS = 0x06,
PACKET_PLAYER_SPAWN = 0x14, PACKET_PLAYER_SPAWN = 0x14,
PACKET_COLLECT_PICKUP = 0x16,
PACKET_SPAWN_MOB = 0x18, PACKET_SPAWN_MOB = 0x18,
PACKET_DESTROY_ENTITIES = 0x1d, PACKET_DESTROY_ENTITIES = 0x1d,
PACKET_CHUNK_DATA = 0x33, PACKET_CHUNK_DATA = 0x33,
@ -247,6 +249,26 @@ void cProtocol132::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerialize
void cProtocol132::SendCollectPickup(const cPickup & a_Pickup, const cPlayer & a_Player)
{
cCSLock Lock(m_CSPacket);
WriteByte(PACKET_COLLECT_PICKUP);
WriteInt (a_Pickup.GetUniqueID());
WriteInt (a_Player.GetUniqueID());
Flush();
// Also send the "pop" sound effect with a somewhat random pitch (fast-random using EntityID ;)
SendSoundEffect(
"random.pop",
(int)(a_Pickup.GetPosX() * 8), (int)(a_Pickup.GetPosY() * 8), (int)(a_Pickup.GetPosZ() * 8),
0.5, (float)(0.75 + ((float)((a_Pickup.GetUniqueID() * 23) % 32)) / 64)
);
}
void cProtocol132::SendDestroyEntity(const cEntity & a_Entity) void cProtocol132::SendDestroyEntity(const cEntity & a_Entity)
{ {
cCSLock Lock(m_CSPacket); cCSLock Lock(m_CSPacket);

View File

@ -33,6 +33,7 @@ public:
virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override; virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override;
virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override; virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override;
virtual void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player) override;
virtual void SendDestroyEntity (const cEntity & a_Entity) override; virtual void SendDestroyEntity (const cEntity & a_Entity) override;
virtual void SendEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override; virtual void SendEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override;
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override; virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;