From 9e281e76439ba0488c2f5d6c7e44a9d431d7e85f Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Thu, 28 Oct 2021 12:04:00 +0200 Subject: [PATCH] reset column drawing function Fixes #301 Short analysis: Usually, the colfunc() pointer is reset to R_DrawColumn() in R_DrawVisSprite() when the player sprites are rendered via R_DrawPSprite() in R_DrawPlayerSprites() as the last step in R_DrawMasked(). However, if you bob your 1px wide weapon sprite out of view, R_DrawPSprite() returns early and the weapon sprite's vissprite is never rendered, thus the pointer is not reset. That's why the glitch immediately disappeared when switching to a regular weapon sprite such as the Chainsaw. This also explains why the glitch never became apparent in widescreen mode. Actually, removing the TRANMAP lump or forcing to regenerate it did *not* fix the issue. It was still there but a lot less visible, since translucent textures were drawn on translucent textures which were drawn on the black void - the TRANMAP just helped to make the glitch undeniable, together with the player sprite that actually triggered it. Apparently, the case that I attempted to fix earlier, i.e. that the TRANMAP lump gets marked as purgeable after being used as a translucency table for a mid-texture, is already been taken care of in P_LoadSideDefs2(). --- Source/r_segs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/r_segs.c b/Source/r_segs.c index d87bc5f1..b3260f27 100644 --- a/Source/r_segs.c +++ b/Source/r_segs.c @@ -206,10 +206,11 @@ void R_RenderMaskedSegRange(drawseg_t *ds, int x1, int x2) maskedtexturecol[dc_x] = D_MAXINT; // [FG] 32-bit integer math } + // [FG] reset column drawing function + colfunc = R_DrawColumn; + // Except for main_tranmap, mark others purgable at this point if (curline->linedef->tranlump > 0 && general_translucency) - // [FG] make sure to never mark main_tranmap as purgeable - if (tranmap != main_tranmap) Z_ChangeTag(tranmap, PU_CACHE); // killough 4/11/98 }