From b5ef8003868078b2e9643e4808726f28bc6f725d Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 16 Oct 2004 02:46:10 +0000 Subject: [PATCH] little hack to allow forcing propagation of commands to children that normally aren't --- stepmania/src/Actor.cpp | 2 +- stepmania/src/ActorFrame.cpp | 35 +++++++++++++++++++++++++++++++++-- stepmania/src/ActorFrame.h | 3 +++ 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index cce339b473..305b446f8c 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -742,7 +742,7 @@ void Actor::HandleCommand( const ParsedCommand &command ) * on these commands. */ else if( sName=="customtexturerect" || sName=="texcoordvelocity" || sName=="scaletoclipped" || sName=="stretchtexcoords" || sName=="position" || sName=="loop" || sName=="play" || - sName=="pause" || sName=="rate" ) + sName=="pause" || sName=="rate" || sName=="propagate" ) return; else { diff --git a/stepmania/src/ActorFrame.cpp b/stepmania/src/ActorFrame.cpp index 126f899e52..1670edc4d7 100644 --- a/stepmania/src/ActorFrame.cpp +++ b/stepmania/src/ActorFrame.cpp @@ -3,6 +3,11 @@ #include "arch/Dialog/Dialog.h" #include "RageUtil.h" +ActorFrame::ActorFrame() +{ + m_bPropagateCommands = false; +} + void ActorFrame::AddChild( Actor* pActor ) { #if _DEBUG @@ -68,6 +73,12 @@ void ActorFrame::RunCommandOnChildren( const CString &cmd ) m_SubActors[i]->Command( cmd ); } +void ActorFrame::RunCommandOnChildren( const ParsedCommand &cmd ) +{ + for( unsigned i=0; iHandleCommand( cmd ); +} + void ActorFrame::Update( float fDeltaTime ) { // LOG->Trace( "ActorFrame::Update( %f )", fDeltaTime ); @@ -146,9 +157,29 @@ void ActorFrame::DeleteAllChildren() void ActorFrame::HandleCommand( const ParsedCommand &command ) { - Actor::HandleCommand( command ); + HandleParams; - // don't propograte most commands to children + const CString& sName = sParam(0); + do + { + if( sName=="propagate" ) + { + m_bPropagateCommands = bParam(1); + RunCommandOnChildren( command ); + } + else + { + Actor::HandleCommand( command ); + break; + } + CheckHandledParams; + } while(0); + + /* By default, don't propograte most commands to children; it makes no sense + * to run "x,50" recursively. If m_bPropagateCommands is set, propagate all + * commands. */ + if( m_bPropagateCommands && sName!="propagate" ) + RunCommandOnChildren( command ); } void ActorFrame::GainFocus( float fRate, bool bRewindMovie, bool bLoop ) diff --git a/stepmania/src/ActorFrame.h b/stepmania/src/ActorFrame.h index 78aee909c9..b381a947fa 100644 --- a/stepmania/src/ActorFrame.h +++ b/stepmania/src/ActorFrame.h @@ -8,6 +8,7 @@ class ActorFrame : public Actor { public: + ActorFrame(); virtual void AddChild( Actor* pActor ); virtual void RemoveChild( Actor* pActor ); virtual void MoveToTail( Actor* pActor ); @@ -19,6 +20,7 @@ public: void DeleteAllChildren(); virtual void RunCommandOnChildren( const CString &cmd ); /* but not on self */ + virtual void RunCommandOnChildren( const ParsedCommand &cmd ); /* but not on self */ virtual void HandleCommand( const ParsedCommand &command ); // derivable virtual void Update( float fDeltaTime ); @@ -41,6 +43,7 @@ public: protected: vector m_SubActors; + bool m_bPropagateCommands; }; #endif