From 780c568aafd0dcaaf5105d2b0c5ea3f7f3a93d1f Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 17 May 2015 12:03:52 -0500 Subject: [PATCH] Fix sprite-to-plane sorting on sloped FOFs --- src/r_things.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index a759dd1d0..0de6a1282 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1752,24 +1752,32 @@ static void R_CreateDrawNodes(void) { if (r2->plane) { + fixed_t planeobjectz; if (r2->plane->minx > rover->x2 || r2->plane->maxx < rover->x1) continue; if (rover->szt > r2->plane->low || rover->sz < r2->plane->high) continue; + // Gotta get the plane's height AT THE OBJECT POSITION if we're using slopes -Red + planeobjectz = +#ifdef ESLOPE + r2->plane->slope ? P_GetZAt(r2->plane->slope, rover->gx, rover->gy) : +#endif + r2->plane->height; + if (rover->mobjflags & MF_NOCLIPHEIGHT) { //Objects with NOCLIPHEIGHT can appear halfway in. - if (r2->plane->height < viewz && rover->pz+(rover->thingheight/2) >= r2->plane->height) + if (r2->plane->height < viewz && rover->pz+(rover->thingheight/2) >= planeobjectz) continue; - if (r2->plane->height > viewz && rover->pzt-(rover->thingheight/2) <= r2->plane->height) + if (r2->plane->height > viewz && rover->pzt-(rover->thingheight/2) <= planeobjectz) continue; } else { - if (r2->plane->height < viewz && rover->pz >= r2->plane->height) + if (r2->plane->height < viewz && rover->pz >= planeobjectz) continue; - if (r2->plane->height > viewz && rover->pzt <= r2->plane->height) + if (r2->plane->height > viewz && rover->pzt <= planeobjectz) continue; }