Process FT_Xml as legacy actors
Everything from here on out is edge cases.
This commit is contained in:
@@ -37,6 +37,9 @@ void ActorUtil::Register( const RString& sClassName, CreateActorFn pfn )
|
||||
(*g_pmapRegistrees)[sClassName] = pfn;
|
||||
}
|
||||
|
||||
/* Resolves actor paths a la LoadActor("..."), with autowildcarding and .redir
|
||||
* files. Returns a path *within* the Rage filesystem, unlike the FILEMAN
|
||||
* function of the same name. */
|
||||
bool ActorUtil::ResolvePath( RString &sPath, const RString &sName )
|
||||
{
|
||||
CollapsePath( sPath );
|
||||
@@ -311,10 +314,28 @@ Actor* ActorUtil::MakeActor( const RString &sPath_, Actor *pParentActor )
|
||||
Actor *pRet = ActorUtil::LoadFromNode( pNode.get(), pParentActor );
|
||||
return pRet;
|
||||
}
|
||||
case FT_Xml:
|
||||
{
|
||||
// Legacy actors; only supported in quirks mode
|
||||
if ( !PREFSMAN->m_bQuirksMode )
|
||||
return new Actor;
|
||||
|
||||
XNode xml;
|
||||
if ( !XmlFileUtil::LoadFromFileShowErrors(xml, sPath) )
|
||||
return new Actor;
|
||||
XmlFileUtil::CompileXNodeTree( &xml, sPath );
|
||||
XmlFileUtil::AnnotateXNodeTree( &xml, sPath );
|
||||
return LoadFromNode( &xml, pParentActor );
|
||||
}
|
||||
case FT_Directory:
|
||||
{
|
||||
if( sPath.Right(1) != "/" )
|
||||
sPath += '/';
|
||||
|
||||
RString sXml = sPath + "default.xml";
|
||||
if (DoesFileExist(sXml))
|
||||
return MakeActor(sXml, pParentActor);
|
||||
|
||||
XNode xml;
|
||||
xml.AppendAttr( "Class", "BGAnimation" );
|
||||
xml.AppendAttr( "AniDir", sPath );
|
||||
@@ -491,6 +512,7 @@ FileType ActorUtil::GetFileType( const RString &sPath )
|
||||
sExt.MakeLower();
|
||||
|
||||
if( sExt=="lua" ) return FT_Lua;
|
||||
else if(sExt=="xml") return FT_Xml;
|
||||
else if(
|
||||
sExt=="png" ||
|
||||
sExt=="jpg" ||
|
||||
|
||||
+9
-1
@@ -335,11 +335,19 @@ bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const Backgroun
|
||||
case FT_Movie:
|
||||
sEffect = SBE_StretchNormal;
|
||||
break;
|
||||
case FT_Directory:
|
||||
case FT_Lua:
|
||||
case FT_Model:
|
||||
sEffect = SBE_UpperLeft;
|
||||
break;
|
||||
case FT_Xml:
|
||||
sEffect = SBE_Centered;
|
||||
break;
|
||||
case FT_Directory:
|
||||
if( DoesFileExist(vsResolved[0] + "/default.lua") )
|
||||
sEffect = SBE_UpperLeft;
|
||||
else
|
||||
sEffect = SBE_Centered;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ASSERT( !sEffect.empty() );
|
||||
|
||||
+7
-1
@@ -2,6 +2,7 @@
|
||||
#include "Foreground.h"
|
||||
#include "RageUtil.h"
|
||||
#include "GameState.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "RageTextureManager.h"
|
||||
#include "ActorUtil.h"
|
||||
#include "Song.h"
|
||||
@@ -34,13 +35,18 @@ void Foreground::LoadFromSong( const Song *pSong )
|
||||
{
|
||||
const BackgroundChange &change = *bgc;
|
||||
RString sBGName = change.m_def.m_sFile1,
|
||||
sLuaFile = pSong->GetSongDir() + sBGName + "/default.lua";
|
||||
sLuaFile = pSong->GetSongDir() + sBGName + "/default.lua",
|
||||
sXmlFile = pSong->GetSongDir() + sBGName + "/default.xml";
|
||||
|
||||
LoadedBGA bga;
|
||||
if ( DoesFileExist( sLuaFile ) )
|
||||
{
|
||||
bga.m_bga = ActorUtil::MakeActor( sLuaFile, this );
|
||||
}
|
||||
else if ( PREFSMAN->m_bQuirksMode && DoesFileExist( sXmlFile ) )
|
||||
{
|
||||
bga.m_bga = ActorUtil::MakeActor( sXmlFile, this );
|
||||
}
|
||||
else
|
||||
{
|
||||
bga.m_bga = ActorUtil::MakeActor( pSong->GetSongDir() + sBGName, this );
|
||||
|
||||
Reference in New Issue
Block a user