summaryrefslogtreecommitdiffstats
path: root/src/control/RoadBlocks.cpp
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-03-25 15:13:06 +0100
committereray orçunus <erayorcunus@gmail.com>2020-03-26 16:54:03 +0100
commit0fe55eb5432906016cc3526caf3f86d5bf85aff1 (patch)
tree0f4f6bfafc9e3138bf090efb16b18e6fa22c2eab /src/control/RoadBlocks.cpp
parentMerge pull request #353 from Sergeanur/Debug (diff)
downloadre3-0fe55eb5432906016cc3526caf3f86d5bf85aff1.tar
re3-0fe55eb5432906016cc3526caf3f86d5bf85aff1.tar.gz
re3-0fe55eb5432906016cc3526caf3f86d5bf85aff1.tar.bz2
re3-0fe55eb5432906016cc3526caf3f86d5bf85aff1.tar.lz
re3-0fe55eb5432906016cc3526caf3f86d5bf85aff1.tar.xz
re3-0fe55eb5432906016cc3526caf3f86d5bf85aff1.tar.zst
re3-0fe55eb5432906016cc3526caf3f86d5bf85aff1.zip
Diffstat (limited to '')
-rw-r--r--src/control/RoadBlocks.cpp34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp
index ed092391..e39fe481 100644
--- a/src/control/RoadBlocks.cpp
+++ b/src/control/RoadBlocks.cpp
@@ -1,7 +1,37 @@
#include "common.h"
#include "patcher.h"
#include "RoadBlocks.h"
+#include "PathFind.h"
+
+int16 &CRoadBlocks::NumRoadBlocks = *(int16*)0x95CC34;
+int16 (&CRoadBlocks::RoadBlockObjects)[NUMROADBLOCKS] = *(int16(*)[NUMROADBLOCKS]) * (uintptr*)0x72B3A8;
+bool (&CRoadBlocks::InOrOut)[NUMROADBLOCKS] = *(bool(*)[NUMROADBLOCKS]) * (uintptr*)0x733810;
-WRAPPER void CRoadBlocks::Init(void) { EAXJMP(0x436F50); }
WRAPPER void CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle*, int32, int16) { EAXJMP(0x4376A0); }
-WRAPPER void CRoadBlocks::GenerateRoadBlocks(void) { EAXJMP(0x436FA0); } \ No newline at end of file
+WRAPPER void CRoadBlocks::GenerateRoadBlocks(void) { EAXJMP(0x436FA0); }
+
+void
+CRoadBlocks::Init(void)
+{
+ NumRoadBlocks = 0;
+ for (int objId = 0; objId < ThePaths.m_numMapObjects; objId++) {
+ if (ThePaths.m_objectFlags[objId] & UseInRoadBlock) {
+ if (NumRoadBlocks < 600) {
+ InOrOut[NumRoadBlocks] = true;
+ RoadBlockObjects[NumRoadBlocks] = objId;
+ NumRoadBlocks++;
+ } else {
+#ifndef MASTER
+ printf("Not enough room for the potential roadblocks\n");
+#endif
+ // FIX: Don't iterate loop after NUMROADBLOCKS
+ return;
+ }
+ }
+ }
+
+}
+
+STARTPATCHES
+ InjectHook(0x436F50, &CRoadBlocks::Init, PATCH_JUMP);
+ENDPATCHES \ No newline at end of file