Allow gestures to loop backwards if the playback rate is negative

This commit is contained in:
FlaminSarge 2025-03-03 06:28:16 -08:00
parent aea94b32cb
commit 5379aaa353

View file

@ -1287,6 +1287,11 @@ void CMultiPlayerAnimState::UpdateGestureLayer( CStudioHdr *pStudioHdr, GestureS
// Get the current cycle.
float flCycle = pGesture->m_pAnimLayer->m_flCycle;
flCycle += pPlayer->GetSequenceCycleRate( pStudioHdr, pGesture->m_pAnimLayer->m_nSequence ) * gpGlobals->frametime * GetGesturePlaybackRate() * pGesture->m_pAnimLayer->m_flPlaybackRate;
if ( flCycle < 0.0f )
{
// if playback rate is negative, allow the animation to loop backwards
flCycle = 1.0f;
}
pGesture->m_pAnimLayer->m_flPrevCycle = pGesture->m_pAnimLayer->m_flCycle;
pGesture->m_pAnimLayer->m_flCycle = flCycle;