lowered weapon shooting fix

This commit is contained in:
celisej567 2025-01-02 23:14:39 +03:00
parent 29985681a1
commit 9027b0bdb7
4 changed files with 94 additions and 81 deletions

View File

@ -1653,6 +1653,7 @@ void CBaseCombatWeapon::ItemPostFrame( void )
if (!pOwner) if (!pOwner)
return; return;
UpdateAutoFire(); UpdateAutoFire();
//Track the duration of the fire //Track the duration of the fire
@ -1666,7 +1667,10 @@ void CBaseCombatWeapon::ItemPostFrame( void )
} }
bool bFired = false; bool bFired = false;
#ifdef GAME_DLL
if (!m_bLowered)
{
#endif
// Secondary attack has priority // Secondary attack has priority
if ((pOwner->m_nButtons & IN_ATTACK2) && (m_flNextSecondaryAttack <= gpGlobals->curtime)) if ((pOwner->m_nButtons & IN_ATTACK2) && (m_flNextSecondaryAttack <= gpGlobals->curtime))
{ {
@ -1730,6 +1734,7 @@ void CBaseCombatWeapon::ItemPostFrame( void )
} }
else else
{ {
//NOTENOTE: There is a bug with this code with regards to the way machine guns catch the leading edge trigger //NOTENOTE: There is a bug with this code with regards to the way machine guns catch the leading edge trigger
// on the player hitting the attack key. It relies on the gun catching that case in the same frame. // on the player hitting the attack key. It relies on the gun catching that case in the same frame.
// However, because the player can also be doing a secondary attack, the edge trigger may be missed. // However, because the player can also be doing a secondary attack, the edge trigger may be missed.
@ -1754,6 +1759,10 @@ void CBaseCombatWeapon::ItemPostFrame( void )
#endif #endif
} }
} }
#ifdef GAME_DLL
}
#endif
// ----------------------- // -----------------------
// Reload pressed / Clip Empty // Reload pressed / Clip Empty

View File

@ -526,6 +526,12 @@ private:
CNetworkVar( CBaseCombatCharacterHandle, m_hOwner ); // Player carrying this weapon CNetworkVar( CBaseCombatCharacterHandle, m_hOwner ); // Player carrying this weapon
protected: protected:
#ifdef GAME_DLL
bool m_bLowered; // Whether the viewmodel is raised or lowered
float m_flRaiseTime; // If lowered, the time we should raise the viewmodel
#endif
#if defined ( TF_CLIENT_DLL ) || defined ( TF_DLL ) #if defined ( TF_CLIENT_DLL ) || defined ( TF_DLL )
// Regulate crit frequency to reduce client-side seed hacking // Regulate crit frequency to reduce client-side seed hacking
void AddToCritBucket( float flAmount ); void AddToCritBucket( float flAmount );

View File

@ -58,8 +58,6 @@ public:
protected: protected:
bool m_bLowered; // Whether the viewmodel is raised or lowered
float m_flRaiseTime; // If lowered, the time we should raise the viewmodel
float m_flHolsterTime; // When the weapon was holstered float m_flHolsterTime; // When the weapon was holstered
}; };

View File