diff options
author | David Corrales | 2007-08-05 19:34:20 +0000 |
---|---|---|
committer | David Corrales | 2007-08-05 19:34:20 +0000 |
commit | 6856535010bd2fa4449bcfde1c88dc06cd46e26f (patch) | |
tree | b81a2234c2beff0312c93e039d6cafda4babeca6 /engines/saga/scene.cpp | |
parent | 1400d28bfb37fc94f3c44dec0a4d0cef65fb8fb7 (diff) | |
parent | ec1803f838d5efc7decf75c05a1fb4a9633751e5 (diff) | |
download | scummvm-rg350-6856535010bd2fa4449bcfde1c88dc06cd46e26f.tar.gz scummvm-rg350-6856535010bd2fa4449bcfde1c88dc06cd46e26f.tar.bz2 scummvm-rg350-6856535010bd2fa4449bcfde1c88dc06cd46e26f.zip |
Merged fsnode with trunk: r27971:28460
svn-id: r28462
Diffstat (limited to 'engines/saga/scene.cpp')
-rw-r--r-- | engines/saga/scene.cpp | 202 |
1 files changed, 196 insertions, 6 deletions
diff --git a/engines/saga/scene.cpp b/engines/saga/scene.cpp index 362b212b14..c49fe546ee 100644 --- a/engines/saga/scene.cpp +++ b/engines/saga/scene.cpp @@ -570,8 +570,6 @@ void Scene::loadScene(LoadSceneParams *loadSceneParams) { _chapterPointsChanged = false; - _vm->_actor->showActors(false); - if ((_vm->getGameType() == GType_IHNM) && (loadSceneParams->chapter != NO_CHAPTER_CHANGE)) { if (loadSceneParams->loadFlag != kLoadBySceneNumber) { error("loadScene wrong usage"); @@ -581,7 +579,16 @@ void Scene::loadScene(LoadSceneParams *loadSceneParams) { _vm->_interface->setLeftPortrait(0); _vm->_anim->freeCutawayList(); - _vm->_script->freeModules(); + // FIXME: Freed script modules are not reloaded correctly when changing chapters. + // This is apparent when returning back to the character selection screen, + // where the scene script module is loaded incorrectly + // Don't free them for now, but free them on game exit, like ITE. + // This has no impact on the game itself (other than increased memory usage), + // as each chapter uses a different module slot + // TODO: Find out why the script modules are not loaded correctly when + // changing chapters and uncomment this again + //_vm->_script->freeModules(); + // deleteAllScenes(); // installSomeAlarm() @@ -591,10 +598,14 @@ void Scene::loadScene(LoadSceneParams *loadSceneParams) { _vm->_interface->addToInventory(IHNM_OBJ_PROFILE); _vm->_interface->activate(); - if (loadSceneParams->chapter == 8 || loadSceneParams->chapter == -1) - _vm->_interface->setMode(kPanelChapterSelection); - else + if (loadSceneParams->chapter == 8 || loadSceneParams->chapter == -1) { + if (_vm->getGameId() != GID_IHNM_DEMO) + _vm->_interface->setMode(kPanelChapterSelection); + else + _vm->_interface->setMode(kPanelNull); + } else { _vm->_interface->setMode(kPanelMain); + } _inGame = true; @@ -640,6 +651,15 @@ void Scene::loadScene(LoadSceneParams *loadSceneParams) { debug(3, "Loading scene number %d:", _sceneNumber); + if (_vm->getGameId() == GID_IHNM_DEMO && _sceneNumber == 144) { + // WORKAROUND for the non-interactive part of the IHNM demo: When restarting the + // non-interactive demo, opcode sfMainMode is incorrectly called. Therefore, if the + // starting scene of the non-interactive demo is loaded (scene 144), set panel to null + // and lock the user interface + _vm->_interface->deactivate(); + _vm->_interface->setMode(kPanelNull); + } + // Load scene descriptor and resource list resources if (_loadDescription) { debug(3, "Loading scene resource %i", _sceneResourceId); @@ -1282,4 +1302,174 @@ void Scene::loadSceneEntryList(const byte* resourcePointer, size_t resourceLengt } } +void Scene::clearPlacard() { + static PalEntry cur_pal[PAL_ENTRIES]; + PalEntry *pal; + Event event; + Event *q_event; + + _vm->_interface->restoreMode(); + + _vm->_gfx->getCurrentPal(cur_pal); + + event.type = kEvTImmediate; + event.code = kPalEvent; + event.op = kEventPalToBlack; + event.time = 0; + event.duration = kNormalFadeDuration; + event.data = cur_pal; + + q_event = _vm->_events->queue(&event); + + event.type = kEvTOneshot; + event.code = kGraphicsEvent; + event.op = kEventClearFlag; + event.param = RF_PLACARD; + + q_event = _vm->_events->chain(q_event, &event); + + event.type = kEvTOneshot; + event.code = kTextEvent; + event.op = kEventRemove; + event.data = _vm->_script->getPlacardTextEntry(); + + q_event = _vm->_events->chain(q_event, &event); + + _vm->_scene->getBGPal(pal); + + event.type = kEvTImmediate; + event.code = kPalEvent; + event.op = kEventBlackToPal; + event.time = 0; + event.duration = kNormalFadeDuration; + event.data = pal; + + q_event = _vm->_events->chain(q_event, &event); + + event.type = kEvTOneshot; + event.code = kCursorEvent; + event.op = kEventShow; + + q_event = _vm->_events->chain(q_event, &event); + + event.type = kEvTOneshot; + event.code = kScriptEvent; + event.op = kEventThreadWake; + event.param = kWaitTypePlacard; + + q_event = _vm->_events->chain(q_event, &event); +} + +void Scene::showPsychicProfile(const char *text) { + int textHeight; + static PalEntry cur_pal[PAL_ENTRIES]; + PalEntry *pal; + TextListEntry textEntry; + Event event; + Event *q_event; + + if (_vm->_interface->getMode() == kPanelPlacard) + return; + + _vm->_interface->rememberMode(); + _vm->_interface->setMode(kPanelPlacard); + _vm->_gfx->savePalette(); + + event.type = kEvTOneshot; + event.code = kCursorEvent; + event.op = kEventHide; + + q_event = _vm->_events->queue(&event); + + _vm->_gfx->getCurrentPal(cur_pal); + + event.type = kEvTImmediate; + event.code = kPalEvent; + event.op = kEventPalToBlack; + event.time = 0; + event.duration = kNormalFadeDuration; + event.data = cur_pal; + + q_event = _vm->_events->chain(q_event, &event); + + event.type = kEvTOneshot; + event.code = kInterfaceEvent; + event.op = kEventClearStatus; + + q_event = _vm->_events->chain(q_event, &event); + + event.type = kEvTOneshot; + event.code = kGraphicsEvent; + event.op = kEventSetFlag; + event.param = RF_PLACARD; + + q_event = _vm->_events->chain(q_event, &event); + + // Set the background and palette for the psychic profile + event.type = kEvTOneshot; + event.code = kPsychicProfileBgEvent; + + q_event = _vm->_events->chain(q_event, &event); + + _vm->_scene->_textList.clear(); + + if (text != NULL) { + textHeight = _vm->_font->getHeight(kKnownFontVerb, text, 226, kFontCentered); + + textEntry.knownColor = kKnownColorBlack; + textEntry.useRect = true; + textEntry.rect.left = 245; + textEntry.rect.setHeight(210 + 76); + textEntry.rect.setWidth(226); + textEntry.rect.top = 210 - textHeight; + textEntry.font = kKnownFontVerb; + textEntry.flags = (FontEffectFlags)(kFontCentered); + textEntry.text = text; + + TextListEntry *_psychicProfileTextEntry = _vm->_scene->_textList.addEntry(textEntry); + + event.type = kEvTOneshot; + event.code = kTextEvent; + event.op = kEventDisplay; + event.data = _psychicProfileTextEntry; + + q_event = _vm->_events->chain(q_event, &event); + } + + _vm->_scene->getBGPal(pal); + + event.type = kEvTImmediate; + event.code = kPalEvent; + event.op = kEventBlackToPal; + event.time = 0; + event.duration = kNormalFadeDuration; + event.data = pal; + + q_event = _vm->_events->chain(q_event, &event); + + event.type = kEvTOneshot; + event.code = kScriptEvent; + event.op = kEventThreadWake; + event.param = kWaitTypePlacard; + + q_event = _vm->_events->chain(q_event, &event); +} + +void Scene::clearPsychicProfile() { + if (_vm->_interface->getMode() == kPanelPlacard || _vm->getGameId() == GID_IHNM_DEMO) { + _vm->_scene->clearPlacard(); + _vm->_scene->_textList.clear(); + _vm->_actor->showActors(false); + _vm->_gfx->restorePalette(); + _vm->_scene->restoreScene(); + _vm->_interface->activate(); + } +} + +void Scene::showIHNMDemoSpecialScreen() { + _vm->_gfx->showCursor(true); + _vm->_interface->clearInventory(); + _vm->_scene->changeScene(150, 0, kTransitionFade); +} + } // End of namespace Saga |