]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Use IS_DEAD where possible, also fix vehicles targeting frozen enemies
authorMario <mario@smbclan.net>
Fri, 1 Jan 2016 11:20:54 +0000 (21:20 +1000)
committerMario <mario@smbclan.net>
Fri, 1 Jan 2016 11:20:54 +0000 (21:20 +1000)
13 files changed:
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/mutators/mutator/instagib/instagib.qc
qcsrc/common/t_items.qc
qcsrc/common/triggers/trigger/heal.qc
qcsrc/common/vehicles/vehicle/bumblebee.qc
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/server/bot/bot.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_player.qc
qcsrc/server/g_damage.qc
qcsrc/server/mutators/mutator/gamemode_freezetag.qc
qcsrc/server/sv_main.qc

index 90de6aea7389f2ade7406cb92879110a2655e8aa..1630163af36386080588dbc63f55817f622eca3a 100644 (file)
@@ -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);
index f0c8c083329865574ee615a60936bf8ec9c70fe8..967757efce66a86ba9fd4cf15167b7e141ebc8fb 100644 (file)
@@ -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)
                {
index 947fcec122db584953dbaca3a28e2006a4918a9d..640e3d5b61cdd83ecc2505b9115cbc9773be3e80 100644 (file)
@@ -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);
index 9367881782cc97d7dd2b02a189299886208204cc..e9e8c1be71b5943cc40101e351ec772bdf8e08f6 100644 (file)
@@ -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)
index 5d4f2d0b3a2cf26a15508c630cc47bb19f90cc38..cbabe8dfd609096cea7a6bb7d6f79227c1cb112e 100644 (file)
@@ -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;
index ad236e07e3a34c15a97d94fb37d44c0d86332d91..0c80818f9a1e19f13187f44cc6cf7cc8f4fb18bd 100644 (file)
@@ -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)
                        {
index f212b4ce45c6578bd0a9cdbcbfa62768cd14ce8c..a63fe4a1fabc0a4f2b435f0463814a9b357b6cdf 100644 (file)
@@ -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)
                        {
index 825799b282f20640799813ec4063331d392eb12f..468b32c4a57ef46fd2eb6186901475b5aae946fa 100644 (file)
@@ -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)
                {
index 20068e0131a760305aff8d8e0db77abc539e5f5d..2d0908ff5f4d420a42ebb8faf726b71cf943a6a7 100644 (file)
@@ -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);
index 9449ada4116d3098c2c0dac21305cf1e95782082..57204e1d486a9d4c6b3309ebc8ce5d45c97746a0 100644 (file)
@@ -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)
index 32cd8c18450b5fbed3ddf73c7804406500926b17..8423032c4c96543660cfa46ec3c04caa1f8e2eac 100644 (file)
@@ -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
index a8287335a913b0995e3a9d87a64f1f226b44e773..7dd7e67c556afa418b5abb5baaea4154470560d7 100644 (file)
@@ -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;
index 3ecd4714b17589ce71fd1aec580246faba1a071f..4ecaedc5b7331213bfce3bf084f19d5cdfcaf663 100644 (file)
@@ -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);