From 1b178ce6d0a16f1df280bc596237e877061d7455 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 1 Jan 2016 05:35:48 +1000 Subject: [PATCH] Rename PHYS_DEAD to IS_DEAD and make it usable outside of player physics --- qcsrc/client/miscfunctions.qh | 3 +++ qcsrc/common/mutators/mutator/dodging/dodging.qc | 2 +- qcsrc/common/physics/player.qc | 2 +- qcsrc/common/physics/player.qh | 4 ---- qcsrc/common/triggers/func/door.qc | 10 +++++----- qcsrc/common/triggers/platforms.qc | 2 +- qcsrc/common/triggers/teleporters.qc | 4 ++-- qcsrc/common/triggers/trigger/swamp.qc | 2 +- qcsrc/common/triggers/trigger/teleport.qc | 2 +- qcsrc/server/miscfunctions.qh | 2 ++ 10 files changed, 17 insertions(+), 16 deletions(-) diff --git a/qcsrc/client/miscfunctions.qh b/qcsrc/client/miscfunctions.qh index 3066fc6c6..a2fa4edce 100644 --- a/qcsrc/client/miscfunctions.qh +++ b/qcsrc/client/miscfunctions.qh @@ -35,6 +35,9 @@ float PreviewExists(string name); vector rotate(vector v, float a); +#define IS_DEAD(s) (((s).classname == "csqcmodel") ? (s).csqcmodel_isdead : ((s).health <= 0)) + + // decolorizes and team colors the player name when needed string playername(string thename, float teamid); diff --git a/qcsrc/common/mutators/mutator/dodging/dodging.qc b/qcsrc/common/mutators/mutator/dodging/dodging.qc index 7be7d6939..915dbe663 100644 --- a/qcsrc/common/mutators/mutator/dodging/dodging.qc +++ b/qcsrc/common/mutators/mutator/dodging/dodging.qc @@ -176,7 +176,7 @@ void PM_dodging(entity this) if (!PHYS_DODGING) return; - if (PHYS_DEAD(this)) + if (IS_DEAD(this)) return; // when swimming, no dodging allowed.. diff --git a/qcsrc/common/physics/player.qc b/qcsrc/common/physics/player.qc index bd79aa648..4465e5da6 100644 --- a/qcsrc/common/physics/player.qc +++ b/qcsrc/common/physics/player.qc @@ -1446,7 +1446,7 @@ void PM_Main(entity this) } #endif - if(PHYS_DEAD(this)) + if(IS_DEAD(this)) { // handle water here vector midpoint = ((this.absmin + this.absmax) * 0.5); diff --git a/qcsrc/common/physics/player.qh b/qcsrc/common/physics/player.qh index 978649026..ea318c5b0 100644 --- a/qcsrc/common/physics/player.qh +++ b/qcsrc/common/physics/player.qh @@ -199,8 +199,6 @@ bool IsFlying(entity a); #define PHYS_INPUT_BUTTON_BUTTON15(s) boolean(input_buttons & BIT(17)) #define PHYS_INPUT_BUTTON_BUTTON16(s) boolean(input_buttons & BIT(18)) - #define PHYS_DEAD(s) ((s).csqcmodel_isdead) - #define GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE (boolean(moveflags & MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE)) #define GAMEPLAYFIX_NOGRAVITYONGROUND (boolean(moveflags & MOVEFLAG_NOGRAVITYONGROUND)) #define GAMEPLAYFIX_Q2AIRACCELERATE (boolean(moveflags & MOVEFLAG_Q2AIRACCELERATE)) @@ -261,8 +259,6 @@ bool IsFlying(entity a); #define PHYS_INPUT_BUTTON_BUTTON15(s) ((s).button15) #define PHYS_INPUT_BUTTON_BUTTON16(s) ((s).button16) - #define PHYS_DEAD(s) ((s).deadflag != DEAD_NO) - #define GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE autocvar_sv_gameplayfix_gravityunaffectedbyticrate #define GAMEPLAYFIX_NOGRAVITYONGROUND autocvar_sv_gameplayfix_nogravityonground #define GAMEPLAYFIX_Q2AIRACCELERATE autocvar_sv_gameplayfix_q2airaccelerate diff --git a/qcsrc/common/triggers/func/door.qc b/qcsrc/common/triggers/func/door.qc index 35a2ff8f7..99ee91f82 100644 --- a/qcsrc/common/triggers/func/door.qc +++ b/qcsrc/common/triggers/func/door.qc @@ -31,7 +31,7 @@ void door_blocked() #ifdef SVQC && (other.takedamage != DAMAGE_NO) #elif defined(CSQC) - && !PHYS_DEAD(other) + && !IS_DEAD(other) #endif ) { // KIll Kill Kill!! @@ -47,7 +47,7 @@ void door_blocked() #endif // don't change direction for dead or dying stuff - if(PHYS_DEAD(other) + if(IS_DEAD(other) #ifdef SVQC && (other.takedamage == DAMAGE_NO) #endif @@ -339,7 +339,7 @@ void door_generic_plat_blocked() #endif //Dont chamge direction for dead or dying stuff - if(PHYS_DEAD(other) && (other.takedamage == DAMAGE_NO)) + if(IS_DEAD(other) && (other.takedamage == DAMAGE_NO)) { if (self.wait >= 0) { @@ -432,9 +432,9 @@ void door_trigger_touch() {SELFPARAM(); if (other.health < 1) #ifdef SVQC - if (!((other.iscreature || (other.flags & FL_PROJECTILE)) && !PHYS_DEAD(other))) + if (!((other.iscreature || (other.flags & FL_PROJECTILE)) && !IS_DEAD(other))) #elif defined(CSQC) - if(!((IS_CLIENT(other) || other.classname == "csqcprojectile") && !PHYS_DEAD(other))) + if(!((IS_CLIENT(other) || other.classname == "csqcprojectile") && !IS_DEAD(other))) #endif return; diff --git a/qcsrc/common/triggers/platforms.qc b/qcsrc/common/triggers/platforms.qc index 11f0bd002..5eb47fa36 100644 --- a/qcsrc/common/triggers/platforms.qc +++ b/qcsrc/common/triggers/platforms.qc @@ -103,7 +103,7 @@ void plat_center_touch() #elif defined(CSQC) if (!IS_PLAYER(other)) return; - if(PHYS_DEAD(other)) + if(IS_DEAD(other)) return; #endif diff --git a/qcsrc/common/triggers/teleporters.qc b/qcsrc/common/triggers/teleporters.qc index 37ab1f694..1050f8ebd 100644 --- a/qcsrc/common/triggers/teleporters.qc +++ b/qcsrc/common/triggers/teleporters.qc @@ -22,7 +22,7 @@ float check_tdeath(entity player, vector org, vector telefragmin, vector telefragmax) { - if (IS_PLAYER(player) && !PHYS_DEAD(player)) + if (IS_PLAYER(player) && !IS_DEAD(player)) { TDEATHLOOP(org) { @@ -30,7 +30,7 @@ float check_tdeath(entity player, vector org, vector telefragmin, vector telefra if (!(teamplay && autocvar_g_telefrags_teamplay && head.team == player.team)) #endif if(IS_PLAYER(head)) - if(!PHYS_DEAD(head)) + if(!IS_DEAD(head)) return 1; } } diff --git a/qcsrc/common/triggers/trigger/swamp.qc b/qcsrc/common/triggers/trigger/swamp.qc index 89aa02fe4..ad9c872da 100644 --- a/qcsrc/common/triggers/trigger/swamp.qc +++ b/qcsrc/common/triggers/trigger/swamp.qc @@ -64,7 +64,7 @@ void swamp_touch() {SELFPARAM(); // If whatever thats touching the swamp is not a player // or if its a dead player, just dont care abt it. - if(!IS_PLAYER(other) || PHYS_DEAD(other)) + if(!IS_PLAYER(other) || IS_DEAD(other)) return; EXACTTRIGGER_TOUCH; diff --git a/qcsrc/common/triggers/trigger/teleport.qc b/qcsrc/common/triggers/trigger/teleport.qc index 5735f0bb5..c013eb867 100644 --- a/qcsrc/common/triggers/trigger/teleport.qc +++ b/qcsrc/common/triggers/trigger/teleport.qc @@ -31,7 +31,7 @@ void Teleport_Touch () return; #endif - if(PHYS_DEAD(other)) + if(IS_DEAD(other)) return; if(self.team) diff --git a/qcsrc/server/miscfunctions.qh b/qcsrc/server/miscfunctions.qh index 9df9042aa..4cb4e20b3 100644 --- a/qcsrc/server/miscfunctions.qh +++ b/qcsrc/server/miscfunctions.qh @@ -117,6 +117,8 @@ void WarpZone_crosshair_trace(entity pl); void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag); +#define IS_DEAD(s) ((s).deadflag != DEAD_NO) + #define ITEM_TOUCH_NEEDKILL() (((trace_dpstartcontents | trace_dphitcontents) & DPCONTENTS_NODROP) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)) #define ITEM_DAMAGE_NEEDKILL(dt) (((dt) == DEATH_HURTTRIGGER.m_id) || ((dt) == DEATH_SLIME.m_id) || ((dt) == DEATH_LAVA.m_id) || ((dt) == DEATH_SWAMP.m_id)) -- 2.39.2