diff --git a/mp/src/game/shared/ff/ff_sh_gamemovement.cpp b/mp/src/game/shared/ff/ff_sh_gamemovement.cpp index 0cf777e5..35594f82 100644 --- a/mp/src/game/shared/ff/ff_sh_gamemovement.cpp +++ b/mp/src/game/shared/ff/ff_sh_gamemovement.cpp @@ -589,6 +589,28 @@ void CFF_SH_GameMovement::Duck( void ) } } +/** Handles speed cropping while ducking + Overwritten from CGameMovement + Purpose: Allow for TFC-style duck speed cropping +*/ +void CFF_SH_GameMovement::HandleDuckingSpeedCrop( void ) +{ + // in HL1/TFC, crouching altered intended movement speed even while in the air + // it basically makes you lose speed while air controlling at high speeds + if (FFDEV_TFC_CROUCH_AIRMOVEMENT && ( player->GetFlags() & FL_DUCKING )) + { + float frac = 0.33333333f; + mv->m_flForwardMove *= frac; + mv->m_flSideMove *= frac; + mv->m_flUpMove *= frac; + m_iSpeedCropped |= SPEED_CROPPED_DUCK; + } + else + { + BaseClass::HandleDuckingSpeedCrop(); + } +} + // Expose our interface. // Note: There can only be one IGameMovement exposed at a time static CFF_SH_GameMovement g_GameMovement; diff --git a/mp/src/game/shared/ff/ff_sh_gamemovement.h b/mp/src/game/shared/ff/ff_sh_gamemovement.h index 1878fc65..c847b2dd 100644 --- a/mp/src/game/shared/ff/ff_sh_gamemovement.h +++ b/mp/src/game/shared/ff/ff_sh_gamemovement.h @@ -36,7 +36,8 @@ protected: virtual bool CheckJumpButton( void ); // Ducking - virtual void Duck( void ); + virtual void Duck( void ); + virtual void HandleDuckingSpeedCrop(); // <--- Overwritten functions }; diff --git a/mp/src/game/shared/ff/ff_sh_vars_movement.cpp b/mp/src/game/shared/ff/ff_sh_vars_movement.cpp index b1294e43..8e07fbab 100644 --- a/mp/src/game/shared/ff/ff_sh_vars_movement.cpp +++ b/mp/src/game/shared/ff/ff_sh_vars_movement.cpp @@ -4,3 +4,5 @@ #ifdef CLIENT_DLL ConVar cl_jumpqueue( "cl_jumpqueue", "0", FCVAR_ARCHIVE | FCVAR_USERINFO, "Enables jump queue (have to let go and press jump in between concurrent jumps) if set to 1" ); #endif + +ConVar ffdev_tfc_crouch_airmovement( "ffdev_tfc_crouch_airmovement", "0", FCVAR_REPLICATED, "Enables/disables 'slower' movement while in the air; in TFC, crouching cuts your desired movement in 1/3 even in the air" ); \ No newline at end of file diff --git a/mp/src/game/shared/ff/ff_sh_vars_movement.h b/mp/src/game/shared/ff/ff_sh_vars_movement.h index 66839c9f..a7d4cc1a 100644 --- a/mp/src/game/shared/ff/ff_sh_vars_movement.h +++ b/mp/src/game/shared/ff/ff_sh_vars_movement.h @@ -15,6 +15,9 @@ extern bool g_bMovementOptimizations; #define SV_TRIMPTRIGGERSPEED 550.0f #define SV_TRIMPTRIGGERSPEEDDOWN 50.0f +extern ConVar ffdev_tfc_crouch_airmovement; +#define FFDEV_TFC_CROUCH_AIRMOVEMENT ffdev_tfc_crouch_airmovement.GetBool() + #define BHOP_CAP_SOFT 1.4f #define BHOP_PCFACTOR 0.65f #define BHOP_CAP_HARD 1.8f