position underlines per-player
This commit is contained in:
+32
-34
@@ -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<OptionsCursor*> &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<iNumUnderlines; i++ )
|
||||
{
|
||||
vector<OptionsCursor*> &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<iNumUnderlines; i++ )
|
||||
/* Don't tween X movement and color changes. */
|
||||
int iWidth, iX, iY;
|
||||
GetWidthXY( pn, iChoiceWithFocus, iWidth, iX, iY );
|
||||
ul.SetGlobalX( (float)iX );
|
||||
ul.SetGlobalDiffuseColor( RageColor(1,1,1, 1.0f) );
|
||||
|
||||
ASSERT( m_vbSelected[pnTakeSelectedFrom].size() == m_RowDef.choices.size() );
|
||||
|
||||
bool bSelected = m_vbSelected[pnTakeSelectedFrom][ iChoiceWithFocus ];
|
||||
bool bHidden = !bSelected || m_bHidden;
|
||||
if( !(bool)SHOW_UNDERLINES )
|
||||
bHidden = true;
|
||||
|
||||
if( ul.GetDestY() != m_fY )
|
||||
{
|
||||
OptionsCursor& ul = *vpUnderlines[i];
|
||||
|
||||
int iChoiceWithFocus = (m_RowDef.layoutType == LAYOUT_SHOW_ONE_IN_ROW) ? m_iChoiceInRowWithFocus[pnTakeSelectedFrom] : i;
|
||||
|
||||
/* Don't tween X movement and color changes. */
|
||||
int iWidth, iX, iY;
|
||||
GetWidthXY( p, iChoiceWithFocus, iWidth, iX, iY );
|
||||
ul.SetGlobalX( (float)iX );
|
||||
ul.SetGlobalDiffuseColor( RageColor(1,1,1, 1.0f) );
|
||||
|
||||
ASSERT( m_vbSelected[pnTakeSelectedFrom].size() == m_RowDef.choices.size() );
|
||||
|
||||
bool bSelected = m_vbSelected[pnTakeSelectedFrom][ iChoiceWithFocus ];
|
||||
bool bHidden = !bSelected || m_bHidden;
|
||||
if( !(bool)SHOW_UNDERLINES )
|
||||
bHidden = true;
|
||||
|
||||
if( ul.GetDestY() != m_fY )
|
||||
{
|
||||
ul.StopTweening();
|
||||
ul.BeginTweening( TWEEN_SECONDS );
|
||||
}
|
||||
|
||||
ul.SetHidden( bHidden );
|
||||
ul.SetBarWidth( iWidth );
|
||||
ul.SetY( (float)iY );
|
||||
ul.StopTweening();
|
||||
ul.BeginTweening( TWEEN_SECONDS );
|
||||
}
|
||||
|
||||
ul.SetHidden( bHidden );
|
||||
ul.SetBarWidth( iWidth );
|
||||
ul.SetY( (float)iY );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -715,7 +712,8 @@ void OptionRow::Reload()
|
||||
|
||||
UpdateEnabledDisabled();
|
||||
UpdateText();
|
||||
PositionUnderlines();
|
||||
FOREACH_HumanPlayer( p )
|
||||
PositionUnderlines( p );
|
||||
}
|
||||
break;
|
||||
case OptionRow::ROW_EXIT:
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
);
|
||||
void DetachHandler();
|
||||
|
||||
void PositionUnderlines();
|
||||
void PositionUnderlines( PlayerNumber pn );
|
||||
void PositionIcons();
|
||||
void UpdateText();
|
||||
void SetRowFocus( bool bRowHasFocus[NUM_PLAYERS] );
|
||||
|
||||
@@ -265,7 +265,7 @@ void ScreenOptions::InitMenu( InputMode im, const vector<OptionRowDefinition> &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; r<m_Rows.size(); r++ ) // foreach options line
|
||||
{
|
||||
OptionRow &row = *m_Rows[r];
|
||||
row.PositionUnderlines();
|
||||
}
|
||||
void ScreenOptions::PositionAllUnderlines()
|
||||
{
|
||||
for( unsigned r=0; r<m_Rows.size(); r++ )
|
||||
FOREACH_HumanPlayer( p )
|
||||
PositionUnderlines( r, p );
|
||||
}
|
||||
|
||||
void ScreenOptions::PositionIcons()
|
||||
@@ -661,11 +660,13 @@ void ScreenOptions::OnChange( PlayerNumber pn )
|
||||
if( !GAMESTATE->IsHumanPlayer(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() )
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -148,10 +148,11 @@ void ScreenPlayerOptions::Input( const DeviceInput& DeviceI, const InputEventTyp
|
||||
COMMAND( m_sprCancelAll[pn], "Show" );
|
||||
|
||||
for( unsigned r=0; r<m_Rows.size(); r++ )
|
||||
{
|
||||
this->ImportOptions( r, pn );
|
||||
this->PositionUnderlines();
|
||||
for( unsigned r=0; r<m_Rows.size(); r++ )
|
||||
this->PositionUnderlines( r, pn );
|
||||
this->UpdateDisqualified( r, pn );
|
||||
}
|
||||
}
|
||||
|
||||
ScreenOptionsMaster::Input( DeviceI, type, GameI, MenuI, StyleI );
|
||||
|
||||
Reference in New Issue
Block a user