diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/pink/objects/actors/lead_actor.cpp | 6 | ||||
-rw-r--r-- | engines/pink/objects/actors/lead_actor.h | 2 | ||||
-rw-r--r-- | engines/pink/objects/inventory.cpp | 25 | ||||
-rw-r--r-- | engines/pink/objects/inventory.h | 6 |
4 files changed, 39 insertions, 0 deletions
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp index e26b50a42c..c583d9a7c4 100644 --- a/engines/pink/objects/actors/lead_actor.cpp +++ b/engines/pink/objects/actors/lead_actor.cpp @@ -201,6 +201,12 @@ void LeadActor::onLeftButtonClick(Common::Point point) { } } +void LeadActor::onMouseOver(Common::Point point, CursorMgr *mgr) { + if (_page->getModule()->getInventoryMgr()->isPinkOwnsAnyItems()) + _cursorMgr->setCursor(kClickableFirstFrameCursor, {0, 0}); + else Actor::onMouseOver(point, mgr); +} + void ParlSqPink::toConsole() { debug("ParlSqPink: _name = %s", _name.c_str()); for (int i = 0; i < _actions.size(); ++i) { diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h index 3a64893991..208bfaad24 100644 --- a/engines/pink/objects/actors/lead_actor.h +++ b/engines/pink/objects/actors/lead_actor.h @@ -63,6 +63,8 @@ public: void onLeftButtonClick(Common::Point point); void onMouseMove(Common::Point point); + virtual void onMouseOver(Common::Point point, CursorMgr *mgr); + private: void updateCursor(Common::Point point); diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp index feed41a29b..0f1b711503 100644 --- a/engines/pink/objects/inventory.cpp +++ b/engines/pink/objects/inventory.cpp @@ -24,9 +24,15 @@ #include <common/debug.h> #include "inventory.h" #include "engines/pink/archive.h" +#include "pink/objects/actors/lead_actor.h" namespace Pink { +InventoryMgr::InventoryMgr() + : _lead(nullptr), _item(nullptr) +{ +} + void Pink::InventoryItem::deserialize(Archive &archive) { NamedObject::deserialize(archive); _initialOwner = archive.readString(); @@ -69,6 +75,25 @@ void InventoryMgr::toConsole() { } } +bool InventoryMgr::isPinkOwnsAnyItems() { + if (_item) + return true; + + for (int i = 0; i < _items.size(); ++i) { + if (_items[i]->getCurrentOwner() == _lead->getName()){ + _item = _items[i]; + return true; + } + } + + return false; +} + +void InventoryMgr::setItemOwner(const Common::String &owner, InventoryItem *item) { + item->_currentOwner = owner; + _item = item; +} + } // End of namespace Pink diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h index ca1ef7fb69..908f2a8d2f 100644 --- a/engines/pink/objects/inventory.h +++ b/engines/pink/objects/inventory.h @@ -38,6 +38,7 @@ public: Common::String &getCurrentOwner(); + friend class InventoryMgr; private: Common::String _initialOwner; Common::String _currentOwner; @@ -47,6 +48,7 @@ class LeadActor; class InventoryMgr : public Object { public: + InventoryMgr(); virtual ~InventoryMgr(); virtual void deserialize(Archive &archive); @@ -55,8 +57,12 @@ public: void setLeadActor(LeadActor *lead); InventoryItem* findInventoryItem(Common::String &name); + bool isPinkOwnsAnyItems(); + void setItemOwner(const Common::String &owner, InventoryItem *item); + private: LeadActor *_lead; + InventoryItem *_item; Common::Array<InventoryItem*> _items; // other fields. haven't RE them yet }; |