From c20c41e7fc74b21a4fdce19cb07561c17defe058 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sat, 6 Aug 2005 05:33:01 +0000 Subject: [PATCH] load commands from elements (for using Lua to generate the command name) --- stepmania/src/Actor.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index ad4fe39564..645cb6c452 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -192,7 +192,7 @@ void Actor::LoadFromNode( const CString& sDir, const XNode* pNode ) // - // Load commands + // Load command attributes // FOREACH_CONST_Attr( pNode, a ) { @@ -214,6 +214,28 @@ void Actor::LoadFromNode( const CString& sDir, const XNode* pNode ) AddCommand( sCmdName, apac ); } + // + // Load command elements + // + FOREACH_CONST_Child( pNode, c ) + { + CString sKeyName = c->m_sName; /* "OnCommand" */ + + if( sKeyName != "Command" ) + continue; /* not a command */ + + CString sName; + c->GetAttrValue( "Name", sName ); + CString sValue; + c->GetAttrValue( "Value", sValue ); + + THEME->EvaluateString( sName ); + THEME->EvaluateString( sValue ); + apActorCommands apac( new ActorCommands( sValue ) ); + + AddCommand( sName, apac ); + } + /* There's an InitCommand. Run it now. This can be used to eg. change Z to * modify draw order between BGAs in a Foreground. */ PlayCommand( "Init" );