diff options
author | Filippos Karapetis | 2012-07-24 22:54:37 +0300 |
---|---|---|
committer | Filippos Karapetis | 2012-07-24 22:54:37 +0300 |
commit | fe3fb1873c60e7ed21c573e09030bd6d0a5018cb (patch) | |
tree | 4fe733a2bbdfbeec4490b1a72a11c9dd3b79682b | |
parent | 6f351302040be620aa039a7c605f3c23463b27db (diff) | |
download | scummvm-rg350-fe3fb1873c60e7ed21c573e09030bd6d0a5018cb.tar.gz scummvm-rg350-fe3fb1873c60e7ed21c573e09030bd6d0a5018cb.tar.bz2 scummvm-rg350-fe3fb1873c60e7ed21c573e09030bd6d0a5018cb.zip |
SCI: Cleanup of the palette remapping code
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics32.cpp | 3 | ||||
-rw-r--r-- | engines/sci/graphics/palette.cpp | 5 | ||||
-rw-r--r-- | engines/sci/graphics/palette.h | 1 |
4 files changed, 5 insertions, 6 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 55c0202048..da377319c0 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -1228,7 +1228,6 @@ reg_t kRemapColors(EngineState *s, int argc, reg_t *argv) { switch (operation) { case 0: { // remap by percent uint16 percent = argv[1].toUint16(); - g_sci->_gfxPalette->toggleRemapping(true); g_sci->_gfxPalette->resetRemapping(); g_sci->_gfxPalette->setRemappingPercent(254, percent); } @@ -1237,7 +1236,6 @@ reg_t kRemapColors(EngineState *s, int argc, reg_t *argv) { uint16 from = argv[1].toUint16(); uint16 to = argv[2].toUint16(); uint16 base = argv[3].toUint16(); - g_sci->_gfxPalette->toggleRemapping(true); g_sci->_gfxPalette->resetRemapping(); g_sci->_gfxPalette->setRemappingRange(254, from, to, base); } diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp index 7240308f4a..3d2c2af81b 100644 --- a/engines/sci/engine/kgraphics32.cpp +++ b/engines/sci/engine/kgraphics32.cpp @@ -741,7 +741,6 @@ reg_t kRemapColors32(EngineState *s, int argc, reg_t *argv) { int16 base = (argc >= 2) ? argv[1].toSint16() : 0; if (base > 0) warning("kRemapColors(0) called with base %d", base); - g_sci->_gfxPalette->toggleRemapping(false); g_sci->_gfxPalette->resetRemapping(); } break; @@ -753,7 +752,6 @@ reg_t kRemapColors32(EngineState *s, int argc, reg_t *argv) { uint16 unk5 = (argc >= 6) ? argv[5].toUint16() : 0; if (unk5 > 0) warning("kRemapColors(1) called with 6 parameters, unknown parameter is %d", unk5); - g_sci->_gfxPalette->toggleRemapping(true); g_sci->_gfxPalette->setRemappingRange(color, from, to, base); } break; @@ -762,7 +760,6 @@ reg_t kRemapColors32(EngineState *s, int argc, reg_t *argv) { uint16 percent = argv[2].toUint16(); // 0 - 100 if (argc >= 4) warning("RemapByPercent called with 4 parameters, unknown parameter is %d", argv[3].toUint16()); - g_sci->_gfxPalette->toggleRemapping(true); g_sci->_gfxPalette->setRemappingPercent(color, percent); } break; diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp index b5154ef860..5a551bab2c 100644 --- a/engines/sci/graphics/palette.cpp +++ b/engines/sci/graphics/palette.cpp @@ -337,6 +337,7 @@ bool GfxPalette::isRemapMask(byte color) { } void GfxPalette::resetRemapping() { + _remapOn = false; _remappingMaskFrom = 0; _remappingMaskTo = 0; _remappingPercentToSet = 0; @@ -347,6 +348,8 @@ void GfxPalette::resetRemapping() { } void GfxPalette::setRemappingPercent(byte color, byte percent) { + _remapOn = true; + // We need to defer the setup of the remapping table until something is // shown on screen, otherwise kernelFindColor() won't find correct // colors. The actual setup of the remapping table will be performed in @@ -360,6 +363,8 @@ void GfxPalette::setRemappingPercent(byte color, byte percent) { } void GfxPalette::setRemappingRange(byte color, byte from, byte to, byte base) { + _remapOn = true; + for (int i = from; i <= to; i++) { _remappingTable[i] = i + base; } diff --git a/engines/sci/graphics/palette.h b/engines/sci/graphics/palette.h index 372f3c7090..134ade5e36 100644 --- a/engines/sci/graphics/palette.h +++ b/engines/sci/graphics/palette.h @@ -53,7 +53,6 @@ public: void getSys(Palette *pal); uint16 getTotalColorCount() const { return _totalScreenColors; } - void toggleRemapping(bool remap) { _remapOn = remap; } void resetRemapping(); void setRemappingPercent(byte color, byte percent); void setRemappingRange(byte color, byte from, byte to, byte base); |