Skip to content

Commit

Permalink
Fix Gauss gun sometimes settting player uranium ammo to -1
Browse files Browse the repository at this point in the history
  • Loading branch information
SamVanheer committed Mar 31, 2023
1 parent 3d13792 commit 0e8d3ad
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Fixed func_friction not working properly in multiplayer (halflife issue [#1542](https://github.com/ValveSoftware/halflife/issues/1542)) (Thanks L453rh4wk)
* Fixed spray logo using wrong decal after save game load when not using custom spray [#193](https://github.com/SamVanheer/halflife-updated/issues/193) (Thanks Ronin4862)
* Fixed ammo pickup sound playing when picking up a weapon for the first time (bug introduced by [#153](https://github.com/SamVanheer/halflife-updated/issues/153) in Beta 12)
* Fixed Gauss gun sometimes settting player uranium ammo to -1 (halflife issue [#3343](https://github.com/ValveSoftware/halflife/issues/3343))

## Changes in V1.0.0 Beta 014

Expand Down
27 changes: 15 additions & 12 deletions dlls/gauss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,22 +199,25 @@ void CGauss::SecondaryAttack()
}
else
{
// during the charging process, eat one bit of ammo every once in a while
if (UTIL_WeaponTimeBase() >= m_pPlayer->m_flNextAmmoBurn && m_pPlayer->m_flNextAmmoBurn != 1000)
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] > 0)
{
// during the charging process, eat one bit of ammo every once in a while
if (UTIL_WeaponTimeBase() >= m_pPlayer->m_flNextAmmoBurn && m_pPlayer->m_flNextAmmoBurn != 1000)
{
#ifdef CLIENT_DLL
if (bIsMultiplayer())
if (bIsMultiplayer())
#else
if (g_pGameRules->IsMultiplayer())
if (g_pGameRules->IsMultiplayer())
#endif
{
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
m_pPlayer->m_flNextAmmoBurn = UTIL_WeaponTimeBase() + 0.1;
}
else
{
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
m_pPlayer->m_flNextAmmoBurn = UTIL_WeaponTimeBase() + 0.3;
{
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
m_pPlayer->m_flNextAmmoBurn = UTIL_WeaponTimeBase() + 0.1;
}
else
{
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
m_pPlayer->m_flNextAmmoBurn = UTIL_WeaponTimeBase() + 0.3;
}
}
}

Expand Down

0 comments on commit 0e8d3ad

Please sign in to comment.