diff --git a/dlls/cbase.h b/dlls/cbase.h index eb45cdc8..e56d7632 100644 --- a/dlls/cbase.h +++ b/dlls/cbase.h @@ -398,6 +398,15 @@ class EXPORT CBaseEntity // true if the entity is networked to the given player inline bool isVisibleTo(edict_t* player) { return m_netPlayers & PLRBIT(player); } + // true if the entity was flagged to be hidden from the given player + inline bool isHiddenFrom(edict_t* player) { return m_hidePlayers & PLRBIT(player); } + + // flag this entity to be visible/invisible to the given player + inline void SetVisible(edict_t* player, bool visible) { + if (visible) m_hidePlayers &= ~PLRBIT(player); + else m_hidePlayers |= PLRBIT(player); + } + //We use this variables to store each ammo count. int ammo_9mm; int ammo_357; @@ -420,6 +429,7 @@ class EXPORT CBaseEntity uint32_t m_pasPlayers; // players in the audible set of this entity (invalid for invisible ents) uint32_t m_pvsPlayers; // players in the visible set of this entity (invalid for invisible ents) uint32_t m_netPlayers; // players this entity has been networked to (AddToFullPack returned 1) + uint32_t m_hidePlayers; // players this entity will be hidden from (AddToFullPack) }; diff --git a/dlls/client.cpp b/dlls/client.cpp index bcba5219..821e4f40 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -1128,7 +1128,7 @@ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *h return 0; } - if (invisible || forceVisChecks) { + if (invisible || forceVisChecks || (baseent->m_hidePlayers & plrbit)) { return 0; }