From 7cbac66935ebae8fa1d0cf5d7eb56f77174219e2 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 28 Oct 2024 20:11:05 +0100 Subject: [PATCH] throw this into an inline func --- src/hardware/hw_main.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 39d52fe90..363dde89c 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -2753,6 +2753,29 @@ static boolean HWR_DoCulling(line_t *cullheight, line_t *viewcullheight, float v return false; } +static inline void HWR_PortalSubsector(seg_t *line, subsector_t *sub, INT16 count) +{ + if (line) + { + //Hurdler: at this point validcount must be the same, but is not because + // gl_frontsector doesn't point anymore to sub->sector due to + // the call gl_frontsector = R_FakeFlat(...) + // if it's not done, the sprite is drawn more than once, + // what looks really bad with translucency or dynamic light, + // without talking about the overdraw of course. + sub->sector->validcount = validcount;/// \todo fix that in a better way + + while (count--) + { + if (!line->polyseg) // ignore segs that belong to polyobjects + HWR_AddLine(line); + line++; + } + } + + sub->validcount = validcount; +} + // -----------------+ // HWR_Subsector : Determine floor/ceiling planes. // : Add sprites of things in sector. @@ -2772,7 +2795,6 @@ static void HWR_Subsector(size_t num) extracolormap_t *floorcolormap; extracolormap_t *ceilingcolormap; ffloor_t *rover; - boolean skipSprites = false; #ifdef PARANOIA //no risk while developing, enough debugging nights! if (num >= addsubsector) @@ -2806,8 +2828,8 @@ static void HWR_Subsector(size_t num) if (gl_portal_state == GLPORTAL_SEARCH) { - skipSprites = true; - goto skip_stuff_for_portals;// hopefully this goto is okay + HWR_PortalSubsector(line, sub, count); + return; } floorcolormap = ceilingcolormap = gl_frontsector->extra_colormap; @@ -3038,8 +3060,6 @@ static void HWR_Subsector(size_t num) } } -skip_stuff_for_portals: - // Hurdler: here interesting things are happening! // we have just drawn the floor and ceiling // we now draw the sprites first and then the walls @@ -3048,8 +3068,7 @@ skip_stuff_for_portals: { // draw sprites first, coz they are clipped to the solidsegs of // subsectors more 'in front' - if (!skipSprites) - HWR_AddSprites(gl_frontsector); + HWR_AddSprites(gl_frontsector); //Hurdler: at this point validcount must be the same, but is not because // gl_frontsector doesn't point anymore to sub->sector due to