From 917fb2690a46f1b51b4cf65c860f39c19668c109 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 20 Jun 2016 03:27:45 +1000 Subject: [PATCH] More thoroughly clean out other from touch --- qcsrc/client/miscfunctions.qc | 8 ++-- qcsrc/client/scoreboard.qc | 18 ++++---- qcsrc/common/monsters/monster/mage.qc | 8 ++-- qcsrc/common/monsters/monster/shambler.qc | 12 +++--- qcsrc/common/mutators/mutator/overkill/rpc.qc | 13 ++++-- qcsrc/common/physics/movetypes/push.qc | 1 - qcsrc/common/weapons/weapon/arc.qc | 8 ++-- qcsrc/common/weapons/weapon/crylink.qc | 9 ++-- qcsrc/common/weapons/weapon/devastator.qc | 26 +++++++----- qcsrc/common/weapons/weapon/electro.qc | 22 +++++----- qcsrc/common/weapons/weapon/fireball.qc | 17 +++++--- qcsrc/common/weapons/weapon/hagar.qc | 16 ++++---- qcsrc/common/weapons/weapon/minelayer.qc | 26 +++++++----- qcsrc/common/weapons/weapon/mortar.qc | 41 +++++++++---------- qcsrc/common/weapons/weapon/seeker.qc | 28 +++++++------ qcsrc/server/cl_client.qc | 36 ++++++++-------- 16 files changed, 156 insertions(+), 133 deletions(-) diff --git a/qcsrc/client/miscfunctions.qc b/qcsrc/client/miscfunctions.qc index d3b3e46d7..01b0ee3cb 100644 --- a/qcsrc/client/miscfunctions.qc +++ b/qcsrc/client/miscfunctions.qc @@ -68,11 +68,11 @@ void RemovePlayer(entity player) void MoveToLast(entity e) { AuditLists(); - other = e.sort_next; - while(other) + entity ent = e.sort_next; + while(ent) { - SORT_SWAP(other, e); - other = e.sort_next; + SORT_SWAP(ent, e); + ent = e.sort_next; } AuditLists(); } diff --git a/qcsrc/client/scoreboard.qc b/qcsrc/client/scoreboard.qc index 2fb239ba1..dc4cf4137 100644 --- a/qcsrc/client/scoreboard.qc +++ b/qcsrc/client/scoreboard.qc @@ -194,13 +194,14 @@ float HUD_ComparePlayerScores(entity left, entity right) void HUD_UpdatePlayerPos(entity player) { - for(other = player.sort_next; other && HUD_ComparePlayerScores(player, other); other = player.sort_next) + entity ent; + for(ent = player.sort_next; ent && HUD_ComparePlayerScores(player, ent); ent = player.sort_next) { - SORT_SWAP(player, other); + SORT_SWAP(player, ent); } - for(other = player.sort_prev; other != players && HUD_ComparePlayerScores(other, player); other = player.sort_prev) + for(ent = player.sort_prev; ent != players && HUD_ComparePlayerScores(ent, player); ent = player.sort_prev) { - SORT_SWAP(other, player); + SORT_SWAP(ent, player); } } @@ -236,13 +237,14 @@ float HUD_CompareTeamScores(entity left, entity right) void HUD_UpdateTeamPos(entity Team) { - for(other = Team.sort_next; other && HUD_CompareTeamScores(Team, other); other = Team.sort_next) + entity ent; + for(ent = Team.sort_next; ent && HUD_CompareTeamScores(Team, ent); ent = Team.sort_next) { - SORT_SWAP(Team, other); + SORT_SWAP(Team, ent); } - for(other = Team.sort_prev; other != teams && HUD_CompareTeamScores(other, Team); other = Team.sort_prev) + for(ent = Team.sort_prev; ent != teams && HUD_CompareTeamScores(ent, Team); ent = Team.sort_prev) { - SORT_SWAP(other, Team); + SORT_SWAP(ent, Team); } } diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index 55fffb1b6..46a9fb18e 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -146,7 +146,7 @@ bool M_Mage_Defend_Heal_Check(entity this, entity targ) return false; } -void M_Mage_Attack_Spike_Explode(entity this) +void M_Mage_Attack_Spike_Explode(entity this, entity directhitentity) { this.event_damage = func_null; @@ -155,7 +155,7 @@ void M_Mage_Attack_Spike_Explode(entity this) this.realowner.mage_spike = NULL; Send_Effect(EFFECT_EXPLOSION_SMALL, this.origin, '0 0 0', 1); - RadiusDamage (this, this.realowner, (autocvar_g_monster_mage_attack_spike_damage), (autocvar_g_monster_mage_attack_spike_damage) * 0.5, (autocvar_g_monster_mage_attack_spike_radius), NULL, NULL, 0, DEATH_MONSTER_MAGE.m_id, other); + RadiusDamage (this, this.realowner, (autocvar_g_monster_mage_attack_spike_damage), (autocvar_g_monster_mage_attack_spike_damage) * 0.5, (autocvar_g_monster_mage_attack_spike_radius), NULL, NULL, 0, DEATH_MONSTER_MAGE.m_id, directhitentity); remove (this); } @@ -164,7 +164,7 @@ void M_Mage_Attack_Spike_Touch(entity this, entity toucher) { PROJECTILE_TOUCH(this, toucher); - WITH(entity, other, toucher, M_Mage_Attack_Spike_Explode(this)); + M_Mage_Attack_Spike_Explode(this, toucher); } .float wait; @@ -174,7 +174,7 @@ void M_Mage_Attack_Spike_Think(entity this) { if (time > this.ltime || (this.enemy && this.enemy.health <= 0) || this.owner.health <= 0) { this.projectiledeathtype |= HITTYPE_SPLASH; - M_Mage_Attack_Spike_Explode(this); + M_Mage_Attack_Spike_Explode(this, NULL); } float spd = vlen(this.velocity); diff --git a/qcsrc/common/monsters/monster/shambler.qc b/qcsrc/common/monsters/monster/shambler.qc index 14be454dc..dd9a61d41 100644 --- a/qcsrc/common/monsters/monster/shambler.qc +++ b/qcsrc/common/monsters/monster/shambler.qc @@ -78,7 +78,7 @@ void M_Shambler_Attack_Swing(entity this) #include -void M_Shambler_Attack_Lightning_Explode(entity this) +void M_Shambler_Attack_Lightning_Explode(entity this, entity directhitentity) { sound(this, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM); Send_Effect(EFFECT_ELECTRO_IMPACT, this.origin, '0 0 0', 1); @@ -91,7 +91,8 @@ void M_Shambler_Attack_Lightning_Explode(entity this) if(this.movetype == MOVETYPE_NONE) this.velocity = this.oldvelocity; - RadiusDamage (this, this.realowner, (autocvar_g_monster_shambler_attack_lightning_damage), (autocvar_g_monster_shambler_attack_lightning_damage), (autocvar_g_monster_shambler_attack_lightning_radius), NULL, NULL, (autocvar_g_monster_shambler_attack_lightning_force), this.projectiledeathtype, other); + RadiusDamage (this, this.realowner, (autocvar_g_monster_shambler_attack_lightning_damage), (autocvar_g_monster_shambler_attack_lightning_damage), (autocvar_g_monster_shambler_attack_lightning_radius), + NULL, NULL, (autocvar_g_monster_shambler_attack_lightning_force), this.projectiledeathtype, directhitentity); FOREACH_ENTITY_RADIUS(this.origin, autocvar_g_monster_shambler_attack_lightning_radius_zap, it != this.realowner && it.takedamage, { @@ -105,7 +106,7 @@ void M_Shambler_Attack_Lightning_Explode(entity this) void M_Shambler_Attack_Lightning_Explode_use(entity this, entity actor, entity trigger) { - M_Shambler_Attack_Lightning_Explode(this); + M_Shambler_Attack_Lightning_Explode(this, trigger); } void M_Shambler_Attack_Lightning_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) @@ -126,7 +127,7 @@ void M_Shambler_Attack_Lightning_Touch(entity this, entity toucher) { PROJECTILE_TOUCH(this, toucher); - WITH(entity, other, toucher, this.use(this, NULL, NULL)); + this.use(this, NULL, toucher); } void M_Shambler_Attack_Lightning_Think(entity this) @@ -134,8 +135,7 @@ void M_Shambler_Attack_Lightning_Think(entity this) this.nextthink = time; if (time > this.cnt) { - other = NULL; - M_Shambler_Attack_Lightning_Explode(this); + M_Shambler_Attack_Lightning_Explode(this, NULL); return; } } diff --git a/qcsrc/common/mutators/mutator/overkill/rpc.qc b/qcsrc/common/mutators/mutator/overkill/rpc.qc index 035c64c7c..b14b6bce4 100644 --- a/qcsrc/common/mutators/mutator/overkill/rpc.qc +++ b/qcsrc/common/mutators/mutator/overkill/rpc.qc @@ -50,23 +50,28 @@ REGISTER_WEAPON(RPC, rpc, NEW(RocketPropelledChainsaw)); #ifdef SVQC spawnfunc(weapon_rpc) { weapon_defaultspawnfunc(this, WEP_RPC); } -void W_RocketPropelledChainsaw_Explode(entity this) +void W_RocketPropelledChainsaw_Explode(entity this, entity directhitentity) { this.event_damage = func_null; this.takedamage = DAMAGE_NO; - RadiusDamage (this, this.realowner, WEP_CVAR(rpc, damage), WEP_CVAR(rpc, edgedamage), WEP_CVAR(rpc, radius), NULL, NULL, WEP_CVAR(rpc, force), this.projectiledeathtype, other); + RadiusDamage (this, this.realowner, WEP_CVAR(rpc, damage), WEP_CVAR(rpc, edgedamage), WEP_CVAR(rpc, radius), NULL, NULL, WEP_CVAR(rpc, force), this.projectiledeathtype, directhitentity); remove (this); } +void W_RocketPropelledChainsaw_Explode_think(entity this) +{ + W_RocketPropelledChainsaw_Explode(this, NULL); +} + void W_RocketPropelledChainsaw_Touch (entity this, entity toucher) { if(WarpZone_Projectile_Touch(this, toucher)) if(wasfreed(this)) return; - WITH(entity, other, toucher, W_RocketPropelledChainsaw_Explode(this)); + W_RocketPropelledChainsaw_Explode(this, toucher); } void W_RocketPropelledChainsaw_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) @@ -80,7 +85,7 @@ void W_RocketPropelledChainsaw_Damage(entity this, entity inflictor, entity atta this.health = this.health - damage; if (this.health <= 0) - W_PrepareExplosionByDamage(this, attacker, W_RocketPropelledChainsaw_Explode); + W_PrepareExplosionByDamage(this, attacker, W_RocketPropelledChainsaw_Explode_think); } void W_RocketPropelledChainsaw_Think(entity this) diff --git a/qcsrc/common/physics/movetypes/push.qc b/qcsrc/common/physics/movetypes/push.qc index 0d03bfff8..5a0426edc 100644 --- a/qcsrc/common/physics/movetypes/push.qc +++ b/qcsrc/common/physics/movetypes/push.qc @@ -148,7 +148,6 @@ void _Movetype_Physics_Pusher(entity this, float dt) // SV_Physics_Pusher { this.move_nextthink = 0; this.move_time = time; - other = NULL; this.move_think(this); } } diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index f7c5f9b66..083ed5146 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -231,17 +231,17 @@ void Arc_Player_SetHeat(entity player) //dprint("Heat: ",ftos(player.arc_heat_percent*100),"%\n"); } -void W_Arc_Bolt_Explode(entity this) +void W_Arc_Bolt_Explode(entity this, entity directhitentity) { this.event_damage = func_null; - RadiusDamage(this, this.realowner, WEP_CVAR(arc, bolt_damage), WEP_CVAR(arc, bolt_edgedamage), WEP_CVAR(arc, bolt_radius), NULL, NULL, WEP_CVAR(arc, bolt_force), this.projectiledeathtype, other); + RadiusDamage(this, this.realowner, WEP_CVAR(arc, bolt_damage), WEP_CVAR(arc, bolt_edgedamage), WEP_CVAR(arc, bolt_radius), NULL, NULL, WEP_CVAR(arc, bolt_force), this.projectiledeathtype, directhitentity); remove(this); } void W_Arc_Bolt_Explode_use(entity this, entity actor, entity trigger) { - W_Arc_Bolt_Explode(this); + W_Arc_Bolt_Explode(this, trigger); } void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) @@ -262,7 +262,7 @@ void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float dam void W_Arc_Bolt_Touch(entity this, entity toucher) { PROJECTILE_TOUCH(this, toucher); - WITH(entity, other, toucher, this.use(this, NULL, NULL)); + this.use(this, NULL, toucher); } void W_Arc_Attack_Bolt(Weapon thiswep, entity actor) diff --git a/qcsrc/common/weapons/weapon/crylink.qc b/qcsrc/common/weapons/weapon/crylink.qc index 74c1cf1ab..938b5e398 100644 --- a/qcsrc/common/weapons/weapon/crylink.qc +++ b/qcsrc/common/weapons/weapon/crylink.qc @@ -118,7 +118,7 @@ void W_Crylink_Reset(entity this) } // force projectile to explode -void W_Crylink_LinkExplode(entity e, entity e2) +void W_Crylink_LinkExplode(entity e, entity e2, entity directhitentity) { float a; @@ -132,7 +132,8 @@ void W_Crylink_LinkExplode(entity e, entity e2) float isprimary = !(e.projectiledeathtype & HITTYPE_SECONDARY); - RadiusDamage(e, e.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * a, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * a, WEP_CVAR_BOTH(crylink, isprimary, radius), NULL, NULL, WEP_CVAR_BOTH(crylink, isprimary, force) * a, e.projectiledeathtype, other); + RadiusDamage(e, e.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * a, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * a, WEP_CVAR_BOTH(crylink, isprimary, radius), + NULL, NULL, WEP_CVAR_BOTH(crylink, isprimary, force) * a, e.projectiledeathtype, directhitentity); W_Crylink_LinkExplode(e.queuenext, e2); @@ -261,7 +262,7 @@ void W_Crylink_LinkJoinEffect_Think(entity this) NULL, WEP_CVAR_BOTH(crylink, isprimary, joinexplode_force) * n, e.projectiledeathtype, - other + NULL ); Send_Effect(EFFECT_CRYLINK_JOINEXPLODE, this.origin, '0 0 0', n); } @@ -317,7 +318,7 @@ void W_Crylink_Touch(entity this, entity toucher) { if(this == this.realowner.crylink_lastgroup) this.realowner.crylink_lastgroup = NULL; - WITH(entity, other, toucher, W_Crylink_LinkExplode(this.queuenext, this)); + W_Crylink_LinkExplode(this.queuenext, this, toucher); this.classname = "spike_oktoremove"; remove(this); return; diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index 1ea678bb5..9d955f058 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -81,15 +81,15 @@ void W_Devastator_Unregister(entity this) } } -void W_Devastator_Explode(entity this) +void W_Devastator_Explode(entity this, entity directhitentity) { W_Devastator_Unregister(this); - if(other.takedamage == DAMAGE_AIM) - if(IS_PLAYER(other)) - if(DIFF_TEAM(this.realowner, other)) - if(!IS_DEAD(other)) - if(IsFlying(other)) + if(directhitentity.takedamage == DAMAGE_AIM) + if(IS_PLAYER(directhitentity)) + if(DIFF_TEAM(this.realowner, directhitentity)) + if(!IS_DEAD(directhitentity)) + if(IsFlying(directhitentity)) Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT); this.event_damage = func_null; @@ -105,7 +105,7 @@ void W_Devastator_Explode(entity this) NULL, WEP_CVAR(devastator, force), this.projectiledeathtype, - other + directhitentity ); Weapon thiswep = WEP_DEVASTATOR; @@ -123,6 +123,11 @@ void W_Devastator_Explode(entity this) remove(this); } +void W_Devastator_Explode_think(entity this) +{ + W_Devastator_Explode(this, NULL); +} + void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity) { W_Devastator_Unregister(this); @@ -259,9 +264,8 @@ void W_Devastator_Think(entity this) this.nextthink = time; if(time > this.cnt) { - other = NULL; this.projectiledeathtype |= HITTYPE_BOUNCE; - W_Devastator_Explode(this); + W_Devastator_Explode(this, NULL); return; } @@ -329,7 +333,7 @@ void W_Devastator_Touch(entity this, entity toucher) return; } W_Devastator_Unregister(this); - WITH(entity, other, toucher, W_Devastator_Explode(this)); + W_Devastator_Explode(this, toucher); } void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) @@ -344,7 +348,7 @@ void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float d this.angles = vectoangles(this.velocity); if(this.health <= 0) - W_PrepareExplosionByDamage(this, attacker, W_Devastator_Explode); + W_PrepareExplosionByDamage(this, attacker, W_Devastator_Explode_think); } void W_Devastator_Attack(Weapon thiswep, entity actor) diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index 07114fc35..b9811abd8 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -144,13 +144,13 @@ void W_Electro_ExplodeCombo(entity this) remove(this); } -void W_Electro_Explode(entity this) +void W_Electro_Explode(entity this, entity directhitentity) { - if(other.takedamage == DAMAGE_AIM) - if(IS_PLAYER(other)) - if(DIFF_TEAM(this.realowner, other)) - if(!IS_DEAD(other)) - if(IsFlying(other)) + if(directhitentity.takedamage == DAMAGE_AIM) + if(IS_PLAYER(directhitentity)) + if(DIFF_TEAM(this.realowner, directhitentity)) + if(!IS_DEAD(directhitentity)) + if(IsFlying(directhitentity)) Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH); this.event_damage = func_null; @@ -168,7 +168,7 @@ void W_Electro_Explode(entity this) NULL, WEP_CVAR_SEC(electro, force), this.projectiledeathtype, - other + directhitentity ); } else @@ -184,7 +184,7 @@ void W_Electro_Explode(entity this) NULL, WEP_CVAR_PRI(electro, force), this.projectiledeathtype, - other + directhitentity ); } @@ -193,13 +193,13 @@ void W_Electro_Explode(entity this) void W_Electro_Explode_use(entity this, entity actor, entity trigger) { - W_Electro_Explode(this); + W_Electro_Explode(this, trigger); } void W_Electro_TouchExplode(entity this, entity toucher) { PROJECTILE_TOUCH(this, toucher); - WITH(entity, other, toucher, W_Electro_Explode(this)); + W_Electro_Explode(this, toucher); } void W_Electro_Bolt_Think(entity this) @@ -302,7 +302,7 @@ void W_Electro_Orb_Touch(entity this, entity toucher) { PROJECTILE_TOUCH(this, toucher); if(toucher.takedamage == DAMAGE_AIM) - { if(WEP_CVAR_SEC(electro, touchexplode)) { WITH(entity, other, toucher, W_Electro_Explode(this)); } } + { if(WEP_CVAR_SEC(electro, touchexplode)) { W_Electro_Explode(this, toucher); } } else { //UpdateCSQCProjectile(this); diff --git a/qcsrc/common/weapons/weapon/fireball.qc b/qcsrc/common/weapons/weapon/fireball.qc index 3026f30c0..37deb1452 100644 --- a/qcsrc/common/weapons/weapon/fireball.qc +++ b/qcsrc/common/weapons/weapon/fireball.qc @@ -62,7 +62,7 @@ REGISTER_WEAPON(FIREBALL, fireball, NEW(Fireball)); #ifdef SVQC spawnfunc(weapon_fireball) { weapon_defaultspawnfunc(this, WEP_FIREBALL); } -void W_Fireball_Explode(entity this) +void W_Fireball_Explode(entity this, entity directhitentity) { entity e; float dist; @@ -75,7 +75,7 @@ void W_Fireball_Explode(entity this) // 1. dist damage d = (this.realowner.health + this.realowner.armorvalue); - RadiusDamage(this, this.realowner, WEP_CVAR_PRI(fireball, damage), WEP_CVAR_PRI(fireball, edgedamage), WEP_CVAR_PRI(fireball, radius), NULL, NULL, WEP_CVAR_PRI(fireball, force), this.projectiledeathtype, other); + RadiusDamage(this, this.realowner, WEP_CVAR_PRI(fireball, damage), WEP_CVAR_PRI(fireball, edgedamage), WEP_CVAR_PRI(fireball, radius), NULL, NULL, WEP_CVAR_PRI(fireball, force), this.projectiledeathtype, directhitentity); if(this.realowner.health + this.realowner.armorvalue >= d) if(!this.cnt) { @@ -112,15 +112,20 @@ void W_Fireball_Explode(entity this) remove(this); } +void W_Fireball_Explode_think(entity this) +{ + W_Fireball_Explode(this, NULL); +} + void W_Fireball_Explode_use(entity this, entity actor, entity trigger) { - W_Fireball_Explode(this); + W_Fireball_Explode(this, trigger); } void W_Fireball_TouchExplode(entity this, entity toucher) { PROJECTILE_TOUCH(this, toucher); - WITH(entity, other, toucher, W_Fireball_Explode(this)); + W_Fireball_Explode(this, toucher); } void W_Fireball_LaserPlay(entity this, float dt, float dist, float damage, float edgedamage, float burntime) @@ -163,7 +168,7 @@ void W_Fireball_Think(entity this) { this.cnt = 1; this.projectiledeathtype |= HITTYPE_SPLASH; - W_Fireball_Explode(this); + W_Fireball_Explode(this, NULL); return; } @@ -184,7 +189,7 @@ void W_Fireball_Damage(entity this, entity inflictor, entity attacker, float dam if(this.health <= 0) { this.cnt = 1; - W_PrepareExplosionByDamage(this, attacker, W_Fireball_Explode); + W_PrepareExplosionByDamage(this, attacker, W_Fireball_Explode_think); } } diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index 78fc6603e..1a078dff0 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -63,30 +63,30 @@ spawnfunc(weapon_hagar) { weapon_defaultspawnfunc(this, WEP_HAGAR); } // NO bounce protection, as bounces are limited! -void W_Hagar_Explode(entity this) +void W_Hagar_Explode(entity this, entity directhitentity) { this.event_damage = func_null; - RadiusDamage(this, this.realowner, WEP_CVAR_PRI(hagar, damage), WEP_CVAR_PRI(hagar, edgedamage), WEP_CVAR_PRI(hagar, radius), NULL, NULL, WEP_CVAR_PRI(hagar, force), this.projectiledeathtype, other); + RadiusDamage(this, this.realowner, WEP_CVAR_PRI(hagar, damage), WEP_CVAR_PRI(hagar, edgedamage), WEP_CVAR_PRI(hagar, radius), NULL, NULL, WEP_CVAR_PRI(hagar, force), this.projectiledeathtype, directhitentity); remove(this); } void W_Hagar_Explode_use(entity this, entity actor, entity trigger) { - W_Hagar_Explode(this); + W_Hagar_Explode(this, trigger); } -void W_Hagar_Explode2(entity this) +void W_Hagar_Explode2(entity this, entity directhitentity) { this.event_damage = func_null; - RadiusDamage(this, this.realowner, WEP_CVAR_SEC(hagar, damage), WEP_CVAR_SEC(hagar, edgedamage), WEP_CVAR_SEC(hagar, radius), NULL, NULL, WEP_CVAR_SEC(hagar, force), this.projectiledeathtype, other); + RadiusDamage(this, this.realowner, WEP_CVAR_SEC(hagar, damage), WEP_CVAR_SEC(hagar, edgedamage), WEP_CVAR_SEC(hagar, radius), NULL, NULL, WEP_CVAR_SEC(hagar, force), this.projectiledeathtype, directhitentity); remove(this); } void W_Hagar_Explode2_use(entity this, entity actor, entity trigger) { - W_Hagar_Explode2(this); + W_Hagar_Explode2(this, trigger); } void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) @@ -116,7 +116,7 @@ void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage void W_Hagar_Touch(entity this, entity toucher) { PROJECTILE_TOUCH(this, toucher); - WITH(entity, other, toucher, this.use(this, NULL, NULL)); + this.use(this, NULL, toucher); } void W_Hagar_Touch2(entity this, entity toucher) @@ -124,7 +124,7 @@ void W_Hagar_Touch2(entity this, entity toucher) PROJECTILE_TOUCH(this, toucher); if(this.cnt > 0 || toucher.takedamage == DAMAGE_AIM) { - WITH(entity, other, toucher, this.use(this, NULL, NULL)); + this.use(this, NULL, toucher); } else { this.cnt++; Send_Effect(EFFECT_HAGAR_BOUNCE, this.origin, this.velocity, 1); diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index 37cb9944b..08b3634f4 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -108,19 +108,19 @@ void W_MineLayer_Stick(entity this, entity to) SetMovetypeFollow(newmine, to); } -void W_MineLayer_Explode(entity this) +void W_MineLayer_Explode(entity this, entity directhitentity) { - if(other.takedamage == DAMAGE_AIM) - if(IS_PLAYER(other)) - if(DIFF_TEAM(this.realowner, other)) - if(!IS_DEAD(other)) - if(IsFlying(other)) + if(directhitentity.takedamage == DAMAGE_AIM) + if(IS_PLAYER(directhitentity)) + if(DIFF_TEAM(this.realowner, directhitentity)) + if(!IS_DEAD(directhitentity)) + if(IsFlying(directhitentity)) Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT); this.event_damage = func_null; this.takedamage = DAMAGE_NO; - RadiusDamage(this, this.realowner, WEP_CVAR(minelayer, damage), WEP_CVAR(minelayer, edgedamage), WEP_CVAR(minelayer, radius), NULL, NULL, WEP_CVAR(minelayer, force), this.projectiledeathtype, other); + RadiusDamage(this, this.realowner, WEP_CVAR(minelayer, damage), WEP_CVAR(minelayer, edgedamage), WEP_CVAR(minelayer, radius), NULL, NULL, WEP_CVAR(minelayer, force), this.projectiledeathtype, directhitentity); if(PS(this.realowner).m_weapon == WEP_MINE_LAYER) { @@ -138,6 +138,11 @@ void W_MineLayer_Explode(entity this) remove(this); } +void W_MineLayer_Explode_think(entity this) +{ + W_MineLayer_Explode(this, NULL); +} + void W_MineLayer_DoRemoteExplode(entity this) { this.event_damage = func_null; @@ -192,7 +197,7 @@ void W_MineLayer_ProximityExplode(entity this) } this.mine_time = 0; - W_MineLayer_Explode(this); + W_MineLayer_Explode(this, NULL); } int W_MineLayer_Count(entity e) @@ -234,9 +239,8 @@ void W_MineLayer_Think(entity this) // TODO: Do this on team change too -- Samual: But isn't a player killed when they switch teams? if(!IS_PLAYER(this.realowner) || IS_DEAD(this.realowner) || STAT(FROZEN, this.realowner)) { - other = NULL; this.projectiledeathtype |= HITTYPE_BOUNCE; - W_MineLayer_Explode(this); + W_MineLayer_Explode(this, NULL); return; } @@ -305,7 +309,7 @@ void W_MineLayer_Damage(entity this, entity inflictor, entity attacker, float da this.angles = vectoangles(this.velocity); if(this.health <= 0) - W_PrepareExplosionByDamage(this, attacker, W_MineLayer_Explode); + W_PrepareExplosionByDamage(this, attacker, W_MineLayer_Explode_think); } void W_MineLayer_Attack(Weapon thiswep, entity actor) diff --git a/qcsrc/common/weapons/weapon/mortar.qc b/qcsrc/common/weapons/weapon/mortar.qc index 06686eca0..8cbe75e74 100644 --- a/qcsrc/common/weapons/weapon/mortar.qc +++ b/qcsrc/common/weapons/weapon/mortar.qc @@ -64,13 +64,13 @@ REGISTER_WEAPON(MORTAR, mortar, NEW(Mortar)); spawnfunc(weapon_mortar) { weapon_defaultspawnfunc(this, WEP_MORTAR); } spawnfunc(weapon_grenadelauncher) { spawnfunc_weapon_mortar(this); } -void W_Mortar_Grenade_Explode(entity this) +void W_Mortar_Grenade_Explode(entity this, entity directhitentity) { - if(other.takedamage == DAMAGE_AIM) - if(IS_PLAYER(other)) - if(DIFF_TEAM(this.realowner, other)) - if(!IS_DEAD(other)) - if(IsFlying(other)) + if(directhitentity.takedamage == DAMAGE_AIM) + if(IS_PLAYER(directhitentity)) + if(DIFF_TEAM(this.realowner, directhitentity)) + if(!IS_DEAD(directhitentity)) + if(IsFlying(directhitentity)) Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT); this.event_damage = func_null; @@ -79,23 +79,23 @@ void W_Mortar_Grenade_Explode(entity this) if(this.movetype == MOVETYPE_NONE) this.velocity = this.oldvelocity; - RadiusDamage(this, this.realowner, WEP_CVAR_PRI(mortar, damage), WEP_CVAR_PRI(mortar, edgedamage), WEP_CVAR_PRI(mortar, radius), NULL, NULL, WEP_CVAR_PRI(mortar, force), this.projectiledeathtype, other); + RadiusDamage(this, this.realowner, WEP_CVAR_PRI(mortar, damage), WEP_CVAR_PRI(mortar, edgedamage), WEP_CVAR_PRI(mortar, radius), NULL, NULL, WEP_CVAR_PRI(mortar, force), this.projectiledeathtype, directhitentity); remove(this); } void W_Mortar_Grenade_Explode_use(entity this, entity actor, entity trigger) { - W_Mortar_Grenade_Explode(this); + W_Mortar_Grenade_Explode(this, trigger); } -void W_Mortar_Grenade_Explode2(entity this) +void W_Mortar_Grenade_Explode2(entity this, entity directhitentity) { - if(other.takedamage == DAMAGE_AIM) - if(IS_PLAYER(other)) - if(DIFF_TEAM(this.realowner, other)) - if(!IS_DEAD(other)) - if(IsFlying(other)) + if(directhitentity.takedamage == DAMAGE_AIM) + if(IS_PLAYER(directhitentity)) + if(DIFF_TEAM(this.realowner, directhitentity)) + if(!IS_DEAD(directhitentity)) + if(IsFlying(directhitentity)) Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT); this.event_damage = func_null; @@ -104,14 +104,14 @@ void W_Mortar_Grenade_Explode2(entity this) if(this.movetype == MOVETYPE_NONE) this.velocity = this.oldvelocity; - RadiusDamage(this, this.realowner, WEP_CVAR_SEC(mortar, damage), WEP_CVAR_SEC(mortar, edgedamage), WEP_CVAR_SEC(mortar, radius), NULL, NULL, WEP_CVAR_SEC(mortar, force), this.projectiledeathtype, other); + RadiusDamage(this, this.realowner, WEP_CVAR_SEC(mortar, damage), WEP_CVAR_SEC(mortar, edgedamage), WEP_CVAR_SEC(mortar, radius), NULL, NULL, WEP_CVAR_SEC(mortar, force), this.projectiledeathtype, directhitentity); remove(this); } void W_Mortar_Grenade_Explode2_use(entity this, entity actor, entity trigger) { - W_Mortar_Grenade_Explode2(this); + W_Mortar_Grenade_Explode2(this, trigger); } void W_Mortar_Grenade_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) @@ -133,13 +133,12 @@ void W_Mortar_Grenade_Think1(entity this) this.nextthink = time; if(time > this.cnt) { - other = NULL; this.projectiledeathtype |= HITTYPE_BOUNCE; - W_Mortar_Grenade_Explode(this); + W_Mortar_Grenade_Explode(this, NULL); return; } if(this.gl_detonate_later && this.gl_bouncecnt >= WEP_CVAR_PRI(mortar, remote_minbouncecnt)) - W_Mortar_Grenade_Explode(this); + W_Mortar_Grenade_Explode(this, NULL); } void W_Mortar_Grenade_Touch1(entity this, entity toucher) @@ -147,7 +146,7 @@ void W_Mortar_Grenade_Touch1(entity this, entity toucher) PROJECTILE_TOUCH(this, toucher); if(toucher.takedamage == DAMAGE_AIM || WEP_CVAR_PRI(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile { - WITH(entity, other, toucher, this.use(this, NULL, NULL)); + this.use(this, NULL, toucher); } else if(WEP_CVAR_PRI(mortar, type) == 1) // bounce { @@ -179,7 +178,7 @@ void W_Mortar_Grenade_Touch2(entity this, entity toucher) PROJECTILE_TOUCH(this, toucher); if(toucher.takedamage == DAMAGE_AIM || WEP_CVAR_SEC(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile { - WITH(entity, other, toucher, this.use(this, NULL, NULL)); + this.use(this, NULL, toucher); } else if(WEP_CVAR_SEC(mortar, type) == 1) // bounce { diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index 475c23fab..524c6791f 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -94,20 +94,24 @@ spawnfunc(weapon_seeker) { weapon_defaultspawnfunc(this, WEP_SEEKER); } // ============================ // Begin: Missile functions, these are general functions to be manipulated by other code // ============================ -void W_Seeker_Missile_Explode(entity this) +void W_Seeker_Missile_Explode(entity this, entity directhitentity) { this.event_damage = func_null; - RadiusDamage(this, this.realowner, WEP_CVAR(seeker, missile_damage), WEP_CVAR(seeker, missile_edgedamage), WEP_CVAR(seeker, missile_radius), NULL, NULL, WEP_CVAR(seeker, missile_force), this.projectiledeathtype, other); + RadiusDamage(this, this.realowner, WEP_CVAR(seeker, missile_damage), WEP_CVAR(seeker, missile_edgedamage), WEP_CVAR(seeker, missile_radius), NULL, NULL, WEP_CVAR(seeker, missile_force), this.projectiledeathtype, directhitentity); remove(this); } +void W_Seeker_Missile_Explode_think(entity this) +{ + W_Seeker_Missile_Explode(this, NULL); +} + void W_Seeker_Missile_Touch(entity this, entity toucher) { PROJECTILE_TOUCH(this, toucher); - // TODO - WITH(entity, other, toucher, W_Seeker_Missile_Explode(this)); + W_Seeker_Missile_Explode(this, toucher); } void W_Seeker_Missile_Think(entity this) @@ -121,7 +125,7 @@ void W_Seeker_Missile_Think(entity this) if(time > this.cnt) { this.projectiledeathtype |= HITTYPE_SPLASH; - W_Seeker_Missile_Explode(this); + W_Seeker_Missile_Explode(this, NULL); } spd = vlen(this.velocity); @@ -179,7 +183,7 @@ void W_Seeker_Missile_Think(entity this) { if(this.autoswitch <= time) { - W_Seeker_Missile_Explode(this); + W_Seeker_Missile_Explode(this, NULL); this.autoswitch = 0; } } @@ -221,7 +225,7 @@ void W_Seeker_Missile_Damage(entity this, entity inflictor, entity attacker, flo this.health = this.health - damage; if(this.health <= 0) - W_PrepareExplosionByDamage(this, attacker, W_Seeker_Missile_Explode); + W_PrepareExplosionByDamage(this, attacker, W_Seeker_Missile_Explode_think); } /* @@ -305,23 +309,23 @@ void W_Seeker_Fire_Missile(Weapon thiswep, entity actor, vector f_diff, entity m // ============================ // Begin: FLAC, close range attack meant for defeating rockets which are coming at you. // ============================ -void W_Seeker_Flac_Explode(entity this) +void W_Seeker_Flac_Explode(entity this, entity directhitentity) { this.event_damage = func_null; - RadiusDamage(this, this.realowner, WEP_CVAR(seeker, flac_damage), WEP_CVAR(seeker, flac_edgedamage), WEP_CVAR(seeker, flac_radius), NULL, NULL, WEP_CVAR(seeker, flac_force), this.projectiledeathtype, other); + RadiusDamage(this, this.realowner, WEP_CVAR(seeker, flac_damage), WEP_CVAR(seeker, flac_edgedamage), WEP_CVAR(seeker, flac_radius), NULL, NULL, WEP_CVAR(seeker, flac_force), this.projectiledeathtype, directhitentity); remove(this); } void W_Seeker_Flac_Touch(entity this, entity toucher) { - WITH(entity, other, toucher, W_Seeker_Flac_Explode(this)); + W_Seeker_Flac_Explode(this, toucher); } void W_Seeker_Flac_Explode_use(entity this, entity actor, entity trigger) { - WITH(entity, other, trigger, W_Seeker_Flac_Explode(this)); + W_Seeker_Flac_Explode(this, trigger); } void W_Seeker_Fire_Flac(Weapon thiswep, entity actor) @@ -484,7 +488,7 @@ void W_Seeker_Tag_Explode(entity this) { //if(other==this.realowner) // return; - Damage_DamageInfo(this.origin, 0, 0, 0, this.velocity, WEP_SEEKER.m_id | HITTYPE_BOUNCE, other.species, this); + Damage_DamageInfo(this.origin, 0, 0, 0, this.velocity, WEP_SEEKER.m_id | HITTYPE_BOUNCE, 0, this); remove(this); } diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 608895b4e..3ba72b815 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -1704,14 +1704,14 @@ bool Spectate(entity this, entity pl) bool SpectateNext(entity this) { - other = find(this.enemy, classname, STR_PLAYER); + entity ent = find(this.enemy, classname, STR_PLAYER); - if (MUTATOR_CALLHOOK(SpectateNext, this, other)) - other = M_ARGV(1, entity); - else if (!other) - other = find(other, classname, STR_PLAYER); + if (MUTATOR_CALLHOOK(SpectateNext, this, ent)) + ent = M_ARGV(1, entity); + else if (!ent) + ent = find(ent, classname, STR_PLAYER); - if(other) { SetSpectatee(this, other); } + if(ent) { SetSpectatee(this, ent); } return SpectateSet(this); } @@ -1719,36 +1719,36 @@ bool SpectateNext(entity this) bool SpectatePrev(entity this) { // NOTE: chain order is from the highest to the lower entnum (unlike find) - other = findchain(classname, STR_PLAYER); - if (!other) // no player + entity ent = findchain(classname, STR_PLAYER); + if (!ent) // no player return false; - entity first = other; + entity first = ent; // skip players until current spectated player if(this.enemy) - while(other && other != this.enemy) - other = other.chain; + while(ent && ent != this.enemy) + ent = ent.chain; - switch (MUTATOR_CALLHOOK(SpectatePrev, this, other, first)) + switch (MUTATOR_CALLHOOK(SpectatePrev, this, ent, first)) { case MUT_SPECPREV_FOUND: - other = M_ARGV(1, entity); + ent = M_ARGV(1, entity); break; case MUT_SPECPREV_RETURN: - other = M_ARGV(1, entity); + ent = M_ARGV(1, entity); return true; case MUT_SPECPREV_CONTINUE: default: { - if(other.chain) - other = other.chain; + if(ent.chain) + ent = ent.chain; else - other = first; + ent = first; break; } } - SetSpectatee(this, other); + SetSpectatee(this, ent); return SpectateSet(this); } -- 2.39.2