fix PlayCommand doesn't propogate

This commit is contained in:
Chris Danford
2004-02-01 04:41:48 +00:00
parent dc0201d576
commit dd78eb858f
4 changed files with 23 additions and 36 deletions
+7 -5
View File
@@ -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() );
+10 -10
View File
@@ -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; i<m_SubActors.size(); i++ )
m_SubActors[i]->SetDiffuseAlpha( 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; i<m_SubActors.size(); i++ )
m_SubActors[i]->HandleCommand( command );
return; // handled
}
// base class handles the rest...
Actor::HandleCommand( command );
}
+5 -17
View File
@@ -651,13 +651,6 @@ void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer )
PlayCommand( "On" );
}
void BGAnimationLayer::FinishTweening()
{
for( unsigned i=0; i<m_SubActors.size(); i++ )
m_SubActors[i]->FinishTweening();
}
void BGAnimationLayer::Update( float fDeltaTime )
{
fDeltaTime *= m_fUpdateRate;
@@ -964,12 +957,6 @@ void BGAnimationLayer::DrawPrimitives()
}
}
void BGAnimationLayer::SetDiffuse( RageColor c )
{
for(unsigned i=0; i<m_SubActors.size(); i++)
m_SubActors[i]->SetDiffuse(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; i<m_SubActors.size(); i++ )
m_SubActors[i]->Command( ssprintf("playcommand,%s", cmd.c_str()) );
m_SubActors[i]->Command( ssprintf("playcommand,%s", sCommandName.c_str()) );
cmd.MakeLower();
map<CString, CString>::const_iterator it = m_asCommands.find( cmd );
CString sKey = sCommandName;
sKey.MakeLower();
map<CString, CString>::const_iterator it = m_asCommands.find( sKey );
if( it == m_asCommands.end() )
return;
+1 -4
View File
@@ -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: