summaryrefslogtreecommitdiffstats
path: root/src/audio/AudioLogic.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio/AudioLogic.cpp')
-rw-r--r--src/audio/AudioLogic.cpp213
1 files changed, 107 insertions, 106 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp
index 8f03d66a..01b33fa5 100644
--- a/src/audio/AudioLogic.cpp
+++ b/src/audio/AudioLogic.cpp
@@ -4201,109 +4201,109 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
switch (sound) {
case SOUND_STEP_START:
case SOUND_STEP_END:
- if (!params.m_pPed->bIsLooking) {
- emittingVol = m_anRandomTable[3] % 15 + 45;
- if (FindPlayerPed() != m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)
- emittingVol /= 2;
- maxDist = 400.f;
- switch (params.m_pPed->m_nSurfaceTouched) {
- case SURFACE_GRASS:
- sampleIndex = m_anRandomTable[1] % 5 + SFX_FOOTSTEP_GRASS_1;
- break;
- case SURFACE_GRAVEL:
- case SURFACE_MUD_DRY:
- sampleIndex = m_anRandomTable[4] % 5 + SFX_FOOTSTEP_GRAVEL_1;
- break;
- case SURFACE_CAR:
- case SURFACE_GARAGE_DOOR:
- case SURFACE_CAR_PANEL:
- case SURFACE_THICK_METAL_PLATE:
- case SURFACE_SCAFFOLD_POLE:
- case SURFACE_LAMP_POST:
- case SURFACE_FIRE_HYDRANT:
- case SURFACE_GIRDER:
- case SURFACE_METAL_CHAIN_FENCE:
- case SURFACE_CONTAINER:
- case SURFACE_NEWS_VENDOR:
- sampleIndex = m_anRandomTable[0] % 5 + SFX_FOOTSTEP_METAL_1;
- break;
- case SURFACE_SAND:
- sampleIndex = (m_anRandomTable[4] & 3) + SFX_FOOTSTEP_SAND_1;
- break;
- case SURFACE_WATER:
- sampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1;
- break;
- case SURFACE_WOOD_CRATES:
- case SURFACE_WOOD_BENCH:
- case SURFACE_WOOD_SOLID:
- sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_WOOD_1;
- break;
- case SURFACE_HEDGE:
- sampleIndex = m_anRandomTable[2] % 5 + SFX_COL_VEG_1;
- break;
- default:
- sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_CONCRETE_1;
- break;
- }
- m_sQueueSample.m_nSampleIndex = sampleIndex;
- m_sQueueSample.m_nBankIndex = SFX_BANK_0;
- m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] - 32;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 17);
- switch (params.m_pPed->m_nMoveState) {
- case PEDMOVE_WALK:
- emittingVol /= 4;
- m_sQueueSample.m_nFrequency = 9 * m_sQueueSample.m_nFrequency / 10;
- break;
- case PEDMOVE_RUN:
- emittingVol /= 2;
- m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10;
- break;
- case PEDMOVE_SPRINT:
- m_sQueueSample.m_nFrequency = 12 * m_sQueueSample.m_nFrequency / 10;
- break;
- default:
- break;
- }
- m_sQueueSample.m_nReleasingVolumeModificator = 5;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 20.0f;
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- m_sQueueSample.m_bRequireReflection = true;
+ if (params.m_pPed->bIsInTheAir)
+ continue;
+ emittingVol = m_anRandomTable[3] % 15 + 45;
+ if (FindPlayerPed() != m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)
+ emittingVol /= 2;
+ maxDist = 400.f;
+ switch (params.m_pPed->m_nSurfaceTouched) {
+ case SURFACE_GRASS:
+ sampleIndex = m_anRandomTable[1] % 5 + SFX_FOOTSTEP_GRASS_1;
+ break;
+ case SURFACE_GRAVEL:
+ case SURFACE_MUD_DRY:
+ sampleIndex = m_anRandomTable[4] % 5 + SFX_FOOTSTEP_GRAVEL_1;
+ break;
+ case SURFACE_CAR:
+ case SURFACE_GARAGE_DOOR:
+ case SURFACE_CAR_PANEL:
+ case SURFACE_THICK_METAL_PLATE:
+ case SURFACE_SCAFFOLD_POLE:
+ case SURFACE_LAMP_POST:
+ case SURFACE_FIRE_HYDRANT:
+ case SURFACE_GIRDER:
+ case SURFACE_METAL_CHAIN_FENCE:
+ case SURFACE_CONTAINER:
+ case SURFACE_NEWS_VENDOR:
+ sampleIndex = m_anRandomTable[0] % 5 + SFX_FOOTSTEP_METAL_1;
+ break;
+ case SURFACE_SAND:
+ sampleIndex = (m_anRandomTable[4] & 3) + SFX_FOOTSTEP_SAND_1;
+ break;
+ case SURFACE_WATER:
+ sampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1;
+ break;
+ case SURFACE_WOOD_CRATES:
+ case SURFACE_WOOD_BENCH:
+ case SURFACE_WOOD_SOLID:
+ sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_WOOD_1;
+ break;
+ case SURFACE_HEDGE:
+ sampleIndex = m_anRandomTable[2] % 5 + SFX_COL_VEG_1;
+ break;
+ default:
+ sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_CONCRETE_1;
+ break;
+ }
+ m_sQueueSample.m_nSampleIndex = sampleIndex;
+ m_sQueueSample.m_nBankIndex = SFX_BANK_0;
+ m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] - SOUND_STEP_START + 1;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 17);
+ switch (params.m_pPed->m_nMoveState) {
+ case PEDMOVE_WALK:
+ emittingVol /= 4;
+ m_sQueueSample.m_nFrequency = 9 * m_sQueueSample.m_nFrequency / 10;
+ break;
+ case PEDMOVE_RUN:
+ emittingVol /= 2;
+ m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10;
+ break;
+ case PEDMOVE_SPRINT:
+ m_sQueueSample.m_nFrequency = 12 * m_sQueueSample.m_nFrequency / 10;
+ break;
+ default:
+ break;
}
+ m_sQueueSample.m_nReleasingVolumeModificator = 5;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 20.0f;
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_bRequireReflection = true;
break;
case SOUND_FALL_LAND:
case SOUND_FALL_COLLAPSE:
- if (!ped->bIsLooking) {
- maxDist = SQR(30);
- emittingVol = m_anRandomTable[3] % 20 + 80;
- if (ped->m_nSurfaceTouched == SURFACE_WATER) {
- m_sQueueSample.m_nSampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1;
- } else if (sound == SOUND_FALL_LAND) {
- m_sQueueSample.m_nSampleIndex = SFX_BODY_LAND;
- } else {
- m_sQueueSample.m_nSampleIndex = SFX_BODY_LAND_AND_FALL;
- }
- m_sQueueSample.m_nBankIndex = SFX_BANK_0;
- m_sQueueSample.m_nCounter = 1;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 17);
- m_sQueueSample.m_nReleasingVolumeModificator = 2;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- m_sQueueSample.m_bRequireReflection = true;
+ if (ped->bIsInTheAir)
+ continue;
+ maxDist = SQR(30);
+ emittingVol = m_anRandomTable[3] % 20 + 80;
+ if (ped->m_nSurfaceTouched == SURFACE_WATER) {
+ m_sQueueSample.m_nSampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1;
+ } else if (sound == SOUND_FALL_LAND) {
+ m_sQueueSample.m_nSampleIndex = SFX_BODY_LAND;
+ } else {
+ m_sQueueSample.m_nSampleIndex = SFX_BODY_LAND_AND_FALL;
}
+ m_sQueueSample.m_nBankIndex = SFX_BANK_0;
+ m_sQueueSample.m_nCounter = 1;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 17);
+ m_sQueueSample.m_nReleasingVolumeModificator = 2;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 30.0f;
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_bRequireReflection = true;
break;
case SOUND_FIGHT_37:
m_sQueueSample.m_nSampleIndex = SFX_FIGHT_1;
@@ -4342,6 +4342,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nFrequency = 20000;
goto AddFightSound;
case SOUND_FIGHT_46:
+ case SOUND_187:
m_sQueueSample.m_nSampleIndex = SFX_FIGHT_5;
m_sQueueSample.m_nFrequency = 18000;
goto AddFightSound;
@@ -4354,7 +4355,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nFrequency = 20000;
AddFightSound:
{
- uint32 soundParams = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]; // wtf? stroring int as float
+ uint32 soundParams = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]; // wtf? storing int as float
uint8 damagerType = soundParams & 0xFF;
uint32 weaponType = soundParams >> 8;
@@ -4402,7 +4403,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
case SOUND_WEAPON_BAT_ATTACK:
case SOUND_WEAPON_KNIFE_ATTACK:
{
- uint32 soundParams = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]; // wtf? stroring int as float
+ uint32 soundParams = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]; // wtf? storing int as float
uint8 damagerType = soundParams & 0xFF;
uint32 weaponType = soundParams >> 8;
if (damagerType == ENTITY_TYPE_PED) {
@@ -4461,7 +4462,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
continue;
m_sQueueSample.m_nSampleIndex = SFX_CAR_ACCEL_13;
m_sQueueSample.m_nBankIndex = SFX_BANK_0; // SFX_BANK_CAR_CHAINSAW
- m_sQueueSample.m_nCounter = 64;
+ m_sQueueSample.m_nCounter = 70;
m_sQueueSample.m_nFrequency = 27000;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 3.0f;
@@ -4473,7 +4474,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_CAR_ACCEL_13);
m_sQueueSample.m_nEmittingVolume = 100;
m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_bReverbFlag = false;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
break;
case SOUND_WEAPON_CHAINSAW_IDLE:
@@ -5159,7 +5160,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nReleasingVolumeDivider = 3;
}
}
- break;
+ continue;
default:
SetupPedComments(params, sound);
continue;
@@ -9922,7 +9923,7 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
nCheckPlayingDelay[slot] = 0;
nFramesUntilFailedLoad[slot] = 0;
} else if (!m_nUserPause) {
- if (++nFramesForPretendPlaying[slot] < 120) {
+ if (++nFramesForPretendPlaying[slot] < 90) {
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_PLAYING;
} else {
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_FINISHED;
@@ -9938,7 +9939,7 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
} else {
if (m_nUserPause)
SampleManager.PauseStream(1, slot + 1);
- if (m_sMissionAudio.m_bPredefinedProperties) {
+ if (m_sMissionAudio.m_bPredefinedProperties[slot]) {
if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAL)
SampleManager.SetStreamedVolumeAndPan(80, 0, 1, slot + 1);
else if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAR)
@@ -9992,7 +9993,7 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
else
{
SampleManager.PauseStream(0, slot + 1);
- if (!m_sMissionAudio.m_bPredefinedProperties) {
+ if (!m_sMissionAudio.m_bPredefinedProperties[slot]) {
distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos[slot]);
if (distSquared >= SQR(80.0f)) {
emittingVol = 0;