[Scummvm-cvs-logs] SF.net SVN: scummvm: [28323] scummvm/trunk/engines/saga
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Mon Jul 30 13:55:11 CEST 2007
Revision: 28323
http://scummvm.svn.sourceforge.net/scummvm/?rev=28323&view=rev
Author: thebluegr
Date: 2007-07-30 04:55:11 -0700 (Mon, 30 Jul 2007)
Log Message:
-----------
Initial support of the psychic profile in IHNM (still buggy)
Modified Paths:
--------------
scummvm/trunk/engines/saga/detection_tables.h
scummvm/trunk/engines/saga/saga.cpp
scummvm/trunk/engines/saga/saga.h
scummvm/trunk/engines/saga/sfuncs.cpp
Modified: scummvm/trunk/engines/saga/detection_tables.h
===================================================================
--- scummvm/trunk/engines/saga/detection_tables.h 2007-07-30 10:33:17 UTC (rev 28322)
+++ scummvm/trunk/engines/saga/detection_tables.h 2007-07-30 11:55:11 UTC (rev 28323)
@@ -36,6 +36,7 @@
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 @@
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 @@
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 @@
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)
};
Modified: scummvm/trunk/engines/saga/saga.cpp
===================================================================
--- scummvm/trunk/engines/saga/saga.cpp 2007-07-30 10:33:17 UTC (rev 28322)
+++ scummvm/trunk/engines/saga/saga.cpp 2007-07-30 11:55:11 UTC (rev 28323)
@@ -455,6 +455,9 @@
colorId = kITEColorTransBlack;
break;
+ case (kKnownColorBrightWhite):
+ colorId = kITEColorBrightWhite;
+ break;
case (kKnownColorBlack):
colorId = kIHNMColorBlack;
break;
Modified: scummvm/trunk/engines/saga/saga.h
===================================================================
--- scummvm/trunk/engines/saga/saga.h 2007-07-30 10:33:17 UTC (rev 28322)
+++ scummvm/trunk/engines/saga/saga.h 2007-07-30 11:55:11 UTC (rev 28323)
@@ -301,6 +301,7 @@
uint32 mainPanelSpritesResourceId;
uint32 optionPanelSpritesResourceId;
uint32 defaultPortraitsResourceId;
+ uint32 psychicProfileResourceId;
uint32 mainStringsResourceId;
uint32 actorsStringsResourceId;
};
Modified: scummvm/trunk/engines/saga/sfuncs.cpp
===================================================================
--- scummvm/trunk/engines/saga/sfuncs.cpp 2007-07-30 10:33:17 UTC (rev 28322)
+++ scummvm/trunk/engines/saga/sfuncs.cpp 2007-07-30 11:55:11 UTC (rev 28323)
@@ -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::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) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list