[Scummvm-cvs-logs] CVS: scummvm/simon debug.cpp,1.23,1.24 intern.h,1.22,1.23 simon.cpp,1.338,1.339 simon.h,1.100,1.101 sound.cpp,1.51,1.52 vga.cpp,1.90,1.91

Max Horn fingolfin at users.sourceforge.net
Sun Nov 30 16:46:01 CET 2003


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

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

Index: debug.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/debug.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- debug.cpp	8 Nov 2003 20:54:29 -0000	1.23
+++ debug.cpp	1 Dec 2003 00:45:16 -0000	1.24
@@ -183,7 +183,7 @@
 			opcode = *src++;
 		}
 
-		if (opcode >= gss->NUM_VIDEO_OP_CODES) {
+		if (opcode >= NUM_VIDEO_OP_CODES) {
 			error("Invalid opcode %x\n", opcode);
 			return;
 		}

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/intern.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- intern.h	12 Nov 2003 16:00:11 -0000	1.22
+++ intern.h	1 Dec 2003 00:45:16 -0000	1.23
@@ -119,14 +119,6 @@
 };
 
 struct GameSpecificSettings {
-	uint VGA_DELAY_BASE;
-	uint TABLE_INDEX_BASE;
-	uint TEXT_INDEX_BASE;
-	uint NUM_VIDEO_OP_CODES;
-	uint VGA_MEM_SIZE;
-	uint TABLES_MEM_SIZE;
-	uint MUSIC_INDEX_BASE;
-	uint SOUND_INDEX_BASE;
 #ifndef __PALM_OS__
 	const char *gme_filename;
 	const char *wav_filename;

Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.338
retrieving revision 1.339
diff -u -d -r1.338 -r1.339
--- simon.cpp	29 Nov 2003 10:12:47 -0000	1.338
+++ simon.cpp	1 Dec 2003 00:45:16 -0000	1.339
@@ -118,14 +118,6 @@
 #else
 #define PTR(a) &a
 static const GameSpecificSettings simon1_settings = {
-	1,										// VGA_DELAY_BASE
-	1576 / 4,									// TABLE_INDEX_BASE
-	1460 / 4,									// TEXT_INDEX_BASE
-	64,										// NUM_VIDEO_OP_CODES
-	1000000,									// VGA_MEM_SIZE
-	50000,										// TABLES_MEM_SIZE
-	1316 / 4,									// MUSIC_INDEX_BASE
-	0,										// SOUND_INDEX_BASE
 	"SIMON.GME",									// gme_filename
 	"SIMON.WAV",									// wav_filename
 	"SIMON.VOC",									// voc_filename
@@ -136,14 +128,6 @@
 };
 
 static const GameSpecificSettings simon1acorn_settings = {
-	1,										// VGA_DELAY_BASE
-	1576 / 4,									// TABLE_INDEX_BASE
-	1460 / 4,									// TEXT_INDEX_BASE
-	64,										// NUM_VIDEO_OP_CODES
-	1000000,									// VGA_MEM_SIZE
-	50000,										// TABLES_MEM_SIZE
-	1316 / 4,									// MUSIC_INDEX_BASE
-	0,										// SOUND_INDEX_BASE
 	"DATA",										// gme_filename
 	"",										// wav_filename
 	"SIMON",									// voc_filename
@@ -154,14 +138,6 @@
 };
 
 static const GameSpecificSettings simon1amiga_settings = {
-	1,										// VGA_DELAY_BASE
-	1576 / 4,									// TABLE_INDEX_BASE
-	1460 / 4,									// TEXT_INDEX_BASE
-	64,										// NUM_VIDEO_OP_CODES
-	1000000,									// VGA_MEM_SIZE
-	50000,										// TABLES_MEM_SIZE
-	1316 / 4,									// MUSIC_INDEX_BASE
-	0,										// SOUND_INDEX_BASE
 	"",										// gme_filename
 	"",										// wav_filename
 	"",										// voc_filename
@@ -172,14 +148,6 @@
 };
 
 static const GameSpecificSettings simon1demo_settings = {
-	1,										// VGA_DELAY_BASE
-	1576 / 4,									// TABLE_INDEX_BASE
-	1460 / 4,									// TEXT_INDEX_BASE
-	64,										// NUM_VIDEO_OP_CODES
-	1000000,									// VGA_MEM_SIZE
-	50000,										// TABLES_MEM_SIZE
-	1316 / 4,									// MUSIC_INDEX_BASE
-	0,										// SOUND_INDEX_BASE
 	"",										// gme_filename
 	"",										// wav_filename
 	"",										// voc_filename
@@ -190,14 +158,6 @@
 };
 
 static const GameSpecificSettings simon2win_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
 	"SIMON2.WAV",									// wav_filename
 	"SIMON2.VOC",									// voc_filename
@@ -208,14 +168,6 @@
 };
 
 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
@@ -226,14 +178,6 @@
 };
 
 static const GameSpecificSettings simon2dos_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
@@ -252,6 +196,26 @@
 	
 	_game = (byte)detector->_game.features;
 
+	if (_game & GF_SIMON2) {
+		VGA_DELAY_BASE = 5;
+		TABLE_INDEX_BASE = 1580 / 4;
+		TEXT_INDEX_BASE = 1500 / 4;
+		NUM_VIDEO_OP_CODES = 75;
+		VGA_MEM_SIZE = 2000000;
+		TABLES_MEM_SIZE = 100000;
+		MUSIC_INDEX_BASE = 1128 / 4;
+		SOUND_INDEX_BASE = 1660 / 4;
+	} else {
+		VGA_DELAY_BASE = 1;
+		TABLE_INDEX_BASE = 1576 / 4;
+		TEXT_INDEX_BASE = 1460 / 4;
+		NUM_VIDEO_OP_CODES = 64;
+		VGA_MEM_SIZE = 1000000;
+		TABLES_MEM_SIZE = 50000;
+		MUSIC_INDEX_BASE = 1316 / 4;
+		SOUND_INDEX_BASE = 0;
+	}
+
 	if (_game & GF_MAC)
 		gss = PTR(simon2mac_settings);
 	else if ((_game & GF_SIMON2) && (_game & GF_TALKIE))
@@ -259,7 +223,7 @@
 	else if (_game & GF_SIMON2)
 		gss = PTR(simon2dos_settings);
 	else if (_game & GF_ACORN)
-		gss =PTR(simon1acorn_settings);
+		gss = PTR(simon1acorn_settings);
 	else if (_game & GF_AMIGA)
 		gss = PTR(simon1amiga_settings);
 	else if (_game & GF_DEMO)
@@ -823,9 +787,9 @@
 }
 
 void SimonEngine::allocTablesHeap() {
-	_tablesheap_size = gss->TABLES_MEM_SIZE;
+	_tablesheap_size = TABLES_MEM_SIZE;
 	_tablesheap_curpos = 0;
-	_tablesheap_ptr = (byte *)calloc(gss->TABLES_MEM_SIZE, 1);
+	_tablesheap_ptr = (byte *)calloc(TABLES_MEM_SIZE, 1);
 }
 
 void SimonEngine::setItemUnk3(Item *item, int value) {
@@ -1148,7 +1112,7 @@
 					memcpy(filename, "SFXXXX", 6);
 					_sound->readSfxFile(filename, _gameDataPath);
 				} else if (_game & GF_SIMON2) {
-					_sound->loadSfxTable(_game_file, _game_offsets_ptr[atoi(filename + 6) - 1 + gss->SOUND_INDEX_BASE]);
+					_sound->loadSfxTable(_game_file, _game_offsets_ptr[atoi(filename + 6) - 1 + SOUND_INDEX_BASE]);
 				}
 
 				alignTableMem();
@@ -1216,7 +1180,7 @@
 	uint32 offs;
 	uint32 size;
 
-	res = atoi(filename + 4) + gss->TEXT_INDEX_BASE - 1;
+	res = atoi(filename + 4) + TEXT_INDEX_BASE - 1;
 	offs = _game_offsets_ptr[res];
 	size = _game_offsets_ptr[res + 1] - offs;
 
@@ -1229,7 +1193,7 @@
 	uint res;
 	uint32 offs;
 
-	res = atoi(filename + 6) + gss->TABLE_INDEX_BASE - 1;
+	res = atoi(filename + 6) + TABLE_INDEX_BASE - 1;
 	offs = _game_offsets_ptr[res];
 
 	_game_file->seek(offs, SEEK_SET);
@@ -2194,13 +2158,13 @@
 void SimonEngine::setup_vga_file_buf_pointers() {
 	byte *alloced;
 
-	alloced = (byte *)malloc(gss->VGA_MEM_SIZE);
+	alloced = (byte *)malloc(VGA_MEM_SIZE);
 
 	_vga_buf_free_start = alloced;
 	_vga_buf_start = alloced;
 	_vga_file_buf_org = alloced;
 	_vga_file_buf_org_2 = alloced;
-	_vga_buf_end = alloced + gss->VGA_MEM_SIZE;
+	_vga_buf_end = alloced + VGA_MEM_SIZE;
 }
 
 void SimonEngine::vga_buf_unk_proc3(byte *end) {
@@ -3756,7 +3720,7 @@
 	}
 }
 
-void decompress_icon(byte *dst, byte *src, uint w, uint h_org, byte base, uint pitch) {
+static void decompress_icon(byte *dst, byte *src, uint w, uint h_org, byte base, uint pitch) {
 	int8 reps;
 	byte color_1, color_2;
 	byte *dst_org = dst;
@@ -3948,7 +3912,7 @@
 
 			//dump_vga_script(pp + READ_BE_UINT16(&((VgaFile1Struct0x6*)p)->script_offs), vga_res, vga_sprite_id);
 
-			add_vga_timer(gss->VGA_DELAY_BASE, pp + READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->script_offs), vga_sprite_id, vga_res);
+			add_vga_timer(VGA_DELAY_BASE, pp + READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->script_offs), vga_sprite_id, vga_res);
 			break;
 		}
 		p += sizeof(VgaFile1Struct0x6);
@@ -4041,7 +4005,7 @@
 		_variableArray[85] = _variableArray[141] * len_div_3;
 	} else {
 		if (_variableArray[86] == 0)
-			len_div_3 = len_div_3 / 2;
+			len_div_3 >>= 1;
 		if (_variableArray[86] == 2)
 			len_div_3 <<= 1;
 		_variableArray[85] = len_div_3 * 5;
@@ -5066,7 +5030,7 @@
 void SimonEngine::loadMusic (uint music) {
 	if (_game & GF_SIMON2) {        // Simon 2 music
 		midi.stop();
-		_game_file->seek(_game_offsets_ptr[gss->MUSIC_INDEX_BASE + music - 1], SEEK_SET);
+		_game_file->seek(_game_offsets_ptr[MUSIC_INDEX_BASE + music - 1], SEEK_SET);
 		if (_game & GF_WIN) {	
 			midi.loadMultipleSMF (_game_file);
 		} else {
@@ -5096,10 +5060,10 @@
 				if (music == 35)
 					midi.setLoop (false);
 
-				_game_file->seek(_game_offsets_ptr[gss->MUSIC_INDEX_BASE + music], SEEK_SET);
+				_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[gss->MUSIC_INDEX_BASE + music], SEEK_SET);
+				_game_file->seek(_game_offsets_ptr[MUSIC_INDEX_BASE + music], SEEK_SET);
 				midi.loadSMF (_game_file, music);
 			} else {
 				char buf[50];

Index: simon.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.h,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -d -r1.100 -r1.101
--- simon.h	10 Nov 2003 01:04:11 -0000	1.100
+++ simon.h	1 Dec 2003 00:45:16 -0000	1.101
@@ -114,6 +114,14 @@
 
 	uint32 *_game_offsets_ptr;
 
+	uint VGA_DELAY_BASE;
+	uint TABLE_INDEX_BASE;
+	uint TEXT_INDEX_BASE;
+	uint NUM_VIDEO_OP_CODES;
+	uint VGA_MEM_SIZE;
+	uint TABLES_MEM_SIZE;
+	uint MUSIC_INDEX_BASE;
+	uint SOUND_INDEX_BASE;
 	const GameSpecificSettings *gss;
 
 	byte _game;

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/sound.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- sound.cpp	29 Nov 2003 11:56:24 -0000	1.51
+++ sound.cpp	1 Dec 2003 00:45:16 -0000	1.52
@@ -261,7 +261,7 @@
 		_voice = new MP3Sound(_mixer, file);
 	}
 #endif
-	if (!file->isOpen()) {
+	if (!_voice) {
 		// for simon2 mac/amiga, only read index file
 		if (_game == GAME_SIMON2MAC) {
 			file->open("voices.idx", gameDataPath);
@@ -315,7 +315,7 @@
 			_effects = new MP3Sound(_mixer, file);
 		}
 #endif
-		if (!file->isOpen()) {
+		if (!_effects) {
 			s = gss->voc_effects_filename;
 			file->open(s, gameDataPath);
 			if (file->isOpen() == false) {

Index: vga.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/vga.cpp,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- vga.cpp	8 Nov 2003 20:54:31 -0000	1.90
+++ vga.cpp	1 Dec 2003 00:45:16 -0000	1.91
@@ -128,7 +128,7 @@
 			opcode = *_vc_ptr++;
 		}
 
-		if (opcode >= gss->NUM_VIDEO_OP_CODES)
+		if (opcode >= NUM_VIDEO_OP_CODES)
 			error("Invalid VGA opcode '%d' encountered", opcode);
 
 		if (opcode == 0)
@@ -349,7 +349,7 @@
 
 	//dump_vga_script(_cur_vga_file_1 + READ_BE_UINT16(&((VgaFile1Struct0x6*)p)->script_offs), res, vga_sprite_id);
 
-	add_vga_timer(gss->VGA_DELAY_BASE, _cur_vga_file_1 + READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->script_offs), vga_sprite_id, res);
+	add_vga_timer(VGA_DELAY_BASE, _cur_vga_file_1 + READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->script_offs), vga_sprite_id, res);
 	_cur_vga_file_1 = old_file_1;
 }
 
@@ -1011,9 +1011,9 @@
 	}
 
 	if (_continous_vgascript)
-		fprintf(_dump_file, "; sleep_ex = %d\n", num + gss->VGA_DELAY_BASE);
+		fprintf(_dump_file, "; sleep_ex = %d\n", num + VGA_DELAY_BASE);
 
-	add_vga_timer(num + gss->VGA_DELAY_BASE, _vc_ptr, _vga_cur_sprite_id, _vga_cur_file_id);
+	add_vga_timer(num + VGA_DELAY_BASE, _vc_ptr, _vga_cur_sprite_id, _vga_cur_file_id);
 	_vc_ptr = (byte *)&vc_get_out_of_code;
 }
 
@@ -1034,7 +1034,7 @@
 	uint16 id = vc_read_next_word();
 	while (vfs->ident != 0) {
 		if (vfs->ident == id) {
-			add_vga_timer(gss->VGA_DELAY_BASE, vfs->code_ptr, vfs->sprite_id, vfs->cur_vga_file);
+			add_vga_timer(VGA_DELAY_BASE, vfs->code_ptr, vfs->sprite_id, vfs->cur_vga_file);
 			vfs_tmp = vfs;
 			do {
 				memcpy(vfs_tmp, vfs_tmp + 1, sizeof(VgaSleepStruct));
@@ -1584,9 +1584,9 @@
 		uint num = vc_read_var_or_word() * _vga_base_delay;
 
 		if (_continous_vgascript)
-			fprintf(_dump_file, "; sleep_ex = %d\n", num + gss->VGA_DELAY_BASE);
+			fprintf(_dump_file, "; sleep_ex = %d\n", num + VGA_DELAY_BASE);
 
-		add_vga_timer(num + gss->VGA_DELAY_BASE, _vc_ptr, _vga_cur_sprite_id, _vga_cur_file_id);
+		add_vga_timer(num + VGA_DELAY_BASE, _vc_ptr, _vga_cur_sprite_id, _vga_cur_file_id);
 		_vc_ptr = (byte *)&vc_get_out_of_code;
 	}
 }





More information about the Scummvm-git-logs mailing list