From 64504718d1e277cd5b292be280241d2f81f0b662 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 14 Oct 2005 01:46:00 +0000 Subject: [PATCH] move m_sCommandName from TS to TI. Cleaner, and fixes queued commands being wiped out by LuaExpressionTransform. --- stepmania/src/Actor.cpp | 21 ++++++++------------- stepmania/src/Actor.h | 2 +- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index 02e5cdfc40..b74652ba7c 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -595,12 +595,12 @@ void Actor::UpdateTweening( float fDeltaTime ) m_start = m_current; // set the start position // Execute the command in this tween (if any). - if( TS.sCommandName.size() ) + if( !TI.m_sCommandName.empty() ) { - if( TS.sCommandName.Left(1) == "!" ) - MESSAGEMAN->Broadcast( TS.sCommandName.substr(1) ); + if( TI.m_sCommandName.Left(1) == "!" ) + MESSAGEMAN->Broadcast( TI.m_sCommandName.substr(1) ); else - this->PlayCommand( TS.sCommandName ); + this->PlayCommand( TI.m_sCommandName ); } } @@ -612,10 +612,6 @@ void Actor::UpdateTweening( float fDeltaTime ) { m_current = TS; - // don't inherit the queued state's command. We keep having to do this. - // Does sCommandName belong in TweenInfo, instead of TweenState? - m_current.sCommandName = ""; - // delete the head tween delete m_Tweens.front(); m_Tweens.erase( m_Tweens.begin() ); @@ -764,9 +760,6 @@ void Actor::BeginTweening( float time, TweenType tt ) { // initialize the new TS from the last TS in the list TS = m_Tweens[m_Tweens.size()-2]->state; - - // don't inherit the queued state's command - TS.sCommandName = ""; } else { @@ -1239,7 +1232,8 @@ void Actor::Sleep( float time ) void Actor::QueueCommand( const CString& sCommandName ) { BeginTweening( 0, TWEEN_LINEAR ); - DestTweenState().sCommandName = sCommandName; + TweenInfo &TI = m_Tweens.back()->info; + TI.m_sCommandName = sCommandName; } void Actor::QueueMessage( const CString& sMessageName ) @@ -1248,7 +1242,8 @@ void Actor::QueueMessage( const CString& sMessageName ) // command, so we don't have to add yet another element to every tween // state for this rarely-used command. BeginTweening( 0, TWEEN_LINEAR ); - DestTweenState().sCommandName = "!" + sMessageName; + TweenInfo &TI = m_Tweens.back()->info; + TI.m_sCommandName = "!" + sMessageName; } void Actor::AddCommand( const CString &sCmdName, apActorCommands apac ) diff --git a/stepmania/src/Actor.h b/stepmania/src/Actor.h index d9ab664ecb..2a0eea91af 100644 --- a/stepmania/src/Actor.h +++ b/stepmania/src/Actor.h @@ -72,7 +72,6 @@ public: RageColor diffuse[4]; RageColor glow; float aux; - CString sCommandName; // command to execute when this TweenState goes into effect }; enum EffectClock @@ -382,6 +381,7 @@ protected: TweenType m_TweenType; float m_fTimeLeftInTween; // how far into the tween are we? float m_fTweenTime; // seconds between Start and End positions/zooms + CString m_sCommandName; // command to execute when this TweenState goes into effect };