ScreenOptions fading is a headache. We move rows up and down, and

fade them in and out at the same time; we do this by tweening the whole
row up and down, and fading each part of the row.  This is a big pain,
because we're also tweening each part for other reasons, and these
tweens tend to collide.  The whole thing is brittle and complicated,
and it's making fixing other problems a pain.

Try it a little differently: to fade the whole row, tween the alpha
along with the position of the whole row.  Then, manually propagate
the changing alpha value to each part, using BaseAlpha, so it doesn't
affect other tweens.

This also helps segregate the fading: with the exception of the actual
propagation, OptionRow doesn't have to know anything about it.  Before,
it had to constantly be careful that any tweening operations didn't
collide with the alpha tweening; often, one or the other would be cancelled,
resulting in either the change not happening at all, or snapping instead
of fading.

(This is still a hack, but it's more manageable; it puts control of high-level
tweening entirely in SOptionsMenu's control, instead of half in OptionRow.)
This commit is contained in:
Glenn Maynard
2006-02-27 03:04:56 +00:00
parent 1262243670
commit c2243b0b0e
3 changed files with 28 additions and 39 deletions
+7 -4
View File
@@ -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 );
}
}