diff options
author | Paul Gilbert | 2016-04-16 13:11:17 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-10 16:11:13 -0400 |
commit | 6a4e7c3d731fba108b1da34413f60a3490529291 (patch) | |
tree | 4aea379937545b1dae228e36e812480e056b0cf4 /engines/titanic | |
parent | ee2a70f466057eaebfc05118374d3def81eca6f3 (diff) | |
download | scummvm-rg350-6a4e7c3d731fba108b1da34413f60a3490529291.tar.gz scummvm-rg350-6a4e7c3d731fba108b1da34413f60a3490529291.tar.bz2 scummvm-rg350-6a4e7c3d731fba108b1da34413f60a3490529291.zip |
TITANIC: Implement CCrushedTV message handlers
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/carry/crushed_tv.cpp | 40 | ||||
-rw-r--r-- | engines/titanic/carry/crushed_tv.h | 6 | ||||
-rw-r--r-- | engines/titanic/core/game_object.cpp | 20 | ||||
-rw-r--r-- | engines/titanic/core/game_object.h | 7 |
4 files changed, 72 insertions, 1 deletions
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(); diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 016903b95c..7549797ca9 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -700,4 +700,24 @@ void CGameObject::loadSurface() { _surface->loadIfReady(); } +bool CGameObject::changeView(const CString &viewName, const CString &clipName) { + CViewItem *newView = parseView(viewName); + CGameManager *gameManager = getGameManager(); + CViewItem *oldView = gameManager->getView(); + + if (!oldView || !newView) + return false; + + CMovieClip *clip = nullptr; + if (!clipName.empty()) { + clip = oldView->findNode()->findRoom()->findClip(clipName); + } else { + CLinkItem *link = oldView->findLink(newView); + if (link) + clip = link->getClip(); + } + + gameManager->_gameState.changeView(newView, clip); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 6047203c9e..db1ed90b54 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -73,7 +73,6 @@ protected: int _field50; int _field54; int _field58; - bool _visible; CMovieClipList _clipList1; int _initialFrame; CMovieClipList _clipList2; @@ -221,9 +220,15 @@ protected: * Load the surface */ void loadSurface(); + + /** + * Change the view + */ + bool changeView(const CString &viewName, const CString &clipName); public: int _field60; CursorId _cursorId; + bool _visible; public: CLASSDEF CGameObject(); |