Audio changes:

- Reorder AudioCollision.cpp functions into original order
- Add missing cAudioCollision::Reset()
- Move cAudioCollision ctor into .h (like original)
- Fix argument types for ped comment functions and more
- Fix wrong names of ped comment functions
- Fix incorrect ped comments
- Remove getters
- Reorder declarations of cAudioManager
- Wrap PC only functions around ifdef
- Add cAudioManager methods from PS2 and mobile
This commit is contained in:
Sergeanur 2021-07-26 04:18:41 +03:00
parent 3adf37a3a9
commit a064b3a687
9 changed files with 1459 additions and 1435 deletions

View File

@ -10,20 +10,39 @@
const int CollisionSoundIntensity = 60; 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; float distSquared;
m_sQueue.m_pEntity2 = nil; CVector v1;
m_sQueue.m_bSurface1 = SURFACE_DEFAULT; CVector v2;
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);
for (int i = 0; i < NUMAUDIOCOLLISIONS; i++) if(!m_bIsInitialised || m_nCollisionEntity < 0 || m_nUserPause ||
m_bIndicesTable[i] = NUMAUDIOCOLLISIONS; (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 void
@ -55,133 +74,71 @@ cAudioCollisionManager::AddCollisionToRequestedQueue()
m_bIndicesTable[i] = collisionsIndex; 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
{
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;
}
return result;
}
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;
}
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;
}
void void
cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter) cAudioManager::ServiceCollisions()
{ {
if(col.m_fIntensity2 > 0.0016f) { int i, j;
uint8 emittingVol = SetLoopingCollisionRequestedSfxFreqAndGetVol(col); bool8 abRepeatedCollision1[NUMAUDIOCOLLISIONS];
if(emittingVol) { bool8 abRepeatedCollision2[NUMAUDIOCOLLISIONS];
m_sQueueSample.m_fDistance = Sqrt(col.m_fDistance);
m_sQueueSample.m_nVolume = m_sQueueSample.m_nEntityIndex = m_nCollisionEntity;
ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_nVolume) { for (int i = 0; i < NUMAUDIOCOLLISIONS; i++)
m_sQueueSample.m_nCounter = counter; abRepeatedCollision1[i] = abRepeatedCollision2[i] = FALSE;
m_sQueueSample.m_vecPos = col.m_vecPosition;
m_sQueueSample.m_nBankIndex = SFX_BANK_0; for (i = 0; i < m_sCollisionManager.m_bCollisionsInQueue; i++) {
m_sQueueSample.m_bIs2D = FALSE; for (j = 0; j < NUMAUDIOCOLLISIONS; j++) {
m_sQueueSample.m_nReleasingVolumeModificator = 7; int index = m_sCollisionManager.m_bIndicesTable[i];
m_sQueueSample.m_nLoopCount = 0; if ((m_sCollisionManager.m_asCollisions1[index].m_pEntity1 == m_sCollisionManager.m_asCollisions2[j].m_pEntity1)
m_sQueueSample.m_nEmittingVolume = emittingVol; && (m_sCollisionManager.m_asCollisions1[index].m_pEntity2 == m_sCollisionManager.m_asCollisions2[j].m_pEntity2)
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex); && (m_sCollisionManager.m_asCollisions1[index].m_bSurface1 == m_sCollisionManager.m_asCollisions2[j].m_bSurface1)
m_sQueueSample.m_fSpeedMultiplier = 4.0f; && (m_sCollisionManager.m_asCollisions1[index].m_bSurface2 == m_sCollisionManager.m_asCollisions2[j].m_bSurface2)
m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity; ) {
m_sQueueSample.m_bReleasingSoundFlag = FALSE; abRepeatedCollision1[index] = TRUE;
m_sQueueSample.m_nReleasingVolumeDivider = 5; abRepeatedCollision2[j] = TRUE;
m_sQueueSample.m_bReverbFlag = TRUE; m_sCollisionManager.m_asCollisions1[index].m_nBaseVolume = ++m_sCollisionManager.m_asCollisions2[j].m_nBaseVolume;
m_sQueueSample.m_bRequireReflection = FALSE; SetUpLoopingCollisionSound(m_sCollisionManager.m_asCollisions1[index], j);
AddSampleToRequestedQueue(); break;
} }
} }
} }
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;
}
}
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, static const int32 gOneShotCol[] = {SFX_COL_TARMAC_1,
SFX_COL_TARMAC_1, SFX_COL_TARMAC_1,
SFX_COL_GRASS_1, SFX_COL_GRASS_1,
@ -219,9 +176,8 @@ static const int32 gOneShotCol[] = {SFX_COL_TARMAC_1,
void void
cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col) cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
{ {
uint16 s1;
int16 s1; uint16 s2;
int16 s2;
int32 emittingVol; int32 emittingVol;
float ratio; float ratio;
@ -321,101 +277,126 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
} }
void void
cAudioManager::ServiceCollisions() cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter)
{ {
int i, j; if(col.m_fIntensity2 > 0.0016f) {
bool8 abRepeatedCollision1[NUMAUDIOCOLLISIONS]; uint8 emittingVol = SetLoopingCollisionRequestedSfxFreqAndGetVol(col);
bool8 abRepeatedCollision2[NUMAUDIOCOLLISIONS]; if(emittingVol) {
m_sQueueSample.m_fDistance = Sqrt(col.m_fDistance);
m_sQueueSample.m_nEntityIndex = m_nCollisionEntity; m_sQueueSample.m_nVolume =
ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
for (int i = 0; i < NUMAUDIOCOLLISIONS; i++) if(m_sQueueSample.m_nVolume) {
abRepeatedCollision1[i] = abRepeatedCollision2[i] = FALSE; m_sQueueSample.m_nCounter = counter;
m_sQueueSample.m_vecPos = col.m_vecPosition;
for (i = 0; i < m_sCollisionManager.m_bCollisionsInQueue; i++) { m_sQueueSample.m_nBankIndex = SFX_BANK_0;
for (j = 0; j < NUMAUDIOCOLLISIONS; j++) { m_sQueueSample.m_bIs2D = FALSE;
int index = m_sCollisionManager.m_bIndicesTable[i]; m_sQueueSample.m_nReleasingVolumeModificator = 7;
if ((m_sCollisionManager.m_asCollisions1[index].m_pEntity1 == m_sCollisionManager.m_asCollisions2[j].m_pEntity1) m_sQueueSample.m_nLoopCount = 0;
&& (m_sCollisionManager.m_asCollisions1[index].m_pEntity2 == m_sCollisionManager.m_asCollisions2[j].m_pEntity2) m_sQueueSample.m_nEmittingVolume = emittingVol;
&& (m_sCollisionManager.m_asCollisions1[index].m_bSurface1 == m_sCollisionManager.m_asCollisions2[j].m_bSurface1) SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex);
&& (m_sCollisionManager.m_asCollisions1[index].m_bSurface2 == m_sCollisionManager.m_asCollisions2[j].m_bSurface2) m_sQueueSample.m_fSpeedMultiplier = 4.0f;
) { m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity;
abRepeatedCollision1[index] = TRUE; m_sQueueSample.m_bReleasingSoundFlag = FALSE;
abRepeatedCollision2[j] = TRUE; m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sCollisionManager.m_asCollisions1[index].m_nBaseVolume = ++m_sCollisionManager.m_asCollisions2[j].m_nBaseVolume; m_sQueueSample.m_bReverbFlag = TRUE;
SetUpLoopingCollisionSound(m_sCollisionManager.m_asCollisions1[index], j); m_sQueueSample.m_bRequireReflection = FALSE;
break; 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;
}
}
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;
} }
void uint32
cAudioManager::ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, float collisionPower, cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision)
float velocity)
{ {
float distSquared; uint8 surface1 = audioCollision.m_bSurface1;
CVector v1; uint8 surface2 = audioCollision.m_bSurface2;
CVector v2; int32 vol;
float ratio;
if(!m_bIsInitialised || m_nCollisionEntity < 0 || m_nUserPause || if(surface1 == SURFACE_GRASS || surface2 == SURFACE_GRASS || surface1 == SURFACE_HEDGE ||
(velocity < 0.0016f && collisionPower < 0.01f)) surface2 == SURFACE_HEDGE) {
return; ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
m_sQueueSample.m_nSampleIndex = SFX_RAIN;
if(entity1->IsBuilding()) { m_sQueueSample.m_nFrequency = 13000.f * ratio + 35000;
v1 = v2 = entity2->GetPosition(); vol = 50.f * ratio;
} else if(entity2->IsBuilding()) { } else if(surface1 == SURFACE_WATER || surface2 == SURFACE_WATER) {
v1 = v2 = entity1->GetPosition(); 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 { } else {
v1 = entity1->GetPosition(); ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
v2 = entity2->GetPosition(); m_sQueueSample.m_nSampleIndex = SFX_SCRAPE_CAR_1;
} m_sQueueSample.m_nFrequency = 10000.f * ratio + 10000;
CVector pos = (v1 + v2) * 0.5f; vol = 40.f * ratio;
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();
} }
if(audioCollision.m_nBaseVolume < 2) vol = audioCollision.m_nBaseVolume * vol / 2;
return vol;
}
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: return GetCollisionRatio(b, 0.f, 2.f, 2.f);
case SURFACE_GRAVEL: return GetCollisionRatio(b, 0.f, 2.f, 2.f);
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: 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: return GetCollisionRatio(b, 1.f, 10.f, 9.f);
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_METAL_CHAIN_FENCE: return GetCollisionRatio(b, 0.1f, 10.f, 9.9f);
case SURFACE_PED: return GetCollisionRatio(b, 0.f, 20.f, 20.f);
case SURFACE_SAND: return GetCollisionRatio(b, 0.f, 10.f, 10.f);
case SURFACE_WATER: 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_RUBBER:
case SURFACE_WHEELBASE: return GetCollisionRatio(b, 0.f, 10.f, 10.f);
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);
}
return 0.f;
}
float
cAudioManager::GetCollisionLoopingRatio(uint32 a, uint32 b, float c)
{
return GetCollisionRatio(c, 0.0f, 0.02f, 0.02f);
}
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;
} }

View File

@ -17,7 +17,18 @@ public:
float m_fDistance; float m_fDistance;
int32 m_nBaseVolume; 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); VALIDATE_SIZE(cAudioCollision, 40);
@ -31,7 +42,15 @@ public:
uint8 m_bCollisionsInQueue; uint8 m_bCollisionsInQueue;
cAudioCollision m_sQueue; cAudioCollision m_sQueue;
cAudioCollisionManager(); cAudioCollisionManager()
{
m_sQueue.Reset();
for(int i = 0; i < NUMAUDIOCOLLISIONS; i++)
m_bIndicesTable[i] = NUMAUDIOCOLLISIONS;
m_bCollisionsInQueue = 0;
}
void AddCollisionToRequestedQueue(); void AddCollisionToRequestedQueue();
}; };

File diff suppressed because it is too large Load Diff

View File

@ -109,7 +109,9 @@ cAudioManager::Service()
if (m_bIsInitialised) { if (m_bIsInitialised) {
m_nPreviousUserPause = m_nUserPause; m_nPreviousUserPause = m_nUserPause;
m_nUserPause = CTimer::GetIsUserPaused(); m_nUserPause = CTimer::GetIsUserPaused();
#ifdef GTA_PC
UpdateReflections(); UpdateReflections();
#endif
ServiceSoundEffects(); ServiceSoundEffects();
MusicManager.Service(); MusicManager.Service();
} }
@ -216,35 +218,35 @@ cAudioManager::PlayOneShot(int32 index, uint16 sound, float vol)
} }
void void
cAudioManager::SetEffectsMasterVolume(uint8 volume) const cAudioManager::SetEffectsMasterVolume(uint8 volume)
{ {
SampleManager.SetEffectsMasterVolume(volume); SampleManager.SetEffectsMasterVolume(volume);
} }
void void
cAudioManager::SetMusicMasterVolume(uint8 volume) const cAudioManager::SetMusicMasterVolume(uint8 volume)
{ {
SampleManager.SetMusicMasterVolume(volume); SampleManager.SetMusicMasterVolume(volume);
} }
void void
cAudioManager::SetEffectsFadeVol(uint8 volume) const cAudioManager::SetEffectsFadeVol(uint8 volume)
{ {
SampleManager.SetEffectsFadeVolume(volume); SampleManager.SetEffectsFadeVolume(volume);
} }
void
cAudioManager::SetMusicFadeVol(uint8 volume)
{
SampleManager.SetMusicFadeVolume(volume);
}
void void
cAudioManager::SetMonoMode(bool8 mono) cAudioManager::SetMonoMode(bool8 mono)
{ {
SampleManager.SetMonoMode(mono); SampleManager.SetMonoMode(mono);
} }
void
cAudioManager::SetMusicFadeVol(uint8 volume) const
{
SampleManager.SetMusicFadeVolume(volume);
}
void void
cAudioManager::ResetTimers(uint32 time) cAudioManager::ResetTimers(uint32 time)
{ {
@ -307,8 +309,10 @@ cAudioManager::DestroyAllGameCreatedEntities()
} }
} }
#ifdef GTA_PC
uint8 uint8
cAudioManager::GetNum3DProvidersAvailable() const cAudioManager::GetNum3DProvidersAvailable()
{ {
if (m_bIsInitialised) if (m_bIsInitialised)
return SampleManager.GetNum3DProvidersAvailable(); return SampleManager.GetNum3DProvidersAvailable();
@ -316,7 +320,7 @@ cAudioManager::GetNum3DProvidersAvailable() const
} }
char * char *
cAudioManager::Get3DProviderName(uint8 id) const cAudioManager::Get3DProviderName(uint8 id)
{ {
if (!m_bIsInitialised) if (!m_bIsInitialised)
return nil; return nil;
@ -331,7 +335,7 @@ cAudioManager::Get3DProviderName(uint8 id) const
} }
int8 int8
cAudioManager::GetCurrent3DProviderIndex() const cAudioManager::GetCurrent3DProviderIndex()
{ {
if (m_bIsInitialised) if (m_bIsInitialised)
return SampleManager.GetCurrent3DProviderIndex(); return SampleManager.GetCurrent3DProviderIndex();
@ -363,13 +367,13 @@ cAudioManager::SetCurrent3DProvider(uint8 which)
} }
void void
cAudioManager::SetSpeakerConfig(int32 conf) const cAudioManager::SetSpeakerConfig(int32 conf)
{ {
SampleManager.SetSpeakerConfig(conf); SampleManager.SetSpeakerConfig(conf);
} }
bool8 bool8
cAudioManager::IsMP3RadioChannelAvailable() const cAudioManager::IsMP3RadioChannelAvailable()
{ {
if (m_bIsInitialised) if (m_bIsInitialised)
return SampleManager.IsMP3RadioChannelAvailable(); return SampleManager.IsMP3RadioChannelAvailable();
@ -378,7 +382,7 @@ cAudioManager::IsMP3RadioChannelAvailable() const
} }
void void
cAudioManager::ReleaseDigitalHandle() const cAudioManager::ReleaseDigitalHandle()
{ {
if (m_bIsInitialised) { if (m_bIsInitialised) {
SampleManager.ReleaseDigitalHandle(); SampleManager.ReleaseDigitalHandle();
@ -386,7 +390,7 @@ cAudioManager::ReleaseDigitalHandle() const
} }
void void
cAudioManager::ReacquireDigitalHandle() const cAudioManager::ReacquireDigitalHandle()
{ {
if (m_bIsInitialised) { if (m_bIsInitialised) {
SampleManager.ReacquireDigitalHandle(); SampleManager.ReacquireDigitalHandle();
@ -400,13 +404,13 @@ cAudioManager::SetDynamicAcousticModelingStatus(bool8 status)
} }
bool8 bool8
cAudioManager::CheckForAnAudioFileOnCD() const cAudioManager::CheckForAnAudioFileOnCD()
{ {
return SampleManager.CheckForAnAudioFileOnCD(); return SampleManager.CheckForAnAudioFileOnCD();
} }
char char
cAudioManager::GetCDAudioDriveLetter() const cAudioManager::GetCDAudioDriveLetter()
{ {
if (m_bIsInitialised) if (m_bIsInitialised)
return SampleManager.GetCDAudioDriveLetter(); return SampleManager.GetCDAudioDriveLetter();
@ -415,11 +419,13 @@ cAudioManager::GetCDAudioDriveLetter() const
} }
bool8 bool8
cAudioManager::IsAudioInitialised() const cAudioManager::IsAudioInitialised()
{ {
return m_bIsInitialised; return m_bIsInitialised;
} }
#endif // GTA_PC
void void
cAudioManager::ServiceSoundEffects() cAudioManager::ServiceSoundEffects()
{ {
@ -469,8 +475,14 @@ cAudioManager::ServiceSoundEffects()
m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0; m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0;
} }
uint32
cAudioManager::FL(float f)
{
return SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex) * f;
}
uint8 uint8
cAudioManager::ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const cAudioManager::ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance)
{ {
float newSoundIntensity; float newSoundIntensity;
if (soundIntensity <= 0.0f) if (soundIntensity <= 0.0f)
@ -482,7 +494,7 @@ cAudioManager::ComputeVolume(uint8 emittingVolume, float soundIntensity, float d
} }
void void
cAudioManager::TranslateEntity(Const CVector *in, CVector *out) const cAudioManager::TranslateEntity(Const CVector *in, CVector *out)
{ {
*out = MultiplyInverse(TheCamera.GetMatrix(), *in); *out = MultiplyInverse(TheCamera.GetMatrix(), *in);
} }
@ -501,7 +513,7 @@ cAudioManager::ComputePan(float dist, CVector *vec)
} }
int32 int32
cAudioManager::ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2, float speedMultiplier) const cAudioManager::ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2, float speedMultiplier)
{ {
uint32 newFreq = oldFreq; uint32 newFreq = oldFreq;
if (!TheCamera.Get_Just_Switched_Status() && speedMultiplier != 0.0f) { if (!TheCamera.Get_Just_Switched_Status() && speedMultiplier != 0.0f) {
@ -522,7 +534,7 @@ cAudioManager::ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1,
} }
int32 int32
cAudioManager::RandomDisplacement(uint32 seed) const cAudioManager::RandomDisplacement(uint32 seed)
{ {
int32 value; int32 value;
@ -593,6 +605,7 @@ cAudioManager::AddSampleToRequestedQueue()
AddReflectionsToRequestedQueue(); AddReflectionsToRequestedQueue();
} }
} }
void void
cAudioManager::AddDetailsToRequestedOrderList(uint8 sample) cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
{ {
@ -610,6 +623,7 @@ cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = sample; m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = sample;
} }
#ifdef GTA_PC
void void
cAudioManager::AddReflectionsToRequestedQueue() cAudioManager::AddReflectionsToRequestedQueue()
{ {
@ -687,6 +701,7 @@ cAudioManager::UpdateReflections()
m_afReflectionsDistances[4] = 50.0f; m_afReflectionsDistances[4] = 50.0f;
} }
} }
#endif // GTA_PC
void void
cAudioManager::AddReleasingSounds() cAudioManager::AddReleasingSounds()
@ -964,6 +979,13 @@ cAudioManager::ClearActiveSamples()
} }
} }
void
cAudioManager::LoadBankIfNecessary(uint8 bank)
{
if(!SampleManager.IsSampleBankLoaded(bank))
SampleManager.LoadSampleBank(bank);
}
void void
cAudioManager::GenerateIntegerRandomNumberTable() cAudioManager::GenerateIntegerRandomNumberTable()
{ {

View File

@ -20,8 +20,8 @@ public:
#ifndef GTA_PS2 #ifndef GTA_PS2
int32 m_nLoopStart; int32 m_nLoopStart;
int32 m_nLoopEnd; int32 m_nLoopEnd;
#endif
uint8 m_nEmittingVolume; uint8 m_nEmittingVolume;
#endif
float m_fSpeedMultiplier; float m_fSpeedMultiplier;
float m_fSoundIntensity; float m_fSoundIntensity;
bool8 m_bReleasingSoundFlag; bool8 m_bReleasingSoundFlag;
@ -183,6 +183,9 @@ enum {
MAX_REFLECTIONS, 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 class cAudioManager
{ {
public: public:
@ -204,8 +207,10 @@ public:
tAudioEntity m_asAudioEntities[NUM_AUDIOENTITIES]; tAudioEntity m_asAudioEntities[NUM_AUDIOENTITIES];
int32 m_anAudioEntityIndices[NUM_AUDIOENTITIES]; int32 m_anAudioEntityIndices[NUM_AUDIOENTITIES];
int32 m_nAudioEntitiesTotal; int32 m_nAudioEntitiesTotal;
#ifdef GTA_PC
CVector m_avecReflectionsPos[NUM_AUDIO_REFLECTIONS]; CVector m_avecReflectionsPos[NUM_AUDIO_REFLECTIONS];
float m_afReflectionsDistances[NUM_AUDIO_REFLECTIONS]; float m_afReflectionsDistances[NUM_AUDIO_REFLECTIONS];
#endif
cAudioScriptObjectManager m_sAudioScriptObjectManager; cAudioScriptObjectManager m_sAudioScriptObjectManager;
cPedComments m_sPedComments; cPedComments m_sPedComments;
int32 m_nFireAudioEntity; int32 m_nFireAudioEntity;
@ -227,277 +232,279 @@ public:
cAudioManager(); cAudioManager();
~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;
int32 CreateEntity(eAudioType type, void *entity);
void DestroyAllGameCreatedEntities();
void DestroyEntity(int32 id);
void DoPoliceRadioCrackle();
// 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;
void Initialise(); void Initialise();
void InitialisePoliceRadio();
void InitialisePoliceRadioZones();
void InterrogateAudioEntities();
bool8 IsAudioInitialised() const;
bool8 IsMissionAudioSampleFinished();
bool8 IsMP3RadioChannelAvailable() const;
bool8 MissionScriptAudioUsesPoliceChannel(int32 soundMission) const;
void PlayLoadedMissionAudio();
void PlayOneShot(int32 index, uint16 sound, float vol);
void PlaySuspectLastSeen(float x, float y, float z);
void PlayerJustGotInCar() const;
void PlayerJustLeftCar() const;
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 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 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 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);
void ProcessPornCinema(uint8 sound);
void ProcessProjectiles();
void ProcessRainOnVehicle(cVehicleParams& params);
void ProcessReverb() const;
bool8 ProcessReverseGear(cVehicleParams& params);
void ProcessSawMillScriptObject(uint8 sound);
void ProcessScriptObject(int32 id);
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 ProcessWeather(int32 id);
bool8 ProcessWetRoadNoise(cVehicleParams& params);
void ProcessWorkShopScriptObject(uint8 sound);
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);
void Service();
void ServiceCollisions();
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 Terminate();
void TranslateEntity(Const CVector *v1, CVector *v2) const; void Service();
int32 CreateEntity(eAudioType type, void *entity);
void UpdateGasPedalAudio(CAutomobile *automobile); void DestroyEntity(int32 id);
void UpdateReflections(); void SetEntityStatus(int32 id, bool8 status);
bool8 UsesReverseWarning(int32 model) const; void PlayOneShot(int32 index, uint16 sound, float vol);
bool8 UsesSiren(int32 model) const; void SetEffectsMasterVolume(uint8 volume);
bool8 UsesSirenSwitching(int32 model) const; void SetMusicMasterVolume(uint8 volume);
void SetEffectsFadeVol(uint8 volume);
void SetMusicFadeVol(uint8 volume);
void SetMonoMode(bool8 mono);
void ResetTimers(uint32 time);
void DestroyAllGameCreatedEntities();
#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 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 *);
int32 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
#ifdef GTA_PC #ifdef GTA_PC
// only used in pc
void AdjustSamplesVolume(); void AdjustSamplesVolume();
uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist); uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist);
#endif #endif
// audio logic
void PreInitialiseGameSpecificSetup();
void PostInitialiseGameSpecificSetup();
void PreTerminateGameSpecificShutdown();
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 ProcessPhysical(int32 id);
void ProcessVehicle(CVehicle *vehicle);
void ProcessRainOnVehicle(cVehicleParams &params);
bool8 ProcessReverseGear(cVehicleParams &params);
void ProcessModelCarEngine(cVehicleParams &params);
bool8 ProcessVehicleRoadNoise(cVehicleParams &params);
bool8 ProcessWetRoadNoise(cVehicleParams &params);
// vehicles
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); // was in .h 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 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);
// 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 ProcessWorkShopScriptObject(uint8 sound);
void ProcessSawMillScriptObject(uint8 sound);
void ProcessLaunderetteScriptObject(uint8 sound);
void ProcessShopScriptObject(uint8 sound);
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);
void ProcessFrontEnd();
void ProcessCrane();
void ProcessProjectiles();
void ProcessGarages();
void ProcessFireHydrant();
// bridge
void ProcessBridge(); // inlined on PS2
void ProcessBridgeWarning();
void ProcessBridgeMotor();
void ProcessBridgeOneShots();
// 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(int32 sfx);
int8 GetMissionScriptPoliceAudioPlayingStatus();
void DoPoliceRadioCrackle();
void ServicePoliceRadio();
void ServicePoliceRadioChannel(uint8 wantedLevel);
bool8 SetupCrimeReport();
void SetupSuspectLastSeenReport();
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
}; };
/* /*

View File

@ -236,23 +236,23 @@ cMusicManager::Initialise()
if (!IsInitialised()) { if (!IsInitialised()) {
time_t timevalue = time(0); time_t timevalue = time(0);
if (timevalue == -1) { if (timevalue == -1) {
pos = AudioManager.GetRandomNumber(0); pos = AudioManager.m_anRandomTable[0];
} else { } else {
tm *pTm = localtime(&timevalue); tm *pTm = localtime(&timevalue);
if (pTm->tm_sec == 0) if (pTm->tm_sec == 0)
pTm->tm_sec = AudioManager.GetRandomNumber(0); pTm->tm_sec = AudioManager.m_anRandomTable[0];
if (pTm->tm_min == 0) if (pTm->tm_min == 0)
pTm->tm_min = AudioManager.GetRandomNumber(1); pTm->tm_min = AudioManager.m_anRandomTable[1];
if (pTm->tm_hour == 0) if (pTm->tm_hour == 0)
pTm->tm_hour = AudioManager.GetRandomNumber(2); pTm->tm_hour = AudioManager.m_anRandomTable[2];
if (pTm->tm_mday == 0) if (pTm->tm_mday == 0)
pTm->tm_mday = AudioManager.GetRandomNumber(3); pTm->tm_mday = AudioManager.m_anRandomTable[3];
if (pTm->tm_mon == 0) if (pTm->tm_mon == 0)
pTm->tm_mon = AudioManager.GetRandomNumber(4); pTm->tm_mon = AudioManager.m_anRandomTable[4];
if (pTm->tm_year == 0) if (pTm->tm_year == 0)
pTm->tm_year = AudioManager.GetRandomNumber(3); pTm->tm_year = AudioManager.m_anRandomTable[3];
if (pTm->tm_wday == 0) if (pTm->tm_wday == 0)
pTm->tm_wday = AudioManager.GetRandomNumber(2); pTm->tm_wday = AudioManager.m_anRandomTable[2];
pos = pTm->tm_yday pos = pTm->tm_yday
* pTm->tm_wday * pTm->tm_wday
* pTm->tm_year * pTm->tm_year
@ -265,7 +265,7 @@ cMusicManager::Initialise()
for (int i = 0; i < TOTAL_STREAMED_SOUNDS; i++) { for (int i = 0; i < TOTAL_STREAMED_SOUNDS; i++) {
m_aTracks[i].m_nLength = SampleManager.GetStreamedFileLength(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(); m_aTracks[i].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
} }
@ -949,7 +949,7 @@ cMusicManager::GetCarTuning()
if (veh == nil) return RADIO_OFF; if (veh == nil) return RADIO_OFF;
if (UsesPoliceRadio(veh)) return POLICE_RADIO; if (UsesPoliceRadio(veh)) return POLICE_RADIO;
if (veh->m_nRadioStation == USERTRACK && !SampleManager.IsMP3RadioChannelAvailable()) 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; return veh->m_nRadioStation;
} }

View File

@ -106,7 +106,7 @@ cAudioManager::ResetPoliceRadio()
} }
void void
cAudioManager::SetMissionScriptPoliceAudio(int32 sfx) const cAudioManager::SetMissionScriptPoliceAudio(int32 sfx)
{ {
if (!m_bIsInitialised) return; if (!m_bIsInitialised) return;
if (g_nMissionAudioPlayingStatus != 1) { if (g_nMissionAudioPlayingStatus != 1) {
@ -116,7 +116,7 @@ cAudioManager::SetMissionScriptPoliceAudio(int32 sfx) const
} }
int8 int8
cAudioManager::GetMissionScriptPoliceAudioPlayingStatus() const cAudioManager::GetMissionScriptPoliceAudioPlayingStatus()
{ {
return g_nMissionAudioPlayingStatus; return g_nMissionAudioPlayingStatus;
} }
@ -677,8 +677,6 @@ cAudioManager::SetupSuspectLastSeenReport()
} }
} }
void void
cAudioManager::ReportCrime(eCrimeType type, const CVector &pos) cAudioManager::ReportCrime(eCrimeType type, const CVector &pos)
{ {

View File

@ -1245,7 +1245,7 @@ cSampleManager::Initialise(void)
int32 randval; int32 randval;
if ( bUseRandomTable ) if ( bUseRandomTable )
randval = AudioManager.GetRandomNumber(1); randval = AudioManager.m_anRandomTable[1];
else else
randval = localtm->tm_sec * localtm->tm_min; randval = localtm->tm_sec * localtm->tm_min;
@ -1256,7 +1256,7 @@ cSampleManager::Initialise(void)
randmp3 = randmp3->pNext; randmp3 = randmp3->pNext;
if ( bUseRandomTable ) if ( bUseRandomTable )
_CurMP3Pos = AudioManager.GetRandomNumber(0) % randmp3->nTrackLength; _CurMP3Pos = AudioManager.m_anRandomTable[0] % randmp3->nTrackLength;
else else
{ {
if ( localtm->tm_sec > 0 ) if ( localtm->tm_sec > 0 )
@ -1265,7 +1265,7 @@ cSampleManager::Initialise(void)
_CurMP3Pos = s*s*s*s*s*s*s*s % randmp3->nTrackLength; _CurMP3Pos = s*s*s*s*s*s*s*s % randmp3->nTrackLength;
} }
else else
_CurMP3Pos = AudioManager.GetRandomNumber(0) % randmp3->nTrackLength; _CurMP3Pos = AudioManager.m_anRandomTable[0] % randmp3->nTrackLength;
} }
} }
else else
@ -1345,7 +1345,7 @@ cSampleManager::CheckForAnAudioFileOnCD(void)
strcpy(filepath, m_szCDRomRootPath); strcpy(filepath, m_szCDRomRootPath);
#endif // #if GTA_VERSION >= GTA3_PC_11 #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"); f = fopen(filepath, "rb");
if ( !f ) if ( !f )
@ -1360,7 +1360,7 @@ cSampleManager::CheckForAnAudioFileOnCD(void)
strcpy(filepath, m_szCDRomRootPath); strcpy(filepath, m_szCDRomRootPath);
#endif // #if GTA_VERSION >= GTA3_PC_11 #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"); f = fopen(filepath, "rb");
} }
@ -1631,12 +1631,12 @@ cSampleManager::UpdateReverb(void)
if ( !usingEAX ) if ( !usingEAX )
return FALSE; return FALSE;
if ( AudioManager.GetFrameCounter() & 15 ) if ( AudioManager.m_FrameCounter & 15 )
return FALSE; return FALSE;
float y = AudioManager.GetReflectionsDistance(REFLECTION_TOP) + AudioManager.GetReflectionsDistance(REFLECTION_BOTTOM); float y = AudioManager.m_afReflectionsDistances[REFLECTION_TOP] + AudioManager.m_afReflectionsDistances[REFLECTION_BOTTOM];
float x = AudioManager.GetReflectionsDistance(REFLECTION_LEFT) + AudioManager.GetReflectionsDistance(REFLECTION_RIGHT); float x = AudioManager.m_afReflectionsDistances[REFLECTION_LEFT] + AudioManager.m_afReflectionsDistances[REFLECTION_RIGHT];
float z = AudioManager.GetReflectionsDistance(REFLECTION_UP); float z = AudioManager.m_afReflectionsDistances[REFLECTION_UP];
float normy = norm(y, 5.0f, 40.0f); float normy = norm(y, 5.0f, 40.0f);
float normx = norm(x, 5.0f, 40.0f); float normx = norm(x, 5.0f, 40.0f);

View File

@ -995,7 +995,7 @@ cSampleManager::Initialise(void)
int32 randval; int32 randval;
if ( bUseRandomTable ) if ( bUseRandomTable )
randval = AudioManager.GetRandomNumber(1); randval = AudioManager.m_anRandomTable[1];
else else
randval = localtm->tm_sec * localtm->tm_min; randval = localtm->tm_sec * localtm->tm_min;
@ -1006,7 +1006,7 @@ cSampleManager::Initialise(void)
randmp3 = randmp3->pNext; randmp3 = randmp3->pNext;
if ( bUseRandomTable ) if ( bUseRandomTable )
_CurMP3Pos = AudioManager.GetRandomNumber(0) % randmp3->nTrackLength; _CurMP3Pos = AudioManager.m_anRandomTable[0] % randmp3->nTrackLength;
else else
{ {
if ( localtm->tm_sec > 0 ) if ( localtm->tm_sec > 0 )
@ -1015,7 +1015,7 @@ cSampleManager::Initialise(void)
_CurMP3Pos = s*s*s*s*s*s*s*s % randmp3->nTrackLength; _CurMP3Pos = s*s*s*s*s*s*s*s % randmp3->nTrackLength;
} }
else else
_CurMP3Pos = AudioManager.GetRandomNumber(0) % randmp3->nTrackLength; _CurMP3Pos = AudioManager.m_anRandomTable[0] % randmp3->nTrackLength;
} }
} }
else else
@ -1363,9 +1363,9 @@ bool8 cSampleManager::UpdateReverb(void)
if ( AudioManager.GetFrameCounter() & 15 ) if ( AudioManager.GetFrameCounter() & 15 )
return FALSE; return FALSE;
float y = AudioManager.GetReflectionsDistance(REFLECTION_TOP) + AudioManager.GetReflectionsDistance(REFLECTION_BOTTOM); float y = AudioManager.m_afReflectionsDistances[REFLECTION_TOP] + AudioManager.m_afReflectionsDistances[REFLECTION_BOTTOM];
float x = AudioManager.GetReflectionsDistance(REFLECTION_LEFT) + AudioManager.GetReflectionsDistance(REFLECTION_RIGHT); float x = AudioManager.m_afReflectionsDistances[REFLECTION_LEFT] + AudioManager.m_afReflectionsDistances[REFLECTION_RIGHT];
float z = AudioManager.GetReflectionsDistance(REFLECTION_UP); float z = AudioManager.m_afReflectionsDistances[REFLECTION_UP];
float normy = norm(y, 5.0f, 40.0f); float normy = norm(y, 5.0f, 40.0f);
float normx = norm(x, 5.0f, 40.0f); float normx = norm(x, 5.0f, 40.0f);