Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
don't need a special method for vis checks
  • Loading branch information
wootguy committed Dec 7, 2024
1 parent 27adcde commit be17074
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 23 deletions.
13 changes: 3 additions & 10 deletions common/const.h
Original file line number Diff line number Diff line change
Expand Up @@ -610,16 +610,9 @@

#define CONTENTS_LADDER -16

#define CONTENT_FLYFIELD -17
#define CONTENT_GRAVITY_FLYFIELD -18
#define CONTENT_FOG -19

#define CONTENT_EMPTY -1
#define CONTENT_SOLID -2
#define CONTENT_WATER -3
#define CONTENT_SLIME -4
#define CONTENT_LAVA -5
#define CONTENT_SKY -6
#define CONTENTS_FLYFIELD -17
#define CONTENTS_GRAVITY_FLYFIELD -18
#define CONTENTS_FOG -19

// channels
#define CHAN_AUTO 0
Expand Down
1 change: 0 additions & 1 deletion dlls/CBaseEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ class EXPORT CBaseEntity
virtual int ObjectCaps(void) { return FCAP_ACROSS_TRANSITION; }
virtual void Activate(void) {}
virtual int GetEntindexPriority() { return ENTIDX_PRIORITY_NORMAL; }
virtual bool ForceVisChecks() { return false; } // return true for invisible ents that normally skip VIS checks in AddToFullPack
virtual Vector GetTargetOrigin() { return pev->origin; } // origin used for monster pathing and targetting

// Setup the object->object collision box (pev->mins / pev->maxs is the object->world collision box)
Expand Down
7 changes: 3 additions & 4 deletions dlls/env/CEnvSound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class CEnvSound : public CPointEntity
{
public:
virtual int GetEntindexPriority() { return ENTIDX_PRIORITY_NORMAL; } // TODO: needed for VIS checks but it shouldn't be
virtual bool ForceVisChecks() { return true; }
void KeyValue(KeyValueData* pkvd);
void Spawn(void);

Expand Down Expand Up @@ -209,8 +208,8 @@ void CEnvSound::Spawn()
// spread think times
pev->nextthink = gpGlobals->time + RANDOM_FLOAT(0.0, 0.5);

// must set a model for rehlds to call AddFullToPack
SET_MODEL(edict(), "models/player.mdl");
// model is needed for rehlds to call AddToFullPack
SET_MODEL(edict(), NOT_PRECACHED_MODEL);
pev->rendermode = kRenderTransTexture;
pev->renderamt = 0;
m_hidePlayers = 0xffffffff; // do visibility checks but don't network the entity.
}
8 changes: 3 additions & 5 deletions dlls/hooks/hlds_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1203,10 +1203,8 @@ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *h
// solid entities should always be sent to clients for collision prediction
bool solid = ent->v.solid >= SOLID_BBOX && ent->v.modelindex;

bool forceVisChecks = baseent->ForceVisChecks();

if (invisible && !forceVisChecks && !solid) {
return 0; // exit now unless a vis check was requested for this ent
if (invisible && !solid) {
return 0;
}

CBasePlayer* plr = (CBasePlayer*)GET_PRIVATE(host);
Expand All @@ -1226,7 +1224,7 @@ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *h
return 0;
}

if ((invisible && !solid) || forceVisChecks || (baseent->m_hidePlayers & plrbit)) {
if (baseent->m_hidePlayers & plrbit) {
return 0;
}

Expand Down
6 changes: 3 additions & 3 deletions dlls/player/CBasePlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1422,12 +1422,12 @@ void CBasePlayer::WaterMove()
}
}

if (pev->watertype == CONTENT_LAVA) // do damage
if (pev->watertype == CONTENTS_LAVA) // do damage
{
if (pev->dmgtime < gpGlobals->time)
TakeDamage(VARS(eoNullEntity), VARS(eoNullEntity), 10 * pev->waterlevel, DMG_BURN);
}
else if (pev->watertype == CONTENT_SLIME) // do damage
else if (pev->watertype == CONTENTS_SLIME) // do damage
{
pev->dmgtime = gpGlobals->time + 1;
TakeDamage(VARS(eoNullEntity), VARS(eoNullEntity), 4 * pev->waterlevel, DMG_ACID);
Expand Down Expand Up @@ -3076,7 +3076,7 @@ void CBasePlayer::PostThink()
{
// ALERT ( at_console, "%f\n", m_flFallVelocity );

if (pev->watertype == CONTENT_WATER)
if (pev->watertype == CONTENTS_WATER)
{
// Did he hit the world or a non-moving entity?
// BUG - this happens all the time in water, especially when
Expand Down

0 comments on commit be17074

Please sign in to comment.