#else
#ifdef SVQC
-void W_Shotgun_DoReload()
+.float shotgun_load;
+
+void W_Shotgun_SetAmmoCounter()
+{
+ // set ammo counter to the weapon we have switched to
+ if(!autocvar_g_balance_shotgun_reload_ammo)
+ self.ammo_counter = 0; // also keeps the crosshair ammo from displaying
+ else
+ self.ammo_counter = self.shotgun_load;
+}
+
+void W_Shotgun_ReloadedAndReady()
{
+ float t;
+
+ // now do the ammo maths
+ 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;
+ self.ammo_shells -= 1;
+ }
+ self.shotgun_load = self.ammo_counter;
+
+ t = ATTACK_FINISHED(self) - autocvar_g_balance_shotgun_reload_time - 1;
+ ATTACK_FINISHED(self) = t;
w_ready();
- if(W_Reload(self.ammo_shells))
+}
+
+void W_Shotgun_Reload()
+{
+ // reloading is disabled for this weapon
+ if(!autocvar_g_balance_shotgun_reload_ammo)
return;
+
+ float t;
+
+ 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);
+
+ t = max(time, ATTACK_FINISHED(self)) + autocvar_g_balance_shotgun_reload_time + 1;
+ ATTACK_FINISHED(self) = t;
+
+ weapon_thinkf(WFRAME_RELOAD, autocvar_g_balance_shotgun_reload_time, W_Shotgun_ReloadedAndReady);
+
+ self.old_ammo_counter = self.ammo_counter;
+ self.ammo_counter = -1;
}
void W_Shotgun_Attack (void)
float bulletconstant;
local entity flash;
- if(self.ammo_counter <= 0)
- W_Shotgun_DoReload();
- if(self.ammo_counter < 0)
+ if(autocvar_g_balance_shotgun_reload_ammo && self.ammo_counter <= 0)
return; // reloading, so we are done
ammoamount = autocvar_g_balance_shotgun_primary_ammo;
fireBallisticBullet(w_shotorg, w_shotdir, spread, bulletspeed, 5, d, 0, f, WEP_SHOTGUN, 0, 1, bulletconstant);
endFireBallisticBullet();
if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
- self.ammo_shells = self.ammo_shells - ammoamount;
+ {
+ if(!autocvar_g_balance_shotgun_reload_ammo)
+ self.ammo_shells = self.ammo_shells - ammoamount;
+ else
+ self.shotgun_load -= ammoamount;
+ }
pointparticles(particleeffectnum("shotgun_muzzleflash"), w_shotorg, w_shotdir * 1000, autocvar_g_balance_shotgun_primary_ammo);
self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE);
else if (req == WR_THINK)
{
- if(self.ammo_counter < 0) // forced reload (e.g. because interrupted)
- self.wish_reload = 1;
+ if(autocvar_g_balance_shotgun_reload_ammo && self.ammo_counter <= 0) // forced reload
+ W_Shotgun_Reload();
else
{
if (self.BUTTON_ATCK)
if(self.weaponentity.state == WS_READY)
{
self.wish_reload = 0;
- W_Reload(self.ammo_shells);
+ W_Shotgun_Reload();
}
}
}
precache_sound ("weapons/shotgun_melee.wav");
}
else if (req == WR_SETUP)
+ {
weapon_setup(WEP_SHOTGUN);
+ W_Shotgun_SetAmmoCounter();
+ }
else if (req == WR_CHECKAMMO1)
return self.ammo_shells >= autocvar_g_balance_shotgun_primary_ammo;
else if (req == WR_CHECKAMMO2)