Skip to content

Commit b0d0ffe

Browse files
committed
Revert mp_refill_bpammo_weapons 3
1 parent efb06a7 commit b0d0ffe

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

dist/game.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ mp_auto_reload_weapons 0
9393
// 0 - disabled (default behaviour)
9494
// 1 - refill backpack ammo on player spawn
9595
// 2 - refill backpack ammo on player spawn and on the purchase of the item
96+
// 3 - refill backpack ammo on each weapon reload (NOTE: Useful for mods like DeathMatch, GunGame, ZombieMod etc.)
9697
//
9798
// Default value: "0"
9899
mp_refill_bpammo_weapons 0

regamedll/dlls/weapons.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,15 @@ void CBasePlayerWeapon::ItemPostFrame()
917917

918918
// Add them to the clip
919919
m_iClip += j;
920-
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= j;
920+
921+
#ifdef REGAMEDLL_ADD
922+
// Do not remove bpammo of the player,
923+
// if cvar allows to refill bpammo on during reloading the weapons
924+
if (refill_bpammo_weapons.value < 3.0f)
925+
#endif
926+
{
927+
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= j;
928+
}
921929

922930
m_pPlayer->TabulateAmmo();
923931
m_fInReload = FALSE;
@@ -1436,8 +1444,15 @@ bool EXT_FUNC CBasePlayerWeapon::__API_HOOK(DefaultShotgunReload)(int iAnim, int
14361444
#endif
14371445
{
14381446
m_iClip++;
1439-
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
1440-
m_pPlayer->ammo_buckshot--;
1447+
1448+
#ifdef REGAMEDLL_ADD
1449+
if (refill_bpammo_weapons.value < 3.0f)
1450+
#endif
1451+
{
1452+
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
1453+
m_pPlayer->ammo_buckshot--;
1454+
}
1455+
14411456
m_fInSpecialReload = 1;
14421457
}
14431458

0 commit comments

Comments
 (0)