diff --git a/src/Core/Resource/Area/CGameArea.cpp b/src/Core/Resource/Area/CGameArea.cpp index fcd48b5e..0a7a033f 100644 --- a/src/Core/Resource/Area/CGameArea.cpp +++ b/src/Core/Resource/Area/CGameArea.cpp @@ -45,8 +45,9 @@ CDependencyTree* CGameArea::BuildDependencyTree() const pTree->AddDependency(pMat->Pass(iPass)->Texture()); } + pTree->AddDependency(mPathID); + pTree->AddDependency(mPortalAreaID); pTree->AddDependency(mpPoiToWorldMap); - Log::Warning("CGameArea::FindDependencies not handling PATH/PTLA"); // Layer dependencies for (u32 iLayer = 0; iLayer < mScriptLayers.size(); iLayer++) diff --git a/src/Core/Resource/Area/CGameArea.h b/src/Core/Resource/Area/CGameArea.h index 7db83507..8c85dc63 100644 --- a/src/Core/Resource/Area/CGameArea.h +++ b/src/Core/Resource/Area/CGameArea.h @@ -56,6 +56,10 @@ class CGameArea : public CResource CCollisionMeshGroup *mpCollision; // Lights std::vector> mLightLayers; + // Path Mesh + CAssetID mPathID; + // Portal Area + CAssetID mPortalAreaID; // Object to Static Geometry Map TResPtr mpPoiToWorldMap; diff --git a/src/Core/Resource/CWorld.cpp b/src/Core/Resource/CWorld.cpp index 3edd6ad8..5715c3ef 100644 --- a/src/Core/Resource/CWorld.cpp +++ b/src/Core/Resource/CWorld.cpp @@ -34,7 +34,10 @@ CDependencyTree* CWorld::BuildDependencyTree() const pTree->AddDependency(mpMapWorld); if (Game() <= ePrime) - Log::Warning("CWorld::BuildDependencyTree not handling audio groups"); + { + for (u32 iGrp = 0; iGrp < mAudioGrps.size(); iGrp++) + pTree->AddDependency(mAudioGrps[iGrp].ResID); + } return pTree; } diff --git a/src/Core/Resource/Factory/CAreaLoader.cpp b/src/Core/Resource/Factory/CAreaLoader.cpp index 2e8b9bd5..dfb920ba 100644 --- a/src/Core/Resource/Factory/CAreaLoader.cpp +++ b/src/Core/Resource/Factory/CAreaLoader.cpp @@ -18,17 +18,16 @@ CAreaLoader::CAreaLoader() , mCollisionBlockNum(-1) , mUnknownBlockNum(-1) , mLightsBlockNum(-1) - , mEmptyBlockNum(-1) + , mVisiBlockNum(-1) , mPathBlockNum(-1) , mOctreeBlockNum(-1) , mScriptGeneratorBlockNum(-1) , mFFFFBlockNum(-1) - , mUnknown2BlockNum(-1) + , mPTLABlockNum(-1) , mEGMCBlockNum(-1) , mBoundingBoxesBlockNum(-1) , mDependenciesBlockNum(-1) , mGPUBlockNum(-1) - , mPVSBlockNum(-1) , mRSOBlockNum(-1) { } @@ -45,7 +44,6 @@ CAreaLoader::~CAreaLoader() // ************ PRIME ************ void CAreaLoader::ReadHeaderPrime() { - Log::FileWrite(mpMREA->GetSourceString(), "Reading MREA header (MP1)"); mpArea->mTransform = CTransform4f(*mpMREA); mNumMeshes = mpMREA->ReadLong(); u32 mNumBlocks = mpMREA->ReadLong(); @@ -55,7 +53,7 @@ void CAreaLoader::ReadHeaderPrime() mCollisionBlockNum = mpMREA->ReadLong(); mUnknownBlockNum = mpMREA->ReadLong(); mLightsBlockNum = mpMREA->ReadLong(); - mEmptyBlockNum = mpMREA->ReadLong(); + mVisiBlockNum = mpMREA->ReadLong(); mPathBlockNum = mpMREA->ReadLong(); mOctreeBlockNum = mpMREA->ReadLong(); @@ -69,7 +67,6 @@ void CAreaLoader::ReadHeaderPrime() void CAreaLoader::ReadGeometryPrime() { - Log::FileWrite(mpMREA->GetSourceString(), "Reading MREA world geometry (MP1/MP2)"); mpSectionMgr->ToSection(mGeometryBlockNum); // Materials @@ -119,7 +116,6 @@ void CAreaLoader::ReadGeometryPrime() void CAreaLoader::ReadSCLYPrime() { // Prime, Echoes Demo - Log::FileWrite(mpMREA->GetSourceString(), "Reading MREA script layers (MP1)"); mpSectionMgr->ToSection(mScriptLayerBlockNum); CFourCC SCLY(*mpMREA); @@ -174,7 +170,6 @@ void CAreaLoader::ReadSCLYPrime() void CAreaLoader::ReadLightsPrime() { - Log::FileWrite(mpMREA->GetSourceString(), "Reading MREA dynamic lights (MP1/MP2)"); mpSectionMgr->ToSection(mLightsBlockNum); u32 BabeDead = mpMREA->ReadLong(); @@ -259,7 +254,6 @@ void CAreaLoader::ReadLightsPrime() void CAreaLoader::ReadHeaderEchoes() { // This function reads the header for Echoes and the Echoes demo disc - Log::FileWrite(mpMREA->GetSourceString(), "Reading MREA header (MP2)"); mpArea->mTransform = CTransform4f(*mpMREA); mNumMeshes = mpMREA->ReadLong(); if (mVersion == eEchoes) mNumLayers = mpMREA->ReadLong(); @@ -271,10 +265,10 @@ void CAreaLoader::ReadHeaderEchoes() mCollisionBlockNum = mpMREA->ReadLong(); mUnknownBlockNum = mpMREA->ReadLong(); mLightsBlockNum = mpMREA->ReadLong(); - mEmptyBlockNum = mpMREA->ReadLong(); + mVisiBlockNum = mpMREA->ReadLong(); mPathBlockNum = mpMREA->ReadLong(); mFFFFBlockNum = mpMREA->ReadLong(); - mUnknown2BlockNum = mpMREA->ReadLong(); + mPTLABlockNum = mpMREA->ReadLong(); mEGMCBlockNum = mpMREA->ReadLong(); if (mVersion == eEchoes) mClusters.resize(mpMREA->ReadLong()); mpMREA->SeekToBoundary(32); @@ -297,7 +291,6 @@ void CAreaLoader::ReadHeaderEchoes() void CAreaLoader::ReadSCLYEchoes() { // MP2, MP3 Proto, MP3, DKCR - Log::FileWrite(mpMREA->GetSourceString(), "Reading MREA script layers (MP2/MP3/DKCR)"); mpSectionMgr->ToSection(mScriptLayerBlockNum); mpArea->mScriptLayers.resize(mNumLayers); @@ -341,7 +334,6 @@ void CAreaLoader::ReadSCLYEchoes() void CAreaLoader::ReadHeaderCorruption() { // This function reads the header for MP3, the MP3 prototype, and DKCR - Log::FileWrite(mpMREA->GetSourceString(), "Reading MREA header (MP3/DKCR)"); mpArea->mTransform = CTransform4f(*mpMREA); mNumMeshes = mpMREA->ReadLong(); mNumLayers = mpMREA->ReadLong(); @@ -361,13 +353,14 @@ void CAreaLoader::ReadHeaderCorruption() u32 Num = mpMREA->ReadLong(); if (Type == "AABB") mBoundingBoxesBlockNum = Num; + else if (Type == "APTL") mPTLABlockNum = Num; else if (Type == "COLI") mCollisionBlockNum = Num; else if (Type == "DEPS") mDependenciesBlockNum = Num; else if (Type == "EGMC") mEGMCBlockNum = Num; else if (Type == "GPUD") mGPUBlockNum = Num; else if (Type == "LITE") mLightsBlockNum = Num; else if (Type == "PFL2") mPathBlockNum = Num; - else if (Type == "PVS!") mPVSBlockNum = Num; + else if (Type == "PVS!") mVisiBlockNum = Num; else if (Type == "ROCT") mOctreeBlockNum = Num; else if (Type == "RSOS") mRSOBlockNum = Num; else if (Type == "SOBJ") mScriptLayerBlockNum = Num; @@ -390,7 +383,6 @@ void CAreaLoader::ReadHeaderCorruption() void CAreaLoader::ReadGeometryCorruption() { - Log::FileWrite(mpMREA->GetSourceString(), "Reading MREA world geometry (MP3)"); mpSectionMgr->ToSection(mGeometryBlockNum); // Materials @@ -432,7 +424,6 @@ void CAreaLoader::ReadGeometryCorruption() void CAreaLoader::ReadLightsCorruption() { - Log::FileWrite(mpMREA->GetSourceString(), "Reading MREA dynamic lights (MP3)"); mpSectionMgr->ToSection(mLightsBlockNum); u32 BabeDead = mpMREA->ReadLong(); @@ -535,7 +526,6 @@ void CAreaLoader::Decompress() { // This function decompresses compressed clusters into a buffer. // It should be called at the beginning of the first compressed cluster. - Log::FileWrite(mpMREA->GetSourceString(), "Decompressing MREA data"); if (mVersion < eEchoes) return; // Decompress clusters @@ -593,14 +583,24 @@ void CAreaLoader::LoadSectionDataBuffers() void CAreaLoader::ReadCollision() { - Log::FileWrite(mpMREA->GetSourceString(), "Reading collision (MP1/MP2/MP3)"); mpSectionMgr->ToSection(mCollisionBlockNum); mpArea->mpCollision = CCollisionLoader::LoadAreaCollision(*mpMREA); } +void CAreaLoader::ReadPATH() +{ + mpSectionMgr->ToSection(mPathBlockNum); + mpArea->mPathID = CAssetID(*mpMREA, (mVersion <= eEchoes ? e32Bit : e64Bit)); +} + +void CAreaLoader::ReadPTLA() +{ + mpSectionMgr->ToSection(this->mPTLABlockNum); + mpArea->mPortalAreaID = CAssetID(*mpMREA, (mVersion <= eEchoes ? e32Bit : e64Bit)); +} + void CAreaLoader::ReadEGMC() { - Log::FileWrite(mpMREA->GetSourceString(), "Reading EGMC"); mpSectionMgr->ToSection(mEGMCBlockNum); CAssetID EGMC(*mpMREA, (mVersion <= eEchoes ? e32Bit : e64Bit)); mpArea->mpPoiToWorldMap = gpResourceStore->LoadResource(EGMC, "EGMC"); diff --git a/src/Core/Resource/Factory/CAreaLoader.h b/src/Core/Resource/Factory/CAreaLoader.h index 728d4c27..39558216 100644 --- a/src/Core/Resource/Factory/CAreaLoader.h +++ b/src/Core/Resource/Factory/CAreaLoader.h @@ -36,17 +36,16 @@ class CAreaLoader u32 mCollisionBlockNum; u32 mUnknownBlockNum; u32 mLightsBlockNum; - u32 mEmptyBlockNum; + u32 mVisiBlockNum; u32 mPathBlockNum; u32 mOctreeBlockNum; u32 mScriptGeneratorBlockNum; u32 mFFFFBlockNum; - u32 mUnknown2BlockNum; + u32 mPTLABlockNum; u32 mEGMCBlockNum; u32 mBoundingBoxesBlockNum; u32 mDependenciesBlockNum; u32 mGPUBlockNum; - u32 mPVSBlockNum; u32 mRSOBlockNum; struct SCompressedCluster { @@ -76,6 +75,8 @@ class CAreaLoader void Decompress(); void LoadSectionDataBuffers(); void ReadCollision(); + void ReadPATH(); + void ReadPTLA(); void ReadEGMC(); void SetUpObjects();