diff options
author | Colin Snover | 2017-07-07 21:02:39 -0500 |
---|---|---|
committer | Colin Snover | 2017-07-07 23:42:30 -0500 |
commit | f59269006c0c7ff42cea4fe106eef2a111d06d64 (patch) | |
tree | 19312bc4010c17b40bd96a5863255e703c70cfe9 /engines | |
parent | 9e90624052af7350b07f50714ed0782b8f72a120 (diff) | |
download | scummvm-rg350-f59269006c0c7ff42cea4fe106eef2a111d06d64.tar.gz scummvm-rg350-f59269006c0c7ff42cea4fe106eef2a111d06d64.tar.bz2 scummvm-rg350-f59269006c0c7ff42cea4fe106eef2a111d06d64.zip |
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.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/graphics/transitions32.cpp | 60 | ||||
-rw-r--r-- | engines/sci/graphics/transitions32.h | 8 |
2 files changed, 64 insertions, 4 deletions
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) { diff --git a/engines/sci/graphics/transitions32.h b/engines/sci/graphics/transitions32.h index 685012fada..c4c52283d1 100644 --- a/engines/sci/graphics/transitions32.h +++ b/engines/sci/graphics/transitions32.h @@ -337,6 +337,12 @@ private: void configure21EarlyHorizontalWipe(PlaneShowStyle &showStyle, const int16 priority); /** + * Initializes the given PlaneShowStyle for a + * horizontal shutter effect for SCI2 to 2.1early. + */ + void configure21EarlyHorizontalShutter(PlaneShowStyle &showStyle, const int16 priority); + + /** * Initializes the given PlaneShowStyle for an * iris effect for SCI2 to 2.1early. */ @@ -364,7 +370,7 @@ private: * Performs a transition that renders into a room * with a horizontal shutter effect. */ - void processHShutterOut(PlaneShowStyle &showStyle); + bool processHShutterOut(PlaneShowStyle &showStyle); /** * Performs a transition that renders to black |