From 9032ee0163801909b374a6eeb14f7bbd44824790 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Thu, 23 Dec 2004 09:48:16 +0000 Subject: [PATCH] fix skips in BGAnimation on first update --- stepmania/src/ScreenManager.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/stepmania/src/ScreenManager.cpp b/stepmania/src/ScreenManager.cpp index 8a717c8a78..562f8e61fb 100644 --- a/stepmania/src/ScreenManager.cpp +++ b/stepmania/src/ScreenManager.cpp @@ -142,16 +142,18 @@ void ScreenManager::Update( float fDeltaTime ) */ ASSERT( !m_ScreenStack.empty() || m_sDelayedScreen != "" ); // Why play the game if there is nothing showing? - m_pSharedBGA->Update( fDeltaTime ); + Screen* pScreen = m_ScreenStack.empty() ? NULL : GetTopScreen(); - if( !m_ScreenStack.empty() ) - { - Screen* pScreen = GetTopScreen(); - if( pScreen->IsFirstUpdate() ) - pScreen->Update( 0 ); - else - pScreen->Update( fDeltaTime ); - } + /* Loading a new screen can take seconds and cause a big jump on the new + * Screen's first update. Clamp the first update delta so that the + * animations don't jump. */ + if( pScreen && pScreen->IsFirstUpdate() ) + fDeltaTime = 0; + + if( pScreen ) + pScreen->Update( fDeltaTime ); + + m_pSharedBGA->Update( fDeltaTime ); m_SystemLayer->Update( fDeltaTime );