[Scummvm-cvs-logs] CVS: scummvm/scumm imuse.cpp,2.91,2.92 resource.cpp,1.159,1.160 saveload.cpp,1.109,1.110 saveload.h,1.23,1.24

Jamieson Christian jamieson630 at users.sourceforge.net
Sun Sep 14 13:36:02 CEST 2003


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

Modified Files:
	imuse.cpp resource.cpp saveload.cpp saveload.h 
Log Message:
Fix for Bug [805593] MI2: Music stops in LeChuck's fortress

Implemented _cmd_queue save/load. In addition to requiring
_cmd_queue information, this bug arises from a rare assumption
that sound resources are loaded in memory even though they
aren't currently playing. Therefore, a list of sound resources
loaded in memory is included in the savegame, so that all
relevant sound resources are reloaded when the savegame is
loaded. This also fixes an unreported music bug in S&M when
saving a game while outside the Bumpusville mansion.

As a result of savegame format modifications, we are now at
savegame version 23.

Index: imuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.cpp,v
retrieving revision 2.91
retrieving revision 2.92
diff -u -d -r2.91 -r2.92
--- imuse.cpp	8 Sep 2003 17:06:44 -0000	2.91
+++ imuse.cpp	14 Sep 2003 20:34:48 -0000	2.92
@@ -1287,7 +1287,11 @@
 		MKLINE(IMuseInternal, _trigger_count, sleUint16, VER(8)),
 		MKARRAY(IMuseInternal, _channel_volume[0], sleUint16, 8, VER(8)),
 		MKARRAY(IMuseInternal, _volchan_table[0], sleUint16, 8, VER(8)),
-		// TODO: Add _cmd_queue in here
+		MKEND()
+	};
+
+	const SaveLoadEntry cmdQueueEntries[] = {
+		MKARRAY(CommandQueue, array[0], sleUint16, 8, VER(23)),
 		MKEND()
 	};
 
@@ -1335,6 +1339,9 @@
 	ser->_load_ref = loadReference;
 
 	ser->saveLoadEntries(this, mainEntries);
+	ser->saveLoadArrayOf (_cmd_queue, ARRAYSIZE(_cmd_queue), sizeof(_cmd_queue[0]), cmdQueueEntries);
+
+	// The players
 	for (i = 0; i < ARRAYSIZE(_players); ++i)
 		_players[i].save_or_load(ser);
 	ser->saveLoadArrayOf(_parts, ARRAYSIZE(_parts), sizeof(_parts[0]), partEntries);

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -d -r1.159 -r1.160
--- resource.cpp	14 Sep 2003 15:03:12 -0000	1.159
+++ resource.cpp	14 Sep 2003 20:34:48 -0000	1.160
@@ -2131,7 +2131,7 @@
 								_numCostumes, "costume", 1);
 	allocResTypeData(rtRoom, MKID('ROOM'), _numRooms, "room", 1);
 	allocResTypeData(rtRoomScripts, MKID('RMSC'), _numRooms, "room script", 1);
-	allocResTypeData(rtSound, MKID('SOUN'), _numSounds, "sound", 1);
+	allocResTypeData(rtSound, MKID('SOUN'), _numSounds, "sound", 2);
 	allocResTypeData(rtScript, MKID('SCRP'), _numScripts, "script", 1);
 	allocResTypeData(rtCharset, MKID('CHAR'), _numCharsets, "charset", 1);
 	allocResTypeData(rtObjectName, MKID('NONE'), _numNewNames, "new name", 0);

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -d -r1.109 -r1.110
--- saveload.cpp	11 Sep 2003 10:32:14 -0000	1.109
+++ saveload.cpp	14 Sep 2003 20:34:48 -0000	1.110
@@ -600,7 +600,7 @@
 	// We should at least store for each save resource it's type and ID. Then at least
 	// we can perform some integrety checks when loading.
 	for (i = rtFirst; i <= rtLast; i++)
-		if (res.mode[i] == 0)
+		if (res.mode[i] != 1)
 			for (j = 1; j < res.num[i]; j++)
 				saveLoadResource(s, i, j);
 
@@ -684,32 +684,42 @@
 	uint32 size;
 
 	/* don't save/load these resource types */
-	if (type == rtTemp || type == rtBuffer || res.mode[type])
+	if (type == rtTemp || type == rtBuffer)
 		return;
 
-	if (ser->isSaving()) {
-		ptr = res.address[type][idx];
-		if (ptr == NULL) {
-			ser->saveUint32(0);
-			return;
-		}
+	if (!res.mode[type]) {
+		if (ser->isSaving()) {
+			ptr = res.address[type][idx];
+			if (ptr == NULL) {
+				ser->saveUint32(0);
+				return;
+			}
 
-		size = ((MemBlkHeader *)ptr)->size;
+			size = ((MemBlkHeader *)ptr)->size;
 
-		ser->saveUint32(size);
-		ser->saveBytes(ptr + sizeof(MemBlkHeader), size);
+			ser->saveUint32(size);
+			ser->saveBytes(ptr + sizeof(MemBlkHeader), size);
 
-		if (type == rtInventory) {
-			ser->saveWord(_inventory[idx]);
-		}
-	} else {
-		size = ser->loadUint32();
-		if (size) {
-			createResource(type, idx, size);
-			ser->loadBytes(getResourceAddress(type, idx), size);
 			if (type == rtInventory) {
-				_inventory[idx] = ser->loadWord();
+				ser->saveWord(_inventory[idx]);
 			}
+		} else {
+			size = ser->loadUint32();
+			if (size) {
+				createResource(type, idx, size);
+				ser->loadBytes(getResourceAddress(type, idx), size);
+				if (type == rtInventory) {
+					_inventory[idx] = ser->loadWord();
+				}
+			}
+		}
+	} else if (res.mode[type] == 2 && ser->getVersion() >= VER(23)) {
+		// Save/load only a list of resource numbers that need reloaded.
+		if (ser->isSaving()) {
+			ser->saveWord (res.address[type][idx] ? 1 : 0);
+		} else {
+			if (ser->loadWord())
+				ensureResourceLoaded (type, idx);
 		}
 	}
 }

Index: saveload.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- saveload.h	9 Sep 2003 17:29:21 -0000	1.23
+++ saveload.h	14 Sep 2003 20:34:48 -0000	1.24
@@ -28,7 +28,7 @@
 // Can be useful for other ports too :)
 
 #define VER(x) x
-#define CURRENT_VER 22
+#define CURRENT_VER 23
 
 // To work around a warning in GCC 3.2 (and 3.1 ?) regarding non-POD types,
 // we use a small trick: instead of 0 we use 42. Why? Well, it seems newer GCC





More information about the Scummvm-git-logs mailing list