From 7183a5e271a20f5ef70b71d4363688903a53d27f Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 16 Jan 2005 14:48:44 +0000 Subject: [PATCH] Add ScreenAttract::AutoBeginFadingOut() to disable sending SM_BeginFadingOut. We can't do this in the ctor (since it's sent during Update now); we can't do it in Update(), because if the message is posted with a delay of 0 (ScreenRanking), the message will be added by ScreenAttract::Update and immediately processed by Actor::Update before the derived Update can remove it. --- stepmania/src/ScreenAttract.cpp | 18 ++++++++++-------- stepmania/src/ScreenAttract.h | 2 ++ stepmania/src/ScreenRanking.cpp | 2 -- stepmania/src/ScreenRanking.h | 2 ++ 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/stepmania/src/ScreenAttract.cpp b/stepmania/src/ScreenAttract.cpp index f5194e9dc7..d432eef059 100644 --- a/stepmania/src/ScreenAttract.cpp +++ b/stepmania/src/ScreenAttract.cpp @@ -122,16 +122,18 @@ void ScreenAttract::Update( float fDelta ) { // The shared background isn't loaded until the screen is actually // showing. The background is loaded by the time of the first update. - BGAnimation &background = *SCREENMAN->m_pSharedBGA; - float fTimeUntilBeginFadingOut = background.GetTweenTimeLeft() - m_Out.GetTweenTimeLeft(); - if( fTimeUntilBeginFadingOut < 0 ) + if( AutoBeginFadingOut() ) { - LOG->Warn( "Screen '%s' Out BGAnimation (%f seconds) is longer than Background BGAnimation (%f seconds); background BGA will be truncated", - m_sName.c_str(), m_Out.GetTweenTimeLeft(), background.GetTweenTimeLeft() ); - fTimeUntilBeginFadingOut = 0; + BGAnimation &background = *SCREENMAN->m_pSharedBGA; + float fTimeUntilBeginFadingOut = background.GetTweenTimeLeft() - m_Out.GetTweenTimeLeft(); + if( fTimeUntilBeginFadingOut < 0 ) + { + LOG->Warn( "Screen '%s' Out BGAnimation (%f seconds) is longer than Background BGAnimation (%f seconds); background BGA will be truncated", + m_sName.c_str(), m_Out.GetTweenTimeLeft(), background.GetTweenTimeLeft() ); + fTimeUntilBeginFadingOut = 0; + } + this->PostScreenMessage( SM_BeginFadingOut, fTimeUntilBeginFadingOut ); } - this->PostScreenMessage( SM_BeginFadingOut, fTimeUntilBeginFadingOut ); - if( GAMESTATE->IsTimeToPlayAttractSounds() ) SOUND->PlayMusic( THEME->GetPathToS(m_sName + " music") ); diff --git a/stepmania/src/ScreenAttract.h b/stepmania/src/ScreenAttract.h index f5d48f52f0..e0dc9a4275 100644 --- a/stepmania/src/ScreenAttract.h +++ b/stepmania/src/ScreenAttract.h @@ -19,6 +19,8 @@ public: virtual void HandleScreenMessage( const ScreenMessage SM ); protected: + virtual bool AutoBeginFadingOut() const { return true; } + Transition m_In; Transition m_Out; }; diff --git a/stepmania/src/ScreenRanking.cpp b/stepmania/src/ScreenRanking.cpp index 7ef12743ec..7eca6a67a3 100644 --- a/stepmania/src/ScreenRanking.cpp +++ b/stepmania/src/ScreenRanking.cpp @@ -362,8 +362,6 @@ ScreenRanking::ScreenRanking( CString sClassName ) : ScreenAttract( sClassName ) } } - this->ClearMessageQueue( SM_BeginFadingOut ); // ignore ScreenAttract's SecsToShow - this->PostScreenMessage( SM_ShowNextPage, 0.5f ); } diff --git a/stepmania/src/ScreenRanking.h b/stepmania/src/ScreenRanking.h index 430659b66d..f77b4e5b02 100644 --- a/stepmania/src/ScreenRanking.h +++ b/stepmania/src/ScreenRanking.h @@ -34,6 +34,8 @@ public: void HandleScreenMessage( const ScreenMessage SM ); protected: + virtual bool AutoBeginFadingOut() const { return false; } + struct PageToShow { PageToShow()