From a04fcce3a998025b765a567791595b3129ae414d Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 9 Jun 2016 22:07:43 +0100 Subject: [PATCH] Hack to fix midtextures for polyobjects being mucked up "frontsector" in this part of the code isn't actually the polyobject's sector for back-side polyobject segs, it's the in-level sector the polyobject as a whole is being rendered in it turns out. --- src/r_segs.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/r_segs.c b/src/r_segs.c index a2487771b..07fe554c2 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -2483,6 +2483,15 @@ void R_StoreWallRange(INT32 start, INT32 stop) #ifdef ESLOPE maskedtextureheight = ds_p->maskedtextureheight; // note to red, this == &(ds_p->maskedtextureheight[0]) +#ifdef POLYOBJECTS + 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)) + 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; + } else +#endif // Set midtexture starting height if (linedef->flags & ML_EFFECT2) { // Ignore slopes when texturing rw_midtextureslide = rw_midtexturebackslide = 0;