From 7f5cf417de5e83641e6aa0998cc9dc8b377346b6 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 23 Apr 2014 21:06:46 +0100 Subject: Some change to Entity.cpp * Added comments to BroadcastMovementUpdate() and the collision tracer --- src/Entities/Entity.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/Entities/Entity.h') diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index 8f3899e2f..354e324c9 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -417,17 +417,14 @@ protected: // Flags that signal that we haven't updated the clients with the latest. bool m_bDirtyHead; bool m_bDirtyOrientation; - bool m_bDirtyPosition; - bool m_bDirtySpeed; + bool m_bHasSentNoSpeed; bool m_bOnGround; float m_Gravity; - // Last Position. - double m_LastPosX, m_LastPosY, m_LastPosZ; - - // This variables keep track of the last time a packet was sent - Int64 m_TimeLastTeleportPacket, m_TimeLastMoveReltPacket, m_TimeLastSpeedPacket; // In ticks + /** Last position sent to client via the Relative Move or Teleport packets (not Velocity) + Only updated if cEntity::BroadcastMovementUpdate() is called! */ + Vector3d m_LastPos; bool m_IsInitialized; // Is set to true when it's initialized, until it's destroyed (Initialize() till Destroy() ) -- cgit v1.2.3 From b4b3b5ce6480419bb18bafa6650dd09ea5544441 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 26 Apr 2014 23:50:24 +0100 Subject: More comments! * Also fixed a potential issue with position sending - if someone moved slowly enough, their position would never be updated. --- src/Entities/Entity.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/Entities/Entity.h') diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index 0785b5609..22b133fb7 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -419,19 +419,26 @@ protected: /// The entity which is attached to this entity (rider), NULL if none cEntity * m_Attachee; - // Flags that signal that we haven't updated the clients with the latest. + /** Stores whether head yaw has been set manually */ bool m_bDirtyHead; + /** Stores whether our yaw/pitch/roll (body orientation) has been set manually */ bool m_bDirtyOrientation; + /** Stores whether we have sent a Velocity packet with a speed of zero (no speed) to the client + Ensures that said packet is sent only once */ bool m_bHasSentNoSpeed; + /** Stores if the entity is on the ground */ bool m_bOnGround; + /** Stores gravity that is applied to an entity every tick + For realistic effects, this should be negative. For spaaaaaaace, this can be zero or even positive */ float m_Gravity; /** Last position sent to client via the Relative Move or Teleport packets (not Velocity) Only updated if cEntity::BroadcastMovementUpdate() is called! */ Vector3d m_LastPos; - bool m_IsInitialized; // Is set to true when it's initialized, until it's destroyed (Initialize() till Destroy() ) + /** True when entity is initialised (Initialize()) and false when destroyed pending deletion (Destroy()) */ + bool m_IsInitialized; eEntityType m_EntityType; -- cgit v1.2.3 From 5082d55e853d0067301d73dc98ce0f177a76bc7f Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 2 May 2014 19:40:12 +0200 Subject: A bit of reformatting. --- src/Entities/Entity.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/Entities/Entity.h') diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index fe91915cd..df03d635b 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -431,18 +431,21 @@ protected: cEntity * m_Attachee; /** Stores whether head yaw has been set manually */ - bool m_bDirtyHead; + bool m_bDirtyHead; + /** Stores whether our yaw/pitch/roll (body orientation) has been set manually */ - bool m_bDirtyOrientation; + bool m_bDirtyOrientation; + /** Stores whether we have sent a Velocity packet with a speed of zero (no speed) to the client Ensures that said packet is sent only once */ - bool m_bHasSentNoSpeed; + bool m_bHasSentNoSpeed; /** Stores if the entity is on the ground */ - bool m_bOnGround; + bool m_bOnGround; + /** Stores gravity that is applied to an entity every tick For realistic effects, this should be negative. For spaaaaaaace, this can be zero or even positive */ - float m_Gravity; + float m_Gravity; /** Last position sent to client via the Relative Move or Teleport packets (not Velocity) Only updated if cEntity::BroadcastMovementUpdate() is called! */ @@ -473,12 +476,14 @@ protected: /// Time, in ticks, since the last damage dealt by the void. Reset to zero when moving out of the void. int m_TicksSinceLastVoidDamage; + virtual void Destroyed(void) {} // Called after the entity has been destroyed void SetWorld(cWorld * a_World) { m_World = a_World; } /** Called in each tick to handle air-related processing i.e. drowning */ virtual void HandleAir(); + /** Called once per tick to set IsSwimming and IsSubmerged */ virtual void SetSwimState(cChunk & a_Chunk); -- cgit v1.2.3