Audio: refactoring, type fixes, renaming cAudioManager fields

This commit is contained in:
Sergeanur
2021-08-25 08:49:58 +03:00
parent d4a2113a8a
commit c8492ab5e0
8 changed files with 189 additions and 192 deletions

View File

@@ -229,9 +229,9 @@ cAudioManager::PostTerminateGameSpecificShutdown()
void
cAudioManager::ResetAudioLogicTimers(uint32 timer)
{
for (int32 i = 0; i < m_nAudioEntitiesTotal; i++) {
if (m_asAudioEntities[m_anAudioEntityIndices[i]].m_nType == AUDIOTYPE_PHYSICAL) {
CPed *ped = (CPed *)m_asAudioEntities[m_anAudioEntityIndices[i]].m_pEntity;
for (uint32 i = 0; i < m_nAudioEntitiesCount; i++) {
if (m_asAudioEntities[m_aAudioEntityOrderList[i]].m_nType == AUDIOTYPE_PHYSICAL) {
CPed *ped = (CPed *)m_asAudioEntities[m_aAudioEntityOrderList[i]].m_pEntity;
if (ped->IsPed()) {
ped->m_lastSoundStart = timer;
ped->m_soundStart = timer + m_anRandomTable[0] % 3000;
@@ -299,8 +299,8 @@ cAudioManager::ProcessSpecial()
CPlayerPed *playerPed;
CVehicle *remoteVehicle;
if (m_nUserPause) {
if (!m_nPreviousUserPause) {
if (m_bIsPaused) {
if (!m_bWasPaused) {
SampleManager.SetEffectsFadeVolume(MAX_VOLUME);
SampleManager.SetMusicFadeVolume(MAX_VOLUME);
}
@@ -325,45 +325,45 @@ cAudioManager::ProcessEntity(int32 id)
m_sQueueSample.m_nEntityIndex = id;
switch (m_asAudioEntities[id].m_nType) {
case AUDIOTYPE_PHYSICAL:
if (!m_nUserPause) {
if (!m_bIsPaused) {
SET_SOUND_REVERB(TRUE);
ProcessPhysical(id);
}
break;
case AUDIOTYPE_EXPLOSION:
if (!m_nUserPause) {
if (!m_bIsPaused) {
SET_SOUND_REVERB(TRUE);
ProcessExplosions(id);
}
break;
case AUDIOTYPE_FIRE:
if (!m_nUserPause) {
if (!m_bIsPaused) {
SET_SOUND_REVERB(TRUE);
ProcessFires(id);
}
break;
case AUDIOTYPE_WEATHER:
if (!m_nUserPause) {
if (!m_bIsPaused) {
SET_SOUND_REVERB(TRUE);
if(CGame::currArea == AREA_MAIN_MAP || CGame::currArea == AREA_EVERYWHERE)
ProcessWeather(id);
}
break;
/* case AUDIOTYPE_CRANE:
if (!m_nUserPause) {
if (!m_bIsPaused) {
SET_SOUND_REVERB(TRUE);
ProcessCrane();
}
break;*/
case AUDIOTYPE_SCRIPTOBJECT:
if (!m_nUserPause) {
if (!m_bIsPaused) {
SET_SOUND_REVERB(TRUE);
ProcessScriptObject(id);
}
break;
#ifdef GTA_BRIDGE
case AUDIOTYPE_BRIDGE:
if (!m_nUserPause) {
if (!m_bIsPaused) {
SET_SOUND_REVERB(TRUE);
ProcessBridge();
}
@@ -374,35 +374,35 @@ cAudioManager::ProcessEntity(int32 id)
ProcessFrontEnd();
break;
case AUDIOTYPE_PROJECTILE:
if (!m_nUserPause) {
if (!m_bIsPaused) {
SET_SOUND_REVERB(TRUE);
ProcessProjectiles();
}
break;
case AUDIOTYPE_GARAGE:
if (!m_nUserPause)
if (!m_bIsPaused)
ProcessGarages();
break;
case AUDIOTYPE_FIREHYDRANT:
if (!m_nUserPause) {
if (!m_bIsPaused) {
SET_SOUND_REVERB(TRUE);
ProcessFireHydrant();
}
break;
case AUDIOTYPE_WATERCANNON:
if (!m_nUserPause) {
if (!m_bIsPaused) {
SET_SOUND_REVERB(TRUE);
ProcessWaterCannon(id);
}
break;
case AUDIOTYPE_ESCALATOR:
if (!m_nUserPause) {
if (!m_bIsPaused) {
SET_SOUND_REVERB(TRUE);
ProcessEscalators();
}
break;
case AUDIOTYPE_EXTRA_SOUNDS:
if (!m_nUserPause) {
if (!m_bIsPaused) {
SET_SOUND_REVERB(TRUE);
ProcessExtraSounds();
}
@@ -683,7 +683,7 @@ const tVehicleSampleData aVehicleSettings[MAX_CARS] = {
bool8 bPlayerJustEnteredCar;
const bool8 hornPatternsArray[8][44] = {
const bool8 HornPattern[8][44] = {
{FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE,
FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE},
{FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
@@ -1717,11 +1717,11 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams& params)
switch (transmission->nDriveType) {
case '4':
if (params.m_VehicleType == VEHICLE_TYPE_BIKE) {
for (int i = 0; i < 2; i++)
for (uint8 i = 0; i < 2; i++)
if (wheelState[i] == WHEEL_STATE_SPINNING)
traction += 0.1f;
} else {
for (int i = 0; i < 4; i++)
for (uint8 i = 0; i < 4; i++)
if (wheelState[i] == WHEEL_STATE_SPINNING)
traction += 0.05f;
}
@@ -2004,7 +2004,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
static uint8 CurrentPretendGear = 1;
static bool8 bLostTractionLastFrame = FALSE;
static bool8 bHandbrakeOnLastFrame = FALSE;
static int32 nCruising = 0;
static uint32 nCruising = 0;
static bool8 bAccelSampleStopped = TRUE;
bool8 lostTraction = FALSE;
@@ -2078,7 +2078,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
wheelInUseCounter = 0;
for (uint8 i = 0; i < 4; i++) {
if (wheelState[i] != WHEEL_STATE_NORMAL)
++wheelInUseCounter;
wheelInUseCounter++;
}
if (wheelInUseCounter > 2)
lostTraction = TRUE;
@@ -2184,7 +2184,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
gasPedalAudio = accelerationMultipler;
switch (engineSoundType) {
case SFX_BANK_MOPED:
++soundOffset;
soundOffset++;
break;
case SFX_BANK_HONDA250:
soundOffset += 2;
@@ -2244,38 +2244,54 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
AddPlayerCarSample(vol, freq, engineSoundType - CAR_SFX_BANKS_OFFSET + SFX_CAR_IDLE_1, SFX_BANK_0, 52, TRUE);
CurrentPretendGear = Max(1, currentGear);
}
else {
if (nCruising == 0){
} else {
if (nCruising > 0) {
PlayCruising:
bAccelSampleStopped = TRUE;
SampleManager.StopChannel(nChannel);
if (!isMoped && (accelerateState < 150 || wheelsOnGround == 0 || brakeState > 0 || params.m_pVehicle->bIsHandbrakeOn
|| lostTraction || currentGear < params.m_pTransmission->nNumberOfGears - 1)) {
nCruising = 0;
} else {
if (accelerateState >= 220 && params.m_fVelocityChange + 0.001f >= velocityChangeForAudio) {
if (nCruising < 800)
nCruising++;
} else if (nCruising > 3)
nCruising--;
freq = 27 * nCruising + freqModifier + 22050;
if (engineSoundType == SFX_BANK_TRUCK)
freq >>= 1;
AddPlayerCarSample(120, freq, soundOffset + SFX_CAR_AFTER_ACCEL_1, engineSoundType, 64, TRUE);
}
} else {
stuckInSand = params.m_VehicleType == VEHICLE_TYPE_CAR && ((CAutomobile*)params.m_pVehicle)->bStuckInSand;
if (accelerateState < 150 || wheelsOnGround == 0 || params.m_pVehicle->bIsHandbrakeOn || lostTraction
|| (currentGear < 2 && params.m_fVelocityChange - velocityChangeForAudio < 0.01f) || brakeState > 0) {
if (((wheelsOnGround && !params.m_pVehicle->bIsHandbrakeOn && !lostTraction ) || stuckInSand) && brakeState <= 0) {
baseFreq = (8000.0f * accelerationMultipler) + 16000;
vol = (25.0f * accelerationMultipler) + 60;
*gasPedalAudioPtr = accelerationMultipler;
} else {
if (((wheelsOnGround == 0 || params.m_pVehicle->bIsHandbrakeOn || lostTraction) && !stuckInSand) || brakeState > 0) {
if (wheelsOnGround == 0 && wheelsOnGroundPrev != 0 || (params.m_pVehicle->bIsHandbrakeOn && !bHandbrakeOnLastFrame || lostTraction && !bLostTractionLastFrame)
&& wheelsOnGround != 0) {
*gasPedalAudioPtr *= 0.6f;
}
freqModifier = 0;
if (engineSoundType != SFX_BANK_GOLF_CART && engineSoundType != SFX_BANK_CAR_CHAINSAW)
baseFreq = (25000.0f * *gasPedalAudioPtr) + 14000;
if (engineSoundType == SFX_BANK_GOLF_CART || engineSoundType == SFX_BANK_CAR_CHAINSAW)
baseFreq = (15000 * *gasPedalAudioPtr) + 14000;
else
baseFreq = (15000.0f * *gasPedalAudioPtr) + 14000;
baseFreq = (25000 * *gasPedalAudioPtr) + 14000;
vol = (25.0f * *gasPedalAudioPtr) + 60;
} else {
baseFreq = (8000 * accelerationMultipler) + 16000;
vol = (25.0f * accelerationMultipler) + 60;
*gasPedalAudioPtr = accelerationMultipler;
}
freq = freqModifier + baseFreq;
if (engineSoundType == SFX_BANK_TRUCK)
freq /= 2;
freq >>= 1;
if (channelUsed) {
SampleManager.StopChannel(nChannel);
bAccelSampleStopped = TRUE;
}
if (params.m_pVehicle->bIsDrowning)
vol /= 4;
vol >>= 2;
AddPlayerCarSample(vol, freq, engineSoundType - CAR_SFX_BANKS_OFFSET + SFX_CAR_REV_1, SFX_BANK_0, 2, TRUE);
} else {
TranslateEntity(&m_sQueueSample.m_vecPos, &pos);
@@ -2288,16 +2304,18 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
processedAccelSampleStopped = TRUE;
bAccelSampleStopped = FALSE;
}
if (!channelUsed) {
if (!processedAccelSampleStopped) {
if (CurrentPretendGear < params.m_pTransmission->nNumberOfGears - 1)
++CurrentPretendGear;
CurrentPretendGear++;
else {
nCruising = 1;
params.m_pVehicle->bAudioChangingGear = TRUE;
goto PlayCruising;
}
}
gearSoundStartTime = CTimer::GetTimeInMilliseconds();
params.m_pVehicle->bAudioChangingGear = TRUE;
#ifdef GTA_PS2
@@ -2322,7 +2340,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
#endif
freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050;
if (engineSoundType == SFX_BANK_TRUCK)
freq /= 2;
freq >>= 1;
#ifdef USE_TIME_SCALE_FOR_AUDIO
SampleManager.SetChannelFrequency(nChannel, freq * CTimer::GetTimeScale());
#else
@@ -2335,30 +2353,11 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
SampleManager.StartChannel(nChannel);
}
}
} else {
PlayCruising:
bAccelSampleStopped = TRUE;
SampleManager.StopChannel(nChannel);
if (!isMoped && (accelerateState < 150 || wheelsOnGround == 0 || brakeState > 0 || params.m_pVehicle->bIsHandbrakeOn
|| lostTraction || currentGear < params.m_pTransmission->nNumberOfGears - 1)) {
nCruising = 0;
} else {
if (accelerateState >= 220 && params.m_fVelocityChange + 0.001f >= velocityChangeForAudio) {
if (nCruising < 800)
++nCruising;
} else if (nCruising > 3) {
--nCruising;
}
freq = 27 * nCruising + freqModifier + 22050;
if (engineSoundType == SFX_BANK_TRUCK)
freq /= 2;
AddPlayerCarSample(120, freq, soundOffset + SFX_CAR_AFTER_ACCEL_1, engineSoundType, 64, TRUE);
}
}
}
LastAccel = accelerateState;
bHandbrakeOnLastFrame = params.m_pVehicle->bIsHandbrakeOn;
bHandbrakeOnLastFrame = !!params.m_pVehicle->bIsHandbrakeOn;
bLostTractionLastFrame = lostTraction;
}
@@ -2405,7 +2404,7 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams& params)
return TRUE;
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
for (int32 i = 0; i < numWheels; i++) {
for (uint8 i = 0; i < numWheels; i++) {
if (wheelStateArr[i] == WHEEL_STATE_NORMAL)
continue;
transmission = params.m_pTransmission;
@@ -2554,7 +2553,7 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams& params)
if (veh->m_nCarHornTimer == 44)
veh->m_nCarHornPattern = (m_FrameCounter + m_sQueueSample.m_nEntityIndex) & 7;
if (!hornPatternsArray[veh->m_nCarHornPattern][44 - veh->m_nCarHornTimer])
if (!HornPattern[veh->m_nCarHornPattern][44 - veh->m_nCarHornTimer])
return TRUE;
}
@@ -2729,7 +2728,7 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams& params)
automobile = (CAutomobile *)params.m_pVehicle;
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
for (int32 i = 0; i < ARRAY_SIZE(automobile->Doors); i++) {
for (uint8 i = 0; i < ARRAY_SIZE(automobile->Doors); i++) {
if (automobile->Damage.GetDoorStatus(i) == DOOR_STATUS_SWINGING) {
doorState = automobile->Doors[i].m_nDoorState;
if (doorState == DOORST_OPEN || doorState == DOORST_CLOSED) {
@@ -3448,7 +3447,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params)
m_sQueueSample.m_nPriority = 1;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_MaxDistance = SOUND_INTENSITY;
++CrunchOffset;
CrunchOffset++;
maxDist = SQR(SOUND_INTENSITY);
emittingVol = m_anRandomTable[4] % 20 + 55;
CrunchOffset %= 2;
@@ -4299,7 +4298,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nCounter = iSound;
narrowSoundRange = TRUE;
++iSound;
iSound++;
m_sQueueSample.m_nPriority = 3;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_MaxDistance = 30.0f;
@@ -4944,7 +4943,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nCounter = iSound;
stereo = TRUE;
++iSound;
iSound++;
m_sQueueSample.m_nFrequency = m_anRandomTable[1] % 1000 + 17000;
if (param2 == 0)
m_sQueueSample.m_nFrequency = (3 * m_sQueueSample.m_nFrequency) / 4;
@@ -5079,15 +5078,14 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
AddSampleToRequestedQueue();
if (stereo) {
m_sQueueSample.m_nPan = 127;
++m_sQueueSample.m_nSampleIndex;
m_sQueueSample.m_nSampleIndex++;
if (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] != SOUND_WEAPON_SHOT_FIRED ||
weapon->m_eWeaponType != WEAPONTYPE_FLAMETHROWER) {
m_sQueueSample.m_nCounter = iSound++;
if (iSound > 60)
iSound = 21;
} else {
++m_sQueueSample.m_nCounter;
}
} else
m_sQueueSample.m_nCounter++;
AddSampleToRequestedQueue();
}
}
@@ -7808,18 +7806,16 @@ cPedComments::Add(tPedComment *com)
index = m_nIndexMap[m_nActiveBank][NUM_PED_COMMENTS_SLOTS - 1];
if (m_asPedComments[m_nActiveBank][index].m_nVolume > com->m_nVolume)
return;
} else {
} else
index = m_nCommentsInBank[m_nActiveBank]++;
}
m_asPedComments[m_nActiveBank][index] = *com;
uint32 i = 0;
uint8 i = 0;
if (index != 0) {
for (i = 0; i < index; i++) {
if (m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][i]].m_nVolume < m_asPedComments[m_nActiveBank][index].m_nVolume) {
if (m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][i]].m_nVolume < m_asPedComments[m_nActiveBank][index].m_nVolume)
break;
}
}
if (i < index)
@@ -7838,7 +7834,7 @@ cPedComments::Process()
static uint8 counter = 0;
static int32 prevSamples[10] = { NO_SAMPLE, NO_SAMPLE, NO_SAMPLE, NO_SAMPLE, NO_SAMPLE, NO_SAMPLE, NO_SAMPLE, NO_SAMPLE, NO_SAMPLE, NO_SAMPLE };
if(AudioManager.m_nUserPause) return;
if(AudioManager.m_bIsPaused) return;
if(m_nCommentsInBank[m_nActiveBank]) {
for(int i = 0; i < ARRAY_SIZE(prevSamples); i++) {
@@ -7935,7 +7931,7 @@ PedCommentAlreadyAdded:
comment = m_asPedComments[actualUsedBank];
for (uint32 i = 0; i < m_nCommentsInBank[actualUsedBank]; i++) {
if (m_asPedComments[actualUsedBank][m_nIndexMap[actualUsedBank][i]].m_nProcess > 0) {
--m_asPedComments[actualUsedBank][m_nIndexMap[actualUsedBank][i]].m_nProcess;
m_asPedComments[actualUsedBank][m_nIndexMap[actualUsedBank][i]].m_nProcess--;
Add(&comment[m_nIndexMap[actualUsedBank][i]]);
}
}
@@ -8124,7 +8120,7 @@ cAudioManager::ProcessWaterCannon(int32)
{
const float SOUND_INTENSITY = 30.0f;
for (int32 i = 0; i < NUM_WATERCANNONS; i++) {
for (uint32 i = 0; i < NUM_WATERCANNONS; i++) {
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);
@@ -8949,13 +8945,13 @@ cAudioManager::ProcessFrontEnd()
SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
if (stereo) {
++m_sQueueSample.m_nSampleIndex;
m_sQueueSample.m_nSampleIndex++;
m_sQueueSample.m_nCounter = iSound++;
m_sQueueSample.m_nPan = 127 - m_sQueueSample.m_nPan;
AddSampleToRequestedQueue();
}
if (center) {
++m_sQueueSample.m_nSampleIndex;
m_sQueueSample.m_nSampleIndex++;
m_sQueueSample.m_nCounter = iSound++;
m_sQueueSample.m_nPan = 63;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
@@ -9020,7 +9016,7 @@ cAudioManager::ProcessProjectiles()
uint8 emittingVol;
float distSquared;
for (int32 i = 0; i < NUM_PROJECTILES; i++) {
for (uint8 i = 0; i < NUM_PROJECTILES; i++) {
if (CProjectileInfo::GetProjectileInfo(i)->m_bInUse) {
switch (CProjectileInfo::GetProjectileInfo(i)->m_eWeaponType) {
case WEAPONTYPE_TEARGAS:
@@ -9164,7 +9160,11 @@ cAudioManager::ProcessGarages()
static uint8 iSound = 32;
for (uint32 i = 0; i < CGarages::NumGarages; ++i) {
#ifdef FIX_BUGS
for (uint32 i = 0; i < CGarages::NumGarages; i++) {
#else
for (uint8 i = 0; i < CGarages::NumGarages; i++) {
#endif
if (CGarages::aGarages[i].m_eGarageType == GARAGE_NONE)
continue;
entity = CGarages::aGarages[i].m_pDoor1;
@@ -9229,7 +9229,7 @@ cAudioManager::ProcessGarages()
break;
}
}
for (j = 0; j < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; ++j) {
for (j = 0; j < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; j++) {
switch (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[j]) {
case SOUND_GARAGE_DOOR_CLOSED:
case SOUND_GARAGE_DOOR_OPENED:
@@ -9813,7 +9813,7 @@ const MissionAudioData MissionAudioNameSfxAssoc[] = {
int32
FindMissionAudioSfx(const char *name)
{
for (uint32 i = 0; MissionAudioNameSfxAssoc[i].m_pName != nil; ++i) {
for (uint32 i = 0; MissionAudioNameSfxAssoc[i].m_pName != nil; i++) {
if (!CGeneral::faststricmp(MissionAudioNameSfxAssoc[i].m_pName, name))
return MissionAudioNameSfxAssoc[i].m_nId;
}
@@ -9825,7 +9825,7 @@ const char *
cAudioManager::GetMissionAudioLoadedLabel(uint8 slot)
{
if (m_bIsInitialised && slot < MISSION_AUDIO_SLOTS && m_nMissionAudioSampleIndex[slot] != NO_SAMPLE) {
for (uint32 i = 0; MissionAudioNameSfxAssoc[i].m_pName != nil; ++i) {
for (uint32 i = 0; MissionAudioNameSfxAssoc[i].m_pName != nil; i++) {
if (m_nMissionAudioSampleIndex[slot] == MissionAudioNameSfxAssoc[i].m_nId)
return MissionAudioNameSfxAssoc[i].m_pName;
}
@@ -9974,7 +9974,7 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
nFramesForPretendPlaying[slot] = 0;
nCheckPlayingDelay[slot] = 0;
nFramesUntilFailedLoad[slot] = 0;
} else if (!m_nUserPause) {
} else if (!m_bIsPaused) {
if (++nFramesForPretendPlaying[slot] < 90) {
m_nMissionAudioPlayStatus[slot] = PLAY_STATUS_PLAYING;
} else {
@@ -9989,7 +9989,7 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
if (MissionScriptAudioUsesPoliceChannel(m_nMissionAudioSampleIndex[slot])) {
SetMissionScriptPoliceAudio(m_nMissionAudioSampleIndex[slot]);
} else {
if (m_nUserPause)
if (m_bIsPaused)
SampleManager.PauseStream(TRUE, slot + 1);
if (m_bIsMissionAudio2D[slot]) {
if (m_nMissionAudioSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAL)
@@ -10028,7 +10028,7 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
break;
}
if (MissionScriptAudioUsesPoliceChannel(m_nMissionAudioSampleIndex[slot])) {
if (!m_nUserPause) {
if (!m_bIsPaused) {
if (nCheckPlayingDelay[slot]) {
--nCheckPlayingDelay[slot];
} else if ((g_bMissionAudioLoadFailed[slot] && m_nMissionAudioFramesToPlay[slot]-- == 0) || GetMissionScriptPoliceAudioPlayingStatus() == PLAY_STATUS_FINISHED) {
@@ -10041,8 +10041,8 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
}
}
} else if (m_bIsMissionAudioPlaying[slot]) {
if (SampleManager.IsStreamPlaying(slot + 1) || m_nUserPause || m_nPreviousUserPause) {
if (m_nUserPause)
if (SampleManager.IsStreamPlaying(slot + 1) || m_bIsPaused || m_bWasPaused) {
if (m_bIsPaused)
SampleManager.PauseStream(TRUE, slot + 1);
else
{
@@ -10075,7 +10075,7 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
m_nMissionAudioFramesToPlay[slot] = 0;
}
} else {
if (m_nUserPause)
if (m_bIsPaused)
break;
if (nCheckPlayingDelay[slot]--) {
if (!SampleManager.IsStreamPlaying(slot + 1))