[Scummvm-cvs-logs] CVS: scummvm/scumm object.cpp,1.60,1.61 scumm.h,1.139,1.140 scummvm.cpp,2.46,2.47

James Brown ender at users.sourceforge.net
Sun Jan 26 02:58:02 CET 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv24092/scumm

Modified Files:
	object.cpp scumm.h scummvm.cpp 
Log Message:
Patch 671031: Fix for MI1 intro crash + others (move new object 
clearing code into a more generic function, and call it earlier)


Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/object.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- object.cpp	18 Jan 2003 14:16:55 -0000	1.60
+++ object.cpp	26 Jan 2003 10:57:01 -0000	1.61
@@ -410,6 +410,35 @@
 	}
 }
 
+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 @@
 	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;
 
@@ -543,11 +554,6 @@
 
 	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++) {

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -d -r1.139 -r1.140
--- scumm.h	24 Jan 2003 06:41:10 -0000	1.139
+++ scumm.h	26 Jan 2003 10:57:01 -0000	1.140
@@ -532,6 +532,7 @@
 	bool isResourceInUse(int type, int i);
 	bool isResourceLoaded(int type, int index);
 	void initRoomSubBlocks();
+	void clearRoomObjects();
 	void loadRoomObjects();
 	void loadRoomObjectsSmall();
 	void readArrayFromIndexFile();

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.46
retrieving revision 2.47
diff -u -d -r2.46 -r2.47
--- scummvm.cpp	26 Jan 2003 06:17:25 -0000	2.46
+++ scummvm.cpp	26 Jan 2003 10:57:01 -0000	2.47
@@ -652,6 +652,8 @@
 	if (room != 0)
 		ensureResourceLoaded(rtRoom, room);
 
+	clearRoomObjects();
+
 	if (_currentRoom == 0) {
 		_ENCD_offs = _EXCD_offs = 0;
 		_numObjectsInRoom = 0;





More information about the Scummvm-git-logs mailing list