aboutsummaryrefslogtreecommitdiff
path: root/scumm/object.cpp
diff options
context:
space:
mode:
authorJames Brown2003-01-26 10:57:01 +0000
committerJames Brown2003-01-26 10:57:01 +0000
commitd1eb2636f4b17e261a886e93b2da6fbb5008eb0a (patch)
tree337955100e66e8e2578408d293899b51d187e9e0 /scumm/object.cpp
parent8d9b84b98eb92abbf4d932d6c6e10a10e0fe576b (diff)
downloadscummvm-rg350-d1eb2636f4b17e261a886e93b2da6fbb5008eb0a.tar.gz
scummvm-rg350-d1eb2636f4b17e261a886e93b2da6fbb5008eb0a.tar.bz2
scummvm-rg350-d1eb2636f4b17e261a886e93b2da6fbb5008eb0a.zip
Patch 671031: Fix for MI1 intro crash + others (move new object
clearing code into a more generic function, and call it earlier) svn-id: r6548
Diffstat (limited to 'scumm/object.cpp')
-rw-r--r--scumm/object.cpp52
1 files changed, 29 insertions, 23 deletions
diff --git a/scumm/object.cpp b/scumm/object.cpp
index 488fe70efc..2192a81c13 100644
--- a/scumm/object.cpp
+++ b/scumm/object.cpp
@@ -410,6 +410,35 @@ void Scumm::drawObject(int obj, int arg)
}
}
+void Scumm::clearRoomObjects()
+{
+ int i;
+
+ if (_features & GF_SMALL_HEADER) {
+ for (i = 0; i < _numLocalObjects; i++) {
+ _objs[i].obj_nr = 0;
+ }
+ } else {
+ // FIXME: Locking/FlObjects stuff?
+ for (i = 0; i < _numLocalObjects; i++) {
+ if (_objs[i].obj_nr < 1) // Optimise codepath
+ continue;
+
+ // Nuke all non-flObjects (flObjects are nuked in script.cpp)
+ if (_objs[i].fl_object_index == 0) {
+ _objs[i].obj_nr = 0;
+ } else {
+ // Nuke all unlocked flObjects
+ if (!(res.flags[rtFlObject][_objs[i].fl_object_index] & RF_LOCK)) {
+ nukeResource(rtFlObject, _objs[i].fl_object_index);
+ _objs[i].obj_nr = 0;
+ _objs[i].fl_object_index = 0;
+ }
+ }
+ }
+ }
+}
+
void Scumm::loadRoomObjects()
{
int i, j;
@@ -432,24 +461,6 @@ void Scumm::loadRoomObjects()
else
_numObjectsInRoom = READ_LE_UINT16(&(roomhdr->old.numObjects));
- // Clear out old room objects (FIXME: Locking/FlObjects stuff?)
- for (i = 0; i < _numLocalObjects; i++) {
- if (_objs[i].obj_nr < 1) // Optimise codepath
- continue;
-
- // Nuke all non-flObjects (flObjects are nuked in script.cpp)
- if (_objs[i].fl_object_index == 0) {
- _objs[i].obj_nr = 0;
- } else {
- // Nuke all unlocked flObjects
- if (!(res.flags[rtFlObject][_objs[i].fl_object_index] & RF_LOCK)) {
- nukeResource(rtFlObject, _objs[i].fl_object_index);
- _objs[i].obj_nr = 0;
- _objs[i].fl_object_index = 0;
- }
- }
- }
-
if (_numObjectsInRoom == 0)
return;
@@ -544,11 +555,6 @@ void Scumm::loadRoomObjectsSmall()
if (_numObjectsInRoom > _numLocalObjects)
error("More than %d objects in room %d", _numLocalObjects, _roomResource);
- // Clear out old room objects
- for (i = 0; i < _numLocalObjects; i++) {
- _objs[i].obj_nr = 0;
- }
-
searchptr = room;
for (i = 0; i < _numObjectsInRoom; i++) {
od = &_objs[findLocalObjectSlot()];