[Scummvm-git-logs] scummvm master -> e00cec9e0c822368d44a13a0bd7d70eac703373b
dreammaster
paulfgilbert at gmail.com
Sun Mar 8 02:27:28 UTC 2020
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:
e00cec9e0c ULTIMA8: Menu action closes menu if it's already open
Commit: e00cec9e0c822368d44a13a0bd7d70eac703373b
https://github.com/scummvm/scummvm/commit/e00cec9e0c822368d44a13a0bd7d70eac703373b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-03-07T18:27:11-08:00
Commit Message:
ULTIMA8: Menu action closes menu if it's already open
Changed paths:
engines/ultima/ultima8/meta_engine.cpp
engines/ultima/ultima8/ultima8.cpp
diff --git a/engines/ultima/ultima8/meta_engine.cpp b/engines/ultima/ultima8/meta_engine.cpp
index 67a8981c02..babae36bf7 100644
--- a/engines/ultima/ultima8/meta_engine.cpp
+++ b/engines/ultima/ultima8/meta_engine.cpp
@@ -80,10 +80,10 @@ static const KeybindingRecord DEBUG_KEYS[] = {
{ ACTION_ADVANCE_FRAME, "ADVANCE_FRAME", "Advance Frame", "Kernel::advanceFrame", nullptr, "SPACE" },
{ ACTION_TOGGLE_STASIS, "TOGGLE_STASIS", "Toggle Avatar In Stasis", "GUIApp::toggleAvatarInStasis", nullptr, "F10" },
{ ACTION_SHAPE_VIEWER, "SHAPE_VIEWER", "Show Shape Viewer", "ShapeViewerGump::U8ShapeViewer", nullptr, "F11" },
-#endif
{ ACTION_NONE, nullptr, nullptr, nullptr, nullptr }
};
+#endif
Common::KeymapArray MetaEngine::initKeymaps() {
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index f3098a5bf4..48724af59c 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -737,6 +737,7 @@ void Ultima8Engine::handleEvent(const Common::Event &event) {
HID_Key key = HID_LAST;
uint16 evn = HID_EVENT_LAST;
bool handled = false;
+ KeybindingAction keybindAction = ACTION_NONE;
switch (event.type) {
case Common::EVENT_KEYDOWN:
@@ -785,14 +786,6 @@ void Ultima8Engine::handleEvent(const Common::Event &event) {
_mouse->setMouseCoords(event.mouse.x, event.mouse.y);
break;
- case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
- MetaEngine::pressAction((KeybindingAction)event.customType);
- break;
-
- case Common::EVENT_CUSTOM_ENGINE_ACTION_END:
- MetaEngine::releaseAction((KeybindingAction)event.customType);
- break;
-
case Common::EVENT_QUIT:
_isRunning = false;
break;
@@ -807,12 +800,13 @@ void Ultima8Engine::handleEvent(const Common::Event &event) {
}
// Text mode input. A few hacks here
- if (!_textModes.empty()) {
- Gump *gump = 0;
+ Gump *gump = 0;
+ if (!_textModes.empty()) {
while (!_textModes.empty()) {
gump = p_dynamic_cast<Gump *>(_objectManager->getObject(_textModes.front()));
- if (gump) break;
+ if (gump)
+ break;
_textModes.pop_front();
}
@@ -848,12 +842,38 @@ void Ultima8Engine::handleEvent(const Common::Event &event) {
gump->OnKeyUp(event.kbd.keycode);
return;
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
+ if ((KeybindingAction)event.customType == ACTION_MENU) {
+ // When any gump is already open, the game menu action acts to close the gump
+ gump->OnKeyDown(Common::KEYCODE_ESCAPE, 0);
+ }
+ break;
+
default:
break;
}
}
}
+ if (!gump) {
+ // Handling for keybinding actions, which only happens if no gump is open
+ switch (event.type) {
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
+ keybindAction = (KeybindingAction)event.customType;
+ if (keybindAction != ACTION_NONE)
+ MetaEngine::pressAction(keybindAction);
+ break;
+
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_END:
+ keybindAction = (KeybindingAction)event.customType;
+ if (keybindAction != ACTION_NONE)
+ MetaEngine::releaseAction(keybindAction);
+ break;
+ default:
+ break;
+ }
+ }
+
// Old style input begins here
switch (event.type) {
More information about the Scummvm-git-logs
mailing list