From d63c846a8b811c0e88533c9bae12b29db7d2fdf1 Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Mon, 24 Jan 2011 02:23:28 +0200 Subject: [PATCH] Fix switching to the shotgun with no ammo when melee is active. Also improve another check --- qcsrc/server/cl_weaponsystem.qc | 4 ++-- qcsrc/server/w_shotgun.qc | 18 +++++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/qcsrc/server/cl_weaponsystem.qc b/qcsrc/server/cl_weaponsystem.qc index 91450dd2b..f2c4447fa 100644 --- a/qcsrc/server/cl_weaponsystem.qc +++ b/qcsrc/server/cl_weaponsystem.qc @@ -1631,8 +1631,8 @@ float W_ReloadCheck(float ammo_amount, float ammo_shot) sprint(self, strcat("You don't have enough ammo to reload the ^2", W_Name(self.weapon), "\n")); self.reload_complain = time + 1; } - // switch away if the loaded amount of ammo is not enough to keep using this weapon - if(self.clip_load < ammo_shot) + // switch away if the amount of ammo is not enough to keep using this weapon + if not(weapon_action(self.weapon, WR_CHECKAMMO1) + weapon_action(self.weapon, WR_CHECKAMMO2)) { self.clip_load = -1; // reload later W_SwitchToOtherWeapon(self); diff --git a/qcsrc/server/w_shotgun.qc b/qcsrc/server/w_shotgun.qc index fa398933b..3f5a91ede 100644 --- a/qcsrc/server/w_shotgun.qc +++ b/qcsrc/server/w_shotgun.qc @@ -176,7 +176,11 @@ float w_shotgun(float req) else if (req == WR_THINK) { if(autocvar_g_balance_shotgun_reload_ammo && self.clip_load < autocvar_g_balance_shotgun_primary_ammo) // forced reload - W_Shotgun_Reload(); + { + // don't force reload an empty shotgun if its melee attack is active + if not(autocvar_g_balance_shotgun_secondary && self.ammo_shells < autocvar_g_balance_shotgun_primary_ammo) + W_Shotgun_Reload(); + } else { if (self.BUTTON_ATCK) @@ -191,12 +195,12 @@ float w_shotgun(float req) } } } - if (self.BUTTON_ATCK2 && autocvar_g_balance_shotgun_secondary) - if (weapon_prepareattack(1, autocvar_g_balance_shotgun_secondary_refire)) - { - // attempt forcing playback of the anim by switching to another anim (that we never play) here... - weapon_thinkf(WFRAME_FIRE1, 0, W_Shotgun_Attack2); - } + } + if (self.BUTTON_ATCK2 && autocvar_g_balance_shotgun_secondary) + if (weapon_prepareattack(1, autocvar_g_balance_shotgun_secondary_refire)) + { + // attempt forcing playback of the anim by switching to another anim (that we never play) here... + weapon_thinkf(WFRAME_FIRE1, 0, W_Shotgun_Attack2); } } else if (req == WR_PRECACHE) -- 2.39.2