void cProtocol125::SendEntityVelocity(const cEntity & a_Entity) { ASSERT(a_Entity.GetUniqueID() != m_Client->GetPlayer()->GetUniqueID()); // Must not send for self cCSLock Lock(m_CSPacket); WriteByte(PACKET_ENTITY_VELOCITY); WriteInt (a_Entity.GetUniqueID()); WriteShort((short) (a_Entity.GetSpeedX() * 400)); //400 = 8000 / 20 WriteShort((short) (a_Entity.GetSpeedY() * 400)); WriteShort((short) (a_Entity.GetSpeedZ() * 400)); Flush(); }
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(); }
void cProtocol146::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) { cCSLock Lock(m_CSPacket); WriteByte(PACKET_SPAWN_OBJECT); WriteInt (a_Entity.GetUniqueID()); WriteByte(a_ObjectType); WriteInt ((int)(a_Entity.GetPosX() * 32)); WriteInt ((int)(a_Entity.GetPosY() * 32)); WriteInt ((int)(a_Entity.GetPosZ() * 32)); WriteByte(a_Pitch); WriteByte(a_Yaw); WriteInt (a_ObjectData); if (a_ObjectData != 0) { WriteShort((short)(a_Entity.GetSpeedX() * 400)); WriteShort((short)(a_Entity.GetSpeedY() * 400)); WriteShort((short)(a_Entity.GetSpeedZ() * 400)); } Flush(); }