[Scummvm-git-logs] scummvm master -> 9c19a447d7987bbeb50a01f30f0162d05f355284

sluicebox noreply at scummvm.org
Fri Nov 15 00:14:52 UTC 2024


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:
9c19a447d7 AGI: PREAGI: Apply WINNIE menu hotkeys immediately


Commit: 9c19a447d7987bbeb50a01f30f0162d05f355284
    https://github.com/scummvm/scummvm/commit/9c19a447d7987bbeb50a01f30f0162d05f355284
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-11-14T16:14:29-08:00

Commit Message:
AGI: PREAGI: Apply WINNIE menu hotkeys immediately

Fixes the N/S/E/W/T/P keys not behaving as in the original.

In the original, pressing a menu hotkey immediately activates its menu
item. We were doing this for the 1/2/3 hotkeys, but for N/S/E/W/T/P we
only selected the item. This required pressing Enter after these keys.

Now all the hotkeys are handled consistently and applied immediately.

Changed paths:
    engines/agi/preagi/winnie.cpp
    engines/agi/preagi/winnie.h


diff --git a/engines/agi/preagi/winnie.cpp b/engines/agi/preagi/winnie.cpp
index 95742fd84d6..a212f9ab442 100644
--- a/engines/agi/preagi/winnie.cpp
+++ b/engines/agi/preagi/winnie.cpp
@@ -796,12 +796,13 @@ void WinnieEngine::getMenuMouseSel(int *iSel, int fCanSel[], int x, int y) {
 	}
 }
 
-void WinnieEngine::makeSel(int *iSel, int fCanSel[]) {
+bool WinnieEngine::makeSel(int *iSel, int fCanSel[]) {
 	if (fCanSel[*iSel])
-		return;
+		return true;
 
 	keyHelp();
 	clrMenuSel(iSel, fCanSel);
+	return false;
 }
 
 void WinnieEngine::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) {
@@ -943,31 +944,55 @@ void WinnieEngine::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) {
 					break;
 				case Common::KEYCODE_n:
 					*iSel = IDI_WTP_SEL_NORTH;
-					makeSel(iSel, fCanSel);
+					if (makeSel(iSel, fCanSel)) {
+						// Menu selection made, hide the mouse cursor
+						CursorMan.showMouse(false);
+						return;
+					}
 					break;
 				case Common::KEYCODE_s:
 					if (event.kbd.flags & Common::KBD_CTRL) {
 						flipFlag(VM_FLAG_SOUND_ON);
 					} else {
 						*iSel = IDI_WTP_SEL_SOUTH;
-						makeSel(iSel, fCanSel);
+						if (makeSel(iSel, fCanSel)) {
+							// Menu selection made, hide the mouse cursor
+							CursorMan.showMouse(false);
+							return;
+						}
 					}
 					break;
 				case Common::KEYCODE_e:
 					*iSel = IDI_WTP_SEL_EAST;
-					makeSel(iSel, fCanSel);
+					if (makeSel(iSel, fCanSel)) {
+						// Menu selection made, hide the mouse cursor
+						CursorMan.showMouse(false);
+						return;
+					}
 					break;
 				case Common::KEYCODE_w:
 					*iSel = IDI_WTP_SEL_WEST;
-					makeSel(iSel, fCanSel);
+					if (makeSel(iSel, fCanSel)) {
+						// Menu selection made, hide the mouse cursor
+						CursorMan.showMouse(false);
+						return;
+					}
 					break;
 				case Common::KEYCODE_t:
 					*iSel = IDI_WTP_SEL_TAKE;
-					makeSel(iSel, fCanSel);
+					if (makeSel(iSel, fCanSel)) {
+						// Menu selection made, hide the mouse cursor
+						CursorMan.showMouse(false);
+						return;
+					}
 					break;
 				case Common::KEYCODE_d:
 					*iSel = IDI_WTP_SEL_DROP;
-					makeSel(iSel, fCanSel);
+					if (makeSel(iSel, fCanSel)) {
+						// Menu selection made, hide the mouse cursor
+						CursorMan.showMouse(false);
+						return;
+					}
 					break;
 				case Common::KEYCODE_RETURN:
 					switch (*iSel) {
diff --git a/engines/agi/preagi/winnie.h b/engines/agi/preagi/winnie.h
index 399f640b82b..2ece0045ff5 100644
--- a/engines/agi/preagi/winnie.h
+++ b/engines/agi/preagi/winnie.h
@@ -338,7 +338,7 @@ private:
 	void loadGame();
 	void dropObjRnd();
 	void setTakeDrop(int[]);
-	void makeSel(int *, int[]);
+	bool makeSel(int *, int[]);
 
 	void wind();
 	void mist();




More information about the Scummvm-git-logs mailing list