Police Radio fixes

This commit is contained in:
Sergeanur 2020-10-22 12:35:38 +03:00
parent 70f625d211
commit 94f0ecfa21
3 changed files with 11 additions and 11 deletions

View File

@ -432,7 +432,7 @@ public:
void ReleaseDigitalHandle() const; void ReleaseDigitalHandle() const;
void ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, void ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2,
float collisionPower, float intensity2); float collisionPower, float intensity2);
void ReportCrime(int32 crime, const CVector *pos); void ReportCrime(eCrimeType crime, const CVector &pos);
void ResetAudioLogicTimers(uint32 timer); void ResetAudioLogicTimers(uint32 timer);
void ResetPoliceRadio(); void ResetPoliceRadio();
void ResetTimers(uint32 time); void ResetTimers(uint32 time);

View File

@ -203,7 +203,7 @@ cDMAudio::IsAudioInitialised(void)
void void
cDMAudio::ReportCrime(eCrimeType crime, const CVector &pos) cDMAudio::ReportCrime(eCrimeType crime, const CVector &pos)
{ {
AudioManager.ReportCrime(crime, &pos); AudioManager.ReportCrime(crime, pos);
} }
int32 int32

View File

@ -91,7 +91,7 @@ cAudioManager::InitialisePoliceRadio()
m_sPoliceRadioQueue.policeChannelTimerSeconds = 0; m_sPoliceRadioQueue.policeChannelTimerSeconds = 0;
m_sPoliceRadioQueue.policeChannelCounterSeconds = 0; m_sPoliceRadioQueue.policeChannelCounterSeconds = 0;
for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++) for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++)
m_sPoliceRadioQueue.crimes[i].type = 0; m_sPoliceRadioQueue.crimes[i].type = CRIME_NONE;
SampleManager.SetChannelReverbFlag(policeChannel, 0); SampleManager.SetChannelReverbFlag(policeChannel, 0);
gSpecialSuspectLastSeenReport = false; gSpecialSuspectLastSeenReport = false;
@ -154,7 +154,7 @@ cAudioManager::ServicePoliceRadio()
if(!m_bIsInitialised) return; if(!m_bIsInitialised) return;
if(!m_nUserPause) { if(m_nUserPause == 0) {
bool crimeReport = SetupCrimeReport(); bool 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)
@ -162,8 +162,8 @@ cAudioManager::ServicePoliceRadio()
#endif #endif
wantedLevel = FindPlayerPed()->m_pWanted->m_nWantedLevel; wantedLevel = FindPlayerPed()->m_pWanted->m_nWantedLevel;
if(!crimeReport) { if(!crimeReport) {
if(wantedLevel) { if(wantedLevel != 0) {
if(nLastSeen) { if(nLastSeen != 0) {
--nLastSeen; --nLastSeen;
} else { } else {
nLastSeen = m_anRandomTable[1] % 1000 + 2000; nLastSeen = m_anRandomTable[1] % 1000 + 2000;
@ -189,7 +189,7 @@ cAudioManager::ServicePoliceRadioChannel(int32 wantedLevel)
if (!m_bIsInitialised) return; if (!m_bIsInitialised) return;
if (m_nUserPause) { if (m_nUserPause != 0) {
if (SampleManager.GetChannelUsedFlag(policeChannel)) SampleManager.StopChannel(policeChannel); if (SampleManager.GetChannelUsedFlag(policeChannel)) SampleManager.StopChannel(policeChannel);
if (g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES && bMissionAudioPhysicalPlayingStatus == 1 && if (g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES && bMissionAudioPhysicalPlayingStatus == 1 &&
SampleManager.IsStreamPlaying(1)) { SampleManager.IsStreamPlaying(1)) {
@ -241,7 +241,7 @@ cAudioManager::ServicePoliceRadioChannel(int32 wantedLevel)
} else { } else {
sample = TOTAL_AUDIO_SAMPLES; sample = TOTAL_AUDIO_SAMPLES;
} }
if (!wantedLevel) { if (wantedLevel == 0) {
if (gSpecialSuspectLastSeenReport) { if (gSpecialSuspectLastSeenReport) {
gSpecialSuspectLastSeenReport = 0; gSpecialSuspectLastSeenReport = 0;
} else if (((sample >= SFX_POLICE_RADIO_MESSAGE_NOISE_1) && (sample <= SFX_POLICE_RADIO_MESSAGE_NOISE_3)) || sample == TOTAL_AUDIO_SAMPLES) { } else if (((sample >= SFX_POLICE_RADIO_MESSAGE_NOISE_1) && (sample <= SFX_POLICE_RADIO_MESSAGE_NOISE_3)) || sample == TOTAL_AUDIO_SAMPLES) {
@ -675,7 +675,7 @@ cAudioManager::SetupSuspectLastSeenReport()
void void
cAudioManager::ReportCrime(int32 type, const CVector *pos) cAudioManager::ReportCrime(eCrimeType type, const CVector &pos)
{ {
int32 lastCrime = ARRAY_SIZE(m_sPoliceRadioQueue.crimes); int32 lastCrime = ARRAY_SIZE(m_sPoliceRadioQueue.crimes);
if (m_bIsInitialised && MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE && FindPlayerPed()->m_pWanted->m_nWantedLevel > 0 && if (m_bIsInitialised && MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE && FindPlayerPed()->m_pWanted->m_nWantedLevel > 0 &&
@ -683,7 +683,7 @@ cAudioManager::ReportCrime(int32 type, const CVector *pos)
for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++) { for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++) {
if (m_sPoliceRadioQueue.crimes[i].type) { if (m_sPoliceRadioQueue.crimes[i].type) {
if (m_sPoliceRadioQueue.crimes[i].type == type) { if (m_sPoliceRadioQueue.crimes[i].type == type) {
m_sPoliceRadioQueue.crimes[i].position = *pos; m_sPoliceRadioQueue.crimes[i].position = pos;
m_sPoliceRadioQueue.crimes[i].timer = 0; m_sPoliceRadioQueue.crimes[i].timer = 0;
return; return;
} }
@ -694,7 +694,7 @@ cAudioManager::ReportCrime(int32 type, const CVector *pos)
if (lastCrime < ARRAY_SIZE(m_sPoliceRadioQueue.crimes)) { if (lastCrime < ARRAY_SIZE(m_sPoliceRadioQueue.crimes)) {
m_sPoliceRadioQueue.crimes[lastCrime].type = type; m_sPoliceRadioQueue.crimes[lastCrime].type = type;
m_sPoliceRadioQueue.crimes[lastCrime].position = *pos; m_sPoliceRadioQueue.crimes[lastCrime].position = pos;
m_sPoliceRadioQueue.crimes[lastCrime].timer = 0; m_sPoliceRadioQueue.crimes[lastCrime].timer = 0;
gMinTimeToNextReport[type] = m_FrameCounter + 500; gMinTimeToNextReport[type] = m_FrameCounter + 500;
} }