[Scummvm-git-logs] scummvm master -> b1ccb1695d1511dd7534db978171ddd6d1521e25
dreammaster
noreply at scummvm.org
Sat Jun 3 23:56:05 UTC 2023
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
56a99dc79f MM: MM1: Refresh display after equipping/removing items
94cd53cac2 MM: MM1: Implement item discarding
b1ccb1695d MM: MM1: Added Detect Magic view
Commit: 56a99dc79f24cc5b46aa509a80c33f94c60db2c5
https://github.com/scummvm/scummvm/commit/56a99dc79f24cc5b46aa509a80c33f94c60db2c5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-06-03T16:55:59-07:00
Commit Message:
MM: MM1: Refresh display after equipping/removing items
Changed paths:
engines/mm/mm1/views/character_info.cpp
diff --git a/engines/mm/mm1/views/character_info.cpp b/engines/mm/mm1/views/character_info.cpp
index 216d01bc69c..706c97586d3 100644
--- a/engines/mm/mm1/views/character_info.cpp
+++ b/engines/mm/mm1/views/character_info.cpp
@@ -171,12 +171,14 @@ bool CharacterInfo::msgKeypress(const KeypressMessage &msg) {
if (msg.keycode >= Common::KEYCODE_a &&
msg.keycode <= Common::KEYCODE_f)
equipItem(msg.keycode - Common::KEYCODE_a);
+ redraw();
break;
case REMOVE:
if (msg.keycode >= Common::KEYCODE_1 &&
msg.keycode <= Common::KEYCODE_6)
removeItem(msg.keycode - Common::KEYCODE_1);
+ redraw();
break;
case SHARE:
Commit: 94cd53cac2fe36e663d068fd48b7160151f05578
https://github.com/scummvm/scummvm/commit/94cd53cac2fe36e663d068fd48b7160151f05578
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-06-03T16:55:59-07:00
Commit Message:
MM: MM1: Implement item discarding
Changed paths:
devtools/create_mm/files/mm1/strings_en.yml
engines/mm/mm1/views/character_info.cpp
engines/mm/mm1/views/character_info.h
diff --git a/devtools/create_mm/files/mm1/strings_en.yml b/devtools/create_mm/files/mm1/strings_en.yml
index 77dee261f86..766edfaf47a 100644
--- a/devtools/create_mm/files/mm1/strings_en.yml
+++ b/devtools/create_mm/files/mm1/strings_en.yml
@@ -25,6 +25,7 @@ dialogs:
legend2: " # view other 'd' discard 's' share"
legend3: " 'e' equip 't' trade"
legend4: "'esc' to go back 'g' gather 'u' use"
+ discard: "discard which item: 'a'-'f'?"
equip: "equip which item: 'a'-'f'?"
remove: "remove which item: '1'-'6'?"
which: "which item: 'a'-'f'?"
diff --git a/engines/mm/mm1/views/character_info.cpp b/engines/mm/mm1/views/character_info.cpp
index 706c97586d3..cb4df042606 100644
--- a/engines/mm/mm1/views/character_info.cpp
+++ b/engines/mm/mm1/views/character_info.cpp
@@ -47,6 +47,11 @@ void CharacterInfo::draw() {
writeString(0, 24, STRING["dialogs.character.legend4"]);
break;
+ case DISCARD:
+ writeString(0, 20, STRING["dialogs.character.discard"]);
+ escToGoBack(0);
+ break;
+
case EQUIP:
writeString(0, 20, STRING["dialogs.character.equip"]);
escToGoBack(0);
@@ -133,6 +138,11 @@ bool CharacterInfo::msgKeypress(const KeypressMessage &msg) {
case Common::KEYCODE_c:
send("CastSpell", GameMessage("SPELL", 0));
break;
+ case Common::KEYCODE_d:
+ if (!g_globals->_currCharacter->_backpack.empty())
+ _state = DISCARD;
+ redraw();
+ break;
case Common::KEYCODE_e:
if (!g_globals->_currCharacter->_backpack.empty())
_state = EQUIP;
@@ -167,6 +177,13 @@ bool CharacterInfo::msgKeypress(const KeypressMessage &msg) {
}
break;
+ case DISCARD:
+ if (msg.keycode >= Common::KEYCODE_a &&
+ msg.keycode <= Common::KEYCODE_f)
+ discardItem(msg.keycode - Common::KEYCODE_a);
+ redraw();
+ break;
+
case EQUIP:
if (msg.keycode >= Common::KEYCODE_a &&
msg.keycode <= Common::KEYCODE_f)
@@ -305,6 +322,13 @@ bool CharacterInfo::msgGame(const GameMessage &msg) {
return false;
}
+void CharacterInfo::discardItem(uint index) {
+ Inventory &inv = g_globals->_currCharacter->_backpack;
+ if (index < inv.size())
+ inv.removeAt(index);
+ _state = DISPLAY;
+}
+
void CharacterInfo::equipItem(uint index) {
Common::String errMsg;
_state = DISPLAY;
diff --git a/engines/mm/mm1/views/character_info.h b/engines/mm/mm1/views/character_info.h
index 2a19856b67a..3c77dcc1e5a 100644
--- a/engines/mm/mm1/views/character_info.h
+++ b/engines/mm/mm1/views/character_info.h
@@ -41,7 +41,7 @@ class CharacterInfo : public CharacterBase, MM1::Game::EquipRemove,
public MM1::Game::UseItem {
private:
enum ViewState {
- DISPLAY, EQUIP, GATHER, REMOVE, SHARE,
+ DISPLAY, DISCARD, EQUIP, GATHER, REMOVE, SHARE,
TRADE_WITH, TRADE_KIND, TRADE_ITEM, USE };
ViewState _state = DISPLAY;
Common::String _newName;
@@ -50,6 +50,11 @@ private:
TransferKind _tradeKind = TK_GEMS;
TextEntry _textEntry;
private:
+ /**
+ * Discards the item at the given index
+ */
+ void discardItem(uint index);
+
/**
* Equips the item at the given index
*/
Commit: b1ccb1695d1511dd7534db978171ddd6d1521e25
https://github.com/scummvm/scummvm/commit/b1ccb1695d1511dd7534db978171ddd6d1521e25
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-06-03T16:55:59-07:00
Commit Message:
MM: MM1: Added Detect Magic view
Changed paths:
A engines/mm/mm1/views_enh/spells/detect_magic.cpp
A engines/mm/mm1/views_enh/spells/detect_magic.h
engines/mm/mm1/views_enh/dialogs.h
engines/mm/module.mk
diff --git a/engines/mm/mm1/views_enh/dialogs.h b/engines/mm/mm1/views_enh/dialogs.h
index 45e67c168a8..736e55a4a50 100644
--- a/engines/mm/mm1/views_enh/dialogs.h
+++ b/engines/mm/mm1/views_enh/dialogs.h
@@ -87,6 +87,7 @@
#include "mm/mm1/views_enh/locations/training.h"
#include "mm/mm1/views_enh/spells/cast_spell.h"
#include "mm/mm1/views_enh/spells/spellbook.h"
+#include "mm/mm1/views_enh/spells/detect_magic.h"
#include "mm/mm1/views_enh/spells/fly.h"
#include "mm/mm1/views_enh/spells/location.h"
@@ -139,6 +140,7 @@ private:
ViewsEnh::Locations::Training _training;
ViewsEnh::Spells::CastSpell _castSpell;
ViewsEnh::Spells::Spellbook _spellbook;
+ ViewsEnh::Spells::DetectMagic _detectMagic;
ViewsEnh::Spells::Fly _fly;
ViewsEnh::Spells::Location _location;
ViewsEnh::CharacterInfo _characterInfo;
diff --git a/engines/mm/mm1/views_enh/spells/detect_magic.cpp b/engines/mm/mm1/views_enh/spells/detect_magic.cpp
new file mode 100644
index 00000000000..19bdd6a8175
--- /dev/null
+++ b/engines/mm/mm1/views_enh/spells/detect_magic.cpp
@@ -0,0 +1,74 @@
+/* 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/spells/detect_magic.h"
+#include "mm/mm1/globals.h"
+
+#define TEXT_X1 160
+#define TEXT_X2 195
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+namespace Spells {
+
+DetectMagic::DetectMagic() : ScrollView("DetectMagic") {
+ setBounds(Common::Rect(30, 30, 210, 120));
+ addButton(&g_globals->_escSprites, Common::Point(0, 64), 0, KEYBIND_ESCAPE, true);
+}
+
+void DetectMagic::draw() {
+ ScrollView::draw();
+
+ setReduced(true);
+ writeString(0, 0, STRING["dialogs.spells.detect_charges"], ALIGN_RIGHT);
+
+ getMagicStrings();
+
+ Inventory &inv = g_globals->_currCharacter->_backpack;
+ for (uint i = 0; i < inv.size(); ++i) {
+ // Write item name
+ writeString(0, (i + 1) * 8, Common::String::format("%c) ", 'A' + i));
+ g_globals->_items.getItem(inv[i]._id);
+ writeString(g_globals->_currItem._name);
+
+ // Write out the detect status
+ writeString(0, (i + 1) * 8, _strings[i], ALIGN_RIGHT);
+ }
+
+ if (inv.empty())
+ writeLine(1, STRING["enhdialogs.misc.no_items"]);
+
+ writeString(15, 66, STRING["enhdialogs.misc.go_back"]);
+ setReduced(false);
+}
+
+bool DetectMagic::msgAction(const ActionMessage &msg) {
+ if (msg._action == KEYBIND_SELECT || msg._action == KEYBIND_ESCAPE)
+ g_events->replaceView("Game", true);
+
+ return true;
+}
+
+} // namespace Spells
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
diff --git a/engines/mm/mm1/views_enh/spells/detect_magic.h b/engines/mm/mm1/views_enh/spells/detect_magic.h
new file mode 100644
index 00000000000..d0aba7ca262
--- /dev/null
+++ b/engines/mm/mm1/views_enh/spells/detect_magic.h
@@ -0,0 +1,48 @@
+/* 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_SPELLS_DETECT_MAGIC_H
+#define MM1_VIEWS_ENH_SPELLS_DETECT_MAGIC_H
+
+#include "mm/mm1/views_enh/scroll_view.h"
+#include "mm/mm1/game/detect_magic.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+namespace Spells {
+
+class DetectMagic : public ScrollView, public MM1::Game::DetectMagic {
+public:
+ DetectMagic();
+ virtual ~DetectMagic() {
+ }
+
+ void draw() override;
+ bool msgAction(const ActionMessage &msg) override;
+};
+
+} // namespace Spells
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
+
+#endif
diff --git a/engines/mm/module.mk b/engines/mm/module.mk
index 06c8c8bf419..c9ef5f419e8 100644
--- a/engines/mm/module.mk
+++ b/engines/mm/module.mk
@@ -136,6 +136,7 @@ MODULE_OBJS += \
mm1/views/wheel_spin.o \
mm1/views_enh/spells/cast_spell.o \
mm1/views_enh/spells/spellbook.o \
+ mm1/views_enh/spells/detect_magic.o \
mm1/views_enh/spells/fly.o \
mm1/views_enh/spells/location.o \
mm1/views_enh/button_container.o \
More information about the Scummvm-git-logs
mailing list