From aea94b32cbefeba5d16ef6fc70eff9508cf11673 Mon Sep 17 00:00:00 2001 From: wget Date: Thu, 27 Feb 2025 09:06:34 +0800 Subject: [PATCH] tf2: Fix prediction for jumping when huntsman is charged/released (#797) * fix prediction for jumping when huntsman is charged/released * remove SetInternalChargeBeginTime override from CTFCompoundBow https://github.com/ValveSoftware/source-sdk-2013/pull/797#discussion_r1970597141 --- src/game/shared/tf/tf_player_shared.cpp | 7 +++++++ src/game/shared/tf/tf_weapon_compound_bow.cpp | 16 ++-------------- src/game/shared/tf/tf_weapon_compound_bow.h | 3 +-- src/game/shared/tf/tf_weaponbase.h | 1 + 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/game/shared/tf/tf_player_shared.cpp b/src/game/shared/tf/tf_player_shared.cpp index 4da5c3df3..a2db00580 100644 --- a/src/game/shared/tf/tf_player_shared.cpp +++ b/src/game/shared/tf/tf_player_shared.cpp @@ -12110,6 +12110,13 @@ bool CTFPlayer::CanJump() const if ( m_Shared.InCond( TF_COND_TAUNTING ) ) return false; + CTFWeaponBase *pActiveWeapon = m_Shared.GetActiveTFWeapon(); + if ( pActiveWeapon ) + { + if ( !pActiveWeapon->OwnerCanJump() ) + return false; + } + int iNoJump = 0; CALL_ATTRIB_HOOK_INT( iNoJump, no_jump ); diff --git a/src/game/shared/tf/tf_weapon_compound_bow.cpp b/src/game/shared/tf/tf_weapon_compound_bow.cpp index 449329c79..768ae0845 100644 --- a/src/game/shared/tf/tf_weapon_compound_bow.cpp +++ b/src/game/shared/tf/tf_weapon_compound_bow.cpp @@ -654,19 +654,7 @@ void CTFCompoundBow::SetArrowAlight( bool bAlight ) //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -void CTFCompoundBow::SetInternalChargeBeginTime( float flChargeBeginTime ) +bool CTFCompoundBow::OwnerCanJump( void ) { -#ifdef GAME_DLL - float flCurrentChargeBeginTime = GetInternalChargeBeginTime(); - if ( flCurrentChargeBeginTime == 0.f && flChargeBeginTime > 0.f ) - { - DisableJump(); - } - else if ( flCurrentChargeBeginTime > 0.f && flChargeBeginTime == 0.f ) - { - EnableJump(); - } -#endif // GAME_DLL - - BaseClass::SetInternalChargeBeginTime( flChargeBeginTime ); + return GetInternalChargeBeginTime() == 0.f; } diff --git a/src/game/shared/tf/tf_weapon_compound_bow.h b/src/game/shared/tf/tf_weapon_compound_bow.h index cbbbb9c74..a192166de 100644 --- a/src/game/shared/tf/tf_weapon_compound_bow.h +++ b/src/game/shared/tf/tf_weapon_compound_bow.h @@ -89,8 +89,7 @@ public: void SetArrowAlight( bool bAlight ); -protected: - virtual void SetInternalChargeBeginTime( float flChargeBeginTime ) OVERRIDE; + bool OwnerCanJump( void ); private: #ifdef CLIENT_DLL diff --git a/src/game/shared/tf/tf_weaponbase.h b/src/game/shared/tf/tf_weaponbase.h index bdf096343..d18638e59 100644 --- a/src/game/shared/tf/tf_weaponbase.h +++ b/src/game/shared/tf/tf_weaponbase.h @@ -335,6 +335,7 @@ class CTFWeaponBase : public CBaseCombatWeapon, public IHasOwner, public IHasGen void EnableDuck(); void DisableDuck(); + virtual bool OwnerCanJump( void ) { return true; } virtual bool OwnerCanTaunt( void ) { return true; } virtual bool CanBeCritBoosted( void ); bool CanHaveRevengeCrits( void );