From 164d272b4c60ab0c99e54e148d3060e013cf9389 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Fri, 1 Apr 2005 23:45:59 +0000 Subject: [PATCH] load .ini files as BGAnims --- stepmania/src/ActorUtil.cpp | 8 ++++++++ stepmania/src/BGAnimation.cpp | 16 +++++++++++++--- stepmania/src/BGAnimation.h | 1 + 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/stepmania/src/ActorUtil.cpp b/stepmania/src/ActorUtil.cpp index d52c433023..78db1e6730 100644 --- a/stepmania/src/ActorUtil.cpp +++ b/stepmania/src/ActorUtil.cpp @@ -270,6 +270,14 @@ Actor* ActorUtil::MakeActor( const RageTextureID &ID ) CString sDir = Dirname( ID.filename ); 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" ) { // TODO: Check for recursive loading diff --git a/stepmania/src/BGAnimation.cpp b/stepmania/src/BGAnimation.cpp index 56141c1317..7c0ed780d2 100644 --- a/stepmania/src/BGAnimation.cpp +++ b/stepmania/src/BGAnimation.cpp @@ -106,8 +106,6 @@ void BGAnimation::AddLayersFromAniDir( const CString &_sAniDir, const IniFile& i void BGAnimation::LoadFromAniDir( const CString &_sAniDir, bool bGeneric ) { - Unload(); - if( _sAniDir.empty() ) return; @@ -115,9 +113,21 @@ void BGAnimation::LoadFromAniDir( const CString &_sAniDir, bool bGeneric ) if( sAniDir.Right(1) != "/" ) 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" ); - CString sPathToIni = sAniDir + "BGAnimation.ini"; if( DoesFileExist(sPathToIni) ) { diff --git a/stepmania/src/BGAnimation.h b/stepmania/src/BGAnimation.h index 6b1a4891d6..9d08101120 100644 --- a/stepmania/src/BGAnimation.h +++ b/stepmania/src/BGAnimation.h @@ -19,6 +19,7 @@ public: void Unload(); 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 ); protected: