add RunCommandsOnLeaves

propagate Reset
This commit is contained in:
Chris Danford
2005-05-29 01:00:05 +00:00
parent 8b135714a5
commit d89b0a8dfc
3 changed files with 32 additions and 33 deletions
+1
View File
@@ -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
+25 -29
View File
@@ -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; i<m_SubActors.size(); i++ )
m_SubActors[i]->RunCommandsOnLeaves( 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; i<m_SubActors.size(); i++ ) \
m_SubActors[i]->cmd(); \
}
#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; i<m_SubActors.size(); i++ )
m_SubActors[i]->SetDiffuseAlpha( f );
}
void ActorFrame::SetBaseAlpha( float f )
{
Actor::SetBaseAlpha( f );
for( unsigned i=0; i<m_SubActors.size(); i++ )
m_SubActors[i]->SetBaseAlpha( f );
}
void ActorFrame::FinishTweening()
{
Actor::FinishTweening();
// set all sub-Actors
for( unsigned i=0; i<m_SubActors.size(); i++ )
m_SubActors[i]->FinishTweening();
}
float ActorFrame::GetTweenTimeLeft() const
{
+6 -4
View File
@@ -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;