From 75309ff21b7d5b104fb2a41cd644cad6b7fdda34 Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 26 Dec 2024 20:50:56 +0100 Subject: [PATCH] crappy optimization check first if any of those flats exist lel --- src/hardware/hw_main.c | 44 +++++++++++++++++++++++++----------------- src/hardware/hw_main.h | 5 +++++ src/p_setup.c | 17 ++++++++++++++++ 3 files changed, 48 insertions(+), 18 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 1361b6d6a..26e2d3e0e 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -118,6 +118,11 @@ ps_metric_t ps_hw_numcolors = {0}; ps_metric_t ps_hw_batchsorttime = {0}; ps_metric_t ps_hw_batchdrawtime = {0}; +// terrible optimization +boolean havesnakerpad = false; +boolean havepazrcst = false; +boolean havefaytpad = false; + static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, boolean noencore, FSurfaceInfo* Surf, INT32 cutflag, ffloor_t *pfloor, FBITFIELD polyflags); static void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap); @@ -692,28 +697,31 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool if (slope) lightlevel = HWR_CalcSlopeLight(lightlevel, slope, gl_frontsector, (FOFsector != NULL)); - if ((lightlevel != 255) && subsector && subsector->sector && (lumpnum != LUMPERROR)) + if (havesnakerpad || havepazrcst || havefaytpad) { - const char *name = W_CheckNameForNum(lumpnum); - - if (name) + if ((lightlevel != 255) && subsector && subsector->sector && (lumpnum != LUMPERROR)) { - // kart sneakerpad - if (memcmp(name, "BOST", 4) == 0) - { - if (GETSECSPECIAL(subsector->sector->special, 4) == 6) - lightlevel = 255; + const char *name = W_CheckNameForNum(lumpnum); - // check the fof sector aswell - if (FOFsector != NULL) - { - if (GETSECSPECIAL(FOFsector->special, 4) == 6) - lightlevel = 255; - } - } - else if ((memcmp(name, "PAZRCST", 7) == 0) || (memcmp(name, "FSBOST", 6) == 0)) // fayt sneakerpads lel + if (name) { - lightlevel = 255; + // kart sneakerpad + if (havesnakerpad && memcmp(name, "BOST", 4) == 0) + { + if (GETSECSPECIAL(subsector->sector->special, 4) == 6) + lightlevel = 255; + + // check the fof sector aswell + if (FOFsector != NULL) + { + if (GETSECSPECIAL(FOFsector->special, 4) == 6) + lightlevel = 255; + } + } + else if ((havepazrcst && (memcmp(name, "PAZRCST", 7) == 0)) || (havefaytpad && (memcmp(name, "FSBOST", 6) == 0))) // fayt sneakerpads lel + { + lightlevel = 255; + } } } } diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 345c0e0a5..5b02b85f3 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -82,6 +82,11 @@ extern ps_metric_t ps_hw_batchdrawtime; extern boolean gl_shadersavailable; +// terrible optimization lmao +extern boolean havesnakerpad; +extern boolean havepazrcst; +extern boolean havefaytpad; + // hw_draw.c void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option); void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap); diff --git a/src/p_setup.c b/src/p_setup.c index 231ac734e..e6b25ef82 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -686,6 +686,19 @@ INT32 P_AddLevelFlat(const char *flatname, levelflat_t *levelflat) // store the flat lump number levelflat->lumpnum = R_GetFlatNumForName(flatname); + if (!havesnakerpad && memcmp(levelflat->name, "BOST", 4) == 0) + { + havesnakerpad = true; + } + if (!havepazrcst && memcmp(levelflat->name, "PAZRCST", 7) == 0) + { + havepazrcst = true; + } + if (!havefaytpad && memcmp(levelflat->name, "FSBOST", 6) == 0) + { + havefaytpad= true; + } + #ifndef ZDEBUG CONS_Debug(DBG_SETUP, "flat #%03d: %s\n", atoi(sizeu1(numlevelflats)), levelflat->name); #endif @@ -780,6 +793,10 @@ static void P_LoadRawSectors(UINT8 *data) numlevelflats = 0; + havesnakerpad = false; + havepazrcst = false; + havefaytpad = false; + // For each counted sector, copy the sector raw data from our cache pointer ms, to the global table pointer ss. for (i = 0; i < numsectors; i++, ss++, ms++) {