[Scummvm-git-logs] scummvm master -> ff3c922b8d45733cbb5048b9a5fbf34c60b19cea

sev- noreply at scummvm.org
Sun Oct 29 19:23:00 UTC 2023


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

Summary:
c62e4c5829 SCUMM: LOOM: Begin work on Drafts Inventory enhancement
0777b3b013 SCUMM: LOOM: Insert French and Spanish translations for Draft menu
a3f7899ca2 SCUMM: LOOM/GUI: Remove stray ":" in Jap Drafts title
8d469f430f SCUMM: LOOM/GUI: Clean up and fix drafts menu for French strings
353e5102c5 SCUMM: LOOM/GUI: Fix Hebrew layout and add more comments
dce87d8bda SCUMM: LOOM/GUI: Fix occasional wrong text height being fetched
3a590f203e SCUMM: LOOM/GUI: Fix FM-Towns widget not disappearing
d97fe2034d SCUMM: LOOM/GUI: Fix text colors inversion for Hebrew
ff3c922b8d SCUMM: LOOM/GUI: Mask currently unknown drafts titles


Commit: c62e4c58293172497835d0b164c651f0bad227ca
    https://github.com/scummvm/scummvm/commit/c62e4c58293172497835d0b164c651f0bad227ca
Author: AndywinXp (andywinxp at gmail.com)
Date: 2023-10-29T20:22:52+01:00

Commit Message:
SCUMM: LOOM: Begin work on Drafts Inventory enhancement

Changed paths:
    engines/scumm/gfx_gui.cpp
    engines/scumm/input.cpp
    engines/scumm/scumm.h


diff --git a/engines/scumm/gfx_gui.cpp b/engines/scumm/gfx_gui.cpp
index c8fcf285cd2..46cce8276de 100644
--- a/engines/scumm/gfx_gui.cpp
+++ b/engines/scumm/gfx_gui.cpp
@@ -720,7 +720,12 @@ void ScummEngine::drawInternalGUIControl(int id, bool highlightColor) {
 
 		// Calculate the positioning for the text
 		int oldId = _charset->getCurID();
-		_charset->setCurID(_game.platform == Common::kPlatformSegaCD ? 6 : 1);
+		if (_game.id == GID_LOOM) {
+			_charset->setCurID(_game.version > 3 ? 1 : 0);
+		} else {
+			_charset->setCurID(_game.platform == Common::kPlatformSegaCD ? 6 : 1);
+		}
+
 
 		centerFlag = ctrl->centerText;
 
@@ -1444,6 +1449,315 @@ void ScummEngine::restoreSurfacesPostGUI() {
 	}
 }
 
+void ScummEngine::showDraftsInventory() {
+	bool leftMsClicked = false, rightMsClicked = false;
+
+	Common::KeyState ks;
+
+	// Pause the engine...
+	PauseToken pt = pauseEngine();
+
+	_shakeTempSavedState = _shakeEnabled;
+	setShake(0);
+
+	// Save surfaces...
+	saveSurfacesPreGUI();
+
+	// Save the current cursor state...
+	saveCursorPreMenu();
+
+	// SETUP AND DRAW GUI! MOVE THIS ELSEWHERE!
+	int yConstant;
+	bool isLoomVGA = (_game.version == 4) || _game.platform == Common::kPlatformFMTowns;
+
+	yConstant = _virtscr[kMainVirtScreen].topline + (_virtscr[kMainVirtScreen].h / 2);
+
+	if (isLoomVGA) {
+		setUpInternalGUIControl(GUI_CTRL_OUTER_BOX,
+			7,
+			0,
+			15,
+			8,
+			15,
+			8,
+			14,
+			1 ,
+			20,
+			yConstant - 60,
+			300,
+			((yConstant + 60) < 0 ? -120 : yConstant + 60),
+			_emptyMsg, 1, 1);
+
+		// Inner box
+		setUpInternalGUIControl(GUI_CTRL_INNER_BOX,
+			7,
+			0,
+			8,
+			15,
+			8,
+			15,
+			14,
+			1,
+			26,
+			yConstant - 47,
+			300 - 6,
+			yConstant - 47 + 102,
+			_emptyMsg, 1, 1);
+	} else {
+		setUpInternalGUIControl(GUI_CTRL_OUTER_BOX,
+			getBannerColor(4),
+			getBannerColor(2),
+			getBannerColor(14),
+			getBannerColor(14),
+			getBannerColor(14),
+			getBannerColor(14),
+			getBannerColor(6),
+			getBannerColor(4),
+			20,
+			yConstant - 60,
+			300,
+			((yConstant + 60) < 0 ? -120 : yConstant + 60),
+			_emptyMsg, 1, 0);
+
+		// Inner box
+		setUpInternalGUIControl(GUI_CTRL_INNER_BOX,
+			getBannerColor(4),
+			getBannerColor(5),
+			getBannerColor(13),
+			getBannerColor(13),
+			getBannerColor(13),
+			getBannerColor(13),
+			getBannerColor(6),
+			getBannerColor(7),
+			26,
+			yConstant - 47,
+			300 - 6,
+			yConstant - 47 + 102,
+			_emptyMsg, 1, 0);
+	}
+
+	drawInternalGUIControl(GUI_CTRL_OUTER_BOX, 0);
+	drawInternalGUIControl(GUI_CTRL_INNER_BOX, 0);
+
+	if (isLoomVGA) {
+		drawLine(160,     yConstant - 47, 160,     yConstant + 55, 15);
+		drawLine(160 + 1, yConstant - 47, 160 + 1, yConstant + 55, 7);
+		drawLine(160 + 2, yConstant - 47, 160 + 2, yConstant + 55, 7);
+		drawLine(160 + 3, yConstant - 47, 160 + 3, yConstant + 55, 8);
+	} else {
+		drawLine(160,     yConstant - 47, 160,     yConstant + 55, getBannerColor(13));
+		drawLine(160 + 1, yConstant - 47, 160 + 1, yConstant + 55, getBannerColor(4));
+		drawLine(160 + 2, yConstant - 47, 160 + 2, yConstant + 55, getBannerColor(4));
+		drawLine(160 + 3, yConstant - 47, 160 + 3, yConstant + 55, getBannerColor(13));
+	}
+
+	int textHeight = getGUIStringHeight("A") + 3;
+
+	const char *translatedNames[6][17] = {
+		// ENGLISH
+		{
+			"Drafts",
+			"Opening:",       "Straw Into Gold:",  "Dyeing:",
+			"Night Vision:",  "Twisting:",         "Sleep:",
+			"Emptying:",      "Invisibility:",     "Terror:",
+			"Sharpening:",    "Reflection:",       "Healing:",
+			"Silence:",       "Shaping:",          "Unmaking:",
+			"Transcendence:"
+		},
+
+		// GERMAN
+		{
+			"Spr\x81\x63he",
+			"\x99\x66\x66nen:",  "Stroh in Gold:",   "F\x84rben:",
+			"Dunkelsicht:",      "Verdrehen:",       "Schlaf:",
+			"Entleeren:",        "Unsichtbarkeit:",  "Angst:",
+			"Sch\x84rfen:",      "Spiegelung:",      "Heilen:",
+			"Stille:",           "Formen:",          "Zerst\x94ren:",
+			"Transzendenz:"
+		},
+
+		// FRENCH
+		{
+			"Drafts",
+			"Opening:",       "Straw Into Gold:",  "Dyeing:",
+			"Night Vision:",  "Twisting:",         "Sleep:",
+			"Emptying:",      "Invisibility:",     "Terror:",
+			"Sharpening:",    "Reflection:",       "Healing:",
+			"Silence:",       "Shaping:",          "Unmaking:",
+			"Transcendence:"
+		},
+
+		// SPANISH
+		{
+			"Drafts",
+			"Opening:",       "Straw Into Gold:",  "Dyeing:",
+			"Night Vision:",  "Twisting:",         "Sleep:",
+			"Emptying:",      "Invisibility:",     "Terror:",
+			"Sharpening:",    "Reflection:",       "Healing:",
+			"Silence:",       "Shaping:",          "Unmaking:",
+			"Transcendence:"
+		},
+
+		// JAPANESE
+		{
+			"\x82\xdc\x82\xb6\x82\xc8\x82\xa2",
+			"\x8a\x4a\x82\xaf\x82\xe9",
+			"\x82\xed\x82\xe7\x82\xf0\x8b\xe0\x89\xdd\x82\xc9\x95\xcf\x82\xa6\x82\xe9",
+			"\x90\xf5\x82\xdf\x82\xe9",
+			"\x88\xc3\x88\xc5\x82\xc5\x95\xa8\x82\xf0\x8c\xa9\x82\xa6",
+			"\x82\xcb\x82\xb6\x82\xe9",
+			"\x96\xb0\x82\xe7\x82\xb9\x82\xe9",
+			"\x83\x4a\x83\x89\x82\xc9\x82\xb7\x82\xe9",
+			"\x8c\xa9\x82\xa6\x82\xc8\x82\xad\x82\xb7\x82\xe9",
+			"\x95\x7c\x82\xaa\x82\xe7\x82\xb9\x82\xe9",
+			"\x90\xeb\x82\xe7\x82\xb9\x82\xe9",
+			"\x89\x66\x82\xb5\x8f\x6f\x82\xb7",
+			"\x8e\xa1\x97\xc3\x82\xb7\x82\xe9",
+			"\x90\xc3\x82\xa9\x82\xc9\x82\xb3\x82\xb9\x82\xe9",
+			"\x8c\x60\x82\xf0\x95\xcf\x82\xa6\x82\xe9",
+			"\x94\x6a\x89\xf3\x82\xb7\x82\xe9",
+			"\x92\xb4\x89\x7a\x82\xb3\x82\xb9\x82\xe9"
+		},
+
+		// HEBREW
+		{
+			"Drafts",
+			"Opening:",       "Straw Into Gold:",  "Dyeing:",
+			"Night Vision:",  "Twisting:",         "Sleep:",
+			"Emptying:",      "Invisibility:",     "Terror:",
+			"Sharpening:",    "Reflection:",       "Healing:",
+			"Silence:",       "Shaping:",          "Unmaking:",
+			"Transcendence:"
+		}
+	};
+
+	const char **names;
+
+	switch (_language) {
+	case Common::EN_ANY:
+	case Common::EN_GRB:
+	case Common::EN_USA:
+		names = translatedNames[0];
+		break;
+	case Common::DE_DEU:
+		names = translatedNames[1];
+		break;
+	case Common::FR_FRA:
+		names = translatedNames[2];
+		break;
+	case Common::ES_ESP:
+		names = translatedNames[3];
+		break;
+	case Common::JA_JPN:
+		names = translatedNames[4];
+		break;
+	case Common::HE_ISR:
+		names = translatedNames[5];
+		break;
+	default:
+		names = translatedNames[0];
+	}
+
+	drawMainMenuTitle(names[0]);
+
+	char notesBuf[6];
+	int base = 0;
+
+	if (_game.version == 4 || _game.platform == Common::kPlatformPCEngine) {
+		// DOS CD version / PC-Engine version
+		base = 100;
+	} else if (_game.platform == Common::kPlatformMacintosh) {
+		// Macintosh version
+		base = 55;
+	} else {
+		// All (?) other versions
+		base = 50;
+	}
+
+	const char *notes = "cdefgabC";
+	int maxWidth = 0;
+	for (int i = 0; i < 16; i++) {
+		int tmpWidth = getGUIStringWidth(names[i + 1]);
+		if (tmpWidth >= maxWidth)
+			maxWidth = tmpWidth;
+	}
+
+	int inactiveColor = 8;
+	int unlockedColor = isLoomVGA ? 1 : getBannerColor(18);
+	int newDraftColor = isLoomVGA ? 14 : getBannerColor(21);
+
+	for (int i = 0; i < 16; i++) {
+		int draft = _scummVars[base + i * 2];
+
+		int xPos = i < 8 ? 30 : 167;
+
+		int heightMultiplier = i < 8 ? i : (i % 8);
+
+		int notesColor = (draft & 0x4000) ? unlockedColor : newDraftColor;
+		int titleColor = (draft & 0x2000) ? unlockedColor : inactiveColor;
+
+		if (draft & 0x2000) {
+			Common::sprintf_s(notesBuf, sizeof(notesBuf), "%c%c%c%c",
+							  notes[draft & 0x0007],
+							  notes[(draft & 0x0038) >> 3],
+							  notes[(draft & 0x01c0) >> 6],
+							  notes[(draft & 0x0e00) >> 9]);
+		} else {
+			notesColor = inactiveColor;
+			Common::sprintf_s(notesBuf, sizeof(notesBuf), "????");
+		}
+
+		drawGUIText(names[i + 1], nullptr, xPos, yConstant - 40 + textHeight * heightMultiplier, titleColor, false);
+		int notesWidth = getGUIStringWidth(notesBuf);
+
+		if (_game.version == 3 && i >= 8)
+			xPos -= 3;
+
+		drawGUIText(notesBuf, nullptr, xPos + 100, yConstant - 40 + textHeight * heightMultiplier, notesColor, false);
+	}
+
+	ScummEngine::drawDirtyScreenParts();
+	_system->updateScreen();
+
+	// Notify that the menu is now active
+	_mainMenuIsActive = true;
+
+	// Clear keypresses and mouse presses
+	clearClickedStatus();
+
+	// Menu loop
+	while (!shouldQuit()) {
+		// Update the screen and the cursor while we're in the loop
+		waitForTimer(1);
+
+		// Wait for any mouse button presses...
+		waitForBannerInput(-1, ks, leftMsClicked, rightMsClicked, false);
+
+		if (leftMsClicked || rightMsClicked) {
+			break;
+		}
+	}
+
+	_mainMenuIsActive = false;
+
+	// Restore the old cursor state...
+	restoreCursorPostMenu();
+
+	// Restore surfaces...
+	if (_game.platform == Common::kPlatformFMTowns) {
+		// RESTORE FMTOWNS BUFFER
+	} else {
+		restoreSurfacesPostGUI();
+	}
+
+	// Restore shake effect...
+	setShake(_shakeTempSavedState);
+
+	// Resume the engine.
+	pt.clear();
+	clearClickedStatus();
+}
+
 void ScummEngine::toggleVoiceMode() {
 	if (VAR_VOICE_MODE != 0xFF) {
 		VAR(VAR_VOICE_MODE) = (VAR(VAR_VOICE_MODE) != 1) ? 1 : 0;
@@ -3692,6 +4006,14 @@ void ScummEngine::drawMainMenuTitle(const char *title) {
 		stringColor = getBannerColor(2);
 	}
 
+	// Override for Drafts menu - LOOM FM-Towns.
+	// This code path will ONLY be activated when looking at the Draft menu,
+	// as this version can't access this code elsewhere.
+	if (_game.id == GID_LOOM && _game.platform == Common::kPlatformFMTowns) {
+		boxColor = 7;
+		stringColor = 0;
+	}
+
 	if (_game.id == GID_DIG) {
 		int cid = _charset->getCurID();
 		_charset->setCurID(1);
diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp
index 3f1db3ff46c..820eeb6e1f0 100644
--- a/engines/scumm/input.cpp
+++ b/engines/scumm/input.cpp
@@ -1135,6 +1135,12 @@ void ScummEngine::processKeyboard(Common::KeyState lastKeyHit) {
 			return;
 		}
 
+		if (_enableEnhancements && _game.id == GID_LOOM &&
+			mainmenuKeyEnabled && (lastKeyHit.keycode == Common::KEYCODE_d && lastKeyHit.hasFlags(Common::KBD_CTRL))) {
+			// Drafts menu
+			showDraftsInventory();
+		}
+
 		if (snapScrollKeyEnabled) {
 			if ((_game.version == 2 && lastKeyHit.keycode == Common::KEYCODE_s && lastKeyHit.hasFlags(Common::KBD_SHIFT)) ||
 				(_game.version == 3 && lastKeyHit.keycode == Common::KEYCODE_i && lastKeyHit.hasFlags(Common::KBD_ALT)) ||
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index e09afbdba91..2e8f7a0e3b0 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -790,6 +790,7 @@ protected:
 	void restoreCursorPostMenu();
 	void saveSurfacesPreGUI();
 	void restoreSurfacesPostGUI();
+	void showDraftsInventory();
 
 public:
 	char displayMessage(const char *altButton, MSVC_PRINTF const char *message, ...) GCC_PRINTF(3, 4);


Commit: 0777b3b013900e1986c5375464083afe415d7ca7
    https://github.com/scummvm/scummvm/commit/0777b3b013900e1986c5375464083afe415d7ca7
Author: AndywinXp (andywinxp at gmail.com)
Date: 2023-10-29T20:22:52+01:00

Commit Message:
SCUMM: LOOM: Insert French and Spanish translations for Draft menu

Changed paths:
    engines/scumm/gfx_gui.cpp


diff --git a/engines/scumm/gfx_gui.cpp b/engines/scumm/gfx_gui.cpp
index 46cce8276de..0c93a8c9c98 100644
--- a/engines/scumm/gfx_gui.cpp
+++ b/engines/scumm/gfx_gui.cpp
@@ -1578,24 +1578,24 @@ void ScummEngine::showDraftsInventory() {
 
 		// FRENCH
 		{
-			"Drafts",
-			"Opening:",       "Straw Into Gold:",  "Dyeing:",
-			"Night Vision:",  "Twisting:",         "Sleep:",
-			"Emptying:",      "Invisibility:",     "Terror:",
-			"Sharpening:",    "Reflection:",       "Healing:",
-			"Silence:",       "Shaping:",          "Unmaking:",
-			"Transcendence:"
+			"Trames",
+			"Ouverture:",            "De la paille \x85 l'or:",  "Teinture:",
+			"Vision de nuit:",       "Trame tordue:",            "Sommeil:",
+			"Vidange:",              "Camouflage:",              "Terreur:",
+			"Trame \x85 aiguiser:",  "Reflet:",                  "Gu\x82rison:",
+			"Silence:",              "Formation:",               "Trame d\x82\x66\x61ite:",
+			"Transcendance:"
 		},
 
 		// SPANISH
 		{
-			"Drafts",
-			"Opening:",       "Straw Into Gold:",  "Dyeing:",
-			"Night Vision:",  "Twisting:",         "Sleep:",
-			"Emptying:",      "Invisibility:",     "Terror:",
-			"Sharpening:",    "Reflection:",       "Healing:",
-			"Silence:",       "Shaping:",          "Unmaking:",
-			"Transcendence:"
+			"Hechizos",
+			"Apertura:",            "Oro a Paja:",     "Tinte:",
+			"Visi\xA2n Nocturna:",  "Retorcer:",       "Sue\xA4o:",
+			"Vacio:",               "Invisibilidad:",  "Terror:",
+			"Afilado:",             "Reflexion:",      "Curativo:",
+			"Silencio:",            "Moldear:",        "Deshacer:",
+			"Trascendencia:"
 		},
 
 		// JAPANESE


Commit: a3f7899ca2bf1c87198bc05d042881fc7691e749
    https://github.com/scummvm/scummvm/commit/a3f7899ca2bf1c87198bc05d042881fc7691e749
Author: AndywinXp (andywinxp at gmail.com)
Date: 2023-10-29T20:22:52+01:00

Commit Message:
SCUMM: LOOM/GUI: Remove stray ":" in Jap Drafts title

Changed paths:
    engines/scumm/gfx_gui.cpp


diff --git a/engines/scumm/gfx_gui.cpp b/engines/scumm/gfx_gui.cpp
index 0c93a8c9c98..827f772d0c0 100644
--- a/engines/scumm/gfx_gui.cpp
+++ b/engines/scumm/gfx_gui.cpp
@@ -1601,22 +1601,22 @@ void ScummEngine::showDraftsInventory() {
 		// JAPANESE
 		{
 			"\x82\xdc\x82\xb6\x82\xc8\x82\xa2",
-			"\x8a\x4a\x82\xaf\x82\xe9",
-			"\x82\xed\x82\xe7\x82\xf0\x8b\xe0\x89\xdd\x82\xc9\x95\xcf\x82\xa6\x82\xe9",
-			"\x90\xf5\x82\xdf\x82\xe9",
-			"\x88\xc3\x88\xc5\x82\xc5\x95\xa8\x82\xf0\x8c\xa9\x82\xa6",
-			"\x82\xcb\x82\xb6\x82\xe9",
-			"\x96\xb0\x82\xe7\x82\xb9\x82\xe9",
-			"\x83\x4a\x83\x89\x82\xc9\x82\xb7\x82\xe9",
-			"\x8c\xa9\x82\xa6\x82\xc8\x82\xad\x82\xb7\x82\xe9",
-			"\x95\x7c\x82\xaa\x82\xe7\x82\xb9\x82\xe9",
-			"\x90\xeb\x82\xe7\x82\xb9\x82\xe9",
-			"\x89\x66\x82\xb5\x8f\x6f\x82\xb7",
-			"\x8e\xa1\x97\xc3\x82\xb7\x82\xe9",
-			"\x90\xc3\x82\xa9\x82\xc9\x82\xb3\x82\xb9\x82\xe9",
-			"\x8c\x60\x82\xf0\x95\xcf\x82\xa6\x82\xe9",
-			"\x94\x6a\x89\xf3\x82\xb7\x82\xe9",
-			"\x92\xb4\x89\x7a\x82\xb3\x82\xb9\x82\xe9"
+			"\x8a\x4a\x82\xaf\x82\xe9:",
+			"\x82\xed\x82\xe7\x82\xf0\x8b\xe0\x89\xdd\x82\xc9\x95\xcf\x82\xa6\x82\xe9:",
+			"\x90\xf5\x82\xdf\x82\xe9:",
+			"\x88\xc3\x88\xc5\x82\xc5\x95\xa8\x82\xf0\x8c\xa9\x82\xa6:",
+			"\x82\xcb\x82\xb6\x82\xe9:",
+			"\x96\xb0\x82\xe7\x82\xb9\x82\xe9:",
+			"\x83\x4a\x83\x89\x82\xc9\x82\xb7\x82\xe9:",
+			"\x8c\xa9\x82\xa6\x82\xc8\x82\xad\x82\xb7\x82\xe9:",
+			"\x95\x7c\x82\xaa\x82\xe7\x82\xb9\x82\xe9:",
+			"\x90\xeb\x82\xe7\x82\xb9\x82\xe9:",
+			"\x89\x66\x82\xb5\x8f\x6f\x82\xb7:",
+			"\x8e\xa1\x97\xc3\x82\xb7\x82\xe9:",
+			"\x90\xc3\x82\xa9\x82\xc9\x82\xb3\x82\xb9\x82\xe9:",
+			"\x8c\x60\x82\xf0\x95\xcf\x82\xa6\x82\xe9:",
+			"\x94\x6a\x89\xf3\x82\xb7\x82\xe9:",
+			"\x92\xb4\x89\x7a\x82\xb3\x82\xb9\x82\xe9:"
 		},
 
 		// HEBREW


Commit: 8d469f430f01565fcea67f805e6d7185f480596a
    https://github.com/scummvm/scummvm/commit/8d469f430f01565fcea67f805e6d7185f480596a
Author: AndywinXp (andywinxp at gmail.com)
Date: 2023-10-29T20:22:52+01:00

Commit Message:
SCUMM: LOOM/GUI: Clean up and fix drafts menu for French strings

French strings are a little bit too long for this menu :)

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


diff --git a/engines/scumm/gfx_gui.cpp b/engines/scumm/gfx_gui.cpp
index 827f772d0c0..91269060ac2 100644
--- a/engines/scumm/gfx_gui.cpp
+++ b/engines/scumm/gfx_gui.cpp
@@ -1466,11 +1466,56 @@ void ScummEngine::showDraftsInventory() {
 	// Save the current cursor state...
 	saveCursorPreMenu();
 
-	// SETUP AND DRAW GUI! MOVE THIS ELSEWHERE!
-	int yConstant;
+	// Do the thing!
+	setUpDraftsInventory();
+	drawDraftsInventory();
+
+	// Notify that the menu is now active
+	_mainMenuIsActive = true;
+
+	// Clear keypresses and mouse presses
+	clearClickedStatus();
+
+	// Menu loop
+	while (!shouldQuit()) {
+		// Update the screen and the cursor while we're in the loop
+		waitForTimer(1);
+
+		// Wait for any mouse button presses...
+		waitForBannerInput(-1, ks, leftMsClicked, rightMsClicked, false);
+
+		if (leftMsClicked || rightMsClicked) {
+			break;
+		}
+	}
+
+	_mainMenuIsActive = false;
+
+	// Restore the old cursor state...
+	restoreCursorPostMenu();
+
+	// Restore surfaces...
+	if (_game.platform == Common::kPlatformFMTowns) {
+		// RESTORE FMTOWNS BUFFER
+	} else {
+		restoreSurfacesPostGUI();
+	}
+
+	// Restore shake effect...
+	setShake(_shakeTempSavedState);
+
+	// Resume the engine.
+	pt.clear();
+	clearClickedStatus();
+}
+
+void ScummEngine::setUpDraftsInventory() {
+	int yConstant = _virtscr[kMainVirtScreen].topline + (_virtscr[kMainVirtScreen].h / 2);
 	bool isLoomVGA = (_game.version == 4) || _game.platform == Common::kPlatformFMTowns;
 
-	yConstant = _virtscr[kMainVirtScreen].topline + (_virtscr[kMainVirtScreen].h / 2);
+	// French labels are quite long, so throughout the following code
+	// there are slight adjustments to French text positioning...
+	int xOffset = _language == Common::FR_FRA ? 10 : 0;
 
 	if (isLoomVGA) {
 		setUpInternalGUIControl(GUI_CTRL_OUTER_BOX,
@@ -1513,9 +1558,9 @@ void ScummEngine::showDraftsInventory() {
 			getBannerColor(14),
 			getBannerColor(6),
 			getBannerColor(4),
-			20,
+			20 - xOffset,
 			yConstant - 60,
-			300,
+			300 + xOffset,
 			((yConstant + 60) < 0 ? -120 : yConstant + 60),
 			_emptyMsg, 1, 0);
 
@@ -1529,9 +1574,9 @@ void ScummEngine::showDraftsInventory() {
 			getBannerColor(13),
 			getBannerColor(6),
 			getBannerColor(7),
-			26,
+			26 - xOffset,
 			yConstant - 47,
-			300 - 6,
+			300 - 6 + xOffset,
 			yConstant - 47 + 102,
 			_emptyMsg, 1, 0);
 	}
@@ -1550,86 +1595,100 @@ void ScummEngine::showDraftsInventory() {
 		drawLine(160 + 2, yConstant - 47, 160 + 2, yConstant + 55, getBannerColor(4));
 		drawLine(160 + 3, yConstant - 47, 160 + 3, yConstant + 55, getBannerColor(13));
 	}
+}
 
-	int textHeight = getGUIStringHeight("A") + 3;
+static const char *loomDraftsNames[6][17] = {
+	// ENGLISH
+	{
+		"Drafts",
+		"Opening:",       "Straw Into Gold:",  "Dyeing:",
+		"Night Vision:",  "Twisting:",         "Sleep:",
+		"Emptying:",      "Invisibility:",     "Terror:",
+		"Sharpening:",    "Reflection:",       "Healing:",
+		"Silence:",       "Shaping:",          "Unmaking:",
+		"Transcendence:"
+	},
+
+	// GERMAN
+	{
+		"Spr\x81\x63he",
+		"\x99\x66\x66nen:",  "Stroh in Gold:",   "F\x84rben:",
+		"Dunkelsicht:",      "Verdrehen:",       "Schlaf:",
+		"Entleeren:",        "Unsichtbarkeit:",  "Angst:",
+		"Sch\x84rfen:",      "Spiegelung:",      "Heilen:",
+		"Stille:",           "Formen:",          "Zerst\x94ren:",
+		"Transzendenz:"
+	},
+
+	// FRENCH
+	{
+		"Trames",
+		"Ouverture:",            "De la paille \x85 l'or:",  "Teinture:",
+		"Vision de nuit:",       "Trame tordue:",            "Sommeil:",
+		"Vidange:",              "Camouflage:",              "Terreur:",
+		"Trame \x85 aiguiser:",  "Reflet:",                  "Gu\x82rison:",
+		"Silence:",              "Formation:",               "Trame d\x82\x66\x61ite:",
+		"Transcendance:"
+	},
+
+	// SPANISH
+	{
+		"Hechizos",
+		"Apertura:",            "Oro a Paja:",     "Tinte:",
+		"Visi\xA2n Nocturna:",  "Retorcer:",       "Sue\xA4o:",
+		"Vacio:",               "Invisibilidad:",  "Terror:",
+		"Afilado:",             "Reflexion:",      "Curativo:",
+		"Silencio:",            "Moldear:",        "Deshacer:",
+		"Trascendencia:"
+	},
+
+	// JAPANESE
+	{
+		"\x82\xdc\x82\xb6\x82\xc8\x82\xa2",
+		"\x8a\x4a\x82\xaf\x82\xe9:",
+		"\x82\xed\x82\xe7\x82\xf0\x8b\xe0\x89\xdd\x82\xc9\x95\xcf\x82\xa6\x82\xe9:",
+		"\x90\xf5\x82\xdf\x82\xe9:",
+		"\x88\xc3\x88\xc5\x82\xc5\x95\xa8\x82\xf0\x8c\xa9\x82\xa6:",
+		"\x82\xcb\x82\xb6\x82\xe9:",
+		"\x96\xb0\x82\xe7\x82\xb9\x82\xe9:",
+		"\x83\x4a\x83\x89\x82\xc9\x82\xb7\x82\xe9:",
+		"\x8c\xa9\x82\xa6\x82\xc8\x82\xad\x82\xb7\x82\xe9:",
+		"\x95\x7c\x82\xaa\x82\xe7\x82\xb9\x82\xe9:",
+		"\x90\xeb\x82\xe7\x82\xb9\x82\xe9:",
+		"\x89\x66\x82\xb5\x8f\x6f\x82\xb7:",
+		"\x8e\xa1\x97\xc3\x82\xb7\x82\xe9:",
+		"\x90\xc3\x82\xa9\x82\xc9\x82\xb3\x82\xb9\x82\xe9:",
+		"\x8c\x60\x82\xf0\x95\xcf\x82\xa6\x82\xe9:",
+		"\x94\x6a\x89\xf3\x82\xb7\x82\xe9:",
+		"\x92\xb4\x89\x7a\x82\xb3\x82\xb9\x82\xe9:"
+	},
+
+	// HEBREW
+	{
+		"\x9a\x85\x90\x89\x82\x90\x8e",
+		"\x84\x87\x89\x9a\x94:",
+		"\x81\x84\x86\x8c \x99\x97 \x9a\x8b\x89\x94\x84:",
+		"\x84\x92\x89\x81\x96:",
+		"\x84\x8c\x89\x8c \x9a\x89\x89\x80\x98:",
+		"\x81\x85\x81\x89\x91:",
+		"\x84\x90\x89\x99:",
+		"\x84\x97\x98\x84:",
+		"\x84\x80\x98\x90 \x89\x9a\x8c\x81\x8c \x84\x8b\x89\x94\x84:",
+		"\x84\x83\x87\x94\x84:",
+		"\x84\x86\x87\x99\x84:",
+		"\x84\x89\x8e\x83\x84:",
+		"\x89\x85\x94\x89\x98:",
+		"\x84\x97\x9a\x99\x84:",
+		"\x84\x98\x85\x96 \x9a\x90\x89\x9a\x90:",
+		"\x84\x91\x89\x98\x84:",
+		"\x9a\x85\x81\x82\x99\x90:"
+	}
+};
 
-	const char *translatedNames[6][17] = {
-		// ENGLISH
-		{
-			"Drafts",
-			"Opening:",       "Straw Into Gold:",  "Dyeing:",
-			"Night Vision:",  "Twisting:",         "Sleep:",
-			"Emptying:",      "Invisibility:",     "Terror:",
-			"Sharpening:",    "Reflection:",       "Healing:",
-			"Silence:",       "Shaping:",          "Unmaking:",
-			"Transcendence:"
-		},
-
-		// GERMAN
-		{
-			"Spr\x81\x63he",
-			"\x99\x66\x66nen:",  "Stroh in Gold:",   "F\x84rben:",
-			"Dunkelsicht:",      "Verdrehen:",       "Schlaf:",
-			"Entleeren:",        "Unsichtbarkeit:",  "Angst:",
-			"Sch\x84rfen:",      "Spiegelung:",      "Heilen:",
-			"Stille:",           "Formen:",          "Zerst\x94ren:",
-			"Transzendenz:"
-		},
-
-		// FRENCH
-		{
-			"Trames",
-			"Ouverture:",            "De la paille \x85 l'or:",  "Teinture:",
-			"Vision de nuit:",       "Trame tordue:",            "Sommeil:",
-			"Vidange:",              "Camouflage:",              "Terreur:",
-			"Trame \x85 aiguiser:",  "Reflet:",                  "Gu\x82rison:",
-			"Silence:",              "Formation:",               "Trame d\x82\x66\x61ite:",
-			"Transcendance:"
-		},
-
-		// SPANISH
-		{
-			"Hechizos",
-			"Apertura:",            "Oro a Paja:",     "Tinte:",
-			"Visi\xA2n Nocturna:",  "Retorcer:",       "Sue\xA4o:",
-			"Vacio:",               "Invisibilidad:",  "Terror:",
-			"Afilado:",             "Reflexion:",      "Curativo:",
-			"Silencio:",            "Moldear:",        "Deshacer:",
-			"Trascendencia:"
-		},
-
-		// JAPANESE
-		{
-			"\x82\xdc\x82\xb6\x82\xc8\x82\xa2",
-			"\x8a\x4a\x82\xaf\x82\xe9:",
-			"\x82\xed\x82\xe7\x82\xf0\x8b\xe0\x89\xdd\x82\xc9\x95\xcf\x82\xa6\x82\xe9:",
-			"\x90\xf5\x82\xdf\x82\xe9:",
-			"\x88\xc3\x88\xc5\x82\xc5\x95\xa8\x82\xf0\x8c\xa9\x82\xa6:",
-			"\x82\xcb\x82\xb6\x82\xe9:",
-			"\x96\xb0\x82\xe7\x82\xb9\x82\xe9:",
-			"\x83\x4a\x83\x89\x82\xc9\x82\xb7\x82\xe9:",
-			"\x8c\xa9\x82\xa6\x82\xc8\x82\xad\x82\xb7\x82\xe9:",
-			"\x95\x7c\x82\xaa\x82\xe7\x82\xb9\x82\xe9:",
-			"\x90\xeb\x82\xe7\x82\xb9\x82\xe9:",
-			"\x89\x66\x82\xb5\x8f\x6f\x82\xb7:",
-			"\x8e\xa1\x97\xc3\x82\xb7\x82\xe9:",
-			"\x90\xc3\x82\xa9\x82\xc9\x82\xb3\x82\xb9\x82\xe9:",
-			"\x8c\x60\x82\xf0\x95\xcf\x82\xa6\x82\xe9:",
-			"\x94\x6a\x89\xf3\x82\xb7\x82\xe9:",
-			"\x92\xb4\x89\x7a\x82\xb3\x82\xb9\x82\xe9:"
-		},
-
-		// HEBREW
-		{
-			"Drafts",
-			"Opening:",       "Straw Into Gold:",  "Dyeing:",
-			"Night Vision:",  "Twisting:",         "Sleep:",
-			"Emptying:",      "Invisibility:",     "Terror:",
-			"Sharpening:",    "Reflection:",       "Healing:",
-			"Silence:",       "Shaping:",          "Unmaking:",
-			"Transcendence:"
-		}
-	};
+void ScummEngine::drawDraftsInventory() {
+	int yConstant = _virtscr[kMainVirtScreen].topline + (_virtscr[kMainVirtScreen].h / 2);
+	bool isLoomVGA = _game.version == 4 || _game.platform == Common::kPlatformFMTowns;
+	int textHeight = getGUIStringHeight("A") + 3;
 
 	const char **names;
 
@@ -1637,25 +1696,25 @@ void ScummEngine::showDraftsInventory() {
 	case Common::EN_ANY:
 	case Common::EN_GRB:
 	case Common::EN_USA:
-		names = translatedNames[0];
+		names = loomDraftsNames[0];
 		break;
 	case Common::DE_DEU:
-		names = translatedNames[1];
+		names = loomDraftsNames[1];
 		break;
 	case Common::FR_FRA:
-		names = translatedNames[2];
+		names = loomDraftsNames[2];
 		break;
 	case Common::ES_ESP:
-		names = translatedNames[3];
+		names = loomDraftsNames[3];
 		break;
 	case Common::JA_JPN:
-		names = translatedNames[4];
+		names = loomDraftsNames[4];
 		break;
 	case Common::HE_ISR:
-		names = translatedNames[5];
+		names = loomDraftsNames[5];
 		break;
 	default:
-		names = translatedNames[0];
+		names = loomDraftsNames[0];
 	}
 
 	drawMainMenuTitle(names[0]);
@@ -1686,10 +1745,19 @@ void ScummEngine::showDraftsInventory() {
 	int unlockedColor = isLoomVGA ? 1 : getBannerColor(18);
 	int newDraftColor = isLoomVGA ? 14 : getBannerColor(21);
 
+	// French labels are quite long, so throughout the following code
+	// there are slight adjustments to French text positioning...
+	int xOffset = _language == Common::FR_FRA ? 10 : 0;
+
 	for (int i = 0; i < 16; i++) {
 		int draft = _scummVars[base + i * 2];
 
 		int xPos = i < 8 ? 30 : 167;
+		int textOffset = xOffset;
+
+		if (i >= 8) {
+			textOffset = 0;
+		}
 
 		int heightMultiplier = i < 8 ? i : (i % 8);
 
@@ -1707,55 +1775,23 @@ void ScummEngine::showDraftsInventory() {
 			Common::sprintf_s(notesBuf, sizeof(notesBuf), "????");
 		}
 
-		drawGUIText(names[i + 1], nullptr, xPos, yConstant - 40 + textHeight * heightMultiplier, titleColor, false);
+		drawGUIText(names[i + 1], nullptr, xPos - textOffset, yConstant - 40 + textHeight * heightMultiplier, titleColor, false);
 		int notesWidth = getGUIStringWidth(notesBuf);
 
-		if (_game.version == 3 && i >= 8)
-			xPos -= 3;
-
-		drawGUIText(notesBuf, nullptr, xPos + 100, yConstant - 40 + textHeight * heightMultiplier, notesColor, false);
-	}
-
-	ScummEngine::drawDirtyScreenParts();
-	_system->updateScreen();
-
-	// Notify that the menu is now active
-	_mainMenuIsActive = true;
-
-	// Clear keypresses and mouse presses
-	clearClickedStatus();
-
-	// Menu loop
-	while (!shouldQuit()) {
-		// Update the screen and the cursor while we're in the loop
-		waitForTimer(1);
-
-		// Wait for any mouse button presses...
-		waitForBannerInput(-1, ks, leftMsClicked, rightMsClicked, false);
-
-		if (leftMsClicked || rightMsClicked) {
-			break;
+		if (_game.version == 3) {
+			if (i >= 8)
+				xPos -= _language == Common::FR_FRA ? -6 : 3;
+			else if (_language == Common::FR_FRA)
+				xPos -= xOffset;
 		}
-	}
-
-	_mainMenuIsActive = false;
 
-	// Restore the old cursor state...
-	restoreCursorPostMenu();
 
-	// Restore surfaces...
-	if (_game.platform == Common::kPlatformFMTowns) {
-		// RESTORE FMTOWNS BUFFER
-	} else {
-		restoreSurfacesPostGUI();
+		drawGUIText(notesBuf, nullptr, xPos + 100 + textOffset, yConstant - 40 + textHeight * heightMultiplier, notesColor, false);
 	}
 
-	// Restore shake effect...
-	setShake(_shakeTempSavedState);
-
-	// Resume the engine.
-	pt.clear();
-	clearClickedStatus();
+	// Update the screen with all the new stuff!
+	ScummEngine::drawDirtyScreenParts();
+	_system->updateScreen();
 }
 
 void ScummEngine::toggleVoiceMode() {
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 2e8f7a0e3b0..b21d550b956 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -791,6 +791,8 @@ protected:
 	void saveSurfacesPreGUI();
 	void restoreSurfacesPostGUI();
 	void showDraftsInventory();
+	void setUpDraftsInventory();
+	void drawDraftsInventory();
 
 public:
 	char displayMessage(const char *altButton, MSVC_PRINTF const char *message, ...) GCC_PRINTF(3, 4);


Commit: 353e5102c503c8949c0c8477d5da539980a0c2bc
    https://github.com/scummvm/scummvm/commit/353e5102c503c8949c0c8477d5da539980a0c2bc
Author: AndywinXp (andywinxp at gmail.com)
Date: 2023-10-29T20:22:52+01:00

Commit Message:
SCUMM: LOOM/GUI: Fix Hebrew layout and add more comments

Changed paths:
    engines/scumm/gfx_gui.cpp


diff --git a/engines/scumm/gfx_gui.cpp b/engines/scumm/gfx_gui.cpp
index 91269060ac2..aff78017e8c 100644
--- a/engines/scumm/gfx_gui.cpp
+++ b/engines/scumm/gfx_gui.cpp
@@ -1513,9 +1513,10 @@ void ScummEngine::setUpDraftsInventory() {
 	int yConstant = _virtscr[kMainVirtScreen].topline + (_virtscr[kMainVirtScreen].h / 2);
 	bool isLoomVGA = (_game.version == 4) || _game.platform == Common::kPlatformFMTowns;
 
-	// French labels are quite long, so throughout the following code
-	// there are slight adjustments to French text positioning...
-	int xOffset = _language == Common::FR_FRA ? 10 : 0;
+	// French&Hebrew labels are quite long, so throughout the following code
+	// there are slight adjustments to French&Hebrew text positioning...
+	bool isLongLanguage = _language == Common::FR_FRA || _language == Common::HE_ISR;
+	int xOffset = isLongLanguage ? 10 : 0;
 
 	if (isLoomVGA) {
 		setUpInternalGUIControl(GUI_CTRL_OUTER_BOX,
@@ -1580,21 +1581,6 @@ void ScummEngine::setUpDraftsInventory() {
 			yConstant - 47 + 102,
 			_emptyMsg, 1, 0);
 	}
-
-	drawInternalGUIControl(GUI_CTRL_OUTER_BOX, 0);
-	drawInternalGUIControl(GUI_CTRL_INNER_BOX, 0);
-
-	if (isLoomVGA) {
-		drawLine(160,     yConstant - 47, 160,     yConstant + 55, 15);
-		drawLine(160 + 1, yConstant - 47, 160 + 1, yConstant + 55, 7);
-		drawLine(160 + 2, yConstant - 47, 160 + 2, yConstant + 55, 7);
-		drawLine(160 + 3, yConstant - 47, 160 + 3, yConstant + 55, 8);
-	} else {
-		drawLine(160,     yConstant - 47, 160,     yConstant + 55, getBannerColor(13));
-		drawLine(160 + 1, yConstant - 47, 160 + 1, yConstant + 55, getBannerColor(4));
-		drawLine(160 + 2, yConstant - 47, 160 + 2, yConstant + 55, getBannerColor(4));
-		drawLine(160 + 3, yConstant - 47, 160 + 3, yConstant + 55, getBannerColor(13));
-	}
 }
 
 static const char *loomDraftsNames[6][17] = {
@@ -1666,31 +1652,38 @@ static const char *loomDraftsNames[6][17] = {
 	// HEBREW
 	{
 		"\x9a\x85\x90\x89\x82\x90\x8e",
-		"\x84\x87\x89\x9a\x94:",
-		"\x81\x84\x86\x8c \x99\x97 \x9a\x8b\x89\x94\x84:",
-		"\x84\x92\x89\x81\x96:",
-		"\x84\x8c\x89\x8c \x9a\x89\x89\x80\x98:",
-		"\x81\x85\x81\x89\x91:",
-		"\x84\x90\x89\x99:",
-		"\x84\x97\x98\x84:",
-		"\x84\x80\x98\x90 \x89\x9a\x8c\x81\x8c \x84\x8b\x89\x94\x84:",
-		"\x84\x83\x87\x94\x84:",
-		"\x84\x86\x87\x99\x84:",
-		"\x84\x89\x8e\x83\x84:",
-		"\x89\x85\x94\x89\x98:",
-		"\x84\x97\x9a\x99\x84:",
-		"\x84\x98\x85\x96 \x9a\x90\x89\x9a\x90:",
-		"\x84\x91\x89\x98\x84:",
-		"\x9a\x85\x81\x82\x99\x90:"
+		":\x84\x87\x89\x9a\x94",
+		":\x81\x84\x86\x8c \x99\x97 \x9a\x8b\x89\x94\x84",
+		":\x84\x92\x89\x81\x96",
+		":\x84\x8c\x89\x8c \x9a\x89\x89\x80\x98",
+		":\x81\x85\x81\x89\x91",
+		":\x84\x90\x89\x99",
+		":\x84\x97\x98\x84",
+		":\x84\x80\x98\x90 \x89\x9a\x8c\x81\x8c \x84\x8b\x89\x94\x84",
+		":\x84\x83\x87\x94\x84",
+		":\x84\x86\x87\x99\x84",
+		":\x84\x89\x8e\x83\x84",
+		":\x89\x85\x94\x89\x98",
+		":\x84\x97\x9a\x99\x84",
+		":\x84\x98\x85\x96 \x9a\x90\x89\x9a\x90",
+		":\x84\x91\x89\x98\x84",
+		":\x9a\x85\x81\x82\x99\x90"
 	}
 };
 
 void ScummEngine::drawDraftsInventory() {
+	int base, xPos;
+	char notesBuf[6];
+	const char **names;
+	const char *notes = "cdefgabC";
+
 	int yConstant = _virtscr[kMainVirtScreen].topline + (_virtscr[kMainVirtScreen].h / 2);
 	bool isLoomVGA = _game.version == 4 || _game.platform == Common::kPlatformFMTowns;
 	int textHeight = getGUIStringHeight("A") + 3;
 
-	const char **names;
+	// French&Hebrew labels are quite long, so throughout the following code
+	// there are slight adjustments to French&Hebrew text positioning...
+	bool isLongLanguage = _language == Common::FR_FRA || _language == Common::HE_ISR;
 
 	switch (_language) {
 	case Common::EN_ANY:
@@ -1717,11 +1710,31 @@ void ScummEngine::drawDraftsInventory() {
 		names = loomDraftsNames[0];
 	}
 
-	drawMainMenuTitle(names[0]);
+	// ACT 1: Draw the widget graphics!
+	//
+	// Draw the inner and outer widgets...
+	drawInternalGUIControl(GUI_CTRL_OUTER_BOX, 0);
+	drawInternalGUIControl(GUI_CTRL_INNER_BOX, 0);
 
-	char notesBuf[6];
-	int base = 0;
+	// Draw the cute bar delimiter in the middle of the widget to separate the two text columns...
+	if (isLoomVGA) {
+		drawLine(160,     yConstant - 47, 160,     yConstant + 55, 15);
+		drawLine(160 + 1, yConstant - 47, 160 + 1, yConstant + 55, 7);
+		drawLine(160 + 2, yConstant - 47, 160 + 2, yConstant + 55, 7);
+		drawLine(160 + 3, yConstant - 47, 160 + 3, yConstant + 55, 8);
+	} else {
+		drawLine(160,     yConstant - 47, 160,     yConstant + 55, getBannerColor(13));
+		drawLine(160 + 1, yConstant - 47, 160 + 1, yConstant + 55, getBannerColor(4));
+		drawLine(160 + 2, yConstant - 47, 160 + 2, yConstant + 55, getBannerColor(4));
+		drawLine(160 + 3, yConstant - 47, 160 + 3, yConstant + 55, getBannerColor(13));
+	}
 
+	drawMainMenuTitle(names[0]); // Write "Drafts" on top of the menu widget
+
+	// ACT 2: Draw the actual useful stuff, text! :-P
+	//
+	// Drafts are stored in SCUMM global variables; we choose the appropriate
+	// first entry in the variables at which these drafts start.
 	if (_game.version == 4 || _game.platform == Common::kPlatformPCEngine) {
 		// DOS CD version / PC-Engine version
 		base = 100;
@@ -1729,41 +1742,32 @@ void ScummEngine::drawDraftsInventory() {
 		// Macintosh version
 		base = 55;
 	} else {
-		// All (?) other versions
+		// Other versions
 		base = 50;
 	}
 
-	const char *notes = "cdefgabC";
-	int maxWidth = 0;
-	for (int i = 0; i < 16; i++) {
-		int tmpWidth = getGUIStringWidth(names[i + 1]);
-		if (tmpWidth >= maxWidth)
-			maxWidth = tmpWidth;
-	}
-
 	int inactiveColor = 8;
 	int unlockedColor = isLoomVGA ? 1 : getBannerColor(18);
 	int newDraftColor = isLoomVGA ? 14 : getBannerColor(21);
 
-	// French labels are quite long, so throughout the following code
-	// there are slight adjustments to French text positioning...
-	int xOffset = _language == Common::FR_FRA ? 10 : 0;
+	// This is used to offset text elements in the event that
+	// we are dealing with a language which has very long strings...
+	int xOffset = isLongLanguage ? 10 : 0;
 
 	for (int i = 0; i < 16; i++) {
 		int draft = _scummVars[base + i * 2];
 
-		int xPos = i < 8 ? 30 : 167;
-		int textOffset = xOffset;
-
-		if (i >= 8) {
-			textOffset = 0;
-		}
-
+		// In which row are we rendering our text?
 		int heightMultiplier = i < 8 ? i : (i % 8);
 
-		int notesColor = (draft & 0x4000) ? unlockedColor : newDraftColor;
+		// Has the draft been unlocked by the player?
 		int titleColor = (draft & 0x2000) ? unlockedColor : inactiveColor;
 
+		// Has the new draft been used at least once?
+		int notesColor = (draft & 0x4000) ? unlockedColor : newDraftColor;
+
+		// Has the draft been unlocked? Great: put it in our text buffer
+		// otherwise just prepare to render the "????" string.
 		if (draft & 0x2000) {
 			Common::sprintf_s(notesBuf, sizeof(notesBuf), "%c%c%c%c",
 							  notes[draft & 0x0007],
@@ -1775,18 +1779,78 @@ void ScummEngine::drawDraftsInventory() {
 			Common::sprintf_s(notesBuf, sizeof(notesBuf), "????");
 		}
 
-		drawGUIText(names[i + 1], nullptr, xPos - textOffset, yConstant - 40 + textHeight * heightMultiplier, titleColor, false);
-		int notesWidth = getGUIStringWidth(notesBuf);
+		// Hebrew rendering vs All-The-Other-LTR-Languages rendering:
+		//
+		// This is one case in which instead of doing all sorts of tricks
+		// to have as few lines as possible, I prefer to duplicate code
+		// for the sake of readability, so just so you know... this is
+		// done on purpose... :-)
+		if (_language != Common::HE_ISR) {
+			// Where are we positioning the text?
+			// Left column or right column?
+			// (Objective: Leave three pixels to the left)
+			if (isLoomVGA) {
+				xPos = i < 8 ? 31 : 167;
+			} else {
+				xPos = i < 8 ? 30 : 167;
+			}
+			int textOffset = xOffset;
 
-		if (_game.version == 3) {
-			if (i >= 8)
-				xPos -= _language == Common::FR_FRA ? -6 : 3;
-			else if (_language == Common::FR_FRA)
-				xPos -= xOffset;
-		}
+			if (i >= 8) {
+				textOffset = 0;
+			}
 
+			// Draw the titles of the drafts...
+			drawGUIText(names[i + 1], nullptr, xPos - textOffset, yConstant - 40 + textHeight * heightMultiplier, titleColor, false);
+			int notesWidth = getGUIStringWidth(notesBuf);
+
+			// Text position adjustments for the notes...
+			// (Objective: Leave three pixels to the right)
+			if (!isLoomVGA) {
+				if (i >= 8)
+					xPos += isLongLanguage ? 8 : -2;
+				else if (isLongLanguage)
+					xPos -= xOffset - 1;
+				else
+					xPos += 1;
+			} else {
+				if (i >= 8)
+					xPos -= _game.platform == Common::kPlatformFMTowns ? 3 : 2;
+				else
+					xPos += _game.platform == Common::kPlatformFMTowns ? 0 : 1;
+			}
+
+			// Draw the notes of the draft... notice how we are subtracting
+			// notesWidth: we are forcing the text aligning on the left.
+			drawGUIText(notesBuf, nullptr, xPos - notesWidth + 127 + textOffset, yConstant - 40 + textHeight * heightMultiplier, notesColor, false);
+		} else {
+			// Hebrew language, let's swap the layout!
 
-		drawGUIText(notesBuf, nullptr, xPos + 100 + textOffset, yConstant - 40 + textHeight * heightMultiplier, notesColor, false);
+			// Where are we positioning the text?
+			// Left column or right column?
+			// (Objective: Leave three pixels to the left)
+			xPos = i >= 8 ? 30 : 167;
+			int textOffset = xOffset;
+
+			if (i < 8) {
+				textOffset = 0;
+			}
+
+			// Draw the notes of the drafts...
+			drawGUIText(notesBuf, nullptr, xPos - textOffset, yConstant - 40 + textHeight * heightMultiplier, titleColor, false);
+			int namesWidth = getGUIStringWidth(names[i + 1]);
+
+			// Text position adjustments for the titles...
+			// (Objective: Leave three pixels to the right)
+			if (i < 8)
+				xPos += 8;
+			else
+				xPos -= xOffset - 1;
+
+			// Draw the titles of the drafts... notice how we are subtracting
+			// namesWidth: we are forcing the text aligning on the left.
+			drawGUIText(names[i + 1], nullptr, xPos - namesWidth + 127 + textOffset, yConstant - 40 + textHeight * heightMultiplier, notesColor, false);
+		}
 	}
 
 	// Update the screen with all the new stuff!


Commit: dce87d8bda1bce9b46136c01ba49fab9596f6242
    https://github.com/scummvm/scummvm/commit/dce87d8bda1bce9b46136c01ba49fab9596f6242
Author: AndywinXp (andywinxp at gmail.com)
Date: 2023-10-29T20:22:52+01:00

Commit Message:
SCUMM: LOOM/GUI: Fix occasional wrong text height being fetched

Also, clean-up.

Changed paths:
    engines/scumm/gfx_gui.cpp


diff --git a/engines/scumm/gfx_gui.cpp b/engines/scumm/gfx_gui.cpp
index aff78017e8c..888ef088488 100644
--- a/engines/scumm/gfx_gui.cpp
+++ b/engines/scumm/gfx_gui.cpp
@@ -1672,14 +1672,14 @@ static const char *loomDraftsNames[6][17] = {
 };
 
 void ScummEngine::drawDraftsInventory() {
-	int base, xPos;
+	int base, xPos, textHeight, heightMultiplier, draft,textOffset, xOffset,
+		inactiveColor, unlockedColor, newDraftColor, titleColor, notesColor;
 	char notesBuf[6];
 	const char **names;
 	const char *notes = "cdefgabC";
 
 	int yConstant = _virtscr[kMainVirtScreen].topline + (_virtscr[kMainVirtScreen].h / 2);
 	bool isLoomVGA = _game.version == 4 || _game.platform == Common::kPlatformFMTowns;
-	int textHeight = getGUIStringHeight("A") + 3;
 
 	// French&Hebrew labels are quite long, so throughout the following code
 	// there are slight adjustments to French&Hebrew text positioning...
@@ -1746,25 +1746,26 @@ void ScummEngine::drawDraftsInventory() {
 		base = 50;
 	}
 
-	int inactiveColor = 8;
-	int unlockedColor = isLoomVGA ? 1 : getBannerColor(18);
-	int newDraftColor = isLoomVGA ? 14 : getBannerColor(21);
+	inactiveColor = 8;
+	unlockedColor = isLoomVGA ? 1 : getBannerColor(18);
+	newDraftColor = isLoomVGA ? 14 : getBannerColor(21);
 
 	// This is used to offset text elements in the event that
 	// we are dealing with a language which has very long strings...
-	int xOffset = isLongLanguage ? 10 : 0;
+	xOffset = isLongLanguage ? 10 : 0;
 
 	for (int i = 0; i < 16; i++) {
-		int draft = _scummVars[base + i * 2];
+		draft = _scummVars[base + i * 2];
 
 		// In which row are we rendering our text?
-		int heightMultiplier = i < 8 ? i : (i % 8);
+		heightMultiplier = i < 8 ? i : (i % 8);
+		textHeight = getGUIStringHeight("A") + 3;
 
 		// Has the draft been unlocked by the player?
-		int titleColor = (draft & 0x2000) ? unlockedColor : inactiveColor;
+		titleColor = (draft & 0x2000) ? unlockedColor : inactiveColor;
 
 		// Has the new draft been used at least once?
-		int notesColor = (draft & 0x4000) ? unlockedColor : newDraftColor;
+		notesColor = (draft & 0x4000) ? unlockedColor : newDraftColor;
 
 		// Has the draft been unlocked? Great: put it in our text buffer
 		// otherwise just prepare to render the "????" string.
@@ -1794,7 +1795,8 @@ void ScummEngine::drawDraftsInventory() {
 			} else {
 				xPos = i < 8 ? 30 : 167;
 			}
-			int textOffset = xOffset;
+
+			textOffset = xOffset;
 
 			if (i >= 8) {
 				textOffset = 0;
@@ -1830,7 +1832,7 @@ void ScummEngine::drawDraftsInventory() {
 			// Left column or right column?
 			// (Objective: Leave three pixels to the left)
 			xPos = i >= 8 ? 30 : 167;
-			int textOffset = xOffset;
+			textOffset = xOffset;
 
 			if (i < 8) {
 				textOffset = 0;


Commit: 3a590f203e80ae7ba6ed979bb6513c28944ac261
    https://github.com/scummvm/scummvm/commit/3a590f203e80ae7ba6ed979bb6513c28944ac261
Author: AndywinXp (andywinxp at gmail.com)
Date: 2023-10-29T20:22:52+01:00

Commit Message:
SCUMM: LOOM/GUI: Fix FM-Towns widget not disappearing

Changed paths:
    engines/scumm/gfx_gui.cpp


diff --git a/engines/scumm/gfx_gui.cpp b/engines/scumm/gfx_gui.cpp
index 888ef088488..2473562eecf 100644
--- a/engines/scumm/gfx_gui.cpp
+++ b/engines/scumm/gfx_gui.cpp
@@ -1452,6 +1452,14 @@ void ScummEngine::restoreSurfacesPostGUI() {
 void ScummEngine::showDraftsInventory() {
 	bool leftMsClicked = false, rightMsClicked = false;
 
+	// FM-Towns stuff...
+	int textSurfBannerMemSize = 0;
+	byte *textSurfBannerMem = nullptr;
+	int rowSize = _screenWidth;
+	int draftsWidgetHeight = _virtscr[kMainVirtScreen].h;
+	int screenMemSize = 0;
+	byte *screenMem = nullptr;
+
 	Common::KeyState ks;
 
 	// Pause the engine...
@@ -1461,7 +1469,35 @@ void ScummEngine::showDraftsInventory() {
 	setShake(0);
 
 	// Save surfaces...
-	saveSurfacesPreGUI();
+	if (_game.platform != Common::kPlatformFMTowns) {
+		saveSurfacesPreGUI();
+	} else {
+		// FM-Towns games draw GUI elements on the text surface, so let's save that
+#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
+		rowSize *= _textSurfaceMultiplier;
+		textSurfBannerMemSize = (draftsWidgetHeight) * rowSize * _textSurfaceMultiplier;
+		textSurfBannerMem = (byte *)malloc(textSurfBannerMemSize * sizeof(byte));
+		if (textSurfBannerMem) {
+			memcpy(
+				textSurfBannerMem,
+				((byte *)_textSurface.getBasePtr(0, _screenTop * _textSurfaceMultiplier)),
+				textSurfBannerMemSize);
+		}
+
+		// We're going to use these same values for saving the
+		// virtual screen surface, so let's un-multiply them...
+		rowSize /= _textSurfaceMultiplier;
+#endif
+
+		screenMemSize = (draftsWidgetHeight) * (rowSize);
+		screenMem = (byte *)malloc(screenMemSize * sizeof(byte));
+		if (screenMem) {
+			memcpy(
+				screenMem,
+				_virtscr[kMainVirtScreen].getPixels(0, _screenTop),
+				screenMemSize);
+		}
+	}
 
 	// Save the current cursor state...
 	saveCursorPreMenu();
@@ -1495,10 +1531,40 @@ void ScummEngine::showDraftsInventory() {
 	restoreCursorPostMenu();
 
 	// Restore surfaces...
-	if (_game.platform == Common::kPlatformFMTowns) {
-		// RESTORE FMTOWNS BUFFER
-	} else {
+	if (_game.platform != Common::kPlatformFMTowns) {
 		restoreSurfacesPostGUI();
+	} else {
+		// FM-Towns games draw GUI elements on the text surface, so restore both surfaces...
+#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
+		if (_game.platform == Common::kPlatformFMTowns && textSurfBannerMem) {
+			rowSize *= _textSurfaceMultiplier;
+			memcpy(
+				((byte *)_textSurface.getBasePtr(0, _screenTop * _textSurfaceMultiplier)),
+				textSurfBannerMem,
+				textSurfBannerMemSize);
+
+			// We're going to use these same values for restoring the
+			// virtual screen surface, so let's un-multiply them...
+			rowSize /= _textSurfaceMultiplier;
+
+			free(textSurfBannerMem);
+			textSurfBannerMem = nullptr;
+		}
+#endif
+
+		if (screenMem) {
+			memcpy(
+				_virtscr[kMainVirtScreen].getPixels(0, _screenTop),
+				screenMem,
+				screenMemSize);
+
+			markRectAsDirty(_virtscr[kMainVirtScreen].number, 0, rowSize, _screenTop, _screenHeight + _screenTop);
+			ScummEngine::drawDirtyScreenParts();
+			_system->updateScreen();
+
+			free(screenMem);
+			screenMem = nullptr;
+		}
 	}
 
 	// Restore shake effect...


Commit: d97fe2034d1ea985e6421995914fe4d6ee4d3d4d
    https://github.com/scummvm/scummvm/commit/d97fe2034d1ea985e6421995914fe4d6ee4d3d4d
Author: AndywinXp (andywinxp at gmail.com)
Date: 2023-10-29T20:22:52+01:00

Commit Message:
SCUMM: LOOM/GUI: Fix text colors inversion for Hebrew

Changed paths:
    engines/scumm/gfx_gui.cpp


diff --git a/engines/scumm/gfx_gui.cpp b/engines/scumm/gfx_gui.cpp
index 2473562eecf..2b3db48d732 100644
--- a/engines/scumm/gfx_gui.cpp
+++ b/engines/scumm/gfx_gui.cpp
@@ -1905,7 +1905,7 @@ void ScummEngine::drawDraftsInventory() {
 			}
 
 			// Draw the notes of the drafts...
-			drawGUIText(notesBuf, nullptr, xPos - textOffset, yConstant - 40 + textHeight * heightMultiplier, titleColor, false);
+			drawGUIText(notesBuf, nullptr, xPos - textOffset, yConstant - 40 + textHeight * heightMultiplier, notesColor, false);
 			int namesWidth = getGUIStringWidth(names[i + 1]);
 
 			// Text position adjustments for the titles...
@@ -1917,7 +1917,7 @@ void ScummEngine::drawDraftsInventory() {
 
 			// Draw the titles of the drafts... notice how we are subtracting
 			// namesWidth: we are forcing the text aligning on the left.
-			drawGUIText(names[i + 1], nullptr, xPos - namesWidth + 127 + textOffset, yConstant - 40 + textHeight * heightMultiplier, notesColor, false);
+			drawGUIText(names[i + 1], nullptr, xPos - namesWidth + 127 + textOffset, yConstant - 40 + textHeight * heightMultiplier, titleColor, false);
 		}
 	}
 


Commit: ff3c922b8d45733cbb5048b9a5fbf34c60b19cea
    https://github.com/scummvm/scummvm/commit/ff3c922b8d45733cbb5048b9a5fbf34c60b19cea
Author: AndywinXp (andywinxp at gmail.com)
Date: 2023-10-29T20:22:52+01:00

Commit Message:
SCUMM: LOOM/GUI: Mask currently unknown drafts titles

Changed paths:
    engines/scumm/gfx_gui.cpp


diff --git a/engines/scumm/gfx_gui.cpp b/engines/scumm/gfx_gui.cpp
index 2b3db48d732..60899c7ff5b 100644
--- a/engines/scumm/gfx_gui.cpp
+++ b/engines/scumm/gfx_gui.cpp
@@ -1649,7 +1649,7 @@ void ScummEngine::setUpDraftsInventory() {
 	}
 }
 
-static const char *loomDraftsNames[6][17] = {
+static const char *loomDraftsNames[6][18] = {
 	// ENGLISH
 	{
 		"Drafts",
@@ -1658,7 +1658,8 @@ static const char *loomDraftsNames[6][17] = {
 		"Emptying:",      "Invisibility:",     "Terror:",
 		"Sharpening:",    "Reflection:",       "Healing:",
 		"Silence:",       "Shaping:",          "Unmaking:",
-		"Transcendence:"
+		"Transcendence:",
+		"Unknown:"
 	},
 
 	// GERMAN
@@ -1669,7 +1670,8 @@ static const char *loomDraftsNames[6][17] = {
 		"Entleeren:",        "Unsichtbarkeit:",  "Angst:",
 		"Sch\x84rfen:",      "Spiegelung:",      "Heilen:",
 		"Stille:",           "Formen:",          "Zerst\x94ren:",
-		"Transzendenz:"
+		"Transzendenz:",
+		"Unbekannt:"
 	},
 
 	// FRENCH
@@ -1680,7 +1682,8 @@ static const char *loomDraftsNames[6][17] = {
 		"Vidange:",              "Camouflage:",              "Terreur:",
 		"Trame \x85 aiguiser:",  "Reflet:",                  "Gu\x82rison:",
 		"Silence:",              "Formation:",               "Trame d\x82\x66\x61ite:",
-		"Transcendance:"
+		"Transcendance:",
+		"Inconnu:"
 	},
 
 	// SPANISH
@@ -1691,7 +1694,8 @@ static const char *loomDraftsNames[6][17] = {
 		"Vacio:",               "Invisibilidad:",  "Terror:",
 		"Afilado:",             "Reflexion:",      "Curativo:",
 		"Silencio:",            "Moldear:",        "Deshacer:",
-		"Trascendencia:"
+		"Trascendencia:",
+		"Desconocido:"
 	},
 
 	// JAPANESE
@@ -1712,7 +1716,8 @@ static const char *loomDraftsNames[6][17] = {
 		"\x90\xc3\x82\xa9\x82\xc9\x82\xb3\x82\xb9\x82\xe9:",
 		"\x8c\x60\x82\xf0\x95\xcf\x82\xa6\x82\xe9:",
 		"\x94\x6a\x89\xf3\x82\xb7\x82\xe9:",
-		"\x92\xb4\x89\x7a\x82\xb3\x82\xb9\x82\xe9:"
+		"\x92\xb4\x89\x7a\x82\xb3\x82\xb9\x82\xe9:",
+		"\x96\xa2\x92\x6d:"
 	},
 
 	// HEBREW
@@ -1733,13 +1738,16 @@ static const char *loomDraftsNames[6][17] = {
 		":\x84\x97\x9a\x99\x84",
 		":\x84\x98\x85\x96 \x9a\x90\x89\x9a\x90",
 		":\x84\x91\x89\x98\x84",
-		":\x9a\x85\x81\x82\x99\x90"
+		":\x9a\x85\x81\x82\x99\x90",
+		":\x92\x85\x83\x89\x20\x80\x8c"
 	}
 };
 
 void ScummEngine::drawDraftsInventory() {
-	int base, xPos, textHeight, heightMultiplier, draft,textOffset, xOffset,
-		inactiveColor, unlockedColor, newDraftColor, titleColor, notesColor;
+	int base, xPos, textHeight, heightMultiplier, draft, textOffset, xOffset,
+		inactiveColor, unlockedColor, newDraftColor, titleColor, notesColor,
+		namesWidth, notesWidth;
+
 	char notesBuf[6];
 	const char **names;
 	const char *notes = "cdefgabC";
@@ -1869,8 +1877,14 @@ void ScummEngine::drawDraftsInventory() {
 			}
 
 			// Draw the titles of the drafts...
-			drawGUIText(names[i + 1], nullptr, xPos - textOffset, yConstant - 40 + textHeight * heightMultiplier, titleColor, false);
-			int notesWidth = getGUIStringWidth(notesBuf);
+			if (draft & 0x2000) {
+				drawGUIText(names[i + 1], nullptr, xPos - textOffset, yConstant - 40 + textHeight * heightMultiplier, titleColor, false);
+			} else {
+				// Draw "Unknown:" as the title of the draft
+				drawGUIText(names[17], nullptr, xPos - textOffset, yConstant - 40 + textHeight * heightMultiplier, titleColor, false);
+			}
+
+			notesWidth = getGUIStringWidth(notesBuf);
 
 			// Text position adjustments for the notes...
 			// (Objective: Leave three pixels to the right)
@@ -1906,7 +1920,7 @@ void ScummEngine::drawDraftsInventory() {
 
 			// Draw the notes of the drafts...
 			drawGUIText(notesBuf, nullptr, xPos - textOffset, yConstant - 40 + textHeight * heightMultiplier, notesColor, false);
-			int namesWidth = getGUIStringWidth(names[i + 1]);
+			namesWidth = getGUIStringWidth(names[i + 1]);
 
 			// Text position adjustments for the titles...
 			// (Objective: Leave three pixels to the right)
@@ -1917,7 +1931,14 @@ void ScummEngine::drawDraftsInventory() {
 
 			// Draw the titles of the drafts... notice how we are subtracting
 			// namesWidth: we are forcing the text aligning on the left.
-			drawGUIText(names[i + 1], nullptr, xPos - namesWidth + 127 + textOffset, yConstant - 40 + textHeight * heightMultiplier, titleColor, false);
+			if (draft & 0x2000) {
+				namesWidth = getGUIStringWidth(names[i + 1]);
+				drawGUIText(names[i + 1], nullptr, xPos - namesWidth + 127 + textOffset, yConstant - 40 + textHeight * heightMultiplier, titleColor, false);
+			} else {
+				// Draw "Unknown:" as the title of the draft
+				namesWidth = getGUIStringWidth(names[17]);
+				drawGUIText(names[17], nullptr, xPos - namesWidth + 127 + textOffset, yConstant - 40 + textHeight * heightMultiplier, titleColor, false);
+			}
 		}
 	}
 




More information about the Scummvm-git-logs mailing list