summaryrefslogtreecommitdiffstats
path: root/src/audio/PoliceRadio.h
blob: c01f21ce500c702fbf84e00d8710a3de141ab261 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma once

#include "Wanted.h"

struct cAMCrime {
	int32 type;
	CVector position;
	uint16 timer;

	cAMCrime()
	{
		type = CRIME_NONE;
		position = CVector(0.0f, 0.0f, 0.0f);
		timer = 0;
	}
};

VALIDATE_SIZE(cAMCrime, 20);

class cPoliceRadioQueue
{
public:
	int32 crimesSamples[60];
	uint8 policeChannelTimer;
	uint8 policeChannelTimerSeconds;
	uint8 policeChannelCounterSeconds;
	cAMCrime crimes[10];

	cPoliceRadioQueue()
	{
		policeChannelTimerSeconds = 0;
		policeChannelCounterSeconds = 0;
		policeChannelTimer = 0;
	}

	void Add(uint32 sample)
	{
		if (policeChannelTimer != 60) {
			crimesSamples[policeChannelTimerSeconds] = sample;
			policeChannelTimer++;
			policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60;
		}
	}
};

VALIDATE_SIZE(cPoliceRadioQueue, 444);