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:
+12
-22
@@ -27,7 +27,6 @@
|
|||||||
#include "RageFile.h"
|
#include "RageFile.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "ScreenEdit.h"
|
|
||||||
#include "song.h"
|
#include "song.h"
|
||||||
#include "SongManager.h"
|
#include "SongManager.h"
|
||||||
#include "SongUtil.h"
|
#include "SongUtil.h"
|
||||||
@@ -118,7 +117,8 @@ GameState::GameState() :
|
|||||||
m_pEditSourceSteps( Message_EditSourceStepsChanged ),
|
m_pEditSourceSteps( Message_EditSourceStepsChanged ),
|
||||||
m_stEditSource( Message_EditSourceStepsTypeChanged ),
|
m_stEditSource( Message_EditSourceStepsTypeChanged ),
|
||||||
m_iEditCourseEntryIndex( Message_EditCourseEntryIndexChanged ),
|
m_iEditCourseEntryIndex( Message_EditCourseEntryIndexChanged ),
|
||||||
m_sEditLocalProfileID( Message_EditLocalProfileIDChanged )
|
m_sEditLocalProfileID( Message_EditLocalProfileIDChanged ),
|
||||||
|
m_bDidModeChangeNoteSkin( false )
|
||||||
{
|
{
|
||||||
g_pImpl = new GameStateImpl;
|
g_pImpl = new GameStateImpl;
|
||||||
|
|
||||||
@@ -286,24 +286,7 @@ void GameState::Reset()
|
|||||||
|
|
||||||
STATSMAN->Reset();
|
STATSMAN->Reset();
|
||||||
|
|
||||||
SongOptions so;
|
ResetOptions();
|
||||||
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 );
|
|
||||||
}
|
|
||||||
|
|
||||||
FOREACH_PlayerNumber(p)
|
FOREACH_PlayerNumber(p)
|
||||||
{
|
{
|
||||||
@@ -327,8 +310,6 @@ void GameState::Reset()
|
|||||||
|
|
||||||
m_bBackedOutOfFinalStage = false;
|
m_bBackedOutOfFinalStage = false;
|
||||||
|
|
||||||
ScreenEdit::ResetStaticState();
|
|
||||||
|
|
||||||
ApplyCmdline();
|
ApplyCmdline();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1170,6 +1151,13 @@ void GameState::ApplyStageModifiers( PlayerNumber pn, RString sModifiers )
|
|||||||
|
|
||||||
void GameState::ResetOptions()
|
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 )
|
FOREACH_PlayerNumber( p )
|
||||||
{
|
{
|
||||||
PlayerOptions po;
|
PlayerOptions po;
|
||||||
@@ -1179,6 +1167,8 @@ void GameState::ResetOptions()
|
|||||||
SongOptions so;
|
SongOptions so;
|
||||||
GetDefaultSongOptions( so );
|
GetDefaultSongOptions( so );
|
||||||
m_SongOptions.Assign( ModsLevel_Preferred, so );
|
m_SongOptions.Assign( ModsLevel_Preferred, so );
|
||||||
|
|
||||||
|
m_bDidModeChangeNoteSkin = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameState::IsDisqualified( PlayerNumber pn )
|
bool GameState::IsDisqualified( PlayerNumber pn )
|
||||||
|
|||||||
@@ -205,6 +205,10 @@ public:
|
|||||||
|
|
||||||
ModsGroup<SongOptions> m_SongOptions;
|
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 GetDefaultPlayerOptions( PlayerOptions &po );
|
||||||
void GetDefaultSongOptions( SongOptions &so );
|
void GetDefaultSongOptions( SongOptions &so );
|
||||||
void ApplyPreferredModifiers( PlayerNumber pn, RString sModifiers );
|
void ApplyPreferredModifiers( PlayerNumber pn, RString sModifiers );
|
||||||
|
|||||||
@@ -626,11 +626,6 @@ static BackgroundLayer g_CurrentBGChangeLayer = BACKGROUND_LAYER_Invalid;
|
|||||||
static const RString EDITOR_NOTE_SKIN = "note";
|
static const RString EDITOR_NOTE_SKIN = "note";
|
||||||
static bool s_bChangedNoteSkin = false;
|
static bool s_bChangedNoteSkin = false;
|
||||||
|
|
||||||
void ScreenEdit::ResetStaticState()
|
|
||||||
{
|
|
||||||
s_bChangedNoteSkin = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void SetDefaultEditorNoteSkin( size_t num, RString &sNameOut, RString &defaultValueOut )
|
static void SetDefaultEditorNoteSkin( size_t num, RString &sNameOut, RString &defaultValueOut )
|
||||||
{
|
{
|
||||||
sNameOut = ssprintf( "EditorNoteSkinP%d", int(num + 1) );
|
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,
|
// 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.
|
// 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.
|
// 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 )
|
FOREACH_PlayerNumber( pn )
|
||||||
{
|
{
|
||||||
const RString &sNoteSkin = EDITOR_NOTE_SKINS[pn].Get();
|
const RString &sNoteSkin = EDITOR_NOTE_SKINS[pn].Get();
|
||||||
|
|||||||
@@ -171,8 +171,6 @@ public:
|
|||||||
virtual void BeginScreen();
|
virtual void BeginScreen();
|
||||||
virtual void EndScreen();
|
virtual void EndScreen();
|
||||||
|
|
||||||
static void ResetStaticState();
|
|
||||||
|
|
||||||
virtual ~ScreenEdit();
|
virtual ~ScreenEdit();
|
||||||
virtual void Update( float fDeltaTime );
|
virtual void Update( float fDeltaTime );
|
||||||
virtual void DrawPrimitives();
|
virtual void DrawPrimitives();
|
||||||
|
|||||||
Reference in New Issue
Block a user