Added support for gathering dependencies of ANCS and FRME; changed CDependencyGroup to use a vector instead of a set

This commit is contained in:
parax0
2016-08-03 13:01:48 -06:00
parent 11a7b86120
commit 3bca8410b0
8 changed files with 262 additions and 42 deletions

View File

@@ -154,6 +154,31 @@ void CAnimSetDependencyTree::Write(IOutputStream& rFile, EIDLength IDLength) con
rFile.WriteLong( mCharacterOffsets[iChar] );
}
void CAnimSetDependencyTree::AddCharacter(const SSetCharacter *pkChar)
{
mCharacterOffsets.push_back( NumDependencies() );
if (!pkChar) return;
AddDependency(pkChar->pModel);
AddDependency(pkChar->pSkeleton);
AddDependency(pkChar->pSkin);
const std::vector<CAssetID> *pkParticleVectors[5] = {
&pkChar->GenericParticles, &pkChar->ElectricParticles,
&pkChar->SwooshParticles, &pkChar->SpawnParticles,
&pkChar->EffectParticles
};
for (u32 iVec = 0; iVec < 5; iVec++)
{
for (u32 iPart = 0; iPart < pkParticleVectors[iVec]->size(); iPart++)
AddDependency(pkParticleVectors[iVec]->at(iPart));
}
AddDependency(pkChar->IceModel);
AddDependency(pkChar->IceSkin);
}
// ************ CScriptInstanceDependencyTree ************
CScriptInstanceDependencyTree::~CScriptInstanceDependencyTree()
{

View File

@@ -10,6 +10,7 @@ class CScriptLayer;
class CScriptObject;
class CPropertyStruct;
class TCharacterProperty;
struct SSetCharacter;
// Group of node classes forming a tree of cached resource dependencies.
enum EDependencyNodeType
@@ -109,6 +110,8 @@ public:
virtual EDependencyNodeType Type() const;
virtual void Read(IInputStream& rFile, EIDLength IDLength);
virtual void Write(IOutputStream& rFile, EIDLength IDLength) const;
void AddCharacter(const SSetCharacter *pkChar);
};
// Node representing a script object. Indicates the type of object.

View File

@@ -116,9 +116,12 @@ bool CResourceEntry::SaveCacheData()
u32 DepsStart = File.Tell();
if (mpDependencies) mpDependencies->Write(File, Game() <= eEchoes ? e32Bit : e64Bit);
u32 DepsSize = File.Tell() - DepsStart;
u32 DepsEnd = File.Tell();
u32 DepsSize = DepsEnd- DepsStart;
File.Seek(DepsSizeOffset, SEEK_SET);
File.WriteLong(DepsSize);
File.Seek(DepsEnd, SEEK_SET);
// Thumbnail
File.WriteLong(0); // Reserved Space (Thumbnail Size)
@@ -262,6 +265,7 @@ CResource* CResourceEntry::Load(IInputStream& rInput)
case eDependencyGroup: mpResource = CDependencyGroupLoader::LoadDGRP(rInput, this); break;
case eDynamicCollision: mpResource = CCollisionLoader::LoadDCLN(rInput, this); break;
case eFont: mpResource = CFontLoader::LoadFONT(rInput, this); break;
case eGuiFrame: mpResource = CUnsupportedFormatLoader::LoadFRME(rInput, this); break;
case eHintSystem: mpResource = CUnsupportedFormatLoader::LoadHINT(rInput, this); break;
case eMapWorld: mpResource = CUnsupportedFormatLoader::LoadMAPW(rInput, this); break;
case eMapUniverse: mpResource = CUnsupportedFormatLoader::LoadMAPU(rInput, this); break;