[Scummvm-git-logs] scummvm master -> 918e3490402d9cef9e5678b7117d5e5ea15d9317

AndywinXp noreply at scummvm.org
Fri Oct 4 18:52:38 UTC 2024


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:
918e349040 SCUMM: INDY3/LOOM (Mac): Draw fake widgets in open/save windows


Commit: 918e3490402d9cef9e5678b7117d5e5ea15d9317
    https://github.com/scummvm/scummvm/commit/918e3490402d9cef9e5678b7117d5e5ea15d9317
Author: AndywinXp (andywinxp at gmail.com)
Date: 2024-10-04T20:52:32+02:00

Commit Message:
SCUMM: INDY3/LOOM (Mac): Draw fake widgets in open/save windows

These are fake widgets because we won't ever have,
within ScummVM, an use for the real ones.

Now the dialogs are more accurate and prettier. :-)

Changed paths:
    engines/scumm/macgui/macgui_dialogwindow.cpp
    engines/scumm/macgui/macgui_impl.cpp
    engines/scumm/macgui/macgui_impl.h
    engines/scumm/macgui/macgui_indy3.cpp
    engines/scumm/macgui/macgui_loom.cpp
    engines/scumm/macgui/macgui_widgets.cpp


diff --git a/engines/scumm/macgui/macgui_dialogwindow.cpp b/engines/scumm/macgui/macgui_dialogwindow.cpp
index 92f070accff..04a3e4a55d8 100644
--- a/engines/scumm/macgui/macgui_dialogwindow.cpp
+++ b/engines/scumm/macgui/macgui_dialogwindow.cpp
@@ -170,8 +170,8 @@ MacGuiImpl::MacCheckbox *MacGuiImpl::MacDialogWindow::addCheckbox(Common::Rect b
 	return checkbox;
 }
 
-MacGuiImpl::MacStaticText *MacGuiImpl::MacDialogWindow::addStaticText(Common::Rect bounds, Common::String text, bool enabled) {
-	MacGuiImpl::MacStaticText *staticText = new MacStaticText(this, bounds, text, enabled);
+MacGuiImpl::MacStaticText *MacGuiImpl::MacDialogWindow::addStaticText(Common::Rect bounds, Common::String text, bool enabled, Graphics::TextAlign alignment) {
+	MacGuiImpl::MacStaticText *staticText = new MacStaticText(this, bounds, text, enabled, alignment);
 	_widgets.push_back(staticText);
 	return staticText;
 }
diff --git a/engines/scumm/macgui/macgui_impl.cpp b/engines/scumm/macgui/macgui_impl.cpp
index e42dbfe8ef7..dfb7034807d 100644
--- a/engines/scumm/macgui/macgui_impl.cpp
+++ b/engines/scumm/macgui/macgui_impl.cpp
@@ -675,8 +675,11 @@ MacGuiImpl::MacDialogWindow *MacGuiImpl::createDialog(int dialogId) {
 
 				// Skip drive label box and listbox
 				bool doNotDraw = (isOpenDialog && (i == 6 || i == 7)) || ((isOpenDialog || isSaveDialog) && i == 3);
-				if (!doNotDraw)
+				if (!doNotDraw) {
 					window->innerSurface()->frameRect(r, kBlack);
+				} else if (_vm->_game.id == GID_INDY3 && i == 3) {
+					drawFakeDriveLabel(window, Common::Rect(r.left + 9, r.top, r.right, r.bottom), _hardDriveIcon, "ScummVM", Graphics::kTextAlignLeft);
+				}
 
 				break;
 			}
@@ -806,6 +809,44 @@ bool MacGuiImpl::runOkCancelDialog(Common::String text) {
 	return ret;
 }
 
+void MacGuiImpl::drawFakePathList(MacDialogWindow *window, Common::Rect r, byte *icon, const char *text, Graphics::TextAlign alignment) {
+	// Draw the text...
+	window->addStaticText(Common::Rect(r.left + 22, r.top + 2, r.right - 21, r.bottom - 1), text, true, alignment);
+
+	// Draw the icon...
+	Graphics::Surface *iconSurf = new Graphics::Surface();
+	iconSurf->create(16, 16, Graphics::PixelFormat::createFormatCLUT8());
+	iconSurf->setPixels(icon);
+	window->drawSprite(iconSurf, r.left + 4, r.top + 1);
+	delete iconSurf;
+
+	// Draw the arrow...
+	Graphics::Surface *arrowSurf = new Graphics::Surface();
+	arrowSurf->create(16, 16, Graphics::PixelFormat::createFormatCLUT8());
+	arrowSurf->setPixels(_arrowDownIcon);
+	window->drawSprite(arrowSurf, r.right - 19, r.top + 1);
+	delete arrowSurf;
+
+	// Draw the black frame...
+	window->innerSurface()->frameRect(r, kBlack);
+
+	// Draw the shadows...
+	window->innerSurface()->hLine(r.left + 3, r.bottom, r.right, kBlack);
+	window->innerSurface()->vLine(r.right, r.top + 3, r.bottom, kBlack);
+}
+
+void MacGuiImpl::drawFakeDriveLabel(MacDialogWindow *window, Common::Rect r, byte *icon, const char *text, Graphics::TextAlign alignment) {
+	// Draw the text...
+	window->addStaticText(Common::Rect(r.left + 25, r.top, r.right, r.bottom), text, true, alignment);
+
+	// Draw the icon...
+	Graphics::Surface *surf = new Graphics::Surface();
+	surf->create(16, 16, Graphics::PixelFormat::createFormatCLUT8());
+	surf->setPixels(icon);
+	window->drawSprite(surf, r.left + 6, r.top);
+	delete surf;
+}
+
 bool MacGuiImpl::runQuitDialog() {
 	Common::String quitString;
 	switch (_vm->_game.id) {
diff --git a/engines/scumm/macgui/macgui_impl.h b/engines/scumm/macgui/macgui_impl.h
index cc5f41240e0..e437ade61b8 100644
--- a/engines/scumm/macgui/macgui_impl.h
+++ b/engines/scumm/macgui/macgui_impl.h
@@ -138,6 +138,64 @@ protected:
 		kStyleRounded
 	};
 
+	byte _hardDriveIcon[16 * 16] = {
+		0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
+		0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
+		0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
+		0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
+		0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
+		0x0F, 0x00, 0x00, 0x00, 0x00, 0x00,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 0x0F, 0x0F
+	};
+
+
 	MacGuiImpl::DelayStatus delay(uint32 ms = 0);
 
 	virtual bool getFontParams(FontId fontId, int &id, int &size, int &slant) const;
@@ -156,6 +214,10 @@ protected:
 
 	virtual void readStrings() {}
 
+	// These are non interactable, no point in having them as widgets for now...
+	void drawFakePathList(MacDialogWindow *window, Common::Rect r, byte *icon, const char *text, Graphics::TextAlign alignment);
+	void drawFakeDriveLabel(MacDialogWindow *window, Common::Rect r, byte *icon, const char *text, Graphics::TextAlign alignment);
+
 public:
 	class MacGuiObject {
 	protected:
@@ -265,10 +327,16 @@ public:
 	private:
 		Color _fg = kBlack;
 		Color _bg = kWhite;
+		Graphics::TextAlign _alignment = Graphics::kTextAlignLeft;
 		bool _wordWrap = false;
 
 	public:
-		MacStaticText(MacGuiImpl::MacDialogWindow *window, Common::Rect bounds, Common::String text, bool enabled) : MacWidget(window, bounds, text, true) {}
+		MacStaticText(
+			MacGuiImpl::MacDialogWindow *window,
+			Common::Rect bounds, Common::String text,
+			bool enabled, Graphics::TextAlign alignment = Graphics::kTextAlignLeft) : MacWidget(window, bounds, text, true) {
+			_alignment = alignment;
+		}
 
 		void getFocus() {}
 		void loseFocus() {}
@@ -565,7 +633,7 @@ public:
 
 		MacGuiImpl::MacButton *addButton(Common::Rect bounds, Common::String text, bool enabled);
 		MacGuiImpl::MacCheckbox *addCheckbox(Common::Rect bounds, Common::String text, bool enabled);
-		MacGuiImpl::MacStaticText *addStaticText(Common::Rect bounds, Common::String text, bool enabled);
+		MacGuiImpl::MacStaticText *addStaticText(Common::Rect bounds, Common::String text, bool enabled, Graphics::TextAlign alignment = Graphics::kTextAlignLeft);
 		MacGuiImpl::MacEditText *addEditText(Common::Rect bounds, Common::String text, bool enabled);
 		MacGuiImpl::MacPicture *addPicture(Common::Rect bounds, int id, bool enabled);
 		MacGuiImpl::MacSlider *addSlider(int x, int y, int h, int minValue, int maxValue, int pageSize, bool enabled);
diff --git a/engines/scumm/macgui/macgui_indy3.cpp b/engines/scumm/macgui/macgui_indy3.cpp
index dc9cc5ce6ab..2cab0cb5bfb 100644
--- a/engines/scumm/macgui/macgui_indy3.cpp
+++ b/engines/scumm/macgui/macgui_indy3.cpp
@@ -1476,7 +1476,9 @@ bool MacIndy3Gui::runOpenDialog(int &saveSlotToHandle) {
 	Common::StringArray savegameNames;
 	prepareSaveLoad(savegameNames, availSlots, slotIds, ARRAYSIZE(availSlots));
 
-	MacGuiImpl::MacListBox *listBox = window->addListBox(Common::Rect(14, 41, 248, 187), savegameNames, true);
+	drawFakePathList(window, Common::Rect(14, 18, 231, 36), _folderIcon, "Indy and The Last Crusade", Graphics::kTextAlignLeft);
+
+	MacGuiImpl::MacListBox *listBox = window->addListBox(Common::Rect(14, 41, 232, 187), savegameNames, true);
 
 	// When quitting, the default action is to not open a saved game
 	bool ret = false;
@@ -1527,6 +1529,8 @@ bool MacIndy3Gui::runSaveDialog(int &saveSlotToHandle, Common::String &name) {
 	Common::StringArray savegameNames;
 	prepareSaveLoad(savegameNames, busySlots, slotIds, ARRAYSIZE(busySlots));
 
+	drawFakePathList(window, Common::Rect(16, 8, 198, 26), _folderIcon, "Indy and The Last ...", Graphics::kTextAlignLeft);
+
 	int firstAvailableSlot = -1;
 	for (int i = 0; i < ARRAYSIZE(busySlots); i++) {
 		if (!busySlots[i]) {
diff --git a/engines/scumm/macgui/macgui_loom.cpp b/engines/scumm/macgui/macgui_loom.cpp
index 5dd08e6d196..e4dc08a5f5f 100644
--- a/engines/scumm/macgui/macgui_loom.cpp
+++ b/engines/scumm/macgui/macgui_loom.cpp
@@ -609,6 +609,9 @@ bool MacLoomGui::runOpenDialog(int &saveSlotToHandle) {
 	Common::StringArray savegameNames;
 	prepareSaveLoad(savegameNames, availSlots, slotIds, ARRAYSIZE(availSlots));
 
+	drawFakePathList(window, Common::Rect(14, 8, 232, 26), _folderIcon, "Loom", Graphics::kTextAlignLeft);
+	drawFakeDriveLabel(window, Common::Rect(242, 10, 340, 28), _hardDriveIcon, "ScummVM", Graphics::kTextAlignLeft);
+
 	window->addListBox(Common::Rect(14, 31, 232, 161), savegameNames, true);
 
 	window->setDefaultWidget(0);
@@ -663,6 +666,9 @@ bool MacLoomGui::runSaveDialog(int &saveSlotToHandle, Common::String &name) {
 		}
 	}
 
+	drawFakePathList(window, Common::Rect(14, 8, 232, 26), _folderIcon, "Loom", Graphics::kTextAlignLeft);
+	drawFakeDriveLabel(window, Common::Rect(242, 10, 340, 28), _hardDriveIcon, "ScummVM", Graphics::kTextAlignLeft);
+
 	window->addListBox(Common::Rect(14, 31, 232, 129), savegameNames, true, true);
 
 	MacGuiImpl::MacEditText *editText = window->addEditText(Common::Rect(16, 159, 229, 175), gameFileResStr, true);
diff --git a/engines/scumm/macgui/macgui_widgets.cpp b/engines/scumm/macgui/macgui_widgets.cpp
index cb4ddd425f9..e4914c079d6 100644
--- a/engines/scumm/macgui/macgui_widgets.cpp
+++ b/engines/scumm/macgui/macgui_widgets.cpp
@@ -355,7 +355,7 @@ void MacGuiImpl::MacStaticText::draw(bool drawFocused) {
 	debug(1, "MacGuiImpl::MacStaticText: Drawing text %d (_fullRedraw = %d, drawFocused = %d, _value = %d)", _id, _fullRedraw, drawFocused, _value);
 
 	_window->innerSurface()->fillRect(_bounds, _bg);
-	drawText(_text, _bounds.left, _bounds.top, _bounds.width(), _fg, _bg, Graphics::kTextAlignLeft, _wordWrap, 1);
+	drawText(_text, _bounds.left, _bounds.top, _bounds.width(), _fg, _bg, _alignment, _wordWrap, 1);
 	_window->markRectAsDirty(_bounds);
 
 	_redraw = false;




More information about the Scummvm-git-logs mailing list