Add force visibility effect (#406)

* Add force visibility effect
This commit is contained in:
fl0werD 2019-08-29 17:51:41 +04:00 committed by Dmitry Novikov
parent 77305688a9
commit 80e8730187
2 changed files with 27 additions and 18 deletions

View File

@ -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

View File

@ -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;