[Scummvm-cvs-logs] scummvm master -> 1f0b9cb68d02d956ec745bef16f0dbddaa743bec

dreammaster dreammaster at scummvm.org
Fri Aug 26 02:46:38 CEST 2016


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:
db179c11bb TITANIC: Implemented CStringParser class
1f0b9cb68d TITANIC: Implemented more game classes


Commit: db179c11bb7d8f82183e39e2778491ead55d875e
    https://github.com/scummvm/scummvm/commit/db179c11bb7d8f82183e39e2778491ead55d875e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-25T20:46:01-04:00

Commit Message:
TITANIC: Implemented CStringParser class

Changed paths:
  A engines/titanic/support/string_parser.cpp
  A engines/titanic/support/string_parser.h
    engines/titanic/module.mk



diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index a3afc7e..65e7367 100644
--- a/engines/titanic/module.mk
+++ b/engines/titanic/module.mk
@@ -468,6 +468,7 @@ MODULE_OBJS := \
 	support/screen_manager.o \
 	support/simple_file.o \
 	support/string.o \
+	support/string_parser.o \
 	support/text_cursor.o \
 	support/time_event_info.o \
 	support/video_surface.o \
diff --git a/engines/titanic/support/string_parser.cpp b/engines/titanic/support/string_parser.cpp
new file mode 100644
index 0000000..496440a
--- /dev/null
+++ b/engines/titanic/support/string_parser.cpp
@@ -0,0 +1,97 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "titanic/support/string_parser.h"
+#include "common/util.h"
+
+namespace Titanic {
+
+void CStringParser::skipSeperators(const CString &seperatorChars) {
+	for (; _index < size(); ++_index) {
+		char c = (*this)[_index];
+		if (seperatorChars.indexOf(c) == -1)
+			break;
+	}
+}
+
+bool CStringParser::parse(CString &resultStr, const CString &seperatorChars, bool allowQuotes) {
+	if (_index >= size())
+		return false;
+
+	resultStr.clear();
+	bool quoteFlag = false;
+	while (_index < size()) {
+		char c = (*this)[_index];
+		if (!quoteFlag && seperatorChars.indexOf(c) >= 0)
+			break;
+
+		if (allowQuotes) {
+			if (quoteFlag) {
+				if (c == '"') {
+					// End of quoted string
+					++_index;
+					break;
+				}
+			} else {
+				if (c == '"') {
+					// Start of quoted string
+					++_index;
+					quoteFlag = true;
+					continue;
+				}
+			}
+		}
+
+		resultStr += c;
+		++_index;
+	}
+
+	return true;
+}
+
+uint CStringParser::readInt() {
+	// Get digits from the string
+	CString numStr;
+	while (Common::isDigit(currentChar()))
+		numStr += getNextChar();
+
+	// Throw a wobbly if there wasn't a number
+	if (numStr.empty())
+		error("ReadInt(): No number to read");
+
+	return atoi(numStr.c_str());
+}
+
+char CStringParser::currentChar() const {
+	return (_index >= size()) ? '\0' : (*this)[_index];
+}
+
+char CStringParser::getNextChar() {
+	return (_index >= size()) ? '\0' : (*this)[_index++];
+}
+
+void CStringParser::skipSpaces() {
+	while (_index < size() && Common::isSpace(currentChar()))
+		++_index;
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/support/string_parser.h b/engines/titanic/support/string_parser.h
new file mode 100644
index 0000000..f89caac
--- /dev/null
+++ b/engines/titanic/support/string_parser.h
@@ -0,0 +1,76 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TITANIC_STRING_PARSER_H
+#define TITANIC_STRING_PARSER_H
+
+#include "titanic/support/string.h"
+
+namespace Titanic {
+
+class CStringParser : public CString {
+private:
+	uint _index;
+private:
+	/**
+	 * Gets the character at the current index
+	 */
+	char currentChar() const;
+
+	/**
+	 * Gets the next character, and increments the parsing index
+	 */
+	char getNextChar();
+
+	/**
+	 * Skips over any spaces
+	 */
+	void skipSpaces();
+public:
+	CStringParser() : CString(), _index(0) {}
+	CStringParser(const CString &str) : CString(str), _index(0) {}
+
+	/**
+	 * Skips over any specified seperator characters in our string
+	 * at the current index
+	 */
+	void skipSeperators(const CString &seperatorChars);
+
+	/**
+	 * Parses out a string from a source string at the current index
+	 * @param resultStr			String to hold the resulting sring
+	 * @param seperatorChras	List of characters that seperate string values
+	 * @param allowQuotes		If true, handles double-quoted substrings
+	 * @returns		True if a string entry was extracted
+	 */
+	bool parse(CString &resultStr, const CString &seperatorChars, bool allowQuotes = false);
+
+	/**
+	 * Reads an integer from the string
+	 */
+	uint readInt();
+
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_STRING_PARSER_H */


Commit: 1f0b9cb68d02d956ec745bef16f0dbddaa743bec
    https://github.com/scummvm/scummvm/commit/1f0b9cb68d02d956ec745bef16f0dbddaa743bec
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-25T20:46:33-04:00

Commit Message:
TITANIC: Implemented more game classes

Changed paths:
    engines/titanic/carry/mouth.cpp
    engines/titanic/carry/mouth.h
    engines/titanic/core/multi_drop_target.cpp
    engines/titanic/core/multi_drop_target.h
    engines/titanic/game/missiveomat_button.cpp
    engines/titanic/game/missiveomat_button.h
    engines/titanic/game/movie_tester.cpp
    engines/titanic/game/movie_tester.h
    engines/titanic/gfx/move_object_button.cpp
    engines/titanic/gfx/move_object_button.h
    engines/titanic/moves/move_player_in_parrot_room.cpp
    engines/titanic/moves/move_player_in_parrot_room.h
    engines/titanic/moves/move_player_to.cpp
    engines/titanic/moves/move_player_to.h
    engines/titanic/moves/move_player_to_from.cpp
    engines/titanic/moves/move_player_to_from.h



diff --git a/engines/titanic/carry/mouth.cpp b/engines/titanic/carry/mouth.cpp
index 8c3791f..e48929a 100644
--- a/engines/titanic/carry/mouth.cpp
+++ b/engines/titanic/carry/mouth.cpp
@@ -21,9 +21,16 @@
  */
 
 #include "titanic/carry/mouth.h"
+#include "titanic/game/head_slot.h"
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CMouth, CHeadPiece)
+	ON_MESSAGE(UseWithOtherMsg)
+	ON_MESSAGE(MovieEndMsg)
+	ON_MESSAGE(PETGainedObjectMsg)
+END_MESSAGE_MAP()
+
 CMouth::CMouth() : CHeadPiece() {
 }
 
@@ -37,4 +44,37 @@ void CMouth::load(SimpleFile *file) {
 	CHeadPiece::load(file);
 }
 
+bool CMouth::UseWithOtherMsg(CUseWithOtherMsg *msg) {
+	CHeadSlot *slot = dynamic_cast<CHeadSlot *>(msg->_other);
+	if (!slot)
+		return CHeadPiece::UseWithOtherMsg(msg);
+
+	_flag = true;
+	setVisible(false);
+	setPosition(Point(0, 0));
+	petMoveToHiddenRoom();
+
+	CAddHeadPieceMsg addMsg(getName());
+	if (addMsg._value != "NULL")
+		addMsg.execute("MouthSlot");
+
+	return true;
+}
+
+bool CMouth::MovieEndMsg(CMovieEndMsg *msg) {
+	return true;
+}
+
+bool CMouth::PETGainedObjectMsg(CPETGainedObjectMsg *msg) {
+	_visibleFrame = 2;
+	loadFrame(2);
+	setVisible(true);
+	if (!_field13C) {
+		stateInc38();
+		_field13C = true;
+	}
+
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/carry/mouth.h b/engines/titanic/carry/mouth.h
index e394330..f5f0f53 100644
--- a/engines/titanic/carry/mouth.h
+++ b/engines/titanic/carry/mouth.h
@@ -28,6 +28,10 @@
 namespace Titanic {
 
 class CMouth : public CHeadPiece {
+	DECLARE_MESSAGE_MAP;
+	bool UseWithOtherMsg(CUseWithOtherMsg *msg);
+	bool MovieEndMsg(CMovieEndMsg *msg);
+	bool PETGainedObjectMsg(CPETGainedObjectMsg *msg);
 public:
 	CLASSDEF;
 	CMouth();
diff --git a/engines/titanic/core/multi_drop_target.cpp b/engines/titanic/core/multi_drop_target.cpp
index f299819..ad709fe 100644
--- a/engines/titanic/core/multi_drop_target.cpp
+++ b/engines/titanic/core/multi_drop_target.cpp
@@ -21,9 +21,14 @@
  */
 
 #include "titanic/core/multi_drop_target.h"
+#include "titanic/support/string_parser.h"
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CMultiDropTarget, CDropTarget)
+	ON_MESSAGE(DropObjectMsg)
+END_MESSAGE_MAP()
+
 void CMultiDropTarget::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
 	file->writeQuotedLine(_string5, indent);
@@ -40,4 +45,21 @@ void CMultiDropTarget::load(SimpleFile *file) {
 	CDropTarget::load(file);
 }
 
+bool CMultiDropTarget::DropObjectMsg(CDropObjectMsg *msg) {
+	CStringParser parser1(_string5);
+	CStringParser parser2(_string6);
+	CString seperatorChars = ",";
+	int dropFrame =  _dropFrame;
+
+	while (parser2.parse(_itemMatchName, seperatorChars)) {
+		_dropFrame = parser1.readInt();
+		CDropTarget::DropObjectMsg(msg);
+
+		parser1.skipSeperators(seperatorChars);
+		parser2.skipSeperators(seperatorChars);
+	}
+
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/core/multi_drop_target.h b/engines/titanic/core/multi_drop_target.h
index c004b9b..ab552f9 100644
--- a/engines/titanic/core/multi_drop_target.h
+++ b/engines/titanic/core/multi_drop_target.h
@@ -28,6 +28,8 @@
 namespace Titanic {
 
 class CMultiDropTarget : public CDropTarget {
+	DECLARE_MESSAGE_MAP;
+	bool DropObjectMsg(CDropObjectMsg *msg);
 public:
 	CString _string5;
 	CString _string6;
diff --git a/engines/titanic/game/missiveomat_button.cpp b/engines/titanic/game/missiveomat_button.cpp
index d5ae75d..b7ad7f8 100644
--- a/engines/titanic/game/missiveomat_button.cpp
+++ b/engines/titanic/game/missiveomat_button.cpp
@@ -21,21 +21,47 @@
  */
 
 #include "titanic/game/missiveomat_button.h"
+#include "titanic/core/room_item.h"
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CMissiveOMatButton, CEditControl)
+	ON_MESSAGE(MouseButtonDownMsg)
+	ON_MESSAGE(VisibleMsg)
+	ON_MESSAGE(MouseDoubleClickMsg)
+END_MESSAGE_MAP()
+
 void CMissiveOMatButton::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writeNumberLine(_fieldFC, indent);
+	file->writeNumberLine(_buttonId, indent);
 
 	CEditControl::save(file, indent);
 }
 
 void CMissiveOMatButton::load(SimpleFile *file) {
 	file->readNumber();
-	_fieldFC = file->readNumber();
+	_buttonId = file->readNumber();
 
 	CEditControl::load(file);
 }
 
+bool CMissiveOMatButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+	CMissiveOMatActionMsg actionMsg;
+	actionMsg._action = _buttonId;
+	actionMsg.execute(findRoom()->findByName("MissiveOMat"));
+	return true;
+}
+
+bool CMissiveOMatButton::VisibleMsg(CVisibleMsg *msg) {
+	setVisible(msg->_visible);
+	return true;
+}
+
+bool CMissiveOMatButton::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) {
+	CMissiveOMatActionMsg actionMsg;
+	actionMsg._action = _buttonId;
+	actionMsg.execute(findRoom()->findByName("MissiveOMat"));
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/game/missiveomat_button.h b/engines/titanic/game/missiveomat_button.h
index d36f5bd..6dbfd4c 100644
--- a/engines/titanic/game/missiveomat_button.h
+++ b/engines/titanic/game/missiveomat_button.h
@@ -28,11 +28,15 @@
 namespace Titanic {
 
 class CMissiveOMatButton : public CEditControl {
+	DECLARE_MESSAGE_MAP;
+	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+	bool VisibleMsg(CVisibleMsg *msg);
+	bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg);
 public:
-	int _fieldFC;
+	int _buttonId;
 public:
 	CLASSDEF;
-	CMissiveOMatButton() : CEditControl(), _fieldFC(2) {}
+	CMissiveOMatButton() : CEditControl(), _buttonId(2) {}
 
 	/**
 	 * Save the data for the class to file
diff --git a/engines/titanic/game/movie_tester.cpp b/engines/titanic/game/movie_tester.cpp
index 1b266d9..bbd66a9 100644
--- a/engines/titanic/game/movie_tester.cpp
+++ b/engines/titanic/game/movie_tester.cpp
@@ -24,18 +24,36 @@
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CMovieTester, CGameObject)
+	ON_MESSAGE(MouseButtonDownMsg)
+END_MESSAGE_MAP()
+
 void CMovieTester::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writeNumberLine(_value1, indent);
-	file->writeNumberLine(_value2, indent);
+	file->writeNumberLine(_movieNumFrames, indent);
+	file->writeNumberLine(_movieFrameNum, indent);
 	CGameObject::save(file, indent);
 }
 
 void CMovieTester::load(SimpleFile *file) {
 	file->readNumber();
-	_value1 = file->readNumber();
-	_value2 = file->readNumber();
+	_movieNumFrames = file->readNumber();
+	_movieFrameNum = file->readNumber();
 	CGameObject::load(file);
 }
 
+bool CMovieTester::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+	if (msg->_buttons == MB_RIGHT) {
+		if (--_movieFrameNum < 0) {
+			_movieFrameNum = _movieNumFrames - 1;
+		}
+	} else {
+		if (++_movieFrameNum >= _movieNumFrames)
+			_movieFrameNum = 0;
+	}
+
+	loadFrame(_movieFrameNum);
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/game/movie_tester.h b/engines/titanic/game/movie_tester.h
index de2ef2c..17a7d48 100644
--- a/engines/titanic/game/movie_tester.h
+++ b/engines/titanic/game/movie_tester.h
@@ -28,11 +28,13 @@
 namespace Titanic {
 
 class CMovieTester : public CGameObject {
+	DECLARE_MESSAGE_MAP;
+	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
 public:
-	int _value1, _value2;
+	int _movieNumFrames, _movieFrameNum;
 public:
 	CLASSDEF;
-	CMovieTester() : CGameObject(), _value1(0), _value2(0) {}
+	CMovieTester() : CGameObject(), _movieNumFrames(0), _movieFrameNum(0) {}
 
 	/**
 	 * Save the data for the class to file
diff --git a/engines/titanic/gfx/move_object_button.cpp b/engines/titanic/gfx/move_object_button.cpp
index bdc90a6..bcd2b2b 100644
--- a/engines/titanic/gfx/move_object_button.cpp
+++ b/engines/titanic/gfx/move_object_button.cpp
@@ -21,9 +21,14 @@
  */
 
 #include "titanic/gfx/move_object_button.h"
+#include "titanic/core/project_item.h"
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CMoveObjectButton, CSTButton)
+	ON_MESSAGE(MouseButtonUpMsg)
+END_MESSAGE_MAP()
+
 CMoveObjectButton::CMoveObjectButton() : CSTButton(), _field11C(1) {
 }
 
@@ -43,4 +48,14 @@ void CMoveObjectButton::load(SimpleFile *file) {
 	CSTButton::load(file);
 }
 
+bool CMoveObjectButton::MouseButtonUpMsg(CMouseButtonUpMsg *msg) {
+	CGameObject *obj = dynamic_cast<CGameObject *>(getRoot()->findByName(_actionTarget));
+	if (obj) {
+		obj->petAddToInventory();
+		obj->setVisible(_field11C);
+	}
+
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/gfx/move_object_button.h b/engines/titanic/gfx/move_object_button.h
index eb2fdc4..46c49c3 100644
--- a/engines/titanic/gfx/move_object_button.h
+++ b/engines/titanic/gfx/move_object_button.h
@@ -28,6 +28,8 @@
 namespace Titanic {
 
 class CMoveObjectButton : public CSTButton {
+	DECLARE_MESSAGE_MAP;
+	bool MouseButtonUpMsg(CMouseButtonUpMsg *msg);
 private:
 	Point _pos1;
 	int _field11C;
diff --git a/engines/titanic/moves/move_player_in_parrot_room.cpp b/engines/titanic/moves/move_player_in_parrot_room.cpp
index df38c63..1ef2e96 100644
--- a/engines/titanic/moves/move_player_in_parrot_room.cpp
+++ b/engines/titanic/moves/move_player_in_parrot_room.cpp
@@ -24,6 +24,11 @@
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CMovePlayerInParrotRoom, CMovePlayerTo)
+	ON_MESSAGE(ActMsg)
+	ON_MESSAGE(MouseButtonDownMsg)
+END_MESSAGE_MAP()
+
 CMovePlayerInParrotRoom::CMovePlayerInParrotRoom() : CMovePlayerTo() {
 }
 
@@ -37,4 +42,20 @@ void CMovePlayerInParrotRoom::load(SimpleFile *file) {
 	CMovePlayerTo::load(file);
 }
 
+bool CMovePlayerInParrotRoom::ActMsg(CActMsg *msg) {
+	if (msg->_action == "PanAwayFromParrot") {
+		unlockMouse();
+		changeView(_destination);
+	}
+
+	return true;
+}
+
+bool CMovePlayerInParrotRoom::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+	lockMouse();
+	CPanningAwayFromParrotMsg awayMsg(this);
+	awayMsg.execute("PerchedParrot");
+	return true;
+}
+
 } // 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 de693fe..54dc2eb 100644
--- a/engines/titanic/moves/move_player_in_parrot_room.h
+++ b/engines/titanic/moves/move_player_in_parrot_room.h
@@ -28,6 +28,9 @@
 namespace Titanic {
 
 class CMovePlayerInParrotRoom : public CMovePlayerTo {
+	DECLARE_MESSAGE_MAP;
+	bool ActMsg(CActMsg *msg);
+	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
 public:
 	CLASSDEF;
 	CMovePlayerInParrotRoom();
diff --git a/engines/titanic/moves/move_player_to.cpp b/engines/titanic/moves/move_player_to.cpp
index 9b6000c..a91215b 100644
--- a/engines/titanic/moves/move_player_to.cpp
+++ b/engines/titanic/moves/move_player_to.cpp
@@ -21,9 +21,15 @@
  */
 
 #include "titanic/moves/move_player_to.h"
+#include "titanic/game_manager.h"
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CMovePlayerTo, CGameObject)
+	ON_MESSAGE(MouseButtonDownMsg)
+	ON_MESSAGE(ActMsg)
+END_MESSAGE_MAP()
+
 CMovePlayerTo::CMovePlayerTo() : CGameObject() {
 }
 
@@ -41,4 +47,17 @@ void CMovePlayerTo::load(SimpleFile *file) {
 	CGameObject::load(file);
 }
 
+bool CMovePlayerTo::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+	CGameManager *gameManager = getGameManager();
+	if (gameManager)
+		changeView(_destination);
+
+	return true;
+}
+
+bool CMovePlayerTo::ActMsg(CActMsg *msg) {
+	_destination = msg->_action;
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/moves/move_player_to.h b/engines/titanic/moves/move_player_to.h
index 4bfffcb..822df69 100644
--- a/engines/titanic/moves/move_player_to.h
+++ b/engines/titanic/moves/move_player_to.h
@@ -28,6 +28,9 @@
 namespace Titanic {
 
 class CMovePlayerTo : public CGameObject {
+	DECLARE_MESSAGE_MAP;
+	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+	bool ActMsg(CActMsg *msg);
 protected:
 	CString _destination;
 public:
diff --git a/engines/titanic/moves/move_player_to_from.cpp b/engines/titanic/moves/move_player_to_from.cpp
index 1a67dc8..c57cc2c 100644
--- a/engines/titanic/moves/move_player_to_from.cpp
+++ b/engines/titanic/moves/move_player_to_from.cpp
@@ -21,10 +21,16 @@
  */
 
 #include "titanic/moves/move_player_to_from.h"
+#include "titanic/core/view_item.h"
+#include "titanic/core/link_item.h"
 
 namespace Titanic {
 
-CMovePlayerToFrom::CMovePlayerToFrom() : CGameObject() {
+BEGIN_MESSAGE_MAP(CMovePlayerToFrom, CMovePlayerTo)
+	ON_MESSAGE(MouseButtonDownMsg)
+END_MESSAGE_MAP()
+
+CMovePlayerToFrom::CMovePlayerToFrom() : CMovePlayerTo() {
 }
 
 void CMovePlayerToFrom::save(SimpleFile *file, int indent) {
@@ -41,4 +47,17 @@ void CMovePlayerToFrom::load(SimpleFile *file) {
 	CGameObject::load(file);
 }
 
+bool CMovePlayerToFrom::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+	if (_string2.empty()) {
+		changeView(_destination);
+	} else {
+		CViewItem *view = parseView(_string2);
+		CViewItem *destView = parseView(_destination);
+		CLinkItem *link = view->findLink(destView);
+		changeView(_destination, link->getName());
+	}
+
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/moves/move_player_to_from.h b/engines/titanic/moves/move_player_to_from.h
index c9eefe5..fde4e94 100644
--- a/engines/titanic/moves/move_player_to_from.h
+++ b/engines/titanic/moves/move_player_to_from.h
@@ -23,11 +23,13 @@
 #ifndef TITANIC_MOVE_PLAYER_TO_FROM_H
 #define TITANIC_MOVE_PLAYER_TO_FROM_H
 
-#include "titanic/core/game_object.h"
+#include "titanic/moves/move_player_to.h"
 
 namespace Titanic {
 
-class CMovePlayerToFrom : public CGameObject {
+class CMovePlayerToFrom : public CMovePlayerTo {
+	DECLARE_MESSAGE_MAP;
+	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
 private:
 	CString _string2;
 public:






More information about the Scummvm-git-logs mailing list