[Scummvm-git-logs] scummvm master -> 0655cff51471b6021801a2e7b5e6331b957b5574

dreammaster dreammaster at scummvm.org
Sun Jan 28 18:21:51 CET 2018


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

Summary:
6f05085af3 XEEN: Flesh out missing ErrorDialog code
0655cff514 XEEN: Change ErrorDialog to MessageDialog


Commit: 6f05085af3d0b720eca6a47e3407d38f842acb56
    https://github.com/scummvm/scummvm/commit/6f05085af3d0b720eca6a47e3407d38f842acb56
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-01-28T12:15:32-05:00

Commit Message:
XEEN: Flesh out missing ErrorDialog code

Changed paths:
    engines/xeen/character.cpp
    engines/xeen/dialogs_error.cpp
    engines/xeen/dialogs_error.h
    engines/xeen/locations.cpp
    engines/xeen/locations.h
    engines/xeen/party.cpp
    engines/xeen/worldofxeen/worldofxeen_menu.cpp


diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp
index b2cf11d..fb9d7e9 100644
--- a/engines/xeen/character.cpp
+++ b/engines/xeen/character.cpp
@@ -1048,7 +1048,7 @@ bool Character::noActions() {
 	case DRUNK: {
 		Common::String msg = Common::String::format(Res.IN_NO_CONDITION, _name.c_str());
 		ErrorScroll::show(Party::_vm, msg,
-			Party::_vm->_mode == 17 ? WT_2 : WT_NONFREEZED_WAIT);
+			Party::_vm->_mode == 17 ? WT_LOC_WAIT : WT_NONFREEZED_WAIT);
 		return true;
 	}
 	default:
diff --git a/engines/xeen/dialogs_error.cpp b/engines/xeen/dialogs_error.cpp
index 7582f17..954d973 100644
--- a/engines/xeen/dialogs_error.cpp
+++ b/engines/xeen/dialogs_error.cpp
@@ -49,12 +49,14 @@ void ErrorDialog::execute(const Common::String &msg, ErrorWaitType waitType) {
 
 		events.clearEvents();
 		break;
-	case WT_3:
-		if (w._enabled || _vm->_mode == MODE_17) {
-			warning("TODO: sub_26D8F");
+
+	case WT_ANIMATED_WAIT:
+		if (windows[11]._enabled || _vm->_mode == MODE_17) {
+			g_vm->_locations->wait();
 			break;
 		}
 		// fall through
+
 	case WT_NONFREEZED_WAIT:
 		do {
 			events.updateGameCounter();
@@ -65,9 +67,11 @@ void ErrorDialog::execute(const Common::String &msg, ErrorWaitType waitType) {
 				break;
 		} while (!_vm->shouldQuit() && !_buttonValue);
 		break;
-	case WT_2:
-		warning("TODO: sub_26D8F");
+
+	case WT_LOC_WAIT:
+		g_vm->_locations->wait();
 		break;
+
 	default:
 		break;
 	}
diff --git a/engines/xeen/dialogs_error.h b/engines/xeen/dialogs_error.h
index 3657cd0..577b7d7 100644
--- a/engines/xeen/dialogs_error.h
+++ b/engines/xeen/dialogs_error.h
@@ -29,7 +29,7 @@
 namespace Xeen {
 
 enum ErrorWaitType { WT_FREEZE_WAIT = 0, WT_NONFREEZED_WAIT = 1,
-	WT_2 = 2, WT_3 = 3 };
+	WT_LOC_WAIT = 2, WT_ANIMATED_WAIT = 3 };
 
 class ErrorDialog : public ButtonContainer {
 private:
diff --git a/engines/xeen/locations.cpp b/engines/xeen/locations.cpp
index dbfd437..7a7fede 100644
--- a/engines/xeen/locations.cpp
+++ b/engines/xeen/locations.cpp
@@ -385,14 +385,14 @@ void BankLocation::depositWithdrawl(PartyBank whereId) {
 			(whereId == WHERE_BANK && !party._bankGold && consType == CONS_GOLD) ||
 			(whereId == WHERE_PARTY && !party._gems && consType == CONS_GEMS) ||
 			(whereId == WHERE_PARTY && !party._gold && consType == CONS_GOLD)) {
-			party.notEnough(consType, whereId, WHERE_BANK, WT_2);
+			party.notEnough(consType, whereId, WHERE_BANK, WT_LOC_WAIT);
 		} else {
 			windows[35].writeString(Res.AMOUNT);
 			int amount = NumericInput::show(_vm, 35, 10, 77);
 
 			if (amount) {
 				if (consType == CONS_GEMS) {
-					if (party.subtract(CONS_GEMS, amount, whereId, WT_2)) {
+					if (party.subtract(CONS_GEMS, amount, whereId, WT_LOC_WAIT)) {
 						if (whereId == WHERE_BANK) {
 							party._gems += amount;
 						} else {
@@ -400,7 +400,7 @@ void BankLocation::depositWithdrawl(PartyBank whereId) {
 						}
 					}
 				} else {
-					if (party.subtract(CONS_GOLD, amount, whereId, WT_2)) {
+					if (party.subtract(CONS_GOLD, amount, whereId, WT_LOC_WAIT)) {
 						if (whereId == WHERE_BANK) {
 							party._gold += amount;
 						} else {
@@ -587,7 +587,7 @@ Character *TavernLocation::doOptions(Character *c) {
 	case Common::KEYCODE_d:
 		// Drink
 		if (!c->noActions()) {
-			if (party.subtract(CONS_GOLD, 1, WHERE_PARTY, WT_2)) {
+			if (party.subtract(CONS_GOLD, 1, WHERE_PARTY, WT_LOC_WAIT)) {
 				sound.stopSound();
 				sound.playSound("gulp.voc");
 				_v21 = 1;
@@ -645,8 +645,8 @@ Character *TavernLocation::doOptions(Character *c) {
 
 		if (YesNo::show(_vm, false, true)) {
 			if (party._food >= _v22) {
-				ErrorScroll::show(_vm, Res.FOOD_PACKS_FULL, WT_2);
-			} else if (party.subtract(CONS_GOLD, _v23, WHERE_PARTY, WT_2)) {
+				ErrorScroll::show(_vm, Res.FOOD_PACKS_FULL, WT_LOC_WAIT);
+			} else if (party.subtract(CONS_GOLD, _v23, WHERE_PARTY, WT_LOC_WAIT)) {
 				party._food = _v22;
 				sound.stopSound();
 				sound.playSound(_isDarkCc ? "thanks2.voc" : "thankyou.voc", 1);
@@ -733,7 +733,7 @@ Character *TavernLocation::doOptions(Character *c) {
 					drawButtons(&windows[0]);
 					windows[10].update();
 					wait();
-				} else if (party.subtract(CONS_GOLD, 1, WHERE_PARTY, WT_2)) {
+				} else if (party.subtract(CONS_GOLD, 1, WHERE_PARTY, WT_LOC_WAIT)) {
 					sound.stopSound();
 					sound.playSound(_isDarkCc ? "thanks2.voc" : "thankyou.voc", 1);
 
@@ -893,7 +893,7 @@ Character *TempleLocation::doOptions(Character *c) {
 		break;
 
 	case Common::KEYCODE_d:
-		if (_donation && party.subtract(CONS_GOLD, _donation, WHERE_PARTY, WT_2)) {
+		if (_donation && party.subtract(CONS_GOLD, _donation, WHERE_PARTY, WT_LOC_WAIT)) {
 			sound.stopSound();
 			sound.playSound("coina.voc", 1);
 			_dayOfWeek = (_dayOfWeek + 1) / 10;
@@ -918,7 +918,7 @@ Character *TempleLocation::doOptions(Character *c) {
 		break;
 
 	case Common::KEYCODE_h:
-		if (_healCost && party.subtract(CONS_GOLD, _healCost, WHERE_PARTY, WT_2)) {
+		if (_healCost && party.subtract(CONS_GOLD, _healCost, WHERE_PARTY, WT_LOC_WAIT)) {
 			c->_magicResistence._temporary = 0;
 			c->_energyResistence._temporary = 0;
 			c->_poisonResistence._temporary = 0;
@@ -945,7 +945,7 @@ Character *TempleLocation::doOptions(Character *c) {
 		break;
 
 	case Common::KEYCODE_u:
-		if (_uncurseCost && party.subtract(CONS_GOLD, _uncurseCost, WHERE_PARTY, WT_2)) {
+		if (_uncurseCost && party.subtract(CONS_GOLD, _uncurseCost, WHERE_PARTY, WT_LOC_WAIT)) {
 			for (int idx = 0; idx < 9; ++idx) {
 				c->_weapons[idx]._bonusFlags &= ~ITEMFLAG_CURSED;
 				c->_armor[idx]._bonusFlags &= ~ITEMFLAG_CURSED;
@@ -1078,7 +1078,7 @@ Character *TrainingLocation::doOptions(Character *c) {
 			sound.playSound(name);
 
 		} else if (!c->noActions()) {
-			if (party.subtract(CONS_GOLD, (c->_level._permanent * c->_level._permanent) * 10, WHERE_PARTY, WT_2)) {
+			if (party.subtract(CONS_GOLD, (c->_level._permanent * c->_level._permanent) * 10, WHERE_PARTY, WT_LOC_WAIT)) {
 				_drawFrameIndex = 0;
 				sound.stopSound();
 				sound.playSound(_isDarkCc ? "prtygd.voc" : "trainin2.voc", 1);
@@ -2352,6 +2352,10 @@ void LocationManager::drawAnim(bool flag) {
 		_location->drawAnim(flag);
 }
 
+int LocationManager::wait() {
+	return _location ? _location->wait() : 0;
+}
+
 /*------------------------------------------------------------------------*/
 
 bool LocationMessage::show(int portrait, const Common::String &name,
diff --git a/engines/xeen/locations.h b/engines/xeen/locations.h
index 7331760..2df4b92 100644
--- a/engines/xeen/locations.h
+++ b/engines/xeen/locations.h
@@ -62,11 +62,6 @@ protected:
 	void drawWindow();
 
 	/**
-	 * Waits for a brief pause, checking for any key or mouse events
-	 */
-	int wait();
-
-	/**
 	 * Generates the display text for the location, for a given character
 	 */
 	virtual Common::String createLocationText(Character &ch) { return ""; }
@@ -98,6 +93,11 @@ public:
 	 * Draws the animated parts
 	 */
 	void drawAnim(bool flag);
+
+	/**
+	 * Waits for a brief pause, checking for any key or mouse events
+	 */
+	int wait();
 };
 
 class BankLocation : public BaseLocation {
@@ -368,19 +368,24 @@ public:
 	LocationManager();
 
 	/**
-	* Show a given location, and return any result
-	*/
+	 * Show a given location, and return any result
+	 */
 	int doAction(LocationAction actionId);
 
 	/**
-	* Returns true if a town location (bank, blacksmith, etc.) is currently active
-	*/
+	 * Returns true if a town location (bank, blacksmith, etc.) is currently active
+	 */
 	bool isActive() const;
 
 	/**
-	* Draws a currently active town location's animation
-	*/
+	 * Draws a currently active town location's animation
+	 */
 	void drawAnim(bool flag);
+
+	/**
+	 * Calls the waiting for any currently active town location
+	 */
+	int wait();
 };
 
 } // End of namespace Xeen
diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp
index f6bd5ca..8f6e6d3 100644
--- a/engines/xeen/party.cpp
+++ b/engines/xeen/party.cpp
@@ -869,11 +869,11 @@ bool Party::giveTake(int takeMode, uint takeVal, int giveMode, uint giveVal, int
 		changeTime(takeVal);
 		break;
 	case 34:
-		if (!subtract(CONS_GOLD, takeVal, WHERE_PARTY, WT_3))
+		if (!subtract(CONS_GOLD, takeVal, WHERE_PARTY, WT_ANIMATED_WAIT))
 			return true;
 		break;
 	case 35:
-		if (!subtract(CONS_GEMS, takeVal, WHERE_PARTY, WT_3))
+		if (!subtract(CONS_GEMS, takeVal, WHERE_PARTY, WT_ANIMATED_WAIT))
 			return true;
 		break;
 	case 37:
@@ -958,7 +958,7 @@ bool Party::giveTake(int takeMode, uint takeVal, int giveMode, uint giveVal, int
 		ps._level._permanent -= takeVal;
 		break;
 	case 65:
-		if (!subtract(CONS_FOOD, takeVal, WHERE_PARTY, WT_3))
+		if (!subtract(CONS_FOOD, takeVal, WHERE_PARTY, WT_ANIMATED_WAIT))
 			return true;
 		break;
 	case 69:
diff --git a/engines/xeen/worldofxeen/worldofxeen_menu.cpp b/engines/xeen/worldofxeen/worldofxeen_menu.cpp
index 5b08c1a..90d3629 100644
--- a/engines/xeen/worldofxeen/worldofxeen_menu.cpp
+++ b/engines/xeen/worldofxeen/worldofxeen_menu.cpp
@@ -73,7 +73,6 @@ void WorldOfXeenMenu::execute() {
 			firstTime = false;
 			events.setCursor(0);
 			events.showCursor();
-			warning("TODO: Read existing save file");
 		}
 
 		showTitles1(title1Sprites);


Commit: 0655cff51471b6021801a2e7b5e6331b957b5574
    https://github.com/scummvm/scummvm/commit/0655cff51471b6021801a2e7b5e6331b957b5574
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-01-28T12:21:44-05:00

Commit Message:
XEEN: Change ErrorDialog to MessageDialog

Changed paths:
  A engines/xeen/dialogs_message.cpp
  A engines/xeen/dialogs_message.h
  R engines/xeen/dialogs_error.cpp
  R engines/xeen/dialogs_error.h
    engines/xeen/character.cpp
    engines/xeen/interface.cpp
    engines/xeen/interface_scene.cpp
    engines/xeen/locations.h
    engines/xeen/module.mk
    engines/xeen/party.cpp
    engines/xeen/party.h


diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp
index fb9d7e9..456e124 100644
--- a/engines/xeen/character.cpp
+++ b/engines/xeen/character.cpp
@@ -22,7 +22,7 @@
 
 #include "xeen/character.h"
 #include "xeen/dialogs_query.h"
-#include "xeen/dialogs_error.h"
+#include "xeen/dialogs_message.h"
 #include "xeen/resources.h"
 #include "xeen/xeen.h"
 
@@ -215,10 +215,10 @@ void InventoryItems::equipError(int itemIndex1, ItemCategory category1, int item
 		Common::String itemName1 = _character->_items[category1].getName(itemIndex1);
 		Common::String itemName2 = _character->_items[category2].getName(itemIndex2);
 
-		ErrorDialog::show(vm, Common::String::format(Res.REMOVE_X_TO_EQUIP_Y,
+		MessageDialog::show(vm, Common::String::format(Res.REMOVE_X_TO_EQUIP_Y,
 			itemName1.c_str(), itemName2.c_str()));
 	} else {
-		ErrorDialog::show(vm, Common::String::format(Res.EQUIPPED_ALL_YOU_CAN,
+		MessageDialog::show(vm, Common::String::format(Res.EQUIPPED_ALL_YOU_CAN,
 			(itemIndex1 == -1) ? Res.RING : Res.MEDAL));
 	}
 }
diff --git a/engines/xeen/dialogs_error.cpp b/engines/xeen/dialogs_error.cpp
deleted file mode 100644
index 954d973..0000000
--- a/engines/xeen/dialogs_error.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "common/scummsys.h"
-#include "xeen/dialogs_error.h"
-#include "xeen/events.h"
-#include "xeen/xeen.h"
-
-namespace Xeen {
-
-void ErrorDialog::show(XeenEngine *vm, const Common::String &msg, ErrorWaitType waitType) {
-	ErrorDialog *dlg = new ErrorDialog(vm);
-	dlg->execute(msg, waitType);
-	delete dlg;
-}
-
-void ErrorDialog::execute(const Common::String &msg, ErrorWaitType waitType) {
-	EventsManager &events = *_vm->_events;
-	Windows &windows = *_vm->_windows;
-	Window &w = windows[6];
-
-	w.open();
-	w.writeString(msg);
-	w.update();
-
-	switch (waitType) {
-	case WT_FREEZE_WAIT:
-		while (!_vm->shouldQuit() && !events.isKeyMousePressed())
-			events.pollEventsAndWait();
-
-		events.clearEvents();
-		break;
-
-	case WT_ANIMATED_WAIT:
-		if (windows[11]._enabled || _vm->_mode == MODE_17) {
-			g_vm->_locations->wait();
-			break;
-		}
-		// fall through
-
-	case WT_NONFREEZED_WAIT:
-		do {
-			events.updateGameCounter();
-			_vm->_interface->draw3d(true);
-
-			events.wait(1);
-			if (checkEvents(_vm))
-				break;
-		} while (!_vm->shouldQuit() && !_buttonValue);
-		break;
-
-	case WT_LOC_WAIT:
-		g_vm->_locations->wait();
-		break;
-
-	default:
-		break;
-	}
-
-	w.close();
-}
-
-/*------------------------------------------------------------------------*/
-
-void ErrorScroll::show(XeenEngine *vm, const Common::String &msg, ErrorWaitType waitType) {
-	Common::String s = Common::String::format("\x3""c\v010\t000%s", msg.c_str());
-	ErrorDialog::show(vm, s, waitType);
-}
-
-/*------------------------------------------------------------------------*/
-
-void CantCast::show(XeenEngine *vm, int spellId, int componentNum) {
-	CantCast *dlg = new CantCast(vm);
-	dlg->execute(spellId, componentNum);
-	delete dlg;
-}
-
-void CantCast::execute(int spellId, int componentNum) {
-	EventsManager &events = *_vm->_events;
-	Sound &sound = *_vm->_sound;
-	Spells &spells = *_vm->_spells;
-	Windows &windows = *_vm->_windows;
-	Window &w = windows[6];
-	Mode oldMode = _vm->_mode;
-	_vm->_mode = MODE_FF;
-
-	sound.playFX(21);
-	w.open();
-	w.writeString(Common::String::format(Res.NOT_ENOUGH_TO_CAST,
-		Res.SPELL_CAST_COMPONENTS[componentNum - 1],
-		spells._spellNames[spellId].c_str()
-	));
-	w.update();
-
-	do {
-		events.pollEventsAndWait();
-	} while (!_vm->shouldQuit() && !events.isKeyMousePressed());
-	events.clearEvents();
-
-	w.close();
-	_vm->_mode = oldMode;
-}
-
-} // End of namespace Xeen
diff --git a/engines/xeen/dialogs_error.h b/engines/xeen/dialogs_error.h
deleted file mode 100644
index 577b7d7..0000000
--- a/engines/xeen/dialogs_error.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef XEEN_DIALOGS_ERROR_H
-#define XEEN_DIALOGS_ERROR_H
-
-#include "xeen/dialogs.h"
-#include "xeen/character.h"
-
-namespace Xeen {
-
-enum ErrorWaitType { WT_FREEZE_WAIT = 0, WT_NONFREEZED_WAIT = 1,
-	WT_LOC_WAIT = 2, WT_ANIMATED_WAIT = 3 };
-
-class ErrorDialog : public ButtonContainer {
-private:
-	ErrorDialog(XeenEngine *vm) : ButtonContainer(vm) {}
-
-	void execute(const Common::String &msg, ErrorWaitType waitType);
-public:
-	static void show(XeenEngine *vm, const Common::String &msg,
-		ErrorWaitType waitType = WT_FREEZE_WAIT);
-};
-
-class ErrorScroll {
-public:
-	static void show(XeenEngine *vm, const Common::String &msg,
-		ErrorWaitType waitType = WT_FREEZE_WAIT);
-};
-
-class CantCast: public ButtonContainer {
-private:
-	CantCast(XeenEngine *vm) : ButtonContainer(vm) {}
-
-	void execute(int spellId, int componentNum);
-public:
-	static void show(XeenEngine *vm, int spellId, int componentNum);
-};
-
-} // End of namespace Xeen
-
-#endif /* XEEN_DIALOGS_ERROR_H */
diff --git a/engines/xeen/dialogs_message.cpp b/engines/xeen/dialogs_message.cpp
new file mode 100644
index 0000000..0396802
--- /dev/null
+++ b/engines/xeen/dialogs_message.cpp
@@ -0,0 +1,123 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/scummsys.h"
+#include "xeen/dialogs_message.h"
+#include "xeen/events.h"
+#include "xeen/xeen.h"
+
+namespace Xeen {
+
+void MessageDialog::show(XeenEngine *vm, const Common::String &msg, MessageWaitType waitType) {
+	MessageDialog *dlg = new MessageDialog(vm);
+	dlg->execute(msg, waitType);
+	delete dlg;
+}
+
+void MessageDialog::execute(const Common::String &msg, MessageWaitType waitType) {
+	EventsManager &events = *_vm->_events;
+	Windows &windows = *_vm->_windows;
+	Window &w = windows[6];
+
+	w.open();
+	w.writeString(msg);
+	w.update();
+
+	switch (waitType) {
+	case WT_FREEZE_WAIT:
+		while (!_vm->shouldQuit() && !events.isKeyMousePressed())
+			events.pollEventsAndWait();
+
+		events.clearEvents();
+		break;
+
+	case WT_ANIMATED_WAIT:
+		if (windows[11]._enabled || _vm->_mode == MODE_17) {
+			g_vm->_locations->wait();
+			break;
+		}
+		// fall through
+
+	case WT_NONFREEZED_WAIT:
+		do {
+			events.updateGameCounter();
+			_vm->_interface->draw3d(true);
+
+			events.wait(1);
+			if (checkEvents(_vm))
+				break;
+		} while (!_vm->shouldQuit() && !_buttonValue);
+		break;
+
+	case WT_LOC_WAIT:
+		g_vm->_locations->wait();
+		break;
+
+	default:
+		break;
+	}
+
+	w.close();
+}
+
+/*------------------------------------------------------------------------*/
+
+void ErrorScroll::show(XeenEngine *vm, const Common::String &msg, MessageWaitType waitType) {
+	Common::String s = Common::String::format("\x3""c\v010\t000%s", msg.c_str());
+	MessageDialog::show(vm, s, waitType);
+}
+
+/*------------------------------------------------------------------------*/
+
+void CantCast::show(XeenEngine *vm, int spellId, int componentNum) {
+	CantCast *dlg = new CantCast(vm);
+	dlg->execute(spellId, componentNum);
+	delete dlg;
+}
+
+void CantCast::execute(int spellId, int componentNum) {
+	EventsManager &events = *_vm->_events;
+	Sound &sound = *_vm->_sound;
+	Spells &spells = *_vm->_spells;
+	Windows &windows = *_vm->_windows;
+	Window &w = windows[6];
+	Mode oldMode = _vm->_mode;
+	_vm->_mode = MODE_FF;
+
+	sound.playFX(21);
+	w.open();
+	w.writeString(Common::String::format(Res.NOT_ENOUGH_TO_CAST,
+		Res.SPELL_CAST_COMPONENTS[componentNum - 1],
+		spells._spellNames[spellId].c_str()
+	));
+	w.update();
+
+	do {
+		events.pollEventsAndWait();
+	} while (!_vm->shouldQuit() && !events.isKeyMousePressed());
+	events.clearEvents();
+
+	w.close();
+	_vm->_mode = oldMode;
+}
+
+} // End of namespace Xeen
diff --git a/engines/xeen/dialogs_message.h b/engines/xeen/dialogs_message.h
new file mode 100644
index 0000000..e092b30
--- /dev/null
+++ b/engines/xeen/dialogs_message.h
@@ -0,0 +1,61 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef XEEN_dialogs_message_H
+#define XEEN_dialogs_message_H
+
+#include "xeen/dialogs.h"
+#include "xeen/character.h"
+
+namespace Xeen {
+
+enum MessageWaitType { WT_FREEZE_WAIT = 0, WT_NONFREEZED_WAIT = 1,
+	WT_LOC_WAIT = 2, WT_ANIMATED_WAIT = 3 };
+
+class MessageDialog : public ButtonContainer {
+private:
+	MessageDialog(XeenEngine *vm) : ButtonContainer(vm) {}
+
+	void execute(const Common::String &msg, MessageWaitType waitType);
+public:
+	static void show(XeenEngine *vm, const Common::String &msg,
+		MessageWaitType waitType = WT_FREEZE_WAIT);
+};
+
+class ErrorScroll {
+public:
+	static void show(XeenEngine *vm, const Common::String &msg,
+		MessageWaitType waitType = WT_FREEZE_WAIT);
+};
+
+class CantCast: public ButtonContainer {
+private:
+	CantCast(XeenEngine *vm) : ButtonContainer(vm) {}
+
+	void execute(int spellId, int componentNum);
+public:
+	static void show(XeenEngine *vm, int spellId, int componentNum);
+};
+
+} // End of namespace Xeen
+
+#endif /* XEEN_dialogs_message_H */
diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp
index c31097e..456a787 100644
--- a/engines/xeen/interface.cpp
+++ b/engines/xeen/interface.cpp
@@ -23,7 +23,7 @@
 #include "xeen/interface.h"
 #include "xeen/dialogs_char_info.h"
 #include "xeen/dialogs_control_panel.h"
-#include "xeen/dialogs_error.h"
+#include "xeen/dialogs_message.h"
 #include "xeen/dialogs_fight_options.h"
 #include "xeen/dialogs_info.h"
 #include "xeen/dialogs_items.h"
diff --git a/engines/xeen/interface_scene.cpp b/engines/xeen/interface_scene.cpp
index 4201501..d937dce 100644
--- a/engines/xeen/interface_scene.cpp
+++ b/engines/xeen/interface_scene.cpp
@@ -21,7 +21,7 @@
  */
 
 #include "xeen/interface_scene.h"
-#include "xeen/dialogs_error.h"
+#include "xeen/dialogs_message.h"
 #include "xeen/resources.h"
 #include "xeen/xeen.h"
 
diff --git a/engines/xeen/locations.h b/engines/xeen/locations.h
index 2df4b92..6086085 100644
--- a/engines/xeen/locations.h
+++ b/engines/xeen/locations.h
@@ -26,7 +26,7 @@
 #include "common/scummsys.h"
 #include "common/str-array.h"
 #include "xeen/dialogs.h"
-#include "xeen/dialogs_error.h"
+#include "xeen/dialogs_message.h"
 #include "xeen/party.h"
 
 namespace Xeen {
diff --git a/engines/xeen/module.mk b/engines/xeen/module.mk
index 2e11e19..36a6bd9 100644
--- a/engines/xeen/module.mk
+++ b/engines/xeen/module.mk
@@ -16,13 +16,13 @@ MODULE_OBJS := \
 	dialogs_char_info.o \
 	dialogs_control_panel.o \
 	dialogs_dismiss.o \
-	dialogs_error.o \
 	dialogs_exchange.o \
 	dialogs_fight_options.o \
 	dialogs_info.o \
 	dialogs_input.o \
 	dialogs_items.o \
 	dialogs_map.o \
+	dialogs_message.o \
 	dialogs_party.o \
 	dialogs_query.o \
 	dialogs_quests.o \
diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp
index 8f6e6d3..15e7a21 100644
--- a/engines/xeen/party.cpp
+++ b/engines/xeen/party.cpp
@@ -23,7 +23,7 @@
 #include "common/scummsys.h"
 #include "common/algorithm.h"
 #include "xeen/party.h"
-#include "xeen/dialogs_error.h"
+#include "xeen/dialogs_message.h"
 #include "xeen/dialogs_input.h"
 #include "xeen/files.h"
 #include "xeen/resources.h"
@@ -480,7 +480,7 @@ void Party::handleLight() {
 		(map.mazeData()._mazeFlags2 & FLAG_IS_DARK) == 0 ? OBSCURITY_NONE : OBSCURITY_BLACK;
 }
 
-int Party::subtract(ConsumableType consumableId, uint amount, PartyBank whereId, ErrorWaitType wait) {
+int Party::subtract(ConsumableType consumableId, uint amount, PartyBank whereId, MessageWaitType wait) {
 	switch (consumableId) {
 	case CONS_GOLD:
 		// Gold
@@ -537,7 +537,7 @@ int Party::subtract(ConsumableType consumableId, uint amount, PartyBank whereId,
 	return true;
 }
 
-void Party::notEnough(ConsumableType consumableId, PartyBank whereId, bool mode, ErrorWaitType wait) {
+void Party::notEnough(ConsumableType consumableId, PartyBank whereId, bool mode, MessageWaitType wait) {
 	assert(consumableId < 4 && whereId < 2);
 	Common::String msg = Common::String::format(
 		mode ? Res.NO_X_IN_THE_Y : Res.NOT_ENOUGH_X_IN_THE_Y,
diff --git a/engines/xeen/party.h b/engines/xeen/party.h
index 9262417..ce2a999 100644
--- a/engines/xeen/party.h
+++ b/engines/xeen/party.h
@@ -29,7 +29,7 @@
 #include "common/serializer.h"
 #include "xeen/character.h"
 #include "xeen/combat.h"
-#include "xeen/dialogs_error.h"
+#include "xeen/dialogs_message.h"
 
 namespace Xeen {
 
@@ -198,9 +198,9 @@ public:
 
 	void handleLight();
 
-	int subtract(ConsumableType consumableId, uint amount, PartyBank whereId, ErrorWaitType wait = WT_FREEZE_WAIT);
+	int subtract(ConsumableType consumableId, uint amount, PartyBank whereId, MessageWaitType wait = WT_FREEZE_WAIT);
 
-	void notEnough(ConsumableType consumableId, PartyBank whereId, bool mode, ErrorWaitType wait);
+	void notEnough(ConsumableType consumableId, PartyBank whereId, bool mode, MessageWaitType wait);
 
 	void checkPartyDead();
 





More information about the Scummvm-git-logs mailing list