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

dreammaster dreammaster at scummvm.org
Thu Aug 18 01:00:27 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:
c628f7224f TITANIC: Implemented CCage class


Commit: c628f7224f336e353d56990977d3683d905877ab
    https://github.com/scummvm/scummvm/commit/c628f7224f336e353d56990977d3683d905877ab
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-17T19:00:18-04:00

Commit Message:
TITANIC: Implemented CCage class

Changed paths:
    engines/titanic/carry/carry_parrot.cpp
    engines/titanic/game/cage.cpp
    engines/titanic/game/cage.h



diff --git a/engines/titanic/carry/carry_parrot.cpp b/engines/titanic/carry/carry_parrot.cpp
index cf96204..8a453e3 100644
--- a/engines/titanic/carry/carry_parrot.cpp
+++ b/engines/titanic/carry/carry_parrot.cpp
@@ -111,7 +111,7 @@ bool CCarryParrot::MouseDragEndMsg(CMouseDragEndMsg *msg) {
 
 	if (compareViewNameTo("ParrotLobby.Node 1.N")) {
 		if (msg->_mousePos.x >= 75 && msg->_mousePos.x <= 565 &&
-				!CParrot::_v2 && !CCage::_v2) {
+				!CParrot::_v2 && !CCage::_open) {
 			setVisible(false);
 			_fieldE0 = 0;
 			CTreeItem *perchedParrot = findUnder(getRoot(), "PerchedParrot");
diff --git a/engines/titanic/game/cage.cpp b/engines/titanic/game/cage.cpp
index 7fbc052..bbac384 100644
--- a/engines/titanic/game/cage.cpp
+++ b/engines/titanic/game/cage.cpp
@@ -21,16 +21,25 @@
  */
 
 #include "titanic/game/cage.h"
+#include "titanic/npcs/parrot.h"
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CCage, CBackground)
+	ON_MESSAGE(MouseButtonDownMsg)
+	ON_MESSAGE(ActMsg)
+	ON_MESSAGE(MovieEndMsg)
+	ON_MESSAGE(PreEnterViewMsg)
+	ON_MESSAGE(MouseMoveMsg)
+END_MESSAGE_MAP()
+
 int CCage::_v1;
-int CCage::_v2;
+bool CCage::_open;
 
 void CCage::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
 	file->writeNumberLine(_v1, indent);
-	file->writeNumberLine(_v2, indent);
+	file->writeNumberLine(_open, indent);
 
 	CBackground::save(file, indent);
 }
@@ -38,9 +47,64 @@ void CCage::save(SimpleFile *file, int indent) {
 void CCage::load(SimpleFile *file) {
 	file->readNumber();
 	_v1 = file->readNumber();
-	_v2 = file->readNumber();
+	_open = file->readNumber();
 
 	CBackground::load(file);
 }
 
+bool CCage::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+	if (CParrot::_v4 && !CParrot::_v5) {
+		CActMsg actMsg(_open ? "Open" : "Shut");
+		actMsg.execute(this);
+	}
+
+	return true;
+}
+
+bool CCage::ActMsg(CActMsg *msg) {
+	if (msg->_action == "Shut") {
+		if (!_open) {
+			playClip("Shut", MOVIE_STOP_PREVIOUS | MOVIE_NOTIFY_OBJECT);
+			disableMouse();
+		}
+	} else if (msg->_action == "Open") {
+		if (_open) {
+			playClip("Open", MOVIE_STOP_PREVIOUS | MOVIE_NOTIFY_OBJECT);
+			disableMouse();
+		}
+	} else if (msg->_action == "CoreReplaced") {
+		CActMsg actMsg("Shut");
+		actMsg.execute(this);
+	} else if (msg->_action == "OpenNow") {
+		loadFrame(0);
+		_open = false;
+	}
+
+	return true;
+}
+
+bool CCage::MovieEndMsg(CMovieEndMsg *msg) {
+	enableMouse();
+	_open = clipExistsByEnd("Shut", msg->_endFrame);
+
+	CStatusChangeMsg statusMsg;
+	statusMsg._newStatus = _open ? 1 : (CParrot::_v4 == 0 ? 1 : 0);
+	statusMsg.execute("PerchCoreHolder");
+
+	return true;
+}
+
+bool CCage::PreEnterViewMsg(CPreEnterViewMsg *msg) {
+	loadSurface();
+	_open = CParrot::_v4 != 0;
+	loadFrame(_open ? 8 : 0);
+
+	return true;
+}
+
+bool CCage::MouseMoveMsg(CMouseMoveMsg *msg) {
+	_cursorId = CParrot::_v4 && !CParrot::_v5 ? CURSOR_ACTIVATE : CURSOR_ARROW;
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/game/cage.h b/engines/titanic/game/cage.h
index bbce978..48b1b46 100644
--- a/engines/titanic/game/cage.h
+++ b/engines/titanic/game/cage.h
@@ -28,9 +28,15 @@
 namespace Titanic {
 
 class CCage : public CBackground {
+	DECLARE_MESSAGE_MAP;
+	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+	bool ActMsg(CActMsg *msg);
+	bool MovieEndMsg(CMovieEndMsg *msg);
+	bool PreEnterViewMsg(CPreEnterViewMsg *msg);
+	bool MouseMoveMsg(CMouseMoveMsg *msg);
 public:
 	static int _v1;
-	static int _v2;
+	static bool _open;
 public:
 	CLASSDEF;
 






More information about the Scummvm-git-logs mailing list