fix: HUD rework review fixes — F10 toggle, mission entity blips, clock inset, docs (issue #33)
linux / build (push) Canceled after 12m9s

This commit is contained in:
2026-11-30 17:39:37 +00:00
parent 34d09a6b08
commit ad3834bcc6
3 changed files with 28 additions and 13 deletions
+1 -1
View File
@@ -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
+7
View File
@@ -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);
+20 -12
View File
@@ -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