[Scummvm-git-logs] scummvm master -> 1c8088ec9ae8f2844f4fac806a2db69e60ede857

eriktorbjorn noreply at scummvm.org
Mon Nov 27 17:13:21 UTC 2023


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

Summary:
1c8088ec9a SCUMM: Move Mac Loom drafts inventory into MacLoomGui


Commit: 1c8088ec9ae8f2844f4fac806a2db69e60ede857
    https://github.com/scummvm/scummvm/commit/1c8088ec9ae8f2844f4fac806a2db69e60ede857
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2023-11-27T18:12:06+01:00

Commit Message:
SCUMM: Move Mac Loom drafts inventory into MacLoomGui

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


diff --git a/engines/scumm/gfx_mac.cpp b/engines/scumm/gfx_mac.cpp
index 630b88a00cd..de941be9f13 100644
--- a/engines/scumm/gfx_mac.cpp
+++ b/engines/scumm/gfx_mac.cpp
@@ -3238,95 +3238,6 @@ MacGui::MacDialogWindow *MacGui::drawBanner(char *message) {
 	return window;
 }
 
-void MacGui::runDraftsInventory() {
-	int base, xPos, textHeight, heightMultiplier, draft, inactiveColor,
-		unlockedColor, newDraftColor, notesColor;
-
-	char notesBuf[6];
-	const char *names[18] = {
-		"Drafts",
-		"Opening:", "Straw Into Gold:", "Dyeing:",
-		"Night Vision:", "Twisting:", "Sleep:",
-		"Emptying:", "Invisibility:", "Terror:",
-		"Sharpening:", "Reflection:", "Healing:",
-		"Silence:", "Shaping:", "Unmaking:",
-		"Transcendence:",
-		"Unknown:"
-	};
-
-	const char *notes = "cdefgabC";
-
-	// ACT 1: Draw the Mac dialog window
-	MacGui::MacDialogWindow *window = createWindow(Common::Rect(110, 20, 540, 252));
-	const Graphics::Font *font = getFont(kSystemFont);
-
-	Graphics::Surface *s = window->innerSurface();
-
-	// ACT 2: Draw the drafts text
-	//
-	// Drafts are stored in SCUMM global variables; we choose the appropriate
-	// first entry in the variables at which these drafts start.
-	base = 55;
-
-	// TODO: Can these be drawn in different styles? (e.g. Checkerboard)
-	unlockedColor = kBlack;
-	inactiveColor = kBlack;
-	newDraftColor = kBlack;
-
-	for (int i = 0; i < 16; i++) {
-		draft = _vm->_scummVars[base + i * 2];
-
-		// In which row are we rendering our text?
-		heightMultiplier = i < 8 ? i : (i % 8);
-		textHeight = 24;
-
-		// Has the draft been unlocked by the player?
-		//int titleColor = (draft & 0x2000) ? unlockedColor : inactiveColor;
-
-		// Has the new draft been used at least once?
-		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],
-							  notes[(draft & 0x0038) >> 3],
-							  notes[(draft & 0x01c0) >> 6],
-							  notes[(draft & 0x0e00) >> 9]);
-		} else {
-			notesColor = inactiveColor;
-			Common::sprintf_s(notesBuf, sizeof(notesBuf), "????");
-		}
-
-		// Where are we positioning the text?
-		// Left column or right column?
-		xPos = i < 8 ? 40 : 260;
-
-		// Draw the titles of the drafts...
-		if (draft & 0x2000) {
-			font->drawString(s, (const char *)names[i + 1], xPos - 20, 24 + textHeight * heightMultiplier, s->w, notesColor, Graphics::kTextAlignLeft); // FIXME: titleColor, not notesColor?
-		} else {
-			// Draw "Unknown:" as the title of the draft
-			font->drawString(s, (const char *)names[17], xPos - 20, 24 + textHeight * heightMultiplier, s->w, notesColor, Graphics::kTextAlignLeft); // FIXME: titleColor, not notesColor?
-		}
-
-		// Draw the notes of the draft...
-		font->drawString(s, (const char *)notesBuf, xPos + 100, 24 + textHeight * heightMultiplier, s->w, notesColor, Graphics::kTextAlignLeft);
-	}
-
-	// Draw "Drafts" on top of the dialog
-	font->drawString(s, (const char *)names[0], 0, 4, s->w, kBlack, Graphics::kTextAlignCenter);
-
-	// Draw a vertical line to separate the two columns
-	s->drawLine(210, 44, 210, 184, kBlack);
-
-	// Update the screen with all the new stuff!
-	window->show();
-	delay();
-	delete window;
-}
-
 void MacGui::drawBitmap(Common::Rect r, const uint16 *bitmap, Color color) const {
 	drawBitmap(_surface, r, bitmap, color);
 }
@@ -3722,6 +3633,95 @@ void MacLoomGui::runAboutDialog() {
 	delete window;
 }
 
+void MacLoomGui::runDraftsInventory() {
+	int base, xPos, textHeight, heightMultiplier, draft, inactiveColor,
+		unlockedColor, newDraftColor, notesColor;
+
+	char notesBuf[6];
+	const char *names[18] = {
+		"Drafts",
+		"Opening:", "Straw Into Gold:", "Dyeing:",
+		"Night Vision:", "Twisting:", "Sleep:",
+		"Emptying:", "Invisibility:", "Terror:",
+		"Sharpening:", "Reflection:", "Healing:",
+		"Silence:", "Shaping:", "Unmaking:",
+		"Transcendence:",
+		"Unknown:"
+	};
+
+	const char *notes = "cdefgabC";
+
+	// ACT 1: Draw the Mac dialog window
+	MacGui::MacDialogWindow *window = createWindow(Common::Rect(110, 20, 540, 252));
+	const Graphics::Font *font = getFont(kSystemFont);
+
+	Graphics::Surface *s = window->innerSurface();
+
+	// ACT 2: Draw the drafts text
+	//
+	// Drafts are stored in SCUMM global variables; we choose the appropriate
+	// first entry in the variables at which these drafts start.
+	base = 55;
+
+	// TODO: Can these be drawn in different styles? (e.g. Checkerboard)
+	unlockedColor = kBlack;
+	inactiveColor = kBlack;
+	newDraftColor = kBlack;
+
+	for (int i = 0; i < 16; i++) {
+		draft = _vm->_scummVars[base + i * 2];
+
+		// In which row are we rendering our text?
+		heightMultiplier = i < 8 ? i : (i % 8);
+		textHeight = 24;
+
+		// Has the draft been unlocked by the player?
+		//int titleColor = (draft & 0x2000) ? unlockedColor : inactiveColor;
+
+		// Has the new draft been used at least once?
+		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],
+							  notes[(draft & 0x0038) >> 3],
+							  notes[(draft & 0x01c0) >> 6],
+							  notes[(draft & 0x0e00) >> 9]);
+		} else {
+			notesColor = inactiveColor;
+			Common::sprintf_s(notesBuf, sizeof(notesBuf), "????");
+		}
+
+		// Where are we positioning the text?
+		// Left column or right column?
+		xPos = i < 8 ? 40 : 260;
+
+		// Draw the titles of the drafts...
+		if (draft & 0x2000) {
+			font->drawString(s, (const char *)names[i + 1], xPos - 20, 24 + textHeight * heightMultiplier, s->w, notesColor, Graphics::kTextAlignLeft); // FIXME: titleColor, not notesColor?
+		} else {
+			// Draw "Unknown:" as the title of the draft
+			font->drawString(s, (const char *)names[17], xPos - 20, 24 + textHeight * heightMultiplier, s->w, notesColor, Graphics::kTextAlignLeft); // FIXME: titleColor, not notesColor?
+		}
+
+		// Draw the notes of the draft...
+		font->drawString(s, (const char *)notesBuf, xPos + 100, 24 + textHeight * heightMultiplier, s->w, notesColor, Graphics::kTextAlignLeft);
+	}
+
+	// Draw "Drafts" on top of the dialog
+	font->drawString(s, (const char *)names[0], 0, 4, s->w, kBlack, Graphics::kTextAlignCenter);
+
+	// Draw a vertical line to separate the two columns
+	s->drawLine(210, 44, 210, 184, kBlack);
+
+	// Update the screen with all the new stuff!
+	window->show();
+	delay();
+	delete window;
+}
+
 // A standard file picker dialog doesn't really make sense in ScummVM, so we
 // make something that just looks similar to one.
 
diff --git a/engines/scumm/gfx_mac.h b/engines/scumm/gfx_mac.h
index 941acee37ff..e9c08fd3bb4 100644
--- a/engines/scumm/gfx_mac.h
+++ b/engines/scumm/gfx_mac.h
@@ -607,7 +607,6 @@ public:
 	MacDialogWindow *createWindow(Common::Rect bounds, MacDialogWindowStyle style = kStyleNormal);
 	MacDialogWindow *createDialog(int dialogId);
 	MacDialogWindow *drawBanner(char *message);
-	void runDraftsInventory();
 
 	void drawBitmap(Common::Rect r, const uint16 *bitmap, Color color) const;
 	void drawBitmap(Graphics::Surface *s, Common::Rect r, const uint16 *bitmap, Color color) const;
@@ -629,6 +628,8 @@ public:
 	void resetAfterLoad();
 	void update(int delta);
 
+	void runDraftsInventory();
+
 protected:
 	bool getFontParams(FontId fontId, int &id, int &size, int &slant) const;
 
diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp
index 48545c54745..24dc89d5fc5 100644
--- a/engines/scumm/input.cpp
+++ b/engines/scumm/input.cpp
@@ -1168,7 +1168,7 @@ void ScummEngine::processKeyboard(Common::KeyState lastKeyHit) {
 			mainmenuKeyEnabled && (lastKeyHit.keycode == Common::KEYCODE_d && lastKeyHit.hasFlags(Common::KBD_CTRL))) {
 			// Drafts menu
 			if (_macGui) {
-				_macGui->runDraftsInventory();
+				((MacLoomGui *)_macGui)->runDraftsInventory();
 			} else {
 				showDraftsInventory();
 			}




More information about the Scummvm-git-logs mailing list