From 05accd5acaff2cdfcd88288ca05e4babf2bacc03 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 28 Feb 2024 17:41:52 +0100 Subject: [PATCH] kill eslope --- src/doomdef.h | 3 - src/hardware/hw_main.c | 431 ++++++---------------------------------- src/hardware/hw_trick.c | 4 - src/p_map.c | 7 - src/r_segs.c | 5 - 5 files changed, 64 insertions(+), 386 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index 8e77e87ae..bb7a63412 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -561,9 +561,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; /// Undefine to use the new method of Gamma correction see colour cube in v_video.c #define BACKWARDSCOMPATCORRECTION -/// Kalaron/Eternity Engine slope code (SRB2CB ported) -#define ESLOPE - /// Backwards compatibility with SRB2CB's slope linedef types. /// \note A simple shim that prints a warning. #define ESLOPE_TYPESHIM diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 9202216a4..8a1f42934 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -44,10 +44,7 @@ #include "../i_system.h" #include "../m_cheat.h" #include "../m_argv.h" // parm functions for msaa - -#ifdef ESLOPE #include "../p_slopes.h" -#endif #include // qsort @@ -655,9 +652,7 @@ void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, boolean isc angle_t angle = 0; FSurfaceInfo Surf; fixed_t tempxsow, tempytow; -#ifdef ESLOPE pslope_t *slope = NULL; -#endif static FOutVector *planeVerts = NULL; static UINT16 numAllocedPlaneVerts = 0; @@ -668,7 +663,7 @@ void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, boolean isc if (!xsub->planepoly) return; -#ifdef ESLOPE + // Get the slope pointer to simplify future code if (FOFsector) { @@ -688,7 +683,6 @@ void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, boolean isc // Set fixedheight to the slope's height from our viewpoint, if we have a slope if (slope) fixedheight = P_GetZAt(slope, viewx, viewy); -#endif height = FIXED_TO_FLOAT(fixedheight); @@ -822,10 +816,8 @@ void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, boolean isc for (i = 0, v3d = planeVerts; i < nrPlaneVerts; i++,v3d++,pv++) SETUP3DVERT(v3d, pv->x, pv->y); -#ifdef ESLOPE if (slope) lightlevel = HWR_CalcSlopeLight(lightlevel, R_PointToAngle2(0, 0, slope->normal.x, slope->normal.y), abs(slope->zdelta)); -#endif HWR_Lighting(&Surf, lightlevel, planecolormap); @@ -1073,7 +1065,6 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, float pegt, pegb, pegmul; float height = 0.0f, bheight = 0.0f; -#ifdef ESLOPE float endrealtop, endrealbot, endtop, endbot; float endpegt, endpegb, endpegmul; float endheight = 0.0f, endbheight = 0.0f; @@ -1084,7 +1075,6 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, fixed_t v1y = FloatToFixed(wallVerts[0].z); fixed_t v2x = FloatToFixed(wallVerts[1].x); fixed_t v2y = FloatToFixed(wallVerts[1].z); -#endif const UINT8 alpha = Surf->PolyColor.s.alpha; FUINT lightnum = HWR_CalcWallLight(sector->lightlevel, v1x, v1y, v2x, v2y); @@ -1106,20 +1096,15 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, else pegmul = (pegb - pegt) / diff; -#ifdef ESLOPE endrealtop = endtop = wallVerts[2].y; endrealbot = endbot = wallVerts[1].y; endpegt = wallVerts[2].t; endpegb = wallVerts[1].t; endpegmul = (endpegb - endpegt) / (endtop - endbot); -#endif for (INT32 i = 0; i < sector->numlights; i++) { -#ifdef ESLOPE - if (endtop < endrealbot) -#endif - if (top < realbot) + if (endtop < endrealbot && top < realbot) return; lightlist_t *list = sector->lightlist; @@ -1169,7 +1154,6 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, else solid = false; -#ifdef ESLOPE if (list[i].slope) { height = FixedToFloat(P_GetZAt(list[i].slope, v1x, v1y)); @@ -1188,26 +1172,16 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, else bheight = endbheight = FIXED_TO_FLOAT(*list[i].caster->bottomheight); } -#else - height = FIXED_TO_FLOAT(list[i].height); - if (solid) - bheight = FIXED_TO_FLOAT(*list[i].caster->bottomheight); -#endif -#ifdef ESLOPE - if (endheight >= endtop) -#endif - if (height >= top) + if (endheight >= endtop && height >= top) { if (solid && top > bheight) top = bheight; -#ifdef ESLOPE + if (solid && endtop > endbheight) endtop = endbheight; -#endif } -#ifdef ESLOPE if (i + 1 < sector->numlights) { if (list[i+1].slope) @@ -1223,60 +1197,42 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, bheight = realbot; endbheight = endrealbot; } -#else - if (i + 1 < sector->numlights) + + if (cv_splitwallfix.value) { - bheight = FIXED_TO_FLOAT(list[i+1].height); + if (endbheight > endtop) + endbot = endtop; + + if (bheight >= top) + continue; + + //Found a break; + bot = bheight; + + if (bot < realbot) + bot = realbot; + + endbot = min(max(endbheight, endrealbot), endtop); } else { - bheight = realbot; + if (endbheight >= endtop && bheight >= top) + continue; + + //Found a break; + bot = bheight; + + if (bot < realbot) + bot = realbot; + + endbot = endbheight; + + if (endbot < endrealbot) + endbot = endrealbot; } -#endif - - if (cv_splitwallfix.value) - { -#ifdef ESLOPE - if (endbheight > endtop) - endbot = endtop; -#endif - if (bheight >= top) - continue; - - //Found a break; - bot = bheight; - - if (bot < realbot) - bot = realbot; - -#ifdef ESLOPE - endbot = min(max(endbheight, endrealbot), endtop); -#endif - }else{ -#ifdef ESLOPE - if (endbheight >= endtop) -#endif - if (bheight >= top) - continue; - - //Found a break; - bot = bheight; - - if (bot < realbot) - bot = realbot; - -#ifdef ESLOPE - endbot = endbheight; - - if (endbot < endrealbot) - endbot = endrealbot; -#endif - } - Surf->PolyColor.s.alpha = alpha; -#ifdef ESLOPE wallVerts[3].t = pegt + ((realtop - top) * pegmul); wallVerts[2].t = endpegt + ((endrealtop - endtop) * endpegmul); wallVerts[0].t = pegt + ((realtop - bot) * pegmul); @@ -1287,14 +1243,7 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, wallVerts[2].y = endtop; wallVerts[0].y = bot; wallVerts[1].y = endbot; -#else - wallVerts[3].t = wallVerts[2].t = pegt + ((realtop - top) * pegmul); - wallVerts[0].t = wallVerts[1].t = pegt + ((realtop - bot) * pegmul); - // set top/bottom coords - wallVerts[2].y = wallVerts[3].y = top; - wallVerts[0].y = wallVerts[1].y = bot; -#endif if (cv_fofzfightfix.value) { if (cutflag & FF_FOG) @@ -1303,7 +1252,9 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, HWR_AddTransparentWall(wallVerts, Surf, texnum, noencore, PF_Translucent|polyflags, false, lightnum, colormap); else HWR_ProjectWall(wallVerts, Surf, PF_Masked|polyflags, lightnum, colormap); - }else{ + } + else + { if (cutflag & FF_FOG) HWR_AddTransparentWall(wallVerts, Surf, texnum, noencore, PF_Fog|PF_NoTexture, true, lightnum, colormap); else if (cutflag & FF_TRANSLUCENT) @@ -1314,22 +1265,16 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, top = bot; -#ifdef ESLOPE endtop = endbot; -#endif } bot = realbot; -#ifdef ESLOPE endbot = endrealbot; - if (endtop <= endrealbot) -#endif - if (top <= realbot) + if (endtop <= endrealbot && top <= realbot) return; Surf->PolyColor.s.alpha = alpha; -#ifdef ESLOPE wallVerts[3].t = pegt + ((realtop - top) * pegmul); wallVerts[2].t = endpegt + ((endrealtop - endtop) * endpegmul); wallVerts[0].t = pegt + ((realtop - bot) * pegmul); @@ -1340,14 +1285,6 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, wallVerts[2].y = endtop; wallVerts[0].y = bot; wallVerts[1].y = endbot; -#else - wallVerts[3].t = wallVerts[2].t = pegt + ((realtop - top) * pegmul); - wallVerts[0].t = wallVerts[1].t = pegt + ((realtop - bot) * pegmul); - - // set top/bottom coords - wallVerts[2].y = wallVerts[3].y = top; - wallVerts[0].y = wallVerts[1].y = bot; -#endif if (cv_fofzfightfix.value) { @@ -1357,7 +1294,9 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, HWR_AddTransparentWall(wallVerts, Surf, texnum, noencore, PF_Translucent|polyflags, false, lightnum, colormap); else HWR_ProjectWall(wallVerts, Surf, PF_Masked|polyflags, lightnum, colormap); - }else{ + } + else + { if (cutflag & FF_FOG) HWR_AddTransparentWall(wallVerts, Surf, texnum, noencore, PF_Fog|PF_NoTexture, true, lightnum, colormap); else if (cutflag & FF_TRANSLUCENT) @@ -1457,19 +1396,15 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom fixed_t worldtop, worldbottom; fixed_t worldhigh = 0, worldlow = 0; -#ifdef ESLOPE fixed_t worldtopslope, worldbottomslope; fixed_t worldhighslope = 0, worldlowslope = 0; fixed_t v1x, v1y, v2x, v2y; -#endif GLMapTexture_t *grTex = NULL; float cliplow = 0.0f, cliphigh = 0.0f; INT32 gr_midtexture; fixed_t h, l; // 3D sides and 2s middle textures -#ifdef ESLOPE fixed_t hS, lS; -#endif FUINT lightnum = 0; // shut up compiler extracolormap_t *colormap; @@ -1501,13 +1436,10 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom ve.y = FIXED_TO_FLOAT(gr_curline->v2->y); } -#ifdef ESLOPE v1x = FLOAT_TO_FIXED(vs.x); v1y = FLOAT_TO_FIXED(vs.y); v2x = FLOAT_TO_FIXED(ve.x); v2y = FLOAT_TO_FIXED(ve.y); -#endif -#ifdef ESLOPE #define SLOPEPARAMS(slope, end1, end2, normalheight) \ if (slope) { \ @@ -1518,10 +1450,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom SLOPEPARAMS(gr_frontsector->c_slope, worldtop, worldtopslope, gr_frontsector->ceilingheight) SLOPEPARAMS(gr_frontsector->f_slope, worldbottom, worldbottomslope, gr_frontsector->floorheight) -#else - worldtop = gr_frontsector->ceilingheight; - worldbottom = gr_frontsector->floorheight; -#endif // remember vertices ordering // 3--2 @@ -1563,13 +1491,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom INT32 gr_toptexture, gr_bottomtexture; // two sided line -#ifdef ESLOPE SLOPEPARAMS(gr_backsector->c_slope, worldhigh, worldhighslope, gr_backsector->ceilingheight) SLOPEPARAMS(gr_backsector->f_slope, worldlow, worldlowslope, gr_backsector->floorheight) -#else - worldhigh = gr_backsector->ceilingheight; - worldlow = gr_backsector->floorheight; -#endif // Sky culling if (!gr_curline->polyseg) // Don't do it for polyobjects @@ -1587,36 +1510,24 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom && (worldhigh != worldtop || worldhighslope != worldtopslope)) // Removing the second line above will render more rarely visible skywalls. Example: Cave garden ceiling in Dark race { -#ifdef ESLOPE wallVerts[0].y = FIXED_TO_FLOAT(worldhigh); wallVerts[1].y = FIXED_TO_FLOAT(worldhighslope); -#else - wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(worldhigh); -#endif HWR_DrawSkyWall(wallVerts, &Surf); } } else { // Only the frontsector is sky, just draw a skywall from the front ceiling -#ifdef ESLOPE wallVerts[0].y = FIXED_TO_FLOAT(worldtop); wallVerts[1].y = FIXED_TO_FLOAT(worldtopslope); -#else - wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(worldtop); -#endif HWR_DrawSkyWall(wallVerts, &Surf); } } else if (gr_backsector->ceilingpic == skyflatnum) { // Only the backsector is sky, just draw a skywall from the front ceiling -#ifdef ESLOPE wallVerts[0].y = FIXED_TO_FLOAT(worldtop); wallVerts[1].y = FIXED_TO_FLOAT(worldtopslope); -#else - wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(worldtop); -#endif HWR_DrawSkyWall(wallVerts, &Surf); } @@ -1636,39 +1547,24 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom // Removing the second line above will render more rarely visible skywalls. Example: Cave garden ceiling in Dark race && !(gr_sidedef->bottomtexture)) { -#ifdef ESLOPE wallVerts[3].y = FIXED_TO_FLOAT(worldlow); wallVerts[2].y = FIXED_TO_FLOAT(worldlowslope); -#else - wallVerts[3].y = wallVerts[2].y = FIXED_TO_FLOAT(worldlow); -#endif - HWR_DrawSkyWall(wallVerts, &Surf); } } else { // Only the backsector has sky, just draw a skywall from the back floor -#ifdef ESLOPE wallVerts[3].y = FIXED_TO_FLOAT(worldbottom); wallVerts[2].y = FIXED_TO_FLOAT(worldbottomslope); -#else - wallVerts[3].y = wallVerts[2].y = FIXED_TO_FLOAT(worldbottom); -#endif - HWR_DrawSkyWall(wallVerts, &Surf); } } else if ((gr_backsector->floorpic == skyflatnum) && !(gr_sidedef->bottomtexture)) { // Only the backsector has sky, just draw a skywall from the back floor if there's no bottomtexture -#ifdef ESLOPE wallVerts[3].y = FIXED_TO_FLOAT(worldlow); wallVerts[2].y = FIXED_TO_FLOAT(worldlowslope); -#else - wallVerts[3].y = wallVerts[2].y = FIXED_TO_FLOAT(worldlow); -#endif - HWR_DrawSkyWall(wallVerts, &Surf); } @@ -1680,21 +1576,14 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom && gr_backsector->ceilingpic == skyflatnum) { worldtop = worldhigh; -#ifdef ESLOPE worldtopslope = worldhighslope; -#endif } gr_toptexture = R_GetTextureNum(gr_sidedef->toptexture); gr_bottomtexture = R_GetTextureNum(gr_sidedef->bottomtexture); // check TOP TEXTURE - if (( -#ifdef ESLOPE - worldhighslope < worldtopslope || -#endif - worldhigh < worldtop - ) && gr_toptexture) + if ((worldhighslope < worldtopslope || worldhigh < worldtop) && gr_toptexture) { { fixed_t texturevpegtop; // top @@ -1704,15 +1593,10 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom // PEGGING if (gr_linedef->flags & ML_DONTPEGTOP) texturevpegtop = 0; -#ifdef ESLOPE else if (gr_linedef->flags & ML_EFFECT1) texturevpegtop = worldhigh + textureheight[gr_sidedef->toptexture] - worldtop; else texturevpegtop = gr_backsector->ceilingheight + textureheight[gr_sidedef->toptexture] - gr_frontsector->ceilingheight; -#else - else - texturevpegtop = worldhigh + textureheight[gr_sidedef->toptexture] - worldtop; -#endif texturevpegtop += gr_sidedef->rowoffset; @@ -1724,7 +1608,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX; wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; -#ifdef ESLOPE // Adjust t value for sloped walls if (!(gr_linedef->flags & ML_EFFECT1)) { @@ -1747,19 +1630,13 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom wallVerts[3].t = wallVerts[0].t - (worldtop - worldhigh) * grTex->scaleY; wallVerts[2].t = wallVerts[1].t - (worldtopslope - worldhighslope) * grTex->scaleY; } -#endif } // set top/bottom coords -#ifdef ESLOPE wallVerts[3].y = FIXED_TO_FLOAT(worldtop); wallVerts[0].y = FIXED_TO_FLOAT(worldhigh); wallVerts[2].y = FIXED_TO_FLOAT(worldtopslope); wallVerts[1].y = FIXED_TO_FLOAT(worldhighslope); -#else - wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(worldtop); - wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(worldhigh); -#endif if (!gl_drawing_stencil && gr_frontsector->numlights) HWR_SplitWall(gr_frontsector, wallVerts, gr_toptexture, gr_linedef->flags & ML_TFERLINE, &Surf, FF_CUTLEVEL, NULL, 0); @@ -1770,11 +1647,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom } // check BOTTOM TEXTURE - if (( -#ifdef ESLOPE - worldlowslope > worldbottomslope || -#endif - worldlow > worldbottom) && gr_bottomtexture) //only if VISIBLE!!! + if ((worldlowslope > worldbottomslope || worldlow > worldbottom) && gr_bottomtexture) //only if VISIBLE!!! { { fixed_t texturevpegbottom = 0; // bottom @@ -1782,19 +1655,12 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom grTex = HWR_GetTexture(gr_bottomtexture, gr_linedef->flags & ML_TFERLINE); // PEGGING -#ifdef ESLOPE if (!(gr_linedef->flags & ML_DONTPEGBOTTOM)) texturevpegbottom = 0; else if (gr_linedef->flags & ML_EFFECT1) texturevpegbottom = worldbottom - worldlow; else texturevpegbottom = gr_frontsector->floorheight - gr_backsector->floorheight; -#else - if (gr_linedef->flags & ML_DONTPEGBOTTOM) - texturevpegbottom = worldbottom - worldlow; - else - texturevpegbottom = 0; -#endif texturevpegbottom += gr_sidedef->rowoffset; @@ -1806,7 +1672,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX; wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; -#ifdef ESLOPE // Adjust t value for sloped walls if (!(gr_linedef->flags & ML_EFFECT1)) { @@ -1829,19 +1694,13 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom wallVerts[0].t = (texturevpegbottom + worldlow - worldbottom) * grTex->scaleY; wallVerts[1].t = (texturevpegbottom + worldlowslope - worldbottomslope) * grTex->scaleY; } -#endif } // set top/bottom coords -#ifdef ESLOPE wallVerts[3].y = FIXED_TO_FLOAT(worldlow); wallVerts[0].y = FIXED_TO_FLOAT(worldbottom); wallVerts[2].y = FIXED_TO_FLOAT(worldlowslope); wallVerts[1].y = FIXED_TO_FLOAT(worldbottomslope); -#else - wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(worldlow); - wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(worldbottom); -#endif if (!gl_drawing_stencil && gr_frontsector->numlights) HWR_SplitWall(gr_frontsector, wallVerts, gr_bottomtexture, gr_linedef->flags & ML_TFERLINE, &Surf, FF_CUTLEVEL, NULL, 0); @@ -1912,19 +1771,13 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom else #endif { -#ifdef ESLOPE popentop = min(worldtop, worldhigh); popenbottom = max(worldbottom, worldlow); popentopslope = min(worldtopslope, worldhighslope); popenbottomslope = max(worldbottomslope, worldlowslope); -#else - popentop = min(front->ceilingheight, back->ceilingheight); - popenbottom = max(front->floorheight, back->floorheight); -#endif } -#ifdef ESLOPE if (gr_linedef->flags & ML_EFFECT2) { if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) @@ -1943,9 +1796,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom } } else if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) -#else - if (gr_linedef->flags & ML_DONTPEGBOTTOM) -#endif { polybottom = popenbottom + gr_sidedef->rowoffset; polytop = polybottom + midtexheight; @@ -2023,11 +1873,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom else { // PEGGING -#ifdef ESLOPE if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) -#else - if (gr_linedef->flags & ML_DONTPEGBOTTOM) -#endif texturevpeg = textureheight[gr_sidedef->midtexture]*repeats - h + polybottom; else texturevpeg = polytop - h; @@ -2043,7 +1889,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(h); wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(l); -#ifdef ESLOPE // Correct to account for slopes { fixed_t midtextureslant; @@ -2086,7 +1931,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom wallVerts[2].y = FIXED_TO_FLOAT(h); wallVerts[1].y = FIXED_TO_FLOAT(l); } -#endif } // set alpha for transparent walls (new boom and legacy linedef types) @@ -2197,12 +2041,9 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { fixed_t texturevpeg; // PEGGING -#ifdef ESLOPE if ((gr_linedef->flags & (ML_DONTPEGBOTTOM|ML_EFFECT2)) == (ML_DONTPEGBOTTOM|ML_EFFECT2)) texturevpeg = gr_frontsector->floorheight + textureheight[gr_sidedef->midtexture] - gr_frontsector->ceilingheight + gr_sidedef->rowoffset; - else -#endif - if (gr_linedef->flags & ML_DONTPEGBOTTOM) + else if (gr_linedef->flags & ML_DONTPEGBOTTOM) texturevpeg = worldbottom + textureheight[gr_sidedef->midtexture] - worldtop + gr_sidedef->rowoffset; else // top of texture at top @@ -2215,7 +2056,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX; wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; -#ifdef ESLOPE // Texture correction for slopes if (gr_linedef->flags & ML_EFFECT2) { wallVerts[3].t += (gr_frontsector->ceilingheight - worldtop) * grTex->scaleY; @@ -2229,19 +2069,12 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom wallVerts[0].t = wallVerts[3].t - (worldbottom-worldtop) * grTex->scaleY; wallVerts[1].t = wallVerts[2].t - (worldbottomslope-worldtopslope) * grTex->scaleY; } -#endif } -#ifdef ESLOPE //Set textures properly on single sided walls that are sloped wallVerts[3].y = FIXED_TO_FLOAT(worldtop); wallVerts[0].y = FIXED_TO_FLOAT(worldbottom); wallVerts[2].y = FIXED_TO_FLOAT(worldtopslope); wallVerts[1].y = FIXED_TO_FLOAT(worldbottomslope); -#else - // set top/bottom coords - wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(worldtop); - wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(worldbottom); -#endif if (gr_frontsector->numlights) HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, gr_linedef->flags & ML_TFERLINE, &Surf, FF_CUTLEVEL, NULL, 0); @@ -2256,17 +2089,11 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom } else { -#ifdef ESLOPE //Set textures properly on single sided walls that are sloped wallVerts[3].y = FIXED_TO_FLOAT(worldtop); wallVerts[0].y = FIXED_TO_FLOAT(worldbottom); wallVerts[2].y = FIXED_TO_FLOAT(worldtopslope); wallVerts[1].y = FIXED_TO_FLOAT(worldbottomslope); -#else - // set top/bottom coords - wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(worldtop); - wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(worldbottom); -#endif // When there's no midtexture, draw a skywall to prevent rendering behind it HWR_DrawSkyWall(wallVerts, &Surf); @@ -2280,22 +2107,14 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if (gr_frontsector->ceilingpic == skyflatnum) // It's a single-sided line with sky for its sector { wallVerts[3].y = wallVerts[2].y = FIXED_TO_FLOAT(INT32_MAX); -#ifdef ESLOPE wallVerts[0].y = FIXED_TO_FLOAT(worldtop); wallVerts[1].y = FIXED_TO_FLOAT(worldtopslope); -#else - wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(worldtop); -#endif HWR_DrawSkyWall(wallVerts, &Surf); } if (gr_frontsector->floorpic == skyflatnum) { -#ifdef ESLOPE wallVerts[3].y = FIXED_TO_FLOAT(worldbottom); wallVerts[2].y = FIXED_TO_FLOAT(worldbottomslope); -#else - wallVerts[3].y = wallVerts[2].y = FIXED_TO_FLOAT(worldbottom); -#endif wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(INT32_MIN); HWR_DrawSkyWall(wallVerts, &Surf); @@ -2364,13 +2183,11 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture); } -#ifdef ESLOPE - h = *rover->t_slope ? P_GetZAt(*rover->t_slope, v1x, v1y) : *rover->topheight; - hS = *rover->t_slope ? P_GetZAt(*rover->t_slope, v2x, v2y) : *rover->topheight; - l = *rover->b_slope ? P_GetZAt(*rover->b_slope, v1x, v1y) : *rover->bottomheight; - lS = *rover->b_slope ? P_GetZAt(*rover->b_slope, v2x, v2y) : *rover->bottomheight; - - + h = P_GetFFloorTopZAt (rover, v1x, v1y); + hS = P_GetFFloorTopZAt (rover, v2x, v2y); + l = P_GetFFloorBottomZAt(rover, v1x, v1y); + lS = P_GetFFloorBottomZAt(rover, v2x, v2y); + if (!cv_grfofcut.value) { if (!(*rover->t_slope) && !gr_frontsector->c_slope && !gr_backsector->c_slope && h > highcut) @@ -2402,19 +2219,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom wallVerts[2].y = FIXED_TO_FLOAT(hS); wallVerts[0].y = FIXED_TO_FLOAT(l); wallVerts[1].y = FIXED_TO_FLOAT(lS); -#else - h = *rover->topheight; - l = *rover->bottomheight; - if (h > highcut) - h = highcut; - if (l < lowcut) - l = lowcut; - //Hurdler: HW code starts here - //FIXME: check if peging is correct - // set top/bottom coords - wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(h); - wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(l); -#endif + if (rover->flags & FF_FOG) { wallVerts[3].t = wallVerts[2].t = 0; @@ -2426,9 +2231,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { fixed_t texturevpeg; boolean attachtobottom = false; -#ifdef ESLOPE boolean slopeskew = false; // skew FOF walls with slopes? -#endif // Wow, how was this missing from OpenGL for so long? // ...Oh well, anyway, Lower Unpegged now changes pegging of FOFs like in software @@ -2437,22 +2240,17 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { texturevpeg = sides[newline->sidenum[0]].rowoffset; attachtobottom = !!(newline->flags & ML_DONTPEGBOTTOM); -#ifdef ESLOPE slopeskew = !!(newline->flags & ML_DONTPEGTOP); -#endif } else { texturevpeg = sides[rover->master->sidenum[0]].rowoffset; attachtobottom = !!(gr_linedef->flags & ML_DONTPEGBOTTOM); -#ifdef ESLOPE slopeskew = !!(rover->master->flags & ML_DONTPEGTOP); -#endif } grTex = HWR_GetTexture(texnum, noencore); -#ifdef ESLOPE if (!slopeskew) // no skewing { if (attachtobottom) @@ -2477,12 +2275,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom wallVerts[2].t = wallVerts[1].t - (hS - lS) * grTex->scaleY; } } -#else - if (attachtobottom) - texturevpeg -= *rover->topheight - *rover->bottomheight; - wallVerts[3].t = wallVerts[2].t = (*rover->topheight - h + texturevpeg) * grTex->scaleY; - wallVerts[0].t = wallVerts[1].t = (*rover->topheight - l + texturevpeg) * grTex->scaleY; -#endif wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX; wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; @@ -2563,12 +2355,12 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom newline = rover->master->frontsector->lines[0] + linenum; texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture); } -#ifdef ESLOPE //backsides - h = *rover->t_slope ? P_GetZAt(*rover->t_slope, v1x, v1y) : *rover->topheight; - hS = *rover->t_slope ? P_GetZAt(*rover->t_slope, v2x, v2y) : *rover->topheight; - l = *rover->b_slope ? P_GetZAt(*rover->b_slope, v1x, v1y) : *rover->bottomheight; - lS = *rover->b_slope ? P_GetZAt(*rover->b_slope, v2x, v2y) : *rover->bottomheight; - + + h = P_GetFFloorTopZAt (rover, v1x, v1y); + hS = P_GetFFloorTopZAt (rover, v2x, v2y); + l = P_GetFFloorBottomZAt(rover, v1x, v1y); + lS = P_GetFFloorBottomZAt(rover, v2x, v2y); + if (!cv_grfofcut.value) { if (!(*rover->t_slope) && !gr_frontsector->c_slope && !gr_backsector->c_slope && h > highcut) @@ -2599,19 +2391,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom wallVerts[2].y = FIXED_TO_FLOAT(hS); wallVerts[0].y = FIXED_TO_FLOAT(l); wallVerts[1].y = FIXED_TO_FLOAT(lS); -#else - h = *rover->topheight; - l = *rover->bottomheight; - if (h > highcut) - h = highcut; - if (l < lowcut) - l = lowcut; - //Hurdler: HW code starts here - //FIXME: check if peging is correct - // set top/bottom coords - wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(h); - wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(l); -#endif + if (rover->flags & FF_FOG) { wallVerts[3].t = wallVerts[2].t = 0; @@ -2704,7 +2484,6 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector) // GZDoom method of sloped line clipping -#ifdef ESLOPE if (afrontsector->f_slope || afrontsector->c_slope || abacksector->f_slope || abacksector->c_slope) { fixed_t v1x, v1y, v2x, v2y; // the seg's vertexes as fixed_t @@ -2744,7 +2523,6 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector) #undef SLOPEPARAMS } else -#endif { frontf1 = frontf2 = afrontsector->floorheight; frontc1 = frontc2 = afrontsector->ceilingheight; @@ -3495,22 +3273,10 @@ void HWR_Subsector(size_t num) } else { - cullFloorHeight = locFloorHeight = gr_frontsector->floorheight; - cullCeilingHeight = locCeilingHeight = gr_frontsector->ceilingheight; - -#ifdef ESLOPE - if (gr_frontsector->f_slope) - { - cullFloorHeight = P_GetZAt(gr_frontsector->f_slope, viewx, viewy); - locFloorHeight = P_GetZAt(gr_frontsector->f_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y); - } - - if (gr_frontsector->c_slope) - { - cullCeilingHeight = P_GetZAt(gr_frontsector->c_slope, viewx, viewy); - locCeilingHeight = P_GetZAt(gr_frontsector->c_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y); - } -#endif + cullFloorHeight = P_GetSectorFloorZAt (gr_frontsector, viewx, viewy); + cullCeilingHeight = P_GetSectorCeilingZAt(gr_frontsector, viewx, viewy); + locFloorHeight = P_GetSectorFloorZAt (gr_frontsector, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y); + locCeilingHeight = P_GetSectorCeilingZAt(gr_frontsector, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y); } // ----- end special tricks ----- @@ -4202,13 +3968,11 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) float realheight, heightmult; const sector_t *sector = spr->mobj->subsector->sector; const lightlist_t *list = sector->lightlist; -#ifdef ESLOPE float endrealtop, endrealbot, endtop, endbot; float endbheight; float endrealheight; fixed_t temp; fixed_t v1x, v1y, v2x, v2y; -#endif INT32 shader = SHADER_NONE; @@ -4293,10 +4057,8 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) towbot = baseWallVerts[0].t; towmult = (towbot - towtop) / (top - bot); -#ifdef ESLOPE endrealtop = endtop = baseWallVerts[2].y; endrealbot = endbot = baseWallVerts[1].y; -#endif // copy the contents of baseWallVerts into the drawn wallVerts array // baseWallVerts is used to know the final shape to easily get the vertex @@ -4338,11 +4100,9 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) if (spr->mobj->frame & FF_FULLBRIGHT) lightlevel = 255; -#ifdef ESLOPE for (i = 1; i < sector->numlights; i++) { - fixed_t h = sector->lightlist[i].slope ? P_GetZAt(sector->lightlist[i].slope, spr->mobj->x, spr->mobj->y) - : sector->lightlist[i].height; + fixed_t h = P_GetLightZAt(§or->lightlist[i], spr->mobj->x, spr->mobj->y); if (h <= temp) { if (!(spr->mobj->frame & FF_FULLBRIGHT)) @@ -4351,19 +4111,10 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) break; } } -#else - i = R_GetPlaneLight(sector, temp, false); - if (!(spr->mobj->frame & FF_FULLBRIGHT)) - lightlevel = *list[i].lightlevel > 255 ? 255 : SOFTLIGHT(*list[i].lightlevel); - colormap = list[i].extra_colormap; -#endif for (i = 0; i < sector->numlights; i++) { -#ifdef ESLOPE - if (endtop < endrealbot) -#endif - if (top < realbot) + if (endtop < endrealbot && top < realbot) return; // even if we aren't changing colormap or lightlevel, we still need to continue drawing down the sprite @@ -4374,7 +4125,6 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) colormap = list[i].extra_colormap; } -#ifdef ESLOPE if (i + 1 < sector->numlights) { if (list[i+1].slope) @@ -4392,21 +4142,8 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) bheight = realbot; endbheight = endrealbot; } -#else - if (i + 1 < sector->numlights) - { - bheight = FIXED_TO_FLOAT(list[i+1].height); - } - else - { - bheight = realbot; - } -#endif -#ifdef ESLOPE - if (endbheight >= endtop) -#endif - if (bheight >= top) + if (endbheight >= endtop && bheight >= top) continue; bot = bheight; @@ -4414,14 +4151,11 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) if (bot < realbot) bot = realbot; -#ifdef ESLOPE endbot = endbheight; if (endbot < endrealbot) endbot = endrealbot; -#endif -#ifdef ESLOPE wallVerts[3].t = towtop + ((realtop - top) * towmult); wallVerts[2].t = towtop + ((endrealtop - endtop) * towmult); wallVerts[0].t = towtop + ((realtop - bot) * towmult); @@ -4454,31 +4188,6 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) wallVerts[1].x = baseWallVerts[2].x + (baseWallVerts[2].x - baseWallVerts[1].x) * heightmult; wallVerts[1].z = baseWallVerts[2].z + (baseWallVerts[2].z - baseWallVerts[1].z) * heightmult; } -#else - wallVerts[3].t = wallVerts[2].t = towtop + ((realtop - top) * towmult); - wallVerts[0].t = wallVerts[1].t = towtop + ((realtop - bot) * towmult); - - wallVerts[2].y = wallVerts[3].y = top; - wallVerts[0].y = wallVerts[1].y = bot; - - // The x and y only need to be adjusted in the case that it's not a papersprite - if (cv_grspritebillboarding.value && spr->mobj && !(spr->mobj->frame & FF_PAPERSPRITE)) - { - // Get the x and z of the vertices so billboarding draws correctly - realheight = realbot - realtop; - heightmult = (realtop - top) / realheight; - wallVerts[3].x = baseWallVerts[3].x + (baseWallVerts[3].x - baseWallVerts[0].x) * heightmult; - wallVerts[3].z = baseWallVerts[3].z + (baseWallVerts[3].z - baseWallVerts[0].z) * heightmult; - wallVerts[2].x = baseWallVerts[2].x + (baseWallVerts[2].x - baseWallVerts[1].x) * heightmult; - wallVerts[2].z = baseWallVerts[2].z + (baseWallVerts[2].z - baseWallVerts[1].z) * heightmult; - - heightmult = (realtop - bot) / realheight; - wallVerts[0].x = baseWallVerts[3].x + (baseWallVerts[3].x - baseWallVerts[0].x) * heightmult; - wallVerts[0].z = baseWallVerts[3].z + (baseWallVerts[3].z - baseWallVerts[0].z) * heightmult; - wallVerts[1].x = baseWallVerts[2].x + (baseWallVerts[2].x - baseWallVerts[1].x) * heightmult; - wallVerts[1].z = baseWallVerts[2].z + (baseWallVerts[2].z - baseWallVerts[1].z) * heightmult; - } -#endif HWR_Lighting(&Surf, lightlevel, colormap); @@ -4493,21 +4202,16 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) HWR_ProcessPolygon(&Surf, wallVerts, 4, blend|PF_Modulated, shader, false); // sprite shader top = bot; -#ifdef ESLOPE endtop = endbot; -#endif } bot = realbot; -#ifdef ESLOPE endbot = endrealbot; - if (endtop <= endrealbot) -#endif - if (top <= realbot) + + if (endtop <= endrealbot && top <= realbot) return; // If we're ever down here, somehow the above loop hasn't draw all the light levels of sprite -#ifdef ESLOPE wallVerts[3].t = towtop + ((realtop - top) * towmult); wallVerts[2].t = towtop + ((endrealtop - endtop) * towmult); wallVerts[0].t = towtop + ((realtop - bot) * towmult); @@ -4517,13 +4221,6 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) wallVerts[2].y = endtop; wallVerts[0].y = bot; wallVerts[1].y = endbot; -#else - wallVerts[3].t = wallVerts[2].t = towtop + ((realtop - top) * towmult); - wallVerts[0].t = wallVerts[1].t = towtop + ((realtop - bot) * towmult); - - wallVerts[2].y = wallVerts[3].y = top; - wallVerts[0].y = wallVerts[1].y = bot; -#endif HWR_Lighting(&Surf, lightlevel, colormap); diff --git a/src/hardware/hw_trick.c b/src/hardware/hw_trick.c index de4a76c59..342a2051c 100644 --- a/src/hardware/hw_trick.c +++ b/src/hardware/hw_trick.c @@ -611,10 +611,8 @@ static boolean isCeilingFloating(sector_t *thisSector) if (!adjSector) // assume floating sectors have surrounding sectors return false; -#ifdef ESLOPE if (adjSector->c_slope) // Don't bother with slopes return false; -#endif if (!refSector) { @@ -664,10 +662,8 @@ static boolean isFloorFloating(sector_t *thisSector) if (!adjSector) // assume floating sectors have surrounding sectors return false; -#ifdef ESLOPE if (adjSector->f_slope) // Don't bother with slopes return false; -#endif if (!refSector) { diff --git a/src/p_map.c b/src/p_map.c index abca82eb0..3942122cc 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3931,13 +3931,6 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush) topheight = *rover->topheight; bottomheight = *rover->bottomheight; -/*#ifdef ESLOPE - if (rover->t_slope) - topheight = P_GetZAt(rover->t_slope, thing->x, thing->y); - if (rover->b_slope) - bottomheight = P_GetZAt(rover->b_slope, thing->x, thing->y); -#endif*/ - delta1 = thing->z - (bottomheight + topheight)/2; delta2 = thingtop - (bottomheight + topheight)/2; if (bottomheight <= thing->ceilingz && abs(delta1) >= abs(delta2)) diff --git a/src/r_segs.c b/src/r_segs.c index 8eb3c9b41..6ee61e8ea 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -2634,13 +2634,8 @@ void R_StoreWallRange(INT32 start, INT32 stop) } else { -#ifdef ESLOPE ffloor[i].f_frac = (centeryfrac>>4) - FixedMul(ffloor[i].f_pos, rw_scale); ffloor[i].f_step = ((centeryfrac>>4) - FixedMul(ffloor[i].f_pos_slope, ds_p->scale2) - ffloor[i].f_frac)/(range); -#else - ffloor[i].f_step = FixedMul(-rw_scalestep, ffloor[i].f_pos); - ffloor[i].f_frac = (centeryfrac>>4) - FixedMul(ffloor[i].f_pos, rw_scale); -#endif } } }