diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/game/bowl_unlocker.cpp | 43 | ||||
-rw-r--r-- | engines/titanic/game/bowl_unlocker.h | 9 |
2 files changed, 48 insertions, 4 deletions
diff --git a/engines/titanic/game/bowl_unlocker.cpp b/engines/titanic/game/bowl_unlocker.cpp index c3c501dbd6..c4adac34f2 100644 --- a/engines/titanic/game/bowl_unlocker.cpp +++ b/engines/titanic/game/bowl_unlocker.cpp @@ -21,19 +21,58 @@ */ #include "titanic/game/bowl_unlocker.h" +#include "titanic/core/room_item.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CBowlUnlocker, CGameObject) + ON_MESSAGE(NutPuzzleMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(LeaveViewMsg) +END_MESSAGE_MAP() + void CBowlUnlocker::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_value, indent); + file->writeNumberLine(_bowlUnlocked, indent); CGameObject::save(file, indent); } void CBowlUnlocker::load(SimpleFile *file) { file->readNumber(); - _value = file->readNumber(); + _bowlUnlocked = file->readNumber(); CGameObject::load(file); } +bool CBowlUnlocker::NutPuzzleMsg(CNutPuzzleMsg *msg) { + if (msg->_value == "UnlockBowl") { + setVisible(true); + playMovie(MOVIE_NOTIFY_OBJECT); + } + + return true; +} + +bool CBowlUnlocker::MovieEndMsg(CMovieEndMsg *msg) { + setVisible(false); + _bowlUnlocked = true; + + CNutPuzzleMsg puzzleMsg("BowlUnlocked"); + puzzleMsg.execute(getRoom(), nullptr, MSGFLAG_SCAN); + + playSound("z#47.wav"); + return true; +} + +bool CBowlUnlocker::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_bowlUnlocked) + msg->execute("Ear1"); + return true; +} + +bool CBowlUnlocker::LeaveViewMsg(CLeaveViewMsg *msg) { + _bowlUnlocked = false; + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/bowl_unlocker.h b/engines/titanic/game/bowl_unlocker.h index 2559ac2c52..b940661904 100644 --- a/engines/titanic/game/bowl_unlocker.h +++ b/engines/titanic/game/bowl_unlocker.h @@ -28,11 +28,16 @@ namespace Titanic { class CBowlUnlocker : public CGameObject { + DECLARE_MESSAGE_MAP; + bool NutPuzzleMsg(CNutPuzzleMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); public: - int _value; + bool _bowlUnlocked; public: CLASSDEF; - CBowlUnlocker() : CGameObject(), _value(0) {} + CBowlUnlocker() : CGameObject(), _bowlUnlocked(false) {} /** * Save the data for the class to file |