aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2016-04-16 23:16:30 -0400
committerPaul Gilbert2016-07-10 16:11:18 -0400
commitd971edf02ea8074b71be852fdcee48e095ff49a9 (patch)
tree79bc95e4864a5c014c92f8c559986cf84bf70101 /engines
parent066dd4f5cd1b0f5408cd0da5ef9050a738edc4b0 (diff)
downloadscummvm-rg350-d971edf02ea8074b71be852fdcee48e095ff49a9.tar.gz
scummvm-rg350-d971edf02ea8074b71be852fdcee48e095ff49a9.tar.bz2
scummvm-rg350-d971edf02ea8074b71be852fdcee48e095ff49a9.zip
TITANIC: Stubs for selecting highlighted PET glyph
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/pet_control/pet_control.cpp4
-rw-r--r--engines/titanic/pet_control/pet_glyphs.cpp10
-rw-r--r--engines/titanic/pet_control/pet_glyphs.h10
-rw-r--r--engines/titanic/pet_control/pet_inventory.cpp13
-rw-r--r--engines/titanic/pet_control/pet_inventory.h7
5 files changed, 36 insertions, 8 deletions
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp
index b9f1359746..25ab972df9 100644
--- a/engines/titanic/pet_control/pet_control.cpp
+++ b/engines/titanic/pet_control/pet_control.cpp
@@ -371,8 +371,8 @@ void CPetControl::addToInventory(CCarry *item) {
_inventory.itemsChanged();
setArea(PET_INVENTORY);
- if (_currentArea != PET_INVENTORY)
- _inventory.couldntShowInventory(item);
+ if (_currentArea == PET_INVENTORY)
+ _inventory.highlightItem(item);
makeDirty();
CPETGainedObjectMsg msg;
diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp
index 057025c03d..41ac4ae5e1 100644
--- a/engines/titanic/pet_control/pet_glyphs.cpp
+++ b/engines/titanic/pet_control/pet_glyphs.cpp
@@ -50,7 +50,7 @@ bool CPetGlyph::translateContains(const Point &delta, const Point &pt) {
/*------------------------------------------------------------------------*/
void CPetGlyphs::clear() {
- fn1(-1);
+ changeHighlight(-1);
destroyContents();
_field10 = 0;
}
@@ -75,8 +75,12 @@ void CPetGlyphs::draw(CScreenManager *screenManager) {
warning("TODO: CPetGlyphs::draw");
}
-void CPetGlyphs::fn1(int val) {
- warning("TODO: CPetGlyphs::fn1");
+void CPetGlyphs::changeHighlight(int index) {
+ warning("TODO: CPetGlyphs::changeHighlight");
+}
+
+void CPetGlyphs::highlight(int index) {
+ warning("TODO: CPetGlyphs::highlight");
}
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h
index 796b165e92..a34276661d 100644
--- a/engines/titanic/pet_control/pet_glyphs.h
+++ b/engines/titanic/pet_control/pet_glyphs.h
@@ -117,7 +117,10 @@ protected:
CPetGfxElement _scrollLeft;
CPetGfxElement _scrollRight;
protected:
- void fn1(int val);
+ /**
+ * Change the currently selected glyph
+ */
+ void changeHighlight(int index);
public:
CPetGlyphs::CPetGlyphs() : _field10(0), _field14(7),
_field18(-1), _field1C(-1), _field20(0), _field24(0) {
@@ -145,6 +148,11 @@ public:
* Draw the control
*/
void draw(CScreenManager *screenManager);
+
+ /**
+ * Highlight a specific glyph
+ */
+ void highlight(int index);
};
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp
index f143e24ecb..e765db60ea 100644
--- a/engines/titanic/pet_control/pet_inventory.cpp
+++ b/engines/titanic/pet_control/pet_inventory.cpp
@@ -133,8 +133,19 @@ void CPetInventory::itemsChanged() {
}
}
-void CPetInventory::couldntShowInventory(CCarry *item) {
+void CPetInventory::highlightItem(CGameObject *item) {
+ int itemIndex = getItemIndex(item);
+ _items.highlight(itemIndex);
+}
+
+int CPetInventory::getItemIndex(CGameObject *item) const {
+ int index = 0;
+ for (CGameObject *obj = _petControl->getFirstObject(); obj && obj != item;
+ ++index, obj = _petControl->getNextObject(obj)) {
+ }
+ return index;
}
+
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h
index 4a08c1c0b2..f228840857 100644
--- a/engines/titanic/pet_control/pet_inventory.h
+++ b/engines/titanic/pet_control/pet_inventory.h
@@ -48,6 +48,11 @@ private:
* Handles initial setup
*/
bool setPetControl(CPetControl *petControl);
+
+ /**
+ * Get the index of an item added to the PET
+ */
+ int getItemIndex(CGameObject *item) const;
public:
CPetInventory();
@@ -111,7 +116,7 @@ public:
/**
* Called when the inventory can't be shown after adding an item
*/
- void couldntShowInventory(CCarry *item);
+ void highlightItem(CGameObject *item);
};
} // End of namespace Titanic