39 Commits

Author SHA1 Message Date
Hezkore
ae51f0cf09 Updated readme 2021-11-19 17:53:45 +01:00
Hezkore
22020108f6 Updated readme 2021-11-19 17:53:24 +01:00
Hezkore
2931fa5cfe Fixed launch cwd path for Linux 2021-11-19 17:42:44 +01:00
Hezkore
35b73e2b2e Fixed TopAlphaSpeed 2021-11-19 16:34:49 +01:00
Hezkore
f6b9b54616 Updated readme 2021-11-19 16:32:02 +01:00
Hezkore
0dcb8d0c10 Updated readme 2021-11-19 16:31:11 +01:00
Hezkore
984bcf893d Throttle particles 2021-11-19 16:30:00 +01:00
Hezkore
c1c5176b17 Particle experiment 2021-11-19 15:20:47 +01:00
Hezkore
06a05476cb Updated readme 2021-11-19 14:39:24 +01:00
Hezkore
dff5f5bf61 Camera: fixed incorrect negative value 2021-11-19 13:47:47 +01:00
Hezkore
5d1725b634 Camera: adjusted camera acc values 2021-11-19 13:30:46 +01:00
withmorten
3233ffe1c4 Merge pull request #1233 from madebr/cmake-fixes
Fix cmake installation with conan
2021-09-03 00:38:46 +02:00
Sergeanur
3569b7edfe Fix ped comments on oal 2021-09-02 19:22:29 +03:00
Sergeanur
a15d5589b3 Fix reflection counter 2021-09-02 18:49:49 +03:00
Sergeanur
d23c045d11 Audio: small refactoring 2021-09-02 18:30:15 +03:00
Sergeanur
3bc6aa85da Audio: a bit more PS2 changes 2021-09-02 17:52:11 +03:00
Sergeanur
5aa149f0bc PS2 ProcessReverb 2021-09-02 12:58:42 +03:00
Sergeanur
8c1f1cc7b8 PS2 mission audio length 2021-09-02 12:43:15 +03:00
Sergeanur
9b511d28ec Audio: PS2 cAudioManager::ServicePoliceRadioChannel 2021-09-02 08:31:22 +03:00
Sergeanur
c41239ed5e Ped comments fixes 2021-09-02 08:00:04 +03:00
Sergeanur
787f1922f4 Audio: fix types for IsSampleBankLoaded/IsPedCommentLoaded, reverse ProcessSpecial from PS2 2021-09-02 07:13:35 +03:00
withmorten
6d44cee7c2 fix librw to be most recent 2021-09-01 15:57:05 +02:00
Sergeanur
6c3cb330c1 Audio: PS2 mission audio 2021-09-01 13:25:47 +03:00
Sergeanur
57757e6c6f Audio: PS2 pager code 2021-09-01 10:44:38 +03:00
Sergeanur
1c426fdff1 Audio: some PS2 code 2021-09-01 08:09:33 +03:00
Sergeanur
bcdeb71070 Audio: ps2 code ifdef 2021-08-30 11:25:14 +03:00
Nikolay Korolev
9bb34fab25 ps2 fix 2021-08-29 19:45:52 +03:00
Nikolay Korolev
8593fff48b fix PS2 script 2021-08-29 19:36:44 +03:00
Sergeanur
55e950fe84 Audio: fixing bugs, fixing types, making code more accurate to original 2021-08-29 09:42:24 +03:00
Nikolay
af543350db Merge pull request #1322 from x87/master
Mention CLEO Redux
2021-08-28 14:16:45 +03:00
x87
9c71524583 Mention CLEO Redux 2021-08-27 13:29:32 -04:00
Nikolay Korolev
399fb28f77 fix debug teleport 2021-08-26 21:50:19 +03:00
Sergeanur
2e02aed5d5 Fix acceleration sound on exiting the vehicle 2021-08-26 08:15:03 +03:00
Nikolay Korolev
885467bcd0 keep noinline only for broken vs versions 2021-08-26 01:24:31 +03:00
Sergeanur
5017e09dd0 Refactor cPedComments 2021-08-25 13:41:29 +03:00
Sergeanur
ee93e4bc7d Audio: refactoring, type fixes, renaming cAudioManager fields 2021-08-25 08:49:42 +03:00
Sergeanur
9ecca45bf3 Audio: fix PS2 ifdefs 2021-08-24 15:24:28 +03:00
Anonymous Maarten
152148d71f conan: copy gamefiles to source folder so cmake install succeeds 2021-07-12 18:00:04 +02:00
Anonymous Maarten
3d922c90e9 cmake: add _INSTALL cmake option 2021-07-12 18:00:02 +02:00
31 changed files with 4105 additions and 3541 deletions

4
.vscode/launch.json vendored
View File

@@ -3,7 +3,7 @@
{
"MIMode": "gdb",
"args": [],
"cwd": "${workspaceFolder}",
"cwd": "${workspaceFolder}/bin/linux-amd64-librw_gl3_glfw-oal/Debug",
"environment": [],
"externalConsole": false,
"name": "(gdb) Launch (Linux Debug)",
@@ -24,7 +24,7 @@
{
"MIMode": "gdb",
"args": [],
"cwd": "${workspaceFolder}",
"cwd": "${workspaceFolder}/bin/linux-amd64-librw_gl3_glfw-oal/Release",
"environment": [],
"externalConsole": false,
"name": "(gdb) Launch (Linux Release)",

View File

@@ -29,6 +29,7 @@ endif()
set(${PROJECT}_AUDIO "OAL" CACHE STRING "Audio")
option(${PROJECT}_INSTALL "Enable installation of ${EXECUTABLE} + gamefiles" OFF)
option(${PROJECT}_WITH_OPUS "Build ${EXECUTABLE} with opus support" OFF)
option(${PROJECT}_WITH_LIBSNDFILE "Build ${EXECUTABLE} with libsndfile (instead of internal decoder)" OFF)

View File

@@ -1,11 +1,17 @@
<img src="https://github.com/GTAmodding/re3/blob/master/res/images/logo_1024.png?raw=true" alt="re3 logo" width="200">
<img src="https://github.com/hezkore/re3/blob/master/res/images/logo_1024.png?raw=true" alt="re3 logo" width="200">
[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FGTAmodding%2Fre3%2Fbadge%3Fref%3Dmaster&style=flat)](https://actions-badge.atrox.dev/GTAmodding/re3/goto?ref=master)
<a href="https://discord.gg/RFNbjsUMGg"><img src="https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&longCache=true&style=flat" /></a>
## About this fork of re3
This fork fixes some issues I've had with the original re3.\
They're currently only applied to GTA 3.
* The camera now has the same vertical and horizontal speed.
* The mouse is generally slower, letting you adjust the mouse sensitivity at a finer-granularity level.
* Particles are no longer affected by framerate.\
_(via a dirty fixed rate hack)_
## Intro
In this repository you'll find the fully reversed source code for GTA III ([master](https://github.com/GTAmodding/re3/tree/master/) branch) and GTA VC ([miami](https://github.com/GTAmodding/re3/tree/miami/) branch).
In this repository you'll find the fully reversed source code for GTA III ([master](https://github.com/hezkore/re3/tree/master/) branch) and GTA VC ([miami](https://github.com/GTAmodding/re3/tree/miami/) branch).
It has been tested and works on Windows, Linux, MacOS and FreeBSD, on x86, amd64, arm and arm64.\
Rendering is handled either by original RenderWare (D3D8)
@@ -85,7 +91,9 @@ The following things would be nice to have/do:
Asset modifications (models, texture, handling, script, ...) should work the same way as with original GTA for the most part.
Mods that make changes to the code (dll/asi, CLEO, limit adjusters) will *not* work.
CLEO scripts work with [CLEO Redux](https://github.com/cleolibrary/CLEO-Redux).
Mods that make changes to the code (dll/asi, limit adjusters) will *not* work.
Some things these mods do are already implemented in re3 (much of SkyGFX, GInput, SilentPatch, Widescreen fix),
others can easily be achieved (increasing limis, see `config.h`),
others will simply have to be rewritten and integrated into the code directly.

View File

@@ -60,7 +60,7 @@ class Re3Conan(ConanFile):
self.requires("opusfile/0.12")
def export_sources(self):
for d in ("cmake", "src"):
for d in ("cmake", "gamefiles", "src"):
shutil.copytree(src=d, dst=os.path.join(self.export_sources_folder, d))
self.copy("CMakeLists.txt")

View File

@@ -8,8 +8,6 @@
#include "SurfaceTable.h"
#include "sampman.h"
const int CollisionSoundIntensity = 60;
void
cAudioManager::ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, float collisionPower,
float velocity)
@@ -18,7 +16,7 @@ cAudioManager::ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface
CVector v1;
CVector v2;
if(!m_bIsInitialised || m_nCollisionEntity < 0 || m_nUserPause ||
if(!m_bIsInitialised || m_nCollisionEntity < 0 || m_bIsPaused ||
(velocity < 0.0016f && collisionPower < 0.01f))
return;
@@ -32,7 +30,7 @@ cAudioManager::ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface
}
CVector pos = (v1 + v2) * 0.5f;
distSquared = GetDistanceSquared(pos);
if(distSquared < SQR(CollisionSoundIntensity)) {
if(distSquared < SQR(COLLISION_MAX_DIST)) {
m_sCollisionManager.m_sQueue.m_pEntity1 = entity1;
m_sCollisionManager.m_sQueue.m_pEntity2 = entity2;
m_sCollisionManager.m_sQueue.m_bSurface1 = surface1;
@@ -48,8 +46,8 @@ cAudioManager::ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface
void
cAudioCollisionManager::AddCollisionToRequestedQueue()
{
int32 collisionsIndex;
int32 i;
uint32 collisionsIndex;
uint32 i;
if (m_bCollisionsInQueue < NUMAUDIOCOLLISIONS)
@@ -139,7 +137,7 @@ cAudioManager::ServiceCollisions()
m_sCollisionManager.m_bCollisionsInQueue = 0;
}
static const int32 gOneShotCol[] = {SFX_COL_TARMAC_1,
static const uint32 gOneShotCol[] = {SFX_COL_TARMAC_1,
SFX_COL_TARMAC_1,
SFX_COL_GRASS_1,
SFX_COL_GRAVEL_1,
@@ -179,7 +177,7 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
uint16 s1;
uint16 s2;
int32 emittingVol;
uint32 emittingVol;
float ratio;
static uint16 counter = 28;
@@ -198,11 +196,11 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
s1 = SURFACE_CAR_PANEL;
ratio = Min(1.f, 2.f * ratio);
}
emittingVol = 40.f * ratio;
emittingVol = 40 * ratio;
if(emittingVol) {
m_sQueueSample.m_fDistance = Sqrt(col.m_fDistance);
m_sQueueSample.m_nVolume =
ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
ComputeVolume(emittingVol, COLLISION_MAX_DIST, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nSampleIndex = gOneShotCol[s1];
switch(m_sQueueSample.m_nSampleIndex) {
@@ -266,7 +264,7 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
SET_EMITTING_VOLUME(emittingVol);
RESET_LOOP_OFFSETS
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_MaxDistance = CollisionSoundIntensity;
m_sQueueSample.m_MaxDistance = COLLISION_MAX_DIST;
m_sQueueSample.m_bStatic = TRUE;
m_sQueueSample.m_bReverb = TRUE;
SET_SOUND_REFLECTION(FALSE);
@@ -284,7 +282,7 @@ cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 coun
if(emittingVol) {
m_sQueueSample.m_fDistance = Sqrt(col.m_fDistance);
m_sQueueSample.m_nVolume =
ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
ComputeVolume(emittingVol, COLLISION_MAX_DIST, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = counter;
m_sQueueSample.m_vecPos = col.m_vecPosition;
@@ -295,7 +293,7 @@ cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 coun
SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_MaxDistance = CollisionSoundIntensity;
m_sQueueSample.m_MaxDistance = COLLISION_MAX_DIST;
m_sQueueSample.m_bStatic = FALSE;
m_sQueueSample.m_nFramesToPlay = 5;
m_sQueueSample.m_bReverb = TRUE;

File diff suppressed because it is too large Load Diff

View File

@@ -15,7 +15,11 @@
cAudioManager AudioManager;
#define SPEED_OF_SOUND 343.f
#ifdef GTA_PS2
#define TIME_SPENT 40
#else
#define TIME_SPENT 50
#endif
cAudioManager::cAudioManager()
{
@@ -24,9 +28,9 @@ cAudioManager::cAudioManager()
m_fSpeedOfSound = SPEED_OF_SOUND / TIME_SPENT;
m_nTimeSpent = TIME_SPENT;
m_nActiveSamples = NUM_CHANNELS_GENERIC;
m_nActiveSampleQueue = 1;
m_nActiveQueue = 1;
ClearRequestedQueue();
m_nActiveSampleQueue = 0;
m_nActiveQueue = 0;
ClearRequestedQueue();
ClearActiveSamples();
GenerateIntegerRandomNumberTable();
@@ -35,11 +39,11 @@ cAudioManager::cAudioManager()
m_bDynamicAcousticModelingStatus = TRUE;
#endif
for (int i = 0; i < NUM_AUDIOENTITIES; i++) {
for (uint32 i = 0; i < NUM_AUDIOENTITIES; i++) {
m_asAudioEntities[i].m_bIsUsed = FALSE;
m_anAudioEntityIndices[i] = NUM_AUDIOENTITIES;
m_aAudioEntityOrderList[i] = NUM_AUDIOENTITIES;
}
m_nAudioEntitiesTotal = 0;
m_nAudioEntitiesCount = 0;
m_FrameCounter = 0;
m_bReduceReleasingPriority = FALSE;
m_bTimerJustReset = FALSE;
@@ -64,7 +68,7 @@ cAudioManager::Initialise()
if (m_nActiveSamples <= 1) {
Terminate();
} else {
--m_nActiveSamples;
m_nActiveSamples--;
#else
{
m_nActiveSamples = NUM_CHANNELS_GENERIC;
@@ -86,10 +90,10 @@ cAudioManager::Terminate()
for (uint32 i = 0; i < NUM_AUDIOENTITIES; i++) {
m_asAudioEntities[i].m_bIsUsed = FALSE;
m_anAudioEntityIndices[i] = ARRAY_SIZE(m_anAudioEntityIndices);
m_aAudioEntityOrderList[i] = NUM_AUDIOENTITIES;
}
m_nAudioEntitiesTotal = 0;
m_nAudioEntitiesCount = 0;
m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0;
PreTerminateGameSpecificShutdown();
@@ -115,8 +119,8 @@ cAudioManager::Service()
m_bTimerJustReset = FALSE;
}
if (m_bIsInitialised) {
m_nPreviousUserPause = m_nUserPause;
m_nUserPause = CTimer::GetIsUserPaused();
m_bWasPaused = m_bIsPaused;
m_bIsPaused = CTimer::GetIsUserPaused();
#ifdef AUDIO_REFLECTIONS
UpdateReflections();
#endif
@@ -138,12 +142,12 @@ cAudioManager::CreateEntity(eAudioType type, void *entity)
#ifdef FIX_BUGS
// since sound could still play after entity deletion let's make sure we don't override one that is in use
// find all the free entity IDs that are being used by queued samples
int32 stillUsedEntities[NUM_CHANNELS_GENERIC * NUM_SOUNDS_SAMPLES_BANKS];
int32 stillUsedEntities[NUM_CHANNELS_GENERIC * NUM_SOUND_QUEUES];
uint32 stillUsedEntitiesCount = 0;
for (uint8 i = 0; i < NUM_SOUNDS_SAMPLES_BANKS; i++)
for (uint8 j = 0; j < m_SampleRequestQueuesStatus[i]; j++) {
tSound &sound = m_asSamples[i][m_abSampleQueueIndexTable[i][j]];
for (uint8 i = 0; i < NUM_SOUND_QUEUES; i++)
for (uint8 j = 0; j < m_nRequestedCount[i]; j++) {
tSound &sound = m_aRequestedQueue[i][m_aRequestedOrderList[i][j]];
if (sound.m_nEntityIndex < 0) continue;
if (!m_asAudioEntities[sound.m_nEntityIndex].m_bIsUsed) {
bool found = false;
@@ -159,7 +163,7 @@ cAudioManager::CreateEntity(eAudioType type, void *entity)
}
#endif
for (uint32 i = 0; i < ARRAY_SIZE(m_asAudioEntities); i++) {
for (uint32 i = 0; i < NUM_AUDIOENTITIES; i++) {
if (!m_asAudioEntities[i].m_bIsUsed) {
#ifdef FIX_BUGS
// skip if ID is still used by queued sample
@@ -184,7 +188,7 @@ cAudioManager::CreateEntity(eAudioType type, void *entity)
m_asAudioEntities[i].m_awAudioEvent[2] = SOUND_NO_SOUND;
m_asAudioEntities[i].m_awAudioEvent[3] = SOUND_NO_SOUND;
m_asAudioEntities[i].m_AudioEvents = 0;
m_anAudioEntityIndices[m_nAudioEntitiesTotal++] = i;
m_aAudioEntityOrderList[m_nAudioEntitiesCount++] = i;
return i;
}
}
@@ -196,11 +200,11 @@ cAudioManager::DestroyEntity(int32 id)
{
if (m_bIsInitialised && id >= 0 && id < NUM_AUDIOENTITIES && m_asAudioEntities[id].m_bIsUsed) {
m_asAudioEntities[id].m_bIsUsed = FALSE;
for (int32 i = 0; i < m_nAudioEntitiesTotal; ++i) {
if (id == m_anAudioEntityIndices[i]) {
for (uint32 i = 0; i < m_nAudioEntitiesCount; i++) {
if (id == m_aAudioEntityOrderList[i]) {
if (i < NUM_AUDIOENTITIES - 1)
memmove(&m_anAudioEntityIndices[i], &m_anAudioEntityIndices[i + 1], NUM_AUDIOENTITY_EVENTS * (m_nAudioEntitiesTotal - (i + 1)));
m_anAudioEntityIndices[--m_nAudioEntitiesTotal] = NUM_AUDIOENTITIES;
memmove(&m_aAudioEntityOrderList[i], &m_aAudioEntityOrderList[i + 1], sizeof(uint32) * (m_nAudioEntitiesCount - (i + 1)));
m_aAudioEntityOrderList[--m_nAudioEntitiesCount] = NUM_AUDIOENTITIES;
return;
}
}
@@ -230,15 +234,17 @@ cAudioManager::GetEntityPointer(int32 id)
return NULL;
}
static Const uint8 OneShotPriority[] = {
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, 3, 5, 2, 2, 1, 1, 3, 1, 3, 3, 1, 1, 1, 4, 4, 3, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 1, 1, 3, 2, 2, 2, 2, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 3, 1, 1, 1, 9,
2, 2, 0, 0, 0, 0, 3, 3, 5, 1, 1, 1, 1, 3, 4, 7, 6, 6, 6, 6, 1, 3, 4, 3, 4, 2, 1, 3, 5, 4, 6, 6, 1, 3,
1, 1, 1, 0, 0, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
void
cAudioManager::PlayOneShot(int32 index, uint16 sound, float vol)
{
static const uint8 OneShotPriority[] = {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, 3, 5, 2, 2, 1, 1, 3, 1, 3, 3, 1, 1, 1, 4, 4, 3, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 1, 1, 3, 2, 2, 2, 2, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 3, 1, 1, 1, 9,
2, 2, 0, 0, 0, 0, 3, 3, 5, 1, 1, 1, 1, 3, 4, 7, 6, 6, 6, 6, 1, 3, 4, 3, 4, 2, 1, 3, 5, 4, 6, 6, 1, 3,
1, 1, 1, 0, 0, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
if (m_bIsInitialised) {
if (index >= 0 && index < NUM_AUDIOENTITIES) {
tAudioEntity &entity = m_asAudioEntities[index];
@@ -254,25 +260,25 @@ cAudioManager::PlayOneShot(int32 index, uint16 sound, float vol)
int32 i = 0;
while (TRUE) {
if (i >= entity.m_AudioEvents) {
if (entity.m_AudioEvents < ARRAY_SIZE(entity.m_awAudioEvent)) {
if (entity.m_AudioEvents < NUM_AUDIOENTITY_EVENTS) {
entity.m_awAudioEvent[i] = sound;
entity.m_afVolume[i] = vol;
++entity.m_AudioEvents;
entity.m_AudioEvents++;
}
return;
}
if (OneShotPriority[entity.m_awAudioEvent[i]] > OneShotPriority[sound])
break;
++i;
i++;
}
if (i < NUM_AUDIOENTITY_EVENTS - 1) {
memmove(&entity.m_awAudioEvent[i + 1], &entity.m_awAudioEvent[i], (NUM_AUDIOENTITY_EVENTS - 1 - i) * NUM_AUDIOENTITY_EVENTS / 2);
memmove(&entity.m_afVolume[i + 1], &entity.m_afVolume[i], (NUM_AUDIOENTITY_EVENTS - 1 - i) * NUM_AUDIOENTITY_EVENTS);
memmove(&entity.m_awAudioEvent[i + 1], &entity.m_awAudioEvent[i], (NUM_AUDIOENTITY_EVENTS - 1 - i) * sizeof(int16));
memmove(&entity.m_afVolume[i + 1], &entity.m_afVolume[i], (NUM_AUDIOENTITY_EVENTS - 1 - i) * sizeof(float));
}
entity.m_awAudioEvent[i] = sound;
entity.m_afVolume[i] = vol;
if (entity.m_AudioEvents < ARRAY_SIZE(entity.m_awAudioEvent))
++entity.m_AudioEvents;
if (entity.m_AudioEvents < NUM_AUDIOENTITY_EVENTS)
entity.m_AudioEvents++;
}
}
}
@@ -317,14 +323,14 @@ cAudioManager::ResetTimers(uint32 time)
m_bTimerJustReset = TRUE;
m_nTimer = time;
ClearRequestedQueue();
if (m_nActiveSampleQueue) {
m_nActiveSampleQueue = 0;
if (m_nActiveQueue) {
m_nActiveQueue = 0;
ClearRequestedQueue();
m_nActiveSampleQueue = 1;
m_nActiveQueue = 1;
} else {
m_nActiveSampleQueue = 1;
m_nActiveQueue = 1;
ClearRequestedQueue();
m_nActiveSampleQueue = 0;
m_nActiveQueue = 0;
}
ClearActiveSamples();
ClearMissionAudio();
@@ -344,7 +350,7 @@ cAudioManager::DestroyAllGameCreatedEntities()
cAudioScriptObject *entity;
if (m_bIsInitialised) {
for (uint32 i = 0; i < ARRAY_SIZE(m_asAudioEntities); i++) {
for (uint32 i = 0; i < NUM_AUDIOENTITIES; i++) {
if (m_asAudioEntities[i].m_bIsUsed) {
switch (m_asAudioEntities[i].m_nType) {
case AUDIOTYPE_PHYSICAL:
@@ -422,13 +428,13 @@ cAudioManager::SetCurrent3DProvider(uint8 which)
#else
if (!m_bIsInitialised)
return -1;
for (uint8 i = 0; i < m_nActiveSamples + 1; ++i)
for (uint8 i = 0; i < m_nActiveSamples + 1; i++)
SampleManager.StopChannel(i);
ClearRequestedQueue();
if (m_nActiveSampleQueue == 0)
m_nActiveSampleQueue = 1;
if (m_nActiveQueue == 0)
m_nActiveQueue = 1;
else
m_nActiveSampleQueue = 0;
m_nActiveQueue = 0;
ClearRequestedQueue();
ClearActiveSamples();
int8 current = SampleManager.SetCurrent3DProvider(which);
@@ -436,7 +442,7 @@ cAudioManager::SetCurrent3DProvider(uint8 which)
#ifdef EXTERNAL_3D_SOUND
m_nActiveSamples = SampleManager.GetMaximumSupportedChannels();
if (m_nActiveSamples > 1)
--m_nActiveSamples;
m_nActiveSamples--;
#endif
}
return current;
@@ -463,17 +469,15 @@ cAudioManager::IsMP3RadioChannelAvailable()
void
cAudioManager::ReleaseDigitalHandle()
{
if (m_bIsInitialised) {
if (m_bIsInitialised)
SampleManager.ReleaseDigitalHandle();
}
}
void
cAudioManager::ReacquireDigitalHandle()
{
if (m_bIsInitialised) {
if (m_bIsInitialised)
SampleManager.ReacquireDigitalHandle();
}
}
#ifdef AUDIO_REFLECTIONS
@@ -514,23 +518,23 @@ cAudioManager::ServiceSoundEffects()
if(CTimer::GetLogicalFramesPassed() != 0)
#endif
m_bReduceReleasingPriority = (m_FrameCounter++ % 5) == 0;
if (m_nUserPause && !m_nPreviousUserPause) {
if (m_bIsPaused && !m_bWasPaused) {
for (int32 i = 0; i < NUM_CHANNELS; i++)
SampleManager.StopChannel(i);
ClearRequestedQueue();
if (m_nActiveSampleQueue) {
m_nActiveSampleQueue = 0;
if (m_nActiveQueue) {
m_nActiveQueue = 0;
ClearRequestedQueue();
m_nActiveSampleQueue = 1;
m_nActiveQueue = 1;
} else {
m_nActiveSampleQueue = 1;
m_nActiveQueue = 1;
ClearRequestedQueue();
m_nActiveSampleQueue = 0;
m_nActiveQueue = 0;
}
ClearActiveSamples();
}
m_nActiveSampleQueue = m_nActiveSampleQueue == 1 ? 0 : 1;
m_nActiveQueue = m_nActiveQueue == 1 ? 0 : 1;
ProcessReverb();
ProcessSpecial();
ClearRequestedQueue();
@@ -547,7 +551,7 @@ cAudioManager::ServiceSoundEffects()
#ifdef AUDIO_OAL
SampleManager.Service();
#endif
for (int32 i = 0; i < m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal; ++i) {
for (int32 i = 0; i < m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal; i++) {
cAudioScriptObject *object = (cAudioScriptObject *)m_asAudioEntities[m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]].m_pEntity;
delete object;
m_asAudioEntities[m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]].m_pEntity = nil;
@@ -586,7 +590,7 @@ cAudioManager::ComputePan(float dist, CVector *vec)
Const static uint8 PanTable[64] = {0, 3, 8, 12, 16, 19, 22, 24, 26, 28, 30, 31, 33, 34, 36, 37, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 53,
54, 55, 55, 56, 56, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63};
int32 index = vec->x / (dist / 64.f);
int32 index = vec->x / (dist / 64.0f);
index = Min(63, ABS(index));
if (vec->x > 0.f)
@@ -619,15 +623,15 @@ cAudioManager::RandomDisplacement(uint32 seed)
static bool8 bPos = TRUE;
static uint32 Adjustment = 0;
if (!seed)
if (seed == 0)
return 0;
value = m_anRandomTable[(Adjustment + seed) % 5] % seed;
Adjustment += value;
if (value % 2) {
if (value % 2)
bPos = !bPos;
}
if (!bPos)
value = -value;
return value;
@@ -636,9 +640,9 @@ cAudioManager::RandomDisplacement(uint32 seed)
void
cAudioManager::InterrogateAudioEntities()
{
for (int32 i = 0; i < m_nAudioEntitiesTotal; i++) {
ProcessEntity(m_anAudioEntityIndices[i]);
m_asAudioEntities[m_anAudioEntityIndices[i]].m_AudioEvents = 0;
for (uint32 i = 0; i < m_nAudioEntitiesCount; i++) {
ProcessEntity(m_aAudioEntityOrderList[i]);
m_asAudioEntities[m_aAudioEntityOrderList[i]].m_AudioEvents = 0;
}
}
@@ -653,14 +657,13 @@ cAudioManager::AddSampleToRequestedQueue()
if (m_sQueueSample.m_nSampleIndex < TOTAL_AUDIO_SAMPLES) {
finalPriority = m_sQueueSample.m_nPriority * (MAX_VOLUME - m_sQueueSample.m_nVolume);
sampleIndex = m_SampleRequestQueuesStatus[m_nActiveSampleQueue];
sampleIndex = m_nRequestedCount[m_nActiveQueue];
if (sampleIndex >= m_nActiveSamples) {
sampleIndex = m_abSampleQueueIndexTable[m_nActiveSampleQueue][m_nActiveSamples - 1];
if (m_asSamples[m_nActiveSampleQueue][sampleIndex].m_nFinalPriority <= finalPriority)
sampleIndex = m_aRequestedOrderList[m_nActiveQueue][m_nActiveSamples - 1];
if (m_aRequestedQueue[m_nActiveQueue][sampleIndex].m_nFinalPriority <= finalPriority)
return;
} else {
++m_SampleRequestQueuesStatus[m_nActiveSampleQueue];
}
} else
m_nRequestedCount[m_nActiveQueue]++;
#if GTA_VERSION < GTA3_PC_10
if (m_sQueueSample.m_bStatic) {
if (m_sQueueSample.m_nLoopCount > 0)
@@ -688,7 +691,7 @@ cAudioManager::AddSampleToRequestedQueue()
m_sQueueSample.m_bReverb = FALSE;
#endif
m_asSamples[m_nActiveSampleQueue][sampleIndex] = m_sQueueSample;
m_aRequestedQueue[m_nActiveQueue][sampleIndex] = m_sQueueSample;
AddDetailsToRequestedOrderList(sampleIndex);
#ifdef AUDIO_REFLECTIONS
@@ -704,15 +707,14 @@ cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
uint32 i = 0;
if (sample != 0) {
for (; i < sample; i++) {
if (m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]].m_nFinalPriority >
m_asSamples[m_nActiveSampleQueue][sample].m_nFinalPriority)
if (m_aRequestedQueue[m_nActiveQueue][m_aRequestedOrderList[m_nActiveQueue][i]].m_nFinalPriority >
m_aRequestedQueue[m_nActiveQueue][sample].m_nFinalPriority)
break;
}
if (i < sample) {
memmove(&m_abSampleQueueIndexTable[m_nActiveSampleQueue][i + 1], &m_abSampleQueueIndexTable[m_nActiveSampleQueue][i], m_nActiveSamples - i - 1);
}
if (i < sample)
memmove(&m_aRequestedOrderList[m_nActiveQueue][i + 1], &m_aRequestedOrderList[m_nActiveQueue][i], m_nActiveSamples - i - 1);
}
m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = sample;
m_aRequestedOrderList[m_nActiveQueue][i] = sample;
}
#ifdef AUDIO_REFLECTIONS
@@ -721,20 +723,21 @@ cAudioManager::AddReflectionsToRequestedQueue()
{
float reflectionDistance;
int32 noise;
uint8 emittingVolume = (m_sQueueSample.m_nVolume / 2) + (m_sQueueSample.m_nVolume / 8);
uint32 oldCounter = m_sQueueSample.m_nCounter;
uint8 emittingVolume = (m_sQueueSample.m_nVolume >> 1) + (m_sQueueSample.m_nVolume >> 3);
for (uint32 i = 0; i < ARRAY_SIZE(m_afReflectionsDistances); i++) {
reflectionDistance = m_afReflectionsDistances[i];
if (reflectionDistance > 0.0f && reflectionDistance < 100.f && reflectionDistance < m_sQueueSample.m_MaxDistance) {
m_sQueueSample.m_nReflectionDelay = (reflectionDistance * 500.f / 1029.f);
if (reflectionDistance > 0.0f && reflectionDistance < 100.0f && reflectionDistance < m_sQueueSample.m_MaxDistance) {
m_sQueueSample.m_nReflectionDelay = (reflectionDistance * 500.0f / 1029.0f);
if (m_sQueueSample.m_nReflectionDelay > 5) {
m_sQueueSample.m_fDistance = m_afReflectionsDistances[i];
SET_EMITTING_VOLUME(emittingVolume);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_MaxDistance, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume > emittingVolume / 16) {
m_sQueueSample.m_nCounter += (i + 1) * 256;
if (m_sQueueSample.m_nVolume > emittingVolume >> 4) {
m_sQueueSample.m_nCounter = oldCounter + ((i + 1) << 8);
if (m_sQueueSample.m_nLoopCount > 0) {
noise = RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
noise = RandomDisplacement(m_sQueueSample.m_nFrequency >> 5);
if (noise > 0)
m_sQueueSample.m_nFrequency -= noise;
else
@@ -810,17 +813,17 @@ cAudioManager::AddReleasingSounds()
bool8 toProcess[44];
#endif
int8 queue = m_nActiveSampleQueue == 0 ? 1 : 0;
uint8 queue = m_nActiveQueue == 0 ? 1 : 0;
for (int32 i = 0; i < m_SampleRequestQueuesStatus[queue]; i++) {
tSound &sample = m_asSamples[queue][m_abSampleQueueIndexTable[queue][i]];
for (uint8 i = 0; i < m_nRequestedCount[queue]; i++) {
tSound &sample = m_aRequestedQueue[queue][m_aRequestedOrderList[queue][i]];
if (sample.m_bIsPlayingFinished)
continue;
toProcess[i] = FALSE;
for (int32 j = 0; j < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; j++) {
if (sample.m_nEntityIndex == m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][j]].m_nEntityIndex &&
sample.m_nCounter == m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][j]].m_nCounter) {
for (uint8 j = 0; j < m_nRequestedCount[m_nActiveQueue]; j++) {
if (sample.m_nEntityIndex == m_aRequestedQueue[m_nActiveQueue][m_aRequestedOrderList[m_nActiveQueue][j]].m_nEntityIndex &&
sample.m_nCounter == m_aRequestedQueue[m_nActiveQueue][m_aRequestedOrderList[m_nActiveQueue][j]].m_nCounter) {
toProcess[i] = TRUE;
break;
}
@@ -840,9 +843,9 @@ cAudioManager::AddReleasingSounds()
if (sample.m_nSampleIndex >= SAMPLEBANK_PED_START && sample.m_nSampleIndex <= SAMPLEBANK_PED_END) { // check if it's ped comment
uint8 vol;
if (CWorld::GetIsLineOfSightClear(TheCamera.GetPosition(), sample.m_vecPos, true, false, false, false, false, false))
vol = MAX_VOLUME;
vol = PED_COMMENT_VOLUME;
else
vol = 31;
vol = PED_COMMENT_VOLUME_BEHIND_WALL;
#ifdef EXTERNAL_3D_SOUND
sample.m_nEmittingVolume = vol;
#endif
@@ -858,7 +861,7 @@ cAudioManager::AddReleasingSounds()
if (sample.m_nEmittingVolumeChange > 0)
sample.m_nEmittingVolumeChange = volumeDiff * sample.m_nEmittingVolumeChange;
#endif
sample.m_nVolume = Min(127, newVolume);
sample.m_nVolume = Min(MAX_VOLUME, newVolume);
}
}
if (sample.m_nVolume == 0)
@@ -954,18 +957,18 @@ cAudioManager::ProcessActiveQueues()
#endif
#ifdef USE_TIME_SCALE_FOR_AUDIO
float timeScale = m_nUserPause ? 1.0f : CTimer::GetTimeScale();
float timeScale = m_bIsPaused ? 1.0f : CTimer::GetTimeScale();
#endif
for (int32 i = 0; i < m_nActiveSamples; i++) {
m_asSamples[m_nActiveSampleQueue][i].m_bIsBeingPlayed = FALSE;
for (uint8 i = 0; i < m_nActiveSamples; i++) {
m_aRequestedQueue[m_nActiveQueue][i].m_bIsBeingPlayed = FALSE;
m_asActiveSamples[i].m_bIsBeingPlayed = FALSE;
}
for (int32 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) {
tSound &sample = m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]];
for (uint8 i = 0; i < m_nRequestedCount[m_nActiveQueue]; i++) {
tSound &sample = m_aRequestedQueue[m_nActiveQueue][m_aRequestedOrderList[m_nActiveQueue][i]];
if (sample.m_nSampleIndex != NO_SAMPLE) {
for (int32 j = 0; j < m_nActiveSamples; j++) {
for (uint8 j = 0; j < m_nActiveSamples; j++) {
if (sample.m_nEntityIndex == m_asActiveSamples[j].m_nEntityIndex && sample.m_nCounter == m_asActiveSamples[j].m_nCounter &&
sample.m_nSampleIndex == m_asActiveSamples[j].m_nSampleIndex) {
if (sample.m_nLoopCount > 0) {
@@ -1032,7 +1035,7 @@ cAudioManager::ProcessActiveQueues()
vol = Clamp2((int8)sample.m_nVolume, (int8)m_asActiveSamples[j].m_nVolume, 10);
m_asActiveSamples[j].m_nVolume = vol;
}
SampleManager.SetChannelVolume(j, m_bDoubleVolume ? 2 * Min(63, vol) : vol);
SampleManager.SetChannelVolume(j, m_bDoubleVolume ? 2 * Min(63, m_asActiveSamples[j].m_nVolume) : m_asActiveSamples[j].m_nVolume);
#endif
TranslateEntity(&sample.m_vecPos, &position);
#ifdef EXTERNAL_3D_SOUND
@@ -1052,15 +1055,15 @@ cAudioManager::ProcessActiveQueues()
}
}
}
for (int32 i = 0; i < m_nActiveSamples; i++) {
for (uint8 i = 0; i < m_nActiveSamples; i++) {
if (m_asActiveSamples[i].m_nSampleIndex != NO_SAMPLE && !m_asActiveSamples[i].m_bIsBeingPlayed) {
SampleManager.StopChannel(i);
m_asActiveSamples[i].m_nSampleIndex = NO_SAMPLE;
m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE;
}
}
for (uint8 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) {
tSound &sample = m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]];
for (uint8 i = 0; i < m_nRequestedCount[m_nActiveQueue]; i++) {
tSound &sample = m_aRequestedQueue[m_nActiveQueue][m_aRequestedOrderList[m_nActiveQueue][i]];
if (!sample.m_bIsBeingPlayed && !sample.m_bIsPlayingFinished && m_asAudioEntities[sample.m_nEntityIndex].m_bIsUsed && sample.m_nSampleIndex < NO_SAMPLE) {
#ifdef AUDIO_REFLECTIONS
if (sample.m_nCounter > 255 && sample.m_nLoopCount > 0 && sample.m_nReflectionDelay > 0) { // check if reflection
@@ -1154,10 +1157,9 @@ cAudioManager::ProcessActiveQueues()
void
cAudioManager::ClearRequestedQueue()
{
for (int32 i = 0; i < m_nActiveSamples; i++) {
m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = m_nActiveSamples;
}
m_SampleRequestQueuesStatus[m_nActiveSampleQueue] = 0;
for (uint8 i = 0; i < m_nActiveSamples; i++)
m_aRequestedOrderList[m_nActiveQueue][i] = m_nActiveSamples;
m_nRequestedCount[m_nActiveQueue] = 0;
}
void
@@ -1203,26 +1205,28 @@ cAudioManager::ClearActiveSamples()
}
void
cAudioManager::GenerateIntegerRandomNumberTable()
{
for (uint32 i = 0; i < ARRAY_SIZE(m_anRandomTable); i++)
m_anRandomTable[i] = myrand();
}
#ifdef GTA_PS2
bool8
cAudioManager::LoadBankIfNecessary(uint8 bank)
{
if(!SampleManager.IsSampleBankLoaded(bank))
SampleManager.LoadSampleBank(bank);
}
void
cAudioManager::GenerateIntegerRandomNumberTable()
{
for (int32 i = 0; i < ARRAY_SIZE(m_anRandomTable); i++) {
m_anRandomTable[i] = myrand();
}
return SampleManager.LoadSampleBank(bank);
return FALSE;
}
#endif
#ifdef EXTERNAL_3D_SOUND
void
cAudioManager::AdjustSamplesVolume()
{
for (int i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) {
tSound *pSample = &m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]];
for (uint8 i = 0; i < m_nRequestedCount[m_nActiveQueue]; i++) {
tSound *pSample = &m_aRequestedQueue[m_nActiveQueue][m_aRequestedOrderList[m_nActiveQueue][i]];
if (!pSample->m_bIs2D)
pSample->m_nEmittingVolume = ComputeEmittingVolume(pSample->m_nEmittingVolume, pSample->m_MaxDistance, pSample->m_fDistance);

View File

@@ -58,7 +58,7 @@ public:
bool8 m_bIsBeingPlayed; // Set to TRUE when the sound was added or changed on current frame to avoid it being overwritten
bool8 m_bIsPlayingFinished; // Not sure about the name. Set to TRUE when sampman channel becomes free
#if GTA_VERSION < GTA3_PC_10
int32 unk; // Only on PS2, used by static non-looped sounds (AFAIK)
int32 unk; // (inherited from GTA 2) Only on PS2, used by static non-looped sounds (AFAIK)
// Looks like it's keeping a number of frames left to play with the purpose of setting m_bIsPlayingFinished=TRUE once value reaches 0
// Default value is -3 for whatever reason
#endif
@@ -96,7 +96,7 @@ public:
CVector m_vecPos;
float m_fDistance;
uint8 m_nVolume;
int8 m_nProcess;
int8 m_nLoadingTimeout; // how many iterations we gonna wait until dropping the sample if it's still not loaded (only useful on PS2)
#if defined(EXTERNAL_3D_SOUND) && defined(FIX_BUGS)
uint8 m_nEmittingVolume;
#endif
@@ -107,22 +107,22 @@ VALIDATE_SIZE(tPedComment, 28);
class cPedComments
{
public:
tPedComment m_asPedComments[NUM_PED_COMMENTS_BANKS][NUM_PED_COMMENTS_SLOTS];
uint8 m_nIndexMap[NUM_PED_COMMENTS_BANKS][NUM_PED_COMMENTS_SLOTS];
uint8 m_nCommentsInBank[NUM_PED_COMMENTS_BANKS];
uint8 m_nActiveBank;
tPedComment m_aPedCommentQueue[NUM_SOUND_QUEUES][NUM_PED_COMMENTS_SLOTS];
uint8 m_aPedCommentOrderList[NUM_SOUND_QUEUES][NUM_PED_COMMENTS_SLOTS];
uint8 m_nPedCommentCount[NUM_SOUND_QUEUES];
uint8 m_nActiveQueue;
cPedComments()
{
for (int i = 0; i < NUM_PED_COMMENTS_SLOTS; i++)
for (int j = 0; j < NUM_PED_COMMENTS_BANKS; j++) {
m_asPedComments[j][i].m_nProcess = -1;
m_nIndexMap[j][i] = NUM_PED_COMMENTS_SLOTS;
for (int j = 0; j < NUM_SOUND_QUEUES; j++) {
m_aPedCommentQueue[j][i].m_nLoadingTimeout = -1;
m_aPedCommentOrderList[j][i] = NUM_PED_COMMENTS_SLOTS;
}
for (int i = 0; i < NUM_PED_COMMENTS_BANKS; i++)
m_nCommentsInBank[i] = 0;
m_nActiveBank = 0;
for (int i = 0; i < NUM_SOUND_QUEUES; i++)
m_nPedCommentCount[i] = 0;
m_nActiveQueue = 0;
}
void Add(tPedComment *com);
void Process();
@@ -204,7 +204,7 @@ enum {
};
enum PLAY_STATUS { PLAY_STATUS_STOPPED = 0, PLAY_STATUS_PLAYING, PLAY_STATUS_FINISHED };
enum LOADING_STATUS { LOADING_STATUS_NOT_LOADED = 0, LOADING_STATUS_LOADED, LOADING_STATUS_FAILED };
enum LOADING_STATUS { LOADING_STATUS_NOT_LOADED = 0, LOADING_STATUS_LOADED, LOADING_STATUS_LOADING };
class cAudioManager
{
@@ -219,16 +219,16 @@ public:
#endif
float m_fSpeedOfSound;
bool8 m_bTimerJustReset;
int32 m_nTimer;
uint32 m_nTimer;
tSound m_sQueueSample;
uint8 m_nActiveSampleQueue;
tSound m_asSamples[NUM_SOUNDS_SAMPLES_BANKS][NUM_CHANNELS_GENERIC];
uint8 m_abSampleQueueIndexTable[NUM_SOUNDS_SAMPLES_BANKS][NUM_CHANNELS_GENERIC];
uint8 m_SampleRequestQueuesStatus[NUM_SOUNDS_SAMPLES_BANKS];
uint8 m_nActiveQueue;
tSound m_aRequestedQueue[NUM_SOUND_QUEUES][NUM_CHANNELS_GENERIC];
uint8 m_aRequestedOrderList[NUM_SOUND_QUEUES][NUM_CHANNELS_GENERIC];
uint8 m_nRequestedCount[NUM_SOUND_QUEUES];
tSound m_asActiveSamples[NUM_CHANNELS_GENERIC];
tAudioEntity m_asAudioEntities[NUM_AUDIOENTITIES];
int32 m_anAudioEntityIndices[NUM_AUDIOENTITIES];
int32 m_nAudioEntitiesTotal;
uint32 m_aAudioEntityOrderList[NUM_AUDIOENTITIES];
uint32 m_nAudioEntitiesCount;
#ifdef AUDIO_REFLECTIONS
CVector m_avecReflectionsPos[MAX_REFLECTIONS];
float m_afReflectionsDistances[MAX_REFLECTIONS];
@@ -253,13 +253,13 @@ public:
uint8 m_nMissionAudioLoadingStatus;
uint8 m_nMissionAudioPlayStatus;
bool8 m_bIsMissionAudioPlaying;
int32 m_nMissionAudioFramesToPlay;
int32 m_nMissionAudioFramesToPlay; // possibly unsigned
bool8 m_bIsMissionAudioAllowedToPlay;
int32 m_anRandomTable[5];
uint8 m_nTimeSpent;
bool8 m_nUserPause;
bool8 m_nPreviousUserPause;
bool8 m_bIsPaused;
bool8 m_bWasPaused;
uint32 m_FrameCounter;
cAudioManager();
@@ -318,7 +318,9 @@ public:
void ClearRequestedQueue(); // inlined on PS2
void ClearActiveSamples();
void GenerateIntegerRandomNumberTable(); // inlined on PS2
void LoadBankIfNecessary(uint8 bank); // this is used only on PS2 but technically not a platform code
#ifdef GTA_PS2
bool8 LoadBankIfNecessary(uint8 bank); // this is used only on PS2 but technically not a platform code
#endif
#ifdef EXTERNAL_3D_SOUND // actually must have been && AUDIO_MSS as well
void AdjustSamplesVolume();
@@ -335,7 +337,7 @@ public:
float GetDistanceSquared(const CVector &v);
void CalculateDistance(bool8 &condition, float dist);
void ProcessSpecial();
void ProcessEntity(int32 sound);
void ProcessEntity(int32 id);
void ProcessPhysical(int32 id);
// vehicles
@@ -355,7 +357,7 @@ public:
bool8 ProcessVehicleSkidding(cVehicleParams &params);
float GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cTransmission *transmission, float velocityChange);
float GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cTransmission *transmission, float velocityChange); // inlined on PS2
void ProcessVehicleHorn(cVehicleParams &params);
bool8 ProcessVehicleHorn(cVehicleParams &params);
bool8 UsesSiren(uint32 model); // inlined on PS2
bool8 UsesSirenSwitching(uint32 model); // inlined on PS2
bool8 ProcessVehicleSirenOrAlarm(cVehicleParams &params);
@@ -473,9 +475,9 @@ public:
uint32 GetGenericFemaleTalkSfx(uint16 sound);
// particles
void ProcessExplosions(int32 explosion);
void ProcessFires(int32 entity);
void ProcessWaterCannon(int32);
void ProcessExplosions(int32 id);
void ProcessFires(int32 id);
void ProcessWaterCannon(int32 id);
// script objects
void ProcessScriptObject(int32 id); // inlined on PS2
@@ -576,3 +578,10 @@ static_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error");
#endif
extern cAudioManager AudioManager;
enum
{
PED_COMMENT_VOLUME = 127,
PED_COMMENT_VOLUME_BEHIND_WALL = 31,
COLLISION_MAX_DIST = 60,
};

View File

@@ -564,8 +564,9 @@ enum eSfxSample
// bank 59
SFX_EXPLOSION_1,
SFX_BRIDGE_OPEN_WARNING,
#ifndef GTA_PS2
SFX_PAGER, // used to be ped comment on PS2
#endif
SFX_COP_VOICE_1_ARREST_1,
SFX_COP_VOICE_1_ARREST_2,
@@ -703,6 +704,9 @@ enum eSfxSample
SFX_POLICE_HELI_27,
SFX_POLICE_HELI_28,
SFX_POLICE_HELI_29,
#ifdef GTA_PS2
SFX_MISSION_CAT1,
#endif
SFX_CHUNKY_DEATH,
SFX_BLACK_DOCKER_VOICE_1_DRIVER_ABUSE_1,
SFX_BLACK_DOCKER_VOICE_1_DRIVER_ABUSE_2,
@@ -761,6 +765,9 @@ enum eSfxSample
SFX_ARMY_VOICE_2_CHASE_13,
SFX_ARMY_VOICE_2_CHASE_14,
SFX_ARMY_VOICE_2_CHASE_15,
#ifdef GTA_PS2
SFX_PAGER,
#endif
SFX_CLAUDE_LOW_DAMAGE_GRUNT_1,
SFX_CLAUDE_LOW_DAMAGE_GRUNT_2,
SFX_CLAUDE_LOW_DAMAGE_GRUNT_3,
@@ -3140,14 +3147,127 @@ enum eSfxSample
SFX_AMMU_D,
SFX_AMMU_E,
SFX_AMMU_F,
#ifdef GTA_PS2
SFX_MISSION_LIB_A1,
SFX_MISSION_LIB_A2,
SFX_MISSION_LIB_A,
SFX_MISSION_LIB_B,
SFX_MISSION_LIB_C,
SFX_MISSION_LIB_D,
SFX_MISSION_L2_A,
SFX_MISSION_J4T_1,
SFX_MISSION_J4T_2,
SFX_MISSION_J4T_3,
SFX_MISSION_J4T_4,
SFX_MISSION_J4_A,
SFX_MISSION_J4_B,
SFX_MISSION_J4_C,
SFX_MISSION_J4_D,
SFX_MISSION_J4_E,
SFX_MISSION_J4_F,
SFX_MISSION_J6_1,
SFX_MISSION_J6_A,
SFX_MISSION_J6_B,
SFX_MISSION_J6_C,
SFX_MISSION_J6_D,
SFX_MISSION_T4_A,
SFX_MISSION_S1_A,
SFX_MISSION_S1_A1,
SFX_MISSION_S1_B,
SFX_MISSION_S1_C,
SFX_MISSION_S1_C1,
SFX_MISSION_S1_D,
SFX_MISSION_S1_E,
SFX_MISSION_S1_F,
SFX_MISSION_S1_G,
SFX_MISSION_S1_H,
SFX_MISSION_S1_I,
SFX_MISSION_S1_J,
SFX_MISSION_S1_K,
SFX_MISSION_S1_L,
SFX_MISSION_S3_A,
SFX_MISSION_S3_B,
SFX_MISSION_EL3_A,
SFX_MISSION_MF1_A,
SFX_MISSION_MF2_A,
SFX_MISSION_MF3_A,
SFX_MISSION_MF3_B,
SFX_MISSION_MF3_B1,
SFX_MISSION_MF3_C,
SFX_MISSION_MF4_A,
SFX_MISSION_MF4_B,
SFX_MISSION_MF4_C,
SFX_MISSION_A1_A,
SFX_MISSION_A3_A,
SFX_MISSION_A5_A,
SFX_MISSION_A4_A,
SFX_MISSION_A4_B,
SFX_MISSION_A4_C,
SFX_MISSION_A4_D,
SFX_MISSION_K1_A,
SFX_MISSION_K3_A,
SFX_MISSION_R1_A,
SFX_MISSION_R2_A,
SFX_MISSION_R2_B,
SFX_MISSION_R2_C,
SFX_MISSION_R2_D,
SFX_MISSION_R2_E,
SFX_MISSION_R2_F,
SFX_MISSION_R2_G,
SFX_MISSION_R2_H,
SFX_MISSION_R5_A,
SFX_MISSION_R6_A,
SFX_MISSION_R6_A1,
SFX_MISSION_R6_B,
SFX_MISSION_LO2_A,
SFX_MISSION_LO6_A,
SFX_MISSION_YD2_A,
SFX_MISSION_YD2_B,
SFX_MISSION_YD2_C,
SFX_MISSION_YD2_C1,
SFX_MISSION_YD2_D,
SFX_MISSION_YD2_E,
SFX_MISSION_YD2_F,
SFX_MISSION_YD2_G,
SFX_MISSION_YD2_H,
SFX_MISSION_YD2_ASS,
SFX_MISSION_YD2_OK,
SFX_MISSION_H5_A,
SFX_MISSION_H5_B,
SFX_MISSION_H5_C,
SFX_MISSION_DOOR_1,
SFX_MISSION_DOOR_2,
SFX_MISSION_DOOR_3,
SFX_MISSION_DOOR_4,
SFX_MISSION_DOOR_5,
SFX_MISSION_DOOR_6,
SFX_MISSION_T3_A,
SFX_MISSION_T3_B,
SFX_MISSION_T3_C,
SFX_MISSION_K1_B,
SFX_MISSION_AMMU_A,
SFX_MISSION_AMMU_B,
SFX_MISSION_AMMU_C,
#endif
TOTAL_AUDIO_SAMPLES,
NO_SAMPLE,
// shorthands
SAMPLEBANK_START = SFX_CAR_HORN_JEEP,
#ifdef GTA_PS2
SAMPLEBANK_END = SFX_INFO,
SAMPLEBANK_MAX = SFX_INFO + 1,
#else
SAMPLEBANK_END = SFX_PAGER,
SAMPLEBANK_MAX = SFX_PAGER + 1,
#endif
SAMPLEBANK_PED_START = SFX_COP_VOICE_1_ARREST_1,
#ifdef GTA_PS2
SAMPLEBANK_PED_END = SFX_MISSION_AMMU_C,
SAMPLEBANK_PED_MAX = SFX_MISSION_AMMU_C + 1,
#else
SAMPLEBANK_PED_END = SFX_AMMU_F,
SAMPLEBANK_PED_MAX = SFX_AMMU_F + 1,
#endif
};

View File

@@ -363,14 +363,14 @@ cMusicManager::GetRadioInCar(void)
CVehicle *veh = FindPlayerVehicle();
if (veh != nil){
if (UsesPoliceRadio(veh)) {
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && !AudioManager.m_nUserPause))
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && !AudioManager.m_bIsPaused))
return POLICE_RADIO;
return m_nRadioInCar;
} else return veh->m_nRadioStation;
}
}
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && !AudioManager.m_nUserPause))
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && !AudioManager.m_bIsPaused))
return RADIO_OFF;
return m_nRadioInCar;
}
@@ -418,7 +418,7 @@ cMusicManager::ResetMusicAfterReload()
void
cMusicManager::ResetTimers(int32 time)
cMusicManager::ResetTimers(uint32 time)
{
m_bResetTimers = TRUE;
m_nResetTime = time;
@@ -469,7 +469,7 @@ cMusicManager::ServiceFrontEndMode()
switch (m_nNextTrack)
{
case STREAMED_SOUND_MISSION_COMPLETED:
if (!AudioManager.m_nUserPause)
if (!AudioManager.m_bIsPaused)
ChangeMusicMode(MUSICMODE_GAME);
break;
case STREAMED_SOUND_GAME_COMPLETED:
@@ -543,7 +543,7 @@ cMusicManager::ServiceGameMode()
nFramesSinceCutsceneEnded = -1;
}
if (AudioManager.m_nPreviousUserPause)
if (AudioManager.m_bWasPaused)
m_bPreviousPlayerInCar = FALSE;
if (!m_bPlayerInCar) {
if (m_bPreviousPlayerInCar) {

View File

@@ -66,7 +66,7 @@ public:
void ResetMusicAfterReload();
void ResetTimers(int32);
void ResetTimers(uint32);
void Service();
void ServiceFrontEndMode();
void ServiceGameMode();

View File

@@ -149,20 +149,20 @@ cAudioManager::ServicePoliceRadio()
if(!m_bIsInitialised) return;
if(!m_nUserPause) {
if(!m_bIsPaused) {
bool8 crimeReport = SetupCrimeReport();
#ifdef FIX_BUGS // Crash at 0x5fe6ef
if(CReplay::IsPlayingBack() || !FindPlayerPed() || !FindPlayerPed()->m_pWanted)
return;
#endif
wantedLevel = FindPlayerPed()->m_pWanted->GetWantedLevel();
if(!crimeReport) {
if(wantedLevel != 0) {
if(nLastSeen != 0) {
if (!crimeReport) {
if (wantedLevel != 0) {
if (nLastSeen != 0) {
#ifdef FIX_BUGS
nLastSeen -= CTimer::GetLogicalFramesPassed();
#else
--nLastSeen;
nLastSeen--;
#endif
} else {
nLastSeen = m_anRandomTable[1] % 1000 + 2000;
@@ -179,26 +179,34 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
{
bool8 processed = FALSE;
uint32 sample;
int32 freq;
uint32 freq;
static int cWait = 0;
static bool8 bChannelOpen = FALSE;
static uint8 bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_STOPPED;
static int32 PoliceChannelFreq = 5500;
static uint32 PoliceChannelFreq = 5500;
if (!m_bIsInitialised) return;
if (m_nUserPause) {
if (m_bIsPaused) {
#ifdef GTA_PS2
if (SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO))
SampleManager.SetChannelFrequency(CHANNEL_POLICE_RADIO, 0);
#else
if (SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) SampleManager.StopChannel(CHANNEL_POLICE_RADIO);
if (g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES && bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING &&
SampleManager.IsStreamPlaying(1)) {
SampleManager.IsStreamPlaying(1))
SampleManager.PauseStream(TRUE, 1);
}
#endif
} else {
if (m_nPreviousUserPause && g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES &&
bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING) {
#ifdef GTA_PS2
if (m_bWasPaused)
SampleManager.SetChannelFrequency(CHANNEL_POLICE_RADIO, PoliceChannelFreq);
#else
if (m_bWasPaused && g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES &&
bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING)
SampleManager.PauseStream(FALSE, 1);
}
#endif
if (m_sPoliceRadioQueue.m_nSamplesInQueue == 0) bChannelOpen = FALSE;
if (cWait) {
#ifdef FIX_BUGS
@@ -211,11 +219,19 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
if (g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES && !bChannelOpen) {
if (g_nMissionAudioPlayingStatus != PLAY_STATUS_STOPPED) {
if (g_nMissionAudioPlayingStatus == PLAY_STATUS_PLAYING && bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_STOPPED &&
#ifdef GTA_PS2
SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) {
#else
SampleManager.IsStreamPlaying(1)) {
#endif
bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_PLAYING;
}
if (bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING) {
#ifdef GTA_PS2
if (SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) {
#else
if (SampleManager.IsStreamPlaying(1)) {
#endif
DoPoliceRadioCrackle();
} else {
bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_FINISHED;
@@ -226,9 +242,18 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
return;
}
} else if (!SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) {
#ifdef GTA_PS2
SampleManager.InitialiseChannel(CHANNEL_POLICE_RADIO, g_nMissionAudioSfx, SFX_BANK_PED_COMMENTS);
PoliceChannelFreq = SampleManager.GetSampleBaseFrequency(g_nMissionAudioSfx);
SampleManager.SetChannelFrequency(CHANNEL_POLICE_RADIO, PoliceChannelFreq);
SampleManager.SetChannelVolume(CHANNEL_POLICE_RADIO, MAX_VOLUME);
SampleManager.SetChannelPan(CHANNEL_POLICE_RADIO, 63);
SampleManager.StartChannel(CHANNEL_POLICE_RADIO);
#else
SampleManager.PreloadStreamedFile(g_nMissionAudioSfx, 1);
SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, TRUE, 1);
SampleManager.StartPreloadedStreamedFile(1);
#endif
g_nMissionAudioPlayingStatus = PLAY_STATUS_PLAYING;
bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_STOPPED;
return;
@@ -267,8 +292,8 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
#endif
SampleManager.SetChannelVolume(CHANNEL_POLICE_RADIO, 100);
SampleManager.SetChannelPan(CHANNEL_POLICE_RADIO, 63);
#ifndef GTA_PS2
SampleManager.SetChannelLoopCount(CHANNEL_POLICE_RADIO, 1);
#ifndef GTA_PS2
SampleManager.SetChannelLoopPoints(CHANNEL_POLICE_RADIO, 0, -1);
#endif
SampleManager.StartChannel(CHANNEL_POLICE_RADIO);
@@ -364,170 +389,170 @@ cAudioManager::SetupCrimeReport()
return TRUE;
}
Const uint32 gCarColourTable[][3] = {
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_BLACK, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_WHITE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_PURPLE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_YELLOW, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_BRIGHT, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_LIGHT, SFX_POLICE_RADIO_BLUE, SFX_POLICE_RADIO_GREY},
#ifdef FIX_BUGS
{SFX_POLICE_RADIO_LIGHT, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
#else
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
#endif
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
#ifdef FIX_BUGS
{SFX_POLICE_RADIO_LIGHT, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_ORANGE, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_ORANGE, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_ORANGE, TOTAL_AUDIO_SAMPLES},
#else
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
#endif
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_ORANGE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_ORANGE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_ORANGE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_ORANGE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_ORANGE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_ORANGE, TOTAL_AUDIO_SAMPLES},
#ifdef FIX_BUGS
{SFX_POLICE_RADIO_LIGHT, SFX_POLICE_RADIO_ORANGE, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_YELLOW, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_YELLOW, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_YELLOW, TOTAL_AUDIO_SAMPLES},
#else
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
#endif
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_YELLOW, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_YELLOW, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_YELLOW, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_YELLOW, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_YELLOW, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_YELLOW, TOTAL_AUDIO_SAMPLES},
#ifdef FIX_BUGS
{SFX_POLICE_RADIO_LIGHT, SFX_POLICE_RADIO_YELLOW, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_GREEN, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_GREEN, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_GREEN, TOTAL_AUDIO_SAMPLES},
#else
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
#endif
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_GREEN, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_GREEN, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_GREEN, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_GREEN, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_GREEN, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_GREEN, TOTAL_AUDIO_SAMPLES},
#ifdef FIX_BUGS
{SFX_POLICE_RADIO_LIGHT, SFX_POLICE_RADIO_GREEN, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
#else
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
#endif
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
#ifdef FIX_BUGS
{SFX_POLICE_RADIO_LIGHT, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_PURPLE, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_PURPLE, SFX_POLICE_RADIO_BLUE},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_PURPLE, TOTAL_AUDIO_SAMPLES},
#else
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
#endif
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_PURPLE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_PURPLE, TOTAL_AUDIO_SAMPLES},
#ifdef FIX_BUGS
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_PURPLE, SFX_POLICE_RADIO_GREY},
#else
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_PURPLE, TOTAL_AUDIO_SAMPLES},
#endif
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_PURPLE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_PURPLE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_PURPLE, TOTAL_AUDIO_SAMPLES},
#ifdef FIX_BUGS
{SFX_POLICE_RADIO_LIGHT, SFX_POLICE_RADIO_PURPLE, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_SILVER, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_SILVER, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_SILVER, TOTAL_AUDIO_SAMPLES},
#else
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
#endif
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_SILVER, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_SILVER, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_SILVER, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_SILVER, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_SILVER, TOTAL_AUDIO_SAMPLES},
#ifdef FIX_BUGS
{SFX_POLICE_RADIO_LIGHT, SFX_POLICE_RADIO_SILVER, TOTAL_AUDIO_SAMPLES},
#else
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_SILVER, TOTAL_AUDIO_SAMPLES},
#endif
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES}
};
void
cAudioManager::SetupSuspectLastSeenReport()
{
CVehicle *veh;
uint8 color1;
int32 main_color;
int32 sample;
uint32 main_color;
uint32 sample;
int32 color_pre_modifier;
int32 color_post_modifier;
const int32 gCarColourTable[][3] = {
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_BLACK, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_WHITE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_PURPLE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_YELLOW, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_BRIGHT, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_LIGHT, SFX_POLICE_RADIO_BLUE, SFX_POLICE_RADIO_GREY},
#ifdef FIX_BUGS
{SFX_POLICE_RADIO_LIGHT, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
#else
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
#endif
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
#ifdef FIX_BUGS
{SFX_POLICE_RADIO_LIGHT, SFX_POLICE_RADIO_RED, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_ORANGE, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_ORANGE, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_ORANGE, TOTAL_AUDIO_SAMPLES},
#else
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
#endif
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_ORANGE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_ORANGE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_ORANGE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_ORANGE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_ORANGE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_ORANGE, TOTAL_AUDIO_SAMPLES},
#ifdef FIX_BUGS
{SFX_POLICE_RADIO_LIGHT, SFX_POLICE_RADIO_ORANGE, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_YELLOW, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_YELLOW, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_YELLOW, TOTAL_AUDIO_SAMPLES},
#else
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
#endif
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_YELLOW, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_YELLOW, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_YELLOW, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_YELLOW, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_YELLOW, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_YELLOW, TOTAL_AUDIO_SAMPLES},
#ifdef FIX_BUGS
{SFX_POLICE_RADIO_LIGHT, SFX_POLICE_RADIO_YELLOW, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_GREEN, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_GREEN, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_GREEN, TOTAL_AUDIO_SAMPLES},
#else
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
#endif
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_GREEN, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_GREEN, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_GREEN, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_GREEN, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_GREEN, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_GREEN, TOTAL_AUDIO_SAMPLES},
#ifdef FIX_BUGS
{SFX_POLICE_RADIO_LIGHT, SFX_POLICE_RADIO_GREEN, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
#else
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
#endif
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
#ifdef FIX_BUGS
{SFX_POLICE_RADIO_LIGHT, SFX_POLICE_RADIO_BLUE, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_PURPLE, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_PURPLE, SFX_POLICE_RADIO_BLUE},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_PURPLE, TOTAL_AUDIO_SAMPLES},
#else
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
#endif
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_PURPLE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_PURPLE, TOTAL_AUDIO_SAMPLES},
#ifdef FIX_BUGS
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_PURPLE, SFX_POLICE_RADIO_GREY},
#else
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_PURPLE, TOTAL_AUDIO_SAMPLES},
#endif
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_PURPLE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_PURPLE, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_PURPLE, TOTAL_AUDIO_SAMPLES},
#ifdef FIX_BUGS
{SFX_POLICE_RADIO_LIGHT, SFX_POLICE_RADIO_PURPLE, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_SILVER, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_SILVER, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_SILVER, TOTAL_AUDIO_SAMPLES},
#else
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
#endif
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_SILVER, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_SILVER, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_SILVER, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_SILVER, TOTAL_AUDIO_SAMPLES},
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_SILVER, TOTAL_AUDIO_SAMPLES},
#ifdef FIX_BUGS
{SFX_POLICE_RADIO_LIGHT, SFX_POLICE_RADIO_SILVER, TOTAL_AUDIO_SAMPLES},
#else
{TOTAL_AUDIO_SAMPLES, SFX_POLICE_RADIO_SILVER, TOTAL_AUDIO_SAMPLES},
#endif
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_LIGHT, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES},
{SFX_POLICE_RADIO_DARK, TOTAL_AUDIO_SAMPLES, TOTAL_AUDIO_SAMPLES}
};
uint32 color_pre_modifier;
uint32 color_post_modifier;
if (MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE) {
veh = FindPlayerVehicle();
@@ -713,8 +738,8 @@ cAudioManager::PlaySuspectLastSeen(float x, float y, float z)
float halfY;
float quarterX;
float quarterY;
int32 sample;
bool8 processed = false;
uint32 sample;
bool8 processed = FALSE;
CVector vec = CVector(x, y, z);
if (!m_bIsInitialised) return;

View File

@@ -123,107 +123,109 @@ enum eStreamedSounds
STREAMED_SOUND_CUTSCENE_MARTY_PH4,
STREAMED_SOUND_MISSION_COMPLETED,
STREAMED_SOUND_GAME_COMPLETED,
STREAMED_SOUND_MISSION_LIB_A1,
STREAMED_SOUND_MISSION_LIB_A2,
STREAMED_SOUND_MISSION_LIB_A,
STREAMED_SOUND_MISSION_LIB_B,
STREAMED_SOUND_MISSION_LIB_C,
STREAMED_SOUND_MISSION_LIB_D,
STREAMED_SOUND_MISSION_L2_A,
STREAMED_SOUND_MISSION_J4T_1,
STREAMED_SOUND_MISSION_J4T_2,
STREAMED_SOUND_MISSION_J4T_3,
STREAMED_SOUND_MISSION_J4T_4,
STREAMED_SOUND_MISSION_J4_A,
STREAMED_SOUND_MISSION_J4_B,
STREAMED_SOUND_MISSION_J4_C,
STREAMED_SOUND_MISSION_J4_D,
STREAMED_SOUND_MISSION_J4_E,
STREAMED_SOUND_MISSION_J4_F,
STREAMED_SOUND_MISSION_J6_1,
STREAMED_SOUND_MISSION_J6_A,
STREAMED_SOUND_MISSION_J6_B,
STREAMED_SOUND_MISSION_J6_C,
STREAMED_SOUND_MISSION_J6_D,
STREAMED_SOUND_MISSION_T4_A,
STREAMED_SOUND_MISSION_S1_A,
STREAMED_SOUND_MISSION_S1_A1,
STREAMED_SOUND_MISSION_S1_B,
STREAMED_SOUND_MISSION_S1_C,
STREAMED_SOUND_MISSION_S1_C1,
STREAMED_SOUND_MISSION_S1_D,
STREAMED_SOUND_MISSION_S1_E,
STREAMED_SOUND_MISSION_S1_F,
STREAMED_SOUND_MISSION_S1_G,
STREAMED_SOUND_MISSION_S1_H,
STREAMED_SOUND_MISSION_S1_I,
STREAMED_SOUND_MISSION_S1_J,
STREAMED_SOUND_MISSION_S1_K,
STREAMED_SOUND_MISSION_S1_L,
STREAMED_SOUND_MISSION_S3_A,
STREAMED_SOUND_MISSION_S3_B,
STREAMED_SOUND_MISSION_EL3_A,
STREAMED_SOUND_MISSION_MF1_A,
STREAMED_SOUND_MISSION_MF2_A,
STREAMED_SOUND_MISSION_MF3_A,
STREAMED_SOUND_MISSION_MF3_B,
STREAMED_SOUND_MISSION_MF3_B1,
STREAMED_SOUND_MISSION_MF3_C,
STREAMED_SOUND_MISSION_MF4_A,
STREAMED_SOUND_MISSION_MF4_B,
STREAMED_SOUND_MISSION_MF4_C,
STREAMED_SOUND_MISSION_A1_A,
STREAMED_SOUND_MISSION_A3_A,
STREAMED_SOUND_MISSION_A5_A,
STREAMED_SOUND_MISSION_A4_A,
STREAMED_SOUND_MISSION_A4_B,
STREAMED_SOUND_MISSION_A4_C,
STREAMED_SOUND_MISSION_A4_D,
STREAMED_SOUND_MISSION_K1_A,
STREAMED_SOUND_MISSION_K3_A,
STREAMED_SOUND_MISSION_R1_A,
STREAMED_SOUND_MISSION_R2_A,
STREAMED_SOUND_MISSION_R2_B,
STREAMED_SOUND_MISSION_R2_C,
STREAMED_SOUND_MISSION_R2_D,
STREAMED_SOUND_MISSION_R2_E,
STREAMED_SOUND_MISSION_R2_F,
STREAMED_SOUND_MISSION_R2_G,
STREAMED_SOUND_MISSION_R2_H,
STREAMED_SOUND_MISSION_R5_A,
STREAMED_SOUND_MISSION_R6_A,
STREAMED_SOUND_MISSION_R6_A1,
STREAMED_SOUND_MISSION_R6_B,
STREAMED_SOUND_MISSION_LO2_A,
STREAMED_SOUND_MISSION_LO6_A,
STREAMED_SOUND_MISSION_YD2_A,
STREAMED_SOUND_MISSION_YD2_B,
STREAMED_SOUND_MISSION_YD2_C,
STREAMED_SOUND_MISSION_YD2_C1,
STREAMED_SOUND_MISSION_YD2_D,
STREAMED_SOUND_MISSION_YD2_E,
STREAMED_SOUND_MISSION_YD2_F,
STREAMED_SOUND_MISSION_YD2_G,
STREAMED_SOUND_MISSION_YD2_H,
STREAMED_SOUND_MISSION_YD2_ASS,
STREAMED_SOUND_MISSION_YD2_OK,
STREAMED_SOUND_MISSION_H5_A,
STREAMED_SOUND_MISSION_H5_B,
STREAMED_SOUND_MISSION_H5_C,
STREAMED_SOUND_MISSION_AMMU_A,
STREAMED_SOUND_MISSION_AMMU_B,
STREAMED_SOUND_MISSION_AMMU_C,
STREAMED_SOUND_MISSION_DOOR_1,
STREAMED_SOUND_MISSION_DOOR_2,
STREAMED_SOUND_MISSION_DOOR_3,
STREAMED_SOUND_MISSION_DOOR_4,
STREAMED_SOUND_MISSION_DOOR_5,
STREAMED_SOUND_MISSION_DOOR_6,
STREAMED_SOUND_MISSION_T3_A,
STREAMED_SOUND_MISSION_T3_B,
STREAMED_SOUND_MISSION_T3_C,
STREAMED_SOUND_MISSION_K1_B,
STREAMED_SOUND_MISSION_CAT1,
#ifndef GTA_PS2
SFX_MISSION_LIB_A1,
SFX_MISSION_LIB_A2,
SFX_MISSION_LIB_A,
SFX_MISSION_LIB_B,
SFX_MISSION_LIB_C,
SFX_MISSION_LIB_D,
SFX_MISSION_L2_A,
SFX_MISSION_J4T_1,
SFX_MISSION_J4T_2,
SFX_MISSION_J4T_3,
SFX_MISSION_J4T_4,
SFX_MISSION_J4_A,
SFX_MISSION_J4_B,
SFX_MISSION_J4_C,
SFX_MISSION_J4_D,
SFX_MISSION_J4_E,
SFX_MISSION_J4_F,
SFX_MISSION_J6_1,
SFX_MISSION_J6_A,
SFX_MISSION_J6_B,
SFX_MISSION_J6_C,
SFX_MISSION_J6_D,
SFX_MISSION_T4_A,
SFX_MISSION_S1_A,
SFX_MISSION_S1_A1,
SFX_MISSION_S1_B,
SFX_MISSION_S1_C,
SFX_MISSION_S1_C1,
SFX_MISSION_S1_D,
SFX_MISSION_S1_E,
SFX_MISSION_S1_F,
SFX_MISSION_S1_G,
SFX_MISSION_S1_H,
SFX_MISSION_S1_I,
SFX_MISSION_S1_J,
SFX_MISSION_S1_K,
SFX_MISSION_S1_L,
SFX_MISSION_S3_A,
SFX_MISSION_S3_B,
SFX_MISSION_EL3_A,
SFX_MISSION_MF1_A,
SFX_MISSION_MF2_A,
SFX_MISSION_MF3_A,
SFX_MISSION_MF3_B,
SFX_MISSION_MF3_B1,
SFX_MISSION_MF3_C,
SFX_MISSION_MF4_A,
SFX_MISSION_MF4_B,
SFX_MISSION_MF4_C,
SFX_MISSION_A1_A,
SFX_MISSION_A3_A,
SFX_MISSION_A5_A,
SFX_MISSION_A4_A,
SFX_MISSION_A4_B,
SFX_MISSION_A4_C,
SFX_MISSION_A4_D,
SFX_MISSION_K1_A,
SFX_MISSION_K3_A,
SFX_MISSION_R1_A,
SFX_MISSION_R2_A,
SFX_MISSION_R2_B,
SFX_MISSION_R2_C,
SFX_MISSION_R2_D,
SFX_MISSION_R2_E,
SFX_MISSION_R2_F,
SFX_MISSION_R2_G,
SFX_MISSION_R2_H,
SFX_MISSION_R5_A,
SFX_MISSION_R6_A,
SFX_MISSION_R6_A1,
SFX_MISSION_R6_B,
SFX_MISSION_LO2_A,
SFX_MISSION_LO6_A,
SFX_MISSION_YD2_A,
SFX_MISSION_YD2_B,
SFX_MISSION_YD2_C,
SFX_MISSION_YD2_C1,
SFX_MISSION_YD2_D,
SFX_MISSION_YD2_E,
SFX_MISSION_YD2_F,
SFX_MISSION_YD2_G,
SFX_MISSION_YD2_H,
SFX_MISSION_YD2_ASS,
SFX_MISSION_YD2_OK,
SFX_MISSION_H5_A,
SFX_MISSION_H5_B,
SFX_MISSION_H5_C,
SFX_MISSION_AMMU_A,
SFX_MISSION_AMMU_B,
SFX_MISSION_AMMU_C,
SFX_MISSION_DOOR_1,
SFX_MISSION_DOOR_2,
SFX_MISSION_DOOR_3,
SFX_MISSION_DOOR_4,
SFX_MISSION_DOOR_5,
SFX_MISSION_DOOR_6,
SFX_MISSION_T3_A,
SFX_MISSION_T3_B,
SFX_MISSION_T3_C,
SFX_MISSION_K1_B,
SFX_MISSION_CAT1,
#endif
TOTAL_STREAMED_SOUNDS,
NO_TRACK,
};

View File

@@ -6,10 +6,10 @@
#define MAX_FREQ DIGITALRATE
struct tSample {
int32 nOffset;
uint32 nOffset;
uint32 nSize;
int32 nFrequency;
int32 nLoopStart;
uint32 nFrequency;
uint32 nLoopStart;
int32 nLoopEnd;
};
@@ -180,16 +180,16 @@ public:
bool8 LoadSampleBank (uint8 nBank);
void UnloadSampleBank (uint8 nBank);
bool8 IsSampleBankLoaded(uint8 nBank);
int8 IsSampleBankLoaded(uint8 nBank);
bool8 IsPedCommentLoaded(uint32 nComment);
uint8 IsPedCommentLoaded(uint32 nComment);
bool8 LoadPedComment (uint32 nComment);
int32 GetBankContainingSound(uint32 offset);
int32 _GetPedCommentSlot(uint32 nComment);
int32 GetSampleBaseFrequency (uint32 nSample);
int32 GetSampleLoopStartOffset(uint32 nSample);
uint32 GetSampleBaseFrequency (uint32 nSample);
uint32 GetSampleLoopStartOffset(uint32 nSample);
int32 GetSampleLoopEndOffset (uint32 nSample);
uint32 GetSampleLength (uint32 nSample);

View File

@@ -29,7 +29,7 @@ char SampleBankDataFilename[] = "AUDIO\\SFX.RAW";
FILE *fpSampleDescHandle;
FILE *fpSampleDataHandle;
bool8 bSampleBankLoaded [MAX_SFX_BANKS];
int8 gBankLoaded [MAX_SFX_BANKS];
int32 nSampleBankDiscStartOffset [MAX_SFX_BANKS];
int32 nSampleBankSize [MAX_SFX_BANKS];
int32 nSampleBankMemoryStartAddress[MAX_SFX_BANKS];
@@ -908,7 +908,7 @@ cSampleManager::Initialise(void)
for ( int32 i = 0; i < MAX_SFX_BANKS; i++ )
{
bSampleBankLoaded[i] = FALSE;
gBankLoaded[i] = LOADING_STATUS_NOT_LOADED;
nSampleBankDiscStartOffset[i] = 0;
nSampleBankSize[i] = 0;
nSampleBankMemoryStartAddress[i] = 0;
@@ -1509,7 +1509,7 @@ cSampleManager::LoadSampleBank(uint8 nBank)
if ( fread((void *)nSampleBankMemoryStartAddress[nBank], 1, nSampleBankSize[nBank],fpSampleDataHandle) != nSampleBankSize[nBank] )
return FALSE;
bSampleBankLoaded[nBank] = TRUE;
gBankLoaded[nBank] = LOADING_STATUS_LOADED;
return TRUE;
}
@@ -1517,16 +1517,16 @@ cSampleManager::LoadSampleBank(uint8 nBank)
void
cSampleManager::UnloadSampleBank(uint8 nBank)
{
bSampleBankLoaded[nBank] = FALSE;
gBankLoaded[nBank] = LOADING_STATUS_NOT_LOADED;
}
bool8
int8
cSampleManager::IsSampleBankLoaded(uint8 nBank)
{
return bSampleBankLoaded[nBank];
return gBankLoaded[nBank];
}
bool8
uint8
cSampleManager::IsPedCommentLoaded(uint32 nComment)
{
int8 slot;
@@ -1539,10 +1539,10 @@ cSampleManager::IsPedCommentLoaded(uint32 nComment)
slot += ARRAY_SIZE(nPedSlotSfx);
#endif
if ( nComment == nPedSlotSfx[slot] )
return TRUE;
return LOADING_STATUS_LOADED;
}
return FALSE;
return LOADING_STATUS_NOT_LOADED;
}
int32
@@ -1619,13 +1619,13 @@ cSampleManager::GetBankContainingSound(uint32 offset)
return INVALID_SFX_BANK;
}
int32
uint32
cSampleManager::GetSampleBaseFrequency(uint32 nSample)
{
return m_aSamples[nSample].nFrequency;
}
int32
uint32
cSampleManager::GetSampleLoopStartOffset(uint32 nSample)
{
return m_aSamples[nSample].nLoopStart;
@@ -1787,12 +1787,23 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
}
else
{
if ( !IsPedCommentLoaded(nSfx) )
int32 i;
for ( i = 0; i < _TODOCONST(3); i++ )
{
int32 slot = nCurrentPedSlot - i - 1;
#ifdef FIX_BUGS
if (slot < 0)
slot += ARRAY_SIZE(nPedSlotSfx);
#endif
if ( nSfx == nPedSlotSfx[slot] )
{
addr = nPedSlotSfxAddr[slot];
break;
}
}
if (i == _TODOCONST(3))
return FALSE;
int32 slot = _GetPedCommentSlot(nSfx);
addr = nPedSlotSfxAddr[slot];
}
#ifdef EXTERNAL_3D_SOUND

View File

@@ -143,20 +143,20 @@ cSampleManager::UnloadSampleBank(uint8 nBank)
ASSERT( nBank < MAX_SFX_BANKS );
}
bool8
int8
cSampleManager::IsSampleBankLoaded(uint8 nBank)
{
ASSERT( nBank < MAX_SFX_BANKS );
return FALSE;
return LOADING_STATUS_NOT_LOADED;
}
bool8
uint8
cSampleManager::IsPedCommentLoaded(uint32 nComment)
{
ASSERT( nComment < TOTAL_AUDIO_SAMPLES );
return FALSE;
return LOADING_STATUS_NOT_LOADED;
}
@@ -179,14 +179,14 @@ cSampleManager::GetBankContainingSound(uint32 offset)
return INVALID_SFX_BANK;
}
int32
uint32
cSampleManager::GetSampleBaseFrequency(uint32 nSample)
{
ASSERT( nSample < TOTAL_AUDIO_SAMPLES );
return 0;
}
int32
uint32
cSampleManager::GetSampleLoopStartOffset(uint32 nSample)
{
ASSERT( nSample < TOTAL_AUDIO_SAMPLES );

View File

@@ -92,7 +92,7 @@ OggOpusFile *fpSampleDataHandle;
#else
FILE *fpSampleDataHandle;
#endif
bool8 bSampleBankLoaded [MAX_SFX_BANKS];
int8 gBankLoaded [MAX_SFX_BANKS];
int32 nSampleBankDiscStartOffset [MAX_SFX_BANKS];
int32 nSampleBankSize [MAX_SFX_BANKS];
uintptr nSampleBankMemoryStartAddress[MAX_SFX_BANKS];
@@ -781,7 +781,7 @@ cSampleManager::Initialise(void)
for ( int32 i = 0; i < MAX_SFX_BANKS; i++ )
{
bSampleBankLoaded[i] = FALSE;
gBankLoaded[i] = LOADING_STATUS_NOT_LOADED;
nSampleBankDiscStartOffset[i] = 0;
nSampleBankSize[i] = 0;
nSampleBankMemoryStartAddress[i] = 0;
@@ -1194,7 +1194,7 @@ cSampleManager::LoadSampleBank(uint8 nBank)
if ( fread((void *)nSampleBankMemoryStartAddress[nBank], 1, nSampleBankSize[nBank], fpSampleDataHandle) != nSampleBankSize[nBank] )
return FALSE;
#endif
bSampleBankLoaded[nBank] = TRUE;
gBankLoaded[nBank] = LOADING_STATUS_LOADED;
return TRUE;
}
@@ -1204,18 +1204,18 @@ cSampleManager::UnloadSampleBank(uint8 nBank)
{
ASSERT( nBank < MAX_SFX_BANKS);
bSampleBankLoaded[nBank] = FALSE;
gBankLoaded[nBank] = LOADING_STATUS_NOT_LOADED;
}
bool8
int8
cSampleManager::IsSampleBankLoaded(uint8 nBank)
{
ASSERT( nBank < MAX_SFX_BANKS);
return bSampleBankLoaded[nBank];
return gBankLoaded[nBank];
}
bool8
uint8
cSampleManager::IsPedCommentLoaded(uint32 nComment)
{
ASSERT( nComment < TOTAL_AUDIO_SAMPLES );
@@ -1230,10 +1230,10 @@ cSampleManager::IsPedCommentLoaded(uint32 nComment)
uint8 slot = nCurrentPedSlot - i - 1;
#endif
if ( nComment == nPedSlotSfx[slot] )
return TRUE;
return LOADING_STATUS_LOADED;
}
return FALSE;
return LOADING_STATUS_NOT_LOADED;
}
@@ -1327,14 +1327,14 @@ cSampleManager::GetBankContainingSound(uint32 offset)
return INVALID_SFX_BANK;
}
int32
uint32
cSampleManager::GetSampleBaseFrequency(uint32 nSample)
{
ASSERT( nSample < TOTAL_AUDIO_SAMPLES );
return m_aSamples[nSample].nFrequency;
}
int32
uint32
cSampleManager::GetSampleLoopStartOffset(uint32 nSample)
{
ASSERT( nSample < TOTAL_AUDIO_SAMPLES );
@@ -1461,11 +1461,23 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
}
else
{
if ( !IsPedCommentLoaded(nSfx) )
int32 i;
for ( i = 0; i < _TODOCONST(3); i++ )
{
int32 slot = nCurrentPedSlot - i - 1;
#ifdef FIX_BUGS
if (slot < 0)
slot += ARRAY_SIZE(nPedSlotSfx);
#endif
if ( nSfx == nPedSlotSfx[slot] )
{
addr = (nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] + PED_BLOCKSIZE * slot);
break;
}
}
if (i == _TODOCONST(3))
return FALSE;
int32 slot = _GetPedCommentSlot(nSfx);
addr = (nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] + PED_BLOCKSIZE * slot);
}
if ( GetChannelUsedFlag(nChannel) )

View File

@@ -212,8 +212,8 @@ enum eScriptSounds {
SCRIPT_SOUND_WORK_SHOP_LOOP_L,
SCRIPT_SOUND_SAWMILL_LOOP_S,
SCRIPT_SOUND_SAWMILL_LOOP_L,
SCRIPT_SOUND_38,
SCRIPT_SOUND_39,
SCRIPT_SOUND_DOG_FOOD_FACTORY_S,
SCRIPT_SOUND_DOG_FOOD_FACTORY_L,
SCRIPT_SOUND_LAUNDERETTE_LOOP_S,
SCRIPT_SOUND_LAUNDERETTE_LOOP_L,
SCRIPT_SOUND_CHINATOWN_RESTAURANT_S,

View File

@@ -347,9 +347,13 @@ public:
void LocateCharCommand(int32, uint32*);
void LocateCharCharCommand(int32, uint32*);
void LocateCharCarCommand(int32, uint32*);
#if GTA_VERSION > GTA3_PS2_160
void LocateCharObjectCommand(int32, uint32*);
#endif
void LocateCarCommand(int32, uint32*);
#if GTA_VERSION > GTA3_PS2_160
void LocateSniperBulletCommand(int32, uint32*);
#endif
void PlayerInAreaCheckCommand(int32, uint32*);
void PlayerInAngledAreaCheckCommand(int32, uint32*);
void CharInAreaCheckCommand(int32, uint32*);

View File

@@ -582,6 +582,7 @@ void CRunningScript::LocateCharCarCommand(int32 command, uint32* pIp)
}
}
#if GTA_VERSION > GTA3_PS2_160
void CRunningScript::LocateCharObjectCommand(int32 command, uint32* pIp)
{
bool b3D, result, debug;
@@ -659,6 +660,7 @@ void CRunningScript::LocateCharObjectCommand(int32 command, uint32* pIp)
CTheScripts::DrawDebugSquare(X - dX, Y - dY, X + dX, Y + dY);
}
}
#endif
void CRunningScript::LocateCarCommand(int32 command, uint32* pIp)
{
@@ -732,6 +734,7 @@ void CRunningScript::LocateCarCommand(int32 command, uint32* pIp)
}
}
#if GTA_VERSION > GTA3_PS2_160
void CRunningScript::LocateSniperBulletCommand(int32 command, uint32* pIp)
{
bool b3D, result, debug;
@@ -770,6 +773,7 @@ void CRunningScript::LocateSniperBulletCommand(int32 command, uint32* pIp)
CTheScripts::DrawDebugSquare(X - dX, Y - dY, X + dX, Y + dY);
}
}
#endif
void CRunningScript::PlayerInAreaCheckCommand(int32 command, uint32* pIp)
{

View File

@@ -1338,7 +1338,6 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
CPed::nEnterCarRangeMultiplier = (float)ScriptParams[0];
#endif
return 0;
#endif
#if GTA_VERSION < GTA3_PC_11
case COMMAND_SET_THREAT_REACTION_RANGE_MULTIPLIER:
CollectParameters(&m_nIp, 1);
@@ -1348,6 +1347,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
CPed::nThreatReactionRangeMultiplier = (float)ScriptParams[0];
#endif
return 0;
#endif
#endif
default:
script_assert(0);

View File

@@ -34,6 +34,9 @@ bool CCamera::bFreeCam = false;
int nPreviousMode = -1;
#endif
#define m_fMultiHori -0.8f
#define m_fMultiVert 0.8f
void
CCam::Init(void)
{
@@ -1517,8 +1520,8 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
float LookLeftRight, LookUpDown;
if((MouseX != 0.0f || MouseY != 0.0f) && !CPad::GetPad(0)->ArePlayerControlsDisabled()){
UseMouse = true;
LookLeftRight = -2.5f*MouseX;
LookUpDown = 4.0f*MouseY;
LookLeftRight = m_fMultiHori*MouseX;
LookUpDown = m_fMultiVert*MouseY;
}else{
LookLeftRight = -CPad::GetPad(0)->LookAroundLeftRight();
LookUpDown = CPad::GetPad(0)->LookAroundUpDown();
@@ -2589,8 +2592,8 @@ CCam::Process_M16_1stPerson(const CVector &CameraTarget, float, float, float)
float LookLeftRight, LookUpDown;
if(MouseX != 0.0f || MouseY != 0.0f){
UseMouse = true;
LookLeftRight = -3.0f*MouseX;
LookUpDown = 4.0f*MouseY;
LookLeftRight = m_fMultiHori*MouseX;
LookUpDown = m_fMultiVert*MouseY;
}else{
LookLeftRight = -CPad::GetPad(0)->SniperModeLookLeftRight();
LookUpDown = CPad::GetPad(0)->SniperModeLookUpDown();
@@ -2880,8 +2883,8 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float,
float LookLeftRight, LookUpDown;
if(MouseX != 0.0f || MouseY != 0.0f){
UseMouse = true;
LookLeftRight = -3.0f*MouseX;
LookUpDown = 4.0f*MouseY;
LookLeftRight = m_fMultiHori*MouseX;
LookUpDown = m_fMultiVert*MouseY;
}else{
LookLeftRight = -CPad::GetPad(0)->LookAroundLeftRight();
LookUpDown = CPad::GetPad(0)->LookAroundUpDown();
@@ -2978,8 +2981,8 @@ CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float
float LookLeftRight, LookUpDown;
if(MouseX != 0.0f || MouseY != 0.0f){
UseMouse = true;
LookLeftRight = -3.0f*MouseX;
LookUpDown = 4.0f*MouseY;
LookLeftRight = m_fMultiHori*MouseX;
LookUpDown = m_fMultiVert*MouseY;
}else{
LookLeftRight = -CPad::GetPad(0)->SniperModeLookLeftRight();
LookUpDown = CPad::GetPad(0)->SniperModeLookUpDown();

View File

@@ -80,7 +80,7 @@ CCamera::CCamera(void)
{
#if GTA_VERSION >= GTA3_PC_11 || defined(FIX_BUGS)
m_fMouseAccelHorzntl = 0.0025f;
m_fMouseAccelVertical = 0.003f;
m_fMouseAccelVertical = 0.0025f;
#endif
Init();
}
@@ -241,9 +241,9 @@ CCamera::Init(void)
m_bLookingAtPlayer = true;
#if GTA_VERSION < GTA3_PC_11 && !defined(FIX_BUGS)
m_fMouseAccelHorzntl = 0.0025f;
m_fMouseAccelVertical = 0.003f;
m_fMouseAccelVertical = 0.0025f;
#endif
m_f3rdPersonCHairMultX = 0.53f;
m_f3rdPersonCHairMultX = 0.4f;
m_f3rdPersonCHairMultY = 0.4f;
}

View File

@@ -126,10 +126,9 @@ enum Config {
NUMINVISIBLEENTITIES = 150,
NUM_AUDIOENTITY_EVENTS = 4,
NUM_PED_COMMENTS_BANKS = 2,
NUM_PED_COMMENTS_SLOTS = 20,
NUM_SOUNDS_SAMPLES_BANKS = 2,
NUM_SOUND_QUEUES = 2,
NUM_AUDIOENTITIES = 200,
NUM_SCRIPT_MAX_ENTITIES = 40,

View File

@@ -44,6 +44,7 @@
#include "CarCtrl.h"
#include "Population.h"
#include "IniFile.h"
#include "Zones.h"
#include "crossplatform.h"
@@ -746,12 +747,15 @@ FixCar(void)
static void
TeleportToWaypoint(void)
{
if (FindPlayerVehicle()) {
if (CRadar::TargetMarkerId != -1)
FindPlayerVehicle()->Teleport(CRadar::TargetMarkerPos + CVector(0.0f, 0.0f, FindPlayerVehicle()->GetColModel()->boundingSphere.center.z));
} else
if(CRadar::TargetMarkerId != -1)
FindPlayerPed()->Teleport(CRadar::TargetMarkerPos + CVector(0.0f, 0.0f, FEET_OFFSET));
if (CRadar::TargetMarkerId == -1)
return;
CEntity* pEntityToTeleport = FindPlayerEntity();
CVector vNewPos = CRadar::TargetMarkerPos;
CGame::currLevel = CTheZones::GetLevelFromPosition(&vNewPos);
CCollision::SortOutCollisionAfterLoad();
CStreaming::LoadScene(vNewPos);
vNewPos.z = CWorld::FindGroundZForCoord(vNewPos.x, vNewPos.y) + pEntityToTeleport->GetDistanceFromCentreOfMassToBaseOfModel();
pEntityToTeleport->Teleport(vNewPos);
}
#endif

View File

@@ -159,7 +159,7 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
pobj->m_pParticle = NULL;
if ( lifeTime != 0 )
pobj->m_nRemoveTimer = CTimer::GetTimeInMilliseconds() + lifeTime;
pobj->m_nRemoveTimer = lifeTime;
else
pobj->m_nRemoveTimer = 0;
@@ -240,7 +240,7 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
pobj->m_nSkipFrames = 1;
pobj->m_nCreationChance = 0;
pobj->m_vecTarget = CVector(0.0f, 0.0f, 0.3f);
pobj->m_nRemoveTimer = CTimer::GetTimeInMilliseconds() + 5000;
pobj->m_nRemoveTimer = 5000;
CAudioHydrant::Add(pobj);
break;
}
@@ -373,7 +373,7 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
pobj->m_nNumEffectCycles = 1;
pobj->m_nSkipFrames = 1;
pobj->m_nCreationChance = 0;
pobj->m_nRemoveTimer = CTimer::GetTimeInMilliseconds();
pobj->m_nRemoveTimer = 0;
break;
}
@@ -384,7 +384,7 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
pobj->m_nNumEffectCycles = 1;
pobj->m_nSkipFrames = 1;
pobj->m_nCreationChance = 0;
pobj->m_nRemoveTimer = CTimer::GetTimeInMilliseconds();
pobj->m_nRemoveTimer = 0;
pobj->m_vecTarget.Normalise();
break;
}
@@ -1087,7 +1087,7 @@ void CParticleObject::UpdateClose(void)
}
}
if ( this->m_nRemoveTimer != 0 && this->m_nRemoveTimer < CTimer::GetTimeInMilliseconds() )
if ( this->m_nRemoveTimer != 0 )
{
MoveToList(&pCloseListHead, &pUnusedListHead, this);
this->m_nState = POBJECTSTATE_FREE;
@@ -1100,7 +1100,7 @@ void CParticleObject::UpdateClose(void)
void
CParticleObject::UpdateFar(void)
{
if ( this->m_nRemoveTimer != 0 && this->m_nRemoveTimer < CTimer::GetTimeInMilliseconds() )
if ( this->m_nRemoveTimer != 0 )
{
MoveToList(&pFarListHead, &pUnusedListHead, this);
this->m_nState = POBJECTSTATE_FREE;

View File

@@ -212,7 +212,7 @@ CEmergencyPed::MedicAI(void)
if (!waitUntilMedicEntersCar) {
CCarCtrl::JoinCarWithRoadSystem(m_pMyVehicle);
m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
m_pMyVehicle->m_bSirenOrAlarm = 0;
m_pMyVehicle->m_bSirenOrAlarm = false;
m_pMyVehicle->AutoPilot.m_nCruiseSpeed = 12;
m_pMyVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_SLOW_DOWN_FOR_CARS;
if (m_pMyVehicle->bIsAmbulanceOnDuty) {

View File

@@ -574,7 +574,9 @@ public:
void RestorePreviousObjective(void);
void SetIdle(void);
#ifdef _MSC_VER
#if _MSC_VER >= 1920 && _MSC_VER < 1929
__declspec(noinline) // workaround for a compiler bug, hooray MS :P
#endif
#endif
void SetObjective(eObjective, void*);
void SetObjective(eObjective);

View File

@@ -806,6 +806,7 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
return AddParticle(type, vecPos, vecDir, pEntity, fSize, color, nRotationSpeed, nRotation, nCurFrame, nLifeSpan);
}
float throttleParticleAdd = 0;
CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, float fSize, RwRGBA const &color, int32 nRotationSpeed, int32 nRotation, int32 nCurFrame, int32 nLifeSpan)
{
if ( CTimer::GetIsPaused() )
@@ -831,6 +832,10 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
if ( pParticle == nil )
return nil;
throttleParticleAdd += CTimer::GetTimeStepInMilliseconds();
if(throttleParticleAdd < 31) return nil;
throttleParticleAdd -= 31;
tParticleSystemData *psystem = &mod_ParticleSystemManager.m_aParticles[type];
if ( psystem->m_fCreateRange != 0.0f && psystem->m_fCreateRange < ( TheCamera.GetPosition() - vecPos ).MagnitudeSqr() )
@@ -1039,22 +1044,28 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
return pParticle;
}
float throttleParticleUpdate = 0;
void CParticle::Update()
{
if ( CTimer::GetIsPaused() )
return;
CParticleObject::UpdateAll();
throttleParticleUpdate += CTimer::GetTimeStepInMilliseconds();
if(throttleParticleUpdate < 31) return;
throttleParticleUpdate -= 31;
CRGBA color(0, 0, 0, 0);
float fFricDeccel50 = pow(0.50f, CTimer::GetTimeStep());
float fFricDeccel80 = pow(0.80f, CTimer::GetTimeStep());
float fFricDeccel90 = pow(0.90f, CTimer::GetTimeStep());
float fFricDeccel95 = pow(0.95f, CTimer::GetTimeStep());
float fFricDeccel96 = pow(0.96f, CTimer::GetTimeStep());
float fFricDeccel99 = pow(0.99f, CTimer::GetTimeStep());
float fFricDeccel50 = 0.50f;
float fFricDeccel80 = 0.80f;
float fFricDeccel90 = 0.90f;
float fFricDeccel95 = 0.95f;
float fFricDeccel96 = 0.96f;
float fFricDeccel99 = 0.99f;
CParticleObject::UpdateAll();
for ( int32 i = 0; i < MAX_PARTICLES; i++ )
{
tParticleSystemData *psystem = &mod_ParticleSystemManager.m_aParticles[i];
@@ -1069,7 +1080,7 @@ void CParticle::Update()
{
bRemoveParticle = false;
CVector moveStep = particle->m_vecPosition + ( particle->m_vecVelocity * CTimer::GetTimeStep() );
CVector moveStep = particle->m_vecPosition + particle->m_vecVelocity;
if ( CTimer::GetTimeInMilliseconds() > particle->m_nTimeWhenWillBeDestroyed || particle->m_nAlpha == 0 )
{
@@ -1149,7 +1160,7 @@ void CParticle::Update()
if ( psystem->m_fGravitationalAcceleration > 0.0f )
{
if ( -50.0f * psystem->m_fGravitationalAcceleration < particle->m_vecVelocity.z )
particle->m_vecVelocity.z -= psystem->m_fGravitationalAcceleration * CTimer::GetTimeStep();
particle->m_vecVelocity.z -= psystem->m_fGravitationalAcceleration;
if ( psystem->Flags & ZCHECK_FIRST )
{
@@ -1347,7 +1358,7 @@ void CParticle::Update()
if ( psystem->m_fGravitationalAcceleration < 0.0f )
{
if ( -5.0f * psystem->m_fGravitationalAcceleration > particle->m_vecVelocity.z )
particle->m_vecVelocity.z -= psystem->m_fGravitationalAcceleration * CTimer::GetTimeStep();
particle->m_vecVelocity.z -= psystem->m_fGravitationalAcceleration;
}
else
{
@@ -1666,7 +1677,7 @@ void CParticle::Render()
float fSpeed = particle->m_vecVelocity.Magnitude();
float fNewTrailLength = fSpeed * CTimer::GetTimeStep() * w * 2.0f;
float fNewTrailLength = fSpeed * w * 2.0f;
if ( fDist > fNewTrailLength )
fTrailLength = fNewTrailLength;
@@ -1899,4 +1910,4 @@ void CParticle::AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatr
nil,
0.3f, color, 0, 0, 0, 0);
}
}
}

View File

@@ -186,7 +186,7 @@ public:
uint8 m_bRainSamplesCounter;
uint8 m_nCarHornTimer;
uint8 m_nCarHornPattern; // last horn?
uint8 m_bSirenOrAlarm;
bool m_bSirenOrAlarm;
int8 m_comedyControlState;
CStoredCollPoly m_aCollPolys[2]; // poly which is under front/rear part of car
float m_fSteerInput;

2
vendor/librw vendored