[Scummvm-git-logs] scummvm master -> 648edf3bf94b95daf10a84b1f10f1816062eb9f9
dreammaster
noreply at scummvm.org
Thu Mar 2 07:28:06 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:
950ca3745d MM: MM1: Added Tavern view
357d402030 MM: MM1: Beginngs of enhanced mode inn screen
648edf3bf9 MM: MM1: More Inn display, toggling inclusion in party
Commit: 950ca3745dbd851dabbdf98bb962efbc1e3981ea
https://github.com/scummvm/scummvm/commit/950ca3745dbd851dabbdf98bb962efbc1e3981ea
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-03-01T23:27:48-08:00
Commit Message:
MM: MM1: Added Tavern view
Changed paths:
A engines/mm/mm1/views_enh/locations/tavern.cpp
A engines/mm/mm1/views_enh/locations/tavern.h
devtools/create_mm/files/mm1/strings_en.yml
engines/mm/mm1/views_enh/dialogs.h
engines/mm/mm1/views_enh/locations/training.cpp
engines/mm/mm1/views_enh/locations/training.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 7d13522208e..3b5c772c4be 100644
--- a/devtools/create_mm/files/mm1/strings_en.yml
+++ b/devtools/create_mm/files/mm1/strings_en.yml
@@ -516,6 +516,12 @@ enhdialogs:
select: "Select"
exit: "Exit"
non_caster: "Not a spell caster..."
+ tavern:
+ title: "Tavern"
+ drink: "\x01""37Drink"
+ gather: "\x01""37Gather"
+ tip: "\x01""37Tip"
+ rumor: "\x01""37Rumors"
temple:
title: "Temple"
heal: "\x01""37Heal"
diff --git a/engines/mm/mm1/views_enh/dialogs.h b/engines/mm/mm1/views_enh/dialogs.h
index 13be24d3482..00fea4abc16 100644
--- a/engines/mm/mm1/views_enh/dialogs.h
+++ b/engines/mm/mm1/views_enh/dialogs.h
@@ -36,6 +36,7 @@
#include "mm/mm1/views_enh/quick_ref.h"
#include "mm/mm1/views_enh/interactions/statue.h"
#include "mm/mm1/views_enh/locations/market.h"
+#include "mm/mm1/views_enh/locations/tavern.h"
#include "mm/mm1/views_enh/locations/temple.h"
#include "mm/mm1/views_enh/locations/training.h"
#include "mm/mm1/views_enh/spells/cast_spell.h"
@@ -54,6 +55,7 @@ private:
Views::Title _title;
ViewsEnh::Interactions::Statue _statue;
ViewsEnh::Locations::Market _market;
+ ViewsEnh::Locations::Tavern _tavern;
ViewsEnh::Locations::Temple _temple;
ViewsEnh::Locations::Training _training;
ViewsEnh::Spells::CastSpell _castSpell;
diff --git a/engines/mm/mm1/views_enh/locations/tavern.cpp b/engines/mm/mm1/views_enh/locations/tavern.cpp
new file mode 100644
index 00000000000..b501263865f
--- /dev/null
+++ b/engines/mm/mm1/views_enh/locations/tavern.cpp
@@ -0,0 +1,168 @@
+/* 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/locations/tavern.h"
+#include "mm/mm1/globals.h"
+#include "mm/mm1/mm1.h"
+#include "mm/mm1/sound.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+namespace Locations {
+
+Tavern::Tavern() : Location("Tavern", LOC_TAVERN) {
+ addButton(&_escSprite, Common::Point(24, 100), 0, KEYBIND_ESCAPE);
+}
+
+void Tavern::draw() {
+ Location::draw();
+ const Character &c = *g_globals->_currCharacter;
+
+ setReduced(false);
+ writeLine(0, STRING["enhdialogs.tavern.title"], ALIGN_MIDDLE);
+ writeLine(1, STRING["enhdialogs.location.options_for"], ALIGN_MIDDLE);
+ writeLine(3, c._name, ALIGN_MIDDLE);
+
+ writeLine(5, STRING["enhdialogs.tavern.drink"], ALIGN_LEFT, 10);
+ writeLine(6, STRING["enhdialogs.tavern.gather"], ALIGN_LEFT, 10);
+ writeLine(7, STRING["enhdialogs.tavern.tip"], ALIGN_LEFT, 10);
+ writeLine(8, STRING["enhdialogs.tavern.rumor"], ALIGN_LEFT, 10);
+
+ writeLine(10, STRING["enhdialogs.location.gold"]);
+ writeLine(10, Common::String::format("%d",
+ g_globals->_currCharacter->_gold), ALIGN_RIGHT);
+
+ setReduced(true);
+ writeString(27, 122, STRING["enhdialogs.location.esc"]);
+}
+
+bool Tavern::msgGame(const GameMessage &msg) {
+ Location::msgGame(msg);
+/*
+ if (msg._name == "UPDATE")
+ checkCharacter();
+ */
+ return true;
+}
+
+bool Tavern::msgKeypress(const KeypressMessage &msg) {
+ // If a delay is active, end it
+ if (endDelay())
+ return true;
+
+ switch (msg.keycode) {
+ case Common::KEYCODE_d:
+ haveADrink();
+ break;
+ case Common::KEYCODE_g:
+ g_globals->_currCharacter->gatherGold();
+ redraw();
+ break;
+ case Common::KEYCODE_t:
+ tipBartender();
+ break;
+ case Common::KEYCODE_r:
+ listenForRumors();
+ break;
+ default:
+ return Location::msgKeypress(msg);
+ break;
+ }
+
+ return true;
+}
+
+bool Tavern::msgAction(const ActionMessage &msg) {
+ if (endDelay())
+ return true;
+
+ if (msg._action == KEYBIND_ESCAPE) {
+ leave();
+ return true;
+ }
+
+ return Location::msgAction(msg);
+}
+
+void Tavern::messageShown() {
+ redraw();
+}
+
+
+void Tavern::haveADrink() {
+ if (g_globals->_currCharacter->_condition) {
+ Sound::sound(SOUND_2);
+ displayMessage(STRING["dialogs.tavern.terrible"]);
+
+ } else if (subtractGold(1)) {
+ if (++g_globals->_currCharacter->_numDrinks < 3 ||
+ g_engine->getRandomNumber(10) <
+ g_globals->_currCharacter->_endurance) {
+ displayMessage(STRING["dialogs.tavern.great_stuff"]);
+
+ } else {
+ if (!(g_globals->_currCharacter->_condition & BAD_CONDITION))
+ g_globals->_currCharacter->_condition |= POISONED;
+
+ Sound::sound(SOUND_2);
+ displayMessage(STRING["dialogs.tavern.you_feel_sick"]);
+ }
+ }
+}
+
+void Tavern::tipBartender() {
+ if (g_globals->_currCharacter->_condition) {
+ displayMessage(STRING["dialogs.tavern.go_see_clerics"]);
+
+ } else if (subtractGold(1)) {
+ if (g_globals->_currCharacter->_numDrinks == 0) {
+ displayMessage(STRING["dialogs.tavern.have_a_drink"]);
+
+ } else if (g_engine->getRandomNumber(3) != 3) {
+ displayMessage(STRING["dialogs.tavern.have_another_round"]);
+
+ } else {
+ int townNum = g_maps->_currentMap->dataByte(Maps::MAP_ID);
+ displayMessage(STRING[Common::String::format(
+ "dialogs.tavern.tips.%d_%d",
+ townNum, g_globals->_currCharacter->_numDrinks
+ )]);
+ }
+ }
+}
+
+void Tavern::listenForRumors() {
+ Common::String msg = STRING["dialogs.tavern.rumors.none"];
+ if (!g_globals->_heardRumor) {
+ g_globals->_heardRumor = true;
+ msg = STRING[Common::String::format(
+ "dialogs.tavern.rumors.%d",
+ g_engine->getRandomNumber(16))];
+ }
+
+ displayMessage(msg);
+}
+
+} // namespace Location
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
diff --git a/engines/mm/mm1/views_enh/locations/tavern.h b/engines/mm/mm1/views_enh/locations/tavern.h
new file mode 100644
index 00000000000..a751b260b24
--- /dev/null
+++ b/engines/mm/mm1/views_enh/locations/tavern.h
@@ -0,0 +1,65 @@
+/* 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_LOCATIONS_TAVERN_H
+#define MM1_VIEWS_ENH_LOCATIONS_TAVERN_H
+
+#include "mm/mm1/views_enh/locations/location.h"
+#include "mm/mm1/data/character.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+namespace Locations {
+
+class Tavern : public Location {
+private:
+ /**
+ * Have a drink
+ */
+ void haveADrink();
+
+ /**
+ * Tip the bartender
+ */
+ void tipBartender();
+
+ /**
+ * Listen for rumors
+ */
+ void listenForRumors();
+
+public:
+ Tavern();
+
+ void draw() override;
+ bool msgGame(const GameMessage &msg);
+ bool msgKeypress(const KeypressMessage &msg) override;
+ bool msgAction(const ActionMessage &msg) override;
+ void messageShown() override;
+};
+
+} // namespace Locations
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
+
+#endif
diff --git a/engines/mm/mm1/views_enh/locations/training.cpp b/engines/mm/mm1/views_enh/locations/training.cpp
index 986b1c9ef99..d45ef0b4ca5 100644
--- a/engines/mm/mm1/views_enh/locations/training.cpp
+++ b/engines/mm/mm1/views_enh/locations/training.cpp
@@ -197,11 +197,6 @@ void Training::train() {
}
}
-void Training::timeout() {
- checkCharacter();
- Location::timeout();
-}
-
void Training::messageShown() {
checkCharacter();
redraw();
diff --git a/engines/mm/mm1/views_enh/locations/training.h b/engines/mm/mm1/views_enh/locations/training.h
index 40f59361032..f59dd239e3f 100644
--- a/engines/mm/mm1/views_enh/locations/training.h
+++ b/engines/mm/mm1/views_enh/locations/training.h
@@ -61,7 +61,6 @@ public:
bool msgGame(const GameMessage &msg);
bool msgKeypress(const KeypressMessage &msg) override;
bool msgAction(const ActionMessage &msg) override;
- void timeout() override;
void messageShown() override;
};
diff --git a/engines/mm/module.mk b/engines/mm/module.mk
index d3eb315d750..de16235aa71 100644
--- a/engines/mm/module.mk
+++ b/engines/mm/module.mk
@@ -146,6 +146,7 @@ MODULE_OBJS += \
mm1/views_enh/interactions/statue.o \
mm1/views_enh/locations/location.o \
mm1/views_enh/locations/market.o \
+ mm1/views_enh/locations/tavern.o \
mm1/views_enh/locations/temple.o \
mm1/views_enh/locations/training.o \
mm1/maps/maps.o \
Commit: 357d402030cdc2f8e2930faa671b810e7f8b1607
https://github.com/scummvm/scummvm/commit/357d402030cdc2f8e2930faa671b810e7f8b1607
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-03-01T23:27:48-08:00
Commit Message:
MM: MM1: Beginngs of enhanced mode inn screen
Changed paths:
A engines/mm/mm1/views_enh/locations/inn.cpp
A engines/mm/mm1/views_enh/locations/inn.h
devtools/create_mm/files/mm1/strings_en.yml
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 3b5c772c4be..116b9b0c5f8 100644
--- a/devtools/create_mm/files/mm1/strings_en.yml
+++ b/devtools/create_mm/files/mm1/strings_en.yml
@@ -90,12 +90,12 @@ dialogs:
5: "inn in which you stayed"
6: "by pressing 'enter'"
inn:
- title: "(%c) inn of "
+ title: "(%c) Inn of "
to_view: "to view"
- ctrl: "(ctrl)-"
- add_remove: "add/remove"
- exit: "'x' exit inn"
- full: "*** party is full ***"
+ ctrl: "(Ctrl)-"
+ add_remove: "Add/Remove"
+ exit: "'x' Exit inn"
+ full: "*** Party is full ***"
main_menu:
title1: "Might and Magic"
title2: "Secret of the Inner Sanctum"
diff --git a/engines/mm/mm1/views_enh/dialogs.h b/engines/mm/mm1/views_enh/dialogs.h
index 00fea4abc16..599b478ed4e 100644
--- a/engines/mm/mm1/views_enh/dialogs.h
+++ b/engines/mm/mm1/views_enh/dialogs.h
@@ -35,6 +35,7 @@
#include "mm/mm1/views_enh/map_popup.h"
#include "mm/mm1/views_enh/quick_ref.h"
#include "mm/mm1/views_enh/interactions/statue.h"
+#include "mm/mm1/views_enh/locations/inn.h"
#include "mm/mm1/views_enh/locations/market.h"
#include "mm/mm1/views_enh/locations/tavern.h"
#include "mm/mm1/views_enh/locations/temple.h"
@@ -50,10 +51,10 @@ struct Dialogs {
private:
Views::Characters _characters;
Views::CreateCharacters _createCharacters;
- Views::Locations::Inn _inn;
Views::Protect _protect;
Views::Title _title;
ViewsEnh::Interactions::Statue _statue;
+ ViewsEnh::Locations::Inn _inn;
ViewsEnh::Locations::Market _market;
ViewsEnh::Locations::Tavern _tavern;
ViewsEnh::Locations::Temple _temple;
diff --git a/engines/mm/mm1/views_enh/locations/inn.cpp b/engines/mm/mm1/views_enh/locations/inn.cpp
new file mode 100644
index 00000000000..238be19904a
--- /dev/null
+++ b/engines/mm/mm1/views_enh/locations/inn.cpp
@@ -0,0 +1,161 @@
+/* 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/locations/inn.h"
+#include "mm/mm1/globals.h"
+#include "mm/mm1/mm1.h"
+#include "mm/mm1/sound.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+namespace Locations {
+
+Inn::Inn() : ScrollView("Inn") {
+ _bounds.setBorderSize(10);
+}
+
+bool Inn::msgFocus(const FocusMessage &msg) {
+ if (g_maps->_currentMap)
+ // Update the starting town
+ g_globals->_startingTown = (Maps::TownId)g_maps->_currentMap->dataByte(Maps::MAP_ID);
+
+ // Save the roster
+ g_globals->_roster.update(_partyChars);
+ g_globals->_roster.save();
+
+ // Get a list of characters in the town
+ _charNums.clear();
+ for (uint i = 0; i < ROSTER_COUNT; ++i) {
+ if (g_globals->_roster._towns[i] == g_globals->_startingTown)
+ _charNums.push_back(i);
+ }
+
+ // Build up a list of characters in the party
+ // (for if we're opening the inn from in-game)
+ _partyChars.clear();
+ for (uint i = 0; i < g_globals->_party.size(); ++i) {
+ for (uint j = 0; j < ROSTER_COUNT; ++j) {
+ if (g_globals->_roster[j] == g_globals->_party[i]) {
+ _partyChars.push_back(j);
+ break;
+ }
+ }
+ }
+
+ return true;
+}
+
+void Inn::draw() {
+ ScrollView::draw();
+ Graphics::ManagedSurface s = getSurface();
+
+ // Write title
+ Common::String title = Common::String::format(
+ STRING["dialogs.inn.title"].c_str(),
+ '0' + g_globals->_startingTown);
+ title += STRING[Common::String::format(
+ "stats.towns.%d", g_globals->_startingTown)];
+ setReduced(false);
+ writeString(0, 0, title, ALIGN_MIDDLE);
+
+ if (_charNums.empty()) {
+ writeString(0, 40, STRING["dialogs.misc.no_characters"], ALIGN_MIDDLE);
+
+ } else {
+ // Write out the roster
+ setReduced(true);
+
+ for (uint idx = 0; idx < _charNums.size(); ++idx) {
+ uint charNum = _charNums[idx];
+ Character &c = g_globals->_roster[charNum];
+
+ Common::Point pt(_innerBounds.left + _innerBounds.width() / 3
+ * (idx % 3), 20 + 30 * (idx / 3));
+ c._faceSprites.draw(&s, 0, pt);
+ writeString(pt.x + 30, pt.y + 10, c._name);
+ }
+ }
+}
+
+bool Inn::msgKeypress(const KeypressMessage &msg) {
+ if (msg.keycode >= Common::KEYCODE_a &&
+ msg.keycode < (Common::KeyCode)(Common::KEYCODE_a + _charNums.size())) {
+ int charNum = _charNums[msg.keycode - Common::KEYCODE_a];
+
+ if (msg.flags & Common::KBD_CTRL) {
+ // Toggle in party
+ if (_partyChars.contains(charNum))
+ _partyChars.remove(charNum);
+ else
+ _partyChars.push_back(charNum);
+
+ redraw();
+
+ } else if (msg.flags == 0) {
+ // View character
+ g_globals->_currCharacter = &g_globals->_roster[charNum];
+ //_characterView.addView();
+ }
+ return true;
+
+ } else if (msg.keycode == Common::KEYCODE_x) {
+ exitInn();
+ return true;
+ }
+
+ return false;
+}
+
+bool Inn::msgAction(const ActionMessage &msg) {
+ switch (msg._action) {
+ case KEYBIND_ESCAPE:
+ replaceView("MainMenu");
+ return true;
+ case KEYBIND_SELECT:
+ exitInn();
+ return true;
+ default:
+ break;
+ }
+
+ return false;
+}
+
+void Inn::exitInn() {
+ if (_partyChars.empty())
+ return;
+
+ // Load party from selected characters
+ g_globals->_party.clear();
+ for (uint i = 0; i < _partyChars.size(); ++i)
+ g_globals->_party.push_back(
+ g_globals->_roster[_partyChars[i]]);
+ g_globals->_currCharacter = &g_globals->_party.front();
+
+ // Load the given town
+ g_globals->_maps.loadTown(g_globals->_startingTown);
+}
+
+} // namespace Location
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
diff --git a/engines/mm/mm1/views_enh/locations/inn.h b/engines/mm/mm1/views_enh/locations/inn.h
new file mode 100644
index 00000000000..64b129094f6
--- /dev/null
+++ b/engines/mm/mm1/views_enh/locations/inn.h
@@ -0,0 +1,57 @@
+/* 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_LOCATIONS_INN_H
+#define MM1_VIEWS_ENH_LOCATIONS_INN_H
+
+#include "mm/mm1/views_enh/locations/location.h"
+#include "mm/mm1/data/character.h"
+#include "mm/mm1/data/int_array.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+namespace Locations {
+
+class Inn : public ScrollView {
+private:
+ Common::Array<uint> _charNums;
+ IntArray _partyChars;
+
+ /**
+ * Exit the Inn
+ */
+ void exitInn();
+public:
+ Inn();
+
+ bool msgFocus(const FocusMessage &msg) override;
+ void draw() override;
+ bool msgKeypress(const KeypressMessage &msg) override;
+ bool msgAction(const ActionMessage &msg) override;
+};
+
+} // namespace Locations
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
+
+#endif
diff --git a/engines/mm/module.mk b/engines/mm/module.mk
index de16235aa71..0c4ef2650ec 100644
--- a/engines/mm/module.mk
+++ b/engines/mm/module.mk
@@ -144,6 +144,7 @@ MODULE_OBJS += \
mm1/views_enh/text_view.o \
mm1/views_enh/interactions/interaction.o \
mm1/views_enh/interactions/statue.o \
+ mm1/views_enh/locations/inn.o \
mm1/views_enh/locations/location.o \
mm1/views_enh/locations/market.o \
mm1/views_enh/locations/tavern.o \
Commit: 648edf3bf94b95daf10a84b1f10f1816062eb9f9
https://github.com/scummvm/scummvm/commit/648edf3bf94b95daf10a84b1f10f1816062eb9f9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-03-01T23:27:48-08:00
Commit Message:
MM: MM1: More Inn display, toggling inclusion in party
Changed paths:
devtools/create_mm/files/mm1/strings_en.yml
engines/mm/mm1/views_enh/locations/inn.cpp
engines/mm/mm1/views_enh/locations/inn.h
diff --git a/devtools/create_mm/files/mm1/strings_en.yml b/devtools/create_mm/files/mm1/strings_en.yml
index 116b9b0c5f8..794c867a830 100644
--- a/devtools/create_mm/files/mm1/strings_en.yml
+++ b/devtools/create_mm/files/mm1/strings_en.yml
@@ -516,6 +516,10 @@ enhdialogs:
select: "Select"
exit: "Exit"
non_caster: "Not a spell caster..."
+ inn:
+ left_click: "Left click potraits to add/remove"
+ right_click: "Right click to view"
+ esc: "ESC to go back"
tavern:
title: "Tavern"
drink: "\x01""37Drink"
diff --git a/engines/mm/mm1/views_enh/locations/inn.cpp b/engines/mm/mm1/views_enh/locations/inn.cpp
index 238be19904a..20dca590e5b 100644
--- a/engines/mm/mm1/views_enh/locations/inn.cpp
+++ b/engines/mm/mm1/views_enh/locations/inn.cpp
@@ -87,13 +87,56 @@ void Inn::draw() {
for (uint idx = 0; idx < _charNums.size(); ++idx) {
uint charNum = _charNums[idx];
Character &c = g_globals->_roster[charNum];
+ bool isInParty = _partyChars.contains(charNum);
+
+ // Build up character portrait and/or frame
+ Graphics::ManagedSurface portrait;
+ portrait.create(30, 30);
+ c._faceSprites.draw(&portrait, 0, Common::Point(0, 0));
Common::Point pt(_innerBounds.left + _innerBounds.width() / 3
- * (idx % 3), 20 + 30 * (idx / 3));
- c._faceSprites.draw(&s, 0, pt);
- writeString(pt.x + 30, pt.y + 10, c._name);
+ * (idx % 3), 20 + 20 * (idx / 3));
+ s.blitFrom(portrait, Common::Rect(0, 0, 30, 30),
+ Common::Rect(pt.x + 2, pt.y + 2, pt.x + 17, pt.y + 17));
+
+ if (isInParty)
+ s.frameRect(Common::Rect(pt.x, pt.y, pt.x + 19, pt.y + 19), 37);
+
+ writeString(pt.x - _innerBounds.left + 22, pt.y - _innerBounds.top + 5, c._name);
+ }
+
+ setReduced(false);
+ if (_partyChars.size() == 6)
+ writeString(0, 130, STRING["dialogs.inn.full"], ALIGN_MIDDLE);
+
+ writeString(0, 145, STRING["enhdialogs.inn.left_click"], ALIGN_MIDDLE);
+ writeString(0, 155, STRING["enhdialogs.inn.right_click"], ALIGN_MIDDLE);
+
+ if (!_partyChars.empty())
+ writeString(0, 170, STRING["dialogs.inn.exit"], ALIGN_MIDDLE);
+ }
+}
+
+bool Inn::msgMouseDown(const MouseDownMessage &msg) {
+ // Cycle through portraits
+ for (uint idx = 0; idx < _charNums.size(); ++idx) {
+ Common::Point pt(_innerBounds.left + _innerBounds.width() / 3
+ * (idx % 3), 20 + 20 * (idx / 3));
+
+ if (Common::Rect(pt.x, pt.y, pt.x + 19, pt.y + 19).contains(msg._pos)) {
+ // Toggle in party
+ int charNum = _charNums[idx];
+ if (_partyChars.contains(charNum))
+ _partyChars.remove(charNum);
+ else
+ _partyChars.push_back(charNum);
+
+ redraw();
+ break;
}
}
+
+ return true;
}
bool Inn::msgKeypress(const KeypressMessage &msg) {
diff --git a/engines/mm/mm1/views_enh/locations/inn.h b/engines/mm/mm1/views_enh/locations/inn.h
index 64b129094f6..dd9214d7c2f 100644
--- a/engines/mm/mm1/views_enh/locations/inn.h
+++ b/engines/mm/mm1/views_enh/locations/inn.h
@@ -45,6 +45,7 @@ public:
bool msgFocus(const FocusMessage &msg) override;
void draw() override;
+ bool msgMouseDown(const MouseDownMessage &msg) override;
bool msgKeypress(const KeypressMessage &msg) override;
bool msgAction(const ActionMessage &msg) override;
};
More information about the Scummvm-git-logs
mailing list