From e49d4a4cee8c0d5b0d0aaa59b703cd1131e2448a Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 10 Feb 2021 20:08:39 -0800 Subject: [PATCH] Use fabs --- src/r_data.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/r_data.c b/src/r_data.c index 018f3cd47..39c41d8bf 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -726,7 +726,7 @@ lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap) } // Add/subtract this value during fading. - brightChange[i] = abs(cbest - cdist) / (double)fadedist; + brightChange[i] = fabs(cbest - cdist) / (double)fadedist; } // Now allocate memory for the actual colormap array itself! @@ -749,21 +749,21 @@ lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap) continue; // Add/subtract towards the destination color. - if (abs(map[i][0] - cdestr) <= brightChange[i]) + if (fabs(map[i][0] - cdestr) <= brightChange[i]) map[i][0] = cdestr; else if (map[i][0] > cdestr) map[i][0] -= brightChange[i]; else map[i][0] += brightChange[i]; - if (abs(map[i][1] - cdestg) <= brightChange[i]) + if (fabs(map[i][1] - cdestg) <= brightChange[i]) map[i][1] = cdestg; else if (map[i][1] > cdestg) map[i][1] -= brightChange[i]; else map[i][1] += brightChange[i]; - if (abs(map[i][2] - cdestb) <= brightChange[i]) + if (fabs(map[i][2] - cdestb) <= brightChange[i]) map[i][2] = cdestb; else if (map[i][2] > cdestb) map[i][2] -= brightChange[i];