sClassName -> sScreenName

load commands from .actor files
This commit is contained in:
Chris Danford
2005-01-04 10:42:59 +00:00
parent a3b49485b5
commit 78db0513dc
2 changed files with 42 additions and 17 deletions
+30 -5
View File
@@ -240,6 +240,31 @@ retry:
if( layer.GetValue( "BaseZoomY", f ) ) pActor->SetBaseZoomY( f );
if( layer.GetValue( "BaseZoomZ", f ) ) pActor->SetBaseZoomZ( f );
//
// Load commands
//
for( IniKey::const_iterator i = layer.begin();
i != layer.end(); ++i)
{
CString KeyName = i->first; /* "OnCommand" */
KeyName.MakeLower();
if( KeyName.Right(7) != "command" )
continue; /* not a command */
const CString &sCommands = i->second;
Commands cmds = ParseCommands( sCommands );
CString sCmdName;
/* Special case: "Command=foo" -> "OnCommand=foo" */
if( KeyName.size() == 7 )
sCmdName="on";
else
sCmdName = KeyName.Left( KeyName.size()-7 );
pActor->AddCommands( sCmdName, cmds );
}
ASSERT( pActor ); // we should have filled this in above
return pActor;
}
@@ -287,13 +312,13 @@ Actor* MakeActor( const RageTextureID &ID )
}
}
void UtilSetXY( Actor& actor, const CString &sClassName )
void UtilSetXY( Actor& actor, const CString &sScreenName )
{
ASSERT( !actor.GetID().empty() );
actor.SetXY( THEME->GetMetricF(sClassName,actor.GetID()+"X"), THEME->GetMetricF(sClassName,actor.GetID()+"Y") );
actor.SetXY( THEME->GetMetricF(sScreenName,actor.GetID()+"X"), THEME->GetMetricF(sScreenName,actor.GetID()+"Y") );
}
void UtilCommand( Actor& actor, const CString &sClassName, const CString &sCommandName )
void UtilCommand( Actor& actor, const CString &sScreenName, const CString &sCommandName )
{
// If Actor is hidden, it won't get updated or drawn, so don't bother tweening.
/* ... but we might be unhiding it, or setting state for when we unhide it later */
@@ -316,10 +341,10 @@ void UtilCommand( Actor& actor, const CString &sClassName, const CString &sComma
else
{
ASSERT_M( !actor.GetID().empty(), ssprintf("!actor.GetID().empty() ('%s', '%s')",
sClassName.c_str(), sCommandName.c_str()) );
sScreenName.c_str(), sCommandName.c_str()) );
}
actor.RunCommands( THEME->GetMetricA(sClassName,actor.GetID()+sCommandName+"Command") );
actor.RunCommands( THEME->GetMetricA(sScreenName,actor.GetID()+sCommandName+"Command") );
}
void AutoActor::Load( const CString &sPath )
+12 -12
View File
@@ -12,25 +12,25 @@ class IniKey;
#define SET_XY_AND_ON_COMMAND( actor ) UtilSetXYAndOnCommand( actor, m_sName )
#define COMMAND( actor, command_name ) UtilCommand( actor, m_sName, command_name )
void UtilSetXY( Actor& actor, const CString &sClassName );
inline void UtilSetXY( Actor* pActor, const CString &sClassName ) { UtilSetXY( *pActor, sClassName ); }
void UtilSetXY( Actor& actor, const CString &sScreenName );
inline void UtilSetXY( Actor* pActor, const CString &sScreenName ) { UtilSetXY( *pActor, sScreenName ); }
void UtilCommand( Actor& actor, const CString &sClassName, const CString &sCommandName );
void UtilCommand( Actor& actor, const CString &sScreenName, const CString &sCommandName );
inline void UtilOnCommand( Actor& actor, const CString &sClassName ) { UtilCommand( actor, sClassName, "On" ); }
inline void UtilOffCommand( Actor& actor, const CString &sClassName ) { UtilCommand( actor, sClassName, "Off" ); }
inline void UtilSetXYAndOnCommand( Actor& actor, const CString &sClassName )
inline void UtilOnCommand( Actor& actor, const CString &sScreenName ) { UtilCommand( actor, sScreenName, "On" ); }
inline void UtilOffCommand( Actor& actor, const CString &sScreenName ) { UtilCommand( actor, sScreenName, "Off" ); }
inline void UtilSetXYAndOnCommand( Actor& actor, const CString &sScreenName )
{
UtilSetXY( actor, sClassName );
UtilOnCommand( actor, sClassName );
UtilSetXY( actor, sScreenName );
UtilOnCommand( actor, sScreenName );
}
/* convenience */
inline void UtilCommand( Actor* pActor, const CString &sClassName, const CString &sCommandName ) { if(pActor) UtilCommand( *pActor, sClassName, sCommandName ); }
inline void UtilOnCommand( Actor* pActor, const CString &sClassName ) { if(pActor) UtilOnCommand( *pActor, sClassName ); }
inline void UtilOffCommand( Actor* pActor, const CString &sClassName ) { if(pActor) UtilOffCommand( *pActor, sClassName ); }
inline void UtilSetXYAndOnCommand( Actor* pActor, const CString &sClassName ) { if(pActor) UtilSetXYAndOnCommand( *pActor, sClassName ); }
inline void UtilCommand( Actor* pActor, const CString &sScreenName, const CString &sCommandName ) { if(pActor) UtilCommand( *pActor, sScreenName, sCommandName ); }
inline void UtilOnCommand( Actor* pActor, const CString &sScreenName ) { if(pActor) UtilOnCommand( *pActor, sScreenName ); }
inline void UtilOffCommand( Actor* pActor, const CString &sScreenName ) { if(pActor) UtilOffCommand( *pActor, sScreenName ); }
inline void UtilSetXYAndOnCommand( Actor* pActor, const CString &sScreenName ) { if(pActor) UtilSetXYAndOnCommand( *pActor, sScreenName ); }
// Return a Sprite, BitmapText, or Model depending on the file type
Actor* LoadFromActorFile( const CString &sIniPath, const CString &sLayer = "Actor" );