[Scummvm-git-logs] scummvm master -> 0b8af4163b3dcd7413f4fa9338fbff839ae56593

dreammaster dreammaster at scummvm.org
Sat Jul 29 02:24:16 CEST 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
0b8af4163b TITANIC: Show initial transform anim when Titania pieces added to inventory


Commit: 0b8af4163b3dcd7413f4fa9338fbff839ae56593
    https://github.com/scummvm/scummvm/commit/0b8af4163b3dcd7413f4fa9338fbff839ae56593
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-07-28T20:24:09-04:00

Commit Message:
TITANIC: Show initial transform anim when Titania pieces added to inventory

Changed paths:
    engines/titanic/pet_control/pet_inventory.cpp
    engines/titanic/pet_control/pet_inventory.h
    engines/titanic/pet_control/pet_inventory_glyphs.cpp
    engines/titanic/titanic.h


diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp
index 57a4e5e..b2f530c 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 96fa51c..dc85b31 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 8d6528f..9d0dd51 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);
 	}
 }
 
diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h
index 015c692..dc7fd15 100644
--- a/engines/titanic/titanic.h
+++ b/engines/titanic/titanic.h
@@ -121,7 +121,6 @@ public:
 	CExeResources _exeResources;
 	StringArray _itemNames;
 	StringArray _itemDescriptions;
-	CString _itemObjects[TOTAL_ITEMS];
 	StringArray _itemIds;
 	StringArray _roomNames;
 	Strings _strings;





More information about the Scummvm-git-logs mailing list