mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-04 17:29:11 +00:00
ZVISION: Use custom engine actions for the menubar shortcuts
This commit is contained in:
parent
496edf905f
commit
db87cb0c63
@ -68,31 +68,6 @@ uint8 ZVision::getBufferedKey(uint8 pos) {
|
||||
return _cheatBuffer[KEYBUF_SIZE - pos - 1];
|
||||
}
|
||||
|
||||
void ZVision::shortKeys(Common::Event event) {
|
||||
if (event.kbd.hasFlags(Common::KBD_CTRL)) {
|
||||
switch (event.kbd.keycode) {
|
||||
case Common::KEYCODE_s:
|
||||
if (_menu->getEnable() & kMenubarSave)
|
||||
_scriptManager->changeLocation('g', 'j', 's', 'e', 0);
|
||||
break;
|
||||
case Common::KEYCODE_r:
|
||||
if (_menu->getEnable() & kMenubarRestore)
|
||||
_scriptManager->changeLocation('g', 'j', 'r', 'e', 0);
|
||||
break;
|
||||
case Common::KEYCODE_p:
|
||||
if (_menu->getEnable() & kMenubarSettings)
|
||||
_scriptManager->changeLocation('g', 'j', 'p', 'e', 0);
|
||||
break;
|
||||
case Common::KEYCODE_q:
|
||||
if (_menu->getEnable() & kMenubarExit)
|
||||
ifQuit();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ZVision::cheatCodes(uint8 key) {
|
||||
Location loc = _scriptManager->getCurrentLocation();
|
||||
// Do not process cheat codes while in the game menus
|
||||
@ -240,6 +215,26 @@ void ZVision::processEvents() {
|
||||
_scriptManager->getStateValue(StateKey_KbdRotateSpeed)) * 2;
|
||||
break;
|
||||
|
||||
case kZVisionActionSave:
|
||||
if (_menu->getEnable() & kMenubarSave)
|
||||
_scriptManager->changeLocation('g', 'j', 's', 'e', 0);
|
||||
break;
|
||||
|
||||
case kZVisionActionRestore:
|
||||
if (_menu->getEnable() & kMenubarRestore)
|
||||
_scriptManager->changeLocation('g', 'j', 'r', 'e', 0);
|
||||
break;
|
||||
|
||||
case kZVisionActionPreferences:
|
||||
if (_menu->getEnable() & kMenubarSettings)
|
||||
_scriptManager->changeLocation('g', 'j', 'p', 'e', 0);
|
||||
break;
|
||||
|
||||
case kZVisionActionQuit:
|
||||
if (_menu->getEnable() & kMenubarExit)
|
||||
ifQuit();
|
||||
break;
|
||||
|
||||
case kZVisionActionShowFPS: {
|
||||
Common::String fpsStr = Common::String::format("FPS: %d", getFPS());
|
||||
_renderManager->showDebugMsg(fpsStr);
|
||||
@ -273,7 +268,6 @@ void ZVision::processEvents() {
|
||||
_scriptManager->setStateValue(StateKey_KeyPress, vkKey);
|
||||
|
||||
_scriptManager->addEvent(_event);
|
||||
shortKeys(_event);
|
||||
cheatCodes(vkKey);
|
||||
}
|
||||
break;
|
||||
|
@ -211,22 +211,22 @@ Common::KeymapArray ZVisionMetaEngine::initKeymaps(const char *target) const {
|
||||
mainKeymap->addAction(act);
|
||||
|
||||
act = new Action(kStandardActionSave, _("Save"));
|
||||
act->setKeyEvent(KeyState(KEYCODE_s, 's', KBD_CTRL));
|
||||
act->setCustomEngineActionEvent(kZVisionActionSave);
|
||||
act->addDefaultInputMapping("C+s");
|
||||
mainKeymap->addAction(act);
|
||||
|
||||
act = new Action(kStandardActionLoad, _("Restore"));
|
||||
act->setKeyEvent(KeyState(KEYCODE_r, 'r', KBD_CTRL));
|
||||
act->setCustomEngineActionEvent(kZVisionActionRestore);
|
||||
act->addDefaultInputMapping("C+r");
|
||||
mainKeymap->addAction(act);
|
||||
|
||||
act = new Action("QUIT", _("Quit"));
|
||||
act->setKeyEvent(KeyState(KEYCODE_q, 'q', KBD_CTRL));
|
||||
act->setCustomEngineActionEvent(kZVisionActionQuit);
|
||||
act->addDefaultInputMapping("C+q");
|
||||
mainKeymap->addAction(act);
|
||||
|
||||
act = new Action(kStandardActionOpenSettings, _("Preferences"));
|
||||
act->setKeyEvent(KeyState(KEYCODE_p, 'p', KBD_CTRL));
|
||||
act->setCustomEngineActionEvent(kZVisionActionPreferences);
|
||||
act->addDefaultInputMapping("C+p");
|
||||
mainKeymap->addAction(act);
|
||||
|
||||
|
@ -106,9 +106,12 @@ enum ZVisionAction {
|
||||
kZVisionActionDown,
|
||||
kZVisionActionLeft,
|
||||
kZVisionActionRight,
|
||||
kZVisionActionSave,
|
||||
kZVisionActionRestore,
|
||||
kZVisionActionQuit,
|
||||
kZVisionActionPreferences,
|
||||
kZVisionActionShowFPS,
|
||||
kZVisionActionSkipCutscene,
|
||||
kZVisionActionQuit,
|
||||
|
||||
kZVisionActionCount
|
||||
};
|
||||
@ -276,7 +279,6 @@ private:
|
||||
void onMouseMove(const Common::Point &pos);
|
||||
|
||||
void registerDefaultSettings();
|
||||
void shortKeys(Common::Event);
|
||||
|
||||
void cheatCodes(uint8 key);
|
||||
void pushKeyToCheatBuf(uint8 key);
|
||||
|
Loading…
x
Reference in New Issue
Block a user