Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial fix HUD - fix timer and fix hud name #439

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mp/src/game/client/hl2mp/hl2mp_hud_target_id.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
using namespace vgui;

#ifdef NEO
DECLARE_NAMED_HUDELEMENT(CTargetID, UI_ELEMENT_TARGET_ID);
DECLARE_NAMED_HUDELEMENT(CTargetID, TargetID);
#endif

//-----------------------------------------------------------------------------
Expand Down
11 changes: 10 additions & 1 deletion mp/src/game/client/neo/c_neo_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -1233,6 +1234,14 @@ void C_NEO_Player::Spawn( void )
}
}

for (auto *hud : gHUD.m_HudList)
{
if (auto *neoHud = dynamic_cast<CNEOHud_ChildElement *>(hud))
{
neoHud->resetLastUpdateTime();
}
}

if (GetTeamNumber() == TEAM_UNASSIGNED)
{
m_bShowTeamMenu = true;
Expand Down
2 changes: 1 addition & 1 deletion mp/src/game/client/neo/ui/neo_hud_ammo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
5 changes: 5 additions & 0 deletions mp/src/game/client/neo/ui/neo_hud_childelement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions mp/src/game/client/neo/ui/neo_hud_childelement.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}
Expand All @@ -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
2 changes: 1 addition & 1 deletion mp/src/game/client/neo/ui/neo_hud_compass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion mp/src/game/client/neo/ui/neo_hud_friendly_marker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion mp/src/game/client/neo/ui/neo_hud_ghost_beacons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion mp/src/game/client/neo/ui/neo_hud_ghost_marker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion mp/src/game/client/neo/ui/neo_hud_round_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down