[Scummvm-cvs-logs] CVS: scummvm/saga sthread.cpp,1.66,1.67

Andrew Kurushin h00ligan at users.sourceforge.net
Fri Jan 21 15:45:21 CET 2005


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

Modified Files:
	sthread.cpp 
Log Message:
some opcode fixes:
opReturnV

Index: sthread.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sthread.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- sthread.cpp	21 Jan 2005 23:35:33 -0000	1.66
+++ sthread.cpp	21 Jan 2005 23:44:34 -0000	1.67
@@ -181,7 +181,6 @@
 	ScriptFunctionType scriptFunction;
 
 	uint16 data;
-	uint16 scriptRetVal = 0;
 	int debug_print = 0;
 	int n_buf;
 //	int bitstate;
@@ -338,21 +337,21 @@
 				break;
 			}
 
-			if (operandChar == opCcall) // CALL function
+			if (operandChar == opCcall) {// CALL function
 				thread->push(thread->_returnValue);
+			}
 
 			if (thread->_flags & kTFlagAsleep)
 				instructionCount = instructionLimit;	// break out of loop!
 			break;
-		case opEnter: // Enter a function
+		CASEOP(opEnter)
 			thread->push(thread->_frameIndex);
 			thread->_frameIndex = thread->_stackTopIndex;
 			thread->_stackTopIndex -= (scriptS.readUint16LE() / 2);
 			break;
-		case opReturn: // Return with value
-			scriptRetVal = thread->pop();
-			// Fall through
-		case opReturnV: // Return with void
+		CASEOP(opReturn)
+			thread->_returnValue = thread->pop();
+		CASEOP(opReturnV)
 			thread->_stackTopIndex = thread->_frameIndex;
 			thread->_frameIndex = thread->pop();
 			if (thread->pushedSize() == 0) {
@@ -361,9 +360,15 @@
 				return;
 			} else {
 				thread->_instructionOffset = thread->pop();
-				/* int n_args = */ thread->pop();
-				if (operandChar == opReturn)
-					thread->push(scriptRetVal);
+				param1 = thread->pop();
+				param1 +=param1;
+				while (param1--) {
+					thread->pop();
+				}
+
+				if (operandChar == opReturn) {
+					thread->push(thread->_returnValue);
+				}
 			}
 			break;
 





More information about the Scummvm-git-logs mailing list