Skip to content

Commit

Permalink
Force sequence only if client side animation
Browse files Browse the repository at this point in the history
  • Loading branch information
XutaxKamay committed Sep 8, 2024
1 parent 9c84641 commit 9fdd0eb
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 39 deletions.
53 changes: 28 additions & 25 deletions game/client/c_baseanimating.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
7 changes: 0 additions & 7 deletions game/server/baseanimating.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
7 changes: 0 additions & 7 deletions game/server/cstrike/hostage/cs_simple_hostage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9fdd0eb

Please sign in to comment.