diff options
-rw-r--r-- | engines/titanic/pet_control/pet_control.cpp | 39 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_control.h | 4 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_element.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_element.h | 3 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_section.h | 5 |
5 files changed, 46 insertions, 9 deletions
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 9d2622ffb6..f316cff8e6 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -208,7 +208,7 @@ void CPetControl::fn4() { } PetArea CPetControl::setArea(PetArea newArea) { - if (newArea == _currentArea || !canChangeArea()) + if (newArea == _currentArea || !isUnlocked()) return _currentArea; // Signal the currently active area that it's being left @@ -347,7 +347,42 @@ bool CPetControl::getC0() const { } bool CPetControl::handleMessage(CMouseButtonDownMsg &msg) { - return true; + if (!containsPt(msg._mousePos) || getC0()) + return false; + + bool result = false; + if (isUnlocked()) + result = _frame.handleMessage(msg); + + if (!result) { + switch (_currentArea) { + case PET_INVENTORY: + result = _inventory.handleMessage(msg); + break; + case PET_CONVERSATION: + result = _conversations.handleMessage(msg); + break; + case PET_REMOTE: + result = _remote.handleMessage(msg); + break; + case PET_ROOMS: + result = _rooms.handleMessage(msg); + break; + case PET_SAVE: + result = _saves.handleMessage(msg); + break; + case PET_5: + result = _sub5.handleMessage(msg); + break; + case PET_6: + result = _sub7.handleMessage(msg); + break; + default: + break; + } + } + + makeDirty(); } bool CPetControl::handleMessage(CMouseDragStartMsg &msg) { diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index be3b4a6118..26b358322b 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -169,9 +169,9 @@ public: PetArea setArea(PetArea newSection); /** - * Returns true if the current area can be changed + * Returns true if the PET is currently unlocked */ - bool canChangeArea() const { return _locked == 0; } + bool isUnlocked() const { return _locked == 0; } /** * Returns a game object used by the PET by name from within the diff --git a/engines/titanic/pet_control/pet_element.cpp b/engines/titanic/pet_control/pet_element.cpp index a4c5b271a0..423c79af8b 100644 --- a/engines/titanic/pet_control/pet_element.cpp +++ b/engines/titanic/pet_control/pet_element.cpp @@ -40,8 +40,8 @@ bool CPetElement::proc6(const Common::Point &pt) { return result; } -bool CPetElement::proc7(const Common::Point &pt) { - bool result = _bounds.contains(pt); +bool CPetElement::handleMessage(CMouseButtonDownMsg &msg) { + bool result = _bounds.contains(msg._mousePos); if (result) setMode(MODE_UNSELECTED); return result; diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index fdb8ca5e56..13f209cefa 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -26,6 +26,7 @@ #include "titanic/simple_file.h" #include "titanic/string.h" #include "titanic/core/link_item.h" +#include "titanic/messages/mouse_messages.h" namespace Titanic { @@ -69,7 +70,7 @@ public: virtual void getBounds(Rect *rect); virtual bool proc6(const Common::Point &pt); - virtual bool proc7(const Common::Point &pt); + virtual bool handleMessage(CMouseButtonDownMsg &msg); /** * Returns whether the passed point falls inside the item diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index f81e8d0aa9..1355a54f22 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -23,7 +23,7 @@ #ifndef TITANIC_PET_SECTION_H #define TITANIC_PET_SECTION_H -#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" #include "titanic/simple_file.h" namespace Titanic { @@ -75,7 +75,8 @@ public: virtual Rect getBounds() { return Rect(); } virtual void proc5(int val) {} - virtual int proc6() { return 0; } + + virtual bool handleMessage(CMouseButtonDownMsg &msg) { return false; } virtual int proc7() { return 0; } virtual int proc8() { return 0; } virtual int proc9() { return 0; } |