[Scummvm-git-logs] scummvm master -> f9aa7c170bf1cfe6b937c0e2cb8f3de2a9f38b06
elasota
noreply at scummvm.org
Sun Nov 24 19:15:19 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:
f9aa7c170b VCRUISE: Add mouse button and escape actions to the keymap
Commit: f9aa7c170bf1cfe6b937c0e2cb8f3de2a9f38b06
https://github.com/scummvm/scummvm/commit/f9aa7c170bf1cfe6b937c0e2cb8f3de2a9f38b06
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2024-11-24T14:15:16-05:00
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