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

dreammaster dreammaster at scummvm.org
Sun Aug 6 23:45:35 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:
c55e83e776 TITANIC: Remove development link left in computer screen view


Commit: c55e83e7761e93aac124121de0e6e45b20269e02
    https://github.com/scummvm/scummvm/commit/c55e83e7761e93aac124121de0e6e45b20269e02
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-08-06T17:45:27-04:00

Commit Message:
TITANIC: Remove development link left in computer screen view

Changed paths:
    engines/titanic/core/view_item.cpp
    engines/titanic/game/computer_screen.cpp
    engines/titanic/game/computer_screen.h
    engines/titanic/messages/messages.h
    engines/titanic/moves/move_player_in_parrot_room.cpp
    engines/titanic/moves/move_player_in_parrot_room.h


diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp
index 401553d..f98b015 100644
--- a/engines/titanic/core/view_item.cpp
+++ b/engines/titanic/core/view_item.cpp
@@ -340,6 +340,7 @@ CString CViewItem::getNodeViewName() const {
 
 bool CViewItem::MovementMsg(CMovementMsg *msg) {
 	Point pt;
+	bool foundPt = false;
 
 	// First allow any child objects to handle it
 	for (CTreeItem *treeItem = getFirstChild(); treeItem;
@@ -348,31 +349,41 @@ bool CViewItem::MovementMsg(CMovementMsg *msg) {
 			return true;
 	}
 
-	// Iterate through the view's contents to find a link or item
-	// with the appropriate movement action
-	for (CTreeItem *treeItem = getFirstChild(); treeItem;
-			treeItem = treeItem->scan(this)) {
-		CLinkItem *link = dynamic_cast<CLinkItem *>(treeItem);
-		CGameObject *gameObj = dynamic_cast<CGameObject *>(treeItem);
-
-		if (link) {
-			// Skip links that aren't for the desired direction
-			if (link->getMovement() != msg->_movement)
-				continue;
-
-			pt = Point((link->_bounds.left + link->_bounds.right) / 2,
-				(link->_bounds.top + link->_bounds.bottom) / 2);
-		} else if (gameObj) {
-			if (!gameObj->_visible || gameObj->getMovement() != msg->_movement)
+	if (msg->_posToUse.x != 0 || msg->_posToUse.y != 0) {
+		pt = msg->_posToUse;
+		foundPt = true;
+	} else {
+		// Iterate through the view's contents to find a link or item
+		// with the appropriate movement action
+		for (CTreeItem *treeItem = getFirstChild(); treeItem;
+				treeItem = treeItem->scan(this)) {
+			CLinkItem *link = dynamic_cast<CLinkItem *>(treeItem);
+			CGameObject *gameObj = dynamic_cast<CGameObject *>(treeItem);
+
+			if (link) {
+				// Skip links that aren't for the desired direction
+				if (link->getMovement() != msg->_movement)
+					continue;
+
+				pt = Point((link->_bounds.left + link->_bounds.right) / 2,
+					(link->_bounds.top + link->_bounds.bottom) / 2);
+			} else if (gameObj) {
+				if (!gameObj->_visible || gameObj->getMovement() != msg->_movement)
+					continue;
+
+				if (!gameObj->findPoint(pt))
+					continue;
+			} else {
+				// Not a link or object, so ignore
 				continue;
+			}
 
-			if (!gameObj->findPoint(pt))
-				continue;
-		} else {
-			// Not a link or object, so ignore
-			continue;
+			foundPt = true;
+			break;
 		}
+	}
 
+	if (foundPt) {
 		// We've found a point on the object or link that has a
 		// cursor for the given direction. So simulate a mouse
 		// press and release on the desired point
diff --git a/engines/titanic/game/computer_screen.cpp b/engines/titanic/game/computer_screen.cpp
index be9c87a..179063d 100644
--- a/engines/titanic/game/computer_screen.cpp
+++ b/engines/titanic/game/computer_screen.cpp
@@ -31,6 +31,7 @@ BEGIN_MESSAGE_MAP(CComputerScreen, CGameObject)
 	ON_MESSAGE(MovieEndMsg)
 	ON_MESSAGE(EnterViewMsg)
 	ON_MESSAGE(TimerMsg)
+	ON_MESSAGE(MovementMsg)
 END_MESSAGE_MAP()
 
 CComputerScreen::CComputerScreen() : CGameObject() {
@@ -68,9 +69,22 @@ bool CComputerScreen::MovieEndMsg(CMovieEndMsg *msg) {
 
 bool CComputerScreen::EnterViewMsg(CEnterViewMsg *msg) {
 	loadFrame(26);
+
+	// WORKAROUND: The original game leaves in a debug link that
+	// allows skipping of Doorbot arrival sequence. Disable it
+	static_cast<CLinkItem *>(getParent()->findByName("_TRACK,3,e-cu,4,E"))->_bounds.clear();
+
 	return true;
 }
 
+bool CComputerScreen::MovementMsg(CMovementMsg *msg) {
+	if (msg->_movement != MOVE_BACKWARDS)
+		return true;
+
+	msg->_posToUse = Common::Point(320, 50);
+	return false;
+}
+
 bool CComputerScreen::TimerMsg(CTimerMsg *msg) {
 	int handle;
 
diff --git a/engines/titanic/game/computer_screen.h b/engines/titanic/game/computer_screen.h
index 8fb1dcd..8affef3 100644
--- a/engines/titanic/game/computer_screen.h
+++ b/engines/titanic/game/computer_screen.h
@@ -33,6 +33,7 @@ class CComputerScreen : public CGameObject {
 	bool MovieEndMsg(CMovieEndMsg *msg);
 	bool EnterViewMsg(CEnterViewMsg *msg);
 	bool TimerMsg(CTimerMsg *msg);
+	bool MovementMsg(CMovementMsg *msg);
 public:
 	CLASSDEF;
 	CComputerScreen();
diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h
index b5c8dd4..115976a 100644
--- a/engines/titanic/messages/messages.h
+++ b/engines/titanic/messages/messages.h
@@ -230,6 +230,7 @@ enum Movement {
 class CMovementMsg : public CMessage {
 public:
 	Movement _movement;
+	Point _posToUse;
 public:
 	CLASSDEF;
 	CMovementMsg() : _movement(MOVE_NONE) {}
diff --git a/engines/titanic/moves/move_player_in_parrot_room.cpp b/engines/titanic/moves/move_player_in_parrot_room.cpp
index 186e448..dfe8cf5 100644
--- a/engines/titanic/moves/move_player_in_parrot_room.cpp
+++ b/engines/titanic/moves/move_player_in_parrot_room.cpp
@@ -27,6 +27,7 @@ namespace Titanic {
 BEGIN_MESSAGE_MAP(CMovePlayerInParrotRoom, CMovePlayerTo)
 	ON_MESSAGE(ActMsg)
 	ON_MESSAGE(MouseButtonDownMsg)
+	ON_MESSAGE(MovementMsg)
 END_MESSAGE_MAP()
 
 CMovePlayerInParrotRoom::CMovePlayerInParrotRoom() : CMovePlayerTo() {
@@ -58,13 +59,10 @@ bool CMovePlayerInParrotRoom::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
 	return true;
 }
 
-bool CMovePlayerInParrotRoom::findPoint(Point &pt) {
-	if (_destination == "ParrotLobby.Node 1.E") {
-		pt = Point(600, 180);
-		return true;
-	} else {
-		return CMovePlayerTo::findPoint(pt);
-	}
+bool CMovePlayerInParrotRoom::MovementMsg(CMovementMsg *msg) {
+	if (msg->_movement == TURN_RIGHT)
+		msg->_posToUse = Point(600, 180);
+	return false;
 }
 
 } // End of namespace Titanic
diff --git a/engines/titanic/moves/move_player_in_parrot_room.h b/engines/titanic/moves/move_player_in_parrot_room.h
index 50a0b2a..637c8b8 100644
--- a/engines/titanic/moves/move_player_in_parrot_room.h
+++ b/engines/titanic/moves/move_player_in_parrot_room.h
@@ -31,6 +31,7 @@ class CMovePlayerInParrotRoom : public CMovePlayerTo {
 	DECLARE_MESSAGE_MAP;
 	bool ActMsg(CActMsg *msg);
 	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+	bool MovementMsg(CMovementMsg *msg);
 public:
 	CLASSDEF;
 	CMovePlayerInParrotRoom();
@@ -44,14 +45,6 @@ public:
 	 * Load the data for the class from file
 	 */
 	virtual void load(SimpleFile *file);
-
-	/**
-	 * Returns a point that falls within the object. Used for simulating
-	 * mouse clicks for movement when arrow keys are pressed
-	 * @param pt	Return point
-	 * @returns		True if a point was found
-	 */
-	virtual bool findPoint(Point &pt);
 };
 
 } // End of namespace Titanic





More information about the Scummvm-git-logs mailing list