aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-21 21:41:48 -0400
committerPaul Gilbert2016-08-21 21:41:48 -0400
commite7d0047b5334bef6688a5f81c200630a58ff89c4 (patch)
tree62fb8f5e0a453d67674e304b4f8102d93d5cba02 /engines/titanic
parent9ebd75742eb3a4fac4f6ff3ae421ec67be1f28eb (diff)
downloadscummvm-rg350-e7d0047b5334bef6688a5f81c200630a58ff89c4.tar.gz
scummvm-rg350-e7d0047b5334bef6688a5f81c200630a58ff89c4.tar.bz2
scummvm-rg350-e7d0047b5334bef6688a5f81c200630a58ff89c4.zip
TITANIC: Implemented more game classes
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/carry/fruit.cpp47
-rw-r--r--engines/titanic/carry/fruit.h5
-rw-r--r--engines/titanic/carry/glass.cpp116
-rw-r--r--engines/titanic/carry/glass.h7
-rw-r--r--engines/titanic/game/floor_indicator.cpp11
-rw-r--r--engines/titanic/game/floor_indicator.h2
-rw-r--r--engines/titanic/game/games_console.cpp30
-rw-r--r--engines/titanic/game/games_console.h7
-rw-r--r--engines/titanic/game/get_lift_eye2.cpp58
-rw-r--r--engines/titanic/game/get_lift_eye2.h6
-rw-r--r--engines/titanic/game/glass_smasher.cpp19
-rw-r--r--engines/titanic/game/glass_smasher.h3
-rw-r--r--engines/titanic/game/gondolier/gondolier_base.cpp27
-rw-r--r--engines/titanic/game/gondolier/gondolier_base.h10
-rw-r--r--engines/titanic/game/gondolier/gondolier_chest.cpp29
-rw-r--r--engines/titanic/game/gondolier/gondolier_chest.h4
-rw-r--r--engines/titanic/game/gondolier/gondolier_face.cpp23
-rw-r--r--engines/titanic/game/gondolier/gondolier_face.h7
-rw-r--r--engines/titanic/game/gondolier/gondolier_mixer.cpp152
-rw-r--r--engines/titanic/game/gondolier/gondolier_mixer.h17
-rw-r--r--engines/titanic/game/television.cpp2
-rw-r--r--engines/titanic/game/transport/gondolier.cpp17
-rw-r--r--engines/titanic/game/transport/gondolier.h5
-rw-r--r--engines/titanic/messages/messages.h4
24 files changed, 559 insertions, 49 deletions
diff --git a/engines/titanic/carry/fruit.cpp b/engines/titanic/carry/fruit.cpp
index 832dccf45a..68f3af7229 100644
--- a/engines/titanic/carry/fruit.cpp
+++ b/engines/titanic/carry/fruit.cpp
@@ -21,9 +21,17 @@
*/
#include "titanic/carry/fruit.h"
+#include "titanic/npcs/character.h"
namespace Titanic {
+BEGIN_MESSAGE_MAP(CFruit, CCarry)
+ ON_MESSAGE(UseWithCharMsg)
+ ON_MESSAGE(LemonFallsFromTreeMsg)
+ ON_MESSAGE(UseWithOtherMsg)
+ ON_MESSAGE(FrameMsg)
+END_MESSAGE_MAP()
+
CFruit::CFruit() : CCarry(), _field12C(0),
_field130(0), _field134(0), _field138(0) {
}
@@ -48,4 +56,43 @@ void CFruit::load(SimpleFile *file) {
CCarry::load(file);
}
+bool CFruit::UseWithCharMsg(CUseWithCharMsg *msg) {
+ if (msg->_character->isEquals("Barbot") && msg->_character->_visible) {
+ CActMsg actMsg("Fruit");
+ actMsg.execute(msg->_character);
+ _fieldE0 = 0;
+ setVisible(false);
+ return true;
+ } else {
+ return CCarry::UseWithCharMsg(msg);
+ }
+}
+
+bool CFruit::LemonFallsFromTreeMsg(CLemonFallsFromTreeMsg *msg) {
+ setVisible(true);
+ dragMove(msg->_pt);
+ _field130 = 1;
+ return true;
+}
+
+bool CFruit::UseWithOtherMsg(CUseWithOtherMsg *msg) {
+ petAddToInventory();
+ return true;
+}
+
+bool CFruit::FrameMsg(CFrameMsg *msg) {
+ if (_field130) {
+ if (_bounds.top > 240) {
+ _field130 = 0;
+ _field134 = 1;
+ }
+
+ makeDirty();
+ _bounds.top += 3;
+ makeDirty();
+ }
+
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/carry/fruit.h b/engines/titanic/carry/fruit.h
index 93fe920740..bcbd314de8 100644
--- a/engines/titanic/carry/fruit.h
+++ b/engines/titanic/carry/fruit.h
@@ -28,6 +28,11 @@
namespace Titanic {
class CFruit : public CCarry {
+ DECLARE_MESSAGE_MAP;
+ bool UseWithCharMsg(CUseWithCharMsg *msg);
+ bool LemonFallsFromTreeMsg(CLemonFallsFromTreeMsg *msg);
+ bool UseWithOtherMsg(CUseWithOtherMsg *msg);
+ bool FrameMsg(CFrameMsg *msg);
private:
int _field12C;
int _field130;
diff --git a/engines/titanic/carry/glass.cpp b/engines/titanic/carry/glass.cpp
index 051457af03..03050dc60d 100644
--- a/engines/titanic/carry/glass.cpp
+++ b/engines/titanic/carry/glass.cpp
@@ -21,9 +21,21 @@
*/
#include "titanic/carry/glass.h"
+#include "titanic/carry/chicken.h"
+#include "titanic/game/sauce_dispensor.h"
+#include "titanic/npcs/character.h"
namespace Titanic {
+BEGIN_MESSAGE_MAP(CGlass, CCarry)
+ ON_MESSAGE(UseWithOtherMsg)
+ ON_MESSAGE(UseWithCharMsg)
+ ON_MESSAGE(ActMsg)
+ ON_MESSAGE(MouseDragEndMsg)
+ ON_MESSAGE(TurnOn)
+ ON_MESSAGE(TurnOff)
+END_MESSAGE_MAP()
+
CGlass::CGlass() : CCarry(), _string6("None") {
}
@@ -39,4 +51,108 @@ void CGlass::load(SimpleFile *file) {
CCarry::load(file);
}
+bool CGlass::UseWithOtherMsg(CUseWithOtherMsg *msg) {
+ CSauceDispensor *dispensor = dynamic_cast<CSauceDispensor *>(msg->_other);
+ CChicken *chicken = dynamic_cast<CChicken *>(msg->_other);
+
+ if (dispensor && _string6 != "None") {
+ CUse useMsg(this);
+ useMsg.execute(dispensor);
+ } else if (msg->_other->isEquals("Chicken") && _string6 != "None") {
+ if (chicken->_string6 != "None") {
+ if (!chicken->_field12C) {
+ CActMsg actMsg(_string6);
+ actMsg.execute("Chicken");
+ }
+
+ _string6 = "None";
+ loadFrame(0);
+ _visibleFrame = 0;
+ }
+
+ petAddToInventory();
+ } else if (msg->_other->isEquals("Napkin") && _string6 != "None") {
+ petAddToInventory();
+ _string6 = "None";
+ loadFrame(0);
+ _visibleFrame = 0;
+ } else {
+ petAddToInventory();
+ }
+
+ return true;
+}
+
+bool CGlass::UseWithCharMsg(CUseWithCharMsg *msg) {
+ if (msg->_character->isEquals("Barbot") && msg->_character->_visible) {
+ CActMsg actMsg(_string6);
+ setVisible(false);
+
+ if (_string6 != "Bird")
+ setPosition(_origPos);
+
+ actMsg.execute(msg->_character);
+ } else {
+ petAddToInventory();
+ }
+
+ return true;
+}
+
+bool CGlass::ActMsg(CActMsg *msg) {
+ if (msg->_action == "GoToPET") {
+ setVisible(true);
+ petAddToInventory();
+ } else if (msg->_action == "Mustard") {
+ _string6 = "Mustard";
+ loadFrame(1);
+ _visibleFrame = 1;
+ } else if (msg->_action == "Tomato") {
+ _string6 = "Tomato";
+ loadFrame(2);
+ _visibleFrame = 2;
+ } else if (msg->_action == "Bird") {
+ _string6 = "Bird";
+ loadFrame(3);
+ _visibleFrame = 3;
+ } else if (msg->_action == "InTitilator") {
+ _string6 = "None";
+ loadFrame(0);
+ _visibleFrame = 0;
+ }
+
+ return true;
+}
+
+bool CGlass::MouseDragEndMsg(CMouseDragEndMsg *msg) {
+ showMouse();
+ if (msg->_dropTarget) {
+ error("TODO: See what drop target is");
+ CCharacter *npc = dynamic_cast<CCharacter *>(msg->_dropTarget);
+ if (npc) {
+ CUseWithCharMsg useMsg(npc);
+ useMsg.execute(this);
+ } else {
+ CUseWithOtherMsg otherMsg(npc);
+ otherMsg.execute(this);
+ }
+ } else if (compareViewNameTo(_fullViewName) && msg->_mousePos.y < 360) {
+ setPosition(_origPos);
+ } else {
+ petAddToInventory();
+ }
+
+ return true;
+}
+
+bool CGlass::TurnOn(CTurnOn *msg) {
+ setVisible(true);
+ return true;
+}
+
+bool CGlass::TurnOff(CTurnOff *msg) {
+ setVisible(false);
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/carry/glass.h b/engines/titanic/carry/glass.h
index 9f4056b1be..85443840a1 100644
--- a/engines/titanic/carry/glass.h
+++ b/engines/titanic/carry/glass.h
@@ -28,6 +28,13 @@
namespace Titanic {
class CGlass : public CCarry {
+ DECLARE_MESSAGE_MAP;
+ bool UseWithOtherMsg(CUseWithOtherMsg *msg);
+ bool UseWithCharMsg(CUseWithCharMsg *msg);
+ bool ActMsg(CActMsg *msg);
+ bool MouseDragEndMsg(CMouseDragEndMsg *msg);
+ bool TurnOn(CTurnOn *msg);
+ bool TurnOff(CTurnOff *msg);
private:
CString _string6;
public:
diff --git a/engines/titanic/game/floor_indicator.cpp b/engines/titanic/game/floor_indicator.cpp
index 360232c38c..3afb03c59d 100644
--- a/engines/titanic/game/floor_indicator.cpp
+++ b/engines/titanic/game/floor_indicator.cpp
@@ -21,9 +21,14 @@
*/
#include "titanic/game/floor_indicator.h"
+#include "titanic/pet_control/pet_control.h"
namespace Titanic {
+BEGIN_MESSAGE_MAP(CFloorIndicator, CGameObject)
+ ON_MESSAGE(EnterViewMsg)
+END_MESSAGE_MAP()
+
void CFloorIndicator::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CGameObject::save(file, indent);
@@ -34,4 +39,10 @@ void CFloorIndicator::load(SimpleFile *file) {
CGameObject::load(file);
}
+bool CFloorIndicator::EnterViewMsg(CEnterViewMsg *msg) {
+ int floorNum = MAX(1, getPetControl()->getRoomsFloorNum());
+ loadFrame(floorNum - 1);
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/floor_indicator.h b/engines/titanic/game/floor_indicator.h
index 066209e52e..38a1757ad0 100644
--- a/engines/titanic/game/floor_indicator.h
+++ b/engines/titanic/game/floor_indicator.h
@@ -28,6 +28,8 @@
namespace Titanic {
class CFloorIndicator : public CGameObject {
+ DECLARE_MESSAGE_MAP;
+ bool EnterViewMsg(CEnterViewMsg *msg);
public:
CLASSDEF;
diff --git a/engines/titanic/game/games_console.cpp b/engines/titanic/game/games_console.cpp
index b7500f9dd9..40311f70ee 100644
--- a/engines/titanic/game/games_console.cpp
+++ b/engines/titanic/game/games_console.cpp
@@ -24,16 +24,42 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CGamesConsole, CBackground)
+ ON_MESSAGE(MouseButtonDownMsg)
+ ON_MESSAGE(LeaveViewMsg)
+END_MESSAGE_MAP()
+
void CGamesConsole::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeNumberLine(_fieldE0, indent);
+ file->writeNumberLine(_active, indent);
CBackground::save(file, indent);
}
void CGamesConsole::load(SimpleFile *file) {
file->readNumber();
- _fieldE0 = file->readNumber();
+ _active = file->readNumber();
CBackground::load(file);
}
+bool CGamesConsole::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+ if (_active) {
+ playMovie(23, 44, 0);
+ _active = false;
+ } else {
+ playMovie(0, 23, 0);
+ _active = true;
+ }
+
+ return true;
+}
+
+bool CGamesConsole::LeaveViewMsg(CLeaveViewMsg *msg) {
+ if (_active) {
+ _active = false;
+ playMovie(23, 44, MOVIE_GAMESTATE);
+ }
+
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/games_console.h b/engines/titanic/game/games_console.h
index 2b1da70e96..f849fd08cc 100644
--- a/engines/titanic/game/games_console.h
+++ b/engines/titanic/game/games_console.h
@@ -28,11 +28,14 @@
namespace Titanic {
class CGamesConsole : public CBackground {
+ DECLARE_MESSAGE_MAP;
+ bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+ bool LeaveViewMsg(CLeaveViewMsg *msg);
public:
- int _fieldE0;
+ bool _active;
public:
CLASSDEF;
- CGamesConsole() : CBackground(), _fieldE0(0) {}
+ CGamesConsole() : CBackground(), _active(false) {}
/**
* Save the data for the class to file
diff --git a/engines/titanic/game/get_lift_eye2.cpp b/engines/titanic/game/get_lift_eye2.cpp
index 7747f7b0c2..914f306f0e 100644
--- a/engines/titanic/game/get_lift_eye2.cpp
+++ b/engines/titanic/game/get_lift_eye2.cpp
@@ -21,34 +21,80 @@
*/
#include "titanic/game/get_lift_eye2.h"
+#include "titanic/game/transport/lift.h"
+#include "titanic/core/project_item.h"
+#include "titanic/pet_control/pet_control.h"
namespace Titanic {
-CString *CGetLiftEye2::_v1;
+BEGIN_MESSAGE_MAP(CGetLiftEye2, CGameObject)
+ ON_MESSAGE(ActMsg)
+ ON_MESSAGE(EnterRoomMsg)
+ ON_MESSAGE(VisibleMsg)
+ ON_MESSAGE(MouseDragStartMsg)
+END_MESSAGE_MAP()
+
+CString *CGetLiftEye2::_destObject;
void CGetLiftEye2::init() {
- _v1 = new CString();
+ _destObject = new CString();
}
void CGetLiftEye2::deinit() {
- delete _v1;
+ delete _destObject;
}
void CGetLiftEye2::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeQuotedLine(*_v1, indent);
+ file->writeQuotedLine(*_destObject, indent);
CGameObject::save(file, indent);
}
void CGetLiftEye2::load(SimpleFile *file) {
file->readNumber();
- *_v1 = file->readString();
+ *_destObject = file->readString();
CGameObject::load(file);
}
+bool CGetLiftEye2::ActMsg(CActMsg *msg) {
+ *_destObject = msg->_action;
+ setVisible(true);
+ return true;
+}
+
bool CGetLiftEye2::EnterRoomMsg(CEnterRoomMsg *msg) {
- warning("CGetLiftEye2::handleEvent");
+ CPetControl *pet = getPetControl();
+ if (pet->getRoomsElevatorNum() == 4 && CLift::_v1 == 1 && !CLift::_v6) {
+ _cursorId = CURSOR_HAND;
+ setVisible(true);
+ } else {
+ _cursorId = CURSOR_ARROW;
+ setVisible(false);
+ }
+
return true;
}
+bool CGetLiftEye2::VisibleMsg(CVisibleMsg *msg) {
+ setVisible(true);
+ _cursorId = CURSOR_HAND;
+ return true;
+}
+
+bool CGetLiftEye2::MouseDragStartMsg(CMouseDragStartMsg *msg) {
+ if (checkPoint(msg->_mousePos, false, true)) {
+ _cursorId = CURSOR_ARROW;
+ setVisible(false);
+ CActMsg actMsg("EyeNotHead");
+ actMsg.execute(*_destObject);
+ CPassOnDragStartMsg dragMsg(msg->_mousePos, 1);
+ dragMsg.execute(*_destObject);
+
+ msg->_dragItem = getRoot()->findByName(*_destObject);
+ return true;
+ } else {
+ return false;
+ }
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/get_lift_eye2.h b/engines/titanic/game/get_lift_eye2.h
index 496784a3c1..c0dd49206e 100644
--- a/engines/titanic/game/get_lift_eye2.h
+++ b/engines/titanic/game/get_lift_eye2.h
@@ -28,9 +28,13 @@
namespace Titanic {
class CGetLiftEye2 : public CGameObject {
+ DECLARE_MESSAGE_MAP;
+ bool ActMsg(CActMsg *msg);
bool EnterRoomMsg(CEnterRoomMsg *msg);
+ bool VisibleMsg(CVisibleMsg *msg);
+ bool MouseDragStartMsg(CMouseDragStartMsg *msg);
public:
- static CString *_v1;
+ static CString *_destObject;
public:
CLASSDEF;
static void init();
diff --git a/engines/titanic/game/glass_smasher.cpp b/engines/titanic/game/glass_smasher.cpp
index 8c33124a47..2123f2dfd0 100644
--- a/engines/titanic/game/glass_smasher.cpp
+++ b/engines/titanic/game/glass_smasher.cpp
@@ -24,6 +24,11 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CGlassSmasher, CGameObject)
+ ON_MESSAGE(StatusChangeMsg)
+ ON_MESSAGE(MovieEndMsg)
+END_MESSAGE_MAP()
+
void CGlassSmasher::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CGameObject::save(file, indent);
@@ -34,4 +39,18 @@ void CGlassSmasher::load(SimpleFile *file) {
CGameObject::load(file);
}
+bool CGlassSmasher::StatusChangeMsg(CStatusChangeMsg *msg) {
+ setVisible(true);
+ playSound("b#40.wav");
+ playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
+ return true;
+}
+
+bool CGlassSmasher::MovieEndMsg(CMovieEndMsg *msg) {
+ setVisible(false);
+ CVisibleMsg visibleMsg(true);
+ visibleMsg.execute("LongStickDispenser");
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/glass_smasher.h b/engines/titanic/game/glass_smasher.h
index 7e38f4e36b..e1eef6f87a 100644
--- a/engines/titanic/game/glass_smasher.h
+++ b/engines/titanic/game/glass_smasher.h
@@ -28,6 +28,9 @@
namespace Titanic {
class CGlassSmasher : public CGameObject {
+ DECLARE_MESSAGE_MAP;
+ bool StatusChangeMsg(CStatusChangeMsg *msg);
+ bool MovieEndMsg(CMovieEndMsg *msg);
public:
CLASSDEF;
diff --git a/engines/titanic/game/gondolier/gondolier_base.cpp b/engines/titanic/game/gondolier/gondolier_base.cpp
index 1f7339cf38..f3dc31c9f5 100644
--- a/engines/titanic/game/gondolier/gondolier_base.cpp
+++ b/engines/titanic/game/gondolier/gondolier_base.cpp
@@ -24,12 +24,16 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CGondolierBase, CGameObject)
+ ON_MESSAGE(PuzzleSolvedMsg)
+END_MESSAGE_MAP()
+
int CGondolierBase::_v1;
-int CGondolierBase::_v2;
-int CGondolierBase::_v3;
+bool CGondolierBase::_puzzleSolved;
+int CGondolierBase::_volume1;
int CGondolierBase::_v4;
int CGondolierBase::_v5;
-int CGondolierBase::_v6;
+int CGondolierBase::_volume2;
int CGondolierBase::_v7;
int CGondolierBase::_v8;
int CGondolierBase::_v9;
@@ -38,11 +42,11 @@ int CGondolierBase::_v10;
void CGondolierBase::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_v1, indent);
- file->writeNumberLine(_v2, indent);
- file->writeNumberLine(_v3, indent);
+ file->writeNumberLine(_puzzleSolved, indent);
+ file->writeNumberLine(_volume1, indent);
file->writeNumberLine(_v4, indent);
file->writeNumberLine(_v5, indent);
- file->writeNumberLine(_v6, indent);
+ file->writeNumberLine(_volume2, indent);
file->writeNumberLine(_v7, indent);
file->writeNumberLine(_v8, indent);
file->writeNumberLine(_v9, indent);
@@ -54,11 +58,11 @@ void CGondolierBase::save(SimpleFile *file, int indent) {
void CGondolierBase::load(SimpleFile *file) {
file->readNumber();
_v1 = file->readNumber();
- _v2 = file->readNumber();
- _v3 = file->readNumber();
+ _puzzleSolved = file->readNumber();
+ _volume1 = file->readNumber();
_v4 = file->readNumber();
_v5 = file->readNumber();
- _v6 = file->readNumber();
+ _volume2 = file->readNumber();
_v7 = file->readNumber();
_v8 = file->readNumber();
_v9 = file->readNumber();
@@ -67,4 +71,9 @@ void CGondolierBase::load(SimpleFile *file) {
CGameObject::load(file);
}
+bool CGondolierBase::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) {
+ _puzzleSolved = true;
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/gondolier/gondolier_base.h b/engines/titanic/game/gondolier/gondolier_base.h
index a7ea2d4931..06d77ba85f 100644
--- a/engines/titanic/game/gondolier/gondolier_base.h
+++ b/engines/titanic/game/gondolier/gondolier_base.h
@@ -28,13 +28,15 @@
namespace Titanic {
class CGondolierBase : public CGameObject {
-private:
+ DECLARE_MESSAGE_MAP;
+ bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg);
+protected:
static int _v1;
- static int _v2;
- static int _v3;
+ static bool _puzzleSolved;
+ static int _volume1;
static int _v4;
static int _v5;
- static int _v6;
+ static int _volume2;
static int _v7;
static int _v8;
static int _v9;
diff --git a/engines/titanic/game/gondolier/gondolier_chest.cpp b/engines/titanic/game/gondolier/gondolier_chest.cpp
index b3e7217502..cf6656732b 100644
--- a/engines/titanic/game/gondolier/gondolier_chest.cpp
+++ b/engines/titanic/game/gondolier/gondolier_chest.cpp
@@ -24,6 +24,12 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CGondolierChest, CGondolierBase)
+ ON_MESSAGE(MouseButtonDownMsg)
+ ON_MESSAGE(MovieEndMsg)
+ ON_MESSAGE(MouseDragStartMsg)
+END_MESSAGE_MAP()
+
void CGondolierChest::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CGondolierBase::save(file, indent);
@@ -34,4 +40,27 @@ void CGondolierChest::load(SimpleFile *file) {
CGondolierBase::load(file);
}
+bool CGondolierChest::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+ if (!_v1)
+ playMovie(0, 14, MOVIE_NOTIFY_OBJECT);
+ else if (msg->_mousePos.y < 330)
+ return false;
+ else if (!_v8 && !_v5) {
+ playMovie(14, 29, 0);
+ _v1 = 0;
+ }
+
+ return true;
+}
+
+bool CGondolierChest::MovieEndMsg(CMovieEndMsg *msg) {
+ if (msg->_endFrame == 14)
+ _v1 = 1;
+ return true;
+}
+
+bool CGondolierChest::MouseDragStartMsg(CMouseDragStartMsg *msg) {
+ return false;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/gondolier/gondolier_chest.h b/engines/titanic/game/gondolier/gondolier_chest.h
index d796917371..8f069241a0 100644
--- a/engines/titanic/game/gondolier/gondolier_chest.h
+++ b/engines/titanic/game/gondolier/gondolier_chest.h
@@ -28,6 +28,10 @@
namespace Titanic {
class CGondolierChest : public CGondolierBase {
+ DECLARE_MESSAGE_MAP;
+ bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+ bool MovieEndMsg(CMovieEndMsg *msg);
+ bool MouseDragStartMsg(CMouseDragStartMsg *msg);
public:
CLASSDEF;
diff --git a/engines/titanic/game/gondolier/gondolier_face.cpp b/engines/titanic/game/gondolier/gondolier_face.cpp
index bdab8491ed..d7bcfa3561 100644
--- a/engines/titanic/game/gondolier/gondolier_face.cpp
+++ b/engines/titanic/game/gondolier/gondolier_face.cpp
@@ -24,16 +24,35 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CGondolierFace, CGondolierBase)
+ ON_MESSAGE(EnterViewMsg)
+ ON_MESSAGE(StatusChangeMsg)
+END_MESSAGE_MAP()
+
void CGondolierFace::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeNumberLine(_fieldBC, indent);
+ file->writeNumberLine(_flag, indent);
CGondolierBase::save(file, indent);
}
void CGondolierFace::load(SimpleFile *file) {
file->readNumber();
- _fieldBC = file->readNumber();
+ _flag = file->readNumber();
CGondolierBase::load(file);
}
+bool CGondolierFace::EnterViewMsg(CEnterViewMsg *msg) {
+ if (_flag)
+ playMovie(MOVIE_REPEAT);
+ else
+ setVisible(false);
+ return true;
+}
+
+bool CGondolierFace::StatusChangeMsg(CStatusChangeMsg *msg) {
+ _flag = msg->_newStatus != 1;
+ setVisible(_flag);
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/gondolier/gondolier_face.h b/engines/titanic/game/gondolier/gondolier_face.h
index 71bdd6d444..b441204d3f 100644
--- a/engines/titanic/game/gondolier/gondolier_face.h
+++ b/engines/titanic/game/gondolier/gondolier_face.h
@@ -28,11 +28,14 @@
namespace Titanic {
class CGondolierFace : public CGondolierBase {
+ DECLARE_MESSAGE_MAP;
+ bool EnterViewMsg(CEnterViewMsg *msg);
+ bool StatusChangeMsg(CStatusChangeMsg *msg);
private:
- int _fieldBC;
+ bool _flag;
public:
CLASSDEF;
- CGondolierFace() : CGondolierBase(), _fieldBC(0) {}
+ CGondolierFace() : CGondolierBase(), _flag(true) {}
/**
* Save the data for the class to file
diff --git a/engines/titanic/game/gondolier/gondolier_mixer.cpp b/engines/titanic/game/gondolier/gondolier_mixer.cpp
index 9b7b72c11b..26deda8bca 100644
--- a/engines/titanic/game/gondolier/gondolier_mixer.cpp
+++ b/engines/titanic/game/gondolier/gondolier_mixer.cpp
@@ -25,20 +25,30 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CGondolierMixer, CGondolierBase)
+ ON_MESSAGE(EnterRoomMsg)
+ ON_MESSAGE(LeaveRoomMsg)
+ ON_MESSAGE(TurnOn)
+ ON_MESSAGE(TurnOff)
+ ON_MESSAGE(SetVolumeMsg)
+ ON_MESSAGE(SignalObject)
+ ON_MESSAGE(LoadSuccessMsg)
+END_MESSAGE_MAP()
+
CGondolierMixer::CGondolierMixer() : CGondolierBase(),
- _string1("c#0.wav"), _string2("c#1.wav"),
- _fieldBC(-1), _fieldC0(-1), _fieldC4(0), _fieldC8(0),
- _fieldE4(0) {
+ _soundName1("c#0.wav"), _soundName2("c#1.wav"),
+ _soundHandle1(-1), _soundHandle2(-1), _fieldC4(0), _fieldC8(0),
+ _fieldE4(false) {
}
void CGondolierMixer::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeNumberLine(_fieldBC, indent);
- file->writeNumberLine(_fieldC0, indent);
+ file->writeNumberLine(_soundHandle1, indent);
+ file->writeNumberLine(_soundHandle2, indent);
file->writeNumberLine(_fieldC4, indent);
file->writeNumberLine(_fieldC8, indent);
- file->writeQuotedLine(_string1, indent);
- file->writeQuotedLine(_string2, indent);
+ file->writeQuotedLine(_soundName1, indent);
+ file->writeQuotedLine(_soundName2, indent);
file->writeNumberLine(_fieldE4, indent);
CGondolierBase::save(file, indent);
@@ -46,12 +56,12 @@ void CGondolierMixer::save(SimpleFile *file, int indent) {
void CGondolierMixer::load(SimpleFile *file) {
file->readNumber();
- _fieldBC = file->readNumber();
- _fieldC0 = file->readNumber();
+ _soundHandle1 = file->readNumber();
+ _soundHandle2 = file->readNumber();
_fieldC4 = file->readNumber();
_fieldC8 = file->readNumber();
- _string1 = file->readString();
- _string2 = file->readString();
+ _soundName1 = file->readString();
+ _soundName2 = file->readString();
_fieldE4 = file->readNumber();
CGondolierBase::load(file);
@@ -59,10 +69,126 @@ void CGondolierMixer::load(SimpleFile *file) {
bool CGondolierMixer::EnterRoomMsg(CEnterRoomMsg *msg) {
CRoomItem *parentRoom = dynamic_cast<CRoomItem *>(getParent());
- if (parentRoom == msg->_newRoom)
- msg->execute(parentRoom);
+ if (parentRoom == msg->_newRoom) {
+ CTurnOn onMsg;
+ onMsg.execute(this);
+ }
return true;
}
+bool CGondolierMixer::LeaveRoomMsg(CLeaveRoomMsg *msg) {
+ CRoomItem *parentRoom = dynamic_cast<CRoomItem *>(getParent());
+ if (parentRoom == msg->_oldRoom) {
+ CTurnOff offMsg;
+ offMsg.execute(this);
+ }
+
+ return true;
+}
+
+bool CGondolierMixer::TurnOn(CTurnOn *msg) {
+ if (!_puzzleSolved) {
+ if (_soundHandle1 == -1) {
+ _soundHandle1 = playSound(_soundName1, _volume1 * _v4 / 10, 0, true);
+ _fieldE4 = true;
+ }
+
+ if (_soundHandle2 == -1) {
+ _soundHandle2 = playSound(_soundName1, _volume2 * _v7 / 10, 0, true);
+ _fieldE4 = true;
+ }
+ }
+
+ return true;
+}
+
+bool CGondolierMixer::TurnOff(CTurnOff *msg) {
+ if (_soundHandle1 != -1) {
+ if (isSoundActive(_soundHandle1))
+ stopSound(_soundHandle1, 2);
+
+ _soundHandle1 = -1;
+ _fieldE4 = false;
+ }
+
+ if (_soundHandle2 != -1) {
+ if (isSoundActive(_soundHandle2))
+ stopSound(_soundHandle2, 2);
+
+ _soundHandle2 = -1;
+ _fieldE4 = false;
+ }
+
+ return true;
+}
+
+bool CGondolierMixer::SetVolumeMsg(CSetVolumeMsg *msg) {
+ if (!_puzzleSolved) {
+ _volume1 = _volume2 = msg->_volume;
+
+ if (_soundHandle1 != -1 && isSoundActive(_soundHandle1))
+ setSoundVolume(_soundHandle1, msg->_volume * _v4 / 10, 2);
+ if (_soundHandle2 != -1 && isSoundActive(_soundHandle2))
+ setSoundVolume(_soundHandle2, msg->_volume * _v7 / 10, 2);
+ }
+
+ return true;
+}
+
+bool CGondolierMixer::SignalObject(CSignalObject *msg) {
+ if (!_puzzleSolved) {
+ if (msg->_strValue == "Fly") {
+ _v4 = CLIP(msg->_numValue, 0, 10);
+
+ if (!_v8) {
+ _v7 = 10 - _v4;
+ CStatusChangeMsg statusMsg;
+ statusMsg._newStatus = _v7;
+ statusMsg.execute("GondolierRightLever");
+ }
+ }
+
+ if (msg->_strValue == "Tos") {
+ _v7 = CLIP(msg->_numValue, 0, 10);
+
+ if (!_v5) {
+ _v4 = 10 - _v7;
+ CStatusChangeMsg statusMsg;
+ statusMsg._newStatus = _v4;
+ statusMsg.execute("GondolierLeftLever");
+ }
+ }
+
+ if (!_v4 && !_v7 && _v5 && _v8) {
+ _puzzleSolved = true;
+ CStatusChangeMsg statusMsg;
+ statusMsg._newStatus = 1;
+ statusMsg.execute("GondolierFace");
+ CTurnOff offMsg;
+ offMsg.execute(this);
+ CVisibleMsg visibleMsg;
+ visibleMsg.execute("Mouth");
+
+ playSound("z#47.wav");
+ } else {
+ CSetVolumeMsg volumeMsg(_volume1, 2);
+ volumeMsg.execute(this);
+ }
+ }
+
+ return true;
+}
+
+bool CGondolierMixer::LoadSuccessMsg(CLoadSuccessMsg *msg) {
+ if (_fieldE4) {
+ _fieldE4 = 0;
+ _soundHandle1 = _soundHandle2 = -1;
+ CTurnOn onMsg;
+ onMsg.execute(this);
+ }
+
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/gondolier/gondolier_mixer.h b/engines/titanic/game/gondolier/gondolier_mixer.h
index 247e520ba6..167650f5bb 100644
--- a/engines/titanic/game/gondolier/gondolier_mixer.h
+++ b/engines/titanic/game/gondolier/gondolier_mixer.h
@@ -29,15 +29,22 @@
namespace Titanic {
class CGondolierMixer : public CGondolierBase {
+ DECLARE_MESSAGE_MAP;
bool EnterRoomMsg(CEnterRoomMsg *msg);
+ bool LeaveRoomMsg(CLeaveRoomMsg *msg);
+ bool TurnOn(CTurnOn *msg);
+ bool TurnOff(CTurnOff *msg);
+ bool SetVolumeMsg(CSetVolumeMsg *msg);
+ bool SignalObject(CSignalObject *msg);
+ bool LoadSuccessMsg(CLoadSuccessMsg *msg);
private:
- int _fieldBC;
- int _fieldC0;
+ int _soundHandle1;
+ int _soundHandle2;
int _fieldC4;
int _fieldC8;
- CString _string1;
- CString _string2;
- int _fieldE4;
+ CString _soundName1;
+ CString _soundName2;
+ bool _fieldE4;
public:
CLASSDEF;
CGondolierMixer();
diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp
index af6bdb8c03..b3c10d4ca4 100644
--- a/engines/titanic/game/television.cpp
+++ b/engines/titanic/game/television.cpp
@@ -251,7 +251,7 @@ bool CTelevision::MovieEndMsg(CMovieEndMsg *msg) {
loadFrame(502);
else
warning("There is currently nothing available for your viewing pleasure on this channel.");
- } else if (_fieldE0 == 5 && *CGetLiftEye2::_v1 != "NULL") {
+ } else if (_fieldE0 == 5 && *CGetLiftEye2::_destObject != "NULL") {
loadFrame(393 + _v4);
} else {
warning("There is currently nothing available for your viewing pleasure on this channel.");
diff --git a/engines/titanic/game/transport/gondolier.cpp b/engines/titanic/game/transport/gondolier.cpp
index f731e45bde..8c28ff9b66 100644
--- a/engines/titanic/game/transport/gondolier.cpp
+++ b/engines/titanic/game/transport/gondolier.cpp
@@ -24,14 +24,31 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CGondolier, CTransport)
+ ON_MESSAGE(StatusChangeMsg)
+END_MESSAGE_MAP()
+
+int CGondolier::_v1;
+int CGondolier::_v2;
+
void CGondolier::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
+ file->writeNumberLine(_v1, indent);
+ file->writeNumberLine(_v2, indent);
CTransport::save(file, indent);
}
void CGondolier::load(SimpleFile *file) {
file->readNumber();
+ _v1 = file->readNumber();
+ _v2 = file->readNumber();
CTransport::load(file);
}
+bool CGondolier::StatusChangeMsg(CStatusChangeMsg *msg) {
+ CShowTextMsg textMsg("Only First Class passengers are allowed to use the Gondoliers.");
+ textMsg.execute("PET");
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/transport/gondolier.h b/engines/titanic/game/transport/gondolier.h
index ac1617256f..3b1e6d5a8a 100644
--- a/engines/titanic/game/transport/gondolier.h
+++ b/engines/titanic/game/transport/gondolier.h
@@ -28,6 +28,11 @@
namespace Titanic {
class CGondolier : public CTransport {
+ DECLARE_MESSAGE_MAP;
+ bool StatusChangeMsg(CStatusChangeMsg *msg);
+private:
+ static int _v1;
+ static int _v2;
public:
CLASSDEF;
diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h
index 4c1fb4f19c..6a3961962b 100644
--- a/engines/titanic/messages/messages.h
+++ b/engines/titanic/messages/messages.h
@@ -236,7 +236,7 @@ MESSAGE2(CEnterRoomMsg, CRoomItem *, oldRoom, nullptr, CRoomItem *, newRoom, nul
MESSAGE2(CEnterViewMsg, CViewItem *, oldView, nullptr, CViewItem *, newView, nullptr);
MESSAGE0(CErasePhonographCylinderMsg);
MESSAGE1(CFrameMsg, uint, ticks, 0);
-MESSAGE2(CFreshenCookieMsg, int, value1, 0, int, value2, 0);
+MESSAGE2(CFreshenCookieMsg, int, value1, 0, int, value2, 1);
MESSAGE1(CGetChevClassBits, int, classBits, 0);
MESSAGE1(CGetChevClassNum, int, classNum, 0);
MESSAGE2(CGetChevCodeFromRoomNameMsg, CString, roomName, "", uint, chevCode, 0);
@@ -255,7 +255,7 @@ MESSAGE1(CKeyCharMsg, int, key, 32);
MESSAGE2(CLeaveNodeMsg, CNodeItem *, oldNode, nullptr, CNodeItem *, newNode, nullptr);
MESSAGE2(CLeaveRoomMsg, CRoomItem *, oldRoom, nullptr, CRoomItem *, newRoom, nullptr);
MESSAGE2(CLeaveViewMsg, CViewItem *, oldView, nullptr, CViewItem *, newView, nullptr);
-MESSAGE2(CLemonFallsFromTreeMsg, int, value1, 0, int, value2, 0);
+MESSAGE1(CLemonFallsFromTreeMsg, Point, pt, Point());
MESSAGE1(CLoadSuccessMsg, int, ticks, 0);
MESSAGE1(CLockPhonographMsg, int, value, 0);
MESSAGE0(CMaitreDDefeatedMsg);