From 4933b59e8e039ae346f650c044e5fe0ba6310ead Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Aug 2016 14:39:59 -0400 Subject: TITANIC: Implemented remaining game classes --- engines/titanic/game/placeholder/tv_on_bar.cpp | 18 ++++++- engines/titanic/game/placeholder/tv_on_bar.h | 4 +- engines/titanic/game/sgt/sgt_nav.cpp | 44 +++++++++++++++++ engines/titanic/game/sgt/sgt_nav.h | 3 ++ engines/titanic/game/sgt/toilet.cpp | 44 +++++++++++++++++ engines/titanic/game/sgt/toilet.h | 4 ++ engines/titanic/game/sgt/vase.cpp | 40 +++++++++++++++ engines/titanic/game/sgt/vase.h | 4 ++ engines/titanic/game/sgt/washstand.cpp | 38 +++++++++++++++ engines/titanic/game/sgt/washstand.h | 4 ++ engines/titanic/game/third_class_canal.cpp | 9 ++++ engines/titanic/game/third_class_canal.h | 2 + engines/titanic/game/throw_tv_down_well.cpp | 63 ++++++++++++++++++++++-- engines/titanic/game/throw_tv_down_well.h | 12 +++-- engines/titanic/game/titania_still_control.cpp | 16 ++++++ engines/titanic/game/titania_still_control.h | 3 ++ engines/titanic/game/tow_parrot_nav.cpp | 17 +++++++ engines/titanic/game/tow_parrot_nav.h | 2 + engines/titanic/game/up_lighter.cpp | 67 +++++++++++++++++++++++++- engines/titanic/game/up_lighter.h | 7 +++ engines/titanic/game/useless_lever.cpp | 24 +++++++++ engines/titanic/game/useless_lever.h | 3 ++ engines/titanic/game/wheel_button.cpp | 45 +++++++++++++++-- engines/titanic/game/wheel_button.h | 6 ++- engines/titanic/game/wheel_hotspot.cpp | 40 +++++++++++++++ engines/titanic/game/wheel_hotspot.h | 3 ++ engines/titanic/game/wheel_spin.cpp | 24 ++++++++- engines/titanic/game/wheel_spin.h | 7 ++- 28 files changed, 534 insertions(+), 19 deletions(-) (limited to 'engines/titanic/game') diff --git a/engines/titanic/game/placeholder/tv_on_bar.cpp b/engines/titanic/game/placeholder/tv_on_bar.cpp index e17fb7833d..710b5a346e 100644 --- a/engines/titanic/game/placeholder/tv_on_bar.cpp +++ b/engines/titanic/game/placeholder/tv_on_bar.cpp @@ -24,16 +24,30 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CTVOnBar, CPlaceHolder) + ON_MESSAGE(VisibleMsg) +END_MESSAGE_MAP() + void CTVOnBar::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writePoint(_pos1, indent); + file->writePoint(_tvPos, indent); CPlaceHolder::save(file, indent); } void CTVOnBar::load(SimpleFile *file) { file->readNumber(); - _pos1 = file->readPoint(); + _tvPos = file->readPoint(); CPlaceHolder::load(file); } +bool CTVOnBar::VisibleMsg(CVisibleMsg *msg) { + setVisible(msg->_visible); + if (msg->_visible) + setPosition(_tvPos); + else + setPosition(Point(0, 0)); + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/placeholder/tv_on_bar.h b/engines/titanic/game/placeholder/tv_on_bar.h index bb5381fb5d..0157bc8764 100644 --- a/engines/titanic/game/placeholder/tv_on_bar.h +++ b/engines/titanic/game/placeholder/tv_on_bar.h @@ -28,8 +28,10 @@ namespace Titanic { class CTVOnBar : public CPlaceHolder { + DECLARE_MESSAGE_MAP; + bool VisibleMsg(CVisibleMsg *msg); private: - Point _pos1; + Point _tvPos; public: CLASSDEF; diff --git a/engines/titanic/game/sgt/sgt_nav.cpp b/engines/titanic/game/sgt/sgt_nav.cpp index f98e486fd0..c004f947d2 100644 --- a/engines/titanic/game/sgt/sgt_nav.cpp +++ b/engines/titanic/game/sgt/sgt_nav.cpp @@ -24,6 +24,11 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(SGTNav, CSGTStateRoom) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MouseMoveMsg) +END_MESSAGE_MAP() + void SGTNav::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSGTStateRoom::save(file, indent); @@ -34,4 +39,43 @@ void SGTNav::load(SimpleFile *file) { CSGTStateRoom::load(file); } +bool SGTNav::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + CTurnOn onMsg; + CTurnOff offMsg; + + if (_statics->_v6 == "Open" && _statics->_v1 == "Open") { + if (_statics->_v3 == "Open") + offMsg.execute("Vase"); + if (_statics->_v4 == "Closed") + onMsg.execute("SGTTV"); + if (_statics->_v7 == "Open") + offMsg.execute("Drawer"); + if (_statics->_v8 == "Open") + offMsg.execute("Armchair"); + if (_statics->_v9 == "Open") + offMsg.execute("Deskchair"); + if (_statics->_v12 == "Open") + offMsg.execute("Toilet"); + + changeView("SGTState.Node 2.E"); + } else if (_statics->_v1 == "Open") { + petDisplayMessage(1, "This is your stateroom. It is for sleeping. If you desire " + "entertainment or relaxation, please visit your local leisure lounge."); + } else if (_statics->_v6 == "Closed") { + petDisplayMessage(1, "The bed will not currently support your weight." + " We are working on this problem but are unlikely to be able to fix it."); + } + + return true; +} + +bool SGTNav::MouseMoveMsg(CMouseMoveMsg *msg) { + if (_statics->_v6 == "Open" && _statics->_v1 == "Open") + _cursorId = CURSOR_MOVE_FORWARD; + else + _cursorId = CURSOR_ARROW; + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/sgt/sgt_nav.h b/engines/titanic/game/sgt/sgt_nav.h index 40fdc4eff1..78f6417229 100644 --- a/engines/titanic/game/sgt/sgt_nav.h +++ b/engines/titanic/game/sgt/sgt_nav.h @@ -28,6 +28,9 @@ namespace Titanic { class SGTNav : public CSGTStateRoom { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MouseMoveMsg(CMouseMoveMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/sgt/toilet.cpp b/engines/titanic/game/sgt/toilet.cpp index 799abd6c76..b8e87b645a 100644 --- a/engines/titanic/game/sgt/toilet.cpp +++ b/engines/titanic/game/sgt/toilet.cpp @@ -24,6 +24,12 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CToilet, CSGTStateRoom) + ON_MESSAGE(TurnOn) + ON_MESSAGE(TurnOff) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + void CToilet::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSGTStateRoom::save(file, indent); @@ -34,4 +40,42 @@ void CToilet::load(SimpleFile *file) { CSGTStateRoom::load(file); } +bool CToilet::TurnOn(CTurnOn *msg) { + if (CSGTStateRoom::_statics->_v12 == "Closed" + && CSGTStateRoom::_statics->_v10 == "Open" + && CSGTStateRoom::_statics->_v8 == "Closed") { + setVisible(true); + CSGTStateRoom::_statics->_v12 = "Open"; + + _fieldE0 = false; + _startFrame = 0; + _endFrame = 11; + playMovie(0, 11, MOVIE_GAMESTATE); + playSound("b#1.wav"); + } + + return true; +} + +bool CToilet::TurnOff(CTurnOff *msg) { + if (CSGTStateRoom::_statics->_v12 == "Open") { + CSGTStateRoom::_statics->_v12 = "Closed"; + + _fieldE0 = true; + _startFrame = 11; + _endFrame = 18; + playMovie(11, 18, MOVIE_GAMESTATE); + playSound("b#1.wav"); + } + + return true; +} + +bool CToilet::MovieEndMsg(CMovieEndMsg *msg) { + if (CSGTStateRoom::_statics->_v12 == "Closed") + setVisible(false); + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/sgt/toilet.h b/engines/titanic/game/sgt/toilet.h index d87531ad7a..a4bc318fb2 100644 --- a/engines/titanic/game/sgt/toilet.h +++ b/engines/titanic/game/sgt/toilet.h @@ -28,6 +28,10 @@ namespace Titanic { class CToilet : public CSGTStateRoom { + DECLARE_MESSAGE_MAP; + bool TurnOn(CTurnOn *msg); + bool TurnOff(CTurnOff *msg); + bool MovieEndMsg(CMovieEndMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/sgt/vase.cpp b/engines/titanic/game/sgt/vase.cpp index 3e04b5db9e..2d37818340 100644 --- a/engines/titanic/game/sgt/vase.cpp +++ b/engines/titanic/game/sgt/vase.cpp @@ -24,6 +24,12 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CVase, CSGTStateRoom) + ON_MESSAGE(TurnOn) + ON_MESSAGE(TurnOff) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + void CVase::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSGTStateRoom::save(file, indent); @@ -34,4 +40,38 @@ void CVase::load(SimpleFile *file) { CSGTStateRoom::load(file); } +bool CVase::TurnOn(CTurnOn *msg) { + if (CSGTStateRoom::_statics->_v3 == "Closed") { + CSGTStateRoom::_statics->_v3 = "Open"; + setVisible(true); + _fieldE0 = false; + _startFrame = 1; + _endFrame = 12; + playMovie(1, 12, MOVIE_GAMESTATE); + } + + return true; +} + +bool CVase::TurnOff(CTurnOff *msg) { + if (CSGTStateRoom::_statics->_v3 == "Open" + && CSGTStateRoom::_statics->_v1 != "RestingV" + && CSGTStateRoom::_statics->_v1 != "RestingUV") { + CSGTStateRoom::_statics->_v3 = "Closed"; + _fieldE0 = true; + _startFrame = 12; + _endFrame = 25; + playMovie(12, 25, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + } + + return true; +} + +bool CVase::MovieEndMsg(CMovieEndMsg *msg) { + if (CSGTStateRoom::_statics->_v3 == "Closed") + setVisible(false); + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/sgt/vase.h b/engines/titanic/game/sgt/vase.h index 8aa35acdf5..e07d9efb80 100644 --- a/engines/titanic/game/sgt/vase.h +++ b/engines/titanic/game/sgt/vase.h @@ -28,6 +28,10 @@ namespace Titanic { class CVase : public CSGTStateRoom { + DECLARE_MESSAGE_MAP; + bool TurnOn(CTurnOn *msg); + bool TurnOff(CTurnOff *msg); + bool MovieEndMsg(CMovieEndMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/sgt/washstand.cpp b/engines/titanic/game/sgt/washstand.cpp index 8127a59a59..afdc74414d 100644 --- a/engines/titanic/game/sgt/washstand.cpp +++ b/engines/titanic/game/sgt/washstand.cpp @@ -24,6 +24,12 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CWashstand, CSGTStateRoom) + ON_MESSAGE(TurnOn) + ON_MESSAGE(TurnOff) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + void CWashstand::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSGTStateRoom::save(file, indent); @@ -34,4 +40,36 @@ void CWashstand::load(SimpleFile *file) { CSGTStateRoom::load(file); } +bool CWashstand::TurnOn(CTurnOn *msg) { + if (_statics->_v10 == "Closed" && _statics->_v2 == "NotOnWashstand") { + setVisible(true); + _statics->_v10 = "Open"; + _fieldE0 = false; + _startFrame = 0; + _endFrame = 14; + playMovie(0, 14, MOVIE_GAMESTATE); + playSound("b#14.wav"); + } + + return true; +} + +bool CWashstand::TurnOff(CTurnOff *msg) { + if (_statics->_v10 == "Open" && _statics->_v11 == "Closed" + && _statics->_v12 == "Closed" && _statics->_v2 == "Open") { + _statics->_v10 = "Closed"; + _fieldE0 = true; + _startFrame = 14; + _endFrame = 28; + playMovie(14, 28, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playSound("b#14.wav"); + } + + return true; +} + +bool CWashstand::MovieEndMsg(CMovieEndMsg *msg) { + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/sgt/washstand.h b/engines/titanic/game/sgt/washstand.h index f140b17f49..1b72cfa1c4 100644 --- a/engines/titanic/game/sgt/washstand.h +++ b/engines/titanic/game/sgt/washstand.h @@ -28,6 +28,10 @@ namespace Titanic { class CWashstand : public CSGTStateRoom { + DECLARE_MESSAGE_MAP; + bool TurnOn(CTurnOn *msg); + bool TurnOff(CTurnOff *msg); + bool MovieEndMsg(CMovieEndMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/third_class_canal.cpp b/engines/titanic/game/third_class_canal.cpp index 6b0a101f7b..97b559e35d 100644 --- a/engines/titanic/game/third_class_canal.cpp +++ b/engines/titanic/game/third_class_canal.cpp @@ -24,6 +24,10 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CThirdClassCanal, CBackground) + ON_MESSAGE(MouseButtonDownMsg) +END_MESSAGE_MAP() + void CThirdClassCanal::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CBackground::save(file, indent); @@ -34,4 +38,9 @@ void CThirdClassCanal::load(SimpleFile *file) { CBackground::load(file); } +bool CThirdClassCanal::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + petDisplayMessage("This area is off limits to passengers."); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/third_class_canal.h b/engines/titanic/game/third_class_canal.h index f6fc471444..d0be8c05aa 100644 --- a/engines/titanic/game/third_class_canal.h +++ b/engines/titanic/game/third_class_canal.h @@ -28,6 +28,8 @@ namespace Titanic { class CThirdClassCanal : public CBackground { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/throw_tv_down_well.cpp b/engines/titanic/game/throw_tv_down_well.cpp index c8a9fc7c9e..9de028cbde 100644 --- a/engines/titanic/game/throw_tv_down_well.cpp +++ b/engines/titanic/game/throw_tv_down_well.cpp @@ -24,18 +24,73 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CThrowTVDownWell, CGameObject) + ON_MESSAGE(ActMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(TimerMsg) + ON_MESSAGE(MovieFrameMsg) +END_MESSAGE_MAP() + void CThrowTVDownWell::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeQuotedLine(_strValue, indent); - file->writeNumberLine(_numValue, indent); + file->writeQuotedLine(_viewName, indent); + file->writeNumberLine(_flag, indent); CGameObject::save(file, indent); } void CThrowTVDownWell::load(SimpleFile *file) { file->readNumber(); - _strValue = file->readString(); - _numValue = file->readNumber(); + _viewName = file->readString(); + _flag = file->readNumber(); CGameObject::load(file); } +bool CThrowTVDownWell::ActMsg(CActMsg *msg) { + if (msg->_action == "ThrowTVDownWell" && !_flag) { + CString viewName = getFullViewName(); + lockMouse(); + addTimer(1, 8000, 0); + + CActMsg actMsg("ThrownTVDownWell"); + actMsg.execute("BOWTelevisionMonitor"); + } + + return true; +} + +bool CThrowTVDownWell::EnterViewMsg(CEnterViewMsg *msg) { + playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + movieEvent(49); + return true; +} + +bool CThrowTVDownWell::MovieEndMsg(CMovieEndMsg *msg) { + sleep(2000); + changeView("ParrotLobby.Node 11.N"); + playSound("z#471.wav"); + addTimer(2, 7000, 0); + return true; +} + +bool CThrowTVDownWell::TimerMsg(CTimerMsg *msg) { + if (msg->_actionVal == 1) { + changeView("ParrotLobby.Node 10.N"); + } else if (msg->_actionVal == 2) { + playSound("z#468.wav", 50); + sleep(1500); + changeView(_viewName); + _viewName = "NULL"; + unlockMouse(); + playSound("z#47.wav"); + } + + return true; +} + +bool CThrowTVDownWell::MovieFrameMsg(CMovieFrameMsg *msg) { + playSound("z#470.wav"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/throw_tv_down_well.h b/engines/titanic/game/throw_tv_down_well.h index b6003aa3ef..c9e8fd57a9 100644 --- a/engines/titanic/game/throw_tv_down_well.h +++ b/engines/titanic/game/throw_tv_down_well.h @@ -28,12 +28,18 @@ namespace Titanic { class CThrowTVDownWell : public CGameObject { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool TimerMsg(CTimerMsg *msg); + bool MovieFrameMsg(CMovieFrameMsg *msg); public: - CString _strValue; - int _numValue; + CString _viewName; + bool _flag; public: CLASSDEF; - CThrowTVDownWell() : CGameObject(), _numValue(0) {} + CThrowTVDownWell() : CGameObject(), _flag(false) {} /** * Save the data for the class to file diff --git a/engines/titanic/game/titania_still_control.cpp b/engines/titanic/game/titania_still_control.cpp index 67866ecdcb..1ce0a85b4e 100644 --- a/engines/titanic/game/titania_still_control.cpp +++ b/engines/titanic/game/titania_still_control.cpp @@ -24,6 +24,11 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CTitaniaStillControl, CGameObject) + ON_MESSAGE(SetFrameMsg) + ON_MESSAGE(VisibleMsg) +END_MESSAGE_MAP() + void CTitaniaStillControl::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); @@ -34,4 +39,15 @@ void CTitaniaStillControl::load(SimpleFile *file) { CGameObject::load(file); } +bool CTitaniaStillControl::SetFrameMsg(CSetFrameMsg *msg) { + loadFrame(msg->_frameNumber); + setVisible(true); + return true; +} + +bool CTitaniaStillControl::VisibleMsg(CVisibleMsg *msg) { + setVisible(false); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/titania_still_control.h b/engines/titanic/game/titania_still_control.h index 66c3045187..b77227a539 100644 --- a/engines/titanic/game/titania_still_control.h +++ b/engines/titanic/game/titania_still_control.h @@ -28,6 +28,9 @@ namespace Titanic { class CTitaniaStillControl : public CGameObject { + DECLARE_MESSAGE_MAP; + bool SetFrameMsg(CSetFrameMsg *msg); + bool VisibleMsg(CVisibleMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/tow_parrot_nav.cpp b/engines/titanic/game/tow_parrot_nav.cpp index 9361808870..57f1649add 100644 --- a/engines/titanic/game/tow_parrot_nav.cpp +++ b/engines/titanic/game/tow_parrot_nav.cpp @@ -21,9 +21,14 @@ */ #include "titanic/game/tow_parrot_nav.h" +#include "titanic/npcs/parrot.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CTOWParrotNav, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) +END_MESSAGE_MAP() + void CTOWParrotNav::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); @@ -34,4 +39,16 @@ void CTOWParrotNav::load(SimpleFile *file) { CGameObject::load(file); } +bool CTOWParrotNav::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + CActMsg actMsg("EnteringFromTOW"); + actMsg.execute("PerchedParrot"); + + CString clipString = "_EXIT,36,1,N,9,3,N"; + if (CParrot::_v4) + clipString += 'a'; + changeView("ParrotLobby.Node 3.N", clipString); + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/tow_parrot_nav.h b/engines/titanic/game/tow_parrot_nav.h index 17618ff6de..252d9b631d 100644 --- a/engines/titanic/game/tow_parrot_nav.h +++ b/engines/titanic/game/tow_parrot_nav.h @@ -28,6 +28,8 @@ namespace Titanic { class CTOWParrotNav : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/up_lighter.cpp b/engines/titanic/game/up_lighter.cpp index f03b8f37a0..d133a7e9df 100644 --- a/engines/titanic/game/up_lighter.cpp +++ b/engines/titanic/game/up_lighter.cpp @@ -21,9 +21,21 @@ */ #include "titanic/game/up_lighter.h" +#include "titanic/core/project_item.h" +#include "titanic/npcs/parrot.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CUpLighter, CDropTarget) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(PumpingMsg) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(EnterRoomMsg) + ON_MESSAGE(ChangeSeasonMsg) + ON_MESSAGE(TimerMsg) + ON_MESSAGE(LeaveRoomMsg) +END_MESSAGE_MAP() + CUpLighter::CUpLighter() : CDropTarget(), _field118(0), _field11C(0), _field120(0), _field124(0) { } @@ -48,8 +60,61 @@ void CUpLighter::load(SimpleFile *file) { CDropTarget::load(file); } +bool CUpLighter::MovieEndMsg(CMovieEndMsg *msg) { + if (_field118) { + playSound("z#47.wav"); + _field124 = true; + + CVisibleMsg visibleMsg(true); + visibleMsg.execute("NoseHolder"); + CDropZoneLostObjectMsg lostMsg(nullptr); + lostMsg.execute(this); + _clipName.clear(); + _itemMatchName = "Nothing"; + _field118 = 0; + } + + return true; +} + +bool CUpLighter::PumpingMsg(CPumpingMsg *msg) { + _field118 = msg->_value; + _clipName = (_field118 && !_field124) ? "WholeSequence" : "HoseToNose"; + return true; +} + +bool CUpLighter::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + CTrueTalkTriggerActionMsg triggerMsg(280245, 0, 0); + triggerMsg.execute(getRoot(), CParrot::_type, + MSGFLAG_BREAK_IF_HANDLED | MSGFLAG_CLASS_DEF | MSGFLAG_SCAN); + return true; +} + bool CUpLighter::EnterRoomMsg(CEnterRoomMsg *msg) { - warning("CUpLighter::handleEvent"); + _field11C = true; + addTimer(5000 + getRandomNumber(15000), 0); + return true; +} + +bool CUpLighter::ChangeSeasonMsg(CChangeSeasonMsg *msg) { + _field120 = msg->_season == "Spring"; + if (_field120) + addTimer(5000 + getRandomNumber(15000), 0); + return true; +} + +bool CUpLighter::TimerMsg(CTimerMsg *msg) { + if (_field120 && _field11C & !_field118) { + CActMsg actMsg("Sneeze"); + actMsg.execute(findRoom()->findByName("NoseHolder")); + addTimer(1000 + getRandomNumber(19000), 0); + } + + return true; +} + +bool CUpLighter::LeaveRoomMsg(CLeaveRoomMsg *msg) { + _field11C = false; return true; } diff --git a/engines/titanic/game/up_lighter.h b/engines/titanic/game/up_lighter.h index 2367e41314..e6a53cf7bd 100644 --- a/engines/titanic/game/up_lighter.h +++ b/engines/titanic/game/up_lighter.h @@ -29,7 +29,14 @@ namespace Titanic { class CUpLighter : public CDropTarget { + DECLARE_MESSAGE_MAP; + bool MovieEndMsg(CMovieEndMsg *msg); + bool PumpingMsg(CPumpingMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); bool EnterRoomMsg(CEnterRoomMsg *msg); + bool ChangeSeasonMsg(CChangeSeasonMsg *msg); + bool TimerMsg(CTimerMsg *msg); + bool LeaveRoomMsg(CLeaveRoomMsg *msg); private: int _field118; int _field11C; diff --git a/engines/titanic/game/useless_lever.cpp b/engines/titanic/game/useless_lever.cpp index e48ad55a71..82d8983710 100644 --- a/engines/titanic/game/useless_lever.cpp +++ b/engines/titanic/game/useless_lever.cpp @@ -24,6 +24,11 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CUselessLever, CToggleButton) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(EnterViewMsg) +END_MESSAGE_MAP() + void CUselessLever::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleButton::save(file, indent); @@ -34,4 +39,23 @@ void CUselessLever::load(SimpleFile *file) { CToggleButton::load(file); } +bool CUselessLever::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_fieldE0) { + playMovie(15, 30, 0); + playSound("z#56.wav"); + _fieldE0 = false; + } else { + playMovie(0, 14, 0); + playSound("z#56.wav"); + _fieldE0 = true; + } + + return true; +} + +bool CUselessLever::EnterViewMsg(CEnterViewMsg *msg) { + loadFrame(_fieldE0 ? 15 : 0); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/useless_lever.h b/engines/titanic/game/useless_lever.h index 27397de216..33ed94b2ac 100644 --- a/engines/titanic/game/useless_lever.h +++ b/engines/titanic/game/useless_lever.h @@ -28,6 +28,9 @@ namespace Titanic { class CUselessLever : public CToggleButton { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/wheel_button.cpp b/engines/titanic/game/wheel_button.cpp index 19c42a8807..d4a9f445a1 100644 --- a/engines/titanic/game/wheel_button.cpp +++ b/engines/titanic/game/wheel_button.cpp @@ -24,14 +24,20 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CWheelButton, CBackground) + ON_MESSAGE(SignalObject) + ON_MESSAGE(TimerMsg) + ON_MESSAGE(LeaveViewMsg) +END_MESSAGE_MAP() + CWheelButton::CWheelButton() : CBackground(), - _fieldE0(0), _fieldE4(0), _fieldE8(0) { + _fieldE0(0), _timerId(0), _fieldE8(0) { } void CWheelButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); - file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_timerId, indent); file->writeNumberLine(_fieldE8, indent); CBackground::save(file, indent); @@ -40,10 +46,43 @@ void CWheelButton::save(SimpleFile *file, int indent) { void CWheelButton::load(SimpleFile *file) { file->readNumber(); _fieldE0 = file->readNumber(); - _fieldE4 = file->readNumber(); + _timerId = file->readNumber(); _fieldE8 = file->readNumber(); CBackground::load(file); } +bool CWheelButton::SignalObject(CSignalObject *msg) { + bool oldFlag = _fieldE0; + _fieldE0 = msg->_numValue != 0; + + if (oldFlag != _fieldE0) { + if (_fieldE0) { + _timerId = addTimer(500, 500); + } else { + stopAnimTimer(_timerId); + _timerId = 0; + setVisible(false); + } + } + + return true; +} + +bool CWheelButton::TimerMsg(CTimerMsg *msg) { + setVisible(!_visible); + makeDirty(); + return true; +} + +bool CWheelButton::LeaveViewMsg(CLeaveViewMsg *msg) { + if (_timerId) { + stopAnimTimer(_timerId); + _timerId = 0; + setVisible(false); + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/wheel_button.h b/engines/titanic/game/wheel_button.h index cb089a660f..097b686943 100644 --- a/engines/titanic/game/wheel_button.h +++ b/engines/titanic/game/wheel_button.h @@ -28,9 +28,13 @@ namespace Titanic { class CWheelButton : public CBackground { + DECLARE_MESSAGE_MAP; + bool SignalObject(CSignalObject *msg); + bool TimerMsg(CTimerMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); public: int _fieldE0; - int _fieldE4; + int _timerId; int _fieldE8; public: CLASSDEF; diff --git a/engines/titanic/game/wheel_hotspot.cpp b/engines/titanic/game/wheel_hotspot.cpp index f9af594cd5..544e6f5470 100644 --- a/engines/titanic/game/wheel_hotspot.cpp +++ b/engines/titanic/game/wheel_hotspot.cpp @@ -24,6 +24,11 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CWheelHotSpot, CBackground) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(SignalObject) +END_MESSAGE_MAP() + void CWheelHotSpot::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); @@ -40,4 +45,39 @@ void CWheelHotSpot::load(SimpleFile *file) { CBackground::load(file); } +bool CWheelHotSpot::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_fieldE0) { + CActMsg actMsg; + + switch (_fieldE4) { + case 1: + actMsg._action = "Stop"; + actMsg.execute("CaptainsWheel"); + break; + + case 2: + actMsg._action = "Cruise"; + actMsg.execute("CaptainsWheel"); + break; + + case 3: + actMsg._action = "Go"; + actMsg.execute("CaptainsWheel"); + break; + + default: + break; + } + } else if (_fieldE4 == 3) { + petDisplayMessage("Go where?"); + } + + return true; +} + +bool CWheelHotSpot::SignalObject(CSignalObject *msg) { + _fieldE0 = msg->_numValue != 0; + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/wheel_hotspot.h b/engines/titanic/game/wheel_hotspot.h index 364fe9a060..e9071a2fa4 100644 --- a/engines/titanic/game/wheel_hotspot.h +++ b/engines/titanic/game/wheel_hotspot.h @@ -28,6 +28,9 @@ namespace Titanic { class CWheelHotSpot : public CBackground { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool SignalObject(CSignalObject *msg); public: int _fieldE0; int _fieldE4; diff --git a/engines/titanic/game/wheel_spin.cpp b/engines/titanic/game/wheel_spin.cpp index daa9918e29..79f83873e1 100644 --- a/engines/titanic/game/wheel_spin.cpp +++ b/engines/titanic/game/wheel_spin.cpp @@ -24,16 +24,36 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CWheelSpin, CBackground) + ON_MESSAGE(SignalObject) + ON_MESSAGE(MouseButtonDownMsg) +END_MESSAGE_MAP() + void CWheelSpin::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_value, indent); + file->writeNumberLine(_active, indent); CBackground::save(file, indent); } void CWheelSpin::load(SimpleFile *file) { file->readNumber(); - _value = file->readNumber(); + _active = file->readNumber(); CBackground::load(file); } +bool CWheelSpin::SignalObject(CSignalObject *msg) { + _active = msg->_numValue != 0; + setVisible(_active); + return true; +} + +bool CWheelSpin::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_active) { + CActMsg actMsg("Spin"); + actMsg.execute("CaptainsWheel"); + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/wheel_spin.h b/engines/titanic/game/wheel_spin.h index 509db1a4bf..f7993f0188 100644 --- a/engines/titanic/game/wheel_spin.h +++ b/engines/titanic/game/wheel_spin.h @@ -28,11 +28,14 @@ namespace Titanic { class CWheelSpin : public CBackground { + DECLARE_MESSAGE_MAP; + bool SignalObject(CSignalObject *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); public: - int _value; + bool _active; public: CLASSDEF; - CWheelSpin() : CBackground(), _value(0) {} + CWheelSpin() : CBackground(), _active(false) {} /** * Save the data for the class to file -- cgit v1.2.3