From cb0c7ce59d9418222314ef09032bfae4c81cd771 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 30 Jan 2006 08:06:31 +0000 Subject: [PATCH] Set up tsDestination directly. It doesn't make sense for a function named "UpdateEnabledDisabled" to do this, and we don't need to delay it anymore as GetWidthXY says (that was before we moved the text into a frame). --- stepmania/src/OptionRow.cpp | 19 +++++++++++-------- stepmania/src/OptionRow.h | 3 ++- stepmania/src/ScreenOptions.cpp | 9 +++++++-- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/stepmania/src/OptionRow.cpp b/stepmania/src/OptionRow.cpp index 420e61032b..ce4243a35b 100644 --- a/stepmania/src/OptionRow.cpp +++ b/stepmania/src/OptionRow.cpp @@ -556,6 +556,17 @@ void OptionRow::SetRowHasFocus( PlayerNumber pn, bool bRowHasFocus ) m_bRowHasFocus[pn] = bRowHasFocus; } +void OptionRow::SetDestination( Actor::TweenState &ts ) +{ + if( m_Frame.DestTweenState() != ts ) + { + m_Frame.StopTweening(); + if( m_pParentType->TWEEN_SECONDS != 0 ) + m_Frame.BeginTweening( m_pParentType->TWEEN_SECONDS ); + m_Frame.DestTweenState() = ts; + } +} + void OptionRow::UpdateEnabledDisabled() { bool bThisRowHasFocusByAny = false; @@ -568,14 +579,6 @@ void OptionRow::UpdateEnabledDisabled() bool bRowEnabled = !m_pHand->m_Def.m_vEnabledForPlayers.empty(); - if( m_Frame.DestTweenState() != m_tsDestination ) - { - m_Frame.StopTweening(); - if( m_pParentType->TWEEN_SECONDS != 0 ) - m_Frame.BeginTweening( m_pParentType->TWEEN_SECONDS ); - m_Frame.DestTweenState() = m_tsDestination; - } - if( bThisRowHasFocusByAny ) m_textTitle->RunCommands( m_pParentType->TITLE_GAIN_FOCUS_COMMAND ); else diff --git a/stepmania/src/OptionRow.h b/stepmania/src/OptionRow.h index 8a7847c748..bab70ef82a 100644 --- a/stepmania/src/OptionRow.h +++ b/stepmania/src/OptionRow.h @@ -220,9 +220,10 @@ protected: int m_iChoiceInRowWithFocus[NUM_PLAYERS]; // this choice has input focus // Only one will true at a time if m_pHand->m_Def.bMultiSelect vector m_vbSelected[NUM_PLAYERS]; // size = m_pHand->m_Def.choices.size() + Actor::TweenState m_tsDestination; // this should approach m_tsDestination. public: - Actor::TweenState m_tsDestination; // this should approach m_tsDestination. + void SetDestination( Actor::TweenState &ts ); protected: bool m_bHidden; // currently off screen }; diff --git a/stepmania/src/ScreenOptions.cpp b/stepmania/src/ScreenOptions.cpp index 858e06e737..d8fe9a8460 100644 --- a/stepmania/src/ScreenOptions.cpp +++ b/stepmania/src/ScreenOptions.cpp @@ -682,7 +682,8 @@ void ScreenOptions::PositionRows() else if( i >= first_end && i < second_start ) fPos = ((int)NUM_ROWS_SHOWN)/2-0.5f; else if( i >= second_end ) fPos = ((int)NUM_ROWS_SHOWN)-0.5f; - row.m_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 ); bool bHidden = i < first_start || @@ -695,7 +696,11 @@ void ScreenOptions::PositionRows() if( pSeparateExitRow ) { - pSeparateExitRow->m_tsDestination.pos.y = SEPARATE_EXIT_ROW_Y; + Actor::TweenState tsDestination; + tsDestination.Init(); + tsDestination.pos.y = SEPARATE_EXIT_ROW_Y; + pSeparateExitRow->SetDestination( tsDestination ); + pSeparateExitRow->SetRowHidden( second_end != (int) Rows.size() ); } }