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

sev- noreply at scummvm.org
Thu Oct 2 15:40:23 UTC 2025


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

Summary:
ddc3f96e33 WAGE: Move dialogs to the Gui class
bce4ff51b0 WAGE: Beginnings of custom MacDialog


Commit: ddc3f96e33be6758698950a03be15c3d41604061
    https://github.com/scummvm/scummvm/commit/ddc3f96e33be6758698950a03be15c3d41604061
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-10-02T17:39:55+02:00

Commit Message:
WAGE: Move dialogs to the Gui class

Changed paths:
    engines/wage/gui.cpp
    engines/wage/gui.h
    engines/wage/sound.cpp
    engines/wage/wage.cpp
    engines/wage/wage.h


diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 7254777c84f..e7a65b2811d 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -48,6 +48,7 @@
 #include "common/system.h"
 #include "graphics/primitives.h"
 #include "graphics/macgui/macfontmanager.h"
+#include "graphics/macgui/macdialog.h"
 #include "graphics/macgui/macwindowmanager.h"
 #include "graphics/macgui/macwindow.h"
 #include "graphics/macgui/macmenu.h"
@@ -317,7 +318,7 @@ void menuCommandsCallback(int action, Common::String &text, void *data) {
 void Gui::executeMenuCommand(int action, Common::String &text) {
 	switch(action) {
 	case kMenuActionAbout:
-		_engine->aboutDialog();
+		aboutDialog();
 		break;
 
 	case kMenuActionNew:
@@ -486,4 +487,83 @@ void Gui::enableRevert() {
 	_menu->enableCommand(kMenuFile, kMenuActionRevert, true);
 }
 
+void Gui::aboutDialog() {
+	Common::U32String messageText(_engine->_world->_aboutMessage, Common::kMacRoman);
+	Common::U32String disclaimer("\n\n\n\nThis adventure was produced with World Builder\xAA\nthe adventure game creation system.\n\xA9 Copyright 1986 by William C. Appleton, All Right Reserved\nPublished by Silicon Beach Software, Inc.", Common::kMacRoman);
+
+	_engine->sayText(_engine->_world->_aboutMessage);
+	_engine->sayText(disclaimer, Common::TextToSpeechManager::QUEUE);
+	messageText += disclaimer;
+
+	Graphics::MacFont font(Graphics::kMacFontGeneva, 9, 0);
+	Graphics::MacText aboutMessage(messageText, _wm, &font, Graphics::kColorBlack,
+											 Graphics::kColorWhite, 400, Graphics::kTextAlignCenter);
+
+	Graphics::MacDialogButtonArray buttons;
+
+	buttons.push_back(new Graphics::MacDialogButton("OK", 191, aboutMessage.getTextHeight() + 30, 68, 28));
+
+	Graphics::MacDialog about(&_screen, _wm, 450, &aboutMessage, 400, &buttons, 0);
+
+	int button = about.run();
+
+	if (button == Graphics::kMacDialogQuitRequested)
+		_engine->_shouldQuit = true;
+}
+
+void Gui::gameOver() {
+	Graphics::MacDialogButtonArray buttons;
+
+	buttons.push_back(new Graphics::MacDialogButton("OK", 66, 67, 68, 28));
+
+	Graphics::MacFont font;
+
+	Graphics::MacText gameOverMessage(*_engine->_world->_gameOverMessage, _wm, &font, Graphics::kColorBlack,
+									  Graphics::kColorWhite, 199, Graphics::kTextAlignCenter);
+
+	_engine->sayText(*_engine->_world->_gameOverMessage, Common::TextToSpeechManager::QUEUE);
+
+	Graphics::MacDialog gameOverDialog(&_screen, _wm,  199, &gameOverMessage, 199, &buttons, 0);
+
+	int button = gameOverDialog.run();
+
+	if (button == Graphics::kMacDialogQuitRequested)
+		_engine->_shouldQuit = true;
+
+	_engine->doClose();
+
+	disableAllMenus();
+	enableNewGameMenus();
+}
+
+bool Gui::saveDialog() {
+	Graphics::MacDialogButtonArray buttons;
+
+	buttons.push_back(new Graphics::MacDialogButton("No", 19, 67, 68, 28));
+	buttons.push_back(new Graphics::MacDialogButton("Yes", 112, 67, 68, 28));
+	buttons.push_back(new Graphics::MacDialogButton("Cancel", 205, 67, 68, 28));
+
+	Graphics::MacFont font;
+
+	Graphics::MacText saveBeforeCloseMessage(*_engine->_world->_saveBeforeCloseMessage, _wm, &font, Graphics::kColorBlack,
+									  Graphics::kColorWhite, 291, Graphics::kTextAlignCenter);
+
+	_engine->sayText(*_engine->_world->_saveBeforeCloseMessage);
+
+	Graphics::MacDialog save(&_screen, _wm, 291, &saveBeforeCloseMessage, 291, &buttons, 1);
+
+	int button = save.run();
+
+	if (button == Graphics::kMacDialogQuitRequested)
+		_engine->_shouldQuit = true;
+	else if (button == 2) // Cancel
+		return false;
+	else if (button == 1)
+		_engine->saveGame();
+
+	_engine->doClose();
+
+	return true;
+}
+
 } // End of namespace Wage
diff --git a/engines/wage/gui.h b/engines/wage/gui.h
index 3ffc0510d8c..b666f786439 100644
--- a/engines/wage/gui.h
+++ b/engines/wage/gui.h
@@ -143,6 +143,10 @@ public:
 
 	void clearOutput();
 
+	void gameOver();
+	bool saveDialog();
+	void aboutDialog();
+
 private:
 	void drawScene();
 	const Graphics::MacFont *getConsoleMacFont();
diff --git a/engines/wage/sound.cpp b/engines/wage/sound.cpp
index ee213abc083..91d14c41ee0 100644
--- a/engines/wage/sound.cpp
+++ b/engines/wage/sound.cpp
@@ -53,6 +53,7 @@
 
 #include "wage/wage.h"
 #include "wage/entities.h"
+#include "wage/gui.h"
 #include "wage/sound.h"
 #include "wage/world.h"
 
@@ -104,7 +105,7 @@ void WageEngine::playSound(Common::String soundName, bool blocking) {
 				if (ConfMan.hasKey("confirm_exit") && ConfMan.getBool("confirm_exit")) {
 					if (!_shouldQuit) {
 						g_system->getEventManager()->resetQuit();
-						if (saveDialog()) {
+						if (_gui->saveDialog()) {
 							_shouldQuit = true;
 							g_system->getEventManager()->pushEvent(event);
 						}
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index 3624451d2cb..86dd721b6b6 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -55,8 +55,6 @@
 #include "engines/engine.h"
 #include "engines/util.h"
 
-#include "graphics/macgui/macdialog.h"
-
 #include "wage/wage.h"
 #include "wage/debugtools.h"
 #include "wage/entities.h"
@@ -254,7 +252,7 @@ void WageEngine::processEvents() {
 				if (!_shouldQuit) {
 					g_system->getEventManager()->resetQuit();
 					g_system->getEventManager()->resetReturnToLauncher();
-					if (saveDialog()) {
+					if (_gui->saveDialog()) {
 						_shouldQuit = true;
 						g_system->getEventManager()->pushEvent(event);
 					}
@@ -325,85 +323,6 @@ void WageEngine::sayText(const Common::String &str, Common::TextToSpeechManager:
 	sayText(Common::U32String(str, Common::CodePage::kMacRoman), action);
 }
 
-void WageEngine::gameOver() {
-	Graphics::MacDialogButtonArray buttons;
-
-	buttons.push_back(new Graphics::MacDialogButton("OK", 66, 67, 68, 28));
-
-	Graphics::MacFont font;
-
-	Graphics::MacText gameOverMessage(*_world->_gameOverMessage, _gui->_wm, &font, Graphics::kColorBlack,
-									  Graphics::kColorWhite, 199, Graphics::kTextAlignCenter);
-
-	sayText(*_world->_gameOverMessage, Common::TextToSpeechManager::QUEUE);
-
-	Graphics::MacDialog gameOverDialog(&_gui->_screen, _gui->_wm,  199, &gameOverMessage, 199, &buttons, 0);
-
-	int button = gameOverDialog.run();
-
-	if (button == Graphics::kMacDialogQuitRequested)
-		_shouldQuit = true;
-
-	doClose();
-
-	_gui->disableAllMenus();
-	_gui->enableNewGameMenus();
-}
-
-bool WageEngine::saveDialog() {
-	Graphics::MacDialogButtonArray buttons;
-
-	buttons.push_back(new Graphics::MacDialogButton("No", 19, 67, 68, 28));
-	buttons.push_back(new Graphics::MacDialogButton("Yes", 112, 67, 68, 28));
-	buttons.push_back(new Graphics::MacDialogButton("Cancel", 205, 67, 68, 28));
-
-	Graphics::MacFont font;
-
-	Graphics::MacText saveBeforeCloseMessage(*_world->_saveBeforeCloseMessage, _gui->_wm, &font, Graphics::kColorBlack,
-									  Graphics::kColorWhite, 291, Graphics::kTextAlignCenter);
-
-	sayText(*_world->_saveBeforeCloseMessage);
-
-	Graphics::MacDialog save(&_gui->_screen, _gui->_wm, 291, &saveBeforeCloseMessage, 291, &buttons, 1);
-
-	int button = save.run();
-
-	if (button == Graphics::kMacDialogQuitRequested)
-		_shouldQuit = true;
-	else if (button == 2) // Cancel
-		return false;
-	else if (button == 1)
-		saveGame();
-
-	doClose();
-
-	return true;
-}
-
-void WageEngine::aboutDialog() {
-	Common::U32String messageText(_world->_aboutMessage, Common::kMacRoman);
-	Common::U32String disclaimer("\n\n\n\nThis adventure was produced with World Builder\xAA\nthe adventure game creation system.\n\xA9 Copyright 1986 by William C. Appleton, All Right Reserved\nPublished by Silicon Beach Software, Inc.", Common::kMacRoman);
-
-	sayText(_world->_aboutMessage);
-	sayText(disclaimer, Common::TextToSpeechManager::QUEUE);
-	messageText += disclaimer;
-
-	Graphics::MacFont font(Graphics::kMacFontGeneva, 9, 0);
-	Graphics::MacText aboutMessage(messageText, _gui->_wm, &font, Graphics::kColorBlack,
-											 Graphics::kColorWhite, 400, Graphics::kTextAlignCenter);
-
-	Graphics::MacDialogButtonArray buttons;
-
-	buttons.push_back(new Graphics::MacDialogButton("OK", 191, aboutMessage.getTextHeight() + 30, 68, 28));
-
-	Graphics::MacDialog about(&_gui->_screen, _gui->_wm, 450, &aboutMessage, 400, &buttons, 0);
-
-	int button = about.run();
-
-	if (button == Graphics::kMacDialogQuitRequested)
-		_shouldQuit = true;
-}
-
 void WageEngine::saveGame() {
 	if (_defaultSaveSlot != -1 && _defaultSaveSlot != getAutosaveSlot())
 		saveGameState(_defaultSaveSlot, _defaultSaveDescritpion, false);
@@ -506,7 +425,7 @@ void WageEngine::onMove(Designed *what, Designed *from, Designed *to) {
 	if (currentScene == _world->_storageScene && !_temporarilyHidden) {
 		if (!_isGameOver) {
 			_isGameOver = true;
-			gameOver();
+			_gui->gameOver();
 		}
 		return;
 	}
@@ -618,7 +537,7 @@ void WageEngine::processTurnInternal(Common::String *textInput, Designed *clickI
 		if (_world->_player->_currentScene == _world->_storageScene) {
 			if (!_isGameOver) {
 				_isGameOver = true;
-				gameOver();
+				_gui->gameOver();
 			}
 		}
 
diff --git a/engines/wage/wage.h b/engines/wage/wage.h
index d94e1a26b26..0085fc7f024 100644
--- a/engines/wage/wage.h
+++ b/engines/wage/wage.h
@@ -164,8 +164,6 @@ private:
 	bool attackHit(Chr *attacker, Chr *victim, Obj *weapon, int targetIndex);
 	void performHealingMagic(Chr *chr, Obj *magicalObject);
 
-	void doClose();
-
 public:
 	void takeObj(Obj *obj);
 
@@ -192,6 +190,8 @@ public:
 	void printPlayerCondition(Chr *player);
 	const char *getPercentMessage(double percent);
 
+	void doClose();
+
 public:
 	Common::RandomSource *_rnd;
 
@@ -226,9 +226,6 @@ public:
 	void appendText(const char *str);
 	void sayText(const Common::U32String &str, Common::TextToSpeechManager::Action action = Common::TextToSpeechManager::INTERRUPT_NO_REPEAT) const;
 	void sayText(const Common::String &str, Common::TextToSpeechManager::Action action = Common::TextToSpeechManager::INTERRUPT_NO_REPEAT) const;
-	void gameOver();
-	bool saveDialog();
-	void aboutDialog();
 	Obj *getOffer();
 	Chr *getMonster();
 	void processEvents();


Commit: bce4ff51b085b401b1277016ff984643aa739b67
    https://github.com/scummvm/scummvm/commit/bce4ff51b085b401b1277016ff984643aa739b67
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-10-02T17:39:55+02:00

Commit Message:
WAGE: Beginnings of custom MacDialog

Changed paths:
    engines/wage/gui.cpp


diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index e7a65b2811d..f54468e8e3e 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -487,6 +487,14 @@ void Gui::enableRevert() {
 	_menu->enableCommand(kMenuFile, kMenuActionRevert, true);
 }
 
+class AboutDialog : Graphics::MacDialog {
+	void paint();
+};
+
+void AboutDialog::paint() {
+	Graphics::MacDialog::paint();
+}
+
 void Gui::aboutDialog() {
 	Common::U32String messageText(_engine->_world->_aboutMessage, Common::kMacRoman);
 	Common::U32String disclaimer("\n\n\n\nThis adventure was produced with World Builder\xAA\nthe adventure game creation system.\n\xA9 Copyright 1986 by William C. Appleton, All Right Reserved\nPublished by Silicon Beach Software, Inc.", Common::kMacRoman);




More information about the Scummvm-git-logs mailing list