From 5cd3dd0d69dead3ca795468716353f9d7d4da7a8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 13 Apr 2016 17:37:14 -0400 Subject: TITANIC: Adding CCarry descendent msg handlers --- engines/titanic/carry/phonograph_cylinder.cpp | 35 ++++++++++++++++++++ engines/titanic/carry/phonograph_cylinder.h | 6 ++++ engines/titanic/carry/photograph.cpp | 47 +++++++++++++++++++++++++++ engines/titanic/carry/photograph.h | 8 +++++ engines/titanic/carry/plug_in.cpp | 28 ++++++++++++++++ engines/titanic/carry/plug_in.h | 2 ++ engines/titanic/carry/sweets.cpp | 8 +++++ engines/titanic/carry/sweets.h | 3 ++ 8 files changed, 137 insertions(+) (limited to 'engines/titanic/carry') diff --git a/engines/titanic/carry/phonograph_cylinder.cpp b/engines/titanic/carry/phonograph_cylinder.cpp index fb58c3214f..18e646d2bb 100644 --- a/engines/titanic/carry/phonograph_cylinder.cpp +++ b/engines/titanic/carry/phonograph_cylinder.cpp @@ -21,9 +21,18 @@ */ #include "titanic/carry/phonograph_cylinder.h" +#include "titanic/game/phonograph.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CPhonographCylinder, CCarry) + ON_MESSAGE(UseWithOtherMsg) + ON_MESSAGE(QueryCylinderMsg) + ON_MESSAGE(RecordOntoCylinderMsg) + ON_MESSAGE(SetMusicControlsMsg) + ON_MESSAGE(ErasePhonographCylinderMsg) +END_MESSAGE_MAP() + CPhonographCylinder::CPhonographCylinder() : CCarry(), _field138(0), _field13C(0), _field140(0), _field144(0), _field148(0), _field14C(0), _field150(0), _field154(0), @@ -86,4 +95,30 @@ void CPhonographCylinder::load(SimpleFile *file) { CCarry::load(file); } +bool CPhonographCylinder::UseWithOtherMsg(CUseWithOtherMsg *msg) { + CPhonograph *phonograph = static_cast(msg->_other); + if (phonograph) { + CSetVarMsg varMsg("m_RecordStatus", 1); + return true; + } else { + return CCarry::UseWithOtherMsg(msg); + } +} + +bool CPhonographCylinder::QueryCylinderMsg(CQueryCylinderMsg *msg) { + msg->_ +} + +bool CPhonographCylinder::RecordOntoCylinderMsg(CRecordOntoCylinderMsg *msg) { + +} + +bool CPhonographCylinder::SetMusicControlsMsg(CSetMusicControlsMsg *msg) { + +} + +bool CPhonographCylinder::ErasePhonographCylinderMsg(CErasePhonographCylinderMsg *msg) { + +} + } // End of namespace Titanic diff --git a/engines/titanic/carry/phonograph_cylinder.h b/engines/titanic/carry/phonograph_cylinder.h index 271ede54b0..08db4b214a 100644 --- a/engines/titanic/carry/phonograph_cylinder.h +++ b/engines/titanic/carry/phonograph_cylinder.h @@ -28,6 +28,12 @@ namespace Titanic { class CPhonographCylinder : public CCarry { + DECLARE_MESSAGE_MAP + bool UseWithOtherMsg(CUseWithOtherMsg *msg); + bool QueryCylinderMsg(CQueryCylinderMsg *msg); + bool RecordOntoCylinderMsg(CRecordOntoCylinderMsg *msg); + bool SetMusicControlsMsg(CSetMusicControlsMsg *msg); + bool ErasePhonographCylinderMsg(CErasePhonographCylinderMsg *msg); private: CString _string6; int _field138; diff --git a/engines/titanic/carry/photograph.cpp b/engines/titanic/carry/photograph.cpp index 92549b3ce5..a7c5d8d095 100644 --- a/engines/titanic/carry/photograph.cpp +++ b/engines/titanic/carry/photograph.cpp @@ -21,9 +21,17 @@ */ #include "titanic/carry/photograph.h" +#include "titanic/core/room_item.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CPhotograph, CCarry) + ON_MESSAGE(MouseDragStartMsg) + ON_MESSAGE(MouseDragEndMsg) + ON_MESSAGE(PETGainedObjectMsg) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + int CPhotograph::_v1; CPhotograph::CPhotograph() : CCarry(), _field12C(0), _field130(0) { @@ -47,4 +55,43 @@ void CPhotograph::load(SimpleFile *file) { CCarry::load(file); } +bool CPhotograph::MouseDragEndMsg(CMouseDragEndMsg *msg) { + _v1 = 0; + CGameObject *target = msg->_dropTarget; + + if (target && target->getName() != "NavigationComputer") { + warning("TODO: CPhotograph::MouseDragEndMsg"); + } else { + return CCarry::MouseDragEndMsg(msg); + } +} + +bool CPhotograph::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (checkPoint(msg->_mousePos, true, true)) { + _v1 = true; + CActMsg actMsg("PlayerPicksUpPhoto"); + actMsg.execute("Doorbot"); + } + + return CCarry::MouseDragStartMsg(msg); +} + +bool CPhotograph::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { + if (getRoom()->getName() == "Home") { + CActMsg actMsg("PlayerPutsPhotoInPET"); + actMsg.execute("Doorbot"); + } + + return true; +} + +bool CPhotograph::ActMsg(CActMsg *msg) { + if (msg->_action == "BecomeGettable") { + _fieldE0 = 1; + _cursorId = CURSOR_HAND; + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/carry/photograph.h b/engines/titanic/carry/photograph.h index 4141280a6b..b7ce488d09 100644 --- a/engines/titanic/carry/photograph.h +++ b/engines/titanic/carry/photograph.h @@ -24,10 +24,18 @@ #define TITANIC_PHOTOGRAPH_H #include "titanic/carry/carry.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" +#include "titanic/messages/pet_messages.h" namespace Titanic { class CPhotograph : public CCarry { + DECLARE_MESSAGE_MAP + bool MouseDragEndMsg(CMouseDragEndMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); + bool PETGainedObjectMsg(CPETGainedObjectMsg *msg); + bool ActMsg(CActMsg *msg); private: static int _v1; private: diff --git a/engines/titanic/carry/plug_in.cpp b/engines/titanic/carry/plug_in.cpp index ff8d9b158f..e4fe54dd27 100644 --- a/engines/titanic/carry/plug_in.cpp +++ b/engines/titanic/carry/plug_in.cpp @@ -24,6 +24,10 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CPlugIn, CCarry) + ON_MESSAGE(UseWithOtherMsg) +END_MESSAGE_MAP() + CPlugIn::CPlugIn() : CCarry(), _field12C(0) { } @@ -37,4 +41,28 @@ void CPlugIn::load(SimpleFile *file) { CCarry::load(file); } +bool CPlugIn::UseWithOtherMsg(CUseWithOtherMsg *msg) { + CGameObject *other = msg->_other; + CString otherName = other->getName(); + + if (otherName == "PET") { + return CCarry::UseWithOtherMsg(msg); + } else if (otherName == "DatasideTransporter") { + CString name = getName(); + if (name == "DatasideTransporter") { + // TODO + if (name != "SendYourself") { + // TODO + } + } else { + // TODO + } + } else { + CShowTextMsg textMsg("This item is incorrectly calibrated."); + textMsg.execute("PET"); + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/carry/plug_in.h b/engines/titanic/carry/plug_in.h index 89a483278d..f48a74bd2b 100644 --- a/engines/titanic/carry/plug_in.h +++ b/engines/titanic/carry/plug_in.h @@ -28,6 +28,8 @@ namespace Titanic { class CPlugIn : public CCarry { + DECLARE_MESSAGE_MAP + bool UseWithOtherMsg(CUseWithOtherMsg *msg); private: int _field12C; public: diff --git a/engines/titanic/carry/sweets.cpp b/engines/titanic/carry/sweets.cpp index faf3ad9dea..71295a3441 100644 --- a/engines/titanic/carry/sweets.cpp +++ b/engines/titanic/carry/sweets.cpp @@ -24,6 +24,10 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CSweets, CCarry) + ON_MESSAGE(MouseButtonUpMsg) +END_MESSAGE_MAP() + CSweets::CSweets() : CCarry() { } @@ -37,4 +41,8 @@ void CSweets::load(SimpleFile *file) { CCarry::load(file); } +bool CSweets::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/carry/sweets.h b/engines/titanic/carry/sweets.h index a18a1fbeeb..7fc0787f76 100644 --- a/engines/titanic/carry/sweets.h +++ b/engines/titanic/carry/sweets.h @@ -24,10 +24,13 @@ #define TITANIC_SWEETS_H #include "titanic/carry/carry.h" +#include "titanic/messages/mouse_messages.h" namespace Titanic { class CSweets : public CCarry { + DECLARE_MESSAGE_MAP + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); public: CLASSDEF CSweets(); -- cgit v1.2.3