-.float shotgun_load;
-
-void W_Shotgun_SetAmmoCounter()
-{
- // set ammo_counter to the weapon we have switched to, if the gun uses reloading
- if(!autocvar_g_balance_shotgun_reload_ammo)
- self.ammo_counter = 0; // also keeps crosshair ammo from displaying
- else
- self.ammo_counter = self.shotgun_load;
-}
-
-void W_Shotgun_ReloadedAndReady()
-{
- float t;
-
- // now do the ammo transfer
- self.ammo_counter = self.old_ammo_counter; // restore the ammo counter, in case we still had ammo in the weapon before reloading
- while(self.ammo_counter < autocvar_g_balance_shotgun_reload_ammo && self.ammo_shells) // make sure we don't add more ammo than 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();
-}
-
-void W_Shotgun_Reload()
-{
- // return if reloading is disabled for this weapon
- if(!autocvar_g_balance_shotgun_reload_ammo)
- return;
-
- if(!W_ReloadCheck(self.ammo_shells))
- return;
-
- float t;
-
- sound (self, CHAN_WEAPON2, "weapons/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;
-}
-