From 74e02e55efe35467c19293df94db66f1d8e9a7d6 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 24 Feb 2005 20:37:39 +0000 Subject: [PATCH] make sure that large updates don't throw hibernation timing out of sync; this also affects small updates, preventing small sub-frame timing errors; if there's 10ms of hibernation left, and a 17ms update arrives, we should update for only 7ms, not 17ms --- stepmania/src/Actor.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index f547550eb7..ec6f573110 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -406,11 +406,18 @@ void Actor::Update( float fDeltaTime ) // LOG->Trace( "Actor::Update( %f )", fDeltaTime ); ASSERT_M( fDeltaTime >= 0, ssprintf("%f",fDeltaTime) ); - m_fHibernateSecondsLeft -= fDeltaTime; - m_fHibernateSecondsLeft = max( 0, m_fHibernateSecondsLeft ); + { + float fHibernate = m_fHibernateSecondsLeft; + m_fHibernateSecondsLeft -= fDeltaTime; + m_fHibernateSecondsLeft = max( 0, m_fHibernateSecondsLeft ); - if( m_fHibernateSecondsLeft > 0 ) - return; + /* If we're hibernating for 8 seconds, and fDeltaTime is 10 seconds, then + * set fDeltaTime to 2. */ + fDeltaTime = max( fDeltaTime - fHibernate, 0 ); + + if( fDeltaTime == 0 ) + return; + } switch( m_EffectClock ) {