[Scummvm-git-logs] scummvm master -> c21470038a804d4678495aa98a0fe941ec1a5bbc
dreammaster
noreply at scummvm.org
Wed Apr 5 04:54:52 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:
c21470038a MM: MM1: Add prisoner interactions
Commit: c21470038a804d4678495aa98a0fe941ec1a5bbc
https://github.com/scummvm/scummvm/commit/c21470038a804d4678495aa98a0fe941ec1a5bbc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-04-04T21:54:43-07:00
Commit Message:
MM: MM1: Add prisoner interactions
Changed paths:
A engines/mm/mm1/views_enh/interactions/prisoners.cpp
A engines/mm/mm1/views_enh/interactions/prisoners.h
devtools/create_mm/files/mm1/strings_en.yml
engines/mm/mm1/views_enh/dialogs.h
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 0ac63af7ecb..a5b1924ce3f 100644
--- a/devtools/create_mm/files/mm1/strings_en.yml
+++ b/devtools/create_mm/files/mm1/strings_en.yml
@@ -1165,12 +1165,17 @@ maps:
pit: "Pit of bubbling lava!"
levitation: "Levitation saves you."
virgin: "A luscious virgin shackled to the wall!\na) Kiss her b) Release her c) Leave"
- tip1: "Try setting 1b,2j"
+ tip1: "Try setting 1B,2J"
tip2: "This cavern is random until the dials\nare set."
- dial: "Stabilization dial #%c set (a-z)?"
+ dial: "Stabilization dial #%c set (A-Z)?"
poof: "Poof! You've been teleported..."
ladder: "A ladder going up, take it (Y/N)?"
-
+ emap11:
+ virgin: "A luscious virgin shackled to the wall!"
+ option_a: "Kiss her"
+ option_b: "Release her"
+ option_c: "Leave"
+
map12:
ladder_up: "Ladder up, climb (Y/N)?"
polyhedron1: "Atop a crystal pyramid spins a glowing\npolyhedron. Stop it on side (1-9)?"
diff --git a/engines/mm/mm1/views_enh/dialogs.h b/engines/mm/mm1/views_enh/dialogs.h
index dd6f541bc14..75dbc043f21 100644
--- a/engines/mm/mm1/views_enh/dialogs.h
+++ b/engines/mm/mm1/views_enh/dialogs.h
@@ -51,6 +51,7 @@
#include "mm/mm1/views_enh/who_will_try.h"
#include "mm/mm1/views_enh/interactions/access_code.h"
#include "mm/mm1/views_enh/interactions/arrested.h"
+#include "mm/mm1/views_enh/interactions/prisoners.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"
@@ -73,6 +74,14 @@ private:
ViewsEnh::Interactions::Arrested _arrested;
ViewsEnh::Interactions::Resistances _resistances;
ViewsEnh::Interactions::Statue _statue;
+ ViewsEnh::Interactions::ChildPrisoner _childPrisoner;
+ ViewsEnh::Interactions::CloakedPrisoner _cloakedPrisoner;
+ ViewsEnh::Interactions::DemonPrisoner _demonPrisoner;
+ ViewsEnh::Interactions::MaidenPrisoner _maidenPrisoner;
+ ViewsEnh::Interactions::ManPrisoner _manPrisoner;
+ ViewsEnh::Interactions::MutatedPrisoner _mutatedPrisoner;
+ ViewsEnh::Interactions::VirginPrisoner _virginPrisoner;
+
ViewsEnh::Locations::Blacksmith _blacksmith;
ViewsEnh::Locations::BlacksmithItems _blacksmithItems;
ViewsEnh::Locations::Inn _inn;
diff --git a/engines/mm/mm1/views_enh/interactions/interaction.h b/engines/mm/mm1/views_enh/interactions/interaction.h
index 6e53391d309..ef9c7528701 100644
--- a/engines/mm/mm1/views_enh/interactions/interaction.h
+++ b/engines/mm/mm1/views_enh/interactions/interaction.h
@@ -37,7 +37,7 @@ class Interaction : public PartyView {
Common::Rect _bounds;
InteractionButton() {}
InteractionButton(const Common::String &text, char c) :
- _text(text), _c(c) {}
+ _text(text), _c(toupper(c)) {}
};
private:
Shared::Xeen::SpriteResource _frame;
diff --git a/engines/mm/mm1/views_enh/interactions/prisoners.cpp b/engines/mm/mm1/views_enh/interactions/prisoners.cpp
new file mode 100644
index 00000000000..0eefbe952e4
--- /dev/null
+++ b/engines/mm/mm1/views_enh/interactions/prisoners.cpp
@@ -0,0 +1,174 @@
+/* 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/prisoners.h"
+#include "mm/mm1/maps/map11.h"
+#include "mm/mm1/globals.h"
+#include "mm/mm1/sound.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+namespace Interactions {
+
+Prisoner::Prisoner(const Common::String &name, int portrait, const Common::String &line1,
+ byte flag, Alignment freeAlignment, Alignment leaveAlignment) :
+ Interaction(name, portrait), _flag(flag),
+ _freeAlignment(freeAlignment), _leaveAlignment(leaveAlignment) {
+ addText(line1);
+ addButton(STRING["maps.prisoners.options1"], '1');
+ addButton(STRING["maps.prisoners.options2"], '2');
+ addButton(STRING["maps.prisoners.options3"], '3');
+}
+
+bool Prisoner::msgKeypress(const KeypressMessage &msg) {
+ if (endDelay())
+ return true;
+
+ if (msg.keycode < Common::KEYCODE_1 || msg.keycode > Common::KEYCODE_3)
+ return true;
+
+ Common::String line;
+ int align;
+ switch (msg.keycode) {
+ case Common::KEYCODE_1:
+ line = STRING["maps.prisoners.flees"];
+ align = _freeAlignment;
+ g_maps->clearSpecial();
+ flee();
+ break;
+
+ case Common::KEYCODE_2:
+ line = STRING["maps.prisoners.cowers"];
+ align = _leaveAlignment;
+ break;
+
+ default:
+ align = NEUTRAL;
+ break;
+ }
+
+ for (uint i = 0; i < g_globals->_party.size(); ++i) {
+ Character &c = g_globals->_party[i];
+
+ if (!(c._flags[1] & _flag)) {
+ c._flags[1] |= _flag;
+ if (align == c._alignment)
+ c._worthiness += 32;
+ }
+ }
+
+ if (align != NEUTRAL) {
+ clearSurface();
+ writeString(0, 1, line);
+ Sound::sound(SOUND_2);
+ delaySeconds(3);
+
+ } else {
+ close();
+ }
+
+ return true;
+}
+
+void Prisoner::timeout() {
+ close();
+}
+
+/*------------------------------------------------------------------------*/
+
+ChildPrisoner::ChildPrisoner() :
+ Prisoner("ChildPrisoner", 1, STRING["maps.prisoners.child"],
+ CHARFLAG1_4, GOOD, EVIL) {
+}
+
+ManPrisoner::ManPrisoner() :
+ Prisoner("ManPrisoner", 1, STRING["maps.prisoners.man"],
+ CHARFLAG1_20, EVIL, GOOD) {
+}
+
+CloakedPrisoner::CloakedPrisoner() :
+ Prisoner("CloakedPrisoner", 1, STRING["maps.prisoners.cloaked"],
+ CHARFLAG1_40, EVIL, GOOD) {
+}
+
+DemonPrisoner::DemonPrisoner() :
+ Prisoner("DemonPrisoner", 1, STRING["maps.prisoners.demon"],
+ CHARFLAG1_10, EVIL, GOOD) {
+}
+
+MutatedPrisoner::MutatedPrisoner() :
+ Prisoner("MutatedPrisoner", 1, STRING["maps.prisoners.mutated"],
+ CHARFLAG1_2, GOOD, EVIL) {
+}
+
+MaidenPrisoner::MaidenPrisoner() :
+ Prisoner("MaidenPrisoner", 1, STRING["maps.prisoners.maiden"],
+ CHARFLAG1_8, GOOD, EVIL) {
+}
+
+void MaidenPrisoner::flee() {
+ MM1::Maps::Map &map = *g_maps->_currentMap;
+ map._walls[48] &= 0x7f;
+}
+
+/*------------------------------------------------------------------------*/
+
+VirginPrisoner::VirginPrisoner() : Interaction("VirginPrisoner", 2) {
+ addText(STRING["maps.emap11.virgin"]);
+ addButton(STRING["maps.emap11.option_a"], 'A');
+ addButton(STRING["maps.emap11.option_b"], 'B');
+ addButton(STRING["maps.emap11.option_c"], 'C');
+}
+
+bool VirginPrisoner::msgKeypress(const KeypressMessage &msg) {
+ switch (msg.keycode) {
+ case Common::KEYCODE_a:
+ g_events->close();
+ g_events->send(SoundMessage(STRING["maps.map11.tip1"]));
+ break;
+ case Common::KEYCODE_b:
+ g_events->close();
+ static_cast<MM1::Maps::Map11 *>(g_maps->_currentMap)->challenge();
+ break;
+ case Common::KEYCODE_c:
+ g_events->close();
+ break;
+ default:
+ return Interaction::msgKeypress(msg);
+ }
+
+ return true;
+}
+
+bool VirginPrisoner::msgAction(const ActionMessage &msg) {
+ if (msg._action == KEYBIND_ESCAPE) {
+ g_events->close();
+ return true;
+ } else {
+ return Interaction::msgAction(msg);
+ }
+}
+
+} // namespace Interactions
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
diff --git a/engines/mm/mm1/views_enh/interactions/prisoners.h b/engines/mm/mm1/views_enh/interactions/prisoners.h
new file mode 100644
index 00000000000..806646efa69
--- /dev/null
+++ b/engines/mm/mm1/views_enh/interactions/prisoners.h
@@ -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/>.
+ *
+ */
+
+#ifndef MM1_VIEWS_ENH_INTERACTIONS_PRISONERS_H
+#define MM1_VIEWS_ENH_INTERACTIONS_PRISONERS_H
+
+#include "mm/mm1/views_enh/interactions/interaction.h"
+#include "mm/mm1/data/character.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+namespace Interactions {
+
+class Prisoner : public Interaction {
+private:
+ byte _flag;
+ Alignment _freeAlignment;
+ Alignment _leaveAlignment;
+protected:
+ virtual void flee() {}
+public:
+ Prisoner(const Common::String &name, int portrait, const Common::String &line1,
+ byte flag, Alignment freeAlignment, Alignment leaveAlignment);
+ virtual ~Prisoner() {}
+
+ bool msgKeypress(const KeypressMessage &msg) override;
+ void timeout() override;
+};
+
+class ChildPrisoner : public Prisoner {
+public:
+ ChildPrisoner();
+ virtual ~ChildPrisoner() {}
+};
+
+class ManPrisoner : public Prisoner {
+public:
+ ManPrisoner();
+ virtual ~ManPrisoner() {}
+};
+
+class CloakedPrisoner : public Prisoner {
+public:
+ CloakedPrisoner();
+ virtual ~CloakedPrisoner() {
+ }
+};
+
+class DemonPrisoner : public Prisoner {
+public:
+ DemonPrisoner();
+ virtual ~DemonPrisoner() {
+ }
+};
+
+class MutatedPrisoner : public Prisoner {
+public:
+ MutatedPrisoner();
+ virtual ~MutatedPrisoner() {
+ }
+};
+
+class MaidenPrisoner : public Prisoner {
+protected:
+ void flee() override;
+public:
+ MaidenPrisoner();
+ virtual ~MaidenPrisoner() {
+ }
+};
+
+class VirginPrisoner : public Interaction {
+public:
+ VirginPrisoner();
+ virtual ~VirginPrisoner() {
+ }
+ bool msgKeypress(const KeypressMessage &msg) override;
+ bool msgAction(const ActionMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
+
+#endif
diff --git a/engines/mm/module.mk b/engines/mm/module.mk
index bcdfe7b275b..2a4866e2eb8 100644
--- a/engines/mm/module.mk
+++ b/engines/mm/module.mk
@@ -173,6 +173,7 @@ MODULE_OBJS += \
mm1/views_enh/interactions/arrested.o \
mm1/views_enh/interactions/interaction.o \
mm1/views_enh/interactions/interaction_query.o \
+ mm1/views_enh/interactions/prisoners.o \
mm1/views_enh/interactions/resistances.o \
mm1/views_enh/interactions/statue.o \
mm1/views_enh/locations/blacksmith.o \
More information about the Scummvm-git-logs
mailing list