From 14c71f39ff97684e6c6933cf18781e8d162d1be6 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 24 Jun 2021 13:47:10 +0300 Subject: High FPS Fixes --- src/audio/AudioManager.cpp | 10 ++++++++-- src/audio/MusicManager.cpp | 4 ++++ src/audio/PolRadio.cpp | 8 ++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) (limited to 'src/audio') diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index e2596964..aa6a0653 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -440,6 +440,9 @@ cAudioManager::IsAudioInitialised() const void cAudioManager::ServiceSoundEffects() { +#ifdef FIX_BUGS + if(CTimer::GetLogicalFramesPassed() != 0) +#endif m_bFifthFrameFlag = (m_FrameCounter++ % 5) == 0; if (m_nUserPause && !m_nPreviousUserPause) { for (int32 i = 0; i < NUM_CHANNELS; i++) @@ -793,9 +796,9 @@ cAudioManager::AddReleasingSounds() } if (!toProcess[i]) { if (sample.m_nCounter <= 255 || !sample.m_nLoopsRemaining) { - if (!sample.m_nReleasingVolumeDivider) + if (sample.m_nReleasingVolumeDivider == 0) continue; - if (!sample.m_nLoopCount) { + if (sample.m_nLoopCount == 0) { if (sample.m_nVolumeChange == -1) { sample.m_nVolumeChange = sample.m_nVolume / sample.m_nReleasingVolumeDivider; if (sample.m_nVolumeChange <= 0) @@ -807,6 +810,9 @@ cAudioManager::AddReleasingSounds() } sample.m_nVolume -= sample.m_nVolumeChange; } +#ifdef FIX_BUGS + if(CTimer::GetLogicalFramesPassed() != 0) +#endif --sample.m_nReleasingVolumeDivider; if (m_bFifthFrameFlag) { if (sample.m_nReleasingVolumeModificator < 20) diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index 1494334b..5a176005 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -1332,7 +1332,11 @@ cMusicManager::DisplayRadioStationName() } else { if (cDisplay == 0) return; +#ifdef FIX_BUGS + cDisplay -= CTimer::GetLogicalFramesPassed(); +#else cDisplay--; +#endif } CFont::SetJustifyOff(); diff --git a/src/audio/PolRadio.cpp b/src/audio/PolRadio.cpp index 30756d94..ce0e9a6d 100644 --- a/src/audio/PolRadio.cpp +++ b/src/audio/PolRadio.cpp @@ -137,7 +137,11 @@ cAudioManager::ServicePoliceRadio() if (!crimeReport) { if (wantedLevel != 0) { if (nLastSeen != 0) +#ifdef FIX_BUGS + nLastSeen -= CTimer::GetLogicalFramesPassed(); +#else --nLastSeen; +#endif else { nLastSeen = m_anRandomTable[1] % 1000 + 2000; SetupSuspectLastSeenReport(); @@ -176,7 +180,11 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel) } if (m_sPoliceRadioQueue.policeChannelTimer == 0) bChannelOpen = FALSE; if (cWait) { +#ifdef FIX_BUGS + cWait -= CTimer::GetLogicalFramesPassed(); +#else --cWait; +#endif return; } if (g_nMissionAudioSfx != NO_SAMPLE && !bChannelOpen) { -- cgit v1.2.3