Insert polyobject planes into their proper spot in the draw list; replace related hack with other hacks

This commit is contained in:
RedEnchilada 2015-04-06 11:22:27 -05:00
parent 83461f49c5
commit 1078be3c30
3 changed files with 21 additions and 4 deletions

View File

@ -100,6 +100,8 @@ typedef struct polyobj_s
UINT8 isBad; // a bad polyobject: should not be rendered/manipulated
INT32 translucency; // index to translucency tables
struct visplane_s *visplane; // polyobject's visplane, for ease of putting into the list later
// these are saved for netgames, so do not let Lua touch these!
INT32 spawnflags; // Flags the polyobject originally spawned with
} polyobj_t;

View File

@ -978,11 +978,12 @@ static void R_Subsector(size_t num)
polysec->floorpic_angle-po->angle,
NULL,
NULL);
ffloor[numffloors].plane->polyobj = po;
//ffloor[numffloors].plane->polyobj = po;
ffloor[numffloors].height = polysec->floorheight;
ffloor[numffloors].polyobj = po;
// ffloor[numffloors].ffloor = rover;
po->visplane = ffloor[numffloors].plane;
numffloors++;
}
@ -1014,11 +1015,12 @@ static void R_Subsector(size_t num)
ffloor[numffloors].plane = R_FindPlane(polysec->ceilingheight, polysec->ceilingpic,
polysec->lightlevel, xoff, yoff, polysec->ceilingpic_angle-po->angle,
NULL, NULL);
ffloor[numffloors].plane->polyobj = po;
//ffloor[numffloors].plane->polyobj = po;
ffloor[numffloors].polyobj = po;
ffloor[numffloors].height = polysec->ceilingheight;
// ffloor[numffloors].ffloor = rover;
po->visplane = ffloor[numffloors].plane;
numffloors++;
}

View File

@ -1682,6 +1682,19 @@ static void R_CreateDrawNodes(void)
}
if (ds->maskedtexturecol)
{
#ifdef POLYOBJECTS_PLANES
// Check for a polyobject plane, but only if this is a front line
if (ds->curline->polyseg && ds->curline->polyseg->visplane && !ds->curline->side) {
// Put it in!
entry = R_CreateDrawNode(&nodehead);
entry->plane = ds->curline->polyseg->visplane;
entry->seg = ds;
ds->curline->polyseg->visplane->polyobj = ds->curline->polyseg;
ds->curline->polyseg->visplane = NULL;
}
#endif
entry = R_CreateDrawNode(&nodehead);
entry->seg = ds;
}
@ -1698,7 +1711,7 @@ static void R_CreateDrawNodes(void)
plane = ds->ffloorplanes[p];
R_PlaneBounds(plane);
if (plane->low < con_clipviewtop || plane->high > vid.height || plane->high > plane->low)
if (plane->low < con_clipviewtop || plane->high > vid.height || plane->high > plane->low || plane->polyobj)
{
ds->ffloorplanes[p] = NULL;
continue;
@ -1809,7 +1822,7 @@ static void R_CreateDrawNodes(void)
}
else if (r2->seg)
{
#ifdef POLYOBJECTS_PLANES
#if 0 //#ifdef POLYOBJECTS_PLANES
if (r2->seg->curline->polyseg && rover->mobj && P_MobjInsidePolyobj(r2->seg->curline->polyseg, rover->mobj)) {
// Determine if we need to sort in front of the polyobj, based on the planes. This fixes the issue where
// polyobject planes render above the object standing on them. (A bit hacky... but it works.) -Red