More type fixes in audio

This commit is contained in:
Sergeanur 2021-08-18 15:31:58 +03:00
parent d4175c5315
commit 5c562c3adc
4 changed files with 23 additions and 23 deletions

View file

@ -6054,7 +6054,7 @@ cPedComments::Process()
uint8 actualUsedBank; uint8 actualUsedBank;
tPedComment *comment; tPedComment *comment;
if (AudioManager.m_nUserPause != 0) return; if (AudioManager.m_nUserPause) return;
if (m_nCommentsInBank[m_nActiveBank]) { if (m_nCommentsInBank[m_nActiveBank]) {
sampleIndex = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nSampleIndex; sampleIndex = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nSampleIndex;

View file

@ -245,8 +245,8 @@ public:
cMissionAudio m_sMissionAudio; cMissionAudio m_sMissionAudio;
int32 m_anRandomTable[5]; int32 m_anRandomTable[5];
uint8 m_nTimeSpent; uint8 m_nTimeSpent;
uint8 m_nUserPause; bool8 m_nUserPause;
uint8 m_nPreviousUserPause; bool8 m_nPreviousUserPause;
uint32 m_FrameCounter; uint32 m_FrameCounter;
cAudioManager(); cAudioManager();

View file

@ -363,14 +363,14 @@ cMusicManager::GetRadioInCar(void)
CVehicle *veh = FindPlayerVehicle(); CVehicle *veh = FindPlayerVehicle();
if (veh != nil){ if (veh != nil){
if (UsesPoliceRadio(veh)) { if (UsesPoliceRadio(veh)) {
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && AudioManager.m_nUserPause == 0)) if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && !AudioManager.m_nUserPause))
return POLICE_RADIO; return POLICE_RADIO;
return m_nRadioInCar; return m_nRadioInCar;
} else return veh->m_nRadioStation; } else return veh->m_nRadioStation;
} }
} }
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && AudioManager.m_nUserPause == 0)) if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && !AudioManager.m_nUserPause))
return RADIO_OFF; return RADIO_OFF;
return m_nRadioInCar; return m_nRadioInCar;
} }

View file

@ -26,7 +26,7 @@ char SubZo2Label[8];
char SubZo3Label[8]; char SubZo3Label[8];
uint32 g_nMissionAudioSfx = TOTAL_AUDIO_SAMPLES; uint32 g_nMissionAudioSfx = TOTAL_AUDIO_SAMPLES;
int8 g_nMissionAudioPlayingStatus = 2; int8 g_nMissionAudioPlayingStatus = PLAY_STATUS_FINISHED;
uint8 gSpecialSuspectLastSeenReport; uint8 gSpecialSuspectLastSeenReport;
uint32 gMinTimeToNextReport[NUM_CRIME_TYPES]; uint32 gMinTimeToNextReport[NUM_CRIME_TYPES];
@ -109,8 +109,8 @@ void
cAudioManager::SetMissionScriptPoliceAudio(uint32 sfx) cAudioManager::SetMissionScriptPoliceAudio(uint32 sfx)
{ {
if (!m_bIsInitialised) return; if (!m_bIsInitialised) return;
if (g_nMissionAudioPlayingStatus != 1) { if (g_nMissionAudioPlayingStatus != PLAY_STATUS_PLAYING) {
g_nMissionAudioPlayingStatus = 0; g_nMissionAudioPlayingStatus = PLAY_STATUS_STOPPED;
g_nMissionAudioSfx = sfx; g_nMissionAudioSfx = sfx;
} }
} }
@ -151,7 +151,7 @@ cAudioManager::ServicePoliceRadio()
if(!m_bIsInitialised) return; if(!m_bIsInitialised) return;
if(m_nUserPause == 0) { if(!m_nUserPause) {
bool8 crimeReport = SetupCrimeReport(); bool8 crimeReport = SetupCrimeReport();
#ifdef FIX_BUGS // Crash at 0x5fe6ef #ifdef FIX_BUGS // Crash at 0x5fe6ef
if(CReplay::IsPlayingBack() || !FindPlayerPed() || !FindPlayerPed()->m_pWanted) if(CReplay::IsPlayingBack() || !FindPlayerPed() || !FindPlayerPed()->m_pWanted)
@ -185,20 +185,20 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
static int cWait = 0; static int cWait = 0;
static bool8 bChannelOpen = FALSE; static bool8 bChannelOpen = FALSE;
static uint8 bMissionAudioPhysicalPlayingStatus = 0; static uint8 bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_STOPPED;
static int32 PoliceChannelFreq = 5500; static int32 PoliceChannelFreq = 5500;
if (!m_bIsInitialised) return; if (!m_bIsInitialised) return;
if (m_nUserPause != 0) { if (m_nUserPause) {
if (SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) SampleManager.StopChannel(CHANNEL_POLICE_RADIO); if (SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) SampleManager.StopChannel(CHANNEL_POLICE_RADIO);
if (g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES && bMissionAudioPhysicalPlayingStatus == 1 && if (g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES && bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING &&
SampleManager.IsStreamPlaying(1)) { SampleManager.IsStreamPlaying(1)) {
SampleManager.PauseStream(TRUE, 1); SampleManager.PauseStream(TRUE, 1);
} }
} else { } else {
if (m_nPreviousUserPause && g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES && if (m_nPreviousUserPause && g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES &&
bMissionAudioPhysicalPlayingStatus == 1) { bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING) {
SampleManager.PauseStream(FALSE, 1); SampleManager.PauseStream(FALSE, 1);
} }
if (m_sPoliceRadioQueue.policeChannelTimer == 0) bChannelOpen = FALSE; if (m_sPoliceRadioQueue.policeChannelTimer == 0) bChannelOpen = FALSE;
@ -211,17 +211,17 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
return; return;
} }
if (g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES && !bChannelOpen) { if (g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES && !bChannelOpen) {
if (g_nMissionAudioPlayingStatus) { if (g_nMissionAudioPlayingStatus != PLAY_STATUS_STOPPED) {
if (g_nMissionAudioPlayingStatus == 1 && !bMissionAudioPhysicalPlayingStatus && if (g_nMissionAudioPlayingStatus == PLAY_STATUS_PLAYING && bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_STOPPED &&
SampleManager.IsStreamPlaying(1)) { SampleManager.IsStreamPlaying(1)) {
bMissionAudioPhysicalPlayingStatus = 1; bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_PLAYING;
} }
if (bMissionAudioPhysicalPlayingStatus == 1) { if (bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING) {
if (SampleManager.IsStreamPlaying(1)) { if (SampleManager.IsStreamPlaying(1)) {
DoPoliceRadioCrackle(); DoPoliceRadioCrackle();
} else { } else {
bMissionAudioPhysicalPlayingStatus = 2; bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_FINISHED;
g_nMissionAudioPlayingStatus = 2; g_nMissionAudioPlayingStatus = PLAY_STATUS_FINISHED;
g_nMissionAudioSfx = TOTAL_AUDIO_SAMPLES; g_nMissionAudioSfx = TOTAL_AUDIO_SAMPLES;
cWait = 30; cWait = 30;
} }
@ -231,13 +231,13 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
SampleManager.PreloadStreamedFile(g_nMissionAudioSfx, 1); SampleManager.PreloadStreamedFile(g_nMissionAudioSfx, 1);
SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, TRUE, 1); SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, TRUE, 1);
SampleManager.StartPreloadedStreamedFile(1); SampleManager.StartPreloadedStreamedFile(1);
g_nMissionAudioPlayingStatus = 1; g_nMissionAudioPlayingStatus = PLAY_STATUS_PLAYING;
bMissionAudioPhysicalPlayingStatus = 0; bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_STOPPED;
return; return;
} }
} }
if (bChannelOpen) DoPoliceRadioCrackle(); if (bChannelOpen) DoPoliceRadioCrackle();
if ((g_nMissionAudioSfx == TOTAL_AUDIO_SAMPLES || g_nMissionAudioPlayingStatus != 1) && if ((g_nMissionAudioSfx == TOTAL_AUDIO_SAMPLES || g_nMissionAudioPlayingStatus != PLAY_STATUS_PLAYING) &&
!SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO) && m_sPoliceRadioQueue.policeChannelTimer) { !SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO) && m_sPoliceRadioQueue.policeChannelTimer) {
if (m_sPoliceRadioQueue.policeChannelTimer) { if (m_sPoliceRadioQueue.policeChannelTimer) {
sample = m_sPoliceRadioQueue.crimesSamples[m_sPoliceRadioQueue.policeChannelCounterSeconds]; sample = m_sPoliceRadioQueue.crimesSamples[m_sPoliceRadioQueue.policeChannelCounterSeconds];
@ -292,7 +292,7 @@ cAudioManager::SetupCrimeReport()
float quarterX; float quarterX;
float quarterY; float quarterY;
int i; int i;
int32 sampleIndex; uint32 sampleIndex;
bool8 processed = FALSE; bool8 processed = FALSE;
if (MusicManager.m_nMusicMode == MUSICMODE_CUTSCENE) return FALSE; if (MusicManager.m_nMusicMode == MUSICMODE_CUTSCENE) return FALSE;