mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-16 08:27:01 +00:00
Added support for tracking extra dependencies in Corruption areas (necessary to avoid crashes)
This commit is contained in:
@@ -314,10 +314,11 @@ void CAreaDependencyTree::Serialize(IArchive& rArc)
|
||||
rArc << SERIAL_CONTAINER("LayerOffsets", mLayerOffsets, "Offset");
|
||||
}
|
||||
|
||||
void CAreaDependencyTree::AddScriptLayer(CScriptLayer *pLayer)
|
||||
void CAreaDependencyTree::AddScriptLayer(CScriptLayer *pLayer, const std::vector<CAssetID>& rkExtraDeps)
|
||||
{
|
||||
if (!pLayer) return;
|
||||
mLayerOffsets.push_back(mChildren.size());
|
||||
std::set<CAssetID> UsedIDs;
|
||||
|
||||
for (u32 iInst = 0; iInst < pLayer->NumInstances(); iInst++)
|
||||
{
|
||||
@@ -326,10 +327,16 @@ void CAreaDependencyTree::AddScriptLayer(CScriptLayer *pLayer)
|
||||
|
||||
// Note: MP2+ need to track all instances (not just instances with dependencies) to be able to build the layer module list
|
||||
if (pTree->NumChildren() > 0 || pLayer->Area()->Game() >= eEchoesDemo)
|
||||
{
|
||||
mChildren.push_back(pTree);
|
||||
pTree->GetAllResourceReferences(UsedIDs);
|
||||
}
|
||||
else
|
||||
delete pTree;
|
||||
}
|
||||
|
||||
for (u32 iDep = 0; iDep < rkExtraDeps.size(); iDep++)
|
||||
AddDependency(rkExtraDeps[iDep]);
|
||||
}
|
||||
|
||||
void CAreaDependencyTree::GetModuleDependencies(EGame Game, std::vector<TString>& rModuleDepsOut, std::vector<u32>& rModuleLayerOffsetsOut) const
|
||||
@@ -351,8 +358,10 @@ void CAreaDependencyTree::GetModuleDependencies(EGame Game, std::vector<TString>
|
||||
|
||||
for (u32 iInst = StartIdx; iInst < EndIdx; iInst++)
|
||||
{
|
||||
CScriptInstanceDependency *pInst = static_cast<CScriptInstanceDependency*>(mChildren[iInst]);
|
||||
ASSERT(pInst->Type() == eDNT_ScriptInstance);
|
||||
IDependencyNode *pNode = mChildren[iInst];
|
||||
if (pNode->Type() != eDNT_ScriptInstance) continue;
|
||||
|
||||
CScriptInstanceDependency *pInst = static_cast<CScriptInstanceDependency*>(pNode);
|
||||
u32 ObjType = pInst->ObjectType();
|
||||
|
||||
if (UsedObjectTypes.find(ObjType) == UsedObjectTypes.end())
|
||||
|
||||
@@ -215,7 +215,7 @@ public:
|
||||
virtual EDependencyNodeType Type() const;
|
||||
virtual void Serialize(IArchive& rArc);
|
||||
|
||||
void AddScriptLayer(CScriptLayer *pLayer);
|
||||
void AddScriptLayer(CScriptLayer *pLayer, const std::vector<CAssetID>& rkExtraDeps);
|
||||
void GetModuleDependencies(EGame Game, std::vector<TString>& rModuleDepsOut, std::vector<u32>& rModuleLayerOffsetsOut) const;
|
||||
|
||||
// Accessors
|
||||
|
||||
@@ -405,31 +405,44 @@ void CAreaDependencyListBuilder::BuildDependencyList(std::list<CAssetID>& rAsset
|
||||
|
||||
for (u32 iChild = StartIdx; iChild < EndIdx; iChild++)
|
||||
{
|
||||
CScriptInstanceDependency *pInst = static_cast<CScriptInstanceDependency*>(pTree->ChildByIndex(iChild));
|
||||
ASSERT(pInst->Type() == eDNT_ScriptInstance);
|
||||
mIsPlayerActor = (pInst->ObjectType() == 0x4C || pInst->ObjectType() == FOURCC('PLAC'));
|
||||
IDependencyNode *pNode = pTree->ChildByIndex(iChild);
|
||||
|
||||
for (u32 iDep = 0; iDep < pInst->NumChildren(); iDep++)
|
||||
if (pNode->Type() == eDNT_ScriptInstance)
|
||||
{
|
||||
CPropertyDependency *pDep = static_cast<CPropertyDependency*>(pInst->ChildByIndex(iDep));
|
||||
CScriptInstanceDependency *pInst = static_cast<CScriptInstanceDependency*>(pNode);
|
||||
mIsPlayerActor = (pInst->ObjectType() == 0x4C || pInst->ObjectType() == FOURCC('PLAC'));
|
||||
|
||||
// For MP3, exclude the CMDL/CSKR properties for the suit assets - only include default character assets
|
||||
if (mGame == eCorruption && mIsPlayerActor)
|
||||
for (u32 iDep = 0; iDep < pInst->NumChildren(); iDep++)
|
||||
{
|
||||
TString PropID = pDep->PropertyID();
|
||||
CPropertyDependency *pDep = static_cast<CPropertyDependency*>(pInst->ChildByIndex(iDep));
|
||||
|
||||
if ( PropID == "0x846397A8" || PropID == "0x685A4C01" ||
|
||||
PropID == "0x9834ECC9" || PropID == "0x188B8960" ||
|
||||
PropID == "0x134A81E3" || PropID == "0x4ABF030C" ||
|
||||
PropID == "0x9BF030DC" || PropID == "0x981263D3" ||
|
||||
PropID == "0x8A8D5AA5" || PropID == "0xE4734608" ||
|
||||
PropID == "0x3376814D" || PropID == "0x797CA77E" ||
|
||||
PropID == "0x0EBEC440" || PropID == "0xBC0952D8" ||
|
||||
PropID == "0xA8778E57" || PropID == "0x1CB10DBE" )
|
||||
continue;
|
||||
// For MP3, exclude the CMDL/CSKR properties for the suit assets - only include default character assets
|
||||
if (mGame == eCorruption && mIsPlayerActor)
|
||||
{
|
||||
TString PropID = pDep->PropertyID();
|
||||
|
||||
if ( PropID == "0x846397A8" || PropID == "0x685A4C01" ||
|
||||
PropID == "0x9834ECC9" || PropID == "0x188B8960" ||
|
||||
PropID == "0x134A81E3" || PropID == "0x4ABF030C" ||
|
||||
PropID == "0x9BF030DC" || PropID == "0x981263D3" ||
|
||||
PropID == "0x8A8D5AA5" || PropID == "0xE4734608" ||
|
||||
PropID == "0x3376814D" || PropID == "0x797CA77E" ||
|
||||
PropID == "0x0EBEC440" || PropID == "0xBC0952D8" ||
|
||||
PropID == "0xA8778E57" || PropID == "0x1CB10DBE" )
|
||||
continue;
|
||||
}
|
||||
|
||||
AddDependency(pDep->ID(), rAssetsOut, pAudioGroupsOut);
|
||||
}
|
||||
|
||||
AddDependency(pDep->ID(), rAssetsOut, pAudioGroupsOut);
|
||||
}
|
||||
else if (pNode->Type() == eDNT_ResourceDependency)
|
||||
{
|
||||
CResourceDependency *pResDep = static_cast<CResourceDependency*>(pNode);
|
||||
AddDependency(pResDep->ID(), rAssetsOut, pAudioGroupsOut);
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(false); // unhandled case!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user