From 516b1b3748ddf9e877bcab7d294472dd19168bd4 Mon Sep 17 00:00:00 2001 From: Andrew Kurushin Date: Tue, 29 Mar 2005 22:14:20 +0000 Subject: [PATCH] fixed script params (some fair animals should walk now) svn-id: r17289 --- saga/scene.cpp | 191 ++++++++++++++++++++++--------------------------- saga/scene.h | 2 - 2 files changed, 87 insertions(+), 106 deletions(-) diff --git a/saga/scene.cpp b/saga/scene.cpp index 056d10705f4..43ed0d95ad8 100644 --- a/saga/scene.cpp +++ b/saga/scene.cpp @@ -302,7 +302,7 @@ int Scene::changeScene(int sceneNumber, int actorsEntrance, int fadeIn) { } endScene(); - loadScene(sceneNumber, BY_SCENE, SC_defaultScene, NULL, fadeIn, actorsEntrance); + loadScene(sceneNumber, BY_SCENE, NULL, NULL, fadeIn, actorsEntrance); return SUCCESS; } @@ -645,7 +645,7 @@ int Scene::loadScene(int scene_num, int load_flag, SCENE_PROC scene_proc, SceneD event.param2 = _desc.startScriptEntrypointNumber; event.param3 = 0; // Action event.param4 = _sceneNumber; // Object - event.param5 = 0; // With Object - TODO: should be 'entrance' + event.param5 = actorsEntrance; // With Object event.param6 = 0; // Actor q_event = _vm->_events->chain(q_event, &event); @@ -663,15 +663,89 @@ int Scene::loadScene(int scene_num, int load_flag, SCENE_PROC scene_proc, SceneD q_event = _vm->_events->chain(q_event, &event); } - if (scene_proc == NULL) { - _sceneProc = SC_defaultScene; - } else { - _sceneProc = scene_proc; - } - getInfo(&scene_info); - _sceneProc(SCENE_BEGIN, &scene_info, this); + if (scene_proc == NULL) { + if (!_inGame) { + _inGame = true; + _vm->_interface->setMode(kPanelInventory); + } + + _vm->_sound->stopVoice(); + _vm->_sound->stopSound(); + + if (_desc.musicRN >= 0) { + event.type = ONESHOT_EVENT; + event.code = MUSIC_EVENT; + event.param = _desc.musicRN; + event.param2 = MUSIC_DEFAULT; + event.op = EVENT_PLAY; + event.time = 0; + + _vm->_events->queue(&event); + } else { + event.type = ONESHOT_EVENT; + event.code = MUSIC_EVENT; + event.op = EVENT_STOP; + event.time = 0; + + _vm->_events->queue(&event); + } + + // Set scene background + event.type = ONESHOT_EVENT; + event.code = BG_EVENT; + event.op = EVENT_DISPLAY; + event.param = SET_PALETTE; + event.time = 0; + + _vm->_events->queue(&event); + + // Activate user interface + event.type = ONESHOT_EVENT; + event.code = INTERFACE_EVENT; + event.op = EVENT_ACTIVATE; + event.time = 0; + + _vm->_events->queue(&event); + + // Begin palette cycle animation if present + event.type = ONESHOT_EVENT; + event.code = PALANIM_EVENT; + event.op = EVENT_CYCLESTART; + event.time = 0; + + q_event = _vm->_events->queue(&event); + + // Show cursor + event.type = ONESHOT_EVENT; + event.code = CURSOR_EVENT; + event.op = EVENT_SHOW; + _vm->_events->chain(q_event, &event); + + // Start the scene main script + if (_desc.sceneScriptEntrypointNumber > 0) { + event.type = ONESHOT_EVENT; + event.code = SCRIPT_EVENT; + event.op = EVENT_EXEC_NONBLOCKING; + event.time = 0; + event.param = _desc.scriptModuleNumber; + event.param2 = _desc.sceneScriptEntrypointNumber; + event.param3 = kVerbEnter; // Action + event.param4 = _sceneNumber; // Object + event.param5 = actorsEntrance; // With Object + event.param6 = 0; // Actor + + _vm->_events->queue(&event); + } + + debug(0, "Scene started"); + + } else { + scene_proc(SCENE_BEGIN, &scene_info, this); + } + + // We probably don't want "followers" to go into scene -1. At the very // least we don't want garbage to be drawn that early in the ITE intro. @@ -930,9 +1004,11 @@ int Scene::endScene() { debug(0, "Ending scene..."); - getInfo(&scene_info); + if (_sceneProc != NULL) { + getInfo(&scene_info); - _sceneProc(SCENE_END, &scene_info, this); + _sceneProc(SCENE_END, &scene_info, this); + } // _vm->_script->abortAllThreads(); @@ -1014,9 +1090,6 @@ void Scene::cmdSceneInfo() { _vm->_console->DebugPrintf(fmt, "Music R#", _desc.musicRN); } -int Scene::SC_defaultScene(int param, SCENE_INFO *scene_info, void *refCon) { - return ((Scene *)refCon)->defaultScene(param, scene_info); -} void Scene::cmdActionMapInfo() { _actionMap->cmdInfo(); @@ -1026,96 +1099,6 @@ void Scene::cmdObjectMapInfo() { _objectMap->cmdInfo(); } -int Scene::defaultScene(int param, SCENE_INFO *scene_info) { - EVENT event; - EVENT *q_event; - - if (!_inGame) { - _inGame = true; - _vm->_interface->setMode(kPanelInventory); - } - - switch (param) { - case SCENE_BEGIN: - _vm->_sound->stopVoice(); - _vm->_sound->stopSound(); - - if (_desc.musicRN >= 0) { - event.type = ONESHOT_EVENT; - event.code = MUSIC_EVENT; - event.param = _desc.musicRN; - event.param2 = MUSIC_DEFAULT; - event.op = EVENT_PLAY; - event.time = 0; - - _vm->_events->queue(&event); - } else { - event.type = ONESHOT_EVENT; - event.code = MUSIC_EVENT; - event.op = EVENT_STOP; - event.time = 0; - - _vm->_events->queue(&event); - } - - // Set scene background - event.type = ONESHOT_EVENT; - event.code = BG_EVENT; - event.op = EVENT_DISPLAY; - event.param = SET_PALETTE; - event.time = 0; - - _vm->_events->queue(&event); - - // Activate user interface - event.type = ONESHOT_EVENT; - event.code = INTERFACE_EVENT; - event.op = EVENT_ACTIVATE; - event.time = 0; - - _vm->_events->queue(&event); - - // Begin palette cycle animation if present - event.type = ONESHOT_EVENT; - event.code = PALANIM_EVENT; - event.op = EVENT_CYCLESTART; - event.time = 0; - - q_event = _vm->_events->queue(&event); - - // Show cursor - event.type = ONESHOT_EVENT; - event.code = CURSOR_EVENT; - event.op = EVENT_SHOW; - _vm->_events->chain(q_event, &event); - - // Start the scene main script - if (_desc.sceneScriptEntrypointNumber > 0) { - event.type = ONESHOT_EVENT; - event.code = SCRIPT_EVENT; - event.op = EVENT_EXEC_NONBLOCKING; - event.time = 0; - event.param = _desc.scriptModuleNumber; - event.param2 = _desc.sceneScriptEntrypointNumber; - event.param3 = 0; // Action - event.param4 = _sceneNumber; // Object - event.param5 = 0; // With Object - TODO: should be 'entrance' - event.param6 = 0; // Actor - TODO: should be VERB_ENTER - - _vm->_events->queue(&event); - } - - debug(0, "Scene started"); - break; - case SCENE_END: - break; - default: - warning("Scene::defaultScene(): Illegal scene procedure parameter"); - break; - } - - return 0; -} void Scene::loadSceneEntryList(const byte* resourcePointer, size_t resourceLength) { int i; diff --git a/saga/scene.h b/saga/scene.h index 437f98302bb..65cba6b3b4a 100644 --- a/saga/scene.h +++ b/saga/scene.h @@ -296,8 +296,6 @@ class Scene { int _sceneDoors[SCENE_DOORS_MAX]; - static int SC_defaultScene(int param, SCENE_INFO *scene_info, void *refCon); - int defaultScene(int param, SCENE_INFO *scene_info); public: ObjectMap *_actionMap;