[Scummvm-git-logs] scummvm master -> 9c3b1766322a52cba7f00321db7bc7d1f0f5fe67

athrxx noreply at scummvm.org
Fri Jul 29 14:23:45 UTC 2022


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

Summary:
9ca9be789c SCUMM: implement EGA dithering mode
9c3b176632 SCUMM: (MI1/FM-Towns) - clear text surface when restarting with F8


Commit: 9ca9be789ca548b142654844958cac110e096c27
    https://github.com/scummvm/scummvm/commit/9ca9be789ca548b142654844958cac110e096c27
Author: athrxx (athrxx at scummvm.org)
Date: 2022-07-29T16:23:24+02:00

Commit Message:
SCUMM: implement EGA dithering mode

(for certain VGA titles)

I've included some titles that do not support this in the original, but e. g. DOTT will require some more fixes for glitches.

Changed paths:
    engines/scumm/cursor.cpp
    engines/scumm/gfx.cpp
    engines/scumm/input.cpp
    engines/scumm/palette.cpp
    engines/scumm/scumm.cpp
    engines/scumm/scumm.h


diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp
index c3d31560fc3..d404e560ade 100644
--- a/engines/scumm/cursor.cpp
+++ b/engines/scumm/cursor.cpp
@@ -99,6 +99,11 @@ void ScummEngine_v5::animateCursor() {
 }
 
 void ScummEngine_v6::setCursorHotspot(int x, int y) {
+	if (_enableEGADithering) {
+		x <<= 1;
+		y <<= 1;
+	}
+
 	_cursor.hotspotX = x;
 	_cursor.hotspotY = y;
 }
@@ -152,18 +157,33 @@ void ScummEngine::setCursorFromBuffer(const byte *ptr, int width, int height, in
 	uint size;
 	byte *dst;
 
-	size = width * height * _bytesPerPixel;
+	int sclW = _enableEGADithering ? 2 : 1;
+	int sclH = _enableEGADithering ? 2 : 1;
+
+	size = width * sclW * height * sclH * _bytesPerPixel;
 	if (size > sizeof(_grabbedCursor))
 		error("grabCursor: grabbed cursor too big");
 
-	_cursor.width = width;
-	_cursor.height = height;
+	_cursor.width = width * sclW;
+	_cursor.height = height * sclH;
 	_cursor.animate = 0;
 
 	dst = _grabbedCursor;
 	for (; height; height--) {
-		memcpy(dst, ptr, width * _bytesPerPixel);
-		dst += width * _bytesPerPixel;
+		for (int h2 = sclH; h2; --h2) {
+			const byte *s1 = ptr;
+			const byte *s2 = 0;
+			byte *d = dst;
+			for (int w = width; w; --w) {
+				for (int w2 = sclW; w2; --w2) {
+					s2 = s1;
+					for (int w3 = _bytesPerPixel; w3; --w3)
+						*d++ = *s2++;
+				}
+				s1 = s2;
+			}
+			dst += width * sclW * _bytesPerPixel;
+		}
 		ptr += pitch;
 	}
 
@@ -700,8 +720,8 @@ void ScummEngine_v5::setBuiltinCursor(int idx) {
 		memset(_grabbedCursor, 0xFF, sizeof(_grabbedCursor));
 	}
 
-	int sclW = (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) ? 2 : _textSurfaceMultiplier;
-	int sclH = (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) ? 1 : _textSurfaceMultiplier;
+	int sclW = (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG || _enableEGADithering) ? 2 : _textSurfaceMultiplier;
+	int sclH = (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) ? 1 : (_enableEGADithering ? 2 : _textSurfaceMultiplier);
 	int sclW2 = _outputPixelFormat.bytesPerPixel * sclW;
 
 	_cursor.hotspotX = _cursorHotspots[2 * _currentCursor] * sclW;
diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index 362895cf4f0..7d8a1ab97ee 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -628,14 +628,12 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i
 	assert(x >= 0 && width <= vs->pitch);
 	assert(_textSurface.getPixels());
 
-	// Some extra clipping/alignment for certain render modes. This is from the MI1EGA interpreter where it actually matters.
-	// The dithering patterns require the alignment, otherwise there will be visible glitches. For V3, the original interpreter
-	// actually does this for all graphics modes... 
-	if (_game.version > 2 && (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderHercG || _renderMode == Common::kRenderHercA)) {
-		top &= ~3;
-		if (bottom & 3)
-			bottom = (bottom + 4) & ~3;
-	}
+	// Some extra vertical alignment for certain render modes. It matters for MI1EGA. The dithering patterns require the alignment,
+	// otherwise there will be visible glitches. It can be found in the original interpreters.
+	int align = (_game.version > 2 && (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderHercG || _renderMode == Common::kRenderHercA)) ? 4 : (_enableEGADithering ? 2 : 1);
+	top &= ~(align - 1);
+	if (bottom & (align - 1))
+		bottom = (bottom + align) & ~(align - 1);
 
 	// Perform some clipping
 	if (width > vs->w - x)
@@ -780,6 +778,9 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i
 			y *= m;
 			width *= m;
 			height *= m;
+		} else if (_enableEGADithering) {
+			// EGA mode for certain VGA versions (MI2, LOOM Talkie)
+			src = ditherVGAtoEGA(pitch, x, y, width, height);
 		} else if (_game.platform == Common::kPlatformDOS && _game.version < 5) {
 			// CGA and Hercules modes for MM/ZAK v1/v2, INDY3, LOOM, MI1EGA
 			src = postProcessDOSGraphics(vs, pitch, x, y, width, height);
@@ -964,6 +965,32 @@ const byte *ScummEngine::postProcessDOSGraphics(VirtScreen *vs, int &pitch, int
 	return res;
 }
 
+const byte *ScummEngine::ditherVGAtoEGA(int &pitch, int &x, int &y, int &width, int &height) const {
+	pitch <<= 1;
+	int pitch2 = (pitch - width) << 1;
+
+	uint8 *dst0 = _hercCGAScaleBuf;
+	uint8 *dst1 = _hercCGAScaleBuf + pitch;
+	uint8 *src = _compositeBuf;
+
+	for (int i = height, st = 1; i; --i, st ^= 1) {
+		for (int ii = width; ii; --ii) {
+			byte in = *src++;
+			*dst0++ = *dst1++ = _egaColorMap[st][in];
+			*dst0++ = *dst1++ = _egaColorMap[st ^ 1][in];
+		}
+		dst0 += pitch2;
+		dst1 += pitch2;
+	}
+
+	x <<= 1;
+	y <<= 1;
+	width <<= 1;
+	height <<= 1;
+
+	return _hercCGAScaleBuf;
+}
+
 #pragma mark -
 #pragma mark --- Background buffers & charset mask ---
 #pragma mark -
@@ -4238,11 +4265,18 @@ void ScummEngine::dissolveEffect(int width, int height) {
 			mac_drawStripToScreen(vs, y, x, y + vs->topline, width, height);
 		else if (IS_ALIGNED(width, 4))
 			drawStripToScreen(vs, x, width, y, y + height);
-		else
-			// This is not suitable for any render mode that requires post-processing of the pixels (CGA; Hercules...).
-			// Currently, non of the targets in concern will arrive here, but we will have to look at this again if we
-			// want to support things like the EGA mode of LOOM VGA Talkie...
-			_system->copyRectToScreen(vs->getPixels(x, y), vs->pitch, x, y + vs->topline, width, height);
+		else {
+			const byte *src = vs->getPixels(x, y);
+			int pitch = vs->pitch;
+			y += vs->topline;
+			int wd = width;
+			int ht = height;
+
+			if (_enableEGADithering)
+				src = ditherVGAtoEGA(pitch, x, y, wd, ht);
+
+			_system->copyRectToScreen(src, vs->pitch, x, y, wd, ht);
+		}
 
 		// Test for 1x1 pattern...
 		canHalt |= is1x1Pattern && ++blits >= blitsBeforeRefresh;
diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp
index c7e8ad047cd..6330fe04a1c 100644
--- a/engines/scumm/input.cpp
+++ b/engines/scumm/input.cpp
@@ -210,7 +210,7 @@ void ScummEngine::parseEvent(Common::Event event) {
 				_mouse.y = _mouse.y * 4 / 7;
 			}
 
-		} else if (_macScreen || (_useCJKMode && _textSurfaceMultiplier == 2) || _renderMode == Common::kRenderCGA_BW) {
+		} else if (_macScreen || (_useCJKMode && _textSurfaceMultiplier == 2) || _renderMode == Common::kRenderCGA_BW || _enableEGADithering) {
 			_mouse.x >>= 1;
 			_mouse.y >>= 1;
 		}
diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp
index a0ff7d86533..d0d42a2a110 100644
--- a/engines/scumm/palette.cpp
+++ b/engines/scumm/palette.cpp
@@ -248,6 +248,9 @@ void ScummEngine::resetPalette() {
 			// else we initialize and then lock down the first 16 colors.
 			if (_renderMode != Common::kRenderEGA)
 				setPaletteFromTable(tableAmigaMIPalette, sizeof(tableAmigaMIPalette) / 3);
+		} else if (_renderMode == Common::kRenderEGA && _supportsEGADithering) {
+			setPaletteFromTable(tableEGAPalette, sizeof(tableEGAPalette) / 3);
+			_enableEGADithering = true;
 #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
 		} else if (_game.platform == Common::kPlatformFMTowns) {
 			if (_game.id == GID_INDY4 || _game.id == GID_MONKEY2)
@@ -729,6 +732,9 @@ void ScummEngine::cyclePalette() {
 		return;
 #endif
 
+	if (_enableEGADithering)
+		return;
+
 	valueToAdd = VAR(VAR_TIMER);
 	if (valueToAdd < VAR(VAR_TIMER_NEXT))
 		valueToAdd = VAR(VAR_TIMER_NEXT);
@@ -967,6 +973,36 @@ void ScummEngine::setShadowPalette(int redScale, int greenScale, int blueScale,
 	}
 }
 
+byte egaFindBestMatch(int r, int g, int b) {
+	// This mostly like the normal EGA palette, but a bit different
+	static const byte matchPalette[] = {
+		0x00, 0x00, 0x00, 	0x00, 0x00, 0xAB, 	0x00, 0xAB, 0x00, 	0x00, 0xAB, 0xAB,
+		0xAB, 0x00, 0x00, 	0xAB, 0x00, 0xAB, 	0xAB, 0x57, 0x00, 	0xAB, 0xAB, 0xAB,
+		0x57, 0x57, 0x57, 	0x57, 0x57, 0xFF, 	0x57, 0xFF, 0x57, 	0x57, 0xFF, 0xFF,
+		0xFF, 0x57, 0x57, 	0xFF, 0x57, 0xFF, 	0xFF, 0xFF, 0x57, 	0xFF, 0xFF, 0xFF
+	};
+
+	uint32 best = (uint32)-1;
+	byte res = 0;
+
+	for (uint16 i = 0; i < 256; ++i) {
+		const byte *c1 = &matchPalette[(i >> 4) * 3];
+		const byte *c2 = &matchPalette[(i & 0x0F) * 3];
+
+		int dr = ((c1[0] + c2[0]) >> 1) - r;
+		int dg = ((c1[1] + c2[1]) >> 1) - g;
+		int db = ((c1[2] + c2[2]) >> 1) - b;
+
+		uint32 sum = dr * dr + dg * dg + db * db;
+		if (sum < best) {
+			best = sum;
+			res = i;
+		}
+	}
+
+	return res;
+}
+
 void ScummEngine::darkenPalette(int redScale, int greenScale, int blueScale, int startColor, int endColor) {
 	if (_game.platform == Common::kPlatformAmiga && _game.id == GID_INDY4) {
 		startColor = CLIP(startColor, 0, 255);
@@ -1019,6 +1055,44 @@ void ScummEngine::darkenPalette(int redScale, int greenScale, int blueScale, int
 		}
 
 		setDirtyColors(startColor, endColor);
+	} else if (_enableEGADithering) {
+		if (redScale == 0 || greenScale == 0 || blueScale == 0) {
+			for (int i = startColor; i <= endColor; ++i)
+				_egaColorMap[0][i] = _egaColorMap[1][i] = 0;
+
+		} else if (redScale == 0xFF || greenScale == 0xFF || blueScale == 0xFF) {
+			if (!_EPAL_offs) {
+				// We can support the EGA mode for games that aren't supposed to have it, like this.
+				// Might be glitchy, though...
+				const byte *p = getPalettePtr(_curPalIndex, _roomResource);
+				for (int i = 0; i < 256; ++i) {
+					byte col = egaFindBestMatch(p[0], p[1], p[2]);
+					_egaColorMap[0][i] = col & 0x0F;
+					_egaColorMap[1][i] = col >> 4;
+					p += 3;
+				}
+			} else {
+				const byte *p = getResourceAddress(rtRoom, _roomResource) + _EPAL_offs + startColor;
+				for (int i = startColor; i <= endColor; ++i) {
+					_egaColorMap[0][i] = *p & 0x0F;
+					_egaColorMap[1][i] = *p++ >> 4;
+				}
+			}
+		} else {
+			const byte *p = getPalettePtr(_curPalIndex, _roomResource) + startColor * 3;
+			for (int i = startColor; i <= endColor; ++i) {
+				int vr = MIN<int>(*p++ * redScale / 0xFF, 0xFF);
+				int vg = MIN<int>(*p++ * greenScale / 0xFF, 0xFF);
+				int vb = MIN<int>(*p++ * blueScale / 0xFF, 0xFF);
+				byte col = egaFindBestMatch(vr, vg, vb);
+				_egaColorMap[0][i] = col & 0x0F;
+				_egaColorMap[1][i] = col >> 4;
+			}
+		}
+
+		_virtscr[kMainVirtScreen].setDirtyRange(0, _virtscr[kMainVirtScreen].h);
+		_virtscr[kVerbVirtScreen].setDirtyRange(0, _virtscr[kVerbVirtScreen].h);
+
 	} else {
 		int max;
 		if (_game.version >= 5 && _game.version <= 6 && _game.heversion <= 60) {
@@ -1274,6 +1348,15 @@ void ScummEngine::copyPalColor(int dst, int src) {
 }
 
 void ScummEngine::setPalColor(int idx, int r, int g, int b) {
+	if (_enableEGADithering) {
+		byte col = egaFindBestMatch(r, g, b);
+		_egaColorMap[0][idx] = col & 0x0F;
+		_egaColorMap[1][idx] = col >> 4;
+		_virtscr[kMainVirtScreen].setDirtyRange(0, _virtscr[kMainVirtScreen].h);
+		_virtscr[kVerbVirtScreen].setDirtyRange(0, _virtscr[kVerbVirtScreen].h);
+		return;
+	}
+
 	if (_game.heversion == 70)
 		idx = _HEV7ActorPalette[idx];
 
@@ -1342,6 +1425,24 @@ void ScummEngine::setCurrentPalette(int palindex) {
 #endif
 	} else if (_game.id == GID_INDY4 && _game.platform == Common::kPlatformAmiga) {
 		setAmigaPaletteFromPtr(pals);
+	} else if (_enableEGADithering) {
+		if (!_EPAL_offs) {
+			// We can support the EGA mode for games that aren't supposed to have it, like this.
+			// Might be glitchy, though...
+			const byte *p = getPalettePtr(_curPalIndex, _roomResource);
+			for (int i = 0; i < 256; ++i) {
+				byte col = egaFindBestMatch(p[0], p[1], p[2]);
+				_egaColorMap[0][i] = col & 0x0F;
+				_egaColorMap[1][i] = col >> 4;
+				p += 3;
+			}
+		} else {
+			pals = getResourceAddress(rtRoom, _roomResource) + _EPAL_offs;
+			for (int i = 0; i < 256; ++i) {
+				_egaColorMap[0][i] = *pals & 0x0F;
+				_egaColorMap[1][i] = *pals++ >> 4;
+			}
+		}
 	} else {
 		setPaletteFromPtr(pals);
 	}
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index f632b919862..fab1f81f9c2 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -179,6 +179,8 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
 	memset(_currentPalette, 0, sizeof(_currentPalette));
 	memset(_darkenPalette, 0, sizeof(_darkenPalette));
 	memset(_HEV7ActorPalette, 0, sizeof(_HEV7ActorPalette));
+	_egaColorMap[0] = &_currentPalette[0x30];
+	_egaColorMap[1] = &_currentPalette[0x130];
 	memset(_extraBoxFlags, 0, sizeof(_extraBoxFlags));
 	memset(_scaleSlots, 0, sizeof(_scaleSlots));
 	memset(_charsetColorMap, 0, sizeof(_charsetColorMap));
@@ -239,6 +241,19 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
 		_renderMode = Common::kRenderDefault;
 	}
 
+	// VGA games which support an EGA dithering mode
+	static const byte egaModeIDs[] = {
+		/*GID_SAMNMAX,*/	// Not supported in the original interpreter. It works, but is too glitchy to have it enabled without further fine tuning...
+		GID_TENTACLE,		// Not supported in the original interpreter. Less glitchy than SAM, so I leave it enabled. I guess, people who actually select this will know what they're doing.
+		GID_LOOM,			// Supported in the original interpreter.
+		GID_MONKEY,
+		GID_MONKEY_VGA,
+		GID_INDY4,			// Not supported in all versions of the original interpreter.
+		GID_MONKEY2			// Support in the original interpreter.
+	};
+
+	_supportsEGADithering = (_game.platform == Common::kPlatformDOS && _game.version > 3 && Common::find(egaModeIDs, &egaModeIDs[ARRAYSIZE(egaModeIDs)], _game.id) != &egaModeIDs[ARRAYSIZE(egaModeIDs)]);
+
 	if (_game.platform == Common::kPlatformFMTowns && _game.id != GID_LOOM && _game.version == 3)
 		if (ConfMan.getBool("aspect_ratio") && !ConfMan.getBool("trim_fmtowns_to_200_pixels")) {
 			GUI::MessageDialog dialog(
@@ -264,7 +279,8 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
 	case Common::kRenderEGA:
 	case Common::kRenderAmiga:
 		if ((_game.version >= 4 && !(_game.features & GF_16COLOR)
-			&& !(_game.platform == Common::kPlatformAmiga && _renderMode == Common::kRenderEGA))
+			&& !(_game.platform == Common::kPlatformAmiga && _renderMode == Common::kRenderEGA)
+			&& !_supportsEGADithering)
 			|| (_game.features & GF_OLD256))
 			_renderMode = Common::kRenderDefault;
 		break;
@@ -324,7 +340,7 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
 
 	if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG)
 		_hercCGAScaleBuf = (byte *)malloc(kHercWidth * kHercHeight);
-	else if (_renderMode == Common::kRenderCGA_BW)
+	else if (_renderMode == Common::kRenderCGA_BW || (_renderMode == Common::kRenderEGA && _supportsEGADithering))
 		_hercCGAScaleBuf = (byte *)malloc(_screenWidth * 2 * _screenHeight * 2);
 
 	setV1ColorTable(_renderMode);
@@ -1120,7 +1136,7 @@ Common::Error ScummEngine::init() {
 	// Initialize backend
 	if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) {
 		initGraphics(kHercWidth, kHercHeight);
-	} else if (_renderMode == Common::kRenderCGA_BW) {
+	} else if (_renderMode == Common::kRenderCGA_BW || (_renderMode == Common::kRenderEGA && _supportsEGADithering)) {
 		initGraphics(_screenWidth * 2, _screenHeight * 2);
 	} else {
 		int screenWidth = _screenWidth;
@@ -2681,25 +2697,36 @@ void ScummEngine_v5::scummLoop_handleSaveLoad() {
 
 	ScummEngine::scummLoop_handleSaveLoad();
 
-	// WORKAROUND: MI1 post-load room palette fixes for games that were saved with a different
-	// render mode. The entry scripts apply custom fixes here, based on the VAR_VIDEOMODE
-	// var. Saving this state and then loading the savegame with a different render mode setting,
-	// will mess up the room palette. The original interpreter does not fix this, savegames
-	// from different videomodes are basically incompatible, at least until a scene comes up
-	// where the script might again apply the necessary fixes. Unfortunately, this workaround
-	// will also only work if the current room has a script with the correct fixes...
-	if (_game.id == GID_MONKEY_EGA && _videoModeChanged) {
+	
+	if (_videoModeChanged) {
 		_videoModeChanged = false;
-		// Reset everything that the former entry script might have
-		// done (based on the former VAR_VIDEOMODE).
-		for (int i = 0; i < ARRAYSIZE(_roomPalette); ++i)
-			_roomPalette[i] = i;
-		// We want just the ENCD script...
-		int entryScript = VAR_ENTRY_SCRIPT;
-		VAR_ENTRY_SCRIPT = 0xFF;
-		runEntryScript();
-		VAR_ENTRY_SCRIPT = entryScript;
 		warning("Loading savegame with a different render mode setting. Glitches might occur");
+
+		if (_game.id == GID_MONKEY_EGA) {
+			// WORKAROUND: MI1 post-load room palette fixes for games that were saved with a different
+			// render mode. The entry scripts apply custom fixes here, based on the VAR_VIDEOMODE
+			// var. Saving this state and then loading the savegame with a different render mode setting,
+			// will mess up the room palette. The original interpreter does not fix this, savegames
+			// from different videomodes are basically incompatible, at least until a scene comes up
+			// where the script might again apply the necessary fixes. Unfortunately, this workaround
+			// will also only work if the current room has a script with the correct fixes...
+
+			// Reset everything that the former entry script might have
+			// done (based on the former VAR_VIDEOMODE).
+			for (int i = 0; i < ARRAYSIZE(_roomPalette); ++i)
+				_roomPalette[i] = i;
+			// We want just the ENCD script...
+			int entryScript = VAR_ENTRY_SCRIPT;
+			VAR_ENTRY_SCRIPT = 0xFF;
+			runEntryScript();
+			VAR_ENTRY_SCRIPT = entryScript;
+		} else if (_supportsEGADithering) {
+			// Reconstruct the screen palette. It might glitch a bit if the palette was modified with
+			// darkenPalette or similar. But we do give warning... and the alternative would be to
+			// completely process, save and load both the VGA and EGA palettes all the time (regardless
+			// of the current render mode).
+			setCurrentPalette(_curPalIndex);
+		}	
 	}
 
 	// update IQ points after loading
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 0e7f06bcc73..2435580ab5f 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -1065,6 +1065,8 @@ protected:
 	// Screen rendering
 	byte *_compositeBuf;
 	byte *_hercCGAScaleBuf = nullptr;
+	bool _enableEGADithering = false;
+	bool _supportsEGADithering = false;
 
 	virtual void drawDirtyScreenParts();
 	void updateDirtyScreen(VirtScreenNumber slot);
@@ -1077,6 +1079,7 @@ protected:
 	void mac_undrawIndy3CreditsText();
 
 	const byte *postProcessDOSGraphics(VirtScreen *vs, int &pitch, int &x, int &y, int &width, int &height) const;
+	const byte *ditherVGAtoEGA(int &pitch, int &x, int &y, int &width, int &height) const;
 
 public:
 	VirtScreen *findVirtScreen(int y);
@@ -1175,6 +1178,9 @@ protected:
 	void mapVerbPalette(int idx);
 	int remapVerbPaletteColor(int r, int g, int b);
 
+	// EGA dithering mode color tables for certain VGA games like MI2, LOOM Talkie...
+	byte *_egaColorMap[2];
+
 public:
 	uint16 _extraBoxFlags[65];
 


Commit: 9c3b1766322a52cba7f00321db7bc7d1f0f5fe67
    https://github.com/scummvm/scummvm/commit/9c3b1766322a52cba7f00321db7bc7d1f0f5fe67
Author: athrxx (athrxx at scummvm.org)
Date: 2022-07-29T16:23:25+02:00

Commit Message:
SCUMM: (MI1/FM-Towns) - clear text surface when restarting with F8

All other FM-Towns titles do this in initScreens(). I don't remember why I did it like this for MI1 , but now it doesn't glitch on restart any more...

Changed paths:
    engines/scumm/scumm.cpp


diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index fab1f81f9c2..064f8816708 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -2885,6 +2885,12 @@ void ScummEngine::restart() {
 	_currentRoom = 0;
 	_currentScript = 0xFF;
 	killAllScriptsExceptCurrent();
+
+	if (_townsScreen && _game.id == GID_MONKEY) {
+		_textSurface.fillRect(Common::Rect(0, 0, _textSurface.w * _textSurfaceMultiplier, _textSurface.h * _textSurfaceMultiplier), 0);
+		_townsScreen->clearLayer(1);
+	}
+
 	setShake(0);
 	_sound->stopAllSounds();
 




More information about the Scummvm-git-logs mailing list