[Scummvm-git-logs] scummvm master -> 398ce423f335c45923dd9c5ac46d50903a0f0024

dreammaster noreply at scummvm.org
Wed Apr 5 04:37:31 UTC 2023


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
335ca34107 MM: MM1: Move virgin prisoner to a class in prisoners.cpp
398ce423f3 MM: MM1: Fix dismissing sign messages


Commit: 335ca34107cea7b9ade93bd51c99f1896c23aeb5
    https://github.com/scummvm/scummvm/commit/335ca34107cea7b9ade93bd51c99f1896c23aeb5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-04-04T21:35:14-07:00

Commit Message:
MM: MM1: Move virgin prisoner to a class in prisoners.cpp

Changed paths:
    engines/mm/mm1/maps/map11.cpp
    engines/mm/mm1/views/dialogs.h
    engines/mm/mm1/views/maps/prisoners.cpp
    engines/mm/mm1/views/maps/prisoners.h


diff --git a/engines/mm/mm1/maps/map11.cpp b/engines/mm/mm1/maps/map11.cpp
index 4309115cca7..8484fc75d89 100644
--- a/engines/mm/mm1/maps/map11.cpp
+++ b/engines/mm/mm1/maps/map11.cpp
@@ -100,26 +100,7 @@ void Map11::special03() {
 
 void Map11::special04() {
 	g_maps->clearSpecial();
-
-	send(SoundMessage(STRING["maps.map11.virgin"],
-		[](const Common::KeyState &ks) {
-			switch (ks.keycode) {
-			case Common::KEYCODE_a:
-				g_events->close();
-				g_events->send(SoundMessage(STRING["maps.map11.tip1"]));
-				break;
-			case Common::KEYCODE_b:
-				static_cast<MM1::Maps::Map11 *>(g_maps->_currentMap)->challenge();
-				break;
-			case Common::KEYCODE_c:
-			case Common::KEYCODE_ESCAPE:
-				g_events->close();
-				break;
-			default:
-				break;
-			}
-		}
-	));
+	g_events->addView("VirginPrisoner");
 }
 
 void Map11::special05() {
@@ -175,7 +156,6 @@ void Map11::selectDial(int dialIndex) {
 
 void Map11::challenge() {
 	Game::Encounter &enc = g_globals->_encounters;
-	g_events->close();
 
 	enc.clearMonsters();
 	enc.addMonster(10, 12);
diff --git a/engines/mm/mm1/views/dialogs.h b/engines/mm/mm1/views/dialogs.h
index 4558fb3e213..0ba78eca792 100644
--- a/engines/mm/mm1/views/dialogs.h
+++ b/engines/mm/mm1/views/dialogs.h
@@ -127,6 +127,7 @@ private:
 	Views::Maps::MaidenPrisoner _maidenPrisoner;
 	Views::Maps::ManPrisoner _manPrisoner;
 	Views::Maps::MutatedPrisoner _mutatedPrisoner;
+	Views::Maps::VirginPrisoner _virginPrisoner;
 	Views::Maps::DogStatue _dogStatue;
 	Views::Maps::Ghost _ghost;
 	Views::Maps::Giant _giant;
diff --git a/engines/mm/mm1/views/maps/prisoners.cpp b/engines/mm/mm1/views/maps/prisoners.cpp
index a9bff882272..fe873ae4e0f 100644
--- a/engines/mm/mm1/views/maps/prisoners.cpp
+++ b/engines/mm/mm1/views/maps/prisoners.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "mm/mm1/views/maps/prisoners.h"
+#include "mm/mm1/maps/map11.h"
 #include "mm/mm1/globals.h"
 #include "mm/mm1/sound.h"
 
@@ -136,6 +137,46 @@ void MaidenPrisoner::flee() {
 	map._walls[48] &= 0x7f;
 }
 
+/*------------------------------------------------------------------------*/
+
+VirginPrisoner::VirginPrisoner() : TextView("VirginPrisoner") {
+	setBounds(getLineBounds(20, 24));
+}
+
+void VirginPrisoner::draw() {
+	clearSurface();
+	writeString(0, 1, STRING["maps.map11.virgin"]);
+}
+
+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 TextView::msgKeypress(msg);
+	}
+
+	return true;
+}
+
+bool VirginPrisoner::msgAction(const ActionMessage &msg) {
+	if (msg._action == KEYBIND_ESCAPE) {
+		g_events->close();
+		return true;
+	} else {
+		return TextView::msgAction(msg);
+	}
+}
+
 } // namespace Maps
 } // namespace Views
 } // namespace MM1
diff --git a/engines/mm/mm1/views/maps/prisoners.h b/engines/mm/mm1/views/maps/prisoners.h
index 12f89bd827c..9f7dd9ff0b8 100644
--- a/engines/mm/mm1/views/maps/prisoners.h
+++ b/engines/mm/mm1/views/maps/prisoners.h
@@ -90,6 +90,16 @@ public:
 	}
 };
 
+class VirginPrisoner : public TextView {
+public:
+	VirginPrisoner();
+	virtual ~VirginPrisoner() {
+	}
+	void draw() override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+};
+
 } // namespace Maps
 } // namespace Views
 } // namespace MM1


Commit: 398ce423f335c45923dd9c5ac46d50903a0f0024
    https://github.com/scummvm/scummvm/commit/398ce423f335c45923dd9c5ac46d50903a0f0024
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-04-04T21:35:14-07:00

Commit Message:
MM: MM1: Fix dismissing sign messages

Changed paths:
    engines/mm/mm1/views/game_messages.cpp


diff --git a/engines/mm/mm1/views/game_messages.cpp b/engines/mm/mm1/views/game_messages.cpp
index 994bf1255ff..98cb0d0ebb2 100644
--- a/engines/mm/mm1/views/game_messages.cpp
+++ b/engines/mm/mm1/views/game_messages.cpp
@@ -109,13 +109,15 @@ bool GameMessages::msgKeypress(const KeypressMessage &msg) {
 }
 
 bool GameMessages::msgAction(const ActionMessage &msg) {
+	auto focusedView = g_events->focusedView();
+
 	if (g_globals->_party.isPartyDead()) {
 		// Party is dead, so now that players have read whatever
 		// message was displayed, switch to the Dead screen
 		g_events->clearViews();
 		addView("Dead");
 
-	} else if (g_events->focusedView()) {
+	} else if (focusedView == this) {
 		if (endDelay())
 			return true;
 
@@ -130,7 +132,7 @@ bool GameMessages::msgAction(const ActionMessage &msg) {
 		case KEYBIND_SELECT:
 			if (_keyCallback) {
 				_keyCallback(Common::KeyState(Common::KEYCODE_RETURN));
-			} else {
+			} else if (_ynCallback) {
 				close();
 				_ynCallback();
 			}
@@ -138,6 +140,9 @@ bool GameMessages::msgAction(const ActionMessage &msg) {
 		default:
 			break;
 		}
+	} else if (msg._action == KEYBIND_SELECT) {
+		clearSurface();
+		return true;
 	}
 
 	return false;




More information about the Scummvm-git-logs mailing list