aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics
diff options
context:
space:
mode:
authorFilippos Karapetis2012-06-09 12:12:44 +0300
committerFilippos Karapetis2012-06-09 12:13:48 +0300
commit66af2cf1d729e5944641ab203f3d36761fdff132 (patch)
tree3833e35a9dd0293f88926fcf27aa0b14951a79aa /engines/sci/graphics
parentec92a867da699f069a6adee41be89a50be0b9128 (diff)
downloadscummvm-rg350-66af2cf1d729e5944641ab203f3d36761fdff132.tar.gz
scummvm-rg350-66af2cf1d729e5944641ab203f3d36761fdff132.tar.bz2
scummvm-rg350-66af2cf1d729e5944641ab203f3d36761fdff132.zip
SCI: Handle translucent text planes
Fixes the incorrect flood fill in the Rada Drums screen in GK1
Diffstat (limited to 'engines/sci/graphics')
-rw-r--r--engines/sci/graphics/frameout.cpp23
-rw-r--r--engines/sci/graphics/text32.cpp9
2 files changed, 20 insertions, 12 deletions
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index 450581000b..a5bd8ba48e 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -53,6 +53,11 @@ namespace Sci {
// TODO/FIXME: This is all guesswork
+enum SciSpeciaPlanelPictureCodes {
+ kPlaneTranslucent = 0xfffe, // -2
+ kPlanePlainColored = 0xffff // -1
+};
+
GfxFrameout::GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCoordAdjuster *coordAdjuster, GfxCache *cache, GfxScreen *screen, GfxPalette *palette, GfxPaint32 *paint32)
: _segMan(segMan), _resMan(resMan), _cache(cache), _screen(screen), _palette(palette), _paint32(paint32) {
@@ -137,7 +142,7 @@ void GfxFrameout::kernelAddPlane(reg_t object) {
newPlane.lastPriority = 0xFFFF; // hidden
newPlane.planeOffsetX = 0;
newPlane.planeOffsetY = 0;
- newPlane.pictureId = 0xFFFF;
+ newPlane.pictureId = kPlanePlainColored;
newPlane.planePictureMirrored = false;
newPlane.planeBack = 0;
_planes.push_back(newPlane);
@@ -155,7 +160,8 @@ void GfxFrameout::kernelUpdatePlane(reg_t object) {
if (lastPictureId != it->pictureId) {
// picture got changed, load new picture
deletePlanePictures(object);
- if ((it->pictureId != 0xFFFF) && (it->pictureId != 0xFFFE)) {
+ // Draw the plane's picture if it's not a translucent/plane colored frame
+ if ((it->pictureId != kPlanePlainColored) && (it->pictureId != kPlaneTranslucent)) {
// SQ6 gives us a bad picture number for the control menu
if (_resMan->testResource(ResourceId(kResourceTypePic, it->pictureId)))
addPlanePicture(object, it->pictureId, 0);
@@ -248,6 +254,9 @@ void GfxFrameout::kernelDeletePlane(reg_t object) {
}
void GfxFrameout::addPlanePicture(reg_t object, GuiResourceId pictureId, uint16 startX, uint16 startY) {
+ if (pictureId == kPlanePlainColored || pictureId == kPlaneTranslucent) // sanity check
+ return;
+
PlanePictureEntry newPicture;
newPicture.object = object;
newPicture.pictureId = pictureId;
@@ -574,21 +583,17 @@ void GfxFrameout::kernelFrameout() {
// There is a race condition lurking in SQ6, which causes the game to hang in the intro, when teleporting to Polysorbate LX.
// Since I first wrote the patch, the race has stopped occurring for me though.
// I'll leave this for investigation later, when someone can reproduce.
- //if (it->pictureId == 0xffff) // FIXME: This is what SSCI does, and fixes the intro of LSL7, but breaks the dialogs in GK1 (adds black boxes)
- if (it->planeBack)
+ //if (it->pictureId == kPlanePlainColored) // FIXME: This is what SSCI does, and fixes the intro of LSL7, but breaks the dialogs in GK1 (adds black boxes)
+ if (it->pictureId == kPlanePlainColored && it->planeBack)
_paint32->fillRect(it->planeRect, it->planeBack);
- GuiResourceId planeMainPictureId = it->pictureId;
-
_coordAdjuster->pictureSetDisplayArea(it->planeRect);
- _palette->drewPicture(planeMainPictureId);
+ _palette->drewPicture(it->pictureId);
FrameoutList itemList;
createPlaneItemList(planeObject, itemList);
-// warning("Plane %s", _segMan->getObjectName(planeObject));
-
for (FrameoutList::iterator listIterator = itemList.begin(); listIterator != itemList.end(); listIterator++) {
FrameoutEntry *itemEntry = *listIterator;
diff --git a/engines/sci/graphics/text32.cpp b/engines/sci/graphics/text32.cpp
index 8ac9582535..7907809c91 100644
--- a/engines/sci/graphics/text32.cpp
+++ b/engines/sci/graphics/text32.cpp
@@ -205,7 +205,7 @@ void GfxText32::drawScrollTextBitmap(reg_t textObject, reg_t hunkId, uint16 x, u
}
void GfxText32::drawTextBitmapInternal(int16 x, int16 y, Common::Rect planeRect, reg_t textObject, reg_t hunkId) {
- uint16 backColor = readSelectorValue(_segMan, textObject, SELECTOR(back));
+ int16 backColor = (int16)readSelectorValue(_segMan, textObject, SELECTOR(back));
// Sanity check: Check if the hunk is set. If not, either the game scripts
// didn't set it, or an old saved game has been loaded, where it wasn't set.
if (hunkId.isNull())
@@ -227,7 +227,7 @@ void GfxText32::drawTextBitmapInternal(int16 x, int16 y, Common::Rect planeRect,
byte *surface = memoryPtr + BITMAP_HEADER_SIZE;
int curByte = 0;
- uint16 skipColor = readSelectorValue(_segMan, textObject, SELECTOR(skip));
+ int16 skipColor = (int16)readSelectorValue(_segMan, textObject, SELECTOR(skip));
uint16 textX = planeRect.left + x;
uint16 textY = planeRect.top + y;
// Get totalWidth, totalHeight
@@ -240,10 +240,13 @@ void GfxText32::drawTextBitmapInternal(int16 x, int16 y, Common::Rect planeRect,
textY = textY * _screen->getDisplayHeight() / _screen->getHeight();
}
+ bool translucent = (skipColor == -1 && backColor == -1);
+
for (int curY = 0; curY < height; curY++) {
for (int curX = 0; curX < width; curX++) {
byte pixel = surface[curByte++];
- if (pixel != skipColor && pixel != backColor)
+ if ((!translucent && pixel != skipColor && pixel != backColor) ||
+ (translucent && pixel != 0xFF))
_screen->putFontPixel(textY, curX + textX, curY, pixel);
}
}