summaryrefslogtreecommitdiffstats
path: root/src/CullZones.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/CullZones.cpp')
-rw-r--r--src/CullZones.cpp23
1 files changed, 23 insertions, 0 deletions
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;
@@ -46,6 +47,27 @@ CCullZones::Init(void)
}
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)
{
bool invisible;
@@ -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);