From f59269006c0c7ff42cea4fe106eef2a111d06d64 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Fri, 7 Jul 2017 21:02:39 -0500 Subject: SCI32: Implement kShowStyle HShutterOut transition This transition style was used when exiting the asteroids minigame in PQ4, though it appears likely that this was an error in the original game script since it does not actually do anything in the context that it is used (neither here nor in the original interpreter). Still, this code is already written, and it fixes the crash, so in it goes. Fixes Trac#9856. --- engines/sci/graphics/transitions32.cpp | 60 ++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 3 deletions(-) (limited to 'engines/sci/graphics/transitions32.cpp') diff --git a/engines/sci/graphics/transitions32.cpp b/engines/sci/graphics/transitions32.cpp index 8f18a60971..df9c2da82b 100644 --- a/engines/sci/graphics/transitions32.cpp +++ b/engines/sci/graphics/transitions32.cpp @@ -320,6 +320,9 @@ void GfxTransitions32::kernelSetShowStyle(const uint16 argc, const reg_t planeOb case kShowStyleWipeRight: configure21EarlyHorizontalWipe(*entry, priority); break; + case kShowStyleHShutterOut: + configure21EarlyHorizontalShutter(*entry, priority); + break; case kShowStyleIrisOut: case kShowStyleIrisIn: configure21EarlyIris(*entry, priority); @@ -382,6 +385,7 @@ ShowStyleList::iterator GfxTransitions32::deleteShowStyle(const ShowStyleList::i case kShowStyleWipeRight: case kShowStyleIrisOut: case kShowStyleIrisIn: + case kShowStyleHShutterOut: if (getSciVersion() <= SCI_VERSION_2_1_EARLY) { for (uint i = 0; i < showStyle->screenItems.size(); ++i) { ScreenItem *screenItem = showStyle->screenItems[i]; @@ -436,6 +440,47 @@ void GfxTransitions32::configure21EarlyHorizontalWipe(PlaneShowStyle &showStyle, } } +void GfxTransitions32::configure21EarlyHorizontalShutter(PlaneShowStyle &showStyle, const int16 priority) { + showStyle.numEdges = 2; + const int numScreenItems = showStyle.numEdges * showStyle.divisions; + showStyle.screenItems.reserve(numScreenItems); + + CelInfo32 celInfo; + celInfo.type = kCelTypeColor; + celInfo.color = showStyle.color; + + const int width = showStyle.width; + const int divisions = showStyle.divisions; + + for (int i = 0; i < divisions; ++i) { + Common::Rect rect; + + // Left + rect.top = 0; + rect.right = (width + 1) * (i + 1) / (2 * divisions); + rect.bottom = showStyle.height; + const int16 leftLeft = rect.left; + + showStyle.screenItems.push_back(new ScreenItem(showStyle.plane, celInfo, rect)); + showStyle.screenItems.back()->_priority = priority; + showStyle.screenItems.back()->_fixedPriority = true; + + // Right + rect.left = width - rect.right; + rect.right = width - leftLeft; + + showStyle.screenItems.push_back(new ScreenItem(showStyle.plane, celInfo, rect)); + showStyle.screenItems.back()->_priority = priority; + showStyle.screenItems.back()->_fixedPriority = true; + } + + if (showStyle.fadeUp) { + for (int i = 0; i < numScreenItems; ++i) { + g_sci->_gfxFrameout->addScreenItem(*showStyle.screenItems[i]); + } + } +} + void GfxTransitions32::configure21EarlyIris(PlaneShowStyle &showStyle, const int16 priority) { showStyle.numEdges = 4; const int numScreenItems = showStyle.numEdges * showStyle.divisions; @@ -532,7 +577,6 @@ bool GfxTransitions32::processShowStyle(PlaneShowStyle &showStyle, uint32 now) { default: case kShowStyleNone: return processNone(showStyle); - case kShowStyleHShutterOut: case kShowStyleHShutterIn: case kShowStyleVShutterOut: case kShowStyleVShutterIn: @@ -541,6 +585,12 @@ bool GfxTransitions32::processShowStyle(PlaneShowStyle &showStyle, uint32 now) { case kShowStyleDissolveNoMorph: case kShowStyleMorph: return processMorph(showStyle); + case kShowStyleHShutterOut: + if (getSciVersion() > SCI_VERSION_2_1_EARLY) { + return processMorph(showStyle); + } else { + return processHShutterOut(showStyle); + } case kShowStyleWipeLeft: if (getSciVersion() > SCI_VERSION_2_1_EARLY) { return processMorph(showStyle); @@ -589,8 +639,12 @@ bool GfxTransitions32::processNone(PlaneShowStyle &showStyle) { return true; } -void GfxTransitions32::processHShutterOut(PlaneShowStyle &showStyle) { - error("HShutterOut is not known to be used by any game. Please submit a bug report with details about the game you were playing and what you were doing that triggered this error. Thanks!"); +bool GfxTransitions32::processHShutterOut(PlaneShowStyle &showStyle) { + if (getSciVersion() > SCI_VERSION_2_1_EARLY) { + error("HShutterOut is not known to be used by any game. Please submit a bug report with details about the game you were playing and what you were doing that triggered this error. Thanks!"); + } + + return processWipe(-1, showStyle); } void GfxTransitions32::processHShutterIn(const PlaneShowStyle &showStyle) { -- cgit v1.2.3