remove(self);
}
-void W_Crylink_Attack(void)
+void W_Crylink_Attack(Weapon thiswep)
{SELFPARAM();
float counter, shots;
entity proj, prevproj, firstproj;
vector forward, right, up;
float maxdmg;
- W_DecreaseAmmo(WEP_CVAR_PRI(crylink, ammo));
+ W_DecreaseAmmo(thiswep, WEP_CVAR_PRI(crylink, ammo));
maxdmg = WEP_CVAR_PRI(crylink, damage) * WEP_CVAR_PRI(crylink, shots);
maxdmg *= 1 + WEP_CVAR_PRI(crylink, bouncedamagefactor) * WEP_CVAR_PRI(crylink, bounces);
}
}
-void W_Crylink_Attack2(void)
+void W_Crylink_Attack2(Weapon thiswep)
{SELFPARAM();
float counter, shots;
entity proj, prevproj, firstproj;
vector forward, right, up;
float maxdmg;
- W_DecreaseAmmo(WEP_CVAR_SEC(crylink, ammo));
+ W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(crylink, ammo));
maxdmg = WEP_CVAR_SEC(crylink, damage) * WEP_CVAR_SEC(crylink, shots);
maxdmg *= 1 + WEP_CVAR_SEC(crylink, bouncedamagefactor) * WEP_CVAR_SEC(crylink, bounces);
if(self.crylink_waitrelease != 1)
if(weapon_prepareattack(0, WEP_CVAR_PRI(crylink, refire)))
{
- W_Crylink_Attack();
+ W_Crylink_Attack(thiswep);
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(crylink, animtime), w_ready);
}
}
if(self.crylink_waitrelease != 2)
if(weapon_prepareattack(1, WEP_CVAR_SEC(crylink, refire)))
{
- W_Crylink_Attack2();
+ W_Crylink_Attack2(thiswep);
weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(crylink, animtime), w_ready);
}
}
W_PrepareExplosionByDamage(attacker, W_Devastator_Explode);
}
-void W_Devastator_Attack(void)
+void W_Devastator_Attack(Weapon thiswep)
{SELFPARAM();
entity missile;
entity flash;
- W_DecreaseAmmo(WEP_CVAR(devastator, ammo));
+ W_DecreaseAmmo(thiswep, WEP_CVAR(devastator, ammo));
W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 5, SND(ROCKET_FIRE), CH_WEAPON_A, WEP_CVAR(devastator, damage));
Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
if(self.rl_release || WEP_CVAR(devastator, guidestop))
if(weapon_prepareattack(0, WEP_CVAR(devastator, refire)))
{
- W_Devastator_Attack();
+ W_Devastator_Attack(thiswep);
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(devastator, animtime), w_ready);
self.rl_release = 0;
}
else { self.nextthink = self.ltime; }
}
-void W_Electro_Attack_Bolt(void)
+void W_Electro_Attack_Bolt(Weapon thiswep)
{SELFPARAM();
entity proj;
- W_DecreaseAmmo(WEP_CVAR_PRI(electro, ammo));
+ W_DecreaseAmmo(thiswep, WEP_CVAR_PRI(electro, ammo));
W_SetupShot_ProjectileSize(
self,
}
}
-void W_Electro_Attack_Orb(void)
+void W_Electro_Attack_Orb(Weapon thiswep)
{SELFPARAM();
- W_DecreaseAmmo(WEP_CVAR_SEC(electro, ammo));
+ W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(electro, ammo));
W_SetupShot_ProjectileSize(
self,
if(self.BUTTON_ATCK2)
if(weapon_prepareattack(1, -1))
{
- W_Electro_Attack_Orb();
+ W_Electro_Attack_Orb(WEP_ELECTRO);
self.electro_count -= 1;
weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
return;
{
if(weapon_prepareattack(0, WEP_CVAR_PRI(electro, refire)))
{
- W_Electro_Attack_Bolt();
+ W_Electro_Attack_Bolt(thiswep);
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
}
}
if(time >= self.electro_secondarytime)
if(weapon_prepareattack(1, WEP_CVAR_SEC(electro, refire)))
{
- W_Electro_Attack_Orb();
+ W_Electro_Attack_Orb(thiswep);
self.electro_count = WEP_CVAR_SEC(electro, count);
weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
self.electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor();
}
}
-void W_Hagar_Attack(void)
+void W_Hagar_Attack(Weapon thiswep)
{SELFPARAM();
entity missile;
- W_DecreaseAmmo(WEP_CVAR_PRI(hagar, ammo));
+ W_DecreaseAmmo(thiswep, WEP_CVAR_PRI(hagar, ammo));
W_SetupShot(self, false, 2, SND(HAGAR_FIRE), CH_WEAPON_A, WEP_CVAR_PRI(hagar, damage));
MUTATOR_CALLHOOK(EditProjectile, self, missile);
}
-void W_Hagar_Attack2(void)
+void W_Hagar_Attack2(Weapon thiswep)
{SELFPARAM();
entity missile;
- W_DecreaseAmmo(WEP_CVAR_SEC(hagar, ammo));
+ W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(hagar, ammo));
W_SetupShot(self, false, 2, SND(HAGAR_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage));
self.hagar_load = 0;
}
-void W_Hagar_Attack2_Load(void)
+void W_Hagar_Attack2_Load(Weapon thiswep)
{SELFPARAM();
// loadable hagar secondary attack, must always run each frame
{
// if we pressed primary fire while loading, unload all rockets and abort
self.weaponentity.state = WS_READY;
- W_DecreaseAmmo(WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo
+ W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo
self.hagar_load = 0;
sound(self, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM);
{
if(!self.hagar_loadblock && self.hagar_loadstep < time)
{
- W_DecreaseAmmo(WEP_CVAR_SEC(hagar, ammo));
+ W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(hagar, ammo));
self.weaponentity.state = WS_INUSE;
self.hagar_load += 1;
sound(self, CH_WEAPON_B, SND_HAGAR_LOAD, VOL_BASE * 0.8, ATTN_NORM); // sound is too loud according to most
loadable_secondary = (WEP_CVAR_SEC(hagar, load) && WEP_CVAR(hagar, secondary));
if(loadable_secondary)
- W_Hagar_Attack2_Load(); // must always run each frame
+ W_Hagar_Attack2_Load(thiswep); // must always run each frame
if(autocvar_g_balance_hagar_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) // forced reload
_WEP_ACTION(self.weapon, WR_RELOAD);
else if(fire1 && !self.hagar_load && !self.hagar_loadblock) // not while secondary is loaded or awaiting reset
{
if(weapon_prepareattack(0, WEP_CVAR_PRI(hagar, refire)))
{
- W_Hagar_Attack();
+ W_Hagar_Attack(thiswep);
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hagar, refire), w_ready);
}
}
{
if(weapon_prepareattack(1, WEP_CVAR_SEC(hagar, refire)))
{
- W_Hagar_Attack2();
+ W_Hagar_Attack2(thiswep);
weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(hagar, refire), w_ready);
}
}
if(self.hagar_load)
{
- W_DecreaseAmmo(WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo if necessary
+ W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo if necessary
self.hagar_load = 0;
}
remove(self);
}
-void W_HLAC_Attack(void)
+void W_HLAC_Attack(Weapon thiswep)
{SELFPARAM();
entity missile;
float spread;
- W_DecreaseAmmo(WEP_CVAR_PRI(hlac, ammo));
+ W_DecreaseAmmo(thiswep, WEP_CVAR_PRI(hlac, ammo));
spread = WEP_CVAR_PRI(hlac, spread_min) + (WEP_CVAR_PRI(hlac, spread_add) * self.misc_bulletcounter);
spread = min(spread,WEP_CVAR_PRI(hlac, spread_max));
}
ATTACK_FINISHED(self) = time + WEP_CVAR_PRI(hlac, refire) * W_WeaponRateFactor();
- W_HLAC_Attack();
+ W_HLAC_Attack(WEP_HLAC);
self.misc_bulletcounter = self.misc_bulletcounter + 1;
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
}
}
}
-void W_HLAC_Attack2_Frame(void)
+void W_HLAC_Attack2_Frame(Weapon thiswep)
{SELFPARAM();
float i;
- W_DecreaseAmmo(WEP_CVAR_SEC(hlac, ammo));
+ W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(hlac, ammo));
for(i=WEP_CVAR_SEC(hlac, shots);i>0;--i)
W_HLAC_Attack2();
if(weapon_prepareattack(0, WEP_CVAR_PRI(hlac, refire)))
{
self.misc_bulletcounter = 0;
- W_HLAC_Attack();
+ W_HLAC_Attack(thiswep);
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
}
}
{
if(weapon_prepareattack(1, WEP_CVAR_SEC(hlac, refire)))
{
- W_HLAC_Attack2_Frame();
+ W_HLAC_Attack2_Frame(thiswep);
weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready);
}
}
return;
}
- W_DecreaseAmmo(WEP_CVAR(hmg, ammo));
+ W_DecreaseAmmo(WEP_HMG, WEP_CVAR(hmg, ammo));
W_SetupShot (self, true, 0, SND(UZI_FIRE), CH_WEAPON_A, WEP_CVAR(hmg, damage));
self.use();
}
-void W_Hook_Attack2(void)
+void W_Hook_Attack2(Weapon thiswep)
{SELFPARAM();
entity gren;
- //W_DecreaseAmmo(WEP_CVAR_SEC(hook, ammo)); // WEAPONTODO: Figure out how to handle ammo with hook secondary (gravitybomb)
+ //W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(hook, ammo)); // WEAPONTODO: Figure out how to handle ammo with hook secondary (gravitybomb)
W_SetupShot(self, false, 4, SND(HOOKBOMB_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(hook, damage));
gren = spawn();
if(time > self.hook_refire)
if(weapon_prepareattack(0, -1))
{
- W_DecreaseAmmo(WEP_CVAR_PRI(hook, ammo));
+ W_DecreaseAmmo(thiswep, WEP_CVAR_PRI(hook, ammo));
self.hook_state |= HOOK_FIRING;
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hook, animtime), w_ready);
}
{
if(weapon_prepareattack(1, WEP_CVAR_SEC(hook, refire)))
{
- W_Hook_Attack2();
+ W_Hook_Attack2(thiswep);
weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(hook, animtime), w_ready);
}
}
{
if( self.ammo_fuel >= (time - self.hook_time_fueldecrease) * hooked_fuel )
{
- W_DecreaseAmmo((time - self.hook_time_fueldecrease) * hooked_fuel);
+ W_DecreaseAmmo(thiswep, (time - self.hook_time_fueldecrease) * hooked_fuel);
self.hook_time_fueldecrease = time;
// decrease next frame again
}
self.muzzle_flash.owner = self.muzzle_flash.realowner = self;
}
-void W_MachineGun_Attack(int deathtype)
+void W_MachineGun_Attack(Weapon thiswep, int deathtype)
{SELFPARAM();
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)
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);
if(self.misc_bulletcounter == 1)
- W_DecreaseAmmo(WEP_CVAR(machinegun, first_ammo));
+ W_DecreaseAmmo(thiswep, WEP_CVAR(machinegun, first_ammo));
else
- W_DecreaseAmmo(WEP_CVAR(machinegun, sustained_ammo));
+ W_DecreaseAmmo(thiswep, WEP_CVAR(machinegun, sustained_ammo));
}
// weapon frames
return;
}
self.misc_bulletcounter = self.misc_bulletcounter + 1;
- W_MachineGun_Attack(WEP_MACHINEGUN.m_id);
+ W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id);
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame);
}
else
return;
}
- W_DecreaseAmmo(WEP_CVAR(machinegun, sustained_ammo));
+ W_DecreaseAmmo(WEP_MACHINEGUN, WEP_CVAR(machinegun, sustained_ammo));
W_SetupShot(self, true, 0, SND(UZI_FIRE), CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage));
if(!autocvar_g_norecoil)
return false;
}
- W_DecreaseAmmo(WEP_CVAR(machinegun, burst_ammo));
+ W_DecreaseAmmo(thiswep, WEP_CVAR(machinegun, burst_ammo));
self.misc_bulletcounter = WEP_CVAR(machinegun, burst) * -1;
W_MachineGun_Attack_Burst();
if(weapon_prepareattack(0, 0))
{
self.misc_bulletcounter = 1;
- W_MachineGun_Attack(WEP_MACHINEGUN.m_id); // sets attack_finished
+ W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id); // sets attack_finished
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame);
}
if(weapon_prepareattack(1, 0))
{
self.misc_bulletcounter = 1;
- W_MachineGun_Attack(WEP_MACHINEGUN.m_id | HITTYPE_SECONDARY); // sets attack_finished
+ W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id | HITTYPE_SECONDARY); // sets attack_finished
weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(machinegun, first_refire), w_ready);
}
}
W_PrepareExplosionByDamage(attacker, W_MineLayer_Explode);
}
-void W_MineLayer_Attack(void)
+void W_MineLayer_Attack(Weapon thiswep)
{SELFPARAM();
entity mine;
entity flash;
}
}
- W_DecreaseAmmo(WEP_CVAR(minelayer, ammo));
+ W_DecreaseAmmo(thiswep, WEP_CVAR(minelayer, ammo));
W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', false, 5, SND(MINE_FIRE), CH_WEAPON_A, WEP_CVAR(minelayer, damage));
Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
{
if(weapon_prepareattack(0, WEP_CVAR(minelayer, refire)))
{
- W_MineLayer_Attack();
+ W_MineLayer_Attack(thiswep);
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(minelayer, animtime), w_ready);
}
}
}
}
-void W_Mortar_Attack(void)
+void W_Mortar_Attack(Weapon thiswep)
{SELFPARAM();
entity gren;
- W_DecreaseAmmo(WEP_CVAR_PRI(mortar, ammo));
+ W_DecreaseAmmo(thiswep, WEP_CVAR_PRI(mortar, ammo));
W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 4, SND(GRENADE_FIRE), CH_WEAPON_A, WEP_CVAR_PRI(mortar, damage));
w_shotdir = v_forward; // no TrueAim for grenades please
MUTATOR_CALLHOOK(EditProjectile, self, gren);
}
-void W_Mortar_Attack2(void)
+void W_Mortar_Attack2(Weapon thiswep)
{SELFPARAM();
entity gren;
- W_DecreaseAmmo(WEP_CVAR_SEC(mortar, ammo));
+ W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(mortar, ammo));
W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 4, SND(GRENADE_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(mortar, damage));
w_shotdir = v_forward; // no TrueAim for grenades please
{
if(weapon_prepareattack(0, WEP_CVAR_PRI(mortar, refire)))
{
- W_Mortar_Attack();
+ W_Mortar_Attack(thiswep);
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(mortar, animtime), w_ready);
}
}
}
else if(weapon_prepareattack(1, WEP_CVAR_SEC(mortar, refire)))
{
- W_Mortar_Attack2();
+ W_Mortar_Attack2(thiswep);
weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(mortar, animtime), w_ready);
}
}
void spawnfunc_weapon_campingrifle(void) { spawnfunc_weapon_rifle(); }
void spawnfunc_weapon_sniperrifle(void) { spawnfunc_weapon_rifle(); }
-void W_Rifle_FireBullet(float pSpread, float pDamage, float pForce, float pSolidPenetration, float pAmmo, int deathtype, float pTracer, float pShots, string pSound)
+void W_Rifle_FireBullet(Weapon thiswep, float pSpread, float pDamage, float pForce, float pSolidPenetration, float pAmmo, int deathtype, float pTracer, float pShots, string pSound)
{SELFPARAM();
float i;
- W_DecreaseAmmo(pAmmo);
+ W_DecreaseAmmo(thiswep, pAmmo);
W_SetupShot(self, true, 2, pSound, CH_WEAPON_A, pDamage * pShots);
void W_Rifle_Attack(void)
{
- W_Rifle_FireBullet(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));
}
void W_Rifle_Attack2(void)
{
- W_Rifle_FireBullet(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));
}
.void(void) rifle_bullethail_attackfunc;
self.nextthink = time;
}
-void W_RocketPropelledChainsaw_Attack (void)
+void W_RocketPropelledChainsaw_Attack (Weapon thiswep)
{SELFPARAM();
entity missile = spawn(); //WarpZone_RefSys_SpawnSameRefSys(self);
entity flash = spawn ();
- W_DecreaseAmmo(WEP_CVAR(rpc, ammo));
+ W_DecreaseAmmo(thiswep, WEP_CVAR(rpc, ammo));
W_SetupShot_ProjectileSize (self, '-3 -3 -3', '3 3 3', false, 5, SND(ROCKET_FIRE), CH_WEAPON_A, WEP_CVAR(rpc, damage));
Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
PROJECTILE_MAKETRIGGER(missile);
{
if(weapon_prepareattack(0, WEP_CVAR(rpc, refire)))
{
- W_RocketPropelledChainsaw_Attack();
+ W_RocketPropelledChainsaw_Attack(thiswep);
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(rpc, animtime), w_ready);
}
}
}
*/
-void W_Seeker_Fire_Missile(vector f_diff, entity m_target)
+void W_Seeker_Fire_Missile(Weapon thiswep, vector f_diff, entity m_target)
{SELFPARAM();
entity missile;
- W_DecreaseAmmo(WEP_CVAR(seeker, missile_ammo));
+ W_DecreaseAmmo(thiswep, WEP_CVAR(seeker, missile_ammo));
makevectors(self.v_angle);
W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND(SEEKER_FIRE), CH_WEAPON_A, 0);
W_Seeker_Flac_Explode();
}
-void W_Seeker_Fire_Flac(void)
+void W_Seeker_Fire_Flac(Weapon thiswep)
{SELFPARAM();
entity missile;
vector f_diff;
float c;
- W_DecreaseAmmo(WEP_CVAR(seeker, flac_ammo));
+ W_DecreaseAmmo(thiswep, WEP_CVAR(seeker, flac_ammo));
c = self.bulletcounter % 4;
switch(c)
if((!closest_target) || ((trace_fraction < 1) && (trace_ent != closest_target)))
closest_target = world;
- W_Seeker_Fire_Missile('0 0 0', closest_target);
+ W_Seeker_Fire_Missile(WEP_SEEKER, '0 0 0', closest_target);
}
void W_Seeker_Vollycontroller_Think(void) // TODO: Merge this with W_Seeker_Attack
switch(c)
{
case 0:
- W_Seeker_Fire_Missile('-1.25 -3.75 0', self.enemy);
+ W_Seeker_Fire_Missile(WEP_SEEKER, '-1.25 -3.75 0', self.enemy);
break;
case 1:
- W_Seeker_Fire_Missile('+1.25 -3.75 0', self.enemy);
+ W_Seeker_Fire_Missile(WEP_SEEKER, '+1.25 -3.75 0', self.enemy);
break;
case 2:
- W_Seeker_Fire_Missile('-1.25 +3.75 0', self.enemy);
+ W_Seeker_Fire_Missile(WEP_SEEKER, '-1.25 +3.75 0', self.enemy);
break;
case 3:
default:
- W_Seeker_Fire_Missile('+1.25 +3.75 0', self.enemy);
+ W_Seeker_Fire_Missile(WEP_SEEKER, '+1.25 +3.75 0', self.enemy);
break;
}
return;
}
-void W_Seeker_Fire_Tag(void)
+void W_Seeker_Fire_Tag(Weapon thiswep)
{SELFPARAM();
entity missile;
- W_DecreaseAmmo(WEP_CVAR(seeker, tag_ammo));
+ W_DecreaseAmmo(thiswep, WEP_CVAR(seeker, tag_ammo));
W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND(TAG_FIRE), CH_WEAPON_A, WEP_CVAR(seeker, missile_damage) * WEP_CVAR(seeker, missile_count));
{
if(weapon_prepareattack(0, WEP_CVAR(seeker, tag_refire)))
{
- W_Seeker_Fire_Tag();
+ W_Seeker_Fire_Tag(thiswep);
weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
}
}
{
if(weapon_prepareattack(0, WEP_CVAR(seeker, tag_refire)))
{
- W_Seeker_Fire_Tag();
+ W_Seeker_Fire_Tag(thiswep);
weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
}
}
{
if(weapon_prepareattack(0, WEP_CVAR(seeker, flac_refire)))
{
- W_Seeker_Fire_Flac();
+ W_Seeker_Fire_Flac(thiswep);
weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(seeker, flac_animtime), w_ready);
}
}
#ifdef SVQC
void spawnfunc_weapon_shotgun(void) { weapon_defaultspawnfunc(WEP_SHOTGUN.m_id); }
-void W_Shotgun_Attack(float isprimary)
+void W_Shotgun_Attack(Weapon thiswep, float isprimary)
{SELFPARAM();
float sc;
entity flash;
- W_DecreaseAmmo(WEP_CVAR_PRI(shotgun, ammo));
+ W_DecreaseAmmo(thiswep, WEP_CVAR_PRI(shotgun, ammo));
W_SetupShot(self, true, 5, SND(SHOTGUN_FIRE), ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), WEP_CVAR_PRI(shotgun, damage) * WEP_CVAR_PRI(shotgun, bullets));
for(sc = 0;sc < WEP_CVAR_PRI(shotgun, bullets);sc = sc + 1)
}
sound(self, CH_WEAPON_SINGLE, SND_Null, VOL_BASE, ATTN_NORM); // kill previous sound
- W_Shotgun_Attack(true); // actually is secondary, but we trick the last shot into playing full reload sound
+ W_Shotgun_Attack(WEP_SHOTGUN, true); // actually is secondary, but we trick the last shot into playing full reload sound
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), w_ready);
}
void W_Shotgun_Attack3_Frame1()
return;
}
- W_Shotgun_Attack(false);
+ W_Shotgun_Attack(WEP_SHOTGUN, false);
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame2);
}
{
if(weapon_prepareattack(0, WEP_CVAR_PRI(shotgun, animtime)))
{
- W_Shotgun_Attack(true);
+ W_Shotgun_Attack(thiswep, true);
self.shotgun_primarytime = time + WEP_CVAR_PRI(shotgun, refire) * W_WeaponRateFactor();
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(shotgun, animtime), w_ready);
}
{
if(weapon_prepareattack(0, WEP_CVAR_SEC(shotgun, alt_animtime)))
{
- W_Shotgun_Attack(false);
+ W_Shotgun_Attack(thiswep, false);
self.shotgun_primarytime = time + WEP_CVAR_SEC(shotgun, alt_refire) * W_WeaponRateFactor();
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame1);
}
remove(dmgent);
}
-void W_Vaporizer_Attack(void)
+void W_Vaporizer_Attack(Weapon thiswep)
{SELFPARAM();
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(!(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT)))
W_RocketMinsta_Explosion(trace_endpos);
- W_DecreaseAmmo(((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)));
+ W_DecreaseAmmo(thiswep, ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)));
}
void W_RocketMinsta_Laser_Explode (void)
{
if(weapon_prepareattack(0, WEP_CVAR_PRI(vaporizer, refire)))
{
- W_Vaporizer_Attack();
+ W_Vaporizer_Attack(thiswep);
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
}
}
// decrease ammo for the laser?
if(WEP_CVAR_SEC(vaporizer, ammo))
- W_DecreaseAmmo(WEP_CVAR_SEC(vaporizer, ammo));
+ W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(vaporizer, ammo));
// ugly instagib hack to reuse the fire mode of the laser
makevectors(self.v_angle);
WriteByte(MSG_BROADCAST, bound(0, 255 * charge, 255));
}
-void W_Vortex_Attack(float issecondary)
+void W_Vortex_Attack(Weapon thiswep, float issecondary)
{SELFPARAM();
float mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, myammo, charge;
//beam and muzzle flash done on client
SendCSQCVortexBeamParticle(charge);
- W_DecreaseAmmo(myammo);
+ W_DecreaseAmmo(thiswep, myammo);
}
.float vortex_chargepool_pauseregen_finished;
{
if(weapon_prepareattack(0, WEP_CVAR_PRI(vortex, refire)))
{
- W_Vortex_Attack(0);
+ W_Vortex_Attack(thiswep, 0);
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(vortex, animtime), w_ready);
}
}
{
if(weapon_prepareattack(0, WEP_CVAR_SEC(vortex, refire)))
{
- W_Vortex_Attack(1);
+ W_Vortex_Attack(thiswep, 1);
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_SEC(vortex, animtime), w_ready);
}
}
if(time < self.hasweapon_complain_spam)
complain = 0;
- // ignore hook button when using nades without hook
- if (autocvar_g_nades && cl.offhand != OFFHAND_HOOK)
+ // ignore hook button when using other offhand equipment
+ if (cl.offhand != OFFHAND_HOOK)
if (wpn == WEP_HOOK.m_id && !((cl.weapons | weaponsInMap) & WepSet_FromWeapon(wpn)))
complain = 0;
}
}
-void W_DecreaseAmmo(float ammo_use)
+void W_DecreaseAmmo(Weapon wep, float ammo_use)
{SELFPARAM();
- entity wep = get_weaponinfo(self.weapon);
if(cvar("g_overkill"))
if(self.ok_use_ammocharge)
void W_AttachToShotorg(entity flash, vector offset);
-void W_DecreaseAmmo(float ammo_use);
+void W_DecreaseAmmo(Weapon wep, float ammo_use);
void W_DropEvent(float event, entity player, float weapon_type, entity weapon_item);