mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-21 02:39:17 +00:00
Added support for loading dependencies of EVNT and STRG
This commit is contained in:
@@ -41,6 +41,33 @@ public:
|
||||
|
||||
return TWideString();
|
||||
}
|
||||
|
||||
CDependencyTree* BuildDependencyTree() const
|
||||
{
|
||||
// The only dependencies STRGs have is they can reference FONTs with the &font=; formatting tag
|
||||
CDependencyTree *pTree = new CDependencyTree(ID());
|
||||
EIDLength IDLength = (Game() <= eEchoes ? e32Bit : e64Bit);
|
||||
|
||||
for (u32 iLang = 0; iLang < mLangTables.size(); iLang++)
|
||||
{
|
||||
const SLangTable& rkTable = mLangTables[iLang];
|
||||
|
||||
for (u32 iStr = 0; iStr < rkTable.Strings.size(); iStr++)
|
||||
{
|
||||
static const TWideString skTag = L"&font=";
|
||||
const TWideString& rkStr = rkTable.Strings[iStr];
|
||||
|
||||
for (u32 FontIdx = rkStr.IndexOfPhrase(*skTag); FontIdx != -1; FontIdx = rkStr.IndexOfPhrase(*skTag, FontIdx + 1))
|
||||
{
|
||||
u32 IDStart = FontIdx + skTag.Size();
|
||||
TWideString StrFontID = rkStr.SubString(IDStart, IDLength * 2);
|
||||
pTree->AddDependency( CAssetID::FromString(StrFontID) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pTree;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CSTRINGTABLE_H
|
||||
|
||||
@@ -12,6 +12,50 @@ CDependencyGroup* CUnsupportedFormatLoader::LoadCSNG(IInputStream& rCSNG, CResou
|
||||
return pGroup;
|
||||
}
|
||||
|
||||
CDependencyGroup* CUnsupportedFormatLoader::LoadEVNT(IInputStream& rEVNT, CResourceEntry *pEntry)
|
||||
{
|
||||
u32 Version = rEVNT.ReadLong();
|
||||
ASSERT(Version == 1 || Version == 2);
|
||||
|
||||
CDependencyGroup *pGroup = new CDependencyGroup(pEntry);
|
||||
|
||||
// Loop Events
|
||||
u32 NumLoopEvents = rEVNT.ReadLong();
|
||||
|
||||
for (u32 iLoop = 0; iLoop < NumLoopEvents; iLoop++)
|
||||
{
|
||||
rEVNT.Seek(0x2, SEEK_CUR);
|
||||
rEVNT.ReadString();
|
||||
rEVNT.Seek(0x1C, SEEK_CUR);
|
||||
}
|
||||
|
||||
// User Events
|
||||
u32 NumUserEvents = rEVNT.ReadLong();
|
||||
|
||||
for (u32 iUser = 0; iUser < NumUserEvents; iUser++)
|
||||
{
|
||||
rEVNT.Seek(0x2, SEEK_CUR);
|
||||
rEVNT.ReadString();
|
||||
rEVNT.Seek(0x1F, SEEK_CUR);
|
||||
rEVNT.ReadString();
|
||||
}
|
||||
|
||||
// Effect Events
|
||||
u32 NumEffectEvents = rEVNT.ReadLong();
|
||||
|
||||
for (u32 iFX = 0; iFX < NumEffectEvents; iFX++)
|
||||
{
|
||||
rEVNT.Seek(0x2, SEEK_CUR);
|
||||
rEVNT.ReadString();
|
||||
rEVNT.Seek(0x23, SEEK_CUR);
|
||||
pGroup->AddDependency(rEVNT.ReadLong());
|
||||
rEVNT.ReadString();
|
||||
rEVNT.Seek(0x8, SEEK_CUR);
|
||||
}
|
||||
|
||||
return pGroup;
|
||||
}
|
||||
|
||||
CDependencyGroup* CUnsupportedFormatLoader::LoadHINT(IInputStream& rHINT, CResourceEntry *pEntry)
|
||||
{
|
||||
u32 Magic = rHINT.ReadLong();
|
||||
|
||||
@@ -12,6 +12,7 @@ class CUnsupportedFormatLoader
|
||||
|
||||
public:
|
||||
static CDependencyGroup* LoadCSNG(IInputStream& rCSNG, CResourceEntry *pEntry);
|
||||
static CDependencyGroup* LoadEVNT(IInputStream& rEVNT, CResourceEntry *pEntry);
|
||||
static CDependencyGroup* LoadHINT(IInputStream& rHINT, CResourceEntry *pEntry);
|
||||
static CDependencyGroup* LoadMAPW(IInputStream& rMAPW, CResourceEntry *pEntry);
|
||||
static CDependencyGroup* LoadMAPU(IInputStream& rMAPU, CResourceEntry *pEntry);
|
||||
|
||||
Reference in New Issue
Block a user