// weapon reload code
// ----------------------------------------------------------------
-float W_ReloadCheck(float ammo_amount, float ammo_use_primary, float ammo_use_secondary)
+float W_ReloadCheck(float ammo_amount)
{
- if(ammo_amount < min(ammo_use_primary, ammo_use_secondary)) // when we get here, ammo_counter must be 0 or -1
+ if(!ammo_amount) // when we get here, ammo_counter must be 0 or -1
{
print("cannot reload... not enough ammo\n");
self.ammo_counter = -1; // reload later
float t;
- if(!W_ReloadCheck(self.sniperrifle_load, autocvar_g_balance_sniperrifle_primary_ammo, autocvar_g_balance_sniperrifle_secondary_ammo))
+ if(!W_ReloadCheck(self.ammo_nails))
return;
sound (self, CHAN_WEAPON2, "weapons/campingrifle_reload.wav", VOL_BASE, ATTN_NORM);
self.ammo_counter = -1;
}
-float W_SniperRifle_CheckMaxBullets(float checkammo)
-{
- float maxbulls;
- maxbulls = autocvar_g_balance_sniperrifle_reload_ammo;
- if(!maxbulls)
- maxbulls = 8; // match HUD
- if(checkammo)
- if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
- maxbulls = min(maxbulls, floor(self.ammo_nails / min(autocvar_g_balance_sniperrifle_primary_ammo, autocvar_g_balance_sniperrifle_secondary_ammo)));
- if(self.ammo_counter > maxbulls)
- self.ammo_counter = maxbulls;
- return (self.ammo_counter == maxbulls);
-}
-
void W_SniperRifle_FireBullet(float pSpread, float pDamage, float pHeadshotAddedDamage, float pForce, float pSpeed, float pLifetime, float pAmmo, float deathtype, float pBulletConstant)
{
if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
.float bot_secondary_sniperriflemooth;
float w_sniperrifle(float req)
{
- float full;
if (req == WR_AIM)
{
self.BUTTON_ATCK=FALSE;
}
else if (req == WR_THINK)
{
- W_SniperRifle_SetAmmoCounter();
if(autocvar_g_balance_sniperrifle_reload_ammo && self.ammo_counter <= 0) // forced reload
W_SniperRifle_Reload();
else
else if (req == WR_SETUP)
{
weapon_setup(WEP_SNIPERRIFLE);
-
- full = W_SniperRifle_CheckMaxBullets(TRUE);
- if(autocvar_g_balance_sniperrifle_auto_reload_on_switch)
- if(!full)
- self.ammo_counter = -1;
+ W_SniperRifle_SetAmmoCounter();
}
else if (req == WR_CHECKAMMO1)
{
{
self.sniperrifle_accumulator = time - autocvar_g_balance_sniperrifle_bursttime;
self.ammo_counter = autocvar_g_balance_sniperrifle_reload_ammo;
- W_SniperRifle_CheckMaxBullets(FALSE);
}
return TRUE;
};