[Scummvm-cvs-logs] CVS: scummvm/simon intern.h,1.33,1.34 simon.cpp,1.489,1.490 sound.cpp,1.76,1.77 vga.cpp,1.122,1.123

kirben kirben at users.sourceforge.net
Thu May 5 20:11:25 CEST 2005


Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3368/simon

Modified Files:
	intern.h simon.cpp sound.cpp vga.cpp 
Log Message:

Auto detect music and voice types, where possible.
Use correct set of MIDI tracks for MT32 in Simon the Sorcerer 2.


Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/intern.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- intern.h	1 Jan 2005 16:09:19 -0000	1.33
+++ intern.h	6 May 2005 03:09:50 -0000	1.34
@@ -149,26 +149,27 @@
 } // End of namespace Simon
 
 enum {
-	GF_SIMON2     = 1 << 0,
-	GF_WIN        = 1 << 1,
-	GF_TALKIE     = 1 << 2,
-	GF_DEMO       = 1 << 3,
-	GF_AMIGA      = 1 << 4,
-	GF_ACORN      = 1 << 5,
-	GF_OLD_BUNDLE = 1 << 6
+	GF_SIMON1     = 1 << 0,
+	GF_SIMON2     = 1 << 1,
+	GF_WIN        = 1 << 2,
+	GF_TALKIE     = 1 << 3,
+	GF_DEMO       = 1 << 4,
+	GF_AMIGA      = 1 << 5,
+	GF_ACORN      = 1 << 6,
+	GF_OLD_BUNDLE = 1 << 7
 };
 
 enum {
-	GAME_SIMON1DOS = GF_OLD_BUNDLE,
+	GAME_SIMON1DOS = GF_SIMON1 | GF_OLD_BUNDLE,
 	GAME_SIMON2DOS = GF_SIMON2,
-	GAME_SIMON1TALKIE = GF_TALKIE,
+	GAME_SIMON1TALKIE = GF_SIMON1 | GF_TALKIE,
 	GAME_SIMON2TALKIE = GF_SIMON2 | GF_TALKIE,
-	GAME_SIMON1WIN = GF_WIN | GF_TALKIE,
+	GAME_SIMON1WIN = GF_SIMON1 | GF_WIN | GF_TALKIE,
 	GAME_SIMON2WIN = GF_SIMON2 | GF_WIN | GF_TALKIE,
-	GAME_SIMON1DEMO = GF_DEMO | GF_OLD_BUNDLE,
-	GAME_SIMON1AMIGA = GF_AMIGA | GF_OLD_BUNDLE,
-	GAME_SIMON1CD32 = GF_TALKIE | GF_AMIGA | GF_OLD_BUNDLE,
-	GAME_SIMON1ACORN = GF_TALKIE | GF_ACORN
+	GAME_SIMON1DEMO = GF_SIMON1 | GF_DEMO | GF_OLD_BUNDLE,
+	GAME_SIMON1AMIGA = GF_SIMON1 | GF_AMIGA | GF_OLD_BUNDLE,
+	GAME_SIMON1CD32 = GF_SIMON1 | GF_TALKIE | GF_AMIGA | GF_OLD_BUNDLE,
+	GAME_SIMON1ACORN = GF_SIMON1 | GF_TALKIE | GF_ACORN
 };
 
 #endif

Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.489
retrieving revision 1.490
diff -u -d -r1.489 -r1.490
--- simon.cpp	24 Apr 2005 12:21:52 -0000	1.489
+++ simon.cpp	6 May 2005 03:09:51 -0000	1.490
@@ -345,7 +345,8 @@
 		VGA_MEM_SIZE = gVars->memory[kMemSimon2Games];
 #endif
 		TABLES_MEM_SIZE = 100000;
-		if ((_game & GF_SIMON2) && ConfMan.getBool("native_mt32"))
+		// Check whether to use MT-32 MIDI tracks in Simon the Sorcerer 2
+		if ((_game & GF_SIMON2) && (ConfMan.getBool("native_mt32") || (_midiDriver == MD_MT32)))
 			MUSIC_INDEX_BASE = (1128 + 612) / 4;
 		else
 			MUSIC_INDEX_BASE = 1128 / 4;
@@ -4152,60 +4153,68 @@
 }
 
 void SimonEngine::loadMusic (uint music) {
-	if (_game & GF_SIMON2) {        // Simon 2 music
+	char buf[4];
+
+	if (_game & GF_AMIGA) {
+		if (_game != GAME_SIMON1CD32) {
+			// TODO Add support for decruncher
+			debug(5,"loadMusic - Decrunch %dtune attempt", music);
+		}
+		// TODO Add Protracker support for simon1amiga/cd32
+		debug(5,"playMusic - Load %dtune attempt", music);
+	} else if (_game & GF_SIMON2) {        // Simon 2 music
 		midi.stop();
 		_game_file->seek(_game_offsets_ptr[MUSIC_INDEX_BASE + music - 1], SEEK_SET);
-		if (_game & GF_WIN && !(ConfMan.getBool("native_mt32") && (_midiDriver != MD_MT32))) {
-			midi.loadMultipleSMF (_game_file);
-		} else {
+		_game_file->read(buf, 4);
+		if (!memcmp(buf, "FORM", 4)) {
+			_game_file->seek(_game_offsets_ptr[MUSIC_INDEX_BASE + music - 1], SEEK_SET);
 			midi.loadXMIDI (_game_file);
+		} else {
+			_game_file->seek(_game_offsets_ptr[MUSIC_INDEX_BASE + music - 1], SEEK_SET);
+			midi.loadMultipleSMF (_game_file);
 		}
 
 		_last_music_played = music;
 		_next_music_to_play = -1;
-	} else { // Simon 1 music
-		if (_game & GF_AMIGA) {
-			if (_game != GAME_SIMON1CD32) {
-				// TODO Add support for decruncher
-				debug(5,"loadMusic - Decrunch %dtune attempt", music);
-			}
-			// TODO Add Protracker support for simon1amiga/cd32
-			debug(5,"playMusic - Load %dtune attempt", music);
-		} else {
-			midi.stop();
-			midi.setLoop (true); // Must do this BEFORE loading music. (GMF may have its own override.)
+	} else if (_game & GF_SIMON1) {        // Simon 1 music
+		midi.stop();
+		midi.setLoop (true); // Must do this BEFORE loading music. (GMF may have its own override.)
 
-			if (_game & GF_WIN) {	
-				// FIXME: The very last music resource, a cymbal crash for when the
-				// two demons crash into each other, should NOT be looped like the 
-				// other music tracks. In simon1dos/talkie the GMF resource includes 
-				// a loop override that acomplishes this, but there seems to be nothing 
-				// for this in the SMF resources.
-				if (music == 35)
-					midi.setLoop (false);
+		if (_game & GF_TALKIE) {	
+			// FIXME: The very last music resource, a cymbal crash for when the
+			// two demons crash into each other, should NOT be looped like the 
+			// other music tracks. In simon1dos/talkie the GMF resource includes 
+			// a loop override that acomplishes this, but there seems to be nothing 
+			// for this in the SMF resources.
+			if (music == 35)
+				midi.setLoop (false);
 
-				_game_file->seek(_game_offsets_ptr[MUSIC_INDEX_BASE + music], SEEK_SET);
-				midi.loadMultipleSMF (_game_file);
-			} else if (_game & GF_TALKIE) {	
+			_game_file->seek(_game_offsets_ptr[MUSIC_INDEX_BASE + music], SEEK_SET);
+			_game_file->read(buf, 4);
+			if (!memcmp(buf, "GMF\x1", 4)) {
 				_game_file->seek(_game_offsets_ptr[MUSIC_INDEX_BASE + music], SEEK_SET);
 				midi.loadSMF (_game_file, music);
 			} else {
-				char buf[15];
-				File f;
-				sprintf(buf, "MOD%d.MUS", music);
-				f.open(buf);
-				if (f.isOpen() == false) {
-					warning("Can't load music from '%s'", buf);
-					return;
-				}
-				if (_game & GF_DEMO)
-					midi.loadS1D (&f);
-				else
-					midi.loadSMF (&f, music);
+				_game_file->seek(_game_offsets_ptr[MUSIC_INDEX_BASE + music], SEEK_SET);
+				midi.loadMultipleSMF (_game_file);
 			}
 
-			midi.startTrack (0);
+		} else {
+			char filename[15];
+			File f;
+			sprintf(filename, "MOD%d.MUS", music);
+			f.open(filename);
+			if (f.isOpen() == false) {
+				warning("Can't load music from '%s'", filename);
+				return;
+			}
+			if (_game & GF_DEMO)
+				midi.loadS1D (&f);
+			else
+				midi.loadSMF (&f, music);
 		}
+
+		midi.startTrack (0);
 	}
 }
 

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/sound.cpp,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- sound.cpp	12 Mar 2005 18:55:46 -0000	1.76
+++ sound.cpp	6 May 2005 03:09:52 -0000	1.77
@@ -244,6 +244,11 @@
 	_voice_file = false;
 	_ambient_playing = 0;
 
+	if (_game == GAME_SIMON1CD32) {
+		// Uses separate voice files
+		return;
+	}
+
 	File *file = new File();
 	const char *s;
 
@@ -274,7 +279,7 @@
 		}
 	}
 #endif
-	if (!_voice) {
+	if (!_voice && (_game & GF_SIMON2)) {
 		// for simon2 mac/amiga, only read index file
 		file->open("voices.idx");
 		if (file->isOpen() == true) {
@@ -287,27 +292,26 @@
 			for (int i = 1; i <= end / 6; i++) {
 				_filenums[i] = file->readUint16BE();
 				_offsets[i] = file->readUint32BE();
-			}
-			_voice_file = true;
-			delete file;
-		} else if (_game & GF_WIN) {
+		}
+		_voice_file = true;
+		delete file;
+	}
+	if (!_voice && gss->wav_filename && gss->wav_filename[0]) {
 			s = gss->wav_filename;
 			file->open(s);
 			if (file->isOpen() == false) {
-				warning("Can't open voice file %s", s);
+				debug(0, "Can't open voice file %s", s);
 				delete file;
 			} else	{
 				_voice_file = true;
 				_voice = new WavSound(_mixer, file);
 			}
-		} else if (_game == GAME_SIMON1CD32) {
-			// simon1cd32 uses separate voice files
-			return;
-		} else if (_game & GF_TALKIE) {
+	}
+	if (!_voice && gss->voc_filename && gss->voc_filename[0]) {
 			s = gss->voc_filename;
 			file->open(s);
 			if (file->isOpen() == false) {
-				warning("Can't open voice file %s", s);
+				debug(0, "Can't open voice file %s", s);
 				delete file;
 			} else {
 				_voice_file = true;
@@ -316,7 +320,7 @@
 		}
 	}
 
-	if (_game == GAME_SIMON1ACORN || _game == GAME_SIMON1TALKIE) {
+	if ((_game & GF_SIMON1) && (_game & GF_TALKIE)) {
 		file = new File();
 #ifdef USE_MAD
 		if (!_effects && gss->mp3_effects_filename && gss->mp3_effects_filename[0]) {

Index: vga.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/vga.cpp,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -d -r1.122 -r1.123
--- vga.cpp	12 Mar 2005 18:56:04 -0000	1.122
+++ vga.cpp	6 May 2005 03:09:53 -0000	1.123
@@ -1024,7 +1024,7 @@
 
 	// Work around to allow inventory arrows to be
 	// shown in some versions of Simon the Sorcerer 1
-	if (!(_game & GF_SIMON2) && !(_game & GF_WIN) && vsp->id == 0x80)
+	if ((_game & GF_SIMON1) && vsp->id == 0x80)
 		num = 0;
 	else
 		num += VGA_DELAY_BASE;





More information about the Scummvm-git-logs mailing list