From f407c9829fb5eac2c00867d2b31b2766dfe70540 Mon Sep 17 00:00:00 2001 From: aap Date: Thu, 13 Jun 2019 12:25:55 +0200 Subject: finished some classes --- src/CullZones.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/CullZones.cpp') diff --git a/src/CullZones.cpp b/src/CullZones.cpp index dc30790b..76052351 100644 --- a/src/CullZones.cpp +++ b/src/CullZones.cpp @@ -6,6 +6,7 @@ #include "Timer.h" #include "Camera.h" #include "World.h" +#include "FileMgr.h" #include "CullZones.h" int32 &CCullZones::NumCullZones = *(int*)0x8F2564; @@ -45,6 +46,27 @@ CCullZones::Init(void) aPointersToBigBuildingsForTreadables[i] = -1; } +void +CCullZones::ResolveVisibilities(void) +{ + int fd; + + CFileMgr::SetDir(""); + fd = CFileMgr::OpenFile("DATA\\cullzone.dat", "rb"); + if(fd > 0){ + CFileMgr::Read(fd, (char*)&NumCullZones, 4); + CFileMgr::Read(fd, (char*)aZones, NUMCULLZONES*sizeof(CCullZone)); + CFileMgr::Read(fd, (char*)&NumAttributeZones, 4); + CFileMgr::Read(fd, (char*)aAttributeZones, NUMATTRIBZONES*sizeof(CAttributeZone)); + CFileMgr::Read(fd, (char*)aIndices, NUMZONEINDICES*2); + CFileMgr::Read(fd, (char*)aPointersToBigBuildingsForBuildings, NUMBUILDINGS*2); + CFileMgr::Read(fd, (char*)aPointersToBigBuildingsForTreadables, NUMTREADABLES*2); + CFileMgr::CloseFile(fd); + }else{ + // TODO: implement code from mobile to generate data here + } +} + void CCullZones::Update(void) { @@ -311,6 +333,7 @@ CCullZone::DoStuffEnteringZone_OneTreadable(uint16 i) STARTPATCHES InjectHook(0x524BC0, &CCullZones::Init, PATCH_JUMP); + InjectHook(0x524EC0, &CCullZones::ResolveVisibilities, PATCH_JUMP); InjectHook(0x524F80, &CCullZones::Update, PATCH_JUMP); InjectHook(0x525370, &CCullZones::AddCullZone, PATCH_JUMP); InjectHook(0x5250D0, &CCullZones::ForceCullZoneCoors, PATCH_JUMP); -- cgit v1.2.3