From 9fdd0ebe71c112aa32e11c3d940eb4e8e716afb6 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 8 Sep 2024 23:26:10 +0200 Subject: [PATCH] Force sequence only if client side animation --- game/client/c_baseanimating.cpp | 53 ++++++++++--------- game/server/baseanimating.cpp | 7 --- .../cstrike/hostage/cs_simple_hostage.cpp | 7 --- 3 files changed, 28 insertions(+), 39 deletions(-) diff --git a/game/client/c_baseanimating.cpp b/game/client/c_baseanimating.cpp index f94fe1899..1dce834a1 100644 --- a/game/client/c_baseanimating.cpp +++ b/game/client/c_baseanimating.cpp @@ -1152,24 +1152,26 @@ CStudioHdr *C_BaseAnimating::OnNewModel() AddEFlags( EFL_USE_PARTITION_WHEN_NOT_SOLID ); } - - // Most entities clear out their sequences when they change models on the server, but - // not all entities network down their m_nSequence (like multiplayer game player entities), - // so we may need to clear it out here. Force a SetSequence call no matter what, though. - int forceSequence = ShouldResetSequenceOnNewModel() ? 0 : m_nSequence; - - if ( GetSequence() >= hdr->GetNumSeq() ) + if (m_bClientSideAnimation) { - forceSequence = 0; - } + // Most entities clear out their sequences when they change models on the server, but + // not all entities network down their m_nSequence (like multiplayer game player entities), + // so we may need to clear it out here. Force a SetSequence call no matter what, though. + int forceSequence = ShouldResetSequenceOnNewModel() ? 0 : m_nSequence; + + if ( GetSequence() >= hdr->GetNumSeq() ) + { + forceSequence = 0; + } - m_nSequence = -1; - SetSequence( forceSequence ); + m_nSequence = -1; + SetSequence( forceSequence ); - if ( m_bResetSequenceInfoOnLoad ) - { - m_bResetSequenceInfoOnLoad = false; - ResetSequenceInfo(); + if ( m_bResetSequenceInfoOnLoad ) + { + m_bResetSequenceInfoOnLoad = false; + ResetSequenceInfo(); + } } return hdr; @@ -4219,16 +4221,17 @@ bool C_BaseAnimating::IsSelfAnimating() if ( m_bClientSideAnimation ) return true; - // Yes, we use animtime. - int iMoveType = GetMoveType(); - if ( iMoveType != MOVETYPE_STEP && - iMoveType != MOVETYPE_NONE && - iMoveType != MOVETYPE_WALK && - iMoveType != MOVETYPE_FLY && - iMoveType != MOVETYPE_FLYGRAVITY ) - { - return true; - } + // TODO_ENHANCED: check if that's correct to do, since we use server side animations. + // // Yes, we use animtime. + // int iMoveType = GetMoveType(); + // if ( iMoveType != MOVETYPE_STEP && + // iMoveType != MOVETYPE_NONE && + // iMoveType != MOVETYPE_WALK && + // iMoveType != MOVETYPE_FLY && + // iMoveType != MOVETYPE_FLYGRAVITY ) + // { + // return true; + // } return false; } diff --git a/game/server/baseanimating.cpp b/game/server/baseanimating.cpp index c6ad540fb..fff94754e 100644 --- a/game/server/baseanimating.cpp +++ b/game/server/baseanimating.cpp @@ -292,13 +292,6 @@ CBaseAnimating::CBaseAnimating() m_flFadeScale = 0.0f; m_fBoneCacheFlags = 0; m_bUseIks = true; - - int sequence = SelectWeightedSequence( ACT_IDLE ); - - if (GetSequence() != sequence) - { - SetSequence( sequence ); - } } CBaseAnimating::~CBaseAnimating() diff --git a/game/server/cstrike/hostage/cs_simple_hostage.cpp b/game/server/cstrike/hostage/cs_simple_hostage.cpp index e30b9dcc1..79ffb6d63 100644 --- a/game/server/cstrike/hostage/cs_simple_hostage.cpp +++ b/game/server/cstrike/hostage/cs_simple_hostage.cpp @@ -861,15 +861,8 @@ void CHostage::HostageThink( void ) // set animation to idle for now StudioFrameAdvance(); - int sequence = SelectWeightedSequence( ACT_IDLE ); - if (GetSequence() != sequence) - { - SetSequence( sequence ); - } - m_PlayerAnimState->Update( GetAbsAngles()[YAW], GetAbsAngles()[PITCH] ); - if ( m_disappearTime && m_disappearTime < gpGlobals->curtime ) { // finished fading - remove us completely