[Scummvm-git-logs] scummvm master -> 130a1f0996fcd16f3920e023b6c06681982f7ea3
neuromancer
noreply at scummvm.org
Fri Aug 9 16:25:07 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:
130a1f0996 FREESCAPE: Improve keymapper support coverage
Commit: 130a1f0996fcd16f3920e023b6c06681982f7ea3
https://github.com/scummvm/scummvm/commit/130a1f0996fcd16f3920e023b6c06681982f7ea3
Author: NabeelShabbir (i210443 at nu.edu.pk)
Date: 2024-08-09T18:25:02+02:00
Commit Message:
FREESCAPE: Improve keymapper support coverage
Changed paths:
engines/freescape/events.cpp
engines/freescape/freescape.cpp
engines/freescape/freescape.h
engines/freescape/games/castle/castle.cpp
engines/freescape/games/castle/castle.h
engines/freescape/games/dark/dark.cpp
engines/freescape/games/dark/dark.h
engines/freescape/games/driller/driller.cpp
engines/freescape/games/driller/driller.h
engines/freescape/games/eclipse/eclipse.cpp
engines/freescape/games/eclipse/eclipse.h
engines/freescape/metaengine.cpp
engines/freescape/movement.cpp
engines/freescape/ui.cpp
diff --git a/engines/freescape/events.cpp b/engines/freescape/events.cpp
index ad373986283..3bc38bf53ed 100644
--- a/engines/freescape/events.cpp
+++ b/engines/freescape/events.cpp
@@ -36,6 +36,20 @@ bool EventManagerWrapper::pollEvent(Common::Event &event) {
if (gotEvent) {
switch (event.type) {
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
+ if (event.customType == kActionEscape)
+ break;
+ _currentActionDown = event.customType;
+ _keyRepeatTime = time + kKeyRepeatInitialDelay;
+ break;
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_END:
+ if (event.customType == kActionEscape)
+ break;
+ if (event.customType == _currentActionDown) {
+ // Only stop firing events if it's the current key
+ _currentActionDown = kActionNone;
+ }
+ break;
case Common::EVENT_KEYDOWN:
if (event.kbd == Common::KEYCODE_ESCAPE || event.kbd == Common::KEYCODE_F5)
break;
@@ -68,9 +82,16 @@ bool EventManagerWrapper::pollEvent(Common::Event &event) {
event.kbdRepeat = true;
event.kbd = _currentKeyDown;
_keyRepeatTime = time + kKeyRepeatSustainDelay;
-
return true;
}
+ if (_currentActionDown != kActionNone && _keyRepeatTime <= time) {
+ event.type = Common::EVENT_CUSTOM_ENGINE_ACTION_START;
+ event.kbdRepeat = true;
+ event.customType = _currentActionDown;
+ _keyRepeatTime = time + kKeyRepeatSustainDelay;
+ return true;
+
+ }
return false;
}
@@ -79,6 +100,7 @@ bool EventManagerWrapper::pollEvent(Common::Event &event) {
void EventManagerWrapper::purgeKeyboardEvents() {
_delegate->purgeKeyboardEvents();
_currentKeyDown.keycode = Common::KEYCODE_INVALID;
+ _currentActionDown = kActionNone;
}
void EventManagerWrapper::purgeMouseEvents() {
diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 2e434d851c7..bcdade6c01c 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -489,72 +489,50 @@ void FreescapeEngine::processInput() {
if (_gameStateControl != kFreescapeGameStatePlaying) {
if (event.type == Common::EVENT_SCREEN_CHANGED)
; // Allow event
- else if (_gameStateControl == kFreescapeGameStateEnd && event.type == Common::EVENT_KEYDOWN) {
+ else if (_gameStateControl == kFreescapeGameStateEnd
+ && (event.type == Common::EVENT_KEYDOWN || event.type == Common::EVENT_CUSTOM_ENGINE_ACTION_START)) {
_endGameKeyPressed = true;
continue;
- } else if (event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE)
+ } else if (event.type == Common::EVENT_CUSTOM_ENGINE_ACTION_START && event.customType == kActionEscape)
; // Allow event
else if (event.customType != 0xde00)
continue;
}
switch (event.type) {
- case Common::EVENT_JOYBUTTON_DOWN:
- if (_hasFallen || _playerWasCrushed)
- break;
- switch (event.joystick.button) {
- case Common::JOYSTICK_BUTTON_B:
- case Common::JOYSTICK_BUTTON_DPAD_UP:
- move(kForwardMovement, _scaleVector.x(), deltaTime);
- break;
- case Common::JOYSTICK_BUTTON_DPAD_DOWN:
- move(kBackwardMovement, _scaleVector.x(), deltaTime);
- break;
- case Common::JOYSTICK_BUTTON_DPAD_LEFT:
- move(kLeftMovement, _scaleVector.y(), deltaTime);
- break;
- case Common::JOYSTICK_BUTTON_DPAD_RIGHT:
- move(kRightMovement, _scaleVector.y(), deltaTime);
- break;
- }
- break;
- case Common::EVENT_KEYDOWN:
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
if (_hasFallen)
break;
- switch (event.kbd.keycode) {
- case Common::KEYCODE_o:
- case Common::KEYCODE_UP:
+ switch (event.customType) {
+ case kActionMoveUp:
move(kForwardMovement, _scaleVector.x(), deltaTime);
break;
- case Common::KEYCODE_k:
- case Common::KEYCODE_DOWN:
+ case kActionMoveDown:
move(kBackwardMovement, _scaleVector.x(), deltaTime);
break;
- case Common::KEYCODE_LEFT:
+ case kActionMoveLeft:
move(kLeftMovement, _scaleVector.y(), deltaTime);
break;
- case Common::KEYCODE_RIGHT:
+ case kActionMoveRight:
move(kRightMovement, _scaleVector.y(), deltaTime);
break;
- case Common::KEYCODE_KP5:
- case Common::KEYCODE_KP0:
- case Common::KEYCODE_0:
+ case kActionShoot:
shoot();
break;
- case Common::KEYCODE_p:
+ case kActionRotateUp:
rotate(0, 5);
break;
- case Common::KEYCODE_l:
+ case kActionRotateDown:
rotate(0, -5);
break;
- case Common::KEYCODE_u:
+ case kActionTurnBack:
rotate(180, 0);
break;
- case Common::KEYCODE_n:
+ case kActionToggleClipMode:
_noClipMode = !_noClipMode;
_flyMode = _noClipMode;
break;
- case Common::KEYCODE_ESCAPE:
+ case kActionEscape:
drawFrame();
_savedScreen = _gfx->getScreenshot();
openMainMenuDialog();
@@ -562,7 +540,7 @@ void FreescapeEngine::processInput() {
_savedScreen->free();
delete _savedScreen;
break;
- case Common::KEYCODE_SPACE:
+ case kActionChangeModeOrSkip:
_shootMode = !_shootMode;
centerCrossair();
if (!_shootMode) {
@@ -574,14 +552,20 @@ void FreescapeEngine::processInput() {
_eventManager->purgeKeyboardEvents();
}
break;
- case Common::KEYCODE_i:
+ case kActionInfoMenu:
drawInfoMenu();
break;
default:
- pressedKey(event.kbd.keycode);
+ pressedKey(event.customType);
break;
}
break;
+ case Common::EVENT_KEYDOWN:
+ if (_hasFallen)
+ break;
+
+ pressedKey(event.kbd.keycode);
+ break;
case Common::EVENT_KEYUP:
if (_hasFallen)
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 08e1ddc10e9..96b0a81a73e 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -57,6 +57,40 @@ enum CameraMovement {
kRightMovement
};
+enum FREESCAPEAction {
+ kActionNone,
+ kActionEscape,
+ kActionSave,
+ kActionLoad,
+ kActionToggleSound,
+ kActionMoveUp,
+ kActionMoveDown,
+ kActionMoveLeft,
+ kActionMoveRight,
+ kActionShoot,
+ kActionRunMode,
+ kActionRest,
+ kActionChangeAngle,
+ kActionChangeStepSize,
+ kActionToggleRiseLower,
+ kActionRiseOrFlyUp,
+ kActionLowerOrFlyDown,
+ kActionChangeModeOrSkip,
+ kActionFaceForward,
+ kActionRotateUp,
+ kActionRotateDown,
+ kActionRotateLeft,
+ kActionRotateRight,
+ kActionTurnBack,
+ kActionInfoMenu,
+ kActionIncreaseStepSize,
+ kActionDecreaseStepSize,
+ kActionToggleFlyMode,
+ kActionToggleClipMode,
+ kActionDeployDrillingRig,
+ kActionCollectDrillingRig
+};
+
typedef Common::HashMap<uint16, Area *> AreaMap;
typedef Common::Array<byte *> ColorMap;
typedef Common::HashMap<uint16, int32> StateVars;
@@ -101,6 +135,7 @@ private:
Common::EventManager *_delegate;
Common::KeyState _currentKeyDown;
+ Common::CustomEventType _currentActionDown;
uint32 _keyRepeatTime;
};
@@ -269,7 +304,7 @@ public:
bool _shootMode;
bool _noClipMode;
bool _invertY;
- virtual void initKeymaps(Common::Keymap *engineKeyMap, const char *target);
+ virtual void initKeymaps(Common::Keymap *engineKeyMap, Common::Keymap *infoScreenKeyMap, const char *target);
EventManagerWrapper *_eventManager;
void processInput();
void resetInput();
diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index 62cfa3e8c84..2db672fa8a7 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -23,6 +23,11 @@
#include "common/memstream.h"
#include "common/config-manager.h"
+#include "backends/keymapper/action.h"
+#include "backends/keymapper/keymap.h"
+#include "backends/keymapper/standard-actions.h"
+#include "common/translation.h"
+
#include "freescape/freescape.h"
#include "freescape/games/castle/castle.h"
#include "freescape/language/8bitDetokeniser.h"
@@ -75,6 +80,71 @@ CastleEngine::~CastleEngine() {
}
}
+void CastleEngine::initKeymaps(Common::Keymap *engineKeyMap, Common::Keymap *infoScreenKeyMap, const char *target) {
+ FreescapeEngine::initKeymaps(engineKeyMap, infoScreenKeyMap, target);
+ Common::Action *act;
+
+ {
+ act = new Common::Action("SAVE", _("Save Game"));
+ act->setCustomEngineActionEvent(kActionSave);
+ act->addDefaultInputMapping("s");
+ infoScreenKeyMap->addAction(act);
+
+ act = new Common::Action("LOAD", _("Load Game"));
+ act->setCustomEngineActionEvent(kActionLoad);
+ act->addDefaultInputMapping("l");
+ infoScreenKeyMap->addAction(act);
+
+ act = new Common::Action("QUIT", _("Quit Game"));
+ act->setCustomEngineActionEvent(kActionEscape);
+ if (isDOS() || isCPC())
+ act->addDefaultInputMapping("ESCAPE");
+ else if (isSpectrum())
+ act->addDefaultInputMapping("1");
+
+ infoScreenKeyMap->addAction(act);
+
+ act = new Common::Action("TOGGLESOUND", _("Toggle Sound"));
+ act->setCustomEngineActionEvent(kActionToggleSound);
+ act->addDefaultInputMapping("t");
+ infoScreenKeyMap->addAction(act);
+ }
+
+ {
+ act = new Common::Action("ROTL", _("Rotate Left"));
+ act->setCustomEngineActionEvent(kActionRotateLeft);
+ act->addDefaultInputMapping("z");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("ROTR", _("Rotate Right"));
+ act->setCustomEngineActionEvent(kActionRotateRight);
+ act->addDefaultInputMapping("x");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("RUNMODE", _("Run"));
+ act->setCustomEngineActionEvent(kActionRunMode);
+ act->addDefaultInputMapping("r");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("WALK", _("Walk"));
+ act->setCustomEngineActionEvent(kActionRiseOrFlyUp);
+ act->addDefaultInputMapping("JOY_B");
+ act->addDefaultInputMapping("w");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("CRAWL", _("Crawl"));
+ act->setCustomEngineActionEvent(kActionLowerOrFlyDown);
+ act->addDefaultInputMapping("JOY_Y");
+ act->addDefaultInputMapping("c");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("FACEFRWARD", _("Face Forward"));
+ act->setCustomEngineActionEvent(kActionFaceForward);
+ act->addDefaultInputMapping("f");
+ engineKeyMap->addAction(act);
+ }
+}
+
void CastleEngine::gotoArea(uint16 areaID, int entranceID) {
debugC(1, kFreescapeDebugMove, "Jumping to area: %d, entrance: %d", areaID, entranceID);
@@ -162,30 +232,30 @@ void CastleEngine::endGame() {
void CastleEngine::pressedKey(const int keycode) {
// This code is duplicated in the DrillerEngine::pressedKey (except for the J case)
- if (keycode == Common::KEYCODE_z) {
+ if (keycode == kActionRotateLeft) {
rotate(-_angleRotations[_angleRotationIndex], 0);
- } else if (keycode == Common::KEYCODE_x) {
+ } else if (keycode == kActionRotateRight) {
rotate(_angleRotations[_angleRotationIndex], 0);
} else if (keycode == Common::KEYCODE_s) {
// TODO: show score
- } else if (keycode == Common::KEYCODE_r) {
+ } else if (keycode == kActionRunMode) {
if (_playerHeightNumber == 0)
rise();
// TODO: raising can fail if there is no room, so the action should fail
_playerStepIndex = 2;
insertTemporaryMessage(_messagesList[15], _countdown - 2);
- } else if (keycode == Common::KEYCODE_w) {
+ } else if (keycode == kActionRiseOrFlyUp) {
if (_playerHeightNumber == 0)
rise();
// TODO: raising can fail if there is no room, so the action should fail
_playerStepIndex = 1;
insertTemporaryMessage(_messagesList[14], _countdown - 2);
- } else if (keycode == Common::KEYCODE_c) {
+ } else if (keycode == kActionLowerOrFlyDown) {
if (_playerHeightNumber == 1)
lower();
_playerStepIndex = 0;
insertTemporaryMessage(_messagesList[13], _countdown - 2);
- } else if (keycode == Common::KEYCODE_f) {
+ } else if (keycode == kActionFaceForward) {
_pitch = 0;
updateCamera();
}
@@ -224,8 +294,8 @@ void CastleEngine::drawInfoMenu() {
// Events
switch (event.type) {
- case Common::EVENT_KEYDOWN:
- if (event.kbd.keycode == Common::KEYCODE_l) {
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
+ if (event.customType == kActionLoad) {
_gfx->setViewport(_fullscreenViewArea);
_eventManager->purgeKeyboardEvents();
loadGameDialog();
@@ -235,7 +305,7 @@ void CastleEngine::drawInfoMenu() {
}
_gfx->setViewport(_viewArea);
- } else if (event.kbd.keycode == Common::KEYCODE_s) {
+ } else if (event.customType == kActionSave) {
_gfx->setViewport(_fullscreenViewArea);
_eventManager->purgeKeyboardEvents();
saveGameDialog();
@@ -245,16 +315,15 @@ void CastleEngine::drawInfoMenu() {
}
_gfx->setViewport(_viewArea);
- } else if (isDOS() && event.kbd.keycode == Common::KEYCODE_t) {
+ } else if (isDOS() && event.customType == kActionToggleSound) {
// TODO
- } else if ((isDOS() || isCPC()) && event.kbd.keycode == Common::KEYCODE_ESCAPE) {
- _forceEndGame = true;
- cont = false;
- } else if (isSpectrum() && event.kbd.keycode == Common::KEYCODE_1) {
+ } else if ((isDOS() || isCPC() || isSpectrum()) && event.customType == kActionEscape) {
_forceEndGame = true;
cont = false;
} else
cont = false;
+ case Common::EVENT_KEYDOWN:
+ cont = false;
break;
case Common::EVENT_SCREEN_CHANGED:
_gfx->computeScreenViewport();
@@ -440,8 +509,8 @@ void CastleEngine::drawFullscreenRiddleAndWait(uint16 riddle) {
// Events
switch (event.type) {
- case Common::EVENT_KEYDOWN:
- if (event.kbd.keycode == Common::KEYCODE_SPACE) {
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
+ if (event.customType == kActionChangeModeOrSkip) {
cont = false;
}
break;
diff --git a/engines/freescape/games/castle/castle.h b/engines/freescape/games/castle/castle.h
index e791b217405..5818880b9d6 100644
--- a/engines/freescape/games/castle/castle.h
+++ b/engines/freescape/games/castle/castle.h
@@ -28,6 +28,8 @@ public:
Graphics::ManagedSurface *_option;
Graphics::Surface *_menu;
+
+ void initKeymaps(Common::Keymap *engineKeyMap, Common::Keymap *infoScreenKeyMap, const char *target) override;
void initGameState() override;
void endGame() override;
@@ -87,4 +89,4 @@ private:
Texture *_optionTexture;
};
-}
\ No newline at end of file
+}
diff --git a/engines/freescape/games/dark/dark.cpp b/engines/freescape/games/dark/dark.cpp
index b4561a16fab..9eab0eff7d8 100644
--- a/engines/freescape/games/dark/dark.cpp
+++ b/engines/freescape/games/dark/dark.cpp
@@ -157,16 +157,77 @@ bool DarkEngine::checkECD(uint16 areaID, int index) {
return !obj->isDestroyed();
}
-void DarkEngine::initKeymaps(Common::Keymap *engineKeyMap, const char *target) {
- FreescapeEngine::initKeymaps(engineKeyMap, target);
+void DarkEngine::initKeymaps(Common::Keymap *engineKeyMap, Common::Keymap *infoScreenKeyMap, const char *target) {
+ FreescapeEngine::initKeymaps(engineKeyMap, infoScreenKeyMap, target);
Common::Action *act;
- act = new Common::Action("JETPACK", _("Enable/Disable Jetpack"));
- act->setKeyEvent(Common::KeyState(Common::KEYCODE_j, 'j'));
- act->addDefaultInputMapping("JOY_LEFT_SHOULDER");
- act->addDefaultInputMapping("JOY_RIGHT_SHOULDER");
- act->addDefaultInputMapping("j");
- engineKeyMap->addAction(act);
+ {
+ act = new Common::Action("SAVE", _("Save Game"));
+ act->setCustomEngineActionEvent(kActionSave);
+ act->addDefaultInputMapping("s");
+ infoScreenKeyMap->addAction(act);
+
+ act = new Common::Action("LOAD", _("Load Game"));
+ act->setCustomEngineActionEvent(kActionLoad);
+ act->addDefaultInputMapping("l");
+ infoScreenKeyMap->addAction(act);
+
+ act = new Common::Action("QUIT", _("Quit Game"));
+ act->setCustomEngineActionEvent(kActionEscape);
+ if (isSpectrum())
+ act->addDefaultInputMapping("1");
+ else
+ act->addDefaultInputMapping("ESCAPE");
+ infoScreenKeyMap->addAction(act);
+
+ if (!(isAmiga() || isAtariST())) {
+ act = new Common::Action("TOGGLESOUND", _("Toggle Sound"));
+ act->setCustomEngineActionEvent(kActionToggleSound);
+ act->addDefaultInputMapping("t");
+ infoScreenKeyMap->addAction(act);
+ }
+ }
+
+ {
+ act = new Common::Action("ROTL", _("Rotate Left"));
+ act->setCustomEngineActionEvent(kActionRotateLeft);
+ act->addDefaultInputMapping("q");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("ROTR", _("Rotate Right"));
+ act->setCustomEngineActionEvent(kActionRotateRight);
+ act->addDefaultInputMapping("w");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("INCSTEPSIZE", _("Increase Step Size"));
+ act->setCustomEngineActionEvent(kActionIncreaseStepSize);
+ act->addDefaultInputMapping("s");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("DECSTEPSIZE", _("Decrease Step Size"));
+ act->setCustomEngineActionEvent(kActionDecreaseStepSize);
+ act->addDefaultInputMapping("x");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("RISE", _("Rise/Fly up"));
+ act->setCustomEngineActionEvent(kActionRiseOrFlyUp);
+ act->addDefaultInputMapping("JOY_B");
+ act->addDefaultInputMapping("r");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("LOWER", _("Lower/Fly down"));
+ act->setCustomEngineActionEvent(kActionLowerOrFlyDown);
+ act->addDefaultInputMapping("JOY_Y");
+ act->addDefaultInputMapping("f");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("JETPACK", _("Enable/Disable Jetpack"));
+ act->setCustomEngineActionEvent(kActionToggleFlyMode);
+ act->addDefaultInputMapping("JOY_LEFT_SHOULDER");
+ act->addDefaultInputMapping("JOY_RIGHT_SHOULDER");
+ act->addDefaultInputMapping("j");
+ engineKeyMap->addAction(act);
+ }
}
void DarkEngine::initGameState() {
@@ -582,19 +643,19 @@ void DarkEngine::gotoArea(uint16 areaID, int entranceID) {
void DarkEngine::pressedKey(const int keycode) {
// This code is duplicated in the DrillerEngine::pressedKey (except for the J case)
- if (keycode == Common::KEYCODE_q) {
+ if (keycode == kActionRotateLeft) {
rotate(-_angleRotations[_angleRotationIndex], 0);
- } else if (keycode == Common::KEYCODE_w) {
+ } else if (keycode == kActionRotateRight) {
rotate(_angleRotations[_angleRotationIndex], 0);
- } else if (keycode == Common::KEYCODE_s) {
+ } else if (keycode == kActionIncreaseStepSize) {
increaseStepSize();
- } else if (keycode == Common::KEYCODE_x) {
+ } else if (keycode == kActionDecreaseStepSize) {
decreaseStepSize();
- } else if (keycode == Common::KEYCODE_r) {
+ } else if (keycode == kActionRiseOrFlyUp) {
rise();
- } else if (keycode == Common::KEYCODE_f) {
+ } else if (keycode == kActionLowerOrFlyDown) {
lower();
- } else if (keycode == Common::KEYCODE_j) {
+ } else if (keycode == kActionToggleFlyMode) {
_flyMode = !_flyMode;
//debugC(1, kFreescapeDebugMedia, "raw %d, hz: %f", freq, hzFreq);
@@ -810,26 +871,25 @@ void DarkEngine::drawInfoMenu() {
// Events
switch (event.type) {
- case Common::EVENT_KEYDOWN:
- if (event.kbd.keycode == Common::KEYCODE_l) {
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
+ if (event.customType == kActionLoad) {
_gfx->setViewport(_fullscreenViewArea);
_eventManager->purgeKeyboardEvents();
loadGameDialog();
_gfx->setViewport(_viewArea);
- } else if (event.kbd.keycode == Common::KEYCODE_s) {
+ } else if (event.customType == kActionSave) {
_gfx->setViewport(_fullscreenViewArea);
_eventManager->purgeKeyboardEvents();
saveGameDialog();
_gfx->setViewport(_viewArea);
- } else if (isDOS() && event.kbd.keycode == Common::KEYCODE_t) {
+ } else if (isDOS() && event.customType == kActionToggleSound) {
playSound(6, true);
- } else if (!isSpectrum() && event.kbd.keycode == Common::KEYCODE_ESCAPE) {
- _forceEndGame = true;
- cont = false;
- } else if (isSpectrum() && event.kbd.keycode == Common::KEYCODE_1) {
+ } else if (event.customType == kActionEscape) {
_forceEndGame = true;
cont = false;
- } else
+ }
+ break;
+ case Common::EVENT_KEYDOWN:
cont = false;
break;
case Common::EVENT_SCREEN_CHANGED:
diff --git a/engines/freescape/games/dark/dark.h b/engines/freescape/games/dark/dark.h
index eb6630cd3e8..af260e46a13 100644
--- a/engines/freescape/games/dark/dark.h
+++ b/engines/freescape/games/dark/dark.h
@@ -52,7 +52,7 @@ public:
uint32 _jetFuelSeconds;
void addSkanner(Area *area);
- void initKeymaps(Common::Keymap *engineKeyMap, const char *target) override;
+ void initKeymaps(Common::Keymap *engineKeyMap, Common::Keymap *infoScreenKeyMap, const char *target) override;
void initGameState() override;
void borderScreen() override;
bool checkIfGameEnded() override;
diff --git a/engines/freescape/games/driller/driller.cpp b/engines/freescape/games/driller/driller.cpp
index 2e0131a2609..f1f7e6fe18f 100644
--- a/engines/freescape/games/driller/driller.cpp
+++ b/engines/freescape/games/driller/driller.cpp
@@ -106,21 +106,80 @@ DrillerEngine::~DrillerEngine() {
delete _drillBase;
}
-void DrillerEngine::initKeymaps(Common::Keymap *engineKeyMap, const char *target) {
- FreescapeEngine::initKeymaps(engineKeyMap, target);
+void DrillerEngine::initKeymaps(Common::Keymap *engineKeyMap, Common::Keymap *infoScreenKeyMap, const char *target) {
+ FreescapeEngine::initKeymaps(engineKeyMap, infoScreenKeyMap, target);
Common::Action *act;
- act = new Common::Action("DEPLOY", _("Deploy drilling rig"));
- act->setKeyEvent(Common::KeyState(Common::KEYCODE_d, 'd'));
- act->addDefaultInputMapping("JOY_LEFT_SHOULDER");
- act->addDefaultInputMapping("d");
- engineKeyMap->addAction(act);
-
- act = new Common::Action("COLLECT", _("Collect drilling rig"));
- act->setKeyEvent(Common::KeyState(Common::KEYCODE_c, 'c'));
- act->addDefaultInputMapping("c");
- act->addDefaultInputMapping("JOY_RIGHT_SHOULDER");
- engineKeyMap->addAction(act);
+ if (!(isAmiga() || isAtariST())) {
+ act = new Common::Action("SAVE", _("Save Game"));
+ act->setCustomEngineActionEvent(kActionSave);
+ act->addDefaultInputMapping("s");
+ infoScreenKeyMap->addAction(act);
+
+ act = new Common::Action("LOAD", _("Load Game"));
+ act->setCustomEngineActionEvent(kActionLoad);
+ act->addDefaultInputMapping("l");
+ infoScreenKeyMap->addAction(act);
+
+ act = new Common::Action("QUIT", _("Quit Game"));
+ act->setCustomEngineActionEvent(kActionEscape);
+ if (isSpectrum())
+ act->addDefaultInputMapping("1");
+ else
+ act->addDefaultInputMapping("ESCAPE");
+ infoScreenKeyMap->addAction(act);
+
+ act = new Common::Action("TOGGLESOUND", _("Toggle Sound"));
+ act->setCustomEngineActionEvent(kActionToggleSound);
+ act->addDefaultInputMapping("t");
+ infoScreenKeyMap->addAction(act);
+ }
+
+ {
+ act = new Common::Action("ROTL", _("Rotate Left"));
+ act->setCustomEngineActionEvent(kActionRotateLeft);
+ act->addDefaultInputMapping("q");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("ROTR", _("Rotate Right"));
+ act->setCustomEngineActionEvent(kActionRotateRight);
+ act->addDefaultInputMapping("w");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("INCSTEPSIZE", _("Increase Step Size"));
+ act->setCustomEngineActionEvent(kActionIncreaseStepSize);
+ act->addDefaultInputMapping("s");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("DECSTEPSIZE", _("Decrease Step Size"));
+ act->setCustomEngineActionEvent(kActionDecreaseStepSize);
+ act->addDefaultInputMapping("x");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("RISE", _("Rise/Fly up"));
+ act->setCustomEngineActionEvent(kActionRiseOrFlyUp);
+ act->addDefaultInputMapping("JOY_B");
+ act->addDefaultInputMapping("r");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("LOWER", _("Lower/Fly down"));
+ act->setCustomEngineActionEvent(kActionLowerOrFlyDown);
+ act->addDefaultInputMapping("JOY_Y");
+ act->addDefaultInputMapping("f");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("DEPLOY", _("Deploy drilling rig"));
+ act->setCustomEngineActionEvent(kActionDeployDrillingRig);
+ act->addDefaultInputMapping("JOY_LEFT_SHOULDER");
+ act->addDefaultInputMapping("d");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("COLLECT", _("Collect drilling rig"));
+ act->setCustomEngineActionEvent(kActionCollectDrillingRig);
+ act->addDefaultInputMapping("c");
+ act->addDefaultInputMapping("JOY_RIGHT_SHOULDER");
+ engineKeyMap->addAction(act);
+ }
}
void DrillerEngine::gotoArea(uint16 areaID, int entranceID) {
@@ -336,28 +395,28 @@ void DrillerEngine::drawInfoMenu() {
// Events
switch (event.type) {
- case Common::EVENT_KEYDOWN:
- if (event.kbd.keycode == Common::KEYCODE_l) {
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
+ if (event.customType == kActionLoad) {
_gfx->setViewport(_fullscreenViewArea);
_eventManager->purgeKeyboardEvents();
loadGameDialog();
_gfx->setViewport(_viewArea);
- } else if (event.kbd.keycode == Common::KEYCODE_s) {
+ } else if (event.customType == kActionSave) {
_gfx->setViewport(_fullscreenViewArea);
_eventManager->purgeKeyboardEvents();
saveGameDialog();
_gfx->setViewport(_viewArea);
- } else if (isDOS() && event.kbd.keycode == Common::KEYCODE_t) {
+ } else if (isDOS() && event.customType == kActionToggleSound) {
// TODO
- } else if ((isDOS() || isCPC()) && event.kbd.keycode == Common::KEYCODE_ESCAPE) {
- _forceEndGame = true;
- cont = false;
- } else if (isSpectrum() && event.kbd.keycode == Common::KEYCODE_1) {
+ } else if ((isDOS() || isCPC() || isSpectrum()) && event.customType == kActionEscape) {
_forceEndGame = true;
cont = false;
} else
cont = false;
break;
+ case Common::EVENT_KEYDOWN:
+ cont = false;
+ break;
case Common::EVENT_SCREEN_CHANGED:
_gfx->computeScreenViewport();
// TODO: properly refresh screen
@@ -399,19 +458,19 @@ Math::Vector3d getProjectionToPlane(const Math::Vector3d &vect, const Math::Vect
}
void DrillerEngine::pressedKey(const int keycode) {
- if (keycode == Common::KEYCODE_q) {
+ if (keycode == kActionRotateLeft) {
rotate(-_angleRotations[_angleRotationIndex], 0);
- } else if (keycode == Common::KEYCODE_w) {
+ } else if (keycode == kActionRotateRight) {
rotate(_angleRotations[_angleRotationIndex], 0);
- } else if (keycode == Common::KEYCODE_s) {
+ } else if (keycode == kActionIncreaseStepSize) {
increaseStepSize();
- } else if (keycode == Common::KEYCODE_x) {
+ } else if (keycode == kActionDecreaseStepSize) {
decreaseStepSize();
- } else if (keycode == Common::KEYCODE_r) {
+ } else if (keycode == kActionRiseOrFlyUp) {
rise();
- } else if (keycode == Common::KEYCODE_f) {
+ } else if (keycode == kActionLowerOrFlyDown) {
lower();
- } else if (keycode == Common::KEYCODE_d) {
+ } else if (keycode == kActionDeployDrillingRig) {
if (isDOS() && isDemo()) // No support for drilling here yet
return;
clearTemporalMessages();
@@ -476,7 +535,7 @@ void DrillerEngine::pressedKey(const int keycode) {
} else
_drillStatusByArea[_currentArea->getAreaID()] = kDrillerRigOutOfPlace;
executeMovementConditions();
- } else if (keycode == Common::KEYCODE_c) {
+ } else if (keycode == kActionCollectDrillingRig) {
if (isDOS() && isDemo()) // No support for drilling here yet
return;
uint32 gasPocketRadius = _currentArea->_gasPocketRadius;
@@ -826,7 +885,7 @@ bool DrillerEngine::onScreenControls(Common::Point mouse) {
lower();
return true;
} else if (_deployDrillArea.contains(mouse)) {
- pressedKey(Common::KEYCODE_d);
+ pressedKey(kActionDeployDrillingRig);
return true;
} else if (_infoScreenArea.contains(mouse)) {
drawInfoMenu();
diff --git a/engines/freescape/games/driller/driller.h b/engines/freescape/games/driller/driller.h
index 65d93235bd6..5e5d87ef498 100644
--- a/engines/freescape/games/driller/driller.h
+++ b/engines/freescape/games/driller/driller.h
@@ -38,7 +38,7 @@ public:
Common::HashMap<uint16, uint32> _drillMaxScoreByArea;
Common::HashMap<uint16, uint32> _drillSuccessByArea;
- void initKeymaps(Common::Keymap *engineKeyMap, const char *target) override;
+ void initKeymaps(Common::Keymap *engineKeyMap, Common::Keymap *infoScreenKeyMap, const char *target) override;
void initGameState() override;
bool checkIfGameEnded() override;
void endGame() override;
diff --git a/engines/freescape/games/eclipse/eclipse.cpp b/engines/freescape/games/eclipse/eclipse.cpp
index 2e5dc146425..da85ab52ba5 100644
--- a/engines/freescape/games/eclipse/eclipse.cpp
+++ b/engines/freescape/games/eclipse/eclipse.cpp
@@ -21,6 +21,11 @@
#include "common/file.h"
+#include "backends/keymapper/action.h"
+#include "backends/keymapper/keymap.h"
+#include "backends/keymapper/standard-actions.h"
+#include "common/translation.h"
+
#include "freescape/freescape.h"
#include "freescape/games/eclipse/eclipse.h"
#include "freescape/language/8bitDetokeniser.h"
@@ -164,6 +169,73 @@ void EclipseEngine::endGame() {
_endGameKeyPressed = false;
}
+void EclipseEngine::initKeymaps(Common::Keymap *engineKeyMap, Common::Keymap *infoScreenKeyMap, const char *target) {
+ FreescapeEngine::initKeymaps(engineKeyMap, infoScreenKeyMap, target);
+ Common::Action *act;
+
+ {
+ act = new Common::Action("SAVE", _("Save Game"));
+ act->setCustomEngineActionEvent(kActionSave);
+ act->addDefaultInputMapping("s");
+ infoScreenKeyMap->addAction(act);
+
+ act = new Common::Action("LOAD", _("Load Game"));
+ act->setCustomEngineActionEvent(kActionLoad);
+ act->addDefaultInputMapping("l");
+ infoScreenKeyMap->addAction(act);
+
+ act = new Common::Action("QUIT", _("Quit Game"));
+ act->setCustomEngineActionEvent(kActionEscape);
+ if (isSpectrum())
+ act->addDefaultInputMapping("1");
+ else
+ act->addDefaultInputMapping("ESCAPE");
+ infoScreenKeyMap->addAction(act);
+
+ act = new Common::Action("TOGGLESOUND", _("Toggle Sound"));
+ act->setCustomEngineActionEvent(kActionToggleSound);
+ act->addDefaultInputMapping("t");
+ infoScreenKeyMap->addAction(act);
+ }
+
+ {
+ act = new Common::Action("ROTL", _("Rotate Left"));
+ act->setCustomEngineActionEvent(kActionRotateLeft);
+ act->addDefaultInputMapping("q");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("ROTR", _("Rotate Right"));
+ act->setCustomEngineActionEvent(kActionRotateRight);
+ act->addDefaultInputMapping("w");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("CHNGANGLE", _("Change Angle"));
+ act->setCustomEngineActionEvent(kActionChangeAngle);
+ act->addDefaultInputMapping("a");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("CHNGSTEPSIZE", _("Change Step Size"));
+ act->setCustomEngineActionEvent(kActionChangeStepSize);
+ act->addDefaultInputMapping("s");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("TGGLHEIGHT", _("Toggle Height"));
+ act->setCustomEngineActionEvent(kActionToggleRiseLower);
+ act->addDefaultInputMapping("h");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("REST", _("Rest"));
+ act->setCustomEngineActionEvent(kActionRest);
+ act->addDefaultInputMapping("r");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("FACEFRWARD", _("Face Forward"));
+ act->setCustomEngineActionEvent(kActionFaceForward);
+ act->addDefaultInputMapping("f");
+ engineKeyMap->addAction(act);
+ }
+}
+
void EclipseEngine::gotoArea(uint16 areaID, int entranceID) {
debugC(1, kFreescapeDebugMove, "Jumping to area: %d, entrance: %d", areaID, entranceID);
@@ -322,28 +394,28 @@ void EclipseEngine::drawInfoMenu() {
// Events
switch (event.type) {
- case Common::EVENT_KEYDOWN:
- if (event.kbd.keycode == Common::KEYCODE_l) {
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
+ if (event.customType == kActionLoad) {
_gfx->setViewport(_fullscreenViewArea);
_eventManager->purgeKeyboardEvents();
loadGameDialog();
_gfx->setViewport(_viewArea);
- } else if (event.kbd.keycode == Common::KEYCODE_s) {
+ } else if (event.customType == kActionSave) {
_gfx->setViewport(_fullscreenViewArea);
_eventManager->purgeKeyboardEvents();
saveGameDialog();
_gfx->setViewport(_viewArea);
- } else if (isDOS() && event.kbd.keycode == Common::KEYCODE_t) {
+ } else if (isDOS() && event.customType == kActionToggleSound) {
playSound(6, true);
- } else if ((isDOS() || isCPC()) && event.kbd.keycode == Common::KEYCODE_ESCAPE) {
- _forceEndGame = true;
- cont = false;
- } else if (isSpectrum() && event.kbd.keycode == Common::KEYCODE_1) {
+ } else if ((isDOS() || isCPC() || isSpectrum()) && event.customType == kActionEscape) {
_forceEndGame = true;
cont = false;
} else
cont = false;
break;
+ case Common::EVENT_KEYDOWN:
+ cont = false;
+ break;
case Common::EVENT_SCREEN_CHANGED:
_gfx->computeScreenViewport();
break;
@@ -369,22 +441,22 @@ void EclipseEngine::drawInfoMenu() {
}
void EclipseEngine::pressedKey(const int keycode) {
- if (keycode == Common::KEYCODE_q) {
+ if (keycode == kActionRotateLeft) {
rotate(-_angleRotations[_angleRotationIndex], 0);
- } else if (keycode == Common::KEYCODE_w) {
+ } else if (keycode == kActionRotateRight) {
rotate(_angleRotations[_angleRotationIndex], 0);
- } else if (keycode == Common::KEYCODE_a) {
+ } else if (keycode == kActionChangeAngle) {
changeAngle();
- } else if (keycode == Common::KEYCODE_s) {
+ } else if (keycode == kActionChangeStepSize) {
changeStepSize();
- } else if (keycode == Common::KEYCODE_h) {
+ } else if (keycode == kActionToggleRiseLower) {
if (_playerHeightNumber == 0)
rise();
else if (_playerHeightNumber == 1)
lower();
else
error("Invalid player height index: %d", _playerHeightNumber);
- } else if (keycode == Common::KEYCODE_r) {
+ } else if (keycode == kActionRest) {
if (_currentArea->getAreaID() == 1) {
playSoundFx(3, false);
if (_temporaryMessages.empty())
@@ -395,14 +467,14 @@ void EclipseEngine::pressedKey(const int keycode) {
insertTemporaryMessage(_messagesList[7], _countdown - 2);
_countdown = _countdown - 5;
}
- } else if (keycode == Common::KEYCODE_f) {
+ } else if (keycode == kActionFaceForward) {
_pitch = 0;
updateCamera();
}
}
void EclipseEngine::releasedKey(const int keycode) {
- if (keycode == Common::KEYCODE_r)
+ if (keycode == kActionRiseOrFlyUp)
_resting = false;
}
diff --git a/engines/freescape/games/eclipse/eclipse.h b/engines/freescape/games/eclipse/eclipse.h
index 5da5e54aa84..cfebe43daac 100644
--- a/engines/freescape/games/eclipse/eclipse.h
+++ b/engines/freescape/games/eclipse/eclipse.h
@@ -71,6 +71,7 @@ public:
void loadAssetsCPCDemo() override;
void loadAssetsZXDemo() override;
+ void initKeymaps(Common::Keymap *engineKeyMap, Common::Keymap *infoScreenKeyMap, const char *target) override;
void initGameState() override;
void executePrint(FCLInstruction &instruction) override;
diff --git a/engines/freescape/metaengine.cpp b/engines/freescape/metaengine.cpp
index a65f83e29f8..7e3b52ff112 100644
--- a/engines/freescape/metaengine.cpp
+++ b/engines/freescape/metaengine.cpp
@@ -20,7 +20,9 @@
*/
#include "common/translation.h"
+#include "backends/keymapper/action.h"
#include "backends/keymapper/keymap.h"
+#include "backends/keymapper/standard-actions.h"
#include "graphics/thumbnail.h"
#include "graphics/scaler.h"
@@ -167,11 +169,20 @@ Common::Error FreescapeMetaEngine::createInstance(OSystem *syst, Engine **engine
}
Common::KeymapArray FreescapeMetaEngine::initKeymaps(const char *target) const {
- Freescape::FreescapeEngine *engine = (Freescape::FreescapeEngine *)g_engine;
+ using namespace Freescape;
+
+ FreescapeEngine *engine = (Freescape::FreescapeEngine *)g_engine;
Common::Keymap *engineKeyMap = new Common::Keymap(Common::Keymap::kKeymapTypeGame, "freescape", "Freescape game");
+ Common::Keymap *infoScreenKeyMap = new Common::Keymap(Common::Keymap::kKeymapTypeGame, "infoscreen-keymap", "Information screen keymapping");
+
if (engine)
- engine->initKeymaps(engineKeyMap, target);
- return Common::Keymap::arrayOf(engineKeyMap);
+ engine->initKeymaps(engineKeyMap, infoScreenKeyMap, target);
+
+ Common::KeymapArray keymaps(2);
+ keymaps[0] = engineKeyMap;
+ keymaps[1] = infoScreenKeyMap;
+
+ return keymaps;
}
void FreescapeMetaEngine::getSavegameThumbnail(Graphics::Surface &thumb) {
diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index d6f0b5e9561..719dffb9bfa 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -29,69 +29,69 @@
namespace Freescape {
-void FreescapeEngine::initKeymaps(Common::Keymap *engineKeyMap, const char *target) {
+void FreescapeEngine::initKeymaps(Common::Keymap *engineKeyMap, Common::Keymap *infoScreenKeyMap, const char *target) {
Common::Action *act;
act = new Common::Action(Common::kStandardActionMoveUp, _("Up"));
- act->setKeyEvent(Common::KEYCODE_UP);
+ act->setCustomEngineActionEvent(kActionMoveUp);
+ act->addDefaultInputMapping("UP");
act->addDefaultInputMapping("JOY_UP");
act->addDefaultInputMapping("o");
engineKeyMap->addAction(act);
act = new Common::Action(Common::kStandardActionMoveDown, _("Down"));
- act->setKeyEvent(Common::KEYCODE_DOWN);
+ act->setCustomEngineActionEvent(kActionMoveDown);
+ act->addDefaultInputMapping("DOWN");
act->addDefaultInputMapping("JOY_DOWN");
act->addDefaultInputMapping("k");
engineKeyMap->addAction(act);
act = new Common::Action(Common::kStandardActionMoveLeft, _("Strafe Left"));
- act->setKeyEvent(Common::KEYCODE_LEFT);
+ act->setCustomEngineActionEvent(kActionMoveLeft);
+ act->addDefaultInputMapping("LEFT");
act->addDefaultInputMapping("JOY_LEFT");
- //act->addDefaultInputMapping("q");
+ // act->addDefaultInputMapping("q");
engineKeyMap->addAction(act);
act = new Common::Action(Common::kStandardActionMoveRight, _("Strafe Right"));
- act->setKeyEvent(Common::KEYCODE_RIGHT);
+ act->setCustomEngineActionEvent(kActionMoveRight);
+ act->addDefaultInputMapping("RIGHT");
act->addDefaultInputMapping("JOY_RIGHT");
- //act->addDefaultInputMapping("w");
+ // act->addDefaultInputMapping("w");
engineKeyMap->addAction(act);
act = new Common::Action("SHOOT", _("Shoot"));
- act->setKeyEvent(Common::KeyState(Common::KEYCODE_KP5, '5'));
+ act->setCustomEngineActionEvent(kActionShoot);
act->addDefaultInputMapping("JOY_A");
+ act->addDefaultInputMapping("KP5");
act->addDefaultInputMapping("5");
+ act->addDefaultInputMapping("KP0");
+ act->addDefaultInputMapping("0");
engineKeyMap->addAction(act);
- act = new Common::Action("RISE", _("Rise/Fly up"));
- act->setKeyEvent(Common::KeyState(Common::KEYCODE_r, 'r'));
- act->addDefaultInputMapping("JOY_B");
- act->addDefaultInputMapping("r");
+ act = new Common::Action("ROTUP", _("Rotate up"));
+ act->setCustomEngineActionEvent(kActionRotateUp);
+ act->addDefaultInputMapping("p");
engineKeyMap->addAction(act);
- act = new Common::Action("LOWER", _("Lower/Fly down"));
- act->setKeyEvent(Common::KeyState(Common::KEYCODE_f, 'f'));
- act->addDefaultInputMapping("JOY_Y");
- act->addDefaultInputMapping("f");
+ act = new Common::Action("ROTDN", _("Rotate down"));
+ act->setCustomEngineActionEvent(kActionRotateDown);
+ act->addDefaultInputMapping("l");
engineKeyMap->addAction(act);
- act = new Common::Action("SWITCH", _("Change mode"));
- act->setKeyEvent(Common::KeyState(Common::KEYCODE_SPACE, Common::ASCII_SPACE));
+ act = new Common::Action("SWITCH", _("Change mode/Skip"));
+ act->setCustomEngineActionEvent(kActionChangeModeOrSkip);
act->addDefaultInputMapping("SPACE");
act->addDefaultInputMapping("JOY_X");
engineKeyMap->addAction(act);
- act = new Common::Action("ROTL", _("Rotate Left"));
- act->setKeyEvent(Common::KeyState(Common::KEYCODE_q, 'q'));
- act->addDefaultInputMapping("q");
- engineKeyMap->addAction(act);
-
- act = new Common::Action("ROTR", _("Rotate Right"));
- act->setKeyEvent(Common::KeyState(Common::KEYCODE_w, 'w'));
- act->addDefaultInputMapping("w");
+ act = new Common::Action("ESCAPE", _("Escape"));
+ act->setCustomEngineActionEvent(kActionEscape);
+ act->addDefaultInputMapping("ESCAPE");
engineKeyMap->addAction(act);
act = new Common::Action("MENU", _("Info Menu"));
- act->setKeyEvent(Common::KeyState(Common::KEYCODE_i, 'i'));
+ act->setCustomEngineActionEvent(kActionInfoMenu);
act->addDefaultInputMapping("i");
act->addDefaultInputMapping("JOY_GUIDE");
engineKeyMap->addAction(act);
diff --git a/engines/freescape/ui.cpp b/engines/freescape/ui.cpp
index 89c2259226a..33777cbc4c4 100644
--- a/engines/freescape/ui.cpp
+++ b/engines/freescape/ui.cpp
@@ -41,9 +41,9 @@ void FreescapeEngine::titleScreen() {
_gfx->computeScreenViewport();
_gfx->clear(0, 0, 0, true);
break;
- case Common::EVENT_KEYDOWN:
- switch (event.kbd.keycode) {
- case Common::KEYCODE_SPACE:
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
+ switch (event.customType) {
+ case kActionChangeModeOrSkip:
i = maxWait;
break;
default:
@@ -200,11 +200,17 @@ void FreescapeEngine::drawBorderScreenAndWait(Graphics::Surface *surface, int ma
_gfx->computeScreenViewport();
_gfx->clear(0, 0, 0, true);
break;
- case Common::EVENT_KEYDOWN:
- switch (event.kbd.keycode) {
- case Common::KEYCODE_SPACE:
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
+ switch (event.customType) {
+ case kActionChangeModeOrSkip:
maxWait = -1;
break;
+ default:
+ break;
+ }
+ break;
+ case Common::EVENT_KEYDOWN:
+ switch (event.kbd.keycode) {
case Common::KEYCODE_d:
_demoMode = true;
maxWait = -1;
More information about the Scummvm-git-logs
mailing list