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/carry | |
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/carry')
76 files changed, 5736 insertions, 0 deletions
diff --git a/engines/titanic/carry/arm.cpp b/engines/titanic/carry/arm.cpp new file mode 100644 index 0000000000..880c93d309 --- /dev/null +++ b/engines/titanic/carry/arm.cpp @@ -0,0 +1,213 @@ +/* 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/carry/arm.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CArm, CCarry) + ON_MESSAGE(PuzzleSolvedMsg) + ON_MESSAGE(TranslateObjectMsg) + ON_MESSAGE(UseWithOtherMsg) + ON_MESSAGE(MouseDragStartMsg) + ON_MESSAGE(MaitreDHappyMsg) + ON_MESSAGE(PETGainedObjectMsg) + ON_MESSAGE(MouseDragMoveMsg) +END_MESSAGE_MAP() + +CArm::CArm() : CCarry(), _string6("Key"), + _field138(0), _field158(0), _field16C(3), _field170(0), + _armRect(220, 208, 409, 350) { +} + +void CArm::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string6, indent); + file->writeNumberLine(_field138, indent); + file->writeNumberLine(_hookedRect.left, indent); + file->writeNumberLine(_hookedRect.top, indent); + file->writeNumberLine(_hookedRect.right, indent); + file->writeNumberLine(_hookedRect.bottom, indent); + + file->writeQuotedLine(_string7, indent); + file->writeNumberLine(_field158, indent); + file->writeNumberLine(_armRect.left, indent); + file->writeNumberLine(_armRect.top, indent); + file->writeNumberLine(_armRect.right, indent); + file->writeNumberLine(_armRect.bottom, indent); + file->writeNumberLine(_field16C, indent); + file->writeNumberLine(_field170, indent); + + CCarry::save(file, indent); +} + +void CArm::load(SimpleFile *file) { + file->readNumber(); + _string6 = file->readString(); + _field138 = file->readNumber(); + _hookedRect.left = file->readNumber(); + _hookedRect.top = file->readNumber(); + _hookedRect.right = file->readNumber(); + _hookedRect.bottom = file->readNumber(); + + _string7 = file->readString(); + _field158 = file->readNumber(); + _armRect.left = file->readNumber(); + _armRect.top = file->readNumber(); + _armRect.right = file->readNumber(); + _armRect.bottom = file->readNumber(); + _field16C = file->readNumber(); + _field170 = file->readNumber(); + + CCarry::load(file); +} + +bool CArm::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) { + _field138 = 0; + _fieldE0 = 1; + + CString name = getName(); + if (name == "Arm1") { + CActMsg actMsg("LoseArm"); + actMsg.execute("MaitreD"); + CPuzzleSolvedMsg solvedMsg; + solvedMsg.execute("AuditoryCentre"); + } else if (name == "Arm2") { + CPuzzleSolvedMsg solvedMsg; + solvedMsg.execute("Key"); + } + + return true; +} + +bool CArm::TranslateObjectMsg(CTranslateObjectMsg *msg) { + Point newPos(_bounds.left - msg->_delta.x, _bounds.top - msg->_delta.y); + setPosition(newPos); + return true; +} + +bool CArm::UseWithOtherMsg(CUseWithOtherMsg *msg) { + if (_string6 != "None") { + CShowTextMsg textMsg("The arm is already holding something."); + textMsg.execute("PET"); + return false; + } else if (msg->_other->getName() == "GondolierLeftLever") { + CIsHookedOnMsg hookedMsg(_hookedRect, 0, getName()); + hookedMsg._rect.translate(_bounds.left, _bounds.top); + hookedMsg.execute("GondolierLeftLever"); + + if (hookedMsg._result) { + _string7 = "GondolierLeftLever"; + } else { + petAddToInventory(); + } + } else if (msg->_other->getName() == "GondolierRightLever") { + CIsHookedOnMsg hookedMsg(_hookedRect, 0, getName()); + hookedMsg._rect.translate(_bounds.left, _bounds.top); + hookedMsg.execute("GondolierRightLever"); + + if (hookedMsg._result) { + _string7 = "GondolierRightLever"; + } else { + petAddToInventory(); + } + } + + return true; +} + +bool CArm::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (!_fieldE0) { + CShowTextMsg textMsg("You can't get this."); + textMsg.execute("PET"); + } else if (checkStartDragging(msg)) { + _tempPos = msg->_mousePos - _bounds; + setPosition(msg->_mousePos - _tempPos); + + if (!_string7.empty()) { + CActMsg actMsg("Unhook"); + actMsg.execute(_string7); + _string7.clear(); + } + + loadFrame(_visibleFrame); + return true; + } + + return false; +} + +bool CArm::MaitreDHappyMsg(CMaitreDHappyMsg *msg) { + CGameObject *petItem; + if (find(getName(), &petItem, FIND_PET)) { + if (!_field158) + playSound("z#47.wav", 100, 0, 0); + if (_string6 == "Key" || _string6 == "AuditoryCentre") { + CGameObject *child = static_cast<CGameObject *>(getFirstChild()); + if (child) { + child->setVisible(true); + petAddToInventory(); + } + + _visibleFrame = _field170; + loadFrame(_visibleFrame); + _string6 = "None"; + petInvChange(); + } + } + + _field158 = 1; + _fieldE0 = 1; + return true; +} + +bool CArm::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { + if (_field158) { + if (_string6 == "Key" || _string6 == "AuditoryCentre") { + CCarry *child = static_cast<CCarry *>(getFirstChild()); + if (child) { + _visibleFrame = _field170; + loadFrame(_visibleFrame); + child->setVisible(true); + child->petAddToInventory(); + } + + _string6 = "None"; + } + } + + return true; +} + +bool CArm::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { + setPosition(msg->_mousePos - _tempPos); + + if (_string6 != "None" && compareViewNameTo("FrozenArboretum.Node 5.S")) { + loadFrame(_armRect.contains(msg->_mousePos) ? + _field16C : _visibleFrame); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/arm.h b/engines/titanic/carry/arm.h new file mode 100644 index 0000000000..fc8bba1f08 --- /dev/null +++ b/engines/titanic/carry/arm.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_ARM_H +#define TITANIC_ARM_H + +#include "titanic/carry/carry.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" +#include "titanic/messages/pet_messages.h" + +namespace Titanic { + +class CArm : public CCarry { + DECLARE_MESSAGE_MAP; + bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg); + bool TranslateObjectMsg(CTranslateObjectMsg *msg); + bool UseWithOtherMsg(CUseWithOtherMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); + bool MaitreDHappyMsg(CMaitreDHappyMsg *msg); + bool PETGainedObjectMsg(CPETGainedObjectMsg *msg); + bool MouseDragMoveMsg(CMouseDragMoveMsg *msg); +private: + CString _string6; + int _field138; + Rect _hookedRect; + CString _string7; + int _field158; + Rect _armRect; + int _field16C; + int _field170; +public: + CLASSDEF; + CArm(); + + /** + * 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_ARM_H */ diff --git a/engines/titanic/carry/auditory_centre.cpp b/engines/titanic/carry/auditory_centre.cpp new file mode 100644 index 0000000000..0bda975a36 --- /dev/null +++ b/engines/titanic/carry/auditory_centre.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/carry/auditory_centre.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CAuditoryCentre, CBrain) + ON_MESSAGE(PuzzleSolvedMsg) +END_MESSAGE_MAP() + +void CAuditoryCentre::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CBrain::save(file, indent); +} + +void CAuditoryCentre::load(SimpleFile *file) { + file->readNumber(); + CBrain::load(file); +} + +bool CAuditoryCentre::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) { + _fieldE0 = 1; + setVisible(true); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/auditory_centre.h b/engines/titanic/carry/auditory_centre.h new file mode 100644 index 0000000000..6f24e86208 --- /dev/null +++ b/engines/titanic/carry/auditory_centre.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_AUDITORY_CENTRE_H +#define TITANIC_AUDITORY_CENTRE_H + +#include "titanic/carry/brain.h" + +namespace Titanic { + +class CAuditoryCentre : public CBrain { + DECLARE_MESSAGE_MAP; + bool PuzzleSolvedMsg(CPuzzleSolvedMsg *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_AUDITORY_CENTRE_H */ diff --git a/engines/titanic/carry/bowl_ear.cpp b/engines/titanic/carry/bowl_ear.cpp new file mode 100644 index 0000000000..852a77899a --- /dev/null +++ b/engines/titanic/carry/bowl_ear.cpp @@ -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. + * + */ + +#include "titanic/carry/bowl_ear.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CBowlEar, CEar) + ON_MESSAGE(PETGainedObjectMsg) + ON_MESSAGE(ReplaceBowlAndNutsMsg) + ON_MESSAGE(NutPuzzleMsg) + ON_MESSAGE(MouseDragStartMsg) +END_MESSAGE_MAP() + +void CBowlEar::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CEar::save(file, indent); +} + +void CBowlEar::load(SimpleFile *file) { + file->readNumber(); + CEar::load(file); +} + +bool CBowlEar::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { + CBowlStateChangeMsg changeMsg(3); + changeMsg.execute("ParrotNutBowlActor"); + + return CEar::PETGainedObjectMsg(msg); +} + +bool CBowlEar::ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg) { + setVisible(false); + return true; +} + +bool CBowlEar::NutPuzzleMsg(CNutPuzzleMsg *msg) { + if (msg->_value == "BowlUnlocked") + _fieldE0 = 1; + + return true; +} + +bool CBowlEar::MouseDragStartMsg(CMouseDragStartMsg *msg) { + setVisible(true); + return CEar::MouseDragStartMsg(msg); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/bowl_ear.h b/engines/titanic/carry/bowl_ear.h new file mode 100644 index 0000000000..d78092f6d7 --- /dev/null +++ b/engines/titanic/carry/bowl_ear.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_BOWL_EAR_H +#define TITANIC_BOWL_EAR_H + +#include "titanic/carry/ear.h" + +namespace Titanic { + +class CBowlEar : public CEar { + DECLARE_MESSAGE_MAP; + bool PETGainedObjectMsg(CPETGainedObjectMsg *msg); + bool ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg); + bool NutPuzzleMsg(CNutPuzzleMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *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_BOWL_EAR_H */ diff --git a/engines/titanic/carry/brain.cpp b/engines/titanic/carry/brain.cpp new file mode 100644 index 0000000000..8df0de9961 --- /dev/null +++ b/engines/titanic/carry/brain.cpp @@ -0,0 +1,134 @@ +/* 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/carry/brain.h" +#include "titanic/game/brain_slot.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CBrain, CCarry) + ON_MESSAGE(UseWithOtherMsg) + ON_MESSAGE(VisibleMsg) + ON_MESSAGE(MouseDragStartMsg) + ON_MESSAGE(PassOnDragStartMsg) + ON_MESSAGE(PETGainedObjectMsg) +END_MESSAGE_MAP() + +CBrain::CBrain() : CCarry(), _field134(0), _field138(0) { +} + +void CBrain::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writePoint(_pos1, indent); + file->writeNumberLine(_field134, indent); + file->writeNumberLine(_field138, indent); + + CCarry::save(file, indent); +} + +void CBrain::load(SimpleFile *file) { + file->readNumber(); + _pos1 = file->readPoint(); + _field134 = file->readNumber(); + _field138 = file->readNumber(); + + CCarry::load(file); +} + +bool CBrain::UseWithOtherMsg(CUseWithOtherMsg *msg) { + CBrainSlot *slot = static_cast<CBrainSlot *>(msg->_other); + if (slot) { + if (slot->getName() == "CentralCore") { + setVisible(false); + petMoveToHiddenRoom(); + CAddHeadPieceMsg headpieceMsg(getName()); + headpieceMsg.execute("CentralCoreSlot"); + } + else if (!slot->_value1 && slot->getName() == "CentralCoreSlot") { + setVisible(false); + petMoveToHiddenRoom(); + CAddHeadPieceMsg headpieceMsg(getName()); + headpieceMsg.execute(msg->_other); + playSound("z#116.wav", 100, 0, 0); + setPosition(Point(0, 0)); + setVisible(false); + _field134 = 1; + } + + return true; + } + else { + return CCarry::UseWithOtherMsg(msg); + } +} + +bool CBrain::VisibleMsg(CVisibleMsg *msg) { + setVisible(msg->_visible); + return true; +} + +bool CBrain::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (!checkStartDragging(msg)) + return false; + + if (_field134) { + CTakeHeadPieceMsg headpieceMsg(getName()); + headpieceMsg.execute("TitaniaControl"); + + _field134 = 0; + setVisible(true); + moveToView(); + + setPosition(Point(msg->_mousePos.x - _bounds.width() / 2, + msg->_mousePos.y - _bounds.height() / 2)); + } + + return CCarry::MouseDragStartMsg(msg); +} + +bool CBrain::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { + if (_field134) { + CTakeHeadPieceMsg headpieceMsg(getName()); + headpieceMsg.execute("TitaniaControl"); + _field134 = 0; + + setVisible(true); + moveToView(); + setPosition(Point(msg->_mousePos.x - _bounds.width() / 2, + msg->_mousePos.y - _bounds.height() / 2)); + } + + return CCarry::PassOnDragStartMsg(msg); +} + +bool CBrain::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { + if (!_field138) { + if (getName() == "Perch") { + stateInc38(); + _field138 = 1; + } + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/brain.h b/engines/titanic/carry/brain.h new file mode 100644 index 0000000000..bcba161e27 --- /dev/null +++ b/engines/titanic/carry/brain.h @@ -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. + * + */ + +#ifndef TITANIC_BRAIN_H +#define TITANIC_BRAIN_H + +#include "titanic/carry/carry.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" +#include "titanic/messages/pet_messages.h" + +namespace Titanic { + +class CBrain : public CCarry { + DECLARE_MESSAGE_MAP; + bool UseWithOtherMsg(CUseWithOtherMsg *msg); + bool VisibleMsg(CVisibleMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); + bool PassOnDragStartMsg(CPassOnDragStartMsg *msg); + bool PETGainedObjectMsg(CPETGainedObjectMsg *msg); +private: + Point _pos1; + int _field134; + int _field138; +public: + CLASSDEF; + CBrain(); + + /** + * 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_BRAIN_H */ diff --git a/engines/titanic/carry/bridge_piece.cpp b/engines/titanic/carry/bridge_piece.cpp new file mode 100644 index 0000000000..fc845feff0 --- /dev/null +++ b/engines/titanic/carry/bridge_piece.cpp @@ -0,0 +1,95 @@ +/* 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/carry/bridge_piece.h" +#include "titanic/game/ship_setting.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CBridgePiece, CCarry) + ON_MESSAGE(UseWithOtherMsg) + ON_MESSAGE(PassOnDragStartMsg) +END_MESSAGE_MAP() + +CBridgePiece::CBridgePiece() : CCarry(), _field140(0) { +} + +void CBridgePiece::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string6, indent); + file->writePoint(_pos3, indent); + file->writeNumberLine(_field140, indent); + + CCarry::save(file, indent); +} + +void CBridgePiece::load(SimpleFile *file) { + file->readNumber(); + _string6 = file->readString(); + _pos3 = file->readPoint(); + _field140 = file->readNumber(); + + CCarry::load(file); +} + +bool CBridgePiece::UseWithOtherMsg(CUseWithOtherMsg *msg) { + CShipSetting *shipSetting = static_cast<CShipSetting *>(msg->_other); + if (!shipSetting) { + return CCarry::UseWithOtherMsg(msg); + } else if (shipSetting->_string4 == "NULL") { + petAddToInventory(); + return true; + } else { + setVisible(false); + playSound("z#54.wav", 100, 0, 0); + setPosition(shipSetting->_pos1); + shipSetting->_string4 = getName(); + petMoveToHiddenRoom(); + + CAddHeadPieceMsg headpieceMsg(shipSetting->getName() == _string6 ? + "Enable" : "Disable"); + CSetFrameMsg frameMsg; + + CString name = getName(); + if (name == "ChickenBridge") { + frameMsg._frameNumber = 1; + } else if (name == "FanBridge") { + frameMsg._frameNumber = 2; + } else if (name == "SeasonBridge") { + frameMsg._frameNumber = 3; + } else if (name == "BeamBridge") { + frameMsg._frameNumber = 0; + } + + frameMsg.execute(shipSetting); + headpieceMsg.execute(shipSetting); + return true; + } +} + +bool CBridgePiece::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { + setVisible(true); + moveToView(); + return CCarry::PassOnDragStartMsg(msg); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/bridge_piece.h b/engines/titanic/carry/bridge_piece.h new file mode 100644 index 0000000000..80a1cc98a8 --- /dev/null +++ b/engines/titanic/carry/bridge_piece.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_BRIDGE_PIECE_H +#define TITANIC_BRIDGE_PIECE_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CBridgePiece : public CCarry { + DECLARE_MESSAGE_MAP; + bool UseWithOtherMsg(CUseWithOtherMsg *msg); + bool PassOnDragStartMsg(CPassOnDragStartMsg *msg); +private: + CString _string6; + Point _pos3; + int _field140; +public: + CLASSDEF; + CBridgePiece(); + + /** + * 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_BRIDGE_PIECE_H */ diff --git a/engines/titanic/carry/carry.cpp b/engines/titanic/carry/carry.cpp new file mode 100644 index 0000000000..75b3b6f35b --- /dev/null +++ b/engines/titanic/carry/carry.cpp @@ -0,0 +1,241 @@ +/* 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/carry/carry.h" +#include "titanic/messages/messages.h" +#include "titanic/npcs/character.h" +#include "titanic/npcs/succubus.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CCarry, CGameObject) + ON_MESSAGE(MouseDragStartMsg) + ON_MESSAGE(MouseDragMoveMsg) + ON_MESSAGE(MouseDragEndMsg) + ON_MESSAGE(UseWithCharMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(UseWithOtherMsg) + ON_MESSAGE(VisibleMsg) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(RemoveFromGameMsg) + ON_MESSAGE(MoveToStartPosMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(PassOnDragStartMsg) +END_MESSAGE_MAP() + +CCarry::CCarry() : CGameObject(), _fieldDC(0), _fieldE0(1), + _field100(0), _field104(0), _field108(0), _field10C(0), + _itemFrame(0), _enterFrame(0), _enterFrameSet(false), _visibleFrame(0), + _string1("None"), + _fullViewName("NULL"), + _string3("That doesn't seem to do anything."), + _string4("It doesn't seem to want this.") { +} + +void CCarry::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + file->writePoint(_origPos, indent); + file->writeQuotedLine(_fullViewName, indent); + file->writeNumberLine(_fieldDC, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeQuotedLine(_string3, indent); + file->writeQuotedLine(_string4, indent); + file->writePoint(_tempPos, indent); + file->writeNumberLine(_field104, indent); + file->writeNumberLine(_field108, indent); + file->writeNumberLine(_field10C, indent); + file->writeNumberLine(_itemFrame, indent); + file->writeQuotedLine(_string5, indent); + file->writeNumberLine(_enterFrame, indent); + file->writeNumberLine(_enterFrameSet, indent); + file->writeNumberLine(_visibleFrame, indent); + + CGameObject::save(file, indent); +} + +void CCarry::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + _origPos = file->readPoint(); + _fullViewName = file->readString(); + _fieldDC = file->readNumber(); + _fieldE0 = file->readNumber(); + _string3 = file->readString(); + _string4 = file->readString(); + _tempPos = file->readPoint(); + _field104 = file->readNumber(); + _field108 = file->readNumber(); + _field10C = file->readNumber(); + _itemFrame = file->readNumber(); + _string5 = file->readString(); + _enterFrame = file->readNumber(); + _enterFrameSet = file->readNumber(); + _visibleFrame = file->readNumber(); + + CGameObject::load(file); +} + +bool CCarry::MouseDragStartMsg(CMouseDragStartMsg *msg) { + CString name = getName(); + + if (_fieldE0) { + if (_visible) { + CShowTextMsg textMsg("You can't get this."); + textMsg.execute("PET"); + } + } else { + if (checkStartDragging(msg)) { + CPassOnDragStartMsg startMsg(msg->_mousePos); + startMsg.execute(this); + return true; + } + } + + return false; +} + +bool CCarry::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { + setPosition(msg->_mousePos - _tempPos); + return true; +} + +bool CCarry::MouseDragEndMsg(CMouseDragEndMsg *msg) { + if (msg->_dropTarget) { + if (msg->_dropTarget->isPet()) { + petAddToInventory(); + return true; + } + + CCharacter *npc = static_cast<CCharacter *>(msg->_dropTarget); + if (npc) { + CUseWithCharMsg charMsg(npc); + charMsg.execute(this, nullptr, 0); + return true; + } + + CDropObjectMsg dropMsg(this); + if (dropMsg.execute(msg->_dropTarget)) + return true; + + // Fall back on a use with other message + CUseWithOtherMsg otherMsg(msg->_dropTarget); + if (otherMsg.execute(this, nullptr, 0)) + return true; + } + + CString viewName = getViewFullName(); + if (viewName.empty() || msg->_mousePos.y >= 360) { + sleep(250); + petAddToInventory(); + } else { + setPosition(_origPos); + loadFrame(_itemFrame); + } + + return true; +} + +bool CCarry::UseWithCharMsg(CUseWithCharMsg *msg) { + CSuccUBus *succubus = static_cast<CSuccUBus *>(msg->_character); + if (succubus) { + CSubAcceptCCarryMsg carryMsg; + carryMsg._item = this; + carryMsg.execute(succubus); + } else { + CShowTextMsg textMsg(_string4); + textMsg.execute("PET"); + petAddToInventory(); + } + + return true; +} + +bool CCarry::LeaveViewMsg(CLeaveViewMsg *msg) { + return true; +} + +bool CCarry::UseWithOtherMsg(CUseWithOtherMsg *msg) { + CShowTextMsg textMsg(_string3); + textMsg.execute("PET"); + + _fullViewName = getViewFullName(); + if (_fullViewName.empty() || _bounds.top >= 360) { + sleep(250); + petAddToInventory(); + } else { + setPosition(_origPos); + } + + return true; +} + +bool CCarry::VisibleMsg(CVisibleMsg *msg) { + setVisible(msg->_visible); + if (msg->_visible && _visibleFrame != -1) + loadFrame(_visibleFrame); + + return true; +} + +bool CCarry::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return true; +} + +bool CCarry::RemoveFromGameMsg(CRemoveFromGameMsg *msg) { + setPosition(Point(0, 0)); + setVisible(false); + + return true; +} + +bool CCarry::MoveToStartPosMsg(CMoveToStartPosMsg *msg) { + setPosition(_origPos); + return true; +} + +bool CCarry::EnterViewMsg(CEnterViewMsg *msg) { + if (!_enterFrameSet) { + loadFrame(_enterFrame); + _enterFrameSet = true; + } + + return true; +} + +bool CCarry::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { + if (_visibleFrame != -1) + loadFrame(_visibleFrame); + + if (msg->_value3) { + _tempPos.x = _bounds.width() / 2; + _tempPos.y = _bounds.height() / 2; + } else { + _tempPos = msg->_mousePos - _bounds; + } + + setPosition(_tempPos - getMousePos()); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/carry.h b/engines/titanic/carry/carry.h new file mode 100644 index 0000000000..fb5519e290 --- /dev/null +++ b/engines/titanic/carry/carry.h @@ -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. + * + */ + +#ifndef TITANIC_CARRY_H +#define TITANIC_CARRY_H + +#include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" + +namespace Titanic { + +class CCarry : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseDragStartMsg(CMouseDragStartMsg *msg); + bool MouseDragMoveMsg(CMouseDragMoveMsg *msg); + bool MouseDragEndMsg(CMouseDragEndMsg *msg); + bool UseWithCharMsg(CUseWithCharMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool UseWithOtherMsg(CUseWithOtherMsg *msg); + bool VisibleMsg(CVisibleMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool RemoveFromGameMsg(CRemoveFromGameMsg *msg); + bool MoveToStartPosMsg(CMoveToStartPosMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool PassOnDragStartMsg(CPassOnDragStartMsg *msg); +protected: + CString _string1; + int _fieldDC; + CString _string3; + CString _string4; + Point _tempPos; + int _field100; + int _field104; + int _field108; + int _field10C; + int _itemFrame; + CString _string5; + int _enterFrame; + bool _enterFrameSet; + int _visibleFrame; +public: + int _fieldE0; + Point _origPos; + CString _fullViewName; +public: + CLASSDEF; + CCarry(); + + /** + * 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_CARRY_H */ diff --git a/engines/titanic/carry/carry_parrot.cpp b/engines/titanic/carry/carry_parrot.cpp new file mode 100644 index 0000000000..8a453e348c --- /dev/null +++ b/engines/titanic/carry/carry_parrot.cpp @@ -0,0 +1,237 @@ +/* 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/carry/carry_parrot.h" +#include "titanic/core/project_item.h" +#include "titanic/core/room_item.h" +#include "titanic/game/cage.h" +#include "titanic/npcs/parrot.h" +#include "titanic/npcs/succubus.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CCarryParrot, CCarry) + ON_MESSAGE(PETGainedObjectMsg) + ON_MESSAGE(TimerMsg) + ON_MESSAGE(IsParrotPresentMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(MouseDragEndMsg) + ON_MESSAGE(PassOnDragStartMsg) + ON_MESSAGE(PreEnterViewMsg) + ON_MESSAGE(UseWithCharMsg) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + +CCarryParrot::CCarryParrot() : CCarry(), _string6("PerchedParrot"), + _timerId(0), _field13C(0), _field140(false), _field144(10), + _field148(25), _field14C(0), _field150(8) { +} + +void CCarryParrot::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string6, indent); + file->writeNumberLine(_timerId, indent); + file->writeNumberLine(_field13C, indent); + file->writeNumberLine(_field140, indent); + + CCarry::save(file, indent); +} + +void CCarryParrot::load(SimpleFile *file) { + file->readNumber(); + _string6 = file->readString(); + _timerId = file->readNumber(); + _field13C = file->readNumber(); + _field140 = file->readNumber(); + + CCarry::load(file); +} + +bool CCarryParrot::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { + CParrot::_v4 = 4; + CActMsg actMsg("Shut"); + actMsg.execute("ParrotCage"); + + return true; +} + +bool CCarryParrot::TimerMsg(CTimerMsg *msg) { + if (CParrot::_v4 == 1 || CParrot::_v4 == 4) { + if (++_field13C >= 30) { + CActMsg actMsg("FreeParrot"); + actMsg.execute(this); + } + } + + return true; +} + +bool CCarryParrot::IsParrotPresentMsg(CIsParrotPresentMsg *msg) { + msg->_value = true; + return true; +} + +bool CCarryParrot::LeaveViewMsg(CLeaveViewMsg *msg) { + if (_visible) { + setVisible(false); + _fieldE0 = 0; + CParrot::_v4 = 2; + } + + return true; +} + +bool CCarryParrot::MouseDragEndMsg(CMouseDragEndMsg *msg) { + stopMovie(); + + if (msg->_mousePos.y >= 360) { + petAddToInventory(); + return true; + } + + if (compareViewNameTo("ParrotLobby.Node 1.N")) { + if (msg->_mousePos.x >= 75 && msg->_mousePos.x <= 565 && + !CParrot::_v2 && !CCage::_open) { + setVisible(false); + _fieldE0 = 0; + CTreeItem *perchedParrot = findUnder(getRoot(), "PerchedParrot"); + detach(); + addUnder(perchedParrot); + sound8(true); + + CPutParrotBackMsg backMsg(msg->_mousePos.x); + backMsg.execute(perchedParrot); + } else { + setVisible(false); + _fieldE0 = 0; + CParrot::_v4 = 2; + playSound("z#475.wav", 100, 0, 0); + sound8(true); + moveUnder(findRoom()); + + CActMsg actMsg("Shut"); + actMsg.execute("ParrotCage"); + } + } else { + CCharacter *character = static_cast<CCharacter *>(msg->_dropTarget); + if (character) { + CUseWithCharMsg charMsg(character); + charMsg.execute(this, nullptr, 0); + } else { + setVisible(false); + _fieldE0 = 0; + playSound("z#475.wav", 100, 0, 0); + sound8(true); + moveUnder(findRoom()); + } + } + + return true; +} + +bool CCarryParrot::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { + if (CParrot::_v4 != 3) { + moveToView(); + setPosition(Point(0, 0)); + setVisible(true); + playClip("Pick Up", 2); + playClip("Flapping", 1); + + stopTimer(_timerId); + _timerId = addTimer(1000, 1000); + + _field13C = 0; + CParrot::_v4 = 1; + msg->_value3 = 1; + + return CCarry::PassOnDragStartMsg(msg); + } + + CTrueTalkNPC *npc = static_cast<CTrueTalkNPC *>(getRoot()->findByName(_string6)); + if (npc) + startTalking(npc, 0x446BF); + + _fieldE0 = 0; + playSound("z#475.wav", 100, 0, 0); + moveUnder(findRoom()); + msg->_value4 = 1; + + return true; +} + +bool CCarryParrot::PreEnterViewMsg(CPreEnterViewMsg *msg) { + loadSurface(); + CCarryParrot *parrot = static_cast<CCarryParrot *>(getRoot()->findByName("CarryParrot")); + if (parrot) + parrot->_fieldE0 = 0; + + return true; +} + +bool CCarryParrot::UseWithCharMsg(CUseWithCharMsg *msg) { + CSuccUBus *succubus = static_cast<CSuccUBus *>(msg->_character); + if (succubus) + CParrot::_v4 = 3; + + return CCarry::UseWithCharMsg(msg); +} + +bool CCarryParrot::ActMsg(CActMsg *msg) { + if (msg->_action == "FreeParrot" && (CParrot::_v4 == 4 || CParrot::_v4 == 1)) { + CTrueTalkNPC *npc = static_cast<CTrueTalkNPC *>(getRoot()->findByName(_string6)); + if (npc) + startTalking(npc, 0x446BF); + + setVisible(false); + _fieldE0 = 0; + + if (CParrot::_v4 == 4) { + CActMsg actMsg("Shut"); + actMsg.execute("ParrotCage"); + } else { + playSound("z#475.wav", 100, 0, 0); + + if (!_field140) { + CCarry *feathers = static_cast<CCarry *>(getRoot()->findByName("Feathers")); + if (feathers) { + feathers->setVisible(true); + feathers->petAddToInventory(); + } + + _field140 = true; + } + + getPetControl()->removeFromInventory(this); + getPetControl()->setAreaChangeType(1); + moveUnder(getRoom()); + } + + CParrot::_v4 = 2; + stopTimer(_timerId); + _timerId = 0; + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/carry_parrot.h b/engines/titanic/carry/carry_parrot.h new file mode 100644 index 0000000000..2980f26d8a --- /dev/null +++ b/engines/titanic/carry/carry_parrot.h @@ -0,0 +1,70 @@ +/* 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_CARRY_PARROT_H +#define TITANIC_CARRY_PARROT_H + +#include "titanic/carry/carry.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" +#include "titanic/messages/pet_messages.h" + +namespace Titanic { + +class CCarryParrot : public CCarry { + DECLARE_MESSAGE_MAP; + bool PETGainedObjectMsg(CPETGainedObjectMsg *msg); + bool TimerMsg(CTimerMsg *msg); + bool IsParrotPresentMsg(CIsParrotPresentMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool MouseDragEndMsg(CMouseDragEndMsg *msg); + bool PassOnDragStartMsg(CPassOnDragStartMsg *msg); + bool PreEnterViewMsg(CPreEnterViewMsg *msg); + bool UseWithCharMsg(CUseWithCharMsg *msg); + bool ActMsg(CActMsg *msg); +private: + CString _string6; + int _timerId; + int _field13C; + bool _field140; + int _field144; + int _field148; + int _field14C; + int _field150; +public: + CLASSDEF; + CCarryParrot(); + + /** + * 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_CARRY_PARROT_H */ diff --git a/engines/titanic/carry/central_core.cpp b/engines/titanic/carry/central_core.cpp new file mode 100644 index 0000000000..e210b34cbe --- /dev/null +++ b/engines/titanic/carry/central_core.cpp @@ -0,0 +1,93 @@ +/* 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/carry/central_core.h" +#include "titanic/npcs/parrot.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CCentralCore, CBrain) + ON_MESSAGE(UseWithOtherMsg) + ON_MESSAGE(DropZoneLostObjectMsg) + ON_MESSAGE(DropZoneGotObjectMsg) +END_MESSAGE_MAP() + +void CCentralCore::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CBrain::save(file, indent); +} + +void CCentralCore::load(SimpleFile *file) { + file->readNumber(); + CBrain::load(file); +} + +bool CCentralCore::UseWithOtherMsg(CUseWithOtherMsg *msg) { + CString name = msg->_other->getName(); + if (name == "HammerDispensorButton") { + CPuzzleSolvedMsg solvedMsg; + solvedMsg.execute("BigHammer"); + } else if (name == "SpeechCentre") { + CShowTextMsg textMsg("This does not reach."); + textMsg.execute("PET"); + } + + return CBrain::UseWithOtherMsg(msg); +} + +bool CCentralCore::DropZoneLostObjectMsg(CDropZoneLostObjectMsg *msg) { + CString name = msg->_object->getName(); + if (name == "PerchCoreHolder") { + CParrot::_v2 = 1; + if (isEquals("CentralCore")) + CParrot::_v5 = 0; + + CActMsg actMsg("LosePerch"); + actMsg.execute("ParrotLobbyController"); + } else if (name == "PerchHolder") { + CActMsg actMsg("LoseStick"); + actMsg.execute("ParrotLobbyController"); + } + + return true; +} + +bool CCentralCore::DropZoneGotObjectMsg(CDropZoneGotObjectMsg *msg) { + CString name = msg->_object->getName(); + if (name == "PerchCoreHolder") { + if (isEquals("CentralCore")) { + CParrot::_v5 = 1; + CActMsg actMsg("CoreReplaced"); + actMsg.execute("ParrotCage"); + } + + CActMsg actMsg("GainPerch"); + actMsg.execute("ParrotLobbyController"); + } else if (name == "PerchHolder") { + CActMsg actMsg("GainStick"); + actMsg.execute("ParrotLobbyController"); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/central_core.h b/engines/titanic/carry/central_core.h new file mode 100644 index 0000000000..cc5d9c2f95 --- /dev/null +++ b/engines/titanic/carry/central_core.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_CENTRAL_CORE_H +#define TITANIC_CENTRAL_CORE_H + +#include "titanic/carry/brain.h" + +namespace Titanic { + +class CCentralCore : public CBrain { + DECLARE_MESSAGE_MAP; + bool UseWithOtherMsg(CUseWithOtherMsg *msg); + bool DropZoneLostObjectMsg(CDropZoneLostObjectMsg *msg); + bool DropZoneGotObjectMsg(CDropZoneGotObjectMsg *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_CENTRAL_CORE_H */ diff --git a/engines/titanic/carry/chicken.cpp b/engines/titanic/carry/chicken.cpp new file mode 100644 index 0000000000..65404dc65d --- /dev/null +++ b/engines/titanic/carry/chicken.cpp @@ -0,0 +1,225 @@ +/* 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/carry/chicken.h" +#include "titanic/game/sauce_dispensor.h" +#include "titanic/npcs/succubus.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CChicken, CCarry) + ON_MESSAGE(UseWithCharMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(VisibleMsg) + ON_MESSAGE(TimerMsg) + ON_MESSAGE(PETGainedObjectMsg) + ON_MESSAGE(ParrotTriesChickenMsg) + ON_MESSAGE(MouseDragEndMsg) + ON_MESSAGE(PETObjectStateMsg) + ON_MESSAGE(PETLostObjectMsg) +END_MESSAGE_MAP() + +int CChicken::_v1; + +CChicken::CChicken() : CCarry(), _string6("None"), + _field12C(1), _field13C(0), _timerId(0) { +} + +void CChicken::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field12C, indent); + file->writeQuotedLine(_string6, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_field13C, indent); + file->writeNumberLine(_timerId, indent); + + CCarry::save(file, indent); +} + +void CChicken::load(SimpleFile *file) { + file->readNumber(); + _field12C = file->readNumber(); + _string6 = file->readString(); + _v1 = file->readNumber(); + _field13C = file->readNumber(); + _timerId = file->readNumber(); + + CCarry::load(file); +} + +bool CChicken::UseWithOtherMsg(CUseWithOtherMsg *msg) { + if (msg->_other->getName() == "Napkin") { + if (_field12C || _string6 == "None") { + CActMsg actMsg("Clean"); + actMsg.execute(this); + petAddToInventory(); + } else { + CShowTextMsg textMsg("The chicken is already clean."); + textMsg.execute("PET"); + } + + petAddToInventory(); + } else { + CSauceDispensor *dispensor = static_cast<CSauceDispensor *>(msg->_other); + if (!dispensor || _string6 == "None") { + return CCarry::UseWithOtherMsg(msg); + } else { + setVisible(false); + CUse use(this); + use.execute(msg->_other); + } + } + + return true; +} + +bool CChicken::UseWithCharMsg(CUseWithCharMsg *msg) { + CSuccUBus *succubus = static_cast<CSuccUBus *>(msg->_character); + if (succubus) { + setPosition(Point(330, 300)); + CSubAcceptCCarryMsg acceptMsg; + acceptMsg._item = this; + acceptMsg.execute(succubus); + } else { + petAddToInventory(); + } + + return true; +} + +bool CChicken::ActMsg(CActMsg *msg) { + if (msg->_action == "GoToPET") { + setVisible(true); + petAddToInventory(); + } else if (msg->_action == "Tomato") { + _string6 = "Tomato"; + loadFrame(4); + _visibleFrame = 4; + } else if (msg->_action == "Mustard") { + _string6 = "Mustard"; + loadFrame(5); + _visibleFrame = 5; + } else if (msg->_action == "Bird") { + _string6 = "Bird"; + loadFrame(2); + _visibleFrame = 2; + } else if (msg->_action == "None") { + setVisible(false); + } else if (msg->_action == "Clean") { + _string6 = "None"; + loadFrame(3); + _field12C = 0; + _visibleFrame = 3; + } + else if (msg->_action == "Dispense Chicken") { + _string6 = "None"; + _field13C = 0; + _field12C = 1; + loadFrame(1); + _visibleFrame = 1; + _v1 = 120; + } else if (msg->_action == "Hot") { + _v1 = 120; + } else if (msg->_action == "Eaten") { + setVisible(false); + petMoveToHiddenRoom(); + _field13C = 1; + } + + return true; +} + +bool CChicken::VisibleMsg(CVisibleMsg *msg) { + setVisible(msg->_visible); + if (msg->_visible) + loadFrame(_visibleFrame); + + return true; +} + +bool CChicken::TimerMsg(CTimerMsg *msg) { + CGameObject *obj = getMailManFirstObject(); + while (obj && obj->getName() != "Chicken") + obj = getMailManNextObject(obj); + + bool flag = false; + if (obj) { + flag = _v1; + } else if (_v1 > 0) { + --_v1; + flag = _v1; + } + + if (flag) { + petInvChange(); + stopTimer(_timerId); + } + + return true; +} + +bool CChicken::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { + stopTimer(_timerId); + _timerId = addTimer(1000, 1000); + return true; +} + +bool CChicken::ParrotTriesChickenMsg(CParrotTriesChickenMsg *msg) { + if (_v1 > 0) + msg->_value1 = 1; + + if (_string6 == "Tomato") { + msg->_value2 = 1; + } else if (_string6 == "Mustard") { + msg->_value2 = 2; + } else if (_string6 == "Bird") { + msg->_value2 = 3; + } + + return true; +} + +bool CChicken::MouseDragEndMsg(CMouseDragEndMsg *msg) { + if (_field13C) + return true; + else + return CCarry::MouseDragEndMsg(msg); +} + +bool CChicken::PETObjectStateMsg(CPETObjectStateMsg *msg) { + if (_v1 > 0) + msg->_value = 2; + + return true; +} + +bool CChicken::PETLostObjectMsg(CPETLostObjectMsg *msg) { + if (compareViewNameTo("ParrotLobby.Node 1.N")) { + CActMsg actMsg("StartChickenDrag"); + actMsg.execute("PerchedParrot"); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/chicken.h b/engines/titanic/carry/chicken.h new file mode 100644 index 0000000000..e64ae458a4 --- /dev/null +++ b/engines/titanic/carry/chicken.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_CHICKEN_H +#define TITANIC_CHICKEN_H + +#include "titanic/carry/carry.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/pet_messages.h" + +namespace Titanic { + +class CChicken : public CCarry { + DECLARE_MESSAGE_MAP; + bool UseWithOtherMsg(CUseWithOtherMsg *msg); + bool UseWithCharMsg(CUseWithCharMsg *msg); + bool ActMsg(CActMsg *msg); + bool VisibleMsg(CVisibleMsg *msg); + bool TimerMsg(CTimerMsg *msg); + bool PETGainedObjectMsg(CPETGainedObjectMsg *msg); + bool ParrotTriesChickenMsg(CParrotTriesChickenMsg *msg); + bool MouseDragEndMsg(CMouseDragEndMsg *msg); + bool PETObjectStateMsg(CPETObjectStateMsg *msg); + bool PETLostObjectMsg(CPETLostObjectMsg *msg); +public: + static int _v1; +public: + int _field12C; + CString _string6; + int _field13C; + int _timerId; +public: + CLASSDEF; + CChicken(); + + /** + * 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_CHICKEN_H */ diff --git a/engines/titanic/carry/crushed_tv.cpp b/engines/titanic/carry/crushed_tv.cpp new file mode 100644 index 0000000000..486537d28e --- /dev/null +++ b/engines/titanic/carry/crushed_tv.cpp @@ -0,0 +1,79 @@ +/* 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/carry/crushed_tv.h" +#include "titanic/npcs/character.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CCrushedTV, CCarry) + ON_MESSAGE(ActMsg) + ON_MESSAGE(UseWithCharMsg) + ON_MESSAGE(MouseDragStartMsg) +END_MESSAGE_MAP() + +CCrushedTV::CCrushedTV() : CCarry() { +} + +void CCrushedTV::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CCarry::save(file, indent); +} + +void CCrushedTV::load(SimpleFile *file) { + file->readNumber(); + CCarry::load(file); +} + +bool CCrushedTV::ActMsg(CActMsg *msg) { + if (msg->_action == "SmashTV") { + setVisible(true); + _fieldE0 = 1; + } + + return true; +} + +bool CCrushedTV::UseWithCharMsg(CUseWithCharMsg *msg) { + if (msg->_character->getName() == "Barbot" && msg->_character->_visible) { + setVisible(false); + CActMsg actMsg("CrushedTV"); + actMsg.execute(msg->_character); + return true; + } else { + return CCarry::UseWithCharMsg(msg); + } +} + +bool CCrushedTV::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (!checkStartDragging(msg)) { + return false; + } else if (compareViewNameTo("BottomOfWell.Node 7.N")) { + changeView("BottomOfWell.Node 12.N", ""); + CActMsg actMsg("TelevisionTaken"); + actMsg.execute("BOWTelevisionMonitor"); + } + + return CCarry::MouseDragStartMsg(msg); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/crushed_tv.h b/engines/titanic/carry/crushed_tv.h new file mode 100644 index 0000000000..340930f842 --- /dev/null +++ b/engines/titanic/carry/crushed_tv.h @@ -0,0 +1,54 @@ +/* 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_CRUSHED_TV_H +#define TITANIC_CRUSHED_TV_H + +#include "titanic/carry/carry.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" + +namespace Titanic { + +class CCrushedTV : public CCarry { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool UseWithCharMsg(CUseWithCharMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); +public: + CLASSDEF; + CCrushedTV(); + + /** + * 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_CRUSHED_TV_H */ diff --git a/engines/titanic/carry/ear.cpp b/engines/titanic/carry/ear.cpp new file mode 100644 index 0000000000..a2234bc6dc --- /dev/null +++ b/engines/titanic/carry/ear.cpp @@ -0,0 +1,67 @@ +/* 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/carry/ear.h" +#include "titanic/game/head_slot.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CEar, CHeadPiece) + ON_MESSAGE(ActMsg) + ON_MESSAGE(UseWithOtherMsg) +END_MESSAGE_MAP() + +CEar::CEar() : CHeadPiece() { +} + +void CEar::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CHeadPiece::save(file, indent); +} + +void CEar::load(SimpleFile *file) { + file->readNumber(); + CHeadPiece::load(file); +} + +bool CEar::ActMsg(CActMsg *msg) { + if (msg->_action == "MusicSolved") + _fieldE0 = true; + return true; +} + +bool CEar::UseWithOtherMsg(CUseWithOtherMsg *msg) { + CHeadSlot *slot = dynamic_cast<CHeadSlot *>(msg->_other); + if (slot) { + setVisible(false); + petMoveToHiddenRoom(); + setPosition(Point(0, 0)); + + CAddHeadPieceMsg addMsg(getName()); + if (addMsg._value != "NULL") + addMsg.execute(addMsg._value == "Ear1" ? "Ear1Slot" : "Ear2Slot"); + } + + return CCarry::UseWithOtherMsg(msg); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/ear.h b/engines/titanic/carry/ear.h new file mode 100644 index 0000000000..a357f46bbf --- /dev/null +++ b/engines/titanic/carry/ear.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_EAR_H +#define TITANIC_EAR_H + +#include "titanic/carry/head_piece.h" + +namespace Titanic { + +class CEar : public CHeadPiece { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool UseWithOtherMsg(CUseWithOtherMsg *msg); +public: + CLASSDEF; + CEar(); + + /** + * 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_EAR_H */ diff --git a/engines/titanic/carry/eye.cpp b/engines/titanic/carry/eye.cpp new file mode 100644 index 0000000000..400df2fdc8 --- /dev/null +++ b/engines/titanic/carry/eye.cpp @@ -0,0 +1,139 @@ +/* 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/carry/eye.h" +#include "titanic/game/head_slot.h" +#include "titanic/pet_control/pet_control.h" +#include "titanic/game/transport/lift.h" +#include "titanic/game/television.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CEye, CHeadPiece) + ON_MESSAGE(UseWithOtherMsg) + ON_MESSAGE(UseWithCharMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(PETGainedObjectMsg) + ON_MESSAGE(PassOnDragStartMsg) +END_MESSAGE_MAP() + +CEye::CEye() : CHeadPiece(), _eyeFlag(false) { +} + +void CEye::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_eyeFlag, indent); + CHeadPiece::save(file, indent); +} + +void CEye::load(SimpleFile *file) { + file->readNumber(); + _eyeFlag = file->readNumber(); + CHeadPiece::load(file); +} + + +bool CEye::UseWithOtherMsg(CUseWithOtherMsg *msg) { + CHeadSlot *slot = dynamic_cast<CHeadSlot *>(msg->_other); + if (slot) { + petMoveToHiddenRoom(); + _flag = true; + CAddHeadPieceMsg headMsg(getName()); + + if (headMsg._value != "NULL") + headMsg.execute(isEquals("Eye1") ? "Eye1Slot" : "Eye2Slot"); + } else if (msg->_other->isEquals("LiftbotWithoutHead")) { + CPetControl *pet = getPetControl(); + if (!CLift::_v1 && pet->getRoomsElevatorNum() == 4) { + _eyeFlag = true; + setPosition(_origPos); + setVisible(false); + CActMsg actMsg1(getName()); + actMsg1.execute("GetLiftEye"); + + CActMsg actMsg2("AddWrongHead"); + actMsg2.execute("FaultyLiftbot"); + } + } else { + return CCarry::UseWithOtherMsg(msg); + } + + return true; +} + +bool CEye::UseWithCharMsg(CUseWithCharMsg *msg) { + CLift *lift = dynamic_cast<CLift *>(msg->_character); + if (lift && lift->getName() == "Well") { + CPetControl *pet = getPetControl(); + if (!CLift::_v1 && pet->getRoomsElevatorNum() == 4) { + _eyeFlag = true; + setPosition(_origPos); + setVisible(false); + + CActMsg actMsg1(getName()); + actMsg1.execute("GetLiftEye"); + CActMsg actMsg2("AddWrongHead"); + actMsg2.execute(msg->_character); + } + + return true; + } else { + return CHeadPiece::UseWithCharMsg(msg); + } +} + +bool CEye::ActMsg(CActMsg *msg) { + if (msg->_action == "BellbotGetLight") { + setVisible(true); + petAddToInventory(); + playSound("z#47.wav"); + + CActMsg actMsg("Eye Removed"); + actMsg.execute("1stClassState"); + } else { + _eyeFlag = false; + + CActMsg actMsg("LoseHead"); + actMsg.execute("FaultyLiftbot"); + } + + return true; +} + +bool CEye::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { + if (isEquals("Eye1")) + CTelevision::_v5 = 0; + + return CHeadPiece::PETGainedObjectMsg(msg); +} + +bool CEye::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { + setVisible(true); + if (_eyeFlag) + CTelevision::_v6 = 0; + else if (isEquals("Eye1")) + CTelevision::_v5 = 0; + + return CHeadPiece::PassOnDragStartMsg(msg); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/eye.h b/engines/titanic/carry/eye.h new file mode 100644 index 0000000000..886bd39b84 --- /dev/null +++ b/engines/titanic/carry/eye.h @@ -0,0 +1,56 @@ +/* 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_EYE_H +#define TITANIC_EYE_H + +#include "titanic/carry/head_piece.h" + +namespace Titanic { + +class CEye : public CHeadPiece { + DECLARE_MESSAGE_MAP; + bool UseWithOtherMsg(CUseWithOtherMsg *msg); + bool UseWithCharMsg(CUseWithCharMsg *msg); + bool ActMsg(CActMsg *msg); + bool PETGainedObjectMsg(CPETGainedObjectMsg *msg); + bool PassOnDragStartMsg(CPassOnDragStartMsg *msg); +private: + bool _eyeFlag; +public: + CLASSDEF; + CEye(); + + /** + * 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_EYE_H */ diff --git a/engines/titanic/carry/feathers.cpp b/engines/titanic/carry/feathers.cpp new file mode 100644 index 0000000000..a5d2babfb1 --- /dev/null +++ b/engines/titanic/carry/feathers.cpp @@ -0,0 +1,42 @@ +/* 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/carry/feathers.h" + +namespace Titanic { + +EMPTY_MESSAGE_MAP(CFeathers, CCarry); + +CFeathers::CFeathers() : CCarry() { +} + +void CFeathers::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CCarry::save(file, indent); +} + +void CFeathers::load(SimpleFile *file) { + file->readNumber(); + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/feathers.h b/engines/titanic/carry/feathers.h new file mode 100644 index 0000000000..7282bcb580 --- /dev/null +++ b/engines/titanic/carry/feathers.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_FEATHERS_H +#define TITANIC_FEATHERS_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CFeathers : public CCarry { + DECLARE_MESSAGE_MAP; +public: + CLASSDEF; + CFeathers(); + + /** + * 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_FEATHERS_H */ diff --git a/engines/titanic/carry/fruit.cpp b/engines/titanic/carry/fruit.cpp new file mode 100644 index 0000000000..68f3af7229 --- /dev/null +++ b/engines/titanic/carry/fruit.cpp @@ -0,0 +1,98 @@ +/* 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/carry/fruit.h" +#include "titanic/npcs/character.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CFruit, CCarry) + ON_MESSAGE(UseWithCharMsg) + ON_MESSAGE(LemonFallsFromTreeMsg) + ON_MESSAGE(UseWithOtherMsg) + ON_MESSAGE(FrameMsg) +END_MESSAGE_MAP() + +CFruit::CFruit() : CCarry(), _field12C(0), + _field130(0), _field134(0), _field138(0) { +} + +void CFruit::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field12C, indent); + file->writeNumberLine(_field130, indent); + file->writeNumberLine(_field134, indent); + file->writeNumberLine(_field138, indent); + + CCarry::save(file, indent); +} + +void CFruit::load(SimpleFile *file) { + file->readNumber(); + _field12C = file->readNumber(); + _field130 = file->readNumber(); + _field134 = file->readNumber(); + _field138 = file->readNumber(); + + CCarry::load(file); +} + +bool CFruit::UseWithCharMsg(CUseWithCharMsg *msg) { + if (msg->_character->isEquals("Barbot") && msg->_character->_visible) { + CActMsg actMsg("Fruit"); + actMsg.execute(msg->_character); + _fieldE0 = 0; + setVisible(false); + return true; + } else { + return CCarry::UseWithCharMsg(msg); + } +} + +bool CFruit::LemonFallsFromTreeMsg(CLemonFallsFromTreeMsg *msg) { + setVisible(true); + dragMove(msg->_pt); + _field130 = 1; + return true; +} + +bool CFruit::UseWithOtherMsg(CUseWithOtherMsg *msg) { + petAddToInventory(); + return true; +} + +bool CFruit::FrameMsg(CFrameMsg *msg) { + if (_field130) { + if (_bounds.top > 240) { + _field130 = 0; + _field134 = 1; + } + + makeDirty(); + _bounds.top += 3; + makeDirty(); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/fruit.h b/engines/titanic/carry/fruit.h new file mode 100644 index 0000000000..bcbd314de8 --- /dev/null +++ b/engines/titanic/carry/fruit.h @@ -0,0 +1,58 @@ +/* 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_FRUIT_H +#define TITANIC_FRUIT_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CFruit : public CCarry { + DECLARE_MESSAGE_MAP; + bool UseWithCharMsg(CUseWithCharMsg *msg); + bool LemonFallsFromTreeMsg(CLemonFallsFromTreeMsg *msg); + bool UseWithOtherMsg(CUseWithOtherMsg *msg); + bool FrameMsg(CFrameMsg *msg); +private: + int _field12C; + int _field130; + int _field134; + int _field138; +public: + CLASSDEF; + CFruit(); + + /** + * 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_FRUIT_H */ diff --git a/engines/titanic/carry/glass.cpp b/engines/titanic/carry/glass.cpp new file mode 100644 index 0000000000..03050dc60d --- /dev/null +++ b/engines/titanic/carry/glass.cpp @@ -0,0 +1,158 @@ +/* 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/carry/glass.h" +#include "titanic/carry/chicken.h" +#include "titanic/game/sauce_dispensor.h" +#include "titanic/npcs/character.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CGlass, CCarry) + ON_MESSAGE(UseWithOtherMsg) + ON_MESSAGE(UseWithCharMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MouseDragEndMsg) + ON_MESSAGE(TurnOn) + ON_MESSAGE(TurnOff) +END_MESSAGE_MAP() + +CGlass::CGlass() : CCarry(), _string6("None") { +} + +void CGlass::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string6, indent); + CCarry::save(file, indent); +} + +void CGlass::load(SimpleFile *file) { + file->readNumber(); + _string6 = file->readString(); + CCarry::load(file); +} + +bool CGlass::UseWithOtherMsg(CUseWithOtherMsg *msg) { + CSauceDispensor *dispensor = dynamic_cast<CSauceDispensor *>(msg->_other); + CChicken *chicken = dynamic_cast<CChicken *>(msg->_other); + + if (dispensor && _string6 != "None") { + CUse useMsg(this); + useMsg.execute(dispensor); + } else if (msg->_other->isEquals("Chicken") && _string6 != "None") { + if (chicken->_string6 != "None") { + if (!chicken->_field12C) { + CActMsg actMsg(_string6); + actMsg.execute("Chicken"); + } + + _string6 = "None"; + loadFrame(0); + _visibleFrame = 0; + } + + petAddToInventory(); + } else if (msg->_other->isEquals("Napkin") && _string6 != "None") { + petAddToInventory(); + _string6 = "None"; + loadFrame(0); + _visibleFrame = 0; + } else { + petAddToInventory(); + } + + return true; +} + +bool CGlass::UseWithCharMsg(CUseWithCharMsg *msg) { + if (msg->_character->isEquals("Barbot") && msg->_character->_visible) { + CActMsg actMsg(_string6); + setVisible(false); + + if (_string6 != "Bird") + setPosition(_origPos); + + actMsg.execute(msg->_character); + } else { + petAddToInventory(); + } + + return true; +} + +bool CGlass::ActMsg(CActMsg *msg) { + if (msg->_action == "GoToPET") { + setVisible(true); + petAddToInventory(); + } else if (msg->_action == "Mustard") { + _string6 = "Mustard"; + loadFrame(1); + _visibleFrame = 1; + } else if (msg->_action == "Tomato") { + _string6 = "Tomato"; + loadFrame(2); + _visibleFrame = 2; + } else if (msg->_action == "Bird") { + _string6 = "Bird"; + loadFrame(3); + _visibleFrame = 3; + } else if (msg->_action == "InTitilator") { + _string6 = "None"; + loadFrame(0); + _visibleFrame = 0; + } + + return true; +} + +bool CGlass::MouseDragEndMsg(CMouseDragEndMsg *msg) { + showMouse(); + if (msg->_dropTarget) { + error("TODO: See what drop target is"); + CCharacter *npc = dynamic_cast<CCharacter *>(msg->_dropTarget); + if (npc) { + CUseWithCharMsg useMsg(npc); + useMsg.execute(this); + } else { + CUseWithOtherMsg otherMsg(npc); + otherMsg.execute(this); + } + } else if (compareViewNameTo(_fullViewName) && msg->_mousePos.y < 360) { + setPosition(_origPos); + } else { + petAddToInventory(); + } + + return true; +} + +bool CGlass::TurnOn(CTurnOn *msg) { + setVisible(true); + return true; +} + +bool CGlass::TurnOff(CTurnOff *msg) { + setVisible(false); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/glass.h b/engines/titanic/carry/glass.h new file mode 100644 index 0000000000..85443840a1 --- /dev/null +++ b/engines/titanic/carry/glass.h @@ -0,0 +1,57 @@ +/* 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_GLASS_H +#define TITANIC_GLASS_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CGlass : public CCarry { + DECLARE_MESSAGE_MAP; + bool UseWithOtherMsg(CUseWithOtherMsg *msg); + bool UseWithCharMsg(CUseWithCharMsg *msg); + bool ActMsg(CActMsg *msg); + bool MouseDragEndMsg(CMouseDragEndMsg *msg); + bool TurnOn(CTurnOn *msg); + bool TurnOff(CTurnOff *msg); +private: + CString _string6; +public: + CLASSDEF; + CGlass(); + + /** + * 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_GLASS_H */ diff --git a/engines/titanic/carry/hammer.cpp b/engines/titanic/carry/hammer.cpp new file mode 100644 index 0000000000..88c766d564 --- /dev/null +++ b/engines/titanic/carry/hammer.cpp @@ -0,0 +1,63 @@ +/* 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/carry/hammer.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CHammer, CCarry) + ON_MESSAGE(PuzzleSolvedMsg) + ON_MESSAGE(UseWithOtherMsg) +END_MESSAGE_MAP() + +CHammer::CHammer() : CCarry() { +} + +void CHammer::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CCarry::save(file, indent); +} + +void CHammer::load(SimpleFile *file) { + file->readNumber(); + CCarry::load(file); +} + +bool CHammer::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) { + _fieldE0 = 1; + return true; +} + +bool CHammer::UseWithOtherMsg(CUseWithOtherMsg *msg) { + CString name = msg->_other->getName(); + if (name == "LongStickDispenser") { + CPuzzleSolvedMsg solvedMsg; + solvedMsg.execute("LongStickDispenser"); + } else if (name == "Bomb") { + CActMsg actMsg("Hit"); + actMsg.execute("Bomb"); + } + + return CCarry::UseWithOtherMsg(msg); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/hammer.h b/engines/titanic/carry/hammer.h new file mode 100644 index 0000000000..8cc86f3db1 --- /dev/null +++ b/engines/titanic/carry/hammer.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_HAMMER_H +#define TITANIC_HAMMER_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CHammer : public CCarry { + DECLARE_MESSAGE_MAP; + bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg); + bool UseWithOtherMsg(CUseWithOtherMsg *msg); +public: + CLASSDEF; + CHammer(); + + /** + * 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_HAMMER_H */ diff --git a/engines/titanic/carry/head_piece.cpp b/engines/titanic/carry/head_piece.cpp new file mode 100644 index 0000000000..34850488a7 --- /dev/null +++ b/engines/titanic/carry/head_piece.cpp @@ -0,0 +1,93 @@ +/* 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/carry/head_piece.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CHeadPiece, CCarry) + ON_MESSAGE(SenseWorkingMsg) + ON_MESSAGE(PETGainedObjectMsg) + ON_MESSAGE(MouseDragStartMsg) +END_MESSAGE_MAP() + +CHeadPiece::CHeadPiece() : CCarry(), _string6("Not Working"), + _flag(0), _field13C(false) { +} + +void CHeadPiece::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_flag, indent); + file->writeQuotedLine(_string6, indent); + file->writeNumberLine(_field13C, indent); + + CCarry::save(file, indent); +} + +void CHeadPiece::load(SimpleFile *file) { + file->readNumber(); + _flag = file->readNumber(); + _string6 = file->readString(); + _field13C = file->readNumber(); + + CCarry::load(file); +} + +bool CHeadPiece::SenseWorkingMsg(CSenseWorkingMsg *msg) { + _string6 = msg->_value; + return true; +} + +bool CHeadPiece::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { + _visibleFrame = 1; + if (!_field13C) { + stateInc38(); + _field13C = true; + } + + return true; +} + +bool CHeadPiece::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (!checkPoint(msg->_mousePos, false, true)) { + return false; + } else if (!_fieldE0) { + return true; + } + + if (_flag) { + setVisible(true); + moveToView(); + setPosition(Point(msg->_mousePos.x - _bounds.width() / 2, + msg->_mousePos.y - _bounds.height() / 2)); + + CTakeHeadPieceMsg takeMsg(getName()); + if (takeMsg._value != "NULL") + takeMsg.execute("TitaniaControl"); + + _flag = false; + } + + return CCarry::MouseDragStartMsg(msg); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/head_piece.h b/engines/titanic/carry/head_piece.h new file mode 100644 index 0000000000..367f781f0e --- /dev/null +++ b/engines/titanic/carry/head_piece.h @@ -0,0 +1,57 @@ +/* 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_HEAD_PIECE_H +#define TITANIC_HEAD_PIECE_H + +#include "titanic/carry/carry.h" +#include "titanic/messages/pet_messages.h" + +namespace Titanic { + +class CHeadPiece : public CCarry { + DECLARE_MESSAGE_MAP; + bool SenseWorkingMsg(CSenseWorkingMsg *msg); + bool PETGainedObjectMsg(CPETGainedObjectMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); +protected: + bool _flag; + CString _string6; + bool _field13C; +public: + CLASSDEF; + CHeadPiece(); + + /** + * 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_HEAD_PIECE_H */ diff --git a/engines/titanic/carry/hose.cpp b/engines/titanic/carry/hose.cpp new file mode 100644 index 0000000000..e90119138a --- /dev/null +++ b/engines/titanic/carry/hose.cpp @@ -0,0 +1,120 @@ +/* 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/carry/hose.h" +#include "titanic/npcs/succubus.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CHose, CCarry) + ON_MESSAGE(DropZoneGotObjectMsg) + ON_MESSAGE(PumpingMsg) + ON_MESSAGE(UseWithCharMsg) + ON_MESSAGE(HoseConnectedMsg) + ON_MESSAGE(DropZoneLostObjectMsg) +END_MESSAGE_MAP() + +CHoseStatics *CHose::_statics; + +void CHose::init() { + _statics = new CHoseStatics(); +} + +void CHose::deinit() { + delete _statics; +} + +CHose::CHose() : CCarry(), + _string6("Succ-U-Bus auxiliary hose attachment incompatible with sliding glass cover.") { +} + +void CHose::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_statics->_actionVal, indent); + file->writeQuotedLine(_statics->_actionTarget, indent); + file->writeQuotedLine(_string6, indent); + CCarry::save(file, indent); +} + +void CHose::load(SimpleFile *file) { + file->readNumber(); + _statics->_actionVal = file->readNumber(); + _statics->_actionTarget = file->readString(); + _string6 = file->readString(); + CCarry::load(file); +} + +bool CHose::DropZoneGotObjectMsg(CDropZoneGotObjectMsg *msg) { + _statics->_actionTarget = msg->_object->getName(); + CPumpingMsg pumpingMsg; + pumpingMsg._value = _statics->_actionVal; + pumpingMsg.execute(_statics->_actionTarget); + CHoseConnectedMsg connectedMsg; + connectedMsg._value = 1; + connectedMsg.execute(this); + + return true; +} + +bool CHose::PumpingMsg(CPumpingMsg *msg) { + _statics->_actionVal = msg->_value; + if (!_statics->_actionTarget.empty()) { + CPumpingMsg pumpingMsg; + pumpingMsg._value = _statics->_actionVal; + pumpingMsg.execute(_statics->_actionTarget); + } + + return true; +} + +bool CHose::UseWithCharMsg(CUseWithCharMsg *msg) { + CSuccUBus *succubus = dynamic_cast<CSuccUBus *>(msg->_character); + if (!_statics->_actionVal && succubus) { + CHoseConnectedMsg connectedMsg(1, this); + if (connectedMsg.execute(succubus)) + return true; + } + + return CCarry::UseWithCharMsg(msg); +} + +bool CHose::HoseConnectedMsg(CHoseConnectedMsg *msg) { + if (msg->_value) { + CHose *hose = dynamic_cast<CHose *>(findChildInstanceOf(CHose::_type)); + if (hose) { + setVisible(true); + petAddToInventory(); + } + } + + return true; +} + +bool CHose::DropZoneLostObjectMsg(CDropZoneLostObjectMsg *msg) { + CPumpingMsg pumpingMsg; + pumpingMsg._value = 0; + pumpingMsg.execute(msg->_object); + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/hose.h b/engines/titanic/carry/hose.h new file mode 100644 index 0000000000..3c8c1549c1 --- /dev/null +++ b/engines/titanic/carry/hose.h @@ -0,0 +1,66 @@ +/* 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_HOSE_H +#define TITANIC_HOSE_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +struct CHoseStatics { + int _actionVal; + CString _actionTarget; + CHoseStatics() : _actionVal(0) {} +}; + +class CHose : public CCarry { + DECLARE_MESSAGE_MAP; + bool DropZoneGotObjectMsg(CDropZoneGotObjectMsg *msg); + bool PumpingMsg(CPumpingMsg *msg); + bool UseWithCharMsg(CUseWithCharMsg *msg); + bool HoseConnectedMsg(CHoseConnectedMsg *msg); + bool DropZoneLostObjectMsg(CDropZoneLostObjectMsg *msg); +protected: + CString _string6; +public: + static CHoseStatics *_statics; +public: + CLASSDEF; + CHose(); + static void init(); + static void deinit(); + + /** + * 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_HOSE_H */ diff --git a/engines/titanic/carry/hose_end.cpp b/engines/titanic/carry/hose_end.cpp new file mode 100644 index 0000000000..c9996437bb --- /dev/null +++ b/engines/titanic/carry/hose_end.cpp @@ -0,0 +1,45 @@ +/* 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/carry/hose_end.h" + +namespace Titanic { + +EMPTY_MESSAGE_MAP(CHoseEnd, CHose); + +CHoseEnd::CHoseEnd() : CHose() { + _string6 = "Connection refused by remote hose."; +} + +void CHoseEnd::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string6, indent); + CHose::save(file, indent); +} + +void CHoseEnd::load(SimpleFile *file) { + file->readNumber(); + _string6 = file->readString(); + CHose::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/hose_end.h b/engines/titanic/carry/hose_end.h new file mode 100644 index 0000000000..836c94456a --- /dev/null +++ b/engines/titanic/carry/hose_end.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_HOSE_END_H +#define TITANIC_HOSE_END_H + +#include "titanic/carry/hose.h" + +namespace Titanic { + +class CHoseEnd : public CHose { + DECLARE_MESSAGE_MAP; +public: + CLASSDEF; + CHoseEnd(); + + /** + * 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_HOSE_END_H */ diff --git a/engines/titanic/carry/key.cpp b/engines/titanic/carry/key.cpp new file mode 100644 index 0000000000..187ff1b6c3 --- /dev/null +++ b/engines/titanic/carry/key.cpp @@ -0,0 +1,60 @@ +/* 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/carry/key.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CKey, CCarry) + ON_MESSAGE(PuzzleSolvedMsg) + ON_MESSAGE(UseWithOtherMsg) +END_MESSAGE_MAP() + +CKey::CKey() : CCarry() { +} + +void CKey::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CCarry::save(file, indent); +} + +void CKey::load(SimpleFile *file) { + file->readNumber(); + CCarry::load(file); +} + +bool CKey::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) { + _fieldE0 = 1; + setVisible(true); + return true; +} + +bool CKey::UseWithOtherMsg(CUseWithOtherMsg *msg) { + if (msg->_other->getName() == "1stClassPhono") { + CActMsg actMsg("Unlock"); + actMsg.execute(msg->_other); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/key.h b/engines/titanic/carry/key.h new file mode 100644 index 0000000000..9d3957937c --- /dev/null +++ b/engines/titanic/carry/key.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_KEY_H +#define TITANIC_KEY_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CKey : public CCarry { + DECLARE_MESSAGE_MAP; + bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg); + bool UseWithOtherMsg(CUseWithOtherMsg *msg); +public: + CLASSDEF; + CKey(); + + /** + * 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_KEY_H */ diff --git a/engines/titanic/carry/liftbot_head.cpp b/engines/titanic/carry/liftbot_head.cpp new file mode 100644 index 0000000000..5f516fcf8c --- /dev/null +++ b/engines/titanic/carry/liftbot_head.cpp @@ -0,0 +1,103 @@ +/* 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/carry/liftbot_head.h" +#include "titanic/game/transport/lift.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CLiftbotHead, CCarry) + ON_MESSAGE(UseWithOtherMsg) + ON_MESSAGE(UseWithCharMsg) + ON_MESSAGE(MouseDragStartMsg) +END_MESSAGE_MAP() + +CLiftbotHead::CLiftbotHead() : CCarry(), _flag(false) { +} + +void CLiftbotHead::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_flag, indent); + CCarry::save(file, indent); +} + +void CLiftbotHead::load(SimpleFile *file) { + file->readNumber(); + _flag = file->readNumber(); + CCarry::load(file); +} + +bool CLiftbotHead::UseWithOtherMsg(CUseWithOtherMsg *msg) { + if (msg->_other->getName() == "LiftbotWithoutHead") { + CPetControl *pet = getPetControl(); + if (CLift::_v1 == 1 && pet->getRoomsElevatorNum() == 4) { + _flag = true; + CActMsg actMsg("AddRightHead"); + actMsg.execute("FaultyLiftbot"); + setVisible(false); + } + + return true; + } else { + return CCarry::UseWithOtherMsg(msg); + } +} + +bool CLiftbotHead::UseWithCharMsg(CUseWithCharMsg *msg) { + CLift *lift = dynamic_cast<CLift *>(msg->_character); + if (lift) { + CPetControl *pet = getPetControl(); + if (lift->isEquals("Well") && !CLift::_v1 && pet->getRoomsElevatorNum() == 4) { + _flag = true; + CActMsg actMsg("AddRightHead"); + actMsg.execute(lift); + setVisible(false); + + return true; + } + } + + return CCarry::UseWithCharMsg(msg); +} + +bool CLiftbotHead::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (!checkStartDragging(msg)) { + return false; + } else if (compareViewNameTo("BottomOfWell.Node 8.N")) { + changeView("BottomOfWell.Node 13.N"); + moveToView(); + + CActMsg actMsg("LiftbotHeadTaken"); + actMsg.execute("BOWLiftbotHeadMonitor"); + + return CCarry::MouseDragStartMsg(msg); + } else if (_flag) { + _flag = false; + CActMsg actMsg("LoseHead"); + actMsg.execute("FaultyLiftbot"); + } + + return CCarry::MouseDragStartMsg(msg); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/liftbot_head.h b/engines/titanic/carry/liftbot_head.h new file mode 100644 index 0000000000..44cc51c993 --- /dev/null +++ b/engines/titanic/carry/liftbot_head.h @@ -0,0 +1,54 @@ +/* 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_LIFTBOT_HEAD_H +#define TITANIC_LIFTBOT_HEAD_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CLiftbotHead : public CCarry { + DECLARE_MESSAGE_MAP; + bool UseWithOtherMsg(CUseWithOtherMsg *msg); + bool UseWithCharMsg(CUseWithCharMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); +private: + bool _flag; +public: + CLASSDEF; + CLiftbotHead(); + + /** + * 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_LIFTBOT_HEAD_H */ diff --git a/engines/titanic/carry/long_stick.cpp b/engines/titanic/carry/long_stick.cpp new file mode 100644 index 0000000000..557b75ab87 --- /dev/null +++ b/engines/titanic/carry/long_stick.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/carry/long_stick.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CLongStick, CCarry) + ON_MESSAGE(UseWithOtherMsg) + ON_MESSAGE(PuzzleSolvedMsg) + ON_MESSAGE(LeaveViewMsg) +END_MESSAGE_MAP() + +CLongStick::CLongStick() : CCarry() { +} + +void CLongStick::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CCarry::save(file, indent); +} + +void CLongStick::load(SimpleFile *file) { + file->readNumber(); + CCarry::load(file); +} + +bool CLongStick::UseWithOtherMsg(CUseWithOtherMsg *msg) { + if (msg->_other->isEquals("SpeechCentre")) { + CPuzzleSolvedMsg puzzleMsg; + puzzleMsg.execute(msg->_other); + } else if (msg->_other->isEquals("LongStickDispensor")) { + petDisplayMessage(1, "You already have one."); + } else if (msg->_other->isEquals("Bomb")) { + CActMsg actMsg("Hit"); + actMsg.execute("Bomb"); + } else { + return CCarry::UseWithOtherMsg(msg); + } + + return true; +} + +bool CLongStick::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) { + _fieldE0 = 1; + return true; +} + +bool CLongStick::LeaveViewMsg(CLeaveViewMsg *msg) { + setVisible(false); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/long_stick.h b/engines/titanic/carry/long_stick.h new file mode 100644 index 0000000000..329ca838f9 --- /dev/null +++ b/engines/titanic/carry/long_stick.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_LONG_STICK_H +#define TITANIC_LONG_STICK_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CLongStick : public CCarry { + DECLARE_MESSAGE_MAP; + bool UseWithOtherMsg(CUseWithOtherMsg *msg); + bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); +public: + CLASSDEF; + CLongStick(); + + /** + * 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_LONG_STICK_H */ diff --git a/engines/titanic/carry/magazine.cpp b/engines/titanic/carry/magazine.cpp new file mode 100644 index 0000000000..cdf92fc707 --- /dev/null +++ b/engines/titanic/carry/magazine.cpp @@ -0,0 +1,93 @@ +/* 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/carry/magazine.h" +#include "titanic/npcs/deskbot.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CMagazine, CCarry) + ON_MESSAGE(UseWithCharMsg) + ON_MESSAGE(MouseDoubleClickMsg) + ON_MESSAGE(VisibleMsg) + ON_MESSAGE(UseWithOtherMsg) +END_MESSAGE_MAP() + +CMagazine::CMagazine() : CCarry() { +} + +void CMagazine::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field12C, indent); + file->writeNumberLine(_field130, indent); + + CCarry::save(file, indent); +} + +void CMagazine::load(SimpleFile *file) { + file->readNumber(); + _field12C = file->readNumber(); + _field130 = file->readNumber(); + + CCarry::load(file); +} + +bool CMagazine::UseWithCharMsg(CUseWithCharMsg *msg) { + CDeskbot *deskbot = static_cast<CDeskbot *>(msg->_character); + if (deskbot) { + if (deskbot->_deskbotActive) { + setVisible(false); + setPosition(Point(1000, 1000)); + CActMsg actMsg("2ndClassUpgrade"); + actMsg.execute("Deskbot"); + } + + return true; + } else { + return CCarry::UseWithCharMsg(msg); + } +} + +bool CMagazine::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { + return true; +} + +bool CMagazine::VisibleMsg(CVisibleMsg *msg) { + setVisible(msg->_visible); + return true; +} + +bool CMagazine::UseWithOtherMsg(CUseWithOtherMsg *msg) { + if (msg->_other->getName() == "SwitchOnDeskbot") { + // TODO: other _field108 if + if (false) { + setVisible(false); + setPosition(Point(1000, 1000)); + CActMsg actMsg("2ndClassUpgrade"); + actMsg.execute("Deskbot"); + } + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/magazine.h b/engines/titanic/carry/magazine.h new file mode 100644 index 0000000000..d1db4689ba --- /dev/null +++ b/engines/titanic/carry/magazine.h @@ -0,0 +1,58 @@ +/* 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_MAGAZINE_H +#define TITANIC_MAGAZINE_H + +#include "titanic/carry/carry.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" + +namespace Titanic { + +class CMagazine : public CCarry { + DECLARE_MESSAGE_MAP; + bool UseWithCharMsg(CUseWithCharMsg *msg); + bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg); + bool VisibleMsg(CVisibleMsg *msg); + bool UseWithOtherMsg(CUseWithOtherMsg *msg); +private: + int _field12C; + int _field130; +public: + CLASSDEF; + CMagazine(); + + /** + * 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_MAGAZINE_H */ diff --git a/engines/titanic/carry/maitred_left_arm.cpp b/engines/titanic/carry/maitred_left_arm.cpp new file mode 100644 index 0000000000..0962f232bd --- /dev/null +++ b/engines/titanic/carry/maitred_left_arm.cpp @@ -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. + * + */ + +#include "titanic/carry/maitred_left_arm.h" +#include "titanic/npcs/true_talk_npc.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CMaitreDLeftArm, CArm) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MouseDragStartMsg) +END_MESSAGE_MAP() + +void CMaitreDLeftArm::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_flag, indent); + CArm::save(file, indent); +} + +void CMaitreDLeftArm::load(SimpleFile *file) { + file->readNumber(); + _flag = file->readNumber(); + CArm::load(file); +} + +bool CMaitreDLeftArm::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (!_flag) { + CTrueTalkNPC *maitreD = dynamic_cast<CTrueTalkNPC *>(findRoomObject("MaitreD")); + startTalking(maitreD, 126); + startTalking(maitreD, 127); + } + + return true; +} + +bool CMaitreDLeftArm::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (checkPoint(msg->_mousePos) && !_flag) { + CVisibleMsg visibleMsg; + visibleMsg.execute("MD left arm background image"); + _flag = true; + + CArmPickedUpFromTableMsg takenMsg; + takenMsg.execute("Restaurant Table Pan Handler", nullptr, MSGFLAG_SCAN); + } + + return CArm::MouseDragStartMsg(msg); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/maitred_left_arm.h b/engines/titanic/carry/maitred_left_arm.h new file mode 100644 index 0000000000..0e1732df46 --- /dev/null +++ b/engines/titanic/carry/maitred_left_arm.h @@ -0,0 +1,53 @@ +/* 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_LEFT_ARM_H +#define TITANIC_LEFT_ARM_H + +#include "titanic/carry/arm.h" + +namespace Titanic { + +class CMaitreDLeftArm : public CArm { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); +private: + bool _flag; +public: + CLASSDEF; + CMaitreDLeftArm() : CArm(), _flag(false) {} + + /** + * 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_LEFT_ARM_H */ diff --git a/engines/titanic/carry/maitred_right_arm.cpp b/engines/titanic/carry/maitred_right_arm.cpp new file mode 100644 index 0000000000..5cec6be9bd --- /dev/null +++ b/engines/titanic/carry/maitred_right_arm.cpp @@ -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. + * + */ + +#include "titanic/carry/maitred_right_arm.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CMaitreDRightArm, CArm) + ON_MESSAGE(DropZoneLostObjectMsg) +END_MESSAGE_MAP() + +void CMaitreDRightArm::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CArm::save(file, indent); +} + +void CMaitreDRightArm::load(SimpleFile *file) { + file->readNumber(); + CArm::load(file); +} + +bool CMaitreDRightArm::DropZoneLostObjectMsg(CDropZoneLostObjectMsg *msg) { + CActMsg actMsg("LoseArm"); + actMsg.execute("MaitreDBody"); + actMsg.execute("MaitreD Arm Holder"); + _fieldE0 = 1; + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/maitred_right_arm.h b/engines/titanic/carry/maitred_right_arm.h new file mode 100644 index 0000000000..4a53d45f69 --- /dev/null +++ b/engines/titanic/carry/maitred_right_arm.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_MAITRED_RIGHT_ARM_H +#define TITANIC_MAITRED_RIGHT_ARM_H + +#include "titanic/carry/arm.h" + +namespace Titanic { + +class CMaitreDRightArm : public CArm { + DECLARE_MESSAGE_MAP; + bool DropZoneLostObjectMsg(CDropZoneLostObjectMsg *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_MAITRED_RIGHT_ARM_H */ diff --git a/engines/titanic/carry/mouth.cpp b/engines/titanic/carry/mouth.cpp new file mode 100644 index 0000000000..e48929a391 --- /dev/null +++ b/engines/titanic/carry/mouth.cpp @@ -0,0 +1,80 @@ +/* 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/carry/mouth.h" +#include "titanic/game/head_slot.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CMouth, CHeadPiece) + ON_MESSAGE(UseWithOtherMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(PETGainedObjectMsg) +END_MESSAGE_MAP() + +CMouth::CMouth() : CHeadPiece() { +} + +void CMouth::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CHeadPiece::save(file, indent); +} + +void CMouth::load(SimpleFile *file) { + file->readNumber(); + CHeadPiece::load(file); +} + +bool CMouth::UseWithOtherMsg(CUseWithOtherMsg *msg) { + CHeadSlot *slot = dynamic_cast<CHeadSlot *>(msg->_other); + if (!slot) + return CHeadPiece::UseWithOtherMsg(msg); + + _flag = true; + setVisible(false); + setPosition(Point(0, 0)); + petMoveToHiddenRoom(); + + CAddHeadPieceMsg addMsg(getName()); + if (addMsg._value != "NULL") + addMsg.execute("MouthSlot"); + + return true; +} + +bool CMouth::MovieEndMsg(CMovieEndMsg *msg) { + return true; +} + +bool CMouth::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { + _visibleFrame = 2; + loadFrame(2); + setVisible(true); + if (!_field13C) { + stateInc38(); + _field13C = true; + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/mouth.h b/engines/titanic/carry/mouth.h new file mode 100644 index 0000000000..f5f0f53b45 --- /dev/null +++ b/engines/titanic/carry/mouth.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_MOUTH_H +#define TITANIC_MOUTH_H + +#include "titanic/carry/head_piece.h" + +namespace Titanic { + +class CMouth : public CHeadPiece { + DECLARE_MESSAGE_MAP; + bool UseWithOtherMsg(CUseWithOtherMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool PETGainedObjectMsg(CPETGainedObjectMsg *msg); +public: + CLASSDEF; + CMouth(); + + /** + * 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_MOUTH_H */ diff --git a/engines/titanic/carry/napkin.cpp b/engines/titanic/carry/napkin.cpp new file mode 100644 index 0000000000..d25e8b5975 --- /dev/null +++ b/engines/titanic/carry/napkin.cpp @@ -0,0 +1,60 @@ +/* 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/carry/napkin.h" +#include "titanic/carry/chicken.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CNapkin, CCarry) + ON_MESSAGE(UseWithOtherMsg) +END_MESSAGE_MAP() + +CNapkin::CNapkin() : CCarry() { +} + +void CNapkin::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CCarry::save(file, indent); +} + +void CNapkin::load(SimpleFile *file) { + file->readNumber(); + CCarry::load(file); +} + +bool CNapkin::UseWithOtherMsg(CUseWithOtherMsg *msg) { + CChicken *chicken = static_cast<CChicken *>(msg->_other); + if (chicken) { + if (chicken->_string6 == "None" || chicken->_field12C) { + CActMsg actMsg("Clean"); + actMsg.execute("Chicken"); + } else { + petDisplayMessage("The Chicken is already quite clean enough, thank you."); + } + } + + petAddToInventory(); + return CCarry::UseWithOtherMsg(msg); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/napkin.h b/engines/titanic/carry/napkin.h new file mode 100644 index 0000000000..ce47dd6059 --- /dev/null +++ b/engines/titanic/carry/napkin.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_NAPKIN_H +#define TITANIC_NAPKIN_H + +#include "titanic/carry/carry.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CNapkin : public CCarry { + DECLARE_MESSAGE_MAP; + bool UseWithOtherMsg(CUseWithOtherMsg *msg); +public: + CLASSDEF; + CNapkin(); + + /** + * 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_NAPKIN_H */ diff --git a/engines/titanic/carry/nose.cpp b/engines/titanic/carry/nose.cpp new file mode 100644 index 0000000000..a08d02a88c --- /dev/null +++ b/engines/titanic/carry/nose.cpp @@ -0,0 +1,65 @@ +/* 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/carry/nose.h" +#include "titanic/game/head_slot.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CNose, CHeadPiece) + ON_MESSAGE(ChangeSeasonMsg) + ON_MESSAGE(UseWithOtherMsg) +END_MESSAGE_MAP() + +CNose::CNose() : CHeadPiece() { +} + +void CNose::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CHeadPiece::save(file, indent); +} + +void CNose::load(SimpleFile *file) { + file->readNumber(); + CHeadPiece::load(file); +} + +bool CNose::ChangeSeasonMsg(CChangeSeasonMsg *msg) { + // WORKAROUND: Redundant code in original skipped + return true; +} + +bool CNose::UseWithOtherMsg(CUseWithOtherMsg *msg) { + CHeadSlot *slot = dynamic_cast<CHeadSlot *>(msg->_other); + if (!slot) + return CCarry::UseWithOtherMsg(msg); + + petMoveToHiddenRoom(); + _flag = false; + CAddHeadPieceMsg addMsg(getName()); + if (addMsg._value != "NULL") + addMsg.execute("NoseSlot"); + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/nose.h b/engines/titanic/carry/nose.h new file mode 100644 index 0000000000..6e5be30df2 --- /dev/null +++ b/engines/titanic/carry/nose.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_NOSE_H +#define TITANIC_NOSE_H + +#include "titanic/carry/head_piece.h" + +namespace Titanic { + +class CNose : public CHeadPiece { + DECLARE_MESSAGE_MAP; + bool ChangeSeasonMsg(CChangeSeasonMsg *msg); + bool UseWithOtherMsg(CUseWithOtherMsg *msg); +public: + CLASSDEF; + CNose(); + + /** + * 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_NOSE_H */ diff --git a/engines/titanic/carry/note.cpp b/engines/titanic/carry/note.cpp new file mode 100644 index 0000000000..388f87e638 --- /dev/null +++ b/engines/titanic/carry/note.cpp @@ -0,0 +1,54 @@ +/* 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/carry/note.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CNote, CCarry) + ON_MESSAGE(MouseDoubleClickMsg) +END_MESSAGE_MAP() + +CNote::CNote() : CCarry(), _field138(1) { +} + +void CNote::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string6, indent); + file->writeNumberLine(_field138, indent); + + CCarry::save(file, indent); +} + +void CNote::load(SimpleFile *file) { + file->readNumber(); + _string6 = file->readString(); + _field138 = file->readNumber(); + + CCarry::load(file); +} + +bool CNote::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/note.h b/engines/titanic/carry/note.h new file mode 100644 index 0000000000..37ebf96d72 --- /dev/null +++ b/engines/titanic/carry/note.h @@ -0,0 +1,54 @@ +/* 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_NOTE_H +#define TITANIC_NOTE_H + +#include "titanic/carry/carry.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CNote : public CCarry { + DECLARE_MESSAGE_MAP; + bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg); +private: + CString _string6; + int _field138; +public: + CLASSDEF; + CNote(); + + /** + * 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_NOTE_H */ diff --git a/engines/titanic/carry/parcel.cpp b/engines/titanic/carry/parcel.cpp new file mode 100644 index 0000000000..2ffe8b0aac --- /dev/null +++ b/engines/titanic/carry/parcel.cpp @@ -0,0 +1,42 @@ +/* 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/carry/parcel.h" + +namespace Titanic { + +EMPTY_MESSAGE_MAP(CParcel, CCarry); + +CParcel::CParcel() : CCarry() { +} + +void CParcel::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CCarry::save(file, indent); +} + +void CParcel::load(SimpleFile *file) { + file->readNumber(); + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/parcel.h b/engines/titanic/carry/parcel.h new file mode 100644 index 0000000000..f33c2ff65a --- /dev/null +++ b/engines/titanic/carry/parcel.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_PARCEL_H +#define TITANIC_PARCEL_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CParcel : public CCarry { + DECLARE_MESSAGE_MAP; +public: + CLASSDEF; + CParcel(); + + /** + * 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_PARCEL_H */ diff --git a/engines/titanic/carry/perch.cpp b/engines/titanic/carry/perch.cpp new file mode 100644 index 0000000000..4f0e76bdb0 --- /dev/null +++ b/engines/titanic/carry/perch.cpp @@ -0,0 +1,50 @@ +/* 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/carry/perch.h" + +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); +} + +void CPerch::load(SimpleFile *file) { + file->readNumber(); + 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 new file mode 100644 index 0000000000..8941c8ea4d --- /dev/null +++ b/engines/titanic/carry/perch.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_PERCH_H +#define TITANIC_PERCH_H + +#include "titanic/carry/central_core.h" + +namespace Titanic { + +class CPerch : public CCentralCore { + DECLARE_MESSAGE_MAP; + bool UseWithOtherMsg(CUseWithOtherMsg *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_PERCH_H */ diff --git a/engines/titanic/carry/phonograph_cylinder.cpp b/engines/titanic/carry/phonograph_cylinder.cpp new file mode 100644 index 0000000000..41df050d2b --- /dev/null +++ b/engines/titanic/carry/phonograph_cylinder.cpp @@ -0,0 +1,202 @@ +/* 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/carry/phonograph_cylinder.h" +#include "titanic/game/phonograph.h" +#include "titanic/sound/music_room.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPhonographCylinder, CCarry) + ON_MESSAGE(UseWithOtherMsg) + ON_MESSAGE(QueryCylinderMsg) + ON_MESSAGE(RecordOntoCylinderMsg) + ON_MESSAGE(SetMusicControlsMsg) + ON_MESSAGE(ErasePhonographCylinderMsg) +END_MESSAGE_MAP() + +CPhonographCylinder::CPhonographCylinder() : CCarry(), + _bellsMuteControl(false), _bellsPitchControl(false), + _bellsSpeedControl(false), _bellsDirectionControl(false), + _bellsInversionControl(false), _snakeMuteControl(false), + _snakeSpeedControl(false), _snakePitchControl(false), + _snakeInversionControl(false), _snakeDirectionControl(false), + _pianoMuteControl(false), _pianoSpeedControl(false), + _pianoPitchControl(false), _pianoInversionControl(false), + _pianoDirectionControl(false), _bassMuteControl(false), + _bassSpeedControl(false), _bassPitchControl(false), + _bassInversionControl(false) { +} + +void CPhonographCylinder::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_itemName, indent); + file->writeNumberLine(_bellsMuteControl, indent); + file->writeNumberLine(_bellsPitchControl, indent); + file->writeNumberLine(_bellsSpeedControl, indent); + file->writeNumberLine(_bellsDirectionControl, indent); + file->writeNumberLine(_bellsInversionControl, indent); + file->writeNumberLine(_snakeMuteControl, indent); + file->writeNumberLine(_snakeSpeedControl, indent); + file->writeNumberLine(_snakePitchControl, indent); + file->writeNumberLine(_snakeInversionControl, indent); + file->writeNumberLine(_snakeDirectionControl, indent); + file->writeNumberLine(_pianoMuteControl, indent); + file->writeNumberLine(_pianoSpeedControl, indent); + file->writeNumberLine(_pianoPitchControl, indent); + file->writeNumberLine(_pianoInversionControl, indent); + file->writeNumberLine(_pianoDirectionControl, indent); + file->writeNumberLine(_bassMuteControl, indent); + file->writeNumberLine(_bassSpeedControl, indent); + file->writeNumberLine(_bassPitchControl, indent); + file->writeNumberLine(_bassInversionControl, indent); + file->writeNumberLine(_bassDirectionControl, indent); + + CCarry::save(file, indent); +} + +void CPhonographCylinder::load(SimpleFile *file) { + file->readNumber(); + _itemName = file->readString(); + _bellsMuteControl = file->readNumber(); + _bellsPitchControl = file->readNumber(); + _bellsSpeedControl = file->readNumber(); + _bellsDirectionControl = file->readNumber(); + _bellsInversionControl = file->readNumber(); + _snakeMuteControl = file->readNumber(); + _snakeSpeedControl = file->readNumber(); + _snakePitchControl = file->readNumber(); + _snakeInversionControl = file->readNumber(); + _snakeDirectionControl = file->readNumber(); + _pianoMuteControl = file->readNumber(); + _pianoSpeedControl = file->readNumber(); + _pianoPitchControl = file->readNumber(); + _pianoInversionControl = file->readNumber(); + _pianoDirectionControl = file->readNumber(); + _bassMuteControl = file->readNumber(); + _bassSpeedControl = file->readNumber(); + _bassPitchControl = file->readNumber(); + _bassInversionControl = file->readNumber(); + _bassDirectionControl = file->readNumber(); + + CCarry::load(file); +} + +bool CPhonographCylinder::UseWithOtherMsg(CUseWithOtherMsg *msg) { + CPhonograph *phonograph = static_cast<CPhonograph *>(msg->_other); + if (phonograph) { + CSetVarMsg varMsg("m_RecordStatus", 1); + return true; + } else { + return CCarry::UseWithOtherMsg(msg); + } +} + +bool CPhonographCylinder::QueryCylinderMsg(CQueryCylinderMsg *msg) { + msg->_name = _itemName; + return true; +} + +bool CPhonographCylinder::RecordOntoCylinderMsg(CRecordOntoCylinderMsg *msg) { + _itemName = "STMusic"; + + CQueryMusicControlSettingMsg queryMsg; + queryMsg.execute("Bells Mute Control"); + _bellsMuteControl = queryMsg._value; + queryMsg.execute("Bells Pitch Control"); + _bellsPitchControl = queryMsg._value; + queryMsg.execute("Bells Speed Control"); + _bellsSpeedControl = queryMsg._value; + queryMsg.execute("Bells Direction Control"); + _bellsDirectionControl = queryMsg._value; + queryMsg.execute("Bells Inversion Control"); + _bellsInversionControl = queryMsg._value; + queryMsg.execute("Snake Mute Control"); + _snakeMuteControl = queryMsg._value; + queryMsg.execute("Snake Speed Control"); + _snakeSpeedControl = queryMsg._value; + queryMsg.execute("Snake Pitch Control"); + _snakePitchControl = queryMsg._value; + queryMsg.execute("Snake Inversion Control"); + _snakeInversionControl = queryMsg._value; + queryMsg.execute("Snake Direction Control"); + _snakeDirectionControl = queryMsg._value; + queryMsg.execute("Piano Mute Control"); + _pianoMuteControl = queryMsg._value; + queryMsg.execute("Piano Speed Control"); + _pianoSpeedControl = queryMsg._value; + queryMsg.execute("Piano Pitch Control"); + _pianoPitchControl = queryMsg._value; + queryMsg.execute("Piano Inversion Control"); + _pianoInversionControl = queryMsg._value; + queryMsg.execute("Piano Direction Control"); + _pianoDirectionControl = queryMsg._value; + queryMsg.execute("Bass Mute Control"); + _bassMuteControl = queryMsg._value; + queryMsg.execute("Bass Speed Control"); + _bassSpeedControl = queryMsg._value; + queryMsg.execute("Bass Pitch Control"); + _bassPitchControl = queryMsg._value; + queryMsg.execute("Bass Inversion Control"); + _bassInversionControl = queryMsg._value; + + return true; +} + +bool CPhonographCylinder::SetMusicControlsMsg(CSetMusicControlsMsg *msg) { + if (!_itemName.hasPrefix("STMusic")) + return true; + + CMusicRoom *musicRoom = getMusicRoom(); + musicRoom->setItem5(BELLS, _bellsMuteControl); + musicRoom->setItem2(BELLS, _bellsPitchControl); + musicRoom->setItem1(BELLS, _bellsSpeedControl); + musicRoom->setItem4(BELLS, _bellsInversionControl); + musicRoom->setItem3(BELLS, _bellsDirectionControl); + + musicRoom->setItem5(SNAKE, _snakeMuteControl); + musicRoom->setItem2(SNAKE, _snakePitchControl); + musicRoom->setItem1(SNAKE, _snakeSpeedControl); + musicRoom->setItem4(SNAKE, _snakeInversionControl); + musicRoom->setItem3(SNAKE, _snakeDirectionControl); + + musicRoom->setItem5(PIANO, _pianoMuteControl); + musicRoom->setItem2(PIANO, _pianoPitchControl); + musicRoom->setItem1(PIANO, _pianoSpeedControl); + musicRoom->setItem4(PIANO, _pianoInversionControl); + musicRoom->setItem3(PIANO, _pianoDirectionControl); + + musicRoom->setItem5(BASS, _bassMuteControl); + musicRoom->setItem2(BASS, _bassPitchControl); + musicRoom->setItem1(BASS, _bassSpeedControl); + musicRoom->setItem4(BASS, _bassInversionControl); + musicRoom->setItem3(BASS, _bassDirectionControl); + + return true; +} + +bool CPhonographCylinder::ErasePhonographCylinderMsg(CErasePhonographCylinderMsg *msg) { + _itemName.clear(); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/phonograph_cylinder.h b/engines/titanic/carry/phonograph_cylinder.h new file mode 100644 index 0000000000..bbb1524cb5 --- /dev/null +++ b/engines/titanic/carry/phonograph_cylinder.h @@ -0,0 +1,76 @@ +/* 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_PHONOGRAPH_CYLINDER_H +#define TITANIC_PHONOGRAPH_CYLINDER_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CPhonographCylinder : public CCarry { + DECLARE_MESSAGE_MAP; + bool UseWithOtherMsg(CUseWithOtherMsg *msg); + bool QueryCylinderMsg(CQueryCylinderMsg *msg); + bool RecordOntoCylinderMsg(CRecordOntoCylinderMsg *msg); + bool SetMusicControlsMsg(CSetMusicControlsMsg *msg); + bool ErasePhonographCylinderMsg(CErasePhonographCylinderMsg *msg); +private: + CString _itemName; + bool _bellsMuteControl; + bool _bellsPitchControl; + bool _bellsSpeedControl; + bool _bellsDirectionControl; + bool _bellsInversionControl; + bool _snakeMuteControl; + bool _snakeSpeedControl; + bool _snakePitchControl; + bool _snakeInversionControl; + bool _snakeDirectionControl; + bool _pianoMuteControl; + bool _pianoSpeedControl; + bool _pianoPitchControl; + bool _pianoInversionControl; + bool _pianoDirectionControl; + bool _bassMuteControl; + bool _bassSpeedControl; + bool _bassPitchControl; + bool _bassInversionControl; + bool _bassDirectionControl; +public: + CLASSDEF; + CPhonographCylinder(); + + /** + * 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_PHONOGRAPH_CYLINDER_H */ diff --git a/engines/titanic/carry/phonograph_ear.cpp b/engines/titanic/carry/phonograph_ear.cpp new file mode 100644 index 0000000000..95297a77a1 --- /dev/null +++ b/engines/titanic/carry/phonograph_ear.cpp @@ -0,0 +1,65 @@ +/* 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/carry/phonograph_ear.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPhonographEar, CEar) + ON_MESSAGE(CorrectMusicPlayedMsg) + ON_MESSAGE(PETGainedObjectMsg) + ON_MESSAGE(TimerMsg) +END_MESSAGE_MAP() + +void CPhonographEar::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field140, indent); + CEar::save(file, indent); +} + +void CPhonographEar::load(SimpleFile *file) { + file->readNumber(); + _field140 = file->readNumber(); + CEar::load(file); +} + +bool CPhonographEar::CorrectMusicPlayedMsg(CCorrectMusicPlayedMsg *msg) { + _fieldE0 = true; + return true; +} + +bool CPhonographEar::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { + if (_field140) { + _field140 = false; + addTimer(1000); + } + + return CEar::PETGainedObjectMsg(msg); +} + +bool CPhonographEar::TimerMsg(CTimerMsg *msg) { + CVisibleMsg visibleMsg; + visibleMsg.execute("Replacement Phonograph Ear"); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/phonograph_ear.h b/engines/titanic/carry/phonograph_ear.h new file mode 100644 index 0000000000..b5db015f90 --- /dev/null +++ b/engines/titanic/carry/phonograph_ear.h @@ -0,0 +1,54 @@ +/* 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_PHONOGRAPH_EAR_H +#define TITANIC_PHONOGRAPH_EAR_H + +#include "titanic/carry/ear.h" + +namespace Titanic { + +class CPhonographEar : public CEar { + DECLARE_MESSAGE_MAP; + bool CorrectMusicPlayedMsg(CCorrectMusicPlayedMsg *msg); + bool PETGainedObjectMsg(CPETGainedObjectMsg *msg); + bool TimerMsg(CTimerMsg *msg); +private: + bool _field140; +public: + CLASSDEF; + CPhonographEar() : CEar(), _field140(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_PHONOGRAPH_EYE_H */ diff --git a/engines/titanic/carry/photograph.cpp b/engines/titanic/carry/photograph.cpp new file mode 100644 index 0000000000..039efd0252 --- /dev/null +++ b/engines/titanic/carry/photograph.cpp @@ -0,0 +1,103 @@ +/* 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/carry/photograph.h" +#include "titanic/core/dont_save_file_item.h" +#include "titanic/core/room_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPhotograph, CCarry) + ON_MESSAGE(MouseDragStartMsg) + ON_MESSAGE(MouseDragEndMsg) + ON_MESSAGE(PETGainedObjectMsg) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + +int CPhotograph::_v1; + +CPhotograph::CPhotograph() : CCarry(), _field12C(0), _field130(0) { +} + +void CPhotograph::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field12C, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_field130, indent); + + CCarry::save(file, indent); +} + +void CPhotograph::load(SimpleFile *file) { + file->readNumber(); + _field12C = file->readNumber(); + _v1 = file->readNumber(); + _field130 = file->readNumber(); + + CCarry::load(file); +} + +bool CPhotograph::MouseDragEndMsg(CMouseDragEndMsg *msg) { + _v1 = 0; + CGameObject *target = msg->_dropTarget; + + if (target && target->isEquals("NavigationComputer")) { + moveUnder(getDontSave()); + makeDirty(); + playSound("a#46.wav"); + starFn1(14); + showMouse(); + return true; + } else { + return CCarry::MouseDragEndMsg(msg); + } +} + +bool CPhotograph::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (checkPoint(msg->_mousePos, true, true)) { + _v1 = true; + CActMsg actMsg("PlayerPicksUpPhoto"); + actMsg.execute("Doorbot"); + } + + return CCarry::MouseDragStartMsg(msg); +} + +bool CPhotograph::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { + if (getRoom()->isEquals("Home")) { + CActMsg actMsg("PlayerPutsPhotoInPET"); + actMsg.execute("Doorbot"); + } + + return true; +} + +bool CPhotograph::ActMsg(CActMsg *msg) { + if (msg->_action == "BecomeGettable") { + _fieldE0 = 1; + _cursorId = CURSOR_HAND; + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/photograph.h b/engines/titanic/carry/photograph.h new file mode 100644 index 0000000000..9cea1e4799 --- /dev/null +++ b/engines/titanic/carry/photograph.h @@ -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. + * + */ + +#ifndef TITANIC_PHOTOGRAPH_H +#define TITANIC_PHOTOGRAPH_H + +#include "titanic/carry/carry.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" +#include "titanic/messages/pet_messages.h" + +namespace Titanic { + +class CPhotograph : public CCarry { + DECLARE_MESSAGE_MAP; + bool MouseDragEndMsg(CMouseDragEndMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); + bool PETGainedObjectMsg(CPETGainedObjectMsg *msg); + bool ActMsg(CActMsg *msg); +private: + static int _v1; +private: + int _field12C; + int _field130; +public: + CLASSDEF; + CPhotograph(); + + /** + * 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_PHOTOGRAPH_H */ diff --git a/engines/titanic/carry/plug_in.cpp b/engines/titanic/carry/plug_in.cpp new file mode 100644 index 0000000000..883458c9b1 --- /dev/null +++ b/engines/titanic/carry/plug_in.cpp @@ -0,0 +1,62 @@ +/* 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/carry/plug_in.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPlugIn, CCarry) + ON_MESSAGE(UseWithOtherMsg) +END_MESSAGE_MAP() + +CPlugIn::CPlugIn() : CCarry(), _field12C(0) { +} + +void CPlugIn::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CCarry::save(file, indent); +} + +void CPlugIn::load(SimpleFile *file) { + file->readNumber(); + CCarry::load(file); +} + +bool CPlugIn::UseWithOtherMsg(CUseWithOtherMsg *msg) { + CGameObject *other = msg->_other; + CString otherName = other->getName(); + + if (otherName == "PET") { + return CCarry::UseWithOtherMsg(msg); + } else if (isEquals("DatasideTransporter")) { + CShowTextMsg textMsg("This item is incorrectly calibrated."); + textMsg.execute("PET"); + } else if (isEquals("DatasideTransporter")) { + error("TODO: Set msg->_other->fieldC4 = 2"); + } else if (isEquals("SendYourself")) { + error("TODO: Set msg->_other->fieldC8 = 1"); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/plug_in.h b/engines/titanic/carry/plug_in.h new file mode 100644 index 0000000000..1358a99e39 --- /dev/null +++ b/engines/titanic/carry/plug_in.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_PLUG_IN_H +#define TITANIC_PLUG_IN_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CPlugIn : public CCarry { + DECLARE_MESSAGE_MAP; + bool UseWithOtherMsg(CUseWithOtherMsg *msg); +private: + int _field12C; +public: + CLASSDEF; + CPlugIn(); + + /** + * 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_PLUG_IN_H */ diff --git a/engines/titanic/carry/speech_centre.cpp b/engines/titanic/carry/speech_centre.cpp new file mode 100644 index 0000000000..b8076aee76 --- /dev/null +++ b/engines/titanic/carry/speech_centre.cpp @@ -0,0 +1,45 @@ +/* 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/carry/speech_centre.h" + +namespace Titanic { + +void CSpeechCentre::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field13C, indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_field14C, indent); + + CBrain::save(file, indent); +} + +void CSpeechCentre::load(SimpleFile *file) { + file->readNumber(); + _field13C = file->readNumber(); + _string1 = file->readString(); + _field14C = file->readNumber(); + + CBrain::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/speech_centre.h b/engines/titanic/carry/speech_centre.h new file mode 100644 index 0000000000..50f47e9c8a --- /dev/null +++ b/engines/titanic/carry/speech_centre.h @@ -0,0 +1,53 @@ +/* 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_SPEECH_CENTRE_H +#define TITANIC_SPEECH_CENTRE_H + +#include "titanic/carry/brain.h" + +namespace Titanic { + +class CSpeechCentre : public CBrain { +private: + int _field13C; + CString _string1; + int _field14C; +public: + CLASSDEF; + CSpeechCentre() : CBrain(), _string1("Summer"), + _field13C(1), _field14C(0) {} + + /** + * 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_SPEECH_CENTRE_H */ diff --git a/engines/titanic/carry/sweets.cpp b/engines/titanic/carry/sweets.cpp new file mode 100644 index 0000000000..f19a8287b7 --- /dev/null +++ b/engines/titanic/carry/sweets.cpp @@ -0,0 +1,48 @@ +/* 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/carry/sweets.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CSweets, CCarry) + ON_MESSAGE(MouseButtonUpMsg) +END_MESSAGE_MAP() + +CSweets::CSweets() : CCarry() { +} + +void CSweets::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CCarry::save(file, indent); +} + +void CSweets::load(SimpleFile *file) { + file->readNumber(); + CCarry::load(file); +} + +bool CSweets::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/sweets.h b/engines/titanic/carry/sweets.h new file mode 100644 index 0000000000..3655fabfb9 --- /dev/null +++ b/engines/titanic/carry/sweets.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_SWEETS_H +#define TITANIC_SWEETS_H + +#include "titanic/carry/carry.h" +#include "titanic/messages/mouse_messages.h" + +namespace Titanic { + +class CSweets : public CCarry { + DECLARE_MESSAGE_MAP; + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); +public: + CLASSDEF; + CSweets(); + + /** + * 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_SWEETS_H */ diff --git a/engines/titanic/carry/vision_centre.cpp b/engines/titanic/carry/vision_centre.cpp new file mode 100644 index 0000000000..8c8bab15f8 --- /dev/null +++ b/engines/titanic/carry/vision_centre.cpp @@ -0,0 +1,37 @@ +/* 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/carry/vision_centre.h" + +namespace Titanic { + +void CVisionCentre::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CBrain::save(file, indent); +} + +void CVisionCentre::load(SimpleFile *file) { + file->readNumber(); + CBrain::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/vision_centre.h b/engines/titanic/carry/vision_centre.h new file mode 100644 index 0000000000..6cf8e2c653 --- /dev/null +++ b/engines/titanic/carry/vision_centre.h @@ -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. + * + */ + +#ifndef TITANIC_VISION_CENTRE_H +#define TITANIC_VISION_CENTRE_H + +#include "titanic/carry/brain.h" + +namespace Titanic { + +class CVisionCentre : public CBrain { +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_VISION_CENTRE_H */ |