Simplify.

Fix danger animation throwing off background sync.
This commit is contained in:
Glenn Maynard
2003-09-23 19:26:36 +00:00
parent 2bd4dbd600
commit 4ce1564d8a
2 changed files with 62 additions and 55 deletions
+22 -16
View File
@@ -388,17 +388,8 @@ void Background::LoadFromSong( Song* pSong )
m_pDancingCharacters->LoadNextSong();
}
void Background::Update( float fDeltaTime )
void Background::UpdateCurBGChange()
{
ActorFrame::Update( fDeltaTime );
if( IsDangerVisible() )
{
m_BGADanger.Update( fDeltaTime );
}
else
{
if( GAMESTATE->m_fMusicSeconds == GameState::MUSIC_SECONDS_INVALID )
return; /* hasn't been updated yet */
@@ -406,8 +397,9 @@ void Background::Update( float fDeltaTime )
return;
/* Only update BGAnimations if we're not in the middle of a stop. */
if( !GAMESTATE->m_bFreeze )
{
if( GAMESTATE->m_bFreeze )
return;
// Find the BGSegment we're in
int i;
int size = (int)(m_aBGChanges.size()) - 1;
@@ -415,8 +407,9 @@ void Background::Update( float fDeltaTime )
if( GAMESTATE->m_fSongBeat < m_aBGChanges[i+1].m_fStartBeat )
break;
if( i != m_iCurBGChangeIndex )
{
if( i == m_iCurBGChangeIndex )
return; /* OK */
LOG->Trace( "old bga %d -> new bga %d, %f, %f", i, m_iCurBGChangeIndex, m_aBGChanges[i].m_fStartBeat, GAMESTATE->m_fSongBeat );
m_iCurBGChangeIndex = i;
@@ -438,8 +431,23 @@ void Background::Update( float fDeltaTime )
m_pCurrentBGA->GainingFocus( change.m_fRate, change.m_bRewindMovie, change.m_bLoop );
m_fSecsLeftInFade = m_pFadingBGA!=NULL ? FADE_SECONDS : 0;
}
void Background::Update( float fDeltaTime )
{
ActorFrame::Update( fDeltaTime );
if( IsDangerVisible() )
{
m_BGADanger.Update( fDeltaTime );
}
/* Always update the current background, even when m_BGADanger is being displayed.
* Otherwise, we'll stop updating movies during danger (which may stop them from
* playing), and we won't start clips at the right time, which will throw backgrounds
* off sync. */
UpdateCurBGChange();
if( m_pCurrentBGA )
m_pCurrentBGA->Update( fDeltaTime );
if( m_pFadingBGA )
@@ -451,8 +459,6 @@ void Background::Update( float fDeltaTime )
if( fPercentOpaque <= 0 )
m_pFadingBGA = NULL;
}
}
}
if( m_pDancingCharacters )
m_pDancingCharacters->Update( fDeltaTime );
+1
View File
@@ -43,6 +43,7 @@ public:
protected:
bool IsDangerVisible();
void UpdateCurBGChange();
DancingCharacters* m_pDancingCharacters;