From 302c0b5445e3d2706568e0893af052c397358878 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Mon, 31 Jul 2006 01:01:32 +0000 Subject: [PATCH] Preference for the used note skin. Also set the note skin in GAMESTATE's player options for use with combined NoteData. --- stepmania/src/ScreenEdit.cpp | 27 +++++++++++++++++++++++++-- stepmania/src/ScreenEdit.h | 1 + 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index 273707ee5f..2e77fff4e3 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -628,6 +628,20 @@ static float g_fLastInsertAttackDurationSeconds = -1; static float g_fLastInsertAttackPositionSeconds = -1; static BackgroundLayer g_CurrentBGChangeLayer = BACKGROUND_LAYER_INVALID; +static void SetDefaultEditorNoteSkin( size_t num, RString &sNameOut, RString &defaultValueOut ) +{ + sNameOut = ssprintf( "EditorNoteSkinP%d", int(num + 1) ); + + switch( num ) + { + case 0: defaultValueOut = "note"; return; + case 1: defaultValueOut = "solo"; return; + } + defaultValueOut = "note"; +} + +static Preference1D EDITOR_NOTE_SKINS( SetDefaultEditorNoteSkin, NUM_PLAYERS ); + REGISTER_SCREEN_CLASS( ScreenEdit ); void ScreenEdit::Init() @@ -672,11 +686,18 @@ void ScreenEdit::Init() m_SnapDisplay.Load( PLAYER_1 ); m_SnapDisplay.SetZoom( 0.5f ); this->AddChild( &m_SnapDisplay ); + + FOREACH_PlayerNumber( pn ) + { + m_sOldNoteSkins[pn] = GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.m_sNoteSkin; + const RString &sNoteSkin = EDITOR_NOTE_SKINS[pn]; + + if( NOTESKIN->DoesNoteSkinExist(sNoteSkin) ) + GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.m_sNoteSkin = sNoteSkin; + } m_PlayerStateEdit.m_PlayerNumber = PLAYER_1; m_PlayerStateEdit.m_PlayerOptions.m_sNoteSkin = GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.m_sNoteSkin; - if( NOTESKIN->DoesNoteSkinExist("note") ) - m_PlayerStateEdit.m_PlayerOptions.m_sNoteSkin = "note"; // change noteskin before loading all of the edit Actors m_pSteps->GetNoteData( m_NoteDataEdit ); m_NoteFieldEdit.SetXY( EDIT_X, EDIT_Y ); @@ -748,6 +769,8 @@ void ScreenEdit::Init() ScreenEdit::~ScreenEdit() { + FOREACH_PlayerNumber( pn ) + GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.m_sNoteSkin = m_sOldNoteSkins[pn]; // UGLY: Don't delete the Song's steps. m_songLastSave.DetachSteps(); diff --git a/stepmania/src/ScreenEdit.h b/stepmania/src/ScreenEdit.h index b55d029424..9b9c815669 100644 --- a/stepmania/src/ScreenEdit.h +++ b/stepmania/src/ScreenEdit.h @@ -212,6 +212,7 @@ protected: NoteField m_NoteFieldEdit; NoteData m_NoteDataEdit; SnapDisplay m_SnapDisplay; + RString m_sOldNoteSkins[NUM_PLAYERS]; BitmapText m_textInputTips;