From 862f19ed65b61b28f20e89ba80b8a57e81963378 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 15 Jan 2005 20:55:04 +0000 Subject: [PATCH] simplify --- stepmania/src/Transition.cpp | 36 +++++++++++++----------------------- stepmania/src/Transition.h | 2 -- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/stepmania/src/Transition.cpp b/stepmania/src/Transition.cpp index 3f5e7c2a8e..cfd0d595bf 100644 --- a/stepmania/src/Transition.cpp +++ b/stepmania/src/Transition.cpp @@ -9,7 +9,6 @@ Transition::Transition() { m_State = waiting; - m_fSecsIntoTransition = 0.0f; } void Transition::Load( CString sBGAniDir ) @@ -22,7 +21,6 @@ void Transition::Load( CString sBGAniDir ) m_fLengthSeconds = m_BGAnimation.GetTweenTimeLeft(); m_State = waiting; - m_fSecsIntoTransition = 0.0f; // load sound from file specified by ini, or use the first sound in the directory IniFile ini; @@ -45,30 +43,23 @@ void Transition::Load( CString sBGAniDir ) void Transition::Update( float fDeltaTime ) { + if( m_State != transitioning ) + return; + + /* Start the transition on the first update, not in the ctor, so + * we don't play a sound while our parent is still loading. */ + if( m_bFirstUpdate ) + m_sound.PlayRandom(); + Actor::Update( fDeltaTime ); - if( m_State == transitioning ) + if( m_BGAnimation.GetTweenTimeLeft() == 0 ) // over { - /* Start the transition on the first update, not in the ctor, so - * we don't play a sound while our parent is still loading. */ - if( m_fSecsIntoTransition==0 ) // first update - { - m_sound.PlayRandom(); - - // stop the sound from playing multiple times on an Update(0) - m_fSecsIntoTransition+=0.000001f; - } - - m_BGAnimation.Update( fDeltaTime ); - if( m_fSecsIntoTransition > m_fLengthSeconds ) // over - { - SCREENMAN->SendMessageToTopScreen( m_MessageToSendWhenDone ); - m_fSecsIntoTransition = 0.0; - m_State = finished; - } - else - m_fSecsIntoTransition += fDeltaTime; + SCREENMAN->SendMessageToTopScreen( m_MessageToSendWhenDone ); + m_State = finished; } + + m_BGAnimation.Update( fDeltaTime ); } bool Transition::EarlyAbortDraw() @@ -88,7 +79,6 @@ void Transition::StartTransitioning( ScreenMessage send_when_done ) m_MessageToSendWhenDone = send_when_done; m_State = transitioning; - m_fSecsIntoTransition = 0.0; } float Transition::GetLengthSeconds() const diff --git a/stepmania/src/Transition.h b/stepmania/src/Transition.h index 64c5e95903..0199208443 100644 --- a/stepmania/src/Transition.h +++ b/stepmania/src/Transition.h @@ -34,8 +34,6 @@ protected: transitioning, finished } m_State; - float m_fSecsIntoTransition; - BGAnimation m_BGAnimation; float m_fLengthSeconds;