From 7a1b35212bf44736104dc202d1f23e71bfdc4cc6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 8 Sep 2017 21:11:22 -0400 Subject: TITANIC: Keep highlighted inventory items animating when changing room --- engines/titanic/pet_control/pet_control.cpp | 1 + engines/titanic/pet_control/pet_glyphs.h | 5 +++++ engines/titanic/pet_control/pet_inventory.cpp | 8 ++++++++ engines/titanic/pet_control/pet_inventory.h | 5 +++++ 4 files changed, 19 insertions(+) diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index a86a72f99d..b3291623c3 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -182,6 +182,7 @@ void CPetControl::enterNode(CNodeItem *node) { void CPetControl::enterRoom(CRoomItem *room) { _rooms.enterRoom(room); _remote.enterRoom(room); + _inventory.enterRoom(room); } void CPetControl::resetRemoteTarget() { diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 6229d17994..8f335f882b 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -475,6 +475,11 @@ public: */ bool isGlyphHighlighted(const CPetGlyph *glyph) const; + /** + * Returns the highlighted index, if any + */ + int getHighlightIndex() const { return _highlightIndex; } + /** * Get the top-left position of the currently highlighted glyph */ diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index b2f530c5fa..0f9f253cb0 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -71,6 +71,14 @@ void CPetInventory::changed(int changeType) { } } +void CPetInventory::enterRoom(CRoomItem *room) { + int index = _items.getHighlightIndex(); + if (index != -1) { + _items.resetHighlight(); + _items.highlight(index); + } +} + bool CPetInventory::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return _items.MouseButtonDownMsg(msg->_mousePos); } diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index dc85b31420..32f5eb4b12 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -85,6 +85,11 @@ public: */ virtual void changed(int changeType); + /** + * Called when a new room is entered + */ + virtual void enterRoom(CRoomItem *room); + /** * Following are handlers for the various messages that the PET can * pass onto the currently active section/area -- cgit v1.2.3