[Scummvm-git-logs] scummvm master -> 059582fe483ee2d65a28e837af0d545ecaa470bd
dreammaster
noreply at scummvm.org
Fri Mar 17 05:50:46 UTC 2023
This automated email contains information about 6 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
626273dbca MM: MM1: Added Rest view
b8afed0bfe MM: MM1: Add bash action
2db67b8c99 MM: MM1: Fix horizontal alignment of Inn buttons
1ba6c58399 NEWS: Added Voyeur German fan translation
eef20cf77b MM: MM1: Beginnings of Blacksmith location
059582fe48 MM: MM1: Beginnings of blacksmith items display
Commit: 626273dbca132b250dd387c66d3eb1c5560a651f
https://github.com/scummvm/scummvm/commit/626273dbca132b250dd387c66d3eb1c5560a651f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-03-16T22:50:33-07:00
Commit Message:
MM: MM1: Added Rest view
Changed paths:
A engines/mm/mm1/views_enh/rest.cpp
A engines/mm/mm1/views_enh/rest.h
A engines/mm/mm1/views_enh/yes_no.cpp
A engines/mm/mm1/views_enh/yes_no.h
devtools/create_mm/files/mm1/strings_en.yml
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 612271ddf2b..50093c07607 100644
--- a/devtools/create_mm/files/mm1/strings_en.yml
+++ b/devtools/create_mm/files/mm1/strings_en.yml
@@ -540,6 +540,8 @@ enhdialogs:
sp: "S.P."
ac: "A.C."
cond: "Cond"
+ rest:
+ too_dangerous: "Too dangerous to rest here!"
spellbook:
title: "Spells for"
spell_points: "Spell Pts"
diff --git a/engines/mm/mm1/views_enh/dialogs.h b/engines/mm/mm1/views_enh/dialogs.h
index fe659c2becc..8597c367ddf 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/map_popup.h"
#include "mm/mm1/views_enh/protect.h"
#include "mm/mm1/views_enh/quick_ref.h"
+#include "mm/mm1/views_enh/rest.h"
#include "mm/mm1/views_enh/search.h"
#include "mm/mm1/views_enh/title.h"
#include "mm/mm1/views_enh/trap.h"
@@ -75,6 +76,7 @@ private:
ViewsEnh::MapPopup _mapPopup;
ViewsEnh::Protect _protect;
ViewsEnh::QuickRef _quickRef;
+ ViewsEnh::Rest _rest;
ViewsEnh::Search _search;
ViewsEnh::Title _title;
ViewsEnh::Trap _trap;
diff --git a/engines/mm/mm1/views_enh/game.cpp b/engines/mm/mm1/views_enh/game.cpp
index 41ca71889a5..50efb1e192e 100644
--- a/engines/mm/mm1/views_enh/game.cpp
+++ b/engines/mm/mm1/views_enh/game.cpp
@@ -78,7 +78,7 @@ bool Game::msgAction(const ActionMessage &msg) {
addView("QuickRef");
return true;
case KEYBIND_REST:
- g_events->send(GameMessage("REST"));
+ addView("Rest");
return true;
case KEYBIND_SEARCH:
send("Search", GameMessage("SHOW"));
diff --git a/engines/mm/mm1/views_enh/rest.cpp b/engines/mm/mm1/views_enh/rest.cpp
new file mode 100644
index 00000000000..f2b32749257
--- /dev/null
+++ b/engines/mm/mm1/views_enh/rest.cpp
@@ -0,0 +1,102 @@
+/* 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/rest.h"
+#include "mm/mm1/globals.h"
+#include "mm/mm1/game/rest.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+
+Rest::Rest() : YesNo("Rest") {
+ setBounds(Common::Rect(0, 144, 234, 200));
+}
+
+bool Rest::msgFocus(const FocusMessage &msg) {
+ if (g_maps->_currentState & 8)
+ tooDangerous();
+ else
+ confirmRest();
+
+ return true;
+}
+
+void Rest::draw() {
+ YesNo::draw();
+
+ if (_mode == CONFIRM) {
+ writeString(0, 0, STRING["dialogs.game.rest.rest_here"], ALIGN_MIDDLE);
+ } else {
+ writeString(0, 0, STRING["enhdialogs.rest.too_dangerous"], ALIGN_MIDDLE);
+ }
+}
+
+bool Rest::msgKeypress(const KeypressMessage &msg) {
+ if (endDelay())
+ return true;
+
+ if (_mode == CONFIRM) {
+ if (msg.keycode == Common::KEYCODE_n) {
+ close();
+ } else if (msg.keycode == Common::KEYCODE_y) {
+ close();
+ Game::Rest::check();
+ }
+ }
+
+ return true;
+}
+
+bool Rest::msgAction(const ActionMessage &msg) {
+ if (endDelay())
+ return true;
+
+ if (_mode == CONFIRM) {
+ if (msg._action == KEYBIND_ESCAPE) {
+ close();
+ } else if (msg._action == KEYBIND_SELECT) {
+ close();
+ Game::Rest::check();
+ }
+ }
+
+ return true;
+}
+
+void Rest::tooDangerous() {
+ _mode = TOO_DANGEROUS;
+ closeYesNo();
+ delaySeconds(3);
+}
+
+void Rest::confirmRest() {
+ _mode = CONFIRM;
+ openYesNo();
+}
+
+void Rest::timeout() {
+ close();
+}
+
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
diff --git a/engines/mm/mm1/views_enh/rest.h b/engines/mm/mm1/views_enh/rest.h
new file mode 100644
index 00000000000..67979df1323
--- /dev/null
+++ b/engines/mm/mm1/views_enh/rest.h
@@ -0,0 +1,53 @@
+/* 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_REST_H
+#define MM1_VIEWS_ENH_REST_H
+
+#include "mm/mm1/views_enh/yes_no.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+
+class Rest : public YesNo {
+private:
+ enum Mode { CONFIRM, TOO_DANGEROUS };
+ Mode _mode = CONFIRM;
+
+ void tooDangerous();
+ void confirmRest();
+public:
+ Rest();
+ virtual ~Rest() {}
+
+ bool msgFocus(const FocusMessage &msg) override;
+ void draw() override;
+ bool msgKeypress(const KeypressMessage &msg) override;
+ bool msgAction(const ActionMessage &msg) override;
+ void timeout() override;
+};
+
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
+
+#endif
diff --git a/engines/mm/mm1/views_enh/yes_no.cpp b/engines/mm/mm1/views_enh/yes_no.cpp
new file mode 100644
index 00000000000..26542db202c
--- /dev/null
+++ b/engines/mm/mm1/views_enh/yes_no.cpp
@@ -0,0 +1,67 @@
+/* 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/yes_no.h"
+#include "mm/mm1/globals.h"
+#include "mm/mm1/sound.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+
+void YesNo::draw() {
+ if (_subviewVisible)
+ _subview.draw();
+
+ ScrollView::draw();
+}
+
+bool YesNo::msgMouseDown(const MouseDownMessage &msg) {
+ if (_subview.msgMouseDown(msg))
+ return true;
+
+ return ScrollView::msgMouseDown(msg);
+}
+
+bool YesNo::msgMouseUp(const MouseUpMessage &msg) {
+ if (_subview.msgMouseUp(msg))
+ return true;
+
+ return ScrollView::msgMouseUp(msg);
+}
+
+/*------------------------------------------------------------------------*/
+
+YesNoSubview::YesNoSubview() : ScrollView("YesNoSubview") {
+ _bounds = Common::Rect(234, 144, 320, 200);
+
+ addButton(&g_globals->_confirmIcons, Common::Point(0, 0), 0, Common::KEYCODE_y);
+ addButton(&g_globals->_confirmIcons, Common::Point(25, 0), 2, Common::KEYCODE_n);
+}
+
+bool YesNoSubview::msgKeypress(const KeypressMessage &msg) {
+ assert(g_events->focusedView() != this);
+ return g_events->focusedView()->send(msg);
+}
+
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
diff --git a/engines/mm/mm1/views_enh/yes_no.h b/engines/mm/mm1/views_enh/yes_no.h
new file mode 100644
index 00000000000..9a9e5d0329e
--- /dev/null
+++ b/engines/mm/mm1/views_enh/yes_no.h
@@ -0,0 +1,75 @@
+/* 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_YES_NO_H
+#define MM1_VIEWS_ENH_YES_NO_H
+
+#include "mm/mm1/views_enh/scroll_view.h"
+#include "mm/shared/xeen/sprites.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+
+class YesNoSubview : public ScrollView {
+public:
+ YesNoSubview();
+ virtual ~YesNoSubview() {}
+
+ bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+class YesNo : public ScrollView {
+private:
+ YesNoSubview _subview;
+ bool _subviewVisible = false;
+
+protected:
+ /**
+ * Start displaying the yes/no subview
+ */
+ void openYesNo() {
+ _subviewVisible = true;
+ redraw();
+ }
+
+ /**
+ * Stop displaying the subview
+ */
+ void closeYesNo() {
+ _subviewVisible = false;
+ redraw();
+ }
+
+public:
+ YesNo(const Common::String &name) : ScrollView(name) {}
+ virtual ~YesNo() {}
+
+ void draw() override;
+ bool msgMouseDown(const MouseDownMessage &msg) override;
+ bool msgMouseUp(const MouseUpMessage &msg) override;
+};
+
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
+
+#endif
diff --git a/engines/mm/module.mk b/engines/mm/module.mk
index ac64870314a..ce4ebac7c81 100644
--- a/engines/mm/module.mk
+++ b/engines/mm/module.mk
@@ -144,6 +144,7 @@ MODULE_OBJS += \
mm1/views_enh/map_popup.o \
mm1/views_enh/party_view.o \
mm1/views_enh/protect.o \
+ mm1/views_enh/rest.o \
mm1/views_enh/quick_ref.o \
mm1/views_enh/scroll_popup.o \
mm1/views_enh/scroll_text.o \
@@ -156,6 +157,7 @@ MODULE_OBJS += \
mm1/views_enh/trap.o \
mm1/views_enh/unlock.o \
mm1/views_enh/who_will_try.o \
+ mm1/views_enh/yes_no.o \
mm1/views_enh/interactions/interaction.o \
mm1/views_enh/interactions/statue.o \
mm1/views_enh/locations/inn.o \
Commit: b8afed0bfe8d03a65ab1faaef250de4f7f9086cc
https://github.com/scummvm/scummvm/commit/b8afed0bfe8d03a65ab1faaef250de4f7f9086cc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-03-16T22:50:33-07:00
Commit Message:
MM: MM1: Add bash action
Changed paths:
engines/mm/mm1/views_enh/dialogs.h
diff --git a/engines/mm/mm1/views_enh/dialogs.h b/engines/mm/mm1/views_enh/dialogs.h
index 8597c367ddf..116475fc4d0 100644
--- a/engines/mm/mm1/views_enh/dialogs.h
+++ b/engines/mm/mm1/views_enh/dialogs.h
@@ -25,6 +25,7 @@
#include "mm/mm1/events.h"
#include "mm/mm1/views_enh/create_characters.h"
#include "mm/mm1/views/locations/inn.h"
+#include "mm/mm1/views/bash.h"
#include "mm/mm1/views/title.h"
#include "mm/mm1/views_enh/character_info.h"
#include "mm/mm1/views_enh/character_select.h"
@@ -82,6 +83,7 @@ private:
ViewsEnh::Trap _trap;
ViewsEnh::Unlock _unlock;
ViewsEnh::WhoWillTry _whoWillTry;
+ Views::Bash _bash;
public:
Dialogs() {}
};
Commit: 2db67b8c99a41d71c1767f782f1a08ec6690e507
https://github.com/scummvm/scummvm/commit/2db67b8c99a41d71c1767f782f1a08ec6690e507
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-03-16T22:50:33-07:00
Commit Message:
MM: MM1: Fix horizontal alignment of Inn buttons
Changed paths:
engines/mm/mm1/views_enh/locations/inn.cpp
diff --git a/engines/mm/mm1/views_enh/locations/inn.cpp b/engines/mm/mm1/views_enh/locations/inn.cpp
index 18a103e1ef6..fc961a58691 100644
--- a/engines/mm/mm1/views_enh/locations/inn.cpp
+++ b/engines/mm/mm1/views_enh/locations/inn.cpp
@@ -33,8 +33,8 @@ Inn::Inn() : ScrollView("Inn") {
_bounds.setBorderSize(10);
_escSprite.load("esc.icn");
- addButton(&_escSprite, Common::Point(135, 166), 0, KEYBIND_ESCAPE, true);
- addButton(&_escSprite, Common::Point(65, 166), 0, KEYBIND_SELECT, true);
+ addButton(&_escSprite, Common::Point(119, 166), 0, KEYBIND_ESCAPE, true);
+ addButton(&_escSprite, Common::Point(85, 166), 0, KEYBIND_SELECT, true);
setButtonEnabled(1, false);
}
@@ -72,9 +72,9 @@ bool Inn::msgFocus(const FocusMessage &msg) {
void Inn::draw() {
setButtonEnabled(1, !_partyChars.empty());
if (!_partyChars.empty()) {
- setButtonPos(0, Common::Point(135, 166));
+ setButtonPos(0, Common::Point(155, 166));
} else {
- setButtonPos(0, Common::Point(105, 166));
+ setButtonPos(0, Common::Point(119, 166));
}
ScrollView::draw();
@@ -126,10 +126,10 @@ void Inn::draw() {
}
if (!_partyChars.empty()) {
- writeString(80, 168, STRING["enhdialogs.inn.exit"]);
- writeString(150, 168, STRING["dialogs.misc.go_back"]);
+ writeString(100, 168, STRING["enhdialogs.inn.exit"]);
+ writeString(170, 168, STRING["enhdialogs.misc.go_back"]);
} else {
- writeString(120, 168, STRING["dialogs.misc.go_back"]);
+ writeString(134, 168, STRING["enhdialogs.misc.go_back"]);
}
}
Commit: 1ba6c58399014e0a81c78fc61cbad8cae53cc7cd
https://github.com/scummvm/scummvm/commit/1ba6c58399014e0a81c78fc61cbad8cae53cc7cd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-03-16T22:50:34-07:00
Commit Message:
NEWS: Added Voyeur German fan translation
Changed paths:
NEWS.md
diff --git a/NEWS.md b/NEWS.md
index 4e0ce767080..f911b30d7ed 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -61,6 +61,9 @@ For a more comprehensive changelog of the latest experimental code, see:
- Added support for GOG.com version.
- Added detection for alternate Polish version.
+ Voyeur:
+ - Added support for German fan translation.
+
RISC OS port:
- Fixed crash on RISC OS 5 with games that require lots of RAM.
Commit: eef20cf77b17ed30b26c6bfb027d007f904e46e7
https://github.com/scummvm/scummvm/commit/eef20cf77b17ed30b26c6bfb027d007f904e46e7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-03-16T22:50:34-07:00
Commit Message:
MM: MM1: Beginnings of Blacksmith location
Changed paths:
A engines/mm/mm1/views_enh/items_view.cpp
A engines/mm/mm1/views_enh/items_view.h
A engines/mm/mm1/views_enh/locations/blacksmith.cpp
A engines/mm/mm1/views_enh/locations/blacksmith.h
A engines/mm/mm1/views_enh/locations/blacksmith_items.cpp
A engines/mm/mm1/views_enh/locations/blacksmith_items.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 50093c07607..fd87e2b1be8 100644
--- a/devtools/create_mm/files/mm1/strings_en.yml
+++ b/devtools/create_mm/files/mm1/strings_en.yml
@@ -424,6 +424,31 @@ dialogs:
15: "thrashes at"
99: "shoots at"
enhdialogs:
+ blacksmith:
+ browse: "\x01""37Browse"
+ for: "for"
+ the: "the"
+ cost: "Cost"
+ gold: "Gold"
+ available: "Available"
+ buy: "Buy"
+ sell: "Sell"
+ for_gold: "for %d gold"
+ areas:
+ weapons: "Weapons"
+ armor: "Armor"
+ accessories: "Accessories"
+ misc: "Misc"
+ buttons:
+ weapons: "\x01""37Weap"
+ armor: "\x01""37Armor"
+ accessories: "A\x01""37cces"
+ misc: "\x01""37Misc"
+ buy: "\x01""Buy"
+ sell: "\x01""Sell"
+ buy: "\x01""Buy"
+ sell: "\x01""Sell"
+ exit: "Exit"
cast_spell:
title: "Cast Spell"
spell_ready: "Spell Ready:"
@@ -512,7 +537,7 @@ enhdialogs:
exit: "Exit Inn"
esc: "ESC to go back"
location:
- store: "store"
+ store: "Store"
options: "options"
options_for: "options for"
gold: "Gold"
diff --git a/engines/mm/mm1/views_enh/dialogs.h b/engines/mm/mm1/views_enh/dialogs.h
index 116475fc4d0..a53be59e013 100644
--- a/engines/mm/mm1/views_enh/dialogs.h
+++ b/engines/mm/mm1/views_enh/dialogs.h
@@ -23,13 +23,12 @@
#define MM1_VIEWS_ENH_DIALOGS_H
#include "mm/mm1/events.h"
-#include "mm/mm1/views_enh/create_characters.h"
-#include "mm/mm1/views/locations/inn.h"
#include "mm/mm1/views/bash.h"
#include "mm/mm1/views/title.h"
#include "mm/mm1/views_enh/character_info.h"
#include "mm/mm1/views_enh/character_select.h"
#include "mm/mm1/views_enh/characters.h"
+#include "mm/mm1/views_enh/create_characters.h"
#include "mm/mm1/views_enh/exchange.h"
#include "mm/mm1/views_enh/game.h"
#include "mm/mm1/views_enh/game_messages.h"
@@ -44,6 +43,7 @@
#include "mm/mm1/views_enh/unlock.h"
#include "mm/mm1/views_enh/who_will_try.h"
#include "mm/mm1/views_enh/interactions/statue.h"
+#include "mm/mm1/views_enh/locations/blacksmith.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"
@@ -59,6 +59,7 @@ namespace ViewsEnh {
struct Dialogs {
private:
ViewsEnh::Interactions::Statue _statue;
+ ViewsEnh::Locations::Blacksmith _blacksmith;
ViewsEnh::Locations::Inn _inn;
ViewsEnh::Locations::Market _market;
ViewsEnh::Locations::Tavern _tavern;
diff --git a/engines/mm/mm1/views_enh/items_view.cpp b/engines/mm/mm1/views_enh/items_view.cpp
new file mode 100644
index 00000000000..b367058d013
--- /dev/null
+++ b/engines/mm/mm1/views_enh/items_view.cpp
@@ -0,0 +1,63 @@
+/* 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/items_view.h"
+#include "mm/mm1/globals.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+
+ItemsView::ItemsView(const Common::String &name) : ScrollView(name) {
+ setBounds(Common::Rect(0, 144, 234, 200));
+}
+
+bool ItemsView::msgFocus(const FocusMessage &msg) {
+ ScrollView::msgFocus(msg);
+ _selectedItem = -1;
+ return true;
+}
+
+void ItemsView::draw() {
+
+}
+
+bool ItemsView::msgKeypress(const KeypressMessage &msg) {
+ if (endDelay())
+ return true;
+
+ return true;
+}
+
+bool ItemsView::msgAction(const ActionMessage &msg) {
+ if (endDelay())
+ return true;
+
+ return true;
+}
+
+void ItemsView::timeout() {
+ close();
+}
+
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
diff --git a/engines/mm/mm1/views_enh/items_view.h b/engines/mm/mm1/views_enh/items_view.h
new file mode 100644
index 00000000000..872787621e2
--- /dev/null
+++ b/engines/mm/mm1/views_enh/items_view.h
@@ -0,0 +1,50 @@
+/* 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_ITEMS_VIEW_H
+#define MM1_VIEWS_ENH_ITEMS_VIEW_H
+
+#include "mm/mm1/views_enh/yes_no.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+
+class ItemsView : public ScrollView {
+protected:
+ int _selectedItem = -1;
+
+public:
+ ItemsView(const Common::String &name);
+ virtual ~ItemsView() {}
+
+ bool msgFocus(const FocusMessage &msg) override;
+ void draw() override;
+ bool msgKeypress(const KeypressMessage &msg) override;
+ bool msgAction(const ActionMessage &msg) override;
+ void timeout() override;
+};
+
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
+
+#endif
diff --git a/engines/mm/mm1/views_enh/locations/blacksmith.cpp b/engines/mm/mm1/views_enh/locations/blacksmith.cpp
new file mode 100644
index 00000000000..7006c26f420
--- /dev/null
+++ b/engines/mm/mm1/views_enh/locations/blacksmith.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/locations/blacksmith.h"
+#include "mm/mm1/globals.h"
+#include "mm/mm1/mm1.h"
+#include "mm/mm1/sound.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+namespace Locations {
+
+Blacksmith::Blacksmith() : Location("Blacksmith", LOC_BLACKSMITH) {
+ addButton(&g_globals->_escSprites, Common::Point(24, 100), 0, KEYBIND_ESCAPE);
+}
+
+void Blacksmith::draw() {
+ Location::draw();
+
+ const Character &c = *g_globals->_currCharacter;
+
+ setReduced(false);
+ writeLine(0, STRING["enhdialogs.location.store"], ALIGN_MIDDLE);
+ writeLine(1, STRING["enhdialogs.location.options_for"], ALIGN_MIDDLE);
+ writeLine(3, c._name, ALIGN_MIDDLE);
+
+ writeLine(5, STRING["enhdialogs.blacksmith.browse"], 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 Blacksmith::msgKeypress(const KeypressMessage &msg) {
+ // If a delay is active, end it
+ if (endDelay())
+ return true;
+
+ switch (msg.keycode) {
+ case Common::KEYCODE_b:
+ addView("BlackSmithItems");
+ break;
+ default:
+ return Location::msgKeypress(msg);
+ break;
+ }
+
+ return true;
+}
+
+bool Blacksmith::msgAction(const ActionMessage &msg) {
+ if (endDelay())
+ return true;
+
+ if (msg._action == KEYBIND_ESCAPE) {
+ leave();
+ return true;
+ }
+
+ return Location::msgAction(msg);
+}
+
+} // namespace Location
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
diff --git a/engines/mm/mm1/views_enh/locations/blacksmith.h b/engines/mm/mm1/views_enh/locations/blacksmith.h
new file mode 100644
index 00000000000..940ed520b27
--- /dev/null
+++ b/engines/mm/mm1/views_enh/locations/blacksmith.h
@@ -0,0 +1,47 @@
+/* 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_BLACKSMITH_H
+#define MM1_VIEWS_ENH_LOCATIONS_BLACKSMITH_H
+
+#include "mm/mm1/views_enh/locations/location.h"
+#include "mm/mm1/data/character.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+namespace Locations {
+
+class Blacksmith : public Location {
+public:
+ Blacksmith();
+
+ 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/mm1/views_enh/locations/blacksmith_items.cpp b/engines/mm/mm1/views_enh/locations/blacksmith_items.cpp
new file mode 100644
index 00000000000..de166e82b8c
--- /dev/null
+++ b/engines/mm/mm1/views_enh/locations/blacksmith_items.cpp
@@ -0,0 +1,78 @@
+/* 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/blacksmith_items.h"
+#include "mm/mm1/globals.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+
+BlacksmithItems::BlacksmithItems() : ItemsView("BlacksmithItems") {
+}
+
+bool BlacksmithItems::msgFocus(const FocusMessage &msg) {
+ ItemsView::msgFocus(msg);
+
+ return true;
+}
+
+void BlacksmithItems::draw() {
+ ItemsView::draw();
+
+// writeString(0, 0, STRING["dialogs.game.BlacksmithItems.BlacksmithItems_here"], ALIGN_MIDDLE);
+}
+
+bool BlacksmithItems::msgKeypress(const KeypressMessage &msg) {
+ if (endDelay())
+ return true;
+/*
+ if (_mode == CONFIRM) {
+ if (msg.keycode == Common::KEYCODE_n) {
+ close();
+ } else if (msg.keycode == Common::KEYCODE_y) {
+ close();
+ Game::BlacksmithItems::check();
+ }
+ }
+*/
+ return true;
+}
+
+bool BlacksmithItems::msgAction(const ActionMessage &msg) {
+ if (endDelay())
+ return true;
+ /*
+ if (_mode == CONFIRM) {
+ if (msg._action == KEYBIND_ESCAPE) {
+ close();
+ } else if (msg._action == KEYBIND_SELECT) {
+ close();
+ Game::BlacksmithItems::check();
+ }
+ }
+ */
+ return true;
+}
+
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
diff --git a/engines/mm/mm1/views_enh/locations/blacksmith_items.h b/engines/mm/mm1/views_enh/locations/blacksmith_items.h
new file mode 100644
index 00000000000..579f1df6b71
--- /dev/null
+++ b/engines/mm/mm1/views_enh/locations/blacksmith_items.h
@@ -0,0 +1,46 @@
+/* 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_BLACKSMITH_ITEMS_H
+#define MM1_VIEWS_ENH_LOCATIONS_BLACKSMITH_ITEMS_H
+
+#include "mm/mm1/views_enh/items_view.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+
+class BlacksmithItems : public ItemsView {
+public:
+ BlacksmithItems();
+ virtual ~BlacksmithItems() {}
+
+ bool msgFocus(const FocusMessage &msg) override;
+ void draw() override;
+ bool msgKeypress(const KeypressMessage &msg) override;
+ bool msgAction(const ActionMessage &msg) override;
+};
+
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
+
+#endif
diff --git a/engines/mm/module.mk b/engines/mm/module.mk
index ce4ebac7c81..8c37830ed2b 100644
--- a/engines/mm/module.mk
+++ b/engines/mm/module.mk
@@ -139,6 +139,7 @@ MODULE_OBJS += \
mm1/views_enh/game_messages.o \
mm1/views_enh/game_party.o \
mm1/views_enh/game_view.o \
+ mm1/views_enh/items_view.o \
mm1/views_enh/main_menu.o \
mm1/views_enh/map.o \
mm1/views_enh/map_popup.o \
@@ -160,6 +161,8 @@ MODULE_OBJS += \
mm1/views_enh/yes_no.o \
mm1/views_enh/interactions/interaction.o \
mm1/views_enh/interactions/statue.o \
+ mm1/views_enh/locations/blacksmith.o \
+ mm1/views_enh/locations/blacksmith_items.o \
mm1/views_enh/locations/inn.o \
mm1/views_enh/locations/location.o \
mm1/views_enh/locations/market.o \
Commit: 059582fe483ee2d65a28e837af0d545ecaa470bd
https://github.com/scummvm/scummvm/commit/059582fe483ee2d65a28e837af0d545ecaa470bd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-03-16T22:50:34-07:00
Commit Message:
MM: MM1: Beginnings of blacksmith items display
Changed paths:
devtools/create_mm/files/mm1/strings_en.yml
engines/mm/mm1/views_enh/dialogs.h
engines/mm/mm1/views_enh/items_view.cpp
engines/mm/mm1/views_enh/items_view.h
engines/mm/mm1/views_enh/locations/blacksmith_items.cpp
engines/mm/mm1/views_enh/locations/blacksmith_items.h
engines/mm/mm1/views_enh/scroll_view.h
diff --git a/devtools/create_mm/files/mm1/strings_en.yml b/devtools/create_mm/files/mm1/strings_en.yml
index fd87e2b1be8..e8568187a00 100644
--- a/devtools/create_mm/files/mm1/strings_en.yml
+++ b/devtools/create_mm/files/mm1/strings_en.yml
@@ -444,10 +444,10 @@ enhdialogs:
armor: "\x01""37Armor"
accessories: "A\x01""37cces"
misc: "\x01""37Misc"
- buy: "\x01""Buy"
- sell: "\x01""Sell"
- buy: "\x01""Buy"
- sell: "\x01""Sell"
+ buy: "\x01""37Buy"
+ sell: "\x01""37Sell"
+ buy: "\x01""37Buy"
+ sell: "\x01""37Sell"
exit: "Exit"
cast_spell:
title: "Cast Spell"
diff --git a/engines/mm/mm1/views_enh/dialogs.h b/engines/mm/mm1/views_enh/dialogs.h
index a53be59e013..0e121c2c95d 100644
--- a/engines/mm/mm1/views_enh/dialogs.h
+++ b/engines/mm/mm1/views_enh/dialogs.h
@@ -43,6 +43,7 @@
#include "mm/mm1/views_enh/unlock.h"
#include "mm/mm1/views_enh/who_will_try.h"
#include "mm/mm1/views_enh/interactions/statue.h"
+#include "mm/mm1/views_enh/locations/blacksmith_items.h"
#include "mm/mm1/views_enh/locations/blacksmith.h"
#include "mm/mm1/views_enh/locations/inn.h"
#include "mm/mm1/views_enh/locations/market.h"
@@ -60,6 +61,7 @@ struct Dialogs {
private:
ViewsEnh::Interactions::Statue _statue;
ViewsEnh::Locations::Blacksmith _blacksmith;
+ ViewsEnh::Locations::BlacksmithItems _blacksmithItems;
ViewsEnh::Locations::Inn _inn;
ViewsEnh::Locations::Market _market;
ViewsEnh::Locations::Tavern _tavern;
diff --git a/engines/mm/mm1/views_enh/items_view.cpp b/engines/mm/mm1/views_enh/items_view.cpp
index b367058d013..f1e7ba86045 100644
--- a/engines/mm/mm1/views_enh/items_view.cpp
+++ b/engines/mm/mm1/views_enh/items_view.cpp
@@ -26,8 +26,22 @@ namespace MM {
namespace MM1 {
namespace ViewsEnh {
-ItemsView::ItemsView(const Common::String &name) : ScrollView(name) {
- setBounds(Common::Rect(0, 144, 234, 200));
+#define BUTTON_WIDTH 35
+#define EXIT_X 270
+
+ItemsView::ItemsView(const Common::String &name) : PartyView(name),
+ _buttonsArea(Common::Rect(0, 101, 320, 146)) {
+ _bounds = Common::Rect(0, 0, 320, 146);
+}
+
+void ItemsView::addButton(int frame, const Common::String &text,
+ Common::KeyCode keycode) {
+ Common::Point pt(_btnText.size() * BUTTON_WIDTH + 5, 0);
+ if (keycode == Common::KEYCODE_ESCAPE)
+ pt.x = EXIT_X;
+
+ PartyView::addButton(&_btnSprites, pt, frame, keycode);
+ _btnText.push_back(text);
}
bool ItemsView::msgFocus(const FocusMessage &msg) {
@@ -37,7 +51,28 @@ bool ItemsView::msgFocus(const FocusMessage &msg) {
}
void ItemsView::draw() {
+ // Manually draw a frame for the entire area to avoid
+ // also drawing the buttons
+ frame();
+ fill();
+
+ // Now draw the buttons area
+ const Common::Rect r = _bounds;
+ _bounds = _buttonsArea;
+ PartyView::draw();
+ _bounds = r;
+
+ // Draw button text
+ setReduced(true);
+ for (uint i = 0; i < _btnText.size(); ++i) {
+ Common::Point pt(i * BUTTON_WIDTH + 5, 122);
+ if (i == (_btnText.size() - 1))
+ pt.x = EXIT_X;
+
+ writeString(pt.x + 18, pt.y, _btnText[i], ALIGN_MIDDLE);
+ }
+ // TODO: drawing items
}
bool ItemsView::msgKeypress(const KeypressMessage &msg) {
diff --git a/engines/mm/mm1/views_enh/items_view.h b/engines/mm/mm1/views_enh/items_view.h
index 872787621e2..424dca7c91b 100644
--- a/engines/mm/mm1/views_enh/items_view.h
+++ b/engines/mm/mm1/views_enh/items_view.h
@@ -22,16 +22,25 @@
#ifndef MM1_VIEWS_ENH_ITEMS_VIEW_H
#define MM1_VIEWS_ENH_ITEMS_VIEW_H
-#include "mm/mm1/views_enh/yes_no.h"
+#include "mm/mm1/views_enh/party_view.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
-class ItemsView : public ScrollView {
+class ItemsView : public PartyView {
protected:
int _selectedItem = -1;
-
+ Common::Array<int> _items;
+ const Common::Rect _buttonsArea;
+ Shared::Xeen::SpriteResource _btnSprites;
+ Common::StringArray _btnText;
+
+ /**
+ * Add a button to the buttons bar
+ */
+ void addButton(int frame, const Common::String &text,
+ Common::KeyCode keycode);
public:
ItemsView(const Common::String &name);
virtual ~ItemsView() {}
diff --git a/engines/mm/mm1/views_enh/locations/blacksmith_items.cpp b/engines/mm/mm1/views_enh/locations/blacksmith_items.cpp
index de166e82b8c..83f35d48c98 100644
--- a/engines/mm/mm1/views_enh/locations/blacksmith_items.cpp
+++ b/engines/mm/mm1/views_enh/locations/blacksmith_items.cpp
@@ -25,8 +25,17 @@
namespace MM {
namespace MM1 {
namespace ViewsEnh {
+namespace Locations {
BlacksmithItems::BlacksmithItems() : ItemsView("BlacksmithItems") {
+ _btnSprites.load("buy.icn");
+ addButton(0, STRING["enhdialogs.blacksmith.buttons.weapons"], Common::KEYCODE_w);
+ addButton(2, STRING["enhdialogs.blacksmith.buttons.armor"], Common::KEYCODE_a);
+ addButton(4, STRING["enhdialogs.blacksmith.buttons.accessories"], Common::KEYCODE_c);
+ addButton(6, STRING["enhdialogs.blacksmith.buttons.misc"], Common::KEYCODE_m);
+ addButton(8, STRING["enhdialogs.blacksmith.buttons.buy"], Common::KEYCODE_b);
+ addButton(10, STRING["enhdialogs.blacksmith.buttons.sell"], Common::KEYCODE_s);
+ addButton(12, STRING["enhdialogs.blacksmith.buttons.exit"], Common::KEYCODE_ESCAPE);
}
bool BlacksmithItems::msgFocus(const FocusMessage &msg) {
@@ -38,23 +47,23 @@ bool BlacksmithItems::msgFocus(const FocusMessage &msg) {
void BlacksmithItems::draw() {
ItemsView::draw();
-// writeString(0, 0, STRING["dialogs.game.BlacksmithItems.BlacksmithItems_here"], ALIGN_MIDDLE);
+ // writeString(0, 0, STRING["dialogs.game.BlacksmithItems.BlacksmithItems_here"], ALIGN_MIDDLE);
}
bool BlacksmithItems::msgKeypress(const KeypressMessage &msg) {
if (endDelay())
return true;
-/*
- if (_mode == CONFIRM) {
- if (msg.keycode == Common::KEYCODE_n) {
- close();
- } else if (msg.keycode == Common::KEYCODE_y) {
- close();
- Game::BlacksmithItems::check();
+ /*
+ if (_mode == CONFIRM) {
+ if (msg.keycode == Common::KEYCODE_n) {
+ close();
+ } else if (msg.keycode == Common::KEYCODE_y) {
+ close();
+ Game::BlacksmithItems::check();
+ }
}
- }
-*/
- return true;
+ */
+ return ItemsView::msgKeypress(msg);
}
bool BlacksmithItems::msgAction(const ActionMessage &msg) {
@@ -70,9 +79,10 @@ bool BlacksmithItems::msgAction(const ActionMessage &msg) {
}
}
*/
- return true;
+ return ItemsView::msgAction(msg);
}
+} // namespace Locations
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
diff --git a/engines/mm/mm1/views_enh/locations/blacksmith_items.h b/engines/mm/mm1/views_enh/locations/blacksmith_items.h
index 579f1df6b71..066b42d1c0b 100644
--- a/engines/mm/mm1/views_enh/locations/blacksmith_items.h
+++ b/engines/mm/mm1/views_enh/locations/blacksmith_items.h
@@ -27,6 +27,7 @@
namespace MM {
namespace MM1 {
namespace ViewsEnh {
+namespace Locations {
class BlacksmithItems : public ItemsView {
public:
@@ -39,6 +40,7 @@ public:
bool msgAction(const ActionMessage &msg) override;
};
+} // namespace Location
} // namespace ViewsEnh
} // namespace MM1
} // namespace MM
diff --git a/engines/mm/mm1/views_enh/scroll_view.h b/engines/mm/mm1/views_enh/scroll_view.h
index 42bd28d2bb7..eefc8cbd365 100644
--- a/engines/mm/mm1/views_enh/scroll_view.h
+++ b/engines/mm/mm1/views_enh/scroll_view.h
@@ -92,6 +92,13 @@ protected:
* Get the button at the given position
*/
int getButtonAt(const Common::Point &pos);
+
+ /**
+ * Return the number of buttons
+ */
+ size_t getButtonCount() const {
+ return _buttons.size();
+ }
public:
ScrollView(const Common::String &name);
ScrollView(const Common::String &name, UIElement *owner);
More information about the Scummvm-git-logs
mailing list