diff options
author | erorcun <erayorcunus@gmail.com> | 2021-02-02 05:31:29 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-02 05:31:29 +0300 |
commit | 1eb77c4d6d758b8efcc229c0b7056e6974dbb700 (patch) | |
tree | 73612989f5979a41d58319429723301efb3710e2 | |
parent | 3e0dbf42d49a1ce3f7a5aef441558376171c3ac9 (diff) | |
parent | 902e539c0d25ec418cd36c735079561f378c712c (diff) |
Merge pull request #1016 from erorcun/miami
Overhaul MusicManager - fix radio bugs, scroll to prev station, radio…
-rw-r--r-- | src/audio/AudioLogic.cpp | 12 | ||||
-rw-r--r-- | src/audio/MusicManager.cpp | 512 | ||||
-rw-r--r-- | src/audio/MusicManager.h | 24 | ||||
-rw-r--r-- | src/audio/audio_enums.h | 2 | ||||
-rw-r--r-- | src/audio/soundlist.h | 14 | ||||
-rw-r--r-- | src/core/Camera.cpp | 2 | ||||
-rw-r--r-- | src/core/ControllerConfig.cpp | 45 | ||||
-rw-r--r-- | src/core/ControllerConfig.h | 4 | ||||
-rw-r--r-- | src/core/config.h | 6 | ||||
-rw-r--r-- | src/render/Hud.cpp | 2 | ||||
-rw-r--r-- | src/save/GenericGameStorage.cpp | 6 | ||||
-rw-r--r-- | src/save/GenericGameStorage.h | 2 | ||||
-rw-r--r-- | src/text/Text.cpp | 2 | ||||
-rw-r--r-- | src/vehicles/Vehicle.cpp | 4 | ||||
-rw-r--r-- | src/vehicles/Vehicle.h | 2 |
15 files changed, 384 insertions, 255 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index ce543f33..c7b26711 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -8846,7 +8846,7 @@ cAudioManager::ProcessFrontEnd() break; case SOUND_PICKUP_BONUS: case SOUND_FRONTEND_MENU_STARTING: - case SOUND_HUD_SOUND: + case SOUND_HUD: stereo = true; m_sQueueSample.m_nSampleIndex = SFX_INFO_LEFT; center = true; @@ -8882,11 +8882,11 @@ cAudioManager::ProcessFrontEnd() case SOUND_CLOCK_TICK: m_sQueueSample.m_nSampleIndex = SFX_TIMER; break; - case SOUND_FRONTEND_NO_RADIO: - case SOUND_FRONTEND_RADIO_CHANGE: + case SOUND_FRONTEND_RADIO_TURN_OFF: + case SOUND_FRONTEND_RADIO_TURN_ON: m_sQueueSample.m_nSampleIndex = SFX_RADIO_CLICK; break; - case SOUND_FRONTEND_RADIO_CHANGE_2: + case SOUND_FRONTEND_HURRICANE: m_sQueueSample.m_nSampleIndex = SFX_HURRICANE_MA; break; case SOUND_BULLETTRACE_1: @@ -8937,9 +8937,9 @@ cAudioManager::ProcessFrontEnd() sample = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i]; - if (sample == SOUND_FRONTEND_NO_RADIO) + if (sample == SOUND_FRONTEND_RADIO_TURN_OFF) m_sQueueSample.m_nFrequency = 28509; - else if (sample == SOUND_FRONTEND_RADIO_CHANGE) + else if (sample == SOUND_FRONTEND_RADIO_TURN_ON) m_sQueueSample.m_nFrequency = 32000; else if (sample == SOUND_BULLETTRACE_1 || sample == SOUND_BULLETTRACE_2) { m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index 374de081..d229ef8d 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -21,6 +21,10 @@ #include "DMAudio.h" #include "GenericGameStorage.h" +#if !defined FIX_BUGS && (defined RADIO_SCROLL_TO_PREV_STATION || defined RADIO_OFF_TEXT) +static_assert(false, "R*'s radio implementation is quite buggy, RADIO_SCROLL_TO_PREV_STATION and RADIO_OFF_TEXT won't work without FIX_BUGS"); +#endif + cMusicManager MusicManager; int32 gNumRetunePresses; int32 gRetuneCounter; @@ -52,7 +56,7 @@ cMusicManager::cMusicManager() m_nPlayingTrack = NO_TRACK; m_nUpcomingMusicMode = MUSICMODE_DISABLED; m_nMusicMode = MUSICMODE_DISABLED; - field_2 = false; + m_bSetNextStation = false; for (int i = 0; i < NUM_RADIOS; i++) aListenTimeArray[i] = 0.0f; @@ -71,27 +75,27 @@ cMusicManager::ResetMusicAfterReload() float afRadioTime[NUM_RADIOS]; m_bRadioSetByScript = false; - m_nRadioStation = WILDSTYLE; + m_nRadioStationScript = WILDSTYLE; m_nRadioPosition = -1; m_nAnnouncement = NO_TRACK; m_bAnnouncementInProgress = false; - field_2 = false; + m_bSetNextStation = false; RadioStaticTimer = 0; gNumRetunePresses = 0; gRetuneCounter = 0; m_nFrontendTrack = NO_TRACK; m_nPlayingTrack = NO_TRACK; - field_398E = false; - field_398F = false; - m_nStreamedTrack = NO_TRACK; - field_3994 = false; - field_3995 = false; - field_3996 = false; - field_3997 = false; + m_FrontendLoopFlag = false; + m_bTrackChangeStarted = false; + m_nNextTrack = NO_TRACK; + m_nNextLoopFlag = false; + m_bVerifyNextTrackStartedToPlay = false; + m_bGameplayAllowsRadio = false; + m_bRadioStreamReady = false; nFramesSinceCutsceneEnded = -1; - field_3999 = false; - field_399A = false; - field_399C = false; + m_bUserResumedGame = false; + m_bMusicModeChangeStarted = false; + m_bEarlyFrontendTrack = false; m_nVolumeLatency = 0; m_nCurrentVolume = 0; m_nMaxVolume = 0; @@ -108,7 +112,7 @@ cMusicManager::ResetMusicAfterReload() for (int i = 0; i < NUM_RADIOS; i++) { aListenTimeArray[i] = afRadioTime[i]; - uint32 trackPos = GetSavedRadioStationPosition(i); + int32 trackPos = GetSavedRadioStationPosition(i); if (trackPos != -1) { if (trackPos > m_aTracks[i].m_nLength) { debug("Radio Track %d saved position is %d, Length is only %d\n", i, trackPos, m_aTracks[i].m_nLength); @@ -179,7 +183,7 @@ cMusicManager::Initialise() m_bResetTimers = false; m_nResetTime = 0; m_bRadioSetByScript = false; - m_nRadioStation = WILDSTYLE; + m_nRadioStationScript = WILDSTYLE; m_nRadioPosition = -1; m_nRadioInCar = NO_TRACK; gRetuneCounter = 0; @@ -188,18 +192,18 @@ cMusicManager::Initialise() m_nPlayingTrack = NO_TRACK; m_nUpcomingMusicMode = MUSICMODE_DISABLED; m_nMusicMode = MUSICMODE_DISABLED; - field_398E = false; - field_398F = false; - m_nStreamedTrack = NO_TRACK; - field_3994 = false; - field_3995 = false; - field_3996 = false; - field_3997 = false; + m_FrontendLoopFlag = false; + m_bTrackChangeStarted = false; + m_nNextTrack = NO_TRACK; + m_nNextLoopFlag = false; + m_bVerifyNextTrackStartedToPlay = false; + m_bGameplayAllowsRadio = false; + m_bRadioStreamReady = false; nFramesSinceCutsceneEnded = -1; - field_3999 = false; - field_399A = false; + m_bUserResumedGame = false; + m_bMusicModeChangeStarted = false; m_nMusicModeToBeSet = MUSICMODE_DISABLED; - field_399C = false; + m_bEarlyFrontendTrack = false; m_nVolumeLatency = 0; m_nCurrentVolume = 0; m_nMaxVolume = 0; @@ -227,7 +231,7 @@ cMusicManager::SetRadioChannelByScript(uint32 station, int32 pos) station = STREAMED_SOUND_CITY_AMBIENT; if (station <= STREAMED_SOUND_RADIO_POLICE) { m_bRadioSetByScript = true; - m_nRadioStation = station; + m_nRadioStationScript = station; m_nRadioPosition = pos == -1 ? -1 : pos % m_aTracks[station].m_nLength; } } @@ -292,7 +296,7 @@ cMusicManager::SetRadioInCar(uint32 station) void cMusicManager::RecordRadioStats() { - if (m_nPlayingTrack < STREAMED_SOUND_CITY_AMBIENT) { + if (m_nPlayingTrack < NUM_RADIOS) { double time /*Rusty*/ = CTimer::GetTimeInMillisecondsPauseMode(); if (time > m_nLastTrackServiceTime) aListenTimeArray[m_nPlayingTrack] += time - m_nLastTrackServiceTime; @@ -321,11 +325,11 @@ cMusicManager::ChangeMusicMode(uint8 mode) while (SampleManager.IsStreamPlaying(0)) SampleManager.StopStreamedFile(0); m_nMusicMode = m_nUpcomingMusicMode; - field_399A = false; - field_398F = false; - m_nStreamedTrack = NO_TRACK; - field_3994 = false; - field_3995 = false; + m_bMusicModeChangeStarted = false; + m_bTrackChangeStarted = false; + m_nNextTrack = NO_TRACK; + m_nNextLoopFlag = false; + m_bVerifyNextTrackStartedToPlay = false; m_nPlayingTrack = NO_TRACK; m_nFrontendTrack = NO_TRACK; m_bAnnouncementInProgress = false; @@ -356,7 +360,7 @@ cMusicManager::Service() if (!m_bIsInitialised || m_bDisabled) return; - if (!field_399A) + if (!m_bMusicModeChangeStarted) m_nMusicModeToBeSet = m_nUpcomingMusicMode; if (m_nMusicModeToBeSet == m_nMusicMode) { if (!AudioManager.m_nUserPause || AudioManager.m_nPreviousUserPause || m_nMusicMode != MUSICMODE_FRONTEND) @@ -371,13 +375,13 @@ cMusicManager::Service() else m_nMusicMode = MUSICMODE_DISABLED; } else { - field_399A = true; - if (!field_3999 && !AudioManager.m_nUserPause && AudioManager.m_nPreviousUserPause) - field_3999 = true; + m_bMusicModeChangeStarted = true; + if (!m_bUserResumedGame && !AudioManager.m_nUserPause && AudioManager.m_nPreviousUserPause) + m_bUserResumedGame = true; if (AudioManager.m_FrameCounter % 4 == 0) { gNumRetunePresses = 0; gRetuneCounter = 0; - field_2 = false; + m_bSetNextStation = false; if (SampleManager.IsStreamPlaying(0)) { if (m_nPlayingTrack != NO_TRACK && !bRadioStatsRecorded) { @@ -390,14 +394,14 @@ cMusicManager::Service() } else { bRadioStatsRecorded = false; m_nMusicMode = m_nMusicModeToBeSet; - field_399A = false; - field_398F = false; - m_nStreamedTrack = NO_TRACK; - field_3994 = false; - field_3995 = false; + m_bMusicModeChangeStarted = false; + m_bTrackChangeStarted = false; + m_nNextTrack = NO_TRACK; + m_nNextLoopFlag = false; + m_bVerifyNextTrackStartedToPlay = false; m_nPlayingTrack = NO_TRACK; - if (field_399C) - field_399C = false; + if (m_bEarlyFrontendTrack) + m_bEarlyFrontendTrack = false; else m_nFrontendTrack = NO_TRACK; } @@ -417,19 +421,19 @@ cMusicManager::ServiceFrontEndMode() g_bAnnouncementReadPosAlready = false; m_nAnnouncement = NO_TRACK; m_bAnnouncementInProgress = false; - m_nStreamedTrack = NO_TRACK; + m_nNextTrack = NO_TRACK; m_nFrontendTrack = NO_TRACK; m_nPlayingTrack = NO_TRACK; } if (AudioManager.m_FrameCounter % 4 != 0) return; - if (!field_398F && !field_3995) { - m_nStreamedTrack = m_nFrontendTrack; - field_3994 = field_398E; + if (!m_bTrackChangeStarted && !m_bVerifyNextTrackStartedToPlay) { + m_nNextTrack = m_nFrontendTrack; + m_nNextLoopFlag = m_FrontendLoopFlag; } - if (m_nStreamedTrack == m_nPlayingTrack) { + if (m_nNextTrack == m_nPlayingTrack) { if (SampleManager.IsStreamPlaying(0)) { if (m_nVolumeLatency > 0) m_nVolumeLatency--; else { @@ -444,25 +448,25 @@ cMusicManager::ServiceFrontEndMode() ChangeMusicMode(MUSICMODE_GAME); } } else { - field_398F = true; - if (field_3995 || !SampleManager.IsStreamPlaying(0)) { + m_bTrackChangeStarted = true; + if (m_bVerifyNextTrackStartedToPlay || !SampleManager.IsStreamPlaying(0)) { bRadioStatsRecorded = false; - if (SampleManager.IsStreamPlaying(0) || m_nStreamedTrack == NO_TRACK) { - m_nPlayingTrack = m_nStreamedTrack; - field_3995 = false; - field_398F = false; + if (SampleManager.IsStreamPlaying(0) || m_nNextTrack == NO_TRACK) { + m_nPlayingTrack = m_nNextTrack; + m_bVerifyNextTrackStartedToPlay = false; + m_bTrackChangeStarted = false; } else { - uint32 trackStartPos = (m_nStreamedTrack > STREAMED_SOUND_RADIO_POLICE) ? 0 : GetTrackStartPos(m_nStreamedTrack); - if (m_nStreamedTrack != NO_TRACK) { - SampleManager.SetStreamedFileLoopFlag(field_3994, 0); - SampleManager.StartStreamedFile(m_nStreamedTrack, trackStartPos, 0); + uint32 trackStartPos = (m_nNextTrack > STREAMED_SOUND_RADIO_POLICE) ? 0 : GetTrackStartPos(m_nNextTrack); + if (m_nNextTrack != NO_TRACK) { + SampleManager.SetStreamedFileLoopFlag(m_nNextLoopFlag, 0); + SampleManager.StartStreamedFile(m_nNextTrack, trackStartPos, 0); m_nVolumeLatency = 3; m_nCurrentVolume = 0; m_nMaxVolume = 100; SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, 0, 0); - if (m_nStreamedTrack < STREAMED_SOUND_CITY_AMBIENT) + if (m_nNextTrack < STREAMED_SOUND_CITY_AMBIENT) m_nLastTrackServiceTime = CTimer::GetTimeInMillisecondsPauseMode(); - field_3995 = true; + m_bVerifyNextTrackStartedToPlay = true; } } } else { @@ -483,8 +487,8 @@ cMusicManager::ServiceGameMode() { CPed *ped = FindPlayerPed(); CVehicle *vehicle = AudioManager.FindVehicleOfPlayer(); - field_3997 = field_3996; - field_3996 = false; + m_bRadioStreamReady = m_bGameplayAllowsRadio; + m_bGameplayAllowsRadio = false; switch (CGame::currArea) { @@ -495,29 +499,28 @@ cMusicManager::ServiceGameMode() case AREA_BLOOD: case AREA_OVALRING: case AREA_MALIBU_CLUB: - field_3996 = false; + m_bGameplayAllowsRadio = false; break; default: if (SampleManager.GetMusicVolume()) { if (PlayerInCar()) - field_3996 = true; + m_bGameplayAllowsRadio = true; } else - field_3996 = false; + m_bGameplayAllowsRadio = false; break; } - if (!field_3996) { + if (!m_bGameplayAllowsRadio) { nFramesSinceCutsceneEnded = -1; gNumRetunePresses = 0; gRetuneCounter = 0; - field_2 = false; + m_bSetNextStation = false; } else if (ped) { - if(!ped->DyingOrDead()) { + if(!ped->DyingOrDead() && vehicle) { #ifdef GTA_PC if (SampleManager.IsMP3RadioChannelAvailable() && vehicle->m_nRadioStation < USERTRACK - && ControlsManager.GetIsKeyboardKeyJustDown(rsF9) - && vehicle) + && ControlsManager.GetIsKeyboardKeyJustDown(rsF9)) { if (!UsesPoliceRadio(vehicle) && !UsesTaxiRadio(vehicle)) { gNumRetunePresses = 0; @@ -532,7 +535,7 @@ cMusicManager::ServiceGameMode() } } #endif - if (CPad::GetPad(0)->ChangeStationJustDown() && vehicle) + if (CPad::GetPad(0)->ChangeStationJustDown()) { if (!UsesPoliceRadio(vehicle) && !UsesTaxiRadio(vehicle)) { gNumRetunePresses++; @@ -540,147 +543,183 @@ cMusicManager::ServiceGameMode() RadioStaticCounter = 0; } } - +#ifdef RADIO_SCROLL_TO_PREV_STATION + else if(CPad::GetPad(0)->GetMouseWheelDownJustDown() || CPad::GetPad(0)->GetMouseWheelUpJustDown()) { + if(!UsesPoliceRadio(vehicle) && !UsesTaxiRadio(vehicle)) { + int scrollNext = ControlsManager.GetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, MOUSE); + int scrollPrev = scrollNext == rsMOUSEWHEELUPBUTTON ? rsMOUSEWHEELDOWNBUTTON + : scrollNext == rsMOUSEWHEELDOWNBUTTON ? rsMOUSEWHEELUPBUTTON : -1; + + if(scrollPrev != -1 && !ControlsManager.IsAnyVehicleActionAssignedToMouseKey(scrollPrev)) { + gNumRetunePresses--; + gRetuneCounter = 20; + RadioStaticCounter = 0; + int track = gNumRetunePresses + vehicle->m_nRadioStation; + while(track < 0) track += NUM_RADIOS + 1; + while(track >= NUM_RADIOS + 1) track -= NUM_RADIOS + 1; + if(!DMAudio.IsMP3RadioChannelAvailable() && track == USERTRACK) gNumRetunePresses--; + } + } + } +#endif } } - if (field_3999) + if (m_bUserResumedGame) { - field_3997 = false; - field_3999 = false; + m_bRadioStreamReady = false; + m_bUserResumedGame = false; } if (m_nPlayingTrack == NO_TRACK && m_nFrontendTrack == NO_TRACK) - field_3997 = false; + m_bRadioStreamReady = false; - if (field_3996) + if (m_bGameplayAllowsRadio) { - if (field_3997) + if (!m_bRadioStreamReady) { - if (m_nAnnouncement < NO_TRACK) { - if ((m_bAnnouncementInProgress || m_nFrontendTrack == m_nPlayingTrack) && ServiceAnnouncement()) { - if (m_bAnnouncementInProgress) { - field_2 = false; - gNumRetunePresses = 0; - gRetuneCounter = 0; - return; - } - if(m_nAnnouncement == NO_TRACK) { - m_nStreamedTrack = NO_TRACK; - m_nFrontendTrack = GetCarTuning(); - field_2 = false; - gRetuneCounter = 0; - gNumRetunePresses = 0; - } + if(vehicle == nil) { + m_nFrontendTrack = STREAMED_SOUND_RADIO_WAVE; // huh? + return; + } + if(m_bRadioSetByScript) { + if(UsesPoliceRadio(vehicle)) + m_nFrontendTrack = STREAMED_SOUND_RADIO_POLICE; + else if(UsesTaxiRadio(vehicle)) + m_nFrontendTrack = STREAMED_SOUND_RADIO_TAXI; + else { + m_nFrontendTrack = m_nRadioStationScript; + vehicle->m_nRadioStation = m_nRadioStationScript; } + if(m_nRadioPosition != -1) { + m_aTracks[m_nFrontendTrack].m_nPosition = m_nRadioPosition; + m_aTracks[m_nFrontendTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode(); + } + m_bRadioSetByScript = false; + return; } - if (!m_bAnnouncementInProgress - && m_nAnnouncement == NO_TRACK - && m_nPlayingTrack == STREAMED_SOUND_RADIO_MP3_PLAYER - && !SampleManager.IsStreamPlaying(0)) - { - SampleManager.StartStreamedFile(STREAMED_SOUND_RADIO_MP3_PLAYER, 0, 0); + + // This starts the radio when you enter the car. + m_nFrontendTrack = GetCarTuning(); + return; + } + if (m_nAnnouncement < NO_TRACK) { + if ((m_bAnnouncementInProgress || m_nFrontendTrack == m_nPlayingTrack) && ServiceAnnouncement()) { + if (m_bAnnouncementInProgress) { + m_bSetNextStation = false; + gNumRetunePresses = 0; + gRetuneCounter = 0; + return; + } + if(m_nAnnouncement == NO_TRACK) { + m_nNextTrack = NO_TRACK; + m_nFrontendTrack = GetCarTuning(); + m_bSetNextStation = false; + gRetuneCounter = 0; + gNumRetunePresses = 0; + } } + } + if (!m_bAnnouncementInProgress + && m_nAnnouncement == NO_TRACK + && m_nPlayingTrack == STREAMED_SOUND_RADIO_MP3_PLAYER + && !SampleManager.IsStreamPlaying(0)) + { + SampleManager.StartStreamedFile(STREAMED_SOUND_RADIO_MP3_PLAYER, 0, 0); + } - if (!m_bRadioSetByScript) + if (!m_bRadioSetByScript) + { + // Because when you switch radio back and forth, gNumRetunePresses will be 0 but gRetuneCounter won't. +#ifdef RADIO_SCROLL_TO_PREV_STATION + if(gRetuneCounter != 0) { + if(gRetuneCounter > 1) + gRetuneCounter--; + else if(gRetuneCounter == 1) { + m_bSetNextStation = true; + gRetuneCounter = 0; + } + } +#else + if (gNumRetunePresses != 0) { - if (gNumRetunePresses != 0) + if (--gRetuneCounter == 0) { - if (--gRetuneCounter == 0) - { - field_2 = true; - gRetuneCounter = 0; - } + m_bSetNextStation = true; + gRetuneCounter = 0; } - if (gRetuneCounter) - { - int32 station = gNumRetunePresses + vehicle->m_nRadioStation; - while (station >= RADIO_OFF) station -= RADIO_OFF; + } +#endif + if (gRetuneCounter) + { + int32 station = gNumRetunePresses + vehicle->m_nRadioStation; +#ifdef RADIO_SCROLL_TO_PREV_STATION + while (station < 0) station += NUM_RADIOS + 1; +#endif + while (station >= NUM_RADIOS + 1) station -= NUM_RADIOS + 1; - if (!DMAudio.IsMP3RadioChannelAvailable() && station == USERTRACK) - { - ++gNumRetunePresses; - station = NUM_RADIOS; - } - if (station == NUM_RADIOS) - { - if (gRetuneCounter == NUM_RADIOS + 9) - { - AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_NO_RADIO, 0.0f); - RadioStaticCounter = 5; - } - } - else + // Scrolling back won't hit here, so increasing isn't problem + if (!DMAudio.IsMP3RadioChannelAvailable() && station == USERTRACK) + { + ++gNumRetunePresses; + station = RADIO_OFF; + } + if (station == RADIO_OFF) + { + if (gRetuneCounter == 19) // One less then what switching radio sets, so runs right after turning off radio { - if (station == WILDSTYLE && gRetuneCounter == NUM_RADIOS + 9) - AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_RADIO_CHANGE, 0.0f); - AudioManager.DoPoliceRadioCrackle(); + AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_RADIO_TURN_OFF, 0.0f); + RadioStaticCounter = 5; } } - if (RadioStaticCounter < 2 && CTimer::GetTimeInMilliseconds() > RadioStaticTimer + 800) + else { - AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_RADIO_CHANGE, 0.0f); - RadioStaticCounter++; - RadioStaticTimer = CTimer::GetTimeInMilliseconds(); +#ifdef RADIO_SCROLL_TO_PREV_STATION + if (vehicle->m_nRadioStation == RADIO_OFF && gRetuneCounter == 19) // Right after turning on the radio +#else + if (station == 0 && gRetuneCounter == 19) // Right after turning on the radio +#endif + AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_RADIO_TURN_ON, 0.0f); + AudioManager.DoPoliceRadioCrackle(); } - if (field_2) - m_nFrontendTrack = GetNextCarTuning(); - if (m_nFrontendTrack >= STREAMED_SOUND_CITY_AMBIENT && m_nFrontendTrack <= STREAMED_SOUND_AMBSIL_AMBIENT) - SetUpCorrectAmbienceTrack(); - ServiceTrack(vehicle, ped); - if (field_2) - field_2 = false; - return; } - if (UsesPoliceRadio(vehicle)) - m_nFrontendTrack = STREAMED_SOUND_RADIO_POLICE; - else if (UsesTaxiRadio(vehicle)) - m_nFrontendTrack = STREAMED_SOUND_RADIO_TAXI; - else { - m_nFrontendTrack = m_nRadioStation; - vehicle->m_nRadioStation = m_nRadioStation; - } - - if (m_nRadioPosition != -1) { - m_aTracks[m_nFrontendTrack].m_nPosition = m_nRadioPosition; - m_aTracks[m_nFrontendTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode(); + if (RadioStaticCounter < 2 && CTimer::GetTimeInMilliseconds() > RadioStaticTimer + 800) + { + AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_RADIO_CHANGE, 0.0f); + RadioStaticCounter++; + RadioStaticTimer = CTimer::GetTimeInMilliseconds(); } - - gRetuneCounter = 0; - gNumRetunePresses = 0; - field_2 = false; - m_bRadioSetByScript = false; + if (m_bSetNextStation) + m_nFrontendTrack = GetNextCarTuning(); if (m_nFrontendTrack >= STREAMED_SOUND_CITY_AMBIENT && m_nFrontendTrack <= STREAMED_SOUND_AMBSIL_AMBIENT) SetUpCorrectAmbienceTrack(); ServiceTrack(vehicle, ped); - if (field_2) - field_2 = false; + if (m_bSetNextStation) + m_bSetNextStation = false; return; } - if (vehicle == nil) - { - m_nFrontendTrack = STREAMED_SOUND_RADIO_WAVE; // huh? - return; + if (UsesPoliceRadio(vehicle)) + m_nFrontendTrack = STREAMED_SOUND_RADIO_POLICE; + else if (UsesTaxiRadio(vehicle)) + m_nFrontendTrack = STREAMED_SOUND_RADIO_TAXI; + else { + m_nFrontendTrack = m_nRadioStationScript; + vehicle->m_nRadioStation = m_nRadioStationScript; } - if (m_bRadioSetByScript) - { - if (UsesPoliceRadio(vehicle)) - m_nFrontendTrack = STREAMED_SOUND_RADIO_POLICE; - else if (UsesTaxiRadio(vehicle)) - m_nFrontendTrack = STREAMED_SOUND_RADIO_TAXI; - else { - m_nFrontendTrack = m_nRadioStation; - vehicle->m_nRadioStation = m_nRadioStation; - } - if (m_nRadioPosition != -1) - { - m_aTracks[m_nFrontendTrack].m_nPosition = m_nRadioPosition; - m_aTracks[m_nFrontendTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode(); - } - m_bRadioSetByScript = false; - return; + + if (m_nRadioPosition != -1) { + m_aTracks[m_nFrontendTrack].m_nPosition = m_nRadioPosition; + m_aTracks[m_nFrontendTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode(); } - m_nFrontendTrack = GetCarTuning(); + gRetuneCounter = 0; + gNumRetunePresses = 0; + m_bSetNextStation = false; + m_bRadioSetByScript = false; + if (m_nFrontendTrack >= STREAMED_SOUND_CITY_AMBIENT && m_nFrontendTrack <= STREAMED_SOUND_AMBSIL_AMBIENT) + SetUpCorrectAmbienceTrack(); + ServiceTrack(vehicle, ped); + if (m_bSetNextStation) + m_bSetNextStation = false; return; } @@ -692,7 +731,7 @@ cMusicManager::ServiceGameMode() g_bAnnouncementReadPosAlready = false; m_nAnnouncement = NO_TRACK; m_bAnnouncementInProgress = false; - m_nStreamedTrack = NO_TRACK; + m_nNextTrack = NO_TRACK; m_nFrontendTrack = NO_TRACK; m_nPlayingTrack = NO_TRACK; } @@ -834,7 +873,7 @@ cMusicManager::ServiceAnnouncement() { if (m_bAnnouncementInProgress) { if (SampleManager.IsStreamPlaying(0)) - m_nPlayingTrack = m_nStreamedTrack; + m_nPlayingTrack = m_nNextTrack; else if (m_nPlayingTrack != NO_TRACK) { m_nAnnouncement = NO_TRACK; m_bAnnouncementInProgress = false; @@ -852,9 +891,9 @@ cMusicManager::ServiceAnnouncement() } else { g_bAnnouncementReadPosAlready = false; m_nPlayingTrack = NO_TRACK; - m_nStreamedTrack = m_nAnnouncement; - SampleManager.SetStreamedFileLoopFlag(0, false); - SampleManager.StartStreamedFile(m_nStreamedTrack, 0, 0); + m_nNextTrack = m_nAnnouncement; + SampleManager.SetStreamedFileLoopFlag(0, 0); + SampleManager.StartStreamedFile(m_nNextTrack, 0, 0); SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, 0, 0); m_bAnnouncementInProgress = true; } @@ -868,9 +907,9 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped) static bool bRadioStatsRecorded = false; static bool bRadioStatsRecorded2 = false; uint8 volume; - if (!field_398F) - m_nStreamedTrack = m_nFrontendTrack; - if (gRetuneCounter != 0 || field_2) { + if (!m_bTrackChangeStarted) + m_nNextTrack = m_nFrontendTrack; + if (gRetuneCounter != 0 || m_bSetNextStation) { if (SampleManager.IsStreamPlaying(0)) { if (m_nPlayingTrack != NO_TRACK && !bRadioStatsRecorded) { m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0); @@ -889,28 +928,35 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped) m_nPlayingTrack = NO_TRACK; } - if (m_nStreamedTrack != m_nPlayingTrack) + if (m_nNextTrack != m_nPlayingTrack) { - field_398F = true; + m_bTrackChangeStarted = true; SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0); if (!(AudioManager.m_FrameCounter & 1)) { - if (field_3995 || !SampleManager.IsStreamPlaying(0)) { + if (m_bVerifyNextTrackStartedToPlay || !SampleManager.IsStreamPlaying(0)) { bRadioStatsRecorded2 = false; if (SampleManager.IsStreamPlaying(0)) { - m_nPlayingTrack = m_nStreamedTrack; - field_3995 = false; - field_398F = false; + m_nPlayingTrack = m_nNextTrack; + m_bVerifyNextTrackStartedToPlay = false; + m_bTrackChangeStarted = false; if (veh) { - if (veh->m_nRadioStation < STREAMED_SOUND_CITY_AMBIENT || veh->m_nRadioStation > STREAMED_SOUND_AMBSIL_AMBIENT) +#ifdef FIX_BUGS + if (m_nPlayingTrack >= STREAMED_SOUND_CITY_AMBIENT && m_nPlayingTrack <= STREAMED_SOUND_AMBSIL_AMBIENT) + veh->m_nRadioStation = RADIO_OFF; + else if (m_nPlayingTrack < STREAMED_SOUND_CITY_AMBIENT) veh->m_nRadioStation = m_nPlayingTrack; +#else + if (veh->m_nRadioStation >= STREAMED_SOUND_CITY_AMBIENT && veh->m_nRadioStation <= STREAMED_SOUND_AMBSIL_AMBIENT) + veh->m_nRadioStation = RADIO_OFF; else - veh->m_nRadioStation = STREAMED_SOUND_CITY_AMBIENT; + veh->m_nRadioStation = m_nPlayingTrack; +#endif } } else { - uint32 pos = GetTrackStartPos(m_nStreamedTrack); - if (m_nStreamedTrack != NO_TRACK) { + uint32 pos = GetTrackStartPos(m_nNextTrack); + if (m_nNextTrack != NO_TRACK) { SampleManager.SetStreamedFileLoopFlag(1, 0); - SampleManager.StartStreamedFile(m_nStreamedTrack, pos, 0); + SampleManager.StartStreamedFile(m_nNextTrack, pos, 0); if (m_nFrontendTrack < STREAMED_SOUND_CITY_AMBIENT || m_nFrontendTrack > STREAMED_SOUND_AMBSIL_AMBIENT) { m_nVolumeLatency = 10; @@ -923,9 +969,9 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped) ComputeAmbienceVol(true, volume); SampleManager.SetStreamedVolumeAndPan(volume, 63, 1, 0); } - if (m_nStreamedTrack < STREAMED_SOUND_CITY_AMBIENT) + if (m_nNextTrack < STREAMED_SOUND_CITY_AMBIENT) m_nLastTrackServiceTime = CTimer::GetTimeInMillisecondsPauseMode(); - field_3995 = true; + m_bVerifyNextTrackStartedToPlay = true; } } } else { @@ -939,8 +985,8 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped) RecordRadioStats(); if (m_nPlayingTrack >= STREAMED_SOUND_HAVANA_CITY_AMBIENT && m_nPlayingTrack <= STREAMED_SOUND_HAVANA_BEACH_AMBIENT) { - if (m_nStreamedTrack >= STREAMED_SOUND_HAVANA_CITY_AMBIENT && m_nStreamedTrack <= STREAMED_SOUND_HAVANA_BEACH_AMBIENT) - AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_RADIO_CHANGE_2, 0.0); + if (m_nNextTrack >= STREAMED_SOUND_HAVANA_CITY_AMBIENT && m_nNextTrack <= STREAMED_SOUND_HAVANA_BEACH_AMBIENT) + AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_HURRICANE, 0.0); } } SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0); @@ -1050,14 +1096,14 @@ cMusicManager::StopCutSceneMusic(void) } void -cMusicManager::PlayFrontEndTrack(uint32 track, uint8 bPlayInFrontend) +cMusicManager::PlayFrontEndTrack(uint32 track, uint8 loopFlag) { if (IsInitialised() && !m_bDisabled && track < TOTAL_STREAMED_SOUNDS && (m_nUpcomingMusicMode == MUSICMODE_FRONTEND || m_nMusicMode == MUSICMODE_FRONTEND)) { m_nFrontendTrack = track; - field_398E = bPlayInFrontend; + m_FrontendLoopFlag = loopFlag; if (m_nMusicMode != MUSICMODE_FRONTEND) - field_399C = true; + m_bEarlyFrontendTrack = true; } } @@ -1083,10 +1129,18 @@ cMusicManager::GetNextCarTuning() if (UsesPoliceRadio(veh)) return STREAMED_SOUND_RADIO_POLICE; if (UsesTaxiRadio(veh)) return STREAMED_SOUND_RADIO_TAXI; if (gNumRetunePresses != 0) { +#ifdef RADIO_SCROLL_TO_PREV_STATION + // m_nRadioStation is unsigned, so... + int station = veh->m_nRadioStation + gNumRetunePresses; + while(station < 0) station += NUM_RADIOS + 1; + while(station >= NUM_RADIOS + 1) station -= NUM_RADIOS + 1; + veh->m_nRadioStation = station; +#else veh->m_nRadioStation += gNumRetunePresses; - while (veh->m_nRadioStation >= RADIO_OFF) - veh->m_nRadioStation -= RADIO_OFF; - DMAudio.IsMP3RadioChannelAvailable(); // woof, just call and do nothing =P + while(veh->m_nRadioStation >= NUM_RADIOS + 1) + veh->m_nRadioStation -= NUM_RADIOS + 1; +#endif + DMAudio.IsMP3RadioChannelAvailable(); // woof, just call and do nothing =P they manipulate gNumRetunePresses on DisplayRadioStationName in this case gNumRetunePresses = 0; } return veh->m_nRadioStation; @@ -1129,7 +1183,7 @@ cMusicManager::GetTrackStartPos(uint32 track) uint32 cMusicManager::GetRadioPosition(uint32 station) { - if (station < STREAMED_SOUND_CITY_AMBIENT) + if (station < NUM_RADIOS) return GetTrackStartPos(station); return 0; } @@ -1158,7 +1212,7 @@ cMusicManager::SetMalibuClubTrackPos(uint8 scriptObject) { if (!IsInitialised()) m_aTracks[STREAMED_SOUND_MALIBU_AMBIENT].m_nPosition = 8640; - if (m_nStreamedTrack != STREAMED_SOUND_MALIBU_AMBIENT && m_nPlayingTrack != STREAMED_SOUND_MALIBU_AMBIENT) { + if (m_nNextTrack != STREAMED_SOUND_MALIBU_AMBIENT && m_nPlayingTrack != STREAMED_SOUND_MALIBU_AMBIENT) { switch (scriptObject) { case SCRIPT_SOUND_NEW_BUILDING_MALIBU_1: @@ -1180,7 +1234,7 @@ cMusicManager::SetStripClubTrackPos(uint8 scriptObject) { if (!IsInitialised()) m_aTracks[STREAMED_SOUND_STRIPCLUB_AMBIENT].m_nPosition = 0; - if (m_nStreamedTrack != STREAMED_SOUND_STRIPCLUB_AMBIENT && m_nPlayingTrack != STREAMED_SOUND_STRIPCLUB_AMBIENT) + if (m_nNextTrack != STREAMED_SOUND_STRIPCLUB_AMBIENT && m_nPlayingTrack != STREAMED_SOUND_STRIPCLUB_AMBIENT) { switch (scriptObject) { @@ -1201,7 +1255,7 @@ cMusicManager::SetStripClubTrackPos(uint8 scriptObject) void cMusicManager::DisplayRadioStationName() { - int8 gStreamedSound; + uint8 gStreamedSound; static wchar *pCurrentStation = nil; static uint8 cDisplay = 0; @@ -1211,20 +1265,25 @@ cMusicManager::DisplayRadioStationName() if (vehicle) { - uint8 track; + int8 track; gStreamedSound = vehicle->m_nRadioStation; if (gStreamedSound >= STREAMED_SOUND_CITY_AMBIENT && gStreamedSound <= STREAMED_SOUND_AMBSIL_AMBIENT) - gStreamedSound = STREAMED_SOUND_CITY_AMBIENT; + gStreamedSound = RADIO_OFF; if (gNumRetunePresses != 0) { track = gNumRetunePresses + gStreamedSound; - while (track >= RADIO_OFF) track -= RADIO_OFF; +#ifdef RADIO_SCROLL_TO_PREV_STATION + while (track < 0) track += NUM_RADIOS + 1; +#endif + while (track >= NUM_RADIOS + 1) track -= NUM_RADIOS + 1; + + // We already handle this condition while scrolling back, on key press. No need to change this. if (!DMAudio.IsMP3RadioChannelAvailable() && track == USERTRACK) gNumRetunePresses++; } else #ifdef FIX_BUGS - track = m_nFrontendTrack == NO_TRACK ? POLICE_RADIO : m_nFrontendTrack; + track = GetCarTuning(); // gStreamedSound or veh->m_nRadioStation would also work, but these don't cover police/taxi radios #else track = m_nFrontendTrack; #endif @@ -1244,6 +1303,18 @@ cMusicManager::DisplayRadioStationName() if (!SampleManager.IsMP3RadioChannelAvailable()) return; string = TheText.Get("FEA_MP3"); break; +#ifdef RADIO_OFF_TEXT + case RADIO_OFF: { + extern wchar WideErrorString[]; + + string = TheText.Get("FEA_FMN"); + if (string == WideErrorString) { + pCurrentStation = nil; + return; + } + break; + } +#endif default: return; }; @@ -1275,6 +1346,11 @@ cMusicManager::DisplayRadioStationName() CFont::DrawFonts(); } } + // Always show station text after entering car. Same behaviour as III and SA. +#ifdef FIX_BUGS + else + pCurrentStation = nil; +#endif } bool diff --git a/src/audio/MusicManager.h b/src/audio/MusicManager.h index 5691b7b8..27456d79 100644 --- a/src/audio/MusicManager.h +++ b/src/audio/MusicManager.h @@ -18,7 +18,7 @@ class cMusicManager public: bool m_bIsInitialised; bool m_bDisabled; - bool field_2; + bool m_bSetNextStation; uint8 m_nVolumeLatency; uint8 m_nCurrentVolume; uint8 m_nMaxVolume; @@ -28,25 +28,25 @@ public: bool m_bResetTimers; uint32 m_nResetTime; bool m_bRadioSetByScript; - uint8 m_nRadioStation; + uint8 m_nRadioStationScript; int32 m_nRadioPosition; uint32 m_nRadioInCar; uint32 m_nFrontendTrack; uint32 m_nPlayingTrack; uint8 m_nUpcomingMusicMode; uint8 m_nMusicMode; - bool field_398E; - bool field_398F; - uint32 m_nStreamedTrack; - bool field_3994; - bool field_3995; - bool field_3996; - bool field_3997; + bool m_FrontendLoopFlag; + bool m_bTrackChangeStarted; + uint32 m_nNextTrack; + bool m_nNextLoopFlag; + bool m_bVerifyNextTrackStartedToPlay; + bool m_bGameplayAllowsRadio; + bool m_bRadioStreamReady; int8 nFramesSinceCutsceneEnded; - bool field_3999; - bool field_399A; + bool m_bUserResumedGame; + bool m_bMusicModeChangeStarted; uint8 m_nMusicModeToBeSet; - bool field_399C; + bool m_bEarlyFrontendTrack; float aListenTimeArray[NUM_RADIOS]; float m_nLastTrackServiceTime; diff --git a/src/audio/audio_enums.h b/src/audio/audio_enums.h index 91fcec49..990b2d73 100644 --- a/src/audio/audio_enums.h +++ b/src/audio/audio_enums.h @@ -14,8 +14,8 @@ enum eRadioStation USERTRACK, NUM_RADIOS = 10, POLICE_RADIO = 10, + RADIO_OFF = 10, //TAXI_RADIO, - RADIO_OFF, }; enum eMusicMode diff --git a/src/audio/soundlist.h b/src/audio/soundlist.h index 4d88590e..e86b13ee 100644 --- a/src/audio/soundlist.h +++ b/src/audio/soundlist.h @@ -171,22 +171,22 @@ enum eSound SOUND_CAR_PED_COLLISION, SOUND_CLOCK_TICK, SOUND_PART_MISSION_COMPLETE, - SOUND_FRONTEND_MENU_STARTING, // same with SOUND_HUD_SOUND + SOUND_FRONTEND_MENU_STARTING, // same sound as SOUND_HUD // TODO(Miami): What are 170-175?? - SOUND_FRONTEND_NO_RADIO = 176, // those 3 are all same sound - SOUND_FRONTEND_RADIO_CHANGE, - SOUND_FRONTEND_RADIO_CHANGE_2, - SOUND_HUD_SOUND, + SOUND_FRONTEND_RADIO_TURN_OFF = 176, // those 2 are same sound + SOUND_FRONTEND_RADIO_TURN_ON, + SOUND_FRONTEND_HURRICANE, // yes, frontend + SOUND_HUD, SOUND_180, SOUND_181, SOUND_182, SOUND_LIGHTNING, SOUND_BULLETTRACE_1, SOUND_BULLETTRACE_2, - SOUND_186, // makes same sound with 40 - SOUND_187, // makes same sound with 46 + SOUND_186, // makes same sound as 40 + SOUND_187, // makes same sound as 46 SOUND_MELEE_ATTACK_START, SOUND_SKATING, SOUND_WEAPON_MINIGUN_ATTACK, diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index 25d2e5c3..5b3f9aa5 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -1768,7 +1768,7 @@ CCamera::CamControl(void) (m_bLookingAtPlayer || WhoIsInControlOfTheCamera == CAMCONTROL_OBBE) && !m_WideScreenOn && (WhoIsInControlOfTheCamera != CAMCONTROL_OBBE || bSwitchedToObbeCam)) - DMAudio.PlayFrontEndSound(SOUND_HUD_SOUND, 0); + DMAudio.PlayFrontEndSound(SOUND_HUD, 0); } // What a mess! diff --git a/src/core/ControllerConfig.cpp b/src/core/ControllerConfig.cpp index 23e86a79..7f634619 100644 --- a/src/core/ControllerConfig.cpp +++ b/src/core/ControllerConfig.cpp @@ -1765,6 +1765,51 @@ void CControllerConfigManager::DeleteMatching1rstPersonControls(e_ControllerActi #undef CLEAR_ACTION_IF_NEEDED +#ifdef RADIO_SCROLL_TO_PREV_STATION +#define CHECK_ACTION(action) \ +if (key == GetControllerKeyAssociatedWithAction(action, type))\ + return true; + +bool CControllerConfigManager::IsAnyVehicleActionAssignedToMouseKey(int32 key) +{ + const eControllerType type = MOUSE; + if (!GetIsKeyBlank(key, type)) + { +#ifdef BIND_VEHICLE_FIREWEAPON + CHECK_ACTION(VEHICLE_FIREWEAPON); +#endif + CHECK_ACTION(VEHICLE_LOOKBEHIND); + CHECK_ACTION(VEHICLE_LOOKLEFT); + CHECK_ACTION(VEHICLE_LOOKRIGHT); + CHECK_ACTION(VEHICLE_HORN); + CHECK_ACTION(VEHICLE_HANDBRAKE); + CHECK_ACTION(VEHICLE_ACCELERATE); + CHECK_ACTION(VEHICLE_BRAKE); + CHECK_ACTION(VEHICLE_CHANGE_RADIO_STATION); + CHECK_ACTION(TOGGLE_SUBMISSIONS); + CHECK_ACTION(VEHICLE_TURRETLEFT); + CHECK_ACTION(VEHICLE_TURRETRIGHT); + CHECK_ACTION(VEHICLE_TURRETUP); + CHECK_ACTION(VEHICLE_TURRETDOWN); + CHECK_ACTION(VEHICLE_ENTER_EXIT); + CHECK_ACTION(CAMERA_CHANGE_VIEW_ALL_SITUATIONS); +#ifndef BIND_VEHICLE_FIREWEAPON + CHECK_ACTION(PED_FIREWEAPON); +#endif + CHECK_ACTION(GO_LEFT); + CHECK_ACTION(GO_RIGHT); + CHECK_ACTION(NETWORK_TALK); + CHECK_ACTION(SWITCH_DEBUG_CAM_ON); + CHECK_ACTION(TOGGLE_DPAD); + CHECK_ACTION(TAKE_SCREEN_SHOT); + CHECK_ACTION(SHOW_MOUSE_POINTER_TOGGLE); + } + return false; +} + +#undef CHECK_ACTION +#endif + void CControllerConfigManager::DeleteMatchingActionInitiators(e_ControllerAction action, int32 key, eControllerType type) { if (!GetIsKeyBlank(key, type)) diff --git a/src/core/ControllerConfig.h b/src/core/ControllerConfig.h index 604fb5cc..d61e23e6 100644 --- a/src/core/ControllerConfig.h +++ b/src/core/ControllerConfig.h @@ -195,6 +195,10 @@ public: void DeleteMatching1rstPersonControls (e_ControllerAction action, int32 key, eControllerType type); void DeleteMatchingActionInitiators (e_ControllerAction action, int32 key, eControllerType type); +#ifdef RADIO_SCROLL_TO_PREV_STATION + bool IsAnyVehicleActionAssignedToMouseKey(int32 key); +#endif + bool GetIsKeyBlank(int32 key, eControllerType type); e_ControllerActionType GetActionType(e_ControllerAction action); diff --git a/src/core/config.h b/src/core/config.h index 329d70b9..f64a7602 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -306,8 +306,8 @@ enum Config { // Hud, frontend and radar #define PC_MENU - #define FIX_RADAR // use radar size from early version before R* broke it +#define RADIO_OFF_TEXT // Won't work without FIX_BUGS #ifndef PC_MENU # define PS2_MENU @@ -376,6 +376,7 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually #define FREE_CAM // Rotating cam // Audio +#define RADIO_SCROLL_TO_PREV_STATION // Won't work without FIX_BUGS #define AUDIO_CACHE // cache sound lengths to speed up the cold boot //#define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds) //#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder @@ -462,6 +463,7 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually #undef BUTTON_ICONS #undef FIX_RADAR +#undef RADIO_OFF_TEXT #undef MAP_ENHANCEMENTS #undef MUCH_SHORTER_OUTRO_SCREEN @@ -490,4 +492,6 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually #undef IMPROVED_CAMERA #undef FREE_CAM #undef BIG_IMG + +#undef RADIO_SCROLL_TO_PREV_STATION #endif diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index e0419a65..ba7d52db 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -1227,7 +1227,7 @@ void CHud::Draw() m_HelpMessageDisplayTime = CMessages::GetWideStringLength(m_HelpMessage) * 0.05f + 3.0f; if (TheCamera.m_ScreenReductionPercentage == 0.0f) - DMAudio.PlayFrontEndSound(SOUND_HUD_SOUND, 0); + DMAudio.PlayFrontEndSound(SOUND_HUD, 0); break; case 1: case 2: diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp index 54685b66..a97e9af7 100644 --- a/src/save/GenericGameStorage.cpp +++ b/src/save/GenericGameStorage.cpp @@ -67,16 +67,16 @@ bool StillToFadeOut; uint32 TimeStartedCountingForFade; uint32 TimeToStayFadedBeforeFadeOut = 1750; -uint32 RadioStationPosition[NUM_RADIOS]; +int32 RadioStationPosition[NUM_RADIOS]; void InitRadioStationPositionList() { for (int i = 0; i < NUM_RADIOS; i++) - RadioStationPosition[i] = 0; + RadioStationPosition[i] = -1; } -uint32 +int32 GetSavedRadioStationPosition(int32 station) { return RadioStationPosition[station]; diff --git a/src/save/GenericGameStorage.h b/src/save/GenericGameStorage.h index 07aa23ca..65f1cc16 100644 --- a/src/save/GenericGameStorage.h +++ b/src/save/GenericGameStorage.h @@ -6,7 +6,7 @@ #define SLOT_COUNT (8) void InitRadioStationPositionList(); -uint32 GetSavedRadioStationPosition(int32 station); +int32 GetSavedRadioStationPosition(int32 station); void PopulateRadioStationPositionList(); bool GenericSave(int file); bool GenericLoad(); diff --git a/src/text/Text.cpp b/src/text/Text.cpp index 20229bf0..4931a97a 100644 --- a/src/text/Text.cpp +++ b/src/text/Text.cpp @@ -9,7 +9,7 @@ #include "Text.h" #include "Timer.h" -static wchar WideErrorString[25]; +wchar WideErrorString[25]; CText TheText; diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index 0ecc5004..4e6c24ef 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -152,7 +152,7 @@ CVehicle::CVehicle(uint8 CreatedBy) m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, this); if(m_audioEntityId >= 0) DMAudio.SetEntityStatus(m_audioEntityId, true); - //m_nRadioStation = CGeneral::GetRandomNumber() % USERTRACK; + //m_nRadioStation = CGeneral::GetRandomNumber() % NUM_RADIOS; switch(GetModelIndex()){ case MI_HUNTER: case MI_ANGEL: @@ -169,7 +169,7 @@ CVehicle::CVehicle(uint8 CreatedBy) m_nRadioStation = RADIO_OFF; break; default: - m_nRadioStation = CGeneral::GetRandomNumber() % USERTRACK; + m_nRadioStation = CGeneral::GetRandomNumber() % NUM_RADIOS; break; } m_pCurGroundEntity = nil; diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index 4a361215..2fb2caf4 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -266,7 +266,7 @@ public: eCarLock m_nDoorLock; int8 m_nLastWeaponDamage; // see eWeaponType, -1 if no damage CEntity *m_pLastDamageEntity; - int8 m_nRadioStation; + uint8 m_nRadioStation; uint8 m_bRainAudioCounter; uint8 m_bRainSamplesCounter; uint32 m_nCarHornTimer; |