diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 5ad5097374..3344007cc4 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -119,6 +119,7 @@ IdleCommentSeconds=12 IdleTimeoutSeconds=30 IdleTimeoutScreen=THEME:GetMetric("Common","FirstAttractScreen") OutDelay=.2 +DoublePressToSelect=false [ScreenExit] Class="ScreenExit" @@ -207,6 +208,7 @@ ExplanationPage2X=0 ExplanationPage2Y=0 HeaderOnCommand= HeaderOffCommand= +DoublePressToSelect=false [ScreenSelectPlayMode] Fallback="ScreenWithMenuElements" @@ -263,6 +265,7 @@ ExplanationPage2X=0 ExplanationPage2Y=0 HeaderOnCommand= HeaderOffCommand= +DoublePressToSelect=false [ScreenSelectMode] Fallback="ScreenSelect" @@ -2649,6 +2652,8 @@ CursorP2OffsetXFromIcon=0 CursorP2OffsetYFromIcon=0 DisabledColor=#606060 +DoublePressToSelect=false + # Blank defaults for a few options. IconChoice1SwitchToPage1Command= IconChoice1SwitchToPage2Command= diff --git a/stepmania/src/ScreenSelectMaster.cpp b/stepmania/src/ScreenSelectMaster.cpp index b43d868390..a08238ff13 100644 --- a/stepmania/src/ScreenSelectMaster.cpp +++ b/stepmania/src/ScreenSelectMaster.cpp @@ -43,6 +43,7 @@ ScreenSelectMaster::ScreenSelectMaster() { ZERO( m_iChoice ); ZERO( m_bChosen ); + ZERO( m_bDoubleChoice ); } void ScreenSelectMaster::Init() @@ -69,6 +70,7 @@ void ScreenSelectMaster::Init() SCROLLER_TRANSFORM.Load( m_sName, "ScrollerTransform" ); SCROLLER_SUBDIVISIONS.Load( m_sName, "ScrollerSubdivisions" ); DEFAULT_CHOICE.Load( m_sName, "DefaultChoice" ); + DOUBLE_PRESS_TO_SELECT.Load(m_sName,"DoublePressToSelect"); ScreenSelect::Init(); @@ -253,6 +255,7 @@ void ScreenSelectMaster::BeginScreen() m_iChoice[p] = (iDefaultChoice!=-1) ? iDefaultChoice : 0; CLAMP( m_iChoice[p], 0, (int)m_aGameCommands.size()-1 ); m_bChosen[p] = false; + m_bDoubleChoice[p] = false; } if( !SHARED_SELECTION ) { @@ -396,6 +399,14 @@ void ScreenSelectMaster::MenuLeft( const InputEventPlus &input ) m_soundChange.Play(); MESSAGEMAN->Broadcast( (MessageID)(Message_MenuLeftP1+pn) ); MESSAGEMAN->Broadcast( (MessageID)(Message_MenuSelectionChanged) ); + + // if they use double select + if(DOUBLE_PRESS_TO_SELECT) + { + m_bDoubleChoice[pn] = false; // player has cancelled their selection + } + + } } @@ -419,6 +430,12 @@ void ScreenSelectMaster::MenuRight( const InputEventPlus &input ) m_soundChange.Play(); MESSAGEMAN->Broadcast( (MessageID)(Message_MenuRightP1+pn) ); MESSAGEMAN->Broadcast( (MessageID)(Message_MenuSelectionChanged) ); + + // if they use double select + if(DOUBLE_PRESS_TO_SELECT) + { + m_bDoubleChoice[pn] = false; // player has cancelled their selection + } } } @@ -442,6 +459,14 @@ void ScreenSelectMaster::MenuUp( const InputEventPlus &input ) m_soundChange.Play(); MESSAGEMAN->Broadcast( (MessageID)(Message_MenuUpP1+pn) ); MESSAGEMAN->Broadcast( (MessageID)(Message_MenuSelectionChanged) ); + + // if they use double select + if(DOUBLE_PRESS_TO_SELECT) + { + m_bDoubleChoice[pn] = false; // player has cancelled their selection + } + + } } @@ -465,6 +490,13 @@ void ScreenSelectMaster::MenuDown( const InputEventPlus &input ) m_soundChange.Play(); MESSAGEMAN->Broadcast( (MessageID)(Message_MenuDownP1+pn) ); MESSAGEMAN->Broadcast( (MessageID)(Message_MenuSelectionChanged) ); + + // if they use double select + if(DOUBLE_PRESS_TO_SELECT) + { + m_bDoubleChoice[pn] = false; // player has cancelled their selection + } + } } @@ -570,10 +602,34 @@ bool ScreenSelectMaster::ChangeSelection( PlayerNumber pn, MenuDir dir, int iNew bOldStillHasFocus |= m_iChoice[p2] == iOldChoice; bNewAlreadyHadFocus |= m_iChoice[p2] == iNewChoice; } - if( !bOldStillHasFocus ) - m_vsprIcon[iOldChoice]->PlayCommand( "LoseFocus" ); - if( !bNewAlreadyHadFocus ) - m_vsprIcon[iNewChoice]->PlayCommand( "GainFocus" ); + + + if(DOUBLE_PRESS_TO_SELECT) + { + // this player is currently on a single press, which they are cancelling + if(m_bDoubleChoice[pn]) + { + if( !bOldStillHasFocus ) + m_vsprIcon[iOldChoice]->PlayCommand( "LoseFocus" ); + if( !bNewAlreadyHadFocus ) + m_vsprIcon[iNewChoice]->PlayCommand( "GainFocus" ); + } + else + { + if( !bOldStillHasFocus ) + m_vsprIcon[iOldChoice]->PlayCommand( "LoseFocus" ); + if( !bNewAlreadyHadFocus ) + m_vsprIcon[iNewChoice]->PlayCommand( "GainFocus" ); + } + } + else // not using double selection + { + + if( !bOldStillHasFocus ) + m_vsprIcon[iOldChoice]->PlayCommand( "LostSelectedLoseFocus" ); + if( !bNewAlreadyHadFocus ) + m_vsprIcon[iNewChoice]->PlayCommand( "LostSelectedGainFocus" ); + } } if( SHOW_CURSOR ) @@ -604,8 +660,26 @@ bool ScreenSelectMaster::ChangeSelection( PlayerNumber pn, MenuDir dir, int iNew scroller.SetDestinationItem( (float)iNewChoice ); - vScroll[iOldChoice]->PlayCommand( "LoseFocus" ); - vScroll[iNewChoice]->PlayCommand( "GainFocus" ); + // using double selections + if(DOUBLE_PRESS_TO_SELECT) + { + // this player is currently on a single press, which they are cancelling + if(m_bDoubleChoice[pn]) + { + vScroll[iOldChoice]->PlayCommand( "LostSelectedLoseFocus" ); + vScroll[iNewChoice]->PlayCommand( "LostSelectedGainFocus" ); + } + else // the player hasn't made any selections yet + { + vScroll[iOldChoice]->PlayCommand( "LoseFocus" ); + vScroll[iNewChoice]->PlayCommand( "GainFocus" ); + } + } + else // regular lose/gain focus + { + vScroll[iOldChoice]->PlayCommand( "LoseFocus" ); + vScroll[iNewChoice]->PlayCommand( "GainFocus" ); + } } } @@ -680,6 +754,22 @@ void ScreenSelectMaster::MenuStart( const InputEventPlus &input ) if( !ProcessMenuStart( pn ) ) return; + // double press is enabled and the player hasn't made their first press + if(DOUBLE_PRESS_TO_SELECT && !m_bDoubleChoice[pn]) + { + m_soundStart.PlayCopy(); + m_bDoubleChoice[pn] = true; + + if(SHOW_SCROLLER) + { + vector &vScroll = SHARED_SELECTION ? m_vsprScroll[0] : m_vsprScroll[pn]; + vScroll[m_iChoice[pn]]->PlayCommand( "InitialSelection" ); + } + + return; + } + + const GameCommand &mc = m_aGameCommands[m_iChoice[pn]]; /* If no options are playable, then we're just waiting for one to become available. diff --git a/stepmania/src/ScreenSelectMaster.h b/stepmania/src/ScreenSelectMaster.h index 7e0cfc0103..598909a442 100644 --- a/stepmania/src/ScreenSelectMaster.h +++ b/stepmania/src/ScreenSelectMaster.h @@ -44,6 +44,7 @@ protected: Page GetPage( int iChoiceIndex ) const; Page GetCurrentPage() const; + ThemeMetric DOUBLE_PRESS_TO_SELECT; ThemeMetric SHOW_ICON; ThemeMetric SHOW_SCROLLER; ThemeMetric SHOW_CURSOR; @@ -98,6 +99,7 @@ protected: int m_iChoice[NUM_PLAYERS]; bool m_bChosen[NUM_PLAYERS]; + bool m_bDoubleChoice[NUM_PLAYERS]; GameButton m_TrackingRepeatingInput; };