From a82a18d8a7c6a5e1a7d6cf3ccd964fcc69e8df78 Mon Sep 17 00:00:00 2001 From: Federico Romero Date: Thu, 11 Jun 2026 23:47:46 -0300 Subject: [PATCH 1/2] Add radar_disc, radar_horizon and radar_airstrip_blip HUD components Allows hiding the radar's black circular border (#4850), the aircraft tilt indicators shown while flying (rotating ring + green attitude band), and the airstrip blip placed on the radar near runways, via setPlayerHudComponentVisible. --- Client/game_sa/CHudSA.cpp | 15 +++++++++++- Client/game_sa/CHudSA.h | 23 +++++++++++++++++-- .../logic/lua/CLuaFunctionParseHelpers.cpp | 3 +++ Client/sdk/game/CHud.h | 3 +++ .../logic/lua/CLuaFunctionParseHelpers.cpp | 3 +++ .../logic/lua/CLuaFunctionParseHelpers.h | 3 +++ 6 files changed, 47 insertions(+), 3 deletions(-) diff --git a/Client/game_sa/CHudSA.cpp b/Client/game_sa/CHudSA.cpp index a1d56313d04..2d91a6ec78f 100644 --- a/Client/game_sa/CHudSA.cpp +++ b/Client/game_sa/CHudSA.cpp @@ -133,6 +133,9 @@ void CHudSA::InitComponentList() {1, HUD_RADAR_MAP, 1, FUNC_CRadar_DrawRadarMap, 1, 0xCC, 0xC3}, {1, HUD_RADAR_BLIPS, 1, FUNC_CRadar_DrawBlips, 1, 0xCC, 0xC3}, {1, HUD_RADAR_ALTIMETER, 1, CODE_ShowRadarAltimeter, 2, 0xCC, 0xEB30}, + {1, HUD_RADAR_DISC, 1, CODE_ShowRadarDisc, 5, 0xCC, HudMakeRelativeJump(CODE_ShowRadarDisc, CODE_DrawRadarBlipsPart)}, + {1, HUD_RADAR_HORIZON, 1, CODE_ShowRadarHorizon, 2, 0xCC, 0xE990, CODE_ShowRadarMapHorizon, 2, 0xCC, 0xE990}, + {1, HUD_RADAR_AIRSTRIP_BLIP, 1, CODE_ShowRadarAirstripBlip, 2, 0xCC, 0xE990}, {1, HUD_CLOCK, 0, VAR_DisableClock, 1, 1, 0}, {1, HUD_RADIO, 1, FUNC_DrawRadioName, 1, 0xCC, 0xC3}, {1, HUD_WANTED, 1, FUNC_DrawWantedLevel, 1, 0xCC, 0xC3}, @@ -172,7 +175,9 @@ void CHudSA::SetComponentVisible(eHudComponent component, bool bVisible) // Save original bytes if required if (pComponent->bSaveOriginalBytes) { - pComponent->origData = *(DWORD*)pComponent->uiDataAddr; + pComponent->origData = *(std::uint64_t*)pComponent->uiDataAddr; + if (pComponent->uiDataSize2 > 0) + pComponent->origData2 = *(std::uint64_t*)pComponent->uiDataAddr2; pComponent->bSaveOriginalBytes = false; } @@ -186,6 +191,14 @@ void CHudSA::SetComponentVisible(eHudComponent component, bool bVisible) else MemPutFast(pDest + i, pSrc[i]); } + + if (pComponent->uiDataSize2 > 0) + { + uchar* pSrc2 = (uchar*)(bVisible ? &pComponent->origData2 : &pComponent->disabledData2); + uchar* pDest2 = (uchar*)(pComponent->uiDataAddr2); + for (uint i = 0; i < pComponent->uiDataSize2; i++) + MemPut(pDest2 + i, pSrc2[i]); + } } } diff --git a/Client/game_sa/CHudSA.h b/Client/game_sa/CHudSA.h index 55c956c764a..a0a9a024d9d 100644 --- a/Client/game_sa/CHudSA.h +++ b/Client/game_sa/CHudSA.h @@ -55,6 +55,12 @@ #define CODE_ShowMoney 0x58F47D #define CODE_ShowRadarAltimeter 0x58A5A6 +#define CODE_ShowRadarHorizon 0x58A3C5 +#define CODE_ShowRadarMapHorizon 0x5869D2 +#define CODE_ShowRadarDisc 0x58A782 +#define CODE_DrawRadarBlipsPart 0x58AA2A +#define CODE_ShowRadarAirstripBlip 0x587D35 + #define VAR_CTheScripts_bDrawCrossHair 0xA44490 #define VAR_RSGlobal 0xC17040 #define VAR_ItemToFlash 0xBAB1DC @@ -66,10 +72,23 @@ struct SHudComponent bool bSaveOriginalBytes; DWORD uiDataAddr; DWORD uiDataSize; - DWORD origData; - DWORD disabledData; + std::uint64_t origData; + std::uint64_t disabledData; + + // Second patch location, only used if uiDataSize2 > 0 + DWORD uiDataAddr2{0}; + DWORD uiDataSize2{0}; + std::uint64_t origData2{0}; + std::uint64_t disabledData2{0}; }; +constexpr std::uint64_t HudMakeRelativeJump(std::uint32_t uiFrom, std::uint32_t uiTo) +{ + constexpr std::uint32_t uiJumpInstructionSize = 5; + const std::uint32_t uiRelativeOffset = uiTo - (uiFrom + uiJumpInstructionSize); + return 0xE9 | (static_cast(uiRelativeOffset) << 8); +} + enum class eHudColour { RED, diff --git a/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp b/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp index 7ae83f8bfbb..20c98af9674 100644 --- a/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp +++ b/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp @@ -107,6 +107,9 @@ ADD_ENUM(HUD_RADAR, "radar") ADD_ENUM(HUD_RADAR_MAP, "radar_map") ADD_ENUM(HUD_RADAR_BLIPS, "radar_blips") ADD_ENUM(HUD_RADAR_ALTIMETER, "radar_altimeter") +ADD_ENUM(HUD_RADAR_DISC, "radar_disc") +ADD_ENUM(HUD_RADAR_HORIZON, "radar_horizon") +ADD_ENUM(HUD_RADAR_AIRSTRIP_BLIP, "radar_airstrip_blip") ADD_ENUM(HUD_CLOCK, "clock") ADD_ENUM(HUD_RADIO, "radio") ADD_ENUM(HUD_WANTED, "wanted") diff --git a/Client/sdk/game/CHud.h b/Client/sdk/game/CHud.h index da95656daf9..cb688b017eb 100644 --- a/Client/sdk/game/CHud.h +++ b/Client/sdk/game/CHud.h @@ -34,6 +34,9 @@ enum eHudComponent HUD_RADAR_MAP, HUD_RADAR_BLIPS, HUD_RADAR_ALTIMETER, + HUD_RADAR_DISC, + HUD_RADAR_HORIZON, + HUD_RADAR_AIRSTRIP_BLIP, }; enum class eHudComponentProperty diff --git a/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp b/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp index ffe4133f790..adeb9dc5a00 100644 --- a/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp +++ b/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp @@ -81,6 +81,9 @@ ADD_ENUM(HUD_RADAR, "radar") ADD_ENUM(HUD_RADAR_MAP, "radar_map") ADD_ENUM(HUD_RADAR_BLIPS, "radar_blips") ADD_ENUM(HUD_RADAR_ALTIMETER, "radar_altimeter") +ADD_ENUM(HUD_RADAR_DISC, "radar_disc") +ADD_ENUM(HUD_RADAR_HORIZON, "radar_horizon") +ADD_ENUM(HUD_RADAR_AIRSTRIP_BLIP, "radar_airstrip_blip") ADD_ENUM(HUD_CLOCK, "clock") ADD_ENUM(HUD_RADIO, "radio") ADD_ENUM(HUD_WANTED, "wanted") diff --git a/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h b/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h index 1d5bc7feee7..73a41dfa943 100644 --- a/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h +++ b/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h @@ -61,6 +61,9 @@ enum eHudComponent HUD_RADAR_MAP, HUD_RADAR_BLIPS, HUD_RADAR_ALTIMETER, + HUD_RADAR_DISC, + HUD_RADAR_HORIZON, + HUD_RADAR_AIRSTRIP_BLIP, }; DECLARE_ENUM(eHudComponent); From 884c6870d9802086d67cf3843e4053af79c023e5 Mon Sep 17 00:00:00 2001 From: Federico Romero Date: Fri, 12 Jun 2026 00:04:39 -0300 Subject: [PATCH 2/2] Add sniper_background HUD component Allows hiding the black letterbox/zoom-box overlay drawn around the screen while aiming the sniper rifle in scope mode, independently of the crosshair, via setPlayerHudComponentVisible (#3962). --- Client/game_sa/CHudSA.cpp | 1 + Client/game_sa/CHudSA.h | 2 ++ Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp | 1 + Client/sdk/game/CHud.h | 1 + Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp | 1 + Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h | 1 + 6 files changed, 7 insertions(+) diff --git a/Client/game_sa/CHudSA.cpp b/Client/game_sa/CHudSA.cpp index 2d91a6ec78f..4f6355088f2 100644 --- a/Client/game_sa/CHudSA.cpp +++ b/Client/game_sa/CHudSA.cpp @@ -136,6 +136,7 @@ void CHudSA::InitComponentList() {1, HUD_RADAR_DISC, 1, CODE_ShowRadarDisc, 5, 0xCC, HudMakeRelativeJump(CODE_ShowRadarDisc, CODE_DrawRadarBlipsPart)}, {1, HUD_RADAR_HORIZON, 1, CODE_ShowRadarHorizon, 2, 0xCC, 0xE990, CODE_ShowRadarMapHorizon, 2, 0xCC, 0xE990}, {1, HUD_RADAR_AIRSTRIP_BLIP, 1, CODE_ShowRadarAirstripBlip, 2, 0xCC, 0xE990}, + {1, HUD_SNIPER_BACKGROUND, 1, CODE_ShowSniperBackground, 1, 0xCC, 0xFF}, {1, HUD_CLOCK, 0, VAR_DisableClock, 1, 1, 0}, {1, HUD_RADIO, 1, FUNC_DrawRadioName, 1, 0xCC, 0xC3}, {1, HUD_WANTED, 1, FUNC_DrawWantedLevel, 1, 0xCC, 0xC3}, diff --git a/Client/game_sa/CHudSA.h b/Client/game_sa/CHudSA.h index a0a9a024d9d..a5cbf0b919b 100644 --- a/Client/game_sa/CHudSA.h +++ b/Client/game_sa/CHudSA.h @@ -61,6 +61,8 @@ #define CODE_DrawRadarBlipsPart 0x58AA2A #define CODE_ShowRadarAirstripBlip 0x587D35 +#define CODE_ShowSniperBackground 0x53E31D + #define VAR_CTheScripts_bDrawCrossHair 0xA44490 #define VAR_RSGlobal 0xC17040 #define VAR_ItemToFlash 0xBAB1DC diff --git a/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp b/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp index 20c98af9674..60ccbc52975 100644 --- a/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp +++ b/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp @@ -110,6 +110,7 @@ ADD_ENUM(HUD_RADAR_ALTIMETER, "radar_altimeter") ADD_ENUM(HUD_RADAR_DISC, "radar_disc") ADD_ENUM(HUD_RADAR_HORIZON, "radar_horizon") ADD_ENUM(HUD_RADAR_AIRSTRIP_BLIP, "radar_airstrip_blip") +ADD_ENUM(HUD_SNIPER_BACKGROUND, "sniper_background") ADD_ENUM(HUD_CLOCK, "clock") ADD_ENUM(HUD_RADIO, "radio") ADD_ENUM(HUD_WANTED, "wanted") diff --git a/Client/sdk/game/CHud.h b/Client/sdk/game/CHud.h index cb688b017eb..df2a82b83b7 100644 --- a/Client/sdk/game/CHud.h +++ b/Client/sdk/game/CHud.h @@ -37,6 +37,7 @@ enum eHudComponent HUD_RADAR_DISC, HUD_RADAR_HORIZON, HUD_RADAR_AIRSTRIP_BLIP, + HUD_SNIPER_BACKGROUND, }; enum class eHudComponentProperty diff --git a/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp b/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp index adeb9dc5a00..01af89776bd 100644 --- a/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp +++ b/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp @@ -84,6 +84,7 @@ ADD_ENUM(HUD_RADAR_ALTIMETER, "radar_altimeter") ADD_ENUM(HUD_RADAR_DISC, "radar_disc") ADD_ENUM(HUD_RADAR_HORIZON, "radar_horizon") ADD_ENUM(HUD_RADAR_AIRSTRIP_BLIP, "radar_airstrip_blip") +ADD_ENUM(HUD_SNIPER_BACKGROUND, "sniper_background") ADD_ENUM(HUD_CLOCK, "clock") ADD_ENUM(HUD_RADIO, "radio") ADD_ENUM(HUD_WANTED, "wanted") diff --git a/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h b/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h index 73a41dfa943..8d053eb539a 100644 --- a/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h +++ b/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h @@ -64,6 +64,7 @@ enum eHudComponent HUD_RADAR_DISC, HUD_RADAR_HORIZON, HUD_RADAR_AIRSTRIP_BLIP, + HUD_SNIPER_BACKGROUND, }; DECLARE_ENUM(eHudComponent);