aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-15 22:48:27 -0400
committerPaul Gilbert2016-08-15 22:48:27 -0400
commita4885b1d6f783f20716c2d86316946362215bdaa (patch)
treedb96ef3696f1c235b4e804de8f7be992cd4706cc /engines/titanic
parent33e4afedde5a31ab97a4e1965869b30dd7964e49 (diff)
downloadscummvm-rg350-a4885b1d6f783f20716c2d86316946362215bdaa.tar.gz
scummvm-rg350-a4885b1d6f783f20716c2d86316946362215bdaa.tar.bz2
scummvm-rg350-a4885b1d6f783f20716c2d86316946362215bdaa.zip
TITANIC: Implemented CBowlUnlocker class
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/game/bowl_unlocker.cpp43
-rw-r--r--engines/titanic/game/bowl_unlocker.h9
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