Simplify some code in R_StoreWallRange

This commit is contained in:
Lactozilla 2023-06-25 23:22:03 -03:00
parent 1127726130
commit 515b082454
2 changed files with 16 additions and 39 deletions

View file

@ -830,7 +830,7 @@ void R_Subsector(size_t num)
sub = &subsectors[num];
// Render the polyobjs in the subsector first
// Render the minibsp instead
if (sub->polynodes)
{
R_AddPolyobjs(sub);
@ -995,23 +995,19 @@ void R_Subsector(size_t num)
}
// Polyobjects have planes, too!
if (minibsp && sub->polynodes)
{
polynode_t *pn = sub->polynodes;
polynodes = pn;
polynodes = sub->polynodes;
for (; pn != NULL; pn = pn->pnext)
if (minibsp && polynodes)
{
polynode_t *pn = polynodes;
for (; pn != NULL && numffloors < MAXFFLOORS; pn = pn->pnext)
{
polyobj_t *po = pn->poly;
sector_t *polysec;
if (numffloors >= MAXFFLOORS)
break;
if (!(po->flags & POF_RENDERPLANES)) // Don't draw planes
continue;
polysec = po->lines[0]->backsector;
sector_t *polysec = po->lines[0]->backsector;
ffloor[numffloors].plane = NULL;
if (polysec->floorheight <= ceilingcenterz

View file

@ -2593,27 +2593,14 @@ void R_StoreWallRange(INT32 start, INT32 stop)
}
}
numbackffloors = i;
}
if (polynodes && numbackffloors < MAXFFLOORS)
polyobj_t *po = curline->polyseg;
if (po && po->flags & POF_RENDERPLANES)
{
polynode_t *pn = polynodes;
sector_t *polysec = po->lines[0]->backsector;
for (; pn != NULL; pn = pn->pnext)
{
polyobj_t *po = pn->poly;
sector_t *polysec;
if (!(po->flags & POF_RENDERPLANES)) // Don't draw planes
continue;
i = 0;
while (i < numffloors && ffloor[i].polyobj != po) i++;
polysec = po->lines[0]->backsector;
if (polysec->floorheight <= frontsector->ceilingheight &&
if (i < MAXFFLOORS && polysec->floorheight <= frontsector->ceilingheight &&
polysec->floorheight >= frontsector->floorheight &&
(viewz < polysec->floorheight))
{
@ -2624,10 +2611,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
i++;
}
if (i >= MAXFFLOORS)
break;
if (polysec->ceilingheight >= frontsector->floorheight &&
if (i < MAXFFLOORS && polysec->ceilingheight >= frontsector->floorheight &&
polysec->ceilingheight <= frontsector->ceilingheight &&
(viewz > polysec->ceilingheight))
{
@ -2637,14 +2621,11 @@ void R_StoreWallRange(INT32 start, INT32 stop)
ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale);
i++;
}
if (i >= MAXFFLOORS)
break;
}
}
numbackffloors = i;
}
}
for (i = 0; i < numffloors; i++)
{