aboutsummaryrefslogtreecommitdiff
path: root/engines/saga/animation.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2007-06-16 01:59:04 +0000
committerFilippos Karapetis2007-06-16 01:59:04 +0000
commitedce8944147846adc71f55659a0daff0b58e90e9 (patch)
tree91212a9da06f80cbd5bd52c6734688e1d259c3a4 /engines/saga/animation.cpp
parentb37161bafd8045b3f094620e7cb42549db2e6db5 (diff)
downloadscummvm-rg350-edce8944147846adc71f55659a0daff0b58e90e9.tar.gz
scummvm-rg350-edce8944147846adc71f55659a0daff0b58e90e9.tar.bz2
scummvm-rg350-edce8944147846adc71f55659a0daff0b58e90e9.zip
Fixed chained cutaways in IHNM. Ben's chapter is completable now
svn-id: r27439
Diffstat (limited to 'engines/saga/animation.cpp')
-rw-r--r--engines/saga/animation.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/engines/saga/animation.cpp b/engines/saga/animation.cpp
index 4d6843e2eb..6de3ed822a 100644
--- a/engines/saga/animation.cpp
+++ b/engines/saga/animation.cpp
@@ -80,6 +80,8 @@ void Anim::freeCutawayList(void) {
void Anim::playCutaway(int cut, bool fade) {
debug(0, "playCutaway(%d, %d)", cut, fade);
+ bool startImmediately = false;
+
_cutAwayFade = fade;
_vm->_gfx->savePalette();
@@ -111,6 +113,19 @@ void Anim::playCutaway(int cut, bool fade) {
else
_vm->_interface->setMode(kPanelCutaway);
_cutawayActive = true;
+ } else {
+ // HACK: Chained cutaways don't behave properly with our event system, leading to
+ // crashes. We need to clear all the current cutaways (like clearcutaway does) and make
+ // sure that the next cutaway or video is started immediately. This avoids crashes
+ // with chained cutaways and videos, without causing any side effects, but this is not
+ // in the original interpreter.
+ // The only chained cutaways I've seen up to now are in Ben's chapter.
+ // FIXME: Is there a more elegant solution for this?
+ for (int i = 0; i < ARRAYSIZE(_cutawayAnimations); i++) {
+ delete _cutawayAnimations[i];
+ _cutawayAnimations[i] = NULL;
+ }
+ startImmediately = true;
}
// Set the initial background and palette for the cutaway
@@ -179,7 +194,8 @@ void Anim::playCutaway(int cut, bool fade) {
setCycles(MAX_ANIMATIONS + cutawaySlot, _cutawayList[cut].cycles);
setFrameTime(MAX_ANIMATIONS + cutawaySlot, 1000 / _cutawayList[cut].frameRate);
- if (_cutAwayMode != kPanelVideo)
+
+ if (_cutAwayMode != kPanelVideo || startImmediately)
play(MAX_ANIMATIONS + cutawaySlot, 0);
else {
Event event;