fix default.xml loading
add Condition check in LoadFromActorFile
This commit is contained in:
@@ -30,7 +30,8 @@ void ActorFrame::LoadFromNode( const CString &sDir, const XNode* pNode )
|
||||
FOREACH_CONST_Child( pChildren, pChild )
|
||||
{
|
||||
Actor* pChildActor = LoadFromActorFile( sDir, *pChild );
|
||||
AddChild( pChildActor );
|
||||
if( pChildActor )
|
||||
AddChild( pChildActor );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,7 +159,10 @@ float ActorFrame::GetTweenTimeLeft() const
|
||||
float m = Actor::GetTweenTimeLeft();
|
||||
|
||||
for( unsigned i=0; i<m_SubActors.size(); i++ )
|
||||
m = max(m, m_fHibernateSecondsLeft + m_SubActors[i]->GetTweenTimeLeft());
|
||||
{
|
||||
const Actor* pActor = m_SubActors[i];
|
||||
m = max(m, m_fHibernateSecondsLeft + pActor->GetTweenTimeLeft());
|
||||
}
|
||||
|
||||
return m;
|
||||
|
||||
@@ -230,7 +234,10 @@ void ActorFrame::PlayCommand( const CString &sCommandName )
|
||||
Actor::PlayCommand( sCommandName );
|
||||
|
||||
for( unsigned i=0; i<m_SubActors.size(); i++ )
|
||||
m_SubActors[i]->PlayCommand( sCommandName );
|
||||
{
|
||||
Actor* pActor = m_SubActors[i];
|
||||
pActor->PlayCommand( sCommandName );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -14,12 +14,23 @@
|
||||
#include "Course.h"
|
||||
#include "XmlFile.h"
|
||||
#include "FontCharAliases.h"
|
||||
#include "LuaHelpers.h"
|
||||
|
||||
#include "arch/Dialog/Dialog.h"
|
||||
|
||||
|
||||
Actor* LoadFromActorFile( const CString& sAniDir, const XNode& layer )
|
||||
{
|
||||
{
|
||||
CString expr;
|
||||
if( layer.GetAttrValue("Condition",expr) )
|
||||
{
|
||||
if( !Lua::RunExpressionB(expr) )
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Actor* pActor = NULL; // fill this in before we return
|
||||
|
||||
// Element name is the type in XML.
|
||||
@@ -46,9 +57,15 @@ Actor* LoadFromActorFile( const CString& sAniDir, const XNode& layer )
|
||||
|
||||
if( sType == "BGAnimation" )
|
||||
{
|
||||
BGAnimation *pBGA = new BGAnimation;
|
||||
pBGA->LoadFromNode( sAniDir, layer );
|
||||
pActor = pBGA;
|
||||
BGAnimation *p = new BGAnimation;
|
||||
p->LoadFromNode( sAniDir, layer );
|
||||
pActor = p;
|
||||
}
|
||||
else if( sType == "ActorFrame" )
|
||||
{
|
||||
ActorFrame *p = new ActorFrame;
|
||||
p->LoadFromNode( sAniDir, &layer );
|
||||
pActor = p;
|
||||
}
|
||||
else if( sType == "BitmapText" )
|
||||
{
|
||||
@@ -174,6 +191,7 @@ retry:
|
||||
/* XXX: We need to do a theme search, since the file we're loading might
|
||||
* be overridden by the theme. */
|
||||
CString sNewPath = sAniDir+sFile;
|
||||
CollapsePath( sNewPath );
|
||||
|
||||
// If we know this is an exact match, don't bother with the GetDirListing;
|
||||
// it's causing problems with partial matching BGAnimation directory names.
|
||||
@@ -227,13 +245,15 @@ retry:
|
||||
sNewPath = DerefRedir( sNewPath );
|
||||
|
||||
pActor = MakeActor( sNewPath );
|
||||
if( pActor == NULL )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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 );
|
||||
|
||||
ASSERT( pActor ); // we should have filled this in above
|
||||
return pActor;
|
||||
}
|
||||
|
||||
@@ -287,7 +307,9 @@ Actor* MakeActor( const RageTextureID &ID )
|
||||
/* Do this last, to avoid the IsADirectory in most cases. */
|
||||
else if( IsADirectory(ID.filename) )
|
||||
{
|
||||
const CString& sDir = ID.filename;
|
||||
CString sDir = ID.filename;
|
||||
if( sDir.Right(1) != "/" )
|
||||
sDir += '/';
|
||||
CString sIni = sDir + "BGAnimation.ini";
|
||||
CString sXml = sDir + "default.xml";
|
||||
|
||||
|
||||
@@ -495,6 +495,8 @@ void BGAnimationLayer::LoadFromNode( const CString& sAniDir_, const XNode& layer
|
||||
for( int i=0; i<iNumParticles; i++ )
|
||||
{
|
||||
Actor* pActor = MakeActor( sPath );
|
||||
if( pActor == NULL )
|
||||
continue;
|
||||
this->AddChild( pActor );
|
||||
pActor->SetXY( randomf(float(FullScreenRectF.left),float(FullScreenRectF.right)),
|
||||
randomf(float(FullScreenRectF.top),float(FullScreenRectF.bottom)) );
|
||||
|
||||
@@ -128,7 +128,10 @@ static NoteResource *MakeNoteResource( const CString &sPath, bool bSpriteOnly )
|
||||
pRes->m_pActor = pSprite;
|
||||
}
|
||||
else
|
||||
{
|
||||
pRes->m_pActor = MakeActor( sPath );
|
||||
ASSERT( pRes->m_pActor );
|
||||
}
|
||||
|
||||
g_NoteResource[sPath] = pRes;
|
||||
it = g_NoteResource.find( sPath );
|
||||
|
||||
Reference in New Issue
Block a user