Share R_AreaVisible

d326b1be51
This commit is contained in:
Denis Pauk 2023-01-22 00:10:34 +02:00
parent 518ada7ea6
commit f9ae8da233
3 changed files with 22 additions and 6 deletions

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

@ -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

@ -811,11 +811,8 @@ static void R_RecursiveWorldNode (mnode_t *node, entity_t *currententity)
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;