aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/pet_control
diff options
context:
space:
mode:
authorPaul Gilbert2016-11-07 21:39:25 -0500
committerPaul Gilbert2016-11-07 21:39:25 -0500
commit61d14b94d558e25105b6d8c2620b83f6d9b53d52 (patch)
tree09a8e3f83e7e161e62c17e0d632c9fc1ea5f0768 /engines/titanic/pet_control
parente9a1abb4f2ce7bd8a70e36958b0e9fd9652d5c8e (diff)
downloadscummvm-rg350-61d14b94d558e25105b6d8c2620b83f6d9b53d52.tar.gz
scummvm-rg350-61d14b94d558e25105b6d8c2620b83f6d9b53d52.tar.bz2
scummvm-rg350-61d14b94d558e25105b6d8c2620b83f6d9b53d52.zip
TITANIC: Fix entering slot name & saving using in-game PET
Diffstat (limited to 'engines/titanic/pet_control')
-rw-r--r--engines/titanic/pet_control/pet_real_life.h5
-rw-r--r--engines/titanic/pet_control/pet_save.cpp13
-rw-r--r--engines/titanic/pet_control/pet_save.h5
3 files changed, 17 insertions, 6 deletions
diff --git a/engines/titanic/pet_control/pet_real_life.h b/engines/titanic/pet_control/pet_real_life.h
index b359d285c8..7c7101a84b 100644
--- a/engines/titanic/pet_control/pet_real_life.h
+++ b/engines/titanic/pet_control/pet_real_life.h
@@ -87,11 +87,6 @@ public:
virtual CGameObject *dragEnd(const Point &pt) const { return nullptr; }
/**
- * Display a message
- */
- virtual void displayMessage(const CString &msg) {}
-
- /**
* Returns true if the object is in a valid state
*/
virtual bool isValid(CPetControl *petControl);
diff --git a/engines/titanic/pet_control/pet_save.cpp b/engines/titanic/pet_control/pet_save.cpp
index d344c8cd14..60afa11ab4 100644
--- a/engines/titanic/pet_control/pet_save.cpp
+++ b/engines/titanic/pet_control/pet_save.cpp
@@ -49,6 +49,16 @@ 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;
+}
+
void CPetSave::highlightCurrent(const Point &pt) {
resetSlots();
highlightSave(_savegameSlotNum);
@@ -71,11 +81,12 @@ void CPetSave::unhighlightSave(int index) {
void CPetSave::execute() {
CPetControl *pet = getPetControl();
if (_savegameSlotNum >= 0) {
+ int slotNumber = _savegameSlotNum;
highlightSlot(-1);
CProjectItem *project = pet ? pet->getRoot() : nullptr;
if (project) {
- project->saveGame(_savegameSlotNum, _slotNames[_savegameSlotNum].getText());
+ project->saveGame(slotNumber, _slotNames[slotNumber].getText());
pet->displayMessage(BLANK);
}
} else if (pet) {
diff --git a/engines/titanic/pet_control/pet_save.h b/engines/titanic/pet_control/pet_save.h
index e5e956403f..39a25eb087 100644
--- a/engines/titanic/pet_control/pet_save.h
+++ b/engines/titanic/pet_control/pet_save.h
@@ -40,6 +40,11 @@ public:
virtual bool MouseButtonUpMsg(const Point &pt);
/**
+ * Handles keypresses when the glyph is focused
+ */
+ virtual bool KeyCharMsg(int key);
+
+ /**
* Unhighlight any currently highlighted element
*/
virtual void unhighlightCurrent() { unhighlightSave(_savegameSlotNum); }