aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/carry
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-15 22:31:33 -0400
committerPaul Gilbert2016-08-15 22:31:33 -0400
commit33e4afedde5a31ab97a4e1965869b30dd7964e49 (patch)
tree01d2666dffea50b1f4100541c938d8d4de08084b /engines/titanic/carry
parent7234f076f4ccf5cb427ad4abda65b4fb2d823d3b (diff)
downloadscummvm-rg350-33e4afedde5a31ab97a4e1965869b30dd7964e49.tar.gz
scummvm-rg350-33e4afedde5a31ab97a4e1965869b30dd7964e49.tar.bz2
scummvm-rg350-33e4afedde5a31ab97a4e1965869b30dd7964e49.zip
TITANIC: Implemented CHeadPiece and ear classes
Diffstat (limited to 'engines/titanic/carry')
-rw-r--r--engines/titanic/carry/bowl_ear.cpp31
-rw-r--r--engines/titanic/carry/bowl_ear.h5
-rw-r--r--engines/titanic/carry/ear.cpp27
-rw-r--r--engines/titanic/carry/ear.h3
-rw-r--r--engines/titanic/carry/head_piece.cpp50
-rw-r--r--engines/titanic/carry/head_piece.h9
-rw-r--r--engines/titanic/carry/phonograph_ear.cpp26
-rw-r--r--engines/titanic/carry/phonograph_ear.h8
8 files changed, 152 insertions, 7 deletions
diff --git a/engines/titanic/carry/bowl_ear.cpp b/engines/titanic/carry/bowl_ear.cpp
index bb5172e580..852a77899a 100644
--- a/engines/titanic/carry/bowl_ear.cpp
+++ b/engines/titanic/carry/bowl_ear.cpp
@@ -24,6 +24,13 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CBowlEar, CEar)
+ ON_MESSAGE(PETGainedObjectMsg)
+ ON_MESSAGE(ReplaceBowlAndNutsMsg)
+ ON_MESSAGE(NutPuzzleMsg)
+ ON_MESSAGE(MouseDragStartMsg)
+END_MESSAGE_MAP()
+
void CBowlEar::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CEar::save(file, indent);
@@ -34,4 +41,28 @@ void CBowlEar::load(SimpleFile *file) {
CEar::load(file);
}
+bool CBowlEar::PETGainedObjectMsg(CPETGainedObjectMsg *msg) {
+ CBowlStateChangeMsg changeMsg(3);
+ changeMsg.execute("ParrotNutBowlActor");
+
+ return CEar::PETGainedObjectMsg(msg);
+}
+
+bool CBowlEar::ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg) {
+ setVisible(false);
+ return true;
+}
+
+bool CBowlEar::NutPuzzleMsg(CNutPuzzleMsg *msg) {
+ if (msg->_value == "BowlUnlocked")
+ _fieldE0 = 1;
+
+ return true;
+}
+
+bool CBowlEar::MouseDragStartMsg(CMouseDragStartMsg *msg) {
+ setVisible(true);
+ return CEar::MouseDragStartMsg(msg);
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/carry/bowl_ear.h b/engines/titanic/carry/bowl_ear.h
index 4f2fbea478..d78092f6d7 100644
--- a/engines/titanic/carry/bowl_ear.h
+++ b/engines/titanic/carry/bowl_ear.h
@@ -28,6 +28,11 @@
namespace Titanic {
class CBowlEar : public CEar {
+ DECLARE_MESSAGE_MAP;
+ bool PETGainedObjectMsg(CPETGainedObjectMsg *msg);
+ bool ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg);
+ bool NutPuzzleMsg(CNutPuzzleMsg *msg);
+ bool MouseDragStartMsg(CMouseDragStartMsg *msg);
public:
CLASSDEF;
diff --git a/engines/titanic/carry/ear.cpp b/engines/titanic/carry/ear.cpp
index 8d85e247f7..a2234bc6dc 100644
--- a/engines/titanic/carry/ear.cpp
+++ b/engines/titanic/carry/ear.cpp
@@ -21,9 +21,15 @@
*/
#include "titanic/carry/ear.h"
+#include "titanic/game/head_slot.h"
namespace Titanic {
+BEGIN_MESSAGE_MAP(CEar, CHeadPiece)
+ ON_MESSAGE(ActMsg)
+ ON_MESSAGE(UseWithOtherMsg)
+END_MESSAGE_MAP()
+
CEar::CEar() : CHeadPiece() {
}
@@ -37,4 +43,25 @@ void CEar::load(SimpleFile *file) {
CHeadPiece::load(file);
}
+bool CEar::ActMsg(CActMsg *msg) {
+ if (msg->_action == "MusicSolved")
+ _fieldE0 = true;
+ return true;
+}
+
+bool CEar::UseWithOtherMsg(CUseWithOtherMsg *msg) {
+ CHeadSlot *slot = dynamic_cast<CHeadSlot *>(msg->_other);
+ if (slot) {
+ setVisible(false);
+ petMoveToHiddenRoom();
+ setPosition(Point(0, 0));
+
+ CAddHeadPieceMsg addMsg(getName());
+ if (addMsg._value != "NULL")
+ addMsg.execute(addMsg._value == "Ear1" ? "Ear1Slot" : "Ear2Slot");
+ }
+
+ return CCarry::UseWithOtherMsg(msg);
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/carry/ear.h b/engines/titanic/carry/ear.h
index edef873d35..a357f46bbf 100644
--- a/engines/titanic/carry/ear.h
+++ b/engines/titanic/carry/ear.h
@@ -28,6 +28,9 @@
namespace Titanic {
class CEar : public CHeadPiece {
+ DECLARE_MESSAGE_MAP;
+ bool ActMsg(CActMsg *msg);
+ bool UseWithOtherMsg(CUseWithOtherMsg *msg);
public:
CLASSDEF;
CEar();
diff --git a/engines/titanic/carry/head_piece.cpp b/engines/titanic/carry/head_piece.cpp
index ae709644a0..34850488a7 100644
--- a/engines/titanic/carry/head_piece.cpp
+++ b/engines/titanic/carry/head_piece.cpp
@@ -24,13 +24,19 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CHeadPiece, CCarry)
+ ON_MESSAGE(SenseWorkingMsg)
+ ON_MESSAGE(PETGainedObjectMsg)
+ ON_MESSAGE(MouseDragStartMsg)
+END_MESSAGE_MAP()
+
CHeadPiece::CHeadPiece() : CCarry(), _string6("Not Working"),
- _field12C(0), _field13C(0) {
+ _flag(0), _field13C(false) {
}
void CHeadPiece::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeNumberLine(_field12C, indent);
+ file->writeNumberLine(_flag, indent);
file->writeQuotedLine(_string6, indent);
file->writeNumberLine(_field13C, indent);
@@ -39,11 +45,49 @@ void CHeadPiece::save(SimpleFile *file, int indent) {
void CHeadPiece::load(SimpleFile *file) {
file->readNumber();
- _field12C = file->readNumber();
+ _flag = file->readNumber();
_string6 = file->readString();
_field13C = file->readNumber();
CCarry::load(file);
}
+bool CHeadPiece::SenseWorkingMsg(CSenseWorkingMsg *msg) {
+ _string6 = msg->_value;
+ return true;
+}
+
+bool CHeadPiece::PETGainedObjectMsg(CPETGainedObjectMsg *msg) {
+ _visibleFrame = 1;
+ if (!_field13C) {
+ stateInc38();
+ _field13C = true;
+ }
+
+ return true;
+}
+
+bool CHeadPiece::MouseDragStartMsg(CMouseDragStartMsg *msg) {
+ if (!checkPoint(msg->_mousePos, false, true)) {
+ return false;
+ } else if (!_fieldE0) {
+ return true;
+ }
+
+ if (_flag) {
+ setVisible(true);
+ moveToView();
+ setPosition(Point(msg->_mousePos.x - _bounds.width() / 2,
+ msg->_mousePos.y - _bounds.height() / 2));
+
+ CTakeHeadPieceMsg takeMsg(getName());
+ if (takeMsg._value != "NULL")
+ takeMsg.execute("TitaniaControl");
+
+ _flag = false;
+ }
+
+ return CCarry::MouseDragStartMsg(msg);
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/carry/head_piece.h b/engines/titanic/carry/head_piece.h
index 05ac772853..a76496072b 100644
--- a/engines/titanic/carry/head_piece.h
+++ b/engines/titanic/carry/head_piece.h
@@ -24,14 +24,19 @@
#define TITANIC_HEAD_PIECE_H
#include "titanic/carry/carry.h"
+#include "titanic/messages/pet_messages.h"
namespace Titanic {
class CHeadPiece : public CCarry {
+ DECLARE_MESSAGE_MAP;
+ bool SenseWorkingMsg(CSenseWorkingMsg *msg);
+ bool PETGainedObjectMsg(CPETGainedObjectMsg *msg);
+ bool MouseDragStartMsg(CMouseDragStartMsg *msg);
private:
- int _field12C;
+ bool _flag;
CString _string6;
- int _field13C;
+ bool _field13C;
public:
CLASSDEF;
CHeadPiece();
diff --git a/engines/titanic/carry/phonograph_ear.cpp b/engines/titanic/carry/phonograph_ear.cpp
index ceb71babd2..9cd461d7e0 100644
--- a/engines/titanic/carry/phonograph_ear.cpp
+++ b/engines/titanic/carry/phonograph_ear.cpp
@@ -24,6 +24,12 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CPhonographEar, CEar)
+ ON_MESSAGE(CorrectMusicPlayedMsg)
+ ON_MESSAGE(PETGainedObjectMsg)
+ ON_MESSAGE(TimerMsg)
+END_MESSAGE_MAP()
+
void CPhonographEar::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_field140, indent);
@@ -36,4 +42,24 @@ void CPhonographEar::load(SimpleFile *file) {
CEar::load(file);
}
+bool CPhonographEar::CorrectMusicPlayedMsg(CCorrectMusicPlayedMsg *msg) {
+ _fieldE0 = true;
+ return true;
+}
+
+bool CPhonographEar::PETGainedObjectMsg(CPETGainedObjectMsg *msg) {
+ if (_field140) {
+ _field140 = false;
+ addTimer(1000);
+ }
+
+ return PETGainedObjectMsg(msg);
+}
+
+bool CPhonographEar::TimerMsg(CTimerMsg *msg) {
+ CVisibleMsg visibleMsg;
+ visibleMsg.execute("Replacement Phonograph Ear");
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/carry/phonograph_ear.h b/engines/titanic/carry/phonograph_ear.h
index 582db9f7ef..b5db015f90 100644
--- a/engines/titanic/carry/phonograph_ear.h
+++ b/engines/titanic/carry/phonograph_ear.h
@@ -28,11 +28,15 @@
namespace Titanic {
class CPhonographEar : public CEar {
+ DECLARE_MESSAGE_MAP;
+ bool CorrectMusicPlayedMsg(CCorrectMusicPlayedMsg *msg);
+ bool PETGainedObjectMsg(CPETGainedObjectMsg *msg);
+ bool TimerMsg(CTimerMsg *msg);
private:
- int _field140;
+ bool _field140;
public:
CLASSDEF;
- CPhonographEar() : CEar(), _field140(1) {}
+ CPhonographEar() : CEar(), _field140(true) {}
/**
* Save the data for the class to file