diff --git a/stepmania/src/ScreenOptions.cpp b/stepmania/src/ScreenOptions.cpp index 82cae72fe1..773c4982a0 100644 --- a/stepmania/src/ScreenOptions.cpp +++ b/stepmania/src/ScreenOptions.cpp @@ -206,9 +206,9 @@ void ScreenOptions::Init( InputMode im, OptionRow OptionRows[], int iNumOptionLi for( c=0; cSetXY( CENTER_X, fY ); m_framePage.AddChild( bt ); + + m_Rows.push_back( ROW_EXIT ); } + InitOptionsText(); + // add explanation here so it appears on top for( p=0; pTrace( "ScreenOptions::~ScreenOptions()" ); - for( int i=0; iIsHumanPlayer(p) ) continue; // skip - for( int i=0; iIsHumanPlayer(p) ) continue; - for( int i=0; iIsHumanPlayer(p) && m_iCurrentRow[p] != (int) i ) + bExitRowIsSelectedByBoth = false; + + RageColor color = bExitRowIsSelectedByBoth ? colorSelected : colorNotSelected; + m_textItems[i][0]->SetGlobalDiffuseColor( color ); + + if( m_textItems[i][0]->GetDestY() != m_fRowY[i] ) + { + m_textItems[i][0]->StopTweening(); + m_textItems[i][0]->BeginTweening( 0.3f ); + m_textItems[i][0]->SetDiffuseAlpha( m_bRowIsHidden[i]? 0.0f:1.0f ); + m_textItems[i][0]->SetY( m_fRowY[i] ); + } + + if( bExitRowIsSelectedByBoth ) + m_textItems[i][0]->SetEffectDiffuseShift( 1.0f, colorSelected, colorNotSelected ); + else + m_textItems[i][0]->SetEffectNone(); + + continue; + } + bool bThisRowIsSelected = false; for( int p=0; pIsHumanPlayer(p) && m_iCurrentRow[p] == i ) + if( GAMESTATE->IsHumanPlayer(p) && m_iCurrentRow[p] == (int) i ) bThisRowIsSelected = true; /* Don't tween selection colors at all. */ @@ -593,27 +632,6 @@ void ScreenOptions::UpdateEnabledDisabled() } } } - - bool bExitRowIsSelectedByBoth = true; - for( int p=0; pIsHumanPlayer(p) && m_iCurrentRow[p] != m_iNumOptionRows ) - bExitRowIsSelectedByBoth = false; - - RageColor color = bExitRowIsSelectedByBoth ? colorSelected : colorNotSelected; - m_textItems[m_iNumOptionRows][0]->SetGlobalDiffuseColor( color ); - - if( m_textItems[m_iNumOptionRows][0]->GetDestY() != m_fRowY[m_iNumOptionRows] ) - { - m_textItems[m_iNumOptionRows][0]->StopTweening(); - m_textItems[m_iNumOptionRows][0]->BeginTweening( 0.3f ); - m_textItems[m_iNumOptionRows][0]->SetDiffuseAlpha( m_bRowIsHidden[m_iNumOptionRows]? 0.0f:1.0f ); - m_textItems[m_iNumOptionRows][0]->SetY( m_fRowY[m_iNumOptionRows] ); - } - - if( bExitRowIsSelectedByBoth ) - m_textItems[m_iNumOptionRows][0]->SetEffectDiffuseShift( 1.0f, colorSelected, colorNotSelected ); - else - m_textItems[m_iNumOptionRows][0]->SetEffectNone(); } void ScreenOptions::Update( float fDeltaTime ) @@ -706,9 +724,6 @@ void ScreenOptions::PositionItems() const int total = NUM_SHOWN_ITEMS; const int halfsize = total / 2; - /* Total number of rows, including "EXIT". */ - const int NumRows = m_iNumOptionRows + 1; - int first_start, first_end, second_start, second_end; /* Choices for each player. If only one player is active, it's the same for both. */ @@ -739,15 +754,15 @@ void ScreenOptions::PositionItems() second_end = second_start + halfsize; } - first_end = min( first_end, NumRows ); - second_end = min( second_end, NumRows ); + first_end = min( first_end, (int) m_Rows.size() ); + second_end = min( second_end, (int) m_Rows.size() ); - /* If less than total (and NumRows) are displayed, fill in the empty + /* If less than total (and m_Rows.size()) are displayed, fill in the empty * space intelligently. */ while(1) { const int sum = (first_end - first_start) + (second_end - second_start); - if( sum >= NumRows || sum >= total) + if( sum >= (int) m_Rows.size() || sum >= total) break; /* nothing more to display, or no room */ /* First priority: expand the top of the second half until it meets @@ -757,14 +772,14 @@ void ScreenOptions::PositionItems() /* Otherwise, expand either end. */ else if( first_start > 0 ) first_start--; - else if( second_end < NumRows ) + else if( second_end < (int) m_Rows.size() ) second_end++; else ASSERT(0); /* do we have room to grow or don't we? */ } int pos = 0; - for( int i=0; i 1 ) + fPercent = m_iCurrentRow[pn] / float(m_Rows.size()-1); + m_ScrollBar.SetPercentage( pn, fPercent ); + } /* Update all players, since changing one player can move both cursors. */ for( int p=0; p m_Rows; + InputMode m_InputMode; ActorFrame m_framePage;