From 0ca5fc0c67eb08efa2c1124495a3906f60bf2139 Mon Sep 17 00:00:00 2001 From: Chris Ison Date: Sun, 3 Jun 2001 12:15:06 +0000 Subject: [PATCH] just some tidy up, thanx Deek --- libs/video/targets/vid_3dfxsvga.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/libs/video/targets/vid_3dfxsvga.c b/libs/video/targets/vid_3dfxsvga.c index aed7fc883..f7d7e7e35 100644 --- a/libs/video/targets/vid_3dfxsvga.c +++ b/libs/video/targets/vid_3dfxsvga.c @@ -222,20 +222,21 @@ findres (int *width, int *height) void TDFX_BrightenPalette (unsigned char *palette) { - byte *pal; - int i; - float red, green, blue, maxnum, somenum; + byte *pal; + int i; + float red, green, blue, maxnum, somenum; + pal = palette; for (i = 0; i < 255; i++) { - red = (float)pal[0]; - green = (float)pal[1]; - blue = (float)pal[2]; - maxnum = max(red,max(green,blue)); - somenum = (bound(0.0,(maxnum * tdfx_brighten->value),255.0) / maxnum); - pal[0] = (int)(somenum * red); - pal[1] = (int)(somenum * green); - pal[2] = (int)(somenum * blue); + red = (float) pal[0]; + green = (float) pal[1]; + blue = (float) pal[2]; + maxnum = max (red, max (green, blue)); + somenum = (bound (0.0, (maxnum * tdfx_brighten->value), 255.0) / maxnum); + pal[0] = (byte) ((somenum * red) + 0.5); + pal[1] = (byte) ((somenum * green) + 0.5); + pal[2] = (byte) ((somenum * blue) + 0.5); pal += 3; } }