diff options
author | Paul Gilbert | 2016-08-13 09:52:44 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-13 09:52:44 -0400 |
commit | 5c64e27692f041c231e08575d03642b4873c887e (patch) | |
tree | 5d099f3b09304c9dea7aa37f5b5f47292dd8eb8b /engines/titanic/npcs | |
parent | c270b30a7937186fecd016b9a74421d633dd90c0 (diff) | |
download | scummvm-rg350-5c64e27692f041c231e08575d03642b4873c887e.tar.gz scummvm-rg350-5c64e27692f041c231e08575d03642b4873c887e.tar.bz2 scummvm-rg350-5c64e27692f041c231e08575d03642b4873c887e.zip |
TITANIC: Implemented several NPC related game classes
Diffstat (limited to 'engines/titanic/npcs')
-rw-r--r-- | engines/titanic/npcs/barbot.cpp | 86 | ||||
-rw-r--r-- | engines/titanic/npcs/barbot.h | 14 | ||||
-rw-r--r-- | engines/titanic/npcs/callbot.cpp | 38 | ||||
-rw-r--r-- | engines/titanic/npcs/callbot.h | 7 | ||||
-rw-r--r-- | engines/titanic/npcs/robot_controller.cpp | 22 | ||||
-rw-r--r-- | engines/titanic/npcs/robot_controller.h | 5 | ||||
-rw-r--r-- | engines/titanic/npcs/starlings.cpp | 25 | ||||
-rw-r--r-- | engines/titanic/npcs/starlings.h | 5 |
8 files changed, 184 insertions, 18 deletions
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(); |