summaryrefslogtreecommitdiffstats
path: root/src/audio/PoliceRadio.h
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-01-25 11:41:22 +0100
committerSergeanur <s.anureev@yandex.ua>2020-01-25 11:48:27 +0100
commitda253837d162686627c64f0faaedd5549db444da (patch)
treed061108eccd39287c37ec09aa00af1eac5298b56 /src/audio/PoliceRadio.h
parentPartial CBoat (diff)
downloadre3-da253837d162686627c64f0faaedd5549db444da.tar
re3-da253837d162686627c64f0faaedd5549db444da.tar.gz
re3-da253837d162686627c64f0faaedd5549db444da.tar.bz2
re3-da253837d162686627c64f0faaedd5549db444da.tar.lz
re3-da253837d162686627c64f0faaedd5549db444da.tar.xz
re3-da253837d162686627c64f0faaedd5549db444da.tar.zst
re3-da253837d162686627c64f0faaedd5549db444da.zip
Diffstat (limited to '')
-rw-r--r--src/audio/PoliceRadio.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/audio/PoliceRadio.h b/src/audio/PoliceRadio.h
new file mode 100644
index 00000000..152a5ee2
--- /dev/null
+++ b/src/audio/PoliceRadio.h
@@ -0,0 +1,44 @@
+#pragma once
+
+struct cAMCrime {
+ int32 type;
+ CVector position;
+ uint16 timer;
+
+ cAMCrime()
+ {
+ type = CRIME_NONE;
+ position = CVector(0.0f, 0.0f, 0.0f);
+ timer = 0;
+ }
+};
+
+static_assert(sizeof(cAMCrime) == 20, "cAMCrime: error ");
+
+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;
+ }
+ }
+};
+
+static_assert(sizeof(cPoliceRadioQueue) == 444, "cPoliceRadioQueue: error "); \ No newline at end of file