Recreate the CLUT when the palette changes

(cherry picked from commit 6e0ff4a4a40306a59c8b18d03ae86560e6a52a4a)
This commit is contained in:
Jaime Passos 2019-11-11 00:02:22 -03:00 committed by James R
parent 1a759a4904
commit 53f78b7693

View file

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