[Scummvm-git-logs] scummvm master -> 3fa46888a81cee152aa064036e62081b403c2053

dreammaster dreammaster at scummvm.org
Sun Jan 15 22:22:24 CET 2017


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

Summary:
988e47d2d0 TITANIC: Show correct inventory glyphs & tooltip for multi-state items
3fa46888a8 TITANIC: Fixes for getting chicken and starling puret


Commit: 988e47d2d0ec0b803dbd20b7018b792952ac9b3a
    https://github.com/scummvm/scummvm/commit/988e47d2d0ec0b803dbd20b7018b792952ac9b3a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-01-15T16:21:46-05:00

Commit Message:
TITANIC: Show correct inventory glyphs & tooltip for multi-state items

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


diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.cpp b/engines/titanic/pet_control/pet_inventory_glyphs.cpp
index 734b260..d19ea60 100644
--- a/engines/titanic/pet_control/pet_inventory_glyphs.cpp
+++ b/engines/titanic/pet_control/pet_inventory_glyphs.cpp
@@ -222,9 +222,12 @@ int CPetInventoryGlyph::populateItem(CGameObject *item, bool isLoading) {
 	if (itemIndex == -1)
 		return -1;
 
+	// Some objects can be in multiple different states. These are handled 
+	// below to give each the correct inventory glyph and description
 	switch (ITEM_MODES[itemIndex]) {
 	case 0:
-		switch (subMode(item, isLoading)) {
+		// Maitre d'Bot's left arm
+		switch (getItemIndex(item, isLoading)) {
 		case 0:
 		case 1:
 			return 0;
@@ -236,7 +239,8 @@ int CPetInventoryGlyph::populateItem(CGameObject *item, bool isLoading) {
 		}
 
 	case 2:
-		switch (subMode(item, isLoading)) {
+		// Maitre d'Bot's right arm
+		switch (getItemIndex(item, isLoading)) {
 		case 0:
 			return 2;
 		default:
@@ -245,7 +249,8 @@ int CPetInventoryGlyph::populateItem(CGameObject *item, bool isLoading) {
 		break;
 
 	case 15:
-		switch (subMode(item, isLoading)) {
+		// Chicken
+		switch (getItemIndex(item, isLoading)) {
 		case 0:
 		case 1:
 			return 14;
@@ -263,7 +268,8 @@ int CPetInventoryGlyph::populateItem(CGameObject *item, bool isLoading) {
 		break;
 
 	case 26:
-		switch (subMode(item, isLoading)) {
+		// Beer glass
+		switch (getItemIndex(item, isLoading)) {
 		case 0:
 			return 26;
 		case 1:
@@ -284,14 +290,14 @@ int CPetInventoryGlyph::populateItem(CGameObject *item, bool isLoading) {
 	return ITEM_MODES[itemIndex];
 }
 
-int CPetInventoryGlyph::subMode(CGameObject *item, bool isLoading) {
+int CPetInventoryGlyph::getItemIndex(CGameObject *item, bool isLoading) {
 	int frameNum = item->getFrameNumber();
 	int movieFrame = item->getMovieFrame();
 
 	if (isLoading && frameNum != -1 && frameNum != movieFrame)
 		item->loadFrame(frameNum);
 
-	return frameNum;
+	return movieFrame;
 }
 
 void CPetInventoryGlyph::startBackgroundMovie() {
diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.h b/engines/titanic/pet_control/pet_inventory_glyphs.h
index e843cf5..cf1cfb3 100644
--- a/engines/titanic/pet_control/pet_inventory_glyphs.h
+++ b/engines/titanic/pet_control/pet_inventory_glyphs.h
@@ -36,7 +36,12 @@ private:
 	 */
 	int populateItem(CGameObject *item, bool isLoading);
 
-	int subMode(CGameObject *item, bool isLoading);
+	/**
+	 * For items which can have multiple different states, such as the
+	 * beer glass or Maitre D arms, returns the correct item index to use
+	 * for getting the inventory item glyph and description
+	 */
+	int getItemIndex(CGameObject *item, bool isLoading);
 
 	/**
 	 * Start any movie for the background


Commit: 3fa46888a81cee152aa064036e62081b403c2053
    https://github.com/scummvm/scummvm/commit/3fa46888a81cee152aa064036e62081b403c2053
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-01-15T16:22:15-05:00

Commit Message:
TITANIC: Fixes for getting chicken and starling puret

Changed paths:
    engines/titanic/carry/glass.cpp
    engines/titanic/core/game_object.cpp
    engines/titanic/game/sauce_dispensor.cpp
    engines/titanic/game/sauce_dispensor.h


diff --git a/engines/titanic/carry/glass.cpp b/engines/titanic/carry/glass.cpp
index d57c63d..6751d84 100644
--- a/engines/titanic/carry/glass.cpp
+++ b/engines/titanic/carry/glass.cpp
@@ -135,7 +135,7 @@ bool CGlass::MouseDragEndMsg(CMouseDragEndMsg *msg) {
 				CUseWithCharMsg useMsg(npc);
 				useMsg.execute(this);
 			} else {
-				CUseWithOtherMsg otherMsg(npc);
+				CUseWithOtherMsg otherMsg(msg->_dropTarget);
 				otherMsg.execute(this);
 			}
 		}
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 2b32796..bcdf77b 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -1511,6 +1511,8 @@ void CGameObject::petAddToCarryParcel(CGameObject *obj) {
 }
 
 void CGameObject::petAddToInventory() {
+	assert(dynamic_cast<CCarry *>(this));
+
 	CPetControl *pet = getPetControl();
 	if (pet) {
 		makeDirty();
diff --git a/engines/titanic/game/sauce_dispensor.cpp b/engines/titanic/game/sauce_dispensor.cpp
index e4cb055..b58de99 100644
--- a/engines/titanic/game/sauce_dispensor.cpp
+++ b/engines/titanic/game/sauce_dispensor.cpp
@@ -36,13 +36,13 @@ BEGIN_MESSAGE_MAP(CSauceDispensor, CBackground)
 END_MESSAGE_MAP()
 
 CSauceDispensor::CSauceDispensor() : CBackground(),
-		_fieldEC(0), _fieldF0(0), _field104(0), _field108(0) {
+		_pouringCondiment(false), _fieldF0(0), _field104(0), _field108(0) {
 }
 
 void CSauceDispensor::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
 	file->writeQuotedLine(_string3, indent);
-	file->writeNumberLine(_fieldEC, indent);
+	file->writeNumberLine(_pouringCondiment, indent);
 	file->writeNumberLine(_fieldF0, indent);
 	file->writePoint(_pos1, indent);
 	file->writePoint(_pos2, indent);
@@ -55,7 +55,7 @@ void CSauceDispensor::save(SimpleFile *file, int indent) {
 void CSauceDispensor::load(SimpleFile *file) {
 	file->readNumber();
 	_string3 = file->readString();
-	_fieldEC = file->readNumber();
+	_pouringCondiment = file->readNumber();
 	_fieldF0 = file->readNumber();
 	_pos1 = file->readPoint();
 	_pos2 = file->readPoint();
@@ -80,6 +80,7 @@ bool CSauceDispensor::Use(CUse *msg) {
 			} else {
 				setVisible(true);
 				if (chicken->_field12C) {
+					_pouringCondiment = true;
 					playMovie(_pos1.x, _pos1.y, MOVIE_NOTIFY_OBJECT);
 				} else {
 					CActMsg actMsg(_string3);
@@ -99,13 +100,14 @@ bool CSauceDispensor::Use(CUse *msg) {
 		petDisplayMessage(1, DISPENSOR_IS_EMPTY);
 	} else if (msg->_item->isEquals("BeerGlass")) {
 		CGlass *glass = dynamic_cast<CGlass *>(msg->_item);
+		assert(glass);
 		_field108 = true;
 
-		if (_field104 || _fieldF0) {
-			petAddToInventory();
+		if (_field104 != 1 || _fieldF0 != 1) {
+			glass->petAddToInventory();
 		} else if (glass->_condiment != "None") {
 			visibleMsg.execute("BeerGlass");
-		} else if (_fieldEC) {
+		} else if (_pouringCondiment) {
 			glass->setPosition(Point(
 				_bounds.left + (_bounds.width() / 2) - (glass->_bounds.width() / 2),
 				300));
@@ -121,7 +123,7 @@ bool CSauceDispensor::Use(CUse *msg) {
 
 bool CSauceDispensor::MovieEndMsg(CMovieEndMsg *msg) {
 	setVisible(false);
-	_fieldEC = false;
+	_pouringCondiment = false;
 
 	CActMsg actMsg("GoToPET");
 	if (_field104)
diff --git a/engines/titanic/game/sauce_dispensor.h b/engines/titanic/game/sauce_dispensor.h
index f8021f3..cdcd592 100644
--- a/engines/titanic/game/sauce_dispensor.h
+++ b/engines/titanic/game/sauce_dispensor.h
@@ -37,7 +37,7 @@ class CSauceDispensor : public CBackground {
 	bool StatusChangeMsg(CStatusChangeMsg *msg);
 public:
 	CString _string3;
-	int _fieldEC;
+	bool _pouringCondiment;
 	int _fieldF0;
 	Point _pos1;
 	Point _pos2;





More information about the Scummvm-git-logs mailing list