aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-13 09:52:44 -0400
committerPaul Gilbert2016-08-13 09:52:44 -0400
commit5c64e27692f041c231e08575d03642b4873c887e (patch)
tree5d099f3b09304c9dea7aa37f5b5f47292dd8eb8b
parentc270b30a7937186fecd016b9a74421d633dd90c0 (diff)
downloadscummvm-rg350-5c64e27692f041c231e08575d03642b4873c887e.tar.gz
scummvm-rg350-5c64e27692f041c231e08575d03642b4873c887e.tar.bz2
scummvm-rg350-5c64e27692f041c231e08575d03642b4873c887e.zip
TITANIC: Implemented several NPC related game classes
-rw-r--r--engines/titanic/messages/messages.h2
-rw-r--r--engines/titanic/npcs/barbot.cpp86
-rw-r--r--engines/titanic/npcs/barbot.h14
-rw-r--r--engines/titanic/npcs/callbot.cpp38
-rw-r--r--engines/titanic/npcs/callbot.h7
-rw-r--r--engines/titanic/npcs/robot_controller.cpp22
-rw-r--r--engines/titanic/npcs/robot_controller.h5
-rw-r--r--engines/titanic/npcs/starlings.cpp25
-rw-r--r--engines/titanic/npcs/starlings.h5
9 files changed, 185 insertions, 19 deletions
diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h
index c1d962f656..0935689db7 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 8f1c5e6ab3..079e8fe10b 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 7557fdd2c6..123e39afed 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 eb0d4b71d5..4af9876b35 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 9b89d59d3f..ca0e0c55b2 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 98866e4505..34c75e30eb 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 6cbf57aef2..326c2280dd 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 333f4c4b7a..7e5907f577 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 4d96e5c77f..1998e6490d 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();