diff options
author | Paul Gilbert | 2016-08-15 21:32:03 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-15 21:32:03 -0400 |
commit | 7234f076f4ccf5cb427ad4abda65b4fb2d823d3b (patch) | |
tree | 347e837786e52fe81a1aa8009963c1d012b5d84b | |
parent | 24aeebc96f50f12a9dacf33c9ce4aceb82011074 (diff) | |
download | scummvm-rg350-7234f076f4ccf5cb427ad4abda65b4fb2d823d3b.tar.gz scummvm-rg350-7234f076f4ccf5cb427ad4abda65b4fb2d823d3b.tar.bz2 scummvm-rg350-7234f076f4ccf5cb427ad4abda65b4fb2d823d3b.zip |
TITANIC: Implemented CBottomOfWellMonitor class
-rw-r--r-- | engines/titanic/game/bottom_of_well_monitor.cpp | 72 | ||||
-rw-r--r-- | engines/titanic/game/bottom_of_well_monitor.h | 9 |
2 files changed, 77 insertions, 4 deletions
diff --git a/engines/titanic/game/bottom_of_well_monitor.cpp b/engines/titanic/game/bottom_of_well_monitor.cpp index beb2a80ce9..373fe4cbdc 100644 --- a/engines/titanic/game/bottom_of_well_monitor.cpp +++ b/engines/titanic/game/bottom_of_well_monitor.cpp @@ -24,6 +24,13 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CBottomOfWellMonitor, CGameObject) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(LeaveViewMsg) +END_MESSAGE_MAP() + int CBottomOfWellMonitor::_v1; int CBottomOfWellMonitor::_v2; @@ -31,7 +38,7 @@ void CBottomOfWellMonitor::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_v1, indent); file->writeNumberLine(_v2, indent); - file->writeNumberLine(_value, indent); + file->writeNumberLine(_flag, indent); CGameObject::save(file, indent); } @@ -39,8 +46,69 @@ void CBottomOfWellMonitor::load(SimpleFile *file) { file->readNumber(); _v1 = file->readNumber(); _v2 = file->readNumber(); - _value = file->readNumber(); + _flag = file->readNumber(); CGameObject::load(file); } +bool CBottomOfWellMonitor::ActMsg(CActMsg *msg) { + if (msg->_action == "TelevisionTaken") { + _v1 = 0; + _cursorId = CURSOR_ARROW; + CVisibleMsg visibleMsg; + visibleMsg.execute("CrushedTV2NE"); + visibleMsg.execute("CrushedTV4SW"); + _cursorId = CURSOR_ARROW; + } else if (msg->_action == "LiftbotHeadTaken") { + _v2 = 0; + _cursorId = CURSOR_ARROW; + CVisibleMsg visibleMsg; + visibleMsg.execute("LiftbotHead2NE"); + visibleMsg.execute("LiftbotHead4SW"); + _cursorId = CURSOR_ARROW; + } else if (msg->_action == "LiftbotHeadTaken") { + _v2 = 1; + CVisibleMsg visibleMsg; + visibleMsg.execute("CrushedTV2NE"); + visibleMsg.execute("CrushedTV4SW"); + _cursorId = CURSOR_MOVE_DOWN1; + } + + return true; +} + +bool CBottomOfWellMonitor::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (!compareTo("BOWTelevisionMonitor")) { + if (_v2) + changeView("BottomOfWell.Node 8.N", ""); + } else { + if (_v1) + changeView("BottomOfWell.Node 7.N", ""); + } + + return true; +} + +bool CBottomOfWellMonitor::EnterViewMsg(CEnterViewMsg *msg) { + if (_flag) { + if (!compareTo("BOWTelevisionMonitor")) { + if (_v2) { + changeView("BottomOfWell.Node 8.N", ""); + _flag = false; + } + } else { + if (_v1) { + changeView("BottomOfWell.Node 7.N", ""); + _flag = false; + } + } + } + + return true; +} + +bool CBottomOfWellMonitor::LeaveViewMsg(CLeaveViewMsg *msg) { + _flag = true; + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/bottom_of_well_monitor.h b/engines/titanic/game/bottom_of_well_monitor.h index 65424aad70..be9ae2c093 100644 --- a/engines/titanic/game/bottom_of_well_monitor.h +++ b/engines/titanic/game/bottom_of_well_monitor.h @@ -28,12 +28,17 @@ namespace Titanic { class CBottomOfWellMonitor : public CGameObject { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); public: static int _v1, _v2; - int _value; + bool _flag; public: CLASSDEF; - CBottomOfWellMonitor() : _value(1) {} + CBottomOfWellMonitor() : _flag(true) {} /** * Save the data for the class to file |