[Scummvm-cvs-logs] scummvm master -> 4c7985c3c9cb1e8023c6d1be5b5ed09fbfba2011

dreammaster dreammaster at scummvm.org
Wed Aug 17 03:04:35 CEST 2016


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:
4c7985c3c9 TITANIC: Implemented various pellerator classes


Commit: 4c7985c3c9cb1e8023c6d1be5b5ed09fbfba2011
    https://github.com/scummvm/scummvm/commit/4c7985c3c9cb1e8023c6d1be5b5ed09fbfba2011
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-16T21:04:19-04:00

Commit Message:
TITANIC: Implemented various pellerator classes

Changed paths:
  A engines/titanic/moves/call_pellerator.cpp
  A engines/titanic/moves/call_pellerator.h
  R engines/titanic/game/call_pellerator.cpp
  R engines/titanic/game/call_pellerator.h
    engines/titanic/core/saveable_object.cpp
    engines/titanic/game/broken_pell_base.cpp
    engines/titanic/game/broken_pell_base.h
    engines/titanic/game/broken_pellerator.cpp
    engines/titanic/game/broken_pellerator.h
    engines/titanic/game/broken_pellerator_froz.cpp
    engines/titanic/game/broken_pellerator_froz.h
    engines/titanic/game/transport/pellerator.cpp
    engines/titanic/game/transport/pellerator.h
    engines/titanic/module.mk
    engines/titanic/moves/exit_pellerator.cpp
    engines/titanic/moves/exit_pellerator.h



diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp
index 2d44126..5fc2d7e 100644
--- a/engines/titanic/core/saveable_object.cpp
+++ b/engines/titanic/core/saveable_object.cpp
@@ -103,7 +103,6 @@
 #include "titanic/game/broken_pellerator.h"
 #include "titanic/game/broken_pellerator_froz.h"
 #include "titanic/game/cage.h"
-#include "titanic/game/call_pellerator.h"
 #include "titanic/game/captains_wheel.h"
 #include "titanic/game/cdrom.h"
 #include "titanic/game/cdrom_computer.h"
@@ -333,6 +332,7 @@
 #include "titanic/messages/pet_messages.h"
 #include "titanic/messages/service_elevator_door.h"
 
+#include "titanic/moves/call_pellerator.h"
 #include "titanic/moves/enter_bomb_room.h"
 #include "titanic/moves/enter_bridge.h"
 #include "titanic/moves/enter_exit_first_class_state.h"
diff --git a/engines/titanic/game/broken_pell_base.cpp b/engines/titanic/game/broken_pell_base.cpp
index 59e2b9b..02c2d87 100644
--- a/engines/titanic/game/broken_pell_base.cpp
+++ b/engines/titanic/game/broken_pell_base.cpp
@@ -26,7 +26,7 @@ namespace Titanic {
 
 EMPTY_MESSAGE_MAP(CBrokenPellBase, CBackground);
 
-int CBrokenPellBase::_v1;
+bool CBrokenPellBase::_v1;
 int CBrokenPellBase::_v2;
 
 void CBrokenPellBase::save(SimpleFile *file, int indent) {
diff --git a/engines/titanic/game/broken_pell_base.h b/engines/titanic/game/broken_pell_base.h
index f63cd01..4ca7edd 100644
--- a/engines/titanic/game/broken_pell_base.h
+++ b/engines/titanic/game/broken_pell_base.h
@@ -29,8 +29,8 @@ namespace Titanic {
 
 class CBrokenPellBase : public CBackground {
 	DECLARE_MESSAGE_MAP;
-private:
-	static int _v1;
+protected:
+	static bool _v1;
 	static int _v2;
 
 	int _fieldE0;
diff --git a/engines/titanic/game/broken_pellerator.cpp b/engines/titanic/game/broken_pellerator.cpp
index d3b204b..8fb7244 100644
--- a/engines/titanic/game/broken_pellerator.cpp
+++ b/engines/titanic/game/broken_pellerator.cpp
@@ -21,9 +21,17 @@
  */
 
 #include "titanic/game/broken_pellerator.h"
+#include "titanic/core/view_item.h"
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CBrokenPellerator, CBrokenPellBase)
+	ON_MESSAGE(MouseButtonDownMsg)
+	ON_MESSAGE(LeaveViewMsg)
+	ON_MESSAGE(ActMsg)
+	ON_MESSAGE(MovieEndMsg)
+END_MESSAGE_MAP()
+
 void CBrokenPellerator::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
 	file->writeQuotedLine(_string2, indent);
@@ -44,4 +52,103 @@ void CBrokenPellerator::load(SimpleFile *file) {
 	CBrokenPellBase::load(file);
 }
 
+bool CBrokenPellerator::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+	if (_v1) {
+		changeView(_v2 ? _string5 : _string4);
+	} else {
+		if (_v2) {
+			playMovie(28, 43, 0);
+		} else {
+			playMovie(0, 14, MOVIE_NOTIFY_OBJECT);
+		}
+
+		_v1 = true;
+	}
+
+	return true;
+}
+
+bool CBrokenPellerator::LeaveViewMsg(CLeaveViewMsg *msg) {
+	CString name = msg->_newView->getNodeViewName();
+	if (name == "Node 3.S" || name == "Node 3.N") {
+		_v1 = false;
+		loadFrame(0);
+	}
+
+	return true;
+}
+
+bool CBrokenPellerator::ActMsg(CActMsg *msg) {
+	if (msg->_action == "PlayerGetsHose") {
+		_v2 = 1;
+		loadFrame(43);
+
+		CStatusChangeMsg statusMsg;
+		statusMsg.execute("PickupHose");
+	} else {
+		_fieldE0 = 0;
+		bool closeFlag = msg->_action == "Close";
+		if (msg->_action == "CloseLeft") {
+			closeFlag = true;
+			_fieldE0 = 1;
+		}
+		if (msg->_action == "CloseRight") {
+			closeFlag = true;
+			_fieldE0 = 2;
+		}
+
+		if (closeFlag) {
+			if (_v1) {
+				_v1 = false;
+				if (_v2)
+					playMovie(43, 57, MOVIE_NOTIFY_OBJECT);
+				else
+					playMovie(14, 28, MOVIE_NOTIFY_OBJECT);
+			} else {
+				switch (_fieldE0) {
+				case 1:
+					changeView(_string2);
+					break;
+				case 2:
+					changeView(_string3);
+					break;
+				default:
+					break;
+				}
+
+				_fieldE0 = 0;
+			}
+		}
+	}
+
+	return true;
+}
+
+bool CBrokenPellerator::MovieEndMsg(CMovieEndMsg *msg) {
+	if (msg->_endFrame == 14) {
+		CStatusChangeMsg statusMsg;
+		statusMsg._newStatus = 1;
+		statusMsg.execute("PickUpHose");
+	}
+
+	if (msg->_endFrame == 28) {
+		CStatusChangeMsg statusMsg;
+		statusMsg._newStatus = 0;
+		statusMsg.execute("PickUpHose");
+	}
+
+	switch (_fieldE0) {
+	case 1:
+		changeView(_string2);
+		break;
+	case 2:
+		changeView(_string3);
+		break;
+	default:
+		break;
+	}
+
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/game/broken_pellerator.h b/engines/titanic/game/broken_pellerator.h
index 6fbde91..3b8c3ba 100644
--- a/engines/titanic/game/broken_pellerator.h
+++ b/engines/titanic/game/broken_pellerator.h
@@ -28,6 +28,11 @@
 namespace Titanic {
 
 class CBrokenPellerator : public CBrokenPellBase {
+	DECLARE_MESSAGE_MAP;
+	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+	bool LeaveViewMsg(CLeaveViewMsg *msg);
+	bool ActMsg(CActMsg *msg);
+	bool MovieEndMsg(CMovieEndMsg *msg);
 private:
 	CString _string2;
 	CString _string3;
diff --git a/engines/titanic/game/broken_pellerator_froz.cpp b/engines/titanic/game/broken_pellerator_froz.cpp
index 4b21ea9..690ab76 100644
--- a/engines/titanic/game/broken_pellerator_froz.cpp
+++ b/engines/titanic/game/broken_pellerator_froz.cpp
@@ -21,9 +21,17 @@
  */
 
 #include "titanic/game/broken_pellerator_froz.h"
+#include "titanic/core/view_item.h"
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CBrokenPelleratorFroz, CBrokenPellBase)
+	ON_MESSAGE(MouseButtonDownMsg)
+	ON_MESSAGE(LeaveViewMsg)
+	ON_MESSAGE(ActMsg)
+	ON_MESSAGE(MovieEndMsg)
+END_MESSAGE_MAP()
+
 void CBrokenPelleratorFroz::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
 	file->writeQuotedLine(_string2, indent);
@@ -44,4 +52,99 @@ void CBrokenPelleratorFroz::load(SimpleFile *file) {
 	CBrokenPellBase::load(file);
 }
 
+bool CBrokenPelleratorFroz::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+	if (_v1) {
+		changeView(_v2 ? _string5 : _string4);
+	} else {
+		_v1 = true;
+		if (_v2) {
+			playMovie(0, 13, 0);
+		} else {
+			playMovie(43, 55, MOVIE_NOTIFY_OBJECT);
+		}
+	}
+
+	return true;
+}
+
+bool CBrokenPelleratorFroz::LeaveViewMsg(CLeaveViewMsg *msg) {
+	CString name = msg->_newView->getNodeViewName();
+
+	if (name == "Node 3.S" || name == "Node 3.E") {
+		_v1 = false;
+		loadFrame(0);
+	}
+
+	return true;
+}
+
+bool CBrokenPelleratorFroz::ActMsg(CActMsg *msg) {
+	if (msg->_action == "PlayerGetsHose") {
+		_v2 = 1;
+		CStatusChangeMsg statusMsg;
+		statusMsg._newStatus = 0;
+		statusMsg.execute("FPickUpHose");
+	} else {
+		_fieldE0 = 0;
+		bool closeFlag = msg->_action == "Close";
+		if (msg->_action == "CloseLeft") {
+			closeFlag = true;
+			_fieldE0 = 1;
+		}
+		if (msg->_action == "CloseRight") {
+			closeFlag = true;
+			_fieldE0 = 2;
+		}
+
+		if (closeFlag) {
+			if (_v1) {
+				_v1 = false;
+				if (_v2)
+					playMovie(29, 42, MOVIE_NOTIFY_OBJECT);
+				else
+					playMovie(72, 84, MOVIE_NOTIFY_OBJECT);
+			} else {
+				switch (_fieldE0) {
+				case 1:
+					changeView(_string2);
+					break;
+				case 2:
+					changeView(_string3);
+					break;
+				default:
+					break;
+				}
+
+				_fieldE0 = 0;
+			}
+		}
+	}
+
+	return true;
+}
+
+bool CBrokenPelleratorFroz::MovieEndMsg(CMovieEndMsg *msg) {
+	if (msg->_endFrame == 55) {
+		CStatusChangeMsg statusMsg;
+		statusMsg._newStatus = 1;
+		statusMsg.execute("FPickUpHose");
+	}
+
+	if (msg->_endFrame == 84) {
+		CStatusChangeMsg statusMsg;
+		statusMsg._newStatus = 0;
+		statusMsg.execute("FPickUpHose");
+	}
+
+	if (_fieldE0 == 1) {
+		changeView(_string2);
+		_fieldE0 = 0;
+	} else if (_fieldE0 == 2) {
+		changeView(_string3);
+		_fieldE0 = 0;
+	}
+
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/game/broken_pellerator_froz.h b/engines/titanic/game/broken_pellerator_froz.h
index 1df6d2d..ccdae6f 100644
--- a/engines/titanic/game/broken_pellerator_froz.h
+++ b/engines/titanic/game/broken_pellerator_froz.h
@@ -28,6 +28,11 @@
 namespace Titanic {
 
 class CBrokenPelleratorFroz : public CBrokenPellBase {
+	DECLARE_MESSAGE_MAP;
+	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+	bool LeaveViewMsg(CLeaveViewMsg *msg);
+	bool ActMsg(CActMsg *msg);
+	bool MovieEndMsg(CMovieEndMsg *msg);
 private:
 	CString _string2;
 	CString _string3;
diff --git a/engines/titanic/game/call_pellerator.cpp b/engines/titanic/game/call_pellerator.cpp
deleted file mode 100644
index 0ea4813..0000000
--- a/engines/titanic/game/call_pellerator.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 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/game/call_pellerator.h"
-
-namespace Titanic {
-
-void CCallPellerator::save(SimpleFile *file, int indent) {
-	file->writeNumberLine(1, indent);
-	CGameObject::save(file, indent);
-}
-
-void CCallPellerator::load(SimpleFile *file) {
-	file->readNumber();
-	CGameObject::load(file);
-}
-
-} // End of namespace Titanic
diff --git a/engines/titanic/game/call_pellerator.h b/engines/titanic/game/call_pellerator.h
deleted file mode 100644
index 7da4b40..0000000
--- a/engines/titanic/game/call_pellerator.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* 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_CALL_PELLERATOR_H
-#define TITANIC_CALL_PELLERATOR_H
-
-#include "titanic/core/game_object.h"
-
-namespace Titanic {
-
-class CCallPellerator : public CGameObject {
-public:
-	CLASSDEF;
-
-	/**
-	 * Save the data for the class to file
-	 */
-	virtual void save(SimpleFile *file, int indent);
-
-	/**
-	 * Load the data for the class from file
-	 */
-	virtual void load(SimpleFile *file);
-};
-
-} // End of namespace Titanic
-
-#endif /* TITANIC_CALL_PELLERATOR_H */
diff --git a/engines/titanic/game/transport/pellerator.cpp b/engines/titanic/game/transport/pellerator.cpp
index e789c20..343ce29 100644
--- a/engines/titanic/game/transport/pellerator.cpp
+++ b/engines/titanic/game/transport/pellerator.cpp
@@ -21,19 +21,32 @@
 */
 
 #include "titanic/game/transport/pellerator.h"
+#include "titanic/core/room_item.h"
 
 namespace Titanic {
 
+static const char *const WAVE_NAMES[10] = {
+	"z#465.wav", "z#456.wav", "z#455.wav", "z#453.wav",
+	"z#452.wav", "NoStandingInFunnyWays", "z#450.wav",
+	"z#449.wav", "z#435.wav", "z#434.wav"
+};
+
 BEGIN_MESSAGE_MAP(CPellerator, CTransport)
+	ON_MESSAGE(StatusChangeMsg)
 	ON_MESSAGE(EnterRoomMsg)
+	ON_MESSAGE(MovieEndMsg)
+	ON_MESSAGE(TimerMsg)
 END_MESSAGE_MAP()
 
-int CPellerator::_v1;
+int CPellerator::_soundHandle;
 int CPellerator::_v2;
 
+CPellerator::CPellerator() : CTransport() {
+}
+
 void CPellerator::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writeNumberLine(_v1, indent);
+	file->writeNumberLine(_soundHandle, indent);
 	file->writeNumberLine(_v2, indent);
 
 	CTransport::save(file, indent);
@@ -41,14 +54,90 @@ void CPellerator::save(SimpleFile *file, int indent) {
 
 void CPellerator::load(SimpleFile *file) {
 	file->readNumber();
-	_v1 = file->readNumber();
+	_soundHandle = file->readNumber();
 	_v2 = file->readNumber();
 
 	CTransport::load(file);
 }
 
+bool CPellerator::StatusChangeMsg(CStatusChangeMsg *msg) {
+	warning("CPellerator::StatusChangeMsg");
+	return true;
+}
+
 bool CPellerator::EnterRoomMsg(CEnterRoomMsg *msg) {
-	warning("CPellerator::handleEvent");
+	if (isEquals("PelleratorObject")) {
+		for (int idx = 0; idx < 10; ++idx)
+			loadSound(WAVE_NAMES[idx]);
+		addTimer(10000);
+	}
+
+	CString name = msg->_oldRoom ? msg->_oldRoom->getName() : "";
+	int oldVal = _v2;
+
+	if (name.empty()) {
+		_v2 = 4;
+		oldVal = 4;
+	} else if (name == "PromenadeDeck") {
+		_v2 = 0;
+	} else if (name == "MusicRoomLobby") {
+		_v2 = 1;
+	} else if (name == "Bar") {
+		_v2 = 2;
+	} else if (name == "TopOfWell") {
+		_v2 = 4;
+	} else if (name == "1stClassRestaurant") {
+		_v2 = 5;
+	} else if (name == "Arboretum" || name == "FrozenArboretum") {
+		_v2 = 6;
+	}
+
+	if (_v2 != oldVal) {
+		CStatusChangeMsg statusMsg;
+		statusMsg._newStatus = _v2;
+		statusMsg.execute("ExitPellerator");
+	}
+
+	loadFrame(264);
+	return true;
+}
+
+bool CPellerator::MovieEndMsg(CMovieEndMsg *msg) {
+	setVisible(false);
+	stopGlobalSound(true, -1);
+
+	switch (_v2) {
+	case 0:
+		_soundHandle = queueSound("z#429.wav", _soundHandle);
+		break;
+	case 1:
+		_soundHandle = queueSound("z#430.wav", _soundHandle);
+		break;
+	case 2:
+		_soundHandle = queueSound("z#431.wav", _soundHandle);
+		break;
+	case 4:
+		_soundHandle = queueSound("z#428.wav", _soundHandle);
+		break;
+	case 5:
+		_soundHandle = queueSound("z#433.wav", _soundHandle);
+		break;
+	case 6:
+		_soundHandle = queueSound("z#432.wav", _soundHandle);
+		break;
+	default:
+		break;
+	}
+
+	return true;
+}
+
+bool CPellerator::TimerMsg(CTimerMsg *msg) {
+	if (compareRoomNameTo("Pellerator")) {
+		_soundHandle = queueSound(WAVE_NAMES[getRandomNumber(9)], _soundHandle);
+		addTimer(20000 + getRandomNumber(10000));
+	}
+
 	return true;
 }
 
diff --git a/engines/titanic/game/transport/pellerator.h b/engines/titanic/game/transport/pellerator.h
index fa400a4..ad93ba0 100644
--- a/engines/titanic/game/transport/pellerator.h
+++ b/engines/titanic/game/transport/pellerator.h
@@ -30,12 +30,16 @@ namespace Titanic {
 
 class CPellerator : public CTransport {
 	DECLARE_MESSAGE_MAP;
+	bool StatusChangeMsg(CStatusChangeMsg *msg);
 	bool EnterRoomMsg(CEnterRoomMsg *msg);
-private:
-	static int _v1;
+	bool MovieEndMsg(CMovieEndMsg *msg);
+	bool TimerMsg(CTimerMsg *msg);
+public:
+	static int _soundHandle;
 	static int _v2;
 public:
 	CLASSDEF;
+	CPellerator();
 
 	/**
 	 * Save the data for the class to file
diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index 34d93b6..a3afc7e 100644
--- a/engines/titanic/module.mk
+++ b/engines/titanic/module.mk
@@ -94,7 +94,6 @@ MODULE_OBJS := \
 	game/broken_pell_base.o \
 	game/broken_pellerator.o \
 	game/broken_pellerator_froz.o \
-	game/call_pellerator.o \
 	game/cage.o \
 	game/captains_wheel.o \
 	game/cdrom.o \
@@ -317,6 +316,7 @@ MODULE_OBJS := \
 	messages/messages.o \
 	messages/mouse_messages.o \
 	messages/service_elevator_door.o \
+	moves/call_pellerator.o \
 	moves/enter_bomb_room.o \
 	moves/enter_bridge.o \
 	moves/enter_exit_first_class_state.o \
diff --git a/engines/titanic/moves/call_pellerator.cpp b/engines/titanic/moves/call_pellerator.cpp
new file mode 100644
index 0000000..0dd8195
--- /dev/null
+++ b/engines/titanic/moves/call_pellerator.cpp
@@ -0,0 +1,82 @@
+/* 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/moves/call_pellerator.h"
+
+namespace Titanic {
+
+BEGIN_MESSAGE_MAP(CCallPellerator, CGameObject)
+	ON_MESSAGE(EnterViewMsg)
+	ON_MESSAGE(LeaveViewMsg)
+	ON_MESSAGE(PETActivateMsg)
+	ON_MESSAGE(MouseButtonDownMsg)
+END_MESSAGE_MAP()
+
+void CCallPellerator::save(SimpleFile *file, int indent) {
+	file->writeNumberLine(1, indent);
+	CGameObject::save(file, indent);
+}
+
+void CCallPellerator::load(SimpleFile *file) {
+	file->readNumber();
+	CGameObject::load(file);
+}
+
+bool CCallPellerator::EnterViewMsg(CEnterViewMsg *msg) {
+	petSetArea(PET_REMOTE);
+	petHighlightGlyph(1);
+	CString name = getFullViewName();
+
+	if (name == "TopOfWell.Node 6.S") {
+		petDisplayMessage(2, "You are standing outside the Pellerator.");
+	}
+
+	petSetRemoteTarget();
+	return true;
+}
+
+bool CCallPellerator::LeaveViewMsg(CLeaveViewMsg *msg) {
+	petClear();
+	return true;
+}
+
+bool CCallPellerator::PETActivateMsg(CPETActivateMsg *msg) {
+	CString name = getFullViewName();
+
+	if (msg->_name == "Pellerator") {
+		if (petDoorOrBellbotPresent()) {
+			petDisplayMessage("I'm sorry, you cannot enter this pellerator at present as a bot is in the way.");
+		} else if (name == "Bar.Node 1.S") {
+			changeView("Pellerator.Node 1.S");
+		} else {
+			changeView("Pellerator.Node 1.N");
+		}
+	}
+
+	return true;
+}
+
+bool CCallPellerator::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+	return true;
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/moves/call_pellerator.h b/engines/titanic/moves/call_pellerator.h
new file mode 100644
index 0000000..3a1ef38
--- /dev/null
+++ b/engines/titanic/moves/call_pellerator.h
@@ -0,0 +1,53 @@
+/* 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_CALL_PELLERATOR_H
+#define TITANIC_CALL_PELLERATOR_H
+
+#include "titanic/core/game_object.h"
+#include "titanic/messages/pet_messages.h"
+
+namespace Titanic {
+
+class CCallPellerator : public CGameObject {
+	DECLARE_MESSAGE_MAP;
+	bool EnterViewMsg(CEnterViewMsg *msg);
+	bool LeaveViewMsg(CLeaveViewMsg *msg);
+	bool PETActivateMsg(CPETActivateMsg *msg);
+	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+public:
+	CLASSDEF;
+
+	/**
+	 * Save the data for the class to file
+	 */
+	virtual void save(SimpleFile *file, int indent);
+
+	/**
+	 * Load the data for the class from file
+	 */
+	virtual void load(SimpleFile *file);
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_CALL_PELLERATOR_H */
diff --git a/engines/titanic/moves/exit_pellerator.cpp b/engines/titanic/moves/exit_pellerator.cpp
index 68a2a8d..12ca2c1 100644
--- a/engines/titanic/moves/exit_pellerator.cpp
+++ b/engines/titanic/moves/exit_pellerator.cpp
@@ -21,9 +21,16 @@
  */
 
 #include "titanic/moves/exit_pellerator.h"
+#include "titanic/game/transport/pellerator.h"
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CExitPellerator, CGameObject)
+	ON_MESSAGE(MouseButtonDownMsg)
+	ON_MESSAGE(StatusChangeMsg)
+	ON_MESSAGE(ChangeSeasonMsg)
+END_MESSAGE_MAP()
+
 CExitPelleratorStatics *CExitPellerator::_statics;
 
 void CExitPellerator::init() {
@@ -38,7 +45,7 @@ void CExitPellerator::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
 	file->writeQuotedLine(_statics->_v1, indent);
 	file->writeNumberLine(_statics->_v2, indent);
-	file->writeNumberLine(_statics->_v3, indent);
+	file->writeNumberLine(_statics->_isWinter, indent);
 
 	CGameObject::save(file, indent);
 }
@@ -47,9 +54,84 @@ void CExitPellerator::load(SimpleFile *file) {
 	file->readNumber();
 	_statics->_v1 = file->readString();
 	_statics->_v2 = file->readNumber();
-	_statics->_v3 = file->readNumber();
+	_statics->_isWinter = file->readNumber();
 
 	CGameObject::load(file);
 }
 
+bool CExitPellerator::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+	CString name = getName();
+	
+	if (name == "ExitPellerator") {
+		if (_statics->_v2 != 2) {
+			switch (getRandomNumber(2)) {
+			case 0:
+				CPellerator::_soundHandle = queueSound("z#457.wav", CPellerator::_soundHandle);
+				break;
+			case 1:
+				CPellerator::_soundHandle = queueSound("z#458.wav", CPellerator::_soundHandle);
+				break;
+			default:
+				CPellerator::_soundHandle = queueSound("z#464.wav", CPellerator::_soundHandle);
+				break;
+			}
+		}
+
+		switch (_statics->_v2) {
+		case 0:
+			changeView("PromenadeDeck.Node 1.W");
+			break;
+		case 1:
+			changeView("MusicRoomLobby.Node 1.S");
+			break;
+		case 4:
+			changeView("TopOfWell.Node 6.N");
+			break;
+		case 5:
+			changeView("1stClassRestaurant.Lobby Node.E");
+			break;
+		case 6:
+			changeView(_statics->_isWinter ? "FrozenArboretum.Node 4.S" : "Arboretum.Node 4.W");
+			break;
+		default:
+			petDisplayMessage(2, "Please exit from the other side.");
+			CPellerator::_soundHandle = queueSound("z#438.wav", CPellerator::_soundHandle);
+
+		}
+	} else if (name == "ExitPellerator2") {
+		if (_statics->_v2 == 2) {
+			switch (getRandomNumber(2)) {
+			case 0:
+				CPellerator::_soundHandle = queueSound("z#457.wav", CPellerator::_soundHandle);
+				break;
+			case 1:
+				CPellerator::_soundHandle = queueSound("z#458.wav", CPellerator::_soundHandle);
+				break;
+			default:
+				CPellerator::_soundHandle = queueSound("z#464.wav", CPellerator::_soundHandle);
+				break;
+			}
+		}
+
+		if (_statics->_v2 == 2) {
+			changeView("Bar.Node 1.N");
+		} else {
+			petDisplayMessage(2, "Please exit from the other side.");
+			CPellerator::_soundHandle = queueSound("z#438.wav", CPellerator::_soundHandle);
+		}
+	}
+
+	return true;
+}
+
+bool CExitPellerator::StatusChangeMsg(CStatusChangeMsg *msg) {
+	_statics->_v2 = msg->_newStatus;
+	return true;
+}
+
+bool CExitPellerator::ChangeSeasonMsg(CChangeSeasonMsg *msg) {
+	_statics->_isWinter = msg->_season == "Winter";
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/moves/exit_pellerator.h b/engines/titanic/moves/exit_pellerator.h
index 280d1e9..8819d64 100644
--- a/engines/titanic/moves/exit_pellerator.h
+++ b/engines/titanic/moves/exit_pellerator.h
@@ -30,10 +30,14 @@ namespace Titanic {
 struct CExitPelleratorStatics {
 	CString _v1;
 	int _v2;
-	int _v3;
+	bool _isWinter;
 };
 
 class CExitPellerator : public CGameObject {
+	DECLARE_MESSAGE_MAP;
+	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+	bool StatusChangeMsg(CStatusChangeMsg *msg);
+	bool ChangeSeasonMsg(CChangeSeasonMsg *msg);
 private:
 	static CExitPelleratorStatics *_statics;
 public:






More information about the Scummvm-git-logs mailing list