diff --git a/stepmania/src/Actor.h b/stepmania/src/Actor.h index 4268c752a7..8533d11a9d 100644 --- a/stepmania/src/Actor.h +++ b/stepmania/src/Actor.h @@ -358,6 +358,7 @@ public: virtual void RunCommands2( const LuaReference& cmds, Actor *pParent ); void RunCommands( const apActorCommands& cmds ) { this->RunCommands( *cmds ); } // convenience void RunCommands2( const apActorCommands& cmds, Actor *pParent ) { this->RunCommands2( *cmds, pParent ); } // convenience + virtual void RunCommandsOnLeaves( const LuaReference& cmds ) { RunCommands(cmds); } static float GetCommandsLengthSeconds( const LuaReference& cmds ); static float GetCommandsLengthSeconds( const apActorCommands& cmds ) { return GetCommandsLengthSeconds( *cmds ); } // convenience diff --git a/stepmania/src/ActorFrame.cpp b/stepmania/src/ActorFrame.cpp index 4b4b8b2fee..70aeaff44d 100644 --- a/stepmania/src/ActorFrame.cpp +++ b/stepmania/src/ActorFrame.cpp @@ -210,6 +210,12 @@ void ActorFrame::RunCommandsOnChildren( const LuaReference& cmds ) m_SubActors[i]->RunCommands( cmds ); } +void ActorFrame::RunCommandsOnLeaves( const LuaReference& cmds ) +{ + for( unsigned i=0; iRunCommandsOnLeaves( cmds ); +} + void ActorFrame::Update( float fDeltaTime ) { // LOG->Trace( "ActorFrame::Update( %f )", fDeltaTime ); @@ -229,7 +235,17 @@ void ActorFrame::Update( float fDeltaTime ) } } -#define PropagateActorFrameCommand( cmd, type ) \ +#define PropagateActorFrameCommand( cmd ) \ + void ActorFrame::cmd() \ + { \ + Actor::cmd(); \ + \ + /* set all sub-Actors */ \ + for( unsigned i=0; icmd(); \ + } + +#define PropagateActorFrameCommand1Param( cmd, type ) \ void ActorFrame::cmd( type f ) \ { \ Actor::cmd( f ); \ @@ -239,35 +255,15 @@ void ActorFrame::Update( float fDeltaTime ) m_SubActors[i]->cmd( f ); \ } -PropagateActorFrameCommand( SetDiffuse, RageColor ) -PropagateActorFrameCommand( SetZTestMode, ZTestMode ) -PropagateActorFrameCommand( SetZWrite, bool ) -PropagateActorFrameCommand( HurryTweening, float ) +PropagateActorFrameCommand( Reset ) +PropagateActorFrameCommand( FinishTweening ) +PropagateActorFrameCommand1Param( SetDiffuse, RageColor ) +PropagateActorFrameCommand1Param( SetZTestMode, ZTestMode ) +PropagateActorFrameCommand1Param( SetZWrite, bool ) +PropagateActorFrameCommand1Param( HurryTweening, float ) +PropagateActorFrameCommand1Param( SetDiffuseAlpha, float ) +PropagateActorFrameCommand1Param( SetBaseAlpha, float ) -void ActorFrame::SetDiffuseAlpha( float f ) -{ - Actor::SetDiffuseAlpha( f ); - - for( unsigned i=0; iSetDiffuseAlpha( f ); -} - -void ActorFrame::SetBaseAlpha( float f ) -{ - Actor::SetBaseAlpha( f ); - - for( unsigned i=0; iSetBaseAlpha( f ); -} - -void ActorFrame::FinishTweening() -{ - Actor::FinishTweening(); - - // set all sub-Actors - for( unsigned i=0; iFinishTweening(); -} float ActorFrame::GetTweenTimeLeft() const { diff --git a/stepmania/src/ActorFrame.h b/stepmania/src/ActorFrame.h index 7f15bb4655..faf92ecd9c 100644 --- a/stepmania/src/ActorFrame.h +++ b/stepmania/src/ActorFrame.h @@ -67,16 +67,18 @@ public: // Commands // void PushSelf( lua_State *L ); - void RunCommandsOnChildren( const LuaReference& cmds ); /* but not on self */ - void RunCommandsOnChildren( const apActorCommands& cmds ) { RunCommandsOnChildren( *cmds ); } // convenience + virtual void RunCommandsOnChildren( const LuaReference& cmds ); /* but not on self */ + virtual void RunCommandsOnChildren( const apActorCommands& cmds ) { RunCommandsOnChildren( *cmds ); } // convenience + virtual void RunCommandsOnLeaves( const LuaReference& cmds ); /* but not on self */ virtual void Update( float fDeltaTime ); virtual void DrawPrimitives(); + // propagated commands + virtual void Reset(); virtual void SetDiffuse( RageColor c ); virtual void SetDiffuseAlpha( float f ); virtual void SetBaseAlpha( float f ); - virtual void SetZTestMode( ZTestMode mode ); virtual void SetZWrite( bool b ); virtual void FinishTweening(); @@ -86,7 +88,7 @@ public: void SetFOV( float fFOV ) { m_fFOV = fFOV; } void SetVanishPoint( float fX, float fY) { m_fVanishX = fX; m_fVanishY = fY; } - void SetPropagateCommands( bool b ); + virtual void SetPropagateCommands( bool b ); /* Amount of time until all tweens (and all children's tweens) have stopped: */ virtual float GetTweenTimeLeft() const;