[Scummvm-git-logs] scummvm master -> 2e513c33f4d824a58485f9b04edffb7aafb55acd

dreammaster noreply at scummvm.org
Wed Mar 15 05:20:57 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:
2e513c33f4 MM: MM1: Added Protect screen


Commit: 2e513c33f4d824a58485f9b04edffb7aafb55acd
    https://github.com/scummvm/scummvm/commit/2e513c33f4d824a58485f9b04edffb7aafb55acd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-03-14T22:20:17-07:00

Commit Message:
MM: MM1: Added Protect screen

Changed paths:
  A engines/mm/mm1/views_enh/protect.cpp
  A engines/mm/mm1/views_enh/protect.h
    devtools/create_mm/files/mm1/strings_en.yml
    engines/mm/mm1/views/protect.cpp
    engines/mm/mm1/views_enh/dialogs.h
    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 79238d8603a..612271ddf2b 100644
--- a/devtools/create_mm/files/mm1/strings_en.yml
+++ b/devtools/create_mm/files/mm1/strings_en.yml
@@ -117,8 +117,8 @@ dialogs:
 		title: " re-order party  new  1  2  3  4  5  6"
 		old: "old"
 	protect:
-		title: "protect:  spells currently active"
-		protection: "protection from"
+		title: "Protect:  Spells currently active"
+		protection: "Protection from"
 		to_attacks: "to attacks"
 		1: "fear"
 		2: "cold"
@@ -127,17 +127,17 @@ dialogs:
 		5: "acid"
 		6: "elec"
 		7: "magic"
-		8: "light ("
-		9: "leather skin"
-		10: "levitate"
-		11: "walk on water"
-		12: "guard dog"
-		13: "psychic protection"
-		14: "bless"
-		15: "invisibility"
-		16: "shield"
-		17: "power shield"
-		18: "*** cursed -"
+		8: "Light ("
+		9: "Leather skin"
+		10: "Levitate"
+		11: "Walk on water"
+		12: "Guard dog"
+		13: "Psychic protection"
+		14: "Bless"
+		15: "Invisibility"
+		16: "Shield"
+		17: "Power shield"
+		18: "*** Cursed -"
 	quick_ref:
 		title: "#     name        hit pts   spell pts ac"
 		food: "food= "
diff --git a/engines/mm/mm1/views/protect.cpp b/engines/mm/mm1/views/protect.cpp
index a921a416727..881d667be06 100644
--- a/engines/mm/mm1/views/protect.cpp
+++ b/engines/mm/mm1/views/protect.cpp
@@ -74,8 +74,7 @@ void Protect::draw() {
 }
 
 void Protect::printProtectionFrom() {
-	if (_textPos.y == 2)
-		writeString(STRING["dialogs.protect.protection"]);
+	writeString(STRING["dialogs.protect.protection"]);
 	_textPos.x = 17;
 }
 
diff --git a/engines/mm/mm1/views_enh/dialogs.h b/engines/mm/mm1/views_enh/dialogs.h
index 63338061c8c..fe659c2becc 100644
--- a/engines/mm/mm1/views_enh/dialogs.h
+++ b/engines/mm/mm1/views_enh/dialogs.h
@@ -25,7 +25,6 @@
 #include "mm/mm1/events.h"
 #include "mm/mm1/views_enh/create_characters.h"
 #include "mm/mm1/views/locations/inn.h"
-#include "mm/mm1/views/protect.h"
 #include "mm/mm1/views/title.h"
 #include "mm/mm1/views_enh/character_info.h"
 #include "mm/mm1/views_enh/character_select.h"
@@ -35,6 +34,7 @@
 #include "mm/mm1/views_enh/game_messages.h"
 #include "mm/mm1/views_enh/main_menu.h"
 #include "mm/mm1/views_enh/map_popup.h"
+#include "mm/mm1/views_enh/protect.h"
 #include "mm/mm1/views_enh/quick_ref.h"
 #include "mm/mm1/views_enh/search.h"
 #include "mm/mm1/views_enh/title.h"
@@ -64,22 +64,22 @@ private:
 	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::Characters _characters;
+	ViewsEnh::CreateCharacters _createCharacters;
+	ViewsEnh::Exchange _exchange;
 	ViewsEnh::Game _game;
 	ViewsEnh::GameMessages _gameMessages;
 	ViewsEnh::MainMenu _mainMenu;
 	ViewsEnh::MapPopup _mapPopup;
+	ViewsEnh::Protect _protect;
 	ViewsEnh::QuickRef _quickRef;
+	ViewsEnh::Search _search;
+	ViewsEnh::Title _title;
+	ViewsEnh::Trap _trap;
+	ViewsEnh::Unlock _unlock;
+	ViewsEnh::WhoWillTry _whoWillTry;
 public:
 	Dialogs() {}
 };
diff --git a/engines/mm/mm1/views_enh/protect.cpp b/engines/mm/mm1/views_enh/protect.cpp
new file mode 100644
index 00000000000..2ba404e83bc
--- /dev/null
+++ b/engines/mm/mm1/views_enh/protect.cpp
@@ -0,0 +1,99 @@
+/* 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/protect.h"
+#include "mm/mm1/globals.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+
+Protect::Protect() : ScrollView("Protect") {
+	setBounds(Common::Rect(0, 0, 320, 200));
+	addButton(&g_globals->_escSprites, Common::Point(120, 166), 0, KEYBIND_ESCAPE);
+}
+
+void Protect::draw() {
+	ScrollView::draw();
+
+	setReduced(false);
+	writeLine(0, STRING["dialogs.protect.title"], ALIGN_MIDDLE);
+	writeString(152, 172, STRING["enhdialogs.misc.go_back"]);
+
+	setReduced(true);
+	int yp = 4;
+
+	// Protection spells
+	for (int i = 0; i < 7; ++i) {
+		g_globals->_activeSpells._arr[i] = 3;
+		if (g_globals->_activeSpells._arr[i]) {
+			Common::String line = Common::String::format("%s %s + %d%%",
+				STRING["dialogs.protect.protection"].c_str(),
+				STRING[Common::String::format("dialogs.protect.%d", i + 1)].c_str(),
+				g_globals->_activeSpells._arr[i]);
+			writeString(0, yp += 8, line, ALIGN_MIDDLE);
+		}
+	}
+
+	// Light spell
+	g_globals->_activeSpells._arr[7] = 5;
+	if (g_globals->_activeSpells._arr[7]) {
+		writeString(0, yp += 8, Common::String::format("%s%d)",
+			STRING["dialogs.protect.8"].c_str(),
+			g_globals->_activeSpells._arr[7]), ALIGN_MIDDLE);
+	}
+
+	// The rest
+	for (int i = 8; i < 18; ++i) {
+		g_globals->_activeSpells._arr[i] = 3;
+		if (i == 13)
+			yp += 8;
+
+		if (g_globals->_activeSpells._arr[i]) {
+			Common::String line = STRING[Common::String::format(
+				"dialogs.protect.%d", i + 1)];
+			if (i == 17) {
+				line += Common::String::format(" %d %s",
+					g_globals->_activeSpells._arr[17],
+					STRING["dialogs.protect.to_attacks"].c_str()
+				);
+			}
+
+			writeString(0, yp += 8, line, ALIGN_MIDDLE);
+		}
+	}
+}
+
+bool Protect::msgAction(const ActionMessage &msg) {
+	switch (msg._action) {
+	case KEYBIND_ESCAPE:
+		close();
+		return true;
+	default:
+		break;
+	}
+
+	return false;
+}
+
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
diff --git a/engines/mm/mm1/views_enh/protect.h b/engines/mm/mm1/views_enh/protect.h
new file mode 100644
index 00000000000..b0fece99726
--- /dev/null
+++ b/engines/mm/mm1/views_enh/protect.h
@@ -0,0 +1,44 @@
+/* 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_PROTECT_H
+#define MM1_VIEWS_ENH_PROTECT_H
+
+#include "mm/mm1/views_enh/scroll_view.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+
+class Protect : public ScrollView {
+public:
+	Protect();
+	virtual ~Protect() {}
+
+	void draw() override;
+	bool msgAction(const ActionMessage &msg) override;
+};
+
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
+
+#endif
diff --git a/engines/mm/module.mk b/engines/mm/module.mk
index bc271c64463..ac64870314a 100644
--- a/engines/mm/module.mk
+++ b/engines/mm/module.mk
@@ -143,6 +143,7 @@ MODULE_OBJS += \
 	mm1/views_enh/map.o \
 	mm1/views_enh/map_popup.o \
 	mm1/views_enh/party_view.o \
+	mm1/views_enh/protect.o \
 	mm1/views_enh/quick_ref.o \
 	mm1/views_enh/scroll_popup.o \
 	mm1/views_enh/scroll_text.o \




More information about the Scummvm-git-logs mailing list