if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
{
if(!MUTATOR_CALLHOOK(Weapon_ImpactEffect, hitwep))
- hitwep.wr_impacteffect(hitwep);
+ hitwep.wr_impacteffect(hitwep, this);
}
}
}
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));
}
}
}
-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);
{
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);
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
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
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
#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);
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);
}
#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);
#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))
{
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");
}
}
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 */
/** (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) */
/** (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 */
/** (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)) {
//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);
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)
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));
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)
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);
}
}
-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(
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));
{
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)
{
{
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);
}
}
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 )
{
#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;
}
}
-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))
}
}
-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;
}
#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);
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;
}
}
-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;
}
}
-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
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);
}
}
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);
}
}
}
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))
{
}
#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)
.entity lastrocket;
-void W_Devastator_Unregister()
-{SELFPARAM();
+void W_Devastator_Unregister(entity this)
+{
if(self.realowner && self.realowner.lastrocket == self)
{
self.realowner.lastrocket = world;
void W_Devastator_Explode(entity this)
{
- W_Devastator_Unregister();
+ W_Devastator_Unregister(self);
if(other.takedamage == DAMAGE_AIM)
if(IS_PLAYER(other))
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;
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)
{
: (vdist(NearestPointOnBox(self.realowner, self.origin) - self.origin, >, WEP_CVAR(devastator, remote_radius))) // safety device
)
{
- W_Devastator_DoRemoteExplode(weaponentity);
+ W_Devastator_DoRemoteExplode(self, weaponentity);
}
}
}
.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)
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);
}
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;
}
#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!
}
}
#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!
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;
}
}
}
}
-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))
{
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))
{
#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);
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))
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)
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));
{
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);
}
}
-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(
}
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;
.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)
{
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);
}
}
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();
}
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))
{
#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)
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;
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;
}
}
}
-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));
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);
}
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;
}
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;
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)
{
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))
{
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))
#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)
{
// 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);
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);
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)
}
}
-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));
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));
}
.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;
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)
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
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();
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
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);
}
{
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)
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);
}
#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);
remove(self);
}
-void W_HLAC_Attack(Weapon thiswep)
-{SELFPARAM();
+void W_HLAC_Attack(Weapon thiswep, entity actor)
+{entity this = actor;
entity missile;
float spread;
MUTATOR_CALLHOOK(EditProjectile, self, missile);
}
-void W_HLAC_Attack2()
-{SELFPARAM();
+void W_HLAC_Attack2(entity actor)
+{entity this = actor;
entity missile;
float spread;
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);
}
}
}
-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)
{
}
}
-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))
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);
}
}
{
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);
}
}
}
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))
{
#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);
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))
// 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;
#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);
}
-void W_MachineGun_MuzzleFlash()
-{SELFPARAM();
+void W_MachineGun_MuzzleFlash(entity actor)
+{entity this = actor;
if(self.muzzle_flash == world)
self.muzzle_flash = spawn();
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)
{
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
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
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
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
}
-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
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);
}
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);
}
}
}
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))
{
#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);
#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
remove(self);
}
-void W_MineLayer_DoRemoteExplode()
-{SELFPARAM();
+void W_MineLayer_DoRemoteExplode(entity this)
+{
self.event_damage = func_null;
self.takedamage = DAMAGE_NO;
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)
{
// explode if it's time to
if(self.mine_time && time >= self.mine_time)
{
- W_MineLayer_ProximityExplode();
+ W_MineLayer_ProximityExplode(self);
return;
}
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)
}
else
{
- W_MineLayer_Stick(other);
+ W_MineLayer_Stick(self, other);
}
}
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;
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;
{
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);
}
}
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))
{
#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);
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))
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))
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)
{
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)
}
}
-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));
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));
.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
{
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);
}
}
}
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);
}
}
}
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))
{
#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);
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");
}
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");
{
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));
}
}
if(self.realowner.playerid != self.playerid)
remove(self);
else
- W_Porto_Fail(0);
+ W_Porto_Fail(self, 0);
}
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);
}
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)
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)
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
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);
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))
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);
}
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);
}
}
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);
}
}
// 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
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);
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;
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
}
}
-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
.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))
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)
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);
}
}
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))
{
#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);
}
*/
-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));
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;
return world;
}
-void W_Seeker_Attack()
-{SELFPARAM();
+void W_Seeker_Attack(entity actor)
+{entity this = actor;
entity tracker, closest_target;
closest_target = world;
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
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;
}
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));
// 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);
{
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);
}
}
{
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);
}
}
{
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);
}
}
{
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);
}
}
}
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))
{
#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)
}
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;
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);
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;
//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),
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 -
}
}
-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
{
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);
}
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;
#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;
}
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)
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
{
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);
}
{
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);
}
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))
}
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))
{
#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)
});
}
-void W_Tuba_NoteOn(float hittype)
-{SELFPARAM();
+void W_Tuba_NoteOn(entity actor, float hittype)
+{entity this = actor;
vector o;
float n;
#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)))
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)
}
}
-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;
}
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();
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);
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))
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)
remove(self);
}
-void W_RocketMinsta_Attack2()
-{SELFPARAM();
+void W_RocketMinsta_Attack2(entity actor)
+{entity this = actor;
makevectors(self.v_angle);
entity proj;
}
}
-void W_RocketMinsta_Attack3 ()
-{SELFPARAM();
+void W_RocketMinsta_Attack3 (entity actor)
+{entity this = actor;
makevectors(self.v_angle);
entity proj;
}
}
-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
{
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);
}
}
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);
}
}
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;
}
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))
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))
{
#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)
{
}
}
-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);
.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
{
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);
}
}
{
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))
{
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;
}
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))
{
#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)
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;
// 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;
excess = frag_damage;
Weapon wep = PS(this).m_weapon;
- WITHSELF(this, wep.wr_playerdeath(wep));
+ WITHSELF(this, wep.wr_playerdeath(wep, this));
RemoveGrapplingHook(this);
// 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;
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)
{
{
// 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;
}
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
}
else if (e)
{
- e.wr_gonethink(e);
+ e.wr_gonethink(e, actor);
}
}
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));
}
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);