summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-06-16 21:41:58 +0200
committeraap <aap@papnet.eu>2019-06-16 21:41:58 +0200
commit71ac32cbd7c801eb0c8f9e487faf9c547f6361ce (patch)
tree32e3adfe12c1915a965740553c7cff8e32acb725 /src
parentsome cleanup (diff)
downloadre3-71ac32cbd7c801eb0c8f9e487faf9c547f6361ce.tar
re3-71ac32cbd7c801eb0c8f9e487faf9c547f6361ce.tar.gz
re3-71ac32cbd7c801eb0c8f9e487faf9c547f6361ce.tar.bz2
re3-71ac32cbd7c801eb0c8f9e487faf9c547f6361ce.tar.lz
re3-71ac32cbd7c801eb0c8f9e487faf9c547f6361ce.tar.xz
re3-71ac32cbd7c801eb0c8f9e487faf9c547f6361ce.tar.zst
re3-71ac32cbd7c801eb0c8f9e487faf9c547f6361ce.zip
Diffstat (limited to 'src')
-rw-r--r--src/common.h2
-rw-r--r--src/render/Hud.cpp78
2 files changed, 41 insertions, 39 deletions
diff --git a/src/common.h b/src/common.h
index 9635f01e..a9055391 100644
--- a/src/common.h
+++ b/src/common.h
@@ -78,6 +78,8 @@ extern void **rwengine;
#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))
struct GlobalScene
{
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index cb3a20bb..5f39c6c6 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -332,10 +332,10 @@ void CHud::Draw() {
CFont::SetPropOff();
CFont::SetColor(CRGBA(0, 0, 0, 255));
- CFont::PrintString(SCREEN_FROM_RIGHT(110.0f - 2.0f), HUD_STRETCH_Y(43.0f + 2.0f), sPrint);
+ CFont::PrintString(HUD_FROM_RIGHT(110.0f - 2.0f), HUD_STRETCH_Y(43.0f + 2.0f), sPrint);
CFont::SetColor(CRGBA(89, 115, 150, 255));
- CFont::PrintString(SCREEN_FROM_RIGHT(110.0f), HUD_STRETCH_Y(43.0f), sPrint);
+ CFont::PrintString(HUD_FROM_RIGHT(110.0f), HUD_STRETCH_Y(43.0f), sPrint);
/*
DrawClock
@@ -345,10 +345,10 @@ void CHud::Draw() {
CFont::SetColor(CRGBA(0, 0, 0, 255));
- CFont::PrintString(SCREEN_FROM_RIGHT(111.0f - 2.0f), HUD_STRETCH_Y(22.0f + 2.0f), sPrint);
+ CFont::PrintString(HUD_FROM_RIGHT(111.0f - 2.0f), HUD_STRETCH_Y(22.0f + 2.0f), sPrint);
CFont::SetColor(CRGBA(194, 165, 120, 255));
- CFont::PrintString(SCREEN_FROM_RIGHT(111.0f), HUD_STRETCH_Y(22.0f), sPrint);
+ CFont::PrintString(HUD_FROM_RIGHT(111.0f), HUD_STRETCH_Y(22.0f), sPrint);
/*
DrawAmmo
@@ -388,7 +388,7 @@ void CHud::Draw() {
if (WeaponType) {
if (WeaponType != 1) {
CFont::SetColor(CRGBA(0, 0, 0, 255));
- CFont::PrintString(SCREEN_FROM_RIGHT(66.0f), HUD_STRETCH_Y(73.0f), sPrint);
+ CFont::PrintString(HUD_FROM_RIGHT(66.0f), HUD_STRETCH_Y(73.0f), sPrint);
}
}
}
@@ -397,7 +397,7 @@ void CHud::Draw() {
DrawWeaponIcon
*/
CHud::Sprites[WeaponType].Draw(
- CRect(SCREEN_FROM_RIGHT(99.0f), HUD_STRETCH_Y(27.0f), SCREEN_FROM_RIGHT(35.0f), HUD_STRETCH_Y(91.0f)),
+ CRect(HUD_FROM_RIGHT(99.0f), HUD_STRETCH_Y(27.0f), HUD_FROM_RIGHT(35.0f), HUD_STRETCH_Y(91.0f)),
CRGBA(255, 255, 255, 255),
0.015f,
0.015f,
@@ -432,17 +432,17 @@ void CHud::Draw() {
AsciiToUnicode(sTemp, sPrint);
CFont::SetColor(CRGBA(0, 0, 0, 255));
- CFont::PrintString(SCREEN_FROM_RIGHT(110.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrint);
+ CFont::PrintString(HUD_FROM_RIGHT(110.0f - 2.0f), HUD_STRETCH_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(SCREEN_FROM_RIGHT(164.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrintIcon);
+ CFont::PrintString(HUD_FROM_RIGHT(164.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrintIcon);
}
CFont::SetColor(CRGBA(186, 101, 50, 255));
- CFont::PrintString(SCREEN_FROM_RIGHT(110.0f), HUD_STRETCH_Y(65.0f), sPrint);
+ CFont::PrintString(HUD_FROM_RIGHT(110.0f), HUD_STRETCH_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(SCREEN_FROM_RIGHT(164.0f), HUD_STRETCH_Y(65.0f), sPrintIcon);
+ CFont::PrintString(HUD_FROM_RIGHT(164.0f), HUD_STRETCH_Y(65.0f), sPrintIcon);
}
}
}
@@ -458,18 +458,18 @@ void CHud::Draw() {
AsciiToUnicode(sTemp, sPrint);
CFont::SetColor(CRGBA(0, 0, 0, 255));
- CFont::PrintString(SCREEN_FROM_RIGHT(182.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrint);
+ CFont::PrintString(HUD_FROM_RIGHT(182.0f - 2.0f), HUD_STRETCH_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(SCREEN_FROM_RIGHT(234.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrintIcon);
+ CFont::PrintString(HUD_FROM_RIGHT(234.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrintIcon);
}
CFont::SetColor(CRGBA(124, 140, 95, 255));
- CFont::PrintString(SCREEN_FROM_RIGHT(182.0f), HUD_STRETCH_Y(65.0f), sPrint);
+ CFont::PrintString(HUD_FROM_RIGHT(182.0f), HUD_STRETCH_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(SCREEN_FROM_RIGHT(234.0f), HUD_STRETCH_Y(65.0f), sPrintIcon);
+ CFont::PrintString(HUD_FROM_RIGHT(234.0f), HUD_STRETCH_Y(65.0f), sPrintIcon);
}
}
}
@@ -489,13 +489,13 @@ void CHud::Draw() {
for (int i = 0; i < 6; i++) {
CFont::SetColor(CRGBA(0, 0, 0, 255));
- CFont::PrintString(2.0f + SCREEN_FROM_RIGHT(60.0f - 2.0f + 23.0f * i), HUD_STRETCH_Y(87.0f + 2.0f), sPrintIcon);
+ CFont::PrintString(2.0f + HUD_FROM_RIGHT(60.0f - 2.0f + 23.0f * i), HUD_STRETCH_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(SCREEN_FROM_RIGHT(60.0f + 23.0f * i), HUD_STRETCH_Y(87.0f), sPrintIcon);
+ CFont::PrintString(HUD_FROM_RIGHT(60.0f + 23.0f * i), HUD_STRETCH_Y(87.0f), sPrintIcon);
}
}
@@ -581,10 +581,10 @@ void CHud::Draw() {
CFont::SetBackGroundOnlyTextOff();
CFont::SetFontStyle(FONT_BANK);
CFont::SetColor(CRGBA(0, 0, 0, fZoneAlpha));
- CFont::PrintString(SCREEN_FROM_RIGHT(32.0f - 1.0f), SCREEN_FROM_BOTTOM(30.0f - 1.0f), CHud::m_ZoneToPrint);
+ CFont::PrintString(HUD_FROM_RIGHT(32.0f - 1.0f), HUD_FROM_BOTTOM(30.0f - 1.0f), CHud::m_ZoneToPrint);
CFont::SetColor(CRGBA(152, 154, 82, fZoneAlpha));
- CFont::PrintString(SCREEN_FROM_RIGHT(32.0f), SCREEN_FROM_BOTTOM(30.0f), CHud::m_ZoneToPrint);
+ CFont::PrintString(HUD_FROM_RIGHT(32.0f), HUD_FROM_BOTTOM(30.0f), CHud::m_ZoneToPrint);
}
}
}
@@ -677,10 +677,10 @@ void CHud::Draw() {
CFont::SetBackGroundOnlyTextOff();
CFont::SetFontStyle(FONT_BANK);
CFont::SetColor(CRGBA(0, 0, 0, fVehicleAlpha));
- CFont::PrintString(SCREEN_FROM_RIGHT(32.0f - 1.0f), SCREEN_FROM_BOTTOM(55.0f - 1.0f), CHud::m_pVehicleNameToPrint);
+ CFont::PrintString(HUD_FROM_RIGHT(32.0f - 1.0f), HUD_FROM_BOTTOM(55.0f - 1.0f), CHud::m_pVehicleNameToPrint);
CFont::SetColor(CRGBA(194, 165, 120, fVehicleAlpha));
- CFont::PrintString(SCREEN_FROM_RIGHT(32.0f), SCREEN_FROM_BOTTOM(55.0f), CHud::m_pVehicleNameToPrint);
+ CFont::PrintString(HUD_FROM_RIGHT(32.0f), HUD_FROM_BOTTOM(55.0f), CHud::m_pVehicleNameToPrint);
}
}
}
@@ -723,20 +723,20 @@ void CHud::Draw() {
CFont::SetPropOff();
CFont::SetBackGroundOnlyTextOn();
CFont::SetColor(CRGBA(0, 0, 0, 255));
- CFont::PrintString(SCREEN_FROM_RIGHT(27.0f - 2.0f), HUD_STRETCH_Y(110.0f + 2.0f), sTimer);
+ CFont::PrintString(HUD_FROM_RIGHT(27.0f - 2.0f), HUD_STRETCH_Y(110.0f + 2.0f), sTimer);
CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f));
CFont::SetColor(CRGBA(186, 101, 50, 255));
- CFont::PrintString(SCREEN_FROM_RIGHT(27.0f), HUD_STRETCH_Y(110.0f), sTimer);
+ CFont::PrintString(HUD_FROM_RIGHT(27.0f), HUD_STRETCH_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(SCREEN_FROM_RIGHT(27.0f + 78.0f), HUD_STRETCH_Y(110.0f + 2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText));
+ 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::SetColor(CRGBA(186, 101, 50, 255));
- CFont::PrintString(SCREEN_FROM_RIGHT(27.0f + 80.0f), HUD_STRETCH_Y(110.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText));
+ CFont::PrintString(HUD_FROM_RIGHT(27.0f + 80.0f), HUD_STRETCH_Y(110.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText));
}
}
}
@@ -753,8 +753,8 @@ void CHud::Draw() {
if (CTimer::GetFrameCounter() & 4 || !CounterFlashTimer) {
if (CUserDisplay::OnscnTimer.m_sEntries[0].m_nType) {
- CSprite2d::DrawRect(CRect(SCREEN_FROM_RIGHT(127.0f - 4.0f), HUD_STRETCH_Y(132.0 + 8.0f), SCREEN_FROM_RIGHT(23.0f), HUD_STRETCH_Y(11.0f + 132.0f + 8.0f)), CRGBA(0, 106, 164, 80));
- CSprite2d::DrawRect(CRect(SCREEN_FROM_RIGHT(127.0f + 4.0f), HUD_STRETCH_Y(132.0 + 8.0f), SCREEN_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(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));
}
else {
AsciiToUnicode(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer, sTimer);
@@ -771,10 +771,10 @@ void CHud::Draw() {
CFont::SetPropOff();
CFont::SetBackGroundOnlyTextOn();
CFont::SetColor(CRGBA(0, 0, 0, 255));
- CFont::PrintString(SCREEN_FROM_RIGHT(27.0f - 2.0f), HUD_STRETCH_Y(132.0f + 2.0f), sTimer);
+ CFont::PrintString(HUD_FROM_RIGHT(27.0f - 2.0f), HUD_STRETCH_Y(132.0f + 2.0f), sTimer);
CFont::SetColor(CRGBA(0, 106, 164, 255));
- CFont::PrintString(SCREEN_FROM_RIGHT(27.0f), HUD_STRETCH_Y(132.0f), sTimer);
+ CFont::PrintString(HUD_FROM_RIGHT(27.0f), HUD_STRETCH_Y(132.0f), sTimer);
}
if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText[0]) {
@@ -782,10 +782,10 @@ void CHud::Draw() {
CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f));
CFont::SetColor(CRGBA(0, 0, 0, 255));
- CFont::PrintString(SCREEN_FROM_RIGHT(27.0f + 59.0f), HUD_STRETCH_Y(132.0f + 2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText));
+ 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::SetColor(CRGBA(0, 106, 164, 255));
- CFont::PrintString(SCREEN_FROM_RIGHT(27.0f + 61.0f), HUD_STRETCH_Y(132.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText));
+ CFont::PrintString(HUD_FROM_RIGHT(27.0f + 61.0f), HUD_STRETCH_Y(132.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText));
}
}
}
@@ -847,7 +847,7 @@ void CHud::Draw() {
*/
if (CHud::m_ItemToFlash == 8 && CTimer::GetFrameCounter() & 8 || CHud::m_ItemToFlash != 8) {
CRadar::DrawMap();
- CHud::Sprites[HUD_RADARDISC].Draw(CRect(HUD_STRETCH_X(16.0f), SCREEN_FROM_BOTTOM(123.0f + 4.0f), HUD_STRETCH_X(94.0f + 20.0f + 5.0f), SCREEN_FROM_BOTTOM(-76.0f + 123.0f - 6.0f)), CRGBA(0, 0, 0, 255));
+ 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));
CRadar::DrawBlips();
}
}
@@ -958,14 +958,14 @@ void CHud::Draw() {
CFont::SetFontStyle(FONT_BANK);
if (TheCamera.m_WideScreenOn)
- CFont::SetCentreSize(SCREEN_FROM_RIGHT(120.0f));
+ CFont::SetCentreSize(HUD_FROM_RIGHT(120.0f));
else
- CFont::SetCentreSize(SCREEN_FROM_RIGHT(280.0f));
+ CFont::SetCentreSize(HUD_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, SCREEN_FROM_BOTTOM(64.0f), CHud::m_Message);
+ CFont::PrintString(SCREEN_WIDTH / 2, HUD_FROM_BOTTOM(64.0f), CHud::m_Message);
CFont::SetDropShadowPosition(0);
}
@@ -1043,10 +1043,10 @@ void CHud::Draw() {
CFont::SetFontStyle(FONT_HEADING);
CFont::SetColor(CRGBA(0, 0, 0, 0.75f * BigMessageAlpha[2]));
- CFont::PrintString(SCREEN_FROM_RIGHT(20.0f + 4.0f), SCREEN_FROM_BOTTOM(78.0f), CHud::m_BigMessage[2]);
+ CFont::PrintString(HUD_FROM_RIGHT(20.0f + 4.0f), HUD_FROM_BOTTOM(78.0f), CHud::m_BigMessage[2]);
CFont::SetColor(CRGBA(170, 123, 87, BigMessageAlpha[2]));
- CFont::PrintString(SCREEN_FROM_RIGHT(20.0f), SCREEN_FROM_BOTTOM(82.0f), CHud::m_BigMessage[2]);
+ CFont::PrintString(HUD_FROM_RIGHT(20.0f), HUD_FROM_BOTTOM(82.0f), CHud::m_BigMessage[2]);
}
else {
BigMessageAlpha[2] = 0.0;
@@ -1230,7 +1230,7 @@ void CHud::DrawAfterFade() {
CFont::SetScale(HUD_STRETCH_X(1.0f), HUD_STRETCH_Y(1.2f));
CFont::SetCentreOn();
CFont::SetPropOn();
- CFont::SetCentreSize(SCREEN_FROM_RIGHT(20.0f));
+ CFont::SetCentreSize(HUD_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]);
@@ -1275,10 +1275,10 @@ void CHud::DrawAfterFade() {
BigMessageAlpha[1] = 255.0;
}
CFont::SetColor(CRGBA(40, 40, 40, BigMessageAlpha[1]));
- CFont::PrintString(SCREEN_FROM_RIGHT(20.0f - 2.0f), SCREEN_FROM_BOTTOM(120.0f), m_BigMessage[1]);
+ CFont::PrintString(HUD_FROM_RIGHT(20.0f - 2.0f), HUD_FROM_BOTTOM(120.0f), m_BigMessage[1]);
CFont::SetColor(CRGBA(220, 172, 2, BigMessageAlpha[1]));
- CFont::PrintString(SCREEN_FROM_RIGHT(20.0f), SCREEN_FROM_BOTTOM(120.0f), m_BigMessage[1]);
+ CFont::PrintString(HUD_FROM_RIGHT(20.0f), HUD_FROM_BOTTOM(120.0f), m_BigMessage[1]);
}
else {
BigMessageAlpha[1] = 0.0;