Fix prediction error when crouchjumping

This commit is contained in:
ficool2 2025-12-15 16:24:57 +00:00 committed by EricS-Valve
parent 2d3a6efb50
commit 7191ecc418
2 changed files with 15 additions and 6 deletions

View File

@ -4011,6 +4011,18 @@ void CGameMovement::PlayerRoughLandingEffects( float fvol )
} }
} }
//-----------------------------------------------------------------------------
// Purpose: Reset interpolation when player duck state changes
// Input : direction -
//-----------------------------------------------------------------------------
void CGameMovement::ResetDuckLatched()
{
#ifdef CLIENT_DLL
if ( !player->InFirstPersonView() )
player->ResetLatched();
#endif
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Use for ease-in, ease-out style interpolation (accel/decel) Used by ducking code. // Purpose: Use for ease-in, ease-out style interpolation (accel/decel) Used by ducking code.
// Input : value - // Input : value -
@ -4133,9 +4145,7 @@ void CGameMovement::FinishUnDuck( void )
mv->SetAbsOrigin( newOrigin ); mv->SetAbsOrigin( newOrigin );
#ifdef CLIENT_DLL ResetDuckLatched();
player->ResetLatched();
#endif // CLIENT_DLL
// Recategorize position since ducking can change origin // Recategorize position since ducking can change origin
CategorizePosition(); CategorizePosition();
@ -4232,9 +4242,7 @@ void CGameMovement::FinishDuck( void )
VectorAdd( mv->GetAbsOrigin(), viewDelta, out ); VectorAdd( mv->GetAbsOrigin(), viewDelta, out );
mv->SetAbsOrigin( out ); mv->SetAbsOrigin( out );
#ifdef CLIENT_DLL ResetDuckLatched();
player->ResetLatched();
#endif // CLIENT_DLL
} }
// See if we are stuck? // See if we are stuck?

View File

@ -227,6 +227,7 @@ protected:
void FinishUnDuckJump( trace_t &trace ); void FinishUnDuckJump( trace_t &trace );
void SetDuckedEyeOffset( float duckFraction ); void SetDuckedEyeOffset( float duckFraction );
void FixPlayerCrouchStuck( bool moveup ); void FixPlayerCrouchStuck( bool moveup );
void ResetDuckLatched();
float SplineFraction( float value, float scale ); float SplineFraction( float value, float scale );