Compare commits

...

28 Commits

Author SHA1 Message Date
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
26 changed files with 4049 additions and 3505 deletions

View File

@ -29,6 +29,7 @@ endif()
set(${PROJECT}_AUDIO "OAL" CACHE STRING "Audio") 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_OPUS "Build ${EXECUTABLE} with opus support" OFF)
option(${PROJECT}_WITH_LIBSNDFILE "Build ${EXECUTABLE} with libsndfile (instead of internal decoder)" OFF) option(${PROJECT}_WITH_LIBSNDFILE "Build ${EXECUTABLE} with libsndfile (instead of internal decoder)" OFF)

View File

@ -85,7 +85,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. 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), 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 can easily be achieved (increasing limis, see `config.h`),
others will simply have to be rewritten and integrated into the code directly. 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") self.requires("opusfile/0.12")
def export_sources(self): 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)) shutil.copytree(src=d, dst=os.path.join(self.export_sources_folder, d))
self.copy("CMakeLists.txt") self.copy("CMakeLists.txt")

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,11 @@
cAudioManager AudioManager; cAudioManager AudioManager;
#define SPEED_OF_SOUND 343.f #define SPEED_OF_SOUND 343.f
#ifdef GTA_PS2
#define TIME_SPENT 40
#else
#define TIME_SPENT 50 #define TIME_SPENT 50
#endif
cAudioManager::cAudioManager() cAudioManager::cAudioManager()
{ {
@ -24,9 +28,9 @@ cAudioManager::cAudioManager()
m_fSpeedOfSound = SPEED_OF_SOUND / TIME_SPENT; m_fSpeedOfSound = SPEED_OF_SOUND / TIME_SPENT;
m_nTimeSpent = TIME_SPENT; m_nTimeSpent = TIME_SPENT;
m_nActiveSamples = NUM_CHANNELS_GENERIC; m_nActiveSamples = NUM_CHANNELS_GENERIC;
m_nActiveSampleQueue = 1; m_nActiveQueue = 1;
ClearRequestedQueue(); ClearRequestedQueue();
m_nActiveSampleQueue = 0; m_nActiveQueue = 0;
ClearRequestedQueue(); ClearRequestedQueue();
ClearActiveSamples(); ClearActiveSamples();
GenerateIntegerRandomNumberTable(); GenerateIntegerRandomNumberTable();
@ -35,11 +39,11 @@ cAudioManager::cAudioManager()
m_bDynamicAcousticModelingStatus = TRUE; m_bDynamicAcousticModelingStatus = TRUE;
#endif #endif
for (int i = 0; i < NUM_AUDIOENTITIES; i++) { for (uint32 i = 0; i < NUM_AUDIOENTITIES; i++) {
m_asAudioEntities[i].m_bIsUsed = FALSE; 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_FrameCounter = 0;
m_bReduceReleasingPriority = FALSE; m_bReduceReleasingPriority = FALSE;
m_bTimerJustReset = FALSE; m_bTimerJustReset = FALSE;
@ -64,7 +68,7 @@ cAudioManager::Initialise()
if (m_nActiveSamples <= 1) { if (m_nActiveSamples <= 1) {
Terminate(); Terminate();
} else { } else {
--m_nActiveSamples; m_nActiveSamples--;
#else #else
{ {
m_nActiveSamples = NUM_CHANNELS_GENERIC; m_nActiveSamples = NUM_CHANNELS_GENERIC;
@ -86,10 +90,10 @@ cAudioManager::Terminate()
for (uint32 i = 0; i < NUM_AUDIOENTITIES; i++) { for (uint32 i = 0; i < NUM_AUDIOENTITIES; i++) {
m_asAudioEntities[i].m_bIsUsed = FALSE; 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; m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0;
PreTerminateGameSpecificShutdown(); PreTerminateGameSpecificShutdown();
@ -115,8 +119,8 @@ cAudioManager::Service()
m_bTimerJustReset = FALSE; m_bTimerJustReset = FALSE;
} }
if (m_bIsInitialised) { if (m_bIsInitialised) {
m_nPreviousUserPause = m_nUserPause; m_bWasPaused = m_bIsPaused;
m_nUserPause = CTimer::GetIsUserPaused(); m_bIsPaused = CTimer::GetIsUserPaused();
#ifdef AUDIO_REFLECTIONS #ifdef AUDIO_REFLECTIONS
UpdateReflections(); UpdateReflections();
#endif #endif
@ -138,12 +142,12 @@ cAudioManager::CreateEntity(eAudioType type, void *entity)
#ifdef FIX_BUGS #ifdef FIX_BUGS
// since sound could still play after entity deletion let's make sure we don't override one that is in use // 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 // 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; uint32 stillUsedEntitiesCount = 0;
for (uint8 i = 0; i < NUM_SOUNDS_SAMPLES_BANKS; i++) for (uint8 i = 0; i < NUM_SOUND_QUEUES; i++)
for (uint8 j = 0; j < m_SampleRequestQueuesStatus[i]; j++) { for (uint8 j = 0; j < m_nRequestedCount[i]; j++) {
tSound &sound = m_asSamples[i][m_abSampleQueueIndexTable[i][j]]; tSound &sound = m_aRequestedQueue[i][m_aRequestedOrderList[i][j]];
if (sound.m_nEntityIndex < 0) continue; if (sound.m_nEntityIndex < 0) continue;
if (!m_asAudioEntities[sound.m_nEntityIndex].m_bIsUsed) { if (!m_asAudioEntities[sound.m_nEntityIndex].m_bIsUsed) {
bool found = false; bool found = false;
@ -159,7 +163,7 @@ cAudioManager::CreateEntity(eAudioType type, void *entity)
} }
#endif #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) { if (!m_asAudioEntities[i].m_bIsUsed) {
#ifdef FIX_BUGS #ifdef FIX_BUGS
// skip if ID is still used by queued sample // 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[2] = SOUND_NO_SOUND;
m_asAudioEntities[i].m_awAudioEvent[3] = SOUND_NO_SOUND; m_asAudioEntities[i].m_awAudioEvent[3] = SOUND_NO_SOUND;
m_asAudioEntities[i].m_AudioEvents = 0; m_asAudioEntities[i].m_AudioEvents = 0;
m_anAudioEntityIndices[m_nAudioEntitiesTotal++] = i; m_aAudioEntityOrderList[m_nAudioEntitiesCount++] = i;
return i; return i;
} }
} }
@ -196,11 +200,11 @@ cAudioManager::DestroyEntity(int32 id)
{ {
if (m_bIsInitialised && id >= 0 && id < NUM_AUDIOENTITIES && m_asAudioEntities[id].m_bIsUsed) { if (m_bIsInitialised && id >= 0 && id < NUM_AUDIOENTITIES && m_asAudioEntities[id].m_bIsUsed) {
m_asAudioEntities[id].m_bIsUsed = FALSE; m_asAudioEntities[id].m_bIsUsed = FALSE;
for (int32 i = 0; i < m_nAudioEntitiesTotal; ++i) { for (uint32 i = 0; i < m_nAudioEntitiesCount; i++) {
if (id == m_anAudioEntityIndices[i]) { if (id == m_aAudioEntityOrderList[i]) {
if (i < NUM_AUDIOENTITIES - 1) if (i < NUM_AUDIOENTITIES - 1)
memmove(&m_anAudioEntityIndices[i], &m_anAudioEntityIndices[i + 1], NUM_AUDIOENTITY_EVENTS * (m_nAudioEntitiesTotal - (i + 1))); memmove(&m_aAudioEntityOrderList[i], &m_aAudioEntityOrderList[i + 1], sizeof(uint32) * (m_nAudioEntitiesCount - (i + 1)));
m_anAudioEntityIndices[--m_nAudioEntitiesTotal] = NUM_AUDIOENTITIES; m_aAudioEntityOrderList[--m_nAudioEntitiesCount] = NUM_AUDIOENTITIES;
return; return;
} }
} }
@ -230,15 +234,17 @@ cAudioManager::GetEntityPointer(int32 id)
return NULL; 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 void
cAudioManager::PlayOneShot(int32 index, uint16 sound, float vol) 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 (m_bIsInitialised) {
if (index >= 0 && index < NUM_AUDIOENTITIES) { if (index >= 0 && index < NUM_AUDIOENTITIES) {
tAudioEntity &entity = m_asAudioEntities[index]; tAudioEntity &entity = m_asAudioEntities[index];
@ -254,25 +260,25 @@ cAudioManager::PlayOneShot(int32 index, uint16 sound, float vol)
int32 i = 0; int32 i = 0;
while (TRUE) { while (TRUE) {
if (i >= entity.m_AudioEvents) { 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_awAudioEvent[i] = sound;
entity.m_afVolume[i] = vol; entity.m_afVolume[i] = vol;
++entity.m_AudioEvents; entity.m_AudioEvents++;
} }
return; return;
} }
if (OneShotPriority[entity.m_awAudioEvent[i]] > OneShotPriority[sound]) if (OneShotPriority[entity.m_awAudioEvent[i]] > OneShotPriority[sound])
break; break;
++i; i++;
} }
if (i < NUM_AUDIOENTITY_EVENTS - 1) { 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_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) * NUM_AUDIOENTITY_EVENTS); memmove(&entity.m_afVolume[i + 1], &entity.m_afVolume[i], (NUM_AUDIOENTITY_EVENTS - 1 - i) * sizeof(float));
} }
entity.m_awAudioEvent[i] = sound; entity.m_awAudioEvent[i] = sound;
entity.m_afVolume[i] = vol; entity.m_afVolume[i] = vol;
if (entity.m_AudioEvents < ARRAY_SIZE(entity.m_awAudioEvent)) if (entity.m_AudioEvents < NUM_AUDIOENTITY_EVENTS)
++entity.m_AudioEvents; entity.m_AudioEvents++;
} }
} }
} }
@ -317,14 +323,14 @@ cAudioManager::ResetTimers(uint32 time)
m_bTimerJustReset = TRUE; m_bTimerJustReset = TRUE;
m_nTimer = time; m_nTimer = time;
ClearRequestedQueue(); ClearRequestedQueue();
if (m_nActiveSampleQueue) { if (m_nActiveQueue) {
m_nActiveSampleQueue = 0; m_nActiveQueue = 0;
ClearRequestedQueue(); ClearRequestedQueue();
m_nActiveSampleQueue = 1; m_nActiveQueue = 1;
} else { } else {
m_nActiveSampleQueue = 1; m_nActiveQueue = 1;
ClearRequestedQueue(); ClearRequestedQueue();
m_nActiveSampleQueue = 0; m_nActiveQueue = 0;
} }
ClearActiveSamples(); ClearActiveSamples();
ClearMissionAudio(); ClearMissionAudio();
@ -344,7 +350,7 @@ cAudioManager::DestroyAllGameCreatedEntities()
cAudioScriptObject *entity; cAudioScriptObject *entity;
if (m_bIsInitialised) { 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) { if (m_asAudioEntities[i].m_bIsUsed) {
switch (m_asAudioEntities[i].m_nType) { switch (m_asAudioEntities[i].m_nType) {
case AUDIOTYPE_PHYSICAL: case AUDIOTYPE_PHYSICAL:
@ -422,13 +428,13 @@ cAudioManager::SetCurrent3DProvider(uint8 which)
#else #else
if (!m_bIsInitialised) if (!m_bIsInitialised)
return -1; return -1;
for (uint8 i = 0; i < m_nActiveSamples + 1; ++i) for (uint8 i = 0; i < m_nActiveSamples + 1; i++)
SampleManager.StopChannel(i); SampleManager.StopChannel(i);
ClearRequestedQueue(); ClearRequestedQueue();
if (m_nActiveSampleQueue == 0) if (m_nActiveQueue == 0)
m_nActiveSampleQueue = 1; m_nActiveQueue = 1;
else else
m_nActiveSampleQueue = 0; m_nActiveQueue = 0;
ClearRequestedQueue(); ClearRequestedQueue();
ClearActiveSamples(); ClearActiveSamples();
int8 current = SampleManager.SetCurrent3DProvider(which); int8 current = SampleManager.SetCurrent3DProvider(which);
@ -436,7 +442,7 @@ cAudioManager::SetCurrent3DProvider(uint8 which)
#ifdef EXTERNAL_3D_SOUND #ifdef EXTERNAL_3D_SOUND
m_nActiveSamples = SampleManager.GetMaximumSupportedChannels(); m_nActiveSamples = SampleManager.GetMaximumSupportedChannels();
if (m_nActiveSamples > 1) if (m_nActiveSamples > 1)
--m_nActiveSamples; m_nActiveSamples--;
#endif #endif
} }
return current; return current;
@ -463,17 +469,15 @@ cAudioManager::IsMP3RadioChannelAvailable()
void void
cAudioManager::ReleaseDigitalHandle() cAudioManager::ReleaseDigitalHandle()
{ {
if (m_bIsInitialised) { if (m_bIsInitialised)
SampleManager.ReleaseDigitalHandle(); SampleManager.ReleaseDigitalHandle();
}
} }
void void
cAudioManager::ReacquireDigitalHandle() cAudioManager::ReacquireDigitalHandle()
{ {
if (m_bIsInitialised) { if (m_bIsInitialised)
SampleManager.ReacquireDigitalHandle(); SampleManager.ReacquireDigitalHandle();
}
} }
#ifdef AUDIO_REFLECTIONS #ifdef AUDIO_REFLECTIONS
@ -514,23 +518,23 @@ cAudioManager::ServiceSoundEffects()
if(CTimer::GetLogicalFramesPassed() != 0) if(CTimer::GetLogicalFramesPassed() != 0)
#endif #endif
m_bReduceReleasingPriority = (m_FrameCounter++ % 5) == 0; m_bReduceReleasingPriority = (m_FrameCounter++ % 5) == 0;
if (m_nUserPause && !m_nPreviousUserPause) { if (m_bIsPaused && !m_bWasPaused) {
for (int32 i = 0; i < NUM_CHANNELS; i++) for (int32 i = 0; i < NUM_CHANNELS; i++)
SampleManager.StopChannel(i); SampleManager.StopChannel(i);
ClearRequestedQueue(); ClearRequestedQueue();
if (m_nActiveSampleQueue) { if (m_nActiveQueue) {
m_nActiveSampleQueue = 0; m_nActiveQueue = 0;
ClearRequestedQueue(); ClearRequestedQueue();
m_nActiveSampleQueue = 1; m_nActiveQueue = 1;
} else { } else {
m_nActiveSampleQueue = 1; m_nActiveQueue = 1;
ClearRequestedQueue(); ClearRequestedQueue();
m_nActiveSampleQueue = 0; m_nActiveQueue = 0;
} }
ClearActiveSamples(); ClearActiveSamples();
} }
m_nActiveSampleQueue = m_nActiveSampleQueue == 1 ? 0 : 1; m_nActiveQueue = m_nActiveQueue == 1 ? 0 : 1;
ProcessReverb(); ProcessReverb();
ProcessSpecial(); ProcessSpecial();
ClearRequestedQueue(); ClearRequestedQueue();
@ -547,7 +551,7 @@ cAudioManager::ServiceSoundEffects()
#ifdef AUDIO_OAL #ifdef AUDIO_OAL
SampleManager.Service(); SampleManager.Service();
#endif #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; cAudioScriptObject *object = (cAudioScriptObject *)m_asAudioEntities[m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]].m_pEntity;
delete object; delete object;
m_asAudioEntities[m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]].m_pEntity = nil; 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, 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}; 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)); index = Min(63, ABS(index));
if (vec->x > 0.f) if (vec->x > 0.f)
@ -619,15 +623,15 @@ cAudioManager::RandomDisplacement(uint32 seed)
static bool8 bPos = TRUE; static bool8 bPos = TRUE;
static uint32 Adjustment = 0; static uint32 Adjustment = 0;
if (!seed) if (seed == 0)
return 0; return 0;
value = m_anRandomTable[(Adjustment + seed) % 5] % seed; value = m_anRandomTable[(Adjustment + seed) % 5] % seed;
Adjustment += value; Adjustment += value;
if (value % 2) { if (value % 2)
bPos = !bPos; bPos = !bPos;
}
if (!bPos) if (!bPos)
value = -value; value = -value;
return value; return value;
@ -636,9 +640,9 @@ cAudioManager::RandomDisplacement(uint32 seed)
void void
cAudioManager::InterrogateAudioEntities() cAudioManager::InterrogateAudioEntities()
{ {
for (int32 i = 0; i < m_nAudioEntitiesTotal; i++) { for (uint32 i = 0; i < m_nAudioEntitiesCount; i++) {
ProcessEntity(m_anAudioEntityIndices[i]); ProcessEntity(m_aAudioEntityOrderList[i]);
m_asAudioEntities[m_anAudioEntityIndices[i]].m_AudioEvents = 0; m_asAudioEntities[m_aAudioEntityOrderList[i]].m_AudioEvents = 0;
} }
} }
@ -653,14 +657,13 @@ cAudioManager::AddSampleToRequestedQueue()
if (m_sQueueSample.m_nSampleIndex < TOTAL_AUDIO_SAMPLES) { if (m_sQueueSample.m_nSampleIndex < TOTAL_AUDIO_SAMPLES) {
finalPriority = m_sQueueSample.m_nPriority * (MAX_VOLUME - m_sQueueSample.m_nVolume); 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) { if (sampleIndex >= m_nActiveSamples) {
sampleIndex = m_abSampleQueueIndexTable[m_nActiveSampleQueue][m_nActiveSamples - 1]; sampleIndex = m_aRequestedOrderList[m_nActiveQueue][m_nActiveSamples - 1];
if (m_asSamples[m_nActiveSampleQueue][sampleIndex].m_nFinalPriority <= finalPriority) if (m_aRequestedQueue[m_nActiveQueue][sampleIndex].m_nFinalPriority <= finalPriority)
return; return;
} else { } else
++m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; m_nRequestedCount[m_nActiveQueue]++;
}
#if GTA_VERSION < GTA3_PC_10 #if GTA_VERSION < GTA3_PC_10
if (m_sQueueSample.m_bStatic) { if (m_sQueueSample.m_bStatic) {
if (m_sQueueSample.m_nLoopCount > 0) if (m_sQueueSample.m_nLoopCount > 0)
@ -688,7 +691,7 @@ cAudioManager::AddSampleToRequestedQueue()
m_sQueueSample.m_bReverb = FALSE; m_sQueueSample.m_bReverb = FALSE;
#endif #endif
m_asSamples[m_nActiveSampleQueue][sampleIndex] = m_sQueueSample; m_aRequestedQueue[m_nActiveQueue][sampleIndex] = m_sQueueSample;
AddDetailsToRequestedOrderList(sampleIndex); AddDetailsToRequestedOrderList(sampleIndex);
#ifdef AUDIO_REFLECTIONS #ifdef AUDIO_REFLECTIONS
@ -704,15 +707,14 @@ cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
uint32 i = 0; uint32 i = 0;
if (sample != 0) { if (sample != 0) {
for (; i < sample; i++) { for (; i < sample; i++) {
if (m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]].m_nFinalPriority > if (m_aRequestedQueue[m_nActiveQueue][m_aRequestedOrderList[m_nActiveQueue][i]].m_nFinalPriority >
m_asSamples[m_nActiveSampleQueue][sample].m_nFinalPriority) m_aRequestedQueue[m_nActiveQueue][sample].m_nFinalPriority)
break; break;
} }
if (i < sample) { if (i < sample)
memmove(&m_abSampleQueueIndexTable[m_nActiveSampleQueue][i + 1], &m_abSampleQueueIndexTable[m_nActiveSampleQueue][i], m_nActiveSamples - i - 1); 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 #ifdef AUDIO_REFLECTIONS
@ -721,20 +723,21 @@ cAudioManager::AddReflectionsToRequestedQueue()
{ {
float reflectionDistance; float reflectionDistance;
int32 noise; 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++) { for (uint32 i = 0; i < ARRAY_SIZE(m_afReflectionsDistances); i++) {
reflectionDistance = m_afReflectionsDistances[i]; reflectionDistance = m_afReflectionsDistances[i];
if (reflectionDistance > 0.0f && reflectionDistance < 100.f && reflectionDistance < m_sQueueSample.m_MaxDistance) { if (reflectionDistance > 0.0f && reflectionDistance < 100.0f && reflectionDistance < m_sQueueSample.m_MaxDistance) {
m_sQueueSample.m_nReflectionDelay = (reflectionDistance * 500.f / 1029.f); m_sQueueSample.m_nReflectionDelay = (reflectionDistance * 500.0f / 1029.0f);
if (m_sQueueSample.m_nReflectionDelay > 5) { if (m_sQueueSample.m_nReflectionDelay > 5) {
m_sQueueSample.m_fDistance = m_afReflectionsDistances[i]; m_sQueueSample.m_fDistance = m_afReflectionsDistances[i];
SET_EMITTING_VOLUME(emittingVolume); SET_EMITTING_VOLUME(emittingVolume);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_MaxDistance, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_MaxDistance, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume > emittingVolume / 16) { if (m_sQueueSample.m_nVolume > emittingVolume >> 4) {
m_sQueueSample.m_nCounter += (i + 1) * 256; m_sQueueSample.m_nCounter = oldCounter + ((i + 1) << 8);
if (m_sQueueSample.m_nLoopCount > 0) { if (m_sQueueSample.m_nLoopCount > 0) {
noise = RandomDisplacement(m_sQueueSample.m_nFrequency / 32); noise = RandomDisplacement(m_sQueueSample.m_nFrequency >> 5);
if (noise > 0) if (noise > 0)
m_sQueueSample.m_nFrequency -= noise; m_sQueueSample.m_nFrequency -= noise;
else else
@ -810,17 +813,17 @@ cAudioManager::AddReleasingSounds()
bool8 toProcess[44]; bool8 toProcess[44];
#endif #endif
int8 queue = m_nActiveSampleQueue == 0 ? 1 : 0; uint8 queue = m_nActiveQueue == 0 ? 1 : 0;
for (int32 i = 0; i < m_SampleRequestQueuesStatus[queue]; i++) { for (uint8 i = 0; i < m_nRequestedCount[queue]; i++) {
tSound &sample = m_asSamples[queue][m_abSampleQueueIndexTable[queue][i]]; tSound &sample = m_aRequestedQueue[queue][m_aRequestedOrderList[queue][i]];
if (sample.m_bIsPlayingFinished) if (sample.m_bIsPlayingFinished)
continue; continue;
toProcess[i] = FALSE; toProcess[i] = FALSE;
for (int32 j = 0; j < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; j++) { for (uint8 j = 0; j < m_nRequestedCount[m_nActiveQueue]; j++) {
if (sample.m_nEntityIndex == m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][j]].m_nEntityIndex && if (sample.m_nEntityIndex == m_aRequestedQueue[m_nActiveQueue][m_aRequestedOrderList[m_nActiveQueue][j]].m_nEntityIndex &&
sample.m_nCounter == m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][j]].m_nCounter) { sample.m_nCounter == m_aRequestedQueue[m_nActiveQueue][m_aRequestedOrderList[m_nActiveQueue][j]].m_nCounter) {
toProcess[i] = TRUE; toProcess[i] = TRUE;
break; 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 if (sample.m_nSampleIndex >= SAMPLEBANK_PED_START && sample.m_nSampleIndex <= SAMPLEBANK_PED_END) { // check if it's ped comment
uint8 vol; uint8 vol;
if (CWorld::GetIsLineOfSightClear(TheCamera.GetPosition(), sample.m_vecPos, true, false, false, false, false, false)) if (CWorld::GetIsLineOfSightClear(TheCamera.GetPosition(), sample.m_vecPos, true, false, false, false, false, false))
vol = MAX_VOLUME; vol = PED_COMMENT_VOLUME;
else else
vol = 31; vol = PED_COMMENT_VOLUME_BEHIND_WALL;
#ifdef EXTERNAL_3D_SOUND #ifdef EXTERNAL_3D_SOUND
sample.m_nEmittingVolume = vol; sample.m_nEmittingVolume = vol;
#endif #endif
@ -858,7 +861,7 @@ cAudioManager::AddReleasingSounds()
if (sample.m_nEmittingVolumeChange > 0) if (sample.m_nEmittingVolumeChange > 0)
sample.m_nEmittingVolumeChange = volumeDiff * sample.m_nEmittingVolumeChange; sample.m_nEmittingVolumeChange = volumeDiff * sample.m_nEmittingVolumeChange;
#endif #endif
sample.m_nVolume = Min(127, newVolume); sample.m_nVolume = Min(MAX_VOLUME, newVolume);
} }
} }
if (sample.m_nVolume == 0) if (sample.m_nVolume == 0)
@ -954,18 +957,18 @@ cAudioManager::ProcessActiveQueues()
#endif #endif
#ifdef USE_TIME_SCALE_FOR_AUDIO #ifdef USE_TIME_SCALE_FOR_AUDIO
float timeScale = m_nUserPause ? 1.0f : CTimer::GetTimeScale(); float timeScale = m_bIsPaused ? 1.0f : CTimer::GetTimeScale();
#endif #endif
for (int32 i = 0; i < m_nActiveSamples; i++) { for (uint8 i = 0; i < m_nActiveSamples; i++) {
m_asSamples[m_nActiveSampleQueue][i].m_bIsBeingPlayed = FALSE; m_aRequestedQueue[m_nActiveQueue][i].m_bIsBeingPlayed = FALSE;
m_asActiveSamples[i].m_bIsBeingPlayed = FALSE; m_asActiveSamples[i].m_bIsBeingPlayed = FALSE;
} }
for (int32 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) { for (uint8 i = 0; i < m_nRequestedCount[m_nActiveQueue]; i++) {
tSound &sample = m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]]; tSound &sample = m_aRequestedQueue[m_nActiveQueue][m_aRequestedOrderList[m_nActiveQueue][i]];
if (sample.m_nSampleIndex != NO_SAMPLE) { 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 && 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) { sample.m_nSampleIndex == m_asActiveSamples[j].m_nSampleIndex) {
if (sample.m_nLoopCount > 0) { if (sample.m_nLoopCount > 0) {
@ -1032,7 +1035,7 @@ cAudioManager::ProcessActiveQueues()
vol = Clamp2((int8)sample.m_nVolume, (int8)m_asActiveSamples[j].m_nVolume, 10); vol = Clamp2((int8)sample.m_nVolume, (int8)m_asActiveSamples[j].m_nVolume, 10);
m_asActiveSamples[j].m_nVolume = vol; 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 #endif
TranslateEntity(&sample.m_vecPos, &position); TranslateEntity(&sample.m_vecPos, &position);
#ifdef EXTERNAL_3D_SOUND #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) { if (m_asActiveSamples[i].m_nSampleIndex != NO_SAMPLE && !m_asActiveSamples[i].m_bIsBeingPlayed) {
SampleManager.StopChannel(i); SampleManager.StopChannel(i);
m_asActiveSamples[i].m_nSampleIndex = NO_SAMPLE; m_asActiveSamples[i].m_nSampleIndex = NO_SAMPLE;
m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE; m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE;
} }
} }
for (uint8 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) { for (uint8 i = 0; i < m_nRequestedCount[m_nActiveQueue]; i++) {
tSound &sample = m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][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) { if (!sample.m_bIsBeingPlayed && !sample.m_bIsPlayingFinished && m_asAudioEntities[sample.m_nEntityIndex].m_bIsUsed && sample.m_nSampleIndex < NO_SAMPLE) {
#ifdef AUDIO_REFLECTIONS #ifdef AUDIO_REFLECTIONS
if (sample.m_nCounter > 255 && sample.m_nLoopCount > 0 && sample.m_nReflectionDelay > 0) { // check if reflection if (sample.m_nCounter > 255 && sample.m_nLoopCount > 0 && sample.m_nReflectionDelay > 0) { // check if reflection
@ -1154,10 +1157,9 @@ cAudioManager::ProcessActiveQueues()
void void
cAudioManager::ClearRequestedQueue() cAudioManager::ClearRequestedQueue()
{ {
for (int32 i = 0; i < m_nActiveSamples; i++) { for (uint8 i = 0; i < m_nActiveSamples; i++)
m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = m_nActiveSamples; m_aRequestedOrderList[m_nActiveQueue][i] = m_nActiveSamples;
} m_nRequestedCount[m_nActiveQueue] = 0;
m_SampleRequestQueuesStatus[m_nActiveSampleQueue] = 0;
} }
void void
@ -1203,26 +1205,28 @@ cAudioManager::ClearActiveSamples()
} }
void 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) cAudioManager::LoadBankIfNecessary(uint8 bank)
{ {
if(!SampleManager.IsSampleBankLoaded(bank)) if(!SampleManager.IsSampleBankLoaded(bank))
SampleManager.LoadSampleBank(bank); return SampleManager.LoadSampleBank(bank);
} return FALSE;
void
cAudioManager::GenerateIntegerRandomNumberTable()
{
for (int32 i = 0; i < ARRAY_SIZE(m_anRandomTable); i++) {
m_anRandomTable[i] = myrand();
}
} }
#endif
#ifdef EXTERNAL_3D_SOUND #ifdef EXTERNAL_3D_SOUND
void void
cAudioManager::AdjustSamplesVolume() cAudioManager::AdjustSamplesVolume()
{ {
for (int i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) { for (uint8 i = 0; i < m_nRequestedCount[m_nActiveQueue]; i++) {
tSound *pSample = &m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]]; tSound *pSample = &m_aRequestedQueue[m_nActiveQueue][m_aRequestedOrderList[m_nActiveQueue][i]];
if (!pSample->m_bIs2D) if (!pSample->m_bIs2D)
pSample->m_nEmittingVolume = ComputeEmittingVolume(pSample->m_nEmittingVolume, pSample->m_MaxDistance, pSample->m_fDistance); 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_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 bool8 m_bIsPlayingFinished; // Not sure about the name. Set to TRUE when sampman channel becomes free
#if GTA_VERSION < GTA3_PC_10 #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 // 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 // Default value is -3 for whatever reason
#endif #endif
@ -96,7 +96,7 @@ public:
CVector m_vecPos; CVector m_vecPos;
float m_fDistance; float m_fDistance;
uint8 m_nVolume; 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) #if defined(EXTERNAL_3D_SOUND) && defined(FIX_BUGS)
uint8 m_nEmittingVolume; uint8 m_nEmittingVolume;
#endif #endif
@ -107,22 +107,22 @@ VALIDATE_SIZE(tPedComment, 28);
class cPedComments class cPedComments
{ {
public: public:
tPedComment m_asPedComments[NUM_PED_COMMENTS_BANKS][NUM_PED_COMMENTS_SLOTS]; tPedComment m_aPedCommentQueue[NUM_SOUND_QUEUES][NUM_PED_COMMENTS_SLOTS];
uint8 m_nIndexMap[NUM_PED_COMMENTS_BANKS][NUM_PED_COMMENTS_SLOTS]; uint8 m_aPedCommentOrderList[NUM_SOUND_QUEUES][NUM_PED_COMMENTS_SLOTS];
uint8 m_nCommentsInBank[NUM_PED_COMMENTS_BANKS]; uint8 m_nPedCommentCount[NUM_SOUND_QUEUES];
uint8 m_nActiveBank; uint8 m_nActiveQueue;
cPedComments() cPedComments()
{ {
for (int i = 0; i < NUM_PED_COMMENTS_SLOTS; i++) for (int i = 0; i < NUM_PED_COMMENTS_SLOTS; i++)
for (int j = 0; j < NUM_PED_COMMENTS_BANKS; j++) { for (int j = 0; j < NUM_SOUND_QUEUES; j++) {
m_asPedComments[j][i].m_nProcess = -1; m_aPedCommentQueue[j][i].m_nLoadingTimeout = -1;
m_nIndexMap[j][i] = NUM_PED_COMMENTS_SLOTS; m_aPedCommentOrderList[j][i] = NUM_PED_COMMENTS_SLOTS;
} }
for (int i = 0; i < NUM_PED_COMMENTS_BANKS; i++) for (int i = 0; i < NUM_SOUND_QUEUES; i++)
m_nCommentsInBank[i] = 0; m_nPedCommentCount[i] = 0;
m_nActiveBank = 0; m_nActiveQueue = 0;
} }
void Add(tPedComment *com); void Add(tPedComment *com);
void Process(); void Process();
@ -204,7 +204,7 @@ enum {
}; };
enum PLAY_STATUS { PLAY_STATUS_STOPPED = 0, PLAY_STATUS_PLAYING, PLAY_STATUS_FINISHED }; 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 class cAudioManager
{ {
@ -219,16 +219,16 @@ public:
#endif #endif
float m_fSpeedOfSound; float m_fSpeedOfSound;
bool8 m_bTimerJustReset; bool8 m_bTimerJustReset;
int32 m_nTimer; uint32 m_nTimer;
tSound m_sQueueSample; tSound m_sQueueSample;
uint8 m_nActiveSampleQueue; uint8 m_nActiveQueue;
tSound m_asSamples[NUM_SOUNDS_SAMPLES_BANKS][NUM_CHANNELS_GENERIC]; tSound m_aRequestedQueue[NUM_SOUND_QUEUES][NUM_CHANNELS_GENERIC];
uint8 m_abSampleQueueIndexTable[NUM_SOUNDS_SAMPLES_BANKS][NUM_CHANNELS_GENERIC]; uint8 m_aRequestedOrderList[NUM_SOUND_QUEUES][NUM_CHANNELS_GENERIC];
uint8 m_SampleRequestQueuesStatus[NUM_SOUNDS_SAMPLES_BANKS]; uint8 m_nRequestedCount[NUM_SOUND_QUEUES];
tSound m_asActiveSamples[NUM_CHANNELS_GENERIC]; tSound m_asActiveSamples[NUM_CHANNELS_GENERIC];
tAudioEntity m_asAudioEntities[NUM_AUDIOENTITIES]; tAudioEntity m_asAudioEntities[NUM_AUDIOENTITIES];
int32 m_anAudioEntityIndices[NUM_AUDIOENTITIES]; uint32 m_aAudioEntityOrderList[NUM_AUDIOENTITIES];
int32 m_nAudioEntitiesTotal; uint32 m_nAudioEntitiesCount;
#ifdef AUDIO_REFLECTIONS #ifdef AUDIO_REFLECTIONS
CVector m_avecReflectionsPos[MAX_REFLECTIONS]; CVector m_avecReflectionsPos[MAX_REFLECTIONS];
float m_afReflectionsDistances[MAX_REFLECTIONS]; float m_afReflectionsDistances[MAX_REFLECTIONS];
@ -253,13 +253,13 @@ public:
uint8 m_nMissionAudioLoadingStatus; uint8 m_nMissionAudioLoadingStatus;
uint8 m_nMissionAudioPlayStatus; uint8 m_nMissionAudioPlayStatus;
bool8 m_bIsMissionAudioPlaying; bool8 m_bIsMissionAudioPlaying;
int32 m_nMissionAudioFramesToPlay; int32 m_nMissionAudioFramesToPlay; // possibly unsigned
bool8 m_bIsMissionAudioAllowedToPlay; bool8 m_bIsMissionAudioAllowedToPlay;
int32 m_anRandomTable[5]; int32 m_anRandomTable[5];
uint8 m_nTimeSpent; uint8 m_nTimeSpent;
bool8 m_nUserPause; bool8 m_bIsPaused;
bool8 m_nPreviousUserPause; bool8 m_bWasPaused;
uint32 m_FrameCounter; uint32 m_FrameCounter;
cAudioManager(); cAudioManager();
@ -318,7 +318,9 @@ public:
void ClearRequestedQueue(); // inlined on PS2 void ClearRequestedQueue(); // inlined on PS2
void ClearActiveSamples(); void ClearActiveSamples();
void GenerateIntegerRandomNumberTable(); // inlined on PS2 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 #ifdef EXTERNAL_3D_SOUND // actually must have been && AUDIO_MSS as well
void AdjustSamplesVolume(); void AdjustSamplesVolume();
@ -335,7 +337,7 @@ public:
float GetDistanceSquared(const CVector &v); float GetDistanceSquared(const CVector &v);
void CalculateDistance(bool8 &condition, float dist); void CalculateDistance(bool8 &condition, float dist);
void ProcessSpecial(); void ProcessSpecial();
void ProcessEntity(int32 sound); void ProcessEntity(int32 id);
void ProcessPhysical(int32 id); void ProcessPhysical(int32 id);
// vehicles // vehicles
@ -355,7 +357,7 @@ public:
bool8 ProcessVehicleSkidding(cVehicleParams &params); bool8 ProcessVehicleSkidding(cVehicleParams &params);
float GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cTransmission *transmission, float velocityChange); float GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cTransmission *transmission, float velocityChange);
float GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cTransmission *transmission, float velocityChange); // inlined on PS2 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 UsesSiren(uint32 model); // inlined on PS2
bool8 UsesSirenSwitching(uint32 model); // inlined on PS2 bool8 UsesSirenSwitching(uint32 model); // inlined on PS2
bool8 ProcessVehicleSirenOrAlarm(cVehicleParams &params); bool8 ProcessVehicleSirenOrAlarm(cVehicleParams &params);
@ -473,9 +475,9 @@ public:
uint32 GetGenericFemaleTalkSfx(uint16 sound); uint32 GetGenericFemaleTalkSfx(uint16 sound);
// particles // particles
void ProcessExplosions(int32 explosion); void ProcessExplosions(int32 id);
void ProcessFires(int32 entity); void ProcessFires(int32 id);
void ProcessWaterCannon(int32); void ProcessWaterCannon(int32 id);
// script objects // script objects
void ProcessScriptObject(int32 id); // inlined on PS2 void ProcessScriptObject(int32 id); // inlined on PS2
@ -576,3 +578,10 @@ static_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error");
#endif #endif
extern cAudioManager AudioManager; 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 // bank 59
SFX_EXPLOSION_1, SFX_EXPLOSION_1,
SFX_BRIDGE_OPEN_WARNING, SFX_BRIDGE_OPEN_WARNING,
#ifndef GTA_PS2
SFX_PAGER, // used to be ped comment on PS2 SFX_PAGER, // used to be ped comment on PS2
#endif
SFX_COP_VOICE_1_ARREST_1, SFX_COP_VOICE_1_ARREST_1,
SFX_COP_VOICE_1_ARREST_2, SFX_COP_VOICE_1_ARREST_2,
@ -703,6 +704,9 @@ enum eSfxSample
SFX_POLICE_HELI_27, SFX_POLICE_HELI_27,
SFX_POLICE_HELI_28, SFX_POLICE_HELI_28,
SFX_POLICE_HELI_29, SFX_POLICE_HELI_29,
#ifdef GTA_PS2
SFX_MISSION_CAT1,
#endif
SFX_CHUNKY_DEATH, SFX_CHUNKY_DEATH,
SFX_BLACK_DOCKER_VOICE_1_DRIVER_ABUSE_1, SFX_BLACK_DOCKER_VOICE_1_DRIVER_ABUSE_1,
SFX_BLACK_DOCKER_VOICE_1_DRIVER_ABUSE_2, 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_13,
SFX_ARMY_VOICE_2_CHASE_14, SFX_ARMY_VOICE_2_CHASE_14,
SFX_ARMY_VOICE_2_CHASE_15, SFX_ARMY_VOICE_2_CHASE_15,
#ifdef GTA_PS2
SFX_PAGER,
#endif
SFX_CLAUDE_LOW_DAMAGE_GRUNT_1, SFX_CLAUDE_LOW_DAMAGE_GRUNT_1,
SFX_CLAUDE_LOW_DAMAGE_GRUNT_2, SFX_CLAUDE_LOW_DAMAGE_GRUNT_2,
SFX_CLAUDE_LOW_DAMAGE_GRUNT_3, SFX_CLAUDE_LOW_DAMAGE_GRUNT_3,
@ -3140,14 +3147,127 @@ enum eSfxSample
SFX_AMMU_D, SFX_AMMU_D,
SFX_AMMU_E, SFX_AMMU_E,
SFX_AMMU_F, 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, TOTAL_AUDIO_SAMPLES,
NO_SAMPLE, NO_SAMPLE,
// shorthands // shorthands
SAMPLEBANK_START = SFX_CAR_HORN_JEEP, SAMPLEBANK_START = SFX_CAR_HORN_JEEP,
#ifdef GTA_PS2
SAMPLEBANK_END = SFX_INFO,
SAMPLEBANK_MAX = SFX_INFO + 1,
#else
SAMPLEBANK_END = SFX_PAGER, SAMPLEBANK_END = SFX_PAGER,
SAMPLEBANK_MAX = SFX_PAGER + 1, SAMPLEBANK_MAX = SFX_PAGER + 1,
#endif
SAMPLEBANK_PED_START = SFX_COP_VOICE_1_ARREST_1, 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_END = SFX_AMMU_F,
SAMPLEBANK_PED_MAX = SFX_AMMU_F + 1, SAMPLEBANK_PED_MAX = SFX_AMMU_F + 1,
#endif
}; };

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -347,9 +347,13 @@ public:
void LocateCharCommand(int32, uint32*); void LocateCharCommand(int32, uint32*);
void LocateCharCharCommand(int32, uint32*); void LocateCharCharCommand(int32, uint32*);
void LocateCharCarCommand(int32, uint32*); void LocateCharCarCommand(int32, uint32*);
#if GTA_VERSION > GTA3_PS2_160
void LocateCharObjectCommand(int32, uint32*); void LocateCharObjectCommand(int32, uint32*);
#endif
void LocateCarCommand(int32, uint32*); void LocateCarCommand(int32, uint32*);
#if GTA_VERSION > GTA3_PS2_160
void LocateSniperBulletCommand(int32, uint32*); void LocateSniperBulletCommand(int32, uint32*);
#endif
void PlayerInAreaCheckCommand(int32, uint32*); void PlayerInAreaCheckCommand(int32, uint32*);
void PlayerInAngledAreaCheckCommand(int32, uint32*); void PlayerInAngledAreaCheckCommand(int32, uint32*);
void CharInAreaCheckCommand(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) void CRunningScript::LocateCharObjectCommand(int32 command, uint32* pIp)
{ {
bool b3D, result, debug; 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); CTheScripts::DrawDebugSquare(X - dX, Y - dY, X + dX, Y + dY);
} }
} }
#endif
void CRunningScript::LocateCarCommand(int32 command, uint32* pIp) 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) void CRunningScript::LocateSniperBulletCommand(int32 command, uint32* pIp)
{ {
bool b3D, result, debug; 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); CTheScripts::DrawDebugSquare(X - dX, Y - dY, X + dX, Y + dY);
} }
} }
#endif
void CRunningScript::PlayerInAreaCheckCommand(int32 command, uint32* pIp) void CRunningScript::PlayerInAreaCheckCommand(int32 command, uint32* pIp)
{ {

View File

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

View File

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

View File

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

View File

@ -212,7 +212,7 @@ CEmergencyPed::MedicAI(void)
if (!waitUntilMedicEntersCar) { if (!waitUntilMedicEntersCar) {
CCarCtrl::JoinCarWithRoadSystem(m_pMyVehicle); CCarCtrl::JoinCarWithRoadSystem(m_pMyVehicle);
m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE; 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_nCruiseSpeed = 12;
m_pMyVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_SLOW_DOWN_FOR_CARS; m_pMyVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_SLOW_DOWN_FOR_CARS;
if (m_pMyVehicle->bIsAmbulanceOnDuty) { if (m_pMyVehicle->bIsAmbulanceOnDuty) {

View File

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

View File

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

2
vendor/librw vendored

@ -1 +1 @@
Subproject commit 22ce63a114be1b84357dea0ba597c8926d465d37 Subproject commit 5501c4fdc7425ff926be59369a13593bb6c81b54