aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamieson Christian2003-05-21 05:12:04 +0000
committerJamieson Christian2003-05-21 05:12:04 +0000
commit98186e59ff483aa7962ee88a80fd071a2c7c0e20 (patch)
tree287bfaa6f9b17e1171d1373eadbb9067f7bf0cf2
parent1227a837ec7636fedc3033c890fe8a705b9c8020 (diff)
downloadscummvm-rg350-98186e59ff483aa7962ee88a80fd071a2c7c0e20.tar.gz
scummvm-rg350-98186e59ff483aa7962ee88a80fd071a2c7c0e20.tar.bz2
scummvm-rg350-98186e59ff483aa7962ee88a80fd071a2c7c0e20.zip
Renamed opcodes whose functions are now known.
Cleaned up unused script variables. Miscellaneous semantic changes. svn-id: r7763
-rw-r--r--simon/items.cpp28
-rw-r--r--simon/simon.cpp19
-rw-r--r--simon/simon.h15
-rw-r--r--simon/vga.cpp102
4 files changed, 34 insertions, 130 deletions
diff --git a/simon/items.cpp b/simon/items.cpp
index df3d49ac3a..aa793b6e52 100644
--- a/simon/items.cpp
+++ b/simon/items.cpp
@@ -698,7 +698,7 @@ int SimonState::runScript() {
break;
case 127:{ /* deals with music */
- o_unk_127();
+ o_play_music_resource();
}
break;
@@ -750,10 +750,8 @@ int SimonState::runScript() {
break;
case 134:{
- _vc70_var2 = -1;
midi.stop();
_last_music_played = -1;
- _vc72_var1 = -1;
}
break;
@@ -1431,7 +1429,7 @@ void SimonState::o_unk_132_helper_2(FillOrCopyStruct *fcs, int x) {
video_putchar(fcs, 8);
}
-void SimonState::o_unk_127() {
+void SimonState::o_play_music_resource() {
int music = getVarOrWord();
int track = getVarOrWord();
@@ -1446,32 +1444,18 @@ void SimonState::o_unk_127() {
if (_game & GF_SIMON2) {
int loop = getVarOrByte();
- if (_debugMode)
- debug (0, "o_unk_127 (%d, %d, %d): Load/play music resource", music, track, loop);
-
midi.setLoop (loop != 0);
-
if (_last_music_played != music) {
- playMusic (music);
+ loadMusic (music);
_last_music_played = music;
_next_music_to_play = -1;
- _vc72_var1 = _vc72_var2 = _vc72_var3 = -1;
}
-
- if (track == _vc72_var1 || track == 999)
- return;
-
- _vc72_var1 = track;
- _vc70_var1 = -1;
- _vc70_var2 = -1;
- _vc72_var2 = -1;
- _vc72_var3 = -1;
- midi_play (track);
+ midi.jump (track, 0);
} else {
if (music != _last_music_played) {
_last_music_played = music;
- playMusic (music);
- midi_play (track);
+ loadMusic (music);
+ midi.jump (track, 0);
}
}
}
diff --git a/simon/simon.cpp b/simon/simon.cpp
index 77dfe7cc84..88d8e981c8 100644
--- a/simon/simon.cpp
+++ b/simon/simon.cpp
@@ -256,11 +256,6 @@ SimonState::SimonState(GameDetector *detector, OSystem *syst)
_vga_var5 = 0;
_vga_var8 = 0;
- _vc72_var1 = 0;
- _vc72_var2 = 0;
- _vc72_var3 = 0;
- _vc70_var1 = 0;
- _vc70_var2 = 0;
_vga_var7 = 0;
_script_cond_a = 0;
@@ -3327,7 +3322,7 @@ void SimonState::processSpecialKeys() {
if (midi._midi_sfx_toggle)
midi.stop();
else
- playMusic(_last_music_played);
+ loadMusic(_last_music_played);
} else
_sound->effectsPause(_effects_paused ^= 1);
break;
@@ -5277,14 +5272,7 @@ bool SimonState::load_game(uint slot) {
return true;
}
-void SimonState::midi_play (uint track) {
- if (track == 999)
- return;
- midi.jump (track, 0);
-}
-
-
-void SimonState::playMusic (uint music) {
+void SimonState::loadMusic (uint music) {
if (midi._midi_sfx_toggle)
return;
@@ -5298,9 +5286,6 @@ void SimonState::playMusic (uint music) {
}
_last_music_played = music;
- _vc72_var1 = 999;
- _vc70_var1 = -1;
- _vc72_var3 = -1;
_next_music_to_play = -1;
} else { // Simon 1 music
if (_game & GF_AMIGAS) {
diff --git a/simon/simon.h b/simon/simon.h
index 0a4cea0df3..b94573862e 100644
--- a/simon/simon.h
+++ b/simon/simon.h
@@ -198,8 +198,6 @@ public:
int _x_scroll, _vga_var1, _vga_var2, _vga_var3, _vga_var5;
byte _vga_var8;
- int16 _vc72_var1, _vc72_var2, _vc72_var3;
- int16 _vc70_var1, _vc70_var2;
byte *_vga_var7;
int16 _script_cond_a, _script_cond_b, _script_cond_c;
@@ -468,7 +466,7 @@ public:
void skip_speech();
void o_unk_120(uint a);
void o_unk_126();
- void o_unk_127();
+ void o_play_music_resource();
void o_save_game();
void o_load_game();
void o_quit_if_user_presses_y();
@@ -670,10 +668,10 @@ public:
void vc_66_skip_if_nz();
void vc_67_skip_if_ge();
void vc_68_skip_if_le();
- void vc_69();
- void vc_70();
- void vc_71();
- void vc_72();
+ void vc_69_play_track();
+ void vc_70_queue_music();
+ void vc_71_check_music_queue();
+ void vc_72_play_track_2();
void vc_73_set_op189_flag();
void vc_74_clear_op189_flag();
@@ -768,8 +766,7 @@ public:
void video_putchar_newline(FillOrCopyStruct *fcs);
void video_putchar_drawchar(FillOrCopyStruct *fcs, uint x, uint y, byte chr);
- void midi_play(uint music);
- void playMusic(uint music);
+ void loadMusic(uint music);
void checkTimerCallback();
void delay(uint delay);
diff --git a/simon/vga.cpp b/simon/vga.cpp
index 56a1f8823a..b4336933fc 100644
--- a/simon/vga.cpp
+++ b/simon/vga.cpp
@@ -99,10 +99,10 @@ static const VgaOpcodeProc vga_opcode_table[] = {
&SimonState::vc_66_skip_if_nz,
&SimonState::vc_67_skip_if_ge,
&SimonState::vc_68_skip_if_le,
- &SimonState::vc_69,
- &SimonState::vc_70,
- &SimonState::vc_71,
- &SimonState::vc_72,
+ &SimonState::vc_69_play_track,
+ &SimonState::vc_70_queue_music,
+ &SimonState::vc_71_check_music_queue,
+ &SimonState::vc_72_play_track_2,
&SimonState::vc_73_set_op189_flag,
&SimonState::vc_74_clear_op189_flag,
};
@@ -1693,7 +1693,7 @@ void SimonState::vc_62_palette_thing() {
if (!_video_var_3) {
if (_game & GF_SIMON2) {
if (_next_music_to_play != -1)
- playMusic(_next_music_to_play);
+ loadMusic(_next_music_to_play);
}
} else
_video_var_3 = true;
@@ -1802,14 +1802,11 @@ void SimonState::vc_68_skip_if_le() {
vc_skip_next_instruction();
}
-void SimonState::vc_69() {
+void SimonState::vc_69_play_track() {
// Simon2
int16 track = vc_read_next_word();
int16 loop = vc_read_next_word();
- if (_debugMode)
- debug (0, "vc_69(%d,%d): Play track", track, loop);
-
// Jamieson630:
// This is a "play track". The original
// design stored the track to play if one was
@@ -1825,29 +1822,11 @@ void SimonState::vc_69() {
// specifying a non-valid track number (999 or -1)
// as a means of stopping what music is currently
// playing.
- if (_vc72_var1 != track) {
- midi.setLoop (loop != 0);
- midi_play (track);
- _vc72_var1 = track;
- _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 = loop;
- midi_play (track);
- _vc72_var1 = track;
- } else if (_vc72_var1 != track) {
- _vc72_var3 = track;
- _vc72_var2 = loop; // (a & 0xFF) << 8 | (a >> 8);
- }
-*/
+ midi.setLoop (loop != 0);
+ midi.jump (track, 0);
}
-void SimonState::vc_70() {
+void SimonState::vc_70_queue_music() {
// Simon2
uint16 track = vc_read_next_word();
uint16 loop = vc_read_next_word();
@@ -1857,50 +1836,27 @@ void SimonState::vc_70() {
// 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;
-
midi.setLoop (loop != 0);
- if (_vc70_var1 != -1 && _vc70_var1 != 999)
+ if (track != -1 && track != 999)
midi.queueTrack ((byte) track, 0);
-
- if (_debugMode)
- debug (0, "vc_70 (%d,%d): Set end of track conditions", track, loop);
}
-void SimonState::vc_71() {
+void SimonState::vc_71_check_music_queue() {
// 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() {
+void SimonState::vc_72_play_track_2() {
// Simon2
// Jamieson630:
- // 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
- // player would find the change and switch
- // tracks. We use a different architecture that
- // 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
+ // This is a "play or stop track". Note that
+ // this opcode looks very similar in function
+ // to vc_69(), 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.
@@ -1913,30 +1869,12 @@ void SimonState::vc_72() {
int16 track = vc_read_next_word();
int16 loop = vc_read_next_word();
- if (_debugMode)
- 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);
- _vc72_var1 = track;
- _vc70_var2 = loop;
- }
- _vc72_var3 = -1;
- }
-/*
- // ORIGINAL TRANSLATION FROM DISASSEMBLY
- uint16 a = vc_read_next_word();
- uint16 b = vc_read_next_word();
- if (a != _vc72_var1) {
- _vc72_var2 = b;
- _vc72_var3 = a;
+ if (track == -1 || track == 999) {
+ midi.stop();
+ } else {
+ midi.setLoop (loop != 0);
+ midi.jump (track, 0);
}
-*/
}
void SimonState::vc_73_set_op189_flag() {