Skip to content

Commit

Permalink
Revert mp_refill_bpammo_weapons 3
Browse files Browse the repository at this point in the history
  • Loading branch information
s1lentq committed Oct 26, 2020
1 parent efb06a7 commit b0d0ffe
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions dist/game.cfg
Expand Up @@ -93,6 +93,7 @@ mp_auto_reload_weapons 0
// 0 - disabled (default behaviour)
// 1 - refill backpack ammo on player spawn
// 2 - refill backpack ammo on player spawn and on the purchase of the item
// 3 - refill backpack ammo on each weapon reload (NOTE: Useful for mods like DeathMatch, GunGame, ZombieMod etc.)
//
// Default value: "0"
mp_refill_bpammo_weapons 0
Expand Down
21 changes: 18 additions & 3 deletions regamedll/dlls/weapons.cpp
Expand Up @@ -917,7 +917,15 @@ void CBasePlayerWeapon::ItemPostFrame()

// Add them to the clip
m_iClip += j;
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= j;

#ifdef REGAMEDLL_ADD
// Do not remove bpammo of the player,
// if cvar allows to refill bpammo on during reloading the weapons
if (refill_bpammo_weapons.value < 3.0f)
#endif
{
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= j;
}

m_pPlayer->TabulateAmmo();
m_fInReload = FALSE;
Expand Down Expand Up @@ -1436,8 +1444,15 @@ bool EXT_FUNC CBasePlayerWeapon::__API_HOOK(DefaultShotgunReload)(int iAnim, int
#endif
{
m_iClip++;
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
m_pPlayer->ammo_buckshot--;

#ifdef REGAMEDLL_ADD
if (refill_bpammo_weapons.value < 3.0f)
#endif
{
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
m_pPlayer->ammo_buckshot--;
}

m_fInSpecialReload = 1;
}

Expand Down

0 comments on commit b0d0ffe

Please sign in to comment.