From 349ab2007a23844a6e2b34d07775ebdd2b7c7158 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 30 Aug 2005 11:16:11 +0000 Subject: Implement sfPlayMusic for IHNM svn-id: r18717 --- saga/sfuncs.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'saga/sfuncs.cpp') diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp index eeff7361e9..ec0020967c 100644 --- a/saga/sfuncs.cpp +++ b/saga/sfuncs.cpp @@ -1640,11 +1640,20 @@ void Script::sfPlayMusic(SCRIPTFUNC_PARAMS) { _vm->_music->stop(); } } else { - // TODO: Verify this - int16 param1 = thread->pop() + 32; + int16 param1 = thread->pop(); int16 param2 = thread->pop(); - _vm->_music->play(param1, param2 ? MUSIC_LOOP: MUSIC_NORMAL); + if (param1 < 1) { + _vm->_music->stop(); + return; + } + + if (param1 > _vm->_music->_songTableLen) { + warning("sfPlayMusic: Wrong song number (%d > %d)", param1, _vm->_music->_songTableLen); + } else { + _vm->_music->setVolume(-1, 1); + _vm->_music->play(_vm->_music->_songTable[param1], param2 ? MUSIC_LOOP: MUSIC_NORMAL); + } } } -- cgit v1.2.3