From 56559fb29df512ab6bfcf09dde0a61369bd6fa57 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 22 Feb 2003 00:12:45 +0000 Subject: [PATCH] Add the note skin pref back in, to change the default skin persistently. Disable the EX pref; wait to add this until the screen is ready (though it might be better to just make it a metric). --- stepmania/src/GameState.cpp | 7 +++- stepmania/src/PrefsManager.cpp | 13 ++++++-- stepmania/src/PrefsManager.h | 3 ++ stepmania/src/ScreenAppearanceOptions.cpp | 40 +++++++++++++++++++---- 4 files changed, 54 insertions(+), 9 deletions(-) diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 0d3782ac6a..dfd9ef1043 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -21,6 +21,7 @@ #include "ThemeManager.h" #include "RageUtil.h" #include "SongManager.h" +#include "NoteSkinManager.h" GameState* GAMESTATE = NULL; // global and accessable from anywhere in our program @@ -44,7 +45,9 @@ GameState::GameState() { m_CurGame = GAME_DANCE; m_iCoins = 0; - Reset(); + /* Don't reset yet; let the first screen do it, so we can + * use PREFSMAN. */ +// Reset(); ResetLastRanking(); } @@ -87,6 +90,8 @@ void GameState::Reset() for( p=0; pSwitchNoteSkin( PlayerNumber(p), PREFSMAN->m_sDefaultNoteSkin ); } void GameState::ResetLastRanking() diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index 842f78d795..7c22dd09d3 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -102,6 +102,8 @@ PrefsManager::PrefsManager() m_sSoundDrivers = DEFAULT_SOUND_DRIVER_LIST; m_fSoundVolume = DEFAULT_SOUND_VOLUME; + m_sDefaultNoteSkin = "default"; + ReadGlobalPrefsFromDisk( true ); } @@ -273,16 +275,22 @@ void PrefsManager::ReadGamePrefsFromDisk() ini.SetPath( "GamePrefs.ini" ); ini.ReadFile(); // it's OK if this fails - CString sAnnouncer = sGameName, sTheme = sGameName;//, sNoteSkin = sGameName; + CString sAnnouncer = sGameName, sTheme = sGameName, sNoteSkin = sGameName; // if these calls fail, the three strings will keep the initial values set above. ini.GetValue( sGameName, "Announcer", sAnnouncer ); ini.GetValue( sGameName, "Theme", sTheme ); -// ini.GetValue( sGameName, "NoteSkin", sNoteSkin ); + ini.GetValue( sGameName, "NoteSkin", sNoteSkin ); // it's OK to call these functions with names that don't exist. ANNOUNCER->SwitchAnnouncer( sAnnouncer ); THEME->SwitchTheme( sTheme ); + + if(NOTESKIN->DoesNoteSkinExist(sNoteSkin)) + m_sDefaultNoteSkin = sNoteSkin; + else + m_sDefaultNoteSkin = "default"; + // NOTESKIN->SwitchNoteSkin( sNoteSkin ); } @@ -299,6 +307,7 @@ void PrefsManager::SaveGamePrefsToDisk() ini.SetValue( sGameName, "Announcer", ANNOUNCER->GetCurAnnouncerName() ); ini.SetValue( sGameName, "Theme", THEME->GetCurThemeName() ); // ini.SetValue( sGameName, "NoteSkin", NOTESKIN->GetCurNoteSkinName() ); + ini.SetValue( sGameName, "NoteSkin", m_sDefaultNoteSkin ); ini.WriteFile(); } diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index 3d79d27769..f443bde096 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -83,6 +83,9 @@ public: CString m_sSoundDrivers; float m_fSoundVolume; + /* Game-specific prefs: */ + CString m_sDefaultNoteSkin; + void ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame ); void SaveGlobalPrefsToDisk(); diff --git a/stepmania/src/ScreenAppearanceOptions.cpp b/stepmania/src/ScreenAppearanceOptions.cpp index 91f5cd9a57..940dc2a635 100644 --- a/stepmania/src/ScreenAppearanceOptions.cpp +++ b/stepmania/src/ScreenAppearanceOptions.cpp @@ -29,8 +29,8 @@ enum { AO_ANNOUNCER = 0, AO_THEME, - AO_DIFF_SELECT, -// AO_SKIN, +// AO_DIFF_SELECT, + AO_SKIN, AO_INSTRUCTIONS, AO_CAUTION, AO_SELECT_GROUP, @@ -42,8 +42,8 @@ enum { OptionRowData g_AppearanceOptionsLines[NUM_APPEARANCE_OPTIONS_LINES] = { { "Announcer", 1, {"OFF"} }, // fill this in on ImportOptions() { "Theme", 0, {""} }, // fill this in on ImportOptions() - { "Difficulty\nSelect", 2, {"DDR Extreme", "Normal"} }, -// { "Note\nSkin", 0, {""} }, // fill this in on ImportOptions() +// { "Difficulty\nSelect", 2, {"DDR Extreme", "Normal"} }, + { "Note\nSkin", 0, {""} }, // fill this in on ImportOptions() { "How To\nPlay", 2, {"SKIP","SHOW"} }, { "Caution", 2, {"SKIP","SHOW"} }, { "Song\nGroup", 2, {"ALL MUSIC","CHOOSE"} }, @@ -133,9 +133,33 @@ void ScreenAppearanceOptions::ImportOptions() if( m_iSelectedOption[0][AO_THEME] == -1 ) m_iSelectedOption[0][AO_THEME] = 0; + // + // fill in skin names + // + CStringArray arraySkinNames; + NOTESKIN->GetNoteSkinNames( arraySkinNames ); + + m_OptionRowData[AO_SKIN].iNumOptions = arraySkinNames.size(); + + for( i=0; im_sDefaultNoteSkin) ) + { + m_iSelectedOption[0][AO_SKIN] = i; + break; + } + } + if( m_iSelectedOption[0][AO_SKIN] == -1 ) + m_iSelectedOption[0][AO_SKIN] = 0; + m_iSelectedOption[0][AO_INSTRUCTIONS] = PREFSMAN->m_bInstructions? 1:0; m_iSelectedOption[0][AO_CAUTION] = PREFSMAN->m_bShowDontDie? 1:0; - m_iSelectedOption[0][AO_DIFF_SELECT] = PREFSMAN->m_bDDRExtremeDifficultySelect? 1:0; +// m_iSelectedOption[0][AO_DIFF_SELECT] = PREFSMAN->m_bDDRExtremeDifficultySelect? 1:0; m_iSelectedOption[0][AO_SELECT_GROUP] = PREFSMAN->m_bShowSelectGroup? 1:0; m_iSelectedOption[0][AO_WHEEL_SECTIONS] = (int)PREFSMAN->m_MusicWheelUsesSections; m_iSelectedOption[0][AO_SHOW_TRANSLATIONS] = PREFSMAN->m_bShowTranslations; @@ -156,7 +180,11 @@ void ScreenAppearanceOptions::ExportOptions() CString sNewTheme = m_OptionRowData[AO_THEME].szOptionsText[iSelectedTheme]; THEME->SwitchTheme( sNewTheme ); - PREFSMAN->m_bDDRExtremeDifficultySelect = !!m_iSelectedOption[0][AO_DIFF_SELECT]; + int iSelectedSkin = m_iSelectedOption[0][AO_SKIN]; + CString sNewSkin = m_OptionRowData[AO_SKIN].szOptionsText[iSelectedSkin]; + + PREFSMAN->m_sDefaultNoteSkin = sNewSkin; +// PREFSMAN->m_bDDRExtremeDifficultySelect = !!m_iSelectedOption[0][AO_DIFF_SELECT]; PREFSMAN->m_bInstructions = !!m_iSelectedOption[0][AO_INSTRUCTIONS]; PREFSMAN->m_bShowDontDie = !!m_iSelectedOption[0][AO_CAUTION]; PREFSMAN->m_bShowSelectGroup = !!m_iSelectedOption[0][AO_SELECT_GROUP];