diff --git a/engine/sw/vid_win2.c b/engine/sw/vid_win2.c index d758ec279..2b5efcabe 100644 --- a/engine/sw/vid_win2.c +++ b/engine/sw/vid_win2.c @@ -77,6 +77,7 @@ void R_GammaCorrectAndSetPalette(const unsigned char *pal) { extern qbyte gammatable[256]; int j, i; + int r, g, b; float f; unsigned short *data; r_flushcache++; @@ -87,11 +88,22 @@ void R_GammaCorrectAndSetPalette(const unsigned char *pal) { f = (1 - ((float)j/VID_GRADES)); f = (float)gammatable[(int)(f*255)]/255; + f *= 2; for (i = 0; i < 256; i++) { - data[i] = ((int)(pal[i*3+0]*f*(1< 255) + r = 255; + if (g > 255) + g = 255; + if (b > 255) + b = 255; + r >>= 8 - redbits; + g >>= 8 - greenbits; + b >>= 8 - bluebits; + data[i] = (r< 255) + r = 255; + if (g > 255) + g = 255; + if (b > 255) + b = 255; + r >>= 8 - redbits; + g >>= 8 - greenbits; + b >>= 8 - bluebits; + data[i] = (r<