From dd78eb858fa59396ba590bb09207c87941f4300d Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 1 Feb 2004 04:41:48 +0000 Subject: [PATCH] fix PlayCommand doesn't propogate --- stepmania/src/Actor.cpp | 12 +++++++----- stepmania/src/ActorFrame.cpp | 20 ++++++++++---------- stepmania/src/BGAnimationLayer.cpp | 22 +++++----------------- stepmania/src/BGAnimationLayer.h | 5 +---- 4 files changed, 23 insertions(+), 36 deletions(-) diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index 065b28fcac..e7ac3a1eb6 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -815,11 +815,13 @@ void Actor::HandleCommand( const ParsedCommand &command ) else if( sName=="zwrite" ) SetZWrite( bParam(1) ); else if( sName=="clearzbuffer" ) SetClearZBuffer( bParam(1) ); else if( sName=="hidden" ) SetHidden( bParam(1) ); - else if( sName=="playcommand" ) sParam(1); /* nop: only BGAnimation handles this but everyone receives it */ - else if( sName=="customtexturerect" || sName=="texcoordvelocity" || sName=="scaletoclipped" || - sName=="stretchtexcoords" || sName=="position" || sName=="loop" || sName=="play" || - sName=="pause" || sName=="rate" ) - return; /* sprite commands; don't run CheckHandledParams */ + else if( sName=="playcommand" ) PlayCommand( sParam(1) ); + // Commands to Sprite should have been handled by Sprite and shouldn't be + // passed to Actor. -Chris +// else if( sName=="customtexturerect" || sName=="texcoordvelocity" || sName=="scaletoclipped" || +// sName=="stretchtexcoords" || sName=="position" || sName=="loop" || sName=="play" || +// sName=="pause" || sName=="rate" ) +// return; /* sprite commands; don't run CheckHandledParams */ else { CString sError = ssprintf( "Actor::HandleCommand: Unrecognized command name '%s'.", sName.c_str() ); diff --git a/stepmania/src/ActorFrame.cpp b/stepmania/src/ActorFrame.cpp index 7356b41f08..c577d30d0b 100644 --- a/stepmania/src/ActorFrame.cpp +++ b/stepmania/src/ActorFrame.cpp @@ -93,11 +93,20 @@ void ActorFrame::Update( float fDeltaTime ) } PropagateActorFrameCommand( SetDiffuse, RageColor ) -PropagateActorFrameCommand( SetDiffuseAlpha, float ) PropagateActorFrameCommand( SetZTest, bool ) PropagateActorFrameCommand( SetZWrite, bool ) PropagateActorFrameCommand( HurryTweening, float ) +void ActorFrame::SetDiffuseAlpha( float f ) +{ + Actor::SetDiffuseAlpha( f ); + + /* set all sub-Actors */ + for( unsigned i=0; iSetDiffuseAlpha( f ); +} + + void ActorFrame::FinishTweening() { Actor::FinishTweening(); @@ -138,15 +147,6 @@ void ActorFrame::DeleteAllChildren() void ActorFrame::HandleCommand( const ParsedCommand &command ) { - // pass "PlayCommand" on to children - if( command.vTokens[0].s=="playcommand" ) - { - for( unsigned i=0; iHandleCommand( command ); - return; // handled - } - - // base class handles the rest... Actor::HandleCommand( command ); } diff --git a/stepmania/src/BGAnimationLayer.cpp b/stepmania/src/BGAnimationLayer.cpp index e4f0c1168a..0de7844343 100644 --- a/stepmania/src/BGAnimationLayer.cpp +++ b/stepmania/src/BGAnimationLayer.cpp @@ -651,13 +651,6 @@ void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer ) PlayCommand( "On" ); } - -void BGAnimationLayer::FinishTweening() -{ - for( unsigned i=0; iFinishTweening(); -} - void BGAnimationLayer::Update( float fDeltaTime ) { fDeltaTime *= m_fUpdateRate; @@ -964,12 +957,6 @@ void BGAnimationLayer::DrawPrimitives() } } -void BGAnimationLayer::SetDiffuse( RageColor c ) -{ - for(unsigned i=0; iSetDiffuse(c); -} - void BGAnimationLayer::GainingFocus( float fRate, bool bRewindMovie, bool bLoop ) { m_fUpdateRate = fRate; @@ -1001,15 +988,16 @@ void BGAnimationLayer::LosingFocus() m_SubActors[0]->Command( "pause" ); } -void BGAnimationLayer::PlayCommand( CString cmd ) +void BGAnimationLayer::PlayCommand( const CString &sCommandName ) { unsigned i; for( i=0; iCommand( ssprintf("playcommand,%s", cmd.c_str()) ); + m_SubActors[i]->Command( ssprintf("playcommand,%s", sCommandName.c_str()) ); - cmd.MakeLower(); - map::const_iterator it = m_asCommands.find( cmd ); + CString sKey = sCommandName; + sKey.MakeLower(); + map::const_iterator it = m_asCommands.find( sKey ); if( it == m_asCommands.end() ) return; diff --git a/stepmania/src/BGAnimationLayer.h b/stepmania/src/BGAnimationLayer.h index 49c2965e0c..8134b5f103 100644 --- a/stepmania/src/BGAnimationLayer.h +++ b/stepmania/src/BGAnimationLayer.h @@ -33,14 +33,11 @@ public: void Update( float fDeltaTime ); void DrawPrimitives(); - void SetDiffuse( RageColor c ); - float GetMaxTweenTimeLeft() const; - void FinishTweening(); void GainingFocus( float fRate, bool bRewindMovie, bool bLoop ); void LosingFocus(); - void PlayCommand( CString cmd ); + void PlayCommand( const CString &sCommandName ); void PlayOffCommand() { PlayCommand( "Off" ); } protected: