summaryrefslogtreecommitdiffstats
path: root/src/audio
diff options
context:
space:
mode:
author_AG <gennariarmando@outlook.com>2019-06-20 02:31:03 +0200
committer_AG <gennariarmando@outlook.com>2019-06-20 02:32:36 +0200
commit2ce7bcc405daf1b01f9220e7b584bc7c318ec5cd (patch)
tree4cbfefeedd462f46b29d4b1c9004f17eefebc364 /src/audio
parentfinally finished CVehicleModelInfo (diff)
downloadre3-2ce7bcc405daf1b01f9220e7b584bc7c318ec5cd.tar
re3-2ce7bcc405daf1b01f9220e7b584bc7c318ec5cd.tar.gz
re3-2ce7bcc405daf1b01f9220e7b584bc7c318ec5cd.tar.bz2
re3-2ce7bcc405daf1b01f9220e7b584bc7c318ec5cd.tar.lz
re3-2ce7bcc405daf1b01f9220e7b584bc7c318ec5cd.tar.xz
re3-2ce7bcc405daf1b01f9220e7b584bc7c318ec5cd.tar.zst
re3-2ce7bcc405daf1b01f9220e7b584bc7c318ec5cd.zip
Diffstat (limited to '')
-rw-r--r--src/audio/MusicManager.cpp203
-rw-r--r--src/audio/SampleManager.h2
2 files changed, 118 insertions, 87 deletions
diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp
index 881f6407..c7a49186 100644
--- a/src/audio/MusicManager.cpp
+++ b/src/audio/MusicManager.cpp
@@ -9,10 +9,12 @@
#include "World.h"
#include "ModelIndices.h"
#include "SampleManager.h"
+#include "Replay.h"
cMusicManager &MusicManager = *(cMusicManager*)0x8F3964;
-int &gNumRetunePresses = *(int*)0x650B80;
-int &gRetuneCounter = *(int*)0x650B84;
+int32 &gNumRetunePresses = *(int32*)0x650B80;
+wchar *pCurrentStation = (wchar*)0x650B9C;
+uint8 &cDisplay = *(uint8*)0x650BA1;
//WRAPPER void cMusicManager::DisplayRadioStationName(void) { EAXJMP(0x57E6D0); }
@@ -44,98 +46,127 @@ bool cMusicManager::PlayerInCar()
void cMusicManager::DisplayRadioStationName()
{
- wchar *RadioName = nullptr;
- 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;
- }
+ int8 pRetune;
+ int8 gStreamedSound;
+ int8 gRetuneCounter;
+
+ if (!CTimer::GetIsPaused() && !TheCamera.m_WideScreenOn && cMusicManager::PlayerInCar() && CReplay::Mode != 1) {
+ if (MusicManager.m_bPlayerInCar && !MusicManager.m_bPreviousPlayerInCar)
+ pCurrentStation = nullptr;
+
+ if (cSampleManager.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 {
+ gStreamedSound = STREAMED_SOUND_RADIO_POLICE;
+ }
+
+ pRetune = gNumRetunePresses + gStreamedSound;
+
+ if (pRetune == POLICE_RADIO) {
+ pRetune = RADIO_OFF;
+ }
+ else if (pRetune > POLICE_RADIO) {
+ pRetune = pRetune - 11;
+ }
+ }
+ else {
+ gStreamedSound = MusicManager.m_nCurrentStreamedSound;
+ pRetune = gNumRetunePresses + gStreamedSound;
+
+ if (pRetune >= USERTRACK) {
+ gRetuneCounter = gNumRetunePresses;
+ pRetune = MusicManager.m_nCurrentStreamedSound;
- CFont::SetJustifyOff();
- CFont::SetBackgroundOff();
- CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f));
- CFont::SetPropOn();
- CFont::SetFontStyle(FONT_HEADING);
- CFont::SetCentreOn();
- CFont::SetCentreSize(HUD_STRETCH_X(640.0f));;
-
- 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()) {
- if (RadioStation > USERTRACK) {
- RadioStation = RADIO_OFF;
- return;
- }
- }
- else {
- if (RadioStation > CHATTERBOX) {
- RadioStation = RADIO_OFF;
- return;
- }
- }
+ if (gStreamedSound == STREAMED_SOUND_WATER_AMBIENT)
+ pRetune = RADIO_OFF;
+
+ while (gRetuneCounter) {
+ if (pRetune == RADIO_OFF) {
+ pRetune = HEAD_RADIO;
+ }
+ else if (pRetune < USERTRACK) {
+ pRetune = pRetune + 1;
}
- else
- RadioStation = RADIO_OFF;
+ if (pRetune == USERTRACK)
+ pRetune = RADIO_OFF;
+
+ --gRetuneCounter;
}
}
+ }
- if (RadioName) {
- CFont::SetColor(CRGBA(0, 0, 0, 255));
+ wchar *string = nullptr;
- CFont::PrintString(SCREEN_WIDTH / 2, HUD_STRETCH_Y(23.0f), RadioName);
+ 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 (gNumRetunePresses)
- CFont::SetColor(CRGBA(102, 133, 143, 255));
- else
- CFont::SetColor(CRGBA(147, 196, 211, 255));
+ if (pRetune > CHATTERBOX && !CSampleManager::IsMP3RadioChannelAvailable()) {
+ return;
+ }
- CFont::PrintString(SCREEN_WIDTH / 2, HUD_STRETCH_Y(22.0f), RadioName);
- CFont::DrawFonts();
- }
+ 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;
+ --cDisplay;
}
+
+ 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));
+ CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_SCALE_Y(23.0f), pCurrentStation);
+
+ if (gNumRetunePresses)
+ 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();
}
}
diff --git a/src/audio/SampleManager.h b/src/audio/SampleManager.h
index b8bd2011..ae036947 100644
--- a/src/audio/SampleManager.h
+++ b/src/audio/SampleManager.h
@@ -5,7 +5,7 @@ public:
static uint32 &nNumOfMp3Files;
public:
- bool IsMP3RadioChannelAvailable();
+ static bool IsMP3RadioChannelAvailable();
};
extern CSampleManager &cSampleManager; \ No newline at end of file