From 0d77e8afafc5bbc7db3565e452427d135612a25c Mon Sep 17 00:00:00 2001 From: Nev3r Date: Thu, 6 Jun 2019 11:26:13 +0200 Subject: [PATCH] Add pad checks for visplanes; invalidate invalid columns from visplanes (visplane renderer and column renderers don't speak exactly the same language). The visplane portal top boundary offset has been restored since all known bugs involving it have been fixed. --- src/r_portal.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/r_portal.c b/src/r_portal.c index 4825bb511..0c0a34b7d 100644 --- a/src/r_portal.c +++ b/src/r_portal.c @@ -200,7 +200,14 @@ static void Portal_ClipVisplane (const visplane_t* plane, portal_t* portal) for (i = 0; i < end - start; i++) { - portal->ceilingclip[i] = plane->top[i + start]; + // Invalid column. + if (plane->top[i + start] == 65535) + { + portal->ceilingclip[i] = -1; + portal->floorclip[i] = -1; + continue; + } + portal->ceilingclip[i] = plane->top[i + start] - 1; portal->floorclip[i] = plane->bottom[i + start] + 1; portal->frontscale[i] = INT32_MAX; } @@ -220,6 +227,11 @@ void Portal_AddSkybox (const visplane_t* plane) mapheader_t *mh; portal_t* portal; + // Visplanes have 1-px pads on their sides (extra columns). + // Trim them, else it may render out of bounds. + if (end > viewwidth) + end = viewwidth; + if (!(start < end)) return;