aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/npcs/callbot.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-13 09:52:44 -0400
committerPaul Gilbert2016-08-13 09:52:44 -0400
commit5c64e27692f041c231e08575d03642b4873c887e (patch)
tree5d099f3b09304c9dea7aa37f5b5f47292dd8eb8b /engines/titanic/npcs/callbot.cpp
parentc270b30a7937186fecd016b9a74421d633dd90c0 (diff)
downloadscummvm-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/callbot.cpp')
-rw-r--r--engines/titanic/npcs/callbot.cpp38
1 files changed, 33 insertions, 5 deletions
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