Use ApplyCommitsScreens. This is simpler, and eliminates one of the

few remaining uses of "NEXT_SCREEN" (deviations from the Screen path)
and nonstandard "SM_GoToNextScreen".
This commit is contained in:
Glenn Maynard
2006-01-15 08:04:40 +00:00
parent 55efe79054
commit cb4739ff31
3 changed files with 15 additions and 25 deletions
+6 -4
View File
@@ -145,6 +145,7 @@ public:
for( int col = 0; col < NumCols; ++col ) for( int col = 0; col < NumCols; ++col )
{ {
GameCommand mc; GameCommand mc;
mc.ApplyCommitsScreens( false );
mc.Load( 0, ParseCommands(ENTRY_MODE(sParam, col)) ); mc.Load( 0, ParseCommands(ENTRY_MODE(sParam, col)) );
/* If the row has just one entry, use the name of the row as the name of the /* If the row has just one entry, use the name of the row as the name of the
* entry. If it has more than one, each one must be specified explicitly. */ * entry. If it has more than one, each one must be specified explicitly. */
@@ -261,10 +262,10 @@ public:
gcOut = ListEntries[iFirstSelection]; gcOut = ListEntries[iFirstSelection];
} }
virtual bool HasScreen( int iChoice ) const virtual RString GetScreen( int iChoice ) const
{ {
const GameCommand &gc = ListEntries[iChoice]; const GameCommand &gc = ListEntries[iChoice];
return !gc.m_sScreen.empty(); return gc.m_sScreen;
} }
void FillNoteSkins( OptionRowDefinition &defOut, CString sParam ) void FillNoteSkins( OptionRowDefinition &defOut, CString sParam )
@@ -1165,6 +1166,7 @@ public:
void Init() void Init()
{ {
m_gc.Init(); m_gc.Init();
m_gc.ApplyCommitsScreens( false );
} }
virtual void LoadInternal( OptionRowDefinition &defOut, const Commands &cmds ) virtual void LoadInternal( OptionRowDefinition &defOut, const Commands &cmds )
{ {
@@ -1197,9 +1199,9 @@ public:
sIconTextOut = ""; sIconTextOut = "";
gcOut = m_gc; gcOut = m_gc;
} }
virtual bool HasScreen( int iChoice ) const virtual RString GetScreen( int iChoice ) const
{ {
return !m_gc.m_sScreen.empty(); return m_gc.m_sScreen;
} }
}; };
+1 -1
View File
@@ -34,7 +34,7 @@ public:
/* Returns an OPT mask. */ /* Returns an OPT mask. */
virtual int ExportOption( const OptionRowDefinition &def, const vector<PlayerNumber> &vpns, const vector<bool> vbSelected[NUM_PLAYERS] ) const = 0; virtual int ExportOption( const OptionRowDefinition &def, const vector<PlayerNumber> &vpns, const vector<bool> vbSelected[NUM_PLAYERS] ) const = 0;
virtual void GetIconTextAndGameCommand( const OptionRowDefinition &def, int iFirstSelection, CString &sIconTextOut, GameCommand &gcOut ) const; virtual void GetIconTextAndGameCommand( const OptionRowDefinition &def, int iFirstSelection, CString &sIconTextOut, GameCommand &gcOut ) const;
virtual bool HasScreen( int iChoice ) const { return false; } virtual RString GetScreen( int iChoice ) const { return RString(); }
}; };
+7 -19
View File
@@ -20,8 +20,6 @@
#define OPTION_MENU_FLAGS THEME->GetMetric (m_sName,"OptionMenuFlags") #define OPTION_MENU_FLAGS THEME->GetMetric (m_sName,"OptionMenuFlags")
#define LINE(sLineName) THEME->GetMetric (m_sName,ssprintf("Line%s",sLineName.c_str())) #define LINE(sLineName) THEME->GetMetric (m_sName,ssprintf("Line%s",sLineName.c_str()))
#define NEXT_SCREEN THEME->GetMetric (m_sName,"NextScreen")
REGISTER_SCREEN_CLASS( ScreenOptionsMaster ); REGISTER_SCREEN_CLASS( ScreenOptionsMaster );
ScreenOptionsMaster::ScreenOptionsMaster( CString sClassName ): ScreenOptionsMaster::ScreenOptionsMaster( CString sClassName ):
@@ -130,8 +128,6 @@ void ScreenOptionsMaster::BeginFadingOut()
{ {
/* If the selection is on a LIST, and the selected LIST option sets the screen, /* If the selection is on a LIST, and the selected LIST option sets the screen,
* honor it. */ * honor it. */
m_bExportWillSetANewScreen = false;
int iCurRow = this->GetCurrentRow(); int iCurRow = this->GetCurrentRow();
ASSERT( iCurRow >= 0 && iCurRow < (int)m_pRows.size() ); ASSERT( iCurRow >= 0 && iCurRow < (int)m_pRows.size() );
const OptionRow &row = *m_pRows[iCurRow]; const OptionRow &row = *m_pRows[iCurRow];
@@ -145,12 +141,16 @@ void ScreenOptionsMaster::BeginFadingOut()
{ {
const OptionRowHandler *pHand = m_OptionRowHandlers[iCurRow]; const OptionRowHandler *pHand = m_OptionRowHandlers[iCurRow];
if( pHand != NULL ) if( pHand != NULL )
m_bExportWillSetANewScreen = pHand->HasScreen( iChoice ); {
CString sThisScreen = pHand->GetScreen( iChoice );
if( sThisScreen != "" )
m_sNextScreen = sThisScreen;
}
} }
} }
// If options set a NextScreen or one is specified in metrics, then fade out // If options set a NextScreen or one is specified in metrics, then fade out
if( m_bExportWillSetANewScreen || NEXT_SCREEN != "" ) if( GetNextScreen() != "" )
ScreenOptions::BeginFadingOut(); ScreenOptions::BeginFadingOut();
} }
@@ -205,8 +205,7 @@ void ScreenOptionsMaster::HandleScreenMessage( const ScreenMessage SM )
if( m_iChangeMask & OPT_RESET_GAME ) if( m_iChangeMask & OPT_RESET_GAME )
{ {
StepMania::ResetGame(); StepMania::ResetGame();
SCREENMAN->SetNewScreen( CommonMetrics::INITIAL_SCREEN ); m_sNextScreen = CommonMetrics::INITIAL_SCREEN;
m_bExportWillSetANewScreen = false;
} }
if( m_iChangeMask & OPT_APPLY_SOUND ) if( m_iChangeMask & OPT_APPLY_SOUND )
@@ -218,20 +217,9 @@ void ScreenOptionsMaster::HandleScreenMessage( const ScreenMessage SM )
SONGMAN->SetPreferences(); SONGMAN->SetPreferences();
CHECKPOINT; CHECKPOINT;
if( !(m_iChangeMask & OPT_RESET_GAME) )
this->HandleScreenMessage( SM_GoToNextScreen ); this->HandleScreenMessage( SM_GoToNextScreen );
return; return;
} }
else if( SM == SM_GoToNextScreen )
{
if( SCREENMAN->IsStackedScreen(this) )
SCREENMAN->PopTopScreen( SM_None );
else if( m_bExportWillSetANewScreen )
; // Do nothing. Let Export set the screen.
else if( NEXT_SCREEN != "" )
SCREENMAN->SetNewScreen( NEXT_SCREEN );
return;
}
else else
ScreenOptions::HandleScreenMessage( SM ); ScreenOptions::HandleScreenMessage( SM );
} }