From db3ea69aac234b9232ebc169d69b11df180b8f45 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 26 Mar 2006 06:04:29 +0000 Subject: [PATCH] Add PlayCommandOnChildren. This obsoletes "propagate". --- stepmania/src/ActorFrame.cpp | 9 +++++++++ stepmania/src/ActorFrame.h | 1 + 2 files changed, 10 insertions(+) diff --git a/stepmania/src/ActorFrame.cpp b/stepmania/src/ActorFrame.cpp index b0ae805843..23726d9829 100644 --- a/stepmania/src/ActorFrame.cpp +++ b/stepmania/src/ActorFrame.cpp @@ -226,6 +226,13 @@ void ActorFrame::DrawPrimitives() } } +void ActorFrame::PlayCommandOnChildren( const RString &sCommandName ) +{ + const apActorCommands *pCmd = GetCommand( sCommandName ); + if( pCmd != NULL ) + RunCommandsOnChildren( *pCmd ); +} + void ActorFrame::RunCommandsOnChildren( const LuaReference& cmds ) { for( unsigned i=0; i public: LunaActorFrame() { LUA->Register( Register ); } + static int playcommandonchildren( T* p, lua_State *L ) { p->PlayCommandOnChildren(SArg(1)); return 0; } static int propagate( T* p, lua_State *L ) { p->SetPropagateCommands( !!IArg(1) ); return 0; } static int fov( T* p, lua_State *L ) { p->SetFOV( FArg(1) ); return 0; } static int SetUpdateRate( T* p, lua_State *L ) { p->SetUpdateRate( FArg(1) ); return 0; } @@ -389,6 +397,7 @@ public: static void Register(lua_State *L) { + ADD_METHOD( playcommandonchildren ); ADD_METHOD( propagate ); ADD_METHOD( fov ); ADD_METHOD( SetUpdateRate ); diff --git a/stepmania/src/ActorFrame.h b/stepmania/src/ActorFrame.h index a7be826b58..012a0e2f90 100644 --- a/stepmania/src/ActorFrame.h +++ b/stepmania/src/ActorFrame.h @@ -34,6 +34,7 @@ public: // Commands // virtual void PushSelf( lua_State *L ); + void PlayCommandOnChildren( const RString &sCommandName ); virtual void RunCommandsOnChildren( const LuaReference& cmds ); /* but not on self */ void RunCommandsOnChildren( const apActorCommands& cmds ) { this->RunCommandsOnChildren( *cmds ); } // convenience virtual void RunCommandsOnLeaves( const LuaReference& cmds, Actor* pParent ); /* but not on self */