From d42559a5cd8e4a08e7867f7bf96eb7a92a15efe0 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 24 Feb 2006 03:01:28 +0000 Subject: [PATCH] I'm still slowly wrangling out just how Cancel should work. Screens typically have two general simple models of transitioning; either the menu elements transition out, or we drop a fade on top of everything. The former leaves the background in place, the latter doesn't. Transitioning is usually used when we're going to a screen with the same background; fading is used otherwise. (There are combinations of these, and more complex modes, but these are the basics.) Traditionally, cancelling has always wiped. It usually goes back to the title menu, which rarely has the same background; and it's an uncommon path, so it's not worth setting up a full transition for. However, for cases where we don't go all the way back, this is incorrect; it looks very strange to press escape in the options submenu or the player options menu, and to have it wipe the screen. I've dealt with this in the past by setting up a "cancel" transition that simply runs "Off" and waits. That works, but it's a pain, since the wait duration needs to line up with the length of the transition. Instead, add a transition mode "CancelTransitionsOut" that causes Cancel to run the Out transition directly. (This also plays the start sound, due to a discrepency right now: with Out, it's the screen's job to play the sound, but with Cancel, it's the transition's job. Figure that out later ...) Ultimately, we should be able to have full CancelCommand transitions if we want, but the SWME TweenOnScreen/TweenOffScreen code transition needs to be completed first (replacing individual transitions with a single "On"/"Off" command). --- stepmania/src/ScreenWithMenuElements.cpp | 8 ++++++++ stepmania/src/ScreenWithMenuElements.h | 1 + 2 files changed, 9 insertions(+) diff --git a/stepmania/src/ScreenWithMenuElements.cpp b/stepmania/src/ScreenWithMenuElements.cpp index a2d020fc26..17e4d9b69c 100644 --- a/stepmania/src/ScreenWithMenuElements.cpp +++ b/stepmania/src/ScreenWithMenuElements.cpp @@ -35,6 +35,7 @@ void ScreenWithMenuElements::Init() LOG->Trace( "ScreenWithMenuElements::Init()" ); PLAY_MUSIC.Load( m_sName, "PlayMusic" ); + CANCEL_TRANSITIONS_OUT.Load( m_sName, "CancelTransitionsOut" ); TIMER_SECONDS.Load( m_sName, "TimerSeconds" ); Screen::Init(); @@ -271,6 +272,13 @@ void ScreenWithMenuElements::TweenOffScreen() void ScreenWithMenuElements::Cancel( ScreenMessage smSendWhenDone ) { + if( CANCEL_TRANSITIONS_OUT ) + { + SCREENMAN->PlayStartSound(); + StartTransitioningScreen( smSendWhenDone ); + return; + } + if( m_Cancel.IsTransitioning() ) return; // ignore diff --git a/stepmania/src/ScreenWithMenuElements.h b/stepmania/src/ScreenWithMenuElements.h index 7c7452f7ec..4475edd485 100644 --- a/stepmania/src/ScreenWithMenuElements.h +++ b/stepmania/src/ScreenWithMenuElements.h @@ -60,6 +60,7 @@ protected: Transition m_Cancel; ThemeMetric PLAY_MUSIC; + ThemeMetric CANCEL_TRANSITIONS_OUT; ThemeMetric TIMER_SECONDS; private: