aboutsummaryrefslogtreecommitdiff
path: root/saga
diff options
context:
space:
mode:
authorTorbjörn Andersson2005-03-08 15:28:01 +0000
committerTorbjörn Andersson2005-03-08 15:28:01 +0000
commitcfe44d6053c8bcce9f9ae887726a652502276c55 (patch)
treecb1b936899cc64099a5599ea2ea1eeb061de32d6 /saga
parent189492eef1a09c2685b854e64a435129777579a6 (diff)
downloadscummvm-rg350-cfe44d6053c8bcce9f9ae887726a652502276c55.tar.gz
scummvm-rg350-cfe44d6053c8bcce9f9ae887726a652502276c55.tar.bz2
scummvm-rg350-cfe44d6053c8bcce9f9ae887726a652502276c55.zip
Apparently, in IHNM opcode #75 can take three parameters. Added stub to
avoid division by zero. svn-id: r17040
Diffstat (limited to 'saga')
-rw-r--r--saga/sfuncs.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp
index 176965a516..20e92cbd70 100644
--- a/saga/sfuncs.cpp
+++ b/saga/sfuncs.cpp
@@ -1549,9 +1549,23 @@ void Script::SF_protectResult(SCRIPTFUNC_PARAMS) {
// Script function #75 (0x4b)
void Script::sfRand(SCRIPTFUNC_PARAMS) {
- int16 param = thread->pop();
+ int16 param;
+
+ if (_vm->getGameType() == GType_IHNM) {
+ // I don't know what this function does in IHNM, but apparently
+ // it can take three parameters.
- thread->_returnValue = _vm->_rnd.getRandomNumber(param - 1);
+ 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)