From e846a103f49eaba48aca6ca8457398bab910c417 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 13 Aug 2017 15:00:41 -0400 Subject: TITANIC: Fix receiving any SuccUBus mail in the Bomb room SuccUBus --- engines/titanic/core/game_object.cpp | 2 +- engines/titanic/npcs/bilge_succubus.cpp | 2 +- engines/titanic/npcs/succubus.cpp | 24 +++++++++++++++--------- engines/titanic/npcs/succubus.h | 2 +- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 580509252b..5abc9f0f76 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -954,7 +954,7 @@ CGameObject *CGameObject::findMailByFlags(RoomFlagsComparison compareType, uint for (CGameObject *obj = mailMan->getFirstObject(); obj; obj = mailMan->getNextObject(obj)) { - if (compareRoomFlags(compareType, roomFlags, obj->_roomFlags)) + if (compareRoomFlags(compareType, obj->_roomFlags, roomFlags)) return obj; } diff --git a/engines/titanic/npcs/bilge_succubus.cpp b/engines/titanic/npcs/bilge_succubus.cpp index a1fc46874c..312f067bd4 100644 --- a/engines/titanic/npcs/bilge_succubus.cpp +++ b/engines/titanic/npcs/bilge_succubus.cpp @@ -89,7 +89,7 @@ bool CBilgeSuccUBus::PETReceiveMsg(CPETReceiveMsg *msg) { } else { uint roomFlags = pet->getRoomFlags(); CGameObject *mailObject = findMailByFlags( - _enabled && compareRoomNameTo("Titania") ? RFC_TITANIA : _flagsComparison, + _fuseboxOn && compareRoomNameTo("Titania") ? RFC_TITANIA : _flagsComparison, roomFlags); if (mailObject) { diff --git a/engines/titanic/npcs/succubus.cpp b/engines/titanic/npcs/succubus.cpp index 522269b41b..79d779b487 100644 --- a/engines/titanic/npcs/succubus.cpp +++ b/engines/titanic/npcs/succubus.cpp @@ -46,9 +46,9 @@ BEGIN_MESSAGE_MAP(CSuccUBus, CTrueTalkNPC) ON_MESSAGE(MouseDragStartMsg) END_MESSAGE_MAP() -bool CSuccUBus::_isOn; -bool CSuccUBus::_motherBlocked; -bool CSuccUBus::_enabled; +bool CSuccUBus::_isOn; // SuccUBus turned on +bool CSuccUBus::_motherBlocked; // Bilge SuccUBus is blocked +bool CSuccUBus::_fuseboxOn; // SuccUBus dial in fusebox is on CSuccUBus::CSuccUBus() : CTrueTalkNPC() { _initialStartFrame = -1; @@ -154,7 +154,7 @@ void CSuccUBus::save(SimpleFile *file, int indent) { file->writeNumberLine(_pumpingEndFrame, indent); file->writeNumberLine(_destRoomFlags, indent); - file->writeNumberLine(_enabled, indent); + file->writeNumberLine(_fuseboxOn, indent); file->writeNumberLine(_inProgress, indent); file->writeNumberLine(_field104, indent); @@ -218,7 +218,7 @@ void CSuccUBus::load(SimpleFile *file) { _pumpingEndFrame = file->readNumber(); _destRoomFlags = file->readNumber(); - _enabled = file->readNumber(); + _fuseboxOn = file->readNumber(); _inProgress = file->readNumber(); _field104 = file->readNumber(); @@ -488,8 +488,12 @@ bool CSuccUBus::PETReceiveMsg(CPETReceiveMsg *msg) { break; } } else { + // When the SuccUBus dial in Titania's fusebox is on, then + // any mail can be received by the SuccUBus in the bomb room. + // Otherwise, only get mail sent to this specific SuccUBus CGameObject *mailObject = findMailByFlags( - _enabled && compareRoomNameTo("Titania") ? RFC_TITANIA : _flagsComparison, petRoomFlags); + _fuseboxOn && compareRoomNameTo("Titania") ? RFC_TITANIA : _flagsComparison, petRoomFlags); + if (!mailObject) { // No mail for this SuccUBus if (getRandomNumber(1) == 0) { @@ -539,7 +543,7 @@ bool CSuccUBus::MovieEndMsg(CMovieEndMsg *msg) { bool flag = false; if (pet && !mailExists(petRoomFlags)) { - CGameObject *mailObject = _enabled && compareRoomNameTo("Titania") ? + CGameObject *mailObject = _fuseboxOn && compareRoomNameTo("Titania") ? findMailByFlags(RFC_TITANIA, petRoomFlags) : findMailByFlags(_flagsComparison, petRoomFlags); @@ -750,9 +754,11 @@ bool CSuccUBus::SetChevRoomBits(CSetChevRoomBits *msg) { bool CSuccUBus::ActMsg(CActMsg *msg) { if (msg->_action == "EnableObject") - _enabled = true; + // SuccUBus dial in fusebox was turned on + _fuseboxOn = true; else if (msg->_action == "DisableObject") - _enabled = false; + // SuccUBus dial in fusebox was turned off + _fuseboxOn = false; return true; } diff --git a/engines/titanic/npcs/succubus.h b/engines/titanic/npcs/succubus.h index 94e0bebe54..1bcebc06da 100644 --- a/engines/titanic/npcs/succubus.h +++ b/engines/titanic/npcs/succubus.h @@ -51,7 +51,7 @@ class CSuccUBus : public CTrueTalkNPC { protected: static bool _isOn; static bool _motherBlocked; - static bool _enabled; + static bool _fuseboxOn; protected: int _initialStartFrame; int _initialEndFrame; -- cgit v1.2.3