diff options
author | Paul Gilbert | 2016-08-17 19:00:18 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-17 19:00:18 -0400 |
commit | c628f7224f336e353d56990977d3683d905877ab (patch) | |
tree | 50e991c12936e3d27e5fbbeafeebcec168f2db3b /engines/titanic | |
parent | 75f6d1fa5b4a413818457fd9d373054405dd7129 (diff) | |
download | scummvm-rg350-c628f7224f336e353d56990977d3683d905877ab.tar.gz scummvm-rg350-c628f7224f336e353d56990977d3683d905877ab.tar.bz2 scummvm-rg350-c628f7224f336e353d56990977d3683d905877ab.zip |
TITANIC: Implemented CCage class
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/carry/carry_parrot.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/game/cage.cpp | 70 | ||||
-rw-r--r-- | engines/titanic/game/cage.h | 8 |
3 files changed, 75 insertions, 5 deletions
diff --git a/engines/titanic/carry/carry_parrot.cpp b/engines/titanic/carry/carry_parrot.cpp index cf96204122..8a453e348c 100644 --- a/engines/titanic/carry/carry_parrot.cpp +++ b/engines/titanic/carry/carry_parrot.cpp @@ -111,7 +111,7 @@ bool CCarryParrot::MouseDragEndMsg(CMouseDragEndMsg *msg) { if (compareViewNameTo("ParrotLobby.Node 1.N")) { if (msg->_mousePos.x >= 75 && msg->_mousePos.x <= 565 && - !CParrot::_v2 && !CCage::_v2) { + !CParrot::_v2 && !CCage::_open) { setVisible(false); _fieldE0 = 0; CTreeItem *perchedParrot = findUnder(getRoot(), "PerchedParrot"); diff --git a/engines/titanic/game/cage.cpp b/engines/titanic/game/cage.cpp index 7fbc052278..bbac384cea 100644 --- a/engines/titanic/game/cage.cpp +++ b/engines/titanic/game/cage.cpp @@ -21,16 +21,25 @@ */ #include "titanic/game/cage.h" +#include "titanic/npcs/parrot.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CCage, CBackground) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(PreEnterViewMsg) + ON_MESSAGE(MouseMoveMsg) +END_MESSAGE_MAP() + int CCage::_v1; -int CCage::_v2; +bool CCage::_open; void CCage::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_v1, indent); - file->writeNumberLine(_v2, indent); + file->writeNumberLine(_open, indent); CBackground::save(file, indent); } @@ -38,9 +47,64 @@ void CCage::save(SimpleFile *file, int indent) { void CCage::load(SimpleFile *file) { file->readNumber(); _v1 = file->readNumber(); - _v2 = file->readNumber(); + _open = file->readNumber(); CBackground::load(file); } +bool CCage::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (CParrot::_v4 && !CParrot::_v5) { + CActMsg actMsg(_open ? "Open" : "Shut"); + actMsg.execute(this); + } + + return true; +} + +bool CCage::ActMsg(CActMsg *msg) { + if (msg->_action == "Shut") { + if (!_open) { + playClip("Shut", MOVIE_STOP_PREVIOUS | MOVIE_NOTIFY_OBJECT); + disableMouse(); + } + } else if (msg->_action == "Open") { + if (_open) { + playClip("Open", MOVIE_STOP_PREVIOUS | MOVIE_NOTIFY_OBJECT); + disableMouse(); + } + } else if (msg->_action == "CoreReplaced") { + CActMsg actMsg("Shut"); + actMsg.execute(this); + } else if (msg->_action == "OpenNow") { + loadFrame(0); + _open = false; + } + + return true; +} + +bool CCage::MovieEndMsg(CMovieEndMsg *msg) { + enableMouse(); + _open = clipExistsByEnd("Shut", msg->_endFrame); + + CStatusChangeMsg statusMsg; + statusMsg._newStatus = _open ? 1 : (CParrot::_v4 == 0 ? 1 : 0); + statusMsg.execute("PerchCoreHolder"); + + return true; +} + +bool CCage::PreEnterViewMsg(CPreEnterViewMsg *msg) { + loadSurface(); + _open = CParrot::_v4 != 0; + loadFrame(_open ? 8 : 0); + + return true; +} + +bool CCage::MouseMoveMsg(CMouseMoveMsg *msg) { + _cursorId = CParrot::_v4 && !CParrot::_v5 ? CURSOR_ACTIVATE : CURSOR_ARROW; + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/cage.h b/engines/titanic/game/cage.h index bbce978489..48b1b46ab7 100644 --- a/engines/titanic/game/cage.h +++ b/engines/titanic/game/cage.h @@ -28,9 +28,15 @@ namespace Titanic { class CCage : public CBackground { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool ActMsg(CActMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool PreEnterViewMsg(CPreEnterViewMsg *msg); + bool MouseMoveMsg(CMouseMoveMsg *msg); public: static int _v1; - static int _v2; + static bool _open; public: CLASSDEF; |