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;
|
m_bRowHasFocus[pn] = bRowHasFocus;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionRow::SetDestination( Actor::TweenState &ts )
|
void OptionRow::SetDestination( Actor::TweenState &ts, bool bTween )
|
||||||
{
|
{
|
||||||
if( m_Frame.DestTweenState() != ts )
|
if( m_Frame.DestTweenState() != ts )
|
||||||
{
|
{
|
||||||
m_Frame.StopTweening();
|
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.BeginTweening( m_pParentType->TWEEN_SECONDS );
|
||||||
m_Frame.DestTweenState() = ts;
|
m_Frame.DestTweenState() = ts;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ protected:
|
|||||||
Actor::TweenState m_tsDestination; // this should approach m_tsDestination.
|
Actor::TweenState m_tsDestination; // this should approach m_tsDestination.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void SetDestination( Actor::TweenState &ts );
|
void SetDestination( Actor::TweenState &ts, bool bTween );
|
||||||
protected:
|
protected:
|
||||||
bool m_bHidden; // currently off screen
|
bool m_bHidden; // currently off screen
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ void ScreenOptions::RestartOptions()
|
|||||||
|
|
||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
|
|
||||||
PositionRows();
|
PositionRows( false );
|
||||||
FOREACH_HumanPlayer( pn )
|
FOREACH_HumanPlayer( pn )
|
||||||
{
|
{
|
||||||
// Hide the highlight if no rows are enabled.
|
// 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 total = NUM_ROWS_SHOWN;
|
||||||
const int halfsize = total / 2;
|
const int halfsize = total / 2;
|
||||||
@@ -656,7 +656,7 @@ void ScreenOptions::PositionRows()
|
|||||||
else if( i >= second_end ) fPos = ((int)NUM_ROWS_SHOWN)-0.5f;
|
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 ) );
|
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 =
|
bool bHidden =
|
||||||
i < first_start ||
|
i < first_start ||
|
||||||
@@ -672,7 +672,7 @@ void ScreenOptions::PositionRows()
|
|||||||
Actor::TweenState tsDestination;
|
Actor::TweenState tsDestination;
|
||||||
tsDestination.Init();
|
tsDestination.Init();
|
||||||
tsDestination.pos.y = SEPARATE_EXIT_ROW_Y;
|
tsDestination.pos.y = SEPARATE_EXIT_ROW_Y;
|
||||||
pSeparateExitRow->SetDestination( tsDestination );
|
pSeparateExitRow->SetDestination( tsDestination, bTween );
|
||||||
|
|
||||||
pSeparateExitRow->SetRowHidden( second_end != (int) Rows.size() );
|
pSeparateExitRow->SetRowHidden( second_end != (int) Rows.size() );
|
||||||
}
|
}
|
||||||
@@ -690,7 +690,7 @@ void ScreenOptions::AfterChangeValueOrRow( PlayerNumber pn )
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* Update m_fY and m_bHidden[]. */
|
/* Update m_fY and m_bHidden[]. */
|
||||||
PositionRows();
|
PositionRows( true );
|
||||||
|
|
||||||
/* Do positioning. */
|
/* Do positioning. */
|
||||||
for( unsigned r=0; r<m_pRows.size(); r++ )
|
for( unsigned r=0; r<m_pRows.size(); r++ )
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ protected:
|
|||||||
RString GetExplanationText( int iRow ) const;
|
RString GetExplanationText( int iRow ) const;
|
||||||
void RefreshIcons( int iRow, PlayerNumber pn );
|
void RefreshIcons( int iRow, PlayerNumber pn );
|
||||||
void PositionCursor( PlayerNumber pn );
|
void PositionCursor( PlayerNumber pn );
|
||||||
void PositionRows();
|
void PositionRows( bool bTween );
|
||||||
void TweenCursor( PlayerNumber pn );
|
void TweenCursor( PlayerNumber pn );
|
||||||
void StoreFocus( PlayerNumber pn );
|
void StoreFocus( PlayerNumber pn );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user