simplify ActorCommands

This commit is contained in:
Glenn Maynard
2006-09-21 01:39:38 +00:00
parent 6fe7bf2683
commit 8548f1cb33
11 changed files with 22 additions and 24 deletions
+2 -2
View File
@@ -261,7 +261,7 @@ void Actor::LoadFromNode( const RString& sDir, const XNode* pNode )
else if( sKeyName == "BaseZoomZ" ) SetBaseZoomZ( StringToFloat(sValue) );
else if( EndsWith(sKeyName,"Command") )
{
apActorCommands apac( new ActorCommands( sValue ) );
apActorCommands apac = ActorCommands( sValue );
RString sCmdName = sKeyName.Left( sKeyName.size()-7 );
AddCommand( sCmdName, apac );
@@ -284,7 +284,7 @@ void Actor::LoadFromNode( const RString& sDir, const XNode* pNode )
c->GetAttrValue( "Value", sValue );
LuaHelpers::RunAtExpressionS( sName );
apActorCommands apac( new ActorCommands( sValue ) );
apActorCommands apac = ActorCommands( sValue );
AddCommand( sName, apac );
}
+8 -4
View File
@@ -7,7 +7,7 @@
#include <sstream>
#include "LuaManager.h"
ActorCommands::ActorCommands( const RString &sCommands )
apActorCommands ActorCommands( const RString &sCommands )
{
RString sLuaFunction;
if( sCommands.size() > 0 && sCommands[0] == '\033' )
@@ -89,6 +89,8 @@ ActorCommands::ActorCommands( const RString &sCommands )
Lua *L = LUA->Get();
LuaReference *pRet = new LuaReference;
RString sError;
if( !LuaHelpers::RunScript( L, sLuaFunction, "in", sError, 1 ) )
{
@@ -96,12 +98,14 @@ ActorCommands::ActorCommands( const RString &sCommands )
}
/* The function is now on the stack. */
this->SetFromStack( L );
pRet->SetFromStack( L );
LUA->Release( L );
ASSERT_M( !this->IsNil(), sLuaFunction.c_str() );
ASSERT_M( !pRet->IsNil(), sLuaFunction.c_str() );
SetName( sLuaFunction );
pRet->SetName( sLuaFunction );
return apActorCommands( pRet );
}
+1 -6
View File
@@ -7,13 +7,8 @@
#include "LuaReference.h"
class ActorCommands: public LuaReference
{
public:
ActorCommands( const RString &sCommands );
};
typedef AutoPtrCopyOnWrite<LuaReference> apActorCommands;
apActorCommands ActorCommands( const RString &sCommands );
#endif
+1 -1
View File
@@ -158,7 +158,7 @@ void BGAnimation::LoadFromNode( const RString& sDir, const XNode* pNode )
Actor *pActor = new Actor;
pActor->SetName( "BGAnimation dummy" );
pActor->SetHidden( true );
apActorCommands ap( new ActorCommands(ssprintf("sleep,%f",fLengthSeconds)) );
apActorCommands ap = ActorCommands( ssprintf("sleep,%f",fLengthSeconds) );
pActor->AddCommand( "On", ap );
AddChild( pActor );
}
+3 -4
View File
@@ -187,12 +187,12 @@ void BackgroundImpl::Init()
RString sCmdLeaves;
bool bSuccess = xml.GetAttrValue( "LeavesCommand", sCmdLeaves );
ASSERT( bSuccess );
bgt.cmdLeaves = apActorCommands( new ActorCommands(sCmdLeaves) );
bgt.cmdLeaves = ActorCommands( sCmdLeaves );
RString sCmdRoot;
bSuccess = xml.GetAttrValue( "RootCommand", sCmdRoot );
ASSERT( bSuccess );
bgt.cmdRoot = apActorCommands( new ActorCommands(sCmdRoot) );
bgt.cmdRoot = ActorCommands( sCmdRoot );
}
}
@@ -715,8 +715,7 @@ void BackgroundImpl::LoadFromSong( const Song* pSong )
* may look something like "BGAnimation, BGAnimationLayer, Sprite" or it
* may be deeper, like "BGAnimation, BGAnimationLayer, BGAnimation,
* BGAnimationLayer, Sprite". */
ActorCommands acmds( "effectclock,music" );
pBGA->RunCommands( acmds );
pBGA->RunCommands( ActorCommands("effectclock,music") );
}
}
+1 -1
View File
@@ -194,7 +194,7 @@ bool NoteSkinManager::GetMetricB( const RString &sButtonName, const RString &sVa
apActorCommands NoteSkinManager::GetMetricA( const RString &sButtonName, const RString &sValueName )
{
return apActorCommands( new ActorCommands( GetMetric(sButtonName,sValueName) ) );
return ActorCommands( GetMetric(sButtonName,sValueName) );
}
RString NoteSkinManager::GetPath( const RString &sButtonName, const RString &sElement )
+1 -1
View File
@@ -57,7 +57,7 @@ void ScoreDisplayBattle::Update( float fDelta )
// TODO: Cache all of the icon graphics so we don't load them dynamically from disk.
m_ItemIcon[s].Load( THEME->GetPathG("ScoreDisplayBattle","icon "+sNewModifier) );
m_ItemIcon[s].StopTweening();
ActorCommands acmds(
apActorCommands acmds = ActorCommands(
"diffuse,1,1,1,1;zoom,1;"
"sleep,0.1;linear,0;diffusealpha,0;"
"sleep,0.1;linear,0;diffusealpha,1;"
+1 -1
View File
@@ -103,7 +103,7 @@ void ScreenEnding::Init()
break;
}
SET_XY_AND_ON_COMMAND( m_sprRemoveMemoryCard[p] );
m_sprRemoveMemoryCard[p].AddCommand( ssprintf("CardRemovedP%dMessage",p+1), apActorCommands(new ActorCommands("hidden,1")) );
m_sprRemoveMemoryCard[p].AddCommand( ssprintf("CardRemovedP%dMessage",p+1), ActorCommands("hidden,1") );
this->AddChild( &m_sprRemoveMemoryCard[p] );
}
+2 -2
View File
@@ -410,10 +410,10 @@ void ScreenEz2SelectMusic::MenuBack( const InputEventPlus &input )
void ScreenEz2SelectMusic::TweenOffScreen()
{
ActorCommands cmds( "linear,0.5;zoomy,0" );
apActorCommands cmds = ActorCommands( "linear,0.5;zoomy,0" );
m_MusicBannerWheel.RunCommands( cmds );
ActorCommands cmds2( "Linear,1;DiffuseAlpha,0" );
apActorCommands cmds2 = ActorCommands( "Linear,1;DiffuseAlpha,0" );
m_PumpDifficultyCircle.RunCommands( cmds2 );
m_Guide.RunCommands( cmds2 );
m_PumpDifficultyRating.RunCommands( cmds2 );
+1 -1
View File
@@ -82,7 +82,7 @@ void HighScoreWheelItem::LoadBlank( int iRankIndex )
void HighScoreWheelItem::ShowFocus()
{
ActorCommands c( "diffuseshift;EffectColor1,1,1,0,1;EffectColor2,0,1,1,1" );
apActorCommands c = ActorCommands( "diffuseshift;EffectColor1,1,1,0,1;EffectColor2,0,1,1,1" );
m_textRank.RunCommands( c );
m_textName.RunCommands( c );
m_textScore.RunCommands( c );
+1 -1
View File
@@ -945,7 +945,7 @@ RageColor ThemeManager::GetMetricC( const RString &sClassName, const RString &sV
apActorCommands ThemeManager::GetMetricA( const RString &sClassName, const RString &sValueName )
{
RString sValue = GetMetricRaw( g_pLoadedThemeData->iniMetrics, sClassName, sValueName );
return apActorCommands( new ActorCommands( sValue ) );
return ActorCommands( sValue );
}
#endif