aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/carry
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-22 21:52:29 -0400
committerPaul Gilbert2016-08-22 21:52:29 -0400
commitdf3e545976f401e4be999eb1c8fa9726b9dfcb38 (patch)
treeb2142a922f5ade01d95fdc5cb197d0dae29219f0 /engines/titanic/carry
parent2822fb5811dd4764a5d5dda5f77ce8f838b604e8 (diff)
downloadscummvm-rg350-df3e545976f401e4be999eb1c8fa9726b9dfcb38.tar.gz
scummvm-rg350-df3e545976f401e4be999eb1c8fa9726b9dfcb38.tar.bz2
scummvm-rg350-df3e545976f401e4be999eb1c8fa9726b9dfcb38.zip
TITANIC: Implemented more game classes
Diffstat (limited to 'engines/titanic/carry')
-rw-r--r--engines/titanic/carry/hose.cpp71
-rw-r--r--engines/titanic/carry/hose.h11
-rw-r--r--engines/titanic/carry/key.cpp20
-rw-r--r--engines/titanic/carry/key.h3
4 files changed, 99 insertions, 6 deletions
diff --git a/engines/titanic/carry/hose.cpp b/engines/titanic/carry/hose.cpp
index 747d58c339..e90119138a 100644
--- a/engines/titanic/carry/hose.cpp
+++ b/engines/titanic/carry/hose.cpp
@@ -21,9 +21,18 @@
*/
#include "titanic/carry/hose.h"
+#include "titanic/npcs/succubus.h"
namespace Titanic {
+BEGIN_MESSAGE_MAP(CHose, CCarry)
+ ON_MESSAGE(DropZoneGotObjectMsg)
+ ON_MESSAGE(PumpingMsg)
+ ON_MESSAGE(UseWithCharMsg)
+ ON_MESSAGE(HoseConnectedMsg)
+ ON_MESSAGE(DropZoneLostObjectMsg)
+END_MESSAGE_MAP()
+
CHoseStatics *CHose::_statics;
void CHose::init() {
@@ -40,18 +49,72 @@ CHose::CHose() : CCarry(),
void CHose::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeNumberLine(_statics->_v1, indent);
- file->writeQuotedLine(_statics->_v2, indent);
+ file->writeNumberLine(_statics->_actionVal, indent);
+ file->writeQuotedLine(_statics->_actionTarget, indent);
file->writeQuotedLine(_string6, indent);
CCarry::save(file, indent);
}
void CHose::load(SimpleFile *file) {
file->readNumber();
- _statics->_v1 = file->readNumber();
- _statics->_v2 = file->readString();
+ _statics->_actionVal = file->readNumber();
+ _statics->_actionTarget = file->readString();
_string6 = file->readString();
CCarry::load(file);
}
+bool CHose::DropZoneGotObjectMsg(CDropZoneGotObjectMsg *msg) {
+ _statics->_actionTarget = msg->_object->getName();
+ CPumpingMsg pumpingMsg;
+ pumpingMsg._value = _statics->_actionVal;
+ pumpingMsg.execute(_statics->_actionTarget);
+ CHoseConnectedMsg connectedMsg;
+ connectedMsg._value = 1;
+ connectedMsg.execute(this);
+
+ return true;
+}
+
+bool CHose::PumpingMsg(CPumpingMsg *msg) {
+ _statics->_actionVal = msg->_value;
+ if (!_statics->_actionTarget.empty()) {
+ CPumpingMsg pumpingMsg;
+ pumpingMsg._value = _statics->_actionVal;
+ pumpingMsg.execute(_statics->_actionTarget);
+ }
+
+ return true;
+}
+
+bool CHose::UseWithCharMsg(CUseWithCharMsg *msg) {
+ CSuccUBus *succubus = dynamic_cast<CSuccUBus *>(msg->_character);
+ if (!_statics->_actionVal && succubus) {
+ CHoseConnectedMsg connectedMsg(1, this);
+ if (connectedMsg.execute(succubus))
+ return true;
+ }
+
+ return CCarry::UseWithCharMsg(msg);
+}
+
+bool CHose::HoseConnectedMsg(CHoseConnectedMsg *msg) {
+ if (msg->_value) {
+ CHose *hose = dynamic_cast<CHose *>(findChildInstanceOf(CHose::_type));
+ if (hose) {
+ setVisible(true);
+ petAddToInventory();
+ }
+ }
+
+ return true;
+}
+
+bool CHose::DropZoneLostObjectMsg(CDropZoneLostObjectMsg *msg) {
+ CPumpingMsg pumpingMsg;
+ pumpingMsg._value = 0;
+ pumpingMsg.execute(msg->_object);
+
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/carry/hose.h b/engines/titanic/carry/hose.h
index 77ab437b8b..3c8c1549c1 100644
--- a/engines/titanic/carry/hose.h
+++ b/engines/titanic/carry/hose.h
@@ -28,11 +28,18 @@
namespace Titanic {
struct CHoseStatics {
- int _v1;
- CString _v2;
+ int _actionVal;
+ CString _actionTarget;
+ CHoseStatics() : _actionVal(0) {}
};
class CHose : public CCarry {
+ DECLARE_MESSAGE_MAP;
+ bool DropZoneGotObjectMsg(CDropZoneGotObjectMsg *msg);
+ bool PumpingMsg(CPumpingMsg *msg);
+ bool UseWithCharMsg(CUseWithCharMsg *msg);
+ bool HoseConnectedMsg(CHoseConnectedMsg *msg);
+ bool DropZoneLostObjectMsg(CDropZoneLostObjectMsg *msg);
protected:
CString _string6;
public:
diff --git a/engines/titanic/carry/key.cpp b/engines/titanic/carry/key.cpp
index 6e947464f1..187ff1b6c3 100644
--- a/engines/titanic/carry/key.cpp
+++ b/engines/titanic/carry/key.cpp
@@ -24,6 +24,11 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CKey, CCarry)
+ ON_MESSAGE(PuzzleSolvedMsg)
+ ON_MESSAGE(UseWithOtherMsg)
+END_MESSAGE_MAP()
+
CKey::CKey() : CCarry() {
}
@@ -37,4 +42,19 @@ void CKey::load(SimpleFile *file) {
CCarry::load(file);
}
+bool CKey::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) {
+ _fieldE0 = 1;
+ setVisible(true);
+ return true;
+}
+
+bool CKey::UseWithOtherMsg(CUseWithOtherMsg *msg) {
+ if (msg->_other->getName() == "1stClassPhono") {
+ CActMsg actMsg("Unlock");
+ actMsg.execute(msg->_other);
+ }
+
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/carry/key.h b/engines/titanic/carry/key.h
index 8f1600f2b3..9d3957937c 100644
--- a/engines/titanic/carry/key.h
+++ b/engines/titanic/carry/key.h
@@ -28,6 +28,9 @@
namespace Titanic {
class CKey : public CCarry {
+ DECLARE_MESSAGE_MAP;
+ bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg);
+ bool UseWithOtherMsg(CUseWithOtherMsg *msg);
public:
CLASSDEF;
CKey();