diff options
-rw-r--r-- | saga/interface.cpp | 26 | ||||
-rw-r--r-- | saga/interface.h | 3 | ||||
-rw-r--r-- | saga/render.cpp | 2 | ||||
-rw-r--r-- | saga/scene.cpp | 83 | ||||
-rw-r--r-- | saga/sfuncs.cpp | 67 |
5 files changed, 113 insertions, 68 deletions
diff --git a/saga/interface.cpp b/saga/interface.cpp index 3f7df23ef4..8b4687d283 100644 --- a/saga/interface.cpp +++ b/saga/interface.cpp @@ -297,6 +297,10 @@ void Interface::setMode(int mode) { case kPanelMap: mapPanelShow(); break; + case kPanelSceneSubstitute: + _vm->_render->setFlag(RF_PLACARD); + _vm->_gfx->getCurrentPal(_mapSavedPal); + break; } draw(); @@ -441,6 +445,15 @@ bool Interface::processAscii(uint16 ascii, bool synthetic) { case kPanelMap: mapPanelClean(); break; + case kPanelSceneSubstitute: + if (ascii == 13) { + _vm->_render->clearFlag(RF_PLACARD); + _vm->_gfx->setPalette(_mapSavedPal); + setMode(kPanelMain); + } else if (ascii == 'q' || ascii == 'Q') { + _vm->shutDown(); + } + break; } return false; } @@ -483,6 +496,9 @@ void Interface::setStatusText(const char *text, int statusColor) { assert(text != NULL); assert(strlen(text) < STATUS_TEXT_LEN); + if (_vm->_render->getFlags() & (RF_PLACARD | RF_MAP)) + return; + strncpy(_statusText, text, STATUS_TEXT_LEN); _statusOnceColor = statusColor; drawStatusBar(); @@ -1293,6 +1309,14 @@ void Interface::update(const Point& mousePoint, int updateFlag) { mapPanelClean(); } + if (_panelMode == kPanelSceneSubstitute) { + if (updateFlag & UPDATE_MOUSECLICK) { + _vm->_render->clearFlag(RF_PLACARD); + _vm->_gfx->setPalette(_mapSavedPal); + setMode(kPanelMain); + } + } + _lastMousePoint = mousePoint; } @@ -1426,7 +1450,7 @@ void Interface::handleMainUpdate(const Point& mousePoint) { } changed = true; } else { - _vm->_script->whichObject(mousePoint); + _vm->_script->whichObject(mousePoint); } changed = changed || (panelButton != _mainPanel.currentButton); diff --git a/saga/interface.h b/saga/interface.h index d79f1b6761..f931c3c959 100644 --- a/saga/interface.h +++ b/saga/interface.h @@ -68,7 +68,8 @@ enum PanelModes { kPanelConverse, kPanelProtect, kPanelPlacard, - kPanelMap + kPanelMap, + kPanelSceneSubstitute // kPanelInventory }; diff --git a/saga/render.cpp b/saga/render.cpp index bd73296ff8..5be861ee7e 100644 --- a/saga/render.cpp +++ b/saga/render.cpp @@ -82,7 +82,7 @@ void Render::drawScene() { // Get mouse coordinates mousePoint = _vm->mousePos(); - if (/*_vm->_interface->getMode() != kPanelPlacard*/!(_flags & (RF_PLACARD | RF_MAP))) { + if (!(_flags & (RF_PLACARD | RF_MAP))) { // Display scene background _vm->_scene->draw(); diff --git a/saga/scene.cpp b/saga/scene.cpp index 1d286270cd..74b140ffc6 100644 --- a/saga/scene.cpp +++ b/saga/scene.cpp @@ -44,6 +44,8 @@ #include "saga/rscfile.h" #include "saga/resnames.h" +#include "graphics/ilbm.h" + namespace Saga { static int initSceneDoors[SCENE_DOORS_MAX] = { @@ -305,7 +307,88 @@ void Scene::skipScene() { } } +static struct SceneSubstitutes { + int sceneId; + const char *message; + const char *name; + const char *image; +} sceneSubstitutes[] = { + { + 7, + "Tycho says he knows much about the northern lands. Can Rif convince " + "the Dog to share this knowledge?", + "The Home of Tycho Northpaw", + "tycho.bbm" + }, + + { + 27, + "The scene of the crime may hold many clues, but will the servants of " + "the Sanctuary trust Rif?", + "The Sanctuary of the Orb", + "sanctuar.bbm" + }, + + { + 5, + "The Rats hold many secrets that could guide Rif on his quest -- assuming " + "he can get past the doorkeeper.", + "The Rat Complex", + "ratdoor.bbm" + }, + + { + 2, + "The Ferrets enjoy making things and have the materials to do so. How can " + "that help Rif?", + "The Ferret Village", + "ferrets.bbm" + }, + + { + 67, + "What aid can the noble King of the Elks provide to Rif and his companions?", + "The Realm of the Forest King", + "elkenter.bbm" + }, + + { + 3, + "The King holds Rif's sweetheart hostage. Will the Boar provide any " + "assistance to Rif?", + "The Great Hall of the Boar King", + "boarhall.bbm" + } +}; + void Scene::changeScene(uint16 sceneNumber, int actorsEntrance, SceneTransitionType transitionType) { + // This is used for latter demos where all places on world map except + // Tent Faire are substituted with LBM picture and short description + // TODO: implement + for (int i = 0; i < ARRAYSIZE(sceneSubstitutes); i++) { + + if (sceneSubstitutes[i].sceneId == sceneNumber) { + Surface *backBuffer = _vm->_gfx->getBackBuffer(); + byte *pal; + Common::File file; + PalEntry cPal[PAL_ENTRIES]; + + if (file.open(sceneSubstitutes[i].image)) { + _vm->_interface->setStatusText("Click or Press Return to continue. Press Q to quit."); + _vm->_interface->setMode(kPanelSceneSubstitute); + Graphics::decodeILBM(file, *backBuffer, pal); + for (int j = 0; j < PAL_ENTRIES; j++) { + cPal[j].red = *pal++; + cPal[j].green = *pal++; + cPal[j].blue = *pal++; + } + _vm->_gfx->setPalette(cPal); + } + debug(0, "Scene %d substitute exists", sceneNumber); + return; + } + } + LoadSceneParams sceneParams; sceneParams.actorsEntrance = actorsEntrance; diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp index 757e27011d..d96daf63e7 100644 --- a/saga/sfuncs.cpp +++ b/saga/sfuncs.cpp @@ -307,7 +307,8 @@ void Script::sfStatusBar(SCRIPTFUNC_PARAMS) { // Script function #5 (0x05) void Script::sfMainMode(SCRIPTFUNC_PARAMS) { _vm->_actor->_centerActor = _vm->_actor->_protagonist; - showVerb(); + + showVerb(); _vm->_interface->activate(); _vm->_interface->setMode(kPanelMain); @@ -534,60 +535,6 @@ void Script::sfSetFollower(SCRIPTFUNC_PARAMS) { } } -static struct SceneSubstitutes { - int sceneId; - const char *message; - const char *name; - const char *image; -} sceneSubstitutes[] = { - { - 7, - "Tycho says he knows much about the northern lands. Can Rif convince " - "the Dog to share this knowledge?", - "The Home of Tycho Northpaw", - "tycho.bbm" - }, - - { - 27, - "The scene of the crime may hold many clues, but will the servants of " - "the Sanctuary trust Rif?", - "The Sanctuary of the Orb", - "sanctuar.bbm" - }, - - { - 5, - "The Rats hold many secrets that could guide Rif on his quest -- assuming " - "he can get past the doorkeeper.", - "The Rat Complex", - "ratdoor.bbm" - }, - - { - 2, - "The Ferrets enjoy making things and have the materials to do so. How can " - "that help Rif?", - "The Ferret Village", - "ferrets.bbm" - }, - - { - 67, - "What aid can the noble King of the Elks provide to Rif and his companions?", - "The Realm of the Forest King", - "elkenter.bbm" - }, - - { - 3, - "The King holds Rif's sweetheart hostage. Will the Boar provide any " - "assistance to Rif?", - "The Great Hall of the Boar King", - "boarhall.bbm" - } -}; - // Script function #16 (0x10) void Script::sfScriptGotoScene(SCRIPTFUNC_PARAMS) { int16 sceneNumber; @@ -610,16 +557,6 @@ void Script::sfScriptGotoScene(SCRIPTFUNC_PARAMS) { _vm->_interface->setMode(kPanelMain); } - // This is used for latter demos where all places on world map except - // Tent Faire are substituted with LBM picture and short description - // TODO: implement - for (int i = 0; i < ARRAYSIZE(sceneSubstitutes); i++) { - - if (sceneSubstitutes[i].sceneId == sceneNumber) { - debug(0, "Scene %d substitute exists", sceneNumber); - } - } - _vm->_scene->changeScene(sceneNumber, entrance, (sceneNumber == ITE_SCENE_ENDCREDIT1) ? kTransitionFade : kTransitionNoFade); //TODO: placard stuff |