2019-05-30 21:24:47 +02:00
|
|
|
#include "MusicManager.h"
|
2019-09-21 22:10:35 +02:00
|
|
|
#include "Camera.h"
|
2019-06-16 00:20:55 +02:00
|
|
|
#include "Font.h"
|
|
|
|
#include "Hud.h"
|
2019-09-21 22:10:35 +02:00
|
|
|
#include "ModelIndices.h"
|
|
|
|
#include "Replay.h"
|
2019-06-16 00:20:55 +02:00
|
|
|
#include "Text.h"
|
|
|
|
#include "Timer.h"
|
|
|
|
#include "World.h"
|
2019-08-02 22:20:12 +02:00
|
|
|
#include "sampman.h"
|
2019-09-21 22:10:35 +02:00
|
|
|
#include "patcher.h"
|
2019-05-30 21:24:47 +02:00
|
|
|
|
2019-09-21 22:10:35 +02:00
|
|
|
cMusicManager &MusicManager = *(cMusicManager *)0x8F3964;
|
|
|
|
int32 &gNumRetunePresses = *(int32 *)0x650B80;
|
|
|
|
wchar *pCurrentStation = (wchar *)0x650B9C;
|
|
|
|
uint8 &cDisplay = *(uint8 *)0x650BA1;
|
2019-05-30 21:24:47 +02:00
|
|
|
|
2019-09-21 22:10:35 +02:00
|
|
|
WRAPPER char *
|
|
|
|
cMusicManager::Get3DProviderName(char)
|
|
|
|
{
|
|
|
|
EAXJMP(0x57A8C0);
|
|
|
|
}
|
2019-06-25 02:34:29 +02:00
|
|
|
|
2019-09-21 22:10:35 +02:00
|
|
|
bool
|
|
|
|
cMusicManager::PlayerInCar()
|
2019-06-17 02:10:55 +02:00
|
|
|
{
|
2019-09-21 22:10:35 +02:00
|
|
|
if(!FindPlayerVehicle())
|
2019-06-16 00:20:55 +02:00
|
|
|
return false;
|
|
|
|
else {
|
|
|
|
int32 State = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_nPedState;
|
|
|
|
|
2019-09-21 22:10:35 +02:00
|
|
|
if(State == PED_DRAG_FROM_CAR || State == PED_EXIT_CAR || State == PED_ARRESTED)
|
2019-06-16 00:20:55 +02:00
|
|
|
return false;
|
|
|
|
|
2019-09-21 22:10:35 +02:00
|
|
|
switch(FindPlayerVehicle()->m_modelIndex) {
|
2019-06-16 00:20:55 +02:00
|
|
|
case MI_FIRETRUCK:
|
|
|
|
case MI_AMBULAN:
|
|
|
|
case MI_MRWHOOP:
|
|
|
|
case MI_PREDATOR:
|
|
|
|
case MI_TRAIN:
|
|
|
|
case MI_SPEEDER:
|
|
|
|
case MI_REEFER:
|
2019-09-21 22:10:35 +02:00
|
|
|
case MI_GHOST: return false;
|
|
|
|
default: return true;
|
2019-06-16 00:20:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-20 15:18:15 +02:00
|
|
|
#if 0
|
|
|
|
WRAPPER void cMusicManager::DisplayRadioStationName(void) { EAXJMP(0x57E6D0); }
|
|
|
|
#else
|
2019-09-21 22:10:35 +02:00
|
|
|
void
|
|
|
|
cMusicManager::DisplayRadioStationName()
|
2019-06-17 02:10:55 +02:00
|
|
|
{
|
2019-06-20 02:31:03 +02:00
|
|
|
int8 pRetune;
|
|
|
|
int8 gStreamedSound;
|
|
|
|
int8 gRetuneCounter;
|
|
|
|
|
2019-09-21 22:10:35 +02:00
|
|
|
if(!CTimer::GetIsPaused() && !TheCamera.m_WideScreenOn && cMusicManager::PlayerInCar() &&
|
|
|
|
!CReplay::IsPlayingBack()) {
|
|
|
|
if(MusicManager.m_bPlayerInCar && !MusicManager.m_bPreviousPlayerInCar)
|
2019-06-30 12:53:39 +02:00
|
|
|
pCurrentStation = nil;
|
2019-06-20 02:31:03 +02:00
|
|
|
|
2019-09-21 22:10:35 +02:00
|
|
|
if(SampleManager.IsMP3RadioChannelAvailable()) {
|
2019-06-20 02:31:03 +02:00
|
|
|
gStreamedSound = MusicManager.m_nCurrentStreamedSound;
|
|
|
|
|
2019-09-21 22:10:35 +02:00
|
|
|
if(gStreamedSound != STREAMED_SOUND_CITY_AMBIENT &&
|
|
|
|
gStreamedSound != STREAMED_SOUND_WATER_AMBIENT) {
|
|
|
|
if(gStreamedSound > STREAMED_SOUND_RADIO_MP3_PLAYER) return;
|
|
|
|
} else {
|
2019-06-20 02:31:03 +02:00
|
|
|
gStreamedSound = STREAMED_SOUND_RADIO_POLICE;
|
|
|
|
}
|
|
|
|
|
|
|
|
pRetune = gNumRetunePresses + gStreamedSound;
|
|
|
|
|
2019-09-21 22:10:35 +02:00
|
|
|
if(pRetune == POLICE_RADIO) {
|
2019-06-20 02:31:03 +02:00
|
|
|
pRetune = RADIO_OFF;
|
2019-09-21 22:10:35 +02:00
|
|
|
} else if(pRetune > POLICE_RADIO) {
|
2019-06-20 02:31:03 +02:00
|
|
|
pRetune = pRetune - 11;
|
|
|
|
}
|
2019-09-21 22:10:35 +02:00
|
|
|
} else {
|
2019-06-20 02:31:03 +02:00
|
|
|
gStreamedSound = MusicManager.m_nCurrentStreamedSound;
|
|
|
|
pRetune = gNumRetunePresses + gStreamedSound;
|
|
|
|
|
2019-09-21 22:10:35 +02:00
|
|
|
if(pRetune >= USERTRACK) {
|
2019-06-20 02:31:03 +02:00
|
|
|
gRetuneCounter = gNumRetunePresses;
|
|
|
|
pRetune = MusicManager.m_nCurrentStreamedSound;
|
2019-06-16 00:20:55 +02:00
|
|
|
|
2019-09-21 22:10:35 +02:00
|
|
|
if(gStreamedSound == STREAMED_SOUND_WATER_AMBIENT)
|
2019-06-20 02:31:03 +02:00
|
|
|
pRetune = RADIO_OFF;
|
|
|
|
|
2019-09-21 22:10:35 +02:00
|
|
|
while(gRetuneCounter) {
|
|
|
|
if(pRetune == RADIO_OFF) {
|
2019-06-20 02:31:03 +02:00
|
|
|
pRetune = HEAD_RADIO;
|
2019-09-21 22:10:35 +02:00
|
|
|
} else if(pRetune < USERTRACK) {
|
2019-06-20 02:31:03 +02:00
|
|
|
pRetune = pRetune + 1;
|
2019-06-16 00:20:55 +02:00
|
|
|
}
|
2019-09-21 22:10:35 +02:00
|
|
|
if(pRetune == USERTRACK) pRetune = RADIO_OFF;
|
2019-06-20 02:31:03 +02:00
|
|
|
|
|
|
|
--gRetuneCounter;
|
2019-06-16 00:20:55 +02:00
|
|
|
}
|
|
|
|
}
|
2019-06-20 02:31:03 +02:00
|
|
|
}
|
2019-06-16 00:20:55 +02:00
|
|
|
|
2019-06-30 12:53:39 +02:00
|
|
|
wchar *string = nil;
|
2019-06-16 00:20:55 +02:00
|
|
|
|
2019-09-21 22:10:35 +02:00
|
|
|
switch(pRetune) {
|
|
|
|
case HEAD_RADIO: string = TheText.Get("FEA_FM0"); break;
|
|
|
|
case DOUBLE_CLEF: string = TheText.Get("FEA_FM1"); break;
|
|
|
|
case JAH_RADIO: string = TheText.Get("FEA_FM2"); break;
|
|
|
|
case RISE_FM: string = TheText.Get("FEA_FM3"); break;
|
|
|
|
case LIPS_106: string = TheText.Get("FEA_FM4"); break;
|
|
|
|
case GAME_FM: string = TheText.Get("FEA_FM5"); break;
|
|
|
|
case MSX_FM: string = TheText.Get("FEA_FM6"); break;
|
|
|
|
case FLASHBACK: string = TheText.Get("FEA_FM7"); break;
|
|
|
|
case CHATTERBOX: string = TheText.Get("FEA_FM8"); break;
|
|
|
|
case USERTRACK: string = TheText.Get("FEA_FM9"); break;
|
|
|
|
default: return;
|
2019-06-20 02:31:03 +02:00
|
|
|
};
|
2019-06-16 00:20:55 +02:00
|
|
|
|
2019-09-21 22:10:35 +02:00
|
|
|
if(pRetune > CHATTERBOX && !SampleManager.IsMP3RadioChannelAvailable()) { return; }
|
2019-06-16 00:20:55 +02:00
|
|
|
|
2019-09-21 22:10:35 +02:00
|
|
|
if(string && pCurrentStation != string ||
|
|
|
|
MusicManager.m_nCurrentStreamedSound == STREAMED_SOUND_RADIO_MP3_PLAYER &&
|
|
|
|
MusicManager.m_nPreviousStreamedSound != STREAMED_SOUND_RADIO_MP3_PLAYER) {
|
2019-06-20 02:31:03 +02:00
|
|
|
pCurrentStation = string;
|
|
|
|
cDisplay = 60;
|
2019-09-21 22:10:35 +02:00
|
|
|
} else {
|
|
|
|
if(!cDisplay) return;
|
2019-06-20 02:31:03 +02:00
|
|
|
--cDisplay;
|
2019-06-16 00:20:55 +02:00
|
|
|
}
|
2019-06-20 02:31:03 +02:00
|
|
|
|
|
|
|
CFont::SetJustifyOff();
|
|
|
|
CFont::SetBackgroundOff();
|
|
|
|
CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f));
|
|
|
|
CFont::SetPropOn();
|
|
|
|
CFont::SetFontStyle(FONT_HEADING);
|
|
|
|
CFont::SetCentreOn();
|
|
|
|
CFont::SetCentreSize(SCREEN_SCALE_X(640.0f));
|
|
|
|
CFont::SetColor(CRGBA(0, 0, 0, 255));
|
2019-10-06 20:31:34 +02:00
|
|
|
CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(22.0f) + SCREEN_SCALE_Y(2.0f), pCurrentStation);
|
2019-06-20 02:31:03 +02:00
|
|
|
|
2019-09-21 22:10:35 +02:00
|
|
|
if(gNumRetunePresses)
|
2019-06-20 02:31:03 +02:00
|
|
|
CFont::SetColor(CRGBA(102, 133, 143, 255));
|
|
|
|
else
|
|
|
|
CFont::SetColor(CRGBA(147, 196, 211, 255));
|
|
|
|
|
|
|
|
CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_SCALE_Y(22.0f), pCurrentStation);
|
|
|
|
CFont::DrawFonts();
|
2019-06-16 00:20:55 +02:00
|
|
|
}
|
2019-06-17 02:10:55 +02:00
|
|
|
}
|
2019-06-20 15:18:15 +02:00
|
|
|
#endif
|
2019-07-05 21:15:32 +02:00
|
|
|
|
|
|
|
WRAPPER
|
|
|
|
void
|
|
|
|
cMusicManager::Initialise()
|
|
|
|
{
|
|
|
|
EAXJMP(0x57CF70);
|
|
|
|
}
|
|
|
|
|
|
|
|
WRAPPER
|
|
|
|
void
|
|
|
|
cMusicManager::Terminate()
|
|
|
|
{
|
|
|
|
EAXJMP(0x57D140);
|
|
|
|
}
|
2019-07-16 17:03:37 +02:00
|
|
|
|
|
|
|
WRAPPER
|
|
|
|
void
|
|
|
|
cMusicManager::ChangeMusicMode(int32 mode)
|
|
|
|
{
|
|
|
|
EAXJMP(0x57D310);
|
|
|
|
}
|
|
|
|
|
|
|
|
WRAPPER
|
|
|
|
void
|
|
|
|
cMusicManager::StopFrontEndTrack()
|
|
|
|
{
|
|
|
|
EAXJMP(0x57E3D0);
|
|
|
|
}
|
2019-08-15 03:43:00 +02:00
|
|
|
|
2019-09-21 22:10:35 +02:00
|
|
|
WRAPPER void
|
|
|
|
cMusicManager::PlayAnnouncement(unsigned char)
|
2019-08-15 03:43:00 +02:00
|
|
|
{
|
|
|
|
EAXJMP(0x57E430);
|
|
|
|
}
|
|
|
|
|
2019-09-21 22:10:35 +02:00
|
|
|
WRAPPER void
|
|
|
|
cMusicManager::PlayFrontEndTrack(unsigned char, unsigned char)
|
2019-08-15 03:43:00 +02:00
|
|
|
{
|
|
|
|
EAXJMP(0x57E2E0);
|
|
|
|
}
|
|
|
|
|
2019-09-21 22:10:35 +02:00
|
|
|
WRAPPER void
|
|
|
|
cMusicManager::PreloadCutSceneMusic(unsigned char)
|
2019-08-15 03:43:00 +02:00
|
|
|
{
|
|
|
|
EAXJMP(0x57E210);
|
|
|
|
}
|
|
|
|
|
2019-09-21 22:10:35 +02:00
|
|
|
WRAPPER void
|
|
|
|
cMusicManager::PlayPreloadedCutSceneMusic(void)
|
2019-08-15 03:43:00 +02:00
|
|
|
{
|
|
|
|
EAXJMP(0x57E290);
|
|
|
|
}
|
|
|
|
|
2019-09-21 22:10:35 +02:00
|
|
|
WRAPPER void
|
|
|
|
cMusicManager::StopCutSceneMusic(void)
|
2019-08-15 03:43:00 +02:00
|
|
|
{
|
|
|
|
EAXJMP(0x57E2B0);
|
|
|
|
}
|
|
|
|
|
2019-09-21 22:10:35 +02:00
|
|
|
WRAPPER int32
|
|
|
|
cMusicManager::GetRadioInCar(void)
|
2019-08-15 03:43:00 +02:00
|
|
|
{
|
|
|
|
EAXJMP(0x57D1D0);
|
|
|
|
}
|
|
|
|
|
2019-09-21 22:10:35 +02:00
|
|
|
WRAPPER void
|
|
|
|
cMusicManager::SetRadioInCar(unsigned int)
|
2019-08-15 03:43:00 +02:00
|
|
|
{
|
|
|
|
EAXJMP(0x57D2C0);
|
|
|
|
}
|
|
|
|
|
2019-08-30 00:44:57 +02:00
|
|
|
WRAPPER void
|
|
|
|
cMusicManager::SetRadioChannelByScript(unsigned char, int)
|
2019-08-15 03:43:00 +02:00
|
|
|
{
|
|
|
|
EAXJMP(0x57D180);
|
2019-08-30 00:44:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
WRAPPER
|
|
|
|
void
|
|
|
|
cMusicManager::ResetMusicAfterReload()
|
|
|
|
{
|
|
|
|
EAXJMP(0x57CF30);
|
2019-09-21 22:10:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
WRAPPER
|
|
|
|
void cMusicManager::ResetTimers(int32) { EAXJMP(0x57D420); }
|
|
|
|
|
|
|
|
WRAPPER
|
|
|
|
void
|
|
|
|
cMusicManager::Service()
|
|
|
|
{
|
|
|
|
EAXJMP(0x57D440);
|
2019-08-15 03:43:00 +02:00
|
|
|
}
|