diff options
Diffstat (limited to 'src/Protocol/Protocol_1_8.cpp')
-rw-r--r-- | src/Protocol/Protocol_1_8.cpp | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp index 7a3cd3b90..cbb13e68e 100644 --- a/src/Protocol/Protocol_1_8.cpp +++ b/src/Protocol/Protocol_1_8.cpp @@ -1136,18 +1136,37 @@ void cProtocol_1_8_0::SendPlayerListUpdatePing() -void cProtocol_1_8_0::SendPlayerMoveLook(void) +void cProtocol_1_8_0::SendPlayerMoveLook (const Vector3d a_Pos, const float a_Yaw, const float a_Pitch, const bool a_IsRelative) { ASSERT(m_State == 3); // In game mode? cPacketizer Pkt(*this, pktPlayerMoveLook); + Pkt.WriteBEDouble(a_Pos.x); + Pkt.WriteBEDouble(a_Pos.y); + Pkt.WriteBEDouble(a_Pos.z); + Pkt.WriteBEFloat(a_Yaw); + Pkt.WriteBEFloat(a_Pitch); + + if (a_IsRelative) + { + // Set all bits to 1 - makes everything relative + Pkt.WriteBEUInt8(static_cast<UInt8>(-1)); + } + else + { + // Set all bits to 0 - make everything absolute + Pkt.WriteBEUInt8(0); + } +} + + + + + +void cProtocol_1_8_0::SendPlayerMoveLook(void) +{ cPlayer * Player = m_Client->GetPlayer(); - Pkt.WriteBEDouble(Player->GetPosX()); - Pkt.WriteBEDouble(Player->GetPosY()); - Pkt.WriteBEDouble(Player->GetPosZ()); - Pkt.WriteBEFloat(static_cast<float>(Player->GetYaw())); - Pkt.WriteBEFloat(static_cast<float>(Player->GetPitch())); - Pkt.WriteBEUInt8(0); + SendPlayerMoveLook(Player->GetPosition(), static_cast<float>(Player->GetYaw()), static_cast<float>(Player->GetPitch()), false); } |