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-08-02 00:38:34 -07:00
committed by Jonathan Payne
parent 5828b2529b
commit 9b08ab5b52
13 changed files with 173 additions and 80 deletions
+7 -8
View File
@@ -805,10 +805,11 @@ static void SwitchToLastPlayedGame()
ASSERT( GAMEMAN->IsGameEnabled(pGame) );
StepMania::ChangeCurrentGame( pGame );
StepMania::InitializeCurrentGame( pGame );
}
void StepMania::ChangeCurrentGame( const Game* g, RString Theme )
// This function is meant to only be called during start up.
void StepMania::InitializeCurrentGame( const Game* g )
{
ASSERT( g != NULL );
ASSERT( GAMESTATE != NULL );
@@ -823,11 +824,9 @@ void StepMania::ChangeCurrentGame( const Game* g, RString Theme )
if( sAnnouncer.empty() )
sAnnouncer = GAMESTATE->GetCurrentGame()->m_szName;
if( sTheme.empty() )
sTheme = GAMESTATE->GetCurrentGame()->m_szName;
if( Theme.size() )
sTheme = Theme;
// It doesn't matter if sTheme is blank or invalid, THEME->STAL will set
// a selectable theme for us. -Kyz
// process theme and language command line arguments;
// these change the preferences in order for transparent loading -aj
RString argTheme;
@@ -1115,7 +1114,7 @@ int main(int argc, char* argv[])
INPUTFILTER = new InputFilter;
INPUTMAPPER = new InputMapper;
StepMania::ChangeCurrentGame( GAMESTATE->GetCurrentGame() );
StepMania::InitializeCurrentGame( GAMESTATE->GetCurrentGame() );
INPUTQUEUE = new InputQueue;
SONGINDEX = new SongCacheIndex;