Start attract music in first update, not ScreenAttract's ctor; we may have

more to load in the derived class, and it's better to wait for loads to finish
before starting music (starting music in the middle of a load then delaying
some more is ugly and emphasizes the load time)
This commit is contained in:
Glenn Maynard
2004-07-25 08:40:01 +00:00
parent 9965bbff54
commit 06c3b710fa
+7 -5
View File
@@ -46,11 +46,6 @@ ScreenAttract::ScreenAttract( CString sName, bool bResetGameState ) : Screen( sN
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(m_sName) );
if( GAMESTATE->IsTimeToPlayAttractSounds() )
SOUND->PlayMusic( THEME->GetPathToS(m_sName + " music") );
else
SOUND->PlayMusic( "" ); // stop music
float fTimeUntilBeginFadingOut = m_Background.GetLengthSeconds() - m_Out.GetLengthSeconds();
if( fTimeUntilBeginFadingOut < 0 )
{
@@ -134,6 +129,13 @@ void ScreenAttract::AttractInput( const DeviceInput& DeviceI, const InputEventTy
void ScreenAttract::Update( float fDelta )
{
if( IsFirstUpdate() )
{
if( GAMESTATE->IsTimeToPlayAttractSounds() )
SOUND->PlayMusic( THEME->GetPathToS(m_sName + " music") );
else
SOUND->PlayMusic( "" ); // stop music
}
Screen::Update(fDelta);
}