diff --git a/stepmania/src/OptionRow.cpp b/stepmania/src/OptionRow.cpp index 7d63ff015c..4c09e1c6a3 100644 --- a/stepmania/src/OptionRow.cpp +++ b/stepmania/src/OptionRow.cpp @@ -375,7 +375,7 @@ void OptionRow::LoadExit() m_textTitle.SetHidden( true ); } -void OptionRow::PositionUnderlines() +void OptionRow::PositionUnderlines( PlayerNumber pn ) { /* SHOW_UNDERLINES @@ -384,43 +384,40 @@ void OptionRow::PositionUnderlines() if( m_RowType == ROW_EXIT ) return; - FOREACH_HumanPlayer( p ) + vector &vpUnderlines = m_Underline[pn]; + + PlayerNumber pnTakeSelectedFrom = m_RowDef.bOneChoiceForAllPlayers ? PLAYER_1 : pn; + + const int iNumUnderlines = (m_RowDef.layoutType == LAYOUT_SHOW_ONE_IN_ROW) ? 1 : vpUnderlines.size(); + + for( int i=0; i &vpUnderlines = m_Underline[p]; + OptionsCursor& ul = *vpUnderlines[i]; - PlayerNumber pnTakeSelectedFrom = m_RowDef.bOneChoiceForAllPlayers ? PLAYER_1 : p; + int iChoiceWithFocus = (m_RowDef.layoutType == LAYOUT_SHOW_ONE_IN_ROW) ? m_iChoiceInRowWithFocus[pnTakeSelectedFrom] : i; - const int iNumUnderlines = (m_RowDef.layoutType == LAYOUT_SHOW_ONE_IN_ROW) ? 1 : vpUnderlines.size(); - - for( int i=0; i &v CHECKPOINT; PositionItems(); - PositionUnderlines(); + PositionAllUnderlines(); PositionIcons(); RefreshIcons(); PositionCursors(); @@ -368,18 +368,17 @@ void ScreenOptions::GetWidthXY( PlayerNumber pn, int iRow, int iChoiceOnRow, int row.GetWidthXY( pn, iChoiceOnRow, iWidthOut, iXOut, iYOut ); } -void ScreenOptions::PositionUnderlines() +void ScreenOptions::PositionUnderlines( int r, PlayerNumber pn ) { - // OPTIMIZATION OPPORTUNITY: There's no reason to the underlines for - // all rows when something changes. Just recalulate for the row that - // changed. + OptionRow &row = *m_Rows[r]; + row.PositionUnderlines( pn ); +} - // Set the position of the underscores showing the current choice for each option line. - for( unsigned r=0; rIsHumanPlayer(pn) ) return; + const int iCurRow = m_iCurrentRow[pn]; + /* Update m_fY and m_bHidden[]. */ PositionItems(); /* Do positioning. */ - PositionUnderlines(); + PositionUnderlines( iCurRow, pn ); RefreshIcons(); PositionIcons(); UpdateEnabledDisabled(); @@ -706,7 +707,6 @@ void ScreenOptions::OnChange( PlayerNumber pn ) } } - const int iCurRow = m_iCurrentRow[pn]; const CString text = GetExplanationText( iCurRow ); BitmapText *pText = NULL; @@ -820,11 +820,13 @@ void ScreenOptions::MenuStart( PlayerNumber pn, const InputEventType selectType int iChoiceInRow = row.GetChoiceInRowWithFocus(pn); bool bSelected = !row.GetSelected( pn, iChoiceInRow ); row.SetSelected( pn, iChoiceInRow, bSelected ); + if( bSelected ) m_SoundToggleOn.Play(); else m_SoundToggleOff.Play(); - PositionUnderlines(); + + PositionUnderlines( iCurRow, pn ); RefreshIcons(); if( row.GetFirstItemGoesDown() ) diff --git a/stepmania/src/ScreenOptions.h b/stepmania/src/ScreenOptions.h index e60b9f4b55..9620c55a6a 100644 --- a/stepmania/src/ScreenOptions.h +++ b/stepmania/src/ScreenOptions.h @@ -40,7 +40,8 @@ protected: CString GetExplanationText( int row ) const; CString GetExplanationTitle( int row ) const; BitmapText &GetTextItemForRow( PlayerNumber pn, int iRow, int iChoiceOnRow ); - void PositionUnderlines(); + void PositionUnderlines( int row, PlayerNumber pn ); + void PositionAllUnderlines(); void PositionIcons(); virtual void RefreshIcons(); void PositionCursors(); diff --git a/stepmania/src/ScreenPlayerOptions.cpp b/stepmania/src/ScreenPlayerOptions.cpp index 71dde35a2d..fcf5f035bb 100644 --- a/stepmania/src/ScreenPlayerOptions.cpp +++ b/stepmania/src/ScreenPlayerOptions.cpp @@ -148,10 +148,11 @@ void ScreenPlayerOptions::Input( const DeviceInput& DeviceI, const InputEventTyp COMMAND( m_sprCancelAll[pn], "Show" ); for( unsigned r=0; rImportOptions( r, pn ); - this->PositionUnderlines(); - for( unsigned r=0; rPositionUnderlines( r, pn ); this->UpdateDisqualified( r, pn ); + } } ScreenOptionsMaster::Input( DeviceI, type, GameI, MenuI, StyleI );