4 unsigned int d_8to24table[256];
5 //byte d_15to8table[32768];
6 byte host_basepal[768];
8 static float vid_gamma = 1.0;
10 void Palette_Setup8to24()
16 out = (byte *) d_8to24table; // d_8to24table is accessed as 32bit for speed reasons, but is created as 8bit bytes
17 for (i=0 ; i<255 ; i++)
24 d_8to24table[255] = 0; // completely transparent black
28 void Palette_Setup15to8()
37 for (i = 0;i < 32768;i++)
39 r = ((i & 0x001F) << 3)+4;
40 g = ((i & 0x03E0) >> 2)+4;
41 b = ((i & 0x7C00) >> 7)+4;
42 pal = (unsigned char *)d_8to24table;
43 for (v = 0, k = 0, l = 1000000000;v < 256;v++, pal += 4)
48 j = r1*r1+g1*g1+b1*b1;
66 if ((i = COM_CheckParm("-gamma")))
67 vid_gamma = atof(com_argv[i+1]);
69 if (vid_gamma == 1) // LordHavoc: dodge the math
71 for (i = 0;i < 256;i++)
76 for (i = 0;i < 256;i++)
78 inf = pow((i+1)/256.0, vid_gamma)*255 + 0.5;
80 if (inf > 255) inf = 255;
89 pal = (byte *)COM_LoadMallocFile ("gfx/palette.lmp", false);
91 Sys_Error ("Couldn't load gfx/palette.lmp");
92 memcpy(host_basepal, pal, 765);
94 host_basepal[765] = host_basepal[766] = host_basepal[767] = 0; // LordHavoc: force the transparent color to black
96 // Palette_Setup15to8();