diff options
author | Paul Gilbert | 2016-08-15 19:09:03 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-15 19:09:03 -0400 |
commit | e54dc36035aa7b66163064a0206c901bdf8ba5bd (patch) | |
tree | 8424a6ff547d1f5df0fa2a66fedf5537c4ac5013 /engines/titanic | |
parent | ada2336267470d6a291c993dc84dad0271e8ba9f (diff) | |
download | scummvm-rg350-e54dc36035aa7b66163064a0206c901bdf8ba5bd.tar.gz scummvm-rg350-e54dc36035aa7b66163064a0206c901bdf8ba5bd.tar.bz2 scummvm-rg350-e54dc36035aa7b66163064a0206c901bdf8ba5bd.zip |
TITANIC: Implemented CParrotSuccUBus class
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/carry/hose.h | 4 | ||||
-rw-r--r-- | engines/titanic/messages/messages.h | 4 | ||||
-rw-r--r-- | engines/titanic/npcs/parrot_succubus.cpp | 102 | ||||
-rw-r--r-- | engines/titanic/npcs/parrot_succubus.h | 6 |
4 files changed, 112 insertions, 4 deletions
diff --git a/engines/titanic/carry/hose.h b/engines/titanic/carry/hose.h index ebd45860e8..77ab437b8b 100644 --- a/engines/titanic/carry/hose.h +++ b/engines/titanic/carry/hose.h @@ -34,10 +34,10 @@ struct CHoseStatics { class CHose : public CCarry { protected: - static CHoseStatics *_statics; - CString _string6; public: + static CHoseStatics *_statics; +public: CLASSDEF; CHose(); static void init(); diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 71807f4e99..6076d43121 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -249,7 +249,7 @@ MESSAGE1(CGetChevLiftBits, int, value, 0); MESSAGE1(CGetChevLiftNum, int, value, 0); MESSAGE1(CGetChevRoomBits, int, value, 0); MESSAGE1(CGetChevRoomNum, int, value, 0); -MESSAGE2(CHoseConnectedMsg, int, value1, 1, int, value2, 0); +MESSAGE2(CHoseConnectedMsg, int, value, 1, CGameObject *, object, nullptr); MESSAGE0(CInitializeAnimMsg); MESSAGE1(CIsEarBowlPuzzleDone, int, value, 0); MESSAGE3(CIsHookedOnMsg, Rect, rect, Rect(), bool, result, false, CString, string1, ""); @@ -288,7 +288,7 @@ MESSAGE2(CPlayRangeMsg, int, value1, 0, int, value2, 0); MESSAGE2(CPlayerTriesRestaurantTableMsg, int, value1, 0, int, value2, 0); MESSAGE1(CPreSaveMsg, int, value, 0); MESSAGE1(CProdMaitreDMsg, int, value, 0); -MESSAGE2(CPumpingMsg, int, value1, 0, int, value2, 0); +MESSAGE2(CPumpingMsg, int, value, 0, CGameObject *, object, nullptr); MESSAGE1(CPutBotBackInHisBoxMsg, int, value, 0); MESSAGE1(CPutParrotBackMsg, int, value, 0); MESSAGE0(CPuzzleSolvedMsg); diff --git a/engines/titanic/npcs/parrot_succubus.cpp b/engines/titanic/npcs/parrot_succubus.cpp index 49c4afa1f1..652282bb48 100644 --- a/engines/titanic/npcs/parrot_succubus.cpp +++ b/engines/titanic/npcs/parrot_succubus.cpp @@ -21,9 +21,19 @@ */ #include "titanic/npcs/parrot_succubus.h" +#include "titanic/pet_control/pet_control.h" +#include "titanic/carry/hose.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CParrotSuccUBus, CSuccUBus) + ON_MESSAGE(HoseConnectedMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(LeaveNodeMsg) +END_MESSAGE_MAP() + CParrotSuccUBus::CParrotSuccUBus() : CSuccUBus(), _field1DC(0), _field1EC(0), _field1F0(376), _field1F4(393) { } @@ -46,4 +56,96 @@ void CParrotSuccUBus::load(SimpleFile *file) { CSuccUBus::load(file); } +bool CParrotSuccUBus::HoseConnectedMsg(CHoseConnectedMsg *msg) { + CPetControl *pet = getPetControl(); + if (msg->_value == _field1DC) + return true; + if (mailExists(pet->getRoomFlags())) + return false; + + _field1DC = msg->_value; + if (_field1DC) { + CGameObject *item = msg->_object; + _string3 = item->getName(); + CHoseConnectedMsg hoseMsg(1, this); + hoseMsg.execute(msg->_object); + item->petMoveToHiddenRoom(); + + CPumpingMsg pumpingMsg(1, this); + pumpingMsg.execute(this); + _field1DC = 1; + + if (_enabled) { + _enabled = false; + } else { + playMovie(_startFrame9, _endFrame9, 0); + playSound("z#26.wav"); + } + + playMovie(_field1C4, _field1C8, MOVIE_NOTIFY_OBJECT); + } else { + stopMovie(); + stopSound(_field1EC); + playMovie(_field1F0, _field1F4, MOVIE_NOTIFY_OBJECT); + + CPumpingMsg pumpingMsg(0, this); + pumpingMsg.execute(_string3); + + CGameObject *obj = getHiddenObject(_string3); + if (obj) { + obj->petAddToInventory(); + obj->setVisible(true); + } + + _enabled = true; + CTurnOff offMsg; + offMsg.execute(this); + } + + return true; +} + +bool CParrotSuccUBus::EnterViewMsg(CEnterViewMsg *msg) { + if (_field1DC) { + playMovie(_field1CC, _field1D0, MOVIE_REPEAT); + return true; + } else { + return CSuccUBus::EnterViewMsg(msg); + } +} + +bool CParrotSuccUBus::MovieEndMsg(CMovieEndMsg *msg) { + if (msg->_endFrame == _field1C8) { + playMovie(_field1CC, _field1D0, MOVIE_REPEAT); + _field1EC = playSound("z#472.wav"); + return true; + } else { + return CSuccUBus::MovieEndMsg(msg); + } +} + +bool CParrotSuccUBus::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_field1DC) { + CHoseConnectedMsg hoseMsg; + hoseMsg._value = 0; + hoseMsg.execute(this); + } else { + return CSuccUBus::MouseButtonDownMsg(msg); + } +} + +bool CParrotSuccUBus::LeaveNodeMsg(CLeaveNodeMsg *msg) { + if (_field1DC) { + CGameObject *obj = getHiddenObject(_string3); + if (CHose::_statics->_v2.empty()) { + playSound("z#51.wav"); + CHoseConnectedMsg hoseMsg; + hoseMsg._value = 0; + hoseMsg.execute(this); + } + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/npcs/parrot_succubus.h b/engines/titanic/npcs/parrot_succubus.h index 6f5d9e602a..74a4a032eb 100644 --- a/engines/titanic/npcs/parrot_succubus.h +++ b/engines/titanic/npcs/parrot_succubus.h @@ -28,6 +28,12 @@ namespace Titanic { class CParrotSuccUBus : public CSuccUBus { + DECLARE_MESSAGE_MAP; + bool HoseConnectedMsg(CHoseConnectedMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool LeaveNodeMsg(CLeaveNodeMsg *msg); public: int _field1DC; CString _string3; |