fix double sided skies per addline clipping code
fixes greencave skybox hopefully this is it and doesent break anything else sigh
This commit is contained in:
1 parent
a3b11a9854
commit
3f27dd042a
2 files changed
+18
-16
No files matched your search
+14
-9
@@ -298,6 +298,7 @@ static void R_AddLine(seg_t *line)
|
||||
INT32 x1, x2;
|
||||
angle_t angle1, angle2, span, tspan;
|
||||
static sector_t tempsec;
|
||||
boolean bothfloorssky = false;
|
||||
|
||||
g_portal = NULL;
|
||||
|
||||
@@ -390,6 +391,10 @@ static void R_AddLine(seg_t *line)
|
||||
|
||||
doorclosed = 0;
|
||||
|
||||
// likewise, but for floors and upper textures
|
||||
if (backsector->floorpic == skyflatnum && frontsector->floorpic == skyflatnum)
|
||||
bothfloorssky = true;
|
||||
|
||||
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
|
||||
fixed_t backf1, backf2, backc1, backc2; // back floor ceiling ends
|
||||
|
||||
@@ -417,19 +422,19 @@ static void R_AddLine(seg_t *line)
|
||||
if (viewsector != backsector && viewsector != frontsector)
|
||||
{
|
||||
// here we're talking about a CEILING lower than a floor. ...yeah we don't even need to bother.
|
||||
if (backc1 <= frontf1 && backc2 <= frontf2)
|
||||
const boolean ceillow = (backc1 <= frontf1 && backc2 <= frontf2);
|
||||
|
||||
// this tries to fix some skyboxes drawing a black void as a midtexture lel
|
||||
if (ceillow && (!bothfloorssky && backsector->ceilingpic == skyflatnum && frontsector->ceilingpic != skyflatnum) // double sided with back ceiling sky but not front ceiling sky
|
||||
&& !line->sidedef->midtexture && !line->sidedef->bottomtexture && !line->sidedef->toptexture && !line->polyseg) // effectively empty
|
||||
{
|
||||
goto clipsolid;
|
||||
}
|
||||
|
||||
// here we're talking about floors higher than ceilings, don't even bother either.
|
||||
if (backf1 >= frontc1 && backf2 >= frontc2)
|
||||
{
|
||||
goto clipsolid;
|
||||
goto clippass;
|
||||
}
|
||||
|
||||
doorclosed = ceillow
|
||||
|| (backf1 >= frontc1 && backf2 >= frontc2)
|
||||
// Check for automap fix. Store in doorclosed for r_segs.c
|
||||
doorclosed = (backc1 <= backf1 && backc2 <= backf2
|
||||
|| (backc1 <= backf1 && backc2 <= backf2
|
||||
&& ((backc1 >= frontc1 && backc2 >= frontc2) || curline->sidedef->toptexture)
|
||||
&& ((backf1 <= frontf1 && backf2 >= frontf2) || curline->sidedef->bottomtexture)
|
||||
&& (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum));
|
||||
|
||||
+4
-7
@@ -2433,7 +2433,6 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
if (!segtextured && !curline->polyseg)
|
||||
{
|
||||
const bool tophigh = (worldhigh <= worldtop && worldhighslope <= worldtopslope);
|
||||
const bool topnothigh = (backsector && (worldhigh != worldtop || worldhighslope != worldtopslope));
|
||||
|
||||
// if we cant see the goddamn skyplane, well there wont be any skybox
|
||||
// we could kill skyVisible instead, but i want to keep the performance improvemnts it yields
|
||||
@@ -2441,14 +2440,12 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
if ((tophigh
|
||||
&& (frontsector->floorpic != skyflatnum && frontsector->ceilingpic != skyflatnum)) // try to guess if its a "window"
|
||||
&& ((!backsector) // single sided
|
||||
|| (topnothigh && (backsector->floorheight > frontsector->ceilingheight || backsector->ceilingheight < frontsector->floorheight)))) // check if there is a "thok" sector behind it
|
||||
|| ((backsector && (worldhigh != worldtop || worldhighslope != worldtopslope))
|
||||
&& (backsector->floorheight >= frontsector->ceilingheight || backsector->ceilingheight <= frontsector->floorheight)))) // check if there is a "thok" sector behind it
|
||||
skyVisible = true;
|
||||
|
||||
// this is an attempt to fix issues with textureless midtextures drawing nothing where they should just draw sky instead
|
||||
if ((tophigh
|
||||
&& newview->sky) // only do this for skyrender
|
||||
&& ((!backsector && frontsector->ceilingpic == skyflatnum) // single sided line with sky ceiling
|
||||
|| (topnothigh && (backsector->ceilingpic == skyflatnum && frontsector->ceilingpic != skyflatnum)))) // double sided with back ceiling sky but not front ceiling sky
|
||||
// this is an attempt to fix issues with textureless single sided lines drawing nothing where they should just draw sky instead
|
||||
if (tophigh && !backsector && frontsector->ceilingpic == skyflatnum)
|
||||
{
|
||||
topstep = -FixedMul (rw_scalestep, worldbottom);
|
||||
topfrac = (centeryfrac>>4) - FixedMul (worldbottom, rw_scale);
|
||||
|
||||
Reference in new issue
Block a user