summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-24 14:28:53 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-24 14:28:53 +0100
commit57834374363965198f8870c9f11111d7c8a12d7f (patch)
tree1b45896954eba5c15ad7d4b8bb790322a1c21fc1 /source
parentProtocol version bumped up to 29 (MC 1.2.4), seems to work. (diff)
downloadcuberite-57834374363965198f8870c9f11111d7c8a12d7f.tar
cuberite-57834374363965198f8870c9f11111d7c8a12d7f.tar.gz
cuberite-57834374363965198f8870c9f11111d7c8a12d7f.tar.bz2
cuberite-57834374363965198f8870c9f11111d7c8a12d7f.tar.lz
cuberite-57834374363965198f8870c9f11111d7c8a12d7f.tar.xz
cuberite-57834374363965198f8870c9f11111d7c8a12d7f.tar.zst
cuberite-57834374363965198f8870c9f11111d7c8a12d7f.zip
Diffstat (limited to '')
-rw-r--r--source/PacketID.h1
-rw-r--r--source/cClientHandle.cpp10
-rw-r--r--source/cClientHandle.h5
-rw-r--r--source/cPlayer.cpp2
-rw-r--r--source/packets/cPacket_Player.cpp243
-rw-r--r--source/packets/cPacket_Player.h150
-rw-r--r--source/packets/cPacket_PlayerListItem.cpp56
-rw-r--r--source/packets/cPacket_PlayerListItem.h30
-rw-r--r--source/packets/cPacket_PlayerLook.cpp46
-rw-r--r--source/packets/cPacket_PlayerLook.h39
-rw-r--r--source/packets/cPacket_PlayerMoveLook.cpp58
-rw-r--r--source/packets/cPacket_PlayerMoveLook.h43
-rw-r--r--source/packets/cPacket_PlayerPosition.cpp53
-rw-r--r--source/packets/cPacket_PlayerPosition.h44
14 files changed, 398 insertions, 382 deletions
diff --git a/source/PacketID.h b/source/PacketID.h
index b10bc54be..d557a284f 100644
--- a/source/PacketID.h
+++ b/source/PacketID.h
@@ -54,6 +54,7 @@ enum ENUM_PACKET_ID
E_CREATIVE_INVENTORY_ACTION = 0x6B,
E_UPDATE_SIGN = 0x82,
E_PLAYER_LIST_ITEM = 0xC9,
+ E_PLAYER_ABILITIES = 0xca, // since 1.2.4, protocol version 29
E_PING = 0xfe,
E_DISCONNECT = 0xff,
};
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp
index 268e6a510..e8f874489 100644
--- a/source/cClientHandle.cpp
+++ b/source/cClientHandle.cpp
@@ -38,18 +38,15 @@
#include "MersenneTwister.h"
#include "packets/cPacket_KeepAlive.h"
-#include "packets/cPacket_PlayerPosition.h"
#include "packets/cPacket_Respawn.h"
#include "packets/cPacket_UpdateHealth.h"
#include "packets/cPacket_RelativeEntityMoveLook.h"
#include "packets/cPacket_Chat.h"
#include "packets/cPacket_Login.h"
#include "packets/cPacket_WindowClick.h"
-#include "packets/cPacket_PlayerMoveLook.h"
#include "packets/cPacket_TimeUpdate.h"
#include "packets/cPacket_BlockDig.h"
#include "packets/cPacket_Handshake.h"
-#include "packets/cPacket_PlayerLook.h"
#include "packets/cPacket_ArmAnim.h"
#include "packets/cPacket_BlockPlace.h"
#include "packets/cPacket_Flying.h"
@@ -64,7 +61,6 @@
#include "packets/cPacket_13.h"
#include "packets/cPacket_UpdateSign.h"
#include "packets/cPacket_Ping.h"
-#include "packets/cPacket_PlayerListItem.h"
#include "packets/cPacket_NamedEntitySpawn.h"
#include "packets/cPacket_MapChunk.h"
#include "packets/cPacket_PreChunk.h"
@@ -125,6 +121,7 @@ cClientHandle::cClientHandle(const cSocket & a_Socket, int a_ViewDistance)
m_PacketMap[E_PLAYERPOS] = new cPacket_PlayerPosition;
m_PacketMap[E_PLAYERLOOK] = new cPacket_PlayerLook;
m_PacketMap[E_PLAYERMOVELOOK] = new cPacket_PlayerMoveLook;
+ m_PacketMap[E_PLAYER_ABILITIES] = new cPacket_PlayerAbilities;
m_PacketMap[E_CHAT] = new cPacket_Chat;
m_PacketMap[E_ANIMATION] = new cPacket_ArmAnim;
m_PacketMap[E_FLYING] = new cPacket_Flying;
@@ -352,8 +349,7 @@ void cClientHandle::StreamChunks(void)
m_LastStreamedChunkX = ChunkPosX;
m_LastStreamedChunkZ = ChunkPosZ;
- // DEBUG:
- LOGINFO("Streaming chunks centered on [%d, %d], view distance %d", ChunkPosX, ChunkPosZ, m_ViewDistance);
+ LOGD("Streaming chunks centered on [%d, %d], view distance %d", ChunkPosX, ChunkPosZ, m_ViewDistance);
cWorld * World = m_Player->GetWorld();
ASSERT(World != NULL);
@@ -1871,7 +1867,7 @@ void cClientHandle::DataReceived(const char * a_Data, int a_Size)
LOGERROR("Unknown packet type 0x%02x from client \"%s\"", (unsigned char)m_ReceivedData[0], m_Username.c_str());
AString Reason;
- Printf(Reason, "[C->S] Unknown PacketID: 0x%02x", m_ReceivedData[0]);
+ Printf(Reason, "[C->S] Unknown PacketID: 0x%02x", (unsigned char)m_ReceivedData[0]);
cPacket_Disconnect DC(Reason);
m_Socket.Send(&DC);
cSleep::MilliSleep(1000); // Give packet some time to be received
diff --git a/source/cClientHandle.h b/source/cClientHandle.h
index c41d08de7..d0ac81db8 100644
--- a/source/cClientHandle.h
+++ b/source/cClientHandle.h
@@ -17,17 +17,15 @@
#include "ChunkDef.h"
#include "packets/cPacket_KeepAlive.h"
-#include "packets/cPacket_PlayerPosition.h"
+#include "packets/cPacket_Player.h"
#include "packets/cPacket_Respawn.h"
#include "packets/cPacket_RelativeEntityMoveLook.h"
#include "packets/cPacket_Chat.h"
#include "packets/cPacket_Login.h"
#include "packets/cPacket_WindowClick.h"
-#include "packets/cPacket_PlayerMoveLook.h"
#include "packets/cPacket_TimeUpdate.h"
#include "packets/cPacket_BlockDig.h"
#include "packets/cPacket_Handshake.h"
-#include "packets/cPacket_PlayerLook.h"
#include "packets/cPacket_ArmAnim.h"
#include "packets/cPacket_BlockPlace.h"
#include "packets/cPacket_Flying.h"
@@ -41,7 +39,6 @@
#include "packets/cPacket_WindowClose.h"
#include "packets/cPacket_UpdateSign.h"
#include "packets/cPacket_Ping.h"
-#include "packets/cPacket_PlayerListItem.h"
diff --git a/source/cPlayer.cpp b/source/cPlayer.cpp
index 4e5f47c72..961145d6e 100644
--- a/source/cPlayer.cpp
+++ b/source/cPlayer.cpp
@@ -28,12 +28,10 @@
#include "packets/cPacket_RelativeEntityMoveLook.h"
#include "packets/cPacket_UpdateHealth.h"
#include "packets/cPacket_Respawn.h"
-#include "packets/cPacket_PlayerPosition.h"
#include "packets/cPacket_DestroyEntity.h"
#include "packets/cPacket_Metadata.h"
#include "packets/cPacket_Chat.h"
#include "packets/cPacket_NewInvalidState.h"
-#include "packets/cPacket_PlayerListItem.h"
#include "packets/cPacket_BlockAction.h"
#include "Vector3d.h"
diff --git a/source/packets/cPacket_Player.cpp b/source/packets/cPacket_Player.cpp
new file mode 100644
index 000000000..86214d725
--- /dev/null
+++ b/source/packets/cPacket_Player.cpp
@@ -0,0 +1,243 @@
+
+// cPacket_Player.cpp
+
+/* Implements the player-related packets:
+ - PlayerAbilities (0xca)
+ - PlayerListItem (0xc9)
+ - PlayerLook (0x0c)
+ - PlayerMoveLook (0x0d)
+ - PlayerPosition (0x0b)
+*/
+
+#include "Globals.h"
+
+#include "cPacket_Player.h"
+#include "../cPlayer.h"
+#include "../cChatColor.h"
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cPacket_PlayerAbilities:
+
+int cPacket_PlayerAbilities::Parse(const char * a_Data, int a_Size)
+{
+ if (a_Size < 4)
+ {
+ return PACKET_INCOMPLETE;
+ }
+ m_Invulnerable = (a_Data[0] != 0);
+ m_IsFlying = (a_Data[1] != 0);
+ m_CanFly = (a_Data[2] != 0);
+ m_InstaMine = (a_Data[3] != 0);
+ return 4;
+}
+
+
+
+
+
+void cPacket_PlayerAbilities::Serialize(AString & a_Data) const
+{
+ char Data[5];
+ Data[0] = m_PacketID;
+ Data[1] = (char)m_Invulnerable;
+ Data[2] = (char)m_IsFlying;
+ Data[3] = (char)m_CanFly;
+ Data[4] = (char)m_InstaMine;
+ a_Data.append(Data, 5);
+}
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cPacket_PlayerListItem:
+
+cPacket_PlayerListItem::cPacket_PlayerListItem(const AString & a_PlayerName, bool a_Online, short a_Ping)
+{
+ m_PacketID = E_PLAYER_LIST_ITEM;
+ m_PlayerName = a_PlayerName;
+ m_Online = a_Online;
+ m_Ping = a_Ping;
+}
+
+
+
+
+
+int cPacket_PlayerListItem::Parse(const char * a_Data, int a_Size)
+{
+ int TotalBytes = 0;
+ HANDLE_PACKET_READ(ReadString16, m_PlayerName, TotalBytes);
+ HANDLE_PACKET_READ(ReadBool, m_Online, TotalBytes);
+ HANDLE_PACKET_READ(ReadShort, m_Ping, TotalBytes);
+ return TotalBytes;
+}
+
+
+
+
+
+void cPacket_PlayerListItem::Serialize(AString & a_Data) const
+{
+ AString PlayerName(m_PlayerName);
+ if (PlayerName.length() > 16)
+ {
+ PlayerName.erase(16);
+ }
+ else if (PlayerName.length() <= 14)
+ {
+ PlayerName += cChatColor::White;
+ }
+
+ AppendByte (a_Data, m_PacketID);
+ AppendString16(a_Data, PlayerName);
+ AppendBool (a_Data, m_Online);
+ AppendShort (a_Data, m_Ping);
+}
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cPacket_PlayerLook:
+
+cPacket_PlayerLook::cPacket_PlayerLook( cPlayer* a_Player )
+{
+ m_PacketID = E_PLAYERLOOK;
+ m_Rotation = a_Player->GetRotation();
+ m_Pitch = a_Player->GetPitch();
+ m_bFlying = a_Player->GetFlying();
+}
+
+
+
+
+
+int cPacket_PlayerLook::Parse(const char * a_Data, int a_Size)
+{
+ int TotalBytes = 0;
+ HANDLE_PACKET_READ(ReadFloat, m_Rotation, TotalBytes);
+ HANDLE_PACKET_READ(ReadFloat, m_Pitch, TotalBytes);
+ HANDLE_PACKET_READ(ReadBool, m_bFlying, TotalBytes);
+ return TotalBytes;
+}
+
+
+
+
+
+void cPacket_PlayerLook::Serialize(AString & a_Data) const
+{
+ AppendByte (a_Data, m_PacketID);
+ AppendFloat (a_Data, m_Rotation);
+ AppendFloat (a_Data, m_Pitch);
+ AppendBool (a_Data, m_bFlying);
+}
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cPacket_PlayerMoveLook:
+
+cPacket_PlayerMoveLook::cPacket_PlayerMoveLook( cPlayer* a_Player )
+{
+ m_PacketID = E_PLAYERMOVELOOK;
+ m_PosX = a_Player->GetPosX();
+ m_PosY = a_Player->GetPosY() + 1.65;
+ m_PosZ = a_Player->GetPosZ();
+ m_Stance = a_Player->GetStance();
+ m_Rotation = a_Player->GetRotation();
+ m_Pitch = a_Player->GetPitch();
+ m_bFlying = a_Player->GetFlying();
+}
+
+
+
+
+
+int cPacket_PlayerMoveLook::Parse(const char * a_Data, int a_Size)
+{
+ int TotalBytes = 0;
+ HANDLE_PACKET_READ(ReadDouble, m_PosX, TotalBytes);
+ HANDLE_PACKET_READ(ReadDouble, m_PosY, TotalBytes);
+ HANDLE_PACKET_READ(ReadDouble, m_Stance, TotalBytes);
+ HANDLE_PACKET_READ(ReadDouble, m_PosZ, TotalBytes);
+ HANDLE_PACKET_READ(ReadFloat, m_Rotation, TotalBytes);
+ HANDLE_PACKET_READ(ReadFloat, m_Pitch, TotalBytes);
+ HANDLE_PACKET_READ(ReadBool, m_bFlying, TotalBytes);
+ return TotalBytes;
+}
+
+
+
+
+
+void cPacket_PlayerMoveLook::Serialize(AString & a_Data) const
+{
+ AppendByte (a_Data, m_PacketID);
+ AppendDouble(a_Data, m_PosX);
+ AppendDouble(a_Data, m_PosY);
+ AppendDouble(a_Data, m_Stance);
+ AppendDouble(a_Data, m_PosZ);
+ AppendFloat (a_Data, m_Rotation);
+ AppendFloat (a_Data, m_Pitch);
+ AppendBool (a_Data, m_bFlying);
+}
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cPacket_PlayerPosition:
+
+cPacket_PlayerPosition::cPacket_PlayerPosition( cPlayer* a_Player )
+{
+ m_PacketID = E_PLAYERPOS;
+
+ m_PosX = a_Player->GetPosX();
+ m_PosY = a_Player->GetPosY() + 1.65;
+ m_PosZ = a_Player->GetPosZ();
+ m_Stance = a_Player->GetStance();
+ m_bFlying = a_Player->GetFlying();
+}
+
+
+
+
+
+int cPacket_PlayerPosition::Parse(const char * a_Data, int a_Size)
+{
+ int TotalBytes = 0;
+ HANDLE_PACKET_READ(ReadDouble, m_PosX, TotalBytes);
+ HANDLE_PACKET_READ(ReadDouble, m_PosY, TotalBytes);
+ HANDLE_PACKET_READ(ReadDouble, m_Stance, TotalBytes);
+ HANDLE_PACKET_READ(ReadDouble, m_PosZ, TotalBytes);
+ HANDLE_PACKET_READ(ReadBool, m_bFlying, TotalBytes);
+ return TotalBytes;
+}
+
+
+
+
+
+void cPacket_PlayerPosition::Serialize(AString & a_Data) const
+{
+ AppendByte (a_Data, m_PacketID);
+ AppendDouble (a_Data, m_PosX);
+ AppendDouble (a_Data, m_PosY);
+ AppendDouble (a_Data, m_Stance);
+ AppendDouble (a_Data, m_PosZ);
+ AppendBool (a_Data, m_bFlying);
+}
+
+
+
+
diff --git a/source/packets/cPacket_Player.h b/source/packets/cPacket_Player.h
new file mode 100644
index 000000000..ce88cc451
--- /dev/null
+++ b/source/packets/cPacket_Player.h
@@ -0,0 +1,150 @@
+
+// cPacket_Player.h
+
+/* Interfaces to the player-related packets:
+ - PlayerAbilities (0xca)
+ - PlayerListItem (0xc9)
+ - PlayerLook (0x0c)
+ - PlayerMoveLook (0x0d)
+ - PlayerPosition (0x0b)
+*/
+
+#pragma once
+
+
+
+
+
+#include "cPacket.h"
+
+
+
+
+
+// fwd:
+class cPlayer;
+
+
+
+
+
+class cPacket_PlayerAbilities : public cPacket
+{
+public:
+ cPacket_PlayerAbilities(void) { m_PacketID = E_PLAYER_LIST_ITEM; }
+
+ virtual int Parse(const char * a_Data, int a_Size) override;
+ virtual void Serialize(AString & a_Data) const override;
+
+ virtual cPacket * Clone() const { return new cPacket_PlayerAbilities(*this); }
+
+ bool m_Invulnerable; // Speculation
+ bool m_IsFlying;
+ bool m_CanFly;
+ bool m_InstaMine; // Speculation
+} ;
+
+
+
+
+
+class cPacket_PlayerListItem : public cPacket
+{
+public:
+ cPacket_PlayerListItem() { m_PacketID = E_PLAYER_LIST_ITEM; }
+ cPacket_PlayerListItem(const AString & a_PlayerName, bool a_Online, short a_Ping);
+
+ virtual int Parse(const char * a_Data, int a_Size) override;
+ virtual void Serialize(AString & a_Data) const override;
+
+ virtual cPacket* Clone() const { return new cPacket_PlayerListItem(*this); }
+
+ AString m_PlayerName; // Supports chat coloring, limited to 16 characters.
+ bool m_Online;
+ short m_Ping;
+} ;
+
+
+
+
+
+class cPacket_PlayerLook : public cPacket
+{
+public:
+ cPacket_PlayerLook()
+ : m_Rotation( 0 )
+ , m_Pitch( 0 )
+ , m_bFlying( false )
+ { m_PacketID = E_PLAYERLOOK; }
+ cPacket_PlayerLook( cPlayer* a_Player );
+ virtual cPacket* Clone() const { return new cPacket_PlayerLook(*this); }
+
+ virtual int Parse(const char * a_Data, int a_Size) override;
+ virtual void Serialize(AString & a_Data) const override;
+
+ float m_Rotation;
+ float m_Pitch;
+ bool m_bFlying; // Yeah.. wtf
+} ;
+
+
+
+
+
+class cPacket_PlayerMoveLook : public cPacket
+{
+public:
+ cPacket_PlayerMoveLook()
+ : m_PosX( 0.0 )
+ , m_PosY( 0.0 )
+ , m_Stance( 0.0 )
+ , m_PosZ( 0.0 )
+ , m_Rotation( 0.f )
+ , m_Pitch( 0.f )
+ , m_bFlying( false )
+ { m_PacketID = E_PLAYERMOVELOOK; }
+ cPacket_PlayerMoveLook( cPlayer* a_Player );
+ virtual cPacket* Clone() const { return new cPacket_PlayerMoveLook(*this); }
+
+ virtual int Parse(const char * a_Data, int a_Size) override;
+ virtual void Serialize(AString & a_Data) const override;
+
+ double m_PosX;
+ double m_PosY;
+ double m_Stance;
+ double m_PosZ;
+ float m_Rotation;
+ float m_Pitch;
+ bool m_bFlying; // Yeah.. wtf
+} ;
+
+
+
+
+
+class cPacket_PlayerPosition : public cPacket
+{
+public:
+ cPacket_PlayerPosition( cPlayer* a_Player );
+ cPacket_PlayerPosition()
+ : m_PosX( 0.0 )
+ , m_PosY( 0.0 )
+ , m_Stance( 0.0 )
+ , m_PosZ( 0.0 )
+ , m_bFlying( false )
+ { m_PacketID = E_PLAYERPOS; }
+ virtual cPacket* Clone() const { return new cPacket_PlayerPosition(*this); }
+
+ virtual int Parse(const char * a_Data, int a_Size) override;
+ virtual void Serialize(AString & a_Data) const override;
+
+ double m_PosX;
+ double m_PosY;
+ double m_Stance;
+ double m_PosZ;
+ bool m_bFlying; // Yeah.. wtf
+} ;
+
+
+
+
diff --git a/source/packets/cPacket_PlayerListItem.cpp b/source/packets/cPacket_PlayerListItem.cpp
deleted file mode 100644
index 3f8be2bde..000000000
--- a/source/packets/cPacket_PlayerListItem.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-
-#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
-
-#include "cPacket_PlayerListItem.h"
-#include "../cChatColor.h"
-
-
-
-
-
-cPacket_PlayerListItem::cPacket_PlayerListItem(const AString & a_PlayerName, bool a_Online, short a_Ping)
-{
- m_PacketID = E_PLAYER_LIST_ITEM;
- m_PlayerName = a_PlayerName;
- m_Online = a_Online;
- m_Ping = a_Ping;
-}
-
-
-
-
-
-int cPacket_PlayerListItem::Parse(const char * a_Data, int a_Size)
-{
- int TotalBytes = 0;
- HANDLE_PACKET_READ(ReadString16, m_PlayerName, TotalBytes);
- HANDLE_PACKET_READ(ReadBool, m_Online, TotalBytes);
- HANDLE_PACKET_READ(ReadShort, m_Ping, TotalBytes);
- return TotalBytes;
-}
-
-
-
-
-
-void cPacket_PlayerListItem::Serialize(AString & a_Data) const
-{
- AString PlayerName(m_PlayerName);
- if (PlayerName.length() > 16)
- {
- PlayerName.erase(16);
- }
- else if (PlayerName.length() <= 14)
- {
- PlayerName += cChatColor::White;
- }
-
- AppendByte (a_Data, m_PacketID);
- AppendString16(a_Data, PlayerName);
- AppendBool (a_Data, m_Online);
- AppendShort (a_Data, m_Ping);
-}
-
-
-
-
diff --git a/source/packets/cPacket_PlayerListItem.h b/source/packets/cPacket_PlayerListItem.h
deleted file mode 100644
index 45395c556..000000000
--- a/source/packets/cPacket_PlayerListItem.h
+++ /dev/null
@@ -1,30 +0,0 @@
-
-#pragma once
-
-#include "cPacket.h"
-
-
-
-
-
-class cPacket_PlayerListItem : public cPacket
-{
-public:
- cPacket_PlayerListItem() { m_PacketID = E_PLAYER_LIST_ITEM; }
- cPacket_PlayerListItem(const AString & a_PlayerName, bool a_Online, short a_Ping);
-
- virtual int Parse(const char * a_Data, int a_Size) override;
- virtual void Serialize(AString & a_Data) const override;
-
- virtual cPacket* Clone() const { return new cPacket_PlayerListItem(*this); }
-
- AString m_PlayerName; // Supports chat coloring, limited to 16 characters.
- bool m_Online;
- short m_Ping;
-
- static const unsigned int c_Size = 6; // Minimal size ( 6 + string )
-};
-
-
-
-
diff --git a/source/packets/cPacket_PlayerLook.cpp b/source/packets/cPacket_PlayerLook.cpp
deleted file mode 100644
index 75adcf38c..000000000
--- a/source/packets/cPacket_PlayerLook.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-
-#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
-
-#include "cPacket_PlayerLook.h"
-#include "../cPlayer.h"
-
-
-
-
-
-cPacket_PlayerLook::cPacket_PlayerLook( cPlayer* a_Player )
-{
- m_PacketID = E_PLAYERLOOK;
- m_Rotation = a_Player->GetRotation();
- m_Pitch = a_Player->GetPitch();
- m_bFlying = a_Player->GetFlying();
-}
-
-
-
-
-
-int cPacket_PlayerLook::Parse(const char * a_Data, int a_Size)
-{
- int TotalBytes = 0;
- HANDLE_PACKET_READ(ReadFloat, m_Rotation, TotalBytes);
- HANDLE_PACKET_READ(ReadFloat, m_Pitch, TotalBytes);
- HANDLE_PACKET_READ(ReadBool, m_bFlying, TotalBytes);
- return TotalBytes;
-}
-
-
-
-
-
-void cPacket_PlayerLook::Serialize(AString & a_Data) const
-{
- AppendByte (a_Data, m_PacketID);
- AppendFloat (a_Data, m_Rotation);
- AppendFloat (a_Data, m_Pitch);
- AppendBool (a_Data, m_bFlying);
-}
-
-
-
-
diff --git a/source/packets/cPacket_PlayerLook.h b/source/packets/cPacket_PlayerLook.h
deleted file mode 100644
index aed8a954d..000000000
--- a/source/packets/cPacket_PlayerLook.h
+++ /dev/null
@@ -1,39 +0,0 @@
-
-#pragma once
-
-#include "cPacket.h"
-
-
-
-
-
-class cPlayer;
-
-
-
-
-
-class cPacket_PlayerLook : public cPacket
-{
-public:
- cPacket_PlayerLook()
- : m_Rotation( 0 )
- , m_Pitch( 0 )
- , m_bFlying( false )
- { m_PacketID = E_PLAYERLOOK; }
- cPacket_PlayerLook( cPlayer* a_Player );
- virtual cPacket* Clone() const { return new cPacket_PlayerLook(*this); }
-
- virtual int Parse(const char * a_Data, int a_Size) override;
- virtual void Serialize(AString & a_Data) const override;
-
- float m_Rotation;
- float m_Pitch;
- bool m_bFlying; // Yeah.. wtf
-
- static const unsigned int c_Size = 10;
-};
-
-
-
-
diff --git a/source/packets/cPacket_PlayerMoveLook.cpp b/source/packets/cPacket_PlayerMoveLook.cpp
deleted file mode 100644
index 4b0af62e1..000000000
--- a/source/packets/cPacket_PlayerMoveLook.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-
-#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
-
-#include "cPacket_PlayerMoveLook.h"
-#include "../cPlayer.h"
-
-
-
-
-
-cPacket_PlayerMoveLook::cPacket_PlayerMoveLook( cPlayer* a_Player )
-{
- m_PacketID = E_PLAYERMOVELOOK;
- m_PosX = a_Player->GetPosX();
- m_PosY = a_Player->GetPosY() + 1.65;
- m_PosZ = a_Player->GetPosZ();
- m_Stance = a_Player->GetStance();
- m_Rotation = a_Player->GetRotation();
- m_Pitch = a_Player->GetPitch();
- m_bFlying = a_Player->GetFlying();
-}
-
-
-
-
-
-int cPacket_PlayerMoveLook::Parse(const char * a_Data, int a_Size)
-{
- int TotalBytes = 0;
- HANDLE_PACKET_READ(ReadDouble, m_PosX, TotalBytes);
- HANDLE_PACKET_READ(ReadDouble, m_PosY, TotalBytes);
- HANDLE_PACKET_READ(ReadDouble, m_Stance, TotalBytes);
- HANDLE_PACKET_READ(ReadDouble, m_PosZ, TotalBytes);
- HANDLE_PACKET_READ(ReadFloat, m_Rotation, TotalBytes);
- HANDLE_PACKET_READ(ReadFloat, m_Pitch, TotalBytes);
- HANDLE_PACKET_READ(ReadBool, m_bFlying, TotalBytes);
- return TotalBytes;
-}
-
-
-
-
-
-void cPacket_PlayerMoveLook::Serialize(AString & a_Data) const
-{
- AppendByte (a_Data, m_PacketID);
- AppendDouble(a_Data, m_PosX);
- AppendDouble(a_Data, m_PosY);
- AppendDouble(a_Data, m_Stance);
- AppendDouble(a_Data, m_PosZ);
- AppendFloat (a_Data, m_Rotation);
- AppendFloat (a_Data, m_Pitch);
- AppendBool (a_Data, m_bFlying);
-}
-
-
-
-
diff --git a/source/packets/cPacket_PlayerMoveLook.h b/source/packets/cPacket_PlayerMoveLook.h
deleted file mode 100644
index c36698839..000000000
--- a/source/packets/cPacket_PlayerMoveLook.h
+++ /dev/null
@@ -1,43 +0,0 @@
-
-#pragma once
-
-#include "cPacket.h"
-
-
-
-
-
-class cPlayer;
-
-
-
-
-
-class cPacket_PlayerMoveLook : public cPacket
-{
-public:
- cPacket_PlayerMoveLook()
- : m_PosX( 0.0 )
- , m_PosY( 0.0 )
- , m_Stance( 0.0 )
- , m_PosZ( 0.0 )
- , m_Rotation( 0.f )
- , m_Pitch( 0.f )
- , m_bFlying( false )
- { m_PacketID = E_PLAYERMOVELOOK; }
- cPacket_PlayerMoveLook( cPlayer* a_Player );
- virtual cPacket* Clone() const { return new cPacket_PlayerMoveLook(*this); }
-
- virtual int Parse(const char * a_Data, int a_Size) override;
- virtual void Serialize(AString & a_Data) const override;
-
- double m_PosX;
- double m_PosY;
- double m_Stance;
- double m_PosZ;
- float m_Rotation;
- float m_Pitch;
- bool m_bFlying; // Yeah.. wtf
-
- static const unsigned int c_Size = 42;
-};
diff --git a/source/packets/cPacket_PlayerPosition.cpp b/source/packets/cPacket_PlayerPosition.cpp
deleted file mode 100644
index 3dae343dd..000000000
--- a/source/packets/cPacket_PlayerPosition.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-
-#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
-
-#include "cPacket_PlayerPosition.h"
-#include "../cPlayer.h"
-
-
-
-
-
-cPacket_PlayerPosition::cPacket_PlayerPosition( cPlayer* a_Player )
-{
- m_PacketID = E_PLAYERPOS;
-
- m_PosX = a_Player->GetPosX();
- m_PosY = a_Player->GetPosY() + 1.65;
- m_PosZ = a_Player->GetPosZ();
- m_Stance = a_Player->GetStance();
- m_bFlying = a_Player->GetFlying();
-}
-
-
-
-
-
-int cPacket_PlayerPosition::Parse(const char * a_Data, int a_Size)
-{
- int TotalBytes = 0;
- HANDLE_PACKET_READ(ReadDouble, m_PosX, TotalBytes);
- HANDLE_PACKET_READ(ReadDouble, m_PosY, TotalBytes);
- HANDLE_PACKET_READ(ReadDouble, m_Stance, TotalBytes);
- HANDLE_PACKET_READ(ReadDouble, m_PosZ, TotalBytes);
- HANDLE_PACKET_READ(ReadBool, m_bFlying, TotalBytes);
- return TotalBytes;
-}
-
-
-
-
-
-void cPacket_PlayerPosition::Serialize(AString & a_Data) const
-{
- AppendByte (a_Data, m_PacketID);
- AppendDouble (a_Data, m_PosX);
- AppendDouble (a_Data, m_PosY);
- AppendDouble (a_Data, m_Stance);
- AppendDouble (a_Data, m_PosZ);
- AppendBool (a_Data, m_bFlying);
-}
-
-
-
-
diff --git a/source/packets/cPacket_PlayerPosition.h b/source/packets/cPacket_PlayerPosition.h
deleted file mode 100644
index f883b6a4d..000000000
--- a/source/packets/cPacket_PlayerPosition.h
+++ /dev/null
@@ -1,44 +0,0 @@
-
-#pragma once
-
-#include "cPacket.h"
-
-
-
-
-
-
-class cPlayer;
-
-
-
-
-
-class cPacket_PlayerPosition : public cPacket
-{
-public:
- cPacket_PlayerPosition( cPlayer* a_Player );
- cPacket_PlayerPosition()
- : m_PosX( 0.0 )
- , m_PosY( 0.0 )
- , m_Stance( 0.0 )
- , m_PosZ( 0.0 )
- , m_bFlying( false )
- { m_PacketID = E_PLAYERPOS; }
- virtual cPacket* Clone() const { return new cPacket_PlayerPosition(*this); }
-
- virtual int Parse(const char * a_Data, int a_Size) override;
- virtual void Serialize(AString & a_Data) const override;
-
- double m_PosX;
- double m_PosY;
- double m_Stance;
- double m_PosZ;
- bool m_bFlying; // Yeah.. wtf
-
- static const unsigned int c_Size = 34;
-};
-
-
-
-