aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics
diff options
context:
space:
mode:
authorFilippos Karapetis2012-07-24 22:55:34 +0300
committerFilippos Karapetis2012-07-24 22:55:34 +0300
commit37b209dac14bea6b8f08c3ee3f66e3d5772652bb (patch)
treeb7baeec55f66152bab2409219a754b4f7f89fb48 /engines/sci/graphics
parentfe3fb1873c60e7ed21c573e09030bd6d0a5018cb (diff)
downloadscummvm-rg350-37b209dac14bea6b8f08c3ee3f66e3d5772652bb.tar.gz
scummvm-rg350-37b209dac14bea6b8f08c3ee3f66e3d5772652bb.tar.bz2
scummvm-rg350-37b209dac14bea6b8f08c3ee3f66e3d5772652bb.zip
SCI: Refresh remapping by percent whenever the screen palette changes
Diffstat (limited to 'engines/sci/graphics')
-rw-r--r--engines/sci/graphics/palette.cpp31
1 files changed, 13 insertions, 18 deletions
diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp
index 5a551bab2c..cb5c0fe614 100644
--- a/engines/sci/graphics/palette.cpp
+++ b/engines/sci/graphics/palette.cpp
@@ -350,10 +350,10 @@ 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
+ // We need to defer the setup of the remapping table every time the screen
+ // palette is changed, so that kernelFindColor() can find the correct
// colors. The actual setup of the remapping table will be performed in
- // remapColor().
+ // copySysPaletteToScreen().
_remappingPercentToSet = percent;
if (_remappingMaskFrom > color || _remappingMaskFrom == 0)
@@ -377,21 +377,6 @@ void GfxPalette::setRemappingRange(byte color, byte from, byte to, byte base) {
byte GfxPalette::remapColor(byte color) {
assert(_remapOn);
-
- // Check if we need to set remapping by percent. This can only be
- // performed when something is shown on screen, so that the screen
- // palette is set up and kernelFindColor() can work correctly.
- if (_remappingPercentToSet) {
- for (int i = 0; i < 256; i++) {
- byte r = _sysPalette.colors[i].r * _remappingPercentToSet / 100;
- byte g = _sysPalette.colors[i].g * _remappingPercentToSet / 100;
- byte b = _sysPalette.colors[i].b * _remappingPercentToSet / 100;
- _remappingTable[i] = kernelFindColor(r, g, b);
- }
-
- _remappingPercentToSet = 0;
- }
-
return _remappingTable[color];
}
@@ -557,6 +542,16 @@ void GfxPalette::copySysPaletteToScreen() {
}
}
+ // Check if we need to reset remapping by percent with the new colors.
+ if (_remappingPercentToSet) {
+ for (int i = 0; i < 256; i++) {
+ byte r = _sysPalette.colors[i].r * _remappingPercentToSet / 100;
+ byte g = _sysPalette.colors[i].g * _remappingPercentToSet / 100;
+ byte b = _sysPalette.colors[i].b * _remappingPercentToSet / 100;
+ _remappingTable[i] = kernelFindColor(r, g, b);
+ }
+ }
+
g_system->getPaletteManager()->setPalette(bpal, 0, 256);
}