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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 28 additions & 9 deletions mp/src/game/server/neo/neo_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();

Expand All @@ -1298,8 +1308,16 @@ void CNEO_Player::ShowDmgInfo(char* infoStr, int infoStrSize)
}
UserMessageBegin(filter, "ShowMenu");
{
WRITE_SHORT(static_cast<short>(m_iDmgMenuNextPage ? 3 : 1)); // Amount of options
WRITE_CHAR(static_cast<char>(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<char>(10)); // 10s timeout
WRITE_BYTE(static_cast<unsigned int>(infoStrSize > MAX_INFOSTR_PER_UMSG));
WRITE_STRING(infoStr + infoStrOffset);
}
Expand All @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions mp/src/game/server/neo/neo_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions mp/src/game/shared/neo/neo_gamerules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down