diff options
Diffstat (limited to 'engines/sci/gfx')
-rw-r--r-- | engines/sci/gfx/gfx_resmgr.cpp | 2 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_resmgr.h | 8 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_system.h | 2 | ||||
-rw-r--r-- | engines/sci/gfx/operations.cpp | 5 | ||||
-rw-r--r-- | engines/sci/gfx/res_pal.cpp | 5 |
5 files changed, 16 insertions, 6 deletions
diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp index b8c005b620..cd5b1be431 100644 --- a/engines/sci/gfx/gfx_resmgr.cpp +++ b/engines/sci/gfx/gfx_resmgr.cpp @@ -341,7 +341,7 @@ gfxr_pic_t *GfxResManager::getPic(int num, int maps, int flags, int default_pale res = resMap.contains(num) ? resMap[num] : NULL; if (!res || res->mode != hash) { - gfxr_pic_t *pic; + gfxr_pic_t *pic = NULL; gfxr_pic_t *unscaled_pic = NULL; #ifdef CUSTOM_GRAPHICS_OPTIONS diff --git a/engines/sci/gfx/gfx_resmgr.h b/engines/sci/gfx/gfx_resmgr.h index fc4e0b3d6f..5cd5d018cc 100644 --- a/engines/sci/gfx/gfx_resmgr.h +++ b/engines/sci/gfx/gfx_resmgr.h @@ -270,8 +270,7 @@ public: /** * Retrieves a color from the static palette */ - const PaletteEntry &getColor(int color) - { + const PaletteEntry &getColor(int color) { return _staticPalette->getColor(color); } @@ -313,6 +312,11 @@ public: return _staticPalette ? _staticPalette->size() : 0; } + /** + * Returns the resource version that the resource manager is using + */ + int getVersion() { return _version; } + private: int _version; gfx_options_t *_options; diff --git a/engines/sci/gfx/gfx_system.h b/engines/sci/gfx/gfx_system.h index fe93922e21..0f5292aedf 100644 --- a/engines/sci/gfx/gfx_system.h +++ b/engines/sci/gfx/gfx_system.h @@ -192,7 +192,7 @@ struct gfx_pixmap_t { * As a special exception, 256 colors are allowed for background pictures * (which do not use transparency) */ - int colors_nr() const { return palette ? palette->size() : 0; } + int colors_nr() const { return palette ? MIN<int>(palette->size(), 256) : 0; } uint32 flags; /* @} */ diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index 77b887778b..5604166794 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -1715,9 +1715,10 @@ 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 .) - if (state->driver->getMode()->palette) + 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); + _gfxop_install_pixmap(state->driver, state->pic->visual_map); + } #ifdef CUSTOM_GRAPHICS_OPTIONS if (state->options->pic0_unscaled) 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; |