]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Offhand: fix ammo consumption
authorTimePath <andrew.hardaker1995@gmail.com>
Tue, 29 Sep 2015 02:03:08 +0000 (12:03 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Tue, 29 Sep 2015 02:03:08 +0000 (12:03 +1000)
19 files changed:
qcsrc/common/weapons/weapon/crylink.qc
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/common/weapons/weapon/hlac.qc
qcsrc/common/weapons/weapon/hmg.qc
qcsrc/common/weapons/weapon/hook.qc
qcsrc/common/weapons/weapon/machinegun.qc
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/common/weapons/weapon/rifle.qc
qcsrc/common/weapons/weapon/rpc.qc
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/common/weapons/weapon/vortex.qc
qcsrc/server/weapons/selection.qc
qcsrc/server/weapons/weaponsystem.qc
qcsrc/server/weapons/weaponsystem.qh

index 902bcab4927ea6d10cc1e0c591c99584fd79afef..b4955ef608316755b3a465a649524acd5db26d6c 100644 (file)
@@ -341,7 +341,7 @@ void W_Crylink_Fadethink(void)
        remove(self);
 }
 
-void W_Crylink_Attack(void)
+void W_Crylink_Attack(Weapon thiswep)
 {SELFPARAM();
        float counter, shots;
        entity proj, prevproj, firstproj;
@@ -349,7 +349,7 @@ void W_Crylink_Attack(void)
        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);
@@ -450,7 +450,7 @@ void W_Crylink_Attack(void)
        }
 }
 
-void W_Crylink_Attack2(void)
+void W_Crylink_Attack2(Weapon thiswep)
 {SELFPARAM();
        float counter, shots;
        entity proj, prevproj, firstproj;
@@ -458,7 +458,7 @@ void W_Crylink_Attack2(void)
        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);
@@ -587,7 +587,7 @@ void W_Crylink_Attack2(void)
                                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);
                                }
                        }
@@ -597,7 +597,7 @@ void W_Crylink_Attack2(void)
                                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);
                                }
                        }
index c52693a6558af65aeef571c43d58f80fd8525d51..cfa94a2dbefa9e82a7f8e4fe75aea53f6cb6eddb 100644 (file)
@@ -337,12 +337,12 @@ void W_Devastator_Damage(entity inflictor, entity attacker, float damage, int de
                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);
@@ -533,7 +533,7 @@ void W_Devastator_Attack(void)
                                        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;
                                        }
index 5a23f8849c2aad63a8ddcde333a4e2845fd9d24c..dbcbb76b9d3c497cc12f3d07b9d36c4f378e016a 100644 (file)
@@ -245,11 +245,11 @@ void W_Electro_Bolt_Think(void)
        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,
@@ -345,9 +345,9 @@ void W_Electro_Orb_Damage(entity inflictor, entity attacker, float damage, int d
        }
 }
 
-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,
@@ -412,7 +412,7 @@ void W_Electro_CheckAttack(void)
        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;
@@ -476,7 +476,7 @@ void W_Electro_CheckAttack(void)
                        {
                                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);
                                }
                        }
@@ -485,7 +485,7 @@ void W_Electro_CheckAttack(void)
                                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();
index 9ca028450a49610473faa8b1fed1d0bc62fe6103..54e2496cfb9601e024f63a77ddfb20c6e5cddb7a 100644 (file)
@@ -123,11 +123,11 @@ void W_Hagar_Touch2(void)
        }
 }
 
-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));
 
@@ -166,11 +166,11 @@ void W_Hagar_Attack(void)
        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));
 
@@ -291,7 +291,7 @@ void W_Hagar_Attack2_Load_Release(void)
        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
 
@@ -319,7 +319,7 @@ void W_Hagar_Attack2_Load(void)
                        {
                                // 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);
 
@@ -337,7 +337,7 @@ void W_Hagar_Attack2_Load(void)
                        {
                                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
@@ -414,14 +414,14 @@ void W_Hagar_Attack2_Load(void)
                        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);
                                }
                        }
@@ -429,7 +429,7 @@ void W_Hagar_Attack2_Load(void)
                        {
                                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);
                                }
                        }
@@ -457,7 +457,7 @@ void W_Hagar_Attack2_Load(void)
 
                        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;
                        }
 
index 1c4b3a0187fee3855680df04faffab41d0a0b46e..ad21fd9ca8b775cec7053f195491c362de36debb 100644 (file)
@@ -67,12 +67,12 @@ void W_HLAC_Touch(void)
        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));
@@ -180,7 +180,7 @@ void W_HLAC_Attack_Frame(void)
                }
 
                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);
        }
@@ -190,11 +190,11 @@ void W_HLAC_Attack_Frame(void)
        }
 }
 
-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();
@@ -220,7 +220,7 @@ void W_HLAC_Attack2_Frame(void)
                                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);
                                }
                        }
@@ -229,7 +229,7 @@ void W_HLAC_Attack2_Frame(void)
                        {
                                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);
                                }
                        }
index bba7f127fcc37c6bc7f29b2dd399962aa59ace9a..bb35d6783f3991503a33dfd8a4ee80d35bf07584 100644 (file)
@@ -61,7 +61,7 @@ void W_HeavyMachineGun_Attack_Auto()
                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));
 
index 8e7afd53d5a51f71357342d76cac83c41b8c2cd5..68907915b90fe6e6e4f22ccec25a4c439c97c78e 100644 (file)
@@ -131,11 +131,11 @@ void W_Hook_Touch2(void)
        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();
@@ -191,7 +191,7 @@ void W_Hook_Attack2(void)
                                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);
                                }
@@ -201,7 +201,7 @@ void W_Hook_Attack2(void)
                        {
                                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);
                                }
                        }
@@ -234,7 +234,7 @@ void W_Hook_Attack2(void)
                                                {
                                                        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
                                                        }
index 784b9a43523ea181e3e3dc6aa9becec77a3677eb..a8437586f21ae84bd9c136089910d9c46a64c677 100644 (file)
@@ -104,7 +104,7 @@ void W_MachineGun_MuzzleFlash(void)
        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)
@@ -131,9 +131,9 @@ void W_MachineGun_Attack(int deathtype)
                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
@@ -154,7 +154,7 @@ void W_MachineGun_Attack_Frame(void)
                        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
@@ -180,7 +180,7 @@ void W_MachineGun_Attack_Auto(void)
                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)
@@ -271,7 +271,7 @@ void W_MachineGun_Attack_Burst(void)
                                                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();
@@ -284,7 +284,7 @@ void W_MachineGun_Attack_Burst(void)
                                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);
                                }
 
@@ -292,7 +292,7 @@ void W_MachineGun_Attack_Burst(void)
                                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);
                                }
                        }
index b6aa26343d5c46bcf02df965207efa7901404c9d..fb2cdc850d6a1eba56014c6fed488b40cd371159 100644 (file)
@@ -306,7 +306,7 @@ void W_MineLayer_Damage(entity inflictor, entity attacker, float damage, int dea
                W_PrepareExplosionByDamage(attacker, W_MineLayer_Explode);
 }
 
-void W_MineLayer_Attack(void)
+void W_MineLayer_Attack(Weapon thiswep)
 {SELFPARAM();
        entity mine;
        entity flash;
@@ -323,7 +323,7 @@ void W_MineLayer_Attack(void)
                }
        }
 
-       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);
@@ -511,7 +511,7 @@ float W_MineLayer_PlacedMines(float detonate)
                        {
                                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);
                                }
                        }
index 559c50310e8f41b388293f9dfb27df1a6fddf56b..893b0ae174dc5d18efff87eea1a5ef7e13296fde 100644 (file)
@@ -198,11 +198,11 @@ void W_Mortar_Grenade_Touch2(void)
        }
 }
 
-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
@@ -247,11 +247,11 @@ void W_Mortar_Attack(void)
        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
@@ -344,7 +344,7 @@ void W_Mortar_Attack2(void)
                        {
                                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);
                                }
                        }
@@ -367,7 +367,7 @@ void W_Mortar_Attack2(void)
                                }
                                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);
                                }
                        }
index 3d69e2d8f1af585fa2c0ddec3d60f605c8fa5061..8aad95ef6240dc40f66d077b16e38c0acfc88090 100644 (file)
@@ -53,11 +53,11 @@ void spawnfunc_weapon_rifle(void) { weapon_defaultspawnfunc(WEP_RIFLE.m_id); }
 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);
 
@@ -78,12 +78,12 @@ void W_Rifle_FireBullet(float pSpread, float pDamage, float pForce, float pSolid
 
 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;
index 836b4be33acb7dab2325fd7e9da1d1f91c7ea56d..d8e35351bea2921153d21fbdd8c9fb6629eb1fdf 100644 (file)
@@ -104,12 +104,12 @@ void W_RocketPropelledChainsaw_Think()
        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);
@@ -164,7 +164,7 @@ void W_RocketPropelledChainsaw_Attack (void)
                                {
                                        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);
                                        }
                                }
index 74be279bc308edd887a5f6332578011dbcc7ddbf..811231cca4a3b759658eb268c0ca3100ce3ead75 100644 (file)
@@ -245,11 +245,11 @@ void W_Seeker_Missile_Animate(void)
 }
 */
 
-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);
@@ -318,13 +318,13 @@ void W_Seeker_Flac_Touch(void)
        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)
@@ -410,7 +410,7 @@ void W_Seeker_Attack(void)
        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
@@ -436,17 +436,17 @@ void W_Seeker_Vollycontroller_Think(void) // TODO: Merge this with W_Seeker_Atta
        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;
        }
 
@@ -556,10 +556,10 @@ void W_Seeker_Tag_Touch(void)
        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));
 
@@ -628,7 +628,7 @@ void W_Seeker_Fire_Tag(void)
                                {
                                        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);
                                        }
                                }
@@ -640,7 +640,7 @@ void W_Seeker_Fire_Tag(void)
                                {
                                        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);
                                        }
                                }
@@ -648,7 +648,7 @@ void W_Seeker_Fire_Tag(void)
                                {
                                        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);
                                        }
                                }
index 578e9284cf796f308fb3d2e7479edb866f7f05a1..809542a483dadab6733a95791380e32af09f5cfe 100644 (file)
@@ -56,12 +56,12 @@ SHOTGUN_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 #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)
@@ -206,7 +206,7 @@ void W_Shotgun_Attack3_Frame2()
        }
 
        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()
@@ -219,7 +219,7 @@ 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);
 }
 
@@ -250,7 +250,7 @@ void W_Shotgun_Attack3_Frame1()
                                        {
                                                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);
                                                }
@@ -262,7 +262,7 @@ void W_Shotgun_Attack3_Frame1()
                                        {
                                                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);
                                                }
index 3cfbf3b38fcec971219c35e249707dd088f74ce0..957e721f194789faecf4200cee2947cf96f57c89 100644 (file)
@@ -71,7 +71,7 @@ void W_RocketMinsta_Explosion(vector loc)
        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);
@@ -105,7 +105,7 @@ void W_Vaporizer_Attack(void)
        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)
@@ -258,7 +258,7 @@ void W_RocketMinsta_Attack3 (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);
                                }
                        }
@@ -291,7 +291,7 @@ void W_RocketMinsta_Attack3 (void)
 
                                        // 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);
index a4e0fb5e046ed921f3560665da2ce4821fbfd6bd..2d09c17e8d262ae372cd09b05a1939667fdd3059 100644 (file)
@@ -78,7 +78,7 @@ void SendCSQCVortexBeamParticle(float charge) {
        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;
 
@@ -128,7 +128,7 @@ void W_Vortex_Attack(float issecondary)
        //beam and muzzle flash done on client
        SendCSQCVortexBeamParticle(charge);
 
-       W_DecreaseAmmo(myammo);
+       W_DecreaseAmmo(thiswep, myammo);
 }
 
 .float vortex_chargepool_pauseregen_finished;
@@ -165,7 +165,7 @@ void W_Vortex_Attack(float issecondary)
                                {
                                        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);
                                        }
                                }
@@ -237,7 +237,7 @@ void W_Vortex_Attack(float issecondary)
                                        {
                                                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);
                                                }
                                        }
index 7b5eb25ef45a6a22ac9c2c10c00ef30939c45958..afc445cb26d6fb5c8348a15e2c6c5abc04ecd887 100644 (file)
@@ -24,8 +24,8 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain)
        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;
 
index 56a92bb7792e78a6a8a7fe038fc07ed872f4c853..b682ab8fe1b6e568338ef76efe0c53fd51bb3d4e 100644 (file)
@@ -827,9 +827,8 @@ void W_AttachToShotorg(entity flash, vector offset)
        }
 }
 
-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)
index 41b382d971aa6794e30eac00124eee646e7ae446..8ee65bb2693cfed784c9c774327028f923265900 100644 (file)
@@ -22,7 +22,7 @@ float forbidWeaponUse(entity player);
 
 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);