diff options
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/carry/perch.cpp | 13 | ||||
-rw-r--r-- | engines/titanic/carry/perch.h | 2 | ||||
-rw-r--r-- | engines/titanic/game/parrot/parrot_lobby_view_object.cpp | 16 | ||||
-rw-r--r-- | engines/titanic/game/parrot/parrot_lobby_view_object.h | 6 | ||||
-rw-r--r-- | engines/titanic/game/parrot/parrot_loser.cpp | 10 | ||||
-rw-r--r-- | engines/titanic/game/parrot/parrot_loser.h | 2 | ||||
-rw-r--r-- | engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp | 78 | ||||
-rw-r--r-- | engines/titanic/game/parrot/parrot_nut_bowl_actor.h | 11 | ||||
-rw-r--r-- | engines/titanic/game/parrot/parrot_nut_eater.cpp | 52 | ||||
-rw-r--r-- | engines/titanic/game/parrot/parrot_nut_eater.h | 5 | ||||
-rw-r--r-- | engines/titanic/game/parrot/parrot_perch_holder.cpp | 45 | ||||
-rw-r--r-- | engines/titanic/game/parrot/parrot_perch_holder.h | 5 | ||||
-rw-r--r-- | engines/titanic/game/parrot/parrot_trigger.cpp | 13 | ||||
-rw-r--r-- | engines/titanic/game/parrot/parrot_trigger.h | 2 | ||||
-rw-r--r-- | engines/titanic/messages/messages.h | 2 |
15 files changed, 251 insertions, 11 deletions
diff --git a/engines/titanic/carry/perch.cpp b/engines/titanic/carry/perch.cpp index 281b3fce53..4f0e76bdb0 100644 --- a/engines/titanic/carry/perch.cpp +++ b/engines/titanic/carry/perch.cpp @@ -24,6 +24,10 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CPerch, CCentralCore) + ON_MESSAGE(UseWithOtherMsg) +END_MESSAGE_MAP() + void CPerch::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CCentralCore::save(file, indent); @@ -34,4 +38,13 @@ void CPerch::load(SimpleFile *file) { CCentralCore::load(file); } +bool CPerch::UseWithOtherMsg(CUseWithOtherMsg *msg) { + if (msg->_other->isEquals("SpeechCentre")) { + CShowTextMsg textMsg("This does not reach."); + textMsg.execute("PET"); + } + + return CCentralCore::UseWithOtherMsg(msg); +} + } // End of namespace Titanic diff --git a/engines/titanic/carry/perch.h b/engines/titanic/carry/perch.h index d23868d909..8941c8ea4d 100644 --- a/engines/titanic/carry/perch.h +++ b/engines/titanic/carry/perch.h @@ -28,6 +28,8 @@ namespace Titanic { class CPerch : public CCentralCore { + DECLARE_MESSAGE_MAP; + bool UseWithOtherMsg(CUseWithOtherMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/parrot/parrot_lobby_view_object.cpp b/engines/titanic/game/parrot/parrot_lobby_view_object.cpp index ae398036a8..1151325676 100644 --- a/engines/titanic/game/parrot/parrot_lobby_view_object.cpp +++ b/engines/titanic/game/parrot/parrot_lobby_view_object.cpp @@ -24,16 +24,28 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CParrotLobbyViewObject, CParrotLobbyObject) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + void CParrotLobbyViewObject::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_flag, indent); CParrotLobbyObject::save(file, indent); } void CParrotLobbyViewObject::load(SimpleFile *file) { file->readNumber(); - _fieldBC = file->readNumber(); + _flag = file->readNumber(); CParrotLobbyObject::load(file); } +bool CParrotLobbyViewObject::ActMsg(CActMsg *msg) { + if (msg->_action != "Refresh") + return false; + + setVisible(_flag ? _haveParrot : _haveStick); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_lobby_view_object.h b/engines/titanic/game/parrot/parrot_lobby_view_object.h index 3179bb962d..484d70908e 100644 --- a/engines/titanic/game/parrot/parrot_lobby_view_object.h +++ b/engines/titanic/game/parrot/parrot_lobby_view_object.h @@ -28,11 +28,13 @@ namespace Titanic { class CParrotLobbyViewObject : public CParrotLobbyObject { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); public: - int _fieldBC; + bool _flag; public: CLASSDEF; - CParrotLobbyViewObject() : CParrotLobbyObject(), _fieldBC(1) {} + CParrotLobbyViewObject() : CParrotLobbyObject(), _flag(true) {} /** * Save the data for the class to file diff --git a/engines/titanic/game/parrot/parrot_loser.cpp b/engines/titanic/game/parrot/parrot_loser.cpp index 6e23ef8314..dc854ee9bd 100644 --- a/engines/titanic/game/parrot/parrot_loser.cpp +++ b/engines/titanic/game/parrot/parrot_loser.cpp @@ -24,6 +24,10 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CParrotLoser, CGameObject) + ON_MESSAGE(LeaveRoomMsg) +END_MESSAGE_MAP() + void CParrotLoser::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); @@ -34,4 +38,10 @@ void CParrotLoser::load(SimpleFile *file) { CGameObject::load(file); } +bool CParrotLoser::LeaveRoomMsg(CLeaveRoomMsg *msg) { + CActMsg actMsg("FreeParrot"); + actMsg.execute("CarryParrot"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_loser.h b/engines/titanic/game/parrot/parrot_loser.h index 819fd6614c..e03bfb0727 100644 --- a/engines/titanic/game/parrot/parrot_loser.h +++ b/engines/titanic/game/parrot/parrot_loser.h @@ -28,6 +28,8 @@ namespace Titanic { class CParrotLoser : public CGameObject { + DECLARE_MESSAGE_MAP; + bool LeaveRoomMsg(CLeaveRoomMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp b/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp index c83d66cbdf..9dfc866c0e 100644 --- a/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp +++ b/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp @@ -21,27 +21,95 @@ */ #include "titanic/game/parrot/parrot_nut_bowl_actor.h" +#include "titanic/core/room_item.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CParrotNutBowlActor, CGameObject) + ON_MESSAGE(MouseButtonUpMsg) + ON_MESSAGE(BowlStateChangeMsg) + ON_MESSAGE(IsEarBowlPuzzleDone) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(ReplaceBowlAndNutsMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(NutPuzzleMsg) +END_MESSAGE_MAP() + CParrotNutBowlActor::CParrotNutBowlActor() : CGameObject(), - _value1(0), _value2(0) { + _puzzleDone(0), _state(0) { } void CParrotNutBowlActor::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_value1, indent); - file->writeNumberLine(_value2, indent); + file->writeNumberLine(_puzzleDone, indent); + file->writeNumberLine(_state, indent); CGameObject::save(file, indent); } void CParrotNutBowlActor::load(SimpleFile *file) { file->readNumber(); - _value1 = file->readNumber(); - _value2 = file->readNumber(); + _puzzleDone = file->readNumber(); + _state = file->readNumber(); CGameObject::load(file); } +bool CParrotNutBowlActor::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + if (!_state) { + CActMsg actMsg("Jiggle"); + actMsg.execute("BowlNutsRustler"); + } + + return true; +} + +bool CParrotNutBowlActor::BowlStateChangeMsg(CBowlStateChangeMsg *msg) { + _state = msg->_state; + if (msg->_state == 3) { + if (!_puzzleDone) { + CReplaceBowlAndNutsMsg replaceMsg; + replaceMsg.execute(findRoom(), nullptr, MSGFLAG_SCAN); + playSound("z#47.wav"); + } + + _puzzleDone = true; + } + + return true; +} + +bool CParrotNutBowlActor::CParrotNutBowlActor::IsEarBowlPuzzleDone(CIsEarBowlPuzzleDone *msg) { + msg->_value = _puzzleDone; + return true; +} + +bool CParrotNutBowlActor::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return true; +} + +bool CParrotNutBowlActor::ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg) { + if (!_puzzleDone) + _state = 0; + return true; +} + +bool CParrotNutBowlActor::LeaveViewMsg(CLeaveViewMsg *msg) { + if (!_puzzleDone && _state) { + CReplaceBowlAndNutsMsg replaceMsg; + replaceMsg.execute(findRoom(), nullptr, MSGFLAG_SCAN); + } + + return true; +} + +bool CParrotNutBowlActor::NutPuzzleMsg(CNutPuzzleMsg *msg) { + if (msg->_value == "NutsGone") + _state = 1; + else if (msg->_value == "BowlUnlocked") + _state = 2; + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_nut_bowl_actor.h b/engines/titanic/game/parrot/parrot_nut_bowl_actor.h index d8395bb65a..b228c0ea9e 100644 --- a/engines/titanic/game/parrot/parrot_nut_bowl_actor.h +++ b/engines/titanic/game/parrot/parrot_nut_bowl_actor.h @@ -28,8 +28,17 @@ namespace Titanic { class CParrotNutBowlActor : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); + bool BowlStateChangeMsg(CBowlStateChangeMsg *msg); + bool IsEarBowlPuzzleDone(CIsEarBowlPuzzleDone *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool NutPuzzleMsg(CNutPuzzleMsg *msg); public: - int _value1, _value2; + bool _puzzleDone; + int _state; public: CLASSDEF; CParrotNutBowlActor(); diff --git a/engines/titanic/game/parrot/parrot_nut_eater.cpp b/engines/titanic/game/parrot/parrot_nut_eater.cpp index 309b379ab8..751da931ac 100644 --- a/engines/titanic/game/parrot/parrot_nut_eater.cpp +++ b/engines/titanic/game/parrot/parrot_nut_eater.cpp @@ -21,9 +21,17 @@ */ #include "titanic/game/parrot/parrot_nut_eater.h" +#include "titanic/core/room_item.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CParrotNutEater, CGameObject) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(ReplaceBowlAndNutsMsg) + ON_MESSAGE(NutPuzzleMsg) + ON_MESSAGE(MovieFrameMsg) +END_MESSAGE_MAP() + CParrotNutEater::CParrotNutEater() : CGameObject(), _fieldBC(0), _fieldC0(69), _fieldC4(132), _fieldC8(0), _fieldCC(68) { } @@ -42,4 +50,48 @@ void CParrotNutEater::load(SimpleFile *file) { CGameObject::load(file); } +bool CParrotNutEater::MovieEndMsg(CMovieEndMsg *msg) { + setVisible(false); + CNutPuzzleMsg nutMsg("NutsGone"); + nutMsg.execute(getRoom(), nullptr, MSGFLAG_SCAN); + + playSound("z#47.wav"); + return true; +} + +bool CParrotNutEater::ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg) { + setVisible(false); + return true; +} + +bool CParrotNutEater::NutPuzzleMsg(CNutPuzzleMsg *msg) { + if (msg->_value == "Jiggle") { + playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + movieEvent(68); + movieEvent(132); + playSound("z#215.wav"); + + CTrueTalkTriggerActionMsg triggerMsg; + triggerMsg._param1 = triggerMsg._param2 = 0; + triggerMsg.execute("PerchedParrot"); + } + + return true; +} + +bool CParrotNutEater::MovieFrameMsg(CMovieFrameMsg *msg) { + switch (msg->_frameNumber) { + case 68: + playSound("z#214.wav"); + break; + case 132: + playSound("z#216.wav"); + break; + default: + break; + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_nut_eater.h b/engines/titanic/game/parrot/parrot_nut_eater.h index 5dcb01ca11..e09ad63947 100644 --- a/engines/titanic/game/parrot/parrot_nut_eater.h +++ b/engines/titanic/game/parrot/parrot_nut_eater.h @@ -28,6 +28,11 @@ namespace Titanic { class CParrotNutEater : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MovieEndMsg(CMovieEndMsg *msg); + bool ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg); + bool NutPuzzleMsg(CNutPuzzleMsg *msg); + bool MovieFrameMsg(CMovieFrameMsg *msg); public: int _fieldBC; int _fieldC0; diff --git a/engines/titanic/game/parrot/parrot_perch_holder.cpp b/engines/titanic/game/parrot/parrot_perch_holder.cpp index dd8523990b..d594446219 100644 --- a/engines/titanic/game/parrot/parrot_perch_holder.cpp +++ b/engines/titanic/game/parrot/parrot_perch_holder.cpp @@ -21,9 +21,19 @@ */ #include "titanic/game/parrot/parrot_perch_holder.h" +#include "titanic/game/cage.h" +#include "titanic/core/project_item.h" +#include "titanic/npcs/parrot.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CParrotPerchHolder, CMultiDropTarget) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(DropObjectMsg) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + void CParrotPerchHolder::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CMultiDropTarget::save(file, indent); @@ -34,4 +44,39 @@ void CParrotPerchHolder::load(SimpleFile *file) { CMultiDropTarget::load(file); } +bool CParrotPerchHolder::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (CParrot::_v1) { + if (CCage::_open) { + petDisplayMessage("You cannot take this because the cage is locked shut."); + } else if (!CParrot::_v4) { + CTrueTalkTriggerActionMsg triggerMsg(280252, 0, 0); + triggerMsg.execute(getRoot(), CParrot::_type, + MSGFLAG_CLASS_DEF | MSGFLAG_BREAK_IF_HANDLED | MSGFLAG_SCAN); + } + } + + return true; +} + +bool CParrotPerchHolder::StatusChangeMsg(CStatusChangeMsg *msg) { + _fieldF4 = msg->_newStatus; + return true; +} + +bool CParrotPerchHolder::DropObjectMsg(CDropObjectMsg *msg) { + if (CCage::_open) + return false; + else + return CMultiDropTarget::DropObjectMsg(msg); +} + +bool CParrotPerchHolder::ActMsg(CActMsg *msg) { + if (msg->_action == "FlashCore") { + playMovie(2, 2, 0); + playMovie(1, 1, 0); + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_perch_holder.h b/engines/titanic/game/parrot/parrot_perch_holder.h index ff618f09dc..c1fe243476 100644 --- a/engines/titanic/game/parrot/parrot_perch_holder.h +++ b/engines/titanic/game/parrot/parrot_perch_holder.h @@ -28,6 +28,11 @@ namespace Titanic { class CParrotPerchHolder : public CMultiDropTarget { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool DropObjectMsg(CDropObjectMsg *msg); + bool ActMsg(CActMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/parrot/parrot_trigger.cpp b/engines/titanic/game/parrot/parrot_trigger.cpp index 36e99ada33..b7287ebb6a 100644 --- a/engines/titanic/game/parrot/parrot_trigger.cpp +++ b/engines/titanic/game/parrot/parrot_trigger.cpp @@ -21,9 +21,15 @@ */ #include "titanic/game/parrot/parrot_trigger.h" +#include "titanic/npcs/parrot.h" +#include "titanic/core/project_item.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CParrotTrigger, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) +END_MESSAGE_MAP() + void CParrotTrigger::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); @@ -36,4 +42,11 @@ void CParrotTrigger::load(SimpleFile *file) { CGameObject::load(file); } +bool CParrotTrigger::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + CTrueTalkTriggerActionMsg triggerMsg(_value, 0, 0); + triggerMsg.execute(getRoot(), CParrot::_type, + MSGFLAG_CLASS_DEF | MSGFLAG_BREAK_IF_HANDLED | MSGFLAG_SCAN); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_trigger.h b/engines/titanic/game/parrot/parrot_trigger.h index 28a1663fa8..6fba77b56d 100644 --- a/engines/titanic/game/parrot/parrot_trigger.h +++ b/engines/titanic/game/parrot/parrot_trigger.h @@ -28,6 +28,8 @@ namespace Titanic { class CParrotTrigger : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); public: int _value; public: diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index afe1c2c27e..dd4e38166d 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -189,7 +189,7 @@ MESSAGE1(CAnimateMaitreDMsg, int, value, 0); MESSAGE1(CArboretumGateMsg, int, value, 0); MESSAGE0(CArmPickedUpFromTableMsg); MESSAGE0(CBodyInBilgeRoomMsg); -MESSAGE1(CBowlStateChangeMsg, int, value, 0); +MESSAGE1(CBowlStateChangeMsg, int, state, 0); MESSAGE2(CCarryObjectArrivedMsg, CString, strValue, "", int, numValue, 0); MESSAGE2(CChangeMusicMsg, CString, filename, "", int, flags, 0); MESSAGE1(CChangeSeasonMsg, CString, season, "Summer"); |