2012-01-29 11:28:19 -08:00
|
|
|
|
|
|
|
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
|
|
|
|
2011-10-03 11:41:19 -07:00
|
|
|
#include "cPacket_PlayerLook.h"
|
|
|
|
#include "../cPlayer.h"
|
|
|
|
|
2012-01-29 11:28:19 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-10-03 11:41:19 -07:00
|
|
|
cPacket_PlayerLook::cPacket_PlayerLook( cPlayer* a_Player )
|
|
|
|
{
|
|
|
|
m_PacketID = E_PLAYERLOOK;
|
|
|
|
m_Rotation = a_Player->GetRotation();
|
2012-02-07 12:49:52 -08:00
|
|
|
m_Pitch = a_Player->GetPitch();
|
|
|
|
m_bFlying = a_Player->GetFlying();
|
2011-10-03 11:41:19 -07:00
|
|
|
}
|
|
|
|
|
2012-02-07 12:49:52 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int cPacket_PlayerLook::Parse(const char * a_Data, int a_Size)
|
2011-10-03 11:41:19 -07:00
|
|
|
{
|
2012-02-07 12:49:52 -08:00
|
|
|
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;
|
2011-10-03 11:41:19 -07:00
|
|
|
}
|
|
|
|
|
2012-02-07 12:49:52 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void cPacket_PlayerLook::Serialize(AString & a_Data) const
|
2011-10-03 11:41:19 -07:00
|
|
|
{
|
2012-02-07 12:49:52 -08:00
|
|
|
AppendByte (a_Data, m_PacketID);
|
|
|
|
AppendFloat (a_Data, m_Rotation);
|
|
|
|
AppendFloat (a_Data, m_Pitch);
|
|
|
|
AppendBool (a_Data, m_bFlying);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|