diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 16d6ff3277..0fc992d400 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -37,6 +37,7 @@ #include "CharacterManager.h" #include "Game.h" #include "AdjustSync.h" +#include "ScreenEdit.h" #include #include @@ -328,6 +329,8 @@ void GameState::Reset() m_bBackedOutOfFinalStage = false; + ScreenEdit::ResetStaticState(); + ApplyCmdline(); } diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index 0af8d6d4cd..5580728289 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -13,8 +13,8 @@ #include "InputMapper.h" #include "RageLog.h" #include "ThemeManager.h" -#include "NoteSkinManager.h" #include "NoteDataUtil.h" +#include "NoteSkinManager.h" #include "SongUtil.h" #include "StepsUtil.h" #include "Foreach.h" @@ -624,21 +624,14 @@ static int g_iLastInsertTapAttackTrack = -1; static float g_fLastInsertAttackDurationSeconds = -1; static float g_fLastInsertAttackPositionSeconds = -1; static BackgroundLayer g_CurrentBGChangeLayer = BACKGROUND_LAYER_Invalid; +static const RString EDITOR_NOTE_SKIN = "note"; +static bool s_bChangedNoteSkin = false; -static void SetDefaultEditorNoteSkin( size_t num, RString &sNameOut, RString &defaultValueOut ) +void ScreenEdit::ResetStaticState() { - sNameOut = ssprintf( "EditorNoteSkinP%d", int(num + 1) ); - - switch( num ) - { - case 0: defaultValueOut = "note"; return; - case 1: defaultValueOut = "solo"; return; - } - defaultValueOut = "note"; + s_bChangedNoteSkin = false; } -static Preference1D EDITOR_NOTE_SKINS( SetDefaultEditorNoteSkin, NUM_PLAYERS ); - REGISTER_SCREEN_CLASS( ScreenEdit ); void ScreenEdit::Init() @@ -683,17 +676,32 @@ void ScreenEdit::Init() m_SnapDisplay.Load( PLAYER_1 ); m_SnapDisplay.SetZoom( 0.5f ); this->AddChild( &m_SnapDisplay ); - - FOREACH_PlayerNumber( pn ) - { - const RString &sNoteSkin = EDITOR_NOTE_SKINS[pn]; - - if( NOTESKIN->DoesNoteSkinExist(sNoteSkin) ) - PO_GROUP_ASSIGN( GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions, ModsLevel_Stage, m_sNoteSkin, sNoteSkin ); - } + // 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 ) + { + s_bChangedNoteSkin = true; + FOREACH_PlayerNumber( pn ) + { + if( NOTESKIN->DoesNoteSkinExist( EDITOR_NOTE_SKIN ) ) + PO_GROUP_ASSIGN( GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions, + ModsLevel_Preferred, m_sNoteSkin, EDITOR_NOTE_SKIN ); + } + } m_PlayerStateEdit.m_PlayerNumber = PLAYER_1; - PO_GROUP_ASSIGN( m_PlayerStateEdit.m_PlayerOptions, ModsLevel_Stage, m_sNoteSkin, GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetStage().m_sNoteSkin ); + // If we always go with the GAMESTATE NoteSkin, we will have fun effects like Vivid or Flat in the editor notefield. + // This is not conducive to productive editing. + if( NOTESKIN->DoesNoteSkinExist( EDITOR_NOTE_SKIN ) ) + { + PO_GROUP_ASSIGN( m_PlayerStateEdit.m_PlayerOptions, ModsLevel_Stage, m_sNoteSkin, EDITOR_NOTE_SKIN ); + } + else + { + PO_GROUP_ASSIGN( m_PlayerStateEdit.m_PlayerOptions, ModsLevel_Stage, m_sNoteSkin, + GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetStage().m_sNoteSkin ); + } m_pSteps->GetNoteData( m_NoteDataEdit ); m_NoteFieldEdit.SetXY( EDIT_X, EDIT_Y ); diff --git a/stepmania/src/ScreenEdit.h b/stepmania/src/ScreenEdit.h index 55f9d8d2b4..ea18f1613f 100644 --- a/stepmania/src/ScreenEdit.h +++ b/stepmania/src/ScreenEdit.h @@ -171,6 +171,8 @@ public: virtual void BeginScreen(); virtual void EndScreen(); + static void ResetStaticState(); + virtual ~ScreenEdit(); virtual void Update( float fDeltaTime ); virtual void DrawPrimitives();