[Scummvm-cvs-logs] scummvm master -> 33e4afedde5a31ab97a4e1965869b30dd7964e49

dreammaster dreammaster at scummvm.org
Tue Aug 16 04:31:41 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:
33e4afedde TITANIC: Implemented CHeadPiece and ear classes


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

Commit Message:
TITANIC: Implemented CHeadPiece and ear classes

Changed paths:
    engines/titanic/carry/bowl_ear.cpp
    engines/titanic/carry/bowl_ear.h
    engines/titanic/carry/ear.cpp
    engines/titanic/carry/ear.h
    engines/titanic/carry/head_piece.cpp
    engines/titanic/carry/head_piece.h
    engines/titanic/carry/phonograph_ear.cpp
    engines/titanic/carry/phonograph_ear.h
    engines/titanic/core/saveable_object.cpp
    engines/titanic/messages/messages.h



diff --git a/engines/titanic/carry/bowl_ear.cpp b/engines/titanic/carry/bowl_ear.cpp
index bb5172e..852a778 100644
--- a/engines/titanic/carry/bowl_ear.cpp
+++ b/engines/titanic/carry/bowl_ear.cpp
@@ -24,6 +24,13 @@
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CBowlEar, CEar)
+	ON_MESSAGE(PETGainedObjectMsg)
+	ON_MESSAGE(ReplaceBowlAndNutsMsg)
+	ON_MESSAGE(NutPuzzleMsg)
+	ON_MESSAGE(MouseDragStartMsg)
+END_MESSAGE_MAP()
+
 void CBowlEar::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
 	CEar::save(file, indent);
@@ -34,4 +41,28 @@ void CBowlEar::load(SimpleFile *file) {
 	CEar::load(file);
 }
 
+bool CBowlEar::PETGainedObjectMsg(CPETGainedObjectMsg *msg) {
+	CBowlStateChangeMsg changeMsg(3);
+	changeMsg.execute("ParrotNutBowlActor");
+
+	return CEar::PETGainedObjectMsg(msg);
+}
+
+bool CBowlEar::ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg) {
+	setVisible(false);
+	return true;
+}
+
+bool CBowlEar::NutPuzzleMsg(CNutPuzzleMsg *msg) {
+	if (msg->_value == "BowlUnlocked")
+		_fieldE0 = 1;
+
+	return true;
+}
+
+bool CBowlEar::MouseDragStartMsg(CMouseDragStartMsg *msg) {
+	setVisible(true);
+	return CEar::MouseDragStartMsg(msg);
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/carry/bowl_ear.h b/engines/titanic/carry/bowl_ear.h
index 4f2fbea..d78092f 100644
--- a/engines/titanic/carry/bowl_ear.h
+++ b/engines/titanic/carry/bowl_ear.h
@@ -28,6 +28,11 @@
 namespace Titanic {
 
 class CBowlEar : public CEar {
+	DECLARE_MESSAGE_MAP;
+	bool PETGainedObjectMsg(CPETGainedObjectMsg *msg);
+	bool ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg);
+	bool NutPuzzleMsg(CNutPuzzleMsg *msg);
+	bool MouseDragStartMsg(CMouseDragStartMsg *msg);
 public:
 	CLASSDEF;
 
diff --git a/engines/titanic/carry/ear.cpp b/engines/titanic/carry/ear.cpp
index 8d85e24..a2234bc 100644
--- a/engines/titanic/carry/ear.cpp
+++ b/engines/titanic/carry/ear.cpp
@@ -21,9 +21,15 @@
  */
 
 #include "titanic/carry/ear.h"
+#include "titanic/game/head_slot.h"
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CEar, CHeadPiece)
+	ON_MESSAGE(ActMsg)
+	ON_MESSAGE(UseWithOtherMsg)
+END_MESSAGE_MAP()
+
 CEar::CEar() : CHeadPiece() {
 }
 
@@ -37,4 +43,25 @@ void CEar::load(SimpleFile *file) {
 	CHeadPiece::load(file);
 }
 
+bool CEar::ActMsg(CActMsg *msg) {
+	if (msg->_action == "MusicSolved")
+		_fieldE0 = true;
+	return true;
+}
+
+bool CEar::UseWithOtherMsg(CUseWithOtherMsg *msg) {
+	CHeadSlot *slot = dynamic_cast<CHeadSlot *>(msg->_other);
+	if (slot) {
+		setVisible(false);
+		petMoveToHiddenRoom();
+		setPosition(Point(0, 0));
+
+		CAddHeadPieceMsg addMsg(getName());
+		if (addMsg._value != "NULL")
+			addMsg.execute(addMsg._value == "Ear1" ? "Ear1Slot" : "Ear2Slot");
+	}
+
+	return CCarry::UseWithOtherMsg(msg);
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/carry/ear.h b/engines/titanic/carry/ear.h
index edef873..a357f46 100644
--- a/engines/titanic/carry/ear.h
+++ b/engines/titanic/carry/ear.h
@@ -28,6 +28,9 @@
 namespace Titanic {
 
 class CEar : public CHeadPiece {
+	DECLARE_MESSAGE_MAP;
+	bool ActMsg(CActMsg *msg);
+	bool UseWithOtherMsg(CUseWithOtherMsg *msg);
 public:
 	CLASSDEF;
 	CEar();
diff --git a/engines/titanic/carry/head_piece.cpp b/engines/titanic/carry/head_piece.cpp
index ae70964..3485048 100644
--- a/engines/titanic/carry/head_piece.cpp
+++ b/engines/titanic/carry/head_piece.cpp
@@ -24,13 +24,19 @@
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CHeadPiece, CCarry)
+	ON_MESSAGE(SenseWorkingMsg)
+	ON_MESSAGE(PETGainedObjectMsg)
+	ON_MESSAGE(MouseDragStartMsg)
+END_MESSAGE_MAP()
+
 CHeadPiece::CHeadPiece() : CCarry(), _string6("Not Working"),
-		_field12C(0), _field13C(0) {
+		_flag(0), _field13C(false) {
 }
 
 void CHeadPiece::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writeNumberLine(_field12C, indent);
+	file->writeNumberLine(_flag, indent);
 	file->writeQuotedLine(_string6, indent);
 	file->writeNumberLine(_field13C, indent);
 
@@ -39,11 +45,49 @@ void CHeadPiece::save(SimpleFile *file, int indent) {
 
 void CHeadPiece::load(SimpleFile *file) {
 	file->readNumber();
-	_field12C = file->readNumber();
+	_flag = file->readNumber();
 	_string6 = file->readString();
 	_field13C = file->readNumber();
 
 	CCarry::load(file);
 }
 
+bool CHeadPiece::SenseWorkingMsg(CSenseWorkingMsg *msg) {
+	_string6 = msg->_value;
+	return true;
+}
+
+bool CHeadPiece::PETGainedObjectMsg(CPETGainedObjectMsg *msg) {
+	_visibleFrame = 1;
+	if (!_field13C) {
+		stateInc38();
+		_field13C = true;
+	}
+
+	return true;
+}
+
+bool CHeadPiece::MouseDragStartMsg(CMouseDragStartMsg *msg) {
+	if (!checkPoint(msg->_mousePos, false, true)) {
+		return false;
+	} else if (!_fieldE0) {
+		return true;
+	}
+
+	if (_flag) {
+		setVisible(true);
+		moveToView();
+		setPosition(Point(msg->_mousePos.x - _bounds.width() / 2,
+			msg->_mousePos.y - _bounds.height() / 2));
+
+		CTakeHeadPieceMsg takeMsg(getName());
+		if (takeMsg._value != "NULL")
+			takeMsg.execute("TitaniaControl");
+
+		_flag = false;
+	}
+
+	return CCarry::MouseDragStartMsg(msg);
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/carry/head_piece.h b/engines/titanic/carry/head_piece.h
index 05ac772..a764960 100644
--- a/engines/titanic/carry/head_piece.h
+++ b/engines/titanic/carry/head_piece.h
@@ -24,14 +24,19 @@
 #define TITANIC_HEAD_PIECE_H
 
 #include "titanic/carry/carry.h"
+#include "titanic/messages/pet_messages.h"
 
 namespace Titanic {
 
 class CHeadPiece : public CCarry {
+	DECLARE_MESSAGE_MAP;
+	bool SenseWorkingMsg(CSenseWorkingMsg *msg);
+	bool PETGainedObjectMsg(CPETGainedObjectMsg *msg);
+	bool MouseDragStartMsg(CMouseDragStartMsg *msg);
 private:
-	int _field12C;
+	bool _flag;
 	CString _string6;
-	int _field13C;
+	bool _field13C;
 public:
 	CLASSDEF;
 	CHeadPiece();
diff --git a/engines/titanic/carry/phonograph_ear.cpp b/engines/titanic/carry/phonograph_ear.cpp
index ceb71ba..9cd461d 100644
--- a/engines/titanic/carry/phonograph_ear.cpp
+++ b/engines/titanic/carry/phonograph_ear.cpp
@@ -24,6 +24,12 @@
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CPhonographEar, CEar)
+	ON_MESSAGE(CorrectMusicPlayedMsg)
+	ON_MESSAGE(PETGainedObjectMsg)
+	ON_MESSAGE(TimerMsg)
+END_MESSAGE_MAP()
+
 void CPhonographEar::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
 	file->writeNumberLine(_field140, indent);
@@ -36,4 +42,24 @@ void CPhonographEar::load(SimpleFile *file) {
 	CEar::load(file);
 }
 
+bool CPhonographEar::CorrectMusicPlayedMsg(CCorrectMusicPlayedMsg *msg) {
+	_fieldE0 = true;
+	return true;
+}
+
+bool CPhonographEar::PETGainedObjectMsg(CPETGainedObjectMsg *msg) {
+	if (_field140) {
+		_field140 = false;
+		addTimer(1000);
+	}
+
+	return PETGainedObjectMsg(msg);
+}
+
+bool CPhonographEar::TimerMsg(CTimerMsg *msg) {
+	CVisibleMsg visibleMsg;
+	visibleMsg.execute("Replacement Phonograph Ear");
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/carry/phonograph_ear.h b/engines/titanic/carry/phonograph_ear.h
index 582db9f..b5db015 100644
--- a/engines/titanic/carry/phonograph_ear.h
+++ b/engines/titanic/carry/phonograph_ear.h
@@ -28,11 +28,15 @@
 namespace Titanic {
 
 class CPhonographEar : public CEar {
+	DECLARE_MESSAGE_MAP;
+	bool CorrectMusicPlayedMsg(CCorrectMusicPlayedMsg *msg);
+	bool PETGainedObjectMsg(CPETGainedObjectMsg *msg);
+	bool TimerMsg(CTimerMsg *msg);
 private:
-	int _field140;
+	bool _field140;
 public:
 	CLASSDEF;
-	CPhonographEar() : CEar(), _field140(1) {}
+	CPhonographEar() : CEar(), _field140(true) {}
 
 	/**
 	 * Save the data for the class to file
diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp
index 080c34b..2d44126 100644
--- a/engines/titanic/core/saveable_object.cpp
+++ b/engines/titanic/core/saveable_object.cpp
@@ -757,7 +757,7 @@ DEFFN(CAutoSoundEvent);
 DEFFN(CBilgeAutoSoundEvent);
 DEFFN(CBilgeDispensorEvent);
 DEFFN(CBodyInBilgeRoomMsg);
-DEFFN(CBowlStateChange);
+DEFFN(CBowlStateChangeMsg);
 DEFFN(CCarryObjectArrivedMsg);
 DEFFN(CChangeMusicMsg);
 DEFFN(CChangeSeasonMsg);
@@ -1344,7 +1344,7 @@ void CSaveableObject::initClassList() {
 	ADDFN(CBilgeAutoSoundEvent, CAutoSoundEvent);
 	ADDFN(CBilgeDispensorEvent, CAutoSoundEvent);
 	ADDFN(CBodyInBilgeRoomMsg, CMessage);
-	ADDFN(CBowlStateChange, CMessage);
+	ADDFN(CBowlStateChangeMsg, CMessage);
 	ADDFN(CCarryObjectArrivedMsg, CMessage);
 	ADDFN(CChangeMusicMsg, CMessage);
 	ADDFN(CChangeSeasonMsg, CMessage);
diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h
index 6076d43..9ee9ccb 100644
--- a/engines/titanic/messages/messages.h
+++ b/engines/titanic/messages/messages.h
@@ -206,7 +206,7 @@ MESSAGE1(CAnimateMaitreDMsg, int, value, 0);
 MESSAGE1(CArboretumGateMsg, int, value, 0);
 MESSAGE0(CArmPickedUpFromTableMsg);
 MESSAGE0(CBodyInBilgeRoomMsg);
-MESSAGE1(CBowlStateChange, int, value, 0);
+MESSAGE1(CBowlStateChangeMsg, int, value, 0);
 MESSAGE2(CCarryObjectArrivedMsg, CString, strValue, "", int, numValue, 0);
 MESSAGE2(CChangeMusicMsg, CString, filename, "", int, flags, 0);
 MESSAGE1(CChangeSeasonMsg, CString, season, "Summer");






More information about the Scummvm-git-logs mailing list