diff options
Diffstat (limited to '')
-rw-r--r-- | src/audio/AudioManager.cpp | 1079 | ||||
-rw-r--r-- | src/audio/AudioManager.h | 132 | ||||
-rw-r--r-- | src/audio/MusicManager.cpp | 14 | ||||
-rw-r--r-- | src/audio/MusicManager.h | 3 |
4 files changed, 1125 insertions, 103 deletions
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 5b42dbd8..4dbdf433 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -11,6 +11,7 @@ #include "MusicManager.h" #include "Ped.h" #include "Physical.h" +#include "Plane.h" #include "PlayerPed.h" #include "SampleManager.h" #include "Stats.h" @@ -194,6 +195,7 @@ cAudioManager::AddReflectionsToRequestedQueue() } } } + #if 1 WRAPPER void cAudioManager::AddReleasingSounds() @@ -456,18 +458,9 @@ cAudioManager::CreateEntity(int32 type, CPhysical *entity) return -3; } -#if 1 -WRAPPER void cAudioManager::DestroyAllGameCreatedEntities() { - EAXJMP(0x57A830); -} -#else -void -cAudioManager::DestroyAllGameCreatedEntities() -{ - cAudioManager *v1; cAudioScriptObject *entity; if(m_bIsInitialised) { @@ -481,13 +474,10 @@ cAudioManager::DestroyAllGameCreatedEntities() case AUDIOTYPE_GARAGE: case AUDIOTYPE_HYDRANT: cAudioManager::DestroyEntity(i); break; case AUDIOTYPE_ONE_SHOT: - entity = m_asAudioEntities[i].m_pEntity; - if(entity) { - cAudioScriptObject::~cAudioScriptObject( - m_asAudioEntities[i].m_pEntity); - cAudioScriptObject::operator delete(entity); - } - cAudioManager::DestroyEntity(i); + entity = + (cAudioScriptObject *)m_asAudioEntities[i].m_pEntity; + if(entity) { delete entity; } + DestroyEntity(i); break; default: break; } @@ -496,7 +486,6 @@ cAudioManager::DestroyAllGameCreatedEntities() m_nScriptObjectEntityTotal = 0; } } -#endif void cAudioManager::DestroyEntity(int32 id) @@ -1011,6 +1000,15 @@ cAudioManager::GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint *prevPhrase = *phrase; } +uint8 &jumboVolOffset = *(uint8 *)0x6508ED; + +void +cAudioManager::DoJumboVolOffset() +{ + if(!(m_nTimeOfRecentCrime % (m_anRandomTable[0] % 6u + 3))) + jumboVolOffset = m_anRandomTable[1] % 60u; +} + uint32 cAudioManager::GetPlayerTalkSfx(int16 sound) { @@ -3457,13 +3455,6 @@ cAudioManager::ProcessActiveQueues() } #endif -#if 1 -bool -cAudioManager::ProcessAirBrakes(cVehicleParams *params) -{ - EAXJMP(0x56C940); -} -#else bool cAudioManager::ProcessAirBrakes(cVehicleParams *params) { @@ -3505,7 +3496,6 @@ cAudioManager::ProcessAirBrakes(cVehicleParams *params) return 1; } -#endif void cAudioManager::ProcessAirportScriptObject(uint8 sound) @@ -3547,7 +3537,7 @@ cAudioManager::ProcessAirportScriptObject(uint8 sound) m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.field_56 = 1; m_sQueueSample.field_16 = 3; - m_sQueueSample.field_48 = 2.0; + m_sQueueSample.field_48 = 2.0f; m_sQueueSample.m_bEmittingVolume = 110; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; @@ -3560,7 +3550,6 @@ cAudioManager::ProcessAirportScriptObject(uint8 sound) } } -WRAPPER bool cAudioManager::ProcessBoatEngine(cVehicleParams *params) { @@ -3599,7 +3588,7 @@ cAudioManager::ProcessBridgeMotor() cSampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = cSampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.field_48 = 2.0; + m_sQueueSample.field_48 = 2.0f; m_sQueueSample.m_fSoundIntensity = 400.0f; m_sQueueSample.field_56 = 0; m_sQueueSample.field_76 = 3; @@ -3700,7 +3689,7 @@ cAudioManager::ProcessCinemaScriptObject(uint8 sound) m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.field_56 = 1; m_sQueueSample.field_16 = 3; - m_sQueueSample.field_48 = 2.0; + m_sQueueSample.field_48 = 2.0f; m_sQueueSample.m_bEmittingVolume = rand; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; @@ -3761,7 +3750,7 @@ cAudioManager::ProcessDocksScriptObject(uint8 sound) m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.field_56 = 1; m_sQueueSample.field_16 = 3; - m_sQueueSample.field_48 = 2.0; + m_sQueueSample.field_48 = 2.0f; m_sQueueSample.m_bEmittingVolume = rand; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; @@ -3866,7 +3855,7 @@ cAudioManager::ProcessFireHydrant() bool something = false; m_sQueueSample.m_vecPos = - *(CVector *)(m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity + 52); + *(CVector *)((size_t)m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity + 52); distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); if(distSquared < 1225.f) { CalculateDistance(&something, distSquared); @@ -3884,8 +3873,8 @@ cAudioManager::ProcessFireHydrant() cSampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = cSampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.field_48 = 2.0; - m_sQueueSample.m_fSoundIntensity = 35.0; + m_sQueueSample.field_48 = 2.0f; + m_sQueueSample.m_fSoundIntensity = 35.0f; m_sQueueSample.field_56 = 0; m_sQueueSample.field_76 = 3; m_sQueueSample.m_bReverbFlag = 1; @@ -4068,6 +4057,110 @@ cAudioManager::ProcessGarages() void cAudioManager::ProcessHomeScriptObject(uint8 sound) { + uint32 time; + uint8 rand; + float dist; + float maxDist; + + static uint8 counter = 0; + + time = CTimer::GetTimeInMilliseconds(); + if(time > audioLogicTimers[6]) { + switch(sound) { + case SCRIPT_SOUND_HOME_LOOP_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + break; + case SCRIPT_SOUND_HOME_LOOP_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + break; + default: break; + } + dist = GetDistanceSquared(&m_sQueueSample.m_vecPos); + if(dist < maxDist) { + m_sQueueSample.m_fDistance = sqrt(dist); + rand = m_anRandomTable[0] % 30u + 40; + m_sQueueSample.m_bVolume = ComputeVolume( + rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if(m_sQueueSample.m_bVolume) { + m_sQueueSample.m_nSampleIndex = + m_anRandomTable[0] % 5u + AUDIO_SAMPLE_HOME_1; + m_sQueueSample.m_bBankIndex = 0; + m_sQueueSample.m_nFrequency = cSampleManager.GetSampleBaseFrequency( + m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency += + RandomDisplacement(m_sQueueSample.m_nFrequency >> 4); + m_sQueueSample.field_4 = counter++; + m_sQueueSample.m_bIsDistant = 0; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.field_56 = 1; + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_48 = 0.0f; + m_sQueueSample.m_bEmittingVolume = rand; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_bReverbFlag = 1; + m_sQueueSample.m_bRequireReflection = 1; + AddSampleToRequestedQueue(); + audioLogicTimers[6] = time + 1000 + m_anRandomTable[3] % 4000u; + } + } + } +} + +float *PlanePathPosition = (float *)0x8F5FC8; +float &LandingPoint = *(float *)0x8F2C7C; +float &TakeOffPoint = *(float *)0x8E28A4; + +void +cAudioManager::ProcessJumbo(cVehicleParams *params) +{ + CPlane *plane; + float position; + + if(params->m_fDistance < 193600.0f) { + CalculateDistance((bool *)params, params->m_fDistance); + plane = (CPlane *)params->m_pVehicle; + DoJumboVolOffset(); + position = PlanePathPosition[plane->m_wIndex]; + if(position <= TakeOffPoint) { + if(plane->field_656 <= 0.10334f) { + ProcessJumboTaxi(); + return; + } + + ProcessJumboAccel(plane); + } else if(300.0f + TakeOffPoint >= position) { + ProcessJumboTakeOff(plane); + } else if(LandingPoint - 350.0f >= position) { + ProcessJumboFlying(); + } else { + if(position > LandingPoint) { + if(plane->field_656 > 0.10334f) { + ProcessJumboDecel(plane); + return; + } + ProcessJumboTaxi(); + return; + } + ProcessJumboLanding(plane); + } + } +} + +WRAPPER +void +cAudioManager::ProcessJumboAccel(CPlane *) +{ + EAXJMP(0x56EA40); +} + +WRAPPER +void +cAudioManager::ProcessJumboDecel(CPlane *) +{ + EAXJMP(0x56EE40); } void @@ -4076,6 +4169,20 @@ cAudioManager::ProcessJumboFlying() if(SetupJumboFlySound(127u)) SetupJumboEngineSound(63u, 22050); } +WRAPPER +void +cAudioManager::ProcessJumboLanding(CPlane *) +{ + EAXJMP(0x56ED10); +} + +WRAPPER +void +cAudioManager::ProcessJumboTakeOff(CPlane *) +{ + EAXJMP(0x56EC00); +} + void cAudioManager::ProcessJumboTaxi() { @@ -4084,6 +4191,771 @@ cAudioManager::ProcessJumboTaxi() } } +void +cAudioManager::ProcessLaunderetteScriptObject(uint8 sound) +{ + float maxDist; + float distSquared; + + switch(sound) { + case SCRIPT_SOUND_LAUNDERETTE_LOOP_S: + case SCRIPT_SOUND_LAUNDERETTE_LOOP_L: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + break; + default: break; + } + distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + if(distSquared < maxDist) { + m_sQueueSample.m_fDistance = sqrt(distSquared); + m_sQueueSample.m_bVolume = ComputeVolume(45u, m_sQueueSample.m_fSoundIntensity, + m_sQueueSample.m_fDistance); + if(m_sQueueSample.m_bVolume) { + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_LAUNDERETTE_1; + m_sQueueSample.m_bBankIndex = 0; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_LAUNDERETTE_1); + m_sQueueSample.field_4 = 0; + m_sQueueSample.m_bIsDistant = 0; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.field_56 = 0; + m_sQueueSample.field_16 = 5; + m_sQueueSample.field_48 = 2.0f; + m_sQueueSample.m_bEmittingVolume = 45; + m_sQueueSample.m_nLoopStart = + cSampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = + cSampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_bReverbFlag = 1; + m_sQueueSample.m_bRequireReflection = 0; + AddSampleToRequestedQueue(); + } + m_sQueueSample.m_bVolume = ComputeVolume(110u, m_sQueueSample.m_fSoundIntensity, + m_sQueueSample.m_fDistance); + if(m_sQueueSample.m_bVolume) { + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_LAUNDERETTE_2; + m_sQueueSample.m_bBankIndex = 0; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_LAUNDERETTE_2); + m_sQueueSample.field_4 = 1; + m_sQueueSample.m_bIsDistant = 0; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.field_56 = 0; + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_48 = 2.0f; + m_sQueueSample.m_bEmittingVolume = 110; + m_sQueueSample.m_nLoopStart = + cSampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = + cSampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_bReverbFlag = 1; + m_sQueueSample.m_bRequireReflection = 0; + AddSampleToRequestedQueue(); + } + } +} + +void +cAudioManager::ProcessLoopingScriptObject(uint8 sound) +{ + uint8 emittingVolume; + float maxDist; + float distSquared; + + switch(sound) { + case SCRIPT_SOUND_PARTY_1_LOOP_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_1; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_1); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_1_LOOP_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_1; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_1); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_2_LOOP_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_2; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_2); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_2_LOOP_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_2; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_2); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_3_LOOP_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_3; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_3); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_3_LOOP_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_3; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_3); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_4_LOOP_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_4; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_4); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_4_LOOP_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_4; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_4); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_5_LOOP_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_5; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_5); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_5_LOOP_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_5; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_5); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_6_LOOP_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_6; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_6); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_6_LOOP_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_6; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_6); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_7_LOOP_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_7; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_7); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_7_LOOP_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_7; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_7); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_8_LOOP_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_8; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_8); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_8_LOOP_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_8; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_8); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_9_LOOP_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_9; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_9); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_9_LOOP_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_9; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_9); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_10_LOOP_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_10; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_10); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_10_LOOP_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_10; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_10); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_11_LOOP_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_11; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_11); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_11_LOOP_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_11; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_11); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_12_LOOP_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_12; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_12); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_12_LOOP_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_12; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_12); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_13_LOOP_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_13; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_13); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_13_LOOP_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_13; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_13); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_STRIP_CLUB_LOOP_1_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_STRIP_CLUB_1; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_STRIP_CLUB_1); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_STRIP_CLUB_LOOP_1_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_STRIP_CLUB_1; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_STRIP_CLUB_1); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_STRIP_CLUB_LOOP_2_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_STRIP_CLUB_2; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_STRIP_CLUB_2); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_STRIP_CLUB_LOOP_2_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_STRIP_CLUB_2; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_STRIP_CLUB_2); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_WORK_SHOP_LOOP_S: + case SCRIPT_SOUND_WORK_SHOP_LOOP_L: + cAudioManager::ProcessWorkShopScriptObject(sound); + return; + case SCRIPT_SOUND_SAWMILL_LOOP_S: + case SCRIPT_SOUND_SAWMILL_LOOP_L: cAudioManager::ProcessSawMillScriptObject(sound); return; + case SCRIPT_SOUND_38: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_409; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 110; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_409); + m_sQueueSample.field_16 = 6; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_39: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_409; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 110; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_409); + m_sQueueSample.field_16 = 6; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_LAUNDERETTE_LOOP_S: + case SCRIPT_SOUND_LAUNDERETTE_LOOP_L: ProcessLaunderetteScriptObject(sound); return; + case SCRIPT_SOUND_CHINATOWN_RESTAURANT_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_CHINATOWN_RESTAURANT; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 110; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_CHINATOWN_RESTAURANT); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_CHINATOWN_RESTAURANT_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_CHINATOWN_RESTAURANT; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 110; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_CHINATOWN_RESTAURANT); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_CIPRIANI_RESAURANT_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_CIPRIANI_RESTAURANT; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 110; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_CIPRIANI_RESTAURANT); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_CIPRIANI_RESAURANT_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_CIPRIANI_RESTAURANT; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 110; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_CIPRIANI_RESTAURANT); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_46: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_414; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 110; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_414); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_47: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_414; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 110; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_414); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_MARCO_BISTRO_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_MARCO_BISTRO; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 110; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_MARCO_BISTRO); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_MARCO_BISTRO_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_MARCO_BISTRO; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 110; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_MARCO_BISTRO); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_AIRPORT_LOOP_S: + case SCRIPT_SOUND_AIRPORT_LOOP_L: ProcessAirportScriptObject(sound); return; + case SCRIPT_SOUND_SHOP_LOOP_S: + case SCRIPT_SOUND_SHOP_LOOP_L: ProcessShopScriptObject(sound); return; + case SCRIPT_SOUND_CINEMA_LOOP_S: + case SCRIPT_SOUND_CINEMA_LOOP_L: ProcessCinemaScriptObject(sound); return; + case SCRIPT_SOUND_DOCKS_LOOP_S: + case SCRIPT_SOUND_DOCKS_LOOP_L: cAudioManager::ProcessDocksScriptObject(sound); return; + case SCRIPT_SOUND_HOME_LOOP_S: + case SCRIPT_SOUND_HOME_LOOP_L: cAudioManager::ProcessHomeScriptObject(sound); return; + case SCRIPT_SOUND_FRANKIE_PIANO: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_FRANKIE_PIANO; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_FRANKIE_PIANO); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PARTY_1_LOOP: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_PARTY_1; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_1); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PORN_CINEMA_1_S: + case SCRIPT_SOUND_PORN_CINEMA_1_L: + case SCRIPT_SOUND_PORN_CINEMA_2_S: + case SCRIPT_SOUND_PORN_CINEMA_2_L: + case SCRIPT_SOUND_PORN_CINEMA_3_S: + case SCRIPT_SOUND_PORN_CINEMA_3_L: + case SCRIPT_SOUND_MISTY_SEX_S: + case SCRIPT_SOUND_MISTY_SEX_L: ProcessPornCinema(sound); return; + case SCRIPT_SOUND_BANK_ALARM_LOOP_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_BANK_ALARM; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 90; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_BANK_ALARM); + m_sQueueSample.field_16 = 2; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_BANK_ALARM_LOOP_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_BANK_ALARM; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 90; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_BANK_ALARM); + m_sQueueSample.field_16 = 2; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_POLICE_BALL_LOOP_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_POLICE_BALL; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_POLICE_BALL); + m_sQueueSample.field_16 = 2; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_POLICE_BALL_LOOP_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_POLICE_BALL; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_POLICE_BALL); + m_sQueueSample.field_16 = 2; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_RAVE_INDUSTRIAL; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_RAVE_INDUSTRIAL); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_RAVE_INDUSTRIAL; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_RAVE_INDUSTRIAL); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_S: + case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L: + cAudioManager::ProcessPoliceCellBeatingScriptObject(sound); + return; + case SCRIPT_SOUND_RAVE_1_LOOP_S: + case SCRIPT_SOUND_RAVE_2_LOOP_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_RAVE_1; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_RAVE_1_LOOP_L: + case SCRIPT_SOUND_RAVE_2_LOOP_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_RAVE_1; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_RAVE_3_LOOP_S: + maxDist = 900.f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_RAVE_2; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_RAVE_2); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_RAVE_3_LOOP_L: + maxDist = 6400.f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_RAVE_2; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 127; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_RAVE_2); + m_sQueueSample.field_16 = 3; + m_sQueueSample.field_76 = 3; + m_sQueueSample.field_48 = 2.0f; + break; + case SCRIPT_SOUND_PRETEND_FIRE_LOOP: + maxDist = 2500.f; + m_sQueueSample.m_fSoundIntensity = 50.0f; + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_FIRE_ENTITY; + m_sQueueSample.m_bBankIndex = 0; + emittingVolume = 80; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_FIRE_ENTITY); + m_sQueueSample.field_16 = 8; + m_sQueueSample.field_76 = 10; + m_sQueueSample.field_48 = 2.0f; + break; + default: return; + } + + distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + if(distSquared < maxDist) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); + m_sQueueSample.m_bVolume = ComputeVolume( + emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if(m_sQueueSample.m_bVolume) { + m_sQueueSample.field_4 = 0; + m_sQueueSample.m_bIsDistant = 0; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.field_56 = 0; + m_sQueueSample.m_bReverbFlag = 1; + m_sQueueSample.m_bEmittingVolume = emittingVolume; + m_sQueueSample.m_nLoopStart = + cSampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = + cSampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_bRequireReflection = 0; + AddSampleToRequestedQueue(); + } + } +} + WRAPPER void cAudioManager::ProcessPed(CPhysical *) @@ -4094,11 +4966,15 @@ cAudioManager::ProcessPed(CPhysical *) void cAudioManager::ProcessPhysical(int32 id) { - CPhysical *entity = m_asAudioEntities[id].m_pEntity; + CPhysical *entity = (CPhysical *)m_asAudioEntities[id].m_pEntity; if(entity) { switch(entity->m_type & 7) { - case ENTITY_TYPE_VEHICLE: ProcessVehicle(m_asAudioEntities[id].m_pEntity); break; - case ENTITY_TYPE_PED: ProcessPed(m_asAudioEntities[id].m_pEntity); break; + case ENTITY_TYPE_VEHICLE: + ProcessVehicle((CVehicle *)m_asAudioEntities[id].m_pEntity); + break; + case ENTITY_TYPE_PED: + ProcessPed((CPhysical *)m_asAudioEntities[id].m_pEntity); + break; default: return; } } @@ -4113,6 +4989,20 @@ cAudioManager::ProcessPlane(void *ptr) WRAPPER void +cAudioManager::ProcessPoliceCellBeatingScriptObject(uint8 sound) +{ + EAXJMP(0x578190); +} + +WRAPPER +void +cAudioManager::ProcessPornCinema(uint8 sound) +{ + EAXJMP(0x577280); +} + +WRAPPER +void cAudioManager::ProcessProjectiles() { EAXJMP(0x578A80); @@ -4120,6 +5010,13 @@ cAudioManager::ProcessProjectiles() WRAPPER void +cAudioManager::ProcessSawMillScriptObject(uint8 sound) +{ + EAXJMP(0x577630); +} + +WRAPPER +void cAudioManager::ProcessScriptObject(int32 id) { EAXJMP(0x576070); @@ -4127,10 +5024,52 @@ cAudioManager::ProcessScriptObject(int32 id) WRAPPER void -cAudioManager::ProcessVehicle(void *) +cAudioManager::ProcessShopScriptObject(uint8 sound) +{ + EAXJMP(0x577970); +} + +void +cAudioManager::ProcessSpecial() +{ + CPlayerPed *playerPed; + ePedState state; + + if(m_bUserPause) { + if(!m_bPreviousUserPause) { + MusicManager.ChangeMusicMode(0); + cSampleManager.SetEffectsFadeVol(maxVolume); + cSampleManager.SetMusicFadeVol(maxVolume); + } + } else { + if(m_bPreviousUserPause) { + MusicManager.StopFrontEndTrack(); + MusicManager.ChangeMusicMode(1u); + } + playerPed = FindPlayerPed(); + if(playerPed) { + state = playerPed->m_nPedState; + if(state != PED_ENTER_CAR && state != PED_STEAL_CAR && + !playerPed->bInVehicle) + cSampleManager.StopChannel(m_bActiveSamples); + } + } +} + +#if 1 +WRAPPER +void +cAudioManager::ProcessVehicle(CVehicle *) { EAXJMP(0x569A00); } +#else +void +cAudioManager::ProcessVehicle(CVehicle *) +{ + EAXJMP(0x569A00); +} +#endif WRAPPER void cAudioManager::ProcessWaterCannon(int32) { EAXJMP(0x575F30); } @@ -4142,6 +5081,48 @@ cAudioManager::ProcessWeather(int32 id) EAXJMP(0x578370); } +void +cAudioManager::ProcessWorkShopScriptObject(uint8 sound) +{ + float distSquared; + float maxDist; + + switch(sound) { + case SCRIPT_SOUND_WORK_SHOP_LOOP_S: + case SCRIPT_SOUND_WORK_SHOP_LOOP_L: + maxDist = 400.f; + this->m_sQueueSample.m_fSoundIntensity = 20.0; + break; + default: break; + } + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); + if(distSquared < maxDist) { + m_sQueueSample.m_fDistance = sqrt(distSquared); + m_sQueueSample.m_bVolume = ComputeVolume(30u, m_sQueueSample.m_fSoundIntensity, + m_sQueueSample.m_fDistance); + if(m_sQueueSample.m_bVolume) { + m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_WORK_SHOP; + m_sQueueSample.m_bBankIndex = 0; + m_sQueueSample.m_nFrequency = + cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_WORK_SHOP); + m_sQueueSample.field_4 = 0; + m_sQueueSample.m_bIsDistant = 0; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.field_56 = 0; + m_sQueueSample.field_16 = 5; + m_sQueueSample.field_48 = 2.0; + m_sQueueSample.m_bEmittingVolume = 30; + m_sQueueSample.m_nLoopStart = + cSampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = + cSampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_bReverbFlag = 1; + m_sQueueSample.m_bRequireReflection = 0; + AddSampleToRequestedQueue(); + } + } +} + WRAPPER void cAudioManager::Service() { @@ -4163,6 +5144,15 @@ InjectHook(0x5796A0, &cAudioManager::ClearMissionAudio, PATCH_JUMP); InjectHook(0x57C120, &cAudioManager::ClearRequestedQueue, PATCH_JUMP); InjectHook(0x57AE00, &cAudioManager::ComputeDopplerEffectedFrequency, PATCH_JUMP); InjectHook(0x57ABB0, &cAudioManager::ComputeVolume, PATCH_JUMP); +InjectHook(0x57A310, &cAudioManager::CreateEntity, PATCH_JUMP); + +InjectHook(0x57A830, &cAudioManager::DestroyAllGameCreatedEntities, PATCH_JUMP); +InjectHook(0x57A400, &cAudioManager::DestroyEntity, PATCH_JUMP); +InjectHook(0x57F060, &cAudioManager::DoPoliceRadioCrackle, PATCH_JUMP); + +InjectHook(0x57C290, &cAudioManager::GenerateIntegerRandomNumberTable, PATCH_JUMP); +InjectHook(0x569750, &cAudioManager::GetDistanceSquared, PATCH_JUMP); +InjectHook(0x57AC60, &cAudioManager::TranslateEntity, PATCH_JUMP); InjectHook(0x57A0E0, &cAudioManager::Initialise, PATCH_JUMP); InjectHook(0x569420, &cAudioManager::PostInitialiseGameSpecificSetup, PATCH_JUMP); @@ -4209,7 +5199,6 @@ InjectHook(0x56CAB0, &cAudioManager::HasAirBrakes, PATCH_JUMP); InjectHook(0x56F410, &cAudioManager::GetJumboTaxiFreq, PATCH_JUMP); InjectHook(0x579650, &cAudioManager::IsMissionAudioSampleFinished, PATCH_JUMP); -// done InjectHook(0x57AF90, &cAudioManager::RandomDisplacement, PATCH_JUMP); InjectHook(0x57A9E0, &cAudioManager::ReleaseDigitalHandle, PATCH_JUMP); @@ -4218,15 +5207,11 @@ InjectHook(0x57AA00, &cAudioManager::SetDynamicAcousticModelingStatus, PATCH_JUM InjectHook(0x57AA50, &cAudioManager::IsAudioInitialised, PATCH_JUMP); -InjectHook(0x57A310, &cAudioManager::CreateEntity, PATCH_JUMP); -InjectHook(0x57A400, &cAudioManager::DestroyEntity, PATCH_JUMP); InjectHook(0x57A4C0, &cAudioManager::SetEntityStatus, PATCH_JUMP); InjectHook(0x569570, &cAudioManager::PreTerminateGameSpecificShutdown, PATCH_JUMP); InjectHook(0x569640, &cAudioManager::PostTerminateGameSpecificShutdown, PATCH_JUMP); -InjectHook(0x57C290, &cAudioManager::GenerateIntegerRandomNumberTable, PATCH_JUMP); - InjectHook(0x56AD10, &cAudioManager::PlayerJustGotInCar, PATCH_JUMP); InjectHook(0x56AD20, &cAudioManager::PlayerJustLeftCar, PATCH_JUMP); InjectHook(0x570DB0, &cAudioManager::GetPhrase, PATCH_JUMP); @@ -4310,6 +5295,7 @@ InjectHook(0x575510, &cAudioManager::GetGenericFemaleTalkSfx, PATCH_JUMP); // Process stuff // InjectHook(0x57BA60, &cAudioManager::ProcessActiveQueues, PATCH_JUMP); +InjectHook(0x56C940, &cAudioManager::ProcessAirBrakes, PATCH_JUMP); InjectHook(0x577B30, &cAudioManager::ProcessAirportScriptObject, PATCH_JUMP); InjectHook(0x579250, &cAudioManager::ProcessBridgeMotor, PATCH_JUMP); InjectHook(0x579170, &cAudioManager::ProcessBridgeWarning, PATCH_JUMP); @@ -4318,8 +5304,15 @@ InjectHook(0x577E50, &cAudioManager::ProcessDocksScriptObject, PATCH_JUMP); InjectHook(0x569870, &cAudioManager::ProcessEntity, PATCH_JUMP); InjectHook(0x578FD0, &cAudioManager::ProcessFireHydrant, PATCH_JUMP); InjectHook(0x5785E0, &cAudioManager::ProcessFrontEnd, PATCH_JUMP); +InjectHook(0x577FE0, &cAudioManager::ProcessHomeScriptObject, PATCH_JUMP); +InjectHook(0x56E8F0, &cAudioManager::ProcessJumbo, PATCH_JUMP); + InjectHook(0x56ECF0, &cAudioManager::ProcessJumboFlying, PATCH_JUMP); InjectHook(0x56EA10, &cAudioManager::ProcessJumboTaxi, PATCH_JUMP); -InjectHook(0x5699C0, &cAudioManager::ProcessPhysical, PATCH_JUMP); +InjectHook(0x5777E0, &cAudioManager::ProcessLaunderetteScriptObject, PATCH_JUMP); +InjectHook(0x576770, &cAudioManager::ProcessLoopingScriptObject, PATCH_JUMP); +InjectHook(0x5699C0, &cAudioManager::ProcessPhysical, PATCH_JUMP); +InjectHook(0x5697D0, &cAudioManager::ProcessPhysical, PATCH_JUMP); +InjectHook(0x577530, &cAudioManager::ProcessWorkShopScriptObject, PATCH_JUMP); ENDPATCHES diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 4c02d07f..0c26fa0e 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -77,7 +77,7 @@ class tAudioEntity { public: eAudioType m_nType; - CPhysical *m_pEntity; + void *m_pEntity; bool m_bIsUsed; uint8 m_bStatus; int16 m_awAudioEvent[4]; @@ -166,9 +166,20 @@ public: uint8 field_31; }; +static_assert(sizeof(cMissionAudio) == 0x20, "cMissionAudio: error"); + class cVehicleParams; +class CPlane; +class CVehicle; -static_assert(sizeof(cMissionAudio) == 0x20, "cMissionAudio: error"); +struct cAudioScriptObject { + int16 m_wSound; + char gap_2[2]; + CVector m_vecPos; + int m_nAudioEntityId; +}; + +static_assert(sizeof(cAudioScriptObject) == 0x14, "cAudioScriptObject: error"); class cAudioManager { @@ -219,36 +230,36 @@ public: uint8 field_19195; int32 m_nTimeOfRecentCrime; - void AddDetailsToRequestedOrderList(uint8 sample); + void AddDetailsToRequestedOrderList(uint8 sample); /// ok void AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 unk1, - uint8 unk2, bool notLooping); - void AddReflectionsToRequestedQueue(); - void AddReleasingSounds(); // todo - void AddSampleToRequestedQueue(); - void AgeCrimes(); // todo - int8 AutoDetect3DProviders(); - - void CalculateDistance(bool *ptr, float dist); - bool CheckForAnAudioFileOnCD(); - void ClearMissionAudio(); - void ClearRequestedQueue(); + uint8 unk2, bool notLooping); /// ok + void AddReflectionsToRequestedQueue(); /// ok (check value) + void AddReleasingSounds(); // todo (difficult) + void AddSampleToRequestedQueue(); /// ok + void AgeCrimes(); // todo + int8 AutoDetect3DProviders(); /// ok + + void CalculateDistance(bool *ptr, float dist); /// ok + bool CheckForAnAudioFileOnCD(); /// ok + void ClearMissionAudio(); /// ok + void ClearRequestedQueue(); /// ok int32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2, - float speedMultiplier); - int32 ComputePan(float, CVector *); // todo - uint32 ComputeVolume(int emittingVolume, float soundIntensity, float distance); - int32 CreateEntity(int32 type, CPhysical *entity); + float speedMultiplier); /// ok + int32 ComputePan(float, CVector *); // todo + uint32 ComputeVolume(int emittingVolume, float soundIntensity, float distance); /// ok + int32 CreateEntity(int32 type, CPhysical *entity); /// ok - void DestroyAllGameCreatedEntities(); // todo, needs cAudioScriptObject - void DestroyEntity(int32 id); - void DoPoliceRadioCrackle(); // todo hook + void DestroyAllGameCreatedEntities(); /// ok + void DestroyEntity(int32 id); /// ok + void DoPoliceRadioCrackle(); /// ok - void GenerateIntegerRandomNumberTable(); + void GenerateIntegerRandomNumberTable(); /// ok - float GetDistanceSquared(CVector *v); // todo hook + float GetDistanceSquared(CVector *v); /// ok - // done + void TranslateEntity(CVector *v1, CVector *v2); /// ok - void TranslateEntity(CVector *v1, CVector *v2); // todo hook + // done void Initialise(); void PostInitialiseGameSpecificSetup(); @@ -322,6 +333,8 @@ public: void Service(); void GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint32 maxOffset); + void DoJumboVolOffset(); + uint32 GetPlayerTalkSfx(int16 sound); uint32 GetCopTalkSfx(int16 sound); uint32 GetSwatTalkSfx(int16 sound); @@ -400,58 +413,58 @@ public: uint32 GetGenericFemaleTalkSfx(int16 sound); void ProcessActiveQueues(); // todo - bool ProcessAirBrakes(cVehicleParams *params); // todo requires CVehicle - void ProcessAirportScriptObject(uint8 sound); // done - bool ProcessBoatEngine(cVehicleParams *params); // todo requires CVehicle - bool ProcessBoatMovingOverWater(cVehicleParams *params); // todo requires CVehicle - void ProcessBridge(); // todo - void ProcessBridgeMotor(); // done + bool ProcessAirBrakes(cVehicleParams *params); /// ok + void ProcessAirportScriptObject(uint8 sound); /// ok + bool ProcessBoatEngine(cVehicleParams *params); // todo requires CBoat + bool ProcessBoatMovingOverWater(cVehicleParams *params); // todo requires CBoat + void ProcessBridge(); // todo requires CBridge + void ProcessBridgeMotor(); /// ok void ProcessBridgeOneShots(); // todo requires CBridge - void ProcessBridgeWarning(); // done + void ProcessBridgeWarning(); /// ok bool ProcessCarBombTick(void *); // todo requires CVehicle void ProcessCesna(void *); // todo requires CPlane - void ProcessCinemaScriptObject(uint8 sound); // done + void ProcessCinemaScriptObject(uint8 sound); /// ok void ProcessCrane(); // todo requires CCrane - void ProcessDocksScriptObject(uint8 sound); // done + void ProcessDocksScriptObject(uint8 sound); /// ok // bool ProcessEngineDamage(void *); //todo requires CVehicle - void ProcessEntity(int32 sound); // done + void ProcessEntity(int32 sound); /// ok void ProcessExplosions(int32 explosion); // todo requires CExplosion - void ProcessFireHydrant(); // done + void ProcessFireHydrant(); /// ok void ProcessFires(int32 entity); // todo requires gFireManager - void ProcessFrontEnd(); // done - void ProcessGarages(); // todo + void ProcessFrontEnd(); /// ok + void ProcessGarages(); // todo requires CGarages::aGarages // bool ProcessHelicopter(void *); // todo requires CVehicle - void ProcessHomeScriptObject(uint8 sound); - // void ProcessJumbo(void *); - // void ProcessJumboAccel(void *); - // void ProcessJumboDecel(void *); - void ProcessJumboFlying(); - // void ProcessJumboLanding(void *); - // void ProcessJumboTakeOff(void *); - void ProcessJumboTaxi(); // done - // void ProcessLaunderetteScriptObject(uint8 sound); - // void ProcessLoopingScriptObject(uint8 sound); + void ProcessHomeScriptObject(uint8 sound); /// ok + void ProcessJumbo(cVehicleParams *); /// ok + void ProcessJumboAccel(CPlane *); // todo + void ProcessJumboDecel(CPlane *); // todo + void ProcessJumboFlying(); /// ok + void ProcessJumboLanding(CPlane *); // todo + void ProcessJumboTakeOff(CPlane *); // todo + void ProcessJumboTaxi(); /// ok + void ProcessLaunderetteScriptObject(uint8 sound); /// ok + void ProcessLoopingScriptObject(uint8 sound); /// ok // void ProcessMissionAudio(); // void ProcessModelVehicle(void *); // void ProcessOneShotScriptObject(uint8 sound); void ProcessPed(CPhysical *p); // todo // void ProcessPedHeadphones(void *); // void ProcessPedOneShots(void *); - void ProcessPhysical(int32 id); // done + void ProcessPhysical(int32 id); /// ok void ProcessPlane(void *); // todo // void ProcessPlayersVehicleEngine(void *, void *); - // void ProcessPoliceCellBeatingScriptObject(uint8 sound); - // void ProcessPornCinema(uint8 sound); - void ProcessProjectiles(); // todo + void ProcessPoliceCellBeatingScriptObject(uint8 sound); // todo + void ProcessPornCinema(uint8 sound); // todo + void ProcessProjectiles(); // todo // void ProcessRainOnVehicle(void *); // void ProcessReverb(); // bool ProcessReverseGear(void *); - // void ProcessSawMillScriptObject(uint8 sound); - void ProcessScriptObject(int32 id); // todo - // void ProcessShopScriptObject(uint8 sound); - // void ProcessSpecial(); + void ProcessSawMillScriptObject(uint8 sound); // todo + void ProcessScriptObject(int32 id); // todo + void ProcessShopScriptObject(uint8 sound); // todo + void ProcessSpecial(); /// ok // bool ProcessTrainNoise(void *); - void ProcessVehicle(void *); // todo + void ProcessVehicle(CVehicle *); // todo // bool ProcessVehicleDoors(void *); // bool ProcessVehicleEngine(void *); // void ProcessVehicleHorn(void *); @@ -462,11 +475,10 @@ public: // void ProcessVehicleSkidding(void *); void ProcessWaterCannon(int32); // todo void ProcessWeather(int32 id); // todo - // bool ProcessWetRoadNoise(void *); - // void ProcessWorkShopScriptObject(uint8 sound); + // bool ProcessWetRoadNoise(void *); + void ProcessWorkShopScriptObject(uint8 sound); /// ok }; static_assert(sizeof(cAudioManager) == 0x4B14, "cAudioManager: error"); extern cAudioManager &AudioManager; -extern cAudioManager &Players; diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index dcd4ae93..71cc594b 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -188,3 +188,17 @@ cMusicManager::Terminate() { EAXJMP(0x57D140); } + +WRAPPER +void +cMusicManager::ChangeMusicMode(int32 mode) +{ + EAXJMP(0x57D310); +} + +WRAPPER +void +cMusicManager::StopFrontEndTrack() +{ + EAXJMP(0x57E3D0); +} diff --git a/src/audio/MusicManager.h b/src/audio/MusicManager.h index 944fd16e..6a08882f 100644 --- a/src/audio/MusicManager.h +++ b/src/audio/MusicManager.h @@ -267,6 +267,9 @@ public: void Initialise(); void Terminate(); + void ChangeMusicMode(int32 mode); + void StopFrontEndTrack(); + char *Get3DProviderName(char); bool PlayerInCar(); void DisplayRadioStationName(); |