diff options
author | Bastien Bouclet | 2016-06-26 07:20:21 +0200 |
---|---|---|
committer | Bastien Bouclet | 2016-06-26 08:37:07 +0200 |
commit | 3391c726cf2cdb6a5523765eefdeb124291f5608 (patch) | |
tree | 8cba4e240af10ac34d038859614af69a9ed71281 /engines/mohawk/cursors.cpp | |
parent | cedcdbc48d391537e4bd867d60665f72b1528a67 (diff) | |
download | scummvm-rg350-3391c726cf2cdb6a5523765eefdeb124291f5608.tar.gz scummvm-rg350-3391c726cf2cdb6a5523765eefdeb124291f5608.tar.bz2 scummvm-rg350-3391c726cf2cdb6a5523765eefdeb124291f5608.zip |
MOHAWK: Remap bitmaps not to use undefined colors
The Spanish version of Myst has bitmaps that use palette indices in the system
reserved range. Affected pixels previously used colors from the Windows system
palette instead of the bitmap's own palette, resulting in visual glitches.
Bitmaps are now remapped to the screen palette which is made of the Windows
reserved palette and part of the bitmap palette. The original engine used GDI's
StretchDIBits with DIB_RGB_COLORS to achieve the same result.
Fixes #7153.
Diffstat (limited to 'engines/mohawk/cursors.cpp')
-rw-r--r-- | engines/mohawk/cursors.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/engines/mohawk/cursors.cpp b/engines/mohawk/cursors.cpp index 4b66829e6a..72eebca917 100644 --- a/engines/mohawk/cursors.cpp +++ b/engines/mohawk/cursors.cpp @@ -34,8 +34,8 @@ #include "graphics/wincursor.h" #ifdef ENABLE_MYST -#include "mohawk/bitmap.h" #include "mohawk/myst.h" +#include "mohawk/myst_graphics.h" #endif namespace Mohawk { @@ -86,11 +86,9 @@ void DefaultCursorManager::setCursor(uint16 id) { #ifdef ENABLE_MYST MystCursorManager::MystCursorManager(MohawkEngine_Myst *vm) : _vm(vm) { - _bmpDecoder = new MystBitmap(); } MystCursorManager::~MystCursorManager() { - delete _bmpDecoder; } void MystCursorManager::showCursor() { @@ -111,17 +109,18 @@ void MystCursorManager::setCursor(uint16 id) { return; } - // Both Myst and Myst ME use the "MystBitmap" format for cursor images. - MohawkSurface *mhkSurface = _bmpDecoder->decodeImage(_vm->getResource(ID_WDIB, id)); - Graphics::Surface *surface = mhkSurface->getSurface(); Common::SeekableReadStream *clrcStream = _vm->getResource(ID_CLRC, id); uint16 hotspotX = clrcStream->readUint16LE(); uint16 hotspotY = clrcStream->readUint16LE(); delete clrcStream; + // Both Myst and Myst ME use the "MystBitmap" format for cursor images. + MohawkSurface *mhkSurface = _vm->_gfx->findImage(id); + Graphics::Surface *surface = mhkSurface->getSurface(); + // Myst ME stores some cursors as 24bpp images instead of 8bpp if (surface->format.bytesPerPixel == 1) { - CursorMan.replaceCursor(surface->getPixels(), surface->w, surface->h, hotspotX, hotspotY, 0); + CursorMan.replaceCursor(surface->getPixels(), surface->w, surface->h, hotspotX, hotspotY, 255); // We're using the screen palette for the original game, but we need // to use this for any 8bpp cursor in ME. @@ -133,7 +132,6 @@ void MystCursorManager::setCursor(uint16 id) { } _vm->_needsUpdate = true; - delete mhkSurface; } void MystCursorManager::setDefaultCursor() { |