From 4c095c954d26cf4f5668613604142ae5f46db55c Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Tue, 12 Dec 2017 05:14:12 +0000 Subject: [PATCH] Fix tints with negative shades in r_usenewshading 4. Patch from Fox. git-svn-id: https://svn.eduke32.com/eduke32@6561 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/include/polymost.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/source/build/include/polymost.h b/source/build/include/polymost.h index 9e03cd2fd..ac499a942 100644 --- a/source/build/include/polymost.h +++ b/source/build/include/polymost.h @@ -81,9 +81,7 @@ static inline float getshadefactor(int32_t const shade) return 1.f; if (r_usenewshading == 4) - { - return 1.f - (shade * shadescale / frealmaxshade); - } + return max(min(1.f - (shade * shadescale / frealmaxshade), 1.f), 0.f); float const shadebound = (float)((shadescale_unbounded || shade>=numshades) ? numshades : numshades-1); float const scaled_shade = (float)shade*shadescale;