summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2019-08-08 02:21:38 +0200
committereray orçunus <erayorcunus@gmail.com>2019-08-08 13:46:49 +0200
commit2ba54983a2d6df7a644ca79a1441578c245e0cd8 (patch)
tree3e8f39f1344ec95e28fba993c3bad6fd4fe0c103 /src/control
parentMerge pull request #183 from Nick007J/master (diff)
downloadre3-2ba54983a2d6df7a644ca79a1441578c245e0cd8.tar
re3-2ba54983a2d6df7a644ca79a1441578c245e0cd8.tar.gz
re3-2ba54983a2d6df7a644ca79a1441578c245e0cd8.tar.bz2
re3-2ba54983a2d6df7a644ca79a1441578c245e0cd8.tar.lz
re3-2ba54983a2d6df7a644ca79a1441578c245e0cd8.tar.xz
re3-2ba54983a2d6df7a644ca79a1441578c245e0cd8.tar.zst
re3-2ba54983a2d6df7a644ca79a1441578c245e0cd8.zip
Diffstat (limited to 'src/control')
-rw-r--r--src/control/TrafficLights.cpp14
-rw-r--r--src/control/TrafficLights.h7
2 files changed, 21 insertions, 0 deletions
diff --git a/src/control/TrafficLights.cpp b/src/control/TrafficLights.cpp
index 73ff6118..f1532ab5 100644
--- a/src/control/TrafficLights.cpp
+++ b/src/control/TrafficLights.cpp
@@ -1,5 +1,19 @@
#include "common.h"
#include "patcher.h"
#include "TrafficLights.h"
+#include "Timer.h"
WRAPPER void CTrafficLights::DisplayActualLight(CEntity *ent) { EAXJMP(0x455800); }
+
+uint8
+CTrafficLights::LightForPeds(void)
+{
+ uint32 period = CTimer::GetTimeInMilliseconds() & 0x3FFF; // Equals to % 16384
+
+ if (period >= 15384)
+ return PED_LIGHTS_WALK_BLINK;
+ else if (period >= 12000)
+ return PED_LIGHTS_WALK;
+ else
+ return PED_LIGHTS_DONT_WALK;
+} \ No newline at end of file
diff --git a/src/control/TrafficLights.h b/src/control/TrafficLights.h
index eec3e1e3..db240111 100644
--- a/src/control/TrafficLights.h
+++ b/src/control/TrafficLights.h
@@ -2,8 +2,15 @@
class CEntity;
+enum {
+ PED_LIGHTS_WALK,
+ PED_LIGHTS_WALK_BLINK,
+ PED_LIGHTS_DONT_WALK,
+};
+
class CTrafficLights
{
public:
static void DisplayActualLight(CEntity *ent);
+ static uint8 LightForPeds(void);
};