diff --git a/src/r_segs.cpp b/src/r_segs.cpp index 44def4ba4..66355ca17 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -2432,21 +2432,23 @@ void R_StoreWallRange(INT32 start, INT32 stop) // untextured seg if (!segtextured && !curline->polyseg) { - const bool tophigh = (backsector && worldhigh <= worldtop && worldhighslope <= worldtopslope) - && (worldhigh != worldtop || worldhighslope != worldtopslope); + 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 // so we do this absolute trash - if ((frontsector->floorpic != skyflatnum && frontsector->ceilingpic != skyflatnum) // try to guess if its a "window" + if ((tophigh + && (frontsector->floorpic != skyflatnum && frontsector->ceilingpic != skyflatnum)) // try to guess if its a "window" && ((!backsector) // single sided - || (tophigh && (backsector->floorheight > frontsector->ceilingheight || backsector->ceilingheight < frontsector->floorheight)))) // check if there is a "thok" sector behind it + || (topnothigh && (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 ((newview->sky // only do this for skyrender + if ((tophigh + && newview->sky) // only do this for skyrender && ((!backsector && frontsector->ceilingpic == skyflatnum) // single sided line with sky ceiling - || (tophigh && (backsector->ceilingpic == skyflatnum && frontsector->ceilingpic != skyflatnum))))) // double sided with back ceiling sky but not front ceiling sky + || (topnothigh && (backsector->ceilingpic == skyflatnum && frontsector->ceilingpic != skyflatnum)))) // double sided with back ceiling sky but not front ceiling sky { topstep = -FixedMul (rw_scalestep, worldbottom); topfrac = (centeryfrac>>4) - FixedMul (worldbottom, rw_scale);