[Scummvm-cvs-logs] CVS: scummvm/simon items.cpp,1.41,1.42 simon.cpp,1.126,1.127 simon.h,1.39,1.40 vga.cpp,1.27,1.28

Travis Howell kirben at users.sourceforge.net
Sun Dec 22 00:09:05 CET 2002


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

Modified Files:
	items.cpp simon.cpp simon.h vga.cpp 
Log Message:

First attempt at proper simon 2 midi support
Thanks to olki's previous work


Index: items.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/items.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- items.cpp	22 Dec 2002 03:54:51 -0000	1.41
+++ items.cpp	22 Dec 2002 08:08:53 -0000	1.42
@@ -753,7 +753,9 @@
 		case 134:{
 				if (_debugMode)
 					warning("stopMidiMusic: not implemented");
-				/* dummy proc */
+				_vc70_var2 = 0xFFFF;
+				_midi_unk1 = 0xFFFF;
+				_vc72_var1 = 0xFFFF;
 			}
 			break;
 
@@ -1472,25 +1474,37 @@
 
 void SimonState::o_unk_127()
 {
+	uint a = getVarOrWord();
+	uint b = getVarOrWord();
 	if (_game & GAME_SIMON2) {
-		uint a = getVarOrWord();
-		uint b = getVarOrWord();
 		uint c = getVarOrByte();
 
 		if (_debugMode)
 			warning("o_unk_127(%d,%d,%d) not implemented properly", a, b, c);
 
-		if (a != _last_music_played) {
-			_last_music_played = a;
-			playMusic(a - 1);
+		if (_midi_unk1 == a) {
+			if (b == _vc72_var1 || b == 999) {
+				return;
+			}
+			if (_vc72_var1 != 0xFFFF || _vc72_var1 != 999)  {
+				_vc70_var2 = c;
+				_vc70_var1 = 0xffff;
+				_vc72_var3 = 0xffff;
+				_midi_unk2 = 0xffff;
+				midi.initialize();
+				midi.play();
+				_vc72_var1 = b;
+			} else {
+				_vc72_var3 = b;
+				_vc72_var2 = c;
+			}
+		} else if (b == 999) {
+			_midi_unk2 = a;
 		}
 	} else {
-		uint a = getVarOrWord();
-		/*uint b = */ getVarOrWord();
-
 		if (a != _last_music_played) {
 			_last_music_played = a;
-			playMusic(a);
+			playMusic(0, a);
 		}
 	}
 }

Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -d -r1.126 -r1.127
--- simon.cpp	22 Dec 2002 03:54:51 -0000	1.126
+++ simon.cpp	22 Dec 2002 08:08:53 -0000	1.127
@@ -4412,15 +4412,12 @@
 		}
 	}
 
-	if (!_fast_mode || !(rand() & 7)) {
-
 		if (_mouse_pos_changed) {
 			_mouse_pos_changed = false;
 			_system->set_mouse_pos(_sdl_mouse_x, _sdl_mouse_y);
 		}
 		_system->copy_rect(_sdl_buf_attached, 320, 0, 0, 320, 200);
 		_system->update_screen();
-	}
 
 	memcpy(_sdl_buf_attached, _sdl_buf, 320 * 200);
 
@@ -4504,7 +4501,7 @@
 	} else {
 		_vk_t_toggle = true;
 	}
-
+	
 	while (1) {
 		hitarea_stuff();
 		handle_verb_clicked(_verb_hitarea);
@@ -4807,21 +4804,26 @@
 	return true;
 }
 
-void SimonState::playMusic(uint music)
+void SimonState::playMusic(uint music_unk, uint music)
 {
-	/* TODO */
-	/* Simon 2 dos / talkie music requires xmi midi format support */
-	if (_game & GAME_WIN) {	
-		midi.shutdown();
-		_game_file->seek(_game_offsets_ptr[gss->MUSIC_INDEX_BASE + music], SEEK_SET);
-		midi.read_all_songs(_game_file, music);
-	
-		midi.initialize();
-		midi.play();
-	} else if (!(_game & GAME_SIMON2) && !(_game & GAME_DEMO)){
+	if (_game & GAME_SIMON2) {        // Simon 2 music
+		if (_game & GAME_WIN) {	
+			midi.shutdown();
+			_game_file->seek(_game_offsets_ptr[gss->MUSIC_INDEX_BASE + music - 1], SEEK_SET);
+			midi.read_all_songs(_game_file, music);
+			_midi_unk1 = music;
+		} else
+			warning ("XMI music not supported");
+		_vc72_var1 = music_unk;
+		_vc70_var1 = 0xFFFF;
+		_vc72_var3 = 0xFFFF;
+		_midi_unk2 = 0xFFFF;
+	} else if (!(_game & GAME_DEMO)){ // Simon 1 music
 		midi.shutdown();
-
-		if (_game & GAME_TALKIE) {
+		if (_game & GAME_WIN) {	
+			_game_file->seek(_game_offsets_ptr[gss->MUSIC_INDEX_BASE + music], SEEK_SET);
+			midi.read_all_songs(_game_file, music);
+		} else if (_game & GAME_TALKIE) {
 			_game_file->seek(_game_offsets_ptr[gss->MUSIC_INDEX_BASE + music], SEEK_SET);
 			midi.read_all_songs_old(_game_file, music);
 		} else {
@@ -4836,7 +4838,6 @@
 			midi.read_all_songs_old(f, music);
 			delete f;
 		}
-
 		midi.initialize();
 		midi.play();
 	}

Index: simon.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- simon.h	8 Dec 2002 15:39:57 -0000	1.39
+++ simon.h	22 Dec 2002 08:08:53 -0000	1.40
@@ -187,6 +187,7 @@
 	int _x_scroll, _vga_var1, _vga_var2, _vga_var3, _vga_var5;
 	byte _vga_var8;
 
+	uint16 _midi_unk1, _midi_unk2;
 	uint16 _vc72_var1, _vc72_var2, _vc72_var3;
 	uint16 _vc70_var1, _vc70_var2;
 	byte *_vga_var7;
@@ -757,7 +758,7 @@
 	void video_putchar_newline(FillOrCopyStruct *fcs);
 	void video_putchar_drawchar(FillOrCopyStruct *fcs, uint x, uint y, byte chr);
 
-	void playMusic(uint music);
+	void playMusic(uint music, uint music_unk);
 	void checkTimerCallback();
 	void delay(uint delay);
 

Index: vga.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/vga.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- vga.cpp	19 Dec 2002 15:46:02 -0000	1.27
+++ vga.cpp	22 Dec 2002 08:08:53 -0000	1.28
@@ -1779,9 +1779,15 @@
 
 	vc_29_stop_all_sounds();
 
-	if ((_game & GAME_SIMON2) && (!_video_var_3)) {
-		if (_debugMode)
-			warning("vc_62_palette_thing: music stuff?");
+	if (!_video_var_3) {
+		if (_game & GAME_SIMON2) {
+		//FIXME The screen should be cleared elsewhere.
+		dx_clear_surfaces(_video_palette_mode == 4 ? 134 : 200);
+			if (_midi_unk2 != 0xffff) {
+				playMusic(999, _midi_unk2);
+			}
+		}
+	return;
 	}
 
 	_video_var_3 = true;
@@ -1897,6 +1903,19 @@
 
 	if (_debugMode)
 		warning("vc_69(%d,%d): music stuff?", a, b);
+
+	if (_vc72_var1 == 999) {
+		_vc70_var2 = b;
+		midi.initialize();
+		midi.play();
+		_vc72_var1 = b;
+	} else if (_vc72_var1 != 0xFFFF) {
+		if (_vc72_var1 != a) {
+			_vc72_var3 = a;
+			_vc72_var2 = a;
+		}
+	}
+
 }
 
 void SimonState::vc_70()
@@ -1906,6 +1925,9 @@
 
 	_vc70_var1 = a;
 	_vc70_var2 = b;
+
+	if (_debugMode)
+		warning("vc_70(%d,%d): music stuff?", a, b);
 }
 
 
@@ -1923,6 +1945,9 @@
 		_vc72_var2 = b;
 		_vc72_var3 = a;
 	}
+
+	if (_debugMode)
+		warning("vc_72(%d,%d): music stuff?", a, b);
 }
 
 void SimonState::vc_73_set_op189_flag()





More information about the Scummvm-git-logs mailing list