From dc4cfc3f2398c51730c732e829a65e6a39b122be Mon Sep 17 00:00:00 2001 From: Rain Date: Wed, 30 Sep 2026 20:53:02 +0300 Subject: [PATCH 01/32] wip --- src/game/client/neo/ui/neo_hud_player_ping.cpp | 16 +++++++++++----- src/game/client/neo/ui/neo_hud_player_ping.h | 5 +++-- src/game/shared/neo/neo_player_shared.cpp | 6 ++++++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/game/client/neo/ui/neo_hud_player_ping.cpp b/src/game/client/neo/ui/neo_hud_player_ping.cpp index 7ca9e7f6dc..f915075cd8 100644 --- a/src/game/client/neo/ui/neo_hud_player_ping.cpp +++ b/src/game/client/neo/ui/neo_hud_player_ping.cpp @@ -12,6 +12,7 @@ #include "voice_status.h" #include "hud_chat.h" #include "engine/IEngineSound.h" +#include "gamestringpool.h" #include "ienginevgui.h" @@ -133,7 +134,8 @@ void CNEOHud_PlayerPing::FireGameEvent(IGameEvent* event) const Vector worldpos = Vector(event->GetInt("pingx"), event->GetInt("pingy"), event->GetInt("pingz")); bool ghosterPing = event->GetBool("ghosterping"); - SetPos(playerIndex - 1, playerTeam, worldpos, ghosterPing); + const char* placeName = event->GetString("place"); + SetPos(playerIndex - 1, playerTeam, worldpos, ghosterPing, placeName); } else if (!Q_stricmp(eventName, "round_start")) { @@ -315,7 +317,8 @@ void CNEOHud_PlayerPing::UpdateDistanceToPlayer(C_BasePlayer* player, const int m_iPlayerPings[playerSlot].noLineOfSight = tr.fraction < 0.999; } -void CNEOHud_PlayerPing::SetPos(const int playerSlot, const int playerTeam, const Vector& pos, bool ghosterPing) { +void CNEOHud_PlayerPing::SetPos(const int playerSlot, const int playerTeam, const Vector& pos, bool ghosterPing, const char* placeName) +{ constexpr float PLAYER_PING_LIFETIME = 8; auto localPlayer = C_NEO_Player::GetLocalNEOPlayer(); if (!localPlayer) { return; } @@ -324,6 +327,7 @@ void CNEOHud_PlayerPing::SetPos(const int playerSlot, const int playerTeam, cons m_iPlayerPings[playerSlot].deathTime = gpGlobals->curtime + PLAYER_PING_LIFETIME; m_iPlayerPings[playerSlot].team = playerTeam; m_iPlayerPings[playerSlot].ghosterPing = ghosterPing; + m_iPlayerPings[playerSlot].placeName = AllocPooledString(placeName); UpdateDistanceToPlayer(localPlayer, playerSlot); const int playerPingsInSpectate = cl_neo_player_pings_in_spectate.GetInt(); @@ -348,13 +352,13 @@ void CNEOHud_PlayerPing::SetPos(const int playerSlot, const int playerTeam, cons return; } } - NotifyPing(playerSlot); + NotifyPing(playerSlot, m_iPlayerPings[playerSlot].placeName); } ConVar snd_ping_volume("snd_ping_volume", "0.33", FCVAR_ARCHIVE, "Player ping volume", true, 0.f, true, 1.f); ConVar cl_neo_player_pings_chat_message("cl_neo_player_pings_chat_message", "1", FCVAR_ARCHIVE, "Show message in chat for player pings.", true, 0, true, 1); // NEO TODO (Adam) custom chat filter instead? ConVar cl_neo_player_pings_time_between_sounds("cl_neo_player_pings_time_between_sounds", "0", FCVAR_ARCHIVE, "Minimum time between two ping sounds", true, 0, false, 0); -void CNEOHud_PlayerPing::NotifyPing(const int playerSlot) +void CNEOHud_PlayerPing::NotifyPing(const int playerSlot, const char* placeName) { C_NEO_Player* pPlayer = static_cast(UTIL_PlayerByIndex(playerSlot + 1)); if (!pPlayer || pPlayer->IsLocalPlayer()) @@ -370,7 +374,9 @@ void CNEOHud_PlayerPing::NotifyPing(const int playerSlot) CBaseHudChat* hudChat = (CBaseHudChat*)GET_HUDELEMENT(CHudChat); if (hudChat) { - hudChat->ChatPrintf(0, CHAT_FILTER_NONE, "%s pinged a location\n", pPlayer->GetNeoPlayerName()); + hudChat->ChatPrintf(0, CHAT_FILTER_NONE, "%s pinged %s\n", + pPlayer->GetNeoPlayerName(), + placeName && *placeName ? placeName : "a location"); } } } diff --git a/src/game/client/neo/ui/neo_hud_player_ping.h b/src/game/client/neo/ui/neo_hud_player_ping.h index a8a844e237..a2e14aa1d8 100644 --- a/src/game/client/neo/ui/neo_hud_player_ping.h +++ b/src/game/client/neo/ui/neo_hud_player_ping.h @@ -12,6 +12,7 @@ struct playerPing int team; bool noLineOfSight; bool ghosterPing; + const char* placeName; }; class CNEOHud_PlayerPing : public CNEOHud_ChildElement, public CHudElement, public vgui::Panel @@ -36,8 +37,8 @@ class CNEOHud_PlayerPing : public CNEOHud_ChildElement, public CHudElement, publ private: int GetStringPixelWidth(wchar_t* pString, vgui::HFont hFont); void UpdateDistanceToPlayer(C_BasePlayer* player, const int pingIndex); - void SetPos(const int index, const int playerTeam, const Vector& pos, bool ghosterPing); - void NotifyPing(const int playerSlot); + void SetPos(const int index, const int playerTeam, const Vector& pos, bool ghosterPing, const char* placeName); + void NotifyPing(const int playerSlot, const char* placeName); private: playerPing m_iPlayerPings[MAX_PLAYERS] = {}; diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index d5f523c88c..a71623d959 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -178,8 +178,14 @@ void CheckPingButton(CNEO_Player* player) event->SetInt("pingz", tr.endpos.z); event->SetBool("ghosterping", player->IsCarryingGhost() || player->m_iNeoClass == NEO_CLASS_VIP); #ifdef GAME_DLL + if (const auto navArea = TheNavMesh ? TheNavMesh->GetNavArea(tr.endpos) : nullptr; navArea) + event->SetString("place", TheNavMesh->PlaceToName(navArea->GetPlace())); + else + event->SetString("place", ""); + gameeventmanager->FireEvent(event); #else + event->SetString("place", ""); gameeventmanager->FireEventClientSide(event); #endif // GAME_DLL constexpr float NEO_PING_DELAY = 2.f; From 97b4bce6992580acf0d91c5a84bdcfa78405d1df Mon Sep 17 00:00:00 2001 From: Rain Date: Thu, 1 Oct 2026 10:34:37 +0300 Subject: [PATCH 02/32] wip --- game/neo/resource/NeoModEvents.res | 1 + src/game/client/neo/ui/neo_hud_player_ping.cpp | 2 +- src/game/shared/neo/neo_player_shared.cpp | 5 +---- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/game/neo/resource/NeoModEvents.res b/game/neo/resource/NeoModEvents.res index 9d62eb6227..e40d42866a 100644 --- a/game/neo/resource/NeoModEvents.res +++ b/game/neo/resource/NeoModEvents.res @@ -89,6 +89,7 @@ "pingy" "short" // ping y position "pingz" "short" // ping z position "ghosterping" "bool" // the player is carrying the ghost + "placename" "string" // nav place name of the pinged location (may be empty "" string) } "ghost_enemy_callout" diff --git a/src/game/client/neo/ui/neo_hud_player_ping.cpp b/src/game/client/neo/ui/neo_hud_player_ping.cpp index f915075cd8..8fdb3d54ff 100644 --- a/src/game/client/neo/ui/neo_hud_player_ping.cpp +++ b/src/game/client/neo/ui/neo_hud_player_ping.cpp @@ -134,7 +134,7 @@ void CNEOHud_PlayerPing::FireGameEvent(IGameEvent* event) const Vector worldpos = Vector(event->GetInt("pingx"), event->GetInt("pingy"), event->GetInt("pingz")); bool ghosterPing = event->GetBool("ghosterping"); - const char* placeName = event->GetString("place"); + const char* placeName = event->GetString("placename"); SetPos(playerIndex - 1, playerTeam, worldpos, ghosterPing, placeName); } else if (!Q_stricmp(eventName, "round_start")) diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index a71623d959..c97defcafa 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -179,13 +179,10 @@ void CheckPingButton(CNEO_Player* player) event->SetBool("ghosterping", player->IsCarryingGhost() || player->m_iNeoClass == NEO_CLASS_VIP); #ifdef GAME_DLL if (const auto navArea = TheNavMesh ? TheNavMesh->GetNavArea(tr.endpos) : nullptr; navArea) - event->SetString("place", TheNavMesh->PlaceToName(navArea->GetPlace())); - else - event->SetString("place", ""); + event->SetString("placename", TheNavMesh->PlaceToName(navArea->GetPlace())); gameeventmanager->FireEvent(event); #else - event->SetString("place", ""); gameeventmanager->FireEventClientSide(event); #endif // GAME_DLL constexpr float NEO_PING_DELAY = 2.f; From 55cf9b56058c30400124aa05febca299b9978bae Mon Sep 17 00:00:00 2001 From: Rain Date: Thu, 1 Oct 2026 12:21:53 +0300 Subject: [PATCH 03/32] wip --- src/game/server/nav_mesh.cpp | 18 ++++++++- src/game/server/nav_mesh.h | 10 +++++ src/game/shared/neo/neo_player_shared.cpp | 49 ++++++++++++++++++++++- 3 files changed, 74 insertions(+), 3 deletions(-) diff --git a/src/game/server/nav_mesh.cpp b/src/game/server/nav_mesh.cpp index dc7d226781..1638ab894d 100644 --- a/src/game/server/nav_mesh.cpp +++ b/src/game/server/nav_mesh.cpp @@ -853,7 +853,13 @@ CNavArea *CNavMesh::GetNavArea( CBaseEntity *pEntity, int nFlags, float flBeneat * Used to find initial area if we start off of the mesh. * @todo Make sure area is not on the other side of the wall from goal. */ +#ifdef NEO +template +CNavArea *CNavMesh::GetNearestNavArea( const Vector &pos, bool anyZ, float maxDist, bool checkLOS, bool checkGround, int team, + F&& ignorePredicate ) const +#else CNavArea *CNavMesh::GetNearestNavArea( const Vector &pos, bool anyZ, float maxDist, bool checkLOS, bool checkGround, int team ) const +#endif { VPROF_BUDGET( "CNavMesh::GetNearestNavArea", "NextBot" ); @@ -869,6 +875,9 @@ CNavArea *CNavMesh::GetNearestNavArea( const Vector &pos, bool anyZ, float maxDi close = GetNavArea( pos ); if ( close ) { +#ifdef NEO + if (!ignorePredicate || !ignorePredicate(close)) +#endif return close; } } @@ -954,6 +963,11 @@ CNavArea *CNavMesh::GetNearestNavArea( const Vector &pos, bool anyZ, float maxDi // mark as visited area->m_nearNavSearchMarker = searchMarker; +#ifdef NEO + if (ignorePredicate && ignorePredicate(area)) + continue; +#endif + Vector areaPos; area->GetClosestPointOnArea( source, &areaPos ); @@ -1030,7 +1044,9 @@ CNavArea *CNavMesh::GetNearestNavArea( const Vector &pos, bool anyZ, float maxDi } } } - +#ifdef NEO + AssertMsg(!ignorePredicate || !ignorePredicate(close), "Result should be ignored but it wasn't"); +#endif return close; } diff --git a/src/game/server/nav_mesh.h b/src/game/server/nav_mesh.h index 48ae68577d..83ca5cea02 100644 --- a/src/game/server/nav_mesh.h +++ b/src/game/server/nav_mesh.h @@ -334,7 +334,13 @@ class CNavMesh : public CGameEventListener CNavArea *GetNavArea( const Vector &pos, float beneathLimt = 120.0f ) const; // given a position, return the nav area that IsOverlapping and is *immediately* beneath it CNavArea *GetNavArea( CBaseEntity *pEntity, int nGetNavAreaFlags, float flBeneathLimit = 120.0f ) const; CNavArea *GetNavAreaByID( unsigned int id ) const; +#ifdef NEO + template + CNavArea *GetNearestNavArea( const Vector &pos, bool anyZ = false, float maxDist = 10000.0f, bool checkLOS = false, bool checkGround = true, int team = TEAM_ANY, + F&& ignorePredicate = nullptr ) const; +#else CNavArea *GetNearestNavArea( const Vector &pos, bool anyZ = false, float maxDist = 10000.0f, bool checkLOS = false, bool checkGround = true, int team = TEAM_ANY ) const; +#endif CNavArea *GetNearestNavArea( CBaseEntity *pEntity, int nGetNavAreaFlags = GETNAVAREA_CHECK_GROUND, float maxDist = 10000.0f ) const; Place GetPlace( const Vector &pos ) const; // return Place at given coordinate @@ -870,7 +876,11 @@ class CNavMesh : public CGameEventListener float yMax = yMin + area->GetSizeY(); // clip ray to area +#ifdef NEO + Vector exit = vec3_invalid; +#else Vector exit; +#endif NavDirType edge = NUM_DIRECTIONS; if ( to.x < 0.0f ) diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index c97defcafa..38f3228bde 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -25,6 +25,7 @@ #ifdef GAME_DLL #include "basetypes.h" +#include "nav_mesh.h" #endif #include "convar.h" @@ -178,8 +179,52 @@ void CheckPingButton(CNEO_Player* player) event->SetInt("pingz", tr.endpos.z); event->SetBool("ghosterping", player->IsCarryingGhost() || player->m_iNeoClass == NEO_CLASS_VIP); #ifdef GAME_DLL - if (const auto navArea = TheNavMesh ? TheNavMesh->GetNavArea(tr.endpos) : nullptr; navArea) - event->SetString("placename", TheNavMesh->PlaceToName(navArea->GetPlace())); + if (TheNavMesh) + { + const auto fnGetNearbyNavArea = [](const Vector& pingPos, const bool requireAreaBeNamed)->CNavArea* { + Assert(TheNavMesh); + constexpr bool anyZ = true; + constexpr float maxDist = 10000; // lax because outdoor areas can be *big* - we can call it "near " to alleviate ambiguity + constexpr bool checkLOS = false; + constexpr bool checkGround = false; + constexpr int team = TEAM_ANY; + const auto ignorePredicate = [requireAreaBeNamed](const CNavArea* area)->bool { + return requireAreaBeNamed && !area || !TheNavMesh->PlaceToName(area->GetPlace()); + }; + return TheNavMesh->GetNearestNavArea(pingPos, anyZ, maxDist, checkLOS, checkGround, team, ignorePredicate); + }; + + const auto actualNavAreaOfPing = fnGetNearbyNavArea(tr.endpos, false); + const auto nearestNamedNavAreaOfPing = !actualNavAreaOfPing ? nullptr : fnGetNearbyNavArea(tr.endpos, true); + const auto nearestNamedNavAreaOfPinger = !nearestNamedNavAreaOfPing ? nullptr : fnGetNearbyNavArea(eyePosition, true); + + if (actualNavAreaOfPing && nearestNamedNavAreaOfPing && nearestNamedNavAreaOfPinger) + { + const bool pingPlaceNameIsExact = (actualNavAreaOfPing == nearestNamedNavAreaOfPing); + + const char* placeName = nullptr; + const auto fun = [&placeName](const CNavArea* area)->void { + Assert(area); + if (!placeName) // can't bail from the enumeration so just guard this assignment + { + placeName = TheNavMesh->PlaceToName(area->GetPlace()); + AssertMsg(!placeName || *placeName, "placename is !null empty string; probably a mistake(?)"); + } + }; + TheNavMesh->ForAllAreasAlongLine(fun, nearestNamedNavAreaOfPing, nearestNamedNavAreaOfPinger); + + if (!pingPlaceNameIsExact) + { + constexpr const char nearPhrase[] = "near "; + char placeFmtBuf[ARRAYSIZE(nearPhrase) - 1 + MAX_PLACE_NAME_LENGTH]; + V_sprintf_safe(placeFmtBuf, "%s%s", nearPhrase, placeName); + placeName = &placeFmtBuf[0]; + } + + event->SetString("placename", placeName); + DevMsg("Place name: %s\n", placeName); + } + } gameeventmanager->FireEvent(event); #else From e0088077f7adc98eefbcdedc40f7124bd5ed5b4b Mon Sep 17 00:00:00 2001 From: Rain Date: Thu, 1 Oct 2026 12:49:50 +0300 Subject: [PATCH 04/32] wip --- src/game/server/nav_mesh.cpp | 3 +-- src/game/server/nav_mesh.h | 7 +++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/game/server/nav_mesh.cpp b/src/game/server/nav_mesh.cpp index 1638ab894d..c128410a68 100644 --- a/src/game/server/nav_mesh.cpp +++ b/src/game/server/nav_mesh.cpp @@ -854,9 +854,8 @@ CNavArea *CNavMesh::GetNavArea( CBaseEntity *pEntity, int nFlags, float flBeneat * @todo Make sure area is not on the other side of the wall from goal. */ #ifdef NEO -template CNavArea *CNavMesh::GetNearestNavArea( const Vector &pos, bool anyZ, float maxDist, bool checkLOS, bool checkGround, int team, - F&& ignorePredicate ) const + std::function ignorePredicate ) const #else CNavArea *CNavMesh::GetNearestNavArea( const Vector &pos, bool anyZ, float maxDist, bool checkLOS, bool checkGround, int team ) const #endif diff --git a/src/game/server/nav_mesh.h b/src/game/server/nav_mesh.h index 83ca5cea02..7a2c4607a3 100644 --- a/src/game/server/nav_mesh.h +++ b/src/game/server/nav_mesh.h @@ -37,6 +37,10 @@ extern ConVar nav_quicksave; extern ConVar nav_show_approach_points; extern ConVar nav_show_danger; +#ifdef NEO +#include +#endif + //-------------------------------------------------------------------------------------------------------- class NavAreaCollector { @@ -335,9 +339,8 @@ class CNavMesh : public CGameEventListener CNavArea *GetNavArea( CBaseEntity *pEntity, int nGetNavAreaFlags, float flBeneathLimit = 120.0f ) const; CNavArea *GetNavAreaByID( unsigned int id ) const; #ifdef NEO - template CNavArea *GetNearestNavArea( const Vector &pos, bool anyZ = false, float maxDist = 10000.0f, bool checkLOS = false, bool checkGround = true, int team = TEAM_ANY, - F&& ignorePredicate = nullptr ) const; + std::function ignorePredicate = nullptr) const; #else CNavArea *GetNearestNavArea( const Vector &pos, bool anyZ = false, float maxDist = 10000.0f, bool checkLOS = false, bool checkGround = true, int team = TEAM_ANY ) const; #endif From c998296d742ef879b2838ffa0c48700b17d7fc64 Mon Sep 17 00:00:00 2001 From: Rain Date: Thu, 1 Oct 2026 13:03:21 +0300 Subject: [PATCH 05/32] wip --- src/game/shared/neo/neo_player_shared.cpp | 26 ++++++----------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index 38f3228bde..1cef3c68f7 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -181,38 +181,25 @@ void CheckPingButton(CNEO_Player* player) #ifdef GAME_DLL if (TheNavMesh) { - const auto fnGetNearbyNavArea = [](const Vector& pingPos, const bool requireAreaBeNamed)->CNavArea* { + const auto fnGetNearbyNavArea = [](const Vector& pingPos, const float maxDist, const bool requireAreaBeNamed)->CNavArea* { Assert(TheNavMesh); constexpr bool anyZ = true; - constexpr float maxDist = 10000; // lax because outdoor areas can be *big* - we can call it "near " to alleviate ambiguity constexpr bool checkLOS = false; constexpr bool checkGround = false; constexpr int team = TEAM_ANY; const auto ignorePredicate = [requireAreaBeNamed](const CNavArea* area)->bool { - return requireAreaBeNamed && !area || !TheNavMesh->PlaceToName(area->GetPlace()); + return requireAreaBeNamed && (!area || !TheNavMesh->PlaceToName(area->GetPlace())); }; return TheNavMesh->GetNearestNavArea(pingPos, anyZ, maxDist, checkLOS, checkGround, team, ignorePredicate); }; - const auto actualNavAreaOfPing = fnGetNearbyNavArea(tr.endpos, false); - const auto nearestNamedNavAreaOfPing = !actualNavAreaOfPing ? nullptr : fnGetNearbyNavArea(tr.endpos, true); - const auto nearestNamedNavAreaOfPinger = !nearestNamedNavAreaOfPing ? nullptr : fnGetNearbyNavArea(eyePosition, true); + const auto actualNavAreaOfPing = fnGetNearbyNavArea(tr.endpos, 1024, false); + const auto nearestNamedNavAreaOfPing = !actualNavAreaOfPing ? nullptr : fnGetNearbyNavArea(tr.endpos, 1024*10, true); - if (actualNavAreaOfPing && nearestNamedNavAreaOfPing && nearestNamedNavAreaOfPinger) + if (actualNavAreaOfPing && nearestNamedNavAreaOfPing) { const bool pingPlaceNameIsExact = (actualNavAreaOfPing == nearestNamedNavAreaOfPing); - - const char* placeName = nullptr; - const auto fun = [&placeName](const CNavArea* area)->void { - Assert(area); - if (!placeName) // can't bail from the enumeration so just guard this assignment - { - placeName = TheNavMesh->PlaceToName(area->GetPlace()); - AssertMsg(!placeName || *placeName, "placename is !null empty string; probably a mistake(?)"); - } - }; - TheNavMesh->ForAllAreasAlongLine(fun, nearestNamedNavAreaOfPing, nearestNamedNavAreaOfPinger); - + const char* placeName = TheNavMesh->PlaceToName(nearestNamedNavAreaOfPing->GetPlace()); if (!pingPlaceNameIsExact) { constexpr const char nearPhrase[] = "near "; @@ -220,7 +207,6 @@ void CheckPingButton(CNEO_Player* player) V_sprintf_safe(placeFmtBuf, "%s%s", nearPhrase, placeName); placeName = &placeFmtBuf[0]; } - event->SetString("placename", placeName); DevMsg("Place name: %s\n", placeName); } From 3ef94fd544604c3063c71f0ed4ba43d23dd95446 Mon Sep 17 00:00:00 2001 From: Rain Date: Thu, 1 Oct 2026 13:08:07 +0300 Subject: [PATCH 06/32] Add sv_neo_player_pings_calc_placename Calculating the place names can be expensive to perf, so offer cvar to disable it. --- src/game/shared/neo/neo_player_shared.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index 1cef3c68f7..0ed4d1642a 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -137,6 +137,9 @@ CBaseCombatWeapon* GetNeoWepWithBits(const CNEO_Player* player, const NEO_WEP_BI #ifdef CLIENT_DLL extern ConVar cl_neo_player_pings; +#else +static ConVar sv_neo_player_pings_calc_placename("sv_neo_player_pings_calc_placename", "1", 0, + "Whether the server should calculare place names for player pings from the nav mesh (possibly expensive)", true, false, true, true); #endif // CLIENT_DLL void CheckPingButton(CNEO_Player* player) { @@ -179,7 +182,7 @@ void CheckPingButton(CNEO_Player* player) event->SetInt("pingz", tr.endpos.z); event->SetBool("ghosterping", player->IsCarryingGhost() || player->m_iNeoClass == NEO_CLASS_VIP); #ifdef GAME_DLL - if (TheNavMesh) + if (sv_neo_player_pings_calc_placename.GetBool() && TheNavMesh) { const auto fnGetNearbyNavArea = [](const Vector& pingPos, const float maxDist, const bool requireAreaBeNamed)->CNavArea* { Assert(TheNavMesh); From 805967ab7a85b10205834a1dbc953757bd48645a Mon Sep 17 00:00:00 2001 From: Rain Date: Thu, 1 Oct 2026 13:08:21 +0300 Subject: [PATCH 07/32] wip: cleanup remove devmsg --- src/game/shared/neo/neo_player_shared.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index 0ed4d1642a..7f5061e183 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -211,7 +211,6 @@ void CheckPingButton(CNEO_Player* player) placeName = &placeFmtBuf[0]; } event->SetString("placename", placeName); - DevMsg("Place name: %s\n", placeName); } } From 9befeeea132722d8a0abff7bd7c2251ffaa8d6d9 Mon Sep 17 00:00:00 2001 From: Rain Date: Thu, 1 Oct 2026 17:36:31 +0300 Subject: [PATCH 08/32] wip: optimize remove std::function usage --- src/game/server/nav_mesh.cpp | 2 +- src/game/server/nav_mesh.h | 6 +----- src/game/shared/neo/neo_player_shared.cpp | 23 +++++++++++++---------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/game/server/nav_mesh.cpp b/src/game/server/nav_mesh.cpp index c128410a68..ff531d0a48 100644 --- a/src/game/server/nav_mesh.cpp +++ b/src/game/server/nav_mesh.cpp @@ -855,7 +855,7 @@ CNavArea *CNavMesh::GetNavArea( CBaseEntity *pEntity, int nFlags, float flBeneat */ #ifdef NEO CNavArea *CNavMesh::GetNearestNavArea( const Vector &pos, bool anyZ, float maxDist, bool checkLOS, bool checkGround, int team, - std::function ignorePredicate ) const + bool(*ignorePredicate)(const CNavArea*) ) const #else CNavArea *CNavMesh::GetNearestNavArea( const Vector &pos, bool anyZ, float maxDist, bool checkLOS, bool checkGround, int team ) const #endif diff --git a/src/game/server/nav_mesh.h b/src/game/server/nav_mesh.h index 7a2c4607a3..b85012b657 100644 --- a/src/game/server/nav_mesh.h +++ b/src/game/server/nav_mesh.h @@ -37,10 +37,6 @@ extern ConVar nav_quicksave; extern ConVar nav_show_approach_points; extern ConVar nav_show_danger; -#ifdef NEO -#include -#endif - //-------------------------------------------------------------------------------------------------------- class NavAreaCollector { @@ -340,7 +336,7 @@ class CNavMesh : public CGameEventListener CNavArea *GetNavAreaByID( unsigned int id ) const; #ifdef NEO CNavArea *GetNearestNavArea( const Vector &pos, bool anyZ = false, float maxDist = 10000.0f, bool checkLOS = false, bool checkGround = true, int team = TEAM_ANY, - std::function ignorePredicate = nullptr) const; + bool(*ignorePredicate)(const CNavArea*) = nullptr) const; #else CNavArea *GetNearestNavArea( const Vector &pos, bool anyZ = false, float maxDist = 10000.0f, bool checkLOS = false, bool checkGround = true, int team = TEAM_ANY ) const; #endif diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index 7f5061e183..be1832c955 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -184,16 +184,19 @@ void CheckPingButton(CNEO_Player* player) #ifdef GAME_DLL if (sv_neo_player_pings_calc_placename.GetBool() && TheNavMesh) { - const auto fnGetNearbyNavArea = [](const Vector& pingPos, const float maxDist, const bool requireAreaBeNamed)->CNavArea* { - Assert(TheNavMesh); - constexpr bool anyZ = true; - constexpr bool checkLOS = false; - constexpr bool checkGround = false; - constexpr int team = TEAM_ANY; - const auto ignorePredicate = [requireAreaBeNamed](const CNavArea* area)->bool { - return requireAreaBeNamed && (!area || !TheNavMesh->PlaceToName(area->GetPlace())); - }; - return TheNavMesh->GetNearestNavArea(pingPos, anyZ, maxDist, checkLOS, checkGround, team, ignorePredicate); + constexpr auto fnGetNearbyNavArea = + [](const Vector& pingPos, const float maxDist, const bool requireAreaBeNamed)->CNavArea* { + Assert(TheNavMesh); + constexpr auto ignoreNamelessPlaces = [](const CNavArea* area)->bool { + return !area || !TheNavMesh->PlaceToName(area->GetPlace()); + }; + constexpr auto ignoreNothing = [](const CNavArea*)->bool { + return false; + }; + return TheNavMesh->GetNearestNavArea(pingPos, true, maxDist, false, false, TEAM_ANY, + [requireAreaBeNamed, ignoreNamelessPlaces, ignoreNothing]() { + return requireAreaBeNamed ? ignoreNamelessPlaces : ignoreNothing; + }()); }; const auto actualNavAreaOfPing = fnGetNearbyNavArea(tr.endpos, 1024, false); From 6e8e404dc7c962af5ef4bf37866c59393444869c Mon Sep 17 00:00:00 2001 From: Rain Date: Thu, 1 Oct 2026 18:06:51 +0300 Subject: [PATCH 09/32] wip: optimize format the "near" messages client side instead of server side --- game/neo/resource/NeoModEvents.res | 1 + src/game/client/neo/ui/neo_hud_player_ping.cpp | 15 +++++++++------ src/game/client/neo/ui/neo_hud_player_ping.h | 5 +++-- src/game/shared/neo/neo_player_shared.cpp | 9 ++------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/game/neo/resource/NeoModEvents.res b/game/neo/resource/NeoModEvents.res index e40d42866a..43e9218ca5 100644 --- a/game/neo/resource/NeoModEvents.res +++ b/game/neo/resource/NeoModEvents.res @@ -90,6 +90,7 @@ "pingz" "short" // ping z position "ghosterping" "bool" // the player is carrying the ghost "placename" "string" // nav place name of the pinged location (may be empty "" string) + "exactplace" "bool" // whether the place ping is pinpoint precise on the place name (else we consider the ping to be "near" it) } "ghost_enemy_callout" diff --git a/src/game/client/neo/ui/neo_hud_player_ping.cpp b/src/game/client/neo/ui/neo_hud_player_ping.cpp index 8fdb3d54ff..3acc60b2e3 100644 --- a/src/game/client/neo/ui/neo_hud_player_ping.cpp +++ b/src/game/client/neo/ui/neo_hud_player_ping.cpp @@ -135,7 +135,8 @@ void CNEOHud_PlayerPing::FireGameEvent(IGameEvent* event) const Vector worldpos = Vector(event->GetInt("pingx"), event->GetInt("pingy"), event->GetInt("pingz")); bool ghosterPing = event->GetBool("ghosterping"); const char* placeName = event->GetString("placename"); - SetPos(playerIndex - 1, playerTeam, worldpos, ghosterPing, placeName); + bool placeIsExact = event->GetBool("exactplace"); + SetPos(playerIndex - 1, playerTeam, worldpos, ghosterPing, placeName, placeIsExact); } else if (!Q_stricmp(eventName, "round_start")) { @@ -317,7 +318,8 @@ void CNEOHud_PlayerPing::UpdateDistanceToPlayer(C_BasePlayer* player, const int m_iPlayerPings[playerSlot].noLineOfSight = tr.fraction < 0.999; } -void CNEOHud_PlayerPing::SetPos(const int playerSlot, const int playerTeam, const Vector& pos, bool ghosterPing, const char* placeName) +void CNEOHud_PlayerPing::SetPos(const int playerSlot, const int playerTeam, const Vector& pos, bool ghosterPing, + const char* placeName, bool placeIsExact) { constexpr float PLAYER_PING_LIFETIME = 8; auto localPlayer = C_NEO_Player::GetLocalNEOPlayer(); @@ -352,13 +354,13 @@ void CNEOHud_PlayerPing::SetPos(const int playerSlot, const int playerTeam, cons return; } } - NotifyPing(playerSlot, m_iPlayerPings[playerSlot].placeName); + NotifyPing(playerSlot, m_iPlayerPings[playerSlot].placeName, placeIsExact); } ConVar snd_ping_volume("snd_ping_volume", "0.33", FCVAR_ARCHIVE, "Player ping volume", true, 0.f, true, 1.f); ConVar cl_neo_player_pings_chat_message("cl_neo_player_pings_chat_message", "1", FCVAR_ARCHIVE, "Show message in chat for player pings.", true, 0, true, 1); // NEO TODO (Adam) custom chat filter instead? ConVar cl_neo_player_pings_time_between_sounds("cl_neo_player_pings_time_between_sounds", "0", FCVAR_ARCHIVE, "Minimum time between two ping sounds", true, 0, false, 0); -void CNEOHud_PlayerPing::NotifyPing(const int playerSlot, const char* placeName) +void CNEOHud_PlayerPing::NotifyPing(const int playerSlot, const char* placeName, bool placeIsExact) { C_NEO_Player* pPlayer = static_cast(UTIL_PlayerByIndex(playerSlot + 1)); if (!pPlayer || pPlayer->IsLocalPlayer()) @@ -374,9 +376,10 @@ void CNEOHud_PlayerPing::NotifyPing(const int playerSlot, const char* placeName) CBaseHudChat* hudChat = (CBaseHudChat*)GET_HUDELEMENT(CHudChat); if (hudChat) { - hudChat->ChatPrintf(0, CHAT_FILTER_NONE, "%s pinged %s\n", + hudChat->ChatPrintf(0, CHAT_FILTER_NONE, "%s pinged %s%s\n", pPlayer->GetNeoPlayerName(), - placeName && *placeName ? placeName : "a location"); + (placeIsExact || !placeName || !*placeName) ? "" : "near ", // only specify "near" for concrete callouts + (placeName && *placeName) ? placeName : "a location"); } } } diff --git a/src/game/client/neo/ui/neo_hud_player_ping.h b/src/game/client/neo/ui/neo_hud_player_ping.h index a2e14aa1d8..4ad9ede931 100644 --- a/src/game/client/neo/ui/neo_hud_player_ping.h +++ b/src/game/client/neo/ui/neo_hud_player_ping.h @@ -37,8 +37,9 @@ class CNEOHud_PlayerPing : public CNEOHud_ChildElement, public CHudElement, publ private: int GetStringPixelWidth(wchar_t* pString, vgui::HFont hFont); void UpdateDistanceToPlayer(C_BasePlayer* player, const int pingIndex); - void SetPos(const int index, const int playerTeam, const Vector& pos, bool ghosterPing, const char* placeName); - void NotifyPing(const int playerSlot, const char* placeName); + void SetPos(const int index, const int playerTeam, const Vector& pos, bool ghosterPing, + const char* placeName, bool placeIsExact); + void NotifyPing(const int playerSlot, const char* placeName, bool placeIsExact); private: playerPing m_iPlayerPings[MAX_PLAYERS] = {}; diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index be1832c955..523d45182a 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -205,14 +205,9 @@ void CheckPingButton(CNEO_Player* player) if (actualNavAreaOfPing && nearestNamedNavAreaOfPing) { const bool pingPlaceNameIsExact = (actualNavAreaOfPing == nearestNamedNavAreaOfPing); + event->SetBool("exactplace", pingPlaceNameIsExact); + const char* placeName = TheNavMesh->PlaceToName(nearestNamedNavAreaOfPing->GetPlace()); - if (!pingPlaceNameIsExact) - { - constexpr const char nearPhrase[] = "near "; - char placeFmtBuf[ARRAYSIZE(nearPhrase) - 1 + MAX_PLACE_NAME_LENGTH]; - V_sprintf_safe(placeFmtBuf, "%s%s", nearPhrase, placeName); - placeName = &placeFmtBuf[0]; - } event->SetString("placename", placeName); } } From 9da8ca6a2c3429999021422323fcc343bdde245f Mon Sep 17 00:00:00 2001 From: Rain Date: Thu, 8 Oct 2026 19:18:31 +0300 Subject: [PATCH 10/32] Allow print of self-pinged placenames for debug --- game/neo/resource/NeoModEvents.res | 1 + .../client/neo/ui/neo_hud_player_ping.cpp | 22 ++++++++++++++----- src/game/shared/neo/neo_player_shared.cpp | 9 +++++++- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/game/neo/resource/NeoModEvents.res b/game/neo/resource/NeoModEvents.res index 43e9218ca5..5780f9f4a9 100644 --- a/game/neo/resource/NeoModEvents.res +++ b/game/neo/resource/NeoModEvents.res @@ -89,6 +89,7 @@ "pingy" "short" // ping y position "pingz" "short" // ping z position "ghosterping" "bool" // the player is carrying the ghost + "print" "bool" // debug only: used to filter client-predicted placename print msgs "placename" "string" // nav place name of the pinged location (may be empty "" string) "exactplace" "bool" // whether the place ping is pinpoint precise on the place name (else we consider the ping to be "near" it) } diff --git a/src/game/client/neo/ui/neo_hud_player_ping.cpp b/src/game/client/neo/ui/neo_hud_player_ping.cpp index 3acc60b2e3..f95dacd805 100644 --- a/src/game/client/neo/ui/neo_hud_player_ping.cpp +++ b/src/game/client/neo/ui/neo_hud_player_ping.cpp @@ -120,10 +120,13 @@ void CNEOHud_PlayerPing::FireGameEvent(IGameEvent* event) const int userID = event->GetInt("userid"); const int playerIndex = engine->GetPlayerForUserID(userID); - if (GetClientVoiceMgr()->IsPlayerBlocked(playerIndex) || (!NEORules()->IsTeamplay() && playerIndex != GetLocalPlayerIndex())) + Assert(playerIndex >= 0); + if (playerIndex == 0 || GetClientVoiceMgr()->IsPlayerBlocked(playerIndex)) { return; } + const int playerSlot = playerIndex - 1; + Assert(playerSlot >= 0); const int localTeam = GetLocalPlayerTeam(); const int playerTeam = event->GetInt("playerteam"); @@ -132,11 +135,21 @@ void CNEOHud_PlayerPing::FireGameEvent(IGameEvent* event) return; } - const Vector worldpos = Vector(event->GetInt("pingx"), event->GetInt("pingy"), event->GetInt("pingz")); + const Vector worldpos(event->GetInt("pingx"), event->GetInt("pingy"), event->GetInt("pingz")); bool ghosterPing = event->GetBool("ghosterping"); const char* placeName = event->GetString("placename"); bool placeIsExact = event->GetBool("exactplace"); - SetPos(playerIndex - 1, playerTeam, worldpos, ghosterPing, placeName, placeIsExact); + SetPos(playerSlot, playerTeam, worldpos, ghosterPing, placeName, placeIsExact); + +#ifdef _DEBUG + ConVarRef cl_neo_player_pings_debug("cl_neo_player_pings_debug"); + Assert(cl_neo_player_pings_debug.IsValid()); + if (cl_neo_player_pings_debug.GetBool() && + event->GetBool("print", false)) // don't print predicted bogus placenames (only wanna predict the in-world visuals) +#else + if (GetLocalPlayerIndex() != playerIndex) // release: don't print own ping placenames because it's not useful to the pinger +#endif + NotifyPing(playerSlot, m_iPlayerPings[playerSlot].placeName, placeIsExact); } else if (!Q_stricmp(eventName, "round_start")) { @@ -354,7 +367,6 @@ void CNEOHud_PlayerPing::SetPos(const int playerSlot, const int playerTeam, cons return; } } - NotifyPing(playerSlot, m_iPlayerPings[playerSlot].placeName, placeIsExact); } ConVar snd_ping_volume("snd_ping_volume", "0.33", FCVAR_ARCHIVE, "Player ping volume", true, 0.f, true, 1.f); @@ -363,7 +375,7 @@ ConVar cl_neo_player_pings_time_between_sounds("cl_neo_player_pings_time_between void CNEOHud_PlayerPing::NotifyPing(const int playerSlot, const char* placeName, bool placeIsExact) { C_NEO_Player* pPlayer = static_cast(UTIL_PlayerByIndex(playerSlot + 1)); - if (!pPlayer || pPlayer->IsLocalPlayer()) + if (!pPlayer) { return; } diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index 523d45182a..1e8e8559ca 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -137,6 +137,9 @@ CBaseCombatWeapon* GetNeoWepWithBits(const CNEO_Player* player, const NEO_WEP_BI #ifdef CLIENT_DLL extern ConVar cl_neo_player_pings; +#ifdef _DEBUG +static ConVar cl_neo_player_pings_debug("cl_neo_player_pings_debug", "0", FCVAR_CHEAT|FCVAR_DEVELOPMENTONLY); +#endif #else static ConVar sv_neo_player_pings_calc_placename("sv_neo_player_pings_calc_placename", "1", 0, "Whether the server should calculare place names for player pings from the nav mesh (possibly expensive)", true, false, true, true); @@ -209,9 +212,13 @@ void CheckPingButton(CNEO_Player* player) const char* placeName = TheNavMesh->PlaceToName(nearestNamedNavAreaOfPing->GetPlace()); event->SetString("placename", placeName); +#ifdef _DEBUG + // It's useful to be able to see your own pings for debug; this lets us filter predicted dupes /w bad placename info. + // For release builds, this is unused by client+server (because release client will never print self-pinged placenames). + event->SetBool("print", true); +#endif } } - gameeventmanager->FireEvent(event); #else gameeventmanager->FireEventClientSide(event); From c397b5a7f676afb1ca3cd44fa27b85f39e9e7645 Mon Sep 17 00:00:00 2001 From: Rain Date: Thu, 8 Oct 2026 19:48:12 +0300 Subject: [PATCH 11/32] Allow printing self-pinged placenames for non-debug builds Add a "server" bool to the event for filtering the predicted events (because they'd have a bad predicted placename). This way we can allow printing self-pinged place names which can be useful for team practice, or just verifying what place name your ping got associated with. --- game/neo/resource/NeoModEvents.res | 6 ++-- .../client/neo/ui/neo_hud_player_ping.cpp | 30 ++++++++----------- src/game/client/neo/ui/neo_hud_player_ping.h | 4 +-- src/game/shared/neo/neo_player_shared.cpp | 15 +++++----- 4 files changed, 24 insertions(+), 31 deletions(-) diff --git a/game/neo/resource/NeoModEvents.res b/game/neo/resource/NeoModEvents.res index 5780f9f4a9..7bf23c6185 100644 --- a/game/neo/resource/NeoModEvents.res +++ b/game/neo/resource/NeoModEvents.res @@ -89,9 +89,9 @@ "pingy" "short" // ping y position "pingz" "short" // ping z position "ghosterping" "bool" // the player is carrying the ghost - "print" "bool" // debug only: used to filter client-predicted placename print msgs - "placename" "string" // nav place name of the pinged location (may be empty "" string) - "exactplace" "bool" // whether the place ping is pinpoint precise on the place name (else we consider the ping to be "near" it) + "server" "bool" // whether this was fired server side (else it's predicted) + "place_exact" "bool" // whether the place ping is pinpoint precise on the place name (else we consider the ping to be "near" it) + "place_name" "string" // nav place name of the pinged location (may be empty "" string) } "ghost_enemy_callout" diff --git a/src/game/client/neo/ui/neo_hud_player_ping.cpp b/src/game/client/neo/ui/neo_hud_player_ping.cpp index f95dacd805..bef8d58552 100644 --- a/src/game/client/neo/ui/neo_hud_player_ping.cpp +++ b/src/game/client/neo/ui/neo_hud_player_ping.cpp @@ -136,20 +136,18 @@ void CNEOHud_PlayerPing::FireGameEvent(IGameEvent* event) } const Vector worldpos(event->GetInt("pingx"), event->GetInt("pingy"), event->GetInt("pingz")); - bool ghosterPing = event->GetBool("ghosterping"); - const char* placeName = event->GetString("placename"); - bool placeIsExact = event->GetBool("exactplace"); - SetPos(playerSlot, playerTeam, worldpos, ghosterPing, placeName, placeIsExact); - -#ifdef _DEBUG - ConVarRef cl_neo_player_pings_debug("cl_neo_player_pings_debug"); - Assert(cl_neo_player_pings_debug.IsValid()); - if (cl_neo_player_pings_debug.GetBool() && - event->GetBool("print", false)) // don't print predicted bogus placenames (only wanna predict the in-world visuals) -#else - if (GetLocalPlayerIndex() != playerIndex) // release: don't print own ping placenames because it's not useful to the pinger -#endif - NotifyPing(playerSlot, m_iPlayerPings[playerSlot].placeName, placeIsExact); + const bool ghosterPing = event->GetBool("ghosterping"); + SetPos(playerSlot, playerTeam, worldpos, ghosterPing); + + static ConVarRef cl_neo_player_pings_print_own("cl_neo_player_pings_print_own"); + Assert(cl_neo_player_pings_print_own.IsValid()); + if (cl_neo_player_pings_print_own.GetBool() && + event->GetBool("server", false)) // don't print predicted bogus placenames (only wanna predict the in-world visuals) + { + const bool placeIsExact = event->GetBool("place_exact"); + const char* placeName = event->GetString("place_name"); + NotifyPing(playerSlot, placeName, placeIsExact); + } } else if (!Q_stricmp(eventName, "round_start")) { @@ -331,8 +329,7 @@ void CNEOHud_PlayerPing::UpdateDistanceToPlayer(C_BasePlayer* player, const int m_iPlayerPings[playerSlot].noLineOfSight = tr.fraction < 0.999; } -void CNEOHud_PlayerPing::SetPos(const int playerSlot, const int playerTeam, const Vector& pos, bool ghosterPing, - const char* placeName, bool placeIsExact) +void CNEOHud_PlayerPing::SetPos(const int playerSlot, const int playerTeam, const Vector& pos, bool ghosterPing) { constexpr float PLAYER_PING_LIFETIME = 8; auto localPlayer = C_NEO_Player::GetLocalNEOPlayer(); @@ -342,7 +339,6 @@ void CNEOHud_PlayerPing::SetPos(const int playerSlot, const int playerTeam, cons m_iPlayerPings[playerSlot].deathTime = gpGlobals->curtime + PLAYER_PING_LIFETIME; m_iPlayerPings[playerSlot].team = playerTeam; m_iPlayerPings[playerSlot].ghosterPing = ghosterPing; - m_iPlayerPings[playerSlot].placeName = AllocPooledString(placeName); UpdateDistanceToPlayer(localPlayer, playerSlot); const int playerPingsInSpectate = cl_neo_player_pings_in_spectate.GetInt(); diff --git a/src/game/client/neo/ui/neo_hud_player_ping.h b/src/game/client/neo/ui/neo_hud_player_ping.h index 4ad9ede931..3b6bc2f52e 100644 --- a/src/game/client/neo/ui/neo_hud_player_ping.h +++ b/src/game/client/neo/ui/neo_hud_player_ping.h @@ -12,7 +12,6 @@ struct playerPing int team; bool noLineOfSight; bool ghosterPing; - const char* placeName; }; class CNEOHud_PlayerPing : public CNEOHud_ChildElement, public CHudElement, public vgui::Panel @@ -37,8 +36,7 @@ class CNEOHud_PlayerPing : public CNEOHud_ChildElement, public CHudElement, publ private: int GetStringPixelWidth(wchar_t* pString, vgui::HFont hFont); void UpdateDistanceToPlayer(C_BasePlayer* player, const int pingIndex); - void SetPos(const int index, const int playerTeam, const Vector& pos, bool ghosterPing, - const char* placeName, bool placeIsExact); + void SetPos(const int index, const int playerTeam, const Vector& pos, bool ghosterPing); void NotifyPing(const int playerSlot, const char* placeName, bool placeIsExact); private: diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index 1e8e8559ca..f10241c3e5 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -138,7 +138,8 @@ CBaseCombatWeapon* GetNeoWepWithBits(const CNEO_Player* player, const NEO_WEP_BI #ifdef CLIENT_DLL extern ConVar cl_neo_player_pings; #ifdef _DEBUG -static ConVar cl_neo_player_pings_debug("cl_neo_player_pings_debug", "0", FCVAR_CHEAT|FCVAR_DEVELOPMENTONLY); +static ConVar cl_neo_player_pings_print_own("cl_neo_player_pings_print_own", "0", FCVAR_ARCHIVE, + "Whether to print the place names of your own pings to chat.", true, false, true, true); #endif #else static ConVar sv_neo_player_pings_calc_placename("sv_neo_player_pings_calc_placename", "1", 0, @@ -184,6 +185,7 @@ void CheckPingButton(CNEO_Player* player) event->SetInt("pingy", tr.endpos.y); event->SetInt("pingz", tr.endpos.z); event->SetBool("ghosterping", player->IsCarryingGhost() || player->m_iNeoClass == NEO_CLASS_VIP); + event->SetBool("server", player->IsServer()); #ifdef GAME_DLL if (sv_neo_player_pings_calc_placename.GetBool() && TheNavMesh) { @@ -208,15 +210,12 @@ void CheckPingButton(CNEO_Player* player) if (actualNavAreaOfPing && nearestNamedNavAreaOfPing) { const bool pingPlaceNameIsExact = (actualNavAreaOfPing == nearestNamedNavAreaOfPing); - event->SetBool("exactplace", pingPlaceNameIsExact); + event->SetBool("place_exact", pingPlaceNameIsExact); const char* placeName = TheNavMesh->PlaceToName(nearestNamedNavAreaOfPing->GetPlace()); - event->SetString("placename", placeName); -#ifdef _DEBUG - // It's useful to be able to see your own pings for debug; this lets us filter predicted dupes /w bad placename info. - // For release builds, this is unused by client+server (because release client will never print self-pinged placenames). - event->SetBool("print", true); -#endif + event->SetString("place_name", placeName); + + AssertMsg(!pingPlaceNameIsExact || *placeName, "Exact named place but place name is empty"); } } gameeventmanager->FireEvent(event); From 0fd0ca8f0f69941a5ff22ee7783b1242b9699361 Mon Sep 17 00:00:00 2001 From: Rain <6595066+Rainyan@users.noreply.github.com> Date: Tue, 3 Nov 2026 10:25:05 +0200 Subject: [PATCH 12/32] wip --- src/game/client/neo/ui/neo_hud_player_ping.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/game/client/neo/ui/neo_hud_player_ping.cpp b/src/game/client/neo/ui/neo_hud_player_ping.cpp index bef8d58552..8a60c27115 100644 --- a/src/game/client/neo/ui/neo_hud_player_ping.cpp +++ b/src/game/client/neo/ui/neo_hud_player_ping.cpp @@ -12,7 +12,6 @@ #include "voice_status.h" #include "hud_chat.h" #include "engine/IEngineSound.h" -#include "gamestringpool.h" #include "ienginevgui.h" From 348b14c18c72db06a139c8494431449752cb0b34 Mon Sep 17 00:00:00 2001 From: Rain <6595066+Rainyan@users.noreply.github.com> Date: Tue, 3 Nov 2026 10:26:18 +0200 Subject: [PATCH 13/32] ignore jetbrains rider project files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 2ac93e819a..e6a5c642cd 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,9 @@ # Qt Creator /build-src-* +# Rider +**/.idea + # CMake build dir /src/build out From 7743cf553ce29f4cb19420e5d30ea06d392deb3a Mon Sep 17 00:00:00 2001 From: Rain <6595066+Rainyan@users.noreply.github.com> Date: Tue, 3 Nov 2026 11:07:57 +0200 Subject: [PATCH 14/32] fix null dereference --- src/game/shared/neo/neo_player_shared.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index f10241c3e5..104d42fd1e 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -215,7 +215,7 @@ void CheckPingButton(CNEO_Player* player) const char* placeName = TheNavMesh->PlaceToName(nearestNamedNavAreaOfPing->GetPlace()); event->SetString("place_name", placeName); - AssertMsg(!pingPlaceNameIsExact || *placeName, "Exact named place but place name is empty"); + AssertMsg(!pingPlaceNameIsExact || (placeName && *placeName), "Exact named place but place name is empty"); } } gameeventmanager->FireEvent(event); From f06488b553432d9f62564713938c8867d5e4fcde Mon Sep 17 00:00:00 2001 From: Rain <6595066+Rainyan@users.noreply.github.com> Date: Tue, 3 Nov 2026 11:12:07 +0200 Subject: [PATCH 15/32] limit area check distance, refactor magic values --- src/game/shared/neo/neo_player_shared.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index 104d42fd1e..44328a5121 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -204,8 +204,13 @@ void CheckPingButton(CNEO_Player* player) }()); }; - const auto actualNavAreaOfPing = fnGetNearbyNavArea(tr.endpos, 1024, false); - const auto nearestNamedNavAreaOfPing = !actualNavAreaOfPing ? nullptr : fnGetNearbyNavArea(tr.endpos, 1024*10, true); + constexpr float maxPingAreaDist = 1024; + constexpr float maxMissedPingAreaDist = maxPingAreaDist * 4; + static_assert(maxPingAreaDist < maxMissedPingAreaDist); + static_assert(IN_BETWEEN_EQ(0, maxPingAreaDist, COORD_EXTENT)); + static_assert(IN_BETWEEN_EQ(0, maxMissedPingAreaDist, COORD_EXTENT)); + const auto actualNavAreaOfPing = fnGetNearbyNavArea(tr.endpos, maxPingAreaDist, false); + const auto nearestNamedNavAreaOfPing = !actualNavAreaOfPing ? nullptr : fnGetNearbyNavArea(tr.endpos, maxMissedPingAreaDist, true); if (actualNavAreaOfPing && nearestNamedNavAreaOfPing) { From 428f07a81b68ba35f0d39bb868c986e6c9eb5fbd Mon Sep 17 00:00:00 2001 From: Rain <6595066+Rainyan@users.noreply.github.com> Date: Tue, 3 Nov 2026 11:17:24 +0200 Subject: [PATCH 16/32] fix typo --- src/game/shared/neo/neo_player_shared.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index 44328a5121..bdb2d30c30 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -143,7 +143,7 @@ static ConVar cl_neo_player_pings_print_own("cl_neo_player_pings_print_own", "0" #endif #else static ConVar sv_neo_player_pings_calc_placename("sv_neo_player_pings_calc_placename", "1", 0, - "Whether the server should calculare place names for player pings from the nav mesh (possibly expensive)", true, false, true, true); + "Whether the server should calculate place names for player pings from the nav mesh (possibly expensive)", true, false, true, true); #endif // CLIENT_DLL void CheckPingButton(CNEO_Player* player) { From 558e7fe90617ecd44444acfc6426e0245c783ca8 Mon Sep 17 00:00:00 2001 From: Rain <6595066+Rainyan@users.noreply.github.com> Date: Wed, 4 Nov 2026 10:56:34 +0200 Subject: [PATCH 17/32] code review: remove redundant GetNearestNavArea predicate --- src/game/shared/neo/neo_player_shared.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index bdb2d30c30..ea97fb7e6e 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -195,13 +195,8 @@ void CheckPingButton(CNEO_Player* player) constexpr auto ignoreNamelessPlaces = [](const CNavArea* area)->bool { return !area || !TheNavMesh->PlaceToName(area->GetPlace()); }; - constexpr auto ignoreNothing = [](const CNavArea*)->bool { - return false; - }; return TheNavMesh->GetNearestNavArea(pingPos, true, maxDist, false, false, TEAM_ANY, - [requireAreaBeNamed, ignoreNamelessPlaces, ignoreNothing]() { - return requireAreaBeNamed ? ignoreNamelessPlaces : ignoreNothing; - }()); + requireAreaBeNamed ? ignoreNamelessPlaces : nullptr); }; constexpr float maxPingAreaDist = 1024; From 2eae6fa8e03f9019d18d632d85e275bcdc49f059 Mon Sep 17 00:00:00 2001 From: Rain <6595066+Rainyan@users.noreply.github.com> Date: Wed, 4 Nov 2026 12:16:07 +0200 Subject: [PATCH 18/32] code review: fix spectators not seeing text pings --- .../client/neo/ui/neo_hud_player_ping.cpp | 156 ++++++++++-------- src/game/client/neo/ui/neo_hud_player_ping.h | 1 + 2 files changed, 90 insertions(+), 67 deletions(-) diff --git a/src/game/client/neo/ui/neo_hud_player_ping.cpp b/src/game/client/neo/ui/neo_hud_player_ping.cpp index 8a60c27115..70d9aa4a8e 100644 --- a/src/game/client/neo/ui/neo_hud_player_ping.cpp +++ b/src/game/client/neo/ui/neo_hud_player_ping.cpp @@ -32,6 +32,16 @@ ConVar cl_neo_player_pings("cl_neo_player_pings", "1", FCVAR_ARCHIVE | FCVAR_USE } }); +enum NeoPlayerPingsInSpectate +{ + NEO_SPECTATE_PINGS_DISABLED = 0, + NEO_SPECTATE_PINGS_TARGET, + NEO_SPECTATE_PINGS_ALL, + + NEO_SPECTATE_PINGS_LAST_VALUE = NEO_SPECTATE_PINGS_ALL +}; +ConVar cl_neo_player_pings_in_spectate("cl_neo_player_pings_in_spectate", "1", FCVAR_ARCHIVE, "See pings of players playing the game. 0 = disabled, 1 = spectate target team, 2 = all", true, NEO_SPECTATE_PINGS_DISABLED, true, NEO_SPECTATE_PINGS_LAST_VALUE); + CNEOHud_PlayerPing::CNEOHud_PlayerPing(const char* pElementName, vgui::Panel* parent) : CHudElement(pElementName), Panel(parent, pElementName) { @@ -109,58 +119,94 @@ void CNEOHud_PlayerPing::Init(void) //----------------------------------------------------------------------------- void CNEOHud_PlayerPing::FireGameEvent(IGameEvent* event) { - auto eventName = event->GetName(); + const auto eventName = event->GetName(); if (!Q_stricmp(eventName, "player_ping")) { - if (!cl_neo_player_pings.GetBool()) + OnPlayerPing(event); + } + else if (!Q_stricmp(eventName, "round_start")) + { + HideAllPings(); + } + else if (!Q_stricmp(eventName, "player_team")) + { + auto player = UTIL_PlayerByUserId(event->GetInt("userid")); + if (player && player->IsLocalPlayer()) { - return; + HideAllPings(); } + } +} - const int userID = event->GetInt("userid"); - const int playerIndex = engine->GetPlayerForUserID(userID); - Assert(playerIndex >= 0); - if (playerIndex == 0 || GetClientVoiceMgr()->IsPlayerBlocked(playerIndex)) - { - return; - } - const int playerSlot = playerIndex - 1; - Assert(playerSlot >= 0); +void CNEOHud_PlayerPing::OnPlayerPing(const IGameEvent* event) +{ + if (!cl_neo_player_pings.GetBool()) + { + return; + } - const int localTeam = GetLocalPlayerTeam(); - const int playerTeam = event->GetInt("playerteam"); - if (localTeam != TEAM_SPECTATOR && playerTeam != localTeam) - { - return; - } + const bool thisIsPredictedPing = !event->GetBool("server", false); + if (thisIsPredictedPing) + { + // don't print predicted (bogus) placenames; we only wanna predict the in-world visuals but not the place text + return; + } - const Vector worldpos(event->GetInt("pingx"), event->GetInt("pingy"), event->GetInt("pingz")); - const bool ghosterPing = event->GetBool("ghosterping"); - SetPos(playerSlot, playerTeam, worldpos, ghosterPing); + const auto localPlayer = C_NEO_Player::GetLocalNEOPlayer(); + Assert(localPlayer); + const auto localTeamNumber = localPlayer->GetTeamNumber(); + const int pingerIndex = engine->GetPlayerForUserID(event->GetInt("userid")); + Assert(pingerIndex >= 0); + + if (pingerIndex == localPlayer->entindex()) + { static ConVarRef cl_neo_player_pings_print_own("cl_neo_player_pings_print_own"); Assert(cl_neo_player_pings_print_own.IsValid()); - if (cl_neo_player_pings_print_own.GetBool() && - event->GetBool("server", false)) // don't print predicted bogus placenames (only wanna predict the in-world visuals) - { - const bool placeIsExact = event->GetBool("place_exact"); - const char* placeName = event->GetString("place_name"); - NotifyPing(playerSlot, placeName, placeIsExact); - } + if (!cl_neo_player_pings_print_own.GetBool()) + return; } - else if (!Q_stricmp(eventName, "round_start")) + else if (pingerIndex == 0 || GetClientVoiceMgr()->IsPlayerBlocked(pingerIndex)) { - HideAllPings(); + return; } - else if (!Q_stricmp(eventName, "player_team")) + + const int pingRecipientTeam = event->GetInt("playerteam"); + + if (localTeamNumber == TEAM_SPECTATOR) { - auto player = UTIL_PlayerByUserId(event->GetInt("userid")); - if (player && player->IsLocalPlayer()) + const C_BaseEntity* obsTarget; + switch (cl_neo_player_pings_in_spectate.GetInt()) { - HideAllPings(); + case NEO_SPECTATE_PINGS_DISABLED: + return; + case NEO_SPECTATE_PINGS_TARGET: + obsTarget = localPlayer->GetObserverTarget(); + if (!obsTarget || obsTarget->GetTeamNumber() != pingRecipientTeam) + return; + break; + case NEO_SPECTATE_PINGS_ALL: + break; + default: + Warning("%s: unhandled enum case %d\n", __FUNCTION__, cl_neo_player_pings_in_spectate.GetInt()); + return; } } + else if (localTeamNumber != pingRecipientTeam) + { + return; + } + + const int pingerSlot = pingerIndex - 1; + Assert(pingerSlot >= 0); + const Vector worldpos(event->GetInt("pingx"), event->GetInt("pingy"), event->GetInt("pingz")); + const bool ghosterPing = event->GetBool("ghosterping"); + SetPos(pingerSlot, pingRecipientTeam, worldpos, ghosterPing); + + const bool placeIsExact = event->GetBool("place_exact"); + const char* placeName = event->GetString("place_name"); + NotifyPing(pingerSlot, placeName, placeIsExact); } void CNEOHud_PlayerPing::LevelShutdown(void) @@ -169,15 +215,6 @@ void CNEOHud_PlayerPing::LevelShutdown(void) m_flNextPingSoundTime = 0.f; } -enum NeoPlayerPingsInSpectate -{ - NEO_SPECTATE_PINGS_DISABLED = 0, - NEO_SPECTATE_PINGS_TARGET, - NEO_SPECTATE_PINGS_ALL, - - NEO_SPECTATE_PINGS_LAST_VALUE = NEO_SPECTATE_PINGS_ALL -}; -ConVar cl_neo_player_pings_in_spectate("cl_neo_player_pings_in_spectate", "1", FCVAR_ARCHIVE, "See pings of players playing the game. 0 = disabled, 1 = spectate target team, 2 = all", true, NEO_SPECTATE_PINGS_DISABLED, true, NEO_SPECTATE_PINGS_LAST_VALUE); void CNEOHud_PlayerPing::DrawNeoHudElement() { if (!ShouldDraw()) @@ -340,33 +377,14 @@ void CNEOHud_PlayerPing::SetPos(const int playerSlot, const int playerTeam, cons m_iPlayerPings[playerSlot].ghosterPing = ghosterPing; UpdateDistanceToPlayer(localPlayer, playerSlot); - const int playerPingsInSpectate = cl_neo_player_pings_in_spectate.GetInt(); - if (GetLocalPlayerTeam() == TEAM_SPECTATOR && playerPingsInSpectate != NEO_SPECTATE_PINGS_ALL) - { - if (playerPingsInSpectate == NEO_SPECTATE_PINGS_DISABLED) - { - return; - } - - int spectateTargetTeam = TEAM_UNASSIGNED; - if (auto observerTarget = localPlayer->GetObserverTarget()) - { - spectateTargetTeam = observerTarget->GetTeamNumber(); - if (playerTeam != spectateTargetTeam) - { - return; - } - } - else - { - return; - } - } } ConVar snd_ping_volume("snd_ping_volume", "0.33", FCVAR_ARCHIVE, "Player ping volume", true, 0.f, true, 1.f); ConVar cl_neo_player_pings_chat_message("cl_neo_player_pings_chat_message", "1", FCVAR_ARCHIVE, "Show message in chat for player pings.", true, 0, true, 1); // NEO TODO (Adam) custom chat filter instead? ConVar cl_neo_player_pings_time_between_sounds("cl_neo_player_pings_time_between_sounds", "0", FCVAR_ARCHIVE, "Minimum time between two ping sounds", true, 0, false, 0); +#ifdef _DEBUG +ConVar cl_neo_player_pings_skip_text_for_bots("cl_neo_player_pings_skip_text_for_bots", "1", FCVAR_DONTRECORD); +#endif void CNEOHud_PlayerPing::NotifyPing(const int playerSlot, const char* placeName, bool placeIsExact) { C_NEO_Player* pPlayer = static_cast(UTIL_PlayerByIndex(playerSlot + 1)); @@ -377,8 +395,12 @@ void CNEOHud_PlayerPing::NotifyPing(const int playerSlot, const char* placeName, if (cl_neo_player_pings_chat_message.GetBool()) { - // Skip text notification for bots - if (g_PR && !g_PR->IsFakePlayer(playerSlot + 1)) + if ( + ( g_PR && !g_PR->IsFakePlayer(playerSlot + 1) ) +#ifdef _DEBUG + || !cl_neo_player_pings_skip_text_for_bots.GetBool() +#endif + ) { CBaseHudChat* hudChat = (CBaseHudChat*)GET_HUDELEMENT(CHudChat); if (hudChat) diff --git a/src/game/client/neo/ui/neo_hud_player_ping.h b/src/game/client/neo/ui/neo_hud_player_ping.h index 3b6bc2f52e..81e2fd74df 100644 --- a/src/game/client/neo/ui/neo_hud_player_ping.h +++ b/src/game/client/neo/ui/neo_hud_player_ping.h @@ -34,6 +34,7 @@ class CNEOHud_PlayerPing : public CNEOHud_ChildElement, public CHudElement, publ virtual void FireGameEvent(IGameEvent* event) override; private: + void OnPlayerPing(const IGameEvent* event); int GetStringPixelWidth(wchar_t* pString, vgui::HFont hFont); void UpdateDistanceToPlayer(C_BasePlayer* player, const int pingIndex); void SetPos(const int index, const int playerTeam, const Vector& pos, bool ghosterPing); From 9640cda4ac6456cee23257796028d6d4e71627a3 Mon Sep 17 00:00:00 2001 From: Rain <6595066+Rainyan@users.noreply.github.com> Date: Wed, 4 Nov 2026 12:19:28 +0200 Subject: [PATCH 19/32] code review: restore ping filter for non-teamplay modes --- src/game/client/neo/ui/neo_hud_player_ping.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/game/client/neo/ui/neo_hud_player_ping.cpp b/src/game/client/neo/ui/neo_hud_player_ping.cpp index 70d9aa4a8e..27f065c8e5 100644 --- a/src/game/client/neo/ui/neo_hud_player_ping.cpp +++ b/src/game/client/neo/ui/neo_hud_player_ping.cpp @@ -140,6 +140,12 @@ void CNEOHud_PlayerPing::FireGameEvent(IGameEvent* event) void CNEOHud_PlayerPing::OnPlayerPing(const IGameEvent* event) { + // because it makes no sense to send pings for enemies to see + if (!NEORules() || !NEORules()->IsTeamplay()) + { + return; + } + if (!cl_neo_player_pings.GetBool()) { return; From db7fa1cf5e151b60489b0fcb525e47fc6c5c1d8e Mon Sep 17 00:00:00 2001 From: Rain <6595066+Rainyan@users.noreply.github.com> Date: Wed, 4 Nov 2026 12:35:32 +0200 Subject: [PATCH 20/32] code review: don't exclude cl_neo_player_pings_print_own for release build because it is needed for the release path, and would silently fail (because we don't typically assert for release) --- src/game/shared/neo/neo_player_shared.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index ea97fb7e6e..f7d08f5e7c 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -137,10 +137,8 @@ CBaseCombatWeapon* GetNeoWepWithBits(const CNEO_Player* player, const NEO_WEP_BI #ifdef CLIENT_DLL extern ConVar cl_neo_player_pings; -#ifdef _DEBUG static ConVar cl_neo_player_pings_print_own("cl_neo_player_pings_print_own", "0", FCVAR_ARCHIVE, "Whether to print the place names of your own pings to chat.", true, false, true, true); -#endif #else static ConVar sv_neo_player_pings_calc_placename("sv_neo_player_pings_calc_placename", "1", 0, "Whether the server should calculate place names for player pings from the nav mesh (possibly expensive)", true, false, true, true); From 6eed71128d4bbe2e405dc716125ff69a6956ca00 Mon Sep 17 00:00:00 2001 From: Rain <6595066+Rainyan@users.noreply.github.com> Date: Wed, 4 Nov 2026 13:17:49 +0200 Subject: [PATCH 21/32] fix assertion failure for pings on non-teamplay game modes --- src/game/client/neo/ui/neo_hud_player_ping.cpp | 3 ++- src/game/shared/neo/neo_player_shared.cpp | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/game/client/neo/ui/neo_hud_player_ping.cpp b/src/game/client/neo/ui/neo_hud_player_ping.cpp index 27f065c8e5..4e2af1f6eb 100644 --- a/src/game/client/neo/ui/neo_hud_player_ping.cpp +++ b/src/game/client/neo/ui/neo_hud_player_ping.cpp @@ -140,7 +140,8 @@ void CNEOHud_PlayerPing::FireGameEvent(IGameEvent* event) void CNEOHud_PlayerPing::OnPlayerPing(const IGameEvent* event) { - // because it makes no sense to send pings for enemies to see + // Don't team-ping for non-teamplay modes. + // This is already checked by the emitter side, but we check again because it could arrive late (dynamic custom rule change etc.) if (!NEORules() || !NEORules()->IsTeamplay()) { return; diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index f7d08f5e7c..64115699d0 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -145,6 +145,13 @@ static ConVar sv_neo_player_pings_calc_placename("sv_neo_player_pings_calc_place #endif // CLIENT_DLL void CheckPingButton(CNEO_Player* player) { +#ifdef GAME_DLL + if (!GameRules() || !GameRules()->IsTeamplay()) + { // because for game modes with no friendlies, it would make no sense to send pings to enemies + return; + } +#endif + if (!player->IsAlive() || !(player->m_afButtonPressed & IN_ATTACK3) || player->m_flNextPingTime > gpGlobals->curtime) { return; From 167366cde798dd44622f5a5df2a29d1a0a63a47e Mon Sep 17 00:00:00 2001 From: Rain <6595066+Rainyan@users.noreply.github.com> Date: Wed, 4 Nov 2026 13:20:11 +0200 Subject: [PATCH 22/32] optimize do faster ops before the virtual indirection --- src/game/shared/neo/neo_player_shared.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index 64115699d0..0b4ff8666a 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -145,6 +145,11 @@ static ConVar sv_neo_player_pings_calc_placename("sv_neo_player_pings_calc_place #endif // CLIENT_DLL void CheckPingButton(CNEO_Player* player) { + if (!(player->m_afButtonPressed & IN_ATTACK3) || player->m_flNextPingTime > gpGlobals->curtime) + { + return; + } + #ifdef GAME_DLL if (!GameRules() || !GameRules()->IsTeamplay()) { // because for game modes with no friendlies, it would make no sense to send pings to enemies @@ -152,7 +157,7 @@ void CheckPingButton(CNEO_Player* player) } #endif - if (!player->IsAlive() || !(player->m_afButtonPressed & IN_ATTACK3) || player->m_flNextPingTime > gpGlobals->curtime) + if (!player->IsAlive()) { return; } From 43c593cea2de79ef68ea73ce695db2cae9c49bed Mon Sep 17 00:00:00 2001 From: Rain <6595066+Rainyan@users.noreply.github.com> Date: Wed, 4 Nov 2026 13:20:20 +0200 Subject: [PATCH 23/32] assert event creation --- src/game/shared/neo/neo_player_shared.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index 0b4ff8666a..0a0dbf6a96 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -176,6 +176,7 @@ void CheckPingButton(CNEO_Player* player) } IGameEvent* event = gameeventmanager->CreateEvent("player_ping"); + Assert(event); if (event) { trace_t tr; From e46557821a9d12534dd8460c4958258a370bb277 Mon Sep 17 00:00:00 2001 From: Rain <6595066+Rainyan@users.noreply.github.com> Date: Wed, 4 Nov 2026 13:28:39 +0200 Subject: [PATCH 24/32] refactor --- src/game/client/neo/ui/neo_hud_player_ping.cpp | 3 +-- src/game/shared/neo/neo_gamerules.h | 6 ++++++ src/game/shared/neo/neo_player_shared.cpp | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/game/client/neo/ui/neo_hud_player_ping.cpp b/src/game/client/neo/ui/neo_hud_player_ping.cpp index 4e2af1f6eb..4d1cfd2b7a 100644 --- a/src/game/client/neo/ui/neo_hud_player_ping.cpp +++ b/src/game/client/neo/ui/neo_hud_player_ping.cpp @@ -140,9 +140,8 @@ void CNEOHud_PlayerPing::FireGameEvent(IGameEvent* event) void CNEOHud_PlayerPing::OnPlayerPing(const IGameEvent* event) { - // Don't team-ping for non-teamplay modes. // This is already checked by the emitter side, but we check again because it could arrive late (dynamic custom rule change etc.) - if (!NEORules() || !NEORules()->IsTeamplay()) + if (!NEORules() || !NEORules()->ArePingsAllowed()) { return; } diff --git a/src/game/shared/neo/neo_gamerules.h b/src/game/shared/neo/neo_gamerules.h index 1bdee613ae..f6c0f1895a 100644 --- a/src/game/shared/neo/neo_gamerules.h +++ b/src/game/shared/neo/neo_gamerules.h @@ -450,6 +450,12 @@ class CNEORules : public CHL2MPRules, public CGameEventListener bool IsClassFull(int team, int classId) const; int GetFallbackClass(int team, int preferredClass) const; + inline bool ArePingsAllowed() + { + // Only allow pings for game modes with friendlies, because it makes no sense to send pings to your enemies. + return IsTeamplay(); + } + public: #ifdef GAME_DLL // Workaround for bot spawning. See Bot_f() for details. diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index 0a0dbf6a96..df80a051f6 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -151,8 +151,8 @@ void CheckPingButton(CNEO_Player* player) } #ifdef GAME_DLL - if (!GameRules() || !GameRules()->IsTeamplay()) - { // because for game modes with no friendlies, it would make no sense to send pings to enemies + if (!NEORules() || !NEORules()->ArePingsAllowed()) + { return; } #endif From c386bf340d77e51c025e36773c4508eda96a5d28 Mon Sep 17 00:00:00 2001 From: Rain <6595066+Rainyan@users.noreply.github.com> Date: Wed, 4 Nov 2026 13:29:49 +0200 Subject: [PATCH 25/32] predict NEORules::ArePingsAllowed --- src/game/shared/neo/neo_player_shared.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index df80a051f6..d37943aca4 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -149,13 +149,11 @@ void CheckPingButton(CNEO_Player* player) { return; } - -#ifdef GAME_DLL + if (!NEORules() || !NEORules()->ArePingsAllowed()) { return; } -#endif if (!player->IsAlive()) { From 32a4ca7d0876f32c7722ea04912612b1d5ee1b3a Mon Sep 17 00:00:00 2001 From: Rain <6595066+Rainyan@users.noreply.github.com> Date: Wed, 4 Nov 2026 13:32:26 +0200 Subject: [PATCH 26/32] refactor --- src/game/shared/neo/neo_player_shared.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index d37943aca4..f9f19ec183 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -149,7 +149,7 @@ void CheckPingButton(CNEO_Player* player) { return; } - + if (!NEORules() || !NEORules()->ArePingsAllowed()) { return; From a64ece5e4e3bcaffaa94b954910c35eff57b39b4 Mon Sep 17 00:00:00 2001 From: Rain <6595066+Rainyan@users.noreply.github.com> Date: Wed, 4 Nov 2026 13:45:05 +0200 Subject: [PATCH 27/32] remove incorrect assertion Remove the incorrect assertion of the function predicate flow being mutually exclusive with this code path (not true for teamplay maps with 0 named navmesh places). This is handled gracefully so this assertion can be removed. --- src/game/server/nav_mesh.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/game/server/nav_mesh.cpp b/src/game/server/nav_mesh.cpp index ff531d0a48..cfc7321e7d 100644 --- a/src/game/server/nav_mesh.cpp +++ b/src/game/server/nav_mesh.cpp @@ -1043,9 +1043,6 @@ CNavArea *CNavMesh::GetNearestNavArea( const Vector &pos, bool anyZ, float maxDi } } } -#ifdef NEO - AssertMsg(!ignorePredicate || !ignorePredicate(close), "Result should be ignored but it wasn't"); -#endif return close; } From f246574171f3ecb65500ef8c4f3865153ec48b6d Mon Sep 17 00:00:00 2001 From: Rain <6595066+Rainyan@users.noreply.github.com> Date: Wed, 4 Nov 2026 13:51:16 +0200 Subject: [PATCH 28/32] Remove incorrect assertion Continuation of a64ece5e for removal of the incorrect & redundant asserts. --- src/game/shared/neo/neo_player_shared.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index f9f19ec183..3641001a4b 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -223,8 +223,6 @@ void CheckPingButton(CNEO_Player* player) const char* placeName = TheNavMesh->PlaceToName(nearestNamedNavAreaOfPing->GetPlace()); event->SetString("place_name", placeName); - - AssertMsg(!pingPlaceNameIsExact || (placeName && *placeName), "Exact named place but place name is empty"); } } gameeventmanager->FireEvent(event); From 62dd24e2fc2183fa7819edb07625b1272293720f Mon Sep 17 00:00:00 2001 From: Rain <6595066+Rainyan@users.noreply.github.com> Date: Wed, 4 Nov 2026 14:11:39 +0200 Subject: [PATCH 29/32] Appease GCC As adapted from code review feedback: https://github.com/NeotokyoRebuild/neo/pull/2189#discussion_r4463013438 Co-authored-by: Dan Peavey --- src/game/shared/neo/neo_player_shared.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index 3641001a4b..e231a1ddec 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -205,7 +205,9 @@ void CheckPingButton(CNEO_Player* player) return !area || !TheNavMesh->PlaceToName(area->GetPlace()); }; return TheNavMesh->GetNearestNavArea(pingPos, true, maxDist, false, false, TEAM_ANY, - requireAreaBeNamed ? ignoreNamelessPlaces : nullptr); + requireAreaBeNamed + ? static_cast(ignoreNamelessPlaces) + : nullptr); }; constexpr float maxPingAreaDist = 1024; From 1dc2eb0b0bae01bb77635d7629ba781ffaf18494 Mon Sep 17 00:00:00 2001 From: Rain Date: Fri, 6 Nov 2026 14:54:42 +0200 Subject: [PATCH 30/32] Fix "cl_neo_player_pings_print_own" regression Co-authored-by: Dan Peavey --- .../client/neo/ui/neo_hud_player_ping.cpp | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/game/client/neo/ui/neo_hud_player_ping.cpp b/src/game/client/neo/ui/neo_hud_player_ping.cpp index 4d1cfd2b7a..557704f061 100644 --- a/src/game/client/neo/ui/neo_hud_player_ping.cpp +++ b/src/game/client/neo/ui/neo_hud_player_ping.cpp @@ -151,13 +151,6 @@ void CNEOHud_PlayerPing::OnPlayerPing(const IGameEvent* event) return; } - const bool thisIsPredictedPing = !event->GetBool("server", false); - if (thisIsPredictedPing) - { - // don't print predicted (bogus) placenames; we only wanna predict the in-world visuals but not the place text - return; - } - const auto localPlayer = C_NEO_Player::GetLocalNEOPlayer(); Assert(localPlayer); const auto localTeamNumber = localPlayer->GetTeamNumber(); @@ -165,16 +158,13 @@ void CNEOHud_PlayerPing::OnPlayerPing(const IGameEvent* event) const int pingerIndex = engine->GetPlayerForUserID(event->GetInt("userid")); Assert(pingerIndex >= 0); - if (pingerIndex == localPlayer->entindex()) + const bool isOwnPing = (pingerIndex == localPlayer->entindex()); + if (!isOwnPing) { - static ConVarRef cl_neo_player_pings_print_own("cl_neo_player_pings_print_own"); - Assert(cl_neo_player_pings_print_own.IsValid()); - if (!cl_neo_player_pings_print_own.GetBool()) + if (pingerIndex == 0 || GetClientVoiceMgr()->IsPlayerBlocked(pingerIndex)) + { return; - } - else if (pingerIndex == 0 || GetClientVoiceMgr()->IsPlayerBlocked(pingerIndex)) - { - return; + } } const int pingRecipientTeam = event->GetInt("playerteam"); @@ -210,6 +200,21 @@ void CNEOHud_PlayerPing::OnPlayerPing(const IGameEvent* event) const bool ghosterPing = event->GetBool("ghosterping"); SetPos(pingerSlot, pingRecipientTeam, worldpos, ghosterPing); + const bool thisIsPredictedPing = !event->GetBool("server", false); + if (thisIsPredictedPing) + { + // don't print predicted (bogus) placenames; we only wanna predict the in-world visuals but not the place text + return; + } + + if (isOwnPing) + { + static ConVarRef cl_neo_player_pings_print_own("cl_neo_player_pings_print_own"); + Assert(cl_neo_player_pings_print_own.IsValid()); + if (!cl_neo_player_pings_print_own.GetBool()) + return; + } + const bool placeIsExact = event->GetBool("place_exact"); const char* placeName = event->GetString("place_name"); NotifyPing(pingerSlot, placeName, placeIsExact); From 1d325658cd9b0f07c5c7bca2eee9f648e86d5a9c Mon Sep 17 00:00:00 2001 From: Rain Date: Fri, 6 Nov 2026 15:30:48 +0200 Subject: [PATCH 31/32] Be explicit about the condition for pinging enemies Merging the ping behaviour behind `CNEORules::ArePingsAllowed` as part of PR #2189. This is a no-op at time of this commit, since we're essentially just inlining the `IsTeamplay` call, but it makes the intent more explicit and aligns with the PR changes. --- src/game/server/neo/bot/behavior/neo_bot_behavior.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/server/neo/bot/behavior/neo_bot_behavior.cpp b/src/game/server/neo/bot/behavior/neo_bot_behavior.cpp index c85df07851..268c0c176e 100644 --- a/src/game/server/neo/bot/behavior/neo_bot_behavior.cpp +++ b/src/game/server/neo/bot/behavior/neo_bot_behavior.cpp @@ -1063,7 +1063,7 @@ void CNEOBotMainAction::FireWeaponAtEnemy( CNEOBot *me ) if (bOnTarget) { - if (NEORules()->IsTeamplay()) + if (NEORules()->ArePingsAllowed()) { me->PressSpecialFireButton(); // place a player ping to alert friends } From d598dbc53431f5bfdf72135333ddee60fa276e4e Mon Sep 17 00:00:00 2001 From: rain Date: Wed, 18 Nov 2026 19:33:42 +0200 Subject: [PATCH 32/32] review feedback: i'm not sure what exactly we're doing here but we most certainly are doing it --- src/game/shared/neo/neo_gamerules.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/game/shared/neo/neo_gamerules.h b/src/game/shared/neo/neo_gamerules.h index f6c0f1895a..4e5dae0235 100644 --- a/src/game/shared/neo/neo_gamerules.h +++ b/src/game/shared/neo/neo_gamerules.h @@ -452,6 +452,11 @@ class CNEORules : public CHL2MPRules, public CGameEventListener inline bool ArePingsAllowed() { + constexpr auto modesWhereWeUseSaneLogic = NEO_GAME_TYPE_CTG; + if (GetGameType() != modesWhereWeUseSaneLogic) + { + return true; + } // Only allow pings for game modes with friendlies, because it makes no sense to send pings to your enemies. return IsTeamplay(); }