From c4bf8575c1740ffca017b7c3e731944747726d00 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 25 Aug 2017 19:03:55 -0400 Subject: TITANIC: Fix Door/Bellbot remaining when summoned outside doors --- engines/titanic/npcs/bellbot.cpp | 11 +++++++++++ engines/titanic/npcs/bellbot.h | 1 + engines/titanic/npcs/doorbot.cpp | 7 +++++++ 3 files changed, 19 insertions(+) (limited to 'engines/titanic/npcs') diff --git a/engines/titanic/npcs/bellbot.cpp b/engines/titanic/npcs/bellbot.cpp index 56420ba0de..c6c6a9e3a6 100644 --- a/engines/titanic/npcs/bellbot.cpp +++ b/engines/titanic/npcs/bellbot.cpp @@ -30,6 +30,7 @@ namespace Titanic { BEGIN_MESSAGE_MAP(CBellBot, CTrueTalkNPC) ON_MESSAGE(OnSummonBotMsg) + ON_MESSAGE(EnterViewMsg) ON_MESSAGE(LeaveViewMsg) ON_MESSAGE(MovieEndMsg) ON_MESSAGE(Use) @@ -98,6 +99,16 @@ bool CBellBot::OnSummonBotMsg(COnSummonBotMsg *msg) { return true; } +bool CBellBot::EnterViewMsg(CEnterViewMsg *msg) { + // WORKAROUND: Calling bot in front of doors and then going through them + // can leave it in the view. Detect this and properly remove him when + // the player returns to that view + if (msg->_newView == getParent() && getPetControl()->canSummonBot("BellBot")) + petMoveToHiddenRoom(); + + return true; +} + bool CBellBot::LeaveViewMsg(CLeaveViewMsg *msg) { if (_npcFlags & NPCFLAG_MOVING) { performAction(true); diff --git a/engines/titanic/npcs/bellbot.h b/engines/titanic/npcs/bellbot.h index c246901cfe..538c299b6e 100644 --- a/engines/titanic/npcs/bellbot.h +++ b/engines/titanic/npcs/bellbot.h @@ -30,6 +30,7 @@ namespace Titanic { class CBellBot : public CTrueTalkNPC { DECLARE_MESSAGE_MAP; bool OnSummonBotMsg(COnSummonBotMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); bool LeaveViewMsg(CLeaveViewMsg *msg); bool MovieEndMsg(CMovieEndMsg *msg); bool Use(CUse *msg); diff --git a/engines/titanic/npcs/doorbot.cpp b/engines/titanic/npcs/doorbot.cpp index 391c60aba3..066191ed56 100644 --- a/engines/titanic/npcs/doorbot.cpp +++ b/engines/titanic/npcs/doorbot.cpp @@ -23,6 +23,7 @@ #include "titanic/npcs/doorbot.h" #include "titanic/core/room_item.h" #include "titanic/debugger.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { @@ -551,6 +552,12 @@ bool CDoorbot::TextInputMsg(CTextInputMsg *msg) { } bool CDoorbot::EnterViewMsg(CEnterViewMsg *msg) { + // WORKAROUND: Calling bot in front of doors and then going through them + // can leave it in the view. Detect this and properly remove him when + // the player returns to that view + if (msg->_newView == getParent() && getPetControl()->canSummonBot("DoorBot")) + petMoveToHiddenRoom(); + if ((_npcFlags & NPCFLAG_DOORBOT_INTRO) && _introMovieNum == 7) playClip("SE Move And Turn", MOVIE_NOTIFY_OBJECT); -- cgit v1.2.3