fix options rows tween from top of screen instead of initially being in the row's position
This commit is contained in:
@@ -553,12 +553,12 @@ void OptionRow::SetRowHasFocus( PlayerNumber pn, bool bRowHasFocus )
|
||||
m_bRowHasFocus[pn] = bRowHasFocus;
|
||||
}
|
||||
|
||||
void OptionRow::SetDestination( Actor::TweenState &ts )
|
||||
void OptionRow::SetDestination( Actor::TweenState &ts, bool bTween )
|
||||
{
|
||||
if( m_Frame.DestTweenState() != ts )
|
||||
{
|
||||
m_Frame.StopTweening();
|
||||
if( m_pParentType->TWEEN_SECONDS != 0 )
|
||||
if( bTween && m_pParentType->TWEEN_SECONDS != 0 )
|
||||
m_Frame.BeginTweening( m_pParentType->TWEEN_SECONDS );
|
||||
m_Frame.DestTweenState() = ts;
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ protected:
|
||||
Actor::TweenState m_tsDestination; // this should approach m_tsDestination.
|
||||
|
||||
public:
|
||||
void SetDestination( Actor::TweenState &ts );
|
||||
void SetDestination( Actor::TweenState &ts, bool bTween );
|
||||
protected:
|
||||
bool m_bHidden; // currently off screen
|
||||
};
|
||||
|
||||
@@ -287,7 +287,7 @@ void ScreenOptions::RestartOptions()
|
||||
|
||||
CHECKPOINT;
|
||||
|
||||
PositionRows();
|
||||
PositionRows( false );
|
||||
FOREACH_HumanPlayer( pn )
|
||||
{
|
||||
// Hide the highlight if no rows are enabled.
|
||||
@@ -564,7 +564,7 @@ void ScreenOptions::HandleScreenMessage( const ScreenMessage SM )
|
||||
}
|
||||
|
||||
|
||||
void ScreenOptions::PositionRows()
|
||||
void ScreenOptions::PositionRows( bool bTween )
|
||||
{
|
||||
const int total = NUM_ROWS_SHOWN;
|
||||
const int halfsize = total / 2;
|
||||
@@ -656,7 +656,7 @@ void ScreenOptions::PositionRows()
|
||||
else if( i >= second_end ) fPos = ((int)NUM_ROWS_SHOWN)-0.5f;
|
||||
|
||||
Actor::TweenState tsDestination = m_exprRowPositionTransformFunction.GetPosition( (float) fPos, i, min( (int)Rows.size(), (int)NUM_ROWS_SHOWN ) );
|
||||
row.SetDestination( tsDestination );
|
||||
row.SetDestination( tsDestination, bTween );
|
||||
|
||||
bool bHidden =
|
||||
i < first_start ||
|
||||
@@ -672,7 +672,7 @@ void ScreenOptions::PositionRows()
|
||||
Actor::TweenState tsDestination;
|
||||
tsDestination.Init();
|
||||
tsDestination.pos.y = SEPARATE_EXIT_ROW_Y;
|
||||
pSeparateExitRow->SetDestination( tsDestination );
|
||||
pSeparateExitRow->SetDestination( tsDestination, bTween );
|
||||
|
||||
pSeparateExitRow->SetRowHidden( second_end != (int) Rows.size() );
|
||||
}
|
||||
@@ -690,7 +690,7 @@ void ScreenOptions::AfterChangeValueOrRow( PlayerNumber pn )
|
||||
return;
|
||||
|
||||
/* Update m_fY and m_bHidden[]. */
|
||||
PositionRows();
|
||||
PositionRows( true );
|
||||
|
||||
/* Do positioning. */
|
||||
for( unsigned r=0; r<m_pRows.size(); r++ )
|
||||
|
||||
@@ -59,7 +59,7 @@ protected:
|
||||
RString GetExplanationText( int iRow ) const;
|
||||
void RefreshIcons( int iRow, PlayerNumber pn );
|
||||
void PositionCursor( PlayerNumber pn );
|
||||
void PositionRows();
|
||||
void PositionRows( bool bTween );
|
||||
void TweenCursor( PlayerNumber pn );
|
||||
void StoreFocus( PlayerNumber pn );
|
||||
|
||||
@@ -132,7 +132,7 @@ protected: // derived classes need access to these
|
||||
ThemeMetric<apActorCommands> ROW_INIT_COMMAND;
|
||||
ThemeMetric<apActorCommands> ROW_ON_COMMAND;
|
||||
ThemeMetric<apActorCommands> ROW_OFF_COMMAND;
|
||||
LuaExpressionTransform m_exprRowPositionTransformFunction; // params: self,positionIndex,itemIndex,numItems
|
||||
LuaExpressionTransform m_exprRowPositionTransformFunction; // params: self,positionIndex,itemIndex,numItems
|
||||
ThemeMetric1D<float> EXPLANATION_X;
|
||||
ThemeMetric1D<float> EXPLANATION_Y;
|
||||
ThemeMetric1D<apActorCommands> EXPLANATION_ON_COMMAND;
|
||||
|
||||
Reference in New Issue
Block a user