Fixed arguments for sound collisions
This commit is contained in:
parent
876e402d1e
commit
ed1bb7236f
@ -117,58 +117,54 @@ cAudioManager::GetCollisionRatio(float a, float b, float c, float d) const
|
||||
}
|
||||
|
||||
uint32
|
||||
cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol(cAudioCollision *audioCollision)
|
||||
cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision)
|
||||
{
|
||||
uint8 surface1 = audioCollision->m_bSurface1;
|
||||
uint8 surface2 = audioCollision->m_bSurface2;
|
||||
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);
|
||||
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_PUDDLE || surface2 == SURFACE_PUDDLE) {
|
||||
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_DIRT || surface2 == SURFACE_DIRT || surface1 == SURFACE_DIRTTRACK ||
|
||||
surface2 == SURFACE_DIRTTRACK || 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_FLESH || surface2 == SURFACE_FLESH) {
|
||||
return 0;
|
||||
} else {
|
||||
if(surface1 == SURFACE_PUDDLE || surface2 == SURFACE_PUDDLE) {
|
||||
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_DIRT || surface2 == SURFACE_DIRT || surface1 == SURFACE_DIRTTRACK ||
|
||||
surface2 == SURFACE_DIRTTRACK || 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_FLESH || surface2 == SURFACE_FLESH) { return 0; }
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
if(audioCollision.m_nBaseVolume < 2) vol = audioCollision.m_nBaseVolume * vol / 2;
|
||||
return vol;
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter)
|
||||
cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter)
|
||||
{
|
||||
if(col->m_fIntensity2 > 0.0016f) {
|
||||
if(col.m_fIntensity2 > 0.0016f) {
|
||||
uint8 emittingVol = SetLoopingCollisionRequestedSfxFreqAndGetVol(col);
|
||||
if(emittingVol) {
|
||||
m_sQueueSample.m_fDistance = Sqrt(col->m_fDistance);
|
||||
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_vecPos = col.m_vecPosition;
|
||||
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
|
||||
m_sQueueSample.m_bIs2D = false;
|
||||
m_sQueueSample.m_nReleasingVolumeModificator = 7;
|
||||
@ -189,22 +185,43 @@ cAudioManager::SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter)
|
||||
}
|
||||
}
|
||||
}
|
||||
static const int32 gOneShotCol[] = {SFX_COL_TARMAC_1,
|
||||
SFX_COL_TARMAC_1,
|
||||
SFX_COL_GRASS_1,
|
||||
SFX_COL_GRAVEL_1,
|
||||
SFX_COL_MUD_1,
|
||||
SFX_COL_TARMAC_1,
|
||||
SFX_COL_CAR_1,
|
||||
SFX_COL_GRASS_1,
|
||||
SFX_COL_SCAFFOLD_POLE_1,
|
||||
SFX_COL_GARAGE_DOOR_1,
|
||||
SFX_COL_CAR_PANEL_1,
|
||||
SFX_COL_THICK_METAL_PLATE_1,
|
||||
SFX_COL_SCAFFOLD_POLE_1,
|
||||
SFX_COL_LAMP_POST_1,
|
||||
SFX_COL_HYDRANT_1,
|
||||
SFX_COL_HYDRANT_1,
|
||||
SFX_COL_METAL_CHAIN_FENCE_1,
|
||||
SFX_COL_PED_1,
|
||||
SFX_COL_SAND_1,
|
||||
SFX_SPLASH_1,
|
||||
SFX_COL_WOOD_CRATES_1,
|
||||
SFX_COL_WOOD_BENCH_1,
|
||||
SFX_COL_WOOD_SOLID_1,
|
||||
SFX_COL_GRASS_1,
|
||||
SFX_COL_GRASS_1,
|
||||
SFX_COL_VEG_1,
|
||||
SFX_COL_TARMAC_1,
|
||||
SFX_COL_CONTAINER_1,
|
||||
SFX_COL_NEWS_VENDOR_1,
|
||||
SFX_TYRE_BUMP,
|
||||
SFX_COL_CARDBOARD_1,
|
||||
SFX_COL_TARMAC_1,
|
||||
SFX_COL_GATE};
|
||||
|
||||
void
|
||||
cAudioManager::SetUpOneShotCollisionSound(cAudioCollision *col)
|
||||
cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
|
||||
{
|
||||
static const int32 gOneShotCol[] = {
|
||||
SFX_COL_TARMAC_1, SFX_COL_TARMAC_1, SFX_COL_GRASS_1,
|
||||
SFX_COL_GRAVEL_1, SFX_COL_MUD_1, SFX_COL_TARMAC_1,
|
||||
SFX_COL_CAR_1, SFX_COL_GRASS_1, SFX_COL_SCAFFOLD_POLE_1,
|
||||
SFX_COL_GARAGE_DOOR_1, SFX_COL_CAR_PANEL_1, SFX_COL_THICK_METAL_PLATE_1,
|
||||
SFX_COL_SCAFFOLD_POLE_1, SFX_COL_LAMP_POST_1, SFX_COL_HYDRANT_1,
|
||||
SFX_COL_HYDRANT_1, SFX_COL_METAL_CHAIN_FENCE_1, SFX_COL_PED_1,
|
||||
SFX_COL_SAND_1, SFX_SPLASH_1, SFX_COL_WOOD_CRATES_1,
|
||||
SFX_COL_WOOD_BENCH_1, SFX_COL_WOOD_SOLID_1, SFX_COL_GRASS_1,
|
||||
SFX_COL_GRASS_1, SFX_COL_VEG_1, SFX_COL_TARMAC_1,
|
||||
SFX_COL_CONTAINER_1, SFX_COL_NEWS_VENDOR_1, SFX_TYRE_BUMP,
|
||||
SFX_COL_CARDBOARD_1, SFX_COL_TARMAC_1, SFX_COL_GATE};
|
||||
|
||||
int16 s1;
|
||||
int16 s2;
|
||||
@ -216,21 +233,21 @@ cAudioManager::SetUpOneShotCollisionSound(cAudioCollision *col)
|
||||
|
||||
for(int32 i = 0; i < 2; i++) {
|
||||
if(i) {
|
||||
s1 = col->m_bSurface2;
|
||||
s2 = col->m_bSurface1;
|
||||
s1 = col.m_bSurface2;
|
||||
s2 = col.m_bSurface1;
|
||||
} else {
|
||||
s1 = col->m_bSurface1;
|
||||
s2 = col->m_bSurface2;
|
||||
s1 = col.m_bSurface1;
|
||||
s2 = col.m_bSurface2;
|
||||
}
|
||||
ratio = GetCollisionOneShotRatio(s1, col->m_fIntensity1);
|
||||
if(s1 == SURFACE_METAL6 && s2 == SURFACE_FLESH) ratio = 0.25f * ratio;
|
||||
ratio = GetCollisionOneShotRatio(s1, col.m_fIntensity1);
|
||||
if(s1 == SURFACE_METAL6 && s2 == SURFACE_FLESH) ratio /= 4.0f;
|
||||
if(s1 == SURFACE_METAL6 && ratio < 0.6f) {
|
||||
s1 = SURFACE_BILLBOARD;
|
||||
ratio = Min(1.f, 2.f * ratio);
|
||||
}
|
||||
emittingVol = 40.f * ratio;
|
||||
if(emittingVol) {
|
||||
m_sQueueSample.m_fDistance = Sqrt(col->m_fDistance);
|
||||
m_sQueueSample.m_fDistance = Sqrt(col.m_fDistance);
|
||||
m_sQueueSample.m_nVolume =
|
||||
ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
|
||||
if(m_sQueueSample.m_nVolume) {
|
||||
@ -288,7 +305,7 @@ cAudioManager::SetUpOneShotCollisionSound(cAudioCollision *col)
|
||||
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
|
||||
m_sQueueSample.m_nCounter = counter++;
|
||||
if(counter >= 255) counter = 28;
|
||||
m_sQueueSample.m_vecPos = col->m_vecPosition;
|
||||
m_sQueueSample.m_vecPos = col.m_vecPosition;
|
||||
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
|
||||
m_sQueueSample.m_bIs2D = false;
|
||||
m_sQueueSample.m_nReleasingVolumeModificator = 11;
|
||||
@ -330,7 +347,7 @@ cAudioManager::ServiceCollisions()
|
||||
someArr1[index] = true;
|
||||
someArr2[j] = true;
|
||||
m_sCollisionManager.m_asCollisions1[index].m_nBaseVolume = ++m_sCollisionManager.m_asCollisions2[j].m_nBaseVolume;
|
||||
SetUpLoopingCollisionSound(&m_sCollisionManager.m_asCollisions1[index], j);
|
||||
SetUpLoopingCollisionSound(m_sCollisionManager.m_asCollisions1[index], j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -362,8 +379,8 @@ cAudioManager::ServiceCollisions()
|
||||
break;
|
||||
}
|
||||
}
|
||||
SetUpOneShotCollisionSound(&m_sCollisionManager.m_asCollisions1[index]);
|
||||
SetUpLoopingCollisionSound(&m_sCollisionManager.m_asCollisions1[index], j);
|
||||
SetUpOneShotCollisionSound(m_sCollisionManager.m_asCollisions1[index]);
|
||||
SetUpLoopingCollisionSound(m_sCollisionManager.m_asCollisions1[index], j);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3625,14 +3625,14 @@ cAudioManager::ProcessActiveQueues()
|
||||
m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE;
|
||||
}
|
||||
}
|
||||
for (int32 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; ++i) {
|
||||
for (uint8 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; ++i) {
|
||||
tSound &sample = m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]];
|
||||
if (!sample.m_bIsProcessed && !sample.m_bLoopEnded && m_asAudioEntities[sample.m_nEntityIndex].m_bIsUsed && sample.m_nSampleIndex < NO_SAMPLE) {
|
||||
if (sample.m_nCounter > 255 && sample.m_nLoopCount && sample.m_nLoopsRemaining) {
|
||||
--sample.m_nLoopsRemaining;
|
||||
sample.m_nReleasingVolumeDivider = 1;
|
||||
} else {
|
||||
for (int32 j = 0; j < m_nActiveSamples; ++j) {
|
||||
for (uint8 j = 0; j < m_nActiveSamples; ++j) {
|
||||
if (!m_asActiveSamples[j].m_bIsProcessed) {
|
||||
if (sample.m_nLoopCount) {
|
||||
v28 = sample.m_nFrequency / m_nTimeSpent;
|
||||
|
@ -438,15 +438,15 @@ public:
|
||||
void SetEffectsFadeVolume(uint8 volume) const;
|
||||
void SetEffectsMasterVolume(uint8 volume) const;
|
||||
void SetEntityStatus(int32 id, uint8 status);
|
||||
uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(cAudioCollision *audioCollision);
|
||||
uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision);
|
||||
void SetMissionAudioLocation(float x, float y, float z);
|
||||
void SetMissionScriptPoliceAudio(int32 sfx) const;
|
||||
void SetMonoMode(uint8); // todo (mobile)
|
||||
void SetMusicFadeVolume(uint8 volume) const;
|
||||
void SetMusicMasterVolume(uint8 volume) const;
|
||||
void SetSpeakerConfig(int32 conf) const;
|
||||
void SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter);
|
||||
void SetUpOneShotCollisionSound(cAudioCollision *col);
|
||||
void SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter);
|
||||
void SetUpOneShotCollisionSound(const cAudioCollision &col);
|
||||
bool SetupCrimeReport();
|
||||
bool SetupJumboEngineSound(uint8 vol, int32 freq);
|
||||
bool SetupJumboFlySound(uint8 emittingVol);
|
||||
|
@ -326,8 +326,8 @@ int32
|
||||
CPhysical::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints)
|
||||
{
|
||||
int32 numSpheres = CCollision::ProcessColModels(
|
||||
GetMatrix(), *CModelInfo::GetModelInfo(GetModelIndex())->GetColModel(),
|
||||
ent->GetMatrix(), *CModelInfo::GetModelInfo(ent->GetModelIndex())->GetColModel(),
|
||||
GetMatrix(), *GetColModel(),
|
||||
ent->GetMatrix(), *ent->GetColModel(),
|
||||
colpoints,
|
||||
nil, nil); // No Lines allowed!
|
||||
if(numSpheres > 0){
|
||||
|
Loading…
Reference in New Issue
Block a user