From 2d8d14dcc53e421bb68280f49367e8eca6055fe1 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 28 Apr 2025 11:29:35 +0200 Subject: [PATCH] move doaddline block slightly better branching since maps with portals are very uncommon in kart --- src/hardware/hw_main.c | 59 +++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 6dd264618..e7bdc20fb 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -2394,7 +2394,35 @@ static void HWR_AddLine(seg_t *line) gl_backsector = line->backsector; if (!cv_glportals.value || LIKELY(!gl_maphasportals)) - goto doaddline; + { +doaddline: + if (!line->backsector) + { + gld_clipper_SafeAddClipRange(angle2, angle1); + } + else + { + gl_backsector = R_FakeFlat(gl_backsector, &tempsec, NULL, NULL, true); + + if (CheckClip(gl_frontsector, gl_backsector)) + { + gld_clipper_SafeAddClipRange(angle2, angle1); + checkforemptylines = false; + } + + // Reject empty lines used for triggers and special events. + // Identical floor and ceiling on both sides, + // identical light levels on both sides, + // and no middle texture. + if (checkforemptylines && R_IsEmptyLine(line, gl_frontsector, gl_backsector)) + return; + } + + if (LIKELY(gl_portal_state != GLPORTAL_SEARCH && !dont_draw))// no need to do this during the portal check + HWR_ProcessSeg(); // Doesn't need arguments because they're defined globally :D + + return; + } // do extra checks on the seg when rendering portals: // don't render segs that are behind the portal destination line @@ -2430,34 +2458,7 @@ static void HWR_AddLine(seg_t *line) return;// dont do anything with the other side i guess? } -doaddline: - - if (!line->backsector) - { - gld_clipper_SafeAddClipRange(angle2, angle1); - } - else - { - gl_backsector = R_FakeFlat(gl_backsector, &tempsec, NULL, NULL, true); - - if (CheckClip(gl_frontsector, gl_backsector)) - { - gld_clipper_SafeAddClipRange(angle2, angle1); - checkforemptylines = false; - } - - // Reject empty lines used for triggers and special events. - // Identical floor and ceiling on both sides, - // identical light levels on both sides, - // and no middle texture. - if (checkforemptylines && R_IsEmptyLine(line, gl_frontsector, gl_backsector)) - return; - } - - if (LIKELY(gl_portal_state != GLPORTAL_SEARCH && !dont_draw))// no need to do this during the portal check - HWR_ProcessSeg(); // Doesn't need arguments because they're defined globally :D - - return; + goto doaddline; } // HWR_CheckBBox