From e03d13c2b899b9580dee783dfd12b5ce0a4d15f1 Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 26 Dec 2024 20:02:46 +0100 Subject: [PATCH] simplify this alot Zzz... somehow overlooked that it already gets a fof sector passed also adds another condition since we dont need to check anything with 255 brightness --- src/hardware/hw_main.c | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 9962d5c1d..57fc751ac 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -692,44 +692,27 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool if (slope) lightlevel = HWR_CalcSlopeLight(lightlevel, slope, gl_frontsector, (FOFsector != NULL)); - if (subsector && (lumpnum != LUMPERROR)) + if ((lightlevel != 255) && subsector && subsector->sector && (lumpnum != LUMPERROR)) { const char *name = W_CheckNameForNum(lumpnum); if (name) { // fayt sneakerpads lel - if (memcmp(name, "PAZRCST", 7) == 0 || memcmp(name, "FSBOST", 6) == 0) + if ((memcmp(name, "PAZRCST", 7) == 0) || (memcmp(name, "FSBOST", 6) == 0)) { lightlevel = 255; } - - // kart sneakerpad - if (memcmp(name, "BOST", 4) == 0) + else if (memcmp(name, "BOST", 4) == 0) // kart sneakerpad { if (GETSECSPECIAL(subsector->sector->special, 4) == 6) - lightlevel = 255; + lightlevel = 255; - if (subsector->sector->ffloors) + // check the fof sector aswell + if (FOFsector != NULL) { - ffloor_t *rover; - - for (rover = subsector->sector->ffloors; rover; rover = rover->next) - { - if (!rover->master->frontsector) - continue; - - if (!rover->master->frontsector->special) - continue; - - if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERPLANES) || (rover->flags & FF_FOG) || (rover->flags & FF_RIPPLE)) - continue; - - if (GETSECSPECIAL(rover->master->frontsector->special, 4) == 6) - { - lightlevel = 255; - } - } + if (GETSECSPECIAL(FOFsector->special, 4) == 6) + lightlevel = 255; } } }