summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2012-02-02 22:09:45 +0400
committerAndrey Nazarov <skuller@skuller.net>2012-04-03 01:25:48 +0400
commit11e971ca37d6612741c95a1b950cfa51e90a36a5 (patch)
treeea8ea9ef2cb578e9dbf4e15869507f32d1e81766
parent512592f3fa7002f01eae335bba39a3a09424a0f2 (diff)
Rename SV_EdictPV to SV_EdictIsVisible.
Also move it into sv_world.c.
-rw-r--r--src/mvd_parse.c2
-rw-r--r--src/sv_ents.c24
-rw-r--r--src/sv_game.c2
-rw-r--r--src/sv_local.h3
-rw-r--r--src/sv_world.c27
5 files changed, 30 insertions, 28 deletions
diff --git a/src/mvd_parse.c b/src/mvd_parse.c
index c6a34f8..ad9e30a 100644
--- a/src/mvd_parse.c
+++ b/src/mvd_parse.c
@@ -551,7 +551,7 @@ static void MVD_ParseSound(mvd_t *mvd, int extrabits)
}
}
BSP_ClusterVis(mvd->cm.cache, mask, leaf->cluster, DVIS_PHS);
- if (!SV_EdictPV(&mvd->cm, entity, mask)) {
+ if (!SV_EdictIsVisible(&mvd->cm, entity, mask)) {
continue; // not in PHS
}
}
diff --git a/src/sv_ents.c b/src/sv_ents.c
index 57bd728..f85d29f 100644
--- a/src/sv_ents.c
+++ b/src/sv_ents.c
@@ -327,28 +327,6 @@ Build a client frame structure
=============================================================================
*/
-qboolean SV_EdictPV(cm_t *cm, edict_t *ent, byte *mask)
-{
- mnode_t *node;
- int i, l;
-
- if (ent->num_clusters == -1) {
- // too many leafs for individual check, go by headnode
- node = CM_NodeNum(cm, ent->headnode);
- return CM_HeadnodeVisible(node, mask);
- }
-
- // check individual leafs
- for (i = 0; i < ent->num_clusters; i++) {
- l = ent->clusternums[i];
- if (Q_IsBitSet(mask, l)) {
- return qtrue;
- }
- }
-
- return qfalse; // not visible
-}
-
#if USE_FPS
static void
fix_old_origin(client_t *client, entity_state_t *state, edict_t *ent, int e)
@@ -504,7 +482,7 @@ void SV_BuildClientFrame(client_t *client)
if (!Q_IsBitSet(clientphs, l))
continue;
} else {
- if (!SV_EdictPV(client->cm, ent, clientpvs)) {
+ if (!SV_EdictIsVisible(client->cm, ent, clientpvs)) {
continue;
}
diff --git a/src/sv_game.c b/src/sv_game.c
index 550b512..71b6fb4 100644
--- a/src/sv_game.c
+++ b/src/sv_game.c
@@ -568,7 +568,7 @@ static void PF_StartSound(edict_t *edict, int channel,
}
}
BSP_ClusterVis(sv.cm.cache, mask, leaf->cluster, DVIS_PHS);
- if (!SV_EdictPV(&sv.cm, edict, mask)) {
+ if (!SV_EdictIsVisible(&sv.cm, edict, mask)) {
continue; // not in PHS
}
}
diff --git a/src/sv_local.h b/src/sv_local.h
index fbcd040..f52dfee 100644
--- a/src/sv_local.h
+++ b/src/sv_local.h
@@ -655,7 +655,6 @@ void SV_BuildProxyClientFrame(client_t *client);
void SV_BuildClientFrame(client_t *client);
void SV_WriteFrameToClient_Default(client_t *client);
void SV_WriteFrameToClient_Enhanced(client_t *client);
-qboolean SV_EdictPV(cm_t *cm, edict_t *ent, byte *mask);
//
// sv_game.c
@@ -705,6 +704,8 @@ int SV_AreaEdicts(vec3_t mins, vec3_t maxs, edict_t **list, int maxcount, int ar
// returns the number of pointers filled in
// ??? does this always return the world?
+qboolean SV_EdictIsVisible(cm_t *cm, edict_t *ent, byte *mask);
+
//===================================================================
//
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