- fixed most issues with palette emulation.

Brightness is now correct - I have no idea why this factor of 1/0.85 is needed - something must reduce the brightness of the entire scene but I have no idea what.
This commit is contained in:
Christoph Oelckers 2020-09-18 20:54:08 +02:00
parent 7b879f6fe7
commit 29a10cabcb
3 changed files with 10 additions and 11 deletions

View file

@ -119,8 +119,16 @@ IHardwareTexture* PaletteManager::GetLookup(int index)
{
auto p = screen->CreateHardwareTexture(1);
// Perform a 0<->255 index swap. The lookup tables are still the original data.
TArray<uint8_t> lookup(numshades * 256, true);
memcpy(lookup.Data(), lookups.getTable(index), lookup.Size());
for (int i = 0; i < numshades; i++)
{
auto p = &lookup[i * 256];
p[255] = p[0];
p[0] = 0;
for (int v = 1; v <= 255; v++) if (p[v] == 0) p[v] = 255;
}
p->CreateTexture(lookup.Data(), 256, numshades, 15, false, "PaletteLookup");
lookuptextures[index] = p;
}