[Scummvm-git-logs] scummvm master -> 77204235e40f2311522b0eb52cbbc6b7a3870016

dreammaster noreply at scummvm.org
Tue Mar 14 05:48:25 UTC 2023


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:
a07f2f91d7 MM: MM1: Fix redrawing game view after closing dialogs
77204235e4 MM: MM1: Added Exchange dialog


Commit: a07f2f91d7d17f06ee0ca0eb3ef6289a8b891167
    https://github.com/scummvm/scummvm/commit/a07f2f91d7d17f06ee0ca0eb3ef6289a8b891167
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-03-13T22:48:18-07:00

Commit Message:
MM: MM1: Fix redrawing game view after closing dialogs

Changed paths:
    engines/mm/mm1/events.cpp


diff --git a/engines/mm/mm1/events.cpp b/engines/mm/mm1/events.cpp
index 92d8bd74320..f2c00a37f6c 100644
--- a/engines/mm/mm1/events.cpp
+++ b/engines/mm/mm1/events.cpp
@@ -155,6 +155,7 @@ void Events::popView() {
 	if (!_views.empty()) {
 		UIElement *view = focusedView();
 		view->msgFocus(FocusMessage(priorView));
+		view->redraw();
 		view->draw();
 	}
 }


Commit: 77204235e40f2311522b0eb52cbbc6b7a3870016
    https://github.com/scummvm/scummvm/commit/77204235e40f2311522b0eb52cbbc6b7a3870016
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-03-13T22:48:18-07:00

Commit Message:
MM: MM1: Added Exchange dialog

Changed paths:
  A engines/mm/mm1/views_enh/exchange.cpp
  A engines/mm/mm1/views_enh/exchange.h
    devtools/create_mm/files/mm1/strings_en.yml
    engines/mm/mm1/globals.cpp
    engines/mm/mm1/globals.h
    engines/mm/mm1/views_enh/character_info.cpp
    engines/mm/mm1/views_enh/dialogs.h
    engines/mm/mm1/views_enh/game.cpp
    engines/mm/module.mk


diff --git a/devtools/create_mm/files/mm1/strings_en.yml b/devtools/create_mm/files/mm1/strings_en.yml
index c39648d587f..79238d8603a 100644
--- a/devtools/create_mm/files/mm1/strings_en.yml
+++ b/devtools/create_mm/files/mm1/strings_en.yml
@@ -505,6 +505,7 @@ enhdialogs:
 		select_portrait: "Select a portrait"
 		select: "\x01""37Select"
 		enter_name: "Enter name:"
+	exchange: "Exhange with whom?"
 	inn:
 		left_click: "Left click potraits to add/remove"
 		right_click: "Right click to view"
diff --git a/engines/mm/mm1/globals.cpp b/engines/mm/mm1/globals.cpp
index 44ae7215097..4cdbbf9e4a3 100644
--- a/engines/mm/mm1/globals.cpp
+++ b/engines/mm/mm1/globals.cpp
@@ -66,6 +66,7 @@ bool Globals::load(bool isEnhanced) {
 		_confirmIcons.load("confirm.icn");
 		_globalSprites.load("global.icn");
 		_tileSprites.load("town.til");
+		_escSprites.load("esc.icn");
 
 		{
 			Common::File f;
diff --git a/engines/mm/mm1/globals.h b/engines/mm/mm1/globals.h
index 7163d8e574d..788e1da025e 100644
--- a/engines/mm/mm1/globals.h
+++ b/engines/mm/mm1/globals.h
@@ -70,6 +70,7 @@ public:
 	Shared::Xeen::SpriteResource _confirmIcons;
 	Shared::Xeen::SpriteResource _globalSprites;
 	Shared::Xeen::SpriteResource _tileSprites;
+	Shared::Xeen::SpriteResource _escSprites;
 	byte SYMBOLS[20][64];
 	XeenFont _fontNormal;
 	XeenFont _fontReduced;
diff --git a/engines/mm/mm1/views_enh/character_info.cpp b/engines/mm/mm1/views_enh/character_info.cpp
index 62420db7d98..eafce2bd115 100644
--- a/engines/mm/mm1/views_enh/character_info.cpp
+++ b/engines/mm/mm1/views_enh/character_info.cpp
@@ -130,8 +130,8 @@ bool CharacterInfo::msgKeypress(const KeypressMessage &msg) {
 		_cursorCell = EXPANDED_TO_REDUCED(idx);
 		showCursor(true);
 		break;
-	case Common::KEYCODE_RETURN:
-		showAttribute(_cursorCell);
+	case Common::KEYCODE_e:
+		addView("Exchange");
 		break;
 	default:
 		break;
@@ -141,14 +141,18 @@ bool CharacterInfo::msgKeypress(const KeypressMessage &msg) {
 }
 
 bool CharacterInfo::msgAction(const ActionMessage &msg) {
-	if (msg._action == KEYBIND_ESCAPE) {
+	switch (msg._action) {
+	case KEYBIND_ESCAPE:
 		close();
 		return true;
-	} else {
+
+	case KEYBIND_SELECT:
+		showAttribute(_cursorCell);
+		return true;
+
+	default:
 		return PartyView::msgAction(msg);
 	}
-
-	return false;
 }
 
 bool CharacterInfo::msgMouseUp(const MouseUpMessage &msg) {
diff --git a/engines/mm/mm1/views_enh/dialogs.h b/engines/mm/mm1/views_enh/dialogs.h
index ad09e3e55d7..63338061c8c 100644
--- a/engines/mm/mm1/views_enh/dialogs.h
+++ b/engines/mm/mm1/views_enh/dialogs.h
@@ -30,6 +30,7 @@
 #include "mm/mm1/views_enh/character_info.h"
 #include "mm/mm1/views_enh/character_select.h"
 #include "mm/mm1/views_enh/characters.h"
+#include "mm/mm1/views_enh/exchange.h"
 #include "mm/mm1/views_enh/game.h"
 #include "mm/mm1/views_enh/game_messages.h"
 #include "mm/mm1/views_enh/main_menu.h"
@@ -55,22 +56,23 @@ namespace ViewsEnh {
 
 struct Dialogs {
 private:
-	ViewsEnh::CreateCharacters _createCharacters;
-	Views::Protect _protect;
-	ViewsEnh::Title _title;
-	ViewsEnh::Characters _characters;
 	ViewsEnh::Interactions::Statue _statue;
 	ViewsEnh::Locations::Inn _inn;
 	ViewsEnh::Locations::Market _market;
-	ViewsEnh::Search _search;
-	ViewsEnh::Trap _trap;
-	ViewsEnh::Unlock _unlock;
-	ViewsEnh::WhoWillTry _whoWillTry;
 	ViewsEnh::Locations::Tavern _tavern;
 	ViewsEnh::Locations::Temple _temple;
 	ViewsEnh::Locations::Training _training;
 	ViewsEnh::Spells::CastSpell _castSpell;
 	ViewsEnh::Spells::Spellbook _spellbook;
+	ViewsEnh::CreateCharacters _createCharacters;
+	ViewsEnh::Exchange _exchange;
+	Views::Protect _protect;
+	ViewsEnh::Title _title;
+	ViewsEnh::Characters _characters;
+	ViewsEnh::Search _search;
+	ViewsEnh::Trap _trap;
+	ViewsEnh::Unlock _unlock;
+	ViewsEnh::WhoWillTry _whoWillTry;
 	ViewsEnh::CharacterInfo _characterInfo;
 	ViewsEnh::CharacterSelect _characterSelect;
 	ViewsEnh::Game _game;
diff --git a/engines/mm/mm1/views_enh/exchange.cpp b/engines/mm/mm1/views_enh/exchange.cpp
new file mode 100644
index 00000000000..eb93ffaec82
--- /dev/null
+++ b/engines/mm/mm1/views_enh/exchange.cpp
@@ -0,0 +1,76 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "mm/mm1/views_enh/exchange.h"
+#include "mm/mm1/globals.h"
+#include "mm/mm1/sound.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+
+Exchange::Exchange() : PartyView("Exchange") {
+	_bounds = Common::Rect(50, 112, 266, 148);
+	addButton(&g_globals->_escSprites, Common::Point(165, 0), 0, KEYBIND_ESCAPE);
+}
+
+bool Exchange::msgFocus(const FocusMessage &msg) {
+	PartyView::msgFocus(msg);
+
+	_srcCharacter = g_globals->_party.indexOf(g_globals->_currCharacter);
+	assert(_srcCharacter != -1);
+	return true;
+}
+
+void Exchange::draw() {
+	PartyView::draw();
+
+	writeString(10, 5, STRING["enhdialogs.exchange"]);
+}
+
+bool Exchange::msgAction(const ActionMessage &msg) {
+	if (msg._action == KEYBIND_ESCAPE) {
+		close();
+		return true;
+	}
+
+	return PartyView::msgAction(msg);
+}
+
+bool Exchange::msgGame(const GameMessage &msg) {
+	if (msg._name == "UPDATE") {
+		int charNum = g_globals->_party.indexOf(g_globals->_currCharacter);
+
+		if (charNum != _srcCharacter) {
+			// Swap the two characters
+			SWAP(g_globals->_party[charNum], g_globals->_party[_srcCharacter]);
+		}
+
+		close();
+		return true;
+	}
+
+	return PartyView::msgGame(msg);
+}
+
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
diff --git a/engines/mm/mm1/views_enh/exchange.h b/engines/mm/mm1/views_enh/exchange.h
new file mode 100644
index 00000000000..16f63e37294
--- /dev/null
+++ b/engines/mm/mm1/views_enh/exchange.h
@@ -0,0 +1,49 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef MM1_VIEWS_ENH_EXCHANGE_H
+#define MM1_VIEWS_ENH_EXCHANGE_H
+
+#include "mm/mm1/views_enh/party_view.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+
+class Exchange : public PartyView {
+private:
+	int _srcCharacter = -1;
+
+public:
+	Exchange();
+	virtual ~Exchange() {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	void draw() override;
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgGame(const GameMessage &msg) override;
+};
+
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
+
+#endif
diff --git a/engines/mm/mm1/views_enh/game.cpp b/engines/mm/mm1/views_enh/game.cpp
index 7082a58994c..41ca71889a5 100644
--- a/engines/mm/mm1/views_enh/game.cpp
+++ b/engines/mm/mm1/views_enh/game.cpp
@@ -71,9 +71,6 @@ bool Game::msgAction(const ActionMessage &msg) {
 	case KEYBIND_MAP:
 		addView("MapPopup");
 		return true;
-	case KEYBIND_ORDER:
-		addView("Order");
-		return true;
 	case KEYBIND_PROTECT:
 		addView("Protect");
 		return true;
@@ -92,6 +89,8 @@ bool Game::msgAction(const ActionMessage &msg) {
 	case KEYBIND_UNLOCK:
 		send("Unlock", GameMessage("SHOW"));
 		break;
+	//case KEYBIND_ORDER:
+	// Enhanced mode uses Exchange button from Char Info view
 	default:
 		break;
 	}
diff --git a/engines/mm/module.mk b/engines/mm/module.mk
index 2c5204ec6fc..bc271c64463 100644
--- a/engines/mm/module.mk
+++ b/engines/mm/module.mk
@@ -133,6 +133,7 @@ MODULE_OBJS += \
 	mm1/views_enh/characters.o \
 	mm1/views_enh/create_characters.o \
 	mm1/views_enh/dialogs.o \
+	mm1/views_enh/exchange.o \
 	mm1/views_enh/game.o \
 	mm1/views_enh/game_commands.o \
 	mm1/views_enh/game_messages.o \




More information about the Scummvm-git-logs mailing list