]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Properly check the necessary amount of ammo for reloading
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 21 Jan 2011 14:20:14 +0000 (16:20 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 21 Jan 2011 14:20:14 +0000 (16:20 +0200)
qcsrc/server/cl_weaponsystem.qc
qcsrc/server/w_shotgun.qc
qcsrc/server/w_sniperrifle.qc

index 914abef3580ff399fe87232620b2db82df0ec975..0e0335b9f745f374c699df4e8dfe3ecdf9e92f0a 100644 (file)
@@ -1616,9 +1616,9 @@ void W_SetupProjectileVelocity(entity missile, float pSpeed, float spread)
 // weapon reload code
 // ----------------------------------------------------------------
 
-float W_ReloadCheck(float ammo_amount)
+float W_ReloadCheck(float ammo_amount, float ammo_use_primary, float ammo_use_secondary)
 {
-       if(ammo_amount < min(autocvar_g_balance_sniperrifle_primary_ammo, autocvar_g_balance_sniperrifle_secondary_ammo)) // when we get here, ammo_counter must be 0 or -1
+       if(ammo_amount < min(ammo_use_primary, ammo_use_secondary)) // when we get here, ammo_counter must be 0 or -1
        {
                print("cannot reload... not enough ammo\n");
                self.ammo_counter = -1; // reload later
index 2e861599739d05d3abed1cb4f8a57d899a004eb2..118fbf08855c04287deb444c6e4dae168f73096c 100644 (file)
@@ -40,7 +40,7 @@ void W_Shotgun_Reload()
 
        float t;
 
-       if(!W_ReloadCheck(self.ammo_shells))
+       if(!W_ReloadCheck(self.ammo_shells, autocvar_g_balance_shotgun_primary_ammo, 0))
                return;
 
        sound (self, CHAN_WEAPON2, "weapons/campingrifle_reload.wav", VOL_BASE, ATTN_NORM);
index 8a3f5a5dee1634dc967ef64f89e1a854a17df998..d31796d904ece8606fa95883d7b4c7713aa2048f 100644 (file)
@@ -44,7 +44,7 @@ void W_SniperRifle_Reload()
 
        float t;
 
-       if(!W_ReloadCheck(self.ammo_nails))
+       if(!W_ReloadCheck(self.ammo_nails, autocvar_g_balance_sniperrifle_primary_ammo, autocvar_g_balance_sniperrifle_secondary_ammo))
                return;
 
        sound (self, CHAN_WEAPON2, "weapons/campingrifle_reload.wav", VOL_BASE, ATTN_NORM);