diff --git a/mp/src/game/server/neo/neo_player.cpp b/mp/src/game/server/neo/neo_player.cpp index deb6b88adc..46b392d376 100644 --- a/mp/src/game/server/neo/neo_player.cpp +++ b/mp/src/game/server/neo/neo_player.cpp @@ -111,7 +111,7 @@ DEFINE_FIELD(m_szNameDupePos, FIELD_INTEGER), DEFINE_FIELD(m_bClientWantNeoName, FIELD_BOOLEAN), END_DATADESC() -#define SHOWMENU_STRLIMIT (512) +static constexpr int SHOWMENU_STRLIMIT = 512; CBaseEntity *g_pLastJinraiSpawn, *g_pLastNSFSpawn; CNEOGameRulesProxy* neoGameRules; @@ -1203,13 +1203,18 @@ bool CNEO_Player::ClientCommand( const CCommand &args ) // menuselect being used by damage stats switch (slot) { - case 1: // Dismiss + case DAMAGE_MENU_SELECT_DISMISS: + case DAMAGE_MENU_SELECT_DONOTSHOW: { m_iDmgMenuCurPage = 0; m_iDmgMenuNextPage = 0; + if (slot == DAMAGE_MENU_SELECT_DONOTSHOW) + { + m_bDoNotShowDmgInfoMenu = true; + } break; } - case 2: // Next-page + case DAMAGE_MENU_SELECT_NEXTPAGE: { char infoStr[SHOWMENU_STRLIMIT]; int infoStrSize = 0; @@ -1280,6 +1285,11 @@ bool CNEO_Player::BecomeRagdollOnClient( const Vector &force ) void CNEO_Player::ShowDmgInfo(char* infoStr, int infoStrSize) { + if (m_bDoNotShowDmgInfoMenu) + { + return; + } + CSingleUserRecipientFilter filter(this); filter.MakeReliable(); @@ -1298,8 +1308,16 @@ void CNEO_Player::ShowDmgInfo(char* infoStr, int infoStrSize) } UserMessageBegin(filter, "ShowMenu"); { - WRITE_SHORT(static_cast(m_iDmgMenuNextPage ? 3 : 1)); // Amount of options - WRITE_CHAR(static_cast(60)); // 60s timeout + // The key options available in bitwise (EX: 1 -> 1 << 0, 9 -> 1 << 8) + short sBitwiseOpts = + 1 << (DAMAGE_MENU_SELECT_DISMISS - 1) + | 1 << (DAMAGE_MENU_SELECT_DONOTSHOW - 1); + if (m_iDmgMenuNextPage) + { + sBitwiseOpts |= 1 << (DAMAGE_MENU_SELECT_NEXTPAGE - 1); + } + WRITE_SHORT(sBitwiseOpts); + WRITE_CHAR(static_cast(10)); // 10s timeout WRITE_BYTE(static_cast(infoStrSize > MAX_INFOSTR_PER_UMSG)); WRITE_STRING(infoStr + infoStrOffset); } @@ -1320,10 +1338,10 @@ int CNEO_Player::SetDmgListStr(char* infoStr, const int infoStrMax, const int pl Assert(infoStrSize != NULL); Assert(showMenu != NULL); *showMenu = false; - static const int TITLE_LEN = 30; // Rough-approximate - static const int POSTFIX_LEN = 15 + 12; - static const int TOTALLINE_LEN = 64; // Rough-approximate - static int FILLSTR_END = SHOWMENU_STRLIMIT - POSTFIX_LEN - TOTALLINE_LEN - 2; + static constexpr int TITLE_LEN = 30; // Rough-approximate + static constexpr int POSTFIX_LEN = 16 + 12 + 24; + static constexpr int TOTALLINE_LEN = 64; // Rough-approximate + static constexpr int FILLSTR_END = SHOWMENU_STRLIMIT - POSTFIX_LEN - TOTALLINE_LEN - 2; memset(infoStr, 0, infoStrMax); Q_snprintf(infoStr, infoStrMax, "Damage infos (Round %d):\n", NEORules()->roundNumber()); if (info) @@ -1407,6 +1425,7 @@ int CNEO_Player::SetDmgListStr(char* infoStr, const int infoStrMax, const int pl { Q_strncat(infoStr, "\n->2. Next", infoStrMax, COPY_ALL_CHARACTERS); } + Q_strncat(infoStr, "\n->9. Do not show again", infoStrMax, COPY_ALL_CHARACTERS); *infoStrSize = Q_strlen(infoStr); return nextPage; diff --git a/mp/src/game/server/neo/neo_player.h b/mp/src/game/server/neo/neo_player.h index 90e5c181c1..fd8321480f 100644 --- a/mp/src/game/server/neo/neo_player.h +++ b/mp/src/game/server/neo/neo_player.h @@ -16,6 +16,13 @@ class INEOPlayerAnimState; #include "neo_player_shared.h" +enum EDmgMenuSelect +{ + DAMAGE_MENU_SELECT_DISMISS = 1, + DAMAGE_MENU_SELECT_NEXTPAGE = 2, + DAMAGE_MENU_SELECT_DONOTSHOW = 9, +}; + class CNEO_Player : public CHL2MP_Player { public: @@ -238,6 +245,7 @@ class CNEO_Player : public CHL2MP_Player int m_iTeamDamageInflicted = 0; int m_iTeamKillsInflicted = 0; bool m_bIsPendingTKKick = false; // To not spam the kickid ConCommand + bool m_bDoNotShowDmgInfoMenu = false; private: bool m_bFirstDeathTick; diff --git a/mp/src/game/shared/neo/neo_gamerules.cpp b/mp/src/game/shared/neo/neo_gamerules.cpp index 72ae35135a..8725b2d796 100644 --- a/mp/src/game/shared/neo/neo_gamerules.cpp +++ b/mp/src/game/shared/neo/neo_gamerules.cpp @@ -514,6 +514,7 @@ void CNEORules::ResetMapSessionCommon() pPlayer->m_iTeamKillsInflicted = 0; pPlayer->m_bIsPendingTKKick = false; pPlayer->m_bKilledInflicted = false; + pPlayer->m_bDoNotShowDmgInfoMenu = false; } } m_flPrevThinkKick = 0.0f; @@ -1494,6 +1495,7 @@ void CNEORules::StartNextRound() pPlayer->m_iXP.Set(0); pPlayer->m_iTeamDamageInflicted = 0; pPlayer->m_iTeamKillsInflicted = 0; + pPlayer->m_bDoNotShowDmgInfoMenu = false; } pPlayer->m_bIsPendingTKKick = false;