if (c & bit)
{
leafnum = (k << 3)+i+1;
- if (leafnum >= numleafs)
+ if (leafnum > numleafs)
return;
c -= bit;
- leaf = &model->leafs[leafnum];
+ leaf = &model->leafs[i];
if (R_NotCulledBox(leaf->mins, leaf->maxs))
{
//for (portal = leaf->portals;portal;portal = portal->next)
}
else
{
- int i, k, l, m, c;
+ int i, k, m, c, leafnum;
msurface_t *surf, **mark;
mleaf_t *leaf;
byte *in = pvsleaf->compressed_vis;
c = *in++;
if (c)
{
- l = model->numleafs - (k << 3);
- if (l > 8)
- l = 8;
- for (i=0 ; i<l ; i++)
+ for (i = 0;i < 8;i++)
{
if (c & (1<<i))
{
- leaf = &model->leafs[(k << 3)+i+1];
+ leafnum = (k << 3)+i+1;
+ if (leafnum > model->numleafs)
+ return;
+ leaf = &model->leafs[leafnum];
// if (leaf->visframe != r_framecount)
// continue;
// if (leaf->contents == CONTENTS_SOLID)