simplify ActorCommands
This commit is contained in:
@@ -261,7 +261,7 @@ void Actor::LoadFromNode( const RString& sDir, const XNode* pNode )
|
|||||||
else if( sKeyName == "BaseZoomZ" ) SetBaseZoomZ( StringToFloat(sValue) );
|
else if( sKeyName == "BaseZoomZ" ) SetBaseZoomZ( StringToFloat(sValue) );
|
||||||
else if( EndsWith(sKeyName,"Command") )
|
else if( EndsWith(sKeyName,"Command") )
|
||||||
{
|
{
|
||||||
apActorCommands apac( new ActorCommands( sValue ) );
|
apActorCommands apac = ActorCommands( sValue );
|
||||||
|
|
||||||
RString sCmdName = sKeyName.Left( sKeyName.size()-7 );
|
RString sCmdName = sKeyName.Left( sKeyName.size()-7 );
|
||||||
AddCommand( sCmdName, apac );
|
AddCommand( sCmdName, apac );
|
||||||
@@ -284,7 +284,7 @@ void Actor::LoadFromNode( const RString& sDir, const XNode* pNode )
|
|||||||
c->GetAttrValue( "Value", sValue );
|
c->GetAttrValue( "Value", sValue );
|
||||||
|
|
||||||
LuaHelpers::RunAtExpressionS( sName );
|
LuaHelpers::RunAtExpressionS( sName );
|
||||||
apActorCommands apac( new ActorCommands( sValue ) );
|
apActorCommands apac = ActorCommands( sValue );
|
||||||
|
|
||||||
AddCommand( sName, apac );
|
AddCommand( sName, apac );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "LuaManager.h"
|
#include "LuaManager.h"
|
||||||
|
|
||||||
ActorCommands::ActorCommands( const RString &sCommands )
|
apActorCommands ActorCommands( const RString &sCommands )
|
||||||
{
|
{
|
||||||
RString sLuaFunction;
|
RString sLuaFunction;
|
||||||
if( sCommands.size() > 0 && sCommands[0] == '\033' )
|
if( sCommands.size() > 0 && sCommands[0] == '\033' )
|
||||||
@@ -89,6 +89,8 @@ ActorCommands::ActorCommands( const RString &sCommands )
|
|||||||
|
|
||||||
Lua *L = LUA->Get();
|
Lua *L = LUA->Get();
|
||||||
|
|
||||||
|
LuaReference *pRet = new LuaReference;
|
||||||
|
|
||||||
RString sError;
|
RString sError;
|
||||||
if( !LuaHelpers::RunScript( L, sLuaFunction, "in", sError, 1 ) )
|
if( !LuaHelpers::RunScript( L, sLuaFunction, "in", sError, 1 ) )
|
||||||
{
|
{
|
||||||
@@ -96,12 +98,14 @@ ActorCommands::ActorCommands( const RString &sCommands )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* The function is now on the stack. */
|
/* The function is now on the stack. */
|
||||||
this->SetFromStack( L );
|
pRet->SetFromStack( L );
|
||||||
LUA->Release( 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,13 +7,8 @@
|
|||||||
#include "LuaReference.h"
|
#include "LuaReference.h"
|
||||||
|
|
||||||
|
|
||||||
class ActorCommands: public LuaReference
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ActorCommands( const RString &sCommands );
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef AutoPtrCopyOnWrite<LuaReference> apActorCommands;
|
typedef AutoPtrCopyOnWrite<LuaReference> apActorCommands;
|
||||||
|
apActorCommands ActorCommands( const RString &sCommands );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ void BGAnimation::LoadFromNode( const RString& sDir, const XNode* pNode )
|
|||||||
Actor *pActor = new Actor;
|
Actor *pActor = new Actor;
|
||||||
pActor->SetName( "BGAnimation dummy" );
|
pActor->SetName( "BGAnimation dummy" );
|
||||||
pActor->SetHidden( true );
|
pActor->SetHidden( true );
|
||||||
apActorCommands ap( new ActorCommands(ssprintf("sleep,%f",fLengthSeconds)) );
|
apActorCommands ap = ActorCommands( ssprintf("sleep,%f",fLengthSeconds) );
|
||||||
pActor->AddCommand( "On", ap );
|
pActor->AddCommand( "On", ap );
|
||||||
AddChild( pActor );
|
AddChild( pActor );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -187,12 +187,12 @@ void BackgroundImpl::Init()
|
|||||||
RString sCmdLeaves;
|
RString sCmdLeaves;
|
||||||
bool bSuccess = xml.GetAttrValue( "LeavesCommand", sCmdLeaves );
|
bool bSuccess = xml.GetAttrValue( "LeavesCommand", sCmdLeaves );
|
||||||
ASSERT( bSuccess );
|
ASSERT( bSuccess );
|
||||||
bgt.cmdLeaves = apActorCommands( new ActorCommands(sCmdLeaves) );
|
bgt.cmdLeaves = ActorCommands( sCmdLeaves );
|
||||||
|
|
||||||
RString sCmdRoot;
|
RString sCmdRoot;
|
||||||
bSuccess = xml.GetAttrValue( "RootCommand", sCmdRoot );
|
bSuccess = xml.GetAttrValue( "RootCommand", sCmdRoot );
|
||||||
ASSERT( bSuccess );
|
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 look something like "BGAnimation, BGAnimationLayer, Sprite" or it
|
||||||
* may be deeper, like "BGAnimation, BGAnimationLayer, BGAnimation,
|
* may be deeper, like "BGAnimation, BGAnimationLayer, BGAnimation,
|
||||||
* BGAnimationLayer, Sprite". */
|
* BGAnimationLayer, Sprite". */
|
||||||
ActorCommands acmds( "effectclock,music" );
|
pBGA->RunCommands( ActorCommands("effectclock,music") );
|
||||||
pBGA->RunCommands( acmds );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ bool NoteSkinManager::GetMetricB( const RString &sButtonName, const RString &sVa
|
|||||||
|
|
||||||
apActorCommands NoteSkinManager::GetMetricA( const RString &sButtonName, const RString &sValueName )
|
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 )
|
RString NoteSkinManager::GetPath( const RString &sButtonName, const RString &sElement )
|
||||||
|
|||||||
@@ -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.
|
// 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].Load( THEME->GetPathG("ScoreDisplayBattle","icon "+sNewModifier) );
|
||||||
m_ItemIcon[s].StopTweening();
|
m_ItemIcon[s].StopTweening();
|
||||||
ActorCommands acmds(
|
apActorCommands acmds = ActorCommands(
|
||||||
"diffuse,1,1,1,1;zoom,1;"
|
"diffuse,1,1,1,1;zoom,1;"
|
||||||
"sleep,0.1;linear,0;diffusealpha,0;"
|
"sleep,0.1;linear,0;diffusealpha,0;"
|
||||||
"sleep,0.1;linear,0;diffusealpha,1;"
|
"sleep,0.1;linear,0;diffusealpha,1;"
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ void ScreenEnding::Init()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SET_XY_AND_ON_COMMAND( m_sprRemoveMemoryCard[p] );
|
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] );
|
this->AddChild( &m_sprRemoveMemoryCard[p] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -410,10 +410,10 @@ void ScreenEz2SelectMusic::MenuBack( const InputEventPlus &input )
|
|||||||
|
|
||||||
void ScreenEz2SelectMusic::TweenOffScreen()
|
void ScreenEz2SelectMusic::TweenOffScreen()
|
||||||
{
|
{
|
||||||
ActorCommands cmds( "linear,0.5;zoomy,0" );
|
apActorCommands cmds = ActorCommands( "linear,0.5;zoomy,0" );
|
||||||
m_MusicBannerWheel.RunCommands( cmds );
|
m_MusicBannerWheel.RunCommands( cmds );
|
||||||
|
|
||||||
ActorCommands cmds2( "Linear,1;DiffuseAlpha,0" );
|
apActorCommands cmds2 = ActorCommands( "Linear,1;DiffuseAlpha,0" );
|
||||||
m_PumpDifficultyCircle.RunCommands( cmds2 );
|
m_PumpDifficultyCircle.RunCommands( cmds2 );
|
||||||
m_Guide.RunCommands( cmds2 );
|
m_Guide.RunCommands( cmds2 );
|
||||||
m_PumpDifficultyRating.RunCommands( cmds2 );
|
m_PumpDifficultyRating.RunCommands( cmds2 );
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ void HighScoreWheelItem::LoadBlank( int iRankIndex )
|
|||||||
|
|
||||||
void HighScoreWheelItem::ShowFocus()
|
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_textRank.RunCommands( c );
|
||||||
m_textName.RunCommands( c );
|
m_textName.RunCommands( c );
|
||||||
m_textScore.RunCommands( c );
|
m_textScore.RunCommands( c );
|
||||||
|
|||||||
@@ -945,7 +945,7 @@ RageColor ThemeManager::GetMetricC( const RString &sClassName, const RString &sV
|
|||||||
apActorCommands ThemeManager::GetMetricA( const RString &sClassName, const RString &sValueName )
|
apActorCommands ThemeManager::GetMetricA( const RString &sClassName, const RString &sValueName )
|
||||||
{
|
{
|
||||||
RString sValue = GetMetricRaw( g_pLoadedThemeData->iniMetrics, sClassName, sValueName );
|
RString sValue = GetMetricRaw( g_pLoadedThemeData->iniMetrics, sClassName, sValueName );
|
||||||
return apActorCommands( new ActorCommands( sValue ) );
|
return ActorCommands( sValue );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user