load .ini files as BGAnims

This commit is contained in:
Chris Danford
2005-04-01 23:45:59 +00:00
parent 411f376e75
commit 164d272b4c
3 changed files with 22 additions and 3 deletions
+8
View File
@@ -270,6 +270,14 @@ Actor* ActorUtil::MakeActor( const RageTextureID &ID )
CString sDir = Dirname( ID.filename ); CString sDir = Dirname( ID.filename );
return LoadFromActorFile( sDir, &xml ); return LoadFromActorFile( sDir, &xml );
} }
else if( sExt=="ini" )
{
IniFile ini;
BGAnimation *pBGA = new BGAnimation;
CString sDir = Dirname( ID.filename );
pBGA->LoadFromIni( sDir, ID.filename );
return pBGA;
}
else if( sExt=="actor" ) else if( sExt=="actor" )
{ {
// TODO: Check for recursive loading // TODO: Check for recursive loading
+13 -3
View File
@@ -106,8 +106,6 @@ void BGAnimation::AddLayersFromAniDir( const CString &_sAniDir, const IniFile& i
void BGAnimation::LoadFromAniDir( const CString &_sAniDir, bool bGeneric ) void BGAnimation::LoadFromAniDir( const CString &_sAniDir, bool bGeneric )
{ {
Unload();
if( _sAniDir.empty() ) if( _sAniDir.empty() )
return; return;
@@ -115,9 +113,21 @@ void BGAnimation::LoadFromAniDir( const CString &_sAniDir, bool bGeneric )
if( sAniDir.Right(1) != "/" ) if( sAniDir.Right(1) != "/" )
sAniDir += "/"; sAniDir += "/";
CString sPathToIni = sAniDir + "BGAnimation.ini";
LoadFromIni( sAniDir, sPathToIni, bGeneric );
}
void BGAnimation::LoadFromIni( const CString &_sDir, const CString &sPathToIni, bool bGeneric )
{
Unload();
CString sAniDir = _sDir;
if( sAniDir.Right(1) != "/" )
sAniDir += "/";
ASSERT_M( IsADirectory(sAniDir), sAniDir + " isn't a directory" ); ASSERT_M( IsADirectory(sAniDir), sAniDir + " isn't a directory" );
CString sPathToIni = sAniDir + "BGAnimation.ini";
if( DoesFileExist(sPathToIni) ) if( DoesFileExist(sPathToIni) )
{ {
+1
View File
@@ -19,6 +19,7 @@ public:
void Unload(); void Unload();
void LoadFromAniDir( const CString &sAniDir, bool bGeneric=true ); void LoadFromAniDir( const CString &sAniDir, bool bGeneric=true );
void LoadFromIni( const CString &sDir, const CString &sPathToIni, bool bGeneric=true );
void LoadFromNode( const CString& sDir, const XNode* pNode ); void LoadFromNode( const CString& sDir, const XNode* pNode );
protected: protected: