2019-05-30 19:24:47 +00:00
|
|
|
#include "common.h"
|
|
|
|
#include "patcher.h"
|
|
|
|
#include "MusicManager.h"
|
2019-06-15 22:20:55 +00:00
|
|
|
#include "Font.h"
|
|
|
|
#include "Hud.h"
|
|
|
|
#include "Text.h"
|
|
|
|
#include "Timer.h"
|
|
|
|
#include "Camera.h"
|
|
|
|
#include "World.h"
|
|
|
|
#include "ModelIndices.h"
|
|
|
|
#include "SampleManager.h"
|
2019-05-30 19:24:47 +00:00
|
|
|
|
|
|
|
cMusicManager &MusicManager = *(cMusicManager*)0x8F3964;
|
2019-06-15 22:20:55 +00:00
|
|
|
int &gNumRetunePresses = *(int*)0x650B80;
|
|
|
|
int &gRetuneCounter = *(int*)0x650B84;
|
2019-05-30 19:24:47 +00:00
|
|
|
|
2019-06-15 22:20:55 +00:00
|
|
|
//WRAPPER void cMusicManager::DisplayRadioStationName(void) { EAXJMP(0x57E6D0); }
|
|
|
|
|
2019-06-17 00:10:55 +00:00
|
|
|
bool cMusicManager::PlayerInCar()
|
|
|
|
{
|
2019-06-15 22:20:55 +00:00
|
|
|
if (!FindPlayerVehicle())
|
|
|
|
return false;
|
|
|
|
else {
|
|
|
|
int32 State = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_nPedState;
|
|
|
|
|
|
|
|
if (State == PED_DRAG_FROM_CAR || State == PED_EXIT_CAR || State == PED_ARRESTED)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
switch (FindPlayerVehicle()->m_modelIndex) {
|
|
|
|
case MI_FIRETRUCK:
|
|
|
|
case MI_AMBULAN:
|
|
|
|
case MI_MRWHOOP:
|
|
|
|
case MI_PREDATOR:
|
|
|
|
case MI_TRAIN:
|
|
|
|
case MI_SPEEDER:
|
|
|
|
case MI_REEFER:
|
|
|
|
case MI_GHOST:
|
|
|
|
return false;
|
|
|
|
default:
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-17 00:10:55 +00:00
|
|
|
void cMusicManager::DisplayRadioStationName()
|
|
|
|
{
|
|
|
|
wchar *RadioName = nullptr;
|
2019-06-15 22:20:55 +00:00
|
|
|
uint32 RadioStation = gNumRetunePresses + MusicManager.m_nCurrentStreamedSound;
|
|
|
|
|
|
|
|
switch (RadioStation) {
|
|
|
|
case HEAD_RADIO:
|
|
|
|
RadioName = TheText.Get("FEA_FM0");
|
|
|
|
break;
|
|
|
|
case DOUBLE_CLEF:
|
|
|
|
RadioName = TheText.Get("FEA_FM1");
|
|
|
|
break;
|
|
|
|
case JAH_RADIO:
|
|
|
|
RadioName = TheText.Get("FEA_FM2");
|
|
|
|
break;
|
|
|
|
case RISE_FM:
|
|
|
|
RadioName = TheText.Get("FEA_FM3");
|
|
|
|
break;
|
|
|
|
case LIPS_106:
|
|
|
|
RadioName = TheText.Get("FEA_FM4");
|
|
|
|
break;
|
|
|
|
case GAME_FM:
|
|
|
|
RadioName = TheText.Get("FEA_FM5");
|
|
|
|
break;
|
|
|
|
case MSX_FM:
|
|
|
|
RadioName = TheText.Get("FEA_FM6");
|
|
|
|
break;
|
|
|
|
case FLASHBACK:
|
|
|
|
RadioName = TheText.Get("FEA_FM7");
|
|
|
|
break;
|
|
|
|
case CHATTERBOX:
|
|
|
|
RadioName = TheText.Get("FEA_FM8");
|
|
|
|
break;
|
|
|
|
case USERTRACK:
|
|
|
|
RadioName = TheText.Get("FEA_FM9");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
RadioName = nullptr;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
CFont::SetJustifyOff();
|
|
|
|
CFont::SetBackgroundOff();
|
2019-06-17 00:10:55 +00:00
|
|
|
CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f));
|
2019-06-15 22:20:55 +00:00
|
|
|
CFont::SetPropOn();
|
|
|
|
CFont::SetFontStyle(FONT_HEADING);
|
|
|
|
CFont::SetCentreOn();
|
2019-06-17 00:10:55 +00:00
|
|
|
CFont::SetCentreSize(HUD_STRETCH_X(640.0f));;
|
2019-06-15 22:20:55 +00:00
|
|
|
|
|
|
|
static int32 nTime = 0;
|
|
|
|
if (!CTimer::GetIsPaused() && !TheCamera.m_WideScreenOn && MusicManager.PlayerInCar()) {
|
|
|
|
if (gNumRetunePresses || (MusicManager.m_bPlayerInCar && !MusicManager.m_bPreviousPlayerInCar))
|
|
|
|
nTime = CTimer::GetTimeInMilliseconds() + 2000;
|
|
|
|
|
|
|
|
if (CTimer::GetTimeInMilliseconds() < nTime) {
|
|
|
|
if (RadioStation) {
|
|
|
|
if (MusicManager.m_nCurrentStreamedSound == STREAMED_SOUND_WATER_AMBIENT ||
|
|
|
|
MusicManager.m_nCurrentStreamedSound == STREAMED_SOUND_RADIO_POLICE ||
|
|
|
|
MusicManager.m_nCurrentStreamedSound == STREAMED_SOUND_WATER_AMBIENT ||
|
|
|
|
MusicManager.m_nCurrentStreamedSound == STREAMED_SOUND_CITY_AMBIENT)
|
|
|
|
RadioStation = RADIO_OFF;
|
|
|
|
else {
|
|
|
|
if (RadioStation > HEAD_RADIO) {
|
|
|
|
if (cSampleManager.IsMP3RadioChannelAvailable()) {
|
2019-06-17 00:10:55 +00:00
|
|
|
if (RadioStation > USERTRACK) {
|
2019-06-15 22:20:55 +00:00
|
|
|
RadioStation = RADIO_OFF;
|
2019-06-17 00:10:55 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-06-15 22:20:55 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-06-17 00:10:55 +00:00
|
|
|
if (RadioStation > CHATTERBOX) {
|
2019-06-15 22:20:55 +00:00
|
|
|
RadioStation = RADIO_OFF;
|
2019-06-17 00:10:55 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-06-15 22:20:55 +00:00
|
|
|
}
|
|
|
|
}
|
2019-06-17 00:10:55 +00:00
|
|
|
else
|
2019-06-15 22:20:55 +00:00
|
|
|
RadioStation = RADIO_OFF;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RadioName) {
|
|
|
|
CFont::SetColor(CRGBA(0, 0, 0, 255));
|
|
|
|
|
2019-06-17 00:10:55 +00:00
|
|
|
CFont::PrintString(SCREEN_WIDTH / 2, HUD_STRETCH_Y(23.0f), RadioName);
|
2019-06-15 22:20:55 +00:00
|
|
|
|
|
|
|
if (gNumRetunePresses)
|
|
|
|
CFont::SetColor(CRGBA(102, 133, 143, 255));
|
|
|
|
else
|
|
|
|
CFont::SetColor(CRGBA(147, 196, 211, 255));
|
|
|
|
|
2019-06-17 00:10:55 +00:00
|
|
|
CFont::PrintString(SCREEN_WIDTH / 2, HUD_STRETCH_Y(22.0f), RadioName);
|
2019-06-15 22:20:55 +00:00
|
|
|
CFont::DrawFonts();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-06-17 00:10:55 +00:00
|
|
|
}
|