diff --git a/stepmania/src/OptionRow.cpp b/stepmania/src/OptionRow.cpp index 079ea2d421..7d8ced0c56 100644 --- a/stepmania/src/OptionRow.cpp +++ b/stepmania/src/OptionRow.cpp @@ -509,7 +509,7 @@ void OptionRow::PositionUnderlines( PlayerNumber pn ) ASSERT( m_vbSelected[pnTakeSelectedFrom].size() == m_pHand->m_Def.m_vsChoices.size() ); bool bSelected = (iChoiceWithFocus==-1) ? false : m_vbSelected[pnTakeSelectedFrom][ iChoiceWithFocus ]; - bool bHidden = !bSelected || m_bHidden || !GAMESTATE->IsHumanPlayer(pn); + bool bHidden = !bSelected || !GAMESTATE->IsHumanPlayer(pn); ul.StopTweening(); ul.BeginTweening( m_pParentType->TWEEN_SECONDS ); @@ -525,9 +525,6 @@ void OptionRow::PositionIcons( PlayerNumber pn ) return; pIcon->SetX( m_pParentType->ICONS_X.GetValue(pn) ); - - /* XXX: this doesn't work since icon is an ActorFrame */ - pIcon->SetDiffuse( RageColor(1,1,1, m_bHidden? 0.0f:1.0f) ); } /* This is called when the focus changes, to update "long row" text. */ @@ -595,9 +592,6 @@ void OptionRow::UpdateEnabledDisabled() else if( bRowEnabled ) color = m_pParentType->COLOR_NOT_SELECTED; else color = m_pParentType->COLOR_DISABLED; - if( m_bHidden ) - color.a = 0; - if( m_sprBullet != NULL ) m_sprBullet->SetGlobalDiffuseColor( color ); m_sprBullet->PlayCommand( bThisRowHasFocusByAny ? "GainFocus" : "LoseFocus" ); @@ -649,9 +643,6 @@ void OptionRow::UpdateEnabledDisabled() if( m_bRowHasFocus[pn] ) color = m_pParentType->COLOR_SELECTED; else if( bRowEnabled ) color = m_pParentType->COLOR_NOT_SELECTED; else color = m_pParentType->COLOR_DISABLED; - - if( m_bHidden ) - color.a = 0; } unsigned item_no = m_pHand->m_Def.m_bOneChoiceForAllPlayers ? 0 : pn; @@ -666,18 +657,6 @@ void OptionRow::UpdateEnabledDisabled() bt.StopTweening(); bt.BeginTweening( m_pParentType->TWEEN_SECONDS ); bt.SetDiffuse( color ); - - /* Only reposition the underline if the text changed, too, or - * we'll cancel PositionUnderlines moving and resizing the - * underline. (XXX: This is brittle; if we're actually changing - * available options, this will break, too. Use m_fBaseAlpha?) */ - if( m_Underline[pn].size() ) - { - OptionsCursor *pUnderline = m_Underline[pn][0]; - pUnderline->StopTweening(); - pUnderline->BeginTweening( m_pParentType->TWEEN_SECONDS ); - pUnderline->SetDiffuseAlpha( color.a ); - } } } break; @@ -692,20 +671,28 @@ void OptionRow::UpdateEnabledDisabled() else m_textItems[0]->StopEffect(); } +} - if( m_sprBullet->DestTweenState().diffuse[0] != color ) +void OptionRow::Update( float fDeltaTime ) +{ + ActorFrame::Update( fDeltaTime ); + + float fAlpha = m_Frame.GetCurrentDiffuseAlpha(); + m_textTitle->SetBaseAlpha( fAlpha ); + if( m_sprBullet != NULL ) + m_sprBullet->SetBaseAlpha( fAlpha ); + FOREACH_HumanPlayer( pn ) { - m_textTitle->StopTweening(); - m_textTitle->BeginTweening( m_pParentType->TWEEN_SECONDS ); - m_textTitle->SetDiffuseAlpha( color.a ); - - if( m_sprBullet != NULL ) - { - m_sprBullet->StopTweening(); - m_sprBullet->BeginTweening( m_pParentType->TWEEN_SECONDS ); - m_sprBullet->SetDiffuseAlpha( color.a ); - } + FOREACH( OptionsCursor *, m_Underline[pn], pUnderline ) + (*pUnderline)->SetBaseAlpha( fAlpha ); + /* XXX: this doesn't work since icon is an ActorFrame */ + if( m_OptionIcons[pn] ) + m_OptionIcons[pn]->SetBaseAlpha( fAlpha ); } + if( m_sprBullet != NULL ) + m_sprBullet->SetBaseAlpha( fAlpha ); + for( unsigned j=0; jSetBaseAlpha( fAlpha ); } void OptionRow::SetOptionIcon( PlayerNumber pn, const RString &sText, GameCommand &gc ) diff --git a/stepmania/src/OptionRow.h b/stepmania/src/OptionRow.h index 61a9c85ff1..c3236e72b6 100644 --- a/stepmania/src/OptionRow.h +++ b/stepmania/src/OptionRow.h @@ -132,6 +132,7 @@ class OptionRow : public ActorFrame public: OptionRow( const OptionRowType *pType ); ~OptionRow(); + void Update( float fDeltaTime ); void Clear(); void LoadNormal( OptionRowHandler *pHand, bool bFirstItemGoesDown ); @@ -181,8 +182,6 @@ public: void GetWidthXY( PlayerNumber pn, int iChoiceOnRow, int &iWidthOut, int &iXOut, int &iYOut ) const; // ScreenOptions calls positions m_FrameDestination, then m_Frame tween to that same TweenState. - void SetRowHidden( bool bRowHidden ) { m_bHidden = bRowHidden; } - bool GetRowHidden() const { return m_bHidden; } unsigned GetTextItemsSize() const { return m_textItems.size(); } bool GetFirstItemGoesDown() const { return m_bFirstItemGoesDown; } diff --git a/stepmania/src/ScreenOptions.cpp b/stepmania/src/ScreenOptions.cpp index 6cafb09409..f137a856dc 100644 --- a/stepmania/src/ScreenOptions.cpp +++ b/stepmania/src/ScreenOptions.cpp @@ -653,15 +653,16 @@ void ScreenOptions::PositionRows( bool bTween ) else if( i >= second_end ) fPos = ((int)NUM_ROWS_SHOWN)-0.5f; Actor::TweenState tsDestination = m_exprRowPositionTransformFunction.GetPosition( fPos, i, min( (int)Rows.size(), (int)NUM_ROWS_SHOWN ) ); - row.SetDestination( tsDestination, bTween ); bool bHidden = i < first_start || (i >= first_end && i < second_start) || i >= second_end; + for( int j=0; j<4; j++ ) + tsDestination.diffuse[j].a = bHidden? 0.0f:1.0f; if( !bHidden ) pos++; - row.SetRowHidden( bHidden ); + row.SetDestination( tsDestination, bTween ); } if( pSeparateExitRow ) @@ -669,9 +670,11 @@ void ScreenOptions::PositionRows( bool bTween ) Actor::TweenState tsDestination; tsDestination.Init(); tsDestination.pos.y = SEPARATE_EXIT_ROW_Y; - pSeparateExitRow->SetDestination( tsDestination, bTween ); - pSeparateExitRow->SetRowHidden( second_end != (int) Rows.size() ); + bool bHidden = (second_end != (int) Rows.size()); + for( int j=0; j<4; j++ ) + tsDestination.diffuse[j].a = bHidden? 0.0f:1.0f; + pSeparateExitRow->SetDestination( tsDestination, bTween ); } }