look at PLAY_MUSIC when calculating whether or not to stop the music

This commit is contained in:
Chris Danford
2005-03-21 01:14:30 +00:00
parent dfee85c3fd
commit 348cf4d15c
3 changed files with 11 additions and 12 deletions
+5 -8
View File
@@ -133,14 +133,11 @@ void ScreenAttract::HandleScreenMessage( const ScreenMessage SM )
/* Look at the def of the screen we're going to; if it has a music theme element
* and it's the same as the one we're playing now, don't stop. However, if we're
* going to interrupt it when we fade in, stop the old music before we fade out. */
/* GetPath optional because this screen and the next screen may not have music -
* if PLAY_MUSIC == 0. We can't access PLAY_MUSIC from here. */
CString sThisMusic = THEME->GetPathS( NEXT_SCREEN, "music", true );
CString sNextMusic = THEME->GetPathS( m_sName, "music", true );
bool bGoingToPlayTheSameMusic = sThisMusic == sNextMusic;
if( bGoingToPlayTheSameMusic )
; // do nothing
else
bool bMusicChanging = false;
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.
if( bMusicChanging )
SOUND->PlayMusic( "" ); // stop the music
SCREENMAN->SetNewScreen( NEXT_SCREEN );
+3 -3
View File
@@ -16,7 +16,6 @@
#define STYLE_ICON THEME->GetMetricB(m_sName,"StyleIcon")
#define MEMORY_CARD_ICONS THEME->GetMetricB(m_sName,"MemoryCardIcons")
#define FORCE_TIMER THEME->GetMetricB(m_sName,"ForceTimer")
#define PLAY_MUSIC THEME->GetMetricB(m_sName,"PlayMusic")
#define STOP_MUSIC_ON_BACK THEME->GetMetricB(m_sName,"StopMusicOnBack")
//REGISTER_SCREEN_CLASS( ScreenWithMenuElements );
@@ -32,7 +31,8 @@ void ScreenWithMenuElements::Init()
Screen::Init();
m_FirstUpdateCommand.Load( m_sName, "FirstUpdateCommand" );
FIRST_UPDATE_COMMAND.Load( m_sName, "FirstUpdateCommand" );
PLAY_MUSIC.Load( m_sName, "PlayMusic" );
ASSERT( this->m_SubActors.empty() ); // don't call Init twice!
@@ -133,7 +133,7 @@ void ScreenWithMenuElements::Update( float fDeltaTime )
SOUND->PlayMusic( THEME->GetPathS(m_sName,"music") );
/* Evaluate FirstUpdateCommand. */
this->RunCommands( m_FirstUpdateCommand );
this->RunCommands( FIRST_UPDATE_COMMAND );
}
Screen::Update( fDeltaTime );
+3 -1
View File
@@ -37,11 +37,13 @@ protected:
AutoActor m_autoFooter;
HelpDisplay *m_textHelp;
AutoActor m_sprOverlay;
ThemeMetric<LuaExpression> m_FirstUpdateCommand;
Transition m_In;
Transition m_Out;
Transition m_Cancel;
ThemeMetric<LuaExpression> FIRST_UPDATE_COMMAND;
ThemeMetric<bool> PLAY_MUSIC;
};
#endif