From ea15a3c114674096d403c887e5debef4290071c6 Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Fri, 21 Jan 2011 04:30:24 +0200 Subject: [PATCH] Properly consider ammo we still had in the weapon before reloading --- qcsrc/server/defs.qh | 1 + qcsrc/server/w_shotgun.qc | 3 ++- qcsrc/server/w_sniperrifle.qc | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index e835738a0..a6374e46d 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -613,6 +613,7 @@ float client_cefc_accumulatortime; #endif .float ammo_counter; +.float old_ammo_counter; .float wish_reload; #define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_CORPSE; (e).dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE diff --git a/qcsrc/server/w_shotgun.qc b/qcsrc/server/w_shotgun.qc index 67c5da3f6..a99786ae3 100644 --- a/qcsrc/server/w_shotgun.qc +++ b/qcsrc/server/w_shotgun.qc @@ -19,7 +19,7 @@ void W_Shotgun_ReloadedAndReady() float t; // now do the ammo maths - self.ammo_counter = 0; // when we get here it's -1 + self.ammo_counter = self.old_ammo_counter; // restore ammo counter, in case we still had ammo in the weapon while reloading while(self.ammo_counter < autocvar_g_balance_shotgun_reload_ammo && self.ammo_shells) // make sure we don't add more than the amount of ammo we have { self.ammo_counter += 1; @@ -50,6 +50,7 @@ void W_Shotgun_Reload() weapon_thinkf(WFRAME_RELOAD, autocvar_g_balance_sniperrifle_reloadtime, W_Shotgun_ReloadedAndReady); + self.old_ammo_counter = self.ammo_counter; self.ammo_counter = -1; } diff --git a/qcsrc/server/w_sniperrifle.qc b/qcsrc/server/w_sniperrifle.qc index 22ff36ce5..c4d273c82 100644 --- a/qcsrc/server/w_sniperrifle.qc +++ b/qcsrc/server/w_sniperrifle.qc @@ -23,7 +23,7 @@ void W_SniperRifle_ReloadedAndReady() float t; // now do the ammo maths - self.ammo_counter = 0; // when we get here it's -1 + self.ammo_counter = self.old_ammo_counter; // restore ammo counter, in case we still had ammo in the weapon while reloading while(self.ammo_counter < autocvar_g_balance_sniperrifle_reload_ammo && self.ammo_nails) // make sure we don't add more than the amount of ammo we have { self.ammo_counter += 1; @@ -54,6 +54,7 @@ void W_SniperRifle_Reload() weapon_thinkf(WFRAME_RELOAD, autocvar_g_balance_sniperrifle_reloadtime, W_SniperRifle_ReloadedAndReady); + self.old_ammo_counter = self.ammo_counter; self.ammo_counter = -1; } -- 2.39.2