aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2007-07-30 11:55:11 +0000
committerFilippos Karapetis2007-07-30 11:55:11 +0000
commit653cf4c971e740e9ce9955447aa8d18491544b18 (patch)
tree83566d766d423ffa4f7cc976db49d1c93abb68b2
parent36496dd467648d6345b08b78a99447429fa0f26a (diff)
downloadscummvm-rg350-653cf4c971e740e9ce9955447aa8d18491544b18.tar.gz
scummvm-rg350-653cf4c971e740e9ce9955447aa8d18491544b18.tar.bz2
scummvm-rg350-653cf4c971e740e9ce9955447aa8d18491544b18.zip
Initial support of the psychic profile in IHNM (still buggy)
svn-id: r28323
-rw-r--r--engines/saga/detection_tables.h4
-rw-r--r--engines/saga/saga.cpp3
-rw-r--r--engines/saga/saga.h1
-rw-r--r--engines/saga/sfuncs.cpp119
4 files changed, 126 insertions, 1 deletions
diff --git a/engines/saga/detection_tables.h b/engines/saga/detection_tables.h
index a304fb906a..b26a9b75d5 100644
--- a/engines/saga/detection_tables.h
+++ b/engines/saga/detection_tables.h
@@ -36,6 +36,7 @@ static const GameResourceDescription ITE_Resources = {
RID_ITE_MAIN_PANEL_SPRITES,
0, // Option panel sprites (IHNM only)
RID_ITE_DEFAULT_PORTRAITS,
+ 0, // Psychic profile background (IHNM only)
RID_ITE_MAIN_STRINGS,
RID_ITE_ACTOR_NAMES
};
@@ -51,6 +52,7 @@ static const GameResourceDescription ITEDemo_Resources = {
RID_ITEDEMO_MAIN_PANEL_SPRITES,
0, // Option panel sprites (IHNM only)
RID_ITEDEMO_DEFAULT_PORTRAITS,
+ 0, // Psychic profile background (IHNM only)
RID_ITEDEMO_MAIN_STRINGS,
RID_ITEDEMO_ACTOR_NAMES
};
@@ -270,6 +272,7 @@ static const GameResourceDescription IHNM_Resources = {
RID_IHNM_MAIN_PANEL_SPRITES,
RID_IHNM_OPTION_PANEL_SPRITES,
0, // Default portraits (ITE only)
+ RID_IHNM_PROFILE_BG,
RID_IHNM_MAIN_STRINGS,
0 // Actors strings (ITE only)
};
@@ -285,6 +288,7 @@ static const GameResourceDescription IHNMDEMO_Resources = {
RID_IHNMDEMO_MAIN_PANEL_SPRITES,
RID_IHNMDEMO_OPTION_PANEL_SPRITES,
0, // Default portraits (ITE only)
+ RID_IHNMDEMO_PROFILE_BG,
RID_IHNMDEMO_MAIN_STRINGS,
0 // Actors strings (ITE only)
};
diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp
index 23eb57d1c7..76731c201a 100644
--- a/engines/saga/saga.cpp
+++ b/engines/saga/saga.cpp
@@ -455,6 +455,9 @@ ColorId SagaEngine::KnownColor2ColorId(KnownColor knownColor) {
colorId = kITEColorTransBlack;
break;
+ case (kKnownColorBrightWhite):
+ colorId = kITEColorBrightWhite;
+ break;
case (kKnownColorBlack):
colorId = kIHNMColorBlack;
break;
diff --git a/engines/saga/saga.h b/engines/saga/saga.h
index cded648168..220a563c14 100644
--- a/engines/saga/saga.h
+++ b/engines/saga/saga.h
@@ -301,6 +301,7 @@ struct GameResourceDescription {
uint32 mainPanelSpritesResourceId;
uint32 optionPanelSpritesResourceId;
uint32 defaultPortraitsResourceId;
+ uint32 psychicProfileResourceId;
uint32 mainStringsResourceId;
uint32 actorsStringsResourceId;
};
diff --git a/engines/saga/sfuncs.cpp b/engines/saga/sfuncs.cpp
index caf13e0c9e..74ff8e88dc 100644
--- a/engines/saga/sfuncs.cpp
+++ b/engines/saga/sfuncs.cpp
@@ -40,6 +40,7 @@
#include "saga/render.h"
#include "saga/sound.h"
#include "saga/sndres.h"
+#include "saga/rscfile.h"
#include "saga/script.h"
#include "saga/objectmap.h"
@@ -1476,7 +1477,123 @@ void Script::sfPlacardOff(SCRIPTFUNC_PARAMS) {
}
void Script::sfPsychicProfile(SCRIPTFUNC_PARAMS) {
- SF_stub("sfPsychicProfile", thread, nArgs);
+ int stringId;
+ Surface *backBuffer = _vm->_gfx->getBackBuffer();
+ static PalEntry cur_pal[PAL_ENTRIES];
+ PalEntry *pal;
+ Event event;
+ Event *q_event;
+
+ // FIXME: This still needs work: the actors are shown while the psychic
+ // profile is shown and the text placement and color are incorrect
+
+ thread->wait(kWaitTypePlacard);
+
+ _vm->_interface->rememberMode();
+ _vm->_interface->setMode(kPanelPlacard);
+
+ stringId = thread->pop();
+
+ event.type = kEvTOneshot;
+ event.code = kCursorEvent;
+ event.op = kEventHide;
+
+ q_event = _vm->_events->queue(&event);
+
+ _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->chain(q_event, &event);
+
+ event.type = kEvTOneshot;
+ event.code = kInterfaceEvent;
+ event.op = kEventClearStatus;
+
+ 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
+ ResourceContext *context = _vm->_resource->getContext(GAME_RESOURCEFILE);
+
+ byte *resourceData;
+ size_t resourceDataLength;
+
+ _vm->_resource->loadResource(context, _vm->getResourceDescription()->psychicProfileResourceId, resourceData, resourceDataLength);
+
+ byte *buf;
+ size_t buflen;
+ int width;
+ int height;
+
+ _vm->decodeBGImage(resourceData, resourceDataLength, &buf, &buflen, &width, &height);
+
+ const PalEntry *palette = (const PalEntry *)_vm->getImagePal(resourceData, resourceDataLength);
+
+ Surface *bgSurface = _vm->_render->getBackGroundSurface();
+ const Rect rect(width, height);
+
+ bgSurface->blit(rect, buf);
+ _vm->_frameCount++;
+
+ _vm->_gfx->setPalette(palette);
+
+ free(buf);
+ free(resourceData);
+
+ // Put the text in the center of the viewport, assuming it will fit on
+ // one line. If we cannot make that assumption we'll need to extend
+ // the text drawing function so that it can center text around a point.
+ // It doesn't end up in exactly the same spot as the original did it,
+ // but it's close enough for now at least.
+
+ TextListEntry textEntry;
+
+ textEntry.knownColor = kKnownColorTransparent;
+ textEntry.effectKnownColor = kKnownColorBrightWhite;
+ textEntry.point.x = _vm->getDisplayWidth() / 2;
+ textEntry.point.y = (_vm->_scene->getHeight() - _vm->_font->getHeight(kKnownFontMedium)) / 2;
+ textEntry.font = kKnownFontVerb;
+ textEntry.flags = (FontEffectFlags)(kFontOutline | kFontCentered);
+ textEntry.text = thread->_strings->getString(stringId);
+
+ _placardTextEntry = _vm->_scene->_textList.addEntry(textEntry);
+
+ event.type = kEvTOneshot;
+ event.code = kTextEvent;
+ event.op = kEventDisplay;
+ 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 = kScriptEvent;
+ event.op = kEventThreadWake;
+ event.param = kWaitTypePlacard;
+
+ q_event = _vm->_events->chain(q_event, &event);
}
void Script::sfPsychicProfileOff(SCRIPTFUNC_PARAMS) {