From 2c9cb0c645b8e8b4014760063406e8c447929d91 Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin Date: Sun, 6 Jun 2021 03:48:55 +0500 Subject: [PATCH] Revert "Merge https://github.com/SamVanheer/HLEnhanced/commit/33413807d0ca23f3d9121e45f5584cb5be98751b" This reverts commit 19bdc1d01b7287cd61b58fb7b7bdb6953caa50a8. --- dlls/gauss.cpp | 36 ++++++++++-------------------------- dlls/weapons.h | 2 +- 2 files changed, 11 insertions(+), 27 deletions(-) diff --git a/dlls/gauss.cpp b/dlls/gauss.cpp index 96345ad2..50707dfe 100644 --- a/dlls/gauss.cpp +++ b/dlls/gauss.cpp @@ -124,12 +124,6 @@ int CGauss::GetItemInfo( ItemInfo *p ) return 1; } -BOOL CGauss::IsUseable() -{ - // Currently charging, allow the player to fire it first. - Solokiller - return CBasePlayerWeapon::IsUseable() || m_fInAttack != 0; -} - BOOL CGauss::Deploy() { m_pPlayer->m_flPlayAftershock = 0.0; @@ -231,22 +225,6 @@ void CGauss::SecondaryAttack() } else { - // Moved to before the ammo burn. - // Because we drained 1 when m_InAttack == 0, then 1 again now before checking if we're out of ammo, - // this resuled in the player having -1 ammo, which in turn caused CanDeploy to think it could be deployed. - // This will need to be fixed further down the line by preventing negative ammo unless explicitly required (infinite ammo?), - // But this check will prevent the problem for now. - Solokiller - // TODO: investigate further. - if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 ) - { - // out of ammo! force the gun to fire - StartFire(); - m_fInAttack = 0; - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0f; - m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1; - return; - } - // 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 ) { @@ -266,6 +244,16 @@ void CGauss::SecondaryAttack() } } + if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 ) + { + // out of ammo! force the gun to fire + StartFire(); + m_fInAttack = 0; + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0; + m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1; + return; + } + if( UTIL_WeaponTimeBase() >= m_pPlayer->m_flAmmoStartCharge ) { // don't eat any more ammo after gun is fully charged. @@ -583,10 +571,6 @@ void CGauss::WeaponIdle( void ) StartFire(); m_fInAttack = 0; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f; - - // Need to set m_flNextPrimaryAttack so the weapon gets a chance to complete its secondary fire animation. - Solokiller - if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 ) - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5f; } else { diff --git a/dlls/weapons.h b/dlls/weapons.h index a3870299..ad8f2fe4 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -745,7 +745,7 @@ public: int iItemSlot( void ) { return 4; } int GetItemInfo(ItemInfo *p); int AddToPlayer( CBasePlayer *pPlayer ); - BOOL IsUseable(); + BOOL Deploy( void ); void Holster( int skiplocal = 0 );