diff options
author | _AG <gennariarmando@outlook.com> | 2019-06-20 02:31:03 +0200 |
---|---|---|
committer | _AG <gennariarmando@outlook.com> | 2019-06-20 02:32:36 +0200 |
commit | 2ce7bcc405daf1b01f9220e7b584bc7c318ec5cd (patch) | |
tree | 4cbfefeedd462f46b29d4b1c9004f17eefebc364 /src | |
parent | finally finished CVehicleModelInfo (diff) | |
download | re3-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 'src')
-rw-r--r-- | src/Radar.cpp | 314 | ||||
-rw-r--r-- | src/Radar.h | 85 | ||||
-rw-r--r-- | src/World.cpp | 2 | ||||
-rw-r--r-- | src/World.h | 3 | ||||
-rw-r--r-- | src/audio/MusicManager.cpp | 203 | ||||
-rw-r--r-- | src/audio/SampleManager.h | 2 | ||||
-rw-r--r-- | src/common.h | 28 | ||||
-rw-r--r-- | src/control/Garages.cpp | 16 | ||||
-rw-r--r-- | src/control/Script.cpp | 4 | ||||
-rw-r--r-- | src/control/Script.h | 5 | ||||
-rw-r--r-- | src/main.cpp | 24 | ||||
-rw-r--r-- | src/render/Draw.cpp | 3 | ||||
-rw-r--r-- | src/render/Draw.h | 7 | ||||
-rw-r--r-- | src/render/Hud.cpp | 313 | ||||
-rw-r--r-- | src/render/Hud.h | 13 | ||||
-rw-r--r-- | src/templates.h | 2 |
16 files changed, 766 insertions, 258 deletions
diff --git a/src/Radar.cpp b/src/Radar.cpp index 93097e8f..58c9973b 100644 --- a/src/Radar.cpp +++ b/src/Radar.cpp @@ -5,15 +5,73 @@ #include "Hud.h" #include "World.h" #include "Frontend.h" +#include "General.h" +#include "Vehicle.h" +#include "Pools.h" +#include "Script.h" +#include "Font.h" WRAPPER void CRadar::ClearBlipForEntity(eBlipType type, int32 id) { EAXJMP(0x4A56C0); } WRAPPER void CRadar::Draw3dMarkers() { EAXJMP(0x4A4C70); } //WRAPPER void CRadar::DrawMap () { EAXJMP(0x4A4200); } -WRAPPER void CRadar::DrawBlips() { EAXJMP(0x4A42F0); } WRAPPER void CRadar::DrawRadarMap() { EAXJMP(0x4A6C20); } +//WRAPPER void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int alpha) { EAXJMP(0x4A5D10); } +WRAPPER void CRadar::TransformRealWorldPointToRadarSpace(CVector2D *out, CVector2D *in) { EAXJMP(0x4A50D0); } +WRAPPER float CRadar::LimitRadarPoint(CVector2D *point) { EAXJMP(0x4A4F30); } +//WRAPPER void CRadar::DrawRadarSprite(int sprite, float x, float y, int alpha) { EAXJMP(0x4A5EF0); } +WRAPPER void CRadar::ShowRadarMarker(CVector pos, uint32 color, float radius) { EAXJMP(0x4A59C0); } +WRAPPER void CRadar::ShowRadarTrace(float x, float y, uint32 size, uint32 red, uint32 green, uint32 blue, uint32 alpha) { EAXJMP(0x4A5870); } +WRAPPER int CRadar::GetRadarTraceColour2(uint32 color, bool bright) { EAXJMP(0x4A5BB0); } +//WRAPPER void CRadar::DrawBlips() { EAXJMP(0x4A42F0); } float &CRadar::m_RadarRange = *(float*)0x8E281C; CVector2D &CRadar::vec2DRadarOrigin = *(CVector2D*)0x6299B8; +CBlip *CRadar::ms_RadarTrace = (CBlip*)0x6ED5E0; + +CSprite2d *CRadar::AsukaSprite = (CSprite2d*)0x8F1A40; +CSprite2d *CRadar::BombSprite = (CSprite2d*)0x8F5FB4; +CSprite2d *CRadar::CatSprite = (CSprite2d*)0x885B24; +CSprite2d *CRadar::CentreSprite = (CSprite2d*)0x8F6268; +CSprite2d *CRadar::CopcarSprite = (CSprite2d*)0x8F1A2C; +CSprite2d *CRadar::DonSprite = (CSprite2d*)0x8F2BE0; +CSprite2d *CRadar::EightSprite = (CSprite2d*)0x8F2BCC; +CSprite2d *CRadar::ElSprite = (CSprite2d*)0x8F1B80; +CSprite2d *CRadar::IceSprite = (CSprite2d*)0x9415FC; +CSprite2d *CRadar::JoeySprite = (CSprite2d*)0x8F2C00; +CSprite2d *CRadar::KenjiSprite = (CSprite2d*)0x8F2C68; +CSprite2d *CRadar::LizSprite = (CSprite2d*)0x8F5830; +CSprite2d *CRadar::LuigiSprite = (CSprite2d*)0x8F1A3C; +CSprite2d *CRadar::NorthSprite = (CSprite2d*)0x8F6274; +CSprite2d *CRadar::RaySprite = (CSprite2d*)0x8E2A7C; +CSprite2d *CRadar::SalSprite = (CSprite2d*)0x8F29EC; +CSprite2d *CRadar::SaveSprite = (CSprite2d*)0x8F5F74; +CSprite2d *CRadar::SpraySprite = (CSprite2d*)0x94307C; +CSprite2d *CRadar::TonySprite = (CSprite2d*)0x885B58; +CSprite2d *CRadar::WeaponSprite = (CSprite2d*)0x941534; + +CSprite2d *CRadar::RadarSprites[RADAR_SPRITE_COUNT] = { + NULL, + AsukaSprite, + BombSprite, + CatSprite, + CentreSprite, + CopcarSprite, + DonSprite, + EightSprite, + ElSprite, + IceSprite, + JoeySprite, + KenjiSprite, + LizSprite, + LuigiSprite, + NorthSprite, + RaySprite, + SalSprite, + SaveSprite, + SpraySprite, + TonySprite, + WeaponSprite +}; void CRadar::DrawMap() { @@ -37,10 +95,260 @@ void CRadar::DrawMap() } } +void CRadar::DrawBlips() +{ + if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) { + RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); + RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); + RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); + RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); + RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); + RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE); + + CVector2D out; + CVector2D in = CVector2D(0.0f, 0.0f); + CRadar::TransformRadarPointToScreenSpace(&out, &in); + + float angle; + if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::CamMode::MODE_TOPDOWN1) + angle = PI + FindPlayerHeading(); + else + angle = FindPlayerHeading() - (PI + atan2(-TheCamera.m_matrix.m_matrix.up.x, TheCamera.m_matrix.m_matrix.up.y)); + + CRadar::DrawRotatingRadarSprite(CentreSprite, out.x, out.y, angle, 255); + + CVector2D vec2d; + vec2d.x = vec2DRadarOrigin.x; + vec2d.y = M_SQRT2 * CRadar::m_RadarRange + vec2DRadarOrigin.y; + CRadar::TransformRealWorldPointToRadarSpace(&in, &vec2d); + CRadar::LimitRadarPoint(&in); + CRadar::TransformRadarPointToScreenSpace(&out, &in); + CRadar::DrawRadarSprite(RADAR_SPRITE_NORTH, out.x, out.y, 255); + + /* + DrawEntityBlip + */ + for (int i = 0; i < 32; i++) { + if (ms_RadarTrace[i].m_bInUse) { + if (ms_RadarTrace[i].m_eBlipType <= BLIP_OBJECT) { + CEntity *e = nil; + switch (CRadar::ms_RadarTrace[i].m_eBlipType) { + case BLIP_CAR: + e = CPools::GetVehiclePool()->GetAt(ms_RadarTrace[i].m_nEntityHandle); + break; + case BLIP_CHAR: + e = CPools::GetPedPool()->GetAt(ms_RadarTrace[i].m_nEntityHandle); + break; + case BLIP_OBJECT: + e = CPools::GetObjectPool()->GetAt(ms_RadarTrace[i].m_nEntityHandle); + break; + }; + + if (e) { + if (CRadar::ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || CRadar::ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) { + if (CTheScripts::DbgFlag) { + CRadar::ShowRadarMarker(e->GetPosition(), CRadar::GetRadarTraceColour2(CRadar::ms_RadarTrace[i].m_nColor, CRadar::ms_RadarTrace[i].m_bDim), CRadar::ms_RadarTrace->m_Radius); + + CRadar::ms_RadarTrace[i].m_Radius = CRadar::ms_RadarTrace[i].m_Radius - 0.1f; + if (CRadar::ms_RadarTrace[i].m_Radius >= 1.0f) + CRadar::ms_RadarTrace[i].m_Radius = 5.0; + } + } + if (CRadar::ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || CRadar::ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BLIP_ONLY) { + vec2d = { e->GetBoundCentre() }; + CRadar::TransformRealWorldPointToRadarSpace(&in, &vec2d); + float dist = CRadar::LimitRadarPoint(&in); + int a = CRadar::CalculateBlipAlpha(dist); + CRadar::TransformRadarPointToScreenSpace(&out, &in); + + CRGBA col = CRadar::GetRadarTraceColour(CRadar::ms_RadarTrace[i].m_nColor, CRadar::ms_RadarTrace[i].m_bDim); + + if (CRadar::ms_RadarTrace[i].m_IconID) + CRadar::DrawRadarSprite(CRadar::ms_RadarTrace[i].m_IconID, out.x, out.y, a); + else + CRadar::ShowRadarTrace(out.x, out.y, CRadar::ms_RadarTrace[i].m_wScale, col.r, col.g, col.b, 255); + } + } + } + } + } + + /* + DrawCoordBlip + */ + for (int i = 0; i < 32; i++) { + if (CRadar::ms_RadarTrace[i].m_bInUse) { + if (ms_RadarTrace[i].m_eBlipType >= BLIP_COORD) { + if (CRadar::DisplayThisBlip(ms_RadarTrace[i].m_IconID, i) && CRadar::ms_RadarTrace[i].m_eBlipType != BLIP_CONTACT_POINT || !CTheScripts::IsPlayerOnAMission()) { + if (CRadar::ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || CRadar::ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) { + if (CTheScripts::DbgFlag) { + CRadar::ShowRadarMarker(CRadar::ms_RadarTrace[i].m_vecPos, CRadar::GetRadarTraceColour2(CRadar::ms_RadarTrace[i].m_nColor, CRadar::ms_RadarTrace[i].m_bDim), CRadar::ms_RadarTrace->m_Radius); + CRadar::ms_RadarTrace[i].m_Radius = CRadar::ms_RadarTrace[i].m_Radius - 0.1f; + if (CRadar::ms_RadarTrace[i].m_Radius >= 1.0f) + CRadar::ms_RadarTrace[i].m_Radius = 5.0f; + } + } + + if (CRadar::ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || CRadar::ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BLIP_ONLY) { + CRadar::TransformRealWorldPointToRadarSpace(&in, &ms_RadarTrace[i].m_vec2DPos); + float dist = CRadar::LimitRadarPoint(&in); + int a = CRadar::CalculateBlipAlpha(dist); + CRadar::TransformRadarPointToScreenSpace(&out, &in); + + CRGBA col = CRadar::GetRadarTraceColour(CRadar::ms_RadarTrace[i].m_nColor, CRadar::ms_RadarTrace[i].m_bDim); + + if (CRadar::ms_RadarTrace[i].m_IconID) + CRadar::DrawRadarSprite(CRadar::ms_RadarTrace[i].m_IconID, out.x, out.y, a); + else + CRadar::ShowRadarTrace(out.x, out.y, CRadar::ms_RadarTrace[i].m_wScale, col.r, col.g, col.b, 255); + } + } + } + }; + } + } +} + +bool CRadar::DisplayThisBlip(int16 spriteid, int counter) +{ + switch (spriteid) { + case RADAR_SPRITE_NONE: + return true; + break; + case RADAR_SPRITE_ASUKA: + case RADAR_SPRITE_BOMB: + case RADAR_SPRITE_CAT: + return false; + break; + case RADAR_SPRITE_CENTRE: + return true; + break; + case RADAR_SPRITE_COPCAR: + case RADAR_SPRITE_DON: + case RADAR_SPRITE_EIGHT: + case RADAR_SPRITE_EL: + case RADAR_SPRITE_ICE: + case RADAR_SPRITE_JOEY: + case RADAR_SPRITE_KENJI: + case RADAR_SPRITE_LIZ: + case RADAR_SPRITE_LUIGI: + return false; + break; + case RADAR_SPRITE_NORTH: + return true; + break; + case RADAR_SPRITE_RAY: + case RADAR_SPRITE_SAL: + case RADAR_SPRITE_SAVE: + case RADAR_SPRITE_SPRAY: + case RADAR_SPRITE_TONY: + case RADAR_SPRITE_WEAPON: + return false; + break; + }; +} + +int CRadar::CalculateBlipAlpha(float dist) +{ + if (dist <= 1.0f) + return 255; + + if (dist <= 5.0f) + return (((1.0f - ((dist * 0.25f) - 0.25f)) * 255.0f) + (((dist * 0.25f) - 0.25f) * 128.0f)); + + return 128; +} + +CRGBA CRadar::GetRadarTraceColour(uint32 color, bool bright) +{ + switch (color) { + case 0: + if (bright) + return CRGBA(113, 43, 73, 255); + else + return CRGBA(127, 0, 0, 255); + break; + case 1: + if (bright) + return CRGBA(95, 160, 106, 255); + else + return CRGBA(127, 0, 255, 255); + break; + case 2: + if (bright) + return CRGBA(128, 167, 243, 255); + else + return CRGBA(0, 127, 255, 255); + break; + case 3: + if (bright) + return CRGBA(225, 225, 225, 255); + else + return CRGBA(127, 127, 127, 255); + break; + case 4: + if (bright) + return CRGBA(255, 225, 0, 255); + else + return CRGBA(127, 127, 0, 255); + break; + case 5: + if (bright) + return CRGBA(255, 0, 255, 255); + else + return CRGBA(127, 0, 127, 255); + break; + case 6: + if (bright) + return CRGBA(255, 255, 255, 255); + else + return CRGBA(127, 127, 255, 255); + break; + default: + return CRGBA(0, 0, 0, 255); + break; + } +} + void CRadar::TransformRadarPointToScreenSpace(CVector2D *out, CVector2D *in) { - out->x = in->x * HUD_STRETCH_X(47.0f) + HUD_STRETCH_X(47.0f + 20.0f); - out->y = (HUD_STRETCH_Y(76.0f)) * 0.5f + SCREEN_HEIGHT - (HUD_STRETCH_Y(123.0f)) - in->y * (HUD_STRETCH_Y(76.0f)) * 0.5f; + out->x = in->x * SCREEN_SCALE_X(47.0f) + SCREEN_SCALE_X(47.0f + 20.0f); + out->y = (SCREEN_SCALE_Y(76.0f)) * 0.5f + SCREEN_HEIGHT - (SCREEN_SCALE_Y(123.0f)) - in->y * (SCREEN_SCALE_Y(76.0f)) * 0.5f; +} + +void CRadar::DrawRadarSprite(int sprite, float x, float y, int alpha) +{ + float w = SCREEN_SCALE_X(8.0f); + float h = SCREEN_SCALE_Y(8.0f); + + RadarSprites[sprite]->Draw(CRect(x - w, y - h, x + w, y + h), CRGBA(255, 255, 255, alpha)); +} + +void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int alpha) +{ + CVector curPosn[4]; + CVector oldPosn[4]; + + curPosn[0].x = x - SCREEN_SCALE_X(5.6f); + curPosn[0].y = y + SCREEN_SCALE_Y(5.6f); + + curPosn[1].x = x + SCREEN_SCALE_X(5.6f); + curPosn[1].y = y + SCREEN_SCALE_Y(5.6f); + + curPosn[2].x = x - SCREEN_SCALE_X(5.6f); + curPosn[2].y = y - SCREEN_SCALE_Y(5.6f); + + curPosn[3].x = x + SCREEN_SCALE_X(5.6f); + curPosn[3].y = y - SCREEN_SCALE_Y(5.6f); + + for (uint32 i = 0; i < 4; i++) { + oldPosn[i] = curPosn[i]; + + curPosn[i].x = x + (oldPosn[i].x - x) * cosf(angle) + (oldPosn[i].y - y) * sinf(angle); + curPosn[i].y = y - (oldPosn[i].x - x) * sinf(angle) + (oldPosn[i].y - y) * cosf(angle); + } + + sprite->Draw(curPosn[2].x, curPosn[2].y, curPosn[3].x, curPosn[3].y, curPosn[0].x, curPosn[0].y, curPosn[1].x, curPosn[1].y, CRGBA(255, 255, 255, alpha)); } STARTPATCHES diff --git a/src/Radar.h b/src/Radar.h index 52d8a883..57d21577 100644 --- a/src/Radar.h +++ b/src/Radar.h @@ -11,11 +11,86 @@ enum eBlipType BLIP_CONTACT_POINT }; +enum eBlipDisplay +{ + BLIP_DISPLAY_NEITHER = 0, + BLIP_DISPLAY_MARKER_ONLY = 1, + BLIP_DISPLAY_BLIP_ONLY = 2, + BLIP_DISPLAY_BOTH = 3, +}; + +enum eRadarSprite +{ + RADAR_SPRITE_NONE = 0, + RADAR_SPRITE_ASUKA = 1, + RADAR_SPRITE_BOMB = 2, + RADAR_SPRITE_CAT = 3, + RADAR_SPRITE_CENTRE = 4, + RADAR_SPRITE_COPCAR = 5, + RADAR_SPRITE_DON = 6, + RADAR_SPRITE_EIGHT = 7, + RADAR_SPRITE_EL = 8, + RADAR_SPRITE_ICE = 9, + RADAR_SPRITE_JOEY = 10, + RADAR_SPRITE_KENJI = 11, + RADAR_SPRITE_LIZ = 12, + RADAR_SPRITE_LUIGI = 13, + RADAR_SPRITE_NORTH = 14, + RADAR_SPRITE_RAY = 15, + RADAR_SPRITE_SAL = 16, + RADAR_SPRITE_SAVE = 17, + RADAR_SPRITE_SPRAY = 18, + RADAR_SPRITE_TONY = 19, + RADAR_SPRITE_WEAPON = 20, + RADAR_SPRITE_COUNT = 21, +}; + +struct CBlip +{ + int32 m_nColor; + int16 m_eBlipType; // eBlipType + int32 m_nEntityHandle; + CVector2D m_vec2DPos; + CVector m_vecPos; + int16 m_BlipIndex; + int8 m_bDim; + int8 m_bInUse; + float m_Radius; + int16 m_wScale; + int16 m_eBlipDisplay; // eBlipDisplay + int16 m_IconID; // eRadarSprite + char gap_46[2]; +}; + +static_assert(sizeof(CBlip) == 0x30, "CBlip: error"); + class CRadar { public: static float &m_RadarRange; static CVector2D &vec2DRadarOrigin; + static CBlip *ms_RadarTrace; + static CSprite2d *AsukaSprite; + static CSprite2d *BombSprite; + static CSprite2d *CatSprite; + static CSprite2d *CentreSprite; + static CSprite2d *CopcarSprite; + static CSprite2d *DonSprite; + static CSprite2d *EightSprite; + static CSprite2d *ElSprite; + static CSprite2d *IceSprite; + static CSprite2d *JoeySprite; + static CSprite2d *KenjiSprite; + static CSprite2d *LizSprite; + static CSprite2d *LuigiSprite; + static CSprite2d *NorthSprite; + static CSprite2d *RaySprite; + static CSprite2d *SalSprite; + static CSprite2d *SaveSprite; + static CSprite2d *SpraySprite; + static CSprite2d *TonySprite; + static CSprite2d *WeaponSprite; + static CSprite2d *RadarSprites[21]; public: static void ClearBlipForEntity(eBlipType type, int32 id); @@ -23,5 +98,15 @@ public: static void DrawMap(); static void TransformRadarPointToScreenSpace(CVector2D * out, CVector2D * in); static void DrawBlips(); + static bool DisplayThisBlip(int16 spriteid, int counter); + static int CalculateBlipAlpha(float dist); + static CRGBA GetRadarTraceColour(uint32 color, bool bright); + static int GetRadarTraceColour2(uint32 color, bool bright); static void DrawRadarMap(); + static void DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int alpha); + static void TransformRealWorldPointToRadarSpace(CVector2D *out, CVector2D *in); + static float LimitRadarPoint(CVector2D *point); + static void DrawRadarSprite(int sprite, float x, float y, int alpha); + static void ShowRadarMarker(CVector pos, uint32 color, float radius); + static void ShowRadarTrace(float x, float y, uint32 size, uint32 red, uint32 green, uint32 blue, uint32 alpha); }; diff --git a/src/World.cpp b/src/World.cpp index b5b7ae5c..1a715e0c 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -594,4 +594,4 @@ WRAPPER CVehicle *FindPlayerVehicle(void) { EAXJMP(0x4A10C0); } WRAPPER CVehicle *FindPlayerTrain(void) { EAXJMP(0x4A1120); } WRAPPER CVector FindPlayerSpeed(void) { EAXJMP(0x4A1090); } WRAPPER CVector FindPlayerCentreOfWorld_NoSniperShift(void) { EAXJMP(0x4A11C0); } - +WRAPPER float FindPlayerHeading(void) { EAXJMP(0x4A1220); } diff --git a/src/World.h b/src/World.h index c1d870e2..9a8a0c46 100644 --- a/src/World.h +++ b/src/World.h @@ -100,4 +100,5 @@ CVector &FindPlayerCoors(CVector &v); CVehicle *FindPlayerVehicle(void); CVehicle *FindPlayerTrain(void); CVector FindPlayerSpeed(void); -CVector FindPlayerCentreOfWorld_NoSniperShift(void);
\ No newline at end of file +CVector FindPlayerCentreOfWorld_NoSniperShift(void); +float FindPlayerHeading(void); 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 diff --git a/src/common.h b/src/common.h index 5552a5c2..0345b65c 100644 --- a/src/common.h +++ b/src/common.h @@ -56,6 +56,17 @@ extern void **rwengine; #include "skel\skeleton.h" #include "Draw.h" +/* + { SCREEN_STRETCH } Done originally by the game for most of the printed stuff. + Stretches everything to screen avoiding it's aspect ratio. + Looks good only in 4:3. + + { SCREEN_SCALE } Alternative to the one above, it's used in this project to scale + original content to a *DEFINED aspect ratio with the possibility to + set a multiplier and scale content differently. + In theory should look good on any screen. +*/ + #define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio()) #define SCREENW (RsGlobal.maximumWidth) @@ -66,15 +77,16 @@ extern void **rwengine; #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))) -#define SCREEN_STRETCH_X_AR(a) float((a) * (SCREEN_WIDTH / float(DEFAULT_SCREEN_WIDTH)) * (4.0/3.0f)/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)) - -#define HUD_STRETCH_X SCREEN_STRETCH_X_AR -#define HUD_STRETCH_Y SCREEN_STRETCH_Y -#define HUD_FROM_RIGHT(a) (SCREEN_WIDTH - HUD_STRETCH_X(a)) -#define HUD_FROM_BOTTOM(a) (SCREEN_HEIGHT - HUD_STRETCH_Y(a)) +#define SCREEN_STRETCH_FROM_RIGHT(a) float(SCREEN_WIDTH - SCREEN_STRETCH_X(a)) +#define SCREEN_STRETCH_FROM_BOTTOM(a) float(SCREEN_HEIGHT - SCREEN_STRETCH_Y(a)) + +#define SCREEN_MULTIPLIER (CDraw::GetScreenMult()) +#define SCREEN_SCALE(a) float((a) * (4.0f / 3.0f) / SCREEN_ASPECT_RATIO) +#define SCREEN_SCALE_X(a) SCREEN_SCALE(SCREEN_STRETCH_X(a) * SCREEN_MULTIPLIER) +#define SCREEN_SCALE_Y(a) (SCREEN_STRETCH_Y(a) * SCREEN_MULTIPLIER) +#define SCREEN_SCALE_FROM_RIGHT(a) (SCREEN_WIDTH - SCREEN_SCALE_X(a)) +#define SCREEN_SCALE_FROM_BOTTOM(a) (SCREEN_HEIGHT - SCREEN_SCALE_Y(a)) #include "math/Vector.h" #include "math/Vector2D.h" diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index b8469e5f..6f1ad028 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -68,40 +68,40 @@ CGarages::IsModelIndexADoor(uint32 id) void CGarages::PrintMessages() { if (CTimer::GetTimeInMilliseconds() > CGarages::MessageStartTime && CTimer::GetTimeInMilliseconds() < CGarages::MessageEndTime) { - CFont::SetScale(HUD_STRETCH_X(1.2f / 2), HUD_STRETCH_Y(1.5f / 2)); // BUG: game doesn't use macro here. + CFont::SetScale(SCREEN_SCALE_X(1.2f / 2), SCREEN_SCALE_Y(1.5f / 2)); // BUG: game doesn't use macro here. CFont::SetPropOn(); CFont::SetJustifyOff(); CFont::SetBackgroundOff(); - CFont::SetCentreSize(HUD_FROM_RIGHT(50.0f)); + CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(50.0f)); CFont::SetCentreOn(); CFont::SetFontStyle(FONT_BANK); if (CGarages::MessageNumberInString2 < 0) { if (CGarages::MessageNumberInString < 0) { CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString((SCREEN_WIDTH/ 2) + HUD_STRETCH_X(2.0f), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f), TheText.Get(CGarages::MessageIDString)); + CFont::PrintString((SCREEN_WIDTH/ 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(-84.0f), TheText.Get(CGarages::MessageIDString)); CFont::SetColor(CRGBA(89, 115, 150, 255)); - CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f), TheText.Get(CGarages::MessageIDString)); + CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(-84.0f), TheText.Get(CGarages::MessageIDString)); } else { CMessages::InsertNumberInString(TheText.Get(CGarages::MessageIDString), CGarages::MessageNumberInString, -1, -1, -1, -1, -1, gUString); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString((SCREEN_WIDTH / 2) + HUD_STRETCH_X(2.0f), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f + 2.0 - 40.0f), gUString); + CFont::PrintString((SCREEN_WIDTH / 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(-84.0f + 2.0 - 40.0f), gUString); CFont::SetColor(CRGBA(89, 115, 150, 255)); - CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f - 40.0f), gUString); + CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(-84.0f - 40.0f), gUString); } } else { CMessages::InsertNumberInString(TheText.Get(CGarages::MessageIDString), CGarages::MessageNumberInString2, -1, -1, -1, -1, -1, gUString); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString((SCREEN_WIDTH / 2) + HUD_STRETCH_X(2.0f), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f + 2.0 - 40.0f), gUString); + CFont::PrintString((SCREEN_WIDTH / 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(-84.0f + 2.0 - 40.0f), gUString); CFont::SetColor(CRGBA(89, 115, 150, 255)); - CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f - 40.0f), gUString); + CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(-84.0f - 40.0f), gUString); } } }
\ No newline at end of file diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 7cea978f..68212e2c 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -7,3 +7,7 @@ uint8 *CTheScripts::ScriptSpace = (uint8*)0x74B248; CTextLine* CTheScripts::IntroTextLines = (CTextLine*)0x70EA74; CScriptRectangle* CTheScripts::IntroRectangles = (CScriptRectangle*)0x72D109; CSprite2d* CTheScripts::ScriptSprites = (CSprite2d*)0x72B090; +bool CTheScripts::DbgFlag = *(bool*)0x95CD87; +uint32 CTheScripts::OnAMissionFlag = *(uint32*)0x8F1B64; + +WRAPPER bool CTheScripts::IsPlayerOnAMission() { EAXJMP(0x439410); } diff --git a/src/control/Script.h b/src/control/Script.h index cdc33e97..cf428855 100644 --- a/src/control/Script.h +++ b/src/control/Script.h @@ -39,4 +39,9 @@ public: static CTextLine* IntroTextLines; static CScriptRectangle* IntroRectangles; static CSprite2d* ScriptSprites; + static bool DbgFlag; + static uint32 OnAMissionFlag; + +public: + static bool IsPlayerOnAMission(); }; diff --git a/src/main.cpp b/src/main.cpp index 9bdb41fc..f9ede02d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -328,15 +328,15 @@ Render2dStuff(void) // top and bottom strips if (weaponType == WEAPONTYPE_ROCKETLAUNCHER) { - CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW, SCREENH / 2 - HUD_STRETCH_Y(180)), black); - CSprite2d::DrawRect(CRect(0.0f, SCREENH / 2 + HUD_STRETCH_Y(170), SCREENW, SCREENH), black); + CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW, SCREENH / 2 - SCREEN_SCALE_Y(180)), black); + CSprite2d::DrawRect(CRect(0.0f, SCREENH / 2 + SCREEN_SCALE_Y(170), SCREENW, SCREENH), black); } else { - CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW, SCREENH / 2 - HUD_STRETCH_Y(210)), black); - CSprite2d::DrawRect(CRect(0.0f, SCREENH / 2 + HUD_STRETCH_Y(210), SCREENW, SCREENH), black); + CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW, SCREENH / 2 - SCREEN_SCALE_Y(210)), black); + CSprite2d::DrawRect(CRect(0.0f, SCREENH / 2 + SCREEN_SCALE_Y(210), SCREENW, SCREENH), black); } - CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW / 2 - HUD_STRETCH_X(210), SCREENH), black); - CSprite2d::DrawRect(CRect(SCREENW / 2 + HUD_STRETCH_X(210), 0.0f, SCREENW, SCREENH), black); + CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW / 2 - SCREEN_SCALE_X(210), SCREENH), black); + CSprite2d::DrawRect(CRect(SCREENW / 2 + SCREEN_SCALE_X(210), 0.0f, SCREENW, SCREENH), black); } MusicManager.DisplayRadioStationName(); @@ -536,17 +536,17 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen) if(str1){ NumberOfChunksLoaded += 1; - float hpos = SCREEN_STRETCH_X(40); - float length = SCREENW - SCREEN_STRETCH_X(100); - float vpos = SCREENH - SCREEN_STRETCH_Y(13); - float height = SCREEN_STRETCH_Y(7); + float hpos = SCREEN_SCALE_X(40); + float length = SCREENW - SCREEN_SCALE_X(100); + float vpos = SCREENH - SCREEN_SCALE_Y(13); + float height = SCREEN_SCALE_Y(7); CSprite2d::DrawRect(CRect(hpos, vpos, hpos + length, vpos + height), CRGBA(40, 53, 68, 255)); length *= NumberOfChunksLoaded/TOTALNUMCHUNKS; CSprite2d::DrawRect(CRect(hpos, vpos, hpos + length, vpos + height), CRGBA(81, 106, 137, 255)); // this is done by the game but is unused - CFont::SetScale(SCREEN_STRETCH_X(2), SCREEN_STRETCH_Y(2)); + CFont::SetScale(SCREEN_SCALE_X(2), SCREEN_SCALE_Y(2)); CFont::SetPropOn(); CFont::SetRightJustifyOn(); CFont::SetFontStyle(FONT_HEADING); @@ -554,7 +554,7 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen) #ifdef CHATTYSPLASH // my attempt static wchar tmpstr[80]; - float scale = SCREEN_STRETCH_Y(0.8f); + float scale = SCREEN_SCALE_Y(0.8f); vpos -= 50*scale; CFont::SetScale(scale, scale); CFont::SetPropOn(); diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp index b411176f..7fd2f604 100644 --- a/src/render/Draw.cpp +++ b/src/render/Draw.cpp @@ -5,6 +5,7 @@ #include "Camera.h" float CDraw::ms_fAspectRatio; +float CDraw::ms_fScreenMultiplier; float &CDraw::ms_fNearClipZ = *(float*)0x8E2DC4; float &CDraw::ms_fFarClipZ = *(float*)0x9434F0; @@ -18,6 +19,8 @@ uint8 &CDraw::FadeBlue = *(uint8*)0x95CD53; void CDraw::CalculateAspectRatio() { + SetScreenMult(DEFAULT_SCALE); + if(FrontEndMenuManager.m_PrefsUseWideScreen) ms_fAspectRatio = 16.0f/9.0f; else if(TheCamera.m_WideScreenOn) diff --git a/src/render/Draw.h b/src/render/Draw.h index 6dd42121..1fcb5212 100644 --- a/src/render/Draw.h +++ b/src/render/Draw.h @@ -1,5 +1,8 @@ #pragma once +#define HUD_SCALE 0.8f +#define DEFAULT_SCALE 1.0f + class CDraw { private: @@ -7,6 +10,7 @@ private: static float &ms_fFarClipZ; static float &ms_fFOV; static float ms_fAspectRatio; + static float ms_fScreenMultiplier; public: static uint8 &FadeValue; @@ -24,5 +28,6 @@ public: static void CalculateAspectRatio(); static float GetAspectRatio(void) { return ms_fAspectRatio; } - + static void SetScreenMult(float mult) { ms_fScreenMultiplier = mult; }; + static float GetScreenMult(void) { return ms_fScreenMultiplier; }; }; diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 5bf78521..559c485d 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -22,7 +22,7 @@ //WRAPPER void CHud::Draw(void) { EAXJMP(0x5052A0); } //WRAPPER void CHud::DrawAfterFade(void) { EAXJMP(0x509030); } -WRAPPER void CHud::ReInitialise(void) { EAXJMP(0x504CC0); } +//WRAPPER void CHud::ReInitialise(void) { EAXJMP(0x504CC0); } WRAPPER void CHud::GetRidOfAllHudMessages(void) { EAXJMP(0x504F90); } WRAPPER void CHud::SetHelpMessage(wchar *message, bool quick) { EAXJMP(0x5051E0); } WRAPPER void CHud::SetMessage(wchar *message) { EAXJMP(0x50A210); } @@ -38,19 +38,19 @@ wchar *CHud::m_HelpMessageToPrint = (wchar*)0x664480; float &CHud::m_HelpMessageDisplayTime = *(float*)0x8E2C28; float &CHud::m_fTextBoxNumLines = *(float*)0x8E2C28; float &CHud::m_fHelpMessageTime = *(float *)0x8E2C28; -bool &CHud::m_bHelpMessageQuick = *(bool *)0x95CCF7; +bool &CHud::m_HelpMessageQuick = *(bool *)0x95CCF7; int32 CHud::m_ZoneState = *(int32*)0x8F29AC; int32 CHud::m_ZoneFadeTimer; int32 CHud::m_ZoneNameTimer = *(int32*)0x8F1A50; -wchar *&CHud::m_pZoneName = *(wchar **)0x8E2C2C; -wchar *CHud::m_pLastZoneName = (wchar*)0x8F432C; +wchar *&CHud::m_ZoneName = *(wchar **)0x8E2C2C; +wchar *CHud::m_LastZoneName = (wchar*)0x8F432C; wchar *CHud::m_ZoneToPrint; int32 CHud::m_VehicleState = *(int32*)0x940560; int32 CHud::m_VehicleFadeTimer; int32 CHud::m_VehicleNameTimer = *(int32*)0x8F2A14; -wchar *&CHud::m_pVehicleName = *(wchar **)0x942FB4; -wchar *CHud::m_pLastVehicleName = *(wchar **)0x8E2DD8; -wchar *CHud::m_pVehicleNameToPrint; +wchar *&CHud::m_VehicleName = *(wchar **)0x942FB4; +wchar *CHud::m_LastVehicleName = *(wchar **)0x8E2DD8; +wchar *CHud::m_VehicleNameToPrint; wchar *CHud::m_Message = (wchar*)0x72E318; wchar *CHud::m_PagerMessage = (wchar*)0x878840; bool &CHud::m_Wants_To_Draw_Hud = *(bool*)0x95CD89; @@ -130,6 +130,8 @@ RwTexture *&gpRocketSightTex = *(RwTexture**)0x8E2C20; void CHud::Initialise() { + debug("Init CHud"); + ReInitialise(); int HudTXD = CTxdStore::AddTxdSlot("hud"); @@ -150,6 +152,8 @@ void CHud::Initialise() void CHud::Shutdown() { + debug("Shutdown CHud"); + for (int i = 0; i < ARRAY_SIZE(WeaponFilenames) / 2; ++i) { Sprites[i].Delete(); } @@ -166,12 +170,12 @@ void CHud::Shutdown() void CHud::SetVehicleName(wchar *name) { - m_pVehicleName = name; + m_VehicleName = name; } void CHud::SetZoneName(wchar *name) { - m_pZoneName = name; + m_ZoneName = name; } void CHud::Draw() @@ -230,7 +234,7 @@ void CHud::Draw() if (CMenuManager::m_PrefsUseWideScreen) { fWidescreenOffset[0] = 0.0f; - fWidescreenOffset[1] = HUD_STRETCH_Y(18.0f); + fWidescreenOffset[1] = SCREEN_SCALE_Y(18.0f); } if (Mode_RunAround && TheCamera.Cams->Using3rdPersonMouseCam()) { @@ -238,18 +242,18 @@ void CHud::Draw() float f3rdY = SCREENH * TheCamera.m_f3rdPersonCHairMultY - fWidescreenOffset[1]; if (CWorld::Players[CWorld::PlayerInFocus].m_pPed && WeaponType == WEAPONTYPE_M16) { - rect.left = f3rdX - HUD_STRETCH_X(32.0f * 0.6f); - rect.top = f3rdY - HUD_STRETCH_Y(32.0f * 0.6f); - rect.right = f3rdX + HUD_STRETCH_X(32.0f * 0.6f); - rect.bottom = f3rdY + HUD_STRETCH_Y(32.0f * 0.6f); + rect.left = f3rdX - SCREEN_SCALE_X(32.0f * 0.6f); + rect.top = f3rdY - SCREEN_SCALE_Y(32.0f * 0.6f); + rect.right = f3rdX + SCREEN_SCALE_X(32.0f * 0.6f); + rect.bottom = f3rdY + SCREEN_SCALE_Y(32.0f * 0.6f); CHud::Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); } else { - rect.left = f3rdX - HUD_STRETCH_X(32.0f * 0.4f); - rect.top = f3rdY - HUD_STRETCH_Y(32.0f * 0.4f); - rect.right = f3rdX + HUD_STRETCH_X(32.0f * 0.4f); - rect.bottom = f3rdY + HUD_STRETCH_Y(32.0f * 0.4f); + rect.left = f3rdX - SCREEN_SCALE_X(32.0f * 0.4f); + rect.top = f3rdY - SCREEN_SCALE_Y(32.0f * 0.4f); + rect.right = f3rdX + SCREEN_SCALE_X(32.0f * 0.4f); + rect.bottom = f3rdY + SCREEN_SCALE_Y(32.0f * 0.4f); CHud::Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); } @@ -257,36 +261,36 @@ void CHud::Draw() else { if (Mode != CCam::CamMode::MODE_M16FIRSTPERSON_34 && Mode != CCam::CamMode::MODE_FIRSTPERSONPEDONPC_41 && Mode != CCam::CamMode::MODE_EDITOR) { if (Mode == CCam::CamMode::MODE_ROCKET_RUN_AROUND) { - rect.left = (SCREEN_WIDTH / 2) - HUD_STRETCH_X(32.0f * 0.7f); - rect.top = (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(32.0f * 0.7f); - rect.right = (SCREEN_WIDTH / 2) + HUD_STRETCH_X(32.0f * 0.7f); - rect.bottom = (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(32.0f * 0.7f); + rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(32.0f * 0.7f); + rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(32.0f * 0.7f); + rect.right = (SCREEN_WIDTH / 2) + SCREEN_SCALE_X(32.0f * 0.7f); + rect.bottom = (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(32.0f * 0.7f); CHud::Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); } else if (Mode != CCam::CamMode::MODE_ROCKET && Mode != CCam::CamMode::MODE_SNIPER_RUN_AROUND) { - rect.left = (SCREEN_WIDTH / 2) - HUD_STRETCH_X(210.0f); - rect.top = (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(210.0f); + rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(210.0f); + rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(210.0f); rect.right = SCREEN_WIDTH / 2; rect.bottom = SCREEN_HEIGHT / 2; CHud::Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); rect.right = (SCREEN_WIDTH / 2); - rect.top = (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(210.0f); - rect.left = HUD_STRETCH_X(210.0f) + (SCREEN_WIDTH / 2); + rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(210.0f); + rect.left = SCREEN_SCALE_X(210.0f) + (SCREEN_WIDTH / 2); rect.bottom = SCREEN_HEIGHT / 2; CHud::Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); - rect.left = (SCREEN_WIDTH / 2) - HUD_STRETCH_X(210.0f); + rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(210.0f); rect.bottom = (SCREEN_HEIGHT / 2); rect.right = (SCREEN_WIDTH / 2); - rect.top = HUD_STRETCH_Y(210.0f) + (SCREEN_HEIGHT / 2); + rect.top = SCREEN_SCALE_Y(210.0f) + (SCREEN_HEIGHT / 2); CHud::Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); rect.right = (SCREEN_WIDTH / 2); rect.bottom = (SCREEN_HEIGHT / 2); - rect.left = HUD_STRETCH_X(210.0f) + (SCREEN_WIDTH / 2); - rect.top = HUD_STRETCH_Y(210.0f) + (SCREEN_HEIGHT / 2); + rect.left = SCREEN_SCALE_X(210.0f) + (SCREEN_WIDTH / 2); + rect.top = SCREEN_SCALE_Y(210.0f) + (SCREEN_HEIGHT / 2); CHud::Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); } else { @@ -297,14 +301,14 @@ void CHud::Draw() RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATETEXTURERASTER, gpRocketSightTex->raster); - CSprite::RenderOneXLUSprite(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 1.0f, HUD_STRETCH_X(40.0f), HUD_STRETCH_Y(40.0f), (100.0f * fMultBright), (200.0f * fMultBright), (100.0f * fMultBright), 255, 1.0f, 255); + CSprite::RenderOneXLUSprite(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 1.0f, SCREEN_SCALE_X(40.0f), SCREEN_SCALE_Y(40.0f), (100.0f * fMultBright), (200.0f * fMultBright), (100.0f * fMultBright), 255, 1.0f, 255); } } else { - rect.left = (SCREEN_WIDTH / 2) - HUD_STRETCH_X(32.0f); - rect.top = (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(32.0f); - rect.right = (SCREEN_WIDTH / 2) + HUD_STRETCH_X(32.0f); - rect.bottom = (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(32.0f); + rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(32.0f); + rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(32.0f); + rect.right = (SCREEN_WIDTH / 2) + SCREEN_SCALE_X(32.0f); + rect.bottom = (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(32.0f); CHud::Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); } } @@ -328,7 +332,7 @@ void CHud::Draw() CFont::SetPropOff(); CFont::SetBackgroundOff(); - CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f)); + CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); CFont::SetCentreOff(); CFont::SetRightJustifyOn(); CFont::SetRightJustifyWrap(0.0f); @@ -337,10 +341,10 @@ void CHud::Draw() CFont::SetPropOff(); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(HUD_FROM_RIGHT(110.0f - 2.0f), HUD_STRETCH_Y(43.0f + 2.0f), sPrint); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f - 2.0f), SCREEN_SCALE_Y(43.0f + 2.0f), sPrint); CFont::SetColor(CRGBA(89, 115, 150, 255)); - CFont::PrintString(HUD_FROM_RIGHT(110.0f), HUD_STRETCH_Y(43.0f), sPrint); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(43.0f), sPrint); /* DrawClock @@ -350,10 +354,10 @@ void CHud::Draw() CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(HUD_FROM_RIGHT(111.0f - 2.0f), HUD_STRETCH_Y(22.0f + 2.0f), sPrint); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f - 2.0f), SCREEN_SCALE_Y(22.0f + 2.0f), sPrint); CFont::SetColor(CRGBA(194, 165, 120, 255)); - CFont::PrintString(HUD_FROM_RIGHT(111.0f), HUD_STRETCH_Y(22.0f), sPrint); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f), SCREEN_SCALE_Y(22.0f), sPrint); /* DrawAmmo @@ -382,10 +386,10 @@ void CHud::Draw() AsciiToUnicode(sTemp, sPrint); CFont::SetBackgroundOff(); - CFont::SetScale(HUD_STRETCH_X(0.4f), HUD_STRETCH_Y(0.6f)); + CFont::SetScale(SCREEN_SCALE_X(0.4f), SCREEN_SCALE_Y(0.6f)); CFont::SetJustifyOff(); CFont::SetCentreOn(); - CFont::SetCentreSize(HUD_STRETCH_X(640.0f)); + CFont::SetCentreSize(SCREEN_SCALE_X(640.0f)); CFont::SetPropOn(); CFont::SetFontStyle(FONT_BANK); @@ -393,7 +397,7 @@ void CHud::Draw() if (WeaponType) { if (WeaponType != 1) { CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(HUD_FROM_RIGHT(66.0f), HUD_STRETCH_Y(73.0f), sPrint); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(66.0f), SCREEN_SCALE_Y(73.0f), sPrint); } } } @@ -402,7 +406,7 @@ void CHud::Draw() DrawWeaponIcon */ CHud::Sprites[WeaponType].Draw( - CRect(HUD_FROM_RIGHT(99.0f), HUD_STRETCH_Y(27.0f), HUD_FROM_RIGHT(35.0f), HUD_STRETCH_Y(91.0f)), + CRect(SCREEN_SCALE_FROM_RIGHT(99.0f), SCREEN_SCALE_Y(27.0f), SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(91.0f)), CRGBA(255, 255, 255, 255), 0.015f, 0.015f, @@ -417,7 +421,7 @@ void CHud::Draw() DrawHealth */ CFont::SetBackgroundOff(); - CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f)); + CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); CFont::SetJustifyOff(); CFont::SetCentreOff(); CFont::SetRightJustifyWrap(0.0f); @@ -437,17 +441,17 @@ void CHud::Draw() AsciiToUnicode(sTemp, sPrint); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(HUD_FROM_RIGHT(110.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrint); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrint); if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) { - CFont::PrintString(HUD_FROM_RIGHT(164.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrintIcon); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(164.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrintIcon); } CFont::SetColor(CRGBA(186, 101, 50, 255)); - CFont::PrintString(HUD_FROM_RIGHT(110.0f), HUD_STRETCH_Y(65.0f), sPrint); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(65.0f), sPrint); if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) { - CFont::PrintString(HUD_FROM_RIGHT(164.0f), HUD_STRETCH_Y(65.0f), sPrintIcon); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(164.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon); } } } @@ -456,25 +460,25 @@ void CHud::Draw() DrawArmour */ if (CHud::m_ItemToFlash == ITEM_ARMOUR && CTimer::GetFrameCounter() & 8 || CHud::m_ItemToFlash != ITEM_ARMOUR) { - CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f)); + CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fArmour > 1.0f) { AsciiToUnicode("[", sPrintIcon); sprintf(sTemp, "%03d", (int32)CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fArmour); AsciiToUnicode(sTemp, sPrint); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(HUD_FROM_RIGHT(182.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrint); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrint); if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 4) { - CFont::PrintString(HUD_FROM_RIGHT(234.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrintIcon); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(234.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrintIcon); } CFont::SetColor(CRGBA(124, 140, 95, 255)); - CFont::PrintString(HUD_FROM_RIGHT(182.0f), HUD_STRETCH_Y(65.0f), sPrint); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f), SCREEN_SCALE_Y(65.0f), sPrint); if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 1) { - CFont::PrintString(HUD_FROM_RIGHT(234.0f), HUD_STRETCH_Y(65.0f), sPrintIcon); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(234.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon); } } } @@ -483,7 +487,7 @@ void CHud::Draw() DrawWantedLevel */ CFont::SetBackgroundOff(); - CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f)); + CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); CFont::SetJustifyOff(); CFont::SetCentreOff(); CFont::SetRightJustifyOff(); @@ -494,27 +498,27 @@ void CHud::Draw() for (int i = 0; i < 6; i++) { CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(2.0f + HUD_FROM_RIGHT(60.0f - 2.0f + 23.0f * i), HUD_STRETCH_Y(87.0f + 2.0f), sPrintIcon); + CFont::PrintString(2.0f + SCREEN_SCALE_FROM_RIGHT(60.0f - 2.0f + 23.0f * i), SCREEN_SCALE_Y(87.0f + 2.0f), sPrintIcon); if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel > i && (CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nLastWantedLevelChange + 2000 || CTimer::GetFrameCounter() & 4)) { CFont::SetColor(CRGBA(193, 164, 120, 255)); - CFont::PrintString(HUD_FROM_RIGHT(60.0f + 23.0f * i), HUD_STRETCH_Y(87.0f), sPrintIcon); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(60.0f + 23.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon); } } /* DrawZoneName */ - if (CHud::m_pZoneName) { + if (CHud::m_ZoneName) { float fZoneAlpha = 0.0f; - if (CHud::m_pZoneName != CHud::m_pLastZoneName) { + if (CHud::m_ZoneName != CHud::m_LastZoneName) { switch (CHud::m_ZoneState) { case 0: CHud::m_ZoneState = 2; - CHud::m_ZoneToPrint = CHud::m_pZoneName; + CHud::m_ZoneToPrint = CHud::m_ZoneName; CHud::m_ZoneNameTimer = 0; CHud::m_ZoneFadeTimer = 0; break; @@ -528,7 +532,7 @@ void CHud::Draw() default: break; } - CHud::m_pLastZoneName = CHud::m_pZoneName; + CHud::m_LastZoneName = CHud::m_ZoneName; } if (CHud::m_ZoneState) { @@ -560,7 +564,7 @@ void CHud::Draw() CHud::m_ZoneFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f); if (CHud::m_ZoneFadeTimer < 0) { CHud::m_ZoneFadeTimer = 0; - CHud::m_ZoneToPrint = CHud::m_pLastZoneName; + CHud::m_ZoneToPrint = CHud::m_LastZoneName; CHud::m_ZoneNameTimer = 0; CHud::m_ZoneState = 2; } @@ -577,24 +581,24 @@ void CHud::Draw() CFont::SetBackgroundOff(); if (CMenuManager::m_PrefsLanguage == 4) - CFont::SetScale(HUD_STRETCH_X(1.2f * 0.8f), HUD_STRETCH_Y(1.2f)); + CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.8f), SCREEN_SCALE_Y(1.2f)); else - CFont::SetScale(HUD_STRETCH_X(1.2f), HUD_STRETCH_Y(1.2f)); + CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f)); CFont::SetRightJustifyOn(); CFont::SetRightJustifyWrap(0.0f); CFont::SetBackGroundOnlyTextOff(); CFont::SetFontStyle(FONT_BANK); CFont::SetColor(CRGBA(0, 0, 0, fZoneAlpha)); - CFont::PrintString(HUD_FROM_RIGHT(32.0f - 1.0f), HUD_FROM_BOTTOM(30.0f - 1.0f), CHud::m_ZoneToPrint); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f - 1.0f), SCREEN_SCALE_FROM_BOTTOM(30.0f - 1.0f), CHud::m_ZoneToPrint); CFont::SetColor(CRGBA(152, 154, 82, fZoneAlpha)); - CFont::PrintString(HUD_FROM_RIGHT(32.0f), HUD_FROM_BOTTOM(30.0f), CHud::m_ZoneToPrint); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(30.0f), CHud::m_ZoneToPrint); } } } else { - CHud::m_pLastZoneName = 0; + CHud::m_LastZoneName = 0; CHud::m_ZoneState = 0; CHud::m_ZoneFadeTimer = 0; CHud::m_ZoneNameTimer = 0; @@ -603,14 +607,14 @@ void CHud::Draw() /* DrawVehicleName */ - if (CHud::m_pVehicleName) { + if (CHud::m_VehicleName) { float fVehicleAlpha = 0.0f; - if (CHud::m_pVehicleName != CHud::m_pLastVehicleName) { + if (CHud::m_VehicleName != CHud::m_LastVehicleName) { switch (CHud::m_VehicleState) { case 0: CHud::m_VehicleState = 2; - CHud::m_pVehicleNameToPrint = CHud::m_pVehicleName; + CHud::m_VehicleNameToPrint = CHud::m_VehicleName; CHud::m_VehicleNameTimer = 0; CHud::m_VehicleFadeTimer = 0; break; @@ -624,7 +628,7 @@ void CHud::Draw() default: break; } - CHud::m_pLastVehicleName = CHud::m_pVehicleName; + CHud::m_LastVehicleName = CHud::m_VehicleName; } if (CHud::m_VehicleState) { @@ -656,7 +660,7 @@ void CHud::Draw() CHud::m_VehicleFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f); if (CHud::m_VehicleFadeTimer < 0) { CHud::m_VehicleFadeTimer = 0; - CHud::m_pVehicleNameToPrint = CHud::m_pLastVehicleName; + CHud::m_VehicleNameToPrint = CHud::m_LastVehicleName; CHud::m_VehicleNameTimer = 0; CHud::m_VehicleState = 2; } @@ -673,24 +677,24 @@ void CHud::Draw() CFont::SetBackgroundOff(); if (CMenuManager::m_PrefsLanguage != 3 && CMenuManager::m_PrefsLanguage != 4) - CFont::SetScale(HUD_STRETCH_X(1.2f), HUD_STRETCH_Y(1.2f)); + CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f)); else - CFont::SetScale(HUD_STRETCH_X(1.2f * 0.85f), HUD_STRETCH_Y(1.2f)); + CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.85f), SCREEN_SCALE_Y(1.2f)); CFont::SetRightJustifyOn(); CFont::SetRightJustifyWrap(0.0f); CFont::SetBackGroundOnlyTextOff(); CFont::SetFontStyle(FONT_BANK); CFont::SetColor(CRGBA(0, 0, 0, fVehicleAlpha)); - CFont::PrintString(HUD_FROM_RIGHT(32.0f - 1.0f), HUD_FROM_BOTTOM(55.0f - 1.0f), CHud::m_pVehicleNameToPrint); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f - 1.0f), SCREEN_SCALE_FROM_BOTTOM(55.0f - 1.0f), CHud::m_VehicleNameToPrint); CFont::SetColor(CRGBA(194, 165, 120, fVehicleAlpha)); - CFont::PrintString(HUD_FROM_RIGHT(32.0f), HUD_FROM_BOTTOM(55.0f), CHud::m_pVehicleNameToPrint); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(55.0f), CHud::m_VehicleNameToPrint); } } } else { - CHud::m_pLastVehicleName = 0; + CHud::m_LastVehicleName = 0; CHud::m_VehicleState = 0; CHud::m_VehicleFadeTimer = 0; CHud::m_VehicleNameTimer = 0; @@ -721,27 +725,27 @@ void CHud::Draw() AsciiToUnicode(CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerBuffer, sTimer); CFont::SetPropOn(); CFont::SetBackgroundOff(); - CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f)); + CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); CFont::SetRightJustifyOn(); CFont::SetRightJustifyWrap(0.0f); CFont::SetFontStyle(FONT_HEADING); CFont::SetPropOff(); CFont::SetBackGroundOnlyTextOn(); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(HUD_FROM_RIGHT(27.0f - 2.0f), HUD_STRETCH_Y(110.0f + 2.0f), sTimer); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f - 2.0f), SCREEN_SCALE_Y(110.0f + 2.0f), sTimer); - CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f)); + CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); CFont::SetColor(CRGBA(186, 101, 50, 255)); - CFont::PrintString(HUD_FROM_RIGHT(27.0f), HUD_STRETCH_Y(110.0f), sTimer); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f), SCREEN_SCALE_Y(110.0f), sTimer); if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText[0]) { CFont::SetPropOn(); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f)); - CFont::PrintString(HUD_FROM_RIGHT(27.0f + 78.0f), HUD_STRETCH_Y(110.0f + 2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); + CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f + 78.0f), SCREEN_SCALE_Y(110.0f + 2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); CFont::SetColor(CRGBA(186, 101, 50, 255)); - CFont::PrintString(HUD_FROM_RIGHT(27.0f + 80.0f), HUD_STRETCH_Y(110.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f + 80.0f), SCREEN_SCALE_Y(110.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); } } } @@ -758,39 +762,39 @@ void CHud::Draw() if (CTimer::GetFrameCounter() & 4 || !CounterFlashTimer) { if (CUserDisplay::OnscnTimer.m_sEntries[0].m_nType) { - CSprite2d::DrawRect(CRect(HUD_FROM_RIGHT(127.0f - 4.0f), HUD_STRETCH_Y(132.0 + 8.0f), HUD_FROM_RIGHT(23.0f), HUD_STRETCH_Y(11.0f + 132.0f + 8.0f)), CRGBA(0, 106, 164, 80)); - CSprite2d::DrawRect(CRect(HUD_FROM_RIGHT(127.0f + 4.0f), HUD_STRETCH_Y(132.0 + 8.0f), HUD_FROM_RIGHT(atoi(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer) + 27.0f + 100.0f + 4.0f), HUD_STRETCH_Y(11.0f + 132.0f + 8.0f)), CRGBA(0, 106, 164, 255)); + CSprite2d::DrawRect(CRect(SCREEN_SCALE_FROM_RIGHT(127.0f - 4.0f), SCREEN_SCALE_Y(132.0 + 8.0f), SCREEN_SCALE_FROM_RIGHT(23.0f), SCREEN_SCALE_Y(11.0f + 132.0f + 8.0f)), CRGBA(0, 106, 164, 80)); + CSprite2d::DrawRect(CRect(SCREEN_SCALE_FROM_RIGHT(127.0f + 4.0f), SCREEN_SCALE_Y(132.0 + 8.0f), SCREEN_SCALE_FROM_RIGHT(atoi(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer) + 27.0f + 100.0f + 4.0f), SCREEN_SCALE_Y(11.0f + 132.0f + 8.0f)), CRGBA(0, 106, 164, 255)); } else { AsciiToUnicode(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer, sTimer); CFont::SetPropOn(); CFont::SetBackgroundOff(); - CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f)); + CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); CFont::SetCentreOff(); CFont::SetRightJustifyOn(); CFont::SetRightJustifyWrap(0.0f); CFont::SetFontStyle(FONT_HEADING); CFont::SetColor(CRGBA(244, 20, 20, 255)); - CFont::SetWrapx(HUD_STRETCH_X(640.0f)); + CFont::SetWrapx(SCREEN_SCALE_X(640.0f)); CFont::SetPropOff(); CFont::SetBackGroundOnlyTextOn(); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(HUD_FROM_RIGHT(27.0f - 2.0f), HUD_STRETCH_Y(132.0f + 2.0f), sTimer); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f - 2.0f), SCREEN_SCALE_Y(132.0f + 2.0f), sTimer); CFont::SetColor(CRGBA(0, 106, 164, 255)); - CFont::PrintString(HUD_FROM_RIGHT(27.0f), HUD_STRETCH_Y(132.0f), sTimer); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f), SCREEN_SCALE_Y(132.0f), sTimer); } if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText[0]) { CFont::SetPropOn(); - CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f)); + CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(HUD_FROM_RIGHT(27.0f + 59.0f), HUD_STRETCH_Y(132.0f + 2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f + 59.0f), SCREEN_SCALE_Y(132.0f + 2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); CFont::SetColor(CRGBA(0, 106, 164, 255)); - CFont::PrintString(HUD_FROM_RIGHT(27.0f + 61.0f), HUD_STRETCH_Y(132.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f + 61.0f), SCREEN_SCALE_Y(132.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); } } } @@ -833,10 +837,10 @@ void CHud::Draw() } } - CHud::Sprites[HUD_PAGER].Draw(CRect(HUD_STRETCH_X(26.0f - PagerXOffset), HUD_STRETCH_Y(27.0f), HUD_STRETCH_X(160.0 + 26.0f - PagerXOffset), HUD_STRETCH_Y(80.0f + 27.0f)), CRGBA(255, 255, 255, 255)); + CHud::Sprites[HUD_PAGER].Draw(CRect(SCREEN_SCALE_X(26.0f - PagerXOffset), SCREEN_SCALE_Y(27.0f), SCREEN_SCALE_X(160.0 + 26.0f - PagerXOffset), SCREEN_SCALE_Y(80.0f + 27.0f)), CRGBA(255, 255, 255, 255)); CFont::SetBackgroundOff(); - CFont::SetScale(HUD_STRETCH_X(0.84f), HUD_STRETCH_Y(1.0f)); + CFont::SetScale(SCREEN_SCALE_X(0.84f), SCREEN_SCALE_Y(1.0f)); CFont::SetColor(CRGBA(32, 162, 66, 205)); CFont::SetRightJustifyOff(); CFont::SetBackgroundOff(); @@ -844,7 +848,7 @@ void CHud::Draw() CFont::SetJustifyOff(); CFont::SetPropOff(); CFont::SetFontStyle(FONT_PAGER); - CFont::PrintString(HUD_STRETCH_X(52.0f - PagerXOffset), HUD_STRETCH_Y(54.0f), CHud::m_PagerMessage); + CFont::PrintString(SCREEN_SCALE_X(52.0f - PagerXOffset), SCREEN_SCALE_Y(54.0f), CHud::m_PagerMessage); } /* @@ -852,7 +856,7 @@ void CHud::Draw() */ if (CHud::m_ItemToFlash == ITEM_RADAR && CTimer::GetFrameCounter() & 8 || CHud::m_ItemToFlash != ITEM_RADAR) { CRadar::DrawMap(); - CHud::Sprites[HUD_RADARDISC].Draw(CRect(HUD_STRETCH_X(16.0f), HUD_FROM_BOTTOM(123.0f + 4.0f), HUD_STRETCH_X(94.0f + 20.0f + 5.0f), HUD_FROM_BOTTOM(-76.0f + 123.0f - 6.0f)), CRGBA(0, 0, 0, 255)); + CHud::Sprites[HUD_RADARDISC].Draw(CRect(SCREEN_SCALE_X(16.0f), SCREEN_SCALE_FROM_BOTTOM(123.0f + 4.0f), SCREEN_SCALE_X(94.0f + 20.0f + 5.0f), SCREEN_SCALE_FROM_BOTTOM(-76.0f + 123.0f - 6.0f)), CRGBA(0, 0, 0, 255)); CRadar::DrawBlips(); } } @@ -872,7 +876,7 @@ void CHud::Draw() for (int i = 0; i < 2; i++) { if (CTheScripts::IntroTextLines[i].m_awText[0] && CTheScripts::IntroTextLines[i].field_29) { - CFont::SetScale(HUD_STRETCH_X(CTheScripts::IntroTextLines[i].m_fScaleX), HUD_STRETCH_Y(CTheScripts::IntroTextLines[i].m_fScaleY * 0.5f)); + CFont::SetScale(SCREEN_SCALE_X(CTheScripts::IntroTextLines[i].m_fScaleX), SCREEN_SCALE_Y(CTheScripts::IntroTextLines[i].m_fScaleY * 0.5f)); CFont::SetColor(CTheScripts::IntroTextLines[i].m_sColor); if (CTheScripts::IntroTextLines[i].m_bJustify) @@ -890,8 +894,8 @@ void CHud::Draw() else CFont::SetCentreOff(); - CFont::SetWrapx(HUD_STRETCH_X(CTheScripts::IntroTextLines[i].m_fWrapX)); - CFont::SetCentreSize(HUD_STRETCH_X(CTheScripts::IntroTextLines[i].m_fCenterSize)); + CFont::SetWrapx(SCREEN_SCALE_X(CTheScripts::IntroTextLines[i].m_fWrapX)); + CFont::SetCentreSize(SCREEN_SCALE_X(CTheScripts::IntroTextLines[i].m_fCenterSize)); if (CTheScripts::IntroTextLines[i].m_bBackground) CFont::SetBackgroundOn(); @@ -911,7 +915,7 @@ void CHud::Draw() CFont::SetPropOff(); CFont::SetFontStyle(CTheScripts::IntroTextLines[i].m_nFont); - CFont::PrintString(HUD_STRETCH_X(640.0f - CTheScripts::IntroTextLines[i].field_36), HUD_STRETCH_Y(448.0f - CTheScripts::IntroTextLines[i].field_40), IntroText->m_awText); + CFont::PrintString(SCREEN_SCALE_X(640.0f - CTheScripts::IntroTextLines[i].field_36), SCREEN_SCALE_Y(448.0f - CTheScripts::IntroTextLines[i].field_40), IntroText->m_awText); } } @@ -947,20 +951,20 @@ void CHud::Draw() CFont::SetJustifyOff(); CFont::SetBackgroundOff(); CFont::SetBackgroundColor(CRGBA(0, 0, 0, 128)); - CFont::SetScale(HUD_STRETCH_X(0.48f), HUD_STRETCH_Y(1.120f)); + CFont::SetScale(SCREEN_SCALE_X(0.48f), SCREEN_SCALE_Y(1.120f)); CFont::SetCentreOn(); CFont::SetPropOn(); CFont::SetFontStyle(FONT_BANK); if (TheCamera.m_WideScreenOn) - CFont::SetCentreSize(HUD_FROM_RIGHT(120.0f)); + CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(120.0f)); else - CFont::SetCentreSize(HUD_FROM_RIGHT(280.0f)); + CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(280.0f)); CFont::SetDropShadowPosition(1); CFont::SetDropColor(CRGBA(0, 0, 0, 255)); CFont::SetColor(CRGBA(235, 235, 235, 255)); - CFont::PrintString(SCREEN_WIDTH / 2, HUD_FROM_BOTTOM(64.0f), CHud::m_Message); + CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_SCALE_FROM_BOTTOM(64.0f), CHud::m_Message); CFont::SetDropShadowPosition(0); } @@ -973,10 +977,10 @@ void CHud::Draw() CFont::SetJustifyOff(); CFont::SetBackgroundOff(); CFont::SetBackGroundOnlyTextOff(); - CFont::SetScale(HUD_STRETCH_X(1.8f), HUD_STRETCH_Y(1.8f)); + CFont::SetScale(SCREEN_SCALE_X(1.8f), SCREEN_SCALE_Y(1.8f)); CFont::SetPropOn(); CFont::SetCentreOn(); - CFont::SetCentreSize(HUD_STRETCH_X(615.0f)); + CFont::SetCentreSize(SCREEN_SCALE_X(615.0f)); CFont::SetColor(CRGBA(255, 255, 0, 255)); CFont::SetFontStyle(FONT_HEADING); @@ -997,10 +1001,10 @@ void CHud::Draw() } CFont::SetColor(CRGBA(0, 0, 0, BigMessageAlpha[0])); - CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(20.0f - 2.0f), m_BigMessage[0]); + CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(20.0f - 2.0f), m_BigMessage[0]); CFont::SetColor(CRGBA(85, 119, 133, BigMessageAlpha[0])); - CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(20.0f), m_BigMessage[0]); + CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(20.0f), m_BigMessage[0]); } else { BigMessageAlpha[0] = 0.0; @@ -1023,19 +1027,19 @@ void CHud::Draw() CFont::SetBackgroundOff(); if (CGame::frenchGame || CGame::germanGame) - CFont::SetScale(HUD_STRETCH_X(1.4f), HUD_STRETCH_Y(1.4f)); + CFont::SetScale(SCREEN_SCALE_X(1.4f), SCREEN_SCALE_Y(1.4f)); else - CFont::SetScale(HUD_STRETCH_X(2.0f), HUD_STRETCH_Y(2.0f)); + CFont::SetScale(SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(2.0f)); CFont::SetPropOn(); CFont::SetRightJustifyOn(); CFont::SetFontStyle(FONT_HEADING); CFont::SetColor(CRGBA(0, 0, 0, 0.75f * BigMessageAlpha[2])); - CFont::PrintString(HUD_FROM_RIGHT(20.0f + 4.0f), HUD_FROM_BOTTOM(78.0f), CHud::m_BigMessage[2]); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f + 4.0f), SCREEN_SCALE_FROM_BOTTOM(78.0f), CHud::m_BigMessage[2]); CFont::SetColor(CRGBA(170, 123, 87, BigMessageAlpha[2])); - CFont::PrintString(HUD_FROM_RIGHT(20.0f), HUD_FROM_BOTTOM(82.0f), CHud::m_BigMessage[2]); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(82.0f), CHud::m_BigMessage[2]); } else { BigMessageAlpha[2] = 0.0; @@ -1087,7 +1091,7 @@ void CHud::DrawAfterFade() case 1: fAlpha = 255.0f; m_HelpMessageFadeTimer = 600; - if (m_HelpMessageTimer > m_fHelpMessageTime * 1000 || m_bHelpMessageQuick && m_HelpMessageTimer > 1500) { + if (m_HelpMessageTimer > m_fHelpMessageTime * 1000 || m_HelpMessageQuick && m_HelpMessageTimer > 1500) { m_HelpMessageFadeTimer = 600; m_HelpMessageState = 3; } @@ -1128,20 +1132,20 @@ void CHud::DrawAfterFade() CFont::SetPropOn(); if (CGame::germanGame) - CFont::SetScale(HUD_STRETCH_X(0.52f * 0.85f), HUD_STRETCH_Y(1.1f * 0.85f)); + CFont::SetScale(SCREEN_SCALE_X(0.52f * 0.85f), SCREEN_SCALE_Y(1.1f * 0.85f)); else - CFont::SetScale(HUD_STRETCH_X(0.52f), HUD_STRETCH_Y(1.1f)); + CFont::SetScale(SCREEN_SCALE_X(0.52f), SCREEN_SCALE_Y(1.1f)); CFont::SetColor(CRGBA(175, 175, 175, 255)); CFont::SetJustifyOff(); - CFont::SetWrapx(HUD_STRETCH_X(200.0f + 26.0f - 4.0f)); + CFont::SetWrapx(SCREEN_SCALE_X(200.0f + 26.0f - 4.0f)); CFont::SetFontStyle(FONT_BANK); CFont::SetBackgroundOn(); CFont::SetBackGroundOnlyTextOff(); CRGBA BackColor = { 0, 0, 0, (uint8)(0.9f * fAlpha) }; CFont::SetBackgroundColor(BackColor); CFont::SetColor(CRGBA(175, 175, 175, 255)); - CFont::PrintString(HUD_STRETCH_X(26.0f), HUD_STRETCH_Y(28.0f + (150.0f - PagerXOffset) * 0.6f), CHud::m_HelpMessageToPrint); + CFont::PrintString(SCREEN_SCALE_X(26.0f), SCREEN_SCALE_Y(28.0f + (150.0f - PagerXOffset) * 0.6f), CHud::m_HelpMessageToPrint); CFont::SetAlphaFade(255.0f); CFont::DrawFonts(); } @@ -1156,17 +1160,17 @@ void CHud::DrawAfterFade() if (m_BigMessage[4][0]) { CFont::SetJustifyOff(); CFont::SetBackgroundOff(); - CFont::SetScale(HUD_STRETCH_X(1.2f), HUD_STRETCH_Y(1.5f)); + CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.5f)); CFont::SetCentreOn(); CFont::SetPropOn(); - CFont::SetCentreSize(HUD_STRETCH_X(600.0f)); + CFont::SetCentreSize(SCREEN_SCALE_X(600.0f)); CFont::SetFontStyle(FONT_BANK); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(HUD_STRETCH_X(2.0f) + (SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(84.0f), m_BigMessage[4]); + CFont::PrintString(SCREEN_SCALE_X(2.0f) + (SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f), m_BigMessage[4]); CFont::SetColor(CRGBA(89, 115, 150, 255)); - CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(84.0f), m_BigMessage[4]); + CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f), m_BigMessage[4]); } // Oddjob result @@ -1216,16 +1220,16 @@ void CHud::DrawAfterFade() CFont::SetJustifyOff(); CFont::SetBackgroundOff(); - CFont::SetScale(HUD_STRETCH_X(1.0f), HUD_STRETCH_Y(1.2f)); + CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.2f)); CFont::SetCentreOn(); CFont::SetPropOn(); - CFont::SetCentreSize(HUD_FROM_RIGHT(20.0f)); + CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(20.0f)); CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetFontStyle(FONT_BANK); - CFont::PrintString(HUD_STRETCH_X(2.0f) + (SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(20.0f + 2.0f), m_BigMessage[5]); + CFont::PrintString(SCREEN_SCALE_X(2.0f) + (SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(20.0f + 2.0f), m_BigMessage[5]); CFont::SetColor(CRGBA(156, 91, 40, 255)); - CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(20.0f + 2.0f), m_BigMessage[5]); + CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(20.0f + 2.0f), m_BigMessage[5]); } /* @@ -1237,9 +1241,9 @@ void CHud::DrawAfterFade() CFont::SetBackgroundOff(); if (CGame::frenchGame || CMenuManager::m_PrefsLanguage == 4) - CFont::SetScale(HUD_STRETCH_X(0.884f), HUD_STRETCH_Y(1.36f)); + CFont::SetScale(SCREEN_SCALE_X(0.884f), SCREEN_SCALE_Y(1.36f)); else - CFont::SetScale(HUD_STRETCH_X(1.04f), HUD_STRETCH_Y(1.6f)); + CFont::SetScale(SCREEN_SCALE_X(1.04f), SCREEN_SCALE_Y(1.6f)); CFont::SetPropOn(); CFont::SetRightJustifyWrap(-500); @@ -1261,10 +1265,10 @@ void CHud::DrawAfterFade() BigMessageAlpha[1] = 255.0f; } CFont::SetColor(CRGBA(40, 40, 40, BigMessageAlpha[1])); - CFont::PrintString(HUD_FROM_RIGHT(20.0f - 2.0f), HUD_FROM_BOTTOM(120.0f), m_BigMessage[1]); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f - 2.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), m_BigMessage[1]); CFont::SetColor(CRGBA(220, 172, 2, BigMessageAlpha[1])); - CFont::PrintString(HUD_FROM_RIGHT(20.0f), HUD_FROM_BOTTOM(120.0f), m_BigMessage[1]); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), m_BigMessage[1]); } else { BigMessageAlpha[1] = 0.0f; @@ -1277,6 +1281,55 @@ void CHud::DrawAfterFade() } } +void CHud::ReInitialise() { + m_Wants_To_Draw_Hud = true; + m_ZoneState = 0; + m_Wants_To_Draw_3dMarkers = true; + m_LastZoneName = 0; + m_ZoneNameTimer = 0; + m_ZoneName = 0; + + for (int i = 0; i < 256; i++) { + m_HelpMessage[i] = 0; + m_LastHelpMessage[i] = 0; + m_HelpMessageToPrint[i] = 0; + m_Message[i] = 0; + + if (i <= 6) + BigMessageInUse[i] = 0.0f; + + if (i <= 128) + *(wchar*)(m_BigMessage[i]) = 0; + } + + m_HelpMessageTimer = 0; + m_HelpMessageFadeTimer = 0; + m_HelpMessageState = 0; + m_HelpMessageQuick = 0; + m_VehicleName = 0; + m_LastVehicleName = 0; + m_VehicleNameToPrint = 0; + m_VehicleNameTimer = 0; + m_VehicleFadeTimer = 0; + m_VehicleState = 0; + m_HelpMessageDisplayTime = 1.0f; + + CounterOnLastFrame = 0; + m_ItemToFlash = ITEM_NONE; + OddJob2Timer = 0; + OddJob2OffTimer = 0.0f; + CounterFlashTimer = 0; + TimerOnLastFrame = 0; + TimerFlashTimer = 0; + SpriteBrightness = 0; + PagerOn = 0; + PagerTimer = 0; + PagerSoundPlayed = 0; + OddJob2On = 0; + PagerXOffset = 150.0f; + OddJob2XOffset = 0.0f; +} + STARTPATCHES InjectHook(0x48BC9A, &CHud::Initialise, PATCH_CALL); InjectHook(0x48C4F1, &CHud::ReInitialise, PATCH_CALL); diff --git a/src/render/Hud.h b/src/render/Hud.h index c4c43e30..8f4b6fb6 100644 --- a/src/render/Hud.h +++ b/src/render/Hud.h @@ -3,6 +3,7 @@ enum eItems { + ITEM_NONE = -1, ITEM_ARMOUR = 3, ITEM_HEALTH = 4, ITEM_RADAR = 8 @@ -43,16 +44,16 @@ public: static float &m_HelpMessageDisplayTime; static float &m_fTextBoxNumLines; static float &m_fHelpMessageTime; - static bool &m_bHelpMessageQuick; + static bool &m_HelpMessageQuick; static int32 m_ZoneState; static int32 m_ZoneFadeTimer; static int32 m_ZoneNameTimer; - static wchar *&m_pZoneName; - static wchar *m_pLastZoneName; + static wchar *&m_ZoneName; + static wchar *m_LastZoneName; static wchar *m_ZoneToPrint; - static wchar *&m_pVehicleName; - static wchar *m_pLastVehicleName; - static wchar *m_pVehicleNameToPrint; + static wchar *&m_VehicleName; + static wchar *m_LastVehicleName; + static wchar *m_VehicleNameToPrint; static int32 m_VehicleState; static int32 m_VehicleFadeTimer; static int32 m_VehicleNameTimer; diff --git a/src/templates.h b/src/templates.h index 3ac0bc90..82a94506 100644 --- a/src/templates.h +++ b/src/templates.h @@ -83,7 +83,7 @@ public: } T *GetAt(int handle){ return m_flags[handle>>8].u == handle & 0xFF ? - (T*)&m_entries[handle>>8] : nil; + nil : (T*)&m_entries[handle >> 8]; } int GetIndex(T *entry){ int i = GetJustIndex(entry); |