[Scummvm-cvs-logs] scummvm master -> a4885b1d6f783f20716c2d86316946362215bdaa

dreammaster dreammaster at scummvm.org
Tue Aug 16 04:48:39 CEST 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
a4885b1d6f TITANIC: Implemented CBowlUnlocker class


Commit: a4885b1d6f783f20716c2d86316946362215bdaa
    https://github.com/scummvm/scummvm/commit/a4885b1d6f783f20716c2d86316946362215bdaa
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-15T22:48:27-04:00

Commit Message:
TITANIC: Implemented CBowlUnlocker class

Changed paths:
    engines/titanic/game/bowl_unlocker.cpp
    engines/titanic/game/bowl_unlocker.h



diff --git a/engines/titanic/game/bowl_unlocker.cpp b/engines/titanic/game/bowl_unlocker.cpp
index c3c501d..c4adac3 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 2559ac2..b940661 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






More information about the Scummvm-git-logs mailing list