aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-13 18:29:12 -0400
committerPaul Gilbert2016-08-13 18:29:12 -0400
commite5c100cf9c02c62d64f1d7bb257b03e5e5ec58fe (patch)
treed42bc006a01e5aa50b2b8e409cf3f28650db5cb0 /engines
parent97b3437f499db5e50aa97d3085c26b1c98ea9d5f (diff)
downloadscummvm-rg350-e5c100cf9c02c62d64f1d7bb257b03e5e5ec58fe.tar.gz
scummvm-rg350-e5c100cf9c02c62d64f1d7bb257b03e5e5ec58fe.tar.bz2
scummvm-rg350-e5c100cf9c02c62d64f1d7bb257b03e5e5ec58fe.zip
TITANIC: Implemented CBellBot class
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/messages/messages.h2
-rw-r--r--engines/titanic/npcs/bellbot.cpp233
-rw-r--r--engines/titanic/npcs/bellbot.h14
-rw-r--r--engines/titanic/npcs/true_talk_npc.h2
4 files changed, 249 insertions, 2 deletions
diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h
index 72da66feef..ed00273954 100644
--- a/engines/titanic/messages/messages.h
+++ b/engines/titanic/messages/messages.h
@@ -352,7 +352,7 @@ MESSAGE0(CTrueTalkSelfQueueAnimSetMsg);
MESSAGE3(CTrueTalkTriggerActionMsg, int, action, 0, int, param1, 0, int, param2, 0);
MESSAGE0(CTurnOff);
MESSAGE0(CTurnOn);
-MESSAGE1(CUse, CCarry *, item, nullptr);
+MESSAGE1(CUse, CGameObject *, item, nullptr);
MESSAGE1(CUseWithCharMsg, CCharacter *, character, nullptr);
MESSAGE1(CUseWithOtherMsg, CGameObject *, other, 0);
MESSAGE1(CVirtualKeyCharMsg, Common::KeyState, keyState, Common::KeyState());
diff --git a/engines/titanic/npcs/bellbot.cpp b/engines/titanic/npcs/bellbot.cpp
index 7ee0128a1e..ac6881a45c 100644
--- a/engines/titanic/npcs/bellbot.cpp
+++ b/engines/titanic/npcs/bellbot.cpp
@@ -21,9 +21,28 @@
*/
#include "titanic/npcs/bellbot.h"
+#include "titanic/carry/carry.h"
+#include "titanic/core/room_item.h"
+#include "titanic/pet_control/pet_control.h"
namespace Titanic {
+BEGIN_MESSAGE_MAP(CBellBot, CTrueTalkNPC)
+ ON_MESSAGE(OnSummonBotMsg)
+ ON_MESSAGE(LeaveViewMsg)
+ ON_MESSAGE(MovieEndMsg)
+ ON_MESSAGE(Use)
+ ON_MESSAGE(DismissBotMsg)
+ ON_MESSAGE(TrueTalkTriggerActionMsg)
+ ON_MESSAGE(MovieFrameMsg)
+ ON_MESSAGE(PutBotBackInHisBoxMsg)
+ ON_MESSAGE(NPCPlayIdleAnimationMsg)
+ ON_MESSAGE(NPCPlayTalkingAnimationMsg)
+ ON_MESSAGE(TimerMsg)
+ ON_MESSAGE(TrueTalkGetStateValueMsg)
+ ON_MESSAGE(TrueTalkNotifySpeechEndedMsg)
+END_MESSAGE_MAP()
+
CBellBot::CBellBot() : CTrueTalkNPC(), _field108(0) {
}
@@ -41,4 +60,218 @@ void CBellBot::load(SimpleFile *file) {
CTrueTalkNPC::load(file);
}
+bool CBellBot::OnSummonBotMsg(COnSummonBotMsg *msg) {
+ if (msg->_value == 1) {
+ _npcFlags |= NPCFLAG_40000;
+ } else {
+ static const char *const ROOM_WAVES[8][2] = {
+ { "EmbLobby", "z#193.wav" },
+ { "PromenadeDeck", "z#191.wav" },
+ { "Arboretum", "z#195.wav" },
+ { "Frozen Arboretum", "z#195.wav" },
+ { "Bar", "z#194.wav" },
+ { "MusicRoom", "z#192.wav" },
+ { "MusicRoomLobby", "z#192.wav" },
+ { "1stClassRestaurant", "z#190.wav" }
+ };
+
+ int idx;
+ for (idx = 0; idx < 8; ++idx) {
+ if (compareRoomNameTo(ROOM_WAVES[idx][0])) {
+ playSound(ROOM_WAVES[idx][1]);
+
+ }
+ }
+ if (idx == 8)
+ playSound("z#147.wav");
+
+ sleep(2000);
+ _npcFlags &= ~NPCFLAG_40000;
+ }
+
+ playClip("Walk On", MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
+ movieEvent();
+ _npcFlags |= NPCFLAG_10000;
+
+ return true;
+}
+
+bool CBellBot::LeaveViewMsg(CLeaveViewMsg *msg) {
+ if (_npcFlags & NPCFLAG_10000) {
+ performAction(1);
+ _npcFlags &= ~NPCFLAG_4;
+ CDismissBotMsg dismissMsg;
+ dismissMsg.execute(this);
+ }
+
+ return true;
+}
+
+bool CBellBot::MovieEndMsg(CMovieEndMsg *msg) {
+ if (!(_npcFlags & NPCFLAG_10000)) {
+ CTrueTalkNPC::MovieEndMsg(msg);
+ } else if (clipExistsByEnd("Walk On", msg->_endFrame)) {
+ setPosition(Point(80, 10));
+ loadFrame(543);
+ _npcFlags |= NPCFLAG_4;
+ if (_npcFlags & NPCFLAG_40000) {
+ startTalking(this, 157);
+ _npcFlags &= ~NPCFLAG_40000;
+ }
+
+ endTalking(this, true);
+ petSetArea(PET_CONVERSATION);
+ } else if (clipExistsByEnd("Walk Off", msg->_endFrame)) {
+ CPutBotBackInHisBoxMsg boxMsg;
+ boxMsg.execute(this);
+
+ if (_npcFlags & NPCFLAG_20000)
+ startAnimTimer("SummonDoorbot", 1500);
+ } else {
+ CTrueTalkNPC::MovieEndMsg(msg);
+ }
+
+ return true;
+}
+
+bool CBellBot::Use(CUse *msg) {
+ error("TODO: Figure out what msg->_item points to");
+ // msg->_item = "Bellbot";
+ return true;
+}
+
+bool CBellBot::DismissBotMsg(CDismissBotMsg *msg) {
+ if (_npcFlags & NPCFLAG_10000) {
+ playClip("Walk Off", MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
+ if (_npcFlags & NPCFLAG_4) {
+ _npcFlags &= ~NPCFLAG_4;
+ performAction(true);
+ } else {
+ performAction(false);
+ }
+
+ CActMsg actMsg("BellbotDismissed");
+ actMsg.execute("BotIdleSummons");
+ }
+
+ return true;
+}
+
+bool CBellBot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) {
+ switch (msg->_action) {
+ case 1:
+ case 28: {
+ _npcFlags &= ~NPCFLAG_2;
+ CDismissBotMsg dismissMsg;
+ dismissMsg.execute(this);
+ break;
+ }
+
+ case 5:
+ _npcFlags &= ~NPCFLAG_20000;
+ playClip("Walk Off", MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
+ movieEvent();
+ break;
+
+ case 17: {
+ CActMsg actMsg("ThrowTVDownWell");
+ actMsg.execute("ThrowTVDownWellControl");
+ break;
+ }
+
+ case 29: {
+ CActMsg actMsg("BellbotGetLight");
+ actMsg.execute("BellbotGetLightCutScene");
+ startTalking(this, 158);
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ return true;
+}
+
+bool CBellBot::MovieFrameMsg(CMovieFrameMsg *msg) {
+ if (clipExistsByStart("Walk Off", msg->_frameNumber)
+ || clipExistsByStart("Walk On", msg->_frameNumber)) {
+ setPosition(Point(20, 10));
+ }
+
+ return true;
+}
+
+bool CBellBot::PutBotBackInHisBoxMsg(CPutBotBackInHisBoxMsg *msg) {
+ petMoveToHiddenRoom();
+ _npcFlags &= ~NPCFLAG_4;
+ return true;
+}
+
+bool CBellBot::NPCPlayIdleAnimationMsg(CNPCPlayIdleAnimationMsg *msg) {
+ static const char *const NAMES[] = {
+ "Sway Side To Side", "Hit Head", "Hands On Hips", "Sway",
+ "Hand Wave", "Slow Sway", "Lean Backwards",
+ "Sway Side To Side 2", "Bob Up And Down", nullptr
+ };
+
+ msg->_names = NAMES;
+ return true;
+}
+
+bool CBellBot::NPCPlayTalkingAnimationMsg(CNPCPlayTalkingAnimationMsg *msg) {
+ static const char *const NAMES[] = {
+ "Hand On Hip Talking", "Hand On Hip Talking", "Hand On Hip Talking",
+ "Sway Side To Side", "Lean Forward", "Hit Head", "Confidential Talking",
+ "Hands On Hips", "Hands On Hips", "Hands On Hips", "Sway", "Laugh",
+ "Hand Wave", "Slow Sway", "Lean Backwards", "Sway Side To Side 2",
+ "Bob Up And Down", "Elbow In Hand", "Elbow In Hand", "Elbow In Hand",
+ nullptr
+ };
+
+ if (msg->_value2 == 2)
+ playClip("Mother Frame", 0);
+ else
+ msg->_names = NAMES;
+
+ return true;
+}
+
+bool CBellBot::TimerMsg(CTimerMsg *msg) {
+ if (msg->_action == "SummonDoorbot") {
+ CTrueTalkNPC::TimerMsg(msg);
+ } else {
+ CRoomItem *room = getRoom();
+ if (room) {
+ CSummonBotMsg botMsg;
+ botMsg._npcName = "Doorbot";
+ botMsg._value = 2;
+ botMsg.execute(room);
+ }
+
+ _npcFlags &= ~NPCFLAG_20000;
+ }
+
+ return true;
+}
+
+bool CBellBot::TrueTalkGetStateValueMsg(CTrueTalkGetStateValueMsg *msg) {
+ CPetControl *pet = getPetControl();
+ bool flag = pet ? pet->isRoom59706() : false;
+
+ if (msg->_stateNum == 7)
+ msg->_stateVal = flag ? 1 : 0;
+
+ return true;
+}
+
+bool CBellBot::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg) {
+ CTrueTalkNPC::TrueTalkNotifySpeechEndedMsg(msg);
+
+ if (msg->_dialogueId == 20991)
+ petDismissBot("DoorBot");
+
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/npcs/bellbot.h b/engines/titanic/npcs/bellbot.h
index 93c4a2857d..c246901cfe 100644
--- a/engines/titanic/npcs/bellbot.h
+++ b/engines/titanic/npcs/bellbot.h
@@ -28,6 +28,20 @@
namespace Titanic {
class CBellBot : public CTrueTalkNPC {
+ DECLARE_MESSAGE_MAP;
+ bool OnSummonBotMsg(COnSummonBotMsg *msg);
+ bool LeaveViewMsg(CLeaveViewMsg *msg);
+ bool MovieEndMsg(CMovieEndMsg *msg);
+ bool Use(CUse *msg);
+ bool DismissBotMsg(CDismissBotMsg *msg);
+ bool TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg);
+ bool MovieFrameMsg(CMovieFrameMsg *msg);
+ bool PutBotBackInHisBoxMsg(CPutBotBackInHisBoxMsg *msg);
+ bool NPCPlayIdleAnimationMsg(CNPCPlayIdleAnimationMsg *msg);
+ bool NPCPlayTalkingAnimationMsg(CNPCPlayTalkingAnimationMsg *msg);
+ bool TimerMsg(CTimerMsg *msg);
+ bool TrueTalkGetStateValueMsg(CTrueTalkGetStateValueMsg *msg);
+ bool TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg);
private:
int _field108;
public:
diff --git a/engines/titanic/npcs/true_talk_npc.h b/engines/titanic/npcs/true_talk_npc.h
index 0319f7e059..6a4e65035e 100644
--- a/engines/titanic/npcs/true_talk_npc.h
+++ b/engines/titanic/npcs/true_talk_npc.h
@@ -71,7 +71,7 @@ protected:
/**
* Perform an action
*/
- void performAction(bool startTalking, CViewItem *view);
+ void performAction(bool startTalking, CViewItem *view = nullptr);
public:
CLASSDEF;
CTrueTalkNPC();