go down if on first choice of a multiselect row

This commit is contained in:
Chris Danford
2004-01-12 08:00:57 +00:00
parent ae0fd0ac1a
commit b1e06653a8
2 changed files with 29 additions and 20 deletions
+23 -14
View File
@@ -860,7 +860,7 @@ void ScreenOptions::Input( const DeviceInput& DeviceI, const InputEventType type
if( type != IET_RELEASE && bHoldingLeftOrRight ) if( type != IET_RELEASE && bHoldingLeftOrRight )
{ {
Move( MenuI.player, -1, type != IET_FIRST_PRESS ); MoveRow( MenuI.player, -1, type != IET_FIRST_PRESS );
return; return;
} }
@@ -1097,8 +1097,6 @@ void ScreenOptions::StartGoToNextState()
void ScreenOptions::MenuStart( PlayerNumber pn, const InputEventType type ) void ScreenOptions::MenuStart( PlayerNumber pn, const InputEventType type )
{ {
if( m_Menu.IsTransitioning() )
return;
if( type == IET_RELEASE ) if( type == IET_RELEASE )
return; return;
@@ -1110,13 +1108,24 @@ void ScreenOptions::MenuStart( PlayerNumber pn, const InputEventType type )
if( data.bMultiSelect ) if( data.bMultiSelect )
{ {
int iChoiceInRow = row.m_iChoiceWithFocus[pn]; int iChoiceInRow = row.m_iChoiceWithFocus[pn];
row.m_vbSelected[pn][iChoiceInRow] = !row.m_vbSelected[pn][iChoiceInRow];
if( row.m_vbSelected[pn][iChoiceInRow] ) if( iChoiceInRow == 0 )
m_SoundToggleOn.Play(); {
MenuDown( pn, type ); // can't go down any more
}
else else
m_SoundToggleOff.Play(); {
PositionUnderlines(); row.m_vbSelected[pn][iChoiceInRow] = !row.m_vbSelected[pn][iChoiceInRow];
RefreshIcons(); if( row.m_vbSelected[pn][iChoiceInRow] )
m_SoundToggleOn.Play();
else
m_SoundToggleOff.Play();
PositionUnderlines();
RefreshIcons();
// move to the first choice
ChangeValueInRow( pn, -row.m_iChoiceWithFocus[pn], type != IET_FIRST_PRESS );
}
} }
else else
{ {
@@ -1145,7 +1154,7 @@ void ScreenOptions::MenuStart( PlayerNumber pn, const InputEventType type )
} }
/* Left/right */ /* Left/right */
void ScreenOptions::ChangeValue( PlayerNumber pn, int iDelta, bool Repeat ) void ScreenOptions::ChangeValueInRow( 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];
@@ -1153,8 +1162,8 @@ void ScreenOptions::ChangeValue( PlayerNumber pn, int iDelta, bool Repeat )
/* If START is being pressed, and in NAV_THREE_KEY, then we're holding left/right /* If START is being pressed, and in NAV_THREE_KEY, 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( m_OptionsNavigation == NAV_THREE_KEY && INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_START) ) ) // if( m_OptionsNavigation == NAV_THREE_KEY && INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_START) ) )
return; // return;
const int iNumOptions = (row.Type == Row::ROW_EXIT)? 1: optrow.choices.size(); const int iNumOptions = (row.Type == Row::ROW_EXIT)? 1: optrow.choices.size();
if( m_OptionsNavigation == NAV_THREE_KEY_MENU && iNumOptions <= 1 ) // 1 or 0 if( m_OptionsNavigation == NAV_THREE_KEY_MENU && iNumOptions <= 1 ) // 1 or 0
@@ -1164,7 +1173,7 @@ void ScreenOptions::ChangeValue( PlayerNumber pn, int iDelta, bool Repeat )
* *
* XXX: Only allow repeats if the opposite key isn't pressed; otherwise, holding both * XXX: Only allow repeats if the opposite key isn't pressed; otherwise, holding both
* directions will repeat in place continuously, which is weird. */ * directions will repeat in place continuously, which is weird. */
Move( pn, iDelta, Repeat ); MoveRow( pn, iDelta, Repeat );
return; return;
} }
@@ -1218,7 +1227,7 @@ void ScreenOptions::ChangeValue( PlayerNumber pn, int iDelta, bool Repeat )
/* Up/down */ /* Up/down */
void ScreenOptions::Move( PlayerNumber pn, int dir, bool Repeat ) void ScreenOptions::MoveRow( 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);
bool changed = false; bool changed = false;
+6 -6
View File
@@ -87,12 +87,12 @@ protected:
virtual void GoToNextState() = 0; virtual void GoToNextState() = 0;
virtual void GoToPrevState() = 0; virtual void GoToPrevState() = 0;
void MenuLeft( PlayerNumber pn, const InputEventType type ) { ChangeValue(pn,-1,type != IET_FIRST_PRESS); } void MenuLeft( PlayerNumber pn, const InputEventType type ) { ChangeValueInRow(pn,-1,type != IET_FIRST_PRESS); }
void MenuRight( PlayerNumber pn, const InputEventType type ) { ChangeValue(pn,+1,type != IET_FIRST_PRESS); } void MenuRight( PlayerNumber pn, const InputEventType type ) { ChangeValueInRow(pn,+1,type != IET_FIRST_PRESS); }
void ChangeValue( PlayerNumber pn, int iDelta, bool Repeat ); void ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat );
void MenuUp( PlayerNumber pn, const InputEventType type ) { Move( pn, -1, type != IET_FIRST_PRESS ); } void MenuUp( PlayerNumber pn, const InputEventType type ) { MoveRow( pn, -1, type != IET_FIRST_PRESS ); }
void MenuDown( PlayerNumber pn, const InputEventType type ) { Move( pn, +1, type != IET_FIRST_PRESS ); } void MenuDown( PlayerNumber pn, const InputEventType type ) { MoveRow( pn, +1, type != IET_FIRST_PRESS ); }
void Move( PlayerNumber pn, int dir, bool Repeat ); void MoveRow( PlayerNumber pn, int dir, bool Repeat );
/* Returns -1 if on a row with no OptionRowData (eg. EXIT). */ /* Returns -1 if on a row with no OptionRowData (eg. EXIT). */
int GetCurrentRow(PlayerNumber pn = PLAYER_1) const; int GetCurrentRow(PlayerNumber pn = PLAYER_1) const;