aboutsummaryrefslogtreecommitdiff
path: root/saga
diff options
context:
space:
mode:
authorEugene Sandulenko2005-01-07 00:57:43 +0000
committerEugene Sandulenko2005-01-07 00:57:43 +0000
commit1fe593995d98939c0d2e2dc2d6c6e11b647e1ca0 (patch)
tree01bb948cbcbbaf729cb167ad407c4f4f5c1d9bd2 /saga
parentd5d801b01c2990f8e07e42abebd9ccbf33d39407 (diff)
downloadscummvm-rg350-1fe593995d98939c0d2e2dc2d6c6e11b647e1ca0.tar.gz
scummvm-rg350-1fe593995d98939c0d2e2dc2d6c6e11b647e1ca0.tar.bz2
scummvm-rg350-1fe593995d98939c0d2e2dc2d6c6e11b647e1ca0.zip
o Fix for popped up actors at initial scene fade out
o Stub for new Wyrmkeep demos with substituted scenes o Converted some script func parameters to apropriate types o More panel fixes svn-id: r16472
Diffstat (limited to 'saga')
-rw-r--r--saga/events.cpp3
-rw-r--r--saga/events.h1
-rw-r--r--saga/input.cpp2
-rw-r--r--saga/interface.cpp54
-rw-r--r--saga/interface.h11
-rw-r--r--saga/render.cpp26
-rw-r--r--saga/scene.cpp18
-rw-r--r--saga/sfuncs.cpp74
8 files changed, 152 insertions, 37 deletions
diff --git a/saga/events.cpp b/saga/events.cpp
index 3babfcbc8c..2c2c5683d5 100644
--- a/saga/events.cpp
+++ b/saga/events.cpp
@@ -384,6 +384,9 @@ int Events::handleOneShot(EVENT *event) {
_vm->_interface->setStatusText("");
_vm->_interface->drawStatusBar(_vm->_gfx->getBackBuffer());
break;
+ case EVENT_RESTORE_MODE:
+ _vm->_interface->restoreMode();
+ break;
default:
break;
}
diff --git a/saga/events.h b/saga/events.h
index 876241fc62..58d3f9ee99 100644
--- a/saga/events.h
+++ b/saga/events.h
@@ -86,6 +86,7 @@ enum EVENT_OPS {
EVENT_DEACTIVATE = 2,
EVENT_SET_STATUS = 3,
EVENT_CLEAR_STATUS = 4,
+ EVENT_RESTORE_MODE = 5,
// ACTOR events
EVENT_MOVE = 1,
// SCRIPT events
diff --git a/saga/input.cpp b/saga/input.cpp
index e8d391a635..e63e362e9f 100644
--- a/saga/input.cpp
+++ b/saga/input.cpp
@@ -87,7 +87,7 @@ int SagaEngine::processInput() {
switch (_interface->getMode()) {
case kPanelNull:
if (_scene->isInDemo())
- _scene->skipScene();
+ _scene->skipScene();
else
_actor->abortAllSpeeches();
break;
diff --git a/saga/interface.cpp b/saga/interface.cpp
index 943b28e151..b20334635e 100644
--- a/saga/interface.cpp
+++ b/saga/interface.cpp
@@ -237,8 +237,9 @@ Interface::Interface(SagaEngine *vm) : _vm(vm), _initialized(false) {
_activeVerb = I_VERB_WALKTO;
- _active = 0;
- _panelMode = _savedMode = _lockedMode = kPanelNull;
+ _active = false;
+ _panelMode = _lockedMode = kPanelNull;
+ _savedMode = -1;
_inMainMode = false;
*_statusText = 0;
@@ -259,29 +260,64 @@ Interface::~Interface(void) {
}
int Interface::activate() {
- _active = 1;
- draw();
+ if (!_active) {
+ _active = true;
+ _vm->_script->_skipSpeeches = false;
+ _vm->_gfx->showCursor(true);
+ unlockMode();
+ if (_panelMode == kPanelMain)
+ ;// show save reminder
+ draw();
+ }
return SUCCESS;
}
int Interface::deactivate() {
- _active = 0;
+ if (_active) {
+ _active = false;
+ _vm->_gfx->showCursor(false);
+ lockMode();
+ setMode(kPanelNull);
+ }
return SUCCESS;
}
-int Interface::setMode(int mode) {
- // TODO: Is this where we should hide/show the mouse cursor?
+void Interface::rememberMode() {
+ assert (_savedMode == -1);
+
+ _savedMode = _panelMode;
+}
- _panelMode = mode;
+void Interface::restoreMode() {
+ assert (_savedMode != -1);
+
+ _panelMode = _savedMode;
+ _savedMode = -1;
+
+ draw();
+}
+
+int Interface::setMode(int mode, bool force) {
+ // TODO: Is this where we should hide/show the mouse cursor?
+ int newmode = mode;
if (_panelMode == kPanelConverse)
_inMainMode = false;
else if (_panelMode == kPanelInventory) {
_inMainMode = true;
- _panelMode = kPanelMain;
+ newmode = kPanelMain;
+ }
+
+ // This lets us to prevents actors to pop up during initial
+ // scene fade in.
+ if (_savedMode != -1 && !force) {
+ _savedMode = newmode;
+ debug(0, "Saved mode: %d. my mode is %d", newmode, _panelMode);
}
+ else
+ _panelMode = newmode;
draw();
diff --git a/saga/interface.h b/saga/interface.h
index f827191fa8..8939566bf6 100644
--- a/saga/interface.h
+++ b/saga/interface.h
@@ -113,7 +113,8 @@ enum PANEL_MODES {
kPanelProtect,
kPanelPlacard,
kPanelMap,
- kPanelInventory
+ kPanelInventory,
+ kPanelFade
};
enum BUTTON_FLAGS {
@@ -208,10 +209,10 @@ public:
int registerLang();
int activate();
int deactivate();
- int setMode(int mode);
+ int setMode(int mode, bool force = false);
int getMode(void) { return _panelMode; }
- void rememberMode() { _savedMode = _panelMode; }
- void restoreMode() { _panelMode = _savedMode; }
+ void rememberMode();
+ void restoreMode();
void lockMode() { _lockedMode = _panelMode; }
void unlockMode() { _panelMode = _lockedMode; }
bool isInMainMode() { return _inMainMode; }
@@ -239,7 +240,7 @@ private:
SagaEngine *_vm;
bool _initialized;
- int _active;
+ bool _active;
RSCFILE_CONTEXT *_interfaceContext;
INTERFACE_DESC _iDesc;
int _panelMode;
diff --git a/saga/render.cpp b/saga/render.cpp
index 7d75de1efa..67409add72 100644
--- a/saga/render.cpp
+++ b/saga/render.cpp
@@ -126,18 +126,20 @@ int Render::drawScene() {
// Display scene background
_vm->_scene->draw(backbuf_surface);
- // Display scene maps, if applicable
- if (getFlags() & RF_OBJECTMAP_TEST) {
- if (_vm->_scene->_objectMap)
- _vm->_scene->_objectMap->draw(backbuf_surface, mouse_pt, _vm->_gfx->getWhite(), _vm->_gfx->getBlack());
- if (_vm->_scene->_actionMap)
- _vm->_scene->_actionMap->draw(backbuf_surface, _vm->_gfx->matchColor(RGB_RED));
- }
-
- // Draw queued actors
- _vm->_actor->drawActors();
- if (getFlags() & RF_ACTOR_PATH_TEST) {
- _vm->_actor->drawPathTest();
+ if (_vm->_interface->getMode() != kPanelFade) {
+ // Display scene maps, if applicable
+ if (getFlags() & RF_OBJECTMAP_TEST) {
+ if (_vm->_scene->_objectMap)
+ _vm->_scene->_objectMap->draw(backbuf_surface, mouse_pt, _vm->_gfx->getWhite(), _vm->_gfx->getBlack());
+ if (_vm->_scene->_actionMap)
+ _vm->_scene->_actionMap->draw(backbuf_surface, _vm->_gfx->matchColor(RGB_RED));
+ }
+
+ // Draw queued actors
+ _vm->_actor->drawActors();
+ if (getFlags() & RF_ACTOR_PATH_TEST) {
+ _vm->_actor->drawPathTest();
+ }
}
}
diff --git a/saga/scene.cpp b/saga/scene.cpp
index 1d8527db09..c4d8102c5a 100644
--- a/saga/scene.cpp
+++ b/saga/scene.cpp
@@ -611,6 +611,9 @@ int Scene::loadScene(int scene_num, int load_flag, SCENE_PROC scene_proc, SCENE_
EVENT *q_event;
static PALENTRY current_pal[PAL_ENTRIES];
+ _vm->_interface->rememberMode();
+ _vm->_interface->setMode(kPanelFade, true);
+
// Fade to black out
_vm->_gfx->getCurrentPal(current_pal);
event.type = IMMEDIATE_EVENT;
@@ -640,6 +643,14 @@ int Scene::loadScene(int scene_num, int load_flag, SCENE_PROC scene_proc, SCENE_
event.duration = 0;
q_event = _vm->_events->chain(q_event, &event);
+ // Restore interface mode
+ event.type = IMMEDIATE_EVENT;
+ event.code = INTERFACE_EVENT;
+ event.op = EVENT_RESTORE_MODE;
+ event.time = 0;
+ event.duration = 0;
+ q_event = _vm->_events->chain(q_event, &event);
+
// Start the scene pre script, but stay with black palette
if (_desc.startScriptNum > 0) {
event.type = ONESHOT_EVENT;
@@ -652,7 +663,7 @@ int Scene::loadScene(int scene_num, int load_flag, SCENE_PROC scene_proc, SCENE_
event.param4 = 0; // With Object - TODO: should be 'entrance'
event.param5 = 0; // Actor
- _vm->_events->chain(q_event, &event);
+ q_event = _vm->_events->chain(q_event, &event);
}
// Fade in from black to the scene background palette
@@ -1046,7 +1057,10 @@ int Scene::defaultScene(int param, SCENE_INFO *scene_info) {
EVENT event;
EVENT *q_event;
- _inGame = true;
+ if (!_inGame) {
+ _inGame = true;
+ _vm->_interface->setMode(kPanelInventory);
+ }
switch (param) {
case SCENE_BEGIN:
diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp
index d4162ccfd4..53fd78ee87 100644
--- a/saga/sfuncs.cpp
+++ b/saga/sfuncs.cpp
@@ -366,19 +366,77 @@ int Script::sfSetFollower(SCRIPTFUNC_PARAMS) {
return SUCCESS;
}
+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)
int Script::SF_gotoScene(SCRIPTFUNC_PARAMS) {
- ScriptDataWord param1 = thread->pop();
- ScriptDataWord param2 = thread->pop();
+ int16 sceneNum = getSWord(thread->pop());
+ int16 entrance = getSWord(thread->pop());
- debug(1, "stub: SF_gotoScene(%d, %d)", param1, param2);
+ for (int i = 0; i < ARRAYSIZE(sceneSubstitutes); i++)
+ if (sceneSubstitutes[i].sceneId == sceneNum)
+ debug(0, "Scene %d substitute exists", sceneNum);
+
+ debug(1, "stub: SF_gotoScene(%d, %d)", sceneNum, entrance);
return SUCCESS;
}
// Script function #17 (0x11)
int Script::SF_setObjImage(SCRIPTFUNC_PARAMS) {
- ScriptDataWord obj_param = thread->pop();
- ScriptDataWord sprite_param = thread->pop();
+ int16 obj_param = getSWord(thread->pop());
+ int16 sprite_param = getSWord(thread->pop());
int index = obj_param & 0x1FFF;
@@ -394,8 +452,8 @@ int Script::SF_setObjImage(SCRIPTFUNC_PARAMS) {
// Script function #18 (0x12)
int Script::SF_setObjName(SCRIPTFUNC_PARAMS) {
- ScriptDataWord obj_param = thread->pop();
- ScriptDataWord name_param = thread->pop();
+ int obj_param = getSWord(thread->pop());
+ int name_param = getSWord(thread->pop());
int index = obj_param & 0x1FFF;
@@ -409,7 +467,7 @@ int Script::SF_setObjName(SCRIPTFUNC_PARAMS) {
// Script function #19 (0x13)
int Script::SF_getObjImage(SCRIPTFUNC_PARAMS) {
- ScriptDataWord param = thread->pop();
+ int param = getSWord(thread->pop());
int index = param & 0x1FFF;
if (index >= ARRAYSIZE(ObjectTable)) {