From 8abe065b7445c0c411535bda611f3e8b65a1efcc Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Fri, 13 Mar 2026 12:51:55 +0000 Subject: [PATCH 01/15] init --- game/neo/scripts/HudLayout.res | 10 +++ src/game/client/CMakeLists.txt | 2 + src/game/client/neo/c_neo_player.h | 3 +- .../neo/ui/neo_hud_walking_indicator.cpp | 81 +++++++++++++++++++ .../client/neo/ui/neo_hud_walking_indicator.h | 34 ++++++++ src/game/server/neo/neo_player.cpp | 32 ++++++++ src/game/server/neo/neo_player.h | 3 + src/game/shared/baseplayer_shared.cpp | 23 ++---- src/game/shared/neo/neo_gamerules.h | 1 + src/game/shared/neo/neo_player_shared.cpp | 36 +++++++++ 10 files changed, 207 insertions(+), 18 deletions(-) create mode 100644 src/game/client/neo/ui/neo_hud_walking_indicator.cpp create mode 100644 src/game/client/neo/ui/neo_hud_walking_indicator.h diff --git a/game/neo/scripts/HudLayout.res b/game/neo/scripts/HudLayout.res index c5f1072b66..941ed72471 100644 --- a/game/neo/scripts/HudLayout.res +++ b/game/neo/scripts/HudLayout.res @@ -908,6 +908,16 @@ "sprint_text_color" "255 255 255 100" "sprint_color" "255 255 255 150" } + neo_walking_indicator + { + "fieldName" "neo_walking_indicator" + "xpos" "208" + "ypos" "464" + "wide" "24" + "tall" "24" + "visible" "1" + "enabled" "1" + } RoundResult { "fieldName" "RoundResult" diff --git a/src/game/client/CMakeLists.txt b/src/game/client/CMakeLists.txt index da90412331..b161820e9b 100644 --- a/src/game/client/CMakeLists.txt +++ b/src/game/client/CMakeLists.txt @@ -1610,6 +1610,8 @@ target_sources_grouped( neo/ui/neo_hud_round_state.h neo/ui/neo_hud_startup_sequence.cpp neo/ui/neo_hud_startup_sequence.h + neo/ui/neo_hud_walking_indicator.cpp + neo/ui/neo_hud_walking_indicator.h neo/ui/neo_hud_worldpos_marker.cpp neo/ui/neo_hud_worldpos_marker.h neo/ui/neo_hud_worldpos_marker_generic.cpp diff --git a/src/game/client/neo/c_neo_player.h b/src/game/client/neo/c_neo_player.h index 283a199c45..ee5375a057 100644 --- a/src/game/client/neo/c_neo_player.h +++ b/src/game/client/neo/c_neo_player.h @@ -188,7 +188,8 @@ class C_NEO_Player : public C_HL2MP_Player #ifdef GLOWS_ENABLE void UpdateGlowEffects(int iNewTeam); #endif // GLOWS_ENABLE - + bool ShouldPlayerMakeFootsteps(float speed = -1.f); + float SpeedFractionToSoundThreshold(float speed = -1.f); private: char m_sNameWithTakeoverContextProcessingBuffer[MAX_PLAYER_NAME_LENGTH]; diff --git a/src/game/client/neo/ui/neo_hud_walking_indicator.cpp b/src/game/client/neo/ui/neo_hud_walking_indicator.cpp new file mode 100644 index 0000000000..043bc6562e --- /dev/null +++ b/src/game/client/neo/ui/neo_hud_walking_indicator.cpp @@ -0,0 +1,81 @@ +#include "cbase.h" +#include "neo_hud_walking_indicator.h" + +#include "iclientmode.h" +#include + +#include "c_neo_player.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +DECLARE_NAMED_HUDELEMENT(CNEOHud_WalkingIndicator, neo_walking_indicator); + +NEO_HUD_ELEMENT_DECLARE_FREQ_CVAR(WalkingIndicator, 0.1) + +CNEOHud_WalkingIndicator::CNEOHud_WalkingIndicator(const char *pElementName, vgui::Panel *parent) + : CHudElement(pElementName), Panel(parent, pElementName) +{ + SetAutoDelete(true); + m_iHideHudElementNumber = NEO_HUD_ELEMENT_WALKING_INDICATOR; + + if (parent) { + SetParent(parent); + } + else + { + SetParent(g_pClientMode->GetViewport()); + } + + m_hWalkingIndicatorTexture = vgui::surface()->CreateNewTextureID(); + Assert(m_hWalkingIndicatorTexture > 0); + vgui::surface()->DrawSetTextureFile(m_hWalkingIndicatorTexture, "vgui/hud/player/walkingIndicator", 1, false); + + SetVisible(true); +} + +void CNEOHud_WalkingIndicator::ApplySchemeSettings(vgui::IScheme* pScheme) +{ + BaseClass::ApplySchemeSettings(pScheme); + + SetBounds(xpos, ypos-tall, wide, tall); + SetFgColor(COLOR_TRANSPARENT); + SetBgColor(COLOR_TRANSPARENT); +} + +void CNEOHud_WalkingIndicator::UpdateStateForNeoHudElementDraw() +{ +} + +void CNEOHud_WalkingIndicator::DrawNeoHudElement() +{ + if (!ShouldDraw()) + return; + + C_NEO_Player* pLocalPlayer = C_NEO_Player::GetLocalNEOPlayer(); + if (!pLocalPlayer) + return; + + C_NEO_Player* pTargetPlayer = pLocalPlayer->IsObserver() && (pLocalPlayer->GetObserverMode() == OBS_MODE_IN_EYE || pLocalPlayer->GetObserverMode() == OBS_MODE_CHASE) ? static_cast(pLocalPlayer->GetObserverTarget()) : pLocalPlayer; + if (!pTargetPlayer) + return; + + if (!pTargetPlayer->IsAlive() || !pTargetPlayer->IsWalking())// && !pTargetPlayer->IsInAim()) player is also silent if aiming and not abusing the threshold, but its much harder to make noise when aiming, better for the indicator to strictly appear when walk is pressed + return; + + const float fractionTowardsMakingSound = Max(0.f, Min(1.f, pTargetPlayer->SpeedFractionToSoundThreshold())); + + vgui::surface()->DrawSetTexture(m_hWalkingIndicatorTexture); + vgui::surface()->DrawSetColor(COLOR_WHITE); + const float ICON_WIDTH = 1 / 2.f; + const float ICON_HEIGHT = 1 / 2.f; + vgui::surface()->DrawTexturedSubRect(0, 0, wide, tall, 0, ICON_WIDTH, ICON_HEIGHT, 2 * ICON_HEIGHT); + vgui::surface()->DrawSetColor(255, 255 - (255 * fractionTowardsMakingSound), 255 - (255 * fractionTowardsMakingSound), 255); + vgui::surface()->DrawTexturedSubRect(0, tall * (1 - fractionTowardsMakingSound), wide, tall, 0, ICON_HEIGHT * (1 - fractionTowardsMakingSound), ICON_WIDTH, ICON_HEIGHT); +} + +void CNEOHud_WalkingIndicator::Paint() +{ + BaseClass::Paint(); + PaintNeoElement(); +} \ No newline at end of file diff --git a/src/game/client/neo/ui/neo_hud_walking_indicator.h b/src/game/client/neo/ui/neo_hud_walking_indicator.h new file mode 100644 index 0000000000..5c4054aa39 --- /dev/null +++ b/src/game/client/neo/ui/neo_hud_walking_indicator.h @@ -0,0 +1,34 @@ +#pragma once + +#include "neo_hud_childelement.h" +#include "hudelement.h" +#include + +class CNEOHud_WalkingIndicator : public CNEOHud_ChildElement, public CHudElement, public vgui::Panel +{ + DECLARE_CLASS_SIMPLE(CNEOHud_WalkingIndicator, Panel); + +public: + CNEOHud_WalkingIndicator(const char *pElementName, vgui::Panel *parent = NULL); + void ApplySchemeSettings(vgui::IScheme* pScheme) override; + + virtual void Paint() override; + +protected: + virtual void UpdateStateForNeoHudElementDraw() override; + virtual void DrawNeoHudElement() override; + virtual ConVar* GetUpdateFrequencyConVar() const override; + +private: + vgui::HTexture m_hWalkingIndicatorTexture = 0; + + CPanelAnimationVarAliasType(int, xpos, "xpos", "r203", "proportional_xpos"); + CPanelAnimationVarAliasType(int, ypos, "ypos", "446", "proportional_ypos"); + CPanelAnimationVarAliasType(int, wide, "wide", "203", "proportional_xpos"); + CPanelAnimationVarAliasType(int, tall, "tall", "32", "proportional_ypos"); + CPanelAnimationVarAliasType(int, visible, "visible", "1", "int"); + CPanelAnimationVarAliasType(int, enabled, "enabled", "1", "int"); + +private: + CNEOHud_WalkingIndicator(const CNEOHud_WalkingIndicator&other); +}; \ No newline at end of file diff --git a/src/game/server/neo/neo_player.cpp b/src/game/server/neo/neo_player.cpp index cf2660fef9..3ff3e4df4d 100644 --- a/src/game/server/neo/neo_player.cpp +++ b/src/game/server/neo/neo_player.cpp @@ -172,6 +172,8 @@ ConVar sv_neo_warmup_godmode("sv_neo_warmup_godmode", "0", FCVAR_REPLICATED, "If ConVar bot_class("bot_class", "-1", 0, "Force all bots to spawn with the specified class number, or -1 to disable.", true, NEO_CLASS_RANDOM, true, NEO_CLASS_LOADOUTABLE_COUNT-1); static void BotChangeClassFn(const CCommand& args); ConCommand bot_changeclass("bot_changeclass", BotChangeClassFn, "Force all bots to switch to the specified class number."); +static void BotChangeSkinFn(const CCommand& args); +ConCommand bot_changeskin("bot_changeskin", BotChangeSkinFn, "Force all bots to switch to the specified skin number."); // Bot Cloak Detection Thresholds // Base detection chance ratio (0.0 - 1.0) for bots to notice a cloaked target based on difficulty @@ -4315,3 +4317,33 @@ static void BotChangeClassFn(const CCommand& args) player->RequestSetClass(botClass); } } + +static void BotChangeSkinFn(const CCommand& args) +{ + constexpr int minValue = NEO_SKIN_FIRST; + constexpr int maxValue = NEO_SKIN__ENUM_COUNT - 1; + + const auto nag = [&args]() { + Msg("Format: %s \n", args.Arg(0), minValue, maxValue); + }; + + if (args.ArgC() != 2) + { + nag(); + return; + } + + const int botSkin = V_atoi(args.Arg(1)); + if (botSkin < minValue || botSkin > maxValue) + { + nag(); + return; + } + + for (int i = 1; i <= gpGlobals->maxClients; ++i) + { + auto* player = assert_cast(UTIL_PlayerByIndex(i)); + if (player && player->IsBot() && player->GetTeamNumber() >= FIRST_GAME_TEAM) + player->RequestSetSkin(botSkin); + } +} diff --git a/src/game/server/neo/neo_player.h b/src/game/server/neo/neo_player.h index 6e9a15f7b4..9cfab5f8e6 100644 --- a/src/game/server/neo/neo_player.h +++ b/src/game/server/neo/neo_player.h @@ -238,6 +238,9 @@ class CNEO_Player : public CHL2MP_Player void BecomeJuggernaut(); void SpawnJuggernautPostDeath(); + bool ShouldPlayerMakeFootsteps(float speed = -1.f); + float SpeedFractionToSoundThreshold(float speed = -1.f); + private: bool m_bAllowGibbing; diff --git a/src/game/shared/baseplayer_shared.cpp b/src/game/shared/baseplayer_shared.cpp index 23e4d887bb..daff64befc 100644 --- a/src/game/shared/baseplayer_shared.cpp +++ b/src/game/shared/baseplayer_shared.cpp @@ -693,29 +693,18 @@ void CBasePlayer::UpdateStepSound( surfacedata_t *psurface, const Vector &vecOri } #ifdef NEO - // Changing movement direction, looking around, wall-running accelerate the player. Threshold should be lower than regular speed, but higher than walk/aim speed - constexpr float SILENT_THRESHOLD_GRACE = 0.7f; -#endif //NEO + if (neoPlayer->ShouldPlayerMakeFootsteps(speed)) + { + return; + } +#endif // NEO + // play the sound // 65% volume if ducking if ( GetFlags() & FL_DUCKING ) { fvol *= 0.65; -#ifdef NEO - if ((neoPlayer->IsInAim() || neoPlayer->IsWalking()) && speed <= (neoPlayer->GetCrouchSpeed() * SILENT_THRESHOLD_GRACE)) - { - return; - } -#endif // NEO - } -#ifdef NEO - - else if ((neoPlayer->IsInAim() || neoPlayer->IsWalking()) && speed <= (neoPlayer->GetNormSpeed() * SILENT_THRESHOLD_GRACE)) - { - return; } - -#endif PlayStepSound( feet, psurface, fvol, false ); } diff --git a/src/game/shared/neo/neo_gamerules.h b/src/game/shared/neo/neo_gamerules.h index c8cbfd2d3e..8fc80ae954 100644 --- a/src/game/shared/neo/neo_gamerules.h +++ b/src/game/shared/neo/neo_gamerules.h @@ -158,6 +158,7 @@ enum NeoHudElements : NEO_HUD_BITS_UNDERLYING_TYPE { NEO_HUD_ELEMENT_SCOREBOARD = (static_cast(1) << 14), NEO_HUD_ELEMENT_PLAYER_PING = (static_cast(1) << 15), NEO_HUD_ELEMENT_WORLDPOS_MARKER_ENT = (static_cast(1) << 16), + NEO_HUD_ELEMENT_WALKING_INDICATOR = (static_cast(1) << 17), }; class CNEORules : public CHL2MPRules, public CGameEventListener diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index fb8cdde290..fd25e2e898 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -403,3 +403,39 @@ void CNEO_Player::CheckAimButtons() Weapon_SetZoom(false); } } + +// Changing movement direction, looking around, wall-running accelerate the player. Threshold should be lower than regular speed, but higher than walk/aim speed +constexpr float SILENT_THRESHOLD_GRACE = 0.7f; +bool CNEO_Player::ShouldPlayerMakeFootsteps(float speed) // Could simply always get speed from the player, but didnt want to risk changing the behavior of UpdateStepSound in baseplayer_shared +{ + if (speed < 0) + { + speed = GetAbsVelocity().Length(); + } + + if ( GetFlags() & FL_DUCKING && (IsInAim() || IsWalking()) && speed <= (GetCrouchSpeed() * SILENT_THRESHOLD_GRACE) ) + { + return false; + } + else if ((IsInAim() || IsWalking()) && speed <= (GetNormSpeed() * SILENT_THRESHOLD_GRACE)) + { + return false; + } + + return true; +} + +float CNEO_Player::SpeedFractionToSoundThreshold(float speed) +{ + if (speed < 0) + { + speed = GetAbsVelocity().Length(); + } + + if (IsInAim() || IsWalking()) + { + const float difference = ((GetFlags() & FL_DUCKING ? GetCrouchSpeed() : GetNormSpeed()) * SILENT_THRESHOLD_GRACE) - GetPlayerMaxSpeed(); + return (speed - GetPlayerMaxSpeed()) / difference; + } + return 1.f; +} \ No newline at end of file From 6b3019387dbc5f83115ab2feb2d0c0b60d59c5c7 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Fri, 13 Mar 2026 13:24:41 +0000 Subject: [PATCH 02/15] fix, dont overlap the icons --- game/neo/scripts/HudLayout.res | 2 +- src/game/client/neo/ui/neo_hud_walking_indicator.cpp | 6 ++++-- src/game/shared/baseplayer_shared.cpp | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/game/neo/scripts/HudLayout.res b/game/neo/scripts/HudLayout.res index 941ed72471..7e29e25a3b 100644 --- a/game/neo/scripts/HudLayout.res +++ b/game/neo/scripts/HudLayout.res @@ -912,7 +912,7 @@ { "fieldName" "neo_walking_indicator" "xpos" "208" - "ypos" "464" + "ypos" "470" "wide" "24" "tall" "24" "visible" "1" diff --git a/src/game/client/neo/ui/neo_hud_walking_indicator.cpp b/src/game/client/neo/ui/neo_hud_walking_indicator.cpp index 043bc6562e..787ac769de 100644 --- a/src/game/client/neo/ui/neo_hud_walking_indicator.cpp +++ b/src/game/client/neo/ui/neo_hud_walking_indicator.cpp @@ -69,9 +69,11 @@ void CNEOHud_WalkingIndicator::DrawNeoHudElement() vgui::surface()->DrawSetColor(COLOR_WHITE); const float ICON_WIDTH = 1 / 2.f; const float ICON_HEIGHT = 1 / 2.f; - vgui::surface()->DrawTexturedSubRect(0, 0, wide, tall, 0, ICON_WIDTH, ICON_HEIGHT, 2 * ICON_HEIGHT); + vgui::surface()->DrawTexturedSubRect(0, 0, wide, tall * (1 - fractionTowardsMakingSound), + 0, ICON_HEIGHT, ICON_WIDTH, ICON_HEIGHT + (ICON_HEIGHT * (1 - fractionTowardsMakingSound))); vgui::surface()->DrawSetColor(255, 255 - (255 * fractionTowardsMakingSound), 255 - (255 * fractionTowardsMakingSound), 255); - vgui::surface()->DrawTexturedSubRect(0, tall * (1 - fractionTowardsMakingSound), wide, tall, 0, ICON_HEIGHT * (1 - fractionTowardsMakingSound), ICON_WIDTH, ICON_HEIGHT); + vgui::surface()->DrawTexturedSubRect(0, tall * (1 - fractionTowardsMakingSound), wide, tall, + 0, ICON_HEIGHT * (1 - fractionTowardsMakingSound), ICON_WIDTH, ICON_HEIGHT); } void CNEOHud_WalkingIndicator::Paint() diff --git a/src/game/shared/baseplayer_shared.cpp b/src/game/shared/baseplayer_shared.cpp index daff64befc..07cd1c77bf 100644 --- a/src/game/shared/baseplayer_shared.cpp +++ b/src/game/shared/baseplayer_shared.cpp @@ -693,7 +693,7 @@ void CBasePlayer::UpdateStepSound( surfacedata_t *psurface, const Vector &vecOri } #ifdef NEO - if (neoPlayer->ShouldPlayerMakeFootsteps(speed)) + if (!neoPlayer->ShouldPlayerMakeFootsteps(speed)) { return; } From b89129a34d14e62474c4db40855159f857f56289 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Fri, 13 Mar 2026 14:48:54 +0000 Subject: [PATCH 03/15] drawn image dimensions constant --- .../client/neo/ui/neo_hud_walking_indicator.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/game/client/neo/ui/neo_hud_walking_indicator.cpp b/src/game/client/neo/ui/neo_hud_walking_indicator.cpp index 787ac769de..0652f9169f 100644 --- a/src/game/client/neo/ui/neo_hud_walking_indicator.cpp +++ b/src/game/client/neo/ui/neo_hud_walking_indicator.cpp @@ -63,17 +63,19 @@ void CNEOHud_WalkingIndicator::DrawNeoHudElement() if (!pTargetPlayer->IsAlive() || !pTargetPlayer->IsWalking())// && !pTargetPlayer->IsInAim()) player is also silent if aiming and not abusing the threshold, but its much harder to make noise when aiming, better for the indicator to strictly appear when walk is pressed return; - const float fractionTowardsMakingSound = Max(0.f, Min(1.f, pTargetPlayer->SpeedFractionToSoundThreshold())); + // we don't want the subrectangle taken from the texture to vary in size when speed changes but the split between the top and bottom image remains in the same spot since texture can be larger than the area its drawn to + const int pictureSplitDistanceInPixels = tall * (1 - Max(0.f, Min(1.f, pTargetPlayer->SpeedFractionToSoundThreshold()))); + const float pictureSplitDistanceFraction = (float)pictureSplitDistanceInPixels / tall; vgui::surface()->DrawSetTexture(m_hWalkingIndicatorTexture); vgui::surface()->DrawSetColor(COLOR_WHITE); const float ICON_WIDTH = 1 / 2.f; const float ICON_HEIGHT = 1 / 2.f; - vgui::surface()->DrawTexturedSubRect(0, 0, wide, tall * (1 - fractionTowardsMakingSound), - 0, ICON_HEIGHT, ICON_WIDTH, ICON_HEIGHT + (ICON_HEIGHT * (1 - fractionTowardsMakingSound))); - vgui::surface()->DrawSetColor(255, 255 - (255 * fractionTowardsMakingSound), 255 - (255 * fractionTowardsMakingSound), 255); - vgui::surface()->DrawTexturedSubRect(0, tall * (1 - fractionTowardsMakingSound), wide, tall, - 0, ICON_HEIGHT * (1 - fractionTowardsMakingSound), ICON_WIDTH, ICON_HEIGHT); + vgui::surface()->DrawTexturedSubRect(0, 0, wide, pictureSplitDistanceInPixels, + 0, ICON_HEIGHT, ICON_WIDTH, ICON_HEIGHT + (ICON_HEIGHT * pictureSplitDistanceFraction)); + vgui::surface()->DrawSetColor(255, 255 * pictureSplitDistanceFraction, 255 * pictureSplitDistanceFraction, 255); + vgui::surface()->DrawTexturedSubRect(0, pictureSplitDistanceInPixels, wide, tall, + 0, ICON_HEIGHT * pictureSplitDistanceFraction, ICON_WIDTH, ICON_HEIGHT); } void CNEOHud_WalkingIndicator::Paint() From d095f9654601ac234e18faaaa881614fd7c7ca5b Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Thu, 30 Jul 2026 18:10:35 +0100 Subject: [PATCH 04/15] align with the bottom, barwidth --- game/neo/scripts/HudLayout.res | 15 +++++---- .../neo/ui/neo_hud_walking_indicator.cpp | 24 +++++--------- .../client/neo/ui/neo_hud_walking_indicator.h | 7 +++-- src/game/shared/neo/neo_player_shared.cpp | 31 ++++++++++++++----- 4 files changed, 46 insertions(+), 31 deletions(-) diff --git a/game/neo/scripts/HudLayout.res b/game/neo/scripts/HudLayout.res index 581be0fdb0..4eb9ed70c7 100644 --- a/game/neo/scripts/HudLayout.res +++ b/game/neo/scripts/HudLayout.res @@ -911,14 +911,17 @@ neo_walking_indicator { "fieldName" "neo_walking_indicator" - "xpos" "c-8-50" - "ypos" "c+8" - "wide" "16" - "tall" "16" - "color" "255 255 255 200" - "texture" "vgui/hud/player/walkingIndicator" "visible" "1" "enabled" "1" + + "xpos" "208" + "ypos" "446" + "wide" "24" + "tall" "24" + "color" "255 255 255 200" + "texture" "vgui/hud/player/walkingIndicator" + + "barwidth" "2" } RoundResult { diff --git a/src/game/client/neo/ui/neo_hud_walking_indicator.cpp b/src/game/client/neo/ui/neo_hud_walking_indicator.cpp index 48f8ebf018..9b9a552740 100644 --- a/src/game/client/neo/ui/neo_hud_walking_indicator.cpp +++ b/src/game/client/neo/ui/neo_hud_walking_indicator.cpp @@ -34,7 +34,7 @@ void CNEOHud_WalkingIndicator::ApplySchemeSettings(vgui::IScheme* pScheme) { BaseClass::ApplySchemeSettings(pScheme); - SetBounds(xpos, ypos-tall, wide, tall); + SetBounds(xpos, ypos, wide, tall); SetFgColor(COLOR_TRANSPARENT); SetBgColor(COLOR_TRANSPARENT); } @@ -63,21 +63,13 @@ void CNEOHud_WalkingIndicator::DrawNeoHudElement() vgui::surface()->DrawSetColor(color); vgui::surface()->DrawTexturedRect(0, 0, wide, tall); -#if 0 - // we don't want the subrectangle taken from the texture to vary in size when speed changes but the split between the top and bottom image remains in the same spot since texture can be larger than the area its drawn to - const int pictureSplitDistanceInPixels = tall * (1 - Max(0.f, Min(1.f, pTargetPlayer->SpeedFractionToSoundThreshold()))); - const float pictureSplitDistanceFraction = (float)pictureSplitDistanceInPixels / tall; - - vgui::surface()->DrawSetTexture(m_hWalkingIndicatorTexture); - vgui::surface()->DrawSetColor(COLOR_WHITE); - const float ICON_WIDTH = 1 / 2.f; - const float ICON_HEIGHT = 1 / 2.f; - vgui::surface()->DrawTexturedSubRect(0, 0, wide, pictureSplitDistanceInPixels, - 0, ICON_HEIGHT, ICON_WIDTH, ICON_HEIGHT + (ICON_HEIGHT * pictureSplitDistanceFraction)); - vgui::surface()->DrawSetColor(255, 255 * pictureSplitDistanceFraction, 255 * pictureSplitDistanceFraction, 255); - vgui::surface()->DrawTexturedSubRect(0, pictureSplitDistanceInPixels, wide, tall, - 0, ICON_HEIGHT * pictureSplitDistanceFraction, ICON_WIDTH, ICON_HEIGHT); -#endif + if (barwidth) + { + const float percentageTowardsGraceThreshold = pTargetPlayer->SpeedFractionToSoundThreshold(); + const float colourGB = 255 - (255 * (percentageTowardsGraceThreshold < 1 ? percentageTowardsGraceThreshold * 0.5f : 1)); + vgui::surface()->DrawSetColor(255, colourGB, colourGB, 255); + vgui::surface()->DrawFilledRect(0, tall - (tall * percentageTowardsGraceThreshold), barwidth, tall); + } } void CNEOHud_WalkingIndicator::Paint() diff --git a/src/game/client/neo/ui/neo_hud_walking_indicator.h b/src/game/client/neo/ui/neo_hud_walking_indicator.h index 25e6c747bb..49c9b035cf 100644 --- a/src/game/client/neo/ui/neo_hud_walking_indicator.h +++ b/src/game/client/neo/ui/neo_hud_walking_indicator.h @@ -20,14 +20,17 @@ class CNEOHud_WalkingIndicator : public CNEOHud_ChildElement, public CHudElement virtual ConVar* GetUpdateFrequencyConVar() const override; private: + CPanelAnimationVarAliasType(int, visible, "visible", "1", "int"); + CPanelAnimationVarAliasType(int, enabled, "enabled", "1", "int"); + CPanelAnimationVarAliasType(int, xpos, "xpos", "r203", "proportional_xpos"); CPanelAnimationVarAliasType(int, ypos, "ypos", "446", "proportional_ypos"); CPanelAnimationVarAliasType(int, wide, "wide", "24", "proportional_xpos"); CPanelAnimationVarAliasType(int, tall, "tall", "24", "proportional_ypos"); CPanelAnimationVarAliasType(Color, color, "color", "150 150 150 40", "Color"); CPanelAnimationVarAliasType(int, texture, "texture", "vgui/hud/player/walkingIndicatorInverted", "textureid"); - CPanelAnimationVarAliasType(int, visible, "visible", "1", "int"); - CPanelAnimationVarAliasType(int, enabled, "enabled", "1", "int"); + + CPanelAnimationVarAliasType(int, barwidth, "barwidth", "4", "proportional_xpos"); private: CNEOHud_WalkingIndicator(const CNEOHud_WalkingIndicator&other); diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index 72be4f76b1..0904a82829 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -730,8 +730,9 @@ CBaseEntity *CNEO_Player::FindUseEntity() return pNearest; } -// Changing movement direction, looking around, wall-running accelerate the player. Threshold should be lower than regular speed, but higher than walk/aim speed +// Changing movement direction, looking around, wall-running accelerate the player. Raise the threshold. constexpr float SILENT_THRESHOLD_GRACE = 0.7f; +#define MAX_SILENT_SPEED SILENT_THRESHOLD_GRACE * (GetFlags() & FL_DUCKING ? GetCrouchSpeed() : GetNormSpeed()) bool CNEO_Player::ShouldPlayerMakeFootsteps(float speed) // Could simply always get speed from the player, but didnt want to risk changing the behavior of UpdateStepSound in baseplayer_shared { if (speed < 0) @@ -739,11 +740,14 @@ bool CNEO_Player::ShouldPlayerMakeFootsteps(float speed) // Could simply always speed = GetAbsVelocity().Length(); } - if ( GetFlags() & FL_DUCKING && (IsInAim() || IsWalking()) && speed <= (GetCrouchSpeed() * SILENT_THRESHOLD_GRACE) ) + if (const bool canBeSilent = IsInAim() || IsWalking(); + !canBeSilent) { - return false; + return true; } - else if ((IsInAim() || IsWalking()) && speed <= (GetNormSpeed() * SILENT_THRESHOLD_GRACE)) + + if (const float maxSilentSpeed = MAX_SILENT_SPEED; + speed <= maxSilentSpeed) { return false; } @@ -758,10 +762,23 @@ float CNEO_Player::SpeedFractionToSoundThreshold(float speed) speed = GetAbsVelocity().Length(); } - if (IsInAim() || IsWalking()) + if (const bool canBeSilent = IsInAim() || IsWalking()) { - const float difference = ((GetFlags() & FL_DUCKING ? GetCrouchSpeed() : GetNormSpeed()) * SILENT_THRESHOLD_GRACE) - GetPlayerMaxSpeed(); - return (speed - GetPlayerMaxSpeed()) / difference; + const float bottom = GetPlayerMaxSpeed(); + if (speed < bottom) + { + return 0.f; + } + + float top = MAX_SILENT_SPEED; + if (speed > top) + { + return 1.f; + } + + top -= bottom; + speed -= bottom; + return top != 0 ? speed / top : 1.f; } return 1.f; } \ No newline at end of file From 82139b49fba2567e579dc254e51b4345375c7b44 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Thu, 30 Jul 2026 18:15:34 +0100 Subject: [PATCH 05/15] hide bar by default --- game/neo/scripts/HudLayout.res | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game/neo/scripts/HudLayout.res b/game/neo/scripts/HudLayout.res index 4eb9ed70c7..09429bf9bc 100644 --- a/game/neo/scripts/HudLayout.res +++ b/game/neo/scripts/HudLayout.res @@ -921,7 +921,7 @@ "color" "255 255 255 200" "texture" "vgui/hud/player/walkingIndicator" - "barwidth" "2" + "barwidth" "0" } RoundResult { From 9129b8700ec071564305d75bffd15cae8cc6011a Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Thu, 30 Jul 2026 18:30:56 +0100 Subject: [PATCH 06/15] cleanup --- src/game/shared/neo/neo_player_shared.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index 0904a82829..1ac3fd8b6f 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -746,8 +746,7 @@ bool CNEO_Player::ShouldPlayerMakeFootsteps(float speed) // Could simply always return true; } - if (const float maxSilentSpeed = MAX_SILENT_SPEED; - speed <= maxSilentSpeed) + if (speed <= MAX_SILENT_SPEED) { return false; } @@ -780,5 +779,6 @@ float CNEO_Player::SpeedFractionToSoundThreshold(float speed) speed -= bottom; return top != 0 ? speed / top : 1.f; } + return 1.f; } \ No newline at end of file From 708e7b7c2ee328d42b399ea3a8a57a80fa47553a Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Thu, 30 Jul 2026 19:44:48 +0100 Subject: [PATCH 07/15] check visible --- game/neo/scripts/HudLayout.res | 1 - src/game/client/neo/ui/neo_hud_walking_indicator.cpp | 2 +- src/game/client/neo/ui/neo_hud_walking_indicator.h | 5 ++--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/game/neo/scripts/HudLayout.res b/game/neo/scripts/HudLayout.res index 09429bf9bc..704d863bd9 100644 --- a/game/neo/scripts/HudLayout.res +++ b/game/neo/scripts/HudLayout.res @@ -912,7 +912,6 @@ { "fieldName" "neo_walking_indicator" "visible" "1" - "enabled" "1" "xpos" "208" "ypos" "446" diff --git a/src/game/client/neo/ui/neo_hud_walking_indicator.cpp b/src/game/client/neo/ui/neo_hud_walking_indicator.cpp index 9b9a552740..8878082c19 100644 --- a/src/game/client/neo/ui/neo_hud_walking_indicator.cpp +++ b/src/game/client/neo/ui/neo_hud_walking_indicator.cpp @@ -45,7 +45,7 @@ void CNEOHud_WalkingIndicator::UpdateStateForNeoHudElementDraw() void CNEOHud_WalkingIndicator::DrawNeoHudElement() { - if (!ShouldDraw()) + if (!ShouldDraw() || !visible) return; C_NEO_Player* pLocalPlayer = C_NEO_Player::GetLocalNEOPlayer(); diff --git a/src/game/client/neo/ui/neo_hud_walking_indicator.h b/src/game/client/neo/ui/neo_hud_walking_indicator.h index 49c9b035cf..f24d4f3368 100644 --- a/src/game/client/neo/ui/neo_hud_walking_indicator.h +++ b/src/game/client/neo/ui/neo_hud_walking_indicator.h @@ -20,8 +20,7 @@ class CNEOHud_WalkingIndicator : public CNEOHud_ChildElement, public CHudElement virtual ConVar* GetUpdateFrequencyConVar() const override; private: - CPanelAnimationVarAliasType(int, visible, "visible", "1", "int"); - CPanelAnimationVarAliasType(int, enabled, "enabled", "1", "int"); + CPanelAnimationVarAliasType(bool, visible, "visible", "1", "bool"); CPanelAnimationVarAliasType(int, xpos, "xpos", "r203", "proportional_xpos"); CPanelAnimationVarAliasType(int, ypos, "ypos", "446", "proportional_ypos"); @@ -30,7 +29,7 @@ class CNEOHud_WalkingIndicator : public CNEOHud_ChildElement, public CHudElement CPanelAnimationVarAliasType(Color, color, "color", "150 150 150 40", "Color"); CPanelAnimationVarAliasType(int, texture, "texture", "vgui/hud/player/walkingIndicatorInverted", "textureid"); - CPanelAnimationVarAliasType(int, barwidth, "barwidth", "4", "proportional_xpos"); + CPanelAnimationVarAliasType(int, barwidth, "barwidth", "0", "proportional_xpos"); private: CNEOHud_WalkingIndicator(const CNEOHud_WalkingIndicator&other); From ab53c4a6e4e7bf3d6057ea00657fc745ee76ca2d Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Fri, 30 Oct 2026 19:46:42 +0000 Subject: [PATCH 08/15] position walking indicator with the range finder --- game/neo/scripts/HudLayout.res | 18 +-- src/game/client/neo/ui/neo_hud_compass.cpp | 40 ----- .../neo/ui/neo_hud_walking_indicator.cpp | 145 +++++++++++++++--- .../client/neo/ui/neo_hud_walking_indicator.h | 13 +- src/game/client/neo/ui/neo_root_settings.cpp | 3 + src/game/client/neo/ui/neo_root_settings.h | 2 + src/game/shared/neo/neo_player_shared.cpp | 53 ------- src/game/shared/neo/neo_player_shared.h | 1 + 8 files changed, 149 insertions(+), 126 deletions(-) diff --git a/game/neo/scripts/HudLayout.res b/game/neo/scripts/HudLayout.res index 45b06f6077..df4c4546ec 100644 --- a/game/neo/scripts/HudLayout.res +++ b/game/neo/scripts/HudLayout.res @@ -910,17 +910,17 @@ } neo_walking_indicator { - "fieldName" "neo_walking_indicator" - "visible" "1" + "fieldName" "neo_walking_indicator" + "visible" "1" + + "xpos" "c40" + "ypos" "c30" - "xpos" "208" - "ypos" "446" - "wide" "24" - "tall" "24" - "color" "255 255 255 200" - "texture" "vgui/hud/player/walkingIndicator" + "animationSpeed" "4" - "barwidth" "0" + "color" "218 217 213 255" + "color2" "255 150 150 255" + "font" "NHudPanelText" } RoundResult { diff --git a/src/game/client/neo/ui/neo_hud_compass.cpp b/src/game/client/neo/ui/neo_hud_compass.cpp index c3226d9c6c..4c28588c98 100644 --- a/src/game/client/neo/ui/neo_hud_compass.cpp +++ b/src/game/client/neo/ui/neo_hud_compass.cpp @@ -22,15 +22,6 @@ using vgui::surface; -ConVar cl_neo_hud_rangefinder_enabled("cl_neo_hud_rangefinder_enabled", "1", FCVAR_ARCHIVE, - "Whether the rangefinder HUD is enabled or not.", true, 0.0f, true, 1.0f); -ConVar cl_neo_hud_rangefinder_pos_frac_x("cl_neo_hud_rangefinder_pos_frac_x", "0.55", FCVAR_ARCHIVE, - "In fractional to the total screen width, the x-axis position of the rangefinder.", - true, 0.0f, true, 1.0f); -ConVar cl_neo_hud_rangefinder_pos_frac_y("cl_neo_hud_rangefinder_pos_frac_y", "0.55", FCVAR_ARCHIVE, - "In fractional to the total screen height, the y-axis position of the rangefinder.", - true, 0.0f, true, 1.0f); - ConVar cl_neo_ghost_callout_compass_time("cl_neo_ghost_callout_compass_time", "10.0", FCVAR_CHEAT, "Time in seconds that ghost callouts remain on the compass.", true, 0.0f, false, 0.0f); @@ -164,28 +155,6 @@ void CNEOHud_Compass::UpdateStateForNeoHudElementDraw() float objAngle = safeAngle(- objYaw + MainViewAngles()[YAW]); m_objAngle = Clamp(objAngle, -(float)m_fov / 2, (float)m_fov / 2); } - - if (cl_neo_hud_rangefinder_enabled.GetBool()) - { - if (pFPPlayer->IsInAim()) - { - // Update Rangefinder - trace_t tr; - Vector vecForward; - AngleVectors(MainViewAngles(), &vecForward); - UTIL_TraceLine(MainViewOrigin(), MainViewOrigin() + (vecForward * MAX_TRACE_LENGTH), - MASK_SHOT, pFPPlayer, COLLISION_GROUP_NONE, &tr); - const float flDist = METERS_PER_INCH * tr.startpos.DistTo(tr.endpos); - if (flDist >= 999.0f || tr.surface.flags & (SURF_SKY | SURF_SKY2D)) - { - V_swprintf_safe(m_wszRangeFinder, L"RANGE ---m"); - } - else - { - V_swprintf_safe(m_wszRangeFinder, L"RANGE %3.0fm", flDist); - } - } - } } void CNEOHud_Compass::DrawNeoHudElement(void) @@ -199,15 +168,6 @@ void CNEOHud_Compass::DrawNeoHudElement(void) { DrawCompass(); } - - if (cl_neo_hud_rangefinder_enabled.GetBool() && GetFirstPersonPlayer()->IsInAim()) - { - surface()->DrawSetTextColor(COLOR_NEO_WHITE); - surface()->DrawSetTextFont(m_hFont); - surface()->DrawSetTextPos((m_resX * cl_neo_hud_rangefinder_pos_frac_x.GetFloat()), - (m_resY * cl_neo_hud_rangefinder_pos_frac_y.GetFloat())); - surface()->DrawPrintText(m_wszRangeFinder, ARRAYSIZE(m_wszRangeFinder) - 1); - } } void CNEOHud_Compass::ApplySchemeSettings(vgui::IScheme *pScheme) diff --git a/src/game/client/neo/ui/neo_hud_walking_indicator.cpp b/src/game/client/neo/ui/neo_hud_walking_indicator.cpp index 8878082c19..6d18522347 100644 --- a/src/game/client/neo/ui/neo_hud_walking_indicator.cpp +++ b/src/game/client/neo/ui/neo_hud_walking_indicator.cpp @@ -5,6 +5,7 @@ #include #include "c_neo_player.h" +#include "view.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" @@ -30,46 +31,152 @@ CNEOHud_WalkingIndicator::CNEOHud_WalkingIndicator(const char *pElementName, vgu SetVisible(true); } +const wchar_t notWalkingText[] = L"NOT "; +const wchar_t walkingText[] = L"WALKING"; +int notWalkingTextWidth = 0; +int textHeight = 0; void CNEOHud_WalkingIndicator::ApplySchemeSettings(vgui::IScheme* pScheme) { BaseClass::ApplySchemeSettings(pScheme); - - SetBounds(xpos, ypos, wide, tall); + + int w,h; + vgui::surface()->GetTextSize(font, notWalkingText, notWalkingTextWidth, h); + int walkingTextWidth; + vgui::surface()->GetTextSize(font, walkingText, walkingTextWidth, h); + textHeight = vgui::surface()->GetFontTall(font); + + vgui::ipanel()->GetSize( GetVParent(), w, h ); + + SetBounds(xpos, ypos, w - xpos, textHeight * 2); SetFgColor(COLOR_TRANSPARENT); SetBgColor(COLOR_TRANSPARENT); } +ConVar cl_neo_hud_rangefinder_enabled("cl_neo_hud_rangefinder_enabled", "1", FCVAR_ARCHIVE, + "Show the rangefinder", true, 0.0f, true, 1.0f); +wchar_t m_wszRangeFinder[11]; void CNEOHud_WalkingIndicator::UpdateStateForNeoHudElementDraw() { + C_NEO_Player* pLocalPlayer = C_NEO_Player::GetLocalNEOPlayer(); + if (!pLocalPlayer) + return; + + C_NEO_Player* pTargetPlayer = pLocalPlayer->IsObserver() && (pLocalPlayer->GetObserverMode() == OBS_MODE_IN_EYE || pLocalPlayer->GetObserverMode() == OBS_MODE_CHASE) ? static_cast(pLocalPlayer->GetObserverTarget()) + : pLocalPlayer; + if (!pTargetPlayer || !pTargetPlayer->IsAlive()) + return; + + if (cl_neo_hud_rangefinder_enabled.GetBool()) + { + if (pTargetPlayer->IsInAim()) + { + // Update Rangefinder + trace_t tr; + Vector vecForward; + AngleVectors(MainViewAngles(), &vecForward); + UTIL_TraceLine(MainViewOrigin(), MainViewOrigin() + (vecForward * MAX_TRACE_LENGTH), + MASK_SHOT, pTargetPlayer, COLLISION_GROUP_NONE, &tr); + const float flDist = METERS_PER_INCH * tr.startpos.DistTo(tr.endpos); + if (flDist >= 999.0f || tr.surface.flags & (SURF_SKY | SURF_SKY2D)) + { + V_swprintf_safe(m_wszRangeFinder, L"RANGE ---m"); + } + else + { + V_swprintf_safe(m_wszRangeFinder, L"RANGE %3.0fm", flDist); + } + } + } } -void CNEOHud_WalkingIndicator::DrawNeoHudElement() +void CNEOHud_WalkingIndicator::DrawRangeFinder(C_NEO_Player * pPlayer, int &offset) { - if (!ShouldDraw() || !visible) + if (!cl_neo_hud_rangefinder_enabled.GetBool()) return; - C_NEO_Player* pLocalPlayer = C_NEO_Player::GetLocalNEOPlayer(); - if (!pLocalPlayer) - return; + if (pPlayer->IsInAim()) + { + vgui::surface()->DrawSetTextColor(color); + vgui::surface()->DrawSetTextFont(font); + vgui::surface()->DrawSetTextPos(notWalkingTextWidth, offset); + vgui::surface()->DrawPrintText(m_wszRangeFinder, ARRAYSIZE(m_wszRangeFinder) - 1); + } + offset += textHeight; +} - C_NEO_Player* pTargetPlayer = pLocalPlayer->IsObserver() && (pLocalPlayer->GetObserverMode() == OBS_MODE_IN_EYE || pLocalPlayer->GetObserverMode() == OBS_MODE_CHASE) ? static_cast(pLocalPlayer->GetObserverTarget()) : pLocalPlayer; - if (!pTargetPlayer) +ConVar cl_neo_hud_walkindicator_enabled("cl_neo_hud_walkindicator_enabled", "1", FCVAR_ARCHIVE, + "Show the walking indicator", true, 0.0f, true, 1.0f); +void CNEOHud_WalkingIndicator::DrawWalkingIndicator(C_NEO_Player * pPlayer, int &offset) +{ + if (!cl_neo_hud_walkindicator_enabled.GetBool()) return; - if (!pTargetPlayer->IsAlive() || !pTargetPlayer->IsWalking()) + static float animationWalkPress = 0.f; + const bool isWalking = pPlayer->IsWalking(); + if (isWalking) + { + animationWalkPress += gpGlobals->frametime * animationSpeed; + } + else + { + animationWalkPress -= gpGlobals->frametime * animationSpeed; + } + animationWalkPress = Clamp(animationWalkPress, 0.f, 1.f); + + if (animationWalkPress == 0.f) + { + offset += textHeight; return; - - vgui::surface()->DrawSetTexture(texture); - vgui::surface()->DrawSetColor(color); - vgui::surface()->DrawTexturedRect(0, 0, wide, tall); + } - if (barwidth) + static float animationFootstepThreshold = 0.f; + const bool isMakingFootsteps = pPlayer->IsMakingFootstepSounds(); + if (isMakingFootsteps && isWalking) + { + animationFootstepThreshold += gpGlobals->frametime * animationSpeed; + } + else + { + animationFootstepThreshold -= gpGlobals->frametime * animationSpeed; + } + animationFootstepThreshold = Clamp(animationFootstepThreshold, 0.f, 1.f); + + const float inverseAnimationFootstepThreshold = 1.f - animationFootstepThreshold; + const Color finalColor = Color((color2.r() * animationFootstepThreshold) + (color.r() * inverseAnimationFootstepThreshold), + (color2.g() * animationFootstepThreshold) + (color.g() * inverseAnimationFootstepThreshold), + (color2.b() * animationFootstepThreshold) + (color.b() * inverseAnimationFootstepThreshold), + ((color2.a() * animationFootstepThreshold) + (color.a() * inverseAnimationFootstepThreshold)) * animationWalkPress); + vgui::surface()->DrawSetTextFont(font); + if (isWalking && isMakingFootsteps) { - const float percentageTowardsGraceThreshold = pTargetPlayer->SpeedFractionToSoundThreshold(); - const float colourGB = 255 - (255 * (percentageTowardsGraceThreshold < 1 ? percentageTowardsGraceThreshold * 0.5f : 1)); - vgui::surface()->DrawSetColor(255, colourGB, colourGB, 255); - vgui::surface()->DrawFilledRect(0, tall - (tall * percentageTowardsGraceThreshold), barwidth, tall); + vgui::surface()->DrawSetTextColor(finalColor.r(), finalColor.g(), finalColor.b(), finalColor.a() * animationFootstepThreshold); + vgui::surface()->DrawSetTextPos(0, offset); + vgui::surface()->DrawPrintText(notWalkingText, ARRAYSIZE(notWalkingText) - 1); } + vgui::surface()->DrawSetTextColor(finalColor); + vgui::surface()->DrawSetTextPos(notWalkingTextWidth, offset); + vgui::surface()->DrawPrintText(walkingText, ARRAYSIZE(walkingText) - 1); + + offset += textHeight; +} + +void CNEOHud_WalkingIndicator::DrawNeoHudElement() +{ + if (!ShouldDraw()) + return; + + C_NEO_Player* pLocalPlayer = C_NEO_Player::GetLocalNEOPlayer(); + if (!pLocalPlayer) + return; + + C_NEO_Player* pTargetPlayer = pLocalPlayer->IsObserver() && (pLocalPlayer->GetObserverMode() == OBS_MODE_IN_EYE || pLocalPlayer->GetObserverMode() == OBS_MODE_CHASE) ? static_cast(pLocalPlayer->GetObserverTarget()) + : pLocalPlayer; + if (!pTargetPlayer || !pTargetPlayer->IsAlive()) + return; + + int offset = 0; + DrawRangeFinder(pTargetPlayer, offset); + DrawWalkingIndicator(pTargetPlayer, offset); } void CNEOHud_WalkingIndicator::Paint() diff --git a/src/game/client/neo/ui/neo_hud_walking_indicator.h b/src/game/client/neo/ui/neo_hud_walking_indicator.h index f24d4f3368..c9faca8453 100644 --- a/src/game/client/neo/ui/neo_hud_walking_indicator.h +++ b/src/game/client/neo/ui/neo_hud_walking_indicator.h @@ -20,16 +20,19 @@ class CNEOHud_WalkingIndicator : public CNEOHud_ChildElement, public CHudElement virtual ConVar* GetUpdateFrequencyConVar() const override; private: + void DrawRangeFinder(C_NEO_Player* pPlayer, int &offset); + void DrawWalkingIndicator(C_NEO_Player* pPlayer, int &offset); + CPanelAnimationVarAliasType(bool, visible, "visible", "1", "bool"); CPanelAnimationVarAliasType(int, xpos, "xpos", "r203", "proportional_xpos"); CPanelAnimationVarAliasType(int, ypos, "ypos", "446", "proportional_ypos"); - CPanelAnimationVarAliasType(int, wide, "wide", "24", "proportional_xpos"); - CPanelAnimationVarAliasType(int, tall, "tall", "24", "proportional_ypos"); - CPanelAnimationVarAliasType(Color, color, "color", "150 150 150 40", "Color"); - CPanelAnimationVarAliasType(int, texture, "texture", "vgui/hud/player/walkingIndicatorInverted", "textureid"); - CPanelAnimationVarAliasType(int, barwidth, "barwidth", "0", "proportional_xpos"); + CPanelAnimationVar(float, animationSpeed, "animationSpeed", "2"); + + CPanelAnimationVarAliasType(Color, color, "color", COLOR_NEO_WHITE_STR, "Color"); + CPanelAnimationVarAliasType(Color, color2, "color2", "255 150 150 255", "Color"); + CPanelAnimationVar(vgui::HFont, font, "font", "NHudPanelText"); private: CNEOHud_WalkingIndicator(const CNEOHud_WalkingIndicator&other); diff --git a/src/game/client/neo/ui/neo_root_settings.cpp b/src/game/client/neo/ui/neo_root_settings.cpp index 4a03f030dc..b85cb7903e 100644 --- a/src/game/client/neo/ui/neo_root_settings.cpp +++ b/src/game/client/neo/ui/neo_root_settings.cpp @@ -690,6 +690,7 @@ void NeoSettingsRestore(NeoSettings *ns, const NeoSettings::Keys::Flags flagsKey pHUD->bShowPos = cvr->cl_showpos.GetBool(); pHUD->iShowFps = cvr->cl_showfps.GetInt(); pHUD->bEnableRangeFinder = cvr->cl_neo_hud_rangefinder_enabled.GetBool(); + pHUD->bEnableWalkIndicator = cvr->cl_neo_hud_walkindicator_enabled.GetBool(); pHUD->iExtendedKillfeed = cvr->cl_neo_hud_extended_killfeed.GetInt(); pHUD->iScoreboardPadding = cvr->cl_neo_hud_scoreboard_padding.GetInt(); pHUD->bShowHudContextHints = cvr->cl_neo_hud_context_hint_enabled.GetBool(); @@ -958,6 +959,7 @@ void NeoSettingsSave(const NeoSettings *ns) cvr->cl_showpos.SetValue(pHUD->bShowPos); cvr->cl_showfps.SetValue(pHUD->iShowFps); cvr->cl_neo_hud_rangefinder_enabled.SetValue(pHUD->bEnableRangeFinder); + cvr->cl_neo_hud_walkindicator_enabled.SetValue(pHUD->bEnableWalkIndicator); cvr->cl_neo_hud_extended_killfeed.SetValue(pHUD->iExtendedKillfeed); cvr->cl_neo_hud_scoreboard_padding.SetValue(pHUD->iScoreboardPadding); cvr->cl_neo_hud_context_hint_enabled.SetValue(pHUD->bShowHudContextHints); @@ -1683,6 +1685,7 @@ void NeoSettings_HUD(NeoSettings *ns) NeoUI::RingBoxBool(L"Show position", &pHud->bShowPos); NeoUI::RingBox(L"Show FPS", SHOWFPS_LABELS, ARRAYSIZE(SHOWFPS_LABELS), &pHud->iShowFps); NeoUI::RingBoxBool(L"Show rangefinder", &pHud->bEnableRangeFinder); + NeoUI::RingBoxBool(L"Show walk indicator", &pHud->bEnableWalkIndicator); NeoUI::RingBox(L"Extended killfeed", EXT_KILLFEED_LABELS, ARRAYSIZE(EXT_KILLFEED_LABELS), &pHud->iExtendedKillfeed); NeoUI::RingBox(L"Scoreboard padding", NEOSCOREBOARDPADDING_LABELS, NEOSCOREBOARDPADDING__TOTAL, &pHud->iScoreboardPadding); diff --git a/src/game/client/neo/ui/neo_root_settings.h b/src/game/client/neo/ui/neo_root_settings.h index 4e4d2d3304..4b17c3dbba 100644 --- a/src/game/client/neo/ui/neo_root_settings.h +++ b/src/game/client/neo/ui/neo_root_settings.h @@ -204,6 +204,7 @@ struct NeoSettings bool bShowPos; int iShowFps; bool bEnableRangeFinder; + bool bEnableWalkIndicator; int iExtendedKillfeed; bool bShowHudContextHints; bool bShowHudContextHintPlayerTakeover; @@ -274,6 +275,7 @@ struct NeoSettings CONVARREF_DEF(cl_neo_streamermode); CONVARREF_DEF(cl_neo_streamermode_autodetect_obs); CONVARREF_DEF(cl_neo_hud_rangefinder_enabled); + CONVARREF_DEF(cl_neo_hud_walkindicator_enabled); CONVARREF_DEF(sv_unlockedchapters); CONVARREF_DEF(cl_neo_hud_context_hint_enabled); CONVARREF_DEF(cl_neo_hud_context_hint_show_player_takeover_hint); diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index 0f43a6b38d..9d8f8d5aac 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -792,59 +792,6 @@ CBaseEntity *CNEO_Player::FindUseEntity() return pNearest; } -// Changing movement direction, looking around, wall-running accelerate the player. Raise the threshold. -constexpr float SILENT_THRESHOLD_GRACE = 0.7f; -#define MAX_SILENT_SPEED SILENT_THRESHOLD_GRACE * (GetFlags() & FL_DUCKING ? GetCrouchSpeed() : GetNormSpeed()) -bool CNEO_Player::ShouldPlayerMakeFootsteps(float speed) // Could simply always get speed from the player, but didnt want to risk changing the behavior of UpdateStepSound in baseplayer_shared -{ - if (speed < 0) - { - speed = GetAbsVelocity().Length(); - } - - if (const bool canBeSilent = IsInAim() || IsWalking(); - !canBeSilent) - { - return true; - } - - if (speed <= MAX_SILENT_SPEED) - { - return false; - } - - return true; -} - -float CNEO_Player::SpeedFractionToSoundThreshold(float speed) -{ - if (speed < 0) - { - speed = GetAbsVelocity().Length(); - } - - if (const bool canBeSilent = IsInAim() || IsWalking()) - { - const float bottom = GetPlayerMaxSpeed(); - if (speed < bottom) - { - return 0.f; - } - - float top = MAX_SILENT_SPEED; - if (speed > top) - { - return 1.f; - } - - top -= bottom; - speed -= bottom; - return top != 0 ? speed / top : 1.f; - } - - return 1.f; -} - void CNEO_Player::CheckVisionButtons() { if (m_iNeoClass == NEO_CLASS_VIP) diff --git a/src/game/shared/neo/neo_player_shared.h b/src/game/shared/neo/neo_player_shared.h index 181f3b85bb..034aac970f 100644 --- a/src/game/shared/neo/neo_player_shared.h +++ b/src/game/shared/neo/neo_player_shared.h @@ -258,6 +258,7 @@ static_assert(NEO_ZOOM_SPEED != 0.0f, "Divide by zero"); #define COLOR_NEO_GREEN Color(154, 255, 154, 255) #define COLOR_NEO_ORANGE Color(243, 190, 52, 255) #define COLOR_NEO_WHITE Color(218, 217, 213, 255) +#define COLOR_NEO_WHITE_STR "218 217 213 255" class CNEO_Player; class CNEOBaseCombatWeapon; From 2e9e5f1a1c29a3774598c91f4ff3db66f308ed8c Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Sat, 31 Oct 2026 12:03:08 +0000 Subject: [PATCH 09/15] smooth things over, set initial animismakingfootsteps value when walk key pressed, remove unused variable --- src/game/client/neo/ui/neo_hud_compass.cpp | 3 - .../neo/ui/neo_hud_walking_indicator.cpp | 55 ++++++++++++------- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/src/game/client/neo/ui/neo_hud_compass.cpp b/src/game/client/neo/ui/neo_hud_compass.cpp index 4c28588c98..14b610f3f3 100644 --- a/src/game/client/neo/ui/neo_hud_compass.cpp +++ b/src/game/client/neo/ui/neo_hud_compass.cpp @@ -143,9 +143,6 @@ static float safeAngle(float angle) { void CNEOHud_Compass::UpdateStateForNeoHudElementDraw() { - auto pFPPlayer = GetFirstPersonPlayer(); - Assert(pFPPlayer); - // Point the objective arrow to the relevant objective, if it exists if (NEORules()->GhostExists() || NEORules()->GetJuggernautMarkerPos() != vec3_origin) { diff --git a/src/game/client/neo/ui/neo_hud_walking_indicator.cpp b/src/game/client/neo/ui/neo_hud_walking_indicator.cpp index 6d18522347..a0172b8c33 100644 --- a/src/game/client/neo/ui/neo_hud_walking_indicator.cpp +++ b/src/game/client/neo/ui/neo_hud_walking_indicator.cpp @@ -20,7 +20,8 @@ CNEOHud_WalkingIndicator::CNEOHud_WalkingIndicator(const char *pElementName, vgu SetAutoDelete(true); m_iHideHudElementNumber = NEO_HUD_ELEMENT_WALKING_INDICATOR; - if (parent) { + if (parent) + { SetParent(parent); } else @@ -111,45 +112,59 @@ void CNEOHud_WalkingIndicator::DrawWalkingIndicator(C_NEO_Player * pPlayer, int if (!cl_neo_hud_walkindicator_enabled.GetBool()) return; - static float animationWalkPress = 0.f; + static float animWalkKeyPressed = 0.f; const bool isWalking = pPlayer->IsWalking(); + static float animIsMakingFootsteps = 0.f; + const bool isMakingFootsteps = pPlayer->IsMakingFootstepSounds() || !(pPlayer->GetFlags() & FL_ONGROUND); if (isWalking) { - animationWalkPress += gpGlobals->frametime * animationSpeed; + if (animWalkKeyPressed == 0.f) + { + if (isMakingFootsteps) + { + animIsMakingFootsteps = 1.f; + } + else + { + animIsMakingFootsteps = 0.f; + } + } + animWalkKeyPressed += gpGlobals->frametime * animationSpeed; } else { - animationWalkPress -= gpGlobals->frametime * animationSpeed; + animWalkKeyPressed -= gpGlobals->frametime * animationSpeed; } - animationWalkPress = Clamp(animationWalkPress, 0.f, 1.f); + animWalkKeyPressed = Clamp(animWalkKeyPressed, 0.f, 1.f); - if (animationWalkPress == 0.f) + if (animWalkKeyPressed == 0.f) { offset += textHeight; return; } - static float animationFootstepThreshold = 0.f; - const bool isMakingFootsteps = pPlayer->IsMakingFootstepSounds(); - if (isMakingFootsteps && isWalking) + if (isMakingFootsteps) { - animationFootstepThreshold += gpGlobals->frametime * animationSpeed; + animIsMakingFootsteps += gpGlobals->frametime * animationSpeed; } else { - animationFootstepThreshold -= gpGlobals->frametime * animationSpeed; + animIsMakingFootsteps -= gpGlobals->frametime * animationSpeed; } - animationFootstepThreshold = Clamp(animationFootstepThreshold, 0.f, 1.f); + animIsMakingFootsteps = Clamp(animIsMakingFootsteps, 0.f, 1.f); + + const float animWalkKeyPressedSmooth = animWalkKeyPressed * animWalkKeyPressed * (3.0f - 2.0f * animWalkKeyPressed); + const float animIsMakingFootstepsSmoothStep = animIsMakingFootsteps * animIsMakingFootsteps * (3.0f - 2.0f * animIsMakingFootsteps); + const float inverseAnimIsMakingFootstepsSmooth = 1.f - animIsMakingFootstepsSmoothStep; - const float inverseAnimationFootstepThreshold = 1.f - animationFootstepThreshold; - const Color finalColor = Color((color2.r() * animationFootstepThreshold) + (color.r() * inverseAnimationFootstepThreshold), - (color2.g() * animationFootstepThreshold) + (color.g() * inverseAnimationFootstepThreshold), - (color2.b() * animationFootstepThreshold) + (color.b() * inverseAnimationFootstepThreshold), - ((color2.a() * animationFootstepThreshold) + (color.a() * inverseAnimationFootstepThreshold)) * animationWalkPress); + const Color finalColor = Color((color2.r() * animIsMakingFootstepsSmoothStep) + (color.r() * inverseAnimIsMakingFootstepsSmooth), + (color2.g() * animIsMakingFootstepsSmoothStep) + (color.g() * inverseAnimIsMakingFootstepsSmooth), + (color2.b() * animIsMakingFootstepsSmoothStep) + (color.b() * inverseAnimIsMakingFootstepsSmooth), + ((color2.a() * animIsMakingFootstepsSmoothStep) + (color.a() * inverseAnimIsMakingFootstepsSmooth)) * animWalkKeyPressedSmooth); vgui::surface()->DrawSetTextFont(font); - if (isWalking && isMakingFootsteps) + if (animIsMakingFootsteps > 0.f) { - vgui::surface()->DrawSetTextColor(finalColor.r(), finalColor.g(), finalColor.b(), finalColor.a() * animationFootstepThreshold); + vgui::surface()->DrawSetTextColor(finalColor.r(), finalColor.g(), finalColor.b(), finalColor.a() * animIsMakingFootstepsSmoothStep); vgui::surface()->DrawSetTextPos(0, offset); vgui::surface()->DrawPrintText(notWalkingText, ARRAYSIZE(notWalkingText) - 1); } @@ -162,7 +177,7 @@ void CNEOHud_WalkingIndicator::DrawWalkingIndicator(C_NEO_Player * pPlayer, int void CNEOHud_WalkingIndicator::DrawNeoHudElement() { - if (!ShouldDraw()) + if (!ShouldDraw() || !visible) return; C_NEO_Player* pLocalPlayer = C_NEO_Player::GetLocalNEOPlayer(); From a16a5c09e37dbb51ff19097d3db7b5fe3d31fbc6 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Sat, 31 Oct 2026 12:15:32 +0000 Subject: [PATCH 10/15] remove unused includes --- src/game/client/neo/ui/neo_hud_compass.cpp | 9 +-------- src/game/client/neo/ui/neo_hud_walking_indicator.cpp | 1 - 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/game/client/neo/ui/neo_hud_compass.cpp b/src/game/client/neo/ui/neo_hud_compass.cpp index 14b610f3f3..094397fb4c 100644 --- a/src/game/client/neo/ui/neo_hud_compass.cpp +++ b/src/game/client/neo/ui/neo_hud_compass.cpp @@ -1,20 +1,13 @@ -#include "cbase.h" -#include "neo_hud_compass.h" +#include "neo_hud_compass.h" #include "c_neo_player.h" #include "neo_gamerules.h" #include "view.h" #include "iclientmode.h" -#include #include -#include -#include #include -#include -#include "ienginevgui.h" - #include "c_team.h" // memdbgon must be the last include file in a .cpp file!!! diff --git a/src/game/client/neo/ui/neo_hud_walking_indicator.cpp b/src/game/client/neo/ui/neo_hud_walking_indicator.cpp index a0172b8c33..e88df035ae 100644 --- a/src/game/client/neo/ui/neo_hud_walking_indicator.cpp +++ b/src/game/client/neo/ui/neo_hud_walking_indicator.cpp @@ -1,4 +1,3 @@ -#include "cbase.h" #include "neo_hud_walking_indicator.h" #include "iclientmode.h" From 109df8f2c0c8aa5d8bbe04021ff9a9e6d375070d Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Sat, 31 Oct 2026 12:16:39 +0000 Subject: [PATCH 11/15] rearange should draw check --- src/game/client/neo/ui/neo_hud_walking_indicator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/client/neo/ui/neo_hud_walking_indicator.cpp b/src/game/client/neo/ui/neo_hud_walking_indicator.cpp index e88df035ae..bff6e4d166 100644 --- a/src/game/client/neo/ui/neo_hud_walking_indicator.cpp +++ b/src/game/client/neo/ui/neo_hud_walking_indicator.cpp @@ -176,7 +176,7 @@ void CNEOHud_WalkingIndicator::DrawWalkingIndicator(C_NEO_Player * pPlayer, int void CNEOHud_WalkingIndicator::DrawNeoHudElement() { - if (!ShouldDraw() || !visible) + if (!visible || !ShouldDraw()) return; C_NEO_Player* pLocalPlayer = C_NEO_Player::GetLocalNEOPlayer(); From 3140c2518b5f5ced6802061965a48fa5a910b63a Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Sat, 31 Oct 2026 12:18:51 +0000 Subject: [PATCH 12/15] unused function --- src/game/server/neo/neo_player.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/game/server/neo/neo_player.h b/src/game/server/neo/neo_player.h index f9cc170bef..3475e8b0e8 100644 --- a/src/game/server/neo/neo_player.h +++ b/src/game/server/neo/neo_player.h @@ -249,9 +249,6 @@ class CNEO_Player : public CHL2MP_Player bool IsAFK() const; bool ValidTakeoverTargetFor(CNEO_Player* pPlayerTakingOver); - bool ShouldPlayerMakeFootsteps(float speed = -1.f); - float SpeedFractionToSoundThreshold(float speed = -1.f); - private: bool m_bAllowGibbing; From 315ffb1e6ecbf6880d67a02fe0f9f86b67cab6e3 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Sat, 31 Oct 2026 12:28:28 +0000 Subject: [PATCH 13/15] remove bot change skin function --- src/game/server/neo/neo_player.cpp | 34 +----------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/src/game/server/neo/neo_player.cpp b/src/game/server/neo/neo_player.cpp index d2529bafd4..a74986f19b 100644 --- a/src/game/server/neo/neo_player.cpp +++ b/src/game/server/neo/neo_player.cpp @@ -156,8 +156,6 @@ ConVar sv_neo_warmup_godmode("sv_neo_warmup_godmode", "0", FCVAR_REPLICATED, "If ConVar bot_class("bot_class", "-1", 0, "Force all bots to spawn with the specified class number, or -1 to disable.", true, NEO_CLASS_RANDOM, true, NEO_CLASS_LOADOUTABLE_COUNT-1); static void BotChangeClassFn(const CCommand& args); ConCommand bot_changeclass("bot_changeclass", BotChangeClassFn, "Force all bots to switch to the specified class number."); -static void BotChangeSkinFn(const CCommand& args); -ConCommand bot_changeskin("bot_changeskin", BotChangeSkinFn, "Force all bots to switch to the specified skin number."); // Bot Cloak Detection Thresholds // Base detection chance ratio (0.0 - 1.0) for bots to notice a cloaked target based on difficulty @@ -4400,34 +4398,4 @@ static void BotChangeClassFn(const CCommand& args) if (player && player->IsBot() && player->GetTeamNumber() >= FIRST_GAME_TEAM) player->RequestSetClass(botClass); } -} - -static void BotChangeSkinFn(const CCommand& args) -{ - constexpr int minValue = NEO_SKIN_FIRST; - constexpr int maxValue = NEO_SKIN__ENUM_COUNT - 1; - - const auto nag = [&args]() { - Msg("Format: %s \n", args.Arg(0), minValue, maxValue); - }; - - if (args.ArgC() != 2) - { - nag(); - return; - } - - const int botSkin = V_atoi(args.Arg(1)); - if (botSkin < minValue || botSkin > maxValue) - { - nag(); - return; - } - - for (int i = 1; i <= gpGlobals->maxClients; ++i) - { - auto* player = assert_cast(UTIL_PlayerByIndex(i)); - if (player && player->IsBot() && player->GetTeamNumber() >= FIRST_GAME_TEAM) - player->RequestSetSkin(botSkin); - } -} +} \ No newline at end of file From 829910f889322373596fa170cab2fa604c93d927 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Sat, 31 Oct 2026 12:35:31 +0000 Subject: [PATCH 14/15] prefix m_, assert cast, split long line --- .../neo/ui/neo_hud_walking_indicator.cpp | 37 ++++++++++--------- .../client/neo/ui/neo_hud_walking_indicator.h | 14 +++---- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/game/client/neo/ui/neo_hud_walking_indicator.cpp b/src/game/client/neo/ui/neo_hud_walking_indicator.cpp index bff6e4d166..61042ad397 100644 --- a/src/game/client/neo/ui/neo_hud_walking_indicator.cpp +++ b/src/game/client/neo/ui/neo_hud_walking_indicator.cpp @@ -40,14 +40,14 @@ void CNEOHud_WalkingIndicator::ApplySchemeSettings(vgui::IScheme* pScheme) BaseClass::ApplySchemeSettings(pScheme); int w,h; - vgui::surface()->GetTextSize(font, notWalkingText, notWalkingTextWidth, h); + vgui::surface()->GetTextSize(m_hFont, notWalkingText, notWalkingTextWidth, h); int walkingTextWidth; - vgui::surface()->GetTextSize(font, walkingText, walkingTextWidth, h); - textHeight = vgui::surface()->GetFontTall(font); + vgui::surface()->GetTextSize(m_hFont, walkingText, walkingTextWidth, h); + textHeight = vgui::surface()->GetFontTall(m_hFont); vgui::ipanel()->GetSize( GetVParent(), w, h ); - SetBounds(xpos, ypos, w - xpos, textHeight * 2); + SetBounds(m_iXpos, m_iYpos, w - m_iXpos, textHeight * 2); SetFgColor(COLOR_TRANSPARENT); SetBgColor(COLOR_TRANSPARENT); } @@ -96,8 +96,8 @@ void CNEOHud_WalkingIndicator::DrawRangeFinder(C_NEO_Player * pPlayer, int &offs if (pPlayer->IsInAim()) { - vgui::surface()->DrawSetTextColor(color); - vgui::surface()->DrawSetTextFont(font); + vgui::surface()->DrawSetTextColor(m_color); + vgui::surface()->DrawSetTextFont(m_hFont); vgui::surface()->DrawSetTextPos(notWalkingTextWidth, offset); vgui::surface()->DrawPrintText(m_wszRangeFinder, ARRAYSIZE(m_wszRangeFinder) - 1); } @@ -128,11 +128,11 @@ void CNEOHud_WalkingIndicator::DrawWalkingIndicator(C_NEO_Player * pPlayer, int animIsMakingFootsteps = 0.f; } } - animWalkKeyPressed += gpGlobals->frametime * animationSpeed; + animWalkKeyPressed += gpGlobals->frametime * m_flAnimationSpeed; } else { - animWalkKeyPressed -= gpGlobals->frametime * animationSpeed; + animWalkKeyPressed -= gpGlobals->frametime * m_flAnimationSpeed; } animWalkKeyPressed = Clamp(animWalkKeyPressed, 0.f, 1.f); @@ -144,11 +144,11 @@ void CNEOHud_WalkingIndicator::DrawWalkingIndicator(C_NEO_Player * pPlayer, int if (isMakingFootsteps) { - animIsMakingFootsteps += gpGlobals->frametime * animationSpeed; + animIsMakingFootsteps += gpGlobals->frametime * m_flAnimationSpeed; } else { - animIsMakingFootsteps -= gpGlobals->frametime * animationSpeed; + animIsMakingFootsteps -= gpGlobals->frametime * m_flAnimationSpeed; } animIsMakingFootsteps = Clamp(animIsMakingFootsteps, 0.f, 1.f); @@ -156,11 +156,11 @@ void CNEOHud_WalkingIndicator::DrawWalkingIndicator(C_NEO_Player * pPlayer, int const float animIsMakingFootstepsSmoothStep = animIsMakingFootsteps * animIsMakingFootsteps * (3.0f - 2.0f * animIsMakingFootsteps); const float inverseAnimIsMakingFootstepsSmooth = 1.f - animIsMakingFootstepsSmoothStep; - const Color finalColor = Color((color2.r() * animIsMakingFootstepsSmoothStep) + (color.r() * inverseAnimIsMakingFootstepsSmooth), - (color2.g() * animIsMakingFootstepsSmoothStep) + (color.g() * inverseAnimIsMakingFootstepsSmooth), - (color2.b() * animIsMakingFootstepsSmoothStep) + (color.b() * inverseAnimIsMakingFootstepsSmooth), - ((color2.a() * animIsMakingFootstepsSmoothStep) + (color.a() * inverseAnimIsMakingFootstepsSmooth)) * animWalkKeyPressedSmooth); - vgui::surface()->DrawSetTextFont(font); + const Color finalColor = Color((m_color2.r() * animIsMakingFootstepsSmoothStep) + (m_color.r() * inverseAnimIsMakingFootstepsSmooth), + (m_color2.g() * animIsMakingFootstepsSmoothStep) + (m_color.g() * inverseAnimIsMakingFootstepsSmooth), + (m_color2.b() * animIsMakingFootstepsSmoothStep) + (m_color.b() * inverseAnimIsMakingFootstepsSmooth), + ((m_color2.a() * animIsMakingFootstepsSmoothStep) + (m_color.a() * inverseAnimIsMakingFootstepsSmooth)) * animWalkKeyPressedSmooth); + vgui::surface()->DrawSetTextFont(m_hFont); if (animIsMakingFootsteps > 0.f) { vgui::surface()->DrawSetTextColor(finalColor.r(), finalColor.g(), finalColor.b(), finalColor.a() * animIsMakingFootstepsSmoothStep); @@ -176,15 +176,16 @@ void CNEOHud_WalkingIndicator::DrawWalkingIndicator(C_NEO_Player * pPlayer, int void CNEOHud_WalkingIndicator::DrawNeoHudElement() { - if (!visible || !ShouldDraw()) + if (!m_bVisible || !ShouldDraw()) return; C_NEO_Player* pLocalPlayer = C_NEO_Player::GetLocalNEOPlayer(); if (!pLocalPlayer) return; - C_NEO_Player* pTargetPlayer = pLocalPlayer->IsObserver() && (pLocalPlayer->GetObserverMode() == OBS_MODE_IN_EYE || pLocalPlayer->GetObserverMode() == OBS_MODE_CHASE) ? static_cast(pLocalPlayer->GetObserverTarget()) - : pLocalPlayer; + C_NEO_Player* pTargetPlayer = pLocalPlayer->IsObserver() && (pLocalPlayer->GetObserverMode() == OBS_MODE_IN_EYE || pLocalPlayer->GetObserverMode() == OBS_MODE_CHASE) + ? assert_cast(pLocalPlayer->GetObserverTarget()) + : pLocalPlayer; if (!pTargetPlayer || !pTargetPlayer->IsAlive()) return; diff --git a/src/game/client/neo/ui/neo_hud_walking_indicator.h b/src/game/client/neo/ui/neo_hud_walking_indicator.h index c9faca8453..b70fd2ec4d 100644 --- a/src/game/client/neo/ui/neo_hud_walking_indicator.h +++ b/src/game/client/neo/ui/neo_hud_walking_indicator.h @@ -23,16 +23,16 @@ class CNEOHud_WalkingIndicator : public CNEOHud_ChildElement, public CHudElement void DrawRangeFinder(C_NEO_Player* pPlayer, int &offset); void DrawWalkingIndicator(C_NEO_Player* pPlayer, int &offset); - CPanelAnimationVarAliasType(bool, visible, "visible", "1", "bool"); + CPanelAnimationVarAliasType(bool, m_bVisible, "visible", "1", "bool"); - CPanelAnimationVarAliasType(int, xpos, "xpos", "r203", "proportional_xpos"); - CPanelAnimationVarAliasType(int, ypos, "ypos", "446", "proportional_ypos"); + CPanelAnimationVarAliasType(int, m_iXpos, "xpos", "r203", "proportional_xpos"); + CPanelAnimationVarAliasType(int, m_iYpos, "ypos", "446", "proportional_ypos"); - CPanelAnimationVar(float, animationSpeed, "animationSpeed", "2"); + CPanelAnimationVar(float, m_flAnimationSpeed, "animationSpeed", "2"); - CPanelAnimationVarAliasType(Color, color, "color", COLOR_NEO_WHITE_STR, "Color"); - CPanelAnimationVarAliasType(Color, color2, "color2", "255 150 150 255", "Color"); - CPanelAnimationVar(vgui::HFont, font, "font", "NHudPanelText"); + CPanelAnimationVarAliasType(Color, m_color, "color", COLOR_NEO_WHITE_STR, "Color"); + CPanelAnimationVarAliasType(Color, m_color2, "color2", "255 150 150 255", "Color"); + CPanelAnimationVar(vgui::HFont, m_hFont, "font", "NHudPanelText"); private: CNEOHud_WalkingIndicator(const CNEOHud_WalkingIndicator&other); From 58adde2df989e89fdaa7dabb4d5594a7139f6d2b Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Sat, 31 Oct 2026 12:41:00 +0000 Subject: [PATCH 15/15] forgot about this one --- src/game/client/neo/ui/neo_hud_walking_indicator.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/game/client/neo/ui/neo_hud_walking_indicator.cpp b/src/game/client/neo/ui/neo_hud_walking_indicator.cpp index 61042ad397..16a832994b 100644 --- a/src/game/client/neo/ui/neo_hud_walking_indicator.cpp +++ b/src/game/client/neo/ui/neo_hud_walking_indicator.cpp @@ -61,8 +61,9 @@ void CNEOHud_WalkingIndicator::UpdateStateForNeoHudElementDraw() if (!pLocalPlayer) return; - C_NEO_Player* pTargetPlayer = pLocalPlayer->IsObserver() && (pLocalPlayer->GetObserverMode() == OBS_MODE_IN_EYE || pLocalPlayer->GetObserverMode() == OBS_MODE_CHASE) ? static_cast(pLocalPlayer->GetObserverTarget()) - : pLocalPlayer; + C_NEO_Player* pTargetPlayer = pLocalPlayer->IsObserver() && (pLocalPlayer->GetObserverMode() == OBS_MODE_IN_EYE || pLocalPlayer->GetObserverMode() == OBS_MODE_CHASE) + ? static_cast(pLocalPlayer->GetObserverTarget()) + : pLocalPlayer; if (!pTargetPlayer || !pTargetPlayer->IsAlive()) return;