From 5320b3e92e2ae790a44b39058f33b7a7dc48f0d8 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 16 Jan 2006 20:30:55 +0000 Subject: [PATCH] OptionRowHandlers were originally exclusive to SOMaster, but they're accessible by SOptions now, too. Move this slightly tricky next-screen logic into SOptions, since it can apply to any screen that sets OptionRowHandlers. (Actually, this doesn't really belong in BeginFadingOut, since it's not called "MaybeBeginFadingOutDependingOnTheCurrentOption". Maybe this should be done in ExportOptions, I'm not sure yet, but this is a step in the right direction.) --- stepmania/src/ScreenOptions.cpp | 30 +++++++++++++++++++++++++++ stepmania/src/ScreenOptions.h | 2 +- stepmania/src/ScreenOptionsMaster.cpp | 30 --------------------------- stepmania/src/ScreenOptionsMaster.h | 2 -- 4 files changed, 31 insertions(+), 33 deletions(-) diff --git a/stepmania/src/ScreenOptions.cpp b/stepmania/src/ScreenOptions.cpp index baf4adf679..70d07def3f 100644 --- a/stepmania/src/ScreenOptions.cpp +++ b/stepmania/src/ScreenOptions.cpp @@ -960,6 +960,36 @@ void ScreenOptions::StoreFocus( PlayerNumber pn ) m_iCurrentRow[pn], row.GetChoiceInRowWithFocus(pn), m_iFocusX[pn]); } +void ScreenOptions::BeginFadingOut() +{ + /* If the selection is on a LIST, and the selected LIST option sets the screen, + * honor it. */ + int iCurRow = this->GetCurrentRow(); + ASSERT( iCurRow >= 0 && iCurRow < (int)m_pRows.size() ); + const OptionRow &row = *m_pRows[iCurRow]; + + { + int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber ); + if( row.GetFirstItemGoesDown() ) + iChoice--; + // not the "goes down" item + if( iChoice != -1 ) + { + const OptionRowHandler *pHand = row.GetHandler(); + if( pHand != NULL ) + { + 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( GetNextScreen() != "" ) + this->PostScreenMessage( SM_BeginFadingOut, 0 ); +} + /* Left/right */ void ScreenOptions::ChangeValueInRowAbsolute( int iRow, PlayerNumber pn, int iChoiceIndex, bool bRepeat ) { diff --git a/stepmania/src/ScreenOptions.h b/stepmania/src/ScreenOptions.h index 11948de66a..d12d36c69c 100644 --- a/stepmania/src/ScreenOptions.h +++ b/stepmania/src/ScreenOptions.h @@ -62,7 +62,7 @@ protected: void UpdateEnabledDisabled( int iRow ); void StoreFocus( PlayerNumber pn ); - virtual void BeginFadingOut() { this->PostScreenMessage( SM_BeginFadingOut, 0 ); } + void BeginFadingOut(); void ChangeValueInRowRelative( int iRow, PlayerNumber pn, int iDelta, bool bRepeat ); void ChangeValueInRowAbsolute( int iRow, PlayerNumber pn, int iChoiceIndex, bool bRepeat ); diff --git a/stepmania/src/ScreenOptionsMaster.cpp b/stepmania/src/ScreenOptionsMaster.cpp index 66b76226b8..5a0d91a4e7 100644 --- a/stepmania/src/ScreenOptionsMaster.cpp +++ b/stepmania/src/ScreenOptionsMaster.cpp @@ -102,36 +102,6 @@ void ScreenOptionsMaster::ExportOptions( int r, const vector &vpns m_iChangeMask |= row.ExportOptions( vpns, bRowHasFocus ); } -void ScreenOptionsMaster::BeginFadingOut() -{ - /* If the selection is on a LIST, and the selected LIST option sets the screen, - * honor it. */ - int iCurRow = this->GetCurrentRow(); - ASSERT( iCurRow >= 0 && iCurRow < (int)m_pRows.size() ); - const OptionRow &row = *m_pRows[iCurRow]; - - { - int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber ); - if( row.GetFirstItemGoesDown() ) - iChoice--; - // not the "goes down" item - if( iChoice != -1 ) - { - const OptionRowHandler *pHand = row.GetHandler(); - if( pHand != NULL ) - { - 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( GetNextScreen() != "" ) - ScreenOptions::BeginFadingOut(); -} - void ScreenOptionsMaster::HandleScreenMessage( const ScreenMessage SM ) { if( SM == SM_ExportOptions ) diff --git a/stepmania/src/ScreenOptionsMaster.h b/stepmania/src/ScreenOptionsMaster.h index d514798ecb..b88fa1532f 100644 --- a/stepmania/src/ScreenOptionsMaster.h +++ b/stepmania/src/ScreenOptionsMaster.h @@ -21,8 +21,6 @@ protected: virtual void ImportOptions( int iRow, const vector &vpns ); virtual void ExportOptions( int iRow, const vector &vpns ); - - virtual void BeginFadingOut(); }; #endif