aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2002-12-22 08:08:53 +0000
committerTravis Howell2002-12-22 08:08:53 +0000
commit987a823ffea77338ad47c83419a0518d6970d504 (patch)
treef151836be784d1cbb8ac0e76cc5cf573c76857f5
parent352748878a79b31dc4ef0d0c9cac1924d83faf0e (diff)
downloadscummvm-rg350-987a823ffea77338ad47c83419a0518d6970d504.tar.gz
scummvm-rg350-987a823ffea77338ad47c83419a0518d6970d504.tar.bz2
scummvm-rg350-987a823ffea77338ad47c83419a0518d6970d504.zip
First attempt at proper simon 2 midi support
Thanks to olki's previous work svn-id: r6056
-rw-r--r--simon/items.cpp34
-rw-r--r--simon/simon.cpp39
-rw-r--r--simon/simon.h3
-rw-r--r--simon/vga.cpp31
4 files changed, 74 insertions, 33 deletions
diff --git a/simon/items.cpp b/simon/items.cpp
index 2086c37f8b..c9903d6e68 100644
--- a/simon/items.cpp
+++ b/simon/items.cpp
@@ -753,7 +753,9 @@ int SimonState::runScript()
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_132_helper_2(FillOrCopyStruct *fcs, int x)
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);
}
}
}
diff --git a/simon/simon.cpp b/simon/simon.cpp
index 38a9c10cb6..3d0efd2fb2 100644
--- a/simon/simon.cpp
+++ b/simon/simon.cpp
@@ -4412,15 +4412,12 @@ void SimonState::dx_update_screen_and_palette()
}
}
- 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 @@ void SimonState::go()
} else {
_vk_t_toggle = true;
}
-
+
while (1) {
hitarea_stuff();
handle_verb_clicked(_verb_hitarea);
@@ -4807,21 +4804,26 @@ bool SimonState::load_game(uint slot)
return true;
}
-void SimonState::playMusic(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)){
+void SimonState::playMusic(uint music_unk, uint music)
+{
+ 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 @@ void SimonState::playMusic(uint music)
midi.read_all_songs_old(f, music);
delete f;
}
-
midi.initialize();
midi.play();
}
diff --git a/simon/simon.h b/simon/simon.h
index a280f8b0f3..4b62082fd8 100644
--- a/simon/simon.h
+++ b/simon/simon.h
@@ -187,6 +187,7 @@ public:
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 @@ public:
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);
diff --git a/simon/vga.cpp b/simon/vga.cpp
index e82c58b4f4..9da26b11ae 100644
--- a/simon/vga.cpp
+++ b/simon/vga.cpp
@@ -1779,9 +1779,15 @@ void SimonState::vc_62_palette_thing()
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 @@ void SimonState::vc_69()
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 @@ void SimonState::vc_70()
_vc70_var1 = a;
_vc70_var2 = b;
+
+ if (_debugMode)
+ warning("vc_70(%d,%d): music stuff?", a, b);
}
@@ -1923,6 +1945,9 @@ void SimonState::vc_72()
_vc72_var2 = b;
_vc72_var3 = a;
}
+
+ if (_debugMode)
+ warning("vc_72(%d,%d): music stuff?", a, b);
}
void SimonState::vc_73_set_op189_flag()