From 0bf25fad846f293f33156f6cdbcae0c21f020b26 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 17 Aug 2024 15:30:04 +0200 Subject: [PATCH] Use a const for the contrast --- src/p_setup.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 29e7f987c..8faa56a78 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -528,15 +528,16 @@ static inline float P_SegLengthFloat(seg_t *seg) */ void P_UpdateSegLightOffset(seg_t *li) { + const UINT8 contrast = 8; fixed_t extralight = 0; - extralight = -(8*FRACUNIT) + + extralight = -((fixed_t)contrast*FRACUNIT) + FixedDiv(AngleFixed(R_PointToAngle2(0, 0, abs(li->v1->x - li->v2->x), - abs(li->v1->y - li->v2->y))), 90*FRACUNIT) * 16; + abs(li->v1->y - li->v2->y))), 90*FRACUNIT) * ((fixed_t)contrast * 2); - // Between -1 and 1 for software, -8 and 8 for hardware - li->lightOffset = FixedFloor((extralight / 8) + (FRACUNIT / 2)) / FRACUNIT; + // Between -2 and 2 for software, -8 and 8 for hardware + li->lightOffset = FixedFloor((extralight / contrast) + (FRACUNIT / 2)) / FRACUNIT; #ifdef HWRENDER li->hwLightOffset = FixedFloor(extralight + (FRACUNIT / 2)) / FRACUNIT; #endif @@ -549,7 +550,6 @@ static void P_LoadRawSegs(UINT8 *data) mapseg_t *ml = (mapseg_t*)data; seg_t *li = segs; line_t *ldef; - fixed_t extralight = 0; size_t i; for (i = 0; i < numsegs; i++, li++, ml++)