From ebcee2beb64d5403f5fdb2cc49836d5b847ae780 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Mon, 10 Apr 2006 10:18:55 +0000 Subject: Split the playTune opcode into Simon 1, Simon 2 and FF versions. The FF version was wrong before, but since it is a no-op, it probably never caused any problems. svn-id: r21763 --- engines/simon/items.cpp | 85 +++++++++++++++++++++++++++++++------------------ engines/simon/simon.h | 4 ++- 2 files changed, 57 insertions(+), 32 deletions(-) (limited to 'engines/simon') diff --git a/engines/simon/items.cpp b/engines/simon/items.cpp index 4c9de254c3..a26497476d 100644 --- a/engines/simon/items.cpp +++ b/engines/simon/items.cpp @@ -193,7 +193,7 @@ void SimonEngine::setupOpcodes() { // 125 - 129 &SimonEngine::o_here, &SimonEngine::o_doClassIcons, - &SimonEngine::o_playTune, + NULL, &SimonEngine::o_waitEndTune, &SimonEngine::o_ifEndTune, // 130 - 134 @@ -291,6 +291,7 @@ void SimonEngine::setupOpcodes() { opcode_table[83] = &SimonEngine::o1_rescan; opcode_table[98] = &SimonEngine::o1_animate; opcode_table[99] = &SimonEngine::o1_stopAnimate; + opcode_table[127] = &SimonEngine::o1_playTune; opcode_table[181] = &SimonEngine::o1_mouseOff; opcode_table[182] = &SimonEngine::o1_loadBeard; opcode_table[183] = &SimonEngine::o1_unloadBeard; @@ -302,6 +303,7 @@ void SimonEngine::setupOpcodes() { opcode_table[83] = &SimonEngine::o2_rescan; opcode_table[98] = &SimonEngine::o2_animate; opcode_table[99] = &SimonEngine::o2_stopAnimate; + opcode_table[127] = &SimonEngine::o2_playTune; opcode_table[181] = &SimonEngine::o2_mouseOff; opcode_table[188] = &SimonEngine::o2_isShortText; opcode_table[189] = &SimonEngine::o2_clearMarks; @@ -317,6 +319,7 @@ void SimonEngine::setupOpcodes() { opcode_table[122] = &SimonEngine::o3_oracleTextDown; opcode_table[123] = &SimonEngine::o3_oracleTextUp; opcode_table[124] = &SimonEngine::o3_ifTime; + opcode_table[127] = &SimonEngine::o3_playTune; opcode_table[131] = &SimonEngine::o3_setTime; opcode_table[133] = &SimonEngine::o3_loadUserGame; opcode_table[134] = &SimonEngine::o3_listSaveGames; @@ -1033,36 +1036,6 @@ void SimonEngine::o_doClassIcons() { mouseOn(); } -void SimonEngine::o_playTune() { - // 127: deals with music - int music = getVarOrWord(); - int track = getVarOrWord(); - - // Jamieson630: - // This appears to be a "load or play music" command. - // The music resource is specified, and optionally - // a track as well. Normally we see two calls being - // made, one to load the resource and another to - // actually start a track (so the resource is - // effectively preloaded so there's no latency when - // starting playback). - if (getGameType() == GType_SIMON2) { - int loop = getVarOrByte(); - - midi.setLoop(loop != 0); - if (_lastMusicPlayed != music) - _nextMusicToPlay = music; - else - midi.startTrack(track); - } else { - if (music != _lastMusicPlayed) { - _lastMusicPlayed = music; - loadMusic(music); - midi.startTrack(track); - } - } -} - void SimonEngine::o_waitEndTune() { // 128: dummy instruction getVarOrWord(); @@ -1622,6 +1595,27 @@ void SimonEngine::o1_stopAnimate() { kill_sprite_simon1(getVarOrWord()); } +void SimonEngine::o1_playTune() { + // 127: deals with music + int music = getVarOrWord(); + int track = getVarOrWord(); + + // Jamieson630: + // This appears to be a "load or play music" command. + // The music resource is specified, and optionally + // a track as well. Normally we see two calls being + // made, one to load the resource and another to + // actually start a track (so the resource is + // effectively preloaded so there's no latency when + // starting playback). + + if (music != _lastMusicPlayed) { + _lastMusicPlayed = music; + loadMusic(music); + midi.startTrack(track); + } +} + void SimonEngine::o1_mouseOff() { // 181: force mouseOff scriptMouseOff(); @@ -1707,6 +1701,28 @@ void SimonEngine::o2_stopAnimate() { kill_sprite_simon2(a, b); } +void SimonEngine::o2_playTune() { + // 127: deals with music + int music = getVarOrWord(); + int track = getVarOrWord(); + int loop = getVarOrByte(); + + // Jamieson630: + // This appears to be a "load or play music" command. + // The music resource is specified, and optionally + // a track as well. Normally we see two calls being + // made, one to load the resource and another to + // actually start a track (so the resource is + // effectively preloaded so there's no latency when + // starting playback). + + midi.setLoop(loop != 0); + if (_lastMusicPlayed != music) + _nextMusicToPlay = music; + else + midi.startTrack(track); +} + void SimonEngine::o2_mouseOff() { // 181: force mouseOff scriptMouseOff(); @@ -1795,6 +1811,13 @@ void SimonEngine::o3_ifTime() { setScriptCondition(false); } +void SimonEngine::o3_playTune() { + // 127: usually deals with music, but is a no-op in FF. + getVarOrWord(); + getVarOrWord(); + getVarOrByte(); +} + void SimonEngine::o3_setTime() { // 131 time(&_timeStore); diff --git a/engines/simon/simon.h b/engines/simon/simon.h index ce1d31cd1d..fc051f11f8 100644 --- a/engines/simon/simon.h +++ b/engines/simon/simon.h @@ -884,7 +884,6 @@ public: void o_defObj(); void o_here(); void o_doClassIcons(); - void o_playTune(); void o_waitEndTune(); void o_ifEndTune(); void o_setAdjNoun(); @@ -932,6 +931,7 @@ public: void o1_rescan(); void o1_animate(); void o1_stopAnimate(); + void o1_playTune(); void o1_mouseOff(); void o1_loadBeard(); void o1_unloadBeard(); @@ -943,6 +943,7 @@ public: void o2_rescan(); void o2_animate(); void o2_stopAnimate(); + void o2_playTune(); void o2_mouseOff(); void o2_isShortText(); void o2_clearMarks(); @@ -955,6 +956,7 @@ public: void o3_oracleTextDown(); void o3_oracleTextUp(); void o3_ifTime(); + void o3_playTune(); void o3_setTime(); void o3_loadUserGame(); void o3_listSaveGames(); -- cgit v1.2.3