position underlines per-player

This commit is contained in:
Chris Danford
2005-03-13 02:15:38 +00:00
parent 3ee87782eb
commit 0ab7c031bc
5 changed files with 54 additions and 52 deletions
+6 -8
View File
@@ -375,7 +375,7 @@ void OptionRow::LoadExit()
m_textTitle.SetHidden( true ); m_textTitle.SetHidden( true );
} }
void OptionRow::PositionUnderlines() void OptionRow::PositionUnderlines( PlayerNumber pn )
{ {
/* /*
SHOW_UNDERLINES SHOW_UNDERLINES
@@ -384,11 +384,9 @@ void OptionRow::PositionUnderlines()
if( m_RowType == ROW_EXIT ) if( m_RowType == ROW_EXIT )
return; return;
FOREACH_HumanPlayer( p ) vector<OptionsCursor*> &vpUnderlines = m_Underline[pn];
{
vector<OptionsCursor*> &vpUnderlines = m_Underline[p];
PlayerNumber pnTakeSelectedFrom = m_RowDef.bOneChoiceForAllPlayers ? PLAYER_1 : p; PlayerNumber pnTakeSelectedFrom = m_RowDef.bOneChoiceForAllPlayers ? PLAYER_1 : pn;
const int iNumUnderlines = (m_RowDef.layoutType == LAYOUT_SHOW_ONE_IN_ROW) ? 1 : vpUnderlines.size(); const int iNumUnderlines = (m_RowDef.layoutType == LAYOUT_SHOW_ONE_IN_ROW) ? 1 : vpUnderlines.size();
@@ -400,7 +398,7 @@ void OptionRow::PositionUnderlines()
/* Don't tween X movement and color changes. */ /* Don't tween X movement and color changes. */
int iWidth, iX, iY; int iWidth, iX, iY;
GetWidthXY( p, iChoiceWithFocus, iWidth, iX, iY ); GetWidthXY( pn, iChoiceWithFocus, iWidth, iX, iY );
ul.SetGlobalX( (float)iX ); ul.SetGlobalX( (float)iX );
ul.SetGlobalDiffuseColor( RageColor(1,1,1, 1.0f) ); ul.SetGlobalDiffuseColor( RageColor(1,1,1, 1.0f) );
@@ -422,7 +420,6 @@ void OptionRow::PositionUnderlines()
ul.SetY( (float)iY ); ul.SetY( (float)iY );
} }
} }
}
void OptionRow::PositionIcons() void OptionRow::PositionIcons()
{ {
@@ -715,7 +712,8 @@ void OptionRow::Reload()
UpdateEnabledDisabled(); UpdateEnabledDisabled();
UpdateText(); UpdateText();
PositionUnderlines(); FOREACH_HumanPlayer( p )
PositionUnderlines( p );
} }
break; break;
case OptionRow::ROW_EXIT: case OptionRow::ROW_EXIT:
+1 -1
View File
@@ -88,7 +88,7 @@ public:
); );
void DetachHandler(); void DetachHandler();
void PositionUnderlines(); void PositionUnderlines( PlayerNumber pn );
void PositionIcons(); void PositionIcons();
void UpdateText(); void UpdateText();
void SetRowFocus( bool bRowHasFocus[NUM_PLAYERS] ); void SetRowFocus( bool bRowHasFocus[NUM_PLAYERS] );
+15 -13
View File
@@ -265,7 +265,7 @@ void ScreenOptions::InitMenu( InputMode im, const vector<OptionRowDefinition> &v
CHECKPOINT; CHECKPOINT;
PositionItems(); PositionItems();
PositionUnderlines(); PositionAllUnderlines();
PositionIcons(); PositionIcons();
RefreshIcons(); RefreshIcons();
PositionCursors(); PositionCursors();
@@ -368,18 +368,17 @@ void ScreenOptions::GetWidthXY( PlayerNumber pn, int iRow, int iChoiceOnRow, int
row.GetWidthXY( pn, iChoiceOnRow, iWidthOut, iXOut, iYOut ); 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.
// Set the position of the underscores showing the current choice for each option line.
for( unsigned r=0; r<m_Rows.size(); r++ ) // foreach options line
{ {
OptionRow &row = *m_Rows[r]; OptionRow &row = *m_Rows[r];
row.PositionUnderlines(); row.PositionUnderlines( pn );
} }
void ScreenOptions::PositionAllUnderlines()
{
for( unsigned r=0; r<m_Rows.size(); r++ )
FOREACH_HumanPlayer( p )
PositionUnderlines( r, p );
} }
void ScreenOptions::PositionIcons() void ScreenOptions::PositionIcons()
@@ -661,11 +660,13 @@ void ScreenOptions::OnChange( PlayerNumber pn )
if( !GAMESTATE->IsHumanPlayer(pn) ) if( !GAMESTATE->IsHumanPlayer(pn) )
return; return;
const int iCurRow = m_iCurrentRow[pn];
/* Update m_fY and m_bHidden[]. */ /* Update m_fY and m_bHidden[]. */
PositionItems(); PositionItems();
/* Do positioning. */ /* Do positioning. */
PositionUnderlines(); PositionUnderlines( iCurRow, pn );
RefreshIcons(); RefreshIcons();
PositionIcons(); PositionIcons();
UpdateEnabledDisabled(); UpdateEnabledDisabled();
@@ -706,7 +707,6 @@ void ScreenOptions::OnChange( PlayerNumber pn )
} }
} }
const int iCurRow = m_iCurrentRow[pn];
const CString text = GetExplanationText( iCurRow ); const CString text = GetExplanationText( iCurRow );
BitmapText *pText = NULL; BitmapText *pText = NULL;
@@ -820,11 +820,13 @@ void ScreenOptions::MenuStart( PlayerNumber pn, const InputEventType selectType
int iChoiceInRow = row.GetChoiceInRowWithFocus(pn); int iChoiceInRow = row.GetChoiceInRowWithFocus(pn);
bool bSelected = !row.GetSelected( pn, iChoiceInRow ); bool bSelected = !row.GetSelected( pn, iChoiceInRow );
row.SetSelected( pn, iChoiceInRow, bSelected ); row.SetSelected( pn, iChoiceInRow, bSelected );
if( bSelected ) if( bSelected )
m_SoundToggleOn.Play(); m_SoundToggleOn.Play();
else else
m_SoundToggleOff.Play(); m_SoundToggleOff.Play();
PositionUnderlines();
PositionUnderlines( iCurRow, pn );
RefreshIcons(); RefreshIcons();
if( row.GetFirstItemGoesDown() ) if( row.GetFirstItemGoesDown() )
+2 -1
View File
@@ -40,7 +40,8 @@ protected:
CString GetExplanationText( int row ) const; CString GetExplanationText( int row ) const;
CString GetExplanationTitle( int row ) const; CString GetExplanationTitle( int row ) const;
BitmapText &GetTextItemForRow( PlayerNumber pn, int iRow, int iChoiceOnRow ); BitmapText &GetTextItemForRow( PlayerNumber pn, int iRow, int iChoiceOnRow );
void PositionUnderlines(); void PositionUnderlines( int row, PlayerNumber pn );
void PositionAllUnderlines();
void PositionIcons(); void PositionIcons();
virtual void RefreshIcons(); virtual void RefreshIcons();
void PositionCursors(); void PositionCursors();
+3 -2
View File
@@ -148,11 +148,12 @@ void ScreenPlayerOptions::Input( const DeviceInput& DeviceI, const InputEventTyp
COMMAND( m_sprCancelAll[pn], "Show" ); COMMAND( m_sprCancelAll[pn], "Show" );
for( unsigned r=0; r<m_Rows.size(); r++ ) for( unsigned r=0; r<m_Rows.size(); r++ )
{
this->ImportOptions( r, pn ); this->ImportOptions( r, pn );
this->PositionUnderlines(); this->PositionUnderlines( r, pn );
for( unsigned r=0; r<m_Rows.size(); r++ )
this->UpdateDisqualified( r, pn ); this->UpdateDisqualified( r, pn );
} }
}
ScreenOptionsMaster::Input( DeviceI, type, GameI, MenuI, StyleI ); ScreenOptionsMaster::Input( DeviceI, type, GameI, MenuI, StyleI );