summaryrefslogtreecommitdiffstats
path: root/src/audio/MusicManager.cpp
diff options
context:
space:
mode:
authorFilip Gawin <filip.gawin@zoho.com>2019-09-21 22:10:35 +0200
committerFilip Gawin <filip.gawin@zoho.com>2019-10-26 13:05:00 +0200
commit003ac856c6e239722241c40358ea91d3c5e64c3a (patch)
tree104e0cd9bc331f049dd01d312f55c8d6086acd82 /src/audio/MusicManager.cpp
parentaudio7 (diff)
downloadre3-003ac856c6e239722241c40358ea91d3c5e64c3a.tar
re3-003ac856c6e239722241c40358ea91d3c5e64c3a.tar.gz
re3-003ac856c6e239722241c40358ea91d3c5e64c3a.tar.bz2
re3-003ac856c6e239722241c40358ea91d3c5e64c3a.tar.lz
re3-003ac856c6e239722241c40358ea91d3c5e64c3a.tar.xz
re3-003ac856c6e239722241c40358ea91d3c5e64c3a.tar.zst
re3-003ac856c6e239722241c40358ea91d3c5e64c3a.zip
Diffstat (limited to '')
-rw-r--r--src/audio/MusicManager.cpp172
1 files changed, 82 insertions, 90 deletions
diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp
index a14994cd..fa1a9390 100644
--- a/src/audio/MusicManager.cpp
+++ b/src/audio/MusicManager.cpp
@@ -1,34 +1,38 @@
-#include "common.h"
-#include "patcher.h"
#include "MusicManager.h"
+#include "Camera.h"
#include "Font.h"
#include "Hud.h"
+#include "ModelIndices.h"
+#include "Replay.h"
#include "Text.h"
#include "Timer.h"
-#include "Camera.h"
#include "World.h"
-#include "ModelIndices.h"
#include "sampman.h"
-#include "Replay.h"
+#include "patcher.h"
-cMusicManager &MusicManager = *(cMusicManager*)0x8F3964;
-int32 &gNumRetunePresses = *(int32*)0x650B80;
-wchar *pCurrentStation = (wchar*)0x650B9C;
-uint8 &cDisplay = *(uint8*)0x650BA1;
+cMusicManager &MusicManager = *(cMusicManager *)0x8F3964;
+int32 &gNumRetunePresses = *(int32 *)0x650B80;
+wchar *pCurrentStation = (wchar *)0x650B9C;
+uint8 &cDisplay = *(uint8 *)0x650BA1;
-WRAPPER char* cMusicManager::Get3DProviderName(char) { EAXJMP(0x57A8C0); }
+WRAPPER char *
+cMusicManager::Get3DProviderName(char)
+{
+ EAXJMP(0x57A8C0);
+}
-bool cMusicManager::PlayerInCar()
+bool
+cMusicManager::PlayerInCar()
{
- if (!FindPlayerVehicle())
+ 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)
+ if(State == PED_DRAG_FROM_CAR || State == PED_EXIT_CAR || State == PED_ARRESTED)
return false;
- switch (FindPlayerVehicle()->m_modelIndex) {
+ switch(FindPlayerVehicle()->m_modelIndex) {
case MI_FIRETRUCK:
case MI_AMBULAN:
case MI_MRWHOOP:
@@ -36,10 +40,8 @@ bool cMusicManager::PlayerInCar()
case MI_TRAIN:
case MI_SPEEDER:
case MI_REEFER:
- case MI_GHOST:
- return false;
- default:
- return true;
+ case MI_GHOST: return false;
+ default: return true;
}
}
}
@@ -47,56 +49,53 @@ bool cMusicManager::PlayerInCar()
#if 0
WRAPPER void cMusicManager::DisplayRadioStationName(void) { EAXJMP(0x57E6D0); }
#else
-void cMusicManager::DisplayRadioStationName()
+void
+cMusicManager::DisplayRadioStationName()
{
int8 pRetune;
int8 gStreamedSound;
int8 gRetuneCounter;
- if (!CTimer::GetIsPaused() && !TheCamera.m_WideScreenOn && cMusicManager::PlayerInCar() && !CReplay::IsPlayingBack()) {
- if (MusicManager.m_bPlayerInCar && !MusicManager.m_bPreviousPlayerInCar)
+ if(!CTimer::GetIsPaused() && !TheCamera.m_WideScreenOn && cMusicManager::PlayerInCar() &&
+ !CReplay::IsPlayingBack()) {
+ if(MusicManager.m_bPlayerInCar && !MusicManager.m_bPreviousPlayerInCar)
pCurrentStation = nil;
- if (SampleManager.IsMP3RadioChannelAvailable()) {
+ if(SampleManager.IsMP3RadioChannelAvailable()) {
gStreamedSound = MusicManager.m_nCurrentStreamedSound;
- if (gStreamedSound != STREAMED_SOUND_CITY_AMBIENT && gStreamedSound != STREAMED_SOUND_WATER_AMBIENT) {
- if (gStreamedSound > STREAMED_SOUND_RADIO_MP3_PLAYER)
- return;
- }
- else {
+ if(gStreamedSound != STREAMED_SOUND_CITY_AMBIENT &&
+ gStreamedSound != STREAMED_SOUND_WATER_AMBIENT) {
+ if(gStreamedSound > STREAMED_SOUND_RADIO_MP3_PLAYER) return;
+ } else {
gStreamedSound = STREAMED_SOUND_RADIO_POLICE;
}
pRetune = gNumRetunePresses + gStreamedSound;
- if (pRetune == POLICE_RADIO) {
+ if(pRetune == POLICE_RADIO) {
pRetune = RADIO_OFF;
- }
- else if (pRetune > POLICE_RADIO) {
+ } else if(pRetune > POLICE_RADIO) {
pRetune = pRetune - 11;
}
- }
- else {
+ } else {
gStreamedSound = MusicManager.m_nCurrentStreamedSound;
pRetune = gNumRetunePresses + gStreamedSound;
- if (pRetune >= USERTRACK) {
+ if(pRetune >= USERTRACK) {
gRetuneCounter = gNumRetunePresses;
pRetune = MusicManager.m_nCurrentStreamedSound;
- if (gStreamedSound == STREAMED_SOUND_WATER_AMBIENT)
+ if(gStreamedSound == STREAMED_SOUND_WATER_AMBIENT)
pRetune = RADIO_OFF;
- while (gRetuneCounter) {
- if (pRetune == RADIO_OFF) {
+ while(gRetuneCounter) {
+ if(pRetune == RADIO_OFF) {
pRetune = HEAD_RADIO;
- }
- else if (pRetune < USERTRACK) {
+ } else if(pRetune < USERTRACK) {
pRetune = pRetune + 1;
}
- if (pRetune == USERTRACK)
- pRetune = RADIO_OFF;
+ if(pRetune == USERTRACK) pRetune = RADIO_OFF;
--gRetuneCounter;
}
@@ -105,52 +104,29 @@ void cMusicManager::DisplayRadioStationName()
wchar *string = nil;
- 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;
+ 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;
};
- if (pRetune > CHATTERBOX && !SampleManager.IsMP3RadioChannelAvailable()) {
- return;
- }
+ if(pRetune > CHATTERBOX && !SampleManager.IsMP3RadioChannelAvailable()) { return; }
- if (string && pCurrentStation != string || MusicManager.m_nCurrentStreamedSound == STREAMED_SOUND_RADIO_MP3_PLAYER && MusicManager.m_nPreviousStreamedSound != STREAMED_SOUND_RADIO_MP3_PLAYER) {
+ if(string && pCurrentStation != string ||
+ MusicManager.m_nCurrentStreamedSound == STREAMED_SOUND_RADIO_MP3_PLAYER &&
+ MusicManager.m_nPreviousStreamedSound != STREAMED_SOUND_RADIO_MP3_PLAYER) {
pCurrentStation = string;
cDisplay = 60;
- }
- else {
- if (!cDisplay)
- return;
+ } else {
+ if(!cDisplay) return;
--cDisplay;
}
@@ -164,7 +140,7 @@ void cMusicManager::DisplayRadioStationName()
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(22.0f) + SCREEN_SCALE_Y(2.0f), pCurrentStation);
- if (gNumRetunePresses)
+ if(gNumRetunePresses)
CFont::SetColor(CRGBA(102, 133, 143, 255));
else
CFont::SetColor(CRGBA(147, 196, 211, 255));
@@ -203,38 +179,44 @@ cMusicManager::StopFrontEndTrack()
EAXJMP(0x57E3D0);
}
-
-WRAPPER void cMusicManager::PlayAnnouncement(unsigned char)
+WRAPPER void
+cMusicManager::PlayAnnouncement(unsigned char)
{
EAXJMP(0x57E430);
}
-WRAPPER void cMusicManager::PlayFrontEndTrack(unsigned char, unsigned char)
+WRAPPER void
+cMusicManager::PlayFrontEndTrack(unsigned char, unsigned char)
{
EAXJMP(0x57E2E0);
}
-WRAPPER void cMusicManager::PreloadCutSceneMusic(unsigned char)
+WRAPPER void
+cMusicManager::PreloadCutSceneMusic(unsigned char)
{
EAXJMP(0x57E210);
}
-WRAPPER void cMusicManager::PlayPreloadedCutSceneMusic(void)
+WRAPPER void
+cMusicManager::PlayPreloadedCutSceneMusic(void)
{
EAXJMP(0x57E290);
}
-WRAPPER void cMusicManager::StopCutSceneMusic(void)
+WRAPPER void
+cMusicManager::StopCutSceneMusic(void)
{
EAXJMP(0x57E2B0);
}
-WRAPPER int32 cMusicManager::GetRadioInCar(void)
+WRAPPER int32
+cMusicManager::GetRadioInCar(void)
{
EAXJMP(0x57D1D0);
}
-WRAPPER void cMusicManager::SetRadioInCar(unsigned int)
+WRAPPER void
+cMusicManager::SetRadioInCar(unsigned int)
{
EAXJMP(0x57D2C0);
}
@@ -250,4 +232,14 @@ void
cMusicManager::ResetMusicAfterReload()
{
EAXJMP(0x57CF30);
+}
+
+WRAPPER
+void cMusicManager::ResetTimers(int32) { EAXJMP(0x57D420); }
+
+WRAPPER
+void
+cMusicManager::Service()
+{
+ EAXJMP(0x57D440);
} \ No newline at end of file