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

@ -709,7 +709,7 @@ static void R_AddPolyobjs(subsector_t *sub)
R_BuildPolyBSP(sub);
minibsp = sub->BSP;
nodecount = minibsp->numnodes-1;
nodecount = minibsp->numnodes - 1;
if (nodecount == 0)
R_Subsector(0);
@ -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)
{
polynode_t *pn = polynodes;
for (; pn != NULL; pn = pn->pnext)
polyobj_t *po = curline->polyseg;
if (po && po->flags & POF_RENDERPLANES)
{
polyobj_t *po = pn->poly;
sector_t *polysec;
sector_t *polysec = po->lines[0]->backsector;
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,13 +2621,10 @@ 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;
}
numbackffloors = i;
}
for (i = 0; i < numffloors; i++)