diff options
author | Filippos Karapetis | 2016-01-08 15:35:19 +0200 |
---|---|---|
committer | Filippos Karapetis | 2016-01-08 15:35:19 +0200 |
commit | a65ff0e56e90c5066bb9a87fe5f7ad7a0fc6db59 (patch) | |
tree | aba3773a0b822451dae4a4b079c0b554d25af483 /engines/sci/graphics | |
parent | c6e083bcf4e566dc93a9b588519fcfb4088be0c2 (diff) | |
download | scummvm-rg350-a65ff0e56e90c5066bb9a87fe5f7ad7a0fc6db59.tar.gz scummvm-rg350-a65ff0e56e90c5066bb9a87fe5f7ad7a0fc6db59.tar.bz2 scummvm-rg350-a65ff0e56e90c5066bb9a87fe5f7ad7a0fc6db59.zip |
SCI: SCI32 palette cyclers are disjoint, so use a single palette copy
Diffstat (limited to 'engines/sci/graphics')
-rw-r--r-- | engines/sci/graphics/palette32.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/engines/sci/graphics/palette32.cpp b/engines/sci/graphics/palette32.cpp index 2b70f9c0d7..0c7b3f68bb 100644 --- a/engines/sci/graphics/palette32.cpp +++ b/engines/sci/graphics/palette32.cpp @@ -131,22 +131,26 @@ inline void _doCycle(PalCycler *cycler, const int16 speed) { } void GfxPalette32::applyAllCycles() { + Color paletteCopy[256]; + memcpy(paletteCopy, _sysPalette.colors, sizeof(Color) * 256); + for (int cyclerIndex = 0, numCyclers = ARRAYSIZE(_cyclers); cyclerIndex < numCyclers; ++cyclerIndex) { PalCycler *cycler = _cyclers[cyclerIndex]; if (cycler != nullptr) { cycler->currentCycle = (uint8) ((((int) cycler->currentCycle) + 1) % cycler->numColorsToCycle); // Disassembly was not fully evaluated to verify this is exactly the same // as the code from applyCycles, but it appeared to be at a glance - Color paletteCopy[256]; - memcpy(paletteCopy, _sysPalette.colors, sizeof(Color) * 256); - for (int i = 0; i < cycler->numColorsToCycle; i++) { - _sysPalette.colors[cycler->fromColor + i] = paletteCopy[cycler->fromColor + (cycler->currentCycle + i) % cycler->numColorsToCycle]; + for (int j = 0; j < cycler->numColorsToCycle; j++) { + _sysPalette.colors[cycler->fromColor + j] = paletteCopy[cycler->fromColor + (cycler->currentCycle + j) % cycler->numColorsToCycle]; } } } } void GfxPalette32::applyCycles() { + Color paletteCopy[256]; + memcpy(paletteCopy, _sysPalette.colors, sizeof(Color) * 256); + for (int i = 0, len = ARRAYSIZE(_cyclers); i < len; ++i) { PalCycler *cycler = _cyclers[i]; if (cycler == nullptr) { @@ -160,8 +164,6 @@ void GfxPalette32::applyCycles() { } } - Color paletteCopy[256]; - memcpy(paletteCopy, _sysPalette.colors, sizeof(Color) * 256); for (int j = 0; j < cycler->numColorsToCycle; j++) { _sysPalette.colors[cycler->fromColor + j] = paletteCopy[cycler->fromColor + (cycler->currentCycle + j) % cycler->numColorsToCycle]; } @@ -177,7 +179,7 @@ int16 GfxPalette32::setCycle(const uint16 fromColor, const uint16 toColor, const PalCycler *cycler = _getCycler(fromColor); if (cycler != nullptr) { - debug("Resetting existing cycler"); + //debug("Resetting existing cycler"); _clearCycleMap(fromColor, cycler->numColorsToCycle); } else { for (cyclerIndex = 0; cyclerIndex < numCyclers; ++cyclerIndex) { |