[Scummvm-git-logs] scummvm master -> 37cc784e5ef4d31a08c8c03ed32fd916181c67fd

AndywinXp noreply at scummvm.org
Sat Nov 30 09:30:15 UTC 2024


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:
37cc784e5e SCUMM: HE: Fix the majority of endianness issues on graphics


Commit: 37cc784e5ef4d31a08c8c03ed32fd916181c67fd
    https://github.com/scummvm/scummvm/commit/37cc784e5ef4d31a08c8c03ed32fd916181c67fd
Author: AndywinXp (andywinxp at gmail.com)
Date: 2024-11-30T10:30:06+01:00

Commit Message:
SCUMM: HE: Fix the majority of endianness issues on graphics

The system is about 80% fixed, and as usual the remaining 20%
is taking way too much to fix...

Anyhow this fixes all endianness/gfx related crashes we had up
until now, and properly implement all the hard stuff, such as:
* Transparency effects
* Additive/subtractive color effects
* Weird transitions

Still, there are some very minor glitches here and there
and I couldn't find the reason for those. But the games are
now very playable and without crashes.

Changed paths:
    engines/scumm/he/gfx_comp/aux_comp.cpp
    engines/scumm/he/gfx_comp/mrle_comp.cpp
    engines/scumm/he/gfx_comp/trle_comp.cpp
    engines/scumm/he/gfx_primitives_he.cpp
    engines/scumm/he/moonbase/moonbase_gfx.cpp
    engines/scumm/he/wiz_he.cpp
    engines/scumm/he/wiz_he.h


diff --git a/engines/scumm/he/gfx_comp/aux_comp.cpp b/engines/scumm/he/gfx_comp/aux_comp.cpp
index 8aaeee4df06..b5d35d70812 100644
--- a/engines/scumm/he/gfx_comp/aux_comp.cpp
+++ b/engines/scumm/he/gfx_comp/aux_comp.cpp
@@ -180,7 +180,9 @@ void Wiz::auxWRLEUncompressAndCopyFromStreamOffset(WizRawPixel *destStream, cons
 				if (!_uses16BitColor) {
 					memcpy(dest8, dest8 + streamOffset, (runCount * sizeof(WizRawPixel8)));
 				} else {
-					memcpy(dest16, dest16 + streamOffset, (runCount * sizeof(WizRawPixel16)));
+					// memcpy(dest16, dest16 + streamOffset, (runCount * sizeof(WizRawPixel16)));
+					for (int i = 0; i < runCount; i++)
+						dest16[i] = FROM_LE_16((dest16 + streamOffset)[i]);
 				}
 			}
 
@@ -229,7 +231,9 @@ void Wiz::auxWRLEUncompressAndCopyFromStreamOffset(WizRawPixel *destStream, cons
 				if (!_uses16BitColor) {
 					memcpy(dest8, dest8 + streamOffset, (runCount * sizeof(WizRawPixel8)));
 				} else {
-					memcpy(dest16, dest16 + streamOffset, (runCount * sizeof(WizRawPixel16)));
+					// memcpy(dest16, dest16 + streamOffset, (runCount * sizeof(WizRawPixel16)));
+					for (int i = 0; i < runCount; i++)
+						dest16[i] = FROM_LE_16((dest16 + streamOffset)[i]);	
 				}
 			}
 
@@ -319,7 +323,10 @@ void Wiz::auxDecompSRLEStream(WizRawPixel *destStream, const WizRawPixel *backgr
 				backgroundStream = (const WizRawPixel *)background8;
 				destStream = (WizRawPixel *)dest8;
 			} else {
-				memcpy(dest16, background16, runCount * sizeof(WizRawPixel16));
+				// memcpy(dest16, background16, runCount * sizeof(WizRawPixel16));
+				for (int i = 0; i < runCount; i++)
+					dest16[i] = FROM_LE_16(background16[i]);
+				
 				background16 += runCount;
 				dest16 += runCount;
 
@@ -1148,7 +1155,9 @@ void Wiz::auxDecompDRLEStream(WizRawPixel *destPtr, const byte *dataStream, WizR
 
 					destPtr = (WizRawPixel *)dest8;
 				} else {
-					memcpy(dest16, background16, runCount * sizeof(WizRawPixel16));
+					for (int i = 0; i < runCount; i++)
+						dest16[i] = FROM_LE_16(background16[i]);
+					//memcpy(dest16, background16, runCount * sizeof(WizRawPixel16));
 					dest16 += runCount;
 					background16 += runCount;
 
@@ -1159,7 +1168,9 @@ void Wiz::auxDecompDRLEStream(WizRawPixel *destPtr, const byte *dataStream, WizR
 				if (!_uses16BitColor) {
 					memcpy(dest8, background8, runCount * sizeof(WizRawPixel8));
 				} else {
-					memcpy(dest16, background16, runCount * sizeof(WizRawPixel16));
+					for (int i = 0; i < runCount; i++)
+						dest16[i] = FROM_LE_16(background16[i]);
+					//memcpy(dest16, background16, runCount * sizeof(WizRawPixel16));
 				}
 			}
 		}
diff --git a/engines/scumm/he/gfx_comp/mrle_comp.cpp b/engines/scumm/he/gfx_comp/mrle_comp.cpp
index 3c3d74424fd..a2ffb37e89c 100644
--- a/engines/scumm/he/gfx_comp/mrle_comp.cpp
+++ b/engines/scumm/he/gfx_comp/mrle_comp.cpp
@@ -122,7 +122,11 @@ static void mrleFLIPAltSourceForwardXBppToXBpp(Wiz *wiz,
 				dest8 += runCount;
 				src8 += runCount;
 			} else {
-				memcpy(dest16, src16, (runCount * sizeof(WizRawPixel16)));
+				// memcpy(dest16, src16, (runCount * sizeof(WizRawPixel16)));
+				for (int i = 0; i < runCount; i++) {
+					dest16[i] = FROM_LE_16(src16[i]);
+				}
+
 				dest16 += runCount;
 				src16 += runCount;
 			}
@@ -165,7 +169,10 @@ static void mrleFLIPAltSourceBackwardXBppToXBpp(Wiz *wiz,
 			} else {
 				dest16 -= runCount;
 				src16 -= runCount;
-				memcpy(dest16 + 1, src16 + 1, (runCount * sizeof(WizRawPixel16)));
+				// memcpy(dest16 + 1, src16 + 1, (runCount * sizeof(WizRawPixel16)));
+				for (int i = 1; i < runCount; i++) {
+					dest16[i] = FROM_LE_16(src16[i]);
+				}
 			}
 		}
 	);
diff --git a/engines/scumm/he/gfx_comp/trle_comp.cpp b/engines/scumm/he/gfx_comp/trle_comp.cpp
index 42d470783a4..e90035c0a6e 100644
--- a/engines/scumm/he/gfx_comp/trle_comp.cpp
+++ b/engines/scumm/he/gfx_comp/trle_comp.cpp
@@ -490,10 +490,10 @@ void Wiz::trleFLIPAdditivePixelMemset(WizRawPixel *dstPtr, WizRawPixel mixColor,
 	while (size-- > 0) {
 		if (!_uses16BitColor) {
 			WizRawPixel workColor = *dst8;
-			*dst8++ = (WizRawPixel8)WIZRAWPIXEL_ADDITIVE_MIX(workColor, mixColor);
+			*dst8++ = (WizRawPixel8)WIZRAWPIXEL_ADDITIVE_MIX(workColor, FROM_LE_16(mixColor));
 		} else {
 			WizRawPixel workColor = *dst16;
-			*dst16++ = (WizRawPixel16)WIZRAWPIXEL_ADDITIVE_MIX(workColor, mixColor);
+			*dst16++ = (WizRawPixel16)WIZRAWPIXEL_ADDITIVE_MIX(workColor, FROM_LE_16(mixColor));
 		}
 	}
 }
@@ -542,10 +542,10 @@ void Wiz::trleFLIPSubtractivePixelMemset(WizRawPixel *dstPtr, WizRawPixel mixCol
 	while (size-- > 0) {
 		if (!_uses16BitColor) {
 			WizRawPixel workColor = *dst8;
-			*dst8++ = (WizRawPixel8)WIZRAWPIXEL_SUBTRACTIVE_MIX(workColor, mixColor);
+			*dst8++ = (WizRawPixel8)WIZRAWPIXEL_SUBTRACTIVE_MIX(workColor, FROM_LE_16(mixColor));
 		} else {
 			WizRawPixel workColor = *dst16;
-			*dst16++ = (WizRawPixel16)WIZRAWPIXEL_SUBTRACTIVE_MIX(workColor, mixColor);
+			*dst16++ = (WizRawPixel16)WIZRAWPIXEL_SUBTRACTIVE_MIX(workColor, FROM_LE_16(mixColor));
 		}
 	}
 }
diff --git a/engines/scumm/he/gfx_primitives_he.cpp b/engines/scumm/he/gfx_primitives_he.cpp
index 5f401134101..a9087e7312c 100644
--- a/engines/scumm/he/gfx_primitives_he.cpp
+++ b/engines/scumm/he/gfx_primitives_he.cpp
@@ -32,7 +32,7 @@ int Wiz::pgReadPixel(const WizSimpleBitmap *srcBM, int x, int y, int defaultValu
 		return defaultValue;
 	} else {
 		if (_uses16BitColor) {
-			return *(((WizRawPixel16 *)srcBM->bufferPtr()) + y * srcBM->bitmapWidth + x);
+			return FROM_LE_16(*(((WizRawPixel16 *)srcBM->bufferPtr()) + y * srcBM->bitmapWidth + x));
 		} else {
 			return *(((WizRawPixel8 *)srcBM->bufferPtr()) + y * srcBM->bitmapWidth + x);
 		}
@@ -42,7 +42,7 @@ int Wiz::pgReadPixel(const WizSimpleBitmap *srcBM, int x, int y, int defaultValu
 void Wiz::pgWritePixel(WizSimpleBitmap *srcBM, int x, int y, WizRawPixel value) {
 	if ((x >= 0) && (y >= 0) && (x < srcBM->bitmapWidth) && (y < srcBM->bitmapHeight)) {
 		if (_uses16BitColor) {
-			*(((WizRawPixel16 *)srcBM->bufferPtr()) + y * srcBM->bitmapWidth + x) = value;
+			*(((WizRawPixel16 *)srcBM->bufferPtr()) + y * srcBM->bitmapWidth + x) = FROM_LE_16(value);
 		} else {
 			*(((WizRawPixel8 *)srcBM->bufferPtr()) + y * srcBM->bitmapWidth + x) = value;
 		}
@@ -52,7 +52,7 @@ void Wiz::pgWritePixel(WizSimpleBitmap *srcBM, int x, int y, WizRawPixel value)
 void Wiz::pgClippedWritePixel(WizSimpleBitmap *srcBM, int x, int y, const Common::Rect *clipRectPtr, WizRawPixel value) {
 	if ((x >= clipRectPtr->left) && (y >= clipRectPtr->top) && (x <= clipRectPtr->right) && (y <= clipRectPtr->bottom)) {
 		if (_uses16BitColor) {
-			*(((WizRawPixel16 *)srcBM->bufferPtr()) + y * srcBM->bitmapWidth + x) = value;
+			*(((WizRawPixel16 *)srcBM->bufferPtr()) + y * srcBM->bitmapWidth + x) = FROM_LE_16(value);
 		} else {
 			*(((WizRawPixel8 *)srcBM->bufferPtr()) + y * srcBM->bitmapWidth + x) = value;
 		}
@@ -667,7 +667,7 @@ void Wiz::pgSimpleBlit(WizSimpleBitmap *destBM, Common::Rect *destRect, WizSimpl
 				s8 += sw;
 			} else {
 				for (int i = cw; --i >= 0;) {
-					*d16++ = *s16--;
+					*d16++ = FROM_LE_16(*s16--);
 				}
 
 				d16 += dw;
@@ -973,7 +973,7 @@ void Wiz::pgTransparentSimpleBlit(WizSimpleBitmap *destBM, Common::Rect *destRec
 				d8 += doff;
 			} else {
 				for (int x = cw; --x >= 0;) {
-					value = *s16++;
+					value = FROM_LE_16(*s16++);
 
 					if (value != tColor) {
 						*d16++ = (WizRawPixel16)value;
@@ -1008,7 +1008,7 @@ void Wiz::pgTransparentSimpleBlit(WizSimpleBitmap *destBM, Common::Rect *destRec
 				d8 += doff;
 			} else {
 				for (int x = cw; --x >= 0;) {
-					value = *s16--;
+					value = FROM_LE_16(*s16--);
 
 					if (value != tColor) {
 						*d16++ = (WizRawPixel16)value;
@@ -1291,7 +1291,7 @@ void Wiz::pgForwardRemapPixelCopy(WizRawPixel *dstPtr, const WizRawPixel *srcPtr
 		const WizRawPixel16 *src16 = (const WizRawPixel16 *)srcPtr;
 
 		while (size-- > 0) {
-			*dst16++ = *src16++;
+			*dst16++ = FROM_LE_16(*src16++);
 		}
 	}
 }
@@ -1321,7 +1321,7 @@ void Wiz::pgTransparentForwardRemapPixelCopy(WizRawPixel *dstPtr, const WizRawPi
 		const WizRawPixel16 *src16 = (const WizRawPixel16 *)srcPtr;
 
 		while (size-- > 0) {
-			WizRawPixel16 srcColor = *src16++;
+			WizRawPixel16 srcColor = FROM_LE_16(*src16++);
 
 			if (transparentColor != srcColor) {
 				*dst16++ = srcColor;
@@ -1357,7 +1357,7 @@ void Wiz::pgTransparentBackwardsRemapPixelCopy(WizRawPixel *dstPtr, const WizRaw
 		const WizRawPixel16 *src16 = (const WizRawPixel16 *)srcPtr;
 
 		while (size-- > 0) {
-			WizRawPixel16 srcColor = *src16++;
+			WizRawPixel16 srcColor = FROM_LE_16(*src16++);
 
 			if (transparentColor != srcColor) {
 				*dst16-- = srcColor;
@@ -1381,7 +1381,7 @@ void Wiz::pgBackwardsRemapPixelCopy(WizRawPixel *dstPtr, const WizRawPixel *srcP
 		const WizRawPixel16 *src16 = (const WizRawPixel16 *)srcPtr;
 
 		while (size-- > 0) {
-			*dst16-- = *src16++;
+			*dst16-- = FROM_LE_16(*src16++);
 		}
 	}
 }
@@ -1401,14 +1401,14 @@ void Wiz::pgForwardMixColorsPixelCopy(WizRawPixel *dstPtr, const WizRawPixel *sr
 
 		while (size-- > 0) {
 			if (_vm->_game.heversion >= 99) {
-				WizRawPixel16 srcColor = *src16++;
+				WizRawPixel16 srcColor = FROM_LE_16(*src16++);
 				WizRawPixel16 dstColor = *dst16;
 
 				*dst16++ = WIZRAWPIXEL_50_50_MIX(
 					WIZRAWPIXEL_50_50_PREMIX_COLOR(srcColor),
 					WIZRAWPIXEL_50_50_PREMIX_COLOR(dstColor));
 			} else {
-				*dst16++ = (*src16++);
+				*dst16++ = FROM_LE_16(*src16++);
 			}
 		}
 	}
@@ -1429,14 +1429,14 @@ void Wiz::pgBackwardsMixColorsPixelCopy(WizRawPixel *dstPtr, const WizRawPixel *
 
 		while (size-- > 0) {
 			if (_vm->_game.heversion >= 99) {
-				WizRawPixel16 srcColor = *src16++;
+				WizRawPixel16 srcColor = FROM_LE_16(*src16++);
 				WizRawPixel16 dstColor = *dst16;
 
 				*dst16-- = WIZRAWPIXEL_50_50_MIX(
 					WIZRAWPIXEL_50_50_PREMIX_COLOR(srcColor),
 					WIZRAWPIXEL_50_50_PREMIX_COLOR(dstColor));
 			} else {
-				*dst16-- = (*src16++);
+				*dst16-- = FROM_LE_16(*src16++);
 			}
 		}
 	}
@@ -1467,7 +1467,7 @@ void Wiz::pgTransparentForwardMixColorsPixelCopy(WizRawPixel *dstPtr, const WizR
 		const WizRawPixel16 *src16 = (const WizRawPixel16 *)srcPtr;
 
 		while (size-- > 0) {
-			WizRawPixel16 srcColor = *src16++;
+			WizRawPixel16 srcColor = FROM_LE_16(*src16++);
 
 			if (transparentColor != srcColor) {
 				WizRawPixel16 dstColor = *dst16;
@@ -1507,7 +1507,7 @@ void Wiz::pgTransparentBackwardsMixColorsPixelCopy(WizRawPixel *dstPtr, const Wi
 		const WizRawPixel16 *src16 = (const WizRawPixel16 *)srcPtr;
 
 		while (size-- > 0) {
-			WizRawPixel16 srcColor = *src16++;
+			WizRawPixel16 srcColor = FROM_LE_16(*src16++);
 
 			if (transparentColor != srcColor) {
 				WizRawPixel16 dstColor = *dst16;
@@ -1536,7 +1536,7 @@ static void pgBlitForwardSrcArbitraryDstPixelTransfer(Wiz *wiz, WizRawPixel *dst
 		const WizRawPixel16 *src16 = (const WizRawPixel16 *)srcPtr;
 
 		for (int i = 0; i < count; i++) {
-			*dst16 = *src16++;
+			*dst16 = FROM_LE_16(*src16++);
 			dst16 += dstStep;
 		}
 	}
@@ -1567,7 +1567,7 @@ static void pgBlitForwardSrcArbitraryDstTransparentPixelTransfer(Wiz *wiz, WizRa
 		transparentColor = *((const WizRawPixel16 *)userParam);
 
 		for (int i = 0; i < count; i++) {
-			color = *src16++;
+			color = FROM_LE_16(*src16++);
 
 			if (transparentColor != color) {
 				*dst16 = color;
@@ -2010,7 +2010,7 @@ void Wiz::rawPixelMemset(void *dstPtr, int value, size_t count) {
 	if (_uses16BitColor) {
 		WizRawPixel16 *dst16Bit = (WizRawPixel16 *)dstPtr;
 		for (size_t i = 0; i < count; i++)
-			WRITE_LE_UINT16(&dst16Bit[i], value);
+			WRITE_UINT16(&dst16Bit[i], value);
 	} else {
 		WizRawPixel8 *dst8Bit = (WizRawPixel8 *)dstPtr;
 		memset(dst8Bit, value, count);
@@ -2019,7 +2019,7 @@ void Wiz::rawPixelMemset(void *dstPtr, int value, size_t count) {
 
 WizRawPixel Wiz::convert8BppToRawPixel(WizRawPixel value, const WizRawPixel *conversionTable) {
 	if (_uses16BitColor) {
-		return *(((const WizRawPixel16 *)conversionTable) + value);
+		return FROM_LE_16(*(((const WizRawPixel16 *)conversionTable) + value));
 	} else {
 		return value;
 	}
@@ -2040,7 +2040,7 @@ bool Wiz::compareDoPixelStreamsOverlap(const WizRawPixel *a, const WizRawPixel *
 		}
 	} else {
 		for (int i = 0; i < width; i++) {
-			if ((*a16++ != (WizRawPixel16)transparentColor) && (*b16++ != (WizRawPixel16)transparentColor)) {
+			if ((FROM_LE_16(*a16++) != (WizRawPixel16)transparentColor) && (FROM_LE_16(*b16++) != (WizRawPixel16)transparentColor)) {
 				return true;
 			}
 		}
diff --git a/engines/scumm/he/moonbase/moonbase_gfx.cpp b/engines/scumm/he/moonbase/moonbase_gfx.cpp
index 4c78f570723..d4c6b96750f 100644
--- a/engines/scumm/he/moonbase/moonbase_gfx.cpp
+++ b/engines/scumm/he/moonbase/moonbase_gfx.cpp
@@ -403,7 +403,9 @@ void Wiz::rawMoonbaseBitmapBlit(WizRawBitmap *dstBitmap, Common::Rect *dstRectPt
 		// Left or right?
 		if (srcRect.left <= srcRect.right) {
 			while (--ch >= 0) {
-				memcpy(d, s, ca);
+				for (x = 0; x < ca; x++) {
+					d[x] = FROM_LE_16(s[x]);
+				}
 
 				d += dw;
 				s += sw;
@@ -415,7 +417,7 @@ void Wiz::rawMoonbaseBitmapBlit(WizRawBitmap *dstBitmap, Common::Rect *dstRectPt
 
 			while (--ch >= 0) {
 				for (x = cw; --x >= 0;) {
-					*d++ = *s--;
+					*d++ = FROM_LE_16(*s--);
 				}
 
 				d += dw;
@@ -427,7 +429,7 @@ void Wiz::rawMoonbaseBitmapBlit(WizRawBitmap *dstBitmap, Common::Rect *dstRectPt
 
 static void trleFLIPMoonbaseBackwardsPixelCopy(WizRawPixel16 *dstPtr, WizRawPixel16 *srcPtr, int size) {
 	while (size-- > 0) {
-		*dstPtr-- = *srcPtr++;
+		*dstPtr-- = FROM_LE_16(*srcPtr++);
 	}
 }
 
@@ -443,11 +445,13 @@ static void trleFLIPDecompressMoonbaseLineForward(Wiz *wiz, WizRawPixel16 *destP
 			destPtr += runCount;
 		},
 		{
-			wiz->rawPixelMemset(destPtr, READ_LE_UINT16(dataStream), runCount);
+			wiz->rawPixelMemset(destPtr, FROM_LE_16(*((uint16 *)dataStream)), runCount);
 			destPtr += runCount;
 		},
 		{
-			memcpy(destPtr, dataStream, runCount * sizeof(WizRawPixel16));
+			for (int i = 0; i < runCount; i++) {
+				destPtr[i] = FROM_LE_16(((WizRawPixel16 *)dataStream)[i]);
+			}
 			destPtr += runCount;
 		}
 	);
@@ -466,7 +470,7 @@ static void trleFLIPDecompressMoonbaseLineBackward(Wiz *wiz, WizRawPixel16 *dest
 		},
 		{
 			destPtr -= runCount;
-			wiz->rawPixelMemset(destPtr + 1, READ_LE_UINT16(dataStream), runCount);
+			wiz->rawPixelMemset(destPtr + 1, FROM_LE_16(*((uint16 *)dataStream)), runCount);
 		},
 		{
 			trleFLIPMoonbaseBackwardsPixelCopy(destPtr, (WizRawPixel16 *)dataStream, runCount);
@@ -889,19 +893,19 @@ void Wiz::blitT14CodecImage(byte *dst, int dstw, int dsth, int dstPitch, const C
 				for (int c = 0; c < cnt; c++) {
 					if (pixels >= sx) {
 						if (rawROP == T14_MMX_PREMUL_ALPHA_COPY) { // MMX_PREMUL_ALPHA_COPY
-							WRITE_LE_UINT16(dst1, READ_LE_UINT16(src));
+							WRITE_UINT16(dst1, READ_LE_UINT16(src));
 						} else if (rawROP == T14_MMX_ADDITIVE) { // MMX_ADDITIVE
 							uint16 color = READ_LE_UINT16(src);
-							uint16 orig = READ_LE_UINT16(dst1);
+							uint16 orig = READ_UINT16(dst1);
 
 							uint32 r = MIN<uint32>(0x7c00, (orig & 0x7c00) + (color & 0x7c00));
 							uint32 g = MIN<uint32>(0x03e0, (orig & 0x03e0) + (color & 0x03e0));
 							uint32 b = MIN<uint32>(0x001f, (orig & 0x001f) + (color & 0x001f));
-							WRITE_LE_UINT16(dst1, (r | g | b));
+							WRITE_UINT16(dst1, (r | g | b));
 						} else if (rawROP == T14_MMX_CHEAP_50_50) { // MMX_CHEAP_50_50
 							uint16 color = (READ_LE_UINT16(src) >> 1) & 0x3DEF;
-							uint16 orig = (READ_LE_UINT16(dst1) >> 1) & 0x3DEF;
-							WRITE_LE_UINT16(dst1, (color + orig));
+							uint16 orig = (READ_UINT16(dst1) >> 1) & 0x3DEF;
+							WRITE_UINT16(dst1, (color + orig));
 						}
 						dst1 += 2;
 					}
@@ -925,10 +929,10 @@ void Wiz::blitT14CodecImage(byte *dst, int dstw, int dsth, int dstPitch, const C
 					if (pixels >= sx) {
 						int alpha = code >> 1;
 						uint16 color = READ_LE_UINT16(singlesOffset);
-						uint32 orig = READ_LE_UINT16(dst1);
+						uint32 orig = READ_UINT16(dst1);
 
 						if (!premulAlpha) {
-							WRITE_LE_UINT16(dst1, color); // ENABLE_PREMUL_ALPHA = 0
+							WRITE_UINT16(dst1, color); // ENABLE_PREMUL_ALPHA = 0
 						} else {
 							if (alpha > 32) {
 								alpha -= 32;
@@ -940,12 +944,12 @@ void Wiz::blitT14CodecImage(byte *dst, int dstw, int dsth, int dstPitch, const C
 								uint32 dG = ((((color & 0x3e0) - oG) * alpha) >> 5) + oG;
 								uint32 dB = ((((color & 0x1f) - oB) * alpha) >> 5) + oB;
 
-								WRITE_LE_UINT16(dst1, (dR & 0x7c00) | (dG & 0x3e0) | (dB & 0x1f));
+								WRITE_UINT16(dst1, (dR & 0x7c00) | (dG & 0x3e0) | (dB & 0x1f));
 							} else {
 								uint32 pix = ((orig << 16) | orig) & 0x3e07c1f;
 								pix = (((pix * alpha) & 0xffffffff) >> 5) & 0x3e07c1f;
 								pix = ((pix >> 16) + pix + color) & 0xffff;
-								WRITE_LE_UINT16(dst1, pix);
+								WRITE_UINT16(dst1, pix);
 							}
 						}
 
diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp
index c0a2a73fb32..c416c0884b9 100644
--- a/engines/scumm/he/wiz_he.cpp
+++ b/engines/scumm/he/wiz_he.cpp
@@ -2288,7 +2288,11 @@ int Wiz::createHistogramArrayForImage(int image, int state, const Common::Rect *
 	return _vm->readVar(0);
 }
 
+// This function is currently deactivated until it can be assessed
+// that it doesn't do more damage than good. Currently it does more
+// damage (e.g. the images get re-byteswapped on every frame)...
 void Wiz::ensureNativeFormatImageForState(int image, int state) {
+#if 0
 	// If AWIZ block is an XMAP, we don't want to do anything with it...
 	if (dwGetImageGeneralProperty(image, state, kWIPXMAPBlockPresent)) {
 		return;
@@ -2337,6 +2341,7 @@ void Wiz::ensureNativeFormatImageForState(int image, int state) {
 		// Reset the compression type...
 		setWizCompressionType(image, state, newCompType);
 	}
+#endif
 }
 
 void Wiz::processWizImageModifyCmd(const WizImageCommand *params) {
diff --git a/engines/scumm/he/wiz_he.h b/engines/scumm/he/wiz_he.h
index 0d93fe86a9d..cf40b1ac6ad 100644
--- a/engines/scumm/he/wiz_he.h
+++ b/engines/scumm/he/wiz_he.h
@@ -66,7 +66,7 @@ namespace Scumm {
 		(wizComp) == kWCTTRLE16Bpp
 
 #define NATIVE_WIZ_TYPE(wizComp)                   \
-	(wizComp) == NATIVE_WIZ_COMP_NONE_16BPP || \
+		(wizComp) == NATIVE_WIZ_COMP_NONE_16BPP || \
 		(wizComp) == NATIVE_WIZ_COMP_TRLE_16BPP    \
 
 #define WIZ_16BPP(wizComp)                       \




More information about the Scummvm-git-logs mailing list