efa81bc: don't filter NoteSkins at a PrefsManager/NoteSkinManager level. Leave the NoteSkin sorting and filtering up to the theme. [Chris Danford]

ScreenWithMenuElements.cpp - add Cancel command, so actors can react to Cancel.
GameState.cpp - cleanup
This commit is contained in:
AJ Kelly
2010-02-19 16:05:50 -06:00
parent 2c19a3fab1
commit c43635b6b3
7 changed files with 8 additions and 16 deletions
-1
View File
@@ -741,7 +741,6 @@ void GameState::FinishStage()
{ {
// Increment the stage counter. // Increment the stage counter.
const int iOldStageIndex = m_iCurrentStageIndex; const int iOldStageIndex = m_iCurrentStageIndex;
++m_iCurrentStageIndex; ++m_iCurrentStageIndex;
m_iNumStagesOfThisSong = 0; m_iNumStagesOfThisSong = 0;
+2 -11
View File
@@ -189,18 +189,9 @@ void NoteSkinManager::GetNoteSkinNames( vector<RString> &AddTo )
GetNoteSkinNames( GAMESTATE->m_pCurGame, AddTo ); GetNoteSkinNames( GAMESTATE->m_pCurGame, AddTo );
} }
void NoteSkinManager::GetNoteSkinNames( const Game* pGame, vector<RString> &AddTo, bool bFilterDefault ) void NoteSkinManager::GetNoteSkinNames( const Game* pGame, vector<RString> &AddTo )
{ {
GetAllNoteSkinNamesForGame( pGame, AddTo ); GetAllNoteSkinNamesForGame( pGame, AddTo );
/* Move "default" to the front if it exists. */
vector<RString>::iterator iter = find( AddTo.begin(), AddTo.end(), GAME_BASE_NOTESKIN_NAME );
if( iter != AddTo.end() )
{
AddTo.erase( iter );
if( !bFilterDefault || !PREFSMAN->m_bHideDefaultNoteSkin )
AddTo.insert( AddTo.begin(), GAME_BASE_NOTESKIN_NAME );
}
} }
@@ -225,7 +216,7 @@ void NoteSkinManager::GetAllNoteSkinNamesForGame( const Game *pGame, vector<RStr
{ {
if( pGame == m_pCurGame ) if( pGame == m_pCurGame )
{ {
/* Faster: */ // Faster:
for( map<RString,NoteSkinData>::const_iterator iter = g_mapNameToData.begin(); for( map<RString,NoteSkinData>::const_iterator iter = g_mapNameToData.begin();
iter != g_mapNameToData.end(); ++iter ) iter != g_mapNameToData.end(); ++iter )
{ {
+1 -1
View File
@@ -18,7 +18,7 @@ public:
~NoteSkinManager(); ~NoteSkinManager();
void RefreshNoteSkinData( const Game* game ); void RefreshNoteSkinData( const Game* game );
void GetNoteSkinNames( const Game* game, vector<RString> &AddTo, bool bFilterDefault=true ); void GetNoteSkinNames( const Game* game, vector<RString> &AddTo );
void GetNoteSkinNames( vector<RString> &AddTo ); // looks up current const Game* in GAMESTATE void GetNoteSkinNames( vector<RString> &AddTo ); // looks up current const Game* in GAMESTATE
bool DoesNoteSkinExist( const RString &sNoteSkin ); // looks up current const Game* in GAMESTATE bool DoesNoteSkinExist( const RString &sNoteSkin ); // looks up current const Game* in GAMESTATE
bool DoNoteSkinsExistForGame( const Game *pGame ); bool DoNoteSkinsExistForGame( const Game *pGame );
+1 -1
View File
@@ -147,7 +147,7 @@ void OptionRow::LoadExit()
void OptionRow::ChoicesChanged( RowType type ) void OptionRow::ChoicesChanged( RowType type )
{ {
ASSERT( !m_pHand->m_Def.m_vsChoices.empty() ); ASSERT_M( !m_pHand->m_Def.m_vsChoices.empty(), m_pHand->m_Def.m_sName + " has no choices" );
// Remove the NextRow marker before reloading choices // Remove the NextRow marker before reloading choices
if( m_pHand->m_Def.m_vsChoices[0] == NEXT_ROW_NAME ) if( m_pHand->m_Def.m_vsChoices[0] == NEXT_ROW_NAME )
+2 -1
View File
@@ -239,7 +239,6 @@ PrefsManager::PrefsManager() :
m_fCenterImageAddHeight ( "CenterImageAddHeight", 0 ), m_fCenterImageAddHeight ( "CenterImageAddHeight", 0 ),
m_AttractSoundFrequency ( "AttractSoundFrequency", ASF_EVERY_TIME ), m_AttractSoundFrequency ( "AttractSoundFrequency", ASF_EVERY_TIME ),
m_bAllowExtraStage ( "AllowExtraStage", true ), m_bAllowExtraStage ( "AllowExtraStage", true ),
m_bHideDefaultNoteSkin ( "HideDefaultNoteSkin", false ),
m_iMaxHighScoresPerListForMachine ( "MaxHighScoresPerListForMachine", 10 ), m_iMaxHighScoresPerListForMachine ( "MaxHighScoresPerListForMachine", 10 ),
m_iMaxHighScoresPerListForPlayer ( "MaxHighScoresPerListForPlayer", 3 ), m_iMaxHighScoresPerListForPlayer ( "MaxHighScoresPerListForPlayer", 3 ),
m_bAllowMultipleHighScoreWithSameName ( "AllowMultipleHighScoreWithSameName", true ), m_bAllowMultipleHighScoreWithSameName ( "AllowMultipleHighScoreWithSameName", true ),
@@ -439,6 +438,7 @@ void PrefsManager::ReadGamePrefsFromIni( const RString &sIni )
RString sGame = section->GetName().Right( section->GetName().length() - GAME_SECTION_PREFIX.length() ); RString sGame = section->GetName().Right( section->GetName().length() - GAME_SECTION_PREFIX.length() );
GamePrefs &gp = m_mapGameNameToGamePrefs[ sGame ]; GamePrefs &gp = m_mapGameNameToGamePrefs[ sGame ];
// todo: read more prefs here? -aj
ini.GetValue( section->GetName(), "Announcer", gp.m_sAnnouncer ); ini.GetValue( section->GetName(), "Announcer", gp.m_sAnnouncer );
ini.GetValue( section->GetName(), "Theme", gp.m_sTheme ); ini.GetValue( section->GetName(), "Theme", gp.m_sTheme );
ini.GetValue( section->GetName(), "DefaultModifiers", gp.m_sDefaultModifiers ); ini.GetValue( section->GetName(), "DefaultModifiers", gp.m_sDefaultModifiers );
@@ -486,6 +486,7 @@ void PrefsManager::SavePrefsToIni( IniFile &ini )
{ {
RString sSection = "Game-" + RString( iter->first ); RString sSection = "Game-" + RString( iter->first );
// todo: write more values here? -aj
ini.SetValue( sSection, "Announcer", iter->second.m_sAnnouncer ); ini.SetValue( sSection, "Announcer", iter->second.m_sAnnouncer );
ini.SetValue( sSection, "Theme", iter->second.m_sTheme ); ini.SetValue( sSection, "Theme", iter->second.m_sTheme );
ini.SetValue( sSection, "DefaultModifiers", iter->second.m_sDefaultModifiers ); ini.SetValue( sSection, "DefaultModifiers", iter->second.m_sDefaultModifiers );
-1
View File
@@ -225,7 +225,6 @@ public:
Preference<int> m_fCenterImageAddHeight; Preference<int> m_fCenterImageAddHeight;
Preference<AttractSoundFrequency> m_AttractSoundFrequency; Preference<AttractSoundFrequency> m_AttractSoundFrequency;
Preference<bool> m_bAllowExtraStage; Preference<bool> m_bAllowExtraStage;
Preference<bool> m_bHideDefaultNoteSkin;
Preference<int> m_iMaxHighScoresPerListForMachine; Preference<int> m_iMaxHighScoresPerListForMachine;
Preference<int> m_iMaxHighScoresPerListForPlayer; Preference<int> m_iMaxHighScoresPerListForPlayer;
Preference<bool> m_bAllowMultipleHighScoreWithSameName; Preference<bool> m_bAllowMultipleHighScoreWithSameName;
+2
View File
@@ -313,6 +313,8 @@ void ScreenWithMenuElements::Cancel( ScreenMessage smSendWhenDone )
return; return;
} }
this->PlayCommand( "Cancel" );
if( m_Cancel.IsTransitioning() ) if( m_Cancel.IsTransitioning() )
return; // ignore return; // ignore