aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics/transitions32.cpp
diff options
context:
space:
mode:
authorColin Snover2016-08-26 19:49:31 -0500
committerColin Snover2016-09-29 19:39:16 -0500
commit63345b2b70e72330b4f2845bd45e13117be41dc4 (patch)
treeb41e6c86484e88695e653bbcf34b24844e43e5e9 /engines/sci/graphics/transitions32.cpp
parent21ffb62f806b556a7faae84c5a221f51baa86087 (diff)
downloadscummvm-rg350-63345b2b70e72330b4f2845bd45e13117be41dc4.tar.gz
scummvm-rg350-63345b2b70e72330b4f2845bd45e13117be41dc4.tar.bz2
scummvm-rg350-63345b2b70e72330b4f2845bd45e13117be41dc4.zip
SCI32: Fix kShowStyleNone transitions
Diffstat (limited to 'engines/sci/graphics/transitions32.cpp')
-rw-r--r--engines/sci/graphics/transitions32.cpp156
1 files changed, 81 insertions, 75 deletions
diff --git a/engines/sci/graphics/transitions32.cpp b/engines/sci/graphics/transitions32.cpp
index 361c38e2b4..e98f783922 100644
--- a/engines/sci/graphics/transitions32.cpp
+++ b/engines/sci/graphics/transitions32.cpp
@@ -233,92 +233,98 @@ void GfxTransitions32::kernelSetShowStyle(const uint16 argc, const reg_t planeOb
}
}
- if (type > 0) {
- if (createNewEntry) {
- entry = new PlaneShowStyle;
- // NOTE: SCI2.1 engine tests if allocation returned a null pointer
- // but then only avoids setting currentStep if this is so. Since
- // this is a nonsensical approach, we do not do that here
- entry->currentStep = 0;
- entry->processed = false;
- entry->divisions = hasDivisions ? divisions : _defaultDivisions[type];
- entry->plane = planeObj;
- entry->fadeColorRangesCount = 0;
-
- if (getSciVersion() < SCI_VERSION_2_1_MIDDLE) {
- // for pixel dissolve
- entry->bitmap = NULL_REG;
- entry->bitmapScreenItem = nullptr;
-
- // for wipe
- entry->screenItems.clear();
- entry->width = plane->_gameRect.width();
- entry->height = plane->_gameRect.height();
- } else {
- entry->fadeColorRanges = nullptr;
- if (hasFadeArray) {
- // NOTE: SCI2.1mid engine does no check to verify that an array is
- // successfully retrieved, and SegMan will cause a fatal error
- // if we try to use a memory segment that is not an array
- SciArray<reg_t> *table = _segMan->lookupArray(pFadeArray);
-
- uint32 rangeCount = table->getSize();
- entry->fadeColorRangesCount = rangeCount;
-
- // NOTE: SCI engine code always allocates memory even if the range
- // table has no entries, but this does not really make sense, so
- // we avoid the allocation call in this case
- if (rangeCount > 0) {
- entry->fadeColorRanges = new uint16[rangeCount];
- for (size_t i = 0; i < rangeCount; ++i) {
- entry->fadeColorRanges[i] = table->getValue(i).toUint16();
- }
+ if (type == kShowStyleNone) {
+ if (createNewEntry == false) {
+ deleteShowStyle(findIteratorForPlane(planeObj));
+ }
+
+ return;
+ }
+
+ if (createNewEntry) {
+ entry = new PlaneShowStyle;
+ // NOTE: SCI2.1 engine tests if allocation returned a null pointer
+ // but then only avoids setting currentStep if this is so. Since
+ // this is a nonsensical approach, we do not do that here
+ entry->currentStep = 0;
+ entry->processed = false;
+ entry->divisions = hasDivisions ? divisions : _defaultDivisions[type];
+ entry->plane = planeObj;
+ entry->fadeColorRangesCount = 0;
+
+ if (getSciVersion() < SCI_VERSION_2_1_MIDDLE) {
+ // for pixel dissolve
+ entry->bitmap = NULL_REG;
+ entry->bitmapScreenItem = nullptr;
+
+ // for wipe
+ entry->screenItems.clear();
+ entry->width = plane->_gameRect.width();
+ entry->height = plane->_gameRect.height();
+ } else {
+ entry->fadeColorRanges = nullptr;
+ if (hasFadeArray) {
+ // NOTE: SCI2.1mid engine does no check to verify that an array is
+ // successfully retrieved, and SegMan will cause a fatal error
+ // if we try to use a memory segment that is not an array
+ SciArray<reg_t> *table = _segMan->lookupArray(pFadeArray);
+
+ uint32 rangeCount = table->getSize();
+ entry->fadeColorRangesCount = rangeCount;
+
+ // NOTE: SCI engine code always allocates memory even if the range
+ // table has no entries, but this does not really make sense, so
+ // we avoid the allocation call in this case
+ if (rangeCount > 0) {
+ entry->fadeColorRanges = new uint16[rangeCount];
+ for (size_t i = 0; i < rangeCount; ++i) {
+ entry->fadeColorRanges[i] = table->getValue(i).toUint16();
}
}
}
}
+ }
- // NOTE: The original engine had no nullptr check and would just crash
- // if it got to here
- if (entry == nullptr) {
- error("Cannot edit non-existing ShowStyle entry");
- }
+ // NOTE: The original engine had no nullptr check and would just crash
+ // if it got to here
+ if (entry == nullptr) {
+ error("Cannot edit non-existing ShowStyle entry");
+ }
- entry->fadeUp = isFadeUp;
- entry->color = color;
- entry->nextTick = g_sci->getTickCount();
- entry->type = type;
- entry->animate = animate;
- entry->delay = (seconds * 60 + entry->divisions - 1) / entry->divisions;
+ entry->fadeUp = isFadeUp;
+ entry->color = color;
+ entry->nextTick = g_sci->getTickCount();
+ entry->type = type;
+ entry->animate = animate;
+ entry->delay = (seconds * 60 + entry->divisions - 1) / entry->divisions;
- if (entry->delay == 0) {
- error("ShowStyle has no duration");
- }
+ if (entry->delay == 0) {
+ error("ShowStyle has no duration");
+ }
- if (frameOutNow) {
- // Creates a reference frame for the pixel dissolves to use
- g_sci->_gfxFrameout->frameOut(false);
- }
+ if (frameOutNow) {
+ // Creates a reference frame for the pixel dissolves to use
+ g_sci->_gfxFrameout->frameOut(false);
+ }
- if (createNewEntry) {
- if (getSciVersion() <= SCI_VERSION_2_1_EARLY) {
- switch (entry->type) {
- case kShowStyleIrisOut:
- case kShowStyleIrisIn:
- configure21EarlyIris(*entry, priority);
- break;
- case kShowStyleDissolve:
- configure21EarlyDissolve(*entry, priority, plane->_gameRect);
- break;
- default:
- // do nothing
- break;
- }
+ if (createNewEntry) {
+ if (getSciVersion() <= SCI_VERSION_2_1_EARLY) {
+ switch (entry->type) {
+ case kShowStyleIrisOut:
+ case kShowStyleIrisIn:
+ configure21EarlyIris(*entry, priority);
+ break;
+ case kShowStyleDissolve:
+ configure21EarlyDissolve(*entry, priority, plane->_gameRect);
+ break;
+ default:
+ // do nothing
+ break;
}
-
- _showStyles.push_back(*entry);
- delete entry;
}
+
+ _showStyles.push_back(*entry);
+ delete entry;
}
}