[Scummvm-git-logs] scummvm master -> d8418f8c10156704a2fae42f9e50386b8f67b501

dreammaster dreammaster at scummvm.org
Sun Feb 19 05:00:08 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:
66f3458a2b TITANIC: Renamings for CCarry class
d8418f8c10 TITANIC: Workaround for using magazine on incorrect objects


Commit: 66f3458a2be4a9a490b406a4e9a100be43849725
    https://github.com/scummvm/scummvm/commit/66f3458a2be4a9a490b406a4e9a100be43849725
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-02-18T22:56:00-05:00

Commit Message:
TITANIC: Renamings for CCarry class

Changed paths:
    engines/titanic/carry/arm.cpp
    engines/titanic/carry/carry.cpp
    engines/titanic/carry/carry.h
    engines/titanic/game/cdrom.cpp
    engines/titanic/game/cdrom.h
    engines/titanic/npcs/bellbot.cpp


diff --git a/engines/titanic/carry/arm.cpp b/engines/titanic/carry/arm.cpp
index c026bd0..129704c 100644
--- a/engines/titanic/carry/arm.cpp
+++ b/engines/titanic/carry/arm.cpp
@@ -130,8 +130,8 @@ bool CArm::MouseDragStartMsg(CMouseDragStartMsg *msg) {
 		textMsg.execute("PET");
 	} else if (checkStartDragging(msg)) {
 		hideMouse();
-		_tempPos = msg->_mousePos - _bounds;
-		setPosition(msg->_mousePos - _tempPos);
+		_centroid = msg->_mousePos - _bounds;
+		setPosition(msg->_mousePos - _centroid);
 
 		if (!_hookedTarget.empty()) {
 			CActMsg actMsg("Unhook");
@@ -189,7 +189,7 @@ bool CArm::PETGainedObjectMsg(CPETGainedObjectMsg *msg) {
 }
 
 bool CArm::MouseDragMoveMsg(CMouseDragMoveMsg *msg) {
-	setPosition(msg->_mousePos - _tempPos);
+	setPosition(msg->_mousePos - _centroid);
 
 	if (_heldItemName == "None" && compareViewNameTo("FrozenArboretum.Node 5.S")) {
 		loadFrame(_armRect.contains(msg->_mousePos) ?
diff --git a/engines/titanic/carry/carry.cpp b/engines/titanic/carry/carry.cpp
index f6403b1..fd5b593 100644
--- a/engines/titanic/carry/carry.cpp
+++ b/engines/titanic/carry/carry.cpp
@@ -44,30 +44,29 @@ BEGIN_MESSAGE_MAP(CCarry, CGameObject)
 	ON_MESSAGE(PassOnDragStartMsg)
 END_MESSAGE_MAP()
 
-CCarry::CCarry() : CGameObject(), _fieldDC(0), _canTake(true),
-		_field100(0), _field104(0), _field108(0), _field10C(0),
-		_itemFrame(0), _enterFrame(0), _enterFrameSet(false), _visibleFrame(0),
-	_string1("None"),
-	_fullViewName("NULL"),
-	_string3(g_vm->_strings[DOESNT_DO_ANYTHING]),
-	_string4(g_vm->_strings[DOESNT_WANT_THIS]) {
+CCarry::CCarry() : CGameObject(), _unused5(0), _canTake(true),
+		_unusedR(0), _unusedG(0), _unusedB(0), _itemFrame(0),
+		_enterFrame(0), _enterFrameSet(false), _visibleFrame(0),
+		_npcUse("None"), _fullViewName("NULL"),
+		_doesNothingMsg(g_vm->_strings[DOESNT_DO_ANYTHING]),
+		_doesntWantMsg(g_vm->_strings[DOESNT_WANT_THIS]) {
 }
 
 void CCarry::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writeQuotedLine(_string1, indent);
+	file->writeQuotedLine(_npcUse, indent);
 	file->writePoint(_origPos, indent);
 	file->writeQuotedLine(_fullViewName, indent);
-	file->writeNumberLine(_fieldDC, indent);
+	file->writeNumberLine(_unused5, indent);
 	file->writeNumberLine(_canTake, indent);
-	file->writeQuotedLine(_string3, indent);
-	file->writeQuotedLine(_string4, indent);
-	file->writePoint(_tempPos, indent);
-	file->writeNumberLine(_field104, indent);
-	file->writeNumberLine(_field108, indent);
-	file->writeNumberLine(_field10C, indent);
+	file->writeQuotedLine(_doesNothingMsg, indent);
+	file->writeQuotedLine(_doesntWantMsg, indent);
+	file->writePoint(_centroid, indent);
+	file->writeNumberLine(_unusedR, indent);
+	file->writeNumberLine(_unusedG, indent);
+	file->writeNumberLine(_unusedB, indent);
 	file->writeNumberLine(_itemFrame, indent);
-	file->writeQuotedLine(_string5, indent);
+	file->writeQuotedLine(_unused6, indent);
 	file->writeNumberLine(_enterFrame, indent);
 	file->writeNumberLine(_enterFrameSet, indent);
 	file->writeNumberLine(_visibleFrame, indent);
@@ -77,19 +76,19 @@ void CCarry::save(SimpleFile *file, int indent) {
 
 void CCarry::load(SimpleFile *file) {
 	file->readNumber();
-	_string1 = file->readString();
+	_npcUse = file->readString();
 	_origPos = file->readPoint();
 	_fullViewName = file->readString();
-	_fieldDC = file->readNumber();
+	_unused5 = file->readNumber();
 	_canTake = file->readNumber();
-	_string3 = file->readString();
-	_string4 = file->readString();
-	_tempPos = file->readPoint();
-	_field104 = file->readNumber();
-	_field108 = file->readNumber();
-	_field10C = file->readNumber();
+	_doesNothingMsg = file->readString();
+	_doesntWantMsg = file->readString();
+	_centroid = file->readPoint();
+	_unusedR = file->readNumber();
+	_unusedG = file->readNumber();
+	_unusedB = file->readNumber();
 	_itemFrame = file->readNumber();
-	_string5 = file->readString();
+	_unused6 = file->readString();
 	_enterFrame = file->readNumber();
 	_enterFrameSet = file->readNumber();
 	_visibleFrame = file->readNumber();
@@ -118,7 +117,7 @@ bool CCarry::MouseDragStartMsg(CMouseDragStartMsg *msg) {
 }
 
 bool CCarry::MouseDragMoveMsg(CMouseDragMoveMsg *msg) {
-	setPosition(msg->_mousePos - _tempPos);
+	setPosition(msg->_mousePos - _centroid);
 	return true;
 }
 
@@ -167,7 +166,7 @@ bool CCarry::UseWithCharMsg(CUseWithCharMsg *msg) {
 		carryMsg._item = this;
 		carryMsg.execute(succubus);
 	} else {
-		CShowTextMsg textMsg(_string4);
+		CShowTextMsg textMsg(_doesntWantMsg);
 		textMsg.execute("PET");
 		petAddToInventory();
 	}
@@ -180,7 +179,7 @@ bool CCarry::LeaveViewMsg(CLeaveViewMsg *msg) {
 }
 
 bool CCarry::UseWithOtherMsg(CUseWithOtherMsg *msg) {
-	CShowTextMsg textMsg(_string3);
+	CShowTextMsg textMsg(_doesNothingMsg);
 	textMsg.execute("PET");
 
 	if (!compareViewNameTo(_fullViewName) || _bounds.top >= 360) {
@@ -233,13 +232,13 @@ bool CCarry::PassOnDragStartMsg(CPassOnDragStartMsg *msg) {
 		loadFrame(_visibleFrame);
 
 	if (msg->_value3) {
-		_tempPos.x = _bounds.width() / 2;
-		_tempPos.y = _bounds.height() / 2;
+		_centroid.x = _bounds.width() / 2;
+		_centroid.y = _bounds.height() / 2;
 	} else {
-		_tempPos = msg->_mousePos - _bounds;
+		_centroid = msg->_mousePos - _bounds;
 	}
 
-	setPosition(getMousePos() - _tempPos);
+	setPosition(getMousePos() - _centroid);
 	return true;
 }
 
diff --git a/engines/titanic/carry/carry.h b/engines/titanic/carry/carry.h
index cb53df4..edfc8a7 100644
--- a/engines/titanic/carry/carry.h
+++ b/engines/titanic/carry/carry.h
@@ -44,21 +44,18 @@ class CCarry : public CGameObject {
 	bool EnterViewMsg(CEnterViewMsg *msg);
 	bool PassOnDragStartMsg(CPassOnDragStartMsg *msg);
 protected:
-	int _fieldDC;
-	CString _string3;
-	CString _string4;
-	Point _tempPos;
-	int _field100;
-	int _field104;
-	int _field108;
-	int _field10C;
+	int _unused5;
+	CString _doesNothingMsg;
+	CString _doesntWantMsg;
+	Point _centroid;
+	int _unusedR, _unusedG, _unusedB;
 	int _itemFrame;
-	CString _string5;
+	CString _unused6;
 	int _enterFrame;
 	bool _enterFrameSet;
 	int _visibleFrame;
 public:
-	CString _string1;
+	CString _npcUse;
 	bool _canTake;
 	Point _origPos;
 	CString _fullViewName;
diff --git a/engines/titanic/game/cdrom.cpp b/engines/titanic/game/cdrom.cpp
index 0d1cd3a..d8d31ec 100644
--- a/engines/titanic/game/cdrom.cpp
+++ b/engines/titanic/game/cdrom.cpp
@@ -38,21 +38,21 @@ CCDROM::CCDROM() : CGameObject() {
 
 void CCDROM::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writePoint(_tempPos, indent);
+	file->writePoint(_centroid, indent);
 	CGameObject::save(file, indent);
 }
 
 void CCDROM::load(SimpleFile *file) {
 	file->readNumber();
-	_tempPos = file->readPoint();
+	_centroid = file->readPoint();
 	CGameObject::load(file);
 }
 
 bool CCDROM::MouseDragStartMsg(CMouseDragStartMsg *msg) {
 	if (checkStartDragging(msg)) {
 		hideMouse();
-		_tempPos = msg->_mousePos - _bounds;
-		setPosition(msg->_mousePos - _tempPos);
+		_centroid = msg->_mousePos - _bounds;
+		setPosition(msg->_mousePos - _centroid);
 		return true;
 	} else {
 		return false;
@@ -77,7 +77,7 @@ bool CCDROM::MouseDragEndMsg(CMouseDragEndMsg *msg) {
 }
 
 bool CCDROM::MouseDragMoveMsg(CMouseDragMoveMsg *msg) {
-	setPosition(msg->_mousePos - _tempPos);
+	setPosition(msg->_mousePos - _centroid);
 	return true;
 }
 
diff --git a/engines/titanic/game/cdrom.h b/engines/titanic/game/cdrom.h
index 0179148..12175f6 100644
--- a/engines/titanic/game/cdrom.h
+++ b/engines/titanic/game/cdrom.h
@@ -36,7 +36,7 @@ class CCDROM : public CGameObject {
 	bool MouseDragMoveMsg(CMouseDragMoveMsg *msg);
 	bool ActMsg(CActMsg *msg);
 private:
-	Point _tempPos;
+	Point _centroid;
 public:
 	CLASSDEF;
 	CCDROM();
diff --git a/engines/titanic/npcs/bellbot.cpp b/engines/titanic/npcs/bellbot.cpp
index 3781120..36c57fe 100644
--- a/engines/titanic/npcs/bellbot.cpp
+++ b/engines/titanic/npcs/bellbot.cpp
@@ -135,7 +135,7 @@ bool CBellBot::MovieEndMsg(CMovieEndMsg *msg) {
 }
 
 bool CBellBot::Use(CUse *msg) {
-	dynamic_cast<CCarry *>(msg->_item)->_string1 = "Bellbot";
+	dynamic_cast<CCarry *>(msg->_item)->_npcUse = "Bellbot";
 	return true;
 }
 


Commit: d8418f8c10156704a2fae42f9e50386b8f67b501
    https://github.com/scummvm/scummvm/commit/d8418f8c10156704a2fae42f9e50386b8f67b501
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-02-18T23:00:02-05:00

Commit Message:
TITANIC: Workaround for using magazine on incorrect objects

Changed paths:
    engines/titanic/carry/magazine.cpp


diff --git a/engines/titanic/carry/magazine.cpp b/engines/titanic/carry/magazine.cpp
index e68c63f..94e853b 100644
--- a/engines/titanic/carry/magazine.cpp
+++ b/engines/titanic/carry/magazine.cpp
@@ -52,19 +52,18 @@ void CMagazine::load(SimpleFile *file) {
 }
 
 bool CMagazine::UseWithCharMsg(CUseWithCharMsg *msg) {
+	// WORKAROUND: Slight difference to original to ensure that when the
+	// magazine is used on an incorrect char, it's returned to inventory
 	CDeskbot *deskbot = dynamic_cast<CDeskbot *>(msg->_character);
-	if (deskbot) {
-		if (deskbot->_deskbotActive) {
-			setVisible(false);
-			setPosition(Point(1000, 1000));
-			CActMsg actMsg("2ndClassUpgrade");
-			actMsg.execute("Deskbot");
-		}
-
+	if (deskbot && deskbot->_deskbotActive) {
+		setVisible(false);
+		setPosition(Point(1000, 1000));
+		CActMsg actMsg("2ndClassUpgrade");
+		actMsg.execute("Deskbot");
 		return true;
-	} else {
-		return CCarry::UseWithCharMsg(msg);
 	}
+
+	return CCarry::UseWithCharMsg(msg);
 }
 
 bool CMagazine::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) {
@@ -77,17 +76,20 @@ bool CMagazine::VisibleMsg(CVisibleMsg *msg) {
 }
 
 bool CMagazine::UseWithOtherMsg(CUseWithOtherMsg *msg) {
+	// WORKAROUND: Slight difference to original to ensure that when the
+	// magazine is used on an incorrect object, it's returned to inventory
 	if (msg->_other->getName() == "SwitchOnDeskbot") {
-		// TODO: other _field108 if
-		if (false) {
+		CDeskbot *deskbot = dynamic_cast<CDeskbot *>(msg->_other);
+		if (deskbot && deskbot->_deskbotActive) {
 			setVisible(false);
 			setPosition(Point(1000, 1000));
 			CActMsg actMsg("2ndClassUpgrade");
 			actMsg.execute("Deskbot");
+			return true;
 		}
 	}
 
-	return true;
+	return CCarry::UseWithOtherMsg(msg);
 }
 
 } // End of namespace Titanic





More information about the Scummvm-git-logs mailing list