//============================================================================
+int checkpvsbytes;
qbyte checkpvs[MAX_MAP_LEAFS/8];
int PF_newcheckclient (int check)
}
// get the PVS for the entity
- VectorAdd (ent->v->origin, ent->v->view_ofs, org);
- memcpy (checkpvs, sv.worldmodel->brushq1.LeafPVS(sv.worldmodel, sv.worldmodel->brushq1.PointInLeaf(sv.worldmodel, org)), (sv.worldmodel->brushq1.numleafs+7)>>3 );
+ VectorAdd(ent->v->origin, ent->v->view_ofs, org);
+ checkpvsbytes = 0;
+ if (sv.worldmodel && sv.worldmodel->brush.FatPVS)
+ checkpvsbytes = sv.worldmodel->brush.FatPVS(sv.worldmodel, org, 0, checkpvs, sizeof(checkpvs));
return i;
}
void PF_checkclient (void)
{
edict_t *ent, *self;
- mleaf_t *leaf;
- int l;
vec3_t view;
// find a new check if on a new frame
// if current entity can't possibly see the check entity, return 0
self = PROG_TO_EDICT(pr_global_struct->self);
- VectorAdd (self->v->origin, self->v->view_ofs, view);
- leaf = sv.worldmodel->brushq1.PointInLeaf(sv.worldmodel, view);
- if (leaf)
+ VectorAdd(self->v->origin, self->v->view_ofs, view);
+ if (sv.worldmodel && checkpvsbytes && !sv.worldmodel->brush.BoxTouchingPVS(sv.worldmodel, checkpvs, view, view))
{
- l = (leaf - sv.worldmodel->brushq1.leafs) - 1;
- if ( (l<0) || !(checkpvs[l>>3] & (1<<(l&7)) ) )
- {
- c_notvis++;
- RETURN_EDICT(sv.edicts);
- return;
- }
+ c_notvis++;
+ RETURN_EDICT(sv.edicts);
+ return;
}
// might be able to see it
Host_Error ("PF_Precache_*: Precache can only be done in spawn functions");
s = G_STRING(OFS_PARM0);
- if (sv.worldmodel->brushq1.ishlbsp && ((!s) || (!s[0])))
+ if (sv.worldmodel->brush.ishlbsp && ((!s) || (!s[0])))
return;
G_INT(OFS_RETURN) = G_INT(OFS_PARM0);
PR_CheckEmptyString (s);
if (modelindex < 1 || modelindex >= MAX_MODELS)
return NULL;
model = sv.models[modelindex];
- if (model->type != mod_brush)
- return NULL;
if (surfnum < 0 || surfnum >= model->brushq1.nummodelsurfaces)
return NULL;
return model->brushq1.surfaces + surfnum + model->brushq1.firstmodelsurface;
if (modelindex < 1 || modelindex >= MAX_MODELS)
return;
model = sv.models[modelindex];
- if (model->type != mod_brush)
+ if (!model->brushq1.numsurfaces)
return;
// FIXME: implement rotation/scaling