aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/saga/interface.cpp18
-rw-r--r--engines/saga/scene.cpp67
-rw-r--r--engines/saga/scene.h3
-rw-r--r--engines/saga/script.h1
-rw-r--r--engines/saga/sfuncs.cpp67
5 files changed, 93 insertions, 63 deletions
diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp
index 150bf55111..bb1de8c70a 100644
--- a/engines/saga/interface.cpp
+++ b/engines/saga/interface.cpp
@@ -652,6 +652,12 @@ bool Interface::processAscii(uint16 ascii) {
_protectHash = (_protectHash << 1) + toupper(*p);
}
break;
+ case kPanelPlacard:
+ if (_vm->getGameType() == GType_IHNM) {
+ // Any keypress here returns the user back to the game
+ _vm->_scene->clearPsychicProfile();
+ }
+ break;
}
return false;
}
@@ -1548,7 +1554,10 @@ void Interface::update(const Point& mousePoint, int updateFlag) {
_vm->_actor->abortSpeech();
if (_vm->_scene->isInIntro() || _fadeMode == kFadeOut || !_active) {
- return;
+ // When opening the psychic profile, the interface is locked (_active is false)
+ // Don't return if the psychic profile is up, so that mouse clicks can be processed
+ if (!(_vm->getGameType() == GType_IHNM && _panelMode == kPanelPlacard))
+ return;
}
if (_statusTextInput) {
@@ -1694,6 +1703,13 @@ void Interface::update(const Point& mousePoint, int updateFlag) {
// No mouse interaction
break;
+ case kPanelPlacard:
+ if (_vm->getGameType() == GType_IHNM) {
+ // Any mouse click here returns the user back to the game
+ if (updateFlag & UPDATE_MOUSECLICK)
+ _vm->_scene->clearPsychicProfile();
+ }
+ break;
}
_lastMousePoint = mousePoint;
diff --git a/engines/saga/scene.cpp b/engines/saga/scene.cpp
index 041553431b..2d85642891 100644
--- a/engines/saga/scene.cpp
+++ b/engines/saga/scene.cpp
@@ -1284,4 +1284,71 @@ 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::clearPsychicProfile() {
+ _vm->_scene->clearPlacard();
+ _vm->_actor->showActors(false);
+ _vm->_gfx->restorePalette();
+ _vm->_scene->restoreScene();
+ _vm->_interface->setMode(kPanelMain);
+ _vm->_interface->activate();
+}
+
} // End of namespace Saga
diff --git a/engines/saga/scene.h b/engines/saga/scene.h
index 99168e6504..d6414e5759 100644
--- a/engines/saga/scene.h
+++ b/engines/saga/scene.h
@@ -340,6 +340,9 @@ class Scene {
return _vm->getDisplayInfo().sceneHeight;
}
+ void clearPlacard();
+ void clearPsychicProfile();
+
private:
void loadScene(LoadSceneParams *loadSceneParams);
void loadSceneDescriptor(uint32 resourceId);
diff --git a/engines/saga/script.h b/engines/saga/script.h
index 5adfb6181a..b9864fb227 100644
--- a/engines/saga/script.h
+++ b/engines/saga/script.h
@@ -380,6 +380,7 @@ public:
setPointerVerb();
}
int getVerbType(VerbTypes verbType);
+ TextListEntry *getPlacardTextEntry() { return _placardTextEntry; }
private:
// When reading or writing data to the common buffer, we have to use a
diff --git a/engines/saga/sfuncs.cpp b/engines/saga/sfuncs.cpp
index 5bbe5d3c5b..f6aa21cb02 100644
--- a/engines/saga/sfuncs.cpp
+++ b/engines/saga/sfuncs.cpp
@@ -1315,11 +1315,6 @@ void Script::sfPlacard(SCRIPTFUNC_PARAMS) {
Event event;
Event *q_event;
- if (_vm->getGameType() == GType_IHNM) {
- warning("Psychic profile is not implemented");
- return;
- }
-
thread->wait(kWaitTypePlacard);
_vm->_interface->rememberMode();
@@ -1416,64 +1411,9 @@ void Script::sfPlacard(SCRIPTFUNC_PARAMS) {
// Script function #49 (0x31)
void Script::sfPlacardOff(SCRIPTFUNC_PARAMS) {
- static PalEntry cur_pal[PAL_ENTRIES];
- PalEntry *pal;
- Event event;
- Event *q_event;
-
thread->wait(kWaitTypePlacard);
- _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 = _placardTextEntry;
-
- 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);
-
+ _vm->_scene->clearPlacard();
}
void Script::sfPsychicProfile(SCRIPTFUNC_PARAMS) {
@@ -1490,6 +1430,7 @@ void Script::sfPsychicProfile(SCRIPTFUNC_PARAMS) {
_vm->_interface->rememberMode();
_vm->_interface->setMode(kPanelPlacard);
+ _vm->_gfx->savePalette();
stringId = thread->pop();
@@ -1576,7 +1517,9 @@ void Script::sfPsychicProfile(SCRIPTFUNC_PARAMS) {
}
void Script::sfPsychicProfileOff(SCRIPTFUNC_PARAMS) {
- SF_stub("sfPsychicProfileOff", thread, nArgs);
+ thread->wait(kWaitTypePlacard);
+
+ _vm->_scene->clearPsychicProfile();
}
// Script function #50 (0x32)