Force sequence only if client side animation

This commit is contained in:
unknown 2024-09-08 23:26:10 +02:00
parent 9c846412ba
commit 9fdd0ebe71
3 changed files with 28 additions and 39 deletions

View file

@ -1152,24 +1152,26 @@ CStudioHdr *C_BaseAnimating::OnNewModel()
AddEFlags( EFL_USE_PARTITION_WHEN_NOT_SOLID ); AddEFlags( EFL_USE_PARTITION_WHEN_NOT_SOLID );
} }
if (m_bClientSideAnimation)
// 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; // 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;
m_nSequence = -1; if ( GetSequence() >= hdr->GetNumSeq() )
SetSequence( forceSequence ); {
forceSequence = 0;
}
if ( m_bResetSequenceInfoOnLoad ) m_nSequence = -1;
{ SetSequence( forceSequence );
m_bResetSequenceInfoOnLoad = false;
ResetSequenceInfo(); if ( m_bResetSequenceInfoOnLoad )
{
m_bResetSequenceInfoOnLoad = false;
ResetSequenceInfo();
}
} }
return hdr; return hdr;
@ -4219,16 +4221,17 @@ bool C_BaseAnimating::IsSelfAnimating()
if ( m_bClientSideAnimation ) if ( m_bClientSideAnimation )
return true; return true;
// Yes, we use animtime. // TODO_ENHANCED: check if that's correct to do, since we use server side animations.
int iMoveType = GetMoveType(); // // Yes, we use animtime.
if ( iMoveType != MOVETYPE_STEP && // int iMoveType = GetMoveType();
iMoveType != MOVETYPE_NONE && // if ( iMoveType != MOVETYPE_STEP &&
iMoveType != MOVETYPE_WALK && // iMoveType != MOVETYPE_NONE &&
iMoveType != MOVETYPE_FLY && // iMoveType != MOVETYPE_WALK &&
iMoveType != MOVETYPE_FLYGRAVITY ) // iMoveType != MOVETYPE_FLY &&
{ // iMoveType != MOVETYPE_FLYGRAVITY )
return true; // {
} // return true;
// }
return false; return false;
} }

View file

@ -292,13 +292,6 @@ CBaseAnimating::CBaseAnimating()
m_flFadeScale = 0.0f; m_flFadeScale = 0.0f;
m_fBoneCacheFlags = 0; m_fBoneCacheFlags = 0;
m_bUseIks = true; m_bUseIks = true;
int sequence = SelectWeightedSequence( ACT_IDLE );
if (GetSequence() != sequence)
{
SetSequence( sequence );
}
} }
CBaseAnimating::~CBaseAnimating() CBaseAnimating::~CBaseAnimating()

View file

@ -861,15 +861,8 @@ void CHostage::HostageThink( void )
// set animation to idle for now // set animation to idle for now
StudioFrameAdvance(); StudioFrameAdvance();
int sequence = SelectWeightedSequence( ACT_IDLE );
if (GetSequence() != sequence)
{
SetSequence( sequence );
}
m_PlayerAnimState->Update( GetAbsAngles()[YAW], GetAbsAngles()[PITCH] ); m_PlayerAnimState->Update( GetAbsAngles()[YAW], GetAbsAngles()[PITCH] );
if ( m_disappearTime && m_disappearTime < gpGlobals->curtime ) if ( m_disappearTime && m_disappearTime < gpGlobals->curtime )
{ {
// finished fading - remove us completely // finished fading - remove us completely