[Scummvm-git-logs] scummvm master -> 5ee4a2d268e0435e4fcc5338c779a586d2c6449d

dreammaster noreply at scummvm.org
Fri Feb 10 06:01:19 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:
5ee4a2d268 MM: MM1: Add enhanced mode main menu


Commit: 5ee4a2d268e0435e4fcc5338c779a586d2c6449d
    https://github.com/scummvm/scummvm/commit/5ee4a2d268e0435e4fcc5338c779a586d2c6449d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-02-09T22:01:10-08:00

Commit Message:
MM: MM1: Add enhanced mode main menu

Changed paths:
  A engines/mm/mm1/views_enh/main_menu.cpp
  A engines/mm/mm1/views_enh/main_menu.h
    devtools/create_mm/files/mm1/strings_en.yml
    engines/mm/mm1/views/title.cpp
    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 ff86e51a92c..e6737d300ad 100644
--- a/devtools/create_mm/files/mm1/strings_en.yml
+++ b/devtools/create_mm/files/mm1/strings_en.yml
@@ -97,15 +97,16 @@ dialogs:
 		exit: "'x' exit inn"
 		full: "*** party is full ***"
 	main_menu:
-		title1: "might and magic"
-		title2: "secret of the inner sanctum"
-		title3: "options"
+		title1: "Might and Magic"
+		title2: "Secret of the Inner Sanctum"
+		title3: "Options"
 		title4: "-------"
-		option1: "'c'.......create new characters"
-		option2: "'v'.......view all characters"
-		option3: "'#'.......go to town"
-		copyright1: "copr. 1986,1987-jon van caneghem"
-		copyright2: "all rights reserved"
+		option1: "'C'.......Create New Characters"
+		option2: "'V'.......View All Characters"
+		option3: "'#'.......Go to Town"
+		copyright1: "Copr. 1986,1987-Jon Van Caneghem"
+		copyright2: "All Rights Reserved"
+		scummvm: "Enhanced version provided by ScummVM"
 	market:
 		special: "special today,all you can eat! "
 		gp: "gp/ea"
@@ -142,8 +143,8 @@ dialogs:
 		food: "food= "
 		to_view: "to view"
 	ready:
-		1: "  are you ready? "
-		2: "then press enter!"
+		1: "  Are you ready? "
+		2: "Then press Enter!"
 	search:
 		search: "search: "
 		you_found: "you found..."
diff --git a/engines/mm/mm1/views/title.cpp b/engines/mm/mm1/views/title.cpp
index e494edba822..1405aa46189 100644
--- a/engines/mm/mm1/views/title.cpp
+++ b/engines/mm/mm1/views/title.cpp
@@ -138,7 +138,8 @@ bool Title::msgKeypress(const KeypressMessage &msg) {
 
 bool Title::msgAction(const ActionMessage &msg) {
 	if (msg._action == KEYBIND_ESCAPE) {
-		g_events->replaceView("AreYouReady");
+		g_events->replaceView(g_engine->isEnhanced() ?
+			"MainMenu" : "AreYouReady");
 		return true;
 	} else if (msg._action == KEYBIND_SELECT) {
 		startSlideshow();
diff --git a/engines/mm/mm1/views_enh/dialogs.h b/engines/mm/mm1/views_enh/dialogs.h
index 62cbf53dbdb..0774301aeb0 100644
--- a/engines/mm/mm1/views_enh/dialogs.h
+++ b/engines/mm/mm1/views_enh/dialogs.h
@@ -23,15 +23,13 @@
 #define MM1_VIEWS_ENH_DIALOGS_H
 
 #include "mm/mm1/events.h"
-#include "mm/mm1/views/are_you_ready.h"
 #include "mm/mm1/views/create_characters.h"
 #include "mm/mm1/views/locations/inn.h"
-#include "mm/mm1/views/main_menu.h"
 #include "mm/mm1/views/protect.h"
 #include "mm/mm1/views/title.h"
-//#include "mm/mm1/views/char.h"
 #include "mm/mm1/views_enh/character_info.h"
 #include "mm/mm1/views_enh/game.h"
+#include "mm/mm1/views_enh/main_menu.h"
 #include "mm/mm1/views_enh/map_popup.h"
 #include "mm/mm1/views_enh/quick_ref.h"
 #include "mm/mm1/views_enh/locations/market.h"
@@ -47,14 +45,14 @@ private:
 	ViewsEnh::Game _game;
 
 	// Unenhanced views
-	Views::AreYouReady _areYouReady;
 	Views::Characters _characters;
 	Views::CreateCharacters _createCharacters;
 	Views::Locations::Inn _inn;
-	Views::MainMenu _mainMenu;
 	Views::Protect _protect;
 	Views::Title _title;
 //	Views::ViewCharacter _viewCharacter;
+	ViewsEnh::MainMenu _areYouReady;
+	ViewsEnh::MainMenu _mainMenu;
 	ViewsEnh::MapPopup _mapPopup;
 	ViewsEnh::QuickRef _quickRef;
 	ViewsEnh::Locations::Market _market;
diff --git a/engines/mm/mm1/views_enh/main_menu.cpp b/engines/mm/mm1/views_enh/main_menu.cpp
new file mode 100644
index 00000000000..37937711982
--- /dev/null
+++ b/engines/mm/mm1/views_enh/main_menu.cpp
@@ -0,0 +1,179 @@
+/* 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/main_menu.h"
+#include "mm/mm1/gfx/screen_decoder.h"
+#include "mm/mm1/globals.h"
+
+#define CIRCLE_X 110
+#define CIRCLE_Y 30
+#define CIRCLE_RADIUS 50
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+
+bool MainMenu::msgFocus(const FocusMessage &msg) {
+	ScrollView::msgFocus(msg);
+	loadCircles();
+	return true;
+}
+
+bool MainMenu::msgUnfocus(const UnfocusMessage &msg) {
+	ScrollView::msgUnfocus(msg);
+	_circles[0].clear();
+	_circles[1].clear();
+	return true;
+}
+
+void MainMenu::loadCircles() {
+	const Common::Rect r(0, 0, CIRCLE_RADIUS * 2, CIRCLE_RADIUS * 2);
+	Gfx::ScreenDecoder decoder;
+	decoder._indexes[0] = 0;
+	decoder._indexes[1] = 2;
+	decoder._indexes[2] = 4;
+	decoder._indexes[3] = 15;
+
+	for (int i = 0; i < 2; ++i) {
+		if (decoder.loadFile(Common::String::format("screen%d", i))) {
+			const Graphics::Surface *src = decoder.getSurface();
+			Graphics::ManagedSurface *dest = &_circles[i];
+
+			dest->create(CIRCLE_RADIUS * 2, CIRCLE_RADIUS * 2);
+			dest->fillRect(r, 255);
+			dest->setTransparentColor(255);
+			copyCircle(src, dest);
+		}
+	}
+}
+
+void MainMenu::copyCircle(const Graphics::Surface *src,
+		Graphics::ManagedSurface *dest) {
+	int radius = CIRCLE_RADIUS;
+	int x = 0;
+	int y = radius;
+	int p = 1 - radius;
+
+	/* Plot first set of points */
+	drawCircleLine(src, dest, x, y);
+
+	while (x < y) {
+		x++;
+		if (p < 0)
+			p += 2 * x + 1;
+		else {
+			y--;
+			p += 2 * (x - y) + 1;
+		}
+		drawCircleLine(src, dest, x, y);
+	}
+}
+
+void MainMenu::drawCircleLine(const Graphics::Surface *src,
+		Graphics::ManagedSurface *dest, int x, int y) {
+	const byte *src1, *src2;
+	byte *dest1;
+
+	src1 = (const byte *)src->getBasePtr(CIRCLE_X + CIRCLE_RADIUS - x, CIRCLE_Y + CIRCLE_RADIUS + y);
+	src2 = (const byte *)src->getBasePtr(CIRCLE_X + CIRCLE_RADIUS + x, CIRCLE_Y + CIRCLE_RADIUS + y);
+	dest1 = (byte *)dest->getBasePtr(CIRCLE_RADIUS - x, CIRCLE_RADIUS + y);
+	Common::copy(src1, src2, dest1);
+
+	src1 = (const byte *)src->getBasePtr(CIRCLE_X + CIRCLE_RADIUS - x, CIRCLE_Y + CIRCLE_RADIUS - y);
+	src2 = (const byte *)src->getBasePtr(CIRCLE_X + CIRCLE_RADIUS + x, CIRCLE_Y + CIRCLE_RADIUS - y);
+	dest1 = (byte *)dest->getBasePtr(CIRCLE_RADIUS - x, CIRCLE_RADIUS - y);
+	Common::copy(src1, src2, dest1);
+
+	src1 = (const byte *)src->getBasePtr(CIRCLE_X + CIRCLE_RADIUS - y, CIRCLE_Y + CIRCLE_RADIUS - x);
+	src2 = (const byte *)src->getBasePtr(CIRCLE_X + CIRCLE_RADIUS + y, CIRCLE_Y + CIRCLE_RADIUS - x);
+	dest1 = (byte *)dest->getBasePtr(CIRCLE_RADIUS - y, CIRCLE_RADIUS - x);
+	Common::copy(src1, src2, dest1);
+
+	src1 = (const byte *)src->getBasePtr(CIRCLE_X + CIRCLE_RADIUS - y, CIRCLE_Y + CIRCLE_RADIUS + x);
+	src2 = (const byte *)src->getBasePtr(CIRCLE_X + CIRCLE_RADIUS + y, CIRCLE_Y + CIRCLE_RADIUS + x);
+	dest1 = (byte *)dest->getBasePtr(CIRCLE_RADIUS - y, CIRCLE_RADIUS + x);
+	Common::copy(src1, src2, dest1);
+}
+
+void MainMenu::draw() {
+	Graphics::ManagedSurface s = getSurface();
+	s.clear(0);
+	ScrollView::draw();
+
+	s.blitFrom(_circles[0], Common::Point(160 - CIRCLE_RADIUS * 2 - 10, 10));
+	s.blitFrom(_circles[1], Common::Point(160 + 10, 10));
+
+	writeString(0, 100, STRING["dialogs.main_menu.title3"], ALIGN_MIDDLE);
+	writeString(0, 110, STRING["dialogs.main_menu.title4"], ALIGN_MIDDLE);
+
+	Common::String line1 = STRING["dialogs.main_menu.option1"];
+	Common::String line2 = STRING["dialogs.main_menu.option2"];
+	Common::String line3 = STRING["dialogs.main_menu.option3"];
+
+	writeString(80, 120, Common::String(line1.c_str(), line1.c_str() + 3));
+	writeString(80, 130, Common::String(line2.c_str(), line2.c_str() + 3));
+	writeString(80, 140, Common::String(line3.c_str(), line3.c_str() + 3));
+	writeString(110, 120, Common::String(line1.c_str() + line1.findLastOf('.') + 1));
+	writeString(110, 130, Common::String(line2.c_str() + line2.findLastOf('.') + 1));
+	writeString(110, 140, Common::String(line3.c_str() + line3.findLastOf('.') + 1));
+
+	writeString(0, 165, STRING["dialogs.main_menu.copyright1"], ALIGN_MIDDLE);
+	writeString(0, 175, STRING["dialogs.main_menu.scummvm"], ALIGN_MIDDLE);
+}
+
+bool MainMenu::msgKeypress(const KeypressMessage &msg) {
+	switch (msg.keycode) {
+	case Common::KEYCODE_c:
+		addView("CreateCharacters");
+		break;
+
+	case Common::KEYCODE_v:
+		addView("Characters");
+		break;
+
+	case Common::KEYCODE_1:
+	case Common::KEYCODE_2:
+	case Common::KEYCODE_3:
+	case Common::KEYCODE_4:
+	case Common::KEYCODE_5:
+		g_globals->_startingTown = (Maps::TownId)(
+			msg.keycode - Common::KEYCODE_0);
+		replaceView("Inn");
+		break;
+
+	default:
+		break;
+	}
+
+	return true;
+
+}
+
+bool msgAction(const ActionMessage &msg) {
+	if (msg._action == KEYBIND_SELECT) {
+	}
+
+	return false;
+}
+
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
diff --git a/engines/mm/mm1/views_enh/main_menu.h b/engines/mm/mm1/views_enh/main_menu.h
new file mode 100644
index 00000000000..f0bf23fc0fd
--- /dev/null
+++ b/engines/mm/mm1/views_enh/main_menu.h
@@ -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/>.
+ *
+ */
+
+#ifndef MM1_VIEWS_ENH_MAIN_MENU_H
+#define MM1_VIEWS_ENH_MAIN_MENU_H
+
+#include "mm/mm1/views_enh/scroll_view.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+
+class MainMenu : public ScrollView {
+private:
+	Graphics::ManagedSurface _circles[2];
+
+	/**
+	 * Loads the two title surfaces and extracts the
+	 * circle area from them for display
+	 */
+	void loadCircles();
+
+	/**
+	 * Copies the circle
+	 */
+	void copyCircle(const Graphics::Surface *src,
+		Graphics::ManagedSurface *dest);
+
+	/**
+	 * Copies a line segment within the circle
+	 */
+	void drawCircleLine(const Graphics::Surface *src,
+		Graphics::ManagedSurface *dest, int x, int y);
+
+public:
+	MainMenu() : ScrollView("MainMenu") {}
+	virtual ~MainMenu() {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+	void draw() override;
+};
+
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
+
+#endif
diff --git a/engines/mm/module.mk b/engines/mm/module.mk
index bbd029f2bea..c888e560cb9 100644
--- a/engines/mm/module.mk
+++ b/engines/mm/module.mk
@@ -117,6 +117,7 @@ MODULE_OBJS := \
 	mm1/views_enh/game.o \
 	mm1/views_enh/game_commands.o \
 	mm1/views_enh/game_messages.o \
+	mm1/views_enh/main_menu.o \
 	mm1/views_enh/map.o \
 	mm1/views_enh/map_popup.o \
 	mm1/views_enh/quick_ref.o \




More information about the Scummvm-git-logs mailing list