From 348cf4d15ca9b6ed709d0869450fd9f5ea9a0efa Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 21 Mar 2005 01:14:30 +0000 Subject: [PATCH] look at PLAY_MUSIC when calculating whether or not to stop the music --- stepmania/src/ScreenAttract.cpp | 13 +++++-------- stepmania/src/ScreenWithMenuElements.cpp | 6 +++--- stepmania/src/ScreenWithMenuElements.h | 4 +++- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/stepmania/src/ScreenAttract.cpp b/stepmania/src/ScreenAttract.cpp index 4b430b84b9..e7ee8b4721 100644 --- a/stepmania/src/ScreenAttract.cpp +++ b/stepmania/src/ScreenAttract.cpp @@ -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 ); diff --git a/stepmania/src/ScreenWithMenuElements.cpp b/stepmania/src/ScreenWithMenuElements.cpp index 980a5fdaf5..1389e11655 100644 --- a/stepmania/src/ScreenWithMenuElements.cpp +++ b/stepmania/src/ScreenWithMenuElements.cpp @@ -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 ); diff --git a/stepmania/src/ScreenWithMenuElements.h b/stepmania/src/ScreenWithMenuElements.h index d440762800..d3f9d2fc6b 100644 --- a/stepmania/src/ScreenWithMenuElements.h +++ b/stepmania/src/ScreenWithMenuElements.h @@ -37,11 +37,13 @@ protected: AutoActor m_autoFooter; HelpDisplay *m_textHelp; AutoActor m_sprOverlay; - ThemeMetric m_FirstUpdateCommand; Transition m_In; Transition m_Out; Transition m_Cancel; + + ThemeMetric FIRST_UPDATE_COMMAND; + ThemeMetric PLAY_MUSIC; }; #endif