From 54a6ec5c074bfb2d83f1841c5775ac606dbd9d90 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 14 Aug 2016 12:30:04 -0400 Subject: TITANIC: Implemented CSummonBots class --- engines/titanic/npcs/summon_bots.cpp | 37 ++++++++++++++++++++++++++++++++++++ engines/titanic/npcs/summon_bots.h | 3 +++ 2 files changed, 40 insertions(+) (limited to 'engines/titanic') diff --git a/engines/titanic/npcs/summon_bots.cpp b/engines/titanic/npcs/summon_bots.cpp index 8796e5ffda..6d71847548 100644 --- a/engines/titanic/npcs/summon_bots.cpp +++ b/engines/titanic/npcs/summon_bots.cpp @@ -24,6 +24,11 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CSummonBots, CRobotController) + ON_MESSAGE(SummonBotQueryMsg) + ON_MESSAGE(SummonBotMsg) +END_MESSAGE_MAP() + CSummonBots::CSummonBots() : CRobotController(), _string2("NULL"), _fieldC8(0), _fieldCC(0) { } @@ -46,4 +51,36 @@ void CSummonBots::load(SimpleFile *file) { CRobotController::load(file); } +bool CSummonBots::SummonBotQueryMsg(CSummonBotQueryMsg *msg) { + if (msg->_npcName == "BellBot") { + if (_fieldC8 && !petCheckNode(_string2)) + return true; + } else if (msg->_npcName == "DoorBot") { + if (_fieldCC && !petCheckNode(_string2)) + return true; + } + + return false; +} + +bool CSummonBots::SummonBotMsg(CSummonBotMsg *msg) { + if (msg->_npcName == "BellBot") { + if (!_fieldC8) + return false; + + if (petDismissBot("BellBot")) + petOnSummonBot("Bellbot", msg->_value); + } else if (msg->_npcName == "DoorBot") { + if (!_fieldCC) + return false; + + if (petDismissBot("Doorbot")) + petOnSummonBot("Doorbot", msg->_value); + } else { + return false; + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/npcs/summon_bots.h b/engines/titanic/npcs/summon_bots.h index ee537fee76..1da6e68245 100644 --- a/engines/titanic/npcs/summon_bots.h +++ b/engines/titanic/npcs/summon_bots.h @@ -28,6 +28,9 @@ namespace Titanic { class CSummonBots : public CRobotController { + DECLARE_MESSAGE_MAP; + bool SummonBotQueryMsg(CSummonBotQueryMsg *msg); + bool SummonBotMsg(CSummonBotMsg *msg); protected: CString _string2; int _fieldC8; -- cgit v1.2.3