have ScreenWithMenuElements play and stop music (instead of ScreenOptions and ScreenSelect)
Add StopMusicOnBack metric
This commit is contained in:
@@ -2403,6 +2403,8 @@ UnderlayOnCommand=
|
||||
UnderlayOffCommand=
|
||||
CodeNames=
|
||||
FirstUpdateCommand=
|
||||
PlayMusic=1
|
||||
StopMusicOnBack=1
|
||||
|
||||
[MenuTimer]
|
||||
WarningStart=6
|
||||
@@ -3163,6 +3165,8 @@ TimerSeconds=0
|
||||
[ScreenAttract]
|
||||
StartScreen=@ScreenTitleBranch()
|
||||
Fallback=ScreenWithMenuElementsBlank
|
||||
#TRICKY: ScreenAttract plays its own music according to an attract music counter
|
||||
PlayMusic=0
|
||||
|
||||
[ScreenWithMenuElementsBlank]
|
||||
Fallback=ScreenWithMenuElements
|
||||
@@ -3763,6 +3767,7 @@ Line5=list,AssistTick
|
||||
Line6=list,Rate
|
||||
Line7=list,AutoAdjust
|
||||
Line8=list,SaveScores
|
||||
StopMusicOnBack=0
|
||||
|
||||
[ScreenCredits]
|
||||
Class=ScreenCredits
|
||||
@@ -3847,7 +3852,6 @@ HelperY=SCREEN_CENTER_Y+80
|
||||
|
||||
[ScreenOptionsMaster]
|
||||
Fallback=ScreenOptions
|
||||
PlayMusic=1
|
||||
|
||||
# Player options
|
||||
Speed=12
|
||||
|
||||
@@ -26,8 +26,7 @@
|
||||
|
||||
REGISTER_SCREEN_CLASS( ScreenOptionsMaster );
|
||||
ScreenOptionsMaster::ScreenOptionsMaster( CString sClassName ):
|
||||
ScreenOptions( sClassName ),
|
||||
PLAY_MUSIC( sClassName, "PlayMusic" )
|
||||
ScreenOptions( sClassName )
|
||||
{
|
||||
LOG->Trace("ScreenOptionsMaster::ScreenOptionsMaster(%s)", m_sName.c_str() );
|
||||
}
|
||||
@@ -106,22 +105,6 @@ ScreenOptionsMaster::~ScreenOptionsMaster()
|
||||
OptionRowHandlers.clear();
|
||||
}
|
||||
|
||||
void ScreenOptionsMaster::Update( float fDelta )
|
||||
{
|
||||
if( m_bFirstUpdate )
|
||||
{
|
||||
/*
|
||||
* Don't play sounds during the ctor, since derived classes havn't loaded yet.
|
||||
* Leave the music alone (eg. ScreenPlayerOptions music sample
|
||||
* left over from ScreenSelectMusic).
|
||||
*/
|
||||
if( PLAY_MUSIC )
|
||||
SOUND->PlayMusic( THEME->GetPathS( m_sName, "music" ) );
|
||||
}
|
||||
|
||||
ScreenOptions::Update( fDelta );
|
||||
}
|
||||
|
||||
void ScreenOptionsMaster::ImportOptions( int r, PlayerNumber pn )
|
||||
{
|
||||
ASSERT( GAMESTATE->IsHumanPlayer(pn) );
|
||||
|
||||
@@ -11,10 +11,8 @@ public:
|
||||
ScreenOptionsMaster( CString sName );
|
||||
virtual void Init();
|
||||
virtual ~ScreenOptionsMaster();
|
||||
void Update( float fDelta );
|
||||
|
||||
protected:
|
||||
|
||||
int m_iChangeMask;
|
||||
CString m_sNextScreen;
|
||||
|
||||
@@ -31,8 +29,6 @@ protected:
|
||||
virtual void GoToPrevScreen();
|
||||
|
||||
virtual void RefreshIcons( int row, PlayerNumber pn );
|
||||
|
||||
ThemeMetric<bool> PLAY_MUSIC;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -109,13 +109,6 @@ ScreenSelect::~ScreenSelect()
|
||||
|
||||
void ScreenSelect::Update( float fDelta )
|
||||
{
|
||||
if(m_bFirstUpdate)
|
||||
{
|
||||
/* Don't play sounds during the ctor, since derived classes havn't loaded yet. */
|
||||
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(m_sName+" intro") );
|
||||
SOUND->PlayMusic( THEME->GetPathS(m_sName,"music") );
|
||||
}
|
||||
|
||||
if( !IsTransitioning() )
|
||||
{
|
||||
if( IDLE_COMMENT_SECONDS > 0 && m_timerIdleComment.PeekDeltaTime() >= IDLE_COMMENT_SECONDS )
|
||||
|
||||
@@ -23,9 +23,9 @@ public:
|
||||
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
|
||||
virtual void HandleScreenMessage( const ScreenMessage SM );
|
||||
virtual void HandleMessage( const CString &sMessage );
|
||||
|
||||
virtual void MenuBack( PlayerNumber pn );
|
||||
|
||||
virtual void MenuBack( PlayerNumber pn );
|
||||
|
||||
protected:
|
||||
virtual int GetSelectionIndex( PlayerNumber pn ) = 0;
|
||||
virtual void UpdateSelectableChoices() = 0; // derived screens must handle this
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
#define TIMER_STEALTH THEME->GetMetricB(m_sName,"TimerStealth")
|
||||
#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 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 );
|
||||
ScreenWithMenuElements::ScreenWithMenuElements( CString sClassName ) : Screen( sClassName )
|
||||
@@ -109,8 +111,6 @@ void ScreenWithMenuElements::Init()
|
||||
this->AddChild( &m_Back );
|
||||
|
||||
m_In.StartTransitioning();
|
||||
|
||||
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(m_sName) );
|
||||
}
|
||||
|
||||
ScreenWithMenuElements::~ScreenWithMenuElements()
|
||||
@@ -123,6 +123,15 @@ void ScreenWithMenuElements::Update( float fDeltaTime )
|
||||
{
|
||||
if( m_bFirstUpdate )
|
||||
{
|
||||
/* Don't play sounds during the ctor, since derived classes havn't loaded yet.
|
||||
* Play sounds after so loading so we don't thrash while loading files. */
|
||||
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(m_sName+" intro") );
|
||||
|
||||
/* 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") );
|
||||
|
||||
/* Evaluate FirstUpdateCommand. */
|
||||
this->RunCommands( m_FirstUpdateCommand );
|
||||
}
|
||||
@@ -183,6 +192,9 @@ void ScreenWithMenuElements::Back( ScreenMessage smSendWhenDone )
|
||||
if( m_Back.IsTransitioning() )
|
||||
return; // ignore
|
||||
|
||||
if( STOP_MUSIC_ON_BACK )
|
||||
SOUND->StopMusic();
|
||||
|
||||
m_MenuTimer->Stop();
|
||||
m_Back.StartTransitioning( smSendWhenDone );
|
||||
SCREENMAN->PlayBackSound();
|
||||
|
||||
Reference in New Issue
Block a user