From e068d17c382da29ad2af7f659e76d1e9fd4f02f8 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 1 Jan 2016 21:20:54 +1000 Subject: [PATCH] Use IS_DEAD where possible, also fix vehicles targeting frozen enemies --- qcsrc/common/gamemodes/gamemode/nexball/nexball.qc | 2 +- qcsrc/common/monsters/sv_monsters.qc | 2 +- qcsrc/common/mutators/mutator/instagib/instagib.qc | 2 +- qcsrc/common/t_items.qc | 2 +- qcsrc/common/triggers/trigger/heal.qc | 2 +- qcsrc/common/vehicles/vehicle/bumblebee.qc | 6 +++--- qcsrc/common/vehicles/vehicle/raptor.qc | 4 ++-- qcsrc/server/bot/bot.qc | 2 +- qcsrc/server/cl_client.qc | 6 +++--- qcsrc/server/cl_player.qc | 2 +- qcsrc/server/g_damage.qc | 4 ++-- qcsrc/server/mutators/mutator/gamemode_freezetag.qc | 2 +- qcsrc/server/sv_main.qc | 2 +- 13 files changed, 19 insertions(+), 19 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc index 90de6aea7..1630163af 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc @@ -726,7 +726,7 @@ void W_Nexball_Touch() PROJECTILE_TOUCH; if(attacker.team != other.team || autocvar_g_nexball_basketball_teamsteal) - if((ball = other.ballcarried) && !STAT(FROZEN, other) && !other.deadflag && (IS_PLAYER(attacker))) + if((ball = other.ballcarried) && !STAT(FROZEN, other) && !IS_DEAD(other) && (IS_PLAYER(attacker))) { other.velocity = other.velocity + normalize(self.velocity) * other.damageforcescale * autocvar_g_balance_nexball_secondary_force; UNSET_ONGROUND(other); diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index f0c8c0833..967757efc 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -1181,7 +1181,7 @@ void Monster_Move_2D(float mspeed, float allow_jumpoff) void Monster_Anim() {SELFPARAM(); int deadbits = (self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2)); - if(self.deadflag) + if(IS_DEAD(self)) { if (!deadbits) { diff --git a/qcsrc/common/mutators/mutator/instagib/instagib.qc b/qcsrc/common/mutators/mutator/instagib/instagib.qc index 947fcec12..640e3d5b6 100644 --- a/qcsrc/common/mutators/mutator/instagib/instagib.qc +++ b/qcsrc/common/mutators/mutator/instagib/instagib.qc @@ -62,7 +62,7 @@ void instagib_ammocheck() if(!IS_PLAYER(self)) return; // not a player - if(self.deadflag || gameover) + if(IS_DEAD(self) || gameover) instagib_stop_countdown(self); else if (self.ammo_cells > 0 || (self.items & IT_UNLIMITED_WEAPON_AMMO) || (self.flags & FL_GODMODE)) instagib_stop_countdown(self); diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 936788178..e9e8c1be7 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -768,7 +768,7 @@ void Item_Touch() if(!(other.flags & FL_PICKUPITEMS) || STAT(FROZEN, other) - || other.deadflag + || IS_DEAD(other) || (this.solid != SOLID_TRIGGER) || (this.owner == other) || (time < this.item_spawnshieldtime) diff --git a/qcsrc/common/triggers/trigger/heal.qc b/qcsrc/common/triggers/trigger/heal.qc index 5d4f2d0b3..cbabe8dfd 100644 --- a/qcsrc/common/triggers/trigger/heal.qc +++ b/qcsrc/common/triggers/trigger/heal.qc @@ -9,7 +9,7 @@ void trigger_heal_touch() if (other.iscreature) { if (other.takedamage) - if (!other.deadflag) + if (!IS_DEAD(other)) if (other.triggerhealtime < time) { EXACTTRIGGER_TOUCH; diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qc b/qcsrc/common/vehicles/vehicle/bumblebee.qc index ad236e07e..0c80818f9 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qc @@ -134,7 +134,7 @@ float bumblebee_gunner_frame() if(trace_ent) if(trace_ent.movetype) if(trace_ent.takedamage) - if(!trace_ent.deadflag) + if(!IS_DEAD(trace_ent) && !STAT(FROZEN, trace_ent)) { if(DIFF_TEAM(trace_ent, gunner)) { @@ -508,13 +508,13 @@ float bumblebee_pilot_frame() if(autocvar_g_vehicle_bumblebee_healgun_locktime) { - if(vehic.tur_head.lock_time < time || vehic.tur_head.enemy.deadflag) + if(vehic.tur_head.lock_time < time || IS_DEAD(vehic.tur_head.enemy) || STAT(FROZEN, vehic.tur_head.enemy)) vehic.tur_head.enemy = world; if(trace_ent) if(trace_ent.movetype) if(trace_ent.takedamage) - if(!trace_ent.deadflag) + if(!IS_DEAD(trace_ent) && !STAT(FROZEN, trace_ent)) { if(teamplay) { diff --git a/qcsrc/common/vehicles/vehicle/raptor.qc b/qcsrc/common/vehicles/vehicle/raptor.qc index f212b4ce4..a63fe4a1f 100644 --- a/qcsrc/common/vehicles/vehicle/raptor.qc +++ b/qcsrc/common/vehicles/vehicle/raptor.qc @@ -291,13 +291,13 @@ float raptor_frame() // Target lock & predict if(autocvar_g_vehicle_raptor_cannon_locktarget == 2) { - if(raptor.gun1.lock_time < time || raptor.gun1.enemy.deadflag) + if(raptor.gun1.lock_time < time || IS_DEAD(raptor.gun1.enemy) || STAT(FROZEN, raptor.gun1.enemy)) raptor.gun1.enemy = world; if(trace_ent) if(trace_ent.movetype) if(trace_ent.takedamage) - if(!trace_ent.deadflag) + if(!IS_DEAD(trace_ent) && !STAT(FROZEN, trace_ent)) { if(teamplay) { diff --git a/qcsrc/server/bot/bot.qc b/qcsrc/server/bot/bot.qc index 825799b28..468b32c4a 100644 --- a/qcsrc/server/bot/bot.qc +++ b/qcsrc/server/bot/bot.qc @@ -113,7 +113,7 @@ void bot_think() } // if dead, just wait until we can respawn - if (self.deadflag) + if (IS_DEAD(self)) { if (self.deadflag == DEAD_DEAD) { diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 20068e013..2d0908ff5 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -1263,7 +1263,7 @@ void ChatBubbleThink() self.mdl = ""; - if ( !self.owner.deadflag && IS_PLAYER(self.owner) ) + if ( !IS_DEAD(self.owner) && IS_PLAYER(self.owner) ) { if ( self.owner.active_minigame ) self.mdl = "models/sprites/minigame_busy.iqm"; @@ -1349,14 +1349,14 @@ void player_powerups () // add a way to see what the items were BEFORE all of these checks for the mutator hook int items_prev = self.items; - if((self.items & IT_USING_JETPACK) && !self.deadflag && !gameover) + if((self.items & IT_USING_JETPACK) && !IS_DEAD(self) && !gameover) self.modelflags |= MF_ROCKET; else self.modelflags &= ~MF_ROCKET; self.effects &= ~(EF_RED | EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT | EF_FLAME | EF_NODEPTHTEST); - if((self.alpha < 0 || self.deadflag) && !self.vehicle) // don't apply the flags if the player is gibbed + if((self.alpha < 0 || IS_DEAD(self)) && !self.vehicle) // don't apply the flags if the player is gibbed return; Fire_ApplyDamage(self); diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index 9449ada41..57204e1d4 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -134,7 +134,7 @@ void player_setupanimsformodel() void player_anim () {SELFPARAM(); int deadbits = (self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2)); - if(self.deadflag) { + if(IS_DEAD(self)) { if (!deadbits) { // Decide on which death animation to use. if(random() < 0.5) diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 32cd8c184..8423032c4 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -778,7 +778,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d // count the damage if(attacker) - if(!targ.deadflag) + if(!IS_DEAD(targ)) if(deathtype != DEATH_BUFF.m_id) if(targ.takedamage == DAMAGE_AIM) if(targ != attacker) @@ -1081,7 +1081,7 @@ float Fire_AddDamage(entity e, entity o, float d, float t, float dt) if(IS_PLAYER(e)) { - if(e.deadflag) + if(IS_DEAD(e)) return -1; } else diff --git a/qcsrc/server/mutators/mutator/gamemode_freezetag.qc b/qcsrc/server/mutators/mutator/gamemode_freezetag.qc index a8287335a..7dd7e67c5 100644 --- a/qcsrc/server/mutators/mutator/gamemode_freezetag.qc +++ b/qcsrc/server/mutators/mutator/gamemode_freezetag.qc @@ -580,7 +580,7 @@ MUTATOR_HOOKFUNCTION(ft, SetStartItems) MUTATOR_HOOKFUNCTION(ft, HavocBot_ChooseRole) {SELFPARAM(); - if (!self.deadflag) + if (!IS_DEAD(self)) { if (random() < 0.5) self.havocbot_role = havocbot_role_ft_freeing; diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index 3ecd4714b..4ecaedc5b 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -101,7 +101,7 @@ void CreatureFrame_FallDamage(entity this) if(!this.hook.state) { float dm = vlen(this.oldvelocity) - velocity_len; // dm is now the velocity DECREASE. Velocity INCREASE should never cause a sound or any damage. - if (this.deadflag) + if (IS_DEAD(this)) dm = (dm - autocvar_g_balance_falldamage_deadminspeed) * autocvar_g_balance_falldamage_factor; else dm = min((dm - autocvar_g_balance_falldamage_minspeed) * autocvar_g_balance_falldamage_factor, autocvar_g_balance_falldamage_maxdamage); -- 2.39.2