Make r_bsp and r_line stop sharing floorplane and ceiling plane variables

This commit is contained in:
Magnus Norddahl 2017-01-04 05:10:16 +01:00
parent 38280b9315
commit c396e7f949
4 changed files with 18 additions and 19 deletions

View file

@ -51,7 +51,7 @@ EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
namespace swrenderer
{
void SWRenderLine::Render(seg_t *line, subsector_t *subsector, sector_t *sector, sector_t *fakebacksector)
void SWRenderLine::Render(seg_t *line, subsector_t *subsector, sector_t *sector, sector_t *fakebacksector, visplane_t *linefloorplane, visplane_t *lineceilingplane)
{
static sector_t tempsec; // killough 3/8/98: ceiling/water hack
bool solid;
@ -60,6 +60,8 @@ namespace swrenderer
InSubsector = subsector;
frontsector = sector;
backsector = fakebacksector;
floorplane = linefloorplane;
ceilingplane = lineceilingplane;
curline = line;

View file

@ -15,6 +15,8 @@
namespace swrenderer
{
struct visplane_t;
struct FWallCoords
{
FVector2 tleft; // coords at left of wall in view space rx1,ry1
@ -38,7 +40,7 @@ namespace swrenderer
class SWRenderLine
{
public:
void Render(seg_t *line, subsector_t *subsector, sector_t *sector, sector_t *fakebacksector);
void Render(seg_t *line, subsector_t *subsector, sector_t *sector, sector_t *fakebacksector, visplane_t *floorplane, visplane_t *ceilingplane);
private:
bool RenderWallSegment(int x1, int x2);
@ -51,6 +53,8 @@ namespace swrenderer
subsector_t *InSubsector;
sector_t *frontsector;
sector_t *backsector;
visplane_t *floorplane;
visplane_t *ceilingplane;
seg_t *curline;
side_t *sidedef;

View file

@ -63,17 +63,13 @@ namespace swrenderer
{
subsector_t *InSubsector;
sector_t *frontsector;
uint8_t FakeSide;
SWRenderLine render_line;
}
bool r_fakingunderwater;
static BYTE FakeSide;
visplane_t *floorplane;
visplane_t *ceilingplane;
// Clip values are the solid pixel bounding the range.
// floorclip starts out SCREENHEIGHT and is just outside the range
// ceilingclip starts out 0 and is just inside the range
@ -415,7 +411,7 @@ static void R_AddPolyobjs(subsector_t *sub)
}
// kg3D - add fake segs, never rendered
void R_FakeDrawLoop(subsector_t *sub)
void R_FakeDrawLoop(subsector_t *sub, visplane_t *floorplane, visplane_t *ceilingplane)
{
int count;
seg_t* line;
@ -427,7 +423,7 @@ void R_FakeDrawLoop(subsector_t *sub)
{
if ((line->sidedef) && !(line->sidedef->Flags & WALLF_POLYOBJ))
{
render_line.Render(line, InSubsector, frontsector, nullptr);
render_line.Render(line, InSubsector, frontsector, nullptr, floorplane, ceilingplane);
}
line++;
}
@ -517,7 +513,7 @@ void R_Subsector (subsector_t *sub)
portal = frontsector->ValidatePortal(sector_t::ceiling);
ceilingplane = frontsector->ceilingplane.PointOnSide(ViewPos) > 0 ||
visplane_t *ceilingplane = frontsector->ceilingplane.PointOnSide(ViewPos) > 0 ||
frontsector->GetTexture(sector_t::ceiling) == skyflatnum ||
portal != NULL ||
(frontsector->heightsec &&
@ -557,7 +553,7 @@ void R_Subsector (subsector_t *sub)
// killough 10/98: add support for skies transferred from sidedefs
portal = frontsector->ValidatePortal(sector_t::floor);
floorplane = frontsector->floorplane.PointOnSide(ViewPos) > 0 || // killough 3/7/98
visplane_t *floorplane = frontsector->floorplane.PointOnSide(ViewPos) > 0 || // killough 3/7/98
frontsector->GetTexture(sector_t::floor) == skyflatnum ||
portal != NULL ||
(frontsector->heightsec &&
@ -636,7 +632,7 @@ void R_Subsector (subsector_t *sub)
if (floorplane)
R_AddPlaneLights(floorplane, frontsector->lighthead);
R_FakeDrawLoop(sub);
R_FakeDrawLoop(sub, floorplane, ceilingplane);
fake3D = 0;
frontsector = sub->sector;
}
@ -700,7 +696,7 @@ void R_Subsector (subsector_t *sub)
if (ceilingplane)
R_AddPlaneLights(ceilingplane, frontsector->lighthead);
R_FakeDrawLoop(sub);
R_FakeDrawLoop(sub, floorplane, ceilingplane);
fake3D = 0;
frontsector = sub->sector;
}
@ -719,8 +715,7 @@ void R_Subsector (subsector_t *sub)
// lightlevels on floor & ceiling lightlevels in the surrounding area.
// [RH] Handle sprite lighting like Duke 3D: If the ceiling is a sky, sprites are lit by
// it, otherwise they are lit by the floor.
R_AddSprites (sub->sector, frontsector->GetTexture(sector_t::ceiling) == skyflatnum ?
ceilinglightlevel : floorlightlevel, FakeSide);
R_AddSprites (sub->sector, frontsector->GetTexture(sector_t::ceiling) == skyflatnum ? ceilinglightlevel : floorlightlevel, FakeSide);
// [RH] Add particles
if ((unsigned int)(sub - subsectors) < (unsigned int)numsubsectors)
@ -761,14 +756,14 @@ void R_Subsector (subsector_t *sub)
fakeFloor->validcount = validcount;
R_3D_NewClip();
}
render_line.Render(line, InSubsector, frontsector, &tempsec); // fake
render_line.Render(line, InSubsector, frontsector, &tempsec, floorplane, ceilingplane); // fake
}
fakeFloor = NULL;
fake3D = 0;
floorplane = backupfp;
ceilingplane = backupcp;
}
render_line.Render(line, InSubsector, frontsector, nullptr); // now real
render_line.Render(line, InSubsector, frontsector, nullptr, floorplane, ceilingplane); // now real
}
line++;
}

View file

@ -52,8 +52,6 @@ void R_RenderBSPNode (void *node);
// killough 4/13/98: fake floors/ceilings for deep water / fake ceilings:
sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, int *floorlightlevel, int *ceilinglightlevel, seg_t *backline, int backx1, int backx2, double frontcz1, double frontcz2);
extern visplane_t *floorplane;
extern visplane_t *ceilingplane;
extern short floorclip[MAXWIDTH];
extern short ceilingclip[MAXWIDTH];