From a4c8c66d107f0040ef221fc21a3592709c28bc2a Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sat, 16 Aug 2008 10:42:50 +0000 Subject: [PATCH] add TestInitialScreen, remove ScreenTestMode. It's more convenient to enable/disable testing with one Prefrence than having to change 1 Preference + 1 metric --- stepmania/src/CommonMetrics.cpp | 1 - stepmania/src/CommonMetrics.h | 1 - stepmania/src/PrefsManager.cpp | 2 +- stepmania/src/PrefsManager.h | 2 +- stepmania/src/ScreenDebugOverlay.cpp | 13 ------------- stepmania/src/ScreenEnding.cpp | 2 +- stepmania/src/ScreenEvaluation.cpp | 2 +- stepmania/src/ScreenNameEntry.cpp | 4 ++-- stepmania/src/ScreenNameEntryTraditional.cpp | 2 +- stepmania/src/ScreenOptionsMaster.cpp | 2 +- stepmania/src/ScreenSelectMusic.cpp | 2 +- stepmania/src/StageStats.cpp | 2 +- stepmania/src/StepMania.cpp | 10 +++++++++- stepmania/src/StepMania.h | 1 + 14 files changed, 20 insertions(+), 26 deletions(-) diff --git a/stepmania/src/CommonMetrics.cpp b/stepmania/src/CommonMetrics.cpp index f0c262478a..e9441d27fe 100644 --- a/stepmania/src/CommonMetrics.cpp +++ b/stepmania/src/CommonMetrics.cpp @@ -11,7 +11,6 @@ static RString PLAYER_COLOR_NAME( size_t p ) { return ssprintf("ColorP%dCommand",int(p+1)); } -ThemeMetric CommonMetrics::INITIAL_SCREEN ("Common","InitialScreen"); ThemeMetric CommonMetrics::FIRST_ATTRACT_SCREEN ("Common","FirstAttractScreen"); ThemeMetric CommonMetrics::DEFAULT_MODIFIERS ("Common","DefaultModifiers" ); ThemeMetric1D CommonMetrics::PLAYER_COLOR ("Common",PLAYER_COLOR_NAME,NUM_PLAYERS); diff --git a/stepmania/src/CommonMetrics.h b/stepmania/src/CommonMetrics.h index ae71949cde..1e9b808ff3 100644 --- a/stepmania/src/CommonMetrics.h +++ b/stepmania/src/CommonMetrics.h @@ -50,7 +50,6 @@ private: // namespace CommonMetrics { - extern ThemeMetric INITIAL_SCREEN; extern ThemeMetric FIRST_ATTRACT_SCREEN; extern ThemeMetric DEFAULT_MODIFIERS; extern ThemeMetric1D PLAYER_COLOR; // TODO: Remove this and do all coloring in Lua diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index d2fb58e6ab..927139238b 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -248,7 +248,7 @@ PrefsManager::PrefsManager() : m_bAllowUnacceleratedRenderer ( "AllowUnacceleratedRenderer", false ), m_bThreadedInput ( "ThreadedInput", true ), m_bThreadedMovieDecode ( "ThreadedMovieDecode", true ), - m_bScreenTestMode ( "ScreenTestMode", false ), + m_sTestInitialScreen ( "TestInitialScreen", "" ), m_bDebugLights ( "DebugLights", false ), m_bMonkeyInput ( "MonkeyInput", false ), m_sMachineName ( "MachineName", "" ), diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index 675d40c961..a5b4474d76 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -224,7 +224,7 @@ public: Preference m_bAllowUnacceleratedRenderer; Preference m_bThreadedInput; Preference m_bThreadedMovieDecode; - Preference m_bScreenTestMode; + Preference m_sTestInitialScreen; Preference m_bDebugLights; Preference m_bMonkeyInput; Preference m_sMachineName; diff --git a/stepmania/src/ScreenDebugOverlay.cpp b/stepmania/src/ScreenDebugOverlay.cpp index ddb720c9fd..1b497d48db 100644 --- a/stepmania/src/ScreenDebugOverlay.cpp +++ b/stepmania/src/ScreenDebugOverlay.cpp @@ -706,18 +706,6 @@ class DebugLineAllowMultitexture : public IDebugLine } }; -class DebugLineScreenTestMode : public IDebugLine -{ - virtual RString GetDisplayTitle() { return SCREEN_TEST_MODE.GetValue(); } - virtual bool IsEnabled() { return PREFSMAN->m_bScreenTestMode.Get(); } - virtual RString GetPageName() const { return "Theme"; } - virtual void DoAndMakeSystemMessage( RString &sMessageOut ) - { - PREFSMAN->m_bScreenTestMode.Set( !PREFSMAN->m_bScreenTestMode ); - IDebugLine::DoAndMakeSystemMessage( sMessageOut ); - } -}; - class DebugLineShowMasks : public IDebugLine { virtual RString GetDisplayTitle() { return SCREEN_SHOW_MASKS.GetValue(); } @@ -1146,7 +1134,6 @@ DECLARE_ONE( DebugLineMonkeyInput ); DECLARE_ONE( DebugLineStats ); DECLARE_ONE( DebugLineVsync ); DECLARE_ONE( DebugLineAllowMultitexture ); -DECLARE_ONE( DebugLineScreenTestMode ); DECLARE_ONE( DebugLineShowMasks ); DECLARE_ONE( DebugLineProfileSlot ); DECLARE_ONE( DebugLineClearProfileStats ); diff --git a/stepmania/src/ScreenEnding.cpp b/stepmania/src/ScreenEnding.cpp index c323569848..c1348fa3f7 100644 --- a/stepmania/src/ScreenEnding.cpp +++ b/stepmania/src/ScreenEnding.cpp @@ -24,7 +24,7 @@ REGISTER_SCREEN_CLASS( ScreenEnding ); ScreenEnding::ScreenEnding() { - if( PREFSMAN->m_bScreenTestMode ) + if( PREFSMAN->m_sTestInitialScreen.Get() != "" ) { PROFILEMAN->LoadFirstAvailableProfile(PLAYER_1); PROFILEMAN->LoadFirstAvailableProfile(PLAYER_2); diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index 5aa9512d17..bb8ab60b2b 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -86,7 +86,7 @@ void ScreenEvaluation::Init() // debugging // - if( PREFSMAN->m_bScreenTestMode && CommonMetrics::INITIAL_SCREEN == m_sName ) // Only fill StageStats with fake info if we're the InitialScreen (i.e. StageStats not already filled) + if( PREFSMAN->m_sTestInitialScreen.Get() == m_sName ) // Only fill StageStats with fake info if we're the InitialScreen (i.e. StageStats not already filled) { PROFILEMAN->LoadFirstAvailableProfile(PLAYER_1); PROFILEMAN->LoadFirstAvailableProfile(PLAYER_2); diff --git a/stepmania/src/ScreenNameEntry.cpp b/stepmania/src/ScreenNameEntry.cpp index 8dd48f1cfd..0e2ecbc5a0 100644 --- a/stepmania/src/ScreenNameEntry.cpp +++ b/stepmania/src/ScreenNameEntry.cpp @@ -20,7 +20,7 @@ #include "InputEventPlus.h" #include "InputMapper.h" -// used in ScreenTestMode section +// used in TestScreen section #include "SongManager.h" #include "Song.h" #include "StatsManager.h" @@ -119,7 +119,7 @@ float ScreenNameEntry::ScrollingText::GetClosestCharYOffset( float fFakeBeat ) c REGISTER_SCREEN_CLASS( ScreenNameEntry ); ScreenNameEntry::ScreenNameEntry() { - if( PREFSMAN->m_bScreenTestMode ) + if( PREFSMAN->m_sTestInitialScreen.Get() != "" ) { GAMESTATE->m_bSideIsJoined[PLAYER_1] = true; GAMESTATE->m_bSideIsJoined[PLAYER_2] = true; diff --git a/stepmania/src/ScreenNameEntryTraditional.cpp b/stepmania/src/ScreenNameEntryTraditional.cpp index 73e81bb2a5..c403201797 100644 --- a/stepmania/src/ScreenNameEntryTraditional.cpp +++ b/stepmania/src/ScreenNameEntryTraditional.cpp @@ -18,7 +18,7 @@ REGISTER_SCREEN_CLASS( ScreenNameEntryTraditional ); void ScreenNameEntryTraditional::Init() { - if( PREFSMAN->m_bScreenTestMode && CommonMetrics::INITIAL_SCREEN == m_sName ) + if( PREFSMAN->m_sTestInitialScreen.Get() == m_sName ) { GAMESTATE->m_bSideIsJoined[PLAYER_1] = true; GAMESTATE->m_bSideIsJoined[PLAYER_2] = true; diff --git a/stepmania/src/ScreenOptionsMaster.cpp b/stepmania/src/ScreenOptionsMaster.cpp index 5028dc1421..450042a5b2 100644 --- a/stepmania/src/ScreenOptionsMaster.cpp +++ b/stepmania/src/ScreenOptionsMaster.cpp @@ -141,7 +141,7 @@ void ScreenOptionsMaster::HandleScreenMessage( const ScreenMessage SM ) if( m_iChangeMask & OPT_RESET_GAME ) { StepMania::ResetGame(); - m_sNextScreen = CommonMetrics::INITIAL_SCREEN; + m_sNextScreen = StepMania::GetInitialScreen(); } if( m_iChangeMask & OPT_APPLY_SOUND ) diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index 6c54e067e2..2e7a895a47 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -58,7 +58,7 @@ static RageTimer g_StartedLoadingAt(RageZeroTimer); REGISTER_SCREEN_CLASS( ScreenSelectMusic ); void ScreenSelectMusic::Init() { - if( PREFSMAN->m_bScreenTestMode && CommonMetrics::INITIAL_SCREEN == m_sName ) + if( PREFSMAN->m_sTestInitialScreen.Get() == m_sName ) { GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR ); GAMESTATE->SetCurrentStyle( GameManager::GameAndStringToStyle(GameManager::GetDefaultGame(),"versus") ); diff --git a/stepmania/src/StageStats.cpp b/stepmania/src/StageStats.cpp index d1b74c6307..bd69a4e494 100644 --- a/stepmania/src/StageStats.cpp +++ b/stepmania/src/StageStats.cpp @@ -137,7 +137,7 @@ void StageStats::CommitScores( bool bSummary ) return; /* don't save scores in battle */ } - if( PREFSMAN->m_bScreenTestMode ) + if( PREFSMAN->m_sTestInitialScreen.Get() != "" ) { FOREACH_PlayerNumber( pn ) { diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index f5e3cfdb5d..7a83fb57cd 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -313,6 +313,14 @@ void StepMania::ResetGame() PREFSMAN->SavePrefsToDisk(); } +ThemeMetric INITIAL_SCREEN ("Common","InitialScreen"); +RString StepMania::GetInitialScreen() +{ + if( PREFSMAN->m_sTestInitialScreen.Get() != "" ) + return PREFSMAN->m_sTestInitialScreen; + return INITIAL_SCREEN; +} + #if defined(WIN32) static Preference g_iLastSeenMemory( "LastSeenMemory", 0 ); #endif @@ -1079,7 +1087,7 @@ int main(int argc, char* argv[]) /* Now that GAMESTATE is reset, tell SCREENMAN to update the theme (load * overlay screens and global sounds), and load the initial screen. */ SCREENMAN->ThemeChanged(); - SCREENMAN->SetNewScreen( CommonMetrics::INITIAL_SCREEN ); + SCREENMAN->SetNewScreen( StepMania::GetInitialScreen() ); // Do this after ThemeChanged so that we can show a system message RString sMessage; diff --git a/stepmania/src/StepMania.h b/stepmania/src/StepMania.h index 6e19867bd1..d93ec10cf3 100644 --- a/stepmania/src/StepMania.h +++ b/stepmania/src/StepMania.h @@ -12,6 +12,7 @@ namespace StepMania void ApplyGraphicOptions(); void ResetPreferences(); void ResetGame(); + RString GetInitialScreen(); void ChangeCurrentGame( const Game* g ); // If successful, return filename of screenshot in sDir, else return ""