summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-06-20 11:28:04 +0200
committerGitHub <noreply@github.com>2019-06-20 11:28:04 +0200
commit109cde810c7b6115f864cf3e5005111c17284ab9 (patch)
tree052fc5a6c687983435f8d0b871b2d9abff31f747 /src/render
parentfinally finished CVehicleModelInfo (diff)
parentFix bug in templates.h, again. (diff)
downloadre3-109cde810c7b6115f864cf3e5005111c17284ab9.tar
re3-109cde810c7b6115f864cf3e5005111c17284ab9.tar.gz
re3-109cde810c7b6115f864cf3e5005111c17284ab9.tar.bz2
re3-109cde810c7b6115f864cf3e5005111c17284ab9.tar.lz
re3-109cde810c7b6115f864cf3e5005111c17284ab9.tar.xz
re3-109cde810c7b6115f864cf3e5005111c17284ab9.tar.zst
re3-109cde810c7b6115f864cf3e5005111c17284ab9.zip
Diffstat (limited to 'src/render')
-rw-r--r--src/render/Draw.cpp3
-rw-r--r--src/render/Draw.h7
-rw-r--r--src/render/Hud.cpp313
-rw-r--r--src/render/Hud.h13
4 files changed, 199 insertions, 137 deletions
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;