From 808775de02a9797f42ecc5b8dd7b87a5e2ab9490 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 29 Mar 2015 00:49:27 -0500 Subject: [PATCH 1/2] Effect 4 on a map line now makes the front midtexture solid (Supports Effect 5 repeating of arbitrary lengths, but not of the automatic "top-to-bottom" type; just use Impassible there!) --- src/p_maputl.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/p_maputl.c b/src/p_maputl.c index 48dd54e8d..b909332b6 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -17,6 +17,7 @@ #include "p_local.h" #include "r_main.h" +#include "r_data.h" #include "p_maputl.h" #include "p_polyobj.h" #include "z_zone.h" @@ -520,6 +521,38 @@ void P_LineOpening(line_t *linedef) { fixed_t thingtop = tmthing->z + tmthing->height; + // Check for collision with front side's midtexture if Effect 4 is set + if (linedef->flags & ML_EFFECT4) { + side_t *side = &sides[linedef->sidenum[0]]; + fixed_t textop, texbottom, texheight; + fixed_t texmid, delta1, delta2; + + // Get the midtexture's height + texheight = textures[texturetranslation[side->midtexture]]->height << FRACBITS; + + // Set texbottom and textop to the Z coordinates of the texture's boundaries + if (linedef->flags & ML_DONTPEGBOTTOM) { + texbottom = openbottom + side->rowoffset; + textop = texbottom + texheight*(side->repeatcnt+1); + } else { + textop = opentop - side->rowoffset; + texbottom = textop - texheight*(side->repeatcnt+1); + } + + texmid = texbottom+(textop-texbottom)/2; + + delta1 = abs(tmthing->z - texmid); + delta2 = abs(thingtop - texmid); + + if (delta1 > delta2) { // Below + if (opentop > texbottom) + opentop = texbottom; + } else { // Above + if (openbottom < textop) + openbottom = textop; + } + } + // Check for fake floors in the sector. if (front->ffloors || back->ffloors #ifdef POLYOBJECTS From 70732f6475719fb42c50024739f8fc3ba5fa0cc3 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Mon, 30 Mar 2015 13:06:04 -0500 Subject: [PATCH 2/2] Make solid midtexture trick work properly(?) for polyobjects --- src/p_maputl.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/p_maputl.c b/src/p_maputl.c index b909332b6..a65d2fa76 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -531,12 +531,25 @@ void P_LineOpening(line_t *linedef) texheight = textures[texturetranslation[side->midtexture]]->height << FRACBITS; // Set texbottom and textop to the Z coordinates of the texture's boundaries - if (linedef->flags & ML_DONTPEGBOTTOM) { - texbottom = openbottom + side->rowoffset; - textop = texbottom + texheight*(side->repeatcnt+1); - } else { - textop = opentop - side->rowoffset; - texbottom = textop - texheight*(side->repeatcnt+1); +#ifdef POLYOBJECTS + if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT)) { + if (linedef->flags & ML_DONTPEGBOTTOM) { + texbottom = back->floorheight + side->rowoffset; + textop = texbottom + texheight*(side->repeatcnt+1); + } else { + textop = back->ceilingheight - side->rowoffset; + texbottom = textop - texheight*(side->repeatcnt+1); + } + } else +#endif + { + if (linedef->flags & ML_DONTPEGBOTTOM) { + texbottom = openbottom + side->rowoffset; + textop = texbottom + texheight*(side->repeatcnt+1); + } else { + textop = opentop - side->rowoffset; + texbottom = textop - texheight*(side->repeatcnt+1); + } } texmid = texbottom+(textop-texbottom)/2;