[Scummvm-git-logs] scummvm master -> de81248bb42800b5a8141812735538ab75d0e2fc

hax0kartik noreply at scummvm.org
Wed Oct 11 13:11:05 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:
de81248bb4 CRAB: Fix keys getting eaten when trying to input save name


Commit: de81248bb42800b5a8141812735538ab75d0e2fc
    https://github.com/scummvm/scummvm/commit/de81248bb42800b5a8141812735538ab75d0e2fc
Author: Kartik Agarwala (agarwala.kartik at gmail.com)
Date: 2023-10-11T18:31:38+05:30

Commit Message:
CRAB: Fix keys getting eaten when trying to input save name

Changed paths:
    engines/crab/input/input.cpp
    engines/crab/input/input.h
    engines/crab/mainmenu.cpp


diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index 259fb254ba3..47b8071d214 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -280,16 +280,21 @@ void InputManager::setKeyBindingMode(KeyBindingMode mode) {
 	_keyMode = mode;
 
 	Common::Keymapper *const mapper = g_engine->getEventManager()->getKeymapper();
-	mapper->disableAllGameKeymaps();
-
-	mapper->setGameKeymapState("Unrest-HUD", true);
 
 	switch (mode) {
+	case KBM_NONE:
+		mapper->disableAllGameKeymaps();
+		break;
+
 	case KBM_GAME:
+		mapper->disableAllGameKeymaps();
+		mapper->setGameKeymapState("Unrest-HUD", true);
 		mapper->setGameKeymapState("Unrest-Game", true);
 		break;
 
 	case KBM_UI:
+		mapper->disableAllGameKeymaps();
+		mapper->setGameKeymapState("Unrest-HUD", true);
 		mapper->setGameKeymapState("Unrest-UI", true);
 		break;
 	}
diff --git a/engines/crab/input/input.h b/engines/crab/input/input.h
index 9983516ccdb..332557b4fcc 100644
--- a/engines/crab/input/input.h
+++ b/engines/crab/input/input.h
@@ -80,8 +80,9 @@ enum InputType {
 };
 
 enum KeyBindingMode {
-	KBM_GAME = 0,
-	KBM_UI = 1
+	KBM_NONE = 0,
+	KBM_GAME = 1,
+	KBM_UI = 2
 };
 
 // Constants related to menu size
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 0a7dfecc82b..74c35d59d69 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -315,6 +315,10 @@ void MainMenu::changeState(MenuState ms, const bool &start) {
 			g_engine->_musicManager->playMusic(_musicKey._credits);
 	}
 
+	// Disable keymapper if switching state to input savename so inputs do not get "eaten".
+	KeyBindingMode mode = (ms == STATE_SAVENAME ? KBM_NONE : KBM_GAME);
+	g_engine->_inputManager->setKeyBindingMode(mode);
+
 	// Set current state
 	_state = ms;
 




More information about the Scummvm-git-logs mailing list