fix music rate display not changing in song options menu

This commit is contained in:
Glenn Maynard
2004-03-31 00:00:08 +00:00
parent d0ce109c61
commit 2ada267834
2 changed files with 35 additions and 15 deletions
+33 -13
View File
@@ -808,7 +808,13 @@ void ScreenOptions::TweenCursor( PlayerNumber pn )
} }
} }
void ScreenOptions::UpdateText( PlayerNumber pn, int iRow ) /* For "long row-style" rows, update the text on screen to contain the currently-
* focused options.
*
* This used to update a single player, but it's not always clear what that means
* when dealing with bOneChoiceForAllPlayers and disabled players, which was brittle.
* Update the whole row. */
void ScreenOptions::UpdateText( int iRow )
{ {
Row &row = *m_Rows[iRow]; Row &row = *m_Rows[iRow];
const OptionRowData &data = row.m_RowDef; const OptionRowData &data = row.m_RowDef;
@@ -816,14 +822,16 @@ void ScreenOptions::UpdateText( PlayerNumber pn, int iRow )
if( !row.m_bRowIsLong ) if( !row.m_bRowIsLong )
return; return;
int iChoiceWithFocus = row.m_iChoiceWithFocus[pn]; FOREACH_HumanPlayer( pn )
{
int iChoiceWithFocus = row.m_iChoiceWithFocus[pn];
unsigned item_no = data.bOneChoiceForAllPlayers ? 0 : pn;
unsigned item_no = data.bOneChoiceForAllPlayers ? 0 : pn; /* If player_no is 2 and there is no player 1: */
item_no = min( item_no, row.m_textItems.size()-1 );
/* If player_no is 2 and there is no player 1: */ row.m_textItems[item_no]->SetText( data.choices[iChoiceWithFocus] );
item_no = min( item_no, row.m_textItems.size()-1 ); }
row.m_textItems[item_no]->SetText( data.choices[iChoiceWithFocus] );
} }
void ScreenOptions::UpdateEnabledDisabled() void ScreenOptions::UpdateEnabledDisabled()
@@ -1316,11 +1324,25 @@ void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat )
{ {
row.m_iChoiceWithFocus[pn] = iNewChoiceWithFocus; row.m_iChoiceWithFocus[pn] = iNewChoiceWithFocus;
m_InputMode == INPUTMODE_SHARE_CURSOR);
/* If this row is bOneChoiceForAllPlayers, then lock the cursors together
* for this row. Don't do this in NAV_FIRST_CHOICE_GOES_DOWN, since the
* current selection and the current focus are detached in that mode. */
bool bForceFocusedChoiceTogether = false;
if( m_OptionsNavigation!=NAV_FIRST_CHOICE_GOES_DOWN &&
optrow.bOneChoiceForAllPlayers )
bForceFocusedChoiceTogether = true;
/* Also lock focus if the screen is explicitly set to share cursors. */
if( m_InputMode == INPUTMODE_SHARE_CURSOR ) if( m_InputMode == INPUTMODE_SHARE_CURSOR )
bForceFocusedChoiceTogether = true;
if( bForceFocusedChoiceTogether )
{ {
// lock focus together // lock focus together
FOREACH_HumanPlayer( pn ) FOREACH_HumanPlayer( p )
row.m_iChoiceWithFocus[pn] = iNewChoiceWithFocus; row.m_iChoiceWithFocus[p] = iNewChoiceWithFocus;
} }
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
@@ -1336,8 +1358,6 @@ void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat )
else else
row.SetOneSelection( (PlayerNumber)p, iNewChoiceWithFocus ); row.SetOneSelection( (PlayerNumber)p, iNewChoiceWithFocus );
} }
UpdateText( (PlayerNumber)p, iCurRow );
} }
} }
else else
@@ -1355,10 +1375,10 @@ void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat )
else else
row.SetOneSelection( pn, iNewChoiceWithFocus ); row.SetOneSelection( pn, iNewChoiceWithFocus );
} }
UpdateText( pn, iCurRow );
} }
UpdateText( iCurRow );
OnChange( pn ); OnChange( pn );
if( m_OptionsNavigation != NAV_THREE_KEY_MENU ) if( m_OptionsNavigation != NAV_THREE_KEY_MENU )
+2 -2
View File
@@ -74,8 +74,8 @@ protected:
virtual void RefreshIcons(); virtual void RefreshIcons();
void PositionCursors(); void PositionCursors();
void PositionItems(); void PositionItems();
void TweenCursor( PlayerNumber player_no ); void TweenCursor( PlayerNumber pn );
void UpdateText( PlayerNumber player_no, int row ); void UpdateText( int row );
void UpdateEnabledDisabled(); void UpdateEnabledDisabled();
virtual void OnChange( PlayerNumber pn ); virtual void OnChange( PlayerNumber pn );