[Scummvm-cvs-logs] scummvm master -> 66af2cf1d729e5944641ab203f3d36761fdff132

bluegr md5 at scummvm.org
Sat Jun 9 11:15:16 CEST 2012


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
66af2cf1d7 SCI: Handle translucent text planes


Commit: 66af2cf1d729e5944641ab203f3d36761fdff132
    https://github.com/scummvm/scummvm/commit/66af2cf1d729e5944641ab203f3d36761fdff132
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-06-09T02:13:48-07:00

Commit Message:
SCI: Handle translucent text planes

Fixes the incorrect flood fill in the Rada Drums screen in GK1

Changed paths:
    engines/sci/graphics/frameout.cpp
    engines/sci/graphics/text32.cpp



diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index 4505810..a5bd8ba 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 8ac9582..7907809 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);
 		}
 	}






More information about the Scummvm-git-logs mailing list