diff options
author | Filippos Karapetis | 2007-07-06 12:39:00 +0000 |
---|---|---|
committer | Filippos Karapetis | 2007-07-06 12:39:00 +0000 |
commit | 38f3b09e58a458616365a4ab74f1f64fe10a8960 (patch) | |
tree | c017fc081e44c59ca22cc980dd7a8407b5d2a699 | |
parent | 51458026fe8dfeea337994914a13bbcc7981f129 (diff) | |
download | scummvm-rg350-38f3b09e58a458616365a4ab74f1f64fe10a8960.tar.gz scummvm-rg350-38f3b09e58a458616365a4ab74f1f64fe10a8960.tar.bz2 scummvm-rg350-38f3b09e58a458616365a4ab74f1f64fe10a8960.zip |
IHNM: sf103 is sfQueueMusic. Now, when doing a good/bad deed in IHNM, the music changes correctly
svn-id: r27936
-rw-r--r-- | engines/saga/script.h | 2 | ||||
-rw-r--r-- | engines/saga/sfuncs.cpp | 36 |
2 files changed, 34 insertions, 4 deletions
diff --git a/engines/saga/script.h b/engines/saga/script.h index ec3a7e1cf4..5adfb6181a 100644 --- a/engines/saga/script.h +++ b/engines/saga/script.h @@ -598,7 +598,7 @@ private: void sfClearGlobalFlag(SCRIPTFUNC_PARAMS); void sfTestGlobalFlag(SCRIPTFUNC_PARAMS); void sfSetPoints(SCRIPTFUNC_PARAMS); - void sf103(SCRIPTFUNC_PARAMS); + void sfQueueMusic(SCRIPTFUNC_PARAMS); void sfDisableAbortSpeeches(SCRIPTFUNC_PARAMS); void SF_stub(const char *name, ScriptThread *thread, int nArgs); diff --git a/engines/saga/sfuncs.cpp b/engines/saga/sfuncs.cpp index 945d66f328..1556b20487 100644 --- a/engines/saga/sfuncs.cpp +++ b/engines/saga/sfuncs.cpp @@ -240,7 +240,7 @@ static const ScriptFunctionDescription IHNMscriptFunctionsList[IHNM_SCRIPT_FUNCT OPCODE(sfSetSpeechBox), OPCODE(sfDebugShowData), OPCODE(sfWaitFramesEsc), - OPCODE(sf103), + OPCODE(sfQueueMusic), OPCODE(sfDisableAbortSpeeches) }; if (_vm->getGameType() == GType_IHNM) @@ -2119,8 +2119,38 @@ void Script::sfWaitFramesEsc(SCRIPTFUNC_PARAMS) { thread->_returnValue = _vm->_framesEsc; } -void Script::sf103(SCRIPTFUNC_PARAMS) { - SF_stub("sf103", thread, nArgs); +void Script::sfQueueMusic(SCRIPTFUNC_PARAMS) { + int16 param1 = thread->pop(); + int16 param2 = thread->pop(); + Event event; + + if (param1 < 0) { + _vm->_music->stop(); + return; + } + + if (param1 >= _vm->_music->_songTableLen) { + warning("sfQueueMusic: Wrong song number (%d > %d)", param1, _vm->_music->_songTableLen - 1); + } else { + _vm->_music->setVolume(-1, 1); + event.type = kEvTOneshot; + event.code = kMusicEvent; + event.param = _vm->_music->_songTable[param1]; + event.param2 = param2 ? MUSIC_LOOP : MUSIC_NORMAL; + event.op = kEventPlay; + event.time = 5 * 1000; // we wait for 5x the duration here, to let the previous music track end + // TODO: original waits for 1000ms here, why is the 5x duration needed? + + _vm->_events->queue(&event); + + if (!_vm->_scene->haveChapterPointsChanged()) { + _vm->_scene->setCurrentMusicTrack(param1); + _vm->_scene->setCurrentMusicRepeat(param2); + } else { + // Don't save this music track when saving in IHNM + _vm->_scene->setChapterPointsChanged(false); + } + } } void Script::sfDisableAbortSpeeches(SCRIPTFUNC_PARAMS) { |