cleanup "smnavigation" flag

fix left/right act as up/down on options menu
never play change line sound when the option didn't change
This commit is contained in:
Glenn Maynard
2004-01-09 04:43:27 +00:00
parent 35a7bbbe61
commit 99b000129b
4 changed files with 30 additions and 37 deletions
+18 -13
View File
@@ -59,6 +59,8 @@ ScreenOptions::ScreenOptions( CString sClassName ) : Screen(sClassName)
{ {
LOG->Trace( "ScreenOptions::ScreenOptions()" ); LOG->Trace( "ScreenOptions::ScreenOptions()" );
m_SMOptionsNavigation = PREFSMAN->m_bArcadeOptionsNavigation;
m_SoundChangeCol.Load( THEME->GetPathToS("ScreenOptions change"), true ); m_SoundChangeCol.Load( THEME->GetPathToS("ScreenOptions change"), true );
m_SoundNextRow.Load( THEME->GetPathToS("ScreenOptions next"), true ); m_SoundNextRow.Load( THEME->GetPathToS("ScreenOptions next"), true );
m_SoundPrevRow.Load( THEME->GetPathToS("ScreenOptions prev"), true ); m_SoundPrevRow.Load( THEME->GetPathToS("ScreenOptions prev"), true );
@@ -694,7 +696,7 @@ void ScreenOptions::Input( const DeviceInput& DeviceI, const InputEventType type
// if we are in dedicated menubutton input and arcade navigation // if we are in dedicated menubutton input and arcade navigation
// check to see if MENU_BUTTON_LEFT and MENU_BUTTON_RIGHT are being held // check to see if MENU_BUTTON_LEFT and MENU_BUTTON_RIGHT are being held
const bool bHoldingLeftOrRight = MenuI.IsValid() && MenuI.button == MENU_BUTTON_START && const bool bHoldingLeftOrRight = MenuI.IsValid() && MenuI.button == MENU_BUTTON_START &&
PREFSMAN->m_bArcadeOptionsNavigation && !m_SMOptionsNavigation &&
(INPUTMAPPER->IsButtonDown( MenuInput(MenuI.player, MENU_BUTTON_RIGHT) ) || (INPUTMAPPER->IsButtonDown( MenuInput(MenuI.player, MENU_BUTTON_RIGHT) ) ||
INPUTMAPPER->IsButtonDown( MenuInput(MenuI.player, MENU_BUTTON_LEFT) ) ); INPUTMAPPER->IsButtonDown( MenuInput(MenuI.player, MENU_BUTTON_LEFT) ) );
@@ -900,7 +902,7 @@ void ScreenOptions::MenuStart( PlayerNumber pn, const InputEventType type )
if( type == IET_RELEASE ) if( type == IET_RELEASE )
return; return;
if( PREFSMAN->m_bArcadeOptionsNavigation ) if( !m_SMOptionsNavigation )
{ {
bool bAllOnExit = true; bool bAllOnExit = true;
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
@@ -912,50 +914,51 @@ void ScreenOptions::MenuStart( PlayerNumber pn, const InputEventType type )
else if( bAllOnExit && type == IET_FIRST_PRESS ) else if( bAllOnExit && type == IET_FIRST_PRESS )
StartGoToNextState(); StartGoToNextState();
} }
else if( type == IET_FIRST_PRESS ) // !m_bArcadeOptionsNavigation else if( type == IET_FIRST_PRESS ) // m_SMOptionsNavigation
{ {
StartGoToNextState(); StartGoToNextState();
} }
} }
/* Left/right */
void ScreenOptions::ChangeValue( PlayerNumber pn, int iDelta, bool Repeat ) void ScreenOptions::ChangeValue( PlayerNumber pn, int iDelta, bool Repeat )
{ {
const int iCurRow = m_iCurrentRow[pn]; const int iCurRow = m_iCurrentRow[pn];
Row &row = *m_Rows[iCurRow]; Row &row = *m_Rows[iCurRow];
OptionRow &optrow = m_OptionRow[iCurRow]; OptionRow &optrow = m_OptionRow[iCurRow];
const int iNumOptions = (row.Type == Row::ROW_EXIT)? 1: optrow.choices.size();
if( PREFSMAN->m_bArcadeOptionsNavigation )
{
/* If START is being pressed, and arcade nav is on, then we're holding left/right /* If START is being pressed, and arcade nav is on, then we're holding left/right
* and start to move backwards. Don't move left and right, too. */ * and start to move backwards. Don't move left and right, too. */
if( PREFSMAN->m_bArcadeOptionsNavigation && if( !m_SMOptionsNavigation && INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_START) ) )
INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_START) ) )
return; return;
const int iNumOptions = (row.Type == Row::ROW_EXIT)? 1: optrow.choices.size();
if( iNumOptions <= 1 ) // 1 or 0 if( iNumOptions <= 1 ) // 1 or 0
{ {
/* There are no other options on the row; move up or down instead of left and right.
* This allows navigating the options menu with left/right/start. */
Move( pn, iDelta, Repeat ); Move( pn, iDelta, Repeat );
return; return;
} }
}
if( Repeat ) if( Repeat )
return; return;
if( row.Type == Row::ROW_EXIT ) // EXIT is selected if( row.Type == Row::ROW_EXIT ) // EXIT is selected
return; // don't allow a move return; // don't allow a move
bool bOneChanged = false;
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
{ {
// if( m_InputMode == INPUTMODE_INDIVIDUAL && p != pn ) if( p != pn )
if( p != pn ) // don't check for INPUTMODE_INDIVIDUAL because on regular
// options it moves everything by 2
continue; // skip continue; // skip
int iNewSel = m_iSelectedOption[p][iCurRow] + iDelta; int iNewSel = m_iSelectedOption[p][iCurRow] + iDelta;
wrap( iNewSel, iNumOptions ); wrap( iNewSel, iNumOptions );
if( iNewSel != m_iSelectedOption[p][iCurRow] )
bOneChanged = true;
if( optrow.bOneChoiceForAllPlayers ) if( optrow.bOneChoiceForAllPlayers )
{ {
for( int p2=0; p2<NUM_PLAYERS; p2++ ) for( int p2=0; p2<NUM_PLAYERS; p2++ )
@@ -971,10 +974,12 @@ void ScreenOptions::ChangeValue( PlayerNumber pn, int iDelta, bool Repeat )
} }
OnChange( (PlayerNumber)p ); OnChange( (PlayerNumber)p );
} }
if( bOneChanged )
m_SoundChangeCol.Play(); m_SoundChangeCol.Play();
} }
/* Up/down */
void ScreenOptions::Move( PlayerNumber pn, int dir, bool Repeat ) void ScreenOptions::Move( PlayerNumber pn, int dir, bool Repeat )
{ {
LOG->Trace("move pn %i, dir %i, rep %i", pn, dir, Repeat); LOG->Trace("move pn %i, dir %i, rep %i", pn, dir, Repeat);
+3
View File
@@ -105,6 +105,7 @@ protected: // derived classes need access to these
int m_iNumOptionRows; int m_iNumOptionRows;
void LoadOptionIcon( PlayerNumber pn, int iRow, CString sText ); void LoadOptionIcon( PlayerNumber pn, int iRow, CString sText );
void SetSMOptionsNavigation( bool on ) { m_SMOptionsNavigation = on; }
private: private:
/* Map menu lines to m_OptionRow entries. */ /* Map menu lines to m_OptionRow entries. */
@@ -125,6 +126,8 @@ private:
}; };
vector<Row*> m_Rows; vector<Row*> m_Rows;
bool m_SMOptionsNavigation;
int m_iCurrentRow[NUM_PLAYERS]; int m_iCurrentRow[NUM_PLAYERS];
InputMode m_InputMode; InputMode m_InputMode;
+1 -14
View File
@@ -180,8 +180,6 @@ ScreenOptionsMaster::ScreenOptionsMaster( CString sClassName ):
if( MusicPath != "" ) if( MusicPath != "" )
SOUND->PlayMusic( MusicPath ); SOUND->PlayMusic( MusicPath );
m_ForceSMOptionsNavigation = false;
CStringArray Flags; CStringArray Flags;
split( OPTION_MENU_FLAGS, ";", Flags, true ); split( OPTION_MENU_FLAGS, ";", Flags, true );
InputMode im = INPUTMODE_INDIVIDUAL; InputMode im = INPUTMODE_INDIVIDUAL;
@@ -206,7 +204,7 @@ ScreenOptionsMaster::ScreenOptionsMaster( CString sClassName ):
GAMESTATE->m_MasterPlayerNumber = PlayerNumber(0); GAMESTATE->m_MasterPlayerNumber = PlayerNumber(0);
} }
if( Flags[i] == "smnavigation" ) if( Flags[i] == "smnavigation" )
m_ForceSMOptionsNavigation = true; SetSMOptionsNavigation( true );
} }
if( NumRows == -1 ) if( NumRows == -1 )
@@ -550,17 +548,6 @@ void ScreenOptionsMaster::ExportOptions()
CHECKPOINT; CHECKPOINT;
} }
void ScreenOptionsMaster::MenuStart( PlayerNumber pn, const InputEventType type )
{
if( m_ForceSMOptionsNavigation )
{
StartGoToNextState();
return;
}
ScreenOptions::MenuStart( pn, type );
}
void ScreenOptionsMaster::GoToNextState() void ScreenOptionsMaster::GoToNextState()
{ {
if( GAMESTATE->m_bEditing ) if( GAMESTATE->m_bEditing )
-2
View File
@@ -37,7 +37,6 @@ private:
}; };
CString m_NextScreen; CString m_NextScreen;
bool m_ForceSMOptionsNavigation;
vector<OptionRowHandler> OptionRowHandlers; vector<OptionRowHandler> OptionRowHandlers;
OptionRow *m_OptionRowAlloc; OptionRow *m_OptionRowAlloc;
@@ -51,7 +50,6 @@ private:
void SetSaveToProfile( OptionRow &row, OptionRowHandler &hand ); void SetSaveToProfile( OptionRow &row, OptionRowHandler &hand );
protected: protected:
virtual void MenuStart( PlayerNumber pn, const InputEventType type );
virtual void ImportOptions(); virtual void ImportOptions();
virtual void ExportOptions(); virtual void ExportOptions();