summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/audio/MusicManager.cpp132
-rw-r--r--src/audio/MusicManager.h264
-rw-r--r--src/audio/SampleManager.cpp9
-rw-r--r--src/audio/SampleManager.h11
-rw-r--r--src/common.h5
-rw-r--r--src/main.cpp14
-rw-r--r--src/modelinfo/ModelIndices.h122
-rw-r--r--src/render/Draw.cpp16
-rw-r--r--src/render/Draw.h7
-rw-r--r--src/render/Hud.cpp1
-rw-r--r--src/render/Hud.h1
11 files changed, 561 insertions, 21 deletions
diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp
index 0e6870de..d3f14b0a 100644
--- a/src/audio/MusicManager.cpp
+++ b/src/audio/MusicManager.cpp
@@ -1,7 +1,137 @@
#include "common.h"
#include "patcher.h"
#include "MusicManager.h"
+#include "Font.h"
+#include "Hud.h"
+#include "Text.h"
+#include "Timer.h"
+#include "Camera.h"
+#include "World.h"
+#include "ModelIndices.h"
+#include "SampleManager.h"
cMusicManager &MusicManager = *(cMusicManager*)0x8F3964;
+int &gNumRetunePresses = *(int*)0x650B80;
+int &gRetuneCounter = *(int*)0x650B84;
-WRAPPER void cMusicManager::DisplayRadioStationName(void) { EAXJMP(0x57E6D0); }
+//WRAPPER void cMusicManager::DisplayRadioStationName(void) { EAXJMP(0x57E6D0); }
+
+bool cMusicManager::PlayerInCar() {
+ 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;
+
+ int16 Model = FindPlayerVehicle()->m_modelIndex;
+ 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;
+ }
+ }
+}
+
+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;
+ }
+
+ CFont::SetJustifyOff();
+ CFont::SetBackgroundOff();
+ CFont::SetScale(SCREEN_STRETCH_X(0.8f), SCREEN_STRETCH_Y(1.35f));
+ CFont::SetPropOn();
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetCentreOn();
+ CFont::SetCentreSize(SCREEN_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;
+ }
+ else {
+ if (RadioStation > CHATTERBOX)
+ RadioStation = RADIO_OFF;
+ }
+ }
+ else {
+ RadioStation = RADIO_OFF;
+ }
+ }
+ }
+
+ if (RadioName) {
+ CFont::SetColor(CRGBA(0, 0, 0, 255));
+
+ CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_STRETCH_Y(23.0f), RadioName);
+
+ if (gNumRetunePresses)
+ CFont::SetColor(CRGBA(102, 133, 143, 255));
+ else
+ CFont::SetColor(CRGBA(147, 196, 211, 255));
+
+ CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_STRETCH_Y(22.0f), RadioName);
+ CFont::DrawFonts();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/audio/MusicManager.h b/src/audio/MusicManager.h
index 42cc879d..7932ca31 100644
--- a/src/audio/MusicManager.h
+++ b/src/audio/MusicManager.h
@@ -1,8 +1,270 @@
#pragma once
+enum eRadioStation {
+ HEAD_RADIO,
+ DOUBLE_CLEF,
+ JAH_RADIO,
+ RISE_FM,
+ LIPS_106,
+ GAME_FM,
+ MSX_FM,
+ FLASHBACK,
+ CHATTERBOX,
+ USERTRACK,
+ POLICE_RADIO,
+ RADIO_OFF,
+};
+
+enum eStreamedSounds {
+ STREAMED_SOUND_RADIO_HEAD = 0,
+ STREAMED_SOUND_RADIO_CLASSIC = 1,
+ STREAMED_SOUND_RADIO_KJAH = 2,
+ STREAMED_SOUND_RADIO_RISE = 3,
+ STREAMED_SOUND_RADIO_LIPS = 4,
+ STREAMED_SOUND_RADIO_GAME = 5,
+ STREAMED_SOUND_RADIO_MSX = 6,
+ STREAMED_SOUND_RADIO_FLASH = 7,
+ STREAMED_SOUND_RADIO_CHAT = 8,
+ STREAMED_SOUND_RADIO_MP3_PLAYER = 9,
+ STREAMED_SOUND_RADIO_POLICE = 10,
+ STREAMED_SOUND_CITY_AMBIENT = 11,
+ STREAMED_SOUND_WATER_AMBIENT = 12,
+ STREAMED_SOUND_ANNOUNCE_COMMERCIAL_OPEN = 13,
+ STREAMED_SOUND_ANNOUNCE_SUBURBAN_OPEN = 14,
+ STREAMED_SOUND_NEWS_INTRO = 15,
+ STREAMED_SOUND_BANK_INTRO = 16,
+ STREAMED_SOUND_CUTSCENE_LUIGI1_LG = 17,
+ STREAMED_SOUND_CUTSCENE_LUIGI2_DSB = 18,
+ STREAMED_SOUND_CUTSCENE_LUIGI3_DM = 19,
+ STREAMED_SOUND_CUTSCENE_LUIGI4_PAP = 20,
+ STREAMED_SOUND_CUTSCENE_LUIGI5_TFB = 21,
+ STREAMED_SOUND_CUTSCENE_JOEY0_DM2 = 22,
+ STREAMED_SOUND_CUTSCENE_JOEY1_LFL = 23,
+ STREAMED_SOUND_CUTSCENE_JOEY2_KCL = 24,
+ STREAMED_SOUND_CUTSCENE_JOEY3_VH = 25,
+ STREAMED_SOUND_CUTSCENE_JOEY4_ETH = 26,
+ STREAMED_SOUND_CUTSCENE_JOEY5_DST = 27,
+ STREAMED_SOUND_CUTSCENE_JOEY6_TBJ = 28,
+ STREAMED_SOUND_CUTSCENE_TONI1_TOL = 29,
+ STREAMED_SOUND_CUTSCENE_TONI2_TPU = 30,
+ STREAMED_SOUND_CUTSCENE_TONI3_MAS = 31,
+ STREAMED_SOUND_CUTSCENE_TONI4_TAT = 32,
+ STREAMED_SOUND_CUTSCENE_TONI5_BF = 33,
+ STREAMED_SOUND_CUTSCENE_SAL0_MAS = 34,
+ STREAMED_SOUND_CUTSCENE_SAL1_PF = 35,
+ STREAMED_SOUND_CUTSCENE_SAL2_CTG = 36,
+ STREAMED_SOUND_CUTSCENE_SAL3_RTC = 37,
+ STREAMED_SOUND_CUTSCENE_SAL5_LRQ = 38,
+ STREAMED_SOUND_CUTSCENE_SAL4_BDBA = 39,
+ STREAMED_SOUND_CUTSCENE_SAL4_BDBB = 40,
+ STREAMED_SOUND_CUTSCENE_SAL2_CTG2 = 41,
+ STREAMED_SOUND_CUTSCENE_SAL4_BDBD = 42,
+ STREAMED_SOUND_CUTSCENE_SAL5_LRQB = 43,
+ STREAMED_SOUND_CUTSCENE_SAL5_LRQC = 44,
+ STREAMED_SOUND_CUTSCENE_ASUKA_1_SSO = 45,
+ STREAMED_SOUND_CUTSCENE_ASUKA_2_PP = 46,
+ STREAMED_SOUND_CUTSCENE_ASUKA_3_SS = 47,
+ STREAMED_SOUND_CUTSCENE_ASUKA_4_PDR = 48,
+ STREAMED_SOUND_CUTSCENE_ASUKA_5_K2FT = 49,
+ STREAMED_SOUND_CUTSCENE_KENJI1_KBO = 50,
+ STREAMED_SOUND_CUTSCENE_KENJI2_GIS = 51,
+ STREAMED_SOUND_CUTSCENE_KENJI3_DS = 52,
+ STREAMED_SOUND_CUTSCENE_KENJI4_SHI = 53,
+ STREAMED_SOUND_CUTSCENE_KENJI5_SD = 54,
+ STREAMED_SOUND_CUTSCENE_RAY0_PDR2 = 55,
+ STREAMED_SOUND_CUTSCENE_RAY1_SW = 56,
+ STREAMED_SOUND_CUTSCENE_RAY2_AP = 57,
+ STREAMED_SOUND_CUTSCENE_RAY3_ED = 58,
+ STREAMED_SOUND_CUTSCENE_RAY4_GF = 59,
+ STREAMED_SOUND_CUTSCENE_RAY5_PB = 60,
+ STREAMED_SOUND_CUTSCENE_RAY6_MM = 61,
+ STREAMED_SOUND_CUTSCENE_DONALD1_STOG = 62,
+ STREAMED_SOUND_CUTSCENE_DONALD2_KK = 63,
+ STREAMED_SOUND_CUTSCENE_DONALD3_ADO = 64,
+ STREAMED_SOUND_CUTSCENE_DONALD5_ES = 65,
+ STREAMED_SOUND_CUTSCENE_DONALD7_MLD = 66,
+ STREAMED_SOUND_CUTSCENE_DONALD4_GTA = 67,
+ STREAMED_SOUND_CUTSCENE_DONALD4_GTA2 = 68,
+ STREAMED_SOUND_CUTSCENE_DONALD6_STS = 69,
+ STREAMED_SOUND_CUTSCENE_ASUKA6_BAIT = 70,
+ STREAMED_SOUND_CUTSCENE_ASUKA7_ETG = 71,
+ STREAMED_SOUND_CUTSCENE_ASUKA8_PS = 72,
+ STREAMED_SOUND_CUTSCENE_ASUKA9_ASD = 73,
+ STREAMED_SOUND_CUTSCENE_KENJI4_SHI2 = 74,
+ STREAMED_SOUND_CUTSCENE_CATALINA1_TEX = 75,
+ STREAMED_SOUND_CUTSCENE_ELBURRO1_PH1 = 76,
+ STREAMED_SOUND_CUTSCENE_ELBURRO2_PH2 = 77,
+ STREAMED_SOUND_CUTSCENE_ELBURRO3_PH3 = 78,
+ STREAMED_SOUND_CUTSCENE_ELBURRO4_PH4 = 79,
+ STREAMED_SOUND_CUTSCENE_YARDIE_PH1 = 80,
+ STREAMED_SOUND_CUTSCENE_YARDIE_PH2 = 81,
+ STREAMED_SOUND_CUTSCENE_YARDIE_PH3 = 82,
+ STREAMED_SOUND_CUTSCENE_YARDIE_PH4 = 83,
+ STREAMED_SOUND_CUTSCENE_HOODS_PH1 = 84,
+ STREAMED_SOUND_CUTSCENE_HOODS_PH2 = 85,
+ STREAMED_SOUND_CUTSCENE_HOODS_PH3 = 86,
+ STREAMED_SOUND_CUTSCENE_HOODS_PH4 = 87,
+ STREAMED_SOUND_CUTSCENE_HOODS_PH5 = 88,
+ STREAMED_SOUND_CUTSCENE_MARTY_PH1 = 89,
+ STREAMED_SOUND_CUTSCENE_MARTY_PH2 = 90,
+ STREAMED_SOUND_CUTSCENE_MARTY_PH3 = 91,
+ STREAMED_SOUND_CUTSCENE_MARTY_PH4 = 92,
+ STREAMED_SOUND_MISSION_COMPLETED = 93,
+ STREAMED_SOUND_GAME_COMPLETED = 94,
+ STREAMED_SOUND_MISSION_LIB_A1 = 95,
+ STREAMED_SOUND_MISSION_LIB_A2 = 96,
+ STREAMED_SOUND_MISSION_LIB_A = 97,
+ STREAMED_SOUND_MISSION_LIB_B = 98,
+ STREAMED_SOUND_MISSION_LIB_C = 99,
+ STREAMED_SOUND_MISSION_LIB_D = 100,
+ STREAMED_SOUND_MISSION_L2_A = 101,
+ STREAMED_SOUND_MISSION_J4T_1 = 102,
+ STREAMED_SOUND_MISSION_J4T_2 = 103,
+ STREAMED_SOUND_MISSION_J4T_3 = 104,
+ STREAMED_SOUND_MISSION_J4T_4 = 105,
+ STREAMED_SOUND_MISSION_J4_A = 106,
+ STREAMED_SOUND_MISSION_J4_B = 107,
+ STREAMED_SOUND_MISSION_J4_C = 108,
+ STREAMED_SOUND_MISSION_J4_D = 109,
+ STREAMED_SOUND_MISSION_J4_E = 110,
+ STREAMED_SOUND_MISSION_J4_F = 111,
+ STREAMED_SOUND_MISSION_J6_1 = 112,
+ STREAMED_SOUND_MISSION_J6_A = 113,
+ STREAMED_SOUND_MISSION_J6_B = 114,
+ STREAMED_SOUND_MISSION_J6_C = 115,
+ STREAMED_SOUND_MISSION_J6_D = 116,
+ STREAMED_SOUND_MISSION_T4_A = 117,
+ STREAMED_SOUND_MISSION_S1_A = 118,
+ STREAMED_SOUND_MISSION_S1_A1 = 119,
+ STREAMED_SOUND_MISSION_S1_B = 120,
+ STREAMED_SOUND_MISSION_S1_C = 121,
+ STREAMED_SOUND_MISSION_S1_C1 = 122,
+ STREAMED_SOUND_MISSION_S1_D = 123,
+ STREAMED_SOUND_MISSION_S1_E = 124,
+ STREAMED_SOUND_MISSION_S1_F = 125,
+ STREAMED_SOUND_MISSION_S1_G = 126,
+ STREAMED_SOUND_MISSION_S1_H = 127,
+ STREAMED_SOUND_MISSION_S1_I = 128,
+ STREAMED_SOUND_MISSION_S1_J = 129,
+ STREAMED_SOUND_MISSION_S1_K = 130,
+ STREAMED_SOUND_MISSION_S1_L = 131,
+ STREAMED_SOUND_MISSION_S3_A = 132,
+ STREAMED_SOUND_MISSION_S3_B = 133,
+ STREAMED_SOUND_MISSION_EL3_A = 134,
+ STREAMED_SOUND_MISSION_MF1_A = 135,
+ STREAMED_SOUND_MISSION_MF2_A = 136,
+ STREAMED_SOUND_MISSION_MF3_A = 137,
+ STREAMED_SOUND_MISSION_MF3_B = 138,
+ STREAMED_SOUND_MISSION_MF3_B1 = 139,
+ STREAMED_SOUND_MISSION_MF3_C = 140,
+ STREAMED_SOUND_MISSION_MF4_A = 141,
+ STREAMED_SOUND_MISSION_MF4_B = 142,
+ STREAMED_SOUND_MISSION_MF4_C = 143,
+ STREAMED_SOUND_MISSION_A1_A = 144,
+ STREAMED_SOUND_MISSION_A3_A = 145,
+ STREAMED_SOUND_MISSION_A5_A = 146,
+ STREAMED_SOUND_MISSION_A4_A = 147,
+ STREAMED_SOUND_MISSION_A4_B = 148,
+ STREAMED_SOUND_MISSION_A4_C = 149,
+ STREAMED_SOUND_MISSION_A4_D = 150,
+ STREAMED_SOUND_MISSION_K1_A = 151,
+ STREAMED_SOUND_MISSION_K3_A = 152,
+ STREAMED_SOUND_MISSION_R1_A = 153,
+ STREAMED_SOUND_MISSION_R2_A = 154,
+ STREAMED_SOUND_MISSION_R2_B = 155,
+ STREAMED_SOUND_MISSION_R2_C = 156,
+ STREAMED_SOUND_MISSION_R2_D = 157,
+ STREAMED_SOUND_MISSION_R2_E = 158,
+ STREAMED_SOUND_MISSION_R2_F = 159,
+ STREAMED_SOUND_MISSION_R2_G = 160,
+ STREAMED_SOUND_MISSION_R2_H = 161,
+ STREAMED_SOUND_MISSION_R5_A = 162,
+ STREAMED_SOUND_MISSION_R6_A = 163,
+ STREAMED_SOUND_MISSION_R6_A1 = 164,
+ STREAMED_SOUND_MISSION_R6_B = 165,
+ STREAMED_SOUND_MISSION_LO2_A = 166,
+ STREAMED_SOUND_MISSION_LO6_A = 167,
+ STREAMED_SOUND_MISSION_YD2_A = 168,
+ STREAMED_SOUND_MISSION_YD2_B = 169,
+ STREAMED_SOUND_MISSION_YD2_C = 170,
+ STREAMED_SOUND_MISSION_YD2_C1 = 171,
+ STREAMED_SOUND_MISSION_YD2_D = 172,
+ STREAMED_SOUND_MISSION_YD2_E = 173,
+ STREAMED_SOUND_MISSION_YD2_F = 174,
+ STREAMED_SOUND_MISSION_YD2_G = 175,
+ STREAMED_SOUND_MISSION_YD2_H = 176,
+ STREAMED_SOUND_MISSION_YD2_ASS = 177,
+ STREAMED_SOUND_MISSION_YD2_OK = 178,
+ STREAMED_SOUND_MISSION_H5_A = 179,
+ STREAMED_SOUND_MISSION_H5_B = 180,
+ STREAMED_SOUND_MISSION_H5_C = 181,
+ STREAMED_SOUND_MISSION_AMMU_A = 182,
+ STREAMED_SOUND_MISSION_AMMU_B = 183,
+ STREAMED_SOUND_MISSION_AMMU_C = 184,
+ STREAMED_SOUND_MISSION_DOOR_1 = 185,
+ STREAMED_SOUND_MISSION_DOOR_2 = 186,
+ STREAMED_SOUND_MISSION_DOOR_3 = 187,
+ STREAMED_SOUND_MISSION_DOOR_4 = 188,
+ STREAMED_SOUND_MISSION_DOOR_5 = 189,
+ STREAMED_SOUND_MISSION_DOOR_6 = 190,
+ STREAMED_SOUND_MISSION_T3_A = 191,
+ STREAMED_SOUND_MISSION_T3_B = 192,
+ STREAMED_SOUND_MISSION_T3_C = 193,
+ STREAMED_SOUND_MISSION_K1_B = 194,
+ STREAMED_SOUND_MISSION_CAT1 = 195,
+ TOTAL_STREAMED_SOUNDS = 196,
+ NO_STREAMED_SOUND = 197,
+};
+
+class tMP3Sample {
+public:
+ uint32 m_nLength;
+ uint32 m_nPosition;
+ uint32 m_nLastPosCheckTimer;
+};
+
class cMusicManager
{
public:
- void DisplayRadioStationName(void);
+ Bool m_bIsInitialised;
+ uint8 field_1;
+ uint8 m_nMusicMode;
+ uint8 m_nCurrentStreamedSound;
+ uint8 m_nPreviousStreamedSound;
+ uint8 field_5;
+ uint8 field_6;
+ uint8 field_7;
+ Bool m_bAnnouncement;
+ Bool m_bPreviousPlayerInCar;
+ Bool m_bPlayerInCar;
+ Bool m_bAnnouncementInProgress;
+ tMP3Sample m_asMP3Samples[196];
+ uint8 field_2364;
+ uint8 field_2365;
+ uint8 field_2366;
+ uint8 field_2367;
+ uint32 field_2368;
+ uint32 field_2372;
+ uint32 field_2376;
+ uint8 field_2380;
+ uint8 field_2381;
+ uint8 field_2382;
+ Bool m_bRadioSetByScript;
+ uint8 m_nRadioStation;
+ uint8 field_2385;
+ uint8 field_2386;
+ uint8 field_2387;
+ uint32 m_nRadioPosition;
+ Bool m_bRadioInCar;
+ uint8 field_2393;
+ uint8 field_2394;
+ uint8 field_2395;
+
+public:
+ bool PlayerInCar();
+ void DisplayRadioStationName();
};
+
+static_assert(sizeof(cMusicManager) == 0x95C, "cMusicManager: error");
+
extern cMusicManager &MusicManager;
diff --git a/src/audio/SampleManager.cpp b/src/audio/SampleManager.cpp
new file mode 100644
index 00000000..2319baec
--- /dev/null
+++ b/src/audio/SampleManager.cpp
@@ -0,0 +1,9 @@
+#include "common.h"
+#include "SampleManager.h"
+
+CSampleManager &cSampleManager = *(CSampleManager *)0x7341E0;
+uint32 &CSampleManager::nNumOfMp3Files = *(uint32*)0x95CC00;
+
+bool CSampleManager::IsMP3RadioChannelAvailable() {
+ return nNumOfMp3Files != 0;
+}
diff --git a/src/audio/SampleManager.h b/src/audio/SampleManager.h
new file mode 100644
index 00000000..b8bd2011
--- /dev/null
+++ b/src/audio/SampleManager.h
@@ -0,0 +1,11 @@
+#pragma once
+
+class CSampleManager {
+public:
+ static uint32 &nNumOfMp3Files;
+
+public:
+ bool IsMP3RadioChannelAvailable();
+};
+
+extern CSampleManager &cSampleManager; \ No newline at end of file
diff --git a/src/common.h b/src/common.h
index 966af022..d31ad18c 100644
--- a/src/common.h
+++ b/src/common.h
@@ -59,6 +59,9 @@ extern void **rwengine;
#define RwEngineInstance (*rwengine)
#include "skel\skeleton.h"
+#include "Draw.h"
+
+#define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio())
#define SCREENW (RsGlobal.maximumWidth)
#define SCREENH (RsGlobal.maximumHeight)
@@ -67,7 +70,7 @@ extern void **rwengine;
#define DEFAULT_SCREEN_HEIGHT (448)
#define SCREEN_WIDTH Float(RsGlobal.width)
#define SCREEN_HEIGHT Float(RsGlobal.height)
-#define SCREEN_STRETCH_X(a) Float((a) * (SCREEN_WIDTH / Float(DEFAULT_SCREEN_WIDTH))) * Float(1.33334f / (CMenuManager::m_PrefsUseWideScreen ? 16.0f / 9.0f : 4.0f / 3.0f))
+#define SCREEN_STRETCH_X(a) Float((a) * (SCREEN_WIDTH / Float(DEFAULT_SCREEN_WIDTH))) * Float((1.3333334f) / (SCREEN_ASPECT_RATIO))
#define SCREEN_STRETCH_Y(a) Float((a) * (SCREEN_HEIGHT / Float(DEFAULT_SCREEN_HEIGHT)))
#define SCREEN_FROM_RIGHT(a) Float(SCREEN_WIDTH - SCREEN_STRETCH_X(a))
#define SCREEN_FROM_BOTTOM(a) Float(SCREEN_HEIGHT - SCREEN_STRETCH_Y(a))
diff --git a/src/main.cpp b/src/main.cpp
index 9b8fc145..38666979 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -86,6 +86,7 @@ RwRGBA gColourTop;
void
Idle(void *arg)
{
+ CDraw::CalculateAspectRatio();
CTimer::Update();
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
@@ -141,7 +142,7 @@ Idle(void *arg)
}else{
float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f));
// ASPECT
- CameraSize(Scene.camera, nil, viewWindow, 4.0f/3.0f);
+ CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
if(!RsCameraBeginUpdate(Scene.camera))
@@ -161,6 +162,7 @@ Idle(void *arg)
void
FrontendIdle(void)
{
+ CDraw::CalculateAspectRatio();
CTimer::Update();
CSprite2d::SetRecipNearClip();
CSprite2d::InitPerFrame();
@@ -173,7 +175,7 @@ FrontendIdle(void)
float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f));
// ASPECT
- CameraSize(Scene.camera, nil, viewWindow, 4.0f/3.0f);
+ CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
if(!RsCameraBeginUpdate(Scene.camera))
@@ -190,13 +192,13 @@ FrontendIdle(void)
bool
DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha)
{
+ CDraw::CalculateAspectRatio();
CRGBA TopColor(TopRed, TopGreen, TopBlue, Alpha);
CRGBA BottomColor(BottomRed, BottomGreen, BottomBlue, Alpha);
float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f));
// ASPECT
- float aspectRatio = CMenuManager::m_PrefsUseWideScreen ? 16.0f/9.0f : 4.0f/3.0f;
- CameraSize(Scene.camera, nil, viewWindow, aspectRatio);
+ CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
@@ -214,10 +216,10 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
bool
DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha)
{
+ CDraw::CalculateAspectRatio();
float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f));
// ASPECT
- float aspectRatio = CMenuManager::m_PrefsUseWideScreen ? 16.0f/9.0f : 4.0f/3.0f;
- CameraSize(Scene.camera, nil, viewWindow, aspectRatio);
+ CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h
index bbf1a58b..7567c0db 100644
--- a/src/modelinfo/ModelIndices.h
+++ b/src/modelinfo/ModelIndices.h
@@ -202,16 +202,118 @@ enum
MI_FEMALE03,
MI_FATFEMALE01,
MI_FATFEMALE02,
-
- MI_FIRETRUCK = 97,
- MI_PREDATOR = 120,
- MI_RHINO = 122,
- MI_TRAIN = 124,
- MI_COACH = 127,
- MI_RCBANDIT = 131,
- MI_SPEEDER = 142,
- MI_REEFER = 143,
- MI_GHOST = 150,
+ MI_PROSTITUTE,
+ MI_PROSTITUTE2,
+ MI_P_MAN1,
+ MI_P_MAN2,
+ MI_P_WOM1,
+ MI_P_WOM2,
+ MI_CT_MAN1,
+ MI_CT_MAN2,
+ MI_CT_WOM1,
+ MI_CT_WOM2,
+ MI_LI_MAN1,
+ MI_LI_MAN2,
+ MI_LI_WOM1,
+ MI_LI_WOM2,
+ MI_DOCKER1,
+ MI_DOCKER2,
+ MI_SCUM_MAN,
+ MI_SCUM_WOM,
+ MI_WORKER1,
+ MI_WORKER2,
+ MI_B_MAN1,
+ MI_B_MAN2,
+ MI_B_MAN3,
+ MI_B_WOM1,
+ MI_B_WOM2,
+ MI_B_WOM3,
+ MI_MOD_MAN,
+ MI_MOD_WOM,
+ MI_ST_MAN,
+ MI_ST_WOM,
+ MI_FAN_MAN1,
+ MI_FAN_MAN2,
+ MI_FAN_WOM,
+ MI_HOS_MAN,
+ MI_HOS_WOM,
+ MI_CONST1,
+ MI_CONST2,
+ MI_SHOPPER1,
+ MI_SHOPPER2,
+ MI_SHOPPER3,
+ MI_STUD_MAN,
+ MI_STUD_WOM,
+ MI_CAS_MAN,
+ MI_CAS_WOM,
+ MI_BUSKER1,
+ MI_BUSKER2,
+ MI_BUSKER3,
+ MI_BUSKER4,
+ MI_PED87,
+ MI_PED88,
+ MI_PED89,
+ MI_LANDSTAL,
+ MI_IDAHO,
+ MI_STINGER,
+ MI_LINERUN,
+ MI_PEREN,
+ MI_SENTINEL,
+ MI_PATRIOT,
+ MI_FIRETRUCK,
+ MI_TRASH,
+ MI_STRETCH,
+ MI_MANANA,
+ MI_INFERNUS,
+ MI_BLISTA,
+ MI_PONY,
+ MI_MULE,
+ MI_CHEETAH,
+ MI_AMBULAN,
+ MI_FBICAR,
+ MI_MOONBEAM,
+ MI_ESPERANT,
+ MI_TAXI,
+ MI_KURUMA,
+ MI_BOBCAT,
+ MI_MRWHOOP,
+ MI_BFINJECT,
+ MI_CORPSE,
+ MI_POLICE,
+ MI_ENFORCER,
+ MI_SECURICA,
+ MI_BANSHEE,
+ MI_PREDATOR,
+ MI_BUS,
+ MI_RHINO,
+ MI_BARRACKS,
+ MI_TRAIN,
+ MI_CHOPPER,
+ MI_DODO,
+ MI_COACH,
+ MI_CABBIE,
+ MI_STALLION,
+ MI_RUMPO,
+ MI_RCBANDIT,
+ MI_BELLYUP,
+ MI_MRWONGS,
+ MI_MAFIA,
+ MI_YARDIE,
+ MI_YAKUZA,
+ MI_DIABLOS,
+ MI_COLUMB ,
+ MI_HOODS,
+ MI_AIRTRAIN,
+ MI_DEADDODO,
+ MI_SPEEDER,
+ MI_REEFER,
+ MI_PANLANT,
+ MI_FLATBED,
+ MI_YANKEE,
+ MI_ESCAPE,
+ MI_BORGNINE,
+ MI_TOYZ,
+ MI_GHOST,
MI_CAR_DOOR = 190,
MI_CAR_BUMPER,
diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp
index fd9a2d7e..e1f79697 100644
--- a/src/render/Draw.cpp
+++ b/src/render/Draw.cpp
@@ -1,6 +1,10 @@
#include "common.h"
#include "patcher.h"
#include "Draw.h"
+#include "Frontend.h"
+#include "Camera.h"
+
+float CDraw::ms_fAspectRatio;
float &CDraw::ms_fNearClipZ = *(float*)0x8E2DC4;
float &CDraw::ms_fFarClipZ = *(float*)0x9434F0;
@@ -11,6 +15,18 @@ uint8 &CDraw::FadeRed = *(uint8*)0x95CD90;
uint8 &CDraw::FadeGreen = *(uint8*)0x95CD71;
uint8 &CDraw::FadeBlue = *(uint8*)0x95CD53;
+void CDraw::CalculateAspectRatio() {
+ if (FrontEndMenuManager.m_PrefsUseWideScreen) {
+ ms_fAspectRatio = 1.7777778f;
+ }
+ else if (TheCamera.m_WideScreenOn) {
+ ms_fAspectRatio = 1.25f;
+ }
+ else {
+ ms_fAspectRatio = 1.3333334f;
+ }
+}
+
static float hFov2vFov(float hfov)
{
float w = SCREENW;
diff --git a/src/render/Draw.h b/src/render/Draw.h
index 408c41b0..6dd42121 100644
--- a/src/render/Draw.h
+++ b/src/render/Draw.h
@@ -6,6 +6,8 @@ private:
static float &ms_fNearClipZ;
static float &ms_fFarClipZ;
static float &ms_fFOV;
+ static float ms_fAspectRatio;
+
public:
static uint8 &FadeValue;
static uint8 &FadeRed;
@@ -16,6 +18,11 @@ public:
static float GetNearClipZ(void) { return ms_fNearClipZ; }
static void SetFarClipZ(float farclip) { ms_fFarClipZ = farclip; }
static float GetFarClipZ(void) { return ms_fFarClipZ; }
+
static void SetFOV(float fov);
static float GetFOV(void) { return ms_fFOV; }
+
+ static void CalculateAspectRatio();
+ static float GetAspectRatio(void) { return ms_fAspectRatio; }
+
};
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 8ff20e5a..1d454d2a 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -53,7 +53,6 @@ wchar* CHud::m_pLastVehicleName = *(wchar **)0x8E2DD8;
wchar* CHud::m_pVehicleNameToPrint;
wchar* CHud::m_Message = (wchar*)0x72E318;
wchar* CHud::m_PagerMessage = (wchar*)0x878840;
-Bool &CHud::m_bRetuneInProgress = *(Bool*)0x650B80;
Bool &CHud::m_Wants_To_Draw_Hud = *(Bool*)0x95CD89;
Bool &CHud::m_Wants_To_Draw_3dMarkers = *(Bool*)0x95CD62;
wchar(*CHud::m_BigMessage)[128] = (wchar(*)[128])0x664CE0;
diff --git a/src/render/Hud.h b/src/render/Hud.h
index 65f75241..04795981 100644
--- a/src/render/Hud.h
+++ b/src/render/Hud.h
@@ -49,7 +49,6 @@ public:
static int32 m_VehicleNameTimer;
static wchar* m_Message;
static wchar* m_PagerMessage;
- static Bool &m_bRetuneInProgress;
static Bool &m_Wants_To_Draw_Hud;
static Bool &m_Wants_To_Draw_3dMarkers;
static wchar(*m_BigMessage)[128];