[Scummvm-cvs-logs] CVS: scummvm/saga sfuncs.cpp,1.93,1.94

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Tue Mar 8 07:28:54 CET 2005


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

Modified Files:
	sfuncs.cpp 
Log Message:
Apparently, in IHNM opcode #75 can take three parameters. Added stub to
avoid division by zero.


Index: sfuncs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sfuncs.cpp,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- sfuncs.cpp	8 Mar 2005 15:06:57 -0000	1.93
+++ sfuncs.cpp	8 Mar 2005 15:28:01 -0000	1.94
@@ -1549,9 +1549,23 @@
 
 // Script function #75 (0x4b)
 void Script::sfRand(SCRIPTFUNC_PARAMS) {
-	int16 param = thread->pop();
+	int16 param;
 
-	thread->_returnValue = _vm->_rnd.getRandomNumber(param - 1);
+	if (_vm->getGameType() == GType_IHNM) {
+		// I don't know what this function does in IHNM, but apparently
+		// it can take three parameters.
+
+		debug(1, "stub: sfRand()");
+
+		for (int i = 0; i < nArgs; i++) {
+			thread->pop();
+		}
+
+		thread->_returnValue = 0;
+	} else {
+		param = thread->pop();
+		thread->_returnValue = _vm->_rnd.getRandomNumber(param - 1);
+	}
 }
 
 // Script function #76 (0x4c)





More information about the Scummvm-git-logs mailing list