version 1.1 | | version 1.2 |
---|
| | |
#include <ddraw.h> | | #include <ddraw.h> |
| | |
| | |
| | //added on 7/11/99 by adb to fix palette problem |
| | #undef min |
| | static __inline int min(int x, int y) { return x < y ? x : y; } |
| | //end additions - adb |
| | |
static int last_r=0, last_g=0, last_b=0; | | static int last_r=0, last_g=0, last_b=0; |
| | |
extern void Win32_DoSetPalette(PALETTEENTRY *rgpe); | | extern void Win32_DoSetPalette(PALETTEENTRY *rgpe); |
extern void Win32_DoGetPalette(PALETTEENTRY *rgpe); | | extern void Win32_DoGetPalette(PALETTEENTRY *rgpe); |
| | extern void Win32_MakePalVisible(void); |
| | |
void gr_palette_step_up( int r, int g, int b ) | | void gr_palette_step_up( int r, int g, int b ) |
{ | | { |
| | |
if (temp<0) temp=0; | | if (temp<0) temp=0; |
else if (temp>63) temp=63; | | else if (temp>63) temp=63; |
pe[i].peBlue = min(temp + gr_palette_gamma, 63) * 4; | | pe[i].peBlue = min(temp + gr_palette_gamma, 63) * 4; |
| | pe[i].peFlags = 0; |
} | | } |
Win32_DoSetPalette (pe); | | Win32_DoSetPalette (pe); |
} | | } |
| | |
PALETTEENTRY pe[256]; | | PALETTEENTRY pe[256]; |
for (i=0;i<256;i++) | | for (i=0;i<256;i++) |
{ | | { |
pe[i].peRed=pe[i].peGreen=pe[i].peBlue=0; | | pe[i].peRed=pe[i].peGreen=pe[i].peBlue=pe[i].peFlags=0; |
} | | } |
| | |
Win32_DoSetPalette (pe); | | Win32_DoSetPalette (pe); |
| | |
PALETTEENTRY pe[256]; | | PALETTEENTRY pe[256]; |
| | |
for (i=0; i<768; i++ ) { | | for (i=0; i<768; i++ ) { |
gr_current_pal[i] = pal[i] + gr_palette_gamma; | | //gr_current_pal[i] = pal[i] + gr_palette_gamma; |
// gr_current_pal[i] = pal[i]; | | //if (gr_current_pal[i] > 63) gr_current_pal[i] = 63; |
if (gr_current_pal[i] > 63) gr_current_pal[i] = 63; | | gr_current_pal[i] = pal[i]; |
} | | } |
for (i=0,j=0;j<256;j++) | | for (i=0,j=0;j<256;j++) |
{ | | { |
pe[j].peRed=gr_current_pal[i++] * 4; | | pe[j].peRed = min(gr_current_pal[i++] + gr_palette_gamma, 63) * 4; |
pe[j].peGreen=gr_current_pal[i++] * 4; | | pe[j].peGreen= min(gr_current_pal[i++] + gr_palette_gamma, 63) * 4; |
pe[j].peBlue=gr_current_pal[i++] * 4; | | pe[j].peBlue = min(gr_current_pal[i++] + gr_palette_gamma, 63) * 4; |
| | pe[j].peFlags = 0; |
} | | } |
Win32_DoSetPalette (pe); | | Win32_DoSetPalette (pe); |
| | |
| | |
fade_palette[i] = i2f(pal[i] + gr_palette_gamma); | | fade_palette[i] = i2f(pal[i] + gr_palette_gamma); |
| | |
pe[k].peBlue = min(f2i(fade_palette[i]), 63) * 4; | | pe[k].peBlue = min(f2i(fade_palette[i]), 63) * 4; |
| | pe[k].peFlags = 0; |
i++; | | i++; |
} | | } |
| | |
Win32_DoSetPalette (pe); | | Win32_DoSetPalette (pe); |
| | Win32_MakePalVisible (); |
} | | } |
| | |
gr_palette_faded_out = 1; | | gr_palette_faded_out = 1; |
| | |
fade_palette[i] = i2f(pal[i] + gr_palette_gamma); | | fade_palette[i] = i2f(pal[i] + gr_palette_gamma); |
| | |
pe[k].peBlue = min(f2i(fade_palette[i]), 63) * 4; | | pe[k].peBlue = min(f2i(fade_palette[i]), 63) * 4; |
| | pe[k].peFlags = 0; |
i++; | | i++; |
| | |
} | | } |
| | |
Win32_DoSetPalette (pe); | | Win32_DoSetPalette (pe); |
| | //added on 7/11/99 by adb to allow fade in on non-palette displays |
| | Win32_MakePalVisible (); |
| | //end additions - adb |
} | | } |
| | |
gr_palette_faded_out = 0; | | gr_palette_faded_out = 0; |