ASYLUM: add a shortcut to show the in-game menu
This commit is contained in:
parent
02b210f515
commit
78900f7a2d
8 changed files with 43 additions and 35 deletions
|
@ -142,6 +142,12 @@ Common::KeymapArray AsylumMetaEngine::initKeymaps(const char *target) const {
|
|||
act->addDefaultInputMapping("o");
|
||||
engineKeyMap->addAction(act);
|
||||
|
||||
act = new Action("MENU", _("Bring up the In-Game Menu"));
|
||||
act->setCustomEngineActionEvent(kAsylumActionShowMenu);
|
||||
act->addDefaultInputMapping("ESCAPE");
|
||||
act->addDefaultInputMapping("JOY_START");
|
||||
engineKeyMap->addAction(act);
|
||||
|
||||
act = new Action("INVENTORY", _("Open character inventory"));
|
||||
act->setCustomEngineActionEvent(kAsylumActionOpenInventory);
|
||||
act->addDefaultInputMapping("i");
|
||||
|
|
|
@ -72,6 +72,9 @@ bool Puzzle::handleEvent(const AsylumEvent &evt) {
|
|||
|
||||
case Common::EVENT_RBUTTONUP:
|
||||
return mouseRightUp(evt);
|
||||
|
||||
case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
|
||||
return keyExit(evt);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -374,6 +374,16 @@ bool Encounter::handleEvent(const AsylumEvent &evt) {
|
|||
case Common::EVENT_RBUTTONDOWN:
|
||||
case Common::EVENT_RBUTTONUP:
|
||||
return mouse(evt);
|
||||
|
||||
case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
|
||||
if ((AsylumAction)evt.customType == kAsylumActionShowMenu) {
|
||||
if (!isSpeaking()
|
||||
&& _isDialogOpen
|
||||
&& !getSpeech()->getTextData()
|
||||
&& !getSpeech()->getTextDataPos())
|
||||
_shouldCloseDialog = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -516,18 +526,6 @@ bool Encounter::update() {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Encounter::key(const AsylumEvent &evt) {
|
||||
if (evt.kbd.keycode == Common::KEYCODE_ESCAPE) {
|
||||
if (!isSpeaking()
|
||||
&& _isDialogOpen
|
||||
&& !getSpeech()->getTextData()
|
||||
&& !getSpeech()->getTextDataPos())
|
||||
_shouldCloseDialog = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Encounter::mouse(const AsylumEvent &evt) {
|
||||
switch (evt.type) {
|
||||
default:
|
||||
|
|
|
@ -212,7 +212,7 @@ private:
|
|||
// Message handling
|
||||
bool init();
|
||||
bool update();
|
||||
bool key(const AsylumEvent &evt);
|
||||
bool key(const AsylumEvent &evt) { return true; }
|
||||
bool mouse(const AsylumEvent &evt);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -879,7 +879,8 @@ enum AsylumAction {
|
|||
kAsylumActionSwitchToSarah,
|
||||
kAsylumActionSwitchToGrimwall,
|
||||
kAsylumActionSwitchToOlmec,
|
||||
kAsylumActionOpenInventory
|
||||
kAsylumActionOpenInventory,
|
||||
kAsylumActionShowMenu
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -167,10 +167,6 @@ void ResourceViewer::key(const AsylumEvent &evt) {
|
|||
default:
|
||||
break;
|
||||
|
||||
case Common::KEYCODE_ESCAPE:
|
||||
_vm->switchEventHandler(_handler);
|
||||
break;
|
||||
|
||||
case Common::KEYCODE_SPACE:
|
||||
if (RESOURCE_INDEX(_resourceId) < resPackSizes[_resPack] - 1) {
|
||||
int i = 1;
|
||||
|
@ -241,6 +237,11 @@ bool ResourceViewer::handleEvent(const AsylumEvent &evt) {
|
|||
case Common::EVENT_KEYDOWN:
|
||||
key(evt);
|
||||
return true;
|
||||
|
||||
case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
|
||||
if ((AsylumAction)evt.customType == kAsylumActionShowMenu)
|
||||
_vm->switchEventHandler(_handler);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -456,6 +456,21 @@ bool Scene::action(AsylumAction a) {
|
|||
getActor()->changeStatus(kActorStatusEnabled);
|
||||
}
|
||||
break;
|
||||
|
||||
case kAsylumActionShowMenu:
|
||||
if (getSpeech()->getSoundResourceId()) {
|
||||
getScene()->stopSpeech();
|
||||
} else {
|
||||
if (getCursor()->isHidden())
|
||||
break;
|
||||
|
||||
if (!_vm->checkGameVersion("Demo")) {
|
||||
_savedScreen.copyFrom(getScreen()->getSurface());
|
||||
memcpy(_savedPalette, getScreen()->getPalette(), sizeof(_savedPalette));
|
||||
_vm->switchEventHandler(_vm->menu());
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -479,23 +494,6 @@ bool Scene::key(const AsylumEvent &evt) {
|
|||
warning("[Scene::key] debug command handling not implemented!");
|
||||
break;
|
||||
|
||||
case Common::KEYCODE_ESCAPE:
|
||||
// TODO add support for debug commands
|
||||
|
||||
if (getSpeech()->getSoundResourceId()) {
|
||||
getScene()->stopSpeech();
|
||||
} else {
|
||||
if (getCursor()->isHidden())
|
||||
break;
|
||||
|
||||
if (!_vm->checkGameVersion("Demo")) {
|
||||
_savedScreen.copyFrom(getScreen()->getSurface());
|
||||
memcpy(_savedPalette, getScreen()->getPalette(), sizeof(_savedPalette));
|
||||
_vm->switchEventHandler(_vm->menu());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Common::KEYCODE_LEFTBRACKET:
|
||||
if (evt.kbd.ascii != 123)
|
||||
break;
|
||||
|
|
|
@ -124,6 +124,7 @@ bool VideoPlayer::handleEvent(const AsylumEvent &evt) {
|
|||
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
case Common::EVENT_KEYDOWN:
|
||||
case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
|
||||
_done = true;
|
||||
if (!_vm->checkGameVersion("Steam") && !_vm->isAltDemo())
|
||||
getScreen()->clear();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue