From 0eda984d16241db385a90cdbd6cdfb60d2c9785e Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 24 Feb 2003 03:26:33 +0000 Subject: [PATCH] use StoreSelectedOptions and RestoreSelectedOptions store options earlier; restore them more consistently --- stepmania/src/ScreenGameplay.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 80e216cc07..f0f0f2b479 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -106,6 +106,9 @@ ScreenGameplay::ScreenGameplay( bool bDemonstration ) if( GAMESTATE->m_pCurSong == NULL && GAMESTATE->m_pCurCourse == NULL ) return; // ScreenDemonstration will move us to the next scren. We just need to survive for one update without crashing. + /* Save selected options before we change them. */ + GAMESTATE->StoreSelectedOptions(); + { for( int p=0; pResetMusicStatistics(); int p; for( p=0; pm_CurStageStats.iSongsPlayed[p] == 0 ) - GAMESTATE->m_SelectedOptions[p] = GAMESTATE->m_PlayerOptions[p]; - if( GAMESTATE->IsPlayerEnabled(p) ) GAMESTATE->m_CurStageStats.iSongsPlayed[p]++; - } switch( GAMESTATE->m_PlayMode ) { @@ -536,14 +533,15 @@ void ScreenGameplay::LoadNextSong() iPlaySongIndex %= m_apCourseSongs.size(); GAMESTATE->m_pCurSong = m_apCourseSongs[iPlaySongIndex]; + // Restore the player's originally selected options. + GAMESTATE->RestoreSelectedOptions(); + for( p=0; pm_pCurNotes[p] = m_apCourseNotes[iPlaySongIndex]; - // Restore the player's originally selected options. - GAMESTATE->m_PlayerOptions[p] = GAMESTATE->m_SelectedOptions[p]; + // Put courses options into effect. GAMESTATE->m_PlayerOptions[p].FromString( m_asCourseModifiers[iPlaySongIndex] ); - GAMESTATE->m_SongOptions.Init(); GAMESTATE->m_SongOptions.FromString( m_asCourseModifiers[iPlaySongIndex] ); } } @@ -1433,9 +1431,8 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) break; case SM_GoToScreenAfterBack: /* Reset options. (Should this be done in ScreenSelect*?) */ - for( p=0; pm_PlayerOptions[p] = GAMESTATE->m_SelectedOptions[p]; - GAMESTATE->m_SongOptions.Init(); + GAMESTATE->RestoreSelectedOptions(); + switch( GAMESTATE->m_PlayMode ) { case PLAY_MODE_ARCADE: @@ -1451,6 +1448,9 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) } break; case SM_GoToStateAfterCleared: + /* Reset options. (Should this be done in ScreenSelect*?) */ + GAMESTATE->RestoreSelectedOptions(); + if( m_bChangedOffsetOrBPM ) { m_bChangedOffsetOrBPM = false; @@ -1518,6 +1518,9 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) break; case SM_GoToScreenAfterFail: + /* Reset options. (Should this be done in ScreenSelect*?) */ + GAMESTATE->RestoreSelectedOptions(); + if( m_bChangedOffsetOrBPM ) { m_bChangedOffsetOrBPM = false;