diff --git a/stepmania/src/ScreenOptions.cpp b/stepmania/src/ScreenOptions.cpp index d11105296c..65b202dd0f 100644 --- a/stepmania/src/ScreenOptions.cpp +++ b/stepmania/src/ScreenOptions.cpp @@ -129,15 +129,21 @@ void ScreenOptions::Init( InputMode im, OptionRow OptionRow[], int iNumOptionLin m_framePage.AddChild( &m_textTitles[r] ); - int iNumChoices = min( m_OptionRow[r].choices.size(), MAX_VISIBLE_VALUES_PER_LINE ); - for( int c=0; cGetPathToF("ScreenOptions explanation") ); @@ -151,10 +157,15 @@ void ScreenOptions::Init( InputMode im, OptionRow OptionRow[], int iNumOptionLin PositionItems(); PositionUnderlines(); PositionIcons(); + CHECKPOINT; RefreshIcons(); + CHECKPOINT; PositionCursors(); + CHECKPOINT; UpdateEnabledDisabled(); + CHECKPOINT; OnChange(); + CHECKPOINT; /* It's tweening into position, but on the initial tween-in we only want to * tween in the whole page at once. Since the tweens are nontrivial, it's @@ -163,8 +174,10 @@ void ScreenOptions::Init( InputMode im, OptionRow OptionRow[], int iNumOptionLin { m_textTitles[r].FinishTweening(); m_sprBullets[r].FinishTweening(); - for( unsigned c=0; cFinishTweening(); + } for( int p=0; pTrace( "ScreenOptions::~ScreenOptions()" ); + for( int i=0; iGetPathToF("ScreenOptions item") ); option.SetText( optline.choices[j] ); @@ -248,16 +266,24 @@ void ScreenOptions::InitOptionsText() if( m_bRowIsLong[i] ) { // re-init with "long row" style - unsigned j; + unsigned j; for( j=0; jSetText( "" ); - for( int p=0; pIsHumanPlayer(p) ) continue; - BitmapText &option = m_textItems[i][p]; + if( p >= m_textItems[i].size() ) + { + BitmapText *bt = new BitmapText; + m_textItems[i].push_back( bt ); + + m_framePage.AddChild( bt ); + } + + BitmapText &option = *m_textItems[i][p]; const int iChoiceInRow = m_iSelectedOption[p][i]; @@ -279,7 +305,7 @@ void ScreenOptions::InitOptionsText() } } - BitmapText &option = m_textItems[i][0]; + BitmapText &option = *m_textItems[i][0]; option.LoadFromFont( THEME->GetPathToF("ScreenOptions item") ); option.SetText( "EXIT" ); option.SetZoom( ITEMS_ZOOM ); @@ -349,6 +375,8 @@ void ScreenOptions::PositionIcons() void ScreenOptions::RefreshIcons() { + ASSERT( m_iNumOptionRows < MAX_OPTION_LINES ); + for( int p=0; pIsHumanPlayer(p) ) @@ -427,7 +455,10 @@ void ScreenOptions::UpdateText( PlayerNumber player_no, int iRow ) OptionRow &row = m_OptionRow[iRow]; if( bLotsOfOptions ) - m_textItems[iRow][row.bOneChoiceForAllPlayers?0:player_no].SetText( m_OptionRow[iRow].choices[iChoiceInRow] ); + { + unsigned item_no = row.bOneChoiceForAllPlayers?0:player_no; + m_textItems[iRow][item_no]->SetText( m_OptionRow[iRow].choices[iChoiceInRow] ); + } } void ScreenOptions::UpdateEnabledDisabled() @@ -450,10 +481,10 @@ void ScreenOptions::UpdateEnabledDisabled() if( m_bRowIsLong[i] ) for( unsigned j=0; jSetGlobalDiffuseColor( color ); else for( unsigned j=0; jSetGlobalDiffuseColor( color ); if( m_sprBullets[i].GetDestY() != m_fRowY[i] ) { @@ -468,21 +499,23 @@ void ScreenOptions::UpdateEnabledDisabled() m_sprBullets[i].SetY( m_fRowY[i] ); m_textTitles[i].SetY( m_fRowY[i] ); + /* XXX: If we're long, then remove the old choices when we switch to long so we don't + * need a special case here. */ if( m_bRowIsLong[i] ) for( unsigned j=0; jStopTweening(); + m_textItems[i][j]->BeginTweening( 0.3f ); + m_textItems[i][j]->SetDiffuseAlpha( m_bRowIsHidden[i]? 0.0f:1.0f ); + m_textItems[i][j]->SetY( m_fRowY[i] ); } else for( unsigned j=0; jStopTweening(); + m_textItems[i][j]->BeginTweening( 0.3f ); + m_textItems[i][j]->SetDiffuseAlpha( m_bRowIsHidden[i]? 0.0f:1.0f ); + m_textItems[i][j]->SetY( m_fRowY[i] ); } } @@ -500,8 +533,8 @@ void ScreenOptions::UpdateEnabledDisabled() continue; } } - m_textItems[i][j].StopTweening(); - m_textItems[i][j].SetDiffuse( RageColor(1,1,1,0) ); + m_textItems[i][j]->StopTweening(); + m_textItems[i][j]->SetDiffuse( RageColor(1,1,1,0) ); } } } @@ -512,20 +545,20 @@ void ScreenOptions::UpdateEnabledDisabled() bExitRowIsSelectedByBoth = false; RageColor color = bExitRowIsSelectedByBoth ? colorSelected : colorNotSelected; - m_textItems[m_iNumOptionRows][0].SetGlobalDiffuseColor( color ); + m_textItems[m_iNumOptionRows][0]->SetGlobalDiffuseColor( color ); - if( m_textItems[m_iNumOptionRows][0].GetDestY() != m_fRowY[m_iNumOptionRows] ) + 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] ); + 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 ); + m_textItems[m_iNumOptionRows][0]->SetEffectDiffuseShift( 1.0f, colorSelected, colorNotSelected ); else - m_textItems[m_iNumOptionRows][0].SetEffectNone(); + m_textItems[m_iNumOptionRows][0]->SetEffectNone(); } void ScreenOptions::Update( float fDeltaTime ) diff --git a/stepmania/src/ScreenOptions.h b/stepmania/src/ScreenOptions.h index 6471726556..48cf0dfb7a 100644 --- a/stepmania/src/ScreenOptions.h +++ b/stepmania/src/ScreenOptions.h @@ -106,7 +106,7 @@ private: Sprite m_sprPage; Sprite m_sprBullets[MAX_OPTION_LINES]; BitmapText m_textTitles[MAX_OPTION_LINES]; - BitmapText m_textItems[MAX_OPTION_LINES][MAX_VISIBLE_VALUES_PER_LINE]; // this array has to be big enough to hold all of the options + vector m_textItems[MAX_OPTION_LINES]; bool m_bRowIsLong[MAX_OPTION_LINES]; // goes off edge of screen