[Scummvm-cvs-logs] CVS: scummvm/scumm imuse.cpp,2.5,2.6 instrument.cpp,2.5,2.6 saveload.h,1.6,1.7

Jamieson Christian jamieson630 at users.sourceforge.net
Sat Dec 21 12:11:22 CET 2002


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

Modified Files:
	imuse.cpp instrument.cpp saveload.h 
Log Message:
Implemented new instrumentation save/load.
Save/load version is now VER_V11.
Adlib/MT-32 instrumentation is now saved and loaded.
BACK UP YOUR VER_V10 SAVEGAMES, JUST IN CASE!

Index: imuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.cpp,v
retrieving revision 2.5
retrieving revision 2.6
diff -u -d -r2.5 -r2.6
--- imuse.cpp	20 Dec 2002 13:09:01 -0000	2.5
+++ imuse.cpp	21 Dec 2002 20:10:47 -0000	2.6
@@ -3127,6 +3127,17 @@
 	ser->saveLoadEntries(this, mainEntries);
 	ser->saveLoadArrayOf(_players, ARRAYSIZE(_players), sizeof(_players[0]), playerEntries);
 	ser->saveLoadArrayOf(_parts, ARRAYSIZE(_parts), sizeof(_parts[0]), partEntries);
+
+	// Load/save the instrument definitions, which were revamped with V11.
+	if (ser->getVersion() >= VER_V11) {
+		int i;
+		Part *part = &_parts[0];
+		for (i = ARRAYSIZE(_parts); i; --i, ++part) {
+			part->_program = 255;
+			part->_instrument.saveOrLoad (ser);
+		}
+	}
+
 	ser->saveLoadArrayOf(_volume_fader, ARRAYSIZE(_volume_fader),
 		                 sizeof(_volume_fader[0]), volumeFaderEntries);
 
@@ -3170,18 +3181,6 @@
 			scumm->getResourceAddress(rtSound, player->_id);
 			player->_mt32emulate = isMT32(player->_id);
 			player->_isGM = isGM(player->_id);
-			if (scumm->_use_adlib) {
-				// FIXME - This should make sure the right
-				// instruments are loaded, but it does not
-				// even try to move to the right position in
-				// the track. Using scan() gives a marginally
-				// better result, but not good enough.
-				//
-				// The correct fix is probably to store the
-				// Adlib instruments, or information on where
-				// to find them, in the savegame.
-				player->jump(player->_track_index, 0, 0);
-			}
 		}
 	}
 }

Index: instrument.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/instrument.cpp,v
retrieving revision 2.5
retrieving revision 2.6
diff -u -d -r2.5 -r2.6
--- instrument.cpp	20 Dec 2002 13:09:01 -0000	2.5
+++ instrument.cpp	21 Dec 2002 20:10:47 -0000	2.6
@@ -330,8 +330,13 @@
 
 void Instrument_Program::saveOrLoad (Serializer *s)
 {
-	_program = s->loadByte();
-	_mt32 = (s->loadByte() > 0);
+	if (s->isSaving()) {
+		s->saveByte (_program);
+		s->saveByte (_mt32 ? 1 : 0);
+	} else {
+		_program = s->loadByte();
+		_mt32 = (s->loadByte() > 0);
+	}
 }
 
 void Instrument_Program::send (MidiChannel *mc)

Index: saveload.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- saveload.h	17 Dec 2002 01:15:13 -0000	1.6
+++ saveload.h	21 Dec 2002 20:10:47 -0000	1.7
@@ -25,12 +25,13 @@
 // Support for "old" savegames (made with 2501 CVS build)
 // Can be useful for other ports too :)
 
+#define VER_V11 11
 #define VER_V10 10
 #define VER_V9 9
 #define VER_V8 8
 #define VER_V7 7
 
-#define CURRENT_VER VER_V10
+#define CURRENT_VER VER_V11
 
 
 // To work around a warning in GCC 3.2 (and 3.1 ?) regarding non-POD types,
@@ -105,6 +106,7 @@
 	void saveLoadEntries(void *d, const SaveLoadEntry *sle);
 
 	bool isSaving() { return _saveOrLoad; }
+	uint32 getVersion() { return _savegameVersion; }
 
 	bool checkEOFLoadStream();
 





More information about the Scummvm-git-logs mailing list