[Scummvm-cvs-logs] scummvm master -> 832961808a415ebcac5b74c54efb4cfbca0134e7

sev- sev at scummvm.org
Sat Apr 30 15:54:36 CEST 2016


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

Summary:
25ccf4f479 SCUMM HE: Prepared drawWizImage for recursive calls
00480bc7e0 SCUMM HE: Implemented Composite Wiz images
832961808a SCUMM HE: Stub for Wiz T14 compression


Commit: 25ccf4f4795feb9ba774ff4b5a429a83b20feec1
    https://github.com/scummvm/scummvm/commit/25ccf4f4795feb9ba774ff4b5a429a83b20feec1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-04-30T11:54:17+02:00

Commit Message:
SCUMM HE: Prepared drawWizImage for recursive calls

Changed paths:
    engines/scumm/he/wiz_he.cpp
    engines/scumm/he/wiz_he.h



diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp
index 82979e5..80f0ea2 100644
--- a/engines/scumm/he/wiz_he.cpp
+++ b/engines/scumm/he/wiz_he.cpp
@@ -1456,9 +1456,6 @@ uint8 *Wiz::drawWizImage(int resNum, int state, int maskNum, int maskState, int
 	uint32 height = READ_LE_UINT32(wizh + 0x8);
 	debug(3, "wiz_header.comp = %d wiz_header.w = %d wiz_header.h = %d", comp, width, height);
 
-	uint8 *wizd = _vm->findWrappedBlock(MKTAG('W','I','Z','D'), dataPtr, state, 0);
-	assert(wizd);
-
 	uint8 *mask = NULL;
 	if (maskNum) {
 		uint8 *maskPtr = _vm->getResourceAddress(rtImage, maskNum);
@@ -1574,58 +1571,76 @@ uint8 *Wiz::drawWizImage(int resNum, int state, int maskNum, int maskState, int
 		transColor = (trns == NULL) ? _vm->VAR(_vm->VAR_WIZ_TCOLOR) : -1;
 	}
 
+	drawWizImageEx(dst, dataPtr, mask, dstPitch, dstType, cw, ch, x1, y1, width, height,
+		state, &rScreen, flags, palPtr, transColor, _vm->_bytesPerPixel, xmapPtr, conditionBits);
+
+	if (!(flags & kWIFBlitToMemBuffer) && dstResNum == 0) {
+		Common::Rect rImage(x1, y1, x1 + width, y1 + height);
+		if (rImage.intersects(rScreen)) {
+			rImage.clip(rScreen);
+			if (!(flags & kWIFBlitToFrontVideoBuffer) && (flags & (kWIFBlitToFrontVideoBuffer | kWIFMarkBufferDirty))) {
+				++rImage.bottom;
+				_vm->markRectAsDirty(kMainVirtScreen, rImage);
+			} else {
+				_vm->restoreBackgroundHE(rImage);
+			}
+		}
+	}
+
+	return dst;
+}
+
+void Wiz::drawWizImageEx(uint8 *dst, uint8 *dataPtr, uint8 *maskPtr, int dstPitch, int dstType,
+		int dstw, int dsth, int srcx, int srcy, int srcw, int srch, int state, const Common::Rect *rect,
+		int flags, const uint8 *palPtr, int transColor, uint8 bitDepth, const uint8 *xmapPtr, uint16 conditionBits) {
+	uint8 *wizh = _vm->findWrappedBlock(MKTAG('W','I','Z','H'), dataPtr, state, 0);
+	assert(wizh);
+	uint32 comp   = READ_LE_UINT32(wizh + 0x0);
+	uint32 width  = READ_LE_UINT32(wizh + 0x4);
+	uint32 height = READ_LE_UINT32(wizh + 0x8);
+	debug(3, "wiz_header.comp = %d wiz_header.w = %d wiz_header.h = %d", comp, width, height);
+
+	uint8 *wizd = _vm->findWrappedBlock(MKTAG('W','I','Z','D'), dataPtr, state, 0);
+	assert(wizd);
+
 	switch (comp) {
 	case 0:
-		copyRawWizImage(dst, wizd, dstPitch, dstType, cw, ch, x1, y1, width, height, &rScreen, flags, palPtr, transColor, _vm->_bytesPerPixel);
+		copyRawWizImage(dst, wizd, dstPitch, dstType, dstw, dsth, srcx, srcy, srcw, srch, rect, flags, palPtr, transColor, bitDepth);
 		break;
 	case 1:
-		if (flags & 0x80) {
+		if (flags & kWIFZPlaneOn) {
 			dst = _vm->getMaskBuffer(0, 0, 1);
 			dstPitch /= _vm->_bytesPerPixel;
-			copyWizImageWithMask(dst, wizd, dstPitch, cw, ch, x1, y1, width, height, &rScreen, 0, 2);
-		} else if (flags & 0x100) {
+			copyWizImageWithMask(dst, wizd, dstPitch, dstw, dsth, srcx, srcy, srcw, srch, rect, 0, 2);
+		} else if (flags & kWIFZPlaneOff) {
 			dst = _vm->getMaskBuffer(0, 0, 1);
 			dstPitch /= _vm->_bytesPerPixel;
-			copyWizImageWithMask(dst, wizd, dstPitch, cw, ch, x1, y1, width, height, &rScreen, 0, 1);
+			copyWizImageWithMask(dst, wizd, dstPitch, dstw, dsth, srcx, srcy, srcw, srch, rect, 0, 1);
 		} else {
-			copyWizImage(dst, wizd, dstPitch, dstType, cw, ch, x1, y1, width, height, &rScreen, flags, palPtr, xmapPtr, _vm->_bytesPerPixel);
+			copyWizImage(dst, wizd, dstPitch, dstType, dstw, dsth, srcx, srcy, srcw, srch, rect, flags, palPtr, xmapPtr, bitDepth);
 		}
 		break;
 #ifdef USE_RGB_COLOR
 	case 2:
-		if (maskNum) {
-			copyMaskWizImage(dst, wizd, mask, dstPitch, dstType, cw, ch, x1, y1, width, height, &rScreen, flags, palPtr);
+		if (maskPtr) {
+			copyMaskWizImage(dst, wizd, maskPtr, dstPitch, dstType, dstw, dsth, srcx, srcy, srcw, srch, rect, flags, palPtr);
 		} else {
-			copyRaw16BitWizImage(dst, wizd, dstPitch, dstType, cw, ch, x1, y1, width, height, &rScreen, flags, transColor);
+			copyRaw16BitWizImage(dst, wizd, dstPitch, dstType, dstw, dsth, srcx, srcy, srcw, srch, rect, flags, transColor);
 		}
 		break;
 	case 4:
 		// TODO: Unknown image type
 		break;
 	case 5:
-		copy16BitWizImage(dst, wizd, dstPitch, dstType, cw, ch, x1, y1, width, height, &rScreen, flags, xmapPtr);
+		copy16BitWizImage(dst, wizd, dstPitch, dstType, dstw, dsth, srcx, srcy, srcw, srch, rect, flags, xmapPtr);
 		break;
 #endif
 	default:
-		error("drawWizImage: Unhandled wiz compression type %d", comp);
+		error("drawWizImageEx: Unhandled wiz compression type %d", comp);
 	}
-
-	if (!(flags & kWIFBlitToMemBuffer) && dstResNum == 0) {
-		Common::Rect rImage(x1, y1, x1 + width, y1 + height);
-		if (rImage.intersects(rScreen)) {
-			rImage.clip(rScreen);
-			if (!(flags & kWIFBlitToFrontVideoBuffer) && (flags & (kWIFBlitToFrontVideoBuffer | kWIFMarkBufferDirty))) {
-				++rImage.bottom;
-				_vm->markRectAsDirty(kMainVirtScreen, rImage);
-			} else {
-				_vm->restoreBackgroundHE(rImage);
-			}
-		}
-	}
-
-	return dst;
 }
 
+
 struct PolygonDrawData {
 	struct PolygonArea {
 		int32 xmin;
diff --git a/engines/scumm/he/wiz_he.h b/engines/scumm/he/wiz_he.h
index e5567ce..1fa4e83 100644
--- a/engines/scumm/he/wiz_he.h
+++ b/engines/scumm/he/wiz_he.h
@@ -117,6 +117,9 @@ enum WizImageFlags {
 	kWIFMarkBufferDirty = 0x10,
 	kWIFBlitToMemBuffer = 0x20,
 	kWIFIsPolygon = 0x40,
+	kWIFZPlaneOn = 0x80,
+	kWIFZPlaneOff = 0x100,
+	kWIFUseShadow = 0x200,
 	kWIFFlipX = 0x400,
 	kWIFFlipY = 0x800
 };
@@ -212,6 +215,7 @@ public:
 	void processWizImage(const WizParameters *params);
 
 	uint8 *drawWizImage(int resNum, int state, int maskNum, int maskState, int x1, int y1, int zorder, int shadow, int zbuffer, const Common::Rect *clipBox, int flags, int dstResNum, const uint8 *palPtr, uint16 conditionBits);
+	void drawWizImageEx(uint8 *dst, uint8 *src, uint8 *mask, int dstPitch, int dstType, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, int state, const Common::Rect *rect, int flags, const uint8 *palPtr, int transColor, uint8 bitDepth, const uint8 *xmapPtr, uint16 conditionBits);
 	void drawWizPolygon(int resNum, int state, int id, int flags, int shadow, int dstResNum, int palette);
 	void drawWizComplexPolygon(int resNum, int state, int po_x, int po_y, int shadow, int angle, int zoom, const Common::Rect *r, int flags, int dstResNum, int palette);
 	void drawWizPolygonTransform(int resNum, int state, Common::Point *wp, int flags, int shadow, int dstResNum, int palette);


Commit: 00480bc7e0facea6eeeac639c0b40837a8f2606b
    https://github.com/scummvm/scummvm/commit/00480bc7e0facea6eeeac639c0b40837a8f2606b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-04-30T14:35:11+02:00

Commit Message:
SCUMM HE: Implemented Composite Wiz images

Changed paths:
    engines/scumm/he/wiz_he.cpp
    engines/scumm/he/wiz_he.h



diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp
index 80f0ea2..5d2d973 100644
--- a/engines/scumm/he/wiz_he.cpp
+++ b/engines/scumm/he/wiz_he.cpp
@@ -1629,7 +1629,7 @@ void Wiz::drawWizImageEx(uint8 *dst, uint8 *dataPtr, uint8 *maskPtr, int dstPitc
 		}
 		break;
 	case 4:
-		// TODO: Unknown image type
+		copyCompositeWizImage(dst, dataPtr, wizd, maskPtr, dstPitch, dstType, dstw, dsth, srcx, srcy, srcw, srch, state, rect, flags, palPtr, transColor, bitDepth, xmapPtr, conditionBits);
 		break;
 	case 5:
 		copy16BitWizImage(dst, wizd, dstPitch, dstType, dstw, dsth, srcx, srcy, srcw, srch, rect, flags, xmapPtr);
@@ -1640,6 +1640,124 @@ void Wiz::drawWizImageEx(uint8 *dst, uint8 *dataPtr, uint8 *maskPtr, int dstPitc
 	}
 }
 
+void Wiz::copyCompositeWizImage(uint8 *dst, uint8 *wizPtr, uint8 *compositeInfoBlockPtr, uint8 *maskPtr, int dstPitch, int dstType,
+		int dstw, int dsth, int srcx, int srcy, int srcw, int srch, int state, const Common::Rect *clipBox,
+		int flags, const uint8 *palPtr, int transColor, uint8 bitDepth, const uint8 *xmapPtr, uint16 conditionBits) {
+
+	uint8 *nestedBlockHeader = _vm->heFindResource(MKTAG('N','E','S','T'), wizPtr);
+	assert(nestedBlockHeader);
+
+	uint8 *nestedWizHeader = _vm->heFindResource(MKTAG('M','U','L','T'), nestedBlockHeader);
+	assert(nestedWizHeader);
+
+	uint16 layerCount = READ_LE_UINT16(compositeInfoBlockPtr);
+	compositeInfoBlockPtr += 2;
+
+	uint16 defaultSubConditionBits = (conditionBits & kWMSBReservedBits);
+
+	conditionBits &= ~kWMSBReservedBits;
+
+	for (uint layerCounter = 0; layerCounter < layerCount; layerCounter++) {
+		int cmdSize = READ_LE_UINT16(compositeInfoBlockPtr);
+		uint8 *cmdPtr = compositeInfoBlockPtr + 2;
+
+		compositeInfoBlockPtr += (cmdSize + 2);
+		uint32 layerCmdDataBits = READ_LE_UINT32(cmdPtr);
+		cmdPtr += 4;
+
+		uint32 subConditionBits;
+
+		if (layerCmdDataBits & kWCFConditionBits) {
+			uint32 layerConditionBits = READ_LE_UINT32(cmdPtr);
+			cmdPtr += 4;
+
+			subConditionBits = (layerConditionBits & kWMSBReservedBits);
+			layerConditionBits &= ~kWMSBReservedBits;
+
+			if (subConditionBits == 0)
+				subConditionBits = defaultSubConditionBits;
+
+			uint32 conditionType = (layerConditionBits & kWSPCCTBits);
+			layerConditionBits &= ~kWSPCCTBits;
+
+			switch (conditionType) {
+			case kWSPCCTAnd:
+				if (layerConditionBits != (layerConditionBits & conditionBits))
+					continue;
+				break;
+
+			case kWSPCCTNot:
+				if (layerConditionBits & conditionBits)
+					continue;
+				break;
+
+			case kWSPCCTOr:
+			default:
+				if (!(layerConditionBits & conditionBits))
+					continue;
+				break;
+			}
+		} else {
+			subConditionBits = defaultSubConditionBits;
+		}
+
+		uint16 subState;
+		if (layerCmdDataBits & kWCFSubState) {
+			subState = READ_LE_UINT16(cmdPtr);
+			cmdPtr += 2;
+		} else {
+			subState = 0;
+		}
+
+		int16 xPos;
+		if (layerCmdDataBits & kWCFXDelta) {
+			xPos = (int16)READ_LE_UINT16(cmdPtr);
+			cmdPtr += 2;
+		} else {
+			xPos = 0;
+		}
+
+		int16 yPos;
+		if (layerCmdDataBits & kWCFYDelta) {
+			yPos = (int16)READ_LE_UINT16(cmdPtr);
+			cmdPtr += 2;
+		} else {
+			yPos = 0;
+		}
+
+		uint32 drawFlags;
+		if (layerCmdDataBits & kWCFDrawFlags) {
+			drawFlags = READ_LE_UINT32(cmdPtr);
+			cmdPtr += 4;
+		} else {
+			drawFlags = flags;
+		}
+
+		uint srcw1, srch1;
+		if (drawFlags & (kWIFFlipX | kWIFFlipY)) {
+			uint8 *wizh = _vm->findWrappedBlock(MKTAG('W','I','Z','H'), wizPtr, subState, 0);
+			assert(wizh);
+			srcw1 = READ_LE_UINT32(wizh + 0x4);
+			srch1 = READ_LE_UINT32(wizh + 0x8);
+		}
+
+		if (drawFlags & kWIFFlipX)
+			xPos = (srcw - (xPos + srcw1));
+
+		if (drawFlags & kWIFFlipY)
+			yPos = (srch - (yPos + srch1));
+
+		if (layerCmdDataBits & kWCFSubConditionBits) {
+			subConditionBits = READ_LE_UINT32(cmdPtr);
+			cmdPtr += 4;
+		} else {
+			subConditionBits = 0;
+		}
+
+		drawWizImageEx(dst, nestedWizHeader, maskPtr, dstPitch, dstType, dstw, dsth, srcx + xPos, srcy + yPos, srcw, srch,
+			subState, clipBox, drawFlags, palPtr, transColor, bitDepth, xmapPtr, subConditionBits);
+	}
+}
 
 struct PolygonDrawData {
 	struct PolygonArea {
diff --git a/engines/scumm/he/wiz_he.h b/engines/scumm/he/wiz_he.h
index 1fa4e83..dd1da8b 100644
--- a/engines/scumm/he/wiz_he.h
+++ b/engines/scumm/he/wiz_he.h
@@ -145,6 +145,29 @@ enum WizProcessFlags {
 	kWPFZBuffer = 0x200000
 };
 
+enum WizCompositeFlags {
+	kWCFConditionBits = 0x01,
+	kWCFSubState = 0x02,
+	kWCFXDelta = 0x04,
+	kWCFYDelta = 0x08,
+	kWCFDrawFlags = 0x10,
+	kWCFSubConditionBits = 0x20
+};
+
+enum WizSpcConditionTypes {
+	kWSPCCTBits = 0xc0000000,
+	kWSPCCTOr   = 0x00000000,
+	kWSPCCTAnd  = 0x40000000,
+	kWSPCCTNot  = 0x80000000
+};
+
+enum WizMoonSystemBits {
+	kWMSBRopMask = 0xff,
+	kWMSBRopParamMask = 0xff00,
+	kWMSBReservedBits = (kWMSBRopMask | kWMSBRopParamMask),
+	kWMSBRopParamRShift = 8
+};
+
 enum {
 	kWizXMap = 0,
 	kWizRMap,
@@ -225,6 +248,10 @@ public:
 	static void copyMaskWizImage(uint8 *dst, const uint8 *src, const uint8 *mask, int dstPitch, int dstType, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect, int flags, const uint8 *palPtr);
 #endif
 
+	void copyCompositeWizImage(uint8 *dst, uint8 *wizPtr, uint8 *wizd, uint8 *maskPtr, int dstPitch, int dstType,
+		int dstw, int dsth, int srcx, int srcy, int srcw, int srch, int state, const Common::Rect *clipBox,
+		int flags, const uint8 *palPtr, int transColor, uint8 bitDepth, const uint8 *xmapPtr, uint16 conditionBits);
+
 	static void copyAuxImage(uint8 *dst1, uint8 *dst2, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, uint8 bitdepth);
 	static void copyWizImageWithMask(uint8 *dst, const uint8 *src, int dstPitch, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect, int maskT, int maskP);
 	static void copyWizImage(uint8 *dst, const uint8 *src, int dstPitch, int dstType, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect, int flags, const uint8 *palPtr, const uint8 *xmapPtr, uint8 bitdepth);


Commit: 832961808a415ebcac5b74c54efb4cfbca0134e7
    https://github.com/scummvm/scummvm/commit/832961808a415ebcac5b74c54efb4cfbca0134e7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-04-30T15:54:06+02:00

Commit Message:
SCUMM HE: Stub for Wiz T14 compression

Changed paths:
    engines/scumm/he/wiz_he.cpp
    engines/scumm/he/wiz_he.h



diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp
index 5d2d973..5b844e2 100644
--- a/engines/scumm/he/wiz_he.cpp
+++ b/engines/scumm/he/wiz_he.cpp
@@ -1634,6 +1634,9 @@ void Wiz::drawWizImageEx(uint8 *dst, uint8 *dataPtr, uint8 *maskPtr, int dstPitc
 	case 5:
 		copy16BitWizImage(dst, wizd, dstPitch, dstType, dstw, dsth, srcx, srcy, srcw, srch, rect, flags, xmapPtr);
 		break;
+	case 9:
+		copyT14WizImage(dst, wizd, dstPitch, dstType, dstw, dsth, srcx, srcy, rect, conditionBits);
+		break;
 #endif
 	default:
 		error("drawWizImageEx: Unhandled wiz compression type %d", comp);
@@ -1759,6 +1762,46 @@ void Wiz::copyCompositeWizImage(uint8 *dst, uint8 *wizPtr, uint8 *compositeInfoB
 	}
 }
 
+void Wiz::copyT14WizImage(uint8 *dst, uint8 *wizd, int dstPitch, int dstType,
+		int dstw, int dsth, int srcx, int srcy, const Common::Rect *clipBox, uint16 conditionBits) {
+
+	int rawROP = conditionBits & kWMSBRopMask;
+	int nROPParam = (conditionBits & kWMSBReservedBits) >> kWMSBRopParamRShift;
+
+	switch (rawROP) {
+	default:
+	case 1:
+		warning("T14: MMX_PREMUL_ALPHA_COPY");
+		break;
+
+	case 2:
+		warning("T14: MMX_ADDITIVE");
+		break;
+
+	case 3:
+		warning("T14: MMX_SUBTRACTIVE");
+		break;
+
+	case 4:
+		warning("T14: MMX_CONSTANT_ALPHA");
+		break;
+
+	case 5:
+		warning("T14: MMX_CHEAP_50_50");
+		break;
+
+	case 6:
+		warning("T14: COPY");
+		break;
+
+	case 7:
+		warning("T14: CHEAP_50_50");
+		break;
+	}
+
+	warning("T14: params %d", nROPParam);
+}
+
 struct PolygonDrawData {
 	struct PolygonArea {
 		int32 xmin;
diff --git a/engines/scumm/he/wiz_he.h b/engines/scumm/he/wiz_he.h
index dd1da8b..fee67a7 100644
--- a/engines/scumm/he/wiz_he.h
+++ b/engines/scumm/he/wiz_he.h
@@ -246,11 +246,13 @@ public:
 
 #ifdef USE_RGB_COLOR
 	static void copyMaskWizImage(uint8 *dst, const uint8 *src, const uint8 *mask, int dstPitch, int dstType, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect, int flags, const uint8 *palPtr);
-#endif
 
 	void copyCompositeWizImage(uint8 *dst, uint8 *wizPtr, uint8 *wizd, uint8 *maskPtr, int dstPitch, int dstType,
 		int dstw, int dsth, int srcx, int srcy, int srcw, int srch, int state, const Common::Rect *clipBox,
 		int flags, const uint8 *palPtr, int transColor, uint8 bitDepth, const uint8 *xmapPtr, uint16 conditionBits);
+	void copyT14WizImage(uint8 *dst, uint8 *wizd, int dstPitch, int dstType,
+			int dstw, int dsth, int srcx, int srcy, const Common::Rect *clipBox, uint16 conditionBits);
+#endif
 
 	static void copyAuxImage(uint8 *dst1, uint8 *dst2, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, uint8 bitdepth);
 	static void copyWizImageWithMask(uint8 *dst, const uint8 *src, int dstPitch, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect, int maskT, int maskP);






More information about the Scummvm-git-logs mailing list