diff --git a/src/Core/Resource/CGameArea.cpp b/src/Core/Resource/CGameArea.cpp index c518d7bb..51841e04 100644 --- a/src/Core/Resource/CGameArea.cpp +++ b/src/Core/Resource/CGameArea.cpp @@ -106,6 +106,11 @@ void CGameArea::ClearScriptLayers() mpGeneratorLayer = nullptr; } +EGame CGameArea::Version() +{ + return mVersion; +} + CTransform4f CGameArea::GetTransform() { return mTransform; diff --git a/src/Core/Resource/CGameArea.h b/src/Core/Resource/CGameArea.h index 6ea0b5e9..bc253df6 100644 --- a/src/Core/Resource/CGameArea.h +++ b/src/Core/Resource/CGameArea.h @@ -20,6 +20,7 @@ class CGameArea : public CResource DECLARE_RESOURCE_TYPE(eArea) friend class CAreaLoader; + EGame mVersion; u32 mVertexCount; u32 mTriangleCount; bool mTerrainMerged; @@ -50,6 +51,7 @@ public: void ClearScriptLayers(); // Getters + EGame Version(); CTransform4f GetTransform(); u32 GetTerrainModelCount(); u32 GetStaticModelCount(); diff --git a/src/Core/Resource/Factory/CAnimSetLoader.cpp b/src/Core/Resource/Factory/CAnimSetLoader.cpp index ab151cd9..a0804269 100644 --- a/src/Core/Resource/Factory/CAnimSetLoader.cpp +++ b/src/Core/Resource/Factory/CAnimSetLoader.cpp @@ -177,7 +177,7 @@ CAnimSet* CAnimSetLoader::LoadCHAR(IInputStream &CHAR) CAnimSetLoader loader; u8 check = CHAR.ReadByte(); - if (check == 0x5) + if (check == 0x5 || check == 0x3) { loader.mVersion = eCorruption; loader.set = new CAnimSet(); diff --git a/src/Core/Resource/Factory/CAreaLoader.cpp b/src/Core/Resource/Factory/CAreaLoader.cpp index ab547507..65aa13a3 100644 --- a/src/Core/Resource/Factory/CAreaLoader.cpp +++ b/src/Core/Resource/Factory/CAreaLoader.cpp @@ -563,6 +563,7 @@ CGameArea* CAreaLoader::LoadMREA(IInputStream& MREA) Loader.mpArea = new CGameArea; u32 version = MREA.ReadLong(); Loader.mVersion = GetFormatVersion(version); + Loader.mpArea->mVersion = Loader.mVersion; Loader.mpMREA = &MREA; switch (Loader.mVersion) @@ -594,6 +595,7 @@ CGameArea* CAreaLoader::LoadMREA(IInputStream& MREA) Loader.ReadGeometryPrime(); Loader.ReadSCLYEchoes(); Loader.ReadCollision(); + Loader.ReadLightsCorruption(); break; case eCorruption: case eReturns: diff --git a/src/Core/Resource/Factory/CScanLoader.cpp b/src/Core/Resource/Factory/CScanLoader.cpp index ddcb32f8..49b6b6bd 100644 --- a/src/Core/Resource/Factory/CScanLoader.cpp +++ b/src/Core/Resource/Factory/CScanLoader.cpp @@ -57,9 +57,11 @@ CScan* CScanLoader::LoadScanMP2(IInputStream& SCAN) switch (NumProperties) { case 0x14: + case 0xB: mpScan = new CScan(); LoadParamsMP2(SCAN); break; + case 0x12: case 0x16: mpScan = new CScan(); LoadParamsMP3(SCAN); @@ -156,6 +158,7 @@ CScan* CScanLoader::LoadSCAN(IInputStream &SCAN) // The MP2 load function will check for MP3 CScanLoader loader; loader.mVersion = eEchoes; + if (magic == 0x01000000) SCAN.Seek(-4, SEEK_CUR); // The version number isn't present in the Echoes demo return loader.LoadScanMP2(SCAN); } diff --git a/src/Core/Resource/Factory/CScriptLoader.cpp b/src/Core/Resource/Factory/CScriptLoader.cpp index 25869b84..24919aa2 100644 --- a/src/Core/Resource/Factory/CScriptLoader.cpp +++ b/src/Core/Resource/Factory/CScriptLoader.cpp @@ -345,7 +345,6 @@ CScriptObject* CScriptLoader::LoadObjectMP2(IInputStream& SCLY) } mpObj = new CScriptObject(mpArea, mpLayer, pTemplate); - mpObj->mpTemplate = pTemplate; mpObj->mInstanceID = SCLY.ReadLong(); // Load connections diff --git a/src/Editor/WorldEditor/CWorldEditor.cpp b/src/Editor/WorldEditor/CWorldEditor.cpp index 28ccf823..28c48721 100644 --- a/src/Editor/WorldEditor/CWorldEditor.cpp +++ b/src/Editor/WorldEditor/CWorldEditor.cpp @@ -137,7 +137,7 @@ void CWorldEditor::SetArea(CWorld *pWorld, CGameArea *pArea) } // Set up sidebar tabs - CMasterTemplate *pMaster = CMasterTemplate::GetMasterForGame(mpWorld->Version()); + CMasterTemplate *pMaster = CMasterTemplate::GetMasterForGame(mpArea->Version()); ui->InstancesTabContents->SetMaster(pMaster); }