diff options
Diffstat (limited to 'src/audio')
-rw-r--r-- | src/audio/AudioManager.cpp | 508 | ||||
-rw-r--r-- | src/audio/AudioManager.h | 4 | ||||
-rw-r--r-- | src/audio/AudioScriptObject.cpp | 51 | ||||
-rw-r--r-- | src/audio/AudioScriptObject.h | 251 | ||||
-rw-r--r-- | src/audio/DMAudio.h | 3 | ||||
-rw-r--r-- | src/audio/MusicManager.cpp | 5 | ||||
-rw-r--r-- | src/audio/PoliceRadio.h | 2 |
7 files changed, 644 insertions, 180 deletions
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 539c9e91..8e8d024a 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -20,6 +20,7 @@ #include "MusicManager.h" #include "Pad.h" #include "Ped.h" +#include "Fire.h" #include "Physical.h" #include "Placeable.h" #include "Plane.h" @@ -67,6 +68,7 @@ const int molotovVolume = 50; const int rainOnVehicleIntensity = 22; const int reverseGearIntensity = 30; +const int engineDamageIntensity = 40; const bool hornPatternsArray[8][44] = { @@ -416,7 +418,7 @@ cAudioManager::AddReleasingSounds() } sample.field_56 = 0; } - memcpy(&m_sQueueSample, &sample, sizeof(sample)); + memcpy(&m_sQueueSample, &sample, sizeof(tSound)); AddSampleToRequestedQueue(); } } @@ -2742,11 +2744,215 @@ cAudioManager::PreTerminateGameSpecificShutdown() } } -WRAPPER void cAudioManager::ProcessActiveQueues() { - EAXJMP(0x57BA60); + bool flag; + float position2; + float position1; + + uint32 v28; + uint32 v29; + + float x; + float usedX; + float usedY; + float usedZ; + + uint8 vol; + uint8 emittingVol; + CVector position; + + for (int32 i = 0; i < m_bActiveSamples; i++) { + m_asSamples[m_bActiveSampleQueue][i].m_bIsProcessed = 0; + m_asActiveSamples[i].m_bIsProcessed = 0; + } + + for (int32 i = 0; i < m_bSampleRequestQueuesStatus[m_bActiveSampleQueue]; ++i) { + tSound& sample = m_asSamples[m_bActiveSampleQueue][m_abSampleQueueIndexTable[m_bActiveSampleQueue][i]]; + if (sample.m_nSampleIndex != NO_SAMPLE) { + for (int32 j = 0; j < m_bActiveSamples; ++j) { + if (sample.m_nEntityIndex == m_asActiveSamples[j].m_nEntityIndex && + sample.m_counter == m_asActiveSamples[j].m_counter && + sample.m_nSampleIndex == m_asActiveSamples[j].m_nSampleIndex) { + if (sample.m_nLoopCount) { + if (m_FrameCounter & 1) { + flag = !!(j & 1); + } + else { + flag = !(j & 1); + } + if (flag && !SampleManager.GetChannelUsedFlag(j)) { + sample.m_bLoopEnded = 1; + m_asActiveSamples[j].m_bLoopEnded = 1; + m_asActiveSamples[j].m_nSampleIndex = NO_SAMPLE; + m_asActiveSamples[j].m_nEntityIndex = AEHANDLE_NONE; + continue; + } + } + sample.m_bIsProcessed = 1; + m_asActiveSamples[j].m_bIsProcessed = 1; + sample.field_88 = -1; + if (!sample.field_56) { + if (sample.m_bIsDistant) { + if (field_4) { + emittingVol = 2 * min(63, sample.m_bEmittingVolume); + } + else { + emittingVol = sample.m_bEmittingVolume; + } + SampleManager.SetChannelFrequency(j, sample.m_nFrequency); + SampleManager.SetChannelEmittingVolume(j, emittingVol); + } + else { + m_asActiveSamples[j].m_fDistance = sample.m_fDistance; + position2 = sample.m_fDistance; + position1 = m_asActiveSamples[j].m_fDistance; + sample.m_nFrequency = ComputeDopplerEffectedFrequency( + sample.m_nFrequency, position1, position2, sample.field_48); + if (sample.m_nFrequency != m_asActiveSamples[j].m_nFrequency) { + int32 freq; + if (sample.m_nFrequency <= + m_asActiveSamples[j].m_nFrequency) { + freq = max(sample.m_nFrequency, + m_asActiveSamples[j].m_nFrequency - + 6000); + } + else { + freq = min(sample.m_nFrequency, + m_asActiveSamples[j].m_nFrequency + + 6000); + } + m_asActiveSamples[j].m_nFrequency = freq; + SampleManager.SetChannelFrequency(j, freq); + } + + if (sample.m_bEmittingVolume != + m_asActiveSamples[j].m_bEmittingVolume) { + if (sample.m_bEmittingVolume <= + m_asActiveSamples[j].m_bEmittingVolume) { + vol = max( + m_asActiveSamples[j].m_bEmittingVolume - 10, + sample.m_bEmittingVolume); + } + else { + vol = min( + m_asActiveSamples[j].m_bEmittingVolume + 10, + sample.m_bEmittingVolume); + } + + uint8 emittingVol; + if (field_4) { + emittingVol = 2 * min(63, vol); + } + else { + emittingVol = vol; + } + SampleManager.SetChannelEmittingVolume(j, emittingVol); + m_asActiveSamples[j].m_bEmittingVolume = vol; + } + TranslateEntity(&sample.m_vecPos, &position); + SampleManager.SetChannel3DPosition(j, position.x, position.y, + position.z); + SampleManager.SetChannel3DDistances( + j, sample.m_fSoundIntensity, + 0.25f * sample.m_fSoundIntensity); + } + SampleManager.SetChannelReverbFlag(j, sample.m_bReverbFlag); + continue; + } + sample.m_bIsProcessed = 0; + m_asActiveSamples[j].m_bIsProcessed = 0; + break; + } + } + } + } + for (int32 i = 0; i < m_bActiveSamples; i++) { + if (m_asActiveSamples[i].m_nSampleIndex != NO_SAMPLE && !m_asActiveSamples[i].m_bIsProcessed) { + SampleManager.StopChannel(i); + m_asActiveSamples[i].m_nSampleIndex = NO_SAMPLE; + m_asActiveSamples[i].m_nEntityIndex = -5; + } + } + for (int32 i = 0; i < m_bSampleRequestQueuesStatus[m_bActiveSampleQueue]; ++i) { + + tSound& sample = m_asSamples[m_bActiveSampleQueue][m_abSampleQueueIndexTable[m_bActiveSampleQueue][i]]; + if (!sample.m_bIsProcessed && !sample.m_bLoopEnded && + m_asAudioEntities[sample.m_nEntityIndex].m_bIsUsed && sample.m_nSampleIndex < NO_SAMPLE) { + if (sample.m_counter > 255 && sample.m_nLoopCount && sample.m_bLoopsRemaining) { + --sample.m_bLoopsRemaining; + sample.field_76 = 1; + } + else { + for (int32 j = 0; j < m_bActiveSamples; ++j) { + if (!m_asActiveSamples[j].m_bIsProcessed) { + if (sample.m_nLoopCount) { + v28 = sample.m_nFrequency / field_19192; + v29 = sample.m_nLoopCount * + SampleManager.GetSampleLength(sample.m_nSampleIndex); + if (v28 == 0) continue; + sample.field_76 = v29 / v28 + 1; + } + memcpy(&m_asActiveSamples[j], &sample, sizeof(tSound)); + if (!m_asActiveSamples[j].m_bIsDistant) + TranslateEntity(&m_asActiveSamples[j].m_vecPos, &position); + if (field_4) { + emittingVol = + 2 * min(63, m_asActiveSamples[j].m_bEmittingVolume); + } + else { + emittingVol = m_asActiveSamples[j].m_bEmittingVolume; + } + if (SampleManager.InitialiseChannel(j, + m_asActiveSamples[j].m_nSampleIndex, + m_asActiveSamples[j].m_bBankIndex)) { + SampleManager.SetChannelFrequency( + j, m_asActiveSamples[j].m_nFrequency); + SampleManager.SetChannelEmittingVolume(j, emittingVol); + SampleManager.SetChannelLoopPoints( + j, m_asActiveSamples[j].m_nLoopStart, + m_asActiveSamples[j].m_nLoopEnd); + SampleManager.SetChannelLoopCount( + j, m_asActiveSamples[j].m_nLoopCount); + SampleManager.SetChannelReverbFlag( + j, m_asActiveSamples[j].m_bReverbFlag); + if (m_asActiveSamples[j].m_bIsDistant) { + uint8 offset = m_asActiveSamples[j].m_bOffset; + if (offset == 63) { + x = 0.f; + } + else if (offset >= 63) { + x = (offset - 63) * 1000.f / 63; + } + else { + x = -(63 - offset) * 1000.f / 63; + } + usedX = x; + usedY = 0.f; + usedZ = 0.f; + m_asActiveSamples[j].m_fSoundIntensity = 100000.0f; + } + else { + usedX = position.x; + usedY = position.y; + usedZ = position.z; + } + SampleManager.SetChannel3DPosition(j, usedX, usedY, usedZ); + SampleManager.SetChannel3DDistances( + j, m_asActiveSamples[j].m_fSoundIntensity, + 0.25f * m_asActiveSamples[j].m_fSoundIntensity); + SampleManager.StartChannel(j); + } + m_asActiveSamples[j].m_bIsProcessed = 1; + sample.m_bIsProcessed = 1; + sample.field_88 = -1; + break; + } + } + } + } + } } bool @@ -3056,7 +3262,7 @@ cAudioManager::ProcessBridgeMotor() m_sQueueSample.m_bVolume = ComputeVolume(maxVolume, bridgeIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = 1; - m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; + m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; // todo check sfx name m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_bIsDistant = false; m_sQueueSample.field_16 = 1; @@ -3127,7 +3333,7 @@ cAudioManager::ProcessBridgeWarning() m_sQueueSample.m_bVolume = ComputeVolume(100, 450.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = 0; - m_sQueueSample.m_nSampleIndex = 457; + m_sQueueSample.m_nSampleIndex = SFX_BRIDGE_OPEN_WARNING; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_bIsDistant = false; m_sQueueSample.field_16 = 1; @@ -3153,7 +3359,7 @@ cAudioManager::ProcessCarBombTick(cVehicleParams *params) { CAutomobile *automobile; - if(params->m_fDistance >= 1600.f) return false; + if(params->m_fDistance >= SQR(40.f)) return false; automobile = (CAutomobile *)params->m_pVehicle; if(automobile->bEngineOn && automobile->m_bombType == CARBOMB_TIMEDACTIVE) { CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); @@ -3410,11 +3616,11 @@ cAudioManager::ProcessEngineDamage(cVehicleParams *params) uint8 engineStatus; uint8 emittingVolume; - if(params->m_fDistance >= 1600.f) return false; + if(params->m_fDistance >= SQR(engineDamageIntensity)) return false; veh = (CAutomobile *)params->m_pVehicle; if(veh->bEngineOn) { engineStatus = veh->Damage.GetEngineStatus(); - if(engineStatus > 250u || engineStatus < 100) return true; + if(engineStatus > 250 || engineStatus < 100) return true; if(engineStatus < 225) { m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; emittingVolume = 6; @@ -3427,7 +3633,7 @@ cAudioManager::ProcessEngineDamage(cVehicleParams *params) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE); } CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - m_sQueueSample.m_bVolume = ComputeVolume(emittingVolume, 40.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(emittingVolume, engineDamageIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { m_sQueueSample.m_counter = 28; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; @@ -3438,7 +3644,7 @@ cAudioManager::ProcessEngineDamage(cVehicleParams *params) SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.field_48 = 2.0f; - m_sQueueSample.m_fSoundIntensity = 40.0f; + m_sQueueSample.m_fSoundIntensity = engineDamageIntensity; m_sQueueSample.field_56 = 0; m_sQueueSample.field_76 = 3; m_sQueueSample.m_bReverbFlag = true; @@ -3534,7 +3740,7 @@ cAudioManager::ProcessExplosions(int32 explosion) CVector *pos; float distSquared; - for(uint8 i = 0; i < 48; i++) { + for(uint8 i = 0; i < ARRAY_SIZE(gaExplosion); i++) { if(CExplosion::GetExplosionActiveCounter(i) == 1) { CExplosion::ResetExplosionActiveCounter(i); type = CExplosion::GetExplosionType(i); @@ -3732,7 +3938,7 @@ cAudioManager::ProcessFrontEnd() break; case SOUND_GARAGE_NO_MONEY: case SOUND_GARAGE_BAD_VEHICLE: - case SOUND_3C: + case SOUND_GARAGE_BOMB_ALREADY_SET: m_sQueueSample.m_nSampleIndex = SFX_PICKUP_ERROR_LEFT; stereo = true; break; @@ -3889,7 +4095,7 @@ cAudioManager::ProcessGarages() CalculateDistance(distCalculated, distSquared); \ m_sQueueSample.m_bVolume = ComputeVolume(60, 80.f, m_sQueueSample.m_fDistance); \ if(m_sQueueSample.m_bVolume) { \ - if(CGarages::Garages[i].m_eGarageType == GARAGE_CRUSHER) { \ + if(CGarages::aGarages[i].m_eGarageType == GARAGE_CRUSHER) { \ m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_PANEL_2; \ m_sQueueSample.m_nFrequency = 6735; \ } else if(m_asAudioEntities[m_sQueueSample.m_nEntityIndex] \ @@ -3905,7 +4111,7 @@ cAudioManager::ProcessGarages() m_sQueueSample.m_bEmittingVolume = 60; \ m_sQueueSample.field_48 = 0.0f; \ m_sQueueSample.m_fSoundIntensity = 80.0f; \ - m_sQueueSample.field_16 = 4; \ + /*m_sQueueSample.field_16 = 4;*/ \ m_sQueueSample.m_bReverbFlag = true; \ /*m_sQueueSample.m_bReverbFlag = true;*/ \ m_sQueueSample.m_bIsDistant = false; \ @@ -3915,7 +4121,7 @@ cAudioManager::ProcessGarages() m_sQueueSample.m_nLoopEnd = -1; \ m_sQueueSample.m_counter = iSound++; \ if(iSound < 32) iSound = 32; \ - m_sQueueSample.m_bRequireReflection = 1; \ + m_sQueueSample.m_bRequireReflection = true; \ AddSampleToRequestedQueue(); \ } \ } \ @@ -3925,20 +4131,20 @@ cAudioManager::ProcessGarages() } for(uint32 i = 0; i < CGarages::NumGarages; ++i) { - if(CGarages::Garages[i].m_eGarageType == GARAGE_NONE) continue; - entity = CGarages::Garages[i].m_pDoor1; + if(CGarages::aGarages[i].m_eGarageType == GARAGE_NONE) continue; + entity = CGarages::aGarages[i].m_pDoor1; if(!entity) continue; m_sQueueSample.m_vecPos = entity->GetPosition(); distCalculated = false; distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); if(distSquared < 6400.f) { - state = CGarages::Garages[i].m_eGarageState; + state = CGarages::aGarages[i].m_eGarageState; if(state == GS_OPENING || state == GS_CLOSING || state == GS_AFTERDROPOFF) { CalculateDistance(distCalculated, distSquared); - m_sQueueSample.m_bVolume = ComputeVolume(90u, 80.f, m_sQueueSample.m_fDistance); + m_sQueueSample.m_bVolume = ComputeVolume(90, 80.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { - if(CGarages::Garages[i].m_eGarageType == GARAGE_CRUSHER) { - if(CGarages::Garages[i].m_eGarageState == GS_AFTERDROPOFF) { + if(CGarages::aGarages[i].m_eGarageType == GARAGE_CRUSHER) { + if(CGarages::aGarages[i].m_eGarageState == GS_AFTERDROPOFF) { if(!(m_FrameCounter & 1)) { LOOP_HELPER continue; @@ -3955,11 +4161,11 @@ cAudioManager::ProcessGarages() m_sQueueSample.m_nSampleIndex) >> 1; m_sQueueSample.m_nFrequency += - RandomDisplacement((int32)m_sQueueSample.m_nFrequency >> 4); + RandomDisplacement(m_sQueueSample.m_nFrequency >> 4); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.field_56 = 1; m_sQueueSample.m_counter = iSound++; - if(iSound < 32u) iSound = 32; + if(iSound < 32) iSound = 32; m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_bIsDistant = false; m_sQueueSample.field_16 = 3; @@ -4001,9 +4207,9 @@ cAudioManager::ProcessGarages() m_sQueueSample.m_bReverbFlag = true; m_sQueueSample.m_bRequireReflection = false; AddSampleToRequestedQueue(); - LOOP_HELPER } } + LOOP_HELPER } } #undef LOOP_HELPER @@ -4183,11 +4389,8 @@ cAudioManager::ProcessJumboAccel(CPlane *plane) void cAudioManager::ProcessJumboDecel(CPlane *plane) { - float modificator; - if(SetupJumboFlySound(20) && SetupJumboTaxiSound(75)) { - modificator = (plane->m_fSpeed - 0.10334f) * 1.676f; - if(modificator > 1.0f) modificator = 1.0f; + const float modificator = min(1.f, (plane->m_fSpeed - 0.10334f) * 1.676f); SetupJumboEngineSound(maxVolume * modificator, 6050.f * modificator + 16000); SetupJumboWhineSound(18, 29500); } @@ -4202,7 +4405,7 @@ cAudioManager::ProcessJumboFlying() void cAudioManager::ProcessJumboLanding(CPlane *plane) { - float modificator = (LandingPoint - PlanePathPosition[plane->m_nPlaneId]) / 350.f; + const float modificator = (LandingPoint - PlanePathPosition[plane->m_nPlaneId]) / 350.f; if(SetupJumboFlySound(107.f * modificator + 20)) { if(SetupJumboTaxiSound(75.f * (1.f - modificator))) { SetupJumboEngineSound(maxVolume, 22050); @@ -4214,7 +4417,7 @@ cAudioManager::ProcessJumboLanding(CPlane *plane) void cAudioManager::ProcessJumboTakeOff(CPlane *plane) { - float modificator = (PlanePathPosition[plane->m_nPlaneId] - TakeOffPoint) / 300.f; + const float modificator = (PlanePathPosition[plane->m_nPlaneId] - TakeOffPoint) / 300.f; if(SetupJumboFlySound((107.f * modificator) + 20) && SetupJumboRumbleSound(maxVolume * (1.f - modificator))) { if(SetupJumboEngineSound(maxVolume, 22050)) SetupJumboWhineSound(18.f * (1.f - modificator), 44100); @@ -5003,13 +5206,11 @@ cAudioManager::ProcessMissionAudio() void cAudioManager::ProcessModelCarEngine(cVehicleParams *params) { - cAudioManager *v2; CAutomobile *automobile; float allowedVelocity; int32 emittingVol; float velocityChange; - v2 = this; if(params->m_fDistance < 900.f) { automobile = (CAutomobile *)params->m_pVehicle; if(automobile->bEngineOn) { @@ -5311,13 +5512,13 @@ cAudioManager::ProcessPed(CPhysical *ped) { cPedParams params; - params.m_pPed = 0; - params.m_bDistanceCalculated = 0; + params.m_pPed = nil; + params.m_bDistanceCalculated = false; params.m_fDistance = 0.0f; m_sQueueSample.m_vecPos = ped->GetPosition(); - params.m_bDistanceCalculated = 0; + //params.m_bDistanceCalculated = false; params.m_pPed = (CPed *)ped; params.m_fDistance = GetDistanceSquared(&m_sQueueSample.m_vecPos); if(ped->m_modelIndex == MI_FATMALE02) ProcessPedHeadphones(¶ms); @@ -5328,7 +5529,7 @@ void cAudioManager::ProcessPedHeadphones(cPedParams *params) { CPed *ped; - CVehicle *veh; + CAutomobile *veh; uint8 emittingVol; if(params->m_fDistance < 49.f) { @@ -5337,9 +5538,9 @@ cAudioManager::ProcessPedHeadphones(cPedParams *params) CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); if(ped->bInVehicle && ped->m_nPedState == PED_DRIVING) { emittingVol = 10; - veh = ped->m_pMyVehicle; + veh = (CAutomobile*)ped->m_pMyVehicle; if(veh && veh->IsCar()) { - for(int32 i = 2; i < 6; i++) { + for(int32 i = 2; i < ARRAYSIZE(veh->Doors); i++) { if(!veh->IsDoorClosed((eDoors)i) || veh->IsDoorMissing((eDoors)i)) { emittingVol = 42; break; @@ -7234,11 +7435,224 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams *params) return true; } -WRAPPER -bool -cAudioManager::ProcessVehicleEngine(cVehicleParams *params) -{ - EAXJMP(0x56A610); +void +cAudioManager::ProcessVehicleEngine(cVehicleParams* params) +{ + CVehicle* playerVeh; + CVehicle* veh; + CAutomobile* automobile; + float relativeGearChange; + float relativeChange; + float reverseRelativechange; + uint8 volume; + eSfxSample accelerationSample; + int32 freq; + uint8 emittingVol; + cTransmission* transmission; + uint8 currentGear; + float modificator; + float traction = 0.f; + + if (params->m_fDistance < SQR(50.f)) { + playerVeh = FindPlayerVehicle(); + veh = params->m_pVehicle; + if (playerVeh == veh && veh->m_status == STATUS_WRECKED) { + SampleManager.StopChannel(m_bActiveSamples); + return; + } + if (veh->bEngineOn) { + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + automobile = (CAutomobile*)params->m_pVehicle; + if (params->m_nIndex == DODO) { + ProcessCesna(params); + return; + } + if (FindPlayerVehicle() == veh) { + ProcessPlayersVehicleEngine(params, automobile); + return; + } + transmission = params->m_pTransmission; + if (transmission) { + currentGear = params->m_pVehicle->m_nCurrentGear; + if (automobile->m_nWheelsOnGround) { + if (automobile->bIsHandbrakeOn) { + if (0.f == params->m_fVelocityChange) traction = 0.9f; + } + else if (params->m_pVehicle->m_status == STATUS_SIMPLE) { + traction = 0.f; + } + else { + switch (transmission->nDriveType) { + case '4': + for (int32 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) { + if (automobile->m_aWheelState[i] == WHEEL_STATE_SPINNING) + traction += 0.05f; + } + break; + case 'F': + if (automobile->m_aWheelState[0] == WHEEL_STATE_SPINNING) + traction += 0.1f; + if (automobile->m_aWheelState[2] == WHEEL_STATE_SPINNING) + traction += 0.1f; + break; + case 'R': + if (automobile->m_aWheelState[1] == WHEEL_STATE_SPINNING) + traction += 0.1f; + if (automobile->m_aWheelState[3] == WHEEL_STATE_SPINNING) + traction += 0.1f; + break; + } + } + if (transmission->fMaxVelocity <= 0.f) { + relativeChange = 0.f; + } + else if (currentGear) { + if ((params->m_fVelocityChange - + transmission->Gears[currentGear].fShiftDownVelocity) / + transmission->fMaxVelocity * 2.5f <= + 1.f) + relativeGearChange = + (params->m_fVelocityChange - + transmission->Gears[currentGear].fShiftDownVelocity) / + transmission->fMaxVelocity * 2.5f; + else + relativeGearChange = 1.f; + if (0.f == traction && automobile->m_status != STATUS_SIMPLE && + params->m_fVelocityChange >= + transmission->Gears[1].fShiftUpVelocity) { + traction = 0.7f; + } + relativeChange = traction * automobile->m_fGasPedalAudio * 0.95f + + (1.f - traction) * relativeGearChange; + } + else { + reverseRelativechange = + Abs((params->m_fVelocityChange - + transmission->Gears[0].fShiftDownVelocity) / + transmission->fMaxReverseVelocity); + if (1.f - reverseRelativechange <= 1.f) { + relativeChange = 1.f - reverseRelativechange; + } + else { + relativeChange = 1.f; + } + } + } + else { + if (automobile->m_nDriveWheelsOnGround) + automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.4f; + relativeChange = automobile->m_fGasPedalAudio; + } + modificator = relativeChange; + if (currentGear || !automobile->m_nWheelsOnGround) + freq = 1200 * currentGear + 18000.f * modificator + 14000; + else + freq = 13000.f * modificator + 14000; + if (modificator >= 0.75f) { + emittingVol = 120; + volume = ComputeVolume(120, 50.f, m_sQueueSample.m_fDistance); + } + else { + emittingVol = modificator * 4 / 3 * 40.f + 80.f; + volume = ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance); + } + } + else { + modificator = 0.f; + emittingVol = 80; + volume = ComputeVolume(80, 50.f, m_sQueueSample.m_fDistance); + } + m_sQueueSample.m_bVolume = volume; + if (m_sQueueSample.m_bVolume) { + if (automobile->m_status == STATUS_SIMPLE) { + if (modificator < 0.02f) { + m_sQueueSample.m_nSampleIndex = + CarSounds[params->m_nIndex].m_bEngineSoundType + SFX_CAR_REV_10; + freq = 10000.f * modificator + 22050; + m_sQueueSample.m_counter = 52; + m_sQueueSample.m_bBankIndex = 0; + m_sQueueSample.m_bIsDistant = 0; + m_sQueueSample.field_16 = 3; + m_sQueueSample.m_nFrequency = + freq + 100 * m_sQueueSample.m_nEntityIndex % 1000; + if (m_sQueueSample.m_nSampleIndex == SFX_CAR_IDLE_6 || + m_sQueueSample.m_nSampleIndex == SFX_CAR_REV_6) + m_sQueueSample.m_nFrequency = m_sQueueSample.m_nFrequency >> 1; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_bEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset( + m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = + SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.field_48 = 6.0f; + m_sQueueSample.m_fSoundIntensity = 50.0f; + m_sQueueSample.field_56 = 0; + m_sQueueSample.field_76 = 8; + m_sQueueSample.m_bReverbFlag = 1; + m_sQueueSample.m_bRequireReflection = 0; + AddSampleToRequestedQueue(); + return; + } + accelerationSample = CarSounds[params->m_nIndex].m_nAccelerationSampleIndex; + } + else { + if (automobile->m_fGasPedal < 0.05f) { + m_sQueueSample.m_nSampleIndex = + CarSounds[params->m_nIndex].m_bEngineSoundType + + SFX_CAR_REV_10; // to recheck idle sounds start 1 postion later + freq = 10000.f * modificator + 22050; + m_sQueueSample.m_counter = 52; + m_sQueueSample.m_bBankIndex = 0; + m_sQueueSample.m_bIsDistant = 0; + m_sQueueSample.field_16 = 3; + m_sQueueSample.m_nFrequency = + freq + 100 * m_sQueueSample.m_nEntityIndex % 1000; + if (m_sQueueSample.m_nSampleIndex == SFX_CAR_IDLE_6 || + m_sQueueSample.m_nSampleIndex == SFX_CAR_REV_6) + m_sQueueSample.m_nFrequency = m_sQueueSample.m_nFrequency >> 1; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_bEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset( + m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = + SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.field_48 = 6.0f; + m_sQueueSample.m_fSoundIntensity = 50.0f; + m_sQueueSample.field_56 = 0; + m_sQueueSample.field_76 = 8; + m_sQueueSample.m_bReverbFlag = 1; + m_sQueueSample.m_bRequireReflection = 0; + AddSampleToRequestedQueue(); + return; + } + accelerationSample = CarSounds[params->m_nIndex].m_nAccelerationSampleIndex; + } + m_sQueueSample.m_nSampleIndex = accelerationSample; + m_sQueueSample.m_counter = 2; + m_sQueueSample.m_bBankIndex = 0; + m_sQueueSample.m_bIsDistant = 0; + m_sQueueSample.field_16 = 3; + m_sQueueSample.m_nFrequency = freq + 100 * m_sQueueSample.m_nEntityIndex % 1000; + if (m_sQueueSample.m_nSampleIndex == SFX_CAR_IDLE_6 || + m_sQueueSample.m_nSampleIndex == SFX_CAR_REV_6) + m_sQueueSample.m_nFrequency = m_sQueueSample.m_nFrequency >> 1; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_bEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = + SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = + SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.field_48 = 6.0f; + m_sQueueSample.m_fSoundIntensity = 50.0f; + m_sQueueSample.field_56 = 0; + m_sQueueSample.field_76 = 8; + m_sQueueSample.m_bReverbFlag = 1; + m_sQueueSample.m_bRequireReflection = 0; + AddSampleToRequestedQueue(); + return; + } + } + } } void @@ -7358,7 +7772,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params) freq = 6050 * emittingVol / 30 + 16000; } else { m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE; - modificator = m_sQueueSample.m_fDistance * 1.f / 95.f * 0.5f; + modificator = m_sQueueSample.m_fDistance / 190.f; sampleFreq = SampleManager.GetSampleBaseFrequency( SFX_ROAD_NOISE); freq = (sampleFreq * modificator) + ((3 * sampleFreq) >> 2); @@ -7533,8 +7947,8 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams *params) void cAudioManager::ProcessWaterCannon(int32) { for(int32 i = 0; i < NUM_WATERCANNONS; i++) { - if(aCannons[i].m_nId) { - m_sQueueSample.m_vecPos = aCannons[0].m_avecPos[aCannons[i].m_wIndex]; + if(CWaterCannons::aCannons[i].m_nId) { + m_sQueueSample.m_vecPos = CWaterCannons::aCannons[0].m_avecPos[CWaterCannons::aCannons[i].m_nCur]; float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); if(distSquared < 900.f) { m_sQueueSample.m_fDistance = Sqrt(distSquared); @@ -7647,7 +8061,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params) m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_bIsDistant = false; m_sQueueSample.field_16 = 3; - modificator = m_sQueueSample.m_fDistance * 1.f / 3.f * 0.5f; + modificator = m_sQueueSample.m_fDistance / 6.f; freq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE); m_sQueueSample.m_nFrequency = freq + freq * modificator; m_sQueueSample.m_nLoopCount = 0; diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 70281237..0be1e38a 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -489,7 +489,7 @@ public: void PreloadMissionAudio(const char *name); /// ok void PreTerminateGameSpecificShutdown(); /// ok /// processX - main logic of adding new sounds - void ProcessActiveQueues(); // todo + void ProcessActiveQueues(); /// ok bool ProcessAirBrakes(cVehicleParams *params); /// ok void ProcessAirportScriptObject(uint8 sound); /// ok bool ProcessBoatEngine(cVehicleParams *params); /// ok @@ -544,7 +544,7 @@ public: bool ProcessTrainNoise(cVehicleParams *params); /// ok void ProcessVehicle(CVehicle *vehicle); /// ok bool ProcessVehicleDoors(cVehicleParams *params); /// ok - bool ProcessVehicleEngine(cVehicleParams *params); // todo + void ProcessVehicleEngine(cVehicleParams *params); /// ok void ProcessVehicleHorn(cVehicleParams *params); /// ok void ProcessVehicleOneShots(void *); // todo bool ProcessVehicleReverseWarning(cVehicleParams *params); /// ok diff --git a/src/audio/AudioScriptObject.cpp b/src/audio/AudioScriptObject.cpp index 796cd88b..0ae3834a 100644 --- a/src/audio/AudioScriptObject.cpp +++ b/src/audio/AudioScriptObject.cpp @@ -2,13 +2,12 @@ #include "patcher.h" #include "AudioScriptObject.h" #include "Pools.h" - -WRAPPER void cAudioScriptObject::SaveAllAudioScriptObjects(uint8 *buf, uint32 *size) { EAXJMP(0x57c460); } +#include "DMAudio.h" void cAudioScriptObject::Reset() { - AudioId = 125; + AudioId = SCRSOUND_INVALID; Posn = CVector(0.0f, 0.0f, 0.0f); AudioEntity = AEHANDLE_NONE; } @@ -18,16 +17,19 @@ cAudioScriptObject::operator new(size_t sz) { return CPools::GetAudioScriptObjectPool()->New(); } + void * cAudioScriptObject::operator new(size_t sz, int handle) { return CPools::GetAudioScriptObjectPool()->New(handle); } + void cAudioScriptObject::operator delete(void *p, size_t sz) { CPools::GetAudioScriptObjectPool()->Delete((cAudioScriptObject *)p); } + void cAudioScriptObject::operator delete(void *p, int handle) { @@ -35,6 +37,47 @@ cAudioScriptObject::operator delete(void *p, int handle) } void +cAudioScriptObject::LoadAllAudioScriptObjects(uint8 *buf, uint32 size) +{ + INITSAVEBUF + + CheckSaveHeader(buf, 'A', 'U', 'D', '\0', size - SAVE_HEADER_SIZE); + + int32 pool_size = ReadSaveBuf<int32>(buf); + for (int32 i = 0; i < pool_size; i++) { + int handle = ReadSaveBuf<int32>(buf); + cAudioScriptObject *p = new(handle) cAudioScriptObject; + assert(p != nil); + *p = ReadSaveBuf<cAudioScriptObject>(buf); + p->AudioEntity = DMAudio.CreateLoopingScriptObject(p); + } + + VALIDATESAVEBUF(size); +} + +void +cAudioScriptObject::SaveAllAudioScriptObjects(uint8 *buf, uint32 *size) +{ + INITSAVEBUF + + int32 pool_size = CPools::GetAudioScriptObjectPool()->GetNoOfUsedSpaces(); + *size = SAVE_HEADER_SIZE + pool_size * (sizeof(cAudioScriptObject) + sizeof(int32)); + WriteSaveHeader(buf, 'A', 'U', 'D', '\0', *size - SAVE_HEADER_SIZE); + WriteSaveBuf(buf, pool_size); + + int32 i = CPools::GetAudioScriptObjectPool()->GetSize(); + while (i--) { + cAudioScriptObject *p = CPools::GetAudioScriptObjectPool()->GetSlot(i); + if (p != nil) { + WriteSaveBuf(buf, CPools::GetAudioScriptObjectPool()->GetIndex(p)); + WriteSaveBuf(buf, *p); + } + } + + VALIDATESAVEBUF(*size); +} + +void PlayOneShotScriptObject(uint8 id, CVector const &pos) { cAudioScriptObject *audioScriptObject = new cAudioScriptObject(); @@ -47,4 +90,6 @@ PlayOneShotScriptObject(uint8 id, CVector const &pos) STARTPATCHES InjectHook(0x57C430, &cAudioScriptObject::Reset, PATCH_JUMP); InjectHook(0x57C5F0, &PlayOneShotScriptObject, PATCH_JUMP); +InjectHook(0x57C560, &cAudioScriptObject::LoadAllAudioScriptObjects, PATCH_JUMP); +InjectHook(0x57c460, &cAudioScriptObject::SaveAllAudioScriptObjects, PATCH_JUMP); ENDPATCHES
\ No newline at end of file diff --git a/src/audio/AudioScriptObject.h b/src/audio/AudioScriptObject.h index 1db19865..4308faee 100644 --- a/src/audio/AudioScriptObject.h +++ b/src/audio/AudioScriptObject.h @@ -2,130 +2,132 @@ enum { - SCRSOUND_TEST_1 = 0, - _SCRSOUND_UNK_1 = 1, - _SCRSOUND_UNK_2 = 2, - _SCRSOUND_UNK_3 = 3, - _SCRSOUND_CLUB_1_S = 4, - _SCRSOUND_CLUB_1_L = 5, - _SCRSOUND_CLUB_2_S = 6, - _SCRSOUND_CLUB_2_L = 7, - _SCRSOUND_CLUB_3_S = 8, - _SCRSOUND_CLUB_3_L = 9, - _SCRSOUND_CLUB_4_S = 10, - _SCRSOUND_CLUB_4_L = 11, - _SCRSOUND_CLUB_5_S = 12, - _SCRSOUND_CLUB_5_L = 13, - _SCRSOUND_CLUB_6_S = 14, - _SCRSOUND_CLUB_6_L = 15, - _SCRSOUND_CLUB_7_S = 16, - _SCRSOUND_CLUB_7_L = 17, - _SCRSOUND_CLUB_8_S = 18, - _SCRSOUND_CLUB_8_L = 19, - _SCRSOUND_CLUB_9_S = 20, - _SCRSOUND_CLUB_9_L = 21, - _SCRSOUND_CLUB_10_S = 22, - _SCRSOUND_CLUB_10_L = 23, - _SCRSOUND_CLUB_11_S = 24, - _SCRSOUND_CLUB_11_L = 25, - _SCRSOUND_CLUB_12_S = 26, - _SCRSOUND_CLUB_12_L = 27, - _SCRSOUND_CLUB_RAGGA_S = 28, - _SCRSOUND_CLUB_RAGGA_L = 29, - SCRSOUND_STRIP_CLUB_LOOP_1_S = 30, - _SCRSOUND_STRIP_CLUB_LOOP_1_L = 31, - SCRSOUND_STRIP_CLUB_LOOP_2_S = 32, - _SCRSOUND_STRIP_CLUB_LOOP_2_L = 33, - _SCRSOUND_SFX_WORKSHOP_1 = 34, - _SCRSOUND_SFX_WORKSHOP_2 = 35, - _SCRSOUND_SAWMILL_LOOP_S = 36, - SCRSOUND_SAWMILL_LOOP_L = 37, - _SCRSOUND_DOG_FOOD_FACTORY_S = 38, - _SCRSOUND_DOG_FOOD_FACTORY_L = 39, - _SCRSOUND_LAUNDERETTE_1 = 40, - _SCRSOUND_LAUNDERETTE_2 = 41, - _SCRSOUND_RESTAURANT_CHINATOWN_S = 42, - _SCRSOUND_RESTAURANT_CHINATOWN_L = 43, - _SCRSOUND_RESTAURANT_ITALY_S = 44, - _SCRSOUND_RESTAURANT_ITALY_L = 45, - _SCRSOUND_RESTAURANT_GENERIC_1_S = 46, - _SCRSOUND_RESTAURANT_GENERIC_1_L = 47, - _SCRSOUND_RESTAURANT_GENERIC_2_S = 48, - _SCRSOUND_RESTAURANT_GENERIC_2_L = 49, - _SCRSOUND_AIRPORT_ANNOUNCEMENT_S = 50, - _SCRSOUND_AIRPORT_ANNOUNCEMENT_L = 51, - _SCRSOUND_SHOP_LOOP_1 = 52, - _SCRSOUND_SHOP_LOOP_2 = 53, - _SCRSOUND_CINEMA_S = 54, - _SCRSOUND_CINEMA_L = 55, - _SCRSOUND_DOCKS_FOGHORN_S = 56, - _SCRSOUND_DOCKS_FOGHORN_L = 57, - _SCRSOUND_HOME_S = 58, - _SCRSOUND_HOME_L = 59, - _SCRSOUND_PIANO_BAR = 60, - _SCRSOUND_CLUB = 61, - SCRSOUND_PORN_CINEMA_1_S = 62, - _SCRSOUND_PORN_CINEMA_1_L = 63, - SCRSOUND_PORN_CINEMA_2_S = 64, - _SCRSOUND_PORN_CINEMA_2_L = 65, - SCRSOUND_PORN_CINEMA_3_S = 66, - _SCRSOUND_PORN_CINEMA_3_L = 67, - _SCRSOUND_BANK_ALARM_LOOP_S = 68, - SCRSOUND_BANK_ALARM_LOOP_L = 69, - _SCRSOUND_POLICE_BALL_LOOP_S = 70, - SCRSOUND_POLICE_BALL_LOOP_L = 71, - _SCRSOUND_RAVE_LOOP_INDUSTRIAL_S = 72, - SCRSOUND_RAVE_LOOP_INDUSTRIAL_L = 73, - _SCRSOUND_UNK_74 = 74, - _SCRSOUND_UNK_75 = 75, - _SCRSOUND_POLICE_CELL_BEATING_LOOP_S = 76, - SCRSOUND_POLICE_CELL_BEATING_LOOP_L = 77, - SCRSOUND_INJURED_PED_MALE_OUCH_S = 78, - SCRSOUND_INJURED_PED_MALE_OUCH_L = 79, - SCRSOUND_INJURED_PED_FEMALE_OUCH_S = 80, - SCRSOUND_INJURED_PED_FEMALE_OUCH_L = 81, - SCRSOUND_EVIDENCE_PICKUP = 82, - SCRSOUND_UNLOAD_GOLD = 83, - _SCRSOUND_RAVE_INDUSTRIAL_S = 84, - _SCRSOUND_RAVE_INDUSTRIAL_L = 85, - _SCRSOUND_RAVE_COMMERCIAL_S = 86, - _SCRSOUND_RAVE_COMMERCIAL_L = 87, - _SCRSOUND_RAVE_SUBURBAN_S = 88, - _SCRSOUND_RAVE_SUBURBAN_L = 89, - _SCRSOUND_GROAN_S = 90, - _SCRSOUND_GROAN_L = 91, - SCRSOUND_GATE_START_CLUNK = 92, - SCRSOUND_GATE_STOP_CLUNK = 93, - SCRSOUND_PART_MISSION_COMPLETE = 94, - SCRSOUND_CHUNKY_RUN_SHOUT = 95, - SCRSOUND_SECURITY_GUARD_RUN_AWAY_SHOUT = 96, - SCRSOUND_RACE_START_1 = 97, - SCRSOUND_RACE_START_2 = 98, - SCRSOUND_RACE_START_3 = 99, - SCRSOUND_RACE_START_GO = 100, - SCRSOUND_SWAT_PED_SHOUT = 101, - SCRSOUND_PRETEND_FIRE_LOOP = 102, - SCRSOUND_AMMUNATION_CHAT_1 = 103, - SCRSOUND_AMMUNATION_CHAT_2 = 104, - SCRSOUND_AMMUNATION_CHAT_3 = 105, - _SCRSOUND_BULLET_WALL_1 = 106, - _SCRSOUND_BULLET_WALL_2 = 107, - _SCRSOUND_BULLET_WALL_3 = 108, - _SCRSOUND_UNK_109 = 109, - _SCRSOUND_GLASSFX2_1 = 110, - _SCRSOUND_GLASSFX2_2 = 111, - _SCRSOUND_PHONE_RING = 112, - _SCRSOUND_UNK_113 = 113, - _SCRSOUND_GLASS_SMASH_1 = 114, - _SCRSOUND_GLASS_SMASH_2 = 115, - _SCRSOUND_GLASS_CRACK = 116, - _SCRSOUND_GLASS_SHARD = 117, - _SCRSOUND_WOODEN_BOX_SMASH = 118, - _SCRSOUND_CARDBOARD_BOX_SMASH = 119, - _SCRSOUND_COL_CAR = 120, - _SCRSOUND_TYRE_BUMP = 121, - _SCRSOUND_BULLET_SHELL_HIT_GROUND_1 = 122, - _SCRSOUND_BULLET_SHELL_HIT_GROUND_2 = 123, + SCRSOUND_TEST_1, + _SCRSOUND_UNK_1, + _SCRSOUND_UNK_2, + _SCRSOUND_UNK_3, + _SCRSOUND_CLUB_1_S, + _SCRSOUND_CLUB_1_L, + _SCRSOUND_CLUB_2_S, + _SCRSOUND_CLUB_2_L, + _SCRSOUND_CLUB_3_S, + _SCRSOUND_CLUB_3_L, + _SCRSOUND_CLUB_4_S, + _SCRSOUND_CLUB_4_L, + _SCRSOUND_CLUB_5_S, + _SCRSOUND_CLUB_5_L, + _SCRSOUND_CLUB_6_S, + _SCRSOUND_CLUB_6_L, + _SCRSOUND_CLUB_7_S, + _SCRSOUND_CLUB_7_L, + _SCRSOUND_CLUB_8_S, + _SCRSOUND_CLUB_8_L, + _SCRSOUND_CLUB_9_S, + _SCRSOUND_CLUB_9_L, + _SCRSOUND_CLUB_10_S, + _SCRSOUND_CLUB_10_L, + _SCRSOUND_CLUB_11_S, + _SCRSOUND_CLUB_11_L, + _SCRSOUND_CLUB_12_S, + _SCRSOUND_CLUB_12_L, + _SCRSOUND_CLUB_RAGGA_S, + _SCRSOUND_CLUB_RAGGA_L, + SCRSOUND_STRIP_CLUB_LOOP_1_S, + _SCRSOUND_STRIP_CLUB_LOOP_1_L, + SCRSOUND_STRIP_CLUB_LOOP_2_S, + _SCRSOUND_STRIP_CLUB_LOOP_2_L, + _SCRSOUND_SFX_WORKSHOP_1, + _SCRSOUND_SFX_WORKSHOP_2, + _SCRSOUND_SAWMILL_LOOP_S, + SCRSOUND_SAWMILL_LOOP_L, + _SCRSOUND_DOG_FOOD_FACTORY_S, + _SCRSOUND_DOG_FOOD_FACTORY_L, + _SCRSOUND_LAUNDERETTE_1, + _SCRSOUND_LAUNDERETTE_2, + _SCRSOUND_RESTAURANT_CHINATOWN_S, + _SCRSOUND_RESTAURANT_CHINATOWN_L, + _SCRSOUND_RESTAURANT_ITALY_S, + _SCRSOUND_RESTAURANT_ITALY_L, + _SCRSOUND_RESTAURANT_GENERIC_1_S, + _SCRSOUND_RESTAURANT_GENERIC_1_L, + _SCRSOUND_RESTAURANT_GENERIC_2_S, + _SCRSOUND_RESTAURANT_GENERIC_2_L, + _SCRSOUND_AIRPORT_ANNOUNCEMENT_S, + _SCRSOUND_AIRPORT_ANNOUNCEMENT_L, + _SCRSOUND_SHOP_LOOP_1, + _SCRSOUND_SHOP_LOOP_2, + _SCRSOUND_CINEMA_S, + _SCRSOUND_CINEMA_L, + _SCRSOUND_DOCKS_FOGHORN_S, + _SCRSOUND_DOCKS_FOGHORN_L, + _SCRSOUND_HOME_S, + _SCRSOUND_HOME_L, + _SCRSOUND_PIANO_BAR, + _SCRSOUND_CLUB, + SCRSOUND_PORN_CINEMA_1_S, + _SCRSOUND_PORN_CINEMA_1_L, + SCRSOUND_PORN_CINEMA_2_S, + _SCRSOUND_PORN_CINEMA_2_L, + SCRSOUND_PORN_CINEMA_3_S, + _SCRSOUND_PORN_CINEMA_3_L, + _SCRSOUND_BANK_ALARM_LOOP_S, + SCRSOUND_BANK_ALARM_LOOP_L, + _SCRSOUND_POLICE_BALL_LOOP_S, + SCRSOUND_POLICE_BALL_LOOP_L, + _SCRSOUND_RAVE_LOOP_INDUSTRIAL_S, + SCRSOUND_RAVE_LOOP_INDUSTRIAL_L, + _SCRSOUND_UNK_74, + _SCRSOUND_UNK_75, + _SCRSOUND_POLICE_CELL_BEATING_LOOP_S, + SCRSOUND_POLICE_CELL_BEATING_LOOP_L, + SCRSOUND_INJURED_PED_MALE_OUCH_S, + SCRSOUND_INJURED_PED_MALE_OUCH_L, + SCRSOUND_INJURED_PED_FEMALE_OUCH_S, + SCRSOUND_INJURED_PED_FEMALE_OUCH_L, + SCRSOUND_EVIDENCE_PICKUP, + SCRSOUND_UNLOAD_GOLD, + _SCRSOUND_RAVE_INDUSTRIAL_S, + _SCRSOUND_RAVE_INDUSTRIAL_L, + _SCRSOUND_RAVE_COMMERCIAL_S, + _SCRSOUND_RAVE_COMMERCIAL_L, + _SCRSOUND_RAVE_SUBURBAN_S, + _SCRSOUND_RAVE_SUBURBAN_L, + _SCRSOUND_GROAN_S, + _SCRSOUND_GROAN_L, + SCRSOUND_GATE_START_CLUNK, + SCRSOUND_GATE_STOP_CLUNK, + SCRSOUND_PART_MISSION_COMPLETE, + SCRSOUND_CHUNKY_RUN_SHOUT, + SCRSOUND_SECURITY_GUARD_RUN_AWAY_SHOUT, + SCRSOUND_RACE_START_1, + SCRSOUND_RACE_START_2, + SCRSOUND_RACE_START_3, + SCRSOUND_RACE_START_GO, + SCRSOUND_SWAT_PED_SHOUT, + SCRSOUND_PRETEND_FIRE_LOOP, + SCRSOUND_AMMUNATION_CHAT_1, + SCRSOUND_AMMUNATION_CHAT_2, + SCRSOUND_AMMUNATION_CHAT_3, + _SCRSOUND_BULLET_WALL_1, + _SCRSOUND_BULLET_WALL_2, + _SCRSOUND_BULLET_WALL_3, + _SCRSOUND_UNK_109, + _SCRSOUND_GLASSFX2_1, + _SCRSOUND_GLASSFX2_2, + _SCRSOUND_PHONE_RING, + _SCRSOUND_UNK_113, + _SCRSOUND_GLASS_SMASH_1, + _SCRSOUND_GLASS_SMASH_2, + _SCRSOUND_GLASS_CRACK, + _SCRSOUND_GLASS_SHARD, + _SCRSOUND_WOODEN_BOX_SMASH, + _SCRSOUND_CARDBOARD_BOX_SMASH, + _SCRSOUND_COL_CAR, + _SCRSOUND_TYRE_BUMP, + _SCRSOUND_BULLET_SHELL_HIT_GROUND_1, + _SCRSOUND_BULLET_SHELL_HIT_GROUND_2, + TOTAL_SCRSOUNDS, + SCRSOUND_INVALID }; class cAudioScriptObject @@ -142,6 +144,7 @@ public: static void operator delete(void*, size_t); static void operator delete(void*, int); + static void LoadAllAudioScriptObjects(uint8 *buf, uint32 size); static void SaveAllAudioScriptObjects(uint8 *buf, uint32 *size); }; diff --git a/src/audio/DMAudio.h b/src/audio/DMAudio.h index 125263f0..d2cdf466 100644 --- a/src/audio/DMAudio.h +++ b/src/audio/DMAudio.h @@ -1,7 +1,6 @@ #pragma once #include "audio_enums.h" -#include "Wanted.h" enum eSound : int16 { @@ -65,7 +64,7 @@ enum eSound : int16 SOUND_GARAGE_NO_MONEY = 57, SOUND_GARAGE_BAD_VEHICLE = 58, SOUND_GARAGE_OPENING = 59, - SOUND_3C = 60, + SOUND_GARAGE_BOMB_ALREADY_SET = 60, SOUND_GARAGE_BOMB1_SET = 61, SOUND_GARAGE_BOMB2_SET = 62, SOUND_GARAGE_BOMB3_SET = 63, diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index 1fac8a23..d840c57b 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -8,6 +8,7 @@ #include "Hud.h" #include "ModelIndices.h" #include "Replay.h" +#include "Pad.h" #include "Text.h" #include "Timer.h" #include "World.h" @@ -16,8 +17,6 @@ cMusicManager &MusicManager = *(cMusicManager *)0x8F3964; int32 &gNumRetunePresses = *(int32 *)0x650B80; -wchar *pCurrentStation = (wchar *)0x650B9C; -uint8 &cDisplay = *(uint8 *)0x650BA1; int32 &gRetuneCounter = *(int32*)0x650B84; bool& bHasStarted = *(bool*)0x650B7C; @@ -71,6 +70,8 @@ cMusicManager::DisplayRadioStationName() int8 pRetune; int8 gStreamedSound; int8 gRetuneCounter; + static wchar *pCurrentStation = nil; + static uint8 cDisplay = 0; if(!CTimer::GetIsPaused() && !TheCamera.m_WideScreenOn && PlayerInCar() && !CReplay::IsPlayingBack()) { diff --git a/src/audio/PoliceRadio.h b/src/audio/PoliceRadio.h index 152a5ee2..4c7030f1 100644 --- a/src/audio/PoliceRadio.h +++ b/src/audio/PoliceRadio.h @@ -1,5 +1,7 @@ #pragma once
+#include "Wanted.h"
+
struct cAMCrime {
int32 type;
CVector position;
|