aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorMax Horn2007-09-10 13:16:06 +0000
committerMax Horn2007-09-10 13:16:06 +0000
commit6419311a2e361c5e265ae3796ef425700694801f (patch)
tree4aa0c2976af553bbf1cac11f166a4c577de58f7f /engines/scumm
parenta8767a421da39db7eeb716772e33f8358e00390d (diff)
downloadscummvm-rg350-6419311a2e361c5e265ae3796ef425700694801f.tar.gz
scummvm-rg350-6419311a2e361c5e265ae3796ef425700694801f.tar.bz2
scummvm-rg350-6419311a2e361c5e265ae3796ef425700694801f.zip
Added some comments
svn-id: r28886
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/object.cpp45
1 files changed, 23 insertions, 22 deletions
diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp
index 2644a2faf8..c7d6b6583d 100644
--- a/engines/scumm/object.cpp
+++ b/engines/scumm/object.cpp
@@ -156,11 +156,14 @@ void ScummEngine::setOwnerOf(int obj, int owner) {
}
void ScummEngine::clearOwnerOf(int obj) {
- int i, j;
+ int i;
uint16 *a;
+ // Stop the associated object script code (else crashes might occurs)
stopObjectScript(obj);
+ // If the object is "owned" by a the current room, we scan the
+ // object list and (only if it's a floating object) nuke it.
if (getOwner(obj) == OF_OWNER_ROOM) {
for (i = 0; i < _numLocalObjects; i++) {
if (_objs[i].obj_nr == obj && _objs[i].fl_object_index) {
@@ -170,26 +173,28 @@ void ScummEngine::clearOwnerOf(int obj) {
_objs[i].fl_object_index = 0;
}
}
- return;
- }
-
- for (i = 0; i < _numInventory; i++) {
- if (_inventory[i] == obj) {
- j = whereIsObject(obj);
- if (j == WIO_INVENTORY) {
+ } else {
+
+ // Alternatively, scan the inventory to see if the object is in there...
+ for (i = 0; i < _numInventory; i++) {
+ if (_inventory[i] == obj) {
+ assert(WIO_INVENTORY == whereIsObject(obj));
+ // Found the object! Nuke it from the inventory.
_res->nukeResource(rtInventory, i);
_inventory[i] = 0;
- }
- a = _inventory;
- for (i = 0; i < _numInventory - 1; i++, a++) {
- if (!a[0] && a[1]) {
- a[0] = a[1];
- a[1] = 0;
- _res->address[rtInventory][i] = _res->address[rtInventory][i + 1];
- _res->address[rtInventory][i + 1] = NULL;
+
+ // Now fill up the gap removing the object from the inventory created.
+ a = _inventory;
+ for (i = 0; i < _numInventory - 1; i++, a++) {
+ if (!_inventory[i] && _inventory[i+1]) {
+ _inventory[i] = _inventory[i+1];
+ _inventory[i+1] = 0;
+ _res->address[rtInventory][i] = _res->address[rtInventory][i + 1];
+ _res->address[rtInventory][i + 1] = NULL;
+ }
}
+ break;
}
- return;
}
}
}
@@ -583,11 +588,7 @@ void ScummEngine::drawObject(int obj, int arg) {
return;
ptr = getOBIMFromObjectData(od);
-
- if (_game.features & GF_OLD_BUNDLE)
- ptr += 0;
- else
- ptr = getObjectImage(ptr, getState(od.obj_nr));
+ ptr = getObjectImage(ptr, getState(od.obj_nr));
if (!ptr)
return;