From 2a6a7e1d2b1c7ed67868d3d63f5c663f06eecd65 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 11 Nov 2025 14:16:00 +0100 Subject: [PATCH] smol optimization R_NoEncore reuse secspecial for invertencore check --- src/r_bsp.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index ea0f5c17a..5a0a21d76 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -48,21 +48,30 @@ boolean g_walloffscreen = false; boolean R_NoEncore(sector_t *sector, boolean ceiling) { - boolean invertencore = (GETSECSPECIAL(sector->special, 2) == 12 || GETSECSPECIAL(sector->special, 2) == 15); // keeping this incase its used + const INT32 invspecial = GETSECSPECIAL(sector->special, 2); + boolean invertencore = (invspecial == 12 || invspecial == 15); // keeping this incase its used + #if 0 // perfect implementation - INT32 val = GETSECSPECIAL(sector->special, 3); - if (val != 1 && val != 3 // spring panel + const INT32 sprnspecial = GETSECSPECIAL(sector->special, 3); + if (sprnspecial != 1 && sprnspecial != 3 // spring panel #else // optimised, see #define GETSECSPECIAL(i,j) ((i >> ((j-1)*4))&15) if ((!(sector->special & (1<<8)) || (sector->special & ((4|8)<<8))) // spring panel #endif && GETSECSPECIAL(sector->special, 4) != 6) // sneaker panel - return invertencore; + { + return invertencore; + } if (invertencore) + { return false; + } if (ceiling) + { return ((boolean)(sector->flags & SF_FLIPSPECIAL_CEILING)); + } + return ((boolean)(sector->flags & SF_FLIPSPECIAL_FLOOR)); }