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
This commit is contained in:
Eugene Sandulenko 2005-01-07 00:57:43 +00:00
parent d5d801b01c
commit 1fe593995d
8 changed files with 151 additions and 36 deletions

View File

@ -384,6 +384,9 @@ int Events::handleOneShot(EVENT *event) {
_vm->_interface->setStatusText(""); _vm->_interface->setStatusText("");
_vm->_interface->drawStatusBar(_vm->_gfx->getBackBuffer()); _vm->_interface->drawStatusBar(_vm->_gfx->getBackBuffer());
break; break;
case EVENT_RESTORE_MODE:
_vm->_interface->restoreMode();
break;
default: default:
break; break;
} }

View File

@ -86,6 +86,7 @@ enum EVENT_OPS {
EVENT_DEACTIVATE = 2, EVENT_DEACTIVATE = 2,
EVENT_SET_STATUS = 3, EVENT_SET_STATUS = 3,
EVENT_CLEAR_STATUS = 4, EVENT_CLEAR_STATUS = 4,
EVENT_RESTORE_MODE = 5,
// ACTOR events // ACTOR events
EVENT_MOVE = 1, EVENT_MOVE = 1,
// SCRIPT events // SCRIPT events

View File

@ -87,7 +87,7 @@ int SagaEngine::processInput() {
switch (_interface->getMode()) { switch (_interface->getMode()) {
case kPanelNull: case kPanelNull:
if (_scene->isInDemo()) if (_scene->isInDemo())
_scene->skipScene(); _scene->skipScene();
else else
_actor->abortAllSpeeches(); _actor->abortAllSpeeches();
break; break;

View File

@ -237,8 +237,9 @@ Interface::Interface(SagaEngine *vm) : _vm(vm), _initialized(false) {
_activeVerb = I_VERB_WALKTO; _activeVerb = I_VERB_WALKTO;
_active = 0; _active = false;
_panelMode = _savedMode = _lockedMode = kPanelNull; _panelMode = _lockedMode = kPanelNull;
_savedMode = -1;
_inMainMode = false; _inMainMode = false;
*_statusText = 0; *_statusText = 0;
@ -259,30 +260,65 @@ Interface::~Interface(void) {
} }
int Interface::activate() { int Interface::activate() {
_active = 1; if (!_active) {
draw(); _active = true;
_vm->_script->_skipSpeeches = false;
_vm->_gfx->showCursor(true);
unlockMode();
if (_panelMode == kPanelMain)
;// show save reminder
draw();
}
return SUCCESS; return SUCCESS;
} }
int Interface::deactivate() { int Interface::deactivate() {
_active = 0; if (_active) {
_active = false;
_vm->_gfx->showCursor(false);
lockMode();
setMode(kPanelNull);
}
return SUCCESS; return SUCCESS;
} }
int Interface::setMode(int mode) { void Interface::rememberMode() {
// TODO: Is this where we should hide/show the mouse cursor? assert (_savedMode == -1);
_panelMode = mode; _savedMode = _panelMode;
}
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) if (_panelMode == kPanelConverse)
_inMainMode = false; _inMainMode = false;
else if (_panelMode == kPanelInventory) { else if (_panelMode == kPanelInventory) {
_inMainMode = true; _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(); draw();
return SUCCESS; return SUCCESS;

View File

@ -113,7 +113,8 @@ enum PANEL_MODES {
kPanelProtect, kPanelProtect,
kPanelPlacard, kPanelPlacard,
kPanelMap, kPanelMap,
kPanelInventory kPanelInventory,
kPanelFade
}; };
enum BUTTON_FLAGS { enum BUTTON_FLAGS {
@ -208,10 +209,10 @@ public:
int registerLang(); int registerLang();
int activate(); int activate();
int deactivate(); int deactivate();
int setMode(int mode); int setMode(int mode, bool force = false);
int getMode(void) { return _panelMode; } int getMode(void) { return _panelMode; }
void rememberMode() { _savedMode = _panelMode; } void rememberMode();
void restoreMode() { _panelMode = _savedMode; } void restoreMode();
void lockMode() { _lockedMode = _panelMode; } void lockMode() { _lockedMode = _panelMode; }
void unlockMode() { _panelMode = _lockedMode; } void unlockMode() { _panelMode = _lockedMode; }
bool isInMainMode() { return _inMainMode; } bool isInMainMode() { return _inMainMode; }
@ -239,7 +240,7 @@ private:
SagaEngine *_vm; SagaEngine *_vm;
bool _initialized; bool _initialized;
int _active; bool _active;
RSCFILE_CONTEXT *_interfaceContext; RSCFILE_CONTEXT *_interfaceContext;
INTERFACE_DESC _iDesc; INTERFACE_DESC _iDesc;
int _panelMode; int _panelMode;

View File

@ -126,18 +126,20 @@ int Render::drawScene() {
// Display scene background // Display scene background
_vm->_scene->draw(backbuf_surface); _vm->_scene->draw(backbuf_surface);
// Display scene maps, if applicable if (_vm->_interface->getMode() != kPanelFade) {
if (getFlags() & RF_OBJECTMAP_TEST) { // Display scene maps, if applicable
if (_vm->_scene->_objectMap) if (getFlags() & RF_OBJECTMAP_TEST) {
_vm->_scene->_objectMap->draw(backbuf_surface, mouse_pt, _vm->_gfx->getWhite(), _vm->_gfx->getBlack()); if (_vm->_scene->_objectMap)
if (_vm->_scene->_actionMap) _vm->_scene->_objectMap->draw(backbuf_surface, mouse_pt, _vm->_gfx->getWhite(), _vm->_gfx->getBlack());
_vm->_scene->_actionMap->draw(backbuf_surface, _vm->_gfx->matchColor(RGB_RED)); if (_vm->_scene->_actionMap)
} _vm->_scene->_actionMap->draw(backbuf_surface, _vm->_gfx->matchColor(RGB_RED));
}
// Draw queued actors // Draw queued actors
_vm->_actor->drawActors(); _vm->_actor->drawActors();
if (getFlags() & RF_ACTOR_PATH_TEST) { if (getFlags() & RF_ACTOR_PATH_TEST) {
_vm->_actor->drawPathTest(); _vm->_actor->drawPathTest();
}
} }
} }

View File

@ -611,6 +611,9 @@ int Scene::loadScene(int scene_num, int load_flag, SCENE_PROC scene_proc, SCENE_
EVENT *q_event; EVENT *q_event;
static PALENTRY current_pal[PAL_ENTRIES]; static PALENTRY current_pal[PAL_ENTRIES];
_vm->_interface->rememberMode();
_vm->_interface->setMode(kPanelFade, true);
// Fade to black out // Fade to black out
_vm->_gfx->getCurrentPal(current_pal); _vm->_gfx->getCurrentPal(current_pal);
event.type = IMMEDIATE_EVENT; 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; event.duration = 0;
q_event = _vm->_events->chain(q_event, &event); 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 // Start the scene pre script, but stay with black palette
if (_desc.startScriptNum > 0) { if (_desc.startScriptNum > 0) {
event.type = ONESHOT_EVENT; 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.param4 = 0; // With Object - TODO: should be 'entrance'
event.param5 = 0; // Actor 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 // 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 event;
EVENT *q_event; EVENT *q_event;
_inGame = true; if (!_inGame) {
_inGame = true;
_vm->_interface->setMode(kPanelInventory);
}
switch (param) { switch (param) {
case SCENE_BEGIN: case SCENE_BEGIN:

View File

@ -366,19 +366,77 @@ int Script::sfSetFollower(SCRIPTFUNC_PARAMS) {
return SUCCESS; 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) // Script function #16 (0x10)
int Script::SF_gotoScene(SCRIPTFUNC_PARAMS) { int Script::SF_gotoScene(SCRIPTFUNC_PARAMS) {
ScriptDataWord param1 = thread->pop(); int16 sceneNum = getSWord(thread->pop());
ScriptDataWord param2 = 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; return SUCCESS;
} }
// Script function #17 (0x11) // Script function #17 (0x11)
int Script::SF_setObjImage(SCRIPTFUNC_PARAMS) { int Script::SF_setObjImage(SCRIPTFUNC_PARAMS) {
ScriptDataWord obj_param = thread->pop(); int16 obj_param = getSWord(thread->pop());
ScriptDataWord sprite_param = thread->pop(); int16 sprite_param = getSWord(thread->pop());
int index = obj_param & 0x1FFF; int index = obj_param & 0x1FFF;
@ -394,8 +452,8 @@ int Script::SF_setObjImage(SCRIPTFUNC_PARAMS) {
// Script function #18 (0x12) // Script function #18 (0x12)
int Script::SF_setObjName(SCRIPTFUNC_PARAMS) { int Script::SF_setObjName(SCRIPTFUNC_PARAMS) {
ScriptDataWord obj_param = thread->pop(); int obj_param = getSWord(thread->pop());
ScriptDataWord name_param = thread->pop(); int name_param = getSWord(thread->pop());
int index = obj_param & 0x1FFF; int index = obj_param & 0x1FFF;
@ -409,7 +467,7 @@ int Script::SF_setObjName(SCRIPTFUNC_PARAMS) {
// Script function #19 (0x13) // Script function #19 (0x13)
int Script::SF_getObjImage(SCRIPTFUNC_PARAMS) { int Script::SF_getObjImage(SCRIPTFUNC_PARAMS) {
ScriptDataWord param = thread->pop(); int param = getSWord(thread->pop());
int index = param & 0x1FFF; int index = param & 0x1FFF;
if (index >= ARRAYSIZE(ObjectTable)) { if (index >= ARRAYSIZE(ObjectTable)) {