summaryrefslogtreecommitdiffstats
path: root/src/CullZones.cpp
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-06-13 12:25:55 +0200
committeraap <aap@papnet.eu>2019-06-13 12:25:55 +0200
commitf407c9829fb5eac2c00867d2b31b2766dfe70540 (patch)
tree49afbef27c493ac1406c0b621a29ed5df78e9a86 /src/CullZones.cpp
parentimplemented GTA stream read functions (diff)
downloadre3-f407c9829fb5eac2c00867d2b31b2766dfe70540.tar
re3-f407c9829fb5eac2c00867d2b31b2766dfe70540.tar.gz
re3-f407c9829fb5eac2c00867d2b31b2766dfe70540.tar.bz2
re3-f407c9829fb5eac2c00867d2b31b2766dfe70540.tar.lz
re3-f407c9829fb5eac2c00867d2b31b2766dfe70540.tar.xz
re3-f407c9829fb5eac2c00867d2b31b2766dfe70540.tar.zst
re3-f407c9829fb5eac2c00867d2b31b2766dfe70540.zip
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);