[Scummvm-git-logs] scummvm master -> 77f53fc0d18369f8e447972c1267ff952ffb7d1d
dreammaster
noreply at scummvm.org
Mon Apr 3 01:46:55 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:
e9fc2c7d11 MM: MM1: Map 3 fixes
d22d5c4626 MM: MM1: Map 4 fixes
77f53fc0d1 MM: MM1: Finished Arrested view
Commit: e9fc2c7d1155060a83e8e1fb20c4ce4c462c5f79
https://github.com/scummvm/scummvm/commit/e9fc2c7d1155060a83e8e1fb20c4ce4c462c5f79
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-04-02T18:46:33-07:00
Commit Message:
MM: MM1: Map 3 fixes
Changed paths:
devtools/create_mm/files/mm1/strings_en.yml
diff --git a/devtools/create_mm/files/mm1/strings_en.yml b/devtools/create_mm/files/mm1/strings_en.yml
index bb416a79a16..051616b6056 100644
--- a/devtools/create_mm/files/mm1/strings_en.yml
+++ b/devtools/create_mm/files/mm1/strings_en.yml
@@ -1052,13 +1052,16 @@ maps:
blacksmith_inside: "A young gnome materializes, asking,\n\"Would you be wanting my services(Y/N)?\""
inn_inside: "An eerie silence pervades the deserted\ninn. suddenly, a ghostly apparition\nappears, asking, \"Sign in (Y/N)?\""
market_inside: "A faint outline of a man appears,\nsaying, \"Need some feed (Y/N)?\""
- temple_inside: "Bright lights swirl throughout the room.a horrifying voice shrieks,\n\"Need help (Y/N)?\""
+ temple_inside: "Bright lights swirl throughout the room.A horrifying voice shrieks,\n\"Need help (Y/N)?\""
training_inside: "Several empty suits of armor approach\nasking, \"Need training (Y/N)?\""
telgoran1: "An elf dressed in robes approaches...\n\n"
telgoran2: "\"Friends, I am telgoran. This scroll you\nhave brought me will be very helpful\n(+2500 exp) Here's 1500 gold for your\nservices. I'll tell you a secret, if\ntreasure is what you want...\""
telgoran3: "\"The brothers you must find...\nPortsmith and Algary are combined.\""
telgoran4: "\"You're not the couriers!\""
+ emap03:
+ blacksmith_inside: "A young gnome materializes, asking,\n\"Would you be wanting my services (Y/N)?\""
+ temple_inside: "Bright lights swirl throughout the room. A horrifying voice shrieks,\n\"Need help (Y/N)?\""
map04:
blacksmith: "\"Current Trends Ironworks\""
Commit: d22d5c46266650849c1c4b99ef665fc0437d78e0
https://github.com/scummvm/scummvm/commit/d22d5c46266650849c1c4b99ef665fc0437d78e0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-04-02T18:46:33-07:00
Commit Message:
MM: MM1: Map 4 fixes
Changed paths:
devtools/create_mm/files/mm1/strings_en.yml
diff --git a/devtools/create_mm/files/mm1/strings_en.yml b/devtools/create_mm/files/mm1/strings_en.yml
index 051616b6056..f711f00af8f 100644
--- a/devtools/create_mm/files/mm1/strings_en.yml
+++ b/devtools/create_mm/files/mm1/strings_en.yml
@@ -1073,16 +1073,18 @@ maps:
blacksmith_inside: "A boistrous half-orc proclaims,\n\"We carry the very latest,\nbrowse (Y/N)?\""
inn_inside: "Adjusting his spectacles, an elderly\ngnome eyes the party and asks,\n\"Signing in (Y/N)?\""
- market_inside: "The chef says,\"i only serve the best!\nHungry (Y/N)?\""
+ market_inside: "The chef says,\"I only serve the best!\nHungry (Y/N)?\""
training_inside: "Three huge armor clad knights bark in\nunison, \"Want a good workout (Y/N)?\""
temple_inside: "Several fat clerics welcome you.\nNeed help (Y/N)?"
agar1: "The wizard Agar speaks:\n\n"
agar2: "\"You have done well to bring me this\nscroll. (+1000 exp) Now take it to my\nprotege Telgoran in Dusk.\""
- agar3: "\"I have no business with you. begone!\""
+ agar3: "\"I have no business with you. Begone!\""
guards: "Town guards: you're under arrest!\n\na)Attack b)Bribe c)Run d)Surrender"
sentence: "High court sentence: years= "
treasure: "Town treasure, steal (Y/N)?"
+ emap04:
+ guards: "Town guards: you're under arrest!\n\nA) Attack B) Bribe C) Run D) Surrender"
map05:
arena: "\"The Arena\""
Commit: 77f53fc0d18369f8e447972c1267ff952ffb7d1d
https://github.com/scummvm/scummvm/commit/77f53fc0d18369f8e447972c1267ff952ffb7d1d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-04-02T18:46:34-07:00
Commit Message:
MM: MM1: Finished Arrested view
Changed paths:
A engines/mm/mm1/game/arrested.cpp
A engines/mm/mm1/game/arrested.h
A engines/mm/mm1/views_enh/interactions/arrested.cpp
A engines/mm/mm1/views_enh/interactions/arrested.h
devtools/create_mm/files/mm1/strings_en.yml
engines/mm/mm1/views/maps/arrested.cpp
engines/mm/mm1/views/maps/arrested.h
engines/mm/mm1/views_enh/combat.cpp
engines/mm/mm1/views_enh/dialogs.h
engines/mm/mm1/views_enh/interactions/interaction.cpp
engines/mm/mm1/views_enh/interactions/interaction.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 f711f00af8f..e4635a37934 100644
--- a/devtools/create_mm/files/mm1/strings_en.yml
+++ b/devtools/create_mm/files/mm1/strings_en.yml
@@ -1081,10 +1081,16 @@ maps:
agar2: "\"You have done well to bring me this\nscroll. (+1000 exp) Now take it to my\nprotege Telgoran in Dusk.\""
agar3: "\"I have no business with you. Begone!\""
guards: "Town guards: you're under arrest!\n\na)Attack b)Bribe c)Run d)Surrender"
- sentence: "High court sentence: years= "
+ sentence: "High court sentence: Years= "
treasure: "Town treasure, steal (Y/N)?"
emap04:
- guards: "Town guards: you're under arrest!\n\nA) Attack B) Bribe C) Run D) Surrender"
+ town_guards: "Town Guards"
+ guards: "Town guards: you're under arrest!"
+ attack: "\x01""37Attack"
+ bribe: "\x01""37Bribe"
+ run: "\x01""37Run"
+ surrender: "\x01""37Surrender"
+ sentence: "High court sentence: %d years"
map05:
arena: "\"The Arena\""
diff --git a/engines/mm/mm1/game/arrested.cpp b/engines/mm/mm1/game/arrested.cpp
new file mode 100644
index 00000000000..21756ebdd8f
--- /dev/null
+++ b/engines/mm/mm1/game/arrested.cpp
@@ -0,0 +1,82 @@
+/* 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/game/arrested.h"
+#include "mm/mm1/maps/map04.h"
+#include "mm/mm1/globals.h"
+
+namespace MM {
+namespace MM1 {
+namespace Game {
+
+void Arrested::attack() {
+ Game::Encounter &enc = g_globals->_encounters;
+ int monsterCount = getRandomNumber(5);
+ g_events->close();
+
+ enc.clearMonsters();
+ for (int i = 0; i < monsterCount; ++i)
+ enc.addMonster(6, 10);
+
+ enc._manual = true;
+ enc._levelIndex = 64;
+ enc._encounterType = Game::FORCE_SURPRISED;
+ enc.execute();
+}
+
+void Arrested::bribe() {
+ if (getRandomNumber(10) == 10) {
+ // Success
+ g_events->close();
+ } else {
+ // 8 year sentence for attempted bribery
+ surrender(8);
+ }
+}
+
+void Arrested::run() {
+ g_events->close();
+ g_globals->_currCharacter = &g_globals->_party[
+ getRandomNumber(g_globals->_party.size()) - 1
+ ];
+ g_globals->_currCharacter->_condition = ERADICATED;
+
+ static_cast<MM1::Maps::Map04 *>(g_maps->_currentMap)->special08();
+}
+
+void Arrested::surrender(int numYears) {
+ g_events->close();
+
+ // Characters are aged by their prision sentence, and their gold halved
+ for (uint i = 0; i < g_globals->_party.size(); ++i) {
+ Character &c = g_globals->_party[i];
+
+ if ((int)c._age._base + numYears < 256)
+ c._age._base += numYears;
+ c._gold /= 2;
+ }
+
+ (*g_maps->_currentMap)[MAP04_TREASURE_STOLEN] = 0;
+}
+
+} // namespace Game
+} // namespace MM1
+} // namespace MM
diff --git a/engines/mm/mm1/game/arrested.h b/engines/mm/mm1/game/arrested.h
new file mode 100644
index 00000000000..2b6b9066b8d
--- /dev/null
+++ b/engines/mm/mm1/game/arrested.h
@@ -0,0 +1,45 @@
+/* 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_GAMES_ARRESTED_H
+#define MM1_GAMES_ARRESTED_H
+
+#include "mm/mm1/game/game_logic.h"
+
+namespace MM {
+namespace MM1 {
+namespace Game {
+
+class Arrested : public GameLogic {
+protected:
+ void attack();
+ void bribe();
+ void run();
+ void surrender(int numYears = 2);
+
+ Arrested() {}
+};
+
+} // namespace Game
+} // namespace MM1
+} // namespace MM
+
+#endif
diff --git a/engines/mm/mm1/views/maps/arrested.cpp b/engines/mm/mm1/views/maps/arrested.cpp
index bcd4ae5c0fb..f2f05200490 100644
--- a/engines/mm/mm1/views/maps/arrested.cpp
+++ b/engines/mm/mm1/views/maps/arrested.cpp
@@ -68,50 +68,8 @@ bool Arrested::msgKeypress(const KeypressMessage &msg) {
return true;
}
-void Arrested::attack() {
- Game::Encounter &enc = g_globals->_encounters;
- int monsterCount = getRandomNumber(5);
- close();
-
- enc.clearMonsters();
- for (int i = 0; i < monsterCount; ++i)
- enc.addMonster(6, 10);
-
- enc._manual = true;
- enc._levelIndex = 64;
- enc._encounterType = Game::FORCE_SURPRISED;
- enc.execute();
-}
-
-void Arrested::bribe() {
- if (getRandomNumber(10) == 10) {
- // Success
- close();
- } else {
- // 8 year sentence for attempted bribery
- surrender(8);
- }
-}
-
-void Arrested::run() {
- close();
- g_globals->_currCharacter = &g_globals->_party[
- getRandomNumber(g_globals->_party.size()) - 1
- ];
- g_globals->_currCharacter->_condition = ERADICATED;
-
- static_cast<MM1::Maps::Map04 *>(g_maps->_currentMap)->special08();
-}
-
void Arrested::surrender(int numYears) {
- // Characters are aged by their prision sentence, and their gold halved
- for (uint i = 0; i < g_globals->_party.size(); ++i) {
- Character &c = g_globals->_party[i];
-
- if ((int)c._age._base + numYears < 256)
- c._age._base += numYears;
- c._gold /= 2;
- }
+ Game::Arrested::surrender(numYears);
// Display sentence
clearSurface();
@@ -119,11 +77,10 @@ void Arrested::surrender(int numYears) {
writeString(0, 1, STRING["maps.map04.sentence"]);
writeNumber(numYears);
- (*g_maps->_currentMap)[MAP04_TREASURE_STOLEN] = 0;
delaySeconds(3);
}
-} // namespace Spells
+} // namespace Maps
} // namespace Views
} // namespace MM1
} // namespace MM
diff --git a/engines/mm/mm1/views/maps/arrested.h b/engines/mm/mm1/views/maps/arrested.h
index cfb89d418f7..09fa53c994b 100644
--- a/engines/mm/mm1/views/maps/arrested.h
+++ b/engines/mm/mm1/views/maps/arrested.h
@@ -23,17 +23,15 @@
#define MM1_VIEWS_MAPS_ARRESTED_H
#include "mm/mm1/views/text_view.h"
+#include "mm/mm1/game/arrested.h"
namespace MM {
namespace MM1 {
namespace Views {
namespace Maps {
-class Arrested : public TextView {
+class Arrested : public TextView, public MM1::Game::Arrested {
private:
- void attack();
- void bribe();
- void run();
void surrender(int numYears = 2);
public:
diff --git a/engines/mm/mm1/views_enh/combat.cpp b/engines/mm/mm1/views_enh/combat.cpp
index 3bdd03eaa21..16c345f10d0 100644
--- a/engines/mm/mm1/views_enh/combat.cpp
+++ b/engines/mm/mm1/views_enh/combat.cpp
@@ -563,7 +563,7 @@ void Combat::writeOption(uint col, uint row, char c, const Common::String &msg)
const int y = r.top;
const int textY = y + (BTN_SIZE - 8) / 2 + 1;
- // Create an 16x16 blank button
+ // Create a blank button
Graphics::ManagedSurface btnSmall(BTN_SIZE, BTN_SIZE);
btnSmall.blitFrom(g_globals->_blankButton, Common::Rect(0, 0, 20, 20),
Common::Rect(0, 0, BTN_SIZE, BTN_SIZE));
diff --git a/engines/mm/mm1/views_enh/dialogs.h b/engines/mm/mm1/views_enh/dialogs.h
index f3f7acc5b06..1165c5acbaa 100644
--- a/engines/mm/mm1/views_enh/dialogs.h
+++ b/engines/mm/mm1/views_enh/dialogs.h
@@ -49,6 +49,7 @@
#include "mm/mm1/views_enh/which_character.h"
#include "mm/mm1/views_enh/which_item.h"
#include "mm/mm1/views_enh/who_will_try.h"
+#include "mm/mm1/views_enh/interactions/arrested.h"
#include "mm/mm1/views_enh/interactions/resistances.h"
#include "mm/mm1/views_enh/interactions/statue.h"
#include "mm/mm1/views_enh/locations/blacksmith_items.h"
@@ -67,6 +68,7 @@ namespace ViewsEnh {
struct Dialogs {
private:
+ ViewsEnh::Interactions::Arrested _arrested;
ViewsEnh::Interactions::Resistances _resistances;
ViewsEnh::Interactions::Statue _statue;
ViewsEnh::Locations::Blacksmith _blacksmith;
diff --git a/engines/mm/mm1/views_enh/interactions/arrested.cpp b/engines/mm/mm1/views_enh/interactions/arrested.cpp
new file mode 100644
index 00000000000..8ffe3f0e1c8
--- /dev/null
+++ b/engines/mm/mm1/views_enh/interactions/arrested.cpp
@@ -0,0 +1,88 @@
+/* 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/interactions/Arrested.h"
+#include "mm/mm1/globals.h"
+
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+namespace Interactions {
+
+Arrested::Arrested() : Interaction("Arrested", 26), Game::Arrested() {
+ _title = STRING["maps.emap04.town_guards"];
+}
+
+bool Arrested::msgFocus(const FocusMessage &msg) {
+ addText(STRING["maps.emap04.guards"]);
+ clearButtons();
+ addButton(STRING["maps.emap04.attack"], 'A');
+ addButton(STRING["maps.emap04.bribe"], 'B');
+ addButton(STRING["maps.emap04.run"], 'R');
+ addButton(STRING["maps.emap04.surrender"], 'S');
+
+ return true;
+}
+
+void Arrested::viewAction() {
+ // If already chosen option, then any click closes dialog
+ if (_buttons.empty())
+ close();
+}
+
+bool Arrested::msgKeypress(const KeypressMessage &msg) {
+ switch (msg.keycode) {
+ case Common::KEYCODE_a:
+ attack();
+ break;
+ case Common::KEYCODE_b:
+ bribe();
+ break;
+ case Common::KEYCODE_r:
+ run();
+ break;
+ case Common::KEYCODE_s:
+ surrender();
+ break;
+ default:
+ return Interaction::msgKeypress(msg);
+ }
+
+ return true;
+}
+
+void Arrested::surrender(int numYears) {
+ Game::Arrested::surrender(numYears);
+
+ // Display sentence
+ Common::String str = Common::String::format(
+ STRING["maps.emap04.sentence"].c_str(), numYears);
+
+ SoundMessage msg(str);
+ msg._delaySeconds = 3;
+ send(msg);
+}
+
+} // namespace Interactions
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
diff --git a/engines/mm/mm1/views_enh/interactions/arrested.h b/engines/mm/mm1/views_enh/interactions/arrested.h
new file mode 100644
index 00000000000..bbd25fa6c93
--- /dev/null
+++ b/engines/mm/mm1/views_enh/interactions/arrested.h
@@ -0,0 +1,58 @@
+/* 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_INTERACTIONS_ARRESTED_H
+#define MM1_VIEWS_ENH_INTERACTIONS_ARRESTED_H
+
+#include "mm/mm1/views_enh/interactions/interaction.h"
+#include "mm/mm1/game/arrested.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+namespace Interactions {
+
+class Arrested : public Interaction, public MM1::Game::Arrested {
+protected:
+ void surrender(int numYears = 2);
+
+ /**
+ * Handles any action/press
+ */
+ void viewAction() override;
+
+public:
+ Arrested();
+
+ /**
+ * Handles focus
+ */
+ bool msgFocus(const FocusMessage &msg) override;
+
+ bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
+
+#endif
diff --git a/engines/mm/mm1/views_enh/interactions/interaction.cpp b/engines/mm/mm1/views_enh/interactions/interaction.cpp
index 2b58665001f..8b4f486d8c1 100644
--- a/engines/mm/mm1/views_enh/interactions/interaction.cpp
+++ b/engines/mm/mm1/views_enh/interactions/interaction.cpp
@@ -30,6 +30,8 @@ namespace MM1 {
namespace ViewsEnh {
namespace Interactions {
+#define BTN_SIZE 10
+
Interaction::Interaction(const Common::String &name, int portrait) : PartyView(name) {
_bounds = Common::Rect(8, 8, 224, 140);
_frame.load("frame.fac");
@@ -61,14 +63,53 @@ void Interaction::draw() {
_frame.draw(&s, 0, Common::Point(8, 8));
_portrait.draw(&s, _portraitFrameNum, Common::Point(15, 14));
+ setReduced(false);
if (!_title.empty()) {
size_t strWidth = getStringWidth(_title);
writeString(125 - strWidth / 2, 20, _title);
}
+ // Write any text lines
for (uint i = 0; i < _lines.size(); ++i) {
writeLine(i, _lines[i], ALIGN_MIDDLE);
}
+
+ // Write out any buttons
+ if (!_buttons.empty()) {
+ _textPos = Common::Point(0, (8 + _lines.size()) * 8);
+ setReduced(true);
+
+ // Create a blank button
+ Graphics::ManagedSurface btnSmall(BTN_SIZE, BTN_SIZE);
+ btnSmall.blitFrom(g_globals->_blankButton, Common::Rect(0, 0, 20, 20),
+ Common::Rect(0, 0, BTN_SIZE, BTN_SIZE));
+
+ for (uint i = 0; i < _buttons.size(); ++i, _textPos.x += 10) {
+ InteractionButton &btn = _buttons[i];
+
+ int itemWidth = BTN_SIZE + 5 + getStringWidth(_buttons[i]._text);
+ if ((_textPos.x + itemWidth) > _innerBounds.width()) {
+ _textPos.x = 0;
+ _textPos.y += BTN_SIZE + 2;
+ }
+ Common::Point pt = _textPos;
+
+ // Display button and write character in the middle
+ s.blitFrom(btnSmall, Common::Point(pt.x + _bounds.borderSize(),
+ pt.y + _bounds.borderSize()));
+
+ writeString(pt.x + (BTN_SIZE / 2) + 1, pt.y,
+ Common::String::format("%c", _buttons[i]._c), ALIGN_MIDDLE);
+
+ // Write text to the right of the button
+ writeString(pt.x + BTN_SIZE + 5, pt.y, _buttons[i]._text);
+
+ // Set up bounds for the area covered by the button & text
+ btn._bounds = Common::Rect(pt.x, pt.y,
+ pt.x + BTN_SIZE + 5 + itemWidth, pt.y + BTN_SIZE);
+ btn._bounds.translate(_innerBounds.left, _innerBounds.top);
+ }
+ }
}
bool Interaction::tick() {
@@ -117,6 +158,18 @@ bool Interaction::msgAction(const ActionMessage &msg) {
bool Interaction::msgMouseDown(const MouseDownMessage &msg) {
if (!PartyView::msgMouseDown(msg)) {
+ // Check if a button was pressed
+ for (uint i = 0; i < _buttons.size(); ++i) {
+ const auto &btn = _buttons[i];
+ if (_buttons[i]._bounds.contains(msg._pos)) {
+ msgKeypress(KeypressMessage(Common::KeyState(
+ (Common::KeyCode)(Common::KEYCODE_a + btn._c - 'A'), btn._c
+ )));
+ return true;
+ }
+ }
+
+ // Fall back on treating click as a standard acknowledgement
viewAction();
}
diff --git a/engines/mm/mm1/views_enh/interactions/interaction.h b/engines/mm/mm1/views_enh/interactions/interaction.h
index 1585350ee84..e0faed0ac92 100644
--- a/engines/mm/mm1/views_enh/interactions/interaction.h
+++ b/engines/mm/mm1/views_enh/interactions/interaction.h
@@ -31,6 +31,14 @@ namespace ViewsEnh {
namespace Interactions {
class Interaction : public PartyView {
+ struct InteractionButton {
+ Common::String _text;
+ char _c = '\0';
+ Common::Rect _bounds;
+ InteractionButton() {}
+ InteractionButton(const Common::String &text, char c) :
+ _text(text), _c(c) {}
+ };
private:
Shared::Xeen::SpriteResource _frame;
Shared::Xeen::SpriteResource _portrait;
@@ -39,6 +47,8 @@ private:
protected:
Common::String _title;
Common::StringArray _lines;
+ Common::Array<InteractionButton> _buttons;
+
bool _animated = true;
int _portraitNum = 0;
protected:
@@ -58,6 +68,20 @@ protected:
*/
void addText(const Common::String &str);
+ /**
+ * Clear the buttons
+ */
+ void clearButtons() {
+ _buttons.clear();
+ }
+
+ /**
+ * Adds a button
+ */
+ void addButton(const Common::String &str, char c) {
+ _buttons.push_back(InteractionButton(str, c));
+ }
+
/**
* Write out a line
*/
diff --git a/engines/mm/module.mk b/engines/mm/module.mk
index 02477443db2..53421b68aa3 100644
--- a/engines/mm/module.mk
+++ b/engines/mm/module.mk
@@ -36,6 +36,7 @@ MODULE_OBJS += \
mm1/data/text_parser.o \
mm1/data/trap.o \
mm1/data/treasure.o \
+ mm1/game/arrested.o \
mm1/game/game_logic.o \
mm1/game/combat.o \
mm1/game/encounter.o \
@@ -168,6 +169,7 @@ MODULE_OBJS += \
mm1/views_enh/which_item.o \
mm1/views_enh/who_will_try.o \
mm1/views_enh/yes_no.o \
+ mm1/views_enh/interactions/arrested.o \
mm1/views_enh/interactions/interaction.o \
mm1/views_enh/interactions/resistances.o \
mm1/views_enh/interactions/statue.o \
More information about the Scummvm-git-logs
mailing list