aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/pet_control
diff options
context:
space:
mode:
authorPaul Gilbert2017-07-28 20:24:09 -0400
committerPaul Gilbert2017-07-28 20:24:09 -0400
commit0b8af4163b3dcd7413f4fa9338fbff839ae56593 (patch)
treeeb660db3487ce09c2a96a992885ce2825d416b72 /engines/titanic/pet_control
parent83b46ee3ccc28f602049ed62ce89d119af1d17df (diff)
downloadscummvm-rg350-0b8af4163b3dcd7413f4fa9338fbff839ae56593.tar.gz
scummvm-rg350-0b8af4163b3dcd7413f4fa9338fbff839ae56593.tar.bz2
scummvm-rg350-0b8af4163b3dcd7413f4fa9338fbff839ae56593.zip
TITANIC: Show initial transform anim when Titania pieces added to inventory
Diffstat (limited to 'engines/titanic/pet_control')
-rw-r--r--engines/titanic/pet_control/pet_inventory.cpp27
-rw-r--r--engines/titanic/pet_control/pet_inventory.h7
-rw-r--r--engines/titanic/pet_control/pet_inventory_glyphs.cpp2
3 files changed, 21 insertions, 15 deletions
diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp
index 57a4e5eb1a..b2f530c5fa 100644
--- a/engines/titanic/pet_control/pet_inventory.cpp
+++ b/engines/titanic/pet_control/pet_inventory.cpp
@@ -30,7 +30,7 @@ namespace Titanic {
CPetInventory::CPetInventory() : CPetSection(),
_movie(nullptr), _isLoading(false), _titaniaBitFlags(0) {
for (int idx = 0; idx < TOTAL_ITEMS; ++idx) {
- _itemBackgrounds[idx] = _itemGlyphs[idx] = nullptr;
+ _itemBackgrounds[idx] = nullptr;
}
}
@@ -153,10 +153,6 @@ bool CPetInventory::setPetControl(CPetControl *petControl) {
CString name = "3Pet" + g_vm->_itemNames[idx];
_itemBackgrounds[idx] = petControl->getHiddenObject(name);
}
-
- if (!g_vm->_itemObjects[idx].empty()) {
- _itemGlyphs[idx] = petControl->getHiddenObject(g_vm->_itemObjects[idx]);
- }
}
tempRect = Rect(0, 0, 580, 15);
@@ -209,37 +205,48 @@ int CPetInventory::getItemIndex(CGameObject *item) const {
return index;
}
-CGameObject *CPetInventory::getFirstAnimation(int index) {
+CGameObject *CPetInventory::getTransformAnimation(int index) {
if (index >= 0 && index < 46) {
+ // Certain items are pieces of Titania, and they only have the
+ // one-time initial transformation into Titania pieces
+ CString name;
int bits = 0;
+
switch (index) {
case 20:
+ name = "PetEarMorph";
bits = 4;
break;
case 21:
+ name = "PetEarMorph1";
bits = 8;
break;
case 22:
+ name = "PetEyeMorph";
bits = 1;
break;
case 23:
+ name = "PetEyeMorph";
bits = 2;
break;
case 36:
+ name = "PetMouthMorph";
bits = 32;
break;
case 39:
+ name = "PetNoseMorph";
bits = 16;
break;
default:
break;
}
- // Only return/show the transformation for Titania's parts the
- // first time they're added to the inventory
- if (!(bits & _titaniaBitFlags)) {
+ if (!(bits & _titaniaBitFlags) && !name.empty()) {
+ CGameObject *obj = getPetControl()->getHiddenObject(name);
+ assert(obj);
+
_titaniaBitFlags = bits | _titaniaBitFlags;
- return _itemGlyphs[index];
+ return obj;
}
}
diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h
index 96fa51c532..dc85b31420 100644
--- a/engines/titanic/pet_control/pet_inventory.h
+++ b/engines/titanic/pet_control/pet_inventory.h
@@ -162,11 +162,10 @@ public:
void highlightItem(CGameObject *item);
/**
- * Gets the object, if any, containing the initial animation played for
- * an inventory item. For example, the animation when items transform
- * into pieces of Titania
+ * Gets the object, if any, containing the transformation animation played
+ * when pieces of Titania are added to the inventory for the first time.
*/
- CGameObject *getFirstAnimation(int index);
+ CGameObject *getTransformAnimation(int index);
/**
* Play the animated movie for an object
diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.cpp b/engines/titanic/pet_control/pet_inventory_glyphs.cpp
index 8d6528f347..9d0dd518b9 100644
--- a/engines/titanic/pet_control/pet_inventory_glyphs.cpp
+++ b/engines/titanic/pet_control/pet_inventory_glyphs.cpp
@@ -207,7 +207,7 @@ void CPetInventoryGlyph::setItem(CGameObject *item, bool isLoading) {
if (_owner && item) {
int idx = populateItem(item, isLoading);
_repeated = static_cast<CPetInventoryGlyphs *>(_owner)->getBackground(idx);
- _singular = static_cast<CPetInventory *>(getPetSection())->getFirstAnimation(idx);
+ _singular = static_cast<CPetInventory *>(getPetSection())->getTransformAnimation(idx);
}
}