summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2021-08-01 13:00:16 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2021-08-01 13:00:16 +0200
commit2b99f2634b7c75401cf1305929530467595919ca (patch)
tree1a4203b9e9b4c709686f82f4681364ddce217907 /src
parentmove debug script stuff to a separate file (diff)
parentFix radio scroll when player controls disabled (diff)
downloadre3-2b99f2634b7c75401cf1305929530467595919ca.tar
re3-2b99f2634b7c75401cf1305929530467595919ca.tar.gz
re3-2b99f2634b7c75401cf1305929530467595919ca.tar.bz2
re3-2b99f2634b7c75401cf1305929530467595919ca.tar.lz
re3-2b99f2634b7c75401cf1305929530467595919ca.tar.xz
re3-2b99f2634b7c75401cf1305929530467595919ca.tar.zst
re3-2b99f2634b7c75401cf1305929530467595919ca.zip
Diffstat (limited to 'src')
-rw-r--r--src/audio/AudioCollision.cpp410
-rw-r--r--src/audio/AudioCollision.h23
-rw-r--r--src/audio/AudioLogic.cpp663
-rw-r--r--src/audio/AudioManager.cpp82
-rw-r--r--src/audio/AudioManager.h511
-rw-r--r--src/audio/DMAudio.cpp12
-rw-r--r--src/audio/DMAudio.h4
-rw-r--r--src/audio/MusicManager.cpp22
-rw-r--r--src/audio/PolRadio.cpp8
-rw-r--r--src/audio/sampman_miles.cpp18
-rw-r--r--src/audio/sampman_oal.cpp14
-rw-r--r--src/control/CarCtrl.cpp5
-rw-r--r--src/core/FileLoader.cpp6
-rw-r--r--src/core/Radar.cpp18
-rw-r--r--src/core/config.h6
-rw-r--r--src/modelinfo/MloModelInfo.h2
-rw-r--r--src/modelinfo/XtraCompsModelInfo.h3
-rw-r--r--src/peds/Ped.cpp28
-rw-r--r--src/peds/PedIK.h2
-rw-r--r--src/peds/PlayerPed.cpp11
-rw-r--r--src/peds/Population.cpp5
-rw-r--r--src/renderer/Renderer.cpp5
-rw-r--r--src/rw/VisibilityPlugins.cpp54
-rw-r--r--src/rw/VisibilityPlugins.h3
-rw-r--r--src/weapons/Weapon.cpp10
25 files changed, 1034 insertions, 891 deletions
diff --git a/src/audio/AudioCollision.cpp b/src/audio/AudioCollision.cpp
index fd819641..bc470c49 100644
--- a/src/audio/AudioCollision.cpp
+++ b/src/audio/AudioCollision.cpp
@@ -10,20 +10,39 @@
const int CollisionSoundIntensity = 60;
-cAudioCollisionManager::cAudioCollisionManager()
+void
+cAudioManager::ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, float collisionPower,
+ float velocity)
{
- m_sQueue.m_pEntity1 = nil;
- m_sQueue.m_pEntity2 = nil;
- m_sQueue.m_bSurface1 = SURFACE_DEFAULT;
- m_sQueue.m_bSurface2 = SURFACE_DEFAULT;
- m_sQueue.m_fIntensity2 = 0.0f;
- m_sQueue.m_fIntensity1 = 0.0f;
- m_sQueue.m_vecPosition = CVector(0.0f, 0.0f, 0.0f);
+ float distSquared;
+ CVector v1;
+ CVector v2;
- for (int i = 0; i < NUMAUDIOCOLLISIONS; i++)
- m_bIndicesTable[i] = NUMAUDIOCOLLISIONS;
+ if(!m_bIsInitialised || m_nCollisionEntity < 0 || m_nUserPause ||
+ (velocity < 0.0016f && collisionPower < 0.01f))
+ return;
- m_bCollisionsInQueue = 0;
+ if(entity1->IsBuilding()) {
+ v1 = v2 = entity2->GetPosition();
+ } else if(entity2->IsBuilding()) {
+ v1 = v2 = entity1->GetPosition();
+ } else {
+ v1 = entity1->GetPosition();
+ v2 = entity2->GetPosition();
+ }
+ CVector pos = (v1 + v2) * 0.5f;
+ distSquared = GetDistanceSquared(pos);
+ if(distSquared < SQR(CollisionSoundIntensity)) {
+ m_sCollisionManager.m_sQueue.m_pEntity1 = entity1;
+ m_sCollisionManager.m_sQueue.m_pEntity2 = entity2;
+ m_sCollisionManager.m_sQueue.m_bSurface1 = surface1;
+ m_sCollisionManager.m_sQueue.m_bSurface2 = surface2;
+ m_sCollisionManager.m_sQueue.m_fIntensity1 = collisionPower;
+ m_sCollisionManager.m_sQueue.m_fIntensity2 = velocity;
+ m_sCollisionManager.m_sQueue.m_vecPosition = pos;
+ m_sCollisionManager.m_sQueue.m_fDistance = distSquared;
+ m_sCollisionManager.AddCollisionToRequestedQueue();
+ }
}
void
@@ -55,133 +74,71 @@ cAudioCollisionManager::AddCollisionToRequestedQueue()
m_bIndicesTable[i] = collisionsIndex;
}
-float
-cAudioManager::GetCollisionLoopingRatio(uint32 a, uint32 b, float c) const
-{
- return GetCollisionRatio(c, 0.0f, 0.02f, 0.02f);
-}
-
-float
-cAudioManager::GetCollisionOneShotRatio(int32 a, float b) const
+void
+cAudioManager::ServiceCollisions()
{
- float result;
-
- switch(a) {
- case SURFACE_DEFAULT:
- case SURFACE_TARMAC:
- case SURFACE_PAVEMENT:
- case SURFACE_STEEP_CLIFF:
- case SURFACE_TRANSPARENT_STONE: result = GetCollisionRatio(b, 10.f, 60.f, 50.f); break;
- case SURFACE_GRASS:
- case SURFACE_CARDBOARDBOX: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break;
- case SURFACE_GRAVEL: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break;
- case SURFACE_MUD_DRY: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break;
- case SURFACE_CAR: result = GetCollisionRatio(b, 6.f, 50.f, 44.f); break;
- case SURFACE_GLASS: result = GetCollisionRatio(b, 0.1f, 10.f, 9.9f); break;
- case SURFACE_TRANSPARENT_CLOTH:
- case SURFACE_THICK_METAL_PLATE: result = GetCollisionRatio(b, 30.f, 130.f, 100.f); break;
- case SURFACE_GARAGE_DOOR: result = GetCollisionRatio(b, 20.f, 100.f, 80.f); break;
- case SURFACE_CAR_PANEL: result = GetCollisionRatio(b, 0.f, 4.f, 4.f); break;
- case SURFACE_SCAFFOLD_POLE:
- case SURFACE_METAL_GATE: result = GetCollisionRatio(b, 1.f, 10.f, 9.f); break;
- case SURFACE_LAMP_POST: result = GetCollisionRatio(b, 1.f, 10.f, 9.f); break;
- case SURFACE_FIRE_HYDRANT: result = GetCollisionRatio(b, 1.f, 15.f, 14.f); break;
- case SURFACE_GIRDER: result = GetCollisionRatio(b, 8.f, 50.f, 42.f); break;
- case SURFACE_METAL_CHAIN_FENCE: result = GetCollisionRatio(b, 0.1f, 10.f, 9.9f); break;
- case SURFACE_PED: result = GetCollisionRatio(b, 0.f, 20.f, 20.f); break;
- case SURFACE_SAND: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break;
- case SURFACE_WATER: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break;
- case SURFACE_WOOD_CRATES: result = GetCollisionRatio(b, 1.f, 4.f, 3.f); break;
- case SURFACE_WOOD_BENCH: result = GetCollisionRatio(b, 0.1f, 5.f, 4.9f); break;
- case SURFACE_WOOD_SOLID: result = GetCollisionRatio(b, 0.1f, 40.f, 39.9f); break;
- case SURFACE_RUBBER:
- case SURFACE_WHEELBASE: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break;
- case SURFACE_PLASTIC: result = GetCollisionRatio(b, 0.1f, 4.f, 3.9f); break;
- case SURFACE_HEDGE: result = GetCollisionRatio(b, 0.f, 0.5f, 0.5f); break;
- case SURFACE_CONTAINER: result = GetCollisionRatio(b, 4.f, 40.f, 36.f); break;
- case SURFACE_NEWS_VENDOR: result = GetCollisionRatio(b, 0.f, 5.f, 5.f); break;
- default: result = 0.f; break;
- }
+ int i, j;
+ bool8 abRepeatedCollision1[NUMAUDIOCOLLISIONS];
+ bool8 abRepeatedCollision2[NUMAUDIOCOLLISIONS];
- return result;
-}
+ m_sQueueSample.m_nEntityIndex = m_nCollisionEntity;
-float
-cAudioManager::GetCollisionRatio(float a, float b, float c, float d) const
-{
- float e;
- e = a;
- if(a <= b) return 0.0f;
- if(c <= a) e = c;
- return (e - b) / d;
-}
+ for (int i = 0; i < NUMAUDIOCOLLISIONS; i++)
+ abRepeatedCollision1[i] = abRepeatedCollision2[i] = FALSE;
-uint32
-cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision)
-{
- uint8 surface1 = audioCollision.m_bSurface1;
- uint8 surface2 = audioCollision.m_bSurface2;
- int32 vol;
- float ratio;
+ for (i = 0; i < m_sCollisionManager.m_bCollisionsInQueue; i++) {
+ for (j = 0; j < NUMAUDIOCOLLISIONS; j++) {
+ int index = m_sCollisionManager.m_bIndicesTable[i];
+ if ((m_sCollisionManager.m_asCollisions1[index].m_pEntity1 == m_sCollisionManager.m_asCollisions2[j].m_pEntity1)
+ && (m_sCollisionManager.m_asCollisions1[index].m_pEntity2 == m_sCollisionManager.m_asCollisions2[j].m_pEntity2)
+ && (m_sCollisionManager.m_asCollisions1[index].m_bSurface1 == m_sCollisionManager.m_asCollisions2[j].m_bSurface1)
+ && (m_sCollisionManager.m_asCollisions1[index].m_bSurface2 == m_sCollisionManager.m_asCollisions2[j].m_bSurface2)
+ ) {
+ abRepeatedCollision1[index] = TRUE;
+ abRepeatedCollision2[j] = TRUE;
+ m_sCollisionManager.m_asCollisions1[index].m_nBaseVolume = ++m_sCollisionManager.m_asCollisions2[j].m_nBaseVolume;
+ SetUpLoopingCollisionSound(m_sCollisionManager.m_asCollisions1[index], j);
+ break;
+ }
+ }
+ }
- if(surface1 == SURFACE_GRASS || surface2 == SURFACE_GRASS || surface1 == SURFACE_HEDGE ||
- surface2 == SURFACE_HEDGE) {
- ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
- m_sQueueSample.m_nSampleIndex = SFX_RAIN;
- m_sQueueSample.m_nFrequency = 13000.f * ratio + 35000;
- vol = 50.f * ratio;
- } else if(surface1 == SURFACE_WATER || surface2 == SURFACE_WATER) {
- ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
- m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP;
- m_sQueueSample.m_nFrequency = 6050.f * ratio + 16000;
- vol = 30.f * ratio;
- } else if(surface1 == SURFACE_GRAVEL || surface2 == SURFACE_GRAVEL || surface1 == SURFACE_MUD_DRY ||
- surface2 == SURFACE_MUD_DRY || surface1 == SURFACE_SAND || surface2 == SURFACE_SAND) {
- ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
- m_sQueueSample.m_nSampleIndex = SFX_GRAVEL_SKID;
- m_sQueueSample.m_nFrequency = 6000.f * ratio + 10000;
- vol = 50.f * ratio;
- } else if(surface1 == SURFACE_PED || surface2 == SURFACE_PED) {
- return 0;
- } else {
- ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
- m_sQueueSample.m_nSampleIndex = SFX_SCRAPE_CAR_1;
- m_sQueueSample.m_nFrequency = 10000.f * ratio + 10000;
- vol = 40.f * ratio;
+ for (i = 0; i < NUMAUDIOCOLLISIONS; i++) {
+ if (!abRepeatedCollision2[i]) {
+ m_sCollisionManager.m_asCollisions2[i].m_pEntity1 = nil;
+ m_sCollisionManager.m_asCollisions2[i].m_pEntity2 = nil;
+ m_sCollisionManager.m_asCollisions2[i].m_bSurface1 = SURFACE_DEFAULT;
+ m_sCollisionManager.m_asCollisions2[i].m_bSurface2 = SURFACE_DEFAULT;
+ m_sCollisionManager.m_asCollisions2[i].m_fIntensity2 = 0.0f;
+ m_sCollisionManager.m_asCollisions2[i].m_fIntensity1 = 0.0f;
+ m_sCollisionManager.m_asCollisions2[i].m_vecPosition = CVector(0.0f, 0.0f, 0.0f);
+ m_sCollisionManager.m_asCollisions2[i].m_fDistance = 0.0f;
+ }
}
- if(audioCollision.m_nBaseVolume < 2) vol = audioCollision.m_nBaseVolume * vol / 2;
- return vol;
-}
-void
-cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter)
-{
- if(col.m_fIntensity2 > 0.0016f) {
- uint8 emittingVol = SetLoopingCollisionRequestedSfxFreqAndGetVol(col);
- if(emittingVol) {
- m_sQueueSample.m_fDistance = Sqrt(col.m_fDistance);
- m_sQueueSample.m_nVolume =
- ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
- if(m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = counter;
- m_sQueueSample.m_vecPos = col.m_vecPosition;
- m_sQueueSample.m_nBankIndex = SFX_BANK_0;
- m_sQueueSample.m_bIs2D = FALSE;
- m_sQueueSample.m_nReleasingVolumeModificator = 7;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 4.0f;
- m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity;
- m_sQueueSample.m_bReleasingSoundFlag = FALSE;
- m_sQueueSample.m_nReleasingVolumeDivider = 5;
- m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
- AddSampleToRequestedQueue();
+ for (i = 0; i < m_sCollisionManager.m_bCollisionsInQueue; i++) {
+ int index = m_sCollisionManager.m_bIndicesTable[i];
+ if (!abRepeatedCollision1[index]) {
+ for (j = 0; j < NUMAUDIOCOLLISIONS; j++) {
+ if (!abRepeatedCollision2[j]) {
+ m_sCollisionManager.m_asCollisions2[j].m_nBaseVolume = 1;
+ m_sCollisionManager.m_asCollisions2[j].m_pEntity1 = m_sCollisionManager.m_asCollisions1[index].m_pEntity1;
+ m_sCollisionManager.m_asCollisions2[j].m_pEntity2 = m_sCollisionManager.m_asCollisions1[index].m_pEntity2;
+ m_sCollisionManager.m_asCollisions2[j].m_bSurface1 = m_sCollisionManager.m_asCollisions1[index].m_bSurface1;
+ m_sCollisionManager.m_asCollisions2[j].m_bSurface2 = m_sCollisionManager.m_asCollisions1[index].m_bSurface2;
+ break;
+ }
}
+ SetUpOneShotCollisionSound(m_sCollisionManager.m_asCollisions1[index]);
+ SetUpLoopingCollisionSound(m_sCollisionManager.m_asCollisions1[index], j);
}
}
+
+ for (int i = 0; i < NUMAUDIOCOLLISIONS; i++)
+ m_sCollisionManager.m_bIndicesTable[i] = NUMAUDIOCOLLISIONS;
+ m_sCollisionManager.m_bCollisionsInQueue = 0;
}
+
static const int32 gOneShotCol[] = {SFX_COL_TARMAC_1,
SFX_COL_TARMAC_1,
SFX_COL_GRASS_1,
@@ -219,9 +176,8 @@ static const int32 gOneShotCol[] = {SFX_COL_TARMAC_1,
void
cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
{
-
- int16 s1;
- int16 s2;
+ uint16 s1;
+ uint16 s2;
int32 emittingVol;
float ratio;
@@ -321,101 +277,127 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
}
void
-cAudioManager::ServiceCollisions()
+cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter)
{
- int i, j;
- bool8 abRepeatedCollision1[NUMAUDIOCOLLISIONS];
- bool8 abRepeatedCollision2[NUMAUDIOCOLLISIONS];
-
- m_sQueueSample.m_nEntityIndex = m_nCollisionEntity;
-
- for (int i = 0; i < NUMAUDIOCOLLISIONS; i++)
- abRepeatedCollision1[i] = abRepeatedCollision2[i] = FALSE;
-
- for (i = 0; i < m_sCollisionManager.m_bCollisionsInQueue; i++) {
- for (j = 0; j < NUMAUDIOCOLLISIONS; j++) {
- int index = m_sCollisionManager.m_bIndicesTable[i];
- if ((m_sCollisionManager.m_asCollisions1[index].m_pEntity1 == m_sCollisionManager.m_asCollisions2[j].m_pEntity1)
- && (m_sCollisionManager.m_asCollisions1[index].m_pEntity2 == m_sCollisionManager.m_asCollisions2[j].m_pEntity2)
- && (m_sCollisionManager.m_asCollisions1[index].m_bSurface1 == m_sCollisionManager.m_asCollisions2[j].m_bSurface1)
- && (m_sCollisionManager.m_asCollisions1[index].m_bSurface2 == m_sCollisionManager.m_asCollisions2[j].m_bSurface2)
- ) {
- abRepeatedCollision1[index] = TRUE;
- abRepeatedCollision2[j] = TRUE;
- m_sCollisionManager.m_asCollisions1[index].m_nBaseVolume = ++m_sCollisionManager.m_asCollisions2[j].m_nBaseVolume;
- SetUpLoopingCollisionSound(m_sCollisionManager.m_asCollisions1[index], j);
- break;
+ if(col.m_fIntensity2 > 0.0016f) {
+ uint8 emittingVol = SetLoopingCollisionRequestedSfxFreqAndGetVol(col);
+ if(emittingVol) {
+ m_sQueueSample.m_fDistance = Sqrt(col.m_fDistance);
+ m_sQueueSample.m_nVolume =
+ ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
+ if(m_sQueueSample.m_nVolume) {
+ m_sQueueSample.m_nCounter = counter;
+ m_sQueueSample.m_vecPos = col.m_vecPosition;
+ m_sQueueSample.m_nBankIndex = SFX_BANK_0;
+ m_sQueueSample.m_bIs2D = FALSE;
+ m_sQueueSample.m_nReleasingVolumeModificator = 7;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 4.0f;
+ m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity;
+ m_sQueueSample.m_bReleasingSoundFlag = FALSE;
+ m_sQueueSample.m_nReleasingVolumeDivider = 5;
+ m_sQueueSample.m_bReverbFlag = TRUE;
+ m_sQueueSample.m_bRequireReflection = FALSE;
+ AddSampleToRequestedQueue();
}
}
}
+}
- for (i = 0; i < NUMAUDIOCOLLISIONS; i++) {
- if (!abRepeatedCollision2[i]) {
- m_sCollisionManager.m_asCollisions2[i].m_pEntity1 = nil;
- m_sCollisionManager.m_asCollisions2[i].m_pEntity2 = nil;
- m_sCollisionManager.m_asCollisions2[i].m_bSurface1 = SURFACE_DEFAULT;
- m_sCollisionManager.m_asCollisions2[i].m_bSurface2 = SURFACE_DEFAULT;
- m_sCollisionManager.m_asCollisions2[i].m_fIntensity2 = 0.0f;
- m_sCollisionManager.m_asCollisions2[i].m_fIntensity1 = 0.0f;
- m_sCollisionManager.m_asCollisions2[i].m_vecPosition = CVector(0.0f, 0.0f, 0.0f);
- m_sCollisionManager.m_asCollisions2[i].m_fDistance = 0.0f;
- }
+uint32
+cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision)
+{
+ uint8 surface1 = audioCollision.m_bSurface1;
+ uint8 surface2 = audioCollision.m_bSurface2;
+ int32 vol;
+ float ratio;
+
+ if(surface1 == SURFACE_GRASS || surface2 == SURFACE_GRASS || surface1 == SURFACE_HEDGE ||
+ surface2 == SURFACE_HEDGE) {
+ ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
+ m_sQueueSample.m_nSampleIndex = SFX_RAIN;
+ m_sQueueSample.m_nFrequency = 13000.f * ratio + 35000;
+ vol = 50.f * ratio;
+ } else if(surface1 == SURFACE_WATER || surface2 == SURFACE_WATER) {
+ ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
+ m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP;
+ m_sQueueSample.m_nFrequency = 6050.f * ratio + 16000;
+ vol = 30.f * ratio;
+ } else if(surface1 == SURFACE_GRAVEL || surface2 == SURFACE_GRAVEL || surface1 == SURFACE_MUD_DRY ||
+ surface2 == SURFACE_MUD_DRY || surface1 == SURFACE_SAND || surface2 == SURFACE_SAND) {
+ ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
+ m_sQueueSample.m_nSampleIndex = SFX_GRAVEL_SKID;
+ m_sQueueSample.m_nFrequency = 6000.f * ratio + 10000;
+ vol = 50.f * ratio;
+ } else if(surface1 == SURFACE_PED || surface2 == SURFACE_PED) {
+ return 0;
+ } else {
+ ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
+ m_sQueueSample.m_nSampleIndex = SFX_SCRAPE_CAR_1;
+ m_sQueueSample.m_nFrequency = 10000.f * ratio + 10000;
+ vol = 40.f * ratio;
}
+ if(audioCollision.m_nBaseVolume < 2) vol = audioCollision.m_nBaseVolume * vol / 2;
+ return vol;
+}
- for (i = 0; i < m_sCollisionManager.m_bCollisionsInQueue; i++) {
- int index = m_sCollisionManager.m_bIndicesTable[i];
- if (!abRepeatedCollision1[index]) {
- for (j = 0; j < NUMAUDIOCOLLISIONS; j++) {
- if (!abRepeatedCollision2[j]) {
- m_sCollisionManager.m_asCollisions2[j].m_nBaseVolume = 1;
- m_sCollisionManager.m_asCollisions2[j].m_pEntity1 = m_sCollisionManager.m_asCollisions1[index].m_pEntity1;
- m_sCollisionManager.m_asCollisions2[j].m_pEntity2 = m_sCollisionManager.m_asCollisions1[index].m_pEntity2;
- m_sCollisionManager.m_asCollisions2[j].m_bSurface1 = m_sCollisionManager.m_asCollisions1[index].m_bSurface1;
- m_sCollisionManager.m_asCollisions2[j].m_bSurface2 = m_sCollisionManager.m_asCollisions1[index].m_bSurface2;
- break;
- }
- }
- SetUpOneShotCollisionSound(m_sCollisionManager.m_asCollisions1[index]);
- SetUpLoopingCollisionSound(m_sCollisionManager.m_asCollisions1[index], j);
- }
+float
+cAudioManager::GetCollisionOneShotRatio(uint32 a, float b)
+{
+ switch(a) {
+ case SURFACE_DEFAULT:
+ case SURFACE_TARMAC:
+ case SURFACE_PAVEMENT:
+ case SURFACE_STEEP_CLIFF:
+ case SURFACE_TRANSPARENT_STONE: return GetCollisionRatio(b, 10.f, 60.f, 50.f);
+ case SURFACE_GRASS:
+ case SURFACE_CARDBOARDBOX:
+ case SURFACE_GRAVEL:
+ case SURFACE_MUD_DRY: return GetCollisionRatio(b, 0.f, 2.f, 2.f);
+ case SURFACE_CAR: return GetCollisionRatio(b, 6.f, 50.f, 44.f);
+ case SURFACE_GLASS:
+ case SURFACE_METAL_CHAIN_FENCE: return GetCollisionRatio(b, 0.1f, 10.f, 9.9f);
+ case SURFACE_TRANSPARENT_CLOTH:
+ case SURFACE_THICK_METAL_PLATE: return GetCollisionRatio(b, 30.f, 130.f, 100.f);
+ case SURFACE_GARAGE_DOOR: return GetCollisionRatio(b, 20.f, 100.f, 80.f);
+ case SURFACE_CAR_PANEL: return GetCollisionRatio(b, 0.f, 4.f, 4.f);
+ case SURFACE_SCAFFOLD_POLE:
+ case SURFACE_METAL_GATE:
+ case SURFACE_LAMP_POST: return GetCollisionRatio(b, 1.f, 10.f, 9.f);
+ case SURFACE_FIRE_HYDRANT: return GetCollisionRatio(b, 1.f, 15.f, 14.f);
+ case SURFACE_GIRDER: return GetCollisionRatio(b, 8.f, 50.f, 42.f);
+ case SURFACE_PED: return GetCollisionRatio(b, 0.f, 20.f, 20.f);
+ case SURFACE_SAND:
+ case SURFACE_WATER:
+ case SURFACE_RUBBER:
+ case SURFACE_WHEELBASE: return GetCollisionRatio(b, 0.f, 10.f, 10.f);
+ case SURFACE_WOOD_CRATES: return GetCollisionRatio(b, 1.f, 4.f, 3.f);
+ case SURFACE_WOOD_BENCH: return GetCollisionRatio(b, 0.1f, 5.f, 4.9f);
+ case SURFACE_WOOD_SOLID: return GetCollisionRatio(b, 0.1f, 40.f, 39.9f);
+ case SURFACE_PLASTIC: return GetCollisionRatio(b, 0.1f, 4.f, 3.9f);
+ case SURFACE_HEDGE: return GetCollisionRatio(b, 0.f, 0.5f, 0.5f);
+ case SURFACE_CONTAINER: return GetCollisionRatio(b, 4.f, 40.f, 36.f);
+ case SURFACE_NEWS_VENDOR: return GetCollisionRatio(b, 0.f, 5.f, 5.f);
+ default: break;
}
- for (int i = 0; i < NUMAUDIOCOLLISIONS; i++)
- m_sCollisionManager.m_bIndicesTable[i] = NUMAUDIOCOLLISIONS;
- m_sCollisionManager.m_bCollisionsInQueue = 0;
+ return 0.f;
}
-void
-cAudioManager::ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, float collisionPower,
- float velocity)
+float
+cAudioManager::GetCollisionLoopingRatio(uint32 a, uint32 b, float c)
{
- float distSquared;
- CVector v1;
- CVector v2;
-
- if(!m_bIsInitialised || m_nCollisionEntity < 0 || m_nUserPause ||
- (velocity < 0.0016f && collisionPower < 0.01f))
- return;
+ return GetCollisionRatio(c, 0.0f, 0.02f, 0.02f);
+}
- if(entity1->IsBuilding()) {
- v1 = v2 = entity2->GetPosition();
- } else if(entity2->IsBuilding()) {
- v1 = v2 = entity1->GetPosition();
- } else {
- v1 = entity1->GetPosition();
- v2 = entity2->GetPosition();
- }
- CVector pos = (v1 + v2) * 0.5f;
- distSquared = GetDistanceSquared(pos);
- if(distSquared < SQR(CollisionSoundIntensity)) {
- m_sCollisionManager.m_sQueue.m_pEntity1 = entity1;
- m_sCollisionManager.m_sQueue.m_pEntity2 = entity2;
- m_sCollisionManager.m_sQueue.m_bSurface1 = surface1;
- m_sCollisionManager.m_sQueue.m_bSurface2 = surface2;
- m_sCollisionManager.m_sQueue.m_fIntensity1 = collisionPower;
- m_sCollisionManager.m_sQueue.m_fIntensity2 = velocity;
- m_sCollisionManager.m_sQueue.m_vecPosition = pos;
- m_sCollisionManager.m_sQueue.m_fDistance = distSquared;
- m_sCollisionManager.AddCollisionToRequestedQueue();
- }
+float
+cAudioManager::GetCollisionRatio(float a, float b, float c, float d)
+{
+ float e;
+ e = a;
+ if(a <= b) return 0.0f;
+ if(c <= a) e = c;
+ return (e - b) / d;
}
diff --git a/src/audio/AudioCollision.h b/src/audio/AudioCollision.h
index 0a058916..a201d500 100644
--- a/src/audio/AudioCollision.h
+++ b/src/audio/AudioCollision.h
@@ -17,7 +17,18 @@ public:
float m_fDistance;
int32 m_nBaseVolume;
- // no methods
+ cAudioCollision() { Reset(); }
+
+ void Reset()
+ {
+ m_pEntity1 = nil;
+ m_pEntity2 = nil;
+ m_bSurface1 = 0;
+ m_bSurface2 = 0;
+ m_fIntensity1 = m_fIntensity2 = 0.0f;
+ m_vecPosition = CVector(0.0f, 0.0f, 0.0f);
+ m_fDistance = 0.0f;
+ }
};
VALIDATE_SIZE(cAudioCollision, 40);
@@ -31,7 +42,15 @@ public:
uint8 m_bCollisionsInQueue;
cAudioCollision m_sQueue;
- cAudioCollisionManager();
+ cAudioCollisionManager()
+ {
+ m_sQueue.Reset();
+
+ for(int i = 0; i < NUMAUDIOCOLLISIONS; i++)
+ m_bIndicesTable[i] = NUMAUDIOCOLLISIONS;
+
+ m_bCollisionsInQueue = 0;
+ }
void AddCollisionToRequestedQueue();
};
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp
index fdc7305b..44664f8a 100644
--- a/src/audio/AudioLogic.cpp
+++ b/src/audio/AudioLogic.cpp
@@ -52,11 +52,8 @@ uint32 gHomeNextTime;
uint32 gCellNextTime;
uint32 gNextCryTime;
-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 };
-
void
-cAudioManager::PreInitialiseGameSpecificSetup() const
+cAudioManager::PreInitialiseGameSpecificSetup()
{
BankStartOffset[SFX_BANK_0] = SAMPLEBANK_START;
#ifdef GTA_PS2
@@ -163,6 +160,7 @@ cAudioManager::PostInitialiseGameSpecificSetup()
m_sMissionAudio.m_nMissionAudioCounter = 0;
ResetAudioLogicTimers(CTimer::GetTimeInMilliseconds());
}
+
void
cAudioManager::PreTerminateGameSpecificShutdown()
{
@@ -228,7 +226,7 @@ cAudioManager::ResetAudioLogicTimers(uint32 timer)
}
void
-cAudioManager::ProcessReverb() const
+cAudioManager::ProcessReverb()
{
if (SampleManager.UpdateReverb() && m_bDynamicAcousticModelingStatus) {
#ifndef GTA_PS2
@@ -248,7 +246,7 @@ cAudioManager::ProcessReverb() const
}
float
-cAudioManager::GetDistanceSquared(const CVector &v) const
+cAudioManager::GetDistanceSquared(const CVector &v)
{
const CVector &c = TheCamera.GetPosition();
return sq(v.x - c.x) + sq(v.y - c.y) + sq((v.z - c.z) * 0.2f);
@@ -801,8 +799,6 @@ cAudioManager::ProcessModelCarEngine(cVehicleParams& params)
}
}
-
-
bool8
cAudioManager::ProcessVehicleRoadNoise(cVehicleParams& params)
{
@@ -1063,20 +1059,20 @@ cAudioManager::UpdateGasPedalAudio(CAutomobile *automobile)
}
void
-cAudioManager::PlayerJustGotInCar() const
+cAudioManager::PlayerJustGotInCar()
{
if (m_bIsInitialised)
bPlayerJustEnteredCar = TRUE;
}
void
-cAudioManager::PlayerJustLeftCar(void) const
+cAudioManager::PlayerJustLeftCar(void)
{
// UNUSED: This is a perfectly empty function.
}
void
-cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 bank, uint8 counter, bool8 notLooping)
+cAudioManager::AddPlayerCarSample(uint8 emittingVolume, uint32 freq, uint32 sample, uint8 bank, uint8 counter, bool8 notLooping)
{
m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, 50.f, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
@@ -1581,7 +1577,7 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams& params)
}
bool8
-cAudioManager::UsesSiren(int32 model) const
+cAudioManager::UsesSiren(uint32 model)
{
switch (model) {
case FIRETRUK:
@@ -1597,7 +1593,7 @@ cAudioManager::UsesSiren(int32 model) const
}
bool8
-cAudioManager::UsesSirenSwitching(int32 model) const
+cAudioManager::UsesSirenSwitching(uint32 model)
{
switch (model) {
case AMBULAN:
@@ -1663,7 +1659,7 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams& params)
}
bool8
-cAudioManager::UsesReverseWarning(int32 model) const
+cAudioManager::UsesReverseWarning(uint32 model)
{
return model == LINERUN || model == FIRETRUK || model == TRASH || model == BUS || model == COACH;
}
@@ -1792,7 +1788,7 @@ cAudioManager::ProcessAirBrakes(cVehicleParams& params)
}
bool8
-cAudioManager::HasAirBrakes(int32 model) const
+cAudioManager::HasAirBrakes(uint32 model)
{
return model == LINERUN || model == FIRETRUK || model == TRASH || model == BUS || model == COACH;
}
@@ -2631,8 +2627,8 @@ uint8 gJumboVolOffsetPercentage;
void
DoJumboVolOffset()
{
- if (!(AudioManager.GetFrameCounter() % (AudioManager.GetRandomNumber(0) % 6 + 3)))
- gJumboVolOffsetPercentage = AudioManager.GetRandomNumber(1) % 60;
+ if (!(AudioManager.m_FrameCounter % (AudioManager.m_anRandomTable[0] % 6 + 3)))
+ gJumboVolOffsetPercentage = AudioManager.m_anRandomTable[1] % 60;
}
void
@@ -2910,7 +2906,7 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol)
}
int32
-cAudioManager::GetJumboTaxiFreq() const
+cAudioManager::GetJumboTaxiFreq()
{
return (60.833f * m_sQueueSample.m_fDistance) + 22050;
}
@@ -3565,23 +3561,23 @@ cAudioManager::SetupPedComments(cPedParams &params, uint16 sound)
switch (sound) {
case SOUND_PED_HELI_PLAYER_FOUND:
soundIntensity = 400.0f;
- pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_POLICE_HELI_1, SFX_POLICE_HELI_29);
+ pedComment.m_nSampleIndex = m_anRandomTable[m_sQueueSample.m_nEntityIndex % 4] % 29 + SFX_POLICE_HELI_1;
break;
case SOUND_PED_BODYCAST_HIT:
if (CTimer::GetTimeInMilliseconds() <= gNextCryTime)
return;
soundIntensity = 50.0f;
gNextCryTime = CTimer::GetTimeInMilliseconds() + 500;
- pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_PLASTER_BLOKE_1, SFX_PLASTER_BLOKE_4);
+ pedComment.m_nSampleIndex = m_anRandomTable[m_sQueueSample.m_nEntityIndex % 4] % 4 + SFX_PLASTER_BLOKE_1;
break;
case SOUND_INJURED_PED_MALE_OUCH:
case SOUND_INJURED_PED_MALE_PRISON:
soundIntensity = 50.0f;
- pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_GENERIC_MALE_GRUNT_1, SFX_GENERIC_MALE_GRUNT_15);
+ pedComment.m_nSampleIndex = m_anRandomTable[m_sQueueSample.m_nEntityIndex % 4] % 15 + SFX_GENERIC_MALE_GRUNT_1;
break;
case SOUND_INJURED_PED_FEMALE:
soundIntensity = 50.0f;
- pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_GENERIC_FEMALE_GRUNT_1, SFX_GENERIC_FEMALE_GRUNT_11);
+ pedComment.m_nSampleIndex = m_anRandomTable[m_sQueueSample.m_nEntityIndex % 4] % 11 + SFX_GENERIC_FEMALE_GRUNT_1;
break;
default:
return;
@@ -3618,7 +3614,7 @@ cAudioManager::SetupPedComments(cPedParams &params, uint16 sound)
}
int32
-cAudioManager::GetPedCommentSfx(CPed *ped, int32 sound)
+cAudioManager::GetPedCommentSfx(CPed *ped, uint16 sound)
{
if (ped->IsPlayer())
return GetPlayerTalkSfx(sound);
@@ -3639,7 +3635,7 @@ cAudioManager::GetPedCommentSfx(CPed *ped, int32 sound)
case MI_MALE01:
return GetNormalMaleTalkSfx(sound);
case MI_TAXI_D:
- return GetTaxiDriverTalkSfx(sound);
+ return GetAsianTaxiDriverTalkSfx(sound);
case MI_PIMP:
return GetPimpTalkSfx(sound);
case MI_GANG01:
@@ -3673,7 +3669,7 @@ cAudioManager::GetPedCommentSfx(CPed *ped, int32 sound)
case MI_SPECIAL04:
return GetSpecialCharacterTalkSfx(ped->GetModelIndex(), sound);
case MI_MALE02:
- return GetMaleNo2TalkSfx(sound);
+ return GetCasualMaleOldTalkSfx(sound);
case MI_MALE03:
case MI_P_MAN1:
case MI_P_MAN2:
@@ -3768,14 +3764,14 @@ cAudioManager::GetPedCommentSfx(CPed *ped, int32 sound)
case MI_STUD_WOM:
return GetStudentFemaleTalkSfx(sound);
case MI_CAS_MAN:
- return GetCasualMaleOldTalkSfx(sound);
+ return GetCasualMaleYoungTalkSfx(sound);
default:
return GetGenericMaleTalkSfx(sound);
}
}
void
-cAudioManager::GetPhrase(uint32 &phrase, uint32 &prevPhrase, uint32 sample, uint32 maxOffset) const
+cAudioManager::GetPhrase(uint32 &phrase, uint32 &prevPhrase, uint32 sample, uint32 maxOffset)
{
phrase = sample + m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % maxOffset;
@@ -3789,7 +3785,7 @@ cAudioManager::GetPhrase(uint32 &phrase, uint32 &prevPhrase, uint32 sample, uint
#pragma region PED_COMMENTS
uint32
-cAudioManager::GetPlayerTalkSfx(int16 sound)
+cAudioManager::GetPlayerTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -3812,7 +3808,7 @@ cAudioManager::GetPlayerTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetCopTalkSfx(int16 sound)
+cAudioManager::GetCopTalkSfx(uint16 sound)
{
uint32 sfx;
PedState pedState;
@@ -3836,7 +3832,7 @@ cAudioManager::GetCopTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetSwatTalkSfx(int16 sound)
+cAudioManager::GetSwatTalkSfx(uint16 sound)
{
uint32 sfx;
PedState pedState;
@@ -3860,7 +3856,7 @@ cAudioManager::GetSwatTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetFBITalkSfx(int16 sound)
+cAudioManager::GetFBITalkSfx(uint16 sound)
{
uint32 sfx;
PedState pedState;
@@ -3884,7 +3880,7 @@ cAudioManager::GetFBITalkSfx(int16 sound)
}
uint32
-cAudioManager::GetArmyTalkSfx(int16 sound)
+cAudioManager::GetArmyTalkSfx(uint16 sound)
{
uint32 sfx;
PedState pedState;
@@ -3903,7 +3899,7 @@ cAudioManager::GetArmyTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetMedicTalkSfx(int16 sound)
+cAudioManager::GetMedicTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -3931,41 +3927,41 @@ cAudioManager::GetMedicTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetFiremanTalkSfx(int16 sound)
+cAudioManager::GetFiremanTalkSfx(uint16 sound)
{
return GetGenericMaleTalkSfx(sound);
}
uint32
-cAudioManager::GetNormalMaleTalkSfx(int16 sound)
+cAudioManager::GetBusinessMaleOldTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
switch (sound) {
case SOUND_PED_HANDS_COWER:
- GetPhrase(sfx, lastSfx, SFX_NORMAL_MALE_GUN_PANIC_1, 7);
+ GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_GUN_PANIC_1, 3);
break;
case SOUND_PED_CAR_JACKED:
- GetPhrase(sfx, lastSfx, SFX_NORMAL_MALE_CARJACKED_1, 7);
+ GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_MUGGED_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_FIGHT_1, 5);
break;
case SOUND_PED_EVADE:
- GetPhrase(sfx, lastSfx, SFX_NORMAL_MALE_DODGE_1, 9);
+ GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_DODGE_1, 4);
break;
case SOUND_PED_FLEE_RUN:
- GetPhrase(sfx, lastSfx, SFX_NORMAL_MALE_RUN_FROM_FIGHT_1, 5);
+ GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_MRUN_FROM_FIGHT_1, 5);
break;
case SOUND_PED_ANNOYED_DRIVER:
- GetPhrase(sfx, lastSfx, SFX_NORMAL_MALE_DRIVER_ABUSE_1, 12);
- break;
- case SOUND_PED_CHAT_SEXY:
- GetPhrase(sfx, lastSfx, SFX_NORMAL_MALE_EYING_1, 8);
- break;
- case SOUND_PED_CHAT_EVENT:
- GetPhrase(sfx, lastSfx, SFX_NORMAL_MALE_SHOCKED_1, 10);
+ GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_DRIVER_ABUSE_1, 5);
break;
case SOUND_PED_CHAT:
- GetPhrase(sfx, lastSfx, SFX_NORMAL_MALE_CHAT_1, 25);
+ GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_CHAT_1, 5);
break;
default:
return GetGenericMaleTalkSfx(sound);
@@ -3974,61 +3970,47 @@ cAudioManager::GetNormalMaleTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetTaxiDriverTalkSfx(int16 sound)
+cAudioManager::GetBusinessMaleYoungTalkSfx(uint16 sound, uint32 model)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
switch (sound) {
- case SOUND_PED_CAR_JACKED:
- GetPhrase(sfx, lastSfx, SFX_ASIAN_TAXI_DRIVER_VOICE_1_CARJACKED_1, 7);
- break;
- case SOUND_PED_ANNOYED_DRIVER:
- GetPhrase(sfx, lastSfx, SFX_ASIAN_TAXI_DRIVER_VOICE_1_DRIVER_ABUSE_1, 6);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
-
- return (SFX_ASIAN_TAXI_DRIVER_VOICE_2_DRIVER_ABUSE_1 - SFX_ASIAN_TAXI_DRIVER_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
-}
-
-uint32
-cAudioManager::GetPimpTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_UP:
- GetPhrase(sfx, lastSfx, SFX_PIMP_GUN_COOL_1, 7);
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_GUN_PANIC_1, 3);
break;
case SOUND_PED_CAR_JACKED:
- GetPhrase(sfx, lastSfx, SFX_PIMP_CARJACKED_1, 4);
+ GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_CARJACKED_1, 2);
break;
- case SOUND_PED_DEFEND:
- GetPhrase(sfx, lastSfx, SFX_PIMP_FIGHT_1, 9);
+ case SOUND_PED_ROBBED:
+ GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_MUGGED_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_FIGHT_1, 4);
break;
case SOUND_PED_EVADE:
- GetPhrase(sfx, lastSfx, SFX_PIMP_DODGE_1, 6);
+ GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_DODGE_1, 4);
break;
- case SOUND_PED_ANNOYED_DRIVER:
- GetPhrase(sfx, lastSfx, SFX_PIMP_DRIVER_ABUSE_1, 5);
+ case SOUND_PED_FLEE_RUN:
+ GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_RUN_FROM_FIGHT_1, 5);
break;
- case SOUND_PED_CHAT_EVENT:
- GetPhrase(sfx, lastSfx, SFX_PIMP_SHOCKED_1, 2);
+ case SOUND_PED_ANNOYED_DRIVER:
+ GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_DRIVER_ABUSE_1, 6);
break;
case SOUND_PED_CHAT:
- GetPhrase(sfx, lastSfx, SFX_PIMP_CHAT_1, 17);
+ GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_CHAT_1, 6);
break;
default:
return GetGenericMaleTalkSfx(sound);
}
+
+ if (model == MI_B_MAN3)
+ sfx += (SFX_BUSINESS_MALE_YOUNG_VOICE_2_DRIVER_ABUSE_1 - SFX_BUSINESS_MALE_YOUNG_VOICE_1_DRIVER_ABUSE_1);
return sfx;
}
uint32
-cAudioManager::GetMafiaTalkSfx(int16 sound)
+cAudioManager::GetMafiaTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4062,7 +4044,7 @@ cAudioManager::GetMafiaTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetTriadTalkSfx(int16 sound)
+cAudioManager::GetTriadTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4099,7 +4081,7 @@ cAudioManager::GetTriadTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetDiabloTalkSfx(int16 sound)
+cAudioManager::GetDiabloTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4140,7 +4122,7 @@ cAudioManager::GetDiabloTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetYakuzaTalkSfx(int16 sound)
+cAudioManager::GetYakuzaTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4171,7 +4153,7 @@ cAudioManager::GetYakuzaTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetYardieTalkSfx(int16 sound)
+cAudioManager::GetYardieTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4208,7 +4190,7 @@ cAudioManager::GetYardieTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetColumbianTalkSfx(int16 sound)
+cAudioManager::GetColumbianTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4242,7 +4224,7 @@ cAudioManager::GetColumbianTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetHoodTalkSfx(int16 sound)
+cAudioManager::GetHoodTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4281,7 +4263,7 @@ cAudioManager::GetHoodTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetBlackCriminalTalkSfx(int16 sound)
+cAudioManager::GetBlackCriminalTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4313,7 +4295,7 @@ cAudioManager::GetBlackCriminalTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetWhiteCriminalTalkSfx(int16 sound)
+cAudioManager::GetWhiteCriminalTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4345,7 +4327,7 @@ cAudioManager::GetWhiteCriminalTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetMaleNo2TalkSfx(int16 sound)
+cAudioManager::GetCasualMaleOldTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4379,79 +4361,13 @@ cAudioManager::GetMaleNo2TalkSfx(int16 sound)
}
uint32
-cAudioManager::GetBlackProjectMaleTalkSfx(int16 sound, int32 model)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch(sound) {
- case SOUND_PED_HANDS_UP: GetPhrase(sfx, lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_GUN_COOL_1, 3); break;
- case SOUND_PED_CAR_JACKED: GetPhrase(sfx, lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_CARJACKED_1, 2); break;
- case SOUND_PED_ROBBED: GetPhrase(sfx, lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_MUGGED_1, 2); break;
- case SOUND_PED_ATTACK: GetPhrase(sfx, lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_FIGHT_1, 6); break;
- case SOUND_PED_EVADE: GetPhrase(sfx, lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_DODGE_1, 5); break;
- case SOUND_PED_ANNOYED_DRIVER: GetPhrase(sfx, lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_DRIVER_ABUSE_1, 7); break;
- case SOUND_PED_CHAT_SEXY: GetPhrase(sfx, lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_EYING_1, 3); break;
- case SOUND_PED_CHAT: GetPhrase(sfx, lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_CHAT_1, 6); break;
- default: return GetGenericMaleTalkSfx(sound);
- }
-
- if (model == MI_P_MAN2)
- sfx += (SFX_BLACK_PROJECT_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_BLACK_PROJECT_MALE_VOICE_1_DRIVER_ABUSE_1);
- return sfx;
-}
-
-uint32
-cAudioManager::GetWhiteFatMaleTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch(sound) {
- case SOUND_PED_CAR_JACKED: GetPhrase(sfx, lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_CARJACKED_1, 3); break;
- case SOUND_PED_ROBBED: GetPhrase(sfx, lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_MUGGED_1, 3); break;
- case SOUND_PED_EVADE: GetPhrase(sfx, lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_DODGE_1, 9); break;
- case SOUND_PED_ANNOYED_DRIVER: GetPhrase(sfx, lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_DRIVER_ABUSE_1, 9); break;
- case SOUND_PED_WAIT_DOUBLEBACK: GetPhrase(sfx, lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_LOST_1, 2); break;
- case SOUND_PED_CHAT: GetPhrase(sfx, lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_CHAT_1, 9); break;
- default: return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetBlackFatMaleTalkSfx(int16 sound)
+cAudioManager::GetCasualMaleYoungTalkSfx(uint16 sound)
{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_CAR_JACKED:
- GetPhrase(sfx, lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_CARJACKED_1, 4);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(sfx, lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_MUGGED_1, 3);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(sfx, lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_DODGE_1, 7);
- break;
- case SOUND_PED_ANNOYED_DRIVER:
- GetPhrase(sfx, lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_DRIVER_ABUSE_1, 6);
- break;
- case SOUND_PED_WAIT_DOUBLEBACK:
- GetPhrase(sfx, lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_LOST_1, 3);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(sfx, lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_CHAT_1, 8);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
+ return GetGenericMaleTalkSfx(sound);
}
uint32
-cAudioManager::GetBlackCasualFemaleTalkSfx(int16 sound)
+cAudioManager::GetBlackCasualFemaleTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4488,7 +4404,7 @@ cAudioManager::GetBlackCasualFemaleTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetWhiteCasualFemaleTalkSfx(int16 sound)
+cAudioManager::GetWhiteCasualFemaleTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4525,7 +4441,7 @@ cAudioManager::GetWhiteCasualFemaleTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetFemaleNo3TalkSfx(int16 sound)
+cAudioManager::GetFemaleNo3TalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4562,7 +4478,47 @@ cAudioManager::GetFemaleNo3TalkSfx(int16 sound)
}
uint32
-cAudioManager::GetBlackFatFemaleTalkSfx(int16 sound)
+cAudioManager::GetWhiteBusinessFemaleTalkSfx(uint16 sound, uint32 model)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(sfx, lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_GUN_PANIC_1, 4);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(sfx, lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(sfx, lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_MUGGED_1, 2);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(sfx, lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_DODGE_1, 6);
+ break;
+ case SOUND_PED_FLEE_RUN:
+ GetPhrase(sfx, lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_RUN_FROM_FIGHT_1, 4);
+ break;
+ case SOUND_PED_ANNOYED_DRIVER:
+ GetPhrase(sfx, lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_DRIVER_ABUSE_1, 5);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ GetPhrase(sfx, lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_SHOCKED_1, 4);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(sfx, lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_CHAT_1, 7);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ }
+
+ if (model == MI_B_WOM2)
+ sfx += (SFX_WHITE_BUSINESS_FEMALE_VOICE_2_DRIVER_ABUSE_1 - SFX_WHITE_BUSINESS_FEMALE_VOICE_1_DRIVER_ABUSE_1);
+ return sfx;
+}
+
+uint32
+cAudioManager::GetBlackFatFemaleTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4596,7 +4552,56 @@ cAudioManager::GetBlackFatFemaleTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetWhiteFatFemaleTalkSfx(int16 sound)
+cAudioManager::GetWhiteFatMaleTalkSfx(uint16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch(sound) {
+ case SOUND_PED_CAR_JACKED: GetPhrase(sfx, lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_CARJACKED_1, 3); break;
+ case SOUND_PED_ROBBED: GetPhrase(sfx, lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_MUGGED_1, 3); break;
+ case SOUND_PED_EVADE: GetPhrase(sfx, lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_DODGE_1, 9); break;
+ case SOUND_PED_ANNOYED_DRIVER: GetPhrase(sfx, lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_DRIVER_ABUSE_1, 9); break;
+ case SOUND_PED_WAIT_DOUBLEBACK: GetPhrase(sfx, lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_LOST_1, 2); break;
+ case SOUND_PED_CHAT: GetPhrase(sfx, lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_CHAT_1, 9); break;
+ default: return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetBlackFatMaleTalkSfx(uint16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(sfx, lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_CARJACKED_1, 4);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(sfx, lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_MUGGED_1, 3);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(sfx, lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_DODGE_1, 7);
+ break;
+ case SOUND_PED_ANNOYED_DRIVER:
+ GetPhrase(sfx, lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_DRIVER_ABUSE_1, 6);
+ break;
+ case SOUND_PED_WAIT_DOUBLEBACK:
+ GetPhrase(sfx, lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_LOST_1, 3);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(sfx, lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_CHAT_1, 8);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetWhiteFatFemaleTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4630,7 +4635,7 @@ cAudioManager::GetWhiteFatFemaleTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetBlackFemaleProstituteTalkSfx(int16 sound)
+cAudioManager::GetBlackFemaleProstituteTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4664,7 +4669,7 @@ cAudioManager::GetBlackFemaleProstituteTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetWhiteFemaleProstituteTalkSfx(int16 sound)
+cAudioManager::GetWhiteFemaleProstituteTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4695,7 +4700,30 @@ cAudioManager::GetWhiteFemaleProstituteTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetBlackProjectFemaleOldTalkSfx(int16 sound)
+cAudioManager::GetBlackProjectMaleTalkSfx(uint16 sound, uint32 model)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch(sound) {
+ case SOUND_PED_HANDS_UP: GetPhrase(sfx, lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_GUN_COOL_1, 3); break;
+ case SOUND_PED_CAR_JACKED: GetPhrase(sfx, lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_CARJACKED_1, 2); break;
+ case SOUND_PED_ROBBED: GetPhrase(sfx, lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_MUGGED_1, 2); break;
+ case SOUND_PED_ATTACK: GetPhrase(sfx, lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_FIGHT_1, 6); break;
+ case SOUND_PED_EVADE: GetPhrase(sfx, lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_DODGE_1, 5); break;
+ case SOUND_PED_ANNOYED_DRIVER: GetPhrase(sfx, lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_DRIVER_ABUSE_1, 7); break;
+ case SOUND_PED_CHAT_SEXY: GetPhrase(sfx, lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_EYING_1, 3); break;
+ case SOUND_PED_CHAT: GetPhrase(sfx, lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_CHAT_1, 6); break;
+ default: return GetGenericMaleTalkSfx(sound);
+ }
+
+ if (model == MI_P_MAN2)
+ sfx += (SFX_BLACK_PROJECT_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_BLACK_PROJECT_MALE_VOICE_1_DRIVER_ABUSE_1);
+ return sfx;
+}
+
+uint32
+cAudioManager::GetBlackProjectFemaleOldTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4729,7 +4757,7 @@ cAudioManager::GetBlackProjectFemaleOldTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetBlackProjectFemaleYoungTalkSfx(int16 sound)
+cAudioManager::GetBlackProjectFemaleYoungTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4763,7 +4791,7 @@ cAudioManager::GetBlackProjectFemaleYoungTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetChinatownMaleOldTalkSfx(int16 sound)
+cAudioManager::GetChinatownMaleOldTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4797,7 +4825,7 @@ cAudioManager::GetChinatownMaleOldTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetChinatownMaleYoungTalkSfx(int16 sound)
+cAudioManager::GetChinatownMaleYoungTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4831,7 +4859,7 @@ cAudioManager::GetChinatownMaleYoungTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetChinatownFemaleOldTalkSfx(int16 sound)
+cAudioManager::GetChinatownFemaleOldTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4862,7 +4890,7 @@ cAudioManager::GetChinatownFemaleOldTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetChinatownFemaleYoungTalkSfx(int16 sound)
+cAudioManager::GetChinatownFemaleYoungTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4893,7 +4921,7 @@ cAudioManager::GetChinatownFemaleYoungTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetLittleItalyMaleTalkSfx(int16 sound)
+cAudioManager::GetLittleItalyMaleTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4927,7 +4955,7 @@ cAudioManager::GetLittleItalyMaleTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetLittleItalyFemaleOldTalkSfx(int16 sound)
+cAudioManager::GetLittleItalyFemaleOldTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4958,7 +4986,7 @@ cAudioManager::GetLittleItalyFemaleOldTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetLittleItalyFemaleYoungTalkSfx(int16 sound)
+cAudioManager::GetLittleItalyFemaleYoungTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -4989,7 +5017,7 @@ cAudioManager::GetLittleItalyFemaleYoungTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetWhiteDockerMaleTalkSfx(int16 sound)
+cAudioManager::GetWhiteDockerMaleTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5020,7 +5048,7 @@ cAudioManager::GetWhiteDockerMaleTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetBlackDockerMaleTalkSfx(int16 sound)
+cAudioManager::GetBlackDockerMaleTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5051,7 +5079,7 @@ cAudioManager::GetBlackDockerMaleTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetScumMaleTalkSfx(int16 sound)
+cAudioManager::GetScumMaleTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5088,7 +5116,7 @@ cAudioManager::GetScumMaleTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetScumFemaleTalkSfx(int16 sound)
+cAudioManager::GetScumFemaleTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5119,7 +5147,7 @@ cAudioManager::GetScumFemaleTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetWhiteWorkerMaleTalkSfx(int16 sound)
+cAudioManager::GetWhiteWorkerMaleTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5150,7 +5178,7 @@ cAudioManager::GetWhiteWorkerMaleTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetBlackWorkerMaleTalkSfx(int16 sound)
+cAudioManager::GetBlackWorkerMaleTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5181,124 +5209,7 @@ cAudioManager::GetBlackWorkerMaleTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetBusinessMaleYoungTalkSfx(int16 sound, int32 model)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_GUN_PANIC_1, 3);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_MUGGED_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_FIGHT_1, 4);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_DODGE_1, 4);
- break;
- case SOUND_PED_FLEE_RUN:
- GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_RUN_FROM_FIGHT_1, 5);
- break;
- case SOUND_PED_ANNOYED_DRIVER:
- GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_DRIVER_ABUSE_1, 6);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_CHAT_1, 6);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
-
- if (model == MI_B_MAN3)
- sfx += (SFX_BUSINESS_MALE_YOUNG_VOICE_2_DRIVER_ABUSE_1 - SFX_BUSINESS_MALE_YOUNG_VOICE_1_DRIVER_ABUSE_1);
- return sfx;
-}
-
-uint32
-cAudioManager::GetBusinessMaleOldTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_GUN_PANIC_1, 3);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_MUGGED_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_FIGHT_1, 5);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_DODGE_1, 4);
- break;
- case SOUND_PED_FLEE_RUN:
- GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_MRUN_FROM_FIGHT_1, 5);
- break;
- case SOUND_PED_ANNOYED_DRIVER:
- GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_DRIVER_ABUSE_1, 5);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(sfx, lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_CHAT_1, 5);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetWhiteBusinessFemaleTalkSfx(int16 sound, int32 model)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(sfx, lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_GUN_PANIC_1, 4);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(sfx, lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(sfx, lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_MUGGED_1, 2);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(sfx, lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_DODGE_1, 6);
- break;
- case SOUND_PED_FLEE_RUN:
- GetPhrase(sfx, lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_RUN_FROM_FIGHT_1, 4);
- break;
- case SOUND_PED_ANNOYED_DRIVER:
- GetPhrase(sfx, lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_DRIVER_ABUSE_1, 5);
- break;
- case SOUND_PED_CHAT_EVENT:
- GetPhrase(sfx, lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_SHOCKED_1, 4);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(sfx, lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_CHAT_1, 7);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
- }
-
- if (model == MI_B_WOM2)
- sfx += (SFX_WHITE_BUSINESS_FEMALE_VOICE_2_DRIVER_ABUSE_1 - SFX_WHITE_BUSINESS_FEMALE_VOICE_1_DRIVER_ABUSE_1);
- return sfx;
-}
-
-uint32
-cAudioManager::GetBlackBusinessFemaleTalkSfx(int16 sound)
+cAudioManager::GetBlackBusinessFemaleTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5335,7 +5246,7 @@ cAudioManager::GetBlackBusinessFemaleTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetSupermodelMaleTalkSfx(int16 sound)
+cAudioManager::GetSupermodelMaleTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5369,7 +5280,7 @@ cAudioManager::GetSupermodelMaleTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetSupermodelFemaleTalkSfx(int16 sound)
+cAudioManager::GetSupermodelFemaleTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5400,7 +5311,7 @@ cAudioManager::GetSupermodelFemaleTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetStewardMaleTalkSfx(int16 sound)
+cAudioManager::GetStewardMaleTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5428,7 +5339,7 @@ cAudioManager::GetStewardMaleTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetStewardFemaleTalkSfx(int16 sound)
+cAudioManager::GetStewardFemaleTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5453,7 +5364,7 @@ cAudioManager::GetStewardFemaleTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetFanMaleTalkSfx(int16 sound, int32 model)
+cAudioManager::GetFanMaleTalkSfx(uint16 sound, uint32 model)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5484,7 +5395,7 @@ cAudioManager::GetFanMaleTalkSfx(int16 sound, int32 model)
}
uint32
-cAudioManager::GetFanFemaleTalkSfx(int16 sound)
+cAudioManager::GetFanFemaleTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5512,7 +5423,7 @@ cAudioManager::GetFanFemaleTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetHospitalMaleTalkSfx(int16 sound)
+cAudioManager::GetHospitalMaleTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5540,7 +5451,7 @@ cAudioManager::GetHospitalMaleTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetHospitalFemaleTalkSfx(int16 sound)
+cAudioManager::GetHospitalFemaleTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5562,7 +5473,7 @@ cAudioManager::GetHospitalFemaleTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetWhiteConstructionWorkerTalkSfx(int16 sound)
+cAudioManager::GetWhiteConstructionWorkerTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5596,7 +5507,7 @@ cAudioManager::GetWhiteConstructionWorkerTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetBlackConstructionWorkerTalkSfx(int16 sound)
+cAudioManager::GetBlackConstructionWorkerTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5630,7 +5541,7 @@ cAudioManager::GetBlackConstructionWorkerTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetShopperFemaleTalkSfx(int16 sound, int32 model)
+cAudioManager::GetShopperFemaleTalkSfx(uint16 sound, uint32 model)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5667,7 +5578,7 @@ cAudioManager::GetShopperFemaleTalkSfx(int16 sound, int32 model)
}
uint32
-cAudioManager::GetStudentMaleTalkSfx(int16 sound)
+cAudioManager::GetStudentMaleTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5701,7 +5612,7 @@ cAudioManager::GetStudentMaleTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetStudentFemaleTalkSfx(int16 sound)
+cAudioManager::GetStudentFemaleTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5735,29 +5646,23 @@ cAudioManager::GetStudentFemaleTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetCasualMaleOldTalkSfx(int16 sound)
-{
- return GetGenericMaleTalkSfx(sound);
-}
-
-uint32
-cAudioManager::GetSpecialCharacterTalkSfx(int32 modelIndex, int32 sound)
+cAudioManager::GetSpecialCharacterTalkSfx(uint32 modelIndex, uint16 sound)
{
char *modelName = CModelInfo::GetModelInfo(modelIndex)->GetModelName();
if (!CGeneral::faststricmp(modelName, "eight") || !CGeneral::faststricmp(modelName, "eight2")) {
- return GetEightTalkSfx(sound);
+ return GetEightBallTalkSfx(sound);
}
if (!CGeneral::faststricmp(modelName, "frankie")) {
- return GetFrankieTalkSfx(sound);
+ return GetSalvatoreTalkSfx(sound);
}
if (!CGeneral::faststricmp(modelName, "misty")) {
return GetMistyTalkSfx(sound);
}
if (!CGeneral::faststricmp(modelName, "ojg") || !CGeneral::faststricmp(modelName, "ojg_p")) {
- return GetOJGTalkSfx(sound);
+ return GetOldJapTalkSfx(sound);
}
if (!CGeneral::faststricmp(modelName, "cat")) {
- return GetCatatalinaTalkSfx(sound);
+ return GetCatalinaTalkSfx(sound);
}
if (!CGeneral::faststricmp(modelName, "bomber")) {
return GetBomberTalkSfx(sound);
@@ -5777,8 +5682,9 @@ cAudioManager::GetSpecialCharacterTalkSfx(int32 modelIndex, int32 sound)
return GetGenericMaleTalkSfx(sound);
}
+
uint32
-cAudioManager::GetEightTalkSfx(int16 sound)
+cAudioManager::GetEightBallTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5803,7 +5709,7 @@ cAudioManager::GetEightTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetFrankieTalkSfx(int16 sound)
+cAudioManager::GetSalvatoreTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5828,7 +5734,7 @@ cAudioManager::GetFrankieTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetMistyTalkSfx(int16 sound)
+cAudioManager::GetMistyTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5857,19 +5763,19 @@ cAudioManager::GetMistyTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetOJGTalkSfx(int16 sound)
+cAudioManager::GetOldJapTalkSfx(uint16 sound)
{
return GetGenericMaleTalkSfx(sound);
}
uint32
-cAudioManager::GetCatatalinaTalkSfx(int16 sound)
+cAudioManager::GetCatalinaTalkSfx(uint16 sound)
{
return GetGenericFemaleTalkSfx(sound);
}
uint32
-cAudioManager::GetBomberTalkSfx(int16 sound)
+cAudioManager::GetBomberTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5886,7 +5792,7 @@ cAudioManager::GetBomberTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetSecurityGuardTalkSfx(int16 sound)
+cAudioManager::GetSecurityGuardTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5919,7 +5825,7 @@ cAudioManager::GetSecurityGuardTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetChunkyTalkSfx(int16 sound)
+cAudioManager::GetChunkyTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5939,7 +5845,98 @@ cAudioManager::GetChunkyTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetGenericMaleTalkSfx(int16 sound)
+cAudioManager::GetAsianTaxiDriverTalkSfx(uint16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(sfx, lastSfx, SFX_ASIAN_TAXI_DRIVER_VOICE_1_CARJACKED_1, 7);
+ break;
+ case SOUND_PED_ANNOYED_DRIVER:
+ GetPhrase(sfx, lastSfx, SFX_ASIAN_TAXI_DRIVER_VOICE_1_DRIVER_ABUSE_1, 6);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+
+ return (SFX_ASIAN_TAXI_DRIVER_VOICE_2_DRIVER_ABUSE_1 - SFX_ASIAN_TAXI_DRIVER_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
+}
+
+uint32
+cAudioManager::GetPimpTalkSfx(uint16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_UP:
+ GetPhrase(sfx, lastSfx, SFX_PIMP_GUN_COOL_1, 7);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(sfx, lastSfx, SFX_PIMP_CARJACKED_1, 4);
+ break;
+ case SOUND_PED_DEFEND:
+ GetPhrase(sfx, lastSfx, SFX_PIMP_FIGHT_1, 9);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(sfx, lastSfx, SFX_PIMP_DODGE_1, 6);
+ break;
+ case SOUND_PED_ANNOYED_DRIVER:
+ GetPhrase(sfx, lastSfx, SFX_PIMP_DRIVER_ABUSE_1, 5);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ GetPhrase(sfx, lastSfx, SFX_PIMP_SHOCKED_1, 2);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(sfx, lastSfx, SFX_PIMP_CHAT_1, 17);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetNormalMaleTalkSfx(uint16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(sfx, lastSfx, SFX_NORMAL_MALE_GUN_PANIC_1, 7);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(sfx, lastSfx, SFX_NORMAL_MALE_CARJACKED_1, 7);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(sfx, lastSfx, SFX_NORMAL_MALE_DODGE_1, 9);
+ break;
+ case SOUND_PED_FLEE_RUN:
+ GetPhrase(sfx, lastSfx, SFX_NORMAL_MALE_RUN_FROM_FIGHT_1, 5);
+ break;
+ case SOUND_PED_ANNOYED_DRIVER:
+ GetPhrase(sfx, lastSfx, SFX_NORMAL_MALE_DRIVER_ABUSE_1, 12);
+ break;
+ case SOUND_PED_CHAT_SEXY:
+ GetPhrase(sfx, lastSfx, SFX_NORMAL_MALE_EYING_1, 8);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ GetPhrase(sfx, lastSfx, SFX_NORMAL_MALE_SHOCKED_1, 10);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(sfx, lastSfx, SFX_NORMAL_MALE_CHAT_1, 25);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetGenericMaleTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -5965,7 +5962,7 @@ cAudioManager::GetGenericMaleTalkSfx(int16 sound)
}
uint32
-cAudioManager::GetGenericFemaleTalkSfx(int16 sound)
+cAudioManager::GetGenericFemaleTalkSfx(uint16 sound)
{
uint32 sfx;
static uint32 lastSfx = NO_SAMPLE;
@@ -8353,7 +8350,7 @@ FindMissionAudioSfx(const char *name)
}
bool8
-cAudioManager::MissionScriptAudioUsesPoliceChannel(int32 soundMission) const
+cAudioManager::MissionScriptAudioUsesPoliceChannel(uint32 soundMission)
{
switch (soundMission) {
case STREAMED_SOUND_MISSION_J6_D:
@@ -8394,7 +8391,7 @@ cAudioManager::PreloadMissionAudio(Const char *name)
}
uint8
-cAudioManager::GetMissionAudioLoadingStatus() const
+cAudioManager::GetMissionAudioLoadingStatus()
{
if (m_bIsInitialised)
return m_sMissionAudio.m_nLoadingStatus;
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index a113cc93..22415e76 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -109,7 +109,9 @@ cAudioManager::Service()
if (m_bIsInitialised) {
m_nPreviousUserPause = m_nUserPause;
m_nUserPause = CTimer::GetIsUserPaused();
+#ifdef GTA_PC
UpdateReflections();
+#endif
ServiceSoundEffects();
MusicManager.Service();
}
@@ -158,6 +160,14 @@ cAudioManager::DestroyEntity(int32 id)
}
}
+bool8
+cAudioManager::GetEntityStatus(int32 id)
+{
+ if (m_bIsInitialised && id >= 0 && id < NUM_AUDIOENTITIES && m_asAudioEntities[id].m_bIsUsed)
+ return m_asAudioEntities[id].m_bStatus;
+ return FALSE;
+}
+
void
cAudioManager::SetEntityStatus(int32 id, bool8 status)
{
@@ -165,6 +175,14 @@ cAudioManager::SetEntityStatus(int32 id, bool8 status)
m_asAudioEntities[id].m_bStatus = status;
}
+void *
+cAudioManager::GetEntityPointer(int32 id)
+{
+ if (m_bIsInitialised && id >= 0 && id < NUM_AUDIOENTITIES && m_asAudioEntities[id].m_bIsUsed)
+ return m_asAudioEntities[id].m_pEntity;
+ return NULL;
+}
+
void
cAudioManager::PlayOneShot(int32 index, uint16 sound, float vol)
{
@@ -216,33 +234,33 @@ cAudioManager::PlayOneShot(int32 index, uint16 sound, float vol)
}
void
-cAudioManager::SetEffectsMasterVolume(uint8 volume) const
+cAudioManager::SetEffectsMasterVolume(uint8 volume)
{
SampleManager.SetEffectsMasterVolume(volume);
}
void
-cAudioManager::SetMusicMasterVolume(uint8 volume) const
+cAudioManager::SetMusicMasterVolume(uint8 volume)
{
SampleManager.SetMusicMasterVolume(volume);
}
void
-cAudioManager::SetEffectsFadeVol(uint8 volume) const
+cAudioManager::SetEffectsFadeVol(uint8 volume)
{
SampleManager.SetEffectsFadeVolume(volume);
}
void
-cAudioManager::SetMonoMode(bool8 mono)
+cAudioManager::SetMusicFadeVol(uint8 volume)
{
- SampleManager.SetMonoMode(mono);
+ SampleManager.SetMusicFadeVolume(volume);
}
void
-cAudioManager::SetMusicFadeVol(uint8 volume) const
+cAudioManager::SetMonoMode(bool8 mono)
{
- SampleManager.SetMusicFadeVolume(volume);
+ SampleManager.SetMonoMode(mono);
}
void
@@ -307,8 +325,10 @@ cAudioManager::DestroyAllGameCreatedEntities()
}
}
+#ifdef GTA_PC
+
uint8
-cAudioManager::GetNum3DProvidersAvailable() const
+cAudioManager::GetNum3DProvidersAvailable()
{
if (m_bIsInitialised)
return SampleManager.GetNum3DProvidersAvailable();
@@ -316,7 +336,7 @@ cAudioManager::GetNum3DProvidersAvailable() const
}
char *
-cAudioManager::Get3DProviderName(uint8 id) const
+cAudioManager::Get3DProviderName(uint8 id)
{
if (!m_bIsInitialised)
return nil;
@@ -331,7 +351,7 @@ cAudioManager::Get3DProviderName(uint8 id) const
}
int8
-cAudioManager::GetCurrent3DProviderIndex() const
+cAudioManager::GetCurrent3DProviderIndex()
{
if (m_bIsInitialised)
return SampleManager.GetCurrent3DProviderIndex();
@@ -363,13 +383,13 @@ cAudioManager::SetCurrent3DProvider(uint8 which)
}
void
-cAudioManager::SetSpeakerConfig(int32 conf) const
+cAudioManager::SetSpeakerConfig(int32 conf)
{
SampleManager.SetSpeakerConfig(conf);
}
bool8
-cAudioManager::IsMP3RadioChannelAvailable() const
+cAudioManager::IsMP3RadioChannelAvailable()
{
if (m_bIsInitialised)
return SampleManager.IsMP3RadioChannelAvailable();
@@ -378,7 +398,7 @@ cAudioManager::IsMP3RadioChannelAvailable() const
}
void
-cAudioManager::ReleaseDigitalHandle() const
+cAudioManager::ReleaseDigitalHandle()
{
if (m_bIsInitialised) {
SampleManager.ReleaseDigitalHandle();
@@ -386,7 +406,7 @@ cAudioManager::ReleaseDigitalHandle() const
}
void
-cAudioManager::ReacquireDigitalHandle() const
+cAudioManager::ReacquireDigitalHandle()
{
if (m_bIsInitialised) {
SampleManager.ReacquireDigitalHandle();
@@ -400,13 +420,13 @@ cAudioManager::SetDynamicAcousticModelingStatus(bool8 status)
}
bool8
-cAudioManager::CheckForAnAudioFileOnCD() const
+cAudioManager::CheckForAnAudioFileOnCD()
{
return SampleManager.CheckForAnAudioFileOnCD();
}
char
-cAudioManager::GetCDAudioDriveLetter() const
+cAudioManager::GetCDAudioDriveLetter()
{
if (m_bIsInitialised)
return SampleManager.GetCDAudioDriveLetter();
@@ -415,11 +435,13 @@ cAudioManager::GetCDAudioDriveLetter() const
}
bool8
-cAudioManager::IsAudioInitialised() const
+cAudioManager::IsAudioInitialised()
{
return m_bIsInitialised;
}
+#endif // GTA_PC
+
void
cAudioManager::ServiceSoundEffects()
{
@@ -469,8 +491,14 @@ cAudioManager::ServiceSoundEffects()
m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0;
}
+uint32
+cAudioManager::FL(float f)
+{
+ return SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex) * f;
+}
+
uint8
-cAudioManager::ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const
+cAudioManager::ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance)
{
float newSoundIntensity;
if (soundIntensity <= 0.0f)
@@ -482,7 +510,7 @@ cAudioManager::ComputeVolume(uint8 emittingVolume, float soundIntensity, float d
}
void
-cAudioManager::TranslateEntity(Const CVector *in, CVector *out) const
+cAudioManager::TranslateEntity(Const CVector *in, CVector *out)
{
*out = MultiplyInverse(TheCamera.GetMatrix(), *in);
}
@@ -500,8 +528,8 @@ cAudioManager::ComputePan(float dist, CVector *vec)
return Min(107, PanTable[index] + 63);
}
-int32
-cAudioManager::ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2, float speedMultiplier) const
+uint32
+cAudioManager::ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2, float speedMultiplier)
{
uint32 newFreq = oldFreq;
if (!TheCamera.Get_Just_Switched_Status() && speedMultiplier != 0.0f) {
@@ -522,7 +550,7 @@ cAudioManager::ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1,
}
int32
-cAudioManager::RandomDisplacement(uint32 seed) const
+cAudioManager::RandomDisplacement(uint32 seed)
{
int32 value;
@@ -593,6 +621,7 @@ cAudioManager::AddSampleToRequestedQueue()
AddReflectionsToRequestedQueue();
}
}
+
void
cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
{
@@ -610,6 +639,7 @@ cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = sample;
}
+#ifdef GTA_PC
void
cAudioManager::AddReflectionsToRequestedQueue()
{
@@ -687,6 +717,7 @@ cAudioManager::UpdateReflections()
m_afReflectionsDistances[4] = 50.0f;
}
}
+#endif // GTA_PC
void
cAudioManager::AddReleasingSounds()
@@ -965,6 +996,13 @@ cAudioManager::ClearActiveSamples()
}
void
+cAudioManager::LoadBankIfNecessary(uint8 bank)
+{
+ if(!SampleManager.IsSampleBankLoaded(bank))
+ SampleManager.LoadSampleBank(bank);
+}
+
+void
cAudioManager::GenerateIntegerRandomNumberTable()
{
for (int32 i = 0; i < ARRAY_SIZE(m_anRandomTable); i++) {
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index 70302745..187a71a8 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -20,8 +20,8 @@ public:
#ifndef GTA_PS2
int32 m_nLoopStart;
int32 m_nLoopEnd;
-#endif
uint8 m_nEmittingVolume;
+#endif
float m_fSpeedMultiplier;
float m_fSoundIntensity;
bool8 m_bReleasingSoundFlag;
@@ -48,7 +48,7 @@ public:
eAudioType m_nType;
void *m_pEntity;
bool8 m_bIsUsed;
- uint8 m_bStatus;
+ bool8 m_bStatus;
int16 m_awAudioEvent[NUM_AUDIOENTITY_EVENTS];
float m_afVolume[NUM_AUDIOENTITY_EVENTS];
uint8 m_AudioEvents;
@@ -183,6 +183,9 @@ enum {
MAX_REFLECTIONS,
};
+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 };
+
class cAudioManager
{
public:
@@ -204,8 +207,10 @@ public:
tAudioEntity m_asAudioEntities[NUM_AUDIOENTITIES];
int32 m_anAudioEntityIndices[NUM_AUDIOENTITIES];
int32 m_nAudioEntitiesTotal;
+#ifdef GTA_PC
CVector m_avecReflectionsPos[NUM_AUDIO_REFLECTIONS];
float m_afReflectionsDistances[NUM_AUDIO_REFLECTIONS];
+#endif
cAudioScriptObjectManager m_sAudioScriptObjectManager;
cPedComments m_sPedComments;
int32 m_nFireAudioEntity;
@@ -227,277 +232,281 @@ public:
cAudioManager();
~cAudioManager();
- // getters
- uint32 GetFrameCounter() const { return m_FrameCounter; }
- float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; }
- int32 GetRandomNumber(int32 idx) const { return m_anRandomTable[idx]; }
- int32 GetRandomNumberInRange(int32 idx, int32 low, int32 high) const { return (m_anRandomTable[idx] % (high - low + 1)) + low; }
- bool8 ShouldDuckMissionAudio() const { return m_sMissionAudio.m_nPlayStatus == 1; }
-
- // "Should" be in alphabetic order, except "getXTalkSfx"
- void AddDetailsToRequestedOrderList(uint8 sample);
- void AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 bank,
- uint8 counter, bool8 notLooping);
- void AddReflectionsToRequestedQueue();
- void AddReleasingSounds();
- void AddSampleToRequestedQueue();
- void AgeCrimes();
-
- void CalculateDistance(bool8 &condition, float dist);
- bool8 CheckForAnAudioFileOnCD() const;
- void ClearActiveSamples();
- void ClearMissionAudio();
- void ClearRequestedQueue();
- int32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2,
- float speedMultiplier) const;
- int32 ComputePan(float, CVector *);
- uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const;
+ void Initialise();
+ void Terminate();
+ void Service();
int32 CreateEntity(eAudioType type, void *entity);
-
- void DestroyAllGameCreatedEntities();
void DestroyEntity(int32 id);
- void DoPoliceRadioCrackle();
+ bool8 GetEntityStatus(int32 id);
+ void SetEntityStatus(int32 id, bool8 status);
+ void *GetEntityPointer(int32 id);
+ void PlayOneShot(int32 index, uint16 sound, float vol);
+ void SetEffectsMasterVolume(uint8 volume);
+ void SetMusicMasterVolume(uint8 volume);
+ void SetEffectsFadeVol(uint8 volume);
+ void SetMusicFadeVol(uint8 volume);
+ void SetMonoMode(bool8 mono);
+ void ResetTimers(uint32 time);
+ void DestroyAllGameCreatedEntities();
- // functions returning talk sfx,
- // order from GetPedCommentSfx
- uint32 GetPlayerTalkSfx(int16 sound);
- uint32 GetCopTalkSfx(int16 sound);
- uint32 GetSwatTalkSfx(int16 sound);
- uint32 GetFBITalkSfx(int16 sound);
- uint32 GetArmyTalkSfx(int16 sound);
- uint32 GetMedicTalkSfx(int16 sound);
- uint32 GetFiremanTalkSfx(int16 sound);
- uint32 GetNormalMaleTalkSfx(int16 sound);
- uint32 GetTaxiDriverTalkSfx(int16 sound);
- uint32 GetPimpTalkSfx(int16 sound);
- uint32 GetMafiaTalkSfx(int16 sound);
- uint32 GetTriadTalkSfx(int16 sound);
- uint32 GetDiabloTalkSfx(int16 sound);
- uint32 GetYakuzaTalkSfx(int16 sound);
- uint32 GetYardieTalkSfx(int16 sound);
- uint32 GetColumbianTalkSfx(int16 sound);
- uint32 GetHoodTalkSfx(int16 sound);
- uint32 GetBlackCriminalTalkSfx(int16 sound);
- uint32 GetWhiteCriminalTalkSfx(int16 sound);
- uint32 GetMaleNo2TalkSfx(int16 sound);
- uint32 GetBlackProjectMaleTalkSfx(int16 sound, int32 model);
- uint32 GetWhiteFatMaleTalkSfx(int16 sound);
- uint32 GetBlackFatMaleTalkSfx(int16 sound);
- uint32 GetBlackCasualFemaleTalkSfx(int16 sound);
- uint32 GetWhiteCasualFemaleTalkSfx(int16 sound);
- uint32 GetFemaleNo3TalkSfx(int16 sound);
- uint32 GetBlackFatFemaleTalkSfx(int16 sound);
- uint32 GetWhiteFatFemaleTalkSfx(int16 sound);
- uint32 GetBlackFemaleProstituteTalkSfx(int16 sound);
- uint32 GetWhiteFemaleProstituteTalkSfx(int16 sound);
- uint32 GetBlackProjectFemaleOldTalkSfx(int16 sound);
- uint32 GetBlackProjectFemaleYoungTalkSfx(int16 sound);
- uint32 GetChinatownMaleOldTalkSfx(int16 sound);
- uint32 GetChinatownMaleYoungTalkSfx(int16 sound);
- uint32 GetChinatownFemaleOldTalkSfx(int16 sound);
- uint32 GetChinatownFemaleYoungTalkSfx(int16 sound);
- uint32 GetLittleItalyMaleTalkSfx(int16 sound);
- uint32 GetLittleItalyFemaleOldTalkSfx(int16 sound);
- uint32 GetLittleItalyFemaleYoungTalkSfx(int16 sound);
- uint32 GetWhiteDockerMaleTalkSfx(int16 sound);
- uint32 GetBlackDockerMaleTalkSfx(int16 sound);
- uint32 GetScumMaleTalkSfx(int16 sound);
- uint32 GetScumFemaleTalkSfx(int16 sound);
- uint32 GetWhiteWorkerMaleTalkSfx(int16 sound);
- uint32 GetBlackWorkerMaleTalkSfx(int16 sound);
- uint32 GetBusinessMaleYoungTalkSfx(int16 sound, int32 model);
- uint32 GetBusinessMaleOldTalkSfx(int16 sound);
- uint32 GetWhiteBusinessFemaleTalkSfx(int16 sound, int32 model);
- uint32 GetBlackBusinessFemaleTalkSfx(int16 sound);
- uint32 GetSupermodelMaleTalkSfx(int16 sound);
- uint32 GetSupermodelFemaleTalkSfx(int16 sound);
- uint32 GetStewardMaleTalkSfx(int16 sound);
- uint32 GetStewardFemaleTalkSfx(int16 sound);
- uint32 GetFanMaleTalkSfx(int16 sound, int32 model);
- uint32 GetFanFemaleTalkSfx(int16 sound);
- uint32 GetHospitalMaleTalkSfx(int16 sound);
- uint32 GetHospitalFemaleTalkSfx(int16 sound);
- uint32 GetWhiteConstructionWorkerTalkSfx(int16 sound);
- uint32 GetBlackConstructionWorkerTalkSfx(int16 sound);
- uint32 GetShopperFemaleTalkSfx(int16 sound, int32 model);
- uint32 GetStudentMaleTalkSfx(int16 sound);
- uint32 GetStudentFemaleTalkSfx(int16 sound);
- uint32 GetCasualMaleOldTalkSfx(int16 sound);
-
- uint32 GetSpecialCharacterTalkSfx(int32 modelIndex, int32 sound);
- uint32 GetEightTalkSfx(int16 sound);
- uint32 GetFrankieTalkSfx(int16 sound);
- uint32 GetMistyTalkSfx(int16 sound);
- uint32 GetOJGTalkSfx(int16 sound);
- uint32 GetCatatalinaTalkSfx(int16 sound);
- uint32 GetBomberTalkSfx(int16 sound);
- uint32 GetSecurityGuardTalkSfx(int16 sound);
- uint32 GetChunkyTalkSfx(int16 sound);
-
- uint32 GetGenericMaleTalkSfx(int16 sound);
- uint32 GetGenericFemaleTalkSfx(int16 sound);
- // end of functions returning talk sfx
-
- void GenerateIntegerRandomNumberTable();
- char *Get3DProviderName(uint8 id) const;
- char GetCDAudioDriveLetter() const;
- int8 GetCurrent3DProviderIndex() const;
- float GetCollisionLoopingRatio(uint32 a, uint32 b, float c) const; // not used
- float GetCollisionOneShotRatio(int32 a, float b) const;
- float GetCollisionRatio(float a, float b, float c, float d) const;
- float GetDistanceSquared(const CVector &v) const;
- int32 GetJumboTaxiFreq() const;
- uint8 GetMissionAudioLoadingStatus() const;
- int8 GetMissionScriptPoliceAudioPlayingStatus() const;
- uint8 GetNum3DProvidersAvailable() const;
- int32 GetPedCommentSfx(CPed *ped, int32 sound);
- void GetPhrase(uint32 &phrase, uint32 &prevPhrase, uint32 sample, uint32 maxOffset) const;
- float GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile,
- cTransmission *transmission, float velocityChange);
- float GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile,
- cTransmission *transmission, float velocityChange);
-
- bool8 HasAirBrakes(int32 model) const;
+#ifdef GTA_PC
+ uint8 GetNum3DProvidersAvailable();
+ char *Get3DProviderName(uint8 id);
+ int8 GetCurrent3DProviderIndex();
+ int8 SetCurrent3DProvider(uint8 which);
+ void SetSpeakerConfig(int32 conf);
+ bool8 IsMP3RadioChannelAvailable();
+ void ReleaseDigitalHandle();
+ void ReacquireDigitalHandle();
+ void SetDynamicAcousticModelingStatus(bool8 status);
+ bool8 CheckForAnAudioFileOnCD();
+ char GetCDAudioDriveLetter();
+ bool8 IsAudioInitialised();
+#endif
- void Initialise();
- void InitialisePoliceRadio();
- void InitialisePoliceRadioZones();
- void InterrogateAudioEntities();
- bool8 IsAudioInitialised() const;
- bool8 IsMissionAudioSampleFinished();
- bool8 IsMP3RadioChannelAvailable() const;
+ void ServiceSoundEffects();
+ uint32 FL(float f); // not used
+ uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance);
+ void TranslateEntity(Const CVector *v1, CVector *v2);
+ int32 ComputePan(float, CVector *);
+ uint32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2, float speedMultiplier); // inlined on PS2
+ int32 RandomDisplacement(uint32 seed);
+ void InterrogateAudioEntities(); // inlined on PS2
+ void AddSampleToRequestedQueue();
+ void AddDetailsToRequestedOrderList(uint8 sample); // inlined on PS2
+#ifdef GTA_PC
+ void AddReflectionsToRequestedQueue();
+ void UpdateReflections();
+#endif
+ void AddReleasingSounds();
+ void ProcessActiveQueues();
+ void ClearRequestedQueue(); // inlined on PS2
+ void ClearActiveSamples();
+ void GenerateIntegerRandomNumberTable(); // inlined on PS2
+ void LoadBankIfNecessary(uint8 bank); // this is used only on PS2 but technically not a platform code
- bool8 MissionScriptAudioUsesPoliceChannel(int32 soundMission) const;
+#ifdef GTA_PC
+ void AdjustSamplesVolume();
+ uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist);
+#endif
- void PlayLoadedMissionAudio();
- void PlayOneShot(int32 index, uint16 sound, float vol);
- void PlaySuspectLastSeen(float x, float y, float z);
- void PlayerJustGotInCar() const;
- void PlayerJustLeftCar() const;
+ // audio logic
+ void PreInitialiseGameSpecificSetup();
void PostInitialiseGameSpecificSetup();
- void PostTerminateGameSpecificShutdown();
- void PreInitialiseGameSpecificSetup() const;
- void PreloadMissionAudio(Const char *name);
void PreTerminateGameSpecificShutdown();
- /// processX - main logic of adding new sounds
- void ProcessActiveQueues();
- bool8 ProcessAirBrakes(cVehicleParams& params);
- void ProcessAirportScriptObject(uint8 sound);
- bool8 ProcessBoatEngine(cVehicleParams& params);
- bool8 ProcessBoatMovingOverWater(cVehicleParams& params);
- void ProcessBridge();
- void ProcessBridgeMotor();
- void ProcessBridgeOneShots();
- void ProcessBridgeWarning();
- bool8 ProcessCarBombTick(cVehicleParams& params);
- void ProcessCesna(cVehicleParams& params);
- void ProcessCinemaScriptObject(uint8 sound);
- void ProcessCrane();
- void ProcessDocksScriptObject(uint8 sound);
- bool8 ProcessEngineDamage(cVehicleParams& params);
+ void PostTerminateGameSpecificShutdown();
+ void ResetAudioLogicTimers(uint32 timer);
+ void ProcessReverb();
+ float GetDistanceSquared(const CVector &v);
+ void CalculateDistance(bool8 &condition, float dist);
+ void ProcessSpecial();
void ProcessEntity(int32 sound);
- void ProcessExplosions(int32 explosion);
- void ProcessFireHydrant();
- void ProcessFires(int32 entity);
- void ProcessFrontEnd();
- void ProcessGarages();
- bool8 ProcessHelicopter(cVehicleParams& params);
- void ProcessHomeScriptObject(uint8 sound);
- void ProcessJumbo(cVehicleParams& params);
+ void ProcessPhysical(int32 id);
+
+ // vehicles
+ void ProcessVehicle(CVehicle *vehicle);
+ void ProcessRainOnVehicle(cVehicleParams &params);
+ bool8 ProcessReverseGear(cVehicleParams &params);
+ void ProcessModelCarEngine(cVehicleParams &params);
+ bool8 ProcessVehicleRoadNoise(cVehicleParams &params);
+ bool8 ProcessWetRoadNoise(cVehicleParams &params);
+ void ProcessVehicleEngine(cVehicleParams &params);
+ void UpdateGasPedalAudio(CAutomobile *automobile); // inlined on PS2
+ void PlayerJustGotInCar();
+ void PlayerJustLeftCar();
+ void AddPlayerCarSample(uint8 emittingVolume, uint32 freq, uint32 sample, uint8 bank, uint8 counter, bool8 notLooping);
+ void ProcessCesna(cVehicleParams &params);
+ void ProcessPlayersVehicleEngine(cVehicleParams &params, CAutomobile *automobile);
+ bool8 ProcessVehicleSkidding(cVehicleParams &params);
+ float GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cTransmission *transmission, float velocityChange);
+ float GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cTransmission *transmission, float velocityChange); // inlined on PS2
+ void ProcessVehicleHorn(cVehicleParams &params);
+ bool8 UsesSiren(uint32 model); // inlined on PS2
+ bool8 UsesSirenSwitching(uint32 model); // inlined on PS2
+ bool8 ProcessVehicleSirenOrAlarm(cVehicleParams &params);
+ bool8 UsesReverseWarning(uint32 model); // inlined on PS2
+ bool8 ProcessVehicleReverseWarning(cVehicleParams &params);
+ bool8 ProcessVehicleDoors(cVehicleParams &params);
+ bool8 ProcessAirBrakes(cVehicleParams &params);
+ bool8 HasAirBrakes(uint32 model); // inlined on PS2
+ bool8 ProcessEngineDamage(cVehicleParams &params);
+ bool8 ProcessCarBombTick(cVehicleParams &params);
+ void ProcessVehicleOneShots(cVehicleParams &params);
+ bool8 ProcessTrainNoise(cVehicleParams &params);
+ bool8 ProcessBoatEngine(cVehicleParams &params);
+ bool8 ProcessBoatMovingOverWater(cVehicleParams &params);
+ bool8 ProcessHelicopter(cVehicleParams &params);
+ void ProcessPlane(cVehicleParams &params); // inlined on PS2
+ void ProcessJumbo(cVehicleParams &params);
+ void ProcessJumboTaxi(); // inlined on PS2
void ProcessJumboAccel(CPlane *plane);
- void ProcessJumboDecel(CPlane *plane);
- void ProcessJumboFlying();
- void ProcessJumboLanding(CPlane *plane);
- void ProcessJumboTakeOff(CPlane *plane);
- void ProcessJumboTaxi();
- void ProcessLaunderetteScriptObject(uint8 sound);
- void ProcessLoopingScriptObject(uint8 sound);
- void ProcessMissionAudio();
- void ProcessModelCarEngine(cVehicleParams& params);
- void ProcessOneShotScriptObject(uint8 sound);
- void ProcessPed(CPhysical *ped);
+ void ProcessJumboTakeOff(CPlane *plane); // inlined on PS2
+ void ProcessJumboFlying(); // inlined on PS2
+ void ProcessJumboLanding(CPlane *plane); // inlined on PS2
+ void ProcessJumboDecel(CPlane *plane); // inlined on PS2
+ bool8 SetupJumboTaxiSound(uint8 vol);
+ bool8 SetupJumboWhineSound(uint8 emittingVol, uint32 freq);
+ bool8 SetupJumboEngineSound(uint8 vol, uint32 freq);
+ bool8 SetupJumboFlySound(uint8 emittingVol);
+ bool8 SetupJumboRumbleSound(uint8 emittingVol);
+ int32 GetJumboTaxiFreq(); // inlined on PS2
+
+ // peds
+ void ProcessPed(CPhysical *ped); // inlined on PS2
void ProcessPedHeadphones(cPedParams &params);
void ProcessPedOneShots(cPedParams &params);
- void ProcessPhysical(int32 id);
- void ProcessPlane(cVehicleParams& params);
- void ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *automobile);
- void ProcessPoliceCellBeatingScriptObject(uint8 sound);
+
+ // ped comments
+ void SetupPedComments(cPedParams &params, uint16 sound);
+ int32 GetPedCommentSfx(CPed *ped, uint16 sound);
+ void GetPhrase(uint32 &phrase, uint32 &prevPhrase, uint32 sample, uint32 maxOffset); // inlined on PS2
+ uint32 GetPlayerTalkSfx(uint16 sound); // inlined on PS2
+ uint32 GetCopTalkSfx(uint16 sound);
+ uint32 GetSwatTalkSfx(uint16 sound);
+ uint32 GetFBITalkSfx(uint16 sound);
+ uint32 GetArmyTalkSfx(uint16 sound);
+ uint32 GetMedicTalkSfx(uint16 sound);
+ uint32 GetFiremanTalkSfx(uint16 sound); // inlined on PS2
+ uint32 GetBusinessMaleOldTalkSfx(uint16 sound);
+ uint32 GetBusinessMaleYoungTalkSfx(uint16 sound, uint32 model);
+ uint32 GetMafiaTalkSfx(uint16 sound);
+ uint32 GetTriadTalkSfx(uint16 sound);
+ uint32 GetDiabloTalkSfx(uint16 sound);
+ uint32 GetYakuzaTalkSfx(uint16 sound);
+ uint32 GetYardieTalkSfx(uint16 sound);
+ uint32 GetColumbianTalkSfx(uint16 sound);
+ uint32 GetHoodTalkSfx(uint16 sound);
+ uint32 GetBlackCriminalTalkSfx(uint16 sound);
+ uint32 GetWhiteCriminalTalkSfx(uint16 sound);
+ uint32 GetCasualMaleOldTalkSfx(uint16 sound);
+ uint32 GetCasualMaleYoungTalkSfx(uint16 sound);
+ uint32 GetBlackCasualFemaleTalkSfx(uint16 sound);
+ uint32 GetWhiteCasualFemaleTalkSfx(uint16 sound);
+ uint32 GetFemaleNo3TalkSfx(uint16 sound);
+ uint32 GetWhiteBusinessFemaleTalkSfx(uint16 sound, uint32 model);
+ uint32 GetBlackFatFemaleTalkSfx(uint16 sound);
+ uint32 GetWhiteFatMaleTalkSfx(uint16 sound);
+ uint32 GetBlackFatMaleTalkSfx(uint16 sound);
+ uint32 GetWhiteFatFemaleTalkSfx(uint16 sound);
+ uint32 GetBlackFemaleProstituteTalkSfx(uint16 sound);
+ uint32 GetWhiteFemaleProstituteTalkSfx(uint16 sound);
+ uint32 GetBlackProjectMaleTalkSfx(uint16 sound, uint32 model);
+ uint32 GetBlackProjectFemaleOldTalkSfx(uint16 sound);
+ uint32 GetBlackProjectFemaleYoungTalkSfx(uint16 sound);
+ uint32 GetChinatownMaleOldTalkSfx(uint16 sound);
+ uint32 GetChinatownMaleYoungTalkSfx(uint16 sound);
+ uint32 GetChinatownFemaleOldTalkSfx(uint16 sound);
+ uint32 GetChinatownFemaleYoungTalkSfx(uint16 sound);
+ uint32 GetLittleItalyMaleTalkSfx(uint16 sound);
+ uint32 GetLittleItalyFemaleOldTalkSfx(uint16 sound);
+ uint32 GetLittleItalyFemaleYoungTalkSfx(uint16 sound);
+ uint32 GetWhiteDockerMaleTalkSfx(uint16 sound);
+ uint32 GetBlackDockerMaleTalkSfx(uint16 sound);
+ uint32 GetScumMaleTalkSfx(uint16 sound);
+ uint32 GetScumFemaleTalkSfx(uint16 sound);
+ uint32 GetWhiteWorkerMaleTalkSfx(uint16 sound);
+ uint32 GetBlackWorkerMaleTalkSfx(uint16 sound);
+ uint32 GetBlackBusinessFemaleTalkSfx(uint16 sound);
+ uint32 GetSupermodelMaleTalkSfx(uint16 sound);
+ uint32 GetSupermodelFemaleTalkSfx(uint16 sound);
+ uint32 GetStewardMaleTalkSfx(uint16 sound);
+ uint32 GetStewardFemaleTalkSfx(uint16 sound);
+ uint32 GetFanMaleTalkSfx(uint16 sound, uint32 model);
+ uint32 GetFanFemaleTalkSfx(uint16 sound);
+ uint32 GetHospitalMaleTalkSfx(uint16 sound);
+ uint32 GetHospitalFemaleTalkSfx(uint16 sound); // inlined on PS2
+ uint32 GetWhiteConstructionWorkerTalkSfx(uint16 sound);
+ uint32 GetBlackConstructionWorkerTalkSfx(uint16 sound);
+ uint32 GetShopperFemaleTalkSfx(uint16 sound, uint32 model);
+ uint32 GetStudentMaleTalkSfx(uint16 sound);
+ uint32 GetStudentFemaleTalkSfx(uint16 sound);
+
+ uint32 GetSpecialCharacterTalkSfx(uint32 modelIndex, uint16 sound);
+ uint32 GetEightBallTalkSfx(uint16 sound); // inlined on PS2
+ uint32 GetSalvatoreTalkSfx(uint16 sound); // inlined on PS2
+ uint32 GetMistyTalkSfx(uint16 sound);
+ uint32 GetOldJapTalkSfx(uint16 sound); // inlined on PS2
+ uint32 GetCatalinaTalkSfx(uint16 sound); // inlined on PS2
+ uint32 GetBomberTalkSfx(uint16 sound); // inlined on PS2
+ uint32 GetSecurityGuardTalkSfx(uint16 sound);
+ uint32 GetChunkyTalkSfx(uint16 sound); // inlined on PS2
+
+ uint32 GetAsianTaxiDriverTalkSfx(uint16 sound); // inlined on PS2
+ uint32 GetPimpTalkSfx(uint16 sound);
+ uint32 GetNormalMaleTalkSfx(uint16 sound);
+ uint32 GetGenericMaleTalkSfx(uint16 sound);
+ uint32 GetGenericFemaleTalkSfx(uint16 sound);
+
+ // particles
+ void ProcessExplosions(int32 explosion);
+ void ProcessFires(int32 entity);
+ void ProcessWaterCannon(int32);
+
+ // script objects
+ void ProcessScriptObject(int32 id); // inlined on PS2
+ void ProcessOneShotScriptObject(uint8 sound);
+ void ProcessLoopingScriptObject(uint8 sound);
void ProcessPornCinema(uint8 sound);
- void ProcessProjectiles();
- void ProcessRainOnVehicle(cVehicleParams& params);
- void ProcessReverb() const;
- bool8 ProcessReverseGear(cVehicleParams& params);
+ void ProcessWorkShopScriptObject(uint8 sound);
void ProcessSawMillScriptObject(uint8 sound);
- void ProcessScriptObject(int32 id);
+ void ProcessLaunderetteScriptObject(uint8 sound);
void ProcessShopScriptObject(uint8 sound);
- void ProcessSpecial();
- bool8 ProcessTrainNoise(cVehicleParams& params);
- void ProcessVehicle(CVehicle *vehicle);
- bool8 ProcessVehicleDoors(cVehicleParams& params);
- void ProcessVehicleEngine(cVehicleParams& params);
- void ProcessVehicleHorn(cVehicleParams& params);
- void ProcessVehicleOneShots(cVehicleParams& params);
- bool8 ProcessVehicleReverseWarning(cVehicleParams& params);
- bool8 ProcessVehicleRoadNoise(cVehicleParams& params);
- bool8 ProcessVehicleSirenOrAlarm(cVehicleParams& params);
- bool8 ProcessVehicleSkidding(cVehicleParams& params);
- void ProcessWaterCannon(int32);
+ void ProcessAirportScriptObject(uint8 sound);
+ void ProcessCinemaScriptObject(uint8 sound);
+ void ProcessDocksScriptObject(uint8 sound);
+ void ProcessHomeScriptObject(uint8 sound);
+ void ProcessPoliceCellBeatingScriptObject(uint8 sound);
+
+ // misc
void ProcessWeather(int32 id);
- bool8 ProcessWetRoadNoise(cVehicleParams& params);
- void ProcessWorkShopScriptObject(uint8 sound);
+ void ProcessFrontEnd();
+ void ProcessCrane();
+ void ProcessProjectiles();
+ void ProcessGarages();
+ void ProcessFireHydrant();
- int32 RandomDisplacement(uint32 seed) const;
- void ReacquireDigitalHandle() const;
- void ReleaseDigitalHandle() const;
- void ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2,
- float collisionPower, float intensity2);
- void ReportCrime(eCrimeType crime, const CVector &pos);
- void ResetAudioLogicTimers(uint32 timer);
- void ResetPoliceRadio();
- void ResetTimers(uint32 time);
+ // bridge
+ void ProcessBridge(); // inlined on PS2
+ void ProcessBridgeWarning();
+ void ProcessBridgeMotor();
+ void ProcessBridgeOneShots();
- void Service();
- void ServiceCollisions();
+ // mission audio
+ bool8 MissionScriptAudioUsesPoliceChannel(uint32 soundMission);
+ void PreloadMissionAudio(Const char *name);
+ uint8 GetMissionAudioLoadingStatus();
+ void SetMissionAudioLocation(float x, float y, float z);
+ void PlayLoadedMissionAudio();
+ bool8 IsMissionAudioSampleFinished();
+ bool8 IsMissionAudioSamplePlaying() { return m_sMissionAudio.m_nPlayStatus == PLAY_STATUS_PLAYING; }
+ bool8 ShouldDuckMissionAudio() { return IsMissionAudioSamplePlaying(); }
+ void ClearMissionAudio();
+ void ProcessMissionAudio();
+
+ // police radio
+ void InitialisePoliceRadioZones();
+ void InitialisePoliceRadio();
+ void ResetPoliceRadio();
+ void SetMissionScriptPoliceAudio(uint32 sfx);
+ int8 GetMissionScriptPoliceAudioPlayingStatus();
+ void DoPoliceRadioCrackle();
void ServicePoliceRadio();
void ServicePoliceRadioChannel(uint8 wantedLevel);
- void ServiceSoundEffects();
- int8 SetCurrent3DProvider(uint8 which);
- void SetDynamicAcousticModelingStatus(bool8 status);
- void SetEffectsFadeVol(uint8 volume) const;
- void SetEffectsMasterVolume(uint8 volume) const;
- void SetEntityStatus(int32 id, bool8 status);
- uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision);
- void SetMissionAudioLocation(float x, float y, float z);
- void SetMissionScriptPoliceAudio(int32 sfx) const;
- void SetMonoMode(bool8 mono);
- void SetMusicFadeVol(uint8 volume) const;
- void SetMusicMasterVolume(uint8 volume) const;
- void SetSpeakerConfig(int32 conf) const;
- void SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter);
- void SetUpOneShotCollisionSound(const cAudioCollision &col);
bool8 SetupCrimeReport();
- bool8 SetupJumboEngineSound(uint8 vol, uint32 freq);
- bool8 SetupJumboFlySound(uint8 emittingVol);
- bool8 SetupJumboRumbleSound(uint8 emittingVol);
- bool8 SetupJumboTaxiSound(uint8 vol);
- bool8 SetupJumboWhineSound(uint8 emittingVol, uint32 freq);
- void SetupPedComments(cPedParams &params, uint16 sound);
void SetupSuspectLastSeenReport();
-
- void Terminate();
- void TranslateEntity(Const CVector *v1, CVector *v2) const;
-
- void UpdateGasPedalAudio(CAutomobile *automobile);
- void UpdateReflections();
- bool8 UsesReverseWarning(int32 model) const;
- bool8 UsesSiren(int32 model) const;
- bool8 UsesSirenSwitching(int32 model) const;
-
-#ifdef GTA_PC
- // only used in pc
- void AdjustSamplesVolume();
- uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist);
-#endif
+ void ReportCrime(eCrimeType crime, const CVector &pos);
+ void PlaySuspectLastSeen(float x, float y, float z);
+ void AgeCrimes(); // inlined on PS2
+
+ // collision stuff
+ void ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, float collisionPower, float intensity2);
+ void ServiceCollisions();
+ void SetUpOneShotCollisionSound(const cAudioCollision &col);
+ void SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter);
+ uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision);
+ float GetCollisionOneShotRatio(uint32 a, float b);
+ float GetCollisionLoopingRatio(uint32 a, uint32 b, float c); // not used
+ float GetCollisionRatio(float a, float b, float c, float d); // inlined on PS2
};
/*
diff --git a/src/audio/DMAudio.cpp b/src/audio/DMAudio.cpp
index eea91bd1..688da201 100644
--- a/src/audio/DMAudio.cpp
+++ b/src/audio/DMAudio.cpp
@@ -38,6 +38,12 @@ cDMAudio::DestroyEntity(int32 audioEntity)
AudioManager.DestroyEntity(audioEntity);
}
+bool8
+cDMAudio::GetEntityStatus(int32 audioEntity)
+{
+ return AudioManager.GetEntityStatus(audioEntity);
+}
+
void
cDMAudio::SetEntityStatus(int32 audioEntity, bool8 status)
{
@@ -171,6 +177,12 @@ cDMAudio::IsAudioInitialised(void)
}
void
+cDMAudio::ResetPoliceRadio()
+{
+ AudioManager.ResetPoliceRadio();
+}
+
+void
cDMAudio::ReportCrime(eCrimeType crime, const CVector &pos)
{
AudioManager.ReportCrime(crime, pos);
diff --git a/src/audio/DMAudio.h b/src/audio/DMAudio.h
index 19689fab..9f427272 100644
--- a/src/audio/DMAudio.h
+++ b/src/audio/DMAudio.h
@@ -22,6 +22,7 @@ public:
int32 CreateEntity(eAudioType type, void *UID);
void DestroyEntity(int32 audioEntity);
+ bool8 GetEntityStatus(int32 audioEntity);
void SetEntityStatus(int32 audioEntity, bool8 status);
void PlayOneShot(int32 audioEntity, uint16 oneShot, float volume);
void DestroyAllGameCreatedEntities(void);
@@ -51,7 +52,8 @@ public:
char GetCDAudioDriveLetter(void);
bool8 IsAudioInitialised(void);
-
+
+ void ResetPoliceRadio();
void ReportCrime(eCrimeType crime, CVector const &pos);
int32 CreateLoopingScriptObject(cAudioScriptObject *scriptObject);
diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp
index cb441622..9872589a 100644
--- a/src/audio/MusicManager.cpp
+++ b/src/audio/MusicManager.cpp
@@ -236,23 +236,23 @@ cMusicManager::Initialise()
if (!IsInitialised()) {
time_t timevalue = time(0);
if (timevalue == -1) {
- pos = AudioManager.GetRandomNumber(0);
+ pos = AudioManager.m_anRandomTable[0];
} else {
tm *pTm = localtime(&timevalue);
if (pTm->tm_sec == 0)
- pTm->tm_sec = AudioManager.GetRandomNumber(0);
+ pTm->tm_sec = AudioManager.m_anRandomTable[0];
if (pTm->tm_min == 0)
- pTm->tm_min = AudioManager.GetRandomNumber(1);
+ pTm->tm_min = AudioManager.m_anRandomTable[1];
if (pTm->tm_hour == 0)
- pTm->tm_hour = AudioManager.GetRandomNumber(2);
+ pTm->tm_hour = AudioManager.m_anRandomTable[2];
if (pTm->tm_mday == 0)
- pTm->tm_mday = AudioManager.GetRandomNumber(3);
+ pTm->tm_mday = AudioManager.m_anRandomTable[3];
if (pTm->tm_mon == 0)
- pTm->tm_mon = AudioManager.GetRandomNumber(4);
+ pTm->tm_mon = AudioManager.m_anRandomTable[4];
if (pTm->tm_year == 0)
- pTm->tm_year = AudioManager.GetRandomNumber(3);
+ pTm->tm_year = AudioManager.m_anRandomTable[3];
if (pTm->tm_wday == 0)
- pTm->tm_wday = AudioManager.GetRandomNumber(2);
+ pTm->tm_wday = AudioManager.m_anRandomTable[2];
pos = pTm->tm_yday
* pTm->tm_wday
* pTm->tm_year
@@ -265,7 +265,7 @@ cMusicManager::Initialise()
for (int i = 0; i < TOTAL_STREAMED_SOUNDS; i++) {
m_aTracks[i].m_nLength = SampleManager.GetStreamedFileLength(i);
- m_aTracks[i].m_nPosition = pos * AudioManager.GetRandomNumber(i % 5) % m_aTracks[i].m_nLength;
+ m_aTracks[i].m_nPosition = pos * AudioManager.m_anRandomTable[i % 5] % m_aTracks[i].m_nLength;
m_aTracks[i].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
}
@@ -527,7 +527,7 @@ cMusicManager::ServiceGameMode()
#endif
}
#ifdef RADIO_SCROLL_TO_PREV_STATION
- else if(CPad::GetPad(0)->GetMouseWheelDownJustDown() || CPad::GetPad(0)->GetMouseWheelUpJustDown()) {
+ else if(!CPad::GetPad(0)->ArePlayerControlsDisabled() && (CPad::GetPad(0)->GetMouseWheelDownJustDown() || CPad::GetPad(0)->GetMouseWheelUpJustDown())) {
int scrollNext = ControlsManager.GetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, MOUSE);
int scrollPrev = scrollNext == rsMOUSEWHEELUPBUTTON ? rsMOUSEWHEELDOWNBUTTON : scrollNext == rsMOUSEWHEELDOWNBUTTON ? rsMOUSEWHEELUPBUTTON : -1;
@@ -949,7 +949,7 @@ cMusicManager::GetCarTuning()
if (veh == nil) return RADIO_OFF;
if (UsesPoliceRadio(veh)) return POLICE_RADIO;
if (veh->m_nRadioStation == USERTRACK && !SampleManager.IsMP3RadioChannelAvailable())
- veh->m_nRadioStation = AudioManager.GetRandomNumber(2) % USERTRACK;
+ veh->m_nRadioStation = AudioManager.m_anRandomTable[2] % USERTRACK;
return veh->m_nRadioStation;
}
diff --git a/src/audio/PolRadio.cpp b/src/audio/PolRadio.cpp
index 235a53d3..d6079191 100644
--- a/src/audio/PolRadio.cpp
+++ b/src/audio/PolRadio.cpp
@@ -25,7 +25,7 @@ tPoliceRadioZone ZoneSfx[NUMAUDIOZONES];
char SubZo2Label[8];
char SubZo3Label[8];
-int32 g_nMissionAudioSfx = TOTAL_AUDIO_SAMPLES;
+uint32 g_nMissionAudioSfx = TOTAL_AUDIO_SAMPLES;
int8 g_nMissionAudioPlayingStatus = 2;
uint8 gSpecialSuspectLastSeenReport;
uint32 gMinTimeToNextReport[NUM_CRIME_TYPES];
@@ -106,7 +106,7 @@ cAudioManager::ResetPoliceRadio()
}
void
-cAudioManager::SetMissionScriptPoliceAudio(int32 sfx) const
+cAudioManager::SetMissionScriptPoliceAudio(uint32 sfx)
{
if (!m_bIsInitialised) return;
if (g_nMissionAudioPlayingStatus != 1) {
@@ -116,7 +116,7 @@ cAudioManager::SetMissionScriptPoliceAudio(int32 sfx) const
}
int8
-cAudioManager::GetMissionScriptPoliceAudioPlayingStatus() const
+cAudioManager::GetMissionScriptPoliceAudioPlayingStatus()
{
return g_nMissionAudioPlayingStatus;
}
@@ -677,8 +677,6 @@ cAudioManager::SetupSuspectLastSeenReport()
}
}
-
-
void
cAudioManager::ReportCrime(eCrimeType type, const CVector &pos)
{
diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp
index d529513d..7c40d15d 100644
--- a/src/audio/sampman_miles.cpp
+++ b/src/audio/sampman_miles.cpp
@@ -1245,7 +1245,7 @@ cSampleManager::Initialise(void)
int32 randval;
if ( bUseRandomTable )
- randval = AudioManager.GetRandomNumber(1);
+ randval = AudioManager.m_anRandomTable[1];
else
randval = localtm->tm_sec * localtm->tm_min;
@@ -1256,7 +1256,7 @@ cSampleManager::Initialise(void)
randmp3 = randmp3->pNext;
if ( bUseRandomTable )
- _CurMP3Pos = AudioManager.GetRandomNumber(0) % randmp3->nTrackLength;
+ _CurMP3Pos = AudioManager.m_anRandomTable[0] % randmp3->nTrackLength;
else
{
if ( localtm->tm_sec > 0 )
@@ -1265,7 +1265,7 @@ cSampleManager::Initialise(void)
_CurMP3Pos = s*s*s*s*s*s*s*s % randmp3->nTrackLength;
}
else
- _CurMP3Pos = AudioManager.GetRandomNumber(0) % randmp3->nTrackLength;
+ _CurMP3Pos = AudioManager.m_anRandomTable[0] % randmp3->nTrackLength;
}
}
else
@@ -1345,7 +1345,7 @@ cSampleManager::CheckForAnAudioFileOnCD(void)
strcpy(filepath, m_szCDRomRootPath);
#endif // #if GTA_VERSION >= GTA3_PC_11
- strcat(filepath, PS2StreamedNameTable[AudioManager.GetRandomNumber(1) % TOTAL_STREAMED_SOUNDS]);
+ strcat(filepath, PS2StreamedNameTable[AudioManager.m_anRandomTable[1] % TOTAL_STREAMED_SOUNDS]);
f = fopen(filepath, "rb");
if ( !f )
@@ -1360,7 +1360,7 @@ cSampleManager::CheckForAnAudioFileOnCD(void)
strcpy(filepath, m_szCDRomRootPath);
#endif // #if GTA_VERSION >= GTA3_PC_11
- strcat(filepath, StreamedNameTable[AudioManager.GetRandomNumber(1) % TOTAL_STREAMED_SOUNDS]);
+ strcat(filepath, StreamedNameTable[AudioManager.m_anRandomTable[1] % TOTAL_STREAMED_SOUNDS]);
f = fopen(filepath, "rb");
}
@@ -1631,12 +1631,12 @@ cSampleManager::UpdateReverb(void)
if ( !usingEAX )
return FALSE;
- if ( AudioManager.GetFrameCounter() & 15 )
+ if ( AudioManager.m_FrameCounter & 15 )
return FALSE;
- float y = AudioManager.GetReflectionsDistance(REFLECTION_TOP) + AudioManager.GetReflectionsDistance(REFLECTION_BOTTOM);
- float x = AudioManager.GetReflectionsDistance(REFLECTION_LEFT) + AudioManager.GetReflectionsDistance(REFLECTION_RIGHT);
- float z = AudioManager.GetReflectionsDistance(REFLECTION_UP);
+ float y = AudioManager.m_afReflectionsDistances[REFLECTION_TOP] + AudioManager.m_afReflectionsDistances[REFLECTION_BOTTOM];
+ float x = AudioManager.m_afReflectionsDistances[REFLECTION_LEFT] + AudioManager.m_afReflectionsDistances[REFLECTION_RIGHT];
+ float z = AudioManager.m_afReflectionsDistances[REFLECTION_UP];
float normy = norm(y, 5.0f, 40.0f);
float normx = norm(x, 5.0f, 40.0f);
diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp
index 2d9f9e86..17776347 100644
--- a/src/audio/sampman_oal.cpp
+++ b/src/audio/sampman_oal.cpp
@@ -995,7 +995,7 @@ cSampleManager::Initialise(void)
int32 randval;
if ( bUseRandomTable )
- randval = AudioManager.GetRandomNumber(1);
+ randval = AudioManager.m_anRandomTable[1];
else
randval = localtm->tm_sec * localtm->tm_min;
@@ -1006,7 +1006,7 @@ cSampleManager::Initialise(void)
randmp3 = randmp3->pNext;
if ( bUseRandomTable )
- _CurMP3Pos = AudioManager.GetRandomNumber(0) % randmp3->nTrackLength;
+ _CurMP3Pos = AudioManager.m_anRandomTable[0] % randmp3->nTrackLength;
else
{
if ( localtm->tm_sec > 0 )
@@ -1015,7 +1015,7 @@ cSampleManager::Initialise(void)
_CurMP3Pos = s*s*s*s*s*s*s*s % randmp3->nTrackLength;
}
else
- _CurMP3Pos = AudioManager.GetRandomNumber(0) % randmp3->nTrackLength;
+ _CurMP3Pos = AudioManager.m_anRandomTable[0] % randmp3->nTrackLength;
}
}
else
@@ -1360,12 +1360,12 @@ bool8 cSampleManager::UpdateReverb(void)
if ( !usingEAX && !_usingEFX )
return FALSE;
- if ( AudioManager.GetFrameCounter() & 15 )
+ if ( AudioManager.m_FrameCounter & 15 )
return FALSE;
- float y = AudioManager.GetReflectionsDistance(REFLECTION_TOP) + AudioManager.GetReflectionsDistance(REFLECTION_BOTTOM);
- float x = AudioManager.GetReflectionsDistance(REFLECTION_LEFT) + AudioManager.GetReflectionsDistance(REFLECTION_RIGHT);
- float z = AudioManager.GetReflectionsDistance(REFLECTION_UP);
+ float y = AudioManager.m_afReflectionsDistances[REFLECTION_TOP] + AudioManager.m_afReflectionsDistances[REFLECTION_BOTTOM];
+ float x = AudioManager.m_afReflectionsDistances[REFLECTION_LEFT] + AudioManager.m_afReflectionsDistances[REFLECTION_RIGHT];
+ float z = AudioManager.m_afReflectionsDistances[REFLECTION_UP];
float normy = norm(y, 5.0f, 40.0f);
float normx = norm(x, 5.0f, 40.0f);
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index 35580053..37312b89 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -731,6 +731,7 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
}
float distanceToPlayer = (pVehicle->GetPosition() - vecPlayerPos).Magnitude2D();
float threshold = 50.0f;
+#ifndef EXTENDED_OFFSCREEN_DESPAWN_RANGE
if (pVehicle->GetIsOnScreen() ||
TheCamera.Cams[TheCamera.ActiveCam].LookingLeft ||
TheCamera.Cams[TheCamera.ActiveCam].LookingRight ||
@@ -741,7 +742,9 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
pVehicle->GetModelIndex() == MI_FIRETRUCK ||
pVehicle->bIsLawEnforcer ||
pVehicle->bIsCarParkVehicle
- ){
+ )
+#endif
+ {
threshold = 130.0f * TheCamera.GenerationDistMultiplier;
}
if (pVehicle->bExtendedRange)
diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp
index cc2b402b..afa2a66f 100644
--- a/src/core/FileLoader.cpp
+++ b/src/core/FileLoader.cpp
@@ -1135,12 +1135,12 @@ CFileLoader::LoadMLO(const char *line)
char smth[8];
char name[24];
int modelIndex;
- float someFloat;
+ float drawDist;
- sscanf(line, "%s %s %d %f", smth, name, &modelIndex, &someFloat);
+ sscanf(line, "%s %s %d %f", smth, name, &modelIndex, &drawDist);
CMloModelInfo *minfo = CModelInfo::AddMloModel(modelIndex);
minfo->SetModelName(name);
- minfo->field_34 = someFloat;
+ minfo->drawDist = drawDist;
int instId = CModelInfo::GetMloInstanceStore().allocPtr;
minfo->firstInstance = instId;
minfo->lastInstance = instId;
diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp
index 77d6cc7f..e0203355 100644
--- a/src/core/Radar.cpp
+++ b/src/core/Radar.cpp
@@ -485,7 +485,11 @@ void CRadar::Draw3dMarkers()
void CRadar::DrawBlips()
{
- if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) {
+ if ((!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud)
+#ifdef MENU_MAP
+ || CMenuManager::bMenuMapActive
+#endif
+ ) {
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
@@ -1216,7 +1220,11 @@ void CRadar::ShowRadarMarker(CVector pos, uint32 color, float radius) {
void CRadar::ShowRadarTrace(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha)
{
- if (!CHud::m_Wants_To_Draw_Hud || TheCamera.m_WideScreenOn)
+ if ((TheCamera.m_WideScreenOn || !CHud::m_Wants_To_Draw_Hud)
+#ifdef MENU_MAP
+ && !CMenuManager::bMenuMapActive
+#endif
+ )
return;
CSprite2d::DrawRect(CRect(x - SCREEN_SCALE_X(size + 1.0f), y - SCREEN_SCALE_Y(size + 1.0f), SCREEN_SCALE_X(size + 1.0f) + x, SCREEN_SCALE_Y(size + 1.0f) + y), CRGBA(0, 0, 0, alpha));
@@ -1225,7 +1233,11 @@ void CRadar::ShowRadarTrace(float x, float y, uint32 size, uint8 red, uint8 gree
void CRadar::ShowRadarTraceWithHeight(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha, uint8 mode)
{
- if (!CHud::m_Wants_To_Draw_Hud || TheCamera.m_WideScreenOn)
+ if ((TheCamera.m_WideScreenOn || !CHud::m_Wants_To_Draw_Hud)
+#ifdef MENU_MAP
+ && !CMenuManager::bMenuMapActive
+#endif
+ )
return;
switch (mode)
diff --git a/src/core/config.h b/src/core/config.h
index f0960e44..21a8b738 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -265,6 +265,9 @@ enum Config {
#define NO_MOVIES // add option to disable intro videos
+#define EXTENDED_OFFSCREEN_DESPAWN_RANGE // Use onscreen despawn range for offscreen peds and vehicles to avoid them despawning in the distance when you look
+ // away
+
#if defined(__LP64__) || defined(_WIN64)
#define FIX_BUGS_64 // Must have fixes to be able to run 64 bit build
#endif
@@ -409,7 +412,7 @@ enum Config {
// #define VC_PED_PORTS // various ports from VC's CPed, mostly subtle
// #define NEW_WALK_AROUND_ALGORITHM // to make walking around vehicles/objects less awkward
#define CANCELLABLE_CAR_ENTER
-//#define PEDS_REPORT_CRIMES_ON_PHONE, requires COMPATIBLE_SAVES
+//#define PEDS_REPORT_CRIMES_ON_PHONE // requires COMPATIBLE_SAVES
// Camera
//#define PS2_CAM_TRANSITION // old way of transitioning between cam modes
@@ -450,6 +453,7 @@ enum Config {
#undef PS2_ALPHA_TEST
#undef NO_ISLAND_LOADING
#undef PS2_AUDIO_CHANNELS
+ #undef EXTENDED_OFFSCREEN_DESPAWN_RANGE
#define PC_PARTICLE
#define VC_PED_PORTS // To not process collisions always. But should be tested if that's really beneficial
#define VC_RAIN_NERF // Reduces number of rain particles
diff --git a/src/modelinfo/MloModelInfo.h b/src/modelinfo/MloModelInfo.h
index d4344706..b1ae3298 100644
--- a/src/modelinfo/MloModelInfo.h
+++ b/src/modelinfo/MloModelInfo.h
@@ -5,7 +5,7 @@
class CMloModelInfo : public CClumpModelInfo
{
public:
- float field_34; // draw distance?
+ float drawDist;
int firstInstance;
int lastInstance;
public:
diff --git a/src/modelinfo/XtraCompsModelInfo.h b/src/modelinfo/XtraCompsModelInfo.h
index 9832399c..ab308a8a 100644
--- a/src/modelinfo/XtraCompsModelInfo.h
+++ b/src/modelinfo/XtraCompsModelInfo.h
@@ -7,6 +7,7 @@ class CXtraCompsModelInfo : public CClumpModelInfo
int field_34;
public:
CXtraCompsModelInfo(void) : CClumpModelInfo(MITYPE_XTRACOMPS) { field_34 = 0; }
- void SetClump(RpClump*) {};
void Shutdown(void) {};
+ RwObject *CreateInstance(void) { return nil; }
+ void SetClump(RpClump*) {};
}; \ No newline at end of file
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 5b52d021..3ccae5d0 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -326,6 +326,7 @@ CPed::~CPed(void)
nearPed->m_nearPeds[k] = nearPed->m_nearPeds[k + 1];
nearPed->m_nearPeds[k + 1] = nil;
}
+ nearPed->m_nearPeds[ARRAY_SIZE(m_nearPeds) - 1] = nil;
nearPed->m_numNearPeds--;
} else
j++;
@@ -392,8 +393,20 @@ CPed::BuildPedLists(void)
if (ped != this && !ped->bInVehicle) {
float dist = (ped->GetPosition() - GetPosition()).Magnitude2D();
if (nThreatReactionRangeMultiplier * 30.0f > dist) {
+#ifdef FIX_BUGS
+ // If the gap ped list is full, sort it and truncate it
+ // before pushing more unsorted peds
+ if( gnNumTempPedList == ARRAY_SIZE(gapTempPedList) - 1 )
+ {
+ gapTempPedList[gnNumTempPedList] = nil;
+ SortPeds(gapTempPedList, 0, gnNumTempPedList - 1);
+ gnNumTempPedList = ARRAY_SIZE(m_nearPeds);
+ }
+#endif
+
gapTempPedList[gnNumTempPedList] = ped;
gnNumTempPedList++;
+ // NOTE: We cannot absolutely fill the gap list, as the list is null-terminated before being passed to SortPeds
assert(gnNumTempPedList < ARRAY_SIZE(gapTempPedList));
}
}
@@ -1347,6 +1360,9 @@ CPed::CalculateNewVelocity(void)
limitedRotDest -= 2 * PI;
}
+#ifdef FREE_CAM
+ if (!TheCamera.Cams[0].Using3rdPersonMouseCam())
+#endif
if (IsPlayer() && m_nPedState == PED_ATTACK)
headAmount /= 4.0f;
@@ -2473,12 +2489,12 @@ CPed::ProcessControl(void)
obstacleForFlyingOtherDirZ = 501.0f;
}
#ifdef VC_PED_PORTS
- uint8 flyDir = 0;
+ int16 flyDir = 0;
float feetZ = GetPosition().z - FEET_OFFSET;
#ifdef FIX_BUGS
- if (obstacleForFlyingZ > feetZ && obstacleForFlyingOtherDirZ < 501.0f)
+ if (obstacleForFlyingZ > feetZ && obstacleForFlyingZ < 500.0f)
flyDir = 1;
- else if (obstacleForFlyingOtherDirZ > feetZ && obstacleForFlyingZ < 500.0f)
+ else if (obstacleForFlyingOtherDirZ > feetZ && obstacleForFlyingOtherDirZ < 501.0f)
flyDir = 2;
#else
if ((obstacleForFlyingZ > feetZ && obstacleForFlyingOtherDirZ < 500.0f) || (obstacleForFlyingZ > feetZ && obstacleForFlyingOtherDirZ > feetZ))
@@ -2487,8 +2503,8 @@ CPed::ProcessControl(void)
flyDir = 2;
#endif
- if (flyDir != 0 && !bSomeVCflag1) {
- SetPosition((flyDir == 2 ? obstacleForFlyingOtherDir.point : obstacleForFlying.point));
+ if (flyDir > 0 && !bSomeVCflag1) {
+ GetMatrix().SetTranslateOnly((flyDir == 2 ? obstacleForFlyingOtherDir.point : obstacleForFlying.point));
GetMatrix().GetPosition().z += FEET_OFFSET;
GetMatrix().UpdateRW();
SetLanding();
@@ -3187,7 +3203,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
lowerSpeedLimit *= 1.5f;
}
CAnimBlendAssociation *fallAnim = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_STD_FALL);
- if (!bWasStanding && speed > upperSpeedLimit && (/*!bPushedAlongByCar ||*/ m_vecMoveSpeed.z < lowerSpeedLimit)
+ if (!bWasStanding && ((speed > upperSpeedLimit /* ||!bPushedAlongByCar*/) || (m_vecMoveSpeed.z < lowerSpeedLimit))
&& m_pCollidingEntity != collidingEnt) {
float damage = 100.0f * Max(speed - 0.25f, 0.0f);
diff --git a/src/peds/PedIK.h b/src/peds/PedIK.h
index 9077fbea..1543fa34 100644
--- a/src/peds/PedIK.h
+++ b/src/peds/PedIK.h
@@ -29,7 +29,7 @@ class CPedIK
{
public:
enum {
- GUN_POINTED_SUCCESSFULLY = 1, // set but unused
+ GUN_POINTED_SUCCESSFULLY = 1,
LOOKAROUND_HEAD_ONLY = 2,
AIMS_WITH_ARM = 4,
};
diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp
index 6d6fc714..416fb949 100644
--- a/src/peds/PlayerPed.cpp
+++ b/src/peds/PlayerPed.cpp
@@ -503,6 +503,10 @@ CPlayerPed::DoWeaponSmoothSpray(void)
{
if (m_nPedState == PED_ATTACK && !m_pPointGunAt) {
eWeaponType weapon = GetWeapon()->m_eWeaponType;
+#ifdef FREE_CAM
+ if(TheCamera.Cams[0].Using3rdPersonMouseCam() && (weapon == WEAPONTYPE_COLT45 || weapon == WEAPONTYPE_UZI))
+ return false;
+#endif
if (weapon == WEAPONTYPE_FLAMETHROWER || weapon == WEAPONTYPE_COLT45 || weapon == WEAPONTYPE_UZI || weapon == WEAPONTYPE_SHOTGUN ||
weapon == WEAPONTYPE_AK47 || weapon == WEAPONTYPE_M16 || weapon == WEAPONTYPE_HELICANNON)
return true;
@@ -1183,6 +1187,13 @@ CPlayerPed::PlayerControlZelda(CPad *padUsed)
padMoveInGameUnit = CVector2D(leftRight, upDown).Magnitude() / PAD_MOVE_TO_GAME_WORLD_MOVE;
}
+#ifdef FREE_CAM
+ if(TheCamera.Cams[0].Using3rdPersonMouseCam() && doSmoothSpray) {
+ padMoveInGameUnit = 0.0f;
+ smoothSprayWithoutMove = false;
+ }
+#endif
+
if (padMoveInGameUnit > 0.0f || smoothSprayWithoutMove) {
float padHeading = CGeneral::GetRadianAngleBetweenPoints(0.0f, 0.0f, -leftRight, upDown);
float neededTurn = CGeneral::LimitRadianAngle(padHeading - camOrientation);
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index 1d2a5798..fcabff91 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -1126,13 +1126,16 @@ CPopulation::ManagePopulation(void)
bool pedIsFarAway = false;
if (PedCreationDistMultiplier() * (PED_REMOVE_DIST_SPECIAL * TheCamera.GenerationDistMultiplier) < dist
|| (!ped->bCullExtraFarAway && PedCreationDistMultiplier() * PED_REMOVE_DIST * TheCamera.GenerationDistMultiplier < dist)
+#ifndef EXTENDED_OFFSCREEN_DESPAWN_RANGE
|| (PedCreationDistMultiplier() * (MIN_CREATION_DIST + CREATION_RANGE) * OFFSCREEN_CREATION_MULT < dist
&& !ped->GetIsOnScreen()
&& TheCamera.Cams[TheCamera.ActiveCam].Mode != CCam::MODE_SNIPER
&& TheCamera.Cams[TheCamera.ActiveCam].Mode != CCam::MODE_SNIPER_RUNABOUT
&& !TheCamera.Cams[TheCamera.ActiveCam].LookingLeft
&& !TheCamera.Cams[TheCamera.ActiveCam].LookingRight
- && !TheCamera.Cams[TheCamera.ActiveCam].LookingBehind))
+ && !TheCamera.Cams[TheCamera.ActiveCam].LookingBehind)
+#endif
+ )
pedIsFarAway = true;
if (!pedIsFarAway)
diff --git a/src/renderer/Renderer.cpp b/src/renderer/Renderer.cpp
index 1c0bd445..25effc81 100644
--- a/src/renderer/Renderer.cpp
+++ b/src/renderer/Renderer.cpp
@@ -154,11 +154,14 @@ CRenderer::PreRender(void)
void
CRenderer::RenderOneRoad(CEntity *e)
{
+#ifndef MASTER
if(gbDontRenderBuildings)
return;
if(gbShowCollisionPolys)
CCollision::DrawColModel_Coloured(e->GetMatrix(), *CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel(), e->GetModelIndex());
- else{
+ else
+#endif
+ {
#ifdef EXTENDED_PIPELINES
CustomPipes::AttachGlossPipe(e->GetAtomic());
#endif
diff --git a/src/rw/VisibilityPlugins.cpp b/src/rw/VisibilityPlugins.cpp
index 7ff5c243..e6d4641d 100644
--- a/src/rw/VisibilityPlugins.cpp
+++ b/src/rw/VisibilityPlugins.cpp
@@ -155,7 +155,7 @@ CVisibilityPlugins::Initialise(void)
m_alphaList.head.item.sort = 0.0f;
m_alphaList.tail.item.sort = 100000000.0f;
#ifdef ASPECT_RATIO_SCALE
- // default 150 if not enough for bigger FOVs
+ // default 150 is not enough for bigger FOVs
m_alphaEntityList.Init(NUMALPHAENTITYLIST * 3);
#else
m_alphaEntityList.Init(NUMALPHAENTITYLIST);
@@ -658,8 +658,7 @@ CVisibilityPlugins::RenderTrainHiDetailAlphaCB(RpAtomic *atomic)
return atomic;
if(flags & ATOMIC_FLAG_DRAWLAST){
- // sort before clump
- if(!InsertAtomicIntoSortedList(atomic, distsq - 0.0001f))
+ if(!InsertAtomicIntoSortedList(atomic, distsq))
RENDERCALLBACK(atomic);
}else{
if(!InsertAtomicIntoSortedList(atomic, distsq + dot))
@@ -792,16 +791,6 @@ CVisibilityPlugins::DefaultVisibilityCB(RpClump *clump)
}
bool
-CVisibilityPlugins::MloVisibilityCB(RpClump *clump)
-{
- RwFrame *frame = RpClumpGetFrame(clump);
- CMloModelInfo *modelInfo = (CMloModelInfo*)GetFrameHierarchyId(frame);
- if (sq(modelInfo->field_34) < GetDistanceSquaredFromCamera(frame))
- return false;
- return CVisibilityPlugins::FrustumSphereCB(clump);
-}
-
-bool
CVisibilityPlugins::FrustumSphereCB(RpClump *clump)
{
RwSphere sphere;
@@ -817,11 +806,22 @@ CVisibilityPlugins::FrustumSphereCB(RpClump *clump)
}
bool
+CVisibilityPlugins::MloVisibilityCB(RpClump *clump)
+{
+ RwFrame *frame = RpClumpGetFrame(clump);
+ CMloModelInfo *modelInfo = (CMloModelInfo*)GetFrameHierarchyId(frame);
+ if (SQR(modelInfo->drawDist) < GetDistanceSquaredFromCamera(frame))
+ return false;
+ return CVisibilityPlugins::FrustumSphereCB(clump);
+}
+
+bool
CVisibilityPlugins::VehicleVisibilityCB(RpClump *clump)
{
- if (GetDistanceSquaredFromCamera(RpClumpGetFrame(clump)) <= ms_vehicleLod1Dist)
- return FrustumSphereCB(clump);
- return false;
+ RwFrame *frame = RpClumpGetFrame(clump);
+ if (ms_vehicleLod1Dist < GetDistanceSquaredFromCamera(frame))
+ return false;
+ return FrustumSphereCB(clump);
}
bool
@@ -927,6 +927,12 @@ CVisibilityPlugins::ClearAtomicFlag(RpAtomic *atomic, int f)
ATOMICEXT(atomic)->flags &= ~f;
}
+void
+CVisibilityPlugins::SetAtomicId(RpAtomic *atomic, int id)
+{
+ ATOMICEXT(atomic)->flags = id;
+}
+
int
CVisibilityPlugins::GetAtomicId(RpAtomic *atomic)
{
@@ -1012,7 +1018,9 @@ CVisibilityPlugins::SetClumpModelInfo(RpClump *clump, CClumpModelInfo *modelInfo
// Unused
switch (modelInfo->GetModelType()) {
- // ignore MLO
+ case MITYPE_MLO:
+ CLUMPEXT(clump)->visibilityCB = MloVisibilityCB;
+ break;
case MITYPE_VEHICLE:
vmi = (CVehicleModelInfo*)modelInfo;
if(vmi->m_vehicleType == VEHICLE_TYPE_TRAIN ||
@@ -1026,6 +1034,12 @@ CVisibilityPlugins::SetClumpModelInfo(RpClump *clump, CClumpModelInfo *modelInfo
}
}
+CClumpModelInfo*
+CVisibilityPlugins::GetClumpModelInfo(RpClump *clump)
+{
+ return (CClumpModelInfo*)GetFrameHierarchyId(RpClumpGetFrame(clump));
+}
+
void
CVisibilityPlugins::SetClumpAlpha(RpClump *clump, int alpha)
{
@@ -1037,3 +1051,9 @@ CVisibilityPlugins::GetClumpAlpha(RpClump *clump)
{
return CLUMPEXT(clump)->alpha;
}
+
+bool
+CVisibilityPlugins::IsClumpVisible(RpClump *clump)
+{
+ return CLUMPEXT(clump)->visibilityCB(clump);
+}
diff --git a/src/rw/VisibilityPlugins.h b/src/rw/VisibilityPlugins.h
index 5fb87765..f97fd589 100644
--- a/src/rw/VisibilityPlugins.h
+++ b/src/rw/VisibilityPlugins.h
@@ -94,6 +94,7 @@ public:
static CSimpleModelInfo *GetAtomicModelInfo(RpAtomic *atomic);
static void SetAtomicFlag(RpAtomic*, int);
static void ClearAtomicFlag(RpAtomic*, int);
+ static void SetAtomicId(RpAtomic *atomic, int);
static int GetAtomicId(RpAtomic *atomic);
static void SetAtomicRenderCallback(RpAtomic*, RpAtomicCallBackRender);
@@ -123,8 +124,10 @@ public:
int alpha;
};
static void SetClumpModelInfo(RpClump*, CClumpModelInfo*);
+ static CClumpModelInfo *GetClumpModelInfo(RpClump*);
static void SetClumpAlpha(RpClump*, int);
static int GetClumpAlpha(RpClump*);
+ static bool IsClumpVisible(RpClump*);
static void *ClumpConstructor(void *object, int32 offset, int32 len);
static void *ClumpDestructor(void *object, int32 offset, int32 len);
diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp
index 6f0e9094..6eab1a65 100644
--- a/src/weapons/Weapon.cpp
+++ b/src/weapons/Weapon.cpp
@@ -592,6 +592,16 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
{
CVector src, trgt;
TheCamera.Find3rdPersonCamTargetVector(info->m_fRange, *fireSource, src, trgt);
+#ifdef FREE_CAM
+ CPed *shooterPed = (CPed *)shooter;
+ if((shooterPed->m_pedIK.m_flags & CPedIK::GUN_POINTED_SUCCESSFULLY) == 0) {
+ trgt.x = info->m_fRange;
+ trgt.y = 0.0f;
+ trgt.z = 0.0f;
+
+ shooterPed->TransformToNode(trgt, PED_HANDR);
+ }
+#endif
#ifdef FIX_BUGS
// fix muzzleflash rotation