[Scummvm-git-logs] scummvm master -> c1b6fc3824018118618685fcbfcabe413e865531

dreammaster dreammaster at scummvm.org
Sat Aug 27 18:10:55 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:
c1b6fc3824 TITANIC: Implemented game pickup classes


Commit: c1b6fc3824018118618685fcbfcabe413e865531
    https://github.com/scummvm/scummvm/commit/c1b6fc3824018118618685fcbfcabe413e865531
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-27T12:10:37-04:00

Commit Message:
TITANIC: Implemented game pickup classes

Changed paths:
    engines/titanic/carry/photograph.cpp
    engines/titanic/game/pickup/pick_up.cpp
    engines/titanic/game/pickup/pick_up.h
    engines/titanic/game/pickup/pick_up_bar_glass.cpp
    engines/titanic/game/pickup/pick_up_bar_glass.h
    engines/titanic/game/pickup/pick_up_hose.cpp
    engines/titanic/game/pickup/pick_up_hose.h
    engines/titanic/game/pickup/pick_up_lemon.cpp
    engines/titanic/game/pickup/pick_up_lemon.h
    engines/titanic/game/pickup/pick_up_speech_centre.cpp
    engines/titanic/game/pickup/pick_up_speech_centre.h
    engines/titanic/game/pickup/pick_up_vis_centre.cpp
    engines/titanic/game/pickup/pick_up_vis_centre.h



diff --git a/engines/titanic/carry/photograph.cpp b/engines/titanic/carry/photograph.cpp
index 7f32a06..039efd0 100644
--- a/engines/titanic/carry/photograph.cpp
+++ b/engines/titanic/carry/photograph.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "titanic/carry/photograph.h"
+#include "titanic/core/dont_save_file_item.h"
 #include "titanic/core/room_item.h"
 
 namespace Titanic {
@@ -59,8 +60,12 @@ bool CPhotograph::MouseDragEndMsg(CMouseDragEndMsg *msg) {
 	_v1 = 0;
 	CGameObject *target = msg->_dropTarget;
 
-	if (target && target->getName() != "NavigationComputer") {
-		warning("TODO: CPhotograph::MouseDragEndMsg");
+	if (target && target->isEquals("NavigationComputer")) {
+		moveUnder(getDontSave());
+		makeDirty();
+		playSound("a#46.wav");
+		starFn1(14);
+		showMouse();
 		return true;
 	} else {
 		return CCarry::MouseDragEndMsg(msg);
@@ -78,7 +83,7 @@ bool CPhotograph::MouseDragStartMsg(CMouseDragStartMsg *msg) {
 }
 
 bool CPhotograph::PETGainedObjectMsg(CPETGainedObjectMsg *msg) {
-	if (getRoom()->getName() == "Home") {
+	if (getRoom()->isEquals("Home")) {
 		CActMsg actMsg("PlayerPutsPhotoInPET");
 		actMsg.execute("Doorbot");
 	}
diff --git a/engines/titanic/game/pickup/pick_up.cpp b/engines/titanic/game/pickup/pick_up.cpp
index c660a36..64d2d1d 100644
--- a/engines/titanic/game/pickup/pick_up.cpp
+++ b/engines/titanic/game/pickup/pick_up.cpp
@@ -24,16 +24,26 @@
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CPickUp, CGameObject)
+	ON_MESSAGE(StatusChangeMsg)
+END_MESSAGE_MAP()
+
 void CPickUp::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writeNumberLine(_fieldBC, indent);
+	file->writeNumberLine(_enabled, indent);
 	CGameObject::save(file, indent);
 }
 
 void CPickUp::load(SimpleFile *file) {
 	file->readNumber();
-	_fieldBC = file->readNumber();
+	_enabled = file->readNumber();
 	CGameObject::load(file);
 }
 
+bool CPickUp::StatusChangeMsg(CStatusChangeMsg *msg) {
+	_enabled = msg->_newStatus == 1;
+	setVisible(_enabled);
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/game/pickup/pick_up.h b/engines/titanic/game/pickup/pick_up.h
index f0b6794..f5ee06f 100644
--- a/engines/titanic/game/pickup/pick_up.h
+++ b/engines/titanic/game/pickup/pick_up.h
@@ -28,11 +28,13 @@
 namespace Titanic {
 
 class CPickUp : public CGameObject {
-private:
-	int _fieldBC;
+	DECLARE_MESSAGE_MAP;
+	bool StatusChangeMsg(CStatusChangeMsg *msg);
+protected:
+	bool _enabled;
 public:
 	CLASSDEF;
-	CPickUp() : CGameObject(), _fieldBC(0) {}
+	CPickUp() : CGameObject(), _enabled(false) {}
 
 	/**
 	 * Save the data for the class to file
diff --git a/engines/titanic/game/pickup/pick_up_bar_glass.cpp b/engines/titanic/game/pickup/pick_up_bar_glass.cpp
index 85b8832..9da17b1 100644
--- a/engines/titanic/game/pickup/pick_up_bar_glass.cpp
+++ b/engines/titanic/game/pickup/pick_up_bar_glass.cpp
@@ -21,9 +21,16 @@
  */
 
 #include "titanic/game/pickup/pick_up_bar_glass.h"
+#include "titanic/core/project_item.h"
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CPickUpBarGlass, CPickUp)
+	ON_MESSAGE(StatusChangeMsg)
+	ON_MESSAGE(MouseDragStartMsg)
+	ON_MESSAGE(MouseButtonDownMsg)
+END_MESSAGE_MAP()
+
 void CPickUpBarGlass::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
 	CPickUp::save(file, indent);
@@ -34,4 +41,48 @@ void CPickUpBarGlass::load(SimpleFile *file) {
 	CPickUp::load(file);
 }
 
+bool CPickUpBarGlass::StatusChangeMsg(CStatusChangeMsg *msg) {
+	switch (msg->_newStatus) {
+	case 0:
+		setVisible(false);
+		_enabled = false;
+		break;
+	case 1:
+		setVisible(true);
+		_enabled = true;
+		break;
+	case 2:
+		setVisible(true);
+		_enabled = false;
+		break;
+	default:
+		break;
+	}
+
+	return true;
+}
+
+bool CPickUpBarGlass::MouseDragStartMsg(CMouseDragStartMsg *msg) {
+	if (checkStartDragging(msg) && _enabled) {
+		CTurnOn onMsg;
+		onMsg.execute("BeerGlass");
+		CVisibleMsg visibleMsg;
+		visibleMsg.execute("BeerGlass");
+		CPassOnDragStartMsg passMsg(msg->_mousePos, 1, 3);
+		passMsg.execute("BeerGlass");
+
+		msg->_dragItem = getRoot()->findByName("BeerGlass");
+
+		CActMsg actMsg("PlayerTakesGlass");
+		actMsg.execute("Barbot");
+		return true;
+	} else {
+		return false;
+	}
+}
+
+bool CPickUpBarGlass::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/game/pickup/pick_up_bar_glass.h b/engines/titanic/game/pickup/pick_up_bar_glass.h
index b5ef6f5..d273d96 100644
--- a/engines/titanic/game/pickup/pick_up_bar_glass.h
+++ b/engines/titanic/game/pickup/pick_up_bar_glass.h
@@ -28,6 +28,10 @@
 namespace Titanic {
 
 class CPickUpBarGlass : public CPickUp {
+	DECLARE_MESSAGE_MAP;
+	bool StatusChangeMsg(CStatusChangeMsg *msg);
+	bool MouseDragStartMsg(CMouseDragStartMsg *msg);
+	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
 public:
 	CLASSDEF;
 
diff --git a/engines/titanic/game/pickup/pick_up_hose.cpp b/engines/titanic/game/pickup/pick_up_hose.cpp
index 7375dda..d07088c 100644
--- a/engines/titanic/game/pickup/pick_up_hose.cpp
+++ b/engines/titanic/game/pickup/pick_up_hose.cpp
@@ -21,14 +21,24 @@
  */
 
 #include "titanic/game/pickup/pick_up_hose.h"
+#include "titanic/core/project_item.h"
+#include "titanic/core/room_item.h"
+#include "titanic/core/view_item.h"
 
 namespace Titanic {
 
-int CPickUpHose::_v1;
+BEGIN_MESSAGE_MAP(CPickUpHose, CPickUp)
+	ON_MESSAGE(MouseDragStartMsg)
+	ON_MESSAGE(StatusChangeMsg)
+	ON_MESSAGE(EnterViewMsg)
+	ON_MESSAGE(MouseButtonDownMsg)
+END_MESSAGE_MAP()
+
+bool CPickUpHose::_v1;
 
 void CPickUpHose::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writeQuotedLine(_string1, indent);
+	file->writeQuotedLine(_target, indent);
 	file->writeNumberLine(_v1, indent);
 
 	CPickUp::save(file, indent);
@@ -36,10 +46,61 @@ void CPickUpHose::save(SimpleFile *file, int indent) {
 
 void CPickUpHose::load(SimpleFile *file) {
 	file->readNumber();
-	_string1 = file->readString();
+	_target = file->readString();
 	_v1 = file->readNumber();
 
 	CPickUp::load(file);
 }
 
+bool CPickUpHose::MouseDragStartMsg(CMouseDragStartMsg *msg) {
+	if (!checkStartDragging(msg))
+		return true;
+	if (_v1 || !_enabled)
+		return false;
+
+	CViewItem *view = getView();
+	if (view) {
+		_v1 = true;
+		CRoomItem *room = locateRoom("Arboretum");
+		CTreeItem *hose = room ? room->findByName("Hose") : nullptr;
+
+		if (!hose) {
+			room = locateRoom("FrozenArboretum");
+			if (room)
+				hose = room->findByName("Hose");
+		}
+
+		if (hose) {
+			CVisibleMsg visibleMsg;
+			visibleMsg.execute(this);
+			moveUnder(view);
+
+			CPassOnDragStartMsg passMsg(msg->_mousePos, 1);
+			passMsg.execute("Hose");
+
+			msg->_dragItem = getRoot()->findByName("Hose");
+			_cursorId = CURSOR_IGNORE;
+
+			CActMsg actMsg("PlayerGetsHose");
+			actMsg.execute(_target);
+		}
+	}
+
+	return true;
+}
+
+bool CPickUpHose::StatusChangeMsg(CStatusChangeMsg *msg) {
+	_cursorId = msg->_newStatus == 1 ? CURSOR_HAND : CURSOR_IGNORE;
+	return true;
+}
+
+bool CPickUpHose::EnterViewMsg(CEnterViewMsg *msg) {
+	_cursorId = CURSOR_IGNORE;
+	return true;
+}
+
+bool CPickUpHose::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+	return _enabled;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/game/pickup/pick_up_hose.h b/engines/titanic/game/pickup/pick_up_hose.h
index 80ccedc..2ad7c2a 100644
--- a/engines/titanic/game/pickup/pick_up_hose.h
+++ b/engines/titanic/game/pickup/pick_up_hose.h
@@ -28,10 +28,15 @@
 namespace Titanic {
 
 class CPickUpHose : public CPickUp {
+	DECLARE_MESSAGE_MAP;
+	bool MouseDragStartMsg(CMouseDragStartMsg *msg);
+	bool StatusChangeMsg(CStatusChangeMsg *msg);
+	bool EnterViewMsg(CEnterViewMsg *msg);
+	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
 private:
-	static int _v1;
+	static bool _v1;
 
-	CString _string1;
+	CString _target;
 public:
 	CLASSDEF;
 
diff --git a/engines/titanic/game/pickup/pick_up_lemon.cpp b/engines/titanic/game/pickup/pick_up_lemon.cpp
index 772114f..5109c36 100644
--- a/engines/titanic/game/pickup/pick_up_lemon.cpp
+++ b/engines/titanic/game/pickup/pick_up_lemon.cpp
@@ -21,9 +21,15 @@
  */
 
 #include "titanic/game/pickup/pick_up_lemon.h"
+#include "titanic/core/project_item.h"
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CPickUpLemon, CPickUp)
+	ON_MESSAGE(MouseButtonDownMsg)
+	ON_MESSAGE(MouseDragStartMsg)
+END_MESSAGE_MAP()
+
 void CPickUpLemon::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
 	CPickUp::save(file, indent);
@@ -34,4 +40,23 @@ void CPickUpLemon::load(SimpleFile *file) {
 	CPickUp::load(file);
 }
 
+bool CPickUpLemon::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+	return true;
+}
+
+bool CPickUpLemon::MouseDragStartMsg(CMouseDragStartMsg *msg) {
+	if (!checkStartDragging(msg))
+		return true;
+	if (!_enabled)
+		return false;
+
+	CVisibleMsg visibleMsg;
+	visibleMsg.execute("Lemon");
+	CPassOnDragStartMsg passMsg(msg->_mousePos, 1);
+	passMsg.execute("Lemon");
+
+	msg->_dragItem = getRoot()->findByName("Lemon");
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/game/pickup/pick_up_lemon.h b/engines/titanic/game/pickup/pick_up_lemon.h
index 0312c71..c196acd 100644
--- a/engines/titanic/game/pickup/pick_up_lemon.h
+++ b/engines/titanic/game/pickup/pick_up_lemon.h
@@ -28,6 +28,9 @@
 namespace Titanic {
 
 class CPickUpLemon : public CPickUp {
+	DECLARE_MESSAGE_MAP;
+	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+	bool MouseDragStartMsg(CMouseDragStartMsg *msg);
 public:
 	CLASSDEF;
 
diff --git a/engines/titanic/game/pickup/pick_up_speech_centre.cpp b/engines/titanic/game/pickup/pick_up_speech_centre.cpp
index 0b9a8d2..d337355 100644
--- a/engines/titanic/game/pickup/pick_up_speech_centre.cpp
+++ b/engines/titanic/game/pickup/pick_up_speech_centre.cpp
@@ -21,9 +21,16 @@
  */
 
 #include "titanic/game/pickup/pick_up_speech_centre.h"
+#include "titanic/core/project_item.h"
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CPickUpSpeechCentre, CPickUp)
+	ON_MESSAGE(MouseButtonDownMsg)
+	ON_MESSAGE(StatusChangeMsg)
+	ON_MESSAGE(MouseDragStartMsg)
+END_MESSAGE_MAP()
+
 void CPickUpSpeechCentre::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
 	CPickUp::save(file, indent);
@@ -34,4 +41,33 @@ void CPickUpSpeechCentre::load(SimpleFile *file) {
 	CPickUp::load(file);
 }
 
+bool CPickUpSpeechCentre::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+	return true;
+}
+
+bool CPickUpSpeechCentre::StatusChangeMsg(CStatusChangeMsg *msg) {
+	_enabled = msg->_newStatus == 1;
+	return true;
+}
+
+bool CPickUpSpeechCentre::MouseDragStartMsg(CMouseDragStartMsg *msg) {
+	if (checkStartDragging(msg)) {
+		if (_enabled) {
+			CVisibleMsg visibleMsg;
+			visibleMsg.execute("SpeechCentre");
+			CPassOnDragStartMsg passMsg(msg->_mousePos, 1);
+			passMsg.execute("SpeechCentre");
+
+			msg->_dragItem = getRoot()->findByName("SpeechCentre");
+
+			CActMsg actMsg("PlayerGetsSpeechCentre");
+			actMsg.execute("SeasonalAdjust");
+		} else {
+			petDisplayMessage("You can',27h,'t pick this up on account of it being stuck to the branch.");
+		}
+	}
+
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/game/pickup/pick_up_speech_centre.h b/engines/titanic/game/pickup/pick_up_speech_centre.h
index 29dce04..81ee0b5 100644
--- a/engines/titanic/game/pickup/pick_up_speech_centre.h
+++ b/engines/titanic/game/pickup/pick_up_speech_centre.h
@@ -28,6 +28,10 @@
 namespace Titanic {
 
 class CPickUpSpeechCentre : public CPickUp {
+	DECLARE_MESSAGE_MAP;
+	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+	bool StatusChangeMsg(CStatusChangeMsg *msg);
+	bool MouseDragStartMsg(CMouseDragStartMsg *msg);
 public:
 	CLASSDEF;
 
diff --git a/engines/titanic/game/pickup/pick_up_vis_centre.cpp b/engines/titanic/game/pickup/pick_up_vis_centre.cpp
index 796e467..baf1763 100644
--- a/engines/titanic/game/pickup/pick_up_vis_centre.cpp
+++ b/engines/titanic/game/pickup/pick_up_vis_centre.cpp
@@ -24,6 +24,11 @@
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CPickUpVisCentre, CPickUp)
+	ON_MESSAGE(MouseButtonDownMsg)
+	ON_MESSAGE(MouseDragStartMsg)
+END_MESSAGE_MAP()
+
 void CPickUpVisCentre::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
 	CPickUp::save(file, indent);
@@ -34,4 +39,22 @@ void CPickUpVisCentre::load(SimpleFile *file) {
 	CPickUp::load(file);
 }
 
+
+bool CPickUpVisCentre::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+	return true;
+}
+
+bool CPickUpVisCentre::MouseDragStartMsg(CMouseDragStartMsg *msg) {
+	if (!checkStartDragging(msg) || !_enabled)
+		return false;
+
+	setVisible(false);
+	CVisibleMsg visibleMsg;
+	visibleMsg.execute("VisionCentre");
+	msg->execute("VisionCentre");
+	CActMsg actMsg("PlayerTakesVisCentre");
+	actMsg.execute("Barbot");
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/game/pickup/pick_up_vis_centre.h b/engines/titanic/game/pickup/pick_up_vis_centre.h
index 4f808f7..a5f5921 100644
--- a/engines/titanic/game/pickup/pick_up_vis_centre.h
+++ b/engines/titanic/game/pickup/pick_up_vis_centre.h
@@ -28,6 +28,9 @@
 namespace Titanic {
 
 class CPickUpVisCentre : public CPickUp {
+	DECLARE_MESSAGE_MAP;
+	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+	bool MouseDragStartMsg(CMouseDragStartMsg *msg);
 public:
 	CLASSDEF;
 





More information about the Scummvm-git-logs mailing list