make Actor LoadFromNode signatures consistent
This commit is contained in:
@@ -63,7 +63,7 @@ Actor::Actor()
|
||||
m_bFirstUpdate = true;
|
||||
}
|
||||
|
||||
void Actor::LoadFromNode( const XNode* pNode )
|
||||
void Actor::LoadFromNode( const CString& sDir, const XNode* pNode )
|
||||
{
|
||||
// Load Name, if any.
|
||||
pNode->GetAttrValue( "Name", m_sName );
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
Actor();
|
||||
virtual ~Actor() {}
|
||||
virtual void Reset();
|
||||
void LoadFromNode( const XNode* pNode );
|
||||
void LoadFromNode( const CString& sDir, const XNode* pNode );
|
||||
|
||||
static void SetBGMTime( float fTime, float fBeat ) { g_fCurrentBGMTime = fTime; g_fCurrentBGMBeat = fBeat; }
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ ActorFrame::~ActorFrame()
|
||||
DeleteAllChildren();
|
||||
}
|
||||
|
||||
void ActorFrame::LoadFromNode( const CString &sDir, const XNode* pNode )
|
||||
void ActorFrame::LoadFromNode( const CString& sDir, const XNode* pNode )
|
||||
{
|
||||
Actor::LoadFromNode( pNode );
|
||||
Actor::LoadFromNode( sDir, pNode );
|
||||
|
||||
//
|
||||
// Load children
|
||||
@@ -29,7 +29,7 @@ void ActorFrame::LoadFromNode( const CString &sDir, const XNode* pNode )
|
||||
{
|
||||
FOREACH_CONST_Child( pChildren, pChild )
|
||||
{
|
||||
Actor* pChildActor = LoadFromActorFile( sDir, *pChild );
|
||||
Actor* pChildActor = LoadFromActorFile( sDir, pChild );
|
||||
if( pChildActor )
|
||||
AddChild( pChildActor );
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
ActorFrame();
|
||||
virtual ~ActorFrame();
|
||||
|
||||
void LoadFromNode( const CString &sDir, const XNode* pNode );
|
||||
void LoadFromNode( const CString& sDir, const XNode* pNode );
|
||||
|
||||
virtual void AddChild( Actor* pActor );
|
||||
virtual void RemoveChild( Actor* pActor );
|
||||
|
||||
+17
-15
@@ -19,11 +19,13 @@
|
||||
#include "arch/Dialog/Dialog.h"
|
||||
|
||||
|
||||
Actor* LoadFromActorFile( const CString& sAniDir, const XNode& layer )
|
||||
Actor* LoadFromActorFile( const CString& sAniDir, const XNode* pNode )
|
||||
{
|
||||
ASSERT( pNode );
|
||||
|
||||
{
|
||||
CString expr;
|
||||
if( layer.GetAttrValue("Condition",expr) )
|
||||
if( pNode->GetAttrValue("Condition",expr) )
|
||||
{
|
||||
if( !Lua::RunExpressionB(expr) )
|
||||
return NULL;
|
||||
@@ -35,15 +37,15 @@ Actor* LoadFromActorFile( const CString& sAniDir, const XNode& layer )
|
||||
|
||||
// Element name is the type in XML.
|
||||
// Type= is the name in INI.
|
||||
CString sType = layer.m_sName;
|
||||
layer.GetAttrValue( "Type", sType );
|
||||
CString sType = pNode->m_sName;
|
||||
pNode->GetAttrValue( "Type", sType );
|
||||
|
||||
CString sFile;
|
||||
layer.GetAttrValue( "File", sFile );
|
||||
pNode->GetAttrValue( "File", sFile );
|
||||
FixSlashesInPlace( sFile );
|
||||
|
||||
CString sText;
|
||||
bool bHasText = layer.GetAttrValue( "Text", sText );
|
||||
bool bHasText = pNode->GetAttrValue( "Text", sText );
|
||||
|
||||
// backward compatibility hacks
|
||||
if( bHasText )
|
||||
@@ -58,13 +60,13 @@ Actor* LoadFromActorFile( const CString& sAniDir, const XNode& layer )
|
||||
if( sType == "BGAnimation" )
|
||||
{
|
||||
BGAnimation *p = new BGAnimation;
|
||||
p->LoadFromNode( sAniDir, layer );
|
||||
p->LoadFromNode( sAniDir, pNode );
|
||||
pActor = p;
|
||||
}
|
||||
else if( sType == "ActorFrame" )
|
||||
{
|
||||
ActorFrame *p = new ActorFrame;
|
||||
p->LoadFromNode( sAniDir, &layer );
|
||||
p->LoadFromNode( sAniDir, pNode );
|
||||
pActor = p;
|
||||
}
|
||||
else if( sType == "BitmapText" )
|
||||
@@ -83,7 +85,7 @@ Actor* LoadFromActorFile( const CString& sAniDir, const XNode& layer )
|
||||
* commas or semicolons. It's useful to be able to refer to fonts in the real
|
||||
* theme font dirs, too. */
|
||||
CString sAlttext;
|
||||
layer.GetAttrValue("AltText", sAlttext );
|
||||
pNode->GetAttrValue("AltText", sAlttext );
|
||||
|
||||
ThemeManager::EvaluateString( sText );
|
||||
ThemeManager::EvaluateString( sAlttext );
|
||||
@@ -252,7 +254,7 @@ retry:
|
||||
ASSERT( pActor ); // we should have filled this in above
|
||||
|
||||
// TODO: LoadFromNode should be called when we still have a pointer to the derived type.
|
||||
pActor->LoadFromNode( &layer );
|
||||
pActor->LoadFromNode( sAniDir, pNode );
|
||||
|
||||
return pActor;
|
||||
}
|
||||
@@ -267,7 +269,7 @@ Actor* MakeActor( const RageTextureID &ID )
|
||||
XNode xml;
|
||||
xml.LoadFromFile( ID.filename );
|
||||
CString sDir = Dirname( ID.filename );
|
||||
return LoadFromActorFile( sDir, xml );
|
||||
return LoadFromActorFile( sDir, &xml );
|
||||
}
|
||||
else if( sExt=="actor" )
|
||||
{
|
||||
@@ -278,11 +280,11 @@ Actor* MakeActor( const RageTextureID &ID )
|
||||
|
||||
CString sDir = Dirname( ID.filename );
|
||||
|
||||
const XNode* pLayer = ini.GetChild( "Actor" );
|
||||
if( pLayer == NULL )
|
||||
const XNode* pNode = ini.GetChild( "Actor" );
|
||||
if( pNode == NULL )
|
||||
RageException::Throw( "The file '%s' doesn't have layer 'Actor'.", ID.filename.c_str() );
|
||||
|
||||
return LoadFromActorFile( sDir, *pLayer );
|
||||
return LoadFromActorFile( sDir, pNode );
|
||||
}
|
||||
else if( sExt=="png" ||
|
||||
sExt=="jpg" ||
|
||||
@@ -317,7 +319,7 @@ Actor* MakeActor( const RageTextureID &ID )
|
||||
{
|
||||
XNode xml;
|
||||
xml.LoadFromFile( sXml );
|
||||
return LoadFromActorFile( sDir, xml );
|
||||
return LoadFromActorFile( sDir, &xml );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ inline void UtilOffCommand( Actor* pActor, const CString &sScreenName ) { if(pAc
|
||||
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& sAniDir, const XNode& layer );
|
||||
Actor* LoadFromActorFile( const CString& sAniDir, const XNode* pNode );
|
||||
Actor* MakeActor( const RageTextureID &ID );
|
||||
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ void BGAnimation::AddLayersFromAniDir( const CString &_sAniDir, const IniFile& i
|
||||
{
|
||||
// import as a single layer
|
||||
BGAnimationLayer* pLayer = new BGAnimationLayer( bGeneric );
|
||||
pLayer->LoadFromNode( sAniDir, *pKey );
|
||||
pLayer->LoadFromNode( sAniDir, pKey );
|
||||
this->AddChild( pLayer );
|
||||
}
|
||||
}
|
||||
@@ -142,7 +142,7 @@ void BGAnimation::LoadFromAniDir( const CString &_sAniDir, bool bGeneric )
|
||||
pScrollerNode->m_attrs.clear();
|
||||
}
|
||||
|
||||
LoadFromNode( sAniDir, *pBGAnimation );
|
||||
LoadFromNode( sAniDir, pBGAnimation );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -174,12 +174,12 @@ void BGAnimation::LoadFromAniDir( const CString &_sAniDir, bool bGeneric )
|
||||
}
|
||||
}
|
||||
|
||||
void BGAnimation::LoadFromNode( const CString &sDir, const XNode& node )
|
||||
void BGAnimation::LoadFromNode( const CString& sDir, const XNode* pNode )
|
||||
{
|
||||
DEBUG_ASSERT( node.m_sName == "BGAnimation" );
|
||||
DEBUG_ASSERT( pNode->m_sName == "BGAnimation" );
|
||||
|
||||
CString sInitCommand;
|
||||
if( node.GetAttrValue( "InitCommand", sInitCommand ) )
|
||||
if( pNode->GetAttrValue( "InitCommand", sInitCommand ) )
|
||||
{
|
||||
/* There's an InitCommand. Run it now. This can be used to eg. change Z to
|
||||
* modify draw order between BGAs in a Foreground. Most things should be done
|
||||
@@ -187,7 +187,7 @@ void BGAnimation::LoadFromNode( const CString &sDir, const XNode& node )
|
||||
this->RunCommands( ParseCommands(sInitCommand) );
|
||||
}
|
||||
|
||||
ActorScroller::LoadFromNode( sDir, &node );
|
||||
ActorScroller::LoadFromNode( sDir, pNode );
|
||||
|
||||
Command cmd;
|
||||
cmd.Load( "PlayCommand,Init" );
|
||||
@@ -197,7 +197,7 @@ void BGAnimation::LoadFromNode( const CString &sDir, const XNode& node )
|
||||
/* Backwards-compatibility: if a "LengthSeconds" value is present, create a dummy
|
||||
* actor that sleeps for the given length of time. This will extend GetTweenTimeLeft. */
|
||||
float fLengthSeconds = 0;
|
||||
if( node.GetAttrValue( "LengthSeconds", fLengthSeconds ) )
|
||||
if( pNode->GetAttrValue( "LengthSeconds", fLengthSeconds ) )
|
||||
{
|
||||
Actor *pActor = new Actor;
|
||||
pActor->SetHidden( true );
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
void Unload();
|
||||
|
||||
void LoadFromAniDir( const CString &sAniDir, bool bGeneric=true );
|
||||
void LoadFromNode( const CString &sDir, const XNode& node );
|
||||
void LoadFromNode( const CString& sDir, const XNode* pNode );
|
||||
|
||||
protected:
|
||||
void AddLayersFromAniDir( const CString &_sAniDir, const IniFile& ini, bool bGeneric );
|
||||
|
||||
@@ -359,9 +359,9 @@ void BGAnimationLayer::LoadFromAniLayerFile( const CString& sPath )
|
||||
m_SubActors[i]->SetBlendMode( BLEND_ADD );
|
||||
}
|
||||
|
||||
void BGAnimationLayer::LoadFromNode( const CString& sAniDir_, const XNode& layer )
|
||||
void BGAnimationLayer::LoadFromNode( const CString& sDir, const XNode* pNode )
|
||||
{
|
||||
CString sAniDir = sAniDir_;
|
||||
CString sAniDir = sDir;
|
||||
|
||||
Init();
|
||||
if( sAniDir.Right(1) != "/" )
|
||||
@@ -374,7 +374,7 @@ void BGAnimationLayer::LoadFromNode( const CString& sAniDir_, const XNode& layer
|
||||
|
||||
{
|
||||
CString expr;
|
||||
if( layer.GetAttrValue("Cond",expr) || layer.GetAttrValue("Condition",expr) )
|
||||
if( pNode->GetAttrValue("Cond",expr) || pNode->GetAttrValue("Condition",expr) )
|
||||
{
|
||||
if( !Lua::RunExpressionB( expr ) )
|
||||
return;
|
||||
@@ -384,12 +384,12 @@ void BGAnimationLayer::LoadFromNode( const CString& sAniDir_, const XNode& layer
|
||||
bool bStretch = false;
|
||||
{
|
||||
CString type = "sprite";
|
||||
layer.GetAttrValue( "Type", type );
|
||||
pNode->GetAttrValue( "Type", type );
|
||||
type.MakeLower();
|
||||
|
||||
/* The preferred way of stretching a sprite to fit the screen is "Type=sprite"
|
||||
* and "stretch=1". "type=1" is for backwards-compatibility. */
|
||||
layer.GetAttrValue( "Stretch", bStretch );
|
||||
pNode->GetAttrValue( "Stretch", bStretch );
|
||||
|
||||
// Check for string match first, then do integer match.
|
||||
// "if(atoi(type)==0)" was matching against all string matches.
|
||||
@@ -425,51 +425,51 @@ void BGAnimationLayer::LoadFromNode( const CString& sAniDir_, const XNode& layer
|
||||
}
|
||||
}
|
||||
|
||||
layer.GetAttrValue( "FOV", m_fFOV );
|
||||
layer.GetAttrValue( "Lighting", m_bLighting );
|
||||
layer.GetAttrValue( "TexCoordVelocityX", m_fTexCoordVelocityX );
|
||||
layer.GetAttrValue( "TexCoordVelocityY", m_fTexCoordVelocityY );
|
||||
layer.GetAttrValue( "DrawCond", m_sDrawCond );
|
||||
pNode->GetAttrValue( "FOV", m_fFOV );
|
||||
pNode->GetAttrValue( "Lighting", m_bLighting );
|
||||
pNode->GetAttrValue( "TexCoordVelocityX", m_fTexCoordVelocityX );
|
||||
pNode->GetAttrValue( "TexCoordVelocityY", m_fTexCoordVelocityY );
|
||||
pNode->GetAttrValue( "DrawCond", m_sDrawCond );
|
||||
|
||||
// compat:
|
||||
layer.GetAttrValue( "StretchTexCoordVelocityX", m_fTexCoordVelocityX );
|
||||
layer.GetAttrValue( "StretchTexCoordVelocityY", m_fTexCoordVelocityY );
|
||||
pNode->GetAttrValue( "StretchTexCoordVelocityX", m_fTexCoordVelocityX );
|
||||
pNode->GetAttrValue( "StretchTexCoordVelocityY", m_fTexCoordVelocityY );
|
||||
|
||||
// particle and tile stuff
|
||||
float fZoomMin = 1;
|
||||
float fZoomMax = 1;
|
||||
layer.GetAttrValue( "ZoomMin", fZoomMin );
|
||||
layer.GetAttrValue( "ZoomMax", fZoomMax );
|
||||
pNode->GetAttrValue( "ZoomMin", fZoomMin );
|
||||
pNode->GetAttrValue( "ZoomMax", fZoomMax );
|
||||
|
||||
float fVelocityXMin = 10, fVelocityXMax = 10;
|
||||
float fVelocityYMin = 0, fVelocityYMax = 0;
|
||||
float fVelocityZMin = 0, fVelocityZMax = 0;
|
||||
float fOverrideSpeed = 0; // 0 means don't override speed
|
||||
layer.GetAttrValue( "VelocityXMin", fVelocityXMin );
|
||||
layer.GetAttrValue( "VelocityXMax", fVelocityXMax );
|
||||
layer.GetAttrValue( "VelocityYMin", fVelocityYMin );
|
||||
layer.GetAttrValue( "VelocityYMax", fVelocityYMax );
|
||||
layer.GetAttrValue( "VelocityZMin", fVelocityZMin );
|
||||
layer.GetAttrValue( "VelocityZMax", fVelocityZMax );
|
||||
layer.GetAttrValue( "OverrideSpeed", fOverrideSpeed );
|
||||
pNode->GetAttrValue( "VelocityXMin", fVelocityXMin );
|
||||
pNode->GetAttrValue( "VelocityXMax", fVelocityXMax );
|
||||
pNode->GetAttrValue( "VelocityYMin", fVelocityYMin );
|
||||
pNode->GetAttrValue( "VelocityYMax", fVelocityYMax );
|
||||
pNode->GetAttrValue( "VelocityZMin", fVelocityZMin );
|
||||
pNode->GetAttrValue( "VelocityZMax", fVelocityZMax );
|
||||
pNode->GetAttrValue( "OverrideSpeed", fOverrideSpeed );
|
||||
|
||||
int iNumParticles = 10;
|
||||
layer.GetAttrValue( "NumParticles", iNumParticles );
|
||||
pNode->GetAttrValue( "NumParticles", iNumParticles );
|
||||
|
||||
layer.GetAttrValue( "ParticlesBounce", m_bParticlesBounce );
|
||||
layer.GetAttrValue( "TilesStartX", m_fTilesStartX );
|
||||
layer.GetAttrValue( "TilesStartY", m_fTilesStartY );
|
||||
layer.GetAttrValue( "TilesSpacingX", m_fTilesSpacingX );
|
||||
layer.GetAttrValue( "TilesSpacingY", m_fTilesSpacingY );
|
||||
layer.GetAttrValue( "TileVelocityX", m_fTileVelocityX );
|
||||
layer.GetAttrValue( "TileVelocityY", m_fTileVelocityY );
|
||||
pNode->GetAttrValue( "ParticlesBounce", m_bParticlesBounce );
|
||||
pNode->GetAttrValue( "TilesStartX", m_fTilesStartX );
|
||||
pNode->GetAttrValue( "TilesStartY", m_fTilesStartY );
|
||||
pNode->GetAttrValue( "TilesSpacingX", m_fTilesSpacingX );
|
||||
pNode->GetAttrValue( "TilesSpacingY", m_fTilesSpacingY );
|
||||
pNode->GetAttrValue( "TileVelocityX", m_fTileVelocityX );
|
||||
pNode->GetAttrValue( "TileVelocityY", m_fTileVelocityY );
|
||||
|
||||
|
||||
switch( m_Type )
|
||||
{
|
||||
case TYPE_SPRITE:
|
||||
{
|
||||
Actor* pActor = LoadFromActorFile( sAniDir, layer );
|
||||
Actor* pActor = LoadFromActorFile( sAniDir, pNode );
|
||||
this->AddChild( pActor );
|
||||
if( bStretch )
|
||||
pActor->StretchTo( FullScreenRectF );
|
||||
@@ -485,7 +485,7 @@ void BGAnimationLayer::LoadFromNode( const CString& sAniDir_, const XNode& layer
|
||||
case TYPE_PARTICLES:
|
||||
{
|
||||
CString sFile;
|
||||
layer.GetAttrValue( "File", sFile );
|
||||
pNode->GetAttrValue( "File", sFile );
|
||||
FixSlashesInPlace( sFile );
|
||||
|
||||
CString sPath = sAniDir+sFile;
|
||||
@@ -516,7 +516,7 @@ void BGAnimationLayer::LoadFromNode( const CString& sAniDir_, const XNode& layer
|
||||
case TYPE_TILES:
|
||||
{
|
||||
CString sFile;
|
||||
layer.GetAttrValue( "File", sFile );
|
||||
pNode->GetAttrValue( "File", sFile );
|
||||
FixSlashesInPlace( sFile );
|
||||
|
||||
CString sPath = sAniDir+sFile;
|
||||
@@ -548,7 +548,7 @@ void BGAnimationLayer::LoadFromNode( const CString& sAniDir_, const XNode& layer
|
||||
}
|
||||
|
||||
bool bStartOnRandomFrame = false;
|
||||
layer.GetAttrValue( "StartOnRandomFrame", bStartOnRandomFrame );
|
||||
pNode->GetAttrValue( "StartOnRandomFrame", bStartOnRandomFrame );
|
||||
if( bStartOnRandomFrame )
|
||||
{
|
||||
for( unsigned i=0; i<m_SubActors.size(); i++ )
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
void Unload();
|
||||
|
||||
void LoadFromAniLayerFile( const CString& sPath );
|
||||
void LoadFromNode( const CString& sAniDir, const XNode& layer );
|
||||
void LoadFromNode( const CString& sDir, const XNode* pNode );
|
||||
|
||||
void Update( float fDeltaTime );
|
||||
void DrawPrimitives();
|
||||
|
||||
Reference in New Issue
Block a user