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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Feb 20 11:49:43 CET 2009


Revision: 38581
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38581&view=rev
Author:   thebluegr
Date:     2009-02-20 10:49:43 +0000 (Fri, 20 Feb 2009)

Log Message:
-----------
Fixed a nasty regression from the script system rewrite (commit #35670), which will cause crashes under certain conditions, and probably makes SAGA games non-completable. 

When a script thread is waiting for another thread, the current instruction offset should not be modified. The thread processing function would incorrectly continue in some special cases, and would incorrectly alter the current instruction offset. This becomes apparent in some special cases only, which made it hard to spot - plus, SAGA games have not been tested for 0.13.0, so there weren't any reports for this.

This change SHOULD go to the 0.13.0 branch, but we've already tagged...

Modified Paths:
--------------
    scummvm/trunk/engines/saga/script.cpp
    scummvm/trunk/engines/saga/sthread.cpp

Modified: scummvm/trunk/engines/saga/script.cpp
===================================================================
--- scummvm/trunk/engines/saga/script.cpp	2009-02-20 04:23:18 UTC (rev 38580)
+++ scummvm/trunk/engines/saga/script.cpp	2009-02-20 10:49:43 UTC (rev 38581)
@@ -614,12 +614,14 @@
 
 	if (scriptFunction == &Saga::Script::sfScriptGotoScene) {
 		stopParsing = true; // cause abortAllThreads called and _this_ thread destroyed
+		breakOut = true;
 		return;
 	}
 
 #ifdef ENABLE_IHNM
 	if (scriptFunction == &Saga::Script::sfVsetTrack) {
 		stopParsing = true;
+		breakOut = true;
 		return;		// cause abortAllThreads called and _this_ thread destroyed
 	}
 #endif
@@ -661,12 +663,14 @@
 	
 	if (scriptFunction == &Saga::Script::sfScriptGotoScene) {
 		stopParsing = true;
+		breakOut = true;
 		return;		// cause abortAllThreads called and _this_ thread destroyed
 	}
 
 #ifdef ENABLE_IHNM
 	if (scriptFunction == &Saga::Script::sfVsetTrack) {
 		stopParsing = true;
+		breakOut = true;
 		return;		// cause abortAllThreads called and _this_ thread destroyed
 	}
 #endif
@@ -691,6 +695,7 @@
 	if (thread->pushedSize() == 0) {
 		thread->_flags |= kTFlagFinished;
 		stopParsing = true;
+		breakOut = true;
 		return;
 	} else {
 		thread->pop(); //cause it 0
@@ -712,6 +717,7 @@
 	if (thread->pushedSize() == 0) {
 		thread->_flags |= kTFlagFinished;
 		stopParsing = true;
+		breakOut = true;
 		return;
 	} else {
 		thread->pop(); //cause it 0
@@ -954,7 +960,8 @@
 void Script::opSpeak(SCRIPTOP_PARAMS) {
 	if (_vm->_actor->isSpeaking()) {
 		thread->wait(kWaitTypeSpeech);
-		stopParsing = false;
+		stopParsing = true;
+		breakOut = false;
 		return;
 	}
 
@@ -1007,7 +1014,8 @@
 void Script::opDialogBegin(SCRIPTOP_PARAMS) {
 	if (_conversingThread) {
 		thread->wait(kWaitTypeDialogBegin);
-		stopParsing = false;
+		stopParsing = true;
+		breakOut = false;
 		return;
 	}
 	_conversingThread = thread;
@@ -1019,7 +1027,8 @@
 		_vm->_interface->activate();
 		_vm->_interface->setMode(kPanelConverse);
 		thread->wait(kWaitTypeDialogEnd);
-		stopParsing = false;
+		stopParsing = true;
+		breakOut = false;
 		return;
 	}
 }

Modified: scummvm/trunk/engines/saga/sthread.cpp
===================================================================
--- scummvm/trunk/engines/saga/sthread.cpp	2009-02-20 04:23:18 UTC (rev 38580)
+++ scummvm/trunk/engines/saga/sthread.cpp	2009-02-20 10:49:43 UTC (rev 38581)
@@ -213,10 +213,10 @@
 		debug(8, "Executing thread offset: %u (%x) stack: %d", thread->_instructionOffset, operandChar, thread->pushedSize());
 
 		stopParsing = false;
+		debug(4, "Calling op %s", this->_scriptOpsList[operandChar].scriptOpName);
 		(this->*_scriptOpsList[operandChar].scriptOp)(thread, &scriptS, stopParsing, breakOut);
-		debug(4, "Calling op %s", this->_scriptOpsList[operandChar].scriptOpName);
 		if (stopParsing)
-			return true;
+			return breakOut;
 
 		if (thread->_flags & (kTFlagFinished | kTFlagAborted)) {
 			error("Wrong flags %d in thread", thread->_flags);


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