[Scummvm-git-logs] scummvm master -> 5f2bf42f8411e8804a57344ac41c8941cf7a485f

eriktorbjorn eriktorbjorn at telia.com
Wed Jun 30 13:00:26 UTC 2021


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

Summary:
0ffe2ada11 SCUMM: Allow more than one Mac font
82cde1fa05 SCUMM: For now, remap font 1 to font 0 in Indy 3 Mac
319492e83a SCUMM: Add function for drawing Indy 3 Mac text box
9d2d6b60c8 SCUMM: Some more work on the Indy 3 Mac text box.
cfe270c8af SCUMM: Render the Indy 3 Mac text box to a separate surface.
84fb97958f SCUMM: Don't draw the top of the Indy 3 Mac text box to the screen
c6018fe678 SCUMM: Use the Mac palette for Indy 3 Mac
81ad3a9cf9 SCUMM: Honor the _keepText flag when creating the Indy 3 Mac text box
52fbee9ec7 SCUMM: Fix removing of the text box
b5cfd4d5e3 SCUMM: Remove mac_restoreCharsetBg()
2a361f3c61 SCUMM: Simplified previous commit
3f249aa67a SCUMM: De-simplify Mac text boxes a bit
0ecf7db54b SCUMM: Fix leftover text from copy protection screen in Indy 3 Mac
61dbbb2d72 SCUMM: Disable text position corrections for Indy 3 Mac in hi-res mode
8f216fe7b8 SCUMM: Fiddle with font height in Indy 3 Mac
50259adc4f SCUMM: Fix shadowed text in Indy 3 Mac
49b58ae946 SCUMM: Clarify Indy 3 Mac text position hack
671a169153 SCUMM: Fix inventory problem when offering items to other characters.
5b2ca72a32 SCUMM: Fix leftover verbs when giving objects to other characters
6fe09c2cba SCUMM: Added Indy 3 Mac high-resolution cursor
aac9b8296d SCUMM: Remove font 1 warning. It has served its purpose.
3f66ef36ac SCUMM: Eliminate strlen() to fix code analysis warning
985463cfd0 SCUMM: Make the Indy 3 Mac fix a bit more specific
1c352471bd SCUMM: Clear the credits between each text screen in Indy 3 Mac
276381dac2 SCUMM: Work around problem with inactive verbs being drawn in a scene
87f61b3589 SCUMM: Clarified comment about credits glitch workaround
e275b07e00 SCUMM: Fix thinko in CharsetRendererMac::getFontHeight()
0de3b584ea SCUMM: Fix Indy 3 Mac credits with the low resolution font
5f2bf42f84 SCUMM: Changed the workaround for verbs drawn in room 80


Commit: 0ffe2ada119d1ed1a08571e61284d8857c740b77
    https://github.com/scummvm/scummvm/commit/0ffe2ada119d1ed1a08571e61284d8857c740b77
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Allow more than one Mac font

Indiana Jones and the Last Crusade uses two fonts, thoug at the moment
it uses the wrong font during the intro. I'm not sure why.

Changed paths:
    engines/scumm/charset.cpp
    engines/scumm/charset.h
    engines/scumm/scumm.cpp


diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp
index 4e3f6610bd..7d4dbce0b1 100644
--- a/engines/scumm/charset.cpp
+++ b/engines/scumm/charset.cpp
@@ -1518,6 +1518,11 @@ CharsetRendererMac::CharsetRendererMac(ScummEngine *vm, const Common::String &fo
 
 	_pad = false;
 
+	// Indy 3 provides an "Indy" font in two sizes, 9 and 12, which are
+	// used for the text boxes. The smaller font can be used for a
+	// headline. The rest of the Mac GUI seems to use a system font, but
+	// that is not implemented.
+
 	// As far as I can tell, Loom uses only font size 13 for in-game text.
 	// The font is also provided in sizes 9 and 12, and it's possible that
 	// 12 is used for system messages, e.g. the original pause dialog. We
@@ -1536,42 +1541,61 @@ CharsetRendererMac::CharsetRendererMac(ScummEngine *vm, const Common::String &fo
 	// 60 is an upside-down note, i.e. the one used for c'.
 	// 95 is a used for the rest of the notes.
 
-	if (_vm->_game.id == GID_LOOM) {
+	if (_vm->_game.id == GID_INDY3 || _vm->_game.id == GID_LOOM) {
 		Common::MacResManager resource;
 		resource.open(fontFile);
 
-		uint16 fontId = 0;
+		Common::String fontFamilyName = (_vm->_game.id == GID_LOOM) ? "Loom" : "Indy";
 
-		Common::SeekableReadStream *fond = resource.getResource(MKTAG('F', 'O', 'N', 'D'), "Loom");
+		Common::SeekableReadStream *fond = resource.getResource(MKTAG('F', 'O', 'N', 'D'), fontFamilyName);
 		Graphics::MacFontFamily fontFamily;
 
 		if (fond) {
 			if (fontFamily.load(*fond)) {
 				Common::Array<Graphics::MacFontFamily::AsscEntry> *assoc = fontFamily.getAssocTable();
 				for (uint i = 0; i < assoc->size(); i++) {
-					if ((*assoc)[i]._fontSize == 13) {
-						fontId = (*assoc)[i]._fontID;
-						break;
+					int fontId = -1;
+					int fontSize = (*assoc)[i]._fontSize;
+
+					if (_vm->_game.id == GID_INDY3) {
+						if (fontSize == 9)
+							fontId = 1;
+						else if (fontSize == 12)
+							fontId = 0;
+					} else {
+						if (fontSize == 13)
+							fontId = 0;
+					}
+					if (fontId != -1) {
+						Common::SeekableReadStream *font = resource.getResource(MKTAG('F', 'O', 'N', 'T'), (*assoc)[i]._fontID);
+						_macFonts[fontId].loadFont(*font, &fontFamily, fontSize, 0);
+						delete font;
 					}
 				}
 			}
 			delete fond;
 		}
+	}
+}
 
-		assert(fontId);
+void CharsetRendererMac::setCurID(int32 id) {
+	if  (id == -1)
+		return;
 
-		Common::SeekableReadStream *font = resource.getResource(MKTAG('F', 'O', 'N', 'T'), fontId);
-		_macFont.loadFont(*font, &fontFamily, 13, 0);
-		delete font;
+	if (_vm->_game.id == GID_LOOM && id != 0) {
+		warning("CharsetRednererMac::setCurID(%d), changing to 0", id);
+		id = 0;
 	}
+
+	_curId = id;
 }
 
 int CharsetRendererMac::getFontHeight() {
-	return _macFont.getFontHeight() / 2;
+	return _macFonts[_curId].getFontHeight() / 2;
 }
 
 int CharsetRendererMac::getCharWidth(uint16 chr) {
-	return _macFont.getCharWidth(chr) / 2;
+	return _macFonts[_curId].getCharWidth(chr) / 2;
 }
 
 void CharsetRendererMac::printChar(int chr, bool ignoreCharsetMask) {
@@ -1663,14 +1687,14 @@ void CharsetRendererMac::printChar(int chr, bool ignoreCharsetMask) {
 
 	if (enableShadow) {
 		left = macLeft / 2;
-		right = (macLeft + _macFont.getCharWidth(chr) + 3) / 2;
+		right = (macLeft + _macFonts[_curId].getCharWidth(chr) + 3) / 2;
 		top = macTop / 2;
-		bottom = (macTop + _macFont.getFontHeight() + 3) / 2;
+		bottom = (macTop + _macFonts[_curId].getFontHeight() + 3) / 2;
 	} else {
 		left = (macLeft + 1) / 2;
-		right = (macLeft + _macFont.getCharWidth(chr) + 1) / 2;
+		right = (macLeft + _macFonts[_curId].getCharWidth(chr) + 1) / 2;
 		top = (macTop + 1) / 2;
-		bottom = (macTop + _macFont.getFontHeight() + 1) / 2;
+		bottom = (macTop + _macFonts[_curId].getFontHeight() + 1) / 2;
 	}
 
 	if (_firstChar) {
@@ -1698,7 +1722,7 @@ void CharsetRendererMac::printChar(int chr, bool ignoreCharsetMask) {
 	// The next character may have to be adjusted to compensate for
 	// rounding errors.
 
-	macLeft += _macFont.getCharWidth(chr);
+	macLeft += _macFonts[_curId].getCharWidth(chr);
 	if (macLeft & 1)
 		_pad = true;
 
@@ -1708,25 +1732,25 @@ void CharsetRendererMac::printChar(int chr, bool ignoreCharsetMask) {
 
 void CharsetRendererMac::printCharInternal(int chr, int color, bool shadow, int x, int y) {
 	if (shadow) {
-		_macFont.drawChar(&_vm->_textSurface, chr, x + 2, y, 0);
-		_macFont.drawChar(&_vm->_textSurface, chr, x, y + 2, 0);
-		_macFont.drawChar(&_vm->_textSurface, chr, x + 3, y + 3, 0);
+		_macFonts[_curId].drawChar(&_vm->_textSurface, chr, x + 2, y, 0);
+		_macFonts[_curId].drawChar(&_vm->_textSurface, chr, x, y + 2, 0);
+		_macFonts[_curId].drawChar(&_vm->_textSurface, chr, x + 3, y + 3, 0);
 
 		if (color != -1) {
-			_macFont.drawChar(_vm->_macScreen, chr, x + 2, y, _shadowColor);
-			_macFont.drawChar(_vm->_macScreen, chr, x, y + 2, _shadowColor);
-			_macFont.drawChar(_vm->_macScreen, chr, x + 3, y + 3, _shadowColor);
+			_macFonts[_curId].drawChar(_vm->_macScreen, chr, x + 2, y, _shadowColor);
+			_macFonts[_curId].drawChar(_vm->_macScreen, chr, x, y + 2, _shadowColor);
+			_macFonts[_curId].drawChar(_vm->_macScreen, chr, x + 3, y + 3, _shadowColor);
 		}
 	}
 
-	_macFont.drawChar(&_vm->_textSurface, chr, x + 1, y + 1, 0);
+	_macFonts[_curId].drawChar(&_vm->_textSurface, chr, x + 1, y + 1, 0);
 
 	if (color != -1)
-		_macFont.drawChar(_vm->_macScreen, chr, x + 1, y + 1, color);
+		_macFonts[_curId].drawChar(_vm->_macScreen, chr, x + 1, y + 1, color);
 }
 
 void CharsetRendererMac::drawChar(int chr, Graphics::Surface &s, int x, int y) {
-	_macFont.drawChar(&s, chr, x, y, _color);
+	_macFonts[_curId].drawChar(&s, chr, x, y, _color);
 }
 
 void CharsetRendererMac::setColor(byte color) {
diff --git a/engines/scumm/charset.h b/engines/scumm/charset.h
index d8dc1c13f9..04225d781e 100644
--- a/engines/scumm/charset.h
+++ b/engines/scumm/charset.h
@@ -277,7 +277,7 @@ public:
 
 class CharsetRendererMac : public CharsetRendererCommon {
 protected:
-	Graphics::MacFONTFont _macFont;
+	Graphics::MacFONTFont _macFonts[2];
 	bool _pad;
 	int _lastTop;
 
@@ -286,7 +286,7 @@ protected:
 public:
 	CharsetRendererMac(ScummEngine *vm, const Common::String &fontFile);
 
-	void setCurID(int32 id) override {}
+	void setCurID(int32 id) override;
 	int getFontHeight() override;
 	int getCharWidth(uint16 chr) override;
 	void printChar(int chr, bool ignoreCharsetMask) override;
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 7ffa28c08b..a0d4368b1e 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -1297,12 +1297,38 @@ Common::Error ScummEngine::init() {
 	if (_game.platform == Common::kPlatformMacintosh) {
 		Common::MacResManager resource;
 
-		if (_game.id == GID_LOOM) {
-			// \xAA is a trademark glyph in Mac OS Roman. We try
-			// that, but also the Windows version, the UTF-8
-			// version, and just plain without in case the file
-			// system can't handle exotic characters like that.
+		// \xAA is a trademark glyph in Mac OS Roman. We try that, but
+		// also the Windows version, the UTF-8 version, and just plain
+		// without in case the file system can't handle exotic
+		// characters like that.
+
+		if (_game.id == GID_INDY3) {
+			static const char *indyFileNames[] = {
+				"Indy\xAA",
+				"Indy\x99",
+				"Indy\xE2\x84\xA2",
+				"Indy"
+			};
+
+			for (int i = 0; i < ARRAYSIZE(indyFileNames); i++) {
+				if (resource.exists(indyFileNames[i])) {
+					macResourceFile = indyFileNames[i];
 
+					_textSurfaceMultiplier = 2;
+					_macScreen = new Graphics::Surface();
+					_macScreen->create(640, 400, Graphics::PixelFormat::createFormatCLUT8());
+					break;
+				}
+			}
+
+			if (macResourceFile.empty()) {
+				GUI::MessageDialog dialog(_(
+"Could not find the 'Indy' Macintosh executable. High-resolution fonts will\n"
+"be disabled."), _("OK"));
+				dialog.runModal();
+			}
+
+		} else if (_game.id == GID_LOOM) {
 			static const char *loomFileNames[] = {
 				"Loom\xAA",
 				"Loom\x99",
@@ -1445,7 +1471,9 @@ void ScummEngine::setupScumm(const Common::String &macResourceFile) {
 	Common::String macFontFile;
 
 	if (_game.platform == Common::kPlatformMacintosh) {
-		if (_game.id == GID_LOOM) {
+		if (_game.id == GID_INDY3) {
+			macFontFile = macResourceFile;
+		} if (_game.id == GID_LOOM) {
 			macInstrumentFile = macResourceFile;
 			macFontFile = macResourceFile;
 			_macCursorFile = macResourceFile;


Commit: 82cde1fa05ec2929586e1d82f69b79391d4130c0
    https://github.com/scummvm/scummvm/commit/82cde1fa05ec2929586e1d82f69b79391d4130c0
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: For now, remap font 1 to font 0 in Indy 3 Mac

It's tempting to think that font 1 is supposed to be a bold version of
font 0, but that donsn't match the screenshots I've seen.

Changed paths:
    engines/scumm/charset.cpp


diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp
index 7d4dbce0b1..cc8c245155 100644
--- a/engines/scumm/charset.cpp
+++ b/engines/scumm/charset.cpp
@@ -1582,8 +1582,19 @@ void CharsetRendererMac::setCurID(int32 id) {
 	if  (id == -1)
 		return;
 
-	if (_vm->_game.id == GID_LOOM && id != 0) {
-		warning("CharsetRednererMac::setCurID(%d), changing to 0", id);
+	// HACK: Indiana Jones and the Last Crusade uses font id 1 at the very
+	// least during the intro to print the "BARNETT COLLEGE" text. Based on
+	// the DOS version, it's tempting to think that it should use a bold
+	// version of the font, but that's apparently not the case. I'm not sure
+	// what's supposed to happen here, but using font 0 seems to match what
+	// the original does.
+	if (_vm->_game.id == GID_INDY3 && id == 1) {
+		warning("CharsetRenderMac::setCurId - Font 1 requested");
+		id = 0;
+	}
+
+	if (id > 0) {
+		warning("CharsetRendererMac::setCurID(%d) - invalid charset", id);
 		id = 0;
 	}
 


Commit: 319492e83a3bb4104b0e9f0c3af76b0c1a199e88
    https://github.com/scummvm/scummvm/commit/319492e83a3bb4104b0e9f0c3af76b0c1a199e88
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Add function for drawing Indy 3 Mac text box

Well, the border and title at least. I still need to get the text to be
drawn inside, and remove the box once it's done.

Changed paths:
    engines/scumm/actor.cpp
    engines/scumm/charset.cpp
    engines/scumm/gfx_mac.cpp
    engines/scumm/scumm.h


diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index b52110631d..63f650753e 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -2871,6 +2871,11 @@ void ScummEngine::actorTalk(const byte *msg) {
 		}
 
 		a = derefActor(_actorToPrintStrFor, "actorTalk");
+
+		if (_macScreen && _game.id == GID_INDY3) {
+			mac_drawIndy3SpeechBox(a);
+		}
+
 		if (!a->isInCurrentRoom()) {
 			oldact = 0xFF;
 		} else {
diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp
index cc8c245155..7b9e42f296 100644
--- a/engines/scumm/charset.cpp
+++ b/engines/scumm/charset.cpp
@@ -1588,12 +1588,18 @@ void CharsetRendererMac::setCurID(int32 id) {
 	// version of the font, but that's apparently not the case. I'm not sure
 	// what's supposed to happen here, but using font 0 seems to match what
 	// the original does.
-	if (_vm->_game.id == GID_INDY3 && id == 1) {
-		warning("CharsetRenderMac::setCurId - Font 1 requested");
-		id = 0;
+	if (_vm->_game.id == GID_INDY3) {
+		if (id == 1) {
+			warning("CharsetRenderMac::setCurId - Font 1 requested");
+			id = 0;
+		} else if (id == 2) {
+			id = 1;
+		}
 	}
 
-	if (id > 0) {
+	int maxId = (_vm->_game.id == GID_LOOM) ? 0 : 1;
+
+	if (id > maxId) {
 		warning("CharsetRendererMac::setCurID(%d) - invalid charset", id);
 		id = 0;
 	}
@@ -1601,12 +1607,22 @@ void CharsetRendererMac::setCurID(int32 id) {
 	_curId = id;
 }
 
+// HACK: Usually, we want the approximate width and height in the unscaled
+//       graphics resolution. But for font 1 in Indiana Jones and the Last
+//       crusade we want the actual dimensions for drawing the text boxes.
+
 int CharsetRendererMac::getFontHeight() {
-	return _macFonts[_curId].getFontHeight() / 2;
+	int height = _macFonts[_curId].getFontHeight();
+	if (_curId == 0)
+		height /= 2;
+	return height;
 }
 
 int CharsetRendererMac::getCharWidth(uint16 chr) {
-	return _macFonts[_curId].getCharWidth(chr) / 2;
+	int width = _macFonts[_curId].getCharWidth(chr);
+	if (_curId == 0)
+		width /= 2;
+	return width;
 }
 
 void CharsetRendererMac::printChar(int chr, bool ignoreCharsetMask) {
diff --git a/engines/scumm/gfx_mac.cpp b/engines/scumm/gfx_mac.cpp
index 75b562bec0..2352724fef 100644
--- a/engines/scumm/gfx_mac.cpp
+++ b/engines/scumm/gfx_mac.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "common/system.h"
+#include "scumm/actor.h"
 #include "scumm/charset.h"
 #include "scumm/usage_bits.h"
 #include "scumm/verbs.h"
@@ -129,4 +130,51 @@ void ScummEngine::mac_drawLoomPracticeMode() {
 	_system->copyRectToScreen(ptr, pitch, x, y, width, height);
 }
 
+void ScummEngine::mac_drawIndy3SpeechBox(Actor *a) {
+	int x = 96;
+	int y = 31;
+	int width = 448;
+	int height = 46;
+
+	byte *ptr = (byte *)_macScreen->getBasePtr(x, y);
+	int pitch = _macScreen->pitch;
+
+	_macScreen->fillRect(Common::Rect(x, y, x + width, y + height), 0);
+
+	int nameWidth = 0;
+
+	if (a) {
+		int oldID = _charset->getCurID();
+		_charset->setCurID(2);
+
+		const char *name = (const char *)a->getActorName();
+		int len = strlen(name);
+
+		int charX = x + 25;
+		int charY = y - 1;
+
+		for (int i = 0; i < len; i++) {
+			_charset->drawChar(name[i], *_macScreen, charX, charY);
+			nameWidth += _charset->getCharWidth(name[i]);
+			charX += _charset->getCharWidth(name[i]);
+		}
+		_charset->drawChar(':', *_macScreen, charX, charY);
+		nameWidth += _charset->getCharWidth(':');
+
+		_charset->setCurID(oldID);
+	}
+
+	if (nameWidth) {
+		_macScreen->hLine(x + 2, y + 2, x + 20, 15);
+		_macScreen->hLine(x + 20 + nameWidth + 9, y + 2, x + width - 3, 15);
+	} else
+		_macScreen->hLine(x + 2, y + 2, x + width - 3, 15);
+
+	_macScreen->hLine(x + 2, y + height - 2, x + width - 3, 15);
+	_macScreen->vLine(x + 1, y + 3, y + height - 3, 15);
+	_macScreen->vLine(x + width - 2, y + 3, y + height - 3, 15);
+
+	_system->copyRectToScreen(ptr, pitch, x, y, width, height);
+}
+
 } // End of namespace Scumm
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index a63d008762..660ad3e575 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -959,6 +959,7 @@ protected:
 	void mac_drawStripToScreen(VirtScreen *vs, int top, int x, int y, int width, int height);
 	void mac_restoreCharsetBg();
 	void mac_drawLoomPracticeMode();
+	void mac_drawIndy3SpeechBox(Actor *a);
 
 	void ditherCGA(byte *dst, int dstPitch, int x, int y, int width, int height) const;
 


Commit: 9d2d6b60c8290e81cb847faa5c2900b63489d459
    https://github.com/scummvm/scummvm/commit/9d2d6b60c8290e81cb847faa5c2900b63489d459
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Some more work on the Indy 3 Mac text box.

I'm starting to reconsider the exact way I'm doing this, so this is a
good place to commit what's there, before tearing it up.

Changed paths:
    engines/scumm/actor.cpp
    engines/scumm/charset.cpp
    engines/scumm/gfx_mac.cpp
    engines/scumm/scumm.h
    engines/scumm/string.cpp


diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index 63f650753e..8a5e29875a 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -2872,10 +2872,6 @@ void ScummEngine::actorTalk(const byte *msg) {
 
 		a = derefActor(_actorToPrintStrFor, "actorTalk");
 
-		if (_macScreen && _game.id == GID_INDY3) {
-			mac_drawIndy3SpeechBox(a);
-		}
-
 		if (!a->isInCurrentRoom()) {
 			oldact = 0xFF;
 		} else {
diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp
index 7b9e42f296..5dcb3accad 100644
--- a/engines/scumm/charset.cpp
+++ b/engines/scumm/charset.cpp
@@ -1674,8 +1674,10 @@ void CharsetRendererMac::printChar(int chr, bool ignoreCharsetMask) {
 	//       shadowing at all. I'll just keep it like this for now,
 	//       because it makes the notes stand out a bit better.
 
-	if ((chr >= 16 && chr <= 23) || chr == 60 || chr == 95) {
-		enableShadow = true;
+	if (_vm->_game.id == GID_LOOM) {
+		if ((chr >= 16 && chr <= 23) || chr == 60 || chr == 95) {
+			enableShadow = true;
+		}
 	}
 
 	// HACK: Apparently, note names are never drawn in light gray. Only
@@ -1684,8 +1686,10 @@ void CharsetRendererMac::printChar(int chr, bool ignoreCharsetMask) {
 	//       light gray note names, because apparently the game never
 	//       changes them back to light gray once the draft is done?
 
-	if (chr >= 16 && chr <= 23 && _color == 7)
-		color = 15;
+	if (_vm->_game.id == GID_LOOM) {
+		if (chr >= 16 && chr <= 23 && _color == 7)
+			color = 15;
+	}
 
 	printCharInternal(chr, color, enableShadow, macLeft, macTop);
 
@@ -1701,11 +1705,13 @@ void CharsetRendererMac::printChar(int chr, bool ignoreCharsetMask) {
 	//       Note that this will not affect the Practice Mode box, since
 	//       this note names are drawn by drawChar(), not printChar().
 
-	if (chr >= 16 && chr <= 23) {
-		int xOffset[] = { 16, 14, 12, 8, 6, 2, 0, 8 };
+	if (_vm->_game.id == GID_LOOM) {
+		if (chr >= 16 && chr <= 23) {
+			int xOffset[] = { 16, 14, 12, 8, 6, 2, 0, 8 };
 
-		int note = (chr == 23) ? 60 : 95;
-		printCharInternal(note, -1, enableShadow, macLeft + 18, macTop + xOffset[chr - 16]);
+			int note = (chr == 23) ? 60 : 95;
+			printCharInternal(note, -1, enableShadow, macLeft + 18, macTop + xOffset[chr - 16]);
+		}
 	}
 
 	// Mark the virtual screen as dirty, using downscaled coordinates.
diff --git a/engines/scumm/gfx_mac.cpp b/engines/scumm/gfx_mac.cpp
index 2352724fef..88b1636142 100644
--- a/engines/scumm/gfx_mac.cpp
+++ b/engines/scumm/gfx_mac.cpp
@@ -130,7 +130,7 @@ void ScummEngine::mac_drawLoomPracticeMode() {
 	_system->copyRectToScreen(ptr, pitch, x, y, width, height);
 }
 
-void ScummEngine::mac_drawIndy3SpeechBox(Actor *a) {
+void ScummEngine::mac_drawIndy3TextBox(Actor *a) {
 	int x = 96;
 	int y = 31;
 	int width = 448;
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 660ad3e575..853c1c0b1e 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -959,7 +959,7 @@ protected:
 	void mac_drawStripToScreen(VirtScreen *vs, int top, int x, int y, int width, int height);
 	void mac_restoreCharsetBg();
 	void mac_drawLoomPracticeMode();
-	void mac_drawIndy3SpeechBox(Actor *a);
+	void mac_drawIndy3TextBox(Actor *a);
 
 	void ditherCGA(byte *dst, int dstPitch, int x, int y, int width, int height) const;
 
diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp
index 7d83599965..38d4f2bfdb 100644
--- a/engines/scumm/string.cpp
+++ b/engines/scumm/string.cpp
@@ -741,6 +741,8 @@ void ScummEngine::CHARSET_1() {
 		fakeBidiString(_charsetBuffer + _charsetBufPos, true);
 	}
 
+	bool drawTextBox = (_macScreen && _game.id == GID_INDY3);
+
 	while (handleNextCharsetCode(a, &c)) {
 		if (c == 0) {
 			// End of text reached, set _haveMsg accordingly
@@ -775,6 +777,11 @@ void ScummEngine::CHARSET_1() {
 		_charset->_left = _nextLeft;
 		_charset->_top = _nextTop;
 
+		if (drawTextBox) {
+			mac_drawIndy3TextBox(a);
+			drawTextBox = false;
+		}
+
 		if (_game.version >= 7) {
 #ifdef ENABLE_SCUMM_7_8
 			if (subtitleLine == subtitleBuffer) {


Commit: cfe270c8af6219d95d8f2f6cd254fa0ade1c8143
    https://github.com/scummvm/scummvm/commit/cfe270c8af6219d95d8f2f6cd254fa0ade1c8143
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Render the Indy 3 Mac text box to a separate surface.

There's still the matter of exactly when the text box should be created
(sometimes text is drawn to it in several steps, and we don't want to
erase the old text), and when/how to remove the box.

Changed paths:
    engines/scumm/charset.cpp
    engines/scumm/charset.h
    engines/scumm/gfx_mac.cpp
    engines/scumm/scumm.cpp
    engines/scumm/scumm.h
    engines/scumm/string.cpp


diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp
index 5dcb3accad..97caa07d09 100644
--- a/engines/scumm/charset.cpp
+++ b/engines/scumm/charset.cpp
@@ -1659,11 +1659,6 @@ void CharsetRendererMac::printChar(int chr, bool ignoreCharsetMask) {
 	bool enableShadow = _enableShadow;
 	int color = _color;
 
-	// Shadowing is a bit of guesswork. It doesn't look like it's using
-	// the Mac's built-in form of shadowed text (which, as I recall it,
-	// never looked particularly good anyway). This seems to match the
-	// original look for normal text.
-
 	// HACK: Notes and their names should always be drawn with a shadow.
 	//       Actually, this doesn't quite match the original but I can't
 	//       figure out what the original does here. The "c" looks like
@@ -1691,7 +1686,12 @@ void CharsetRendererMac::printChar(int chr, bool ignoreCharsetMask) {
 			color = 15;
 	}
 
-	printCharInternal(chr, color, enableShadow, macLeft, macTop);
+	bool drawToTextBox = (vs->number == 1 && _vm->_game.id == GID_INDY3);
+
+	if (drawToTextBox)
+		printCharToTextBox(chr, color, macLeft, macTop);
+	else
+		printCharInternal(chr, color, enableShadow, macLeft, macTop);
 
 	// HACK: The way we combine high and low resolution graphics means
 	//       that sometimes, when a note name is drawn on the distaff, the
@@ -1745,7 +1745,8 @@ void CharsetRendererMac::printChar(int chr, bool ignoreCharsetMask) {
 			_str.bottom = bottom;
 	}
 
-	_vm->markRectAsDirty(vs->number, left, right, top - vs->topline, bottom - vs->topline);
+	if (!drawToTextBox)
+		_vm->markRectAsDirty(vs->number, left, right, top - vs->topline, bottom - vs->topline);
 
 	if (!ignoreCharsetMask) {
 		_hasMask = true;
@@ -1764,6 +1765,11 @@ void CharsetRendererMac::printChar(int chr, bool ignoreCharsetMask) {
 }
 
 void CharsetRendererMac::printCharInternal(int chr, int color, bool shadow, int x, int y) {
+	// Shadowing is a bit of guesswork. It doesn't look like it's using
+	// the Mac's built-in form of shadowed text (which, as I recall it,
+	// never looked particularly good anyway). This seems to match the
+	// original look for normal text.
+
 	if (shadow) {
 		_macFonts[_curId].drawChar(&_vm->_textSurface, chr, x + 2, y, 0);
 		_macFonts[_curId].drawChar(&_vm->_textSurface, chr, x, y + 2, 0);
@@ -1782,6 +1788,10 @@ void CharsetRendererMac::printCharInternal(int chr, int color, bool shadow, int
 		_macFonts[_curId].drawChar(_vm->_macScreen, chr, x + 1, y + 1, color);
 }
 
+void CharsetRendererMac::printCharToTextBox(int chr, int color, int x, int y) {
+	_macFonts[_curId].drawChar(_vm->_macIndy3TextBox, chr, x + 5, y + 11, _color);
+}
+
 void CharsetRendererMac::drawChar(int chr, Graphics::Surface &s, int x, int y) {
 	_macFonts[_curId].drawChar(&s, chr, x, y, _color);
 }
diff --git a/engines/scumm/charset.h b/engines/scumm/charset.h
index 04225d781e..6839519058 100644
--- a/engines/scumm/charset.h
+++ b/engines/scumm/charset.h
@@ -282,6 +282,7 @@ protected:
 	int _lastTop;
 
 	void printCharInternal(int chr, int color, bool shadow, int x, int y);
+	void printCharToTextBox(int chr, int color, int x, int y);
 
 public:
 	CharsetRendererMac(ScummEngine *vm, const Common::String &fontFile);
diff --git a/engines/scumm/gfx_mac.cpp b/engines/scumm/gfx_mac.cpp
index 88b1636142..3299900e42 100644
--- a/engines/scumm/gfx_mac.cpp
+++ b/engines/scumm/gfx_mac.cpp
@@ -130,16 +130,11 @@ void ScummEngine::mac_drawLoomPracticeMode() {
 	_system->copyRectToScreen(ptr, pitch, x, y, width, height);
 }
 
-void ScummEngine::mac_drawIndy3TextBox(Actor *a) {
-	int x = 96;
-	int y = 31;
-	int width = 448;
-	int height = 46;
+void ScummEngine::mac_createIndy3TextBox(Actor *a) {
+	int width = _macIndy3TextBox->w;
+	int height = _macIndy3TextBox->h;
 
-	byte *ptr = (byte *)_macScreen->getBasePtr(x, y);
-	int pitch = _macScreen->pitch;
-
-	_macScreen->fillRect(Common::Rect(x, y, x + width, y + height), 0);
+	_macIndy3TextBox->fillRect(Common::Rect(width, height), 0);
 
 	int nameWidth = 0;
 
@@ -150,31 +145,31 @@ void ScummEngine::mac_drawIndy3TextBox(Actor *a) {
 		const char *name = (const char *)a->getActorName();
 		int len = strlen(name);
 
-		int charX = x + 25;
-		int charY = y - 1;
+		int charX = 25;
 
 		for (int i = 0; i < len; i++) {
-			_charset->drawChar(name[i], *_macScreen, charX, charY);
+			_charset->drawChar(name[i], *_macIndy3TextBox, charX, 0);
 			nameWidth += _charset->getCharWidth(name[i]);
 			charX += _charset->getCharWidth(name[i]);
 		}
-		_charset->drawChar(':', *_macScreen, charX, charY);
-		nameWidth += _charset->getCharWidth(':');
 
+		_charset->drawChar(':', *_macIndy3TextBox, charX, 0);
 		_charset->setCurID(oldID);
 	}
 
 	if (nameWidth) {
-		_macScreen->hLine(x + 2, y + 2, x + 20, 15);
-		_macScreen->hLine(x + 20 + nameWidth + 9, y + 2, x + width - 3, 15);
+		_macIndy3TextBox->hLine(2, 3, 20, 15);
+		_macIndy3TextBox->hLine(32 + nameWidth, 3, width - 3, 15);
 	} else
-		_macScreen->hLine(x + 2, y + 2, x + width - 3, 15);
+		_macIndy3TextBox->hLine(2, 3, width - 3, 15);
 
-	_macScreen->hLine(x + 2, y + height - 2, x + width - 3, 15);
-	_macScreen->vLine(x + 1, y + 3, y + height - 3, 15);
-	_macScreen->vLine(x + width - 2, y + 3, y + height - 3, 15);
+	_macIndy3TextBox->vLine(1, 4, height - 3, 15);
+	_macIndy3TextBox->vLine(width - 2, 4, height - 3, 15);
+	_macIndy3TextBox->hLine(2, height - 2, width - 3, 15);
+}
 
-	_system->copyRectToScreen(ptr, pitch, x, y, width, height);
+void ScummEngine::mac_drawIndy3TextBox() {
+	_system->copyRectToScreen((byte *)_macIndy3TextBox->getBasePtr(0, 0), _macIndy3TextBox->pitch, 96, 30, _macIndy3TextBox->w, _macIndy3TextBox->h);
 }
 
 } // End of namespace Scumm
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index a0d4368b1e..1d0cc1b336 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -280,6 +280,7 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
 	_hePaletteSlot = 0;
 	_16BitPalette = NULL;
 	_macScreen = NULL;
+	_macIndy3TextBox = NULL;
 #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
 	_townsScreen = 0;
 	_scrollRequest = _scrollDeltaAdjust = 0;
@@ -680,6 +681,11 @@ ScummEngine::~ScummEngine() {
 		delete _macScreen;
 	}
 
+	if (_macIndy3TextBox) {
+		_macIndy3TextBox->free();
+		delete _macIndy3TextBox;
+	}
+
 #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
 	delete _townsScreen;
 #ifdef USE_RGB_COLOR
@@ -1317,6 +1323,9 @@ Common::Error ScummEngine::init() {
 					_textSurfaceMultiplier = 2;
 					_macScreen = new Graphics::Surface();
 					_macScreen->create(640, 400, Graphics::PixelFormat::createFormatCLUT8());
+
+					_macIndy3TextBox = new Graphics::Surface();
+					_macIndy3TextBox->create(448, 47, Graphics::PixelFormat::createFormatCLUT8());
 					break;
 				}
 			}
@@ -1696,6 +1705,10 @@ void ScummEngine::resetScumm() {
 		_macScreen->fillRect(Common::Rect(_macScreen->w, _macScreen->h), 0);
 	}
 
+	if (_macIndy3TextBox) {
+		_macIndy3TextBox->fillRect(Common::Rect(_macIndy3TextBox->w, _macIndy3TextBox->h), 0);
+	}
+
 	if (_game.version == 0) {
 		initScreens(8, 144);
 	} else if ((_game.id == GID_MANIAC) && (_game.version <= 1) && !(_game.platform == Common::kPlatformNES)) {
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 853c1c0b1e..011f01646a 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -959,7 +959,8 @@ protected:
 	void mac_drawStripToScreen(VirtScreen *vs, int top, int x, int y, int width, int height);
 	void mac_restoreCharsetBg();
 	void mac_drawLoomPracticeMode();
-	void mac_drawIndy3TextBox(Actor *a);
+	void mac_createIndy3TextBox(Actor *a);
+	void mac_drawIndy3TextBox();
 
 	void ditherCGA(byte *dst, int dstPitch, int x, int y, int width, int height) const;
 
@@ -1103,6 +1104,7 @@ public:
 	Graphics::Surface _textSurface;
 	int _textSurfaceMultiplier;
 	Graphics::Surface *_macScreen;
+	Graphics::Surface *_macIndy3TextBox;
 
 protected:
 	byte _charsetColor;
diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp
index 38d4f2bfdb..a0ac3aa762 100644
--- a/engines/scumm/string.cpp
+++ b/engines/scumm/string.cpp
@@ -741,7 +741,8 @@ void ScummEngine::CHARSET_1() {
 		fakeBidiString(_charsetBuffer + _charsetBufPos, true);
 	}
 
-	bool drawTextBox = (_macScreen && _game.id == GID_INDY3);
+	bool createTextBox = (_macScreen && _game.id == GID_INDY3);
+	bool drawTextBox = false;
 
 	while (handleNextCharsetCode(a, &c)) {
 		if (c == 0) {
@@ -777,9 +778,10 @@ void ScummEngine::CHARSET_1() {
 		_charset->_left = _nextLeft;
 		_charset->_top = _nextTop;
 
-		if (drawTextBox) {
-			mac_drawIndy3TextBox(a);
-			drawTextBox = false;
+		if (createTextBox) {
+			mac_createIndy3TextBox(a);
+			createTextBox = false;
+			drawTextBox = true;
 		}
 
 		if (_game.version >= 7) {
@@ -821,6 +823,9 @@ void ScummEngine::CHARSET_1() {
 			_nextTop = _charset->_top;
 		}
 
+		if (drawTextBox)
+			mac_drawIndy3TextBox();
+
 		if (_game.version <= 2) {
 			_talkDelay += _defaultTalkDelay;
 			VAR(VAR_CHARCOUNT)++;


Commit: 84fb97958fb235065353c6b385e7efe197211cea
    https://github.com/scummvm/scummvm/commit/84fb97958fb235065353c6b385e7efe197211cea
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Don't draw the top of the Indy 3 Mac text box to the screen

It's only there so that the font renderer will definitely have something
to draw to.

Changed paths:
    engines/scumm/gfx_mac.cpp


diff --git a/engines/scumm/gfx_mac.cpp b/engines/scumm/gfx_mac.cpp
index 3299900e42..0e97cb8c98 100644
--- a/engines/scumm/gfx_mac.cpp
+++ b/engines/scumm/gfx_mac.cpp
@@ -169,7 +169,7 @@ void ScummEngine::mac_createIndy3TextBox(Actor *a) {
 }
 
 void ScummEngine::mac_drawIndy3TextBox() {
-	_system->copyRectToScreen((byte *)_macIndy3TextBox->getBasePtr(0, 0), _macIndy3TextBox->pitch, 96, 30, _macIndy3TextBox->w, _macIndy3TextBox->h);
+	_system->copyRectToScreen((byte *)_macIndy3TextBox->getBasePtr(0, 2), _macIndy3TextBox->pitch, 96, 32, _macIndy3TextBox->w, _macIndy3TextBox->h - 2);
 }
 
 } // End of namespace Scumm


Commit: c6018fe678d3dc532d862062c9332f111d21bd1a
    https://github.com/scummvm/scummvm/commit/c6018fe678d3dc532d862062c9332f111d21bd1a
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Use the Mac palette for Indy 3 Mac

Changed paths:
    engines/scumm/palette.cpp


diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp
index 833c2c5aeb..10fc5a64a7 100644
--- a/engines/scumm/palette.cpp
+++ b/engines/scumm/palette.cpp
@@ -253,7 +253,7 @@ void ScummEngine::resetPalette() {
 		default:
 			if ((_game.platform == Common::kPlatformAmiga) || (_game.platform == Common::kPlatformAtariST))
 				setPaletteFromTable(tableAmigaPalette, sizeof(tableAmigaPalette) / 3);
-			else if (_game.id == GID_LOOM && _game.platform == Common::kPlatformMacintosh)
+			else if ((_game.id == GID_LOOM || _game.id == GID_INDY3) && _game.platform == Common::kPlatformMacintosh)
 				setPaletteFromTable(tableMacPalette, sizeof(tableMacPalette) / 3);
 			else
 				setPaletteFromTable(tableEGAPalette, sizeof(tableEGAPalette) / 3);


Commit: 81ad3a9cf93d0af65f90d450bdc1d556fdafc98a
    https://github.com/scummvm/scummvm/commit/81ad3a9cf93d0af65f90d450bdc1d556fdafc98a
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Honor the _keepText flag when creating the Indy 3 Mac text box

Sometimes more than one piece of text is drawn to the same box, and we
don't want to clear the old text then.

Changed paths:
    engines/scumm/string.cpp


diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp
index a0ac3aa762..c57aea3d4a 100644
--- a/engines/scumm/string.cpp
+++ b/engines/scumm/string.cpp
@@ -779,7 +779,8 @@ void ScummEngine::CHARSET_1() {
 		_charset->_top = _nextTop;
 
 		if (createTextBox) {
-			mac_createIndy3TextBox(a);
+			if (!_keepText)
+				mac_createIndy3TextBox(a);
 			createTextBox = false;
 			drawTextBox = true;
 		}


Commit: 52fbee9ec7714b093eb658af36a8f0660f62a386
    https://github.com/scummvm/scummvm/commit/52fbee9ec7714b093eb658af36a8f0660f62a386
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Fix removing of the text box

That takes care of most of the remaining glitches, at least in the early
game.

Changed paths:
    engines/scumm/charset.cpp
    engines/scumm/gfx_mac.cpp


diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp
index 97caa07d09..4e867661f7 100644
--- a/engines/scumm/charset.cpp
+++ b/engines/scumm/charset.cpp
@@ -1686,7 +1686,7 @@ void CharsetRendererMac::printChar(int chr, bool ignoreCharsetMask) {
 			color = 15;
 	}
 
-	bool drawToTextBox = (vs->number == 1 && _vm->_game.id == GID_INDY3);
+	bool drawToTextBox = (vs->number == kTextVirtScreen && _vm->_game.id == GID_INDY3);
 
 	if (drawToTextBox)
 		printCharToTextBox(chr, color, macLeft, macTop);
diff --git a/engines/scumm/gfx_mac.cpp b/engines/scumm/gfx_mac.cpp
index 0e97cb8c98..245c1ef1a8 100644
--- a/engines/scumm/gfx_mac.cpp
+++ b/engines/scumm/gfx_mac.cpp
@@ -169,7 +169,42 @@ void ScummEngine::mac_createIndy3TextBox(Actor *a) {
 }
 
 void ScummEngine::mac_drawIndy3TextBox() {
-	_system->copyRectToScreen((byte *)_macIndy3TextBox->getBasePtr(0, 2), _macIndy3TextBox->pitch, 96, 32, _macIndy3TextBox->w, _macIndy3TextBox->h - 2);
+	// The first two rows of the text box are padding for font rendering.
+	// They are not drawn to the screen.
+
+	int x = 96;
+	int y = 32;
+	int w = _macIndy3TextBox->w;
+	int h = _macIndy3TextBox->h - 2;
+
+	// The text box is drawn to the Mac screen and text surface, as if it
+	// had been one giant glyph. Note that it will end up on the main
+	// virtual screen, not the text one.
+
+	VirtScreen *vs = &_virtscr[kMainVirtScreen];
+
+	byte *ptr = (byte *)_macIndy3TextBox->getBasePtr(0, 2);
+	int pitch = _macIndy3TextBox->pitch;
+
+	_macScreen->copyRectToSurface(ptr, pitch, x, y, w, h);
+	_textSurface.fillRect(Common::Rect(x, y, x + w, y + h), 0);
+	_charset->_textScreenID = vs->number;
+
+	// Mark the virtual screen as dirty. The top and left coordinates are
+	// rounded down, while the bottom and right ones are rounded up.
+
+	int vsTop = y / 2 - vs->topline;
+	int vsBottom = (y + h) / 2 - vs->topline;
+	int vsLeft = x / 2;
+	int vsRight = (x + w) / 2;
+
+	if ((y + h) & 1)
+		vsBottom++;
+
+	if ((x + w) & 1)
+		vsRight++;
+
+	markRectAsDirty(vs->number, vsLeft, vsRight, vsTop, vsBottom);
 }
 
 } // End of namespace Scumm


Commit: b5cfd4d5e3d5bee64017290c637d3c79d54b1c10
    https://github.com/scummvm/scummvm/commit/b5cfd4d5e3d5bee64017290c637d3c79d54b1c10
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Remove mac_restoreCharsetBg()

The differences between the two weren't as great as I had first thought.

Changed paths:
    engines/scumm/actor.cpp
    engines/scumm/gfx.cpp
    engines/scumm/gfx_mac.cpp
    engines/scumm/scumm.h


diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index 8a5e29875a..d49df646f6 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -2983,9 +2983,6 @@ void ScummEngine::stopTalk() {
 			towns_restoreCharsetBg();
 		else
 #endif
-		if (_macScreen)
-			mac_restoreCharsetBg();
-		else
 			restoreCharsetBg();
 	}
 }
diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index 555b97a18e..cacbe87d0c 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -1124,6 +1124,9 @@ void ScummEngine::restoreCharsetBg() {
 		_charset->_str.left = -1;
 		_charset->_left = -1;
 
+		if (_macScreen)
+			clearTextSurface();
+
 		// Restore background on the whole text area. This code is based on
 		// restoreBackground(), but was changed to only restore those parts which are
 		// currently covered by the charset mask.
diff --git a/engines/scumm/gfx_mac.cpp b/engines/scumm/gfx_mac.cpp
index 245c1ef1a8..686418ddac 100644
--- a/engines/scumm/gfx_mac.cpp
+++ b/engines/scumm/gfx_mac.cpp
@@ -57,25 +57,6 @@ void ScummEngine::mac_drawStripToScreen(VirtScreen *vs, int top, int x, int y, i
 	_system->copyRectToScreen(_macScreen->getBasePtr(x * 2, y * 2), _macScreen->pitch, x * 2, y * 2, width * 2, height * 2);
 }
 
-void ScummEngine::mac_restoreCharsetBg() {
-	_nextLeft = _string[0].xpos;
-	_nextTop = _string[0].ypos + _screenTop;
-
-	if (_charset->_hasMask) {
-		_charset->_hasMask = false;
-		_charset->_str.left = -1;
-		_charset->_left = -1;
-
-		clearTextSurface();
-
-		VirtScreen *vs = &_virtscr[_charset->_textScreenID];
-		if (!vs->h)
-			return;
-
-		markRectAsDirty(vs->number, Common::Rect(vs->w, vs->h), USAGE_BIT_RESTORED);
-	}
-}
-
 void ScummEngine::mac_drawLoomPracticeMode() {
 	// In practice mode, the game shows the notes as they are being played.
 	// In the DOS version, this is drawn by script 27 but the Mac version
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 011f01646a..5c91478f34 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -957,7 +957,6 @@ protected:
 	void updateDirtyScreen(VirtScreenNumber slot);
 	void drawStripToScreen(VirtScreen *vs, int x, int width, int top, int bottom);
 	void mac_drawStripToScreen(VirtScreen *vs, int top, int x, int y, int width, int height);
-	void mac_restoreCharsetBg();
 	void mac_drawLoomPracticeMode();
 	void mac_createIndy3TextBox(Actor *a);
 	void mac_drawIndy3TextBox();


Commit: 2a361f3c6189c73247116ba45bfa24e7c5cd30b1
    https://github.com/scummvm/scummvm/commit/2a361f3c6189c73247116ba45bfa24e7c5cd30b1
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Simplified previous commit

Changed paths:
    engines/scumm/gfx.cpp


diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index cacbe87d0c..b1de1fdbb5 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -1124,9 +1124,6 @@ void ScummEngine::restoreCharsetBg() {
 		_charset->_str.left = -1;
 		_charset->_left = -1;
 
-		if (_macScreen)
-			clearTextSurface();
-
 		// Restore background on the whole text area. This code is based on
 		// restoreBackground(), but was changed to only restore those parts which are
 		// currently covered by the charset mask.
@@ -1153,7 +1150,7 @@ void ScummEngine::restoreCharsetBg() {
 				memset(screenBuf, 0, vs->h * vs->pitch);
 		}
 
-		if (vs->hasTwoBuffers) {
+		if (vs->hasTwoBuffers || _macScreen) {
 			// Clean out the charset mask
 			clearTextSurface();
 		}


Commit: 3f249aa67a7c0c4f16dee69123d3e4ea3046f7f2
    https://github.com/scummvm/scummvm/commit/3f249aa67a7c0c4f16dee69123d3e4ea3046f7f2
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: De-simplify Mac text boxes a bit

We can't pretend that the Mac text box is on the main virtual screen,
because then removing it will remove all other text on the main virtual
screen, e.g. the copy protection instructions.

Changed paths:
    engines/scumm/gfx.cpp
    engines/scumm/gfx_mac.cpp
    engines/scumm/scumm.h


diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index b1de1fdbb5..070f8408cb 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -1124,6 +1124,11 @@ void ScummEngine::restoreCharsetBg() {
 		_charset->_str.left = -1;
 		_charset->_left = -1;
 
+		if (_macScreen && _game.id == GID_INDY3 && _charset->_textScreenID == kTextVirtScreen) {
+			mac_undrawIndy3TextBox();
+			return;
+		}
+
 		// Restore background on the whole text area. This code is based on
 		// restoreBackground(), but was changed to only restore those parts which are
 		// currently covered by the charset mask.
diff --git a/engines/scumm/gfx_mac.cpp b/engines/scumm/gfx_mac.cpp
index 686418ddac..6f8591b492 100644
--- a/engines/scumm/gfx_mac.cpp
+++ b/engines/scumm/gfx_mac.cpp
@@ -159,8 +159,8 @@ void ScummEngine::mac_drawIndy3TextBox() {
 	int h = _macIndy3TextBox->h - 2;
 
 	// The text box is drawn to the Mac screen and text surface, as if it
-	// had been one giant glyph. Note that it will end up on the main
-	// virtual screen, not the text one.
+	// had been one giant glyph. Note that it will be drawn on the main
+	// virtual screen, but we still pretend it's on the text one.
 
 	VirtScreen *vs = &_virtscr[kMainVirtScreen];
 
@@ -169,7 +169,6 @@ void ScummEngine::mac_drawIndy3TextBox() {
 
 	_macScreen->copyRectToSurface(ptr, pitch, x, y, w, h);
 	_textSurface.fillRect(Common::Rect(x, y, x + w, y + h), 0);
-	_charset->_textScreenID = vs->number;
 
 	// Mark the virtual screen as dirty. The top and left coordinates are
 	// rounded down, while the bottom and right ones are rounded up.
@@ -185,7 +184,32 @@ void ScummEngine::mac_drawIndy3TextBox() {
 	if ((x + w) & 1)
 		vsRight++;
 
-	markRectAsDirty(vs->number, vsLeft, vsRight, vsTop, vsBottom);
+	markRectAsDirty(kMainVirtScreen, vsLeft, vsRight, vsTop, vsBottom);
+}
+
+void ScummEngine::mac_undrawIndy3TextBox() {
+	int x = 96;
+	int y = 32;
+	int w = _macIndy3TextBox->w;
+	int h = _macIndy3TextBox->h - 2;
+
+	_macScreen->fillRect(Common::Rect(x, y, x + w, y + h), 0);
+	_textSurface.fillRect(Common::Rect(x, y, x + w, y + h), CHARSET_MASK_TRANSPARENCY);
+
+	VirtScreen *vs = &_virtscr[kMainVirtScreen];
+
+	int vsTop = y / 2 - vs->topline;
+	int vsBottom = (y + h) / 2 - vs->topline;
+	int vsLeft = x / 2;
+	int vsRight = (x + w) / 2;
+
+	if ((y + h) & 1)
+		vsBottom++;
+
+	if ((x + w) & 1)
+		vsRight++;
+
+	markRectAsDirty(kMainVirtScreen, vsLeft, vsRight, vsTop, vsBottom);
 }
 
 } // End of namespace Scumm
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 5c91478f34..0d3cc57b73 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -960,6 +960,7 @@ protected:
 	void mac_drawLoomPracticeMode();
 	void mac_createIndy3TextBox(Actor *a);
 	void mac_drawIndy3TextBox();
+	void mac_undrawIndy3TextBox();
 
 	void ditherCGA(byte *dst, int dstPitch, int x, int y, int width, int height) const;
 


Commit: 0ecf7db54b4c6caa90cb6d88b9385386080dec2c
    https://github.com/scummvm/scummvm/commit/0ecf7db54b4c6caa90cb6d88b9385386080dec2c
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Fix leftover text from copy protection screen in Indy 3 Mac

Changed paths:
    engines/scumm/gfx.cpp


diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index 070f8408cb..aef45c44e6 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -343,6 +343,11 @@ void ScummEngine::initScreens(int b, int h) {
 	}
 #endif
 
+	if (_macScreen) {
+		_macScreen->fillRect(Common::Rect(_macScreen->w, _macScreen->h), 0);
+		clearTextSurface();
+	}
+
 	if (!getResourceAddress(rtBuffer, 4)) {
 		// Since the size of screen 3 is fixed, there is no need to reallocate
 		// it if its size changed.


Commit: 61dbbb2d725e39e2c28087aa3f182f769bcfd8d3
    https://github.com/scummvm/scummvm/commit/61dbbb2d725e39e2c28087aa3f182f769bcfd8d3
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Disable text position corrections for Indy 3 Mac in hi-res mode

The text rendering isn't pixel perfect compared to the original, but I
actually think ScummVM looks better. Maybe the original draws one
character at a time without compensating for when the character width
isn't even? That might account for text being slightly wider in the
original.

Changed paths:
    engines/scumm/string.cpp


diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp
index c57aea3d4a..2d4c25e20d 100644
--- a/engines/scumm/string.cpp
+++ b/engines/scumm/string.cpp
@@ -1037,7 +1037,7 @@ void ScummEngine::drawString(int a, const byte *msg) {
 
 	// HACK: Correct positions of text in books in Indy3 Mac.
 	// See also bug #8759.
-	if (_game.id == GID_INDY3 && _game.platform == Common::kPlatformMacintosh && a == 1) {
+	if (_game.id == GID_INDY3 && _game.platform == Common::kPlatformMacintosh && a == 1 && !_macScreen) {
 		if (_currentRoom == 75) {
 			// Grail Diary Page 1 (Library)
 			if (_charset->_startLeft < 160)


Commit: 8f216fe7b8603ddaccad1a7674b209989dc2bfb2
    https://github.com/scummvm/scummvm/commit/8f216fe7b8603ddaccad1a7674b209989dc2bfb2
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Fiddle with font height in Indy 3 Mac

It's still not pixel perfect, but I think it looks fine for now.

Changed paths:
    engines/scumm/charset.cpp


diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp
index 4e867661f7..1fa4487d9c 100644
--- a/engines/scumm/charset.cpp
+++ b/engines/scumm/charset.cpp
@@ -1613,14 +1613,21 @@ void CharsetRendererMac::setCurID(int32 id) {
 
 int CharsetRendererMac::getFontHeight() {
 	int height = _macFonts[_curId].getFontHeight();
-	if (_curId == 0)
+	if (_vm->_game.id == GID_INDY3) {
+		// For font 0, round up the height. It's still not quite as
+		// widely spaced as in the original, but I think it looks fine.
+		if (height & 1)
+			height++;
 		height /= 2;
+	}
 	return height;
 }
 
 int CharsetRendererMac::getCharWidth(uint16 chr) {
 	int width = _macFonts[_curId].getCharWidth(chr);
-	if (_curId == 0)
+	// For font 1 in Last Crusade, we want the real width. It is used for
+	// text box titles, which are drawn outside the normal font rendering.
+	if (_curId == 0 || _vm->_game.id != GID_INDY3)
 		width /= 2;
 	return width;
 }


Commit: 50259adc4f39032c7dde95ad13fee07fd1ac68a4
    https://github.com/scummvm/scummvm/commit/50259adc4f39032c7dde95ad13fee07fd1ac68a4
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Fix shadowed text in Indy 3 Mac

Changed paths:
    engines/scumm/charset.cpp


diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp
index 1fa4487d9c..69072c3878 100644
--- a/engines/scumm/charset.cpp
+++ b/engines/scumm/charset.cpp
@@ -1772,21 +1772,30 @@ void CharsetRendererMac::printChar(int chr, bool ignoreCharsetMask) {
 }
 
 void CharsetRendererMac::printCharInternal(int chr, int color, bool shadow, int x, int y) {
-	// Shadowing is a bit of guesswork. It doesn't look like it's using
-	// the Mac's built-in form of shadowed text (which, as I recall it,
-	// never looked particularly good anyway). This seems to match the
-	// original look for normal text.
-
 	if (shadow) {
-		_macFonts[_curId].drawChar(&_vm->_textSurface, chr, x + 2, y, 0);
-		_macFonts[_curId].drawChar(&_vm->_textSurface, chr, x, y + 2, 0);
-		_macFonts[_curId].drawChar(&_vm->_textSurface, chr, x + 3, y + 3, 0);
-
-		if (color != -1) {
-			_macFonts[_curId].drawChar(_vm->_macScreen, chr, x + 2, y, _shadowColor);
-			_macFonts[_curId].drawChar(_vm->_macScreen, chr, x, y + 2, _shadowColor);
-			_macFonts[_curId].drawChar(_vm->_macScreen, chr, x + 3, y + 3, _shadowColor);
-		}
+		if (_vm->_game.id == GID_LOOM) {
+			// Shadowing is a bit of guesswork. It doesn't look
+			// like it's using the Mac's built-in form of shadowed
+			// text (which, as I recall it, never looked
+			// particularly good anyway). This seems to match the
+			// original look for normal text.
+
+			_macFonts[_curId].drawChar(&_vm->_textSurface, chr, x + 2, y, 0);
+			_macFonts[_curId].drawChar(&_vm->_textSurface, chr, x, y + 2, 0);
+			_macFonts[_curId].drawChar(&_vm->_textSurface, chr, x + 3, y + 3, 0);
+
+			if (color != -1) {
+				_macFonts[_curId].drawChar(_vm->_macScreen, chr, x + 2, y, _shadowColor);
+				_macFonts[_curId].drawChar(_vm->_macScreen, chr, x, y + 2, _shadowColor);
+				_macFonts[_curId].drawChar(_vm->_macScreen, chr, x + 3, y + 3, _shadowColor);
+			}
+		} else {
+			// Indy 3 uses simpler shadowing, and doesn't need the
+			// "draw only on text surface" hack.
+
+			_macFonts[_curId].drawChar(&_vm->_textSurface, chr, x + 2, y + 2, 0);
+			_macFonts[_curId].drawChar(_vm->_macScreen, chr, x + 2, y + 2, _shadowColor);
+		}			
 	}
 
 	_macFonts[_curId].drawChar(&_vm->_textSurface, chr, x + 1, y + 1, 0);
@@ -1808,12 +1817,10 @@ void CharsetRendererMac::setColor(byte color) {
 	_enableShadow = false;
 	_shadowColor = 0;
 
-	if (_vm->_game.id == GID_LOOM) {
-		_enableShadow = ((color & 0xF0) != 0);
-		// Anything outside the ordinary palette should be fine.
-		_shadowColor = 255;
-		_color &= 0x0F;
-	}
+	_enableShadow = ((color & 0xF0) != 0);
+	// Anything outside the ordinary palette should be fine.
+	_shadowColor = 255;
+	_color &= 0x0F;
 }
 
 #ifdef ENABLE_SCUMM_7_8


Commit: 49b58ae946fc4e6690cadb109c0c4ecac18a0526
    https://github.com/scummvm/scummvm/commit/49b58ae946fc4e6690cadb109c0c4ecac18a0526
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Clarify Indy 3 Mac text position hack

The text positions for the books in Indy 3 Mac only need to be adjusted
when using the low-resolution font. When using the Mac font, it works as
intended without changes.

Changed paths:
    engines/scumm/string.cpp


diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp
index 2d4c25e20d..d409eda9c5 100644
--- a/engines/scumm/string.cpp
+++ b/engines/scumm/string.cpp
@@ -1036,7 +1036,7 @@ void ScummEngine::drawString(int a, const byte *msg) {
 	_charset->setCurID(_string[a].charset);
 
 	// HACK: Correct positions of text in books in Indy3 Mac.
-	// See also bug #8759.
+	// See also bug #8759. Not needed when using the Mac font.
 	if (_game.id == GID_INDY3 && _game.platform == Common::kPlatformMacintosh && a == 1 && !_macScreen) {
 		if (_currentRoom == 75) {
 			// Grail Diary Page 1 (Library)


Commit: 671a169153f02a54c32239a246655a1134575be7
    https://github.com/scummvm/scummvm/commit/671a169153f02a54c32239a246655a1134575be7
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Fix inventory problem when offering items to other characters.

If you offered an object to someone, e.g. one of the guards at Castle
Brunwald, then clicked "Never mind" instead, the next time you tried you
would only see one inventory object. This seems to be because unlike the
DOS version (at least the 256-color version), script 12 only enables
verb 101, not the whole inventory.

Perhaps the Mac version treated the inventory as a single verb?

Changed paths:
    engines/scumm/script_v5.cpp


diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp
index c6b3d529db..9cd7c3ed96 100644
--- a/engines/scumm/script_v5.cpp
+++ b/engines/scumm/script_v5.cpp
@@ -2377,7 +2377,25 @@ void ScummEngine_v5::o5_verbOps() {
 			vs->origLeft = vs->curRect.left;
 			break;
 		case 6:		// SO_VERB_ON
-			vs->curmode = 1;
+			// It seems that the Mac version of Indiana Jones and
+			// the Last Crusade treats the entire inventory as a
+			// single verb, or at least that's my guess as far as
+			// script 12 is concerned. In the 256-color DOS
+			// version (I don't have the EGA version), the script
+			// enables all inventory verbs, and possibly the
+			// inventory arrows. Well, that's what the hard-coded
+			// inventory script does, so this should be fine.
+			//
+			// This fixes a problem where if you offer an object
+			// to someone and then press "Never mind", the next
+			// time you try you see only one inventory object.
+			//
+			// I don't know if it has to be limited to this
+			// particular script, but that's what I'll do for now.
+			if (_game.id == GID_INDY3 && _game.platform == Common::kPlatformMacintosh && verb == 101 && vm.slot[_currentScript].number == 12) {
+				inventoryScriptIndy3Mac();
+			} else
+				vs->curmode = 1;
 			break;
 		case 7:		// SO_VERB_OFF
 			vs->curmode = 0;


Commit: 5b2ca72a324e2b63cbf7c07880602f19ccacf375
    https://github.com/scummvm/scummvm/commit/5b2ca72a324e2b63cbf7c07880602f19ccacf375
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Fix leftover verbs when giving objects to other characters

It looks like the input script - or at least this particular input
script - expects to be called twice. Once to clear the verbs and once
for the recipient to accept/reject your offer. In the 256-color DOS
version, both of these are done during the same call.

I don't know if this applies to other input scripts as well, but I'm
limiting it to this one for now.

Changed paths:
    engines/scumm/script.cpp


diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp
index fc0f49723d..6d13e73490 100644
--- a/engines/scumm/script.cpp
+++ b/engines/scumm/script.cpp
@@ -1412,8 +1412,26 @@ void ScummEngine::runInputScript(int clickArea, int val, int mode) {
 		_lastInputScriptTime = time;
 	}
 
-	if (verbScript)
-		runScript(verbScript, 0, 0, args);
+	if (verbScript) {
+		// It seems that script 18 expects to be called twice: Once
+		// with parameter 1 (kVerbClickArea) to clear all the verbs,
+		// and once with 3 (kInventoryClickArea) to print the "Take
+		// this <something>" message.
+		//
+		// In the 256-color DOS version, this is all done in the same
+		// call to the script.
+		//
+		// Should this workaround apply to other input scripts
+		// as well? I don't know.
+		if (_game.id == GID_INDY3 && _game.platform == Common::kPlatformMacintosh && verbScript == 18 && val >= 101 && val <= 106) {
+			args[0] = kVerbClickArea;
+			runScript(verbScript, 0, 0, args);
+
+			args[0] = kInventoryClickArea;
+			runScript(verbScript, 0, 0, args);
+		} else
+			runScript(verbScript, 0, 0, args);
+	}
 }
 
 void ScummEngine::decreaseScriptDelay(int amount) {


Commit: 6fe09c2cbaaf5043a6b049c27bbeda8640ae13fb
    https://github.com/scummvm/scummvm/commit/6fe09c2cbaaf5043a6b049c27bbeda8640ae13fb
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Added Indy 3 Mac high-resolution cursor

Unlike Loom, there is apparently no cursor resource for this, so I'm
simply hard-coding it.

Changed paths:
    engines/scumm/cursor.cpp


diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp
index 83961ee931..9f0fcc6010 100644
--- a/engines/scumm/cursor.cpp
+++ b/engines/scumm/cursor.cpp
@@ -597,6 +597,8 @@ void ScummEngine_v5::resetCursors() {
 }
 
 void ScummEngine_v5::setBuiltinCursor(int idx) {
+	// TODO: This function gets called over and over. For the Mac cursors,
+	//       it should be enough to just call it once.
 	if (!_macCursorFile.empty()) {
 		Common::MacResManager resource;
 		if (resource.open(_macCursorFile)) {
@@ -612,6 +614,29 @@ void ScummEngine_v5::setBuiltinCursor(int idx) {
 		}
 	}
 
+	if (_game.id == GID_INDY3 && _macScreen) {
+		const byte buf[15 * 15] = {
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0xFF, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
+		};
+
+		CursorMan.replaceCursor(buf, 15, 15, 7, 7, 0xFF);
+		return;
+	}
+
 	int i, j;
 	uint16 color;
 	const uint16 *src = _cursorImages[_currentCursor];


Commit: aac9b8296d50e11659fb51003c7dfcd6f7978778
    https://github.com/scummvm/scummvm/commit/aac9b8296d50e11659fb51003c7dfcd6f7978778
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Remove font 1 warning. It has served its purpose.

My conclusion is that font 0 and font 1 are the same font in the Mac
version. In the DOS version, font 1 is a bolder font.

Changed paths:
    engines/scumm/charset.cpp


diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp
index 69072c3878..973241d490 100644
--- a/engines/scumm/charset.cpp
+++ b/engines/scumm/charset.cpp
@@ -1582,15 +1582,13 @@ void CharsetRendererMac::setCurID(int32 id) {
 	if  (id == -1)
 		return;
 
-	// HACK: Indiana Jones and the Last Crusade uses font id 1 at the very
-	// least during the intro to print the "BARNETT COLLEGE" text. Based on
-	// the DOS version, it's tempting to think that it should use a bold
-	// version of the font, but that's apparently not the case. I'm not sure
-	// what's supposed to happen here, but using font 0 seems to match what
-	// the original does.
+	// Indiana Jones and the Last Crusade uses font id 1 in a number of
+	// places. In the DOS version, this is a bolder font than font 0, but
+	// by the looks of it the Mac version uses the same font for both
+	// cases. In ScummVM, we match id 0 and 1 to font 0 and id 2 (which is
+	// only used to print the text box caption) to font 1.
 	if (_vm->_game.id == GID_INDY3) {
 		if (id == 1) {
-			warning("CharsetRenderMac::setCurId - Font 1 requested");
 			id = 0;
 		} else if (id == 2) {
 			id = 1;


Commit: 3f66ef36ac530893f007a19b59186f7d6436af55
    https://github.com/scummvm/scummvm/commit/3f66ef36ac530893f007a19b59186f7d6436af55
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Eliminate strlen() to fix code analysis warning

Instead of looping through the entire string, loop until the end of the
string or until the rendered string gets too wide for the text box. The
upper limit is somewhat arbitrarily chosen, but should look fine if an
actor name is ever that long. (Hint: They're not.)

Changed paths:
    engines/scumm/gfx_mac.cpp


diff --git a/engines/scumm/gfx_mac.cpp b/engines/scumm/gfx_mac.cpp
index 6f8591b492..b5ec46286a 100644
--- a/engines/scumm/gfx_mac.cpp
+++ b/engines/scumm/gfx_mac.cpp
@@ -124,11 +124,9 @@ void ScummEngine::mac_createIndy3TextBox(Actor *a) {
 		_charset->setCurID(2);
 
 		const char *name = (const char *)a->getActorName();
-		int len = strlen(name);
-
 		int charX = 25;
 
-		for (int i = 0; i < len; i++) {
+		for (int i = 0; name[i] && nameWidth < width - 50; i++) {
 			_charset->drawChar(name[i], *_macIndy3TextBox, charX, 0);
 			nameWidth += _charset->getCharWidth(name[i]);
 			charX += _charset->getCharWidth(name[i]);


Commit: 985463cfd00892d42faefa3137897b225ab2d431
    https://github.com/scummvm/scummvm/commit/985463cfd00892d42faefa3137897b225ab2d431
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Make the Indy 3 Mac fix a bit more specific

I don't know if there can ever be any confusion, but check that it's a
global script that's called, just to be safe.

Changed paths:
    engines/scumm/script_v5.cpp


diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp
index 9cd7c3ed96..ed141275b7 100644
--- a/engines/scumm/script_v5.cpp
+++ b/engines/scumm/script_v5.cpp
@@ -2392,7 +2392,7 @@ void ScummEngine_v5::o5_verbOps() {
 			//
 			// I don't know if it has to be limited to this
 			// particular script, but that's what I'll do for now.
-			if (_game.id == GID_INDY3 && _game.platform == Common::kPlatformMacintosh && verb == 101 && vm.slot[_currentScript].number == 12) {
+			if (_game.id == GID_INDY3 && _game.platform == Common::kPlatformMacintosh && verb == 101 && vm.slot[_currentScript].number == 12 && vm.slot[_currentScript].where == WIO_GLOBAL) {
 				inventoryScriptIndy3Mac();
 			} else
 				vs->curmode = 1;


Commit: 1c352471bd50c7fcd794a4d47e3e42d0228aa6eb
    https://github.com/scummvm/scummvm/commit/1c352471bd50c7fcd794a4d47e3e42d0228aa6eb
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Clear the credits between each text screen in Indy 3 Mac

I don't see anything in the script that would do it (well, there is one
but that may be just an accidental leftover from the DOS version), so
trigger on the end of each delay throughout the credits script.

Pretty? No, I guess not. But it's at the end of the game, so there
should be no risk of it messing things up.

Changed paths:
    engines/scumm/gfx_mac.cpp
    engines/scumm/script.cpp
    engines/scumm/scumm.h


diff --git a/engines/scumm/gfx_mac.cpp b/engines/scumm/gfx_mac.cpp
index b5ec46286a..4ddbf095c5 100644
--- a/engines/scumm/gfx_mac.cpp
+++ b/engines/scumm/gfx_mac.cpp
@@ -210,4 +210,12 @@ void ScummEngine::mac_undrawIndy3TextBox() {
 	markRectAsDirty(kMainVirtScreen, vsLeft, vsRight, vsTop, vsBottom);
 }
 
+void ScummEngine::mac_undrawIndy3CreditsText() {
+	// Set _masMask to make the text clear, and _textScreenID to ensure
+	// that it's the main area that's cleared.
+	_charset->_hasMask = true;
+	_charset->_textScreenID = kMainVirtScreen;
+	restoreCharsetBg();
+}
+
 } // End of namespace Scumm
diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp
index 6d13e73490..0fad1f5e0d 100644
--- a/engines/scumm/script.cpp
+++ b/engines/scumm/script.cpp
@@ -1441,6 +1441,20 @@ void ScummEngine::decreaseScriptDelay(int amount) {
 		if (ss->status == ssPaused) {
 			ss->delay -= amount;
 			if (ss->delay < 0) {
+				if (_game.id == GID_INDY3 && _game.platform == Common::kPlatformMacintosh && ss->number == 134 && ss->where == WIO_GLOBAL) {
+					// Unlike the DOS version, there doesn't
+					// appear to be anything in the credits
+					// script to clear the credits between
+					// the text screens. I don't know how
+					// the original did it, but the only
+					// reliable way I can think of is to
+					// trigger on the end of each delay
+					// throughout the script.
+					//
+					// Since this is at the very end of the
+					// game, it should be safe enough.
+					mac_undrawIndy3CreditsText();
+				}
 				ss->status = ssRunning;
 				ss->delay = 0;
 			}
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 0d3cc57b73..9445a91c53 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -961,6 +961,7 @@ protected:
 	void mac_createIndy3TextBox(Actor *a);
 	void mac_drawIndy3TextBox();
 	void mac_undrawIndy3TextBox();
+	void mac_undrawIndy3CreditsText();
 
 	void ditherCGA(byte *dst, int dstPitch, int x, int y, int width, int height) const;
 


Commit: 276381dac219dd7ad0c19c99c2f5076f85da73bc
    https://github.com/scummvm/scummvm/commit/276381dac219dd7ad0c19c99c2f5076f85da73bc
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Work around problem with inactive verbs being drawn in a scene

There is at least one scene in the game where inactive verbs are drawn,
and then the scene background is drawn over them. This should mean the
verbs are no longer visible, but the way we implement high-resolution
text on a scaled low-resolution background all text is assumed to have a
text mask on the text surface.

We work around this by only drawin verbs in standard rooms, where
"standard" is defined as being 128 pixels tall.

Changed paths:
    engines/scumm/verbs.cpp


diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp
index fca55d3895..efd15c0cc8 100644
--- a/engines/scumm/verbs.cpp
+++ b/engines/scumm/verbs.cpp
@@ -1073,6 +1073,33 @@ void ScummEngine::drawVerb(int verb, int mode) {
 	if (!verb)
 		return;
 
+	// The way we implement high-resolution font on a scaled low-resolution
+	// background requires there to always be a text surface telling which
+	// pixels have been drawn on. This means that the "has mask" feature is
+	// not correctly implemented, and in most cases this works just fine
+	// for both Loom and Indiana Jones and the Last Crusade.
+	//
+	// However, there is at least one scene in Indiana Jones - room 80,
+	// where you escape from the zeppelin on a biplane - where the game
+	// (sloppily, in my opinion) draws two disabled verbs (Travel and Talk)
+	// and then counts on the background to draw over them. Obviously that
+	// won't work here.
+	//
+	// As far as I can tell, all normal rooms, i.e. rooms that could
+	// sensibly have verbs, are 128 pixels tall. Other heights I've seen
+	// are 136, 176, 184, 192 and 200, probably depending at least partly
+	// on how much text is displayed in them.
+	//
+	// So to work around the issue, we only draw verbs in rooms that are
+	// 128 pixels tall and hope for the best.
+	//
+	// Note that with the low-resolution font, which does implement the
+	// "has mask" feature, the Macintosh version still needs a hack in
+	// printChar() for black text to work properly. This version of the
+	// game is weird.
+	if (_game.id == GID_INDY3 && _macScreen && _roomHeight > 128)
+		return;
+
 	vs = &_verbs[verb];
 
 	if (!vs->saveid && vs->curmode && vs->verbid) {


Commit: 87f61b3589426aa1b5fea06ff993e7669d17367a
    https://github.com/scummvm/scummvm/commit/87f61b3589426aa1b5fea06ff993e7669d17367a
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Clarified comment about credits glitch workaround

For some reason that I can't be bothered to investigate, it only works
with the high-resolution font. Which is what you should be using anyway.

Changed paths:
    engines/scumm/gfx_mac.cpp


diff --git a/engines/scumm/gfx_mac.cpp b/engines/scumm/gfx_mac.cpp
index 4ddbf095c5..35c2a6b09a 100644
--- a/engines/scumm/gfx_mac.cpp
+++ b/engines/scumm/gfx_mac.cpp
@@ -212,7 +212,8 @@ void ScummEngine::mac_undrawIndy3TextBox() {
 
 void ScummEngine::mac_undrawIndy3CreditsText() {
 	// Set _masMask to make the text clear, and _textScreenID to ensure
-	// that it's the main area that's cleared.
+	// that it's the main area that's cleared. Note that this only works
+	// with the high-resolution font.
 	_charset->_hasMask = true;
 	_charset->_textScreenID = kMainVirtScreen;
 	restoreCharsetBg();


Commit: e275b07e0003b04dadf19c72189f4afe42827d63
    https://github.com/scummvm/scummvm/commit/e275b07e0003b04dadf19c72189f4afe42827d63
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Fix thinko in CharsetRendererMac::getFontHeight()

It should only return the actual font height for Indy 3's font 1, and
even there it's not actually needed at the moment. I'm guessing this
error is why I saw some text rendering errors in Mac Loom, where lines
of text were spaced too far apart. Though strangely, I never managed to
reproduce it.

Changed paths:
    engines/scumm/charset.cpp


diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp
index 973241d490..a17e163910 100644
--- a/engines/scumm/charset.cpp
+++ b/engines/scumm/charset.cpp
@@ -1611,22 +1611,29 @@ void CharsetRendererMac::setCurID(int32 id) {
 
 int CharsetRendererMac::getFontHeight() {
 	int height = _macFonts[_curId].getFontHeight();
-	if (_vm->_game.id == GID_INDY3) {
+	if (_curId == 0 && _vm->_game.id == GID_INDY3) {
 		// For font 0, round up the height. It's still not quite as
 		// widely spaced as in the original, but I think it looks fine.
 		if (height & 1)
 			height++;
-		height /= 2;
 	}
+
+        // If we ever need the height for font 1 in Last Crusade (we don't at
+	// the moment), we need the actual height.
+	if (_curId == 0 || _vm->_game.id != GID_INDY3)
+		height /= 2;
+
 	return height;
 }
 
 int CharsetRendererMac::getCharWidth(uint16 chr) {
 	int width = _macFonts[_curId].getCharWidth(chr);
+
 	// For font 1 in Last Crusade, we want the real width. It is used for
 	// text box titles, which are drawn outside the normal font rendering.
 	if (_curId == 0 || _vm->_game.id != GID_INDY3)
 		width /= 2;
+
 	return width;
 }
 


Commit: 0de3b584ea689d28e11d9d5f63e0bb70d08dd202
    https://github.com/scummvm/scummvm/commit/0de3b584ea689d28e11d9d5f63e0bb70d08dd202
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Fix Indy 3 Mac credits with the low resolution font

This is based on the DOS VGA version. I would have been more comfortable
comparing it to the EGA version, but I don't have that. But from what I
can tell, it should work the same.

Changed paths:
    engines/scumm/gfx_mac.cpp


diff --git a/engines/scumm/gfx_mac.cpp b/engines/scumm/gfx_mac.cpp
index 35c2a6b09a..f836f0b0a9 100644
--- a/engines/scumm/gfx_mac.cpp
+++ b/engines/scumm/gfx_mac.cpp
@@ -211,12 +211,24 @@ void ScummEngine::mac_undrawIndy3TextBox() {
 }
 
 void ScummEngine::mac_undrawIndy3CreditsText() {
-	// Set _masMask to make the text clear, and _textScreenID to ensure
-	// that it's the main area that's cleared. Note that this only works
-	// with the high-resolution font.
-	_charset->_hasMask = true;
-	_charset->_textScreenID = kMainVirtScreen;
-	restoreCharsetBg();
+	if (_macScreen) {
+		// Set _masMask to make the text clear, and _textScreenID to
+		// ensure that it's the main area that's cleared. Note that
+		// this only works with the high-resolution font.
+		_charset->_hasMask = true;
+		_charset->_textScreenID = kMainVirtScreen;
+		restoreCharsetBg();
+	} else {
+		// The DOS VGA version clear the text by using the putState
+		// opcode. I would have been more comfortable if I could have
+		// compared it to the EGA version, but I don't have that.
+		// Judging by the size and position of the object, they should
+		// be the same.
+		putState(946, 0);
+		markObjectRectAsDirty(946);
+		if (_bgNeedsRedraw)
+			clearDrawObjectQueue();
+	}
 }
 
 } // End of namespace Scumm


Commit: 5f2bf42f8411e8804a57344ac41c8941cf7a485f
    https://github.com/scummvm/scummvm/commit/5f2bf42f8411e8804a57344ac41c8941cf7a485f
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-06-30T14:59:55+02:00

Commit Message:
SCUMM: Changed the workaround for verbs drawn in room 80

It turns out that checking the room height causes verbs not to be
redrawn after reading books. Let's just limit it to room 80, and hope
there aren't any other cases.

Changed paths:
    engines/scumm/verbs.cpp


diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp
index efd15c0cc8..8da868c136 100644
--- a/engines/scumm/verbs.cpp
+++ b/engines/scumm/verbs.cpp
@@ -1085,19 +1085,15 @@ void ScummEngine::drawVerb(int verb, int mode) {
 	// and then counts on the background to draw over them. Obviously that
 	// won't work here.
 	//
-	// As far as I can tell, all normal rooms, i.e. rooms that could
-	// sensibly have verbs, are 128 pixels tall. Other heights I've seen
-	// are 136, 176, 184, 192 and 200, probably depending at least partly
-	// on how much text is displayed in them.
-	//
-	// So to work around the issue, we only draw verbs in rooms that are
-	// 128 pixels tall and hope for the best.
+	// I thought it would be possible to base this workaround on room
+	// height, but then verbs aren't redrawn after reading books. So I
+	// guess the safest path is to limit it to this particular room.
 	//
 	// Note that with the low-resolution font, which does implement the
 	// "has mask" feature, the Macintosh version still needs a hack in
 	// printChar() for black text to work properly. This version of the
 	// game is weird.
-	if (_game.id == GID_INDY3 && _macScreen && _roomHeight > 128)
+	if (_game.id == GID_INDY3 && _macScreen && _currentRoom == 80)
 		return;
 
 	vs = &_verbs[verb];




More information about the Scummvm-git-logs mailing list