From 33cac793736c1d419cc69e1caac0feb248657a6f Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Wed, 16 Mar 2016 21:57:36 -0500 Subject: SCI32: Work around bad Styler script in KQ7 2.0b The SCI2.1mid version of the game includes scripts designed for SCI2.1early which means wrong parameters are sent to the kernel. --- engines/sci/graphics/frameout.cpp | 13 +++++++++++-- engines/sci/graphics/frameout.h | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'engines/sci/graphics') diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index fc9f5d8299..30e59c208c 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -1120,11 +1120,20 @@ inline ShowStyleEntry *GfxFrameout::deleteShowStyleInternal(ShowStyleEntry *cons // and need to be fixed in future // TODO: SQ6 does not use 'priority' (exists since SCI2) or 'blackScreen' (exists since SCI3); // check to see if other versions use or if they are just always ignored -void GfxFrameout::kernelSetShowStyle(const uint16 argc, const reg_t &planeObj, const ShowStyleType type, const int16 seconds, const int16 back, const int16 priority, const int16 animate, const int16 frameOutNow, const reg_t &pFadeArray, const int16 divisions, const int16 blackScreen) { +void GfxFrameout::kernelSetShowStyle(const uint16 argc, const reg_t planeObj, const ShowStyleType type, const int16 seconds, const int16 back, const int16 priority, const int16 animate, const int16 frameOutNow, reg_t pFadeArray, int16 divisions, const int16 blackScreen) { bool hasDivisions = false; bool hasFadeArray = false; - if (getSciVersion() < SCI_VERSION_2_1_MIDDLE) { + + // KQ7 2.0b uses a mismatched version of the Styler script (SCI2.1early script + // for SCI2.1mid engine), so the calls it makes to kSetShowStyle are wrong and + // put `divisions` where `pFadeArray` is supposed to be + if (getSciVersion() == SCI_VERSION_2_1_MIDDLE && g_sci->getGameId() == GID_KQ7) { + hasDivisions = argc > 7; + hasFadeArray = false; + divisions = argc > 7 ? pFadeArray.toSint16() : -1; + pFadeArray = NULL_REG; + } else if (getSciVersion() < SCI_VERSION_2_1_MIDDLE) { hasDivisions = argc > 7; hasFadeArray = false; } else if (getSciVersion() < SCI_VERSION_3) { diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h index aef215356d..7cc1adf059 100644 --- a/engines/sci/graphics/frameout.h +++ b/engines/sci/graphics/frameout.h @@ -333,7 +333,7 @@ private: public: // NOTE: This signature is taken from SCI3 Phantasmagoria 2 // and is valid for all implementations of SCI32 - void kernelSetShowStyle(const uint16 argc, const reg_t &planeObj, const ShowStyleType type, const int16 seconds, const int16 direction, const int16 priority, const int16 animate, const int16 frameOutNow, const reg_t &pFadeArray, const int16 divisions, const int16 blackScreen); + void kernelSetShowStyle(const uint16 argc, const reg_t planeObj, const ShowStyleType type, const int16 seconds, const int16 direction, const int16 priority, const int16 animate, const int16 frameOutNow, reg_t pFadeArray, int16 divisions, const int16 blackScreen); #pragma mark - #pragma mark Rendering -- cgit v1.2.3