]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix DecreaseAmmo usage
authorSamual Lenks <samual@xonotic.org>
Wed, 11 Dec 2013 00:47:09 +0000 (19:47 -0500)
committerSamual Lenks <samual@xonotic.org>
Wed, 11 Dec 2013 00:47:09 +0000 (19:47 -0500)
14 files changed:
qcsrc/common/weapons/w_crylink.qc
qcsrc/common/weapons/w_devastator.qc
qcsrc/common/weapons/w_electro.qc
qcsrc/common/weapons/w_hagar.qc
qcsrc/common/weapons/w_hlac.qc
qcsrc/common/weapons/w_hook.qc
qcsrc/common/weapons/w_machinegun.qc
qcsrc/common/weapons/w_minelayer.qc
qcsrc/common/weapons/w_minstanex.qc
qcsrc/common/weapons/w_mortar.qc
qcsrc/common/weapons/w_nex.qc
qcsrc/common/weapons/w_rifle.qc
qcsrc/common/weapons/w_seeker.qc
qcsrc/server/weapons/weaponsystem.qc

index 3f8382864069f7e35622357a33298bc54d1e51ca..928381ce611c7a39e52727656091107bae0715dd 100644 (file)
@@ -341,7 +341,7 @@ void W_Crylink_Attack (void)
        vector forward, right, up;
        float maxdmg;
 
-       W_DecreaseAmmo(ammo_cells, WEP_CVAR_PRI(crylink, ammo), autocvar_g_balance_crylink_reload_ammo);
+       W_DecreaseAmmo(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_Attack2 (void)
        vector forward, right, up;
        float maxdmg;
 
-       W_DecreaseAmmo(ammo_cells, WEP_CVAR_SEC(crylink, ammo), autocvar_g_balance_crylink_reload_ammo);
+       W_DecreaseAmmo(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);
index 3744ff81a877f3c592b4cc1eb3e6b77fa6918a3f..15d6c406fdc8697072d1bd6fe36e56128e46a4c1 100644 (file)
@@ -262,7 +262,7 @@ void W_Devastator_Attack (void)
        entity missile;
        entity flash;
 
-       W_DecreaseAmmo(ammo_rockets, WEP_CVAR(devastator, ammo), WEP_CVAR(devastator, reload_ammo));
+       W_DecreaseAmmo(WEP_CVAR(devastator, ammo));
 
        W_SetupShot_ProjectileSize (self, '-3 -3 -3', '3 3 3', FALSE, 5, "weapons/rocket_fire.wav", CH_WEAPON_A, WEP_CVAR(devastator, damage));
        pointparticles(particleeffectnum("rocketlauncher_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
index 5b30a65dcf670a0c141f4b44b7a63534295a1185..08c2f8ac04f5298bfa3339184a23f27c0e40c88f 100644 (file)
@@ -241,7 +241,7 @@ void W_Electro_Attack_Bolt(void)
 {
        entity proj;
 
-       W_DecreaseAmmo(ammo_cells, WEP_CVAR_PRI(electro, ammo), autocvar_g_balance_electro_reload_ammo);//weapontodo
+       W_DecreaseAmmo(WEP_CVAR_PRI(electro, ammo));
 
        W_SetupShot_ProjectileSize(self, '0 0 -3', '0 0 -3', FALSE, 2, "weapons/electro_fire.wav", CH_WEAPON_A, WEP_CVAR_PRI(electro, damage));
 
@@ -330,7 +330,7 @@ void W_Electro_Orb_Damage(entity inflictor, entity attacker, float damage, float
 
 void W_Electro_Attack_Orb(void)
 {
-       W_DecreaseAmmo(ammo_cells, WEP_CVAR_SEC(electro, ammo), autocvar_g_balance_electro_reload_ammo);//weapontodo
+       W_DecreaseAmmo(WEP_CVAR_SEC(electro, ammo));
 
        W_SetupShot_ProjectileSize(self, '0 0 -4', '0 0 -4', FALSE, 2, "weapons/electro_fire2.wav", CH_WEAPON_A, WEP_CVAR_SEC(electro, damage));
 
index 20e7b7b90ba346aec13c8e6847b626a4f26fed8c..4b55578524b4b10a18751aafbcede7650fba2d8f 100644 (file)
@@ -119,7 +119,7 @@ void W_Hagar_Attack (void)
 {
        entity missile;
 
-       W_DecreaseAmmo(ammo_rockets, WEP_CVAR_PRI(hagar, ammo), autocvar_g_balance_hagar_reload_ammo);
+       W_DecreaseAmmo(WEP_CVAR_PRI(hagar, ammo));
 
        W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav", CH_WEAPON_A, WEP_CVAR_PRI(hagar, damage));
 
@@ -162,7 +162,7 @@ void W_Hagar_Attack2 (void)
 {
        entity missile;
 
-       W_DecreaseAmmo(ammo_rockets, WEP_CVAR_SEC(hagar, ammo), autocvar_g_balance_hagar_reload_ammo);
+       W_DecreaseAmmo(WEP_CVAR_SEC(hagar, ammo));
 
        W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage));
 
@@ -307,7 +307,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(ammo_rockets, WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1, autocvar_g_balance_hagar_reload_ammo); // give back ammo
+                               W_DecreaseAmmo(WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo
                                self.hagar_load = 0;
                                sound(self, CH_WEAPON_A, "weapons/hagar_beep.wav", VOL_BASE, ATTN_NORM);
 
@@ -325,7 +325,7 @@ void W_Hagar_Attack2_Load (void)
                        {
                                if(!self.hagar_loadblock && self.hagar_loadstep < time)
                                {
-                                       W_DecreaseAmmo(ammo_rockets, WEP_CVAR_SEC(hagar, ammo), autocvar_g_balance_hagar_reload_ammo);
+                                       W_DecreaseAmmo(WEP_CVAR_SEC(hagar, ammo));
                                        self.weaponentity.state = WS_INUSE;
                                        self.hagar_load += 1;
                                        sound(self, CH_WEAPON_B, "weapons/hagar_load.wav", VOL_BASE * 0.8, ATTN_NORM); // sound is too loud according to most
@@ -456,7 +456,7 @@ float w_hagar(float req)
 
                        if(self.hagar_load)
                        {
-                               W_DecreaseAmmo(ammo_rockets, WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1, autocvar_g_balance_hagar_reload_ammo); // give back ammo if necessary
+                               W_DecreaseAmmo(WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo if necessary
                                self.hagar_load = 0;
                        }
                        
index d4e4b3136d2de340f122477f297eed0ce0250cec..d324142ab90b9375ccf2e203e9dd7349b9076b3e 100644 (file)
@@ -64,7 +64,7 @@ void W_HLAC_Attack (void)
        entity missile;
     float spread;
 
-       W_DecreaseAmmo(ammo_cells, WEP_CVAR_PRI(hlac, ammo), autocvar_g_balance_hlac_reload_ammo);
+       W_DecreaseAmmo(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));
@@ -156,7 +156,7 @@ void W_HLAC_Attack2 (void)
 {
     float i;
 
-       W_DecreaseAmmo(ammo_cells, WEP_CVAR_SEC(hlac, ammo), autocvar_g_balance_hlac_reload_ammo);
+       W_DecreaseAmmo(WEP_CVAR_SEC(hlac, ammo));
 
     for(i=WEP_CVAR_SEC(hlac, shots);i>0;--i)
         W_HLAC_Attack2f();
index 8a5cc0531499b75aa25dd4e477a3aa13238f042e..5310be53602e50addf68fd58f07b5dfa5d36a4c3 100644 (file)
@@ -129,7 +129,7 @@ void W_Hook_Attack2()
 {
        entity gren;
 
-       W_DecreaseAmmo(ammo_cells, WEP_CVAR_SEC(hook, ammo), FALSE);
+       W_DecreaseAmmo(WEP_CVAR_SEC(hook, ammo));
        W_SetupShot (self, FALSE, 4, "weapons/hookbomb_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(hook, damage));
 
        gren = spawn ();
@@ -191,7 +191,7 @@ float w_hook(float req)
                                if (time > self.hook_refire)
                                if (weapon_prepareattack(0, -1))
                                {
-                                       W_DecreaseAmmo(ammo_fuel, WEP_CVAR_PRI(hook, ammo), FALSE);
+                                       W_DecreaseAmmo(WEP_CVAR_PRI(hook, ammo));
                                        self.hook_state |= HOOK_FIRING;
                                        weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hook, animtime), w_ready);                             
                                }
@@ -234,7 +234,7 @@ float w_hook(float req)
                                                {
                                                        if ( self.ammo_fuel >= (time - self.hook_time_fueldecrease) * hooked_fuel )
                                                        {
-                                                               W_DecreaseAmmo(ammo_fuel, (time - self.hook_time_fueldecrease) * hooked_fuel, FALSE);
+                                                               W_DecreaseAmmo((time - self.hook_time_fueldecrease) * hooked_fuel);
                                                                self.hook_time_fueldecrease = time;
                                                                // decrease next frame again
                                                        }
index d6b028c2c6d07185e1a2ecd35cb260f536aef5c7..7a3f229e09698fe2e7976fbd678e52500ecdf66a 100644 (file)
@@ -125,9 +125,9 @@ void W_UZI_Attack (float 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(ammo_nails, WEP_CVAR(uzi, first_ammo), autocvar_g_balance_uzi_reload_ammo);
+               W_DecreaseAmmo(WEP_CVAR(uzi, first_ammo));
        else
-               W_DecreaseAmmo(ammo_nails, WEP_CVAR(uzi, sustained_ammo), autocvar_g_balance_uzi_reload_ammo);
+               W_DecreaseAmmo(WEP_CVAR(uzi, sustained_ammo));
 }
 
 // weapon frames
@@ -174,7 +174,7 @@ void uzi_mode1_fire_auto()
                return;
        }
 
-       W_DecreaseAmmo(ammo_nails, WEP_CVAR(uzi, sustained_ammo), autocvar_g_balance_uzi_reload_ammo);
+       W_DecreaseAmmo(WEP_CVAR(uzi, sustained_ammo));
 
        W_SetupShot (self, TRUE, 0, "weapons/uzi_fire.wav", CH_WEAPON_A, WEP_CVAR(uzi, sustained_damage));
        if (!autocvar_g_norecoil)
@@ -273,7 +273,7 @@ float w_uzi(float req)
                                                return FALSE;
                                        }
 
-                                       W_DecreaseAmmo(ammo_nails, WEP_CVAR(uzi, burst_ammo), autocvar_g_balance_uzi_reload_ammo);
+                                       W_DecreaseAmmo(WEP_CVAR(uzi, burst_ammo));
 
                                        self.misc_bulletcounter = WEP_CVAR(uzi, burst) * -1;
                                        uzi_mode1_fire_burst();
index 4e1092eed9cf1a639c9938c735ea7fccbdf73d5c..8449ec3d1743f713c31f451527e07a4162efb897 100644 (file)
@@ -319,7 +319,7 @@ void W_Mine_Attack (void)
                }
        }
 
-       W_DecreaseAmmo(ammo_rockets, WEP_CVAR(minelayer, ammo), autocvar_g_balance_minelayer_reload_ammo);
+       W_DecreaseAmmo(WEP_CVAR(minelayer, ammo));
 
        W_SetupShot_ProjectileSize (self, '-4 -4 -4', '4 4 4', FALSE, 5, "weapons/mine_fire.wav", CH_WEAPON_A, WEP_CVAR(minelayer, damage));
        pointparticles(particleeffectnum("rocketlauncher_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
index 433a5ee81ff3a6f4fb4a1d35829585cc9449f7ca..5fb10a296364a99015931a241ecf7ee7675a3c1d 100644 (file)
@@ -105,7 +105,7 @@ void W_MinstaNex_Attack (void)
                        break;
        }
        
-       W_DecreaseAmmo(ammo_cells, ((g_minstagib) ? 1 : WEP_CVAR_PRI(minstanex, ammo)), WEP_CVAR(minstanex, reload_ammo));
+       W_DecreaseAmmo(((g_minstagib) ? 1 : WEP_CVAR_PRI(minstanex, ammo)));
 }
 
 float w_minstanex(float req)
@@ -152,7 +152,7 @@ float w_minstanex(float req)
                                        
                                        // decrease ammo for the laser?
                                        if(WEP_CVAR_SEC(minstanex, ammo))
-                                               W_DecreaseAmmo(ammo_cells, WEP_CVAR_SEC(minstanex, ammo), WEP_CVAR(minstanex, reload_ammo));
+                                               W_DecreaseAmmo(WEP_CVAR_SEC(minstanex, ammo));
 
                                        // ugly minstagib hack to reuse the fire mode of the laser
                                        float w;
index 588d4994beffb1c708287d12f35c34d096fedeb8..3f6316d205528258805b3bc4ea2ba1c5944b2728 100644 (file)
@@ -216,7 +216,7 @@ void W_Grenade_Attack (void)
 {
        entity gren;
 
-       W_DecreaseAmmo(ammo_rockets, WEP_CVAR_PRI(mortar, ammo), autocvar_g_balance_mortar_reload_ammo); // WEAPONTODO
+       W_DecreaseAmmo(WEP_CVAR_PRI(mortar, ammo));
 
        W_SetupShot_ProjectileSize (self, '-3 -3 -3', '3 3 3', FALSE, 4, "weapons/grenade_fire.wav", CH_WEAPON_A, WEP_CVAR_PRI(mortar, damage));
        w_shotdir = v_forward; // no TrueAim for grenades please
@@ -265,7 +265,7 @@ void W_Grenade_Attack2 (void)
 {
        entity gren;
 
-       W_DecreaseAmmo(ammo_rockets, WEP_CVAR_SEC(mortar, ammo), autocvar_g_balance_mortar_reload_ammo);
+       W_DecreaseAmmo(WEP_CVAR_SEC(mortar, ammo));
 
        W_SetupShot_ProjectileSize (self, '-3 -3 -3', '3 3 3', FALSE, 4, "weapons/grenade_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(mortar, damage));
        w_shotdir = v_forward; // no TrueAim for grenades please
index 9c0dfbbe8b2b9e41da80c2c54cf848dedd4b4ba3..2ddf96cd48e02403d5c4f82eddcdeadbd50fb63a 100644 (file)
@@ -109,7 +109,7 @@ void W_Nex_Attack (float issecondary)
        //beam and muzzle flash done on client
        SendCSQCNexBeamParticle(charge);
 
-       W_DecreaseAmmo(ammo_cells, myammo, autocvar_g_balance_nex_reload_ammo);
+       W_DecreaseAmmo(myammo);
 }
 
 void spawnfunc_weapon_nex (void); // defined in t_items.qc
index 261eb65f6efcbd242b780fb86873b9f452bf7d7d..4b07025ad98097698e39bd9209446144e200b25f 100644 (file)
@@ -51,7 +51,7 @@ void W_Rifle_FireBullet(float pSpread, float pDamage, float pForce, float pSpeed
 {
        float i;
 
-       W_DecreaseAmmo(ammo_nails, pAmmo, autocvar_g_balance_rifle_reload_ammo);
+       W_DecreaseAmmo(pAmmo);
 
        W_SetupShot (self, TRUE, 2, pSound, CH_WEAPON_A, pDamage * pShots);
 
index 5cd9dca24fbc7588925ff91a57b273129c34fd48..e453f91b4cae8d0480b9566bd23d3dd94e2e7908 100644 (file)
@@ -241,7 +241,7 @@ void W_Seeker_Fire_Missile(vector f_diff, entity m_target)
 {
        entity missile;
 
-       W_DecreaseAmmo(ammo_rockets, WEP_CVAR(seeker, missile_ammo), autocvar_g_balance_seeker_reload_ammo);
+       W_DecreaseAmmo(WEP_CVAR(seeker, missile_ammo));
 
        makevectors(self.v_angle);
        W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/seeker_fire.wav", CH_WEAPON_A, 0);
@@ -316,7 +316,7 @@ void W_Seeker_Fire_Flac()
        vector f_diff;
        float c;
 
-       W_DecreaseAmmo(ammo_rockets, WEP_CVAR(seeker, flac_ammo), autocvar_g_balance_seeker_reload_ammo);
+       W_DecreaseAmmo(WEP_CVAR(seeker, flac_ammo));
 
        c = mod(self.bulletcounter, 4);
        switch(c)
@@ -552,7 +552,7 @@ void W_Seeker_Tag_Touch()
 void W_Seeker_Fire_Tag()
 {
        entity missile;
-       W_DecreaseAmmo(ammo_rockets, WEP_CVAR(seeker, tag_ammo), autocvar_g_balance_seeker_reload_ammo);
+       W_DecreaseAmmo(WEP_CVAR(seeker, tag_ammo));
 
        W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/tag_fire.wav", CH_WEAPON_A, WEP_CVAR(seeker, missile_damage) * WEP_CVAR(seeker, missile_count));
 
index 545d36ccc9f41e8f27a81be4bb67cfa891e8d97d..aa6f7e6a7c6d7bd0c949d0386f19a755b9e01f27 100644 (file)
@@ -808,13 +808,13 @@ void W_AttachToShotorg(entity flash, vector offset)
        }
 }
 
-void W_DecreaseAmmo(.float ammo_type, float ammo_use, float ammo_reload) // WEAPONTODO: why does this have ammo_type?
+void W_DecreaseAmmo(float ammo_use)
 {
-       if((self.items & IT_UNLIMITED_WEAPON_AMMO) && !ammo_reload)
+       if((self.items & IT_UNLIMITED_WEAPON_AMMO) && !self.reloading_ammo)
                return;
 
        // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
-       if(ammo_reload)
+       if(self.reloading_ammo)
        {
                self.clip_load -= ammo_use;
                self.(weapon_load[self.weapon]) = self.clip_load;