1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-22 22:20:01 +00:00

Merge pull request #1016 from erorcun/miami

Overhaul MusicManager - fix radio bugs, scroll to prev station, radio…
This commit is contained in:
erorcun 2021-02-02 05:31:29 +03:00 committed by GitHub
commit 1eb77c4d6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 393 additions and 264 deletions

View file

@ -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);

View file

@ -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 (!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 (gNumRetunePresses != 0)
{
if (--gRetuneCounter == 0)
{
field_2 = true;
gRetuneCounter = 0;
}
}
if (gRetuneCounter)
{
int32 station = gNumRetunePresses + vehicle->m_nRadioStation;
while (station >= RADIO_OFF) station -= RADIO_OFF;
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
{
if (station == WILDSTYLE && gRetuneCounter == NUM_RADIOS + 9)
AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_RADIO_CHANGE, 0.0f);
AudioManager.DoPoliceRadioCrackle();
}
}
if (RadioStaticCounter < 2 && CTimer::GetTimeInMilliseconds() > RadioStaticTimer + 800)
{
AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_RADIO_CHANGE, 0.0f);
RadioStaticCounter++;
RadioStaticTimer = CTimer::GetTimeInMilliseconds();
}
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;
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_nRadioStation;
vehicle->m_nRadioStation = m_nRadioStation;
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_nRadioPosition != -1) {
m_aTracks[m_nFrontendTrack].m_nPosition = m_nRadioPosition;
m_aTracks[m_nFrontendTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
// 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);
}
gRetuneCounter = 0;
gNumRetunePresses = 0;
field_2 = false;
m_bRadioSetByScript = false;
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 (--gRetuneCounter == 0)
{
m_bSetNextStation = true;
gRetuneCounter = 0;
}
}
#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;
// 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
{
AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_RADIO_TURN_OFF, 0.0f);
RadioStaticCounter = 5;
}
}
else
{
#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 (RadioStaticCounter < 2 && CTimer::GetTimeInMilliseconds() > RadioStaticTimer + 800)
{
AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_RADIO_CHANGE, 0.0f);
RadioStaticCounter++;
RadioStaticTimer = CTimer::GetTimeInMilliseconds();
}
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 (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 (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;
}
m_nFrontendTrack = GetCarTuning();
if (m_nRadioPosition != -1) {
m_aTracks[m_nFrontendTrack].m_nPosition = m_nRadioPosition;
m_aTracks[m_nFrontendTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
}
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

View file

@ -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;

View file

@ -14,8 +14,8 @@ enum eRadioStation
USERTRACK,
NUM_RADIOS = 10,
POLICE_RADIO = 10,
RADIO_OFF = 10,
//TAXI_RADIO,
RADIO_OFF,
};
enum eMusicMode

View file

@ -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,

View file

@ -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!

View file

@ -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))

View file

@ -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);

View file

@ -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

View file

@ -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:

View file

@ -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];

View file

@ -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();

View file

@ -9,7 +9,7 @@
#include "Text.h"
#include "Timer.h"
static wchar WideErrorString[25];
wchar WideErrorString[25];
CText TheText;

View file

@ -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;

View file

@ -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;