Negative Light

Light no longer goes wrong when lightlevel of a sector is negative.
This commit is contained in:
Sryder13 2014-03-24 17:11:45 +00:00
parent 770c7eeade
commit 9e10e3278b

View file

@ -401,6 +401,12 @@ UINT32 HWR_Lighting(INT32 light, UINT32 color, UINT32 fadecolor, boolean fogbloc
(void)fogblockpoly;
// Don't go out of bounds
if (light < 0)
light = 0;
else if (light > 255)
light = 255;
realcolor.rgba = color;
fogcolor.rgba = fadecolor;
@ -488,6 +494,12 @@ static UINT8 HWR_FogBlockAlpha(INT32 light, UINT32 color, UINT32 fadecolor) // L
RGBA_t realcolor, fogcolor, surfcolor;
INT32 alpha, fogalpha;
// Don't go out of bounds
if (light < 0)
light = 0;
else if (light > 255)
light = 255;
realcolor.rgba = color;
fogcolor.rgba = fadecolor;