From 17308b9ad60c2f773be0de39b811a9752e3037af Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 11 Jun 2016 00:32:38 +1000 Subject: [PATCH] Step 5: complete --- qcsrc/common/effects/qc/casings.qc | 14 +- qcsrc/common/effects/qc/gibs.qc | 12 +- qcsrc/common/effects/qc/lightningarc.qc | 4 +- .../gamemodes/gamemode/nexball/nexball.qc | 80 ++--- .../gamemodes/gamemode/onslaught/onslaught.qc | 56 ++-- .../gamemode/onslaught/sv_controlpoint.qc | 22 +- qcsrc/common/minigames/cl_minigames_hud.qc | 6 +- qcsrc/common/minigames/minigame/pong.qc | 2 +- qcsrc/common/minigames/sv_minigames.qc | 8 +- qcsrc/common/monsters/monster/mage.qc | 2 +- qcsrc/common/monsters/monster/shambler.qc | 2 +- qcsrc/common/monsters/monster/zombie.qc | 14 +- qcsrc/common/mutators/mutator/buffs/buffs.qc | 38 +-- qcsrc/common/mutators/mutator/nix/nix.qc | 2 +- .../mutators/mutator/overkill/overkill.qc | 8 +- qcsrc/common/mutators/mutator/overkill/rpc.qc | 36 +- .../mutator/physical_items/physical_items.qc | 40 +-- .../mutators/mutator/sandbox/sandbox.qc | 12 +- .../mutator/waypoints/waypointsprites.qc | 14 +- qcsrc/common/physics/movelib.qh | 8 +- qcsrc/common/t_items.qc | 236 ++++++------- qcsrc/common/triggers/func/bobbing.qc | 14 +- qcsrc/common/triggers/func/button.qc | 44 +-- qcsrc/common/triggers/func/conveyor.qc | 72 ++-- qcsrc/common/triggers/func/door.qc | 310 +++++++++--------- qcsrc/common/triggers/func/door_rotating.qc | 6 +- qcsrc/common/triggers/func/door_secret.qc | 72 ++-- qcsrc/common/triggers/func/fourier.qc | 18 +- qcsrc/common/triggers/func/ladder.qc | 10 +- qcsrc/common/triggers/func/pendulum.qc | 14 +- qcsrc/common/triggers/func/plat.qc | 54 +-- qcsrc/common/triggers/func/pointparticles.qc | 108 +++--- qcsrc/common/triggers/func/train.qc | 154 ++++----- qcsrc/common/triggers/func/vectormamamam.qc | 10 +- qcsrc/common/triggers/misc/laser.qc | 88 ++--- qcsrc/common/triggers/platforms.qc | 82 ++--- qcsrc/common/triggers/subs.qc | 152 ++++----- qcsrc/common/triggers/target/music.qc | 12 +- qcsrc/common/triggers/target/spawn.qc | 4 +- qcsrc/common/triggers/trigger/gravity.qc | 32 +- qcsrc/common/triggers/trigger/heal.qc | 8 +- qcsrc/common/triggers/trigger/hurt.qc | 16 +- qcsrc/common/triggers/trigger/impulse.qc | 62 ++-- qcsrc/common/triggers/trigger/keylock.qc | 36 +- qcsrc/common/triggers/trigger/multi.qc | 20 +- qcsrc/common/triggers/trigger/secret.qc | 8 +- qcsrc/common/triggers/trigger/swamp.qc | 20 +- qcsrc/common/triggers/trigger/teleport.qc | 14 +- qcsrc/common/triggers/trigger/viewloc.qc | 18 +- qcsrc/common/triggers/triggers.qc | 8 +- qcsrc/common/triggers/triggers.qh | 2 +- qcsrc/common/turrets/checkpoint.qc | 6 +- qcsrc/common/turrets/cl_turrets.qc | 34 +- qcsrc/common/turrets/sv_turrets.qc | 142 ++++---- qcsrc/common/turrets/turret.qh | 2 +- qcsrc/common/turrets/turret/ewheel.qc | 2 +- qcsrc/common/turrets/turret/flac_weapon.qc | 16 +- qcsrc/common/turrets/turret/fusionreactor.qc | 4 +- qcsrc/common/turrets/turret/hellion_weapon.qc | 42 +-- qcsrc/common/turrets/turret/hk_weapon.qc | 108 +++--- qcsrc/common/turrets/turret/phaser_weapon.qc | 36 +- qcsrc/common/turrets/util.qc | 2 +- qcsrc/common/vehicles/sv_vehicles.qc | 160 ++++----- qcsrc/common/vehicles/sv_vehicles.qh | 16 +- qcsrc/common/vehicles/vehicle/bumblebee.qc | 36 +- .../vehicles/vehicle/bumblebee_weapons.qc | 18 +- qcsrc/common/vehicles/vehicle/racer.qc | 2 +- qcsrc/common/vehicles/vehicle/racer_weapon.qc | 76 ++--- qcsrc/common/vehicles/vehicle/raptor.qc | 18 +- .../common/vehicles/vehicle/raptor_weapons.qc | 44 +-- qcsrc/common/vehicles/vehicle/spiderbot.qc | 2 +- .../vehicles/vehicle/spiderbot_weapons.qc | 34 +- qcsrc/common/weapons/weapon/arc.qc | 233 +++++++------ qcsrc/common/weapons/weapon/blaster.qc | 31 +- qcsrc/common/weapons/weapon/crylink.qc | 84 +++-- qcsrc/common/weapons/weapon/devastator.qc | 218 ++++++------ qcsrc/common/weapons/weapon/electro.qc | 113 ++++--- qcsrc/common/weapons/weapon/fireball.qc | 136 ++++---- qcsrc/common/weapons/weapon/hagar.qc | 173 +++++----- qcsrc/common/weapons/weapon/hlac.qc | 50 ++- qcsrc/common/weapons/weapon/hook.qc | 63 ++-- qcsrc/common/weapons/weapon/machinegun.qc | 64 ++-- qcsrc/common/weapons/weapon/minelayer.qc | 206 ++++++------ qcsrc/common/weapons/weapon/mortar.qc | 138 ++++---- qcsrc/common/weapons/weapon/porto.qc | 139 ++++---- qcsrc/common/weapons/weapon/rifle.qc | 57 ++-- qcsrc/common/weapons/weapon/seeker.qc | 200 ++++++----- qcsrc/common/weapons/weapon/shockwave.qc | 107 +++--- qcsrc/common/weapons/weapon/shotgun.qc | 75 ++--- qcsrc/common/weapons/weapon/tuba.qc | 64 ++-- qcsrc/common/weapons/weapon/vaporizer.qc | 102 +++--- qcsrc/common/weapons/weapon/vortex.qc | 38 +-- qcsrc/lib/defer.qh | 2 +- qcsrc/lib/self.qh | 2 +- qcsrc/lib/warpzone/server.qc | 2 +- qcsrc/server/bot/aim.qc | 4 +- qcsrc/server/bot/aim.qh | 4 +- qcsrc/server/cheats.qc | 15 +- qcsrc/server/cl_player.qc | 2 +- qcsrc/server/command/common.qc | 6 +- qcsrc/server/command/radarmap.qc | 132 ++++---- qcsrc/server/command/sv_cmd.qc | 6 +- qcsrc/server/defs.qh | 2 +- qcsrc/server/g_damage.qc | 16 +- qcsrc/server/g_hook.qc | 106 +++--- qcsrc/server/g_lights.qc | 50 +-- qcsrc/server/g_subs.qc | 10 +- qcsrc/server/g_subs.qh | 12 +- qcsrc/server/g_world.qc | 10 +- qcsrc/server/ipban.qc | 4 +- qcsrc/server/item_key.qc | 16 +- qcsrc/server/miscfunctions.qc | 16 +- qcsrc/server/mutators/events.qh | 6 +- .../mutators/mutator/gamemode_assault.qc | 12 +- qcsrc/server/mutators/mutator/gamemode_ctf.qc | 120 +++---- .../mutators/mutator/gamemode_keepaway.qc | 76 ++--- .../mutators/mutator/gamemode_keyhunt.qc | 46 +-- qcsrc/server/pathlib/debug.qc | 12 +- qcsrc/server/race.qc | 12 +- qcsrc/server/weapons/weaponsystem.qc | 2 +- 120 files changed, 2908 insertions(+), 2970 deletions(-) diff --git a/qcsrc/common/effects/qc/casings.qc b/qcsrc/common/effects/qc/casings.qc index 8cb4a2aa1..605d42e67 100644 --- a/qcsrc/common/effects/qc/casings.qc +++ b/qcsrc/common/effects/qc/casings.qc @@ -87,19 +87,19 @@ void Casing_Touch(entity this) { if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) { - Casing_Delete(self); + Casing_Delete(this); return; } - if (!self.silent) + if (!this.silent) if (!trace_ent || trace_ent.solid == SOLID_BSP) { - if(vdist(self.velocity, >, 50)) + if(vdist(this.velocity, >, 50)) { - if (time >= self.nextthink) + if (time >= this.nextthink) { Sound s; - switch (self.state) + switch (this.state) { case 1: s = SND_CASINGS_RANDOM(); @@ -109,12 +109,12 @@ void Casing_Touch(entity this) break; } - sound (self, CH_SHOTS, s, VOL_BASE, ATTEN_LARGE); + sound (this, CH_SHOTS, s, VOL_BASE, ATTEN_LARGE); } } } - self.nextthink = time + 0.2; + this.nextthink = time + 0.2; } void Casing_Damage(entity this, float thisdmg, int hittype, vector org, vector thisforce) diff --git a/qcsrc/common/effects/qc/gibs.qc b/qcsrc/common/effects/qc/gibs.qc index 20b050c3a..bc82b50d0 100644 --- a/qcsrc/common/effects/qc/gibs.qc +++ b/qcsrc/common/effects/qc/gibs.qc @@ -114,7 +114,7 @@ void new_te_bloodshower (int ef, vector org, float explosionspeed, int howmany) void SUB_RemoveOnNoImpact(entity this) { if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) - Gib_Delete(self); + Gib_Delete(this); } void Gib_Touch(entity this) @@ -123,15 +123,15 @@ void Gib_Touch(entity this) if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) { - Gib_Delete(self); + Gib_Delete(this); return; } - if(!self.silent) - sound(self, CH_PAIN, SND_GIB_SPLAT_RANDOM(), VOL_BASE, ATTEN_NORM); - __pointparticles(_particleeffectnum(strcat(species_prefix(self.cnt), "blood")), self.origin + '0 0 1', '0 0 30', 10); + if(!this.silent) + sound(this, CH_PAIN, SND_GIB_SPLAT_RANDOM(), VOL_BASE, ATTEN_NORM); + __pointparticles(_particleeffectnum(strcat(species_prefix(this.cnt), "blood")), this.origin + '0 0 1', '0 0 30', 10); - Gib_Delete(self); + Gib_Delete(this); } void Gib_Draw(entity this) diff --git a/qcsrc/common/effects/qc/lightningarc.qc b/qcsrc/common/effects/qc/lightningarc.qc index 8a16a1dc3..e7fea83db 100644 --- a/qcsrc/common/effects/qc/lightningarc.qc +++ b/qcsrc/common/effects/qc/lightningarc.qc @@ -28,8 +28,8 @@ REGISTER_NET_TEMP(TE_CSQC_ARC) void b_draw() { - //Draw_CylindricLine(self.fx_start, self.fx_end, self.fx_with, self.fx_texture, 0, time * 3, '1 1 1', 0.7, DRAWFLAG_ADDITIVE, view_origin); - Draw_CylindricLine(self.fx_start, self.fx_end, self.fx_with, self.fx_texture, (self.fx_with/256), 0, '1 1 1', 1, DRAWFLAG_ADDITIVE, view_origin); + //Draw_CylindricLine(this.fx_start, this.fx_end, this.fx_with, this.fx_texture, 0, time * 3, '1 1 1', 0.7, DRAWFLAG_ADDITIVE, view_origin); + Draw_CylindricLine(this.fx_start, this.fx_end, this.fx_with, this.fx_texture, (this.fx_with/256), 0, '1 1 1', 1, DRAWFLAG_ADDITIVE, view_origin); } void b_make(vector s,vector e, string t,float l,float z) diff --git a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc index d17ff7f16..5a4f7e3a0 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc @@ -293,46 +293,46 @@ void football_touch(entity this) { if(other.solid == SOLID_BSP) { - if(time > self.lastground + 0.1) + if(time > this.lastground + 0.1) { - _sound(self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); - self.lastground = time; + _sound(this, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM); + this.lastground = time; } - if(vlen(self.velocity) && !self.cnt) - self.nextthink = time + autocvar_g_nexball_delay_idle; + if(this.velocity && !this.cnt) + this.nextthink = time + autocvar_g_nexball_delay_idle; return; } if (!IS_PLAYER(other)) return; if(other.health < 1) return; - if(!self.cnt) - self.nextthink = time + autocvar_g_nexball_delay_idle; + if(!this.cnt) + this.nextthink = time + autocvar_g_nexball_delay_idle; - self.pusher = other; - self.team = other.team; + this.pusher = other; + this.team = other.team; if(autocvar_g_nexball_football_physics == -1) // MrBougo try 1, before decompiling Rev's original { if(vlen(other.velocity)) - self.velocity = other.velocity * 1.5 + '0 0 1' * autocvar_g_nexball_football_boost_up; + this.velocity = other.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); - self.velocity = other.velocity + v_forward * autocvar_g_nexball_football_boost_forward + '0 0 1' * autocvar_g_nexball_football_boost_up; + this.velocity = other.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'); - self.velocity = other.velocity + v_forward * autocvar_g_nexball_football_boost_forward + v_up * autocvar_g_nexball_football_boost_up; + this.velocity = other.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); - self.velocity = other.velocity + v_forward * autocvar_g_nexball_football_boost_forward + v_up * autocvar_g_nexball_football_boost_up; + this.velocity = other.velocity + v_forward * autocvar_g_nexball_football_boost_forward + v_up * autocvar_g_nexball_football_boost_up; } - self.avelocity = -250 * v_forward; // maybe there is a way to make it look better? + this.avelocity = -250 * v_forward; // maybe there is a way to make it look better? } void basketball_touch(entity this) @@ -342,18 +342,18 @@ void basketball_touch(entity this) football_touch(this); return; } - if(!self.cnt && IS_PLAYER(other) && !STAT(FROZEN, other) && !IS_DEAD(other) && (other != self.nb_dropper || time > self.nb_droptime + autocvar_g_nexball_delay_collect)) + 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(other.health <= 0) return; LogNB("caught", other); - GiveBall(other, self); + GiveBall(other, this); } else if(other.solid == SOLID_BSP) { - _sound(self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); - if(vlen(self.velocity) && !self.cnt) - self.nextthink = min(time + autocvar_g_nexball_delay_idle, self.teamtime); + _sound(this, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM); + if(vlen(this.velocity) && !this.cnt) + this.nextthink = min(time + autocvar_g_nexball_delay_idle, this.teamtime); } } @@ -364,14 +364,14 @@ void GoalTouch(entity this) string pname; if(gameover) return; - if((self.spawnflags & GOAL_TOUCHPLAYER) && other.ballcarried) + if((this.spawnflags & GOAL_TOUCHPLAYER) && other.ballcarried) ball = other.ballcarried; else ball = other; if(ball.classname != "nexball_basketball") if(ball.classname != "nexball_football") return; - if((!ball.pusher && self.team != GOAL_OUT) || ball.cnt) + if((!ball.pusher && this.team != GOAL_OUT) || ball.cnt) return; EXACTTRIGGER_TOUCH; @@ -386,13 +386,13 @@ void GoalTouch(entity this) else pname = "Someone (?)"; - if(ball.team == self.team) //owngoal (regular goals) + if(ball.team == this.team) //owngoal (regular goals) { LogNB("owngoal", ball.pusher); bprint("Boo! ", pname, "^7 scored a goal against their own team!\n"); pscore = -1; } - else if(self.team == GOAL_FAULT) + else if(this.team == GOAL_FAULT) { LogNB("fault", ball.pusher); if(nb_teams == 2) @@ -401,10 +401,10 @@ void GoalTouch(entity this) bprint(Team_ColoredFullName(ball.team), " loses a point due to ", pname, "^7's silliness.\n"); pscore = -1; } - else if(self.team == GOAL_OUT) + else if(this.team == GOAL_OUT) { LogNB("out", ball.pusher); - if((self.spawnflags & GOAL_TOUCHPLAYER) && ball.owner) + if((this.spawnflags & GOAL_TOUCHPLAYER) && ball.owner) bprint(pname, "^7 went out of bounds.\n"); else bprint("The ball was returned.\n"); @@ -412,12 +412,12 @@ void GoalTouch(entity this) } else //score { - LogNB(strcat("goal:", ftos(self.team)), ball.pusher); + LogNB(strcat("goal:", ftos(this.team)), ball.pusher); bprint("Goaaaaal! ", pname, "^7 scored a point for the ", Team_ColoredFullName(ball.team), ".\n"); pscore = 1; } - _sound(ball, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NONE); + _sound(ball, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NONE); if(ball.team && pscore) { @@ -443,7 +443,7 @@ void GoalTouch(entity this) setthink(ball, ResetBall); if(ball.classname == "nexball_basketball") settouch(ball, football_touch); // better than func_null: football control until the ball gets reset - ball.nextthink = time + autocvar_g_nexball_delay_goal * (self.team != GOAL_OUT); + ball.nextthink = time + autocvar_g_nexball_delay_goal * (this.team != GOAL_OUT); } //=======================// @@ -613,7 +613,7 @@ float nb_Goal_Customize(entity this) { entity e, wp_owner; e = WaypointSprite_getviewentity(other); - wp_owner = self.owner; + wp_owner = this.owner; if(SAME_TEAM(e, wp_owner)) { return false; } return true; @@ -840,26 +840,26 @@ void W_Nexball_Attack2(entity actor) float ball_customize(entity this) { - if(!self.owner) + if(!this.owner) { - self.effects &= ~EF_FLAME; - self.scale = 1; - setcefc(self, func_null); + this.effects &= ~EF_FLAME; + this.scale = 1; + setcefc(this, func_null); return true; } - if(other == self.owner) + if(other == this.owner) { - self.scale = autocvar_g_nexball_viewmodel_scale; - if(self.enemy) - self.effects |= EF_FLAME; + this.scale = autocvar_g_nexball_viewmodel_scale; + if(this.enemy) + this.effects |= EF_FLAME; else - self.effects &= ~EF_FLAME; + this.effects &= ~EF_FLAME; } else { - self.effects &= ~EF_FLAME; - self.scale = 1; + this.effects &= ~EF_FLAME; + this.scale = 1; } return true; diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc index 005bd0921..ce31eeced 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc @@ -166,28 +166,28 @@ bool ons_CaptureShield_Customize(entity this) { entity e = WaypointSprite_getviewentity(other); - if(!self.enemy.isshielded && (ons_ControlPoint_Attackable(self.enemy, e.team) > 0 || self.enemy.classname != "onslaught_controlpoint")) { return false; } - if(SAME_TEAM(self, e)) { return false; } + if(!this.enemy.isshielded && (ons_ControlPoint_Attackable(this.enemy, e.team) > 0 || this.enemy.classname != "onslaught_controlpoint")) { return false; } + if(SAME_TEAM(this, e)) { return false; } return true; } void ons_CaptureShield_Touch(entity this) { - if(!self.enemy.isshielded && (ons_ControlPoint_Attackable(self.enemy, other.team) > 0 || self.enemy.classname != "onslaught_controlpoint")) { return; } + 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, self)) { return; } + if(SAME_TEAM(other, this)) { return; } - vector mymid = (self.absmin + self.absmax) * 0.5; + vector mymid = (this.absmin + this.absmax) * 0.5; vector othermid = (other.absmin + other.absmax) * 0.5; - Damage(other, self, self, 0, DEATH_HURTTRIGGER.m_id, mymid, normalize(othermid - mymid) * ons_captureshield_force); + Damage(other, this, this, 0, DEATH_HURTTRIGGER.m_id, mymid, normalize(othermid - mymid) * ons_captureshield_force); if(IS_REAL_CLIENT(other)) { play2(other, SND(ONS_DAMAGEBLOCKEDBYSHIELD)); - if(self.enemy.classname == "onslaught_generator") + if(this.enemy.classname == "onslaught_generator") Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_ONS_GENERATOR_SHIELDED); else Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_ONS_CONTROLPOINT_SHIELDED); @@ -378,19 +378,19 @@ bool ons_Link_Send(entity this, entity to, int sendflags) WriteByte(MSG_ENTITY, sendflags); if(sendflags & 1) { - WriteCoord(MSG_ENTITY, self.goalentity.origin_x); - WriteCoord(MSG_ENTITY, self.goalentity.origin_y); - WriteCoord(MSG_ENTITY, self.goalentity.origin_z); + WriteCoord(MSG_ENTITY, this.goalentity.origin_x); + WriteCoord(MSG_ENTITY, this.goalentity.origin_y); + WriteCoord(MSG_ENTITY, this.goalentity.origin_z); } if(sendflags & 2) { - WriteCoord(MSG_ENTITY, self.enemy.origin_x); - WriteCoord(MSG_ENTITY, self.enemy.origin_y); - WriteCoord(MSG_ENTITY, self.enemy.origin_z); + WriteCoord(MSG_ENTITY, this.enemy.origin_x); + WriteCoord(MSG_ENTITY, this.enemy.origin_y); + WriteCoord(MSG_ENTITY, this.enemy.origin_z); } if(sendflags & 4) { - WriteByte(MSG_ENTITY, self.clientcolors); // which is goalentity's color + enemy's color * 16 + WriteByte(MSG_ENTITY, this.clientcolors); // which is goalentity's color + enemy's color * 16 } return true; } @@ -791,8 +791,8 @@ void ons_ControlPoint_Touch(entity this) if(STAT(FROZEN, toucher)) { return; } if(IS_DEAD(toucher)) { return; } - if ( SAME_TEAM(self,toucher) ) - if ( self.iscaptured ) + if ( SAME_TEAM(this,toucher) ) + if ( this.iscaptured ) { if(time <= toucher.teleport_antispam) Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_TELEPORT_ANTISPAM, rint(toucher.teleport_antispam - time)); @@ -800,23 +800,23 @@ void ons_ControlPoint_Touch(entity this) Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_TELEPORT); } - attackable = ons_ControlPoint_Attackable(self, toucher.team); + attackable = ons_ControlPoint_Attackable(this, toucher.team); if(attackable != 2 && attackable != 4) return; // we've verified that this player has a legitimate claim to this point, // so start building the captured point icon (which only captures this // point if it successfully builds without being destroyed first) - ons_ControlPoint_Icon_Spawn(self, toucher); + ons_ControlPoint_Icon_Spawn(this, toucher); - self.ons_toucher = toucher; + this.ons_toucher = toucher; onslaught_updatelinks(); } void ons_ControlPoint_Think(entity this) { - self.nextthink = time + ONS_CP_THINKRATE; - CSQCMODEL_AUTOUPDATE(self); + this.nextthink = time + ONS_CP_THINKRATE; + CSQCMODEL_AUTOUPDATE(this); } void ons_ControlPoint_Reset(entity this) @@ -1070,24 +1070,24 @@ void ons_GeneratorReset(entity this) void ons_DelayedGeneratorSetup(entity this) { // bot waypoints - waypoint_spawnforitem_force(self, self.origin); - self.nearestwaypointtimeout = 0; // activate waypointing again - self.bot_basewaypoint = self.nearestwaypoint; + waypoint_spawnforitem_force(this, this.origin); + this.nearestwaypointtimeout = 0; // activate waypointing again + this.bot_basewaypoint = this.nearestwaypoint; // captureshield setup - ons_CaptureShield_Spawn(self, true); + ons_CaptureShield_Spawn(this, true); onslaught_updatelinks(); - Net_LinkEntity(self, false, 0, generator_send); + Net_LinkEntity(this, false, 0, generator_send); } void onslaught_generator_touch(entity this) { if ( IS_PLAYER(other) ) - if ( SAME_TEAM(self,other) ) - if ( self.iscaptured ) + if ( SAME_TEAM(this,other) ) + if ( this.iscaptured ) { Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_ONS_TELEPORT); } diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qc b/qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qc index aceb3e64e..491acdd00 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qc @@ -8,25 +8,25 @@ bool cpicon_send(entity this, entity to, int sf) WriteByte(MSG_ENTITY, sf); if(sf & CPSF_SETUP) { - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, this.origin_x); + WriteCoord(MSG_ENTITY, this.origin_y); + WriteCoord(MSG_ENTITY, this.origin_z); - WriteByte(MSG_ENTITY, self.health); - WriteByte(MSG_ENTITY, self.max_health); - WriteByte(MSG_ENTITY, self.count); - WriteByte(MSG_ENTITY, self.team); - WriteByte(MSG_ENTITY, self.owner.iscaptured); + WriteByte(MSG_ENTITY, this.health); + WriteByte(MSG_ENTITY, this.max_health); + WriteByte(MSG_ENTITY, this.count); + WriteByte(MSG_ENTITY, this.team); + WriteByte(MSG_ENTITY, this.owner.iscaptured); } if(sf & CPSF_STATUS) { - WriteByte(MSG_ENTITY, self.team); + WriteByte(MSG_ENTITY, this.team); - if(self.health <= 0) + if(this.health <= 0) WriteByte(MSG_ENTITY, 0); else - WriteByte(MSG_ENTITY, ceil((self.health / self.max_health) * 255)); + WriteByte(MSG_ENTITY, ceil((this.health / this.max_health) * 255)); } return true; diff --git a/qcsrc/common/minigames/cl_minigames_hud.qc b/qcsrc/common/minigames/cl_minigames_hud.qc index 1c85489c0..6fc2400d3 100644 --- a/qcsrc/common/minigames/cl_minigames_hud.qc +++ b/qcsrc/common/minigames/cl_minigames_hud.qc @@ -265,7 +265,7 @@ void HUD_MinigameMenu_ClickJoin(entity this, entity actor, entity trigger) /*// Temporary placeholder for un-implemented Click actions void HUD_MinigameMenu_ClickNoop() { - dprint("Placeholder for ",self.message,"\n"); + dprint("Placeholder for ",this.message,"\n"); }*/ // Click action for Quit @@ -287,7 +287,7 @@ void HUD_MinigameMenu_ClickInvite(entity this, entity actor, entity trigger) if ( HUD_MinigameMenu_Click_ExpandCollapse(this) ) { entity e; - entity prev = self; + entity prev = this; for(int i = 0; i < maxclients; ++i) { if ( player_localnum != i && playerslots[i] && entcs_GetName(i) != "" && @@ -295,7 +295,7 @@ void HUD_MinigameMenu_ClickInvite(entity this, entity actor, entity trigger) { e = HUD_MinigameMenu_SpawnSubEntry( strzone(entcs_GetName(i)), HUD_MinigameMenu_ClickInvite_Entry, - self ); + this ); e.flags |= 1; e.netname = strzone(ftos(i+1)); e.origin_x *= 2; diff --git a/qcsrc/common/minigames/minigame/pong.qc b/qcsrc/common/minigames/minigame/pong.qc index 4bcb8c514..ef3c70085 100644 --- a/qcsrc/common/minigames/minigame/pong.qc +++ b/qcsrc/common/minigames/minigame/pong.qc @@ -56,7 +56,7 @@ void pong_ball_throw(entity ball) // Think equivalent of pong_ball_throw, used to delay throws void pong_ball_throwthink(entity this) { - pong_ball_throw(self); + pong_ball_throw(this); } // Moves ball to the center and stops its motion diff --git a/qcsrc/common/minigames/sv_minigames.qc b/qcsrc/common/minigames/sv_minigames.qc index 50dc93010..b9a7b78cf 100644 --- a/qcsrc/common/minigames/sv_minigames.qc +++ b/qcsrc/common/minigames/sv_minigames.qc @@ -50,10 +50,10 @@ void minigame_rmplayer(entity minigame_session, entity player) } -#define FIELD(Flags, Type,Name) if ( sf & (Flags) ) Write##Type(MSG_ENTITY, self.Name); +#define FIELD(Flags, Type,Name) if ( sf & (Flags) ) Write##Type(MSG_ENTITY, this.Name); #define MSLE(Name,Fields) \ - else if ( self.classname == #Name ) { \ - if ( sf & MINIG_SF_CREATE ) WriteString(MSG_ENTITY,self.owner.netname); \ + else if ( this.classname == #Name ) { \ + if ( sf & MINIG_SF_CREATE ) WriteString(MSG_ENTITY,this.owner.netname); \ Fields } // Send an entity to a client @@ -115,7 +115,7 @@ void minigame_resend(entity minigame) bool minigame_CheckSend(entity this) { entity e; - for ( e = self.owner.minigame_players; e != world; e = e.list_next ) + for ( e = this.owner.minigame_players; e != world; e = e.list_next ) if ( e.minigame_players == other ) return true; return false; diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index 2401c9011..247c6b8f4 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -164,7 +164,7 @@ void M_Mage_Attack_Spike_Touch(entity this) { PROJECTILE_TOUCH(this); - M_Mage_Attack_Spike_Explode(self); + 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 e98c372c2..0d134941b 100644 --- a/qcsrc/common/monsters/monster/shambler.qc +++ b/qcsrc/common/monsters/monster/shambler.qc @@ -128,7 +128,7 @@ void M_Shambler_Attack_Lightning_Touch(entity this) { PROJECTILE_TOUCH(this); - self.use(this, NULL, NULL); + this.use(this, NULL, NULL); } void M_Shambler_Attack_Lightning_Think(entity this) diff --git a/qcsrc/common/monsters/monster/zombie.qc b/qcsrc/common/monsters/monster/zombie.qc index 578cf4c59..1eafd4bfd 100644 --- a/qcsrc/common/monsters/monster/zombie.qc +++ b/qcsrc/common/monsters/monster/zombie.qc @@ -77,24 +77,24 @@ const float zombie_anim_spawn = 30; void M_Zombie_Attack_Leap_Touch(entity this) { - if (self.health <= 0) + if (this.health <= 0) return; vector angles_face; if(other.takedamage) { - angles_face = vectoangles(self.moveto - self.origin); + angles_face = vectoangles(this.moveto - this.origin); angles_face = normalize(angles_face) * (autocvar_g_monster_zombie_attack_leap_force); - Damage(other, self, self, (autocvar_g_monster_zombie_attack_leap_damage) * MONSTER_SKILLMOD(self), DEATH_MONSTER_ZOMBIE_JUMP.m_id, other.origin, angles_face); - settouch(self, Monster_Touch); // instantly turn it off to stop damage spam - self.state = 0; + Damage(other, this, this, (autocvar_g_monster_zombie_attack_leap_damage) * MONSTER_SKILLMOD(this), DEATH_MONSTER_ZOMBIE_JUMP.m_id, other.origin, angles_face); + settouch(this, Monster_Touch); // instantly turn it off to stop damage spam + this.state = 0; } if (trace_dphitcontents) { - self.state = 0; - settouch(self, Monster_Touch); + this.state = 0; + settouch(this, Monster_Touch); } } diff --git a/qcsrc/common/mutators/mutator/buffs/buffs.qc b/qcsrc/common/mutators/mutator/buffs/buffs.qc index 87046b96e..e2cb8b318 100644 --- a/qcsrc/common/mutators/mutator/buffs/buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/buffs.qc @@ -98,25 +98,25 @@ bool buffs_BuffModel_Customize(entity this) bool same_team; player = WaypointSprite_getviewentity(other); - myowner = self.owner; + myowner = this.owner; same_team = (SAME_TEAM(player, myowner) || SAME_TEAM(player, myowner)); if(myowner.alpha <= 0.5 && !same_team && myowner.alpha != 0) return false; - if(MUTATOR_CALLHOOK(BuffModel_Customize, self, player)) + if(MUTATOR_CALLHOOK(BuffModel_Customize, this, player)) return false; if(player == myowner || (IS_SPEC(other) && other.enemy == myowner)) { // somewhat hide the model, but keep the glow - self.effects = 0; - self.alpha = -1; + this.effects = 0; + this.alpha = -1; } else { - self.effects = EF_FULLBRIGHT | EF_LOWPRECISION; - self.alpha = 1; + this.effects = EF_FULLBRIGHT | EF_LOWPRECISION; + this.alpha = 1; } return true; } @@ -228,21 +228,21 @@ void buff_Touch(entity this) if(ITEM_TOUCH_NEEDKILL()) { - buff_Respawn(self); + buff_Respawn(this); return; } - if((self.team && DIFF_TEAM(other, self)) + if((this.team && DIFF_TEAM(other, this)) || (STAT(FROZEN, other)) || (other.vehicle) - || (!self.buff_active) + || (!this.buff_active) ) { // can't touch this return; } - if(MUTATOR_CALLHOOK(BuffTouch, self, other)) + if(MUTATOR_CALLHOOK(BuffTouch, this, other)) return; if(!IS_PLAYER(other)) @@ -250,7 +250,7 @@ void buff_Touch(entity this) if (other.buffs) { - if (other.cvar_cl_buffs_autoreplace && other.buffs != self.buffs) + if (other.cvar_cl_buffs_autoreplace && other.buffs != this.buffs) { int buffid = buff_FirstFromFlags(other.buffs).m_id; //Send_Notification(NOTIF_ONE, other, MSG_MULTI, ITEM_BUFF_DROP, other.buffs); @@ -262,16 +262,16 @@ void buff_Touch(entity this) else { return; } // do nothing } - self.owner = other; - self.buff_active = false; - self.lifetime = 0; - int buffid = buff_FirstFromFlags(self.buffs).m_id; + this.owner = other; + 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_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(self), '0 0 0', 1); + 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 |= (self.buffs); + other.buffs |= (this.buffs); } float buff_Available(entity buff) @@ -1036,14 +1036,14 @@ MUTATOR_HOOKFUNCTION(buffs, VehicleExit) MUTATOR_HOOKFUNCTION(buffs, PlayerRegen) {SELFPARAM(); - if(self.buffs & BUFF_MEDIC.m_itemid) + if(this.buffs & BUFF_MEDIC.m_itemid) { regen_mod_rot = autocvar_g_buffs_medic_rot; regen_mod_limit = regen_mod_max = autocvar_g_buffs_medic_max; regen_mod_regen = autocvar_g_buffs_medic_regen; } - if(self.buffs & BUFF_SPEED.m_itemid) + if(this.buffs & BUFF_SPEED.m_itemid) regen_mod_regen = autocvar_g_buffs_speed_regen; } diff --git a/qcsrc/common/mutators/mutator/nix/nix.qc b/qcsrc/common/mutators/mutator/nix/nix.qc index cfc89b057..9c1f4bc7a 100644 --- a/qcsrc/common/mutators/mutator/nix/nix.qc +++ b/qcsrc/common/mutators/mutator/nix/nix.qc @@ -122,7 +122,7 @@ void NIX_GiveCurrentWeapon(entity this) // get weapon info entity e = Weapons_from(nix_weapon); - if(nix_nextchange != self.nix_lastchange_id) // this shall only be called once per round! + if(nix_nextchange != this.nix_lastchange_id) // this shall only be called once per round! { this.ammo_shells = this.ammo_nails = this.ammo_rockets = this.ammo_cells = this.ammo_plasma = this.ammo_fuel = 0; diff --git a/qcsrc/common/mutators/mutator/overkill/overkill.qc b/qcsrc/common/mutators/mutator/overkill/overkill.qc index 19e88cd63..a25dbe3e7 100644 --- a/qcsrc/common/mutators/mutator/overkill/overkill.qc +++ b/qcsrc/common/mutators/mutator/overkill/overkill.qc @@ -167,10 +167,10 @@ MUTATOR_HOOKFUNCTION(ok, MonsterDropItem) MUTATOR_HOOKFUNCTION(ok, PlayerRegen) {SELFPARAM(); // overkill's values are different, so use custom regen - if(!STAT(FROZEN, self)) + if(!STAT(FROZEN, this)) { - self.armorvalue = CalcRotRegen(self.armorvalue, autocvar_g_balance_armor_regenstable, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, 1 * frametime * (time > self.ok_pauseregen_finished), 0, 0, 1, 1 * frametime * (time > self.pauserotarmor_finished), autocvar_g_balance_armor_limit); - self.health = CalcRotRegen(self.health, autocvar_g_balance_health_regenstable, 0, 100, 1 * frametime * (time > self.ok_pauseregen_finished), 200, 0, autocvar_g_balance_health_rotlinear, 1 * frametime * (time > self.pauserothealth_finished), autocvar_g_balance_health_limit); + this.armorvalue = CalcRotRegen(this.armorvalue, autocvar_g_balance_armor_regenstable, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, 1 * frametime * (time > this.ok_pauseregen_finished), 0, 0, 1, 1 * frametime * (time > this.pauserotarmor_finished), autocvar_g_balance_armor_limit); + this.health = CalcRotRegen(this.health, autocvar_g_balance_health_regenstable, 0, 100, 1 * frametime * (time > this.ok_pauseregen_finished), 200, 0, autocvar_g_balance_health_rotlinear, 1 * frametime * (time > this.pauserothealth_finished), autocvar_g_balance_health_limit); float minf, maxf, limitf; @@ -178,7 +178,7 @@ MUTATOR_HOOKFUNCTION(ok, PlayerRegen) minf = autocvar_g_balance_fuel_regenstable; limitf = autocvar_g_balance_fuel_limit; - self.ammo_fuel = CalcRotRegen(self.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > self.pauseregen_finished) * ((self.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > self.pauserotfuel_finished), limitf); + this.ammo_fuel = CalcRotRegen(this.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > this.pauseregen_finished) * ((this.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > this.pauserotfuel_finished), limitf); } return true; // return true anyway, as frozen uses no regen } diff --git a/qcsrc/common/mutators/mutator/overkill/rpc.qc b/qcsrc/common/mutators/mutator/overkill/rpc.qc index e5831a1bd..3fc2683c8 100644 --- a/qcsrc/common/mutators/mutator/overkill/rpc.qc +++ b/qcsrc/common/mutators/mutator/overkill/rpc.qc @@ -52,12 +52,12 @@ spawnfunc(weapon_rpc) { weapon_defaultspawnfunc(this, WEP_RPC); } void W_RocketPropelledChainsaw_Explode(entity this) { - self.event_damage = func_null; - self.takedamage = DAMAGE_NO; + this.event_damage = func_null; + this.takedamage = DAMAGE_NO; - RadiusDamage (self, self.realowner, WEP_CVAR(rpc, damage), WEP_CVAR(rpc, edgedamage), WEP_CVAR(rpc, radius), world, world, WEP_CVAR(rpc, force), self.projectiledeathtype, other); + RadiusDamage (this, this.realowner, WEP_CVAR(rpc, damage), WEP_CVAR(rpc, edgedamage), WEP_CVAR(rpc, radius), world, world, WEP_CVAR(rpc, force), this.projectiledeathtype, other); - remove (self); + remove (this); } void W_RocketPropelledChainsaw_Touch (entity this) @@ -85,29 +85,29 @@ void W_RocketPropelledChainsaw_Damage(entity this, entity inflictor, entity atta void W_RocketPropelledChainsaw_Think(entity this) { - if(self.cnt <= time) + if(this.cnt <= time) { - remove(self); + remove(this); return; } - self.cnt = vlen(self.velocity); - self.wait = self.cnt * sys_frametime; - self.pos1 = normalize(self.velocity); + this.cnt = vlen(this.velocity); + this.wait = this.cnt * sys_frametime; + this.pos1 = normalize(this.velocity); - tracebox(self.origin, self.mins, self.maxs, self.origin + self.pos1 * (2 * self.wait), MOVE_NORMAL, self); + tracebox(this.origin, this.mins, this.maxs, this.origin + this.pos1 * (2 * this.wait), MOVE_NORMAL, this); if(IS_PLAYER(trace_ent)) - Damage (trace_ent, self, self.realowner, WEP_CVAR(rpc, damage2), self.projectiledeathtype, self.origin, normalize(self.origin - other.origin) * WEP_CVAR(rpc, force)); + Damage (trace_ent, this, this.realowner, WEP_CVAR(rpc, damage2), this.projectiledeathtype, this.origin, normalize(this.origin - other.origin) * WEP_CVAR(rpc, force)); - self.velocity = self.pos1 * (self.cnt + (WEP_CVAR(rpc, speedaccel) * sys_frametime)); + this.velocity = this.pos1 * (this.cnt + (WEP_CVAR(rpc, speedaccel) * sys_frametime)); - UpdateCSQCProjectile(self); - self.nextthink = time; + UpdateCSQCProjectile(this); + this.nextthink = time; } void W_RocketPropelledChainsaw_Attack (Weapon thiswep, entity actor) { - entity missile = spawn(); //WarpZone_RefSys_SpawnSameRefSys(self); + entity missile = spawn(); //WarpZone_RefSys_SpawnSameRefSys(actor); entity flash = spawn (); W_DecreaseAmmo(thiswep, actor, WEP_CVAR(rpc, ammo)); @@ -152,8 +152,7 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep, entity actor) METHOD(RocketPropelledChainsaw, wr_aim, void(entity thiswep, entity actor)) { - entity this = actor; - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false); + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false); } METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) @@ -219,12 +218,11 @@ METHOD(RocketPropelledChainsaw, wr_killmessage, Notification(entity thiswep)) METHOD(RocketPropelledChainsaw, wr_impacteffect, void(entity thiswep, entity actor)) { - entity this = actor; vector org2; org2 = w_org + w_backoff * 12; pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); + sound(actor, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); } #endif diff --git a/qcsrc/common/mutators/mutator/physical_items/physical_items.qc b/qcsrc/common/mutators/mutator/physical_items/physical_items.qc index aad331527..fed70ef7d 100644 --- a/qcsrc/common/mutators/mutator/physical_items/physical_items.qc +++ b/qcsrc/common/mutators/mutator/physical_items/physical_items.qc @@ -33,48 +33,48 @@ REGISTER_MUTATOR(physical_items, cvar("g_physical_items")) void physical_item_think(entity this) { - self.nextthink = time; + this.nextthink = time; - self.alpha = self.owner.alpha; // apply fading and ghosting + this.alpha = this.owner.alpha; // apply fading and ghosting - if(!self.cnt) // map item, not dropped + if(!this.cnt) // map item, not dropped { // copy ghost item properties - self.colormap = self.owner.colormap; - self.colormod = self.owner.colormod; - self.glowmod = self.owner.glowmod; + this.colormap = this.owner.colormap; + this.colormod = this.owner.colormod; + this.glowmod = this.owner.glowmod; // if the item is not spawned, make sure the invisible / ghost item returns to its origin and stays there if(autocvar_g_physical_items_reset) { - if(self.owner.wait > time) // awaiting respawn + if(this.owner.wait > time) // awaiting respawn { - setorigin(self, self.spawn_origin); - self.angles = self.spawn_angles; - self.solid = SOLID_NOT; - self.alpha = -1; - self.movetype = MOVETYPE_NONE; + setorigin(this, this.spawn_origin); + this.angles = this.spawn_angles; + this.solid = SOLID_NOT; + this.alpha = -1; + this.movetype = MOVETYPE_NONE; } else { - self.alpha = 1; - self.solid = SOLID_CORPSE; - self.movetype = MOVETYPE_PHYSICS; + this.alpha = 1; + this.solid = SOLID_CORPSE; + this.movetype = MOVETYPE_PHYSICS; } } } - if(!self.owner.modelindex) - remove(self); // the real item is gone, remove this + if(!this.owner.modelindex) + remove(this); // the real item is gone, remove this } void physical_item_touch(entity this) { - if(!self.cnt) // not for dropped items + if(!this.cnt) // not for dropped items if (ITEM_TOUCH_NEEDKILL()) { - 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/sandbox/sandbox.qc b/qcsrc/common/mutators/mutator/sandbox/sandbox.qc index 62b3fb0bc..56d0fb34e 100644 --- a/qcsrc/common/mutators/mutator/sandbox/sandbox.qc +++ b/qcsrc/common/mutators/mutator/sandbox/sandbox.qc @@ -48,15 +48,15 @@ void sandbox_ObjectFunction_Touch(entity this) { // apply material impact effects - if(!self.material) + if(!this.material) return; - if(self.touch_timer > time) + if(this.touch_timer > time) return; // don't execute each frame - self.touch_timer = time + 0.1; + this.touch_timer = time + 0.1; // make particle count and sound volume depend on impact speed float intensity; - intensity = vlen(self.velocity) + vlen(other.velocity); + intensity = vlen(this.velocity) + vlen(other.velocity); if(intensity) // avoid divisions by 0 intensity /= 2; // average the two velocities if (!(intensity >= autocvar_g_sandbox_object_material_velocity_min)) @@ -65,8 +65,8 @@ void sandbox_ObjectFunction_Touch(entity this) intensity -= autocvar_g_sandbox_object_material_velocity_min; // start from minimum velocity, not actual velocity intensity = bound(0, intensity * autocvar_g_sandbox_object_material_velocity_factor, 1); - _sound(self, CH_TRIGGER, strcat("object/impact_", self.material, "_", ftos(ceil(random() * 5)) , ".wav"), VOL_BASE * intensity, ATTEN_NORM); - Send_Effect_(strcat("impact_", self.material), self.origin, '0 0 0', ceil(intensity * 10)); // allow a count from 1 to 10 + _sound(this, CH_TRIGGER, strcat("object/impact_", this.material, "_", ftos(ceil(random() * 5)) , ".wav"), VOL_BASE * intensity, ATTEN_NORM); + Send_Effect_(strcat("impact_", this.material), this.origin, '0 0 0', ceil(intensity * 10)); // allow a count from 1 to 10 } void sandbox_ObjectFunction_Think(entity this) diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc index 56b549e78..d04936a5d 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc @@ -907,18 +907,18 @@ void WaypointSprite_Think(entity this) { bool doremove = false; - if (self.fade_time && time >= self.teleport_time) + if (this.fade_time && time >= this.teleport_time) { doremove = true; } - if (self.exteriormodeltoclient) - WaypointSprite_UpdateOrigin(self, self.exteriormodeltoclient.origin + self.view_ofs); + if (this.exteriormodeltoclient) + WaypointSprite_UpdateOrigin(this, this.exteriormodeltoclient.origin + this.view_ofs); if (doremove) - WaypointSprite_Kill(self); + WaypointSprite_Kill(this); else - self.nextthink = time; // WHY?!? + this.nextthink = time; // WHY?!? } bool WaypointSprite_visible_for_player(entity this, entity player, entity view) @@ -970,10 +970,10 @@ float WaypointSprite_Customize(entity this) // make spectators see what the player would see entity e = WaypointSprite_getviewentity(other); - if (MUTATOR_CALLHOOK(CustomizeWaypoint, self, other)) + if (MUTATOR_CALLHOOK(CustomizeWaypoint, this, other)) return false; - return self.waypointsprite_visible_for_player(self, other, e); + return this.waypointsprite_visible_for_player(this, other, e); } bool WaypointSprite_SendEntity(entity this, entity to, float sendflags); diff --git a/qcsrc/common/physics/movelib.qh b/qcsrc/common/physics/movelib.qh index a64651b30..250c3ba2b 100644 --- a/qcsrc/common/physics/movelib.qh +++ b/qcsrc/common/physics/movelib.qh @@ -6,20 +6,20 @@ /** Simulate drag - self.velocity = movelib_dragvec(self.velocity,0.02,0.5); + this.velocity = movelib_dragvec(this.velocity,0.02,0.5); **/ vector movelib_dragvec(entity this, float drag, float exp_); /** Simulate drag - self.velocity *= movelib_dragflt(somespeed,0.01,0.7); + this.velocity *= movelib_dragflt(somespeed,0.01,0.7); **/ float movelib_dragflt(float fspeed,float drag,float exp_); /** Do a inertia simulation based on velocity. Basicaly, this allows you to simulate loss of steering with higher speed. - self.velocity = movelib_inertmove_byspeed(self.velocity,newvel,1000,0.1,0.9); + this.velocity = movelib_inertmove_byspeed(this.velocity,newvel,1000,0.1,0.9); **/ vector movelib_inertmove_byspeed(entity this, vector vel_new, float vel_max, float newmin, float oldmax); @@ -31,7 +31,7 @@ void movelib_move(entity this, vector force, float max_velocity, float drag, flo /* void movelib_move_simple(vector newdir,float velo,float blendrate) { - self.velocity = self.velocity * (1 - blendrate) + (newdir * blendrate) * velo; + this.velocity = this.velocity * (1 - blendrate) + (newdir * blendrate) * velo; } */ #define movelib_move_simple(e,newdir,velo,blendrate) \ diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 8848aa917..daa0cb246 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -289,7 +289,7 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew) #ifdef SVQC bool ItemSend(entity this, entity to, int sf) { - if(self.gravity) + if(this.gravity) sf |= ISF_DROP; else sf &= ~ISF_DROP; @@ -297,19 +297,19 @@ bool ItemSend(entity this, entity to, int sf) WriteHeader(MSG_ENTITY, ENT_CLIENT_ITEM); WriteByte(MSG_ENTITY, sf); - //WriteByte(MSG_ENTITY, self.cnt); + //WriteByte(MSG_ENTITY, this.cnt); if(sf & ISF_LOCATION) { - WriteCoord(MSG_ENTITY, self.origin.x); - WriteCoord(MSG_ENTITY, self.origin.y); - WriteCoord(MSG_ENTITY, self.origin.z); + WriteCoord(MSG_ENTITY, this.origin.x); + WriteCoord(MSG_ENTITY, this.origin.y); + WriteCoord(MSG_ENTITY, this.origin.z); } if(sf & ISF_ANGLES) { - WriteAngle(MSG_ENTITY, self.angles_x); - WriteAngle(MSG_ENTITY, self.angles_y); - WriteAngle(MSG_ENTITY, self.angles_z); + WriteAngle(MSG_ENTITY, this.angles_x); + WriteAngle(MSG_ENTITY, this.angles_y); + WriteAngle(MSG_ENTITY, this.angles_z); } if(sf & ISF_SIZE) @@ -319,30 +319,30 @@ bool ItemSend(entity this, entity to, int sf) } if(sf & ISF_STATUS) - WriteByte(MSG_ENTITY, self.ItemStatus); + WriteByte(MSG_ENTITY, this.ItemStatus); if(sf & ISF_MODEL) { Pickup p = this.itemdef; WriteByte(MSG_ENTITY, p.instanceOfPowerup || p.instanceOfHealth || p.instanceOfArmor); - WriteShort(MSG_ENTITY, self.fade_end); - WriteShort(MSG_ENTITY, self.fade_start); + WriteShort(MSG_ENTITY, this.fade_end); + WriteShort(MSG_ENTITY, this.fade_start); - if(self.mdl == "") - LOG_TRACE("^1WARNING!^7 self.mdl is unset for item ", self.classname, "exspect a crash just aboute now\n"); + if(this.mdl == "") + LOG_TRACE("^1WARNING!^7 this.mdl is unset for item ", this.classname, "exspect a crash just aboute now\n"); - WriteString(MSG_ENTITY, self.mdl); + WriteString(MSG_ENTITY, this.mdl); } if(sf & ISF_COLORMAP) - WriteShort(MSG_ENTITY, self.colormap); + WriteShort(MSG_ENTITY, this.colormap); if(sf & ISF_DROP) { - WriteCoord(MSG_ENTITY, self.velocity.x); - WriteCoord(MSG_ENTITY, self.velocity.y); - WriteCoord(MSG_ENTITY, self.velocity.z); + WriteCoord(MSG_ENTITY, this.velocity.x); + WriteCoord(MSG_ENTITY, this.velocity.y); + WriteCoord(MSG_ENTITY, this.velocity.z); } return true; @@ -385,22 +385,22 @@ bool have_pickup_item(entity this) /* float Item_Customize() { - if(self.spawnshieldtime) + if(this.spawnshieldtime) return true; - if(self.weapons & ~other.weapons) + if(this.weapons & ~other.weapons) { - self.colormod = '0 0 0'; - self.glowmod = self.colormod; - self.alpha = 0.5 + 0.5 * g_ghost_items; // halfway more alpha + this.colormod = '0 0 0'; + this.glowmod = this.colormod; + this.alpha = 0.5 + 0.5 * g_ghost_items; // halfway more alpha return true; } else { if(g_ghost_items) { - self.colormod = stov(autocvar_g_ghost_items_color); - self.glowmod = self.colormod; - self.alpha = g_ghost_items; + this.colormod = stov(autocvar_g_ghost_items_color); + this.glowmod = this.colormod; + this.alpha = g_ghost_items; return true; } else @@ -473,9 +473,9 @@ void Item_Show (entity e, float mode) void Item_Think(entity this) { - self.nextthink = time; - if(self.origin != self.oldorigin) - ItemUpdate(self); + this.nextthink = time; + if(this.origin != this.oldorigin) + ItemUpdate(this); } bool Item_ItemsTime_SpectatorOnly(GameItem it); @@ -486,96 +486,96 @@ void Item_ItemsTime_SetTimesForAllPlayers(); void Item_Respawn (entity this) { - Item_Show(self, 1); + Item_Show(this, 1); // this is ugly... - if(self.items == ITEM_Strength.m_itemid) - sound (self, CH_TRIGGER, SND_STRENGTH_RESPAWN, VOL_BASE, ATTEN_NORM); // play respawn sound - else if(self.items == ITEM_Shield.m_itemid) - sound (self, CH_TRIGGER, SND_SHIELD_RESPAWN, VOL_BASE, ATTEN_NORM); // play respawn sound + if(this.items == ITEM_Strength.m_itemid) + sound (this, CH_TRIGGER, SND_STRENGTH_RESPAWN, VOL_BASE, ATTEN_NORM); // play respawn sound + else if(this.items == ITEM_Shield.m_itemid) + sound (this, CH_TRIGGER, SND_SHIELD_RESPAWN, VOL_BASE, ATTEN_NORM); // play respawn sound else - sound (self, CH_TRIGGER, SND_ITEMRESPAWN, VOL_BASE, ATTEN_NORM); // play respawn sound - setorigin (self, self.origin); + sound (this, CH_TRIGGER, SND_ITEMRESPAWN, VOL_BASE, ATTEN_NORM); // play respawn sound + setorigin (this, this.origin); - if (Item_ItemsTime_Allow(self.itemdef) || self.weapons & WEPSET_SUPERWEAPONS) + if (Item_ItemsTime_Allow(this.itemdef) || this.weapons & WEPSET_SUPERWEAPONS) { - float t = Item_ItemsTime_UpdateTime(self, 0); - Item_ItemsTime_SetTime(self, t); + float t = Item_ItemsTime_UpdateTime(this, 0); + Item_ItemsTime_SetTime(this, t); Item_ItemsTime_SetTimesForAllPlayers(); } - setthink(self, Item_Think); - self.nextthink = time; + setthink(this, Item_Think); + this.nextthink = time; - //Send_Effect(EFFECT_ITEM_RESPAWN, self.origin + self.mins_z * '0 0 1' + '0 0 48', '0 0 0', 1); - Send_Effect(EFFECT_ITEM_RESPAWN, CENTER_OR_VIEWOFS(self), '0 0 0', 1); + //Send_Effect(EFFECT_ITEM_RESPAWN, this.origin + this.mins_z * '0 0 1' + '0 0 48', '0 0 0', 1); + Send_Effect(EFFECT_ITEM_RESPAWN, CENTER_OR_VIEWOFS(this), '0 0 0', 1); } void Item_RespawnCountdown (entity this) { - if(self.count >= ITEM_RESPAWN_TICKS) + if(this.count >= ITEM_RESPAWN_TICKS) { - if(self.waypointsprite_attached) - WaypointSprite_Kill(self.waypointsprite_attached); - Item_Respawn(self); + if(this.waypointsprite_attached) + WaypointSprite_Kill(this.waypointsprite_attached); + Item_Respawn(this); } else { - self.nextthink = time + 1; - self.count += 1; - if(self.count == 1) + this.nextthink = time + 1; + this.count += 1; + if(this.count == 1) { MUTATOR_CALLHOOK(Item_RespawnCountdown, string_null, '0 0 0'); do { { - entity wi = Weapons_from(self.weapon); + entity wi = Weapons_from(this.weapon); if (wi != WEP_Null) { - entity wp = WaypointSprite_Spawn(WP_Weapon, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_Weapon); + entity wp = WaypointSprite_Spawn(WP_Weapon, 0, 0, this, '0 0 64', world, 0, this, waypointsprite_attached, true, RADARICON_Weapon); wp.wp_extra = wi.m_id; break; } } { - entity ii = self.itemdef; + entity ii = this.itemdef; if (ii != NULL) { - entity wp = WaypointSprite_Spawn(WP_Item, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_Item); + entity wp = WaypointSprite_Spawn(WP_Item, 0, 0, this, '0 0 64', world, 0, this, waypointsprite_attached, true, RADARICON_Item); wp.wp_extra = ii.m_id; break; } } } while (0); - if(self.waypointsprite_attached) + if(this.waypointsprite_attached) { - GameItem def = self.itemdef; + GameItem def = this.itemdef; if (Item_ItemsTime_SpectatorOnly(def)) - WaypointSprite_UpdateRule(self.waypointsprite_attached, 0, SPRITERULE_SPECTATOR); - WaypointSprite_UpdateBuildFinished(self.waypointsprite_attached, time + ITEM_RESPAWN_TICKS); + WaypointSprite_UpdateRule(this.waypointsprite_attached, 0, SPRITERULE_SPECTATOR); + WaypointSprite_UpdateBuildFinished(this.waypointsprite_attached, time + ITEM_RESPAWN_TICKS); } } - if(self.waypointsprite_attached) + if(this.waypointsprite_attached) { FOREACH_CLIENT(IS_REAL_CLIENT(it), { - if(self.waypointsprite_attached.waypointsprite_visible_for_player(self.waypointsprite_attached, it, it)) + if(this.waypointsprite_attached.waypointsprite_visible_for_player(this.waypointsprite_attached, it, it)) { msg_entity = it; soundto(MSG_ONE, this, CH_TRIGGER, SND(ITEMRESPAWNCOUNTDOWN), VOL_BASE, ATTEN_NORM); // play respawn sound } }); - WaypointSprite_Ping(self.waypointsprite_attached); - //WaypointSprite_UpdateHealth(self.waypointsprite_attached, self.count); + WaypointSprite_Ping(this.waypointsprite_attached); + //WaypointSprite_UpdateHealth(this.waypointsprite_attached, this.count); } } } void Item_RespawnThink(entity this) { - self.nextthink = time; - if(self.origin != self.oldorigin) - ItemUpdate(self); + this.nextthink = time; + if(this.origin != this.oldorigin) + ItemUpdate(this); - if(time >= self.wait) - Item_Respawn(self); + if(time >= this.wait) + Item_Respawn(this); } void Item_ScheduleRespawnIn(entity e, float t) @@ -863,12 +863,12 @@ void Item_FindTeam(entity this) { entity e; - if(self.effects & EF_NODRAW) + if(this.effects & EF_NODRAW) { // marker for item team search - LOG_TRACE("Initializing item team ", ftos(self.team), "\n"); + LOG_TRACE("Initializing item team ", ftos(this.team), "\n"); RandomSelection_Init(); - FOREACH_ENTITY_FLOAT(team, self.team, + FOREACH_ENTITY_FLOAT(team, this.team, { if(it.flags & FL_ITEM) if(it.classname != "item_flag_team" && it.classname != "item_key_team") @@ -879,7 +879,7 @@ void Item_FindTeam(entity this) e.state = 0; Item_Show(e, 1); - FOREACH_ENTITY_FLOAT(team, self.team, + FOREACH_ENTITY_FLOAT(team, this.team, { if(it.flags & FL_ITEM) if(it.classname != "item_flag_team" && it.classname != "item_key_team") @@ -894,16 +894,16 @@ void Item_FindTeam(entity this) } }); - Item_Reset(self); + Item_Reset(this); } } // Savage: used for item garbage-collection void RemoveItem(entity this) { - if(wasfreed(self) || !self) { return; } - Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(self), '0 0 0', 1); - remove(self); + if(wasfreed(this) || !this) { return; } + Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(this), '0 0 0', 1); + remove(this); } // pickup evaluation functions @@ -1452,39 +1452,39 @@ spawnfunc(target_items) float n, i; string s; - self.use = target_items_use; - if(!self.strength_finished) - self.strength_finished = autocvar_g_balance_powerup_strength_time; - if(!self.invincible_finished) - self.invincible_finished = autocvar_g_balance_powerup_invincible_time; - if(!self.superweapons_finished) - self.superweapons_finished = autocvar_g_balance_superweapons_time; + this.use = target_items_use; + if(!this.strength_finished) + this.strength_finished = autocvar_g_balance_powerup_strength_time; + if(!this.invincible_finished) + this.invincible_finished = autocvar_g_balance_powerup_invincible_time; + if(!this.superweapons_finished) + this.superweapons_finished = autocvar_g_balance_superweapons_time; - n = tokenize_console(self.netname); + n = tokenize_console(this.netname); if(argv(0) == "give") { - self.netname = substring(self.netname, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)); + this.netname = substring(this.netname, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)); } else { for(i = 0; i < n; ++i) { - if (argv(i) == "unlimited_ammo") self.items |= IT_UNLIMITED_AMMO; - else if(argv(i) == "unlimited_weapon_ammo") self.items |= IT_UNLIMITED_WEAPON_AMMO; - else if(argv(i) == "unlimited_superweapons") self.items |= IT_UNLIMITED_SUPERWEAPONS; - else if(argv(i) == "strength") self.items |= ITEM_Strength.m_itemid; - else if(argv(i) == "invincible") self.items |= ITEM_Shield.m_itemid; - else if(argv(i) == "superweapons") self.items |= IT_SUPERWEAPON; - else if(argv(i) == "jetpack") self.items |= ITEM_Jetpack.m_itemid; - else if(argv(i) == "fuel_regen") self.items |= ITEM_JetpackRegen.m_itemid; + if (argv(i) == "unlimited_ammo") this.items |= IT_UNLIMITED_AMMO; + else if(argv(i) == "unlimited_weapon_ammo") this.items |= IT_UNLIMITED_WEAPON_AMMO; + else if(argv(i) == "unlimited_superweapons") this.items |= IT_UNLIMITED_SUPERWEAPONS; + else if(argv(i) == "strength") this.items |= ITEM_Strength.m_itemid; + else if(argv(i) == "invincible") this.items |= ITEM_Shield.m_itemid; + else if(argv(i) == "superweapons") this.items |= IT_SUPERWEAPON; + else if(argv(i) == "jetpack") this.items |= ITEM_Jetpack.m_itemid; + else if(argv(i) == "fuel_regen") this.items |= ITEM_JetpackRegen.m_itemid; else { FOREACH(Weapons, it != WEP_Null, { s = W_UndeprecateName(argv(i)); if(s == it.netname) { - self.weapons |= (it.m_wepset); - if(self.spawnflags == 0 || self.spawnflags == 2) + this.weapons |= (it.m_wepset); + if(this.spawnflags == 0 || this.spawnflags == 2) it.wr_init(it); break; } @@ -1493,22 +1493,22 @@ spawnfunc(target_items) } string itemprefix, valueprefix; - if(self.spawnflags == 0) + if(this.spawnflags == 0) { itemprefix = ""; valueprefix = ""; } - else if(self.spawnflags == 1) + else if(this.spawnflags == 1) { itemprefix = "max "; valueprefix = "max "; } - else if(self.spawnflags == 2) + else if(this.spawnflags == 2) { itemprefix = "min "; valueprefix = "min "; } - else if(self.spawnflags == 4) + else if(this.spawnflags == 4) { itemprefix = "minus "; valueprefix = "max "; @@ -1519,28 +1519,28 @@ spawnfunc(target_items) itemprefix = valueprefix = string_null; } - self.netname = ""; - self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, boolean(self.items & IT_UNLIMITED_WEAPON_AMMO), "unlimited_weapon_ammo"); - self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, boolean(self.items & IT_UNLIMITED_SUPERWEAPONS), "unlimited_superweapons"); - self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, self.strength_finished * boolean(self.items & ITEM_Strength.m_itemid), "strength"); - self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, self.invincible_finished * boolean(self.items & ITEM_Shield.m_itemid), "invincible"); - self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, self.superweapons_finished * boolean(self.items & IT_SUPERWEAPON), "superweapons"); - self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, boolean(self.items & ITEM_Jetpack.m_itemid), "jetpack"); - self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, boolean(self.items & ITEM_JetpackRegen.m_itemid), "fuel_regen"); - if(self.ammo_shells != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.ammo_shells), "shells"); - if(self.ammo_nails != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.ammo_nails), "nails"); - if(self.ammo_rockets != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.ammo_rockets), "rockets"); - if(self.ammo_cells != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.ammo_cells), "cells"); - if(self.ammo_plasma != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.ammo_plasma), "plasma"); - if(self.ammo_fuel != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.ammo_fuel), "fuel"); - if(self.health != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.health), "health"); - if(self.armorvalue != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.armorvalue), "armor"); - FOREACH(Weapons, it != WEP_Null, self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, !!(self.weapons & (it.m_wepset)), it.netname)); + this.netname = ""; + this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, boolean(this.items & IT_UNLIMITED_WEAPON_AMMO), "unlimited_weapon_ammo"); + this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, boolean(this.items & IT_UNLIMITED_SUPERWEAPONS), "unlimited_superweapons"); + this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, this.strength_finished * boolean(this.items & ITEM_Strength.m_itemid), "strength"); + this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, this.invincible_finished * boolean(this.items & ITEM_Shield.m_itemid), "invincible"); + this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, this.superweapons_finished * boolean(this.items & IT_SUPERWEAPON), "superweapons"); + this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, boolean(this.items & ITEM_Jetpack.m_itemid), "jetpack"); + this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, boolean(this.items & ITEM_JetpackRegen.m_itemid), "fuel_regen"); + if(this.ammo_shells != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.ammo_shells), "shells"); + if(this.ammo_nails != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.ammo_nails), "nails"); + if(this.ammo_rockets != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.ammo_rockets), "rockets"); + if(this.ammo_cells != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.ammo_cells), "cells"); + if(this.ammo_plasma != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.ammo_plasma), "plasma"); + if(this.ammo_fuel != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.ammo_fuel), "fuel"); + if(this.health != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.health), "health"); + if(this.armorvalue != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.armorvalue), "armor"); + FOREACH(Weapons, it != WEP_Null, this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, !!(this.weapons & (it.m_wepset)), it.netname)); } - self.netname = strzone(self.netname); - //print(self.netname, "\n"); + this.netname = strzone(this.netname); + //print(this.netname, "\n"); - n = tokenize_console(self.netname); + n = tokenize_console(this.netname); for(i = 0; i < n; ++i) { FOREACH(Weapons, it != WEP_Null && argv(i) == it.netname, { diff --git a/qcsrc/common/triggers/func/bobbing.qc b/qcsrc/common/triggers/func/bobbing.qc index e03063249..583efbe25 100644 --- a/qcsrc/common/triggers/func/bobbing.qc +++ b/qcsrc/common/triggers/func/bobbing.qc @@ -3,20 +3,20 @@ void func_bobbing_controller_think(entity this) { vector v; - self.nextthink = time + 0.1; + this.nextthink = time + 0.1; - if(self.owner.active != ACTIVE_ACTIVE) + if(this.owner.active != ACTIVE_ACTIVE) { - self.owner.velocity = '0 0 0'; + this.owner.velocity = '0 0 0'; return; } // calculate sinewave using makevectors - makevectors((self.nextthink * self.owner.cnt + self.owner.phase * 360) * '0 1 0'); - v = self.owner.destvec + self.owner.movedir * v_forward_y; - if(self.owner.classname == "func_bobbing") // don't brake stuff if the func_bobbing was killtarget'ed + makevectors((this.nextthink * this.owner.cnt + this.owner.phase * 360) * '0 1 0'); + v = this.owner.destvec + this.owner.movedir * v_forward_y; + if(this.owner.classname == "func_bobbing") // don't brake stuff if the func_bobbing was killtarget'ed // * 10 so it will arrive in 0.1 sec - self.owner.velocity = (v - self.owner.SUB_ORIGIN) * 10; + this.owner.velocity = (v - this.owner.SUB_ORIGIN) * 10; } /*QUAKED spawnfunc_func_bobbing (0 .5 .8) ? X_AXIS Y_AXIS diff --git a/qcsrc/common/triggers/func/button.qc b/qcsrc/common/triggers/func/button.qc index ed972cd9f..8424776ff 100644 --- a/qcsrc/common/triggers/func/button.qc +++ b/qcsrc/common/triggers/func/button.qc @@ -6,25 +6,25 @@ void button_return(entity this); void button_wait(entity this) { - self.state = STATE_TOP; - self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait; - SUB_THINK(self, button_return); - SUB_UseTargets(self, self.enemy, NULL); - self.frame = 1; // use alternate textures + this.state = STATE_TOP; + this.SUB_NEXTTHINK = this.SUB_LTIME + this.wait; + SUB_THINK(this, button_return); + SUB_UseTargets(this, this.enemy, NULL); + this.frame = 1; // use alternate textures } void button_done(entity this) { - self.state = STATE_BOTTOM; + this.state = STATE_BOTTOM; } void button_return(entity this) { - self.state = STATE_DOWN; - SUB_CalcMove (self, self.pos1, TSPEED_LINEAR, self.speed, button_done); - self.frame = 0; // use normal textures - if (self.health) - self.takedamage = DAMAGE_YES; // can be shot again + this.state = STATE_DOWN; + SUB_CalcMove (this, this.pos1, TSPEED_LINEAR, this.speed, button_done); + this.frame = 0; // use normal textures + if (this.health) + this.takedamage = DAMAGE_YES; // can be shot again } @@ -36,17 +36,17 @@ void button_blocked() void button_fire(entity this) { - self.health = self.max_health; - self.takedamage = DAMAGE_NO; // will be reset upon return + this.health = this.max_health; + this.takedamage = DAMAGE_NO; // will be reset upon return - if (self.state == STATE_UP || self.state == STATE_TOP) + if (this.state == STATE_UP || this.state == STATE_TOP) return; - if (self.noise != "") - _sound (self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); + if (this.noise != "") + _sound (this, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM); - self.state = STATE_UP; - SUB_CalcMove (self, self.pos2, TSPEED_LINEAR, self.speed, button_wait); + this.state = STATE_UP; + SUB_CalcMove (this, this.pos2, TSPEED_LINEAR, this.speed, button_wait); } void button_reset(entity this) @@ -74,12 +74,12 @@ void button_touch(entity this) return; if (!other.iscreature) return; - if(other.velocity * self.movedir < 0) + if(other.velocity * this.movedir < 0) return; - self.enemy = other; + this.enemy = other; if (other.owner) - self.enemy = other.owner; - button_fire (self); + this.enemy = other.owner; + button_fire (this); } void button_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) diff --git a/qcsrc/common/triggers/func/conveyor.qc b/qcsrc/common/triggers/func/conveyor.qc index a4be9fe05..e86eefb2c 100644 --- a/qcsrc/common/triggers/func/conveyor.qc +++ b/qcsrc/common/triggers/func/conveyor.qc @@ -4,47 +4,47 @@ void conveyor_think(entity this) { #ifdef CSQC // TODO: check if this is what is causing the glitchiness when switching between them - float dt = time - self.move_time; - self.move_time = time; + float dt = time - this.move_time; + this.move_time = time; if(dt <= 0) { return; } #endif entity e; - // set myself as current conveyor where possible - for(e = world; (e = findentity(e, conveyor, self)); ) + // set mythis as current conveyor where possible + for(e = world; (e = findentity(e, conveyor, this)); ) e.conveyor = world; - if(self.state) + if(this.state) { - for(e = findradius((self.absmin + self.absmax) * 0.5, vlen(self.absmax - self.absmin) * 0.5 + 1); e; e = e.chain) + for(e = findradius((this.absmin + this.absmax) * 0.5, vlen(this.absmax - this.absmin) * 0.5 + 1); e; e = e.chain) if(!e.conveyor.state) if(isPushable(e)) { vector emin = e.absmin; vector emax = e.absmax; - if(self.solid == SOLID_BSP) + if(this.solid == SOLID_BSP) { emin -= '1 1 1'; emax += '1 1 1'; } - if(boxesoverlap(emin, emax, self.absmin, self.absmax)) // quick - if(WarpZoneLib_BoxTouchesBrush(emin, emax, self, e)) // accurate - e.conveyor = self; + if(boxesoverlap(emin, emax, this.absmin, this.absmax)) // quick + if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, e)) // accurate + e.conveyor = this; } - for(e = world; (e = findentity(e, conveyor, self)); ) + for(e = world; (e = findentity(e, conveyor, this)); ) { if(IS_CLIENT(e)) // doing it via velocity has quite some advantages continue; // done in SV_PlayerPhysics continue; - setorigin(e, e.origin + self.movedir * PHYS_INPUT_FRAMETIME); + setorigin(e, e.origin + this.movedir * PHYS_INPUT_FRAMETIME); move_out_of_solid(e); #ifdef SVQC UpdateCSQCProjectile(e); #endif /* // stupid conveyor code - tracebox(e.origin, e.mins, e.maxs, e.origin + self.movedir * sys_frametime, MOVE_NORMAL, e); + tracebox(e.origin, e.mins, e.maxs, e.origin + this.movedir * sys_frametime, MOVE_NORMAL, e); if(trace_fraction > 0) setorigin(e, trace_endpos); */ @@ -52,7 +52,7 @@ void conveyor_think(entity this) } #ifdef SVQC - self.nextthink = time; + this.nextthink = time; #endif } @@ -79,31 +79,31 @@ bool conveyor_send(entity this, entity to, int sf) if(sf & 1) { - WriteByte(MSG_ENTITY, self.warpzone_isboxy); - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); - - WriteCoord(MSG_ENTITY, self.mins_x); - WriteCoord(MSG_ENTITY, self.mins_y); - WriteCoord(MSG_ENTITY, self.mins_z); - WriteCoord(MSG_ENTITY, self.maxs_x); - WriteCoord(MSG_ENTITY, self.maxs_y); - WriteCoord(MSG_ENTITY, self.maxs_z); - - WriteCoord(MSG_ENTITY, self.movedir_x); - WriteCoord(MSG_ENTITY, self.movedir_y); - WriteCoord(MSG_ENTITY, self.movedir_z); - - WriteByte(MSG_ENTITY, self.speed); - WriteByte(MSG_ENTITY, self.state); - - WriteString(MSG_ENTITY, self.targetname); - WriteString(MSG_ENTITY, self.target); + WriteByte(MSG_ENTITY, this.warpzone_isboxy); + WriteCoord(MSG_ENTITY, this.origin_x); + WriteCoord(MSG_ENTITY, this.origin_y); + WriteCoord(MSG_ENTITY, this.origin_z); + + WriteCoord(MSG_ENTITY, this.mins_x); + WriteCoord(MSG_ENTITY, this.mins_y); + WriteCoord(MSG_ENTITY, this.mins_z); + WriteCoord(MSG_ENTITY, this.maxs_x); + WriteCoord(MSG_ENTITY, this.maxs_y); + WriteCoord(MSG_ENTITY, this.maxs_z); + + WriteCoord(MSG_ENTITY, this.movedir_x); + WriteCoord(MSG_ENTITY, this.movedir_y); + WriteCoord(MSG_ENTITY, this.movedir_z); + + WriteByte(MSG_ENTITY, this.speed); + WriteByte(MSG_ENTITY, this.state); + + WriteString(MSG_ENTITY, this.targetname); + WriteString(MSG_ENTITY, this.target); } if(sf & 2) - WriteByte(MSG_ENTITY, self.state); + WriteByte(MSG_ENTITY, this.state); return true; } diff --git a/qcsrc/common/triggers/func/door.qc b/qcsrc/common/triggers/func/door.qc index 580d63a14..248896d8b 100644 --- a/qcsrc/common/triggers/func/door.qc +++ b/qcsrc/common/triggers/func/door.qc @@ -27,7 +27,7 @@ void door_rotating_go_up(entity this); void door_blocked() {SELFPARAM(); - if((self.spawnflags & 8) + if((this.spawnflags & 8) #ifdef SVQC && (other.takedamage != DAMAGE_NO) #elif defined(CSQC) @@ -36,14 +36,14 @@ void door_blocked() ) { // KIll Kill Kill!! #ifdef SVQC - Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); + Damage (other, this, this, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); #endif } else { #ifdef SVQC - if((self.dmg) && (other.takedamage == DAMAGE_YES)) // Shall we bite? - Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); + if((this.dmg) && (other.takedamage == DAMAGE_YES)) // Shall we bite? + Damage (other, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); #endif // don't change direction for dead or dying stuff @@ -53,23 +53,23 @@ void door_blocked() #endif ) { - if (self.wait >= 0) + if (this.wait >= 0) { - if (self.state == STATE_DOWN) - if (self.classname == "door") + if (this.state == STATE_DOWN) + if (this.classname == "door") { - door_go_up (self); + door_go_up (this); } else { - door_rotating_go_up (self); + door_rotating_go_up (this); } else - if (self.classname == "door") + if (this.classname == "door") { - door_go_down (self); + door_go_down (this); } else { - door_rotating_go_down (self); + door_rotating_go_down (this); } } } @@ -77,8 +77,8 @@ void door_blocked() else { //gib dying stuff just to make sure - if((self.dmg) && (other.takedamage != DAMAGE_NO)) // Shall we bite? - Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); + if((this.dmg) && (other.takedamage != DAMAGE_NO)) // Shall we bite? + Damage (other, this, this, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); } #endif } @@ -86,63 +86,63 @@ void door_blocked() void door_hit_top(entity this) { - if (self.noise1 != "") - _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); - self.state = STATE_TOP; - if (self.spawnflags & DOOR_TOGGLE) + if (this.noise1 != "") + _sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM); + this.state = STATE_TOP; + if (this.spawnflags & DOOR_TOGGLE) return; // don't come down automatically - if (self.classname == "door") + if (this.classname == "door") { - SUB_THINK(self, door_go_down); + SUB_THINK(this, door_go_down); } else { - SUB_THINK(self, door_rotating_go_down); + SUB_THINK(this, door_rotating_go_down); } - self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait; + this.SUB_NEXTTHINK = this.SUB_LTIME + this.wait; } void door_hit_bottom(entity this) { - if (self.noise1 != "") - _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); - self.state = STATE_BOTTOM; + if (this.noise1 != "") + _sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM); + this.state = STATE_BOTTOM; } void door_go_down(entity this) { - if (self.noise2 != "") - _sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); - if (self.max_health) + if (this.noise2 != "") + _sound (this, CH_TRIGGER_SINGLE, this.noise2, VOL_BASE, ATTEN_NORM); + if (this.max_health) { - self.takedamage = DAMAGE_YES; - self.health = self.max_health; + this.takedamage = DAMAGE_YES; + this.health = this.max_health; } - self.state = STATE_DOWN; - SUB_CalcMove (self, self.pos1, TSPEED_LINEAR, self.speed, door_hit_bottom); + this.state = STATE_DOWN; + SUB_CalcMove (this, this.pos1, TSPEED_LINEAR, this.speed, door_hit_bottom); } void door_go_up(entity this) { - if (self.state == STATE_UP) + if (this.state == STATE_UP) return; // already going up - if (self.state == STATE_TOP) + if (this.state == STATE_TOP) { // reset top wait time - self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait; + this.SUB_NEXTTHINK = this.SUB_LTIME + this.wait; return; } - if (self.noise2 != "") - _sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); - self.state = STATE_UP; - SUB_CalcMove (self, self.pos2, TSPEED_LINEAR, self.speed, door_hit_top); + if (this.noise2 != "") + _sound (this, CH_TRIGGER_SINGLE, this.noise2, VOL_BASE, ATTEN_NORM); + this.state = STATE_UP; + SUB_CalcMove (this, this.pos2, TSPEED_LINEAR, this.speed, door_hit_top); string oldmessage; - oldmessage = self.message; - self.message = ""; - SUB_UseTargets(self, NULL, NULL); - self.message = oldmessage; + oldmessage = this.message; + this.message = ""; + SUB_UseTargets(this, NULL, NULL); + this.message = oldmessage; } @@ -252,7 +252,7 @@ void door_fire(entity this, entity actor, entity trigger) void door_use(entity this, entity actor, entity trigger) { - //dprint("door_use (model: ");dprint(self.model);dprint(")\n"); + //dprint("door_use (model: ");dprint(this.model);dprint(")\n"); if (this.owner) WITHSELF(this.owner, door_fire(this.owner, actor, trigger)); @@ -293,17 +293,17 @@ void door_touch(entity this) { if (!IS_PLAYER(other)) return; - if (self.owner.door_finished > time) + if (this.owner.door_finished > time) return; - self.owner.door_finished = time + 2; + this.owner.door_finished = time + 2; #ifdef SVQC - if (!(self.owner.dmg) && (self.owner.message != "")) + if (!(this.owner.dmg) && (this.owner.message != "")) { if (IS_CLIENT(other)) - centerprint(other, self.owner.message); - play2(other, self.owner.noise); + centerprint(other, this.owner.message); + play2(other, this.owner.noise); } #endif } @@ -311,36 +311,36 @@ void door_touch(entity this) void door_generic_plat_blocked(entity this) { - if((self.spawnflags & 8) && (other.takedamage != DAMAGE_NO)) { // KIll Kill Kill!! + if((this.spawnflags & 8) && (other.takedamage != DAMAGE_NO)) { // KIll Kill Kill!! #ifdef SVQC - Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); + Damage (other, this, this, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); #endif } else { #ifdef SVQC - if((self.dmg) && (other.takedamage == DAMAGE_YES)) // Shall we bite? - Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); + if((this.dmg) && (other.takedamage == DAMAGE_YES)) // Shall we bite? + Damage (other, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); #endif //Dont chamge direction for dead or dying stuff if(IS_DEAD(other) && (other.takedamage == DAMAGE_NO)) { - if (self.wait >= 0) + if (this.wait >= 0) { - if (self.state == STATE_DOWN) - door_rotating_go_up (self); + if (this.state == STATE_DOWN) + door_rotating_go_up (this); else - door_rotating_go_down (self); + door_rotating_go_down (this); } } #ifdef SVQC else { //gib dying stuff just to make sure - if((self.dmg) && (other.takedamage != DAMAGE_NO)) // Shall we bite? - Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); + if((this.dmg) && (other.takedamage != DAMAGE_NO)) // Shall we bite? + Damage (other, this, this, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); } #endif } @@ -348,61 +348,61 @@ void door_generic_plat_blocked(entity this) void door_rotating_hit_top(entity this) { - if (self.noise1 != "") - _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); - self.state = STATE_TOP; - if (self.spawnflags & DOOR_TOGGLE) + if (this.noise1 != "") + _sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM); + this.state = STATE_TOP; + if (this.spawnflags & DOOR_TOGGLE) return; // don't come down automatically - SUB_THINK(self, door_rotating_go_down); - self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait; + SUB_THINK(this, door_rotating_go_down); + this.SUB_NEXTTHINK = this.SUB_LTIME + this.wait; } void door_rotating_hit_bottom(entity this) { - if (self.noise1 != "") - _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); - if (self.lip==666) // self.lip is used to remember reverse opening direction for door_rotating + if (this.noise1 != "") + _sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM); + if (this.lip==666) // this.lip is used to remember reverse opening direction for door_rotating { - self.pos2 = '0 0 0' - self.pos2; - self.lip = 0; + this.pos2 = '0 0 0' - this.pos2; + this.lip = 0; } - self.state = STATE_BOTTOM; + this.state = STATE_BOTTOM; } void door_rotating_go_down(entity this) { - if (self.noise2 != "") - _sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); - if (self.max_health) + if (this.noise2 != "") + _sound (this, CH_TRIGGER_SINGLE, this.noise2, VOL_BASE, ATTEN_NORM); + if (this.max_health) { - self.takedamage = DAMAGE_YES; - self.health = self.max_health; + this.takedamage = DAMAGE_YES; + this.health = this.max_health; } - self.state = STATE_DOWN; - SUB_CalcAngleMove (self, self.pos1, TSPEED_LINEAR, self.speed, door_rotating_hit_bottom); + this.state = STATE_DOWN; + SUB_CalcAngleMove (this, this.pos1, TSPEED_LINEAR, this.speed, door_rotating_hit_bottom); } void door_rotating_go_up(entity this) { - if (self.state == STATE_UP) + if (this.state == STATE_UP) return; // already going up - if (self.state == STATE_TOP) + if (this.state == STATE_TOP) { // reset top wait time - self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait; + this.SUB_NEXTTHINK = this.SUB_LTIME + this.wait; return; } - if (self.noise2 != "") - _sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); - self.state = STATE_UP; - SUB_CalcAngleMove (self, self.pos2, TSPEED_LINEAR, self.speed, door_rotating_hit_top); + if (this.noise2 != "") + _sound (this, CH_TRIGGER_SINGLE, this.noise2, VOL_BASE, ATTEN_NORM); + this.state = STATE_UP; + SUB_CalcAngleMove (this, this.pos2, TSPEED_LINEAR, this.speed, door_rotating_hit_top); string oldmessage; - oldmessage = self.message; - self.message = ""; - SUB_UseTargets(self, NULL, other); // TODO: is other needed here? - self.message = oldmessage; + oldmessage = this.message; + this.message = ""; + SUB_UseTargets(this, NULL, other); // TODO: is other needed here? + this.message = oldmessage; } @@ -424,14 +424,14 @@ void door_trigger_touch(entity this) #endif return; - if (time < self.door_finished) + if (time < this.door_finished) return; // check if door is locked - if (!door_check_keys(self, other)) + if (!door_check_keys(this, other)) return; - self.door_finished = time + 1; + this.door_finished = time + 1; door_use(this.owner, other, NULL); } @@ -444,7 +444,7 @@ void door_spawnfield(entity this, vector fmins, vector fmaxs) trigger = new(doortriggerfield); trigger.movetype = MOVETYPE_NONE; trigger.solid = SOLID_TRIGGER; - trigger.owner = self; + trigger.owner = this; #ifdef SVQC settouch(trigger, door_trigger_touch); #endif @@ -494,51 +494,51 @@ void LinkDoors(entity this) door_link(); #endif - if (self.enemy) + if (this.enemy) return; // already linked by another door - if (self.spawnflags & 4) + if (this.spawnflags & 4) { - self.owner = self.enemy = self; + this.owner = this.enemy = this; - if (self.health) + if (this.health) return; IFTARGETED return; - if (self.items) + if (this.items) return; - door_spawnfield(self, self.absmin, self.absmax); + door_spawnfield(this, this.absmin, this.absmax); return; // don't want to link this door } - FindConnectedComponent(self, enemy, LinkDoors_nextent, LinkDoors_isconnected, self); + FindConnectedComponent(this, enemy, LinkDoors_nextent, LinkDoors_isconnected, this); // set owner, and make a loop of the chain LOG_TRACE("LinkDoors: linking doors:"); - for(t = self; ; t = t.enemy) + for(t = this; ; t = t.enemy) { LOG_TRACE(" ", etos(t)); - t.owner = self; + t.owner = this; if(t.enemy == world) { - t.enemy = self; + t.enemy = this; break; } } LOG_TRACE("\n"); // collect health, targetname, message, size - cmins = self.absmin; - cmaxs = self.absmax; - for(t = self; ; t = t.enemy) + cmins = this.absmin; + cmaxs = this.absmax; + for(t = this; ; t = t.enemy) { - if(t.health && !self.health) - self.health = t.health; - if((t.targetname != "") && (self.targetname == "")) - self.targetname = t.targetname; - if((t.message != "") && (self.message == "")) - self.message = t.message; + if(t.health && !this.health) + this.health = t.health; + if((t.targetname != "") && (this.targetname == "")) + this.targetname = t.targetname; + if((t.message != "") && (this.message == "")) + this.message = t.message; if (t.absmin_x < cmins_x) cmins_x = t.absmin_x; if (t.absmin_y < cmins_y) @@ -551,31 +551,31 @@ void LinkDoors(entity this) cmaxs_y = t.absmax_y; if (t.absmax_z > cmaxs_z) cmaxs_z = t.absmax_z; - if(t.enemy == self) + if(t.enemy == this) break; } // distribute health, targetname, message - for(t = self; t; t = t.enemy) + for(t = this; t; t = t.enemy) { - t.health = self.health; - t.targetname = self.targetname; - t.message = self.message; - if(t.enemy == self) + t.health = this.health; + t.targetname = this.targetname; + t.message = this.message; + if(t.enemy == this) break; } // shootable, or triggered doors just needed the owner/enemy links, // they don't spawn a field - if (self.health) + if (this.health) return; IFTARGETED return; - if (self.items) + if (this.items) return; - door_spawnfield(self, cmins, cmaxs); + door_spawnfield(this, cmins, cmaxs); } REGISTER_NET_LINKED(ENT_CLIENT_DOOR) @@ -617,29 +617,29 @@ float door_send(entity this, entity to, float sf) if(sf & SF_TRIGGER_INIT) { - WriteString(MSG_ENTITY, self.classname); - WriteByte(MSG_ENTITY, self.spawnflags); + WriteString(MSG_ENTITY, this.classname); + WriteByte(MSG_ENTITY, this.spawnflags); - WriteString(MSG_ENTITY, self.model); + WriteString(MSG_ENTITY, this.model); - trigger_common_write(self, true); + trigger_common_write(this, true); - WriteCoord(MSG_ENTITY, self.pos1_x); - WriteCoord(MSG_ENTITY, self.pos1_y); - WriteCoord(MSG_ENTITY, self.pos1_z); - WriteCoord(MSG_ENTITY, self.pos2_x); - WriteCoord(MSG_ENTITY, self.pos2_y); - WriteCoord(MSG_ENTITY, self.pos2_z); + WriteCoord(MSG_ENTITY, this.pos1_x); + WriteCoord(MSG_ENTITY, this.pos1_y); + WriteCoord(MSG_ENTITY, this.pos1_z); + WriteCoord(MSG_ENTITY, this.pos2_x); + WriteCoord(MSG_ENTITY, this.pos2_y); + WriteCoord(MSG_ENTITY, this.pos2_z); - WriteCoord(MSG_ENTITY, self.size_x); - WriteCoord(MSG_ENTITY, self.size_y); - WriteCoord(MSG_ENTITY, self.size_z); + WriteCoord(MSG_ENTITY, this.size_x); + WriteCoord(MSG_ENTITY, this.size_y); + WriteCoord(MSG_ENTITY, this.size_z); - WriteShort(MSG_ENTITY, self.wait); - WriteShort(MSG_ENTITY, self.speed); - WriteByte(MSG_ENTITY, self.lip); - WriteByte(MSG_ENTITY, self.state); - WriteCoord(MSG_ENTITY, self.SUB_LTIME); + WriteShort(MSG_ENTITY, this.wait); + WriteShort(MSG_ENTITY, this.speed); + WriteByte(MSG_ENTITY, this.lip); + WriteByte(MSG_ENTITY, this.state); + WriteCoord(MSG_ENTITY, this.SUB_LTIME); } if(sf & SF_TRIGGER_RESET) @@ -649,16 +649,16 @@ float door_send(entity this, entity to, float sf) if(sf & SF_TRIGGER_UPDATE) { - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); - - WriteCoord(MSG_ENTITY, self.pos1_x); - WriteCoord(MSG_ENTITY, self.pos1_y); - WriteCoord(MSG_ENTITY, self.pos1_z); - WriteCoord(MSG_ENTITY, self.pos2_x); - WriteCoord(MSG_ENTITY, self.pos2_y); - WriteCoord(MSG_ENTITY, self.pos2_z); + WriteCoord(MSG_ENTITY, this.origin_x); + WriteCoord(MSG_ENTITY, this.origin_y); + WriteCoord(MSG_ENTITY, this.origin_z); + + WriteCoord(MSG_ENTITY, this.pos1_x); + WriteCoord(MSG_ENTITY, this.pos1_y); + WriteCoord(MSG_ENTITY, this.pos1_z); + WriteCoord(MSG_ENTITY, this.pos2_x); + WriteCoord(MSG_ENTITY, this.pos2_y); + WriteCoord(MSG_ENTITY, this.pos2_z); } return true; @@ -667,19 +667,19 @@ float door_send(entity this, entity to, float sf) void door_link() { // set size now, as everything is loaded - //FixSize(self); - //Net_LinkEntity(self, false, 0, door_send); + //FixSize(this); + //Net_LinkEntity(this, false, 0, door_send); } #endif void door_init_startopen(entity this) { - SUB_SETORIGIN(self, self.pos2); - self.pos2 = self.pos1; - self.pos1 = self.origin; + SUB_SETORIGIN(this, this.pos2); + this.pos2 = this.pos1; + this.pos1 = this.origin; #ifdef SVQC - self.SendFlags |= SF_TRIGGER_UPDATE; + this.SendFlags |= SF_TRIGGER_UPDATE; #endif } diff --git a/qcsrc/common/triggers/func/door_rotating.qc b/qcsrc/common/triggers/func/door_rotating.qc index 504005e36..093382a70 100644 --- a/qcsrc/common/triggers/func/door_rotating.qc +++ b/qcsrc/common/triggers/func/door_rotating.qc @@ -38,9 +38,9 @@ void door_rotating_reset(entity this) void door_rotating_init_startopen(entity this) { - self.angles = self.movedir; - self.pos2 = '0 0 0'; - self.pos1 = self.movedir; + this.angles = this.movedir; + this.pos2 = '0 0 0'; + this.pos1 = this.movedir; } diff --git a/qcsrc/common/triggers/func/door_secret.qc b/qcsrc/common/triggers/func/door_secret.qc index 2156d5f83..f0472fadc 100644 --- a/qcsrc/common/triggers/func/door_secret.qc +++ b/qcsrc/common/triggers/func/door_secret.qc @@ -71,76 +71,76 @@ void fd_secret_damage(entity this, entity inflictor, entity attacker, float dama // Wait after first movement... void fd_secret_move1(entity this) { - self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0; - setthink(self, fd_secret_move2); - if (self.noise3 != "") - _sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM); + this.SUB_NEXTTHINK = this.SUB_LTIME + 1.0; + setthink(this, fd_secret_move2); + if (this.noise3 != "") + _sound(this, CH_TRIGGER_SINGLE, this.noise3, VOL_BASE, ATTEN_NORM); } // Start moving sideways w/sound... void fd_secret_move2(entity this) { - if (self.noise2 != "") - _sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); - SUB_CalcMove(self, self.dest2, TSPEED_LINEAR, self.speed, fd_secret_move3); + if (this.noise2 != "") + _sound(this, CH_TRIGGER_SINGLE, this.noise2, VOL_BASE, ATTEN_NORM); + SUB_CalcMove(this, this.dest2, TSPEED_LINEAR, this.speed, fd_secret_move3); } // Wait here until time to go back... void fd_secret_move3(entity this) { - if (self.noise3 != "") - _sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM); - if (!(self.spawnflags & SECRET_OPEN_ONCE)) + if (this.noise3 != "") + _sound(this, CH_TRIGGER_SINGLE, this.noise3, VOL_BASE, ATTEN_NORM); + if (!(this.spawnflags & SECRET_OPEN_ONCE)) { - self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait; - setthink(self, fd_secret_move4); + this.SUB_NEXTTHINK = this.SUB_LTIME + this.wait; + setthink(this, fd_secret_move4); } } // Move backward... void fd_secret_move4(entity this) { - if (self.noise2 != "") - _sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); - SUB_CalcMove(self, self.dest1, TSPEED_LINEAR, self.speed, fd_secret_move5); + if (this.noise2 != "") + _sound(this, CH_TRIGGER_SINGLE, this.noise2, VOL_BASE, ATTEN_NORM); + SUB_CalcMove(this, this.dest1, TSPEED_LINEAR, this.speed, fd_secret_move5); } // Wait 1 second... void fd_secret_move5(entity this) { - self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0; - setthink(self, fd_secret_move6); - if (self.noise3 != "") - _sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM); + this.SUB_NEXTTHINK = this.SUB_LTIME + 1.0; + setthink(this, fd_secret_move6); + if (this.noise3 != "") + _sound(this, CH_TRIGGER_SINGLE, this.noise3, VOL_BASE, ATTEN_NORM); } void fd_secret_move6(entity this) { - if (self.noise2 != "") - _sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); - SUB_CalcMove(self, self.oldorigin, TSPEED_LINEAR, self.speed, fd_secret_done); + if (this.noise2 != "") + _sound(this, CH_TRIGGER_SINGLE, this.noise2, VOL_BASE, ATTEN_NORM); + SUB_CalcMove(this, this.oldorigin, TSPEED_LINEAR, this.speed, fd_secret_done); } void fd_secret_done(entity this) { - if (self.spawnflags&SECRET_YES_SHOOT) + if (this.spawnflags&SECRET_YES_SHOOT) { - self.health = 10000; - self.takedamage = DAMAGE_YES; - //self.th_pain = fd_secret_use; + this.health = 10000; + this.takedamage = DAMAGE_YES; + //this.th_pain = fd_secret_use; } - if (self.noise3 != "") - _sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM); + if (this.noise3 != "") + _sound(this, CH_TRIGGER_SINGLE, this.noise3, VOL_BASE, ATTEN_NORM); } .float door_finished; void secret_blocked() {SELFPARAM(); - if (time < self.door_finished) + if (time < this.door_finished) return; - self.door_finished = time + 0.5; - //T_Damage (other, self, self, self.dmg, self.dmg, self.deathtype, DT_IMPACT, (self.absmin + self.absmax) * 0.5, '0 0 0', Obituary_Generic); + this.door_finished = time + 0.5; + //T_Damage (other, this, this, this.dmg, this.dmg, this.deathtype, DT_IMPACT, (this.absmin + this.absmax) * 0.5, '0 0 0', Obituary_Generic); } /* @@ -154,16 +154,16 @@ void secret_touch(entity this) { if (!other.iscreature) return; - if (self.door_finished > time) + if (this.door_finished > time) return; - self.door_finished = time + 2; + this.door_finished = time + 2; - if (self.message) + if (this.message) { if (IS_CLIENT(other)) - centerprint(other, self.message); - play2(other, self.noise); + centerprint(other, this.message); + play2(other, this.noise); } } diff --git a/qcsrc/common/triggers/func/fourier.qc b/qcsrc/common/triggers/func/fourier.qc index 53366aa10..cde3c5d49 100644 --- a/qcsrc/common/triggers/func/fourier.qc +++ b/qcsrc/common/triggers/func/fourier.qc @@ -15,28 +15,28 @@ void func_fourier_controller_think(entity this) vector v; float n, i, t; - self.nextthink = time + 0.1; - if(self.owner.active != ACTIVE_ACTIVE) + this.nextthink = time + 0.1; + if(this.owner.active != ACTIVE_ACTIVE) { - self.owner.velocity = '0 0 0'; + this.owner.velocity = '0 0 0'; return; } - n = floor((tokenize_console(self.owner.netname)) / 5); - t = self.nextthink * self.owner.cnt + self.owner.phase * 360; + n = floor((tokenize_console(this.owner.netname)) / 5); + t = this.nextthink * this.owner.cnt + this.owner.phase * 360; - v = self.owner.destvec; + v = this.owner.destvec; for(i = 0; i < n; ++i) { makevectors((t * stof(argv(i*5)) + stof(argv(i*5+1)) * 360) * '0 1 0'); - v = v + ('1 0 0' * stof(argv(i*5+2)) + '0 1 0' * stof(argv(i*5+3)) + '0 0 1' * stof(argv(i*5+4))) * self.owner.height * v_forward_y; + v = v + ('1 0 0' * stof(argv(i*5+2)) + '0 1 0' * stof(argv(i*5+3)) + '0 0 1' * stof(argv(i*5+4))) * this.owner.height * v_forward_y; } - if(self.owner.classname == "func_fourier") // don't brake stuff if the func_fourier was killtarget'ed + if(this.owner.classname == "func_fourier") // don't brake stuff if the func_fourier was killtarget'ed // * 10 so it will arrive in 0.1 sec - self.owner.velocity = (v - self.owner.origin) * 10; + this.owner.velocity = (v - this.owner.origin) * 10; } spawnfunc(func_fourier) diff --git a/qcsrc/common/triggers/func/ladder.qc b/qcsrc/common/triggers/func/ladder.qc index c446c3f3f..af5065643 100644 --- a/qcsrc/common/triggers/func/ladder.qc +++ b/qcsrc/common/triggers/func/ladder.qc @@ -15,7 +15,7 @@ void func_ladder_touch(entity this) EXACTTRIGGER_TOUCH; other.ladder_time = time + 0.1; - other.ladder_entity = self; + other.ladder_entity = this; } #ifdef SVQC @@ -23,11 +23,11 @@ bool func_ladder_send(entity this, entity to, int sf) { WriteHeader(MSG_ENTITY, ENT_CLIENT_LADDER); - WriteString(MSG_ENTITY, self.classname); - WriteByte(MSG_ENTITY, self.skin); - WriteCoord(MSG_ENTITY, self.speed); + WriteString(MSG_ENTITY, this.classname); + WriteByte(MSG_ENTITY, this.skin); + WriteCoord(MSG_ENTITY, this.speed); - trigger_common_write(self, false); + trigger_common_write(this, false); return true; } diff --git a/qcsrc/common/triggers/func/pendulum.qc b/qcsrc/common/triggers/func/pendulum.qc index e05b2a6fc..f1fffd7b9 100644 --- a/qcsrc/common/triggers/func/pendulum.qc +++ b/qcsrc/common/triggers/func/pendulum.qc @@ -3,21 +3,21 @@ void func_pendulum_controller_think(entity this) { float v; - self.nextthink = time + 0.1; + this.nextthink = time + 0.1; - if (!(self.owner.active == ACTIVE_ACTIVE)) + if (!(this.owner.active == ACTIVE_ACTIVE)) { - self.owner.avelocity_x = 0; + this.owner.avelocity_x = 0; return; } // calculate sinewave using makevectors - makevectors((self.nextthink * self.owner.freq + self.owner.phase) * '0 360 0'); - v = self.owner.speed * v_forward_y + self.cnt; - if(self.owner.classname == "func_pendulum") // don't brake stuff if the func_bobbing was killtarget'ed + makevectors((this.nextthink * this.owner.freq + this.owner.phase) * '0 360 0'); + v = this.owner.speed * v_forward_y + this.cnt; + if(this.owner.classname == "func_pendulum") // don't brake stuff if the func_bobbing was killtarget'ed { // * 10 so it will arrive in 0.1 sec - self.owner.avelocity_z = (remainder(v - self.owner.angles_z, 360)) * 10; + this.owner.avelocity_z = (remainder(v - this.owner.angles_z, 360)) * 10; } } diff --git a/qcsrc/common/triggers/func/plat.qc b/qcsrc/common/triggers/func/plat.qc index ee942f4cb..dea0077c1 100644 --- a/qcsrc/common/triggers/func/plat.qc +++ b/qcsrc/common/triggers/func/plat.qc @@ -1,11 +1,11 @@ REGISTER_NET_LINKED(ENT_CLIENT_PLAT) #ifdef SVQC -void plat_link(); +void plat_link(entity this); void plat_delayedinit(entity this) { - plat_link(); + plat_link(this); plat_spawn_inside_trigger(this); // the "start moving" trigger } @@ -16,36 +16,36 @@ float plat_send(entity this, entity to, float sf) if(sf & SF_TRIGGER_INIT) { - WriteByte(MSG_ENTITY, self.platmovetype_start); - WriteByte(MSG_ENTITY, self.platmovetype_turn); - WriteByte(MSG_ENTITY, self.platmovetype_end); - WriteByte(MSG_ENTITY, self.spawnflags); + WriteByte(MSG_ENTITY, this.platmovetype_start); + WriteByte(MSG_ENTITY, this.platmovetype_turn); + WriteByte(MSG_ENTITY, this.platmovetype_end); + WriteByte(MSG_ENTITY, this.spawnflags); - WriteString(MSG_ENTITY, self.model); + WriteString(MSG_ENTITY, this.model); - trigger_common_write(self, true); + trigger_common_write(this, true); - WriteCoord(MSG_ENTITY, self.pos1_x); - WriteCoord(MSG_ENTITY, self.pos1_y); - WriteCoord(MSG_ENTITY, self.pos1_z); - WriteCoord(MSG_ENTITY, self.pos2_x); - WriteCoord(MSG_ENTITY, self.pos2_y); - WriteCoord(MSG_ENTITY, self.pos2_z); + WriteCoord(MSG_ENTITY, this.pos1_x); + WriteCoord(MSG_ENTITY, this.pos1_y); + WriteCoord(MSG_ENTITY, this.pos1_z); + WriteCoord(MSG_ENTITY, this.pos2_x); + WriteCoord(MSG_ENTITY, this.pos2_y); + WriteCoord(MSG_ENTITY, this.pos2_z); - WriteCoord(MSG_ENTITY, self.size_x); - WriteCoord(MSG_ENTITY, self.size_y); - WriteCoord(MSG_ENTITY, self.size_z); + WriteCoord(MSG_ENTITY, this.size_x); + WriteCoord(MSG_ENTITY, this.size_y); + WriteCoord(MSG_ENTITY, this.size_z); - WriteAngle(MSG_ENTITY, self.mangle_x); - WriteAngle(MSG_ENTITY, self.mangle_y); - WriteAngle(MSG_ENTITY, self.mangle_z); + WriteAngle(MSG_ENTITY, this.mangle_x); + WriteAngle(MSG_ENTITY, this.mangle_y); + WriteAngle(MSG_ENTITY, this.mangle_z); - WriteShort(MSG_ENTITY, self.speed); - WriteShort(MSG_ENTITY, self.height); - WriteByte(MSG_ENTITY, self.lip); - WriteByte(MSG_ENTITY, self.state); + WriteShort(MSG_ENTITY, this.speed); + WriteShort(MSG_ENTITY, this.height); + WriteByte(MSG_ENTITY, this.lip); + WriteByte(MSG_ENTITY, this.state); - WriteShort(MSG_ENTITY, self.dmg); + WriteShort(MSG_ENTITY, this.dmg); } if(sf & SF_TRIGGER_RESET) @@ -56,9 +56,9 @@ float plat_send(entity this, entity to, float sf) return true; } -void plat_link() +void plat_link(entity this) { - //Net_LinkEntity(self, 0, false, plat_send); + //Net_LinkEntity(this, 0, false, plat_send); } spawnfunc(func_plat) diff --git a/qcsrc/common/triggers/func/pointparticles.qc b/qcsrc/common/triggers/func/pointparticles.qc index 9cfc01acb..ece31ac0e 100644 --- a/qcsrc/common/triggers/func/pointparticles.qc +++ b/qcsrc/common/triggers/func/pointparticles.qc @@ -9,42 +9,42 @@ bool pointparticles_SendEntity(entity this, entity to, float fl) // optional features to save space fl = fl & 0x0F; - if(self.spawnflags & 2) + if(this.spawnflags & 2) fl |= 0x10; // absolute count on toggle-on - if(self.movedir != '0 0 0' || self.velocity != '0 0 0') + if(this.movedir != '0 0 0' || this.velocity != '0 0 0') fl |= 0x20; // 4 bytes - saves CPU - if(self.waterlevel || self.count != 1) + if(this.waterlevel || this.count != 1) fl |= 0x40; // 4 bytes - obscure features almost never used - if(self.mins != '0 0 0' || self.maxs != '0 0 0') + if(this.mins != '0 0 0' || this.maxs != '0 0 0') fl |= 0x80; // 14 bytes - saves lots of space WriteByte(MSG_ENTITY, fl); if(fl & 2) { - if(self.state) - WriteCoord(MSG_ENTITY, self.impulse); + if(this.state) + WriteCoord(MSG_ENTITY, this.impulse); else WriteCoord(MSG_ENTITY, 0); // off } if(fl & 4) { - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, this.origin_x); + WriteCoord(MSG_ENTITY, this.origin_y); + WriteCoord(MSG_ENTITY, this.origin_z); } if(fl & 1) { - if(self.model != "null") + if(this.model != "null") { - WriteShort(MSG_ENTITY, self.modelindex); + WriteShort(MSG_ENTITY, this.modelindex); if(fl & 0x80) { - WriteCoord(MSG_ENTITY, self.mins_x); - WriteCoord(MSG_ENTITY, self.mins_y); - WriteCoord(MSG_ENTITY, self.mins_z); - WriteCoord(MSG_ENTITY, self.maxs_x); - WriteCoord(MSG_ENTITY, self.maxs_y); - WriteCoord(MSG_ENTITY, self.maxs_z); + WriteCoord(MSG_ENTITY, this.mins_x); + WriteCoord(MSG_ENTITY, this.mins_y); + WriteCoord(MSG_ENTITY, this.mins_z); + WriteCoord(MSG_ENTITY, this.maxs_x); + WriteCoord(MSG_ENTITY, this.maxs_y); + WriteCoord(MSG_ENTITY, this.maxs_z); } } else @@ -52,36 +52,36 @@ bool pointparticles_SendEntity(entity this, entity to, float fl) WriteShort(MSG_ENTITY, 0); if(fl & 0x80) { - WriteCoord(MSG_ENTITY, self.maxs_x); - WriteCoord(MSG_ENTITY, self.maxs_y); - WriteCoord(MSG_ENTITY, self.maxs_z); + WriteCoord(MSG_ENTITY, this.maxs_x); + WriteCoord(MSG_ENTITY, this.maxs_y); + WriteCoord(MSG_ENTITY, this.maxs_z); } } - WriteShort(MSG_ENTITY, self.cnt); - WriteString(MSG_ENTITY, self.mdl); + WriteShort(MSG_ENTITY, this.cnt); + WriteString(MSG_ENTITY, this.mdl); if(fl & 0x20) { - WriteShort(MSG_ENTITY, compressShortVector(self.velocity)); - WriteShort(MSG_ENTITY, compressShortVector(self.movedir)); + WriteShort(MSG_ENTITY, compressShortVector(this.velocity)); + WriteShort(MSG_ENTITY, compressShortVector(this.movedir)); } if(fl & 0x40) { - WriteShort(MSG_ENTITY, self.waterlevel * 16.0); - WriteByte(MSG_ENTITY, self.count * 16.0); + WriteShort(MSG_ENTITY, this.waterlevel * 16.0); + WriteByte(MSG_ENTITY, this.count * 16.0); } - WriteString(MSG_ENTITY, self.noise); - if(self.noise != "") + WriteString(MSG_ENTITY, this.noise); + if(this.noise != "") { - WriteByte(MSG_ENTITY, floor(self.atten * 64)); - WriteByte(MSG_ENTITY, floor(self.volume * 255)); + WriteByte(MSG_ENTITY, floor(this.atten * 64)); + WriteByte(MSG_ENTITY, floor(this.volume * 255)); } - WriteString(MSG_ENTITY, self.bgmscript); - if(self.bgmscript != "") + WriteString(MSG_ENTITY, this.bgmscript); + if(this.bgmscript != "") { - WriteByte(MSG_ENTITY, floor(self.bgmscriptattack * 64)); - WriteByte(MSG_ENTITY, floor(self.bgmscriptdecay * 64)); - WriteByte(MSG_ENTITY, floor(self.bgmscriptsustain * 255)); - WriteByte(MSG_ENTITY, floor(self.bgmscriptrelease * 64)); + WriteByte(MSG_ENTITY, floor(this.bgmscriptattack * 64)); + WriteByte(MSG_ENTITY, floor(this.bgmscriptdecay * 64)); + WriteByte(MSG_ENTITY, floor(this.bgmscriptsustain * 255)); + WriteByte(MSG_ENTITY, floor(this.bgmscriptrelease * 64)); } } return 1; @@ -95,12 +95,12 @@ void pointparticles_use(entity this, entity actor, entity trigger) void pointparticles_think(entity this) { - if(self.origin != self.oldorigin) + if(this.origin != this.oldorigin) { - self.SendFlags |= 4; - self.oldorigin = self.origin; + this.SendFlags |= 4; + this.oldorigin = this.origin; } - self.nextthink = time; + this.nextthink = time; } void pointparticles_reset(entity this) @@ -149,25 +149,25 @@ spawnfunc(func_pointparticles) spawnfunc(func_sparks) { - // self.cnt is the amount of sparks that one burst will spawn - if(self.cnt < 1) { - self.cnt = 25.0; // nice default value + // this.cnt is the amount of sparks that one burst will spawn + if(this.cnt < 1) { + this.cnt = 25.0; // nice default value } - // self.wait is the probability that a sparkthink will spawn a spark shower + // this.wait is the probability that a sparkthink will spawn a spark shower // range: 0 - 1, but 0 makes little sense, so... - if(self.wait < 0.05) { - self.wait = 0.25; // nice default value + if(this.wait < 0.05) { + this.wait = 0.25; // nice default value } - self.count = self.cnt; - self.mins = '0 0 0'; - self.maxs = '0 0 0'; - self.velocity = '0 0 -1'; - self.mdl = "TE_SPARK"; - self.impulse = 10 * self.wait; // by default 2.5/sec - self.wait = 0; - self.cnt = 0; // use mdl + this.count = this.cnt; + this.mins = '0 0 0'; + this.maxs = '0 0 0'; + this.velocity = '0 0 -1'; + this.mdl = "TE_SPARK"; + this.impulse = 10 * this.wait; // by default 2.5/sec + this.wait = 0; + this.cnt = 0; // use mdl spawnfunc_func_pointparticles(this); } diff --git a/qcsrc/common/triggers/func/train.qc b/qcsrc/common/triggers/func/train.qc index 18b8d0834..425a6fe8a 100644 --- a/qcsrc/common/triggers/func/train.qc +++ b/qcsrc/common/triggers/func/train.qc @@ -6,58 +6,58 @@ void train_use(entity this, entity actor, entity trigger); void train_wait(entity this) { SUB_UseTargets(this.enemy, NULL, NULL); - self.enemy = world; + this.enemy = world; // if turning is enabled, the train will turn toward the next point while waiting - if(self.platmovetype_turn && !self.train_wait_turning) + if(this.platmovetype_turn && !this.train_wait_turning) { entity targ, cp; vector ang; - targ = find(world, targetname, self.target); - if((self.spawnflags & 1) && targ.curvetarget) + targ = find(world, targetname, this.target); + if((this.spawnflags & 1) && targ.curvetarget) cp = find(world, targetname, targ.curvetarget); else cp = world; if(cp) // bezier curves movement - ang = cp.origin - (self.origin - self.view_ofs); // use the origin of the control point of the next path_corner + ang = cp.origin - (this.origin - this.view_ofs); // use the origin of the control point of the next path_corner else // linear movement - ang = targ.origin - (self.origin - self.view_ofs); // use the origin of the next path_corner + ang = targ.origin - (this.origin - this.view_ofs); // use the origin of the next path_corner ang = vectoangles(ang); ang_x = -ang_x; // flip up / down orientation - if(self.wait > 0) // slow turning - SUB_CalcAngleMove(self, ang, TSPEED_TIME, self.SUB_LTIME - time + self.wait, train_wait); + if(this.wait > 0) // slow turning + SUB_CalcAngleMove(this, ang, TSPEED_TIME, this.SUB_LTIME - time + this.wait, train_wait); else // instant turning - SUB_CalcAngleMove(self, ang, TSPEED_TIME, 0.0000001, train_wait); - self.train_wait_turning = true; + SUB_CalcAngleMove(this, ang, TSPEED_TIME, 0.0000001, train_wait); + this.train_wait_turning = true; return; } #ifdef SVQC - if(self.noise != "") - stopsoundto(MSG_BROADCAST, self, CH_TRIGGER_SINGLE); // send this as unreliable only, as the train will resume operation shortly anyway + if(this.noise != "") + stopsoundto(MSG_BROADCAST, this, CH_TRIGGER_SINGLE); // send this as unreliable only, as the train will resume operation shortly anyway #endif #ifdef SVQC - entity tg = find(world, targetname, self.target); + entity tg = find(world, targetname, this.target); if(tg.spawnflags & 4) { - self.use = train_use; - SUB_THINK(self, func_null); - self.SUB_NEXTTHINK = 0; + this.use = train_use; + SUB_THINK(this, func_null); + this.SUB_NEXTTHINK = 0; } else #endif - if(self.wait < 0 || self.train_wait_turning) // no waiting or we already waited while turning + if(this.wait < 0 || this.train_wait_turning) // no waiting or we already waited while turning { - self.train_wait_turning = false; - train_next(self); + this.train_wait_turning = false; + train_next(this); } else { - SUB_THINK(self, train_next); - self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait; + SUB_THINK(this, train_next); + this.SUB_NEXTTHINK = this.SUB_LTIME + this.wait; } } @@ -66,52 +66,52 @@ void train_next(entity this) entity targ, cp = world; vector cp_org = '0 0 0'; - targ = find(world, targetname, self.target); - self.target = targ.target; - if (self.spawnflags & 1) + targ = find(world, targetname, this.target); + this.target = targ.target; + if (this.spawnflags & 1) { if(targ.curvetarget) { cp = find(world, targetname, targ.curvetarget); // get its second target (the control point) - cp_org = cp.origin - self.view_ofs; // no control point found, assume a straight line to the destination + cp_org = cp.origin - this.view_ofs; // no control point found, assume a straight line to the destination } } - if (self.target == "") + if (this.target == "") objerror("train_next: no next target"); - self.wait = targ.wait; - if (!self.wait) - self.wait = 0.1; + this.wait = targ.wait; + if (!this.wait) + this.wait = 0.1; if(targ.platmovetype) { // this path_corner contains a movetype overrider, apply it - self.platmovetype_start = targ.platmovetype_start; - self.platmovetype_end = targ.platmovetype_end; + this.platmovetype_start = targ.platmovetype_start; + this.platmovetype_end = targ.platmovetype_end; } else { // this path_corner doesn't contain a movetype overrider, use the train's defaults - self.platmovetype_start = self.platmovetype_start_default; - self.platmovetype_end = self.platmovetype_end_default; + this.platmovetype_start = this.platmovetype_start_default; + this.platmovetype_end = this.platmovetype_end_default; } if (targ.speed) { if (cp) - SUB_CalcMove_Bezier(self, cp_org, targ.origin - self.view_ofs, TSPEED_LINEAR, targ.speed, train_wait); + SUB_CalcMove_Bezier(this, cp_org, targ.origin - this.view_ofs, TSPEED_LINEAR, targ.speed, train_wait); else - SUB_CalcMove(self, targ.origin - self.view_ofs, TSPEED_LINEAR, targ.speed, train_wait); + SUB_CalcMove(this, targ.origin - this.view_ofs, TSPEED_LINEAR, targ.speed, train_wait); } else { if (cp) - SUB_CalcMove_Bezier(self, cp_org, targ.origin - self.view_ofs, TSPEED_LINEAR, self.speed, train_wait); + SUB_CalcMove_Bezier(this, cp_org, targ.origin - this.view_ofs, TSPEED_LINEAR, this.speed, train_wait); else - SUB_CalcMove(self, targ.origin - self.view_ofs, TSPEED_LINEAR, self.speed, train_wait); + SUB_CalcMove(this, targ.origin - this.view_ofs, TSPEED_LINEAR, this.speed, train_wait); } - if(self.noise != "") - _sound(self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_IDLE); + if(this.noise != "") + _sound(this, CH_TRIGGER_SINGLE, this.noise, VOL_BASE, ATTEN_IDLE); } REGISTER_NET_LINKED(ENT_CLIENT_TRAIN) @@ -124,43 +124,43 @@ float train_send(entity this, entity to, float sf) if(sf & SF_TRIGGER_INIT) { - WriteString(MSG_ENTITY, self.platmovetype); - WriteByte(MSG_ENTITY, self.platmovetype_turn); - WriteByte(MSG_ENTITY, self.spawnflags); + WriteString(MSG_ENTITY, this.platmovetype); + WriteByte(MSG_ENTITY, this.platmovetype_turn); + WriteByte(MSG_ENTITY, this.spawnflags); - WriteString(MSG_ENTITY, self.model); + WriteString(MSG_ENTITY, this.model); - trigger_common_write(self, true); + trigger_common_write(this, true); - WriteString(MSG_ENTITY, self.curvetarget); + WriteString(MSG_ENTITY, this.curvetarget); - WriteCoord(MSG_ENTITY, self.pos1_x); - WriteCoord(MSG_ENTITY, self.pos1_y); - WriteCoord(MSG_ENTITY, self.pos1_z); - WriteCoord(MSG_ENTITY, self.pos2_x); - WriteCoord(MSG_ENTITY, self.pos2_y); - WriteCoord(MSG_ENTITY, self.pos2_z); + WriteCoord(MSG_ENTITY, this.pos1_x); + WriteCoord(MSG_ENTITY, this.pos1_y); + WriteCoord(MSG_ENTITY, this.pos1_z); + WriteCoord(MSG_ENTITY, this.pos2_x); + WriteCoord(MSG_ENTITY, this.pos2_y); + WriteCoord(MSG_ENTITY, this.pos2_z); - WriteCoord(MSG_ENTITY, self.size_x); - WriteCoord(MSG_ENTITY, self.size_y); - WriteCoord(MSG_ENTITY, self.size_z); + WriteCoord(MSG_ENTITY, this.size_x); + WriteCoord(MSG_ENTITY, this.size_y); + WriteCoord(MSG_ENTITY, this.size_z); - WriteCoord(MSG_ENTITY, self.view_ofs_x); - WriteCoord(MSG_ENTITY, self.view_ofs_y); - WriteCoord(MSG_ENTITY, self.view_ofs_z); + WriteCoord(MSG_ENTITY, this.view_ofs_x); + WriteCoord(MSG_ENTITY, this.view_ofs_y); + WriteCoord(MSG_ENTITY, this.view_ofs_z); - WriteAngle(MSG_ENTITY, self.mangle_x); - WriteAngle(MSG_ENTITY, self.mangle_y); - WriteAngle(MSG_ENTITY, self.mangle_z); + WriteAngle(MSG_ENTITY, this.mangle_x); + WriteAngle(MSG_ENTITY, this.mangle_y); + WriteAngle(MSG_ENTITY, this.mangle_z); - WriteShort(MSG_ENTITY, self.speed); - WriteShort(MSG_ENTITY, self.height); - WriteByte(MSG_ENTITY, self.lip); - WriteByte(MSG_ENTITY, self.state); - WriteByte(MSG_ENTITY, self.wait); + WriteShort(MSG_ENTITY, this.speed); + WriteShort(MSG_ENTITY, this.height); + WriteByte(MSG_ENTITY, this.lip); + WriteByte(MSG_ENTITY, this.state); + WriteByte(MSG_ENTITY, this.wait); - WriteShort(MSG_ENTITY, self.dmg); - WriteByte(MSG_ENTITY, self.dmgtime); + WriteShort(MSG_ENTITY, this.dmg); + WriteByte(MSG_ENTITY, this.dmgtime); } if(sf & SF_TRIGGER_RESET) @@ -171,9 +171,9 @@ float train_send(entity this, entity to, float sf) return true; } -void train_link() +void train_link(entity this) { - //Net_LinkEntity(self, 0, false, train_send); + //Net_LinkEntity(this, 0, false, train_send); } void train_use(entity this, entity actor, entity trigger) @@ -186,19 +186,19 @@ void train_use(entity this, entity actor, entity trigger) void func_train_find(entity this) { entity targ; - targ = find(world, targetname, self.target); - self.target = targ.target; - if (self.target == "") + targ = find(world, targetname, this.target); + this.target = targ.target; + if (this.target == "") objerror("func_train_find: no next target"); - SUB_SETORIGIN(self, targ.origin - self.view_ofs); + SUB_SETORIGIN(this, targ.origin - this.view_ofs); - if(!(self.spawnflags & 4)) + if(!(this.spawnflags & 4)) { - self.SUB_NEXTTHINK = self.SUB_LTIME + 1; - SUB_THINK(self, train_next); + this.SUB_NEXTTHINK = this.SUB_LTIME + 1; + SUB_THINK(this, train_next); } - train_link(); + train_link(this); } #endif diff --git a/qcsrc/common/triggers/func/vectormamamam.qc b/qcsrc/common/triggers/func/vectormamamam.qc index b3e931b3a..dd8804106 100644 --- a/qcsrc/common/triggers/func/vectormamamam.qc +++ b/qcsrc/common/triggers/func/vectormamamam.qc @@ -59,16 +59,16 @@ vector func_vectormamamam_origin(entity o, float t) void func_vectormamamam_controller_think(entity this) { - self.nextthink = time + 0.1; + this.nextthink = time + 0.1; - if(self.owner.active != ACTIVE_ACTIVE) + if(this.owner.active != ACTIVE_ACTIVE) { - self.owner.velocity = '0 0 0'; + this.owner.velocity = '0 0 0'; return; } - if(self.owner.classname == "func_vectormamamam") // don't brake stuff if the func_vectormamamam was killtarget'ed - self.owner.velocity = (self.owner.destvec + func_vectormamamam_origin(self.owner, 0.1) - self.owner.origin) * 10; + if(this.owner.classname == "func_vectormamamam") // don't brake stuff if the func_vectormamamam was killtarget'ed + this.owner.velocity = (this.owner.destvec + func_vectormamamam_origin(this.owner, 0.1) - this.owner.origin) * 10; } void func_vectormamamam_findtarget(entity this) diff --git a/qcsrc/common/triggers/misc/laser.qc b/qcsrc/common/triggers/misc/laser.qc index f0aafc7c4..15c7e2630 100644 --- a/qcsrc/common/triggers/misc/laser.qc +++ b/qcsrc/common/triggers/misc/laser.qc @@ -51,8 +51,8 @@ void misc_laser_aim(entity this) void misc_laser_init(entity this) { - if(self.target != "") - self.enemy = find(world, targetname, self.target); + if(this.target != "") + this.enemy = find(world, targetname, this.target); } .entity pusher; @@ -62,62 +62,62 @@ void misc_laser_think(entity this) entity hitent; vector hitloc; - self.nextthink = time; + this.nextthink = time; - if(!self.state) + if(!this.state) return; misc_laser_aim(this); - if(self.enemy) + if(this.enemy) { - o = self.enemy.origin; - if (!(self.spawnflags & 2)) - o = self.origin + normalize(o - self.origin) * 32768; + o = this.enemy.origin; + if (!(this.spawnflags & 2)) + o = this.origin + normalize(o - this.origin) * 32768; } else { - makevectors(self.mangle); - o = self.origin + v_forward * 32768; + makevectors(this.mangle); + o = this.origin + v_forward * 32768; } - if(self.dmg || self.enemy.target != "") + if(this.dmg || this.enemy.target != "") { - traceline(self.origin, o, MOVE_NORMAL, self); + traceline(this.origin, o, MOVE_NORMAL, this); } hitent = trace_ent; hitloc = trace_endpos; - if(self.enemy.target != "") // DETECTOR laser + if(this.enemy.target != "") // DETECTOR laser { if(trace_ent.iscreature) { - self.pusher = hitent; - if(!self.count) + this.pusher = hitent; + if(!this.count) { - self.count = 1; + this.count = 1; - SUB_UseTargets(self.enemy, self.enemy.pusher, NULL); + SUB_UseTargets(this.enemy, this.enemy.pusher, NULL); } } else { - if(self.count) + if(this.count) { - self.count = 0; + this.count = 0; - SUB_UseTargets(self.enemy, self.enemy.pusher, NULL); + SUB_UseTargets(this.enemy, this.enemy.pusher, NULL); } } } - if(self.dmg) + if(this.dmg) { - if(self.team) - if(((self.spawnflags & 8) == 0) == (self.team != hitent.team)) + if(this.team) + if(((this.spawnflags & 8) == 0) == (this.team != hitent.team)) return; if(hitent.takedamage) - Damage(hitent, self, self, ((self.dmg < 0) ? 100000 : (self.dmg * frametime)), DEATH_HURTTRIGGER.m_id, hitloc, '0 0 0'); + Damage(hitent, this, this, ((this.dmg < 0) ? 100000 : (this.dmg * frametime)), DEATH_HURTTRIGGER.m_id, hitloc, '0 0 0'); } } @@ -125,52 +125,52 @@ bool laser_SendEntity(entity this, entity to, float fl) { WriteHeader(MSG_ENTITY, ENT_CLIENT_LASER); fl = fl - (fl & 0xF0); // use that bit to indicate finite length laser - if(self.spawnflags & 2) + if(this.spawnflags & 2) fl |= 0x80; - if(self.alpha) + if(this.alpha) fl |= 0x40; - if(self.scale != 1 || self.modelscale != 1) + if(this.scale != 1 || this.modelscale != 1) fl |= 0x20; - if(self.spawnflags & 4) + if(this.spawnflags & 4) fl |= 0x10; WriteByte(MSG_ENTITY, fl); if(fl & 1) { - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, this.origin_x); + WriteCoord(MSG_ENTITY, this.origin_y); + WriteCoord(MSG_ENTITY, this.origin_z); } if(fl & 8) { - WriteByte(MSG_ENTITY, self.colormod_x * 255.0); - WriteByte(MSG_ENTITY, self.colormod_y * 255.0); - WriteByte(MSG_ENTITY, self.colormod_z * 255.0); + WriteByte(MSG_ENTITY, this.colormod_x * 255.0); + WriteByte(MSG_ENTITY, this.colormod_y * 255.0); + WriteByte(MSG_ENTITY, this.colormod_z * 255.0); if(fl & 0x40) - WriteByte(MSG_ENTITY, self.alpha * 255.0); + WriteByte(MSG_ENTITY, this.alpha * 255.0); if(fl & 0x20) { - WriteByte(MSG_ENTITY, bound(0, self.scale * 16.0, 255)); - WriteByte(MSG_ENTITY, bound(0, self.modelscale * 16.0, 255)); + WriteByte(MSG_ENTITY, bound(0, this.scale * 16.0, 255)); + WriteByte(MSG_ENTITY, bound(0, this.modelscale * 16.0, 255)); } if((fl & 0x80) || !(fl & 0x10)) // effect doesn't need sending if the laser is infinite and has collision testing turned off - WriteShort(MSG_ENTITY, self.cnt + 1); + WriteShort(MSG_ENTITY, this.cnt + 1); } if(fl & 2) { if(fl & 0x80) { - WriteCoord(MSG_ENTITY, self.enemy.origin_x); - WriteCoord(MSG_ENTITY, self.enemy.origin_y); - WriteCoord(MSG_ENTITY, self.enemy.origin_z); + WriteCoord(MSG_ENTITY, this.enemy.origin_x); + WriteCoord(MSG_ENTITY, this.enemy.origin_y); + WriteCoord(MSG_ENTITY, this.enemy.origin_z); } else { - WriteAngle(MSG_ENTITY, self.mangle_x); - WriteAngle(MSG_ENTITY, self.mangle_y); + WriteAngle(MSG_ENTITY, this.mangle_x); + WriteAngle(MSG_ENTITY, this.mangle_y); } } if(fl & 4) - WriteByte(MSG_ENTITY, self.state); + WriteByte(MSG_ENTITY, this.state); return 1; } diff --git a/qcsrc/common/triggers/platforms.qc b/qcsrc/common/triggers/platforms.qc index 3819e9c7f..b29894664 100644 --- a/qcsrc/common/triggers/platforms.qc +++ b/qcsrc/common/triggers/platforms.qc @@ -2,17 +2,17 @@ void generic_plat_blocked() { #ifdef SVQC SELFPARAM(); - if(self.dmg && other.takedamage != DAMAGE_NO) + if(this.dmg && other.takedamage != DAMAGE_NO) { - if(self.dmgtime2 < time) + if(this.dmgtime2 < time) { - Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); - self.dmgtime2 = time + self.dmgtime; + Damage (other, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); + this.dmgtime2 = time + this.dmgtime; } // Gib dead/dying stuff if(IS_DEAD(other)) - Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); + Damage (other, this, this, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); } #endif } @@ -26,22 +26,22 @@ void plat_spawn_inside_trigger(entity this) settouch(trigger, plat_center_touch); trigger.movetype = MOVETYPE_NONE; trigger.solid = SOLID_TRIGGER; - trigger.enemy = self; + trigger.enemy = this; - tmin = self.absmin + '25 25 0'; - tmax = self.absmax - '25 25 -8'; - tmin_z = tmax_z - (self.pos1_z - self.pos2_z + 8); - if (self.spawnflags & PLAT_LOW_TRIGGER) + tmin = this.absmin + '25 25 0'; + tmax = this.absmax - '25 25 -8'; + tmin_z = tmax_z - (this.pos1_z - this.pos2_z + 8); + if (this.spawnflags & PLAT_LOW_TRIGGER) tmax_z = tmin_z + 8; - if (self.size_x <= 50) + if (this.size_x <= 50) { - tmin_x = (self.mins_x + self.maxs_x) / 2; + tmin_x = (this.mins_x + this.maxs_x) / 2; tmax_x = tmin_x + 1; } - if (self.size_y <= 50) + if (this.size_y <= 50) { - tmin_y = (self.mins_y + self.maxs_y) / 2; + tmin_y = (this.mins_y + this.maxs_y) / 2; tmax_y = tmin_y + 1; } @@ -60,31 +60,31 @@ void plat_spawn_inside_trigger(entity this) void plat_hit_top(entity this) { - _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); - self.state = 1; + _sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM); + this.state = 1; - SUB_THINK(self, plat_go_down); - self.SUB_NEXTTHINK = self.SUB_LTIME + 3; + SUB_THINK(this, plat_go_down); + this.SUB_NEXTTHINK = this.SUB_LTIME + 3; } void plat_hit_bottom(entity this) { - _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); - self.state = 2; + _sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM); + this.state = 2; } void plat_go_down(entity this) { - _sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM); - self.state = 3; - SUB_CalcMove (self, self.pos2, TSPEED_LINEAR, self.speed, plat_hit_bottom); + _sound (this, CH_TRIGGER_SINGLE, this.noise, VOL_BASE, ATTEN_NORM); + this.state = 3; + SUB_CalcMove (this, this.pos2, TSPEED_LINEAR, this.speed, plat_hit_bottom); } void plat_go_up(entity this) { - _sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM); - self.state = 4; - SUB_CalcMove (self, self.pos1, TSPEED_LINEAR, self.speed, plat_hit_top); + _sound (this, CH_TRIGGER_SINGLE, this.noise, VOL_BASE, ATTEN_NORM); + this.state = 4; + SUB_CalcMove (this, this.pos1, TSPEED_LINEAR, this.speed, plat_hit_top); } void plat_center_touch(entity this) @@ -102,11 +102,11 @@ void plat_center_touch(entity this) return; #endif - if (self.enemy.state == 2) { - entity e = self.enemy; + if (this.enemy.state == 2) { + entity e = this.enemy; WITHSELF(e, plat_go_up(e)); - } else if (self.enemy.state == 1) - self.enemy.SUB_NEXTTHINK = self.enemy.SUB_LTIME + 1; + } else if (this.enemy.state == 1) + this.enemy.SUB_NEXTTHINK = this.enemy.SUB_LTIME + 1; } void plat_outside_touch(entity this) @@ -122,8 +122,8 @@ void plat_outside_touch(entity this) return; #endif - if (self.enemy.state == 1) { - entity e = self.enemy; + if (this.enemy.state == 1) { + entity e = this.enemy; WITHSELF(e, plat_go_down(e)); } } @@ -143,28 +143,28 @@ void plat_trigger_use(entity this, entity actor, entity trigger) void plat_crush() {SELFPARAM(); - if((self.spawnflags & 4) && (other.takedamage != DAMAGE_NO)) + if((this.spawnflags & 4) && (other.takedamage != DAMAGE_NO)) { // KIll Kill Kill!! #ifdef SVQC - Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); + Damage (other, this, this, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); #endif } else { #ifdef SVQC - if((self.dmg) && (other.takedamage != DAMAGE_NO)) + if((this.dmg) && (other.takedamage != DAMAGE_NO)) { // Shall we bite? - Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); + Damage (other, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); // Gib dead/dying stuff if(IS_DEAD(other)) - Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); + Damage (other, this, this, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); } #endif - if (self.state == 4) - plat_go_down (self); - else if (self.state == 3) - plat_go_up (self); + if (this.state == 4) + plat_go_down (this); + else if (this.state == 3) + plat_go_up (this); // when in other states, then the plat_crush event came delayed after // plat state already had changed // this isn't a bug per se! diff --git a/qcsrc/common/triggers/subs.qc b/qcsrc/common/triggers/subs.qc index bb92dcca0..6389a03cd 100644 --- a/qcsrc/common/triggers/subs.qc +++ b/qcsrc/common/triggers/subs.qc @@ -7,15 +7,15 @@ void SUB_CalcAngleMoveDone(entity this); ================== SUB_Friction -Applies some friction to self +Applies some friction to this ================== */ .float friction; void SUB_Friction (entity this) { - self.SUB_NEXTTHINK = time; - if(self.SUB_FLAGS & FL_ONGROUND) - self.SUB_VELOCITY = self.SUB_VELOCITY * (1 - frametime * self.friction); + this.SUB_NEXTTHINK = time; + if(this.SUB_FLAGS & FL_ONGROUND) + this.SUB_VELOCITY = this.SUB_VELOCITY * (1 - frametime * this.friction); } /* @@ -75,19 +75,19 @@ void SUB_SetFade (entity ent, float when, float fading_time) ============= SUB_CalcMove -calculate self.SUB_VELOCITY and self.SUB_NEXTTHINK to reach dest from -self.SUB_ORIGIN traveling at speed +calculate this.SUB_VELOCITY and this.SUB_NEXTTHINK to reach dest from +this.SUB_ORIGIN traveling at speed =============== */ void SUB_CalcMoveDone(entity this) { // After moving, set origin to exact final destination - SUB_SETORIGIN (self, self.finaldest); - self.SUB_VELOCITY = '0 0 0'; - self.SUB_NEXTTHINK = -1; - if (self.think1) - self.think1 (self); + SUB_SETORIGIN (this, this.finaldest); + this.SUB_VELOCITY = '0 0 0'; + this.SUB_NEXTTHINK = -1; + if (this.think1) + this.think1 (this); } .float platmovetype_turn; @@ -101,19 +101,19 @@ void SUB_CalcMove_controller_think (entity this) vector veloc; vector angloc; vector nextpos; - delta = self.destvec; - delta2 = self.destvec2; - if(time < self.animstate_endtime) + delta = this.destvec; + delta2 = this.destvec2; + if(time < this.animstate_endtime) { nexttick = time + PHYS_INPUT_FRAMETIME; - traveltime = self.animstate_endtime - self.animstate_starttime; - phasepos = (nexttick - self.animstate_starttime) / traveltime; // range: [0, 1] - phasepos = cubic_speedfunc(self.platmovetype_start, self.platmovetype_end, phasepos); - nextpos = self.origin + (delta * phasepos) + (delta2 * phasepos * phasepos); + traveltime = this.animstate_endtime - this.animstate_starttime; + phasepos = (nexttick - this.animstate_starttime) / traveltime; // range: [0, 1] + phasepos = cubic_speedfunc(this.platmovetype_start, this.platmovetype_end, phasepos); + nextpos = this.origin + (delta * phasepos) + (delta2 * phasepos * phasepos); // derivative: delta + 2 * delta2 * phasepos (e.g. for angle positioning) - if(self.owner.platmovetype_turn) + if(this.owner.platmovetype_turn) { vector destangle; destangle = delta + 2 * delta2 * phasepos; @@ -121,30 +121,30 @@ void SUB_CalcMove_controller_think (entity this) destangle_x = -destangle_x; // flip up / down orientation // take the shortest distance for the angles - vector v = SUB_ANGLES(self.owner); + vector v = SUB_ANGLES(this.owner); v.x -= 360 * floor((v.x - destangle_x) / 360 + 0.5); v.y -= 360 * floor((v.y - destangle_y) / 360 + 0.5); v.z -= 360 * floor((v.z - destangle_z) / 360 + 0.5); - SUB_ANGLES(self.owner) = v; - angloc = destangle - SUB_ANGLES(self.owner); + SUB_ANGLES(this.owner) = v; + angloc = destangle - SUB_ANGLES(this.owner); angloc = angloc * (1 / PHYS_INPUT_FRAMETIME); // so it arrives for the next frame - self.owner.SUB_AVELOCITY = angloc; + this.owner.SUB_AVELOCITY = angloc; } - if(nexttick < self.animstate_endtime) - veloc = nextpos - self.owner.SUB_ORIGIN; + if(nexttick < this.animstate_endtime) + veloc = nextpos - this.owner.SUB_ORIGIN; else - veloc = self.finaldest - self.owner.SUB_ORIGIN; + veloc = this.finaldest - this.owner.SUB_ORIGIN; veloc = veloc * (1 / PHYS_INPUT_FRAMETIME); // so it arrives for the next frame - self.owner.SUB_VELOCITY = veloc; - self.nextthink = nexttick; + this.owner.SUB_VELOCITY = veloc; + this.nextthink = nexttick; } else { // derivative: delta + 2 * delta2 (e.g. for angle positioning) - entity own = self.owner; - SUB_THINK(own, self.think1); - remove(self); + entity own = this.owner; + SUB_THINK(own, this.think1); + remove(this); WITHSELF(own, SUB_THUNK(own)(own)); } } @@ -191,21 +191,21 @@ void SUB_CalcMove_Bezier (entity this, vector tcontrol, vector tdest, float tspe if (!tspeed) objerror ("No speed is defined!"); - self.think1 = func; - self.finaldest = tdest; - SUB_THINK(self, SUB_CalcMoveDone); + this.think1 = func; + this.finaldest = tdest; + SUB_THINK(this, SUB_CalcMoveDone); switch(tspeedtype) { default: case TSPEED_START: - traveltime = 2 * vlen(tcontrol - self.SUB_ORIGIN) / tspeed; + traveltime = 2 * vlen(tcontrol - this.SUB_ORIGIN) / tspeed; break; case TSPEED_END: traveltime = 2 * vlen(tcontrol - tdest) / tspeed; break; case TSPEED_LINEAR: - traveltime = vlen(tdest - self.SUB_ORIGIN) / tspeed; + traveltime = vlen(tdest - this.SUB_ORIGIN) / tspeed; break; case TSPEED_TIME: traveltime = tspeed; @@ -214,26 +214,26 @@ void SUB_CalcMove_Bezier (entity this, vector tcontrol, vector tdest, float tspe if (traveltime < 0.1) // useless anim { - self.SUB_VELOCITY = '0 0 0'; - self.SUB_NEXTTHINK = self.SUB_LTIME + 0.1; + this.SUB_VELOCITY = '0 0 0'; + this.SUB_NEXTTHINK = this.SUB_LTIME + 0.1; return; } controller = new(SUB_CalcMove_controller); - controller.owner = self; - controller.platmovetype = self.platmovetype; - controller.platmovetype_start = self.platmovetype_start; - controller.platmovetype_end = self.platmovetype_end; - SUB_CalcMove_controller_setbezier(controller, self.SUB_ORIGIN, tcontrol, tdest); + controller.owner = this; + controller.platmovetype = this.platmovetype; + controller.platmovetype_start = this.platmovetype_start; + controller.platmovetype_end = this.platmovetype_end; + SUB_CalcMove_controller_setbezier(controller, this.SUB_ORIGIN, tcontrol, tdest); controller.finaldest = (tdest + '0 0 0.125'); // where do we want to end? Offset to overshoot a bit. controller.animstate_starttime = time; controller.animstate_endtime = time + traveltime; setthink(controller, SUB_CalcMove_controller_think); - controller.think1 = SUB_THUNK(self); + controller.think1 = SUB_THUNK(this); // the thinking is now done by the controller - SUB_THINK(self, SUB_NullThink); // for PushMove - self.SUB_NEXTTHINK = self.SUB_LTIME + traveltime; + SUB_THINK(this, SUB_NullThink); // for PushMove + this.SUB_NEXTTHINK = this.SUB_LTIME + traveltime; // invoke controller WITHSELF(controller, getthink(controller)(controller)); @@ -247,18 +247,18 @@ void SUB_CalcMove (entity this, vector tdest, float tspeedtype, float tspeed, vo if (!tspeed) objerror ("No speed is defined!"); - self.think1 = func; - self.finaldest = tdest; - SUB_THINK(self, SUB_CalcMoveDone); + this.think1 = func; + this.finaldest = tdest; + SUB_THINK(this, SUB_CalcMoveDone); - if (tdest == self.SUB_ORIGIN) + if (tdest == this.SUB_ORIGIN) { - self.SUB_VELOCITY = '0 0 0'; - self.SUB_NEXTTHINK = self.SUB_LTIME + 0.1; + this.SUB_VELOCITY = '0 0 0'; + this.SUB_NEXTTHINK = this.SUB_LTIME + 0.1; return; } - delta = tdest - self.SUB_ORIGIN; + delta = tdest - this.SUB_ORIGIN; switch(tspeedtype) { @@ -277,15 +277,15 @@ void SUB_CalcMove (entity this, vector tdest, float tspeedtype, float tspeed, vo // of controlled animation, so let's just use linear movement. // Alternatively entities can choose to specify non-controlled movement. // The only currently implemented alternative movement is linear (value 1) - if (traveltime < 0.15 || (self.platmovetype_start == 1 && self.platmovetype_end == 1)) // is this correct? + if (traveltime < 0.15 || (this.platmovetype_start == 1 && this.platmovetype_end == 1)) // is this correct? { - self.SUB_VELOCITY = delta * (1/traveltime); // QuakeC doesn't allow vector/float division - self.SUB_NEXTTHINK = self.SUB_LTIME + traveltime; + this.SUB_VELOCITY = delta * (1/traveltime); // QuakeC doesn't allow vector/float division + this.SUB_NEXTTHINK = this.SUB_LTIME + traveltime; return; } // now just run like a bezier curve... - SUB_CalcMove_Bezier(self, (self.SUB_ORIGIN + tdest) * 0.5, tdest, tspeedtype, tspeed, func); + SUB_CalcMove_Bezier(this, (this.SUB_ORIGIN + tdest) * 0.5, tdest, tspeedtype, tspeed, func); } void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void(entity this) func) @@ -297,20 +297,20 @@ void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, ============= SUB_CalcAngleMove -calculate self.SUB_AVELOCITY and self.SUB_NEXTTHINK to reach destangle from -self.angles rotating +calculate this.SUB_AVELOCITY and this.SUB_NEXTTHINK to reach destangle from +this.angles rotating -The calling function should make sure self.SUB_THINK is valid +The calling function should make sure this.SUB_THINK is valid =============== */ void SUB_CalcAngleMoveDone(entity this) { // After rotating, set angle to exact final angle - self.angles = self.finalangle; - self.SUB_AVELOCITY = '0 0 0'; - self.SUB_NEXTTHINK = -1; - if (self.think1) - self.think1 (self); + this.angles = this.finalangle; + this.SUB_AVELOCITY = '0 0 0'; + this.SUB_NEXTTHINK = -1; + if (this.think1) + this.think1 (this); } // FIXME: I fixed this function only for rotation around the main axes @@ -323,10 +323,10 @@ void SUB_CalcAngleMove (entity this, vector destangle, float tspeedtype, float t objerror ("No speed is defined!"); // take the shortest distance for the angles - self.angles_x -= 360 * floor((self.angles_x - destangle_x) / 360 + 0.5); - self.angles_y -= 360 * floor((self.angles_y - destangle_y) / 360 + 0.5); - self.angles_z -= 360 * floor((self.angles_z - destangle_z) / 360 + 0.5); - delta = destangle - self.angles; + this.angles_x -= 360 * floor((this.angles_x - destangle_x) / 360 + 0.5); + this.angles_y -= 360 * floor((this.angles_y - destangle_y) / 360 + 0.5); + this.angles_z -= 360 * floor((this.angles_z - destangle_z) / 360 + 0.5); + delta = destangle - this.angles; switch(tspeedtype) { @@ -341,19 +341,19 @@ void SUB_CalcAngleMove (entity this, vector destangle, float tspeedtype, float t break; } - self.think1 = func; - self.finalangle = destangle; - SUB_THINK(self, SUB_CalcAngleMoveDone); + this.think1 = func; + this.finalangle = destangle; + SUB_THINK(this, SUB_CalcAngleMoveDone); if (traveltime < 0.1) { - self.SUB_AVELOCITY = '0 0 0'; - self.SUB_NEXTTHINK = self.SUB_LTIME + 0.1; + this.SUB_AVELOCITY = '0 0 0'; + this.SUB_NEXTTHINK = this.SUB_LTIME + 0.1; return; } - self.SUB_AVELOCITY = delta * (1 / traveltime); - self.SUB_NEXTTHINK = self.SUB_LTIME + traveltime; + this.SUB_AVELOCITY = delta * (1 / traveltime); + this.SUB_NEXTTHINK = this.SUB_LTIME + traveltime; } void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void(entity this) func) diff --git a/qcsrc/common/triggers/target/music.qc b/qcsrc/common/triggers/target/music.qc index 94c15c17a..48330d460 100644 --- a/qcsrc/common/triggers/target/music.qc +++ b/qcsrc/common/triggers/target/music.qc @@ -254,18 +254,18 @@ void Net_TargetMusic() void Ent_TriggerMusic_Think(entity this) { - if(WarpZoneLib_BoxTouchesBrush(view_origin, view_origin, self, world)) + if(WarpZoneLib_BoxTouchesBrush(view_origin, view_origin, this, world)) { - music_trigger = self; + music_trigger = this; } - self.nextthink = time; + this.nextthink = time; } void Ent_TriggerMusic_Remove(entity this) { - if(self.noise) - strunzone(self.noise); - self.noise = string_null; + if(this.noise) + strunzone(this.noise); + this.noise = string_null; } NET_HANDLE(ENT_CLIENT_TRIGGER_MUSIC, bool isnew) diff --git a/qcsrc/common/triggers/target/spawn.qc b/qcsrc/common/triggers/target/spawn.qc index a7c0c9351..a570c2a64 100644 --- a/qcsrc/common/triggers/target/spawn.qc +++ b/qcsrc/common/triggers/target/spawn.qc @@ -23,12 +23,12 @@ float target_spawn_count; void target_spawn_helper_setmodel(entity this) { - _setmodel(self, self.model); + _setmodel(this, this.model); } void target_spawn_helper_setsize(entity this) { - setsize(self, self.mins, self.maxs); + setsize(this, this.mins, this.maxs); } void target_spawn_edit_entity(entity this, entity e, string msg, entity kt, entity t2, entity t3, entity t4, entity act, entity trigger) diff --git a/qcsrc/common/triggers/trigger/gravity.qc b/qcsrc/common/triggers/trigger/gravity.qc index 197ea9271..4472b572e 100644 --- a/qcsrc/common/triggers/trigger/gravity.qc +++ b/qcsrc/common/triggers/trigger/gravity.qc @@ -15,20 +15,20 @@ void trigger_gravity_remove(entity own) void trigger_gravity_check_think(entity this) { // This spawns when a player enters the gravity zone and checks if he left. - // Each frame, self.count is set to 2 by trigger_gravity_touch() and decreased by 1 here. + // Each frame, this.count is set to 2 by trigger_gravity_touch() and decreased by 1 here. // It the player has left the gravity trigger, this will be allowed to reach 0 and indicate that. - if(self.count <= 0) + if(this.count <= 0) { - if(self.owner.trigger_gravity_check == self) - trigger_gravity_remove(self.owner); + if(this.owner.trigger_gravity_check == this) + trigger_gravity_remove(this.owner); else - remove(self); + remove(this); return; } else { - self.count -= 1; - self.nextthink = time; + this.count -= 1; + this.nextthink = time; } } @@ -41,18 +41,18 @@ void trigger_gravity_touch(entity this) { float g; - if(self.state != true) + if(this.state != true) return; EXACTTRIGGER_TOUCH; - g = self.gravity; + g = this.gravity; - if (!(self.spawnflags & 1)) + if (!(this.spawnflags & 1)) { if(other.trigger_gravity_check) { - if(self == other.trigger_gravity_check.enemy) + if(this == other.trigger_gravity_check.enemy) { // same? other.trigger_gravity_check.count = 2; // gravity one more frame... @@ -60,13 +60,13 @@ void trigger_gravity_touch(entity this) } // compare prio - if(self.cnt > other.trigger_gravity_check.enemy.cnt) + if(this.cnt > other.trigger_gravity_check.enemy.cnt) trigger_gravity_remove(other); else return; } other.trigger_gravity_check = spawn(); - other.trigger_gravity_check.enemy = self; + 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); @@ -79,9 +79,9 @@ void trigger_gravity_touch(entity this) if (other.gravity != g) { other.gravity = g; - if(self.noise != "") - _sound (other, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); - UpdateCSQCProjectile(self.owner); + if(this.noise != "") + _sound (other, 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 25d824d7a..41519e20c 100644 --- a/qcsrc/common/triggers/trigger/heal.qc +++ b/qcsrc/common/triggers/trigger/heal.qc @@ -2,7 +2,7 @@ .float triggerhealtime; void trigger_heal_touch(entity this) { - if (self.active != ACTIVE_ACTIVE) + if (this.active != ACTIVE_ACTIVE) return; // only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu) @@ -15,11 +15,11 @@ void trigger_heal_touch(entity this) EXACTTRIGGER_TOUCH; other.triggerhealtime = time + 1; - if (other.health < self.max_health) + if (other.health < this.max_health) { - other.health = min(other.health + self.health, self.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, self.noise, VOL_BASE, ATTEN_NORM); + _sound (other, 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 82199a393..69653ad3c 100644 --- a/qcsrc/common/triggers/trigger/hurt.qc +++ b/qcsrc/common/triggers/trigger/hurt.qc @@ -10,11 +10,11 @@ void trigger_hurt_use(entity this, entity actor, entity trigger) .float triggerhurttime; void trigger_hurt_touch(entity this) { - if (self.active != ACTIVE_ACTIVE) + if (this.active != ACTIVE_ACTIVE) return; - if(self.team) - if(((self.spawnflags & 4) == 0) == (self.team != other.team)) + if(this.team) + if(((this.spawnflags & 4) == 0) == (this.team != other.team)) return; // only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu) @@ -27,14 +27,14 @@ void trigger_hurt_touch(entity this) other.triggerhurttime = time + 1; entity own; - own = self.enemy; + own = this.enemy; if (!IS_PLAYER(own)) { - own = self; - self.enemy = world; // I still hate you all + own = this; + this.enemy = world; // I still hate you all } - Damage (other, self, own, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); + Damage (other, this, own, this.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); } } else if(other.damagedbytriggers) @@ -42,7 +42,7 @@ void trigger_hurt_touch(entity this) if(other.takedamage) { EXACTTRIGGER_TOUCH; - Damage(other, self, self, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); + Damage(other, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); } } diff --git a/qcsrc/common/triggers/trigger/impulse.qc b/qcsrc/common/triggers/trigger/impulse.qc index d45a82b53..c174aa513 100644 --- a/qcsrc/common/triggers/trigger/impulse.qc +++ b/qcsrc/common/triggers/trigger/impulse.qc @@ -5,7 +5,7 @@ void trigger_impulse_touch1(entity this) float pushdeltatime; float str; - if (self.active != ACTIVE_ACTIVE) + if (this.active != ACTIVE_ACTIVE) return; if (!isPushable(other)) @@ -13,55 +13,55 @@ void trigger_impulse_touch1(entity this) EXACTTRIGGER_TOUCH; - targ = find(world, targetname, self.target); + targ = find(world, targetname, this.target); if(!targ) { objerror("trigger_force without a (valid) .target!\n"); - remove(self); + remove(this); return; } #ifdef SVQC - str = min(self.radius, vlen(self.origin - other.origin)); + str = min(this.radius, vlen(this.origin - other.origin)); #elif defined(CSQC) - str = min(self.radius, vlen(self.origin - other.move_origin)); + str = min(this.radius, vlen(this.origin - other.move_origin)); #endif - if(self.falloff == 1) - str = (str / self.radius) * self.strength; - else if(self.falloff == 2) - str = (1 - (str / self.radius)) * self.strength; + if(this.falloff == 1) + str = (str / this.radius) * this.strength; + else if(this.falloff == 2) + str = (1 - (str / this.radius)) * this.strength; else - str = self.strength; + str = this.strength; pushdeltatime = time - other.lastpushtime; if (pushdeltatime > 0.15) pushdeltatime = 0; other.lastpushtime = time; if(!pushdeltatime) return; - if(self.spawnflags & 64) + if(this.spawnflags & 64) { #ifdef SVQC - float addspeed = str - other.velocity * normalize(targ.origin - self.origin); + float addspeed = str - other.velocity * normalize(targ.origin - this.origin); if (addspeed > 0) { float accelspeed = min(8 * pushdeltatime * str, addspeed); - other.velocity += accelspeed * normalize(targ.origin - self.origin); + other.velocity += accelspeed * normalize(targ.origin - this.origin); } #elif defined(CSQC) - float addspeed = str - other.move_velocity * normalize(targ.origin - self.origin); + float addspeed = str - other.move_velocity * normalize(targ.origin - this.origin); if (addspeed > 0) { float accelspeed = min(8 * pushdeltatime * str, addspeed); - other.move_velocity += accelspeed * normalize(targ.origin - self.origin); + other.move_velocity += accelspeed * normalize(targ.origin - this.origin); } #endif } else #ifdef SVQC - other.velocity = other.velocity + normalize(targ.origin - self.origin) * str * pushdeltatime; + other.velocity = other.velocity + normalize(targ.origin - this.origin) * str * pushdeltatime; #elif defined(CSQC) - other.move_velocity = other.move_velocity + normalize(targ.origin - self.origin) * str * pushdeltatime; + other.move_velocity = other.move_velocity + normalize(targ.origin - this.origin) * str * pushdeltatime; #endif #ifdef SVQC @@ -78,7 +78,7 @@ void trigger_impulse_touch2(entity this) { float pushdeltatime; - if (self.active != ACTIVE_ACTIVE) + if (this.active != ACTIVE_ACTIVE) return; if (!isPushable(other)) @@ -93,11 +93,11 @@ void trigger_impulse_touch2(entity this) // div0: ticrate independent, 1 = identity (not 20) #ifdef SVQC - other.velocity = other.velocity * pow(self.strength, pushdeltatime); + other.velocity = other.velocity * pow(this.strength, pushdeltatime); UpdateCSQCProjectile(other); #elif defined(CSQC) - other.move_velocity = other.move_velocity * pow(self.strength, pushdeltatime); + other.move_velocity = other.move_velocity * pow(this.strength, pushdeltatime); #endif } @@ -107,7 +107,7 @@ void trigger_impulse_touch3(entity this) float pushdeltatime; float str; - if (self.active != ACTIVE_ACTIVE) + if (this.active != ACTIVE_ACTIVE) return; if (!isPushable(other)) @@ -120,27 +120,27 @@ void trigger_impulse_touch3(entity this) other.lastpushtime = time; if(!pushdeltatime) return; - setsize(self, '-1 -1 -1' * self.radius,'1 1 1' * self.radius); + setsize(this, '-1 -1 -1' * this.radius,'1 1 1' * this.radius); #ifdef SVQC - str = min(self.radius, vlen(self.origin - other.origin)); + str = min(this.radius, vlen(this.origin - other.origin)); #elif defined(CSQC) - str = min(self.radius, vlen(self.origin - other.move_origin)); + str = min(this.radius, vlen(this.origin - other.move_origin)); #endif - if(self.falloff == 1) - str = (1 - str / self.radius) * self.strength; // 1 in the inside - else if(self.falloff == 2) - str = (str / self.radius) * self.strength; // 0 in the inside + if(this.falloff == 1) + str = (1 - str / this.radius) * this.strength; // 1 in the inside + else if(this.falloff == 2) + str = (str / this.radius) * this.strength; // 0 in the inside else - str = self.strength; + str = this.strength; #ifdef SVQC - other.velocity = other.velocity + normalize(other.origin - self.origin) * str * pushdeltatime; + other.velocity = other.velocity + normalize(other.origin - this.origin) * str * pushdeltatime; UpdateCSQCProjectile(other); #elif defined(CSQC) - other.move_velocity = other.move_velocity + normalize(other.move_origin - self.origin) * str * pushdeltatime; + other.move_velocity = other.move_velocity + normalize(other.move_origin - this.origin) * str * pushdeltatime; #endif } diff --git a/qcsrc/common/triggers/trigger/keylock.qc b/qcsrc/common/triggers/trigger/keylock.qc index e90eb1853..c8ff29cb7 100644 --- a/qcsrc/common/triggers/trigger/keylock.qc +++ b/qcsrc/common/triggers/trigger/keylock.qc @@ -28,53 +28,53 @@ void trigger_keylock_touch(entity this) return; // check silver key - if(self.itemkeys) - key_used = item_keys_usekey(self, other); + if(this.itemkeys) + key_used = item_keys_usekey(this, other); - if(self.itemkeys) + if(this.itemkeys) { #ifdef SVQC // at least one of the keys is missing if(key_used) { // one or more keys were given, but others are still missing! - play2(other, self.noise1); - Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_ALSONEED, item_keys_keylist(self.itemkeys)); + 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; } else if(other.key_door_messagetime <= time) { // no keys were given - play2(other, self.noise2); - Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_NEED, item_keys_keylist(self.itemkeys)); + 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; } #endif // trigger target2 - if(self.delay <= time || started_delay == true) - if(self.target2) + if(this.delay <= time || started_delay == true) + if(this.target2) { - trigger_keylock_trigger(this, other, self.target2); + trigger_keylock_trigger(this, other, this.target2); started_delay = true; - self.delay = time + self.wait; + this.delay = time + this.wait; } } else { #ifdef SVQC // all keys were given! - play2(other, self.noise); - centerprint(other, self.message); + play2(other, this.noise); + centerprint(other, this.message); #endif - if(self.target) - trigger_keylock_trigger(this, other, self.target); + if(this.target) + trigger_keylock_trigger(this, other, this.target); - if(self.killtarget) - trigger_keylock_kill(self.killtarget); + if(this.killtarget) + trigger_keylock_kill(this.killtarget); - remove(self); + remove(this); } } diff --git a/qcsrc/common/triggers/trigger/multi.qc b/qcsrc/common/triggers/trigger/multi.qc index 435255727..539c3f065 100644 --- a/qcsrc/common/triggers/trigger/multi.qc +++ b/qcsrc/common/triggers/trigger/multi.qc @@ -68,33 +68,33 @@ void multi_use(entity this, entity actor, entity trigger) void multi_touch(entity this) { - if(!(self.spawnflags & 2)) + if(!(this.spawnflags & 2)) if(!other.iscreature) return; - if(self.team) - if(((self.spawnflags & 4) == 0) == (self.team != other.team)) + if(this.team) + if(((this.spawnflags & 4) == 0) == (this.team != other.team)) return; // if the trigger has an angles field, check player's facing direction - if (self.movedir != '0 0 0') + if (this.movedir != '0 0 0') { makevectors (other.angles); - if (v_forward * self.movedir < 0) + 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(self.pressedkeys) + if(this.pressedkeys) if(IS_PLAYER(other)) // only for players - if(!(other.pressedkeys & self.pressedkeys)) + if(!(other.pressedkeys & this.pressedkeys)) return; EXACTTRIGGER_TOUCH; - self.enemy = other; - self.goalentity = other; - multi_trigger(self); + this.enemy = other; + this.goalentity = other; + multi_trigger(this); } void multi_eventdamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) diff --git a/qcsrc/common/triggers/trigger/secret.qc b/qcsrc/common/triggers/trigger/secret.qc index 5707a0ac3..bf4178bea 100644 --- a/qcsrc/common/triggers/trigger/secret.qc +++ b/qcsrc/common/triggers/trigger/secret.qc @@ -29,12 +29,12 @@ void trigger_secret_touch(entity this) //print(ftos(secret_counter.count), "\n"); // centerprint message (multi_touch() doesn't always call centerprint()) - centerprint(other, self.message); - self.message = ""; + centerprint(other, this.message); + this.message = ""; // handle normal trigger features - multi_touch(self); - remove(self); + multi_touch(this); + remove(this); } /*QUAKED trigger_secret (.5 .5 .5) ? diff --git a/qcsrc/common/triggers/trigger/swamp.qc b/qcsrc/common/triggers/trigger/swamp.qc index 3a1cf9530..fb792b94b 100644 --- a/qcsrc/common/triggers/trigger/swamp.qc +++ b/qcsrc/common/triggers/trigger/swamp.qc @@ -39,14 +39,14 @@ void swampslug_think(entity this); void swampslug_think(entity this) { //Slowly kill the slug - self.health = self.health - 1; + this.health = this.health - 1; //Slug dead? then remove curses. - if(self.health <= 0) + if(this.health <= 0) { - self.owner.in_swamp = 0; - remove(self); - //centerprint(self.owner,"Killing slug...\n"); + this.owner.in_swamp = 0; + remove(this); + //centerprint(this.owner,"Killing slug...\n"); return; } @@ -54,10 +54,10 @@ void swampslug_think(entity this) // Or we have exited it very recently. // Do the damage and renew the timer. #ifdef SVQC - Damage (self.owner, self, self, self.dmg, DEATH_SWAMP.m_id, other.origin, '0 0 0'); + Damage (this.owner, this, this, this.dmg, DEATH_SWAMP.m_id, other.origin, '0 0 0'); #endif - self.nextthink = time + self.swamp_interval; + this.nextthink = time + this.swamp_interval; } void swamp_touch(entity this) @@ -79,9 +79,9 @@ void swamp_touch(entity this) setthink(other.swampslug, swampslug_think); other.swampslug.nextthink = time; other.swampslug.owner = other; - other.swampslug.dmg = self.dmg; - other.swampslug.swamp_interval = self.swamp_interval; - other.swamp_slowdown = self.swamp_slowdown; + other.swampslug.dmg = this.dmg; + other.swampslug.swamp_interval = this.swamp_interval; + other.swamp_slowdown = this.swamp_slowdown; other.in_swamp = 1; return; } diff --git a/qcsrc/common/triggers/trigger/teleport.qc b/qcsrc/common/triggers/trigger/teleport.qc index 54777b75c..8caa2d5eb 100644 --- a/qcsrc/common/triggers/trigger/teleport.qc +++ b/qcsrc/common/triggers/trigger/teleport.qc @@ -13,7 +13,7 @@ void trigger_teleport_use(entity this, entity actor, entity trigger) void Teleport_Touch (entity this) { - if (self.active != ACTIVE_ACTIVE) + if (this.active != ACTIVE_ACTIVE) return; #ifdef SVQC @@ -34,8 +34,8 @@ void Teleport_Touch (entity this) if(IS_DEAD(other)) return; - if(self.team) - if(((self.spawnflags & 4) == 0) == (DIFF_TEAM(this, other))) + if(this.team) + if(((this.spawnflags & 4) == 0) == (DIFF_TEAM(this, other))) return; EXACTTRIGGER_TOUCH; @@ -46,12 +46,12 @@ void Teleport_Touch (entity this) #endif entity e; - e = Simple_TeleportPlayer(self, other); + e = Simple_TeleportPlayer(this, other); #ifdef SVQC - string s = self.target; self.target = string_null; - SUB_UseTargets(self, other, other); // TODO: should we be using other for trigger too? - if (!self.target) self.target = s; + string s = this.target; this.target = string_null; + SUB_UseTargets(this, other, other); // TODO: should we be using other for trigger too? + if (!this.target) this.target = s; SUB_UseTargets(e, other, other); #endif diff --git a/qcsrc/common/triggers/trigger/viewloc.qc b/qcsrc/common/triggers/trigger/viewloc.qc index d65fe953f..9e4ab5068 100644 --- a/qcsrc/common/triggers/trigger/viewloc.qc +++ b/qcsrc/common/triggers/trigger/viewloc.qc @@ -17,27 +17,27 @@ void viewloc_think(entity this) // we abuse this method, rather than using normal .touch, because touch isn't reliable with multiple clients inside the same trigger, and can't "untouch" entities // set myself as current viewloc where possible - for(e = world; (e = findentity(e, viewloc, self)); ) + for(e = world; (e = findentity(e, viewloc, this)); ) e.viewloc = world; - for(e = findradius((self.absmin + self.absmax) * 0.5, vlen(self.absmax - self.absmin) * 0.5 + 1); e; e = e.chain) + for(e = findradius((this.absmin + this.absmax) * 0.5, vlen(this.absmax - this.absmin) * 0.5 + 1); e; e = e.chain) if(!e.viewloc) if(IS_PLAYER(e)) // should we support non-player entities with this? //if(!IS_DEAD(e)) // death view is handled separately, we can't override this just yet { vector emin = e.absmin; vector emax = e.absmax; - if(self.solid == SOLID_BSP) + if(this.solid == SOLID_BSP) { emin -= '1 1 1'; emax += '1 1 1'; } - if(boxesoverlap(emin, emax, self.absmin, self.absmax)) // quick - if(WarpZoneLib_BoxTouchesBrush(emin, emax, self, e)) // accurate - e.viewloc = self; + if(boxesoverlap(emin, emax, this.absmin, this.absmax)) // quick + if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, e)) // accurate + e.viewloc = this; } - self.nextthink = time; + this.nextthink = time; } bool trigger_viewloc_send(entity this, entity to, int sf) @@ -136,8 +136,8 @@ spawnfunc(target_viewlocation) { spawnfunc_target_viewlocation_start(this); } void trigger_viewloc_updatelink(entity this) { - self.enemy = findfloat(world, entnum, self.cnt); - self.goalentity = findfloat(world, entnum, self.count); + this.enemy = findfloat(world, entnum, this.cnt); + this.goalentity = findfloat(world, entnum, this.count); } NET_HANDLE(ENT_CLIENT_VIEWLOC_TRIGGER, bool isnew) diff --git a/qcsrc/common/triggers/triggers.qc b/qcsrc/common/triggers/triggers.qc index d9c6a0812..d7d988f51 100644 --- a/qcsrc/common/triggers/triggers.qc +++ b/qcsrc/common/triggers/triggers.qc @@ -170,16 +170,16 @@ SUB_UseTargets the global "activator" should be set to the entity that initiated the firing. -If self.delay is set, a DelayedUse entity will be created that will actually +If this.delay is set, a DelayedUse entity will be created that will actually do the SUB_UseTargets after that many seconds have passed. -Centerprints any self.message to the activator. +Centerprints any this.message to the activator. -Removes all entities with a targetname that match self.killtarget, +Removes all entities with a targetname that match this.killtarget, and removes them, so some events can remove other triggers. Search for (string)targetname in all entities that -match (string)self.target and call their .use function +match (string)this.target and call their .use function ============================== */ diff --git a/qcsrc/common/triggers/triggers.qh b/qcsrc/common/triggers/triggers.qh index 5e24781e6..82c0916c1 100644 --- a/qcsrc/common/triggers/triggers.qh +++ b/qcsrc/common/triggers/triggers.qh @@ -16,7 +16,7 @@ const float SPAWNFLAG_NOTOUCH = 1; .float height; .float nottargeted; -#define IFTARGETED if(!self.nottargeted && self.targetname != "") +#define IFTARGETED if(!this.nottargeted && this.targetname != "") .float lip; diff --git a/qcsrc/common/turrets/checkpoint.qc b/qcsrc/common/turrets/checkpoint.qc index a5e758e0e..46526df4d 100644 --- a/qcsrc/common/turrets/checkpoint.qc +++ b/qcsrc/common/turrets/checkpoint.qc @@ -16,14 +16,10 @@ /* entity path_makeorcache(entity forwho,entity start, entity end) { - entity oldself; entity pth; - oldself = self; - self = forwho; - //pth = pathlib_makepath(start.origin,end.origin,PFL_GROUNDSNAP,500,1.5,PT_QUICKSTAR); + //pth = pathlib_makepath(forwho, start.origin,end.origin,PFL_GROUNDSNAP,500,1.5,PT_QUICKSTAR); - self = oldself; return pth; } */ diff --git a/qcsrc/common/turrets/cl_turrets.qc b/qcsrc/common/turrets/cl_turrets.qc index 63b30bc35..347a5ff83 100644 --- a/qcsrc/common/turrets/cl_turrets.qc +++ b/qcsrc/common/turrets/cl_turrets.qc @@ -316,41 +316,41 @@ entity turret_gibtoss(string _model, vector _from, vector _to, vector _cmod, flo void turret_die(entity this) { - sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); - pointparticles(EFFECT_ROCKET_EXPLODE, self.origin, '0 0 0', 1); + sound (this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); + pointparticles(EFFECT_ROCKET_EXPLODE, this.origin, '0 0 0', 1); if (!autocvar_cl_nogibs) { // Base - if(self.m_id == TUR_EWHEEL.m_id) - turret_gibtoss((get_turretinfo(self.m_id)).model, self.origin + '0 0 18', self.velocity + '0 0 400' + '0.1 0.1 1' * (random() * 400), '-1 -1 -1', true); - else if (self.m_id == TUR_WALKER.m_id) - turret_gibtoss((get_turretinfo(self.m_id)).model, self.origin + '0 0 18', self.velocity + '0 0 300' + '0.1 0.1 1' * (random() * 200), '-1 -1 -1', true); - else if (self.m_id == TUR_TESLA.m_id) - turret_gibtoss((get_turretinfo(self.m_id)).model, self.origin + '0 0 18', '0 0 200', '-1 -1 -1', false); + if(this.m_id == TUR_EWHEEL.m_id) + turret_gibtoss((get_turretinfo(this.m_id)).model, this.origin + '0 0 18', this.velocity + '0 0 400' + '0.1 0.1 1' * (random() * 400), '-1 -1 -1', true); + else if (this.m_id == TUR_WALKER.m_id) + turret_gibtoss((get_turretinfo(this.m_id)).model, this.origin + '0 0 18', this.velocity + '0 0 300' + '0.1 0.1 1' * (random() * 200), '-1 -1 -1', true); + else if (this.m_id == TUR_TESLA.m_id) + turret_gibtoss((get_turretinfo(this.m_id)).model, this.origin + '0 0 18', '0 0 200', '-1 -1 -1', false); else { if (random() > 0.5) { - turret_gibtoss("models/turrets/base-gib2.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false); - turret_gibtoss("models/turrets/base-gib3.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false); - turret_gibtoss("models/turrets/base-gib4.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false); + turret_gibtoss("models/turrets/base-gib2.md3", this.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false); + turret_gibtoss("models/turrets/base-gib3.md3", this.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false); + turret_gibtoss("models/turrets/base-gib4.md3", this.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false); } else - turret_gibtoss("models/turrets/base-gib1.md3", self.origin + '0 0 8', '0 0 0', '0 0 0', true); + turret_gibtoss("models/turrets/base-gib1.md3", this.origin + '0 0 8', '0 0 0', '0 0 0', true); - entity headgib = turret_gibtoss((get_turretinfo(self.m_id)).head_model, self.origin + '0 0 32', '0 0 200' + randomvec() * 200, '-1 -1 -1', true); + entity headgib = turret_gibtoss((get_turretinfo(this.m_id)).head_model, this.origin + '0 0 32', '0 0 200' + randomvec() * 200, '-1 -1 -1', true); if(headgib) { - headgib.angles = headgib.move_angles = self.tur_head.angles; - headgib.avelocity = headgib.move_avelocity = self.tur_head.move_avelocity + randomvec() * 45; + headgib.angles = headgib.move_angles = this.tur_head.angles; + headgib.avelocity = headgib.move_avelocity = this.tur_head.move_avelocity + randomvec() * 45; headgib.avelocity_y = headgib.move_avelocity_y = headgib.move_avelocity_y * 5; headgib.gravity = 0.5; } } } - setmodel(self, MDL_Null); - setmodel(self.tur_head, MDL_Null); + setmodel(this, MDL_Null); + setmodel(this.tur_head, MDL_Null); } NET_HANDLE(ENT_CLIENT_TURRET, bool isnew) diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc index de6ff767e..1c87cbb45 100644 --- a/qcsrc/common/turrets/sv_turrets.qc +++ b/qcsrc/common/turrets/sv_turrets.qc @@ -166,44 +166,44 @@ float turret_targetscore_generic(entity _turret, entity _target) // Generic damage handling void turret_hide(entity this) { - self.effects |= EF_NODRAW; - self.nextthink = time + self.respawntime - 0.2; - setthink(self, turret_respawn); + this.effects |= EF_NODRAW; + this.nextthink = time + this.respawntime - 0.2; + setthink(this, turret_respawn); } void turret_die(entity this) { - self.deadflag = DEAD_DEAD; - self.tur_head.deadflag = self.deadflag; + this.deadflag = DEAD_DEAD; + this.tur_head.deadflag = this.deadflag; // Unsolidify and hide real parts - self.solid = SOLID_NOT; - self.tur_head.solid = self.solid; + this.solid = SOLID_NOT; + this.tur_head.solid = this.solid; - self.event_damage = func_null; - self.takedamage = DAMAGE_NO; + this.event_damage = func_null; + this.takedamage = DAMAGE_NO; - self.health = 0; + this.health = 0; // Go boom - //RadiusDamage (self,self, min(self.ammo,50),min(self.ammo,50) * 0.25,250,world,min(self.ammo,50)*5,DEATH_TURRET,world); + //RadiusDamage (this,this, min(this.ammo,50),min(this.ammo,50) * 0.25,250,world,min(this.ammo,50)*5,DEATH_TURRET,world); - Turret tur = get_turretinfo(self.m_id); - if(self.damage_flags & TFL_DMG_DEATH_NORESPAWN) + Turret tur = get_turretinfo(this.m_id); + if(this.damage_flags & TFL_DMG_DEATH_NORESPAWN) { - tur.tr_death(tur, self); + tur.tr_death(tur, this); - remove(self.tur_head); - remove(self); + remove(this.tur_head); + remove(this); } else { // Setup respawn - self.SendFlags |= TNSF_STATUS; - self.nextthink = time + 0.2; - setthink(self, turret_hide); + this.SendFlags |= TNSF_STATUS; + this.nextthink = time + 0.2; + setthink(this, turret_hide); - tur.tr_death(tur, self); + tur.tr_death(tur, this); } } @@ -256,28 +256,28 @@ void turret_respawn(entity this) { // Make sure all parts belong to the same team since // this function doubles as "teamchange" function. - self.tur_head.team = self.team; - self.effects &= ~EF_NODRAW; - self.deadflag = DEAD_NO; - self.effects = EF_LOWPRECISION; - self.solid = SOLID_BBOX; - self.takedamage = DAMAGE_AIM; - self.event_damage = turret_damage; - self.avelocity = '0 0 0'; - self.tur_head.avelocity = self.avelocity; - self.tur_head.angles = self.idle_aim; - self.health = self.max_health; - self.enemy = world; - self.volly_counter = self.shot_volly; - self.ammo = self.ammo_max; - - self.nextthink = time + self.ticrate; - setthink(self, turret_think); - - self.SendFlags = TNSF_FULL_UPDATE; - - Turret tur = get_turretinfo(self.m_id); - tur.tr_setup(tur, self); + this.tur_head.team = this.team; + this.effects &= ~EF_NODRAW; + this.deadflag = DEAD_NO; + this.effects = EF_LOWPRECISION; + this.solid = SOLID_BBOX; + this.takedamage = DAMAGE_AIM; + this.event_damage = turret_damage; + this.avelocity = '0 0 0'; + this.tur_head.avelocity = this.avelocity; + this.tur_head.angles = this.idle_aim; + this.health = this.max_health; + this.enemy = world; + this.volly_counter = this.shot_volly; + this.ammo = this.ammo_max; + + this.nextthink = time + this.ticrate; + setthink(this, turret_think); + + this.SendFlags = TNSF_FULL_UPDATE; + + Turret tur = get_turretinfo(this.m_id); + tur.tr_setup(tur, this); } @@ -306,55 +306,55 @@ bool turret_send(entity this, entity to, float sf) WriteByte(MSG_ENTITY, sf); if(sf & TNSF_SETUP) { - WriteByte(MSG_ENTITY, self.m_id); + WriteByte(MSG_ENTITY, this.m_id); - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, this.origin_x); + WriteCoord(MSG_ENTITY, this.origin_y); + WriteCoord(MSG_ENTITY, this.origin_z); - WriteAngle(MSG_ENTITY, self.angles_x); - WriteAngle(MSG_ENTITY, self.angles_y); + WriteAngle(MSG_ENTITY, this.angles_x); + WriteAngle(MSG_ENTITY, this.angles_y); } if(sf & TNSF_ANG) { - WriteShort(MSG_ENTITY, rint(self.tur_head.angles_x)); - WriteShort(MSG_ENTITY, rint(self.tur_head.angles_y)); + WriteShort(MSG_ENTITY, rint(this.tur_head.angles_x)); + WriteShort(MSG_ENTITY, rint(this.tur_head.angles_y)); } if(sf & TNSF_AVEL) { - WriteShort(MSG_ENTITY, rint(self.tur_head.avelocity_x)); - WriteShort(MSG_ENTITY, rint(self.tur_head.avelocity_y)); + WriteShort(MSG_ENTITY, rint(this.tur_head.avelocity_x)); + WriteShort(MSG_ENTITY, rint(this.tur_head.avelocity_y)); } if(sf & TNSF_MOVE) { - WriteShort(MSG_ENTITY, rint(self.origin_x)); - WriteShort(MSG_ENTITY, rint(self.origin_y)); - WriteShort(MSG_ENTITY, rint(self.origin_z)); + WriteShort(MSG_ENTITY, rint(this.origin_x)); + WriteShort(MSG_ENTITY, rint(this.origin_y)); + WriteShort(MSG_ENTITY, rint(this.origin_z)); - WriteShort(MSG_ENTITY, rint(self.velocity_x)); - WriteShort(MSG_ENTITY, rint(self.velocity_y)); - WriteShort(MSG_ENTITY, rint(self.velocity_z)); + WriteShort(MSG_ENTITY, rint(this.velocity_x)); + WriteShort(MSG_ENTITY, rint(this.velocity_y)); + WriteShort(MSG_ENTITY, rint(this.velocity_z)); - WriteShort(MSG_ENTITY, rint(self.angles_y)); + WriteShort(MSG_ENTITY, rint(this.angles_y)); } if(sf & TNSF_ANIM) { - WriteCoord(MSG_ENTITY, self.anim_start_time); - WriteByte(MSG_ENTITY, self.frame); + WriteCoord(MSG_ENTITY, this.anim_start_time); + WriteByte(MSG_ENTITY, this.frame); } if(sf & TNSF_STATUS) { - WriteByte(MSG_ENTITY, self.team); + WriteByte(MSG_ENTITY, this.team); - if(self.health <= 0) + if(this.health <= 0) WriteByte(MSG_ENTITY, 0); else - WriteByte(MSG_ENTITY, ceil((self.health / self.max_health) * 255)); + WriteByte(MSG_ENTITY, ceil((this.health / this.max_health) * 255)); } return true; @@ -430,17 +430,17 @@ void load_unit_settings(entity ent, bool is_reload) void turret_projectile_explode(entity this) { - self.takedamage = DAMAGE_NO; - self.event_damage = func_null; + this.takedamage = DAMAGE_NO; + this.event_damage = func_null; #ifdef TURRET_DEBUG float d; - d = RadiusDamage (self, self.owner, self.owner.shot_dmg, 0, self.owner.shot_radius, self, world, self.owner.shot_force, self.totalfrags, world); - self.owner.tur_debug_dmg_t_h = self.owner.tur_debug_dmg_t_h + d; - self.owner.tur_debug_dmg_t_f = self.owner.tur_debug_dmg_t_f + self.owner.shot_dmg; + d = RadiusDamage (this, this.owner, this.owner.shot_dmg, 0, this.owner.shot_radius, this, world, this.owner.shot_force, this.totalfrags, world); + this.owner.tur_debug_dmg_t_h = this.owner.tur_debug_dmg_t_h + d; + this.owner.tur_debug_dmg_t_f = this.owner.tur_debug_dmg_t_f + this.owner.shot_dmg; #else - RadiusDamage (self, self.realowner, self.owner.shot_dmg, 0, self.owner.shot_radius, self, world, self.owner.shot_force, self.totalfrags, world); + RadiusDamage (this, this.realowner, this.owner.shot_dmg, 0, this.owner.shot_radius, this, world, this.owner.shot_force, this.totalfrags, world); #endif - remove(self); + remove(this); } void turret_projectile_touch(entity this) diff --git a/qcsrc/common/turrets/turret.qh b/qcsrc/common/turrets/turret.qh index 5ac3c2ef6..151797b6d 100644 --- a/qcsrc/common/turrets/turret.qh +++ b/qcsrc/common/turrets/turret.qh @@ -48,7 +48,7 @@ CLASS(Turret, Object) METHOD(Turret, tr_attack, void(Turret this, entity it)) { Weapon w = this.m_weapon; .entity weaponentity = weaponentities[0]; - w.wr_think(w, self, weaponentity, 1); + w.wr_think(w, this, weaponentity, 1); } #endif /** (ALL) */ diff --git a/qcsrc/common/turrets/turret/ewheel.qc b/qcsrc/common/turrets/turret/ewheel.qc index 9debc63cc..2d01c36d5 100644 --- a/qcsrc/common/turrets/turret/ewheel.qc +++ b/qcsrc/common/turrets/turret/ewheel.qc @@ -174,7 +174,7 @@ METHOD(EWheel, tr_death, void(EWheel this, entity it)) it.velocity = '0 0 0'; #ifdef EWHEEL_FANCYPATH - if (self.pathcurrent) + if (it.pathcurrent) pathlib_deletepath(it.pathcurrent.owner); #endif it.pathcurrent = NULL; diff --git a/qcsrc/common/turrets/turret/flac_weapon.qc b/qcsrc/common/turrets/turret/flac_weapon.qc index 6adacff31..ada1bf063 100644 --- a/qcsrc/common/turrets/turret/flac_weapon.qc +++ b/qcsrc/common/turrets/turret/flac_weapon.qc @@ -38,18 +38,18 @@ METHOD(FlacAttack, wr_think, void(entity thiswep, entity actor, .entity weaponen void turret_flac_projectile_think_explode(entity this) { - if(self.enemy != world) - if(vdist(self.origin - self.enemy.origin, <, self.owner.shot_radius * 3)) - setorigin(self,self.enemy.origin + randomvec() * self.owner.shot_radius); + if(this.enemy != world) + if(vdist(this.origin - this.enemy.origin, <, this.owner.shot_radius * 3)) + setorigin(this,this.enemy.origin + randomvec() * this.owner.shot_radius); #ifdef TURRET_DEBUG - float d = RadiusDamage (self, self.owner, self.owner.shot_dmg, self.owner.shot_dmg, self.owner.shot_radius, self, world, self.owner.shot_force, self.totalfrags, world); - self.owner.tur_dbg_dmg_t_h = self.owner.tur_dbg_dmg_t_h + d; - self.owner.tur_dbg_dmg_t_f = self.owner.tur_dbg_dmg_t_f + self.owner.shot_dmg; + float d = RadiusDamage (this, this.owner, this.owner.shot_dmg, this.owner.shot_dmg, this.owner.shot_radius, this, world, this.owner.shot_force, this.totalfrags, world); + this.owner.tur_dbg_dmg_t_h = this.owner.tur_dbg_dmg_t_h + d; + this.owner.tur_dbg_dmg_t_f = this.owner.tur_dbg_dmg_t_f + this.owner.shot_dmg; #else - RadiusDamage (self, self.realowner, self.owner.shot_dmg, self.owner.shot_dmg, self.owner.shot_radius, self, world, self.owner.shot_force, self.totalfrags, world); + RadiusDamage (this, this.realowner, this.owner.shot_dmg, this.owner.shot_dmg, this.owner.shot_radius, this, world, this.owner.shot_force, this.totalfrags, world); #endif - remove(self); + remove(this); } #endif diff --git a/qcsrc/common/turrets/turret/fusionreactor.qc b/qcsrc/common/turrets/turret/fusionreactor.qc index 013c089f3..bdac1f029 100644 --- a/qcsrc/common/turrets/turret/fusionreactor.qc +++ b/qcsrc/common/turrets/turret/fusionreactor.qc @@ -50,8 +50,8 @@ spawnfunc(turret_fusionreactor) { if (!turret_initialize(this, TUR_FUSIONREACTOR METHOD(FusionReactor, tr_attack, void(FusionReactor this, entity it)) { - self.enemy.ammo = min(self.enemy.ammo + self.shot_dmg,self.enemy.ammo_max); - vector fl_org = 0.5 * (self.enemy.absmin + self.enemy.absmax); + it.enemy.ammo = min(it.enemy.ammo + it.shot_dmg,it.enemy.ammo_max); + vector fl_org = 0.5 * (it.enemy.absmin + it.enemy.absmax); te_smallflash(fl_org); } METHOD(FusionReactor, tr_think, void(FusionReactor thistur, entity it)) diff --git a/qcsrc/common/turrets/turret/hellion_weapon.qc b/qcsrc/common/turrets/turret/hellion_weapon.qc index f053d782e..0b112f226 100644 --- a/qcsrc/common/turrets/turret/hellion_weapon.qc +++ b/qcsrc/common/turrets/turret/hellion_weapon.qc @@ -47,60 +47,60 @@ void turret_hellion_missile_think(entity this) vector pre_pos; float itime; - self.nextthink = time + 0.05; + this.nextthink = time + 0.05; - olddir = normalize(self.velocity); + olddir = normalize(this.velocity); - if(self.max_health < time) - turret_projectile_explode(self); + if(this.max_health < time) + turret_projectile_explode(this); // Enemy dead? just keep on the current heading then. - if ((self.enemy == world) || (IS_DEAD(self.enemy))) + if ((this.enemy == world) || (IS_DEAD(this.enemy))) { // Make sure we dont return to tracking a respawned player - self.enemy = world; + this.enemy = world; // Turn model - self.angles = vectoangles(self.velocity); + this.angles = vectoangles(this.velocity); - if(vdist(self.origin - self.owner.origin, >, (self.owner.shot_radius * 5))) - turret_projectile_explode(self); + if(vdist(this.origin - this.owner.origin, >, (this.owner.shot_radius * 5))) + turret_projectile_explode(this); // Accelerate - self.velocity = olddir * min(vlen(self.velocity) * (autocvar_g_turrets_unit_hellion_shot_speed_gain), (autocvar_g_turrets_unit_hellion_shot_speed_max)); + this.velocity = olddir * min(vlen(this.velocity) * (autocvar_g_turrets_unit_hellion_shot_speed_gain), (autocvar_g_turrets_unit_hellion_shot_speed_max)); - UpdateCSQCProjectile(self); + UpdateCSQCProjectile(this); return; } // Enemy in range? - if(vdist(self.origin - self.enemy.origin, <, self.owner.shot_radius * 0.2)) - turret_projectile_explode(self); + if(vdist(this.origin - this.enemy.origin, <, this.owner.shot_radius * 0.2)) + turret_projectile_explode(this); // Predict enemy position - itime = vlen(self.enemy.origin - self.origin) / vlen(self.velocity); - pre_pos = self.enemy.origin + self.enemy.velocity * itime; + itime = vlen(this.enemy.origin - this.origin) / vlen(this.velocity); + pre_pos = this.enemy.origin + this.enemy.velocity * itime; - pre_pos = (pre_pos + self.enemy.origin) * 0.5; + pre_pos = (pre_pos + this.enemy.origin) * 0.5; // Find out the direction to that place - newdir = normalize(pre_pos - self.origin); + newdir = normalize(pre_pos - this.origin); // Turn newdir = normalize(olddir + newdir * 0.35); // Turn model - self.angles = vectoangles(self.velocity); + this.angles = vectoangles(this.velocity); // Accelerate - self.velocity = newdir * min(vlen(self.velocity) * (autocvar_g_turrets_unit_hellion_shot_speed_gain), (autocvar_g_turrets_unit_hellion_shot_speed_max)); + this.velocity = newdir * min(vlen(this.velocity) * (autocvar_g_turrets_unit_hellion_shot_speed_gain), (autocvar_g_turrets_unit_hellion_shot_speed_max)); if (itime < 0.05) - setthink(self, turret_projectile_explode); + setthink(this, turret_projectile_explode); - UpdateCSQCProjectile(self); + UpdateCSQCProjectile(this); } #endif diff --git a/qcsrc/common/turrets/turret/hk_weapon.qc b/qcsrc/common/turrets/turret/hk_weapon.qc index b1658923e..5a4677dce 100644 --- a/qcsrc/common/turrets/turret/hk_weapon.qc +++ b/qcsrc/common/turrets/turret/hk_weapon.qc @@ -58,54 +58,54 @@ void turret_hk_missile_think(entity this) entity e; float ad,edist; - self.nextthink = time + self.ticrate; + this.nextthink = time + this.ticrate; - //if (self.cnt < time) + //if (this.cnt < time) // turret_hk_missile_explode(); - if (IS_DEAD(self.enemy)) - self.enemy = world; + if (IS_DEAD(this.enemy)) + this.enemy = world; // Pick the closest valid target. - if (!self.enemy) + if (!this.enemy) { - e = findradius(self.origin, 5000); + e = findradius(this.origin, 5000); while (e) { if (hk_is_valid_target(this, e)) { - if (!self.enemy) - self.enemy = e; + if (!this.enemy) + this.enemy = e; else - if (vlen2(self.origin - e.origin) < vlen2(self.origin - self.enemy.origin)) - self.enemy = e; + if (vlen2(this.origin - e.origin) < vlen2(this.origin - this.enemy.origin)) + this.enemy = e; } e = e.chain; } } - self.angles = vectoangles(self.velocity); - self.angles_x = self.angles_x * -1; - makevectors(self.angles); - self.angles_x = self.angles_x * -1; + this.angles = vectoangles(this.velocity); + this.angles_x = this.angles_x * -1; + makevectors(this.angles); + this.angles_x = this.angles_x * -1; - if (self.enemy) + if (this.enemy) { - edist = vlen(self.origin - self.enemy.origin); + edist = vlen(this.origin - this.enemy.origin); // Close enougth to do decent damage? - if ( edist <= (self.owner.shot_radius * 0.25) ) + if ( edist <= (this.owner.shot_radius * 0.25) ) { - turret_projectile_explode(self); + turret_projectile_explode(this); return; } // Get data on enemy position - pre_pos = self.enemy.origin + - self.enemy.velocity * - min((vlen(self.enemy.origin - self.origin) / vlen(self.velocity)),0.5); + pre_pos = this.enemy.origin + + this.enemy.velocity * + min((vlen(this.enemy.origin - this.origin) / vlen(this.velocity)),0.5); - traceline(self.origin, pre_pos,true,self.enemy); - ve = normalize(pre_pos - self.origin); + traceline(this.origin, pre_pos,true,this.enemy); + ve = normalize(pre_pos - this.origin); fe = trace_fraction; } @@ -116,20 +116,20 @@ void turret_hk_missile_think(entity this) fe = 0; } - if ((fe != 1) || (self.enemy == world) || (edist > 1000)) + if ((fe != 1) || (this.enemy == world) || (edist > 1000)) { - myspeed = vlen(self.velocity); + myspeed = vlen(this.velocity); lt_for = myspeed * 3; lt_seek = myspeed * 2.95; // Trace forward - traceline(self.origin, self.origin + v_forward * lt_for,false,self); + traceline(this.origin, this.origin + v_forward * lt_for,false,this); vf = trace_endpos; ff = trace_fraction; // Find angular offset - ad = vlen(vectoangles(normalize(self.enemy.origin - self.origin)) - self.angles); + ad = vlen(vectoangles(normalize(this.enemy.origin - this.origin)) - this.angles); // To close to something, Slow down! if ( ((ff < 0.7) || (ad > 4)) && (myspeed > (autocvar_g_turrets_unit_hk_shot_speed)) ) @@ -145,29 +145,29 @@ void turret_hk_missile_think(entity this) if (ff < 0.5) pt_seek = 1; // Trace left - traceline(self.origin, self.origin + (-1 * (v_right * pt_seek) + (v_forward * ff)) * lt_seek,false,self); + traceline(this.origin, this.origin + (-1 * (v_right * pt_seek) + (v_forward * ff)) * lt_seek,false,this); vl = trace_endpos; fl = trace_fraction; // Trace right - traceline(self.origin, self.origin + ((v_right * pt_seek) + (v_forward * ff)) * lt_seek ,false,self); + traceline(this.origin, this.origin + ((v_right * pt_seek) + (v_forward * ff)) * lt_seek ,false,this); vr = trace_endpos; fr = trace_fraction; // Trace up - traceline(self.origin, self.origin + ((v_up * pt_seek) + (v_forward * ff)) * lt_seek ,false,self); + traceline(this.origin, this.origin + ((v_up * pt_seek) + (v_forward * ff)) * lt_seek ,false,this); vu = trace_endpos; fu = trace_fraction; // Trace down - traceline(self.origin, self.origin + (-1 * (v_up * pt_seek) + (v_forward * ff)) * lt_seek ,false,self); + traceline(this.origin, this.origin + (-1 * (v_up * pt_seek) + (v_forward * ff)) * lt_seek ,false,this); vd = trace_endpos; fd = trace_fraction; - vl = normalize(vl - self.origin); - vr = normalize(vr - self.origin); - vu = normalize(vu - self.origin); - vd = normalize(vd - self.origin); + vl = normalize(vl - this.origin); + vr = normalize(vr - this.origin); + vu = normalize(vu - this.origin); + vd = normalize(vd - this.origin); // Panic tresh passed, find a single direction and turn as hard as we can if (pt_seek == 1) @@ -183,7 +183,7 @@ void turret_hk_missile_think(entity this) wishdir = normalize( (vl * fl) + (vr * fr) + (vu * fu) + (vd * fd) ); } - if (self.enemy) + if (this.enemy) { if (fe < 0.1) fe = 0.1; // Make sure we always try to move sligtly towards our target wishdir = (wishdir * (1 - fe)) + (ve * fe); @@ -192,58 +192,58 @@ void turret_hk_missile_think(entity this) else { // Got a clear path to target, speed up fast (if not at full speed) and go straight for it. - myspeed = vlen(self.velocity); + myspeed = vlen(this.velocity); if (myspeed < (autocvar_g_turrets_unit_hk_shot_speed_max)) myspeed = min(myspeed * (autocvar_g_turrets_unit_hk_shot_speed_accel2),(autocvar_g_turrets_unit_hk_shot_speed_max)); wishdir = ve; } - if ((myspeed > (autocvar_g_turrets_unit_hk_shot_speed)) && (self.cnt > time)) + if ((myspeed > (autocvar_g_turrets_unit_hk_shot_speed)) && (this.cnt > time)) myspeed = min(myspeed * (autocvar_g_turrets_unit_hk_shot_speed_accel2),(autocvar_g_turrets_unit_hk_shot_speed_max)); // Ranoutagazfish? - if (self.cnt < time) + if (this.cnt < time) { - self.cnt = time + 0.25; - self.nextthink = 0; - self.movetype = MOVETYPE_BOUNCE; + this.cnt = time + 0.25; + this.nextthink = 0; + this.movetype = MOVETYPE_BOUNCE; return; } // Calculate new heading - olddir = normalize(self.velocity); + olddir = normalize(this.velocity); newdir = normalize(olddir + wishdir * (autocvar_g_turrets_unit_hk_shot_speed_turnrate)); // Set heading & speed - self.velocity = newdir * myspeed; + this.velocity = newdir * myspeed; // Align model with new heading - self.angles = vectoangles(self.velocity); + this.angles = vectoangles(this.velocity); #ifdef TURRET_DEBUG_HK - //if(self.atime < time) { + //if(this.atime < time) { if ((fe <= 0.99)||(edist > 1000)) { - te_lightning2(world,self.origin, self.origin + vr * lt_seek); - te_lightning2(world,self.origin, self.origin + vl * lt_seek); - te_lightning2(world,self.origin, self.origin + vu * lt_seek); - te_lightning2(world,self.origin, self.origin + vd * lt_seek); - te_lightning2(world,self.origin, vf); + te_lightning2(world,this.origin, this.origin + vr * lt_seek); + te_lightning2(world,this.origin, this.origin + vl * lt_seek); + te_lightning2(world,this.origin, this.origin + vu * lt_seek); + te_lightning2(world,this.origin, this.origin + vd * lt_seek); + te_lightning2(world,this.origin, vf); } else { - te_lightning2(world,self.origin, self.enemy.origin); + te_lightning2(world,this.origin, this.enemy.origin); } bprint("Speed: ", ftos(rint(myspeed)), "\n"); bprint("Trace to solid: ", ftos(rint(ff * 100)), "%\n"); bprint("Trace to target:", ftos(rint(fe * 100)), "%\n"); - self.atime = time + 0.2; + this.atime = time + 0.2; //} #endif - UpdateCSQCProjectile(self); + UpdateCSQCProjectile(this); } bool hk_is_valid_target(entity this, entity e_target) diff --git a/qcsrc/common/turrets/turret/phaser_weapon.qc b/qcsrc/common/turrets/turret/phaser_weapon.qc index 1f6d62c95..ea48a6479 100644 --- a/qcsrc/common/turrets/turret/phaser_weapon.qc +++ b/qcsrc/common/turrets/turret/phaser_weapon.qc @@ -54,37 +54,37 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity void beam_think(entity this) { - if ((time > self.cnt) || (IS_DEAD(self.owner))) + if ((time > this.cnt) || (IS_DEAD(this.owner))) { - self.owner.attack_finished_single[0] = time + self.owner.shot_refire; - self.owner.fireflag = 2; - self.owner.tur_head.frame = 10; - sound (self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM); - remove(self); + this.owner.attack_finished_single[0] = time + this.owner.shot_refire; + this.owner.fireflag = 2; + this.owner.tur_head.frame = 10; + sound (this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM); + remove(this); return; } - turret_do_updates(self.owner); + turret_do_updates(this.owner); - if (time - self.shot_spread > 0) + if (time - this.shot_spread > 0) { - self.shot_spread = time + 2; - sound (self, CH_SHOTS_SINGLE, SND_TUR_PHASER, VOL_BASE, ATTEN_NORM); + this.shot_spread = time + 2; + sound (this, CH_SHOTS_SINGLE, SND_TUR_PHASER, VOL_BASE, ATTEN_NORM); } - self.nextthink = time + self.ticrate; + this.nextthink = time + this.ticrate; - self.owner.attack_finished_single[0] = time + frametime; - FireImoBeam ( self.owner, self.tur_shotorg, - self.tur_shotorg + self.tur_shotdir_updated * self.target_range, - '-1 -1 -1' * self.shot_radius, - '1 1 1' * self.shot_radius, - self.shot_force, + this.owner.attack_finished_single[0] = time + frametime; + FireImoBeam ( this.owner, this.tur_shotorg, + this.tur_shotorg + this.tur_shotdir_updated * this.target_range, + '-1 -1 -1' * this.shot_radius, + '1 1 1' * this.shot_radius, + this.shot_force, this.shot_dmg, 0.75, DEATH_TURRET_PHASER.m_id); - self.scale = vlen(self.owner.tur_shotorg - trace_endpos) / 256; + this.scale = vlen(this.owner.tur_shotorg - trace_endpos) / 256; } diff --git a/qcsrc/common/turrets/util.qc b/qcsrc/common/turrets/util.qc index 805e13012..41e7cd491 100644 --- a/qcsrc/common/turrets/util.qc +++ b/qcsrc/common/turrets/util.qc @@ -1,5 +1,5 @@ /* -* Update self.tur_shotorg by getting up2date bone info +* Update this.tur_shotorg by getting up2date bone info * NOTICE this func overwrites the global v_forward, v_right and v_up vectors. */ float turret_tag_fire_update(entity this) diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 3d94aa51f..ec437b9cb 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -8,7 +8,7 @@ bool vehicle_send(entity to, int sf) if(sf & VSF_SPAWN) { - WriteByte(MSG_ENTITY, self.vehicleid); + WriteByte(MSG_ENTITY, this.vehicleid); } if(sf & VSF_SETUP) @@ -215,21 +215,21 @@ void vehicles_projectile_damage(entity this, entity inflictor, entity attacker, void vehicles_projectile_explode(entity this) { - if(self.owner && other != world) + if(this.owner && other != world) { - if(other == self.owner.vehicle) + if(other == this.owner.vehicle) return; - if(other == self.owner.vehicle.tur_head) + if(other == this.owner.vehicle.tur_head) return; } PROJECTILE_TOUCH(this); - self.event_damage = func_null; - RadiusDamage (self, self.realowner, self.shot_dmg, 0, self.shot_radius, self, world, self.shot_force, self.totalfrags, other); + this.event_damage = func_null; + RadiusDamage (this, this.realowner, this.shot_dmg, 0, this.shot_radius, this, world, this.shot_force, this.totalfrags, other); - remove (self); + remove (this); } void vehicles_projectile_explode_use(entity this, entity actor, entity trigger) @@ -292,19 +292,19 @@ entity vehicles_projectile(entity this, string _mzlfx, Sound _mzlsound, void vehicles_gib_explode(entity this) { - sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); - Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1); - Send_Effect(EFFECT_EXPLOSION_SMALL, self.wp00.origin + '0 0 64', '0 0 0', 1); - remove(self); + sound (this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); + Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (this.origin + '0 0 100'), '0 0 0', 1); + Send_Effect(EFFECT_EXPLOSION_SMALL, this.wp00.origin + '0 0 64', '0 0 0', 1); + remove(this); } void vehicles_gib_think(entity this) { - self.alpha -= 0.1; - if(self.cnt >= time) - remove(self); + this.alpha -= 0.1; + if(this.cnt >= time) + remove(this); else - self.nextthink = time + 0.1; + this.nextthink = time + 0.1; } entity vehicle_tossgib(entity this, entity _template, vector _vel, string _tag, bool _burn, bool _explode, float _maxtime, vector _rot) @@ -456,23 +456,23 @@ void vehicles_clearreturn(entity veh) void vehicles_spawn(entity this); void vehicles_return(entity this) { - Send_Effect(EFFECT_TELEPORT, self.wp00.origin + '0 0 64', '0 0 0', 1); + Send_Effect(EFFECT_TELEPORT, this.wp00.origin + '0 0 64', '0 0 0', 1); - setthink(self.wp00, vehicles_spawn); - self.wp00.nextthink = time; + setthink(this.wp00, vehicles_spawn); + this.wp00.nextthink = time; - if(self.waypointsprite_attached) - WaypointSprite_Kill(self.waypointsprite_attached); + if(this.waypointsprite_attached) + WaypointSprite_Kill(this.waypointsprite_attached); - remove(self); + remove(this); } void vehicles_showwp_goaway(entity this) { - if(self.waypointsprite_attached) - WaypointSprite_Kill(self.waypointsprite_attached); + if(this.waypointsprite_attached) + WaypointSprite_Kill(this.waypointsprite_attached); - remove(self); + remove(this); } @@ -587,16 +587,16 @@ void vehicles_regen(entity this, float timer, .float regen_field, float field_ma void shieldhit_think(entity this) { - self.alpha -= 0.1; - if (self.alpha <= 0) + this.alpha -= 0.1; + if (this.alpha <= 0) { - // setmodel(self, MDL_Null); - self.alpha = -1; - self.effects |= EF_NODRAW; + // setmodel(this, MDL_Null); + this.alpha = -1; + this.effects |= EF_NODRAW; } else { - self.nextthink = time + 0.1; + this.nextthink = time + 0.1; } } @@ -893,26 +893,26 @@ void vehicles_exit(entity vehic, bool eject) void vehicles_touch(entity this) { - if(MUTATOR_CALLHOOK(VehicleTouch, self, other)) + if(MUTATOR_CALLHOOK(VehicleTouch, this, other)) return; // Vehicle currently in use - if(self.owner) + if(this.owner) { - if(!forbidWeaponUse(self.owner)) + if(!forbidWeaponUse(this.owner)) if(other != world) - if((self.origin_z + self.maxs_z) > (other.origin_z)) + if((this.origin_z + this.maxs_z) > (other.origin_z)) if(vehicles_crushable(other)) { - if(vdist(self.velocity, >=, 30)) - Damage(other, self, self.owner, autocvar_g_vehicles_crush_dmg, DEATH_VH_CRUSH.m_id, '0 0 0', normalize(other.origin - self.origin) * autocvar_g_vehicles_crush_force); + 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); return; // Dont do selfdamage when hitting "soft targets". } - if(self.play_time < time) { - Vehicle info = Vehicles_from(self.vehicleid); - info.vr_impact(info, self); + if(this.play_time < time) { + Vehicle info = Vehicles_from(this.vehicleid); + info.vr_impact(info, this); } return; @@ -921,7 +921,7 @@ void vehicles_touch(entity this) if(autocvar_g_vehicles_enter) return; - vehicles_enter(other, self); + vehicles_enter(other, this); } bool vehicle_impulse(entity this, int imp) @@ -935,7 +935,7 @@ bool vehicle_impulse(entity this, int imp) { case IMP_weapon_drop.impulse: { - stuffcmd(self, "\ntoggle cl_eventchase_vehicle\nset _vehicles_shownchasemessage 1\n"); + stuffcmd(this, "\ntoggle cl_eventchase_vehicle\nset _vehicles_shownchasemessage 1\n"); return true; } } @@ -1081,66 +1081,66 @@ void vehicles_enter(entity pl, entity veh) void vehicles_think(entity this) { - self.nextthink = time; + this.nextthink = time; - if(self.owner) - self.owner.vehicle_weapon2mode = self.vehicle_weapon2mode; + if(this.owner) + this.owner.vehicle_weapon2mode = this.vehicle_weapon2mode; - Vehicle info = Vehicles_from(self.vehicleid); - info.vr_think(info, self); + Vehicle info = Vehicles_from(this.vehicleid); + info.vr_think(info, this); - vehicles_painframe(self); + vehicles_painframe(this); - CSQCMODEL_AUTOUPDATE(self); + CSQCMODEL_AUTOUPDATE(this); } // initialization void vehicles_spawn(entity this) { - LOG_TRACE("Spawning vehicle: ", self.classname, "\n"); + LOG_TRACE("Spawning vehicle: ", this.classname, "\n"); // disown & reset - self.vehicle_hudmodel.viewmodelforclient = self; - - self.owner = world; - settouch(self, vehicles_touch); - self.event_damage = vehicles_damage; - self.iscreature = true; - self.teleportable = false; // no teleporting for vehicles, too buggy - self.damagedbycontents = true; - self.movetype = MOVETYPE_WALK; - self.solid = SOLID_SLIDEBOX; - self.takedamage = DAMAGE_AIM; - self.deadflag = DEAD_NO; - self.bot_attack = true; - self.flags = FL_NOTARGET; - self.avelocity = '0 0 0'; - self.velocity = '0 0 0'; - setthink(self, vehicles_think); - self.nextthink = time; + this.vehicle_hudmodel.viewmodelforclient = this; + + this.owner = world; + settouch(this, vehicles_touch); + this.event_damage = vehicles_damage; + this.iscreature = true; + this.teleportable = false; // no teleporting for vehicles, too buggy + this.damagedbycontents = true; + this.movetype = MOVETYPE_WALK; + this.solid = SOLID_SLIDEBOX; + this.takedamage = DAMAGE_AIM; + this.deadflag = DEAD_NO; + this.bot_attack = true; + this.flags = FL_NOTARGET; + this.avelocity = '0 0 0'; + this.velocity = '0 0 0'; + setthink(this, vehicles_think); + this.nextthink = time; // Reset locking - self.lock_strength = 0; - self.lock_target = world; - self.misc_bulletcounter = 0; + this.lock_strength = 0; + this.lock_target = world; + this.misc_bulletcounter = 0; // Return to spawn - self.angles = self.pos2; - setorigin(self, self.pos1); + this.angles = this.pos2; + setorigin(this, this.pos1); // Show it - Send_Effect(EFFECT_TELEPORT, self.origin + '0 0 64', '0 0 0', 1); + Send_Effect(EFFECT_TELEPORT, this.origin + '0 0 64', '0 0 0', 1); - if(self.vehicle_controller) - self.team = self.vehicle_controller.team; + if(this.vehicle_controller) + this.team = this.vehicle_controller.team; - FOREACH_CLIENT(IS_PLAYER(it) && it.hook.aiment == self, RemoveGrapplingHook(it)); + FOREACH_CLIENT(IS_PLAYER(it) && it.hook.aiment == this, RemoveGrapplingHook(it)); - vehicles_reset_colors(self); + vehicles_reset_colors(this); - Vehicle info = Vehicles_from(self.vehicleid); - info.vr_spawn(info, self); + Vehicle info = Vehicles_from(this.vehicleid); + info.vr_spawn(info, this); - CSQCMODEL_AUTOINIT(self); + CSQCMODEL_AUTOINIT(this); } bool vehicle_initialize(entity this, Vehicle info, bool nodrop) diff --git a/qcsrc/common/vehicles/sv_vehicles.qh b/qcsrc/common/vehicles/sv_vehicles.qh index 54550c509..8c53724b5 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qh +++ b/qcsrc/common/vehicles/sv_vehicles.qh @@ -44,14 +44,14 @@ float autocvar_g_vehicles_weapon_damagerate = 1; .entity gunner1; .entity gunner2; -.float vehicle_health = _STAT(VEHICLESTAT_HEALTH); /// If self is player this is 0..100 indicating precentage of health left on vehicle. If self is vehile, this is the real health value. -.float vehicle_energy = _STAT(VEHICLESTAT_ENERGY); /// If self is player this is 0..100 indicating precentage of energy left on vehicle. If self is vehile, this is the real energy value. -.float vehicle_shield = _STAT(VEHICLESTAT_SHIELD); /// If self is player this is 0..100 indicating precentage of shield left on vehicle. If self is vehile, this is the real shield value. - -.float vehicle_ammo1 = _STAT(VEHICLESTAT_AMMO1); /// If self is player this is 0..100 indicating percentage of primary ammo left UNLESS value is already stored in vehicle_energy. If self is vehile, this is the real ammo1 value. -.float vehicle_reload1 = _STAT(VEHICLESTAT_RELOAD1); /// If self is player this is 0..100 indicating percentage of primary reload status. If self is vehile, this is the real reload1 value. -.float vehicle_ammo2 = _STAT(VEHICLESTAT_AMMO2); /// If self is player this is 0..100 indicating percentage of secondary ammo left. If self is vehile, this is the real ammo2 value. -.float vehicle_reload2 = _STAT(VEHICLESTAT_RELOAD2); /// If self is player this is 0..100 indicating percentage of secondary reload status. If self is vehile, this is the real reload2 value. +.float vehicle_health = _STAT(VEHICLESTAT_HEALTH); /// If ent is player this is 0..100 indicating precentage of health left on vehicle. If ent is vehile, this is the real health value. +.float vehicle_energy = _STAT(VEHICLESTAT_ENERGY); /// If ent is player this is 0..100 indicating precentage of energy left on vehicle. If ent is vehile, this is the real energy value. +.float vehicle_shield = _STAT(VEHICLESTAT_SHIELD); /// If ent is player this is 0..100 indicating precentage of shield left on vehicle. If ent is vehile, this is the real shield value. + +.float vehicle_ammo1 = _STAT(VEHICLESTAT_AMMO1); /// If ent is player this is 0..100 indicating percentage of primary ammo left UNLESS value is already stored in vehicle_energy. If ent is vehile, this is the real ammo1 value. +.float vehicle_reload1 = _STAT(VEHICLESTAT_RELOAD1); /// If ent is player this is 0..100 indicating percentage of primary reload status. If ent is vehile, this is the real reload1 value. +.float vehicle_ammo2 = _STAT(VEHICLESTAT_AMMO2); /// If ent is player this is 0..100 indicating percentage of secondary ammo left. If ent is vehile, this is the real ammo2 value. +.float vehicle_reload2 = _STAT(VEHICLESTAT_RELOAD2); /// If ent is player this is 0..100 indicating percentage of secondary reload status. If ent is vehile, this is the real reload2 value. .float sound_nexttime; const float VOL_VEHICLEENGINE = 1; diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qc b/qcsrc/common/vehicles/vehicle/bumblebee.qc index daa2865d4..ac98dadbe 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qc @@ -630,16 +630,16 @@ void bumblebee_land(entity this) float hgt; hgt = raptor_altitude(this, 512); - self.velocity = (self.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * sys_frametime); - self.angles_x *= 0.95; - self.angles_z *= 0.95; + this.velocity = (this.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * sys_frametime); + this.angles_x *= 0.95; + this.angles_z *= 0.95; if(hgt < 16) - setthink(self, vehicles_think); + setthink(this, vehicles_think); - self.nextthink = time; + this.nextthink = time; - CSQCMODEL_AUTOUPDATE(self); + CSQCMODEL_AUTOUPDATE(this); } void bumblebee_exit(entity this, int eject) @@ -686,33 +686,33 @@ void bumblebee_exit(entity this, int eject) void bumblebee_blowup(entity this) { - RadiusDamage(self, self.enemy, autocvar_g_vehicle_bumblebee_blowup_coredamage, + RadiusDamage(this, this.enemy, autocvar_g_vehicle_bumblebee_blowup_coredamage, autocvar_g_vehicle_bumblebee_blowup_edgedamage, - autocvar_g_vehicle_bumblebee_blowup_radius, self, world, + autocvar_g_vehicle_bumblebee_blowup_radius, this, world, autocvar_g_vehicle_bumblebee_blowup_forceintensity, DEATH_VH_BUMB_DEATH.m_id, world); - sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); - Send_Effect(EFFECT_EXPLOSION_BIG, (self.origin + '0 0 100') + (randomvec() * 80), '0 0 0', 1); + sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); + Send_Effect(EFFECT_EXPLOSION_BIG, (this.origin + '0 0 100') + (randomvec() * 80), '0 0 0', 1); - if(self.owner.deadflag == DEAD_DYING) - self.owner.deadflag = DEAD_DEAD; + if(this.owner.deadflag == DEAD_DYING) + this.owner.deadflag = DEAD_DEAD; - remove(self); + remove(this); } void bumblebee_diethink(entity this) { - if(time >= self.wait) - setthink(self, bumblebee_blowup); + if(time >= this.wait) + setthink(this, bumblebee_blowup); if(random() < 0.1) { - sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); - Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1); + sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); + Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (this.origin + '0 0 100'), '0 0 0', 1); } - self.nextthink = time + 0.1; + this.nextthink = time + 0.1; } spawnfunc(vehicle_bumblebee) diff --git a/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc b/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc index 26a6ddd13..b2e838f94 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc @@ -22,23 +22,23 @@ bool bumble_raygun_send(entity this, entity to, float sf) WriteByte(MSG_ENTITY, sf); if(sf & BRG_SETUP) { - WriteByte(MSG_ENTITY, etof(self.realowner)); - WriteByte(MSG_ENTITY, self.realowner.team); - WriteByte(MSG_ENTITY, self.cnt); + WriteByte(MSG_ENTITY, etof(this.realowner)); + WriteByte(MSG_ENTITY, this.realowner.team); + WriteByte(MSG_ENTITY, this.cnt); } if(sf & BRG_START) { - WriteCoord(MSG_ENTITY, self.hook_start_x); - WriteCoord(MSG_ENTITY, self.hook_start_y); - WriteCoord(MSG_ENTITY, self.hook_start_z); + WriteCoord(MSG_ENTITY, this.hook_start_x); + WriteCoord(MSG_ENTITY, this.hook_start_y); + WriteCoord(MSG_ENTITY, this.hook_start_z); } if(sf & BRG_END) { - WriteCoord(MSG_ENTITY, self.hook_end_x); - WriteCoord(MSG_ENTITY, self.hook_end_y); - WriteCoord(MSG_ENTITY, self.hook_end_z); + WriteCoord(MSG_ENTITY, this.hook_end_x); + WriteCoord(MSG_ENTITY, this.hook_end_y); + WriteCoord(MSG_ENTITY, this.hook_end_z); } return true; diff --git a/qcsrc/common/vehicles/vehicle/racer.qc b/qcsrc/common/vehicles/vehicle/racer.qc index 24a0682d9..e212d3124 100644 --- a/qcsrc/common/vehicles/vehicle/racer.qc +++ b/qcsrc/common/vehicles/vehicle/racer.qc @@ -414,7 +414,7 @@ void racer_think(entity this) float forced = autocvar_g_vehicle_racer_upforcedamper; - //int cont = pointcontents(self.origin - '0 0 64'); + //int cont = pointcontents(this.origin - '0 0 64'); traceline(this.origin - '0 0 64', this.origin - '0 0 64', MOVE_NOMONSTERS, this); //if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME) if(trace_dpstartcontents & DPCONTENTS_LIQUIDSMASK) diff --git a/qcsrc/common/vehicles/vehicle/racer_weapon.qc b/qcsrc/common/vehicles/vehicle/racer_weapon.qc index f15b8cfb8..1af09990b 100644 --- a/qcsrc/common/vehicles/vehicle/racer_weapon.qc +++ b/qcsrc/common/vehicles/vehicle/racer_weapon.qc @@ -69,50 +69,50 @@ void racer_rocket_tracker(entity this) vector olddir, newdir; float oldvel, newvel; - self.nextthink = time; + this.nextthink = time; - if (IS_DEAD(self.owner) || self.cnt < time) + if (IS_DEAD(this.owner) || this.cnt < time) { - self.use(self, NULL, NULL); + this.use(this, NULL, NULL); return; } - if(!self.realowner.vehicle) + if(!this.realowner.vehicle) { - UpdateCSQCProjectile(self); + UpdateCSQCProjectile(this); return; } - olddir = normalize(self.velocity); - oldvel = vlen(self.velocity); - newvel = oldvel + self.lip; + olddir = normalize(this.velocity); + oldvel = vlen(this.velocity); + newvel = oldvel + this.lip; makevectors(vectoangles(olddir)); - float time_to_impact = min(vlen(self.enemy.origin - self.origin) / vlen(self.velocity), 1); - vector predicted_origin = self.enemy.origin + self.enemy.velocity * time_to_impact; + float time_to_impact = min(vlen(this.enemy.origin - this.origin) / vlen(this.velocity), 1); + vector predicted_origin = this.enemy.origin + this.enemy.velocity * time_to_impact; - traceline(self.origin, self.origin + v_forward * 64 - '0 0 32', MOVE_NORMAL, self); - newdir = normalize(predicted_origin - self.origin); + traceline(this.origin, this.origin + v_forward * 64 - '0 0 32', MOVE_NORMAL, this); + newdir = normalize(predicted_origin - this.origin); //vector - float height_diff = predicted_origin_z - self.origin_z; + float height_diff = predicted_origin_z - this.origin_z; if(vdist(newdir - v_forward, >, autocvar_g_vehicle_racer_rocket_locked_maxangle)) { //bprint("Target lost!\n"); //dprint("OF:", ftos(vlen(newdir - v_forward)), "\n"); - setthink(self, racer_rocket_groundhugger); + setthink(this, racer_rocket_groundhugger); return; } - if(trace_fraction != 1.0 && trace_ent != self.enemy) + if(trace_fraction != 1.0 && trace_ent != this.enemy) newdir_z += 16 * sys_frametime; - self.velocity = normalize(olddir + newdir * autocvar_g_vehicle_racer_rocket_turnrate) * newvel; - self.velocity_z -= 800 * sys_frametime; - self.velocity_z += max(height_diff, autocvar_g_vehicle_racer_rocket_climbspeed) * sys_frametime ; + this.velocity = normalize(olddir + newdir * autocvar_g_vehicle_racer_rocket_turnrate) * newvel; + this.velocity_z -= 800 * sys_frametime; + this.velocity_z += max(height_diff, autocvar_g_vehicle_racer_rocket_climbspeed) * sys_frametime ; - UpdateCSQCProjectile(self); + UpdateCSQCProjectile(this); return; } @@ -121,50 +121,50 @@ void racer_rocket_groundhugger(entity this) vector olddir, newdir; float oldvel, newvel; - self.nextthink = time; + this.nextthink = time; - if(IS_DEAD(self.owner) || self.cnt < time) + if(IS_DEAD(this.owner) || this.cnt < time) { - self.use(self, NULL, NULL); + this.use(this, NULL, NULL); return; } - if(!self.realowner.vehicle) + if(!this.realowner.vehicle) { - UpdateCSQCProjectile(self); + UpdateCSQCProjectile(this); return; } - olddir = normalize(self.velocity); - oldvel = vlen(self.velocity); - newvel = oldvel + self.lip; + olddir = normalize(this.velocity); + oldvel = vlen(this.velocity); + newvel = oldvel + this.lip; - tracebox(self.origin, self.mins, self.maxs, self.origin + olddir * 64, MOVE_WORLDONLY,self); + tracebox(this.origin, this.mins, this.maxs, this.origin + olddir * 64, MOVE_WORLDONLY,this); if(trace_fraction <= 0.5) { // Hitting somethign soon, just speed ahead - self.velocity = olddir * newvel; - UpdateCSQCProjectile(self); + this.velocity = olddir * newvel; + UpdateCSQCProjectile(this); return; } - traceline(trace_endpos, trace_endpos - '0 0 64', MOVE_NORMAL, self); + traceline(trace_endpos, trace_endpos - '0 0 64', MOVE_NORMAL, this); if(trace_fraction != 1.0) { - newdir = normalize(trace_endpos + '0 0 64' - self.origin) * autocvar_g_vehicle_racer_rocket_turnrate; - self.velocity = normalize(olddir + newdir) * newvel; + newdir = normalize(trace_endpos + '0 0 64' - this.origin) * autocvar_g_vehicle_racer_rocket_turnrate; + this.velocity = normalize(olddir + newdir) * newvel; } else { - self.velocity = olddir * newvel; - self.velocity_z -= 1600 * sys_frametime; // 2x grav looks better for this one + this.velocity = olddir * newvel; + this.velocity_z -= 1600 * sys_frametime; // 2x grav looks better for this one } - int cont = pointcontents(self.origin - '0 0 32'); + int cont = pointcontents(this.origin - '0 0 32'); if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME) - self.velocity_z += 200; + this.velocity_z += 200; - UpdateCSQCProjectile(self); + UpdateCSQCProjectile(this); return; } diff --git a/qcsrc/common/vehicles/vehicle/raptor.qc b/qcsrc/common/vehicles/vehicle/raptor.qc index 6273e83b5..1e364e549 100644 --- a/qcsrc/common/vehicles/vehicle/raptor.qc +++ b/qcsrc/common/vehicles/vehicle/raptor.qc @@ -536,26 +536,26 @@ void raptor_blowup(entity this) void raptor_diethink(entity this) { - if(time >= self.wait) - setthink(self, raptor_blowup); + if(time >= this.wait) + setthink(this, raptor_blowup); if(random() < 0.05) { - sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); - Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1); + sound (this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); + Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (this.origin + '0 0 100'), '0 0 0', 1); } - self.nextthink = time; + this.nextthink = time; - CSQCMODEL_AUTOUPDATE(self); + CSQCMODEL_AUTOUPDATE(this); } // If we dont do this ever now and then, the raptors rotors // stop working, presumably due to angle overflow. cute. void raptor_rotor_anglefix(entity this) { - self.gun1.angles_y = anglemods(self.gun1.angles_y); - self.gun2.angles_y = anglemods(self.gun2.angles_y); - self.nextthink = time + 15; + this.gun1.angles_y = anglemods(this.gun1.angles_y); + this.gun2.angles_y = anglemods(this.gun2.angles_y); + this.nextthink = time + 15; } bool raptor_impulse(entity this, int _imp) diff --git a/qcsrc/common/vehicles/vehicle/raptor_weapons.qc b/qcsrc/common/vehicles/vehicle/raptor_weapons.qc index 1aca46381..3541b2568 100644 --- a/qcsrc/common/vehicles/vehicle/raptor_weapons.qc +++ b/qcsrc/common/vehicles/vehicle/raptor_weapons.qc @@ -87,33 +87,33 @@ METHOD(RaptorFlare, wr_think, void(entity thiswep, entity actor, .entity weapone void raptor_bomblet_boom(entity this) { - RadiusDamage (self, self.realowner, autocvar_g_vehicle_raptor_bomblet_damage, + RadiusDamage (this, this.realowner, autocvar_g_vehicle_raptor_bomblet_damage, autocvar_g_vehicle_raptor_bomblet_edgedamage, autocvar_g_vehicle_raptor_bomblet_radius, world, world, autocvar_g_vehicle_raptor_bomblet_force, DEATH_VH_RAPT_BOMB.m_id, world); - remove(self); + remove(this); } void raptor_bomblet_touch(entity this) { - if(other == self.owner) + if(other == this.owner) return; PROJECTILE_TOUCH(this); - setthink(self, raptor_bomblet_boom); - self.nextthink = time + random() * autocvar_g_vehicle_raptor_bomblet_explode_delay; + setthink(this, raptor_bomblet_boom); + this.nextthink = time + random() * autocvar_g_vehicle_raptor_bomblet_explode_delay; } void raptor_bomb_burst(entity this) { - if(self.cnt > time) + if(this.cnt > time) if(autocvar_g_vehicle_raptor_bomblet_alt) { - self.nextthink = time; - traceline(self.origin, self.origin + (normalize(self.velocity) * autocvar_g_vehicle_raptor_bomblet_alt), MOVE_NORMAL, self); - if((trace_fraction == 1.0) || (vdist(self.origin - self.owner.origin, <, autocvar_g_vehicle_raptor_bomblet_radius))) + this.nextthink = time; + traceline(this.origin, this.origin + (normalize(this.velocity) * autocvar_g_vehicle_raptor_bomblet_alt), MOVE_NORMAL, this); + if((trace_fraction == 1.0) || (vdist(this.origin - this.owner.origin, <, autocvar_g_vehicle_raptor_bomblet_radius))) { - UpdateCSQCProjectile(self); + UpdateCSQCProjectile(this); return; } } @@ -121,26 +121,26 @@ void raptor_bomb_burst(entity this) entity bomblet; float i; - Damage_DamageInfo(self.origin, 0, 0, 0, '0 0 0', DEATH_VH_RAPT_FRAGMENT.m_id, 0, self); + Damage_DamageInfo(this.origin, 0, 0, 0, '0 0 0', DEATH_VH_RAPT_FRAGMENT.m_id, 0, this); for(i = 0; i < autocvar_g_vehicle_raptor_bomblets; ++i) { bomblet = spawn(); - setorigin(bomblet, self.origin); + setorigin(bomblet, this.origin); bomblet.movetype = MOVETYPE_TOSS; settouch(bomblet, raptor_bomblet_touch); setthink(bomblet, raptor_bomblet_boom); bomblet.nextthink = time + 5; - bomblet.owner = self.owner; - bomblet.realowner = self.realowner; - bomblet.velocity = normalize(normalize(self.velocity) + (randomvec() * autocvar_g_vehicle_raptor_bomblet_spread)) * vlen(self.velocity); + bomblet.owner = this.owner; + bomblet.realowner = this.realowner; + bomblet.velocity = normalize(normalize(this.velocity) + (randomvec() * autocvar_g_vehicle_raptor_bomblet_spread)) * vlen(this.velocity); PROJECTILE_MAKETRIGGER(bomblet); CSQCProjectile(bomblet, true, PROJECTILE_RAPTORBOMBLET, true); } - remove(self); + remove(this); } void raptor_bombdrop(entity this) @@ -194,19 +194,19 @@ void raptor_flare_damage(entity this, entity inflictor, entity attacker, float d void raptor_flare_think(entity this) { - self.nextthink = time + 0.1; - entity _missile = findchainentity(enemy, self.owner); + this.nextthink = time + 0.1; + entity _missile = findchainentity(enemy, this.owner); while(_missile) { if(_missile.flags & FL_PROJECTILE) - if(vdist(self.origin - _missile.origin, <, autocvar_g_vehicle_raptor_flare_range)) + if(vdist(this.origin - _missile.origin, <, autocvar_g_vehicle_raptor_flare_range)) if(random() > autocvar_g_vehicle_raptor_flare_chase) - _missile.enemy = self; + _missile.enemy = this; _missile = _missile.chain; } - if(self.tur_impacttime < time) - remove(self); + if(this.tur_impacttime < time) + remove(this); } #endif diff --git a/qcsrc/common/vehicles/vehicle/spiderbot.qc b/qcsrc/common/vehicles/vehicle/spiderbot.qc index 8c7c4f7fd..63924987e 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot.qc +++ b/qcsrc/common/vehicles/vehicle/spiderbot.qc @@ -288,7 +288,7 @@ bool spiderbot_frame(entity this) autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN.m_id, 0); sound (gun, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM); - //trailparticles(self, _particleeffectnum("spiderbot_minigun_trail"), v, trace_endpos); + //trailparticles(this, _particleeffectnum("spiderbot_minigun_trail"), v, trace_endpos); Send_Effect(EFFECT_SPIDERBOT_MINIGUN_MUZZLEFLASH, v, v_forward * 2500, 1); vehic.vehicle_ammo1 -= autocvar_g_vehicle_spiderbot_minigun_ammo_cost; diff --git a/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc b/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc index 1c808b13e..6476ebbf0 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc +++ b/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc @@ -14,36 +14,36 @@ void spiderbot_rocket_unguided(entity this) { vector newdir, olddir; - self.nextthink = time; + this.nextthink = time; - olddir = normalize(self.velocity); - newdir = normalize(self.pos1 - self.origin) + randomvec() * autocvar_g_vehicle_spiderbot_rocket_noise; - self.velocity = normalize(olddir + newdir * autocvar_g_vehicle_spiderbot_rocket_turnrate) * autocvar_g_vehicle_spiderbot_rocket_speed; + olddir = normalize(this.velocity); + newdir = normalize(this.pos1 - this.origin) + randomvec() * autocvar_g_vehicle_spiderbot_rocket_noise; + this.velocity = normalize(olddir + newdir * autocvar_g_vehicle_spiderbot_rocket_turnrate) * autocvar_g_vehicle_spiderbot_rocket_speed; - UpdateCSQCProjectile(self); + UpdateCSQCProjectile(this); - if (IS_DEAD(self.owner) || self.cnt < time || vdist(self.pos1 - self.origin, <, 16)) - self.use(self, NULL, NULL); + if (IS_DEAD(this.owner) || this.cnt < time || vdist(this.pos1 - this.origin, <, 16)) + this.use(this, NULL, NULL); } void spiderbot_rocket_guided(entity this) { vector newdir, olddir; - self.nextthink = time; + this.nextthink = time; - if(!self.realowner.vehicle) - setthink(self, spiderbot_rocket_unguided); + if(!this.realowner.vehicle) + setthink(this, spiderbot_rocket_unguided); - crosshair_trace(self.realowner); - olddir = normalize(self.velocity); - newdir = normalize(trace_endpos - self.origin) + randomvec() * autocvar_g_vehicle_spiderbot_rocket_noise; - self.velocity = normalize(olddir + newdir * autocvar_g_vehicle_spiderbot_rocket_turnrate) * autocvar_g_vehicle_spiderbot_rocket_speed; + crosshair_trace(this.realowner); + olddir = normalize(this.velocity); + newdir = normalize(trace_endpos - this.origin) + randomvec() * autocvar_g_vehicle_spiderbot_rocket_noise; + this.velocity = normalize(olddir + newdir * autocvar_g_vehicle_spiderbot_rocket_turnrate) * autocvar_g_vehicle_spiderbot_rocket_speed; - UpdateCSQCProjectile(self); + UpdateCSQCProjectile(this); - if (IS_DEAD(self.owner) || self.cnt < time) - self.use(self, NULL, NULL); + if (IS_DEAD(this.owner) || this.cnt < time) + this.use(this, NULL, NULL); } void spiderbot_guide_release(entity this) diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index ba75c98c5..91aece258 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -154,7 +154,7 @@ bool W_Arc_Beam_Send(entity this, entity to, int sf) // - The owner client has no use for beam start position or directions, // it always figures this information out for itself with csqc code. // - Spectating the owner also truncates this information. - float drawlocal = ((to == self.owner) || ((to.enemy == self.owner) && IS_SPEC(to))); + float drawlocal = ((to == this.owner) || ((to.enemy == this.owner) && IS_SPEC(to))); if(drawlocal) { sf &= ~ARC_SF_LOCALMASK; } WriteByte(MSG_ENTITY, sf); @@ -173,25 +173,25 @@ bool W_Arc_Beam_Send(entity this, entity to, int sf) } if(sf & ARC_SF_START) // starting location { - WriteCoord(MSG_ENTITY, self.beam_start.x); - WriteCoord(MSG_ENTITY, self.beam_start.y); - WriteCoord(MSG_ENTITY, self.beam_start.z); + WriteCoord(MSG_ENTITY, this.beam_start.x); + WriteCoord(MSG_ENTITY, this.beam_start.y); + WriteCoord(MSG_ENTITY, this.beam_start.z); } if(sf & ARC_SF_WANTDIR) // want/aim direction { - WriteCoord(MSG_ENTITY, self.beam_wantdir.x); - WriteCoord(MSG_ENTITY, self.beam_wantdir.y); - WriteCoord(MSG_ENTITY, self.beam_wantdir.z); + WriteCoord(MSG_ENTITY, this.beam_wantdir.x); + WriteCoord(MSG_ENTITY, this.beam_wantdir.y); + WriteCoord(MSG_ENTITY, this.beam_wantdir.z); } if(sf & ARC_SF_BEAMDIR) // beam direction { - WriteCoord(MSG_ENTITY, self.beam_dir.x); - WriteCoord(MSG_ENTITY, self.beam_dir.y); - WriteCoord(MSG_ENTITY, self.beam_dir.z); + WriteCoord(MSG_ENTITY, this.beam_dir.x); + WriteCoord(MSG_ENTITY, this.beam_dir.y); + WriteCoord(MSG_ENTITY, this.beam_dir.z); } if(sf & ARC_SF_BEAMTYPE) // beam type { - WriteByte(MSG_ENTITY, self.beam_type); + WriteByte(MSG_ENTITY, this.beam_type); } return true; @@ -233,10 +233,10 @@ void Arc_Player_SetHeat(entity player) void W_Arc_Bolt_Explode(entity this) { - self.event_damage = func_null; - RadiusDamage(self, self.realowner, WEP_CVAR(arc, bolt_damage), WEP_CVAR(arc, bolt_edgedamage), WEP_CVAR(arc, bolt_radius), world, world, WEP_CVAR(arc, bolt_force), self.projectiledeathtype, other); + this.event_damage = func_null; + RadiusDamage(this, this.realowner, WEP_CVAR(arc, bolt_damage), WEP_CVAR(arc, bolt_edgedamage), WEP_CVAR(arc, bolt_radius), world, world, WEP_CVAR(arc, bolt_force), this.projectiledeathtype, other); - remove(self); + remove(this); } void W_Arc_Bolt_Explode_use(entity this, entity actor, entity trigger) @@ -262,22 +262,21 @@ void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float dam void W_Arc_Bolt_Touch(entity this) { PROJECTILE_TOUCH(this); - self.use(this, NULL, NULL); + this.use(this, NULL, NULL); } void W_Arc_Attack_Bolt(Weapon thiswep, entity actor) { - entity this = actor; entity missile; - W_DecreaseAmmo(thiswep, self, WEP_CVAR(arc, bolt_ammo)); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR(arc, bolt_ammo)); - W_SetupShot(self, false, 2, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR(arc, bolt_damage)); + W_SetupShot(actor, false, 2, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR(arc, bolt_damage)); Send_Effect(EFFECT_ARC_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); missile = new(missile); - missile.owner = missile.realowner = self; + missile.owner = missile.realowner = actor; missile.bot_dodge = true; missile.bot_dodgerating = WEP_CVAR(arc, bolt_damage); @@ -305,75 +304,75 @@ void W_Arc_Attack_Bolt(Weapon thiswep, entity actor) CSQCProjectile(missile, true, PROJECTILE_ARC_BOLT, true); - MUTATOR_CALLHOOK(EditProjectile, self, missile); + MUTATOR_CALLHOOK(EditProjectile, actor, missile); } void W_Arc_Beam_Think(entity this) { - if(self != self.owner.arc_beam) + if(this != this.owner.arc_beam) { - remove(self); + remove(this); return; } float burst = 0; - if( (PHYS_INPUT_BUTTON_ATCK2(self.owner) && !WEP_CVAR(arc, bolt)) || self.beam_bursting) + if( (PHYS_INPUT_BUTTON_ATCK2(this.owner) && !WEP_CVAR(arc, bolt)) || this.beam_bursting) { - if(!self.beam_bursting) - self.beam_bursting = true; + if(!this.beam_bursting) + this.beam_bursting = true; burst = ARC_BT_BURSTMASK; } Weapon thiswep = WEP_ARC; if( - !IS_PLAYER(self.owner) + !IS_PLAYER(this.owner) || - (self.owner.(thiswep.ammo_field) <= 0 && !(self.owner.items & IT_UNLIMITED_WEAPON_AMMO)) + (this.owner.(thiswep.ammo_field) <= 0 && !(this.owner.items & IT_UNLIMITED_WEAPON_AMMO)) || - IS_DEAD(self.owner) + IS_DEAD(this.owner) || gameover || - (!PHYS_INPUT_BUTTON_ATCK(self.owner) && !burst ) + (!PHYS_INPUT_BUTTON_ATCK(this.owner) && !burst ) || - STAT(FROZEN, self.owner) + STAT(FROZEN, this.owner) || - self.owner.vehicle + this.owner.vehicle || - (WEP_CVAR(arc, overheat_max) > 0 && self.beam_heat >= WEP_CVAR(arc, overheat_max)) + (WEP_CVAR(arc, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(arc, overheat_max)) ) { if ( WEP_CVAR(arc, cooldown) > 0 ) { float cooldown_speed = 0; - if ( self.beam_heat > WEP_CVAR(arc, overheat_min) && WEP_CVAR(arc, cooldown) > 0 ) + if ( this.beam_heat > WEP_CVAR(arc, overheat_min) && WEP_CVAR(arc, cooldown) > 0 ) { cooldown_speed = WEP_CVAR(arc, cooldown); } else if ( !burst ) { - cooldown_speed = self.beam_heat / WEP_CVAR(arc, beam_refire); + cooldown_speed = this.beam_heat / WEP_CVAR(arc, beam_refire); } if ( cooldown_speed ) { - if ( WEP_CVAR(arc, cooldown_release) || (WEP_CVAR(arc, overheat_max) > 0 && self.beam_heat >= WEP_CVAR(arc, overheat_max)) ) - self.owner.arc_overheat = time + self.beam_heat / cooldown_speed; - self.owner.arc_cooldown = cooldown_speed; + if ( WEP_CVAR(arc, cooldown_release) || (WEP_CVAR(arc, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(arc, overheat_max)) ) + this.owner.arc_overheat = time + this.beam_heat / cooldown_speed; + this.owner.arc_cooldown = cooldown_speed; } - if ( WEP_CVAR(arc, overheat_max) > 0 && self.beam_heat >= WEP_CVAR(arc, overheat_max) ) + if ( WEP_CVAR(arc, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(arc, overheat_max) ) { Send_Effect(EFFECT_ARC_OVERHEAT, - self.beam_start, self.beam_wantdir, 1 ); - sound(self, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM); + this.beam_start, this.beam_wantdir, 1 ); + sound(this, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM); } } - if(self == self.owner.arc_beam) { self.owner.arc_beam = world; } - entity own = self.owner; + if(this == this.owner.arc_beam) { this.owner.arc_beam = world; } + entity own = this.owner; Weapon w = WEP_ARC; if(!w.wr_checkammo1(w, own) && !w.wr_checkammo2(w, own)) if(!(own.items & IT_UNLIMITED_WEAPON_AMMO)) @@ -381,13 +380,13 @@ void W_Arc_Beam_Think(entity this) // note: this doesn't force the switch W_SwitchToOtherWeapon(own); } - remove(self); + remove(this); return; } // decrease ammo float coefficient = frametime; - if(!(self.owner.items & IT_UNLIMITED_WEAPON_AMMO)) + if(!(this.owner.items & IT_UNLIMITED_WEAPON_AMMO)) { float rootammo; if(burst) @@ -397,17 +396,17 @@ void W_Arc_Beam_Think(entity this) if(rootammo) { - coefficient = min(coefficient, self.owner.(thiswep.ammo_field) / rootammo); - self.owner.(thiswep.ammo_field) = max(0, self.owner.(thiswep.ammo_field) - (rootammo * frametime)); + coefficient = min(coefficient, this.owner.(thiswep.ammo_field) / rootammo); + this.owner.(thiswep.ammo_field) = max(0, this.owner.(thiswep.ammo_field) - (rootammo * frametime)); } } float heat_speed = burst ? WEP_CVAR(arc, burst_heat) : WEP_CVAR(arc, beam_heat); - self.beam_heat = min( WEP_CVAR(arc, overheat_max), self.beam_heat + heat_speed*frametime ); + this.beam_heat = min( WEP_CVAR(arc, overheat_max), this.beam_heat + heat_speed*frametime ); - makevectors(self.owner.v_angle); + makevectors(this.owner.v_angle); W_SetupShot_Range( - self.owner, + this.owner, true, 0, SND_Null, @@ -417,44 +416,44 @@ void W_Arc_Beam_Think(entity this) ); // After teleport, "lock" the beam until the teleport is confirmed. - if (time < self.beam_teleporttime + ANTILAG_LATENCY(self.owner)) { - w_shotdir = self.beam_dir; + if (time < this.beam_teleporttime + ANTILAG_LATENCY(this.owner)) { + w_shotdir = this.beam_dir; } // network information: shot origin and want/aim direction - if(self.beam_start != w_shotorg) + if(this.beam_start != w_shotorg) { - self.SendFlags |= ARC_SF_START; - self.beam_start = w_shotorg; + this.SendFlags |= ARC_SF_START; + this.beam_start = w_shotorg; } - if(self.beam_wantdir != w_shotdir) + if(this.beam_wantdir != w_shotdir) { - self.SendFlags |= ARC_SF_WANTDIR; - self.beam_wantdir = w_shotdir; + this.SendFlags |= ARC_SF_WANTDIR; + this.beam_wantdir = w_shotdir; } - if(!self.beam_initialized) + if(!this.beam_initialized) { - self.beam_dir = w_shotdir; - self.beam_initialized = true; + this.beam_dir = w_shotdir; + this.beam_initialized = true; } // WEAPONTODO: Detect player velocity so that the beam curves when moving too - // idea: blend together self.beam_dir with the inverted direction the player is moving in + // idea: blend together this.beam_dir with the inverted direction the player is moving in // might have to make some special accomodation so that it only uses view_right and view_up // note that if we do this, it'll always be corrected to a maximum angle by beam_maxangle handling float segments; - if(self.beam_dir != w_shotdir) + if(this.beam_dir != w_shotdir) { // calculate how much we're going to move the end of the beam to the want position // WEAPONTODO (server and client): // blendfactor never actually becomes 0 in this situation, which is a problem - // regarding precision... this means that self.beam_dir and w_shotdir approach + // regarding precision... this means that this.beam_dir and w_shotdir approach // eachother, however they never actually become the same value with this method. // Perhaps we should do some form of rounding/snapping? - float angle = vlen(w_shotdir - self.beam_dir) * RAD2DEG; + float angle = vlen(w_shotdir - this.beam_dir) * RAD2DEG; if(angle && (angle > WEP_CVAR(arc, beam_maxangle))) { // if the angle is greater than maxangle, force the blendfactor to make this the maximum factor @@ -463,7 +462,7 @@ void W_Arc_Beam_Think(entity this) (1 - (WEP_CVAR(arc, beam_returnspeed) * frametime)), min(WEP_CVAR(arc, beam_maxangle) / angle, 1) ); - self.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (self.beam_dir * blendfactor)); + this.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (this.beam_dir * blendfactor)); } else { @@ -473,11 +472,11 @@ void W_Arc_Beam_Think(entity this) (1 - (WEP_CVAR(arc, beam_returnspeed) * frametime)), 1 ); - self.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (self.beam_dir * blendfactor)); + this.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (this.beam_dir * blendfactor)); } // network information: beam direction - self.SendFlags |= ARC_SF_BEAMDIR; + this.SendFlags |= ARC_SF_BEAMDIR; // calculate how many segments are needed float max_allowed_segments; @@ -510,7 +509,7 @@ void W_Arc_Beam_Think(entity this) } else { segments = 1; } - vector beam_endpos = (w_shotorg + (self.beam_dir * WEP_CVAR(arc, beam_range))); + vector beam_endpos = (w_shotorg + (this.beam_dir * WEP_CVAR(arc, beam_range))); vector beam_controlpoint = w_shotorg + w_shotdir * (WEP_CVAR(arc, beam_range) * (1 - WEP_CVAR(arc, beam_tightness))); float i; @@ -532,12 +531,12 @@ void W_Arc_Beam_Think(entity this) vector new_dir = normalize(new_origin - last_origin); WarpZone_traceline_antilag( - self.owner, + this.owner, last_origin, new_origin, MOVE_NORMAL, - self.owner, - ANTILAG_LATENCY(self.owner) + this.owner, + ANTILAG_LATENCY(this.owner) ); // Do all the transforms for warpzones right now, as we already @@ -571,7 +570,7 @@ void W_Arc_Beam_Think(entity this) vlen(WarpZone_UnTransformOrigin(WarpZone_trace_transform, hitorigin) - w_shotorg) ); - if(is_player && SAME_TEAM(self.owner, trace_ent)) + if(is_player && SAME_TEAM(this.owner, trace_ent)) { float roothealth, rootarmor; if(burst) @@ -627,10 +626,10 @@ void W_Arc_Beam_Think(entity this) else { rootdamage = WEP_CVAR(arc, beam_nonplayerdamage); } - if(accuracy_isgooddamage(self.owner, trace_ent)) + if(accuracy_isgooddamage(this.owner, trace_ent)) { accuracy_add( - self.owner, + this.owner, WEP_ARC.m_id, 0, rootdamage * coefficient * falloff @@ -639,8 +638,8 @@ void W_Arc_Beam_Think(entity this) Damage( trace_ent, - self.owner, - self.owner, + this.owner, + this.owner, rootdamage * coefficient * falloff, WEP_ARC.m_id, hitorigin, @@ -665,27 +664,27 @@ void W_Arc_Beam_Think(entity this) new_beam_type |= burst; // network information: beam type - if(new_beam_type != self.beam_type) + if(new_beam_type != this.beam_type) { - self.SendFlags |= ARC_SF_BEAMTYPE; - self.beam_type = new_beam_type; + this.SendFlags |= ARC_SF_BEAMTYPE; + this.beam_type = new_beam_type; } - self.owner.beam_prev = time; - self.nextthink = time; + this.owner.beam_prev = time; + this.nextthink = time; } void W_Arc_Beam(float burst, entity actor) -{entity this = actor; +{ // only play fire sound if 1 sec has passed since player let go the fire button - if(time - self.beam_prev > 1) - sound(self, CH_WEAPON_A, SND_ARC_FIRE, VOL_BASE, ATTN_NORM); + if(time - actor.beam_prev > 1) + sound(actor, CH_WEAPON_A, SND_ARC_FIRE, VOL_BASE, ATTN_NORM); - entity beam = self.arc_beam = new(W_Arc_Beam); + entity beam = actor.arc_beam = new(W_Arc_Beam); beam.solid = SOLID_NOT; setthink(beam, W_Arc_Beam_Think); - beam.owner = self; + beam.owner = actor; beam.movetype = MOVETYPE_NONE; beam.bot_dodge = true; beam.bot_dodgerating = WEP_CVAR(arc, beam_damage); @@ -695,48 +694,47 @@ void W_Arc_Beam(float burst, entity actor) WITHSELF(beam, getthink(beam)(beam)); } void Arc_Smoke(entity actor) -{entity this = actor; - makevectors(self.v_angle); - W_SetupShot_Range(self,true,0,SND_Null,0,0,0); +{ + makevectors(actor.v_angle); + W_SetupShot_Range(actor,true,0,SND_Null,0,0,0); - vector smoke_origin = w_shotorg + self.velocity*frametime; - if ( self.arc_overheat > time ) + vector smoke_origin = w_shotorg + actor.velocity*frametime; + if ( actor.arc_overheat > time ) { - if ( random() < self.arc_heat_percent ) + if ( random() < actor.arc_heat_percent ) Send_Effect(EFFECT_ARC_SMOKE, smoke_origin, '0 0 0', 1 ); - if ( PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_ATCK2(self) ) + if ( PHYS_INPUT_BUTTON_ATCK(actor) || PHYS_INPUT_BUTTON_ATCK2(actor) ) { Send_Effect(EFFECT_ARC_OVERHEAT_FIRE, smoke_origin, w_shotdir, 1 ); - if ( !self.arc_smoke_sound ) + if ( !actor.arc_smoke_sound ) { - self.arc_smoke_sound = 1; - sound(self, CH_SHOTS_SINGLE, SND_ARC_LOOP_OVERHEAT, VOL_BASE, ATTN_NORM); + actor.arc_smoke_sound = 1; + sound(actor, CH_SHOTS_SINGLE, SND_ARC_LOOP_OVERHEAT, VOL_BASE, ATTN_NORM); } } } - else if ( self.arc_beam && WEP_CVAR(arc, overheat_max) > 0 && - self.arc_beam.beam_heat > WEP_CVAR(arc, overheat_min) ) + else if ( actor.arc_beam && WEP_CVAR(arc, overheat_max) > 0 && + actor.arc_beam.beam_heat > WEP_CVAR(arc, overheat_min) ) { - if ( random() < (self.arc_beam.beam_heat-WEP_CVAR(arc, overheat_min)) / + if ( random() < (actor.arc_beam.beam_heat-WEP_CVAR(arc, overheat_min)) / ( WEP_CVAR(arc, overheat_max)-WEP_CVAR(arc, overheat_min) ) ) Send_Effect(EFFECT_ARC_SMOKE, smoke_origin, '0 0 0', 1 ); } - if ( self.arc_smoke_sound && ( self.arc_overheat <= time || - !( PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_ATCK2(self) ) ) || PS(self).m_switchweapon != WEP_ARC ) + if ( actor.arc_smoke_sound && ( actor.arc_overheat <= time || + !( PHYS_INPUT_BUTTON_ATCK(actor) || PHYS_INPUT_BUTTON_ATCK2(actor) ) ) || PS(actor).m_switchweapon != WEP_ARC ) { - self.arc_smoke_sound = 0; - sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM); + actor.arc_smoke_sound = 0; + sound(actor, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM); } } METHOD(Arc, wr_aim, void(entity thiswep, entity actor)) { - entity this = actor; if(WEP_CVAR(arc, beam_botaimspeed)) { - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim( - self, + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim( + actor, WEP_CVAR(arc, beam_botaimspeed), 0, WEP_CVAR(arc, beam_botaimlifetime), @@ -745,8 +743,8 @@ METHOD(Arc, wr_aim, void(entity thiswep, entity actor)) } else { - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim( - self, + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim( + actor, 1000000, 0, 0.001, @@ -855,20 +853,18 @@ METHOD(Arc, wr_killmessage, Notification(entity thiswep)) } METHOD(Arc, wr_drop, void(entity thiswep, entity actor)) { - entity this = actor; - weapon_dropevent_item.arc_overheat = self.arc_overheat; - weapon_dropevent_item.arc_cooldown = self.arc_cooldown; - self.arc_overheat = 0; - self.arc_cooldown = 0; + weapon_dropevent_item.arc_overheat = actor.arc_overheat; + weapon_dropevent_item.arc_cooldown = actor.arc_cooldown; + actor.arc_overheat = 0; + actor.arc_cooldown = 0; } METHOD(Arc, wr_pickup, void(entity thiswep, entity actor)) { - entity this = actor; - if ( !client_hasweapon(self, thiswep, false, false) && + if ( !client_hasweapon(actor, thiswep, false, false) && weapon_dropevent_item.arc_overheat > time ) { - self.arc_overheat = weapon_dropevent_item.arc_overheat; - self.arc_cooldown = weapon_dropevent_item.arc_cooldown; + actor.arc_overheat = weapon_dropevent_item.arc_overheat; + actor.arc_cooldown = weapon_dropevent_item.arc_cooldown; } } #endif @@ -877,13 +873,12 @@ bool autocvar_cl_arcbeam_teamcolor = true; METHOD(Arc, wr_impacteffect, void(entity thiswep, entity actor)) { - entity this = actor; if(w_deathtype & HITTYPE_SECONDARY) { vector org2; org2 = w_org + w_backoff * 6; pointparticles(EFFECT_ARC_BOLT_EXPLODE, org2, w_backoff * 1000, 1); - if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); } + if(!w_issilent) { sound(actor, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); } } } diff --git a/qcsrc/common/weapons/weapon/blaster.qc b/qcsrc/common/weapons/weapon/blaster.qc index 394d50c69..59cb4618b 100644 --- a/qcsrc/common/weapons/weapon/blaster.qc +++ b/qcsrc/common/weapons/weapon/blaster.qc @@ -60,22 +60,22 @@ void W_Blaster_Touch(entity this) { PROJECTILE_TOUCH(this); - self.event_damage = func_null; + this.event_damage = func_null; RadiusDamage( - self, - self.realowner, - self.blaster_damage, - self.blaster_edgedamage, - self.blaster_radius, + this, + this.realowner, + this.blaster_damage, + this.blaster_edgedamage, + this.blaster_radius, world, world, - self.blaster_force, - self.projectiledeathtype, + this.blaster_force, + this.projectiledeathtype, other ); - remove(self); + remove(this); } void W_Blaster_Think(entity this) @@ -152,16 +152,15 @@ void W_Blaster_Attack( METHOD(Blaster, wr_aim, void(entity thiswep, entity actor)) { - entity this = actor; if(WEP_CVAR(blaster, secondary)) { if((random() * (WEP_CVAR_PRI(blaster, damage) + WEP_CVAR_SEC(blaster, damage))) > WEP_CVAR_PRI(blaster, damage)) - { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), false); } + { PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), false); } else - { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); } + { PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); } } else - { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); } + { PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); } } METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, .entity weaponentity, int fire)) @@ -225,8 +224,7 @@ METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, .entity weaponenti METHOD(Blaster, wr_setup, void(entity thiswep, entity actor)) { - entity this = actor; - self.ammo_field = ammo_none; + actor.ammo_field = ammo_none; } METHOD(Blaster, wr_checkammo1, bool(entity thiswep, entity actor)) @@ -254,11 +252,10 @@ METHOD(Blaster, wr_killmessage, Notification(entity thiswep)) METHOD(Blaster, wr_impacteffect, void(entity thiswep, entity actor)) { - entity this = actor; vector org2; org2 = w_org + w_backoff * 6; pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1); - if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); } + if(!w_issilent) { sound(actor, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); } } #endif diff --git a/qcsrc/common/weapons/weapon/crylink.qc b/qcsrc/common/weapons/weapon/crylink.qc index a582f9843..51932f6fe 100644 --- a/qcsrc/common/weapons/weapon/crylink.qc +++ b/qcsrc/common/weapons/weapon/crylink.qc @@ -233,15 +233,15 @@ void W_Crylink_LinkJoinEffect_Think(entity this) // is there at least 2 projectiles very close? entity e, p; float n; - e = self.owner.crylink_lastgroup; + e = this.owner.crylink_lastgroup; n = 0; if(e) { - if(vlen(e.origin - self.origin) < vlen(e.velocity) * frametime) + if(vlen(e.origin - this.origin) < vlen(e.velocity) * frametime) ++n; for(p = e; (p = p.queuenext) != e; ) { - if(vlen(p.origin - self.origin) < vlen(p.velocity) * frametime) + if(vlen(p.origin - this.origin) < vlen(p.velocity) * frametime) ++n; } if(n >= 2) @@ -263,11 +263,11 @@ void W_Crylink_LinkJoinEffect_Think(entity this) e.projectiledeathtype, other ); - Send_Effect(EFFECT_CRYLINK_JOINEXPLODE, self.origin, '0 0 0', n); + Send_Effect(EFFECT_CRYLINK_JOINEXPLODE, this.origin, '0 0 0', n); } } } - remove(self); + remove(this); } float W_Crylink_Touch_WouldHitFriendly(entity projectile, float rad) @@ -297,13 +297,13 @@ void W_Crylink_Touch(entity this) { float finalhit; float f; - float isprimary = !(self.projectiledeathtype & HITTYPE_SECONDARY); + float isprimary = !(this.projectiledeathtype & HITTYPE_SECONDARY); PROJECTILE_TOUCH(this); float a; - a = bound(0, 1 - (time - self.fade_time) * self.fade_rate, 1); + a = bound(0, 1 - (time - this.fade_time) * this.fade_rate, 1); - finalhit = ((self.cnt <= 0) || (other.takedamage != DAMAGE_NO)); + finalhit = ((this.cnt <= 0) || (other.takedamage != DAMAGE_NO)); if(finalhit) f = 1; else @@ -311,28 +311,28 @@ void W_Crylink_Touch(entity this) if(a) f *= a; - float totaldamage = RadiusDamage(self, self.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * f, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * f, WEP_CVAR_BOTH(crylink, isprimary, radius), world, world, WEP_CVAR_BOTH(crylink, isprimary, force) * f, self.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), world, world, WEP_CVAR_BOTH(crylink, isprimary, force) * f, this.projectiledeathtype, other); - if(totaldamage && ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 2) || ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 1) && !W_Crylink_Touch_WouldHitFriendly(self, WEP_CVAR_BOTH(crylink, isprimary, radius))))) + 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(self == self.realowner.crylink_lastgroup) - self.realowner.crylink_lastgroup = world; - W_Crylink_LinkExplode(self.queuenext, self); - self.classname = "spike_oktoremove"; - remove(self); + if(this == this.realowner.crylink_lastgroup) + this.realowner.crylink_lastgroup = world; + W_Crylink_LinkExplode(this.queuenext, this); + this.classname = "spike_oktoremove"; + remove(this); return; } else if(finalhit) { // just unlink - W_Crylink_Dequeue(self); - remove(self); + W_Crylink_Dequeue(this); + remove(this); return; } - self.cnt = self.cnt - 1; - self.angles = vectoangles(self.velocity); - self.owner = world; - self.projectiledeathtype |= HITTYPE_BOUNCE; + this.cnt = this.cnt - 1; + this.angles = vectoangles(this.velocity); + this.owner = world; + this.projectiledeathtype |= HITTYPE_BOUNCE; // commented out as it causes a little hitch... //if(proj.cnt == 0) // CSQCProjectile(proj, true, PROJECTILE_CRYLINK, true); @@ -340,26 +340,26 @@ void W_Crylink_Touch(entity this) void W_Crylink_Fadethink(entity this) { - W_Crylink_Dequeue(self); - remove(self); + W_Crylink_Dequeue(this); + remove(this); } void W_Crylink_Attack(Weapon thiswep, entity actor) -{entity this = actor; +{ float counter, shots; entity proj, prevproj, firstproj; vector s; vector forward, right, up; float maxdmg; - W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(crylink, ammo)); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(crylink, ammo)); maxdmg = WEP_CVAR_PRI(crylink, damage) * WEP_CVAR_PRI(crylink, shots); maxdmg *= 1 + WEP_CVAR_PRI(crylink, bouncedamagefactor) * WEP_CVAR_PRI(crylink, bounces); if(WEP_CVAR_PRI(crylink, joinexplode)) maxdmg += WEP_CVAR_PRI(crylink, joinexplode_damage); - W_SetupShot(self, false, 2, SND_CRYLINK_FIRE, CH_WEAPON_A, maxdmg); + W_SetupShot(actor, false, 2, SND_CRYLINK_FIRE, CH_WEAPON_A, maxdmg); forward = v_forward; right = v_right; up = v_up; @@ -371,7 +371,7 @@ void W_Crylink_Attack(Weapon thiswep, entity actor) { proj = new(spike); proj.reset = W_Crylink_Reset; - proj.realowner = proj.owner = self; + proj.realowner = proj.owner = actor; proj.bot_dodge = true; proj.bot_dodgerating = WEP_CVAR_PRI(crylink, damage); if(shots == 1) { @@ -442,32 +442,32 @@ void W_Crylink_Attack(Weapon thiswep, entity actor) CSQCProjectile(proj, true, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), true); - MUTATOR_CALLHOOK(EditProjectile, self, proj); + MUTATOR_CALLHOOK(EditProjectile, actor, proj); } if(WEP_CVAR_PRI(crylink, joinspread) != 0) { - self.crylink_lastgroup = proj; + actor.crylink_lastgroup = proj; W_Crylink_CheckLinks(proj); - self.crylink_waitrelease = 1; + actor.crylink_waitrelease = 1; } } void W_Crylink_Attack2(Weapon thiswep, entity actor) -{entity this = actor; +{ float counter, shots; entity proj, prevproj, firstproj; vector s; vector forward, right, up; float maxdmg; - W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(crylink, ammo)); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(crylink, ammo)); maxdmg = WEP_CVAR_SEC(crylink, damage) * WEP_CVAR_SEC(crylink, shots); maxdmg *= 1 + WEP_CVAR_SEC(crylink, bouncedamagefactor) * WEP_CVAR_SEC(crylink, bounces); if(WEP_CVAR_SEC(crylink, joinexplode)) maxdmg += WEP_CVAR_SEC(crylink, joinexplode_damage); - W_SetupShot(self, false, 2, SND_CRYLINK_FIRE2, CH_WEAPON_A, maxdmg); + W_SetupShot(actor, false, 2, SND_CRYLINK_FIRE2, CH_WEAPON_A, maxdmg); forward = v_forward; right = v_right; up = v_up; @@ -479,7 +479,7 @@ void W_Crylink_Attack2(Weapon thiswep, entity actor) { proj = new(spike); proj.reset = W_Crylink_Reset; - proj.realowner = proj.owner = self; + proj.realowner = proj.owner = actor; proj.bot_dodge = true; proj.bot_dodgerating = WEP_CVAR_SEC(crylink, damage); if(shots == 1) { @@ -557,23 +557,22 @@ void W_Crylink_Attack2(Weapon thiswep, entity actor) CSQCProjectile(proj, true, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), true); - MUTATOR_CALLHOOK(EditProjectile, self, proj); + MUTATOR_CALLHOOK(EditProjectile, actor, proj); } if(WEP_CVAR_SEC(crylink, joinspread) != 0) { - self.crylink_lastgroup = proj; + actor.crylink_lastgroup = proj; W_Crylink_CheckLinks(proj); - self.crylink_waitrelease = 2; + actor.crylink_waitrelease = 2; } } METHOD(Crylink, wr_aim, void(entity thiswep, entity actor)) { - entity this = actor; if(random() < 0.10) - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(crylink, speed), 0, WEP_CVAR_PRI(crylink, middle_lifetime), false); + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, WEP_CVAR_PRI(crylink, speed), 0, WEP_CVAR_PRI(crylink, middle_lifetime), false); else - PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, WEP_CVAR_SEC(crylink, speed), 0, WEP_CVAR_SEC(crylink, middle_lifetime), false); + PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, WEP_CVAR_SEC(crylink, speed), 0, WEP_CVAR_SEC(crylink, middle_lifetime), false); } METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { @@ -667,20 +666,19 @@ METHOD(Crylink, wr_killmessage, Notification(entity thiswep)) #ifdef CSQC METHOD(Crylink, wr_impacteffect, void(entity thiswep, entity actor)) { - entity this = actor; vector org2; org2 = w_org + w_backoff * 2; if(w_deathtype & HITTYPE_SECONDARY) { pointparticles(EFFECT_CRYLINK_IMPACT2, org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, SND_CRYLINK_IMPACT2, VOL_BASE, ATTN_NORM); + sound(actor, CH_SHOTS, SND_CRYLINK_IMPACT2, VOL_BASE, ATTN_NORM); } else { pointparticles(EFFECT_CRYLINK_IMPACT, org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, SND_CRYLINK_IMPACT, VOL_BASE, ATTN_NORM); + sound(actor, CH_SHOTS, SND_CRYLINK_IMPACT, VOL_BASE, ATTN_NORM); } } #endif diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index 275c375f3..fe3a19a0b 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -74,75 +74,75 @@ spawnfunc(weapon_rocketlauncher) { spawnfunc_weapon_devastator(this); } void W_Devastator_Unregister(entity this) { - if(self.realowner && self.realowner.lastrocket == self) + if(this.realowner && this.realowner.lastrocket == this) { - self.realowner.lastrocket = world; - // self.realowner.rl_release = 1; + this.realowner.lastrocket = world; + // this.realowner.rl_release = 1; } } void W_Devastator_Explode(entity this) { - W_Devastator_Unregister(self); + W_Devastator_Unregister(this); if(other.takedamage == DAMAGE_AIM) if(IS_PLAYER(other)) - if(DIFF_TEAM(self.realowner, other)) + if(DIFF_TEAM(this.realowner, other)) if(!IS_DEAD(other)) if(IsFlying(other)) - Send_Notification(NOTIF_ONE, self.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT); + Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT); - self.event_damage = func_null; - self.takedamage = DAMAGE_NO; + this.event_damage = func_null; + this.takedamage = DAMAGE_NO; RadiusDamage( - self, - self.realowner, + this, + this.realowner, WEP_CVAR(devastator, damage), WEP_CVAR(devastator, edgedamage), WEP_CVAR(devastator, radius), world, world, WEP_CVAR(devastator, force), - self.projectiledeathtype, + this.projectiledeathtype, other ); Weapon thiswep = WEP_DEVASTATOR; - if(PS(self.realowner).m_weapon == thiswep) + if(PS(this.realowner).m_weapon == thiswep) { - if(self.realowner.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo)) - if(!(self.realowner.items & IT_UNLIMITED_WEAPON_AMMO)) + if(this.realowner.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo)) + if(!(this.realowner.items & IT_UNLIMITED_WEAPON_AMMO)) { - self.realowner.cnt = WEP_DEVASTATOR.m_id; + this.realowner.cnt = WEP_DEVASTATOR.m_id; int slot = 0; // TODO: unhardcode - ATTACK_FINISHED(self.realowner, slot) = time; - PS(self.realowner).m_switchweapon = w_getbestweapon(self.realowner); + ATTACK_FINISHED(this.realowner, slot) = time; + PS(this.realowner).m_switchweapon = w_getbestweapon(this.realowner); } } - remove(self); + remove(this); } void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity) { - W_Devastator_Unregister(self); + W_Devastator_Unregister(this); - self.event_damage = func_null; - self.takedamage = DAMAGE_NO; + this.event_damage = func_null; + this.takedamage = DAMAGE_NO; float handled_as_rocketjump = false; entity head = WarpZone_FindRadius( - self.origin, + this.origin, WEP_CVAR(devastator, remote_jump_radius), false ); while(head) { - if(head.takedamage && (head == self.realowner)) + if(head.takedamage && (head == this.realowner)) { - float distance_to_head = vlen(self.origin - head.WarpZone_findradius_nearest); + float distance_to_head = vlen(this.origin - head.WarpZone_findradius_nearest); if(distance_to_head <= WEP_CVAR(devastator, remote_jump_radius)) { // we handled this as a rocketjump :) @@ -159,7 +159,7 @@ void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity) // now do the damage RadiusDamage( - self, + this, head, WEP_CVAR(devastator, remote_jump_damage), WEP_CVAR(devastator, remote_jump_damage), @@ -167,7 +167,7 @@ void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity) world, head, 0, - self.projectiledeathtype | HITTYPE_BOUNCE, + this.projectiledeathtype | HITTYPE_BOUNCE, world ); break; @@ -177,44 +177,44 @@ void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity) } RadiusDamage( - self, - self.realowner, + this, + this.realowner, WEP_CVAR(devastator, remote_damage), WEP_CVAR(devastator, remote_edgedamage), WEP_CVAR(devastator, remote_radius), (handled_as_rocketjump ? head : world), world, WEP_CVAR(devastator, remote_force), - self.projectiledeathtype | HITTYPE_BOUNCE, + this.projectiledeathtype | HITTYPE_BOUNCE, world ); Weapon thiswep = WEP_DEVASTATOR; - if(PS(self.realowner).m_weapon == thiswep) + if(PS(this.realowner).m_weapon == thiswep) { - if(self.realowner.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo)) - if(!(self.realowner.items & IT_UNLIMITED_WEAPON_AMMO)) + if(this.realowner.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo)) + if(!(this.realowner.items & IT_UNLIMITED_WEAPON_AMMO)) { - self.realowner.cnt = WEP_DEVASTATOR.m_id; + this.realowner.cnt = WEP_DEVASTATOR.m_id; int slot = weaponslot(weaponentity); - ATTACK_FINISHED(self.realowner, slot) = time; - PS(self.realowner).m_switchweapon = w_getbestweapon(self.realowner); + ATTACK_FINISHED(this.realowner, slot) = time; + PS(this.realowner).m_switchweapon = w_getbestweapon(this.realowner); } } - remove(self); + remove(this); } void W_Devastator_RemoteExplode(entity this, .entity weaponentity) { - if(!IS_DEAD(self.realowner)) - if(self.realowner.lastrocket) + if(!IS_DEAD(this.realowner)) + if(this.realowner.lastrocket) { - if((self.spawnshieldtime >= 0) - ? (time >= self.spawnshieldtime) // timer - : (vdist(NearestPointOnBox(self.realowner, self.origin) - self.origin, >, WEP_CVAR(devastator, remote_radius))) // safety device + if((this.spawnshieldtime >= 0) + ? (time >= this.spawnshieldtime) // timer + : (vdist(NearestPointOnBox(this.realowner, this.origin) - this.origin, >, WEP_CVAR(devastator, remote_radius))) // safety device ) { - W_Devastator_DoRemoteExplode(self, weaponentity); + W_Devastator_DoRemoteExplode(this, weaponentity); } } } @@ -256,68 +256,68 @@ void W_Devastator_Think(entity this) { vector desireddir, olddir, newdir, desiredorigin, goal; float velspeed, f; - self.nextthink = time; - if(time > self.cnt) + this.nextthink = time; + if(time > this.cnt) { other = world; - self.projectiledeathtype |= HITTYPE_BOUNCE; - W_Devastator_Explode(self); + this.projectiledeathtype |= HITTYPE_BOUNCE; + W_Devastator_Explode(this); return; } // accelerate - makevectors(self.angles.x * '-1 0 0' + self.angles.y * '0 1 0'); - velspeed = WEP_CVAR(devastator, speed) * W_WeaponSpeedFactor(self.realowner) - (self.velocity * v_forward); + makevectors(this.angles.x * '-1 0 0' + this.angles.y * '0 1 0'); + velspeed = WEP_CVAR(devastator, speed) * W_WeaponSpeedFactor(this.realowner) - (this.velocity * v_forward); if(velspeed > 0) - self.velocity = self.velocity + v_forward * min(WEP_CVAR(devastator, speedaccel) * W_WeaponSpeedFactor(self.realowner) * frametime, velspeed); + this.velocity = this.velocity + v_forward * min(WEP_CVAR(devastator, speedaccel) * W_WeaponSpeedFactor(this.realowner) * frametime, velspeed); // laser guided, or remote detonation - if(PS(self.realowner).m_weapon == WEP_DEVASTATOR) + if(PS(this.realowner).m_weapon == WEP_DEVASTATOR) { - if(self == self.realowner.lastrocket) - if(!self.realowner.rl_release) - if(!PHYS_INPUT_BUTTON_ATCK2(self)) + if(this == this.realowner.lastrocket) + if(!this.realowner.rl_release) + if(!PHYS_INPUT_BUTTON_ATCK2(this)) if(WEP_CVAR(devastator, guiderate)) - if(time > self.pushltime) - if(!IS_DEAD(self.realowner)) + if(time > this.pushltime) + if(!IS_DEAD(this.realowner)) { f = WEP_CVAR(devastator, guideratedelay); if(f) - f = bound(0, (time - self.pushltime) / f, 1); + f = bound(0, (time - this.pushltime) / f, 1); else f = 1; - velspeed = vlen(self.velocity); + velspeed = vlen(this.velocity); - makevectors(self.realowner.v_angle); - desireddir = WarpZone_RefSys_TransformVelocity(self.realowner, self, v_forward); - desiredorigin = WarpZone_RefSys_TransformOrigin(self.realowner, self, self.realowner.origin + self.realowner.view_ofs); - olddir = normalize(self.velocity); + makevectors(this.realowner.v_angle); + desireddir = WarpZone_RefSys_TransformVelocity(this.realowner, this, v_forward); + desiredorigin = WarpZone_RefSys_TransformOrigin(this.realowner, this, this.realowner.origin + this.realowner.view_ofs); + olddir = normalize(this.velocity); // now it gets tricky... we want to move like some curve to approximate the target direction // but we are limiting the rate at which we can turn! - goal = desiredorigin + ((self.origin - desiredorigin) * desireddir + WEP_CVAR(devastator, guidegoal)) * desireddir; - newdir = W_Devastator_SteerTo(olddir, normalize(goal - self.origin), cos(WEP_CVAR(devastator, guiderate) * f * frametime * DEG2RAD)); + goal = desiredorigin + ((this.origin - desiredorigin) * desireddir + WEP_CVAR(devastator, guidegoal)) * desireddir; + newdir = W_Devastator_SteerTo(olddir, normalize(goal - this.origin), cos(WEP_CVAR(devastator, guiderate) * f * frametime * DEG2RAD)); - self.velocity = newdir * velspeed; - self.angles = vectoangles(self.velocity); + this.velocity = newdir * velspeed; + this.angles = vectoangles(this.velocity); - if(!self.count) + if(!this.count) { - Send_Effect(EFFECT_ROCKET_GUIDE, self.origin, self.velocity, 1); + Send_Effect(EFFECT_ROCKET_GUIDE, this.origin, this.velocity, 1); // TODO add a better sound here - sound(self.realowner, CH_WEAPON_B, SND_ROCKET_MODE, VOL_BASE, ATTN_NORM); - self.count = 1; + sound(this.realowner, CH_WEAPON_B, SND_ROCKET_MODE, VOL_BASE, ATTN_NORM); + this.count = 1; } } .entity weaponentity = weaponentities[0]; // TODO: unhardcode - if(self.rl_detonate_later) - W_Devastator_RemoteExplode(self, weaponentity); + if(this.rl_detonate_later) + W_Devastator_RemoteExplode(this, weaponentity); } - if(self.csqcprojectile_clientanimate == 0) - UpdateCSQCProjectile(self); + if(this.csqcprojectile_clientanimate == 0) + UpdateCSQCProjectile(this); } void W_Devastator_Touch(entity this) @@ -348,18 +348,18 @@ void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float d } void W_Devastator_Attack(Weapon thiswep, entity actor) -{entity this = actor; +{ entity missile; entity flash; - W_DecreaseAmmo(thiswep, self, WEP_CVAR(devastator, ammo)); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR(devastator, ammo)); - W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(devastator, damage)); + W_SetupShot_ProjectileSize(actor, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(devastator, damage)); Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); - missile = WarpZone_RefSys_SpawnSameRefSys(self); - missile.owner = missile.realowner = self; - self.lastrocket = missile; + missile = WarpZone_RefSys_SpawnSameRefSys(actor); + missile.owner = missile.realowner = actor; + actor.lastrocket = missile; if(WEP_CVAR(devastator, detonatedelay) >= 0) missile.spawnshieldtime = time + WEP_CVAR(devastator, detonatedelay); else @@ -398,10 +398,10 @@ void W_Devastator_Attack(Weapon thiswep, entity actor) setmodel(flash, MDL_DEVASTATOR_MUZZLEFLASH); // precision set below SUB_SetFade(flash, time, 0.1); flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION; - W_AttachToShotorg(self, flash, '5 0 0'); + W_AttachToShotorg(actor, flash, '5 0 0'); // common properties - MUTATOR_CALLHOOK(EditProjectile, self, missile); + MUTATOR_CALLHOOK(EditProjectile, actor, missile); } #if 0 @@ -409,35 +409,34 @@ METHOD(Devastator, wr_aim, void(entity thiswep, entity actor)) { entity this = actor; // aim and decide to fire if appropriate - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false); + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false); if(skill >= 2) // skill 0 and 1 bots won't detonate rockets! { // decide whether to detonate rockets entity missile, targetlist, targ; targetlist = findchainfloat(bot_attack, true); - for(missile = world; (missile = find(missile, classname, "rocket")); ) if(missile.realowner == self) + for(missile = world; (missile = find(missile, classname, "rocket")); ) if(missile.realowner == actor) { targ = targetlist; while(targ) { if(targ != missile.realowner && vlen(targ.origin - missile.origin) < WEP_CVAR(devastator, radius)) { - PHYS_INPUT_BUTTON_ATCK2(self) = true; + PHYS_INPUT_BUTTON_ATCK2(actor) = true; break; } targ = targ.chain; } } - if(PHYS_INPUT_BUTTON_ATCK2(self)) PHYS_INPUT_BUTTON_ATCK(self) = false; + if(PHYS_INPUT_BUTTON_ATCK2(actor)) PHYS_INPUT_BUTTON_ATCK(actor) = false; } } #else METHOD(Devastator, wr_aim, void(entity thiswep, entity actor)) { - entity this = actor; // aim and decide to fire if appropriate - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false); + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false); if(skill >= 2) // skill 0 and 1 bots won't detonate rockets! { // decide whether to detonate rockets @@ -452,7 +451,7 @@ METHOD(Devastator, wr_aim, void(entity thiswep, entity actor)) teamdamage = 0; enemydamage = 0; targetlist = findchainfloat(bot_attack, true); - FOREACH_ENTITY_ENT(realowner, self, + FOREACH_ENTITY_ENT(realowner, actor, { if(it.classname != "rocket") continue; @@ -462,23 +461,23 @@ METHOD(Devastator, wr_aim, void(entity thiswep, entity actor)) d = vlen(targ.origin + (targ.mins + targ.maxs) * 0.5 - it.origin); d = bound(0, edgedamage + (coredamage - edgedamage) * sqrt(1 - d * recipricoledgeradius), 10000); // count potential damage according to type of target - if(targ == self) + if(targ == actor) selfdamage = selfdamage + d; - else if(targ.team == self.team && teamplay) + else if(targ.team == actor.team && teamplay) teamdamage = teamdamage + d; - else if(bot_shouldattack(self, targ)) + else if(bot_shouldattack(actor, targ)) enemydamage = enemydamage + d; targ = targ.chain; } }); float desirabledamage; desirabledamage = enemydamage; - if(time > self.invincible_finished && time > self.spawnshieldtime) + if(time > actor.invincible_finished && time > actor.spawnshieldtime) desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent; - if(teamplay && self.team) + if(teamplay && actor.team) desirabledamage = desirabledamage - teamdamage; - FOREACH_ENTITY_ENT(realowner, self, + FOREACH_ENTITY_ENT(realowner, actor, { if(it.classname != "rocket") continue; @@ -492,32 +491,32 @@ METHOD(Devastator, wr_aim, void(entity thiswep, entity actor)) if( (v_forward * normalize(it.origin - targ.origin)< 0.1) && desirabledamage > 0.1*coredamage - ) PHYS_INPUT_BUTTON_ATCK2(self) = true; + ) PHYS_INPUT_BUTTON_ATCK2(actor) = true; targ = targ.chain; } } else { - float distance; distance= bound(300,vlen(self.origin-self.enemy.origin),30000); + float distance; distance= bound(300,vlen(actor.origin-actor.enemy.origin),30000); //As the distance gets larger, a correct detonation gets near imposible //Bots are assumed to use the rocket spawnfunc_light to see if the rocket gets near a player - if(v_forward * normalize(it.origin - self.enemy.origin)< 0.1) - if(IS_PLAYER(self.enemy)) + if(v_forward * normalize(it.origin - actor.enemy.origin)< 0.1) + if(IS_PLAYER(actor.enemy)) if(desirabledamage >= 0.1*coredamage) if(random()/distance*300 > frametime*bound(0,(10-skill)*0.2,1)) - PHYS_INPUT_BUTTON_ATCK2(self) = true; + PHYS_INPUT_BUTTON_ATCK2(actor) = true; // dprint(ftos(random()/distance*300),">");dprint(ftos(frametime*bound(0,(10-skill)*0.2,1)),"\n"); } }); // if we would be doing at X percent of the core damage, detonate it // but don't fire a new shot at the same time! if(desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events - PHYS_INPUT_BUTTON_ATCK2(self) = true; - if((skill > 6.5) && (selfdamage > self.health)) - PHYS_INPUT_BUTTON_ATCK2(self) = false; - //if(PHYS_INPUT_BUTTON_ATCK2(self) == true) + PHYS_INPUT_BUTTON_ATCK2(actor) = true; + if((skill > 6.5) && (selfdamage > actor.health)) + PHYS_INPUT_BUTTON_ATCK2(actor) = false; + //if(PHYS_INPUT_BUTTON_ATCK2(actor) == true) // dprint(ftos(desirabledamage),"\n"); - if(PHYS_INPUT_BUTTON_ATCK2(self)) PHYS_INPUT_BUTTON_ATCK(self) = false; + if(PHYS_INPUT_BUTTON_ATCK2(actor)) PHYS_INPUT_BUTTON_ATCK(actor) = false; } } #endif @@ -559,8 +558,7 @@ METHOD(Devastator, wr_think, void(entity thiswep, entity actor, .entity weaponen } METHOD(Devastator, wr_setup, void(entity thiswep, entity actor)) { - entity this = actor; - self.rl_release = 1; + actor.rl_release = 1; } METHOD(Devastator, wr_checkammo1, bool(entity thiswep, entity actor)) { @@ -604,9 +602,8 @@ METHOD(Devastator, wr_checkammo2, bool(entity thiswep, entity actor)) } METHOD(Devastator, wr_resetplayer, void(entity thiswep, entity actor)) { - entity this = actor; - self.lastrocket = NULL; // stop rocket guiding, no revenge from the grave! - self.rl_release = 0; + actor.lastrocket = NULL; // stop rocket guiding, no revenge from the grave! + actor.rl_release = 0; } METHOD(Devastator, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { @@ -629,12 +626,11 @@ METHOD(Devastator, wr_killmessage, Notification(entity thiswep)) METHOD(Devastator, wr_impacteffect, void(entity thiswep, entity actor)) { - entity this = actor; vector org2; org2 = w_org + w_backoff * 12; pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTN_NORM); + sound(actor, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTN_NORM); } #endif diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index 19e3ff8a8..f8e7d8427 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -124,13 +124,13 @@ void W_Electro_TriggerCombo(vector org, float rad, entity own) void W_Electro_ExplodeCombo(entity this) { - W_Electro_TriggerCombo(self.origin, WEP_CVAR(electro, combo_comboradius), self.realowner); + W_Electro_TriggerCombo(this.origin, WEP_CVAR(electro, combo_comboradius), this.realowner); - self.event_damage = func_null; + this.event_damage = func_null; RadiusDamage( - self, - self.realowner, + this, + this.realowner, WEP_CVAR(electro, combo_damage), WEP_CVAR(electro, combo_edgedamage), WEP_CVAR(electro, combo_radius), @@ -141,54 +141,54 @@ void W_Electro_ExplodeCombo(entity this) world ); - remove(self); + remove(this); } void W_Electro_Explode(entity this) { if(other.takedamage == DAMAGE_AIM) if(IS_PLAYER(other)) - if(DIFF_TEAM(self.realowner, other)) + if(DIFF_TEAM(this.realowner, other)) if(!IS_DEAD(other)) if(IsFlying(other)) - Send_Notification(NOTIF_ONE, self.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH); + Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH); - self.event_damage = func_null; - self.takedamage = DAMAGE_NO; + this.event_damage = func_null; + this.takedamage = DAMAGE_NO; - if(self.movetype == MOVETYPE_BOUNCE) + if(this.movetype == MOVETYPE_BOUNCE) { RadiusDamage( - self, - self.realowner, + this, + this.realowner, WEP_CVAR_SEC(electro, damage), WEP_CVAR_SEC(electro, edgedamage), WEP_CVAR_SEC(electro, radius), world, world, WEP_CVAR_SEC(electro, force), - self.projectiledeathtype, + this.projectiledeathtype, other ); } else { - W_Electro_TriggerCombo(self.origin, WEP_CVAR_PRI(electro, comboradius), self.realowner); + W_Electro_TriggerCombo(this.origin, WEP_CVAR_PRI(electro, comboradius), this.realowner); RadiusDamage( - self, - self.realowner, + this, + this.realowner, WEP_CVAR_PRI(electro, damage), WEP_CVAR_PRI(electro, edgedamage), WEP_CVAR_PRI(electro, radius), world, world, WEP_CVAR_PRI(electro, force), - self.projectiledeathtype, + this.projectiledeathtype, other ); } - remove(self); + remove(this); } void W_Electro_Explode_use(entity this, entity actor, entity trigger) @@ -204,7 +204,7 @@ void W_Electro_TouchExplode(entity this) void W_Electro_Bolt_Think(entity this) { - if(time >= self.ltime) + if(time >= this.ltime) { this.use(this, NULL, NULL); return; @@ -213,7 +213,7 @@ void W_Electro_Bolt_Think(entity this) if(WEP_CVAR_PRI(electro, midaircombo_radius)) { float found = 0; - entity e = WarpZone_FindRadius(self.origin, WEP_CVAR_PRI(electro, midaircombo_radius), true); + entity e = WarpZone_FindRadius(this.origin, WEP_CVAR_PRI(electro, midaircombo_radius), true); // loop through nearby orbs and trigger them while(e) @@ -221,7 +221,7 @@ void W_Electro_Bolt_Think(entity this) if(e.classname == "electro_orb") { // change owner to whoever caused the combo explosion - e.realowner = self.realowner; + e.realowner = this.realowner; e.takedamage = DAMAGE_NO; e.classname = "electro_orb_chain"; @@ -249,19 +249,19 @@ void W_Electro_Bolt_Think(entity this) if(found && WEP_CVAR_PRI(electro, midaircombo_explode)) { this.use(this, NULL, NULL); } else - { self.nextthink = min(time + WEP_CVAR_PRI(electro, midaircombo_interval), self.ltime); } + { this.nextthink = min(time + WEP_CVAR_PRI(electro, midaircombo_interval), this.ltime); } } - else { self.nextthink = self.ltime; } + else { this.nextthink = this.ltime; } } void W_Electro_Attack_Bolt(Weapon thiswep, entity actor) -{entity this = actor; +{ entity proj; - W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(electro, ammo)); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(electro, ammo)); W_SetupShot_ProjectileSize( - self, + actor, '0 0 -3', '0 0 -3', false, @@ -274,7 +274,7 @@ void W_Electro_Attack_Bolt(Weapon thiswep, entity actor) Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); proj = new(electro_bolt); - proj.owner = proj.realowner = self; + proj.owner = proj.realowner = actor; proj.bot_dodge = true; proj.bot_dodgerating = WEP_CVAR_PRI(electro, damage); proj.use = W_Electro_Explode_use; @@ -295,19 +295,19 @@ void W_Electro_Attack_Bolt(Weapon thiswep, entity actor) CSQCProjectile(proj, true, PROJECTILE_ELECTRO_BEAM, true); - MUTATOR_CALLHOOK(EditProjectile, self, proj); + MUTATOR_CALLHOOK(EditProjectile, actor, proj); } void W_Electro_Orb_Touch(entity this) { PROJECTILE_TOUCH(this); if(other.takedamage == DAMAGE_AIM) - { if(WEP_CVAR_SEC(electro, touchexplode)) { W_Electro_Explode(self); } } + { if(WEP_CVAR_SEC(electro, touchexplode)) { W_Electro_Explode(this); } } else { - //UpdateCSQCProjectile(self); - spamsound(self, CH_SHOTS, SND(ELECTRO_BOUNCE), VOL_BASE, ATTEN_NORM); - self.projectiledeathtype |= HITTYPE_BOUNCE; + //UpdateCSQCProjectile(this); + spamsound(this, CH_SHOTS, SND(ELECTRO_BOUNCE), VOL_BASE, ATTEN_NORM); + this.projectiledeathtype |= HITTYPE_BOUNCE; } } @@ -354,11 +354,11 @@ void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float } void W_Electro_Attack_Orb(Weapon thiswep, entity actor) -{entity this = actor; - W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(electro, ammo)); +{ + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(electro, ammo)); W_SetupShot_ProjectileSize( - self, + actor, '0 0 -4', '0 0 -4', false, @@ -373,7 +373,7 @@ void W_Electro_Attack_Orb(Weapon thiswep, entity actor) Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); entity proj = new(electro_orb); - proj.owner = proj.realowner = self; + proj.owner = proj.realowner = actor; proj.use = W_Electro_Explode_use; setthink(proj, adaptor_think2use_hittype_splash); proj.bot_dodge = true; @@ -410,17 +410,17 @@ void W_Electro_Attack_Orb(Weapon thiswep, entity actor) CSQCProjectile(proj, true, PROJECTILE_ELECTRO, false); // no culling, it has sound - MUTATOR_CALLHOOK(EditProjectile, self, proj); + MUTATOR_CALLHOOK(EditProjectile, actor, proj); } void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, int fire) -{entity this = actor; - if(self.electro_count > 1) - if(PHYS_INPUT_BUTTON_ATCK2(self)) +{ + if(actor.electro_count > 1) + if(PHYS_INPUT_BUTTON_ATCK2(actor)) if(weapon_prepareattack(thiswep, actor, weaponentity, true, -1)) { W_Electro_Attack_Orb(WEP_ELECTRO, actor); - self.electro_count -= 1; + actor.electro_count -= 1; weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack); return; } @@ -432,30 +432,29 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, i METHOD(Electro, wr_aim, void(entity thiswep, entity actor)) { - entity this = actor; - PHYS_INPUT_BUTTON_ATCK(self) = PHYS_INPUT_BUTTON_ATCK2(self) = false; - if(vdist(self.origin - self.enemy.origin, >, 1000)) { self.bot_secondary_electromooth = 0; } - if(self.bot_secondary_electromooth == 0) + PHYS_INPUT_BUTTON_ATCK(actor) = PHYS_INPUT_BUTTON_ATCK2(actor) = false; + if(vdist(actor.origin - actor.enemy.origin, >, 1000)) { actor.bot_secondary_electromooth = 0; } + if(actor.bot_secondary_electromooth == 0) { float shoot; if(WEP_CVAR_PRI(electro, speed)) - shoot = bot_aim(self, WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, lifetime), false); + shoot = bot_aim(actor, WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, lifetime), false); else - shoot = bot_aim(self, 1000000, 0, 0.001, false); + shoot = bot_aim(actor, 1000000, 0, 0.001, false); if(shoot) { - PHYS_INPUT_BUTTON_ATCK(self) = true; - if(random() < 0.01) self.bot_secondary_electromooth = 1; + PHYS_INPUT_BUTTON_ATCK(actor) = true; + if(random() < 0.01) actor.bot_secondary_electromooth = 1; } } else { - if(bot_aim(self, WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), true)) + if(bot_aim(actor, WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), true)) { - PHYS_INPUT_BUTTON_ATCK2(self) = true; - if(random() < 0.03) self.bot_secondary_electromooth = 0; + PHYS_INPUT_BUTTON_ATCK2(actor) = true; + if(random() < 0.03) actor.bot_secondary_electromooth = 0; } } } @@ -519,8 +518,7 @@ METHOD(Electro, wr_checkammo2, bool(entity thiswep, entity actor)) } METHOD(Electro, wr_resetplayer, void(entity thiswep, entity actor)) { - entity this = actor; - self.electro_secondarytime = time; + actor.electro_secondarytime = time; } METHOD(Electro, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { @@ -553,14 +551,13 @@ METHOD(Electro, wr_killmessage, Notification(entity thiswep)) METHOD(Electro, wr_impacteffect, void(entity thiswep, entity actor)) { - entity this = actor; vector org2; org2 = w_org + w_backoff * 6; if(w_deathtype & HITTYPE_SECONDARY) { pointparticles(EFFECT_ELECTRO_BALLEXPLODE, org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM); + sound(actor, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM); } else { @@ -569,13 +566,13 @@ METHOD(Electro, wr_impacteffect, void(entity thiswep, entity actor)) // this is sent as "primary (w_deathtype & HITTYPE_BOUNCE)" to distinguish it from (w_deathtype & HITTYPE_SECONDARY) bounced balls pointparticles(EFFECT_ELECTRO_COMBO, org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, SND_ELECTRO_IMPACT_COMBO, VOL_BASE, ATTEN_NORM); + sound(actor, CH_SHOTS, SND_ELECTRO_IMPACT_COMBO, VOL_BASE, ATTEN_NORM); } else { pointparticles(EFFECT_ELECTRO_IMPACT, org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM); + sound(actor, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM); } } } diff --git a/qcsrc/common/weapons/weapon/fireball.qc b/qcsrc/common/weapons/weapon/fireball.qc index d6768f9eb..5c21c8ba1 100644 --- a/qcsrc/common/weapons/weapon/fireball.qc +++ b/qcsrc/common/weapons/weapon/fireball.qc @@ -70,46 +70,46 @@ void W_Fireball_Explode(entity this) vector dir; float d; - self.event_damage = func_null; - self.takedamage = DAMAGE_NO; + this.event_damage = func_null; + this.takedamage = DAMAGE_NO; // 1. dist damage - d = (self.realowner.health + self.realowner.armorvalue); - RadiusDamage(self, self.realowner, WEP_CVAR_PRI(fireball, damage), WEP_CVAR_PRI(fireball, edgedamage), WEP_CVAR_PRI(fireball, radius), world, world, WEP_CVAR_PRI(fireball, force), self.projectiledeathtype, other); - if(self.realowner.health + self.realowner.armorvalue >= d) - if(!self.cnt) + d = (this.realowner.health + this.realowner.armorvalue); + RadiusDamage(this, this.realowner, WEP_CVAR_PRI(fireball, damage), WEP_CVAR_PRI(fireball, edgedamage), WEP_CVAR_PRI(fireball, radius), world, world, WEP_CVAR_PRI(fireball, force), this.projectiledeathtype, other); + if(this.realowner.health + this.realowner.armorvalue >= d) + if(!this.cnt) { - modeleffect_spawn("models/sphere/sphere.md3", 0, 0, self.origin, '0 0 0', '0 0 0', '0 0 0', 0, WEP_CVAR_PRI(fireball, bfgradius), 0.2, 0.05, 0.25); + modeleffect_spawn("models/sphere/sphere.md3", 0, 0, this.origin, '0 0 0', '0 0 0', '0 0 0', 0, WEP_CVAR_PRI(fireball, bfgradius), 0.2, 0.05, 0.25); // 2. bfg effect // NOTE: this cannot be made warpzone aware by design. So, better intentionally ignore warpzones here. - for(e = findradius(self.origin, WEP_CVAR_PRI(fireball, bfgradius)); e; e = e.chain) - if(e != self.realowner) if(e.takedamage == DAMAGE_AIM) if(!IS_PLAYER(e) || !self.realowner || DIFF_TEAM(e, self)) + for(e = findradius(this.origin, WEP_CVAR_PRI(fireball, bfgradius)); e; e = e.chain) + if(e != this.realowner) if(e.takedamage == DAMAGE_AIM) if(!IS_PLAYER(e) || !this.realowner || DIFF_TEAM(e, this)) { // can we see fireball? - traceline(e.origin + e.view_ofs, self.origin, MOVE_NORMAL, e); + traceline(e.origin + e.view_ofs, this.origin, MOVE_NORMAL, e); if(/* trace_startsolid || */ trace_fraction != 1) // startsolid should be never happening anyway continue; // can we see player who shot fireball? - traceline(e.origin + e.view_ofs, self.realowner.origin + self.realowner.view_ofs, MOVE_NORMAL, e); - if(trace_ent != self.realowner) + traceline(e.origin + e.view_ofs, this.realowner.origin + this.realowner.view_ofs, MOVE_NORMAL, e); + if(trace_ent != this.realowner) if(/* trace_startsolid || */ trace_fraction != 1) continue; - dist = vlen(self.origin - e.origin - e.view_ofs); + dist = vlen(this.origin - e.origin - e.view_ofs); points = (1 - sqrt(dist / WEP_CVAR_PRI(fireball, bfgradius))); if(points <= 0) continue; - dir = normalize(e.origin + e.view_ofs - self.origin); + dir = normalize(e.origin + e.view_ofs - this.origin); - if(accuracy_isgooddamage(self.realowner, e)) - accuracy_add(self.realowner, WEP_FIREBALL.m_id, 0, WEP_CVAR_PRI(fireball, bfgdamage) * points); + if(accuracy_isgooddamage(this.realowner, e)) + accuracy_add(this.realowner, WEP_FIREBALL.m_id, 0, WEP_CVAR_PRI(fireball, bfgdamage) * points); - Damage(e, self, self.realowner, WEP_CVAR_PRI(fireball, bfgdamage) * points, self.projectiledeathtype | HITTYPE_BOUNCE | HITTYPE_SPLASH, e.origin + e.view_ofs, WEP_CVAR_PRI(fireball, bfgforce) * dir); + Damage(e, this, this.realowner, WEP_CVAR_PRI(fireball, bfgdamage) * points, this.projectiledeathtype | HITTYPE_BOUNCE | HITTYPE_SPLASH, e.origin + e.view_ofs, WEP_CVAR_PRI(fireball, bfgforce) * dir); Send_Effect(EFFECT_FIREBALL_BFGDAMAGE, e.origin, -1 * dir, 1); } } - remove(self); + remove(this); } void W_Fireball_Explode_use(entity this, entity actor, entity trigger) @@ -133,14 +133,14 @@ void W_Fireball_LaserPlay(entity this, float dt, float dist, float damage, float return; RandomSelection_Init(); - for(e = WarpZone_FindRadius(self.origin, dist, true); e; e = e.chain) - if(e != self.realowner) if(e.takedamage == DAMAGE_AIM) if(!IS_PLAYER(e) || !self.realowner || DIFF_TEAM(e, self)) + for(e = WarpZone_FindRadius(this.origin, dist, true); e; e = e.chain) + if(e != this.realowner) if(e.takedamage == DAMAGE_AIM) if(!IS_PLAYER(e) || !this.realowner || DIFF_TEAM(e, this)) { p = e.origin; p.x += e.mins.x + random() * (e.maxs.x - e.mins.x); p.y += e.mins.y + random() * (e.maxs.y - e.mins.y); p.z += e.mins.z + random() * (e.maxs.z - e.mins.z); - d = vlen(WarpZone_UnTransformOrigin(e, self.origin) - p); + d = vlen(WarpZone_UnTransformOrigin(e, this.origin) - p); if(d < dist) { e.fireball_impactvec = p; @@ -149,27 +149,27 @@ void W_Fireball_LaserPlay(entity this, float dt, float dist, float damage, float } if(RandomSelection_chosen_ent) { - d = vlen(WarpZone_UnTransformOrigin(RandomSelection_chosen_ent, self.origin) - RandomSelection_chosen_ent.fireball_impactvec); + d = vlen(WarpZone_UnTransformOrigin(RandomSelection_chosen_ent, this.origin) - RandomSelection_chosen_ent.fireball_impactvec); d = damage + (edgedamage - damage) * (d / dist); - Fire_AddDamage(RandomSelection_chosen_ent, self.realowner, d * burntime, burntime, self.projectiledeathtype | HITTYPE_BOUNCE); - //trailparticles(self, particleeffectnum(EFFECT_FIREBALL_LASER), self.origin, RandomSelection_chosen_ent.fireball_impactvec); - Send_Effect(EFFECT_FIREBALL_LASER, self.origin, RandomSelection_chosen_ent.fireball_impactvec - self.origin, 1); + Fire_AddDamage(RandomSelection_chosen_ent, this.realowner, d * burntime, burntime, this.projectiledeathtype | HITTYPE_BOUNCE); + //trailparticles(this, particleeffectnum(EFFECT_FIREBALL_LASER), this.origin, RandomSelection_chosen_ent.fireball_impactvec); + Send_Effect(EFFECT_FIREBALL_LASER, this.origin, RandomSelection_chosen_ent.fireball_impactvec - this.origin, 1); } } void W_Fireball_Think(entity this) { - if(time > self.pushltime) + if(time > this.pushltime) { - self.cnt = 1; - self.projectiledeathtype |= HITTYPE_SPLASH; + this.cnt = 1; + this.projectiledeathtype |= HITTYPE_SPLASH; W_Fireball_Explode(this); return; } - W_Fireball_LaserPlay(self, 0.1, WEP_CVAR_PRI(fireball, laserradius), WEP_CVAR_PRI(fireball, laserdamage), WEP_CVAR_PRI(fireball, laseredgedamage), WEP_CVAR_PRI(fireball, laserburntime)); + W_Fireball_LaserPlay(this, 0.1, WEP_CVAR_PRI(fireball, laserradius), WEP_CVAR_PRI(fireball, laserdamage), WEP_CVAR_PRI(fireball, laseredgedamage), WEP_CVAR_PRI(fireball, laserburntime)); - self.nextthink = time + 0.1; + this.nextthink = time + 0.1; } void W_Fireball_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) @@ -189,15 +189,15 @@ void W_Fireball_Damage(entity this, entity inflictor, entity attacker, float dam } void W_Fireball_Attack1(entity actor) -{entity this = actor; +{ entity proj; - W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', false, 2, SND_FIREBALL_FIRE2, CH_WEAPON_A, WEP_CVAR_PRI(fireball, damage) + WEP_CVAR_PRI(fireball, bfgdamage)); + W_SetupShot_ProjectileSize(actor, '-16 -16 -16', '16 16 16', false, 2, SND_FIREBALL_FIRE2, CH_WEAPON_A, WEP_CVAR_PRI(fireball, damage) + WEP_CVAR_PRI(fireball, bfgdamage)); Send_Effect(EFFECT_FIREBALL_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); proj = new(plasma_prim); - proj.owner = proj.realowner = self; + proj.owner = proj.realowner = actor; proj.bot_dodge = true; proj.bot_dodgerating = WEP_CVAR_PRI(fireball, damage); proj.pushltime = time + WEP_CVAR_PRI(fireball, lifetime); @@ -205,7 +205,7 @@ void W_Fireball_Attack1(entity actor) setthink(proj, W_Fireball_Think); proj.nextthink = time; proj.health = WEP_CVAR_PRI(fireball, health); - proj.team = self.team; + proj.team = actor.team; proj.event_damage = W_Fireball_Damage; proj.takedamage = DAMAGE_YES; proj.damageforcescale = WEP_CVAR_PRI(fireball, damageforcescale); @@ -223,7 +223,7 @@ void W_Fireball_Attack1(entity actor) CSQCProjectile(proj, true, PROJECTILE_FIREBALL, true); - MUTATOR_CALLHOOK(EditProjectile, self, proj); + MUTATOR_CALLHOOK(EditProjectile, actor, proj); } void W_Fireball_AttackEffect(entity actor, float i, vector f_diff) @@ -266,49 +266,49 @@ void W_Fireball_Attack1_Frame0(Weapon thiswep, entity actor, .entity weaponentit void W_Fireball_Firemine_Think(entity this) { - if(time > self.pushltime) + if(time > this.pushltime) { - remove(self); + remove(this); return; } // make it "hot" once it leaves its owner - if(self.owner) + if(this.owner) { - if(vdist(self.origin - self.owner.origin - self.owner.view_ofs, >, WEP_CVAR_SEC(fireball, laserradius))) + if(vdist(this.origin - this.owner.origin - this.owner.view_ofs, >, WEP_CVAR_SEC(fireball, laserradius))) { - self.cnt += 1; - if(self.cnt == 3) - self.owner = world; + this.cnt += 1; + if(this.cnt == 3) + this.owner = world; } else - self.cnt = 0; + this.cnt = 0; } - W_Fireball_LaserPlay(self, 0.1, WEP_CVAR_SEC(fireball, laserradius), WEP_CVAR_SEC(fireball, laserdamage), WEP_CVAR_SEC(fireball, laseredgedamage), WEP_CVAR_SEC(fireball, laserburntime)); + W_Fireball_LaserPlay(this, 0.1, WEP_CVAR_SEC(fireball, laserradius), WEP_CVAR_SEC(fireball, laserdamage), WEP_CVAR_SEC(fireball, laseredgedamage), WEP_CVAR_SEC(fireball, laserburntime)); - self.nextthink = time + 0.1; + this.nextthink = time + 0.1; } void W_Fireball_Firemine_Touch(entity this) { PROJECTILE_TOUCH(this); if(other.takedamage == DAMAGE_AIM) - if(Fire_AddDamage(other, self.realowner, WEP_CVAR_SEC(fireball, damage), WEP_CVAR_SEC(fireball, damagetime), self.projectiledeathtype) >= 0) + if(Fire_AddDamage(other, this.realowner, WEP_CVAR_SEC(fireball, damage), WEP_CVAR_SEC(fireball, damagetime), this.projectiledeathtype) >= 0) { - remove(self); + remove(this); return; } - self.projectiledeathtype |= HITTYPE_BOUNCE; + this.projectiledeathtype |= HITTYPE_BOUNCE; } void W_Fireball_Attack2(entity actor) -{entity this = actor; +{ entity proj; vector f_diff; float c; - c = self.bulletcounter % 4; + c = actor.bulletcounter % 4; switch(c) { case 0: @@ -325,14 +325,14 @@ void W_Fireball_Attack2(entity actor) f_diff = '+1.25 +3.75 0'; break; } - W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', false, 2, SND_FIREBALL_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(fireball, damage)); - traceline(w_shotorg, w_shotorg + f_diff_x * v_up + f_diff_y * v_right, MOVE_NORMAL, self); + W_SetupShot_ProjectileSize(actor, '-4 -4 -4', '4 4 4', false, 2, SND_FIREBALL_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(fireball, damage)); + traceline(w_shotorg, w_shotorg + f_diff_x * v_up + f_diff_y * v_right, MOVE_NORMAL, actor); w_shotorg = trace_endpos; Send_Effect(EFFECT_FIREBALL_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); proj = new(grenade); - proj.owner = proj.realowner = self; + proj.owner = proj.realowner = actor; proj.bot_dodge = true; proj.bot_dodgerating = WEP_CVAR_SEC(fireball, damage); proj.movetype = MOVETYPE_BOUNCE; @@ -353,28 +353,27 @@ void W_Fireball_Attack2(entity actor) CSQCProjectile(proj, true, PROJECTILE_FIREMINE, true); - MUTATOR_CALLHOOK(EditProjectile, self, proj); + MUTATOR_CALLHOOK(EditProjectile, actor, proj); } METHOD(Fireball, wr_aim, void(entity thiswep, entity actor)) { - entity this = actor; - PHYS_INPUT_BUTTON_ATCK(self) = false; - PHYS_INPUT_BUTTON_ATCK2(self) = false; - if(self.bot_primary_fireballmooth == 0) + PHYS_INPUT_BUTTON_ATCK(actor) = false; + PHYS_INPUT_BUTTON_ATCK2(actor) = false; + if(actor.bot_primary_fireballmooth == 0) { - if(bot_aim(self, WEP_CVAR_PRI(fireball, speed), 0, WEP_CVAR_PRI(fireball, lifetime), false)) + if(bot_aim(actor, WEP_CVAR_PRI(fireball, speed), 0, WEP_CVAR_PRI(fireball, lifetime), false)) { - PHYS_INPUT_BUTTON_ATCK(self) = true; - if(random() < 0.02) self.bot_primary_fireballmooth = 0; + PHYS_INPUT_BUTTON_ATCK(actor) = true; + if(random() < 0.02) actor.bot_primary_fireballmooth = 0; } } else { - if(bot_aim(self, WEP_CVAR_SEC(fireball, speed), WEP_CVAR_SEC(fireball, speed_up), WEP_CVAR_SEC(fireball, lifetime), true)) + if(bot_aim(actor, WEP_CVAR_SEC(fireball, speed), WEP_CVAR_SEC(fireball, speed_up), WEP_CVAR_SEC(fireball, lifetime), true)) { - PHYS_INPUT_BUTTON_ATCK2(self) = true; - if(random() < 0.01) self.bot_primary_fireballmooth = 1; + PHYS_INPUT_BUTTON_ATCK2(actor) = true; + if(random() < 0.01) actor.bot_primary_fireballmooth = 1; } } } @@ -400,8 +399,7 @@ METHOD(Fireball, wr_think, void(entity thiswep, entity actor, .entity weaponenti } METHOD(Fireball, wr_setup, void(entity thiswep, entity actor)) { - entity this = actor; - self.ammo_field = ammo_none; + actor.ammo_field = ammo_none; } METHOD(Fireball, wr_checkammo1, bool(entity thiswep, entity actor)) { @@ -413,8 +411,7 @@ METHOD(Fireball, wr_checkammo2, bool(entity thiswep, entity actor)) } METHOD(Fireball, wr_resetplayer, void(entity thiswep, entity actor)) { - entity this = actor; - self.fireball_primarytime = time; + actor.fireball_primarytime = time; } METHOD(Fireball, wr_suicidemessage, Notification(entity thiswep)) { @@ -436,7 +433,6 @@ METHOD(Fireball, wr_killmessage, Notification(entity thiswep)) METHOD(Fireball, wr_impacteffect, void(entity thiswep, entity actor)) { - entity this = actor; vector org2; if(w_deathtype & HITTYPE_SECONDARY) { @@ -447,7 +443,7 @@ METHOD(Fireball, wr_impacteffect, void(entity thiswep, entity actor)) org2 = w_org + w_backoff * 16; pointparticles(EFFECT_FIREBALL_EXPLODE, org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, SND_FIREBALL_IMPACT2, VOL_BASE, ATTEN_NORM * 0.25); // long range boom + sound(actor, CH_SHOTS, SND_FIREBALL_IMPACT2, VOL_BASE, ATTEN_NORM * 0.25); // long range boom } } diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index a81479869..7914c6b79 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -65,10 +65,10 @@ spawnfunc(weapon_hagar) { weapon_defaultspawnfunc(this, WEP_HAGAR); } void W_Hagar_Explode(entity this) { - self.event_damage = func_null; - RadiusDamage(self, self.realowner, WEP_CVAR_PRI(hagar, damage), WEP_CVAR_PRI(hagar, edgedamage), WEP_CVAR_PRI(hagar, radius), world, world, WEP_CVAR_PRI(hagar, force), self.projectiledeathtype, other); + this.event_damage = func_null; + RadiusDamage(this, this.realowner, WEP_CVAR_PRI(hagar, damage), WEP_CVAR_PRI(hagar, edgedamage), WEP_CVAR_PRI(hagar, radius), world, world, WEP_CVAR_PRI(hagar, force), this.projectiledeathtype, other); - remove(self); + remove(this); } void W_Hagar_Explode_use(entity this, entity actor, entity trigger) @@ -78,10 +78,10 @@ void W_Hagar_Explode_use(entity this, entity actor, entity trigger) void W_Hagar_Explode2(entity this) { - self.event_damage = func_null; - RadiusDamage(self, self.realowner, WEP_CVAR_SEC(hagar, damage), WEP_CVAR_SEC(hagar, edgedamage), WEP_CVAR_SEC(hagar, radius), world, world, WEP_CVAR_SEC(hagar, force), self.projectiledeathtype, other); + this.event_damage = func_null; + RadiusDamage(this, this.realowner, WEP_CVAR_SEC(hagar, damage), WEP_CVAR_SEC(hagar, edgedamage), WEP_CVAR_SEC(hagar, radius), world, world, WEP_CVAR_SEC(hagar, force), this.projectiledeathtype, other); - remove(self); + remove(this); } void W_Hagar_Explode2_use(entity this, entity actor, entity trigger) @@ -123,29 +123,29 @@ void W_Hagar_Touch2(entity this) { PROJECTILE_TOUCH(this); - if(self.cnt > 0 || other.takedamage == DAMAGE_AIM) { + if(this.cnt > 0 || other.takedamage == DAMAGE_AIM) { this.use(this, NULL, NULL); } else { - self.cnt++; - Send_Effect(EFFECT_HAGAR_BOUNCE, self.origin, self.velocity, 1); - self.angles = vectoangles(self.velocity); - self.owner = world; - self.projectiledeathtype |= HITTYPE_BOUNCE; + this.cnt++; + Send_Effect(EFFECT_HAGAR_BOUNCE, this.origin, this.velocity, 1); + this.angles = vectoangles(this.velocity); + this.owner = world; + this.projectiledeathtype |= HITTYPE_BOUNCE; } } void W_Hagar_Attack(Weapon thiswep, entity actor) -{entity this = actor; +{ entity missile; - W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(hagar, ammo)); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(hagar, ammo)); - W_SetupShot(self, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(hagar, damage)); + W_SetupShot(actor, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(hagar, damage)); Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); missile = new(missile); - missile.owner = missile.realowner = self; + missile.owner = missile.realowner = actor; missile.bot_dodge = true; missile.bot_dodgerating = WEP_CVAR_PRI(hagar, damage); @@ -173,21 +173,21 @@ void W_Hagar_Attack(Weapon thiswep, entity actor) CSQCProjectile(missile, true, PROJECTILE_HAGAR, true); - MUTATOR_CALLHOOK(EditProjectile, self, missile); + MUTATOR_CALLHOOK(EditProjectile, actor, missile); } void W_Hagar_Attack2(Weapon thiswep, entity actor) -{entity this = actor; +{ entity missile; - W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hagar, ammo)); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hagar, ammo)); - W_SetupShot(self, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage)); + W_SetupShot(actor, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage)); Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); missile = new(missile); - missile.owner = missile.realowner = self; + missile.owner = missile.realowner = actor; missile.bot_dodge = true; missile.bot_dodgerating = WEP_CVAR_SEC(hagar, damage); @@ -216,12 +216,12 @@ void W_Hagar_Attack2(Weapon thiswep, entity actor) CSQCProjectile(missile, true, PROJECTILE_HAGAR_BOUNCING, true); - MUTATOR_CALLHOOK(EditProjectile, self, missile); + MUTATOR_CALLHOOK(EditProjectile, actor, missile); } .float hagar_loadstep, hagar_loadblock, hagar_loadbeep, hagar_warning; void W_Hagar_Attack2_Load_Release(entity actor, .entity weaponentity) -{entity this = actor; +{ // time to release the rockets we've loaded entity missile; @@ -229,24 +229,24 @@ void W_Hagar_Attack2_Load_Release(entity actor, .entity weaponentity) vector s; vector forward, right, up; - if(!self.hagar_load) + if(!actor.hagar_load) return; - weapon_prepareattack_do(self, weaponentity, true, WEP_CVAR_SEC(hagar, refire)); + weapon_prepareattack_do(actor, weaponentity, true, WEP_CVAR_SEC(hagar, refire)); - W_SetupShot(self, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage)); + W_SetupShot(actor, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage)); Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); forward = v_forward; right = v_right; up = v_up; - shots = self.hagar_load; + shots = actor.hagar_load; missile = world; for(counter = 0; counter < shots; ++counter) { missile = new(missile); - missile.owner = missile.realowner = self; + missile.owner = missile.realowner = actor; missile.bot_dodge = true; missile.bot_dodgerating = WEP_CVAR_SEC(hagar, damage); @@ -291,51 +291,51 @@ void W_Hagar_Attack2_Load_Release(entity actor, .entity weaponentity) CSQCProjectile(missile, true, PROJECTILE_HAGAR, true); - MUTATOR_CALLHOOK(EditProjectile, self, missile); + MUTATOR_CALLHOOK(EditProjectile, actor, missile); } - weapon_thinkf(self, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hagar, load_animtime), w_ready); - self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, refire) * W_WeaponRateFactor(actor); - self.hagar_load = 0; + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hagar, load_animtime), w_ready); + actor.hagar_loadstep = time + WEP_CVAR_SEC(hagar, refire) * W_WeaponRateFactor(actor); + actor.hagar_load = 0; } void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity) -{entity this = actor; +{ // loadable hagar secondary attack, must always run each frame if(time < game_starttime) return; - bool loaded = self.hagar_load >= WEP_CVAR_SEC(hagar, load_max); + bool loaded = actor.hagar_load >= WEP_CVAR_SEC(hagar, load_max); // this is different than WR_CHECKAMMO when it comes to reloading bool enough_ammo; - if(self.items & IT_UNLIMITED_WEAPON_AMMO) + if(actor.items & IT_UNLIMITED_WEAPON_AMMO) enough_ammo = true; else if(autocvar_g_balance_hagar_reload_ammo) - enough_ammo = self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo); + enough_ammo = actor.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo); else - enough_ammo = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hagar, ammo); + enough_ammo = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(hagar, ammo); bool stopped = loaded || !enough_ammo; - if(PHYS_INPUT_BUTTON_ATCK2(self)) + if(PHYS_INPUT_BUTTON_ATCK2(actor)) { - if(PHYS_INPUT_BUTTON_ATCK(self) && WEP_CVAR_SEC(hagar, load_abort)) + if(PHYS_INPUT_BUTTON_ATCK(actor) && WEP_CVAR_SEC(hagar, load_abort)) { - if(self.hagar_load) + if(actor.hagar_load) { // if we pressed primary fire while loading, unload all rockets and abort - self.(weaponentity).state = WS_READY; - W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo - self.hagar_load = 0; - sound(self, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM); + actor.(weaponentity).state = WS_READY; + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hagar, ammo) * actor.hagar_load * -1); // give back ammo + actor.hagar_load = 0; + sound(actor, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM); // pause until we can load rockets again, once we re-press the alt fire button - self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor(actor); + actor.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor(actor); // require letting go of the alt fire button before we can load again - self.hagar_loadblock = true; + actor.hagar_loadblock = true; } } else @@ -343,65 +343,65 @@ void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity) // check if we can attempt to load another rocket if(!stopped) { - if(!self.hagar_loadblock && self.hagar_loadstep < time) + if(!actor.hagar_loadblock && actor.hagar_loadstep < time) { - W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hagar, ammo)); - self.(weaponentity).state = WS_INUSE; - self.hagar_load += 1; - sound(self, CH_WEAPON_B, SND_HAGAR_LOAD, VOL_BASE * 0.8, ATTN_NORM); // sound is too loud according to most + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hagar, ammo)); + actor.(weaponentity).state = WS_INUSE; + actor.hagar_load += 1; + sound(actor, CH_WEAPON_B, SND_HAGAR_LOAD, VOL_BASE * 0.8, ATTN_NORM); // sound is too loud according to most - if(self.hagar_load >= WEP_CVAR_SEC(hagar, load_max)) + if(actor.hagar_load >= WEP_CVAR_SEC(hagar, load_max)) stopped = true; else - self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor(actor); + actor.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor(actor); } } - if(stopped && !self.hagar_loadbeep && self.hagar_load) // prevents the beep from playing each frame + if(stopped && !actor.hagar_loadbeep && actor.hagar_load) // prevents the beep from playing each frame { // if this is the last rocket we can load, play a beep sound to notify the player - sound(self, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM); - self.hagar_loadbeep = true; - self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_hold) * W_WeaponRateFactor(actor); + sound(actor, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM); + actor.hagar_loadbeep = true; + actor.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_hold) * W_WeaponRateFactor(actor); } } } - else if(self.hagar_loadblock) + else if(actor.hagar_loadblock) { // the alt fire button has been released, so re-enable loading if blocked - self.hagar_loadblock = false; + actor.hagar_loadblock = false; } - if(self.hagar_load) + if(actor.hagar_load) { // play warning sound if we're about to release - if(stopped && self.hagar_loadstep - 0.5 < time && WEP_CVAR_SEC(hagar, load_hold) >= 0) + if(stopped && actor.hagar_loadstep - 0.5 < time && WEP_CVAR_SEC(hagar, load_hold) >= 0) { - if(!self.hagar_warning) // prevents the beep from playing each frame + if(!actor.hagar_warning) // prevents the beep from playing each frame { // we're about to automatically release after holding time, play a beep sound to notify the player - sound(self, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM); - self.hagar_warning = true; + sound(actor, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM); + actor.hagar_warning = true; } } // release if player let go of button or if they've held it in too long - if(!PHYS_INPUT_BUTTON_ATCK2(self) || (stopped && self.hagar_loadstep < time && WEP_CVAR_SEC(hagar, load_hold) >= 0)) + if(!PHYS_INPUT_BUTTON_ATCK2(actor) || (stopped && actor.hagar_loadstep < time && WEP_CVAR_SEC(hagar, load_hold) >= 0)) { - self.(weaponentity).state = WS_READY; - W_Hagar_Attack2_Load_Release(self, weaponentity); + actor.(weaponentity).state = WS_READY; + W_Hagar_Attack2_Load_Release(actor, weaponentity); } } else { - self.hagar_loadbeep = false; - self.hagar_warning = false; + actor.hagar_loadbeep = false; + actor.hagar_warning = false; // we aren't checking ammo during an attack, so we must do it here - if(!(thiswep.wr_checkammo1(thiswep, self) + thiswep.wr_checkammo2(thiswep, self))) - if(!(self.items & IT_UNLIMITED_WEAPON_AMMO)) + if(!(thiswep.wr_checkammo1(thiswep, actor) + thiswep.wr_checkammo2(thiswep, actor))) + if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) { // note: this doesn't force the switch - W_SwitchToOtherWeapon(self); + W_SwitchToOtherWeapon(actor); return; } } @@ -439,11 +439,10 @@ void W_Hagar_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int METHOD(Hagar, wr_aim, void(entity thiswep, entity actor)) { - entity this = actor; if(random()>0.15) - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false); + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false); else // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming - PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false); + PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false); } METHOD(Hagar, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { @@ -481,13 +480,12 @@ METHOD(Hagar, wr_gonethink, void(entity thiswep, entity actor)) } METHOD(Hagar, wr_setup, void(entity thiswep, entity actor)) { - entity this = actor; - self.hagar_loadblock = false; + actor.hagar_loadblock = false; - if(self.hagar_load) + if(actor.hagar_load) { - W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo if necessary - self.hagar_load = 0; + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hagar, ammo) * actor.hagar_load * -1); // give back ammo if necessary + actor.hagar_load = 0; } } METHOD(Hagar, wr_checkammo1, bool(entity thiswep, entity actor)) @@ -504,8 +502,7 @@ METHOD(Hagar, wr_checkammo2, bool(entity thiswep, entity actor)) } METHOD(Hagar, wr_resetplayer, void(entity thiswep, entity actor)) { - entity this = actor; - self.hagar_load = 0; + actor.hagar_load = 0; } METHOD(Hagar, wr_playerdeath, void(entity thiswep, entity actor)) { @@ -516,9 +513,8 @@ METHOD(Hagar, wr_playerdeath, void(entity thiswep, entity actor)) } METHOD(Hagar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - entity this = actor; - if(!self.hagar_load) // require releasing loaded rockets first - W_Reload(self, min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND_RELOAD); + if(!actor.hagar_load) // require releasing loaded rockets first + W_Reload(actor, min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND_RELOAD); } METHOD(Hagar, wr_suicidemessage, Notification(entity thiswep)) { @@ -537,18 +533,17 @@ METHOD(Hagar, wr_killmessage, Notification(entity thiswep)) METHOD(Hagar, wr_impacteffect, void(entity thiswep, entity actor)) { - entity this = actor; vector org2; org2 = w_org + w_backoff * 6; pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1); if(!w_issilent) { if(w_random<0.15) - sound(self, CH_SHOTS, SND_HAGEXP1, VOL_BASE, ATTN_NORM); + sound(actor, CH_SHOTS, SND_HAGEXP1, VOL_BASE, ATTN_NORM); else if(w_random<0.7) - sound(self, CH_SHOTS, SND_HAGEXP2, VOL_BASE, ATTN_NORM); + sound(actor, CH_SHOTS, SND_HAGEXP2, VOL_BASE, ATTN_NORM); else - sound(self, CH_SHOTS, SND_HAGEXP3, VOL_BASE, ATTN_NORM); + sound(actor, CH_SHOTS, SND_HAGEXP3, VOL_BASE, ATTN_NORM); } } diff --git a/qcsrc/common/weapons/weapon/hlac.qc b/qcsrc/common/weapons/weapon/hlac.qc index 9d82c34f2..6b09f9011 100644 --- a/qcsrc/common/weapons/weapon/hlac.qc +++ b/qcsrc/common/weapons/weapon/hlac.qc @@ -60,37 +60,37 @@ void W_HLAC_Touch(entity this) PROJECTILE_TOUCH(this); - self.event_damage = func_null; + this.event_damage = func_null; - isprimary = !(self.projectiledeathtype & HITTYPE_SECONDARY); + isprimary = !(this.projectiledeathtype & HITTYPE_SECONDARY); - RadiusDamage(self, self.realowner, WEP_CVAR_BOTH(hlac, isprimary, damage), WEP_CVAR_BOTH(hlac, isprimary, edgedamage), WEP_CVAR_BOTH(hlac, isprimary, radius), world, world, WEP_CVAR_BOTH(hlac, isprimary, force), self.projectiledeathtype, other); + RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(hlac, isprimary, damage), WEP_CVAR_BOTH(hlac, isprimary, edgedamage), WEP_CVAR_BOTH(hlac, isprimary, radius), world, world, WEP_CVAR_BOTH(hlac, isprimary, force), this.projectiledeathtype, other); - remove(self); + remove(this); } void W_HLAC_Attack(Weapon thiswep, entity actor) -{entity this = actor; +{ entity missile; float spread; - W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(hlac, ammo)); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(hlac, ammo)); - spread = WEP_CVAR_PRI(hlac, spread_min) + (WEP_CVAR_PRI(hlac, spread_add) * self.misc_bulletcounter); + spread = WEP_CVAR_PRI(hlac, spread_min) + (WEP_CVAR_PRI(hlac, spread_add) * actor.misc_bulletcounter); spread = min(spread,WEP_CVAR_PRI(hlac, spread_max)); - if(self.crouch) + if(actor.crouch) spread = spread * WEP_CVAR_PRI(hlac, spread_crouchmod); - W_SetupShot(self, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(hlac, damage)); + W_SetupShot(actor, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(hlac, damage)); Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); if(!autocvar_g_norecoil) { - self.punchangle_x = random() - 0.5; - self.punchangle_y = random() - 0.5; + actor.punchangle_x = random() - 0.5; + actor.punchangle_y = random() - 0.5; } missile = new(hlacbolt); - missile.owner = missile.realowner = self; + missile.owner = missile.realowner = actor; missile.bot_dodge = true; missile.bot_dodgerating = WEP_CVAR_PRI(hlac, damage); @@ -114,25 +114,25 @@ void W_HLAC_Attack(Weapon thiswep, entity actor) CSQCProjectile(missile, true, PROJECTILE_HLAC, true); - MUTATOR_CALLHOOK(EditProjectile, self, missile); + MUTATOR_CALLHOOK(EditProjectile, actor, missile); } void W_HLAC_Attack2(entity actor) -{entity this = actor; +{ entity missile; float spread; spread = WEP_CVAR_SEC(hlac, spread); - if(self.crouch) + if(actor.crouch) spread = spread * WEP_CVAR_SEC(hlac, spread_crouchmod); - W_SetupShot(self, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hlac, damage)); + W_SetupShot(actor, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hlac, damage)); Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); missile = new(hlacbolt); - missile.owner = missile.realowner = self; + missile.owner = missile.realowner = actor; missile.bot_dodge = true; missile.bot_dodgerating = WEP_CVAR_SEC(hlac, damage); @@ -157,7 +157,7 @@ void W_HLAC_Attack2(entity actor) CSQCProjectile(missile, true, PROJECTILE_HLAC, true); - MUTATOR_CALLHOOK(EditProjectile, self, missile); + MUTATOR_CALLHOOK(EditProjectile, actor, missile); } // weapon frames @@ -192,25 +192,24 @@ void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int } void W_HLAC_Attack2_Frame(Weapon thiswep, entity actor) -{entity this = actor; +{ float i; - W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hlac, ammo)); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hlac, ammo)); for(i=WEP_CVAR_SEC(hlac, shots);i>0;--i) W_HLAC_Attack2(actor); if(!autocvar_g_norecoil) { - self.punchangle_x = random() - 0.5; - self.punchangle_y = random() - 0.5; + actor.punchangle_x = random() - 0.5; + actor.punchangle_y = random() - 0.5; } } METHOD(HLAC, wr_aim, void(entity thiswep, entity actor)) { - entity this = actor; - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false); + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false); } METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { @@ -265,12 +264,11 @@ METHOD(HLAC, wr_killmessage, Notification(entity thiswep)) METHOD(HLAC, wr_impacteffect, void(entity thiswep, entity actor)) { - entity this = actor; vector org2; org2 = w_org + w_backoff * 6; pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1); if(!w_issilent) - sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); + sound(actor, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); } #endif diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index 591961110..8bfc9ebc0 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -83,39 +83,39 @@ void W_Hook_ExplodeThink(entity this) { float dt, dmg_remaining_next, f; - dt = time - self.teleport_time; - dmg_remaining_next = pow(bound(0, 1 - dt / self.dmg_duration, 1), self.dmg_power); + dt = time - this.teleport_time; + dmg_remaining_next = pow(bound(0, 1 - dt / this.dmg_duration, 1), this.dmg_power); - f = self.dmg_last - dmg_remaining_next; - self.dmg_last = dmg_remaining_next; + f = this.dmg_last - dmg_remaining_next; + this.dmg_last = dmg_remaining_next; - RadiusDamage(self, self.realowner, self.dmg * f, self.dmg_edge * f, self.dmg_radius, self.realowner, world, self.dmg_force * f, self.projectiledeathtype, world); - self.projectiledeathtype |= HITTYPE_BOUNCE; - //RadiusDamage(self, world, self.dmg * f, self.dmg_edge * f, self.dmg_radius, world, world, self.dmg_force * f, self.projectiledeathtype, world); + RadiusDamage(this, this.realowner, this.dmg * f, this.dmg_edge * f, this.dmg_radius, this.realowner, world, this.dmg_force * f, this.projectiledeathtype, world); + this.projectiledeathtype |= HITTYPE_BOUNCE; + //RadiusDamage(this, world, this.dmg * f, this.dmg_edge * f, this.dmg_radius, world, world, this.dmg_force * f, this.projectiledeathtype, world); - if(dt < self.dmg_duration) - self.nextthink = time + 0.05; // soon + if(dt < this.dmg_duration) + this.nextthink = time + 0.05; // soon else - remove(self); + remove(this); } void W_Hook_Explode2(entity this) { - self.event_damage = func_null; - settouch(self, func_null); - self.effects |= EF_NODRAW; - - setthink(self, W_Hook_ExplodeThink); - self.nextthink = time; - self.dmg = WEP_CVAR_SEC(hook, damage); - self.dmg_edge = WEP_CVAR_SEC(hook, edgedamage); - self.dmg_radius = WEP_CVAR_SEC(hook, radius); - self.dmg_force = WEP_CVAR_SEC(hook, force); - self.dmg_power = WEP_CVAR_SEC(hook, power); - self.dmg_duration = WEP_CVAR_SEC(hook, duration); - self.teleport_time = time; - self.dmg_last = 1; - self.movetype = MOVETYPE_NONE; + this.event_damage = func_null; + settouch(this, func_null); + this.effects |= EF_NODRAW; + + setthink(this, W_Hook_ExplodeThink); + this.nextthink = time; + this.dmg = WEP_CVAR_SEC(hook, damage); + this.dmg_edge = WEP_CVAR_SEC(hook, edgedamage); + this.dmg_radius = WEP_CVAR_SEC(hook, radius); + this.dmg_force = WEP_CVAR_SEC(hook, force); + this.dmg_power = WEP_CVAR_SEC(hook, power); + this.dmg_duration = WEP_CVAR_SEC(hook, duration); + this.teleport_time = time; + this.dmg_last = 1; + this.movetype = MOVETYPE_NONE; } void W_Hook_Explode2_use(entity this, entity actor, entity trigger) @@ -279,8 +279,7 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, } METHOD(Hook, wr_setup, void(entity thiswep, entity actor)) { - entity this = actor; - self.hook_state &= ~HOOK_WAITING_FOR_RELEASE; + actor.hook_state &= ~HOOK_WAITING_FOR_RELEASE; } METHOD(Hook, wr_checkammo1, bool(Hook thiswep, entity actor)) { @@ -297,10 +296,9 @@ METHOD(Hook, wr_checkammo2, bool(Hook thiswep, entity actor)) } METHOD(Hook, wr_resetplayer, void(entity thiswep, entity actor)) { - entity this = actor; - RemoveGrapplingHook(self); - self.hook_time = 0; - self.hook_refire = time; + RemoveGrapplingHook(actor); + actor.hook_time = 0; + actor.hook_refire = time; } METHOD(Hook, wr_killmessage, Notification(entity thiswep)) { @@ -312,12 +310,11 @@ METHOD(Hook, wr_killmessage, Notification(entity thiswep)) METHOD(Hook, wr_impacteffect, void(entity thiswep, entity actor)) { - entity this = actor; vector org2; org2 = w_org + w_backoff * 2; pointparticles(EFFECT_HOOK_EXPLODE, org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, SND_HOOKBOMB_IMPACT, VOL_BASE, ATTN_NORM); + sound(actor, CH_SHOTS, SND_HOOKBOMB_IMPACT, VOL_BASE, ATTN_NORM); } #endif diff --git a/qcsrc/common/weapons/weapon/machinegun.qc b/qcsrc/common/weapons/weapon/machinegun.qc index 2bf2f18bd..03c305ca9 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -89,53 +89,53 @@ void W_MachineGun_MuzzleFlash_Think(entity this) } void W_MachineGun_MuzzleFlash(entity actor) -{entity this = actor; - if(self.muzzle_flash == world) - self.muzzle_flash = spawn(); +{ + if(actor.muzzle_flash == world) + actor.muzzle_flash = spawn(); // muzzle flash for 1st person view - setmodel(self.muzzle_flash, MDL_MACHINEGUN_MUZZLEFLASH); // precision set below - - self.muzzle_flash.scale = 0.75; - setthink(self.muzzle_flash, W_MachineGun_MuzzleFlash_Think); - self.muzzle_flash.nextthink = time + 0.02; - self.muzzle_flash.frame = 2; - self.muzzle_flash.alpha = 0.75; - self.muzzle_flash.angles_z = random() * 180; - self.muzzle_flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION; - self.muzzle_flash.owner = self.muzzle_flash.realowner = self; + setmodel(actor.muzzle_flash, MDL_MACHINEGUN_MUZZLEFLASH); // precision set below + + actor.muzzle_flash.scale = 0.75; + setthink(actor.muzzle_flash, W_MachineGun_MuzzleFlash_Think); + actor.muzzle_flash.nextthink = time + 0.02; + actor.muzzle_flash.frame = 2; + actor.muzzle_flash.alpha = 0.75; + actor.muzzle_flash.angles_z = random() * 180; + actor.muzzle_flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION; + actor.muzzle_flash.owner = actor.muzzle_flash.realowner = actor; } void W_MachineGun_Attack(Weapon thiswep, int deathtype, entity actor, .entity weaponentity) -{entity this = actor; - W_SetupShot(self, true, 0, SND_UZI_FIRE, CH_WEAPON_A, ((self.misc_bulletcounter == 1) ? WEP_CVAR(machinegun, first_damage) : WEP_CVAR(machinegun, sustained_damage))); +{ + W_SetupShot(actor, true, 0, SND_UZI_FIRE, CH_WEAPON_A, ((actor.misc_bulletcounter == 1) ? WEP_CVAR(machinegun, first_damage) : WEP_CVAR(machinegun, sustained_damage))); if(!autocvar_g_norecoil) { - self.punchangle_x = random() - 0.5; - self.punchangle_y = random() - 0.5; + actor.punchangle_x = random() - 0.5; + actor.punchangle_y = random() - 0.5; } int slot = weaponslot(weaponentity); // this attack_finished just enforces a cooldown at the end of a burst - ATTACK_FINISHED(self, slot) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor(actor); + ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor(actor); - if(self.misc_bulletcounter == 1) - fireBullet(self, w_shotorg, w_shotdir, WEP_CVAR(machinegun, first_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, first_damage), WEP_CVAR(machinegun, first_force), deathtype, 0); + if(actor.misc_bulletcounter == 1) + fireBullet(actor, w_shotorg, w_shotdir, WEP_CVAR(machinegun, first_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, first_damage), WEP_CVAR(machinegun, first_force), deathtype, 0); else - fireBullet(self, w_shotorg, w_shotdir, WEP_CVAR(machinegun, sustained_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), deathtype, 0); + fireBullet(actor, w_shotorg, w_shotdir, WEP_CVAR(machinegun, sustained_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), deathtype, 0); Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); - W_MachineGun_MuzzleFlash(self); - W_AttachToShotorg(self, self.muzzle_flash, '5 0 0'); + W_MachineGun_MuzzleFlash(actor); + W_AttachToShotorg(actor, actor.muzzle_flash, '5 0 0'); // casing code if(autocvar_g_casings >= 2) - SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, self); + SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, actor); - if(self.misc_bulletcounter == 1) - W_DecreaseAmmo(thiswep, self, WEP_CVAR(machinegun, first_ammo)); + if(actor.misc_bulletcounter == 1) + W_DecreaseAmmo(thiswep, actor, WEP_CVAR(machinegun, first_ammo)); else - W_DecreaseAmmo(thiswep, self, WEP_CVAR(machinegun, sustained_ammo)); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR(machinegun, sustained_ammo)); } // weapon frames @@ -244,11 +244,10 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit METHOD(MachineGun, wr_aim, void(entity thiswep, entity actor)) { - entity this = actor; - if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200)) - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 0.001, false); + if(vdist(actor.origin - actor.enemy.origin, <, 3000 - bound(0, skill, 10) * 200)) + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, 1000000, 0, 0.001, false); else - PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, 1000000, 0, 0.001, false); + PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, 1000000, 0, 0.001, false); } METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { @@ -356,12 +355,11 @@ METHOD(MachineGun, wr_killmessage, Notification(entity thiswep)) METHOD(MachineGun, wr_impacteffect, void(entity thiswep, entity actor)) { - entity this = actor; vector org2; org2 = w_org + w_backoff * 2; pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1); if(!w_issilent) - sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTN_NORM); + sound(actor, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTN_NORM); } #endif diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index bc7f8eb39..14a1c6491 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -65,44 +65,44 @@ spawnfunc(weapon_minelayer) { weapon_defaultspawnfunc(this, WEP_MINE_LAYER); } void W_MineLayer_Stick(entity this, entity to) { - spamsound(self, CH_SHOTS, SND(MINE_STICK), VOL_BASE, ATTN_NORM); + spamsound(this, CH_SHOTS, SND(MINE_STICK), VOL_BASE, ATTN_NORM); // in order for mines to face properly when sticking to the ground, they must be a server side entity rather than a csqc projectile entity newmine = spawn(); - newmine.classname = self.classname; + newmine.classname = this.classname; - newmine.bot_dodge = self.bot_dodge; - newmine.bot_dodgerating = self.bot_dodgerating; + newmine.bot_dodge = this.bot_dodge; + newmine.bot_dodgerating = this.bot_dodgerating; - newmine.owner = self.owner; - newmine.realowner = self.realowner; + newmine.owner = this.owner; + newmine.realowner = this.realowner; setsize(newmine, '-4 -4 -4', '4 4 4'); - setorigin(newmine, self.origin); + setorigin(newmine, this.origin); setmodel(newmine, MDL_MINELAYER_MINE); newmine.angles = vectoangles(-trace_plane_normal); // face against the surface newmine.mine_orientation = -trace_plane_normal; - newmine.takedamage = self.takedamage; - newmine.damageforcescale = self.damageforcescale; - newmine.health = self.health; - newmine.event_damage = self.event_damage; - newmine.spawnshieldtime = self.spawnshieldtime; + newmine.takedamage = this.takedamage; + newmine.damageforcescale = this.damageforcescale; + newmine.health = this.health; + newmine.event_damage = this.event_damage; + newmine.spawnshieldtime = this.spawnshieldtime; newmine.damagedbycontents = true; newmine.movetype = MOVETYPE_NONE; // lock the mine in place - newmine.projectiledeathtype = self.projectiledeathtype; + newmine.projectiledeathtype = this.projectiledeathtype; - newmine.mine_time = self.mine_time; + newmine.mine_time = this.mine_time; settouch(newmine, func_null); setthink(newmine, W_MineLayer_Think); newmine.nextthink = time; - newmine.cnt = self.cnt; - newmine.flags = self.flags; + newmine.cnt = this.cnt; + newmine.flags = this.flags; - remove(self); + remove(this); if(to) SetMovetypeFollow(newmine, to); @@ -112,17 +112,17 @@ void W_MineLayer_Explode(entity this) { if(other.takedamage == DAMAGE_AIM) if(IS_PLAYER(other)) - if(DIFF_TEAM(self.realowner, other)) + if(DIFF_TEAM(this.realowner, other)) if(!IS_DEAD(other)) if(IsFlying(other)) - Send_Notification(NOTIF_ONE, self.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT); + Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT); - self.event_damage = func_null; - self.takedamage = DAMAGE_NO; + this.event_damage = func_null; + this.takedamage = DAMAGE_NO; - RadiusDamage(self, self.realowner, WEP_CVAR(minelayer, damage), WEP_CVAR(minelayer, edgedamage), WEP_CVAR(minelayer, radius), world, world, WEP_CVAR(minelayer, force), self.projectiledeathtype, other); + RadiusDamage(this, this.realowner, WEP_CVAR(minelayer, damage), WEP_CVAR(minelayer, edgedamage), WEP_CVAR(minelayer, radius), world, world, WEP_CVAR(minelayer, force), this.projectiledeathtype, other); - if(PS(self.realowner).m_weapon == WEP_MINE_LAYER) + if(PS(this.realowner).m_weapon == WEP_MINE_LAYER) { entity own = this.realowner; Weapon w = WEP_MINE_LAYER; @@ -134,21 +134,21 @@ void W_MineLayer_Explode(entity this) PS(own).m_switchweapon = w_getbestweapon(own); } } - self.realowner.minelayer_mines -= 1; - remove(self); + this.realowner.minelayer_mines -= 1; + remove(this); } void W_MineLayer_DoRemoteExplode(entity this) { - self.event_damage = func_null; - self.takedamage = DAMAGE_NO; + this.event_damage = func_null; + this.takedamage = DAMAGE_NO; - if(self.movetype == MOVETYPE_NONE || self.movetype == MOVETYPE_FOLLOW) - self.velocity = self.mine_orientation; // particle fx and decals need .velocity + if(this.movetype == MOVETYPE_NONE || this.movetype == MOVETYPE_FOLLOW) + this.velocity = this.mine_orientation; // particle fx and decals need .velocity - RadiusDamage(self, self.realowner, WEP_CVAR(minelayer, remote_damage), WEP_CVAR(minelayer, remote_edgedamage), WEP_CVAR(minelayer, remote_radius), world, world, WEP_CVAR(minelayer, remote_force), self.projectiledeathtype | HITTYPE_BOUNCE, world); + RadiusDamage(this, this.realowner, WEP_CVAR(minelayer, remote_damage), WEP_CVAR(minelayer, remote_edgedamage), WEP_CVAR(minelayer, remote_radius), world, world, WEP_CVAR(minelayer, remote_force), this.projectiledeathtype | HITTYPE_BOUNCE, world); - if(PS(self.realowner).m_weapon == WEP_MINE_LAYER) + if(PS(this.realowner).m_weapon == WEP_MINE_LAYER) { entity own = this.realowner; Weapon w = WEP_MINE_LAYER; @@ -161,38 +161,38 @@ void W_MineLayer_DoRemoteExplode(entity this) } } this.realowner.minelayer_mines -= 1; - remove(self); + remove(this); } void W_MineLayer_RemoteExplode(entity this) { - if(!IS_DEAD(self.realowner)) - if((self.spawnshieldtime >= 0) - ? (time >= self.spawnshieldtime) // timer - : (vdist(NearestPointOnBox(self.realowner, self.origin) - self.origin, >, WEP_CVAR(minelayer, remote_radius))) // safety device + if(!IS_DEAD(this.realowner)) + if((this.spawnshieldtime >= 0) + ? (time >= this.spawnshieldtime) // timer + : (vdist(NearestPointOnBox(this.realowner, this.origin) - this.origin, >, WEP_CVAR(minelayer, remote_radius))) // safety device ) { - W_MineLayer_DoRemoteExplode(self); + W_MineLayer_DoRemoteExplode(this); } } void W_MineLayer_ProximityExplode(entity this) { // make sure no friend is in the mine's radius. If there is any, explosion is delayed until he's at a safe distance - if(WEP_CVAR(minelayer, protection) && self.mine_explodeanyway == 0) + if(WEP_CVAR(minelayer, protection) && this.mine_explodeanyway == 0) { entity head; - head = findradius(self.origin, WEP_CVAR(minelayer, radius)); + head = findradius(this.origin, WEP_CVAR(minelayer, radius)); while(head) { - if(head == self.realowner || SAME_TEAM(head, self.realowner)) + if(head == this.realowner || SAME_TEAM(head, this.realowner)) return; head = head.chain; } } - self.mine_time = 0; - W_MineLayer_Explode(self); + this.mine_time = 0; + W_MineLayer_Explode(this); } int W_MineLayer_Count(entity e) @@ -209,74 +209,74 @@ void W_MineLayer_Think(entity this) { entity head; - self.nextthink = time; + this.nextthink = time; - if(self.movetype == MOVETYPE_FOLLOW) + if(this.movetype == MOVETYPE_FOLLOW) { - if(LostMovetypeFollow(self)) + if(LostMovetypeFollow(this)) { - UnsetMovetypeFollow(self); - self.movetype = MOVETYPE_NONE; + UnsetMovetypeFollow(this); + this.movetype = MOVETYPE_NONE; } } // our lifetime has expired, it's time to die - mine_time just allows us to play a sound for this // TODO: replace this mine_trigger.wav sound with a real countdown - if((time > self.cnt) && (!self.mine_time) && (self.cnt > 0)) + if((time > this.cnt) && (!this.mine_time) && (this.cnt > 0)) { if(WEP_CVAR(minelayer, lifetime_countdown) > 0) - spamsound(self, CH_SHOTS, SND(MINE_TRIGGER), VOL_BASE, ATTN_NORM); - self.mine_time = time + WEP_CVAR(minelayer, lifetime_countdown); - self.mine_explodeanyway = 1; // make the mine super aggressive -- Samual: Rather, make it not care if a team mate is near. + spamsound(this, CH_SHOTS, SND(MINE_TRIGGER), VOL_BASE, ATTN_NORM); + this.mine_time = time + WEP_CVAR(minelayer, lifetime_countdown); + this.mine_explodeanyway = 1; // make the mine super aggressive -- Samual: Rather, make it not care if a team mate is near. } // a player's mines shall explode if he disconnects or dies // TODO: Do this on team change too -- Samual: But isn't a player killed when they switch teams? - if(!IS_PLAYER(self.realowner) || IS_DEAD(self.realowner) || STAT(FROZEN, self.realowner)) + if(!IS_PLAYER(this.realowner) || IS_DEAD(this.realowner) || STAT(FROZEN, this.realowner)) { other = world; - self.projectiledeathtype |= HITTYPE_BOUNCE; - W_MineLayer_Explode(self); + this.projectiledeathtype |= HITTYPE_BOUNCE; + W_MineLayer_Explode(this); return; } // set the mine for detonation when a foe gets close enough - head = findradius(self.origin, WEP_CVAR(minelayer, proximityradius)); + head = findradius(this.origin, WEP_CVAR(minelayer, proximityradius)); while(head) { if(IS_PLAYER(head) && !IS_DEAD(head) && !STAT(FROZEN, head)) - if(head != self.realowner && DIFF_TEAM(head, self.realowner)) // don't trigger for team mates - if(!self.mine_time) + if(head != this.realowner && DIFF_TEAM(head, this.realowner)) // don't trigger for team mates + if(!this.mine_time) { - spamsound(self, CH_SHOTS, SND(MINE_TRIGGER), VOL_BASE, ATTN_NORM); - self.mine_time = time + WEP_CVAR(minelayer, time); + spamsound(this, CH_SHOTS, SND(MINE_TRIGGER), VOL_BASE, ATTN_NORM); + this.mine_time = time + WEP_CVAR(minelayer, time); } head = head.chain; } // explode if it's time to - if(self.mine_time && time >= self.mine_time) + if(this.mine_time && time >= this.mine_time) { - W_MineLayer_ProximityExplode(self); + W_MineLayer_ProximityExplode(this); return; } // remote detonation - if(PS(self.realowner).m_weapon == WEP_MINE_LAYER) - if(!IS_DEAD(self.realowner)) - if(self.minelayer_detonate) - W_MineLayer_RemoteExplode(self); + if(PS(this.realowner).m_weapon == WEP_MINE_LAYER) + if(!IS_DEAD(this.realowner)) + if(this.minelayer_detonate) + W_MineLayer_RemoteExplode(this); } void W_MineLayer_Touch(entity this) { - if(self.movetype == MOVETYPE_NONE || self.movetype == MOVETYPE_FOLLOW) + 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(self)) + if(WarpZone_Projectile_Touch(this)) { - if(wasfreed(self)) - self.realowner.minelayer_mines -= 1; + if(wasfreed(this)) + this.realowner.minelayer_mines -= 1; return; } @@ -287,7 +287,7 @@ void W_MineLayer_Touch(entity this) } else { - W_MineLayer_Stick(self, other); + W_MineLayer_Stick(this, other); } } @@ -309,29 +309,29 @@ void W_MineLayer_Damage(entity this, entity inflictor, entity attacker, float da } void W_MineLayer_Attack(Weapon thiswep, entity actor) -{entity this = actor; +{ entity mine; entity flash; // scan how many mines we placed, and return if we reached our limit if(WEP_CVAR(minelayer, limit)) { - if(self.minelayer_mines >= WEP_CVAR(minelayer, limit)) + if(actor.minelayer_mines >= WEP_CVAR(minelayer, limit)) { // the refire delay keeps this message from being spammed - Send_Notification(NOTIF_ONE, self, MSG_MULTI, WEAPON_MINELAYER_LIMIT, WEP_CVAR(minelayer, limit)); - play2(self, SND(UNAVAILABLE)); + Send_Notification(NOTIF_ONE, actor, MSG_MULTI, WEAPON_MINELAYER_LIMIT, WEP_CVAR(minelayer, limit)); + play2(actor, SND(UNAVAILABLE)); return; } } - W_DecreaseAmmo(thiswep, self, WEP_CVAR(minelayer, ammo)); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR(minelayer, ammo)); - W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', false, 5, SND_MINE_FIRE, CH_WEAPON_A, WEP_CVAR(minelayer, damage)); + W_SetupShot_ProjectileSize(actor, '-4 -4 -4', '4 4 4', false, 5, SND_MINE_FIRE, CH_WEAPON_A, WEP_CVAR(minelayer, damage)); Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); - mine = WarpZone_RefSys_SpawnSameRefSys(self); - mine.owner = mine.realowner = self; + mine = WarpZone_RefSys_SpawnSameRefSys(actor); + mine.owner = mine.realowner = actor; if(WEP_CVAR(minelayer, detonatedelay) >= 0) mine.spawnshieldtime = time + WEP_CVAR(minelayer, detonatedelay); else @@ -371,13 +371,13 @@ void W_MineLayer_Attack(Weapon thiswep, entity actor) setmodel(flash, MDL_MINELAYER_MUZZLEFLASH); // precision set below SUB_SetFade(flash, time, 0.1); flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION; - W_AttachToShotorg(self, flash, '5 0 0'); + W_AttachToShotorg(actor, flash, '5 0 0'); // common properties - MUTATOR_CALLHOOK(EditProjectile, self, mine); + MUTATOR_CALLHOOK(EditProjectile, actor, mine); - self.minelayer_mines = W_MineLayer_Count(self); + actor.minelayer_mines = W_MineLayer_Count(actor); } float W_MineLayer_PlacedMines(entity this, float detonate) @@ -403,12 +403,11 @@ float W_MineLayer_PlacedMines(entity this, float detonate) METHOD(MineLayer, wr_aim, void(entity thiswep, entity actor)) { - entity this = actor; // aim and decide to fire if appropriate - if(self.minelayer_mines >= WEP_CVAR(minelayer, limit)) - PHYS_INPUT_BUTTON_ATCK(self) = false; + if(actor.minelayer_mines >= WEP_CVAR(minelayer, limit)) + PHYS_INPUT_BUTTON_ATCK(actor) = false; else - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(minelayer, speed), 0, WEP_CVAR(minelayer, lifetime), false); + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, WEP_CVAR(minelayer, speed), 0, WEP_CVAR(minelayer, lifetime), false); if(skill >= 2) // skill 0 and 1 bots won't detonate mines! { // decide whether to detonate mines @@ -426,7 +425,7 @@ METHOD(MineLayer, wr_aim, void(entity thiswep, entity actor)) entity mine = find(world, classname, "mine"); while(mine) { - if(mine.realowner != self) + if(mine.realowner != actor) { mine = find(mine, classname, "mine"); continue; @@ -437,11 +436,11 @@ METHOD(MineLayer, wr_aim, void(entity thiswep, entity actor)) d = vlen(targ.origin + (targ.mins + targ.maxs) * 0.5 - mine.origin); d = bound(0, edgedamage + (coredamage - edgedamage) * sqrt(1 - d * recipricoledgeradius), 10000); // count potential damage according to type of target - if(targ == self) + if(targ == actor) selfdamage = selfdamage + d; - else if(targ.team == self.team && teamplay) + else if(targ.team == actor.team && teamplay) teamdamage = teamdamage + d; - else if(bot_shouldattack(self, targ)) + else if(bot_shouldattack(actor, targ)) enemydamage = enemydamage + d; targ = targ.chain; } @@ -449,15 +448,15 @@ METHOD(MineLayer, wr_aim, void(entity thiswep, entity actor)) } float desirabledamage; desirabledamage = enemydamage; - if(time > self.invincible_finished && time > self.spawnshieldtime) + if(time > actor.invincible_finished && time > actor.spawnshieldtime) desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent; - if(teamplay && self.team) + if(teamplay && actor.team) desirabledamage = desirabledamage - teamdamage; mine = find(world, classname, "mine"); while(mine) { - if(mine.realowner != self) + if(mine.realowner != actor) { mine = find(mine, classname, "mine"); continue; @@ -472,18 +471,18 @@ METHOD(MineLayer, wr_aim, void(entity thiswep, entity actor)) if( (v_forward * normalize(mine.origin - targ.origin)< 0.1) && desirabledamage > 0.1*coredamage - ) PHYS_INPUT_BUTTON_ATCK2(self) = true; + ) PHYS_INPUT_BUTTON_ATCK2(actor) = true; targ = targ.chain; } }else{ - float distance; distance= bound(300,vlen(self.origin-self.enemy.origin),30000); + float distance; distance= bound(300,vlen(actor.origin-actor.enemy.origin),30000); //As the distance gets larger, a correct detonation gets near imposible //Bots are assumed to use the mine spawnfunc_light to see if the mine gets near a player - if(v_forward * normalize(mine.origin - self.enemy.origin)< 0.1) - if(IS_PLAYER(self.enemy)) + if(v_forward * normalize(mine.origin - actor.enemy.origin)< 0.1) + if(IS_PLAYER(actor.enemy)) if(desirabledamage >= 0.1*coredamage) if(random()/distance*300 > frametime*bound(0,(10-skill)*0.2,1)) - PHYS_INPUT_BUTTON_ATCK2(self) = true; + PHYS_INPUT_BUTTON_ATCK2(actor) = true; // dprint(ftos(random()/distance*300),">");dprint(ftos(frametime*bound(0,(10-skill)*0.2,1)),"\n"); } @@ -492,12 +491,12 @@ METHOD(MineLayer, wr_aim, void(entity thiswep, entity actor)) // if we would be doing at X percent of the core damage, detonate it // but don't fire a new shot at the same time! if(desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events - PHYS_INPUT_BUTTON_ATCK2(self) = true; - if((skill > 6.5) && (selfdamage > self.health)) - PHYS_INPUT_BUTTON_ATCK2(self) = false; - //if(PHYS_INPUT_BUTTON_ATCK2(self) == true) + PHYS_INPUT_BUTTON_ATCK2(actor) = true; + if((skill > 6.5) && (selfdamage > actor.health)) + PHYS_INPUT_BUTTON_ATCK2(actor) = false; + //if(PHYS_INPUT_BUTTON_ATCK2(actor) == true) // dprint(ftos(desirabledamage),"\n"); - if(PHYS_INPUT_BUTTON_ATCK2(self)) PHYS_INPUT_BUTTON_ATCK(self) = false; + if(PHYS_INPUT_BUTTON_ATCK2(actor)) PHYS_INPUT_BUTTON_ATCK(actor) = false; } } METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) @@ -565,12 +564,11 @@ METHOD(MineLayer, wr_killmessage, Notification(entity thiswep)) METHOD(MineLayer, wr_impacteffect, void(entity thiswep, entity actor)) { - entity this = actor; vector org2; org2 = w_org + w_backoff * 12; pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, SND_MINE_EXP, VOL_BASE, ATTN_NORM); + sound(actor, CH_SHOTS, SND_MINE_EXP, VOL_BASE, ATTN_NORM); } #endif diff --git a/qcsrc/common/weapons/weapon/mortar.qc b/qcsrc/common/weapons/weapon/mortar.qc index 843eaa86b..8825fc0c5 100644 --- a/qcsrc/common/weapons/weapon/mortar.qc +++ b/qcsrc/common/weapons/weapon/mortar.qc @@ -68,20 +68,20 @@ void W_Mortar_Grenade_Explode(entity this) { if(other.takedamage == DAMAGE_AIM) if(IS_PLAYER(other)) - if(DIFF_TEAM(self.realowner, other)) + if(DIFF_TEAM(this.realowner, other)) if(!IS_DEAD(other)) if(IsFlying(other)) - Send_Notification(NOTIF_ONE, self.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT); + Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT); - self.event_damage = func_null; - self.takedamage = DAMAGE_NO; + this.event_damage = func_null; + this.takedamage = DAMAGE_NO; - if(self.movetype == MOVETYPE_NONE) - self.velocity = self.oldvelocity; + if(this.movetype == MOVETYPE_NONE) + this.velocity = this.oldvelocity; - RadiusDamage(self, self.realowner, WEP_CVAR_PRI(mortar, damage), WEP_CVAR_PRI(mortar, edgedamage), WEP_CVAR_PRI(mortar, radius), world, world, WEP_CVAR_PRI(mortar, force), self.projectiledeathtype, other); + RadiusDamage(this, this.realowner, WEP_CVAR_PRI(mortar, damage), WEP_CVAR_PRI(mortar, edgedamage), WEP_CVAR_PRI(mortar, radius), world, world, WEP_CVAR_PRI(mortar, force), this.projectiledeathtype, other); - remove(self); + remove(this); } void W_Mortar_Grenade_Explode_use(entity this, entity actor, entity trigger) @@ -93,20 +93,20 @@ void W_Mortar_Grenade_Explode2(entity this) { if(other.takedamage == DAMAGE_AIM) if(IS_PLAYER(other)) - if(DIFF_TEAM(self.realowner, other)) + if(DIFF_TEAM(this.realowner, other)) if(!IS_DEAD(other)) if(IsFlying(other)) - Send_Notification(NOTIF_ONE, self.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT); + Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT); - self.event_damage = func_null; - self.takedamage = DAMAGE_NO; + this.event_damage = func_null; + this.takedamage = DAMAGE_NO; - if(self.movetype == MOVETYPE_NONE) - self.velocity = self.oldvelocity; + if(this.movetype == MOVETYPE_NONE) + this.velocity = this.oldvelocity; - RadiusDamage(self, self.realowner, WEP_CVAR_SEC(mortar, damage), WEP_CVAR_SEC(mortar, edgedamage), WEP_CVAR_SEC(mortar, radius), world, world, WEP_CVAR_SEC(mortar, force), self.projectiledeathtype, other); + RadiusDamage(this, this.realowner, WEP_CVAR_SEC(mortar, damage), WEP_CVAR_SEC(mortar, edgedamage), WEP_CVAR_SEC(mortar, radius), world, world, WEP_CVAR_SEC(mortar, force), this.projectiledeathtype, other); - remove(self); + remove(this); } void W_Mortar_Grenade_Explode2_use(entity this, entity actor, entity trigger) @@ -130,16 +130,16 @@ void W_Mortar_Grenade_Damage(entity this, entity inflictor, entity attacker, flo void W_Mortar_Grenade_Think1(entity this) { - self.nextthink = time; - if(time > self.cnt) + this.nextthink = time; + if(time > this.cnt) { other = world; - self.projectiledeathtype |= HITTYPE_BOUNCE; - W_Mortar_Grenade_Explode(self); + this.projectiledeathtype |= HITTYPE_BOUNCE; + W_Mortar_Grenade_Explode(this); return; } - if(self.gl_detonate_later && self.gl_bouncecnt >= WEP_CVAR_PRI(mortar, remote_minbouncecnt)) - W_Mortar_Grenade_Explode(self); + if(this.gl_detonate_later && this.gl_bouncecnt >= WEP_CVAR_PRI(mortar, remote_minbouncecnt)) + W_Mortar_Grenade_Explode(this); } void W_Mortar_Grenade_Touch1(entity this) @@ -151,26 +151,26 @@ void W_Mortar_Grenade_Touch1(entity this) } else if(WEP_CVAR_PRI(mortar, type) == 1) // bounce { - spamsound(self, CH_SHOTS, SND(GRENADE_BOUNCE_RANDOM()), VOL_BASE, ATTN_NORM); - Send_Effect(EFFECT_HAGAR_BOUNCE, self.origin, self.velocity, 1); - self.projectiledeathtype |= HITTYPE_BOUNCE; - self.gl_bouncecnt += 1; + spamsound(this, CH_SHOTS, SND(GRENADE_BOUNCE_RANDOM()), VOL_BASE, ATTN_NORM); + Send_Effect(EFFECT_HAGAR_BOUNCE, this.origin, this.velocity, 1); + 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 { - spamsound(self, CH_SHOTS, SND(GRENADE_STICK), VOL_BASE, ATTN_NORM); + spamsound(this, CH_SHOTS, SND(GRENADE_STICK), VOL_BASE, ATTN_NORM); // let it stick whereever it is - self.oldvelocity = self.velocity; - self.velocity = '0 0 0'; - self.movetype = MOVETYPE_NONE; // also disables gravity - self.gravity = 0; // nope, it does NOT! maybe a bug in CSQC code? TODO - UpdateCSQCProjectile(self); + this.oldvelocity = this.velocity; + this.velocity = '0 0 0'; + this.movetype = MOVETYPE_NONE; // also disables gravity + this.gravity = 0; // nope, it does NOT! maybe a bug in CSQC code? TODO + UpdateCSQCProjectile(this); // do not respond to any more touches - self.solid = SOLID_NOT; + this.solid = SOLID_NOT; - self.nextthink = min(self.nextthink, time + WEP_CVAR_PRI(mortar, lifetime_stick)); + this.nextthink = min(this.nextthink, time + WEP_CVAR_PRI(mortar, lifetime_stick)); } } @@ -183,46 +183,46 @@ void W_Mortar_Grenade_Touch2(entity this) } else if(WEP_CVAR_SEC(mortar, type) == 1) // bounce { - spamsound(self, CH_SHOTS, SND(GRENADE_BOUNCE_RANDOM()), VOL_BASE, ATTN_NORM); - Send_Effect(EFFECT_HAGAR_BOUNCE, self.origin, self.velocity, 1); - self.projectiledeathtype |= HITTYPE_BOUNCE; - self.gl_bouncecnt += 1; + spamsound(this, CH_SHOTS, SND(GRENADE_BOUNCE_RANDOM()), VOL_BASE, ATTN_NORM); + Send_Effect(EFFECT_HAGAR_BOUNCE, this.origin, this.velocity, 1); + this.projectiledeathtype |= HITTYPE_BOUNCE; + this.gl_bouncecnt += 1; - if(WEP_CVAR_SEC(mortar, lifetime_bounce) && self.gl_bouncecnt == 1) - self.nextthink = time + WEP_CVAR_SEC(mortar, lifetime_bounce); + if(WEP_CVAR_SEC(mortar, lifetime_bounce) && this.gl_bouncecnt == 1) + 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 { - spamsound(self, CH_SHOTS, SND(GRENADE_STICK), VOL_BASE, ATTN_NORM); + spamsound(this, CH_SHOTS, SND(GRENADE_STICK), VOL_BASE, ATTN_NORM); // let it stick whereever it is - self.oldvelocity = self.velocity; - self.velocity = '0 0 0'; - self.movetype = MOVETYPE_NONE; // also disables gravity - self.gravity = 0; // nope, it does NOT! maybe a bug in CSQC code? TODO - UpdateCSQCProjectile(self); + this.oldvelocity = this.velocity; + this.velocity = '0 0 0'; + this.movetype = MOVETYPE_NONE; // also disables gravity + this.gravity = 0; // nope, it does NOT! maybe a bug in CSQC code? TODO + UpdateCSQCProjectile(this); // do not respond to any more touches - self.solid = SOLID_NOT; + this.solid = SOLID_NOT; - self.nextthink = min(self.nextthink, time + WEP_CVAR_SEC(mortar, lifetime_stick)); + this.nextthink = min(this.nextthink, time + WEP_CVAR_SEC(mortar, lifetime_stick)); } } void W_Mortar_Attack(Weapon thiswep, entity actor) -{entity this = actor; +{ entity gren; - W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(mortar, ammo)); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(mortar, ammo)); - W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(mortar, damage)); + W_SetupShot_ProjectileSize(actor, '-3 -3 -3', '3 3 3', false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(mortar, damage)); w_shotdir = v_forward; // no TrueAim for grenades please Send_Effect(EFFECT_GRENADE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); gren = new(grenade); - gren.owner = gren.realowner = self; + gren.owner = gren.realowner = actor; gren.bot_dodge = true; gren.bot_dodgerating = WEP_CVAR_PRI(mortar, damage); gren.movetype = MOVETYPE_BOUNCE; @@ -255,22 +255,22 @@ void W_Mortar_Attack(Weapon thiswep, entity actor) else CSQCProjectile(gren, true, PROJECTILE_GRENADE_BOUNCING, true); - MUTATOR_CALLHOOK(EditProjectile, self, gren); + MUTATOR_CALLHOOK(EditProjectile, actor, gren); } void W_Mortar_Attack2(Weapon thiswep, entity actor) -{entity this = actor; +{ entity gren; - W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(mortar, ammo)); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(mortar, ammo)); - W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(mortar, damage)); + W_SetupShot_ProjectileSize(actor, '-3 -3 -3', '3 3 3', false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(mortar, damage)); w_shotdir = v_forward; // no TrueAim for grenades please Send_Effect(EFFECT_GRENADE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); gren = new(grenade); - gren.owner = gren.realowner = self; + gren.owner = gren.realowner = actor; gren.bot_dodge = true; gren.bot_dodgerating = WEP_CVAR_SEC(mortar, damage); gren.movetype = MOVETYPE_BOUNCE; @@ -302,30 +302,29 @@ void W_Mortar_Attack2(Weapon thiswep, entity actor) else CSQCProjectile(gren, true, PROJECTILE_GRENADE_BOUNCING, true); - MUTATOR_CALLHOOK(EditProjectile, self, gren); + MUTATOR_CALLHOOK(EditProjectile, actor, gren); } .float bot_secondary_grenademooth; METHOD(Mortar, wr_aim, void(entity thiswep, entity actor)) { - entity this = actor; - PHYS_INPUT_BUTTON_ATCK(self) = false; - PHYS_INPUT_BUTTON_ATCK2(self) = false; - if(self.bot_secondary_grenademooth == 0) // WEAPONTODO: merge this into using WEP_CVAR_BOTH + PHYS_INPUT_BUTTON_ATCK(actor) = false; + PHYS_INPUT_BUTTON_ATCK2(actor) = false; + if(actor.bot_secondary_grenademooth == 0) // WEAPONTODO: merge this into using WEP_CVAR_BOTH { - if(bot_aim(self, WEP_CVAR_PRI(mortar, speed), WEP_CVAR_PRI(mortar, speed_up), WEP_CVAR_PRI(mortar, lifetime), true)) + if(bot_aim(actor, WEP_CVAR_PRI(mortar, speed), WEP_CVAR_PRI(mortar, speed_up), WEP_CVAR_PRI(mortar, lifetime), true)) { - PHYS_INPUT_BUTTON_ATCK(self) = true; - if(random() < 0.01) self.bot_secondary_grenademooth = 1; + PHYS_INPUT_BUTTON_ATCK(actor) = true; + if(random() < 0.01) actor.bot_secondary_grenademooth = 1; } } else { - if(bot_aim(self, WEP_CVAR_SEC(mortar, speed), WEP_CVAR_SEC(mortar, speed_up), WEP_CVAR_SEC(mortar, lifetime), true)) + if(bot_aim(actor, WEP_CVAR_SEC(mortar, speed), WEP_CVAR_SEC(mortar, speed_up), WEP_CVAR_SEC(mortar, lifetime), true)) { - PHYS_INPUT_BUTTON_ATCK2(self) = true; - if(random() < 0.02) self.bot_secondary_grenademooth = 0; + PHYS_INPUT_BUTTON_ATCK2(actor) = true; + if(random() < 0.02) actor.bot_secondary_grenademooth = 0; } } } @@ -417,12 +416,11 @@ METHOD(Mortar, wr_killmessage, Notification(entity thiswep)) METHOD(Mortar, wr_impacteffect, void(entity thiswep, entity actor)) { - entity this = actor; vector org2; org2 = w_org + w_backoff * 12; pointparticles(EFFECT_GRENADE_EXPLODE, org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, SND_GRENADE_IMPACT, VOL_BASE, ATTN_NORM); + sound(actor, CH_SHOTS, SND_GRENADE_IMPACT, VOL_BASE, ATTN_NORM); } #endif diff --git a/qcsrc/common/weapons/weapon/porto.qc b/qcsrc/common/weapons/weapon/porto.qc index ac9f759fc..10c2bd7a9 100644 --- a/qcsrc/common/weapons/weapon/porto.qc +++ b/qcsrc/common/weapons/weapon/porto.qc @@ -55,14 +55,14 @@ MUTATOR_HOOKFUNCTION(porto_ticker, SV_StartFrame) { void W_Porto_Success(entity this) { - if(self.realowner == world) + if(this.realowner == world) { objerror("Cannot succeed successfully: no owner\n"); return; } - self.realowner.porto_current = world; - remove(self); + this.realowner.porto_current = world; + remove(this); } string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo); @@ -112,10 +112,10 @@ void W_Porto_Remove(entity p) void W_Porto_Think(entity this) { trace_plane_normal = '0 0 0'; - if(self.realowner.playerid != self.playerid) - remove(self); + if(this.realowner.playerid != this.playerid) + remove(this); else - W_Porto_Fail(self, 0); + W_Porto_Fail(this, 0); } void W_Porto_Touch(entity this) @@ -131,7 +131,7 @@ void W_Porto_Touch(entity this) norm = trace_plane_normal; if(trace_ent.iscreature) { - traceline(trace_ent.origin, trace_ent.origin + '0 0 2' * STAT(PL_MIN, NULL).z, MOVE_WORLDONLY, self); + traceline(trace_ent.origin, trace_ent.origin + '0 0 2' * STAT(PL_MIN, NULL).z, MOVE_WORLDONLY, this); if(trace_fraction >= 1) return; if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK || trace_dphitcontents & DPCONTENTS_PLAYERCLIP) @@ -140,121 +140,121 @@ void W_Porto_Touch(entity this) return; } - if(self.realowner.playerid != self.playerid) + if(this.realowner.playerid != this.playerid) { - sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); - remove(self); + sound(this, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); + remove(this); } else if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK || trace_dphitcontents & DPCONTENTS_PLAYERCLIP) { - spamsound(self, CH_SHOTS, SND(PORTO_BOUNCE), VOL_BASE, ATTEN_NORM); + spamsound(this, CH_SHOTS, SND(PORTO_BOUNCE), VOL_BASE, ATTEN_NORM); // just reflect - self.right_vector = self.right_vector - 2 * trace_plane_normal * (self.right_vector * trace_plane_normal); - self.angles = vectoangles(self.velocity - 2 * trace_plane_normal * (self.velocity * trace_plane_normal)); + this.right_vector = this.right_vector - 2 * trace_plane_normal * (this.right_vector * trace_plane_normal); + this.angles = vectoangles(this.velocity - 2 * trace_plane_normal * (this.velocity * trace_plane_normal)); } else if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) { - sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); - W_Porto_Fail(self, 0); - if(self.cnt < 0) - Portal_ClearAll_PortalsOnly(self.realowner); + sound(this, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); + W_Porto_Fail(this, 0); + if(this.cnt < 0) + Portal_ClearAll_PortalsOnly(this.realowner); } - else if(self.cnt == 0) + else if(this.cnt == 0) { // in-portal only - if(Portal_SpawnInPortalAtTrace(self.realowner, self.right_vector, self.portal_id)) + if(Portal_SpawnInPortalAtTrace(this.realowner, this.right_vector, this.portal_id)) { - sound(self, CH_SHOTS, SND_PORTO_CREATE, VOL_BASE, ATTEN_NORM); + sound(this, CH_SHOTS, SND_PORTO_CREATE, VOL_BASE, ATTEN_NORM); trace_plane_normal = norm; - Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_CREATED_IN); - W_Porto_Success(self); + Send_Notification(NOTIF_ONE, this.realowner, MSG_CENTER, CENTER_PORTO_CREATED_IN); + W_Porto_Success(this); } else { - sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); + sound(this, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); trace_plane_normal = norm; - W_Porto_Fail(self, 0); + W_Porto_Fail(this, 0); } } - else if(self.cnt == 1) + else if(this.cnt == 1) { // out-portal only - if(Portal_SpawnOutPortalAtTrace(self.realowner, self.right_vector, self.portal_id)) + if(Portal_SpawnOutPortalAtTrace(this.realowner, this.right_vector, this.portal_id)) { - sound(self, CH_SHOTS, SND_PORTO_CREATE, VOL_BASE, ATTEN_NORM); + sound(this, CH_SHOTS, SND_PORTO_CREATE, VOL_BASE, ATTEN_NORM); trace_plane_normal = norm; - Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_CREATED_OUT); - W_Porto_Success(self); + Send_Notification(NOTIF_ONE, this.realowner, MSG_CENTER, CENTER_PORTO_CREATED_OUT); + W_Porto_Success(this); } else { - sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); + sound(this, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); trace_plane_normal = norm; - W_Porto_Fail(self, 0); + W_Porto_Fail(this, 0); } } - else if(self.effects & EF_RED) + else if(this.effects & EF_RED) { - self.effects += EF_BLUE - EF_RED; - if(Portal_SpawnInPortalAtTrace(self.realowner, self.right_vector, self.portal_id)) + this.effects += EF_BLUE - EF_RED; + if(Portal_SpawnInPortalAtTrace(this.realowner, this.right_vector, this.portal_id)) { - sound(self, CH_SHOTS, SND_PORTO_CREATE, VOL_BASE, ATTEN_NORM); + sound(this, CH_SHOTS, SND_PORTO_CREATE, VOL_BASE, ATTEN_NORM); trace_plane_normal = norm; - Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_CREATED_IN); - self.right_vector = self.right_vector - 2 * trace_plane_normal * (self.right_vector * norm); - self.angles = vectoangles(self.velocity - 2 * trace_plane_normal * (self.velocity * norm)); - CSQCProjectile(self, true, PROJECTILE_PORTO_BLUE, true); // change type + Send_Notification(NOTIF_ONE, this.realowner, MSG_CENTER, CENTER_PORTO_CREATED_IN); + this.right_vector = this.right_vector - 2 * trace_plane_normal * (this.right_vector * norm); + this.angles = vectoangles(this.velocity - 2 * trace_plane_normal * (this.velocity * norm)); + CSQCProjectile(this, true, PROJECTILE_PORTO_BLUE, true); // change type } else { - sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); + sound(this, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); trace_plane_normal = norm; - Portal_ClearAll_PortalsOnly(self.realowner); - W_Porto_Fail(self, 0); + Portal_ClearAll_PortalsOnly(this.realowner); + W_Porto_Fail(this, 0); } } else { - if(self.realowner.portal_in.portal_id == self.portal_id) + if(this.realowner.portal_in.portal_id == this.portal_id) { - if(Portal_SpawnOutPortalAtTrace(self.realowner, self.right_vector, self.portal_id)) + if(Portal_SpawnOutPortalAtTrace(this.realowner, this.right_vector, this.portal_id)) { - sound(self, CH_SHOTS, SND_PORTO_CREATE, VOL_BASE, ATTEN_NORM); + sound(this, CH_SHOTS, SND_PORTO_CREATE, VOL_BASE, ATTEN_NORM); trace_plane_normal = norm; - Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_CREATED_OUT); - W_Porto_Success(self); + Send_Notification(NOTIF_ONE, this.realowner, MSG_CENTER, CENTER_PORTO_CREATED_OUT); + W_Porto_Success(this); } else { - sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); - Portal_ClearAll_PortalsOnly(self.realowner); - W_Porto_Fail(self, 0); + sound(this, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); + Portal_ClearAll_PortalsOnly(this.realowner); + W_Porto_Fail(this, 0); } } else { - sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); - Portal_ClearAll_PortalsOnly(self.realowner); - W_Porto_Fail(self, 0); + sound(this, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); + Portal_ClearAll_PortalsOnly(this.realowner); + W_Porto_Fail(this, 0); } } } void W_Porto_Attack(entity actor, float type) -{entity this = actor; +{ entity gren; - W_SetupShot(self, false, 4, SND_PORTO_FIRE, CH_WEAPON_A, 0); + W_SetupShot(actor, false, 4, SND_PORTO_FIRE, CH_WEAPON_A, 0); // always shoot from the eye w_shotdir = v_forward; - w_shotorg = self.origin + self.view_ofs + ((w_shotorg - self.origin - self.view_ofs) * v_forward) * v_forward; + w_shotorg = actor.origin + actor.view_ofs + ((w_shotorg - actor.origin - actor.view_ofs) * v_forward) * v_forward; //Send_Effect(EFFECT_GRENADE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); gren = new(porto); gren.cnt = type; - gren.owner = gren.realowner = self; - gren.playerid = self.playerid; + gren.owner = gren.realowner = actor; + gren.playerid = actor.playerid; gren.bot_dodge = true; gren.bot_dodgerating = 200; gren.movetype = MOVETYPE_BOUNCEMISSILE; @@ -268,7 +268,7 @@ void W_Porto_Attack(entity actor, float type) setthink(gren, W_Porto_Think); settouch(gren, W_Porto_Touch); - if(self.items & ITEM_Strength.m_itemid) + if(actor.items & ITEM_Strength.m_itemid) W_SetupProjVelocity_Basic(gren, WEP_CVAR_BOTH(porto, (type <= 0), speed) * autocvar_g_balance_powerup_strength_force, 0); else W_SetupProjVelocity_Basic(gren, WEP_CVAR_BOTH(porto, (type <= 0), speed), 0); @@ -277,8 +277,8 @@ void W_Porto_Attack(entity actor, float type) gren.flags = FL_PROJECTILE; gren.portal_id = time; - self.porto_current = gren; - gren.playerid = self.playerid; + actor.porto_current = gren; + gren.playerid = actor.playerid; fixedmakevectors(fixedvectoangles(gren.velocity)); gren.right_vector = v_right; @@ -289,17 +289,16 @@ void W_Porto_Attack(entity actor, float type) else CSQCProjectile(gren, true, PROJECTILE_PORTO_RED, true); - MUTATOR_CALLHOOK(EditProjectile, self, gren); + MUTATOR_CALLHOOK(EditProjectile, actor, gren); } METHOD(PortoLaunch, wr_aim, void(entity thiswep, entity actor)) { - entity this = actor; - PHYS_INPUT_BUTTON_ATCK(self) = false; - PHYS_INPUT_BUTTON_ATCK2(self) = false; + PHYS_INPUT_BUTTON_ATCK(actor) = false; + PHYS_INPUT_BUTTON_ATCK2(actor) = false; if(!WEP_CVAR(porto, secondary)) - if(bot_aim(self, WEP_CVAR_PRI(porto, speed), 0, WEP_CVAR_PRI(porto, lifetime), false)) - PHYS_INPUT_BUTTON_ATCK(self) = true; + if(bot_aim(actor, WEP_CVAR_PRI(porto, speed), 0, WEP_CVAR_PRI(porto, lifetime), false)) + PHYS_INPUT_BUTTON_ATCK(actor) = true; } METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { @@ -369,13 +368,11 @@ METHOD(PortoLaunch, wr_checkammo2, bool(entity thiswep, entity this)) } METHOD(PortoLaunch, wr_setup, void(entity thiswep, entity actor)) { - entity this = actor; - self.ammo_field = ammo_none; + actor.ammo_field = ammo_none; } METHOD(PortoLaunch, wr_resetplayer, void(entity thiswep, entity actor)) { - entity this = actor; - self.porto_current = world; + actor.porto_current = world; } #endif #ifdef CSQC diff --git a/qcsrc/common/weapons/weapon/rifle.qc b/qcsrc/common/weapons/weapon/rifle.qc index 7381172aa..13e445310 100644 --- a/qcsrc/common/weapons/weapon/rifle.qc +++ b/qcsrc/common/weapons/weapon/rifle.qc @@ -57,26 +57,26 @@ spawnfunc(weapon_campingrifle) { spawnfunc_weapon_rifle(this); } spawnfunc(weapon_sniperrifle) { spawnfunc_weapon_rifle(this); } void W_Rifle_FireBullet(Weapon thiswep, float pSpread, float pDamage, float pForce, float pSolidPenetration, float pAmmo, int deathtype, float pTracer, float pShots, Sound pSound, entity actor) -{entity this = actor; +{ float i; - W_DecreaseAmmo(thiswep, self, pAmmo); + W_DecreaseAmmo(thiswep, actor, pAmmo); - W_SetupShot(self, true, 2, pSound, CH_WEAPON_A, pDamage * pShots); + W_SetupShot(actor, true, 2, pSound, CH_WEAPON_A, pDamage * pShots); Send_Effect(EFFECT_RIFLE_MUZZLEFLASH, w_shotorg, w_shotdir * 2000, 1); - if(PHYS_INPUT_BUTTON_ZOOM(self) | PHYS_INPUT_BUTTON_ZOOMSCRIPT(self)) // if zoomed, shoot from the eye + if(PHYS_INPUT_BUTTON_ZOOM(actor) | PHYS_INPUT_BUTTON_ZOOMSCRIPT(actor)) // if zoomed, shoot from the eye { w_shotdir = v_forward; - w_shotorg = self.origin + self.view_ofs + ((w_shotorg - self.origin - self.view_ofs) * v_forward) * v_forward; + w_shotorg = actor.origin + actor.view_ofs + ((w_shotorg - actor.origin - actor.view_ofs) * v_forward) * v_forward; } for(i = 0; i < pShots; ++i) - fireBullet(self, w_shotorg, w_shotdir, pSpread, pSolidPenetration, pDamage, pForce, deathtype, (pTracer ? EF_RED : EF_BLUE)); + fireBullet(actor, w_shotorg, w_shotdir, pSpread, pSolidPenetration, pDamage, pForce, deathtype, (pTracer ? EF_RED : EF_BLUE)); if(autocvar_g_casings >= 2) - SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, self); + SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, actor); } void W_Rifle_Attack(entity actor) @@ -117,22 +117,22 @@ void W_Rifle_BulletHail_Continue(Weapon thiswep, entity actor, .entity weaponent } void W_Rifle_BulletHail(entity actor, .entity weaponentity, float mode, void(entity actor) AttackFunc, WFRAME fr, float animtime, float refire) -{entity this = actor; +{ // if we get here, we have at least one bullet to fire AttackFunc(actor); if(mode) { // continue hail - self.rifle_bullethail_attackfunc = AttackFunc; - self.rifle_bullethail_frame = fr; - self.rifle_bullethail_animtime = animtime; - self.rifle_bullethail_refire = refire; - weapon_thinkf(self, weaponentity, fr, animtime, W_Rifle_BulletHail_Continue); + actor.rifle_bullethail_attackfunc = AttackFunc; + actor.rifle_bullethail_frame = fr; + actor.rifle_bullethail_animtime = animtime; + actor.rifle_bullethail_refire = refire; + weapon_thinkf(actor, weaponentity, fr, animtime, W_Rifle_BulletHail_Continue); } else { // just one shot - weapon_thinkf(self, weaponentity, fr, animtime, w_ready); + weapon_thinkf(actor, weaponentity, fr, animtime, w_ready); } } @@ -140,25 +140,24 @@ void W_Rifle_BulletHail(entity actor, .entity weaponentity, float mode, void(ent METHOD(Rifle, wr_aim, void(entity thiswep, entity actor)) { - entity this = actor; - PHYS_INPUT_BUTTON_ATCK(self) = false; - PHYS_INPUT_BUTTON_ATCK2(self) = false; - if(vdist(self.origin - self.enemy.origin, >, 1000)) - self.bot_secondary_riflemooth = 0; - if(self.bot_secondary_riflemooth == 0) + PHYS_INPUT_BUTTON_ATCK(actor) = false; + PHYS_INPUT_BUTTON_ATCK2(actor) = false; + if(vdist(actor.origin - actor.enemy.origin, >, 1000)) + actor.bot_secondary_riflemooth = 0; + if(actor.bot_secondary_riflemooth == 0) { - if(bot_aim(self, 1000000, 0, 0.001, false)) + if(bot_aim(actor, 1000000, 0, 0.001, false)) { - PHYS_INPUT_BUTTON_ATCK(self) = true; - if(random() < 0.01) self.bot_secondary_riflemooth = 1; + PHYS_INPUT_BUTTON_ATCK(actor) = true; + if(random() < 0.01) actor.bot_secondary_riflemooth = 1; } } else { - if(bot_aim(self, 1000000, 0, 0.001, false)) + if(bot_aim(actor, 1000000, 0, 0.001, false)) { - PHYS_INPUT_BUTTON_ATCK2(self) = true; - if(random() < 0.03) self.bot_secondary_riflemooth = 0; + PHYS_INPUT_BUTTON_ATCK2(actor) = true; + if(random() < 0.03) actor.bot_secondary_riflemooth = 0; } } } @@ -211,8 +210,7 @@ METHOD(Rifle, wr_checkammo2, bool(entity thiswep, entity actor)) } METHOD(Rifle, wr_resetplayer, void(entity thiswep, entity actor)) { - entity this = actor; - self.rifle_accumulator = time - WEP_CVAR(rifle, bursttime); + actor.rifle_accumulator = time - WEP_CVAR(rifle, bursttime); } METHOD(Rifle, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { @@ -245,13 +243,12 @@ METHOD(Rifle, wr_killmessage, Notification(entity thiswep)) METHOD(Rifle, wr_impacteffect, void(entity thiswep, entity actor)) { - entity this = actor; vector org2; org2 = w_org + w_backoff * 2; pointparticles(EFFECT_RIFLE_IMPACT, org2, w_backoff * 1000, 1); if(!w_issilent) { - sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTN_NORM); + sound(actor, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTN_NORM); } } METHOD(Rifle, wr_init, void(entity thiswep)) diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index 2fc642525..71c24b59a 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -96,10 +96,10 @@ spawnfunc(weapon_seeker) { weapon_defaultspawnfunc(this, WEP_SEEKER); } // ============================ void W_Seeker_Missile_Explode(entity this) { - self.event_damage = func_null; - RadiusDamage(self, self.realowner, WEP_CVAR(seeker, missile_damage), WEP_CVAR(seeker, missile_edgedamage), WEP_CVAR(seeker, missile_radius), world, world, WEP_CVAR(seeker, missile_force), self.projectiledeathtype, other); + this.event_damage = func_null; + RadiusDamage(this, this.realowner, WEP_CVAR(seeker, missile_damage), WEP_CVAR(seeker, missile_edgedamage), WEP_CVAR(seeker, missile_radius), world, world, WEP_CVAR(seeker, missile_force), this.projectiledeathtype, other); - remove(self); + remove(this); } void W_Seeker_Missile_Touch(entity this) @@ -117,50 +117,50 @@ void W_Seeker_Missile_Think(entity this) float dist; float spd; - if(time > self.cnt) + if(time > this.cnt) { - self.projectiledeathtype |= HITTYPE_SPLASH; - W_Seeker_Missile_Explode(self); + this.projectiledeathtype |= HITTYPE_SPLASH; + W_Seeker_Missile_Explode(this); } - spd = vlen(self.velocity); + spd = vlen(this.velocity); spd = bound( spd - WEP_CVAR(seeker, missile_decel) * frametime, WEP_CVAR(seeker, missile_speed_max), spd + WEP_CVAR(seeker, missile_accel) * frametime ); - if(self.enemy != world) - if(self.enemy.takedamage != DAMAGE_AIM || IS_DEAD(self.enemy)) - self.enemy = world; + if(this.enemy != world) + if(this.enemy.takedamage != DAMAGE_AIM || IS_DEAD(this.enemy)) + this.enemy = world; - if(self.enemy != world) + if(this.enemy != world) { - e = self.enemy; + e = this.enemy; eorg = 0.5 * (e.absmin + e.absmax); turnrate = WEP_CVAR(seeker, missile_turnrate); // how fast to turn - desireddir = normalize(eorg - self.origin); - olddir = normalize(self.velocity); // get my current direction - dist = vlen(eorg - self.origin); + desireddir = normalize(eorg - this.origin); + olddir = normalize(this.velocity); // get my current direction + dist = vlen(eorg - this.origin); // Do evasive maneuvers for world objects? ( this should be a cpu hog. :P ) if(WEP_CVAR(seeker, missile_smart) && (dist > WEP_CVAR(seeker, missile_smart_mindist))) { - // Is it a better idea (shorter distance) to trace to the target itself? - if( vdist(self.origin + olddir * self.wait, <, dist)) - traceline(self.origin, self.origin + olddir * self.wait, false, self); + // Is it a better idea (shorter distance) to trace to the target itthis? + if( vdist(this.origin + olddir * this.wait, <, dist)) + traceline(this.origin, this.origin + olddir * this.wait, false, this); else - traceline(self.origin, eorg, false, self); + traceline(this.origin, eorg, false, this); // Setup adaptive tracelength - self.wait = bound(WEP_CVAR(seeker, missile_smart_trace_min), vlen(self.origin - trace_endpos), self.wait = WEP_CVAR(seeker, missile_smart_trace_max)); + this.wait = bound(WEP_CVAR(seeker, missile_smart_trace_min), vlen(this.origin - trace_endpos), this.wait = WEP_CVAR(seeker, missile_smart_trace_max)); // Calc how important it is that we turn and add this to the desierd (enemy) dir. desireddir = normalize(((trace_plane_normal * (1 - trace_fraction)) + (desireddir * trace_fraction)) * 0.5); } newdir = normalize(olddir + desireddir * turnrate); // take the average of the 2 directions; not the best method but simple & easy - self.velocity = newdir * spd; // make me fly in the new direction at my flight speed + this.velocity = newdir * spd; // make me fly in the new direction at my flight speed } else dist = 0; @@ -170,38 +170,38 @@ void W_Seeker_Missile_Think(entity this) { if(dist <= WEP_CVAR(seeker, missile_proxy_maxrange)) { - if(self.autoswitch == 0) + if(this.autoswitch == 0) { - self.autoswitch = time + WEP_CVAR(seeker, missile_proxy_delay); + this.autoswitch = time + WEP_CVAR(seeker, missile_proxy_delay); } else { - if(self.autoswitch <= time) + if(this.autoswitch <= time) { - W_Seeker_Missile_Explode(self); - self.autoswitch = 0; + W_Seeker_Missile_Explode(this); + this.autoswitch = 0; } } } else { - if(self.autoswitch != 0) - self.autoswitch = 0; + if(this.autoswitch != 0) + this.autoswitch = 0; } } /////////////// - if(IS_DEAD(self.enemy)) + if(IS_DEAD(this.enemy)) { - self.enemy = world; - self.cnt = time + 1 + (random() * 4); - self.nextthink = self.cnt; + this.enemy = world; + this.cnt = time + 1 + (random() * 4); + this.nextthink = this.cnt; return; } - //self.angles = vectoangles(self.velocity); // turn model in the new flight direction - self.nextthink = time;// + 0.05; // csqc projectiles - UpdateCSQCProjectile(self); + //this.angles = vectoangles(this.velocity); // turn model in the new flight direction + this.nextthink = time;// + 0.05; // csqc projectiles + UpdateCSQCProjectile(this); } @@ -224,45 +224,45 @@ void W_Seeker_Missile_Damage(entity this, entity inflictor, entity attacker, flo } /* -void W_Seeker_Missile_Animate() +void W_Seeker_Missile_Animate(entity this) { - self.frame = self.frame +1; - self.nextthink = time + 0.05; + this.frame = this.frame +1; + this.nextthink = time + 0.05; - if(self.enemy != world) - if(self.enemy.takedamage != DAMAGE_AIM || IS_DEAD(self.enemy)) - self.enemy = world; + if(this.enemy != world) + if(this.enemy.takedamage != DAMAGE_AIM || IS_DEAD(this.enemy)) + this.enemy = world; - if(self.frame == 5) + if(this.frame == 5) { - self.think = W_Seeker_Missile_Think; - self.nextthink = time;// + cvar("g_balance_seeker_missile_activate_delay"); // cant dealy with csqc projectiles + this.think = W_Seeker_Missile_Think; + this.nextthink = time;// + cvar("g_balance_seeker_missile_activate_delay"); // cant dealy with csqc projectiles if(autocvar_g_balance_seeker_missile_proxy) - self.movetype = MOVETYPE_BOUNCEMISSILE; + this.movetype = MOVETYPE_BOUNCEMISSILE; else - self.movetype = MOVETYPE_FLYMISSILE; + this.movetype = MOVETYPE_FLYMISSILE; } - UpdateCSQCProjectile(self); + UpdateCSQCProjectile(this); } */ void W_Seeker_Fire_Missile(Weapon thiswep, entity actor, vector f_diff, entity m_target) -{entity this = actor; +{ entity missile; - W_DecreaseAmmo(thiswep, self, WEP_CVAR(seeker, missile_ammo)); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR(seeker, missile_ammo)); - makevectors(self.v_angle); - W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND_SEEKER_FIRE, CH_WEAPON_A, 0); + makevectors(actor.v_angle); + W_SetupShot_ProjectileSize(actor, '-2 -2 -2', '2 2 2', false, 2, SND_SEEKER_FIRE, CH_WEAPON_A, 0); w_shotorg += f_diff; Send_Effect(EFFECT_SEEKER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); - //self.detornator = false; + //actor.detornator = false; missile = new(seeker_missile); - missile.owner = missile.realowner = self; + missile.owner = missile.realowner = actor; missile.bot_dodge = true; missile.bot_dodgerating = WEP_CVAR(seeker, missile_damage); @@ -298,7 +298,7 @@ void W_Seeker_Fire_Missile(Weapon thiswep, entity actor, vector f_diff, entity m CSQCProjectile(missile, false, PROJECTILE_SEEKER, true); - MUTATOR_CALLHOOK(EditProjectile, self, missile); + MUTATOR_CALLHOOK(EditProjectile, actor, missile); } // ============================ @@ -306,11 +306,11 @@ void W_Seeker_Fire_Missile(Weapon thiswep, entity actor, vector f_diff, entity m // ============================ void W_Seeker_Flac_Explode(entity this) { - self.event_damage = func_null; + this.event_damage = func_null; - RadiusDamage(self, self.realowner, WEP_CVAR(seeker, flac_damage), WEP_CVAR(seeker, flac_edgedamage), WEP_CVAR(seeker, flac_radius), world, world, WEP_CVAR(seeker, flac_force), self.projectiledeathtype, other); + RadiusDamage(this, this.realowner, WEP_CVAR(seeker, flac_damage), WEP_CVAR(seeker, flac_edgedamage), WEP_CVAR(seeker, flac_radius), world, world, WEP_CVAR(seeker, flac_force), this.projectiledeathtype, other); - remove(self); + remove(this); } void W_Seeker_Flac_Explode_use(entity this, entity actor, entity trigger) @@ -319,14 +319,14 @@ void W_Seeker_Flac_Explode_use(entity this, entity actor, entity trigger) } void W_Seeker_Fire_Flac(Weapon thiswep, entity actor) -{entity this = actor; +{ entity missile; vector f_diff; float c; - W_DecreaseAmmo(thiswep, self, WEP_CVAR(seeker, flac_ammo)); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR(seeker, flac_ammo)); - c = self.bulletcounter % 4; + c = actor.bulletcounter % 4; switch(c) { case 0: @@ -343,13 +343,13 @@ void W_Seeker_Fire_Flac(Weapon thiswep, entity actor) f_diff = '+1.25 +3.75 0'; break; } - W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND_FLAC_FIRE, CH_WEAPON_A, WEP_CVAR(seeker, flac_damage)); + W_SetupShot_ProjectileSize(actor, '-2 -2 -2', '2 2 2', false, 2, SND_FLAC_FIRE, CH_WEAPON_A, WEP_CVAR(seeker, flac_damage)); w_shotorg += f_diff; Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); missile = new(missile); - missile.owner = missile.realowner = self; + missile.owner = missile.realowner = actor; missile.bot_dodge = true; missile.bot_dodgerating = WEP_CVAR(seeker, flac_damage); settouch(missile, W_Seeker_Flac_Explode); @@ -373,7 +373,7 @@ void W_Seeker_Fire_Flac(Weapon thiswep, entity actor) W_SetupProjVelocity_UP_PRE(missile, seeker, flac_); CSQCProjectile(missile, true, PROJECTILE_FLAC, true); - MUTATOR_CALLHOOK(EditProjectile, self, missile); + MUTATOR_CALLHOOK(EditProjectile, actor, missile); } // ============================ @@ -390,22 +390,22 @@ entity W_Seeker_Tagged_Info(entity isowner, entity istarget) } void W_Seeker_Attack(entity actor) -{entity this = actor; +{ entity tracker, closest_target; closest_target = world; - for(tracker = world; (tracker = find(tracker, classname, "tag_tracker")); ) if (tracker.realowner == self) + for(tracker = world; (tracker = find(tracker, classname, "tag_tracker")); ) if (tracker.realowner == actor) { if(closest_target) { - if(vlen2(self.origin - tracker.tag_target.origin) < vlen2(self.origin - closest_target.origin)) + if(vlen2(actor.origin - tracker.tag_target.origin) < vlen2(actor.origin - closest_target.origin)) closest_target = tracker.tag_target; } else closest_target = tracker.tag_target; } - traceline(self.origin + self.view_ofs, closest_target.origin, MOVE_NOMONSTERS, self); + traceline(actor.origin + actor.view_ofs, closest_target.origin, MOVE_NOMONSTERS, actor); if((!closest_target) || ((trace_fraction < 1) && (trace_ent != closest_target))) closest_target = world; @@ -456,19 +456,19 @@ void W_Seeker_Vollycontroller_Think(entity this) // TODO: Merge this with W_Seek void W_Seeker_Tracker_Think(entity this) { // commit suicide if: You die OR target dies OR you switch away from the seeker OR commit suicide if lifetime is up - if((IS_DEAD(self.realowner)) || (IS_DEAD(self.tag_target)) || (PS(self.realowner).m_switchweapon != WEP_SEEKER) - || (time > self.tag_time + WEP_CVAR(seeker, tag_tracker_lifetime))) + if((IS_DEAD(this.realowner)) || (IS_DEAD(this.tag_target)) || (PS(this.realowner).m_switchweapon != WEP_SEEKER) + || (time > this.tag_time + WEP_CVAR(seeker, tag_tracker_lifetime))) { - if(self) + if(this) { - WaypointSprite_Kill(self.tag_target.wps_tag_tracker); - remove(self); + WaypointSprite_Kill(this.tag_target.wps_tag_tracker); + remove(this); } return; } // Update the think method information - self.nextthink = time; + this.nextthink = time; } // ============================ @@ -500,18 +500,18 @@ void W_Seeker_Tag_Touch(entity this) PROJECTILE_TOUCH(this); - dir = normalize(self.realowner.origin - self.origin); - org2 = findbetterlocation(self.origin, 8); + dir = normalize(this.realowner.origin - this.origin); + org2 = findbetterlocation(this.origin, 8); te_knightspike(org2); - self.event_damage = func_null; - Damage_DamageInfo(self.origin, 0, 0, 0, self.velocity, WEP_SEEKER.m_id | HITTYPE_BOUNCE | HITTYPE_SECONDARY, other.species, self); + 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); if(other.takedamage == DAMAGE_AIM && !IS_DEAD(other)) { // check to see if this person is already tagged by me - entity tag = W_Seeker_Tagged_Info(self.realowner, other); + entity tag = W_Seeker_Tagged_Info(this.realowner, other); if(tag != world) { @@ -522,11 +522,11 @@ void W_Seeker_Tag_Touch(entity this) } else { - //sprint(self.realowner, strcat("You just tagged ^2", other.netname, "^7 with a tracking device!\n")); + //sprint(this.realowner, strcat("You just tagged ^2", other.netname, "^7 with a tracking device!\n")); e = new(tag_tracker); e.cnt = WEP_CVAR(seeker, missile_count); - e.owner = self.owner; - e.realowner = self.realowner; + e.owner = this.owner; + e.realowner = this.realowner; if(WEP_CVAR(seeker, type) == 1) { @@ -545,24 +545,24 @@ 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', self.realowner, 0, other, wps_tag_tracker, true, RADARICON_TAGGED); + 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); } } - remove(self); + remove(this); return; } void W_Seeker_Fire_Tag(Weapon thiswep, entity actor) -{entity this = actor; +{ entity missile; - W_DecreaseAmmo(thiswep, self, WEP_CVAR(seeker, tag_ammo)); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR(seeker, tag_ammo)); - W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND_TAG_FIRE, CH_WEAPON_A, WEP_CVAR(seeker, missile_damage) * WEP_CVAR(seeker, missile_count)); + W_SetupShot_ProjectileSize(actor, '-2 -2 -2', '2 2 2', false, 2, SND_TAG_FIRE, CH_WEAPON_A, WEP_CVAR(seeker, missile_damage) * WEP_CVAR(seeker, missile_count)); missile = new(seeker_tag); - missile.owner = missile.realowner = self; + missile.owner = missile.realowner = actor; missile.bot_dodge = true; missile.bot_dodgerating = 50; settouch(missile, W_Seeker_Tag_Touch); @@ -588,7 +588,7 @@ void W_Seeker_Fire_Tag(Weapon thiswep, entity actor) CSQCProjectile(missile, true, PROJECTILE_TAG, false); // has sound - MUTATOR_CALLHOOK(EditProjectile, self, missile); + MUTATOR_CALLHOOK(EditProjectile, actor, missile); } // ============================ @@ -597,14 +597,13 @@ void W_Seeker_Fire_Tag(Weapon thiswep, entity actor) METHOD(Seeker, wr_aim, void(entity thiswep, entity actor)) { - entity this = actor; if(WEP_CVAR(seeker, type) == 1) - if(W_Seeker_Tagged_Info(self, self.enemy) != world) - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(seeker, missile_speed_max), 0, WEP_CVAR(seeker, missile_lifetime), false); + if(W_Seeker_Tagged_Info(actor, actor.enemy) != world) + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, WEP_CVAR(seeker, missile_speed_max), 0, WEP_CVAR(seeker, missile_lifetime), false); else - PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false); + PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false); else - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false); + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false); } METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { @@ -701,7 +700,6 @@ METHOD(Seeker, wr_killmessage, Notification(entity thiswep)) METHOD(Seeker, wr_impacteffect, void(entity thiswep, entity actor)) { - entity this = actor; vector org2; org2 = w_org + w_backoff * 6; if(w_deathtype & HITTYPE_BOUNCE) @@ -709,7 +707,7 @@ METHOD(Seeker, wr_impacteffect, void(entity thiswep, entity actor)) if(w_deathtype & HITTYPE_SECONDARY) { if(!w_issilent) - sound(self, CH_SHOTS, SND_TAG_IMPACT, 1, ATTEN_NORM); + sound(actor, CH_SHOTS, SND_TAG_IMPACT, 1, ATTEN_NORM); } else { @@ -717,11 +715,11 @@ METHOD(Seeker, wr_impacteffect, void(entity thiswep, entity actor)) if(!w_issilent) { if(w_random<0.15) - sound(self, CH_SHOTS, SND_TAGEXP1, 1, ATTEN_NORM); + sound(actor, CH_SHOTS, SND_TAGEXP1, 1, ATTEN_NORM); else if(w_random<0.7) - sound(self, CH_SHOTS, SND_TAGEXP2, 1, ATTEN_NORM); + sound(actor, CH_SHOTS, SND_TAGEXP2, 1, ATTEN_NORM); else - sound(self, CH_SHOTS, SND_TAGEXP3, 1, ATTEN_NORM); + sound(actor, CH_SHOTS, SND_TAGEXP3, 1, ATTEN_NORM); } } } @@ -731,11 +729,11 @@ METHOD(Seeker, wr_impacteffect, void(entity thiswep, entity actor)) if(!w_issilent) { if(w_random<0.15) - sound(self, CH_SHOTS, SND_SEEKEREXP1, 1, ATTEN_NORM); + sound(actor, CH_SHOTS, SND_SEEKEREXP1, 1, ATTEN_NORM); else if(w_random<0.7) - sound(self, CH_SHOTS, SND_SEEKEREXP2, 1, ATTEN_NORM); + sound(actor, CH_SHOTS, SND_SEEKEREXP2, 1, ATTEN_NORM); else - sound(self, CH_SHOTS, SND_SEEKEREXP3, 1, ATTEN_NORM); + sound(actor, CH_SHOTS, SND_SEEKEREXP3, 1, ATTEN_NORM); } } } diff --git a/qcsrc/common/weapons/weapon/shockwave.qc b/qcsrc/common/weapons/weapon/shockwave.qc index a138d6a68..9834dab6b 100644 --- a/qcsrc/common/weapons/weapon/shockwave.qc +++ b/qcsrc/common/weapons/weapon/shockwave.qc @@ -93,7 +93,7 @@ spawnfunc(weapon_shockwave) { //if(autocvar_sv_q3acompat_machineshockwaveswap) // WEAPONTODO if(autocvar_sv_q3acompat_machineshotgunswap) - if(self.classname != "droppedweapon") + if(this.classname != "droppedweapon") { weapon_defaultspawnfunc(this, WEP_MACHINEGUN); return; @@ -120,57 +120,57 @@ void W_Shockwave_Melee_Think(entity this) vector targpos; // check to see if we can still continue, otherwise give up now - if(IS_DEAD(self.realowner) && WEP_CVAR(shockwave, melee_no_doubleslap)) + if(IS_DEAD(this.realowner) && WEP_CVAR(shockwave, melee_no_doubleslap)) { - remove(self); + remove(this); return; } // set start time of melee - if(!self.cnt) + if(!this.cnt) { - self.cnt = time; - W_PlayStrengthSound(self.realowner); + this.cnt = time; + W_PlayStrengthSound(this.realowner); } // update values for v_* vectors - makevectors(self.realowner.v_angle); + makevectors(this.realowner.v_angle); // calculate swing percentage based on time meleetime = WEP_CVAR(shockwave, melee_time) * W_WeaponRateFactor(this.realowner); - swing = bound(0, (self.cnt + meleetime - time) / meleetime, 10); + swing = bound(0, (this.cnt + meleetime - time) / meleetime, 10); f = ((1 - swing) * WEP_CVAR(shockwave, melee_traces)); // perform the traces needed for this frame - for(i=self.swing_prev; i < f; ++i) + for(i=this.swing_prev; i < f; ++i) { swing_factor = ((1 - (i / WEP_CVAR(shockwave, melee_traces))) * 2 - 1); - targpos = (self.realowner.origin + self.realowner.view_ofs + targpos = (this.realowner.origin + this.realowner.view_ofs + (v_forward * WEP_CVAR(shockwave, melee_range)) + (v_up * swing_factor * WEP_CVAR(shockwave, melee_swing_up)) + (v_right * swing_factor * WEP_CVAR(shockwave, melee_swing_side))); WarpZone_traceline_antilag( - self.realowner, - (self.realowner.origin + self.realowner.view_ofs), + this.realowner, + (this.realowner.origin + this.realowner.view_ofs), targpos, false, - self.realowner, - ANTILAG_LATENCY(self.realowner) + this.realowner, + ANTILAG_LATENCY(this.realowner) ); // draw lightning beams for debugging #ifdef DEBUG_SHOCKWAVE - te_lightning2(world, targpos, self.realowner.origin + self.realowner.view_ofs + v_forward * 5 - v_up * 5); + te_lightning2(world, targpos, this.realowner.origin + this.realowner.view_ofs + v_forward * 5 - v_up * 5); te_customflash(targpos, 40, 2, '1 1 1'); #endif is_player = (IS_PLAYER(trace_ent) || trace_ent.classname == "body" || IS_MONSTER(trace_ent)); - if((trace_fraction < 1) // if trace is good, apply the damage and remove self if necessary + if((trace_fraction < 1) // if trace is good, apply the damage and remove this if necessary && (trace_ent.takedamage == DAMAGE_AIM) - && (trace_ent != self.swing_alreadyhit) + && (trace_ent != this.swing_alreadyhit) && (is_player || WEP_CVAR(shockwave, melee_nonplayerdamage))) { target_victim = trace_ent; // so it persists through other calls @@ -183,22 +183,22 @@ void W_Shockwave_Melee_Think(entity this) // trigger damage with this calculated info Damage( target_victim, - self.realowner, - self.realowner, + this.realowner, + this.realowner, swing_damage, (WEP_SHOCKWAVE.m_id | HITTYPE_SECONDARY), - (self.realowner.origin + self.realowner.view_ofs), + (this.realowner.origin + this.realowner.view_ofs), (v_forward * WEP_CVAR(shockwave, melee_force)) ); // handle accuracy - if(accuracy_isgooddamage(self.realowner, target_victim)) - { accuracy_add(self.realowner, WEP_SHOCKWAVE.m_id, 0, swing_damage); } + if(accuracy_isgooddamage(this.realowner, target_victim)) + { accuracy_add(this.realowner, WEP_SHOCKWAVE.m_id, 0, swing_damage); } #ifdef DEBUG_SHOCKWAVE LOG_INFO(sprintf( "MELEE: %s hitting %s with %f damage (factor: %f) at %f time.\n", - self.realowner.netname, + this.realowner.netname, target_victim.netname, swing_damage, swing_factor, @@ -209,28 +209,28 @@ void W_Shockwave_Melee_Think(entity this) // allow multiple hits with one swing, but not against the same player twice if(WEP_CVAR(shockwave, melee_multihit)) { - self.swing_alreadyhit = target_victim; + this.swing_alreadyhit = target_victim; continue; // move along to next trace } else { - remove(self); + remove(this); return; } } } - if(time >= self.cnt + meleetime) + if(time >= this.cnt + meleetime) { // melee is finished - remove(self); + remove(this); return; } else { // set up next frame - self.swing_prev = i; - self.nextthink = time; + this.swing_prev = i; + this.nextthink = time; } } @@ -281,7 +281,7 @@ float W_Shockwave_Attack_IsVisible( vector nearest_on_line, vector sw_shotorg, vector attack_endpos) -{entity this = actor; +{ vector nearest_to_attacker = head.WarpZone_findradius_nearest; vector center = (head.origin + (head.mins + head.maxs) * 0.5); vector corner; @@ -290,14 +290,14 @@ float W_Shockwave_Attack_IsVisible( // STEP ONE: Check if the nearest point is clear if(W_Shockwave_Attack_CheckSpread(nearest_to_attacker, nearest_on_line, sw_shotorg, attack_endpos)) { - WarpZone_TraceLine(sw_shotorg, nearest_to_attacker, MOVE_NOMONSTERS, self); + WarpZone_TraceLine(sw_shotorg, nearest_to_attacker, MOVE_NOMONSTERS, actor); if(trace_fraction == 1) { return true; } // yes, the nearest point is clear and we can allow the damage } // STEP TWO: Check if shotorg to center point is clear if(W_Shockwave_Attack_CheckSpread(center, nearest_on_line, sw_shotorg, attack_endpos)) { - WarpZone_TraceLine(sw_shotorg, center, MOVE_NOMONSTERS, self); + WarpZone_TraceLine(sw_shotorg, center, MOVE_NOMONSTERS, actor); if(trace_fraction == 1) { return true; } // yes, the center point is clear and we can allow the damage } @@ -307,7 +307,7 @@ float W_Shockwave_Attack_IsVisible( corner = get_corner_position(head, i); if(W_Shockwave_Attack_CheckSpread(corner, nearest_on_line, sw_shotorg, attack_endpos)) { - WarpZone_TraceLine(sw_shotorg, corner, MOVE_NOMONSTERS, self); + WarpZone_TraceLine(sw_shotorg, corner, MOVE_NOMONSTERS, actor); if(trace_fraction == 1) { return true; } // yes, this corner is clear and we can allow the damage } } @@ -356,7 +356,7 @@ void W_Shockwave_Send(entity actor) } void W_Shockwave_Attack(entity actor) -{entity this = actor; +{ // declarations float multiplier, multiplier_from_accuracy, multiplier_from_distance; float final_damage; @@ -366,16 +366,16 @@ void W_Shockwave_Attack(entity actor) float i, queue = 0; // set up the shot direction - W_SetupShot(self, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage)); + W_SetupShot(actor, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage)); vector attack_endpos = (w_shotorg + (w_shotdir * WEP_CVAR(shockwave, blast_distance))); - WarpZone_TraceLine(w_shotorg, attack_endpos, MOVE_NOMONSTERS, self); + WarpZone_TraceLine(w_shotorg, attack_endpos, MOVE_NOMONSTERS, actor); vector attack_hitpos = trace_endpos; float distance_to_end = vlen(w_shotorg - attack_endpos); float distance_to_hit = vlen(w_shotorg - attack_hitpos); //entity transform = WarpZone_trace_transform; // do the firing effect now - W_Shockwave_Send(self); + W_Shockwave_Send(actor); Damage_DamageInfo( attack_hitpos, WEP_CVAR(shockwave, blast_splash_damage), @@ -384,7 +384,7 @@ void W_Shockwave_Attack(entity actor) w_shotdir * WEP_CVAR(shockwave, blast_splash_force), WEP_SHOCKWAVE.m_id, 0, - self + actor ); // splash damage/jumping trace @@ -403,7 +403,7 @@ void W_Shockwave_Attack(entity actor) { float distance_to_head = vlen(attack_hitpos - head.WarpZone_findradius_nearest); - if((head == self) && (distance_to_head <= WEP_CVAR(shockwave, blast_jump_radius))) + if((head == actor) && (distance_to_head <= WEP_CVAR(shockwave, blast_jump_radius))) { // ======================== // BLAST JUMP CALCULATION @@ -459,8 +459,8 @@ void W_Shockwave_Attack(entity actor) // trigger damage with this calculated info Damage( head, - self, - self, + actor, + actor, final_damage, WEP_SHOCKWAVE.m_id, head.origin, @@ -550,7 +550,7 @@ void W_Shockwave_Attack(entity actor) head = WarpZone_FindRadius(w_shotorg, WEP_CVAR(shockwave, blast_distance), false); while(head) { - if((head != self) && head.takedamage) + if((head != actor) && head.takedamage) { // ======================== // BLAST CONE CALCULATION @@ -563,15 +563,15 @@ void W_Shockwave_Attack(entity actor) float h; // hypotenuse, which is the distance between attacker to head float a; // adjacent side, which is the distance between attacker and the point on w_shotdir that is closest to head.origin - h = vlen(center - self.origin); - a = h * (normalize(center - self.origin) * w_shotdir); + h = vlen(center - actor.origin); + a = h * (normalize(center - actor.origin) * w_shotdir); // WEAPONTODO: replace with simpler method vector nearest_on_line = (w_shotorg + a * w_shotdir); vector nearest_to_attacker = WarpZoneLib_NearestPointOnBox(center + head.mins, center + head.maxs, nearest_on_line); if((vlen(head.WarpZone_findradius_dist) <= WEP_CVAR(shockwave, blast_distance)) - && (W_Shockwave_Attack_IsVisible(self, head, nearest_on_line, w_shotorg, attack_endpos))) + && (W_Shockwave_Attack_IsVisible(actor, head, nearest_on_line, w_shotorg, attack_endpos))) { // calculate importance of distance and accuracy for this attack multiplier_from_accuracy = (1 - @@ -643,24 +643,24 @@ void W_Shockwave_Attack(entity actor) Damage( head, - self, - self, + actor, + actor, final_damage, WEP_SHOCKWAVE.m_id, head.origin, final_force ); - if(accuracy_isgooddamage(self.realowner, head)) + if(accuracy_isgooddamage(actor.realowner, head)) { LOG_INFO("wtf\n"); - accuracy_add(self.realowner, WEP_SHOCKWAVE.m_id, 0, final_damage); + accuracy_add(actor.realowner, WEP_SHOCKWAVE.m_id, 0, final_damage); } #ifdef DEBUG_SHOCKWAVE LOG_INFO(sprintf( "SHOCKWAVE by %s: damage = %f, force = %f.\n", - self.netname, + actor.netname, final_damage, vlen(final_force) )); @@ -674,11 +674,10 @@ void W_Shockwave_Attack(entity actor) METHOD(Shockwave, wr_aim, void(entity thiswep, entity actor)) { - entity this = actor; - if(vlen(self.origin - self.enemy.origin) <= WEP_CVAR(shockwave, melee_range)) - { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, 1000000, 0, 0.001, false); } + if(vdist(actor.origin - actor.enemy.origin, <=, WEP_CVAR(shockwave, melee_range))) + { PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, 1000000, 0, 0.001, false); } else - { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 0.001, false); } + { PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, 1000000, 0, 0.001, false); } } METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { diff --git a/qcsrc/common/weapons/weapon/shotgun.qc b/qcsrc/common/weapons/weapon/shotgun.qc index 8de7b6fb3..06c48b115 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qc +++ b/qcsrc/common/weapons/weapon/shotgun.qc @@ -59,22 +59,22 @@ REGISTER_WEAPON(SHOTGUN, shotgun, NEW(Shotgun)); spawnfunc(weapon_shotgun) { weapon_defaultspawnfunc(this, WEP_SHOTGUN); } void W_Shotgun_Attack(Weapon thiswep, entity actor, float isprimary) -{entity this = actor; +{ float sc; entity flash; - W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(shotgun, ammo)); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(shotgun, ammo)); - W_SetupShot(self, true, 5, SND_SHOTGUN_FIRE, ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), WEP_CVAR_PRI(shotgun, damage) * WEP_CVAR_PRI(shotgun, bullets)); + W_SetupShot(actor, true, 5, SND_SHOTGUN_FIRE, ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), WEP_CVAR_PRI(shotgun, damage) * WEP_CVAR_PRI(shotgun, bullets)); for(sc = 0;sc < WEP_CVAR_PRI(shotgun, bullets);sc = sc + 1) - fireBullet(self, w_shotorg, w_shotdir, WEP_CVAR_PRI(shotgun, spread), WEP_CVAR_PRI(shotgun, solidpenetration), WEP_CVAR_PRI(shotgun, damage), WEP_CVAR_PRI(shotgun, force), WEP_SHOTGUN.m_id, 0); + fireBullet(actor, w_shotorg, w_shotdir, WEP_CVAR_PRI(shotgun, spread), WEP_CVAR_PRI(shotgun, solidpenetration), WEP_CVAR_PRI(shotgun, damage), WEP_CVAR_PRI(shotgun, force), WEP_SHOTGUN.m_id, 0); Send_Effect(EFFECT_SHOTGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, WEP_CVAR_PRI(shotgun, ammo)); // casing code if(autocvar_g_casings >= 1) for(sc = 0;sc < WEP_CVAR_PRI(shotgun, ammo);sc = sc + 1) - SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 30) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 1, self); + SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 30) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 1, actor); // muzzle flash for 1st person view flash = spawn(); @@ -82,7 +82,7 @@ void W_Shotgun_Attack(Weapon thiswep, entity actor, float isprimary) setthink(flash, SUB_Remove); flash.nextthink = time + 0.06; flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION; - W_AttachToShotorg(self, flash, '5 0 0'); + W_AttachToShotorg(actor, flash, '5 0 0'); } .float swing_prev; @@ -94,47 +94,47 @@ void W_Shotgun_Melee_Think(entity this) entity target_victim; vector targpos; - if(!self.cnt) // set start time of melee + if(!this.cnt) // set start time of melee { - self.cnt = time; - W_PlayStrengthSound(self.realowner); + this.cnt = time; + W_PlayStrengthSound(this.realowner); } - makevectors(self.realowner.v_angle); // update values for v_* vectors + makevectors(this.realowner.v_angle); // update values for v_* vectors // calculate swing percentage based on time meleetime = WEP_CVAR_SEC(shotgun, melee_time) * W_WeaponRateFactor(this.realowner); - swing = bound(0, (self.cnt + meleetime - time) / meleetime, 10); + swing = bound(0, (this.cnt + meleetime - time) / meleetime, 10); f = ((1 - swing) * WEP_CVAR_SEC(shotgun, melee_traces)); // check to see if we can still continue, otherwise give up now - if(IS_DEAD(self.realowner) && WEP_CVAR_SEC(shotgun, melee_no_doubleslap)) + if(IS_DEAD(this.realowner) && WEP_CVAR_SEC(shotgun, melee_no_doubleslap)) { - remove(self); + remove(this); return; } // if okay, perform the traces needed for this frame - for(i=self.swing_prev; i < f; ++i) + for(i=this.swing_prev; i < f; ++i) { swing_factor = ((1 - (i / WEP_CVAR_SEC(shotgun, melee_traces))) * 2 - 1); - targpos = (self.realowner.origin + self.realowner.view_ofs + targpos = (this.realowner.origin + this.realowner.view_ofs + (v_forward * WEP_CVAR_SEC(shotgun, melee_range)) + (v_up * swing_factor * WEP_CVAR_SEC(shotgun, melee_swing_up)) + (v_right * swing_factor * WEP_CVAR_SEC(shotgun, melee_swing_side))); - WarpZone_traceline_antilag(self, self.realowner.origin + self.realowner.view_ofs, targpos, false, self.realowner, ANTILAG_LATENCY(self.realowner)); + WarpZone_traceline_antilag(this, this.realowner.origin + this.realowner.view_ofs, targpos, false, this.realowner, ANTILAG_LATENCY(this.realowner)); // draw lightning beams for debugging - //te_lightning2(world, targpos, self.realowner.origin + self.realowner.view_ofs + v_forward * 5 - v_up * 5); + //te_lightning2(world, targpos, this.realowner.origin + this.realowner.view_ofs + v_forward * 5 - v_up * 5); //te_customflash(targpos, 40, 2, '1 1 1'); is_player = (IS_PLAYER(trace_ent) || trace_ent.classname == "body" || IS_MONSTER(trace_ent)); - if((trace_fraction < 1) // if trace is good, apply the damage and remove self + if((trace_fraction < 1) // if trace is good, apply the damage and remove this && (trace_ent.takedamage == DAMAGE_AIM) - && (trace_ent != self.swing_alreadyhit) + && (trace_ent != this.swing_alreadyhit) && (is_player || WEP_CVAR_SEC(shotgun, melee_nonplayerdamage))) { target_victim = trace_ent; // so it persists through other calls @@ -144,42 +144,42 @@ void W_Shotgun_Melee_Think(entity this) else swing_damage = (WEP_CVAR_SEC(shotgun, melee_nonplayerdamage) * min(1, swing_factor + 1)); - //print(strcat(self.realowner.netname, " hitting ", target_victim.netname, " with ", strcat(ftos(swing_damage), " damage (factor: ", ftos(swing_factor), ") at "), ftos(time), " seconds.\n")); + //print(strcat(this.realowner.netname, " hitting ", target_victim.netname, " with ", strcat(ftos(swing_damage), " damage (factor: ", ftos(swing_factor), ") at "), ftos(time), " seconds.\n")); - Damage(target_victim, self.realowner, self.realowner, + Damage(target_victim, this.realowner, this.realowner, swing_damage, WEP_SHOTGUN.m_id | HITTYPE_SECONDARY, - self.realowner.origin + self.realowner.view_ofs, + this.realowner.origin + this.realowner.view_ofs, v_forward * WEP_CVAR_SEC(shotgun, force)); - if(accuracy_isgooddamage(self.realowner, target_victim)) { accuracy_add(self.realowner, WEP_SHOTGUN.m_id, 0, swing_damage); } + if(accuracy_isgooddamage(this.realowner, target_victim)) { accuracy_add(this.realowner, WEP_SHOTGUN.m_id, 0, swing_damage); } // draw large red flash for debugging //te_customflash(targpos, 200, 2, '15 0 0'); if(WEP_CVAR_SEC(shotgun, melee_multihit)) // allow multiple hits with one swing, but not against the same player twice. { - self.swing_alreadyhit = target_victim; + this.swing_alreadyhit = target_victim; continue; // move along to next trace } else { - remove(self); + remove(this); return; } } } - if(time >= self.cnt + meleetime) + if(time >= this.cnt + meleetime) { // melee is finished - remove(self); + remove(this); return; } else { // set up next frame - self.swing_prev = i; - self.nextthink = time; + this.swing_prev = i; + this.nextthink = time; } } @@ -228,11 +228,10 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity METHOD(Shotgun, wr_aim, void(entity thiswep, entity actor)) { - entity this = actor; - if(vdist(self.origin - self.enemy.origin, <=, WEP_CVAR_SEC(shotgun, melee_range))) - PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, 1000000, 0, 0.001, false); + if(vdist(actor.origin - actor.enemy.origin, <=, WEP_CVAR_SEC(shotgun, melee_range))) + PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, 1000000, 0, 0.001, false); else - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 0.001, false); + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, 1000000, 0, 0.001, false); } METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { @@ -282,8 +281,7 @@ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentit } METHOD(Shotgun, wr_setup, void(entity thiswep, entity actor)) { - entity this = actor; - self.ammo_field = ammo_none; + actor.ammo_field = ammo_none; } METHOD(Shotgun, wr_checkammo1, bool(entity thiswep, entity actor)) { @@ -330,14 +328,13 @@ METHOD(Shotgun, wr_killmessage, Notification(entity thiswep)) METHOD(Shotgun, wr_impacteffect, void(entity thiswep, entity actor)) { - entity this = actor; vector org2 = w_org + w_backoff * 2; pointparticles(EFFECT_SHOTGUN_IMPACT, org2, w_backoff * 1000, 1); - if(!w_issilent && time - self.prevric > 0.25) + if(!w_issilent && time - actor.prevric > 0.25) { if(w_random < 0.05) - sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM); - self.prevric = time; + sound(actor, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM); + actor.prevric = time; } } diff --git a/qcsrc/common/weapons/weapon/tuba.qc b/qcsrc/common/weapons/weapon/tuba.qc index 147f2e00e..c0e0ac89b 100644 --- a/qcsrc/common/weapons/weapon/tuba.qc +++ b/qcsrc/common/weapons/weapon/tuba.qc @@ -280,80 +280,80 @@ void W_Tuba_NoteThink(entity this) float vol0, vol1; vector dir0, dir1; vector v; - if(time > self.teleport_time) + if(time > this.teleport_time) { W_Tuba_NoteOff(this); return; } - self.nextthink = time; + this.nextthink = time; dist_mult = WEP_CVAR(tuba, attenuation) / autocvar_snd_soundradius; - FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != self.realowner, { - v = self.origin - (it.origin + it.view_ofs); + FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != this.realowner, { + v = this.origin - (it.origin + it.view_ofs); vol0 = max(0, 1 - vlen(v) * dist_mult); dir0 = normalize(v); - v = self.realowner.origin - (it.origin + it.view_ofs); + v = this.realowner.origin - (it.origin + it.view_ofs); vol1 = max(0, 1 - vlen(v) * dist_mult); dir1 = normalize(v); if(fabs(vol0 - vol1) > 0.005) // 0.5 percent change in volume { - setorigin(self, self.realowner.origin); - self.SendFlags |= 2; + setorigin(this, this.realowner.origin); + this.SendFlags |= 2; break; } if(dir0 * dir1 < 0.9994) // 2 degrees change in angle { - setorigin(self, self.realowner.origin); - self.SendFlags |= 2; + setorigin(this, this.realowner.origin); + this.SendFlags |= 2; break; } }); } void W_Tuba_NoteOn(entity actor, float hittype) -{entity this = actor; +{ vector o; float n; - W_SetupShot(self, false, 2, SND_Null, 0, WEP_CVAR(tuba, damage)); + W_SetupShot(actor, false, 2, SND_Null, 0, WEP_CVAR(tuba, damage)); - n = W_Tuba_GetNote(self, hittype); + n = W_Tuba_GetNote(actor, hittype); hittype = 0; - if(self.tuba_instrument & 1) + if(actor.tuba_instrument & 1) hittype |= HITTYPE_SECONDARY; - if(self.tuba_instrument & 2) + if(actor.tuba_instrument & 2) hittype |= HITTYPE_BOUNCE; - if(self.tuba_note) + if(actor.tuba_note) { - if(self.tuba_note.cnt != n || self.tuba_note.tuba_instrument != self.tuba_instrument) + if(actor.tuba_note.cnt != n || actor.tuba_note.tuba_instrument != actor.tuba_instrument) { - W_Tuba_NoteOff(self.tuba_note); + W_Tuba_NoteOff(actor.tuba_note); } } - if(!self.tuba_note) + if(!actor.tuba_note) { - self.tuba_note = new(tuba_note); - self.tuba_note.owner = self.tuba_note.realowner = self; - self.tuba_note.cnt = n; - self.tuba_note.tuba_instrument = self.tuba_instrument; - setthink(self.tuba_note, W_Tuba_NoteThink); - self.tuba_note.nextthink = time; - self.tuba_note.spawnshieldtime = time; - Net_LinkEntity(self.tuba_note, false, 0, W_Tuba_NoteSendEntity); + actor.tuba_note = new(tuba_note); + actor.tuba_note.owner = actor.tuba_note.realowner = actor; + actor.tuba_note.cnt = n; + actor.tuba_note.tuba_instrument = actor.tuba_instrument; + setthink(actor.tuba_note, W_Tuba_NoteThink); + actor.tuba_note.nextthink = time; + actor.tuba_note.spawnshieldtime = time; + Net_LinkEntity(actor.tuba_note, false, 0, W_Tuba_NoteSendEntity); } - self.tuba_note.teleport_time = time + WEP_CVAR(tuba, refire) * 2 * W_WeaponRateFactor(actor); // so it can get prolonged safely + actor.tuba_note.teleport_time = time + WEP_CVAR(tuba, refire) * 2 * W_WeaponRateFactor(actor); // so it can get prolonged safely - //sound(self, c, TUBA_NOTE(n), bound(0, VOL_BASE * cvar("g_balance_tuba_volume"), 1), autocvar_g_balance_tuba_attenuation); - RadiusDamage(self, self, WEP_CVAR(tuba, damage), WEP_CVAR(tuba, edgedamage), WEP_CVAR(tuba, radius), NULL, NULL, WEP_CVAR(tuba, force), hittype | WEP_TUBA.m_id, NULL); + //sound(actor, c, TUBA_NOTE(n), bound(0, VOL_BASE * cvar("g_balance_tuba_volume"), 1), autocvar_g_balance_tuba_attenuation); + RadiusDamage(actor, actor, WEP_CVAR(tuba, damage), WEP_CVAR(tuba, edgedamage), WEP_CVAR(tuba, radius), NULL, NULL, WEP_CVAR(tuba, force), hittype | WEP_TUBA.m_id, NULL); - o = gettaginfo(self.exteriorweaponentity, 0); - if(time > self.tuba_smoketime) + o = gettaginfo(actor.exteriorweaponentity, 0); + if(time > actor.tuba_smoketime) { Send_Effect(EFFECT_SMOKE_RING, o + v_up * 45 + v_right * -6 + v_forward * 8, v_up * 100, 1); - self.tuba_smoketime = time + 0.25; + actor.tuba_smoketime = time + 0.25; } } #endif diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index ee77fc1c1..c660279ef 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -169,63 +169,63 @@ spawnfunc(weapon_vaporizer) { weapon_defaultspawnfunc(this, WEP_VAPORIZER); } spawnfunc(weapon_minstanex) { spawnfunc_weapon_vaporizer(this); } void W_RocketMinsta_Explosion(entity actor, vector loc) -{entity this = actor; - if(accuracy_canbegooddamage(self)) - accuracy_add(self, WEP_DEVASTATOR.m_id, autocvar_g_rm_damage, 0); +{ + if(accuracy_canbegooddamage(actor)) + accuracy_add(actor, WEP_DEVASTATOR.m_id, autocvar_g_rm_damage, 0); entity dmgent = spawn(); - dmgent.owner = dmgent.realowner = self; + dmgent.owner = dmgent.realowner = actor; setorigin(dmgent, loc); - RadiusDamage (dmgent, self, autocvar_g_rm_damage, autocvar_g_rm_edgedamage, autocvar_g_rm_radius, world, world, autocvar_g_rm_force, WEP_DEVASTATOR.m_id | HITTYPE_SPLASH, other); + RadiusDamage (dmgent, actor, autocvar_g_rm_damage, autocvar_g_rm_edgedamage, autocvar_g_rm_radius, world, world, autocvar_g_rm_force, WEP_DEVASTATOR.m_id | HITTYPE_SPLASH, other); remove(dmgent); } void W_Vaporizer_Attack(Weapon thiswep, entity actor) -{entity this = actor; - bool flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last +{ + bool flying = IsFlying(actor); // do this BEFORE to make the trace values from FireRailgunBullet last float vaporizer_damage = ((WEP_CVAR_PRI(vaporizer, damage) > 0) ? WEP_CVAR_PRI(vaporizer, damage) : 10000); - W_SetupShot(self, true, 0, SND_Null, CH_WEAPON_A, vaporizer_damage); + W_SetupShot(actor, true, 0, SND_Null, CH_WEAPON_A, vaporizer_damage); // handle sound separately so we can change the volume // added bonus: no longer plays the strength sound (strength gives no bonus to instakill anyway) - sound (self, CH_WEAPON_A, SND_MINSTANEXFIRE, VOL_BASE * 0.8, ATTEN_NORM); + sound (actor, CH_WEAPON_A, SND_MINSTANEXFIRE, VOL_BASE * 0.8, ATTEN_NORM); yoda = 0; damage_goodhits = 0; - FireRailgunBullet(self, w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, vaporizer_damage, 800, 0, 0, 0, 0, WEP_VAPORIZER.m_id); + FireRailgunBullet(actor, w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, vaporizer_damage, 800, 0, 0, 0, 0, WEP_VAPORIZER.m_id); // do this now, as goodhits is disabled below - SendCSQCVaporizerBeamParticle(self, damage_goodhits); + SendCSQCVaporizerBeamParticle(actor, damage_goodhits); if(yoda && flying) - Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA); - if(damage_goodhits && self.vaporizer_lasthit) + Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA); + if(damage_goodhits && actor.vaporizer_lasthit) { - Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE); + Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE); damage_goodhits = 0; // only every second time } - self.vaporizer_lasthit = damage_goodhits; + actor.vaporizer_lasthit = damage_goodhits; if(autocvar_g_rm) if(!(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT))) - W_RocketMinsta_Explosion(self, trace_endpos); + W_RocketMinsta_Explosion(actor, trace_endpos); - W_DecreaseAmmo(thiswep, self, ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo))); + W_DecreaseAmmo(thiswep, actor, ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo))); } void W_RocketMinsta_Laser_Explode (entity this) { if(other.takedamage == DAMAGE_AIM) if(IS_PLAYER(other)) - if(DIFF_TEAM(self.realowner, other)) + if(DIFF_TEAM(this.realowner, other)) if(!IS_DEAD(other)) if(IsFlying(other)) - Send_Notification(NOTIF_ONE, self.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH); + Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH); - self.event_damage = func_null; - self.takedamage = DAMAGE_NO; - RadiusDamage (self, self.realowner, self.rm_damage, self.rm_edmg, autocvar_g_rm_laser_radius, world, world, self.rm_force, self.projectiledeathtype, other); - remove(self); + this.event_damage = func_null; + this.takedamage = DAMAGE_NO; + RadiusDamage (this, this.realowner, this.rm_damage, this.rm_edmg, autocvar_g_rm_laser_radius, world, world, this.rm_force, this.projectiledeathtype, other); + remove(this); } void W_RocketMinsta_Laser_Explode_use(entity this, entity actor, entity trigger) @@ -237,13 +237,13 @@ void W_RocketMinsta_Laser_Touch (entity this) { PROJECTILE_TOUCH(this); //W_RocketMinsta_Laser_Explode (); - RadiusDamage (self, self.realowner, self.rm_damage, self.rm_edmg, autocvar_g_rm_laser_radius, world, world, self.rm_force, self.projectiledeathtype, other); - remove(self); + RadiusDamage (this, this.realowner, this.rm_damage, this.rm_edmg, autocvar_g_rm_laser_radius, world, world, this.rm_force, this.projectiledeathtype, other); + remove(this); } void W_RocketMinsta_Attack2(entity actor) -{entity this = actor; - makevectors(self.v_angle); +{ + makevectors(actor.v_angle); entity proj; float counter = 0; @@ -251,17 +251,17 @@ void W_RocketMinsta_Attack2(entity actor) float spread = autocvar_g_rm_laser_spread; float rndspread = autocvar_g_rm_laser_spread_random; - Weapon w = PS(self).m_weapon; - PS(self).m_weapon = WEP_ELECTRO; - W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, SND_CRYLINK_FIRE, CH_WEAPON_A, autocvar_g_rm_laser_damage); - PS(self).m_weapon = w; + Weapon w = PS(actor).m_weapon; + PS(actor).m_weapon = WEP_ELECTRO; + W_SetupShot_ProjectileSize (actor, '0 0 -3', '0 0 -3', false, 2, SND_CRYLINK_FIRE, CH_WEAPON_A, autocvar_g_rm_laser_damage); + PS(actor).m_weapon = w; Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); while(counter < total) { proj = new(plasma_prim); - proj.owner = proj.realowner = self; + proj.owner = proj.realowner = actor; proj.bot_dodge = true; proj.bot_dodgerating = autocvar_g_rm_laser_damage; proj.use = W_RocketMinsta_Laser_Explode_use; @@ -290,30 +290,30 @@ void W_RocketMinsta_Attack2(entity actor) CSQCProjectile(proj, true, PROJECTILE_ROCKETMINSTA_LASER, true); - MUTATOR_CALLHOOK(EditProjectile, self, proj); + MUTATOR_CALLHOOK(EditProjectile, actor, proj); counter++; } } void W_RocketMinsta_Attack3 (entity actor) -{entity this = actor; - makevectors(self.v_angle); +{ + makevectors(actor.v_angle); entity proj; float counter = 0; float total = 1; - Weapon w = PS(self).m_weapon; - PS(self).m_weapon = WEP_ELECTRO; - W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, SND_ELECTRO_FIRE2, CH_WEAPON_A, autocvar_g_rm_laser_damage); - PS(self).m_weapon = w; + Weapon w = PS(actor).m_weapon; + PS(actor).m_weapon = WEP_ELECTRO; + W_SetupShot_ProjectileSize (actor, '0 0 -3', '0 0 -3', false, 2, SND_ELECTRO_FIRE2, CH_WEAPON_A, autocvar_g_rm_laser_damage); + PS(actor).m_weapon = w; Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); while(counter < total) { proj = new(plasma_prim); - proj.owner = proj.realowner = self; + proj.owner = proj.realowner = actor; proj.bot_dodge = true; proj.bot_dodgerating = autocvar_g_rm_laser_damage; proj.use = W_RocketMinsta_Laser_Explode_use; @@ -340,18 +340,17 @@ void W_RocketMinsta_Attack3 (entity actor) CSQCProjectile(proj, true, PROJECTILE_ROCKETMINSTA_LASER, true); - MUTATOR_CALLHOOK(EditProjectile, self, proj); + MUTATOR_CALLHOOK(EditProjectile, actor, proj); counter++; } } METHOD(Vaporizer, wr_aim, void(entity thiswep, entity actor)) { - entity this = actor; - if(self.(thiswep.ammo_field) > 0) - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 1, false); + if(actor.(thiswep.ammo_field) > 0) + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, 1000000, 0, 1, false); else - PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars + PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars } METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { @@ -429,9 +428,8 @@ METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponent } METHOD(Vaporizer, wr_setup, void(entity thiswep, entity actor)) { - entity this = actor; - self.ammo_field = (thiswep.ammo_field); - self.vaporizer_lasthit = 0; + actor.ammo_field = (thiswep.ammo_field); + actor.vaporizer_lasthit = 0; } METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep, entity actor)) { @@ -450,8 +448,7 @@ METHOD(Vaporizer, wr_checkammo2, bool(entity thiswep, entity actor)) } METHOD(Vaporizer, wr_resetplayer, void(entity thiswep, entity actor)) { - entity this = actor; - self.vaporizer_lasthit = 0; + actor.vaporizer_lasthit = 0; } METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { @@ -478,17 +475,16 @@ METHOD(Vaporizer, wr_killmessage, Notification(entity thiswep)) METHOD(Vaporizer, wr_impacteffect, void(entity thiswep, entity actor)) { - entity this = actor; vector org2 = w_org + w_backoff * 6; if(w_deathtype & HITTYPE_SECONDARY) { pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1); - if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); } + if(!w_issilent) { sound(actor, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); } } else { pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1); - if(!w_issilent) { sound(self, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM); } + if(!w_issilent) { sound(actor, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM); } } } METHOD(Vaporizer, wr_init, void(entity thiswep)) diff --git a/qcsrc/common/weapons/weapon/vortex.qc b/qcsrc/common/weapons/weapon/vortex.qc index 0169c4b08..d523686d6 100644 --- a/qcsrc/common/weapons/weapon/vortex.qc +++ b/qcsrc/common/weapons/weapon/vortex.qc @@ -158,7 +158,7 @@ MUTATOR_HOOKFUNCTION(vortex_charge, GetPressedKeys) } void W_Vortex_Attack(Weapon thiswep, entity actor, float issecondary) -{entity this = actor; +{ float mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, myammo, charge; mydmg = WEP_CVAR_BOTH(vortex, !issecondary, damage); @@ -170,12 +170,12 @@ void W_Vortex_Attack(Weapon thiswep, entity actor, float issecondary) myammo = WEP_CVAR_BOTH(vortex, !issecondary, ammo); float flying; - flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last + flying = IsFlying(actor); // do this BEFORE to make the trace values from FireRailgunBullet last if(WEP_CVAR(vortex, charge)) { - charge = WEP_CVAR(vortex, charge_mindmg) / mydmg + (1 - WEP_CVAR(vortex, charge_mindmg) / mydmg) * self.vortex_charge; - self.vortex_charge *= WEP_CVAR(vortex, charge_shot_multiplier); // do this AFTER setting mydmg/myforce + charge = WEP_CVAR(vortex, charge_mindmg) / mydmg + (1 - WEP_CVAR(vortex, charge_mindmg) / mydmg) * actor.vortex_charge; + actor.vortex_charge *= WEP_CVAR(vortex, charge_shot_multiplier); // do this AFTER setting mydmg/myforce // O RLY? -- divVerent // YA RLY -- FruitieX } @@ -184,43 +184,42 @@ void W_Vortex_Attack(Weapon thiswep, entity actor, float issecondary) mydmg *= charge; myforce *= charge; - W_SetupShot(self, true, 5, SND_NEXFIRE, CH_WEAPON_A, mydmg); + W_SetupShot(actor, true, 5, SND_NEXFIRE, CH_WEAPON_A, mydmg); if(charge > WEP_CVAR(vortex, charge_animlimit) && WEP_CVAR(vortex, charge_animlimit)) // if the Vortex is overcharged, we play an extra sound { - sound(self, CH_WEAPON_B, SND_NEXCHARGE, VOL_BASE * (charge - 0.5 * WEP_CVAR(vortex, charge_animlimit)) / (1 - 0.5 * WEP_CVAR(vortex, charge_animlimit)), ATTN_NORM); + sound(actor, CH_WEAPON_B, SND_NEXCHARGE, VOL_BASE * (charge - 0.5 * WEP_CVAR(vortex, charge_animlimit)) / (1 - 0.5 * WEP_CVAR(vortex, charge_animlimit)), ATTN_NORM); } yoda = 0; damage_goodhits = 0; - FireRailgunBullet(self, w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, WEP_VORTEX.m_id); + FireRailgunBullet(actor, w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, WEP_VORTEX.m_id); if(yoda && flying) - Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA); - if(damage_goodhits && self.vortex_lasthit) + Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA); + if(damage_goodhits && actor.vortex_lasthit) { - Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE); + Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE); damage_goodhits = 0; // only every second time } - self.vortex_lasthit = damage_goodhits; + actor.vortex_lasthit = damage_goodhits; //beam and muzzle flash done on client SendCSQCVortexBeamParticle(charge); - W_DecreaseAmmo(thiswep, self, myammo); + W_DecreaseAmmo(thiswep, actor, myammo); } .float vortex_chargepool_pauseregen_finished; METHOD(Vortex, wr_aim, void(entity thiswep, entity actor)) { - entity this = actor; - if(bot_aim(self, 1000000, 0, 1, false)) - PHYS_INPUT_BUTTON_ATCK(self) = true; + if(bot_aim(actor, 1000000, 0, 1, false)) + PHYS_INPUT_BUTTON_ATCK(actor) = true; else { if(WEP_CVAR(vortex, charge)) - PHYS_INPUT_BUTTON_ATCK2(self) = true; + PHYS_INPUT_BUTTON_ATCK2(actor) = true; } } METHOD(Vortex, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) @@ -349,14 +348,13 @@ METHOD(Vortex, wr_checkammo2, bool(entity thiswep, entity actor)) } METHOD(Vortex, wr_resetplayer, void(entity thiswep, entity actor)) { - entity this = actor; if (WEP_CVAR(vortex, charge)) { if (WEP_CVAR_SEC(vortex, chargepool)) { - self.vortex_chargepool_ammo = 1; + actor.vortex_chargepool_ammo = 1; } - self.vortex_charge = WEP_CVAR(vortex, charge_start); + actor.vortex_charge = WEP_CVAR(vortex, charge_start); } - self.vortex_lasthit = 0; + actor.vortex_lasthit = 0; } METHOD(Vortex, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { diff --git a/qcsrc/lib/defer.qh b/qcsrc/lib/defer.qh index d4a25089f..3e7e020c6 100644 --- a/qcsrc/lib/defer.qh +++ b/qcsrc/lib/defer.qh @@ -9,7 +9,7 @@ class(Defer).entity owner; class(Defer).void(entity) defer_func; - /** Remove self */ + /** Remove entity */ void SUB_Remove(entity this) { remove(this); diff --git a/qcsrc/lib/self.qh b/qcsrc/lib/self.qh index 583750014..fe26b08a4 100644 --- a/qcsrc/lib/self.qh +++ b/qcsrc/lib/self.qh @@ -29,7 +29,7 @@ #endif // Step 5: this should work -#if 0 +#if 1 #undef self #define self (0, this) #endif diff --git a/qcsrc/lib/warpzone/server.qc b/qcsrc/lib/warpzone/server.qc index 28c11e91c..c373e1eae 100644 --- a/qcsrc/lib/warpzone/server.qc +++ b/qcsrc/lib/warpzone/server.qc @@ -206,7 +206,7 @@ void WarpZone_Touch (entity this) #endif return; - if(WarpZoneLib_ExactTrigger_Touch(self, other)) + if(WarpZoneLib_ExactTrigger_Touch(this, other)) return; #ifdef SVQC diff --git a/qcsrc/server/bot/aim.qc b/qcsrc/server/bot/aim.qc index ebbacd6b8..bbb1c8634 100644 --- a/qcsrc/server/bot/aim.qc +++ b/qcsrc/server/bot/aim.qc @@ -156,8 +156,8 @@ void bot_lagfunc(entity this, float t, float f1, float f2, entity e1, vector v1, } this.bot_aimtarg = e1; this.bot_aimlatency = this.ping; // FIXME? Shouldn't this be in the lag item? - //this.bot_aimselforigin = v1; - //this.bot_aimselfvelocity = v2; + //this.bot_aimorigin = v1; + //this.bot_aimvelocity = v2; this.bot_aimtargorigin = v3; this.bot_aimtargvelocity = v4; if(skill <= 0) diff --git a/qcsrc/server/bot/aim.qh b/qcsrc/server/bot/aim.qh index a26e64bc7..dfe10e265 100644 --- a/qcsrc/server/bot/aim.qh +++ b/qcsrc/server/bot/aim.qh @@ -74,8 +74,8 @@ vector shotdir; .vector bot_5th_order_aimfilter; .vector bot_olddesiredang; -//.vector bot_aimselforigin; -//.vector bot_aimselfvelocity; +//.vector bot_aimorigin; +//.vector bot_aimvelocity; .vector bot_aimtargorigin; .vector bot_aimtargvelocity; diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 94816a1a7..7dda06011 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -295,7 +295,6 @@ float CheatCommand(entity this, int argc) { float effectnum, f; vector start, end; - entity oldself; case "pointparticles": IS_CHEAT(this, 0, argc, 0); @@ -552,11 +551,11 @@ float CheatCommand(entity this, int argc) { start = '0 0 0'; effectnum = 0; - for(oldself = world; (oldself = find(oldself, classname, "dragbox_box")); ) + for(entity ent = world; (ent = find(ent, classname, "dragbox_box")); ) { - if(e.cnt <= 0 && oldself.cnt == 0 || e.cnt == oldself.cnt) + if(e.cnt <= 0 && ent.cnt == 0 || e.cnt == ent.cnt) { - start = start + oldself.origin; + start = start + ent.origin; ++effectnum; } } @@ -583,12 +582,12 @@ float CheatCommand(entity this, int argc) // these need race_place // counting... effectnum = 1; - for(oldself = world; (oldself = find(oldself, classname, "dragpoint")); ) - if(oldself.cnt == 0) + for(entity ent = world; (ent = find(ent, classname, "dragpoint")); ) + if(ent.cnt == 0) { - if(vlen(oldself.origin - start) < vlen(e.origin - start)) + if(vlen2(ent.origin - start) < vlen2(e.origin - start)) ++effectnum; - else if(vlen(oldself.origin - start) == vlen(e.origin - start) && etof(oldself) < etof(e)) + else if(vlen2(ent.origin - start) == vlen2(e.origin - start) && etof(ent) < etof(e)) ++effectnum; } fputs(f, strcat("\"race_place\" \"", ftos(effectnum), "\"\n")); diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index 250f3cda1..173191ddc 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -704,7 +704,7 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc // for now, just give "say" back and only handle say_team if(!teamsay) { - clientcommand(self, strcat("say ", msgin)); + clientcommand(source, strcat("say ", msgin)); return; } */ diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index 1cc6e1d21..ae0a02538 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -205,7 +205,7 @@ void timeout_handler_think(entity this) if (timeout_time == autocvar_sv_timeout_resumetime) // play a warning sound when only seconds are left Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_PREPARE); - self.nextthink = time + TIMEOUT_SLOWMO_VALUE; // think again in one second + this.nextthink = time + TIMEOUT_SLOWMO_VALUE; // think again in one second timeout_time -= 1; // decrease the time counter } else // time to end the timeout @@ -232,7 +232,7 @@ void timeout_handler_think(entity this) { Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_TIMEOUT_BEGINNING, timeout_leadtime); - self.nextthink = time + 1; // think again in one second + this.nextthink = time + 1; // think again in one second timeout_leadtime -= 1; // decrease the time counter } else // time to begin the timeout @@ -254,7 +254,7 @@ void timeout_handler_think(entity this) it.lastV_angle = it.v_angle; )); - self.nextthink = time; // think again next frame to handle it under TIMEOUT_ACTIVE code + this.nextthink = time; // think again next frame to handle it under TIMEOUT_ACTIVE code } return; diff --git a/qcsrc/server/command/radarmap.qc b/qcsrc/server/command/radarmap.qc index 616727c5d..dd1d5deaf 100644 --- a/qcsrc/server/command/radarmap.qc +++ b/qcsrc/server/command/radarmap.qc @@ -221,147 +221,147 @@ void RadarMap_Think(entity this) float i, x, l; string si; - if (self.frame == 0) + if (this.frame == 0) { // initialize get_mi_min_max_texcoords(1); - self.mins = mi_picmin; - self.maxs_x = (mi_picmax.x - mi_picmin.x) / self.size.x; - self.maxs_y = (mi_picmax.y - mi_picmin.y) / self.size.y; - self.maxs_z = mi_max.z - mi_min.z; - LOG_INFO("Picture mins/maxs: ", ftos(self.maxs.x), " and ", ftos(self.maxs.y), " should match\n"); - self.netname = strzone(strcat("gfx/", mi_shortname, "_radar.xpm")); - if (!(self.count & 1)) + this.mins = mi_picmin; + this.maxs_x = (mi_picmax.x - mi_picmin.x) / this.size.x; + this.maxs_y = (mi_picmax.y - mi_picmin.y) / this.size.y; + this.maxs_z = mi_max.z - mi_min.z; + LOG_INFO("Picture mins/maxs: ", ftos(this.maxs.x), " and ", ftos(this.maxs.y), " should match\n"); + this.netname = strzone(strcat("gfx/", mi_shortname, "_radar.xpm")); + if (!(this.count & 1)) { - self.cnt = fopen(self.netname, FILE_READ); - if (self.cnt < 0) self.cnt = fopen(strcat("gfx/", mi_shortname, "_radar.tga"), FILE_READ); - if (self.cnt < 0) self.cnt = fopen(strcat("gfx/", mi_shortname, "_radar.png"), FILE_READ); - if (self.cnt < 0) self.cnt = fopen(strcat("gfx/", mi_shortname, "_radar.jpg"), FILE_READ); - if (self.cnt < 0) self.cnt = fopen(strcat("gfx/", mi_shortname, "_mini.tga"), FILE_READ); - if (self.cnt < 0) self.cnt = fopen(strcat("gfx/", mi_shortname, "_mini.png"), FILE_READ); - if (self.cnt < 0) self.cnt = fopen(strcat("gfx/", mi_shortname, "_mini.jpg"), FILE_READ); - if (self.cnt >= 0) + this.cnt = fopen(this.netname, FILE_READ); + if (this.cnt < 0) this.cnt = fopen(strcat("gfx/", mi_shortname, "_radar.tga"), FILE_READ); + if (this.cnt < 0) this.cnt = fopen(strcat("gfx/", mi_shortname, "_radar.png"), FILE_READ); + if (this.cnt < 0) this.cnt = fopen(strcat("gfx/", mi_shortname, "_radar.jpg"), FILE_READ); + if (this.cnt < 0) this.cnt = fopen(strcat("gfx/", mi_shortname, "_mini.tga"), FILE_READ); + if (this.cnt < 0) this.cnt = fopen(strcat("gfx/", mi_shortname, "_mini.png"), FILE_READ); + if (this.cnt < 0) this.cnt = fopen(strcat("gfx/", mi_shortname, "_mini.jpg"), FILE_READ); + if (this.cnt >= 0) { - fclose(self.cnt); + fclose(this.cnt); - LOG_INFO(self.netname, " already exists, aborting (you may want to specify --force)\n"); + LOG_INFO(this.netname, " already exists, aborting (you may want to specify --force)\n"); RadarMap_Next(); return; } } - self.cnt = fopen(self.netname, FILE_WRITE); - if (self.cnt < 0) + this.cnt = fopen(this.netname, FILE_WRITE); + if (this.cnt < 0) { - LOG_INFO("Error writing ", self.netname, "\n"); - remove(self); + LOG_INFO("Error writing ", this.netname, "\n"); + remove(this); radarmapper = world; return; } - LOG_INFO("Writing to ", self.netname, "...\n"); - fputs(self.cnt, "/* XPM */\n"); - fputs(self.cnt, "static char *RadarMap[] = {\n"); - fputs(self.cnt, "/* columns rows colors chars-per-pixel */\n"); - fputs(self.cnt, strcat("\"", ftos(self.size.x), " ", ftos(self.size.y), " 256 2\",\n")); + LOG_INFO("Writing to ", this.netname, "...\n"); + fputs(this.cnt, "/* XPM */\n"); + fputs(this.cnt, "static char *RadarMap[] = {\n"); + fputs(this.cnt, "/* columns rows colors chars-per-pixel */\n"); + fputs(this.cnt, strcat("\"", ftos(this.size.x), " ", ftos(this.size.y), " 256 2\",\n")); for (i = 0; i < 256; ++i) { si = substring(doublehex, i * 2, 2); - fputs(self.cnt, strcat("\"", si, " c #", si, si, si, "\",\n")); + fputs(this.cnt, strcat("\"", si, " c #", si, si, si, "\",\n")); } - self.frame += 1; - self.nextthink = time; - sharpen_init(self.size.x); + this.frame += 1; + this.nextthink = time; + sharpen_init(this.size.x); } - else if (self.frame <= self.size.y) + else if (this.frame <= this.size.y) { // fill the sharpen buffer with this line - sharpen_shift(self.size.x); - i = self.count & 24; + sharpen_shift(this.size.x); + i = this.count & 24; switch (i) { case 0: default: - for (x = 0; x < self.size.x; ++x) + for (x = 0; x < this.size.x; ++x) { - l = RadarMapAtPoint_Block(self.mins.x + x * self.maxs.x, self.mins.y + (self.size.y - self.frame) * self.maxs.y, self.maxs.x, self.maxs.y, self.mins.z, self.maxs.z, self.size.z); + l = RadarMapAtPoint_Block(this.mins.x + x * this.maxs.x, this.mins.y + (this.size.y - this.frame) * this.maxs.y, this.maxs.x, this.maxs.y, this.mins.z, this.maxs.z, this.size.z); sharpen_set(x, l); } break; case 8: - for (x = 0; x < self.size.x; ++x) + for (x = 0; x < this.size.x; ++x) { - l = RadarMapAtPoint_Trace(self.mins.x + x * self.maxs.x, self.mins.y + (self.size.y - self.frame) * self.maxs.y, self.maxs.x, self.maxs.y, self.mins.z, self.maxs.z, self.size.z); + l = RadarMapAtPoint_Trace(this.mins.x + x * this.maxs.x, this.mins.y + (this.size.y - this.frame) * this.maxs.y, this.maxs.x, this.maxs.y, this.mins.z, this.maxs.z, this.size.z); sharpen_set(x, l); } break; case 16: - for (x = 0; x < self.size.x; ++x) + for (x = 0; x < this.size.x; ++x) { - l = RadarMapAtPoint_Sample(self.mins.x + x * self.maxs.x, self.mins.y + (self.size.y - self.frame) * self.maxs.y, self.maxs.x, self.maxs.y, self.mins.z, self.maxs.z, self.size.z); + l = RadarMapAtPoint_Sample(this.mins.x + x * this.maxs.x, this.mins.y + (this.size.y - this.frame) * this.maxs.y, this.maxs.x, this.maxs.y, this.mins.z, this.maxs.z, this.size.z); sharpen_set(x, l); } break; case 24: - for (x = 0; x < self.size.x; ++x) + for (x = 0; x < this.size.x; ++x) { - l = RadarMapAtPoint_LineBlock(self.mins.x + x * self.maxs.x, self.mins.y + (self.size.y - self.frame) * self.maxs.y, self.maxs.x, self.maxs.y, self.mins.z, self.maxs.z, self.size.z); + l = RadarMapAtPoint_LineBlock(this.mins.x + x * this.maxs.x, this.mins.y + (this.size.y - this.frame) * this.maxs.y, this.maxs.x, this.maxs.y, this.mins.z, this.maxs.z, this.size.z); sharpen_set(x, l); } break; } // do we have enough lines? - if (self.frame >= 2) + if (this.frame >= 2) { // write a pixel line - fputs(self.cnt, "\""); - for (x = 0; x < self.size.x; ++x) + fputs(this.cnt, "\""); + for (x = 0; x < this.size.x; ++x) { - l = sharpen_get(x, self.ltime); - fputs(self.cnt, substring(doublehex, 2 * floor(l * 256.0), 2)); + l = sharpen_get(x, this.ltime); + fputs(this.cnt, substring(doublehex, 2 * floor(l * 256.0), 2)); } - if (self.frame == self.size.y) + if (this.frame == this.size.y) { - fputs(self.cnt, "\"\n"); + fputs(this.cnt, "\"\n"); } else { - fputs(self.cnt, "\",\n"); - LOG_INFO(ftos(self.size.y - self.frame), " lines left\n"); + fputs(this.cnt, "\",\n"); + LOG_INFO(ftos(this.size.y - this.frame), " lines left\n"); } } // is this the last line? then write back the missing line - if (self.frame == self.size.y) + if (this.frame == this.size.y) { - sharpen_shift(self.size.x); + sharpen_shift(this.size.x); // write a pixel line - fputs(self.cnt, "\""); - for (x = 0; x < self.size.x; ++x) + fputs(this.cnt, "\""); + for (x = 0; x < this.size.x; ++x) { - l = sharpen_get(x, self.ltime); - fputs(self.cnt, substring(doublehex, 2 * floor(l * 256.0), 2)); + l = sharpen_get(x, this.ltime); + fputs(this.cnt, substring(doublehex, 2 * floor(l * 256.0), 2)); } - if (self.frame == self.size.y) + if (this.frame == this.size.y) { - fputs(self.cnt, "\"\n"); + fputs(this.cnt, "\"\n"); } else { - fputs(self.cnt, "\",\n"); - LOG_INFO(ftos(self.size.y - self.frame), " lines left\n"); + fputs(this.cnt, "\",\n"); + LOG_INFO(ftos(this.size.y - this.frame), " lines left\n"); } } - self.frame += 1; - self.nextthink = time; + this.frame += 1; + this.nextthink = time; } else { // close the file - fputs(self.cnt, "};\n"); - fclose(self.cnt); - LOG_INFO("Finished. Please edit data/", self.netname, " with an image editing application and place it in the TGA format in the gfx folder.\n"); + fputs(this.cnt, "};\n"); + fclose(this.cnt); + LOG_INFO("Finished. Please edit data/", this.netname, " with an image editing application and place it in the TGA format in the gfx folder.\n"); RadarMap_Next(); } } diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 7fbfd536b..37c994d68 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -45,12 +45,12 @@ void make_mapinfo_Think(entity this) { LOG_INFO("Done rebuiling mapinfos.\n"); MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0); - remove(self); + remove(this); } else { - setthink(self, make_mapinfo_Think); - self.nextthink = time; + setthink(this, make_mapinfo_Think); + this.nextthink = time; } } diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index bb7f538c3..8eea0dc20 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -55,7 +55,7 @@ float server_is_dedicated; .float inactive; // Clientwall disappears when inactive .float alpha_max, alpha_min; .float fade_start, fade_end, fade_vertical_offset; -.float default_solid; // Variable to store default self.solid for clientwalls +.float default_solid; // Variable to store default .solid for clientwalls .float pain_finished; //Added by Supajoe .float pain_frame; //" diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index beaf7805a..df88116d7 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -1251,18 +1251,18 @@ void Fire_ApplyEffect(entity e) void fireburner_think(entity this) { // for players, this is done in the regular loop - if(wasfreed(self.owner)) + if(wasfreed(this.owner)) { - remove(self); + remove(this); return; } - Fire_ApplyEffect(self.owner); - if(!Fire_IsBurning(self.owner)) + Fire_ApplyEffect(this.owner); + if(!Fire_IsBurning(this.owner)) { - self.owner.fire_burner = world; - remove(self); + this.owner.fire_burner = world; + remove(this); return; } - Fire_ApplyDamage(self.owner); - self.nextthink = time; + Fire_ApplyDamage(this.owner); + this.nextthink = time; } diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc index 04766c155..defd6051e 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -49,7 +49,7 @@ const float GRAPHOOK_RELEASE = 21; 4. Open client.c and add this to the top of PutClientInServer(): - RemoveGrapplingHook(self); // Wazat's Grappling Hook + RemoveGrapplingHook(this); // Wazat's Grappling Hook 5. Find ClientConnect() (in client.c) and add these lines to the bottom: @@ -138,40 +138,40 @@ void GrapplingHookThink(entity this) { float spd, dist, minlength, pullspeed, ropestretch, ropeairfriction, rubberforce, newlength, rubberforce_overstretch; vector dir, org, end, v0, dv, v, myorg, vs; - if(self.realowner.hook != self) // how did that happen? + if(this.realowner.hook != this) // how did that happen? { error("Owner lost the hook!\n"); return; } - if(LostMovetypeFollow(self) || intermission_running || (round_handler_IsActive() && !round_handler_IsRoundStarted()) || ((self.aiment.flags & FL_PROJECTILE) && self.aiment.classname != "nade")) + if(LostMovetypeFollow(this) || intermission_running || (round_handler_IsActive() && !round_handler_IsRoundStarted()) || ((this.aiment.flags & FL_PROJECTILE) && this.aiment.classname != "nade")) { - RemoveGrapplingHook(self.realowner); + RemoveGrapplingHook(this.realowner); return; } - if(self.aiment) - WarpZone_RefSys_AddIncrementally(self, self.aiment); + if(this.aiment) + WarpZone_RefSys_AddIncrementally(this, this.aiment); - self.nextthink = time; + this.nextthink = time; - int s = W_GetGunAlignment(self.realowner); + int s = W_GetGunAlignment(this.realowner); vs = hook_shotorigin[s]; - makevectors(self.realowner.v_angle); - org = self.realowner.origin + self.realowner.view_ofs + v_forward * vs.x + v_right * -vs.y + v_up * vs.z; - myorg = WarpZone_RefSys_TransformOrigin(self.realowner, self, org); + makevectors(this.realowner.v_angle); + org = this.realowner.origin + this.realowner.view_ofs + v_forward * vs.x + v_right * -vs.y + v_up * vs.z; + myorg = WarpZone_RefSys_TransformOrigin(this.realowner, this, org); - if(self.hook_length < 0) - self.hook_length = vlen(myorg - self.origin); + if(this.hook_length < 0) + this.hook_length = vlen(myorg - this.origin); int tarzan = autocvar_g_grappling_hook_tarzan; - entity pull_entity = self.realowner; + entity pull_entity = this.realowner; float velocity_multiplier = 1; - MUTATOR_CALLHOOK(GrappleHookThink, self, tarzan, pull_entity, velocity_multiplier); + MUTATOR_CALLHOOK(GrappleHookThink, this, tarzan, pull_entity, velocity_multiplier); tarzan = M_ARGV(1, int); pull_entity = M_ARGV(2, entity); velocity_multiplier = M_ARGV(3, float); - if(self.state == 1) + if(this.state == 1) { pullspeed = autocvar_g_balance_grapplehook_speed_pull;//2000; // speed the rope is pulled with @@ -196,18 +196,18 @@ void GrapplingHookThink(entity this) bool frozen_pulling = (autocvar_g_grappling_hook_tarzan >= 2 && autocvar_g_balance_grapplehook_pull_frozen); - dir = self.origin - myorg; + dir = this.origin - myorg; dist = vlen(dir); dir = normalize(dir); if(tarzan) { - v = v0 = WarpZone_RefSys_TransformVelocity(pull_entity, self, pull_entity.velocity); + v = v0 = WarpZone_RefSys_TransformVelocity(pull_entity, this, pull_entity.velocity); // first pull the rope... - if(self.realowner.hook_state & HOOK_PULLING) + if(this.realowner.hook_state & HOOK_PULLING) { - newlength = self.hook_length; + newlength = this.hook_length; newlength = max(newlength - pullspeed * frametime, minlength); if(newlength < dist - ropestretch) // overstretched? @@ -217,41 +217,41 @@ void GrapplingHookThink(entity this) v = v + frametime * dir * rubberforce_overstretch; } - self.hook_length = newlength; + this.hook_length = newlength; } if(pull_entity.movetype == MOVETYPE_FLY) pull_entity.movetype = MOVETYPE_WALK; - if(self.realowner.hook_state & HOOK_RELEASING) + if(this.realowner.hook_state & HOOK_RELEASING) { newlength = dist; - self.hook_length = newlength; + this.hook_length = newlength; } else { // then pull the player - spd = bound(0, (dist - self.hook_length) / ropestretch, 1); + spd = bound(0, (dist - this.hook_length) / ropestretch, 1); v = v * (1 - frametime * ropeairfriction); v = v + frametime * dir * spd * rubberforce; dv = ((v - v0) * dir) * dir; if(tarzan >= 2) { - if(self.aiment.movetype == MOVETYPE_WALK || self.aiment.classname == "nade") + if(this.aiment.movetype == MOVETYPE_WALK || this.aiment.classname == "nade") { - entity aim_ent = ((IS_VEHICLE(self.aiment) && self.aiment.owner) ? self.aiment.owner : self.aiment); + entity aim_ent = ((IS_VEHICLE(this.aiment) && this.aiment.owner) ? this.aiment.owner : this.aiment); v = v - dv * 0.5; - if((frozen_pulling && STAT(FROZEN, self.aiment)) || !frozen_pulling) + if((frozen_pulling && STAT(FROZEN, this.aiment)) || !frozen_pulling) { - self.aiment.velocity = self.aiment.velocity - dv * 0.5; - UNSET_ONGROUND(self.aiment); - if(self.aiment.flags & FL_PROJECTILE) - UpdateCSQCProjectile(self.aiment); + this.aiment.velocity = this.aiment.velocity - dv * 0.5; + UNSET_ONGROUND(this.aiment); + if(this.aiment.flags & FL_PROJECTILE) + UpdateCSQCProjectile(this.aiment); } - if(self.aiment.classname == "nade") - self.aiment.nextthink = time + autocvar_g_balance_grapplehook_nade_time; // set time after letting go? - aim_ent.pusher = self.realowner; + if(this.aiment.classname == "nade") + this.aiment.nextthink = time + autocvar_g_balance_grapplehook_nade_time; // set time after letting go? + aim_ent.pusher = this.realowner; aim_ent.pushltime = time + autocvar_g_maxpushtime; aim_ent.istypefrag = PHYS_INPUT_BUTTON_CHAT(aim_ent); } @@ -260,18 +260,18 @@ void GrapplingHookThink(entity this) UNSET_ONGROUND(pull_entity); } - if(!frozen_pulling && !(self.aiment.flags & FL_PROJECTILE)) - pull_entity.velocity = WarpZone_RefSys_TransformVelocity(self, pull_entity, v * velocity_multiplier); + if(!frozen_pulling && !(this.aiment.flags & FL_PROJECTILE)) + pull_entity.velocity = WarpZone_RefSys_TransformVelocity(this, pull_entity, v * velocity_multiplier); - if(frozen_pulling && autocvar_g_balance_grapplehook_pull_frozen == 2 && !STAT(FROZEN, self.aiment)) + if(frozen_pulling && autocvar_g_balance_grapplehook_pull_frozen == 2 && !STAT(FROZEN, this.aiment)) { - RemoveGrapplingHook(self.realowner); + RemoveGrapplingHook(this.realowner); return; } } else { - end = self.origin - dir*50; + end = this.origin - dir*50; dist = vlen(end - myorg); if(dist < 200) spd = dist * (pullspeed / 200); @@ -279,25 +279,25 @@ void GrapplingHookThink(entity this) spd = pullspeed; if(spd < 50) spd = 0; - self.realowner.velocity = dir*spd; - self.realowner.movetype = MOVETYPE_FLY; + this.realowner.velocity = dir*spd; + this.realowner.movetype = MOVETYPE_FLY; - UNSET_ONGROUND(self.realowner); + UNSET_ONGROUND(this.realowner); } } - makevectors(self.angles.x * '-1 0 0' + self.angles.y * '0 1 0'); - myorg = WarpZone_RefSys_TransformOrigin(self, self.realowner, self.origin); // + v_forward * (-9); + makevectors(this.angles.x * '-1 0 0' + this.angles.y * '0 1 0'); + myorg = WarpZone_RefSys_TransformOrigin(this, this.realowner, this.origin); // + v_forward * (-9); - if(myorg != self.hook_start) + if(myorg != this.hook_start) { - self.SendFlags |= 2; - self.hook_start = myorg; + this.SendFlags |= 2; + this.hook_start = myorg; } - if(org != self.hook_end) + if(org != this.hook_end) { - self.SendFlags |= 4; - self.hook_end = org; + this.SendFlags |= 4; + this.hook_end = org; } } @@ -312,11 +312,11 @@ void GrapplingHookTouch (entity this) if(other) if(other.movetype != MOVETYPE_NONE) { - SetMovetypeFollow(self, other); - WarpZone_RefSys_BeginAddingIncrementally(self, self.aiment); + SetMovetypeFollow(this, other); + WarpZone_RefSys_BeginAddingIncrementally(this, this.aiment); } - //self.realowner.disableclientprediction = true; + //this.realowner.disableclientprediction = true; } void GrapplingHook_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) diff --git a/qcsrc/server/g_lights.qc b/qcsrc/server/g_lights.qc index 796af16b1..9e2cd1156 100644 --- a/qcsrc/server/g_lights.qc +++ b/qcsrc/server/g_lights.qc @@ -36,50 +36,50 @@ flags: */ void dynlight_think(entity this) { - if(!self.owner) - remove(self); + if(!this.owner) + remove(this); - self.nextthink = time + 0.1; + this.nextthink = time + 0.1; } void dynlight_find_aiment(entity this) { entity targ; - if (!self.target) + if (!this.target) objerror ("dynlight: no target to follow"); - targ = find(world, targetname, self.target); - self.movetype = MOVETYPE_FOLLOW; - self.aiment = targ; - self.owner = targ; - self.punchangle = targ.angles; - self.view_ofs = self.origin - targ.origin; - self.v_angle = self.angles - targ.angles; - setthink(self, dynlight_think); - self.nextthink = time + 0.1; + targ = find(world, targetname, this.target); + this.movetype = MOVETYPE_FOLLOW; + this.aiment = targ; + this.owner = targ; + this.punchangle = targ.angles; + this.view_ofs = this.origin - targ.origin; + this.v_angle = this.angles - targ.angles; + setthink(this, dynlight_think); + this.nextthink = time + 0.1; } void dynlight_find_path(entity this) { entity targ; - if (!self.target) + if (!this.target) objerror ("dynlight: no target to follow"); - targ = find(world, targetname, self.target); - self.target = targ.target; - setorigin (self, targ.origin); - setthink(self, train_next); - self.nextthink = time + 0.1; + targ = find(world, targetname, this.target); + this.target = targ.target; + setorigin (this, targ.origin); + setthink(this, train_next); + this.nextthink = time + 0.1; } void dynlight_find_target(entity this) { entity targ; - if (!self.target) + if (!this.target) objerror ("dynlight: no target to follow"); - targ = find(world, targetname, self.target); - setattachment(self, targ, self.dtagname); - self.owner = targ; - setthink(self, dynlight_think); - self.nextthink = time + 0.1; + targ = find(world, targetname, this.target); + setattachment(this, targ, this.dtagname); + this.owner = targ; + setthink(this, dynlight_think); + this.nextthink = time + 0.1; } void dynlight_use(entity this, entity actor, entity trigger) { diff --git a/qcsrc/server/g_subs.qc b/qcsrc/server/g_subs.qc index 3fb232f02..b3b4d2eb0 100644 --- a/qcsrc/server/g_subs.qc +++ b/qcsrc/server/g_subs.qc @@ -414,12 +414,12 @@ void InitTrigger(entity this) { // trigger angles are used for one-way touches. An angle of 0 is assumed // to mean no restrictions, so use a yaw of 360 instead. - SetMovedir(self); - self.solid = SOLID_TRIGGER; + SetMovedir(this); + this.solid = SOLID_TRIGGER; SetBrushEntityModel(this); - self.movetype = MOVETYPE_NONE; - self.modelindex = 0; - self.model = ""; + this.movetype = MOVETYPE_NONE; + this.modelindex = 0; + this.model = ""; } void InitSolidBSPTrigger(entity this) diff --git a/qcsrc/server/g_subs.qh b/qcsrc/server/g_subs.qh index b18cc67b5..4f9fc471f 100644 --- a/qcsrc/server/g_subs.qh +++ b/qcsrc/server/g_subs.qh @@ -11,7 +11,7 @@ spawnfunc(info_null); ================== SUB_Friction -Applies some friction to self +Applies some friction to this ================== */ .float friction; @@ -41,8 +41,8 @@ void SUB_SetFade (entity ent, float when, float fadetime); ============= SUB_CalcMove -calculate self.velocity and self.nextthink to reach dest from -self.origin traveling at speed +calculate this.velocity and this.nextthink to reach dest from +this.origin traveling at speed =============== */ void SUB_CalcMoveDone(entity this); @@ -64,10 +64,10 @@ void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, ============= SUB_CalcAngleMove -calculate self.avelocity and self.nextthink to reach destangle from -self.angles rotating +calculate this.avelocity and this.nextthink to reach destangle from +this.angles rotating -The calling function should make sure self.think is valid +The calling function should make sure this.think is valid =============== */ void SUB_CalcAngleMoveDone (entity this); diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 0d3de4679..8e2f74c72 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -129,11 +129,11 @@ void GotoFirstMap(entity this) if(time < 5) { - self.nextthink = time; + this.nextthink = time; } else { - self.nextthink = time + 1; + this.nextthink = time + 1; LOG_INFO("Waiting for _sv_init being set to 1 by initialization scripts...\n"); } } @@ -548,7 +548,7 @@ spawnfunc(__init_dedicated_server) e = new(info_player_deathmatch); // safeguard against player joining - self.classname = "worldspawn"; // safeguard against various stuff ;) + this.classname = "worldspawn"; // safeguard against various stuff ;) // needs to be done so early because of the constants they create static_init(); @@ -739,7 +739,7 @@ spawnfunc(worldspawn) player_count = 0; bot_waypoints_for_items = autocvar_g_waypoints_for_items; if(bot_waypoints_for_items == 1) - if(self.spawnflags & SPAWNFLAG_NO_WAYPOINTS_FOR_ITEMS) + if(this.spawnflags & SPAWNFLAG_NO_WAYPOINTS_FOR_ITEMS) bot_waypoints_for_items = 0; precache(); @@ -922,7 +922,7 @@ spawnfunc(worldspawn) spawnfunc(light) { - //makestatic (self); // Who the f___ did that? + //makestatic (this); // Who the f___ did that? remove(this); } diff --git a/qcsrc/server/ipban.qc b/qcsrc/server/ipban.qc index 5de4c56a7..8cc375979 100644 --- a/qcsrc/server/ipban.qc +++ b/qcsrc/server/ipban.qc @@ -237,13 +237,13 @@ void OnlineBanList_Think(entity this) } if(autocvar_g_ban_sync_interval > 0) - self.nextthink = time + max(60, autocvar_g_ban_sync_interval * 60); + this.nextthink = time + max(60, autocvar_g_ban_sync_interval * 60); else goto killme; return; LABEL(killme) - remove(self); + remove(this); } const float BAN_MAX = 256; diff --git a/qcsrc/server/item_key.qc b/qcsrc/server/item_key.qc index cbc6f94f4..656eede4c 100644 --- a/qcsrc/server/item_key.qc +++ b/qcsrc/server/item_key.qc @@ -74,18 +74,18 @@ void item_key_touch(entity this) return; // player already picked up this key - if (other.itemkeys & self.itemkeys) + if (other.itemkeys & this.itemkeys) return; - other.itemkeys |= self.itemkeys; - play2(other, self.noise); + other.itemkeys |= this.itemkeys; + play2(other, this.noise); - centerprint(other, self.message); + centerprint(other, this.message); - string oldmsg = self.message; - self.message = ""; - SUB_UseTargets(self, other, other); // TODO: should we be using other for the trigger here? - self.message = oldmsg; + string oldmsg = this.message; + this.message = ""; + SUB_UseTargets(this, other, other); // TODO: should we be using other for the trigger here? + this.message = oldmsg; }; /** diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 1e2cd69ee..44c21610a 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -442,9 +442,9 @@ void GetCvars(entity this, int f) if (f > 0) { if (s == "cl_weaponpriority") - if (PS(self)) PS(self).m_switchweapon = w_getbestweapon(self); + if (PS(this)) PS(this).m_switchweapon = w_getbestweapon(this); if (s == "cl_allow_uidtracking") - PlayerStats_GameReport_AddPlayer(self); + PlayerStats_GameReport_AddPlayer(this); } } @@ -779,14 +779,14 @@ void precache() #if 0 // Disabled this code because it simply does not work (e.g. ignores bgmvolume, overlaps with "cd loop" controlled tracks). - if (!self.noise && self.music) // quake 3 uses the music field - self.noise = self.music; + if (!this.noise && this.music) // quake 3 uses the music field + this.noise = this.music; // plays music for the level if there is any - if (self.noise) + if (this.noise) { - precache_sound (self.noise); - ambientsound ('0 0 0', self.noise, VOL_BASE, ATTEN_NONE); + precache_sound (this.noise); + ambientsound ('0 0 0', this.noise, VOL_BASE, ATTEN_NONE); } #endif } @@ -825,7 +825,7 @@ void make_safe_for_remove(entity e) void objerror(string s) {SELFPARAM(); // needed for engine functions - make_safe_for_remove(self); + make_safe_for_remove(this); builtin_objerror(s); } diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index a7b3daca0..ec2176b33 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -98,7 +98,7 @@ MUTATOR_HOOKABLE(MatchEnd, EV_NO_ARGS); /**/ MUTATOR_HOOKABLE(GetTeamCount, EV_GetTeamCount); -/** copies variables for spectating "other" to "self" */ +/** copies variables for spectating "spectatee" to "this" */ #define EV_SpectateCopy(i, o) \ /** spectatee */ i(entity, MUTATOR_ARGV_0_entity) \ /** client */ i(entity, MUTATOR_ARGV_1_entity) \ @@ -157,7 +157,7 @@ MUTATOR_HOOKABLE(SetStartItems, EV_NO_ARGS); MUTATOR_HOOKABLE(CustomizeWaypoint, EV_CustomizeWaypoint); /** - * checks if the current item may be spawned (self.items and self.weapons may be read and written to, as well as the ammo_ fields) + * checks if the current item may be spawned (.items and .weapons may be read and written to, as well as the ammo_ fields) * return error to request removal */ #define EV_FilterItem(i, o) \ @@ -487,7 +487,7 @@ MUTATOR_HOOKABLE(PortalTeleport, EV_PortalTeleport); /** * called whenever a player uses impulse 33 (help me) in cl_impulse.qc - * normally help me ping uses self.waypointsprite_attachedforcarrier, + * normally help me ping uses .waypointsprite_attachedforcarrier, * but if your mutator uses something different then you can handle it * in a special manner using this hook */ diff --git a/qcsrc/server/mutators/mutator/gamemode_assault.qc b/qcsrc/server/mutators/mutator/gamemode_assault.qc index 7c32b077a..701ff1670 100644 --- a/qcsrc/server/mutators/mutator/gamemode_assault.qc +++ b/qcsrc/server/mutators/mutator/gamemode_assault.qc @@ -235,18 +235,18 @@ void assault_roundstart_use_this(entity this) void assault_wall_think(entity this) { - if(self.enemy.health < 0) + if(this.enemy.health < 0) { - self.model = ""; - self.solid = SOLID_NOT; + this.model = ""; + this.solid = SOLID_NOT; } else { - self.model = self.mdl; - self.solid = SOLID_BSP; + this.model = this.mdl; + this.solid = SOLID_BSP; } - self.nextthink = time + 0.2; + this.nextthink = time + 0.2; } // trigger new round diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qc b/qcsrc/server/mutators/mutator/gamemode_ctf.qc index fe63fa7e4..b827f10ea 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qc @@ -281,7 +281,7 @@ void ctf_CaptureShield_Update(entity player, bool wanted_status) bool ctf_CaptureShield_Customize(entity this) { if(!other.ctf_captureshielded) { return false; } - if(CTF_SAMETEAM(self, other)) { return false; } + if(CTF_SAMETEAM(this, other)) { return false; } return true; } @@ -289,12 +289,12 @@ bool ctf_CaptureShield_Customize(entity this) void ctf_CaptureShield_Touch(entity this) { if(!other.ctf_captureshielded) { return; } - if(CTF_SAMETEAM(self, other)) { return; } + if(CTF_SAMETEAM(this, other)) { return; } - vector mymid = (self.absmin + self.absmax) * 0.5; + vector mymid = (this.absmin + this.absmax) * 0.5; vector othermid = (other.absmin + other.absmax) * 0.5; - Damage(other, self, self, 0, DEATH_HURTTRIGGER.m_id, mymid, normalize(othermid - mymid) * ctf_captureshield_force); + 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); } } @@ -752,7 +752,7 @@ bool ctf_Stalemate_Customize(entity this) // make spectators see what the player would see entity e, wp_owner; e = WaypointSprite_getviewentity(other); - wp_owner = self.owner; + wp_owner = this.owner; // team waypoints if(CTF_SAMETEAM(wp_owner.flagcarried, wp_owner)) { return false; } @@ -856,24 +856,24 @@ void ctf_FlagThink(entity this) // declarations entity tmp_entity; - self.nextthink = time + FLAG_THINKRATE; // only 5 fps, more is unnecessary. + this.nextthink = time + FLAG_THINKRATE; // only 5 fps, more is unnecessary. // captureshield - if(self == ctf_worldflaglist) // only for the first flag + if(this == ctf_worldflaglist) // only for the first flag FOREACH_CLIENT(true, LAMBDA(ctf_CaptureShield_Update(it, 1))); // release shield only // sanity checks - if(self.mins != CTF_FLAG.m_mins || self.maxs != CTF_FLAG.m_maxs) { // reset the flag boundaries in case it got squished + if(this.mins != CTF_FLAG.m_mins || this.maxs != CTF_FLAG.m_maxs) { // reset the flag boundaries in case it got squished LOG_TRACE("wtf the flag got squashed?\n"); - tracebox(self.origin, CTF_FLAG.m_mins, CTF_FLAG.m_maxs, self.origin, MOVE_NOMONSTERS, self); - if(!trace_startsolid || self.noalign) // can we resize it without getting stuck? - setsize(self, CTF_FLAG.m_mins, CTF_FLAG.m_maxs); } + tracebox(this.origin, CTF_FLAG.m_mins, CTF_FLAG.m_maxs, this.origin, MOVE_NOMONSTERS, this); + if(!trace_startsolid || this.noalign) // can we resize it without getting stuck? + setsize(this, CTF_FLAG.m_mins, CTF_FLAG.m_maxs); } - switch(self.ctf_status) // reset flag angles in case warpzones adjust it + switch(this.ctf_status) // reset flag angles in case warpzones adjust it { case FLAG_DROPPED: { - self.angles = '0 0 0'; + this.angles = '0 0 0'; break; } @@ -881,7 +881,7 @@ void ctf_FlagThink(entity this) } // main think method - switch(self.ctf_status) + switch(this.ctf_status) { case FLAG_BASE: { @@ -889,9 +889,9 @@ void ctf_FlagThink(entity this) { for(tmp_entity = ctf_worldflaglist; tmp_entity; tmp_entity = tmp_entity.ctf_worldflagnext) if(tmp_entity.ctf_status == FLAG_DROPPED) - if(vlen(self.origin - tmp_entity.origin) < autocvar_g_ctf_dropped_capture_radius) + if(vdist(this.origin - tmp_entity.origin, <, autocvar_g_ctf_dropped_capture_radius)) if(time > tmp_entity.ctf_droptime + autocvar_g_ctf_dropped_capture_delay) - ctf_Handle_Capture(self, tmp_entity, CAPTURE_DROPPED); + ctf_Handle_Capture(this, tmp_entity, CAPTURE_DROPPED); } return; } @@ -900,37 +900,37 @@ void ctf_FlagThink(entity this) { if(autocvar_g_ctf_flag_dropped_floatinwater) { - vector midpoint = ((self.absmin + self.absmax) * 0.5); + vector midpoint = ((this.absmin + this.absmax) * 0.5); if(pointcontents(midpoint) == CONTENT_WATER) { - self.velocity = self.velocity * 0.5; + this.velocity = this.velocity * 0.5; if(pointcontents(midpoint + FLAG_FLOAT_OFFSET) == CONTENT_WATER) - { self.velocity_z = autocvar_g_ctf_flag_dropped_floatinwater; } + { this.velocity_z = autocvar_g_ctf_flag_dropped_floatinwater; } else - { self.movetype = MOVETYPE_FLY; } + { this.movetype = MOVETYPE_FLY; } } - else if(self.movetype == MOVETYPE_FLY) { self.movetype = MOVETYPE_TOSS; } + else if(this.movetype == MOVETYPE_FLY) { this.movetype = MOVETYPE_TOSS; } } if(autocvar_g_ctf_flag_return_dropped) { - if((vlen(self.origin - self.ctf_spawnorigin) <= autocvar_g_ctf_flag_return_dropped) || (autocvar_g_ctf_flag_return_dropped == -1)) + if((vdist(this.origin - this.ctf_spawnorigin, <=, autocvar_g_ctf_flag_return_dropped)) || (autocvar_g_ctf_flag_return_dropped == -1)) { - self.health = 0; - ctf_CheckFlagReturn(self, RETURN_DROPPED); + this.health = 0; + ctf_CheckFlagReturn(this, RETURN_DROPPED); return; } } - if(self.ctf_flagdamaged) + if(this.ctf_flagdamaged) { - self.health -= ((self.max_flag_health / autocvar_g_ctf_flag_return_damage_delay) * FLAG_THINKRATE); - ctf_CheckFlagReturn(self, RETURN_NEEDKILL); + this.health -= ((this.max_flag_health / autocvar_g_ctf_flag_return_damage_delay) * FLAG_THINKRATE); + ctf_CheckFlagReturn(this, RETURN_NEEDKILL); return; } else if(autocvar_g_ctf_flag_return_time) { - self.health -= ((self.max_flag_health / autocvar_g_ctf_flag_return_time) * FLAG_THINKRATE); - ctf_CheckFlagReturn(self, RETURN_TIMEOUT); + this.health -= ((this.max_flag_health / autocvar_g_ctf_flag_return_time) * FLAG_THINKRATE); + ctf_CheckFlagReturn(this, RETURN_TIMEOUT); return; } return; @@ -938,13 +938,13 @@ void ctf_FlagThink(entity this) case FLAG_CARRY: { - if(self.speedrunning && ctf_captimerecord && (time >= self.ctf_pickuptime + ctf_captimerecord)) + if(this.speedrunning && ctf_captimerecord && (time >= this.ctf_pickuptime + ctf_captimerecord)) { - self.health = 0; - ctf_CheckFlagReturn(self, RETURN_SPEEDRUN); + this.health = 0; + ctf_CheckFlagReturn(this, RETURN_SPEEDRUN); - self.owner.impulse = CHIMPULSE_SPEEDRUN.impulse; // move the player back to the waypoint they set - ImpulseCommands(self.owner); + this.owner.impulse = CHIMPULSE_SPEEDRUN.impulse; // move the player back to the waypoint they set + ImpulseCommands(this.owner); } if(autocvar_g_ctf_stalemate) { @@ -954,36 +954,36 @@ void ctf_FlagThink(entity this) wpforenemy_nextthink = time + WPFE_THINKRATE; // waypoint for enemy think rate (to reduce unnecessary spam of this check) } } - if(CTF_SAMETEAM(self, self.owner) && self.team) + if(CTF_SAMETEAM(this, this.owner) && this.team) { if(autocvar_g_ctf_flag_return) // drop the flag if reverse status has changed - ctf_Handle_Throw(self.owner, world, DROP_THROW); - else if(vlen(self.owner.origin - self.ctf_spawnorigin) <= autocvar_g_ctf_flag_return_carried_radius) - ctf_Handle_Return(self, self.owner); + ctf_Handle_Throw(this.owner, world, DROP_THROW); + else if(vdist(this.owner.origin - this.ctf_spawnorigin, <=, autocvar_g_ctf_flag_return_carried_radius)) + ctf_Handle_Return(this, this.owner); } return; } case FLAG_PASSING: { - vector targ_origin = ((self.pass_target.absmin + self.pass_target.absmax) * 0.5); - targ_origin = WarpZone_RefSys_TransformOrigin(self.pass_target, self, targ_origin); // origin of target as seen by the flag (us) - WarpZone_TraceLine(self.origin, targ_origin, MOVE_NOMONSTERS, self); - - if((self.pass_target == world) - || (IS_DEAD(self.pass_target)) - || (self.pass_target.flagcarried) - || (vlen(self.origin - targ_origin) > autocvar_g_ctf_pass_radius) - || ((trace_fraction < 1) && (trace_ent != self.pass_target)) - || (time > self.ctf_droptime + autocvar_g_ctf_pass_timelimit)) + vector targ_origin = ((this.pass_target.absmin + this.pass_target.absmax) * 0.5); + targ_origin = WarpZone_RefSys_TransformOrigin(this.pass_target, this, targ_origin); // origin of target as seen by the flag (us) + WarpZone_TraceLine(this.origin, targ_origin, MOVE_NOMONSTERS, this); + + if((this.pass_target == world) + || (IS_DEAD(this.pass_target)) + || (this.pass_target.flagcarried) + || (vdist(this.origin - targ_origin, <, autocvar_g_ctf_pass_radius)) + || ((trace_fraction < 1) && (trace_ent != this.pass_target)) + || (time > this.ctf_droptime + autocvar_g_ctf_pass_timelimit)) { // give up, pass failed - ctf_Handle_Drop(self, world, DROP_PASS); + ctf_Handle_Drop(this, world, DROP_PASS); } else { // still a viable target, go for it - ctf_CalculatePassVelocity(self, targ_origin, self.origin, true); + ctf_CalculatePassVelocity(this, targ_origin, this.origin, true); } return; } @@ -1370,7 +1370,7 @@ int havocbot_ctf_teamcount(entity bot, vector org, float tc_radius) if(DIFF_TEAM(it, bot) || IS_DEAD(it) || it == bot) continue; - if(vlen(it.origin - org) < tc_radius) + if(vdist(it.origin - org, <, tc_radius)) ++c; )); @@ -1477,11 +1477,11 @@ void havocbot_goalrating_ctf_droppedflags(entity this, float ratingscale, vector { if(df_radius) { - if(vlen(org-head.origin)vlen(this.origin-pos)) + if(vlen2(this.origin-ef.dropped_origin)>vlen2(this.origin-pos)) { havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_RETRIEVER); return; @@ -1719,7 +1719,7 @@ void havocbot_role_ctf_offense(entity this) else pos = ef.origin; - if(vlen(pos-mf.dropped_origin)>700) + if(vdist(pos - mf.dropped_origin, >, 700)) { havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_ESCORT); return; @@ -1912,7 +1912,7 @@ void havocbot_role_ctf_defense(entity this) if(closestplayer) if(DIFF_TEAM(closestplayer, this)) - if(vlen(org - this.origin)>1000) + if(vdist(org - this.origin, >, 1000)) if(checkpvs(this.origin,closestplayer)||random()<0.5) havocbot_goalrating_ctf_ourbase(this, 30000); @@ -2168,7 +2168,7 @@ MUTATOR_HOOKFUNCTION(ctf, PlayerUseKey) if(closest_target) { vector closest_target_center = WarpZone_UnTransformOrigin(closest_target, CENTER_OR_VIEWOFS(closest_target)); - if(vlen(passer_center - head_center) < vlen(passer_center - closest_target_center)) + if(vlen2(passer_center - head_center) < vlen2(passer_center - closest_target_center)) { closest_target = head; } } else { closest_target = head; } diff --git a/qcsrc/server/mutators/mutator/gamemode_keepaway.qc b/qcsrc/server/mutators/mutator/gamemode_keepaway.qc index 3a6a77df5..3264c7b2c 100644 --- a/qcsrc/server/mutators/mutator/gamemode_keepaway.qc +++ b/qcsrc/server/mutators/mutator/gamemode_keepaway.qc @@ -86,78 +86,78 @@ void ka_RespawnBall(entity this); void ka_RespawnBall(entity this) // runs whenever the ball needs to be relocated { if(gameover) { return; } - vector oldballorigin = self.origin; + vector oldballorigin = this.origin; - if(!MoveToRandomMapLocation(self, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, 10, 1024, 256)) + if(!MoveToRandomMapLocation(this, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, 10, 1024, 256)) { entity spot = SelectSpawnPoint(this, true); - setorigin(self, spot.origin); - self.angles = spot.angles; + setorigin(this, spot.origin); + this.angles = spot.angles; } - makevectors(self.angles); - self.movetype = MOVETYPE_BOUNCE; - self.velocity = '0 0 200'; - self.angles = '0 0 0'; - self.effects = autocvar_g_keepawayball_effects; - settouch(self, ka_TouchEvent); - setthink(self, ka_RespawnBall); - self.nextthink = time + autocvar_g_keepawayball_respawntime; + makevectors(this.angles); + this.movetype = MOVETYPE_BOUNCE; + this.velocity = '0 0 200'; + this.angles = '0 0 0'; + this.effects = autocvar_g_keepawayball_effects; + settouch(this, ka_TouchEvent); + setthink(this, ka_RespawnBall); + this.nextthink = time + autocvar_g_keepawayball_respawntime; Send_Effect(EFFECT_ELECTRO_COMBO, oldballorigin, '0 0 0', 1); - Send_Effect(EFFECT_ELECTRO_COMBO, self.origin, '0 0 0', 1); + Send_Effect(EFFECT_ELECTRO_COMBO, this.origin, '0 0 0', 1); - WaypointSprite_Spawn(WP_KaBall, 0, 0, self, '0 0 64', world, self.team, self, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER); - WaypointSprite_Ping(self.waypointsprite_attachedforcarrier); + WaypointSprite_Spawn(WP_KaBall, 0, 0, this, '0 0 64', world, this.team, this, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER); + WaypointSprite_Ping(this.waypointsprite_attachedforcarrier); - sound(self, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere) + sound(this, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere) } void ka_TimeScoring(entity this) { - if(self.owner.ballcarried) + if(this.owner.ballcarried) { // add points for holding the ball after a certain amount of time if(autocvar_g_keepaway_score_timepoints) - PlayerScore_Add(self.owner, SP_SCORE, autocvar_g_keepaway_score_timepoints); + PlayerScore_Add(this.owner, SP_SCORE, autocvar_g_keepaway_score_timepoints); - PlayerScore_Add(self.owner, SP_KEEPAWAY_BCTIME, (autocvar_g_keepaway_score_timeinterval / 1)); // interval is divided by 1 so that time always shows "seconds" - self.nextthink = time + autocvar_g_keepaway_score_timeinterval; + PlayerScore_Add(this.owner, SP_KEEPAWAY_BCTIME, (autocvar_g_keepaway_score_timeinterval / 1)); // interval is divided by 1 so that time always shows "seconds" + this.nextthink = time + autocvar_g_keepaway_score_timeinterval; } } void ka_TouchEvent(entity this) // runs any time that the ball comes in contact with something { if(gameover) { return; } - if(!self) { return; } + if(!this) { return; } if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) { // The ball fell off the map, respawn it since players can't get to it - ka_RespawnBall(self); + ka_RespawnBall(this); return; } if(IS_DEAD(other)) { return; } if(STAT(FROZEN, other)) { return; } if (!IS_PLAYER(other)) { // The ball just touched an object, most likely the world - Send_Effect(EFFECT_BALL_SPARKS, self.origin, '0 0 0', 1); - sound(self, CH_TRIGGER, SND_KA_TOUCH, VOL_BASE, ATTEN_NORM); + Send_Effect(EFFECT_BALL_SPARKS, this.origin, '0 0 0', 1); + sound(this, CH_TRIGGER, SND_KA_TOUCH, VOL_BASE, ATTEN_NORM); return; } - else if(self.wait > time) { return; } + else if(this.wait > time) { return; } // attach the ball to the player - self.owner = other; - other.ballcarried = self; - setattachment(self, other, ""); - setorigin(self, '0 0 0'); + this.owner = other; + other.ballcarried = this; + setattachment(this, other, ""); + setorigin(this, '0 0 0'); // make the ball invisible/unable to do anything/set up time scoring - self.velocity = '0 0 0'; - self.movetype = MOVETYPE_NONE; - self.effects |= EF_NODRAW; - settouch(self, func_null); - setthink(self, ka_TimeScoring); - self.nextthink = time + autocvar_g_keepaway_score_timeinterval; - self.takedamage = DAMAGE_NO; + this.velocity = '0 0 0'; + this.movetype = MOVETYPE_NONE; + this.effects |= EF_NODRAW; + settouch(this, func_null); + setthink(this, ka_TimeScoring); + this.nextthink = time + autocvar_g_keepaway_score_timeinterval; + this.takedamage = DAMAGE_NO; // apply effects to player other.glow_color = autocvar_g_keepawayball_trail_color; @@ -169,7 +169,7 @@ void ka_TouchEvent(entity this) // runs any time that the ball comes in contact Send_Notification(NOTIF_ALL, world, 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); - sound(self.owner, CH_TRIGGER, SND_KA_PICKEDUP, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere) + 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); @@ -179,7 +179,7 @@ void ka_TouchEvent(entity this) // runs any time that the ball comes in contact 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_Kill(self.waypointsprite_attachedforcarrier); + WaypointSprite_Kill(this.waypointsprite_attachedforcarrier); } void ka_DropEvent(entity plyr) // runs any time that a player is supposed to lose the ball diff --git a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc index 30653641f..6bb53b7c5 100644 --- a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc @@ -219,14 +219,14 @@ void kh_Controller_Think(entity this) // called a lot { if(intermission_running) return; - if(self.cnt > 0) - { if(getthink(self) != kh_WaitForPlayers) { self.cnt -= 1; } } - else if(self.cnt == 0) + if(this.cnt > 0) + { if(getthink(this) != kh_WaitForPlayers) { this.cnt -= 1; } } + else if(this.cnt == 0) { - self.cnt -= 1; + this.cnt -= 1; kh_Controller_Thinkfunc(); } - self.nextthink = time + 1; + this.nextthink = time + 1; } // frags f: take from cvar * f @@ -510,7 +510,7 @@ void kh_Key_Touch(entity this) // runs many, many times when a key has been dro if(intermission_running) return; - if(self.owner) // already carried + if(this.owner) // already carried return; if(ITEM_TOUCH_NEEDKILL()) @@ -525,10 +525,10 @@ void kh_Key_Touch(entity this) // runs many, many times when a key has been dro return; if(IS_DEAD(other)) return; - if(other == self.enemy) - if(time < self.kh_droptime + autocvar_g_balance_keyhunt_delay_collect) + if(other == this.enemy) + if(time < this.kh_droptime + autocvar_g_balance_keyhunt_delay_collect) return; // you just dropped it! - kh_Key_Collect(self, other); + kh_Key_Collect(this, other); } 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 @@ -731,35 +731,35 @@ void kh_Key_Think(entity this) // runs all the time if(intermission_running) return; - if(self.owner) + if(this.owner) { #ifndef KH_PLAYER_USE_ATTACHMENT - makevectors('0 1 0' * (self.cnt + (time % 360) * KH_KEY_XYSPEED)); - setorigin(self, v_forward * KH_KEY_XYDIST + '0 0 1' * self.origin.z); + makevectors('0 1 0' * (this.cnt + (time % 360) * KH_KEY_XYSPEED)); + setorigin(this, v_forward * KH_KEY_XYDIST + '0 0 1' * this.origin.z); #endif } // if in nodrop or time over, end the round - if(!self.owner) - if(time > self.pain_finished) - kh_LoserTeam(self.team, self); + if(!this.owner) + if(time > this.pain_finished) + kh_LoserTeam(this.team, this); - if(self.owner) + if(this.owner) if(kh_Key_AllOwnedByWhichTeam() != -1) { - if(self.siren_time < time) + if(this.siren_time < time) { - sound(self.owner, CH_TRIGGER, SND_KH_ALARM, VOL_BASE, ATTEN_NORM); // play a simple alarm - self.siren_time = time + 2.5; // repeat every 2.5 seconds + sound(this.owner, CH_TRIGGER, SND_KH_ALARM, VOL_BASE, ATTEN_NORM); // play a simple alarm + this.siren_time = time + 2.5; // repeat every 2.5 seconds } entity key; vector p; - p = self.owner.origin; + p = this.owner.origin; FOR_EACH_KH_KEY(key) - if(vlen(key.owner.origin - p) > autocvar_g_balance_keyhunt_maxdist) + if(vdist(key.owner.origin - p, >, autocvar_g_balance_keyhunt_maxdist)) goto not_winning; - kh_WinnerTeam(self.team); + kh_WinnerTeam(this.team); LABEL(not_winning) } @@ -777,7 +777,7 @@ LABEL(not_winning) )); } - self.nextthink = time + 0.05; + this.nextthink = time + 0.05; } void key_reset(entity this) diff --git a/qcsrc/server/pathlib/debug.qc b/qcsrc/server/pathlib/debug.qc index 09b81724e..bd1295172 100644 --- a/qcsrc/server/pathlib/debug.qc +++ b/qcsrc/server/pathlib/debug.qc @@ -32,17 +32,17 @@ void path_dbg_think(entity this) void __showpath2_think(entity this) { #ifdef TURRET_DEBUG - mark_info(self.origin,1); + mark_info(this.origin,1); #endif - if(self.path_next) + if(this.path_next) { - setthink(self.path_next, __showpath2_think); - self.path_next.nextthink = time + 0.15; + setthink(this.path_next, __showpath2_think); + this.path_next.nextthink = time + 0.15; } else { - setthink(self.owner, __showpath2_think); - self.owner.nextthink = time + 0.15; + setthink(this.owner, __showpath2_think); + this.owner.nextthink = time + 0.15; } } diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index 6fc5cf712..f729137a6 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -457,17 +457,17 @@ void race_SendTime(entity e, float cp, float t, float tvalid) } else // RACE! Not Qualifying { - float lself, lother, othtime; + float mylaps, lother, othtime; entity oth; oth = race_checkpoint_lastplayers[cp]; if(oth) { - lself = PlayerScore_Add(e, SP_RACE_LAPS, 0); + mylaps = PlayerScore_Add(e, SP_RACE_LAPS, 0); lother = race_checkpoint_lastlaps[cp]; othtime = race_checkpoint_lasttimes[cp]; } else - lself = lother = othtime = 0; + mylaps = lother = othtime = 0; if(IS_REAL_CLIENT(e)) { @@ -485,7 +485,7 @@ void race_SendTime(entity e, float cp, float t, float tvalid) else { WriteInt24_t(MSG_ONE, TIME_ENCODE(time - race_checkpoint_lasttimes[cp])); - WriteByte(MSG_ONE, lself - lother); + WriteByte(MSG_ONE, mylaps - lother); WriteString(MSG_ONE, oth.netname); // record holder } }); @@ -493,7 +493,7 @@ void race_SendTime(entity e, float cp, float t, float tvalid) race_checkpoint_lastplayers[cp] = e; race_checkpoint_lasttimes[cp] = time; - race_checkpoint_lastlaps[cp] = lself; + race_checkpoint_lastlaps[cp] = mylaps; if(IS_REAL_CLIENT(oth)) { @@ -511,7 +511,7 @@ void race_SendTime(entity e, float cp, float t, float tvalid) else { WriteInt24_t(MSG_ONE, TIME_ENCODE(time - othtime)); - WriteByte(MSG_ONE, lother - lself); + WriteByte(MSG_ONE, lother - mylaps); WriteString(MSG_ONE, e.netname); // record holder } }); diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 12b2e7daa..c2bccef95 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -68,7 +68,7 @@ void CL_Weaponentity_Think(entity this) .entity weaponentity = this.weaponentity_fld; if (this.owner.(weaponentity) != this) { - // owner has new gun; remove self + // owner has new gun; remove old one if (this.weaponchild) remove(this.weaponchild); remove(this); return; -- 2.39.2