mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-07-16 07:18:02 +08:00
feat(hud): Add force show HUD component and replaced some hard-coded values. (#628)
This commit is contained in:
@ -1,16 +1,18 @@
|
||||
#include "backend/looped/looped.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "core/data/hud_component_names.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
namespace big
|
||||
{
|
||||
static bool bLastHideRadar = false;
|
||||
static bool bHasHUDBeenHidden = false;
|
||||
|
||||
void looped::self_hud()
|
||||
{
|
||||
const bool bHideRadar = g->self.hide_radar;
|
||||
const bool bHideAmmo = g->self.hide_ammo;
|
||||
const bool bForceShowElement = g->self.force_show_hud_element;
|
||||
const bool bForceShowHUD = g->self.force_show_hud;
|
||||
auto& bHudComponents = g->self.hud_components_states;
|
||||
|
||||
if (bHideRadar)
|
||||
@ -28,6 +30,11 @@ namespace big
|
||||
HUD::DISPLAY_AMMO_THIS_FRAME(false);
|
||||
}
|
||||
|
||||
if (bForceShowHUD) {
|
||||
HUD::DISPLAY_HUD_WHEN_NOT_IN_STATE_OF_PLAY_THIS_FRAME();
|
||||
HUD::DISPLAY_HUD_WHEN_PAUSED_THIS_FRAME();
|
||||
}
|
||||
|
||||
if (
|
||||
std::all_of(
|
||||
std::begin(bHudComponents),
|
||||
@ -36,14 +43,22 @@ namespace big
|
||||
)
|
||||
) {
|
||||
HUD::DISPLAY_HUD(false);
|
||||
bHasHUDBeenHidden = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
HUD::DISPLAY_HUD(true);
|
||||
for (int i = 0; i < (int)HudComponents::HUD_WEAPONS; i++)
|
||||
bHasHUDBeenHidden = false;
|
||||
}
|
||||
|
||||
if (!bHasHUDBeenHidden)
|
||||
{
|
||||
for (int i = 0; i < static_cast<int>(HudComponents::HUD_WEAPONS); i++)
|
||||
{
|
||||
if (bHudComponents[i])
|
||||
HUD::HIDE_HUD_COMPONENT_THIS_FRAME(i + 1);
|
||||
else if (!bHudComponents[i] && bForceShowElement)
|
||||
HUD::SHOW_HUD_COMPONENT_THIS_FRAME(i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,13 @@
|
||||
#include "backend/looped/looped.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "core/enums.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void looped::weapons_force_crosshairs()
|
||||
{
|
||||
if (g->weapons.force_crosshairs) {
|
||||
HUD::SHOW_HUD_COMPONENT_THIS_FRAME(14 /*RETICLE*/);
|
||||
HUD::SHOW_HUD_COMPONENT_THIS_FRAME(static_cast<int>(HudComponents::RETICLE));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user