diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 1c446d450b..d6ebf2a264 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -27,7 +27,6 @@ #include "RageFile.h" #include "RageLog.h" #include "RageUtil.h" -#include "ScreenEdit.h" #include "song.h" #include "SongManager.h" #include "SongUtil.h" @@ -118,7 +117,8 @@ GameState::GameState() : m_pEditSourceSteps( Message_EditSourceStepsChanged ), m_stEditSource( Message_EditSourceStepsTypeChanged ), m_iEditCourseEntryIndex( Message_EditCourseEntryIndexChanged ), - m_sEditLocalProfileID( Message_EditLocalProfileIDChanged ) + m_sEditLocalProfileID( Message_EditLocalProfileIDChanged ), + m_bDidModeChangeNoteSkin( false ) { g_pImpl = new GameStateImpl; @@ -286,24 +286,7 @@ void GameState::Reset() STATSMAN->Reset(); - SongOptions so; - GetDefaultSongOptions( so ); - m_SongOptions.Assign( ModsLevel_Preferred, so ); - - FOREACH_PlayerNumber(p) - { - // I can't think of a good reason to have both game-specific - // default mods and theme specific default mods. We should choose - // one or the other. -Chris - // Having default modifiers in prefs is needed for several things. - // The theme setting is for eg. BM being reverse by default. (This - // could be done in the title menu GameCommand, but then it wouldn't - // affect demo, and other non-gameplay things ...) -glenn - - PlayerOptions po; - GetDefaultPlayerOptions( po ); - m_pPlayerState[p]->m_PlayerOptions.Assign( ModsLevel_Preferred, po ); - } + ResetOptions(); FOREACH_PlayerNumber(p) { @@ -327,8 +310,6 @@ void GameState::Reset() m_bBackedOutOfFinalStage = false; - ScreenEdit::ResetStaticState(); - ApplyCmdline(); } @@ -1170,6 +1151,13 @@ void GameState::ApplyStageModifiers( PlayerNumber pn, RString sModifiers ) void GameState::ResetOptions() { + // I can't think of a good reason to have both game-specific + // default mods and theme specific default mods. We should choose + // one or the other. -Chris + // Having default modifiers in prefs is needed for several things. + // The theme setting is for eg. BM being reverse by default. (This + // could be done in the title menu GameCommand, but then it wouldn't + // affect demo, and other non-gameplay things ...) -glenn FOREACH_PlayerNumber( p ) { PlayerOptions po; @@ -1179,6 +1167,8 @@ void GameState::ResetOptions() SongOptions so; GetDefaultSongOptions( so ); m_SongOptions.Assign( ModsLevel_Preferred, so ); + + m_bDidModeChangeNoteSkin = false; } bool GameState::IsDisqualified( PlayerNumber pn ) diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index f84d3177cd..53aaef40de 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -205,6 +205,10 @@ public: ModsGroup m_SongOptions; + // True if the current mode has changed the default NoteSkin, such as Edit/Sync Songs does. + // Note: any mode that wants to use it must set it + bool m_bDidModeChangeNoteSkin; + void GetDefaultPlayerOptions( PlayerOptions &po ); void GetDefaultSongOptions( SongOptions &so ); void ApplyPreferredModifiers( PlayerNumber pn, RString sModifiers ); diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index 5122038de2..21abb011b1 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -626,11 +626,6 @@ static BackgroundLayer g_CurrentBGChangeLayer = BACKGROUND_LAYER_Invalid; static const RString EDITOR_NOTE_SKIN = "note"; static bool s_bChangedNoteSkin = false; -void ScreenEdit::ResetStaticState() -{ - s_bChangedNoteSkin = false; -} - static void SetDefaultEditorNoteSkin( size_t num, RString &sNameOut, RString &defaultValueOut ) { sNameOut = ssprintf( "EditorNoteSkinP%d", int(num + 1) ); @@ -693,9 +688,9 @@ void ScreenEdit::Init() // We keep track of this bit of state so that when the user is in Edit/Sync Songs and makes a change to the NoteSkins, // that change is "sticky" across multiple ScreenEdits. That is the way the rest of the options work. // TODO: It would be cleaner to do this by making it possible to set an option in metrics.ini. - if( !s_bChangedNoteSkin ) + if( !GAMESTATE->m_bDidModeChangeNoteSkin ) { - s_bChangedNoteSkin = true; + GAMESTATE->m_bDidModeChangeNoteSkin = true; FOREACH_PlayerNumber( pn ) { const RString &sNoteSkin = EDITOR_NOTE_SKINS[pn].Get(); diff --git a/stepmania/src/ScreenEdit.h b/stepmania/src/ScreenEdit.h index ea18f1613f..55f9d8d2b4 100644 --- a/stepmania/src/ScreenEdit.h +++ b/stepmania/src/ScreenEdit.h @@ -171,8 +171,6 @@ public: virtual void BeginScreen(); virtual void EndScreen(); - static void ResetStaticState(); - virtual ~ScreenEdit(); virtual void Update( float fDeltaTime ); virtual void DrawPrimitives();