From 3140fa9e55ba81f1de9e197f05bd40277996540c Mon Sep 17 00:00:00 2001 From: Hunter Kvalevog Date: Fri, 8 Aug 2025 16:37:24 -0500 Subject: [PATCH 1/2] CTFPlayerModelPanel: Clamp negative choreo scene time When reusing the shared CTFPlayerModelPanel in the class select screen, SetupFlexWeights would incorrectly calculate a large negative m_flSceneTime. This would result in class select animations freezing when going back and forth in the class select menu. -0.1s start times are allowed to give the system time to lerp to the looping animation. This constant is already used in neighboring code. --- src/game/client/tf/vgui/tf_playermodelpanel.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/game/client/tf/vgui/tf_playermodelpanel.cpp b/src/game/client/tf/vgui/tf_playermodelpanel.cpp index 5fc2219cca9..dfae5369e03 100644 --- a/src/game/client/tf/vgui/tf_playermodelpanel.cpp +++ b/src/game/client/tf/vgui/tf_playermodelpanel.cpp @@ -2295,6 +2295,7 @@ void CTFPlayerModelPanel::SetupFlexWeights( void ) } m_flSceneTime += (m_RootMDL.m_MDL.m_flTime - m_flLastTickTime); + m_flSceneTime = Max( m_flSceneTime, -0.1f ); m_flLastTickTime = m_RootMDL.m_MDL.m_flTime; if ( m_flSceneEndTime > FLT_EPSILON && m_flSceneTime > m_flSceneEndTime ) From fe6ea8d79a06d3af72eb6944c90bc9b54a590cff Mon Sep 17 00:00:00 2001 From: Hunter Kvalevog Date: Fri, 8 Aug 2025 16:39:10 -0500 Subject: [PATCH 2/2] CTFPlayerModelPanel: Replace lerp magic number with macro --- src/game/client/tf/vgui/tf_playermodelpanel.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/game/client/tf/vgui/tf_playermodelpanel.cpp b/src/game/client/tf/vgui/tf_playermodelpanel.cpp index dfae5369e03..29e2d018fed 100644 --- a/src/game/client/tf/vgui/tf_playermodelpanel.cpp +++ b/src/game/client/tf/vgui/tf_playermodelpanel.cpp @@ -34,6 +34,8 @@ DECLARE_BUILD_FACTORY( CTFPlayerModelPanel ); +#define SCENE_LERP_TIME 0.1f + char g_szSceneTmpName[256]; static bool IsTauntItem( GameItemDefinition_t *pItemDef, const int iTeam, const int iClass, const char **ppSequence = NULL, const char **ppRequiredItem = NULL, const char **ppScene = NULL ) @@ -466,7 +468,7 @@ CChoreoScene *LoadSceneForModel( const char *filename, IChoreoEventCallback *pCa if ( bSetEndTime ) { - *flSceneEndTime += 0.1f; // give time for lerp to idle pose + *flSceneEndTime += SCENE_LERP_TIME; // give time for lerp to idle pose } } @@ -2291,11 +2293,11 @@ void CTFPlayerModelPanel::SetupFlexWeights( void ) // Advance time if ( m_flLastTickTime < FLT_EPSILON ) { - m_flLastTickTime = m_RootMDL.m_MDL.m_flTime - 0.1; + m_flLastTickTime = m_RootMDL.m_MDL.m_flTime - SCENE_LERP_TIME; } m_flSceneTime += (m_RootMDL.m_MDL.m_flTime - m_flLastTickTime); - m_flSceneTime = Max( m_flSceneTime, -0.1f ); + m_flSceneTime = Max( m_flSceneTime, -SCENE_LERP_TIME ); m_flLastTickTime = m_RootMDL.m_MDL.m_flTime; if ( m_flSceneEndTime > FLT_EPSILON && m_flSceneTime > m_flSceneEndTime )