From 69a593e09da980f1c61ad49ed27def4ff3e45c41 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 8 Dec 2024 04:38:58 +0100 Subject: [PATCH] use early return no need to check for all this crap if we can use it anyways --- src/hardware/hw_main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 44f0a4b1a..dec4082ad 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -470,7 +470,10 @@ static FUINT HWR_CalcWallLight(FUINT lightnum, seg_t *seg) { INT16 finallight = lightnum; - if (seg != NULL && P_ApplyLightOffsetFine(lightnum, seg->frontsector) && cv_glfakecontrast.value != 0) + if (cv_glfakecontrast.value == 0) + return (FUINT)finallight; + + if (seg != NULL && P_ApplyLightOffsetFine(lightnum, seg->frontsector)) { if (cv_glfakecontrast.value == 2) // Smooth setting finallight += seg->hwLightOffset; @@ -487,7 +490,10 @@ static FUINT HWR_CalcSlopeLight(FUINT lightnum, pslope_t *slope, const sector_t { INT16 finallight = lightnum; - if (slope != NULL && sector != NULL && P_ApplyLightOffsetFine(lightnum, sector) && cv_glfakecontrast.value != 0 && cv_glslopecontrast.value != 0) + if (cv_glfakecontrast.value == 0 || cv_glslopecontrast.value == 0) + return (FUINT)finallight; + + if (slope != NULL && sector != NULL && P_ApplyLightOffsetFine(lightnum, sector)) { if (cv_glfakecontrast.value == 2) // Smooth setting finallight += (fof ? -slope->hwLightOffset : slope->hwLightOffset);