diff options
author | Torbjörn Andersson | 2004-09-23 06:53:46 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2004-09-23 06:53:46 +0000 |
commit | caed46c816340186e8ef433940bf76e4ebfc4855 (patch) | |
tree | e6280f086bc583b29ca34a3bda3bbe9c043362f4 /saga | |
parent | c7338cccdb211fde6c6deb45b6168dd97de58989 (diff) | |
download | scummvm-rg350-caed46c816340186e8ef433940bf76e4ebfc4855.tar.gz scummvm-rg350-caed46c816340186e8ef433940bf76e4ebfc4855.tar.bz2 scummvm-rg350-caed46c816340186e8ef433940bf76e4ebfc4855.zip |
Added support for scene music and the music-playing opcode to make the
opening scene a bit nicer.
svn-id: r15241
Diffstat (limited to 'saga')
-rw-r--r-- | saga/scene.cpp | 11 | ||||
-rw-r--r-- | saga/script.h | 1 | ||||
-rw-r--r-- | saga/sfuncs.cpp | 45 |
3 files changed, 56 insertions, 1 deletions
diff --git a/saga/scene.cpp b/saga/scene.cpp index 658d05a7f5..48dab518e5 100644 --- a/saga/scene.cpp +++ b/saga/scene.cpp @@ -962,6 +962,17 @@ int Scene::defaultScene(int param, R_SCENE_INFO *scene_info) { _vm->_script->SThreadCompleteThread(); } + if (_desc.musicRN >= 0) { + event.type = R_ONESHOT_EVENT; + event.code = R_MUSIC_EVENT; + event.param = _desc.musicRN; + event.op = EVENT_PLAY; + event.time = 0; + + _vm->_events->queue(&event); + } else + _vm->_music->stop(); + if (_desc.sceneScriptNum > 0) { R_SCRIPT_THREAD *_sceneScriptThread; diff --git a/saga/script.h b/saga/script.h index 11f3e877ff..c3164b98e6 100644 --- a/saga/script.h +++ b/saga/script.h @@ -252,6 +252,7 @@ private: int SF_setActorZ(R_SCRIPTFUNC_PARAMS); int SF_getActorX(R_SCRIPTFUNC_PARAMS); int SF_getActorY(R_SCRIPTFUNC_PARAMS); + int SF_playMusic(R_SCRIPTFUNC_PARAMS); }; } // End of namespace Saga diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp index 0ce2c2b216..df1c900c81 100644 --- a/saga/sfuncs.cpp +++ b/saga/sfuncs.cpp @@ -104,7 +104,7 @@ void Script::setupScriptFuncList(void) { {60, 0, OPCODE(SF_getActorX)}, {61, 0, OPCODE(SF_getActorY)}, {62, 0, NULL}, - {63, 0, NULL}, + {63, 0, OPCODE(SF_playMusic)}, {64, 0, NULL}, {65, 0, NULL}, {66, 0, NULL}, @@ -619,4 +619,47 @@ int Script::SF_getActorY(R_SCRIPTFUNC_PARAMS) { return R_SUCCESS; } +static int musicTable[] = { + MUSIC_1, + MUSIC_2, + MUSIC_3, + MUSIC_4, + MUSIC_5, + MUSIC_6, + MUSIC_7, + MUSIC_8, + MUSIC_9, + MUSIC_10, + MUSIC_11, + MUSIC_12, + MUSIC_13, + MUSIC_14, + MUSIC_15, + MUSIC_16, + MUSIC_17, + MUSIC_18, + MUSIC_19, + MUSIC_20, + MUSIC_21, + MUSIC_22, + MUSIC_23, + MUSIC_24, + MUSIC_25, + MUSIC_26 +}; + +// Script function #63 +int Script::SF_playMusic(R_SCRIPTFUNC_PARAMS) { + SDataWord_T param; + + param = thread->pop(); + + if (/* param >= 0 && */ param < ARRAYSIZE(musicTable)) + _vm->_music->play(musicTable[param], 0); + else + _vm->_music->stop(); + + return R_SUCCESS; +} + } // End of namespace Saga |