diff options
author | Torbjörn Andersson | 2004-11-07 15:11:04 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2004-11-07 15:11:04 +0000 |
commit | 18abe168cedb8a332d69dabe661c0edf9847e229 (patch) | |
tree | 807808920dfa6bec92025a989e8a83b320753891 | |
parent | c55ff57fc6111a3e67c598a3cca579392ce70d16 (diff) | |
download | scummvm-rg350-18abe168cedb8a332d69dabe661c0edf9847e229.tar.gz scummvm-rg350-18abe168cedb8a332d69dabe661c0edf9847e229.tar.bz2 scummvm-rg350-18abe168cedb8a332d69dabe661c0edf9847e229.zip |
Unstubbed SF_dropObject(). (Untested)
svn-id: r15724
-rw-r--r-- | saga/sfuncs.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp index e1e0450e89..19f2e13262 100644 --- a/saga/sfuncs.cpp +++ b/saga/sfuncs.cpp @@ -158,6 +158,10 @@ int Script::SF_takeObject(SCRIPTFUNC_PARAMS) { SDataWord_T param = thread->pop(); int index = param & 0x1FFF; + if (index >= ARRAYSIZE(ObjectTable)) { + return FAILURE; + } + if (ObjectTable[index].sceneIndex != -1) { ObjectTable[index].sceneIndex = -1; _vm->_interface->addToInventory(index); @@ -551,10 +555,26 @@ int Script::SF_sceneEq(SCRIPTFUNC_PARAMS) { // Script function #32 (0x20) int Script::SF_dropObject(SCRIPTFUNC_PARAMS) { - for (int i = 0; i < nArgs; i++) - thread->pop(); + SDataWord_T obj_param = thread->pop(); + SDataWord_T sprite_param = thread->pop(); + SDataWord_T x_param = thread->pop(); + SDataWord_T y_param = thread->pop(); + + int index = obj_param & 0x1FFF; + + if (index >= ARRAYSIZE(ObjectTable)) { + return FAILURE; + } + + if (ObjectTable[index].sceneIndex == -1) { + _vm->_interface->removeFromInventory(index); + } + + ObjectTable[index].sceneIndex = _vm->_scene->currentSceneNumber(); + ObjectTable[index].spritelistRn = 9 + sprite_param; + ObjectTable[index].x = x_param; + ObjectTable[index].y = y_param; - debug(1, "stub: SF_dropObject(), %d args", nArgs); return SUCCESS; } |