From c84ff65720f62810d54253ddf232d2e5d33a843f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 14 Sep 2007 12:42:47 +0000 Subject: Removed the RF_PLACARD flag. Also, simplified sfPlaceActor and removed a non needed check svn-id: r28901 --- engines/saga/events.cpp | 5 ++++- engines/saga/events.h | 1 + engines/saga/interface.cpp | 2 +- engines/saga/render.cpp | 8 ++++---- engines/saga/render.h | 9 ++++----- engines/saga/scene.cpp | 34 +++++++++------------------------- engines/saga/sfuncs.cpp | 21 ++------------------- 7 files changed, 25 insertions(+), 55 deletions(-) (limited to 'engines') diff --git a/engines/saga/events.cpp b/engines/saga/events.cpp index 298ce6acdb..c36db47620 100644 --- a/engines/saga/events.cpp +++ b/engines/saga/events.cpp @@ -390,7 +390,7 @@ int Events::handleOneShot(Event *event) { free(buf); free(resourceData); - // Draw the scene. It won't be drawn by Render::drawScene(), as the RF_PLACARD is set + // Draw the scene. It won't be drawn by Render::drawScene(), as a placard is up _vm->_scene->draw(); } break; @@ -471,6 +471,9 @@ int Events::handleOneShot(Event *event) { case kEventSetFadeMode: _vm->_interface->setFadeMode(event->param); break; + case kEventRestoreMode: + _vm->_interface->restoreMode(); + break; default: break; } diff --git a/engines/saga/events.h b/engines/saga/events.h index 7e9e5e6cc1..36130236b4 100644 --- a/engines/saga/events.h +++ b/engines/saga/events.h @@ -92,6 +92,7 @@ enum EventOps { kEventSetStatus = 3, kEventClearStatus = 4, kEventSetFadeMode = 5, + kEventRestoreMode = 6, // ACTOR events kEventMove = 1, // SCRIPT events diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp index 070cdd12da..201ae58659 100644 --- a/engines/saga/interface.cpp +++ b/engines/saga/interface.cpp @@ -713,7 +713,7 @@ 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)) + if (_vm->_render->getFlags() & RF_MAP || _vm->_interface->getMode() == kPanelPlacard) return; strncpy(_statusText, text, STATUS_TEXT_LEN); diff --git a/engines/saga/render.cpp b/engines/saga/render.cpp index 930476b4e2..7a56fc71c5 100644 --- a/engines/saga/render.cpp +++ b/engines/saga/render.cpp @@ -85,11 +85,11 @@ void Render::drawScene() { // Get mouse coordinates mousePoint = _vm->mousePos(); - if (!(_flags & (RF_DEMO_SUBST | RF_PLACARD | RF_MAP))) { - // Display scene background - _vm->_scene->draw(); - + if (!(_flags & (RF_DEMO_SUBST | RF_MAP) || _vm->_interface->getMode() == kPanelPlacard)) { if (_vm->_interface->getFadeMode() != kFadeOut) { + // Display scene background + _vm->_scene->draw(); + if (_vm->_puzzle->isActive()) { _vm->_puzzle->movePiece(mousePoint); _vm->_actor->drawSpeech(); diff --git a/engines/saga/render.h b/engines/saga/render.h index 4c6e3ee5b1..95abc2e4df 100644 --- a/engines/saga/render.h +++ b/engines/saga/render.h @@ -39,11 +39,10 @@ enum RENDER_FLAGS { RF_OBJECTMAP_TEST = (1 << 3), RF_RENDERPAUSE = (1 << 4), RF_GAMEPAUSE = (1 << 5), - RF_PLACARD = (1 << 6), - RF_ACTOR_PATH_TEST = (1 << 7), - RF_MAP = (1 << 8), - RF_DISABLE_ACTORS = (1 << 9), - RF_DEMO_SUBST = (1 << 10) + RF_ACTOR_PATH_TEST = (1 << 6), + RF_MAP = (1 << 7), + RF_DISABLE_ACTORS = (1 << 8), + RF_DEMO_SUBST = (1 << 9) }; class Render { diff --git a/engines/saga/scene.cpp b/engines/saga/scene.cpp index 7bf68cdd53..1cc1eeda02 100644 --- a/engines/saga/scene.cpp +++ b/engines/saga/scene.cpp @@ -739,15 +739,6 @@ void Scene::loadScene(LoadSceneParams *loadSceneParams) { q_event = NULL; - //fix placard bug - //i guess we should remove RF_PLACARD flag - and use _interface->getMode() - event.type = kEvTOneshot; - event.code = kGraphicsEvent; - event.op = kEventClearFlag; - event.param = RF_PLACARD; - - q_event = _vm->_events->chain(q_event, &event); - if (loadSceneParams->transitionType == kTransitionFade) { _vm->_interface->setFadeMode(kFadeOut); @@ -1335,8 +1326,6 @@ void Scene::clearPlacard() { Event event; Event *q_event; - _vm->_interface->restoreMode(); - _vm->_gfx->getCurrentPal(cur_pal); event.type = kEvTImmediate; @@ -1348,13 +1337,6 @@ void Scene::clearPlacard() { 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; @@ -1362,6 +1344,14 @@ void Scene::clearPlacard() { q_event = _vm->_events->chain(q_event, &event); + event.type = kEvTImmediate; + event.code = kInterfaceEvent; + event.op = kEventRestoreMode; + event.time = 0; + event.duration = 0; + + q_event = _vm->_events->chain(q_event, &event); + _vm->_scene->getBGPal(pal); event.type = kEvTImmediate; @@ -1425,13 +1415,6 @@ void Scene::showPsychicProfile(const char *text) { 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; @@ -1484,6 +1467,7 @@ void Scene::showPsychicProfile(const char *text) { void Scene::clearPsychicProfile() { if (_vm->_interface->getMode() == kPanelPlacard || _vm->getGameId() == GID_IHNM_DEMO) { + _vm->_interface->restoreMode(); _vm->_scene->clearPlacard(); _vm->_scene->_textList.clear(); _vm->_render->setFlag(RF_DISABLE_ACTORS); diff --git a/engines/saga/sfuncs.cpp b/engines/saga/sfuncs.cpp index a63045944f..356121001c 100644 --- a/engines/saga/sfuncs.cpp +++ b/engines/saga/sfuncs.cpp @@ -1054,26 +1054,16 @@ void Script::sfPlaceActor(SCRIPTFUNC_PARAMS) { ActorData *actor = _vm->_actor->getActor(actorId); actor->_location.x = thread->pop(); actor->_location.y = thread->pop(); - int actorDirection = thread->pop(); + actor->_facingDirection = actor->_actionDirection = thread->pop(); int frameType = thread->pop(); int frameOffset = thread->pop(); ActorFrameRange *frameRange; debug(1, "sfPlaceActor(id = 0x%x, x=%d, y=%d, dir=%d, frameType=%d, frameOffset=%d)", actorId, actor->_location.x, - actor->_location.y, actorDirection, frameType, frameOffset); - - actor->_facingDirection = actor->_actionDirection = actorDirection; - - if (!actor->_frames) - _vm->_actor->loadActorResources(actor); //? is not it already loaded ? + actor->_location.y, actor->_facingDirection, frameType, frameOffset); if (frameType >= 0) { frameRange = _vm->_actor->getActorFrameRange(actorId, frameType); - - if (frameRange->frameCount <= frameOffset) { - warning("Wrong frameOffset 0x%X", frameOffset); - } - actor->_frameNumber = frameRange->frameIndex + frameOffset; actor->_currentAction = kActionFreeze; } else { @@ -1207,13 +1197,6 @@ void Script::sfPlacard(SCRIPTFUNC_PARAMS) { 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); - event.type = kEvTOneshot; event.code = kGraphicsEvent; event.op = kEventFillRect; -- cgit v1.2.3