add comment about "Carmack's typo"

This commit is contained in:
Roman Fomin 2024-03-17 11:20:55 +07:00
parent f001b48f8f
commit 3c572f8395

View File

@ -208,6 +208,8 @@ void V_InitColorTranslation(void)
double green = *palsrc++ / 256.0; double green = *palsrc++ / 256.0;
double blue = *palsrc++ / 256.0; double blue = *palsrc++ / 256.0;
// formula is taken from dcolors.c preseving "Carmack's typo"
// https://doomwiki.org/wiki/Carmack%27s_typo
int gray = (red * 0.299 + green * 0.587 + blue * 0.144) * 255; int gray = (red * 0.299 + green * 0.587 + blue * 0.144) * 255;
invul_gray[i] = I_GetPaletteIndex(playpal, gray, gray, gray); invul_gray[i] = I_GetPaletteIndex(playpal, gray, gray, gray);
} }