aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2017-09-08 21:11:22 -0400
committerPaul Gilbert2017-09-08 21:11:22 -0400
commit7a1b35212bf44736104dc202d1f23e71bfdc4cc6 (patch)
tree5a917fc72d21832518da23e1297d47329e423327
parent13908dd6c2d589e1e31487e035480860e8994916 (diff)
downloadscummvm-rg350-7a1b35212bf44736104dc202d1f23e71bfdc4cc6.tar.gz
scummvm-rg350-7a1b35212bf44736104dc202d1f23e71bfdc4cc6.tar.bz2
scummvm-rg350-7a1b35212bf44736104dc202d1f23e71bfdc4cc6.zip
TITANIC: Keep highlighted inventory items animating when changing room
-rw-r--r--engines/titanic/pet_control/pet_control.cpp1
-rw-r--r--engines/titanic/pet_control/pet_glyphs.h5
-rw-r--r--engines/titanic/pet_control/pet_inventory.cpp8
-rw-r--r--engines/titanic/pet_control/pet_inventory.h5
4 files changed, 19 insertions, 0 deletions
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
@@ -476,6 +476,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
*/
Point getHighlightedGlyphPos() const;
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
@@ -86,6 +86,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
*/