[Scummvm-cvs-logs] scummvm master -> 5c64e27692f041c231e08575d03642b4873c887e

dreammaster dreammaster at scummvm.org
Sat Aug 13 15:52:53 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:
5c64e27692 TITANIC: Implemented several NPC related game classes


Commit: 5c64e27692f041c231e08575d03642b4873c887e
    https://github.com/scummvm/scummvm/commit/5c64e27692f041c231e08575d03642b4873c887e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-13T09:52:44-04:00

Commit Message:
TITANIC: Implemented several NPC related game classes

Changed paths:
    engines/titanic/messages/messages.h
    engines/titanic/npcs/barbot.cpp
    engines/titanic/npcs/barbot.h
    engines/titanic/npcs/callbot.cpp
    engines/titanic/npcs/callbot.h
    engines/titanic/npcs/robot_controller.cpp
    engines/titanic/npcs/robot_controller.h
    engines/titanic/npcs/starlings.cpp
    engines/titanic/npcs/starlings.h



diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h
index c1d962f..0935689 100644
--- a/engines/titanic/messages/messages.h
+++ b/engines/titanic/messages/messages.h
@@ -331,7 +331,7 @@ MESSAGE0(CSubSendCCarryMsg);
 MESSAGE0(CSUBTransition);
 MESSAGE0(CSubTurnOffMsg);
 MESSAGE0(CSubTurnOnMsg);
-MESSAGE2(CSummonBotMsg, CString, strValue, "", int, numValue, 0);
+MESSAGE2(CSummonBotMsg, CString, npcName, "", int, value, 0);
 MESSAGE1(CSummonBotQueryMsg, CString, npcName, "");
 MESSAGE1(CTakeHeadPieceMsg, CString, value, "NULL");
 MESSAGE2(CTextInputMsg, CString, input, "", CString, response, "");
diff --git a/engines/titanic/npcs/barbot.cpp b/engines/titanic/npcs/barbot.cpp
index 8f1c5e6..079e8fe 100644
--- a/engines/titanic/npcs/barbot.cpp
+++ b/engines/titanic/npcs/barbot.cpp
@@ -26,6 +26,23 @@ namespace Titanic {
 
 int CBarbot::_v0;
 
+BEGIN_MESSAGE_MAP(CBarbot, CTrueTalkNPC)
+	ON_MESSAGE(ActMsg)
+	ON_MESSAGE(EnterViewMsg)
+	ON_MESSAGE(TurnOn)
+	ON_MESSAGE(TurnOff)
+	ON_MESSAGE(LeaveViewMsg)
+	ON_MESSAGE(MovieEndMsg)
+	ON_MESSAGE(TrueTalkSelfQueueAnimSetMsg)
+	ON_MESSAGE(TrueTalkQueueUpAnimSetMsg)
+	ON_MESSAGE(TrueTalkGetStateValueMsg)
+	ON_MESSAGE(TrueTalkTriggerActionMsg)
+	ON_MESSAGE(FrameMsg)
+	ON_MESSAGE(LoadSuccessMsg)
+	ON_MESSAGE(MovieFrameMsg)
+	ON_MESSAGE(EnterRoomMsg)
+END_MESSAGE_MAP()
+
 CBarbot::CBarbot() : CTrueTalkNPC() {
 	_field108 = 0;
 	_field10C = 0;
@@ -233,9 +250,74 @@ void CBarbot::load(SimpleFile *file) {
 	CTrueTalkNPC::load(file);
 }
 
+bool CBarbot::ActMsg(CActMsg *msg) {
+	// TODO
+	return false;
+}
+
+bool CBarbot::EnterViewMsg(CEnterViewMsg *msg) {
+	// TODO
+	return false;
+}
+
+bool CBarbot::TurnOn(CTurnOn *msg) {
+	// TODO
+	return false;
+}
+
+bool CBarbot::TurnOff(CTurnOff *msg) {
+	// TODO
+	return false;
+}
+
+bool CBarbot::LeaveViewMsg(CLeaveViewMsg *msg) {
+	// TODO
+	return false;
+}
+
+bool CBarbot::MovieEndMsg(CMovieEndMsg *msg) {
+	// TODO
+	return false;
+}
+
+bool CBarbot::TrueTalkSelfQueueAnimSetMsg(CTrueTalkSelfQueueAnimSetMsg *msg) {
+	// TODO
+	return false;
+}
+
+bool CBarbot::TrueTalkQueueUpAnimSetMsg(CTrueTalkQueueUpAnimSetMsg *msg) {
+	// TODO
+	return false;
+}
+
+bool CBarbot::TrueTalkGetStateValueMsg(CTrueTalkGetStateValueMsg *msg) {
+	// TODO
+	return false;
+}
+
+bool CBarbot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) {
+	// TODO
+	return false;
+}
+
+bool CBarbot::FrameMsg(CFrameMsg *msg) {
+	// TODO
+	return false;
+}
+
+bool CBarbot::LoadSuccessMsg(CLoadSuccessMsg *msg) {
+	// TODO
+	return false;
+}
+
+bool CBarbot::MovieFrameMsg(CMovieFrameMsg *msg) {
+	// TODO
+	return false;
+}
+
 bool CBarbot::EnterRoomMsg(CEnterRoomMsg *msg) {
-	warning("TODO: Barbot::CEnterRoomMsg");
-	return true;
+	// TODO
+	return false;
 }
 
 } // End of namespace Titanic
diff --git a/engines/titanic/npcs/barbot.h b/engines/titanic/npcs/barbot.h
index 7557fdd..123e39a 100644
--- a/engines/titanic/npcs/barbot.h
+++ b/engines/titanic/npcs/barbot.h
@@ -29,6 +29,20 @@
 namespace Titanic {
 
 class CBarbot : public CTrueTalkNPC {
+	DECLARE_MESSAGE_MAP;
+	bool ActMsg(CActMsg *msg);
+	bool EnterViewMsg(CEnterViewMsg *msg);
+	bool TurnOn(CTurnOn *msg);
+	bool TurnOff(CTurnOff *msg);
+	bool LeaveViewMsg(CLeaveViewMsg *msg);
+	bool MovieEndMsg(CMovieEndMsg *msg);
+	bool TrueTalkSelfQueueAnimSetMsg(CTrueTalkSelfQueueAnimSetMsg *msg);
+	bool TrueTalkQueueUpAnimSetMsg(CTrueTalkQueueUpAnimSetMsg *msg);
+	bool TrueTalkGetStateValueMsg(CTrueTalkGetStateValueMsg *msg);
+	bool TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg);
+	bool FrameMsg(CFrameMsg *msg);
+	bool LoadSuccessMsg(CLoadSuccessMsg *msg);
+	bool MovieFrameMsg(CMovieFrameMsg *msg);
 	bool EnterRoomMsg(CEnterRoomMsg *msg);
 private:
 	static int _v0;
diff --git a/engines/titanic/npcs/callbot.cpp b/engines/titanic/npcs/callbot.cpp
index eb0d4b7..4af9876 100644
--- a/engines/titanic/npcs/callbot.cpp
+++ b/engines/titanic/npcs/callbot.cpp
@@ -21,26 +21,54 @@
  */
 
 #include "titanic/npcs/callbot.h"
+#include "titanic/core/room_item.h"
 
 namespace Titanic {
 
-CCallBot::CCallBot() : CGameObject(), _fieldC8(0) {
+BEGIN_MESSAGE_MAP(CCallBot, CGameObject)
+	ON_MESSAGE(TurnOn)
+	ON_MESSAGE(EnterViewMsg)
+END_MESSAGE_MAP()
+
+CCallBot::CCallBot() : CGameObject(), _enabled(0) {
 }
 
 void CCallBot::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writeQuotedLine(_string1, indent);
-	file->writeNumberLine(_fieldC8, indent);
+	file->writeQuotedLine(_npcName, indent);
+	file->writeNumberLine(_enabled, indent);
 
 	CGameObject::save(file, indent);
 }
 
 void CCallBot::load(SimpleFile *file) {
 	file->readNumber();
-	_string1 = file->readString();
-	_fieldC8 = file->readNumber();
+	_npcName = file->readString();
+	_enabled = file->readNumber();
 
 	CGameObject::load(file);
 }
 
+bool CCallBot::TurnOn(CTurnOn *msg) {
+	_enabled = true;
+	return true;
+}
+
+bool CCallBot::EnterViewMsg(CEnterViewMsg *msg) {
+	if (_enabled) {
+		CRoomItem *room = getRoom();
+		
+		if (room) {
+			CSummonBotQueryMsg queryMsg;
+			queryMsg._npcName = _npcName;
+			if (queryMsg.execute(room))
+				petOnSummonBot(_npcName, 0);
+		}
+
+		_enabled = false;
+	}
+
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/npcs/callbot.h b/engines/titanic/npcs/callbot.h
index 9b89d59..ca0e0c5 100644
--- a/engines/titanic/npcs/callbot.h
+++ b/engines/titanic/npcs/callbot.h
@@ -28,9 +28,12 @@
 namespace Titanic {
 
 class CCallBot : public CGameObject {
+	DECLARE_MESSAGE_MAP;
+	bool TurnOn(CTurnOn *msg);
+	bool EnterViewMsg(CEnterViewMsg *msg);
 protected:
-	CString _string1;
-	int _fieldC8;
+	CString _npcName;
+	bool _enabled;
 public:
 	CLASSDEF;
 	CCallBot();
diff --git a/engines/titanic/npcs/robot_controller.cpp b/engines/titanic/npcs/robot_controller.cpp
index 98866e4..34c75e3 100644
--- a/engines/titanic/npcs/robot_controller.cpp
+++ b/engines/titanic/npcs/robot_controller.cpp
@@ -24,21 +24,37 @@
 
 namespace Titanic {
 
-CRobotController::CRobotController() : CGameObject(), _string1("BellBot") {
+BEGIN_MESSAGE_MAP(CRobotController, CGameObject)
+	ON_MESSAGE(SummonBotMsg)
+	ON_MESSAGE(SummonBotQueryMsg)
+END_MESSAGE_MAP()
+
+CRobotController::CRobotController() : CGameObject(), _robotName("BellBot") {
 }
 
 void CRobotController::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writeQuotedLine(_string1, indent);
+	file->writeQuotedLine(_robotName, indent);
 
 	CGameObject::save(file, indent);
 }
 
 void CRobotController::load(SimpleFile *file) {
 	file->readNumber();
-	_string1 = file->readString();
+	_robotName = file->readString();
 
 	CGameObject::load(file);
 }
 
+bool CRobotController::SummonBotMsg(CSummonBotMsg *msg) {
+	if (!petDismissBot(msg->_npcName))
+		petOnSummonBot(msg->_npcName, msg->_value);
+
+	return true;
+}
+
+bool CRobotController::SummonBotQueryMsg(CSummonBotQueryMsg *msg) {
+	return _robotName == msg->_npcName;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/npcs/robot_controller.h b/engines/titanic/npcs/robot_controller.h
index 6cbf57a..326c228 100644
--- a/engines/titanic/npcs/robot_controller.h
+++ b/engines/titanic/npcs/robot_controller.h
@@ -28,8 +28,11 @@
 namespace Titanic {
 
 class CRobotController : public CGameObject {
+	DECLARE_MESSAGE_MAP;
+	bool SummonBotMsg(CSummonBotMsg *msg);
+	bool SummonBotQueryMsg(CSummonBotQueryMsg *msg);
 protected:
-	CString _string1;
+	CString _robotName;
 public:
 	CLASSDEF;
 	CRobotController();
diff --git a/engines/titanic/npcs/starlings.cpp b/engines/titanic/npcs/starlings.cpp
index 333f4c4..7e5907f 100644
--- a/engines/titanic/npcs/starlings.cpp
+++ b/engines/titanic/npcs/starlings.cpp
@@ -24,23 +24,40 @@
 
 namespace Titanic {
 
-int CStarlings::_v1;
+BEGIN_MESSAGE_MAP(CStarlings, CCharacter)
+	ON_MESSAGE(EnterViewMsg)
+	ON_MESSAGE(StatusChangeMsg)
+END_MESSAGE_MAP()
 
-CStarlings::CStarlings() : CCharacter() {
+CStarlings::CStarlings() : CCharacter(), _enabled(false) {
 }
 
 void CStarlings::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writeNumberLine(_v1, indent);
+	file->writeNumberLine(_enabled, indent);
 
 	CCharacter::save(file, indent);
 }
 
 void CStarlings::load(SimpleFile *file) {
 	file->readNumber();
-	_v1 = file->readNumber();
+	_enabled = file->readNumber();
 
 	CCharacter::load(file);
 }
 
+bool CStarlings::EnterViewMsg(CEnterViewMsg *msg) {
+	if (_enabled)
+		setVisible(false);
+	else
+		playMovie(MOVIE_REPEAT);
+	return true;
+}
+
+bool CStarlings::StatusChangeMsg(CStatusChangeMsg *msg) {
+	_enabled = msg->_newStatus == 1;
+	setVisible(!_enabled);
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/npcs/starlings.h b/engines/titanic/npcs/starlings.h
index 4d96e5c..1998e64 100644
--- a/engines/titanic/npcs/starlings.h
+++ b/engines/titanic/npcs/starlings.h
@@ -28,8 +28,11 @@
 namespace Titanic {
 
 class CStarlings : public CCharacter {
+	DECLARE_MESSAGE_MAP;
+	bool EnterViewMsg(CEnterViewMsg *msg);
+	bool StatusChangeMsg(CStatusChangeMsg *msg);
 private:
-	static int _v1;
+	bool _enabled;
 public:
 	CLASSDEF;
 	CStarlings();






More information about the Scummvm-git-logs mailing list