Compare commits

...

3 Commits

Author SHA1 Message Date
d24120a99e client and shotgun fixex
Some checks failed
Build / build-linux-i386 (push) Has been cancelled
Build / build-linux-amd64 (push) Has been cancelled
Build / build-android-armv7a (push) Has been cancelled
Build / build-windows-i386 (push) Has been cancelled
Build / build-windows-amd64 (push) Has been cancelled
Build / build-dedicated-windows-i386 (push) Has been cancelled
Build / build-dedicated-windows-amd64 (push) Has been cancelled
Build / build-dedicated-linux-i386 (push) Has been cancelled
Build / build-dedicated-linux-amd64 (push) Has been cancelled
Build / build-macos-amd64 (push) Has been cancelled
Build / build-dedicated-macos-amd64 (push) Has been cancelled
Tests / tests-linux-i386 (push) Has been cancelled
Tests / tests-linux-amd64 (push) Has been cancelled
Tests / tests-macos-amd64 (push) Has been cancelled
Tests / tests-windows-i386 (push) Has been cancelled
Tests / tests-windows-amd64 (push) Has been cancelled
2025-01-02 23:53:02 +03:00
9026dca97f BEGIN_DATADESC update 2025-01-02 23:24:05 +03:00
9027b0bdb7 lowered weapon shooting fix 2025-01-02 23:14:39 +03:00
6 changed files with 188 additions and 157 deletions

View File

@@ -610,6 +610,12 @@ void CWeaponShotgun::ItemPostFrame( void )
return;
}
#ifdef GAME_DLL
if (!m_bLowered)
{
#endif // GAME_DLL
// Shotgun uses same timing and ammo for secondary attack
if ((m_bDelayedFire2 || pOwner->m_nButtons & IN_ATTACK2) && (m_flNextPrimaryAttack <= gpGlobals->curtime))
{
@@ -681,6 +687,9 @@ void CWeaponShotgun::ItemPostFrame( void )
PrimaryAttack();
}
}
#ifdef GAME_DLL
}
#endif // GAME_DLL
if ( pOwner->m_nButtons & IN_RELOAD && UsesClipsForAmmo1() && !m_bInReload )
{

View File

@@ -94,6 +94,11 @@ CBaseCombatWeapon::CBaseCombatWeapon() : BASECOMBATWEAPON_DERIVED_FROM()
m_hWeaponFileInfo = GetInvalidWeaponInfoHandle();
#ifdef GAME_DLL
m_bLowered = false;
m_flRaiseTime = gpGlobals->curtime;
#endif
#if defined( TF_DLL )
UseClientSideAnimation();
#endif
@@ -1653,6 +1658,7 @@ void CBaseCombatWeapon::ItemPostFrame( void )
if (!pOwner)
return;
UpdateAutoFire();
//Track the duration of the fire
@@ -1666,7 +1672,10 @@ void CBaseCombatWeapon::ItemPostFrame( void )
}
bool bFired = false;
#ifdef GAME_DLL
if (!m_bLowered)
{
#endif
// Secondary attack has priority
if ((pOwner->m_nButtons & IN_ATTACK2) && (m_flNextSecondaryAttack <= gpGlobals->curtime))
{
@@ -1730,6 +1739,7 @@ void CBaseCombatWeapon::ItemPostFrame( void )
}
else
{
//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.
// However, because the player can also be doing a secondary attack, the edge trigger may be missed.
@@ -1754,6 +1764,10 @@ void CBaseCombatWeapon::ItemPostFrame( void )
#endif
}
}
#ifdef GAME_DLL
}
#endif
// -----------------------
// Reload pressed / Clip Empty
@@ -2579,6 +2593,9 @@ IMPLEMENT_NETWORKCLASS_ALIASED( BaseCombatWeapon, DT_BaseCombatWeapon )
//-----------------------------------------------------------------------------//
BEGIN_DATADESC( CBaseCombatWeapon )
DEFINE_FIELD(m_bLowered, FIELD_BOOLEAN),
DEFINE_FIELD(m_flRaiseTime, FIELD_TIME),
DEFINE_FIELD( m_flNextPrimaryAttack, FIELD_TIME ),
DEFINE_FIELD( m_flNextSecondaryAttack, FIELD_TIME ),
DEFINE_FIELD( m_flTimeWeaponIdle, FIELD_TIME ),

View File

@@ -526,6 +526,11 @@ private:
CNetworkVar( CBaseCombatCharacterHandle, m_hOwner ); // Player carrying this weapon
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 )
// Regulate crit frequency to reduce client-side seed hacking
void AddToCritBucket( float flAmount );

View File

@@ -34,8 +34,6 @@ END_NETWORK_TABLE()
//---------------------------------------------------------
BEGIN_DATADESC( CBaseHLCombatWeapon )
DEFINE_FIELD( m_bLowered, FIELD_BOOLEAN ),
DEFINE_FIELD( m_flRaiseTime, FIELD_TIME ),
DEFINE_FIELD( m_flHolsterTime, FIELD_TIME ),
DEFINE_FIELD( m_iPrimaryAttacks, FIELD_INTEGER ),
DEFINE_FIELD( m_iSecondaryAttacks, FIELD_INTEGER ),

View File

@@ -58,8 +58,10 @@ public:
protected:
#ifndef 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
float m_flHolsterTime; // When the weapon was holstered
};

View File