fix attract music logic

This commit is contained in:
Glenn Maynard
2005-03-22 22:53:39 +00:00
parent 4c953a5f03
commit 59b59214e9
4 changed files with 25 additions and 13 deletions
+12 -8
View File
@@ -108,15 +108,19 @@ void ScreenAttract::AttractInput( const DeviceInput& DeviceI, const InputEventTy
// Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
} }
void ScreenAttract::StartPlayingMusic()
{
if( !GAMESTATE->IsTimeToPlayAttractSounds() )
{
SOUND->PlayMusic( "" ); // stop music
return;
}
ScreenWithMenuElements::StartPlayingMusic();
}
void ScreenAttract::Update( float fDelta ) void ScreenAttract::Update( float fDelta )
{ {
if( IsFirstUpdate() )
{
if( GAMESTATE->IsTimeToPlayAttractSounds() )
SOUND->PlayMusic( THEME->GetPathS(m_sName,"music") );
else
SOUND->PlayMusic( "" ); // stop music
}
ScreenWithMenuElements::Update(fDelta); ScreenWithMenuElements::Update(fDelta);
} }
@@ -135,7 +139,7 @@ void ScreenAttract::HandleScreenMessage( const ScreenMessage SM )
* going to interrupt it when we fade in, stop the old music before we fade out. */ * going to interrupt it when we fade in, stop the old music before we fade out. */
bool bMusicChanging = false; bool bMusicChanging = false;
if( PLAY_MUSIC ) if( PLAY_MUSIC )
bMusicChanging = THEME->GetPathS(NEXT_SCREEN,"music") != THEME->GetPathS(m_sName,"music",true); // GetPath optional on the next screen because it may not have music. bMusicChanging = THEME->GetPathS(m_sName,"music") != THEME->GetPathS(NEXT_SCREEN,"music",true); // GetPath optional on the next screen because it may not have music.
if( bMusicChanging ) if( bMusicChanging )
SOUND->PlayMusic( "" ); // stop the music SOUND->PlayMusic( "" ); // stop the music
+1
View File
@@ -19,6 +19,7 @@ public:
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
protected: protected:
virtual void StartPlayingMusic();
}; };
+9 -4
View File
@@ -122,6 +122,14 @@ ScreenWithMenuElements::~ScreenWithMenuElements()
SAFE_DELETE( m_textHelp ); SAFE_DELETE( m_textHelp );
} }
void ScreenWithMenuElements::StartPlayingMusic()
{
/* Some screens should leave the music alone (eg. ScreenPlayerOptions music
* sample left over from ScreenSelectMusic). */
if( PLAY_MUSIC )
SOUND->PlayMusic( THEME->GetPathS(m_sName,"music") );
}
void ScreenWithMenuElements::Update( float fDeltaTime ) void ScreenWithMenuElements::Update( float fDeltaTime )
{ {
if( m_bFirstUpdate ) if( m_bFirstUpdate )
@@ -130,10 +138,7 @@ void ScreenWithMenuElements::Update( float fDeltaTime )
* Play sounds after so loading so we don't thrash while loading files. */ * Play sounds after so loading so we don't thrash while loading files. */
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(m_sName+" intro") ); SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(m_sName+" intro") );
/* Some screens should leave the music alone (eg. ScreenPlayerOptions music StartPlayingMusic();
* sample left over from ScreenSelectMusic). */
if( PLAY_MUSIC )
SOUND->PlayMusic( THEME->GetPathS(m_sName,"music") );
/* Evaluate FirstUpdateCommand. */ /* Evaluate FirstUpdateCommand. */
this->RunCommands( FIRST_UPDATE_COMMAND ); this->RunCommands( FIRST_UPDATE_COMMAND );
+2
View File
@@ -29,6 +29,8 @@ public:
void ResetTimer(); void ResetTimer();
protected: protected:
virtual void StartPlayingMusic();
AutoActor m_sprUnderlay; AutoActor m_sprUnderlay;
AutoActor m_autoHeader; AutoActor m_autoHeader;
Sprite m_sprStyleIcon; Sprite m_sprStyleIcon;