[Scummvm-git-logs] scummvm master -> 08b648e30f42287cbb2123cd590290d4dec19a3f
dreammaster
noreply at scummvm.org
Thu Feb 16 06:09:07 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:
705a0ad544 MM: MM1: Skeleton dialog for casting spells
51d843db19 MM: MM1: Some content in the Cast Spell dialog
08b648e30f MM: MM1: Proper buttons for Cast Spell dialog
Commit: 705a0ad544f47197184e2536306580b927be74d1
https://github.com/scummvm/scummvm/commit/705a0ad544f47197184e2536306580b927be74d1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-02-15T22:08:53-08:00
Commit Message:
MM: MM1: Skeleton dialog for casting spells
Changed paths:
A engines/mm/mm1/views_enh/cast_spell.cpp
A engines/mm/mm1/views_enh/cast_spell.h
devtools/create_mm/files/mm1/strings_en.yml
engines/mm/mm1/data/character.h
engines/mm/mm1/metaengine.cpp
engines/mm/mm1/metaengine.h
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 5caf8d03fa4..a356b2492d2 100644
--- a/devtools/create_mm/files/mm1/strings_en.yml
+++ b/devtools/create_mm/files/mm1/strings_en.yml
@@ -423,11 +423,14 @@ dialogs:
15: "thrashes at"
99: "shoots at"
enhdialogs:
- map:
- north: "North"
- south: "South"
- east: "East"
- west: "West"
+ cast_spell:
+ title: "Cast Spell"
+ spell_ready: "Spell Ready:"
+ cost: "Cost"
+ cur_sp: "Cur SP"
+ cast: "\x01""37Cast"
+ new: "\x01""37New"
+ esc: "ESC"
character:
stats:
might: "Mgt"
@@ -480,6 +483,11 @@ enhdialogs:
options: "options"
options_for: "options for"
gold: "gold"
+ map:
+ north: "North"
+ south: "South"
+ east: "East"
+ west: "West"
market:
buy_food: "buy food"
thankyou: "thank you,\ncome again!"
@@ -496,6 +504,11 @@ enhdialogs:
sp: "S.P."
ac: "A.C."
cond: "Cond"
+ spellbook:
+ title: "Spells for"
+ spell_pts: "Spell Pts - "
+ select: "Select"
+ exit: "Exit"
temple:
title: "temple"
heal: "\x01""37heal"
@@ -881,6 +894,102 @@ spells:
6: "is webbed"
7: "is paralyzed"
8: "is affected"
+ cleric:
+ 0: "Awaken"
+ 1: "Bless"
+ 2: "Blind"
+ 3: "First Aid"
+ 4: "Light"
+ 5: "Power Cure"
+ 6: "Protection From Fear"
+ 7: "Turn Undead"
+ 8: "Cure Wounds"
+ 9: "Heroism"
+ 10: "Pain"
+ 11: "Protection From Cold"
+ 12: "Protection From Ice"
+ 13: "Protection From Poison"
+ 14: "Silence"
+ 15: "Suggestion"
+ 16: "Create Food"
+ 17: "Cure Blindness"
+ 18: "Cure Paralysis"
+ 19: "Lasting Light"
+ 20: "Produce Flame"
+ 21: "Produce Frost"
+ 22: "Remove Quest"
+ 23: "Walk on Water"
+ 24: "Cure Disease"
+ 25: "Neutralize Poison"
+ 26: "Protection From Acid"
+ 27: "Protection From Electricity"
+ 28: "Restore Alignment"
+ 29: "Summon Lightning"
+ 30: "Super Heroism"
+ 31: "Surface"
+ 32: "Deadly Swarm"
+ 33: "Dispel Magic"
+ 34: "Paralyze"
+ 35: "Remove Condition"
+ 36: "Restore Energy"
+ 37: "Moon Ray"
+ 38: "Raise Dead"
+ 39: "Rejuvinate"
+ 40: "Stone to Flesh"
+ 41: "Town Portal"
+ 42: "Divine Intervention"
+ 43: "Holy Word"
+ 44: "Protection From Elements"
+ 45: "Ressurection"
+ 46: "Sun Ray"
+ wizard:
+ 0: "Awaken"
+ 1: "Detect Magic"
+ 2: "Energy Blast"
+ 3: "Flame Arrow"
+ 4: "Leather Skin"
+ 5: "Light"
+ 6: "Location"
+ 7: "Sleep"
+ 8: "Electric Arrow"
+ 9: "Hypnotize"
+ 10: "identify Monster"
+ 11: "Jump"
+ 12: "Levitate"
+ 13: "Power"
+ 14: "Quickness"
+ 15: "Scare"
+ 16: "Fireball"
+ 17: "Fly"
+ 18: "Invisibility"
+ 19: "Lightning Bolt"
+ 20: "Make Room"
+ 21: "Slow"
+ 22: "Weaken"
+ 23: "Web"
+ 24: "Acid Arrow"
+ 25: "Cold Beam"
+ 26: "Feeble Mind"
+ 27: "Freeze"
+ 28: "Guard Dog"
+ 29: "Psychic Protection"
+ 30: "Shield"
+ 31: "Time Distortion"
+ 32: "Acid Rain"
+ 33: "Dispel Magic"
+ 34: "Finger of Death"
+ 35: "Shelter"
+ 36: "Teleport"
+ 37: "Dancing Sword"
+ 38: "Disintegration"
+ 39: "Etherialize"
+ 40: "Protection From Magic"
+ 41: "Recharge Item"
+ 42: "Astral Spell"
+ 43: "Duplication"
+ 44: "Meteor Shower"
+ 45: "Power Shield"
+ 46: "Prismatic Light"
monster_spells:
casts: "casts "
fails_to_cast: "fails to cast a spell"
diff --git a/engines/mm/mm1/data/character.h b/engines/mm/mm1/data/character.h
index a994118cfbb..17211e7c771 100644
--- a/engines/mm/mm1/data/character.h
+++ b/engines/mm/mm1/data/character.h
@@ -466,6 +466,7 @@ struct Character : public PrimaryAttributes {
// Combat fields
bool _checked = false;
bool _canAttack = false;
+ int _activeSpell = -1;
Character();
diff --git a/engines/mm/mm1/metaengine.cpp b/engines/mm/mm1/metaengine.cpp
index f1a5f6fe142..3bbf834f775 100644
--- a/engines/mm/mm1/metaengine.cpp
+++ b/engines/mm/mm1/metaengine.cpp
@@ -77,6 +77,7 @@ static const KeybindingRecord NORMAL_KEYS[] = {
{ KEYBIND_STRAFE_LEFT, "STRAFE_LEFT", "Strafe Left", "C+LEFT", nullptr },
{ KEYBIND_STRAFE_RIGHT, "STRAFE_RIGHT", "Strafe Right", "C+RIGHT", nullptr },
+ { KEYBIND_SPELL, "CAST", "Cast Spell", "c", nullptr },
{ KEYBIND_MAP, "MAP", "Show Map", "m", nullptr },
{ KEYBIND_MINIMAP, "MINIMAP", "Toggle Minimap", "=", nullptr },
{ KEYBIND_ORDER, "ORDER", "Reorder Party", "o", nullptr },
diff --git a/engines/mm/mm1/metaengine.h b/engines/mm/mm1/metaengine.h
index c6dd6609004..32d602abe0a 100644
--- a/engines/mm/mm1/metaengine.h
+++ b/engines/mm/mm1/metaengine.h
@@ -44,6 +44,7 @@ enum KeybindingAction {
KEYBIND_REST,
KEYBIND_SEARCH,
KEYBIND_BASH,
+ KEYBIND_SPELL,
KEYBIND_UNLOCK,
KEYBIND_QUICKREF,
KEYBIND_VERSION,
diff --git a/engines/mm/mm1/views_enh/cast_spell.cpp b/engines/mm/mm1/views_enh/cast_spell.cpp
new file mode 100644
index 00000000000..3cbc93b92fa
--- /dev/null
+++ b/engines/mm/mm1/views_enh/cast_spell.cpp
@@ -0,0 +1,54 @@
+/* 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/cast_spell.h"
+#include "mm/mm1/globals.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+
+CastSpell::CastSpell() : ScrollView("CastSpell") {
+ _bounds = Common::Rect(234, 0, 320, 144);
+
+ addButton(&g_globals->_confirmIcons,
+ Common::Point(14, 10), 0,
+ Common::KeyState(Common::KEYCODE_y, 'y'));
+ addButton(&g_globals->_confirmIcons,
+ Common::Point(40, 10), 2,
+ Common::KeyState(Common::KEYCODE_n, 'n'));
+}
+
+void CastSpell::draw() {
+ ScrollView::draw();
+}
+
+bool CastSpell::msgFocus(const FocusMessage &msg) {
+ return true;
+}
+
+bool CastSpell::msgKeypress(const KeypressMessage &msg) {
+ return true;
+}
+
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
diff --git a/engines/mm/mm1/views_enh/cast_spell.h b/engines/mm/mm1/views_enh/cast_spell.h
new file mode 100644
index 00000000000..9074c2573cd
--- /dev/null
+++ b/engines/mm/mm1/views_enh/cast_spell.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_CAST_SPELL_H
+#define MM1_VIEWS_ENH_CAST_SPELL_H
+
+#include "mm/mm1/messages.h"
+#include "mm/mm1/views_enh/scroll_view.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+
+/**
+ * Dialog for casting a spell
+ */
+class CastSpell : public ScrollView {
+public:
+ CastSpell();
+ virtual ~CastSpell() {}
+
+ void draw() override;
+ bool msgFocus(const FocusMessage &msg) override;
+ bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
+
+#endif
diff --git a/engines/mm/mm1/views_enh/dialogs.h b/engines/mm/mm1/views_enh/dialogs.h
index 0774301aeb0..0efe5991052 100644
--- a/engines/mm/mm1/views_enh/dialogs.h
+++ b/engines/mm/mm1/views_enh/dialogs.h
@@ -27,6 +27,7 @@
#include "mm/mm1/views/locations/inn.h"
#include "mm/mm1/views/protect.h"
#include "mm/mm1/views/title.h"
+#include "mm/mm1/views_enh/cast_spell.h"
#include "mm/mm1/views_enh/character_info.h"
#include "mm/mm1/views_enh/game.h"
#include "mm/mm1/views_enh/main_menu.h"
@@ -51,7 +52,7 @@ private:
Views::Protect _protect;
Views::Title _title;
// Views::ViewCharacter _viewCharacter;
- ViewsEnh::MainMenu _areYouReady;
+ ViewsEnh::CastSpell _castSpell;
ViewsEnh::MainMenu _mainMenu;
ViewsEnh::MapPopup _mapPopup;
ViewsEnh::QuickRef _quickRef;
diff --git a/engines/mm/mm1/views_enh/game.cpp b/engines/mm/mm1/views_enh/game.cpp
index 09a23b9fcae..c839e480395 100644
--- a/engines/mm/mm1/views_enh/game.cpp
+++ b/engines/mm/mm1/views_enh/game.cpp
@@ -70,6 +70,10 @@ bool Game::msgKeypress(const KeypressMessage &msg) {
bool Game::msgAction(const ActionMessage &msg) {
switch (msg._action) {
+ case KEYBIND_SPELL:
+ addView("CastSpell");
+ return true;
+
case KEYBIND_VIEW_PARTY1:
case KEYBIND_VIEW_PARTY2:
case KEYBIND_VIEW_PARTY3:
@@ -82,7 +86,7 @@ bool Game::msgAction(const ActionMessage &msg) {
g_globals->_currCharacter = &g_globals->_party[charNum];
addView("CharacterInfo");
}
- break;
+ return true;
}
default:
break;
diff --git a/engines/mm/module.mk b/engines/mm/module.mk
index 1b3dc0324dd..456f6a86e51 100644
--- a/engines/mm/module.mk
+++ b/engines/mm/module.mk
@@ -120,6 +120,7 @@ MODULE_OBJS += \
mm1/views/trap.o \
mm1/views/unlock.o \
mm1/views_enh/button_container.o \
+ mm1/views_enh/cast_spell.o \
mm1/views_enh/character_info.o \
mm1/views_enh/dialogs.o \
mm1/views_enh/game.o \
Commit: 51d843db19c82241935b06d1fd5271d28a74183b
https://github.com/scummvm/scummvm/commit/51d843db19c82241935b06d1fd5271d28a74183b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-02-15T22:08:54-08:00
Commit Message:
MM: MM1: Some content in the Cast Spell dialog
Changed paths:
A engines/mm/mm1/views_enh/spells/cast_spell.cpp
A engines/mm/mm1/views_enh/spells/cast_spell.h
R engines/mm/mm1/views_enh/cast_spell.cpp
R engines/mm/mm1/views_enh/cast_spell.h
devtools/create_mm/files/mm1/strings_en.yml
engines/mm/mm1/data/character.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/mm1/views_enh/game_party.cpp
engines/mm/mm1/views_enh/game_party.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 a356b2492d2..71bf951316d 100644
--- a/devtools/create_mm/files/mm1/strings_en.yml
+++ b/devtools/create_mm/files/mm1/strings_en.yml
@@ -426,6 +426,7 @@ enhdialogs:
cast_spell:
title: "Cast Spell"
spell_ready: "Spell Ready:"
+ none: "None Ready"
cost: "Cost"
cur_sp: "Cur SP"
cast: "\x01""37Cast"
diff --git a/engines/mm/mm1/data/character.h b/engines/mm/mm1/data/character.h
index 17211e7c771..95a8a63841c 100644
--- a/engines/mm/mm1/data/character.h
+++ b/engines/mm/mm1/data/character.h
@@ -466,7 +466,8 @@ struct Character : public PrimaryAttributes {
// Combat fields
bool _checked = false;
bool _canAttack = false;
- int _activeSpell = -1;
+ int _nonCombatSpell = -1;
+ int _combatSpell = -1;
Character();
diff --git a/engines/mm/mm1/views_enh/cast_spell.cpp b/engines/mm/mm1/views_enh/cast_spell.cpp
deleted file mode 100644
index 3cbc93b92fa..00000000000
--- a/engines/mm/mm1/views_enh/cast_spell.cpp
+++ /dev/null
@@ -1,54 +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 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/cast_spell.h"
-#include "mm/mm1/globals.h"
-
-namespace MM {
-namespace MM1 {
-namespace ViewsEnh {
-
-CastSpell::CastSpell() : ScrollView("CastSpell") {
- _bounds = Common::Rect(234, 0, 320, 144);
-
- addButton(&g_globals->_confirmIcons,
- Common::Point(14, 10), 0,
- Common::KeyState(Common::KEYCODE_y, 'y'));
- addButton(&g_globals->_confirmIcons,
- Common::Point(40, 10), 2,
- Common::KeyState(Common::KEYCODE_n, 'n'));
-}
-
-void CastSpell::draw() {
- ScrollView::draw();
-}
-
-bool CastSpell::msgFocus(const FocusMessage &msg) {
- return true;
-}
-
-bool CastSpell::msgKeypress(const KeypressMessage &msg) {
- return true;
-}
-
-} // namespace ViewsEnh
-} // namespace MM1
-} // namespace MM
diff --git a/engines/mm/mm1/views_enh/character_info.cpp b/engines/mm/mm1/views_enh/character_info.cpp
index 6eb5498649f..0a40bab66f2 100644
--- a/engines/mm/mm1/views_enh/character_info.cpp
+++ b/engines/mm/mm1/views_enh/character_info.cpp
@@ -83,7 +83,11 @@ CharacterInfo::CharacterInfo() :
bool CharacterInfo::msgFocus(const FocusMessage &msg) {
_viewIcon.load("view.icn");
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_PARTY_MENUS);
- g_events->findView("GameParty")->draw();
+
+ // Turn on highlight for selected character
+ if (!g_globals->_currCharacter)
+ g_globals->_currCharacter = &g_globals->_party[0];
+ g_events->send(GameMessage("CHAR_HIGHLIGHT", (int)true));
_cursorCell = 0;
showCursor(true);
@@ -94,6 +98,11 @@ bool CharacterInfo::msgFocus(const FocusMessage &msg) {
bool CharacterInfo::msgUnfocus(const UnfocusMessage &msg) {
_viewIcon.clear();
+
+ // Turn off highlight for selected character
+ g_events->send(GameMessage("CHAR_HIGHLIGHT", (int)false));
+
+ MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_MENUS);
return ScrollView::msgUnfocus(msg);
}
diff --git a/engines/mm/mm1/views_enh/dialogs.h b/engines/mm/mm1/views_enh/dialogs.h
index 0efe5991052..548d268a3bd 100644
--- a/engines/mm/mm1/views_enh/dialogs.h
+++ b/engines/mm/mm1/views_enh/dialogs.h
@@ -27,7 +27,6 @@
#include "mm/mm1/views/locations/inn.h"
#include "mm/mm1/views/protect.h"
#include "mm/mm1/views/title.h"
-#include "mm/mm1/views_enh/cast_spell.h"
#include "mm/mm1/views_enh/character_info.h"
#include "mm/mm1/views_enh/game.h"
#include "mm/mm1/views_enh/main_menu.h"
@@ -35,6 +34,7 @@
#include "mm/mm1/views_enh/quick_ref.h"
#include "mm/mm1/views_enh/locations/market.h"
#include "mm/mm1/views_enh/locations/temple.h"
+#include "mm/mm1/views_enh/spells/cast_spell.h"
namespace MM {
namespace MM1 {
diff --git a/engines/mm/mm1/views_enh/game.cpp b/engines/mm/mm1/views_enh/game.cpp
index c839e480395..54aa57d4299 100644
--- a/engines/mm/mm1/views_enh/game.cpp
+++ b/engines/mm/mm1/views_enh/game.cpp
@@ -45,8 +45,6 @@ Game::Game() : TextView("Game"),
bool Game::msgFocus(const FocusMessage &msg) {
MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_NORMAL);
- g_globals->_currCharacter = nullptr;
-
return TextView::msgFocus(msg);
}
diff --git a/engines/mm/mm1/views_enh/game_party.cpp b/engines/mm/mm1/views_enh/game_party.cpp
index 64e29d44227..cf76b06451e 100644
--- a/engines/mm/mm1/views_enh/game_party.cpp
+++ b/engines/mm/mm1/views_enh/game_party.cpp
@@ -87,7 +87,7 @@ void GameParty::draw() {
_hpSprites.draw(&s, frame, Common::Point(HP_BARS_X[idx], 38));
// Also draw the highlight if character is selected
- if (g_globals->_currCharacter == &c)
+ if (_highlightOn && g_globals->_currCharacter == &c)
g_globals->_globalSprites.draw(&s, 8, Common::Point(CHAR_FACES_X[idx] - 1, 5));
}
@@ -96,6 +96,17 @@ void GameParty::draw() {
s.markAllDirty();
}
+bool GameParty::msgGame(const GameMessage &msg) {
+ if (msg._name == "CHAR_HIGHLIGHT") {
+ _highlightOn = msg._value != 0;
+ draw();
+ return true;
+ }
+
+ return false;
+}
+
+
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
diff --git a/engines/mm/mm1/views_enh/game_party.h b/engines/mm/mm1/views_enh/game_party.h
index c450a90581e..65a2afd98eb 100644
--- a/engines/mm/mm1/views_enh/game_party.h
+++ b/engines/mm/mm1/views_enh/game_party.h
@@ -37,6 +37,7 @@ private:
Shared::Xeen::SpriteResource _restoreSprites;
Shared::Xeen::SpriteResource _hpSprites;
Shared::Xeen::SpriteResource _dseFace;
+ bool _highlightOn = false;
public:
GameParty(UIElement *owner);
@@ -46,6 +47,11 @@ public:
* Draw the view
*/
void draw() override;
+
+ /**
+ * Handle game messages
+ */
+ bool msgGame(const GameMessage &msg) override;
};
} // namespace ViewsEnh
diff --git a/engines/mm/mm1/views_enh/spells/cast_spell.cpp b/engines/mm/mm1/views_enh/spells/cast_spell.cpp
new file mode 100644
index 00000000000..37c7e9ec1fe
--- /dev/null
+++ b/engines/mm/mm1/views_enh/spells/cast_spell.cpp
@@ -0,0 +1,105 @@
+/* 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/cast_spell.h"
+#include "mm/mm1/globals.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+
+CastSpell::CastSpell() : ScrollView("CastSpell") {
+ _bounds = Common::Rect(225, 0, 320, 144);
+
+ addButton(&g_globals->_confirmIcons,
+ Common::Point(0, 100), 0,
+ Common::KeyState(Common::KEYCODE_y, 'y'));
+ addButton(&g_globals->_confirmIcons,
+ Common::Point(40, 100), 2,
+ Common::KeyState(Common::KEYCODE_n, 'n'));
+}
+
+bool CastSpell::msgFocus(const FocusMessage &msg) {
+ // Turn on highlight for selected character
+ if (!g_globals->_currCharacter)
+ g_globals->_currCharacter = &g_globals->_party[0];
+ g_events->send(GameMessage("CHAR_HIGHLIGHT", (int)true));
+
+ MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_PARTY_MENUS);
+ return true;
+}
+
+bool CastSpell::msgUnfocus(const UnfocusMessage &msg) {
+ // Turn off highlight for selected character
+ g_events->send(GameMessage("CHAR_HIGHLIGHT", (int)false));
+
+ MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_MENUS);
+ return true;
+}
+
+void CastSpell::draw() {
+ ScrollView::draw();
+
+ const Character &c = *g_globals->_currCharacter;
+ writeString(0, 0, STRING["enhdialogs.cast_spell.title"], ALIGN_MIDDLE);
+ writeString(0, 20, c._name, ALIGN_MIDDLE);
+ writeString(0, 40, STRING["enhdialogs.cast_spell.spell_ready"]);
+
+ writeString(0, 80, STRING["enhdialogs.cast_spell.cost"]);
+ writeString(0, 90, STRING["enhdialogs.cast_spell.cur_sp"]);
+ writeString(0, 80, Common::String::format("%d/%d", 6, 9), ALIGN_RIGHT);
+ writeString(0, 90, Common::String::format("%d", c._sp._current), ALIGN_RIGHT);
+
+ writeString(0, 120, STRING["enhdialogs.cast_spell.cast"]);
+ writeString(30, 120, STRING["enhdialogs.cast_spell.new"]);
+ writeString(60, 120, STRING["enhdialogs.cast_spell.esc"]);
+
+ setTextColor(37);
+ writeString(0, 60, STRING["enhdialogs.cast_spell.none"], ALIGN_MIDDLE);
+}
+
+bool CastSpell::msgKeypress(const KeypressMessage &msg) {
+ return true;
+}
+
+bool CastSpell::msgAction(const ActionMessage &msg) {
+ if (msg._action == KEYBIND_ESCAPE) {
+ close();
+ return true;
+
+ } else if (msg._action >= KEYBIND_VIEW_PARTY1 &&
+ msg._action <= KEYBIND_VIEW_PARTY6) {
+ uint charNum = msg._action - KEYBIND_VIEW_PARTY1;
+ if (charNum < g_globals->_party.size()) {
+ g_globals->_currCharacter = &g_globals->_party[
+ msg._action - KEYBIND_VIEW_PARTY1];
+ g_events->send(GameMessage("CHAR_HIGHLIGHT", (int)true));
+ redraw();
+ return true;
+ }
+ }
+
+ return false;
+}
+
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
diff --git a/engines/mm/mm1/views_enh/cast_spell.h b/engines/mm/mm1/views_enh/spells/cast_spell.h
similarity index 92%
rename from engines/mm/mm1/views_enh/cast_spell.h
rename to engines/mm/mm1/views_enh/spells/cast_spell.h
index 9074c2573cd..185cfdf3d28 100644
--- a/engines/mm/mm1/views_enh/cast_spell.h
+++ b/engines/mm/mm1/views_enh/spells/cast_spell.h
@@ -39,7 +39,9 @@ public:
void draw() override;
bool msgFocus(const FocusMessage &msg) override;
+ bool msgUnfocus(const UnfocusMessage &msg) override;
bool msgKeypress(const KeypressMessage &msg) override;
+ bool msgAction(const ActionMessage &msg) override;
};
} // namespace ViewsEnh
diff --git a/engines/mm/module.mk b/engines/mm/module.mk
index 456f6a86e51..4206018a131 100644
--- a/engines/mm/module.mk
+++ b/engines/mm/module.mk
@@ -119,8 +119,8 @@ MODULE_OBJS += \
mm1/views/text_view.o \
mm1/views/trap.o \
mm1/views/unlock.o \
+ mm1/views_enh/spells/cast_spell.o \
mm1/views_enh/button_container.o \
- mm1/views_enh/cast_spell.o \
mm1/views_enh/character_info.o \
mm1/views_enh/dialogs.o \
mm1/views_enh/game.o \
Commit: 08b648e30f42287cbb2123cd590290d4dec19a3f
https://github.com/scummvm/scummvm/commit/08b648e30f42287cbb2123cd590290d4dec19a3f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-02-15T22:08:54-08:00
Commit Message:
MM: MM1: Proper buttons for Cast Spell dialog
Changed paths:
engines/mm/mm1/views_enh/scroll_view.cpp
engines/mm/mm1/views_enh/scroll_view.h
engines/mm/mm1/views_enh/spells/cast_spell.cpp
engines/mm/mm1/views_enh/spells/cast_spell.h
diff --git a/engines/mm/mm1/views_enh/scroll_view.cpp b/engines/mm/mm1/views_enh/scroll_view.cpp
index 5311d00a3fd..6d242ca1fb0 100644
--- a/engines/mm/mm1/views_enh/scroll_view.cpp
+++ b/engines/mm/mm1/views_enh/scroll_view.cpp
@@ -47,6 +47,11 @@ void ScrollView::addButton(Shared::Xeen::SpriteResource *sprites,
_buttons.push_back(Button(sprites, pos, frame, key));
}
+void ScrollView::addButton(Shared::Xeen::SpriteResource *sprites,
+ const Common::Point &pos, int frame, KeybindingAction action) {
+ _buttons.push_back(Button(sprites, pos, frame, action));
+}
+
void ScrollView::resetSelectedButton() {
_selectedButton = -1;
redraw();
@@ -171,7 +176,11 @@ bool ScrollView::msgMouseUp(const MouseUpMessage &msg) {
// If the highlighted button remains the same, trigger it's key
int selectedButton = getButtonAt(msg._pos);
if (selectedButton != -1 && selectedButton == oldSelection) {
- msgKeypress(KeypressMessage(_buttons[selectedButton]._key));
+ const Button &btn = _buttons[selectedButton];
+ if (btn._action != KEYBIND_NONE)
+ msgAction(btn._action);
+ else
+ msgKeypress(KeypressMessage(btn._key));
return true;
}
diff --git a/engines/mm/mm1/views_enh/scroll_view.h b/engines/mm/mm1/views_enh/scroll_view.h
index f8ba6eb5e7b..52d6f916a63 100644
--- a/engines/mm/mm1/views_enh/scroll_view.h
+++ b/engines/mm/mm1/views_enh/scroll_view.h
@@ -36,12 +36,18 @@ class ScrollView : public TextView {
Common::Point _pos;
int _frame;
Common::KeyState _key;
+ KeybindingAction _action = KEYBIND_NONE;
Button(Shared::Xeen::SpriteResource *sprites,
const Common::Point &pos, int frame,
const Common::KeyState &key) :
_sprites(sprites), _pos(pos), _frame(frame), _key(key) {
}
+ Button(Shared::Xeen::SpriteResource *sprites,
+ const Common::Point &pos, int frame,
+ KeybindingAction action) :
+ _sprites(sprites), _pos(pos), _frame(frame), _action(action) {
+ }
};
private:
Common::Array<Button> _buttons;
@@ -87,6 +93,12 @@ public:
const Common::Point &pos, int frame,
const Common::KeyState &key);
+ /**
+ * Add a button for display
+ */
+ void addButton(Shared::Xeen::SpriteResource *sprites,
+ const Common::Point &pos, int frame, KeybindingAction action);
+
/**
* Reset selected button
*/
diff --git a/engines/mm/mm1/views_enh/spells/cast_spell.cpp b/engines/mm/mm1/views_enh/spells/cast_spell.cpp
index 37c7e9ec1fe..6df6eb7963f 100644
--- a/engines/mm/mm1/views_enh/spells/cast_spell.cpp
+++ b/engines/mm/mm1/views_enh/spells/cast_spell.cpp
@@ -27,14 +27,14 @@ namespace MM1 {
namespace ViewsEnh {
CastSpell::CastSpell() : ScrollView("CastSpell") {
- _bounds = Common::Rect(225, 0, 320, 144);
+ _bounds = Common::Rect(225, 0, 320, 146);
+ _icons.load("cast.icn");
- addButton(&g_globals->_confirmIcons,
- Common::Point(0, 100), 0,
- Common::KeyState(Common::KEYCODE_y, 'y'));
- addButton(&g_globals->_confirmIcons,
- Common::Point(40, 100), 2,
+ addButton(&_icons, Common::Point(0, 100), 0,
+ Common::KeyState(Common::KEYCODE_c, 'c'));
+ addButton(&_icons, Common::Point(28, 100), 2,
Common::KeyState(Common::KEYCODE_n, 'n'));
+ addButton(&_icons, Common::Point(56, 100), 4, KEYBIND_ESCAPE);
}
bool CastSpell::msgFocus(const FocusMessage &msg) {
@@ -68,9 +68,9 @@ void CastSpell::draw() {
writeString(0, 80, Common::String::format("%d/%d", 6, 9), ALIGN_RIGHT);
writeString(0, 90, Common::String::format("%d", c._sp._current), ALIGN_RIGHT);
- writeString(0, 120, STRING["enhdialogs.cast_spell.cast"]);
- writeString(30, 120, STRING["enhdialogs.cast_spell.new"]);
- writeString(60, 120, STRING["enhdialogs.cast_spell.esc"]);
+ writeString(0, 122, STRING["enhdialogs.cast_spell.cast"]);
+ writeString(30, 122, STRING["enhdialogs.cast_spell.new"]);
+ writeString(58, 122, STRING["enhdialogs.cast_spell.esc"]);
setTextColor(37);
writeString(0, 60, STRING["enhdialogs.cast_spell.none"], ALIGN_MIDDLE);
diff --git a/engines/mm/mm1/views_enh/spells/cast_spell.h b/engines/mm/mm1/views_enh/spells/cast_spell.h
index 185cfdf3d28..636b30bf2db 100644
--- a/engines/mm/mm1/views_enh/spells/cast_spell.h
+++ b/engines/mm/mm1/views_enh/spells/cast_spell.h
@@ -33,6 +33,8 @@ namespace ViewsEnh {
* Dialog for casting a spell
*/
class CastSpell : public ScrollView {
+private:
+ Shared::Xeen::SpriteResource _icons;
public:
CastSpell();
virtual ~CastSpell() {}
More information about the Scummvm-git-logs
mailing list