aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/game
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/game')
-rw-r--r--engines/titanic/game/broken_pell_base.cpp2
-rw-r--r--engines/titanic/game/broken_pell_base.h4
-rw-r--r--engines/titanic/game/broken_pellerator.cpp107
-rw-r--r--engines/titanic/game/broken_pellerator.h5
-rw-r--r--engines/titanic/game/broken_pellerator_froz.cpp103
-rw-r--r--engines/titanic/game/broken_pellerator_froz.h5
-rw-r--r--engines/titanic/game/call_pellerator.cpp37
-rw-r--r--engines/titanic/game/call_pellerator.h47
-rw-r--r--engines/titanic/game/transport/pellerator.cpp97
-rw-r--r--engines/titanic/game/transport/pellerator.h8
10 files changed, 322 insertions, 93 deletions
diff --git a/engines/titanic/game/broken_pell_base.cpp b/engines/titanic/game/broken_pell_base.cpp
index 59e2b9bca1..02c2d873ac 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 f63cd0112b..4ca7eddd20 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 d3b204b1e5..8fb7244b7e 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 6fbde91053..3b8c3ba587 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 4b21ea93d0..690ab76820 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 1df6d2d0b2..ccdae6ffa8 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 0ea48131b1..0000000000
--- 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 7da4b40794..0000000000
--- 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 e789c20a3d..343ce29b3d 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 fa400a49cd..ad93ba036a 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