summaryrefslogtreecommitdiffstats
path: root/src/render/Hud.cpp
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-04-26 21:03:15 +0200
committerSergeanur <s.anureev@yandex.ua>2020-04-26 21:03:15 +0200
commitf0890b11122291a22d6a65f349281cf1aed49bd0 (patch)
tree3b418b522c5fd097abac916693e59808ea4f5b4f /src/render/Hud.cpp
parentMore japanese (diff)
parentRemove little hack (diff)
downloadre3-f0890b11122291a22d6a65f349281cf1aed49bd0.tar
re3-f0890b11122291a22d6a65f349281cf1aed49bd0.tar.gz
re3-f0890b11122291a22d6a65f349281cf1aed49bd0.tar.bz2
re3-f0890b11122291a22d6a65f349281cf1aed49bd0.tar.lz
re3-f0890b11122291a22d6a65f349281cf1aed49bd0.tar.xz
re3-f0890b11122291a22d6a65f349281cf1aed49bd0.tar.zst
re3-f0890b11122291a22d6a65f349281cf1aed49bd0.zip
Diffstat (limited to 'src/render/Hud.cpp')
-rw-r--r--src/render/Hud.cpp125
1 files changed, 62 insertions, 63 deletions
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index a2db6640..a2a74109 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -1,5 +1,5 @@
#include "common.h"
-#include "patcher.h"
+
#include "Camera.h"
#include "DMAudio.h"
#include "Clock.h"
@@ -21,52 +21,52 @@
#include "User.h"
#include "World.h"
-wchar CHud::m_HelpMessage[256]; // = (wchar*)0x86B888;
-wchar CHud::m_LastHelpMessage[256]; // = (wchar*)0x6E8F28;
-uint32 CHud::m_HelpMessageState; // = *(int32*)0x880E1C;
-uint32 CHud::m_HelpMessageTimer; // = *(int32*)0x880FA4;
-int32 CHud::m_HelpMessageFadeTimer; // = *(int32*)0x8F6258;
-wchar CHud::m_HelpMessageToPrint[256]; // = (wchar*)0x664480;
-float CHud::m_fHelpMessageTime; // *(float *)0x8E2C28;
-bool CHud::m_HelpMessageQuick; // = *(bool*)0x95CCF7;
-uint32 CHud::m_ZoneState; // = *(int32*)0x8F29AC;
+wchar CHud::m_HelpMessage[256];
+wchar CHud::m_LastHelpMessage[256];
+uint32 CHud::m_HelpMessageState;
+uint32 CHud::m_HelpMessageTimer;
+int32 CHud::m_HelpMessageFadeTimer;
+wchar CHud::m_HelpMessageToPrint[256];
+float CHud::m_fHelpMessageTime;
+bool CHud::m_HelpMessageQuick;
+uint32 CHud::m_ZoneState;
int32 CHud::m_ZoneFadeTimer;
-uint32 CHud::m_ZoneNameTimer; // = *(int32*)0x8F1A50;
-wchar *CHud::m_pZoneName; // = *(wchar**)0x8E2C2C;
-wchar *CHud::m_pLastZoneName; // = (wchar*)0x8F432C;
+uint32 CHud::m_ZoneNameTimer;
+wchar *CHud::m_pZoneName;
+wchar *CHud::m_pLastZoneName;
wchar *CHud::m_ZoneToPrint;
-uint32 CHud::m_VehicleState; // = *(int32*)0x940560;
+uint32 CHud::m_VehicleState;
int32 CHud::m_VehicleFadeTimer;
-uint32 CHud::m_VehicleNameTimer; // = *(int32*)0x8F2A14;
-wchar *CHud::m_VehicleName; // = *(wchar**)0x942FB4;
-wchar *CHud::m_pLastVehicleName; // = *(wchar**)0x8E2DD8;
+uint32 CHud::m_VehicleNameTimer;
+wchar *CHud::m_VehicleName;
+wchar *CHud::m_pLastVehicleName;
wchar *CHud::m_pVehicleNameToPrint;
-wchar CHud::m_Message[256];// = (wchar*)0x72E318;
-wchar CHud::m_PagerMessage[256]; // = (wchar*)0x878840;
-bool CHud::m_Wants_To_Draw_Hud; // (bool*)0x95CD89;
-bool CHud::m_Wants_To_Draw_3dMarkers; // = *(bool*)0x95CD62;
-wchar CHud::m_BigMessage[6][128]; // = *(wchar(*)[6][128]) * (uintptr*)0x664CE0;
-int16 CHud::m_ItemToFlash; // = *(int16*)0x95CC82;
+wchar CHud::m_Message[256];
+wchar CHud::m_PagerMessage[256];
+bool CHud::m_Wants_To_Draw_Hud;
+bool CHud::m_Wants_To_Draw_3dMarkers;
+wchar CHud::m_BigMessage[6][128];
+int16 CHud::m_ItemToFlash;
// These aren't really in CHud
float CHud::BigMessageInUse[6];
float CHud::BigMessageAlpha[6];
float CHud::BigMessageX[6];
-float CHud::OddJob2OffTimer; // = *(float*)0x942FA0;
-bool CHud::CounterOnLastFrame; // = *(int8*)0x95CD67;
-float CHud::OddJob2XOffset; // = *(float*)0x8F1B5C;
-uint16 CHud::CounterFlashTimer; // = *(int16*)0x95CC20;
-uint16 CHud::OddJob2Timer; // = *(int16*)0x95CC52;
-bool CHud::TimerOnLastFrame; //= *(int8*)0x95CDA7;
-int16 CHud::OddJob2On; //= *(int16*)0x95CC78;
-uint16 CHud::TimerFlashTimer; //= *(int16*)0x95CC6C;
-int16 CHud::PagerSoundPlayed; //= *(int16*)0x95CC4A;
-int32 CHud::SpriteBrightness; //= *(int32*)0x95CC54;
-float CHud::PagerXOffset; //= *(float*)0x941590;
-int16 CHud::PagerTimer; //= *(int16*)0x95CC3A;
-int16 CHud::PagerOn; //= *(int16*)0x95CCA0;
-
-CSprite2d CHud::Sprites[NUM_HUD_SPRITES]; // = (CSprite2d*)0x95CB9C;
+float CHud::OddJob2OffTimer;
+bool CHud::CounterOnLastFrame;
+float CHud::OddJob2XOffset;
+uint16 CHud::CounterFlashTimer;
+uint16 CHud::OddJob2Timer;
+bool CHud::TimerOnLastFrame;
+int16 CHud::OddJob2On;
+uint16 CHud::TimerFlashTimer;
+int16 CHud::PagerSoundPlayed;
+int32 CHud::SpriteBrightness;
+float CHud::PagerXOffset;
+int16 CHud::PagerTimer;
+int16 CHud::PagerOn;
+
+CSprite2d CHud::Sprites[NUM_HUD_SPRITES];
struct
{
@@ -98,8 +98,8 @@ struct
{"siterocket", "siterocket"}
};
-RwTexture *&gpSniperSightTex = *(RwTexture**)0x8F5834;
-RwTexture *&gpRocketSightTex = *(RwTexture**)0x8E2C20;
+RwTexture *gpSniperSightTex;
+RwTexture *gpRocketSightTex;
void CHud::Draw()
{
@@ -136,7 +136,7 @@ void CHud::Draw()
if (DrawCrossHair || DrawCrossHairPC) {
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void *)rwFILTERLINEAR);
- SpriteBrightness = min(SpriteBrightness+1, 30);
+ SpriteBrightness = Min(SpriteBrightness+1, 30);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
@@ -144,12 +144,10 @@ void CHud::Draw()
float fMultBright = SpriteBrightness * 0.03f * (0.25f * fStep + 0.75f);
CRect rect;
if (DrawCrossHairPC && TheCamera.Cams[TheCamera.ActiveCam].Using3rdPersonMouseCam()) {
-#ifndef ASPECT_RATIO_SCALE
float f3rdX = SCREEN_WIDTH * TheCamera.m_f3rdPersonCHairMultX;
float f3rdY = SCREEN_HEIGHT * TheCamera.m_f3rdPersonCHairMultY;
-#else
- float f3rdX = (((TheCamera.m_f3rdPersonCHairMultX - 0.5f) / ((CDraw::GetAspectRatio()) / (DEFAULT_ASPECT_RATIO))) + 0.5f) * SCREEN_WIDTH;
- float f3rdY = SCREEN_HEIGHT * TheCamera.m_f3rdPersonCHairMultY + SCREEN_SCALE_Y(-2.0f);
+#ifdef ASPECT_RATIO_SCALE
+ f3rdY -= SCREEN_SCALE_Y(2.0f);
#endif
if (FindPlayerPed() && WeaponType == WEAPONTYPE_M16) {
rect.left = f3rdX - SCREEN_SCALE_X(32.0f * 0.6f);
@@ -475,7 +473,12 @@ void CHud::Draw()
break;
}
+
+#ifndef HUD_ENHANCEMENTS
if (!m_Message[0]) {
+#else
+ if (!m_Message[0] && !m_BigMessage[2][0]) { // Hide zone name if wasted/busted text is displaying
+#endif
m_ZoneNameTimer += CTimer::GetTimeStepInMilliseconds();
CFont::SetJustifyOff();
CFont::SetPropOn();
@@ -565,7 +568,11 @@ void CHud::Draw()
break;
}
+#ifndef HUD_ENHANCEMENTS
if (!m_Message[0]) {
+#else
+ if (!m_Message[0] && !m_BigMessage[2][0]) { // Hide vehicle name if wasted/busted text is displaying
+#endif
m_VehicleNameTimer += CTimer::GetTimeStepInMilliseconds();
CFont::SetJustifyOff();
CFont::SetPropOn();
@@ -708,7 +715,7 @@ void CHud::Draw()
} else {
int counter = atoi(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer);
#ifdef FIX_BUGS
- counter = min(counter, 100);
+ counter = Min(counter, 100);
#endif
CSprite2d::DrawRect(CRect(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2 + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(8.0f), SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(11.0f) + SCREEN_SCALE_Y(8.0f)), CRGBA(0, 106, 164, 80));
CSprite2d::DrawRect(CRect(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2 + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(8.0f), SCREEN_SCALE_X(counter) / 2.0f + SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET + 50.0f) + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(11.0f) + SCREEN_SCALE_Y(8.0f)), CRGBA(0, 106, 164, 255));
@@ -1204,7 +1211,7 @@ void CHud::DrawAfterFade()
OddJob2On = 2;
}
else {
- fStep = min(40.0f, OddJob2XOffset / 6.0f);
+ fStep = Min(40.0f, OddJob2XOffset / 6.0f);
OddJob2XOffset = OddJob2XOffset - fStep;
}
break;
@@ -1215,7 +1222,7 @@ void CHud::DrawAfterFade()
}
break;
case 3:
- fStep = max(30.0f, OddJob2XOffset / 5.0f);
+ fStep = Max(30.0f, OddJob2XOffset / 5.0f);
OddJob2XOffset = OddJob2XOffset - fStep;
@@ -1238,10 +1245,17 @@ void CHud::DrawAfterFade()
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::SetFontStyle(FONTJAP(FONT_BANK));
+#ifdef BETA_SLIDING_TEXT
+ CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f) - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[5]);
+
+ CFont::SetColor(CRGBA(156, 91, 40, 255));
+ CFont::PrintString(SCREEN_WIDTH / 2 - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f), m_BigMessage[5]);
+#else
CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[5]);
CFont::SetColor(CRGBA(156, 91, 40, 255));
CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f), m_BigMessage[5]);
+#endif
}
}
@@ -1490,18 +1504,3 @@ void CHud::Shutdown()
int HudTXD = CTxdStore::FindTxdSlot("hud");
CTxdStore::RemoveTxdSlot(HudTXD);
}
-
-STARTPATCHES
- InjectHook(0x5052A0, &CHud::Draw, PATCH_JUMP);
- InjectHook(0x509030, &CHud::DrawAfterFade, PATCH_JUMP);
- InjectHook(0x504F90, &CHud::GetRidOfAllHudMessages, PATCH_JUMP);
- InjectHook(0x5048F0, &CHud::Initialise, PATCH_JUMP);
- InjectHook(0x504CC0, &CHud::ReInitialise, PATCH_JUMP);
- InjectHook(0x50A250, &CHud::SetBigMessage, PATCH_JUMP);
- InjectHook(0x5051E0, &CHud::SetHelpMessage, PATCH_JUMP);
- InjectHook(0x50A210, &CHud::SetMessage, PATCH_JUMP);
- InjectHook(0x50A320, &CHud::SetPagerMessage, PATCH_JUMP);
- InjectHook(0x505290, &CHud::SetVehicleName, PATCH_JUMP);
- InjectHook(0x5051D0, &CHud::SetZoneName, PATCH_JUMP);
- InjectHook(0x504C50, &CHud::Shutdown, PATCH_JUMP);
-ENDPATCHES