|
|
|
@ -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,34 +543,77 @@ 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(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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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) {
|
|
|
|
|
field_2 = false;
|
|
|
|
|
m_bSetNextStation = false;
|
|
|
|
|
gNumRetunePresses = 0;
|
|
|
|
|
gRetuneCounter = 0;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(m_nAnnouncement == NO_TRACK) {
|
|
|
|
|
m_nStreamedTrack = NO_TRACK;
|
|
|
|
|
m_nNextTrack = NO_TRACK;
|
|
|
|
|
m_nFrontendTrack = GetCarTuning();
|
|
|
|
|
field_2 = false;
|
|
|
|
|
m_bSetNextStation = false;
|
|
|
|
|
gRetuneCounter = 0;
|
|
|
|
|
gNumRetunePresses = 0;
|
|
|
|
|
}
|
|
|
|
@ -583,36 +629,56 @@ cMusicManager::ServiceGameMode()
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
field_2 = true;
|
|
|
|
|
m_bSetNextStation = true;
|
|
|
|
|
gRetuneCounter = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
if (gRetuneCounter)
|
|
|
|
|
{
|
|
|
|
|
int32 station = gNumRetunePresses + vehicle->m_nRadioStation;
|
|
|
|
|
while (station >= RADIO_OFF) station -= RADIO_OFF;
|
|
|
|
|
#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 = NUM_RADIOS;
|
|
|
|
|
station = RADIO_OFF;
|
|
|
|
|
}
|
|
|
|
|
if (station == NUM_RADIOS)
|
|
|
|
|
if (station == RADIO_OFF)
|
|
|
|
|
{
|
|
|
|
|
if (gRetuneCounter == NUM_RADIOS + 9)
|
|
|
|
|
if (gRetuneCounter == 19) // One less then what switching radio sets, so runs right after turning off radio
|
|
|
|
|
{
|
|
|
|
|
AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_NO_RADIO, 0.0f);
|
|
|
|
|
AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_RADIO_TURN_OFF, 0.0f);
|
|
|
|
|
RadioStaticCounter = 5;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (station == WILDSTYLE && gRetuneCounter == NUM_RADIOS + 9)
|
|
|
|
|
AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_RADIO_CHANGE, 0.0f);
|
|
|
|
|
#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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -622,13 +688,13 @@ cMusicManager::ServiceGameMode()
|
|
|
|
|
RadioStaticCounter++;
|
|
|
|
|
RadioStaticTimer = CTimer::GetTimeInMilliseconds();
|
|
|
|
|
}
|
|
|
|
|
if (field_2)
|
|
|
|
|
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 (UsesPoliceRadio(vehicle))
|
|
|
|
@ -636,8 +702,8 @@ cMusicManager::ServiceGameMode()
|
|
|
|
|
else if (UsesTaxiRadio(vehicle))
|
|
|
|
|
m_nFrontendTrack = STREAMED_SOUND_RADIO_TAXI;
|
|
|
|
|
else {
|
|
|
|
|
m_nFrontendTrack = m_nRadioStation;
|
|
|
|
|
vehicle->m_nRadioStation = m_nRadioStation;
|
|
|
|
|
m_nFrontendTrack = m_nRadioStationScript;
|
|
|
|
|
vehicle->m_nRadioStation = m_nRadioStationScript;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (m_nRadioPosition != -1) {
|
|
|
|
@ -647,40 +713,13 @@ cMusicManager::ServiceGameMode()
|
|
|
|
|
|
|
|
|
|
gRetuneCounter = 0;
|
|
|
|
|
gNumRetunePresses = 0;
|
|
|
|
|
field_2 = false;
|
|
|
|
|
m_bSetNextStation = false;
|
|
|
|
|
m_bRadioSetByScript = false;
|
|
|
|
|
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 (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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_nFrontendTrack = GetCarTuning();
|
|
|
|
|
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
|
|
|
|
|