From 77515f04e0cbb23029563017b47def5f2b9d0e4a Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Tue, 21 Jan 2020 09:47:24 +0200 Subject: [PATCH] ConstructMloClumps --- src/core/FileLoader.cpp | 2 +- src/core/ZoneCull.cpp | 6 +++--- src/modelinfo/ModelInfo.cpp | 10 ++++++++-- src/modelinfo/ModelInfo.h | 1 + 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp index cdf31f7b..50f51ecb 100644 --- a/src/core/FileLoader.cpp +++ b/src/core/FileLoader.cpp @@ -96,7 +96,7 @@ CFileLoader::LoadLevel(const char *filename) LoadObjectTypes(line + 4); }else if(strncmp(line, "IPL", 3) == 0){ if(!objectsLoaded){ - // CModelInfo::ConstructMloClumps(); + CModelInfo::ConstructMloClumps(); CObjectData::Initialise("DATA\\OBJECT.DAT"); objectsLoaded = true; } diff --git a/src/core/ZoneCull.cpp b/src/core/ZoneCull.cpp index b6929e86..7b22a550 100644 --- a/src/core/ZoneCull.cpp +++ b/src/core/ZoneCull.cpp @@ -473,8 +473,8 @@ CCullZone::DoStuffEnteringZone_OneTreadablePlus10m(uint16 i) int j; if(i < 6000){ - CPools::GetTreadablePool()->GetSlot(i)->bZoneCulled = true;; - CPools::GetTreadablePool()->GetSlot(i)->bZoneCulled2 = true;; + CPools::GetTreadablePool()->GetSlot(i)->bZoneCulled = true; + CPools::GetTreadablePool()->GetSlot(i)->bZoneCulled2 = true; bb = CCullZones::aPointersToBigBuildingsForTreadables[i]; if(bb != -1) CPools::GetBuildingPool()->GetSlot(bb)->bZoneCulled = true; @@ -492,7 +492,7 @@ CCullZone::DoStuffEnteringZone_OneTreadable(uint16 i) int j; if(i < 6000){ - CPools::GetTreadablePool()->GetSlot(i)->bZoneCulled = true;; + CPools::GetTreadablePool()->GetSlot(i)->bZoneCulled = true; bb = CCullZones::aPointersToBigBuildingsForTreadables[i]; if(bb != -1) CPools::GetBuildingPool()->GetSlot(bb)->bZoneCulled = true; diff --git a/src/modelinfo/ModelInfo.cpp b/src/modelinfo/ModelInfo.cpp index fdde699b..c41320e2 100644 --- a/src/modelinfo/ModelInfo.cpp +++ b/src/modelinfo/ModelInfo.cpp @@ -121,7 +121,7 @@ CModelInfo::AddMloModel(int id) CMloModelInfo *modelinfo; modelinfo = CModelInfo::ms_mloModelStore.alloc(); CModelInfo::ms_modelInfoPtrs[id] = modelinfo; - modelinfo->m_clump = 0; + modelinfo->m_clump = nil; modelinfo->firstInstance = 0; modelinfo->lastInstance = 0; return modelinfo; @@ -218,13 +218,19 @@ CModelInfo::RemoveColModelsFromOtherLevels(eLevelName level) } } - CStore* CModelInfo::GetMloInstanceStore() { return &CModelInfo::ms_mloInstanceStore; } +void +CModelInfo::ConstructMloClumps() +{ + for (int i = 0; i < ms_mloModelStore.allocPtr; i++) + ms_mloModelStore.store[i].ConstructClump(); +} + STARTPATCHES InjectHook(0x50B310, CModelInfo::Initialise, PATCH_JUMP); InjectHook(0x50B5B0, CModelInfo::ShutDown, PATCH_JUMP); diff --git a/src/modelinfo/ModelInfo.h b/src/modelinfo/ModelInfo.h index 1a295264..3835117e 100644 --- a/src/modelinfo/ModelInfo.h +++ b/src/modelinfo/ModelInfo.h @@ -46,4 +46,5 @@ public: static bool IsBikeModel(int32 id); static void RemoveColModelsFromOtherLevels(eLevelName level); static CStore* CModelInfo::GetMloInstanceStore(); + static void ConstructMloClumps(); };