Recreate the CLUT when the palette changes

This commit is contained in:
Jaime Passos 2019-11-11 00:02:22 -03:00 committed by Latapostrophe
parent f22e767380
commit 994f9492e8

View file

@ -2604,13 +2604,15 @@ void InitColorLUT(void)
{ {
UINT8 r, g, b; UINT8 r, g, b;
static boolean clutinit = false; static boolean clutinit = false;
if (!clutinit) static RGBA_t *lastpalette = NULL;
if ((!clutinit) || (lastpalette != pLocalPalette))
{ {
for (r = 0; r < CLUTSIZE; r++) for (r = 0; r < CLUTSIZE; r++)
for (g = 0; g < CLUTSIZE; g++) for (g = 0; g < CLUTSIZE; g++)
for (b = 0; b < CLUTSIZE; b++) for (b = 0; b < CLUTSIZE; b++)
colorlookup[r][g][b] = NearestColor(r << SHIFTCOLORBITS, g << SHIFTCOLORBITS, b << SHIFTCOLORBITS); colorlookup[r][g][b] = NearestColor(r << SHIFTCOLORBITS, g << SHIFTCOLORBITS, b << SHIFTCOLORBITS);
clutinit = true; clutinit = true;
lastpalette = pLocalPalette;
} }
} }