From fd20a1f1eae2b2ba955ce9ddedc20cd151a6f362 Mon Sep 17 00:00:00 2001 From: TimePath Date: Sat, 28 May 2016 19:58:43 +1000 Subject: [PATCH] Remove weapon SELFPARAM --- qcsrc/common/effects/qc/damageeffects.qc | 2 +- .../gamemodes/gamemode/nexball/nexball.qc | 6 +- qcsrc/common/mutators/mutator/nix/nix.qc | 2 +- qcsrc/common/mutators/mutator/overkill/hmg.qc | 10 +-- qcsrc/common/mutators/mutator/overkill/rpc.qc | 8 +-- .../turrets/turret/machinegun_weapon.qc | 4 +- qcsrc/common/weapons/weapon.qh | 16 ++--- qcsrc/common/weapons/weapon/arc.qc | 42 +++++------ qcsrc/common/weapons/weapon/blaster.qc | 12 ++-- qcsrc/common/weapons/weapon/crylink.qc | 23 +++--- qcsrc/common/weapons/weapon/devastator.qc | 52 +++++++------- qcsrc/common/weapons/weapon/electro.qc | 41 ++++++----- qcsrc/common/weapons/weapon/fireball.qc | 54 +++++++------- qcsrc/common/weapons/weapon/hagar.qc | 70 +++++++++---------- qcsrc/common/weapons/weapon/hlac.qc | 31 ++++---- qcsrc/common/weapons/weapon/hook.qc | 12 ++-- qcsrc/common/weapons/weapon/machinegun.qc | 31 ++++---- qcsrc/common/weapons/weapon/minelayer.qc | 46 ++++++------ qcsrc/common/weapons/weapon/mortar.qc | 39 +++++------ qcsrc/common/weapons/weapon/porto.qc | 54 +++++++------- qcsrc/common/weapons/weapon/rifle.qc | 41 ++++++----- qcsrc/common/weapons/weapon/seeker.qc | 53 ++++++-------- qcsrc/common/weapons/weapon/shockwave.qc | 25 +++---- qcsrc/common/weapons/weapon/shotgun.qc | 27 ++++--- qcsrc/common/weapons/weapon/tuba.qc | 14 ++-- qcsrc/common/weapons/weapon/vaporizer.qc | 49 +++++++------ qcsrc/common/weapons/weapon/vortex.qc | 28 ++++---- qcsrc/server/bot/havocbot/havocbot.qc | 2 +- qcsrc/server/cl_client.qc | 2 +- qcsrc/server/cl_player.qc | 4 +- qcsrc/server/race.qc | 4 +- qcsrc/server/weapons/weaponsystem.qc | 8 +-- qcsrc/server/weapons/weaponsystem.qh | 2 +- 33 files changed, 395 insertions(+), 419 deletions(-) diff --git a/qcsrc/common/effects/qc/damageeffects.qc b/qcsrc/common/effects/qc/damageeffects.qc index 3d67392899..30a0a0c9e5 100644 --- a/qcsrc/common/effects/qc/damageeffects.qc +++ b/qcsrc/common/effects/qc/damageeffects.qc @@ -418,7 +418,7 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew) if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)) { if(!MUTATOR_CALLHOOK(Weapon_ImpactEffect, hitwep)) - hitwep.wr_impacteffect(hitwep); + hitwep.wr_impacteffect(hitwep, this); } } } diff --git a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc index 5063071d63..afa6db93f0 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc @@ -184,7 +184,7 @@ void GiveBall(entity plyr, entity ball) plyr.(weaponentity).m_switchweapon = PS(plyr).m_weapon; plyr.weapons = WEPSET(NEXBALL); Weapon w = WEP_NEXBALL; - WITHSELF(plyr, w.wr_resetplayer(w)); + WITHSELF(plyr, w.wr_resetplayer(w, plyr)); PS(plyr).m_switchweapon = WEP_NEXBALL; WITHSELF(plyr, W_SwitchWeapon(plyr, WEP_NEXBALL)); } @@ -886,7 +886,7 @@ METHOD(BallStealer, wr_think, void(BallStealer thiswep, entity actor, .entity we } } -METHOD(BallStealer, wr_setup, void(BallStealer this)) +METHOD(BallStealer, wr_setup, void(BallStealer this, entity actor)) { TC(BallStealer, this); //weapon_setup(WEP_PORTO.m_id); @@ -980,7 +980,7 @@ MUTATOR_HOOKFUNCTION(nb, PlayerPreThink) { self.weapons = self.(weaponentity).weapons; Weapon w = WEP_NEXBALL; - w.wr_resetplayer(w); + w.wr_resetplayer(w, self); PS(self).m_switchweapon = self.(weaponentity).m_switchweapon; W_SwitchWeapon(self, PS(self).m_switchweapon); diff --git a/qcsrc/common/mutators/mutator/nix/nix.qc b/qcsrc/common/mutators/mutator/nix/nix.qc index 0c18993db0..e51003204c 100644 --- a/qcsrc/common/mutators/mutator/nix/nix.qc +++ b/qcsrc/common/mutators/mutator/nix/nix.qc @@ -160,7 +160,7 @@ void NIX_GiveCurrentWeapon() else Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_NIX_NEWWEAPON, nix_weapon); - e.wr_resetplayer(e); + e.wr_resetplayer(e, self); // all weapons must be fully loaded when we spawn if(e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars diff --git a/qcsrc/common/mutators/mutator/overkill/hmg.qc b/qcsrc/common/mutators/mutator/overkill/hmg.qc index ee4c85635e..419123e104 100644 --- a/qcsrc/common/mutators/mutator/overkill/hmg.qc +++ b/qcsrc/common/mutators/mutator/overkill/hmg.qc @@ -89,7 +89,7 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); - W_MachineGun_MuzzleFlash(); + W_MachineGun_MuzzleFlash(actor); W_AttachToShotorg(actor, actor.muzzle_flash, '5 0 0'); if (autocvar_g_casings >= 2) // casing code @@ -100,9 +100,9 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(hmg, refire), W_HeavyMachineGun_Attack_Auto); } -METHOD(HeavyMachineGun, wr_aim, void(entity thiswep)) +METHOD(HeavyMachineGun, wr_aim, void(entity thiswep, entity actor)) { - SELFPARAM(); + 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); else @@ -166,9 +166,9 @@ METHOD(HeavyMachineGun, wr_killmessage, Notification(entity thiswep)) #endif #ifdef CSQC -METHOD(HeavyMachineGun, wr_impacteffect, void(entity thiswep)) +METHOD(HeavyMachineGun, wr_impacteffect, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; vector org2; org2 = w_org + w_backoff * 2; pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1); diff --git a/qcsrc/common/mutators/mutator/overkill/rpc.qc b/qcsrc/common/mutators/mutator/overkill/rpc.qc index 860e37bcca..1458172720 100644 --- a/qcsrc/common/mutators/mutator/overkill/rpc.qc +++ b/qcsrc/common/mutators/mutator/overkill/rpc.qc @@ -150,9 +150,9 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep) MUTATOR_CALLHOOK(EditProjectile, self, missile); } -METHOD(RocketPropelledChainsaw, wr_aim, void(entity thiswep)) +METHOD(RocketPropelledChainsaw, wr_aim, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false); } @@ -218,9 +218,9 @@ METHOD(RocketPropelledChainsaw, wr_killmessage, Notification(entity thiswep)) #ifdef CSQC -METHOD(RocketPropelledChainsaw, wr_impacteffect, void(entity thiswep)) +METHOD(RocketPropelledChainsaw, wr_impacteffect, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; vector org2; org2 = w_org + w_backoff * 12; pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1); diff --git a/qcsrc/common/turrets/turret/machinegun_weapon.qc b/qcsrc/common/turrets/turret/machinegun_weapon.qc index 853750f6ca..34cd32d742 100644 --- a/qcsrc/common/turrets/turret/machinegun_weapon.qc +++ b/qcsrc/common/turrets/turret/machinegun_weapon.qc @@ -4,7 +4,7 @@ #ifdef SVQC -void W_MachineGun_MuzzleFlash(); +void W_MachineGun_MuzzleFlash(entity actor); SOUND(MachineGunTurretAttack_FIRE, W_Sound("electro_fire")); METHOD(MachineGunTurretAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { @@ -20,7 +20,7 @@ METHOD(MachineGunTurretAttack, wr_think, void(entity thiswep, entity actor, .ent weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready); } fireBullet (actor, actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_MACHINEGUN.m_id, 0); - W_MachineGun_MuzzleFlash(); + W_MachineGun_MuzzleFlash(actor); setattachment(actor.muzzle_flash, actor.tur_head, "tag_fire"); } } diff --git a/qcsrc/common/weapons/weapon.qh b/qcsrc/common/weapons/weapon.qh index c76a88399d..99ff42367f 100644 --- a/qcsrc/common/weapons/weapon.qh +++ b/qcsrc/common/weapons/weapon.qh @@ -85,7 +85,7 @@ CLASS(Weapon, Object) ATTRIB(Weapon, m_pickup, entity, NULL); /** (SERVER) setup weapon data */ - METHOD(Weapon, wr_setup, void(Weapon this)) {} + METHOD(Weapon, wr_setup, void(Weapon this, entity actor)) {} /** (SERVER) logic to run every frame */ METHOD(Weapon, wr_think, void(Weapon this, entity actor, .entity weaponentity, int fire)) {} /** (SERVER) checks ammo for weapon primary */ @@ -93,7 +93,7 @@ CLASS(Weapon, Object) /** (SERVER) checks ammo for weapon second */ METHOD(Weapon, wr_checkammo2, bool(Weapon this, entity actor)) {return false;} /** (SERVER) runs bot aiming code for this weapon */ - METHOD(Weapon, wr_aim, void(Weapon this)) {} + METHOD(Weapon, wr_aim, void(Weapon this, entity actor)) {} /** (BOTH) precaches models/sounds used by this weapon, also sets up weapon properties */ METHOD(Weapon, wr_init, void(Weapon this)) {} /** (SERVER) notification number for suicide message (may inspect w_deathtype for details) */ @@ -103,13 +103,13 @@ CLASS(Weapon, Object) /** (SERVER) handles reloading for weapon */ METHOD(Weapon, wr_reload, void(Weapon this, entity actor, .entity weaponentity)) {} /** (SERVER) clears fields that the weapon may use */ - METHOD(Weapon, wr_resetplayer, void(Weapon this)) {} + METHOD(Weapon, wr_resetplayer, void(Weapon this, entity actor)) {} /** (CLIENT) impact effect for weapon explosion */ - METHOD(Weapon, wr_impacteffect, void(Weapon this)) {} + METHOD(Weapon, wr_impacteffect, void(Weapon this, entity actor)) {} /** (SERVER) called whenever a player dies */ - METHOD(Weapon, wr_playerdeath, void(Weapon this)) {} + METHOD(Weapon, wr_playerdeath, void(Weapon this, entity actor)) {} /** (SERVER) logic to run when weapon is lost */ - METHOD(Weapon, wr_gonethink, void(Weapon this)) {} + METHOD(Weapon, wr_gonethink, void(Weapon this, entity actor)) {} /** (ALL) dump weapon cvars to config in data directory (see: sv_cmd dumpweapons) */ METHOD(Weapon, wr_config, void(Weapon this)) {} /** (CLIENT) weapon specific zoom reticle */ @@ -120,9 +120,9 @@ CLASS(Weapon, Object) /** (CLIENT) weapon specific glow */ METHOD(Weapon, wr_glow, vector(Weapon this)) { return '0 0 0'; } /** (SERVER) the weapon is dropped */ - METHOD(Weapon, wr_drop, void(Weapon this)) {} + METHOD(Weapon, wr_drop, void(Weapon this, entity actor)) {} /** (SERVER) a weapon is picked up */ - METHOD(Weapon, wr_pickup, void(Weapon this)) {} + METHOD(Weapon, wr_pickup, void(Weapon this, entity actor)) {} /** (SERVER) update cvar based properties */ METHOD(Weapon, wr_update, void(Weapon this)) {} METHOD(Weapon, display, void(entity this, void(string name, string icon) returns)) { diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index 462bf0aa31..e2936bd959 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -231,8 +231,8 @@ void Arc_Player_SetHeat(entity player) //dprint("Heat: ",ftos(player.arc_heat_percent*100),"%\n"); } -void W_Arc_Bolt_Explode() -{SELFPARAM(); +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); @@ -241,7 +241,7 @@ void W_Arc_Bolt_Explode() void W_Arc_Bolt_Explode_use(entity this, entity actor, entity trigger) { - WITHSELF(this, W_Arc_Bolt_Explode()); + WITHSELF(this, W_Arc_Bolt_Explode(this)); } void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) @@ -265,8 +265,9 @@ void W_Arc_Bolt_Touch(entity this) self.use(this, NULL, NULL); } -void W_Arc_Attack_Bolt(Weapon thiswep) -{SELFPARAM(); +void W_Arc_Attack_Bolt(Weapon thiswep, entity actor) +{ + entity this = actor; entity missile; W_DecreaseAmmo(thiswep, self, WEP_CVAR(arc, bolt_ammo)); @@ -674,8 +675,8 @@ void W_Arc_Beam_Think(entity this) self.nextthink = time; } -void W_Arc_Beam(float burst) -{SELFPARAM(); +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) @@ -693,9 +694,8 @@ void W_Arc_Beam(float burst) WITHSELF(beam, getthink(beam)(beam)); } - -void Arc_Smoke() -{SELFPARAM(); +void Arc_Smoke(entity actor) +{entity this = actor; makevectors(self.v_angle); W_SetupShot_Range(self,true,0,SND_Null,0,0,0); @@ -730,9 +730,9 @@ void Arc_Smoke() } } -METHOD(Arc, wr_aim, void(entity thiswep)) +METHOD(Arc, wr_aim, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; if(WEP_CVAR(arc, beam_botaimspeed)) { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim( @@ -757,7 +757,7 @@ METHOD(Arc, wr_aim, void(entity thiswep)) METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { Arc_Player_SetHeat(actor); - Arc_Smoke(); + Arc_Smoke(actor); bool beam_fire2 = ((fire & 2) && !WEP_CVAR(arc, bolt)); @@ -779,7 +779,7 @@ METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, i { if(weapon_prepareattack(thiswep, actor, weaponentity, boolean(beam_fire2), 0)) { - W_Arc_Beam(boolean(beam_fire2)); + W_Arc_Beam(boolean(beam_fire2), actor); if(!actor.arc_BUTTON_ATCK_prev) { @@ -795,7 +795,7 @@ METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, i { if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(arc, bolt_refire))) { - W_Arc_Attack_Bolt(thiswep); + W_Arc_Attack_Bolt(thiswep, actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, bolt_refire), w_ready); } } @@ -853,17 +853,17 @@ METHOD(Arc, wr_killmessage, Notification(entity thiswep)) else return WEAPON_ARC_MURDER; } -METHOD(Arc, wr_drop, void(entity thiswep)) +METHOD(Arc, wr_drop, void(entity thiswep, entity actor)) { - SELFPARAM(); + 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; } -METHOD(Arc, wr_pickup, void(entity thiswep)) +METHOD(Arc, wr_pickup, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; if ( !client_hasweapon(self, thiswep, false, false) && weapon_dropevent_item.arc_overheat > time ) { @@ -875,9 +875,9 @@ METHOD(Arc, wr_pickup, void(entity thiswep)) #ifdef CSQC bool autocvar_cl_arcbeam_teamcolor = true; -METHOD(Arc, wr_impacteffect, void(entity thiswep)) +METHOD(Arc, wr_impacteffect, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; if(w_deathtype & HITTYPE_SECONDARY) { vector org2; diff --git a/qcsrc/common/weapons/weapon/blaster.qc b/qcsrc/common/weapons/weapon/blaster.qc index 4da4f82672..5b583c1ac6 100644 --- a/qcsrc/common/weapons/weapon/blaster.qc +++ b/qcsrc/common/weapons/weapon/blaster.qc @@ -150,9 +150,9 @@ void W_Blaster_Attack( } } -METHOD(Blaster, wr_aim, void(entity thiswep)) +METHOD(Blaster, wr_aim, void(entity thiswep, entity actor)) { - SELFPARAM(); + 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)) @@ -223,9 +223,9 @@ METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, .entity weaponenti } } -METHOD(Blaster, wr_setup, void(entity thiswep)) +METHOD(Blaster, wr_setup, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; self.ammo_field = ammo_none; } @@ -252,9 +252,9 @@ METHOD(Blaster, wr_killmessage, Notification(entity thiswep)) #endif #ifdef CSQC -METHOD(Blaster, wr_impacteffect, void(entity thiswep)) +METHOD(Blaster, wr_impacteffect, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; vector org2; org2 = w_org + w_backoff * 6; pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1); diff --git a/qcsrc/common/weapons/weapon/crylink.qc b/qcsrc/common/weapons/weapon/crylink.qc index 7c9ae5eaf0..fb24bcfdf3 100644 --- a/qcsrc/common/weapons/weapon/crylink.qc +++ b/qcsrc/common/weapons/weapon/crylink.qc @@ -344,8 +344,8 @@ void W_Crylink_Fadethink(entity this) remove(self); } -void W_Crylink_Attack(Weapon thiswep) -{SELFPARAM(); +void W_Crylink_Attack(Weapon thiswep, entity actor) +{entity this = actor; float counter, shots; entity proj, prevproj, firstproj; vector s; @@ -452,8 +452,8 @@ void W_Crylink_Attack(Weapon thiswep) } } -void W_Crylink_Attack2(Weapon thiswep) -{SELFPARAM(); +void W_Crylink_Attack2(Weapon thiswep, entity actor) +{entity this = actor; float counter, shots; entity proj, prevproj, firstproj; vector s; @@ -567,9 +567,9 @@ void W_Crylink_Attack2(Weapon thiswep) } } -METHOD(Crylink, wr_aim, void(entity thiswep)) +METHOD(Crylink, wr_aim, void(entity thiswep, entity actor)) { - SELFPARAM(); + 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); else @@ -586,7 +586,7 @@ METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentit if(actor.crylink_waitrelease != 1) if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(crylink, refire))) { - W_Crylink_Attack(thiswep); + W_Crylink_Attack(thiswep, actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(crylink, animtime), w_ready); } } @@ -596,7 +596,7 @@ METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentit if(actor.crylink_waitrelease != 2) if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(crylink, refire))) { - W_Crylink_Attack2(thiswep); + W_Crylink_Attack2(thiswep, actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(crylink, animtime), w_ready); } } @@ -653,8 +653,7 @@ METHOD(Crylink, wr_checkammo2, bool(entity thiswep, entity actor)) } METHOD(Crylink, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - SELFPARAM(); - W_Reload(self, min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND_RELOAD); + W_Reload(actor, min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND_RELOAD); } METHOD(Crylink, wr_suicidemessage, Notification(entity thiswep)) { @@ -666,9 +665,9 @@ METHOD(Crylink, wr_killmessage, Notification(entity thiswep)) } #endif #ifdef CSQC -METHOD(Crylink, wr_impacteffect, void(entity thiswep)) +METHOD(Crylink, wr_impacteffect, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; vector org2; org2 = w_org + w_backoff * 2; if(w_deathtype & HITTYPE_SECONDARY) diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index 1c79e2fcb2..e04f812be8 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -72,8 +72,8 @@ spawnfunc(weapon_rocketlauncher) { spawnfunc_weapon_devastator(this); } .entity lastrocket; -void W_Devastator_Unregister() -{SELFPARAM(); +void W_Devastator_Unregister(entity this) +{ if(self.realowner && self.realowner.lastrocket == self) { self.realowner.lastrocket = world; @@ -83,7 +83,7 @@ void W_Devastator_Unregister() void W_Devastator_Explode(entity this) { - W_Devastator_Unregister(); + W_Devastator_Unregister(self); if(other.takedamage == DAMAGE_AIM) if(IS_PLAYER(other)) @@ -123,9 +123,9 @@ void W_Devastator_Explode(entity this) remove(self); } -void W_Devastator_DoRemoteExplode(.entity weaponentity) -{SELFPARAM(); - W_Devastator_Unregister(); +void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity) +{ + W_Devastator_Unregister(self); self.event_damage = func_null; self.takedamage = DAMAGE_NO; @@ -204,8 +204,8 @@ void W_Devastator_DoRemoteExplode(.entity weaponentity) remove(self); } -void W_Devastator_RemoteExplode(.entity weaponentity) -{SELFPARAM(); +void W_Devastator_RemoteExplode(entity this, .entity weaponentity) +{ if(!IS_DEAD(self.realowner)) if(self.realowner.lastrocket) { @@ -214,7 +214,7 @@ void W_Devastator_RemoteExplode(.entity weaponentity) : (vdist(NearestPointOnBox(self.realowner, self.origin) - self.origin, >, WEP_CVAR(devastator, remote_radius))) // safety device ) { - W_Devastator_DoRemoteExplode(weaponentity); + W_Devastator_DoRemoteExplode(self, weaponentity); } } } @@ -313,7 +313,7 @@ void W_Devastator_Think(entity this) .entity weaponentity = weaponentities[0]; // TODO: unhardcode if(self.rl_detonate_later) - W_Devastator_RemoteExplode(weaponentity); + W_Devastator_RemoteExplode(self, weaponentity); } if(self.csqcprojectile_clientanimate == 0) @@ -325,10 +325,10 @@ void W_Devastator_Touch(entity this) if(WarpZone_Projectile_Touch()) { if(wasfreed(self)) - W_Devastator_Unregister(); + W_Devastator_Unregister(self); return; } - W_Devastator_Unregister(); + W_Devastator_Unregister(self); W_Devastator_Explode(this); } @@ -347,8 +347,8 @@ void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float d W_PrepareExplosionByDamage(this, attacker, W_Devastator_Explode); } -void W_Devastator_Attack(Weapon thiswep) -{SELFPARAM(); +void W_Devastator_Attack(Weapon thiswep, entity actor) +{entity this = actor; entity missile; entity flash; @@ -405,8 +405,9 @@ void W_Devastator_Attack(Weapon thiswep) } #if 0 -METHOD(Devastator, wr_aim, void(entity thiswep)) +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); if(skill >= 2) // skill 0 and 1 bots won't detonate rockets! @@ -432,9 +433,9 @@ METHOD(Devastator, wr_aim, void(entity thiswep)) } } #else -METHOD(Devastator, wr_aim, void(entity thiswep)) +METHOD(Devastator, wr_aim, void(entity thiswep, entity actor)) { - SELFPARAM(); + 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); if(skill >= 2) // skill 0 and 1 bots won't detonate rockets! @@ -530,7 +531,7 @@ METHOD(Devastator, wr_think, void(entity thiswep, entity actor, .entity weaponen if(actor.rl_release || WEP_CVAR(devastator, guidestop)) if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(devastator, refire))) { - W_Devastator_Attack(thiswep); + W_Devastator_Attack(thiswep, actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(devastator, animtime), w_ready); actor.rl_release = 0; } @@ -556,9 +557,9 @@ METHOD(Devastator, wr_think, void(entity thiswep, entity actor, .entity weaponen } } } -METHOD(Devastator, wr_setup, void(entity thiswep)) +METHOD(Devastator, wr_setup, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; self.rl_release = 1; } METHOD(Devastator, wr_checkammo1, bool(entity thiswep, entity actor)) @@ -601,16 +602,15 @@ METHOD(Devastator, wr_checkammo2, bool(entity thiswep, entity actor)) { return false; } -METHOD(Devastator, wr_resetplayer, void(entity thiswep)) +METHOD(Devastator, wr_resetplayer, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; self.lastrocket = NULL; // stop rocket guiding, no revenge from the grave! self.rl_release = 0; } METHOD(Devastator, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - SELFPARAM(); - W_Reload(self, WEP_CVAR(devastator, ammo), SND_RELOAD); + W_Reload(actor, WEP_CVAR(devastator, ammo), SND_RELOAD); } METHOD(Devastator, wr_suicidemessage, Notification(entity thiswep)) { @@ -627,9 +627,9 @@ METHOD(Devastator, wr_killmessage, Notification(entity thiswep)) #endif #ifdef CSQC -METHOD(Devastator, wr_impacteffect, void(entity thiswep)) +METHOD(Devastator, wr_impacteffect, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; vector org2; org2 = w_org + w_backoff * 12; pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1); diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index 37711625a7..37dcf9f07e 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -144,8 +144,8 @@ void W_Electro_ExplodeCombo(entity this) remove(self); } -void W_Electro_Explode() -{SELFPARAM(); +void W_Electro_Explode(entity this) +{ if(other.takedamage == DAMAGE_AIM) if(IS_PLAYER(other)) if(DIFF_TEAM(self.realowner, other)) @@ -193,13 +193,13 @@ void W_Electro_Explode() void W_Electro_Explode_use(entity this, entity actor, entity trigger) { - WITHSELF(this, W_Electro_Explode()); + WITHSELF(this, W_Electro_Explode(this)); } void W_Electro_TouchExplode(entity this) { PROJECTILE_TOUCH; - W_Electro_Explode(); + W_Electro_Explode(this); } void W_Electro_Bolt_Think(entity this) @@ -254,8 +254,8 @@ void W_Electro_Bolt_Think(entity this) else { self.nextthink = self.ltime; } } -void W_Electro_Attack_Bolt(Weapon thiswep) -{SELFPARAM(); +void W_Electro_Attack_Bolt(Weapon thiswep, entity actor) +{entity this = actor; entity proj; W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(electro, ammo)); @@ -302,7 +302,7 @@ void W_Electro_Orb_Touch(entity this) { PROJECTILE_TOUCH; if(other.takedamage == DAMAGE_AIM) - { if(WEP_CVAR_SEC(electro, touchexplode)) { W_Electro_Explode(); } } + { if(WEP_CVAR_SEC(electro, touchexplode)) { W_Electro_Explode(self); } } else { //UpdateCSQCProjectile(self); @@ -353,8 +353,8 @@ void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float } } -void W_Electro_Attack_Orb(Weapon thiswep) -{SELFPARAM(); +void W_Electro_Attack_Orb(Weapon thiswep, entity actor) +{entity this = actor; W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(electro, ammo)); W_SetupShot_ProjectileSize( @@ -414,12 +414,12 @@ void W_Electro_Attack_Orb(Weapon thiswep) } void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, int fire) -{SELFPARAM(); +{entity this = actor; if(self.electro_count > 1) if(PHYS_INPUT_BUTTON_ATCK2(self)) if(weapon_prepareattack(thiswep, actor, weaponentity, true, -1)) { - W_Electro_Attack_Orb(WEP_ELECTRO); + W_Electro_Attack_Orb(WEP_ELECTRO, actor); self.electro_count -= 1; weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack); return; @@ -430,9 +430,9 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, i .float bot_secondary_electromooth; -METHOD(Electro, wr_aim, void(entity thiswep)) +METHOD(Electro, wr_aim, void(entity thiswep, entity actor)) { - SELFPARAM(); + 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) @@ -480,7 +480,7 @@ METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentit { if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) { - W_Electro_Attack_Bolt(thiswep); + W_Electro_Attack_Bolt(thiswep, actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready); } } @@ -489,7 +489,7 @@ METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentit if(time >= actor.electro_secondarytime) if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(electro, refire))) { - W_Electro_Attack_Orb(thiswep); + W_Electro_Attack_Orb(thiswep, actor); actor.electro_count = WEP_CVAR_SEC(electro, count); weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack); actor.electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor(); @@ -517,15 +517,14 @@ METHOD(Electro, wr_checkammo2, bool(entity thiswep, entity actor)) } return ammo_amount; } -METHOD(Electro, wr_resetplayer, void(entity thiswep)) +METHOD(Electro, wr_resetplayer, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; self.electro_secondarytime = time; } METHOD(Electro, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - SELFPARAM(); - W_Reload(self, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND_RELOAD); + W_Reload(actor, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND_RELOAD); } METHOD(Electro, wr_suicidemessage, Notification(entity thiswep)) { @@ -552,9 +551,9 @@ METHOD(Electro, wr_killmessage, Notification(entity thiswep)) #endif #ifdef CSQC -METHOD(Electro, wr_impacteffect, void(entity thiswep)) +METHOD(Electro, wr_impacteffect, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; vector org2; org2 = w_org + w_backoff * 6; if(w_deathtype & HITTYPE_SECONDARY) diff --git a/qcsrc/common/weapons/weapon/fireball.qc b/qcsrc/common/weapons/weapon/fireball.qc index 9aa1d4b078..10a26e4440 100644 --- a/qcsrc/common/weapons/weapon/fireball.qc +++ b/qcsrc/common/weapons/weapon/fireball.qc @@ -123,8 +123,8 @@ void W_Fireball_TouchExplode(entity this) W_Fireball_Explode(this); } -void W_Fireball_LaserPlay(float dt, float dist, float damage, float edgedamage, float burntime) -{SELFPARAM(); +void W_Fireball_LaserPlay(entity this, float dt, float dist, float damage, float edgedamage, float burntime) +{ entity e; float d; vector p; @@ -167,7 +167,7 @@ void W_Fireball_Think(entity this) return; } - W_Fireball_LaserPlay(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(self, 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; } @@ -188,8 +188,8 @@ void W_Fireball_Damage(entity this, entity inflictor, entity attacker, float dam } } -void W_Fireball_Attack1() -{SELFPARAM(); +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)); @@ -226,41 +226,41 @@ void W_Fireball_Attack1() MUTATOR_CALLHOOK(EditProjectile, self, proj); } -void W_Fireball_AttackEffect(float i, vector f_diff) -{SELFPARAM(); - W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', false, 0, SND_Null, 0, 0); +void W_Fireball_AttackEffect(entity actor, float i, vector f_diff) +{ + W_SetupShot_ProjectileSize(actor, '-16 -16 -16', '16 16 16', false, 0, SND_Null, 0, 0); w_shotorg += f_diff.x * v_up + f_diff.y * v_right; Send_Effect(EFFECT_FIREBALL_PRE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); } void W_Fireball_Attack1_Frame4(Weapon thiswep, entity actor, .entity weaponentity, int fire) { - W_Fireball_Attack1(); + W_Fireball_Attack1(actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), w_ready); } void W_Fireball_Attack1_Frame3(Weapon thiswep, entity actor, .entity weaponentity, int fire) { - W_Fireball_AttackEffect(0, '+1.25 +3.75 0'); + W_Fireball_AttackEffect(actor, 0, '+1.25 +3.75 0'); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame4); } void W_Fireball_Attack1_Frame2(Weapon thiswep, entity actor, .entity weaponentity, int fire) { - W_Fireball_AttackEffect(0, '-1.25 +3.75 0'); + W_Fireball_AttackEffect(actor, 0, '-1.25 +3.75 0'); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame3); } void W_Fireball_Attack1_Frame1(Weapon thiswep, entity actor, .entity weaponentity, int fire) { - W_Fireball_AttackEffect(1, '+1.25 -3.75 0'); + W_Fireball_AttackEffect(actor, 1, '+1.25 -3.75 0'); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame2); } void W_Fireball_Attack1_Frame0(Weapon thiswep, entity actor, .entity weaponentity, int fire) -{SELFPARAM(); - W_Fireball_AttackEffect(0, '-1.25 -3.75 0'); - sound(self, CH_WEAPON_SINGLE, SND_FIREBALL_PREFIRE2, VOL_BASE, ATTEN_NORM); +{ + W_Fireball_AttackEffect(actor, 0, '-1.25 -3.75 0'); + sound(actor, CH_WEAPON_SINGLE, SND_FIREBALL_PREFIRE2, VOL_BASE, ATTEN_NORM); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame1); } @@ -285,7 +285,7 @@ void W_Fireball_Firemine_Think(entity this) self.cnt = 0; } - W_Fireball_LaserPlay(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(self, 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; } @@ -302,8 +302,8 @@ void W_Fireball_Firemine_Touch(entity this) self.projectiledeathtype |= HITTYPE_BOUNCE; } -void W_Fireball_Attack2() -{SELFPARAM(); +void W_Fireball_Attack2(entity actor) +{entity this = actor; entity proj; vector f_diff; float c; @@ -356,9 +356,9 @@ void W_Fireball_Attack2() MUTATOR_CALLHOOK(EditProjectile, self, proj); } -METHOD(Fireball, wr_aim, void(entity thiswep)) +METHOD(Fireball, wr_aim, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; PHYS_INPUT_BUTTON_ATCK(self) = false; PHYS_INPUT_BUTTON_ATCK2(self) = false; if(self.bot_primary_fireballmooth == 0) @@ -393,14 +393,14 @@ METHOD(Fireball, wr_think, void(entity thiswep, entity actor, .entity weaponenti { if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(fireball, refire))) { - W_Fireball_Attack2(); + W_Fireball_Attack2(actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(fireball, animtime), w_ready); } } } -METHOD(Fireball, wr_setup, void(entity thiswep)) +METHOD(Fireball, wr_setup, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; self.ammo_field = ammo_none; } METHOD(Fireball, wr_checkammo1, bool(entity thiswep, entity actor)) @@ -411,9 +411,9 @@ METHOD(Fireball, wr_checkammo2, bool(entity thiswep, entity actor)) { return true; // fireball has infinite ammo } -METHOD(Fireball, wr_resetplayer, void(entity thiswep)) +METHOD(Fireball, wr_resetplayer, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; self.fireball_primarytime = time; } METHOD(Fireball, wr_suicidemessage, Notification(entity thiswep)) @@ -434,9 +434,9 @@ METHOD(Fireball, wr_killmessage, Notification(entity thiswep)) #endif #ifdef CSQC -METHOD(Fireball, wr_impacteffect, void(entity thiswep)) +METHOD(Fireball, wr_impacteffect, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; vector org2; if(w_deathtype & HITTYPE_SECONDARY) { diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index d37063a678..e2274faafa 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -63,8 +63,8 @@ spawnfunc(weapon_hagar) { weapon_defaultspawnfunc(this, WEP_HAGAR); } // NO bounce protection, as bounces are limited! -void W_Hagar_Explode() -{SELFPARAM(); +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); @@ -73,11 +73,11 @@ void W_Hagar_Explode() void W_Hagar_Explode_use(entity this, entity actor, entity trigger) { - WITHSELF(this, W_Hagar_Explode()); + WITHSELF(this, W_Hagar_Explode(this)); } -void W_Hagar_Explode2() -{SELFPARAM(); +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); @@ -86,7 +86,7 @@ void W_Hagar_Explode2() void W_Hagar_Explode2_use(entity this, entity actor, entity trigger) { - WITHSELF(this, W_Hagar_Explode2()); + WITHSELF(this, W_Hagar_Explode2(this)); } void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) @@ -134,8 +134,8 @@ void W_Hagar_Touch2(entity this) } } -void W_Hagar_Attack(Weapon thiswep) -{SELFPARAM(); +void W_Hagar_Attack(Weapon thiswep, entity actor) +{entity this = actor; entity missile; W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(hagar, ammo)); @@ -176,8 +176,8 @@ void W_Hagar_Attack(Weapon thiswep) MUTATOR_CALLHOOK(EditProjectile, self, missile); } -void W_Hagar_Attack2(Weapon thiswep) -{SELFPARAM(); +void W_Hagar_Attack2(Weapon thiswep, entity actor) +{entity this = actor; entity missile; W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hagar, ammo)); @@ -220,8 +220,8 @@ void W_Hagar_Attack2(Weapon thiswep) } .float hagar_loadstep, hagar_loadblock, hagar_loadbeep, hagar_warning; -void W_Hagar_Attack2_Load_Release(.entity weaponentity) -{SELFPARAM(); +void W_Hagar_Attack2_Load_Release(entity actor, .entity weaponentity) +{entity this = actor; // time to release the rockets we've loaded entity missile; @@ -299,8 +299,8 @@ void W_Hagar_Attack2_Load_Release(.entity weaponentity) self.hagar_load = 0; } -void W_Hagar_Attack2_Load(Weapon thiswep, .entity weaponentity) -{SELFPARAM(); +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) @@ -388,7 +388,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep, .entity weaponentity) if(!PHYS_INPUT_BUTTON_ATCK2(self) || (stopped && self.hagar_loadstep < time && WEP_CVAR_SEC(hagar, load_hold) >= 0)) { self.(weaponentity).state = WS_READY; - W_Hagar_Attack2_Load_Release(weaponentity); + W_Hagar_Attack2_Load_Release(self, weaponentity); } } else @@ -423,7 +423,7 @@ void W_Hagar_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int return; } - W_Hagar_Attack(thiswep); + W_Hagar_Attack(thiswep, actor); int slot = weaponslot(weaponentity); ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(hagar, refire) * W_WeaponRateFactor(); @@ -437,9 +437,9 @@ void W_Hagar_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int weapon_thinkf(actor, weaponentity, theframe, WEP_CVAR_PRI(hagar, refire), W_Hagar_Attack_Auto); } -METHOD(Hagar, wr_aim, void(entity thiswep)) +METHOD(Hagar, wr_aim, void(entity thiswep, entity actor)) { - SELFPARAM(); + 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); else // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming @@ -451,7 +451,7 @@ METHOD(Hagar, wr_think, void(entity thiswep, entity actor, .entity weaponentity, loadable_secondary = (WEP_CVAR_SEC(hagar, load) && WEP_CVAR(hagar, secondary)); if(loadable_secondary) - W_Hagar_Attack2_Load(thiswep, weaponentity); // must always run each frame + W_Hagar_Attack2_Load(thiswep, actor, weaponentity); // must always run each frame if(autocvar_g_balance_hagar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) { // forced reload thiswep.wr_reload(thiswep, actor, weaponentity); } @@ -464,25 +464,24 @@ METHOD(Hagar, wr_think, void(entity thiswep, entity actor, .entity weaponentity, { if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hagar, refire))) { - W_Hagar_Attack2(thiswep); + W_Hagar_Attack2(thiswep, actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hagar, refire), w_ready); } } } -METHOD(Hagar, wr_gonethink, void(entity thiswep)) +METHOD(Hagar, wr_gonethink, void(entity thiswep, entity actor)) { - SELFPARAM(); // we lost the weapon and want to prepare switching away - if(self.hagar_load) + if(actor.hagar_load) { .entity weaponentity = weaponentities[0]; // TODO: unhardcode - self.(weaponentity).state = WS_READY; - W_Hagar_Attack2_Load_Release(weaponentity); + actor.(weaponentity).state = WS_READY; + W_Hagar_Attack2_Load_Release(actor, weaponentity); } } -METHOD(Hagar, wr_setup, void(entity thiswep)) +METHOD(Hagar, wr_setup, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; self.hagar_loadblock = false; if(self.hagar_load) @@ -503,22 +502,21 @@ METHOD(Hagar, wr_checkammo2, bool(entity thiswep, entity actor)) ammo_amount += actor.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo); return ammo_amount; } -METHOD(Hagar, wr_resetplayer, void(entity thiswep)) +METHOD(Hagar, wr_resetplayer, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; self.hagar_load = 0; } -METHOD(Hagar, wr_playerdeath, void(entity thiswep)) +METHOD(Hagar, wr_playerdeath, void(entity thiswep, entity actor)) { - SELFPARAM(); .entity weaponentity = weaponentities[0]; // TODO: unhardcode // if we have any rockets loaded when we die, release them - if(self.hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath)) - W_Hagar_Attack2_Load_Release(weaponentity); + if(actor.hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath)) + W_Hagar_Attack2_Load_Release(actor, weaponentity); } METHOD(Hagar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - SELFPARAM(); + 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); } @@ -537,9 +535,9 @@ METHOD(Hagar, wr_killmessage, Notification(entity thiswep)) #endif #ifdef CSQC -METHOD(Hagar, wr_impacteffect, void(entity thiswep)) +METHOD(Hagar, wr_impacteffect, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; vector org2; org2 = w_org + w_backoff * 6; pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1); diff --git a/qcsrc/common/weapons/weapon/hlac.qc b/qcsrc/common/weapons/weapon/hlac.qc index dbcb04deff..928462a204 100644 --- a/qcsrc/common/weapons/weapon/hlac.qc +++ b/qcsrc/common/weapons/weapon/hlac.qc @@ -69,8 +69,8 @@ void W_HLAC_Touch(entity this) remove(self); } -void W_HLAC_Attack(Weapon thiswep) -{SELFPARAM(); +void W_HLAC_Attack(Weapon thiswep, entity actor) +{entity this = actor; entity missile; float spread; @@ -117,8 +117,8 @@ void W_HLAC_Attack(Weapon thiswep) MUTATOR_CALLHOOK(EditProjectile, self, missile); } -void W_HLAC_Attack2() -{SELFPARAM(); +void W_HLAC_Attack2(entity actor) +{entity this = actor; entity missile; float spread; @@ -181,7 +181,7 @@ void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int int slot = weaponslot(weaponentity); ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(hlac, refire) * W_WeaponRateFactor(); - W_HLAC_Attack(WEP_HLAC); + W_HLAC_Attack(WEP_HLAC, actor); actor.misc_bulletcounter = actor.misc_bulletcounter + 1; weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame); } @@ -191,14 +191,14 @@ void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int } } -void W_HLAC_Attack2_Frame(Weapon thiswep) -{SELFPARAM(); +void W_HLAC_Attack2_Frame(Weapon thiswep, entity actor) +{entity this = actor; float i; W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hlac, ammo)); for(i=WEP_CVAR_SEC(hlac, shots);i>0;--i) - W_HLAC_Attack2(); + W_HLAC_Attack2(actor); if(!autocvar_g_norecoil) { @@ -207,9 +207,9 @@ void W_HLAC_Attack2_Frame(Weapon thiswep) } } -METHOD(HLAC, wr_aim, void(entity thiswep)) +METHOD(HLAC, wr_aim, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 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)) @@ -221,7 +221,7 @@ METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity, if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hlac, refire))) { actor.misc_bulletcounter = 0; - W_HLAC_Attack(thiswep); + W_HLAC_Attack(thiswep, actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame); } } @@ -230,7 +230,7 @@ METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity, { if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hlac, refire))) { - W_HLAC_Attack2_Frame(thiswep); + W_HLAC_Attack2_Frame(thiswep, actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready); } } @@ -249,8 +249,7 @@ METHOD(HLAC, wr_checkammo2, bool(entity thiswep, entity actor)) } METHOD(HLAC, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - SELFPARAM(); - W_Reload(self, min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND_RELOAD); + W_Reload(actor, min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND_RELOAD); } METHOD(HLAC, wr_suicidemessage, Notification(entity thiswep)) { @@ -264,9 +263,9 @@ METHOD(HLAC, wr_killmessage, Notification(entity thiswep)) #endif #ifdef CSQC -METHOD(HLAC, wr_impacteffect, void(entity thiswep)) +METHOD(HLAC, wr_impacteffect, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; vector org2; org2 = w_org + w_backoff * 6; pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1); diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index c4529759a9..40f828f58f 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -277,9 +277,9 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, actor.hook_state &= ~HOOK_REMOVING; } } -METHOD(Hook, wr_setup, void(entity thiswep)) +METHOD(Hook, wr_setup, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; self.hook_state &= ~HOOK_WAITING_FOR_RELEASE; } METHOD(Hook, wr_checkammo1, bool(Hook thiswep, entity actor)) @@ -295,9 +295,9 @@ METHOD(Hook, wr_checkammo2, bool(Hook thiswep, entity actor)) // infinite ammo for now return true; // actor.ammo_cells >= WEP_CVAR_SEC(hook, ammo); // WEAPONTODO: see above } -METHOD(Hook, wr_resetplayer, void(entity thiswep)) +METHOD(Hook, wr_resetplayer, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; RemoveGrapplingHook(self); self.hook_time = 0; self.hook_refire = time; @@ -310,9 +310,9 @@ METHOD(Hook, wr_killmessage, Notification(entity thiswep)) #endif #ifdef CSQC -METHOD(Hook, wr_impacteffect, void(entity thiswep)) +METHOD(Hook, wr_impacteffect, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; vector org2; org2 = w_org + w_backoff * 2; pointparticles(EFFECT_HOOK_EXPLODE, org2, '0 0 0', 1); diff --git a/qcsrc/common/weapons/weapon/machinegun.qc b/qcsrc/common/weapons/weapon/machinegun.qc index 18934a66f3..10a8c40a18 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -88,8 +88,8 @@ void W_MachineGun_MuzzleFlash_Think(entity this) } -void W_MachineGun_MuzzleFlash() -{SELFPARAM(); +void W_MachineGun_MuzzleFlash(entity actor) +{entity this = actor; if(self.muzzle_flash == world) self.muzzle_flash = spawn(); @@ -106,8 +106,8 @@ void W_MachineGun_MuzzleFlash() self.muzzle_flash.owner = self.muzzle_flash.realowner = self; } -void W_MachineGun_Attack(Weapon thiswep, int deathtype, .entity weaponentity) -{SELFPARAM(); +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))); if(!autocvar_g_norecoil) { @@ -125,7 +125,7 @@ void W_MachineGun_Attack(Weapon thiswep, int deathtype, .entity weaponentity) Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); - W_MachineGun_MuzzleFlash(); + W_MachineGun_MuzzleFlash(self); W_AttachToShotorg(self, self.muzzle_flash, '5 0 0'); // casing code @@ -156,7 +156,7 @@ void W_MachineGun_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentit return; } actor.misc_bulletcounter = actor.misc_bulletcounter + 1; - W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id, weaponentity); + W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id, actor, weaponentity); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame); } else @@ -198,7 +198,7 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); - W_MachineGun_MuzzleFlash(); + W_MachineGun_MuzzleFlash(actor); W_AttachToShotorg(actor, actor.muzzle_flash, '5 0 0'); if(autocvar_g_casings >= 2) // casing code @@ -222,7 +222,7 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); - W_MachineGun_MuzzleFlash(); + W_MachineGun_MuzzleFlash(actor); W_AttachToShotorg(actor, actor.muzzle_flash, '5 0 0'); if(autocvar_g_casings >= 2) // casing code @@ -242,9 +242,9 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit } -METHOD(MachineGun, wr_aim, void(entity thiswep)) +METHOD(MachineGun, wr_aim, void(entity thiswep, entity actor)) { - SELFPARAM(); + 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); else @@ -288,7 +288,7 @@ METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponen if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0)) { actor.misc_bulletcounter = 1; - W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id, weaponentity); // sets attack_finished + W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id, actor, weaponentity); // sets attack_finished weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame); } @@ -296,7 +296,7 @@ METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponen if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0)) { actor.misc_bulletcounter = 1; - W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id | HITTYPE_SECONDARY, weaponentity); // sets attack_finished + W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id | HITTYPE_SECONDARY, actor, weaponentity); // sets attack_finished weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(machinegun, first_refire), w_ready); } } @@ -337,8 +337,7 @@ METHOD(MachineGun, wr_checkammo2, bool(entity thiswep, entity actor)) } METHOD(MachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - SELFPARAM(); - W_Reload(self, min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND_RELOAD); + W_Reload(actor, min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND_RELOAD); } METHOD(MachineGun, wr_suicidemessage, Notification(entity thiswep)) { @@ -355,9 +354,9 @@ METHOD(MachineGun, wr_killmessage, Notification(entity thiswep)) #endif #ifdef CSQC -METHOD(MachineGun, wr_impacteffect, void(entity thiswep)) +METHOD(MachineGun, wr_impacteffect, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; vector org2; org2 = w_org + w_backoff * 2; pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1); diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index 66c6d021e4..ecb5059b53 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -63,8 +63,8 @@ void W_MineLayer_Think(entity this); #ifdef SVQC spawnfunc(weapon_minelayer) { weapon_defaultspawnfunc(this, WEP_MINE_LAYER); } -void W_MineLayer_Stick(entity to) -{SELFPARAM(); +void W_MineLayer_Stick(entity this, entity to) +{ spamsound(self, 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 @@ -138,8 +138,8 @@ void W_MineLayer_Explode(entity this) remove(self); } -void W_MineLayer_DoRemoteExplode() -{SELFPARAM(); +void W_MineLayer_DoRemoteExplode(entity this) +{ self.event_damage = func_null; self.takedamage = DAMAGE_NO; @@ -164,20 +164,20 @@ void W_MineLayer_DoRemoteExplode() remove(self); } -void W_MineLayer_RemoteExplode() -{SELFPARAM(); +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 ) { - W_MineLayer_DoRemoteExplode(); + W_MineLayer_DoRemoteExplode(self); } } -void W_MineLayer_ProximityExplode() -{SELFPARAM(); +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) { @@ -257,7 +257,7 @@ void W_MineLayer_Think(entity this) // explode if it's time to if(self.mine_time && time >= self.mine_time) { - W_MineLayer_ProximityExplode(); + W_MineLayer_ProximityExplode(self); return; } @@ -265,7 +265,7 @@ void W_MineLayer_Think(entity this) if(PS(self.realowner).m_weapon == WEP_MINE_LAYER) if(!IS_DEAD(self.realowner)) if(self.minelayer_detonate) - W_MineLayer_RemoteExplode(); + W_MineLayer_RemoteExplode(self); } void W_MineLayer_Touch(entity this) @@ -287,7 +287,7 @@ void W_MineLayer_Touch(entity this) } else { - W_MineLayer_Stick(other); + W_MineLayer_Stick(self, other); } } @@ -308,8 +308,8 @@ void W_MineLayer_Damage(entity this, entity inflictor, entity attacker, float da W_PrepareExplosionByDamage(this, attacker, W_MineLayer_Explode); } -void W_MineLayer_Attack(Weapon thiswep) -{SELFPARAM(); +void W_MineLayer_Attack(Weapon thiswep, entity actor) +{entity this = actor; entity mine; entity flash; @@ -401,9 +401,9 @@ float W_MineLayer_PlacedMines(entity this, float detonate) return minfound; } -METHOD(MineLayer, wr_aim, void(entity thiswep)) +METHOD(MineLayer, wr_aim, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; // aim and decide to fire if appropriate if(self.minelayer_mines >= WEP_CVAR(minelayer, limit)) PHYS_INPUT_BUTTON_ATCK(self) = false; @@ -513,7 +513,7 @@ METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, .entity weaponent { if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(minelayer, refire))) { - W_MineLayer_Attack(thiswep); + W_MineLayer_Attack(thiswep, actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(minelayer, animtime), w_ready); } } @@ -543,15 +543,13 @@ METHOD(MineLayer, wr_checkammo2, bool(entity thiswep, entity actor)) else return false; } -METHOD(MineLayer, wr_resetplayers, void(entity thiswep)) +METHOD(MineLayer, wr_resetplayer, void(entity thiswep, entity actor)) { - SELFPARAM(); - self.minelayer_mines = 0; + actor.minelayer_mines = 0; } METHOD(MineLayer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - SELFPARAM(); - W_Reload(self, WEP_CVAR(minelayer, ammo), SND_RELOAD); + W_Reload(actor, WEP_CVAR(minelayer, ammo), SND_RELOAD); } METHOD(MineLayer, wr_suicidemessage, Notification(entity thiswep)) { @@ -565,9 +563,9 @@ METHOD(MineLayer, wr_killmessage, Notification(entity thiswep)) #endif #ifdef CSQC -METHOD(MineLayer, wr_impacteffect, void(entity thiswep)) +METHOD(MineLayer, wr_impacteffect, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; vector org2; org2 = w_org + w_backoff * 12; pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1); diff --git a/qcsrc/common/weapons/weapon/mortar.qc b/qcsrc/common/weapons/weapon/mortar.qc index 5fa2447a78..ddff4a35d5 100644 --- a/qcsrc/common/weapons/weapon/mortar.qc +++ b/qcsrc/common/weapons/weapon/mortar.qc @@ -64,8 +64,8 @@ REGISTER_WEAPON(MORTAR, mortar, NEW(Mortar)); spawnfunc(weapon_mortar) { weapon_defaultspawnfunc(this, WEP_MORTAR); } spawnfunc(weapon_grenadelauncher) { spawnfunc_weapon_mortar(this); } -void W_Mortar_Grenade_Explode() -{SELFPARAM(); +void W_Mortar_Grenade_Explode(entity this) +{ if(other.takedamage == DAMAGE_AIM) if(IS_PLAYER(other)) if(DIFF_TEAM(self.realowner, other)) @@ -86,11 +86,11 @@ void W_Mortar_Grenade_Explode() void W_Mortar_Grenade_Explode_use(entity this, entity actor, entity trigger) { - WITHSELF(this, W_Mortar_Grenade_Explode()); + WITHSELF(this, W_Mortar_Grenade_Explode(this)); } -void W_Mortar_Grenade_Explode2() -{SELFPARAM(); +void W_Mortar_Grenade_Explode2(entity this) +{ if(other.takedamage == DAMAGE_AIM) if(IS_PLAYER(other)) if(DIFF_TEAM(self.realowner, other)) @@ -111,7 +111,7 @@ void W_Mortar_Grenade_Explode2() void W_Mortar_Grenade_Explode2_use(entity this, entity actor, entity trigger) { - WITHSELF(this, W_Mortar_Grenade_Explode2()); + WITHSELF(this, W_Mortar_Grenade_Explode2(this)); } void W_Mortar_Grenade_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) @@ -135,11 +135,11 @@ void W_Mortar_Grenade_Think1(entity this) { other = world; self.projectiledeathtype |= HITTYPE_BOUNCE; - W_Mortar_Grenade_Explode(); + W_Mortar_Grenade_Explode(self); return; } if(self.gl_detonate_later && self.gl_bouncecnt >= WEP_CVAR_PRI(mortar, remote_minbouncecnt)) - W_Mortar_Grenade_Explode(); + W_Mortar_Grenade_Explode(self); } void W_Mortar_Grenade_Touch1(entity this) @@ -210,8 +210,8 @@ void W_Mortar_Grenade_Touch2(entity this) } } -void W_Mortar_Attack(Weapon thiswep) -{SELFPARAM(); +void W_Mortar_Attack(Weapon thiswep, entity actor) +{entity this = actor; entity gren; W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(mortar, ammo)); @@ -258,8 +258,8 @@ void W_Mortar_Attack(Weapon thiswep) MUTATOR_CALLHOOK(EditProjectile, self, gren); } -void W_Mortar_Attack2(Weapon thiswep) -{SELFPARAM(); +void W_Mortar_Attack2(Weapon thiswep, entity actor) +{entity this = actor; entity gren; W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(mortar, ammo)); @@ -307,9 +307,9 @@ void W_Mortar_Attack2(Weapon thiswep) .float bot_secondary_grenademooth; -METHOD(Mortar, wr_aim, void(entity thiswep)) +METHOD(Mortar, wr_aim, void(entity thiswep, entity actor)) { - SELFPARAM(); + 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 @@ -353,7 +353,7 @@ METHOD(Mortar, wr_think, void(entity thiswep, entity actor, .entity weaponentity { if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(mortar, refire))) { - W_Mortar_Attack(thiswep); + W_Mortar_Attack(thiswep, actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(mortar, animtime), w_ready); } } @@ -376,7 +376,7 @@ METHOD(Mortar, wr_think, void(entity thiswep, entity actor, .entity weaponentity } else if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(mortar, refire))) { - W_Mortar_Attack2(thiswep); + W_Mortar_Attack2(thiswep, actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(mortar, animtime), w_ready); } } @@ -395,8 +395,7 @@ METHOD(Mortar, wr_checkammo2, bool(entity thiswep, entity actor)) } METHOD(Mortar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - SELFPARAM(); - W_Reload(self, min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND_RELOAD); // WEAPONTODO + W_Reload(actor, min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND_RELOAD); // WEAPONTODO } METHOD(Mortar, wr_suicidemessage, Notification(entity thiswep)) { @@ -416,9 +415,9 @@ METHOD(Mortar, wr_killmessage, Notification(entity thiswep)) #endif #ifdef CSQC -METHOD(Mortar, wr_impacteffect, void(entity thiswep)) +METHOD(Mortar, wr_impacteffect, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; vector org2; org2 = w_org + w_backoff * 12; pointparticles(EFFECT_GRENADE_EXPLODE, org2, '0 0 0', 1); diff --git a/qcsrc/common/weapons/weapon/porto.qc b/qcsrc/common/weapons/weapon/porto.qc index d1bd519eec..c029c220d0 100644 --- a/qcsrc/common/weapons/weapon/porto.qc +++ b/qcsrc/common/weapons/weapon/porto.qc @@ -53,8 +53,8 @@ MUTATOR_HOOKFUNCTION(porto_ticker, SV_StartFrame) { FOREACH_CLIENT(IS_PLAYER(it), it.porto_forbidden = max(0, it.porto_forbidden - 1)); } -void W_Porto_Success() -{SELFPARAM(); +void W_Porto_Success(entity this) +{ if(self.realowner == world) { objerror("Cannot succeed successfully: no owner\n"); @@ -66,8 +66,8 @@ void W_Porto_Success() } string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo); -void W_Porto_Fail(float failhard) -{SELFPARAM(); +void W_Porto_Fail(entity this, float failhard) +{ if(self.realowner == world) { objerror("Cannot fail successfully: no owner\n"); @@ -105,7 +105,7 @@ void W_Porto_Remove(entity p) { if(p.porto_current.realowner == p && p.porto_current.classname == "porto") { - WITHSELF(p.porto_current, W_Porto_Fail(1)); + WITHSELF(p.porto_current, W_Porto_Fail(p.porto_current, 1)); } } @@ -115,7 +115,7 @@ void W_Porto_Think(entity this) if(self.realowner.playerid != self.playerid) remove(self); else - W_Porto_Fail(0); + W_Porto_Fail(self, 0); } void W_Porto_Touch(entity this) @@ -155,7 +155,7 @@ void W_Porto_Touch(entity this) else if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) { sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); - W_Porto_Fail(0); + W_Porto_Fail(self, 0); if(self.cnt < 0) Portal_ClearAll_PortalsOnly(self.realowner); } @@ -167,13 +167,13 @@ void W_Porto_Touch(entity this) sound(self, 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(); + W_Porto_Success(self); } else { sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); trace_plane_normal = norm; - W_Porto_Fail(0); + W_Porto_Fail(self, 0); } } else if(self.cnt == 1) @@ -184,13 +184,13 @@ void W_Porto_Touch(entity this) sound(self, 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(); + W_Porto_Success(self); } else { sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); trace_plane_normal = norm; - W_Porto_Fail(0); + W_Porto_Fail(self, 0); } } else if(self.effects & EF_RED) @@ -210,7 +210,7 @@ void W_Porto_Touch(entity this) sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); trace_plane_normal = norm; Portal_ClearAll_PortalsOnly(self.realowner); - W_Porto_Fail(0); + W_Porto_Fail(self, 0); } } else @@ -222,26 +222,26 @@ void W_Porto_Touch(entity this) sound(self, 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(); + W_Porto_Success(self); } else { sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); Portal_ClearAll_PortalsOnly(self.realowner); - W_Porto_Fail(0); + W_Porto_Fail(self, 0); } } else { sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); Portal_ClearAll_PortalsOnly(self.realowner); - W_Porto_Fail(0); + W_Porto_Fail(self, 0); } } } -void W_Porto_Attack(float type) -{SELFPARAM(); +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); @@ -292,9 +292,9 @@ void W_Porto_Attack(float type) MUTATOR_CALLHOOK(EditProjectile, self, gren); } -METHOD(PortoLaunch, wr_aim, void(entity thiswep)) +METHOD(PortoLaunch, wr_aim, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; PHYS_INPUT_BUTTON_ATCK(self) = false; PHYS_INPUT_BUTTON_ATCK2(self) = false; if(!WEP_CVAR(porto, secondary)) @@ -310,7 +310,7 @@ METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, .entity weapone if(!actor.porto_forbidden) if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(porto, refire))) { - W_Porto_Attack(0); + W_Porto_Attack(actor, 0); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready); } @@ -319,7 +319,7 @@ METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, .entity weapone if(!actor.porto_forbidden) if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(porto, refire))) { - W_Porto_Attack(1); + W_Porto_Attack(actor, 1); weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(porto, animtime), w_ready); } } @@ -352,7 +352,7 @@ METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, .entity weapone if(!actor.porto_forbidden) if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(porto, refire))) { - W_Porto_Attack(-1); + W_Porto_Attack(actor, -1); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready); } } @@ -367,19 +367,19 @@ METHOD(PortoLaunch, wr_checkammo2, bool(entity thiswep, entity this)) // always allow infinite ammo return true; } -METHOD(PortoLaunch, wr_setup, void(entity thiswep)) +METHOD(PortoLaunch, wr_setup, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; self.ammo_field = ammo_none; } -METHOD(PortoLaunch, wr_resetplayer, void(entity thiswep)) +METHOD(PortoLaunch, wr_resetplayer, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; self.porto_current = world; } #endif #ifdef CSQC -METHOD(PortoLaunch, wr_impacteffect, void(entity this)) { +METHOD(PortoLaunch, wr_impacteffect, void(entity this, entity actor)) { LOG_WARNING("Since when does Porto send DamageInfo?\n"); } #endif diff --git a/qcsrc/common/weapons/weapon/rifle.qc b/qcsrc/common/weapons/weapon/rifle.qc index e11bdd85b7..7381172aac 100644 --- a/qcsrc/common/weapons/weapon/rifle.qc +++ b/qcsrc/common/weapons/weapon/rifle.qc @@ -56,8 +56,8 @@ spawnfunc(weapon_rifle) { weapon_defaultspawnfunc(this, WEP_RIFLE); } 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) -{SELFPARAM(); +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); @@ -79,17 +79,17 @@ void W_Rifle_FireBullet(Weapon thiswep, float pSpread, float pDamage, float pFor 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); } -void W_Rifle_Attack() +void W_Rifle_Attack(entity actor) { - W_Rifle_FireBullet(WEP_RIFLE, WEP_CVAR_PRI(rifle, spread), WEP_CVAR_PRI(rifle, damage), WEP_CVAR_PRI(rifle, force), WEP_CVAR_PRI(rifle, solidpenetration), WEP_CVAR_PRI(rifle, ammo), WEP_RIFLE.m_id, WEP_CVAR_PRI(rifle, tracer), WEP_CVAR_PRI(rifle, shots), SND_CAMPINGRIFLE_FIRE); + W_Rifle_FireBullet(WEP_RIFLE, WEP_CVAR_PRI(rifle, spread), WEP_CVAR_PRI(rifle, damage), WEP_CVAR_PRI(rifle, force), WEP_CVAR_PRI(rifle, solidpenetration), WEP_CVAR_PRI(rifle, ammo), WEP_RIFLE.m_id, WEP_CVAR_PRI(rifle, tracer), WEP_CVAR_PRI(rifle, shots), SND_CAMPINGRIFLE_FIRE, actor); } -void W_Rifle_Attack2() +void W_Rifle_Attack2(entity actor) { - W_Rifle_FireBullet(WEP_RIFLE, WEP_CVAR_SEC(rifle, spread), WEP_CVAR_SEC(rifle, damage), WEP_CVAR_SEC(rifle, force), WEP_CVAR_SEC(rifle, solidpenetration), WEP_CVAR_SEC(rifle, ammo), WEP_RIFLE.m_id | HITTYPE_SECONDARY, WEP_CVAR_SEC(rifle, tracer), WEP_CVAR_SEC(rifle, shots), SND_CAMPINGRIFLE_FIRE2); + W_Rifle_FireBullet(WEP_RIFLE, WEP_CVAR_SEC(rifle, spread), WEP_CVAR_SEC(rifle, damage), WEP_CVAR_SEC(rifle, force), WEP_CVAR_SEC(rifle, solidpenetration), WEP_CVAR_SEC(rifle, ammo), WEP_RIFLE.m_id | HITTYPE_SECONDARY, WEP_CVAR_SEC(rifle, tracer), WEP_CVAR_SEC(rifle, shots), SND_CAMPINGRIFLE_FIRE2, actor); } -.void() rifle_bullethail_attackfunc; +.void(entity actor) rifle_bullethail_attackfunc; .WFRAME rifle_bullethail_frame; .float rifle_bullethail_animtime; .float rifle_bullethail_refire; @@ -107,7 +107,7 @@ void W_Rifle_BulletHail_Continue(Weapon thiswep, entity actor, .entity weaponent PS(actor).m_switchweapon = sw; if(r) { - actor.rifle_bullethail_attackfunc(); + actor.rifle_bullethail_attackfunc(actor); weapon_thinkf(actor, weaponentity, actor.rifle_bullethail_frame, actor.rifle_bullethail_animtime, W_Rifle_BulletHail_Continue); } else @@ -116,10 +116,10 @@ void W_Rifle_BulletHail_Continue(Weapon thiswep, entity actor, .entity weaponent } } -void W_Rifle_BulletHail(.entity weaponentity, float mode, void() AttackFunc, WFRAME fr, float animtime, float refire) -{SELFPARAM(); +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(); + AttackFunc(actor); if(mode) { // continue hail @@ -138,9 +138,9 @@ void W_Rifle_BulletHail(.entity weaponentity, float mode, void() AttackFunc, WFR .float bot_secondary_riflemooth; -METHOD(Rifle, wr_aim, void(entity thiswep)) +METHOD(Rifle, wr_aim, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; PHYS_INPUT_BUTTON_ATCK(self) = false; PHYS_INPUT_BUTTON_ATCK2(self) = false; if(vdist(self.origin - self.enemy.origin, >, 1000)) @@ -174,7 +174,7 @@ METHOD(Rifle, wr_think, void(entity thiswep, entity actor, .entity weaponentity, if(time >= actor.rifle_accumulator + WEP_CVAR_PRI(rifle, burstcost)) { weapon_prepareattack_do(actor, weaponentity, false, WEP_CVAR_PRI(rifle, refire)); - W_Rifle_BulletHail(weaponentity, WEP_CVAR_PRI(rifle, bullethail), W_Rifle_Attack, WFRAME_FIRE1, WEP_CVAR_PRI(rifle, animtime), WEP_CVAR_PRI(rifle, refire)); + W_Rifle_BulletHail(actor, weaponentity, WEP_CVAR_PRI(rifle, bullethail), W_Rifle_Attack, WFRAME_FIRE1, WEP_CVAR_PRI(rifle, animtime), WEP_CVAR_PRI(rifle, refire)); actor.rifle_accumulator += WEP_CVAR_PRI(rifle, burstcost); } if(fire & 2) @@ -189,7 +189,7 @@ METHOD(Rifle, wr_think, void(entity thiswep, entity actor, .entity weaponentity, if(time >= actor.rifle_accumulator + WEP_CVAR_SEC(rifle, burstcost)) { weapon_prepareattack_do(actor, weaponentity, true, WEP_CVAR_SEC(rifle, refire)); - W_Rifle_BulletHail(weaponentity, WEP_CVAR_SEC(rifle, bullethail), W_Rifle_Attack2, WFRAME_FIRE2, WEP_CVAR_SEC(rifle, animtime), WEP_CVAR_PRI(rifle, refire)); + W_Rifle_BulletHail(actor, weaponentity, WEP_CVAR_SEC(rifle, bullethail), W_Rifle_Attack2, WFRAME_FIRE2, WEP_CVAR_SEC(rifle, animtime), WEP_CVAR_PRI(rifle, refire)); actor.rifle_accumulator += WEP_CVAR_SEC(rifle, burstcost); } } @@ -209,15 +209,14 @@ METHOD(Rifle, wr_checkammo2, bool(entity thiswep, entity actor)) ammo_amount += actor.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_SEC(rifle, ammo); return ammo_amount; } -METHOD(Rifle, wr_resetplayer, void(entity thiswep)) +METHOD(Rifle, wr_resetplayer, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; self.rifle_accumulator = time - WEP_CVAR(rifle, bursttime); } METHOD(Rifle, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - SELFPARAM(); - W_Reload(self, min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), SND_RELOAD); + W_Reload(actor, min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), SND_RELOAD); } METHOD(Rifle, wr_suicidemessage, Notification(entity thiswep)) { @@ -244,9 +243,9 @@ METHOD(Rifle, wr_killmessage, Notification(entity thiswep)) #endif #ifdef CSQC -METHOD(Rifle, wr_impacteffect, void(entity thiswep)) +METHOD(Rifle, wr_impacteffect, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; vector org2; org2 = w_org + w_backoff * 2; pointparticles(EFFECT_RIFLE_IMPACT, org2, w_backoff * 1000, 1); diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index d1a9368142..5af840505d 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -248,8 +248,8 @@ void W_Seeker_Missile_Animate() } */ -void W_Seeker_Fire_Missile(Weapon thiswep, vector f_diff, entity m_target) -{SELFPARAM(); +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)); @@ -318,16 +318,8 @@ void W_Seeker_Flac_Explode_use(entity this, entity actor, entity trigger) WITHSELF(this, W_Seeker_Flac_Explode(this)); } -void W_Seeker_Flac_Touch() -{ - SELFPARAM(); - PROJECTILE_TOUCH; - - W_Seeker_Flac_Explode(this); -} - -void W_Seeker_Fire_Flac(Weapon thiswep) -{SELFPARAM(); +void W_Seeker_Fire_Flac(Weapon thiswep, entity actor) +{entity this = actor; entity missile; vector f_diff; float c; @@ -397,8 +389,8 @@ entity W_Seeker_Tagged_Info(entity isowner, entity istarget) return world; } -void W_Seeker_Attack() -{SELFPARAM(); +void W_Seeker_Attack(entity actor) +{entity this = actor; entity tracker, closest_target; closest_target = world; @@ -417,7 +409,7 @@ void W_Seeker_Attack() if((!closest_target) || ((trace_fraction < 1) && (trace_ent != closest_target))) closest_target = world; - W_Seeker_Fire_Missile(WEP_SEEKER, '0 0 0', closest_target); + W_Seeker_Fire_Missile(WEP_SEEKER, actor, '0 0 0', closest_target); } void W_Seeker_Vollycontroller_Think(entity this) // TODO: Merge this with W_Seeker_Attack @@ -444,17 +436,17 @@ void W_Seeker_Vollycontroller_Think(entity this) // TODO: Merge this with W_Seek switch(c) { case 0: - WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, '-1.25 -3.75 0', own.enemy)); + WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, own, '-1.25 -3.75 0', own.enemy)); break; case 1: - WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, '+1.25 -3.75 0', own.enemy)); + WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, own, '+1.25 -3.75 0', own.enemy)); break; case 2: - WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, '-1.25 +3.75 0', own.enemy)); + WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, own, '-1.25 +3.75 0', own.enemy)); break; case 3: default: - WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, '+1.25 +3.75 0', own.enemy)); + WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, own, '+1.25 +3.75 0', own.enemy)); break; } @@ -562,8 +554,8 @@ void W_Seeker_Tag_Touch(entity this) return; } -void W_Seeker_Fire_Tag(Weapon thiswep) -{SELFPARAM(); +void W_Seeker_Fire_Tag(Weapon thiswep, entity actor) +{entity this = actor; entity missile; W_DecreaseAmmo(thiswep, self, WEP_CVAR(seeker, tag_ammo)); @@ -603,9 +595,9 @@ void W_Seeker_Fire_Tag(Weapon thiswep) // Begin: Genereal weapon functions // ============================ -METHOD(Seeker, wr_aim, void(entity thiswep)) +METHOD(Seeker, wr_aim, void(entity thiswep, entity actor)) { - SELFPARAM(); + 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); @@ -624,7 +616,7 @@ METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity { if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, missile_refire))) { - W_Seeker_Attack(); + W_Seeker_Attack(actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, missile_animtime), w_ready); } } @@ -632,7 +624,7 @@ METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity { if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, tag_refire))) { - W_Seeker_Fire_Tag(thiswep); + W_Seeker_Fire_Tag(thiswep, actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready); } } @@ -644,7 +636,7 @@ METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity { if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, tag_refire))) { - W_Seeker_Fire_Tag(thiswep); + W_Seeker_Fire_Tag(thiswep, actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready); } } @@ -652,7 +644,7 @@ METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity { if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, flac_refire))) { - W_Seeker_Fire_Flac(thiswep); + W_Seeker_Fire_Flac(thiswep, actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, flac_animtime), w_ready); } } @@ -690,8 +682,7 @@ METHOD(Seeker, wr_checkammo2, bool(entity thiswep, entity actor)) } METHOD(Seeker, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - SELFPARAM(); - W_Reload(self, min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND_RELOAD); + W_Reload(actor, min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND_RELOAD); } METHOD(Seeker, wr_suicidemessage, Notification(entity thiswep)) { @@ -708,9 +699,9 @@ METHOD(Seeker, wr_killmessage, Notification(entity thiswep)) #endif #ifdef CSQC -METHOD(Seeker, wr_impacteffect, void(entity thiswep)) +METHOD(Seeker, wr_impacteffect, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; vector org2; org2 = w_org + w_backoff * 6; if(w_deathtype & HITTYPE_BOUNCE) diff --git a/qcsrc/common/weapons/weapon/shockwave.qc b/qcsrc/common/weapons/weapon/shockwave.qc index 47d33fc5e5..a39e7697b9 100644 --- a/qcsrc/common/weapons/weapon/shockwave.qc +++ b/qcsrc/common/weapons/weapon/shockwave.qc @@ -276,11 +276,12 @@ float W_Shockwave_Attack_CheckSpread( } float W_Shockwave_Attack_IsVisible( + entity actor, entity head, vector nearest_on_line, vector sw_shotorg, vector attack_endpos) -{SELFPARAM(); +{entity this = actor; vector nearest_to_attacker = head.WarpZone_findradius_nearest; vector center = (head.origin + (head.mins + head.maxs) * 0.5); vector corner; @@ -339,8 +340,8 @@ float W_Shockwave_Attack_CheckHit( return true; } -void W_Shockwave_Send() -{SELFPARAM(); +void W_Shockwave_Send(entity actor) +{ WriteHeader(MSG_BROADCAST, TE_CSQC_SHOCKWAVEPARTICLE); WriteCoord(MSG_BROADCAST, w_shotorg.x); WriteCoord(MSG_BROADCAST, w_shotorg.y); @@ -351,11 +352,11 @@ void W_Shockwave_Send() WriteShort(MSG_BROADCAST, WEP_CVAR(shockwave, blast_distance)); WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_max), 255)); WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_min), 255)); - WriteByte(MSG_BROADCAST, etof(self)); + WriteByte(MSG_BROADCAST, etof(actor)); } -void W_Shockwave_Attack() -{SELFPARAM(); +void W_Shockwave_Attack(entity actor) +{entity this = actor; // declarations float multiplier, multiplier_from_accuracy, multiplier_from_distance; float final_damage; @@ -374,7 +375,7 @@ void W_Shockwave_Attack() //entity transform = WarpZone_trace_transform; // do the firing effect now - W_Shockwave_Send(); + W_Shockwave_Send(self); Damage_DamageInfo( attack_hitpos, WEP_CVAR(shockwave, blast_splash_damage), @@ -570,7 +571,7 @@ void W_Shockwave_Attack() 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(head, nearest_on_line, w_shotorg, attack_endpos))) + && (W_Shockwave_Attack_IsVisible(self, head, nearest_on_line, w_shotorg, attack_endpos))) { // calculate importance of distance and accuracy for this attack multiplier_from_accuracy = (1 - @@ -671,9 +672,9 @@ void W_Shockwave_Attack() } } -METHOD(Shockwave, wr_aim, void(entity thiswep)) +METHOD(Shockwave, wr_aim, void(entity thiswep, entity actor)) { - SELFPARAM(); + 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); } else @@ -687,7 +688,7 @@ METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponent { if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(shockwave, blast_animtime))) { - W_Shockwave_Attack(); + W_Shockwave_Attack(actor); actor.shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor(); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(shockwave, blast_animtime), w_ready); } @@ -853,7 +854,7 @@ void Net_ReadShockwaveParticle() shockwave.sw_time = time; } -METHOD(Shockwave, wr_impacteffect, void(entity thiswep)) +METHOD(Shockwave, wr_impacteffect, void(entity thiswep, entity actor)) { // handled by Net_ReadShockwaveParticle //vector org2; diff --git a/qcsrc/common/weapons/weapon/shotgun.qc b/qcsrc/common/weapons/weapon/shotgun.qc index 1cf1fe07f0..2440ea42ed 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qc +++ b/qcsrc/common/weapons/weapon/shotgun.qc @@ -58,8 +58,8 @@ REGISTER_WEAPON(SHOTGUN, shotgun, NEW(Shotgun)); #ifdef SVQC spawnfunc(weapon_shotgun) { weapon_defaultspawnfunc(this, WEP_SHOTGUN); } -void W_Shotgun_Attack(Weapon thiswep, float isprimary) -{SELFPARAM(); +void W_Shotgun_Attack(Weapon thiswep, entity actor, float isprimary) +{entity this = actor; float sc; entity flash; @@ -207,7 +207,7 @@ void W_Shotgun_Attack3_Frame2(Weapon thiswep, entity actor, .entity weaponentity } sound(actor, CH_WEAPON_SINGLE, SND_Null, VOL_BASE, ATTN_NORM); // kill previous sound - W_Shotgun_Attack(WEP_SHOTGUN, true); // actually is secondary, but we trick the last shot into playing full reload sound + W_Shotgun_Attack(WEP_SHOTGUN, actor, true); // actually is secondary, but we trick the last shot into playing full reload sound weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), w_ready); } void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity, int fire) @@ -220,15 +220,15 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity return; } - W_Shotgun_Attack(WEP_SHOTGUN, false); + W_Shotgun_Attack(WEP_SHOTGUN, actor, false); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame2); } .float shotgun_primarytime; -METHOD(Shotgun, wr_aim, void(entity thiswep)) +METHOD(Shotgun, wr_aim, void(entity thiswep, entity actor)) { - SELFPARAM(); + 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); else @@ -251,7 +251,7 @@ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentit { if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(shotgun, animtime))) { - W_Shotgun_Attack(thiswep, true); + W_Shotgun_Attack(thiswep, actor, true); actor.shotgun_primarytime = time + WEP_CVAR_PRI(shotgun, refire) * W_WeaponRateFactor(); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(shotgun, animtime), w_ready); } @@ -263,7 +263,7 @@ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentit { if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(shotgun, alt_animtime))) { - W_Shotgun_Attack(thiswep, false); + W_Shotgun_Attack(thiswep, actor, false); actor.shotgun_primarytime = time + WEP_CVAR_SEC(shotgun, alt_refire) * W_WeaponRateFactor(); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame1); } @@ -280,9 +280,9 @@ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentit weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shotgun_Attack2); } } -METHOD(Shotgun, wr_setup, void(entity thiswep)) +METHOD(Shotgun, wr_setup, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; self.ammo_field = ammo_none; } METHOD(Shotgun, wr_checkammo1, bool(entity thiswep, entity actor)) @@ -310,8 +310,7 @@ METHOD(Shotgun, wr_checkammo2, bool(entity thiswep, entity actor)) } METHOD(Shotgun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - SELFPARAM(); - W_Reload(self, WEP_CVAR_PRI(shotgun, ammo), SND_RELOAD); // WEAPONTODO + W_Reload(actor, WEP_CVAR_PRI(shotgun, ammo), SND_RELOAD); // WEAPONTODO } METHOD(Shotgun, wr_suicidemessage, Notification(entity thiswep)) { @@ -329,9 +328,9 @@ METHOD(Shotgun, wr_killmessage, Notification(entity thiswep)) #ifdef CSQC .float prevric; -METHOD(Shotgun, wr_impacteffect, void(entity thiswep)) +METHOD(Shotgun, wr_impacteffect, void(entity thiswep, entity actor)) { - SELFPARAM(); + 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) diff --git a/qcsrc/common/weapons/weapon/tuba.qc b/qcsrc/common/weapons/weapon/tuba.qc index 1c0a5bb8ef..3dd1c26289 100644 --- a/qcsrc/common/weapons/weapon/tuba.qc +++ b/qcsrc/common/weapons/weapon/tuba.qc @@ -309,8 +309,8 @@ void W_Tuba_NoteThink(entity this) }); } -void W_Tuba_NoteOn(float hittype) -{SELFPARAM(); +void W_Tuba_NoteOn(entity actor, float hittype) +{entity this = actor; vector o; float n; @@ -359,9 +359,8 @@ void W_Tuba_NoteOn(float hittype) #endif #ifdef SVQC -METHOD(Tuba, wr_aim, void(Tuba this)) +METHOD(Tuba, wr_aim, void(Tuba this, entity actor)) { - entity actor = self; // bots cannot play the Tuba well yet // I think they should start with the recorder first if (vdist((actor.origin - actor.enemy.origin), <, WEP_CVAR(tuba, radius))) @@ -378,13 +377,13 @@ METHOD(Tuba, wr_think, void(Tuba this, entity actor, .entity weaponentity, int f if (fire & 1) if (weapon_prepareattack(this, actor, weaponentity, false, WEP_CVAR(tuba, refire))) { - W_Tuba_NoteOn(0); + W_Tuba_NoteOn(actor, 0); weapon_thinkf(actor, weaponentity, WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready); } if (fire & 2) if (weapon_prepareattack(this, actor, weaponentity, true, WEP_CVAR(tuba, refire))) { - W_Tuba_NoteOn(HITTYPE_SECONDARY); + W_Tuba_NoteOn(actor, HITTYPE_SECONDARY); weapon_thinkf(actor, weaponentity, WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready); } if (actor.tuba_note) @@ -396,9 +395,8 @@ METHOD(Tuba, wr_think, void(Tuba this, entity actor, .entity weaponentity, int f } } -METHOD(Tuba, wr_setup, void(Tuba this)) +METHOD(Tuba, wr_setup, void(Tuba this, entity actor)) { - entity actor = self; actor.ammo_field = ammo_none; actor.tuba_instrument = 0; } diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index d0125ed342..4fd81eb309 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -167,8 +167,8 @@ NET_HANDLE(TE_CSQC_VAPORBEAMPARTICLE, bool isNew) spawnfunc(weapon_vaporizer) { weapon_defaultspawnfunc(this, WEP_VAPORIZER); } spawnfunc(weapon_minstanex) { spawnfunc_weapon_vaporizer(this); } -void W_RocketMinsta_Explosion(vector loc) -{SELFPARAM(); +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); entity dmgent = spawn(); @@ -178,8 +178,8 @@ void W_RocketMinsta_Explosion(vector loc) remove(dmgent); } -void W_Vaporizer_Attack(Weapon thiswep) -{SELFPARAM(); +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 float vaporizer_damage = ((WEP_CVAR_PRI(vaporizer, damage) > 0) ? WEP_CVAR_PRI(vaporizer, damage) : 10000); @@ -207,13 +207,13 @@ void W_Vaporizer_Attack(Weapon thiswep) if(autocvar_g_rm) if(!(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT))) - W_RocketMinsta_Explosion(trace_endpos); + W_RocketMinsta_Explosion(self, trace_endpos); W_DecreaseAmmo(thiswep, self, ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo))); } -void W_RocketMinsta_Laser_Explode () -{SELFPARAM(); +void W_RocketMinsta_Laser_Explode (entity this) +{ if(other.takedamage == DAMAGE_AIM) if(IS_PLAYER(other)) if(DIFF_TEAM(self.realowner, other)) @@ -229,7 +229,7 @@ void W_RocketMinsta_Laser_Explode () void W_RocketMinsta_Laser_Explode_use(entity this, entity actor, entity trigger) { - WITHSELF(this, W_RocketMinsta_Laser_Explode()); + WITHSELF(this, W_RocketMinsta_Laser_Explode(this)); } void W_RocketMinsta_Laser_Touch (entity this) @@ -240,8 +240,8 @@ void W_RocketMinsta_Laser_Touch (entity this) remove(self); } -void W_RocketMinsta_Attack2() -{SELFPARAM(); +void W_RocketMinsta_Attack2(entity actor) +{entity this = actor; makevectors(self.v_angle); entity proj; @@ -294,8 +294,8 @@ void W_RocketMinsta_Attack2() } } -void W_RocketMinsta_Attack3 () -{SELFPARAM(); +void W_RocketMinsta_Attack3 (entity actor) +{entity this = actor; makevectors(self.v_angle); entity proj; @@ -344,9 +344,9 @@ void W_RocketMinsta_Attack3 () } } -METHOD(Vaporizer, wr_aim, void(entity thiswep)) +METHOD(Vaporizer, wr_aim, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; if(self.(thiswep.ammo_field) > 0) PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 1, false); else @@ -365,7 +365,7 @@ METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponent { if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vaporizer, refire))) { - W_Vaporizer_Attack(thiswep); + W_Vaporizer_Attack(thiswep, actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready); } } @@ -381,13 +381,13 @@ METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponent actor.jump_interval = time + autocvar_g_rm_laser_refire; actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_delay; damage_goodhits = 0; - W_RocketMinsta_Attack2(); + W_RocketMinsta_Attack2(actor); } else if(rapid && actor.jump_interval2 <= time && actor.held_down) { actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_refire; damage_goodhits = 0; - W_RocketMinsta_Attack3(); + W_RocketMinsta_Attack3(actor); //weapon_thinkf(actor, WFRAME_FIRE2, autocvar_g_rm_laser_rapid_animtime, w_ready); } } @@ -426,9 +426,9 @@ METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponent else actor.held_down = false; } -METHOD(Vaporizer, wr_setup, void(entity thiswep)) +METHOD(Vaporizer, wr_setup, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; self.ammo_field = (thiswep.ammo_field); self.vaporizer_lasthit = 0; } @@ -447,14 +447,13 @@ METHOD(Vaporizer, wr_checkammo2, bool(entity thiswep, entity actor)) ammo_amount += actor.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo); return ammo_amount; } -METHOD(Vaporizer, wr_resetplayer, void(entity thiswep)) +METHOD(Vaporizer, wr_resetplayer, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; self.vaporizer_lasthit = 0; } METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - SELFPARAM(); float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)); float used_ammo; if(WEP_CVAR_SEC(vaporizer, ammo)) @@ -462,7 +461,7 @@ METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponen else used_ammo = vaporizer_ammo; - W_Reload(self, used_ammo, SND_RELOAD); + W_Reload(actor, used_ammo, SND_RELOAD); } METHOD(Vaporizer, wr_suicidemessage, Notification(entity thiswep)) { @@ -476,9 +475,9 @@ METHOD(Vaporizer, wr_killmessage, Notification(entity thiswep)) #endif #ifdef CSQC -METHOD(Vaporizer, wr_impacteffect, void(entity thiswep)) +METHOD(Vaporizer, wr_impacteffect, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; vector org2 = w_org + w_backoff * 6; if(w_deathtype & HITTYPE_SECONDARY) { diff --git a/qcsrc/common/weapons/weapon/vortex.qc b/qcsrc/common/weapons/weapon/vortex.qc index d0d0025ec2..6459ad7a8d 100644 --- a/qcsrc/common/weapons/weapon/vortex.qc +++ b/qcsrc/common/weapons/weapon/vortex.qc @@ -155,8 +155,8 @@ MUTATOR_HOOKFUNCTION(vortex_charge, GetPressedKeys) } } -void W_Vortex_Attack(Weapon thiswep, float issecondary) -{SELFPARAM(); +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); @@ -210,9 +210,9 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary) .float vortex_chargepool_pauseregen_finished; -METHOD(Vortex, wr_aim, void(entity thiswep)) +METHOD(Vortex, wr_aim, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; if(bot_aim(self, 1000000, 0, 1, false)) PHYS_INPUT_BUTTON_ATCK(self) = true; else @@ -242,7 +242,7 @@ METHOD(Vortex, wr_think, void(entity thiswep, entity actor, .entity weaponentity { if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vortex, refire))) { - W_Vortex_Attack(thiswep, 0); + W_Vortex_Attack(thiswep, actor, 0); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vortex, animtime), w_ready); } } @@ -314,17 +314,16 @@ METHOD(Vortex, wr_think, void(entity thiswep, entity actor, .entity weaponentity { if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(vortex, refire))) { - W_Vortex_Attack(thiswep, 1); + W_Vortex_Attack(thiswep, actor, 1); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(vortex, animtime), w_ready); } } } } } -METHOD(Vortex, wr_setup, void(entity thiswep)) +METHOD(Vortex, wr_setup, void(entity thiswep, entity actor)) { - SELFPARAM(); - self.vortex_lasthit = 0; + actor.vortex_lasthit = 0; } METHOD(Vortex, wr_checkammo1, bool(entity thiswep, entity actor)) { @@ -346,9 +345,9 @@ METHOD(Vortex, wr_checkammo2, bool(entity thiswep, entity actor)) return false; // zoom is not a fire mode } } -METHOD(Vortex, wr_resetplayer, void(entity thiswep)) +METHOD(Vortex, wr_resetplayer, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; if (WEP_CVAR(vortex, charge)) { if (WEP_CVAR_SEC(vortex, chargepool)) { self.vortex_chargepool_ammo = 1; @@ -359,8 +358,7 @@ METHOD(Vortex, wr_resetplayer, void(entity thiswep)) } METHOD(Vortex, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - SELFPARAM(); - W_Reload(self, min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), SND_RELOAD); + W_Reload(actor, min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), SND_RELOAD); } METHOD(Vortex, wr_suicidemessage, Notification(entity thiswep)) { @@ -374,9 +372,9 @@ METHOD(Vortex, wr_killmessage, Notification(entity thiswep)) #endif #ifdef CSQC -METHOD(Vortex, wr_impacteffect, void(entity thiswep)) +METHOD(Vortex, wr_impacteffect, void(entity thiswep, entity actor)) { - SELFPARAM(); + entity this = actor; vector org2 = w_org + w_backoff * 6; pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1); if(!w_issilent) diff --git a/qcsrc/server/bot/havocbot/havocbot.qc b/qcsrc/server/bot/havocbot/havocbot.qc index 3163c21f5c..2ddeb63918 100644 --- a/qcsrc/server/bot/havocbot/havocbot.qc +++ b/qcsrc/server/bot/havocbot/havocbot.qc @@ -107,7 +107,7 @@ void havocbot_ai(entity this) if(this.weapons) { Weapon w = PS(this).m_weapon; - w.wr_aim(w); + w.wr_aim(w, this); if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(this)) { PHYS_INPUT_BUTTON_ATCK(this) = false; diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index e9fbdbdc86..7fc618f4be 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -619,7 +619,7 @@ void PutClientInServer() // reset fields the weapons may use FOREACH(Weapons, true, LAMBDA( - it.wr_resetplayer(it); + it.wr_resetplayer(it, this); // reload all reloadable weapons if (it.spawnflags & WEP_FLAG_RELOADABLE) { this.weapon_load[it.m_id] = it.reloading_ammo; diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index b1ca51987a..85044c2740 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -556,7 +556,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, excess = frag_damage; Weapon wep = PS(this).m_weapon; - WITHSELF(this, wep.wr_playerdeath(wep)); + WITHSELF(this, wep.wr_playerdeath(wep, this)); RemoveGrapplingHook(this); @@ -637,7 +637,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, // reset fields the weapons may use just in case FOREACH(Weapons, it != WEP_Null, LAMBDA( - WITHSELF(this, it.wr_resetplayer(it)); + WITHSELF(this, it.wr_resetplayer(it, this)); for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { ATTACK_FINISHED_FOR(this, it.m_id, slot) = 0; diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index 3d4bb782f3..34a3d8a2aa 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -22,7 +22,7 @@ void race_InitSpectator() race_SendNextCheckpoint(msg_entity.enemy, 1); } -void W_Porto_Fail(float failhard); +void W_Porto_Fail(entity this, float failhard); float race_readTime(string map, float pos) { @@ -570,7 +570,7 @@ void checkpoint_passed(entity this, entity player) { // do not allow portalling through checkpoints trace_plane_normal = normalize(-1 * player.velocity); - WITHSELF(player, W_Porto_Fail(0)); + WITHSELF(player, W_Porto_Fail(player, 0)); return; } diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 97e008cc0e..d5a89b3a1e 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -469,7 +469,7 @@ void W_WeaponFrame(Player actor) actor.weaponname = newwep.mdl; actor.bulletcounter = 0; actor.ammo_field = newwep.ammo_field; - newwep.wr_setup(newwep); + newwep.wr_setup(newwep, actor); this.state = WS_RAISE; // set our clip load to the load of the weapon we switched to, if it's reloadable @@ -564,7 +564,7 @@ void W_WeaponFrame(Player actor) } else if (e) { - e.wr_gonethink(e); + e.wr_gonethink(e, actor); } } @@ -764,9 +764,9 @@ void W_Reload(entity actor, float sent_ammo_min, Sound sent_sound) actor.clip_load = actor.(weapon_load[PS(actor).m_weapon.m_id]) = -1; } -void W_DropEvent(.void(Weapon) event, entity player, float weapon_type, entity weapon_item) +void W_DropEvent(.void(Weapon, entity actor) event, entity player, float weapon_type, entity weapon_item) { Weapon w = Weapons_from(weapon_type); weapon_dropevent_item = weapon_item; - WITHSELF(player, w.event(w)); + WITHSELF(player, w.event(w, player)); } diff --git a/qcsrc/server/weapons/weaponsystem.qh b/qcsrc/server/weapons/weaponsystem.qh index 74d120150f..a43a40c2f9 100644 --- a/qcsrc/server/weapons/weaponsystem.qh +++ b/qcsrc/server/weapons/weaponsystem.qh @@ -14,7 +14,7 @@ void W_AttachToShotorg(entity actor, entity flash, vector offset); void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use); -void W_DropEvent(.void(Weapon) event, entity player, float weapon_type, entity weapon_item); +void W_DropEvent(.void(Weapon, entity actor) event, entity player, float weapon_type, entity weapon_item); void W_Reload(entity actor, float sent_ammo_min, Sound sent_sound); -- 2.39.2