From 06b7d7ceb80dc1664224e5334816ce80c75fd6ec Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Wed, 5 Jan 2022 18:05:47 +0100 Subject: [PATCH] Make only ML_EFFECT3 affect midtexture pegging in UDMF --- src/hardware/hw_main.c | 10 +++++----- src/p_maputl.c | 2 +- src/p_setup.c | 8 ++++++++ src/r_segs.c | 12 ++++++------ 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 291cabe9a..dece1deda 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -1330,7 +1330,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if (gl_linedef->flags & ML_EFFECT2) { - if (!!(gl_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gl_linedef->flags & ML_EFFECT3)) + if (gl_linedef->flags & ML_EFFECT3) { polybottom = max(front->floorheight, back->floorheight) + gl_sidedef->rowoffset; polytop = polybottom + textureheight[gl_midtexture]*repeats; @@ -1341,7 +1341,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom polybottom = polytop - textureheight[gl_midtexture]*repeats; } } - else if (!!(gl_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gl_linedef->flags & ML_EFFECT3)) + else if (gl_linedef->flags & ML_EFFECT3) { polybottom = popenbottom + gl_sidedef->rowoffset; polytop = polybottom + textureheight[gl_midtexture]*repeats; @@ -1371,7 +1371,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { // PEGGING - if (!!(gl_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gl_linedef->flags & ML_EFFECT3)) + if (gl_linedef->flags & ML_EFFECT3) texturevpeg = textureheight[gl_sidedef->midtexture]*repeats - h + polybottom; else texturevpeg = polytop - h; @@ -1396,7 +1396,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if (gl_linedef->flags & ML_EFFECT2) midtextureslant = 0; - else if (!!(gl_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gl_linedef->flags & ML_EFFECT3)) + else if (gl_linedef->flags & ML_EFFECT3) midtextureslant = worldlow < worldbottom ? worldbottomslope-worldbottom : worldlowslope-worldlow; @@ -1421,7 +1421,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { // PEGGING - if (!!(gl_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gl_linedef->flags & ML_EFFECT3)) + if (gl_linedef->flags & ML_EFFECT3) texturevpeg = textureheight[gl_sidedef->midtexture]*repeats - h + polybottom; else texturevpeg = polytop - h; diff --git a/src/p_maputl.c b/src/p_maputl.c index ee22578ef..0e10d1411 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -524,7 +524,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (linedef->flags & ML_EFFECT5 && !side->repeatcnt) { // "infinite" repeat texbottom = openbottom + side->rowoffset; textop = opentop + side->rowoffset; - } else if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) { + } else if (linedef->flags & ML_EFFECT3) { texbottom = openbottom + side->rowoffset; textop = texbottom + texheight*(side->repeatcnt+1); } else { diff --git a/src/p_setup.c b/src/p_setup.c index b89b38f5b..f92fd46a9 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -5852,6 +5852,14 @@ static void P_ConvertBinaryMap(void) break; } } + + for (i = 0; i < numlines; i++) + { + if (!!(lines[i].flags & ML_DONTPEGBOTTOM) ^ !!(lines[i].flags & ML_EFFECT3)) + lines[i].flags |= ML_EFFECT3; + else + lines[i].flags &= ~ML_EFFECT3; + } } /** Compute MD5 message digest for bytes read from memory source diff --git a/src/r_segs.c b/src/r_segs.c index 48d071b29..28968563e 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -345,7 +345,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) { dc_texturemid = ds->maskedtextureheight[dc_x]; - if (!!(curline->linedef->flags & ML_DONTPEGBOTTOM) ^ !!(curline->linedef->flags & ML_EFFECT3)) + if (curline->linedef->flags & ML_EFFECT3) dc_texturemid += (textureheight[texnum])*times + textureheight[texnum]; else dc_texturemid -= (textureheight[texnum])*times; @@ -1455,9 +1455,9 @@ static void R_RenderSegLoop (void) maskedtexturecol[rw_x] = (INT16)texturecolumn; if (maskedtextureheight != NULL) { - maskedtextureheight[rw_x] = (!!(curline->linedef->flags & ML_DONTPEGBOTTOM) ^ !!(curline->linedef->flags & ML_EFFECT3) ? + maskedtextureheight[rw_x] = (curline->linedef->flags & ML_EFFECT3) ? max(rw_midtexturemid, rw_midtextureback) : - min(rw_midtexturemid, rw_midtextureback)); + min(rw_midtexturemid, rw_midtextureback); } } @@ -2247,7 +2247,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (curline->polyseg) { // use REAL front and back floors please, so midtexture rendering isn't mucked up rw_midtextureslide = rw_midtexturebackslide = 0; - if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) + if (linedef->flags & ML_EFFECT3) rw_midtexturemid = rw_midtextureback = max(curline->frontsector->floorheight, curline->backsector->floorheight) - viewz; else rw_midtexturemid = rw_midtextureback = min(curline->frontsector->ceilingheight, curline->backsector->ceilingheight) - viewz; @@ -2258,13 +2258,13 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (linedef->flags & ML_EFFECT2) { // Ignore slopes when texturing rw_midtextureslide = rw_midtexturebackslide = 0; - if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) + if (linedef->flags & ML_EFFECT3) rw_midtexturemid = rw_midtextureback = max(frontsector->floorheight, backsector->floorheight) - viewz; else rw_midtexturemid = rw_midtextureback = min(frontsector->ceilingheight, backsector->ceilingheight) - viewz; } - else if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) + else if (linedef->flags & ML_EFFECT3) { rw_midtexturemid = worldbottom; rw_midtextureslide = floorfrontslide;