Skip to content
Open
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
1 change: 1 addition & 0 deletions src/game/client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1575,6 +1575,7 @@ set(UNITY_SOURCE_NEO_SRC_CLIENT
neo/neo_fixup_glshaders.cpp
neo/c_neo_bloom_controller.cpp
neo/neo_killer_damage_info.cpp
neo/c_neo_killer_infos.cpp
)

set_source_files_properties(
Expand Down
8 changes: 8 additions & 0 deletions src/game/client/hl2mp/c_hl2mp_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,14 @@ void C_HL2MP_Player::PostDataUpdate( DataUpdateType_t updateType )
{
MoveToLastReceivedPosition( true );
ResetLatched();
#ifdef NEO
// NEO NOTE (nullsystem): Respawning doesn't trigger
// C_NEO_Player::Spawn/m_bFirstAliveTick without this
if (IsLocalPlayer())
{
static_cast<C_NEO_Player *>(this)->m_bFirstAliveTick = true;
}
#endif
m_iSpawnInterpCounterCache = m_iSpawnInterpCounter;
}

Expand Down
10 changes: 10 additions & 0 deletions src/game/client/neo/c_neo_killer_infos.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "c_neo_killer_infos.h"

#include "strtools.h"

void NeoUserIDsLocalKilledClear()
{
g_neoUserIDsLocalKilledSize = 0;
V_memset(g_neoUserIDsLocalKilled, 0, sizeof(g_neoUserIDsLocalKilled));
}

9 changes: 8 additions & 1 deletion src/game/client/neo/c_neo_killer_infos.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include "shareddefs.h"

static constexpr const int WEP_NAME_MAXSTRLEN = 32;

struct CNEOKillerInfos
Expand All @@ -13,5 +15,10 @@ struct CNEOKillerInfos
wchar_t wszKilledWith[WEP_NAME_MAXSTRLEN];
};

// Global instance of CNEOKillerInfos
void NeoUserIDsLocalKilledClear();

// Global instance of CNEOKillerInfos and local-player's kill record
inline CNEOKillerInfos g_neoKillerInfos;
inline int g_neoUserIDsLocalKilledSize;
inline int g_neoUserIDsLocalKilled[MAX_PLAYERS_ARRAY_SAFE];

7 changes: 5 additions & 2 deletions src/game/client/neo/c_neo_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ C_NEO_Player::C_NEO_Player()
m_flTocFactor = 0.15f;

memset(m_szNeoNameWDupeIdx, 0, sizeof(m_szNeoNameWDupeIdx));
if (IsLocalPlayer()) NeoUserIDsLocalKilledClear();
m_szNameDupePos = 0;
}

Expand Down Expand Up @@ -1207,6 +1208,9 @@ void C_NEO_Player::PreThink( void )
CLocalPlayerFilter filter;
enginesound->SetPlayerDSP(filter, 0, true);

NeoUserIDsLocalKilledClear();
V_memset(&g_neoKillerInfos, 0, sizeof(CNEOKillerInfos));

// Reset the cache of other players crosshair data on spawning in
if (CHudCrosshair *crosshair = GET_HUDELEMENT(CHudCrosshair))
{
Expand Down Expand Up @@ -1625,11 +1629,10 @@ void C_NEO_Player::Spawn( void )
m_rfAttackersAccumlator.GetForModify(i) = 0.0f;
m_rfAttackersHits.GetForModify(i) = 0;
}
V_memset(m_rfNeoPlayerIdxsKilledByLocal, 0, sizeof(m_rfNeoPlayerIdxsKilledByLocal));
if (IsLocalPlayer()) NeoUserIDsLocalKilledClear();

Weapon_SetZoom(false);


SetViewOffset(VEC_VIEW_NEOSCALE(this));

auto *localPlayer = C_NEO_Player::GetLocalNEOPlayer();
Expand Down
5 changes: 2 additions & 3 deletions src/game/client/neo/c_neo_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ class C_NEO_Player : public C_HL2MP_Player
unsigned char m_NeoFlags;

private:
friend C_HL2MP_Player;

bool m_bFirstAliveTick;
bool m_bFirstDeathTick;
bool m_bPreviouslyReloading;
Expand All @@ -278,9 +280,6 @@ class C_NEO_Player : public C_HL2MP_Player
mutable char m_szNeoNameWDupeIdx[MAX_PLAYER_NAME_LENGTH + 10];
mutable int m_szNeoNameLocalDupeIdx;

public:
bool m_rfNeoPlayerIdxsKilledByLocal[MAX_PLAYERS_ARRAY_SAFE];

private:
C_NEO_Player(const C_NEO_Player &);
};
Expand Down
22 changes: 19 additions & 3 deletions src/game/client/neo/ui/neo_hud_deathnotice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,8 @@ void CNEOHud_DeathNotice::AddPlayerDeath(IGameEvent* event)
{
// the event should be "player_death"
const int killer = engine->GetPlayerForUserID(event->GetInt("attacker"));
const int victim = engine->GetPlayerForUserID(event->GetInt("userid"));
const int iVictimUserID = event->GetInt("userid");
const int victim = engine->GetPlayerForUserID(iVictimUserID);
const int assistInt = event->GetInt("assists");
const int assist = engine->GetPlayerForUserID(assistInt);
const bool hasAssists = assist > 0;
Expand Down Expand Up @@ -859,9 +860,24 @@ void CNEOHud_DeathNotice::AddPlayerDeath(IGameEvent* event)
deathMsg.bInvolved = killer == GetLocalPlayerIndex() || victim == GetLocalPlayerIndex() || assist == GetLocalPlayerIndex();
Assert(victim >= 0 && victim < (MAX_PLAYERS + 1));
C_NEO_Player *localPlayer = C_NEO_Player::GetLocalNEOPlayer();
if (localPlayer)
if (localPlayer
&& killer == localPlayer->entindex()
&& g_neoUserIDsLocalKilledSize < MAX_PLAYERS_ARRAY_SAFE)
{
localPlayer->m_rfNeoPlayerIdxsKilledByLocal[victim] = (killer == localPlayer->entindex());
// Sanity check it's not there already just in-case
bool bVictimUserIDExists = false;
for (int i = 0; i < g_neoUserIDsLocalKilledSize; ++i)
{
if (iVictimUserID == g_neoUserIDsLocalKilled[i])
{
bVictimUserIDExists = true;
break;
}
}
if (false == bVictimUserIDExists)
{
g_neoUserIDsLocalKilled[g_neoUserIDsLocalKilledSize++] = iVictimUserID;
}
}

SetDeathNoticeItemDimensions(&deathMsg);
Expand Down
14 changes: 6 additions & 8 deletions src/game/client/neo/ui/neo_hud_killer_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,6 @@ void CNEOHud_KillerInfo::resetHUDState()

void CNEOHud_KillerInfo::UpdateStateForNeoHudElementDraw()
{
const bool bIsPreRoundFreeze = (NEORules()->GetRoundStatus() == NeoRoundStatus::PreRoundFreeze);
if (bIsPreRoundFreeze && false == m_preRoundFreezeCleared)
{
resetHUDState();
}
m_preRoundFreezeCleared = bIsPreRoundFreeze;

// If to show or not
const C_NEO_Player *pLocalPlayer = C_NEO_Player::GetLocalNEOPlayer();
m_bPlayerShownHud = pLocalPlayer
Expand All @@ -91,8 +84,13 @@ void CNEOHud_KillerInfo::UpdateStateForNeoHudElementDraw()

void CNEOHud_KillerInfo::DrawNeoHudElement()
{
if (!ShouldDraw() || !m_bPlayerShownHud)
{
return;
}

const C_NEO_Player *pLocalPlayer = C_NEO_Player::GetLocalNEOPlayer();
if (!ShouldDraw() || !m_bPlayerShownHud || !pLocalPlayer)
if (!pLocalPlayer)
{
return;
}
Expand Down
1 change: 0 additions & 1 deletion src/game/client/neo/ui/neo_hud_killer_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,5 @@ class CNEOHud_KillerInfo : public CNEOHud_ChildElement, public CHudElement, publ
vgui::HFont m_hFontNormal;
vgui::HFont m_hFontTitle;
CAvatarImage m_avatar;
bool m_preRoundFreezeCleared = false;
bool m_bPlayerShownHud = false;
};
10 changes: 9 additions & 1 deletion src/game/client/neo/ui/neo_scoreboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,15 @@ void CNEOScoreBoard::Update()
pPlayerInfo->iTakenDmgs = pLocalPlayer->GetAttackersScores(pNeoPlayer->entindex());
pPlayerInfo->iTakenHits = pLocalPlayer->GetAttackerHits(pNeoPlayer->entindex());
pPlayerInfo->bKilledYou = (pNeoPlayer->entindex() == g_neoKillerInfos.iEntIndex);
pPlayerInfo->bYouKilled = pLocalPlayer->m_rfNeoPlayerIdxsKilledByLocal[pNeoPlayer->entindex()];
pPlayerInfo->bYouKilled = false;
for (int i = 0; i < g_neoUserIDsLocalKilledSize; ++i)
{
if (g_neoUserIDsLocalKilled[i] == pPlayerInfo->iUserID)
{
pPlayerInfo->bYouKilled = true;
break;
}
}
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/game/client/neo/ui/neo_scoreboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class CNEOScoreBoard : public vgui::Panel, public IViewPortPanel, public CGameEv

int m_HLTVSpectators = 0;
int m_iTotalPlayers = 0;
CNEOScoreBoardPlayer m_playersInfo[MAX_PLAYERS + 1] = {};
CNEOScoreBoardPlayer m_playersInfo[MAX_PLAYERS_ARRAY_SAFE] = {};
CNEOScoreBoardPlayer m_playerPopup = {};

wchar_t m_wszHostname[128] = {};
Expand Down