From: Mario Date: Sun, 19 Jun 2016 16:51:04 +0000 (+1000) Subject: Cleanse the touch functions of the other evil X-Git-Tag: xonotic-v0.8.2~700^2~128^2~4 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=678388b78fdaad89fc8218dadf7007432b4153c3;p=xonotic%2Fxonotic-data.pk3dir.git Cleanse the touch functions of the other evil --- diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index 6261fa842..39032cd70 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -16,7 +16,7 @@ .float scale; .vector colormod; -void SUB_Stop(entity this) +void SUB_Stop(entity this, entity toucher) { this.move_velocity = this.move_avelocity = '0 0 0'; this.move_movetype = MOVETYPE_NONE; diff --git a/qcsrc/client/weapons/projectile.qh b/qcsrc/client/weapons/projectile.qh index 66e1be470..27bca00c8 100644 --- a/qcsrc/client/weapons/projectile.qh +++ b/qcsrc/client/weapons/projectile.qh @@ -16,7 +16,7 @@ class(Projectile).float gravity; class(Projectile).int snd_looping; class(Projectile).bool silent; -void SUB_Stop(entity this); +void SUB_Stop(entity this, entity toucher); void Projectile_ResetTrail(entity this, vector to); diff --git a/qcsrc/common/effects/qc/casings.qc b/qcsrc/common/effects/qc/casings.qc index 605d42e67..308a7b219 100644 --- a/qcsrc/common/effects/qc/casings.qc +++ b/qcsrc/common/effects/qc/casings.qc @@ -83,7 +83,7 @@ Sound SND_CASINGS_RANDOM() { return Sounds_from(SND_CASINGS1.m_id + floor(prandom() * 3)); } -void Casing_Touch(entity this) +void Casing_Touch(entity this, entity toucher) { if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) { diff --git a/qcsrc/common/effects/qc/gibs.qc b/qcsrc/common/effects/qc/gibs.qc index bc82b50d0..b88a57f4d 100644 --- a/qcsrc/common/effects/qc/gibs.qc +++ b/qcsrc/common/effects/qc/gibs.qc @@ -111,13 +111,13 @@ void new_te_bloodshower (int ef, vector org, float explosionspeed, int howmany) __pointparticles(ef, org, randomvec() * explosionspeed, howmany / 50); } -void SUB_RemoveOnNoImpact(entity this) +void SUB_RemoveOnNoImpact(entity this, entity toucher) { if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) Gib_Delete(this); } -void Gib_Touch(entity this) +void Gib_Touch(entity this, entity toucher) { // TODO maybe bounce of walls, make more gibs, etc. diff --git a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc index 46b4e0345..2668f7e19 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc @@ -52,8 +52,8 @@ float autocvar_g_balance_nexball_secondary_lifetime; float autocvar_g_balance_nexball_secondary_refire; float autocvar_g_balance_nexball_secondary_speed; -void basketball_touch(entity this); -void football_touch(entity this); +void basketball_touch(entity this, entity toucher); +void football_touch(entity this, entity toucher); void ResetBall(entity this); const int NBM_NONE = 0; const int NBM_FOOTBALL = 2; @@ -289,9 +289,9 @@ void ResetBall(entity this) } } -void football_touch(entity this) +void football_touch(entity this, entity toucher) { - if(other.solid == SOLID_BSP) + if(toucher.solid == SOLID_BSP) { if(time > this.lastground + 0.1) { @@ -302,54 +302,54 @@ void football_touch(entity this) this.nextthink = time + autocvar_g_nexball_delay_idle; return; } - if (!IS_PLAYER(other)) + if (!IS_PLAYER(toucher)) return; - if(other.health < 1) + if(toucher.health < 1) return; if(!this.cnt) this.nextthink = time + autocvar_g_nexball_delay_idle; - this.pusher = other; - this.team = other.team; + this.pusher = toucher; + this.team = toucher.team; if(autocvar_g_nexball_football_physics == -1) // MrBougo try 1, before decompiling Rev's original { - if(other.velocity) - this.velocity = other.velocity * 1.5 + '0 0 1' * autocvar_g_nexball_football_boost_up; + if(toucher.velocity) + this.velocity = toucher.velocity * 1.5 + '0 0 1' * autocvar_g_nexball_football_boost_up; } else if(autocvar_g_nexball_football_physics == 1) // MrBougo's modded Rev style: partially independant of the height of the aiming point { - makevectors(other.v_angle); - this.velocity = other.velocity + v_forward * autocvar_g_nexball_football_boost_forward + '0 0 1' * autocvar_g_nexball_football_boost_up; + makevectors(toucher.v_angle); + this.velocity = toucher.velocity + v_forward * autocvar_g_nexball_football_boost_forward + '0 0 1' * autocvar_g_nexball_football_boost_up; } else if(autocvar_g_nexball_football_physics == 2) // 2nd mod try: totally independant. Really playable! { - makevectors(other.v_angle.y * '0 1 0'); - this.velocity = other.velocity + v_forward * autocvar_g_nexball_football_boost_forward + v_up * autocvar_g_nexball_football_boost_up; + makevectors(toucher.v_angle.y * '0 1 0'); + this.velocity = toucher.velocity + v_forward * autocvar_g_nexball_football_boost_forward + v_up * autocvar_g_nexball_football_boost_up; } else // Revenant's original style (from the original mod's disassembly, acknowledged by Revenant) { - makevectors(other.v_angle); - this.velocity = other.velocity + v_forward * autocvar_g_nexball_football_boost_forward + v_up * autocvar_g_nexball_football_boost_up; + makevectors(toucher.v_angle); + this.velocity = toucher.velocity + v_forward * autocvar_g_nexball_football_boost_forward + v_up * autocvar_g_nexball_football_boost_up; } this.avelocity = -250 * v_forward; // maybe there is a way to make it look better? } -void basketball_touch(entity this) +void basketball_touch(entity this, entity toucher) { - if(other.ballcarried) + if(toucher.ballcarried) { - football_touch(this); + football_touch(this, toucher); return; } - if(!this.cnt && IS_PLAYER(other) && !STAT(FROZEN, other) && !IS_DEAD(other) && (other != this.nb_dropper || time > this.nb_droptime + autocvar_g_nexball_delay_collect)) + if(!this.cnt && IS_PLAYER(toucher) && !STAT(FROZEN, toucher) && !IS_DEAD(toucher) && (toucher != this.nb_dropper || time > this.nb_droptime + autocvar_g_nexball_delay_collect)) { - if(other.health <= 0) + if(toucher.health <= 0) return; - LogNB("caught", other); - GiveBall(other, this); + LogNB("caught", toucher); + GiveBall(toucher, this); } - else if(other.solid == SOLID_BSP) + else if(toucher.solid == SOLID_BSP) { _sound(this, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM); if(this.velocity && !this.cnt) @@ -357,23 +357,23 @@ void basketball_touch(entity this) } } -void GoalTouch(entity this) +void GoalTouch(entity this, entity toucher) { entity ball; float isclient, pscore, otherteam; string pname; if(gameover) return; - if((this.spawnflags & GOAL_TOUCHPLAYER) && other.ballcarried) - ball = other.ballcarried; + if((this.spawnflags & GOAL_TOUCHPLAYER) && toucher.ballcarried) + ball = toucher.ballcarried; else - ball = other; + ball = toucher; if(ball.classname != "nexball_basketball") if(ball.classname != "nexball_football") return; if((!ball.pusher && this.team != GOAL_OUT) || ball.cnt) return; - EXACTTRIGGER_TOUCH; + EXACTTRIGGER_TOUCH(this, toucher); if(nb_teams == 2) @@ -730,32 +730,32 @@ void W_Nexball_Think(entity this) this.nextthink = time; } -void W_Nexball_Touch(entity this) +void W_Nexball_Touch(entity this, entity toucher) { entity ball, attacker; attacker = this.owner; //this.think = func_null; //this.enemy = NULL; - PROJECTILE_TOUCH(this); - if(attacker.team != other.team || autocvar_g_nexball_basketball_teamsteal) - if((ball = other.ballcarried) && !STAT(FROZEN, other) && !IS_DEAD(other) && (IS_PLAYER(attacker))) + PROJECTILE_TOUCH(this, toucher); + if(attacker.team != toucher.team || autocvar_g_nexball_basketball_teamsteal) + if((ball = toucher.ballcarried) && !STAT(FROZEN, toucher) && !IS_DEAD(toucher) && (IS_PLAYER(attacker))) { - other.velocity = other.velocity + normalize(this.velocity) * other.damageforcescale * autocvar_g_balance_nexball_secondary_force; - UNSET_ONGROUND(other); + toucher.velocity = toucher.velocity + normalize(this.velocity) * toucher.damageforcescale * autocvar_g_balance_nexball_secondary_force; + UNSET_ONGROUND(toucher); if(!attacker.ballcarried) { LogNB("stole", attacker); - _sound(other, CH_TRIGGER, ball.noise2, VOL_BASE, ATTEN_NORM); + _sound(toucher, CH_TRIGGER, ball.noise2, VOL_BASE, ATTEN_NORM); - if(SAME_TEAM(attacker, other) && time > attacker.teamkill_complain) + if(SAME_TEAM(attacker, toucher) && time > attacker.teamkill_complain) { attacker.teamkill_complain = time + 5; attacker.teamkill_soundtime = time + 0.4; - attacker.teamkill_soundsource = other; + attacker.teamkill_soundsource = toucher; } - GiveBall(attacker, other.ballcarried); + GiveBall(attacker, toucher.ballcarried); } } remove(this); diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc index 9a30445ac..d2a070f27 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc @@ -172,25 +172,25 @@ bool ons_CaptureShield_Customize(entity this) return true; } -void ons_CaptureShield_Touch(entity this) +void ons_CaptureShield_Touch(entity this, entity toucher) { - if(!this.enemy.isshielded && (ons_ControlPoint_Attackable(this.enemy, other.team) > 0 || this.enemy.classname != "onslaught_controlpoint")) { return; } - if(!IS_PLAYER(other)) { return; } - if(SAME_TEAM(other, this)) { return; } + if(!this.enemy.isshielded && (ons_ControlPoint_Attackable(this.enemy, toucher.team) > 0 || this.enemy.classname != "onslaught_controlpoint")) { return; } + if(!IS_PLAYER(toucher)) { return; } + if(SAME_TEAM(toucher, this)) { return; } vector mymid = (this.absmin + this.absmax) * 0.5; - vector othermid = (other.absmin + other.absmax) * 0.5; + vector theirmid = (toucher.absmin + toucher.absmax) * 0.5; - Damage(other, this, this, 0, DEATH_HURTTRIGGER.m_id, mymid, normalize(othermid - mymid) * ons_captureshield_force); + Damage(toucher, this, this, 0, DEATH_HURTTRIGGER.m_id, mymid, normalize(theirmid - mymid) * ons_captureshield_force); - if(IS_REAL_CLIENT(other)) + if(IS_REAL_CLIENT(toucher)) { - play2(other, SND(ONS_DAMAGEBLOCKEDBYSHIELD)); + play2(toucher, SND(ONS_DAMAGEBLOCKEDBYSHIELD)); if(this.enemy.classname == "onslaught_generator") - Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_ONS_GENERATOR_SHIELDED); + Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_GENERATOR_SHIELDED); else - Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_ONS_CONTROLPOINT_SHIELDED); + Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_CONTROLPOINT_SHIELDED); } } @@ -776,9 +776,8 @@ void ons_ControlPoint_UpdateSprite(entity e) } } -void ons_ControlPoint_Touch(entity this) +void ons_ControlPoint_Touch(entity this, entity toucher) { - entity toucher = other; int attackable; if(IS_VEHICLE(toucher) && toucher.owner) @@ -1083,13 +1082,13 @@ void ons_DelayedGeneratorSetup(entity this) } -void onslaught_generator_touch(entity this) +void onslaught_generator_touch(entity this, entity toucher) { - if ( IS_PLAYER(other) ) - if ( SAME_TEAM(this,other) ) + if ( IS_PLAYER(toucher) ) + if ( SAME_TEAM(this,toucher) ) if ( this.iscaptured ) { - Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_ONS_TELEPORT); + Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_TELEPORT); } } diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index c964b3082..55fffb1b6 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -160,11 +160,11 @@ void M_Mage_Attack_Spike_Explode(entity this) remove (this); } -void M_Mage_Attack_Spike_Touch(entity this) +void M_Mage_Attack_Spike_Touch(entity this, entity toucher) { - PROJECTILE_TOUCH(this); + PROJECTILE_TOUCH(this, toucher); - M_Mage_Attack_Spike_Explode(this); + WITH(entity, other, toucher, M_Mage_Attack_Spike_Explode(this)); } .float wait; diff --git a/qcsrc/common/monsters/monster/shambler.qc b/qcsrc/common/monsters/monster/shambler.qc index b94332c30..14be454dc 100644 --- a/qcsrc/common/monsters/monster/shambler.qc +++ b/qcsrc/common/monsters/monster/shambler.qc @@ -122,11 +122,11 @@ void M_Shambler_Attack_Lightning_Damage(entity this, entity inflictor, entity at W_PrepareExplosionByDamage(this, attacker, adaptor_think2use); } -void M_Shambler_Attack_Lightning_Touch(entity this) +void M_Shambler_Attack_Lightning_Touch(entity this, entity toucher) { - PROJECTILE_TOUCH(this); + PROJECTILE_TOUCH(this, toucher); - this.use(this, NULL, NULL); + WITH(entity, other, toucher, this.use(this, NULL, NULL)); } void M_Shambler_Attack_Lightning_Think(entity this) diff --git a/qcsrc/common/monsters/monster/spider.qc b/qcsrc/common/monsters/monster/spider.qc index d1ff169b6..b6d41dbb4 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -157,9 +157,9 @@ void M_Spider_Attack_Web_Explode_use(entity this, entity actor, entity trigger) M_Spider_Attack_Web_Explode(this); } -void M_Spider_Attack_Web_Touch(entity this) +void M_Spider_Attack_Web_Touch(entity this, entity toucher) { - PROJECTILE_TOUCH(this); + PROJECTILE_TOUCH(this, toucher); M_Spider_Attack_Web_Explode(this); } diff --git a/qcsrc/common/monsters/monster/wyvern.qc b/qcsrc/common/monsters/monster/wyvern.qc index 001b2e24d..345d6459c 100644 --- a/qcsrc/common/monsters/monster/wyvern.qc +++ b/qcsrc/common/monsters/monster/wyvern.qc @@ -46,7 +46,7 @@ float autocvar_g_monster_wyvern_attack_fireball_radius; float autocvar_g_monster_wyvern_attack_fireball_speed; void M_Wyvern_Attack_Fireball_Explode(entity this); -void M_Wyvern_Attack_Fireball_Touch(entity this); +void M_Wyvern_Attack_Fireball_Touch(entity this, entity toucher); SOUND(WyvernAttack_FIRE, W_Sound("electro_fire")); METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, .entity weaponentity, int fire)) @@ -116,9 +116,9 @@ void M_Wyvern_Attack_Fireball_Explode(entity this) remove(this); } -void M_Wyvern_Attack_Fireball_Touch(entity this) +void M_Wyvern_Attack_Fireball_Touch(entity this, entity toucher) { - PROJECTILE_TOUCH(this); + PROJECTILE_TOUCH(this, toucher); M_Wyvern_Attack_Fireball_Explode(this); } diff --git a/qcsrc/common/monsters/monster/zombie.qc b/qcsrc/common/monsters/monster/zombie.qc index 1eafd4bfd..fd270a1e1 100644 --- a/qcsrc/common/monsters/monster/zombie.qc +++ b/qcsrc/common/monsters/monster/zombie.qc @@ -75,18 +75,18 @@ const float zombie_anim_spawn = 30; .vector moveto; -void M_Zombie_Attack_Leap_Touch(entity this) +void M_Zombie_Attack_Leap_Touch(entity this, entity toucher) { if (this.health <= 0) return; vector angles_face; - if(other.takedamage) + if(toucher.takedamage) { angles_face = vectoangles(this.moveto - this.origin); angles_face = normalize(angles_face) * (autocvar_g_monster_zombie_attack_leap_force); - Damage(other, this, this, (autocvar_g_monster_zombie_attack_leap_damage) * MONSTER_SKILLMOD(this), DEATH_MONSTER_ZOMBIE_JUMP.m_id, other.origin, angles_face); + Damage(toucher, this, this, (autocvar_g_monster_zombie_attack_leap_damage) * MONSTER_SKILLMOD(this), DEATH_MONSTER_ZOMBIE_JUMP.m_id, toucher.origin, angles_face); settouch(this, Monster_Touch); // instantly turn it off to stop damage spam this.state = 0; } diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 5e9eaef32..795e0310a 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -391,7 +391,7 @@ bool Monster_Attack_Leap_Check(entity this, vector vel) return true; } -bool Monster_Attack_Leap(entity this, vector anm, void(entity this) touchfunc, vector vel, float animtime) +bool Monster_Attack_Leap(entity this, vector anm, void(entity this, entity toucher) touchfunc, vector vel, float animtime) { if(!Monster_Attack_Leap_Check(this, vel)) return false; @@ -463,15 +463,15 @@ void Monster_UpdateModel(entity this) mon.mr_anim(mon, this); } -void Monster_Touch(entity this) +void Monster_Touch(entity this, entity toucher) { - if(other == NULL) { return; } + if(toucher == NULL) { return; } - if(other.monster_attack) - if(this.enemy != other) - if(!IS_MONSTER(other)) - if(Monster_ValidTarget(this, other)) - this.enemy = other; + if(toucher.monster_attack) + if(this.enemy != toucher) + if(!IS_MONSTER(toucher)) + if(Monster_ValidTarget(this, toucher)) + this.enemy = toucher; } void Monster_Miniboss_Check(entity this) diff --git a/qcsrc/common/monsters/sv_monsters.qh b/qcsrc/common/monsters/sv_monsters.qh index f8501fc75..ffade7b6a 100644 --- a/qcsrc/common/monsters/sv_monsters.qh +++ b/qcsrc/common/monsters/sv_monsters.qh @@ -77,7 +77,7 @@ bool Monster_Spawn(entity this, int mon_id); void monster_setupcolors(entity this); -void Monster_Touch(entity this); +void Monster_Touch(entity this, entity toucher); void Monster_Move_2D(entity this, float mspeed, float allow_jumpoff); @@ -85,7 +85,7 @@ void Monster_Delay(entity this, int repeat_count, float defer_amnt, void(entity) float Monster_Attack_Melee(entity this, entity targ, float damg, vector anim, float er, float animtime, int deathtype, float dostop); -bool Monster_Attack_Leap(entity this, vector anm, void(entity this) touchfunc, vector vel, float animtime); +bool Monster_Attack_Leap(entity this, vector anm, void(entity this, entity toucher) touchfunc, vector vel, float animtime); entity Monster_FindTarget(entity this); diff --git a/qcsrc/common/mutators/mutator/buffs/buffs.qc b/qcsrc/common/mutators/mutator/buffs/buffs.qc index 1e873105b..c1ff98b67 100644 --- a/qcsrc/common/mutators/mutator/buffs/buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/buffs.qc @@ -222,7 +222,7 @@ void buff_Respawn(entity this) sound(this, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere) } -void buff_Touch(entity this) +void buff_Touch(entity this, entity toucher) { if(gameover) { return; } @@ -232,9 +232,9 @@ void buff_Touch(entity this) return; } - if((this.team && DIFF_TEAM(other, this)) - || (STAT(FROZEN, other)) - || (other.vehicle) + if((this.team && DIFF_TEAM(toucher, this)) + || (STAT(FROZEN, toucher)) + || (toucher.vehicle) || (!this.buff_active) ) { @@ -242,37 +242,37 @@ void buff_Touch(entity this) return; } - if(MUTATOR_CALLHOOK(BuffTouch, this, other)) + if(MUTATOR_CALLHOOK(BuffTouch, this, toucher)) return; - other = M_ARGV(1, entity); + toucher = M_ARGV(1, entity); - if(!IS_PLAYER(other)) - return; // incase mutator changed other + if(!IS_PLAYER(toucher)) + return; // incase mutator changed toucher - if (other.buffs) + if (toucher.buffs) { - if (other.cvar_cl_buffs_autoreplace && other.buffs != this.buffs) + if (toucher.cvar_cl_buffs_autoreplace && toucher.buffs != this.buffs) { - int buffid = buff_FirstFromFlags(other.buffs).m_id; - //Send_Notification(NOTIF_ONE, other, MSG_MULTI, ITEM_BUFF_DROP, other.buffs); - Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ITEM_BUFF_LOST, other.netname, buffid); + int buffid = buff_FirstFromFlags(toucher.buffs).m_id; + //Send_Notification(NOTIF_ONE, toucher, MSG_MULTI, ITEM_BUFF_DROP, toucher.buffs); + Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ITEM_BUFF_LOST, toucher.netname, buffid); - other.buffs = 0; - //sound(other, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM); + toucher.buffs = 0; + //sound(toucher, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM); } else { return; } // do nothing } - this.owner = other; + this.owner = toucher; this.buff_active = false; this.lifetime = 0; int buffid = buff_FirstFromFlags(this.buffs).m_id; - Send_Notification(NOTIF_ONE, other, MSG_MULTI, ITEM_BUFF_GOT, buffid); - Send_Notification(NOTIF_ALL_EXCEPT, other, MSG_INFO, INFO_ITEM_BUFF, other.netname, buffid); + Send_Notification(NOTIF_ONE, toucher, MSG_MULTI, ITEM_BUFF_GOT, buffid); + Send_Notification(NOTIF_ALL_EXCEPT, toucher, MSG_INFO, INFO_ITEM_BUFF, toucher.netname, buffid); Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(this), '0 0 0', 1); - sound(other, CH_TRIGGER, SND_SHIELD_RESPAWN, VOL_BASE, ATTN_NORM); - other.buffs |= (this.buffs); + sound(toucher, CH_TRIGGER, SND_SHIELD_RESPAWN, VOL_BASE, ATTN_NORM); + toucher.buffs |= (this.buffs); } float buff_Available(entity buff) @@ -907,12 +907,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink) if(boxesoverlap(player.absmin - pickup_size, player.absmax + pickup_size, it.absmin, it.absmax)) { if(gettouch(it)) - { - entity oldother = other; - other = player; - gettouch(it)(it); - other = oldother; - } + gettouch(it)(it, player); } }); } diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index 7336c34a4..d9f4a396a 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -559,35 +559,35 @@ entity nades_spawn_orb(entity own, entity realown, vector org, float orb_ltime, return orb; } -void nade_entrap_touch(entity this) +void nade_entrap_touch(entity this, entity toucher) { - if(DIFF_TEAM(other, this.realowner)) // TODO: what if realowner changes team or disconnects? + if(DIFF_TEAM(toucher, this.realowner)) // TODO: what if realowner changes team or disconnects? { - if (!isPushable(other)) + if (!isPushable(toucher)) return; - float pushdeltatime = time - other.lastpushtime; + float pushdeltatime = time - toucher.lastpushtime; if (pushdeltatime > 0.15) pushdeltatime = 0; - other.lastpushtime = time; + toucher.lastpushtime = time; if(!pushdeltatime) return; // div0: ticrate independent, 1 = identity (not 20) #ifdef SVQC - other.velocity = other.velocity * pow(autocvar_g_nades_entrap_strength, pushdeltatime); + toucher.velocity = toucher.velocity * pow(autocvar_g_nades_entrap_strength, pushdeltatime); - UpdateCSQCProjectile(other); + UpdateCSQCProjectile(toucher); #elif defined(CSQC) - other.move_velocity = other.move_velocity * pow(autocvar_g_nades_entrap_strength, pushdeltatime); + toucher.move_velocity = toucher.move_velocity * pow(autocvar_g_nades_entrap_strength, pushdeltatime); #endif } - if ( IS_REAL_CLIENT(other) || IS_VEHICLE(other) || IS_MONSTER(other) ) + if ( IS_REAL_CLIENT(toucher) || IS_VEHICLE(toucher) || IS_MONSTER(toucher) ) { - entity show_tint = (IS_VEHICLE(other)) ? other.owner : other; + entity show_tint = (IS_VEHICLE(toucher)) ? toucher.owner : toucher; STAT(ENTRAP_ORB, show_tint) = time + 0.1; float tint_alpha = 0.75; - if(SAME_TEAM(other, this.realowner)) + if(SAME_TEAM(toucher, this.realowner)) tint_alpha = 0.45; STAT(ENTRAP_ORB_ALPHA, show_tint) = tint_alpha * (this.ltime - time) / this.orb_lifetime; } @@ -601,43 +601,43 @@ void nade_entrap_boom(entity this) orb.colormod = NADE_TYPE_ENTRAP.m_color; } -void nade_heal_touch(entity this) +void nade_heal_touch(entity this, entity toucher) { float maxhealth; float health_factor; - if(IS_PLAYER(other) || IS_MONSTER(other)) - if(!IS_DEAD(other)) - if(!STAT(FROZEN, other)) + if(IS_PLAYER(toucher) || IS_MONSTER(toucher)) + if(!IS_DEAD(toucher)) + if(!STAT(FROZEN, toucher)) { health_factor = autocvar_g_nades_heal_rate*frametime/2; - if ( other != this.realowner ) + if ( toucher != this.realowner ) { - if ( SAME_TEAM(other,this) ) + if ( SAME_TEAM(toucher,this) ) health_factor *= autocvar_g_nades_heal_friend; else health_factor *= autocvar_g_nades_heal_foe; } if ( health_factor > 0 ) { - maxhealth = (IS_MONSTER(other)) ? other.max_health : g_pickup_healthmega_max; - if ( other.health < maxhealth ) + maxhealth = (IS_MONSTER(toucher)) ? toucher.max_health : g_pickup_healthmega_max; + if ( toucher.health < maxhealth ) { if ( this.nade_show_particles ) - Send_Effect(EFFECT_HEALING, other.origin, '0 0 0', 1); - other.health = min(other.health+health_factor, maxhealth); + Send_Effect(EFFECT_HEALING, toucher.origin, '0 0 0', 1); + toucher.health = min(toucher.health+health_factor, maxhealth); } - other.pauserothealth_finished = max(other.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot); + toucher.pauserothealth_finished = max(toucher.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot); } else if ( health_factor < 0 ) { - Damage(other,this,this.realowner,-health_factor,DEATH_NADE_HEAL.m_id,other.origin,'0 0 0'); + Damage(toucher,this,this.realowner,-health_factor,DEATH_NADE_HEAL.m_id,toucher.origin,'0 0 0'); } } - if ( IS_REAL_CLIENT(other) || IS_VEHICLE(other) ) + if ( IS_REAL_CLIENT(toucher) || IS_VEHICLE(toucher) ) { - entity show_red = (IS_VEHICLE(other)) ? other.owner : other; + entity show_red = (IS_VEHICLE(toucher)) ? toucher.owner : toucher; show_red.stat_healing_orb = time+0.1; show_red.stat_healing_orb_alpha = 0.75 * (this.ltime - time) / this.orb_lifetime; } @@ -756,22 +756,22 @@ void nade_pickup(entity this, entity thenade) } bool CanThrowNade(entity this); -void nade_touch(entity this) +void nade_touch(entity this, entity toucher) { - if(other) + if(toucher) UpdateCSQCProjectile(this); - if(other == this.realowner) + if(toucher == this.realowner) return; // no this impacts if(autocvar_g_nades_pickup) if(time >= this.spawnshieldtime) - if(!other.nade && this.health == this.max_health) // no boosted shot pickups, thank you very much - if(!other.frozen) - if(CanThrowNade(other)) // prevent some obvious things, like dead players - if(IS_REAL_CLIENT(other)) // above checks for IS_PLAYER, don't need to do it here + if(!toucher.nade && this.health == this.max_health) // no boosted shot pickups, thank you very much + if(!toucher.frozen) + if(CanThrowNade(toucher)) // prevent some obvious things, like dead players + if(IS_REAL_CLIENT(toucher)) // above checks for IS_PLAYER, don't need to do it here { - nade_pickup(other, this); + nade_pickup(toucher, this); sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX)); remove(this); return; @@ -792,7 +792,7 @@ void nade_touch(entity this) return; } - PROJECTILE_TOUCH(this); + PROJECTILE_TOUCH(this, toucher); //setsize(this, '-2 -2 -2', '2 2 2'); //UpdateCSQCProjectile(this); @@ -802,7 +802,7 @@ void nade_touch(entity this) return; } - this.enemy = other; + this.enemy = toucher; nade_boom(this); } diff --git a/qcsrc/common/mutators/mutator/overkill/rpc.qc b/qcsrc/common/mutators/mutator/overkill/rpc.qc index 90c671a60..035c64c7c 100644 --- a/qcsrc/common/mutators/mutator/overkill/rpc.qc +++ b/qcsrc/common/mutators/mutator/overkill/rpc.qc @@ -60,13 +60,13 @@ void W_RocketPropelledChainsaw_Explode(entity this) remove (this); } -void W_RocketPropelledChainsaw_Touch (entity this) +void W_RocketPropelledChainsaw_Touch (entity this, entity toucher) { - if(WarpZone_Projectile_Touch(this)) + if(WarpZone_Projectile_Touch(this, toucher)) if(wasfreed(this)) return; - W_RocketPropelledChainsaw_Explode(this); + WITH(entity, other, toucher, W_RocketPropelledChainsaw_Explode(this)); } void W_RocketPropelledChainsaw_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) diff --git a/qcsrc/common/mutators/mutator/physical_items/physical_items.qc b/qcsrc/common/mutators/mutator/physical_items/physical_items.qc index 10ec0cf5a..6e4bfa566 100644 --- a/qcsrc/common/mutators/mutator/physical_items/physical_items.qc +++ b/qcsrc/common/mutators/mutator/physical_items/physical_items.qc @@ -68,7 +68,7 @@ void physical_item_think(entity this) remove(this); // the real item is gone, remove this } -void physical_item_touch(entity this) +void physical_item_touch(entity this, entity toucher) { if(!this.cnt) // not for dropped items if (ITEM_TOUCH_NEEDKILL()) diff --git a/qcsrc/common/mutators/mutator/sandbox/sandbox.qc b/qcsrc/common/mutators/mutator/sandbox/sandbox.qc index bc4cb6775..cb9307859 100644 --- a/qcsrc/common/mutators/mutator/sandbox/sandbox.qc +++ b/qcsrc/common/mutators/mutator/sandbox/sandbox.qc @@ -34,7 +34,7 @@ float object_count; .string material; .float touch_timer; -void sandbox_ObjectFunction_Touch(entity this) +void sandbox_ObjectFunction_Touch(entity this, entity toucher) { // apply material impact effects @@ -46,7 +46,7 @@ void sandbox_ObjectFunction_Touch(entity this) // make particle count and sound volume depend on impact speed float intensity; - intensity = vlen(this.velocity) + vlen(other.velocity); + intensity = vlen(this.velocity) + vlen(toucher.velocity); if(intensity) // avoid divisions by 0 intensity /= 2; // average the two velocities if (!(intensity >= autocvar_g_sandbox_object_material_velocity_min)) diff --git a/qcsrc/common/physics/movetypes/movetypes.qc b/qcsrc/common/physics/movetypes/movetypes.qc index a68e3e3a0..78429dda9 100644 --- a/qcsrc/common/physics/movetypes/movetypes.qc +++ b/qcsrc/common/physics/movetypes/movetypes.qc @@ -315,25 +315,11 @@ void _Movetype_CheckWaterTransition(entity ent) // SV_CheckWaterTransition void _Movetype_Impact(entity this, entity oth) // SV_Impact { - entity oldother = other; - if(gettouch(this)) - { - other = oth; - - gettouch(this)(this); - - other = oldother; - } + gettouch(this)(this, oth); if(gettouch(oth)) - { - other = this; - - gettouch(oth)(oth); - - other = oldother; - } + gettouch(oth)(oth, this); } void _Movetype_LinkEdict_TouchAreaGrid(entity this) // SV_LinkEdict_TouchAreaGrid @@ -341,15 +327,11 @@ void _Movetype_LinkEdict_TouchAreaGrid(entity this) // SV_LinkEdict_TouchAreaGr if(this.solid == SOLID_NOT) return; - entity oldother = other; - FOREACH_ENTITY_RADIUS(0.5 * (this.absmin + this.absmax), 0.5 * vlen(this.absmax - this.absmin), true, { if (it.solid == SOLID_TRIGGER && it != this) if (it.move_nomonsters != MOVE_NOMONSTERS && it.move_nomonsters != MOVE_WORLDONLY) if (gettouch(it) && boxesoverlap(it.absmin, it.absmax, this.absmin, this.absmax)) { - other = this; - trace_allsolid = false; trace_startsolid = false; trace_fraction = 1; @@ -360,11 +342,9 @@ void _Movetype_LinkEdict_TouchAreaGrid(entity this) // SV_LinkEdict_TouchAreaGr trace_plane_dist = 0; trace_ent = this; - gettouch(it)(it); + gettouch(it)(it, this); } }); - - other = oldother; } void _Movetype_LinkEdict(entity this, bool touch_triggers) // SV_LinkEdict diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 1bf751f91..2ab3d6191 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -761,7 +761,7 @@ LABEL(skip) return 1; } -void Item_Touch(entity this) +void Item_Touch(entity this, entity toucher) { // remove the item if it's currnetly in a NODROP brush or hits a NOIMPACT surface (such as sky) @@ -774,21 +774,21 @@ void Item_Touch(entity this) } } - if(!(other.flags & FL_PICKUPITEMS) - || STAT(FROZEN, other) - || IS_DEAD(other) + if(!(toucher.flags & FL_PICKUPITEMS) + || STAT(FROZEN, toucher) + || IS_DEAD(toucher) || (this.solid != SOLID_TRIGGER) - || (this.owner == other) + || (this.owner == toucher) || (time < this.item_spawnshieldtime) ) { return; } - switch (MUTATOR_CALLHOOK(ItemTouch, this, other)) + switch (MUTATOR_CALLHOOK(ItemTouch, this, toucher)) { case MUT_ITEMTOUCH_RETURN: { return; } - case MUT_ITEMTOUCH_PICKUP: { other = M_ARGV(1, entity); goto pickup; } + case MUT_ITEMTOUCH_PICKUP: { toucher = M_ARGV(1, entity); goto pickup; } } - other = M_ARGV(1, entity); + toucher = M_ARGV(1, entity); if (this.classname == "droppedweapon") { @@ -797,7 +797,7 @@ void Item_Touch(entity this) this.superweapons_finished = max(0, this.superweapons_finished - time); } entity it = this.itemdef; - bool gave = ITEM_HANDLE(Pickup, it, this, other); + bool gave = ITEM_HANDLE(Pickup, it, this, toucher); if (!gave) { if (this.classname == "droppedweapon") @@ -812,10 +812,10 @@ void Item_Touch(entity this) LABEL(pickup) - other.last_pickup = time; + toucher.last_pickup = time; Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(this), '0 0 0', 1); - _sound (other, (this.itemdef.instanceOfPowerup ? CH_TRIGGER_SINGLE : CH_TRIGGER), (this.item_pickupsound ? this.item_pickupsound : Sound_fixpath(this.item_pickupsound_ent)), VOL_BASE, ATTEN_NORM); + _sound (toucher, (this.itemdef.instanceOfPowerup ? CH_TRIGGER_SINGLE : CH_TRIGGER), (this.item_pickupsound ? this.item_pickupsound : Sound_fixpath(this.item_pickupsound_ent)), VOL_BASE, ATTEN_NORM); if (this.classname == "droppedweapon") remove (this); @@ -1421,11 +1421,9 @@ spawnfunc(item_quad) { this.classname = "item_strength";spawnfunc_item_strength( void target_items_use(entity this, entity actor, entity trigger) { - other = trigger; // TODO - if(actor.classname == "droppedweapon") { - EXACTTRIGGER_TOUCH; + EXACTTRIGGER_TOUCH(this, trigger); remove(actor); return; } @@ -1436,7 +1434,7 @@ void target_items_use(entity this, entity actor, entity trigger) return; if(trigger.solid == SOLID_TRIGGER) { - EXACTTRIGGER_TOUCH; + EXACTTRIGGER_TOUCH(this, trigger); } FOREACH_ENTITY_ENT(enemy, actor, diff --git a/qcsrc/common/t_items.qh b/qcsrc/common/t_items.qh index 5ebc9d7e6..1ed807c7c 100644 --- a/qcsrc/common/t_items.qh +++ b/qcsrc/common/t_items.qh @@ -88,7 +88,7 @@ float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax float Item_GiveTo(entity item, entity player); -void Item_Touch(entity this); +void Item_Touch(entity this, entity toucher); void Item_Reset(entity this); diff --git a/qcsrc/common/triggers/func/button.qc b/qcsrc/common/triggers/func/button.qc index a8ec50a86..f419553b3 100644 --- a/qcsrc/common/triggers/func/button.qc +++ b/qcsrc/common/triggers/func/button.qc @@ -68,17 +68,17 @@ void button_use(entity this, entity actor, entity trigger) button_fire(this); } -void button_touch(entity this) +void button_touch(entity this, entity toucher) { - if (!other) + if (!toucher) return; - if (!other.iscreature) + if (!toucher.iscreature) return; - if(other.velocity * this.movedir < 0) + if(toucher.velocity * this.movedir < 0) return; - this.enemy = other; - if (other.owner) - this.enemy = other.owner; + this.enemy = toucher; + if (toucher.owner) + this.enemy = toucher.owner; button_fire (this); } diff --git a/qcsrc/common/triggers/func/door.qc b/qcsrc/common/triggers/func/door.qc index f32a8d75d..25c1a27b3 100644 --- a/qcsrc/common/triggers/func/door.qc +++ b/qcsrc/common/triggers/func/door.qc @@ -289,9 +289,9 @@ Prints messages ================ */ -void door_touch(entity this) +void door_touch(entity this, entity toucher) { - if (!IS_PLAYER(other)) + if (!IS_PLAYER(toucher)) return; if (this.owner.door_finished > time) return; @@ -301,17 +301,16 @@ void door_touch(entity this) #ifdef SVQC if (!(this.owner.dmg) && (this.owner.message != "")) { - if (IS_CLIENT(other)) - centerprint(other, this.owner.message); - play2(other, this.owner.noise); + if (IS_CLIENT(toucher)) + centerprint(toucher, this.owner.message); + play2(toucher, this.owner.noise); } #endif } void door_generic_plat_blocked(entity this) { - - if((this.spawnflags & 8) && (other.takedamage != DAMAGE_NO)) { // KIll Kill Kill!! + if((this.spawnflags & 8) && (other.takedamage != DAMAGE_NO)) { // Kill Kill Kill!! #ifdef SVQC Damage (other, this, this, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); #endif @@ -414,13 +413,13 @@ Spawned if a door lacks a real activator ========================================= */ -void door_trigger_touch(entity this) +void door_trigger_touch(entity this, entity toucher) { - if (other.health < 1) + if (toucher.health < 1) #ifdef SVQC - if (!((other.iscreature || (other.flags & FL_PROJECTILE)) && !IS_DEAD(other))) + if (!((toucher.iscreature || (toucher.flags & FL_PROJECTILE)) && !IS_DEAD(toucher))) #elif defined(CSQC) - if(!((IS_CLIENT(other) || other.classname == "csqcprojectile") && !IS_DEAD(other))) + if(!((IS_CLIENT(toucher) || toucher.classname == "csqcprojectile") && !IS_DEAD(toucher))) #endif return; @@ -428,12 +427,12 @@ void door_trigger_touch(entity this) return; // check if door is locked - if (!door_check_keys(this, other)) + if (!door_check_keys(this, toucher)) return; this.door_finished = time + 1; - door_use(this.owner, other, NULL); + door_use(this.owner, toucher, NULL); } void door_spawnfield(entity this, vector fmins, vector fmaxs) diff --git a/qcsrc/common/triggers/func/door_secret.qc b/qcsrc/common/triggers/func/door_secret.qc index f02fc61f6..3ae918fac 100644 --- a/qcsrc/common/triggers/func/door_secret.qc +++ b/qcsrc/common/triggers/func/door_secret.qc @@ -150,9 +150,9 @@ secret_touch Prints messages ================ */ -void secret_touch(entity this) +void secret_touch(entity this, entity toucher) { - if (!other.iscreature) + if (!toucher.iscreature) return; if (this.door_finished > time) return; @@ -161,9 +161,9 @@ void secret_touch(entity this) if (this.message) { - if (IS_CLIENT(other)) - centerprint(other, this.message); - play2(other, this.noise); + if (IS_CLIENT(toucher)) + centerprint(toucher, this.message); + play2(toucher, this.noise); } } diff --git a/qcsrc/common/triggers/func/ladder.qc b/qcsrc/common/triggers/func/ladder.qc index af5065643..ae9160dfd 100644 --- a/qcsrc/common/triggers/func/ladder.qc +++ b/qcsrc/common/triggers/func/ladder.qc @@ -1,21 +1,21 @@ REGISTER_NET_LINKED(ENT_CLIENT_LADDER) -void func_ladder_touch(entity this) +void func_ladder_touch(entity this, entity toucher) { #ifdef SVQC - if (!other.iscreature) + if (!toucher.iscreature) return; - if(IS_VEHICLE(other)) + if(IS_VEHICLE(toucher)) return; #elif defined(CSQC) - if(!other.isplayermodel) + if(!toucher.isplayermodel) return; #endif - EXACTTRIGGER_TOUCH; + EXACTTRIGGER_TOUCH(this, toucher); - other.ladder_time = time + 0.1; - other.ladder_entity = this; + toucher.ladder_time = time + 0.1; + toucher.ladder_entity = this; } #ifdef SVQC diff --git a/qcsrc/common/triggers/platforms.qc b/qcsrc/common/triggers/platforms.qc index c089039a6..93a57941b 100644 --- a/qcsrc/common/triggers/platforms.qc +++ b/qcsrc/common/triggers/platforms.qc @@ -86,18 +86,18 @@ void plat_go_up(entity this) SUB_CalcMove (this, this.pos1, TSPEED_LINEAR, this.speed, plat_hit_top); } -void plat_center_touch(entity this) +void plat_center_touch(entity this, entity toucher) { #ifdef SVQC - if (!other.iscreature) + if (!toucher.iscreature) return; - if (other.health <= 0) + if (toucher.health <= 0) return; #elif defined(CSQC) - if (!IS_PLAYER(other)) + if (!IS_PLAYER(toucher)) return; - if(IS_DEAD(other)) + if(IS_DEAD(toucher)) return; #endif @@ -107,16 +107,16 @@ void plat_center_touch(entity this) this.enemy.SUB_NEXTTHINK = this.enemy.SUB_LTIME + 1; } -void plat_outside_touch(entity this) +void plat_outside_touch(entity this, entity toucher) { #ifdef SVQC - if (!other.iscreature) + if (!toucher.iscreature) return; - if (other.health <= 0) + if (toucher.health <= 0) return; #elif defined(CSQC) - if (!IS_PLAYER(other)) + if (!IS_PLAYER(toucher)) return; #endif diff --git a/qcsrc/common/triggers/platforms.qh b/qcsrc/common/triggers/platforms.qh index 6bdfb23d6..c728be596 100644 --- a/qcsrc/common/triggers/platforms.qh +++ b/qcsrc/common/triggers/platforms.qh @@ -3,8 +3,8 @@ .float dmgtime2; -void plat_center_touch(entity this); -void plat_outside_touch(entity this); +void plat_center_touch(entity this, entity toucher); +void plat_outside_touch(entity this, entity toucher); void plat_trigger_use(entity this, entity actor, entity trigger); void plat_go_up(entity this); void plat_go_down(entity this); diff --git a/qcsrc/common/triggers/teleporters.qh b/qcsrc/common/triggers/teleporters.qh index ef47b0c6c..c0f45f263 100644 --- a/qcsrc/common/triggers/teleporters.qh +++ b/qcsrc/common/triggers/teleporters.qh @@ -17,7 +17,7 @@ const float TELEPORT_SIMPLE = 2; // only do teleport, nothing special entity Simple_TeleportPlayer(entity teleporter, entity player); -void Teleport_Touch (entity this); +void Teleport_Touch(entity this, entity toucher); void teleport_findtarget(entity this); diff --git a/qcsrc/common/triggers/trigger/gravity.qc b/qcsrc/common/triggers/trigger/gravity.qc index 9dcc710f0..cef8cb8bb 100644 --- a/qcsrc/common/triggers/trigger/gravity.qc +++ b/qcsrc/common/triggers/trigger/gravity.qc @@ -37,50 +37,50 @@ void trigger_gravity_use(entity this, entity actor, entity trigger) this.state = !this.state; } -void trigger_gravity_touch(entity this) +void trigger_gravity_touch(entity this, entity toucher) { float g; if(this.state != true) return; - EXACTTRIGGER_TOUCH; + EXACTTRIGGER_TOUCH(this, toucher); g = this.gravity; if (!(this.spawnflags & 1)) { - if(other.trigger_gravity_check) + if(toucher.trigger_gravity_check) { - if(this == other.trigger_gravity_check.enemy) + if(this == toucher.trigger_gravity_check.enemy) { // same? - other.trigger_gravity_check.count = 2; // gravity one more frame... + toucher.trigger_gravity_check.count = 2; // gravity one more frame... return; } // compare prio - if(this.cnt > other.trigger_gravity_check.enemy.cnt) - trigger_gravity_remove(other); + if(this.cnt > toucher.trigger_gravity_check.enemy.cnt) + trigger_gravity_remove(toucher); else return; } - other.trigger_gravity_check = spawn(); - other.trigger_gravity_check.enemy = this; - other.trigger_gravity_check.owner = other; - other.trigger_gravity_check.gravity = other.gravity; - setthink(other.trigger_gravity_check, trigger_gravity_check_think); - other.trigger_gravity_check.nextthink = time; - other.trigger_gravity_check.count = 2; - if(other.gravity) - g *= other.gravity; + toucher.trigger_gravity_check = spawn(); + toucher.trigger_gravity_check.enemy = this; + toucher.trigger_gravity_check.owner = toucher; + toucher.trigger_gravity_check.gravity = toucher.gravity; + setthink(toucher.trigger_gravity_check, trigger_gravity_check_think); + toucher.trigger_gravity_check.nextthink = time; + toucher.trigger_gravity_check.count = 2; + if(toucher.gravity) + g *= toucher.gravity; } - if (other.gravity != g) + if (toucher.gravity != g) { - other.gravity = g; + toucher.gravity = g; if(this.noise != "") - _sound (other, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM); + _sound (toucher, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM); UpdateCSQCProjectile(this.owner); } } diff --git a/qcsrc/common/triggers/trigger/heal.qc b/qcsrc/common/triggers/trigger/heal.qc index 41519e20c..5a2bc78de 100644 --- a/qcsrc/common/triggers/trigger/heal.qc +++ b/qcsrc/common/triggers/trigger/heal.qc @@ -1,25 +1,25 @@ #ifdef SVQC .float triggerhealtime; -void trigger_heal_touch(entity this) +void trigger_heal_touch(entity this, entity toucher) { if (this.active != ACTIVE_ACTIVE) return; // only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu) - if (other.iscreature) + if (toucher.iscreature) { - if (other.takedamage) - if (!IS_DEAD(other)) - if (other.triggerhealtime < time) + if (toucher.takedamage) + if (!IS_DEAD(toucher)) + if (toucher.triggerhealtime < time) { - EXACTTRIGGER_TOUCH; - other.triggerhealtime = time + 1; + EXACTTRIGGER_TOUCH(this, toucher); + toucher.triggerhealtime = time + 1; - if (other.health < this.max_health) + if (toucher.health < this.max_health) { - other.health = min(other.health + this.health, this.max_health); - other.pauserothealth_finished = max(other.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot); - _sound (other, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM); + toucher.health = min(toucher.health + this.health, this.max_health); + toucher.pauserothealth_finished = max(toucher.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot); + _sound (toucher, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM); } } } diff --git a/qcsrc/common/triggers/trigger/hurt.qc b/qcsrc/common/triggers/trigger/hurt.qc index 92a4dd029..4579fd752 100644 --- a/qcsrc/common/triggers/trigger/hurt.qc +++ b/qcsrc/common/triggers/trigger/hurt.qc @@ -8,23 +8,23 @@ void trigger_hurt_use(entity this, entity actor, entity trigger) } .float triggerhurttime; -void trigger_hurt_touch(entity this) +void trigger_hurt_touch(entity this, entity toucher) { if (this.active != ACTIVE_ACTIVE) return; if(this.team) - if(((this.spawnflags & 4) == 0) == (this.team != other.team)) + if(((this.spawnflags & 4) == 0) == (this.team != toucher.team)) return; // only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu) - if (other.iscreature) + if (toucher.iscreature) { - if (other.takedamage) - if (other.triggerhurttime < time) + if (toucher.takedamage) + if (toucher.triggerhurttime < time) { - EXACTTRIGGER_TOUCH; - other.triggerhurttime = time + 1; + EXACTTRIGGER_TOUCH(this, toucher); + toucher.triggerhurttime = time + 1; entity own; own = this.enemy; @@ -34,15 +34,15 @@ void trigger_hurt_touch(entity this) this.enemy = NULL; // I still hate you all } - Damage (other, this, own, this.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); + Damage (toucher, this, own, this.dmg, DEATH_HURTTRIGGER.m_id, toucher.origin, '0 0 0'); } } - else if(other.damagedbytriggers) + else if(toucher.damagedbytriggers) { - if(other.takedamage) + if(toucher.takedamage) { - EXACTTRIGGER_TOUCH; - Damage(other, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); + EXACTTRIGGER_TOUCH(this, toucher); + Damage(toucher, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, toucher.origin, '0 0 0'); } } diff --git a/qcsrc/common/triggers/trigger/impulse.qc b/qcsrc/common/triggers/trigger/impulse.qc index 91381f487..3d9a87a46 100644 --- a/qcsrc/common/triggers/trigger/impulse.qc +++ b/qcsrc/common/triggers/trigger/impulse.qc @@ -1,5 +1,5 @@ // targeted (directional) mode -void trigger_impulse_touch1(entity this) +void trigger_impulse_touch1(entity this, entity toucher) { entity targ; float pushdeltatime; @@ -8,10 +8,10 @@ void trigger_impulse_touch1(entity this) if (this.active != ACTIVE_ACTIVE) return; - if (!isPushable(other)) + if (!isPushable(toucher)) return; - EXACTTRIGGER_TOUCH; + EXACTTRIGGER_TOUCH(this, toucher); targ = find(NULL, targetname, this.target); if(!targ) @@ -22,9 +22,9 @@ void trigger_impulse_touch1(entity this) } #ifdef SVQC - str = min(this.radius, vlen(this.origin - other.origin)); + str = min(this.radius, vlen(this.origin - toucher.origin)); #elif defined(CSQC) - str = min(this.radius, vlen(this.origin - other.move_origin)); + str = min(this.radius, vlen(this.origin - toucher.move_origin)); #endif if(this.falloff == 1) @@ -34,75 +34,75 @@ void trigger_impulse_touch1(entity this) else str = this.strength; - pushdeltatime = time - other.lastpushtime; + pushdeltatime = time - toucher.lastpushtime; if (pushdeltatime > 0.15) pushdeltatime = 0; - other.lastpushtime = time; + toucher.lastpushtime = time; if(!pushdeltatime) return; if(this.spawnflags & 64) { #ifdef SVQC - float addspeed = str - other.velocity * normalize(targ.origin - this.origin); + float addspeed = str - toucher.velocity * normalize(targ.origin - this.origin); if (addspeed > 0) { float accelspeed = min(8 * pushdeltatime * str, addspeed); - other.velocity += accelspeed * normalize(targ.origin - this.origin); + toucher.velocity += accelspeed * normalize(targ.origin - this.origin); } #elif defined(CSQC) - float addspeed = str - other.move_velocity * normalize(targ.origin - this.origin); + float addspeed = str - toucher.move_velocity * normalize(targ.origin - this.origin); if (addspeed > 0) { float accelspeed = min(8 * pushdeltatime * str, addspeed); - other.move_velocity += accelspeed * normalize(targ.origin - this.origin); + toucher.move_velocity += accelspeed * normalize(targ.origin - this.origin); } #endif } else #ifdef SVQC - other.velocity = other.velocity + normalize(targ.origin - this.origin) * str * pushdeltatime; + toucher.velocity = toucher.velocity + normalize(targ.origin - this.origin) * str * pushdeltatime; #elif defined(CSQC) - other.move_velocity = other.move_velocity + normalize(targ.origin - this.origin) * str * pushdeltatime; + toucher.move_velocity = toucher.move_velocity + normalize(targ.origin - this.origin) * str * pushdeltatime; #endif #ifdef SVQC - UNSET_ONGROUND(other); + UNSET_ONGROUND(toucher); - UpdateCSQCProjectile(other); + UpdateCSQCProjectile(toucher); #elif defined(CSQC) - other.move_flags &= ~FL_ONGROUND; + toucher.move_flags &= ~FL_ONGROUND; #endif } // Directionless (accelerator/decelerator) mode -void trigger_impulse_touch2(entity this) +void trigger_impulse_touch2(entity this, entity toucher) { float pushdeltatime; if (this.active != ACTIVE_ACTIVE) return; - if (!isPushable(other)) + if (!isPushable(toucher)) return; - EXACTTRIGGER_TOUCH; + EXACTTRIGGER_TOUCH(this, toucher); - pushdeltatime = time - other.lastpushtime; + pushdeltatime = time - toucher.lastpushtime; if (pushdeltatime > 0.15) pushdeltatime = 0; - other.lastpushtime = time; + toucher.lastpushtime = time; if(!pushdeltatime) return; // div0: ticrate independent, 1 = identity (not 20) #ifdef SVQC - other.velocity = other.velocity * pow(this.strength, pushdeltatime); + toucher.velocity = toucher.velocity * pow(this.strength, pushdeltatime); - UpdateCSQCProjectile(other); + UpdateCSQCProjectile(toucher); #elif defined(CSQC) - other.move_velocity = other.move_velocity * pow(this.strength, pushdeltatime); + toucher.move_velocity = toucher.move_velocity * pow(this.strength, pushdeltatime); #endif } // Spherical (gravity/repulsor) mode -void trigger_impulse_touch3(entity this) +void trigger_impulse_touch3(entity this, entity toucher) { float pushdeltatime; float str; @@ -110,22 +110,22 @@ void trigger_impulse_touch3(entity this) if (this.active != ACTIVE_ACTIVE) return; - if (!isPushable(other)) + if (!isPushable(toucher)) return; - EXACTTRIGGER_TOUCH; + EXACTTRIGGER_TOUCH(this, toucher); - pushdeltatime = time - other.lastpushtime; + pushdeltatime = time - toucher.lastpushtime; if (pushdeltatime > 0.15) pushdeltatime = 0; - other.lastpushtime = time; + toucher.lastpushtime = time; if(!pushdeltatime) return; setsize(this, '-1 -1 -1' * this.radius,'1 1 1' * this.radius); #ifdef SVQC - str = min(this.radius, vlen(this.origin - other.origin)); + str = min(this.radius, vlen(this.origin - toucher.origin)); #elif defined(CSQC) - str = min(this.radius, vlen(this.origin - other.move_origin)); + str = min(this.radius, vlen(this.origin - toucher.move_origin)); #endif if(this.falloff == 1) @@ -136,11 +136,11 @@ void trigger_impulse_touch3(entity this) str = this.strength; #ifdef SVQC - other.velocity = other.velocity + normalize(other.origin - this.origin) * str * pushdeltatime; + toucher.velocity = toucher.velocity + normalize(toucher.origin - this.origin) * str * pushdeltatime; - UpdateCSQCProjectile(other); + UpdateCSQCProjectile(toucher); #elif defined(CSQC) - other.move_velocity = other.move_velocity + normalize(other.move_origin - this.origin) * str * pushdeltatime; + toucher.move_velocity = toucher.move_velocity + normalize(toucher.move_origin - this.origin) * str * pushdeltatime; #endif } diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc index 8100f6b79..88f785f39 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qc +++ b/qcsrc/common/triggers/trigger/jumppads.qc @@ -129,24 +129,24 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht) return sdir * vs + '0 0 1' * vz; } -void trigger_push_touch(entity this) +void trigger_push_touch(entity this, entity toucher) { if (this.active == ACTIVE_NOT) return; - if (!isPushable(other)) + if (!isPushable(toucher)) return; if(this.team) - if(((this.spawnflags & 4) == 0) == (DIFF_TEAM(this, other))) + if(((this.spawnflags & 4) == 0) == (DIFF_TEAM(this, toucher))) return; - EXACTTRIGGER_TOUCH; + EXACTTRIGGER_TOUCH(this, toucher); if(this.enemy) { - other.velocity = trigger_push_calculatevelocity(other.origin, this.enemy, this.height); - other.move_velocity = other.velocity; + toucher.velocity = trigger_push_calculatevelocity(toucher.origin, this.enemy, this.height); + toucher.move_velocity = toucher.velocity; } else if(this.target && this.target != "") { @@ -159,105 +159,105 @@ void trigger_push_touch(entity this) else RandomSelection_Add(e, 0, string_null, 1, 1); } - other.velocity = trigger_push_calculatevelocity(other.origin, RandomSelection_chosen_ent, this.height); - other.move_velocity = other.velocity; + toucher.velocity = trigger_push_calculatevelocity(toucher.origin, RandomSelection_chosen_ent, this.height); + toucher.move_velocity = toucher.velocity; } else { - other.velocity = this.movedir; - other.move_velocity = other.velocity; + toucher.velocity = this.movedir; + toucher.move_velocity = toucher.velocity; } #ifdef SVQC - UNSET_ONGROUND(other); + UNSET_ONGROUND(toucher); #elif defined(CSQC) - other.move_flags &= ~FL_ONGROUND; + toucher.move_flags &= ~FL_ONGROUND; - if (other.flags & FL_PROJECTILE) + if (toucher.flags & FL_PROJECTILE) { - other.move_angles = vectoangles (other.move_velocity); - switch(other.move_movetype) + toucher.move_angles = vectoangles (toucher.move_velocity); + switch(toucher.move_movetype) { case MOVETYPE_FLY: - other.move_movetype = MOVETYPE_TOSS; - other.gravity = 1; + toucher.move_movetype = MOVETYPE_TOSS; + toucher.gravity = 1; break; case MOVETYPE_BOUNCEMISSILE: - other.move_movetype = MOVETYPE_BOUNCE; - other.gravity = 1; + toucher.move_movetype = MOVETYPE_BOUNCE; + toucher.gravity = 1; break; } } #endif #ifdef SVQC - if (IS_PLAYER(other)) + if (IS_PLAYER(toucher)) { // reset tracking of oldvelocity for impact damage (sudden velocity changes) - other.oldvelocity = other.velocity; + toucher.oldvelocity = toucher.velocity; if(this.pushltime < time) // prevent "snorring" sound when a player hits the jumppad more than once { // flash when activated - Send_Effect(EFFECT_JUMPPAD, other.origin, other.velocity, 1); - _sound (other, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM); + Send_Effect(EFFECT_JUMPPAD, toucher.origin, toucher.velocity, 1); + _sound (toucher, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM); this.pushltime = time + 0.2; } - if(IS_REAL_CLIENT(other) || IS_BOT_CLIENT(other)) + if(IS_REAL_CLIENT(toucher) || IS_BOT_CLIENT(toucher)) { bool found = false; - for(int i = 0; i < other.jumppadcount && i < NUM_JUMPPADSUSED; ++i) - if(other.(jumppadsused[i]) == this) + for(int i = 0; i < toucher.jumppadcount && i < NUM_JUMPPADSUSED; ++i) + if(toucher.(jumppadsused[i]) == this) found = true; if(!found) { - other.(jumppadsused[other.jumppadcount % NUM_JUMPPADSUSED]) = this; - other.jumppadcount = other.jumppadcount + 1; + toucher.(jumppadsused[toucher.jumppadcount % NUM_JUMPPADSUSED]) = this; + toucher.jumppadcount = toucher.jumppadcount + 1; } - if(IS_REAL_CLIENT(other)) + if(IS_REAL_CLIENT(toucher)) { if(this.message) - centerprint(other, this.message); + centerprint(toucher, this.message); } else - other.lastteleporttime = time; + toucher.lastteleporttime = time; - if (!IS_DEAD(other)) - animdecide_setaction(other, ANIMACTION_JUMP, true); + if (!IS_DEAD(toucher)) + animdecide_setaction(toucher, ANIMACTION_JUMP, true); } else - other.jumppadcount = true; + toucher.jumppadcount = true; // reset tracking of who pushed you into a hazard (for kill credit) - other.pushltime = 0; - other.istypefrag = 0; + toucher.pushltime = 0; + toucher.istypefrag = 0; } if(this.enemy.target) - SUB_UseTargets(this.enemy, other, other); // TODO: do we need other as trigger too? + SUB_UseTargets(this.enemy, toucher, toucher); // TODO: do we need toucher as trigger too? - if (other.flags & FL_PROJECTILE) + if (toucher.flags & FL_PROJECTILE) { - other.angles = vectoangles (other.velocity); - switch(other.movetype) + toucher.angles = vectoangles (toucher.velocity); + switch(toucher.movetype) { case MOVETYPE_FLY: - other.movetype = MOVETYPE_TOSS; - other.gravity = 1; + toucher.movetype = MOVETYPE_TOSS; + toucher.gravity = 1; break; case MOVETYPE_BOUNCEMISSILE: - other.movetype = MOVETYPE_BOUNCE; - other.gravity = 1; + toucher.movetype = MOVETYPE_BOUNCE; + toucher.gravity = 1; break; } - UpdateCSQCProjectile(other); + UpdateCSQCProjectile(toucher); } - /*if (other.flags & FL_ITEM) + /*if (toucher.flags & FL_ITEM) { - ItemUpdate(other); - other.SendFlags |= ISF_DROP; + ItemUpdate(toucher); + toucher.SendFlags |= ISF_DROP; }*/ if (this.spawnflags & PUSH_ONCE) diff --git a/qcsrc/common/triggers/trigger/jumppads.qh b/qcsrc/common/triggers/trigger/jumppads.qh index 4e8bf1809..e03f14d33 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qh +++ b/qcsrc/common/triggers/trigger/jumppads.qh @@ -35,7 +35,7 @@ void trigger_push_use(entity this, entity actor, entity trigger); vector trigger_push_calculatevelocity(vector org, entity tgt, float ht); -void trigger_push_touch(entity this); +void trigger_push_touch(entity this, entity toucher); .vector dest; void trigger_push_findtarget(entity this); diff --git a/qcsrc/common/triggers/trigger/keylock.qc b/qcsrc/common/triggers/trigger/keylock.qc index 133397876..2cc81e597 100644 --- a/qcsrc/common/triggers/trigger/keylock.qc +++ b/qcsrc/common/triggers/trigger/keylock.qc @@ -18,18 +18,18 @@ void trigger_keylock_kill(string s) remove(t); } -void trigger_keylock_touch(entity this) +void trigger_keylock_touch(entity this, entity toucher) { bool key_used = false; bool started_delay = false; // only player may trigger the lock - if(!IS_PLAYER(other)) + if(!IS_PLAYER(toucher)) return; // check silver key if(this.itemkeys) - key_used = item_keys_usekey(this, other); + key_used = item_keys_usekey(this, toucher); if(this.itemkeys) { @@ -38,16 +38,16 @@ void trigger_keylock_touch(entity this) if(key_used) { // one or more keys were given, but others are still missing! - play2(other, this.noise1); - Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_ALSONEED, item_keys_keylist(this.itemkeys)); - other.key_door_messagetime = time + 2; + play2(toucher, this.noise1); + Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_DOOR_LOCKED_ALSONEED, item_keys_keylist(this.itemkeys)); + toucher.key_door_messagetime = time + 2; } - else if(other.key_door_messagetime <= time) + else if(toucher.key_door_messagetime <= time) { // no keys were given - play2(other, this.noise2); - Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_NEED, item_keys_keylist(this.itemkeys)); - other.key_door_messagetime = time + 2; + play2(toucher, this.noise2); + Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_DOOR_LOCKED_NEED, item_keys_keylist(this.itemkeys)); + toucher.key_door_messagetime = time + 2; } #endif @@ -55,7 +55,7 @@ void trigger_keylock_touch(entity this) if(this.delay <= time || started_delay == true) if(this.target2) { - trigger_keylock_trigger(this, other, this.target2); + trigger_keylock_trigger(this, toucher, this.target2); started_delay = true; this.delay = time + this.wait; } @@ -64,12 +64,12 @@ void trigger_keylock_touch(entity this) { #ifdef SVQC // all keys were given! - play2(other, this.noise); - centerprint(other, this.message); + play2(toucher, this.noise); + centerprint(toucher, this.message); #endif if(this.target) - trigger_keylock_trigger(this, other, this.target); + trigger_keylock_trigger(this, toucher, this.target); if(this.killtarget) trigger_keylock_kill(this.killtarget); diff --git a/qcsrc/common/triggers/trigger/multi.qc b/qcsrc/common/triggers/trigger/multi.qc index 14d7fda04..b801e9f4f 100644 --- a/qcsrc/common/triggers/trigger/multi.qc +++ b/qcsrc/common/triggers/trigger/multi.qc @@ -66,34 +66,34 @@ void multi_use(entity this, entity actor, entity trigger) multi_trigger(this); } -void multi_touch(entity this) +void multi_touch(entity this, entity toucher) { if(!(this.spawnflags & 2)) - if(!other.iscreature) + if(!toucher.iscreature) return; if(this.team) - if(((this.spawnflags & 4) == 0) == (this.team != other.team)) + if(((this.spawnflags & 4) == 0) == (this.team != toucher.team)) return; // if the trigger has an angles field, check player's facing direction if (this.movedir != '0 0 0') { - makevectors (other.angles); + makevectors (toucher.angles); if (v_forward * this.movedir < 0) return; // not facing the right way } // if the trigger has pressed keys, check that the player is pressing those keys if(this.pressedkeys) - if(IS_PLAYER(other)) // only for players - if(!(other.pressedkeys & this.pressedkeys)) + if(IS_PLAYER(toucher)) // only for players + if(!(toucher.pressedkeys & this.pressedkeys)) return; - EXACTTRIGGER_TOUCH; + EXACTTRIGGER_TOUCH(this, toucher); - this.enemy = other; - this.goalentity = other; + this.enemy = toucher; + this.goalentity = toucher; multi_trigger(this); } diff --git a/qcsrc/common/triggers/trigger/secret.qc b/qcsrc/common/triggers/trigger/secret.qc index bf4178bea..b54f99dcd 100644 --- a/qcsrc/common/triggers/trigger/secret.qc +++ b/qcsrc/common/triggers/trigger/secret.qc @@ -17,10 +17,10 @@ void secrets_setstatus(entity this) /** * A secret has been found (maybe :P) */ -void trigger_secret_touch(entity this) +void trigger_secret_touch(entity this, entity toucher) { // only a player can trigger this - if (!IS_PLAYER(other)) + if (!IS_PLAYER(toucher)) return; // update secrets found counter @@ -29,11 +29,11 @@ void trigger_secret_touch(entity this) //print(ftos(secret_counter.count), "\n"); // centerprint message (multi_touch() doesn't always call centerprint()) - centerprint(other, this.message); + centerprint(toucher, this.message); this.message = ""; // handle normal trigger features - multi_touch(this); + multi_touch(this, toucher); remove(this); } diff --git a/qcsrc/common/triggers/trigger/swamp.qc b/qcsrc/common/triggers/trigger/swamp.qc index fb792b94b..0f8d1a73e 100644 --- a/qcsrc/common/triggers/trigger/swamp.qc +++ b/qcsrc/common/triggers/trigger/swamp.qc @@ -22,7 +22,7 @@ #ifdef SVQC spawnfunc(trigger_swamp); #endif -void swamp_touch(entity this); +void swamp_touch(entity this, entity toucher); void swampslug_think(entity this); @@ -54,42 +54,42 @@ void swampslug_think(entity this) // Or we have exited it very recently. // Do the damage and renew the timer. #ifdef SVQC - Damage (this.owner, this, this, this.dmg, DEATH_SWAMP.m_id, other.origin, '0 0 0'); + Damage (this.owner, this, this, this.dmg, DEATH_SWAMP.m_id, this.owner.origin, '0 0 0'); #endif this.nextthink = time + this.swamp_interval; } -void swamp_touch(entity this) +void swamp_touch(entity this, entity toucher) { // 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) || IS_DEAD(other)) + if(!IS_PLAYER(toucher) || IS_DEAD(toucher)) return; - EXACTTRIGGER_TOUCH; + EXACTTRIGGER_TOUCH(this, toucher); // Chech if player alredy got a swampslug. - if(other.in_swamp != 1) + if(toucher.in_swamp != 1) { // If not attach one. - //centerprint(other,"Entering swamp!\n"); - other.swampslug = spawn(); - other.swampslug.health = 2; - setthink(other.swampslug, swampslug_think); - other.swampslug.nextthink = time; - other.swampslug.owner = other; - other.swampslug.dmg = this.dmg; - other.swampslug.swamp_interval = this.swamp_interval; - other.swamp_slowdown = this.swamp_slowdown; - other.in_swamp = 1; + //centerprint(toucher,"Entering swamp!\n"); + toucher.swampslug = spawn(); + toucher.swampslug.health = 2; + setthink(toucher.swampslug, swampslug_think); + toucher.swampslug.nextthink = time; + toucher.swampslug.owner = toucher; + toucher.swampslug.dmg = this.dmg; + toucher.swampslug.swamp_interval = this.swamp_interval; + toucher.swamp_slowdown = this.swamp_slowdown; + toucher.in_swamp = 1; return; } - //other.in_swamp = 1; + //toucher.in_swamp = 1; //Revitalize players swampslug - other.swampslug.health = 2; + toucher.swampslug.health = 2; } REGISTER_NET_LINKED(ENT_CLIENT_SWAMP) diff --git a/qcsrc/common/triggers/trigger/teleport.qc b/qcsrc/common/triggers/trigger/teleport.qc index 8ee6b7a69..484daeedf 100644 --- a/qcsrc/common/triggers/trigger/teleport.qc +++ b/qcsrc/common/triggers/trigger/teleport.qc @@ -11,49 +11,49 @@ void trigger_teleport_use(entity this, entity actor, entity trigger) } #endif -void Teleport_Touch (entity this) +void Teleport_Touch(entity this, entity toucher) { if (this.active != ACTIVE_ACTIVE) return; #ifdef SVQC - if (!other.teleportable) + if (!toucher.teleportable) return; - if(other.vehicle) - if(!other.vehicle.teleportable) + if(toucher.vehicle) + if(!toucher.vehicle.teleportable) return; - if(IS_TURRET(other)) + if(IS_TURRET(toucher)) return; #elif defined(CSQC) - if(!IS_PLAYER(other)) + if(!IS_PLAYER(toucher)) return; #endif - if(IS_DEAD(other)) + if(IS_DEAD(toucher)) return; if(this.team) - if(((this.spawnflags & 4) == 0) == (DIFF_TEAM(this, other))) + if(((this.spawnflags & 4) == 0) == (DIFF_TEAM(this, toucher))) return; - EXACTTRIGGER_TOUCH; + EXACTTRIGGER_TOUCH(this, toucher); #ifdef SVQC - if(IS_PLAYER(other)) - RemoveGrapplingHook(other); + if(IS_PLAYER(toucher)) + RemoveGrapplingHook(toucher); #endif entity e; - e = Simple_TeleportPlayer(this, other); + e = Simple_TeleportPlayer(this, toucher); #ifdef SVQC string s = this.target; this.target = string_null; - SUB_UseTargets(this, other, other); // TODO: should we be using other for trigger too? + SUB_UseTargets(this, toucher, toucher); // TODO: should we be using toucher for trigger too? if (!this.target) this.target = s; - SUB_UseTargets(e, other, other); + SUB_UseTargets(e, toucher, toucher); #endif } diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc index 57bb008fc..1f8450f39 100644 --- a/qcsrc/common/turrets/sv_turrets.qc +++ b/qcsrc/common/turrets/sv_turrets.qc @@ -443,9 +443,9 @@ void turret_projectile_explode(entity this) remove(this); } -void turret_projectile_touch(entity this) +void turret_projectile_touch(entity this, entity toucher) { - PROJECTILE_TOUCH(this); + PROJECTILE_TOUCH(this, toucher); turret_projectile_explode(this); } diff --git a/qcsrc/common/turrets/targettrigger.qc b/qcsrc/common/turrets/targettrigger.qc index 15dbaec4f..62ed2fb72 100644 --- a/qcsrc/common/turrets/targettrigger.qc +++ b/qcsrc/common/turrets/targettrigger.qc @@ -1,13 +1,13 @@ spawnfunc(turret_targettrigger); -void turret_targettrigger_touch(entity this); +void turret_targettrigger_touch(entity this, entity toucher); -void turret_targettrigger_touch(entity this) +void turret_targettrigger_touch(entity this, entity toucher) { if (this.cnt > time) return; FOREACH_ENTITY_STRING_ORDERED(targetname, this.target, { if (!(it.turret_flags & TUR_FLAG_RECIEVETARGETS)) continue; if (!it.turret_addtarget) continue; - it.turret_addtarget(it, other, this); + it.turret_addtarget(it, toucher, this); }); this.cnt = time + 0.5; } diff --git a/qcsrc/common/turrets/turret/walker.qc b/qcsrc/common/turrets/turret/walker.qc index 1a5c3f09a..029495276 100644 --- a/qcsrc/common/turrets/turret/walker.qc +++ b/qcsrc/common/turrets/turret/walker.qc @@ -103,6 +103,11 @@ void walker_rocket_explode(entity this) remove (this); } +void walker_rocket_touch(entity this, entity toucher) +{ + walker_rocket_explode(this); +} + void walker_rocket_damage(entity this, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce) { this.health = this.health - damage; @@ -253,7 +258,7 @@ void walker_fire_rocket(entity this, vector org) rocket.movetype = MOVETYPE_FLY; rocket.velocity = normalize((v_forward + v_up * 0.5) + (randomvec() * 0.2)) * (autocvar_g_turrets_unit_walker_rocket_speed); rocket.angles = vectoangles(rocket.velocity); - settouch(rocket, walker_rocket_explode); + settouch(rocket, walker_rocket_touch); rocket.flags = FL_PROJECTILE; rocket.solid = SOLID_BBOX; rocket.max_health = time + 9; diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index c7a46d482..c3a1ec6c9 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -179,28 +179,33 @@ void vehicles_projectile_damage(entity this, entity inflictor, entity attacker, } } -void vehicles_projectile_explode(entity this) +void vehicles_projectile_explode(entity this, entity toucher) { - if(this.owner && other != NULL) + if(this.owner && toucher != NULL) { - if(other == this.owner.vehicle) + if(toucher == this.owner.vehicle) return; - if(other == this.owner.vehicle.tur_head) + if(toucher == this.owner.vehicle.tur_head) return; } - PROJECTILE_TOUCH(this); + PROJECTILE_TOUCH(this, toucher); this.event_damage = func_null; - RadiusDamage (this, this.realowner, this.shot_dmg, 0, this.shot_radius, this, NULL, this.shot_force, this.totalfrags, other); + RadiusDamage (this, this.realowner, this.shot_dmg, 0, this.shot_radius, this, NULL, this.shot_force, this.totalfrags, toucher); remove (this); } +void vehicles_projectile_explode_think(entity this) +{ + vehicles_projectile_explode(this, NULL); +} + void vehicles_projectile_explode_use(entity this, entity actor, entity trigger) { - vehicles_projectile_explode(this); + vehicles_projectile_explode(this, trigger); } entity vehicles_projectile(entity this, string _mzlfx, Sound _mzlsound, @@ -264,6 +269,11 @@ void vehicles_gib_explode(entity this) remove(this); } +void vehicles_gib_touch(entity this, entity toucher) +{ + vehicles_gib_explode(this); +} + void vehicles_gib_think(entity this) { this.alpha -= 0.1; @@ -293,7 +303,7 @@ entity vehicle_tossgib(entity this, entity _template, vector _vel, string _tag, { setthink(_gib, vehicles_gib_explode); _gib.nextthink = time + random() * _explode; - settouch(_gib, vehicles_gib_explode); + settouch(_gib, vehicles_gib_touch); } else { @@ -817,21 +827,21 @@ void vehicles_exit(entity vehic, bool eject) vehicles_exit_running = false; } -void vehicles_touch(entity this) +void vehicles_touch(entity this, entity toucher) { - if(MUTATOR_CALLHOOK(VehicleTouch, this, other)) + if(MUTATOR_CALLHOOK(VehicleTouch, this, toucher)) return; // Vehicle currently in use if(this.owner) { if(!forbidWeaponUse(this.owner)) - if(other != NULL) - if((this.origin_z + this.maxs_z) > (other.origin_z)) - if(vehicles_crushable(other)) + if(toucher != NULL) + if((this.origin_z + this.maxs_z) > (toucher.origin_z)) + if(vehicles_crushable(toucher)) { if(vdist(this.velocity, >=, 30)) - Damage(other, this, this.owner, autocvar_g_vehicles_crush_dmg, DEATH_VH_CRUSH.m_id, '0 0 0', normalize(other.origin - this.origin) * autocvar_g_vehicles_crush_force); + Damage(toucher, this, this.owner, autocvar_g_vehicles_crush_dmg, DEATH_VH_CRUSH.m_id, '0 0 0', normalize(toucher.origin - this.origin) * autocvar_g_vehicles_crush_force); return; // Dont do selfdamage when hitting "soft targets". } @@ -847,7 +857,7 @@ void vehicles_touch(entity this) if(autocvar_g_vehicles_enter) return; - vehicles_enter(other, this); + vehicles_enter(toucher, this); } bool vehicle_impulse(entity this, int imp) diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qc b/qcsrc/common/vehicles/vehicle/bumblebee.qc index 2750621f2..9885269ac 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qc @@ -369,26 +369,26 @@ bool vehicles_valid_pilot(entity this, entity toucher) return true; } -void bumblebee_touch(entity this) +void bumblebee_touch(entity this, entity toucher) { if(autocvar_g_vehicles_enter) { return; } if(this.gunner1 != NULL && this.gunner2 != NULL) { - vehicles_touch(this); + vehicles_touch(this, toucher); return; } - if(vehicles_valid_pilot(this, other)) + if(vehicles_valid_pilot(this, toucher)) { float phase_time = (time >= this.gun1.phase) + (time >= this.gun2.phase); - if(time >= other.vehicle_enter_delay && phase_time) - if(bumblebee_gunner_enter(this, other)) + if(time >= toucher.vehicle_enter_delay && phase_time) + if(bumblebee_gunner_enter(this, toucher)) return; } - vehicles_touch(this); + vehicles_touch(this, toucher); } void bumblebee_regen(entity this) @@ -701,6 +701,11 @@ void bumblebee_blowup(entity this) remove(this); } +void bumblebee_dead_touch(entity this, entity toucher) +{ + bumblebee_blowup(this); +} + void bumblebee_diethink(entity this) { if(time >= this.wait) @@ -745,11 +750,8 @@ METHOD(Bumblebee, vr_think, void(Bumblebee thisveh, entity instance)) { entity e = instance.gunner1; instance.gun1.vehicle_exit(instance.gun1, VHEF_EJECT); - entity oldother = other; - other = e; instance.phase = 0; - gettouch(instance)(instance); - other = oldother; + gettouch(instance)(instance, e); return; } @@ -757,11 +759,8 @@ METHOD(Bumblebee, vr_think, void(Bumblebee thisveh, entity instance)) { entity e = instance.gunner2; instance.gun2.vehicle_exit(instance.gun2, VHEF_EJECT); - entity oldother = other; - other = e; instance.phase = 0; - gettouch(instance)(instance); - other = oldother; + gettouch(instance)(instance, e); return; } } @@ -790,7 +789,7 @@ METHOD(Bumblebee, vr_death, void(Bumblebee thisveh, entity instance)) entity _body = vehicle_tossgib(instance, instance, instance.velocity + randomvec() * 200, "", rint(random()), rint(random()), 6, randomvec() * 100); if(random() > 0.5) - settouch(_body, bumblebee_blowup); + settouch(_body, bumblebee_dead_touch); else settouch(_body, func_null); diff --git a/qcsrc/common/vehicles/vehicle/racer.qc b/qcsrc/common/vehicles/vehicle/racer.qc index 254f9bfc4..9e1a84771 100644 --- a/qcsrc/common/vehicles/vehicle/racer.qc +++ b/qcsrc/common/vehicles/vehicle/racer.qc @@ -511,7 +511,7 @@ void racer_blowup_think(entity this) CSQCMODEL_AUTOUPDATE(this); } -void racer_deadtouch(entity this) +void racer_deadtouch(entity this, entity toucher) { this.avelocity_x *= 0.7; this.cnt -= 1; diff --git a/qcsrc/common/vehicles/vehicle/raptor.qc b/qcsrc/common/vehicles/vehicle/raptor.qc index 59510c78f..ab9ccef63 100644 --- a/qcsrc/common/vehicles/vehicle/raptor.qc +++ b/qcsrc/common/vehicles/vehicle/raptor.qc @@ -508,7 +508,7 @@ bool raptor_takeoff(entity this) PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false; } -void raptor_blowup(entity this) +void raptor_blowup(entity this, entity toucher) { this.deadflag = DEAD_DEAD; this.vehicle_exit(this, VHEF_NORMAL); @@ -529,7 +529,10 @@ void raptor_blowup(entity this) void raptor_diethink(entity this) { if(time >= this.wait) - setthink(this, raptor_blowup); + { + raptor_blowup(this, NULL); + return; + } if(random() < 0.05) { diff --git a/qcsrc/common/vehicles/vehicle/raptor_weapons.qc b/qcsrc/common/vehicles/vehicle/raptor_weapons.qc index 56c3e8c61..a9b9a8658 100644 --- a/qcsrc/common/vehicles/vehicle/raptor_weapons.qc +++ b/qcsrc/common/vehicles/vehicle/raptor_weapons.qc @@ -53,7 +53,7 @@ METHOD(RaptorBomb, wr_think, void(entity thiswep, entity actor, .entity weaponen void raptor_flare_think(entity this); void raptor_flare_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force); -void raptor_flare_touch(entity this); +void raptor_flare_touch(entity this, entity toucher); METHOD(RaptorFlare, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { bool isPlayer = IS_PLAYER(actor); @@ -94,12 +94,12 @@ void raptor_bomblet_boom(entity this) remove(this); } -void raptor_bomblet_touch(entity this) +void raptor_bomblet_touch(entity this, entity toucher) { - if(other == this.owner) + if(toucher == this.owner) return; - PROJECTILE_TOUCH(this); + PROJECTILE_TOUCH(this, toucher); setthink(this, raptor_bomblet_boom); this.nextthink = time + random() * autocvar_g_vehicle_raptor_bomblet_explode_delay; } @@ -143,6 +143,11 @@ void raptor_bomb_burst(entity this) remove(this); } +void raptor_bomb_touch(entity this, entity toucher) +{ + raptor_bomb_burst(this); +} + void raptor_bombdrop(entity this) { entity bomb_1, bomb_2; @@ -157,8 +162,8 @@ void raptor_bombdrop(entity this) bomb_1.movetype = bomb_2.movetype = MOVETYPE_BOUNCE; bomb_1.velocity = bomb_2.velocity = this.velocity; - settouch(bomb_1, raptor_bomb_burst); - settouch(bomb_2, raptor_bomb_burst); + settouch(bomb_1, raptor_bomb_touch); + settouch(bomb_2, raptor_bomb_touch); setthink(bomb_1, raptor_bomb_burst); setthink(bomb_2, raptor_bomb_burst); bomb_1.cnt = bomb_2.cnt = time + 10; @@ -180,7 +185,7 @@ void raptor_bombdrop(entity this) CSQCProjectile(bomb_2, true, PROJECTILE_RAPTORBOMB, true); } -void raptor_flare_touch(entity this) +void raptor_flare_touch(entity this, entity toucher) { remove(this); } diff --git a/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc b/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc index dba8a72a8..8876f8959 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc +++ b/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc @@ -196,7 +196,7 @@ void spiderbot_rocket_do(entity this) float _dist = (random() * autocvar_g_vehicle_spiderbot_rocket_radius) + vlen(v - trace_endpos); _dist -= (random() * autocvar_g_vehicle_spiderbot_rocket_radius) ; rocket.nextthink = time + (_dist / autocvar_g_vehicle_spiderbot_rocket_speed); - setthink(rocket, vehicles_projectile_explode); + setthink(rocket, vehicles_projectile_explode_think); if(PHYS_INPUT_BUTTON_ATCK2(this.owner) && this.tur_head.frame == 1) this.wait = -10; diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index 9262698da..f7c5f9b66 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -259,10 +259,10 @@ void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float dam W_PrepareExplosionByDamage(this, attacker, getthink(this)); } -void W_Arc_Bolt_Touch(entity this) +void W_Arc_Bolt_Touch(entity this, entity toucher) { - PROJECTILE_TOUCH(this); - this.use(this, NULL, NULL); + PROJECTILE_TOUCH(this, toucher); + WITH(entity, other, toucher, this.use(this, NULL, NULL)); } void W_Arc_Attack_Bolt(Weapon thiswep, entity actor) diff --git a/qcsrc/common/weapons/weapon/blaster.qc b/qcsrc/common/weapons/weapon/blaster.qc index a4fb13c44..79a680e36 100644 --- a/qcsrc/common/weapons/weapon/blaster.qc +++ b/qcsrc/common/weapons/weapon/blaster.qc @@ -56,9 +56,9 @@ REGISTER_WEAPON(BLASTER, blaster, NEW(Blaster)); spawnfunc(weapon_blaster) { weapon_defaultspawnfunc(this, WEP_BLASTER); } spawnfunc(weapon_laser) { spawnfunc_weapon_blaster(this); } -void W_Blaster_Touch(entity this) +void W_Blaster_Touch(entity this, entity toucher) { - PROJECTILE_TOUCH(this); + PROJECTILE_TOUCH(this, toucher); this.event_damage = func_null; @@ -72,7 +72,7 @@ void W_Blaster_Touch(entity this) NULL, this.blaster_force, this.projectiledeathtype, - other + toucher ); remove(this); diff --git a/qcsrc/common/weapons/weapon/crylink.qc b/qcsrc/common/weapons/weapon/crylink.qc index eb3e72f8a..74c1cf1ab 100644 --- a/qcsrc/common/weapons/weapon/crylink.qc +++ b/qcsrc/common/weapons/weapon/crylink.qc @@ -293,17 +293,17 @@ float W_Crylink_Touch_WouldHitFriendly(entity projectile, float rad) } // NO bounce protection, as bounces are limited! -void W_Crylink_Touch(entity this) +void W_Crylink_Touch(entity this, entity toucher) { float finalhit; float f; float isprimary = !(this.projectiledeathtype & HITTYPE_SECONDARY); - PROJECTILE_TOUCH(this); + PROJECTILE_TOUCH(this, toucher); float a; a = bound(0, 1 - (time - this.fade_time) * this.fade_rate, 1); - finalhit = ((this.cnt <= 0) || (other.takedamage != DAMAGE_NO)); + finalhit = ((this.cnt <= 0) || (toucher.takedamage != DAMAGE_NO)); if(finalhit) f = 1; else @@ -311,13 +311,13 @@ void W_Crylink_Touch(entity this) if(a) f *= a; - float totaldamage = RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * f, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * f, WEP_CVAR_BOTH(crylink, isprimary, radius), NULL, NULL, WEP_CVAR_BOTH(crylink, isprimary, force) * f, this.projectiledeathtype, other); + float totaldamage = RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * f, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * f, WEP_CVAR_BOTH(crylink, isprimary, radius), NULL, NULL, WEP_CVAR_BOTH(crylink, isprimary, force) * f, this.projectiledeathtype, toucher); if(totaldamage && ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 2) || ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 1) && !W_Crylink_Touch_WouldHitFriendly(this, WEP_CVAR_BOTH(crylink, isprimary, radius))))) { if(this == this.realowner.crylink_lastgroup) this.realowner.crylink_lastgroup = NULL; - W_Crylink_LinkExplode(this.queuenext, this); + WITH(entity, other, toucher, W_Crylink_LinkExplode(this.queuenext, this)); this.classname = "spike_oktoremove"; remove(this); return; diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index f2ca42655..1ea678bb5 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -320,16 +320,16 @@ void W_Devastator_Think(entity this) UpdateCSQCProjectile(this); } -void W_Devastator_Touch(entity this) +void W_Devastator_Touch(entity this, entity toucher) { - if(WarpZone_Projectile_Touch(this)) + if(WarpZone_Projectile_Touch(this, toucher)) { if(wasfreed(this)) W_Devastator_Unregister(this); return; } W_Devastator_Unregister(this); - W_Devastator_Explode(this); + WITH(entity, other, toucher, W_Devastator_Explode(this)); } void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index 09cb77c8b..07114fc35 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -196,10 +196,10 @@ void W_Electro_Explode_use(entity this, entity actor, entity trigger) W_Electro_Explode(this); } -void W_Electro_TouchExplode(entity this) +void W_Electro_TouchExplode(entity this, entity toucher) { - PROJECTILE_TOUCH(this); - W_Electro_Explode(this); + PROJECTILE_TOUCH(this, toucher); + WITH(entity, other, toucher, W_Electro_Explode(this)); } void W_Electro_Bolt_Think(entity this) @@ -298,11 +298,11 @@ void W_Electro_Attack_Bolt(Weapon thiswep, entity actor) MUTATOR_CALLHOOK(EditProjectile, actor, proj); } -void W_Electro_Orb_Touch(entity this) +void W_Electro_Orb_Touch(entity this, entity toucher) { - PROJECTILE_TOUCH(this); - if(other.takedamage == DAMAGE_AIM) - { if(WEP_CVAR_SEC(electro, touchexplode)) { W_Electro_Explode(this); } } + PROJECTILE_TOUCH(this, toucher); + if(toucher.takedamage == DAMAGE_AIM) + { if(WEP_CVAR_SEC(electro, touchexplode)) { WITH(entity, other, toucher, W_Electro_Explode(this)); } } else { //UpdateCSQCProjectile(this); diff --git a/qcsrc/common/weapons/weapon/fireball.qc b/qcsrc/common/weapons/weapon/fireball.qc index d07324701..3026f30c0 100644 --- a/qcsrc/common/weapons/weapon/fireball.qc +++ b/qcsrc/common/weapons/weapon/fireball.qc @@ -117,10 +117,10 @@ void W_Fireball_Explode_use(entity this, entity actor, entity trigger) W_Fireball_Explode(this); } -void W_Fireball_TouchExplode(entity this) +void W_Fireball_TouchExplode(entity this, entity toucher) { - PROJECTILE_TOUCH(this); - W_Fireball_Explode(this); + PROJECTILE_TOUCH(this, toucher); + WITH(entity, other, toucher, W_Fireball_Explode(this)); } void W_Fireball_LaserPlay(entity this, float dt, float dist, float damage, float edgedamage, float burntime) @@ -290,11 +290,11 @@ void W_Fireball_Firemine_Think(entity this) this.nextthink = time + 0.1; } -void W_Fireball_Firemine_Touch(entity this) +void W_Fireball_Firemine_Touch(entity this, entity toucher) { - PROJECTILE_TOUCH(this); - if(other.takedamage == DAMAGE_AIM) - if(Fire_AddDamage(other, this.realowner, WEP_CVAR_SEC(fireball, damage), WEP_CVAR_SEC(fireball, damagetime), this.projectiledeathtype) >= 0) + PROJECTILE_TOUCH(this, toucher); + if(toucher.takedamage == DAMAGE_AIM) + if(Fire_AddDamage(toucher, this.realowner, WEP_CVAR_SEC(fireball, damage), WEP_CVAR_SEC(fireball, damagetime), this.projectiledeathtype) >= 0) { remove(this); return; diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index d41ad95b9..78fc6603e 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -113,18 +113,18 @@ void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage W_PrepareExplosionByDamage(this, attacker, getthink(this)); } -void W_Hagar_Touch(entity this) +void W_Hagar_Touch(entity this, entity toucher) { - PROJECTILE_TOUCH(this); - this.use(this, NULL, NULL); + PROJECTILE_TOUCH(this, toucher); + WITH(entity, other, toucher, this.use(this, NULL, NULL)); } -void W_Hagar_Touch2(entity this) +void W_Hagar_Touch2(entity this, entity toucher) { - PROJECTILE_TOUCH(this); + PROJECTILE_TOUCH(this, toucher); - if(this.cnt > 0 || other.takedamage == DAMAGE_AIM) { - this.use(this, NULL, NULL); + if(this.cnt > 0 || toucher.takedamage == DAMAGE_AIM) { + WITH(entity, other, toucher, this.use(this, NULL, NULL)); } else { this.cnt++; Send_Effect(EFFECT_HAGAR_BOUNCE, this.origin, this.velocity, 1); diff --git a/qcsrc/common/weapons/weapon/hlac.qc b/qcsrc/common/weapons/weapon/hlac.qc index c176e84c6..d46972fa1 100644 --- a/qcsrc/common/weapons/weapon/hlac.qc +++ b/qcsrc/common/weapons/weapon/hlac.qc @@ -54,17 +54,17 @@ REGISTER_WEAPON(HLAC, hlac, NEW(HLAC)); #ifdef SVQC spawnfunc(weapon_hlac) { weapon_defaultspawnfunc(this, WEP_HLAC); } -void W_HLAC_Touch(entity this) +void W_HLAC_Touch(entity this, entity toucher) { float isprimary; - PROJECTILE_TOUCH(this); + PROJECTILE_TOUCH(this, toucher); this.event_damage = func_null; isprimary = !(this.projectiledeathtype & HITTYPE_SECONDARY); - RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(hlac, isprimary, damage), WEP_CVAR_BOTH(hlac, isprimary, edgedamage), WEP_CVAR_BOTH(hlac, isprimary, radius), NULL, NULL, WEP_CVAR_BOTH(hlac, isprimary, force), this.projectiledeathtype, other); + RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(hlac, isprimary, damage), WEP_CVAR_BOTH(hlac, isprimary, edgedamage), WEP_CVAR_BOTH(hlac, isprimary, radius), NULL, NULL, WEP_CVAR_BOTH(hlac, isprimary, force), this.projectiledeathtype, toucher); remove(this); } diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index 5963b3bc7..553e7e280 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -137,9 +137,9 @@ void W_Hook_Damage(entity this, entity inflictor, entity attacker, float damage, W_PrepareExplosionByDamage(this, this.realowner, W_Hook_Explode2); } -void W_Hook_Touch2(entity this) +void W_Hook_Touch2(entity this, entity toucher) { - PROJECTILE_TOUCH(this); + PROJECTILE_TOUCH(this, toucher); this.use(this, NULL, NULL); } diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index a406e7509..37cb9944b 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -268,26 +268,26 @@ void W_MineLayer_Think(entity this) W_MineLayer_RemoteExplode(this); } -void W_MineLayer_Touch(entity this) +void W_MineLayer_Touch(entity this, entity toucher) { if(this.movetype == MOVETYPE_NONE || this.movetype == MOVETYPE_FOLLOW) return; // we're already a stuck mine, why do we get called? TODO does this even happen? - if(WarpZone_Projectile_Touch(this)) + if(WarpZone_Projectile_Touch(this, toucher)) { if(wasfreed(this)) this.realowner.minelayer_mines -= 1; return; } - if(other && IS_PLAYER(other) && !IS_DEAD(other)) + if(toucher && IS_PLAYER(toucher) && !IS_DEAD(toucher)) { // hit a player // don't stick } else { - W_MineLayer_Stick(this, other); + W_MineLayer_Stick(this, toucher); } } diff --git a/qcsrc/common/weapons/weapon/mortar.qc b/qcsrc/common/weapons/weapon/mortar.qc index 5f56f19db..06686eca0 100644 --- a/qcsrc/common/weapons/weapon/mortar.qc +++ b/qcsrc/common/weapons/weapon/mortar.qc @@ -142,12 +142,12 @@ void W_Mortar_Grenade_Think1(entity this) W_Mortar_Grenade_Explode(this); } -void W_Mortar_Grenade_Touch1(entity this) +void W_Mortar_Grenade_Touch1(entity this, entity toucher) { - PROJECTILE_TOUCH(this); - if(other.takedamage == DAMAGE_AIM || WEP_CVAR_PRI(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile + 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 { - this.use(this, NULL, NULL); + WITH(entity, other, toucher, this.use(this, NULL, NULL)); } else if(WEP_CVAR_PRI(mortar, type) == 1) // bounce { @@ -156,7 +156,7 @@ void W_Mortar_Grenade_Touch1(entity this) this.projectiledeathtype |= HITTYPE_BOUNCE; this.gl_bouncecnt += 1; } - else if(WEP_CVAR_PRI(mortar, type) == 2 && (!other || (other.takedamage != DAMAGE_AIM && other.movetype == MOVETYPE_NONE))) // stick + else if(WEP_CVAR_PRI(mortar, type) == 2 && (!toucher || (toucher.takedamage != DAMAGE_AIM && toucher.movetype == MOVETYPE_NONE))) // stick { spamsound(this, CH_SHOTS, SND(GRENADE_STICK), VOL_BASE, ATTN_NORM); @@ -174,12 +174,12 @@ void W_Mortar_Grenade_Touch1(entity this) } } -void W_Mortar_Grenade_Touch2(entity this) +void W_Mortar_Grenade_Touch2(entity this, entity toucher) { - PROJECTILE_TOUCH(this); - if(other.takedamage == DAMAGE_AIM || WEP_CVAR_SEC(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile + 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 { - this.use(this, NULL, NULL); + WITH(entity, other, toucher, this.use(this, NULL, NULL)); } else if(WEP_CVAR_SEC(mortar, type) == 1) // bounce { @@ -192,7 +192,7 @@ void W_Mortar_Grenade_Touch2(entity this) this.nextthink = time + WEP_CVAR_SEC(mortar, lifetime_bounce); } - else if(WEP_CVAR_SEC(mortar, type) == 2 && (!other || (other.takedamage != DAMAGE_AIM && other.movetype == MOVETYPE_NONE))) // stick + else if(WEP_CVAR_SEC(mortar, type) == 2 && (!toucher || (toucher.takedamage != DAMAGE_AIM && toucher.movetype == MOVETYPE_NONE))) // stick { spamsound(this, CH_SHOTS, SND(GRENADE_STICK), VOL_BASE, ATTN_NORM); diff --git a/qcsrc/common/weapons/weapon/porto.qc b/qcsrc/common/weapons/weapon/porto.qc index 3b047dc8c..dbcad2c1e 100644 --- a/qcsrc/common/weapons/weapon/porto.qc +++ b/qcsrc/common/weapons/weapon/porto.qc @@ -118,14 +118,14 @@ void W_Porto_Think(entity this) W_Porto_Fail(this, 0); } -void W_Porto_Touch(entity this) +void W_Porto_Touch(entity this, entity toucher) { vector norm; // do not use PROJECTILE_TOUCH here // FIXME but DO handle warpzones! - if(other.classname == "portal") + if(toucher.classname == "portal") return; // handled by the portal norm = trace_plane_normal; diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index a39c3958f..475c23fab 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -102,11 +102,12 @@ void W_Seeker_Missile_Explode(entity this) remove(this); } -void W_Seeker_Missile_Touch(entity this) +void W_Seeker_Missile_Touch(entity this, entity toucher) { - PROJECTILE_TOUCH(this); + PROJECTILE_TOUCH(this, toucher); - W_Seeker_Missile_Explode(this); + // TODO + WITH(entity, other, toucher, W_Seeker_Missile_Explode(this)); } void W_Seeker_Missile_Think(entity this) @@ -313,9 +314,14 @@ void W_Seeker_Flac_Explode(entity this) remove(this); } +void W_Seeker_Flac_Touch(entity this, entity toucher) +{ + WITH(entity, other, toucher, W_Seeker_Flac_Explode(this)); +} + void W_Seeker_Flac_Explode_use(entity this, entity actor, entity trigger) { - W_Seeker_Flac_Explode(this); + WITH(entity, other, trigger, W_Seeker_Flac_Explode(this)); } void W_Seeker_Fire_Flac(Weapon thiswep, entity actor) @@ -352,7 +358,7 @@ void W_Seeker_Fire_Flac(Weapon thiswep, entity actor) missile.owner = missile.realowner = actor; missile.bot_dodge = true; missile.bot_dodgerating = WEP_CVAR(seeker, flac_damage); - settouch(missile, W_Seeker_Flac_Explode); + settouch(missile, W_Seeker_Flac_Touch); missile.use = W_Seeker_Flac_Explode_use; setthink(missile, adaptor_think2use_hittype_splash); missile.nextthink = time + WEP_CVAR(seeker, flac_lifetime) + WEP_CVAR(seeker, flac_lifetime_rand); @@ -492,13 +498,13 @@ void W_Seeker_Tag_Damage(entity this, entity inflictor, entity attacker, float d W_Seeker_Tag_Explode(this); } -void W_Seeker_Tag_Touch(entity this) +void W_Seeker_Tag_Touch(entity this, entity toucher) { vector dir; vector org2; entity e; - PROJECTILE_TOUCH(this); + PROJECTILE_TOUCH(this, toucher); dir = normalize(this.realowner.origin - this.origin); org2 = findbetterlocation(this.origin, 8); @@ -506,23 +512,23 @@ void W_Seeker_Tag_Touch(entity this) te_knightspike(org2); this.event_damage = func_null; - Damage_DamageInfo(this.origin, 0, 0, 0, this.velocity, WEP_SEEKER.m_id | HITTYPE_BOUNCE | HITTYPE_SECONDARY, other.species, this); + Damage_DamageInfo(this.origin, 0, 0, 0, this.velocity, WEP_SEEKER.m_id | HITTYPE_BOUNCE | HITTYPE_SECONDARY, toucher.species, this); - if(other.takedamage == DAMAGE_AIM && !IS_DEAD(other)) + if(toucher.takedamage == DAMAGE_AIM && !IS_DEAD(toucher)) { // check to see if this person is already tagged by me - entity tag = W_Seeker_Tagged_Info(this.realowner, other); + entity tag = W_Seeker_Tagged_Info(this.realowner, toucher); if(tag != NULL) { - if(other.wps_tag_tracker && (WEP_CVAR(seeker, type) == 1)) // don't attach another waypointsprite without killing the old one first - WaypointSprite_Kill(other.wps_tag_tracker); + if(toucher.wps_tag_tracker && (WEP_CVAR(seeker, type) == 1)) // don't attach another waypointsprite without killing the old one first + WaypointSprite_Kill(toucher.wps_tag_tracker); tag.tag_time = time; } else { - //sprint(this.realowner, strcat("You just tagged ^2", other.netname, "^7 with a tracking device!\n")); + //sprint(this.realowner, strcat("You just tagged ^2", toucher.netname, "^7 with a tracking device!\n")); e = new(tag_tracker); e.cnt = WEP_CVAR(seeker, missile_count); e.owner = this.owner; @@ -530,13 +536,13 @@ void W_Seeker_Tag_Touch(entity this) if(WEP_CVAR(seeker, type) == 1) { - e.tag_target = other; + e.tag_target = toucher; e.tag_time = time; setthink(e, W_Seeker_Tracker_Think); } else { - e.enemy = other; + e.enemy = toucher; setthink(e, W_Seeker_Vollycontroller_Think); } @@ -545,8 +551,8 @@ void W_Seeker_Tag_Touch(entity this) if(WEP_CVAR(seeker, type) == 1) { - WaypointSprite_Spawn(WP_Seeker, WEP_CVAR(seeker, tag_tracker_lifetime), 0, other, '0 0 64', this.realowner, 0, other, wps_tag_tracker, true, RADARICON_TAGGED); - WaypointSprite_UpdateRule(other.wps_tag_tracker, 0, SPRITERULE_DEFAULT); + WaypointSprite_Spawn(WP_Seeker, WEP_CVAR(seeker, tag_tracker_lifetime), 0, toucher, '0 0 64', this.realowner, 0, toucher, wps_tag_tracker, true, RADARICON_TAGGED); + WaypointSprite_UpdateRule(toucher.wps_tag_tracker, 0, SPRITERULE_DEFAULT); } } diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index 8b061b72a..8a2fbdac3 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -233,11 +233,11 @@ void W_RocketMinsta_Laser_Explode_use(entity this, entity actor, entity trigger) W_RocketMinsta_Laser_Explode(this); } -void W_RocketMinsta_Laser_Touch (entity this) +void W_RocketMinsta_Laser_Touch(entity this, entity toucher) { - PROJECTILE_TOUCH(this); + PROJECTILE_TOUCH(this, toucher); //W_RocketMinsta_Laser_Explode (); - RadiusDamage (this, this.realowner, this.rm_damage, this.rm_edmg, autocvar_g_rm_laser_radius, NULL, NULL, this.rm_force, this.projectiledeathtype, other); + RadiusDamage(this, this.realowner, this.rm_damage, this.rm_edmg, autocvar_g_rm_laser_radius, NULL, NULL, this.rm_force, this.projectiledeathtype, toucher); remove(this); } diff --git a/qcsrc/lib/self.qh b/qcsrc/lib/self.qh index ec43a3402..48357fa40 100644 --- a/qcsrc/lib/self.qh +++ b/qcsrc/lib/self.qh @@ -66,9 +66,11 @@ SELFWRAP(think, void, (), (entity this), (this)) #define setthink(e, f) SELFWRAP_SET(think, e, f) #define getthink(e) SELFWRAP_GET(think, e) -SELFWRAP(touch, void, (), (entity this), (this)) +#ifndef MENUQC +SELFWRAP(touch, void, (), (entity this, entity toucher), (this, other)) #define settouch(e, f) SELFWRAP_SET(touch, e, f) #define gettouch(e) SELFWRAP_GET(touch, e) +#endif SELFWRAP(blocked, void, (), (entity this), (this)) #define setblocked(e, f) SELFWRAP_SET(blocked, e, f) diff --git a/qcsrc/lib/warpzone/client.qc b/qcsrc/lib/warpzone/client.qc index 5a1e320e9..fd0925db9 100644 --- a/qcsrc/lib/warpzone/client.qc +++ b/qcsrc/lib/warpzone/client.qc @@ -25,7 +25,7 @@ void WarpZone_Fade_PreDraw(entity this) this.drawmask = MASK_NORMAL; } -void WarpZone_Touch (entity this); +void WarpZone_Touch(entity this, entity toucher); NET_HANDLE(ENT_CLIENT_WARPZONE, bool isnew) { warpzone_warpzones_exist = 1; diff --git a/qcsrc/lib/warpzone/common.qh b/qcsrc/lib/warpzone/common.qh index 2cfa7ef9b..6669ae1af 100644 --- a/qcsrc/lib/warpzone/common.qh +++ b/qcsrc/lib/warpzone/common.qh @@ -111,6 +111,6 @@ float WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher); void WarpZoneLib_ExactTrigger_Init(entity this); // WARNING: this kills the trace globals -#define EXACTTRIGGER_TOUCH if(WarpZoneLib_ExactTrigger_Touch(this, other)) return +#define EXACTTRIGGER_TOUCH(e,t) if(WarpZoneLib_ExactTrigger_Touch((e), (t))) return #define EXACTTRIGGER_INIT WarpZoneLib_ExactTrigger_Init(this) #endif diff --git a/qcsrc/lib/warpzone/server.qc b/qcsrc/lib/warpzone/server.qc index 7ddb96cbb..6dd0ea3c7 100644 --- a/qcsrc/lib/warpzone/server.qc +++ b/qcsrc/lib/warpzone/server.qc @@ -189,29 +189,29 @@ float WarpZone_Teleport(entity wz, entity player, float f0, float f1) return 1; } -void WarpZone_Touch (entity this) +void WarpZone_Touch(entity this, entity toucher) { - if(other.classname == "trigger_warpzone") + if(toucher.classname == "trigger_warpzone") return; - if(time <= other.warpzone_teleport_finishtime) // already teleported this frame + if(time <= toucher.warpzone_teleport_finishtime) // already teleported this frame return; // FIXME needs a better check to know what is safe to teleport and what not #ifdef SVQC - if(other.movetype == MOVETYPE_NONE || other.movetype == MOVETYPE_FOLLOW || other.tag_entity) + if(toucher.movetype == MOVETYPE_NONE || toucher.movetype == MOVETYPE_FOLLOW || toucher.tag_entity) #elif defined(CSQC) - if(other.move_movetype == MOVETYPE_NONE || other.move_movetype == MOVETYPE_FOLLOW || other.tag_networkentity) + if(toucher.move_movetype == MOVETYPE_NONE || toucher.move_movetype == MOVETYPE_FOLLOW || toucher.tag_networkentity) #endif return; - if(WarpZoneLib_ExactTrigger_Touch(this, other)) + if(WarpZoneLib_ExactTrigger_Touch(this, toucher)) return; #ifdef SVQC - if(WarpZone_PlaneDist(this, other.origin + other.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet) + if(WarpZone_PlaneDist(this, toucher.origin + toucher.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet) #elif defined(CSQC) - if(WarpZone_PlaneDist(this, other.move_origin + other.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet) + if(WarpZone_PlaneDist(this, toucher.move_origin + toucher.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet) #endif return; @@ -227,29 +227,29 @@ void WarpZone_Touch (entity this) // 24/(0.25/frametime) // 96*frametime float d; - d = 24 + max(vlen(other.mins), vlen(other.maxs)); - if(IS_NOT_A_CLIENT(other)) + d = 24 + max(vlen(toucher.mins), vlen(toucher.maxs)); + if(IS_NOT_A_CLIENT(toucher)) #ifdef SVQC - f = -d / bound(frametime * d * 1, frametime * vlen(other.velocity), d); + f = -d / bound(frametime * d * 1, frametime * vlen(toucher.velocity), d); #elif defined(CSQC) - f = -d / bound(frametime * d * 1, frametime * vlen(other.move_velocity), d); + f = -d / bound(frametime * d * 1, frametime * vlen(toucher.move_velocity), d); #endif else f = -1; - if(WarpZone_Teleport(this, other, f, 0)) + if(WarpZone_Teleport(this, toucher, f, 0)) { #ifdef SVQC string save1, save2; save1 = this.target; this.target = string_null; save2 = this.target3; this.target3 = string_null; - SUB_UseTargets(this, other, other); // use other too? + SUB_UseTargets(this, toucher, toucher); // use toucher too? if (!this.target) this.target = save1; if (!this.target3) this.target3 = save2; save1 = this.target; this.target = string_null; save2 = this.target2; this.target2 = string_null; - SUB_UseTargets(this.enemy, other, other); // use other too? + SUB_UseTargets(this.enemy, toucher, toucher); // use toucher too? if (!this.target) this.target = save1; if (!this.target2) this.target2 = save2; #endif @@ -434,9 +434,9 @@ float WarpZone_CheckProjectileImpact(entity player) #endif #endif -float WarpZone_Projectile_Touch(entity this) +float WarpZone_Projectile_Touch(entity this, entity toucher) { - if(other.classname == "trigger_warpzone") + if(toucher.classname == "trigger_warpzone") return true; // no further impacts if we teleported this frame! @@ -496,7 +496,7 @@ float WarpZone_Projectile_Touch(entity this) } #endif - if(WarpZone_Projectile_Touch_ImpactFilter_Callback(this, other)) + if(WarpZone_Projectile_Touch_ImpactFilter_Callback(this, toucher)) return true; #endif @@ -847,8 +847,6 @@ void WarpZone_StartFrame() WarpZone_PostInitialize_Callback(); } - entity oldother = other; - FOREACH_ENTITY(!is_pure(it), { if(warpzone_warpzones_exist) @@ -857,28 +855,25 @@ void WarpZone_StartFrame() if(IS_OBSERVER(it) || it.solid == SOLID_NOT) if(IS_CLIENT(it)) // we don't care about it being a bot { - other = it; // player - // warpzones if (warpzone_warpzones_exist) { entity e = WarpZone_Find(it.origin + it.mins, it.origin + it.maxs); if (e) - if (!WarpZoneLib_ExactTrigger_Touch(e, other)) + if (!WarpZoneLib_ExactTrigger_Touch(e, it)) if (WarpZone_PlaneDist(e, it.origin + it.view_ofs) <= 0) WarpZone_Teleport(e, it, -1, 0); // NOT triggering targets by this! } // teleporters - if(other.teleportable) + if(it.teleportable) { entity ent = Teleport_Find(it.origin + it.mins, it.origin + it.maxs); if (ent) - if (!WarpZoneLib_ExactTrigger_Touch(ent, other)) - Simple_TeleportPlayer(ent, other); // NOT triggering targets by this! + if (!WarpZoneLib_ExactTrigger_Touch(ent, it)) + Simple_TeleportPlayer(ent, it); // NOT triggering targets by this! } } }); - other = oldother; } .float warpzone_reconnecting; diff --git a/qcsrc/lib/warpzone/server.qh b/qcsrc/lib/warpzone/server.qh index 9abea2a68..0ec67e4d3 100644 --- a/qcsrc/lib/warpzone/server.qh +++ b/qcsrc/lib/warpzone/server.qh @@ -3,7 +3,7 @@ #ifdef SVQC void WarpZone_StartFrame(); -float WarpZone_Projectile_Touch(entity this); +float WarpZone_Projectile_Touch(entity this, entity toucher); // THESE must be defined by calling QC code: void WarpZone_PostTeleportPlayer_Callback(entity pl); diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc index b22a81e04..fd3cd08ec 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -301,18 +301,18 @@ void GrapplingHookThink(entity this) } } -void GrapplingHookTouch (entity this) +void GrapplingHookTouch(entity this, entity toucher) { - if(other.movetype == MOVETYPE_FOLLOW) + if(toucher.movetype == MOVETYPE_FOLLOW) return; - PROJECTILE_TOUCH(this); + PROJECTILE_TOUCH(this, toucher); GrapplingHook_Stop(this); - if(other) - if(other.movetype != MOVETYPE_NONE) + if(toucher) + if(toucher.movetype != MOVETYPE_NONE) { - SetMovetypeFollow(this, other); + SetMovetypeFollow(this, toucher); WarpZone_RefSys_BeginAddingIncrementally(this, this.aiment); } diff --git a/qcsrc/server/item_key.qc b/qcsrc/server/item_key.qc index 317b897b0..cf2b25acf 100644 --- a/qcsrc/server/item_key.qc +++ b/qcsrc/server/item_key.qc @@ -68,23 +68,23 @@ item_key /** * Key touch handler. */ -void item_key_touch(entity this) +void item_key_touch(entity this, entity toucher) { - if (!IS_PLAYER(other)) + if (!IS_PLAYER(toucher)) return; // player already picked up this key - if (other.itemkeys & this.itemkeys) + if (toucher.itemkeys & this.itemkeys) return; - other.itemkeys |= this.itemkeys; - play2(other, this.noise); + toucher.itemkeys |= this.itemkeys; + play2(toucher, this.noise); - centerprint(other, this.message); + centerprint(toucher, this.message); string oldmsg = this.message; this.message = ""; - SUB_UseTargets(this, other, other); // TODO: should we be using other for the trigger here? + SUB_UseTargets(this, toucher, toucher); // TODO: should we be using toucher for the trigger here? this.message = oldmsg; }; diff --git a/qcsrc/server/miscfunctions.qh b/qcsrc/server/miscfunctions.qh index a8304b0e3..7cd8c7012 100644 --- a/qcsrc/server/miscfunctions.qh +++ b/qcsrc/server/miscfunctions.qh @@ -121,7 +121,7 @@ void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomo #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)) -#define PROJECTILE_TOUCH(this) MACRO_BEGIN if (WarpZone_Projectile_Touch(this)) return; MACRO_END +#define PROJECTILE_TOUCH(e,t) MACRO_BEGIN if (WarpZone_Projectile_Touch(e,t)) return; MACRO_END #define CENTER_OR_VIEWOFS(ent) (ent.origin + (IS_PLAYER(ent) ? ent.view_ofs : ((ent.mins + ent.maxs) * 0.5))) diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qc b/qcsrc/server/mutators/mutator/gamemode_ctf.qc index a184e68df..e89ea8c83 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qc @@ -286,16 +286,16 @@ bool ctf_CaptureShield_Customize(entity this) return true; } -void ctf_CaptureShield_Touch(entity this) +void ctf_CaptureShield_Touch(entity this, entity toucher) { - if(!other.ctf_captureshielded) { return; } - if(CTF_SAMETEAM(this, other)) { return; } + if(!toucher.ctf_captureshielded) { return; } + if(CTF_SAMETEAM(this, toucher)) { return; } vector mymid = (this.absmin + this.absmax) * 0.5; - vector othermid = (other.absmin + other.absmax) * 0.5; + vector theirmid = (toucher.absmin + toucher.absmax) * 0.5; - Damage(other, this, this, 0, DEATH_HURTTRIGGER.m_id, mymid, normalize(othermid - mymid) * ctf_captureshield_force); - if(IS_REAL_CLIENT(other)) { Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_CTF_CAPTURESHIELD_SHIELDED); } + Damage(toucher, this, this, 0, DEATH_HURTTRIGGER.m_id, mymid, normalize(theirmid - mymid) * ctf_captureshield_force); + if(IS_REAL_CLIENT(toucher)) { Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_CTF_CAPTURESHIELD_SHIELDED); } } void ctf_CaptureShield_Spawn(entity flag) diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qh b/qcsrc/server/mutators/mutator/gamemode_ctf.qh index 95e0bcd42..45de46971 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qh +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qh @@ -20,7 +20,7 @@ CLASS(Flag, Pickup) ATTRIB(Flag, m_maxs, vector, PL_MAX_CONST + '0 0 -13') ENDCLASS(Flag) Flag CTF_FLAG; STATIC_INIT(Flag) { CTF_FLAG = NEW(Flag); } -void ctf_FlagTouch(entity this) { ITEM_HANDLE(Pickup, CTF_FLAG, this, other); } +void ctf_FlagTouch(entity this, entity toucher) { ITEM_HANDLE(Pickup, CTF_FLAG, this, toucher); } // flag constants // for most of these, there is just one question to be asked: WHYYYYY? diff --git a/qcsrc/server/mutators/mutator/gamemode_domination.qc b/qcsrc/server/mutators/mutator/gamemode_domination.qc index 6bbbaee99..7acddd32d 100644 --- a/qcsrc/server/mutators/mutator/gamemode_domination.qc +++ b/qcsrc/server/mutators/mutator/gamemode_domination.qc @@ -249,11 +249,11 @@ void dompointthink(entity this) } } -void dompointtouch(entity this) +void dompointtouch(entity this, entity toucher) { - if (!IS_PLAYER(other)) + if (!IS_PLAYER(toucher)) return; - if (other.health < 1) + if (toucher.health < 1) return; if(round_handler_IsActive() && !round_handler_IsRoundStarted()) @@ -264,7 +264,7 @@ void dompointtouch(entity this) // only valid teams can claim it entity head = find(NULL, classname, "dom_team"); - while (head && head.team != other.team) + while (head && head.team != toucher.team) head = find(head, classname, "dom_team"); if (!head || head.netname == "" || head == this.goalentity) return; @@ -273,9 +273,9 @@ void dompointtouch(entity this) this.team = this.goalentity.team; // this stores the PREVIOUS team! - this.cnt = other.team; + this.cnt = toucher.team; this.owner = head; // team to switch to after the delay - this.dmg_inflictor = other; + this.dmg_inflictor = toucher; // this.state = 1; // this.delay = time + cvar("g_domination_point_capturetime"); @@ -298,8 +298,8 @@ void dompointtouch(entity this) this.modelindex = head.dmg; this.skin = head.skin; - this.enemy = other; // individual player scoring - this.enemy_playerid = other.playerid; + this.enemy = toucher; // individual player scoring + this.enemy_playerid = toucher.playerid; dompoint_captured(this); } diff --git a/qcsrc/server/mutators/mutator/gamemode_keepaway.qc b/qcsrc/server/mutators/mutator/gamemode_keepaway.qc index 454e2f168..de181307e 100644 --- a/qcsrc/server/mutators/mutator/gamemode_keepaway.qc +++ b/qcsrc/server/mutators/mutator/gamemode_keepaway.qc @@ -81,7 +81,7 @@ void ka_EventLog(string mode, entity actor) // use an alias for easy changing an GameLogEcho(strcat(":ka:", mode, ((actor != NULL) ? (strcat(":", ftos(actor.playerid))) : ""))); } -void ka_TouchEvent(entity this); +void ka_TouchEvent(entity this, entity toucher); void ka_RespawnBall(entity this); void ka_RespawnBall(entity this) // runs whenever the ball needs to be relocated { @@ -125,7 +125,7 @@ void ka_TimeScoring(entity this) } } -void ka_TouchEvent(entity this) // runs any time that the ball comes in contact with something +void ka_TouchEvent(entity this, entity toucher) // runs any time that the ball comes in contact with something { if(gameover) { return; } if(!this) { return; } @@ -134,9 +134,9 @@ void ka_TouchEvent(entity this) // runs any time that the ball comes in contact ka_RespawnBall(this); return; } - if(IS_DEAD(other)) { return; } - if(STAT(FROZEN, other)) { return; } - if (!IS_PLAYER(other)) + if(IS_DEAD(toucher)) { return; } + if(STAT(FROZEN, toucher)) { return; } + if (!IS_PLAYER(toucher)) { // The ball just touched an object, most likely the world Send_Effect(EFFECT_BALL_SPARKS, this.origin, '0 0 0', 1); sound(this, CH_TRIGGER, SND_KA_TOUCH, VOL_BASE, ATTEN_NORM); @@ -145,9 +145,9 @@ void ka_TouchEvent(entity this) // runs any time that the ball comes in contact else if(this.wait > time) { return; } // attach the ball to the player - this.owner = other; - other.ballcarried = this; - setattachment(this, other, ""); + this.owner = toucher; + toucher.ballcarried = this; + setattachment(this, toucher, ""); setorigin(this, '0 0 0'); // make the ball invisible/unable to do anything/set up time scoring @@ -160,25 +160,25 @@ void ka_TouchEvent(entity this) // runs any time that the ball comes in contact this.takedamage = DAMAGE_NO; // apply effects to player - other.glow_color = autocvar_g_keepawayball_trail_color; - other.glow_trail = true; - other.effects |= autocvar_g_keepaway_ballcarrier_effects; + toucher.glow_color = autocvar_g_keepawayball_trail_color; + toucher.glow_trail = true; + toucher.effects |= autocvar_g_keepaway_ballcarrier_effects; // messages and sounds - ka_EventLog("pickup", other); - Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_KEEPAWAY_PICKUP, other.netname); - Send_Notification(NOTIF_ALL_EXCEPT, other, MSG_CENTER, CENTER_KEEPAWAY_PICKUP, other.netname); - Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_KEEPAWAY_PICKUP_SELF); + ka_EventLog("pickup", toucher); + Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_KEEPAWAY_PICKUP, toucher.netname); + Send_Notification(NOTIF_ALL_EXCEPT, toucher, MSG_CENTER, CENTER_KEEPAWAY_PICKUP, toucher.netname); + Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_KEEPAWAY_PICKUP_SELF); sound(this.owner, CH_TRIGGER, SND_KA_PICKEDUP, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere) // scoring - PlayerScore_Add(other, SP_KEEPAWAY_PICKUPS, 1); + PlayerScore_Add(toucher, SP_KEEPAWAY_PICKUPS, 1); // waypoints - WaypointSprite_AttachCarrier(WP_KaBallCarrier, other, RADARICON_FLAGCARRIER); - other.waypointsprite_attachedforcarrier.waypointsprite_visible_for_player = ka_ballcarrier_waypointsprite_visible_for_player; - WaypointSprite_UpdateRule(other.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT); - WaypointSprite_Ping(other.waypointsprite_attachedforcarrier); + WaypointSprite_AttachCarrier(WP_KaBallCarrier, toucher, RADARICON_FLAGCARRIER); + toucher.waypointsprite_attachedforcarrier.waypointsprite_visible_for_player = ka_ballcarrier_waypointsprite_visible_for_player; + WaypointSprite_UpdateRule(toucher.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT); + WaypointSprite_Ping(toucher.waypointsprite_attachedforcarrier); WaypointSprite_Kill(this.waypointsprite_attachedforcarrier); } diff --git a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc index 448a2bbc7..9ac66b5f5 100644 --- a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc @@ -505,7 +505,7 @@ void kh_Key_Collect(entity key, entity player) //a player picks up a dropped ke kh_Key_AssignTo(key, player); // this also updates .kh_state } -void kh_Key_Touch(entity this) // runs many, many times when a key has been dropped and can be picked up +void kh_Key_Touch(entity this, entity toucher) // runs many, many times when a key has been dropped and can be picked up { if(intermission_running) return; @@ -521,14 +521,14 @@ void kh_Key_Touch(entity this) // runs many, many times when a key has been dro // maybe start a shorter countdown? } - if (!IS_PLAYER(other)) + if (!IS_PLAYER(toucher)) return; - if(IS_DEAD(other)) + if(IS_DEAD(toucher)) return; - if(other == this.enemy) + if(toucher == this.enemy) if(time < this.kh_droptime + autocvar_g_balance_keyhunt_delay_collect) return; // you just dropped it! - kh_Key_Collect(this, other); + kh_Key_Collect(this, toucher); } void kh_Key_Remove(entity key) // runs after when all the keys have been collected or when a key has been dropped for more than X seconds diff --git a/qcsrc/server/portals.qc b/qcsrc/server/portals.qc index 7d85eec7e..423b839ea 100644 --- a/qcsrc/server/portals.qc +++ b/qcsrc/server/portals.qc @@ -249,7 +249,7 @@ float Portal_WillHitPlane(vector eorg, vector emins, vector emaxs, vector evel, #endif } -void Portal_Touch(entity this) +void Portal_Touch(entity this, entity toucher) { vector g; @@ -258,18 +258,18 @@ void Portal_Touch(entity this) if(this.solid != SOLID_TRIGGER) return; // possibly engine bug - if(IS_PLAYER(other)) + if(IS_PLAYER(toucher)) return; // handled by think #endif - if(other.classname == "item_flag_team") + if(toucher.classname == "item_flag_team") return; // never portal these - if(other.classname == "grapplinghook") + if(toucher.classname == "grapplinghook") return; // handled by think if(!autocvar_g_vehicles_teleportable) - if(IS_VEHICLE(other)) + if(IS_VEHICLE(toucher)) return; // no teleporting vehicles? if(!this.enemy) @@ -283,43 +283,43 @@ void Portal_Touch(entity this) return; // only handle impacts #endif - if(other.classname == "porto") + if(toucher.classname == "porto") { - if(other.portal_id == this.portal_id) + if(toucher.portal_id == this.portal_id) return; } if(time < this.portal_activatetime) - if(other == this.aiment) + if(toucher == this.aiment) { this.portal_activatetime = time + 0.1; return; } - if(other != this.aiment) - if(IS_PLAYER(other)) - if(IS_INDEPENDENT_PLAYER(other) || IS_INDEPENDENT_PLAYER(this.aiment)) + if(toucher != this.aiment) + if(IS_PLAYER(toucher)) + if(IS_INDEPENDENT_PLAYER(toucher) || IS_INDEPENDENT_PLAYER(this.aiment)) return; // cannot go through someone else's portal - if(other.aiment != this.aiment) - if(IS_PLAYER(other.aiment)) - if(IS_INDEPENDENT_PLAYER(other.aiment) || IS_INDEPENDENT_PLAYER(this.aiment)) + if(toucher.aiment != this.aiment) + if(IS_PLAYER(toucher.aiment)) + if(IS_INDEPENDENT_PLAYER(toucher.aiment) || IS_INDEPENDENT_PLAYER(this.aiment)) return; // cannot go through someone else's portal fixedmakevectors(this.mangle); g = frametime * '0 0 -1' * autocvar_sv_gravity; - if(!Portal_WillHitPlane(other.origin, other.mins, other.maxs, other.velocity + g, this.origin, v_forward, this.maxs.x)) + if(!Portal_WillHitPlane(toucher.origin, toucher.mins, toucher.maxs, toucher.velocity + g, this.origin, v_forward, this.maxs.x)) return; /* - if(other.mins_x < PL_MIN.x || other.mins_y < PL_MIN.y || other.mins_z < PL_MIN.z - || other.maxs_x > PL_MAX.x || other.maxs_y > PL_MAX.y || other.maxs_z > PL_MAX.z) + if(toucher.mins_x < PL_MIN.x || toucher.mins_y < PL_MIN.y || toucher.mins_z < PL_MIN.z + || toucher.maxs_x > PL_MAX.x || toucher.maxs_y > PL_MAX.y || toucher.maxs_z > PL_MAX.z) { // can't teleport this return; } */ - if(Portal_TeleportPlayer(this, other)) - if(other.classname == "porto") - if(other.effects & EF_RED) - other.effects += EF_BLUE - EF_RED; + if(Portal_TeleportPlayer(this, toucher)) + if(toucher.classname == "porto") + if(toucher.effects & EF_RED) + toucher.effects += EF_BLUE - EF_RED; } void Portal_Think(entity this); diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index c4e94cd13..e32968c56 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -698,10 +698,10 @@ void checkpoint_passed(entity this, entity player) } } -void checkpoint_touch(entity this) +void checkpoint_touch(entity this, entity toucher) { - EXACTTRIGGER_TOUCH; - checkpoint_passed(this, other); + EXACTTRIGGER_TOUCH(this, toucher); + checkpoint_passed(this, toucher); } void checkpoint_use(entity this, entity actor, entity trigger) @@ -1092,13 +1092,13 @@ void race_ImposePenaltyTime(entity pl, float penalty, string reason) } } -void penalty_touch(entity this) +void penalty_touch(entity this, entity toucher) { - EXACTTRIGGER_TOUCH; - if(other.race_lastpenalty != this) + EXACTTRIGGER_TOUCH(this, toucher); + if(toucher.race_lastpenalty != this) { - other.race_lastpenalty = this; - race_ImposePenaltyTime(other, this.race_penalty, this.race_penalty_reason); + toucher.race_lastpenalty = this; + race_ImposePenaltyTime(toucher, this.race_penalty, this.race_penalty_reason); } }