First attempt at proper simon 2 midi support

Thanks to olki's previous work

svn-id: r6056
This commit is contained in:
Travis Howell 2002-12-22 08:08:53 +00:00
parent 352748878a
commit 987a823ffe
4 changed files with 73 additions and 32 deletions

View File

@ -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);
}
}
}

View File

@ -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)
void SimonState::playMusic(uint music_unk, uint music)
{
/* TODO */
/* Simon 2 dos / talkie music requires xmi midi format support */
if (_game & GAME_WIN) {
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();
_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)){
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();
}

View File

@ -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);

View File

@ -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()