aboutsummaryrefslogtreecommitdiff
path: root/simon/vga.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'simon/vga.cpp')
-rw-r--r--simon/vga.cpp67
1 files changed, 48 insertions, 19 deletions
diff --git a/simon/vga.cpp b/simon/vga.cpp
index 8b1b40f326..56a1f8823a 100644
--- a/simon/vga.cpp
+++ b/simon/vga.cpp
@@ -1805,13 +1805,13 @@ void SimonState::vc_68_skip_if_le() {
void SimonState::vc_69() {
// Simon2
int16 track = vc_read_next_word();
- int16 paused = vc_read_next_word();
+ int16 loop = vc_read_next_word();
if (_debugMode)
- warning("vc_69(%d,%d): music stuff", track, paused);
+ debug (0, "vc_69(%d,%d): Play track", track, loop);
// Jamieson630:
- // This is a "play or queue track". The original
+ // This is a "play track". The original
// design stored the track to play if one was
// already in progress, so that the next time a
// "fill MIDI stream" event occured, the MIDI
@@ -1826,48 +1826,70 @@ void SimonState::vc_69() {
// as a means of stopping what music is currently
// playing.
if (_vc72_var1 != track) {
+ midi.setLoop (loop != 0);
midi_play (track);
- if (paused)
- midi.pause (true);
_vc72_var1 = track;
- _vc72_var2 = -1; // (a & 0xFF) << 8 | (a >> 8);
+ _vc72_var2 = -1;
_vc72_var3 = -1;
+ _vc70_var1 = -1;
+ _vc70_var2 = loop;
}
/*
// ORIGINAL TRANSLATION FROM DISASSEMBLY
if (_vc72_var1 == 999 || _vc72_var1 == -1) {
- _vc70_var2 = paused;
+ _vc70_var2 = loop;
midi_play (track);
_vc72_var1 = track;
} else if (_vc72_var1 != track) {
_vc72_var3 = track;
- _vc72_var2 = paused; // (a & 0xFF) << 8 | (a >> 8);
+ _vc72_var2 = loop; // (a & 0xFF) << 8 | (a >> 8);
}
*/
}
void SimonState::vc_70() {
// Simon2
- uint16 a = vc_read_next_word();
- uint16 b = vc_read_next_word();
+ uint16 track = vc_read_next_word();
+ uint16 loop = vc_read_next_word();
+
+ // Jamieson630:
+ // This sets the "on end of track" action.
+ // It specifies whether to loop the current
+ // track and, if not, whether to switch to
+ // a different track upon completion.
+ _vc70_var1 = track;
+ _vc70_var2 = loop;
- _vc70_var1 = a;
- _vc70_var2 = b;
+ midi.setLoop (loop != 0);
+ if (_vc70_var1 != -1 && _vc70_var1 != 999)
+ midi.queueTrack ((byte) track, 0);
if (_debugMode)
- warning("vc_70(%d,%d): music stuff?", a, b);
+ debug (0, "vc_70 (%d,%d): Set end of track conditions", track, loop);
}
void SimonState::vc_71() {
// Simon2
+ // Jamieson630:
+ // This command skips the next instruction
+ // unless (1) there is a track playing, AND
+ // (2) there is a track queued to play after it.
+ if (_debugMode)
+ debug (0, "vc_71(): Is music playing? %s", midi.isPlaying(true) ? "YES" : "NO");
+
+ if (!midi.isPlaying (true))
+ vc_skip_next_instruction();
+/*
+ // ORIGINAL TRANSLATION FROM DISASSEMBLY
if (_vc72_var3 == -1 && _vc70_var1 == -1)
vc_skip_next_instruction();
+*/
}
void SimonState::vc_72() {
// Simon2
// Jamieson630:
- // This is a "queue or stop track". The original
+ // This is a "play or stop track". The original
// design stored the track to play if one was
// already in progress, so that the next time a
// "fill MIDI stream" event occured, the MIDI
@@ -1876,26 +1898,33 @@ void SimonState::vc_72() {
// allows for an immediate response here, but
// we'll simulate the variable changes so other
// scripts don't get thrown off.
+
// NOTE: This opcode looks very similar in function
// to vc_72(), except that this opcode may allow
// for specifying a track of 999 or -1 in order to
// stop the music. We'll code it that way for now.
+
+ // NOTE: It's possible that when "stopping" a track,
+ // we're supposed to just go on to the next queued
+ // track, if any. Must find out if there is ANY
+ // case where this is used to stop a track in the
+ // first place.
+
int16 track = vc_read_next_word();
- int16 paused = !vc_read_next_word();
+ int16 loop = vc_read_next_word();
if (_debugMode)
- warning ("vc_72 (%d, %d): music stuff?", track, paused);
+ debug (0, "vc_72 (%d, %d): Play or stop track", track, loop);
if (track != _vc72_var1) {
if (track == -1 || track == 999) {
midi.stop();
_vc72_var1 = -1;
} else {
+ midi.setLoop (loop != 0);
midi_play (track);
- if (paused)
- midi.pause (true);
_vc72_var1 = track;
- _vc72_var2 = paused;
+ _vc70_var2 = loop;
}
_vc72_var3 = -1;
}