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_EntityLook.h"
|
|
|
|
|
2012-01-27 06:04:28 -08:00
|
|
|
#include "../cEntity.h"
|
2011-10-03 11:41:19 -07:00
|
|
|
|
2012-01-29 11:28:19 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-10-03 11:41:19 -07:00
|
|
|
cPacket_EntityLook::cPacket_EntityLook(cEntity* a_Entity)
|
|
|
|
{
|
|
|
|
m_PacketID = E_ENT_LOOK;
|
|
|
|
|
|
|
|
m_UniqueID = a_Entity->GetUniqueID();
|
|
|
|
m_Rotation = (char)((a_Entity->GetRotation()/360.f)*256);
|
|
|
|
m_Pitch = (char)((a_Entity->GetPitch()/360.f)*256);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cPacket_EntityLook::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_UniqueID, Message, i );
|
|
|
|
AppendByte ( m_Rotation, Message, i );
|
|
|
|
AppendByte ( m_Pitch, Message, i );
|
|
|
|
|
|
|
|
bool RetVal = !cSocket::IsSocketError( SendData( a_Socket, Message, TotalSize, 0 ) );
|
|
|
|
delete [] Message;
|
|
|
|
return RetVal;
|
|
|
|
}
|