[Scummvm-cvs-logs] CVS: scummvm/simon simon.cpp,1.138,1.139 sound.cpp,1.9,1.10 sound.h,1.3,1.4

Travis Howell kirben at users.sourceforge.net
Sat Jan 11 18:02:02 CET 2003


Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1:/tmp/cvs-serv3327/simon

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

Add warning when voice files are missing in simon2amiga/mac
Work if voice file is missing in simon2amiga/mac


Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -d -r1.138 -r1.139
--- simon.cpp	11 Jan 2003 15:38:37 -0000	1.138
+++ simon.cpp	12 Jan 2003 02:01:04 -0000	1.139
@@ -90,6 +90,24 @@
 	"GSPTR30",									/* gamepc_filename */
 };
 
+static const GameSpecificSettings simon2mac_settings = {
+	5,										/* VGA_DELAY_BASE */
+	1580 / 4,									/* TABLE_INDEX_BASE */
+	1500 / 4,									/* TEXT_INDEX_BASE */
+	75,										/* NUM_VIDEO_OP_CODES */
+	2000000,									/* VGA_MEM_SIZE */
+	100000,										/* TABLES_MEM_SIZE */
+	1128 / 4,									/* MUSIC_INDEX_BASE */
+	1660 / 4,									/* SOUND_INDEX_BASE */
+	"Simon2.gme",									/* gme_filename */
+	"",										/* wav_filename */
+	"",										/* voc_filename */
+	"SIMON2.MP3",									/* mp3_filename */
+	"",										/* voc_effects_filename */
+	"",										/* mp3_effects_filename */
+	"gsptr30",									/* gamepc_filename */
+};
+
 static const GameSpecificSettings simon2dos_settings = {
 	5,										/* VGA_DELAY_BASE */
 	1580 / 4,									/* TABLE_INDEX_BASE */
@@ -4496,7 +4514,9 @@
 	_sdl_buf = (byte *)calloc(320 * 200, 1);
 	_sdl_buf_attached = (byte *)calloc(320 * 200, 1);
 
-	if (_game == GAME_SIMON2TALKIE || _game & GAME_SIMON2WIN) {
+	if (_game == GAME_SIMON2MAC) {
+		gss = &simon2mac_settings;
+	} else if (_game == GAME_SIMON2TALKIE || _game == GAME_SIMON2WIN) {
 		gss = &simon2win_settings;
 	} else if (_game == GAME_SIMON2DOS) {
 		gss = &simon2dos_settings;
@@ -4511,6 +4531,8 @@
 
 	setup_vga_file_buf_pointers();
 
+	_vk_t_toggle = true;
+
 	_sound = new SimonSound(_game, gss, _gameDataPath, _mixer);
 
 	loadGamePcFile(gss->gamepc_filename);
@@ -4535,7 +4557,7 @@
 	if (_sound->hasVoice()) {
 		_vk_t_toggle = false;
 	} else {
-		_vk_t_toggle = false;
+		_vk_t_toggle = true;
 	}
 
 	midi._midi_sfx_toggle = false;

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/sound.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- sound.cpp	11 Jan 2003 16:00:54 -0000	1.9
+++ sound.cpp	12 Jan 2003 02:01:07 -0000	1.10
@@ -37,6 +37,8 @@
 
 	_ambient_playing = 0;
 
+	_voice_file = false;
+
 	File *file = new File();
 	File *file2 = new File();
 	const char *s;
@@ -44,15 +46,20 @@
 	// for simon2 mac/amiga, only read index file
 	if (_game == GAME_SIMON2MAC) {
 		file->open("voices.idx", gameDataPath);
-		file->seek(0, SEEK_END);
-		int end = file->pos();
-		file->seek(0, SEEK_SET);
-		_filenums = (uint16 *)malloc(end / 3 + 1);
-		_offsets = (uint32 *)malloc((end / 6) * 4 + 1);
+		if (file->isOpen() == false) {
+			warning("Can't open voice index file 'voices.idx'");
+		} else {
+			file->seek(0, SEEK_END);
+			int end = file->pos();
+			file->seek(0, SEEK_SET);
+			_filenums = (uint16 *)malloc(end / 3 + 1);
+			_offsets = (uint32 *)malloc((end / 6) * 4 + 1);
 
-		for (int i = 1; i <= end / 6; i++) {
-			_filenums[i] = file->readUint16BE();
-			_offsets[i] = file->readUint32BE();
+			for (int i = 1; i <= end / 6; i++) {
+				_filenums[i] = file->readUint16BE();
+				_offsets[i] = file->readUint32BE();
+			}
+			_voice_file = true;
 		}
 	} else {
 #ifdef USE_MAD
@@ -63,21 +70,24 @@
 				s = gss->wav_filename;
 				file->open(s, gameDataPath);
 				if (file->isOpen() == false) {
-					warning("Cannot open voice file %s", s);
+					warning("Can't open voice file %s", s);
 				} else	{
+					_voice_file = true;
 					_voice = new WavSound(_mixer, file);
 				}
 			} else if (_game & GAME_TALKIE) {
 				s = gss->voc_filename;
 				file->open(s, gameDataPath);
 				if (file->isOpen() == false) {
-					warning("Cannot open voice file %s", s);
+					warning("Can't open voice file %s", s);
 				} else {
+					_voice_file = true;
 					_voice = new VocSound(_mixer, file);
 				}
 			}
 #ifdef USE_MAD
 		} else {
+			_voice_file = true;
 			_voice = new MP3Sound(_mixer, file);
 		}
 #endif
@@ -90,7 +100,7 @@
 				s = gss->voc_effects_filename;
 				file2->open(s, gameDataPath);
 				if (file2->isOpen() == false) {
-					warning("Cannot open effects file %s", s);
+					warning("Can't open effects file %s", s);
 				} else {
 					_effects = new VocSound(_mixer, file2);
 				}
@@ -119,7 +129,7 @@
 		free(filename2);
 		if (file->isOpen() == false) {
 			if (atoi(filename + 6) != 1 && atoi(filename + 6) != 30)
-			warning("readSfxFile: Cannot load sfx file %s", filename);
+			warning("readSfxFile: Can't load sfx file %s", filename);
 			return;
 		}
 	}
@@ -144,7 +154,11 @@
 		sprintf(filename, "voices%d.dat", _filenums[sound]);
 		File *file = new File();
 		file->open(filename, _gameDataPath);
-		_voice = new WavSound(_mixer, file, _offsets);
+		if (file->isOpen() == false) {
+			warning("Can't open voice file %s", filename);
+		} else {
+			_voice = new WavSound(_mixer, file, _offsets);
+		}
 	}
 
 	if (!_voice)
@@ -185,7 +199,7 @@
 
 bool SimonSound::hasVoice()
 {
-	return _voice != NULL;
+	return _voice_file;
 }
 
 void SimonSound::stopVoice()
@@ -237,7 +251,7 @@
 	_file->seek(base, SEEK_SET);
 
 	if (_file->read(_offsets, size) != size)
-		error("Cannot read offsets");
+		error("Can't read offsets");
 
 	for (uint i = 0; i < res; i++) {
 #if defined(SCUMM_BIG_ENDIAN)
@@ -331,7 +345,7 @@
 
 	if (_file->read(&voc_hdr, sizeof(voc_hdr)) != sizeof(voc_hdr) ||
 			strncmp((char *)voc_hdr.desc, "Creative Voice File\x1A", 10) != 0) {
-		error("playVoc(%d): cannot read voc header", sound);
+		error("playVoc(%d): can't read voc header", sound);
 	}
 
 	_file->read(&voc_block_hdr, sizeof(voc_block_hdr));
@@ -372,7 +386,7 @@
 			|| wave_hdr.fmt != MKID('fmt ') || READ_LE_UINT16(&wave_hdr.format_tag) != 1
 			|| READ_LE_UINT16(&wave_hdr.channels) != 1
 			|| READ_LE_UINT16(&wave_hdr.bits_per_sample) != 8) {
-		error("playWav(%d): cannot read RIFF header", sound);
+		error("playWav(%d): can't read RIFF header", sound);
 	}
 
 	_file->seek(FROM_LE_32(wave_hdr.size) - sizeof(wave_hdr) + 20, SEEK_CUR);
@@ -381,7 +395,7 @@
 	data[1] = _file->readUint32LE();
 	if (//fread(data, sizeof(data), 1, sound_file) != 1 ||
 			 data[0] != 'atad') {
-		error("playWav(%d): cannot read data header", sound);
+		error("playWav(%d): can't read data header", sound);
 	}
 
 	byte *buffer = (byte *)malloc(data[1]);

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/sound.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- sound.h	11 Jan 2003 16:00:55 -0000	1.3
+++ sound.h	12 Jan 2003 02:01:07 -0000	1.4
@@ -74,6 +74,7 @@
 	PlayingSoundHandle _effects_handle;
 	PlayingSoundHandle _ambient_handle;
 
+	bool _voice_file;
 	uint _ambient_playing;
 
 	SimonSound(const byte game, const GameSpecificSettings *gss, const char *gameDataPath, SoundMixer *mixer);





More information about the Scummvm-git-logs mailing list