[Scummvm-git-logs] scummvm master -> 1380308919fff5d2a5ab12632e6716086040a0b8
dreammaster
noreply at scummvm.org
Mon Jun 23 16:05:12 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
1380308919 TITANIC: Add keymapper support
Commit: 1380308919fff5d2a5ab12632e6716086040a0b8
https://github.com/scummvm/scummvm/commit/1380308919fff5d2a5ab12632e6716086040a0b8
Author: aunnoman1 (aunnoman123 at outlook.com)
Date: 2025-06-23T09:05:07-07:00
Commit Message:
TITANIC: Add keymapper support
Changed paths:
A engines/titanic/POTFILES
engines/titanic/continue_save_dialog.cpp
engines/titanic/continue_save_dialog.h
engines/titanic/core/saveable_object.cpp
engines/titanic/events.cpp
engines/titanic/events.h
engines/titanic/game/missiveomat.cpp
engines/titanic/game/nav_helmet.cpp
engines/titanic/input_translator.cpp
engines/titanic/input_translator.h
engines/titanic/main_game_window.cpp
engines/titanic/main_game_window.h
engines/titanic/messages/messages.cpp
engines/titanic/messages/messages.h
engines/titanic/metaengine.cpp
engines/titanic/pet_control/pet_control.cpp
engines/titanic/pet_control/pet_control.h
engines/titanic/pet_control/pet_conversations.cpp
engines/titanic/pet_control/pet_conversations.h
engines/titanic/pet_control/pet_glyphs.cpp
engines/titanic/pet_control/pet_glyphs.h
engines/titanic/pet_control/pet_inventory.cpp
engines/titanic/pet_control/pet_inventory.h
engines/titanic/pet_control/pet_load_save.cpp
engines/titanic/pet_control/pet_load_save.h
engines/titanic/pet_control/pet_real_life.cpp
engines/titanic/pet_control/pet_real_life.h
engines/titanic/pet_control/pet_remote.cpp
engines/titanic/pet_control/pet_remote.h
engines/titanic/pet_control/pet_rooms.cpp
engines/titanic/pet_control/pet_rooms.h
engines/titanic/pet_control/pet_save.cpp
engines/titanic/pet_control/pet_save.h
engines/titanic/pet_control/pet_section.h
engines/titanic/star_control/star_control.cpp
engines/titanic/star_control/star_control.h
engines/titanic/star_control/star_view.cpp
engines/titanic/star_control/star_view.h
engines/titanic/titanic.h
diff --git a/engines/titanic/POTFILES b/engines/titanic/POTFILES
new file mode 100644
index 00000000000..dbaf8b734d7
--- /dev/null
+++ b/engines/titanic/POTFILES
@@ -0,0 +1 @@
+engines/titanic/metaengine.cpp
diff --git a/engines/titanic/continue_save_dialog.cpp b/engines/titanic/continue_save_dialog.cpp
index 3baa19b8b97..7f2ddcf38e6 100644
--- a/engines/titanic/continue_save_dialog.cpp
+++ b/engines/titanic/continue_save_dialog.cpp
@@ -26,6 +26,8 @@
#include "common/str-array.h"
#include "graphics/screen.h"
+#include "backends/keymapper/keymapper.h"
+
namespace Titanic {
#define SAVEGAME_SLOTS_COUNT 5
@@ -68,6 +70,9 @@ Rect CContinueSaveDialog::getSlotBounds(int index) {
}
int CContinueSaveDialog::show() {
+ Common::Keymapper *keymapper = g_vm->getEventManager()->getKeymapper();
+ keymapper->getKeymap("cont-save")->setEnabled(true);
+
// Load images for the dialog
loadImages();
@@ -84,6 +89,8 @@ int CContinueSaveDialog::show() {
if (g_vm->shouldQuit())
_selectedSlot = -2;
+ keymapper->getKeymap("cont-save")->setEnabled(false);
+
return _selectedSlot;
}
@@ -227,8 +234,8 @@ void CContinueSaveDialog::leftButtonUp(const Point &mousePos) {
}
}
-void CContinueSaveDialog::keyDown(Common::KeyState keyState) {
- if (keyState.keycode == Common::KEYCODE_ESCAPE)
+void CContinueSaveDialog::actionStart(Common::CustomEventType action) {
+ if (action == kActionQuit)
_selectedSlot = EXIT_GAME;
}
diff --git a/engines/titanic/continue_save_dialog.h b/engines/titanic/continue_save_dialog.h
index 2b1368ad5e0..2529ded952d 100644
--- a/engines/titanic/continue_save_dialog.h
+++ b/engines/titanic/continue_save_dialog.h
@@ -84,7 +84,7 @@ public:
void mouseMove(const Point &mousePos) override;
void leftButtonDown(const Point &mousePos) override;
void leftButtonUp(const Point &mousePos) override;
- void keyDown(Common::KeyState keyState) override;
+ void actionStart(Common::CustomEventType action) override;
/**
* Add a savegame to the list to be displayed
diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp
index e0a232fd4d8..6760cf8778b 100644
--- a/engines/titanic/core/saveable_object.cpp
+++ b/engines/titanic/core/saveable_object.cpp
@@ -954,7 +954,7 @@ DEFFN(CTurnOn);
DEFFN(CUse);
DEFFN(CUseWithCharMsg);
DEFFN(CUseWithOtherMsg);
-DEFFN(CVirtualKeyCharMsg);
+DEFFN(CActionMsg);
DEFFN(CVisibleMsg);
DEFFN(CCheckCodeWheelsMsg);
@@ -1543,7 +1543,7 @@ void CSaveableObject::initClassList() {
ADDFN(CUse, CMessage);
ADDFN(CUseWithCharMsg, CMessage);
ADDFN(CUseWithOtherMsg, CMessage);
- ADDFN(CVirtualKeyCharMsg, CMessage);
+ ADDFN(CActionMsg, CMessage);
ADDFN(CVisibleMsg, CMessage);
ADDFN(CCheckCodeWheelsMsg, CMessage);
diff --git a/engines/titanic/events.cpp b/engines/titanic/events.cpp
index 01546adb077..6c3efd6ca90 100644
--- a/engines/titanic/events.cpp
+++ b/engines/titanic/events.cpp
@@ -89,12 +89,17 @@ void Events::pollEvents() {
_mousePos = event.mouse;
eventTarget()->mouseWheel(_mousePos, event.type == Common::EVENT_WHEELUP);
return;
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
+ handleKbdSpecial(event.customType);
+ eventTarget()->actionStart(event.customType);
+ return;
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_END:
+ handleKbdSpecial(kActionNone);
+ return;
case Common::EVENT_KEYDOWN:
- handleKbdSpecial(event.kbd);
eventTarget()->keyDown(event.kbd);
return;
case Common::EVENT_KEYUP:
- handleKbdSpecial(event.kbd);
eventTarget()->keyUp(event.kbd);
return;
default:
@@ -187,13 +192,8 @@ void Events::setMousePos(const Common::Point &pt) {
eventTarget()->mouseMove(_mousePos);
}
-void Events::handleKbdSpecial(Common::KeyState keyState) {
- if (keyState.flags & Common::KBD_CTRL)
- _specialButtons |= MK_CONTROL;
- else
- _specialButtons &= ~MK_CONTROL;
-
- if (keyState.flags & Common::KBD_SHIFT)
+void Events::handleKbdSpecial(Common::CustomEventType action) {
+ if (action == kActionShift)
_specialButtons |= MK_SHIFT;
else
_specialButtons &= ~MK_SHIFT;
diff --git a/engines/titanic/events.h b/engines/titanic/events.h
index e217d4daeb7..164c062d5af 100644
--- a/engines/titanic/events.h
+++ b/engines/titanic/events.h
@@ -65,6 +65,7 @@ public:
virtual void mouseWheel(const Point &mousePos, bool wheelUp) {}
virtual void keyDown(Common::KeyState keyState) {}
virtual void keyUp(Common::KeyState keyState) {}
+ virtual void actionStart(Common::CustomEventType action) {}
};
/**
@@ -109,7 +110,7 @@ private:
/**
* Handles setting/resettings special buttons on key up/down
*/
- void handleKbdSpecial(Common::KeyState keyState);
+ void handleKbdSpecial(Common::CustomEventType action);
public:
Events(TitanicEngine *vm);
~Events() {}
diff --git a/engines/titanic/game/missiveomat.cpp b/engines/titanic/game/missiveomat.cpp
index c7896a968ef..3774b544a60 100644
--- a/engines/titanic/game/missiveomat.cpp
+++ b/engines/titanic/game/missiveomat.cpp
@@ -21,10 +21,13 @@
#include "titanic/game/missiveomat.h"
#include "titanic/core/room_item.h"
+#include "titanic/pet_control/pet_control.h"
#include "titanic/support/files_manager.h"
#include "titanic/titanic.h"
#include "titanic/translation.h"
+#include "backends/keymapper/keymapper.h"
+
namespace Titanic {
BEGIN_MESSAGE_MAP(CMissiveOMat, CGameObject)
@@ -78,6 +81,16 @@ void CMissiveOMat::load(SimpleFile *file) {
bool CMissiveOMat::EnterViewMsg(CEnterViewMsg *msg) {
CMissiveOMatActionMsg actionMsg(MESSAGE_STARTUP);
actionMsg.execute(this);
+
+ Common::Keymapper *keymapper = g_system->getEventManager()->getKeymapper();
+ keymapper->getKeymap("pet")->setEnabled(false);
+ keymapper->getKeymap("movement")->setEnabled(false);
+ if (getPetControl()->_currentArea == PET_REAL_LIFE) {
+ keymapper->getKeymap("real-life")->setEnabled(false);
+ } else {
+ keymapper->getKeymap("inv-shortcut")->setEnabled(false);
+ }
+
return true;
}
@@ -357,6 +370,15 @@ bool CMissiveOMat::LeaveViewMsg(CLeaveViewMsg *msg) {
editMsg.execute("MissiveOMat Login Control");
petShowCursor();
+ Common::Keymapper *keymapper = g_system->getEventManager()->getKeymapper();
+ keymapper->getKeymap("pet")->setEnabled(true);
+ keymapper->getKeymap("movement")->setEnabled(true);
+ if (getPetControl()->_currentArea == PET_REAL_LIFE) {
+ keymapper->getKeymap("real-life")->setEnabled(true);
+ } else {
+ keymapper->getKeymap("inv-shortcut")->setEnabled(true);
+ }
+
return true;
}
diff --git a/engines/titanic/game/nav_helmet.cpp b/engines/titanic/game/nav_helmet.cpp
index 8238b1a5cbf..3a688942fe9 100644
--- a/engines/titanic/game/nav_helmet.cpp
+++ b/engines/titanic/game/nav_helmet.cpp
@@ -24,6 +24,8 @@
#include "titanic/star_control/star_control.h"
#include "titanic/translation.h"
+#include "backends/keymapper/keymapper.h"
+
namespace Titanic {
BEGIN_MESSAGE_MAP(CNavHelmet, CGameObject)
@@ -79,6 +81,7 @@ bool CNavHelmet::LeaveViewMsg(CLeaveViewMsg *msg) {
bool CNavHelmet::PETHelmetOnOffMsg(CPETHelmetOnOffMsg *msg) {
CPetControl *pet = getPetControl();
+ Common::Keymapper *keymapper = g_system->getEventManager()->getKeymapper();
if (_helmetOn) {
_helmetOn = false;
@@ -94,6 +97,11 @@ bool CNavHelmet::PETHelmetOnOffMsg(CPETHelmetOnOffMsg *msg) {
}
decTransitions();
+
+ keymapper->getKeymap("star-map")->setEnabled(false);
+ keymapper->getKeymap("pet")->setEnabled(true);
+ keymapper->getKeymap("inv-shortcut")->setEnabled(true);
+ keymapper->getKeymap("movement")->setEnabled(true);
} else {
incTransitions();
_helmetOn = true;
@@ -101,6 +109,11 @@ bool CNavHelmet::PETHelmetOnOffMsg(CPETHelmetOnOffMsg *msg) {
playMovie(0, 60, MOVIE_NOTIFY_OBJECT);
playSound(TRANSLATE("a#48.wav", "a#41.wav"));
playSound(TRANSLATE("a#47.wav", "a#40.wav"));
+
+ keymapper->getKeymap("pet")->setEnabled(false);
+ keymapper->getKeymap("inv-shortcut")->setEnabled(false);
+ keymapper->getKeymap("movement")->setEnabled(false);
+ keymapper->getKeymap("star-map")->setEnabled(true);
}
return true;
diff --git a/engines/titanic/input_translator.cpp b/engines/titanic/input_translator.cpp
index 18d7f6f37ff..6ff349105c2 100644
--- a/engines/titanic/input_translator.cpp
+++ b/engines/titanic/input_translator.cpp
@@ -90,17 +90,19 @@ void CInputTranslator::keyDown(const Common::KeyState &keyState) {
if (_inputHandler->handleMessage(msg))
return;
}
+}
- if (CMovementMsg::getMovement(keyState.keycode) != MOVE_NONE) {
- CMovementMsg msg(keyState.keycode);
+void CInputTranslator::actionStart(const Common::CustomEventType &action) {
+ if(action > kActionNone && action < kActionMovementNone) {
+ CActionMsg msg(action);
if (_inputHandler->handleMessage(msg))
return;
}
- if (isSpecialKey(keyState.keycode)) {
- CVirtualKeyCharMsg msg(keyState);
- msg._keyState.ascii = 0;
- _inputHandler->handleMessage(msg);
+ if (CMovementMsg::getMovement(action) != MOVE_NONE) {
+ CMovementMsg msg(action);
+ if (_inputHandler->handleMessage(msg))
+ return;
}
}
@@ -108,18 +110,5 @@ bool CInputTranslator::isMousePressed() const {
return g_vm->_events->getSpecialButtons() & (MK_LBUTTON | MK_RBUTTON | MK_MBUTTON);
}
-bool CInputTranslator::isSpecialKey(Common::KeyCode key) {
- if ((key >= Common::KEYCODE_F1 && key <= Common::KEYCODE_F8) ||
- (key >= Common::KEYCODE_KP1 && key <= Common::KEYCODE_KP9))
- return true;
-
- if (key == Common::KEYCODE_PAGEUP || key == Common::KEYCODE_PAGEDOWN ||
- key == Common::KEYCODE_HOME || key == Common::KEYCODE_END ||
- key == Common::KEYCODE_LEFT || key == Common::KEYCODE_RIGHT ||
- key == Common::KEYCODE_UP || key == Common::KEYCODE_DOWN)
- return true;
-
- return false;
-}
} // End of namespace Titanic
diff --git a/engines/titanic/input_translator.h b/engines/titanic/input_translator.h
index d889a0c98f0..e0e3f9dc42f 100644
--- a/engines/titanic/input_translator.h
+++ b/engines/titanic/input_translator.h
@@ -22,6 +22,7 @@
#ifndef TITANIC_INPUT_TRANSLATOR_H
#define TITANIC_INPUT_TRANSLATOR_H
+#include "common/events.h"
#include "common/keyboard.h"
#include "titanic/messages/mouse_messages.h"
@@ -36,11 +37,6 @@ private:
*/
int getButtons(int special) const;
- /**
- * Returns true if a key down contains a special non-ascii key
- * that should still be passed onto the game
- */
- bool isSpecialKey(Common::KeyCode key);
public:
CInputHandler *_inputHandler;
public:
@@ -55,6 +51,7 @@ public:
void middleButtonDoubleClick(int special, const Point &pt);
void mouseWheel(bool wheelUp, const Point &pt);
void keyDown(const Common::KeyState &keyState);
+ void actionStart(const Common::CustomEventType &action);
/**
* Returns true if any mouse button is currently pressed
diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp
index b1feb0ee0c3..fd5254e91af 100644
--- a/engines/titanic/main_game_window.cpp
+++ b/engines/titanic/main_game_window.cpp
@@ -345,21 +345,27 @@ void CMainGameWindow::mouseWheel(const Point &mousePos, bool wheelUp) {
}
void CMainGameWindow::keyDown(Common::KeyState keyState) {
- if (keyState.keycode == Common::KEYCODE_c && (keyState.flags & Common::KBD_CTRL)) {
+ if (_inputAllowed) {
+ _gameManager->_inputTranslator.keyDown(keyState);
+ }
+}
+
+void CMainGameWindow::actionStart(Common::CustomEventType action) {
+ if (action == kActionCheat) {
// Cheat action
if (_project && g_vm->canLoadGameStateCurrently()) {
CViewItem *newView = _project->parseView("Cheat Room.Node 1.Cheat Rooms View");
_gameManager->_gameState.changeView(newView, nullptr);
}
- } else if (keyState.keycode == Common::KEYCODE_F5) {
+ } else if (action == kActionSave) {
// Show the GMM save dialog
g_vm->saveGameDialog();
- } else if (keyState.keycode == Common::KEYCODE_F7) {
+ } else if (action == kActionLoad) {
// Show the GMM load dialog
g_vm->loadGameDialog();
} else if (_inputAllowed) {
- _gameManager->_inputTranslator.keyDown(keyState);
+ _gameManager->_inputTranslator.actionStart(action);
}
}
diff --git a/engines/titanic/main_game_window.h b/engines/titanic/main_game_window.h
index 933de275f78..b6f8e8c3ebc 100644
--- a/engines/titanic/main_game_window.h
+++ b/engines/titanic/main_game_window.h
@@ -109,6 +109,7 @@ public:
void middleButtonUp(const Point &mousePos) override;
void mouseWheel(const Point &mousePos, bool wheelUp) override;
void keyDown(Common::KeyState keyState) override;
+ void actionStart(Common::CustomEventType action) override;
/**
* Called when the application starts
diff --git a/engines/titanic/messages/messages.cpp b/engines/titanic/messages/messages.cpp
index 829de4cabcb..d81c2c87f3c 100644
--- a/engines/titanic/messages/messages.cpp
+++ b/engines/titanic/messages/messages.cpp
@@ -180,19 +180,15 @@ CShowTextMsg::CShowTextMsg(StringId stringId) : CMessage() {
/*------------------------------------------------------------------------*/
-Movement CMovementMsg::getMovement(Common::KeyCode keycode) {
- switch (keycode) {
- case Common::KEYCODE_LEFT:
- case Common::KEYCODE_KP4:
+Movement CMovementMsg::getMovement(Common::CustomEventType action) {
+ switch (action) {
+ case kActionMovementLeft:
return TURN_LEFT;
- case Common::KEYCODE_RIGHT:
- case Common::KEYCODE_KP6:
+ case kActionMovementRight:
return TURN_RIGHT;
- case Common::KEYCODE_UP:
- case Common::KEYCODE_KP8:
+ case kActionMovementForwards:
return MOVE_FORWARDS;
- case Common::KEYCODE_DOWN:
- case Common::KEYCODE_KP2:
+ case kActionMovementBackwards:
return MOVE_BACKWARDS;
default:
return MOVE_NONE;
diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h
index 08896f8643b..65c32e85bd3 100644
--- a/engines/titanic/messages/messages.h
+++ b/engines/titanic/messages/messages.h
@@ -27,6 +27,8 @@
#include "titanic/core/tree_item.h"
#include "titanic/support/strings.h"
+#include "common/events.h"
+
namespace Titanic {
enum MessageFlag {
@@ -237,17 +239,17 @@ public:
CLASSDEF;
CMovementMsg() : _movement(MOVE_NONE) {}
CMovementMsg(Movement move) : _movement(move) {}
- CMovementMsg(Common::KeyCode key) :
- _movement(getMovement(key)) {}
+ CMovementMsg(Common::CustomEventType action) :
+ _movement(getMovement(action)) {}
static bool isSupportedBy(const CTreeItem *item) {
return supports(item, _type);
}
/**
- * Returns the movement associated with a given key, if any
+ * Returns the movement associated with a given action, if any
*/
- static Movement getMovement(Common::KeyCode keycode);
+ static Movement getMovement(Common::CustomEventType action);
};
@@ -405,7 +407,7 @@ MESSAGE0(CTurnOn);
MESSAGE1(CUse, CGameObject *, item, nullptr);
MESSAGE1(CUseWithCharMsg, CCharacter *, character, nullptr);
MESSAGE1(CUseWithOtherMsg, CGameObject *, other, 0);
-MESSAGE1(CVirtualKeyCharMsg, Common::KeyState, keyState, Common::KeyState());
+MESSAGE1(CActionMsg, Common::CustomEventType, action, 0);
MESSAGE1(CVisibleMsg, bool, visible, true);
MESSAGE1(CCheckCodeWheelsMsg, bool, isCorrect, true);
diff --git a/engines/titanic/metaengine.cpp b/engines/titanic/metaengine.cpp
index 409914dc58f..9c267ac84c0 100644
--- a/engines/titanic/metaengine.cpp
+++ b/engines/titanic/metaengine.cpp
@@ -32,6 +32,12 @@
#include "graphics/surface.h"
#include "titanic/detection.h"
+#include "common/translation.h"
+
+#include "backends/keymapper/action.h"
+#include "backends/keymapper/keymapper.h"
+#include "backends/keymapper/standard-actions.h"
+
namespace Titanic {
uint32 TitanicEngine::getFeatures() const {
@@ -57,6 +63,7 @@ public:
int getMaximumSaveSlot() const override;
bool removeSaveState(const char *target, int slot) const override;
SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override;
+ Common::KeymapArray initKeymaps(const char *target) const override;
};
bool TitanicMetaEngine::hasFeature(MetaEngineFeature f) const {
@@ -158,6 +165,257 @@ SaveStateDescriptor TitanicMetaEngine::querySaveMetaInfos(const char *target, in
return SaveStateDescriptor();
}
+Common::KeymapArray TitanicMetaEngine::initKeymaps(const char *target) const {
+ using namespace Common;
+ using namespace Titanic;
+
+ Keymap *engineKeymap = new Keymap(Keymap::kKeymapTypeGame, "titanic-default", _("Default keymappings"));
+ Keymap *petKeymap = new Keymap(Keymap::kKeymapTypeGame, "pet", _("PET keymappings"));
+ Keymap *realLifeKeymap = new Keymap(Keymap::kKeymapTypeGame, "real-life", _("Real Life keymappings"));
+ Keymap *invShortcutKeymap = new Keymap(Keymap::kKeymapTypeGame, "inv-shortcut", _("Inventory shortcut"));
+ Keymap *contSaveKeymap = new Keymap(Keymap::kKeymapTypeGame, "cont-save", _("Continue game dialogue keymappings"));
+ Keymap *starMapKeymap = new Keymap(Keymap::kKeymapTypeGame, "star-map", _("Star Map keymappings"));
+ Keymap *movementKeymap = new Keymap(Keymap::kKeymapTypeGame, "movement", _("Movement keymappings"));
+
+ Action *act;
+
+ act = new Action(kStandardActionLeftClick, _("Select / Interact / Move"));
+ act->setLeftClickEvent();
+ act->addDefaultInputMapping("MOUSE_LEFT");
+ act->addDefaultInputMapping("JOY_A");
+ engineKeymap->addAction(act);
+
+ act = new Action(kStandardActionRightClick, _("Select / Interact / Quick move"));
+ act->setRightClickEvent();
+ act->addDefaultInputMapping("MOUSE_RIGHT");
+ act->addDefaultInputMapping("JOY_B");
+ engineKeymap->addAction(act);
+
+ act = new Action("CHEAT", _("Cheat menu"));
+ act->setCustomEngineActionEvent(kActionCheat);
+ act->addDefaultInputMapping("C+c");
+ engineKeymap->addAction(act);
+
+ act = new Action("SAVE", _("Save game"));
+ act->setCustomEngineActionEvent(kActionSave);
+ act->addDefaultInputMapping("F5");
+ act->addDefaultInputMapping("JOY_LEFT_SHOULDER");
+ engineKeymap->addAction(act);
+
+ act = new Action("LOAD", _("Load game"));
+ act->setCustomEngineActionEvent(kActionLoad);
+ act->addDefaultInputMapping("F7");
+ act->addDefaultInputMapping("JOY_RIGHT_SHOULDER");
+ engineKeymap->addAction(act);
+
+ act = new Action("SHIFT", _("Shift"));
+ act->setCustomEngineActionEvent(kActionShift);
+ act->addDefaultInputMapping("LSHIFT");
+ act->addDefaultInputMapping("RSHIFT");
+ act->addDefaultInputMapping("JOY_X");
+ engineKeymap->addAction(act);
+
+ act = new Action("UP", _("Scroll up"));
+ act->setCustomEngineActionEvent(kActionUp);
+ act->addDefaultInputMapping("UP");
+ act->addDefaultInputMapping("KP8");
+ act->addDefaultInputMapping("JOY_UP");
+ realLifeKeymap->addAction(act);
+
+ act = new Action("DOWN", _("Scroll down"));
+ act->setCustomEngineActionEvent(kActionDown);
+ act->addDefaultInputMapping("DOWN");
+ act->addDefaultInputMapping("TAB");
+ act->addDefaultInputMapping("KP2");
+ act->addDefaultInputMapping("JOY_DOWN");
+ realLifeKeymap->addAction(act);
+
+ act = new Action("SELECT", _("Select"));
+ act->setCustomEngineActionEvent(kActionSelect);
+ act->addDefaultInputMapping("Return");
+ act->addDefaultInputMapping("KP_ENTER");
+ realLifeKeymap->addAction(act);
+
+ act = new Action("CONVERSATION", _("Conversation"));
+ act->setCustomEngineActionEvent(kActionPETConversation);
+ act->addDefaultInputMapping("F1");
+ petKeymap->addAction(act);
+
+ act = new Action("INVENTORY", _("Inventory"));
+ act->setCustomEngineActionEvent(kActionPETInventory);
+ act->addDefaultInputMapping("F2");
+ petKeymap->addAction(act);
+
+ act = new Action("REMOTE", _("Remote"));
+ act->setCustomEngineActionEvent(kActionPETRemote);
+ act->addDefaultInputMapping("F3");
+ petKeymap->addAction(act);
+
+ act = new Action("ROOMS", _("Rooms"));
+ act->setCustomEngineActionEvent(kActionPETRooms);
+ act->addDefaultInputMapping("F4");
+ petKeymap->addAction(act);
+
+ act = new Action("REALLIFE", _("Real life"));
+ act->setCustomEngineActionEvent(kActionPETRealLife);
+ act->addDefaultInputMapping("F6");
+ petKeymap->addAction(act);
+
+ act = new Action("SCROLLUP", _("Scroll up page"));
+ act->setCustomEngineActionEvent(kActionPETScrollPageUp);
+ act->addDefaultInputMapping("PAGEUP");
+ act->addDefaultInputMapping("KP9");
+ act->addDefaultInputMapping("JOY_UP");
+ petKeymap->addAction(act);
+
+ act = new Action("SCROLLDOWN", _("Scroll down page"));
+ act->setCustomEngineActionEvent(kActionPETScrollPageDown);
+ act->addDefaultInputMapping("PAGEDOWN");
+ act->addDefaultInputMapping("KP3");
+ act->addDefaultInputMapping("JOY_DOWN");
+ petKeymap->addAction(act);
+
+ act = new Action("SCROLLTOP", _("Scroll to top"));
+ act->setCustomEngineActionEvent(kActionPETScrollTop);
+ act->addDefaultInputMapping("HOME");
+ act->addDefaultInputMapping("KP7");
+ petKeymap->addAction(act);
+
+ act = new Action("SCROLLBOTTOM", _("Scroll to bottom"));
+ act->setCustomEngineActionEvent(kActionPeTScrollBottom);
+ act->addDefaultInputMapping("END");
+ act->addDefaultInputMapping("KP1");
+ petKeymap->addAction(act);
+
+ if (Common::parseLanguage(ConfMan.get("language", target)) == Common::DE_DEU) {
+ act = new Action("TRANSLATION", _("Translation"));
+ act->setCustomEngineActionEvent(kActionPETTranslation);
+ act->addDefaultInputMapping("F8");
+ petKeymap->addAction(act);
+ }
+
+ act = new Action("INVENTORY", _("Inventory"));
+ act->setCustomEngineActionEvent(kActionPETInventory);
+ act->addDefaultInputMapping("TAB");
+ invShortcutKeymap->addAction(act);
+
+ act = new Action("QUIT", _("Quit"));
+ act->setCustomEngineActionEvent(kActionQuit);
+ act->addDefaultInputMapping("ESCAPE");
+ contSaveKeymap->addAction(act);
+
+ act = new Action("TOGGLE", _("Toggle between Star Map and photo of your home"));
+ act->setCustomEngineActionEvent(kActionStarMapToggle);
+ act->addDefaultInputMapping("TAB");
+ starMapKeymap->addAction(act);
+
+ act = new Action("LEFT", _("Move left"));
+ act->setCustomEngineActionEvent(kActionStarMapLeft);
+ act->allowKbdRepeats();
+ act->addDefaultInputMapping("z");
+ starMapKeymap->addAction(act);
+
+ act = new Action("RIGHT", _("Move right"));
+ act->setCustomEngineActionEvent(kActionStarMapRight);
+ act->allowKbdRepeats();
+ act->addDefaultInputMapping("x");
+ starMapKeymap->addAction(act);
+
+ act = new Action("UP", _("Move up"));
+ act->setCustomEngineActionEvent(kActionStarMapUp);
+ act->allowKbdRepeats();
+ act->addDefaultInputMapping("QUOTE");
+ starMapKeymap->addAction(act);
+
+ act = new Action("DOWN", _("Move down"));
+ act->setCustomEngineActionEvent(kActionStarMapDown);
+ act->allowKbdRepeats();
+ act->addDefaultInputMapping("SLASH");
+ starMapKeymap->addAction(act);
+
+ act = new Action("FORWARD", _("Move forward"));
+ act->setCustomEngineActionEvent(kActionStarMapForward);
+ act->allowKbdRepeats();
+ act->addDefaultInputMapping("SEMICOLON");
+ act->addDefaultInputMapping("JOY_RIGHT_SHOULDER");
+ starMapKeymap->addAction(act);
+
+ act = new Action("BACKWARD", _("Move backward"));
+ act->setCustomEngineActionEvent(kActionStarMapBackward);
+ act->allowKbdRepeats();
+ act->addDefaultInputMapping("PERIOD");
+ act->addDefaultInputMapping("JOY_LEFT_SHOULDER");
+ starMapKeymap->addAction(act);
+
+ act = new Action("STOP", _("Stop moving"));
+ act->setCustomEngineActionEvent(kActionStarMapStop);
+ act->addDefaultInputMapping("SPACE");
+ act->addDefaultInputMapping("JOY_Y");
+ starMapKeymap->addAction(act);
+
+ act = new Action("LOCK", _("Lock coordinate"));
+ act->setCustomEngineActionEvent(kActionStarMapLock);
+ act->addDefaultInputMapping("l");
+ act->addDefaultInputMapping("JOY_UP");
+ starMapKeymap->addAction(act);
+
+ act = new Action("UNLOCK", _("Unlock coordinate"));
+ act->setCustomEngineActionEvent(kActionStarMapUnlock);
+ act->addDefaultInputMapping("d");
+ act->addDefaultInputMapping("JOY_DOWN");
+ starMapKeymap->addAction(act);
+
+ act = new Action("CONSTELLATIONS", _("View constellations"));
+ act->setCustomEngineActionEvent(kActionStarMapConstellations);
+ act->addDefaultInputMapping("c");
+ starMapKeymap->addAction(act);
+
+ act = new Action("BOUNDARIES", _("View boundaries"));
+ act->setCustomEngineActionEvent(kActionStarMapBoundaries);
+ act->addDefaultInputMapping("b");
+ starMapKeymap->addAction(act);
+
+ act = new Action("MFORWARD", _("Move forward"));
+ act->setCustomEngineActionEvent(kActionMovementForwards);
+ act->addDefaultInputMapping("UP");
+ act->addDefaultInputMapping("JOY_UP");
+ movementKeymap->addAction(act);
+
+ act = new Action("MBACKWARD", _("Move backward"));
+ act->setCustomEngineActionEvent(kActionMovementBackwards);
+ act->addDefaultInputMapping("DOWN");
+ act->addDefaultInputMapping("JOY_DOWN");
+ movementKeymap->addAction(act);
+
+ act = new Action("MLEFT", _("Move left"));
+ act->setCustomEngineActionEvent(kActionMovementLeft);
+ act->addDefaultInputMapping("LEFT");
+ act->addDefaultInputMapping("JOY_LEFT");
+ movementKeymap->addAction(act);
+
+ act = new Action("MRIGHT", _("Move right"));
+ act->setCustomEngineActionEvent(kActionMovementRight);
+ act->addDefaultInputMapping("RIGHT");
+ act->addDefaultInputMapping("JOY_RIGHT");
+ movementKeymap->addAction(act);
+
+ KeymapArray keymaps(7);
+
+ keymaps[0] = engineKeymap;
+ keymaps[1] = realLifeKeymap;
+ keymaps[2] = petKeymap;
+ keymaps[3] = invShortcutKeymap;
+ keymaps[4] = contSaveKeymap;
+ keymaps[5] = starMapKeymap;
+ keymaps[6] = movementKeymap;
+
+ contSaveKeymap->setEnabled(false);
+ realLifeKeymap->setEnabled(false);
+ starMapKeymap->setEnabled(false);
+
+ return keymaps;
+}
+
#if PLUGIN_ENABLED_DYNAMIC(TITANIC)
REGISTER_PLUGIN_DYNAMIC(TITANIC, PLUGIN_TYPE_ENGINE, TitanicMetaEngine);
#else
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp
index 21694bd7eda..bfcd4154e67 100644
--- a/engines/titanic/pet_control/pet_control.cpp
+++ b/engines/titanic/pet_control/pet_control.cpp
@@ -28,6 +28,8 @@
#include "titanic/game_state.h"
#include "titanic/titanic.h"
+#include "backends/keymapper/keymapper.h"
+
namespace Titanic {
BEGIN_MESSAGE_MAP(CPetControl, CGameObject)
@@ -39,7 +41,7 @@ BEGIN_MESSAGE_MAP(CPetControl, CGameObject)
ON_MESSAGE(MouseDoubleClickMsg)
ON_MESSAGE(MouseWheelMsg)
ON_MESSAGE(KeyCharMsg)
- ON_MESSAGE(VirtualKeyCharMsg)
+ ON_MESSAGE(ActionMsg)
ON_MESSAGE(TimerMsg)
END_MESSAGE_MAP()
@@ -73,6 +75,7 @@ void CPetControl::save(SimpleFile *file, int indent) {
void CPetControl::load(SimpleFile *file) {
int val = file->readNumber();
isValid();
+ Common::Keymapper *keymapper = g_system->getEventManager()->getKeymapper();
if (!val) {
_currentArea = (PetArea)file->readNumber();
@@ -80,6 +83,11 @@ void CPetControl::load(SimpleFile *file) {
_remoteTargetName = file->readString();
loadAreas(file, 0);
+
+ if (_currentArea == PET_REAL_LIFE) {
+ keymapper->getKeymap("inv-shortcut")->setEnabled(false);
+ keymapper->getKeymap("real-life")->setEnabled(true);
+ }
}
CGameObject::load(file);
@@ -219,6 +227,15 @@ PetArea CPetControl::setArea(PetArea newArea, bool forceChange) {
if ((!forceChange && newArea == _currentArea) || !isAreaUnlocked())
return _currentArea;
+ Common::Keymapper *keymapper = g_system->getEventManager()->getKeymapper();
+ if (newArea == PET_REAL_LIFE) {
+ keymapper->getKeymap("inv-shortcut")->setEnabled(false);
+ keymapper->getKeymap("real-life")->setEnabled(true);
+ } else {
+ keymapper->getKeymap("real-life")->setEnabled(false);
+ keymapper->getKeymap("inv-shortcut")->setEnabled(true);
+ }
+
// Signal the currently active area that it's being left
_sections[_currentArea]->leave();
@@ -337,55 +354,40 @@ bool CPetControl::KeyCharMsg(CKeyCharMsg *msg) {
makeDirty();
bool result = _sections[_currentArea]->KeyCharMsg(msg);
- if (!result) {
- switch (msg->_key) {
- case Common::KEYCODE_TAB:
- if (isAreaUnlocked()) {
- setArea(PET_INVENTORY);
- result = true;
- }
- break;
- default:
- break;
- }
- }
-
return result;
}
-bool CPetControl::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) {
+bool CPetControl::ActionMsg(CActionMsg *msg) {
if (isInputLocked())
return false;
- bool result = _sections[_currentArea]->VirtualKeyCharMsg(msg);
+ bool result = _sections[_currentArea]->ActionMsg(msg);
if (!result) {
- switch (msg->_keyState.keycode) {
- case Common::KEYCODE_F1:
+ switch (msg->_action) {
+ case kActionPETConversation:
result = true;
setArea(PET_CONVERSATION);
break;
- case Common::KEYCODE_F2:
- setArea(PET_INVENTORY);
+ case kActionPETInventory:
result = true;
+ setArea(PET_INVENTORY);
break;
- case Common::KEYCODE_F3:
+ case kActionPETRemote:
result = true;
setArea(PET_REMOTE);
break;
- case Common::KEYCODE_F4:
+ case kActionPETRooms:
result = true;
setArea(PET_ROOMS);
break;
- case Common::KEYCODE_F6:
+ case kActionPETRealLife:
result = true;
setArea(PET_REAL_LIFE);
break;
- case Common::KEYCODE_F8:
- if (g_vm->isGerman()) {
- result = true;
- setArea(PET_TRANSLATION);
- }
+ case kActionPETTranslation:
+ result = true;
+ setArea(PET_TRANSLATION);
break;
default:
break;
diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h
index 52a64f8e0d6..7ec2af82fbc 100644
--- a/engines/titanic/pet_control/pet_control.h
+++ b/engines/titanic/pet_control/pet_control.h
@@ -116,7 +116,7 @@ protected:
bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg);
bool MouseWheelMsg(CMouseWheelMsg *msg);
bool KeyCharMsg(CKeyCharMsg *msg);
- bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg);
+ bool ActionMsg(CActionMsg *msg);
bool TimerMsg(CTimerMsg *msg);
public:
PetArea _currentArea;
diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp
index f4f2c74859a..fb764931f39 100644
--- a/engines/titanic/pet_control/pet_conversations.cpp
+++ b/engines/titanic/pet_control/pet_conversations.cpp
@@ -223,8 +223,28 @@ bool CPetConversations::KeyCharMsg(CKeyCharMsg *msg) {
return handleKey(keyState);
}
-bool CPetConversations::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) {
- return handleKey(msg->_keyState);
+bool CPetConversations::ActionMsg(CActionMsg *msg) {
+ Common::CustomEventType action;
+ action = msg->_action;
+
+ switch (action) {
+ case kActionPETScrollPageUp:
+ scrollUpPage();
+ return true;
+ case kActionPETScrollPageDown:
+ scrollDownPage();
+ return true;
+ case kActionPETScrollTop:
+ scrollToTop();
+ return true;
+ case kActionPeTScrollBottom:
+ scrollToBottom();
+ return true;
+ default:
+ break;
+ }
+
+ return false;
}
void CPetConversations::displayMessage(const CString &msg) {
@@ -464,32 +484,12 @@ TTnpcScript *CPetConversations::getNPCScript(const CString &name) const {
}
bool CPetConversations::handleKey(const Common::KeyState &keyState) {
- switch (keyState.keycode) {
- case Common::KEYCODE_PAGEUP:
- case Common::KEYCODE_KP9:
- scrollUpPage();
- return true;
- case Common::KEYCODE_PAGEDOWN:
- case Common::KEYCODE_KP3:
- scrollDownPage();
- return true;
- case Common::KEYCODE_HOME:
- case Common::KEYCODE_KP7:
- scrollToTop();
+ if (keyState.ascii > 0 && keyState.ascii <= 127
+ && keyState.ascii != Common::KEYCODE_TAB) {
+ if (_textInput.handleKey(keyState.ascii))
+ // Text line finished, so process line
+ textLineEntered(_textInput.getText());
return true;
- case Common::KEYCODE_END:
- case Common::KEYCODE_KP1:
- scrollToBottom();
- return true;
- default:
- if (keyState.ascii > 0 && keyState.ascii <= 127
- && keyState.ascii != Common::KEYCODE_TAB) {
- if (_textInput.handleKey(keyState.ascii))
- // Text line finished, so process line
- textLineEntered(_textInput.getText());
- return true;
- }
- break;
}
return false;
diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h
index d6e7c281ac4..ee7a8d8f2c3 100644
--- a/engines/titanic/pet_control/pet_conversations.h
+++ b/engines/titanic/pet_control/pet_conversations.h
@@ -165,7 +165,7 @@ public:
bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) override;
bool MouseWheelMsg(CMouseWheelMsg *msg) override;
bool KeyCharMsg(CKeyCharMsg *msg) override;
- bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) override;
+ bool ActionMsg(CActionMsg *msg) override;
/**
* Display a message
diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp
index 16a0ba81baa..2495ba08d4a 100644
--- a/engines/titanic/pet_control/pet_glyphs.cpp
+++ b/engines/titanic/pet_control/pet_glyphs.cpp
@@ -412,10 +412,10 @@ bool CPetGlyphs::KeyCharMsg(int key) {
return false;
}
-bool CPetGlyphs::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) {
+bool CPetGlyphs::ActionMsg(CActionMsg *msg) {
if (_highlightIndex >= 0) {
CPetGlyph *glyph = getGlyph(_highlightIndex);
- if (glyph && glyph->VirtualKeyCharMsg(msg))
+ if (glyph && glyph->ActionMsg(msg))
return true;
}
diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h
index 662893e98de..8ddfc491f4d 100644
--- a/engines/titanic/pet_control/pet_glyphs.h
+++ b/engines/titanic/pet_control/pet_glyphs.h
@@ -138,9 +138,9 @@ public:
virtual bool KeyCharMsg(int key) { return false; }
/**
- * Handles keypresses
+ * Handles actions
*/
- virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { return false; }
+ virtual bool ActionMsg(CActionMsg *msg) {return false; }
/**
* Unhighlight any currently highlighted element
@@ -401,9 +401,9 @@ public:
bool KeyCharMsg(int key);
/**
- * Virtual key message
+ * Action message
*/
- bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg);
+ bool ActionMsg(CActionMsg *msg);
/**
* When the PET section is entered, passes onto the highlighted
diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp
index c6988f8c1d7..9c80eca5222 100644
--- a/engines/titanic/pet_control/pet_inventory.cpp
+++ b/engines/titanic/pet_control/pet_inventory.cpp
@@ -97,8 +97,8 @@ bool CPetInventory::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) {
return _items.MouseDoubleClickMsg(msg->_mousePos);
}
-bool CPetInventory::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) {
- return _items.VirtualKeyCharMsg(msg);
+bool CPetInventory::ActionMsg(CActionMsg *msg) {
+ return _items.ActionMsg(msg);
}
bool CPetInventory::MouseWheelMsg(CMouseWheelMsg *msg) {
diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h
index 2827fd689b2..51cbe2ffd03 100644
--- a/engines/titanic/pet_control/pet_inventory.h
+++ b/engines/titanic/pet_control/pet_inventory.h
@@ -96,7 +96,7 @@ public:
bool MouseDragStartMsg(CMouseDragStartMsg *msg) override;
bool MouseButtonUpMsg(CMouseButtonUpMsg *msg) override;
bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) override;
- bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) override;
+ bool ActionMsg(CActionMsg *msg) override;
bool MouseWheelMsg(CMouseWheelMsg *msg) override;
/**
diff --git a/engines/titanic/pet_control/pet_load_save.cpp b/engines/titanic/pet_control/pet_load_save.cpp
index a7e496c28f4..247d4bb6000 100644
--- a/engines/titanic/pet_control/pet_load_save.cpp
+++ b/engines/titanic/pet_control/pet_load_save.cpp
@@ -80,19 +80,17 @@ bool CPetLoadSave::MouseButtonDownMsg(const Point &pt) {
return false;
}
-bool CPetLoadSave::KeyCharMsg(int key) {
- switch (key) {
- case Common::KEYCODE_TAB:
- case Common::KEYCODE_DOWN:
- case Common::KEYCODE_KP2:
+bool CPetLoadSave::ActionMsg(CActionMsg *msg) {
+ Common::CustomEventType action = msg->_action;
+ switch (action) {
+ case kActionDown:
if (_savegameSlotNum != -1) {
highlightSlot((_savegameSlotNum + 1) % 5);
getPetControl()->makeDirty();
}
return true;
- case Common::KEYCODE_UP:
- case Common::KEYCODE_KP8:
+ case kActionUp:
if (_savegameSlotNum != -1) {
int slotNum = --_savegameSlotNum;
highlightSlot((slotNum == -1) ? SAVEGAME_SLOTS_COUNT - 1 : slotNum);
@@ -100,8 +98,7 @@ bool CPetLoadSave::KeyCharMsg(int key) {
}
return true;
- case Common::KEYCODE_RETURN:
- case Common::KEYCODE_KP_ENTER:
+ case kActionSelect:
execute();
return true;
diff --git a/engines/titanic/pet_control/pet_load_save.h b/engines/titanic/pet_control/pet_load_save.h
index 6b0afe0be23..8d84ca049b7 100644
--- a/engines/titanic/pet_control/pet_load_save.h
+++ b/engines/titanic/pet_control/pet_load_save.h
@@ -25,6 +25,8 @@
#include "titanic/pet_control/pet_glyphs.h"
#include "titanic/gfx/text_control.h"
+#include "common/events.h"
+
namespace Titanic {
#define SAVEGAME_SLOTS_COUNT 5
@@ -88,9 +90,9 @@ public:
bool MouseButtonDownMsg(const Point &pt) override;
/**
- * Handles keypresses when the glyph is focused
+ * Handles Actions when the glyph is focused
*/
- bool KeyCharMsg(int key) override;
+ bool ActionMsg(CActionMsg *msg) override;
/**
* Resets highlighting on the save slots
diff --git a/engines/titanic/pet_control/pet_real_life.cpp b/engines/titanic/pet_control/pet_real_life.cpp
index 6804ace0153..be3b14cb373 100644
--- a/engines/titanic/pet_control/pet_real_life.cpp
+++ b/engines/titanic/pet_control/pet_real_life.cpp
@@ -73,8 +73,8 @@ bool CPetRealLife::KeyCharMsg(CKeyCharMsg *msg) {
return _glyphs.KeyCharMsg(msg->_key);
}
-bool CPetRealLife::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) {
- return _glyphs.VirtualKeyCharMsg(msg);
+bool CPetRealLife::ActionMsg(CActionMsg *msg) {
+ return _glyphs.ActionMsg(msg);
}
void CPetRealLife::postLoad() {
diff --git a/engines/titanic/pet_control/pet_real_life.h b/engines/titanic/pet_control/pet_real_life.h
index eb82ce1e499..2b82daaa8f3 100644
--- a/engines/titanic/pet_control/pet_real_life.h
+++ b/engines/titanic/pet_control/pet_real_life.h
@@ -78,7 +78,7 @@ public:
bool MouseDragEndMsg(CMouseDragEndMsg *msg) override;
bool MouseButtonUpMsg(CMouseButtonUpMsg *msg) override;
bool KeyCharMsg(CKeyCharMsg *msg) override;
- bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) override;
+ bool ActionMsg(CActionMsg *msg) override;
/**
* Returns item a drag-drop operation has dropped on, if any
diff --git a/engines/titanic/pet_control/pet_remote.cpp b/engines/titanic/pet_control/pet_remote.cpp
index 7627409e01d..f8f7baf0999 100644
--- a/engines/titanic/pet_control/pet_remote.cpp
+++ b/engines/titanic/pet_control/pet_remote.cpp
@@ -162,8 +162,8 @@ bool CPetRemote::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) {
return _items.MouseButtonDownMsg(msg->_mousePos);
}
-bool CPetRemote::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) {
- return _items.VirtualKeyCharMsg(msg);
+bool CPetRemote::ActionMsg(CActionMsg *msg) {
+ return _items.ActionMsg(msg);
}
bool CPetRemote::MouseWheelMsg(CMouseWheelMsg *msg) {
diff --git a/engines/titanic/pet_control/pet_remote.h b/engines/titanic/pet_control/pet_remote.h
index 2084cdbaff3..2cef16e4f0c 100644
--- a/engines/titanic/pet_control/pet_remote.h
+++ b/engines/titanic/pet_control/pet_remote.h
@@ -110,7 +110,7 @@ public:
bool MouseButtonDownMsg(CMouseButtonDownMsg *msg) override;
bool MouseButtonUpMsg(CMouseButtonUpMsg *msg) override;
bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) override;
- bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) override;
+ bool ActionMsg(CActionMsg *msg) override;
bool MouseWheelMsg(CMouseWheelMsg *msg) override;
/**
diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp
index 67b664dd61a..cf241040b45 100644
--- a/engines/titanic/pet_control/pet_rooms.cpp
+++ b/engines/titanic/pet_control/pet_rooms.cpp
@@ -92,8 +92,8 @@ bool CPetRooms::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) {
return !_glyphs.MouseButtonDownMsg(msg->_mousePos);
}
-bool CPetRooms::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) {
- return _glyphs.VirtualKeyCharMsg(msg);
+bool CPetRooms::ActionMsg(CActionMsg *msg) {
+ return _glyphs.ActionMsg(msg);
}
bool CPetRooms::checkDragEnd(CGameObject *item) {
diff --git a/engines/titanic/pet_control/pet_rooms.h b/engines/titanic/pet_control/pet_rooms.h
index b3a5486a932..4de7cf6840a 100644
--- a/engines/titanic/pet_control/pet_rooms.h
+++ b/engines/titanic/pet_control/pet_rooms.h
@@ -95,7 +95,7 @@ public:
bool MouseDragStartMsg(CMouseDragStartMsg *msg) override;
bool MouseButtonUpMsg(CMouseButtonUpMsg *msg) override;
bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) override;
- bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) override;
+ bool ActionMsg(CActionMsg *msg) override;
/**
* Check whether a drag drop can occur
diff --git a/engines/titanic/pet_control/pet_save.cpp b/engines/titanic/pet_control/pet_save.cpp
index 194b368f435..2f0996249ae 100644
--- a/engines/titanic/pet_control/pet_save.cpp
+++ b/engines/titanic/pet_control/pet_save.cpp
@@ -49,15 +49,19 @@ bool CPetSave::MouseButtonUpMsg(const Point &pt) {
}
bool CPetSave::KeyCharMsg(int key) {
- if (CPetLoadSave::KeyCharMsg(key))
- return true;
-
if (_savegameSlotNum != -1)
_slotNames[_savegameSlotNum].handleKey(key);
return true;
}
+bool CPetSave::ActionMsg(CActionMsg *msg) {
+ if (CPetLoadSave::ActionMsg(msg))
+ return true;
+
+ return false;
+}
+
void CPetSave::highlightCurrent(const Point &pt) {
resetSlots();
highlightSave(_savegameSlotNum);
diff --git a/engines/titanic/pet_control/pet_save.h b/engines/titanic/pet_control/pet_save.h
index 86ca5ed3cb8..d4d9914b219 100644
--- a/engines/titanic/pet_control/pet_save.h
+++ b/engines/titanic/pet_control/pet_save.h
@@ -43,6 +43,11 @@ public:
*/
bool KeyCharMsg(int key) override;
+ /**
+ * Handles actions when the glyph is focused
+ */
+ bool ActionMsg(CActionMsg *msg) override;
+
/**
* Unhighlight any currently highlighted element
*/
diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h
index 1871ab65e5d..df3bc723349 100644
--- a/engines/titanic/pet_control/pet_section.h
+++ b/engines/titanic/pet_control/pet_section.h
@@ -107,7 +107,7 @@ public:
virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { return false; }
virtual bool MouseWheelMsg(CMouseWheelMsg *msg) { return false; }
virtual bool KeyCharMsg(CKeyCharMsg *msg) { return false; }
- virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { return false; }
+ virtual bool ActionMsg(CActionMsg *msg) { return false; }
/**
* Check whether a drag drop can occur
diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp
index b0448d85159..72f40eb57ed 100644
--- a/engines/titanic/star_control/star_control.cpp
+++ b/engines/titanic/star_control/star_control.cpp
@@ -33,7 +33,7 @@ namespace Titanic {
BEGIN_MESSAGE_MAP(CStarControl, CGameObject)
ON_MESSAGE(MouseMoveMsg)
ON_MESSAGE(MouseButtonDownMsg)
- ON_MESSAGE(KeyCharMsg)
+ ON_MESSAGE(ActionMsg)
ON_MESSAGE(FrameMsg)
ON_MESSAGE(MovementMsg)
END_MESSAGE_MAP()
@@ -102,10 +102,10 @@ bool CStarControl::MouseMoveMsg(CMouseMoveMsg *msg) {
}
}
-bool CStarControl::KeyCharMsg(CKeyCharMsg *msg) {
+bool CStarControl::ActionMsg(CActionMsg *msg) {
if (_visible) {
CErrorCode errorCode;
- _view.KeyCharMsg(msg->_key, &errorCode);
+ _view.ActionMsg(msg, &errorCode);
return errorCode.get();
}
diff --git a/engines/titanic/star_control/star_control.h b/engines/titanic/star_control/star_control.h
index c41912a33d1..0c1f093015d 100644
--- a/engines/titanic/star_control/star_control.h
+++ b/engines/titanic/star_control/star_control.h
@@ -34,7 +34,7 @@ class CStarControl : public CGameObject {
DECLARE_MESSAGE_MAP;
bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
bool MouseMoveMsg(CMouseMoveMsg *msg);
- bool KeyCharMsg(CKeyCharMsg *msg);
+ bool ActionMsg(CActionMsg *msg);
bool FrameMsg(CFrameMsg *msg);
bool MovementMsg(CMovementMsg *msg);
private:
diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp
index 022a13c42b6..123bac3f0d2 100644
--- a/engines/titanic/star_control/star_view.cpp
+++ b/engines/titanic/star_control/star_view.cpp
@@ -154,19 +154,20 @@ bool CStarView::MouseMoveMsg(int unused, const Point &pt) {
return false;
}
-bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
+bool CStarView::ActionMsg(CActionMsg *msg, CErrorCode *errorCode) {
FPose pose;
int lockLevel = _starField ? _starField->getMatchedIndex() : -1;
+ Common::CustomEventType action = msg->_action;
- switch (tolower(key)) {
- case Common::KEYCODE_TAB:
+ switch (action) {
+ case kActionStarMapToggle:
if (_starField) {
toggleHomePhoto();
return true;
}
break;
- case Common::KEYCODE_l: {
+ case kActionStarMapLock: {
CPetControl *pet = _owner->getPetControl();
if (pet && pet->_remoteTarget) {
CPETStarFieldLockMsg lockMsg(1);
@@ -175,7 +176,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
return true;
}
- case Common::KEYCODE_d: {
+ case kActionStarMapUnlock: {
CPetControl *pet = _owner->getPetControl();
if (pet && pet->_remoteTarget) {
CPETStarFieldLockMsg lockMsg(0);
@@ -184,7 +185,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
return true;
}
- case Common::KEYCODE_z:
+ case kActionStarMapLeft:
if (lockLevel == -1) {
pose.setRotationMatrix(Y_AXIS, -1.0);
_camera.changeOrientation(pose);
@@ -193,7 +194,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
}
break;
- case Common::KEYCODE_SEMICOLON:
+ case kActionStarMapForward:
if (lockLevel == -1) {
_camera.accelerate();
errorCode->set();
@@ -201,7 +202,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
}
break;
- case Common::KEYCODE_PERIOD:
+ case kActionStarMapBackward:
if (lockLevel == -1) {
_camera.deccelerate();
errorCode->set();
@@ -209,7 +210,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
}
break;
- case Common::KEYCODE_SPACE:
+ case kActionStarMapStop:
if (lockLevel == -1) {
_camera.stop();
errorCode->set();
@@ -217,7 +218,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
}
break;
- case Common::KEYCODE_x:
+ case kActionStarMapRight:
if (lockLevel == -1) {
pose.setRotationMatrix(Y_AXIS, 1.0);
_camera.changeOrientation(pose);
@@ -226,7 +227,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
}
break;
- case Common::KEYCODE_QUOTE:
+ case kActionStarMapUp:
if (lockLevel == -1) {
pose.setRotationMatrix(X_AXIS, 1.0);
_camera.changeOrientation(pose);
@@ -235,7 +236,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
}
break;
- case Common::KEYCODE_SLASH:
+ case kActionStarMapDown:
if (lockLevel == -1) {
pose.setRotationMatrix(X_AXIS, -1.0);
_camera.changeOrientation(pose);
@@ -246,13 +247,13 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
// New for ScummVM to show the boundaries sphere code the original implemented,
// but wasn't actually hooked up to any player action
- case Common::KEYCODE_b:
+ case kActionStarMapBoundaries:
viewBoundaries();
return true;
// New for ScummVM to show the constellations sphere code the original implemented,
// but wasn't actually hooked up to any player action
- case Common::KEYCODE_c:
+ case kActionStarMapConstellations:
viewConstellations();
return true;
diff --git a/engines/titanic/star_control/star_view.h b/engines/titanic/star_control/star_view.h
index ef8bb9b798f..46f513a8e5c 100644
--- a/engines/titanic/star_control/star_view.h
+++ b/engines/titanic/star_control/star_view.h
@@ -22,6 +22,7 @@
#ifndef TITANIC_STAR_VIEW_H
#define TITANIC_STAR_VIEW_H
+#include "titanic/messages/messages.h"
#include "titanic/star_control/camera.h"
#include "titanic/star_control/surface_fader.h"
#include "titanic/star_control/viewport.h"
@@ -120,9 +121,9 @@ public:
bool MouseMoveMsg(int unused, const Point &pt);
/**
- * Handles keyboard messages
+ * Handles action messages
*/
- bool KeyCharMsg(int key, CErrorCode *errorCode);
+ bool ActionMsg(CActionMsg *msg, CErrorCode *errorCode);
/**
* Returns true if a star destination can be set
diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h
index 7d4c9a0852e..9bced7af9a4 100644
--- a/engines/titanic/titanic.h
+++ b/engines/titanic/titanic.h
@@ -78,6 +78,46 @@ class CScriptHandler;
class TTscriptBase;
struct TitanicGameDescription;
+enum TITANICActions {
+ kActionNone,
+ kActionUp,
+ kActionDown,
+ kActionSelect,
+ kActionCheat,
+ kActionSave,
+ kActionLoad,
+ kActionQuit,
+ kActionShift,
+ kActionPETConversation,
+ kActionPETInventory,
+ kActionPETRemote,
+ kActionPETRooms,
+ kActionPETRealLife,
+ kActionPETTranslation,
+ kActionPETScrollPageUp,
+ kActionPETScrollPageDown,
+ kActionPETScrollTop,
+ kActionPeTScrollBottom,
+ kActionStarMapToggle,
+ kActionStarMapLeft,
+ kActionStarMapRight,
+ kActionStarMapUp,
+ kActionStarMapDown,
+ kActionStarMapForward,
+ kActionStarMapBackward,
+ kActionStarMapStop,
+ kActionStarMapLock,
+ kActionStarMapUnlock,
+ kActionStarMapConstellations,
+ kActionStarMapBoundaries,
+ kActionMovementNone,
+ kActionMovementForwards,
+ kActionMovementBackwards,
+ kActionMovementLeft,
+ kActionMovementRight,
+
+};
+
class TitanicEngine : public Engine {
private:
/**
More information about the Scummvm-git-logs
mailing list