From 80e8730187ae03652ab1c6ed5c9f0d990f28c0ac Mon Sep 17 00:00:00 2001 From: fl0werD Date: Thu, 29 Aug 2019 17:51:41 +0400 Subject: [PATCH] Add force visibility effect (#406) * Add force visibility effect --- regamedll/common/const.h | 23 ++++++++++++----------- regamedll/dlls/client.cpp | 22 +++++++++++++++------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/regamedll/common/const.h b/regamedll/common/const.h index f3c9b8dc..c12e3769 100644 --- a/regamedll/common/const.h +++ b/regamedll/common/const.h @@ -130,17 +130,18 @@ #define DAMAGE_AIM 2 // entity effects -#define EF_BRIGHTFIELD 1 // swirling cloud of particles -#define EF_MUZZLEFLASH 2 // single frame ELIGHT on entity attachment 0 -#define EF_BRIGHTLIGHT 4 // DLIGHT centered at entity origin -#define EF_DIMLIGHT 8 // player flashlight -#define EF_INVLIGHT 16 // get lighting from ceiling -#define EF_NOINTERP 32 // don't interpolate the next frame -#define EF_LIGHT 64 // rocket flare glow sprite -#define EF_NODRAW 128 // don't draw entity -#define EF_NIGHTVISION 256 // player nightvision -#define EF_SNIPERLASER 512 // sniper laser effect -#define EF_FIBERCAMERA 1024 // fiber camera +#define EF_BRIGHTFIELD (1<<0) // swirling cloud of particles +#define EF_MUZZLEFLASH (1<<1) // single frame ELIGHT on entity attachment 0 +#define EF_BRIGHTLIGHT (1<<2) // DLIGHT centered at entity origin +#define EF_DIMLIGHT (1<<3) // player flashlight +#define EF_INVLIGHT (1<<4) // get lighting from ceiling +#define EF_NOINTERP (1<<5) // don't interpolate the next frame +#define EF_LIGHT (1<<6) // rocket flare glow sprite +#define EF_NODRAW (1<<7) // don't draw entity +#define EF_NIGHTVISION (1<<8) // player nightvision +#define EF_SNIPERLASER (1<<9) // sniper laser effect +#define EF_FIBERCAMERA (1<<10) // fiber camera +#define EF_FORCEVISIBILITY (1<<11) // force visibility // entity flags #define EFLAG_SLERP 1 // do studio interpolation of this entity diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index 204e6081..9b65b858 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -4300,17 +4300,22 @@ BOOL EXT_FUNC AddToFullPack(struct entity_state_s *state, int e, edict_t *ent, e if (CheckPlayerPVSLeafChanged(host, hostnum)) ResetPlayerPVS(host, hostnum); - if (ent != host) +#ifdef REGAMEDLL_ADD + if ((ent->v.effects & EF_FORCEVISIBILITY) != EF_FORCEVISIBILITY) +#endif { - if (!CheckEntityRecentlyInPVS(hostnum, e, gpGlobals->time)) + if (ent != host) { - if (!ENGINE_CHECK_VISIBILITY(ent, pSet)) + if (!CheckEntityRecentlyInPVS(hostnum, e, gpGlobals->time)) { - MarkEntityInPVS(hostnum, e, 0, false); - return FALSE; - } + if (!ENGINE_CHECK_VISIBILITY(ent, pSet)) + { + MarkEntityInPVS(hostnum, e, 0, false); + return FALSE; + } - MarkEntityInPVS(hostnum, e, gpGlobals->time, true); + MarkEntityInPVS(hostnum, e, gpGlobals->time, true); + } } } @@ -4363,6 +4368,9 @@ BOOL EXT_FUNC AddToFullPack(struct entity_state_s *state, int e, edict_t *ent, e state->effects = ent->v.effects; #ifdef REGAMEDLL_ADD + // don't send unhandled custom bit to client + state->effects &= ~EF_FORCEVISIBILITY; + if (ent->v.skin == CONTENTS_LADDER && (host->v.iuser3 & PLAYER_PREVENT_CLIMB) == PLAYER_PREVENT_CLIMB) { state->skin = CONTENTS_EMPTY;