From ad3834bcc65fc06d5ca0233c96eae90fad48a2c0 Mon Sep 17 00:00:00 2001 From: opencode Date: Mon, 30 Nov 2026 17:39:37 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20HUD=20rework=20review=20fixes=20?= =?UTF-8?q?=E2=80=94=20F10=20toggle,=20mission=20entity=20blips,=20clock?= =?UTF-8?q?=20inset,=20docs=20(issue=20#33)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/config.h | 2 +- src/core/re3.cpp | 7 +++++++ src/renderer/Hud.cpp | 32 ++++++++++++++++++++------------ 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/core/config.h b/src/core/config.h index 1542ac56..e215a689 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -342,7 +342,7 @@ enum Config { // Hud, frontend and radar //#define PS2_HUD -//#define HUD_REWORK // dynamic HUD (issue #33): vehicle-only minimap (F12 toggle), top-right clock, health/armour bars, money fade, aim-only crosshair +//#define HUD_REWORK // dynamic HUD (issue #33): vehicle-only minimap (F10 toggle), top-right clock, health/armour bars, money fade, aim-only crosshair #define HUD_ENHANCEMENTS // Adjusts some aspects to make the HUD look/behave a little bit better. // #define BETA_SLIDING_TEXT #define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC diff --git a/src/core/re3.cpp b/src/core/re3.cpp index c5aabab0..54dbf7c8 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -945,6 +945,13 @@ DebugMenuPopulate(void) false; #endif DebugMenuAddVarBool8ReadOnly("Gameplay", "Third-person rifle", &bThirdPersonRifle); + static bool bHudRework = +#ifdef HUD_REWORK + true; +#else + false; +#endif + DebugMenuAddVarBool8ReadOnly("Gameplay", "HUD rework (F10)", &bHudRework); static int spawnCarId = MI_LANDSTAL; e = DebugMenuAddVar("Spawn", "Spawn Car ID", &spawnCarId, nil, 1, MI_LANDSTAL, MI_GHOST, carnames); diff --git a/src/renderer/Hud.cpp b/src/renderer/Hud.cpp index 65055b3e..d5c46064 100644 --- a/src/renderer/Hud.cpp +++ b/src/renderer/Hud.cpp @@ -104,19 +104,20 @@ CRGBA MISSIONTITLE_COLOR(220, 172, 2, 255); #ifdef HUD_REWORK /* Dynamic HUD rework (issue #33). Everything below is custom behaviour compiled - only when HUD_REWORK is defined. The minimap visibility toggle is F12. + only when HUD_REWORK is defined. The minimap visibility toggle is F10. */ #define HUD_REWORK_BAR_HOLD_MS 4000 // health/armour bars stay opaque this long after a change #define HUD_REWORK_MONEY_HOLD_MS 3000 // money stays solid this long after a change #define HUD_REWORK_FADE_MS 1000 // shared fade-out duration for the widgets above #define HUD_REWORK_MONEY_IDLE_ALPHA 110.0f // money alpha while nothing is happening #define HUD_REWORK_BAR_HEIGHT 5.0f +#define HUD_REWORK_MAX_HEALTH_ARMOUR 100.0f // health/armour are always 0..100 #define HUD_REWORK_HEALTH_Y 30.0f // from bottom, just below the radar #define HUD_REWORK_ARMOUR_Y 22.0f -#define HUD_REWORK_CLOCK_X 40.0f // top-right clock inset from the right edge +#define HUD_REWORK_CLOCK_X 111.0f // top-right, left of the weapon icon (vanilla inset) #define HUD_REWORK_MONEY_X 30.0f // top-left money inset from the left edge -#define HUD_REWORK_MONEY_Y 20.0f -#define HUD_REWORK_TOGGLE_FKEY 11 // F12 +#define HUD_REWORK_MONEY_Y 20.0f // transient pager/help overlays may briefly cover it, by design +#define HUD_REWORK_TOGGLE_FKEY 9 // F10 static bool ms_bRadarEnabled = true; static float ms_fLastHealth = -1.0f; @@ -175,18 +176,25 @@ HUD_TrackMoney(int32 money) } } -// The minimap is a driving aid: it only shows in a vehicle, unless the player -// re-enabled it with F12 or a waypoint/mission blip is active. The latter always -// wins so navigation is never hidden. +// The minimap is a driving aid: it only shows while the player is in a vehicle, +// and F10 toggles that in-vehicle display on or off. A waypoint or any visible +// blip (mission marker, mission target) forces it on regardless, so navigation +// is never hidden. static bool HUD_RadarShouldBeVisible() { int32 i; + sRadarTrace *pTrace; for (i = 0; i < NUMRADARBLIPS; i++) { - if (CRadar::ms_RadarTrace[i].m_bInUse - && (CRadar::ms_RadarTrace[i].m_eBlipType == BLIP_COORD - || CRadar::ms_RadarTrace[i].m_eBlipType == BLIP_CONTACT_POINT)) + pTrace = &CRadar::ms_RadarTrace[i]; + if (pTrace->m_bInUse + && pTrace->m_eBlipDisplay != BLIP_DISPLAY_NEITHER + && (pTrace->m_eBlipType == BLIP_CAR + || pTrace->m_eBlipType == BLIP_CHAR + || pTrace->m_eBlipType == BLIP_OBJECT + || pTrace->m_eBlipType == BLIP_COORD + || pTrace->m_eBlipType == BLIP_CONTACT_POINT)) return true; } @@ -223,10 +231,10 @@ HUD_DrawHealthArmourBars() HUD_TrackFloat(FindPlayerPed()->m_fArmour, &ms_fLastArmour, &ms_nArmourChangeTime); HUD_DrawBar(x, SCREEN_SCALE_FROM_BOTTOM(HUD_REWORK_HEALTH_Y), width, height, - FindPlayerPed()->m_fHealth, 100.0f, HEALTH_COLOR, + FindPlayerPed()->m_fHealth, HUD_REWORK_MAX_HEALTH_ARMOUR, HEALTH_COLOR, HUD_ChangeAlpha(ms_nHealthChangeTime, HUD_REWORK_BAR_HOLD_MS, 0.0f)); HUD_DrawBar(x, SCREEN_SCALE_FROM_BOTTOM(HUD_REWORK_ARMOUR_Y), width, height, - FindPlayerPed()->m_fArmour, 100.0f, ARMOUR_COLOR, + FindPlayerPed()->m_fArmour, HUD_REWORK_MAX_HEALTH_ARMOUR, ARMOUR_COLOR, HUD_ChangeAlpha(ms_nArmourChangeTime, HUD_REWORK_BAR_HOLD_MS, 0.0f)); } #endif // HUD_REWORK