From 487c57242964ef4a86fc4f41c1c538d9df9ec892 Mon Sep 17 00:00:00 2001 From: archshift Date: Tue, 29 Jul 2014 19:14:56 -0700 Subject: Entity.h: Moved constants out of some unnamed enum --- src/Entities/Entity.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/Entities/Entity.h') diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index e66194ca2..b9c280b6b 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -128,20 +128,20 @@ public: esFireworkExploding = 17, } ; - enum - { - FIRE_TICKS_PER_DAMAGE = 10, ///< How many ticks to wait between damaging an entity when it stands in fire - FIRE_DAMAGE = 1, ///< How much damage to deal when standing in fire - LAVA_TICKS_PER_DAMAGE = 10, ///< How many ticks to wait between damaging an entity when it stands in lava - LAVA_DAMAGE = 5, ///< How much damage to deal when standing in lava - BURN_TICKS_PER_DAMAGE = 20, ///< How many ticks to wait between damaging an entity when it is burning - BURN_DAMAGE = 1, ///< How much damage to deal when the entity is burning - BURN_TICKS = 200, ///< How long to keep an entity burning after it has stood in lava / fire - MAX_AIR_LEVEL = 300, ///< Maximum air an entity can have - DROWNING_TICKS = 20, ///< Number of ticks per heart of damage - VOID_BOUNDARY = -46, ///< At what position Y to begin applying void damage - FALL_DAMAGE_HEIGHT = 4 ///< At what position Y fall damage is applied - } ; + static const int FIRE_TICKS_PER_DAMAGE = 10; ///< Ticks to wait between damaging an entity when it stands in fire + static const int FIRE_DAMAGE = 1; ///< Damage to deal when standing in fire + static const int LAVA_TICKS_PER_DAMAGE = 10; ///< Ticks to wait between damaging an entity when it stands in lava + static const int LAVA_DAMAGE = 5; ///< Damage to deal when standing in lava + static const int BURN_TICKS_PER_DAMAGE = 20; ///< Ticks to wait between damaging an entity when it is burning + static const int BURN_DAMAGE = 1; ///< Damage to deal when the entity is burning + + static const int BURN_TICKS = 200; ///< Ticks to keep an entity burning after it has stood in lava / fire + + static const int MAX_AIR_LEVEL = 300; ///< Maximum air an entity can have + static const int DROWNING_TICKS = 20; ///< Number of ticks per heart of damage + + static const int VOID_BOUNDARY = -46; ///< Y position to begin applying void damage + static const int FALL_DAMAGE_HEIGHT = 4; ///< Y difference after which fall damage is applied cEntity(eEntityType a_EntityType, double a_X, double a_Y, double a_Z, double a_Width, double a_Height); virtual ~cEntity(); -- cgit v1.2.3 From dfed6f94ca78f2e104ed316d83400b0ca74cb79a Mon Sep 17 00:00:00 2001 From: Howaner Date: Mon, 1 Sep 2014 21:05:45 +0200 Subject: Added name tag --- src/Entities/Entity.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Entities/Entity.h') diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index b9c280b6b..774cdb062 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -447,7 +447,7 @@ public: // tolua_end /// Called when the specified player right-clicks this entity - virtual void OnRightClicked(cPlayer &) {} + virtual void OnRightClicked(cPlayer & a_Player) {} /// Returns the list of drops for this pawn when it is killed. May check a_Killer for special handling (sword of looting etc.). Called from KilledBy(). virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) -- cgit v1.2.3 From 52d86728e69023f8d70c84f019335b713453aa2d Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 13 Sep 2014 22:49:05 +0100 Subject: Entities experience water resistance --- src/Entities/Entity.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/Entities/Entity.h') diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index b9c280b6b..6bc070dcc 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -535,6 +535,12 @@ protected: virtual void Destroyed(void) {} // Called after the entity has been destroyed + /** Applies friction to an entity + @param a_Speed The speed vector to apply changes to + @param a_SlowdownMultiplier The factor to reduce the speed by + */ + static void ApplyFriction(Vector3d & a_Speed, double a_SlowdownMultiplier, float a_Dt); + /** Called in each tick to handle air-related processing i.e. drowning */ virtual void HandleAir(void); -- cgit v1.2.3 From f8d1e96ae7ac9a3483ff0a214796455946d7880f Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 3 Sep 2014 16:25:45 -0700 Subject: Use static casts instead of C casts, add floor-cast functions --- src/Entities/Entity.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Entities/Entity.h') diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index 3fa7e80c1..0a03eb3f2 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -27,9 +27,9 @@ return super::GetClass(); \ } -#define POSX_TOINT (int)floor(GetPosX()) -#define POSY_TOINT (int)floor(GetPosY()) -#define POSZ_TOINT (int)floor(GetPosZ()) +#define POSX_TOINT FloorD(GetPosX()) +#define POSY_TOINT FloorD(GetPosY()) +#define POSZ_TOINT FloorD(GetPosZ()) #define POS_TOINT Vector3i(POSXTOINT, POSYTOINT, POSZTOINT) #define GET_AND_VERIFY_CURRENT_CHUNK(ChunkVarName, X, Z) cChunk * ChunkVarName = a_Chunk.GetNeighborChunk(X, Z); if ((ChunkVarName == NULL) || !ChunkVarName->IsValid()) { return; } -- cgit v1.2.3 From 76b37acb421bf10e094182b2e9be111eb29c46f1 Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 3 Sep 2014 16:51:38 -0700 Subject: Float/Ciel: If it's going to use C++11, it might as well take advantage of it --- src/Entities/Entity.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Entities/Entity.h') diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index 0a03eb3f2..f0577aba2 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -27,9 +27,9 @@ return super::GetClass(); \ } -#define POSX_TOINT FloorD(GetPosX()) -#define POSY_TOINT FloorD(GetPosY()) -#define POSZ_TOINT FloorD(GetPosZ()) +#define POSX_TOINT FloorC(GetPosX()) +#define POSY_TOINT FloorC(GetPosY()) +#define POSZ_TOINT FloorC(GetPosZ()) #define POS_TOINT Vector3i(POSXTOINT, POSYTOINT, POSZTOINT) #define GET_AND_VERIFY_CURRENT_CHUNK(ChunkVarName, X, Z) cChunk * ChunkVarName = a_Chunk.GetNeighborChunk(X, Z); if ((ChunkVarName == NULL) || !ChunkVarName->IsValid()) { return; } -- cgit v1.2.3