summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkeyboard.osh@gmail.com <keyboard.osh@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-04-19 06:32:18 +0200
committerkeyboard.osh@gmail.com <keyboard.osh@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-04-19 06:32:18 +0200
commit0ceadbe7e0308484fd787d2a1ee05392f91c7178 (patch)
tree29a94fc070cecdfcf743bfcce3e2c8dab7d44d3b
parentAdded BlockTNT.h to VC project file (diff)
downloadcuberite-0ceadbe7e0308484fd787d2a1ee05392f91c7178.tar
cuberite-0ceadbe7e0308484fd787d2a1ee05392f91c7178.tar.gz
cuberite-0ceadbe7e0308484fd787d2a1ee05392f91c7178.tar.bz2
cuberite-0ceadbe7e0308484fd787d2a1ee05392f91c7178.tar.lz
cuberite-0ceadbe7e0308484fd787d2a1ee05392f91c7178.tar.xz
cuberite-0ceadbe7e0308484fd787d2a1ee05392f91c7178.tar.zst
cuberite-0ceadbe7e0308484fd787d2a1ee05392f91c7178.zip
-rw-r--r--source/Player.cpp46
1 files changed, 6 insertions, 40 deletions
diff --git a/source/Player.cpp b/source/Player.cpp
index 2cb96ca9c..544503e5e 100644
--- a/source/Player.cpp
+++ b/source/Player.cpp
@@ -165,50 +165,16 @@ void cPlayer::Tick(float a_Dt, cChunk & a_Chunk)
}
super::Tick(a_Dt, a_Chunk);
- //TODO: Change this to use the BroadcastMovementUpdate function
- if (m_bDirtyOrientation && !m_bDirtyPosition)
- {
- m_World->BroadcastEntLook(*this, m_ClientHandle);
- m_World->BroadcastEntHeadLook(*this, m_ClientHandle);
- m_bDirtyOrientation = false;
- }
- else if (m_bDirtyPosition)
+ if (m_bDirtyPosition)
{
cRoot::Get()->GetPluginManager()->CallHookPlayerMoving(*this);
-
- float DiffX = (float)(GetPosX() - m_LastPosX );
- float DiffY = (float)(GetPosY() - m_LastPosY );
- float DiffZ = (float)(GetPosZ() - m_LastPosZ );
- float SqrDist = DiffX * DiffX + DiffY * DiffY + DiffZ * DiffZ;
- if (
- (SqrDist > 4 * 4) || // 4 blocks is max Relative Move
- (m_World->GetWorldAge() - m_TimeLastTeleportPacket > 40) // Send an absolute position every 2 seconds
- )
- {
- // LOG("Teleported %f", sqrtf(SqrDist) );
- m_World->BroadcastTeleportEntity(*this, m_ClientHandle);
- m_TimeLastTeleportPacket = m_World->GetWorldAge();
- }
- else
- {
- // Relative move sucks balls! It's always wrong wtf!
- if (m_bDirtyOrientation)
- {
- m_World->BroadcastEntRelMoveLook(*this, (char)(DiffX * 32), (char)(DiffY * 32), (char)(DiffZ * 32), m_ClientHandle);
- m_World->BroadcastEntHeadLook(*this, m_ClientHandle);
- m_bDirtyOrientation = false;
- }
- else
- {
- m_World->BroadcastEntRelMove(*this, (char)(DiffX * 32), (char)(DiffY * 32), (char)(DiffZ * 32), m_ClientHandle);
- }
- }
- m_LastPosX = GetPosX();
- m_LastPosY = GetPosY();
- m_LastPosZ = GetPosZ();
- m_bDirtyPosition = false;
+ BroadcastMovementUpdate(m_ClientHandle);
m_ClientHandle->StreamChunks();
}
+ else
+ {
+ BroadcastMovementUpdate(m_ClientHandle);
+ }
if (m_Health > 0) // make sure player is alive
{