diff --git a/stepmania/src/ScreenOptionsMaster.cpp b/stepmania/src/ScreenOptionsMaster.cpp index c228d8bfa3..d6d5b9c0cc 100644 --- a/stepmania/src/ScreenOptionsMaster.cpp +++ b/stepmania/src/ScreenOptionsMaster.cpp @@ -498,6 +498,12 @@ void ScreenOptionsMaster::ExportOptions() PREFSMAN->SaveGlobalPrefsToDisk(); PREFSMAN->SaveGamePrefsToDisk(); } + + if( ChangeMask & OPT_RESET_GAME ) + { + ResetGame(); + m_NextScreen = ""; + } } void ScreenOptionsMaster::MenuStart( PlayerNumber pn ) @@ -515,7 +521,7 @@ void ScreenOptionsMaster::GoToNextState() { if( GAMESTATE->m_bEditing ) SCREENMAN->PopTopScreen(); - else + else if( m_NextScreen != "" ) SCREENMAN->SetNewScreen( m_NextScreen ); } diff --git a/stepmania/src/ScreenOptionsMasterPrefs.cpp b/stepmania/src/ScreenOptionsMasterPrefs.cpp index 8ed5c59bae..b0acb99cac 100644 --- a/stepmania/src/ScreenOptionsMasterPrefs.cpp +++ b/stepmania/src/ScreenOptionsMasterPrefs.cpp @@ -9,6 +9,9 @@ #include "SongOptions.h" #include "RageDisplay.h" #include "RageUtil.h" +#include "GameManager.h" +#include "GameState.h" +#include "InputMapper.h" /* "sel" is the selection in the menu. */ template @@ -32,6 +35,42 @@ static void MoveData( int &sel, bool &opt, bool ToSel ) } +static void GameChoices( CStringArray &out ) +{ + vector aGames; + GAMEMAN->GetEnabledGames( aGames ); + for( unsigned i=0; iGetGameDefForGame(game)->m_szName; + sGameName.MakeUpper(); + out.push_back( sGameName ); + } +} + +static void GameSel( int &sel, bool ToSel, const CStringArray &choices ) +{ + if( ToSel ) + { + const CString sCurGameName = GAMEMAN->GetGameDefForGame(GAMESTATE->m_CurGame)->m_szName; + + sel = 0; + for(unsigned i = 0; i < choices.size(); ++i) + if( !stricmp(choices[i], sCurGameName) ) + sel = i; + } else { + PREFSMAN->SaveGamePrefsToDisk(); + INPUTMAPPER->SaveMappingsToDisk(); // save mappings before switching the game + + vector aGames; + GAMEMAN->GetEnabledGames( aGames ); + GAMESTATE->m_CurGame = aGames[sel]; + + PREFSMAN->ReadGamePrefsFromDisk(); + INPUTMAPPER->ReadMappingsFromDisk(); + } +} + static void LanguageChoices( CStringArray &out ) { THEME->GetLanguages( out ); @@ -353,6 +392,9 @@ MOVE( ResamplingQuality, PREFSMAN->m_iSoundResampleQuality ); static const ConfOption g_ConfOptions[] = { + /* Select game */ + ConfOption( "Game", GameSel, GameChoices ), + /* Appearance options */ ConfOption( "Language", Language, LanguageChoices ), ConfOption( "Theme", Theme, ThemeChoices ), @@ -445,7 +487,8 @@ int ConfOption::GetEffects() const { TextureResolution, OPT_APPLY_GRAPHICS }, { KeepTexturesInMemory, OPT_APPLY_GRAPHICS }, { RefreshRate, OPT_APPLY_GRAPHICS }, - { WaitForVsync, OPT_APPLY_GRAPHICS } + { WaitForVsync, OPT_APPLY_GRAPHICS }, + { GameSel, OPT_RESET_GAME } }; int ret = OPT_SAVE_PREFERENCES; diff --git a/stepmania/src/ScreenOptionsMasterPrefs.h b/stepmania/src/ScreenOptionsMasterPrefs.h index 1064532cdc..074d3faaab 100644 --- a/stepmania/src/ScreenOptionsMasterPrefs.h +++ b/stepmania/src/ScreenOptionsMasterPrefs.h @@ -5,6 +5,7 @@ static const int MAX_OPTIONS=16; #define OPT_SAVE_PREFERENCES 0x1 #define OPT_APPLY_GRAPHICS 0x2 #define OPT_APPLY_THEME 0x4 +#define OPT_RESET_GAME 0x8 struct ConfOption {