diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 6f643f5a9a..eabba0773b 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -110,6 +110,7 @@ void ScreenGameplay::Init() LIGHTSMAN->SetLightsMode( LIGHTSMODE_GAMEPLAY ); m_pSoundMusic = NULL; + m_bPaused = false; /* We do this ourself. */ SOUND->HandleSongTimer( false ); @@ -260,11 +261,15 @@ void ScreenGameplay::Init() + m_SongBackground.SetName( "SongBackground" ); m_SongBackground.SetDrawOrder( DRAW_ORDER_BEFORE_EVERYTHING ); + ON_COMMAND( m_SongBackground ); this->AddChild( &m_SongBackground ); - m_Foreground.SetDrawOrder( DRAW_ORDER_OVERLAY+1 ); // on top of the overlay, but under transitions - this->AddChild( &m_Foreground ); + m_SongForeground.SetName( "SongForeground" ); + m_SongForeground.SetDrawOrder( DRAW_ORDER_OVERLAY+1 ); // on top of the overlay, but under transitions + ON_COMMAND( m_SongBackground ); + this->AddChild( &m_SongForeground ); if( PREFSMAN->m_bShowBeginnerHelper ) { @@ -1060,7 +1065,7 @@ void ScreenGameplay::LoadNextSong() else m_BeginnerHelper.SetHidden( false ); - m_Foreground.LoadFromSong( GAMESTATE->m_pCurSong ); + m_SongForeground.LoadFromSong( GAMESTATE->m_pCurSong ); m_fTimeSinceLastDancingComment = 0; @@ -1127,6 +1132,19 @@ float ScreenGameplay::StartPlayingSong(float MinTimeToNotes, float MinTimeToMusi return fFirstSecond - fStartSecond; } + +void ScreenGameplay::PauseGame( bool bPause ) +{ + if( m_bPaused == bPause ) + { + LOG->Trace( "ScreenGameplay::PauseGame(%i) received, but already in that state; ignored", bPause ); + return; + } + + m_bPaused = bPause; + m_pSoundMusic->Pause( bPause ); +} + // play assist ticks void ScreenGameplay::PlayTicks() { diff --git a/stepmania/src/ScreenGameplay.h b/stepmania/src/ScreenGameplay.h index 2f1286e992..6deaaa68a6 100644 --- a/stepmania/src/ScreenGameplay.h +++ b/stepmania/src/ScreenGameplay.h @@ -54,6 +54,7 @@ protected: void LoadNextSong(); void LoadCourseSongNumber( int SongNumber ); float StartPlayingSong(float MinTimeToNotes, float MinTimeToMusic); + void PauseGame( bool bPause ); void ShowSavePrompt( ScreenMessage SM_SendWhenDone ); void PlayAnnouncer( CString type, float fSeconds ); void UpdateLights(); @@ -73,6 +74,7 @@ protected: STATE_OUTRO, // not allowed to press Back NUM_DANCING_STATES } m_DancingState; + bool m_bPaused; vector m_apSongsQueue; // size may be >1 if playing a course vector m_vpStepsQueue[NUM_PLAYERS]; // size may be >1 if playing a course vector m_asModifiersQueue[NUM_PLAYERS];// size may be >1 if playing a course @@ -83,7 +85,7 @@ protected: LyricDisplay m_LyricDisplay; Background m_SongBackground; - Foreground m_Foreground; + Foreground m_SongForeground; Transition m_NextSongIn; // shows between songs in a course Transition m_NextSongOut; // shows between songs in a course