From c6fae88a462bf6e5ded37ac2fcdde0f844be9314 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 3 Jan 2016 23:12:22 +1000 Subject: [PATCH] Purge self from event_damage --- qcsrc/client/defs.qh | 2 +- qcsrc/common/effects/qc/casings.qc | 8 +- qcsrc/common/effects/qc/damageeffects.qc | 2 +- qcsrc/common/effects/qc/gibs.qc | 10 +- .../gamemodes/gamemode/onslaught/onslaught.qc | 140 ++++---- qcsrc/common/monsters/monster/shambler.qc | 14 +- qcsrc/common/monsters/sv_monsters.qc | 85 +++-- .../mutators/mutator/bloodloss/bloodloss.qc | 2 +- qcsrc/common/mutators/mutator/nades/nades.qc | 50 +-- qcsrc/common/mutators/mutator/overkill/rpc.qc | 14 +- .../mutator/physical_items/physical_items.qc | 10 +- .../mutator/waypoints/waypointsprites.qc | 8 +- .../mutator/waypoints/waypointsprites.qh | 2 +- qcsrc/common/physics/movetypes/push.qc | 6 +- qcsrc/common/t_items.qc | 4 +- qcsrc/common/triggers/func/breakable.qc | 42 +-- qcsrc/common/triggers/func/button.qc | 14 +- qcsrc/common/triggers/func/door.qc | 18 +- qcsrc/common/triggers/func/door_secret.qc | 4 +- qcsrc/common/triggers/trigger/multi.qc | 18 +- qcsrc/common/turrets/sv_turrets.qc | 52 +-- qcsrc/common/turrets/turret/walker.qc | 12 +- qcsrc/common/vehicles/sv_vehicles.qc | 104 +++--- .../common/vehicles/vehicle/raptor_weapons.qc | 12 +- qcsrc/common/weapons/weapon/devastator.qc | 16 +- qcsrc/common/weapons/weapon/electro.qc | 30 +- qcsrc/common/weapons/weapon/fireball.qc | 16 +- qcsrc/common/weapons/weapon/hagar.qc | 20 +- qcsrc/common/weapons/weapon/hook.qc | 14 +- qcsrc/common/weapons/weapon/minelayer.qc | 18 +- qcsrc/common/weapons/weapon/mortar.qc | 14 +- qcsrc/common/weapons/weapon/seeker.qc | 40 +-- qcsrc/server/cl_client.qc | 26 +- qcsrc/server/cl_player.qc | 306 +++++++++--------- qcsrc/server/cl_player.qh | 6 +- qcsrc/server/defs.qh | 2 +- qcsrc/server/g_damage.qc | 2 +- qcsrc/server/g_hook.qc | 22 +- qcsrc/server/mutators/events.qh | 1 + qcsrc/server/mutators/mutator/gamemode_ctf.qc | 14 +- .../mutators/mutator/gamemode_invasion.qc | 8 +- .../mutators/mutator/gamemode_keyhunt.qc | 10 +- qcsrc/server/portals.qc | 14 +- qcsrc/server/weapons/throwing.qc | 10 +- qcsrc/server/weapons/throwing.qh | 2 +- 45 files changed, 611 insertions(+), 613 deletions(-) diff --git a/qcsrc/client/defs.qh b/qcsrc/client/defs.qh index 3e959b084..d3db0ebfd 100644 --- a/qcsrc/client/defs.qh +++ b/qcsrc/client/defs.qh @@ -95,7 +95,7 @@ float ticrate; const float MIN_DAMAGEEXTRARADIUS = 2; const float MAX_DAMAGEEXTRARADIUS = 16; .float damageextraradius; -.void(float thisdmg, int hittype, vector org, vector thisforce) event_damage; +.void(entity this, float thisdmg, int hittype, vector org, vector thisforce) event_damage; // only for Porto float angles_held_status; diff --git a/qcsrc/common/effects/qc/casings.qc b/qcsrc/common/effects/qc/casings.qc index f68bf383d..3e0aa3592 100644 --- a/qcsrc/common/effects/qc/casings.qc +++ b/qcsrc/common/effects/qc/casings.qc @@ -113,12 +113,12 @@ void Casing_Touch() self.nextthink = time + 0.2; } -void Casing_Damage(float thisdmg, int hittype, vector org, vector thisforce) -{SELFPARAM(); +void Casing_Damage(entity this, float thisdmg, int hittype, vector org, vector thisforce) +{ if (thisforce.z < 0) thisforce.z = 0; - self.move_velocity = self.move_velocity + thisforce + '0 0 100'; - self.move_flags &= ~FL_ONGROUND; + this.move_velocity = this.move_velocity + thisforce + '0 0 100'; + this.move_flags &= ~FL_ONGROUND; } NET_HANDLE(casings, bool isNew) diff --git a/qcsrc/common/effects/qc/damageeffects.qc b/qcsrc/common/effects/qc/damageeffects.qc index 45b532b8a..4d85ab909 100644 --- a/qcsrc/common/effects/qc/damageeffects.qc +++ b/qcsrc/common/effects/qc/damageeffects.qc @@ -271,7 +271,7 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew) self.silent = 1; if(self.event_damage) - self.event_damage(thisdmg, w_deathtype, w_org, thisforce); + self.event_damage(self, thisdmg, w_deathtype, w_org, thisforce); DamageEffect(w_org, thisdmg, w_deathtype, species); diff --git a/qcsrc/common/effects/qc/gibs.qc b/qcsrc/common/effects/qc/gibs.qc index 09be41c6a..00aa243ed 100644 --- a/qcsrc/common/effects/qc/gibs.qc +++ b/qcsrc/common/effects/qc/gibs.qc @@ -20,7 +20,7 @@ bool Violence_GibSplash_SendEntity(entity this, entity to, int sf) } void Violence_GibSplash_At(vector org, vector dir, float type, float amount, entity gibowner, entity attacker) -{SELFPARAM(); +{ if(g_cts) // no gibs in CTS return; @@ -29,14 +29,14 @@ void Violence_GibSplash_At(vector org, vector dir, float type, float amount, ent e.state = type; // should stay smaller than 15 if(!sound_allowed(MSG_BROADCAST, gibowner) || !sound_allowed(MSG_BROADCAST, attacker)) e.state |= 0x40; // "silence" bit - e.state |= 8 * self.species; // gib type, ranges from 0 to 15 + e.state |= 8 * gibowner.species; // gib type, ranges from 0 to 15 // if this is a copied dead body, send the num of its player instead // TODO: remove this field, read from model txt files - if(self.classname == "body") - e.team = etof(self.enemy); + if(gibowner.classname == "body") + e.team = etof(gibowner.enemy); else - e.team = etof(self); + e.team = etof(gibowner); setorigin(e, org); e.velocity = dir; diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc index 7cdefd906..acd372c98 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc @@ -487,18 +487,18 @@ int ons_ControlPoint_Attackable(entity cp, int teamnumber) return 0; } -void ons_ControlPoint_Icon_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); +void ons_ControlPoint_Icon_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ if(damage <= 0) { return; } - if (self.owner.isshielded) + if (this.owner.isshielded) { // this is protected by a shield, so ignore the damage - if (time > self.pain_finished) + if (time > this.pain_finished) if (IS_PLAYER(attacker)) { play2(attacker, SND(ONS_DAMAGEBLOCKEDBYSHIELD)); - self.pain_finished = time + 1; + this.pain_finished = time + 1; attacker.typehitsound += 1; // play both sounds (shield is way too quiet) } @@ -506,60 +506,60 @@ void ons_ControlPoint_Icon_Damage(entity inflictor, entity attacker, float damag } if(IS_PLAYER(attacker)) - if(time - ons_notification_time[self.team] > 10) + if(time - ons_notification_time[this.team] > 10) { - play2team(self.team, SND(ONS_CONTROLPOINT_UNDERATTACK)); - ons_notification_time[self.team] = time; + play2team(this.team, SND(ONS_CONTROLPOINT_UNDERATTACK)); + ons_notification_time[this.team] = time; } - self.health = self.health - damage; - if(self.owner.iscaptured) - WaypointSprite_UpdateHealth(self.owner.sprite, self.health); + this.health = this.health - damage; + if(this.owner.iscaptured) + WaypointSprite_UpdateHealth(this.owner.sprite, this.health); else - WaypointSprite_UpdateBuildFinished(self.owner.sprite, time + (self.max_health - self.health) / (self.count / ONS_CP_THINKRATE)); - self.pain_finished = time + 1; + WaypointSprite_UpdateBuildFinished(this.owner.sprite, time + (this.max_health - this.health) / (this.count / ONS_CP_THINKRATE)); + this.pain_finished = time + 1; // particles on every hit pointparticles(EFFECT_SPARKS, hitloc, force*-1, 1); //sound on every hit if (random() < 0.5) - sound(self, CH_TRIGGER, SND_ONS_HIT1, VOL_BASE+0.3, ATTEN_NORM); + sound(this, CH_TRIGGER, SND_ONS_HIT1, VOL_BASE+0.3, ATTEN_NORM); else - sound(self, CH_TRIGGER, SND_ONS_HIT2, VOL_BASE+0.3, ATTEN_NORM); + sound(this, CH_TRIGGER, SND_ONS_HIT2, VOL_BASE+0.3, ATTEN_NORM); - if (self.health < 0) + if (this.health < 0) { - sound(self, CH_TRIGGER, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM); - pointparticles(EFFECT_ROCKET_EXPLODE, self.origin, '0 0 0', 1); - Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(self.team, INFO_ONSLAUGHT_CPDESTROYED_), self.owner.message, attacker.netname); + sound(this, CH_TRIGGER, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM); + pointparticles(EFFECT_ROCKET_EXPLODE, this.origin, '0 0 0', 1); + Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(this.team, INFO_ONSLAUGHT_CPDESTROYED_), this.owner.message, attacker.netname); PlayerScore_Add(attacker, SP_ONS_TAKES, 1); PlayerScore_Add(attacker, SP_SCORE, 10); - self.owner.goalentity = world; - self.owner.islinked = false; - self.owner.iscaptured = false; - self.owner.team = 0; - self.owner.colormap = 1024; + this.owner.goalentity = world; + this.owner.islinked = false; + this.owner.iscaptured = false; + this.owner.team = 0; + this.owner.colormap = 1024; - WaypointSprite_UpdateMaxHealth(self.owner.sprite, 0); + WaypointSprite_UpdateMaxHealth(this.owner.sprite, 0); onslaught_updatelinks(); // Use targets now (somebody make sure this is in the right place..) - setself(self.owner); - activator = self; - SUB_UseTargets (); + setself(this.owner); + activator = this; + WITH(entity, self, this, SUB_UseTargets()); setself(this); - self.owner.waslinked = self.owner.islinked; - if(self.owner.model != "models/onslaught/controlpoint_pad.md3") - setmodel_fixsize(self.owner, MDL_ONS_CP_PAD1); - //setsize(self, '-32 -32 0', '32 32 8'); + this.owner.waslinked = this.owner.islinked; + if(this.owner.model != "models/onslaught/controlpoint_pad.md3") + setmodel_fixsize(this.owner, MDL_ONS_CP_PAD1); + //setsize(this, '-32 -32 0', '32 32 8'); - remove(self); + remove(this); } - self.SendFlags |= CPSF_STATUS; + this.SendFlags |= CPSF_STATUS; } void ons_ControlPoint_Icon_Think() @@ -590,7 +590,7 @@ void ons_ControlPoint_Icon_Think() self.SendFlags |= CPSF_STATUS; if(self.health <= 0) { - ons_ControlPoint_Icon_Damage(self, self, 1, 0, self.origin, '0 0 0'); + ons_ControlPoint_Icon_Damage(self, self, self, 1, 0, self.origin, '0 0 0'); return; } } @@ -955,64 +955,64 @@ void ons_Generator_UpdateSprite(entity e) } } -void ons_GeneratorDamage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); +void ons_GeneratorDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ if(damage <= 0) { return; } if(warmup_stage || gameover) { return; } if(!round_handler_IsRoundStarted()) { return; } - if (attacker != self) + if (attacker != this) { - if (self.isshielded) + if (this.isshielded) { // this is protected by a shield, so ignore the damage - if (time > self.pain_finished) + if (time > this.pain_finished) if (IS_PLAYER(attacker)) { play2(attacker, SND(ONS_DAMAGEBLOCKEDBYSHIELD)); attacker.typehitsound += 1; - self.pain_finished = time + 1; + this.pain_finished = time + 1; } return; } - if (time > self.pain_finished) + if (time > this.pain_finished) { - self.pain_finished = time + 10; - FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && SAME_TEAM(it, self), LAMBDA(Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_GENERATOR_UNDERATTACK))); - play2team(self.team, SND(ONS_GENERATOR_UNDERATTACK)); + this.pain_finished = time + 10; + FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && SAME_TEAM(it, this), LAMBDA(Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_GENERATOR_UNDERATTACK))); + play2team(this.team, SND(ONS_GENERATOR_UNDERATTACK)); } } - self.health = self.health - damage; - WaypointSprite_UpdateHealth(self.sprite, self.health); + this.health = this.health - damage; + WaypointSprite_UpdateHealth(this.sprite, this.health); // choose an animation frame based on health - self.frame = 10 * bound(0, (1 - self.health / self.max_health), 1); + this.frame = 10 * bound(0, (1 - this.health / this.max_health), 1); // see if the generator is still functional, or dying - if (self.health > 0) + if (this.health > 0) { - self.lasthealth = self.health; + this.lasthealth = this.health; } else { - if (attacker == self) - Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(self.team, INFO_ONSLAUGHT_GENDESTROYED_OVERTIME_)); + if (attacker == this) + Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(this.team, INFO_ONSLAUGHT_GENDESTROYED_OVERTIME_)); else { - Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(self.team, INFO_ONSLAUGHT_GENDESTROYED_)); + Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(this.team, INFO_ONSLAUGHT_GENDESTROYED_)); PlayerScore_Add(attacker, SP_SCORE, 100); } - self.iscaptured = false; - self.islinked = false; - self.isshielded = false; - self.takedamage = DAMAGE_NO; // can't be hurt anymore - self.event_damage = func_null; // won't do anything if hurt - self.count = 0; // reset counter - self.think = func_null; - self.nextthink = 0; - //self.think(); // do the first explosion now - - WaypointSprite_UpdateMaxHealth(self.sprite, 0); - WaypointSprite_Ping(self.sprite); - //WaypointSprite_Kill(self.sprite); // can't do this yet, code too poor + this.iscaptured = false; + this.islinked = false; + this.isshielded = false; + this.takedamage = DAMAGE_NO; // can't be hurt anymore + this.event_damage = func_null; // won't do anything if hurt + this.count = 0; // reset counter + this.think = func_null; + this.nextthink = 0; + //this.think(); // do the first explosion now + + WaypointSprite_UpdateMaxHealth(this.sprite, 0); + WaypointSprite_Ping(this.sprite); + //WaypointSprite_Kill(this.sprite); // can't do this yet, code too poor onslaught_updatelinks(); } @@ -1020,7 +1020,7 @@ void ons_GeneratorDamage(entity inflictor, entity attacker, float damage, int de // Throw some flaming gibs on damage, more damage = more chance for gib if(random() < damage/220) { - sound(self, CH_TRIGGER, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); + sound(this, CH_TRIGGER, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); } else { @@ -1029,12 +1029,12 @@ void ons_GeneratorDamage(entity inflictor, entity attacker, float damage, int de //sound on every hit if (random() < 0.5) - sound(self, CH_TRIGGER, SND_ONS_HIT1, VOL_BASE, ATTEN_NORM); + sound(this, CH_TRIGGER, SND_ONS_HIT1, VOL_BASE, ATTEN_NORM); else - sound(self, CH_TRIGGER, SND_ONS_HIT2, VOL_BASE, ATTEN_NORM); + sound(this, CH_TRIGGER, SND_ONS_HIT2, VOL_BASE, ATTEN_NORM); } - self.SendFlags |= GSF_STATUS; + this.SendFlags |= GSF_STATUS; } void ons_GeneratorThink() diff --git a/qcsrc/common/monsters/monster/shambler.qc b/qcsrc/common/monsters/monster/shambler.qc index e77902be2..136b24f2f 100644 --- a/qcsrc/common/monsters/monster/shambler.qc +++ b/qcsrc/common/monsters/monster/shambler.qc @@ -105,18 +105,18 @@ void M_Shambler_Attack_Lightning_Explode() self.nextthink = time + 0.2; } -void M_Shambler_Attack_Lightning_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); - if (self.health <= 0) +void M_Shambler_Attack_Lightning_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + if (this.health <= 0) return; - if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions + if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions return; // g_projectiles_damage says to halt - self.health = self.health - damage; + this.health = this.health - damage; - if (self.health <= 0) - W_PrepareExplosionByDamage(attacker, self.use); + if (this.health <= 0) + WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.use)); } void M_Shambler_Attack_Lightning_Touch() diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 55e453d5d..f4fc64148 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -741,7 +741,7 @@ void Monster_Move(entity this, float runspeed, float walkspeed, float stpspeed) Unfreeze(this); this.health = 0; if(this.event_damage) - this.event_damage(this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, this.origin, '0 0 0'); + this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, this.origin, '0 0 0'); } else if ( this.revive_progress <= 0 ) @@ -965,22 +965,22 @@ void Monster_Reset(entity this) this.moveto = this.origin; } -void Monster_Dead_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); - self.health -= damage; +void Monster_Dead_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + this.health -= damage; - Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker); + Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker); - if(self.health <= -50) // 100 health until gone? + if(this.health <= -50) // 100 health until gone? { - Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker); + Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker); // number of monsters spawned with mobspawn command totalspawned -= 1; - self.think = SUB_Remove_self; - self.nextthink = time + 0.1; - self.event_damage = func_null; + this.think = SUB_Remove_self; + this.nextthink = time + 0.1; + this.event_damage = func_null; } } @@ -1038,86 +1038,85 @@ void Monster_Dead(entity this, entity attacker, float gibbed) W_ThrowNewWeapon(this, this.weapon, 0, this.origin, randomvec() * 150 + '0 0 325'); } -void Monster_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); - if((self.spawnflags & MONSTERFLAG_INVINCIBLE) && deathtype != DEATH_KILL.m_id && !ITEM_DAMAGE_NEEDKILL(deathtype)) +void Monster_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + if((this.spawnflags & MONSTERFLAG_INVINCIBLE) && deathtype != DEATH_KILL.m_id && !ITEM_DAMAGE_NEEDKILL(deathtype)) return; - if(STAT(FROZEN, self) && deathtype != DEATH_KILL.m_id && deathtype != DEATH_NADE_ICE_FREEZE.m_id) + if(STAT(FROZEN, this) && deathtype != DEATH_KILL.m_id && deathtype != DEATH_NADE_ICE_FREEZE.m_id) return; - //if(time < self.pain_finished && deathtype != DEATH_KILL.m_id) + //if(time < this.pain_finished && deathtype != DEATH_KILL.m_id) //return; - if(time < self.spawnshieldtime && deathtype != DEATH_KILL.m_id) + if(time < this.spawnshieldtime && deathtype != DEATH_KILL.m_id) return; - if(deathtype == DEATH_FALL.m_id && self.draggedby != world) + if(deathtype == DEATH_FALL.m_id && this.draggedby != world) return; vector v; float take, save; - v = healtharmor_applydamage(100, self.armorvalue / 100, deathtype, damage); + v = healtharmor_applydamage(100, this.armorvalue / 100, deathtype, damage); take = v_x; save = v_y; damage_take = take; frag_attacker = attacker; frag_deathtype = deathtype; - Monster mon = get_monsterinfo(self.monsterid); - mon.mr_pain(mon, self); + Monster mon = get_monsterinfo(this.monsterid); + mon.mr_pain(mon, this); take = damage_take; if(take) { - self.health -= take; - Monster_Sound(self, monstersound_pain, 1.2, true, CH_PAIN); + this.health -= take; + Monster_Sound(this, monstersound_pain, 1.2, true, CH_PAIN); } - if(self.sprite) - WaypointSprite_UpdateHealth(self.sprite, self.health); + if(this.sprite) + WaypointSprite_UpdateHealth(this.sprite, this.health); - self.dmg_time = time; + this.dmg_time = time; if(sound_allowed(MSG_BROADCAST, attacker) && deathtype != DEATH_DROWN.m_id) - spamsound (self, CH_PAIN, SND(BODYIMPACT1), VOL_BASE, ATTEN_NORM); // FIXME: PLACEHOLDER + spamsound (this, CH_PAIN, SND(BODYIMPACT1), VOL_BASE, ATTEN_NORM); // FIXME: PLACEHOLDER - self.velocity += force * self.damageforcescale; + this.velocity += force * this.damageforcescale; if(deathtype != DEATH_DROWN.m_id && take) { - Violence_GibSplash_At(hitloc, force, 2, bound(0, take, 200) / 16, self, attacker); + Violence_GibSplash_At(hitloc, force, 2, bound(0, take, 200) / 16, this, attacker); if (take > 50) - Violence_GibSplash_At(hitloc, force * -0.1, 3, 1, self, attacker); + Violence_GibSplash_At(hitloc, force * -0.1, 3, 1, this, attacker); if (take > 100) - Violence_GibSplash_At(hitloc, force * -0.2, 3, 1, self, attacker); + Violence_GibSplash_At(hitloc, force * -0.2, 3, 1, this, attacker); } - if(self.health <= 0) + if(this.health <= 0) { if(deathtype == DEATH_KILL.m_id) - self.candrop = false; // killed by mobkill command + this.candrop = false; // killed by mobkill command // TODO: fix this? activator = attacker; - other = self.enemy; - SUB_UseTargets(); - self.target2 = self.oldtarget2; // reset to original target on death, incase we respawn + other = this.enemy; + WITH(entity, self, this, SUB_UseTargets()); + this.target2 = this.oldtarget2; // reset to original target on death, incase we respawn - Monster_Dead(self, attacker, (self.health <= -100 || deathtype == DEATH_KILL.m_id)); + Monster_Dead(this, attacker, (this.health <= -100 || deathtype == DEATH_KILL.m_id)); - WaypointSprite_Kill(self.sprite); + WaypointSprite_Kill(this.sprite); - frag_target = self; - MUTATOR_CALLHOOK(MonsterDies, attacker); + MUTATOR_CALLHOOK(MonsterDies, this, attacker); - if(self.health <= -100 || deathtype == DEATH_KILL.m_id) // check if we're already gibbed + if(this.health <= -100 || deathtype == DEATH_KILL.m_id) // check if we're already gibbed { - Violence_GibSplash(self, 1, 0.5, attacker); + Violence_GibSplash(this, 1, 0.5, attacker); - self.think = SUB_Remove_self; - self.nextthink = time + 0.1; + this.think = SUB_Remove_self; + this.nextthink = time + 0.1; } } } diff --git a/qcsrc/common/mutators/mutator/bloodloss/bloodloss.qc b/qcsrc/common/mutators/mutator/bloodloss/bloodloss.qc index 54e8237ec..4543ae10e 100644 --- a/qcsrc/common/mutators/mutator/bloodloss/bloodloss.qc +++ b/qcsrc/common/mutators/mutator/bloodloss/bloodloss.qc @@ -15,7 +15,7 @@ MUTATOR_HOOKFUNCTION(bloodloss, PlayerPreThink) if(self.vehicle) vehicles_exit(VHEF_RELEASE); if(self.event_damage) - self.event_damage(self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0'); + self.event_damage(self, self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0'); self.bloodloss_timer = time + 0.5 + random() * 0.5; } } diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index 387a95d89..fcfce9ab7 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -701,16 +701,16 @@ void nade_beep() self.nextthink = max(self.wait, time); } -void nade_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); +void nade_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ if(ITEM_DAMAGE_NEEDKILL(deathtype)) { - self.takedamage = DAMAGE_NO; - nade_boom(); + this.takedamage = DAMAGE_NO; + WITH(entity, self, this, nade_boom()); return; } - if(self.nade_type == NADE_TYPE_TRANSLOCATE.m_id || self.nade_type == NADE_TYPE_SPAWN.m_id) + if(this.nade_type == NADE_TYPE_TRANSLOCATE.m_id || this.nade_type == NADE_TYPE_SPAWN.m_id) return; if (MUTATOR_CALLHOOK(Nade_Damage, DEATH_WEAPONOF(deathtype), force, damage)) {} @@ -727,43 +727,43 @@ void nade_damage(entity inflictor, entity attacker, float damage, int deathtype, else if(DEATH_ISWEAPON(deathtype, WEP_VORTEX) || DEATH_ISWEAPON(deathtype, WEP_VAPORIZER)) { force *= 6; - damage = self.max_health * 0.55; + damage = this.max_health * 0.55; } else if(DEATH_ISWEAPON(deathtype, WEP_MACHINEGUN)) - damage = self.max_health * 0.1; + damage = this.max_health * 0.1; else if(DEATH_ISWEAPON(deathtype, WEP_SHOCKWAVE) || DEATH_ISWEAPON(deathtype, WEP_SHOTGUN)) // WEAPONTODO { if(deathtype & HITTYPE_SECONDARY) { - damage = self.max_health * 0.1; + damage = this.max_health * 0.1; force *= 10; } else - damage = self.max_health * 1.15; + damage = this.max_health * 1.15; } - self.velocity += force; - UpdateCSQCProjectile(self); + this.velocity += force; + UpdateCSQCProjectile(this); - if(damage <= 0 || ((IS_ONGROUND(self)) && IS_PLAYER(attacker))) + if(damage <= 0 || ((IS_ONGROUND(this)) && IS_PLAYER(attacker))) return; - if(self.health == self.max_health) + if(this.health == this.max_health) { - sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX)); - self.nextthink = max(time + autocvar_g_nades_nade_lifetime, time); - self.think = nade_beep; + sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX)); + this.nextthink = max(time + autocvar_g_nades_nade_lifetime, time); + this.think = nade_beep; } - self.health -= damage; + this.health -= damage; - if ( self.nade_type != NADE_TYPE_HEAL.m_id || IS_PLAYER(attacker) ) - self.realowner = attacker; + if ( this.nade_type != NADE_TYPE_HEAL.m_id || IS_PLAYER(attacker) ) + this.realowner = attacker; - if(self.health <= 0) - W_PrepareExplosionByDamage(attacker, nade_boom); + if(this.health <= 0) + WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, nade_boom)); else - nade_burn_spawn(self); + nade_burn_spawn(this); } void toss_nade(entity e, vector _velocity, float _time) @@ -1252,10 +1252,10 @@ MUTATOR_HOOKFUNCTION(nades, PlayerDamage_Calculate) } MUTATOR_HOOKFUNCTION(nades, MonsterDies) -{SELFPARAM(); +{ if(IS_PLAYER(frag_attacker)) - if(DIFF_TEAM(frag_attacker, self)) - if(!(self.spawnflags & MONSTERFLAG_SPAWNED)) + if(DIFF_TEAM(frag_attacker, frag_target)) + if(!(frag_target.spawnflags & MONSTERFLAG_SPAWNED)) nades_GiveBonus(frag_attacker, autocvar_g_nades_bonus_score_minor); return false; diff --git a/qcsrc/common/mutators/mutator/overkill/rpc.qc b/qcsrc/common/mutators/mutator/overkill/rpc.qc index fb7ff8c69..96e54d5a0 100644 --- a/qcsrc/common/mutators/mutator/overkill/rpc.qc +++ b/qcsrc/common/mutators/mutator/overkill/rpc.qc @@ -69,18 +69,18 @@ void W_RocketPropelledChainsaw_Touch () W_RocketPropelledChainsaw_Explode(); } -void W_RocketPropelledChainsaw_Damage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); - if (self.health <= 0) +void W_RocketPropelledChainsaw_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + if (this.health <= 0) return; - if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions + if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions return; // g_projectiles_damage says to halt - self.health = self.health - damage; + this.health = this.health - damage; - if (self.health <= 0) - W_PrepareExplosionByDamage(attacker, W_RocketPropelledChainsaw_Explode); + if (this.health <= 0) + WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_RocketPropelledChainsaw_Explode)); } void W_RocketPropelledChainsaw_Think() diff --git a/qcsrc/common/mutators/mutator/physical_items/physical_items.qc b/qcsrc/common/mutators/mutator/physical_items/physical_items.qc index 6fbe77bce..b473e8fc9 100644 --- a/qcsrc/common/mutators/mutator/physical_items/physical_items.qc +++ b/qcsrc/common/mutators/mutator/physical_items/physical_items.qc @@ -78,13 +78,13 @@ void physical_item_touch() } } -void physical_item_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); - if(!self.cnt) // not for dropped items +void physical_item_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + if(!this.cnt) // not for dropped items if(ITEM_DAMAGE_NEEDKILL(deathtype)) { - setorigin(self, self.spawn_origin); - self.angles = self.spawn_angles; + setorigin(this, this.spawn_origin); + this.angles = this.spawn_angles; } } diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc index 0710a49d0..f4b82ef12 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc @@ -1126,10 +1126,10 @@ void WaypointSprite_ClearOwned() WaypointSprite_Kill(self.waypointsprite_attached); } -void WaypointSprite_PlayerDead() -{SELFPARAM(); - WaypointSprite_Disown(self.waypointsprite_attached, waypointsprite_deadlifetime); - WaypointSprite_DetachCarrier(self); +void WaypointSprite_PlayerDead(entity this) +{ + WaypointSprite_Disown(this.waypointsprite_attached, waypointsprite_deadlifetime); + WaypointSprite_DetachCarrier(this); } void WaypointSprite_PlayerGone() diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh index 4e3ceb0e5..b299f7fbe 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh @@ -227,7 +227,7 @@ void WaypointSprite_ClearPersonal(); void WaypointSprite_ClearOwned(); -void WaypointSprite_PlayerDead(); +void WaypointSprite_PlayerDead(entity this); void WaypointSprite_PlayerGone(); #endif diff --git a/qcsrc/common/physics/movetypes/push.qc b/qcsrc/common/physics/movetypes/push.qc index b83246546..dc455944c 100644 --- a/qcsrc/common/physics/movetypes/push.qc +++ b/qcsrc/common/physics/movetypes/push.qc @@ -93,16 +93,14 @@ void _Movetype_PushMove(entity this, float dt) // SV_PushMove if (check.move_movetype == 32) // MOVETYPE_PHYSICS { check.move_origin = check.move_origin + move; - WITH(entity, this, check, _Movetype_LinkEdict(this, true)); + _Movetype_LinkEdict(check, true); continue; } // try moving the contacted entity this.solid = SOLID_NOT; bool flag = false; - WITH(entity, this, check, { - flag = _Movetype_PushEntity(this, move, true); - }); + flag = _Movetype_PushEntity(check, move, true); if (!flag) { // entity "check" got teleported diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 8cbbbb339..4d601d4e1 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -1014,10 +1014,10 @@ float commodity_pickupevalfunc(entity player, entity item) return item.bot_pickupbasevalue * c; } -void Item_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void Item_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) { if(ITEM_DAMAGE_NEEDKILL(deathtype)) - RemoveItem(); + WITH(entity, self, this, RemoveItem()); } void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter) diff --git a/qcsrc/common/triggers/func/breakable.qc b/qcsrc/common/triggers/func/breakable.qc index e43e0e4c4..e3c74b356 100644 --- a/qcsrc/common/triggers/func/breakable.qc +++ b/qcsrc/common/triggers/func/breakable.qc @@ -41,7 +41,7 @@ // Otherwise mdl_dead will be displayed at the map origin, and nobody would // want that! -void func_breakable_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force); +void func_breakable_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force); // // func_breakable @@ -226,42 +226,42 @@ void func_breakable_destroy() self.message = oldmsg; } -void func_breakable_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); - if(self.state == 1) +void func_breakable_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + if(this.state == 1) return; - if(self.spawnflags & DOOR_NOSPLASH) + if(this.spawnflags & DOOR_NOSPLASH) if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH)) return; - if(self.team) - if(attacker.team == self.team) + if(this.team) + if(attacker.team == this.team) return; - self.pain_finished = time; - self.health = self.health - damage; - if(self.sprite) + this.pain_finished = time; + this.health = this.health - damage; + if(this.sprite) { - WaypointSprite_Ping(self.sprite); - WaypointSprite_UpdateHealth(self.sprite, self.health); + WaypointSprite_Ping(this.sprite); + WaypointSprite_UpdateHealth(this.sprite, this.health); } - func_breakable_colormod(); + WITH(entity, self, this, func_breakable_colormod()); - if(self.health <= 0) + if(this.health <= 0) { debrisforce = force; - self.takedamage = DAMAGE_NO; - self.event_damage = func_null; + this.takedamage = DAMAGE_NO; + this.event_damage = func_null; - if(IS_CLIENT(attacker) && self.classname == "func_assault_destructible") + if(IS_CLIENT(attacker) && this.classname == "func_assault_destructible") { - self.owner = attacker; - self.realowner = attacker; + this.owner = attacker; + this.realowner = attacker; } // do not explode NOW but in the NEXT FRAME! // because recursive calls to RadiusDamage are not allowed - self.nextthink = time; - self.think = func_breakable_destroy; + this.nextthink = time; + this.think = func_breakable_destroy; } } diff --git a/qcsrc/common/triggers/func/button.qc b/qcsrc/common/triggers/func/button.qc index 0e2252130..41cdb44da 100644 --- a/qcsrc/common/triggers/func/button.qc +++ b/qcsrc/common/triggers/func/button.qc @@ -83,16 +83,16 @@ void button_touch() button_fire (); } -void button_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); - if(self.spawnflags & DOOR_NOSPLASH) +void button_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + if(this.spawnflags & DOOR_NOSPLASH) if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH)) return; - self.health = self.health - damage; - if (self.health <= 0) + this.health = this.health - damage; + if (this.health <= 0) { - self.enemy = damage_attacker; - button_fire (); + this.enemy = damage_attacker; + WITH(entity, self, this, button_fire()); } } diff --git a/qcsrc/common/triggers/func/door.qc b/qcsrc/common/triggers/func/door.qc index 99ee91f82..1bd36df4b 100644 --- a/qcsrc/common/triggers/func/door.qc +++ b/qcsrc/common/triggers/func/door.qc @@ -272,24 +272,24 @@ void door_use() } } -void door_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); - if(self.spawnflags & DOOR_NOSPLASH) +void door_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + if(this.spawnflags & DOOR_NOSPLASH) if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH)) return; - self.health = self.health - damage; + this.health = this.health - damage; - if (self.itemkeys) + if (this.itemkeys) { // don't allow opening doors through damage if keys are required return; } - if (self.health <= 0) + if (this.health <= 0) { - self.owner.health = self.owner.max_health; - self.owner.takedamage = DAMAGE_NO; // wil be reset upon return - WITH(entity, self, self.owner, door_use()); + this.owner.health = this.owner.max_health; + this.owner.takedamage = DAMAGE_NO; // wil be reset upon return + WITH(entity, self, this.owner, door_use()); } } diff --git a/qcsrc/common/triggers/func/door_secret.qc b/qcsrc/common/triggers/func/door_secret.qc index 3fabc3fb1..e32ed7e50 100644 --- a/qcsrc/common/triggers/func/door_secret.qc +++ b/qcsrc/common/triggers/func/door_secret.qc @@ -63,9 +63,9 @@ void fd_secret_use() _sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); } -void fd_secret_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void fd_secret_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) { - fd_secret_use(); + WITH(entity, self, this, fd_secret_use()); } // Wait after first movement... diff --git a/qcsrc/common/triggers/trigger/multi.qc b/qcsrc/common/triggers/trigger/multi.qc index fd3917d33..500f8f32f 100644 --- a/qcsrc/common/triggers/trigger/multi.qc +++ b/qcsrc/common/triggers/trigger/multi.qc @@ -99,19 +99,19 @@ void multi_touch() multi_trigger (); } -void multi_eventdamage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); - if (!self.takedamage) +void multi_eventdamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + if(!this.takedamage) return; - if(self.spawnflags & DOOR_NOSPLASH) + if(this.spawnflags & DOOR_NOSPLASH) if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH)) return; - self.health = self.health - damage; - if (self.health <= 0) + this.health = this.health - damage; + if (this.health <= 0) { - self.enemy = attacker; - self.goalentity = inflictor; - multi_trigger(); + this.enemy = attacker; + this.goalentity = inflictor; + WITH(entity, self, this, multi_trigger()); } } diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc index 9fac6c79f..bbd9c990a 100644 --- a/qcsrc/common/turrets/sv_turrets.qc +++ b/qcsrc/common/turrets/sv_turrets.qc @@ -207,17 +207,17 @@ void turret_die() } } -void turret_damage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector vforce) -{SELFPARAM(); +void turret_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector vforce) +{ // Enough already! - if(self.deadflag == DEAD_DEAD) + if(this.deadflag == DEAD_DEAD) return; // Inactive turrets take no damage. (hm..) - if(!self.active) + if(!this.active) return; - if(SAME_TEAM(self, attacker)) + if(SAME_TEAM(this, attacker)) { if(autocvar_g_friendlyfire) damage = damage * autocvar_g_friendlyfire; @@ -225,30 +225,30 @@ void turret_damage (entity inflictor, entity attacker, float damage, int deathty return; } - self.health -= damage; + this.health -= damage; // thorw head slightly off aim when hit? - if (self.damage_flags & TFL_DMG_HEADSHAKE) + if (this.damage_flags & TFL_DMG_HEADSHAKE) { - self.tur_head.angles_x = self.tur_head.angles_x + (-0.5 + random()) * damage; - self.tur_head.angles_y = self.tur_head.angles_y + (-0.5 + random()) * damage; + this.tur_head.angles_x = this.tur_head.angles_x + (-0.5 + random()) * damage; + this.tur_head.angles_y = this.tur_head.angles_y + (-0.5 + random()) * damage; - self.SendFlags |= TNSF_ANG; + this.SendFlags |= TNSF_ANG; } - if (self.turret_flags & TUR_FLAG_MOVE) - self.velocity = self.velocity + vforce; + if (this.turret_flags & TUR_FLAG_MOVE) + this.velocity = this.velocity + vforce; - if (self.health <= 0) + if (this.health <= 0) { - self.event_damage = func_null; - self.tur_head.event_damage = func_null; - self.takedamage = DAMAGE_NO; - self.nextthink = time; - self.think = turret_die; + this.event_damage = func_null; + this.tur_head.event_damage = func_null; + this.takedamage = DAMAGE_NO; + this.nextthink = time; + this.think = turret_die; } - self.SendFlags |= TNSF_STATUS; + this.SendFlags |= TNSF_STATUS; } void() turret_think; @@ -449,13 +449,13 @@ void turret_projectile_touch() turret_projectile_explode(); } -void turret_projectile_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector vforce) -{SELFPARAM(); - self.velocity += vforce; - self.health -= damage; - //self.realowner = attacker; // Dont change realowner, it does not make much sense for turrets - if(self.health <= 0) - W_PrepareExplosionByDamage(self.owner, turret_projectile_explode); +void turret_projectile_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector vforce) +{ + this.velocity += vforce; + this.health -= damage; + //this.realowner = attacker; // Dont change realowner, it does not make much sense for turrets + if(this.health <= 0) + WITH(entity, self, this, W_PrepareExplosionByDamage(this.owner, turret_projectile_explode)); } entity turret_projectile(string _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim) diff --git a/qcsrc/common/turrets/turret/walker.qc b/qcsrc/common/turrets/turret/walker.qc index 05f2b77ed..339e997b7 100644 --- a/qcsrc/common/turrets/turret/walker.qc +++ b/qcsrc/common/turrets/turret/walker.qc @@ -105,13 +105,13 @@ void walker_rocket_explode() remove (self); } -void walker_rocket_damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce) -{SELFPARAM(); - self.health = self.health - damage; - self.velocity = self.velocity + vforce; +void walker_rocket_damage(entity this, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce) +{ + this.health = this.health - damage; + this.velocity = this.velocity + vforce; - if (self.health <= 0) - W_PrepareExplosionByDamage(self.owner, walker_rocket_explode); + if (this.health <= 0) + WITH(entity, self, this, W_PrepareExplosionByDamage(this.owner, walker_rocket_explode)); } #define WALKER_ROCKET_MOVE movelib_move_simple(self, newdir, (autocvar_g_turrets_unit_walker_rocket_speed), (autocvar_g_turrets_unit_walker_rocket_turnrate)); UpdateCSQCProjectile(self) diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index dc57e259f..391ce9984 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -196,20 +196,20 @@ vector vehicles_force_fromtag_maglev(entity this, string tag_name, float spring_ } // projectile handling -void vehicles_projectile_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); +void vehicles_projectile_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ // Ignore damage from oterh projectiles from my owner (dont mess up volly's) - if(inflictor.owner == self.owner) + if(inflictor.owner == this.owner) return; - self.health -= damage; - self.velocity += force; - if(self.health < 1) + this.health -= damage; + this.velocity += force; + if(this.health < 1) { - self.takedamage = DAMAGE_NO; - self.event_damage = func_null; - self.think = self.use; - self.nextthink = time; + this.takedamage = DAMAGE_NO; + this.event_damage = func_null; + this.think = this.use; + this.nextthink = time; } } @@ -634,9 +634,9 @@ void vehicles_frame(entity this, entity actor) vehicles_painframe(this); } -void vehicles_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); - self.dmg_time = time; +void vehicles_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + this.dmg_time = time; // WEAPONTODO if(DEATH_ISWEAPON(deathtype, WEP_VORTEX)) @@ -657,74 +657,74 @@ void vehicles_damage(entity inflictor, entity attacker, float damage, int deatht if(DEATH_WEAPONOF(deathtype) != WEP_Null) damage *= autocvar_g_vehicles_weapon_damagerate; - self.enemy = attacker; + this.enemy = attacker; - self.pain_finished = time; + this.pain_finished = time; - if((self.vehicle_flags & VHF_HASSHIELD) && (self.vehicle_shield > 0)) + if((this.vehicle_flags & VHF_HASSHIELD) && (this.vehicle_shield > 0)) { - if (wasfreed(self.vehicle_shieldent) || self.vehicle_shieldent == world) + if (wasfreed(this.vehicle_shieldent) || this.vehicle_shieldent == world) { - self.vehicle_shieldent = spawn(); - self.vehicle_shieldent.effects = EF_LOWPRECISION; - - setmodel(self.vehicle_shieldent, MDL_VEH_SHIELD); - setattachment(self.vehicle_shieldent, self, ""); - setorigin(self.vehicle_shieldent, real_origin(self) - self.origin); - self.vehicle_shieldent.scale = 256 / vlen(self.maxs - self.mins); - self.vehicle_shieldent.think = shieldhit_think; + this.vehicle_shieldent = spawn(); + this.vehicle_shieldent.effects = EF_LOWPRECISION; + + setmodel(this.vehicle_shieldent, MDL_VEH_SHIELD); + setattachment(this.vehicle_shieldent, this, ""); + setorigin(this.vehicle_shieldent, real_origin(this) - this.origin); + this.vehicle_shieldent.scale = 256 / vlen(this.maxs - this.mins); + this.vehicle_shieldent.think = shieldhit_think; } - self.vehicle_shieldent.colormod = '1 1 1'; - self.vehicle_shieldent.alpha = 0.45; - self.vehicle_shieldent.angles = vectoangles(normalize(hitloc - (self.origin + self.vehicle_shieldent.origin))) - self.angles; - self.vehicle_shieldent.nextthink = time; - self.vehicle_shieldent.effects &= ~EF_NODRAW; + this.vehicle_shieldent.colormod = '1 1 1'; + this.vehicle_shieldent.alpha = 0.45; + this.vehicle_shieldent.angles = vectoangles(normalize(hitloc - (this.origin + this.vehicle_shieldent.origin))) - this.angles; + this.vehicle_shieldent.nextthink = time; + this.vehicle_shieldent.effects &= ~EF_NODRAW; - self.vehicle_shield -= damage; + this.vehicle_shield -= damage; - if(self.vehicle_shield < 0) + if(this.vehicle_shield < 0) { - self.vehicle_health -= fabs(self.vehicle_shield); - self.vehicle_shieldent.colormod = '2 0 0'; - self.vehicle_shield = 0; - self.vehicle_shieldent.alpha = 0.75; + this.vehicle_health -= fabs(this.vehicle_shield); + this.vehicle_shieldent.colormod = '2 0 0'; + this.vehicle_shield = 0; + this.vehicle_shieldent.alpha = 0.75; if(sound_allowed(MSG_BROADCAST, attacker)) - spamsound (self, CH_PAIN, "onslaught/ons_hit2.wav", VOL_BASE, ATTEN_NORM); // FIXME: PLACEHOLDER + spamsound (this, CH_PAIN, "onslaught/ons_hit2.wav", VOL_BASE, ATTEN_NORM); // FIXME: PLACEHOLDER } else if(sound_allowed(MSG_BROADCAST, attacker)) - spamsound (self, CH_PAIN, "onslaught/electricity_explode.wav", VOL_BASE, ATTEN_NORM); // FIXME: PLACEHOLDER + spamsound (this, CH_PAIN, "onslaught/electricity_explode.wav", VOL_BASE, ATTEN_NORM); // FIXME: PLACEHOLDER } else { - self.vehicle_health -= damage; + this.vehicle_health -= damage; if(sound_allowed(MSG_BROADCAST, attacker)) - spamsound (self, CH_PAIN, "onslaught/ons_hit2.wav", VOL_BASE, ATTEN_NORM); // FIXME: PLACEHOLDER + spamsound (this, CH_PAIN, "onslaught/ons_hit2.wav", VOL_BASE, ATTEN_NORM); // FIXME: PLACEHOLDER } - if(self.damageforcescale < 1 && self.damageforcescale > 0) - self.velocity += force * self.damageforcescale; + if(this.damageforcescale < 1 && this.damageforcescale > 0) + this.velocity += force * this.damageforcescale; else - self.velocity += force; + this.velocity += force; - if(self.vehicle_health <= 0) + if(this.vehicle_health <= 0) { - if(self.owner) - if(self.vehicle_flags & VHF_DEATHEJECT) - vehicles_exit(VHEF_EJECT); + if(this.owner) + if(this.vehicle_flags & VHF_DEATHEJECT) + WITH(entity, self, this, vehicles_exit(VHEF_EJECT)); else - vehicles_exit(VHEF_RELEASE); + WITH(entity, self, this, vehicles_exit(VHEF_RELEASE)); - antilag_clear(self); + antilag_clear(this); - Vehicle info = Vehicles_from(self.vehicleid); - info.vr_death(info, self); - vehicles_setreturn(self); + Vehicle info = Vehicles_from(this.vehicleid); + info.vr_death(info, this); + vehicles_setreturn(this); } } diff --git a/qcsrc/common/vehicles/vehicle/raptor_weapons.qc b/qcsrc/common/vehicles/vehicle/raptor_weapons.qc index 9af91bf51..202be527f 100644 --- a/qcsrc/common/vehicles/vehicle/raptor_weapons.qc +++ b/qcsrc/common/vehicles/vehicle/raptor_weapons.qc @@ -106,7 +106,7 @@ float autocvar_g_vehicle_raptor_flare_chase; float autocvar_g_vehicle_raptor_flare_range; void raptor_flare_think(); -void raptor_flare_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force); +void raptor_flare_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force); void raptor_flare_touch(); METHOD(RaptorFlare, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { @@ -237,11 +237,11 @@ void raptor_flare_touch() remove(self); } -void raptor_flare_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); - self.health -= damage; - if(self.health <= 0) - remove(self); +void raptor_flare_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + this.health -= damage; + if(this.health <= 0) + remove(this); } void raptor_flare_think() diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index f334f2a2b..d714acab4 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -332,19 +332,19 @@ void W_Devastator_Touch() W_Devastator_Explode(); } -void W_Devastator_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); - if(self.health <= 0) +void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + if(this.health <= 0) return; - if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions + if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions return; // g_projectiles_damage says to halt - self.health = self.health - damage; - self.angles = vectoangles(self.velocity); + this.health = this.health - damage; + this.angles = vectoangles(this.velocity); - if(self.health <= 0) - W_PrepareExplosionByDamage(attacker, W_Devastator_Explode); + if(this.health <= 0) + WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Devastator_Explode)); } void W_Devastator_Attack(Weapon thiswep) diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index fd1f74ecd..d766e6a87 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -306,34 +306,34 @@ void W_Electro_Orb_Touch() } } -void W_Electro_Orb_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); - if(self.health <= 0) +void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + if(this.health <= 0) return; // note: combos are usually triggered by W_Electro_TriggerCombo, not damage float is_combo = (inflictor.classname == "electro_orb_chain" || inflictor.classname == "electro_bolt"); - if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, (is_combo ? 1 : -1))) + if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, (is_combo ? 1 : -1))) return; // g_projectiles_damage says to halt - self.health = self.health - damage; - if(self.health <= 0) + this.health = this.health - damage; + if(this.health <= 0) { - self.takedamage = DAMAGE_NO; - self.nextthink = time; + this.takedamage = DAMAGE_NO; + this.nextthink = time; if(is_combo) { // change owner to whoever caused the combo explosion - self.realowner = inflictor.realowner; - self.classname = "electro_orb_chain"; - self.think = W_Electro_ExplodeCombo; - self.nextthink = time + + this.realowner = inflictor.realowner; + this.classname = "electro_orb_chain"; + this.think = W_Electro_ExplodeCombo; + this.nextthink = time + ( // bound the length, inflictor may be in a galaxy far far away (warpzones) min( WEP_CVAR(electro, combo_radius), - vlen(self.origin - inflictor.origin) + vlen(this.origin - inflictor.origin) ) / // delay combo chains, looks cooler @@ -342,8 +342,8 @@ void W_Electro_Orb_Damage(entity inflictor, entity attacker, float damage, int d } else { - self.use = W_Electro_Explode; - self.think = adaptor_think2use; // not _hittype_splash, as this runs "immediately" + this.use = W_Electro_Explode; + this.think = adaptor_think2use; // not _hittype_splash, as this runs "immediately" } } } diff --git a/qcsrc/common/weapons/weapon/fireball.qc b/qcsrc/common/weapons/weapon/fireball.qc index 2beeb69a1..f39ad474a 100644 --- a/qcsrc/common/weapons/weapon/fireball.qc +++ b/qcsrc/common/weapons/weapon/fireball.qc @@ -167,19 +167,19 @@ void W_Fireball_Think() self.nextthink = time + 0.1; } -void W_Fireball_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); - if(self.health <= 0) +void W_Fireball_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + if(this.health <= 0) return; - if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions + if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions return; // g_projectiles_damage says to halt - self.health = self.health - damage; - if(self.health <= 0) + this.health = this.health - damage; + if(this.health <= 0) { - self.cnt = 1; - W_PrepareExplosionByDamage(attacker, W_Fireball_Explode); + this.cnt = 1; + WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Fireball_Explode)); } } diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index 611097e90..ff6088f8f 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -79,28 +79,28 @@ void W_Hagar_Explode2() remove(self); } -void W_Hagar_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); - if(self.health <= 0) +void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + if(this.health <= 0) return; - float is_linkexplode = ( ((inflictor.owner != world) ? (inflictor.owner == self.owner) : true) + float is_linkexplode = ( ((inflictor.owner != world) ? (inflictor.owner == this.owner) : true) && (inflictor.projectiledeathtype & HITTYPE_SECONDARY) - && (self.projectiledeathtype & HITTYPE_SECONDARY)); + && (this.projectiledeathtype & HITTYPE_SECONDARY)); if(is_linkexplode) is_linkexplode = (is_linkexplode && WEP_CVAR_SEC(hagar, load_linkexplode)); else is_linkexplode = -1; // not secondary load, so continue as normal without exception. - if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, is_linkexplode)) + if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, is_linkexplode)) return; // g_projectiles_damage says to halt - self.health = self.health - damage; - self.angles = vectoangles(self.velocity); + this.health = this.health - damage; + this.angles = vectoangles(this.velocity); - if(self.health <= 0) - W_PrepareExplosionByDamage(attacker, self.think); + if(this.health <= 0) + WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.think)); } void W_Hagar_Touch() diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index d059746f1..8fc13f9e1 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -118,18 +118,18 @@ void W_Hook_Explode2() self.movetype = MOVETYPE_NONE; } -void W_Hook_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); - if(self.health <= 0) +void W_Hook_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + if(this.health <= 0) return; - if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions + if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions return; // g_projectiles_damage says to halt - self.health = self.health - damage; + this.health = this.health - damage; - if(self.health <= 0) - W_PrepareExplosionByDamage(self.realowner, W_Hook_Explode2); + if(this.health <= 0) + WITH(entity, self, this, W_PrepareExplosionByDamage(this.realowner, W_Hook_Explode2)); } void W_Hook_Touch2() diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index 029ce460f..f9c43f62d 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -294,21 +294,21 @@ void W_MineLayer_Touch() } } -void W_MineLayer_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); - if(self.health <= 0) +void W_MineLayer_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + if(this.health <= 0) return; - float is_from_enemy = (inflictor.realowner != self.realowner); + float is_from_enemy = (inflictor.realowner != this.realowner); - if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, (is_from_enemy ? 1 : -1))) + if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, (is_from_enemy ? 1 : -1))) return; // g_projectiles_damage says to halt - self.health = self.health - damage; - self.angles = vectoangles(self.velocity); + this.health = this.health - damage; + this.angles = vectoangles(this.velocity); - if(self.health <= 0) - W_PrepareExplosionByDamage(attacker, W_MineLayer_Explode); + if(this.health <= 0) + WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_MineLayer_Explode)); } void W_MineLayer_Attack(Weapon thiswep) diff --git a/qcsrc/common/weapons/weapon/mortar.qc b/qcsrc/common/weapons/weapon/mortar.qc index a19f38dc0..b361a5050 100644 --- a/qcsrc/common/weapons/weapon/mortar.qc +++ b/qcsrc/common/weapons/weapon/mortar.qc @@ -105,18 +105,18 @@ void W_Mortar_Grenade_Explode2() } -void W_Mortar_Grenade_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); - if(self.health <= 0) +void W_Mortar_Grenade_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + if(this.health <= 0) return; - if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions + if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions return; // g_projectiles_damage says to halt - self.health = self.health - damage; + this.health = this.health - damage; - if(self.health <= 0) - W_PrepareExplosionByDamage(attacker, self.use); + if(this.health <= 0) + WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.use)); } void W_Mortar_Grenade_Think1() diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index c777562e4..98fe8c8f7 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -206,21 +206,21 @@ void W_Seeker_Missile_Think() -void W_Seeker_Missile_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); - if(self.health <= 0) +void W_Seeker_Missile_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + if(this.health <= 0) return; - if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions + if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions return; // g_projectiles_damage says to halt - if(self.realowner == attacker) - self.health = self.health - (damage * 0.25); + if(this.realowner == attacker) + this.health = this.health - (damage * 0.25); else - self.health = self.health - damage; + this.health = this.health - damage; - if(self.health <= 0) - W_PrepareExplosionByDamage(attacker, W_Seeker_Missile_Explode); + if(this.health <= 0) + WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Seeker_Missile_Explode)); } /* @@ -477,22 +477,22 @@ void W_Seeker_Tracker_Think() // ============================ // Begin: Tag projectile // ============================ -void W_Seeker_Tag_Explode() -{SELFPARAM(); - //if(other==self.realowner) +void W_Seeker_Tag_Explode(entity this) +{ + //if(other==this.realowner) // return; - Damage_DamageInfo(self.origin, 0, 0, 0, self.velocity, WEP_SEEKER.m_id | HITTYPE_BOUNCE, other.species, self); + Damage_DamageInfo(this.origin, 0, 0, 0, this.velocity, WEP_SEEKER.m_id | HITTYPE_BOUNCE, other.species, this); - remove(self); + remove(this); } -void W_Seeker_Tag_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); - if(self.health <= 0) +void W_Seeker_Tag_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + if(this.health <= 0) return; - self.health = self.health - damage; - if(self.health <= 0) - W_Seeker_Tag_Explode(); + this.health = this.health - damage; + if(this.health <= 0) + W_Seeker_Tag_Explode(this); } void W_Seeker_Tag_Touch() diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 9230f0c24..d211e0f38 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -209,7 +209,7 @@ void PutObserverInServer() if(self.vehicle) vehicles_exit(VHEF_RELEASE); - WaypointSprite_PlayerDead(); + WaypointSprite_PlayerDead(self); if(!mutator_returnvalue) // mutator prevents resetting teams self.team = -1; // move this as it is needed to log the player spectating in eventlog @@ -731,21 +731,21 @@ Called when a client types 'kill' in the console */ .float clientkill_nexttime; -void ClientKill_Now_TeamChange() -{SELFPARAM(); - if(self.killindicator_teamchange == -1) +void ClientKill_Now_TeamChange(entity this) +{ + if(this.killindicator_teamchange == -1) { - JoinBestTeam( self, false, true ); + JoinBestTeam( this, false, true ); } - else if(self.killindicator_teamchange == -2) + else if(this.killindicator_teamchange == -2) { if(blockSpectators) - Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime); - PutObserverInServer(); + Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime); + WITH(entity, self, this, PutObserverInServer()); } else - SV_ChangeTeam(self.killindicator_teamchange - 1); - self.killindicator_teamchange = 0; + WITH(entity, self, this, SV_ChangeTeam(this.killindicator_teamchange - 1)); + this.killindicator_teamchange = 0; } void ClientKill_Now() @@ -766,7 +766,7 @@ void ClientKill_Now() self.killindicator = world; if(self.killindicator_teamchange) - ClientKill_Now_TeamChange(); + ClientKill_Now_TeamChange(self); if(IS_PLAYER(self)) Damage(self, self, self, 100000, DEATH_KILL.m_id, self.origin, '0 0 0'); @@ -1552,7 +1552,7 @@ void player_regen () if(self.vehicle) vehicles_exit(VHEF_RELEASE); if(self.event_damage) - self.event_damage(self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0'); + self.event_damage(self, self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0'); } if (!(self.items & IT_UNLIMITED_WEAPON_AMMO)) @@ -2195,7 +2195,7 @@ void PlayerPreThink () { if(self.vehicle) vehicles_exit(VHEF_RELEASE); - self.event_damage(self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, self.origin, '0 0 0'); + self.event_damage(self, self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, self.origin, '0 0 0'); } else if ( self.revive_progress <= 0 ) Unfreeze(self); diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index 57204e1d4..c6b0359c4 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -157,55 +157,55 @@ void player_anim () animdecide_setimplicitstate(self, (IS_ONGROUND(self))); } -void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); +void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ float take, save; vector v; - Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker); + Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker); // damage resistance (ignore most of the damage from a bullet or similar) damage = max(damage - 5, 1); - v = healtharmor_applydamage(self.armorvalue, autocvar_g_balance_armor_blockpercent, deathtype, damage); + v = healtharmor_applydamage(this.armorvalue, autocvar_g_balance_armor_blockpercent, deathtype, damage); take = v.x; save = v.y; if(sound_allowed(MSG_BROADCAST, attacker)) { if (save > 10) - sound (self, CH_SHOTS, SND_ARMORIMPACT, VOL_BASE, ATTEN_NORM); + sound (this, CH_SHOTS, SND_ARMORIMPACT, VOL_BASE, ATTEN_NORM); else if (take > 30) - sound (self, CH_SHOTS, SND_BODYIMPACT2, VOL_BASE, ATTEN_NORM); + sound (this, CH_SHOTS, SND_BODYIMPACT2, VOL_BASE, ATTEN_NORM); else if (take > 10) - sound (self, CH_SHOTS, SND_BODYIMPACT1, VOL_BASE, ATTEN_NORM); + sound (this, CH_SHOTS, SND_BODYIMPACT1, VOL_BASE, ATTEN_NORM); } if (take > 50) - Violence_GibSplash_At(hitloc, force * -0.1, 3, 1, self, attacker); + Violence_GibSplash_At(hitloc, force * -0.1, 3, 1, this, attacker); if (take > 100) - Violence_GibSplash_At(hitloc, force * -0.2, 3, 1, self, attacker); + Violence_GibSplash_At(hitloc, force * -0.2, 3, 1, this, attacker); - self.armorvalue = self.armorvalue - save; - self.health = self.health - take; + this.armorvalue = this.armorvalue - save; + this.health = this.health - take; // pause regeneration for 5 seconds - self.pauseregen_finished = max(self.pauseregen_finished, time + autocvar_g_balance_pause_health_regen); + this.pauseregen_finished = max(this.pauseregen_finished, time + autocvar_g_balance_pause_health_regen); - self.dmg_save = self.dmg_save + save;//max(save - 10, 0); - self.dmg_take = self.dmg_take + take;//max(take - 10, 0); - self.dmg_inflictor = inflictor; + this.dmg_save = this.dmg_save + save;//max(save - 10, 0); + this.dmg_take = this.dmg_take + take;//max(take - 10, 0); + this.dmg_inflictor = inflictor; - if (self.health <= -autocvar_sv_gibhealth && self.alpha >= 0) + if (this.health <= -autocvar_sv_gibhealth && this.alpha >= 0) { // don't use any animations as a gib - self.frame = 0; + this.frame = 0; // view just above the floor - self.view_ofs = '0 0 4'; + this.view_ofs = '0 0 4'; - Violence_GibSplash(self, 1, 1, attacker); - self.alpha = -1; - self.solid = SOLID_NOT; // restore later - self.takedamage = DAMAGE_NO; // restore later - self.damagedbycontents = false; + Violence_GibSplash(this, 1, 1, attacker); + this.alpha = -1; + this.solid = SOLID_NOT; // restore later + this.takedamage = DAMAGE_NO; // restore later + this.damagedbycontents = false; } } @@ -295,20 +295,20 @@ void calculate_player_respawn_time(entity this) this.respawn_flags = this.respawn_flags | RESPAWN_FORCE; } -void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); +void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ float take, save, dh, da; vector v; float valid_damage_for_weaponstats; float excess; - dh = max(self.health, 0); - da = max(self.armorvalue, 0); + dh = max(this.health, 0); + da = max(this.armorvalue, 0); if(!DEATH_ISSPECIAL(deathtype)) { - damage *= sqrt(bound(1.0, self.cvar_cl_handicap, 100.0)); - if(self != attacker) + damage *= sqrt(bound(1.0, this.cvar_cl_handicap, 100.0)); + if(this != attacker) damage /= sqrt(bound(1.0, attacker.cvar_cl_handicap, 100.0)); } @@ -318,20 +318,20 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp vector ear1, ear2; vector d; float f; - ear1 = self.origin; - ear1_z += 0.125 * self.view_ofs.z + 0.875 * self.maxs.z; // 7/8 + ear1 = this.origin; + ear1_z += 0.125 * this.view_ofs.z + 0.875 * this.maxs.z; // 7/8 ear2 = ear1; - makevectors(self.angles); + makevectors(this.angles); ear1 += v_right * -10; ear2 += v_right * +10; - d = inflictor.origin - self.origin; + d = inflictor.origin - this.origin; if (d) f = (d * v_right) / vlen(d); // this is cos of angle of d and v_right! else f = 0; // Assum ecenter. force = v_right * vlen(force); - Violence_GibSplash_At(ear1, force * -1, 2, bound(0, damage, 25) / 2 * (0.5 - 0.5 * f), self, attacker); - Violence_GibSplash_At(ear2, force, 2, bound(0, damage, 25) / 2 * (0.5 + 0.5 * f), self, attacker); + Violence_GibSplash_At(ear1, force * -1, 2, bound(0, damage, 25) / 2 * (0.5 - 0.5 * f), this, attacker); + Violence_GibSplash_At(ear2, force, 2, bound(0, damage, 25) / 2 * (0.5 + 0.5 * f), this, attacker); if(f > 0) { hitloc = ear1; @@ -344,140 +344,140 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp } } else - Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker); + Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker); - v = healtharmor_applydamage(self.armorvalue, autocvar_g_balance_armor_blockpercent, deathtype, damage); + v = healtharmor_applydamage(this.armorvalue, autocvar_g_balance_armor_blockpercent, deathtype, damage); take = v.x; save = v.y; - if(attacker == self) + if(attacker == this) { - // don't reset pushltime for self damage as it may be an attempt to + // don't reset pushltime for this damage as it may be an attempt to // escape a lava pit or similar - //self.pushltime = 0; - self.istypefrag = 0; + //this.pushltime = 0; + this.istypefrag = 0; } else if(IS_PLAYER(attacker)) { - self.pusher = attacker; - self.pushltime = time + autocvar_g_maxpushtime; - self.istypefrag = self.BUTTON_CHAT; + this.pusher = attacker; + this.pushltime = time + autocvar_g_maxpushtime; + this.istypefrag = this.BUTTON_CHAT; } - else if(time < self.pushltime) + else if(time < this.pushltime) { - attacker = self.pusher; - self.pushltime = max(self.pushltime, time + 0.6); + attacker = this.pusher; + this.pushltime = max(this.pushltime, time + 0.6); } else { - self.pushltime = 0; - self.istypefrag = 0; + this.pushltime = 0; + this.istypefrag = 0; } frag_damage = damage; - MUTATOR_CALLHOOK(PlayerDamage_SplitHealthArmor, inflictor, attacker, self, force, take, save); - take = bound(0, damage_take, self.health); - save = bound(0, damage_save, self.armorvalue); + MUTATOR_CALLHOOK(PlayerDamage_SplitHealthArmor, inflictor, attacker, this, force, take, save); + take = bound(0, damage_take, this.health); + save = bound(0, damage_save, this.armorvalue); excess = max(0, damage - take - save); if(sound_allowed(MSG_BROADCAST, attacker)) { if (save > 10) - sound (self, CH_SHOTS, SND_ARMORIMPACT, VOL_BASE, ATTEN_NORM); + sound (this, CH_SHOTS, SND_ARMORIMPACT, VOL_BASE, ATTEN_NORM); else if (take > 30) - sound (self, CH_SHOTS, SND_BODYIMPACT2, VOL_BASE, ATTEN_NORM); + sound (this, CH_SHOTS, SND_BODYIMPACT2, VOL_BASE, ATTEN_NORM); else if (take > 10) - sound (self, CH_SHOTS, SND_BODYIMPACT1, VOL_BASE, ATTEN_NORM); // FIXME possibly remove them? + sound (this, CH_SHOTS, SND_BODYIMPACT1, VOL_BASE, ATTEN_NORM); // FIXME possibly remove them? } if (take > 50) - Violence_GibSplash_At(hitloc, force * -0.1, 3, 1, self, attacker); + Violence_GibSplash_At(hitloc, force * -0.1, 3, 1, this, attacker); if (take > 100) - Violence_GibSplash_At(hitloc, force * -0.2, 3, 1, self, attacker); + Violence_GibSplash_At(hitloc, force * -0.2, 3, 1, this, attacker); - if (time >= self.spawnshieldtime) + if (time >= this.spawnshieldtime) { - if (!(self.flags & FL_GODMODE)) + if (!(this.flags & FL_GODMODE)) { - self.armorvalue = self.armorvalue - save; - self.health = self.health - take; + this.armorvalue = this.armorvalue - save; + this.health = this.health - take; // pause regeneration for 5 seconds if(take) - self.pauseregen_finished = max(self.pauseregen_finished, time + autocvar_g_balance_pause_health_regen); + this.pauseregen_finished = max(this.pauseregen_finished, time + autocvar_g_balance_pause_health_regen); - if (time > self.pain_finished) //Don't switch pain sequences like crazy + if (time > this.pain_finished) //Don't switch pain sequences like crazy { - self.pain_finished = time + 0.5; //Supajoe + this.pain_finished = time + 0.5; //Supajoe if(autocvar_sv_gentle < 1) { - if(self.classname != "body") // pain anim is BORKED on our ZYMs, FIXME remove this once we have good models + if(this.classname != "body") // pain anim is BORKED on our ZYMs, FIXME remove this once we have good models { - if (!self.animstate_override) + if (!this.animstate_override) { if (random() > 0.5) - animdecide_setaction(self, ANIMACTION_PAIN1, true); + animdecide_setaction(this, ANIMACTION_PAIN1, true); else - animdecide_setaction(self, ANIMACTION_PAIN2, true); + animdecide_setaction(this, ANIMACTION_PAIN2, true); } } if(sound_allowed(MSG_BROADCAST, attacker)) - if((self.health < 2 * WEP_CVAR_PRI(blaster, damage) * autocvar_g_balance_selfdamagepercent + 1) || !(DEATH_WEAPONOF(deathtype).spawnflags & WEP_FLAG_CANCLIMB) || attacker != self) // WEAPONTODO: create separate limit for pain notification with laser - if(self.health > 1) + if((this.health < 2 * WEP_CVAR_PRI(blaster, damage) * autocvar_g_balance_selfdamagepercent + 1) || !(DEATH_WEAPONOF(deathtype).spawnflags & WEP_FLAG_CANCLIMB) || attacker != this) // WEAPONTODO: create separate limit for pain notification with laser + if(this.health > 1) // exclude pain sounds for laserjumps as long as you aren't REALLY low on health and would die of the next two { if(deathtype == DEATH_FALL.m_id) - PlayerSound(self, playersound_fall, CH_PAIN, VOICETYPE_PLAYERSOUND); - else if(self.health > 75) // TODO make a "gentle" version? - PlayerSound(self, playersound_pain100, CH_PAIN, VOICETYPE_PLAYERSOUND); - else if(self.health > 50) - PlayerSound(self, playersound_pain75, CH_PAIN, VOICETYPE_PLAYERSOUND); - else if(self.health > 25) - PlayerSound(self, playersound_pain50, CH_PAIN, VOICETYPE_PLAYERSOUND); + PlayerSound(this, playersound_fall, CH_PAIN, VOICETYPE_PLAYERSOUND); + else if(this.health > 75) // TODO make a "gentle" version? + PlayerSound(this, playersound_pain100, CH_PAIN, VOICETYPE_PLAYERSOUND); + else if(this.health > 50) + PlayerSound(this, playersound_pain75, CH_PAIN, VOICETYPE_PLAYERSOUND); + else if(this.health > 25) + PlayerSound(this, playersound_pain50, CH_PAIN, VOICETYPE_PLAYERSOUND); else - PlayerSound(self, playersound_pain25, CH_PAIN, VOICETYPE_PLAYERSOUND); + PlayerSound(this, playersound_pain25, CH_PAIN, VOICETYPE_PLAYERSOUND); } } } // throw off bot aim temporarily float shake; - if(IS_BOT_CLIENT(self) && self.health >= 1) + if(IS_BOT_CLIENT(this) && this.health >= 1) { shake = damage * 5 / (bound(0,skill,100) + 1); - self.v_angle_x = self.v_angle.x + (random() * 2 - 1) * shake; - self.v_angle_y = self.v_angle.y + (random() * 2 - 1) * shake; - self.v_angle_x = bound(-90, self.v_angle.x, 90); + this.v_angle_x = this.v_angle.x + (random() * 2 - 1) * shake; + this.v_angle_y = this.v_angle.y + (random() * 2 - 1) * shake; + this.v_angle_x = bound(-90, this.v_angle.x, 90); } } else - self.max_armorvalue += (save + take); + this.max_armorvalue += (save + take); } - self.dmg_save = self.dmg_save + save;//max(save - 10, 0); - self.dmg_take = self.dmg_take + take;//max(take - 10, 0); - self.dmg_inflictor = inflictor; + this.dmg_save = this.dmg_save + save;//max(save - 10, 0); + this.dmg_take = this.dmg_take + take;//max(take - 10, 0); + this.dmg_inflictor = inflictor; - if (self != attacker) { + if (this != attacker) { float realdmg = damage - excess; if (IS_PLAYER(attacker)) { PlayerScore_Add(attacker, SP_DMG, realdmg); } - if (IS_PLAYER(self)) { - PlayerScore_Add(self, SP_DMGTAKEN, realdmg); + if (IS_PLAYER(this)) { + PlayerScore_Add(this, SP_DMGTAKEN, realdmg); } } bool abot = (IS_BOT_CLIENT(attacker)); - bool vbot = (IS_BOT_CLIENT(self)); + bool vbot = (IS_BOT_CLIENT(this)); valid_damage_for_weaponstats = 0; Weapon awep = WEP_Null; - if(vbot || IS_REAL_CLIENT(self)) + if(vbot || IS_REAL_CLIENT(this)) if(abot || IS_REAL_CLIENT(attacker)) - if(attacker && self != attacker) - if(DIFF_TEAM(self, attacker)) + if(attacker && this != attacker) + if(DIFF_TEAM(this, attacker)) { if(DEATH_ISSPECIAL(deathtype)) awep = PS(attacker).m_weapon; @@ -488,150 +488,150 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp if(valid_damage_for_weaponstats) { - dh = dh - max(self.health, 0); - da = da - max(self.armorvalue, 0); - WeaponStats_LogDamage(awep.m_id, abot, PS(self).m_weapon.m_id, vbot, dh + da); - MUTATOR_CALLHOOK(PlayerDamaged, attacker, self, dh, da, hitloc, deathtype); + dh = dh - max(this.health, 0); + da = da - max(this.armorvalue, 0); + WeaponStats_LogDamage(awep.m_id, abot, PS(this).m_weapon.m_id, vbot, dh + da); + MUTATOR_CALLHOOK(PlayerDamaged, attacker, this, dh, da, hitloc, deathtype); } - if (self.health < 1) + if (this.health < 1) { float defer_ClientKill_Now_TeamChange; defer_ClientKill_Now_TeamChange = false; - if(self.alivetime) + if(this.alivetime) { - PS_GR_P_ADDVAL(self, PLAYERSTATS_ALIVETIME, time - self.alivetime); - self.alivetime = 0; + PS_GR_P_ADDVAL(this, PLAYERSTATS_ALIVETIME, time - this.alivetime); + this.alivetime = 0; } if(valid_damage_for_weaponstats) - WeaponStats_LogKill(awep.m_id, abot, PS(self).m_weapon.m_id, vbot); + WeaponStats_LogKill(awep.m_id, abot, PS(this).m_weapon.m_id, vbot); if(autocvar_sv_gentle < 1) // TODO make a "gentle" version? if(sound_allowed(MSG_BROADCAST, attacker)) { if(deathtype == DEATH_DROWN.m_id) - PlayerSound(self, playersound_drown, CH_PAIN, VOICETYPE_PLAYERSOUND); + PlayerSound(this, playersound_drown, CH_PAIN, VOICETYPE_PLAYERSOUND); else - PlayerSound(self, playersound_death, CH_PAIN, VOICETYPE_PLAYERSOUND); + PlayerSound(this, playersound_death, CH_PAIN, VOICETYPE_PLAYERSOUND); } // get rid of kill indicator - if(self.killindicator) + if(this.killindicator) { - remove(self.killindicator); - self.killindicator = world; - if(self.killindicator_teamchange) + remove(this.killindicator); + this.killindicator = world; + if(this.killindicator_teamchange) defer_ClientKill_Now_TeamChange = true; - if(self.classname == "body") + if(this.classname == "body") if(deathtype == DEATH_KILL.m_id) { // for the lemmings fans, a small harmless explosion - Send_Effect(EFFECT_ROCKET_EXPLODE, self.origin, '0 0 0', 1); + Send_Effect(EFFECT_ROCKET_EXPLODE, this.origin, '0 0 0', 1); } } // print an obituary message - if(self.classname != "body") - Obituary (attacker, inflictor, self, deathtype); + if(this.classname != "body") + Obituary (attacker, inflictor, this, deathtype); // increment frag counter for used weapon type Weapon w = DEATH_WEAPONOF(deathtype); if(w != WEP_Null) - if(accuracy_isgooddamage(attacker, self)) + if(accuracy_isgooddamage(attacker, this)) attacker.accuracy.(accuracy_frags[w.m_id-1]) += 1; - MUTATOR_CALLHOOK(PlayerDies, inflictor, attacker, self, deathtype); + MUTATOR_CALLHOOK(PlayerDies, inflictor, attacker, this, deathtype); excess = frag_damage; - Weapon wep = PS(self).m_weapon; - wep.wr_playerdeath(wep); + Weapon wep = PS(this).m_weapon; + WITH(entity, self, this, wep.wr_playerdeath(wep)); - RemoveGrapplingHook(self); + RemoveGrapplingHook(this); - Portal_ClearAllLater(self); + Portal_ClearAllLater(this); - self.fixangle = true; + this.fixangle = true; if(defer_ClientKill_Now_TeamChange) - ClientKill_Now_TeamChange(); // can turn player into spectator + ClientKill_Now_TeamChange(this); // can turn player into spectator // player could have been miraculously resuscitated ;) // e.g. players in freezetag get frozen, they don't really die - if(self.health >= 1 || !(IS_PLAYER(self) || self.classname == "body")) + if(this.health >= 1 || !(IS_PLAYER(this) || this.classname == "body")) return; // when we get here, player actually dies - Unfreeze(self); // remove any icy remains - self.health = 0; // Unfreeze resets health, so we need to set it back + Unfreeze(this); // remove any icy remains + this.health = 0; // Unfreeze resets health, so we need to set it back // clear waypoints - WaypointSprite_PlayerDead(); + WaypointSprite_PlayerDead(this); // throw a weapon - SpawnThrownWeapon (self.origin + (self.mins + self.maxs) * 0.5, PS(self).m_switchweapon.m_id); + SpawnThrownWeapon(this, this.origin + (this.mins + this.maxs) * 0.5, PS(this).m_switchweapon.m_id); // become fully visible - self.alpha = default_player_alpha; + this.alpha = default_player_alpha; // make the corpse upright (not tilted) - self.angles_x = 0; - self.angles_z = 0; + this.angles_x = 0; + this.angles_z = 0; // don't spin - self.avelocity = '0 0 0'; + this.avelocity = '0 0 0'; // view from the floor - self.view_ofs = '0 0 -8'; + this.view_ofs = '0 0 -8'; // toss the corpse - self.movetype = MOVETYPE_TOSS; + this.movetype = MOVETYPE_TOSS; // shootable corpse - self.solid = SOLID_CORPSE; - self.ballistics_density = autocvar_g_ballistics_density_corpse; + this.solid = SOLID_CORPSE; + this.ballistics_density = autocvar_g_ballistics_density_corpse; // don't stick to the floor - UNSET_ONGROUND(self); + UNSET_ONGROUND(this); // dying animation - self.deadflag = DEAD_DYING; + this.deadflag = DEAD_DYING; // when to allow respawn calculate_player_respawn_time(this); - self.death_time = time; + this.death_time = time; if (random() < 0.5) - animdecide_setstate(self, self.anim_state | ANIMSTATE_DEAD1, true); + animdecide_setstate(this, this.anim_state | ANIMSTATE_DEAD1, true); else - animdecide_setstate(self, self.anim_state | ANIMSTATE_DEAD2, true); - if (self.maxs.z > 5) + animdecide_setstate(this, this.anim_state | ANIMSTATE_DEAD2, true); + if (this.maxs.z > 5) { - self.maxs_z = 5; - setsize(self, self.mins, self.maxs); + this.maxs_z = 5; + setsize(this, this.mins, this.maxs); } // set damage function to corpse damage - self.event_damage = PlayerCorpseDamage; + this.event_damage = PlayerCorpseDamage; // call the corpse damage function just in case it wants to gib - self.event_damage(inflictor, attacker, excess, deathtype, hitloc, force); + this.event_damage(this, inflictor, attacker, excess, deathtype, hitloc, force); // set up to fade out later - SUB_SetFade (self, time + 6 + random (), 1); + SUB_SetFade (this, time + 6 + random (), 1); // reset body think wrapper broken by SUB_SetFade - if(self.classname == "body" && self.think != CopyBody_Think) { - self.CopyBody_think = self.think; - self.CopyBody_nextthink = self.nextthink; - self.think = CopyBody_Think; - self.nextthink = time; + if(this.classname == "body" && this.think != CopyBody_Think) { + this.CopyBody_think = this.think; + this.CopyBody_nextthink = this.nextthink; + this.think = CopyBody_Think; + this.nextthink = time; } - if(autocvar_sv_gentle > 0 || autocvar_ekg || self.classname == "body") { + if(autocvar_sv_gentle > 0 || autocvar_ekg || this.classname == "body") { // remove corpse // clones don't run any animation code any more, so we must gib them when they die :( - PlayerCorpseDamage (inflictor, attacker, autocvar_sv_gibhealth+1.0, deathtype, hitloc, force); + PlayerCorpseDamage(this, inflictor, attacker, autocvar_sv_gibhealth+1.0, deathtype, hitloc, force); } // reset fields the weapons may use just in case FOREACH(Weapons, it != WEP_Null, LAMBDA( - it.wr_resetplayer(it); + WITH(entity, self, this, it.wr_resetplayer(it)); for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { - ATTACK_FINISHED_FOR(self, it.m_id, slot) = 0; + ATTACK_FINISHED_FOR(this, it.m_id, slot) = 0; } )); } diff --git a/qcsrc/server/cl_player.qh b/qcsrc/server/cl_player.qh index b71a4e2d8..5ffd93c0b 100644 --- a/qcsrc/server/cl_player.qh +++ b/qcsrc/server/cl_player.qh @@ -14,7 +14,7 @@ void player_setupanimsformodel(); void player_anim(); -void PlayerCorpseDamage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force); +void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force); // g__str: // If 0, default is used. @@ -29,11 +29,11 @@ void PlayerCorpseDamage(entity inflictor, entity attacker, float damage, int dea void calculate_player_respawn_time(entity this); -void ClientKill_Now_TeamChange(); +void ClientKill_Now_TeamChange(entity this); void MoveToTeam(entity client, float team_colour, float type); -void PlayerDamage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force); +void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force); /** to be used by `prvm_edictset server playernumber muted 1` */ .float muted; diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 6fa9b03f6..dd47b86a4 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -62,7 +62,7 @@ float server_is_dedicated; // Fields -.void(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) event_damage; +.void(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) event_damage; //.string wad; //.string map; diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 8423032c4..f064e152b 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -862,7 +862,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d // apply damage if (damage != 0 || (self.damageforcescale && vlen(force))) if (self.event_damage) - self.event_damage (inflictor, attacker, damage, deathtype, hitloc, force); + self.event_damage (self, inflictor, attacker, damage, deathtype, hitloc, force); setself(this); // apply mirror damage if any diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc index e6c583baa..4a3277928 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -317,25 +317,25 @@ void GrapplingHookTouch () //self.realowner.disableclientprediction = true; } -void GrapplingHook_Damage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); - if(self.health <= 0) +void GrapplingHook_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + if(this.health <= 0) return; - if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions + if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions return; // g_balance_projectiledamage says to halt - self.health = self.health - damage; + this.health = this.health - damage; - if (self.health <= 0) + if (this.health <= 0) { - if(attacker != self.realowner) + if(attacker != this.realowner) { - self.realowner.pusher = attacker; - self.realowner.pushltime = time + autocvar_g_maxpushtime; - self.realowner.istypefrag = self.realowner.BUTTON_CHAT; + this.realowner.pusher = attacker; + this.realowner.pushltime = time + autocvar_g_maxpushtime; + this.realowner.istypefrag = this.realowner.BUTTON_CHAT; } - RemoveGrapplingHook(self.realowner); + RemoveGrapplingHook(this.realowner); } } diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index 93b87ad97..00d2716e4 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -222,6 +222,7 @@ MUTATOR_HOOKABLE(MonsterSpawn, EV_MonsterSpawn); /** called when a monster dies */ #define EV_MonsterDies(i, o) \ + /**/ i(entity, frag_target) \ /**/ i(entity, frag_attacker) \ /**/ MUTATOR_HOOKABLE(MonsterDies, EV_MonsterDies); diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qc b/qcsrc/server/mutators/mutator/gamemode_ctf.qc index 589e172dd..ab7f5760d 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qc @@ -998,26 +998,26 @@ void ctf_CheckStalemate() } } -void ctf_FlagDamage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); +void ctf_FlagDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ if(ITEM_DAMAGE_NEEDKILL(deathtype)) { if(autocvar_g_ctf_flag_return_damage_delay) { - self.ctf_flagdamaged = true; + this.ctf_flagdamaged = true; } else { - self.health = 0; - ctf_CheckFlagReturn(self, RETURN_NEEDKILL); + this.health = 0; + ctf_CheckFlagReturn(this, RETURN_NEEDKILL); } return; } if(autocvar_g_ctf_flag_return_damage) { // reduce health and check if it should be returned - self.health = self.health - damage; - ctf_CheckFlagReturn(self, RETURN_DAMAGE); + this.health = this.health - damage; + ctf_CheckFlagReturn(this, RETURN_DAMAGE); return; } } diff --git a/qcsrc/server/mutators/mutator/gamemode_invasion.qc b/qcsrc/server/mutators/mutator/gamemode_invasion.qc index cd18a5176..b7730592c 100644 --- a/qcsrc/server/mutators/mutator/gamemode_invasion.qc +++ b/qcsrc/server/mutators/mutator/gamemode_invasion.qc @@ -329,15 +329,15 @@ void Invasion_RoundStart() } MUTATOR_HOOKFUNCTION(inv, MonsterDies) -{SELFPARAM(); - if(!(self.spawnflags & MONSTERFLAG_RESPAWNED)) +{ + if(!(frag_target.spawnflags & MONSTERFLAG_RESPAWNED)) { inv_numkilled += 1; inv_maxcurrent -= 1; - if(teamplay) { inv_monsters_perteam[self.team] -= 1; } + if(teamplay) { inv_monsters_perteam[frag_target.team] -= 1; } if(IS_PLAYER(frag_attacker)) - if(SAME_TEAM(frag_attacker, self)) // in non-teamplay modes, same team = same player, so this works + if(SAME_TEAM(frag_attacker, frag_target)) // in non-teamplay modes, same team = same player, so this works PlayerScore_Add(frag_attacker, SP_KILLS, -1); else { diff --git a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc index c6b9b4c15..09a029984 100644 --- a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc @@ -471,9 +471,9 @@ void kh_Key_AssignTo(entity key, entity player) // runs every time a key is pic } } -void kh_Key_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); - if(self.owner) +void kh_Key_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + if(this.owner) return; if(ITEM_DAMAGE_NEEDKILL(deathtype)) { @@ -484,9 +484,9 @@ void kh_Key_Damage(entity inflictor, entity attacker, float damage, int deathtyp } if(vlen(force) <= 0) return; - if(time > self.pushltime) + if(time > this.pushltime) if(IS_PLAYER(attacker)) - self.team = attacker.team; + this.team = attacker.team; } void kh_Key_Collect(entity key, entity player) //a player picks up a dropped key diff --git a/qcsrc/server/portals.qc b/qcsrc/server/portals.qc index 1b09ac450..361abcd11 100644 --- a/qcsrc/server/portals.qc +++ b/qcsrc/server/portals.qc @@ -428,16 +428,16 @@ void Portal_Remove(entity portal, float killed) } } -void Portal_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); +void Portal_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ if(deathtype == DEATH_TELEFRAG.m_id) return; - if(attacker != self.aiment) - if(IS_INDEPENDENT_PLAYER(attacker) || IS_INDEPENDENT_PLAYER(self.aiment)) + if(attacker != this.aiment) + if(IS_INDEPENDENT_PLAYER(attacker) || IS_INDEPENDENT_PLAYER(this.aiment)) return; - self.health -= damage; - if(self.health < 0) - Portal_Remove(self, 1); + this.health -= damage; + if(this.health < 0) + Portal_Remove(this, 1); } void Portal_Think_TryTeleportPlayer(entity e, vector g) diff --git a/qcsrc/server/weapons/throwing.qc b/qcsrc/server/weapons/throwing.qc index 6db0a3d02..e36825e48 100644 --- a/qcsrc/server/weapons/throwing.qc +++ b/qcsrc/server/weapons/throwing.qc @@ -190,9 +190,9 @@ void W_ThrowWeapon(vector velo, vector delta, float doreduce) Send_Notification(NOTIF_ONE, self, MSG_MULTI, ITEM_WEAPON_DROP, a, w.m_id); } -void SpawnThrownWeapon(vector org, float w) -{SELFPARAM(); - if(self.weapons & WepSet_FromWeapon(PS(self).m_weapon)) - if(W_IsWeaponThrowable(PS(self).m_weapon.m_id)) - W_ThrowNewWeapon(self, PS(self).m_weapon.m_id, false, org, randomvec() * 125 + '0 0 200'); +void SpawnThrownWeapon(entity this, vector org, float w) +{ + if(this.weapons & WepSet_FromWeapon(PS(this).m_weapon)) + if(W_IsWeaponThrowable(PS(this).m_weapon.m_id)) + W_ThrowNewWeapon(this, PS(this).m_weapon.m_id, false, org, randomvec() * 125 + '0 0 200'); } diff --git a/qcsrc/server/weapons/throwing.qh b/qcsrc/server/weapons/throwing.qh index 4994d02ae..1bf50c14a 100644 --- a/qcsrc/server/weapons/throwing.qh +++ b/qcsrc/server/weapons/throwing.qh @@ -12,5 +12,5 @@ float W_IsWeaponThrowable(float w); // toss current weapon void W_ThrowWeapon(vector velo, vector delta, float doreduce); -void SpawnThrownWeapon(vector org, float w); +void SpawnThrownWeapon(entity this, vector org, float w); #endif -- 2.39.2