[Scummvm-cvs-logs] CVS: scummvm/saga script.h,1.70,1.71 sthread.cpp,1.76,1.77

Andrew Kurushin h00ligan at users.sourceforge.net
Sun Apr 3 10:23:55 CEST 2005


Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22433

Modified Files:
	script.h sthread.cpp 
Log Message:
-fixed interpreter bug: on opCall now pushes additional data for compatibly
ps:doors can be opened

Index: script.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.h,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- script.h	29 Mar 2005 17:54:53 -0000	1.70
+++ script.h	3 Apr 2005 17:23:02 -0000	1.71
@@ -290,7 +290,7 @@
 	}
 
 	uint pushedSize() {
-		return _stackSize - _stackTopIndex - 1;
+		return _stackSize - _stackTopIndex - 2;
 	}
 
 	void push(int16 value) {

Index: sthread.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sthread.cpp,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- sthread.cpp	3 Apr 2005 15:32:04 -0000	1.76
+++ sthread.cpp	3 Apr 2005 17:23:02 -0000	1.77
@@ -49,7 +49,7 @@
 	newThread->_flags = kTFlagNone;
 	newThread->_stackSize = DEFAULT_THREAD_STACK_SIZE;
 	newThread->_stackBuf = (uint16 *)malloc(newThread->_stackSize * sizeof(*newThread->_stackBuf));
-	newThread->_stackTopIndex = newThread->_stackSize - 1; // or 2 - as in original
+	newThread->_stackTopIndex = newThread->_stackSize - 2; 
 	newThread->_instructionOffset = _modules[scriptModuleNumber].entryPoints[scriptEntryPointNumber].offset;
 	newThread->_commonBase = _commonBuffer;
 	newThread->_staticBase = _commonBuffer + _modules[scriptModuleNumber].staticOffset;
@@ -322,6 +322,8 @@
 			// counter as a pointer here. But I don't think
 			// we will have to do that.
 			thread->push(param2);
+			// NOTE2: program counter is 32bit - so we should "emulate" it size - because kAddressStack relies on it
+			thread->push(0);
 			thread->_instructionOffset = iparam1;
 			
 			break;
@@ -338,7 +340,6 @@
 			(this->*scriptFunction)(thread, argumentsCount);
 
 			if (scriptFunction == &Saga::Script::sfScriptGotoScene) {			
-			//if (functionNumber ==  16) { // sfScriptGotoScene
 				return true; // cause abortAllThreads called and _this_ thread destroyed
 			}
 
@@ -363,6 +364,7 @@
 				thread->_flags |= kTFlagFinished;
 				return true;
 			} else {
+				thread->pop(); //cause it 0
 				thread->_instructionOffset = thread->pop();
 				iparam1 = thread->pop();
 				iparam1 += iparam1;





More information about the Scummvm-git-logs mailing list