From 1fe1359e5b543498ecd14ca7d2f947b9266ffa13 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 22 Sep 2023 21:26:40 +0200 Subject: [PATCH] - fix incomplete palette generation for paletted rendering. --- source/core/palette.cpp | 38 ++++++-------------------------------- 1 file changed, 6 insertions(+), 32 deletions(-) diff --git a/source/core/palette.cpp b/source/core/palette.cpp index 9b96f9714..8512faf0f 100644 --- a/source/core/palette.cpp +++ b/source/core/palette.cpp @@ -353,42 +353,16 @@ void LookupTableInfo::makeTable(int palnum, const uint8_t *remapbuf, int r, int int length = numshades * 256; auto p = tables[palnum].Shades.LockNewBuffer(length); - if (r == 0 && g == 0 && b == 0) + // "black fog"/visibility case -- only remap color indices + + auto src = getTable(0); + + for (int j = 0; j < numshades; j++) { - // "black fog"/visibility case -- only remap color indices - - auto src = getTable(0); - - for (int j = 0; j < numshades; j++) - for (int i = 0; i < 256; i++) - { - p[256 * j + i] = src[256 * j + remapbuf[i]]; - } - } - else - { - // colored fog case - - auto src = getTable(0); for (int i = 0; i < 256; i++) { - p[i] = src[remapbuf[i]]; + p[256 * j + i] = src[256 * j + remapbuf[i]]; } - -#if 0 // these are never used. - for (int i = 1; i < numshades; i++) - { - int colfac = (numshades - i); - for (int j = 0; j < 256; j++) - { - PalEntry pe = GPalette.BaseColors[remapbuf[j]]; - p[256 * i + j] = ColorMatcher.Pick( - (pe.r * colfac + r * i) / numshades, - (pe.g * colfac + g * i) / numshades, - (pe.b * colfac + b * i) / numshades); - } - } -#endif } tables[palnum].FadeColor.r = r;