From df7a03cd562f2015198ed41fd9f9ea1e44ef0fc8 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 4 Sep 2002 03:28:02 +0000 Subject: [PATCH] Abort tweens, to make sure everything has a chance to tween off if the difficulty screen is rushed through. Make sure all elements go completely off-screen; they weren't if the tween-off started while an element was over the left edge of the screen due to bounce. --- stepmania/src/MenuElements.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/stepmania/src/MenuElements.cpp b/stepmania/src/MenuElements.cpp index 12bc593590..aacef2678c 100644 --- a/stepmania/src/MenuElements.cpp +++ b/stepmania/src/MenuElements.cpp @@ -129,6 +129,14 @@ void MenuElements::TweenOnScreenFromMenu( ScreenMessage smSendWhenDone ) void MenuElements::TweenTopLayerOffScreen() { +/* + This trick is neat, but there's a problem: fOriginalX may not be the settled + position--we might still be tweening, and if it's a bounce tween, it might be + left of center, which means fOriginalX+SCREEN_WIDTH won't actually take it + completely off-screen. fOriginalX+SCREEN_WIDTH*2 would, but that'd make the + bounce faster. SCREEN_WIDTH+SCREEN_WIDTH/2 would, but ignoring fOriginalX + will make each component tween off at a different rate ... + -glenn CArray apActorsInTopFrame; apActorsInTopFrame.Add( &m_sprTopEdge ); apActorsInTopFrame.Add( &m_sprStyleIcon ); @@ -139,7 +147,21 @@ void MenuElements::TweenTopLayerOffScreen() apActorsInTopFrame[i]->BeginTweening( MENU_ELEMENTS_TWEEN_TIME, TWEEN_BOUNCE_BEGIN ); apActorsInTopFrame[i]->SetTweenX( fOriginalX+SCREEN_WIDTH ); } + */ + m_sprTopEdge.StopTweening(); + m_sprTopEdge.BeginTweening( MENU_ELEMENTS_TWEEN_TIME, TWEEN_BOUNCE_BEGIN ); + m_sprTopEdge.SetTweenX( TOP_EDGE_X+SCREEN_WIDTH ); + + m_sprStyleIcon.StopTweening(); + m_sprStyleIcon.BeginTweening( MENU_ELEMENTS_TWEEN_TIME, TWEEN_BOUNCE_BEGIN ); + m_sprStyleIcon.SetTweenX( STYLE_ICON_X+SCREEN_WIDTH ); + + m_MenuTimer.StopTweening(); + m_MenuTimer.BeginTweening( MENU_ELEMENTS_TWEEN_TIME, TWEEN_BOUNCE_BEGIN ); + m_MenuTimer.SetTweenX( TIMER_X+SCREEN_WIDTH ); + + m_textHelp.StopTweening(); m_textHelp.BeginTweening( MENU_ELEMENTS_TWEEN_TIME/2 ); m_textHelp.SetTweenZoomY( 0 ); } @@ -168,6 +190,7 @@ void MenuElements::TweenBottomLayerOnScreen() void MenuElements::TweenBottomLayerOffScreen() { float fOriginalY = m_sprBottomEdge.GetY(); + m_sprBottomEdge.StopTweening(); m_sprBottomEdge.BeginTweening( MENU_ELEMENTS_TWEEN_TIME/2 ); m_sprBottomEdge.SetTweenY( fOriginalY + 100 );