Added three new packets and cleaned up cPacket_Thunderbolt.cpp... cPacket_BlockAction, cPacket_Explosion, and cPacket_SoundEffect.
git-svn-id: http://mc-server.googlecode.com/svn/trunk@70 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
094456a131
commit
894f6e02d4
@ -305,6 +305,7 @@
|
|||||||
<ClCompile Include="..\source\packets\cPacket_13.cpp" />
|
<ClCompile Include="..\source\packets\cPacket_13.cpp" />
|
||||||
<ClCompile Include="..\source\packets\cPacket_AddToInventory.cpp" />
|
<ClCompile Include="..\source\packets\cPacket_AddToInventory.cpp" />
|
||||||
<ClCompile Include="..\source\packets\cPacket_ArmAnim.cpp" />
|
<ClCompile Include="..\source\packets\cPacket_ArmAnim.cpp" />
|
||||||
|
<ClCompile Include="..\source\packets\cPacket_BlockAction.cpp" />
|
||||||
<ClCompile Include="..\source\packets\cPacket_BlockChange.cpp" />
|
<ClCompile Include="..\source\packets\cPacket_BlockChange.cpp" />
|
||||||
<ClCompile Include="..\source\packets\cPacket_BlockDig.cpp" />
|
<ClCompile Include="..\source\packets\cPacket_BlockDig.cpp" />
|
||||||
<ClCompile Include="..\source\packets\cPacket_BlockPlace.cpp" />
|
<ClCompile Include="..\source\packets\cPacket_BlockPlace.cpp" />
|
||||||
@ -314,7 +315,9 @@
|
|||||||
<ClCompile Include="..\source\packets\cPacket_Disconnect.cpp" />
|
<ClCompile Include="..\source\packets\cPacket_Disconnect.cpp" />
|
||||||
<ClCompile Include="..\source\packets\cPacket_EntityEquipment.cpp" />
|
<ClCompile Include="..\source\packets\cPacket_EntityEquipment.cpp" />
|
||||||
<ClCompile Include="..\source\packets\cPacket_CreateInventoryAction.cpp" />
|
<ClCompile Include="..\source\packets\cPacket_CreateInventoryAction.cpp" />
|
||||||
|
<ClCompile Include="..\source\packets\cPacket_Explosion.cpp" />
|
||||||
<ClCompile Include="..\source\packets\cPacket_NewInvalidState.cpp" />
|
<ClCompile Include="..\source\packets\cPacket_NewInvalidState.cpp" />
|
||||||
|
<ClCompile Include="..\source\packets\cPacket_SoundEffect.cpp" />
|
||||||
<ClCompile Include="..\source\packets\cPacket_Thunderbolt.cpp" />
|
<ClCompile Include="..\source\packets\cPacket_Thunderbolt.cpp" />
|
||||||
<ClCompile Include="..\source\packets\cPacket_EntityLook.cpp" />
|
<ClCompile Include="..\source\packets\cPacket_EntityLook.cpp" />
|
||||||
<ClCompile Include="..\source\packets\cPacket_EntityStatus.cpp" />
|
<ClCompile Include="..\source\packets\cPacket_EntityStatus.cpp" />
|
||||||
@ -449,6 +452,7 @@
|
|||||||
<ClInclude Include="..\source\packets\cPacket_13.h" />
|
<ClInclude Include="..\source\packets\cPacket_13.h" />
|
||||||
<ClInclude Include="..\source\packets\cPacket_AddToInventory.h" />
|
<ClInclude Include="..\source\packets\cPacket_AddToInventory.h" />
|
||||||
<ClInclude Include="..\source\packets\cPacket_ArmAnim.h" />
|
<ClInclude Include="..\source\packets\cPacket_ArmAnim.h" />
|
||||||
|
<ClInclude Include="..\source\packets\cPacket_BlockAction.h" />
|
||||||
<ClInclude Include="..\source\packets\cPacket_BlockChange.h" />
|
<ClInclude Include="..\source\packets\cPacket_BlockChange.h" />
|
||||||
<ClInclude Include="..\source\packets\cPacket_BlockDig.h" />
|
<ClInclude Include="..\source\packets\cPacket_BlockDig.h" />
|
||||||
<ClInclude Include="..\source\packets\cPacket_BlockPlace.h" />
|
<ClInclude Include="..\source\packets\cPacket_BlockPlace.h" />
|
||||||
@ -458,7 +462,9 @@
|
|||||||
<ClInclude Include="..\source\packets\cPacket_Disconnect.h" />
|
<ClInclude Include="..\source\packets\cPacket_Disconnect.h" />
|
||||||
<ClInclude Include="..\source\packets\cPacket_EntityEquipment.h" />
|
<ClInclude Include="..\source\packets\cPacket_EntityEquipment.h" />
|
||||||
<ClInclude Include="..\source\packets\cPacket_CreateInventoryAction.h" />
|
<ClInclude Include="..\source\packets\cPacket_CreateInventoryAction.h" />
|
||||||
|
<ClInclude Include="..\source\packets\cPacket_Explosion.h" />
|
||||||
<ClInclude Include="..\source\packets\cPacket_NewInvalidState.h" />
|
<ClInclude Include="..\source\packets\cPacket_NewInvalidState.h" />
|
||||||
|
<ClInclude Include="..\source\packets\cPacket_SoundEffect.h" />
|
||||||
<ClInclude Include="..\source\packets\cPacket_Thunderbolt.h" />
|
<ClInclude Include="..\source\packets\cPacket_Thunderbolt.h" />
|
||||||
<ClInclude Include="..\source\packets\cPacket_EntityLook.h" />
|
<ClInclude Include="..\source\packets\cPacket_EntityLook.h" />
|
||||||
<ClInclude Include="..\source\packets\cPacket_EntityStatus.h" />
|
<ClInclude Include="..\source\packets\cPacket_EntityStatus.h" />
|
||||||
|
@ -385,6 +385,15 @@
|
|||||||
<Filter Include="cLavaSimulator">
|
<Filter Include="cLavaSimulator">
|
||||||
<UniqueIdentifier>{b0401fd9-4021-4ab7-bf61-c8de112b4196}</UniqueIdentifier>
|
<UniqueIdentifier>{b0401fd9-4021-4ab7-bf61-c8de112b4196}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="Packets\cPacket_Explosion">
|
||||||
|
<UniqueIdentifier>{0a6d025d-4fb8-4557-a348-004b819ea477}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Packets\cPacket_BlockAction">
|
||||||
|
<UniqueIdentifier>{e7503f74-0963-428a-a0fc-0b3bc1c81f99}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Packets\cPacket_SoundEffect">
|
||||||
|
<UniqueIdentifier>{faf55c04-f56e-4f41-a948-54232627c3a9}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\source\cServer.cpp">
|
<ClCompile Include="..\source\cServer.cpp">
|
||||||
@ -772,6 +781,15 @@
|
|||||||
<ClCompile Include="..\source\cLavaSimulator.cpp">
|
<ClCompile Include="..\source\cLavaSimulator.cpp">
|
||||||
<Filter>cLavaSimulator</Filter>
|
<Filter>cLavaSimulator</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\source\packets\cPacket_Explosion.cpp">
|
||||||
|
<Filter>Packets\cPacket_Explosion</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\source\packets\cPacket_BlockAction.cpp">
|
||||||
|
<Filter>Packets\cPacket_BlockAction</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\source\packets\cPacket_SoundEffect.cpp">
|
||||||
|
<Filter>Packets\cPacket_SoundEffect</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\source\cServer.h">
|
<ClInclude Include="..\source\cServer.h">
|
||||||
@ -1194,6 +1212,15 @@
|
|||||||
<ClInclude Include="..\source\cLavaSimulator.h">
|
<ClInclude Include="..\source\cLavaSimulator.h">
|
||||||
<Filter>cLavaSimulator</Filter>
|
<Filter>cLavaSimulator</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\source\packets\cPacket_Explosion.h">
|
||||||
|
<Filter>Packets\cPacket_Explosion</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\source\packets\cPacket_BlockAction.h">
|
||||||
|
<Filter>Packets\cPacket_BlockAction</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\source\packets\cPacket_SoundEffect.h">
|
||||||
|
<Filter>Packets\cPacket_SoundEffect</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\source\AllToLua.pkg">
|
<None Include="..\source\AllToLua.pkg">
|
||||||
|
18
makefile
18
makefile
@ -122,6 +122,9 @@ MCServer : \
|
|||||||
build/cPacket_AddToInventory.o\
|
build/cPacket_AddToInventory.o\
|
||||||
build/cPacket_ArmAnim.o\
|
build/cPacket_ArmAnim.o\
|
||||||
build/cPacket_BlockChange.o\
|
build/cPacket_BlockChange.o\
|
||||||
|
build/cPacket_BlockAction.o\
|
||||||
|
build/cPacket_Explosion.o\
|
||||||
|
build/cPacket_SoundEffect.o\
|
||||||
build/cPacket_BlockDig.o\
|
build/cPacket_BlockDig.o\
|
||||||
build/cPacket_BlockPlace.o\
|
build/cPacket_BlockPlace.o\
|
||||||
build/cPacket_Chat.o\
|
build/cPacket_Chat.o\
|
||||||
@ -310,6 +313,9 @@ MCServer : \
|
|||||||
build/cPacket_AddToInventory.o\
|
build/cPacket_AddToInventory.o\
|
||||||
build/cPacket_ArmAnim.o\
|
build/cPacket_ArmAnim.o\
|
||||||
build/cPacket_BlockChange.o\
|
build/cPacket_BlockChange.o\
|
||||||
|
build/cPacket_BlockAction.o\
|
||||||
|
build/cPacket_Explosion.o\
|
||||||
|
build/cPacket_SoundEffect.o\
|
||||||
build/cPacket_BlockDig.o\
|
build/cPacket_BlockDig.o\
|
||||||
build/cPacket_BlockPlace.o\
|
build/cPacket_BlockPlace.o\
|
||||||
build/cPacket_Chat.o\
|
build/cPacket_Chat.o\
|
||||||
@ -501,6 +507,9 @@ clean :
|
|||||||
build/cPacket_AddToInventory.o\
|
build/cPacket_AddToInventory.o\
|
||||||
build/cPacket_ArmAnim.o\
|
build/cPacket_ArmAnim.o\
|
||||||
build/cPacket_BlockChange.o\
|
build/cPacket_BlockChange.o\
|
||||||
|
build/cPacket_BlockAction.o\
|
||||||
|
build/cPacket_Explosion.o\
|
||||||
|
build/cPacket_SoundEffect.o\
|
||||||
build/cPacket_BlockDig.o\
|
build/cPacket_BlockDig.o\
|
||||||
build/cPacket_BlockPlace.o\
|
build/cPacket_BlockPlace.o\
|
||||||
build/cPacket_Chat.o\
|
build/cPacket_Chat.o\
|
||||||
@ -880,6 +889,15 @@ build/cPacket_ArmAnim.o : source/packets/cPacket_ArmAnim.cpp
|
|||||||
build/cPacket_BlockChange.o : source/packets/cPacket_BlockChange.cpp
|
build/cPacket_BlockChange.o : source/packets/cPacket_BlockChange.cpp
|
||||||
$(CC) $(CC_OPTIONS) source/packets/cPacket_BlockChange.cpp -c $(INCLUDE) -o build/cPacket_BlockChange.o
|
$(CC) $(CC_OPTIONS) source/packets/cPacket_BlockChange.cpp -c $(INCLUDE) -o build/cPacket_BlockChange.o
|
||||||
|
|
||||||
|
build/cPacket_BlockAction.o : source/packets/cPacket_BlockAction.cpp
|
||||||
|
$(CC) $(CC_OPTIONS) source/packets/cPacket_BlockAction.cpp -c $(INCLUDE) -o build/cPacket_BlockAction.o
|
||||||
|
|
||||||
|
build/cPacket_Explosion.o : source/packets/cPacket_Explosion.cpp
|
||||||
|
$(CC) $(CC_OPTIONS) source/packets/cPacket_Explosion.cpp -c $(INCLUDE) -o build/cPacket_Explosion.o
|
||||||
|
|
||||||
|
build/cPacket_SoundEffect.o : source/packets/cPacket_SoundEffect.cpp
|
||||||
|
$(CC) $(CC_OPTIONS) source/packets/cPacket_SoundEffect.cpp -c $(INCLUDE) -o build/cPacket_SoundEffect.o
|
||||||
|
|
||||||
build/cPacket_BlockDig.o : source/packets/cPacket_BlockDig.cpp
|
build/cPacket_BlockDig.o : source/packets/cPacket_BlockDig.cpp
|
||||||
$(CC) $(CC_OPTIONS) source/packets/cPacket_BlockDig.cpp -c $(INCLUDE) -o build/cPacket_BlockDig.o
|
$(CC) $(CC_OPTIONS) source/packets/cPacket_BlockDig.cpp -c $(INCLUDE) -o build/cPacket_BlockDig.o
|
||||||
|
|
||||||
|
@ -39,6 +39,9 @@ enum ENUM_PACKET_ID
|
|||||||
E_MAP_CHUNK = 0x33,
|
E_MAP_CHUNK = 0x33,
|
||||||
E_MULTI_BLOCK = 0x34,
|
E_MULTI_BLOCK = 0x34,
|
||||||
E_BLOCK_CHANGE = 0x35,
|
E_BLOCK_CHANGE = 0x35,
|
||||||
|
E_BLOCK_ACTION = 0x36,
|
||||||
|
E_EXPLOSION = 0x3C,
|
||||||
|
E_SOUND_EFFECT = 0x3D,
|
||||||
E_NEW_INVALID_STATE = 0x46,
|
E_NEW_INVALID_STATE = 0x46,
|
||||||
E_THUNDERBOLT = 0x47,
|
E_THUNDERBOLT = 0x47,
|
||||||
E_WINDOW_OPEN = 0x64,
|
E_WINDOW_OPEN = 0x64,
|
||||||
|
29
source/packets/cPacket_BlockAction.cpp
Normal file
29
source/packets/cPacket_BlockAction.cpp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#include "cPacket_BlockAction.h"
|
||||||
|
|
||||||
|
cPacket_BlockAction::cPacket_BlockAction( const cPacket_BlockAction & a_Copy )
|
||||||
|
{
|
||||||
|
m_PacketID = E_BLOCK_ACTION;
|
||||||
|
m_PosX = a_Copy.m_PosX;
|
||||||
|
m_PosY = a_Copy.m_PosY;
|
||||||
|
m_PosZ = a_Copy.m_PosZ;
|
||||||
|
m_Byte1 = a_Copy.m_Byte1;
|
||||||
|
m_Byte2 = a_Copy.m_Byte2;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cPacket_BlockAction::Send(cSocket & a_Socket)
|
||||||
|
{
|
||||||
|
unsigned int TotalSize = c_Size;
|
||||||
|
char* Message = new char[TotalSize];
|
||||||
|
|
||||||
|
unsigned int i = 0;
|
||||||
|
AppendByte ( (char)m_PacketID, Message, i );
|
||||||
|
AppendInteger ( m_PosX, Message, i );
|
||||||
|
AppendShort ( m_PosY, Message, i );
|
||||||
|
AppendInteger ( m_PosZ, Message, i );
|
||||||
|
AppendByte ( m_Byte1, Message, i );
|
||||||
|
AppendByte ( m_Byte1, Message, i );
|
||||||
|
|
||||||
|
bool RetVal = !cSocket::IsSocketError( SendData( a_Socket, Message, TotalSize, 0 ) );
|
||||||
|
delete [] Message;
|
||||||
|
return RetVal;
|
||||||
|
}
|
28
source/packets/cPacket_BlockAction.h
Normal file
28
source/packets/cPacket_BlockAction.h
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "cPacket.h"
|
||||||
|
#include "PacketID.h"
|
||||||
|
|
||||||
|
class cPacket_BlockAction : public cPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
cPacket_BlockAction()
|
||||||
|
: m_PosX( 0 )
|
||||||
|
, m_PosY( 0 )
|
||||||
|
, m_PosZ( 0 )
|
||||||
|
, m_Byte1( 0 )
|
||||||
|
, m_Byte2( 0 )
|
||||||
|
{ m_PacketID = E_BLOCK_ACTION; }
|
||||||
|
cPacket_BlockAction( const cPacket_BlockAction & a_Copy );
|
||||||
|
virtual cPacket* Clone() const { return new cPacket_BlockAction(*this); }
|
||||||
|
|
||||||
|
bool Send(cSocket & a_Socket);
|
||||||
|
|
||||||
|
int m_PosX; // Block X Coordinate
|
||||||
|
short m_PosY; // Block Y Coordinate
|
||||||
|
int m_PosZ; // Block Z Coordinate
|
||||||
|
char m_Byte1; // Varies
|
||||||
|
char m_Byte2; // Varies
|
||||||
|
|
||||||
|
static const unsigned int c_Size = 1 + 4 + 2 + 4 + 1 + 1;
|
||||||
|
};
|
42
source/packets/cPacket_Explosion.cpp
Normal file
42
source/packets/cPacket_Explosion.cpp
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#include "cPacket_Explosion.h"
|
||||||
|
|
||||||
|
cPacket_Explosion::~cPacket_Explosion()
|
||||||
|
{
|
||||||
|
if( m_Records )
|
||||||
|
{
|
||||||
|
delete [] m_Records;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cPacket_Explosion::cPacket_Explosion( const cPacket_Explosion & a_Copy )
|
||||||
|
{
|
||||||
|
m_PacketID = E_EXPLOSION;
|
||||||
|
m_PosX = a_Copy.m_PosX;
|
||||||
|
m_PosY = a_Copy.m_PosY;
|
||||||
|
m_PosZ = a_Copy.m_PosZ;
|
||||||
|
m_Radius = a_Copy.m_Radius; //might not be radius
|
||||||
|
m_RecordsCount= a_Copy.m_RecordsCount;
|
||||||
|
|
||||||
|
m_Records = new char[(m_RecordsCount * 3)];
|
||||||
|
memcpy( m_Records, a_Copy.m_Records, (m_RecordsCount * 3) );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cPacket_Explosion::Send(cSocket & a_Socket)
|
||||||
|
{
|
||||||
|
unsigned int TotalSize = c_Size + (m_RecordsCount * 3);
|
||||||
|
char* Message = new char[TotalSize];
|
||||||
|
|
||||||
|
unsigned int i = 0;
|
||||||
|
AppendByte ( (char)m_PacketID, Message, i );
|
||||||
|
AppendDouble ( m_PosX, Message, i );
|
||||||
|
AppendDouble ( m_PosY, Message, i );
|
||||||
|
AppendDouble ( m_PosZ, Message, i );
|
||||||
|
AppendFloat ( m_Radius, Message, i );
|
||||||
|
AppendInteger ( m_RecordsCount, Message, i );
|
||||||
|
AppendData ( m_Records, (m_RecordsCount * 3),Message, i );
|
||||||
|
|
||||||
|
bool RetVal = !cSocket::IsSocketError( SendData( a_Socket, Message, TotalSize, 0 ) );
|
||||||
|
delete [] Message;
|
||||||
|
return RetVal;
|
||||||
|
}
|
32
source/packets/cPacket_Explosion.h
Normal file
32
source/packets/cPacket_Explosion.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "cPacket.h"
|
||||||
|
#include "PacketID.h"
|
||||||
|
|
||||||
|
class cPacket_Explosion : public cPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
cPacket_Explosion()
|
||||||
|
: m_PosX( 0 )
|
||||||
|
, m_PosY( 0 )
|
||||||
|
, m_PosZ( 0 )
|
||||||
|
, m_Radius( 0 )
|
||||||
|
, m_RecordsCount( 0 )
|
||||||
|
, m_Records( 0 )
|
||||||
|
{ m_PacketID = E_EXPLOSION; m_Records = 0; }
|
||||||
|
cPacket_Explosion( const cPacket_Explosion & a_Copy );
|
||||||
|
~cPacket_Explosion();
|
||||||
|
virtual cPacket* Clone() const { return new cPacket_Explosion(*this); }
|
||||||
|
|
||||||
|
bool Send(cSocket & a_Socket);
|
||||||
|
|
||||||
|
double m_PosX; // The entity ID of the thunderbolt
|
||||||
|
double m_PosY; // Always true. Might have a meaning in the future...
|
||||||
|
double m_PosZ; // Thunderbolt X as Absolute Integer
|
||||||
|
float m_Radius; // Thunderbolt Y as Absolute Integer
|
||||||
|
int m_RecordsCount; // Thunderbolt Z as Absolute Integer
|
||||||
|
|
||||||
|
static const unsigned int c_Size = 1 + 8 + 8 + 8 + 4 + 4;
|
||||||
|
|
||||||
|
char* m_Records;
|
||||||
|
};
|
30
source/packets/cPacket_SoundEffect.cpp
Normal file
30
source/packets/cPacket_SoundEffect.cpp
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#include "cPacket_SoundEffect.h"
|
||||||
|
|
||||||
|
cPacket_SoundEffect::cPacket_SoundEffect( const cPacket_SoundEffect & a_Copy )
|
||||||
|
{
|
||||||
|
m_PacketID = E_SOUND_EFFECT;
|
||||||
|
m_SoundID = a_Copy.m_SoundID;
|
||||||
|
m_PosX = a_Copy.m_PosX;
|
||||||
|
m_PosY = a_Copy.m_PosY;
|
||||||
|
m_PosZ = a_Copy.m_PosZ;
|
||||||
|
m_SoundData = a_Copy.m_SoundData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool cPacket_SoundEffect::Send(cSocket & a_Socket)
|
||||||
|
{
|
||||||
|
unsigned int TotalSize = c_Size;
|
||||||
|
char* Message = new char[TotalSize];
|
||||||
|
|
||||||
|
unsigned int i = 0;
|
||||||
|
AppendByte ( (char)m_PacketID, Message, i );
|
||||||
|
AppendInteger ( m_SoundID, Message, i );
|
||||||
|
AppendInteger ( m_PosX, Message, i );
|
||||||
|
AppendByte ( (char)m_PosY, Message, i );
|
||||||
|
AppendInteger ( m_PosZ, Message, i );
|
||||||
|
AppendInteger ( m_SoundData, Message, i );
|
||||||
|
|
||||||
|
bool RetVal = !cSocket::IsSocketError( SendData( a_Socket, Message, TotalSize, 0 ) );
|
||||||
|
delete [] Message;
|
||||||
|
return RetVal;
|
||||||
|
}
|
28
source/packets/cPacket_SoundEffect.h
Normal file
28
source/packets/cPacket_SoundEffect.h
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "cPacket.h"
|
||||||
|
#include "PacketID.h"
|
||||||
|
|
||||||
|
class cPacket_SoundEffect : public cPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
cPacket_SoundEffect()
|
||||||
|
: m_SoundID( 0 )
|
||||||
|
, m_PosX( 0 )
|
||||||
|
, m_PosY( 0 )
|
||||||
|
, m_PosZ( 0 )
|
||||||
|
, m_SoundData( 0 )
|
||||||
|
{ m_PacketID = E_SOUND_EFFECT; }
|
||||||
|
cPacket_SoundEffect( const cPacket_SoundEffect & a_Copy );
|
||||||
|
virtual cPacket* Clone() const { return new cPacket_SoundEffect(*this); }
|
||||||
|
|
||||||
|
bool Send(cSocket & a_Socket);
|
||||||
|
|
||||||
|
int m_SoundID; // Sound ID
|
||||||
|
int m_PosX; // Block X Coordinate
|
||||||
|
char m_PosY; // Block Y Coordinate
|
||||||
|
int m_PosZ; // Block Z Coordinate
|
||||||
|
int m_SoundData;// Extra Sound Data
|
||||||
|
|
||||||
|
static const unsigned int c_Size = 1 + 4 + 4 + 1 + 4 + 4;
|
||||||
|
};
|
@ -8,13 +8,8 @@ cPacket_Thunderbolt::cPacket_Thunderbolt( const cPacket_Thunderbolt & a_Copy )
|
|||||||
m_xLBPos = a_Copy.m_xLBPos;
|
m_xLBPos = a_Copy.m_xLBPos;
|
||||||
m_yLBPos = a_Copy.m_yLBPos;
|
m_yLBPos = a_Copy.m_yLBPos;
|
||||||
m_zLBPos = a_Copy.m_zLBPos;
|
m_zLBPos = a_Copy.m_zLBPos;
|
||||||
printf("blot-packet %i %i %i\n", m_xLBPos,m_yLBPos,m_zLBPos);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool cPacket_Thunderbolt::Send(cSocket & a_Socket)
|
bool cPacket_Thunderbolt::Send(cSocket & a_Socket)
|
||||||
{
|
{
|
||||||
unsigned int TotalSize = c_Size;
|
unsigned int TotalSize = c_Size;
|
||||||
@ -28,11 +23,6 @@ bool cPacket_Thunderbolt::Send(cSocket & a_Socket)
|
|||||||
AppendInteger ( m_yLBPos*32, Message, i );
|
AppendInteger ( m_yLBPos*32, Message, i );
|
||||||
AppendInteger ( m_zLBPos*32, Message, i );
|
AppendInteger ( m_zLBPos*32, Message, i );
|
||||||
|
|
||||||
for( unsigned int iii = 1; iii < TotalSize; ++iii ){
|
|
||||||
|
|
||||||
printf("packetdata %i\n", (int)Message[iii]);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RetVal = !cSocket::IsSocketError( SendData( a_Socket, Message, TotalSize, 0 ) );
|
bool RetVal = !cSocket::IsSocketError( SendData( a_Socket, Message, TotalSize, 0 ) );
|
||||||
delete [] Message;
|
delete [] Message;
|
||||||
return RetVal;
|
return RetVal;
|
||||||
|
Loading…
Reference in New Issue
Block a user