From a768deb83fe38ce879e46339431a8a49d9cf8c73 Mon Sep 17 00:00:00 2001 From: Jamieson Christian Date: Tue, 20 May 2003 16:43:53 +0000 Subject: Simon music fixes svn-id: r7744 --- simon/items.cpp | 31 ++++++++++++++++++++++++++++++- simon/simon.cpp | 20 +++++++++++--------- sound/midiparser.cpp | 2 +- 3 files changed, 42 insertions(+), 11 deletions(-) diff --git a/simon/items.cpp b/simon/items.cpp index 98c83b43c9..f9ae8f5a82 100644 --- a/simon/items.cpp +++ b/simon/items.cpp @@ -1434,12 +1434,37 @@ void SimonState::o_unk_132_helper_2(FillOrCopyStruct *fcs, int x) { void SimonState::o_unk_127() { int a = getVarOrWord(); int b = getVarOrWord(); + if (_game & GF_SIMON2) { uint c = getVarOrByte(); if (_debugMode) warning("o_unk_127(%d,%d,%d) not implemented properly", a, b, c); + if (_last_music_played != a) { + if (b == 999) { +// _next_music_to_play = a; + playMusic (a); + _last_music_played = a; + // midi_play (0); + } + } + + if (b == _vc72_var1 || b == 999) + return; + + if (_vc72_var1 == -1 || _vc72_var1 == 999) { + _vc70_var2 = c; + _vc70_var1 = -1; + _vc72_var3 = -1; + midi_play (b); + _vc72_var1 = b; + } else { + midi_play (b); +// _vc72_var3 = b; +// _vc72_var2 = c; + } +/* if (_last_music_played == a) { if (b == _vc72_var1 || b == 999) return; @@ -1459,12 +1484,16 @@ void SimonState::o_unk_127() { midi.jump (b, c); } } else if (b == 999) { - _next_music_to_play = a; + // _next_music_to_play = a; + playMusic (a); + midi_play (b); } +*/ } else { if (a != _last_music_played) { _last_music_played = a; playMusic(a); + midi_play (b); } } } diff --git a/simon/simon.cpp b/simon/simon.cpp index 204fbbd474..a8d5b95422 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -4952,7 +4952,7 @@ void SimonState::go() { addTimeEvent(0, 1); openGameFile(); - _last_music_played = (uint) - 1; + _last_music_played = -1; _vga_base_delay = 1; _start_mainscript = false; @@ -5277,24 +5277,25 @@ bool SimonState::load_game(uint slot) { return true; } -void SimonState::midi_play(uint a) { - if (a == 999) - return; +void SimonState::midi_play (uint track) { + if (track == 999) + return; - if (_vc72_var1 == 999) { - //FIXME Original game started music at this point - } + if (_vc72_var1 == 999) { +// _midi_var11 = 0; + midi.jump (track, 0); +// _midi_var12 = 1; + } } -void SimonState::playMusic(uint music) { +void SimonState::playMusic (uint music) { if (midi._midi_sfx_toggle) return; if (_game & GF_SIMON2) { // Simon 2 music midi.stop(); _game_file->seek(_game_offsets_ptr[gss->MUSIC_INDEX_BASE + music - 1], SEEK_SET); - //FIXME The original game only loaded music file at this point if (_game & GF_WIN) { midi.playMultipleSMF (_game_file); } else { @@ -5334,6 +5335,7 @@ void SimonState::playMusic(uint music) { midi.playSMF (f, music); delete f; } + midi.jump (0, 0); } } } diff --git a/sound/midiparser.cpp b/sound/midiparser.cpp index 7551481cdd..0432a10ec8 100644 --- a/sound/midiparser.cpp +++ b/sound/midiparser.cpp @@ -90,7 +90,7 @@ void MidiParser::onTimer() { // Process the next info. _last_event_tick += info.delta; if (info.event < 0x80) { - printf ("ERROR! Bad command or running status %02X", info.event); + printf ("ERROR! Bad command or running status %02X\n", info.event); _play_pos = 0; return; } -- cgit v1.2.3