[Scummvm-git-logs] scummvm master -> f5f4c300b9c4032f4fead861e817265dae8d476b
dreammaster
paulfgilbert at gmail.com
Sat Mar 7 04:12:18 UTC 2020
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
295bc8ea18 ULTIMA8: Fix quit key sequence check
1dcd3d5226 ULTIMA8: Properly reset current domain after reading game Id
f5f4c300b9 ULTIMA8: Add all the other keys to the keymapper
Commit: 295bc8ea185ffdbe7ede06e8d95e6d19a5968d2a
https://github.com/scummvm/scummvm/commit/295bc8ea185ffdbe7ede06e8d95e6d19a5968d2a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-03-06T19:32:43-08:00
Commit Message:
ULTIMA8: Fix quit key sequence check
Changed paths:
engines/ultima/ultima8/ultima8.cpp
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index eabf432d6e..4b3f58335b 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -893,7 +893,7 @@ void Ultima8Engine::handleEvent(const Common::Event &event) {
break;
// Any special key handling goes here
- if ((event.kbd.keycode == Common::KEYCODE_x || event.kbd.keycode == Common::KEYCODE_x) &&
+ if ((event.kbd.keycode == Common::KEYCODE_q || event.kbd.keycode == Common::KEYCODE_x) &&
(event.kbd.flags & (Common::KBD_CTRL | Common::KBD_ALT | Common::KBD_META)) != 0)
ForceQuit();
break;
Commit: 1dcd3d5226e0d5f0cafe3560e1b22c8b0efc1be4
https://github.com/scummvm/scummvm/commit/1dcd3d5226e0d5f0cafe3560e1b22c8b0efc1be4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-03-06T19:32:43-08:00
Commit Message:
ULTIMA8: Properly reset current domain after reading game Id
Changed paths:
engines/ultima/detection.cpp
engines/ultima/detection.h
diff --git a/engines/ultima/detection.cpp b/engines/ultima/detection.cpp
index 89adf34ef1..11978b16b5 100644
--- a/engines/ultima/detection.cpp
+++ b/engines/ultima/detection.cpp
@@ -103,8 +103,7 @@ const char *UltimaMetaEngine::getSavegameFile(int saveGameIdx, const char *targe
SaveStateList UltimaMetaEngine::listSaves(const char *target) const {
SaveStateList saveList = AdvancedMetaEngine::listSaves(target);
- ConfMan.setActiveDomain(target);
- Common::String gameId = ConfMan.get("gameid");
+ Common::String gameId = getGameId(target);
if (gameId == "ultima6" || gameId == "ultima6_enh")
Ultima::Nuvie::MetaEngine::listSaves(saveList);
@@ -112,14 +111,26 @@ SaveStateList UltimaMetaEngine::listSaves(const char *target) const {
}
Common::KeymapArray UltimaMetaEngine::initKeymaps(const char *target) const {
- ConfMan.setActiveDomain(target);
- Common::String gameId = ConfMan.get("gameid");
+ Common::String gameId = getGameId(target);
if (gameId == "ultima8")
return Ultima::Ultima8::MetaEngine::initKeymaps();
return Common::KeymapArray();
}
+Common::String UltimaMetaEngine::getGameId(const char *target) {
+ // Store a copy of the active domain
+ Common::String currDomain = ConfMan.getActiveDomainName();
+
+ // Switch to the given target domain and get it's game Id
+ ConfMan.setActiveDomain(target);
+ Common::String gameId = ConfMan.get("gameid");
+
+ // Switch back to the original domain and return the game Id
+ ConfMan.setActiveDomain(currDomain);
+ return gameId;
+}
+
#if PLUGIN_ENABLED_DYNAMIC(ULTIMA)
REGISTER_PLUGIN_DYNAMIC(ULTIMA, PLUGIN_TYPE_ENGINE, UltimaMetaEngine);
#else
diff --git a/engines/ultima/detection.h b/engines/ultima/detection.h
index 889ca1dc70..5c012e019e 100644
--- a/engines/ultima/detection.h
+++ b/engines/ultima/detection.h
@@ -60,6 +60,11 @@ struct UltimaGameDescription {
} // End of namespace Ultima
class UltimaMetaEngine : public AdvancedMetaEngine {
+private:
+ /**
+ * Gets the game Id given a target string
+ */
+ static Common::String getGameId(const char *target);
public:
UltimaMetaEngine();
~UltimaMetaEngine() override {}
Commit: f5f4c300b9c4032f4fead861e817265dae8d476b
https://github.com/scummvm/scummvm/commit/f5f4c300b9c4032f4fead861e817265dae8d476b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-03-06T20:11:29-08:00
Commit Message:
ULTIMA8: Add all the other keys to the keymapper
Changed paths:
engines/ultima/ultima8/meta_engine.cpp
engines/ultima/ultima8/meta_engine.h
engines/ultima/ultima8/ultima8.cpp
diff --git a/engines/ultima/ultima8/meta_engine.cpp b/engines/ultima/ultima8/meta_engine.cpp
index 352c9ac58f..67a8981c02 100644
--- a/engines/ultima/ultima8/meta_engine.cpp
+++ b/engines/ultima/ultima8/meta_engine.cpp
@@ -32,17 +32,66 @@ struct KeybindingRecord {
KeybindingAction _action;
const char *_id;
const char *_desc;
- const char *_method;
+ const char *_pressMethod;
+ const char *_releaseMethod;
const char *_key;
};
static const KeybindingRecord KEYS[] = {
- { ACTION_COMBAT, "COMBAT", "Combat", "MainActor::toggleCombat", "c" },
+ { ACTION_QUICKSAVE, "QUICKSAVE", "Quick Save", "GUIApp::saveGame QuickSave", nullptr, "F1" },
+ { ACTION_SAVE, "SAVE", "Save Game", "GUIApp::saveGame", nullptr, "F5" },
+ { ACTION_LOAD, "LOAD", "Load Game", "GUIApp::loadGame", nullptr, "F7" },
+ { ACTION_BEDROLL, "BEDROLL", "Bedroll", "MainActor::useBedroll", nullptr, "b" },
+ { ACTION_COMBAT, "COMBAT", "Combat", "MainActor::toggleCombat", nullptr, "c" },
+ { ACTION_BACKPACK, "BACKPACK", "Use Backpack", "MainActor::useBackpack", nullptr, "i" },
+ { ACTION_KEYRING, "KEYRING", "Keyring", "MainActor::useKeyring", nullptr, "k" },
+ { ACTION_MINIMAP, "MINIMAP", "Toggle Minimap", "MiniMapGump::toggle", nullptr, "m" },
+ { ACTION_RECALL, "RECALL", "Use Recall", "MainActor::useRecall", nullptr, "r" },
+ { ACTION_INVENTORY, "INVENTORY", "Inventory", "MainActor::useInventory", nullptr, "z" },
+ { ACTION_MENU, "MENU", "Game Menu", "MenuGump::showMenu", nullptr, "ESCAPE" },
+ { ACTION_CLOSE_GUMPS, "CLOSE_GUMPS", "Close Gumps", "GUIApp::closeItemGumps", nullptr, "BACKSPACE" },
+ { ACTION_HIGHLIGHT_ITEMS, "HIGHLIGHT_ITEMS", "Show Highlight Items", "GameMapGump::toggleHighlightItems",
+ "GameMapGump::toggleHighlightItems", "TAB" },
+ { ACTION_TOGGLE_TOUCHING, "TOUCHING", "Show Touching Items", "GUIApp::toggleShowTouchingItems", nullptr, "h" },
+
+ { ACTION_NONE, nullptr, nullptr, nullptr, nullptr }
+};
+
+static const KeybindingRecord CHEAT_KEYS[] = {
+ { ACTION_CHEAT_MODE, "CHEAT_MODE", "Toggle Cheat Mode", "Cheat::toggle", nullptr, "BACKQUOTE" },
+ { ACTION_CLIPPING, "CLIPPING", "Toggle Clipping", "QuickAvatarMoverProcess::toggleClipping", nullptr, "INSERT" },
+ { ACTION_DEC_SORT_ORDER, "DEC_SORT_ORDER", "Decrement Map Sort Order", "GameMapGump::decrementSortOrder", nullptr, "LEFTBRACKET" },
+ { ACTION_INC_SORT_ORDER, "INC_SORT_ORDER", "Increment Map Sort Order", "GameMapGump::incrementSortOrder", nullptr, "RIGHTBRACKET" },
+ { ACTION_ASCEND, "ASCEND", "Ascend", "QuickAvatarMoverProcess::startAscend", "QuickAvatarMoverProcess::stopAscend", "HOME" },
+ { ACTION_DESCEND, "DESCEND", "Descend", "QuickAvatarMoverProcess::startDescend", "QuickAvatarMoverProcess::stopDescend", "END" },
+ { ACTION_MOVE_UP, "MOVE_UP", "Move Up", "QuickAvatarMoverProcess::startMoveUp", "QuickAvatarMoverProcess::stopMoveUp", "UP" },
+ { ACTION_MOVE_DOWN, "MOVE_DOWN", "Move Down", "QuickAvatarMoverProcess::startMoveDown", "QuickAvatarMoverProcess::stopMoveDown", "DOWN" },
+ { ACTION_MOVE_LEFT, "MOVE_LEFT", "Move Left", "QuickAvatarMoverProcess::startMoveLeft", "QuickAvatarMoverProcess::stopMoveLeft", "LEFT" },
+ { ACTION_RIGHT, "MOVE_RIGHT", "Move Right", "QuickAvatarMoverProcess::startMoveRight", "QuickAvatarMoverProcess::stopMoveRight", "RIGHT" },
+
+ { ACTION_NONE, nullptr, nullptr, nullptr, nullptr }
+};
+
+#ifndef RELEASE_BUILD
+static const KeybindingRecord DEBUG_KEYS[] = {
+ { ACTION_TOGGLE_PAINT, "TOGGLE_PAINT", "Toggle Paint Editor Items", "GUIApp::togglePaintEditorItems", nullptr, "e" },
+ { ACTION_ENGINE_STATS, "STATS", "List engine stats", "GUIApp::engineStats", nullptr, "t" },
+ { ACTION_FRAME_BY_FRAME, "FRAME_BY_FRAME", "Toggle Frame By Frame", "Kernel::toggleFrameByFrame", nullptr, "F12" },
+ { 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 }
};
+
Common::KeymapArray MetaEngine::initKeymaps() {
+ Common::KeymapArray keymapArray;
+
+ // Core keymaps
Common::Keymap *keyMap = new Common::Keymap(Common::Keymap::kKeymapTypeGame, "ultima8", _("Ultima VIII"));
+ keymapArray.push_back(keyMap);
for (const KeybindingRecord *r = KEYS; r->_id; ++r) {
Common::Action *act = new Common::Action(r->_id, _(r->_desc));
@@ -51,16 +100,61 @@ Common::KeymapArray MetaEngine::initKeymaps() {
keyMap->addAction(act);
}
- return Common::Keymap::arrayOf(keyMap);
+ // Cheat keymaps
+ keyMap = new Common::Keymap(Common::Keymap::kKeymapTypeGame, "ultima8_cheats", _("Ultima VIII Cheats"));
+ keymapArray.push_back(keyMap);
+
+ for (const KeybindingRecord *r = CHEAT_KEYS; r->_id; ++r) {
+ Common::Action *act = new Common::Action(r->_id, _(r->_desc));
+ act->setCustomEngineActionEvent(r->_action);
+ act->addDefaultInputMapping(r->_key);
+ keyMap->addAction(act);
+ }
+
+#ifndef RELEASE_BUILD
+ // Debug keymaps
+ keyMap = new Common::Keymap(Common::Keymap::kKeymapTypeGame, "ultima8_debug", _("Ultima VIII Debug"));
+ keymapArray.push_back(keyMap);
+
+ for (const KeybindingRecord *r = DEBUG_KEYS; r->_id; ++r) {
+ Common::Action *act = new Common::Action(r->_id, _(r->_desc));
+ act->setCustomEngineActionEvent(r->_action);
+ act->addDefaultInputMapping(r->_key);
+ keyMap->addAction(act);
+ }
+#endif
+
+ return keymapArray;
}
-void MetaEngine::executeAction(KeybindingAction keyAction) {
- for (const KeybindingRecord *r = KEYS; r->_id; ++r) {
- if (r->_action == keyAction) {
- g_debugger->executeCommand(r->_method);
- break;
+void MetaEngine::pressAction(KeybindingAction keyAction) {
+ Common::String methodName = getMethod(keyAction, true);
+ if (!methodName.empty())
+ g_debugger->executeCommand(methodName);
+}
+
+void MetaEngine::releaseAction(KeybindingAction keyAction) {
+ Common::String methodName = getMethod(keyAction, false);
+ if (!methodName.empty())
+ g_debugger->executeCommand(methodName);
+}
+
+Common::String MetaEngine::getMethod(KeybindingAction keyAction, bool isPress) {
+#ifdef RELEASE_BUILD
+ const KeybindingRecord *KEY_ARRAYS[] = { KEYS, CHEAT_KEYS, nullptr };
+#else
+ const KeybindingRecord *KEY_ARRAYS[] = { KEYS, CHEAT_KEYS, DEBUG_KEYS, nullptr };
+#endif
+
+ for (const KeybindingRecord **arr = KEY_ARRAYS; *arr; ++arr) {
+ for (const KeybindingRecord *r = *arr; r->_id; ++r) {
+ if (r->_action == keyAction) {
+ return Common::String(isPress ? r->_pressMethod : r->_releaseMethod);
+ }
}
}
+
+ return Common::String();
}
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/meta_engine.h b/engines/ultima/ultima8/meta_engine.h
index 3fc4d4fef4..dd004ff262 100644
--- a/engines/ultima/ultima8/meta_engine.h
+++ b/engines/ultima/ultima8/meta_engine.h
@@ -29,10 +29,27 @@ namespace Ultima {
namespace Ultima8 {
enum KeybindingAction {
- ACTION_NONE, ACTION_COMBAT
+ ACTION_QUICKSAVE, ACTION_SAVE, ACTION_LOAD, ACTION_BEDROLL, ACTION_COMBAT, ACTION_BACKPACK,
+ ACTION_KEYRING, ACTION_MINIMAP, ACTION_RECALL, ACTION_INVENTORY, ACTION_MENU,
+ ACTION_CLOSE_GUMPS, ACTION_HIGHLIGHT_ITEMS, ACTION_TOGGLE_TOUCHING,
+
+ ACTION_CHEAT_MODE, ACTION_CLIPPING, ACTION_DEC_SORT_ORDER, ACTION_INC_SORT_ORDER, ACTION_ASCEND,
+ ACTION_DESCEND, ACTION_MOVE_UP, ACTION_MOVE_DOWN, ACTION_MOVE_LEFT, ACTION_RIGHT,
+
+#ifndef RELEASE_BUILD
+ ACTION_TOGGLE_PAINT, ACTION_ENGINE_STATS, ACTION_FRAME_BY_FRAME,
+ ACTION_ADVANCE_FRAME, ACTION_TOGGLE_STASIS, ACTION_SHAPE_VIEWER,
+#endif
+
+ ACTION_NONE
};
class MetaEngine {
+private:
+ /**
+ * Get the method to execute
+ */
+ static Common::String getMethod(KeybindingAction keyAction, bool isPress);
public:
/**
* Initialize keymaps
@@ -40,9 +57,14 @@ public:
static Common::KeymapArray initKeymaps();
/**
- * Execute an engine keymap action
+ * Execute an engine keymap press action
+ */
+ static void pressAction(KeybindingAction keyAction);
+
+ /**
+ * Execute an engine keymap release action
*/
- static void executeAction(KeybindingAction keyAction);
+ static void releaseAction(KeybindingAction keyAction);
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index 4b3f58335b..f3098a5bf4 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -786,7 +786,11 @@ void Ultima8Engine::handleEvent(const Common::Event &event) {
break;
case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
- MetaEngine::executeAction((KeybindingAction)event.customType);
+ MetaEngine::pressAction((KeybindingAction)event.customType);
+ break;
+
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_END:
+ MetaEngine::releaseAction((KeybindingAction)event.customType);
break;
case Common::EVENT_QUIT:
More information about the Scummvm-git-logs
mailing list