summaryrefslogtreecommitdiff
path: root/src/control/TrafficLights.cpp
blob: 61c941b856d576efc2b595e6e70a75a5399a21fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "common.h"
#include "patcher.h"
#include "TrafficLights.h"
#include "Timer.h"
#include "Vehicle.h"

WRAPPER void CTrafficLights::DisplayActualLight(CEntity *ent) { EAXJMP(0x455800); }
WRAPPER bool CTrafficLights::ShouldCarStopForLight(CVehicle*, bool) { EAXJMP(0x455350); }
WRAPPER bool CTrafficLights::ShouldCarStopForBridge(CVehicle*) { EAXJMP(0x456460); }

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;
}