aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/gfx
diff options
context:
space:
mode:
authorFilippos Karapetis2009-07-16 12:43:42 +0000
committerFilippos Karapetis2009-07-16 12:43:42 +0000
commit645e6baa07e71d10b76f3f0fd0950c2e0513a23c (patch)
tree7ac4fa7b8cda6c2701b9191281aa20fd724cb265 /engines/sci/gfx
parenta6c41a375fd1ae3395b9662207993739388a5ea0 (diff)
downloadscummvm-rg350-645e6baa07e71d10b76f3f0fd0950c2e0513a23c.tar.gz
scummvm-rg350-645e6baa07e71d10b76f3f0fd0950c2e0513a23c.tar.bz2
scummvm-rg350-645e6baa07e71d10b76f3f0fd0950c2e0513a23c.zip
Added a proper fix for Pepper (the previous one caused regressions in KQ6)
svn-id: r42533
Diffstat (limited to 'engines/sci/gfx')
-rw-r--r--engines/sci/gfx/operations.cpp3
-rw-r--r--engines/sci/gfx/res_pal.cpp5
2 files changed, 6 insertions, 2 deletions
diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp
index 9b2c3dc7f5..6b15cdc516 100644
--- a/engines/sci/gfx/operations.cpp
+++ b/engines/sci/gfx/operations.cpp
@@ -1712,8 +1712,7 @@ static int _gfxop_set_pic(GfxState *state) {
// FIXME: The _gfxop_install_pixmap call below updates the OSystem palette.
// This is too soon, since it causes brief palette corruption until the
// screen is updated too. (Possibly related: EngineState::pic_not_valid .)
- // SCI1.1 games don't use per-picture palettes
- if (state->gfxResMan->getVersion() < SCI_VERSION_1_1) {
+ if (state->pic->visual_map->palette && state->driver->getMode()->palette) {
state->pic->visual_map->palette->forceInto(state->driver->getMode()->palette);
_gfxop_install_pixmap(state->driver, state->pic->visual_map);
}
diff --git a/engines/sci/gfx/res_pal.cpp b/engines/sci/gfx/res_pal.cpp
index 97e7297d43..d686220453 100644
--- a/engines/sci/gfx/res_pal.cpp
+++ b/engines/sci/gfx/res_pal.cpp
@@ -44,6 +44,11 @@ Palette *gfxr_read_pal11(int id, byte *resource, int size) {
int entry_size = (format == SCI_PAL_FORMAT_VARIABLE_FLAGS) ? 4 : 3;
byte *pal_data = resource + 37;
int _colors_nr = READ_LE_UINT16(resource + 29);
+
+ // Happens at the beginning of Pepper
+ if (_colors_nr > 256)
+ return NULL;
+
Palette *retval = new Palette(_colors_nr + start_color);
int i;