Created GameLoop::ChangeGame analogous to GameLoop::ChangeTheme. Changed ChangeTheme to use the AfterThemeChangeScreen metric instead of a passed in screen name from the theme being changed away from. ChangeGame uses the AfterGameChangeScreen and AfterGameAndThemeChangeScreen metrics to pick the screen to load after the change. New metrics are optional and default to InitialScreen. Changed ScreenManager::ThemeChanged to not duplicate the code in ReloadOverlayScreens. Fixed ScreenManager::IsScreenNameValid to check with HasMetric before using GetMetric. Changed game ConfOption logic to set the preference and work in a similar way to the theme ConfOption. Added THEME:SetTheme lua function.

This commit is contained in:
Kyzentun
2014-07-20 20:59:12 -06:00
parent 35ce025a1c
commit c3fb210291
13 changed files with 173 additions and 80 deletions
+3 -9
View File
@@ -177,7 +177,7 @@ static void GameSel( int &sel, bool ToSel, const ConfOption *pConfOption )
if( ToSel )
{
const RString sCurGameName = GAMESTATE->m_pCurGame->m_szName;
const RString sCurGameName = PREFSMAN->GetCurrentGame();
sel = 0;
for(unsigned i = 0; i < choices.size(); ++i)
@@ -186,13 +186,7 @@ static void GameSel( int &sel, bool ToSel, const ConfOption *pConfOption )
} else {
vector<const Game*> aGames;
GAMEMAN->GetEnabledGames( aGames );
StepMania::ChangeCurrentGame( aGames[sel] );
/* Reload metrics to force a refresh of CommonMetrics::DIFFICULTIES_TO_SHOW,
* mainly if we're not switching themes. I'm not sure if this was the
* case going from theme to theme, but if it was, it should be fixed
* now. There's probably be a better way to do it, but I'm not sure
* what it'd be. -aj */
THEME->ReloadMetrics();
PREFSMAN->SetCurrentGame(aGames[sel]->m_szName);
}
}
@@ -663,7 +657,7 @@ static void InitializeConfOptions()
#define ADD(x) g_ConfOptions.push_back( x )
// Select game
ADD( ConfOption( "Game", GameSel, GameChoices ) );
g_ConfOptions.back().m_iEffects = OPT_RESET_GAME;
g_ConfOptions.back().m_iEffects = OPT_CHANGE_GAME;
// Appearance options
ADD( ConfOption( "Language", Language, LanguageChoices ) );