From da253837d162686627c64f0faaedd5549db444da Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 25 Jan 2020 12:41:22 +0200 Subject: audio stuff Collision audio and police radio stuff moved to a separate cpp's like in the original code cPoliceRadioQueue added, code refactored correspondingly cAudioManager::ServiceCollisions reversed PlayOneShotScriptObject reversed cAudioScriptObject moved to AudioScriptObject.cpp Fixed use of numbers on non-integer types (bools, pointers) enum is now used for ped audio calculation Added fixes for vehicle description in the police radio (missing vehicles and wrong colors) --- src/audio/PoliceRadio.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/audio/PoliceRadio.h (limited to 'src/audio/PoliceRadio.h') 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 -- cgit v1.2.3