[Scummvm-git-logs] scummvm branch-2-9 -> da6891979e1c6643b43ac3a6ab7a95e8a26ec924
ccawley2011
noreply at scummvm.org
Mon Nov 25 14:10:16 UTC 2024
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
d59e1d128b MTROPOLIS: Add mouse button actions to the keymap
da6891979e VCRUISE: Add mouse button and escape actions to the keymap
Commit: d59e1d128b5465bf5393aabd90ef9e5585f2f948
https://github.com/scummvm/scummvm/commit/d59e1d128b5465bf5393aabd90ef9e5585f2f948
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2024-11-25T14:09:03Z
Commit Message:
MTROPOLIS: Add mouse button actions to the keymap
Changed paths:
engines/mtropolis/metaengine.cpp
diff --git a/engines/mtropolis/metaengine.cpp b/engines/mtropolis/metaengine.cpp
index fd51e34d439..1ae15bc4b91 100644
--- a/engines/mtropolis/metaengine.cpp
+++ b/engines/mtropolis/metaengine.cpp
@@ -24,7 +24,8 @@
#include "engines/advancedDetector.h"
#include "backends/keymapper/action.h"
-#include "backends/keymapper/keymap.h"
+#include "backends/keymapper/keymapper.h"
+#include "backends/keymapper/standard-actions.h"
#include "graphics/managed_surface.h"
#include "graphics/scaler.h"
@@ -155,8 +156,26 @@ Common::Error MTropolisMetaEngine::createInstance(OSystem *syst, Engine **engine
Common::Array<Common::Keymap *> MTropolisMetaEngine::initKeymaps(const char *target) const {
Common::Keymap *keymap = new Common::Keymap(Common::Keymap::kKeymapTypeGame, "mtropolis", "mTropolis");
-
Common::Action *act;
+
+ act = new Common::Action(Common::kStandardActionLeftClick, _("Left Click"));
+ act->setLeftClickEvent();
+ act->addDefaultInputMapping("MOUSE_LEFT");
+ act->addDefaultInputMapping("JOY_A");
+ keymap->addAction(act);
+
+ act = new Common::Action(Common::kStandardActionRightClick, _("Right Click"));
+ act->setRightClickEvent();
+ act->addDefaultInputMapping("MOUSE_RIGHT");
+ act->addDefaultInputMapping("JOY_B");
+ keymap->addAction(act);
+
+ act = new Common::Action(Common::kStandardActionMiddleClick, _("Middle Click"));
+ act->setMiddleClickEvent();
+ act->addDefaultInputMapping("MOUSE_MIDDLE");
+ act->addDefaultInputMapping("JOY_X");
+ keymap->addAction(act);
+
act = new Common::Action("DEBUG_TOGGLE_OVERLAY", _("Toggle debug overlay"));
act->setCustomEngineActionEvent(MTropolis::Actions::kDebugToggleOverlay);
act->addDefaultInputMapping("F10");
Commit: da6891979e1c6643b43ac3a6ab7a95e8a26ec924
https://github.com/scummvm/scummvm/commit/da6891979e1c6643b43ac3a6ab7a95e8a26ec924
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2024-11-25T14:10:09Z
Commit Message:
VCRUISE: Add mouse button and escape actions to the keymap
Changed paths:
engines/vcruise/metaengine.cpp
engines/vcruise/runtime.cpp
engines/vcruise/runtime.h
engines/vcruise/vcruise.cpp
diff --git a/engines/vcruise/metaengine.cpp b/engines/vcruise/metaengine.cpp
index 3c22e374f56..a1aeacaf1c1 100644
--- a/engines/vcruise/metaengine.cpp
+++ b/engines/vcruise/metaengine.cpp
@@ -22,7 +22,8 @@
#include "common/translation.h"
#include "backends/keymapper/action.h"
-#include "backends/keymapper/keymap.h"
+#include "backends/keymapper/keymapper.h"
+#include "backends/keymapper/standard-actions.h"
#include "engines/advancedDetector.h"
#include "vcruise/vcruise.h"
@@ -152,8 +153,20 @@ Common::Error VCruiseMetaEngine::createInstance(OSystem *syst, Engine **engine,
Common::Array<Common::Keymap *> VCruiseMetaEngine::initKeymaps(const char *target) const {
Common::Keymap *keymap = new Common::Keymap(Common::Keymap::kKeymapTypeGame, "vcruise", "V-Cruise");
-
Common::Action *act;
+
+ act = new Common::Action(Common::kStandardActionLeftClick, _("Left Click"));
+ act->setLeftClickEvent();
+ act->addDefaultInputMapping("MOUSE_LEFT");
+ act->addDefaultInputMapping("JOY_A");
+ keymap->addAction(act);
+
+ act = new Common::Action("VCRUISE_ESCAPE", _("Escape"));
+ act->setCustomEngineActionEvent(VCruise::kKeymappedEventEscape);
+ act->addDefaultInputMapping("ESCAPE");
+ act->addDefaultInputMapping("JOY_Y");
+ keymap->addAction(act);
+
act = new Common::Action("VCRUISE_HELP", _("Display help screen"));
act->setCustomEngineActionEvent(VCruise::kKeymappedEventHelp);
act->addDefaultInputMapping("F1");
diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index b9cc8925901..f4c0bdc8f8c 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -553,7 +553,7 @@ ScriptEnvironmentVars::ScriptEnvironmentVars() : lmb(false), lmbDrag(false), esc
panInteractionID(0), clickInteractionID(0), fpsOverride(0), lastHighlightedItem(0), animChangeFrameOffset(0), animChangeNumFrames(0) {
}
-OSEvent::OSEvent() : type(kOSEventTypeInvalid), keyCode(static_cast<Common::KeyCode>(0)), keymappedEvent(kKeymappedEventNone), timestamp(0) {
+OSEvent::OSEvent() : type(kOSEventTypeInvalid), keymappedEvent(kKeymappedEventNone), timestamp(0) {
}
void Runtime::RenderSection::init(const Common::Rect ¶mRect, const Graphics::PixelFormat &fmt) {
@@ -2362,7 +2362,7 @@ bool Runtime::runWaitForAnimation() {
// Still waiting, check events
OSEvent evt;
while (popOSEvent(evt)) {
- if (evt.type == kOSEventTypeKeyDown && evt.keyCode == Common::KEYCODE_ESCAPE) {
+ if (evt.type == kOSEventTypeKeymappedEvent && evt.keymappedEvent == kKeymappedEventEscape) {
if (_escOn) {
// Terminate the animation
if (_animDecoderState == kAnimDecoderStatePlaying) {
@@ -6858,14 +6858,6 @@ void Runtime::onMouseMove(int16 x, int16 y) {
queueOSEvent(evt);
}
-void Runtime::onKeyDown(Common::KeyCode keyCode) {
- OSEvent evt;
- evt.type = kOSEventTypeKeyDown;
- evt.keyCode = keyCode;
-
- queueOSEvent(evt);
-}
-
void Runtime::onKeymappedEvent(KeymappedEvent kme) {
OSEvent evt;
evt.type = kOSEventTypeKeymappedEvent;
diff --git a/engines/vcruise/runtime.h b/engines/vcruise/runtime.h
index dfbaccb40f5..4a21f066ce7 100644
--- a/engines/vcruise/runtime.h
+++ b/engines/vcruise/runtime.h
@@ -553,14 +553,13 @@ enum OSEventType {
kOSEventTypeLButtonDown,
kOSEventTypeLButtonUp,
- kOSEventTypeKeyDown,
-
kOSEventTypeKeymappedEvent,
};
enum KeymappedEvent {
kKeymappedEventNone,
+ kKeymappedEventEscape,
kKeymappedEventHelp,
kKeymappedEventSaveGame,
kKeymappedEventLoadGame,
@@ -584,7 +583,6 @@ struct OSEvent {
OSEventType type;
Common::Point pos;
- Common::KeyCode keyCode;
KeymappedEvent keymappedEvent;
uint32 timestamp;
};
@@ -666,7 +664,6 @@ public:
void onLButtonDown(int16 x, int16 y);
void onLButtonUp(int16 x, int16 y);
void onMouseMove(int16 x, int16 y);
- void onKeyDown(Common::KeyCode keyCode);
void onKeymappedEvent(KeymappedEvent evt);
bool canSave(bool onCurrentScreen) const;
diff --git a/engines/vcruise/vcruise.cpp b/engines/vcruise/vcruise.cpp
index c2aedd8e3ff..cce7b4df6fd 100644
--- a/engines/vcruise/vcruise.cpp
+++ b/engines/vcruise/vcruise.cpp
@@ -64,9 +64,6 @@ void VCruiseEngine::handleEvents() {
case Common::EVENT_MOUSEMOVE:
_runtime->onMouseMove(evt.mouse.x, evt.mouse.y);
break;
- case Common::EVENT_KEYDOWN:
- _runtime->onKeyDown(evt.kbd.keycode);
- break;
case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
_runtime->onKeymappedEvent(static_cast<VCruise::KeymappedEvent>(evt.customType));
break;
More information about the Scummvm-git-logs
mailing list