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:
@@ -46,11 +46,6 @@ ScreenAttract::ScreenAttract( CString sName, bool bResetGameState ) : Screen( sN
|
|||||||
|
|
||||||
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(m_sName) );
|
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();
|
float fTimeUntilBeginFadingOut = m_Background.GetLengthSeconds() - m_Out.GetLengthSeconds();
|
||||||
if( fTimeUntilBeginFadingOut < 0 )
|
if( fTimeUntilBeginFadingOut < 0 )
|
||||||
{
|
{
|
||||||
@@ -134,6 +129,13 @@ void ScreenAttract::AttractInput( const DeviceInput& DeviceI, const InputEventTy
|
|||||||
|
|
||||||
void ScreenAttract::Update( float fDelta )
|
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);
|
Screen::Update(fDelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user