aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/npcs
diff options
context:
space:
mode:
authorPaul Gilbert2016-05-28 19:52:48 -0400
committerPaul Gilbert2016-07-15 19:16:40 -0400
commita7ecc6d601f1beabd0f5538d5e1cd7d6e983d2b9 (patch)
tree28069093089951057a2b0ae3db7578711cf3ff53 /engines/titanic/npcs
parent1f4eca3d061d85cdc11a8e20834c14de082baedc (diff)
downloadscummvm-rg350-a7ecc6d601f1beabd0f5538d5e1cd7d6e983d2b9.tar.gz
scummvm-rg350-a7ecc6d601f1beabd0f5538d5e1cd7d6e983d2b9.tar.bz2
scummvm-rg350-a7ecc6d601f1beabd0f5538d5e1cd7d6e983d2b9.zip
TITANIC: Adding CDeskbot message handlers
Diffstat (limited to 'engines/titanic/npcs')
-rw-r--r--engines/titanic/npcs/deskbot.cpp90
-rw-r--r--engines/titanic/npcs/deskbot.h4
-rw-r--r--engines/titanic/npcs/true_talk_npc.cpp2
-rw-r--r--engines/titanic/npcs/true_talk_npc.h10
4 files changed, 92 insertions, 14 deletions
diff --git a/engines/titanic/npcs/deskbot.cpp b/engines/titanic/npcs/deskbot.cpp
index e0e147fabf..dcd27466db 100644
--- a/engines/titanic/npcs/deskbot.cpp
+++ b/engines/titanic/npcs/deskbot.cpp
@@ -41,14 +41,14 @@ END_MESSAGE_MAP()
int CDeskbot::_v1;
int CDeskbot::_v2;
-CDeskbot::CDeskbot() : CTrueTalkNPC(), _field108(0), _field10C(0) {
+CDeskbot::CDeskbot() : CTrueTalkNPC(), _deskbotActive(false), _field10C(0) {
}
void CDeskbot::save(SimpleFile *file, int indent) const {
file->writeNumberLine(1, indent);
file->writeNumberLine(_v1, indent);
file->writeNumberLine(_v2, indent);
- file->writeNumberLine(_field108, indent);
+ file->writeNumberLine(_deskbotActive, indent);
file->writeNumberLine(_field10C, indent);
CTrueTalkNPC::save(file, indent);
@@ -58,34 +58,99 @@ void CDeskbot::load(SimpleFile *file) {
file->readNumber();
_v1 = file->readNumber();
_v2 = file->readNumber();
- _field108 = file->readNumber();
+ _deskbotActive = file->readNumber();
_field10C = file->readNumber();
CTrueTalkNPC::load(file);
}
bool CDeskbot::TurnOn(CTurnOn *msg) {
- // TODO
+ if (!_deskbotActive) {
+ setVisible(true);
+ playClip("BellRinging", 4);
+ playSound("b#69.wav");
+ setPetArea(PET_CONVERSATION);
+
+ _npcFlags |= NPCFLAG_20000;
+ _deskbotActive = true;
+ }
+
return true;
}
bool CDeskbot::EnterViewMsg(CEnterViewMsg *msg) {
- // TODO
+ setVisible(false);
+ _deskbotActive = false;
+ _fieldC4 = 0;
+ loadFrame(625);
+
return true;
}
bool CDeskbot::ActMsg(CActMsg *msg) {
- // TODO
+ if (msg->_action == "2ndClassUpgrade" && getPassengerClass() > 2) {
+ startTalking(this, 140, findView());
+ }
+
return true;
}
bool CDeskbot::MovieEndMsg(CMovieEndMsg *msg) {
- // TODO
+ bool flag = false;
+ if (_npcFlags & NPCFLAG_10000) {
+ if (_field10C) {
+ setPetArea(PET_ROOMS);
+ dec54();
+ unlockMouse();
+ playSound("z#47.wav", 100, 0, 0);
+ _field10C = false;
+ }
+
+ _npcFlags &= ~NPCFLAG_10000;
+ flag = true;
+ }
+
+ bool flag = false;
+ if (_npcFlags & NPCFLAG_40000) {
+ _deskbotActive = false;
+ _npcFlags &= ~(NPCFLAG_40000 | NPCFLAG_20000);
+
+ if (_npcFlags & NPCFLAG_80000) {
+ CTurnOn turnOn;
+ turnOn.execute("EmbBellbotTrigger");
+ unlockMouse();
+ changeView("EmbLobby.Node 4.N", "");
+ } else if (_npcFlags & NPCFLAG_100000) {
+ CTurnOn turnOn;
+ turnOn.execute("EmbDoorBotTrigger");
+ unlockMouse();
+ changeView("EmbLobby.Node 4.N", "");
+ }
+
+ _npcFlags &= ~(NPCFLAG_80000 | NPCFLAG_100000);
+ flag = true;
+ }
+
+ if (_npcFlags & NPCFLAG_20000) {
+ _npcFlags &= ~(NPCFLAG_40000 | NPCFLAG_20000);
+ endTalking(this, 1, findView());
+
+ _npcFlags |= NPCFLAG_4;
+ flag = true;
+ }
+
+ if (!flag)
+ CTrueTalkNPC::MovieEndMsg(msg);
+
return true;
}
bool CDeskbot::LeaveViewMsg(CLeaveViewMsg *msg) {
- // TODO
+ if (_deskbotActive) {
+ CTurnOff turnOff;
+ turnOff.execute(this);
+ }
+
return true;
}
@@ -115,7 +180,14 @@ bool CDeskbot::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg)
}
bool CDeskbot::TurnOff(CTurnOff *msg) {
- // TODO
+ if (_deskbotActive) {
+ stopMovie();
+ performAction(1, findView());
+
+ _npcFlags = (_npcFlags & ~(NPCFLAG_SPEAKING | NPCFLAG_2 | NPCFLAG_4)) | NPCFLAG_40000;
+ playClip("Closing", 0x14);
+ }
+
return true;
}
diff --git a/engines/titanic/npcs/deskbot.h b/engines/titanic/npcs/deskbot.h
index 2711e9cc43..607255be57 100644
--- a/engines/titanic/npcs/deskbot.h
+++ b/engines/titanic/npcs/deskbot.h
@@ -44,8 +44,8 @@ private:
static int _v1;
static int _v2;
public:
- int _field108;
- int _field10C;
+ bool _deskbotActive;
+ bool _field10C;
public:
CLASSDEF
CDeskbot();
diff --git a/engines/titanic/npcs/true_talk_npc.cpp b/engines/titanic/npcs/true_talk_npc.cpp
index 297de59178..ba2de20de9 100644
--- a/engines/titanic/npcs/true_talk_npc.cpp
+++ b/engines/titanic/npcs/true_talk_npc.cpp
@@ -197,7 +197,7 @@ void CTrueTalkNPC::processInput(CTextInputMsg *msg, CViewItem *view) {
talkManager->processInput(this, msg, view);
}
-void CTrueTalkNPC::performAction(int val1, int val2) {
+void CTrueTalkNPC::performAction(int actionNum, CViewItem *view) {
// TODO
}
diff --git a/engines/titanic/npcs/true_talk_npc.h b/engines/titanic/npcs/true_talk_npc.h
index 8277b55e45..a1303c3e5d 100644
--- a/engines/titanic/npcs/true_talk_npc.h
+++ b/engines/titanic/npcs/true_talk_npc.h
@@ -30,7 +30,9 @@
namespace Titanic {
enum NpcFlag {
- NPCFLAG_SPEAKING = 1, NPCFLAG_2 = 2, NPCFLAG_4 = 4, NPCFLAG_8 = 8
+ NPCFLAG_SPEAKING = 1, NPCFLAG_2 = 2, NPCFLAG_4 = 4, NPCFLAG_8 = 8,
+ NPCFLAG_10000 = 0x10000, NPCFLAG_20000 = 0x20000, NPCFLAG_40000 = 0x40000,
+ NPCFLAG_80000 = 0x80000, NPCFLAG_100000 = 0x100000
};
class CViewItem;
@@ -60,7 +62,11 @@ protected:
int _field104;
protected:
void processInput(CTextInputMsg *msg, CViewItem *view);
- void performAction(int val1, int val2);
+
+ /**
+ * Perform an action
+ */
+ void performAction(int actionNum, CViewItem *view = nullptr);
/**
* Start an animation timer