Skip to content

Commit

Permalink
TITANIC: Don't allow movement link to be used in Starfield Puzlze
Browse files Browse the repository at this point in the history
The scene has an unused right turn link that wasn't used, and is
covered by the starview. Since movement now uses simulated mouse
clicks, the worst result of clicking right arrow is simply that
a star may be accidentally selected. But for cleanliness, it was
best to fix it. It also allowed the creation of code that other
objects in the view can use to override default movement logic,
just in case it's needed.
  • Loading branch information
dreammaster committed Aug 6, 2017
1 parent 5a4840e commit 89457af
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
10 changes: 9 additions & 1 deletion engines/titanic/core/view_item.cpp
Expand Up @@ -341,7 +341,15 @@ CString CViewItem::getNodeViewName() const {
bool CViewItem::MovementMsg(CMovementMsg *msg) {
Point pt;

// Iterate through the links to find an appropriate link
// First allow any child objects to handle it
for (CTreeItem *treeItem = getFirstChild(); treeItem;
treeItem = treeItem->scan(this)) {
if (msg->execute(treeItem, nullptr, 0))
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);
Expand Down
8 changes: 8 additions & 0 deletions engines/titanic/star_control/star_control.cpp
Expand Up @@ -39,6 +39,7 @@ BEGIN_MESSAGE_MAP(CStarControl, CGameObject)
ON_MESSAGE(MouseButtonDownMsg)
ON_MESSAGE(KeyCharMsg)
ON_MESSAGE(FrameMsg)
ON_MESSAGE(MovementMsg)
END_MESSAGE_MAP()

CStarControl::CStarControl() : _enabled(false), _petControl(nullptr),
Expand Down Expand Up @@ -276,4 +277,11 @@ void CStarControl::starDestinationSet() {
_view.starDestinationSet();
}

bool CStarControl::MovementMsg(CMovementMsg *msg) {
// The star control view has an unused turn right link hidden
// under the star view. For cleanliness, explicitly consume any
// movements in the star view so the link is never used
return true;
}

} // End of namespace Titanic
1 change: 1 addition & 0 deletions engines/titanic/star_control/star_control.h
Expand Up @@ -36,6 +36,7 @@ class CStarControl : public CGameObject {
bool MouseMoveMsg(CMouseMoveMsg *msg);
bool KeyCharMsg(CKeyCharMsg *msg);
bool FrameMsg(CFrameMsg *msg);
bool MovementMsg(CMovementMsg *msg);
private:
bool _enabled;
CStarField _starField;
Expand Down

0 comments on commit 89457af

Please sign in to comment.