[Scummvm-git-logs] scummvm master -> 542139a12965c4707fa9cfe2e0d5938f79b17e67

neuromancer noreply at scummvm.org
Mon Jan 17 10:34:05 UTC 2022


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:
542139a129 HYPNO: allow to jump into the system menu in spider


Commit: 542139a12965c4707fa9cfe2e0d5938f79b17e67
    https://github.com/scummvm/scummvm/commit/542139a12965c4707fa9cfe2e0d5938f79b17e67
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-01-17T11:34:03+01:00

Commit Message:
HYPNO: allow to jump into the system menu in spider

Changed paths:
    engines/hypno/actions.cpp
    engines/hypno/hypno.h
    engines/hypno/scene.cpp


diff --git a/engines/hypno/actions.cpp b/engines/hypno/actions.cpp
index 88b2955512c..8146476efdd 100644
--- a/engines/hypno/actions.cpp
+++ b/engines/hypno/actions.cpp
@@ -28,11 +28,11 @@ namespace Hypno {
 
 //Actions
 
-void HypnoEngine::runMenu(Hotspots hs) {
-	const Hotspot h = *hs.begin();
-	assert(h.type == MakeMenu);
-	debugC(1, kHypnoDebugScene, "hotspot actions size: %d", h.actions.size());
-	for (Actions::const_iterator itt = h.actions.begin(); itt != h.actions.end(); ++itt) {
+void HypnoEngine::runMenu(Hotspots *hs) {
+	Hotspot *h = hs->begin();
+	assert(h->type == MakeMenu);
+	debugC(1, kHypnoDebugScene, "hotspot actions size: %d", h->actions.size());
+	for (Actions::const_iterator itt = h->actions.begin(); itt != h->actions.end(); ++itt) {
 		Action *action = *itt;
 		switch (action->type) {
 			case QuitAction:
@@ -68,14 +68,20 @@ void HypnoEngine::runMenu(Hotspots hs) {
 		//	runMice(h, (Mice*) action);
 	}
 
+	Graphics::Surface *menu = nullptr;
 	if (_conversation.empty()) {
-		if (h.flags[0] == "HINTS" || h.flags[1] == "HINTS" || h.flags[2] == "HINTS")
-			loadImage("int_main/hint1.smk", 0, 0, true);
-		else if (h.flags[0] == "AUTO_BUTTONS" || h.flags[0] == "SINGLE_RUN") {
+		if (h->flags[0] == "HINTS" || h->flags[1] == "HINTS" || h->flags[2] == "HINTS") {
+			menu = decodeFrame("int_main/hint1.smk", 0);
+			h->rect = Common::Rect(0, 0, menu->w, menu->h);
+			drawImage(*menu, 0, 0, true);
+		} else if (h->flags[0] == "AUTO_BUTTONS" || h->flags[0] == "SINGLE_RUN") {
 			if (isDemo())
 				loadImage("int_main/resume.smk", 0, 0, true, false, 0);
-			else
-				loadImage("int_main/menu.smk", 0, 0, true, false, 0);
+			else {
+				menu = decodeFrame("int_main/menu.smk", 0);
+				h->rect = Common::Rect(0, 0, menu->w, menu->h);
+				drawImage(*menu, 0, 0, true);
+			}
 		}
 	}
 }
diff --git a/engines/hypno/hypno.h b/engines/hypno/hypno.h
index e3498bc6047..b871229e177 100644
--- a/engines/hypno/hypno.h
+++ b/engines/hypno/hypno.h
@@ -151,7 +151,7 @@ public:
 	void changeCursor(const Common::String &cursor);
 
 	// Actions
-	void runMenu(Hotspots hs);
+	void runMenu(Hotspots *hs);
 	void runBackground(Background *a);
 	void runOverlay(Overlay *a);
 	void runMice(Mice *a);
diff --git a/engines/hypno/scene.cpp b/engines/hypno/scene.cpp
index de136c0e935..98476f9b256 100644
--- a/engines/hypno/scene.cpp
+++ b/engines/hypno/scene.cpp
@@ -110,9 +110,6 @@ void HypnoEngine::clickedHotspot(Common::Point mousePos) {
 	int cs = 0;
 	for (Hotspots::const_iterator it = hots->begin(); it != hots->end(); ++it) {
 		const Hotspot h = *it;
-		if (h.type != MakeHotspot)
-			continue;
-
 		cs = h.rect.width() * h.rect.height();
 		if (h.rect.contains(mousePos)) {
 			if (cs < rs) {
@@ -122,6 +119,12 @@ void HypnoEngine::clickedHotspot(Common::Point mousePos) {
 			}
 		}
 	}
+	if (selected.type == MakeMenu) {
+		// TODO: remove when proper escape to main menu is implemented
+		openMainMenuDialog();
+		return;
+	}
+
 	if (!found)
 		return;
 
@@ -278,7 +281,7 @@ void HypnoEngine::runScene(Scene *scene) {
 			if (lastCountdown == _countdown) {}
 			else if (_countdown > 0) {
 				uint32 c = _pixelFormat.RGBToColor(255, 0, 0);
-				runMenu(*stack.back());
+				runMenu(stack.back());
 				uint32 minutes = _countdown / 60;
 				uint32 seconds = _countdown % 60;
 			 	_font->drawString(_compositeSurface, Common::String::format("TIME: %d:%d", minutes, seconds), 80, 10, 60, c);
@@ -303,7 +306,7 @@ void HypnoEngine::runScene(Scene *scene) {
 						if (it->decoder) {
 							skipVideo(*it);
 							if (it->scaled) {
-								runMenu(*stack.back());
+								runMenu(stack.back());
 								drawScreen();
 							}
 						}
@@ -418,7 +421,7 @@ void HypnoEngine::runScene(Scene *scene) {
 					(  it->currentFrame->w == _screenW 
 					&& it->currentFrame->h == _screenH 
 					&& it->decoder->getCurFrame() > 0)) {
-						runMenu(*stack.back());
+						runMenu(stack.back());
 						drawScreen();
 					}
 					it->decoder->close();
@@ -485,13 +488,13 @@ void HypnoEngine::runScene(Scene *scene) {
 		if (_nextHotsToRemove) {
 			debugC(1, kHypnoDebugScene, "Removing a hotspot list!");
 			stack.pop_back();
-			runMenu(*stack.back());
+			runMenu(stack.back());
 			_nextHotsToRemove = nullptr;
 			drawScreen();
 		} else if (_nextHotsToAdd) {
 			debugC(1, kHypnoDebugScene, "Adding a hotspot list!");
 			stack.push_back(_nextHotsToAdd);
-			runMenu(*stack.back());
+			runMenu(stack.back());
 			_nextHotsToAdd = nullptr;
 			drawScreen();
 		}




More information about the Scummvm-git-logs mailing list