From 7f5bf2ab8e3af9002829ada72540abfb04e4dc52 Mon Sep 17 00:00:00 2001 From: nullsystem <15316579+nullsystem@users.noreply.github.com> Date: Sun, 30 Jun 2024 12:24:33 +0100 Subject: [PATCH] Partial fix HUD, fix timer and fix hud name * The hud names are all wrong due to macro trip-ups, they're now renamed to the actual one * During client-side spawning, reset the timer to 0 and slightly tweak the conditionals so it works properly on next map again. --- mp/src/game/client/hl2mp/hl2mp_hud_target_id.cpp | 2 +- mp/src/game/client/neo/c_neo_player.cpp | 11 ++++++++++- mp/src/game/client/neo/ui/neo_hud_ammo.cpp | 2 +- mp/src/game/client/neo/ui/neo_hud_childelement.cpp | 5 +++++ mp/src/game/client/neo/ui/neo_hud_childelement.h | 7 +++---- mp/src/game/client/neo/ui/neo_hud_compass.cpp | 2 +- mp/src/game/client/neo/ui/neo_hud_friendly_marker.cpp | 2 +- mp/src/game/client/neo/ui/neo_hud_ghost_beacons.cpp | 2 +- mp/src/game/client/neo/ui/neo_hud_ghost_marker.cpp | 2 +- .../client/neo/ui/neo_hud_health_thermoptic_aux.cpp | 2 +- mp/src/game/client/neo/ui/neo_hud_round_state.cpp | 2 +- 11 files changed, 26 insertions(+), 13 deletions(-) diff --git a/mp/src/game/client/hl2mp/hl2mp_hud_target_id.cpp b/mp/src/game/client/hl2mp/hl2mp_hud_target_id.cpp index d031321d9..65bea537e 100644 --- a/mp/src/game/client/hl2mp/hl2mp_hud_target_id.cpp +++ b/mp/src/game/client/hl2mp/hl2mp_hud_target_id.cpp @@ -13,7 +13,7 @@ using namespace vgui; #ifdef NEO -DECLARE_NAMED_HUDELEMENT(CTargetID, UI_ELEMENT_TARGET_ID); +DECLARE_NAMED_HUDELEMENT(CTargetID, TargetID); #endif //----------------------------------------------------------------------------- diff --git a/mp/src/game/client/neo/c_neo_player.cpp b/mp/src/game/client/neo/c_neo_player.cpp index 7cb1edb61..f1b5212b2 100644 --- a/mp/src/game/client/neo/c_neo_player.cpp +++ b/mp/src/game/client/neo/c_neo_player.cpp @@ -25,6 +25,7 @@ #include "ui/neo_hud_game_event.h" #include "ui/neo_hud_ghost_marker.h" #include "ui/neo_hud_friendly_marker.h" +#include "ui/neo_hud_round_state.h" #include "neo/game_controls/neo_loadoutmenu.h" @@ -897,7 +898,7 @@ void C_NEO_Player::PreThink( void ) engine->ClientCmd(teammenu.GetName()); } - if (auto *ghostMarker = GET_NAMED_HUDELEMENT(CNEOHud_GhostMarker, UI_ELEMENT_NAME_GHOST_MARKER)) + if (auto *ghostMarker = GET_NAMED_HUDELEMENT(CNEOHud_GhostMarker, neo_ghost_marker)) { if (!m_bGhostExists) { @@ -1233,6 +1234,14 @@ void C_NEO_Player::Spawn( void ) } } + for (auto *hud : gHUD.m_HudList) + { + if (auto *neoHud = dynamic_cast(hud)) + { + neoHud->resetLastUpdateTime(); + } + } + if (GetTeamNumber() == TEAM_UNASSIGNED) { m_bShowTeamMenu = true; diff --git a/mp/src/game/client/neo/ui/neo_hud_ammo.cpp b/mp/src/game/client/neo/ui/neo_hud_ammo.cpp index 5f041e085..e68d38cdf 100644 --- a/mp/src/game/client/neo/ui/neo_hud_ammo.cpp +++ b/mp/src/game/client/neo/ui/neo_hud_ammo.cpp @@ -38,7 +38,7 @@ ConVar neo_cl_hud_debug_ammo_color_b("neo_cl_hud_debug_ammo_color_b", "205", FCV ConVar neo_cl_hud_debug_ammo_color_a("neo_cl_hud_debug_ammo_color_a", "255", FCVAR_USERINFO | FCVAR_CHEAT, "Alpha color value of the ammo, in range 0 - 255.", true, 0.0f, true, 255.0f); -DECLARE_NAMED_HUDELEMENT(CNEOHud_Ammo, UI_ELEMENT_NAME_AMMO); +DECLARE_NAMED_HUDELEMENT(CNEOHud_Ammo, NHudWeapon); NEO_HUD_ELEMENT_DECLARE_FREQ_CVAR(Ammo, 0.00695); diff --git a/mp/src/game/client/neo/ui/neo_hud_childelement.cpp b/mp/src/game/client/neo/ui/neo_hud_childelement.cpp index bfcbd4715..ae70aa7b2 100644 --- a/mp/src/game/client/neo/ui/neo_hud_childelement.cpp +++ b/mp/src/game/client/neo/ui/neo_hud_childelement.cpp @@ -45,6 +45,11 @@ CNEOHud_ChildElement::CNEOHud_ChildElement() Assert(m_rounded_width > 0 && m_rounded_height > 0); } +void CNEOHud_ChildElement::resetLastUpdateTime() +{ + m_flLastUpdateTime = 0.0f; +} + CNEOHud_ChildElement::XYHudPos CNEOHud_ChildElement::DrawNeoHudRoundedCommon( const int x0, const int y0, const int x1, const int y1, Color color, bool topLeft, bool topRight, bool bottomLeft, bool bottomRight) const diff --git a/mp/src/game/client/neo/ui/neo_hud_childelement.h b/mp/src/game/client/neo/ui/neo_hud_childelement.h index 6358fa189..1877b2c2a 100644 --- a/mp/src/game/client/neo/ui/neo_hud_childelement.h +++ b/mp/src/game/client/neo/ui/neo_hud_childelement.h @@ -29,6 +29,8 @@ class CNEOHud_ChildElement public: CNEOHud_ChildElement(); virtual ~CNEOHud_ChildElement() { } + CNEOHud_ChildElement(CNEOHud_ChildElement &other) = delete; + void resetLastUpdateTime(); protected: virtual void DrawNeoHudRoundedBox(const int x0, const int y0, const int x1, const int y1, Color color = NEO_HUDBOX_COLOR, @@ -72,7 +74,7 @@ class CNEOHud_ChildElement else if (frequency > 0) { const float deltaTime = gpGlobals->curtime - m_flLastUpdateTime; - if (deltaTime < frequency) + if ((m_flLastUpdateTime > 0.0f) && (deltaTime < frequency)) { return false; } @@ -98,9 +100,6 @@ class CNEOHud_ChildElement int m_rounded_width, m_rounded_height; float m_flLastUpdateTime; - -private: - CNEOHud_ChildElement(CNEOHud_ChildElement& other); }; #endif // NEO_HUD_CHILDELEMENT_H diff --git a/mp/src/game/client/neo/ui/neo_hud_compass.cpp b/mp/src/game/client/neo/ui/neo_hud_compass.cpp index e18c4fb50..64db1266b 100644 --- a/mp/src/game/client/neo/ui/neo_hud_compass.cpp +++ b/mp/src/game/client/neo/ui/neo_hud_compass.cpp @@ -38,7 +38,7 @@ ConVar neo_cl_hud_debug_compass_color_b("neo_cl_hud_debug_compass_color_b", "205 ConVar neo_cl_hud_debug_compass_color_a("neo_cl_hud_debug_compass_color_a", "255", FCVAR_USERINFO | FCVAR_CHEAT, "Alpha color value of the Debug compass, in range 0 - 255.", true, 0.0f, true, 255.0f); -DECLARE_NAMED_HUDELEMENT(CNEOHud_Compass, UI_ELEMENT_NAME_COMPASS); +DECLARE_NAMED_HUDELEMENT(CNEOHud_Compass, NHudCompass); NEO_HUD_ELEMENT_DECLARE_FREQ_CVAR(Compass, 0.00695) diff --git a/mp/src/game/client/neo/ui/neo_hud_friendly_marker.cpp b/mp/src/game/client/neo/ui/neo_hud_friendly_marker.cpp index 520077e74..194d6e758 100644 --- a/mp/src/game/client/neo/ui/neo_hud_friendly_marker.cpp +++ b/mp/src/game/client/neo/ui/neo_hud_friendly_marker.cpp @@ -24,7 +24,7 @@ using vgui::surface; ConVar neo_friendly_marker_hud_scale_factor("neo_friendly_marker_hud_scale_factor", "0.5", FCVAR_USERINFO, "Friendly player marker HUD element scaling factor", true, 0.01, false, 0); -DECLARE_NAMED_HUDELEMENT(CNEOHud_FriendlyMarker, UI_ELEMENT_NAME_IFF); +DECLARE_NAMED_HUDELEMENT(CNEOHud_FriendlyMarker, neo_iff); NEO_HUD_ELEMENT_DECLARE_FREQ_CVAR(FriendlyMarker, 0.01) diff --git a/mp/src/game/client/neo/ui/neo_hud_ghost_beacons.cpp b/mp/src/game/client/neo/ui/neo_hud_ghost_beacons.cpp index 85317b02c..56de96123 100644 --- a/mp/src/game/client/neo/ui/neo_hud_ghost_beacons.cpp +++ b/mp/src/game/client/neo/ui/neo_hud_ghost_beacons.cpp @@ -28,7 +28,7 @@ ConVar neo_ghost_beacon_alpha("neo_ghost_beacon_alpha", "150", FCVAR_USERINFO, ConVar neo_ghost_delay_secs("neo_ghost_delay_secs", "3.3", FCVAR_CHEAT | FCVAR_REPLICATED, "The delay in seconds until the ghost shows up after pick up.", true, 0.0, false, 0.0); -DECLARE_NAMED_HUDELEMENT(CNEOHud_GhostBeacons, UI_ELEMENT_NAME_GHOST_BEACONS); +DECLARE_NAMED_HUDELEMENT(CNEOHud_GhostBeacons, neo_ghost_beacons); NEO_HUD_ELEMENT_DECLARE_FREQ_CVAR(GhostBeacons, 0.01) diff --git a/mp/src/game/client/neo/ui/neo_hud_ghost_marker.cpp b/mp/src/game/client/neo/ui/neo_hud_ghost_marker.cpp index 32ccb0e20..a0f1e144e 100644 --- a/mp/src/game/client/neo/ui/neo_hud_ghost_marker.cpp +++ b/mp/src/game/client/neo/ui/neo_hud_ghost_marker.cpp @@ -23,7 +23,7 @@ using vgui::surface; ConVar neo_ghost_marker_hud_scale_factor("neo_ghost_marker_hud_scale_factor", "0.5", FCVAR_USERINFO, "Ghost marker HUD element scaling factor", true, 0.01, false, 0); -DECLARE_NAMED_HUDELEMENT(CNEOHud_GhostMarker, UI_ELEMENT_NAME_GHOST_MARKER); +DECLARE_NAMED_HUDELEMENT(CNEOHud_GhostMarker, neo_ghost_marker); NEO_HUD_ELEMENT_DECLARE_FREQ_CVAR(GhostMarker, 0.01) diff --git a/mp/src/game/client/neo/ui/neo_hud_health_thermoptic_aux.cpp b/mp/src/game/client/neo/ui/neo_hud_health_thermoptic_aux.cpp index 8ea8eb78c..073189c2f 100644 --- a/mp/src/game/client/neo/ui/neo_hud_health_thermoptic_aux.cpp +++ b/mp/src/game/client/neo/ui/neo_hud_health_thermoptic_aux.cpp @@ -23,7 +23,7 @@ using vgui::surface; ConVar neo_cl_hud_hta_enabled("neo_cl_hud_hta_enabled", "1", FCVAR_USERINFO, "Whether the HUD Health/ThermOptic/AUX module is enabled or not.", true, 0, true, 1); -DECLARE_NAMED_HUDELEMENT(CNEOHud_HTA, UI_ELEMENT_NAME_HTA); +DECLARE_NAMED_HUDELEMENT(CNEOHud_HTA, NHudHealth); NEO_HUD_ELEMENT_DECLARE_FREQ_CVAR(HTA, 0.00695); diff --git a/mp/src/game/client/neo/ui/neo_hud_round_state.cpp b/mp/src/game/client/neo/ui/neo_hud_round_state.cpp index a043e0320..e15387ba1 100644 --- a/mp/src/game/client/neo/ui/neo_hud_round_state.cpp +++ b/mp/src/game/client/neo/ui/neo_hud_round_state.cpp @@ -24,7 +24,7 @@ using vgui::surface; -DECLARE_NAMED_HUDELEMENT(CNEOHud_RoundState, UI_ELEMENT_ROUND_STATE); +DECLARE_NAMED_HUDELEMENT(CNEOHud_RoundState, neo_round_state); NEO_HUD_ELEMENT_DECLARE_FREQ_CVAR(RoundState, 0.1)