From 6a4e7c3d731fba108b1da34413f60a3490529291 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 16 Apr 2016 13:11:17 -0400 Subject: TITANIC: Implement CCrushedTV message handlers --- engines/titanic/carry/crushed_tv.cpp | 40 ++++++++++++++++++++++++++++++++++++ engines/titanic/carry/crushed_tv.h | 6 ++++++ 2 files changed, 46 insertions(+) (limited to 'engines/titanic/carry') diff --git a/engines/titanic/carry/crushed_tv.cpp b/engines/titanic/carry/crushed_tv.cpp index a0a7ee7a43..5abc8fac98 100644 --- a/engines/titanic/carry/crushed_tv.cpp +++ b/engines/titanic/carry/crushed_tv.cpp @@ -21,9 +21,16 @@ */ #include "titanic/carry/crushed_tv.h" +#include "titanic/npcs/character.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CCrushedTV, CCarry) + ON_MESSAGE(ActMsg) + ON_MESSAGE(UseWithCharMsg) + ON_MESSAGE(MouseDragStartMsg) +END_MESSAGE_MAP() + CCrushedTV::CCrushedTV() : CCarry() { } @@ -37,4 +44,37 @@ void CCrushedTV::load(SimpleFile *file) { CCarry::load(file); } +bool CCrushedTV::ActMsg(CActMsg *msg) { + if (msg->_action == "SmashTV") { + setVisible(true); + _fieldE0 = 1; + } + + return true; +} + +bool CCrushedTV::UseWithCharMsg(CUseWithCharMsg *msg) { + if (msg->_character->getName() == "Barbot" && msg->_character->_visible) { + setVisible(false); + CActMsg actMsg("CrushedTV"); + actMsg.execute(msg->_character); + return true; + } else { + return CCarry::UseWithCharMsg(msg); + } +} + +bool CCrushedTV::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (!checkStartDragging(msg)) { + return false; + } else if (compareViewNameTo("BottomOfWell.Node 7.N")) { + changeView("BottomOfWell.Node 12.N", ""); + CActMsg actMsg("TelevisionTaken"); + actMsg.execute("BOWTelevisionMonitor"); + } + + return CCarry::MouseDragStartMsg(msg); +} + + } // End of namespace Titanic diff --git a/engines/titanic/carry/crushed_tv.h b/engines/titanic/carry/crushed_tv.h index b2bfd7580e..3e7753499d 100644 --- a/engines/titanic/carry/crushed_tv.h +++ b/engines/titanic/carry/crushed_tv.h @@ -24,10 +24,16 @@ #define TITANIC_CRUSHED_TV_H #include "titanic/carry/carry.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" namespace Titanic { class CCrushedTV : public CCarry { + DECLARE_MESSAGE_MAP + bool ActMsg(CActMsg *msg); + bool UseWithCharMsg(CUseWithCharMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); public: CLASSDEF CCrushedTV(); -- cgit v1.2.3