aboutsummaryrefslogtreecommitdiff
path: root/engines/saga/sfuncs.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2007-07-06 12:39:00 +0000
committerFilippos Karapetis2007-07-06 12:39:00 +0000
commit38f3b09e58a458616365a4ab74f1f64fe10a8960 (patch)
treec017fc081e44c59ca22cc980dd7a8407b5d2a699 /engines/saga/sfuncs.cpp
parent51458026fe8dfeea337994914a13bbcc7981f129 (diff)
downloadscummvm-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
Diffstat (limited to 'engines/saga/sfuncs.cpp')
-rw-r--r--engines/saga/sfuncs.cpp36
1 files changed, 33 insertions, 3 deletions
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) {