diff --git a/stepmania/src/ScreenOptions.cpp b/stepmania/src/ScreenOptions.cpp index 773c4982a0..a0f4f6c327 100644 --- a/stepmania/src/ScreenOptions.cpp +++ b/stepmania/src/ScreenOptions.cpp @@ -79,8 +79,11 @@ ScreenOptions::ScreenOptions( CString sClassName ) : Screen(sClassName) } m_framePage.Command( FRAME_ON_COMMAND ); +} - memset(&m_bRowIsLong, 0, sizeof(m_bRowIsLong)); +void ScreenOptions::LoadOptionIcon( PlayerNumber pn, int iRow, CString sText ) +{ + m_Rows[iRow]->m_OptionIcons[pn].Load( pn, sText, false ); } void ScreenOptions::Init( InputMode im, OptionRow OptionRows[], int iNumOptionLines ) @@ -122,6 +125,12 @@ void ScreenOptions::Init( InputMode im, OptionRow OptionRows[], int iNumOptionLi m_framePage.AddChild( &m_Highlight[p] ); } + int r; + for( r=0; r & textItems = m_textItems[r]; + Row &row = *m_Rows[r]; + row.Type = Row::ROW_NORMAL; + + vector & textItems = row.m_textItems; const OptionRow &optline = m_OptionRow[r]; unsigned c; - m_framePage.AddChild( &m_sprBullets[r] ); - - m_framePage.AddChild( &m_textTitles[r] ); + m_framePage.AddChild( &row.m_sprBullet ); + m_framePage.AddChild( &row.m_textTitle ); float fX = ITEMS_START_X; // indent 70 pixels for( c=0; c SCREEN_RIGHT-40 ) { // It goes off the edge of the screen. Re-init with the "long row" style. - m_bRowIsLong[r] = true; - for( unsigned j=0; jLoadFromFont( THEME->GetPathToF("ScreenOptions item") ); bt->SetText( "EXIT" ); bt->SetZoom( ITEMS_ZOOM ); - bt->SetShadowLength( 0 ); - float fY = ITEMS_START_Y + ITEMS_SPACING_Y*m_iNumOptionRows; - bt->SetXY( CENTER_X, fY ); + bt->EnableShadow( false ); + bt->SetX( CENTER_X ); m_framePage.AddChild( bt ); - - m_Rows.push_back( ROW_EXIT ); } InitOptionsText(); @@ -282,7 +293,7 @@ void ScreenOptions::Init( InputMode im, OptionRow OptionRows[], int iNumOptionLi m_framePage.AddChild( m_sprFrame ); // poke once at all the explanation metrics so that we catch missing ones early - for( r=0; rFinishTweening(); - } + Row &row = *m_Rows[r]; + row.m_sprBullet.FinishTweening(); + row.m_textTitle.FinishTweening(); + + for( unsigned c=0; cFinishTweening(); for( int p=0; pTrace( "ScreenOptions::~ScreenOptions()" ); for( unsigned i=0; iType == Row::ROW_EXIT ) + return ""; + + CString sLineName = m_OptionRow[iRow].name; sLineName.Replace("\n-",""); sLineName.Replace("\n",""); sLineName.Replace(" ",""); return THEME->GetMetric( "OptionExplanations", sLineName+"Help" ); } -CString ScreenOptions::GetExplanationTitle( int row ) const +CString ScreenOptions::GetExplanationTitle( int iRow ) const { - CString sLineName = m_OptionRow[row].name; + if( m_Rows[iRow]->Type == Row::ROW_EXIT ) + return ""; + + CString sLineName = m_OptionRow[iRow].name; sLineName.Replace("\n-",""); sLineName.Replace("\n",""); sLineName.Replace(" ",""); @@ -365,26 +381,26 @@ CString ScreenOptions::GetExplanationTitle( int row ) const BitmapText &ScreenOptions::GetTextItemForRow( PlayerNumber pn, int iRow ) { - const bool bExitRow = (m_Rows[iRow] == ROW_EXIT); - if( bExitRow ) - return *m_textItems[iRow][0]; + Row &row = *m_Rows[iRow]; + if( row.Type == Row::ROW_EXIT ) + return *row.m_textItems[0]; - const bool bLotsOfOptions = m_bRowIsLong[iRow]; - if( !bLotsOfOptions ) + if( !row.m_bRowIsLong ) { unsigned iOptionInRow = m_iSelectedOption[pn][iRow]; - return *m_textItems[iRow][iOptionInRow]; + return *row.m_textItems[iOptionInRow]; } const bool bOneChoice = m_OptionRow[iRow].bOneChoiceForAllPlayers; if( bOneChoice ) - return *m_textItems[iRow][0]; + return *row.m_textItems[0]; /* We have lots of options and this isn't a OneChoice row, which means * each player has a separate item displayed. */ - int iOptionInRow = min( (unsigned)pn, m_textItems[iRow].size()-1 ); - return *m_textItems[iRow][iOptionInRow]; + int iOptionInRow = min( (unsigned)pn, row.m_textItems.size()-1 ); + CHECKPOINT; + return *row.m_textItems[iOptionInRow]; } void ScreenOptions::GetWidthXY( PlayerNumber pn, int iRow, int &iWidthOut, int &iXOut, int &iYOut ) @@ -393,23 +409,24 @@ void ScreenOptions::GetWidthXY( PlayerNumber pn, int iRow, int &iWidthOut, int & iWidthOut = int(roundf( text.GetZoomedWidth() )); iXOut = int(roundf( text.GetDestX() )); - /* We update m_fRowY, change colors and tween items, and then tween rows to - * their final positions. (This is so we don't tween colors, too.) m_fRowY + /* We update m_fY, change colors and tween items, and then tween rows to + * their final positions. (This is so we don't tween colors, too.) m_fY * is the actual destination position, even though we may not have set up the * tween yet. */ - iYOut = int(roundf( m_fRowY[iRow] )); + iYOut = int(roundf( m_Rows[iRow]->m_fY )); } void ScreenOptions::InitOptionsText() { for( unsigned i=0; iGetPathToF("ScreenOptions title") ); CString sText = GetExplanationTitle( i ); @@ -421,13 +438,13 @@ void ScreenOptions::InitOptionsText() title.SetVertAlign( Actor::align_middle ); title.EnableShadow( false ); - Sprite &bullet = m_sprBullets[i]; + Sprite &bullet = row.m_sprBullet; bullet.Load( THEME->GetPathToG("ScreenOptions bullet") ); bullet.SetXY( ARROWS_X, fY ); // set the Y position of each item in the line - for( unsigned c=0; cSetY( fY ); + for( unsigned c=0; cSetY( fY ); } } @@ -441,10 +458,11 @@ void ScreenOptions::PositionUnderlines() for( unsigned i=0; i