diff options
author | Paul Gilbert | 2016-08-27 13:59:08 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-27 13:59:08 -0400 |
commit | f5ab3d1cd9eb3a884b0ab5d0b154a4f9cccc74b7 (patch) | |
tree | 771a8d2b3fddf96c17a1d81d42cb08dfba09d110 /engines/titanic/game/parrot | |
parent | 873d555add9aaf5eb0d021518f5134142e2c2ff6 (diff) | |
parent | 5ea32efbb0ecb3e6b8336ad3c2edd3905ea5b89a (diff) | |
download | scummvm-rg350-f5ab3d1cd9eb3a884b0ab5d0b154a4f9cccc74b7.tar.gz scummvm-rg350-f5ab3d1cd9eb3a884b0ab5d0b154a4f9cccc74b7.tar.bz2 scummvm-rg350-f5ab3d1cd9eb3a884b0ab5d0b154a4f9cccc74b7.zip |
Merge branch 'master' into xeen
Diffstat (limited to 'engines/titanic/game/parrot')
20 files changed, 1284 insertions, 0 deletions
diff --git a/engines/titanic/game/parrot/parrot_lobby_controller.cpp b/engines/titanic/game/parrot/parrot_lobby_controller.cpp new file mode 100644 index 0000000000..907e7519b8 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_controller.cpp @@ -0,0 +1,72 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/parrot/parrot_lobby_controller.h" +#include "titanic/core/room_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CParrotLobbyController, CParrotLobbyObject) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + +void CParrotLobbyController::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CParrotLobbyObject::save(file, indent); +} + +void CParrotLobbyController::load(SimpleFile *file) { + file->readNumber(); + CParrotLobbyObject::load(file); +} + +bool CParrotLobbyController::ActMsg(CActMsg *msg) { + if (msg->_action == "Refresh") + return false; + else if (msg->_action == "GainParrot") + _haveParrot = true; + else if (msg->_action == "LoseParrot") + _haveParrot = false; + else if (msg->_action == "GainPerch") + _havePerch = true; + else if (msg->_action == "LosePerch") + _havePerch = false; + else if (msg->_action == "GainStick") + _haveStick = true; + else if (msg->_action == "LoseStick") + _haveStick = false; + + _flags = 0; + if (_haveParrot) + _flags = 4; + if (_havePerch) + _flags |= 2; + if (_haveStick) + _flags |= 1; + + CActMsg actMsg("Refresh"); + actMsg.execute(findRoom(), CParrotLobbyObject::_type, MSGFLAG_CLASS_DEF | MSGFLAG_SCAN); + actMsg.execute("ParrotLobbyUpdater_TOW"); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_lobby_controller.h b/engines/titanic/game/parrot/parrot_lobby_controller.h new file mode 100644 index 0000000000..896a4e19d2 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_controller.h @@ -0,0 +1,49 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_PARROT_LOBBY_CONTROLLER_H +#define TITANIC_PARROT_LOBBY_CONTROLLER_H + +#include "titanic/game/parrot/parrot_lobby_object.h" + +namespace Titanic { + +class CParrotLobbyController : public CParrotLobbyObject { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); +public: + CLASSDEF; + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_LOBBY_CONTROLLER_H */ diff --git a/engines/titanic/game/parrot/parrot_lobby_link_updater.cpp b/engines/titanic/game/parrot/parrot_lobby_link_updater.cpp new file mode 100644 index 0000000000..47311c31f5 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_link_updater.cpp @@ -0,0 +1,115 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/parrot/parrot_lobby_link_updater.h" +#include "titanic/titanic.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CParrotLobbyLinkUpdater, CParrotLobbyObject) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + +/*------------------------------------------------------------------------*/ + +LinkUpdatorEntry::LinkUpdatorEntry() { + Common::fill(&_vals[0], &_vals[8], 0); +} + +void LinkUpdatorEntry::load(Common::SeekableReadStream *s) { + _linkStr = readStringFromStream(s); + for (int idx = 0; idx < 8; ++idx) + _vals[idx] = s->readByte(); +} + +/*------------------------------------------------------------------------*/ + +void LinkUpdatorEntries::load(Common::SeekableReadStream *s, int count) { + resize(count); + for (int idx = 0; idx < count; ++idx) + (*this)[idx].load(s); +} + +/*------------------------------------------------------------------------*/ + +CParrotLobbyLinkUpdater::CParrotLobbyLinkUpdater() : CParrotLobbyObject(), _fieldBC(1) { + Common::SeekableReadStream *s = g_vm->_filesManager->getResource("DATA/PARROT_LOBBY_LINK_UPDATOR"); + _entries[0].load(s, 7); + _entries[1].load(s, 5); + _entries[2].load(s, 6); + _entries[3].load(s, 9); + _entries[4].load(s, 1); + delete s; +} + +void CParrotLobbyLinkUpdater::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CParrotLobbyObject::save(file, indent); +} + +void CParrotLobbyLinkUpdater::load(SimpleFile *file) { + file->readNumber(); + CParrotLobbyObject::load(file); +} + +bool CParrotLobbyLinkUpdater::ActMsg(CActMsg *msg) { + if (msg->_action != "Refresh") + return false; + + CNodeItem *node = findNode(); + LinkUpdatorEntries *entriesP; + if (isEquals("ParrotLobbyUpdater_TOW")) { + entriesP = &_entries[4]; + } else { + if (node->_nodeNumber > 3) + return true; + entriesP = &_entries[node->_nodeNumber]; + } + int count = entriesP->size(); + + for (CTreeItem *item = node->getFirstChild(); item; item = item->scan(node)) { + CLinkItem *link = dynamic_cast<CLinkItem *>(item); + if (!link || count == 0) + continue; + + CString linkName = link->getName(); + char c = linkName.lastChar(); + if (c >= 'a' && c <= 'd') + linkName.deleteLastChar(); + + for (uint idx = 0; idx < entriesP->size(); ++idx) { + const LinkUpdatorEntry &entry = (*entriesP)[idx]; + if (entry._linkStr == linkName) { + int val = entry._vals[CParrotLobbyObject::_flags]; + if (val) + linkName += (char)(0x60 + val); + + link->_name = linkName; + break; + } + } + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_lobby_link_updater.h b/engines/titanic/game/parrot/parrot_lobby_link_updater.h new file mode 100644 index 0000000000..93db931a53 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_link_updater.h @@ -0,0 +1,68 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_PARROT_LOBBY_LINK_UPDATER_H +#define TITANIC_PARROT_LOBBY_LINK_UPDATER_H + +#include "common/stream.h" +#include "titanic/game/parrot/parrot_lobby_object.h" + +namespace Titanic { + +struct LinkUpdatorEntry { + CString _linkStr; + int _vals[8]; + + LinkUpdatorEntry(); + void load(Common::SeekableReadStream *s); +}; + +class LinkUpdatorEntries : public Common::Array<LinkUpdatorEntry> { +public: + void load(Common::SeekableReadStream *s, int count); +}; + +class CParrotLobbyLinkUpdater : public CParrotLobbyObject { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); +private: + LinkUpdatorEntries _entries[5]; +public: + int _fieldBC; +public: + CLASSDEF; + CParrotLobbyLinkUpdater(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_LOBBY_LINK_UPDATER_H */ diff --git a/engines/titanic/game/parrot/parrot_lobby_object.cpp b/engines/titanic/game/parrot/parrot_lobby_object.cpp new file mode 100644 index 0000000000..06222fd063 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_object.cpp @@ -0,0 +1,61 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/parrot/parrot_lobby_object.h" + +namespace Titanic { + +EMPTY_MESSAGE_MAP(CParrotLobbyObject, CGameObject); + +bool CParrotLobbyObject::_haveParrot; +bool CParrotLobbyObject::_havePerch; +bool CParrotLobbyObject::_haveStick; +int CParrotLobbyObject::_flags; + +void CParrotLobbyObject::init() { + _haveParrot = true; + _havePerch = true; + _haveStick = true; + _flags = 7; +} + +void CParrotLobbyObject::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_haveParrot, indent); + file->writeNumberLine(_havePerch, indent); + file->writeNumberLine(_haveStick, indent); + file->writeNumberLine(_flags, indent); + + CGameObject::save(file, indent); +} + +void CParrotLobbyObject::load(SimpleFile *file) { + file->readNumber(); + _haveParrot = file->readNumber(); + _havePerch = file->readNumber(); + _haveStick = file->readNumber(); + _flags = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_lobby_object.h b/engines/titanic/game/parrot/parrot_lobby_object.h new file mode 100644 index 0000000000..a210331399 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_object.h @@ -0,0 +1,55 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_PARROT_LOBBY_OBJECT_H +#define TITANIC_PARROT_LOBBY_OBJECT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CParrotLobbyObject : public CGameObject { + DECLARE_MESSAGE_MAP; +public: + static bool _haveParrot; + static bool _havePerch; + static bool _haveStick; + static int _flags; + + static void init(); +public: + CLASSDEF; + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_LOBBY_OBJECT_H */ diff --git a/engines/titanic/game/parrot/parrot_lobby_view_object.cpp b/engines/titanic/game/parrot/parrot_lobby_view_object.cpp new file mode 100644 index 0000000000..1151325676 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_view_object.cpp @@ -0,0 +1,51 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/parrot/parrot_lobby_view_object.h" + +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(_flag, indent); + CParrotLobbyObject::save(file, indent); +} + +void CParrotLobbyViewObject::load(SimpleFile *file) { + 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 new file mode 100644 index 0000000000..484d70908e --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_view_object.h @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_PARROT_LOBBY_VIEW_OBJECT_H +#define TITANIC_PARROT_LOBBY_VIEW_OBJECT_H + +#include "titanic/game/parrot/parrot_lobby_object.h" + +namespace Titanic { + +class CParrotLobbyViewObject : public CParrotLobbyObject { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); +public: + bool _flag; +public: + CLASSDEF; + CParrotLobbyViewObject() : CParrotLobbyObject(), _flag(true) {} + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_LOBBY_VIEW_OBJECT_H */ diff --git a/engines/titanic/game/parrot/parrot_loser.cpp b/engines/titanic/game/parrot/parrot_loser.cpp new file mode 100644 index 0000000000..dc854ee9bd --- /dev/null +++ b/engines/titanic/game/parrot/parrot_loser.cpp @@ -0,0 +1,47 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/parrot/parrot_loser.h" + +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); +} + +void CParrotLoser::load(SimpleFile *file) { + file->readNumber(); + 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 new file mode 100644 index 0000000000..e03bfb0727 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_loser.h @@ -0,0 +1,49 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_PARROT_LOSER_H +#define TITANIC_PARROT_LOSER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CParrotLoser : public CGameObject { + DECLARE_MESSAGE_MAP; + bool LeaveRoomMsg(CLeaveRoomMsg *msg); +public: + CLASSDEF; + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_LOSER_H */ diff --git a/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp b/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp new file mode 100644 index 0000000000..9dfc866c0e --- /dev/null +++ b/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp @@ -0,0 +1,115 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#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(), + _puzzleDone(0), _state(0) { +} + +void CParrotNutBowlActor::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_puzzleDone, indent); + file->writeNumberLine(_state, indent); + + CGameObject::save(file, indent); +} + +void CParrotNutBowlActor::load(SimpleFile *file) { + 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 new file mode 100644 index 0000000000..b228c0ea9e --- /dev/null +++ b/engines/titanic/game/parrot/parrot_nut_bowl_actor.h @@ -0,0 +1,59 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_PARROT_NUT_BOWL_ACTOR_H +#define TITANIC_PARROT_NUT_BOWL_ACTOR_H + +#include "titanic/core/game_object.h" + +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: + bool _puzzleDone; + int _state; +public: + CLASSDEF; + CParrotNutBowlActor(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_NUT_BOWL_ACTOR_H */ diff --git a/engines/titanic/game/parrot/parrot_nut_eater.cpp b/engines/titanic/game/parrot/parrot_nut_eater.cpp new file mode 100644 index 0000000000..751da931ac --- /dev/null +++ b/engines/titanic/game/parrot/parrot_nut_eater.cpp @@ -0,0 +1,97 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#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) { +} + +void CParrotNutEater::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + + CGameObject::save(file, indent); +} + +void CParrotNutEater::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + + 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 new file mode 100644 index 0000000000..e09ad63947 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_nut_eater.h @@ -0,0 +1,59 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_PARROT_NUT_EATER_H +#define TITANIC_PARROT_NUT_EATER_H + +#include "titanic/core/game_object.h" + +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; + int _fieldC4; + int _fieldC8; + int _fieldCC; +public: + CLASSDEF; + CParrotNutEater(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CREDITS_H */ diff --git a/engines/titanic/game/parrot/parrot_perch_holder.cpp b/engines/titanic/game/parrot/parrot_perch_holder.cpp new file mode 100644 index 0000000000..d594446219 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_perch_holder.cpp @@ -0,0 +1,82 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#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); +} + +void CParrotPerchHolder::load(SimpleFile *file) { + file->readNumber(); + 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 new file mode 100644 index 0000000000..c1fe243476 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_perch_holder.h @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_PARROT_PERCH_HOLDER_H +#define TITANIC_PARROT_PERCH_HOLDER_H + +#include "titanic/core/multi_drop_target.h" + +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; + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_PERCH_HOLDER_H */ diff --git a/engines/titanic/game/parrot/parrot_trigger.cpp b/engines/titanic/game/parrot/parrot_trigger.cpp new file mode 100644 index 0000000000..b7287ebb6a --- /dev/null +++ b/engines/titanic/game/parrot/parrot_trigger.cpp @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#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); + CGameObject::save(file, indent); +} + +void CParrotTrigger::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + 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 new file mode 100644 index 0000000000..6fba77b56d --- /dev/null +++ b/engines/titanic/game/parrot/parrot_trigger.h @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_PARROT_TRIGGER_H +#define TITANIC_PARROT_TRIGGER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CParrotTrigger : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); +public: + int _value; +public: + CLASSDEF; + CParrotTrigger() : CGameObject(), _value(0x446AB) {} + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_TRIGGER_H */ diff --git a/engines/titanic/game/parrot/player_meets_parrot.cpp b/engines/titanic/game/parrot/player_meets_parrot.cpp new file mode 100644 index 0000000000..cdb14516bf --- /dev/null +++ b/engines/titanic/game/parrot/player_meets_parrot.cpp @@ -0,0 +1,46 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/parrot/player_meets_parrot.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPlayerMeetsParrot, CGameObject) + ON_MESSAGE(EnterRoomMsg) +END_MESSAGE_MAP() + +void CPlayerMeetsParrot::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPlayerMeetsParrot::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +bool CPlayerMeetsParrot::EnterRoomMsg(CEnterRoomMsg *msg) { + stateSet24(); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/player_meets_parrot.h b/engines/titanic/game/parrot/player_meets_parrot.h new file mode 100644 index 0000000000..edae18801f --- /dev/null +++ b/engines/titanic/game/parrot/player_meets_parrot.h @@ -0,0 +1,51 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_PLAYER_MEETS_PARROT_H +#define TITANIC_PLAYER_MEETS_PARROT_H + +#include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CPlayerMeetsParrot : public CGameObject { + DECLARE_MESSAGE_MAP; +protected: + bool EnterRoomMsg(CEnterRoomMsg *msg); +public: + CLASSDEF; + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PLAYER_MEETS_PARROT_H */ |