Factor out a call to GameState::ResetOptions. Also, move the state that

keeps track of whether NoteSkin was changed or not into GameState.
This commit is contained in:
John Bauer
2006-11-30 19:29:15 +00:00
parent 6b07fcaed5
commit aedcc9f208
4 changed files with 18 additions and 31 deletions
+12 -22
View File
@@ -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 )
+4
View File
@@ -205,6 +205,10 @@ public:
ModsGroup<SongOptions> 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 );
+2 -7
View File
@@ -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();
-2
View File
@@ -171,8 +171,6 @@ public:
virtual void BeginScreen();
virtual void EndScreen();
static void ResetStaticState();
virtual ~ScreenEdit();
virtual void Update( float fDeltaTime );
virtual void DrawPrimitives();