diff options
author | Filippos Karapetis | 2007-07-30 13:19:46 +0000 |
---|---|---|
committer | Filippos Karapetis | 2007-07-30 13:19:46 +0000 |
commit | ba44fcbf6b5a209fd7d705ffcf678568bb049640 (patch) | |
tree | 6462d5ca9fd031aca1cf2ddcd02dbed9dae8292f | |
parent | 653cf4c971e740e9ce9955447aa8d18491544b18 (diff) | |
download | scummvm-rg350-ba44fcbf6b5a209fd7d705ffcf678568bb049640.tar.gz scummvm-rg350-ba44fcbf6b5a209fd7d705ffcf678568bb049640.tar.bz2 scummvm-rg350-ba44fcbf6b5a209fd7d705ffcf678568bb049640.zip |
Some corrections for the psychic profile screen in IHNM. The psychic profile background drawing has been turned into an event, so actors and animations will no longer be incorrectly shown. Also, the incorrect text color has been fixed. The text position is still wrong, though, and it's currently not possible to exit the psychic profile screen
svn-id: r28324
-rw-r--r-- | engines/saga/events.cpp | 34 | ||||
-rw-r--r-- | engines/saga/events.h | 3 | ||||
-rw-r--r-- | engines/saga/sfuncs.cpp | 39 |
3 files changed, 45 insertions, 31 deletions
diff --git a/engines/saga/events.cpp b/engines/saga/events.cpp index 73a603bf5c..5bdcf671d3 100644 --- a/engines/saga/events.cpp +++ b/engines/saga/events.cpp @@ -35,6 +35,7 @@ #include "saga/palanim.h" #include "saga/render.h" #include "saga/sndres.h" +#include "saga/rscfile.h" #include "saga/music.h" #include "saga/actor.h" @@ -344,6 +345,39 @@ int Events::handleOneShot(Event *event) { _vm->_actor->showActors(true); } break; + case kPsychicProfileBgEvent: + { + 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); + + // Draw the scene. It won't be drawn by Render::drawScene(), as the RF_PLACARD is set + _vm->_scene->draw(); + } + break; case kAnimEvent: switch (event->op) { case kEventPlay: diff --git a/engines/saga/events.h b/engines/saga/events.h index d0af1fe916..2486525751 100644 --- a/engines/saga/events.h +++ b/engines/saga/events.h @@ -60,7 +60,8 @@ enum EventCodes { kScriptEvent, kCursorEvent, kGraphicsEvent, - kCutawayEvent + kCutawayEvent, + kPsychicProfileBgEvent }; enum EventOps { diff --git a/engines/saga/sfuncs.cpp b/engines/saga/sfuncs.cpp index 74ff8e88dc..5bbe5d3c5b 100644 --- a/engines/saga/sfuncs.cpp +++ b/engines/saga/sfuncs.cpp @@ -1484,8 +1484,7 @@ void Script::sfPsychicProfile(SCRIPTFUNC_PARAMS) { 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 + // FIXME: This still needs work: the text placement is incorrect thread->wait(kWaitTypePlacard); @@ -1525,32 +1524,10 @@ void Script::sfPsychicProfile(SCRIPTFUNC_PARAMS) { 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); + event.type = kEvTOneshot; + event.code = kPsychicProfileBgEvent; - free(buf); - free(resourceData); + q_event = _vm->_events->chain(q_event, &event); // 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 @@ -1558,14 +1535,16 @@ void Script::sfPsychicProfile(SCRIPTFUNC_PARAMS) { // It doesn't end up in exactly the same spot as the original did it, // but it's close enough for now at least. + // FIXME: This assumption is wrong for the psychic profile, the text + // placement is incorrect + TextListEntry textEntry; - textEntry.knownColor = kKnownColorTransparent; - textEntry.effectKnownColor = kKnownColorBrightWhite; + textEntry.knownColor = kKnownColorBlack; 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.flags = (FontEffectFlags)(kFontCentered); textEntry.text = thread->_strings->getString(stringId); _placardTextEntry = _vm->_scene->_textList.addEntry(textEntry); |