Share R_AreaVisible

This commit is contained in:
Denis Pauk 2022-10-30 22:58:55 +02:00
parent c17210b34a
commit d326b1be51
5 changed files with 27 additions and 36 deletions

View file

@ -53,3 +53,20 @@ R_TextureAnimation(const entity_t *currententity, const mtexinfo_t *tex)
return tex->image;
}
qboolean
R_AreaVisible(const byte *areabits, mleaf_t *pleaf)
{
int area;
// check for door connected areas
if (!areabits)
return true;
area = pleaf->area;
if ((areabits[area >> 3] & (1 << (area & 7))))
return true;
return false; // not visible
}

View file

@ -818,13 +818,8 @@ R_RecursiveWorldNode(entity_t *currententity, mnode_t *node)
pleaf = (mleaf_t *)node;
/* check for door connected areas */
if (r_newrefdef.areabits)
{
if (!(r_newrefdef.areabits[pleaf->area >> 3] & (1 << (pleaf->area & 7))))
{
return; /* not visible */
}
}
if (!R_AreaVisible(r_newrefdef.areabits, pleaf))
return; // not visible
mark = pleaf->firstmarksurface;
c = pleaf->nummarksurfaces;

View file

@ -674,13 +674,9 @@ RecursiveWorldNode(entity_t *currententity, mnode_t *node)
pleaf = (mleaf_t *)node;
/* check for door connected areas */
if (gl3_newrefdef.areabits)
{
if (!(gl3_newrefdef.areabits[pleaf->area >> 3] & (1 << (pleaf->area & 7))))
{
return; /* not visible */
}
}
// check for door connected areas
if (!R_AreaVisible(gl3_newrefdef.areabits, pleaf))
return; // not visible
mark = pleaf->firstmarksurface;
c = pleaf->nummarksurfaces;

View file

@ -208,6 +208,8 @@ extern void Mod_LoadSurfedges (const char *name, int **surfedges, int *numsurfed
const byte *mod_base, const lump_t *l, int extra);
extern int Mod_CalcLumpHunkSize(const lump_t *l, int inSize, int outSize, int extra);
extern mleaf_t *Mod_PointInLeaf(const vec3_t p, mnode_t *node);
extern struct image_s *R_TextureAnimation(const entity_t *currententity, const mtexinfo_t *tex);
extern struct image_s *R_TextureAnimation(const entity_t *currententity,
const mtexinfo_t *tex);
extern qboolean R_AreaVisible(const byte *areabits, mleaf_t *pleaf);
#endif /* SRC_CLIENT_REFRESH_REF_SHARED_H_ */

View file

@ -138,25 +138,6 @@ R_RotateBmodel(const entity_t *currententity)
R_TransformFrustum ();
}
static qboolean
R_AreaVisible(mleaf_t *pleaf)
{
int area;
// check for door connected areas
if (!r_newrefdef.areabits)
return true;
area = pleaf->area;
if ((r_newrefdef.areabits[area>>3] & (1<<(area&7))))
return true;
return false; // not visible
}
/*
================
R_RecursiveClipBPoly
@ -320,7 +301,7 @@ R_RecursiveClipBPoly(entity_t *currententity, bedge_t *pedges, mnode_t *pnode, m
{
int r_currentbkey;
if (!R_AreaVisible((mleaf_t *)pn))
if (!R_AreaVisible(r_newrefdef.areabits, (mleaf_t *)pn))
continue;
r_currentbkey = ((mleaf_t *)pn)->key;
@ -538,7 +519,7 @@ R_RecursiveWorldNode (entity_t *currententity, const model_t *currentmodel, mnod
msurface_t **mark;
pleaf = (mleaf_t *)node;
if (!R_AreaVisible(pleaf))
if (!R_AreaVisible(r_newrefdef.areabits, pleaf))
return; // not visible
mark = pleaf->firstmarksurface;