This commit is contained in:
Nikolay Korolev 2021-08-01 14:00:16 +03:00
commit 2b99f2634b
25 changed files with 1620 additions and 1477 deletions

View File

@ -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
{
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
cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter)
cAudioManager::ServiceCollisions()
{
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();
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;
}
}
}
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,
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;
}
}
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
cAudioManager::ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, float collisionPower,
float velocity)
uint32
cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision)
{
float distSquared;
CVector v1;
CVector v2;
uint8 surface1 = audioCollision.m_bSurface1;
uint8 surface2 = audioCollision.m_bSurface2;
int32 vol;
float ratio;
if(!m_bIsInitialised || m_nCollisionEntity < 0 || m_nUserPause ||
(velocity < 0.0016f && collisionPower < 0.01f))
return;
if(entity1->IsBuilding()) {
v1 = v2 = entity2->GetPosition();
} else if(entity2->IsBuilding()) {
v1 = v2 = entity1->GetPosition();
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 {
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();
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;
}
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;
}
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;
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();
};

File diff suppressed because it is too large Load Diff

View File

@ -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,35 +234,35 @@ 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::SetMusicFadeVol(uint8 volume)
{
SampleManager.SetMusicFadeVolume(volume);
}
void
cAudioManager::SetMonoMode(bool8 mono)
{
SampleManager.SetMonoMode(mono);
}
void
cAudioManager::SetMusicFadeVol(uint8 volume) const
{
SampleManager.SetMusicFadeVolume(volume);
}
void
cAudioManager::ResetTimers(uint32 time)
{
@ -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()
@ -964,6 +995,13 @@ cAudioManager::ClearActiveSamples()
}
}
void
cAudioManager::LoadBankIfNecessary(uint8 bank)
{
if(!SampleManager.IsSampleBankLoaded(bank))
SampleManager.LoadSampleBank(bank);
}
void
cAudioManager::GenerateIntegerRandomNumberTable()
{

View File

@ -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;
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 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 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;
void Service();
int32 CreateEntity(eAudioType type, void *entity);
void DestroyEntity(int32 id);
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();
#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 *);
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
#ifdef GTA_PC
// only used in pc
void AdjustSamplesVolume();
uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist);
#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);
// 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 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(uint32 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

@ -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)
{
@ -170,6 +176,12 @@ cDMAudio::IsAudioInitialised(void)
return AudioManager.IsAudioInitialised();
}
void
cDMAudio::ResetPoliceRadio()
{
AudioManager.ResetPoliceRadio();
}
void
cDMAudio::ReportCrime(eCrimeType crime, const CVector &pos)
{

View File

@ -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);

View File

@ -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;
}

View File

@ -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)
{

View File

@ -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);

View File

@ -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);

View File

@ -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)

View File

@ -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;

View File

@ -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)

View File

@ -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

View File

@ -5,7 +5,7 @@
class CMloModelInfo : public CClumpModelInfo
{
public:
float field_34; // draw distance?
float drawDist;
int firstInstance;
int lastInstance;
public:

View File

@ -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*) {};
};

View File

@ -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);

View File

@ -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,
};

View File

@ -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);

View File

@ -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)

View File

@ -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

View File

@ -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))
@ -791,16 +790,6 @@ CVisibilityPlugins::DefaultVisibilityCB(RpClump *clump)
return true;
}
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)
{
@ -816,12 +805,23 @@ CVisibilityPlugins::FrustumSphereCB(RpClump *clump)
return RwCameraFrustumTestSphere(ms_pCamera, &sphere) != rwSPHEREOUTSIDE;
}
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);
}

View File

@ -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);

View File

@ -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