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;