diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/core/view_item.cpp | 53 | ||||
-rw-r--r-- | engines/titanic/game/computer_screen.cpp | 14 | ||||
-rw-r--r-- | engines/titanic/game/computer_screen.h | 1 | ||||
-rw-r--r-- | engines/titanic/messages/messages.h | 1 | ||||
-rw-r--r-- | engines/titanic/moves/move_player_in_parrot_room.cpp | 12 | ||||
-rw-r--r-- | engines/titanic/moves/move_player_in_parrot_room.h | 9 |
6 files changed, 54 insertions, 36 deletions
diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index 401553d55d..f98b015feb 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 be9c87a540..179063d1b0 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 8fb1dcd4dc..8affef3aed 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 b5c8dd4e21..115976a70d 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 186e448bba..dfe8cf547e 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 50a0b2a00e..637c8b8211 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 |