[Scummvm-cvs-logs] CVS: scummvm saveload.cpp,1.42,1.43 scumm.h,1.151,1.152 scummsys.h,1.33,1.34 sound.cpp,1.77,1.78

James Brown ender at users.sourceforge.net
Sun May 5 10:45:02 CEST 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv2603

Modified Files:
	saveload.cpp scumm.h scummsys.h sound.cpp 
Log Message:
Add more Dig compatability, fix Dig sounds due to Endian.



Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saveload.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- saveload.cpp	23 Apr 2002 23:58:31 -0000	1.42
+++ saveload.cpp	5 May 2002 17:44:39 -0000	1.43
@@ -25,10 +25,6 @@
 #include "sound/mididrv.h"
 #include "sound/imuse.h"
 
-#ifdef _WIN32_WCE
-#define _MANAGE_OLD_SAVE
-#endif
-
 struct SaveGameHeader {
 	uint32 type;
 	uint32 size;
@@ -36,24 +32,17 @@
 	char name[32];
 };
 
-#ifdef _MANAGE_OLD_SAVE
-
 // Support for "old" savegames (made with 2501 CVS build)
 // Can be useful for other ports too :)
 
+#define VER_V9 9
 #define VER_V8 8
 #define VER_V7 7
 
-#define CURRENT_VER VER_V8
+#define CURRENT_VER VER_V9
 
 static uint32 _current_version = CURRENT_VER;
 
-#else
-
-#define CURRENT_VER 7
-
-#endif
-
 bool Scumm::saveState(int slot, bool compat)
 {
 	char filename[256];
@@ -70,17 +59,8 @@
 
 	hdr.type = MKID('SCVM');
 	hdr.size = 0;
-
-#ifdef _MANAGE_OLD_SAVE
-
 	hdr.ver = _current_version;
 
-#else
-
-	hdr.ver = CURRENT_VER;
-
-#endif
-
 	out.fwrite(&hdr, sizeof(hdr), 1);
 
 	ser._saveLoadStream = out;
@@ -111,26 +91,14 @@
 		out.fclose();
 		return false;
 	}
-#ifdef _MANAGE_OLD_SAVE
-
-	if (hdr.ver != VER_V8 && hdr.ver != VER_V7) {
-
-#else
-
-	if (hdr.ver != CURRENT_VER) {
-
-#endif
 
+	if (hdr.ver < VER_V7 || hdr.ver > _current_version) {
 		warning("Invalid version of '%s'", filename);
 		out.fclose();
 		return false;
 	}
-#ifdef _MANAGE_OLD_SAVE
 
 	_current_version = hdr.ver;
-
-#endif
-
 	memcpy(_saveLoadName, hdr.name, sizeof(hdr.name));
 
 	pauseSounds(true);
@@ -228,16 +196,8 @@
 		strcpy(desc, "Invalid savegame");
 		return false;
 	}
-#ifdef _MANAGE_OLD_SAVE
-
-	if (hdr.ver != VER_V8 && hdr.ver != VER_V7) {
-
-#else
-
-	if (hdr.ver != CURRENT_VER) {
-
-#endif
 
+	if (hdr.ver < VER_V8 || hdr.ver > _current_version) {
 		strcpy(desc, "Invalid version");
 		return false;
 	}
@@ -371,9 +331,7 @@
 		MKEND()
 	};
 
-#ifdef _MANAGE_OLD_SAVE
-
-	const SaveLoadEntry mainEntries1[] = {
+	const SaveLoadEntry mainEntriesV9[] = {
 		MKLINE(Scumm, _scrWidth, sleUint16),
 		MKLINE(Scumm, _scrHeight, sleUint16),
 		MKLINE(Scumm, _ENCD_offs, sleUint32),
@@ -393,10 +351,6 @@
 		MKARRAY(Scumm, charset._colorMap[0], sleByte, 16),
 		MKARRAY(Scumm, _charsetData[0][0], sleByte, 10 * 16),
 		MKLINE(Scumm, _curExecScript, sleUint16),
-		MKEND()
-	};
-
-	const SaveLoadEntry mainEntries2V8[] = {
 
 		MKLINE(Scumm, camera._dest.x, sleInt16),
 		MKLINE(Scumm, camera._dest.y, sleInt16),
@@ -413,24 +367,6 @@
 		MKLINE(Scumm, camera._leftTrigger, sleInt16),
 		MKLINE(Scumm, camera._rightTrigger, sleInt16),
 		MKLINE(Scumm, camera._movingToActor, sleUint16),
-		MKEND()
-	};
-
-	const SaveLoadEntry mainEntries2V7[] = {
-		MKLINE(Scumm, camera._dest.x, sleInt16),
-		MKLINE(Scumm, camera._cur.x, sleInt16),
-		MKLINE(Scumm, camera._last.x, sleInt16),
-		MKLINE(Scumm, _screenStartStrip, sleInt16),
-		MKLINE(Scumm, _screenEndStrip, sleInt16),
-		MKLINE(Scumm, camera._mode, sleByte),
-		MKLINE(Scumm, camera._follows, sleByte),
-		MKLINE(Scumm, camera._leftTrigger, sleInt16),
-		MKLINE(Scumm, camera._rightTrigger, sleInt16),
-		MKLINE(Scumm, camera._movingToActor, sleUint16),
-		MKEND()
-	};
-
-	const SaveLoadEntry mainEntries3[] = {
 
 		MKLINE(Scumm, _actorToPrintStrFor, sleByte),
 		MKLINE(Scumm, _charsetColor, sleByte),
@@ -467,7 +403,7 @@
 		MKLINE(Scumm, gdi._transparency, sleByte),
 		MKARRAY(Scumm, _currentPalette[0], sleByte, 768),
 
-
+		MKARRAY(Scumm, _proc_special_palette[0], sleByte, 256),
 		/* virtscr */
 
 		MKARRAY(Scumm, charset._buffer[0], sleByte, 256),
@@ -491,12 +427,15 @@
 		MKLINE(Scumm, _screenB, sleUint16),
 		MKLINE(Scumm, _screenH, sleUint16),
 
+		MKLINE(Scumm, _cd_track, sleInt16),
+		MKLINE(Scumm, _cd_loops, sleInt16),
+		MKLINE(Scumm, _cd_frame, sleInt16),		
+		MKLINE(Scumm, _cd_end, sleInt16),
+
 		MKEND()
 	};
 
-#else
-
-	const SaveLoadEntry mainEntries[] = {
+	const SaveLoadEntry mainEntriesV8[] = {
 		MKLINE(Scumm, _scrWidth, sleUint16),
 		MKLINE(Scumm, _scrHeight, sleUint16),
 		MKLINE(Scumm, _ENCD_offs, sleUint32),
@@ -511,7 +450,7 @@
 		MKLINE(Scumm, _numObjectsInRoom, sleByte),
 		MKLINE(Scumm, _currentScript, sleByte),
 		MKARRAY(Scumm, _localScriptList[0], sleUint32, NUM_LOCALSCRIPT),
-		MKARRAY(Scumm, vm.localvar[0][0], sleUint16, NUM_SCRIPT_SLOT * 17),
+		MKARRAY(Scumm, vm.localvar[0][0], sleUint16, 25 * 17),
 		MKARRAY(Scumm, _resourceMapper[0], sleByte, 128),
 		MKARRAY(Scumm, charset._colorMap[0], sleByte, 16),
 		MKARRAY(Scumm, _charsetData[0][0], sleByte, 10 * 16),
@@ -595,8 +534,6 @@
 		MKEND()
 	};
 
-#endif
-
 	const SaveLoadEntry scriptSlotEntries[] = {
 		MKLINE(ScriptSlot, offs, sleUint32),
 		MKLINE(ScriptSlot, delay, sleInt32),
@@ -662,35 +599,18 @@
 	int var120Backup;
 	int var98Backup;
 
-#ifdef _MANAGE_OLD_SAVE
-
-	s->saveLoadEntries(this, mainEntries1);
-	s->saveLoadEntries(this,
-										 (_current_version ==
-											VER_V8 ? mainEntries2V8 : mainEntries2V7));
-	s->saveLoadEntries(this, mainEntries3);
-
-#else
-
-	s->saveLoadEntries(this, mainEntries);
-
-#endif
-
-#ifdef _MANAGE_OLD_SAVE
-
-	// Probably not necessary anymore with latest NUM_ACTORS values
-
-	s->saveLoadArrayOf(actor, (_current_version == VER_V8 ? NUM_ACTORS : 13),
-										 sizeof(actor[0]), actorEntries);
-
-#else
+	if (_current_version == VER_V9) 
+		s->saveLoadEntries(this, mainEntriesV9);
+	else
+		s->saveLoadEntries(this, mainEntriesV8);
 
 	s->saveLoadArrayOf(actor, NUM_ACTORS, sizeof(actor[0]), actorEntries);
 
-#endif
-
-	s->saveLoadArrayOf(vm.slot, NUM_SCRIPT_SLOT, sizeof(vm.slot[0]),
-										 scriptSlotEntries);
+	if (_current_version < VER_V9) {
+		printf("Loading pre-v9\n");
+		s->saveLoadArrayOf(vm.slot, 25, sizeof(vm.slot[0]), scriptSlotEntries);
+	} else
+		s->saveLoadArrayOf(vm.slot, NUM_SCRIPT_SLOT, sizeof(vm.slot[0]), scriptSlotEntries);
 	s->saveLoadArrayOf(_objs, _numLocalObjects, sizeof(_objs[0]),
 										 objectEntries);
 	s->saveLoadArrayOf(_verbs, _numVerbs, sizeof(_verbs[0]), verbEntries);

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.151
retrieving revision 1.152
diff -u -d -r1.151 -r1.152
--- scumm.h	1 May 2002 17:16:45 -0000	1.151
+++ scumm.h	5 May 2002 17:44:39 -0000	1.152
@@ -52,7 +52,7 @@
 #endif
 	BITS_PER_SAMPLE = 16,
 	NUM_MIXER = 4,
-	NUM_SCRIPT_SLOT = 25,
+	NUM_SCRIPT_SLOT = 40,
 	NUM_LOCALSCRIPT = 60,
 	NUM_SHADOW_PALETTE = 8,
     MAX_ACTORS = 30,
@@ -966,7 +966,7 @@
 	bool _endOfMouthSync;
 	uint16 _mouthSyncTimes[52];
 	uint _curSoundPos;
-	int current_cd_sound;
+	int current_cd_sound, _cd_loops, _cd_frame, _cd_track, _cd_end;
 
 	int tempMusic;
 

Index: scummsys.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummsys.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- scummsys.h	30 Apr 2002 09:26:31 -0000	1.33
+++ scummsys.h	5 May 2002 17:44:39 -0000	1.34
@@ -258,6 +258,7 @@
 //#endif
 
 #define MKID(a) ((((a)>>24)&0xFF) | (((a)>>8)&0xFF00) | (((a)<<8)&0xFF0000) | (((a)<<24)&0xFF000000))
+#define MKID_BE(a) (a)
 
 #if defined(SCUMM_NEED_ALIGNMENT)
 	FORCEINLINE uint READ_LE_UINT16(void *ptr) {
@@ -307,6 +308,7 @@
 #elif defined(SCUMM_BIG_ENDIAN)
 
 #define MKID(a) (a)
+#define MKID_BE(a) ((((a)>>24)&0xFF) | (((a)>>8)&0xFF00) | (((a)<<8)&0xFF0000) | (((a)<<24)&0xFF000000))
 
 uint32 FORCEINLINE FROM_LE_32(uint32 a) {
 	return ((a>>24)&0xFF) + ((a>>8)&0xFF00) + ((a<<8)&0xFF0000) + ((a<<24)&0xFF000000);

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound.cpp,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- sound.cpp	5 May 2002 07:52:17 -0000	1.77
+++ sound.cpp	5 May 2002 17:44:39 -0000	1.78
@@ -693,7 +693,7 @@
 	int num = fileReadDwordBE(_sfxFile);
 	fileReadDwordBE(_sfxFile);	 fileReadDwordBE(_sfxFile);
 	
-	if (tag != MKID('COMP')) {
+	if (tag != MKID_BE('COMP')) {
 		warning("Compressed sound %d invalid (%c%c%c%c)", index, tag>>24, tag>>16, tag>>8, tag);
 		return;
 	}
@@ -763,24 +763,24 @@
 		byte *ptr = CompFinal;
 		int tag, size;
 		tag = READ_BE_UINT32(ptr); ptr+=4;
-		if (tag != MKID('iMUS')) {
+		if (tag != MKID_BE('iMUS')) {
 			warning("Decompression of bundle sound failed");
 			free(CompFinal);
 			return;
 		}
 
 		ptr+=12;       /* Skip header */
-		while(tag != MKID('DATA')) {
+		while(tag != MKID_BE('DATA')) {
 			tag = READ_BE_UINT32(ptr);  ptr+=4;
 			switch(tag) {
-				case MKID('FRMT'):
-				case MKID('TEXT'):
-				case MKID('REGN'):
-				case MKID('STOP'):
+				case MKID_BE('FRMT'):
+				case MKID_BE('TEXT'):
+				case MKID_BE('REGN'):
+				case MKID_BE('STOP'):
 					size = READ_BE_UINT32(ptr); ptr+=size+4;
 				break;
 
-				case MKID('DATA'):
+				case MKID_BE('DATA'):
 					size = READ_BE_UINT32(ptr); ptr+=4;
 				break;
 





More information about the Scummvm-git-logs mailing list