Speaking of maths, here's how the colormaps are generated:
Code: Select all
#define NUMLIGHTS 32
/*
=====================
=
= RF_BuildLights
=
= 0 is full palette
= NUMLIGHTS and NUMLIGHTS+1 are all black
=
=====================
*/
void RF_BuildLights (void)
{
int l,c;
int red,green,blue, ri, gi, bi;
byte *palsrc;
short color12,color15;
for (l=0;l<NUMLIGHTS;l++)
{
//printf ("%i.",NUMLIGHTS-l);
palsrc = palette;
for (c=0;c<256;c++)
{
red = *palsrc++;
green = *palsrc++;
blue = *palsrc++;
red = (red*(NUMLIGHTS-l)+NUMLIGHTS/2)/NUMLIGHTS;
green = (green*(NUMLIGHTS-l)+NUMLIGHTS/2)/NUMLIGHTS;
blue = (blue*(NUMLIGHTS-l)+NUMLIGHTS/2)/NUMLIGHTS;
lightpalette[l][c] = BestColor(red,green,blue,palette,0,255);
}
memcpy (screen,lightpalette[l],256);
screen+=320;
memcpy (screen,lightpalette[l],256);
screen+=320;
memcpy (screen,lightpalette[l],256);
screen+=320;
}
}
(I snipped out the unused code for Doom Alpha's highcolor modes.)
So the formula for the darkest colormap range is (where l = 31, so NUMLIGHTS - l is 1) is:
So an intensity of 0 yields 0.5, and an intensity of 255 yields 8.46875.