From 27fda591a46fe5f1d134e8f404f91c663c4cbd7f Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 9 Jan 2004 05:50:15 +0000 Subject: [PATCH] Add a separate nav type for the options menu. Pressing left or right on "EXIT" and having it move off, and having left and right move around on stray menu entries with only one entry is strange. --- stepmania/src/ScreenOptions.cpp | 47 ++++++++++++++++++++++----- stepmania/src/ScreenOptions.h | 5 +-- stepmania/src/ScreenOptionsMaster.cpp | 2 +- 3 files changed, 42 insertions(+), 12 deletions(-) diff --git a/stepmania/src/ScreenOptions.cpp b/stepmania/src/ScreenOptions.cpp index 9cf5960e46..bf3cbaa965 100644 --- a/stepmania/src/ScreenOptions.cpp +++ b/stepmania/src/ScreenOptions.cpp @@ -55,11 +55,37 @@ const float ITEM_X[NUM_PLAYERS] = { 260, 420 }; #define FRAME_ON_COMMAND THEME->GetMetric ("ScreenOptions","FrameOnCommand") #define FRAME_OFF_COMMAND THEME->GetMetric ("ScreenOptions","FrameOffCommand") +/* + * Three navigation types are provided: + * + * NAV_THREE_KEY: + * left, right -> change option + * up, down -> don't matter (change row) + * start -> move to next row + * left+right+start -> move to prev row + * (next screen via "exit" entry) + * This is the minimal navigation, for using menus with only three buttons. + * + * NAV_FIVE_KEY: + * left, right -> change option + * up, down -> change row + * start -> next screen + * This is a much more convenient navigation, requiring five keys. + * + * NAV_THREE_KEY_MENU: + * left, right -> change row + * up, down -> change row + * start -> next screen + * This is a specialized navigation for ScreenOptionsMenu. It must be enabled to + * allow screens that use rows to select other screens to work with only three + * buttons. (It's also used when in five-key mode.) + */ + ScreenOptions::ScreenOptions( CString sClassName ) : Screen(sClassName) { LOG->Trace( "ScreenOptions::ScreenOptions()" ); - m_SMOptionsNavigation = PREFSMAN->m_bArcadeOptionsNavigation; + m_OptionsNavigation = PREFSMAN->m_bArcadeOptionsNavigation? NAV_THREE_KEY:NAV_FIVE_KEY; m_SoundChangeCol.Load( THEME->GetPathToS("ScreenOptions change"), true ); m_SoundNextRow.Load( THEME->GetPathToS("ScreenOptions next"), true ); @@ -696,7 +722,7 @@ void ScreenOptions::Input( const DeviceInput& DeviceI, const InputEventType type // if we are in dedicated menubutton input and arcade navigation // check to see if MENU_BUTTON_LEFT and MENU_BUTTON_RIGHT are being held const bool bHoldingLeftOrRight = MenuI.IsValid() && MenuI.button == MENU_BUTTON_START && - !m_SMOptionsNavigation && + m_OptionsNavigation == NAV_THREE_KEY && (INPUTMAPPER->IsButtonDown( MenuInput(MenuI.player, MENU_BUTTON_RIGHT) ) || INPUTMAPPER->IsButtonDown( MenuInput(MenuI.player, MENU_BUTTON_LEFT) ) ); @@ -902,7 +928,9 @@ void ScreenOptions::MenuStart( PlayerNumber pn, const InputEventType type ) if( type == IET_RELEASE ) return; - if( !m_SMOptionsNavigation ) + switch( m_OptionsNavigation ) + { + case NAV_THREE_KEY: { bool bAllOnExit = true; for( int p=0; pIsButtonDown( MenuInput(pn, MENU_BUTTON_START) ) ) + if( m_OptionsNavigation == NAV_THREE_KEY && INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_START) ) ) return; const int iNumOptions = (row.Type == Row::ROW_EXIT)? 1: optrow.choices.size(); - if( iNumOptions <= 1 ) // 1 or 0 + if( m_OptionsNavigation == NAV_THREE_KEY_MENU && 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. */ diff --git a/stepmania/src/ScreenOptions.h b/stepmania/src/ScreenOptions.h index 4d630e6a12..d4bf972c49 100644 --- a/stepmania/src/ScreenOptions.h +++ b/stepmania/src/ScreenOptions.h @@ -105,7 +105,8 @@ protected: // derived classes need access to these int m_iNumOptionRows; void LoadOptionIcon( PlayerNumber pn, int iRow, CString sText ); - void SetSMOptionsNavigation( bool on ) { m_SMOptionsNavigation = on; } + enum Navigation { NAV_THREE_KEY, NAV_THREE_KEY_MENU, NAV_FIVE_KEY }; + void SetNavigation( Navigation nav ) { m_OptionsNavigation = nav; } private: /* Map menu lines to m_OptionRow entries. */ @@ -126,7 +127,7 @@ private: }; vector m_Rows; - bool m_SMOptionsNavigation; + Navigation m_OptionsNavigation; int m_iCurrentRow[NUM_PLAYERS]; diff --git a/stepmania/src/ScreenOptionsMaster.cpp b/stepmania/src/ScreenOptionsMaster.cpp index dff98bedc5..c9aef60e0f 100644 --- a/stepmania/src/ScreenOptionsMaster.cpp +++ b/stepmania/src/ScreenOptionsMaster.cpp @@ -204,7 +204,7 @@ ScreenOptionsMaster::ScreenOptionsMaster( CString sClassName ): GAMESTATE->m_MasterPlayerNumber = PlayerNumber(0); } if( Flags[i] == "smnavigation" ) - SetSMOptionsNavigation( true ); + SetNavigation( NAV_THREE_KEY_MENU ); } if( NumRows == -1 )