Simon music fixes
svn-id: r7744
This commit is contained in:
parent
dab0e4308e
commit
a768deb83f
3 changed files with 42 additions and 11 deletions
|
@ -1434,12 +1434,37 @@ void SimonState::o_unk_132_helper_2(FillOrCopyStruct *fcs, int x) {
|
||||||
void SimonState::o_unk_127() {
|
void SimonState::o_unk_127() {
|
||||||
int a = getVarOrWord();
|
int a = getVarOrWord();
|
||||||
int b = getVarOrWord();
|
int b = getVarOrWord();
|
||||||
|
|
||||||
if (_game & GF_SIMON2) {
|
if (_game & GF_SIMON2) {
|
||||||
uint c = getVarOrByte();
|
uint c = getVarOrByte();
|
||||||
|
|
||||||
if (_debugMode)
|
if (_debugMode)
|
||||||
warning("o_unk_127(%d,%d,%d) not implemented properly", a, b, c);
|
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 (_last_music_played == a) {
|
||||||
if (b == _vc72_var1 || b == 999)
|
if (b == _vc72_var1 || b == 999)
|
||||||
return;
|
return;
|
||||||
|
@ -1459,12 +1484,16 @@ void SimonState::o_unk_127() {
|
||||||
midi.jump (b, c);
|
midi.jump (b, c);
|
||||||
}
|
}
|
||||||
} else if (b == 999) {
|
} else if (b == 999) {
|
||||||
_next_music_to_play = a;
|
// _next_music_to_play = a;
|
||||||
|
playMusic (a);
|
||||||
|
midi_play (b);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
} else {
|
} else {
|
||||||
if (a != _last_music_played) {
|
if (a != _last_music_played) {
|
||||||
_last_music_played = a;
|
_last_music_played = a;
|
||||||
playMusic(a);
|
playMusic(a);
|
||||||
|
midi_play (b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4952,7 +4952,7 @@ void SimonState::go() {
|
||||||
addTimeEvent(0, 1);
|
addTimeEvent(0, 1);
|
||||||
openGameFile();
|
openGameFile();
|
||||||
|
|
||||||
_last_music_played = (uint) - 1;
|
_last_music_played = -1;
|
||||||
_vga_base_delay = 1;
|
_vga_base_delay = 1;
|
||||||
|
|
||||||
_start_mainscript = false;
|
_start_mainscript = false;
|
||||||
|
@ -5277,24 +5277,25 @@ bool SimonState::load_game(uint slot) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimonState::midi_play(uint a) {
|
void SimonState::midi_play (uint track) {
|
||||||
if (a == 999)
|
if (track == 999)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_vc72_var1 == 999) {
|
if (_vc72_var1 == 999) {
|
||||||
//FIXME Original game started music at this point
|
// _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)
|
if (midi._midi_sfx_toggle)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_game & GF_SIMON2) { // Simon 2 music
|
if (_game & GF_SIMON2) { // Simon 2 music
|
||||||
midi.stop();
|
midi.stop();
|
||||||
_game_file->seek(_game_offsets_ptr[gss->MUSIC_INDEX_BASE + music - 1], SEEK_SET);
|
_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) {
|
if (_game & GF_WIN) {
|
||||||
midi.playMultipleSMF (_game_file);
|
midi.playMultipleSMF (_game_file);
|
||||||
} else {
|
} else {
|
||||||
|
@ -5334,6 +5335,7 @@ void SimonState::playMusic(uint music) {
|
||||||
midi.playSMF (f, music);
|
midi.playSMF (f, music);
|
||||||
delete f;
|
delete f;
|
||||||
}
|
}
|
||||||
|
midi.jump (0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ void MidiParser::onTimer() {
|
||||||
// Process the next info.
|
// Process the next info.
|
||||||
_last_event_tick += info.delta;
|
_last_event_tick += info.delta;
|
||||||
if (info.event < 0x80) {
|
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;
|
_play_pos = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue