[Scummvm-git-logs] scummvm master -> 97c3eb7d63c4ac86a8af48f0458679b7c5771eac

eriktorbjorn noreply at scummvm.org
Wed Mar 26 18:07:55 UTC 2025


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:
97c3eb7d63 SCUMM: Fix debug code for drawing masks to work with 16-bit colors


Commit: 97c3eb7d63c4ac86a8af48f0458679b7c5771eac
    https://github.com/scummvm/scummvm/commit/97c3eb7d63c4ac86a8af48f0458679b7c5771eac
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2025-03-26T19:06:51+01:00

Commit Message:
SCUMM: Fix debug code for drawing masks to work with 16-bit colors

Mainly an attempt to help with the reported TurboGrafx-16 masking bugs.

Changed paths:
    engines/scumm/gfx.cpp


diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index 467d6249b63..279cf291852 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -2413,19 +2413,27 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const
 
 #if 0
 		// HACK: blit mask(s) onto normal screen. Useful to debug masking
+		int bytesPerStrip = (_vm->_game.features & GF_16BIT_COLOR) ? 16 : 8;
+
 		for (int i = 0; i < numzbuf; i++) {
+
 			byte *dst1, *dst2;
 
-			dst1 = dst2 = (byte *)vs->getPixels(0,0) + y * vs->pitch + x * 8;
+			dst1 = dst2 = (byte *)vs->getPixels(0,0) + y * vs->pitch + x * bytesPerStrip;
 			if (vs->hasTwoBuffers)
-				dst2 = vs->backBuf + y * vs->pitch + x * 8;
+				dst2 = vs->backBuf + y * vs->pitch + x * bytesPerStrip;
 			byte *mask_ptr = getMaskBuffer(x, y, i);
 
 			for (int h = 0; h < height; h++) {
 				int maskbits = *mask_ptr;
 				for (int j = 0; j < 8; j++) {
-					if (maskbits & 0x80)
-						dst1[j] = dst2[j] = 12 + i;
+					if (maskbits & 0x80) {
+						if (bytesPerStrip == 16) {
+							WRITE_UINT16(dst1 + j * 2, _vm->_16BitPalette[12 + i]);
+							WRITE_UINT16(dst2 + j * 2, _vm->_16BitPalette[12 + i]);
+						} else
+							dst1[j] = dst2[j] = 12 + i;
+					}
 					maskbits <<= 1;
 				}
 				dst1 += vs->pitch;
@@ -2778,16 +2786,23 @@ void Gdi::drawBMAPBg(const byte *ptr, VirtScreen *vs) {
 
 #if 0
 		// HACK: blit mask(s) onto normal screen. Useful to debug masking
+		int bytesPerStrip = (_vm->_game.features & GF_16BIT_COLOR) ? 16 : 8;
+
 		for (int i = 0; i < numzbuf; i++) {
-			byte *dst1 = (byte *)vs->pixels + stripnr * 8;
-			byte *dst2 = vs->backBuf + stripnr * 8;
+			byte *dst1 = (byte *)vs->getPixels(0, 0) + stripnr * bytesPerStrip;
+			byte *dst2 = vs->backBuf + stripnr * bytesPerStrip;
 
-			mask_ptr = getMaskBuffer(stripnr, 0, i);
+			byte *mask_ptr = getMaskBuffer(stripnr, 0, i);
 			for (int h = 0; h < vs->h; h++) {
 				int maskbits = *mask_ptr;
 				for (int j = 0; j < 8; j++) {
-					if (maskbits & 0x80)
-						dst1[j] = dst2[j] = 12 + i;
+					if (maskbits & 0x80) {
+						if (bytesPerStrip == 16) {
+							WRITE_UINT16(dst1 + j * 2, _vm->_16BitPalette[12 + i]);
+							WRITE_UINT16(dst2 + j * 2, _vm->_16BitPalette[12 + i]);
+						} else
+							dst1[j] = dst2[j] = 12 + i;
+					}
 					maskbits <<= 1;
 				}
 				dst1 += vs->pitch;




More information about the Scummvm-git-logs mailing list