diff options
author | Andrey Nazarov <skuller@skuller.net> | 2012-02-02 22:09:45 +0400 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2012-04-03 01:25:48 +0400 |
commit | 11e971ca37d6612741c95a1b950cfa51e90a36a5 (patch) | |
tree | ea8ea9ef2cb578e9dbf4e15869507f32d1e81766 /src/sv_world.c | |
parent | 512592f3fa7002f01eae335bba39a3a09424a0f2 (diff) |
Rename SV_EdictPV to SV_EdictIsVisible.
Also move it into sv_world.c.
Diffstat (limited to 'src/sv_world.c')
-rw-r--r-- | src/sv_world.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/sv_world.c b/src/sv_world.c index 47aed67..d03bcf3 100644 --- a/src/sv_world.c +++ b/src/sv_world.c @@ -121,6 +121,31 @@ void SV_ClearWorld(void) } } +/* +=============== +SV_EdictIsVisible + +Checks if edict is potentially visible from the given PVS row. +=============== +*/ +qboolean SV_EdictIsVisible(cm_t *cm, edict_t *ent, byte *mask) +{ + int i; + + if (ent->num_clusters == -1) { + // too many leafs for individual check, go by headnode + return CM_HeadnodeVisible(CM_NodeNum(cm, ent->headnode), mask); + } + + // check individual leafs + for (i = 0; i < ent->num_clusters; i++) { + if (Q_IsBitSet(mask, ent->clusternums[i])) { + return qtrue; + } + } + + return qfalse; // not visible +} /* =============== @@ -465,8 +490,6 @@ int SV_PointContents(vec3_t p) return contents; } - - typedef struct { vec3_t boxmins, boxmaxs;// enclose the test object along entire move vec_t *mins, *maxs; // size of the moving object |