From cafec8773d4a5b9b38da9d12ee68ec6ad02bf163 Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Sat, 12 Aug 2017 08:51:47 +0200 Subject: MOHAWK: Myst: Fix incorrect vault instructions using image patch Thanks to dafioram for providing the replacement image. Fixes #10115. --- engines/mohawk/myst_graphics.cpp | 73 +++++++++++++++++++++++++++++++++++++++- engines/mohawk/myst_graphics.h | 2 ++ 2 files changed, 74 insertions(+), 1 deletion(-) (limited to 'engines/mohawk') diff --git a/engines/mohawk/myst_graphics.cpp b/engines/mohawk/myst_graphics.cpp index 0aceb1de04..9b0d33e30b 100644 --- a/engines/mohawk/myst_graphics.cpp +++ b/engines/mohawk/myst_graphics.cpp @@ -97,7 +97,7 @@ MohawkSurface *MystGraphics::decodeImage(uint16 id) { Image::PICTDecoder pict; if (!pict.loadStream(*dataStream)) - error("Could not decode Myst ME PICT"); + error("Could not decode Myst ME PICT %d", id); delete dataStream; @@ -113,9 +113,80 @@ MohawkSurface *MystGraphics::decodeImage(uint16 id) { } assert(mhkSurface); + applyImagePatches(id, mhkSurface); return mhkSurface; } +void MystGraphics::applyImagePatches(uint16 id, const MohawkSurface *mhkSurface) const { + + // In the English ME version of the game, the instructions found on Stoneship + // to open the vault are incorrect. They are: + // Turn every one of [these switches to the] "off" position. + // They should be: + // Turn every one of [these switches to the] "on" position. + // + // Here we stomp over the "off" with an "on". + // The fixed image was provided by dafioram in bug Trac#10115. + if (id == 2019 && _vm->getFeatures() & GF_ME && _vm->getLanguage() == Common::EN_ANY) { + static const byte markerSwitchInstructionsFixPic[] = { + 0x1d, 0x1c, 0x19, 0x19, 0x19, 0x19, 0x1c, 0x19, 0x19, 0x17, 0x19, 0x19, 0x19, 0x19, 0x19, + 0x1e, 0x1e, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, + 0x1c, 0x19, 0x19, 0x19, 0x1c, 0x19, 0x19, 0x19, 0x1c, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, + 0x1d, 0x1e, 0x16, 0x0d, 0x0e, 0x12, 0x19, 0x19, 0x17, 0x10, 0x06, 0x05, 0x19, 0x19, 0x19, + 0x1e, 0x1e, 0x10, 0x13, 0x1c, 0x11, 0x0d, 0x19, 0x12, 0x09, 0x16, 0x04, 0x18, 0x18, 0x19, + 0x1e, 0x1a, 0x03, 0x1b, 0x1c, 0x17, 0x02, 0x15, 0x13, 0x00, 0x19, 0x06, 0x18, 0x19, 0x18, + 0x1e, 0x1e, 0x01, 0x1b, 0x1c, 0x1b, 0x02, 0x15, 0x13, 0x00, 0x19, 0x07, 0x0a, 0x19, 0x18, + 0x1e, 0x1c, 0x0c, 0x0e, 0x14, 0x0c, 0x0c, 0x19, 0x0b, 0x00, 0x19, 0x00, 0x08, 0x19, 0x19, + 0x1e, 0x1c, 0x19, 0x14, 0x0f, 0x0f, 0x14, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x17, + 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, + 0x1c, 0x1c, 0x1e, 0x19, 0x19, 0x19, 0x17, 0x19, 0x19, 0x17, 0x19, 0x19, 0x19, 0x19, 0x19 + }; + + static const byte markerSwitchInstructionsFixPal[] = { + 0x00, 0x00, 0x00, + 0x10, 0x08, 0x08, + 0x18, 0x10, 0x10, + 0x28, 0x10, 0x08, + 0x20, 0x18, 0x18, + 0x28, 0x20, 0x20, + 0x38, 0x20, 0x10, + 0x30, 0x28, 0x20, + 0x38, 0x30, 0x28, + 0x40, 0x38, 0x28, + 0x48, 0x38, 0x28, + 0x48, 0x40, 0x30, + 0x50, 0x48, 0x38, + 0x50, 0x48, 0x40, + 0x60, 0x50, 0x38, + 0x68, 0x58, 0x40, + 0x68, 0x58, 0x48, + 0x70, 0x60, 0x50, + 0x78, 0x68, 0x50, + 0x80, 0x70, 0x50, + 0x80, 0x78, 0x60, + 0x88, 0x80, 0x60, + 0x98, 0x90, 0x70, + 0xb0, 0xa0, 0x78, + 0xb8, 0xa8, 0x8d, + 0xb8, 0xa8, 0x90, + 0xb8, 0xb0, 0x88, + 0xc0, 0xb8, 0x90, + 0xd8, 0xcc, 0x98, + 0xd0, 0xe0, 0xc8, + 0xf0, 0xe4, 0xc8 + }; + + Graphics::Surface fixSurf; + fixSurf.create(15, 11, Graphics::PixelFormat::createFormatCLUT8()); + fixSurf.copyRectToSurface(markerSwitchInstructionsFixPic, fixSurf.w, 0, 0, fixSurf.w, fixSurf.h); + fixSurf.convertToInPlace(_pixelFormat, markerSwitchInstructionsFixPal); + + mhkSurface->getSurface()->copyRectToSurface(fixSurf, 171, 208, Common::Rect(fixSurf.w, fixSurf.h)); + + fixSurf.free(); + } +} + void MystGraphics::copyImageSectionToScreen(uint16 image, Common::Rect src, Common::Rect dest) { Graphics::Surface *surface = findImage(image)->getSurface(); diff --git a/engines/mohawk/myst_graphics.h b/engines/mohawk/myst_graphics.h index 173e02357d..44669bd6dc 100644 --- a/engines/mohawk/myst_graphics.h +++ b/engines/mohawk/myst_graphics.h @@ -82,6 +82,8 @@ private: void remapSurfaceToSystemPalette(MohawkSurface *mhkSurface); byte getColorIndex(const byte *palette, byte red, byte green, byte blue); + + void applyImagePatches(uint16 id, const MohawkSurface *mhkSurface) const; }; } // End of namespace Mohawk -- cgit v1.2.3