[Scummvm-cvs-logs] SF.net SVN: scummvm: [27439] scummvm/trunk/engines/saga/animation.cpp

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sat Jun 16 03:59:05 CEST 2007


Revision: 27439
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27439&view=rev
Author:   thebluegr
Date:     2007-06-15 18:59:04 -0700 (Fri, 15 Jun 2007)

Log Message:
-----------
Fixed chained cutaways in IHNM. Ben's chapter is completable now

Modified Paths:
--------------
    scummvm/trunk/engines/saga/animation.cpp

Modified: scummvm/trunk/engines/saga/animation.cpp
===================================================================
--- scummvm/trunk/engines/saga/animation.cpp	2007-06-16 01:58:03 UTC (rev 27438)
+++ scummvm/trunk/engines/saga/animation.cpp	2007-06-16 01:59:04 UTC (rev 27439)
@@ -80,6 +80,8 @@
 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 @@
 		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 @@
 
 	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;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list