Example #1
0
void cProtocol125::SendEntityLook(const cEntity & a_Entity)
{
	ASSERT(a_Entity.GetUniqueID() != m_Client->GetPlayer()->GetUniqueID());  // Must not send for self
	
	cCSLock Lock(m_CSPacket);
	WriteByte(PACKET_ENT_LOOK);
	WriteInt (a_Entity.GetUniqueID());
	WriteByte((char)((a_Entity.GetRotation() / 360.f) * 256));
	WriteByte((char)((a_Entity.GetPitch()    / 360.f) * 256));
	Flush();
}
Example #2
0
void cProtocol125::SendTeleportEntity(const cEntity & a_Entity)
{
	cCSLock Lock(m_CSPacket);
	WriteByte   (PACKET_ENT_TELEPORT);
	WriteInt    (a_Entity.GetUniqueID());
	WriteInt    ((int)(floor(a_Entity.GetPosX() * 32)));
	WriteInt    ((int)(floor(a_Entity.GetPosY() * 32)));
	WriteInt    ((int)(floor(a_Entity.GetPosZ() * 32)));
	WriteByte   ((char)((a_Entity.GetRotation() / 360.f) * 256));
	WriteByte   ((char)((a_Entity.GetPitch() / 360.f) * 256));
	Flush();
}
Example #3
0
void cProtocol125::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleType)
{
	cCSLock Lock(m_CSPacket);
	WriteByte (PACKET_SPAWN_OBJECT);
	WriteInt  (a_Vehicle.GetUniqueID());
	WriteByte (a_VehicleType);
	WriteInt  ((int)(a_Vehicle.GetPosX() * 32));
	WriteInt  ((int)(a_Vehicle.GetPosY() * 32));
	WriteInt  ((int)(a_Vehicle.GetPosZ() * 32));
	WriteByte ((Byte)((a_Vehicle.GetPitch() / 360.f) * 256));
	WriteByte ((Byte)((a_Vehicle.GetRotation() / 360.f) * 256));
	WriteInt  (1);
	WriteShort((short)(a_Vehicle.GetSpeedX() * 400));
	WriteShort((short)(a_Vehicle.GetSpeedY() * 400));
	WriteShort((short)(a_Vehicle.GetSpeedZ() * 400));
	Flush();
}