diff options
Diffstat (limited to 'engines/titanic/game')
392 files changed, 27805 insertions, 0 deletions
diff --git a/engines/titanic/game/announce.cpp b/engines/titanic/game/announce.cpp new file mode 100644 index 0000000000..74c126476f --- /dev/null +++ b/engines/titanic/game/announce.cpp @@ -0,0 +1,132 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/announce.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CAnnounce, CGameObject) + ON_MESSAGE(TimerMsg) + ON_MESSAGE(LeaveRoomMsg) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + +CAnnounce::CAnnounce() : _nameIndex(0), _soundHandle(0), _leaveFlag(1), _enabled(false) { +} + +void CAnnounce::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_nameIndex, indent); + file->writeNumberLine(_soundHandle, indent); + file->writeNumberLine(_leaveFlag, indent); + file->writeNumberLine(_enabled, indent); + + CGameObject::save(file, indent); +} + +void CAnnounce::load(SimpleFile *file) { + file->readNumber(); + _nameIndex = file->readNumber(); + _soundHandle = file->readNumber(); + _leaveFlag = file->readNumber(); + _enabled = file->readNumber(); + + CGameObject::load(file); +} + +bool CAnnounce::TimerMsg(CTimerMsg *msg) { + if (!_enabled) + return false; + + if (msg->_timerCtr == 1) { + CString numStr = "0"; + CString waveNames1[20] = { + "z#181.wav", "z#211.wav", "z#203.wav", "z#202.wav", "z#201.wav", + "z#200.wav", "z#199.wav", "z#198.wav", "z#197.wav", "z#196.wav", + "z#210.wav", "z#209.wav", "z#208.wav", "z#207.wav", "z#206.wav", + "z#205.wav", "z#204.wav", "z#145.wav", "", "" + }; + CString waveNames2[37] = { + "z#154.wav", "z#153.wav", "z#152.wav", "z#151.wav", "z#150.wav", + "z#149.wav", "z#148.wav", "z#169.wav", "z#171.wav", "z#178.wav", + "z#176.wav", "z#177.wav", "z#165.wav", "z#170.wav", "z#180.wav", + "z#156.wav", "z#172.wav", "z#173.wav", "z#160.wav", "z#158.wav", + "z#161.wav", "z#179.wav", "z#163.wav", "z#164.wav", "z#162.wav", + "z#159.wav", "z#175.wav", "z#166.wav", "z#174.wav", "z#157.wav", + "", "", "", "", "", "", "" + }; + + int randVal = _nameIndex ? getRandomNumber(2) : 0; + switch (randVal) { + case 0: + case 1: + _soundHandle = playSound("z#189.wav"); + if (_nameIndex < 20) { + queueSound(waveNames1[_nameIndex], _soundHandle); + ++_nameIndex; + } else { + queueSound(waveNames1[1 + getRandomNumber(17)], _soundHandle); + } + break; + + case 2: + _soundHandle = playSound("z#189.wav"); + queueSound(waveNames2[1 + getRandomNumber(35)], _soundHandle); + break; + + default: + break; + } + + addTimer(1, 300000 + getRandomNumber(30000), 0); + if (getRandomNumber(3) == 0) + addTimer(2, 4000, 0); + + } else if (msg->_timerCtr == 2) { + CParrotSpeakMsg speakMsg; + speakMsg._target = "Announcements"; + speakMsg.execute("PerchedParrot"); + } + + return true; +} + +bool CAnnounce::LeaveRoomMsg(CLeaveRoomMsg *msg) { + if (_leaveFlag) { + addTimer(1, 1000, 0); + _leaveFlag = 0; + _enabled = true; + } + + return true; +} + +bool CAnnounce::ActMsg(CActMsg *msg) { + if (msg->_action == "Enable") + _enabled = true; + else if (msg->_action == "Disable") + _enabled = false; + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/announce.h b/engines/titanic/game/announce.h new file mode 100644 index 0000000000..9bf060daae --- /dev/null +++ b/engines/titanic/game/announce.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_ANNOUNCE_H +#define TITANIC_ANNOUNCE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CAnnounce : public CGameObject { + DECLARE_MESSAGE_MAP; + bool TimerMsg(CTimerMsg *msg); + bool LeaveRoomMsg(CLeaveRoomMsg *msg); + bool ActMsg(CActMsg *msg); +private: + int _nameIndex; + int _soundHandle; + bool _leaveFlag; + bool _enabled; +public: + CLASSDEF; + CAnnounce(); + + /** + * 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_ROOM_ITEM_H */ diff --git a/engines/titanic/game/annoy_barbot.cpp b/engines/titanic/game/annoy_barbot.cpp new file mode 100644 index 0000000000..8b22f9c13a --- /dev/null +++ b/engines/titanic/game/annoy_barbot.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/game/annoy_barbot.h" + +namespace Titanic { + +int CAnnoyBarbot::_v1; + +BEGIN_MESSAGE_MAP(CAnnoyBarbot, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) +END_MESSAGE_MAP() + +void CAnnoyBarbot::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + CGameObject::save(file, indent); +} + +void CAnnoyBarbot::load(SimpleFile *file) { + file->readNumber(); + _v1 = file->readNumber(); + CGameObject::load(file); +} + +bool CAnnoyBarbot::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if ((++_v1 % 3) == 1) { + CActMsg actMsg("GoRingBell"); + actMsg.execute("Barbot"); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/annoy_barbot.h b/engines/titanic/game/annoy_barbot.h new file mode 100644 index 0000000000..0ccfe43794 --- /dev/null +++ b/engines/titanic/game/annoy_barbot.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_ANNOY_BARBOT_H +#define TITANIC_ANNOY_BARBOT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CAnnoyBarbot : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); +private: + static int _v1; +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_ANNOY_BARBOT_H */ diff --git a/engines/titanic/game/arb_background.cpp b/engines/titanic/game/arb_background.cpp new file mode 100644 index 0000000000..f71bcf90d1 --- /dev/null +++ b/engines/titanic/game/arb_background.cpp @@ -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. + * + */ + +#include "titanic/game/arb_background.h" + +namespace Titanic { + +EMPTY_MESSAGE_MAP(CArbBackground, CBackground); + +CArbBackground::CArbBackground() : CBackground(), + _fieldE0(0), _fieldE4(61), _fieldE8(62), _fieldEC(118) { +} + +void CArbBackground::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + + CBackground::save(file, indent); +} + +void CArbBackground::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/arb_background.h b/engines/titanic/game/arb_background.h new file mode 100644 index 0000000000..88d4d1bec6 --- /dev/null +++ b/engines/titanic/game/arb_background.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_ARB_BACKGROUND_H +#define TITANIC_ARB_BACKGROUND_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CArbBackground : public CBackground { + DECLARE_MESSAGE_MAP; +public: + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; +public: + CLASSDEF; + CArbBackground(); + + /** + * 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_ARB_BACKGROUND_H */ diff --git a/engines/titanic/game/arboretum_gate.cpp b/engines/titanic/game/arboretum_gate.cpp new file mode 100644 index 0000000000..4c3ca03b7a --- /dev/null +++ b/engines/titanic/game/arboretum_gate.cpp @@ -0,0 +1,331 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/arboretum_gate.h" +#include "titanic/game/seasonal_adjustment.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CArboretumGate, CBackground) + ON_MESSAGE(ChangeSeasonMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(TurnOff) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(TurnOn) +END_MESSAGE_MAP() + +int CArboretumGate::_v1; +int CArboretumGate::_initialFrame; +int CArboretumGate::_v3; + +CArboretumGate::CArboretumGate() : CBackground() { + _viewName1 = "NULL"; + _viewName2 = "NULL"; + _seasonNum = 0; + _fieldF0 = 0; + _winterOffStartFrame = 244; + _winterOffEndFrame = 304; + _springOffStartFrame = 122; + _springOffEndFrame = 182; + _summerOffStartFrame1 = 183; + _summerOffEndFrame1 = 243; + _summerOffStartFrame2 = 665; + _summerOffEndFrame2 = 724; + _autumnOffStartFrame1 = 61; + _autumnOffEndFrame1 = 121; + _autumnOffStartFrame2 = 0; + _autumnOffEndFrame2 = 60; + _winterOnStartFrame = 485; + _winterOnEndFrame = 544; + _springOnStartFrame = 425; + _springOnEndFrame = 484; + _summerOnStartFrame1 = 545; + _summerOnEndFrame1 = 604; + _summerOnStartFrame2 = 605; + _summerOnEndFrame2 = 664; + _autumnOnStartFrame1 = 305; + _autumnOnEndFrame1 = 364; + _autumnOnStartFrame2 = 365; + _autumnOnEndFrame2 = 424; +} + +void CArboretumGate::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_seasonNum, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_initialFrame, indent); + file->writeNumberLine(_v3, indent); + file->writeQuotedLine(_viewName1, indent); + file->writeNumberLine(_fieldF0, indent); + file->writeNumberLine(_winterOffStartFrame, indent); + file->writeNumberLine(_winterOffEndFrame, indent); + file->writeNumberLine(_springOffStartFrame, indent); + file->writeNumberLine(_springOffEndFrame, indent); + file->writeNumberLine(_summerOffStartFrame1, indent); + file->writeNumberLine(_summerOffEndFrame1, indent); + file->writeNumberLine(_summerOffStartFrame2, indent); + file->writeNumberLine(_summerOffEndFrame2, indent); + file->writeNumberLine(_autumnOffStartFrame1, indent); + file->writeNumberLine(_autumnOffEndFrame1, indent); + file->writeNumberLine(_autumnOffStartFrame2, indent); + file->writeNumberLine(_autumnOffEndFrame2, indent); + file->writeNumberLine(_winterOnStartFrame, indent); + file->writeNumberLine(_winterOnEndFrame, indent); + file->writeNumberLine(_springOnStartFrame, indent); + file->writeNumberLine(_springOnEndFrame, indent); + file->writeNumberLine(_summerOnStartFrame1, indent); + file->writeNumberLine(_summerOnEndFrame1, indent); + file->writeNumberLine(_summerOnStartFrame2, indent); + file->writeNumberLine(_summerOnEndFrame2, indent); + file->writeNumberLine(_autumnOnStartFrame1, indent); + file->writeNumberLine(_autumnOnEndFrame1, indent); + file->writeNumberLine(_autumnOnStartFrame2, indent); + file->writeNumberLine(_autumnOnEndFrame2, indent); + file->writeQuotedLine(_viewName2, indent); + + CBackground::save(file, indent); +} + +void CArboretumGate::load(SimpleFile *file) { + file->readNumber(); + _seasonNum = file->readNumber(); + _v1 = file->readNumber(); + _initialFrame = file->readNumber(); + _v3 = file->readNumber(); + _viewName1 = file->readString(); + _fieldF0 = file->readNumber(); + _winterOffStartFrame = file->readNumber(); + _winterOffEndFrame = file->readNumber(); + _springOffStartFrame = file->readNumber(); + _springOffEndFrame = file->readNumber(); + _summerOffStartFrame1 = file->readNumber(); + _summerOffEndFrame1 = file->readNumber(); + _summerOffStartFrame2 = file->readNumber(); + _summerOffEndFrame2 = file->readNumber(); + _autumnOffStartFrame1 = file->readNumber(); + _autumnOffEndFrame1 = file->readNumber(); + _autumnOffStartFrame2 = file->readNumber(); + _autumnOffEndFrame2 = file->readNumber(); + _winterOnStartFrame = file->readNumber(); + _winterOnEndFrame = file->readNumber(); + _springOnStartFrame = file->readNumber(); + _springOnEndFrame = file->readNumber(); + _summerOnStartFrame1 = file->readNumber(); + _summerOnEndFrame1 = file->readNumber(); + _summerOnStartFrame2 = file->readNumber(); + _summerOnEndFrame2 = file->readNumber(); + _autumnOnStartFrame1 = file->readNumber(); + _autumnOnEndFrame1 = file->readNumber(); + _autumnOnStartFrame2 = file->readNumber(); + _autumnOnEndFrame2 = file->readNumber(); + _viewName2 = file->readString(); + + CBackground::load(file); +} + +bool CArboretumGate::ChangeSeasonMsg(CChangeSeasonMsg *msg) { + _seasonNum = (_seasonNum + 1) % 4; + return true; +} + +bool CArboretumGate::ActMsg(CActMsg *msg) { + if (msg->_action == "PlayerGetsSpeechCentre") { + _v1 = 1; + CVisibleMsg visibleMsg(true); + visibleMsg.execute("SpCtrOverlay"); + } else if (msg->_action == "ExitLFrozen") { + if (_v3) { + _viewName2 = "FrozenArboretum.Node 2.W"; + CTurnOn onMsg; + onMsg.execute(this); + } else { + changeView("FrozenArboretum.Node 2.W"); + } + } else if (msg->_action == "ExitRFrozen") { + if (_v3) { + _viewName2 = "FrozenArboretum.Node 2.E"; + CTurnOn onMsg; + onMsg.execute(this); + } else { + changeView("FrozenArboretum.Node 2.E"); + } + } else if (msg->_action == "ExitLNormal") { + if (_v3) { + _viewName2 = "Arboretum.Node 2.W"; + CTurnOn onMsg; + onMsg.execute(this); + } else { + changeView("Arboretum.Node 2.W"); + } + } else if (msg->_action == "ExitRNormal") { + if (_v3) { + _viewName2 = "Arboretum.Node 2.E"; + CTurnOn onMsg; + onMsg.execute(this); + } + else { + changeView("Arboretum.Node 2.E"); + } + } + + return true; +} + +bool CArboretumGate::MovieEndMsg(CMovieEndMsg *msg) { + setVisible(!_v3); + + if (_viewName1 != "NULL") { + changeView(_viewName1); + } else if (_viewName2 != "NULL") { + changeView(_viewName2); + _viewName2 = "NULL"; + } + + return true; +} + +bool CArboretumGate::LeaveViewMsg(CLeaveViewMsg *msg) { + return false; +} + +bool CArboretumGate::TurnOff(CTurnOff *msg) { + if (!_v3) { + switch (_seasonNum) { + case SPRING: + playMovie(_springOffStartFrame, _springOffEndFrame, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + break; + + case SUMMER: + if (_v1) { + playMovie(_summerOffStartFrame2, _summerOffEndFrame2, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + } else { + playMovie(_summerOffStartFrame1, _summerOffEndFrame1, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + } + break; + + case AUTUMN: + if (_v1) { + playMovie(_autumnOffStartFrame2, _autumnOffEndFrame2, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + } else { + playMovie(_autumnOffStartFrame1, _autumnOffEndFrame1, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + } + break; + + case WINTER: + playMovie(_winterOffStartFrame, _winterOffEndFrame, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + break; + + default: + break; + } + + _v3 = 1; + CArboretumGateMsg gateMsg; + gateMsg.execute("Arboretum", nullptr, MSGFLAG_SCAN); + } + + return true; +} + +bool CArboretumGate::TurnOn(CTurnOn *msg) { + if (_v3) { + CArboretumGateMsg gateMsg(0); + gateMsg.execute("Arboretum"); + setVisible(true); + + switch (_seasonNum) { + case SPRING: + playMovie(_springOnStartFrame, _springOnEndFrame, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + break; + + case SUMMER: + if (_v1) { + playMovie(_summerOnStartFrame2, _summerOnEndFrame2, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + } else { + playMovie(_summerOnStartFrame1, _summerOnEndFrame1, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + } + break; + + case AUTUMN: + if (_v1) { + playMovie(_autumnOnStartFrame2, _autumnOnEndFrame2, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + } else { + playMovie(_autumnOnStartFrame1, _autumnOnEndFrame1, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + } + break; + + case WINTER: + playMovie(_winterOnStartFrame, _winterOnEndFrame, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + break; + + default: + break; + } + + _v3 = 0; + } + + return true; +} + +bool CArboretumGate::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (!_v3) { + CTurnOff offMsg; + offMsg.execute(this); + } + + return true; +} + +bool CArboretumGate::EnterViewMsg(CEnterViewMsg *msg) { + if (!_v3) { + switch (_seasonNum) { + case SPRING: + _initialFrame = _springOffStartFrame; + break; + + case SUMMER: + _initialFrame = _v1 ? _summerOffStartFrame2 : _summerOffStartFrame1; + break; + + case AUTUMN: + _initialFrame = _v1 ? _autumnOffStartFrame1 : _autumnOffStartFrame2; + break; + + case WINTER: + _initialFrame = _winterOffStartFrame; + break; + + default: + break; + } + + loadFrame(_initialFrame); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/arboretum_gate.h b/engines/titanic/game/arboretum_gate.h new file mode 100644 index 0000000000..62c9200a64 --- /dev/null +++ b/engines/titanic/game/arboretum_gate.h @@ -0,0 +1,92 @@ +/* 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_ARBORETUM_GATE_H +#define TITANIC_ARBORETUM_GATE_H + +#include "titanic/core/background.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" + +namespace Titanic { + +class CArboretumGate : public CBackground { + DECLARE_MESSAGE_MAP; + bool ChangeSeasonMsg(CChangeSeasonMsg *msg); + bool ActMsg(CActMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool TurnOff(CTurnOff *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool TurnOn(CTurnOn *msg); +private: + static int _v1; + static int _initialFrame; + static int _v3; +private: + int _seasonNum; + CString _viewName1; + int _fieldF0; + int _winterOffStartFrame; + int _winterOffEndFrame; + int _springOffStartFrame; + int _springOffEndFrame; + int _summerOffStartFrame2; + int _summerOffEndFrame2; + int _summerOffStartFrame1; + int _summerOffEndFrame1; + int _autumnOffStartFrame2; + int _autumnOffEndFrame2; + int _autumnOffStartFrame1; + int _autumnOffEndFrame1; + int _winterOnStartFrame; + int _winterOnEndFrame; + int _springOnStartFrame; + int _springOnEndFrame; + int _summerOnStartFrame1; + int _summerOnEndFrame1; + int _summerOnStartFrame2; + int _summerOnEndFrame2; + int _autumnOnStartFrame1; + int _autumnOnEndFrame1; + int _autumnOnStartFrame2; + int _autumnOnEndFrame2; + CString _viewName2; +public: + CLASSDEF; + CArboretumGate(); + + /** + * 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_ARBORETUM_GATE_H */ diff --git a/engines/titanic/game/auto_animate.cpp b/engines/titanic/game/auto_animate.cpp new file mode 100644 index 0000000000..16e6e56747 --- /dev/null +++ b/engines/titanic/game/auto_animate.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/game/auto_animate.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CAutoAnimate, CBackground) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(InitializeAnimMsg) +END_MESSAGE_MAP() + +void CAutoAnimate::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_enabled, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_repeat, indent); + CBackground::save(file, indent); +} + +void CAutoAnimate::load(SimpleFile *file) { + file->readNumber(); + _enabled = file->readNumber(); + _fieldE4 = file->readNumber(); + _repeat = file->readNumber(); + CBackground::load(file); +} + +bool CAutoAnimate::EnterViewMsg(CEnterViewMsg *msg) { + if (_enabled) { + uint flags = _repeat ? MOVIE_REPEAT : 0; + if (_startFrame != _endFrame) + playMovie(_startFrame, _endFrame, flags); + else + playMovie(flags); + + if (!_fieldE4) + _enabled = false; + } + + return true; +} + +bool CAutoAnimate::InitializeAnimMsg(CInitializeAnimMsg *msg) { + _enabled = true; + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/auto_animate.h b/engines/titanic/game/auto_animate.h new file mode 100644 index 0000000000..735aba922e --- /dev/null +++ b/engines/titanic/game/auto_animate.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_AUTO_ANIMATE_H +#define TITANIC_AUTO_ANIMATE_H + +#include "titanic/core/background.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CAutoAnimate : public CBackground { + DECLARE_MESSAGE_MAP; + bool EnterViewMsg(CEnterViewMsg *msg); + bool InitializeAnimMsg(CInitializeAnimMsg *msg); +private: + bool _enabled; + int _fieldE4; + bool _repeat; +public: + CLASSDEF; + CAutoAnimate() : CBackground(), _enabled(true), _fieldE4(1), _repeat(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_AUTO_ANIMATE_H */ diff --git a/engines/titanic/game/bar_bell.cpp b/engines/titanic/game/bar_bell.cpp new file mode 100644 index 0000000000..207644a00e --- /dev/null +++ b/engines/titanic/game/bar_bell.cpp @@ -0,0 +1,131 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/bar_bell.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CBarBell, CGameObject) + ON_MESSAGE(EnterRoomMsg) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MouseButtonUpMsg) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + +CBarBell::CBarBell() : CGameObject(), _fieldBC(0), + _volume(65), _soundVal3(0), _fieldC8(0), _fieldCC(0) { +} + +void CBarBell::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_volume, indent); + file->writeNumberLine(_soundVal3, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_fieldCC, indent); + + CGameObject::save(file, indent); +} + +void CBarBell::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _volume = file->readNumber(); + _soundVal3 = file->readNumber(); + _fieldC8 = file->readNumber(); + _fieldCC = file->readNumber(); + + CGameObject::load(file); +} + +bool CBarBell::EnterRoomMsg(CEnterRoomMsg *msg) { + _fieldBC = 0; + return true; +} + +bool CBarBell::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if ((_fieldC8 % 3) == 2) { + switch (_fieldBC) { + case 0: + case 1: + case 5: + playSound("c#54.wav", _volume, _soundVal3); + break; + + case 2: + playSound("c#52.wav", _volume, _soundVal3); + break; + + case 3: + playSound("c#53.wav", _volume, _soundVal3); + break; + + case 4: + playSound("c#55.wav", _volume, _soundVal3); + break; + + default: + playSound("c#51.wav", _volume, _soundVal3); + break; + } + } else if (_fieldBC >= 5) { + if (_fieldBC == 6) { + CActMsg actMsg("BellRing3"); + actMsg.execute("Barbot"); + } + + playSound("c#51.wav", _volume, _soundVal3); + } else { + if (_fieldBC == 3) { + CActMsg actMsg("BellRing1"); + actMsg.execute("Barbot"); + } else if (_fieldBC == 4) { + CActMsg actMsg("BellRing2"); + actMsg.execute("Barbot"); + } + + playSound("c#54.wav", _volume, _soundVal3); + } + + return true; +} + +bool CBarBell::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + if (!_fieldBC) { + CTurnOn onMsg; + onMsg.execute("Barbot"); + } + + ++_fieldBC; + return 2; +} + +bool CBarBell::ActMsg(CActMsg *msg) { + if (msg->_action == "ResetCount") { + _fieldBC = 0; + ++_fieldC8; + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/bar_bell.h b/engines/titanic/game/bar_bell.h new file mode 100644 index 0000000000..b50fe505ba --- /dev/null +++ b/engines/titanic/game/bar_bell.h @@ -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. + * + */ + +#ifndef TITANIC_BAR_BELL_H +#define TITANIC_BAR_BELL_H + +#include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CBarBell : public CGameObject { + DECLARE_MESSAGE_MAP; + bool EnterRoomMsg(CEnterRoomMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); + bool ActMsg(CActMsg *msg); +public: + int _fieldBC; + int _volume; + int _soundVal3; + int _fieldC8; + int _fieldCC; +public: + CLASSDEF; + CBarBell(); + + /** + * 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_BAR_BELL_H */ diff --git a/engines/titanic/game/bar_menu.cpp b/engines/titanic/game/bar_menu.cpp new file mode 100644 index 0000000000..3812a8dab6 --- /dev/null +++ b/engines/titanic/game/bar_menu.cpp @@ -0,0 +1,104 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/bar_menu.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CBarMenu, CGameObject) + ON_MESSAGE(PETActivateMsg) + ON_MESSAGE(PETDownMsg) + ON_MESSAGE(PETUpMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(LeaveViewMsg) +END_MESSAGE_MAP() + +CBarMenu::CBarMenu() : CGameObject(), _barFrameNumber(0), _visibleFlag(false), _numFrames(6) { +} + +void CBarMenu::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_barFrameNumber, indent); + file->writeNumberLine(_visibleFlag, indent); + file->writeNumberLine(_numFrames, indent); + + CGameObject::save(file, indent); +} + +void CBarMenu::load(SimpleFile *file) { + file->readNumber(); + _barFrameNumber = file->readNumber(); + _visibleFlag = file->readNumber(); + _numFrames = file->readNumber(); + + CGameObject::load(file); +} + +bool CBarMenu::PETActivateMsg(CPETActivateMsg *msg) { + if (msg->_name == "Television") { + _visibleFlag = !_visibleFlag; + setVisible(_visibleFlag); + loadFrame(_barFrameNumber); + } + + return true; +} + +bool CBarMenu::PETDownMsg(CPETDownMsg *msg) { + if (_visibleFlag) { + if (--_barFrameNumber < 0) + _barFrameNumber = _numFrames - 1; + + loadFrame(_barFrameNumber); + } + + return true; +} + +bool CBarMenu::PETUpMsg(CPETUpMsg *msg) { + if (_visibleFlag) { + _barFrameNumber = (_barFrameNumber + 1) % _numFrames; + loadFrame(_barFrameNumber); + } + + return true; +} + +bool CBarMenu::EnterViewMsg(CEnterViewMsg *msg) { + petSetArea(PET_REMOTE); + petHighlightGlyph(2); + petSetRemoteTarget(); + setVisible(_visibleFlag); + loadFrame(_barFrameNumber); + + return true; +} + +bool CBarMenu::LeaveViewMsg(CLeaveViewMsg *msg) { + petClear(); + _visibleFlag = false; + setVisible(false); + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/bar_menu.h b/engines/titanic/game/bar_menu.h new file mode 100644 index 0000000000..f16f7b035d --- /dev/null +++ b/engines/titanic/game/bar_menu.h @@ -0,0 +1,59 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_BAR_MENU_H +#define TITANIC_BAR_MENU_H + +#include "titanic/core/game_object.h" +#include "titanic/messages/pet_messages.h" + +namespace Titanic { + +class CBarMenu : public CGameObject { + DECLARE_MESSAGE_MAP; + bool PETActivateMsg(CPETActivateMsg *msg); + bool PETDownMsg(CPETDownMsg *msg); + bool PETUpMsg(CPETUpMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); +public: + int _barFrameNumber; + bool _visibleFlag; + int _numFrames; +public: + CLASSDEF; + CBarMenu(); + + /** + * 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_BAR_MENU_H */ diff --git a/engines/titanic/game/bar_menu_button.cpp b/engines/titanic/game/bar_menu_button.cpp new file mode 100644 index 0000000000..874584db30 --- /dev/null +++ b/engines/titanic/game/bar_menu_button.cpp @@ -0,0 +1,61 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/bar_menu_button.h" +#include "titanic/messages/pet_messages.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CBarMenuButton, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MouseButtonUpMsg) +END_MESSAGE_MAP() + +void CBarMenuButton::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CBarMenuButton::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +bool CBarMenuButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return true; +} + +bool CBarMenuButton::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + if (_value) { + CPETUpMsg upMsg("", -1); + upMsg.execute("BarTelevision"); + } else { + CPETDownMsg downMsg("", -1); + downMsg.execute("BarTelevision"); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/bar_menu_button.h b/engines/titanic/game/bar_menu_button.h new file mode 100644 index 0000000000..300435c209 --- /dev/null +++ b/engines/titanic/game/bar_menu_button.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_BAR_MENU_BUTTON_H +#define TITANIC_BAR_MENU_BUTTON_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CBarMenuButton : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); +public: + int _value; +public: + CLASSDEF; + CBarMenuButton() : CGameObject(), _value(1) {} + + /** + * 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_BAR_MENU_BUTTON_H */ diff --git a/engines/titanic/game/belbot_get_light.cpp b/engines/titanic/game/belbot_get_light.cpp new file mode 100644 index 0000000000..2cc4c3ae19 --- /dev/null +++ b/engines/titanic/game/belbot_get_light.cpp @@ -0,0 +1,78 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/belbot_get_light.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CBelbotGetLight, CGameObject) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(MovieFrameMsg) + ON_MESSAGE(EnterViewMsg) +END_MESSAGE_MAP() + +void CBelbotGetLight::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_value, indent); + CGameObject::save(file, indent); +} + +void CBelbotGetLight::load(SimpleFile *file) { + file->readNumber(); + _value = file->readString(); + CGameObject::load(file); +} + +bool CBelbotGetLight::ActMsg(CActMsg *msg) { + if (msg->_action == "BellbotGetLight") { + _value = getFullViewName(); + lockMouse(); + changeView("1stClassState.Node 11.N", ""); + } + + return true; +} + +bool CBelbotGetLight::MovieEndMsg(CMovieEndMsg *msg) { + sleep(1000); + changeView(_value, ""); + unlockMouse(); + return true; +} + +bool CBelbotGetLight::MovieFrameMsg(CMovieFrameMsg *msg) { + if (getMovieFrame() == 37) { + CActMsg actMsg("BellbotGetLight"); + actMsg.execute("Eye1"); + } + + return true; +} + +bool CBelbotGetLight::EnterViewMsg(CEnterViewMsg *msg) { + playMovie(MOVIE_NOTIFY_OBJECT); + movieEvent(37); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/belbot_get_light.h b/engines/titanic/game/belbot_get_light.h new file mode 100644 index 0000000000..1707ad4793 --- /dev/null +++ b/engines/titanic/game/belbot_get_light.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_BELBOT_GET_LIGHT_H +#define TITANIC_BELBOT_GET_LIGHT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CBelbotGetLight : public CGameObject { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool MovieFrameMsg(CMovieFrameMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); +private: + CString _value; +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_LIGHT_H */ diff --git a/engines/titanic/game/bomb.cpp b/engines/titanic/game/bomb.cpp new file mode 100644 index 0000000000..f3f1129e22 --- /dev/null +++ b/engines/titanic/game/bomb.cpp @@ -0,0 +1,363 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/bomb.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CBomb, CBackground) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(EnterRoomMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(TurnOn) + ON_MESSAGE(TimerMsg) + ON_MESSAGE(TrueTalkGetStateValueMsg) + ON_MESSAGE(SetFrameMsg) +END_MESSAGE_MAP() + +static const char *const WAVE_NAMES1[] = { + "z#353.wav", "z#339.wav", "z#325.wav", "z#311.wav", "z#297.wav", + "z#283.wav", "z#269.wav", "z#255.wav", "z#241.wav" +}; + +static const char *const WAVE_NAMES2[] = { + "", "z#352.wav", "z#338.wav", "z#324.wav", "z#310.wav", "z#296.wav", + "z#281.wav", "z#268.wav", "z#254.wav", "z#240.wav", "", "z#351.wav", + "z#337.wav", "z#323.wav", "z#309.wav", "z#295.wav", "z#282.wav", + "z#267.wav", "z#253.wav", "z#239.wav" +}; + +static const char *const WAVE_NAMES3[100] = { + "bombcountdown_c0.wav", "z#355.wav", "z#341.wav", "z#327.wav", "z#313.wav", + "z#299.wav", "z#285.wav", "z#271.wav", "z#257.wav", "z#243.wav", + "z#354.wav", "z#350.wav", "z#349.wav", "z#348.wav", "z#347.wav", + "z#346.wav", "z#345.wav", "z#344.wav", "z#343.wav", "z#342.wav", + "z#340.wav", "z#336.wav", "z#335.wav", "z#334.wav", "z#333.wav", + "z#332.wav", "z#331.wav", "z#330.wav", "z#329.wav", "z#328.wav", + "z#326.wav", "z#322.wav", "z#321.wav", "z#320.wav", "z#319.wav", + "z#318.wav", "z#317.wav", "z#316.wav", "z#315.wav", "z#314.wav", + "z#312.wav", "z#308.wav", "z#307.wav", "z#306.wav", "z#305.wav", + "z#304.wav", "z#303.wav", "z#302.wav", "z#301.wav", "z#300.wav", + "z#298.wav", "z#294.wav", "z#293.wav", "z#292.wav", "z#291.wav", + "z#290.wav", "z#289.wav", "z#288.wav", "z#287.wav", "z#286.wav", + "z#284.wav", "z#280.wav", "z#279.wav", "z#278.wav", "z#277.wav", + "z#276.wav", "z#275.wav", "z#274.wav", "z#273.wav", "z#272.wav", + "z#270.wav", "z#266.wav", "z#265.wav", "z#264.wav", "z#263.wav", + "z#262.wav", "z#261.wav", "z#260.wav", "z#259.wav", "z#258.wav", + "z#256.wav", "z#252.wav", "z#251.wav", "z#250.wav", "z#249.wav", + "z#248.wav", "z#247.wav", "z#246.wav", "z#245.wav", "z#244.wav", + "z#242.wav", "z#238.wav", "z#237.wav", "z#236.wav", "z#235.wav", + "z#234.wav", "z#233.wav", "z#232.wav", "z#231.wav", "z#230.wav", +}; + +CBomb::CBomb() : CBackground() { + _fieldE0 = 0; + _fieldE4 = 0; + _fieldE8 = 17; + _fieldEC = 9; + _fieldF0 = 0; + _countdown = 999; + _soundHandle = 0; + _fieldFC = 0; + _startingTicks = 0; + _volume = 60; +} + +void CBomb::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_fieldF0, indent); + file->writeNumberLine(_countdown, indent); + file->writeNumberLine(_soundHandle, indent); + file->writeNumberLine(_fieldFC, indent); + file->writeNumberLine(_startingTicks, indent); + file->writeNumberLine(_volume, indent); + + CBackground::save(file, indent); +} + +void CBomb::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + _fieldF0 = file->readNumber(); + _countdown = file->readNumber(); + _soundHandle = file->readNumber(); + _fieldFC = file->readNumber(); + _startingTicks = file->readNumber(); + _volume = file->readNumber(); + + CBackground::load(file); +} + +bool CBomb::StatusChangeMsg(CStatusChangeMsg *msg) { + _fieldE4 += msg->_newStatus; + + if (_fieldE4 == 23) { + startAnimTimer("Disarmed", 2000); + lockMouse(); + } + + _fieldF0 %= 1000; + if (!(_fieldF0 % 20) && _countdown < 995) { + int val = getRandomNumber(5) + 25; + if (_fieldF0 < 20 || _fieldF0 > 80) + val = 28; + + CString name; + switch (val - 25) { + case 0: + name = "z#372.wav"; + break; + case 1: + name = "z#371.wav"; + break; + case 2: + name = "z#370.wav"; + break; + case 3: + name = "z#369.wav"; + break; + case 4: + name = "z#368.wav"; + break; + default: + name = "z#366.wav"; + break; + } + + _soundHandle = queueSound(name, _soundHandle, _volume); + } + + return true; +} + +bool CBomb::EnterViewMsg(CEnterViewMsg *msg) { + _fieldE4 = 2; + return true; +} + +bool CBomb::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + playSound("z#62.wav"); + + if (_fieldE0) { + stopSound(_soundHandle); + if (_fieldE4 < 23) { + _fieldE8 = MIN(_fieldE8 + 1, 23); + + CString name; + switch (_fieldE8) { + case 18: + name = "z#380.wav"; + break; + case 19: + name = "z#379.wav"; + break; + case 20: + name = "z#377.wav"; + break; + case 21: + name = "z#376.wav"; + break; + case 22: + name = "z#375.wav"; + break; + default: + name = "z#374.wav"; + break; + } + + _soundHandle = queueSound(name, _soundHandle, _volume); + _countdown = 999; + } + } else { + _soundHandle = playSound("z#389.wav", _volume); + _fieldE0 = true; + CActMsg actMsg("Arm Bomb"); + actMsg.execute("EndExplodeShip"); + } + + return true; +} + +bool CBomb::EnterRoomMsg(CEnterRoomMsg *msg) { + _fieldE8 = 17; + _fieldEC = 9; + _fieldF0 = 0; + _startingTicks = getTicksCount(); + return true; +} + +bool CBomb::ActMsg(CActMsg *msg) { + if (msg->_action == "Hit") { + playSound("z#63.wav"); + stopSound(_soundHandle); + + if (_fieldEC < 17) + ++_fieldEC; + + CString name; + switch (_fieldEC) { + case 10: + name = "z#388.wav"; + break; + case 11: + name = "z#387.wav"; + break; + case 12: + name = "z#386.wav"; + break; + case 13: + name = "z#385.wav"; + break; + case 14: + name = "z#384.wav"; + break; + case 15: + name = "z#383.wav"; + break; + case 16: + name = "z#382.wav"; + break; + default: + name = "z#381.wav"; + break; + } + + _soundHandle = queueSound(name, _soundHandle, _volume); + _countdown = 999; + } + + return true; +} + +bool CBomb::TurnOn(CTurnOn *msg) { + if (!_fieldE0) { + _soundHandle = playSound("z#389.wav", _volume); + _fieldE0 = true; + + CActMsg actMsg("Arm Bomb"); + actMsg.execute("EndExplodeShip"); + addTimer(0); + } + + changeView("Titania.Node 8.W", ""); + CActMsg actMsg("Titania.Node 8.N"); + actMsg.execute("BombNav"); + actMsg.execute("EnterBombRoom"); + + return true; +} + +bool CBomb::TimerMsg(CTimerMsg *msg) { + if (msg->_action == "Disarmed") { + stopSound(_soundHandle); + playSound("z#364.wav", _volume); + + CActMsg actMsg1("Disarm Bomb"); + actMsg1.execute("EndExplodeShip"); + _fieldE0 = false; + CActMsg actMsg2("Titania.Node 5.N"); + actMsg2.execute("BombNav"); + actMsg2.execute("EnterBombNav"); + + changeView("Titania.Node 8.W", ""); + changeView("Titania.Node 13.N", ""); + unlockMouse(); + } + + if (compareRoomNameTo("Titania")) { + if (msg->_actionVal == 1 && getRandomNumber(9) == 0) { + if (!_fieldE0) + return true; + + CParrotSpeakMsg speakMsg("Bomb", "BombCountdown"); + speakMsg.execute("PerchedParrot"); + } + + if (_fieldE0) { + if (isSoundActive(_soundHandle)) { + if (msg->_actionVal == 0) { + addTimer(1, 1000, 0); + } else { + _soundHandle = 0; + int section = _countdown / 100; + int index = _countdown % 100; + + if (_countdown >= 100) { + CString name1 = index ? WAVE_NAMES2[section] : + WAVE_NAMES1[section]; + playSound(name1, _volume); + } + + CString name2 = WAVE_NAMES3[index]; + if (_countdown == 10) { + name2 = "z#229.wav"; + _countdown = 998; + } + + if (_soundHandle > 0) { + _soundHandle = queueSound(name2, _soundHandle, _volume); + } else { + _soundHandle = playSound(name2, _volume); + } + + --_countdown; + addTimer(0, 1000, 0); + } + } else { + addTimer(0, 100, 0); + } + } + } else { + if (_fieldE0) { + --_countdown; + addTimer(6000); + + if (_countdown < 11) + _countdown = getRandomNumber(900) + 50; + } + } + + return true; +} + +bool CBomb::TrueTalkGetStateValueMsg(CTrueTalkGetStateValueMsg *msg) { + if (msg->_stateNum == 10) + msg->_stateVal = _fieldE0; + + return true; +} + +bool CBomb::SetFrameMsg(CSetFrameMsg *msg) { + _volume = msg->_frameNumber; + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/bomb.h b/engines/titanic/game/bomb.h new file mode 100644 index 0000000000..f78c42cff0 --- /dev/null +++ b/engines/titanic/game/bomb.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_BOMB_H +#define TITANIC_BOMB_H + +#include "titanic/core/background.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CBomb : public CBackground { + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool EnterRoomMsg(CEnterRoomMsg *msg); + bool ActMsg(CActMsg *msg); + bool TurnOn(CTurnOn *msg); + bool TimerMsg(CTimerMsg *msg); + bool TrueTalkGetStateValueMsg(CTrueTalkGetStateValueMsg *msg); + bool SetFrameMsg(CSetFrameMsg *msg); + DECLARE_MESSAGE_MAP; +private: + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; + int _fieldF0; + int _countdown; + int _soundHandle; + int _fieldFC; + int _startingTicks; + int _volume; +public: + CLASSDEF; + CBomb(); + + /** + * 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_BOMB_H */ diff --git a/engines/titanic/game/bottom_of_well_monitor.cpp b/engines/titanic/game/bottom_of_well_monitor.cpp new file mode 100644 index 0000000000..38211040d8 --- /dev/null +++ b/engines/titanic/game/bottom_of_well_monitor.cpp @@ -0,0 +1,114 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/bottom_of_well_monitor.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CBottomOfWellMonitor, CGameObject) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(LeaveViewMsg) +END_MESSAGE_MAP() + +int CBottomOfWellMonitor::_v1; +int CBottomOfWellMonitor::_v2; + +void CBottomOfWellMonitor::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_v2, indent); + file->writeNumberLine(_flag, indent); + CGameObject::save(file, indent); +} + +void CBottomOfWellMonitor::load(SimpleFile *file) { + file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); + _flag = file->readNumber(); + CGameObject::load(file); +} + +bool CBottomOfWellMonitor::ActMsg(CActMsg *msg) { + if (msg->_action == "TelevisionTaken") { + _v1 = 0; + _cursorId = CURSOR_ARROW; + CVisibleMsg visibleMsg; + visibleMsg.execute("CrushedTV2NE"); + visibleMsg.execute("CrushedTV4SW"); + _cursorId = CURSOR_ARROW; + } else if (msg->_action == "LiftbotHeadTaken") { + _v2 = 0; + _cursorId = CURSOR_ARROW; + CVisibleMsg visibleMsg; + visibleMsg.execute("LiftbotHead2NE"); + visibleMsg.execute("LiftbotHead4SW"); + _cursorId = CURSOR_ARROW; + } else if (msg->_action == "LiftbotHeadTaken") { + _v2 = 1; + CVisibleMsg visibleMsg; + visibleMsg.execute("CrushedTV2NE"); + visibleMsg.execute("CrushedTV4SW"); + _cursorId = CURSOR_MOVE_DOWN1; + } + + return true; +} + +bool CBottomOfWellMonitor::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (isEquals("BOWTelevisionMonitor")) { + if (_v1) + changeView("BottomOfWell.Node 7.N", ""); + } else { + if (_v2) + changeView("BottomOfWell.Node 8.N", ""); + } + + return true; +} + +bool CBottomOfWellMonitor::EnterViewMsg(CEnterViewMsg *msg) { + if (_flag) { + if (isEquals("BOWTelevisionMonitor")) { + if (_v1) { + changeView("BottomOfWell.Node 7.N", ""); + _flag = false; + } + } else { + if (_v2) { + changeView("BottomOfWell.Node 8.N", ""); + _flag = false; + } + } + } + + return true; +} + +bool CBottomOfWellMonitor::LeaveViewMsg(CLeaveViewMsg *msg) { + _flag = true; + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/bottom_of_well_monitor.h b/engines/titanic/game/bottom_of_well_monitor.h new file mode 100644 index 0000000000..be9ae2c093 --- /dev/null +++ b/engines/titanic/game/bottom_of_well_monitor.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_BOTTOM_OF_WELL_MONITOR_H +#define TITANIC_BOTTOM_OF_WELL_MONITOR_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CBottomOfWellMonitor : public CGameObject { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); +public: + static int _v1, _v2; + bool _flag; +public: + CLASSDEF; + CBottomOfWellMonitor() : _flag(true) {} + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BOTTOM_OF_WELL_MONITOR_H */ diff --git a/engines/titanic/game/bowl_unlocker.cpp b/engines/titanic/game/bowl_unlocker.cpp new file mode 100644 index 0000000000..c4adac34f2 --- /dev/null +++ b/engines/titanic/game/bowl_unlocker.cpp @@ -0,0 +1,78 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/bowl_unlocker.h" +#include "titanic/core/room_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CBowlUnlocker, CGameObject) + ON_MESSAGE(NutPuzzleMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(LeaveViewMsg) +END_MESSAGE_MAP() + +void CBowlUnlocker::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_bowlUnlocked, indent); + CGameObject::save(file, indent); +} + +void CBowlUnlocker::load(SimpleFile *file) { + file->readNumber(); + _bowlUnlocked = file->readNumber(); + CGameObject::load(file); +} + +bool CBowlUnlocker::NutPuzzleMsg(CNutPuzzleMsg *msg) { + if (msg->_value == "UnlockBowl") { + setVisible(true); + playMovie(MOVIE_NOTIFY_OBJECT); + } + + return true; +} + +bool CBowlUnlocker::MovieEndMsg(CMovieEndMsg *msg) { + setVisible(false); + _bowlUnlocked = true; + + CNutPuzzleMsg puzzleMsg("BowlUnlocked"); + puzzleMsg.execute(getRoom(), nullptr, MSGFLAG_SCAN); + + playSound("z#47.wav"); + return true; +} + +bool CBowlUnlocker::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_bowlUnlocked) + msg->execute("Ear1"); + return true; +} + +bool CBowlUnlocker::LeaveViewMsg(CLeaveViewMsg *msg) { + _bowlUnlocked = false; + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/bowl_unlocker.h b/engines/titanic/game/bowl_unlocker.h new file mode 100644 index 0000000000..b940661904 --- /dev/null +++ b/engines/titanic/game/bowl_unlocker.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_BOWL_UNLOCKER_H +#define TITANIC_BOWL_UNLOCKER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CBowlUnlocker : public CGameObject { + DECLARE_MESSAGE_MAP; + bool NutPuzzleMsg(CNutPuzzleMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); +public: + bool _bowlUnlocked; +public: + CLASSDEF; + CBowlUnlocker() : CGameObject(), _bowlUnlocked(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_BOWL_UNLOCKER_H */ diff --git a/engines/titanic/game/brain_slot.cpp b/engines/titanic/game/brain_slot.cpp new file mode 100644 index 0000000000..1518d9b0b3 --- /dev/null +++ b/engines/titanic/game/brain_slot.cpp @@ -0,0 +1,149 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/brain_slot.h" +#include "titanic/core/project_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CBrainSlot, CGameObject) + ON_MESSAGE(SetFrameMsg) + ON_MESSAGE(AddHeadPieceMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MouseDragStartMsg) +END_MESSAGE_MAP() + +int CBrainSlot::_added; +bool CBrainSlot::_woken; + +void CBrainSlot::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value1, indent); + file->writeQuotedLine(_target, indent); + file->writeNumberLine(_added, indent); + file->writeNumberLine(_woken, indent); + + CGameObject::save(file, indent); +} + +void CBrainSlot::load(SimpleFile *file) { + file->readNumber(); + _value1 = file->readNumber(); + _target = file->readString(); + _added = file->readNumber(); + _woken = file->readNumber(); + + CGameObject::load(file); +} + +bool CBrainSlot::SetFrameMsg(CSetFrameMsg *msg) { + loadFrame(msg->_frameNumber); + _value1 = 1; + return true; +} + +bool CBrainSlot::AddHeadPieceMsg(CAddHeadPieceMsg *msg) { + _added = 1; + _cursorId = CURSOR_HAND; + CAddHeadPieceMsg addMsg("NULL"); + + if (isEquals("AuditoryCentreSlot")) { + if (msg->_value == "AuditoryCentre") + addMsg._value = "AuditoryCentre"; + } else if (isEquals("SpeechCentreSlot")) { + if (msg->_value == "SpeechCentre") + addMsg._value = "SpeechCentre"; + } else if (isEquals("OlfactoryCentreSlot")) { + if (msg->_value == "OlfactoryCentre") + addMsg._value = "OlfactoryCentre"; + } else if (isEquals("VisionCentreSlot")) { + if (msg->_value == "VisionCentre") + addMsg._value = "VisionCentre"; + } else if (isEquals("CentralCoreSlot")) { + if (msg->_value == "CentralCore") + addMsg._value = "CentralCore"; + } + + if (addMsg._value != "NULL") + addMsg.execute("TitaniaControl"); + + if (addMsg._value == "OlfactoryCentre") + loadFrame(2); + else if (addMsg._value == "AuditoryCentre") + loadFrame(1); + else if (addMsg._value == "SpeechCentre") + loadFrame(3); + else if (addMsg._value == "VisionCentre") + loadFrame(4); + else if (addMsg._value == "CentralCore") { + CActMsg actMsg("Insert Central Core"); + actMsg.execute("CentralCoreSlot"); + } + + _target = msg->_value; + _value1 = 1; + return true; +} + +bool CBrainSlot::EnterViewMsg(CEnterViewMsg *msg) { + if (getName() == "CentralCoreSlot") + loadFrame(21); + if (_woken) + _cursorId = CURSOR_ARROW; + + return true; +} + +bool CBrainSlot::ActMsg(CActMsg *msg) { + if (msg->_action == "Insert Central Core") + playMovie(0, 21, 0); + else if (msg->_action == "Woken") + _woken = true; + + return true; +} + +bool CBrainSlot::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (!_value1 || _woken || !checkPoint(msg->_mousePos, false, true)) + return false; + + _cursorId = CURSOR_ARROW; + CVisibleMsg visibleMsg(true); + visibleMsg.execute(_target); + CTakeHeadPieceMsg takeMsg(_target); + takeMsg.execute("TitaniaControl"); + + loadFrame(isEquals("CentralCoreSlot") ? 21 : 0); + _value1 = 0; + + CPassOnDragStartMsg passMsg; + passMsg._mousePos = msg->_mousePos; + passMsg.execute(_target); + + msg->_dragItem = getRoot()->findByName(_target); + _added = 0; + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/brain_slot.h b/engines/titanic/game/brain_slot.h new file mode 100644 index 0000000000..4d500cc59a --- /dev/null +++ b/engines/titanic/game/brain_slot.h @@ -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. + * + */ + +#ifndef TITANIC_BRAIN_SLOT_H +#define TITANIC_BRAIN_SLOT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CBrainSlot : public CGameObject { + DECLARE_MESSAGE_MAP; + bool SetFrameMsg(CSetFrameMsg *msg); + bool AddHeadPieceMsg(CAddHeadPieceMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool ActMsg(CActMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); +public: + static int _added; + static bool _woken; +public: + int _value1; + CString _target; +public: + CLASSDEF; + CBrainSlot() : CGameObject(), _value1(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_BRAIN_SLOT_H */ diff --git a/engines/titanic/game/bridge_door.cpp b/engines/titanic/game/bridge_door.cpp new file mode 100644 index 0000000000..bfa30fd650 --- /dev/null +++ b/engines/titanic/game/bridge_door.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/game/bridge_door.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CBridgeDoor, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + +void CBridgeDoor::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CBridgeDoor::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +bool CBridgeDoor::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + setVisible(true); + playMovie(0, 6, 0); + changeView("Titania.Node 12.N"); + + return true; +} + +bool CBridgeDoor::StatusChangeMsg(CStatusChangeMsg *msg) { + setVisible(true); + playMovie(7, 0, MOVIE_NOTIFY_OBJECT); + return true; +} + +bool CBridgeDoor::MovieEndMsg(CMovieEndMsg *msg) { + setVisible(false); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/bridge_door.h b/engines/titanic/game/bridge_door.h new file mode 100644 index 0000000000..010a8b8bc0 --- /dev/null +++ b/engines/titanic/game/bridge_door.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_BRIDGE_DOOR_H +#define TITANIC_BRIDGE_DOOR_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CBridgeDoor : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool MovieEndMsg(CMovieEndMsg *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_BRIDGE_DOOR_H */ diff --git a/engines/titanic/game/bridge_view.cpp b/engines/titanic/game/bridge_view.cpp new file mode 100644 index 0000000000..466480a64c --- /dev/null +++ b/engines/titanic/game/bridge_view.cpp @@ -0,0 +1,115 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/bridge_view.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CBridgeView, CBackground) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + +void CBridgeView::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_mode, indent); + CBackground::save(file, indent); +} + +void CBridgeView::load(SimpleFile *file) { + file->readNumber(); + _mode = file->readNumber(); + CBackground::load(file); +} + +bool CBridgeView::ActMsg(CActMsg *msg) { + CTurnOn onMsg; + CSetVolumeMsg volumeMsg; + volumeMsg._secondsTransition = 1; + + if (msg->_action == "End") { + _mode = 4; + petLockInput(); + petHide(); + setVisible(true); + playMovie(MOVIE_NOTIFY_OBJECT); + } else if (msg->_action == "Go") { + _mode = 1; + setVisible(true); + volumeMsg._volume = 100; + volumeMsg.execute("EngineSounds"); + onMsg.execute("EngineSounds"); + playMovie(MOVIE_NOTIFY_OBJECT); + } else { + volumeMsg._volume = 50; + volumeMsg.execute("EngineSounds"); + onMsg.execute("EngineSounds"); + + if (msg->_action == "Cruise") { + _mode = 2; + setVisible(true); + playMovie(MOVIE_NOTIFY_OBJECT); + } else if (msg->_action == "GoENd") { + _mode = 3; + setVisible(true); + CChangeMusicMsg musicMsg; + musicMsg._flags = 1; + musicMsg.execute("BridgeAutoMusicPlayer"); + playSound("a#42.wav"); + playMovie(MOVIE_NOTIFY_OBJECT); + } + } + + return true; +} + +bool CBridgeView::MovieEndMsg(CMovieEndMsg *msg) { + CTurnOff offMsg; + offMsg.execute("EngineSounds"); + + switch (_mode) { + case 0: + case 1: + setVisible(false); + dec54(); + break; + + case 2: { + setVisible(false); + CActMsg actMsg("End"); + actMsg.execute("HomeSequence"); + break; + } + + case 3: + setVisible(false); + changeView("TheEnd.Node 3.N"); + break; + + default: + break; + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/bridge_view.h b/engines/titanic/game/bridge_view.h new file mode 100644 index 0000000000..45cfa3f4c8 --- /dev/null +++ b/engines/titanic/game/bridge_view.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_BRIDGE_VIEW_H +#define TITANIC_BRIDGE_VIEW_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CBridgeView : public CBackground { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); +public: + int _mode; +public: + CLASSDEF; + CBridgeView() : CBackground(), _mode(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_BRIDGE_VIEW_H */ diff --git a/engines/titanic/game/broken_pell_base.cpp b/engines/titanic/game/broken_pell_base.cpp new file mode 100644 index 0000000000..02c2d873ac --- /dev/null +++ b/engines/titanic/game/broken_pell_base.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/game/broken_pell_base.h" + +namespace Titanic { + +EMPTY_MESSAGE_MAP(CBrokenPellBase, CBackground); + +bool CBrokenPellBase::_v1; +int CBrokenPellBase::_v2; + +void CBrokenPellBase::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_v2, indent); + file->writeNumberLine(_fieldE0, indent); + CBackground::save(file, indent); +} + +void CBrokenPellBase::load(SimpleFile *file) { + file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); + _fieldE0 = file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/broken_pell_base.h b/engines/titanic/game/broken_pell_base.h new file mode 100644 index 0000000000..4ca7eddd20 --- /dev/null +++ b/engines/titanic/game/broken_pell_base.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_BROKEN_PELL_BASE_H +#define TITANIC_BROKEN_PELL_BASE_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CBrokenPellBase : public CBackground { + DECLARE_MESSAGE_MAP; +protected: + static bool _v1; + static int _v2; + + int _fieldE0; +public: + CLASSDEF; + CBrokenPellBase() : CBackground(), _fieldE0(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_BROKEN_PELL_BASE_H */ diff --git a/engines/titanic/game/broken_pellerator.cpp b/engines/titanic/game/broken_pellerator.cpp new file mode 100644 index 0000000000..8fb7244b7e --- /dev/null +++ b/engines/titanic/game/broken_pellerator.cpp @@ -0,0 +1,154 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/broken_pellerator.h" +#include "titanic/core/view_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CBrokenPellerator, CBrokenPellBase) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + +void CBrokenPellerator::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string2, indent); + file->writeQuotedLine(_string3, indent); + file->writeQuotedLine(_string4, indent); + file->writeQuotedLine(_string5, indent); + + CBrokenPellBase::save(file, indent); +} + +void CBrokenPellerator::load(SimpleFile *file) { + file->readNumber(); + _string2 = file->readString(); + _string3 = file->readString(); + _string4 = file->readString(); + _string5 = file->readString(); + + CBrokenPellBase::load(file); +} + +bool CBrokenPellerator::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_v1) { + changeView(_v2 ? _string5 : _string4); + } else { + if (_v2) { + playMovie(28, 43, 0); + } else { + playMovie(0, 14, MOVIE_NOTIFY_OBJECT); + } + + _v1 = true; + } + + return true; +} + +bool CBrokenPellerator::LeaveViewMsg(CLeaveViewMsg *msg) { + CString name = msg->_newView->getNodeViewName(); + if (name == "Node 3.S" || name == "Node 3.N") { + _v1 = false; + loadFrame(0); + } + + return true; +} + +bool CBrokenPellerator::ActMsg(CActMsg *msg) { + if (msg->_action == "PlayerGetsHose") { + _v2 = 1; + loadFrame(43); + + CStatusChangeMsg statusMsg; + statusMsg.execute("PickupHose"); + } else { + _fieldE0 = 0; + bool closeFlag = msg->_action == "Close"; + if (msg->_action == "CloseLeft") { + closeFlag = true; + _fieldE0 = 1; + } + if (msg->_action == "CloseRight") { + closeFlag = true; + _fieldE0 = 2; + } + + if (closeFlag) { + if (_v1) { + _v1 = false; + if (_v2) + playMovie(43, 57, MOVIE_NOTIFY_OBJECT); + else + playMovie(14, 28, MOVIE_NOTIFY_OBJECT); + } else { + switch (_fieldE0) { + case 1: + changeView(_string2); + break; + case 2: + changeView(_string3); + break; + default: + break; + } + + _fieldE0 = 0; + } + } + } + + return true; +} + +bool CBrokenPellerator::MovieEndMsg(CMovieEndMsg *msg) { + if (msg->_endFrame == 14) { + CStatusChangeMsg statusMsg; + statusMsg._newStatus = 1; + statusMsg.execute("PickUpHose"); + } + + if (msg->_endFrame == 28) { + CStatusChangeMsg statusMsg; + statusMsg._newStatus = 0; + statusMsg.execute("PickUpHose"); + } + + switch (_fieldE0) { + case 1: + changeView(_string2); + break; + case 2: + changeView(_string3); + break; + default: + break; + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/broken_pellerator.h b/engines/titanic/game/broken_pellerator.h new file mode 100644 index 0000000000..3b8c3ba587 --- /dev/null +++ b/engines/titanic/game/broken_pellerator.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_BROKEN_PELLERATOR_H +#define TITANIC_BROKEN_PELLERATOR_H + +#include "titanic/game/broken_pell_base.h" + +namespace Titanic { + +class CBrokenPellerator : public CBrokenPellBase { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool ActMsg(CActMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); +private: + CString _string2; + CString _string3; + CString _string4; + CString _string5; +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_BROKEN_PELLERATOR_H */ diff --git a/engines/titanic/game/broken_pellerator_froz.cpp b/engines/titanic/game/broken_pellerator_froz.cpp new file mode 100644 index 0000000000..690ab76820 --- /dev/null +++ b/engines/titanic/game/broken_pellerator_froz.cpp @@ -0,0 +1,150 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/broken_pellerator_froz.h" +#include "titanic/core/view_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CBrokenPelleratorFroz, CBrokenPellBase) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + +void CBrokenPelleratorFroz::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string2, indent); + file->writeQuotedLine(_string3, indent); + file->writeQuotedLine(_string4, indent); + file->writeQuotedLine(_string5, indent); + + CBrokenPellBase::save(file, indent); +} + +void CBrokenPelleratorFroz::load(SimpleFile *file) { + file->readNumber(); + _string2 = file->readString(); + _string3 = file->readString(); + _string4 = file->readString(); + _string5 = file->readString(); + + CBrokenPellBase::load(file); +} + +bool CBrokenPelleratorFroz::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_v1) { + changeView(_v2 ? _string5 : _string4); + } else { + _v1 = true; + if (_v2) { + playMovie(0, 13, 0); + } else { + playMovie(43, 55, MOVIE_NOTIFY_OBJECT); + } + } + + return true; +} + +bool CBrokenPelleratorFroz::LeaveViewMsg(CLeaveViewMsg *msg) { + CString name = msg->_newView->getNodeViewName(); + + if (name == "Node 3.S" || name == "Node 3.E") { + _v1 = false; + loadFrame(0); + } + + return true; +} + +bool CBrokenPelleratorFroz::ActMsg(CActMsg *msg) { + if (msg->_action == "PlayerGetsHose") { + _v2 = 1; + CStatusChangeMsg statusMsg; + statusMsg._newStatus = 0; + statusMsg.execute("FPickUpHose"); + } else { + _fieldE0 = 0; + bool closeFlag = msg->_action == "Close"; + if (msg->_action == "CloseLeft") { + closeFlag = true; + _fieldE0 = 1; + } + if (msg->_action == "CloseRight") { + closeFlag = true; + _fieldE0 = 2; + } + + if (closeFlag) { + if (_v1) { + _v1 = false; + if (_v2) + playMovie(29, 42, MOVIE_NOTIFY_OBJECT); + else + playMovie(72, 84, MOVIE_NOTIFY_OBJECT); + } else { + switch (_fieldE0) { + case 1: + changeView(_string2); + break; + case 2: + changeView(_string3); + break; + default: + break; + } + + _fieldE0 = 0; + } + } + } + + return true; +} + +bool CBrokenPelleratorFroz::MovieEndMsg(CMovieEndMsg *msg) { + if (msg->_endFrame == 55) { + CStatusChangeMsg statusMsg; + statusMsg._newStatus = 1; + statusMsg.execute("FPickUpHose"); + } + + if (msg->_endFrame == 84) { + CStatusChangeMsg statusMsg; + statusMsg._newStatus = 0; + statusMsg.execute("FPickUpHose"); + } + + if (_fieldE0 == 1) { + changeView(_string2); + _fieldE0 = 0; + } else if (_fieldE0 == 2) { + changeView(_string3); + _fieldE0 = 0; + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/broken_pellerator_froz.h b/engines/titanic/game/broken_pellerator_froz.h new file mode 100644 index 0000000000..ccdae6ffa8 --- /dev/null +++ b/engines/titanic/game/broken_pellerator_froz.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_BROKEN_PELLERATOR_FROZ_H +#define TITANIC_BROKEN_PELLERATOR_FROZ_H + +#include "titanic/game/broken_pell_base.h" + +namespace Titanic { + +class CBrokenPelleratorFroz : public CBrokenPellBase { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool ActMsg(CActMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); +private: + CString _string2; + CString _string3; + CString _string4; + CString _string5; +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_BROKEN_PELLERATOR_FROZ_H */ diff --git a/engines/titanic/game/cage.cpp b/engines/titanic/game/cage.cpp new file mode 100644 index 0000000000..bbac384cea --- /dev/null +++ b/engines/titanic/game/cage.cpp @@ -0,0 +1,110 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/cage.h" +#include "titanic/npcs/parrot.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CCage, CBackground) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(PreEnterViewMsg) + ON_MESSAGE(MouseMoveMsg) +END_MESSAGE_MAP() + +int CCage::_v1; +bool CCage::_open; + +void CCage::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_open, indent); + + CBackground::save(file, indent); +} + +void CCage::load(SimpleFile *file) { + file->readNumber(); + _v1 = file->readNumber(); + _open = file->readNumber(); + + CBackground::load(file); +} + +bool CCage::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (CParrot::_v4 && !CParrot::_v5) { + CActMsg actMsg(_open ? "Open" : "Shut"); + actMsg.execute(this); + } + + return true; +} + +bool CCage::ActMsg(CActMsg *msg) { + if (msg->_action == "Shut") { + if (!_open) { + playClip("Shut", MOVIE_STOP_PREVIOUS | MOVIE_NOTIFY_OBJECT); + disableMouse(); + } + } else if (msg->_action == "Open") { + if (_open) { + playClip("Open", MOVIE_STOP_PREVIOUS | MOVIE_NOTIFY_OBJECT); + disableMouse(); + } + } else if (msg->_action == "CoreReplaced") { + CActMsg actMsg("Shut"); + actMsg.execute(this); + } else if (msg->_action == "OpenNow") { + loadFrame(0); + _open = false; + } + + return true; +} + +bool CCage::MovieEndMsg(CMovieEndMsg *msg) { + enableMouse(); + _open = clipExistsByEnd("Shut", msg->_endFrame); + + CStatusChangeMsg statusMsg; + statusMsg._newStatus = _open ? 1 : (CParrot::_v4 == 0 ? 1 : 0); + statusMsg.execute("PerchCoreHolder"); + + return true; +} + +bool CCage::PreEnterViewMsg(CPreEnterViewMsg *msg) { + loadSurface(); + _open = CParrot::_v4 != 0; + loadFrame(_open ? 8 : 0); + + return true; +} + +bool CCage::MouseMoveMsg(CMouseMoveMsg *msg) { + _cursorId = CParrot::_v4 && !CParrot::_v5 ? CURSOR_ACTIVATE : CURSOR_ARROW; + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/cage.h b/engines/titanic/game/cage.h new file mode 100644 index 0000000000..48b1b46ab7 --- /dev/null +++ b/engines/titanic/game/cage.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_CAGE_H +#define TITANIC_CAGE_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CCage : public CBackground { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool ActMsg(CActMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool PreEnterViewMsg(CPreEnterViewMsg *msg); + bool MouseMoveMsg(CMouseMoveMsg *msg); +public: + static int _v1; + static bool _open; +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_CAGE_H */ diff --git a/engines/titanic/game/captains_wheel.cpp b/engines/titanic/game/captains_wheel.cpp new file mode 100644 index 0000000000..79908b561d --- /dev/null +++ b/engines/titanic/game/captains_wheel.cpp @@ -0,0 +1,209 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/captains_wheel.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CCaptainsWheel, CBackground) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(TurnOff) + ON_MESSAGE(TurnOn) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + +CCaptainsWheel::CCaptainsWheel() : CBackground(), + _fieldE0(0), _fieldE4(0), _fieldE8(0), _fieldEC(0), + _fieldF0(0), _fieldF4(0) { +} + +void CCaptainsWheel::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_fieldF0, indent); + file->writeNumberLine(_fieldF4, indent); + + CBackground::save(file, indent); +} + +void CCaptainsWheel::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + _fieldF0 = file->readNumber(); + _fieldF4 = file->readNumber(); + + CBackground::load(file); +} + +bool CCaptainsWheel::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_fieldE0) { + _fieldE0 = false; + CTurnOff offMsg; + offMsg.execute(this); + playMovie(162, 168, 0); + } else { + playMovie(0, 8, MOVIE_NOTIFY_OBJECT); + } + + return true; +} + +bool CCaptainsWheel::LeaveViewMsg(CLeaveViewMsg *msg) { + if (_fieldE0) { + _fieldE0 = false; + CTurnOff offMsg; + offMsg.execute(this); + playMovie(162, 168, MOVIE_GAMESTATE); + } + + return true; +} + +bool CCaptainsWheel::ActMsg(CActMsg *msg) { + if (msg->_action == "Spin") { + if (_fieldE0) { + CTurnOn onMsg; + onMsg.execute("RatchetySound"); + playMovie(8, 142, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + } + } else if (msg->_action == "Honk") { + if (_fieldE0) { + playMovie(150, 160, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + } + } else if (msg->_action == "Go") { + if (!_fieldE0) { + inc54(); + _fieldE0 = false; + _fieldE4 = 1; + + CTurnOff offMsg; + offMsg.execute(this); + playMovie(162, 168, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + } + } else if (msg->_action == "Cruise") { + if (_fieldE0) { + inc54(); + _fieldE0 = false; + _fieldE4 = 2; + + CTurnOff offMsg; + offMsg.execute(this); + playMovie(162, 168, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + } + } else if (msg->_action == "SetDestin") { + playSound("a#44.wav"); + CSetVolumeMsg volumeMsg; + volumeMsg._volume = 25; + volumeMsg.execute("EngineSounds"); + CTurnOn onMsg; + onMsg.execute("EngineSounds"); + _fieldF0 = 1; + } else if (msg->_action == "ClearDestin") { + _fieldF0 = 0; + } + + return true; +} + +bool CCaptainsWheel::TurnOff(CTurnOff *msg) { + CSignalObject signalMsg; + signalMsg._numValue = 0; + + static const char *const NAMES[8] = { + "WheelSpin", "SeagullHorn", "WheelStopButt", "StopHotSpot", + "WheelCruiseButt", "CruiseHotSpot", "WheelGoButt","GoHotSpot" + }; + for (int idx = 0; idx < 8; ++idx) + signalMsg.execute(NAMES[idx]); + + return true; +} + +bool CCaptainsWheel::TurnOn(CTurnOn *msg) { + CSignalObject signalMsg; + signalMsg._numValue = 1; + signalMsg.execute("WheelSpin"); + signalMsg.execute("SeagullHorn"); + + if (_fieldE0) { + signalMsg.execute("WheelStopButt"); + signalMsg.execute("StopHotSpot"); + } + + if (_fieldEC) { + signalMsg.execute("WheelCruiseButt"); + signalMsg.execute("CruiseHotSpot"); + } + + if (_fieldF0) { + signalMsg.execute("WheelGoButt"); + signalMsg.execute("GoHotSpot"); + } + + return true; +} + +bool CCaptainsWheel::MovieEndMsg(CMovieEndMsg *msg) { + if (msg->_endFrame == 8) { + _fieldE0 = true; + CTurnOn onMsg; + onMsg.execute(this); + } + + if (msg->_endFrame == 142) { + CTurnOff offMsg; + offMsg.execute("RatchetySound"); + } + + if (msg->_endFrame == 168) { + switch (_fieldE4) { + case 1: { + CActMsg actMsg(starFn2() ? "GoEnd" : "Go"); + actMsg.execute("GoSequence"); + break; + } + + case 2: { + CActMsg actMsg("Cruise"); + actMsg.execute("CruiseSequence"); + break; + } + + default: + break; + } + + _fieldE4 = 0; + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/captains_wheel.h b/engines/titanic/game/captains_wheel.h new file mode 100644 index 0000000000..3aca45c21f --- /dev/null +++ b/engines/titanic/game/captains_wheel.h @@ -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. + * + */ + +#ifndef TITANIC_CAPTAINS_WHEEL_H +#define TITANIC_CAPTAINS_WHEEL_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CCaptainsWheel : public CBackground { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool ActMsg(CActMsg *msg); + bool TurnOff(CTurnOff *msg); + bool TurnOn(CTurnOn *msg); + bool MovieEndMsg(CMovieEndMsg *msg); +public: + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; + int _fieldF0; + int _fieldF4; +public: + CLASSDEF; + CCaptainsWheel(); + + /** + * 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_CAPTAINS_WHEEL_H */ diff --git a/engines/titanic/game/cdrom.cpp b/engines/titanic/game/cdrom.cpp new file mode 100644 index 0000000000..cd913d05f7 --- /dev/null +++ b/engines/titanic/game/cdrom.cpp @@ -0,0 +1,88 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/cdrom.h" +#include "titanic/core/room_item.h" +#include "titanic/game/cdrom_tray.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CCDROM, CGameObject) + ON_MESSAGE(MouseDragStartMsg) + ON_MESSAGE(MouseDragEndMsg) + ON_MESSAGE(MouseDragMoveMsg) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + +CCDROM::CCDROM() : CGameObject() { +} + +void CCDROM::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writePoint(_tempPos, indent); + CGameObject::save(file, indent); +} + +void CCDROM::load(SimpleFile *file) { + file->readNumber(); + _tempPos = file->readPoint(); + CGameObject::load(file); +} + +bool CCDROM::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (checkStartDragging(msg)) { + _tempPos = msg->_mousePos - _bounds; + setPosition(msg->_mousePos - _tempPos); + return true; + } else { + return false; + } +} + +bool CCDROM::MouseDragEndMsg(CMouseDragEndMsg *msg) { + if (msg->_dropTarget && msg->_dropTarget->getName() == "newComputer") { + CCDROMTray *newTray = dynamic_cast<CCDROMTray *>(getRoom()->findByName("newTray")); + + if (newTray->_isOpened && newTray->_insertedCD == "None") { + CActMsg actMsg(getName()); + actMsg.execute(newTray); + setVisible(false); + } + } + + resetPosition(); + return true; +} + +bool CCDROM::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { + setPosition(msg->_mousePos - _tempPos); + return true; +} + +bool CCDROM::ActMsg(CActMsg *msg) { + if (msg->_action == "Ejected") + setVisible(true); + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/cdrom.h b/engines/titanic/game/cdrom.h new file mode 100644 index 0000000000..017914830c --- /dev/null +++ b/engines/titanic/game/cdrom.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_CDROM_H +#define TITANIC_CDROM_H + +#include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" + +namespace Titanic { + +class CCDROM : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseDragStartMsg(CMouseDragStartMsg *msg); + bool MouseDragEndMsg(CMouseDragEndMsg *msg); + bool MouseDragMoveMsg(CMouseDragMoveMsg *msg); + bool ActMsg(CActMsg *msg); +private: + Point _tempPos; +public: + CLASSDEF; + CCDROM(); + + /** + * 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_CDROM_H */ diff --git a/engines/titanic/game/cdrom_computer.cpp b/engines/titanic/game/cdrom_computer.cpp new file mode 100644 index 0000000000..ceb0595188 --- /dev/null +++ b/engines/titanic/game/cdrom_computer.cpp @@ -0,0 +1,78 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/cdrom_computer.h" +#include "titanic/core/room_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CCDROMComputer, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) +END_MESSAGE_MAP() + +CCDROMComputer::CCDROMComputer() : CGameObject(), + _clickRect(0, 3, 55, 32) { +} + +void CCDROMComputer::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_clickRect.left, indent); + file->writeNumberLine(_clickRect.top, indent); + file->writeNumberLine(_clickRect.right, indent); + file->writeNumberLine(_clickRect.bottom, indent); + + CGameObject::save(file, indent); +} + +void CCDROMComputer::load(SimpleFile *file) { + file->readNumber(); + _clickRect.left = file->readNumber(); + _clickRect.top = file->readNumber(); + _clickRect.right = file->readNumber(); + _clickRect.bottom = file->readNumber(); + + CGameObject::load(file); +} + +bool CCDROMComputer::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + CTreeItem *tray = getRoom()->findByName("newTray"); + if (tray) { + CStatusChangeMsg statusMsg; + statusMsg.execute(tray); + + if (!statusMsg._success) { + // Check if the mouse is within the clickable area + Rect tempRect = _clickRect; + tempRect.translate(_bounds.left, _bounds.top); + + if (!tempRect.contains(msg->_mousePos)) + return true; + } + + CActMsg actMsg("ClickedOn"); + actMsg.execute(tray); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/cdrom_computer.h b/engines/titanic/game/cdrom_computer.h new file mode 100644 index 0000000000..39fa9b9498 --- /dev/null +++ b/engines/titanic/game/cdrom_computer.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_CDROM_COMPUTER_H +#define TITANIC_CDROM_COMPUTER_H + +#include "titanic/core/game_object.h" +#include "titanic/messages/mouse_messages.h" + +namespace Titanic { + +class CCDROMComputer : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); +private: + Rect _clickRect; +public: + CLASSDEF; + CCDROMComputer(); + + /** + * 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_CDROM_COMPUTER_H */ diff --git a/engines/titanic/game/cdrom_tray.cpp b/engines/titanic/game/cdrom_tray.cpp new file mode 100644 index 0000000000..1e5b135d35 --- /dev/null +++ b/engines/titanic/game/cdrom_tray.cpp @@ -0,0 +1,127 @@ +/* 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/core/room_item.h" +#include "titanic/game/cdrom_tray.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CCDROMTray, CGameObject) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(StatusChangeMsg) +END_MESSAGE_MAP() + + +CCDROMTray::CCDROMTray() : CGameObject(), _isOpened(false) { +} + +void CCDROMTray::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_isOpened, indent); + file->writeQuotedLine(_insertedCD, indent); + + CGameObject::save(file, indent); +} + +void CCDROMTray::load(SimpleFile *file) { + file->readNumber(); + _isOpened = file->readNumber(); + _insertedCD = file->readString(); + + CGameObject::load(file); +} + +bool CCDROMTray::ActMsg(CActMsg *msg) { + if (msg->_action == "ClickedOn") { + if (_isOpened) { + // Closing the tray + if (_insertedCD == "None") { + // No CD in tray + playMovie(55, 65, 0); + playSound("a#35.wav", 50, 0, 0); + _isOpened = false; + } else { + // Ejecting tray with CD + CTreeItem *cdrom = getRoom()->findByName(_insertedCD); + if (cdrom) { + CActMsg actMsg("Ejected"); + actMsg.execute(cdrom); + } + + _insertedCD = "None"; + loadFrame(52); + } + } else if (_insertedCD == "None") { + // Opening tray with no CD + playMovie(44, 54, 0); + playSound("a#34.wav", 50, 0, 0); + _isOpened = true; + } else if (_insertedCD == "newCD1" || _insertedCD == "newCD2") { + // Opening tray with standard CD + playMovie(22, 32, 0); + playSound("a#34.wav", 50, 0, 0); + _isOpened = true; + } else if (_insertedCD == "newSTCD") { + // Opening tray with Starship Titanic CD + playMovie(0, 10, 0); + playSound("a#34.wav", 50, 0, 0); + _isOpened = true; + } + } else if (_isOpened) { + if (msg->_action == "newCD1" || msg->_action == "newCD2") { + // Standard CD dropped on CDROM Tray + playMovie(33, 43, MOVIE_NOTIFY_OBJECT); + playSound("a#35.wav", 50, 0, 0); + } else if (msg->_action == "newSTCD") { + // Starship Titanic CD dropped on CDROM Tray + playMovie(11, 21, MOVIE_NOTIFY_OBJECT); + playSound("a#35.wav", 50, 0, 0); + } else { + return true; + } + + _insertedCD = msg->_action; + _isOpened = false; + } + + return true; +} + +bool CCDROMTray::MovieEndMsg(CMovieEndMsg *msg) { + CTreeItem *screen = getRoom()->findByName("newScreen"); + + if (screen) { + CActMsg actMsg(_insertedCD); + actMsg.execute(screen); + } + + return true; +} + +bool CCDROMTray::StatusChangeMsg(CStatusChangeMsg *msg) { + msg->_success = _isOpened; + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/cdrom_tray.h b/engines/titanic/game/cdrom_tray.h new file mode 100644 index 0000000000..10fc1e145e --- /dev/null +++ b/engines/titanic/game/cdrom_tray.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_CDROM_TRAY_H +#define TITANIC_CDROM_TRAY_H + +#include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CCDROMTray : public CGameObject { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool StatusChangeMsg(CStatusChangeMsg *msg); +public: + bool _isOpened; + CString _insertedCD; +public: + CLASSDEF; + CCDROMTray(); + + /** + * 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_CDROM_TRAY_H */ diff --git a/engines/titanic/game/cell_point_button.cpp b/engines/titanic/game/cell_point_button.cpp new file mode 100644 index 0000000000..207dd73543 --- /dev/null +++ b/engines/titanic/game/cell_point_button.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/game/cell_point_button.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CCellPointButton, CBackground) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(EnterViewMsg) +END_MESSAGE_MAP() + +CCellPointButton::CCellPointButton() : CBackground() { + _fieldE0 = 0; + _fieldE4 = 0; + _fieldE8 = 0; + _fieldEC = 0; + _regionNum = 0; + _fieldF4 = 0; + _fieldF8 = 0; + _fieldFC = 0; + _field100 = 0; + _field104 = 0; + _field108 = 1; +} + +void CCellPointButton::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_regionNum, indent); + file->writeNumberLine(_fieldF4, indent); + file->writeNumberLine(_fieldF8, indent); + file->writeNumberLine(_fieldFC, indent); + file->writeNumberLine(_field100, indent); + file->writeNumberLine(_field104, indent); + file->writeNumberLine(_field108, indent); + file->writeQuotedLine(_string3, indent); + file->writeNumberLine(_dialNum, indent); + + CBackground::save(file, indent); +} + +void CCellPointButton::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + _regionNum = file->readNumber(); + _fieldF4 = file->readNumber(); + _fieldF8 = file->readNumber(); + _fieldFC = file->readNumber(); + _field100 = file->readNumber(); + _field104 = file->readNumber(); + _field108 = file->readNumber(); + _string3 = file->readString(); + _dialNum = file->readNumber(); + + CBackground::load(file); +} + +bool CCellPointButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (getRandomNumber(2) == 0) { + CParrotSpeakMsg speakMsg("Cellpoints", _string3); + speakMsg.execute("PerchedParrot"); + } + + playMovie(0); + _regionNum = _regionNum ? 0 : 1; + playSound("z#425.wav"); + talkSetDialRegion(_string3, _dialNum, _regionNum); + + return true; +} + +bool CCellPointButton::EnterViewMsg(CEnterViewMsg *msg) { + _regionNum = talkGetDialRegion(_string3, _dialNum); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/cell_point_button.h b/engines/titanic/game/cell_point_button.h new file mode 100644 index 0000000000..33f58cbb83 --- /dev/null +++ b/engines/titanic/game/cell_point_button.h @@ -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. + * + */ + +#ifndef TITANIC_CELL_POINT_BUTTON_H +#define TITANIC_CELL_POINT_BUTTON_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CCellPointButton : public CBackground { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); +public: + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; + int _regionNum; + int _fieldF4; + int _fieldF8; + int _fieldFC; + int _field100; + int _field104; + int _field108; + CString _string3; + int _dialNum; +public: + CLASSDEF; + CCellPointButton(); + + /** + * 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_CELL_POINT_BUTTON_H */ diff --git a/engines/titanic/game/chev_code.cpp b/engines/titanic/game/chev_code.cpp new file mode 100644 index 0000000000..0acdf575f4 --- /dev/null +++ b/engines/titanic/game/chev_code.cpp @@ -0,0 +1,285 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/chev_code.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CChevCode, CGameObject) + ON_MESSAGE(SetChevLiftBits) + ON_MESSAGE(SetChevClassBits) + ON_MESSAGE(SetChevFloorBits) + ON_MESSAGE(SetChevRoomBits) + ON_MESSAGE(GetChevLiftNum) + ON_MESSAGE(GetChevClassNum) + ON_MESSAGE(GetChevFloorNum) + ON_MESSAGE(GetChevRoomNum) + ON_MESSAGE(CheckChevCode) + ON_MESSAGE(GetChevCodeFromRoomNameMsg) +END_MESSAGE_MAP() + +void CChevCode::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_chevCode, indent); + CGameObject::save(file, indent); +} + +void CChevCode::load(SimpleFile *file) { + file->readNumber(); + _chevCode = file->readNumber(); + CGameObject::load(file); +} + +bool CChevCode::SetChevLiftBits(CSetChevLiftBits *msg) { + _chevCode &= ~0xC0000; + if (msg->_liftNum > 0 && msg->_liftNum < 5) + _chevCode = ((msg->_liftNum - 1) << 18) | _chevCode; + + return true; +} + +bool CChevCode::SetChevClassBits(CSetChevClassBits *msg) { + _chevCode &= ~0x30000; + if (msg->_classNum > 0 && msg->_classNum < 4) + _chevCode = (msg->_classNum << 16) | msg->_classNum; + + return true; +} + +bool CChevCode::SetChevFloorBits(CSetChevFloorBits *msg) { + int section = (msg->_floorNum + 4) / 10; + int index = (msg->_floorNum + 4) % 10; + _chevCode &= ~0xFF00; + + int val = 0; + switch (section) { + case 0: + val = 144; + break; + case 1: + val = 208; + break; + case 2: + val = 224; + break; + case 3: + val = 240; + break; + default: + break; + } + + _chevCode |= ((index + val) << 8); + return true; +} + +bool CChevCode::SetChevRoomBits(CSetChevRoomBits *msg) { + _chevCode &= ~0xff; + if (msg->_roomNum > 0 && msg->_roomNum < 128) + _chevCode |= msg->_roomNum * 2; + + return true; +} + +bool CChevCode::GetChevLiftNum(CGetChevLiftNum *msg) { + msg->_liftNum = ((_chevCode >> 18) & 3) + 1; + return true; +} + +bool CChevCode::GetChevClassNum(CGetChevClassNum *msg) { + msg->_classNum = (_chevCode >> 16) & 3; + return true; +} + +bool CChevCode::GetChevFloorNum(CGetChevFloorNum *msg) { + int val1 = (_chevCode >> 8) & 0xF; + int val2 = ((_chevCode >> 12) & 0xF) - 9; + + switch (val2) { + case 0: + val2 = 0; + break; + case 4: + val2 = 1; + break; + case 5: + val2 = 2; + break; + case 6: + val2 = 3; + break; + default: + val2 = 4; + break; + } + + msg->_floorNum = (val1 >= 10) ? 0 : val1 * 10; + return true; +} + +bool CChevCode::GetChevRoomNum(CGetChevRoomNum *msg) { + msg->_roomNum = (_chevCode >> 1) & 0x7F; + return true; +} + +bool CChevCode::CheckChevCode(CCheckChevCode *msg) { + CGetChevClassNum getClassMsg; + CGetChevLiftNum getLiftMsg; + CGetChevFloorNum getFloorMsg; + CGetChevRoomNum getRoomMsg; + CString roomName; + int classNum = 0; + uint bits = 0; + + if (_chevCode & 1) { + switch (_chevCode) { + case 0x1D0D9: + roomName = "ParrLobby"; + classNum = 4; + break; + case 0x196D9: + roomName = "FCRestrnt"; + classNum = 4; + break; + case 0x39FCB: + roomName = "Bridge"; + classNum = 4; + break; + case 0x2F86D: + roomName = "CrtrsCham"; + classNum = 4; + break; + case 0x465FB: + roomName = "SculpCham"; + classNum = 4; + break; + case 0x3D94B: + roomName = "BilgeRoom"; + classNum = 4; + break; + case 0x59FAD: + roomName = "BoWell"; + classNum = 4; + break; + case 0x4D6AF: + roomName = "Arboretum"; + classNum = 4; + break; + case 0x8A397: + roomName = "TitRoom"; + classNum = 4; + break; + case 0x79C45: + roomName = "PromDeck"; + classNum = 4; + break; + case 0xB3D97: + roomName = "Bar"; + classNum = 4; + break; + case 0xCC971: + roomName = "EmbLobby"; + classNum = 4; + break; + case 0xF34DB: + roomName = "MusicRoom"; + classNum = 4; + break; + default: + roomName = "BadRoom"; + classNum = 5; + break; + } + + bits = classNum == 5 ? 0x3D94B : _chevCode; + } else { + getFloorMsg.execute(this); + getRoomMsg.execute(this); + getClassMsg.execute(this); + getLiftMsg.execute(this); + if (getFloorMsg._floorNum > 37 || getRoomMsg._roomNum > 18) + classNum = 5; + + if (classNum == 5) { + bits = 0x3D94B; + } else { + switch (getClassMsg._classNum) { + case 1: + if (getFloorMsg._floorNum >= 2 && getFloorMsg._floorNum <= 18 + && getRoomMsg._roomNum >= 1 && getRoomMsg._roomNum <= 3 + && getLiftMsg._liftNum >= 1 && getLiftMsg._liftNum <= 4) + classNum = 1; + else + classNum = 5; + break; + + case 2: + if (getFloorMsg._floorNum >= 19 && getFloorMsg._floorNum <= 26 + && getRoomMsg._roomNum >= 1 && getRoomMsg._roomNum <= 5 + && getLiftMsg._liftNum >= 1 && getLiftMsg._liftNum <= 4) + classNum = 2; + else + classNum = 5; + break; + + case 3: + if (getFloorMsg._floorNum >= 27 && getFloorMsg._floorNum <= 37 + && getRoomMsg._roomNum >= 1 && getRoomMsg._roomNum <= 18 + && (getLiftMsg._liftNum & 1) == 1 + && getLiftMsg._liftNum >= 1 && getLiftMsg._liftNum <= 4) + classNum = 3; + else + classNum = 5; + break; + } + } + } + + msg->_classNum = classNum; + msg->_chevCode = bits; + + // WORKAROUND: Skipped code from original that was for debugging purposes only + return true; +} + +bool CChevCode::GetChevCodeFromRoomNameMsg(CGetChevCodeFromRoomNameMsg *msg) { + static const char *const ROOM_NAMES[13] = { + "ParrotLobby", "sculptureChamber", "Bar", "EmbLobby", "MusicRoom", + "Titania", "BottomOfWell", "Arboretum", "PromenadeDeck", + "FCRestrnt", "CrtrsCham", "BilgeRoom", "Bridge" + }; + static const uint CHEV_CODES[13] = { + 0x1D0D9, 0x465FB, 0xB3D97, 0xCC971, 0xF34DB, 0x8A397, 0x59FAD, + 0x4D6AF, 0x79C45, 0x196D9, 0x2F86D, 0x3D94B, 0x39FCB + }; + + for (int idx = 0; idx < 13; ++idx) { + if (msg->_roomName == ROOM_NAMES[idx]) { + msg->_chevCode = CHEV_CODES[idx]; + break; + } + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/chev_code.h b/engines/titanic/game/chev_code.h new file mode 100644 index 0000000000..4a71b13f9e --- /dev/null +++ b/engines/titanic/game/chev_code.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_CHEV_CODE_H +#define TITANIC_CHEV_CODE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CChevCode : public CGameObject { + DECLARE_MESSAGE_MAP; + bool SetChevLiftBits(CSetChevLiftBits *msg); + bool SetChevClassBits(CSetChevClassBits *msg); + bool SetChevFloorBits(CSetChevFloorBits *msg); + bool SetChevRoomBits(CSetChevRoomBits *msg); + bool GetChevLiftNum(CGetChevLiftNum *msg); + bool GetChevClassNum(CGetChevClassNum *msg); + bool GetChevFloorNum(CGetChevFloorNum *msg); + bool GetChevRoomNum(CGetChevRoomNum *msg); + bool CheckChevCode(CCheckChevCode *msg); + bool GetChevCodeFromRoomNameMsg(CGetChevCodeFromRoomNameMsg *msg); +public: + int _chevCode; +public: + CLASSDEF; + CChevCode() : CGameObject(), _chevCode(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_CHEV_CODE_H */ diff --git a/engines/titanic/game/chev_panel.cpp b/engines/titanic/game/chev_panel.cpp new file mode 100644 index 0000000000..ed730c9d61 --- /dev/null +++ b/engines/titanic/game/chev_panel.cpp @@ -0,0 +1,121 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/chev_panel.h" +#include "titanic/game/chev_code.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CChevPanel, CGameObject) + ON_MESSAGE(MouseDragStartMsg) + ON_MESSAGE(MouseDragMoveMsg) + ON_MESSAGE(MouseButtonUpMsg) + ON_MESSAGE(SetChevPanelBitMsg) + ON_MESSAGE(MouseDragEndMsg) + ON_MESSAGE(ClearChevPanelBits) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(SetChevPanelButtonsMsg) +END_MESSAGE_MAP() + +void CChevPanel::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_startPos.x, indent); + file->writeNumberLine(_startPos.y, indent); + file->writeNumberLine(_chevCode, indent); + + CGameObject::save(file, indent); +} + +void CChevPanel::load(SimpleFile *file) { + file->readNumber(); + _startPos.x = file->readNumber(); + _startPos.y = file->readNumber(); + _chevCode = file->readNumber(); + + CGameObject::load(file); +} + +bool CChevPanel::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (checkStartDragging(msg)) { + _startPos = Point(msg->_mousePos.x - _bounds.left, + msg->_mousePos.y - _bounds.top); + CChildDragStartMsg dragMsg(_startPos); + dragMsg.execute(this, nullptr, MSGFLAG_SCAN); + } + + return true; +} + +bool CChevPanel::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { + CChildDragMoveMsg dragMsg(_startPos); + dragMsg.execute(this, nullptr, MSGFLAG_SCAN); + + setPosition(msg->_mousePos - _startPos); + return true; +} + +bool CChevPanel::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + CChevCode chevCode; + chevCode._chevCode = _chevCode; + CCheckChevCode checkCode; + checkCode.execute(this); + CClearChevPanelBits panelBits; + panelBits.execute(this, nullptr, MSGFLAG_SCAN); + CSetChevPanelButtonsMsg setMsg; + setMsg._chevCode = checkCode._chevCode; + setMsg.execute(this); + + return true; +} + +bool CChevPanel::SetChevPanelBitMsg(CSetChevPanelBitMsg *msg) { + _chevCode = (_chevCode & ~(1 << msg->_value1)) | (msg->_value2 << msg->_value1); + return true; +} + +bool CChevPanel::MouseDragEndMsg(CMouseDragEndMsg *msg) { + setPosition(msg->_mousePos - _startPos); + return true; +} + +bool CChevPanel::ClearChevPanelBits(CClearChevPanelBits *msg) { + CSetChevPanelButtonsMsg setMsg; + setMsg._chevCode = 0; + setMsg.execute(this); + + return true; +} + +bool CChevPanel::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return true; +} + +bool CChevPanel::SetChevPanelButtonsMsg(CSetChevPanelButtonsMsg *msg) { + _chevCode = msg->_chevCode; + CSetChevButtonImageMsg setMsg; + setMsg._value2 = 1; + setMsg.execute(this, nullptr, MSGFLAG_SCAN); + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/chev_panel.h b/engines/titanic/game/chev_panel.h new file mode 100644 index 0000000000..bcfb920221 --- /dev/null +++ b/engines/titanic/game/chev_panel.h @@ -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. + * + */ + +#ifndef TITANIC_CHEV_PANEL_H +#define TITANIC_CHEV_PANEL_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CChevPanel : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseDragStartMsg(CMouseDragStartMsg *msg); + bool MouseDragMoveMsg(CMouseDragMoveMsg *msg); + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); + bool SetChevPanelBitMsg(CSetChevPanelBitMsg *msg); + bool MouseDragEndMsg(CMouseDragEndMsg *msg); + bool ClearChevPanelBits(CClearChevPanelBits *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool SetChevPanelButtonsMsg(CSetChevPanelButtonsMsg *msg); +public: + Point _startPos; + int _chevCode; +public: + CLASSDEF; + CChevPanel() : _chevCode(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_CHEV_PANEL_H */ diff --git a/engines/titanic/game/chicken_cooler.cpp b/engines/titanic/game/chicken_cooler.cpp new file mode 100644 index 0000000000..d10405de38 --- /dev/null +++ b/engines/titanic/game/chicken_cooler.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/game/chicken_cooler.h" +#include "titanic/carry/chicken.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CChickenCooler, CGameObject) + ON_MESSAGE(EnterRoomMsg) + ON_MESSAGE(EnterViewMsg) +END_MESSAGE_MAP() + +void CChickenCooler::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + + CGameObject::save(file, indent); +} + +void CChickenCooler::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + + CGameObject::load(file); +} + +bool CChickenCooler::EnterRoomMsg(CEnterRoomMsg *msg) { + if (_fieldC0) { + CGameObject *obj = getMailManFirstObject(); + if (obj) { + // WORKAROUND: Redundant loop for chicken in originalhere + } else { + getNextMail(nullptr); + if (CChicken::_v1 > _fieldBC) + CChicken::_v1 = _fieldBC; + } + } + + return true; +} + +bool CChickenCooler::EnterViewMsg(CEnterViewMsg *msg) { + if (!_fieldC0) { + for (CGameObject *obj = getMailManFirstObject(); obj; + obj = getNextMail(obj)) { + if (obj->isEquals("Chicken")) + return true; + } + + if (CChicken::_v1 > _fieldBC) + CChicken::_v1 = _fieldBC; + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/chicken_cooler.h b/engines/titanic/game/chicken_cooler.h new file mode 100644 index 0000000000..54dba90686 --- /dev/null +++ b/engines/titanic/game/chicken_cooler.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_CHICKEN_COOLER_H +#define TITANIC_CHICKEN_COOLER_H + +#include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CChickenCooler : public CGameObject { + DECLARE_MESSAGE_MAP; + bool EnterRoomMsg(CEnterRoomMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); +private: + int _fieldBC; + int _fieldC0; +public: + CLASSDEF; + CChickenCooler() : CGameObject(), _fieldBC(0), _fieldC0(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_CHICKEN_COOLER_H */ diff --git a/engines/titanic/game/chicken_dispensor.cpp b/engines/titanic/game/chicken_dispensor.cpp new file mode 100644 index 0000000000..7fb8fefcda --- /dev/null +++ b/engines/titanic/game/chicken_dispensor.cpp @@ -0,0 +1,189 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/chicken_dispensor.h" +#include "titanic/core/project_item.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CChickenDispensor, CBackground) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(MouseDragStartMsg) + ON_MESSAGE(TurnOff) +END_MESSAGE_MAP() + +CChickenDispensor::CChickenDispensor() : CBackground(), + _fieldE0(0), _fieldE4(0), _fieldE8(0) { +} + +void CChickenDispensor::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + CBackground::save(file, indent); +} + +void CChickenDispensor::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + + CBackground::load(file); +} + +bool CChickenDispensor::StatusChangeMsg(CStatusChangeMsg *msg) { + msg->execute("SGTRestLeverAnimation"); + int v1 = _fieldE8 ? 0 : _fieldE4; + CPetControl *pet = getPetControl(); + CGameObject *obj; + + for (obj = pet->getFirstObject(); obj; obj = pet->getNextObject(obj)) { + if (obj->isEquals("Chicken")) { + petDisplayMessage(1, "Chickens are allocated on a one-per-customer basis."); + return true; + } + } + + for (obj = getMailManFirstObject(); obj; obj = getNextMail(obj)) { + if (obj->isEquals("Chicken")) { + petDisplayMessage(1, "Chickens are allocated on a one-per-customer basis."); + return true; + } + } + + if (v1 == 1 || v1 == 2) + _fieldE8 = 1; + + switch (v1) { + case 0: + petDisplayMessage(1, "Only one piece of chicken per passenger. Thank you."); + break; + case 1: + setVisible(true); + if (_fieldE0) { + playMovie(0, 12, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playSound("z#400.wav"); + _fieldE4 = 0; + } else { + playMovie(12, 16, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + _fieldE8 = 1; + _fieldE4 = 0; + } + break; + + case 2: + setVisible(true); + if (_fieldE0) { + playMovie(0, 12, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playSound("z#400.wav"); + } else { + playMovie(12, 16, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + _fieldE8 = 1; + } + break; + + default: + break; + } + + return true; +} + +bool CChickenDispensor::MovieEndMsg(CMovieEndMsg *msg) { + if (getMovieFrame() == 16) { + playSound("b#50.wav", 50); + CActMsg actMsg("Dispense Chicken"); + actMsg.execute("Chicken"); + } else if (_fieldE8) { + _cursorId = CURSOR_ARROW; + loadFrame(0); + setVisible(false); + if (_fieldE4 == 2) + _fieldE8 = 0; + } else { + loadFrame(0); + setVisible(false); + changeView("SgtLobby.Node 1.N"); + } + + return true; +} + +bool CChickenDispensor::ActMsg(CActMsg *msg) { + if (msg->_action == "EnableObject") + _fieldE0 = 0; + else if (msg->_action == "DisableObject") + _fieldE0 = 1; + else if (msg->_action == "IncreaseQuantity") + _fieldE4 = 2; + else if (msg->_action == "DecreaseQuantity") + _fieldE4 = 1; + + return true; +} + +bool CChickenDispensor::LeaveViewMsg(CLeaveViewMsg *msg) { + return true; +} + +bool CChickenDispensor::EnterViewMsg(CEnterViewMsg *msg) { + playSound("b#51.wav"); + _fieldE8 = 0; + _cursorId = CURSOR_ARROW; + return true; +} + +bool CChickenDispensor::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (getMovieFrame() == 16) { + setVisible(false); + loadFrame(0); + _cursorId = CURSOR_ARROW; + _fieldE8 = 1; + + CVisibleMsg visibleMsg; + visibleMsg.execute("Chicken"); + CPassOnDragStartMsg passMsg(msg->_mousePos, 1); + passMsg.execute("Chicken"); + + msg->_dragItem = getRoot()->findByName("Chicken"); + } + + return true; +} + +bool CChickenDispensor::TurnOff(CTurnOff *msg) { + if (getMovieFrame() == 16) + setVisible(false); + playMovie(16, 12, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + _fieldE8 = 0; + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/chicken_dispensor.h b/engines/titanic/game/chicken_dispensor.h new file mode 100644 index 0000000000..5e3ba47ee8 --- /dev/null +++ b/engines/titanic/game/chicken_dispensor.h @@ -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. + * + */ + +#ifndef TITANIC_CHICKEN_DISPENSOR_H +#define TITANIC_CHICKEN_DISPENSOR_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CChickenDispensor : public CBackground { + DECLARE_MESSAGE_MAP; + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool ActMsg(CActMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); + bool TurnOff(CTurnOff *msg); +public: + int _fieldE0; + int _fieldE4; + int _fieldE8; +public: + CLASSDEF; + CChickenDispensor(); + + /** + * 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_DISPENSOR_H */ diff --git a/engines/titanic/game/close_broken_pel.cpp b/engines/titanic/game/close_broken_pel.cpp new file mode 100644 index 0000000000..c234590849 --- /dev/null +++ b/engines/titanic/game/close_broken_pel.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/game/close_broken_pel.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CCloseBrokenPel, CBackground) + ON_MESSAGE(MouseButtonDownMsg) +END_MESSAGE_MAP() + +void CCloseBrokenPel::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_target, indent); + CBackground::save(file, indent); +} + +void CCloseBrokenPel::load(SimpleFile *file) { + file->readNumber(); + _target = file->readString(); + CBackground::load(file); +} + +bool CCloseBrokenPel::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + CActMsg actMsg("Close"); + actMsg.execute(_target); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/close_broken_pel.h b/engines/titanic/game/close_broken_pel.h new file mode 100644 index 0000000000..4bd66255df --- /dev/null +++ b/engines/titanic/game/close_broken_pel.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_CLOSE_BROKEN_PEL_H +#define TITANIC_CLOSE_BROKEN_PEL_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CCloseBrokenPel : public CBackground { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); +public: + CString _target; +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_CLOSE_BROKEN_PEL_H */ diff --git a/engines/titanic/game/code_wheel.cpp b/engines/titanic/game/code_wheel.cpp new file mode 100644 index 0000000000..94ee25435a --- /dev/null +++ b/engines/titanic/game/code_wheel.cpp @@ -0,0 +1,108 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/code_wheel.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CodeWheel, CBomb) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(MouseButtonUpMsg) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + +CodeWheel::CodeWheel() : CBomb(), _field108(0), _state(4), _field110(0) { +} + +void CodeWheel::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field108, indent); + file->writeNumberLine(_state, indent); + file->writeNumberLine(_field110, indent); + + CBomb::save(file, indent); +} + +void CodeWheel::load(SimpleFile *file) { + file->readNumber(); + _field108 = file->readNumber(); + _state = file->readNumber(); + _field110 = file->readNumber(); + + CBomb::load(file); +} + +bool CodeWheel::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + static const int START_FRAMES[15] = { + 0, 5, 10, 15, 19, 24, 28, 33, 38, 42, 47, 52, 57, 61, 66 + }; + static const int END_FRAMES[15] = { + 5, 10, 15, 19, 24, 28, 33, 38, 42, 47, 52, 57, 61, 66, 70 + }; + + int yp = _bounds.top + _bounds.height() / 2; + if (msg->_mousePos.y > yp) { + if (_state == _field108) + _field110 = true; + + _state = (_state + 1) % 15; + playMovie(START_FRAMES[_state], END_FRAMES[_state], + MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + } else { + if (_state == _field108) + _field110 = true; + + playMovie(START_FRAMES[14 - _state] + 68, END_FRAMES[14 - _state] + 68, + MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + + _state = (_state <= 0) ? 14 : _state - 1; + } + + playSound("z#59.wav"); + return true; +} + +bool CodeWheel::EnterViewMsg(CEnterViewMsg *msg) { + loadFrame(24); + _state = 4; + return true; +} + +bool CodeWheel::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + return true; +} + +bool CodeWheel::MovieEndMsg(CMovieEndMsg *msg) { + sleep(200); + CStatusChangeMsg changeMsg; + changeMsg._newStatus = 0; + if (_field110) + changeMsg._newStatus = -1; + if (_field108 == _state) + changeMsg._newStatus = 1; + changeMsg.execute("Bomb"); + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/code_wheel.h b/engines/titanic/game/code_wheel.h new file mode 100644 index 0000000000..e38a45b631 --- /dev/null +++ b/engines/titanic/game/code_wheel.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_CODE_WHEEL_H +#define TITANIC_CODE_WHEEL_H + +#include "titanic/game/bomb.h" + +namespace Titanic { + +class CodeWheel : public CBomb { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); +private: + int _field108; + int _state; + int _field110; +public: + CLASSDEF; + CodeWheel(); + + /** + * 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_CODE_WHEEL_H */ diff --git a/engines/titanic/game/computer.cpp b/engines/titanic/game/computer.cpp new file mode 100644 index 0000000000..90574997b1 --- /dev/null +++ b/engines/titanic/game/computer.cpp @@ -0,0 +1,106 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/computer.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CComputer, CBackground) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + +void CComputer::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_currentCD, indent); + file->writeNumberLine(_state, indent); + CBackground::save(file, indent); +} + +void CComputer::load(SimpleFile *file) { + file->readNumber(); + _currentCD = file->readString(); + _state = file->readNumber(); + CBackground::load(file); +} + +bool CComputer::ActMsg(CActMsg *msg) { + if (_state) { + playSound("a#35.wav", 100, 0, 0); + playMovie(32, 42, 0); + + if (msg->_action == "CD1") + playMovie(43, 49, 0); + else if (msg->_action == "CD2") + playMovie(50, 79, 0); + else if (msg->_action == "STCD") + playMovie(80, 90, 4); + + _currentCD = msg->_action; + _state = 0; + } + + return true; +} + +bool CComputer::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_currentCD == "None") { + if (_state) { + playSound("a#35.wav", 100, 0, 0); + playMovie(11, 21, 0); + _state = 0; + } else { + playSound("a#34.wav", 100, 0, 0); + playMovie(0, 10, 0); + _state = 1; + } + } else { + if (_state) { + loadFrame(11); + CActMsg actMsg("EjectCD"); + actMsg.execute(_currentCD); + _currentCD = "None"; + } else { + playSound("a#34.wav", 100, 0, 0); + playMovie(21, 31, 0); + _state = 1; + } + } + + return true; +} + +bool CComputer::MovieEndMsg(CMovieEndMsg *msg) { + if (msg->_endFrame == 90) { + playSound("a#32.wav", 100, 0, 0); + playSound("a#33.wav", 100, 0, 0); + playSound("a#31.wav", 100, 0, 0); + playSound("a#0.wav", 100, 0, 0); + + gotoView("Home.Node 4.E", "_TRACK,3,e-cu,4,E"); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/computer.h b/engines/titanic/game/computer.h new file mode 100644 index 0000000000..6acdba27ea --- /dev/null +++ b/engines/titanic/game/computer.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_COMPUTER_H +#define TITANIC_COMPUTER_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CComputer : public CBackground { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); +public: + CString _currentCD; + int _state; +public: + CLASSDEF; + CComputer() : CBackground(), _currentCD("None"), _state(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_COMPUTER_H */ diff --git a/engines/titanic/game/computer_screen.cpp b/engines/titanic/game/computer_screen.cpp new file mode 100644 index 0000000000..3e5172219d --- /dev/null +++ b/engines/titanic/game/computer_screen.cpp @@ -0,0 +1,140 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/computer_screen.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CComputerScreen, CGameObject) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(TimerMsg) +END_MESSAGE_MAP() + +CComputerScreen::CComputerScreen() : CGameObject() { +} + +void CComputerScreen::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CComputerScreen::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +bool CComputerScreen::ActMsg(CActMsg *msg) { + if (msg->_action == "newCD1" || msg->_action == "newCD2") { + playMovie(27, 53, MOVIE_GAMESTATE); + playMovie(19, 26, MOVIE_GAMESTATE); + } else if (msg->_action == "newSTCD") { + playMovie(0, 18, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + } + + return true; +} + +bool CComputerScreen::MovieEndMsg(CMovieEndMsg *msg) { + playSound("z#47.wav", 100, 0, 0); + addTimer(0, 3000, 0); + + for (int idx = 0; idx < 10; ++idx) + playMovie(0, 18, 0); + return true; +} + +bool CComputerScreen::EnterViewMsg(CEnterViewMsg *msg) { + loadFrame(26); + return true; +} + +bool CComputerScreen::TimerMsg(CTimerMsg *msg) { + int handle; + + switch (msg->_actionVal) { + case 0: + loadSound("a#32.wav"); + loadSound("a#31.wav"); + loadSound("a#33.wav"); + loadSound("a#30.wav"); + loadSound("a#29.wav"); + playSound("a#25.wav"); + addTimer(1, 2000, 0); + break; + + case 1: + playSound("a#32.wav"); + playSound("a#31.wav"); + addTimer(2, 2000, 0); + break; + + case 2: { + CChangeMusicMsg musicMsg(CString(), 1); + musicMsg.execute("HomeMusicPlayer"); + playSound("a#33.wav"); + playSound("a#31.wav"); + changeView("Home.Node 4.E", ""); + playClip(51, 150); + playSound("a#31.wav"); + playClip(151, 200); + + handle = playSound("a#27.wav"); + playClip(200, 306); + playSound("a#30.wav"); + stopSound(handle, 0); + + playClip(306, 338); + handle = playSound("a#28.wav"); + playClip(338, 392); + playSound("a#29.wav"); + stopSound(handle); + + playSound("y#662.wav"); + setSoundVolume(handle, 10, 2); + playClip(392, 450); + startTalking("Doorbot", 0x3611A); + sleep(8000); + + playClip(450, 492); + startTalking("Doorbot", 0x36121); + playClip(492, 522); + setSoundVolume(handle, 30, 2); + + playClip(523, 540); + setSoundVolume(handle, 0, 1); + + playClip(541, 551); + stopSound(handle); + break; + } + + default: + break; + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/computer_screen.h b/engines/titanic/game/computer_screen.h new file mode 100644 index 0000000000..8fb1dcd4dc --- /dev/null +++ b/engines/titanic/game/computer_screen.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_COMPUTER_SCREEN_H +#define TITANIC_COMPUTER_SCREEN_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CComputerScreen : public CGameObject { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool TimerMsg(CTimerMsg *msg); +public: + CLASSDEF; + CComputerScreen(); + + /** + * 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_COMPUTER_SCREEN_H */ diff --git a/engines/titanic/game/cookie.cpp b/engines/titanic/game/cookie.cpp new file mode 100644 index 0000000000..96edca4058 --- /dev/null +++ b/engines/titanic/game/cookie.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/game/cookie.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CCookie, CGameObject) + ON_MESSAGE(LeaveNodeMsg) + ON_MESSAGE(FreshenCookieMsg) +END_MESSAGE_MAP() + +void CCookie::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value1, indent); + file->writeNumberLine(_value2, indent); + + CGameObject::save(file, indent); +} + +void CCookie::load(SimpleFile *file) { + file->readNumber(); + _value1 = file->readNumber(); + _value2 = file->readNumber(); + + CGameObject::load(file); +} + +bool CCookie::LeaveNodeMsg(CLeaveNodeMsg *msg) { + if (_value2) + _value1 = 1; + return true; +} + +bool CCookie::FreshenCookieMsg(CFreshenCookieMsg *msg) { + _value1 = msg->_value2; + _value2 = msg->_value1; + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/cookie.h b/engines/titanic/game/cookie.h new file mode 100644 index 0000000000..2018deeb3e --- /dev/null +++ b/engines/titanic/game/cookie.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_COOKIE_H +#define TITANIC_COOKIE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CCookie : public CGameObject { + DECLARE_MESSAGE_MAP; + bool LeaveNodeMsg(CLeaveNodeMsg *msg); + bool FreshenCookieMsg(CFreshenCookieMsg *msg); +public: + int _value1; + int _value2; +public: + CLASSDEF; + CCookie() : CGameObject(), _value1(0), _value2(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_COOKIE_H */ diff --git a/engines/titanic/game/credits.cpp b/engines/titanic/game/credits.cpp new file mode 100644 index 0000000000..d9149f6dd2 --- /dev/null +++ b/engines/titanic/game/credits.cpp @@ -0,0 +1,81 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/credits.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CCredits, CGameObject) + ON_MESSAGE(SignalObject) + ON_MESSAGE(TimerMsg) +END_MESSAGE_MAP() + +CCredits::CCredits() : CGameObject(), _fieldBC(-1), _fieldC0(1) { +} + +void CCredits::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + + CGameObject::save(file, indent); +} + +void CCredits::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + + CGameObject::load(file); +} + +bool CCredits::SignalObject(CSignalObject *msg) { + petHide(); + disableMouse(); + addTimer(50); + return true; +} + +bool CCredits::TimerMsg(CTimerMsg *msg) { + stopGlobalSound(true, -1); + setVisible(true); + loadSound("a#16.wav"); + loadSound("a#24.wav"); + + playCutscene(0, 18); + playGlobalSound("a#16.wav", -1, false, false, 0); + playCutscene(19, 642); + playSound("a#24.wav"); + playCutscene(643, 750); + + COpeningCreditsMsg creditsMsg; + creditsMsg.execute("Service Elevator Entity"); + changeView("EmbLobby.Node 6.S"); + + setVisible(false); + petShow(); + enableMouse(); + stopGlobalSound(true, -1); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/credits.h b/engines/titanic/game/credits.h new file mode 100644 index 0000000000..23fd25584d --- /dev/null +++ b/engines/titanic/game/credits.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_CREDITS_H +#define TITANIC_CREDITS_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CCredits : public CGameObject { + DECLARE_MESSAGE_MAP; + bool SignalObject(CSignalObject *msg); + bool TimerMsg(CTimerMsg *msg); +public: + int _fieldBC, _fieldC0; +public: + CLASSDEF; + CCredits(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CREDITS_H */ diff --git a/engines/titanic/game/credits_button.cpp b/engines/titanic/game/credits_button.cpp new file mode 100644 index 0000000000..ee8f7bb329 --- /dev/null +++ b/engines/titanic/game/credits_button.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/game/credits_button.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CCreditsButton, CBackground) + ON_MESSAGE(MouseButtonUpMsg) + ON_MESSAGE(MouseButtonDownMsg) +END_MESSAGE_MAP() + +CCreditsButton::CCreditsButton() : CBackground(), _fieldE0(1) { +} + +void CCreditsButton::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + CBackground::save(file, indent); +} + +void CCreditsButton::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + CBackground::load(file); +} + +bool CCreditsButton::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + return true; +} + +bool CCreditsButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_fieldE0) { + playSound("a#20.wav"); + CSignalObject signalMsg; + signalMsg._numValue = 1; + signalMsg.execute("CreditsPlayer"); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/credits_button.h b/engines/titanic/game/credits_button.h new file mode 100644 index 0000000000..4a53083195 --- /dev/null +++ b/engines/titanic/game/credits_button.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_CREDITS_BUTTON_H +#define TITANIC_CREDITS_BUTTON_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CCreditsButton : public CBackground { + DECLARE_MESSAGE_MAP; + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); +public: + int _fieldE0; +public: + CLASSDEF; + CCreditsButton(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CREDITS_BUTTON_H */ diff --git a/engines/titanic/game/dead_area.cpp b/engines/titanic/game/dead_area.cpp new file mode 100644 index 0000000000..3c41ab34ba --- /dev/null +++ b/engines/titanic/game/dead_area.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/game/dead_area.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CDeadArea, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MouseButtonUpMsg) +END_MESSAGE_MAP() + +CDeadArea::CDeadArea() : CGameObject() { +} + +void CDeadArea::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CDeadArea::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/dead_area.h b/engines/titanic/game/dead_area.h new file mode 100644 index 0000000000..fdb44ef5df --- /dev/null +++ b/engines/titanic/game/dead_area.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_DEAD_AREA_H +#define TITANIC_DEAD_AREA_H + +#include "titanic/core/game_object.h" +#include "titanic/messages/mouse_messages.h" + +namespace Titanic { + +/** + * Implements a non-responsive screen area + */ +class CDeadArea : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return true; } + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg) { return true; } +public: + CLASSDEF; + CDeadArea(); + + /** + * 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_DEAD_AREA_H */ diff --git a/engines/titanic/game/desk_click_responder.cpp b/engines/titanic/game/desk_click_responder.cpp new file mode 100644 index 0000000000..0650b3a1f5 --- /dev/null +++ b/engines/titanic/game/desk_click_responder.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/game/desk_click_responder.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CDeskClickResponder, CClickResponder) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(LoadSuccessMsg) +END_MESSAGE_MAP() + +void CDeskClickResponder::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldD4, indent); + file->writeNumberLine(_ticks, indent); + + CClickResponder::save(file, indent); +} + +void CDeskClickResponder::load(SimpleFile *file) { + file->readNumber(); + _fieldD4 = file->readNumber(); + _ticks = file->readNumber(); + + CClickResponder::load(file); +} + +bool CDeskClickResponder::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + _fieldD4 = (_fieldD4 + 1) % 3; + if (_fieldD4) + return CClickResponder::MouseButtonDownMsg(msg); + + uint ticks = getTicksCount(); + if (!_ticks || ticks > (_ticks + 4000)) { + playSound("a#22.wav"); + _ticks = ticks; + } + + return true; +} + +bool CDeskClickResponder::LoadSuccessMsg(CLoadSuccessMsg *msg) { + _ticks = 0; + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/desk_click_responder.h b/engines/titanic/game/desk_click_responder.h new file mode 100644 index 0000000000..13cf7f4b87 --- /dev/null +++ b/engines/titanic/game/desk_click_responder.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_DESK_CLICK_RESPONDER_H +#define TITANIC_DESK_CLICK_RESPONDER_H + +#include "titanic/core/click_responder.h" + +namespace Titanic { + +class CDeskClickResponder : public CClickResponder { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool LoadSuccessMsg(CLoadSuccessMsg *msg); +protected: + int _fieldD4; + uint _ticks; +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_DESK_CLICK_RESPONDER_H */ diff --git a/engines/titanic/game/doorbot_elevator_handler.cpp b/engines/titanic/game/doorbot_elevator_handler.cpp new file mode 100644 index 0000000000..39978e9ed7 --- /dev/null +++ b/engines/titanic/game/doorbot_elevator_handler.cpp @@ -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. + * + */ + +#include "titanic/game/doorbot_elevator_handler.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CDoorbotElevatorHandler, CGameObject) + ON_MESSAGE(EnterNodeMsg) +END_MESSAGE_MAP() + +void CDoorbotElevatorHandler::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + file->writeNumberLine(_called, indent); + CGameObject::save(file, indent); +} + +void CDoorbotElevatorHandler::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + _called = file->readNumber(); + CGameObject::load(file); +} + +bool CDoorbotElevatorHandler::EnterNodeMsg(CEnterNodeMsg *msg) { + if (!_called) { + CDoorbotNeededInElevatorMsg elevatorMsg; + elevatorMsg._value = 0; + elevatorMsg.execute("Doorbot"); + _called = true; + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/doorbot_elevator_handler.h b/engines/titanic/game/doorbot_elevator_handler.h new file mode 100644 index 0000000000..f846273f14 --- /dev/null +++ b/engines/titanic/game/doorbot_elevator_handler.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_DOORBOT_ELEVATOR_HANDLER_H +#define TITANIC_DOORBOT_ELEVATOR_HANDLER_H + +#include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CDoorbotElevatorHandler : public CGameObject { + DECLARE_MESSAGE_MAP; + bool EnterNodeMsg(CEnterNodeMsg *msg); +private: + bool _called; + int _value; +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_DOORBOT_ELEVATOR_HANDLER_H */ diff --git a/engines/titanic/game/doorbot_home_handler.cpp b/engines/titanic/game/doorbot_home_handler.cpp new file mode 100644 index 0000000000..92898ca626 --- /dev/null +++ b/engines/titanic/game/doorbot_home_handler.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/game/doorbot_home_handler.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CDoorbotHomeHandler, CGameObject) + ON_MESSAGE(EnterViewMsg) +END_MESSAGE_MAP() + +CDoorbotHomeHandler::CDoorbotHomeHandler() { +} + +void CDoorbotHomeHandler::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CDoorbotHomeHandler::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +bool CDoorbotHomeHandler::EnterViewMsg(CEnterViewMsg *msg) { + CDoorbotNeededInHomeMsg neededMsg; + neededMsg.execute("Doorbot"); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/doorbot_home_handler.h b/engines/titanic/game/doorbot_home_handler.h new file mode 100644 index 0000000000..10552f2b87 --- /dev/null +++ b/engines/titanic/game/doorbot_home_handler.h @@ -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. + * + */ + +#ifndef TITANIC_DOORBOT_HOME_HANDLER_H +#define TITANIC_DOORBOT_HOME_HANDLER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CDoorbotHomeHandler : public CGameObject { + DECLARE_MESSAGE_MAP; + bool EnterViewMsg(CEnterViewMsg *msg); +public: + CLASSDEF; + CDoorbotHomeHandler(); + + /** + * 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_DOORBOT_HOME_HANDLER_H */ diff --git a/engines/titanic/game/ear_sweet_bowl.cpp b/engines/titanic/game/ear_sweet_bowl.cpp new file mode 100644 index 0000000000..646b95f0b4 --- /dev/null +++ b/engines/titanic/game/ear_sweet_bowl.cpp @@ -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. + * + */ + +#include "titanic/game/ear_sweet_bowl.h" +#include "titanic/core/room_item.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CEarSweetBowl, CSweetBowl) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(ReplaceBowlAndNutsMsg) +END_MESSAGE_MAP() + +void CEarSweetBowl::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CSweetBowl::save(file, indent); +} + +void CEarSweetBowl::load(SimpleFile *file) { + file->readNumber(); + CSweetBowl::load(file); +} + +bool CEarSweetBowl::MovieEndMsg(CMovieEndMsg *msg) { + CIsEarBowlPuzzleDone doneMsg; + doneMsg.execute(findRoom()); + + if (!doneMsg._value) { + CPetControl *pet = getPetControl(); + if (pet) + pet->hasRoomFlags(); + + CIsParrotPresentMsg parrotMsg; + parrotMsg.execute(findRoom()); + + if (parrotMsg._value) { + CNutPuzzleMsg nutMsg("Jiggle"); + nutMsg.execute("NutsParrotPlayer"); + } + } + + return true; +} + +bool CEarSweetBowl::ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg) { + setVisible(false); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/ear_sweet_bowl.h b/engines/titanic/game/ear_sweet_bowl.h new file mode 100644 index 0000000000..1324ed224a --- /dev/null +++ b/engines/titanic/game/ear_sweet_bowl.h @@ -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. + * + */ + +#ifndef TITANIC_EAR_SWEET_BOWL_H +#define TITANIC_EAR_SWEET_BOWL_H + +#include "titanic/game/sweet_bowl.h" + +namespace Titanic { + +class CEarSweetBowl : public CSweetBowl { + DECLARE_MESSAGE_MAP; + bool MovieEndMsg(CMovieEndMsg *msg); + bool ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *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_EAR_SWEET_BOWL_H */ diff --git a/engines/titanic/game/eject_phonograph_button.cpp b/engines/titanic/game/eject_phonograph_button.cpp new file mode 100644 index 0000000000..b2ff441ef8 --- /dev/null +++ b/engines/titanic/game/eject_phonograph_button.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/game/eject_phonograph_button.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CEjectPhonographButton, CBackground) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(CylinderHolderReadyMsg) +END_MESSAGE_MAP() + +void CEjectPhonographButton::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_ejected, indent); + file->writeNumberLine(_readyFlag, indent); + file->writeQuotedLine(_soundName, indent); + file->writeQuotedLine(_readySoundName, indent); + + CBackground::save(file, indent); +} + +void CEjectPhonographButton::load(SimpleFile *file) { + file->readNumber(); + _ejected = file->readNumber(); + _readyFlag = file->readNumber(); + _soundName = file->readString(); + _readySoundName = file->readString(); + + CBackground::load(file); +} + +bool CEjectPhonographButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + CQueryPhonographState queryMsg; + queryMsg.execute(getParent(), nullptr, MSGFLAG_SCAN); + + if (!_ejected && !queryMsg._value) { + loadFrame(1); + playSound(_soundName); + _readyFlag = true; + + CEjectCylinderMsg ejectMsg; + ejectMsg.execute(getParent(), nullptr, MSGFLAG_SCAN); + _ejected = true; + } + + return true; +} + +bool CEjectPhonographButton::CylinderHolderReadyMsg(CCylinderHolderReadyMsg *msg) { + if (_readyFlag) { + loadFrame(0); + playSound(_readySoundName); + _readyFlag = 0; + } + + _ejected = false; + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/eject_phonograph_button.h b/engines/titanic/game/eject_phonograph_button.h new file mode 100644 index 0000000000..df8e602468 --- /dev/null +++ b/engines/titanic/game/eject_phonograph_button.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_EJECT_PHONOGRAPH_BUTTON_H +#define TITANIC_EJECT_PHONOGRAPH_BUTTON_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CEjectPhonographButton : public CBackground { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool CylinderHolderReadyMsg(CCylinderHolderReadyMsg *msg); +public: + bool _ejected; + bool _readyFlag; + CString _soundName; + CString _readySoundName; +public: + CLASSDEF; + CEjectPhonographButton() : CBackground(), _ejected(false), _readyFlag(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_EJECT_PHONOGRAPH_BUTTON_H */ diff --git a/engines/titanic/game/elevator_action_area.cpp b/engines/titanic/game/elevator_action_area.cpp new file mode 100644 index 0000000000..d59c9b9e7a --- /dev/null +++ b/engines/titanic/game/elevator_action_area.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/game/elevator_action_area.h" +#include "titanic/core/room_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CElevatorActionArea, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) +END_MESSAGE_MAP() + +void CElevatorActionArea::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CElevatorActionArea::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +bool CElevatorActionArea::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + CServiceElevatorMsg elevMsg(_value); + elevMsg.execute(findRoom()->findByName("Service Elevator Entity")); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/elevator_action_area.h b/engines/titanic/game/elevator_action_area.h new file mode 100644 index 0000000000..75d3a06d29 --- /dev/null +++ b/engines/titanic/game/elevator_action_area.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_ELEVATOR_ACTION_AREA_H +#define TITANIC_ELEVATOR_ACTION_AREA_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CElevatorActionArea : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); +public: + int _value; +public: + CLASSDEF; + CElevatorActionArea() : CGameObject(), _value(4) {} + + /** + * 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_ELEVATOR_ACTION_AREA_H */ diff --git a/engines/titanic/game/emma_control.cpp b/engines/titanic/game/emma_control.cpp new file mode 100644 index 0000000000..e3ba7cc42c --- /dev/null +++ b/engines/titanic/game/emma_control.cpp @@ -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. + * + */ + +#include "titanic/game/emma_control.h" +#include "titanic/core/room_item.h" +#include "titanic/sound/auto_music_player.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CEmmaControl, CBackground) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(StatusChangeMsg) +END_MESSAGE_MAP() + +void CEmmaControl::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_flag, indent); + file->writeQuotedLine(_hiddenSoundName, indent); + file->writeQuotedLine(_visibleSoundName, indent); + + CBackground::save(file, indent); +} + +void CEmmaControl::load(SimpleFile *file) { + file->readNumber(); + _flag = file->readNumber(); + _hiddenSoundName = file->readString(); + _visibleSoundName = file->readString(); + + CBackground::load(file); +} + +bool CEmmaControl::EnterViewMsg(CEnterViewMsg *msg) { + setVisible(_flag); + return true; +} + +bool CEmmaControl::StatusChangeMsg(CStatusChangeMsg *msg) { + _flag = !_flag; + setVisible(_flag); + CChangeMusicMsg changeMsg(_flag ? _visibleSoundName : _hiddenSoundName, 0); + changeMsg.execute(findRoom(), CAutoMusicPlayer::_type, + MSGFLAG_SCAN | MSGFLAG_BREAK_IF_HANDLED | MSGFLAG_CLASS_DEF); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/emma_control.h b/engines/titanic/game/emma_control.h new file mode 100644 index 0000000000..e4032ca1a5 --- /dev/null +++ b/engines/titanic/game/emma_control.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_EMMA_CONTROL_H +#define TITANIC_EMMA_CONTROL_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CEmmaControl : public CBackground { + DECLARE_MESSAGE_MAP; + bool EnterViewMsg(CEnterViewMsg *msg); + bool StatusChangeMsg(CStatusChangeMsg *msg); +private: + bool _flag; + + CString _hiddenSoundName; + CString _visibleSoundName; +public: + CLASSDEF; + CEmmaControl() : CBackground(), _flag(false), + _hiddenSoundName("b#39.wav"), _visibleSoundName("b#38.wav") {} + + /** + * 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_EMMA_CONTROL_H */ diff --git a/engines/titanic/game/empty_nut_bowl.cpp b/engines/titanic/game/empty_nut_bowl.cpp new file mode 100644 index 0000000000..adee2589f6 --- /dev/null +++ b/engines/titanic/game/empty_nut_bowl.cpp @@ -0,0 +1,78 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/empty_nut_bowl.h" +#include "titanic/core/room_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CEmptyNutBowl, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(ReplaceBowlAndNutsMsg) + ON_MESSAGE(NutPuzzleMsg) + ON_MESSAGE(MouseDragStartMsg) +END_MESSAGE_MAP() + +void CEmptyNutBowl::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_flag, indent); + CGameObject::save(file, indent); +} + +void CEmptyNutBowl::load(SimpleFile *file) { + file->readNumber(); + _flag = file->readNumber(); + CGameObject::load(file); +} + +bool CEmptyNutBowl::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_flag) { + CNutPuzzleMsg nutMsg("UnlockBowl"); + nutMsg.execute(getRoom(), nullptr, MSGFLAG_SCAN); + _flag = false; + } + + return true; +} + +bool CEmptyNutBowl::ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg) { + setVisible(false); + _flag = true; + return true; +} + +bool CEmptyNutBowl::NutPuzzleMsg(CNutPuzzleMsg *msg) { + if (msg->_value == "NutsGone") + setVisible(true); + return true; +} + +bool CEmptyNutBowl::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (!_flag) { + msg->execute("Ear1"); + setVisible(false); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/empty_nut_bowl.h b/engines/titanic/game/empty_nut_bowl.h new file mode 100644 index 0000000000..d67e75b0aa --- /dev/null +++ b/engines/titanic/game/empty_nut_bowl.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_EMPTY_NUT_BOWL_H +#define TITANIC_EMPTY_NUT_BOWL_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CEmptyNutBowl : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg); + bool NutPuzzleMsg(CNutPuzzleMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); +public: + bool _flag; +public: + CLASSDEF; + CEmptyNutBowl() : CGameObject(), _flag(true) {} + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_EMPTY_NUT_BOWL_H */ diff --git a/engines/titanic/game/end_credit_text.cpp b/engines/titanic/game/end_credit_text.cpp new file mode 100644 index 0000000000..4eee13d3fb --- /dev/null +++ b/engines/titanic/game/end_credit_text.cpp @@ -0,0 +1,72 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/end_credit_text.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CEndCreditText, CGameObject) + ON_MESSAGE(ActMsg) + ON_MESSAGE(FrameMsg) + ON_MESSAGE(TimerMsg) +END_MESSAGE_MAP() + +void CEndCreditText::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_flag, indent); + CGameObject::save(file, indent); +} + +void CEndCreditText::load(SimpleFile *file) { + file->readNumber(); + _flag = file->readNumber(); + CGameObject::load(file); +} + +bool CEndCreditText::ActMsg(CActMsg *msg) { + playGlobalSound("z#41.wav", -1, false, false, 0); + createCredits(); + _flag = true; + return true; +} + +bool CEndCreditText::FrameMsg(CFrameMsg *msg) { + if (_flag) { + if (_credits) { + makeDirty(); + } else { + addTimer(5000); + _flag = false; + } + } + + return true; +} + +bool CEndCreditText::TimerMsg(CTimerMsg *msg) { + setGlobalSoundVolume(-4, 2, -1); + sleep(1000); + quitGame(); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/end_credit_text.h b/engines/titanic/game/end_credit_text.h new file mode 100644 index 0000000000..a0e0078837 --- /dev/null +++ b/engines/titanic/game/end_credit_text.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_END_CREDIT_TEXT_H +#define TITANIC_END_CREDIT_TEXT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CEndCreditText : public CGameObject { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool FrameMsg(CFrameMsg *msg); + bool TimerMsg(CTimerMsg *msg); +private: + bool _flag; +public: + CLASSDEF; + CEndCreditText() : CGameObject(), _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_END_CREDIT_TEXT_H */ diff --git a/engines/titanic/game/end_credits.cpp b/engines/titanic/game/end_credits.cpp new file mode 100644 index 0000000000..f613e5a008 --- /dev/null +++ b/engines/titanic/game/end_credits.cpp @@ -0,0 +1,64 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/end_credits.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CEndCredits, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(FrameMsg) +END_MESSAGE_MAP() + +void CEndCredits::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_flag, indent); + CGameObject::save(file, indent); +} + +void CEndCredits::load(SimpleFile *file) { + file->readNumber(); + _flag = file->readNumber(); + CGameObject::load(file); +} + +bool CEndCredits::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_flag) { + deinit(); + stopGlobalSound(true, -1); + _flag = false; + } else { + loadSound("z#41.wav"); + playGlobalSound("z#41.wav", -1, false, false, 0); + _flag = true; + } + + return true; +} + +bool CEndCredits::FrameMsg(CFrameMsg *msg) { + if (_flag) + makeDirty(); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/end_credits.h b/engines/titanic/game/end_credits.h new file mode 100644 index 0000000000..257c5b64a7 --- /dev/null +++ b/engines/titanic/game/end_credits.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_END_CREDITS_H +#define TITANIC_END_CREDITS_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CEndCredits : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool FrameMsg(CFrameMsg *msg); +public: + bool _flag; +public: + CLASSDEF; + CEndCredits() : CGameObject(), _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_END_CREDITS_H */ diff --git a/engines/titanic/game/end_explode_ship.cpp b/engines/titanic/game/end_explode_ship.cpp new file mode 100644 index 0000000000..10c80f5863 --- /dev/null +++ b/engines/titanic/game/end_explode_ship.cpp @@ -0,0 +1,107 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/end_explode_ship.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CEndExplodeShip, CGameObject) + ON_MESSAGE(ActMsg) + ON_MESSAGE(TimerMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(MovieFrameMsg) +END_MESSAGE_MAP() + +void CEndExplodeShip::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value1, indent); + file->writeNumberLine(_value2, indent); + + CGameObject::save(file, indent); +} + +void CEndExplodeShip::load(SimpleFile *file) { + file->readNumber(); + _value1 = file->readNumber(); + _value2 = file->readNumber(); + + CGameObject::load(file); +} + +bool CEndExplodeShip::ActMsg(CActMsg *msg) { + if (msg->_action == "Arm Bomb") { + _value1 = 1; + } else if (msg->_action == "Disarm Bomb") { + _value1 = 0; + } else if (msg->_action == "TakeOff") { + loadSound("a#31.wav"); + loadSound("a#14.wav"); + playGlobalSound("a#13.wav", -1, true, true, 0); + addTimer(1, 10212, 0); + } + + return true; +} + +bool CEndExplodeShip::TimerMsg(CTimerMsg *msg) { + if (msg->_actionVal == 1) { + setVisible(true); + playMovie(0, 449, 0); + movieEvent(58); + playMovie(516, _value1 ? 550 : 551, MOVIE_NOTIFY_OBJECT); + } + + if (msg->_actionVal == 3) { + setGlobalSoundVolume(-4, 2, -1); + CActMsg actMsg(_value1 ? "ExplodeCredits" : "Credits"); + actMsg.execute("EndGameCredits"); + } + + if (msg->_action == "Room") { + playMovie(550, 583, MOVIE_NOTIFY_OBJECT); + movieEvent(551); + } + + return true; +} + +bool CEndExplodeShip::MovieEndMsg(CMovieEndMsg *msg) { + if (getMovieFrame() == 550) { + playSound("z#399.wav"); + startAnimTimer("Boom", 4200, 0); + } else { + addTimer(3, 8000, 0); + } + + return true; +} + +bool CEndExplodeShip::MovieFrameMsg(CMovieFrameMsg *msg) { + if (getMovieFrame() == 58) + playSound("a#31.wav", 70); + else if (getMovieFrame() == 551) + playSound("a#14.wav"); + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/end_explode_ship.h b/engines/titanic/game/end_explode_ship.h new file mode 100644 index 0000000000..c48f822af8 --- /dev/null +++ b/engines/titanic/game/end_explode_ship.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_END_EXPLODE_SHIP_H +#define TITANIC_END_EXPLODE_SHIP_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CEndExplodeShip : public CGameObject { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool TimerMsg(CTimerMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool MovieFrameMsg(CMovieFrameMsg *msg); +public: + int _value1, _value2; +public: + CLASSDEF; + CEndExplodeShip() : CGameObject(), _value1(0), _value2(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_END_EXPLODE_SHIP_H */ diff --git a/engines/titanic/game/end_game_credits.cpp b/engines/titanic/game/end_game_credits.cpp new file mode 100644 index 0000000000..4edcef0a17 --- /dev/null +++ b/engines/titanic/game/end_game_credits.cpp @@ -0,0 +1,87 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/end_game_credits.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CEndGameCredits, CGameObject) + ON_MESSAGE(ActMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(TimerMsg) +END_MESSAGE_MAP() + +CEndGameCredits::CEndGameCredits() : CGameObject(), _flag(0), + _frameRange(0, 28) { +} + +void CEndGameCredits::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_flag, indent); + file->writePoint(_frameRange, indent); + + CGameObject::save(file, indent); +} + +void CEndGameCredits::load(SimpleFile *file) { + file->readNumber(); + _flag = file->readNumber(); + _frameRange = file->readPoint(); + + CGameObject::load(file); +} + +bool CEndGameCredits::ActMsg(CActMsg *msg) { + if (!_flag) { + if (msg->_action == "ExplodeCredits") + _frameRange = Point(0, 27); + if (msg->_action == "Credits") + _frameRange = Point(28, 46); + + changeView("TheEnd.Node 4.N"); + } + + return true; +} + +bool CEndGameCredits::EnterViewMsg(CEnterViewMsg *msg) { + playMovie(_frameRange.x, _frameRange.y, MOVIE_NOTIFY_OBJECT); + return true; +} + +bool CEndGameCredits::MovieEndMsg(CMovieEndMsg *msg) { + if (getMovieFrame() == 46) { + CVisibleMsg visibleMsg; + visibleMsg.execute("CreditsBackdrop"); + } + + return true; +} + +bool CEndGameCredits::TimerMsg(CTimerMsg *msg) { + CActMsg actMsg; + actMsg.execute("EndCreditsText"); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/end_game_credits.h b/engines/titanic/game/end_game_credits.h new file mode 100644 index 0000000000..13a92423f6 --- /dev/null +++ b/engines/titanic/game/end_game_credits.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_END_GAME_CREDITS_H +#define TITANIC_END_GAME_CREDITS_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CEndGameCredits : public CGameObject { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool TimerMsg(CTimerMsg *msg); +private: + bool _flag; + Point _frameRange; +public: + CLASSDEF; + CEndGameCredits(); + + /** + * 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_END_GAME_CREDITS_H */ diff --git a/engines/titanic/game/end_sequence_control.cpp b/engines/titanic/game/end_sequence_control.cpp new file mode 100644 index 0000000000..033a7752a3 --- /dev/null +++ b/engines/titanic/game/end_sequence_control.cpp @@ -0,0 +1,84 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/end_sequence_control.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CEndSequenceControl, CGameObject) + ON_MESSAGE(TimerMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(EnterRoomMsg) + ON_MESSAGE(EnterViewMsg) +END_MESSAGE_MAP() + +void CEndSequenceControl::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CEndSequenceControl::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +bool CEndSequenceControl::TimerMsg(CTimerMsg *msg) { + switch (msg->_actionVal) { + case 1: + changeView("TheEnd.Node 2.N"); + break; + case 2: { + playSound("ShipFlyingMusic.wav"); + CActMsg actMsg("TakeOff"); + actMsg.execute("EndExplodeShip"); + break; + } + + default: + break; + } + + return true; +} + +bool CEndSequenceControl::MovieEndMsg(CMovieEndMsg *msg) { + setGlobalSoundVolume(-4, 2, -1); + changeView("TheEnd.Node 3.N"); + addTimer(2, 1000, 0); + return true; +} + +bool CEndSequenceControl::EnterRoomMsg(CEnterRoomMsg *msg) { + petHide(); + disableMouse(); + addTimer(1, 1000, 0); + playGlobalSound("a#15.wav", -1, true, true, 0); + return true; +} + +bool CEndSequenceControl::EnterViewMsg(CEnterViewMsg *msg) { + movieSetAudioTiming(true); + playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/end_sequence_control.h b/engines/titanic/game/end_sequence_control.h new file mode 100644 index 0000000000..223f25186d --- /dev/null +++ b/engines/titanic/game/end_sequence_control.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_END_SEQUENCE_CONTROL_H +#define TITANIC_END_SEQUENCE_CONTROL_H + +#include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CEndSequenceControl : public CGameObject { + DECLARE_MESSAGE_MAP; + bool TimerMsg(CTimerMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool EnterRoomMsg(CEnterRoomMsg *msg); + bool EnterViewMsg(CEnterViewMsg *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_END_SEQUENCE_CONTROL_H */ diff --git a/engines/titanic/game/fan.cpp b/engines/titanic/game/fan.cpp new file mode 100644 index 0000000000..3fdebbd3ef --- /dev/null +++ b/engines/titanic/game/fan.cpp @@ -0,0 +1,126 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/fan.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CFan, CGameObject) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + +void CFan::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_state, indent); + file->writeNumberLine(_value2, indent); + + CGameObject::save(file, indent); +} + +void CFan::load(SimpleFile *file) { + file->readNumber(); + _state = file->readNumber(); + _value2 = file->readNumber(); + + CGameObject::load(file); +} + +bool CFan::EnterViewMsg(CEnterViewMsg *msg) { + switch (_state) { + case 0: + case 1: + loadFrame(0); + break; + case 2: + playMovie(24, 34, MOVIE_REPEAT); + break; + case 3: + playMovie(63, 65, MOVIE_REPEAT); + break; + } + + return true; +} + +bool CFan::StatusChangeMsg(CStatusChangeMsg *msg) { + if (msg->_newStatus >= -1 && msg->_newStatus < 3) { + int oldState = _state; + _state = msg->_newStatus; + switch (_state) { + case -1: + case 0: + if (oldState == 0) + loadFrame(0); + else if (oldState == 1) + playMovie(24, 34, MOVIE_STOP_PREVIOUS | MOVIE_NOTIFY_OBJECT); + else if (oldState == 2) { + playMovie(66, 79, MOVIE_STOP_PREVIOUS); + playMovie(24, 34, MOVIE_NOTIFY_OBJECT); + } + break; + + case 1: + if (oldState == 0) + playMovie(24, 34, MOVIE_REPEAT | MOVIE_STOP_PREVIOUS); + if (oldState == 2) + playMovie(66, 79, MOVIE_NOTIFY_OBJECT | MOVIE_STOP_PREVIOUS); + break; + + case 2: + if (oldState == 1) + playMovie(48, 62, MOVIE_NOTIFY_OBJECT | MOVIE_STOP_PREVIOUS); + break; + + default: + break; + } + } + + msg->execute("PromDeckFanNoises"); + return true; +} + +bool CFan::MovieEndMsg(CMovieEndMsg *msg) { + switch (_state) { + case -1: + case 0: + loadFrame(0); + break; + + case 1: + playMovie(24, 34, MOVIE_REPEAT); + break; + + case 2: + playMovie(63, 65, MOVIE_REPEAT); + break; + + default: + break; + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/fan.h b/engines/titanic/game/fan.h new file mode 100644 index 0000000000..9cffce8b68 --- /dev/null +++ b/engines/titanic/game/fan.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_FAN_H +#define TITANIC_FAN_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CFan : public CGameObject { + DECLARE_MESSAGE_MAP; + bool EnterViewMsg(CEnterViewMsg *msg); + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); +public: + int _state, _value2; +public: + CLASSDEF; + CFan() : CGameObject(), _state(0), _value2(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_FAN_H */ diff --git a/engines/titanic/game/fan_control.cpp b/engines/titanic/game/fan_control.cpp new file mode 100644 index 0000000000..56a1e49dec --- /dev/null +++ b/engines/titanic/game/fan_control.cpp @@ -0,0 +1,182 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/fan_control.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CFanControl, CGameObject) + ON_MESSAGE(ActMsg) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(TimerMsg) +END_MESSAGE_MAP() + +CFanControl::CFanControl() : CGameObject(), _state(-1), + _enabled(false), _fieldC4(0), _fieldC8(false), _fieldCC(0) { +} + +void CFanControl::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_state, indent); + file->writeNumberLine(_enabled, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_fieldCC, indent); + + CGameObject::save(file, indent); +} + +void CFanControl::load(SimpleFile *file) { + file->readNumber(); + _state = file->readNumber(); + _enabled = file->readNumber(); + _fieldC4 = file->readNumber(); + _fieldC8 = file->readNumber(); + _fieldCC = file->readNumber(); + + CGameObject::load(file); +} + +bool CFanControl::ActMsg(CActMsg *msg) { + if (msg->_action == "EnableObject") + _enabled = true; + else if (msg->_action == "DisableObject") + _enabled = false; + else if (msg->_action == "StarlingsDead") { + _fieldC4 = 0; + dec54(); + _fieldCC = 0; + } + + return true; +} + +bool CFanControl::StatusChangeMsg(CStatusChangeMsg *msg) { + if (!_fieldCC) { + playSound("z#42.wav"); + if (_enabled) { + switch (msg->_newStatus) { + case 1: + _fieldC8 = !_fieldC8; + if (_fieldC8) { + playMovie(6, 8, 0); + _state = 0; + } else { + switch (_state) { + case 0: + playMovie(4, 6, 0); + _state = -1; + break; + case 1: + playMovie(0, 6, 0); + break; + case 2: + playMovie(18, 24, 0); + playMovie(0, 6, 0); + break; + default: + break; + } + + _state = -1; + } + break; + + case 2: + if (_fieldC8) { + _state = (_state + 1) % 4; + switch (_state) { + case 0: + playMovie(18, 24, 0); + playMovie(0, 4, 0); + break; + case 1: + playMovie(8, 12, 0); + break; + case 2: + if (_fieldC4) { + inc54(); + _fieldCC = 1; + playMovie(12, 18, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + } else { + playMovie(12, 18, 0); + } + break; + default: + break; + } + } + break; + + default: + break; + } + + CStatusChangeMsg statusMsg; + statusMsg._newStatus = _state; + statusMsg.execute("RightFan"); + } else { + petDisplayMessage(1, "Unfortunately this fan controller has blown a fuse."); + } + } + + return true; +} + +bool CFanControl::EnterViewMsg(CEnterViewMsg *msg) { + switch (_state) { + case 0: + loadFrame(6); + break; + case 1: + loadFrame(4); + break; + case 2: + loadFrame(0); + break; + case 3: + loadFrame(18); + break; + default: + break; + } + + return true; +} + +bool CFanControl::MovieEndMsg(CMovieEndMsg *msg) { + addTimer(2000); + return true; +} + +bool CFanControl::TimerMsg(CTimerMsg *msg) { + CStatusChangeMsg statusMsg; + statusMsg._newStatus = 1; + statusMsg.execute("StarlingPuret"); + changeView("PromenadeDeck.Node 3.S"); + changeView("PromenadeDeck.Node 3.E"); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/fan_control.h b/engines/titanic/game/fan_control.h new file mode 100644 index 0000000000..1f7402db12 --- /dev/null +++ b/engines/titanic/game/fan_control.h @@ -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. + * + */ + +#ifndef TITANIC_FAN_CONTROL_H +#define TITANIC_FAN_CONTROL_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CFanControl : public CGameObject { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool TimerMsg(CTimerMsg *msg); +public: + int _state; + bool _enabled; + int _fieldC4; + bool _fieldC8; + int _fieldCC; +public: + CLASSDEF; + CFanControl(); + + /** + * 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_FAN_CONTROL_H */ diff --git a/engines/titanic/game/fan_decrease.cpp b/engines/titanic/game/fan_decrease.cpp new file mode 100644 index 0000000000..b0b9cc585f --- /dev/null +++ b/engines/titanic/game/fan_decrease.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/game/fan_decrease.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CFanDecrease, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) +END_MESSAGE_MAP() + +void CFanDecrease::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CFanDecrease::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +bool CFanDecrease::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + CStatusChangeMsg statusMsg; + statusMsg._newStatus = 2; + statusMsg.execute("FanController"); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/fan_decrease.h b/engines/titanic/game/fan_decrease.h new file mode 100644 index 0000000000..2e90d09a3f --- /dev/null +++ b/engines/titanic/game/fan_decrease.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_FAN_DECREASE_H +#define TITANIC_FAN_DECREASE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CFanDecrease : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *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_FAN_DECREASE_H */ diff --git a/engines/titanic/game/fan_increase.cpp b/engines/titanic/game/fan_increase.cpp new file mode 100644 index 0000000000..abd2e019d3 --- /dev/null +++ b/engines/titanic/game/fan_increase.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/game/fan_increase.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CFanIncrease, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) +END_MESSAGE_MAP() + +void CFanIncrease::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CFanIncrease::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +bool CFanIncrease::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + CStatusChangeMsg statusMsg; + statusMsg._newStatus = 1; + statusMsg.execute("FanController"); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/fan_increase.h b/engines/titanic/game/fan_increase.h new file mode 100644 index 0000000000..7ed74e1847 --- /dev/null +++ b/engines/titanic/game/fan_increase.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_FAN_INCREASE_H +#define TITANIC_FAN_INCREASE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CFanIncrease : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *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_FAN_INCREASE_H */ diff --git a/engines/titanic/game/fan_noises.cpp b/engines/titanic/game/fan_noises.cpp new file mode 100644 index 0000000000..c6e6d203dd --- /dev/null +++ b/engines/titanic/game/fan_noises.cpp @@ -0,0 +1,206 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/fan_noises.h" +#include "titanic/core/room_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CFanNoises, CGameObject) + ON_MESSAGE(EnterRoomMsg) + ON_MESSAGE(LeaveRoomMsg) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(SetVolumeMsg) + ON_MESSAGE(LoadSuccessMsg) +END_MESSAGE_MAP() + +CFanNoises::CFanNoises() : CGameObject(), _state(-1), + _soundHandle(0), _soundPercent(70), _soundV3(-1), _soundSeconds(0), + _stopSeconds(0), _startFlag(true) { +} + +void CFanNoises::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_state, indent); + file->writeNumberLine(_soundHandle, indent); + file->writeNumberLine(_soundPercent, indent); + file->writeNumberLine(_soundV3, indent); + file->writeNumberLine(_soundSeconds, indent); + file->writeNumberLine(_stopSeconds, indent); + file->writeNumberLine(_startFlag, indent); + + CGameObject::save(file, indent); +} + +void CFanNoises::load(SimpleFile *file) { + file->readNumber(); + _state = file->readNumber(); + _soundHandle = file->readNumber(); + _soundPercent = file->readNumber(); + _soundV3 = file->readNumber(); + _soundSeconds = file->readNumber(); + _stopSeconds = file->readNumber(); + _startFlag = file->readNumber(); + + CGameObject::load(file); +} + +bool CFanNoises::EnterRoomMsg(CEnterRoomMsg *msg) { + if (getParent() == msg->_newRoom) { + if (_soundHandle != -1) { + if (isSoundActive(_soundHandle)) + stopSound(_soundHandle, _stopSeconds); + _soundHandle = -1; + _startFlag = false; + } + + switch (_state) { + case 1: + _soundHandle = playSound("b#60.wav", 0, _soundV3, true); + setSoundVolume(_soundHandle, _soundPercent, _soundSeconds); + _startFlag = true; + break; + case 2: + _soundHandle = playSound("b#58.wav", 0, _soundV3, true); + setSoundVolume(_soundHandle, _soundPercent, _soundSeconds); + _startFlag = true; + break; + default: + break; + } + } + + return true; +} + +bool CFanNoises::LeaveRoomMsg(CLeaveRoomMsg *msg) { + if (getParent() == msg->_oldRoom && _soundHandle != -1) { + if (isSoundActive(_soundHandle)) + stopSound(_soundHandle, _stopSeconds); + + _soundHandle = -1; + _startFlag = false; + } + + return true; +} + +bool CFanNoises::StatusChangeMsg(CStatusChangeMsg *msg) { + if (msg->_newStatus >= -1 && msg->_newStatus <= 2) { + int oldState = _state; + _state = msg->_newStatus; + + switch (msg->_newStatus) { + case -1: + case 0: + if (_soundHandle != -1) { + if (isSoundActive(_soundHandle)) + stopSound(_soundHandle, 1); + _soundHandle = -1; + _startFlag = false; + } + + switch (oldState) { + case 1: + case 2: + playSound("b#59.wav", _soundPercent, _soundV3); + break; + default: + break; + } + break; + + case 1: + if (_soundHandle != -1) { + if (isSoundActive(_soundHandle)) + stopSound(_soundHandle, 1); + _soundHandle = -1; + _startFlag = false; + } + + switch (oldState) { + case 1: + case 2: + _soundHandle = playSound("b#60.wav", _soundPercent, _soundV3); + break; + default: + break; + } + break; + + case 2: + if (_soundHandle != -1) { + if (isSoundActive(_soundHandle)) + stopSound(_soundHandle, 1); + _soundHandle = -1; + _startFlag = false; + } + + if (oldState == 1) { + _soundHandle = playSound("b#58.wav", _soundPercent, _soundV3); + } + break; + + default: + break; + } + } + + return true; +} + +bool CFanNoises::SetVolumeMsg(CSetVolumeMsg *msg) { + _soundPercent = msg->_volume; + + if (_soundHandle != -1 && isSoundActive(_soundHandle)) + setSoundVolume(_soundHandle, _soundPercent, msg->_secondsTransition); + + return true; +} + +bool CFanNoises::LoadSuccessMsg(CLoadSuccessMsg *msg) { + if (_startFlag) { + _startFlag = false; + _soundHandle = -1; + + switch (_state) { + case 1: + playSound("b#60.wav", 0, _soundV3, true); + setSoundVolume(_soundHandle, _soundPercent, _soundSeconds); + _startFlag = true; + break; + + case 2: + playSound("b#58.wav", 0, _soundV3, true); + setSoundVolume(_soundHandle, _soundPercent, _soundSeconds); + _startFlag = true; + break; + + default: + break; + } + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/fan_noises.h b/engines/titanic/game/fan_noises.h new file mode 100644 index 0000000000..56c80c0764 --- /dev/null +++ b/engines/titanic/game/fan_noises.h @@ -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. + * + */ + +#ifndef TITANIC_FAN_NOISES_H +#define TITANIC_FAN_NOISES_H + +#include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CFanNoises : public CGameObject { + DECLARE_MESSAGE_MAP; + bool EnterRoomMsg(CEnterRoomMsg *msg); + bool LeaveRoomMsg(CLeaveRoomMsg *msg); + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool SetVolumeMsg(CSetVolumeMsg *msg); + bool LoadSuccessMsg(CLoadSuccessMsg *msg); +private: + int _state; + int _soundHandle; + int _soundPercent; + int _soundV3; + int _soundSeconds; + int _stopSeconds; + bool _startFlag; +public: + CLASSDEF; + CFanNoises(); + + /** + * 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_FAN_NOISES_H */ diff --git a/engines/titanic/game/floor_indicator.cpp b/engines/titanic/game/floor_indicator.cpp new file mode 100644 index 0000000000..3afb03c59d --- /dev/null +++ b/engines/titanic/game/floor_indicator.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/game/floor_indicator.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CFloorIndicator, CGameObject) + ON_MESSAGE(EnterViewMsg) +END_MESSAGE_MAP() + +void CFloorIndicator::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CFloorIndicator::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +bool CFloorIndicator::EnterViewMsg(CEnterViewMsg *msg) { + int floorNum = MAX(1, getPetControl()->getRoomsFloorNum()); + loadFrame(floorNum - 1); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/floor_indicator.h b/engines/titanic/game/floor_indicator.h new file mode 100644 index 0000000000..38a1757ad0 --- /dev/null +++ b/engines/titanic/game/floor_indicator.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_FLOOR_INDICATOR_H +#define TITANIC_FLOOR_INDICATOR_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CFloorIndicator : public CGameObject { + DECLARE_MESSAGE_MAP; + bool EnterViewMsg(CEnterViewMsg *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_FLOOR_INDICATOR_H */ diff --git a/engines/titanic/game/games_console.cpp b/engines/titanic/game/games_console.cpp new file mode 100644 index 0000000000..40311f70ee --- /dev/null +++ b/engines/titanic/game/games_console.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/game/games_console.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CGamesConsole, CBackground) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(LeaveViewMsg) +END_MESSAGE_MAP() + +void CGamesConsole::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_active, indent); + CBackground::save(file, indent); +} + +void CGamesConsole::load(SimpleFile *file) { + file->readNumber(); + _active = file->readNumber(); + CBackground::load(file); +} + +bool CGamesConsole::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_active) { + playMovie(23, 44, 0); + _active = false; + } else { + playMovie(0, 23, 0); + _active = true; + } + + return true; +} + +bool CGamesConsole::LeaveViewMsg(CLeaveViewMsg *msg) { + if (_active) { + _active = false; + playMovie(23, 44, MOVIE_GAMESTATE); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/games_console.h b/engines/titanic/game/games_console.h new file mode 100644 index 0000000000..f849fd08cc --- /dev/null +++ b/engines/titanic/game/games_console.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_GAMES_CONSOLE_H +#define TITANIC_GAMES_CONSOLE_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CGamesConsole : public CBackground { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); +public: + bool _active; +public: + CLASSDEF; + CGamesConsole() : CBackground(), _active(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_GAMES_CONSOLE_H */ diff --git a/engines/titanic/game/get_lift_eye2.cpp b/engines/titanic/game/get_lift_eye2.cpp new file mode 100644 index 0000000000..914f306f0e --- /dev/null +++ b/engines/titanic/game/get_lift_eye2.cpp @@ -0,0 +1,100 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/get_lift_eye2.h" +#include "titanic/game/transport/lift.h" +#include "titanic/core/project_item.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CGetLiftEye2, CGameObject) + ON_MESSAGE(ActMsg) + ON_MESSAGE(EnterRoomMsg) + ON_MESSAGE(VisibleMsg) + ON_MESSAGE(MouseDragStartMsg) +END_MESSAGE_MAP() + +CString *CGetLiftEye2::_destObject; + +void CGetLiftEye2::init() { + _destObject = new CString(); +} + +void CGetLiftEye2::deinit() { + delete _destObject; +} + +void CGetLiftEye2::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(*_destObject, indent); + CGameObject::save(file, indent); +} + +void CGetLiftEye2::load(SimpleFile *file) { + file->readNumber(); + *_destObject = file->readString(); + CGameObject::load(file); +} + +bool CGetLiftEye2::ActMsg(CActMsg *msg) { + *_destObject = msg->_action; + setVisible(true); + return true; +} + +bool CGetLiftEye2::EnterRoomMsg(CEnterRoomMsg *msg) { + CPetControl *pet = getPetControl(); + if (pet->getRoomsElevatorNum() == 4 && CLift::_v1 == 1 && !CLift::_v6) { + _cursorId = CURSOR_HAND; + setVisible(true); + } else { + _cursorId = CURSOR_ARROW; + setVisible(false); + } + + return true; +} + +bool CGetLiftEye2::VisibleMsg(CVisibleMsg *msg) { + setVisible(true); + _cursorId = CURSOR_HAND; + return true; +} + +bool CGetLiftEye2::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (checkPoint(msg->_mousePos, false, true)) { + _cursorId = CURSOR_ARROW; + setVisible(false); + CActMsg actMsg("EyeNotHead"); + actMsg.execute(*_destObject); + CPassOnDragStartMsg dragMsg(msg->_mousePos, 1); + dragMsg.execute(*_destObject); + + msg->_dragItem = getRoot()->findByName(*_destObject); + return true; + } else { + return false; + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/get_lift_eye2.h b/engines/titanic/game/get_lift_eye2.h new file mode 100644 index 0000000000..c0dd49206e --- /dev/null +++ b/engines/titanic/game/get_lift_eye2.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_GET_LIFT_EYE2_H +#define TITANIC_GET_LIFT_EYE2_H + +#include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" +namespace Titanic { + +class CGetLiftEye2 : public CGameObject { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool EnterRoomMsg(CEnterRoomMsg *msg); + bool VisibleMsg(CVisibleMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); +public: + static CString *_destObject; +public: + CLASSDEF; + 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_GET_LIFT_EYE2_H */ diff --git a/engines/titanic/game/glass_smasher.cpp b/engines/titanic/game/glass_smasher.cpp new file mode 100644 index 0000000000..2123f2dfd0 --- /dev/null +++ b/engines/titanic/game/glass_smasher.cpp @@ -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. + * + */ + +#include "titanic/game/glass_smasher.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CGlassSmasher, CGameObject) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + +void CGlassSmasher::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CGlassSmasher::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +bool CGlassSmasher::StatusChangeMsg(CStatusChangeMsg *msg) { + setVisible(true); + playSound("b#40.wav"); + playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + return true; +} + +bool CGlassSmasher::MovieEndMsg(CMovieEndMsg *msg) { + setVisible(false); + CVisibleMsg visibleMsg(true); + visibleMsg.execute("LongStickDispenser"); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/glass_smasher.h b/engines/titanic/game/glass_smasher.h new file mode 100644 index 0000000000..e1eef6f87a --- /dev/null +++ b/engines/titanic/game/glass_smasher.h @@ -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. + * + */ + +#ifndef TITANIC_GLASS_SMASHER_H +#define TITANIC_GLASS_SMASHER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CGlassSmasher : public CGameObject { + DECLARE_MESSAGE_MAP; + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool MovieEndMsg(CMovieEndMsg *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_GLASS_SMASHER_H */ diff --git a/engines/titanic/game/gondolier/gondolier_base.cpp b/engines/titanic/game/gondolier/gondolier_base.cpp new file mode 100644 index 0000000000..f3dc31c9f5 --- /dev/null +++ b/engines/titanic/game/gondolier/gondolier_base.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/game/gondolier/gondolier_base.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CGondolierBase, CGameObject) + ON_MESSAGE(PuzzleSolvedMsg) +END_MESSAGE_MAP() + +int CGondolierBase::_v1; +bool CGondolierBase::_puzzleSolved; +int CGondolierBase::_volume1; +int CGondolierBase::_v4; +int CGondolierBase::_v5; +int CGondolierBase::_volume2; +int CGondolierBase::_v7; +int CGondolierBase::_v8; +int CGondolierBase::_v9; +int CGondolierBase::_v10; + +void CGondolierBase::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_puzzleSolved, indent); + file->writeNumberLine(_volume1, indent); + file->writeNumberLine(_v4, indent); + file->writeNumberLine(_v5, indent); + file->writeNumberLine(_volume2, indent); + file->writeNumberLine(_v7, indent); + file->writeNumberLine(_v8, indent); + file->writeNumberLine(_v9, indent); + file->writeNumberLine(_v10, indent); + + CGameObject::save(file, indent); +} + +void CGondolierBase::load(SimpleFile *file) { + file->readNumber(); + _v1 = file->readNumber(); + _puzzleSolved = file->readNumber(); + _volume1 = file->readNumber(); + _v4 = file->readNumber(); + _v5 = file->readNumber(); + _volume2 = file->readNumber(); + _v7 = file->readNumber(); + _v8 = file->readNumber(); + _v9 = file->readNumber(); + _v10 = file->readNumber(); + + CGameObject::load(file); +} + +bool CGondolierBase::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) { + _puzzleSolved = true; + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/gondolier/gondolier_base.h b/engines/titanic/game/gondolier/gondolier_base.h new file mode 100644 index 0000000000..06d77ba85f --- /dev/null +++ b/engines/titanic/game/gondolier/gondolier_base.h @@ -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. + * + */ + +#ifndef TITANIC_GONDOLIER_BASE_H +#define TITANIC_GONDOLIER_BASE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CGondolierBase : public CGameObject { + DECLARE_MESSAGE_MAP; + bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg); +protected: + static int _v1; + static bool _puzzleSolved; + static int _volume1; + static int _v4; + static int _v5; + static int _volume2; + static int _v7; + static int _v8; + static int _v9; + static int _v10; +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_GONDOLIER_BASE_H */ diff --git a/engines/titanic/game/gondolier/gondolier_chest.cpp b/engines/titanic/game/gondolier/gondolier_chest.cpp new file mode 100644 index 0000000000..cf6656732b --- /dev/null +++ b/engines/titanic/game/gondolier/gondolier_chest.cpp @@ -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. + * + */ + +#include "titanic/game/gondolier/gondolier_chest.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CGondolierChest, CGondolierBase) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(MouseDragStartMsg) +END_MESSAGE_MAP() + +void CGondolierChest::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGondolierBase::save(file, indent); +} + +void CGondolierChest::load(SimpleFile *file) { + file->readNumber(); + CGondolierBase::load(file); +} + +bool CGondolierChest::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (!_v1) + playMovie(0, 14, MOVIE_NOTIFY_OBJECT); + else if (msg->_mousePos.y < 330) + return false; + else if (!_v8 && !_v5) { + playMovie(14, 29, 0); + _v1 = 0; + } + + return true; +} + +bool CGondolierChest::MovieEndMsg(CMovieEndMsg *msg) { + if (msg->_endFrame == 14) + _v1 = 1; + return true; +} + +bool CGondolierChest::MouseDragStartMsg(CMouseDragStartMsg *msg) { + return false; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/gondolier/gondolier_chest.h b/engines/titanic/game/gondolier/gondolier_chest.h new file mode 100644 index 0000000000..8f069241a0 --- /dev/null +++ b/engines/titanic/game/gondolier/gondolier_chest.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_GONDOLIER_CHEST_H +#define TITANIC_GONDOLIER_CHEST_H + +#include "titanic/game/gondolier/gondolier_base.h" + +namespace Titanic { + +class CGondolierChest : public CGondolierBase { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MovieEndMsg(CMovieEndMsg *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_GONDOLIER_CHEST_H */ diff --git a/engines/titanic/game/gondolier/gondolier_face.cpp b/engines/titanic/game/gondolier/gondolier_face.cpp new file mode 100644 index 0000000000..d7bcfa3561 --- /dev/null +++ b/engines/titanic/game/gondolier/gondolier_face.cpp @@ -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. + * + */ + +#include "titanic/game/gondolier/gondolier_face.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CGondolierFace, CGondolierBase) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(StatusChangeMsg) +END_MESSAGE_MAP() + +void CGondolierFace::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_flag, indent); + CGondolierBase::save(file, indent); +} + +void CGondolierFace::load(SimpleFile *file) { + file->readNumber(); + _flag = file->readNumber(); + CGondolierBase::load(file); +} + +bool CGondolierFace::EnterViewMsg(CEnterViewMsg *msg) { + if (_flag) + playMovie(MOVIE_REPEAT); + else + setVisible(false); + return true; +} + +bool CGondolierFace::StatusChangeMsg(CStatusChangeMsg *msg) { + _flag = msg->_newStatus != 1; + setVisible(_flag); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/gondolier/gondolier_face.h b/engines/titanic/game/gondolier/gondolier_face.h new file mode 100644 index 0000000000..b441204d3f --- /dev/null +++ b/engines/titanic/game/gondolier/gondolier_face.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_GONDOLIER_FACE_H +#define TITANIC_GONDOLIER_FACE_H + +#include "titanic/game/gondolier/gondolier_base.h" + +namespace Titanic { + +class CGondolierFace : public CGondolierBase { + DECLARE_MESSAGE_MAP; + bool EnterViewMsg(CEnterViewMsg *msg); + bool StatusChangeMsg(CStatusChangeMsg *msg); +private: + bool _flag; +public: + CLASSDEF; + CGondolierFace() : CGondolierBase(), _flag(true) {} + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_GONDOLIER_FACE_H */ diff --git a/engines/titanic/game/gondolier/gondolier_mixer.cpp b/engines/titanic/game/gondolier/gondolier_mixer.cpp new file mode 100644 index 0000000000..26deda8bca --- /dev/null +++ b/engines/titanic/game/gondolier/gondolier_mixer.cpp @@ -0,0 +1,194 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/gondolier/gondolier_mixer.h" +#include "titanic/core/room_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CGondolierMixer, CGondolierBase) + ON_MESSAGE(EnterRoomMsg) + ON_MESSAGE(LeaveRoomMsg) + ON_MESSAGE(TurnOn) + ON_MESSAGE(TurnOff) + ON_MESSAGE(SetVolumeMsg) + ON_MESSAGE(SignalObject) + ON_MESSAGE(LoadSuccessMsg) +END_MESSAGE_MAP() + +CGondolierMixer::CGondolierMixer() : CGondolierBase(), + _soundName1("c#0.wav"), _soundName2("c#1.wav"), + _soundHandle1(-1), _soundHandle2(-1), _fieldC4(0), _fieldC8(0), + _fieldE4(false) { +} + +void CGondolierMixer::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_soundHandle1, indent); + file->writeNumberLine(_soundHandle2, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeQuotedLine(_soundName1, indent); + file->writeQuotedLine(_soundName2, indent); + file->writeNumberLine(_fieldE4, indent); + + CGondolierBase::save(file, indent); +} + +void CGondolierMixer::load(SimpleFile *file) { + file->readNumber(); + _soundHandle1 = file->readNumber(); + _soundHandle2 = file->readNumber(); + _fieldC4 = file->readNumber(); + _fieldC8 = file->readNumber(); + _soundName1 = file->readString(); + _soundName2 = file->readString(); + _fieldE4 = file->readNumber(); + + CGondolierBase::load(file); +} + +bool CGondolierMixer::EnterRoomMsg(CEnterRoomMsg *msg) { + CRoomItem *parentRoom = dynamic_cast<CRoomItem *>(getParent()); + if (parentRoom == msg->_newRoom) { + CTurnOn onMsg; + onMsg.execute(this); + } + + return true; +} + +bool CGondolierMixer::LeaveRoomMsg(CLeaveRoomMsg *msg) { + CRoomItem *parentRoom = dynamic_cast<CRoomItem *>(getParent()); + if (parentRoom == msg->_oldRoom) { + CTurnOff offMsg; + offMsg.execute(this); + } + + return true; +} + +bool CGondolierMixer::TurnOn(CTurnOn *msg) { + if (!_puzzleSolved) { + if (_soundHandle1 == -1) { + _soundHandle1 = playSound(_soundName1, _volume1 * _v4 / 10, 0, true); + _fieldE4 = true; + } + + if (_soundHandle2 == -1) { + _soundHandle2 = playSound(_soundName1, _volume2 * _v7 / 10, 0, true); + _fieldE4 = true; + } + } + + return true; +} + +bool CGondolierMixer::TurnOff(CTurnOff *msg) { + if (_soundHandle1 != -1) { + if (isSoundActive(_soundHandle1)) + stopSound(_soundHandle1, 2); + + _soundHandle1 = -1; + _fieldE4 = false; + } + + if (_soundHandle2 != -1) { + if (isSoundActive(_soundHandle2)) + stopSound(_soundHandle2, 2); + + _soundHandle2 = -1; + _fieldE4 = false; + } + + return true; +} + +bool CGondolierMixer::SetVolumeMsg(CSetVolumeMsg *msg) { + if (!_puzzleSolved) { + _volume1 = _volume2 = msg->_volume; + + if (_soundHandle1 != -1 && isSoundActive(_soundHandle1)) + setSoundVolume(_soundHandle1, msg->_volume * _v4 / 10, 2); + if (_soundHandle2 != -1 && isSoundActive(_soundHandle2)) + setSoundVolume(_soundHandle2, msg->_volume * _v7 / 10, 2); + } + + return true; +} + +bool CGondolierMixer::SignalObject(CSignalObject *msg) { + if (!_puzzleSolved) { + if (msg->_strValue == "Fly") { + _v4 = CLIP(msg->_numValue, 0, 10); + + if (!_v8) { + _v7 = 10 - _v4; + CStatusChangeMsg statusMsg; + statusMsg._newStatus = _v7; + statusMsg.execute("GondolierRightLever"); + } + } + + if (msg->_strValue == "Tos") { + _v7 = CLIP(msg->_numValue, 0, 10); + + if (!_v5) { + _v4 = 10 - _v7; + CStatusChangeMsg statusMsg; + statusMsg._newStatus = _v4; + statusMsg.execute("GondolierLeftLever"); + } + } + + if (!_v4 && !_v7 && _v5 && _v8) { + _puzzleSolved = true; + CStatusChangeMsg statusMsg; + statusMsg._newStatus = 1; + statusMsg.execute("GondolierFace"); + CTurnOff offMsg; + offMsg.execute(this); + CVisibleMsg visibleMsg; + visibleMsg.execute("Mouth"); + + playSound("z#47.wav"); + } else { + CSetVolumeMsg volumeMsg(_volume1, 2); + volumeMsg.execute(this); + } + } + + return true; +} + +bool CGondolierMixer::LoadSuccessMsg(CLoadSuccessMsg *msg) { + if (_fieldE4) { + _fieldE4 = 0; + _soundHandle1 = _soundHandle2 = -1; + CTurnOn onMsg; + onMsg.execute(this); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/gondolier/gondolier_mixer.h b/engines/titanic/game/gondolier/gondolier_mixer.h new file mode 100644 index 0000000000..167650f5bb --- /dev/null +++ b/engines/titanic/game/gondolier/gondolier_mixer.h @@ -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. + * + */ + +#ifndef TITANIC_GONDOLIER_MIXER_H +#define TITANIC_GONDOLIER_MIXER_H + +#include "titanic/game/gondolier/gondolier_base.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CGondolierMixer : public CGondolierBase { + DECLARE_MESSAGE_MAP; + bool EnterRoomMsg(CEnterRoomMsg *msg); + bool LeaveRoomMsg(CLeaveRoomMsg *msg); + bool TurnOn(CTurnOn *msg); + bool TurnOff(CTurnOff *msg); + bool SetVolumeMsg(CSetVolumeMsg *msg); + bool SignalObject(CSignalObject *msg); + bool LoadSuccessMsg(CLoadSuccessMsg *msg); +private: + int _soundHandle1; + int _soundHandle2; + int _fieldC4; + int _fieldC8; + CString _soundName1; + CString _soundName2; + bool _fieldE4; +public: + CLASSDEF; + CGondolierMixer(); + + /** + * 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_GONDOLIER_MIXER_H */ diff --git a/engines/titanic/game/gondolier/gondolier_slider.cpp b/engines/titanic/game/gondolier/gondolier_slider.cpp new file mode 100644 index 0000000000..e7a46eb33d --- /dev/null +++ b/engines/titanic/game/gondolier/gondolier_slider.cpp @@ -0,0 +1,239 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/gondolier/gondolier_slider.h" + +namespace Titanic { + +static const int ARRAY[11] = { 0, 0, 1, 4, 9, 15, 21, 27, 32, 35, 36 }; + +BEGIN_MESSAGE_MAP(CGondolierSlider, CGondolierBase) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MouseDragMoveMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(MouseDragStartMsg) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(MouseDragEndMsg) + ON_MESSAGE(IsHookedOnMsg) + ON_MESSAGE(FrameMsg) + ON_MESSAGE(SignalObject) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + +CGondolierSlider::CGondolierSlider() : CGondolierBase(), + _fieldBC(0), _fieldC0(0), _fieldC4(0), _fieldC8(0), + _arrayIndex(0), _string1("NULL"), _fieldFC(0), _field118(0) { +} + +void CGondolierSlider::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_sliderRect1.left, indent); + file->writeNumberLine(_sliderRect1.top, indent); + file->writeNumberLine(_sliderRect1.right, indent); + file->writeNumberLine(_sliderRect1.bottom, indent); + file->writeNumberLine(_sliderRect2.left, indent); + file->writeNumberLine(_sliderRect2.top, indent); + file->writeNumberLine(_sliderRect2.right, indent); + file->writeNumberLine(_sliderRect2.bottom, indent); + file->writeNumberLine(_sliderRect1.left, indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_fieldFC, indent); + file->writeQuotedLine(_string2, indent); + file->writeQuotedLine(_string3, indent); + file->writeNumberLine(_field118, indent); + + CGondolierBase::save(file, indent); +} + +void CGondolierSlider::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + _fieldC8 = file->readNumber(); + _sliderRect1.left = file->readNumber(); + _sliderRect1.top = file->readNumber(); + _sliderRect1.right = file->readNumber(); + _sliderRect1.bottom = file->readNumber(); + _sliderRect2.left = file->readNumber(); + _sliderRect2.top = file->readNumber(); + _sliderRect2.right = file->readNumber(); + _sliderRect2.bottom = file->readNumber(); + _arrayIndex = file->readNumber(); + _string1 = file->readString(); + _fieldFC = file->readNumber(); + _string2 = file->readString(); + _string3 = file->readString(); + _field118 = file->readNumber(); + + CGondolierBase::load(file); +} + +bool CGondolierSlider::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (!_v1) + return false; + if (_fieldFC ? _v5 : _v8) + return false; + + return _sliderRect1.contains(msg->_mousePos); +} + +bool CGondolierSlider::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { + if (!(_fieldFC ? _v5 : _v8)) { + int minVal = 0x7FFFFFFF; + int foundIndex = -1; + int yp = (_sliderRect2.top + _sliderRect2.bottom) / 2 + + _bounds.top - msg->_mousePos.y; + + for (int idx = 0; idx < 11; ++idx) { + int yv = yp + ARRAY[idx]; + if (yv < 0) + yv = -yv; + if (yv < minVal) { + minVal = yv; + foundIndex = idx; + } + } + + if (foundIndex >= 0) { + _arrayIndex = foundIndex; + CSignalObject signalMsg; + signalMsg.execute(this); + } + } + + return true; +} + +bool CGondolierSlider::EnterViewMsg(CEnterViewMsg *msg) { + CSignalObject signalMsg; + signalMsg.execute(this); + return true; +} + +bool CGondolierSlider::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (!_v1) + return false; + if (_fieldFC ? _v5 : _v8) + return false; + + _field118 = checkStartDragging(msg); + return _field118; +} + +bool CGondolierSlider::StatusChangeMsg(CStatusChangeMsg *msg) { + _arrayIndex = CLIP(10 - msg->_newStatus, 0, 10); + _sliderRect1 = _sliderRect2; + _sliderRect1.translate(_bounds.left, _bounds.top); + _sliderRect1.translate(0, ARRAY[_arrayIndex]); + + loadFrame(_arrayIndex); + return true; +} + +bool CGondolierSlider::MouseDragEndMsg(CMouseDragEndMsg *msg) { + _field118 = false; + return true; +} + +bool CGondolierSlider::IsHookedOnMsg(CIsHookedOnMsg *msg) { + if (_fieldFC ? _v5 : _v8) + return false; + + if (!_sliderRect1.intersects(msg->_rect)) { + _string2 = CString(); + msg->_result = false; + } else { + _string2 = _string1; + if (_fieldFC) { + _v5 = _v9 = 1; + } else { + _v8 = _v10 = 1; + } + + msg->_result = true; + } + + return true; +} + +bool CGondolierSlider::FrameMsg(CFrameMsg *msg) { + if (_fieldFC ? _v5 : _v8) { + if (_arrayIndex < 10) { + ++_arrayIndex; + CSignalObject signalMsg; + signalMsg.execute(this); + + int yp = 0; + if (_arrayIndex > 0) + yp = ARRAY[_arrayIndex] - ARRAY[_arrayIndex - 1]; + + if (!_string2.empty()) { + CTranslateObjectMsg transMsg; + transMsg._delta = Point(0, yp); + transMsg.execute(_string2); + } + } + } else if (_fieldFC ? _v10 : _v9) { + if (!_field118 && !_puzzleSolved && _arrayIndex > 0) { + CSignalObject signalMsg; + signalMsg.execute(this); + } + } + + return true; +} + +bool CGondolierSlider::SignalObject(CSignalObject *msg) { + _arrayIndex = CLIP(_arrayIndex, 0, 10); + _sliderRect1 = _sliderRect2; + _sliderRect1.translate(_bounds.left, _bounds.top); + _sliderRect1.translate(0, ARRAY[_arrayIndex]); + loadFrame(_arrayIndex); + + CSignalObject signalMsg; + signalMsg._numValue = 10 - _arrayIndex; + signalMsg._strValue = _fieldFC ? "Fly" : "Tos"; + signalMsg.execute(_string3); + + return true; +} + +bool CGondolierSlider::ActMsg(CActMsg *msg) { + if (msg->_action == "Unhook") { + if (_fieldFC) { + _v5 = _v9 = 0; + _v10 = _v8; + } else { + _v8 = _v10 = 0; + _v9 = _v5; + } + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/gondolier/gondolier_slider.h b/engines/titanic/game/gondolier/gondolier_slider.h new file mode 100644 index 0000000000..d1562f5b2d --- /dev/null +++ b/engines/titanic/game/gondolier/gondolier_slider.h @@ -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. + * + */ + +#ifndef TITANIC_GONDOLIER_SLIDER_H +#define TITANIC_GONDOLIER_SLIDER_H + +#include "titanic/game/gondolier/gondolier_base.h" + +namespace Titanic { + +class CGondolierSlider : public CGondolierBase { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MouseDragMoveMsg(CMouseDragMoveMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool MouseDragEndMsg(CMouseDragEndMsg *msg); + bool IsHookedOnMsg(CIsHookedOnMsg *msg); + bool FrameMsg(CFrameMsg *msg); + bool SignalObject(CSignalObject *msg); + bool ActMsg(CActMsg *msg); +private: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; + Rect _sliderRect1; + Rect _sliderRect2; + int _arrayIndex; + CString _string1; + int _fieldFC; + CString _string2; + CString _string3; + bool _field118; +public: + CLASSDEF; + CGondolierSlider(); + + /** + * 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_GONDOLIER_SLIDER_H */ diff --git a/engines/titanic/game/hammer_clip.cpp b/engines/titanic/game/hammer_clip.cpp new file mode 100644 index 0000000000..7fb64350af --- /dev/null +++ b/engines/titanic/game/hammer_clip.cpp @@ -0,0 +1,83 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/hammer_clip.h" +#include "titanic/core/project_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CHammerClip, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(MouseDragStartMsg) +END_MESSAGE_MAP() + +void CHammerClip::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CHammerClip::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +bool CHammerClip::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return true; +} + +bool CHammerClip::StatusChangeMsg(CStatusChangeMsg *msg) { + _value = msg->_newStatus == 1; + if (_value) { + CPuzzleSolvedMsg solvedMsg; + solvedMsg.execute("BigHammer"); + _cursorId = CURSOR_HAND; + } + + return true; +} + +bool CHammerClip::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (!checkStartDragging(msg)) + return false; + + if (_value) { + CVisibleMsg visibleMsg(true); + visibleMsg.execute("BigHammer"); + CPassOnDragStartMsg passMsg(msg->_mousePos, 1); + passMsg.execute("BigHammer"); + + msg->_dragItem = getRoot()->findByName("BigHammer"); + + CActMsg actMsg("HammerTaken"); + actMsg.execute("HammerDispensor"); + actMsg.execute("HammerDispensorButton"); + _cursorId = CURSOR_ARROW; + _value = 0; + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/hammer_clip.h b/engines/titanic/game/hammer_clip.h new file mode 100644 index 0000000000..4af58c22a5 --- /dev/null +++ b/engines/titanic/game/hammer_clip.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_HAMMER_CLIP_H +#define TITANIC_HAMMER_CLIP_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CHammerClip : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); +public: + int _value; +public: + CLASSDEF; + CHammerClip() : CGameObject(), _value(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_HAMMER_CLIP_H */ diff --git a/engines/titanic/game/hammer_dispensor.cpp b/engines/titanic/game/hammer_dispensor.cpp new file mode 100644 index 0000000000..bc6a3d5ad8 --- /dev/null +++ b/engines/titanic/game/hammer_dispensor.cpp @@ -0,0 +1,104 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/hammer_dispensor.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CHammerDispensor, CBackground) + ON_MESSAGE(ActMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + +CHammerDispensor::CHammerDispensor() : CBackground(), + _fieldE0(false), _fieldE4(true), _state(0) { +} + +void CHammerDispensor::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_state, indent); + + CBackground::save(file, indent); +} + +void CHammerDispensor::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _state = file->readNumber(); + + CBackground::load(file); +} + +bool CHammerDispensor::ActMsg(CActMsg *msg) { + if (msg->_action == "DispenseHammer" && !_fieldE0) { + _state = 1; + playMovie(15, 31, MOVIE_NOTIFY_OBJECT); + _fieldE0 = true; + } + + if (msg->_action == "HammerTaken" && _fieldE0) + loadFrame(32); + + return true; +} + +bool CHammerDispensor::EnterViewMsg(CEnterViewMsg *msg) { + if (_fieldE4) { + playMovie(7, 14, 0); + _fieldE4 = false; + } + + return true; +} + +bool CHammerDispensor::LeaveViewMsg(CLeaveViewMsg *msg) { + _fieldE4 = true; + _fieldE0 = 0; + _state = 2; + + if (_fieldE0) + playMovie(32, 50, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + else + playMovie(0, 7, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + return true; +} + +bool CHammerDispensor::MovieEndMsg(CMovieEndMsg *msg) { + if (_state == 1) { + CStatusChangeMsg statusMsg; + statusMsg._newStatus = 1; + statusMsg.execute("HammerClip"); + } else if (_state == 2) { + CStatusChangeMsg statusMsg; + statusMsg._newStatus = 2; + statusMsg.execute("HammerClip"); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/hammer_dispensor.h b/engines/titanic/game/hammer_dispensor.h new file mode 100644 index 0000000000..2383a3349e --- /dev/null +++ b/engines/titanic/game/hammer_dispensor.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_HAMMER_DISPENSOR_H +#define TITANIC_HAMMER_DISPENSOR_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CHammerDispensor : public CBackground { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); +private: + bool _fieldE0; + bool _fieldE4; + int _state; +public: + CLASSDEF; + CHammerDispensor(); + + /** + * 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_DISPENSOR_H */ diff --git a/engines/titanic/game/hammer_dispensor_button.cpp b/engines/titanic/game/hammer_dispensor_button.cpp new file mode 100644 index 0000000000..fbda501a24 --- /dev/null +++ b/engines/titanic/game/hammer_dispensor_button.cpp @@ -0,0 +1,145 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/hammer_dispensor_button.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CHammerDispensorButton, CStartAction) + ON_MESSAGE(PuzzleSolvedMsg) + ON_MESSAGE(MouseButtonUpMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(FrameMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(EnterViewMsg) +END_MESSAGE_MAP() + +CHammerDispensorButton::CHammerDispensorButton() : CStartAction(), + _fieldF8(0), _fieldFC(0), _field100(0), _btnPos(Point(56, 6)), + _field10C(nullptr), _field110(0) { +} + +void CHammerDispensorButton::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldF8, indent); + file->writeNumberLine(_fieldFC, indent); + file->writeNumberLine(_field100, indent); + file->writeNumberLine(_btnPos.x, indent); + file->writeNumberLine(_btnPos.y, indent); + file->writeNumberLine(_field110, indent); + + CStartAction::save(file, indent); +} + +void CHammerDispensorButton::load(SimpleFile *file) { + file->readNumber(); + _fieldF8 = file->readNumber(); + _fieldFC = file->readNumber(); + _field100 = file->readNumber(); + _btnPos.x = file->readNumber(); + _btnPos.y = file->readNumber(); + _field110 = file->readNumber(); + + CStartAction::load(file); +} + +bool CHammerDispensorButton::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) { + _fieldF8 = 1; + return true; +} + +bool CHammerDispensorButton::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + playSound("z#93.wav"); + petDisplayMessage(1, "In case of emergency hammer requirement, poke with long stick."); + return true; +} + +bool CHammerDispensorButton::ActMsg(CActMsg *msg) { + if (msg->_action == "HammerTaken") + _field110 = true; + return true; +} + +bool CHammerDispensorButton::FrameMsg(CFrameMsg *msg) { + if (!_fieldF8) + return true; + + if (!_field10C) { + CGameObject *obj = getDraggingObject(); + if (obj) { + if (obj->isEquals("Perch") && getView() == findView()) + _field10C = obj; + } + } + + if (_field10C) { + Point pt(_btnPos.x + _bounds.left, _btnPos.y + _bounds.top); + bool flag = checkPoint(pt, true); + + switch (_fieldFC) { + case 0: + if (flag) { + playSound("z#93.wav"); + if (++_field100 == 5) { + if (!_field110) { + CActMsg actMsg(_msgAction); + actMsg.execute(_msgTarget); + } + + setVisible(false); + _fieldF8 = 0; + _field100 = 0; + } + + _fieldFC = 1; + } + break; + + case 1: + if (!flag) { + _fieldFC = 0; + ++_field100; + } + break; + + default: + break; + } + } + + return true; +} + +bool CHammerDispensorButton::LeaveViewMsg(CLeaveViewMsg *msg) { + _field10C = nullptr; + _field100 = 0; + _fieldFC = 0; + return true; +} + +bool CHammerDispensorButton::EnterViewMsg(CEnterViewMsg *msg) { + setVisible(true); + _fieldF8 = 1; + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/hammer_dispensor_button.h b/engines/titanic/game/hammer_dispensor_button.h new file mode 100644 index 0000000000..f497b9dae1 --- /dev/null +++ b/engines/titanic/game/hammer_dispensor_button.h @@ -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. + * + */ + +#ifndef TITANIC_HAMMER_DISPENSOR_BUTTON_H +#define TITANIC_HAMMER_DISPENSOR_BUTTON_H + +#include "titanic/game/start_action.h" + +namespace Titanic { + +class CHammerDispensorButton : public CStartAction { + DECLARE_MESSAGE_MAP; + bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg); + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); + bool ActMsg(CActMsg *msg); + bool FrameMsg(CFrameMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); +private: + int _fieldF8; + int _fieldFC; + int _field100; + Point _btnPos; + CGameObject *_field10C; + int _field110; +public: + CLASSDEF; + CHammerDispensorButton(); + + /** + * 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_DISPENSOR_BUTTON_H */ diff --git a/engines/titanic/game/head_slot.cpp b/engines/titanic/game/head_slot.cpp new file mode 100644 index 0000000000..f7df02d364 --- /dev/null +++ b/engines/titanic/game/head_slot.cpp @@ -0,0 +1,184 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/head_slot.h" +#include "titanic/core/project_item.h" +#include "titanic/game/brain_slot.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CHeadSlot, CGameObject) + ON_MESSAGE(AddHeadPieceMsg) + ON_MESSAGE(SenseWorkingMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(LoadSuccessMsg) + ON_MESSAGE(TimerMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MouseDragStartMsg) +END_MESSAGE_MAP() + +int CHeadSlot::_v1; + +CHeadSlot::CHeadSlot() : CGameObject(), _string1("NotWorking"), _string2("NULL"), + _fieldBC(0), _fieldD8(0), _fieldDC(27), _fieldE0(56), + _fieldE4(82), _fieldE8(112), _fieldEC(false) { +} + +void CHeadSlot::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_fieldD8, indent); + file->writeNumberLine(_fieldDC, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_fieldEC, indent); + + CGameObject::save(file, indent); +} + +void CHeadSlot::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + _fieldD8 = file->readNumber(); + _fieldDC = file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _v1 = file->readNumber(); + _fieldEC = file->readNumber(); + + CGameObject::load(file); +} + +bool CHeadSlot::AddHeadPieceMsg(CAddHeadPieceMsg *msg) { + setVisible(true); + _fieldBC = 1; + _string2 = msg->_value; + playMovie(_fieldDC, _fieldE8, 0); + _cursorId = CURSOR_HAND; + msg->execute("TitaniaControl"); + return true; +} + +bool CHeadSlot::SenseWorkingMsg(CSenseWorkingMsg *msg) { + if (_fieldEC) + playMovie(_fieldE4, _fieldE8, 0); + + _string1 = msg->_value; + _fieldEC = false; + return true; +} + +bool CHeadSlot::EnterViewMsg(CEnterViewMsg *msg) { + setVisible(true); + if (_v1) + _cursorId = CURSOR_ARROW; + + if (_v1 == 1 || _string1 == "Working") { + playMovie(_fieldE0, _fieldE4, MOVIE_GAMESTATE); + _fieldEC = true; + } else if (_fieldBC) { + playMovie(_fieldE0, _fieldE8, MOVIE_GAMESTATE); + _fieldEC = false; + } else { + playMovie(0, _fieldDC, MOVIE_GAMESTATE); + } + + addTimer(5000 + getRandomNumber(3000)); + return true; +} + +bool CHeadSlot::LeaveViewMsg(CLeaveViewMsg *msg) { + if (getName() == "YepItsASlot") { + stopMovie(); + + if (_fieldBC) { + loadFrame(_fieldE0); + playMovie(_fieldE0, _fieldE8, MOVIE_GAMESTATE); + _fieldEC = false; + } else { + loadFrame(_fieldDC); + playMovie(_fieldDC, _fieldE0, MOVIE_GAMESTATE); + } + + _fieldEC = false; + } + + return true; +} + +bool CHeadSlot::LoadSuccessMsg(CLoadSuccessMsg *msg) { + return true; +} + +bool CHeadSlot::TimerMsg(CTimerMsg *msg) { + if (compareViewNameTo("Titania.Node 15.S") && CBrainSlot::_added == 5 + && _fieldBC == 1) { + if (_string1 == "Working" && !_fieldEC) { + playMovie(_fieldE0, _fieldE4, 0); + _fieldEC = true; + } else if (_string1 == "Random") { + playMovie(_fieldE0, _fieldE8, 0); + } + } + + if (compareViewNameTo("Titania.Node 15.S")) { + _fieldD8 = 7000 + getRandomNumber(5000); + addTimer(_fieldD8); + } + + return true; +} + +bool CHeadSlot::ActMsg(CActMsg *msg) { + if (msg->_action == "Woken") + _v1 = 1; + return true; +} + +bool CHeadSlot::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (_fieldBC && !_v1 && checkPoint(msg->_mousePos, false, true)) { + CPassOnDragStartMsg passMsg; + passMsg._mousePos = msg->_mousePos; + passMsg.execute(_string2); + + msg->_dragItem = getRoot()->findByName(_string2); + _cursorId = CURSOR_ARROW; + _fieldBC = 0; + _fieldEC = false; + _string2 = "NULL"; + stopMovie(); + loadFrame(0); + playMovie(0, _fieldDC, 0); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/head_slot.h b/engines/titanic/game/head_slot.h new file mode 100644 index 0000000000..2767db3b61 --- /dev/null +++ b/engines/titanic/game/head_slot.h @@ -0,0 +1,69 @@ +/* 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_SLOT_H +#define TITANIC_HEAD_SLOT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CHeadSlot : public CGameObject { + DECLARE_MESSAGE_MAP; + bool AddHeadPieceMsg(CAddHeadPieceMsg *msg); + bool SenseWorkingMsg(CSenseWorkingMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool LoadSuccessMsg(CLoadSuccessMsg *msg); + bool TimerMsg(CTimerMsg *msg); + bool ActMsg(CActMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); +public: + static int _v1; +public: + int _fieldBC; + CString _string1; + CString _string2; + int _fieldD8; + int _fieldDC; + int _fieldE0; + int _fieldE4; + int _fieldE8; + bool _fieldEC; +public: + CLASSDEF; + CHeadSlot(); + + /** + * 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_SLOT_H */ diff --git a/engines/titanic/game/head_smash_event.cpp b/engines/titanic/game/head_smash_event.cpp new file mode 100644 index 0000000000..5ec3d299d5 --- /dev/null +++ b/engines/titanic/game/head_smash_event.cpp @@ -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. + * + */ + +#include "titanic/game/head_smash_event.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CHeadSmashEvent, CBackground) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + +void CHeadSmashEvent::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CBackground::save(file, indent); +} + +void CHeadSmashEvent::load(SimpleFile *file) { + file->readNumber(); + CBackground::load(file); +} + +bool CHeadSmashEvent::ActMsg(CActMsg *msg) { + if (msg->_action == "PlayToEnd") { + setVisible(true); + playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + } + + return true; +} + +bool CHeadSmashEvent::MovieEndMsg(CMovieEndMsg *msg) { + changeView("CreatorsChamber.Node 1.W"); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/head_smash_event.h b/engines/titanic/game/head_smash_event.h new file mode 100644 index 0000000000..09fd7a54cc --- /dev/null +++ b/engines/titanic/game/head_smash_event.h @@ -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. + * + */ + +#ifndef TITANIC_HEAD_SMASH_EVENT_H +#define TITANIC_HEAD_SMASH_EVENT_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CHeadSmashEvent : public CBackground { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool MovieEndMsg(CMovieEndMsg *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_HEAD_SMASH_EVENT_H */ diff --git a/engines/titanic/game/head_smash_lever.cpp b/engines/titanic/game/head_smash_lever.cpp new file mode 100644 index 0000000000..d5c2eaf8c4 --- /dev/null +++ b/engines/titanic/game/head_smash_lever.cpp @@ -0,0 +1,101 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/head_smash_lever.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CHeadSmashLever, CBackground) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(FrameMsg) + ON_MESSAGE(LoadSuccessMsg) +END_MESSAGE_MAP() + +CHeadSmashLever::CHeadSmashLever() : CBackground(), + _enabled(false), _fieldE4(false), _ticksCount(0) {} + +void CHeadSmashLever::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_enabled, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_ticksCount, indent); + + CBackground::save(file, indent); +} + +void CHeadSmashLever::load(SimpleFile *file) { + file->readNumber(); + _enabled = file->readNumber(); + _fieldE4 = file->readNumber(); + _ticksCount = file->readNumber(); + + CBackground::load(file); +} + +bool CHeadSmashLever::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_enabled) { + playMovie(0, 14, 0); + playSound("z#54.wav"); + int soundHandle = playSound("z#45.wav"); + queueSound("z#49.wav", soundHandle); + _ticksCount = getTicksCount(); + _fieldE4 = true; + } else { + playMovie(0); + playSound("z#56.wav"); + } + + return true; +} + +bool CHeadSmashLever::ActMsg(CActMsg *msg) { + if (msg->_action == "EnableObject") + _enabled = true; + else if (msg->_action == "DisableObject") + _enabled = false; + + return true; +} + +bool CHeadSmashLever::FrameMsg(CFrameMsg *msg) { + if (_fieldE4 && msg->_ticks > (_ticksCount + 750)) { + CActMsg actMsg1("CreatorsChamber.Node 1.S"); + actMsg1.execute("MoveToCreators"); + CActMsg actMsg2("PlayToEnd"); + actMsg2.execute("SmashingStatue"); + + playSound("b#16.wav"); + _fieldE4 = false; + } + + return true; +} + +bool CHeadSmashLever::LoadSuccessMsg(CLoadSuccessMsg *msg) { + if (_fieldE4) + _ticksCount = getTicksCount(); + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/head_smash_lever.h b/engines/titanic/game/head_smash_lever.h new file mode 100644 index 0000000000..e2426b68da --- /dev/null +++ b/engines/titanic/game/head_smash_lever.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_SMASH_LEVER_H +#define TITANIC_HEAD_SMASH_LEVER_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CHeadSmashLever : public CBackground { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool ActMsg(CActMsg *msg); + bool FrameMsg(CFrameMsg *msg); + bool LoadSuccessMsg(CLoadSuccessMsg *msg); +public: + bool _enabled; + bool _fieldE4; + int _ticksCount; +public: + CLASSDEF; + CHeadSmashLever(); + + /** + * 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_SMASH_LEVER_H */ diff --git a/engines/titanic/game/head_spinner.cpp b/engines/titanic/game/head_spinner.cpp new file mode 100644 index 0000000000..2fb3654c4a --- /dev/null +++ b/engines/titanic/game/head_spinner.cpp @@ -0,0 +1,43 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/head_spinner.h" + +namespace Titanic { + +void CHeadSpinner::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value1, indent); + file->writeNumberLine(_value2, indent); + + CGameObject::save(file, indent); +} + +void CHeadSpinner::load(SimpleFile *file) { + file->readNumber(); + _value1 = file->readNumber(); + _value2 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/head_spinner.h b/engines/titanic/game/head_spinner.h new file mode 100644 index 0000000000..4456070ee4 --- /dev/null +++ b/engines/titanic/game/head_spinner.h @@ -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. + * + */ + +#ifndef TITANIC_HEAD_SPINNER_H +#define TITANIC_HEAD_SPINNER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CHeadSpinner : public CGameObject { +public: + int _value1, _value2; +public: + CHeadSpinner() : CGameObject(), _value1(0), _value2(0) {} + 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_HEAD_SPINNER_H */ diff --git a/engines/titanic/game/idle_summoner.cpp b/engines/titanic/game/idle_summoner.cpp new file mode 100644 index 0000000000..5ca3209e28 --- /dev/null +++ b/engines/titanic/game/idle_summoner.cpp @@ -0,0 +1,130 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/idle_summoner.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CIdleSummoner, CGameObject) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(TimerMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(LoadSuccessMsg) +END_MESSAGE_MAP() + +CIdleSummoner::CIdleSummoner() : CGameObject(), _fieldBC(360000), + _fieldC0(60000), _fieldC4(360000), _fieldC8(60000), + _fieldCC(0), _fieldD0(0), _fieldD4(0), _fieldD8(0), _ticks(0) { +} + +void CIdleSummoner::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_fieldCC, indent); + file->writeNumberLine(_fieldD0, indent); + file->writeNumberLine(_fieldD4, indent); + file->writeNumberLine(_fieldD8, indent); + file->writeNumberLine(_ticks, indent); + + CGameObject::save(file, indent); +} + +void CIdleSummoner::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + _fieldC8 = file->readNumber(); + _fieldCC = file->readNumber(); + _fieldD0 = file->readNumber(); + _fieldD4 = file->readNumber(); + _fieldD8 = file->readNumber(); + _ticks = file->readNumber(); + + CGameObject::load(file); +} + +bool CIdleSummoner::EnterViewMsg(CEnterViewMsg *msg) { + CActMsg actMsg("Enable"); + actMsg.execute(this); + return true; +} + +bool CIdleSummoner::TimerMsg(CTimerMsg *msg) { + uint nodesCtr = getNodeChangedCtr(); + if (msg->_actionVal == 1 && !petDoorOrBellbotPresent() + && nodesCtr > 0 && _fieldD8) { + if (!compareRoomNameTo("TopOfWell") && !compareRoomNameTo("EmbLobby")) + return true; + + int region = talkGetDialRegion("BellBot", 1); + uint delay = region == 1 ? 15000 : 12000; + uint enterTicks = MIN(getNodeEnterTicks(), _ticks); + + CString name; + uint ticks = getTicksCount() - enterTicks; + if (ticks > delay) { + if (region == 1 || getRandomNumber(1) == 1) { + name = "BellBot"; + } else { + name = "DoorBot"; + } + _fieldD8 = nodesCtr; + + if (getRoom()) { + CSummonBotQueryMsg queryMsg(name); + if (queryMsg.execute(this)) { + CSummonBotMsg summonMsg(name, 1); + summonMsg.execute(this); + } + } + } + } + + return true; +} + +bool CIdleSummoner::ActMsg(CActMsg *msg) { + if (msg->_action == "Enable") { + if (!_fieldD4) + _fieldD4 = addTimer(15000, 15000); + } else if (msg->_action == "Disable") { + if (_fieldD4 > 0) { + stopAnimTimer(_fieldD4); + _fieldD4 = 0; + } + } else if (msg->_action == "DoorbotDismissed" || msg->_action == "BellbotDismissed") { + _ticks = getTicksCount(); + } + + return true; +} + +bool CIdleSummoner::LoadSuccessMsg(CLoadSuccessMsg *msg) { + _ticks = getTicksCount(); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/idle_summoner.h b/engines/titanic/game/idle_summoner.h new file mode 100644 index 0000000000..0066694b68 --- /dev/null +++ b/engines/titanic/game/idle_summoner.h @@ -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. + * + */ + +#ifndef TITANIC_IDLE_SUMMONER_H +#define TITANIC_IDLE_SUMMONER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CIdleSummoner : public CGameObject { + DECLARE_MESSAGE_MAP; + bool EnterViewMsg(CEnterViewMsg *msg); + bool TimerMsg(CTimerMsg *msg); + bool ActMsg(CActMsg *msg); + bool LoadSuccessMsg(CLoadSuccessMsg *msg); +public: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; + int _fieldCC; + int _fieldD0; + int _fieldD4; + int _fieldD8; + uint _ticks; +public: + CIdleSummoner(); + 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_IDLE_SUMMONER_H */ diff --git a/engines/titanic/game/leave_sec_class_state.cpp b/engines/titanic/game/leave_sec_class_state.cpp new file mode 100644 index 0000000000..3e23e3ad1c --- /dev/null +++ b/engines/titanic/game/leave_sec_class_state.cpp @@ -0,0 +1,39 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/leave_sec_class_state.h" + +namespace Titanic { + +EMPTY_MESSAGE_MAP(CLeaveSecClassState, CGameObject); + +void CLeaveSecClassState::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CLeaveSecClassState::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/leave_sec_class_state.h b/engines/titanic/game/leave_sec_class_state.h new file mode 100644 index 0000000000..0b1e854f57 --- /dev/null +++ b/engines/titanic/game/leave_sec_class_state.h @@ -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. + * + */ + +#ifndef TITANIC_LEAVE_SEC_CLASS_STATE_H +#define TITANIC_LEAVE_SEC_CLASS_STATE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CLeaveSecClassState : public CGameObject { + DECLARE_MESSAGE_MAP; +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_LEAVE_SEC_CLASS_STATE_H */ diff --git a/engines/titanic/game/lemon_dispensor.cpp b/engines/titanic/game/lemon_dispensor.cpp new file mode 100644 index 0000000000..31a04cbeca --- /dev/null +++ b/engines/titanic/game/lemon_dispensor.cpp @@ -0,0 +1,123 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/lemon_dispensor.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CLemonDispensor, CBackground) + ON_MESSAGE(FrameMsg) + ON_MESSAGE(ChangeSeasonMsg) + ON_MESSAGE(LeaveViewMsg) +END_MESSAGE_MAP() + +bool CLemonDispensor::_isSummer; +int CLemonDispensor::_v2; +int CLemonDispensor::_v3; +CGameObject *CLemonDispensor::_draggingObject; + +CLemonDispensor::CLemonDispensor() : CBackground(), + _fieldE0(0), _origPt(Point(9, 15)), _fieldEC(0) { +} + +void CLemonDispensor::init() { + _isSummer = false; + _v2 = 0; + _v3 = 0; + _draggingObject = nullptr; +} + +void CLemonDispensor::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_isSummer, indent); + file->writeNumberLine(_v2, indent); + file->writeNumberLine(_v3, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_origPt.x, indent); + file->writeNumberLine(_origPt.y, indent); + file->writeNumberLine(_fieldEC, indent); + + CBackground::save(file, indent); +} + +void CLemonDispensor::load(SimpleFile *file) { + file->readNumber(); + _isSummer = file->readNumber(); + _v2 = file->readNumber(); + _v3 = file->readNumber(); + _fieldE0 = file->readNumber(); + _origPt.x = file->readNumber(); + _origPt.y = file->readNumber(); + _fieldEC = file->readNumber(); + + CBackground::load(file); +} + +bool CLemonDispensor::FrameMsg(CFrameMsg *msg) { + if (_v2 || !_isSummer) + return true; + + if (!_draggingObject) { + CGameObject *obj = getDraggingObject(); + if (obj && getView() == findView()) { + if (obj->isEquals("Perch")) { + petDisplayMessage(1, "This stick is too short to reach the branches."); + return true; + } + + if (obj->isEquals("LongStick")) + _draggingObject = obj; + } + } + + if (_draggingObject) { + Point pt(_origPt.x + _draggingObject->_bounds.left, + _origPt.y + _draggingObject->_bounds.top); + bool flag = checkPoint(pt, true); + + if (_fieldEC == 0) { + if (flag && ++_v3 > 10) { + CLemonFallsFromTreeMsg lemonMsg(pt); + lemonMsg.execute("Lemon"); + _v2 = 1; + } + } else if (_fieldEC == 1 && !flag) { + _fieldEC = 0; + } + } + + return true; +} + +bool CLemonDispensor::ChangeSeasonMsg(CChangeSeasonMsg *msg) { + _isSummer = msg->_season == "Summer"; + return true; +} + +bool CLemonDispensor::LeaveViewMsg(CLeaveViewMsg *msg) { + _draggingObject = nullptr; + _v3 = 0; + _fieldEC = 0; + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/lemon_dispensor.h b/engines/titanic/game/lemon_dispensor.h new file mode 100644 index 0000000000..933e0b6af0 --- /dev/null +++ b/engines/titanic/game/lemon_dispensor.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_LEMON_DISPENSOR_H +#define TITANIC_LEMON_DISPENSOR_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CLemonDispensor : public CBackground { + DECLARE_MESSAGE_MAP; + bool FrameMsg(CFrameMsg *msg); + bool ChangeSeasonMsg(CChangeSeasonMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); +private: + static bool _isSummer; + static int _v2; + static int _v3; + static CGameObject *_draggingObject; + + int _fieldE0; + Point _origPt; + int _fieldEC; +public: + CLASSDEF; + CLemonDispensor(); + + /** + * Initialize statics + */ + static void init(); + + /** + * 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_LEMON_DISPENSOR_H */ diff --git a/engines/titanic/game/light.cpp b/engines/titanic/game/light.cpp new file mode 100644 index 0000000000..65e357047e --- /dev/null +++ b/engines/titanic/game/light.cpp @@ -0,0 +1,152 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/light.h" +#include "titanic/game/television.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CLight, CBackground) + ON_MESSAGE(TurnOff) + ON_MESSAGE(LightsMsg) + ON_MESSAGE(MouseButtonUpMsg) + ON_MESSAGE(TurnOn) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(EnterRoomMsg) +END_MESSAGE_MAP() + +CLight::CLight() : CBackground(), _fieldE0(0), _fieldE4(0), + _fieldE8(0), _fieldEC(0), _fieldF0(0), _fieldF4(0), + _fieldF8(0), _fieldFC(0) { +} + +void CLight::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_fieldF0, indent); + file->writeNumberLine(_fieldF4, indent); + file->writeNumberLine(_fieldF8, indent); + file->writeNumberLine(_fieldFC, indent); + + CBackground::save(file, indent); +} + +void CLight::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + _fieldF0 = file->readNumber(); + _fieldF4 = file->readNumber(); + _fieldF8 = file->readNumber(); + _fieldFC = file->readNumber(); + + CBackground::load(file); +} + +bool CLight::TurnOff(CTurnOff *msg) { + setVisible(false); + return true; +} + +bool CLight::LightsMsg(CLightsMsg *msg) { + if ((msg->_flag2 && _fieldE8) || (msg->_flag3 && _fieldEC) + || (msg->_flag1 && _fieldE4) || (msg->_flag4 && _fieldF0)) { + setVisible(true); + } else { + setVisible(false); + } + + return true; +} + +bool CLight::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + // WORKAROUND: Original code doesn't seem to do anything + return true; +} + +bool CLight::TurnOn(CTurnOn *msg) { + setVisible(true); + return true; +} + +bool CLight::StatusChangeMsg(CStatusChangeMsg *msg) { + CPetControl *pet = getPetControl(); + bool flag = pet ? pet->isRoom59706() : false; + + if (_fieldFC == 1 && flag) { + petDisplayMessage(1, "That light appears to be loose."); + playSound("z#144.wav", 70); + } else { + petDisplayMessage(1, "Lumi-Glow(tm) Lights. They glow in the dark!"); + playSound("z#62.wav", 70); + } + + return true; +} + +bool CLight::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + CPetControl *pet = getPetControl(); + bool flag = pet ? pet->isRoom59706() : false; + + if (_fieldFC == 1 && flag) { + petDisplayMessage(1, "That light appears to be loose."); + playSound("z#144.wav", 70); + } else { + petDisplayMessage(1, "Lumi-Glow(tm) Lights. They glow in the dark!"); + playSound("z#62.wav", 70); + } + + return true; +} + +bool CLight::ActMsg(CActMsg *msg) { + if (msg->_action == "Eye Removed") + _fieldFC = 0; + + return true; +} + +bool CLight::EnterRoomMsg(CEnterRoomMsg *msg) { + CPetControl *pet = getPetControl(); + setVisible(true); + + if (isEquals("6WTL")) { + CLightsMsg lightsMsg(1, 1, 1, 1); + lightsMsg.execute("1stClassState", CLight::_type, MSGFLAG_SCAN); + + bool flag = pet ? pet->isRoom59706() : false; + if (flag) + CTelevision::_turnOn = true; + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/light.h b/engines/titanic/game/light.h new file mode 100644 index 0000000000..68223275e5 --- /dev/null +++ b/engines/titanic/game/light.h @@ -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. + * + */ + +#ifndef TITANIC_LIGHT_H +#define TITANIC_LIGHT_H + +#include "titanic/core/background.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CLight : public CBackground { + DECLARE_MESSAGE_MAP; + bool TurnOff(CTurnOff *msg); + bool LightsMsg(CLightsMsg *msg); + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); + bool TurnOn(CTurnOn *msg); + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool ActMsg(CActMsg *msg); + bool EnterRoomMsg(CEnterRoomMsg *msg); +private: + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; + int _fieldF0; + int _fieldF4; + int _fieldF8; + int _fieldFC; +public: + CLASSDEF; + CLight(); + + /** + * 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_LIGHT_H */ diff --git a/engines/titanic/game/light_switch.cpp b/engines/titanic/game/light_switch.cpp new file mode 100644 index 0000000000..188691033a --- /dev/null +++ b/engines/titanic/game/light_switch.cpp @@ -0,0 +1,152 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/light_switch.h" +#include "titanic/game/light.h" +#include "titanic/game/television.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CLightSwitch, CBackground) + ON_MESSAGE(PETUpMsg) + ON_MESSAGE(PETDownMsg) + ON_MESSAGE(PETLeftMsg) + ON_MESSAGE(PETRightMsg) + ON_MESSAGE(PETActivateMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(EnterRoomMsg) +END_MESSAGE_MAP() + +bool CLightSwitch::_flag; + +CLightSwitch::CLightSwitch() : CBackground(), + _fieldE0(0), _fieldE4(0), _fieldE8(0) { +} + +void CLightSwitch::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_flag, indent); + file->writeNumberLine(_fieldE8, indent); + + CBackground::save(file, indent); +} + +void CLightSwitch::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _flag = file->readNumber(); + _fieldE8 = file->readNumber(); + + CBackground::load(file); +} + +bool CLightSwitch::PETUpMsg(CPETUpMsg *msg) { + if (msg->_name == "Light") { + CLightsMsg lightsMsg(true, true, false, false); + lightsMsg.execute("1stClassState", CLight::_type, MSGFLAG_SCAN); + + if (_fieldE8) + CTelevision::_turnOn = true; + } + + return true; +} + +bool CLightSwitch::PETDownMsg(CPETDownMsg *msg) { + if (msg->_name == "Light") { + CLightsMsg lightsMsg(false, false, true, true); + lightsMsg.execute("1stClassState", CLight::_type, MSGFLAG_SCAN); + + if (_fieldE8) + CTelevision::_turnOn = true; + } + + return true; +} + +bool CLightSwitch::PETLeftMsg(CPETLeftMsg *msg) { + if (msg->_name == "Light") { + CLightsMsg lightsMsg(false, true, true, false); + lightsMsg.execute("1stClassState", CLight::_type, MSGFLAG_SCAN); + + if (_fieldE8) + CTelevision::_turnOn = true; + } + + return true; +} + +bool CLightSwitch::PETRightMsg(CPETRightMsg *msg) { + if (msg->_name == "Light") { + CLightsMsg lightsMsg(true, false, false, true); + lightsMsg.execute("1stClassState", CLight::_type, MSGFLAG_SCAN); + + if (_fieldE8) + CTelevision::_turnOn = true; + } + + return true; +} + +bool CLightSwitch::PETActivateMsg(CPETActivateMsg *msg) { + if (msg->_name == "Light") { + if (_flag) { + CTurnOff offMsg; + offMsg.execute("1stClassState", CLight::_type, MSGFLAG_CLASS_DEF | MSGFLAG_SCAN); + + } else { + CTurnOn onMsg; + onMsg.execute("1stClassState", CLight::_type, MSGFLAG_CLASS_DEF | MSGFLAG_SCAN); + _flag = false; + if (_fieldE8) + CTelevision::_turnOn = false; + } + } + + return true; +} + +bool CLightSwitch::EnterViewMsg(CEnterViewMsg *msg) { + petSetRemoteTarget(); + return true; +} + +bool CLightSwitch::LeaveViewMsg(CLeaveViewMsg *msg) { + petClear(); + return true; +} + +bool CLightSwitch::EnterRoomMsg(CEnterRoomMsg *msg) { + _flag = true; + CPetControl *pet = getPetControl(); + if (pet) + _fieldE8 = pet->isRoom59706(); + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/light_switch.h b/engines/titanic/game/light_switch.h new file mode 100644 index 0000000000..f8c01dc8b0 --- /dev/null +++ b/engines/titanic/game/light_switch.h @@ -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. + * + */ + +#ifndef TITANIC_LIGHT_SWITCH_H +#define TITANIC_LIGHT_SWITCH_H + +#include "titanic/core/background.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/pet_messages.h" + +namespace Titanic { + +class CLightSwitch : public CBackground { + DECLARE_MESSAGE_MAP; + bool PETUpMsg(CPETUpMsg *msg); + bool PETDownMsg(CPETDownMsg *msg); + bool PETLeftMsg(CPETLeftMsg *msg); + bool PETRightMsg(CPETRightMsg *msg); + bool PETActivateMsg(CPETActivateMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool EnterRoomMsg(CEnterRoomMsg *msg); +public: + static bool _flag; +private: + int _fieldE0; + int _fieldE4; + int _fieldE8; +public: + CLASSDEF; + CLightSwitch(); + + /** + * 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_LIGHT_SWITCH_H */ diff --git a/engines/titanic/game/little_lift_button.cpp b/engines/titanic/game/little_lift_button.cpp new file mode 100644 index 0000000000..afda4cac1d --- /dev/null +++ b/engines/titanic/game/little_lift_button.cpp @@ -0,0 +1,64 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/little_lift_button.h" +#include "titanic/core/room_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CLittleLiftButton, CBackground) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + +void CLittleLiftButton::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CBackground::save(file, indent); +} + +void CLittleLiftButton::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CBackground::load(file); +} + +bool CLittleLiftButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + playMovie(MOVIE_NOTIFY_OBJECT); + playSound("z#60.wav"); + return true; +} + +bool CLittleLiftButton::MovieEndMsg(CMovieEndMsg *msg) { + changeView("SecClassLittleLift.Node 1.N"); + + CRoomItem *room = getRoom(); + if (room) { + CStatusChangeMsg statusMsg; + statusMsg._newStatus = _value; + statusMsg.execute(room, nullptr, MSGFLAG_SCAN); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/little_lift_button.h b/engines/titanic/game/little_lift_button.h new file mode 100644 index 0000000000..2cbf3b97ff --- /dev/null +++ b/engines/titanic/game/little_lift_button.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_LITTLE_LIFT_BUTTON_H +#define TITANIC_LITTLE_LIFT_BUTTON_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CLittleLiftButton : public CBackground { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); +private: + int _value; +public: + CLASSDEF; + CLittleLiftButton() : CBackground(), _value(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_LITTLE_LIFT_BUTTON_H */ diff --git a/engines/titanic/game/long_stick_dispenser.cpp b/engines/titanic/game/long_stick_dispenser.cpp new file mode 100644 index 0000000000..08a29f2e4b --- /dev/null +++ b/engines/titanic/game/long_stick_dispenser.cpp @@ -0,0 +1,150 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/long_stick_dispenser.h" +#include "titanic/core/project_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CLongStickDispenser, CGameObject) + ON_MESSAGE(PuzzleSolvedMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(VisibleMsg) + ON_MESSAGE(EnterRoomMsg) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(MouseDragStartMsg) +END_MESSAGE_MAP() + +void CLongStickDispenser::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + + CGameObject::save(file, indent); +} + +void CLongStickDispenser::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + + CGameObject::load(file); +} + +bool CLongStickDispenser::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) { + if (!_fieldBC && !_fieldC4 && !_fieldC0) { + CStatusChangeMsg statusMsg; + statusMsg.execute("ShatterGlass"); + _fieldC0 = 1; + loadFrame(19); + } else if (_fieldC0) { + playSound("z#63.wav"); + petDisplayMessage(1, "'This glass is totally and utterly unbreakable."); + } + + return true; +} + +bool CLongStickDispenser::MovieEndMsg(CMovieEndMsg *msg) { + CPuzzleSolvedMsg puzzleMsg; + puzzleMsg.execute("LongStick"); + _fieldC0 = 1; + return true; +} + +bool CLongStickDispenser::VisibleMsg(CVisibleMsg *msg) { + setVisible(msg->_visible); + return true; +} + +bool CLongStickDispenser::EnterRoomMsg(CEnterRoomMsg *msg) { + _fieldC0 = 0; + _fieldC4 = 1; + return true; +} + +bool CLongStickDispenser::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (!_fieldC0) { + playSound("z#62.wav"); + + switch (_fieldBC) { + case 0: + petDisplayMessage(1, "For emergency long stick, smash glass."); + break; + case 1: + petDisplayMessage(1, "This dispenser has suddenly been fitted with unbreakable glass " + "to prevent unseemly hoarding of sticks."); + break; + default: + break; + } + } + + return true; +} + +bool CLongStickDispenser::LeaveViewMsg(CLeaveViewMsg *msg) { + if (_fieldC0 == 1) { + if (_fieldC4) { + playMovie(19, 38, MOVIE_GAMESTATE); + } else { + playMovie(0, 18, MOVIE_GAMESTATE); + _fieldBC = 1; + } + + _fieldC4 = 1; + _fieldC0 = 0; + } + + return true; +} + +bool CLongStickDispenser::EnterViewMsg(CEnterViewMsg *msg) { + setVisible(true); + loadFrame(38); + _cursorId = CURSOR_HAND; + return true; +} + +bool CLongStickDispenser::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (!checkStartDragging(msg)) { + return false; + } else if (_fieldC0 == 1 && _fieldC4 == 1) { + CVisibleMsg visibleMsg(true); + visibleMsg.execute("LongStick"); + CPassOnDragStartMsg dragMsg(msg->_mousePos, 1); + dragMsg.execute("LongStick"); + + msg->_dragItem = getRoot()->findByName("LongStick"); + loadFrame(0); + _fieldC4 = 0; + _cursorId = CURSOR_ARROW; + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/long_stick_dispenser.h b/engines/titanic/game/long_stick_dispenser.h new file mode 100644 index 0000000000..be05ef9c65 --- /dev/null +++ b/engines/titanic/game/long_stick_dispenser.h @@ -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. + * + */ + +#ifndef TITANIC_LONG_STICK_DISPENSER_H +#define TITANIC_LONG_STICK_DISPENSER_H + +#include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CLongStickDispenser : public CGameObject { + DECLARE_MESSAGE_MAP; + bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool VisibleMsg(CVisibleMsg *msg); + bool EnterRoomMsg(CEnterRoomMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); +private: + int _fieldBC; + int _fieldC0; + int _fieldC4; +public: + CLASSDEF; + CLongStickDispenser() : CGameObject(), _fieldBC(0), + _fieldC0(0), _fieldC4(1) {} + + /** + * 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_DISPENSER_H */ diff --git a/engines/titanic/game/maitred/maitred_arm_holder.cpp b/engines/titanic/game/maitred/maitred_arm_holder.cpp new file mode 100644 index 0000000000..75d95640d2 --- /dev/null +++ b/engines/titanic/game/maitred/maitred_arm_holder.cpp @@ -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. + * + */ + +#include "titanic/game/maitred/maitred_arm_holder.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CMaitreDArmHolder, CDropTarget) + ON_MESSAGE(MaitreDArmHolder) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + +void CMaitreDArmHolder::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CDropTarget::save(file, indent); +} + +void CMaitreDArmHolder::load(SimpleFile *file) { + file->readNumber(); + CDropTarget::load(file); +} + +bool CMaitreDArmHolder::MaitreDArmHolder(CMaitreDArmHolder *msg) { + _fieldF4 = 0; + return true; +} + +bool CMaitreDArmHolder::ActMsg(CActMsg *msg) { + if (msg->_action == "LoseArm") { + _bounds = Rect(); + setVisible(false); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/maitred/maitred_arm_holder.h b/engines/titanic/game/maitred/maitred_arm_holder.h new file mode 100644 index 0000000000..22f961f236 --- /dev/null +++ b/engines/titanic/game/maitred/maitred_arm_holder.h @@ -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. + * + */ + +#ifndef TITANIC_MAITRED_ARM_HOLDER_H +#define TITANIC_MAITRED_ARM_HOLDER_H + +#include "titanic/core/drop_target.h" + +namespace Titanic { + +class CMaitreDArmHolder : public CDropTarget { + DECLARE_MESSAGE_MAP; + bool MaitreDArmHolder(CMaitreDArmHolder *msg); + bool ActMsg(CActMsg *msg); +public: + CLASSDEF; + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MAITRED_ARM_HOLDER_H */ diff --git a/engines/titanic/game/maitred/maitred_body.cpp b/engines/titanic/game/maitred/maitred_body.cpp new file mode 100644 index 0000000000..4cb12aac8f --- /dev/null +++ b/engines/titanic/game/maitred/maitred_body.cpp @@ -0,0 +1,75 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/maitred/maitred_body.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CMaitreDBody, CMaitreDProdReceptor) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(AnimateMaitreDMsg) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + +void CMaitreDBody::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_armed, indent); + CMaitreDProdReceptor::save(file, indent); +} + +void CMaitreDBody::load(SimpleFile *file) { + file->readNumber(); + _armed = file->readNumber(); + CMaitreDProdReceptor::load(file); +} + +bool CMaitreDBody::EnterViewMsg(CEnterViewMsg *msg) { + return true; +} + +bool CMaitreDBody::AnimateMaitreDMsg(CAnimateMaitreDMsg *msg) { + static const char *const ARMED_CLIPS[5] = { + "Talking 1", "Talking 2", "Talking 3", "Talking 4", nullptr + }; + static const char *const UNARMED_CLIPS[5] = { + "Armless Talking 1", "Armless Talking 2", "Armless Talking 3", + "Armless Talking 4", nullptr + }; + + if (!hasActiveMovie()) { + playRandomClip(_armed ? ARMED_CLIPS : UNARMED_CLIPS); + } + + return true; +} + +bool CMaitreDBody::ActMsg(CActMsg *msg) { + if (msg->_action == "LoseArm") { + _armed = false; + loadFrame(262); + playSound("c#75.wav"); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/maitred/maitred_body.h b/engines/titanic/game/maitred/maitred_body.h new file mode 100644 index 0000000000..1798958e84 --- /dev/null +++ b/engines/titanic/game/maitred/maitred_body.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_MAITRED_BODY_H +#define TITANIC_MAITRED_BODY_H + +#include "titanic/game/maitred/maitred_prod_receptor.h" + +namespace Titanic { + +class CMaitreDBody : public CMaitreDProdReceptor { + DECLARE_MESSAGE_MAP; + bool EnterViewMsg(CEnterViewMsg *msg); + bool AnimateMaitreDMsg(CAnimateMaitreDMsg *msg); + bool ActMsg(CActMsg *msg); +private: + bool _armed; +public: + CLASSDEF; + CMaitreDBody() : CMaitreDProdReceptor(), _armed(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_MAITRED_BODY_H */ diff --git a/engines/titanic/game/maitred/maitred_legs.cpp b/engines/titanic/game/maitred/maitred_legs.cpp new file mode 100644 index 0000000000..8c0b0db5ea --- /dev/null +++ b/engines/titanic/game/maitred/maitred_legs.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/game/maitred/maitred_legs.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CMaitreDLegs, CMaitreDProdReceptor) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(AnimateMaitreDMsg) +END_MESSAGE_MAP() + +void CMaitreDLegs::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_flag, indent); + CMaitreDProdReceptor::save(file, indent); +} + +void CMaitreDLegs::load(SimpleFile *file) { + file->readNumber(); + _flag = file->readNumber(); + CMaitreDProdReceptor::load(file); +} + +bool CMaitreDLegs::EnterViewMsg(CEnterViewMsg *msg) { + _flag = true; + loadFrame(0); + return true; +} + +bool CMaitreDLegs::AnimateMaitreDMsg(CAnimateMaitreDMsg *msg) { + static const char *const WIGGLE_CLIPS[4] = { + "Hip Wiggle", "Knee Bend", "Wire Wiggle", nullptr + }; + static const char *const FIGHTING_CLIPS[4] = { + "Fighting 1", "Fighting 2", "Leg Fidget", nullptr + }; + static const char *const ARCING_SOUNDS[9] = { + "MaitreD Arcing 1.wav", "MaitreD Arcing 2.wav", + "MaitreD Arcing 3.wav", "MaitreD Arcing 4.wav", + "MaitreD Arcing 5.wav", "MaitreD Arcing 6.wav", + "MaitreD Arcing 7.wav", "MaitreD Arcing 8.wav", + "MaitreD Arcing 9.wav" + }; + + switch (msg->_value) { + case 0: + if (_flag) { + playRandomClip(FIGHTING_CLIPS); + + if (getRandomNumber(2) != 0) + playSound(ARCING_SOUNDS[getRandomNumber(9)], + 40 + getRandomNumber(30)); + } else { + playClip("Walk Right"); + _flag = true; + } + break; + + case 1: + if (_flag) { + playClip("Walk Left"); + _flag = false; + } else { + playRandomClip(WIGGLE_CLIPS); + } + break; + + default: + break; + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/maitred/maitred_legs.h b/engines/titanic/game/maitred/maitred_legs.h new file mode 100644 index 0000000000..b8a32eef4c --- /dev/null +++ b/engines/titanic/game/maitred/maitred_legs.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_MAITRED_LEGS_H +#define TITANIC_MAITRED_LEGS_H + +#include "titanic/game/maitred/maitred_prod_receptor.h" + +namespace Titanic { + +class CMaitreDLegs : public CMaitreDProdReceptor { + DECLARE_MESSAGE_MAP; + bool EnterViewMsg(CEnterViewMsg *msg); + bool AnimateMaitreDMsg(CAnimateMaitreDMsg *msg); +private: + bool _flag; +public: + CLASSDEF; + CMaitreDLegs() : CMaitreDProdReceptor(), _flag(true) {} + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MAITRED_LEGS_H */ diff --git a/engines/titanic/game/maitred/maitred_prod_receptor.cpp b/engines/titanic/game/maitred/maitred_prod_receptor.cpp new file mode 100644 index 0000000000..66533a542f --- /dev/null +++ b/engines/titanic/game/maitred/maitred_prod_receptor.cpp @@ -0,0 +1,122 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/maitred/maitred_prod_receptor.h" +#include "titanic/npcs/maitre_d.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CMaitreDProdReceptor, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MouseMoveMsg) + ON_MESSAGE(ProdMaitreDMsg) + ON_MESSAGE(DisableMaitreDProdReceptor) +END_MESSAGE_MAP() + +void CMaitreDProdReceptor::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_counter, indent); + file->writeNumberLine(_fieldC4, indent); + + CGameObject::save(file, indent); +} + +void CMaitreDProdReceptor::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _counter = file->readNumber(); + _fieldC4 = file->readNumber(); + + CGameObject::load(file); +} + +bool CMaitreDProdReceptor::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_fieldBC == 2 && static_cast<CGameObject *>(getParent())->hasActiveMovie()) { + return false; + } else { + CProdMaitreDMsg prodMsg(126); + prodMsg.execute(this); + return true; + } +} + +bool CMaitreDProdReceptor::MouseMoveMsg(CMouseMoveMsg *msg) { + if (_fieldBC == 2 && static_cast<CGameObject *>(getParent())->hasActiveMovie()) + return false; + else if (++_counter < 20) + return true; + + _counter = 0; + CProdMaitreDMsg prodMsg(126); + + if (isEquals("Stick")) + prodMsg._value = 121; + else if (isEquals("Hammer")) + prodMsg._value = 122; + else if (isEquals("Lemon")) + prodMsg._value = 123; + else if (isEquals("Chicken")) + prodMsg._value = 124; + else if (isEquals("Perch")) + prodMsg._value = 125; + + CMaitreD *maitreD = static_cast<CMaitreD *>(findRoomObject("MaitreD")); + if (maitreD->_field100 <= 0) + prodMsg.execute(this); + + return true; +} + +bool CMaitreDProdReceptor::ProdMaitreDMsg(CProdMaitreDMsg *msg) { + if (_fieldC4) { + CMaitreD *maitreD = static_cast<CMaitreD *>(findRoomObject("MaitreD")); + if (maitreD->_field100 <= 0) { + CViewItem *view = findView(); + startTalking(maitreD, msg->_value, view); + + switch (_fieldBC) { + case 1: + startTalking(maitreD, 128, view); + break; + case 2: + startTalking(maitreD, 129, view); + break; + case 3: + startTalking(maitreD, 127, view); + break; + default: + startTalking(maitreD, 130, view); + break; + } + } + } + + return true; +} + +bool CMaitreDProdReceptor::DisableMaitreDProdReceptor(CDisableMaitreDProdReceptor *msg) { + _fieldC4 = 0; + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/maitred/maitred_prod_receptor.h b/engines/titanic/game/maitred/maitred_prod_receptor.h new file mode 100644 index 0000000000..0b00ce0014 --- /dev/null +++ b/engines/titanic/game/maitred/maitred_prod_receptor.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_MAITRED_PROD_RECEPTOR_H +#define TITANIC_MAITRED_PROD_RECEPTOR_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CMaitreDProdReceptor : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MouseMoveMsg(CMouseMoveMsg *msg); + bool ProdMaitreDMsg(CProdMaitreDMsg *msg); + bool DisableMaitreDProdReceptor(CDisableMaitreDProdReceptor *msg); +protected: + int _fieldBC; + int _counter; + int _fieldC4; +public: + CLASSDEF; + CMaitreDProdReceptor() : CGameObject(), + _fieldBC(0), _counter(0), _fieldC4(1) {} + + /** + * 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_PROD_RECEPTOR_H */ diff --git a/engines/titanic/game/missiveomat.cpp b/engines/titanic/game/missiveomat.cpp new file mode 100644 index 0000000000..6f47131716 --- /dev/null +++ b/engines/titanic/game/missiveomat.cpp @@ -0,0 +1,330 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/missiveomat.h" +#include "titanic/core/room_item.h" +#include "titanic/titanic.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CMissiveOMat, CGameObject) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(KeyCharMsg) + ON_MESSAGE(TimerMsg) + ON_MESSAGE(MissiveOMatActionMsg) + ON_MESSAGE(LeaveViewMsg) +END_MESSAGE_MAP() + +CMissiveOMat::CMissiveOMat() : CGameObject(), _mode(1), + _totalMessages(0), _messageNum(0), _personIndex(-1) { + // Load data for the messages, their from and to names + loadArray(_welcomeMessages, "TEXT/MISSIVEOMAT/WELCOME", 3); + loadArray(_messages, "TEXT/MISSIVEOMAT/MESSAGES", 58); + loadArray(_from, "TEXT/MISSIVEOMAT/FROM", 58); + loadArray(_to, "TEXT/MISSIVEOMAT/TO", 58); +} + +void CMissiveOMat::loadArray(CString *arr, const CString &resName, int count) { + Common::SeekableReadStream *s = g_vm->_filesManager->getResource(resName); + for (int idx = 0; idx < count; ++idx) + arr[idx] = readStringFromStream(s); + delete s; +} + +void CMissiveOMat::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_mode, indent); + file->writeNumberLine(_totalMessages, indent); + file->writeNumberLine(_messageNum, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_personIndex, indent); + + CGameObject::save(file, indent); +} + +void CMissiveOMat::load(SimpleFile *file) { + file->readNumber(); + _mode = file->readNumber(); + _totalMessages = file->readNumber(); + _messageNum = file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + _personIndex = file->readNumber(); + + CGameObject::load(file); +} + +bool CMissiveOMat::EnterViewMsg(CEnterViewMsg *msg) { + CMissiveOMatActionMsg actionMsg(9); + actionMsg.execute(this); + return true; +} + +bool CMissiveOMat::KeyCharMsg(CKeyCharMsg *msg) { + CTreeItem *loginControl = findRoom()->findByName("MissiveOMat Login Control"); + CTreeItem *welcome = findRoom()->findByName("MissiveOMat Welcome"); + CTreeItem *scrollUp = findRoom()->findByName("MissiveOMat ScrollUp Button"); + CEditControlMsg editMsg; + + switch (_mode) { + case 1: { + playSound("z#228.wav"); + editMsg._mode = 6; + editMsg._param = msg->_key; + editMsg.execute(loginControl); + + if (editMsg._param == 1000) { + editMsg._mode = 3; + editMsg.execute(loginControl); + + _string1 = editMsg._text; + if (!_string1.empty()) { + loadFrame(2); + _mode = 2; + + editMsg._mode = 1; + editMsg.execute(loginControl); + editMsg._mode = 10; + editMsg._param = 24; + editMsg.execute(loginControl); + } + } + break; + } + + case 2: { + playSound("z#228.wav"); + editMsg._mode = 6; + editMsg._param = msg->_key; + editMsg.execute(loginControl); + + _string2 = editMsg._text; + if (_string1 == "Droot Scraliontis") { + _string1 = "Scraliontis"; + } else if (_string1 == "Antar Brobostigon") { + _string1 = "Brobostigon"; + } else if (_string1 == "colin") { + _string1 = "Leovinus"; + } + + bool flag = false; + if (_string1 == "Leovinus") { + if (_string2 == "Other") { + flag = true; + _personIndex = 0; + } + } else if (_string1 == "Scraliontis") { + if (_string2 == "This") { + flag = true; + _personIndex = 1; + } + } else if (_string1 == "Brobostigon") { + if (_string2 == "That") { + flag = true; + _personIndex = 2; + } + } + + if (flag) { + _mode = 4; + loadFrame(4); + editMsg._mode = 1; + editMsg.execute(loginControl); + + getTextCursor()->hide(); + editMsg._mode = 13; + editMsg.execute(loginControl); + + editMsg._mode = 12; + editMsg.execute(welcome); + + editMsg._mode = 2; + editMsg._text = _welcomeMessages[_personIndex]; + editMsg.execute(welcome); + + editMsg._mode = 12; + editMsg._text = "MissiveOMat OK Button"; + editMsg.execute(welcome); + editMsg.execute(scrollUp); + } else { + _mode = 3; + loadFrame(3); + addTimer(1500); + + editMsg._mode = 1; + editMsg.execute(loginControl); + + getTextCursor()->hide(); + } + break; + } + + default: + break; + } + + return true; +} + +bool CMissiveOMat::TimerMsg(CTimerMsg *msg) { + if (_mode == 3) { + CTreeItem *loginControl = findRoom()->findByName("MissiveOMat Login Control"); + CEditControlMsg editMsg; + editMsg._mode = 10; + editMsg._param = 8; + editMsg.execute(loginControl); + } + + return true; +} + +bool CMissiveOMat::MissiveOMatActionMsg(CMissiveOMatActionMsg *msg) { + CTreeItem *welcome = findByName("MissiveOMat Welcome"); + + switch (msg->_action) { + case MESSAGE_SHOW: { + CTreeItem *btnOk = findRoom()->findByName("MissiveOMat OK Button"); + CTreeItem *btnNext = findRoom()->findByName("MissiveOMat Next Button"); + CTreeItem *btnPrev = findRoom()->findByName("MissiveOMat Prev Button"); + CTreeItem *btnLogout = findRoom()->findByName("MissiveOMat Logout Button"); + + _mode = MESSAGE_5; + CVisibleMsg visibleMsg; + visibleMsg._visible = false; + visibleMsg.execute(btnOk); + visibleMsg._visible = true; + visibleMsg.execute(btnNext); + visibleMsg.execute(btnPrev); + visibleMsg.execute(btnLogout); + + _messageNum = 0; + _totalMessages = 0; + CString *strP = &_messages[_personIndex * 19]; + for (_totalMessages = 0; !strP->empty(); ++strP, ++_totalMessages) + ; + + CMissiveOMatActionMsg actionMsg; + actionMsg._action = REDRAW_MESSAGE; + actionMsg.execute(this); + break; + } + + case NEXT_MESSAGE: + if (_messageNum < (_totalMessages - 1)) { + ++_messageNum; + CMissiveOMatActionMsg actionMsg; + actionMsg._action = REDRAW_MESSAGE; + actionMsg.execute(this); + } + break; + + case PRIOR_MESSAGE: + if (_messageNum > 0) { + --_messageNum; + CMissiveOMatActionMsg actionMsg; + actionMsg._action = REDRAW_MESSAGE; + actionMsg.execute(this); + } + break; + + case MESSAGE_5: { + CMissiveOMatActionMsg actionMsg; + actionMsg._action = MESSAGE_9; + actionMsg.execute(this); + break; + } + + case MESSAGE_DOWN: + if (welcome) + scrollTextDown(); + break; + + case MESSAGE_UP: + if (welcome) + scrollTextUp(); + break; + + case REDRAW_MESSAGE: + if (welcome) { + CString str = CString::format( + "Missive %d of %d.\nFrom: %s\nTo: %s\n\n%s\n", + _messageNum + 1, _totalMessages, _from[_messageNum].c_str(), + _to[_messageNum].c_str(), _messages[_messageNum].c_str()); + + setText(str); + } + break; + + case MESSAGE_9: { + loadFrame(1); + _mode = MESSAGE_NONE; + _personIndex = -1; + + static const char *const WIDGETS[7] = { + "MissiveOMat Login Control", "MissiveOMat OK Button", + "MissiveOMat Next Button", "MissiveOMat Prev Button", + "MissiveOMat Logout Button", "MissiveOMat ScrollDown Button", + "MissiveOMat ScrollUp Button" + }; + CEditControlMsg editMsg; + + for (int idx = 0; idx < 7; ++idx) { + editMsg._mode = 0; + editMsg._param = 12; + editMsg.execute(WIDGETS[idx]); + editMsg._mode = 1; + editMsg.execute(WIDGETS[idx]); + editMsg._mode = 13; + editMsg.execute(WIDGETS[idx]); + } + + editMsg._mode = 12; + editMsg.execute("MissiveOMat Login Control"); + editMsg._mode = 10; + editMsg._param = 8; + editMsg.execute("MissiveOMat Login Control"); + editMsg._mode = 8; + editMsg.execute("MissiveOMat Login Control"); + + _string1.clear(); + _string2.clear(); + break; + } + + default: + break; + } + + return true; +} + +bool CMissiveOMat::LeaveViewMsg(CLeaveViewMsg *msg) { + CEditControlMsg editMsg; + editMsg._mode = 9; + editMsg.execute("MissiveOMat Login Control"); + petShowCursor(); + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/missiveomat.h b/engines/titanic/game/missiveomat.h new file mode 100644 index 0000000000..9810fcc403 --- /dev/null +++ b/engines/titanic/game/missiveomat.h @@ -0,0 +1,74 @@ +/* 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_MISSIVEOMAT_H +#define TITANIC_MISSIVEOMAT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +enum MissiveOMatAction { + MESSAGE_NONE = 1, MESSAGE_SHOW = 2, NEXT_MESSAGE = 3, PRIOR_MESSAGE = 4, + MESSAGE_5 = 5, MESSAGE_DOWN = 6, MESSAGE_UP = 7, REDRAW_MESSAGE = 8, + MESSAGE_9 = 9 +}; + +class CMissiveOMat : public CGameObject { + DECLARE_MESSAGE_MAP; + bool EnterViewMsg(CEnterViewMsg *msg); + bool KeyCharMsg(CKeyCharMsg *msg); + bool TimerMsg(CTimerMsg *msg); + bool MissiveOMatActionMsg(CMissiveOMatActionMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); +private: + CString _welcomeMessages[3]; + CString _messages[58]; + CString _from[58]; + CString _to[58]; +private: + void loadArray(CString *arr, const CString &resName, int count); +public: + int _mode; + int _totalMessages; + int _messageNum; + CString _string1; + CString _string2; + int _personIndex; +public: + CLASSDEF; + CMissiveOMat(); + + /** + * 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_MISSIVEOMAT_H */ diff --git a/engines/titanic/game/missiveomat_button.cpp b/engines/titanic/game/missiveomat_button.cpp new file mode 100644 index 0000000000..b7ad7f8f6f --- /dev/null +++ b/engines/titanic/game/missiveomat_button.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/game/missiveomat_button.h" +#include "titanic/core/room_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CMissiveOMatButton, CEditControl) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(VisibleMsg) + ON_MESSAGE(MouseDoubleClickMsg) +END_MESSAGE_MAP() + +void CMissiveOMatButton::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_buttonId, indent); + + CEditControl::save(file, indent); +} + +void CMissiveOMatButton::load(SimpleFile *file) { + file->readNumber(); + _buttonId = file->readNumber(); + + CEditControl::load(file); +} + +bool CMissiveOMatButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + CMissiveOMatActionMsg actionMsg; + actionMsg._action = _buttonId; + actionMsg.execute(findRoom()->findByName("MissiveOMat")); + return true; +} + +bool CMissiveOMatButton::VisibleMsg(CVisibleMsg *msg) { + setVisible(msg->_visible); + return true; +} + +bool CMissiveOMatButton::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { + CMissiveOMatActionMsg actionMsg; + actionMsg._action = _buttonId; + actionMsg.execute(findRoom()->findByName("MissiveOMat")); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/missiveomat_button.h b/engines/titanic/game/missiveomat_button.h new file mode 100644 index 0000000000..6dbfd4cd56 --- /dev/null +++ b/engines/titanic/game/missiveomat_button.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_MISSIVEOMAT_BUTTON_H +#define TITANIC_MISSIVEOMAT_BUTTON_H + +#include "titanic/gfx/edit_control.h" + +namespace Titanic { + +class CMissiveOMatButton : public CEditControl { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool VisibleMsg(CVisibleMsg *msg); + bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg); +public: + int _buttonId; +public: + CLASSDEF; + CMissiveOMatButton() : CEditControl(), _buttonId(2) {} + + /** + * 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_MISSIVEOMAT_BUTTON_H */ diff --git a/engines/titanic/game/movie_tester.cpp b/engines/titanic/game/movie_tester.cpp new file mode 100644 index 0000000000..bbd66a9bce --- /dev/null +++ b/engines/titanic/game/movie_tester.cpp @@ -0,0 +1,59 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/movie_tester.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CMovieTester, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) +END_MESSAGE_MAP() + +void CMovieTester::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_movieNumFrames, indent); + file->writeNumberLine(_movieFrameNum, indent); + CGameObject::save(file, indent); +} + +void CMovieTester::load(SimpleFile *file) { + file->readNumber(); + _movieNumFrames = file->readNumber(); + _movieFrameNum = file->readNumber(); + CGameObject::load(file); +} + +bool CMovieTester::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (msg->_buttons == MB_RIGHT) { + if (--_movieFrameNum < 0) { + _movieFrameNum = _movieNumFrames - 1; + } + } else { + if (++_movieFrameNum >= _movieNumFrames) + _movieFrameNum = 0; + } + + loadFrame(_movieFrameNum); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/movie_tester.h b/engines/titanic/game/movie_tester.h new file mode 100644 index 0000000000..17a7d489d8 --- /dev/null +++ b/engines/titanic/game/movie_tester.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_MOVIE_TESTER_H +#define TITANIC_MOVIE_TESTER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CMovieTester : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); +public: + int _movieNumFrames, _movieFrameNum; +public: + CLASSDEF; + CMovieTester() : CGameObject(), _movieNumFrames(0), _movieFrameNum(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_MOVIE_TESTER_H */ diff --git a/engines/titanic/game/music_console_button.cpp b/engines/titanic/game/music_console_button.cpp new file mode 100644 index 0000000000..9cf385e3a7 --- /dev/null +++ b/engines/titanic/game/music_console_button.cpp @@ -0,0 +1,133 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/music_console_button.h" +#include "titanic/core/room_item.h" +#include "titanic/sound/music_handler.h" +#include "titanic/titanic.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CMusicConsoleButton, CMusicPlayer) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(SetMusicControlsMsg) +END_MESSAGE_MAP() + +void CMusicConsoleButton::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CMusicPlayer::save(file, indent); +} + +void CMusicConsoleButton::load(SimpleFile *file) { + file->readNumber(); + CMusicPlayer::load(file); +} + +bool CMusicConsoleButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_isActive) { + CStopMusicMsg stopMsg(this); + stopMsg.execute(this); + stopMovie(); + loadFrame(0); + } else { + CStartMusicMsg startMsg(this); + startMsg.execute(this); + playMovie(MOVIE_REPEAT); + + CMusicHasStartedMsg startedMsg; + startedMsg.execute("Music Room Phonograph"); + + if (CMusicRoom::_musicHandler->checkSound(1) + && CMusicRoom::_musicHandler->checkSound(2) + && CMusicRoom::_musicHandler->checkSound(3)) { + CCorrectMusicPlayedMsg correctMsg; + correctMsg.execute(findRoom()); + } + } + + return true; +} + +bool CMusicConsoleButton::LeaveViewMsg(CLeaveViewMsg *msg) { + if (_isActive) { + CStopMusicMsg stopMsg(this); + stopMsg.execute(this); + stopMovie(); + loadFrame(0); + } + + return true; +} + +bool CMusicConsoleButton::SetMusicControlsMsg(CSetMusicControlsMsg *msg) { + CMusicRoom *musicRoom = getMusicRoom(); + CQueryMusicControlSettingMsg queryMsg; + + queryMsg.execute("Bells Mute Control"); + musicRoom->setItem5(BELLS, queryMsg._value == 1 ? 1 : 0); + queryMsg.execute("Bells Pitch Control"); + musicRoom->setItem2(BELLS, queryMsg._value); + queryMsg.execute("Bells Speed Control"); + musicRoom->setItem1(BELLS, queryMsg._value); + queryMsg.execute("Bells Inversion Control"); + musicRoom->setItem4(BELLS, queryMsg._value == 0 ? 1 : 0); + queryMsg.execute("Bells Direction Control"); + musicRoom->setItem3(BELLS, queryMsg._value == 0 ? 1 : 0); + + queryMsg.execute("Snake Mute Control"); + musicRoom->setItem5(SNAKE, queryMsg._value == 1 ? 1 : 0); + queryMsg.execute("Snake Pitch Control"); + musicRoom->setItem2(SNAKE, queryMsg._value); + queryMsg.execute("Snake Speed Control"); + musicRoom->setItem1(SNAKE, queryMsg._value); + queryMsg.execute("Snake Inversion Control"); + musicRoom->setItem4(SNAKE, queryMsg._value == 0 ? 1 : 0); + queryMsg.execute("Snake Direction Control"); + musicRoom->setItem3(SNAKE, queryMsg._value == 0 ? 1 : 0); + + queryMsg.execute("Piano Mute Control"); + musicRoom->setItem5(PIANO, queryMsg._value == 1 ? 1 : 0); + queryMsg.execute("Piano Pitch Control"); + musicRoom->setItem2(PIANO, queryMsg._value); + queryMsg.execute("Piano Speed Control"); + musicRoom->setItem1(PIANO, queryMsg._value); + queryMsg.execute("Piano Inversion Control"); + musicRoom->setItem4(PIANO, queryMsg._value == 0 ? 1 : 0); + queryMsg.execute("Piano Direction Control"); + musicRoom->setItem3(PIANO, queryMsg._value == 0 ? 1 : 0); + + queryMsg.execute("Bass Mute Control"); + musicRoom->setItem5(BASS, queryMsg._value == 1 ? 1 : 0); + queryMsg.execute("Bass Pitch Control"); + musicRoom->setItem2(BASS, queryMsg._value); + queryMsg.execute("Bass Speed Control"); + musicRoom->setItem1(BASS, queryMsg._value); + queryMsg.execute("Bass Inversion Control"); + musicRoom->setItem4(BASS, queryMsg._value == 0 ? 1 : 0); + queryMsg.execute("Bass Direction Control"); + musicRoom->setItem3(BASS, queryMsg._value == 0 ? 1 : 0); + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/music_console_button.h b/engines/titanic/game/music_console_button.h new file mode 100644 index 0000000000..80ce719c96 --- /dev/null +++ b/engines/titanic/game/music_console_button.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_MUSIC_CONSOLE_BUTTON_H +#define TITANIC_MUSIC_CONSOLE_BUTTON_H + +#include "titanic/sound/music_player.h" + +namespace Titanic { + +class CMusicConsoleButton : public CMusicPlayer { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool SetMusicControlsMsg(CSetMusicControlsMsg *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_MUSIC_CONSOLE_BUTTON_H */ diff --git a/engines/titanic/game/music_room_phonograph.cpp b/engines/titanic/game/music_room_phonograph.cpp new file mode 100644 index 0000000000..06a35dc4d5 --- /dev/null +++ b/engines/titanic/game/music_room_phonograph.cpp @@ -0,0 +1,41 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/music_room_phonograph.h" + +namespace Titanic { + +EMPTY_MESSAGE_MAP(CMusicRoomPhonograph, CRestaurantPhonograph); + +void CMusicRoomPhonograph::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field118, indent); + CRestaurantPhonograph::save(file, indent); +} + +void CMusicRoomPhonograph::load(SimpleFile *file) { + file->readNumber(); + _field118 = file->readNumber(); + CRestaurantPhonograph::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/music_room_phonograph.h b/engines/titanic/game/music_room_phonograph.h new file mode 100644 index 0000000000..9286861785 --- /dev/null +++ b/engines/titanic/game/music_room_phonograph.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_MUSIC_ROOM_PHONOGRAPH_H +#define TITANIC_MUSIC_ROOM_PHONOGRAPH_H + +#include "titanic/game/restaurant_phonograph.h" + +namespace Titanic { + +class CMusicRoomPhonograph : public CRestaurantPhonograph { + DECLARE_MESSAGE_MAP; +private: + int _field118; +public: + CLASSDEF; + CMusicRoomPhonograph() : CRestaurantPhonograph(), _field118(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_MUSIC_ROOM_PHONOGRAPH_H */ diff --git a/engines/titanic/game/music_room_stop_phonograph_button.cpp b/engines/titanic/game/music_room_stop_phonograph_button.cpp new file mode 100644 index 0000000000..dee2c0883e --- /dev/null +++ b/engines/titanic/game/music_room_stop_phonograph_button.cpp @@ -0,0 +1,75 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/music_room_stop_phonograph_button.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CMusicRoomStopPhonographButton, CEjectPhonographButton) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(FrameMsg) +END_MESSAGE_MAP() + +void CMusicRoomStopPhonographButton::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_ticks, indent); + CEjectPhonographButton::save(file, indent); +} + +void CMusicRoomStopPhonographButton::load(SimpleFile *file) { + file->readNumber(); + _ticks = file->readNumber(); + CEjectPhonographButton::load(file); +} + +bool CMusicRoomStopPhonographButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (!_ejected) { + loadFrame(1); + playSound(_soundName); + _readyFlag = true; + + CPhonographStopMsg stopMsg; + stopMsg.execute(getParent(), nullptr, MSGFLAG_SCAN); + if (stopMsg._value2) { + _ticks = getTicksCount(); + } else { + CEjectCylinderMsg ejectMsg; + ejectMsg.execute(getParent(), nullptr, MSGFLAG_SCAN); + _ejected = true; + } + } + + return true; +} + +bool CMusicRoomStopPhonographButton::FrameMsg(CFrameMsg *msg) { + if (_readyFlag && _ticks && msg->_ticks >= (_ticks + 100)) { + loadFrame(0); + playSound(_readySoundName); + _ticks = 0; + _readyFlag = false; + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/music_room_stop_phonograph_button.h b/engines/titanic/game/music_room_stop_phonograph_button.h new file mode 100644 index 0000000000..dd9e8b4bc0 --- /dev/null +++ b/engines/titanic/game/music_room_stop_phonograph_button.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_MUSIC_ROOM_STOP_PHONOGRAPH_BUTTON_H +#define TITANIC_MUSIC_ROOM_STOP_PHONOGRAPH_BUTTON_H + +#include "titanic/game/eject_phonograph_button.h" + +namespace Titanic { + +class CMusicRoomStopPhonographButton : public CEjectPhonographButton { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool FrameMsg(CFrameMsg *msg); +private: + uint _ticks; +public: + CLASSDEF; + CMusicRoomStopPhonographButton() : CEjectPhonographButton(), _ticks(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_MUSIC_ROOM_STOP_PHONOGRAPH_BUTTON_H */ diff --git a/engines/titanic/game/music_system_lock.cpp b/engines/titanic/game/music_system_lock.cpp new file mode 100644 index 0000000000..074864e7c3 --- /dev/null +++ b/engines/titanic/game/music_system_lock.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/game/music_system_lock.h" +#include "titanic/core/room_item.h" +#include "titanic/carry/carry.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CMusicSystemLock, CDropTarget) + ON_MESSAGE(DropObjectMsg) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + +void CMusicSystemLock::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CDropTarget::save(file, indent); +} + +void CMusicSystemLock::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CDropTarget::load(file); +} + +bool CMusicSystemLock::DropObjectMsg(CDropObjectMsg *msg) { + CTreeItem *key = msg->_item->findByName("Music System Key"); + if (key) { + setVisible(true); + playMovie(MOVIE_NOTIFY_OBJECT); + } + + return true; +} + +bool CMusicSystemLock::MovieEndMsg(CMovieEndMsg *msg) { + CTreeItem *phonograph = findRoom()->findByName("Restaurant Phonograph"); + CQueryPhonographState queryMsg; + queryMsg.execute(phonograph); + CLockPhonographMsg lockMsg(queryMsg._value); + lockMsg.execute(phonograph, nullptr, MSGFLAG_SCAN); + + setVisible(false); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/music_system_lock.h b/engines/titanic/game/music_system_lock.h new file mode 100644 index 0000000000..0947915caa --- /dev/null +++ b/engines/titanic/game/music_system_lock.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_MUSIC_SYSTEM_LOCK_H +#define TITANIC_MUSIC_SYSTEM_LOCK_H + +#include "titanic/core/drop_target.h" + +namespace Titanic { + +class CMusicSystemLock : public CDropTarget { + DECLARE_MESSAGE_MAP; + bool DropObjectMsg(CDropObjectMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); +private: + int _value; +public: + CLASSDEF; + CMusicSystemLock() : CDropTarget(), _value(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_MUSIC_SYSTEM_LOCK_H */ diff --git a/engines/titanic/game/musical_instrument.cpp b/engines/titanic/game/musical_instrument.cpp new file mode 100644 index 0000000000..3bd2e37ccc --- /dev/null +++ b/engines/titanic/game/musical_instrument.cpp @@ -0,0 +1,39 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/musical_instrument.h" + +namespace Titanic { + +EMPTY_MESSAGE_MAP(CMusicalInstrument, CBackground); + +void CMusicalInstrument::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CBackground::save(file, indent); +} + +void CMusicalInstrument::load(SimpleFile *file) { + file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/musical_instrument.h b/engines/titanic/game/musical_instrument.h new file mode 100644 index 0000000000..5d18ed91f0 --- /dev/null +++ b/engines/titanic/game/musical_instrument.h @@ -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. + * + */ + +#ifndef TITANIC_MUSICAL_INSTRUMENT_H +#define TITANIC_MUSICAL_INSTRUMENT_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CMusicalInstrument : public CBackground { + DECLARE_MESSAGE_MAP; +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_MUSICAL_INSTRUMENT_H */ diff --git a/engines/titanic/game/nav_helmet.cpp b/engines/titanic/game/nav_helmet.cpp new file mode 100644 index 0000000000..08ff073c26 --- /dev/null +++ b/engines/titanic/game/nav_helmet.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/game/nav_helmet.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CNavHelmet, CGameObject) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(PETHelmetOnOffMsg) + ON_MESSAGE(PETPhotoOnOffMsg) + ON_MESSAGE(PETStarFieldLockMsg) + ON_MESSAGE(PETSetStarDestinationMsg) +END_MESSAGE_MAP() + +void CNavHelmet::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_flag, indent); + CGameObject::save(file, indent); +} + +void CNavHelmet::load(SimpleFile *file) { + file->readNumber(); + _flag = file->readNumber(); + CGameObject::load(file); +} + +bool CNavHelmet::MovieEndMsg(CMovieEndMsg *msg) { + if (_flag) { + setVisible(false); + + CPetControl *pet = getPetControl(); + if (pet) { + pet->setArea(PET_STARFIELD); + petDisplayMessage(1, "Now would be an excellent opportunity to adjust your viewing apparatus."); + pet->incAreaLocks(); + } + + starFn1(0); + starFn1(12); + } + + return true; +} + +bool CNavHelmet::EnterViewMsg(CEnterViewMsg *msg) { + petSetRemoteTarget(); + return true; +} + +bool CNavHelmet::LeaveViewMsg(CLeaveViewMsg *msg) { + petClear(); + return true; +} + +bool CNavHelmet::PETHelmetOnOffMsg(CPETHelmetOnOffMsg *msg) { + CPetControl *pet = getPetControl(); + + if (_flag) { + _flag = false; + setVisible(true); + starFn1(1); + playMovie(61, 120, MOVIE_NOTIFY_OBJECT); + playSound("a#47.wav"); + playSound("a#48.wav"); + + if (pet) { + pet->decAreaLocks(); + pet->setArea(PET_REMOTE); + } + + dec54(); + } else { + inc54(); + _flag = true; + setVisible(true); + playMovie(0, 60, MOVIE_NOTIFY_OBJECT); + playSound("a#48.wav"); + playSound("a#47.wav"); + } + + return true; +} + +bool CNavHelmet::PETPhotoOnOffMsg(CPETPhotoOnOffMsg *msg) { + if (_flag) + starFn1(9); + + return true; +} + +bool CNavHelmet::PETStarFieldLockMsg(CPETStarFieldLockMsg *msg) { + if (_flag) { + if (msg->_value) { + playSound("a#6.wav"); + starFn1(17); + } else { + playSound("a#5.wav"); + starFn1(18); + } + } + + return true; +} + +bool CNavHelmet::PETSetStarDestinationMsg(CPETSetStarDestinationMsg *msg) { + CActMsg actMsg("SetDestin"); + actMsg.execute("CaptainsWheel"); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/nav_helmet.h b/engines/titanic/game/nav_helmet.h new file mode 100644 index 0000000000..c408d05c97 --- /dev/null +++ b/engines/titanic/game/nav_helmet.h @@ -0,0 +1,59 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_NAV_HELMET_H +#define TITANIC_NAV_HELMET_H + +#include "titanic/core/game_object.h" +#include "titanic/messages/pet_messages.h" + +namespace Titanic { + +class CNavHelmet : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MovieEndMsg(CMovieEndMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool PETHelmetOnOffMsg(CPETHelmetOnOffMsg *msg); + bool PETPhotoOnOffMsg(CPETPhotoOnOffMsg *msg); + bool PETStarFieldLockMsg(CPETStarFieldLockMsg *msg); + bool PETSetStarDestinationMsg(CPETSetStarDestinationMsg *msg); +private: + bool _flag; +public: + CLASSDEF; + CNavHelmet() : CGameObject(), _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_NAV_HELMET_H */ diff --git a/engines/titanic/game/nav_helmet_off.cpp b/engines/titanic/game/nav_helmet_off.cpp new file mode 100644 index 0000000000..289e9e3f55 --- /dev/null +++ b/engines/titanic/game/nav_helmet_off.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/game/nav_helmet_off.h" +#include "titanic/pet_control/pet_control.h" +#include "titanic/messages/pet_messages.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CNavHelmetOff, CNavHelmet) + ON_MESSAGE(MouseButtonUpMsg) +END_MESSAGE_MAP() + +void CNavHelmetOff::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_target, indent); +} + +void CNavHelmetOff::load(SimpleFile *file) { + file->readNumber(); + _target = file->readString(); +} + +bool CNavHelmetOff::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + CDoffNavHelmet doffMsg; + doffMsg.execute(_target); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/nav_helmet_off.h b/engines/titanic/game/nav_helmet_off.h new file mode 100644 index 0000000000..c9529fe8e9 --- /dev/null +++ b/engines/titanic/game/nav_helmet_off.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_NAV_HELMET_OFF_H +#define TITANIC_NAV_HELMET_OFF_H + +#include "titanic/game/nav_helmet.h" +#include "titanic/messages/pet_messages.h" + +namespace Titanic { + +class CNavHelmetOff : public CNavHelmet { + DECLARE_MESSAGE_MAP; + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); +private: + CString _target; +public: + CLASSDEF; + CNavHelmetOff() : CNavHelmet(), _target("NULL") {} + + /** + * 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_NAV_HELMET_OFF_H */ diff --git a/engines/titanic/game/nav_helmet_on.cpp b/engines/titanic/game/nav_helmet_on.cpp new file mode 100644 index 0000000000..59ceebc4ad --- /dev/null +++ b/engines/titanic/game/nav_helmet_on.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/game/nav_helmet_on.h" +#include "titanic/pet_control/pet_control.h" +#include "titanic/messages/pet_messages.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CNavHelmetOn, CNavHelmet) + ON_MESSAGE(MouseButtonUpMsg) +END_MESSAGE_MAP() + +void CNavHelmetOn::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_target, indent); +} + +void CNavHelmetOn::load(SimpleFile *file) { + file->readNumber(); + _target = file->readString(); +} + +bool CNavHelmetOn::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + CDonNavHelmet donMsg; + donMsg.execute(_target); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/nav_helmet_on.h b/engines/titanic/game/nav_helmet_on.h new file mode 100644 index 0000000000..452637c48a --- /dev/null +++ b/engines/titanic/game/nav_helmet_on.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_NAV_HELMET_ON_H +#define TITANIC_NAV_HELMET_ON_H + +#include "titanic/game/nav_helmet.h" +#include "titanic/messages/pet_messages.h" + +namespace Titanic { + +class CNavHelmetOn : public CNavHelmet { + DECLARE_MESSAGE_MAP; + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); +private: + CString _target; +public: + CLASSDEF; + CNavHelmetOn() : CNavHelmet(), _target("NULL") {} + + /** + * 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_NAV_HELMET_ON_H */ diff --git a/engines/titanic/game/navigation_computer.cpp b/engines/titanic/game/navigation_computer.cpp new file mode 100644 index 0000000000..49bd252988 --- /dev/null +++ b/engines/titanic/game/navigation_computer.cpp @@ -0,0 +1,39 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/navigation_computer.h" + +namespace Titanic { + +EMPTY_MESSAGE_MAP(CNavigationComputer, CGameObject); + +void CNavigationComputer::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CNavigationComputer::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/navigation_computer.h b/engines/titanic/game/navigation_computer.h new file mode 100644 index 0000000000..27d06c1f27 --- /dev/null +++ b/engines/titanic/game/navigation_computer.h @@ -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. + * + */ + +#ifndef TITANIC_NAVIGATION_COMPUTER_H +#define TITANIC_NAVIGATION_COMPUTER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CNavigationComputer : public CGameObject { + DECLARE_MESSAGE_MAP; +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_NAVIGATION_COMPUTER_H */ diff --git a/engines/titanic/game/no_nut_bowl.cpp b/engines/titanic/game/no_nut_bowl.cpp new file mode 100644 index 0000000000..8c0a95ac9a --- /dev/null +++ b/engines/titanic/game/no_nut_bowl.cpp @@ -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. + * + */ + +#include "titanic/game/no_nut_bowl.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CNoNutBowl, CBackground) + ON_MESSAGE(ActMsg) + ON_MESSAGE(ReplaceBowlAndNutsMsg) + ON_MESSAGE(NutPuzzleMsg) +END_MESSAGE_MAP() + +void CNoNutBowl::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CBackground::save(file, indent); +} + +void CNoNutBowl::load(SimpleFile *file) { + file->readNumber(); + CBackground::load(file); +} + +bool CNoNutBowl::ActMsg(CActMsg *msg) { + return true; +} + +bool CNoNutBowl::ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg) { + setVisible(false); + return true; +} + +bool CNoNutBowl::NutPuzzleMsg(CNutPuzzleMsg *msg) { + if (msg->_value == "NutsGone") + setVisible(true); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/no_nut_bowl.h b/engines/titanic/game/no_nut_bowl.h new file mode 100644 index 0000000000..cd8bc65179 --- /dev/null +++ b/engines/titanic/game/no_nut_bowl.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_NO_NUT_BOWL_H +#define TITANIC_NO_NUT_BOWL_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CNoNutBowl : public CBackground { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg); + bool NutPuzzleMsg(CNutPuzzleMsg *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_NO_NUT_BOWL_H */ diff --git a/engines/titanic/game/nose_holder.cpp b/engines/titanic/game/nose_holder.cpp new file mode 100644 index 0000000000..ac6c10dafd --- /dev/null +++ b/engines/titanic/game/nose_holder.cpp @@ -0,0 +1,121 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/nose_holder.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CNoseHolder, CDropTarget) + ON_MESSAGE(ActMsg) + ON_MESSAGE(FrameMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(EnterViewMsg) +END_MESSAGE_MAP() + +CNoseHolder::CNoseHolder() : CDropTarget(), _dragObject(nullptr), + _field11C(0) { +} + +void CNoseHolder::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field11C, indent); + + CDropTarget::save(file, indent); +} + +void CNoseHolder::load(SimpleFile *file) { + file->readNumber(); + _field11C = file->readNumber(); + + CDropTarget::load(file); +} + +bool CNoseHolder::ActMsg(CActMsg *msg) { + if (msg->_action == "Sneeze" && !_itemName.empty() && _fieldF4) { + CProximity prox; + prox._positioningMode = POSMODE_VECTOR; + playSound("z#35.wav", prox); + + if (getView() == findView()) { + setVisible(true); + playMovie(1, 13, MOVIE_NOTIFY_OBJECT); + } + } + + return true; +} + +bool CNoseHolder::FrameMsg(CFrameMsg *msg) { + if (!_dragObject) { + CGameObject *dragObj = getDraggingObject(); + if (!dragObj) + return false; + + if (!dragObj->isEquals("Feathers") || getView() != findView()) + return false; + + _dragObject = dragObj; + } + + if (_dragObject) { + if (!checkPoint(Point(_dragObject->_bounds.left, + _dragObject->_bounds.top))) { + _field11C = false; + } else if (!_field11C) { + CActMsg actMsg("Sneeze"); + actMsg.execute(this); + _field11C = true; + } + } + + return true; +} + +bool CNoseHolder::LeaveViewMsg(CLeaveViewMsg *msg) { + _field11C = false; + _dragObject = nullptr; + if (_fieldF4) { + loadFrame(_dropFrame); + setVisible(false); + } + + return true; +} + +bool CNoseHolder::MovieEndMsg(CMovieEndMsg *msg) { + if (_fieldF4) { + loadFrame(_dropFrame); + setVisible(false); + } + + return true; +} + +bool CNoseHolder::EnterViewMsg(CEnterViewMsg *msg) { + if (_fieldF4) + setVisible(false); + + return CDropTarget::EnterViewMsg(msg); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/nose_holder.h b/engines/titanic/game/nose_holder.h new file mode 100644 index 0000000000..7b3fbba625 --- /dev/null +++ b/engines/titanic/game/nose_holder.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_NOSE_HOLDER_H +#define TITANIC_NOSE_HOLDER_H + +#include "titanic/core/drop_target.h" + +namespace Titanic { + +class CNoseHolder : public CDropTarget { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool FrameMsg(CFrameMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); +private: + CGameObject *_dragObject; + int _field11C; +public: + CLASSDEF; + CNoseHolder(); + + /** + * 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_HOLDER_H */ diff --git a/engines/titanic/game/null_port_hole.cpp b/engines/titanic/game/null_port_hole.cpp new file mode 100644 index 0000000000..b1514c7cbf --- /dev/null +++ b/engines/titanic/game/null_port_hole.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/game/null_port_hole.h" + +namespace Titanic { + +EMPTY_MESSAGE_MAP(CNullPortHole, CClickResponder); + +CNullPortHole::CNullPortHole() : CClickResponder() { + _message = "For a better view, why not visit the Promenade Deck?"; + _soundName = "b#48.wav"; +} + +void CNullPortHole::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_soundName, indent); + file->writeQuotedLine(_message, indent); + + CClickResponder::save(file, indent); +} + +void CNullPortHole::load(SimpleFile *file) { + file->readNumber(); + _soundName = file->readString(); + _message = file->readString(); + + CClickResponder::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/null_port_hole.h b/engines/titanic/game/null_port_hole.h new file mode 100644 index 0000000000..26564271b9 --- /dev/null +++ b/engines/titanic/game/null_port_hole.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_NULL_PORT_HOLE_H +#define TITANIC_NULL_PORT_HOLE_H + +#include "titanic/core/click_responder.h" + +namespace Titanic { + +class CNullPortHole : public CClickResponder { + DECLARE_MESSAGE_MAP; +public: + CLASSDEF; + CNullPortHole(); + + /** + * 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_NULL_PORT_HOLE_H */ diff --git a/engines/titanic/game/nut_replacer.cpp b/engines/titanic/game/nut_replacer.cpp new file mode 100644 index 0000000000..6b05d1d0e9 --- /dev/null +++ b/engines/titanic/game/nut_replacer.cpp @@ -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. + * + */ + +#include "titanic/game/nut_replacer.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CNutReplacer, CGameObject) + ON_MESSAGE(ReplaceBowlAndNutsMsg) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + +void CNutReplacer::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CNutReplacer::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +bool CNutReplacer::ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg) { + setVisible(true); + playMovie(MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + return true; +} + +bool CNutReplacer::MovieEndMsg(CMovieEndMsg *msg) { + setVisible(false); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/nut_replacer.h b/engines/titanic/game/nut_replacer.h new file mode 100644 index 0000000000..e2eed4e247 --- /dev/null +++ b/engines/titanic/game/nut_replacer.h @@ -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. + * + */ + +#ifndef TITANIC_NUT_REPLACER_H +#define TITANIC_NUT_REPLACER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CNutReplacer : public CGameObject { + DECLARE_MESSAGE_MAP; + bool ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg); + bool MovieEndMsg(CMovieEndMsg *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_NUT_REPLACER_H */ diff --git a/engines/titanic/game/parrot/parrot_lobby_controller.cpp b/engines/titanic/game/parrot/parrot_lobby_controller.cpp new file mode 100644 index 0000000000..907e7519b8 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_controller.cpp @@ -0,0 +1,72 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/parrot/parrot_lobby_controller.h" +#include "titanic/core/room_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CParrotLobbyController, CParrotLobbyObject) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + +void CParrotLobbyController::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CParrotLobbyObject::save(file, indent); +} + +void CParrotLobbyController::load(SimpleFile *file) { + file->readNumber(); + CParrotLobbyObject::load(file); +} + +bool CParrotLobbyController::ActMsg(CActMsg *msg) { + if (msg->_action == "Refresh") + return false; + else if (msg->_action == "GainParrot") + _haveParrot = true; + else if (msg->_action == "LoseParrot") + _haveParrot = false; + else if (msg->_action == "GainPerch") + _havePerch = true; + else if (msg->_action == "LosePerch") + _havePerch = false; + else if (msg->_action == "GainStick") + _haveStick = true; + else if (msg->_action == "LoseStick") + _haveStick = false; + + _flags = 0; + if (_haveParrot) + _flags = 4; + if (_havePerch) + _flags |= 2; + if (_haveStick) + _flags |= 1; + + CActMsg actMsg("Refresh"); + actMsg.execute(findRoom(), CParrotLobbyObject::_type, MSGFLAG_CLASS_DEF | MSGFLAG_SCAN); + actMsg.execute("ParrotLobbyUpdater_TOW"); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_lobby_controller.h b/engines/titanic/game/parrot/parrot_lobby_controller.h new file mode 100644 index 0000000000..896a4e19d2 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_controller.h @@ -0,0 +1,49 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_PARROT_LOBBY_CONTROLLER_H +#define TITANIC_PARROT_LOBBY_CONTROLLER_H + +#include "titanic/game/parrot/parrot_lobby_object.h" + +namespace Titanic { + +class CParrotLobbyController : public CParrotLobbyObject { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); +public: + CLASSDEF; + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_LOBBY_CONTROLLER_H */ diff --git a/engines/titanic/game/parrot/parrot_lobby_link_updater.cpp b/engines/titanic/game/parrot/parrot_lobby_link_updater.cpp new file mode 100644 index 0000000000..47311c31f5 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_link_updater.cpp @@ -0,0 +1,115 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/parrot/parrot_lobby_link_updater.h" +#include "titanic/titanic.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CParrotLobbyLinkUpdater, CParrotLobbyObject) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + +/*------------------------------------------------------------------------*/ + +LinkUpdatorEntry::LinkUpdatorEntry() { + Common::fill(&_vals[0], &_vals[8], 0); +} + +void LinkUpdatorEntry::load(Common::SeekableReadStream *s) { + _linkStr = readStringFromStream(s); + for (int idx = 0; idx < 8; ++idx) + _vals[idx] = s->readByte(); +} + +/*------------------------------------------------------------------------*/ + +void LinkUpdatorEntries::load(Common::SeekableReadStream *s, int count) { + resize(count); + for (int idx = 0; idx < count; ++idx) + (*this)[idx].load(s); +} + +/*------------------------------------------------------------------------*/ + +CParrotLobbyLinkUpdater::CParrotLobbyLinkUpdater() : CParrotLobbyObject(), _fieldBC(1) { + Common::SeekableReadStream *s = g_vm->_filesManager->getResource("DATA/PARROT_LOBBY_LINK_UPDATOR"); + _entries[0].load(s, 7); + _entries[1].load(s, 5); + _entries[2].load(s, 6); + _entries[3].load(s, 9); + _entries[4].load(s, 1); + delete s; +} + +void CParrotLobbyLinkUpdater::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CParrotLobbyObject::save(file, indent); +} + +void CParrotLobbyLinkUpdater::load(SimpleFile *file) { + file->readNumber(); + CParrotLobbyObject::load(file); +} + +bool CParrotLobbyLinkUpdater::ActMsg(CActMsg *msg) { + if (msg->_action != "Refresh") + return false; + + CNodeItem *node = findNode(); + LinkUpdatorEntries *entriesP; + if (isEquals("ParrotLobbyUpdater_TOW")) { + entriesP = &_entries[4]; + } else { + if (node->_nodeNumber > 3) + return true; + entriesP = &_entries[node->_nodeNumber]; + } + int count = entriesP->size(); + + for (CTreeItem *item = node->getFirstChild(); item; item = item->scan(node)) { + CLinkItem *link = dynamic_cast<CLinkItem *>(item); + if (!link || count == 0) + continue; + + CString linkName = link->getName(); + char c = linkName.lastChar(); + if (c >= 'a' && c <= 'd') + linkName.deleteLastChar(); + + for (uint idx = 0; idx < entriesP->size(); ++idx) { + const LinkUpdatorEntry &entry = (*entriesP)[idx]; + if (entry._linkStr == linkName) { + int val = entry._vals[CParrotLobbyObject::_flags]; + if (val) + linkName += (char)(0x60 + val); + + link->_name = linkName; + break; + } + } + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_lobby_link_updater.h b/engines/titanic/game/parrot/parrot_lobby_link_updater.h new file mode 100644 index 0000000000..93db931a53 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_link_updater.h @@ -0,0 +1,68 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_PARROT_LOBBY_LINK_UPDATER_H +#define TITANIC_PARROT_LOBBY_LINK_UPDATER_H + +#include "common/stream.h" +#include "titanic/game/parrot/parrot_lobby_object.h" + +namespace Titanic { + +struct LinkUpdatorEntry { + CString _linkStr; + int _vals[8]; + + LinkUpdatorEntry(); + void load(Common::SeekableReadStream *s); +}; + +class LinkUpdatorEntries : public Common::Array<LinkUpdatorEntry> { +public: + void load(Common::SeekableReadStream *s, int count); +}; + +class CParrotLobbyLinkUpdater : public CParrotLobbyObject { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); +private: + LinkUpdatorEntries _entries[5]; +public: + int _fieldBC; +public: + CLASSDEF; + CParrotLobbyLinkUpdater(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_LOBBY_LINK_UPDATER_H */ diff --git a/engines/titanic/game/parrot/parrot_lobby_object.cpp b/engines/titanic/game/parrot/parrot_lobby_object.cpp new file mode 100644 index 0000000000..06222fd063 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_object.cpp @@ -0,0 +1,61 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/parrot/parrot_lobby_object.h" + +namespace Titanic { + +EMPTY_MESSAGE_MAP(CParrotLobbyObject, CGameObject); + +bool CParrotLobbyObject::_haveParrot; +bool CParrotLobbyObject::_havePerch; +bool CParrotLobbyObject::_haveStick; +int CParrotLobbyObject::_flags; + +void CParrotLobbyObject::init() { + _haveParrot = true; + _havePerch = true; + _haveStick = true; + _flags = 7; +} + +void CParrotLobbyObject::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_haveParrot, indent); + file->writeNumberLine(_havePerch, indent); + file->writeNumberLine(_haveStick, indent); + file->writeNumberLine(_flags, indent); + + CGameObject::save(file, indent); +} + +void CParrotLobbyObject::load(SimpleFile *file) { + file->readNumber(); + _haveParrot = file->readNumber(); + _havePerch = file->readNumber(); + _haveStick = file->readNumber(); + _flags = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_lobby_object.h b/engines/titanic/game/parrot/parrot_lobby_object.h new file mode 100644 index 0000000000..a210331399 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_object.h @@ -0,0 +1,55 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_PARROT_LOBBY_OBJECT_H +#define TITANIC_PARROT_LOBBY_OBJECT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CParrotLobbyObject : public CGameObject { + DECLARE_MESSAGE_MAP; +public: + static bool _haveParrot; + static bool _havePerch; + static bool _haveStick; + static int _flags; + + static void init(); +public: + CLASSDEF; + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_LOBBY_OBJECT_H */ diff --git a/engines/titanic/game/parrot/parrot_lobby_view_object.cpp b/engines/titanic/game/parrot/parrot_lobby_view_object.cpp new file mode 100644 index 0000000000..1151325676 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_view_object.cpp @@ -0,0 +1,51 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/parrot/parrot_lobby_view_object.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CParrotLobbyViewObject, CParrotLobbyObject) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + +void CParrotLobbyViewObject::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_flag, indent); + CParrotLobbyObject::save(file, indent); +} + +void CParrotLobbyViewObject::load(SimpleFile *file) { + file->readNumber(); + _flag = file->readNumber(); + CParrotLobbyObject::load(file); +} + +bool CParrotLobbyViewObject::ActMsg(CActMsg *msg) { + if (msg->_action != "Refresh") + return false; + + setVisible(_flag ? _haveParrot : _haveStick); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_lobby_view_object.h b/engines/titanic/game/parrot/parrot_lobby_view_object.h new file mode 100644 index 0000000000..484d70908e --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_view_object.h @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_PARROT_LOBBY_VIEW_OBJECT_H +#define TITANIC_PARROT_LOBBY_VIEW_OBJECT_H + +#include "titanic/game/parrot/parrot_lobby_object.h" + +namespace Titanic { + +class CParrotLobbyViewObject : public CParrotLobbyObject { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); +public: + bool _flag; +public: + CLASSDEF; + CParrotLobbyViewObject() : CParrotLobbyObject(), _flag(true) {} + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_LOBBY_VIEW_OBJECT_H */ diff --git a/engines/titanic/game/parrot/parrot_loser.cpp b/engines/titanic/game/parrot/parrot_loser.cpp new file mode 100644 index 0000000000..dc854ee9bd --- /dev/null +++ b/engines/titanic/game/parrot/parrot_loser.cpp @@ -0,0 +1,47 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/parrot/parrot_loser.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CParrotLoser, CGameObject) + ON_MESSAGE(LeaveRoomMsg) +END_MESSAGE_MAP() + +void CParrotLoser::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CParrotLoser::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +bool CParrotLoser::LeaveRoomMsg(CLeaveRoomMsg *msg) { + CActMsg actMsg("FreeParrot"); + actMsg.execute("CarryParrot"); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_loser.h b/engines/titanic/game/parrot/parrot_loser.h new file mode 100644 index 0000000000..e03bfb0727 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_loser.h @@ -0,0 +1,49 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_PARROT_LOSER_H +#define TITANIC_PARROT_LOSER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CParrotLoser : public CGameObject { + DECLARE_MESSAGE_MAP; + bool LeaveRoomMsg(CLeaveRoomMsg *msg); +public: + CLASSDEF; + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_LOSER_H */ diff --git a/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp b/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp new file mode 100644 index 0000000000..9dfc866c0e --- /dev/null +++ b/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp @@ -0,0 +1,115 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/parrot/parrot_nut_bowl_actor.h" +#include "titanic/core/room_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CParrotNutBowlActor, CGameObject) + ON_MESSAGE(MouseButtonUpMsg) + ON_MESSAGE(BowlStateChangeMsg) + ON_MESSAGE(IsEarBowlPuzzleDone) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(ReplaceBowlAndNutsMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(NutPuzzleMsg) +END_MESSAGE_MAP() + +CParrotNutBowlActor::CParrotNutBowlActor() : CGameObject(), + _puzzleDone(0), _state(0) { +} + +void CParrotNutBowlActor::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_puzzleDone, indent); + file->writeNumberLine(_state, indent); + + CGameObject::save(file, indent); +} + +void CParrotNutBowlActor::load(SimpleFile *file) { + file->readNumber(); + _puzzleDone = file->readNumber(); + _state = file->readNumber(); + + CGameObject::load(file); +} + +bool CParrotNutBowlActor::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + if (!_state) { + CActMsg actMsg("Jiggle"); + actMsg.execute("BowlNutsRustler"); + } + + return true; +} + +bool CParrotNutBowlActor::BowlStateChangeMsg(CBowlStateChangeMsg *msg) { + _state = msg->_state; + if (msg->_state == 3) { + if (!_puzzleDone) { + CReplaceBowlAndNutsMsg replaceMsg; + replaceMsg.execute(findRoom(), nullptr, MSGFLAG_SCAN); + playSound("z#47.wav"); + } + + _puzzleDone = true; + } + + return true; +} + +bool CParrotNutBowlActor::CParrotNutBowlActor::IsEarBowlPuzzleDone(CIsEarBowlPuzzleDone *msg) { + msg->_value = _puzzleDone; + return true; +} + +bool CParrotNutBowlActor::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return true; +} + +bool CParrotNutBowlActor::ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg) { + if (!_puzzleDone) + _state = 0; + return true; +} + +bool CParrotNutBowlActor::LeaveViewMsg(CLeaveViewMsg *msg) { + if (!_puzzleDone && _state) { + CReplaceBowlAndNutsMsg replaceMsg; + replaceMsg.execute(findRoom(), nullptr, MSGFLAG_SCAN); + } + + return true; +} + +bool CParrotNutBowlActor::NutPuzzleMsg(CNutPuzzleMsg *msg) { + if (msg->_value == "NutsGone") + _state = 1; + else if (msg->_value == "BowlUnlocked") + _state = 2; + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_nut_bowl_actor.h b/engines/titanic/game/parrot/parrot_nut_bowl_actor.h new file mode 100644 index 0000000000..b228c0ea9e --- /dev/null +++ b/engines/titanic/game/parrot/parrot_nut_bowl_actor.h @@ -0,0 +1,59 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_PARROT_NUT_BOWL_ACTOR_H +#define TITANIC_PARROT_NUT_BOWL_ACTOR_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CParrotNutBowlActor : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); + bool BowlStateChangeMsg(CBowlStateChangeMsg *msg); + bool IsEarBowlPuzzleDone(CIsEarBowlPuzzleDone *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool NutPuzzleMsg(CNutPuzzleMsg *msg); +public: + bool _puzzleDone; + int _state; +public: + CLASSDEF; + CParrotNutBowlActor(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_NUT_BOWL_ACTOR_H */ diff --git a/engines/titanic/game/parrot/parrot_nut_eater.cpp b/engines/titanic/game/parrot/parrot_nut_eater.cpp new file mode 100644 index 0000000000..751da931ac --- /dev/null +++ b/engines/titanic/game/parrot/parrot_nut_eater.cpp @@ -0,0 +1,97 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/parrot/parrot_nut_eater.h" +#include "titanic/core/room_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CParrotNutEater, CGameObject) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(ReplaceBowlAndNutsMsg) + ON_MESSAGE(NutPuzzleMsg) + ON_MESSAGE(MovieFrameMsg) +END_MESSAGE_MAP() + +CParrotNutEater::CParrotNutEater() : CGameObject(), _fieldBC(0), + _fieldC0(69), _fieldC4(132), _fieldC8(0), _fieldCC(68) { +} + +void CParrotNutEater::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + + CGameObject::save(file, indent); +} + +void CParrotNutEater::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + + CGameObject::load(file); +} + +bool CParrotNutEater::MovieEndMsg(CMovieEndMsg *msg) { + setVisible(false); + CNutPuzzleMsg nutMsg("NutsGone"); + nutMsg.execute(getRoom(), nullptr, MSGFLAG_SCAN); + + playSound("z#47.wav"); + return true; +} + +bool CParrotNutEater::ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg) { + setVisible(false); + return true; +} + +bool CParrotNutEater::NutPuzzleMsg(CNutPuzzleMsg *msg) { + if (msg->_value == "Jiggle") { + playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + movieEvent(68); + movieEvent(132); + playSound("z#215.wav"); + + CTrueTalkTriggerActionMsg triggerMsg; + triggerMsg._param1 = triggerMsg._param2 = 0; + triggerMsg.execute("PerchedParrot"); + } + + return true; +} + +bool CParrotNutEater::MovieFrameMsg(CMovieFrameMsg *msg) { + switch (msg->_frameNumber) { + case 68: + playSound("z#214.wav"); + break; + case 132: + playSound("z#216.wav"); + break; + default: + break; + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_nut_eater.h b/engines/titanic/game/parrot/parrot_nut_eater.h new file mode 100644 index 0000000000..e09ad63947 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_nut_eater.h @@ -0,0 +1,59 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_PARROT_NUT_EATER_H +#define TITANIC_PARROT_NUT_EATER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CParrotNutEater : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MovieEndMsg(CMovieEndMsg *msg); + bool ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg); + bool NutPuzzleMsg(CNutPuzzleMsg *msg); + bool MovieFrameMsg(CMovieFrameMsg *msg); +public: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; + int _fieldCC; +public: + CLASSDEF; + CParrotNutEater(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CREDITS_H */ diff --git a/engines/titanic/game/parrot/parrot_perch_holder.cpp b/engines/titanic/game/parrot/parrot_perch_holder.cpp new file mode 100644 index 0000000000..d594446219 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_perch_holder.cpp @@ -0,0 +1,82 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/parrot/parrot_perch_holder.h" +#include "titanic/game/cage.h" +#include "titanic/core/project_item.h" +#include "titanic/npcs/parrot.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CParrotPerchHolder, CMultiDropTarget) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(DropObjectMsg) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + +void CParrotPerchHolder::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CMultiDropTarget::save(file, indent); +} + +void CParrotPerchHolder::load(SimpleFile *file) { + file->readNumber(); + CMultiDropTarget::load(file); +} + +bool CParrotPerchHolder::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (CParrot::_v1) { + if (CCage::_open) { + petDisplayMessage("You cannot take this because the cage is locked shut."); + } else if (!CParrot::_v4) { + CTrueTalkTriggerActionMsg triggerMsg(280252, 0, 0); + triggerMsg.execute(getRoot(), CParrot::_type, + MSGFLAG_CLASS_DEF | MSGFLAG_BREAK_IF_HANDLED | MSGFLAG_SCAN); + } + } + + return true; +} + +bool CParrotPerchHolder::StatusChangeMsg(CStatusChangeMsg *msg) { + _fieldF4 = msg->_newStatus; + return true; +} + +bool CParrotPerchHolder::DropObjectMsg(CDropObjectMsg *msg) { + if (CCage::_open) + return false; + else + return CMultiDropTarget::DropObjectMsg(msg); +} + +bool CParrotPerchHolder::ActMsg(CActMsg *msg) { + if (msg->_action == "FlashCore") { + playMovie(2, 2, 0); + playMovie(1, 1, 0); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_perch_holder.h b/engines/titanic/game/parrot/parrot_perch_holder.h new file mode 100644 index 0000000000..c1fe243476 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_perch_holder.h @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_PARROT_PERCH_HOLDER_H +#define TITANIC_PARROT_PERCH_HOLDER_H + +#include "titanic/core/multi_drop_target.h" + +namespace Titanic { + +class CParrotPerchHolder : public CMultiDropTarget { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool DropObjectMsg(CDropObjectMsg *msg); + bool ActMsg(CActMsg *msg); +public: + CLASSDEF; + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_PERCH_HOLDER_H */ diff --git a/engines/titanic/game/parrot/parrot_trigger.cpp b/engines/titanic/game/parrot/parrot_trigger.cpp new file mode 100644 index 0000000000..b7287ebb6a --- /dev/null +++ b/engines/titanic/game/parrot/parrot_trigger.cpp @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/parrot/parrot_trigger.h" +#include "titanic/npcs/parrot.h" +#include "titanic/core/project_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CParrotTrigger, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) +END_MESSAGE_MAP() + +void CParrotTrigger::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CParrotTrigger::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +bool CParrotTrigger::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + CTrueTalkTriggerActionMsg triggerMsg(_value, 0, 0); + triggerMsg.execute(getRoot(), CParrot::_type, + MSGFLAG_CLASS_DEF | MSGFLAG_BREAK_IF_HANDLED | MSGFLAG_SCAN); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_trigger.h b/engines/titanic/game/parrot/parrot_trigger.h new file mode 100644 index 0000000000..6fba77b56d --- /dev/null +++ b/engines/titanic/game/parrot/parrot_trigger.h @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_PARROT_TRIGGER_H +#define TITANIC_PARROT_TRIGGER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CParrotTrigger : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); +public: + int _value; +public: + CLASSDEF; + CParrotTrigger() : CGameObject(), _value(0x446AB) {} + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_TRIGGER_H */ diff --git a/engines/titanic/game/parrot/player_meets_parrot.cpp b/engines/titanic/game/parrot/player_meets_parrot.cpp new file mode 100644 index 0000000000..cdb14516bf --- /dev/null +++ b/engines/titanic/game/parrot/player_meets_parrot.cpp @@ -0,0 +1,46 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/parrot/player_meets_parrot.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPlayerMeetsParrot, CGameObject) + ON_MESSAGE(EnterRoomMsg) +END_MESSAGE_MAP() + +void CPlayerMeetsParrot::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPlayerMeetsParrot::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +bool CPlayerMeetsParrot::EnterRoomMsg(CEnterRoomMsg *msg) { + stateSet24(); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/player_meets_parrot.h b/engines/titanic/game/parrot/player_meets_parrot.h new file mode 100644 index 0000000000..edae18801f --- /dev/null +++ b/engines/titanic/game/parrot/player_meets_parrot.h @@ -0,0 +1,51 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_PLAYER_MEETS_PARROT_H +#define TITANIC_PLAYER_MEETS_PARROT_H + +#include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CPlayerMeetsParrot : public CGameObject { + DECLARE_MESSAGE_MAP; +protected: + bool EnterRoomMsg(CEnterRoomMsg *msg); +public: + CLASSDEF; + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PLAYER_MEETS_PARROT_H */ diff --git a/engines/titanic/game/pet/pet.cpp b/engines/titanic/game/pet/pet.cpp new file mode 100644 index 0000000000..99c9e01eb3 --- /dev/null +++ b/engines/titanic/game/pet/pet.cpp @@ -0,0 +1,69 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/pet/pet.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPET, CGameObject) + ON_MESSAGE(ShowTextMsg) +END_MESSAGE_MAP() + +CPET::CPET() : CGameObject(), _fieldBC(0), _fieldC0(3), + _fieldC4(0), _fieldC8(0), _fieldD8(0), _fieldDC(0) { +} + +void CPET::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_fieldD8, indent); + file->writeNumberLine(_fieldDC, indent); + + CGameObject::save(file, indent); +} + +void CPET::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + _fieldC8 = file->readNumber(); + _string1 = file->readString(); + _fieldD8 = file->readNumber(); + _fieldDC = file->readNumber(); + + CGameObject::load(file); +} + +bool CPET::ShowTextMsg(CShowTextMsg *msg) { + CPetControl *pet = getPetControl(); + if (pet) + pet->petDisplayMessage(1, msg->_value); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet.h b/engines/titanic/game/pet/pet.h new file mode 100644 index 0000000000..de31a423d0 --- /dev/null +++ b/engines/titanic/game/pet/pet.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_PET_H +#define TITANIC_PET_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPET : public CGameObject { + DECLARE_MESSAGE_MAP; + bool ShowTextMsg(CShowTextMsg *msg); +public: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; + CString _string1; + int _fieldD8; + int _fieldDC; +public: + CLASSDEF; + CPET(); + + /** + * 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_PET_H */ diff --git a/engines/titanic/game/pet/pet_class1.cpp b/engines/titanic/game/pet/pet_class1.cpp new file mode 100644 index 0000000000..651a8f9ed3 --- /dev/null +++ b/engines/titanic/game/pet/pet_class1.cpp @@ -0,0 +1,39 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/pet/pet_class1.h" + +namespace Titanic { + +EMPTY_MESSAGE_MAP(CPETClass1, CGameObject); + +void CPETClass1::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPETClass1::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_class1.h b/engines/titanic/game/pet/pet_class1.h new file mode 100644 index 0000000000..fb7a48b927 --- /dev/null +++ b/engines/titanic/game/pet/pet_class1.h @@ -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. + * + */ + +#ifndef TITANIC_PET_CLASS1_H +#define TITANIC_PET_CLASS1_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPETClass1 : public CGameObject { + DECLARE_MESSAGE_MAP; +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_PET_CLASS1_H */ diff --git a/engines/titanic/game/pet/pet_class2.cpp b/engines/titanic/game/pet/pet_class2.cpp new file mode 100644 index 0000000000..e3e23f62ed --- /dev/null +++ b/engines/titanic/game/pet/pet_class2.cpp @@ -0,0 +1,39 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/pet/pet_class2.h" + +namespace Titanic { + +EMPTY_MESSAGE_MAP(CPETClass2, CGameObject); + +void CPETClass2::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPETClass2::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_class2.h b/engines/titanic/game/pet/pet_class2.h new file mode 100644 index 0000000000..c8855c82f3 --- /dev/null +++ b/engines/titanic/game/pet/pet_class2.h @@ -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. + * + */ + +#ifndef TITANIC_PET_CLASS2_H +#define TITANIC_PET_CLASS2_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPETClass2 : public CGameObject { + DECLARE_MESSAGE_MAP; +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_PET_CLASS2_H */ diff --git a/engines/titanic/game/pet/pet_class3.cpp b/engines/titanic/game/pet/pet_class3.cpp new file mode 100644 index 0000000000..7751b994ab --- /dev/null +++ b/engines/titanic/game/pet/pet_class3.cpp @@ -0,0 +1,39 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/pet/pet_class3.h" + +namespace Titanic { + +EMPTY_MESSAGE_MAP(CPETClass3, CGameObject); + +void CPETClass3::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPETClass3::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_class3.h b/engines/titanic/game/pet/pet_class3.h new file mode 100644 index 0000000000..59d8389665 --- /dev/null +++ b/engines/titanic/game/pet/pet_class3.h @@ -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. + * + */ + +#ifndef TITANIC_PET_CLASS3_H +#define TITANIC_PET_CLASS3_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPETClass3 : public CGameObject { + DECLARE_MESSAGE_MAP; +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_PET_CLASS3_H */ diff --git a/engines/titanic/game/pet/pet_lift.cpp b/engines/titanic/game/pet/pet_lift.cpp new file mode 100644 index 0000000000..afa9dd04cd --- /dev/null +++ b/engines/titanic/game/pet/pet_lift.cpp @@ -0,0 +1,74 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/pet/pet_lift.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPETLift, CPETTransport) + ON_MESSAGE(TransportMsg) +END_MESSAGE_MAP() + +void CPETLift::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CPETTransport::save(file, indent); +} + +void CPETLift::load(SimpleFile *file) { + file->readNumber(); + CPETTransport::load(file); +} + +bool CPETLift::TransportMsg(CTransportMsg *msg) { + CPetControl *pet = getPetControl(); + if (msg->_value1 != 1) + return false; + + int floorNum = -1; + if (msg->_roomName == "TopOfWell") { + floorNum = 1; + } else if (msg->_roomName == "BottomOfWell") { + floorNum = 39; + } else if (msg->_roomName == "PlayersRoom" && pet) { + int assignedFloor = pet->getAssignedFloorNum(); + if (assignedFloor < 1 || assignedFloor > 39) { + pet->petDisplayMessage("You have not assigned a room to go to."); + floorNum = -1; + } + } + + if (floorNum != -1) { + int elevatorNum = pet ? pet->getRoomsElevatorNum() : 0; + + if ((elevatorNum == 2 || elevatorNum == 4) && floorNum > 27) { + petDisplayMessage("Sorry, this elevator does not go below floor 27."); + } else { + CTrueTalkTriggerActionMsg triggerMsg(2, floorNum, 0); + triggerMsg.execute("Liftbot"); + } + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_lift.h b/engines/titanic/game/pet/pet_lift.h new file mode 100644 index 0000000000..ce3aace1a6 --- /dev/null +++ b/engines/titanic/game/pet/pet_lift.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_PET_LIFT_H +#define TITANIC_PET_LIFT_H + +#include "titanic/game/pet/pet_transport.h" + +namespace Titanic { + +class CPETLift : public CPETTransport { + DECLARE_MESSAGE_MAP; + bool TransportMsg(CTransportMsg *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_PET_LIFT_H */ diff --git a/engines/titanic/game/pet/pet_monitor.cpp b/engines/titanic/game/pet/pet_monitor.cpp new file mode 100644 index 0000000000..2716a81fa8 --- /dev/null +++ b/engines/titanic/game/pet/pet_monitor.cpp @@ -0,0 +1,64 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/pet/pet_monitor.h" +#include "titanic/core/room_item.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPETMonitor, CGameObject) + ON_MESSAGE(EnterRoomMsg) +END_MESSAGE_MAP() + +void CPETMonitor::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPETMonitor::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +bool CPETMonitor::EnterRoomMsg(CEnterRoomMsg *msg) { + bool flag = true; + if (msg->_newRoom && msg->_oldRoom) { + CString oldRoomName = msg->_oldRoom->getName(); + CString newRoomName = msg->_newRoom->getName(); + + if (newRoomName == "SgtLobby" && oldRoomName == "SGTState") + flag = false; + } + + if (flag) { + CPetControl *pet = getPetControl(); + if (pet) { + pet->setRoomsRoomNum(0); + pet->resetRoomsHighlight(); + } + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_monitor.h b/engines/titanic/game/pet/pet_monitor.h new file mode 100644 index 0000000000..61d1ba8ab6 --- /dev/null +++ b/engines/titanic/game/pet/pet_monitor.h @@ -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. + * + */ + +#ifndef TITANIC_PET_MONITOR_H +#define TITANIC_PET_MONITOR_H + +#include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CPETMonitor : public CGameObject { + DECLARE_MESSAGE_MAP; + bool EnterRoomMsg(CEnterRoomMsg *msg); +public: + CLASSDEF; + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_MONITOR_H */ diff --git a/engines/titanic/game/pet/pet_pellerator.cpp b/engines/titanic/game/pet/pet_pellerator.cpp new file mode 100644 index 0000000000..59516ebcde --- /dev/null +++ b/engines/titanic/game/pet/pet_pellerator.cpp @@ -0,0 +1,61 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/pet/pet_pellerator.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPETPellerator, CPETTransport) + ON_MESSAGE(PETActivateMsg) +END_MESSAGE_MAP() + +void CPETPellerator::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CPETTransport::save(file, indent); +} + +void CPETPellerator::load(SimpleFile *file) { + file->readNumber(); + CPETTransport::load(file); +} + +bool CPETPellerator::PETActivateMsg(CPETActivateMsg *msg) { + CStatusChangeMsg statusMsg; + + if (msg->_name == "PromenadeDeck") + statusMsg._newStatus = 0; + else if (msg->_name == "MusicRoom") + statusMsg._newStatus = 1; + else if (msg->_name == "Bar") + statusMsg._newStatus = 2; + else if (msg->_name == "TopOfWell") + statusMsg._newStatus = 4; + else if (msg->_name == "1stClassRestaurant") + statusMsg._newStatus = 5; + else if (msg->_name == "Arboretum") + statusMsg._newStatus = 6; + + statusMsg.execute("PelleratorObject"); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_pellerator.h b/engines/titanic/game/pet/pet_pellerator.h new file mode 100644 index 0000000000..51af6f1bcd --- /dev/null +++ b/engines/titanic/game/pet/pet_pellerator.h @@ -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. + * + */ + +#ifndef TITANIC_PET_PELLERATOR_H +#define TITANIC_PET_PELLERATOR_H + +#include "titanic/game/pet/pet_transport.h" +#include "titanic/messages/pet_messages.h" + +namespace Titanic { + +class CPETPellerator : public CPETTransport { + DECLARE_MESSAGE_MAP; + bool PETActivateMsg(CPETActivateMsg *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_PET_PELLERATOR_H */ diff --git a/engines/titanic/game/pet/pet_position.cpp b/engines/titanic/game/pet/pet_position.cpp new file mode 100644 index 0000000000..d3d030eb16 --- /dev/null +++ b/engines/titanic/game/pet/pet_position.cpp @@ -0,0 +1,264 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/pet/pet_position.h" +#include "titanic/core/view_item.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPETPosition, CGameObject) + ON_MESSAGE(EnterRoomMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(LeaveViewMsg) +END_MESSAGE_MAP() + +void CPETPosition::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPETPosition::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +bool CPETPosition::EnterRoomMsg(CEnterRoomMsg *msg) { + if (msg->_newRoom->getName() == "EmbLobby") { + CPetControl *pet = getPetControl(); + if (pet) + pet->setRoomsFloorNum(1); + } + + return true; +} + +bool CPETPosition::EnterViewMsg(CEnterViewMsg *msg) { + CPetControl *pet = getPetControl(); + CString viewStr = msg->_newView->getNodeViewName(); + CString tempStr; + + if (compareRoomNameTo("TopOfWell")) { + tempStr = msg->_newView->getNodeViewName(); + int wellEntry = 0; + + if (tempStr == "Node 25.N") + wellEntry = 1; + else if (tempStr == "Node 24.SE") + wellEntry = 2; + else if (tempStr == "Node 26.N") + wellEntry = 3; + else if (tempStr == "Node 27.N") + wellEntry = 4; + + if (wellEntry != 0) + petSetRoomsWellEntry(wellEntry); + } else if (compareRoomNameTo("1stClassLobby")) { + int roomNum = 0; + + if (viewStr == "Node 2.N") + roomNum = 1; + else if (viewStr == "Node 3.N") + roomNum = 2; + else if (viewStr == "Node 4.N") + roomNum = 3; + else if (viewStr == "Node 5.N") + roomNum = 1; + else if (viewStr == "Node 6.N") + roomNum = 2; + else if (viewStr == "Node 7.N") + roomNum = 3; + + if (pet) { + pet->setRoomsRoomNum(roomNum); + pet->resetRoomsHighlight(); + + int elevatorNum = pet->getRoomsElevatorNum(); + int wellEntry = 0; + + if (viewStr == "Node 10.S") + wellEntry = (elevatorNum == 1 || elevatorNum == 2) ? 1 : 3; + else if (viewStr == "Node 9.S") + wellEntry = (elevatorNum == 1 || elevatorNum == 2) ? 2 : 4; + + if (wellEntry) + petSetRoomsWellEntry(wellEntry); + } + } else if (compareRoomNameTo("2ndClassLobby")) { + int roomNum = 0; + + if (viewStr == "Node 3.N") + roomNum = 1; + else if (viewStr == "Node 4.N") + roomNum = 2; + else if (viewStr == "Node 5.N") + roomNum = 3; + else if (viewStr == "Node 6.N") + roomNum = 4; + + if (pet) { + pet->setRoomsRoomNum(roomNum); + pet->resetRoomsHighlight(); + + int elevatorNum = pet->getRoomsElevatorNum(); + int wellEntry = 0; + + if (viewStr == "Node 8.S") + wellEntry = (elevatorNum == 1 || elevatorNum == 2) ? 1 : 3; + else if (viewStr == "Node 1.S") + wellEntry = (elevatorNum == 1 || elevatorNum == 2) ? 2 : 4; + + if (wellEntry) + petSetRoomsWellEntry(wellEntry); + } + } else if (compareRoomNameTo("SecClassLittleLift")) { + if (pet && viewStr == "Node 1.N") + pet->resetRoomsHighlight(); + } else if (compareRoomNameTo("SGTLittleLift")) { + if (pet && viewStr == "Node 1.N") + pet->resetRoomsHighlight(); + } else if (compareRoomNameTo("SgtLobby")) { + int roomNum = 0; + + if (viewStr == "Node 4.N") + roomNum = 1; + else if (viewStr == "Node 5.N") + roomNum = 2; + else if (viewStr == "Node 6.N") + roomNum = 3; + else if (viewStr == "Node 7.N") + roomNum = 4; + else if (viewStr == "Node 8.N") + roomNum = 5; + else if (viewStr == "Node 9.N") + roomNum = 6; + + if (pet) { + pet->setRooms1CC(1); + pet->setRoomsRoomNum(roomNum); + + if (viewStr == "Node 1.S") + pet->setRoomsWellEntry(pet->getRoomsElevatorNum()); + } + } else if (compareRoomNameTo("BottomOfWell")) { + if (viewStr == "Node 10.E") + petSetRoomsWellEntry(3); + else if (viewStr == "Node 11.W") + petSetRoomsWellEntry(1); + } + + return true; +} + +bool CPETPosition::LeaveViewMsg(CLeaveViewMsg *msg) { + CPetControl *pet = getPetControl(); + CString oldView = msg->_oldView->getName(); + CString newView = msg->_newView->getName(); + + if (pet && newView == "Lift.Node 1.N") { + int elevatorNum = pet->getRoomsElevatorNum(); + + if (oldView == "TopOfWell.Node 25.N") { + pet->setRoomsFloorNum(1); + pet->setRoomsElevatorNum(1); + return true; + } else if (oldView == "TopOfWell.Node 24.SE") { + pet->setRoomsFloorNum(1); + pet->setRoomsElevatorNum(2); + return true; + } else if (oldView == "TopOfWell.Node 26.N") { + pet->setRoomsFloorNum(1); + pet->setRoomsElevatorNum(3); + return true; + } else if (oldView == "TopOfWell.Node 27.N") { + pet->setRoomsFloorNum(1); + pet->setRoomsElevatorNum(4); + return true; + } else if (oldView == "1stClassLobby.Node 10.S") { + switch (elevatorNum) { + case 1: + pet->setRoomsFloorNum(1); + pet->setRoomsElevatorNum(1); + break; + case 2: + pet->setRoomsElevatorNum(1); + break; + default: + pet->setRoomsElevatorNum(3); + break; + } + return true; + } else if (oldView == "1stClassLobby.Node 9.S") { + switch (elevatorNum) { + case 1: + case 2: + pet->setRoomsElevatorNum(2); + break; + default: + pet->setRoomsElevatorNum(4); + break; + } + return true; + } else if (oldView == "2ndClassLobby.Node 8.S") { + switch (elevatorNum) { + case 1: + case 2: + pet->setRoomsElevatorNum(1); + break; + default: + pet->setRoomsElevatorNum(3); + break; + } + return true; + } else if (oldView == "2ndClassLobby.Node 1.S") { + switch (elevatorNum) { + case 1: + case 2: + pet->setRoomsElevatorNum(2); + break; + default: + pet->setRoomsElevatorNum(4); + break; + } + return true; + } else if (oldView == "SgtLobby.Node 1.S") { + return true; + } else if (oldView == "BottomOfWell.Node 10.E" || oldView == "BottomOfWell.Node 11.W") { + pet->setRoomsElevatorNum(1); + return true; + } + } + + CRoomItem *newRoom = msg->_newView->findRoom(); + if (newRoom) { + CString roomName = newRoom->getName(); + if (roomName == "1stClassLobby" || roomName == "2ndClassLobby" || roomName == "SgtLobby") { + if (pet) + pet->resetRoomsHighlight(); + } + } + + return true; +} + + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_position.h b/engines/titanic/game/pet/pet_position.h new file mode 100644 index 0000000000..0cf835f23f --- /dev/null +++ b/engines/titanic/game/pet/pet_position.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_PET_POSITION_H +#define TITANIC_PET_POSITION_H + +#include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CPETPosition : public CGameObject { + DECLARE_MESSAGE_MAP; + bool EnterRoomMsg(CEnterRoomMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *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_PET_POSITION_H */ diff --git a/engines/titanic/game/pet/pet_sentinal.cpp b/engines/titanic/game/pet/pet_sentinal.cpp new file mode 100644 index 0000000000..ac4cbc8418 --- /dev/null +++ b/engines/titanic/game/pet/pet_sentinal.cpp @@ -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. + * + */ + +#include "titanic/game/pet/pet_sentinal.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPETSentinal, CGameObject) + ON_MESSAGE(EnterViewMsg) +END_MESSAGE_MAP() + +CPETSentinal::CPETSentinal() : CGameObject(), _elevatorNum(0), + _wellEntry(0), _resetHighlight(0) { +} + +void CPETSentinal::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_elevatorNum, indent); + file->writeNumberLine(_wellEntry, indent); + file->writeNumberLine(_resetHighlight, indent); + CGameObject::save(file, indent); +} + +void CPETSentinal::load(SimpleFile *file) { + file->readNumber(); + _elevatorNum = file->readNumber(); + _wellEntry = file->readNumber(); + _resetHighlight = file->readNumber(); + CGameObject::load(file); +} + +bool CPETSentinal::EnterViewMsg(CEnterViewMsg *msg) { + CPetControl *pet = getPetControl(); + if (pet) { + if (_elevatorNum != -1) + pet->setRoomsElevatorNum(_elevatorNum); + if (_wellEntry) + pet->setRoomsWellEntry(_wellEntry); + if (_resetHighlight) + pet->resetRoomsHighlight(); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_sentinal.h b/engines/titanic/game/pet/pet_sentinal.h new file mode 100644 index 0000000000..150fe4a87e --- /dev/null +++ b/engines/titanic/game/pet/pet_sentinal.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_PET_SENTINAL_H +#define TITANIC_PET_SENTINAL_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPETSentinal : public CGameObject { + DECLARE_MESSAGE_MAP; + bool EnterViewMsg(CEnterViewMsg *msg); +private: + int _elevatorNum; + int _wellEntry; + bool _resetHighlight; +public: + CLASSDEF; + CPETSentinal(); + + /** + * 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_PET_SENTINAL_H */ diff --git a/engines/titanic/game/pet/pet_sounds.cpp b/engines/titanic/game/pet/pet_sounds.cpp new file mode 100644 index 0000000000..c7f3cd3bf8 --- /dev/null +++ b/engines/titanic/game/pet/pet_sounds.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/game/pet/pet_sounds.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPETSounds, CGameObject) + ON_MESSAGE(PETPlaySoundMsg) + ON_MESSAGE(LoadSuccessMsg) +END_MESSAGE_MAP() + +void CPETSounds::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_ticks, indent); + CGameObject::save(file, indent); +} + +void CPETSounds::load(SimpleFile *file) { + file->readNumber(); + _ticks = file->readNumber(); + CGameObject::load(file); +} + +bool CPETSounds::PETPlaySoundMsg(CPETPlaySoundMsg *msg) { + if (msg->_soundNum == 1) { + playSound("z#65.wav"); + } else if (msg->_soundNum == 2 && stateGet24()) { + uint ticks = getTicksCount(); + if (!_ticks || ticks > (_ticks + 12000)) { + playSound("z#36.wav"); + _ticks = ticks; + } + } + + return true; +} + +bool CPETSounds::LoadSuccessMsg(CLoadSuccessMsg *msg) { + _ticks = 0; + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_sounds.h b/engines/titanic/game/pet/pet_sounds.h new file mode 100644 index 0000000000..2262fde916 --- /dev/null +++ b/engines/titanic/game/pet/pet_sounds.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_PET_SOUNDS_H +#define TITANIC_PET_SOUNDS_H + +#include "titanic/core/game_object.h" +#include "titanic/messages/pet_messages.h" + +namespace Titanic { + +class CPETSounds : public CGameObject { + DECLARE_MESSAGE_MAP; + bool PETPlaySoundMsg(CPETPlaySoundMsg *msg); + bool LoadSuccessMsg(CLoadSuccessMsg *msg); +public: + uint _ticks; +public: + CLASSDEF; + CPETSounds() : CGameObject(), _ticks(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_PET_SOUNDS_H */ diff --git a/engines/titanic/game/pet/pet_transition.cpp b/engines/titanic/game/pet/pet_transition.cpp new file mode 100644 index 0000000000..ec10569236 --- /dev/null +++ b/engines/titanic/game/pet/pet_transition.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/game/pet/pet_transition.h" +#include "titanic/pet_control/pet_control.h" +#include "titanic/core/view_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPETTransition, CGameObject) + ON_MESSAGE(EnterViewMsg) +END_MESSAGE_MAP() + +void CPETTransition::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPETTransition::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +bool CPETTransition::EnterViewMsg(CEnterViewMsg *msg) { + CPetControl *pet = getPetControl(); + + if (compareRoomNameTo("1stClassLobby") && pet) { + int elevatorNum = pet->getRoomsElevatorNum(); + CString nodeView = msg->_newView->getNodeViewName(); + + if (nodeView == "Node 1.E") { + pet->setRoomsElevatorNum((elevatorNum == 1 || elevatorNum == 2) ? 1 : 3); + } else if (nodeView == "Node 1.W") { + pet->setRoomsElevatorNum((elevatorNum == 1 || elevatorNum == 2) ? 2 : 4); + } + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_transition.h b/engines/titanic/game/pet/pet_transition.h new file mode 100644 index 0000000000..d0fa20ccc5 --- /dev/null +++ b/engines/titanic/game/pet/pet_transition.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_PET_TRANSITION_H +#define TITANIC_PET_TRANSITION_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPETTransition : public CGameObject { + DECLARE_MESSAGE_MAP; + bool EnterViewMsg(CEnterViewMsg *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_PET_TRANSITION_H */ diff --git a/engines/titanic/game/pet/pet_transport.cpp b/engines/titanic/game/pet/pet_transport.cpp new file mode 100644 index 0000000000..a48e70ed01 --- /dev/null +++ b/engines/titanic/game/pet/pet_transport.cpp @@ -0,0 +1,46 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/pet/pet_transport.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPETTransport, CGameObject) + ON_MESSAGE(EnterRoomMsg) +END_MESSAGE_MAP() + +void CPETTransport::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPETTransport::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +bool CPETTransport::EnterRoomMsg(CEnterRoomMsg *msg) { + petClear(); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_transport.h b/engines/titanic/game/pet/pet_transport.h new file mode 100644 index 0000000000..58aefe6743 --- /dev/null +++ b/engines/titanic/game/pet/pet_transport.h @@ -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. + * + */ + +#ifndef TITANIC_PET_TRANSPORT_H +#define TITANIC_PET_TRANSPORT_H + +#include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CPETTransport : public CGameObject { + DECLARE_MESSAGE_MAP; + virtual bool EnterRoomMsg(CEnterRoomMsg *msg); +public: + CLASSDEF; + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_TRANSPORT_H */ diff --git a/engines/titanic/game/pet/pet_val_base.cpp b/engines/titanic/game/pet/pet_val_base.cpp new file mode 100644 index 0000000000..d77f366436 --- /dev/null +++ b/engines/titanic/game/pet/pet_val_base.cpp @@ -0,0 +1,31 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/pet/pet_val_base.h" + +namespace Titanic { + +CPetValBase::CPetValBase() : _field4(0), _field8(0), + _fieldC(0), _field10(0), _field14(0) { +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_val_base.h b/engines/titanic/game/pet/pet_val_base.h new file mode 100644 index 0000000000..cdb2808108 --- /dev/null +++ b/engines/titanic/game/pet/pet_val_base.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_pet_element_H +#define TITANIC_pet_element_H + +namespace Titanic { + +class CPetElement { +protected: + int _field4; + int _field8; + int _fieldC; + int _field10; + int _field14; +public: + CPetElement(); + + virtual void proc1() {} + virtual void proc2() {} + virtual void proc3() {} + virtual void proc4() {} + + virtual void proc5() {} + + virtual void proc6() {} + virtual void proc7() {} + virtual void proc8() {} + virtual void proc9() {} + virtual void proc10() {} + virtual void proc11() {} + virtual void proc12() {} + virtual void proc13() {} + virtual void proc14() {} + virtual void proc15() {} + virtual void proc16() {} + virtual void proc17() {} +}; + +} // End of namespace Titanic + +#endif /* TITANIC_pet_element_H */ diff --git a/engines/titanic/game/pet_disabler.cpp b/engines/titanic/game/pet_disabler.cpp new file mode 100644 index 0000000000..c4946fe39f --- /dev/null +++ b/engines/titanic/game/pet_disabler.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/game/pet_disabler.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPetDisabler, CGameObject) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(LeaveViewMsg) +END_MESSAGE_MAP() + +void CPetDisabler::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_value, indent); + CGameObject::save(file, indent); +} + +void CPetDisabler::load(SimpleFile *file) { + file->readNumber(); + _value = file->readString(); + CGameObject::load(file); +} + +bool CPetDisabler::EnterViewMsg(CEnterViewMsg *msg) { + petLockInput(); + return true; +} + +bool CPetDisabler::LeaveViewMsg(CLeaveViewMsg *msg) { + petUnlockInput(); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet_disabler.h b/engines/titanic/game/pet_disabler.h new file mode 100644 index 0000000000..06e99be49e --- /dev/null +++ b/engines/titanic/game/pet_disabler.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_PET_DISABLER_H +#define TITANIC_PET_DISABLER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPetDisabler : public CGameObject { + DECLARE_MESSAGE_MAP; + bool EnterViewMsg(CEnterViewMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); +public: + CString _value; +public: + CLASSDEF; + CPetDisabler() : CGameObject() {} + + /** + * 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_PET_DISABLER_H */ diff --git a/engines/titanic/game/phonograph.cpp b/engines/titanic/game/phonograph.cpp new file mode 100644 index 0000000000..408cfa3413 --- /dev/null +++ b/engines/titanic/game/phonograph.cpp @@ -0,0 +1,177 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/phonograph.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPhonograph, CMusicPlayer) + ON_MESSAGE(PhonographPlayMsg) + ON_MESSAGE(PhonographStopMsg) + ON_MESSAGE(PhonographRecordMsg) + ON_MESSAGE(EnterRoomMsg) + ON_MESSAGE(LeaveRoomMsg) + ON_MESSAGE(MusicHasStartedMsg) +END_MESSAGE_MAP() + +CPhonograph::CPhonograph() : CMusicPlayer(), + _fieldE0(false), _fieldE4(0), _fieldE8(0), _fieldEC(0), + _fieldF0(0), _fieldF4(0) { +} + +void CPhonograph::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_fieldF0, indent); + file->writeNumberLine(_fieldF4, indent); + + CMusicPlayer::save(file, indent); +} + +void CPhonograph::load(SimpleFile *file) { + file->readNumber(); + _string2 = file->readString(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + _fieldF0 = file->readNumber(); + _fieldF4 = file->readNumber(); + + CMusicPlayer::load(file); +} + +bool CPhonograph::PhonographPlayMsg(CPhonographPlayMsg *msg) { + CQueryCylinderHolderMsg holderMsg; + holderMsg.execute(this); + if (!holderMsg._value2) { + _fieldE0 = false; + return true; + } + + CQueryCylinderMsg cylinderMsg; + cylinderMsg.execute(holderMsg._target); + + if (cylinderMsg._name.empty()) { + _fieldE0 = false; + } else if (cylinderMsg._name.hasPrefix("STMusic")) { + CStartMusicMsg startMsg(this); + startMsg.execute(this); + _fieldE0 = true; + msg->_value = 1; + } else { + stopGlobalSound(0, -1); + playGlobalSound(cylinderMsg._name, -2, true, true, 0); + _fieldE0 = true; + msg->_value = 1; + } + + return true; +} + +bool CPhonograph::PhonographStopMsg(CPhonographStopMsg *msg) { + CQueryCylinderHolderMsg holderMsg; + holderMsg.execute(this); + if (!holderMsg._value2) + return true; + + _fieldE0 = false; + CQueryCylinderMsg cylinderMsg; + cylinderMsg.execute(holderMsg._target); + + if (_fieldE0) { + if (!cylinderMsg._name.empty()) { + if (cylinderMsg._name.hasPrefix("STMusic")) { + CStopMusicMsg stopMsg; + stopMsg.execute(this); + } else { + stopGlobalSound(msg->_value1, -1); + } + msg->_value2 = 1; + } + + if (!msg->_value3) + _fieldE0 = false; + } else if (_fieldE4) { + _fieldE4 = false; + msg->_value2 = 1; + } + + return true; +} + +bool CPhonograph::PhonographRecordMsg(CPhonographRecordMsg *msg) { + if (!_fieldE0 && !_fieldE4 && !_fieldE8) { + CQueryCylinderHolderMsg holderMsg; + holderMsg.execute(this); + + if (holderMsg._value2) { + _fieldE4 = true; + CErasePhonographCylinderMsg eraseMsg; + eraseMsg.execute(holderMsg._target); + } else { + _fieldE4 = false; + } + } + + return true; +} + +bool CPhonograph::EnterRoomMsg(CEnterRoomMsg *msg) { + if (_fieldE0) { + CPhonographPlayMsg playMsg; + playMsg.execute(this); + } + + return true; +} + +bool CPhonograph::LeaveRoomMsg(CLeaveRoomMsg *msg) { + if (_fieldE0) { + CPhonographStopMsg stopMsg; + stopMsg._value1 = 1; + stopMsg.execute(this); + } + + return true; +} + +bool CPhonograph::MusicHasStartedMsg(CMusicHasStartedMsg *msg) { + if (_fieldE4) { + CQueryCylinderHolderMsg holderMsg; + holderMsg.execute(this); + if (holderMsg._value2) { + CRecordOntoCylinderMsg recordMsg; + recordMsg.execute(holderMsg._target); + } else { + _fieldE4 = false; + } + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/phonograph.h b/engines/titanic/game/phonograph.h new file mode 100644 index 0000000000..b13a5ea910 --- /dev/null +++ b/engines/titanic/game/phonograph.h @@ -0,0 +1,64 @@ +/* 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_H +#define TITANIC_PHONOGRAPH_H + +#include "titanic/sound/music_player.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CPhonograph : public CMusicPlayer { + DECLARE_MESSAGE_MAP; + bool PhonographPlayMsg(CPhonographPlayMsg *msg); + bool PhonographStopMsg(CPhonographStopMsg *msg); + bool PhonographRecordMsg(CPhonographRecordMsg *msg); + bool EnterRoomMsg(CEnterRoomMsg *msg); + bool LeaveRoomMsg(CLeaveRoomMsg *msg); + bool MusicHasStartedMsg(CMusicHasStartedMsg *msg); +protected: + CString _string2; + bool _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; + int _fieldF0; + int _fieldF4; +public: + CLASSDEF; + CPhonograph(); + + /** + * 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_MUSIC_CONSOLE_BUTTON_H */ diff --git a/engines/titanic/game/phonograph_lid.cpp b/engines/titanic/game/phonograph_lid.cpp new file mode 100644 index 0000000000..3741749fbf --- /dev/null +++ b/engines/titanic/game/phonograph_lid.cpp @@ -0,0 +1,86 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/phonograph_lid.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPhonographLid, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(LockPhonographMsg) + ON_MESSAGE(LeaveViewMsg) +END_MESSAGE_MAP() + +void CPhonographLid::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_open, indent); + CGameObject::save(file, indent); +} + +void CPhonographLid::load(SimpleFile *file) { + file->readNumber(); + _open = file->readNumber(); + CGameObject::load(file); +} + +bool CPhonographLid::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + CQueryPhonographState stateMsg; + stateMsg.execute(getParent(), nullptr, MSGFLAG_SCAN); + if (stateMsg._value) { + if (_open) { + CGameObject *lock = dynamic_cast<CGameObject *>(findByName("Music System Lock")); + if (lock) + lock->setVisible(false); + playMovie(0, 27, 0); + } else { + playMovie(27, 55, 0); + } + + _open = !_open; + } else { + petDisplayMessage(0, "This is the restaurant music system. It appears to be locked."); + } + + return true; +} + +bool CPhonographLid::MovieEndMsg(CMovieEndMsg *msg) { + // WORKAROUND: Redundant code in original not included + return true; +} + +bool CPhonographLid::LockPhonographMsg(CLockPhonographMsg *msg) { + _cursorId = msg->_value ? CURSOR_INVALID : CURSOR_ARROW; + return true; +} + +bool CPhonographLid::LeaveViewMsg(CLeaveViewMsg *msg) { + if (_open) { + playMovie(27, 55, MOVIE_GAMESTATE); + _open = false; + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/phonograph_lid.h b/engines/titanic/game/phonograph_lid.h new file mode 100644 index 0000000000..4e71d70ec2 --- /dev/null +++ b/engines/titanic/game/phonograph_lid.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_PHONOGRAPH_LID_H +#define TITANIC_PHONOGRAPH_LID_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPhonographLid : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool LockPhonographMsg(CLockPhonographMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); +private: + bool _open; +public: + CLASSDEF; + CPhonographLid() : CGameObject(), _open(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_PHONOGRAPH_LID_H */ diff --git a/engines/titanic/game/pickup/pick_up.cpp b/engines/titanic/game/pickup/pick_up.cpp new file mode 100644 index 0000000000..64d2d1d0d2 --- /dev/null +++ b/engines/titanic/game/pickup/pick_up.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/game/pickup/pick_up.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPickUp, CGameObject) + ON_MESSAGE(StatusChangeMsg) +END_MESSAGE_MAP() + +void CPickUp::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_enabled, indent); + CGameObject::save(file, indent); +} + +void CPickUp::load(SimpleFile *file) { + file->readNumber(); + _enabled = file->readNumber(); + CGameObject::load(file); +} + +bool CPickUp::StatusChangeMsg(CStatusChangeMsg *msg) { + _enabled = msg->_newStatus == 1; + setVisible(_enabled); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pickup/pick_up.h b/engines/titanic/game/pickup/pick_up.h new file mode 100644 index 0000000000..f5ee06fd32 --- /dev/null +++ b/engines/titanic/game/pickup/pick_up.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_PICK_UP_H +#define TITANIC_PICK_UP_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPickUp : public CGameObject { + DECLARE_MESSAGE_MAP; + bool StatusChangeMsg(CStatusChangeMsg *msg); +protected: + bool _enabled; +public: + CLASSDEF; + CPickUp() : CGameObject(), _enabled(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_ANNOY_BARBOT_H */ diff --git a/engines/titanic/game/pickup/pick_up_bar_glass.cpp b/engines/titanic/game/pickup/pick_up_bar_glass.cpp new file mode 100644 index 0000000000..9da17b139e --- /dev/null +++ b/engines/titanic/game/pickup/pick_up_bar_glass.cpp @@ -0,0 +1,88 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/pickup/pick_up_bar_glass.h" +#include "titanic/core/project_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPickUpBarGlass, CPickUp) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(MouseDragStartMsg) + ON_MESSAGE(MouseButtonDownMsg) +END_MESSAGE_MAP() + +void CPickUpBarGlass::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CPickUp::save(file, indent); +} + +void CPickUpBarGlass::load(SimpleFile *file) { + file->readNumber(); + CPickUp::load(file); +} + +bool CPickUpBarGlass::StatusChangeMsg(CStatusChangeMsg *msg) { + switch (msg->_newStatus) { + case 0: + setVisible(false); + _enabled = false; + break; + case 1: + setVisible(true); + _enabled = true; + break; + case 2: + setVisible(true); + _enabled = false; + break; + default: + break; + } + + return true; +} + +bool CPickUpBarGlass::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (checkStartDragging(msg) && _enabled) { + CTurnOn onMsg; + onMsg.execute("BeerGlass"); + CVisibleMsg visibleMsg; + visibleMsg.execute("BeerGlass"); + CPassOnDragStartMsg passMsg(msg->_mousePos, 1, 3); + passMsg.execute("BeerGlass"); + + msg->_dragItem = getRoot()->findByName("BeerGlass"); + + CActMsg actMsg("PlayerTakesGlass"); + actMsg.execute("Barbot"); + return true; + } else { + return false; + } +} + +bool CPickUpBarGlass::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pickup/pick_up_bar_glass.h b/engines/titanic/game/pickup/pick_up_bar_glass.h new file mode 100644 index 0000000000..d273d96170 --- /dev/null +++ b/engines/titanic/game/pickup/pick_up_bar_glass.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_PICK_UP_BAR_GLASS_H +#define TITANIC_PICK_UP_BAR_GLASS_H + +#include "titanic/game/pickup/pick_up.h" + +namespace Titanic { + +class CPickUpBarGlass : public CPickUp { + DECLARE_MESSAGE_MAP; + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *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_PICK_UP_BAR_GLASS_H */ diff --git a/engines/titanic/game/pickup/pick_up_hose.cpp b/engines/titanic/game/pickup/pick_up_hose.cpp new file mode 100644 index 0000000000..d07088cefd --- /dev/null +++ b/engines/titanic/game/pickup/pick_up_hose.cpp @@ -0,0 +1,106 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/pickup/pick_up_hose.h" +#include "titanic/core/project_item.h" +#include "titanic/core/room_item.h" +#include "titanic/core/view_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPickUpHose, CPickUp) + ON_MESSAGE(MouseDragStartMsg) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(MouseButtonDownMsg) +END_MESSAGE_MAP() + +bool CPickUpHose::_v1; + +void CPickUpHose::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_target, indent); + file->writeNumberLine(_v1, indent); + + CPickUp::save(file, indent); +} + +void CPickUpHose::load(SimpleFile *file) { + file->readNumber(); + _target = file->readString(); + _v1 = file->readNumber(); + + CPickUp::load(file); +} + +bool CPickUpHose::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (!checkStartDragging(msg)) + return true; + if (_v1 || !_enabled) + return false; + + CViewItem *view = getView(); + if (view) { + _v1 = true; + CRoomItem *room = locateRoom("Arboretum"); + CTreeItem *hose = room ? room->findByName("Hose") : nullptr; + + if (!hose) { + room = locateRoom("FrozenArboretum"); + if (room) + hose = room->findByName("Hose"); + } + + if (hose) { + CVisibleMsg visibleMsg; + visibleMsg.execute(this); + moveUnder(view); + + CPassOnDragStartMsg passMsg(msg->_mousePos, 1); + passMsg.execute("Hose"); + + msg->_dragItem = getRoot()->findByName("Hose"); + _cursorId = CURSOR_IGNORE; + + CActMsg actMsg("PlayerGetsHose"); + actMsg.execute(_target); + } + } + + return true; +} + +bool CPickUpHose::StatusChangeMsg(CStatusChangeMsg *msg) { + _cursorId = msg->_newStatus == 1 ? CURSOR_HAND : CURSOR_IGNORE; + return true; +} + +bool CPickUpHose::EnterViewMsg(CEnterViewMsg *msg) { + _cursorId = CURSOR_IGNORE; + return true; +} + +bool CPickUpHose::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return _enabled; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pickup/pick_up_hose.h b/engines/titanic/game/pickup/pick_up_hose.h new file mode 100644 index 0000000000..2ad7c2a583 --- /dev/null +++ b/engines/titanic/game/pickup/pick_up_hose.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_PICK_UP_HOSE_H +#define TITANIC_PICK_UP_HOSE_H + +#include "titanic/game/pickup/pick_up.h" + +namespace Titanic { + +class CPickUpHose : public CPickUp { + DECLARE_MESSAGE_MAP; + bool MouseDragStartMsg(CMouseDragStartMsg *msg); + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); +private: + static bool _v1; + + CString _target; +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_PICK_UP_HOSE_H */ diff --git a/engines/titanic/game/pickup/pick_up_lemon.cpp b/engines/titanic/game/pickup/pick_up_lemon.cpp new file mode 100644 index 0000000000..5109c36304 --- /dev/null +++ b/engines/titanic/game/pickup/pick_up_lemon.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/game/pickup/pick_up_lemon.h" +#include "titanic/core/project_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPickUpLemon, CPickUp) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MouseDragStartMsg) +END_MESSAGE_MAP() + +void CPickUpLemon::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CPickUp::save(file, indent); +} + +void CPickUpLemon::load(SimpleFile *file) { + file->readNumber(); + CPickUp::load(file); +} + +bool CPickUpLemon::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return true; +} + +bool CPickUpLemon::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (!checkStartDragging(msg)) + return true; + if (!_enabled) + return false; + + CVisibleMsg visibleMsg; + visibleMsg.execute("Lemon"); + CPassOnDragStartMsg passMsg(msg->_mousePos, 1); + passMsg.execute("Lemon"); + + msg->_dragItem = getRoot()->findByName("Lemon"); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pickup/pick_up_lemon.h b/engines/titanic/game/pickup/pick_up_lemon.h new file mode 100644 index 0000000000..c196acdeaf --- /dev/null +++ b/engines/titanic/game/pickup/pick_up_lemon.h @@ -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. + * + */ + +#ifndef TITANIC_PICK_UP_LEMON_H +#define TITANIC_PICK_UP_LEMON_H + +#include "titanic/game/pickup/pick_up.h" + +namespace Titanic { + +class CPickUpLemon : public CPickUp { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *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_PICK_UP_LEMON_H */ diff --git a/engines/titanic/game/pickup/pick_up_speech_centre.cpp b/engines/titanic/game/pickup/pick_up_speech_centre.cpp new file mode 100644 index 0000000000..5e99c0a3b7 --- /dev/null +++ b/engines/titanic/game/pickup/pick_up_speech_centre.cpp @@ -0,0 +1,73 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/pickup/pick_up_speech_centre.h" +#include "titanic/core/project_item.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPickUpSpeechCentre, CPickUp) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(MouseDragStartMsg) +END_MESSAGE_MAP() + +void CPickUpSpeechCentre::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CPickUp::save(file, indent); +} + +void CPickUpSpeechCentre::load(SimpleFile *file) { + file->readNumber(); + CPickUp::load(file); +} + +bool CPickUpSpeechCentre::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return true; +} + +bool CPickUpSpeechCentre::StatusChangeMsg(CStatusChangeMsg *msg) { + _enabled = msg->_newStatus == 1; + return true; +} + +bool CPickUpSpeechCentre::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (checkStartDragging(msg)) { + if (_enabled) { + CVisibleMsg visibleMsg; + visibleMsg.execute("SpeechCentre"); + CPassOnDragStartMsg passMsg(msg->_mousePos, 1); + passMsg.execute("SpeechCentre"); + + msg->_dragItem = getRoot()->findByName("SpeechCentre"); + + CActMsg actMsg("PlayerGetsSpeechCentre"); + actMsg.execute("SeasonalAdjust"); + } else { + petDisplayMessage("You can't pick this up on account of it being stuck to the branch."); + } + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pickup/pick_up_speech_centre.h b/engines/titanic/game/pickup/pick_up_speech_centre.h new file mode 100644 index 0000000000..81ee0b5d77 --- /dev/null +++ b/engines/titanic/game/pickup/pick_up_speech_centre.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_PICK_UP_SPEECH_CENTRE_H +#define TITANIC_PICK_UP_SPEECH_CENTRE_H + +#include "titanic/game/pickup/pick_up.h" + +namespace Titanic { + +class CPickUpSpeechCentre : public CPickUp { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool StatusChangeMsg(CStatusChangeMsg *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_PICK_UP_SPEECH_CENTRE_H */ diff --git a/engines/titanic/game/pickup/pick_up_vis_centre.cpp b/engines/titanic/game/pickup/pick_up_vis_centre.cpp new file mode 100644 index 0000000000..baf1763d09 --- /dev/null +++ b/engines/titanic/game/pickup/pick_up_vis_centre.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/game/pickup/pick_up_vis_centre.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPickUpVisCentre, CPickUp) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MouseDragStartMsg) +END_MESSAGE_MAP() + +void CPickUpVisCentre::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CPickUp::save(file, indent); +} + +void CPickUpVisCentre::load(SimpleFile *file) { + file->readNumber(); + CPickUp::load(file); +} + + +bool CPickUpVisCentre::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return true; +} + +bool CPickUpVisCentre::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (!checkStartDragging(msg) || !_enabled) + return false; + + setVisible(false); + CVisibleMsg visibleMsg; + visibleMsg.execute("VisionCentre"); + msg->execute("VisionCentre"); + CActMsg actMsg("PlayerTakesVisCentre"); + actMsg.execute("Barbot"); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pickup/pick_up_vis_centre.h b/engines/titanic/game/pickup/pick_up_vis_centre.h new file mode 100644 index 0000000000..a5f59211d3 --- /dev/null +++ b/engines/titanic/game/pickup/pick_up_vis_centre.h @@ -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. + * + */ + +#ifndef TITANIC_PICK_UP_VIS_CENTRE_H +#define TITANIC_PICK_UP_VIS_CENTRE_H + +#include "titanic/game/pickup/pick_up.h" + +namespace Titanic { + +class CPickUpVisCentre : public CPickUp { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *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_PICK_UP_VIS_CENTRE_H */ diff --git a/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp b/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp new file mode 100644 index 0000000000..6e5037f237 --- /dev/null +++ b/engines/titanic/game/placeholder/bar_shelf_vis_centre.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/game/placeholder/bar_shelf_vis_centre.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CBarShelfVisCentre, CPlaceHolder) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(TimerMsg) + ON_MESSAGE(EnterViewMsg) +END_MESSAGE_MAP() + +void CBarShelfVisCentre::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_flag, indent); + CPlaceHolder::save(file, indent); +} + +void CBarShelfVisCentre::load(SimpleFile *file) { + file->readNumber(); + _flag = file->readNumber(); + CPlaceHolder::load(file); +} + +bool CBarShelfVisCentre::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (!_flag) { + CActMsg actMsg("ClickOnVision"); + actMsg.execute("Barbot"); + addTimer(3000); + _flag = true; + } + + return true; +} + +bool CBarShelfVisCentre::TimerMsg(CTimerMsg *msg) { + _flag = false; + return true; +} + +bool CBarShelfVisCentre::EnterViewMsg(CEnterViewMsg *msg) { + _flag = false; + return true; +} + + +} // End of namespace Titanic diff --git a/engines/titanic/game/placeholder/bar_shelf_vis_centre.h b/engines/titanic/game/placeholder/bar_shelf_vis_centre.h new file mode 100644 index 0000000000..8ad3dcb8d1 --- /dev/null +++ b/engines/titanic/game/placeholder/bar_shelf_vis_centre.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_BAR_SHELF_VIS_CENTRE_H +#define TITANIC_BAR_SHELF_VIS_CENTRE_H + +#include "titanic/game/placeholder/place_holder.h" + +namespace Titanic { + +class CBarShelfVisCentre : public CPlaceHolder { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool TimerMsg(CTimerMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); +private: + bool _flag; +public: + CLASSDEF; + CBarShelfVisCentre() : CPlaceHolder(), _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_BAR_SHELF_VIS_CENTRE_H */ diff --git a/engines/titanic/game/placeholder/lemon_on_bar.cpp b/engines/titanic/game/placeholder/lemon_on_bar.cpp new file mode 100644 index 0000000000..e9cf6a309a --- /dev/null +++ b/engines/titanic/game/placeholder/lemon_on_bar.cpp @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/placeholder/lemon_on_bar.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CLemonOnBar, CPlaceHolder) + ON_MESSAGE(VisibleMsg) +END_MESSAGE_MAP() + +void CLemonOnBar::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writePoint(_lemonPos, indent); + CPlaceHolder::save(file, indent); +} + +void CLemonOnBar::load(SimpleFile *file) { + file->readNumber(); + _lemonPos = file->readPoint(); + CPlaceHolder::load(file); +} + +bool CLemonOnBar::VisibleMsg(CVisibleMsg *msg) { + setVisible(msg->_visible); + if (msg->_visible) + setPosition(_lemonPos); + else + setPosition(Point(0, 0)); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/placeholder/lemon_on_bar.h b/engines/titanic/game/placeholder/lemon_on_bar.h new file mode 100644 index 0000000000..c6512ced67 --- /dev/null +++ b/engines/titanic/game/placeholder/lemon_on_bar.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_LEMON_ON_BAR_H +#define TITANIC_LEMON_ON_BAR_H + +#include "titanic/game/placeholder/place_holder.h" + +namespace Titanic { + +class CLemonOnBar : public CPlaceHolder { + DECLARE_MESSAGE_MAP; + bool VisibleMsg(CVisibleMsg *msg); +private: + Point _lemonPos; +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_LEMON_ON_BAR_H */ diff --git a/engines/titanic/game/placeholder/place_holder.cpp b/engines/titanic/game/placeholder/place_holder.cpp new file mode 100644 index 0000000000..ae42cabc29 --- /dev/null +++ b/engines/titanic/game/placeholder/place_holder.cpp @@ -0,0 +1,46 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/placeholder/place_holder.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPlaceHolder, CGameObject) + ON_MESSAGE(VisibleMsg) +END_MESSAGE_MAP() + +void CPlaceHolder::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPlaceHolder::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +bool CPlaceHolder::VisibleMsg(CVisibleMsg *msg) { + setVisible(msg->_visible); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/placeholder/place_holder.h b/engines/titanic/game/placeholder/place_holder.h new file mode 100644 index 0000000000..b1aa041710 --- /dev/null +++ b/engines/titanic/game/placeholder/place_holder.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_PLACE_HOLDER_H +#define TITANIC_PLACE_HOLDER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPlaceHolder : public CGameObject { + DECLARE_MESSAGE_MAP; + bool VisibleMsg(CVisibleMsg *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_PLACE_HOLDER_H */ diff --git a/engines/titanic/game/placeholder/tv_on_bar.cpp b/engines/titanic/game/placeholder/tv_on_bar.cpp new file mode 100644 index 0000000000..e17fb7833d --- /dev/null +++ b/engines/titanic/game/placeholder/tv_on_bar.cpp @@ -0,0 +1,39 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/placeholder/tv_on_bar.h" + +namespace Titanic { + +void CTVOnBar::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writePoint(_pos1, indent); + CPlaceHolder::save(file, indent); +} + +void CTVOnBar::load(SimpleFile *file) { + file->readNumber(); + _pos1 = file->readPoint(); + CPlaceHolder::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/placeholder/tv_on_bar.h b/engines/titanic/game/placeholder/tv_on_bar.h new file mode 100644 index 0000000000..bb5381fb5d --- /dev/null +++ b/engines/titanic/game/placeholder/tv_on_bar.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_TV_ON_BAR_H +#define TITANIC_TV_ON_BAR_H + +#include "titanic/game/placeholder/place_holder.h" + +namespace Titanic { + +class CTVOnBar : public CPlaceHolder { +private: + Point _pos1; +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_TV_ON_BAR_H */ diff --git a/engines/titanic/game/play_music_button.cpp b/engines/titanic/game/play_music_button.cpp new file mode 100644 index 0000000000..93416911b8 --- /dev/null +++ b/engines/titanic/game/play_music_button.cpp @@ -0,0 +1,78 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/play_music_button.h" +#include "titanic/sound/music_room.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPlayMusicButton, CBackground) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(FrameMsg) +END_MESSAGE_MAP() + +void CPlayMusicButton::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_flag, indent); + file->writeNumberLine(_ticks, indent); + + CBackground::save(file, indent); +} + +void CPlayMusicButton::load(SimpleFile *file) { + file->readNumber(); + _flag = file->readNumber(); + _ticks = file->readNumber(); + + CBackground::load(file); +} + +bool CPlayMusicButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + CMusicRoom *musicRoom = getMusicRoom(); + if (_flag) { + musicRoom->stopMusic(); + stopMovie(); + loadFrame(0); + _flag = false; + } else { + musicRoom->startMusic(100); + playMovie(MOVIE_REPEAT); + _ticks = getTicksCount(); + _flag = true; + } + + return true; +} + +bool CPlayMusicButton::FrameMsg(CFrameMsg *msg) { + if (_flag && !CMusicRoom::_musicHandler->isBusy()) { + CMusicRoom *musicRoom = getMusicRoom(); + musicRoom->stopMusic(); + stopMovie(); + loadFrame(0); + _flag = false; + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/play_music_button.h b/engines/titanic/game/play_music_button.h new file mode 100644 index 0000000000..824b372bf9 --- /dev/null +++ b/engines/titanic/game/play_music_button.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_PLAY_MUSIC_BUTTON_H +#define TITANIC_PLAY_MUSIC_BUTTON_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CPlayMusicButton : public CBackground { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool FrameMsg(CFrameMsg *msg); +public: + bool _flag; + uint _ticks; +public: + CLASSDEF; + CPlayMusicButton() : CBackground(), _flag(false), _ticks(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_PLAY_MUSIC_BUTTON_H */ diff --git a/engines/titanic/game/play_on_act.cpp b/engines/titanic/game/play_on_act.cpp new file mode 100644 index 0000000000..9c368c335d --- /dev/null +++ b/engines/titanic/game/play_on_act.cpp @@ -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. + * + */ + +#include "titanic/game/play_on_act.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPlayOnAct, CBackground) + ON_MESSAGE(ActMsg) + ON_MESSAGE(LeaveViewMsg) +END_MESSAGE_MAP() + +void CPlayOnAct::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CBackground::save(file, indent); +} + +void CPlayOnAct::load(SimpleFile *file) { + file->readNumber(); + CBackground::load(file); +} + +bool CPlayOnAct::ActMsg(CActMsg *msg) { + if (msg->_action == "PlayMovie") { + setVisible(true); + playMovie(0); + } else if (msg->_action == "PlayToEnd") { + setVisible(true); + playMovie(MOVIE_GAMESTATE); + } + + return true; +} + +bool CPlayOnAct::LeaveViewMsg(CLeaveViewMsg *msg) { + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/play_on_act.h b/engines/titanic/game/play_on_act.h new file mode 100644 index 0000000000..72615f2fc4 --- /dev/null +++ b/engines/titanic/game/play_on_act.h @@ -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. + * + */ + +#ifndef TITANIC_PLAY_ON_ACT_H +#define TITANIC_PLAY_ON_ACT_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CPlayOnAct : public CBackground { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *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_PLAY_ON_ACT_H */ diff --git a/engines/titanic/game/port_hole.cpp b/engines/titanic/game/port_hole.cpp new file mode 100644 index 0000000000..25807b1b1d --- /dev/null +++ b/engines/titanic/game/port_hole.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/game/port_hole.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPortHole, CGameObject) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(EnterViewMsg) +END_MESSAGE_MAP() + +CPortHole::CPortHole() : CGameObject(), _open(false), + _closeSoundName("b#47.wav"), _openSoundName("b#46.wav") { +} + +void CPortHole::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_open, indent); + file->writeQuotedLine(_closeSoundName, indent); + file->writeQuotedLine(_openSoundName, indent); + + CGameObject::save(file, indent); +} + +void CPortHole::load(SimpleFile *file) { + file->readNumber(); + _open = file->readNumber(); + _closeSoundName = file->readString(); + _openSoundName = file->readString(); + + CGameObject::load(file); +} + +bool CPortHole::ActMsg(CActMsg *msg) { + if (msg->_action == "TogglePortHole") { + if (_open) { + playMovie(14, 26, MOVIE_NOTIFY_OBJECT); + playSound(_closeSoundName); + _open = false; + } else { + setVisible(true); + playMovie(1, 13, 0); + playSound(_openSoundName); + _open = true; + } + } + + return true; +} + +bool CPortHole::MovieEndMsg(CMovieEndMsg *msg) { + _open = false; + setVisible(false); + return true; +} + +bool CPortHole::LeaveViewMsg(CLeaveViewMsg *msg) { + if (_open) { + playSound(_closeSoundName); + playMovie(14, 26, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + _open = false; + } + + return true; +} + +bool CPortHole::EnterViewMsg(CEnterViewMsg *msg) { + setVisible(false); + _open = false; + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/port_hole.h b/engines/titanic/game/port_hole.h new file mode 100644 index 0000000000..9f1997a517 --- /dev/null +++ b/engines/titanic/game/port_hole.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_PORT_HOLE_H +#define TITANIC_PORT_HOLE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPortHole : public CGameObject { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); +private: + bool _open; + CString _closeSoundName, _openSoundName; +public: + CLASSDEF; + CPortHole(); + + /** + * 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_PORT_HOLE_H */ diff --git a/engines/titanic/game/record_phonograph_button.cpp b/engines/titanic/game/record_phonograph_button.cpp new file mode 100644 index 0000000000..f022957dbb --- /dev/null +++ b/engines/titanic/game/record_phonograph_button.cpp @@ -0,0 +1,39 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/record_phonograph_button.h" + +namespace Titanic { + +void CRecordPhonographButton::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CBackground::save(file, indent); +} + +void CRecordPhonographButton::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/record_phonograph_button.h b/engines/titanic/game/record_phonograph_button.h new file mode 100644 index 0000000000..3383c01e31 --- /dev/null +++ b/engines/titanic/game/record_phonograph_button.h @@ -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. + * + */ + +#ifndef TITANIC_RECORD_PHONOGRAPH_BUTTON_H +#define TITANIC_RECORD_PHONOGRAPH_BUTTON_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CRecordPhonographButton : public CBackground { +public: + int _value; +public: + CLASSDEF; + CRecordPhonographButton() : CBackground(), _value(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_RECORD_PHONOGRAPH_BUTTON_H */ diff --git a/engines/titanic/game/replacement_ear.cpp b/engines/titanic/game/replacement_ear.cpp new file mode 100644 index 0000000000..1f9960365d --- /dev/null +++ b/engines/titanic/game/replacement_ear.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/game/replacement_ear.h" + +namespace Titanic { + +void CReplacementEar::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CBackground::save(file, indent); +} + +void CReplacementEar::load(SimpleFile *file) { + file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/replacement_ear.h b/engines/titanic/game/replacement_ear.h new file mode 100644 index 0000000000..0d282b7fb4 --- /dev/null +++ b/engines/titanic/game/replacement_ear.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_REPLACEMENT_EAR_H +#define TITANIC_REPLACEMENT_EAR_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CReplacementEar : public CBackground { +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_REPLACEMENT_EAR_H */ diff --git a/engines/titanic/game/reserved_table.cpp b/engines/titanic/game/reserved_table.cpp new file mode 100644 index 0000000000..a600190709 --- /dev/null +++ b/engines/titanic/game/reserved_table.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/game/reserved_table.h" + +namespace Titanic { + +void CReservedTable::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value1, indent); + file->writeNumberLine(_value2, indent); + + CGameObject::save(file, indent); +} + +void CReservedTable::load(SimpleFile *file) { + file->readNumber(); + _value1 = file->readNumber(); + _value2 = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/reserved_table.h b/engines/titanic/game/reserved_table.h new file mode 100644 index 0000000000..a3532c7d14 --- /dev/null +++ b/engines/titanic/game/reserved_table.h @@ -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. + * + */ + +#ifndef TITANIC_RESERVED_TABLE_H +#define TITANIC_RESERVED_TABLE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CReservedTable : public CGameObject { +public: + int _value1, _value2; +public: + CLASSDEF; + CReservedTable() : CGameObject(), _value1(0), _value2(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_RESERVED_TABLE_H */ diff --git a/engines/titanic/game/restaurant_cylinder_holder.cpp b/engines/titanic/game/restaurant_cylinder_holder.cpp new file mode 100644 index 0000000000..d70009f151 --- /dev/null +++ b/engines/titanic/game/restaurant_cylinder_holder.cpp @@ -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. + * + */ + +#include "titanic/game/restaurant_cylinder_holder.h" + +namespace Titanic { + +CRestaurantCylinderHolder::CRestaurantCylinderHolder() : CDropTarget(), + _field118(0), _field11C(0), _field12C(0), _field130(0), + _string6("z#61.wav"), _field140(1) { +} + +void CRestaurantCylinderHolder::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field118, indent); + file->writeNumberLine(_field11C, indent); + file->writeQuotedLine(_string5, indent); + file->writeNumberLine(_field12C, indent); + file->writeNumberLine(_field130, indent); + file->writeQuotedLine(_string6, indent); + file->writeNumberLine(_field140, indent); + + CDropTarget::save(file, indent); +} + +void CRestaurantCylinderHolder::load(SimpleFile *file) { + file->readNumber(); + _field118 = file->readNumber(); + _field11C = file->readNumber(); + _string5 = file->readString(); + _field12C = file->readNumber(); + _field130 = file->readNumber(); + _string6 = file->readString(); + _field140 = file->readNumber(); + + CDropTarget::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/restaurant_cylinder_holder.h b/engines/titanic/game/restaurant_cylinder_holder.h new file mode 100644 index 0000000000..3aa979b0a5 --- /dev/null +++ b/engines/titanic/game/restaurant_cylinder_holder.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_RESTAURANT_CYLINDER_HOLDER_H +#define TITANIC_RESTAURANT_CYLINDER_HOLDER_H + +#include "titanic/core/drop_target.h" + +namespace Titanic { + +class CRestaurantCylinderHolder : public CDropTarget { +private: + int _field118; + int _field11C; + CString _string5; + int _field12C; + int _field130; + CString _string6; + int _field140; +public: + CLASSDEF; + CRestaurantCylinderHolder(); + + /** + * 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_RESTAURANT_CYLINDER_HOLDER_H */ diff --git a/engines/titanic/game/restaurant_phonograph.cpp b/engines/titanic/game/restaurant_phonograph.cpp new file mode 100644 index 0000000000..83a4ac3e71 --- /dev/null +++ b/engines/titanic/game/restaurant_phonograph.cpp @@ -0,0 +1,51 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/restaurant_phonograph.h" + +namespace Titanic { + +CRestaurantPhonograph::CRestaurantPhonograph() : CPhonograph(), + _fieldF8(1), _field114(0) {} + +void CRestaurantPhonograph::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldF8, indent); + file->writeQuotedLine(_string2, indent); + file->writeQuotedLine(_string3, indent); + + file->writeNumberLine(_field114, indent); + + CPhonograph::save(file, indent); +} + +void CRestaurantPhonograph::load(SimpleFile *file) { + file->readNumber(); + _fieldF8 = file->readNumber(); + _string2 = file->readString(); + _string3 = file->readString(); + _field114 = file->readNumber(); + + CPhonograph::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/restaurant_phonograph.h b/engines/titanic/game/restaurant_phonograph.h new file mode 100644 index 0000000000..710a2edd73 --- /dev/null +++ b/engines/titanic/game/restaurant_phonograph.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_RESTAURANT_PHONOGRAPH_H +#define TITANIC_RESTAURANT_PHONOGRAPH_H + +#include "titanic/game/phonograph.h" + +namespace Titanic { + +class CRestaurantPhonograph : public CPhonograph { +private: + int _fieldF8; + CString _string2; + CString _string3; + int _field114; +public: + CLASSDEF; + CRestaurantPhonograph(); + + /** + * 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_RESTAURANT_PHONOGRAPH_H */ diff --git a/engines/titanic/game/sauce_dispensor.cpp b/engines/titanic/game/sauce_dispensor.cpp new file mode 100644 index 0000000000..8dc818d917 --- /dev/null +++ b/engines/titanic/game/sauce_dispensor.cpp @@ -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. + * + */ + +#include "titanic/game/sauce_dispensor.h" + +namespace Titanic { + +CSauceDispensor::CSauceDispensor() : CBackground(), + _fieldEC(0), _fieldF0(0), _field104(0), _field108(0) { +} + +void CSauceDispensor::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string3, indent); + file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_fieldF0, indent); + file->writePoint(_pos1, indent); + file->writePoint(_pos2, indent); + file->writeNumberLine(_field104, indent); + file->writeNumberLine(_field108, indent); + + CBackground::save(file, indent); +} + +void CSauceDispensor::load(SimpleFile *file) { + file->readNumber(); + _string3 = file->readString(); + _fieldEC = file->readNumber(); + _fieldF0 = file->readNumber(); + _pos1 = file->readPoint(); + _pos2 = file->readPoint(); + _field104 = file->readNumber(); + _field108 = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sauce_dispensor.h b/engines/titanic/game/sauce_dispensor.h new file mode 100644 index 0000000000..aa177050d5 --- /dev/null +++ b/engines/titanic/game/sauce_dispensor.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_SAUCE_DISPENSOR_H +#define TITANIC_SAUCE_DISPENSOR_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CSauceDispensor : public CBackground { +public: + CString _string3; + int _fieldEC; + int _fieldF0; + Point _pos1; + Point _pos2; + int _field104; + int _field108; +public: + CLASSDEF; + CSauceDispensor(); + + /** + * 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_SAUCE_DISPENSOR_H */ diff --git a/engines/titanic/game/search_point.cpp b/engines/titanic/game/search_point.cpp new file mode 100644 index 0000000000..f60a3132b7 --- /dev/null +++ b/engines/titanic/game/search_point.cpp @@ -0,0 +1,39 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/search_point.h" + +namespace Titanic { + +void CSearchPoint::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CSearchPoint::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/search_point.h b/engines/titanic/game/search_point.h new file mode 100644 index 0000000000..3c5639b104 --- /dev/null +++ b/engines/titanic/game/search_point.h @@ -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. + * + */ + +#ifndef TITANIC_SEARCH_POINT_H +#define TITANIC_SEARCH_POINT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CSearchPoint : public CGameObject { +public: + int _value; +public: + CLASSDEF; + CSearchPoint() : CGameObject(), _value(2) {} + + /** + * 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_SEARCH_POINT_H */ diff --git a/engines/titanic/game/season_background.cpp b/engines/titanic/game/season_background.cpp new file mode 100644 index 0000000000..1c63f3d892 --- /dev/null +++ b/engines/titanic/game/season_background.cpp @@ -0,0 +1,51 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/season_background.h" + +namespace Titanic { + +CSeasonBackground::CSeasonBackground() : CBackground(), + _fieldE0(0), _fieldE4(0), _fieldE8(46), _fieldEC(0) { +} + +void CSeasonBackground::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + + CBackground::save(file, indent); +} + +void CSeasonBackground::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/season_background.h b/engines/titanic/game/season_background.h new file mode 100644 index 0000000000..f0fd2cdc63 --- /dev/null +++ b/engines/titanic/game/season_background.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_SEASON_BACKGROUND_H +#define TITANIC_SEASON_BACKGROUND_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CSeasonBackground : public CBackground { +public: + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; +public: + CLASSDEF; + CSeasonBackground(); + + /** + * 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_SEASON_BACKGROUND_H */ diff --git a/engines/titanic/game/season_barrel.cpp b/engines/titanic/game/season_barrel.cpp new file mode 100644 index 0000000000..9594396885 --- /dev/null +++ b/engines/titanic/game/season_barrel.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/game/season_barrel.h" + +namespace Titanic { + +void CSeasonBarrel::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + + CBackground::save(file, indent); +} + +void CSeasonBarrel::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/season_barrel.h b/engines/titanic/game/season_barrel.h new file mode 100644 index 0000000000..f77864599d --- /dev/null +++ b/engines/titanic/game/season_barrel.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_SEASON_BARREL_H +#define TITANIC_SEASON_BARREL_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CSeasonBarrel : public CBackground { +public: + int _fieldE0; + int _fieldE4; +public: + CLASSDEF; + CSeasonBarrel() : CBackground(), _fieldE0(0), _fieldE4(7) {} + + /** + * 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_SEASON_BARREL_H */ diff --git a/engines/titanic/game/seasonal_adjustment.cpp b/engines/titanic/game/seasonal_adjustment.cpp new file mode 100644 index 0000000000..33a0ae89c5 --- /dev/null +++ b/engines/titanic/game/seasonal_adjustment.cpp @@ -0,0 +1,43 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/seasonal_adjustment.h" + +namespace Titanic { + +void CSeasonalAdjustment::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + + CBackground::save(file, indent); +} + +void CSeasonalAdjustment::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/seasonal_adjustment.h b/engines/titanic/game/seasonal_adjustment.h new file mode 100644 index 0000000000..f96c13619d --- /dev/null +++ b/engines/titanic/game/seasonal_adjustment.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_SEASONAL_ADJUSTMENT_H +#define TITANIC_SEASONAL_ADJUSTMENT_H + +#include "titanic/core/background.h" + +namespace Titanic { + +enum Season { + SPRING = 0, + SUMMER = 1, + AUTUMN = 2, + WINTER = 3 +}; + +class CSeasonalAdjustment : public CBackground { +public: + int _fieldE0; + int _fieldE4; +public: + CLASSDEF; + CSeasonalAdjustment() : CBackground(), _fieldE0(0), _fieldE4(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_SEASONAL_ADJUSTMENT_H */ diff --git a/engines/titanic/game/service_elevator_window.cpp b/engines/titanic/game/service_elevator_window.cpp new file mode 100644 index 0000000000..95b2735b37 --- /dev/null +++ b/engines/titanic/game/service_elevator_window.cpp @@ -0,0 +1,51 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/service_elevator_window.h" + +namespace Titanic { + +CServiceElevatorWindow::CServiceElevatorWindow() : CBackground(), + _fieldE0(0), _fieldE4(0), _fieldE8(0), _fieldEC(0) { +} + +void CServiceElevatorWindow::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + + CBackground::save(file, indent); +} + +void CServiceElevatorWindow::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/service_elevator_window.h b/engines/titanic/game/service_elevator_window.h new file mode 100644 index 0000000000..4233b8405a --- /dev/null +++ b/engines/titanic/game/service_elevator_window.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_SERVICE_ELEVATOR_WINDOW_H +#define TITANIC_SERVICE_ELEVATOR_WINDOW_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CServiceElevatorWindow : public CBackground { +public: + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; +public: + CLASSDEF; + CServiceElevatorWindow(); + + /** + * 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_SERVICE_ELEVATOR_WINDOW_H */ diff --git a/engines/titanic/game/sgt/armchair.cpp b/engines/titanic/game/sgt/armchair.cpp new file mode 100644 index 0000000000..f547c3ef9a --- /dev/null +++ b/engines/titanic/game/sgt/armchair.cpp @@ -0,0 +1,87 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/sgt/armchair.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CArmchair, CSGTStateRoom) + ON_MESSAGE(TurnOn) + ON_MESSAGE(TurnOff) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + +void CArmchair::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void CArmchair::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +bool CArmchair::TurnOn(CTurnOn *msg) { + if (_statics->_v8 == "Closed" && _statics->_v12 == "Closed") { + CVisibleMsg visibleMsg(false); + visibleMsg.execute("Deskchair"); + + if (_statics->_v9 == "Open") { + CActMsg actMsg("Squash"); + actMsg.execute("Deskchair"); + _startFrame = 22; + _endFrame = 31; + } else { + _startFrame = 0; + _endFrame = 10; + } + + playMovie(_startFrame, _endFrame, MOVIE_GAMESTATE); + playSound("b#0.wav"); + _statics->_v8 = "Open"; + _fieldE0 = 0; + } + + return true; +} + +bool CArmchair::TurnOff(CTurnOff *msg) { + if (_statics->_v8 == "Open") { + _statics->_v8 = "Closed"; + _startFrame = 11; + _endFrame = 21; + _fieldE0 = 1; + playMovie(11, 21, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playSound("b#0.wav"); + } + + return true; +} + +bool CArmchair::MovieEndMsg(CMovieEndMsg *msg) { + if (_statics->_v8 == "Closed") + loadFrame(0); + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/armchair.h b/engines/titanic/game/sgt/armchair.h new file mode 100644 index 0000000000..169b9b4aa0 --- /dev/null +++ b/engines/titanic/game/sgt/armchair.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_ARMCHAIR_H +#define TITANIC_ARMCHAIR_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class CArmchair : public CSGTStateRoom { + DECLARE_MESSAGE_MAP; + bool TurnOn(CTurnOn *msg); + bool TurnOff(CTurnOff *msg); + bool MovieEndMsg(CMovieEndMsg *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_ARMCHAIR_H */ diff --git a/engines/titanic/game/sgt/basin.cpp b/engines/titanic/game/sgt/basin.cpp new file mode 100644 index 0000000000..775c67deca --- /dev/null +++ b/engines/titanic/game/sgt/basin.cpp @@ -0,0 +1,78 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/sgt/basin.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CBasin, CSGTStateRoom) + ON_MESSAGE(TurnOn) + ON_MESSAGE(TurnOff) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + +void CBasin::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void CBasin::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +bool CBasin::TurnOn(CTurnOn *msg) { + if (_statics->_v10 == "Open" && _statics->_v11 == "Closed" + && _statics->_v2 == "Closed") { + setVisible(true); + _statics->_v11 = "Open"; + _fieldE0 = 0; + _startFrame = 0; + _endFrame = 6; + playMovie(0, 6, MOVIE_GAMESTATE); + playSound("b#13.wav"); + } + + return true; +} + +bool CBasin::TurnOff(CTurnOff *msg) { + if (_statics->_v11 == "Open") { + _statics->_v11 = "Closed"; + _fieldE0 = 1; + _startFrame = 8; + _endFrame = 14; + playMovie(8, 14, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playSound("b#13.wav"); + } + + return true; +} + +bool CBasin::MovieEndMsg(CMovieEndMsg *msg) { + if (_statics->_v11 == "Closed") + setVisible(false); + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/basin.h b/engines/titanic/game/sgt/basin.h new file mode 100644 index 0000000000..1fcb469824 --- /dev/null +++ b/engines/titanic/game/sgt/basin.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_BASIN_H +#define TITANIC_BASIN_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class CBasin : public CSGTStateRoom { + DECLARE_MESSAGE_MAP; + bool TurnOn(CTurnOn *msg); + bool TurnOff(CTurnOff *msg); + bool MovieEndMsg(CMovieEndMsg *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_BASIN_H */ diff --git a/engines/titanic/game/sgt/bedfoot.cpp b/engines/titanic/game/sgt/bedfoot.cpp new file mode 100644 index 0000000000..ff7d64569a --- /dev/null +++ b/engines/titanic/game/sgt/bedfoot.cpp @@ -0,0 +1,129 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/sgt/bedfoot.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CBedfoot, CSGTStateRoom) + ON_MESSAGE(TurnOn) + ON_MESSAGE(TurnOff) +END_MESSAGE_MAP() + +void CBedfoot::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void CBedfoot::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +bool CBedfoot::TurnOn(CTurnOn *msg) { + if (_statics->_v2 == "Closed" && _statics->_v11 == "Closed") { + _fieldE0 = 0; + _startFrame = 0; + if (_statics->_v10 == "Open") { + _endFrame = 13; + _statics->_v2 = "Open"; + playSound("b#7.wav"); + } else { + _endFrame = 17; + _statics->_v2 = "NotOnWashstand"; + playSound("b#4.wav"); + } + + playMovie(_startFrame, _endFrame, MOVIE_GAMESTATE); + } else if (_statics->_v2 == "RestingUnderTV") { + _fieldE0 = 0; + _startFrame = 8; + if (_statics->_v10 == "Open") { + _statics->_v2 = "Open"; + playSound("189_436_bed down 1.wav"); + } else { + _statics->_v2 = "NotOnWashstand"; + playSound("192_436_bed hits floor.wav"); + } + + playMovie(_startFrame, _endFrame, MOVIE_GAMESTATE); + } + + if (_statics->_v2 == "Open") + _statics->_v1 = "Closed"; + else if (_statics->_v2 == "NotOnWashstand") + _statics->_v1 = "ClosedWrong"; + + return true; +} + +bool CBedfoot::TurnOff(CTurnOff *msg) { + if (_statics->_v1 == "Closed" || _statics->_v1 == "ClosedWrong") { + setVisible(true); + CVisibleMsg visibleMsg(false); + visibleMsg.execute("Bedhead"); + } + + if (_statics->_v2 == "Open" && _statics->_v1 == "Closed") { + _fieldE0 = 0; + _startFrame = 20; + if (_statics->_v4 == "Closed") { + _statics->_v2 = "Closed"; + _endFrame = 30; + } else { + _statics->_v2 = "RestingUnderTV"; + _endFrame = 25; + } + + playMovie(_startFrame, _endFrame, MOVIE_GAMESTATE); + playSound("b#7.wav"); + + } else if (_statics->_v2 == "NotOnWashstand" && _statics->_v1 == "ClosedWrong") { + _fieldE0 = 0; + _startFrame = 17; + + if (_statics->_v4 == "Closed") { + _statics->_v2 = "Closed"; + _endFrame = 30; + } else { + _statics->_v2 = "RestingUnderTV"; + _endFrame = 25; + } + + playMovie(_startFrame, _endFrame, MOVIE_GAMESTATE); + playSound("b#7.wav"); + + } else if (_statics->_v2 == "RestingUTV" && _statics->_v4 == "Closed") { + _statics->_v2 = "Closed"; + _startFrame = 25; + _endFrame = 30; + playMovie(25, 30, MOVIE_GAMESTATE); + playSound("b#7.wav"); + } + + if (_statics->_v2 == "Closed") + _statics->_v1 = "Closed"; + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/bedfoot.h b/engines/titanic/game/sgt/bedfoot.h new file mode 100644 index 0000000000..cc7b82b075 --- /dev/null +++ b/engines/titanic/game/sgt/bedfoot.h @@ -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. + * + */ + +#ifndef TITANIC_BEDFOOT_H +#define TITANIC_BEDFOOT_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class CBedfoot : public CSGTStateRoom { + DECLARE_MESSAGE_MAP; + bool TurnOn(CTurnOn *msg); + bool TurnOff(CTurnOff *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_BEDFOOT_H */ diff --git a/engines/titanic/game/sgt/bedhead.cpp b/engines/titanic/game/sgt/bedhead.cpp new file mode 100644 index 0000000000..f911a83ae3 --- /dev/null +++ b/engines/titanic/game/sgt/bedhead.cpp @@ -0,0 +1,170 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/sgt/bedhead.h" +#include "titanic/titanic.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CBedhead, CSGTStateRoom) + ON_MESSAGE(TurnOn) + ON_MESSAGE(TurnOff) +END_MESSAGE_MAP() + +void BedheadEntry::load(Common::SeekableReadStream *s) { + _name1 = readStringFromStream(s); + _name2 = readStringFromStream(s); + _name3 = readStringFromStream(s); + _name4 = readStringFromStream(s); + _startFrame = s->readUint32LE(); + _endFrame = s->readUint32LE(); +} + +/*------------------------------------------------------------------------*/ + +void BedheadEntries::load(Common::SeekableReadStream *s, int count) { + resize(count); + for (uint idx = 0; idx < count; ++idx) + (*this)[idx].load(s); +} + +/*------------------------------------------------------------------------*/ + +void TurnOnEntries::load(Common::SeekableReadStream *s) { + _closed.load(s, 4); + _restingTV.load(s, 2); + _restingUV.load(s, 2); + _closedWrong.load(s, 2); +} + +/*------------------------------------------------------------------------*/ + +void TurnOffEntries::load(Common::SeekableReadStream *s) { + _open.load(s, 3); + _restingUTV.load(s, 1); + _restingV.load(s, 1); + _restingG.load(s, 3); + _openWrong.load(s, 1); + _restingDWrong.load(s, 1); +} + +/*------------------------------------------------------------------------*/ + +CBedhead::CBedhead() : CSGTStateRoom() { + Common::SeekableReadStream *s = g_vm->_filesManager->getResource("DATA/BEDHEAD"); + _on.load(s); + _off.load(s); + delete s; +} + +void CBedhead::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void CBedhead::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +bool CBedhead::TurnOn(CTurnOn *msg) { + if (_statics->_v2 == "Closed" || _statics->_v2 == "RestingUnderTV") + return true; + + const BedheadEntries *data = nullptr; + if (_statics->_v1 == "Closed") + data = &_on._closed; + else if (_statics->_v1 == "RestingTV") + data = &_on._restingTV; + else if (_statics->_v1 == "RestingUV") + data = &_on._restingUV; + else if (_statics->_v1 == "ClosedWrong") + data = &_on._closedWrong; + else + return true; + + for (uint idx = 0; idx < data->size(); ++idx) { + const BedheadEntry &entry = (*data)[idx]; + if ((entry._name1 == _statics->_v4 || entry._name1 == "Any") + && (entry._name2 == _statics->_v3 || entry._name2 == "Any") + && (entry._name3 == _statics->_v5 || entry._name3 == "Any")) { + CVisibleMsg visibleMsg(false); + visibleMsg.execute("Bedfoot"); + setVisible(true); + + _statics->_v1 = entry._name4; + playMovie(entry._startFrame, entry._endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playSound("b#6.wav"); + _fieldE0 = false; + } + } + + if (_statics->_v1 == "Open") { + playMovie(71, 78, 0); + playSound("196_436 bed inflate 2.wav"); + } + + return true; +} + +bool CBedhead::TurnOff(CTurnOff *msg) { + if (_statics->_v1 == "Open") { + playMovie(78, 85, 0); + playSound("191_436_bed inflate deflate.wav"); + } + + BedheadEntries *data = nullptr; + if (_statics->_v1 == "Open") + data = &_off._open; + else if (_statics->_v1 == "RestingUTV") + data = &_off._restingUTV; + else if (_statics->_v1 == "RestingV") + data = &_off._restingV; + else if (_statics->_v1 == "RestingG") + data = &_off._restingG; + else if (_statics->_v1 == "OpenWrong") + data = &_off._openWrong; + else if (_statics->_v1 == "RestingDWrong") + data = &_off._restingDWrong; + else + return true; + + for (uint idx = 0; idx < data->size(); ++idx) { + const BedheadEntry &entry = (*data)[idx]; + if ((entry._name1 == _statics->_v4 || entry._name1 == "Any") + && (entry._name2 == _statics->_v3 || entry._name2 == "Any") + && (entry._name3 == _statics->_v5 || entry._name3 == "Any")) { + CVisibleMsg visibleMsg(false); + visibleMsg.execute("Bedfoot"); + setVisible(true); + + _statics->_v1 = entry._name4; + playMovie(entry._startFrame, entry._endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playSound("193_436_bed fold up 1.wav"); + _fieldE0 = false; + } + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/bedhead.h b/engines/titanic/game/sgt/bedhead.h new file mode 100644 index 0000000000..7784cb8caf --- /dev/null +++ b/engines/titanic/game/sgt/bedhead.h @@ -0,0 +1,90 @@ +/* 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_BEDHEAD_H +#define TITANIC_BEDHEAD_H + +#include "common/array.h" +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +struct BedheadEntry { + CString _name1; + CString _name2; + CString _name3; + CString _name4; + int _startFrame; + int _endFrame; + + void load(Common::SeekableReadStream *s); +}; +class BedheadEntries : public Common::Array<BedheadEntry> { +public: + void load(Common::SeekableReadStream *s, int count); +}; + +struct TurnOnEntries { + BedheadEntries _closed; + BedheadEntries _restingTV; + BedheadEntries _restingUV; + BedheadEntries _closedWrong; + + void load(Common::SeekableReadStream *s); +}; + +struct TurnOffEntries { + BedheadEntries _open; + BedheadEntries _restingUTV; + BedheadEntries _restingV; + BedheadEntries _restingG; + BedheadEntries _openWrong; + BedheadEntries _restingDWrong; + + void load(Common::SeekableReadStream *s); +}; + +class CBedhead : public CSGTStateRoom { + DECLARE_MESSAGE_MAP; + bool TurnOn(CTurnOn *msg); + bool TurnOff(CTurnOff *msg); +private: + TurnOnEntries _on; + TurnOffEntries _off; +public: + CLASSDEF; + CBedhead(); + + /** + * 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_BEDHEAD_H */ diff --git a/engines/titanic/game/sgt/chest_of_drawers.cpp b/engines/titanic/game/sgt/chest_of_drawers.cpp new file mode 100644 index 0000000000..d9c72d3021 --- /dev/null +++ b/engines/titanic/game/sgt/chest_of_drawers.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/game/sgt/chest_of_drawers.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CChestOfDrawers, CSGTStateRoom) + ON_MESSAGE(TurnOn) + ON_MESSAGE(TurnOff) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + +void CChestOfDrawers::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void CChestOfDrawers::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +bool CChestOfDrawers::TurnOn(CTurnOn *msg) { + if (_statics->_v6 == "Closed" && _statics->_v5 == "Open") { + _fieldE0 = false; + _statics->_v6 = "Open"; + _startFrame = 1; + _endFrame = 14; + playSound("b#11.wav"); + } + + return true; +} + +bool CChestOfDrawers::TurnOff(CTurnOff *msg) { + if (_statics->_v6 == "Open" && _statics->_v5 == "Closed") { + CVisibleMsg visibleMsg; + visibleMsg.execute("Drawer"); + _statics->_v6 = "Closed"; + _fieldE0 = true; + + _startFrame = 14; + _endFrame = 27; + playMovie(14, 27, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playSound("b#11.wav"); + } + + return true; +} + +bool CChestOfDrawers::MovieEndMsg(CMovieEndMsg *msg) { + if (_statics->_v6 == "Open") { + CVisibleMsg visibleMsg; + visibleMsg.execute("Drawer"); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/chest_of_drawers.h b/engines/titanic/game/sgt/chest_of_drawers.h new file mode 100644 index 0000000000..5bf852902b --- /dev/null +++ b/engines/titanic/game/sgt/chest_of_drawers.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_CHEST_OF_DRAWERS_H +#define TITANIC_CHEST_OF_DRAWERS_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class CChestOfDrawers : public CSGTStateRoom { + DECLARE_MESSAGE_MAP; + bool TurnOn(CTurnOn *msg); + bool TurnOff(CTurnOff *msg); + bool MovieEndMsg(CMovieEndMsg *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_CHEST_OF_DRAWERS_H */ diff --git a/engines/titanic/game/sgt/desk.cpp b/engines/titanic/game/sgt/desk.cpp new file mode 100644 index 0000000000..09ff66f134 --- /dev/null +++ b/engines/titanic/game/sgt/desk.cpp @@ -0,0 +1,83 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/sgt/desk.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CDesk, CSGTStateRoom) + ON_MESSAGE(TurnOn) + ON_MESSAGE(TurnOff) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + +void CDesk::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void CDesk::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +bool CDesk::TurnOn(CTurnOn *msg) { + if (_statics->_v5 == "Closed" && _statics->_v1 != "RestingG" + && _statics->_v1 != "OpenWrong") { + _statics->_v5 = "Open"; + _fieldE0 = false; + _startFrame = 1; + _endFrame = 26; + playMovie(1, 26, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playSound("b#12.wav"); + } + + return true; +} + +bool CDesk::TurnOff(CTurnOff *msg) { + if (_statics->_v5 == "Open" && _statics->_v6 == "Closed" + && _statics->_v1 == "Open") { + CVisibleMsg visibleMsg(false); + visibleMsg.execute("ChestOfDrawers"); + + _statics->_v5 = "Closed"; + _fieldE0 = true; + _startFrame = 26; + _endFrame = 51; + playMovie(26, 51, MOVIE_GAMESTATE); + playSound("b#9.wav"); + } + + return true; +} + +bool CDesk::MovieEndMsg(CMovieEndMsg *msg) { + if (_statics->_v5 == "Open") { + CVisibleMsg visibleMsg(true); + visibleMsg.execute("ChestOfDrawers"); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/desk.h b/engines/titanic/game/sgt/desk.h new file mode 100644 index 0000000000..8b9e1fe841 --- /dev/null +++ b/engines/titanic/game/sgt/desk.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_DESK_H +#define TITANIC_DESK_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class CDesk : public CSGTStateRoom { + DECLARE_MESSAGE_MAP; + bool TurnOn(CTurnOn *msg); + bool TurnOff(CTurnOff *msg); + bool MovieEndMsg(CMovieEndMsg *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_DESK_H */ diff --git a/engines/titanic/game/sgt/deskchair.cpp b/engines/titanic/game/sgt/deskchair.cpp new file mode 100644 index 0000000000..7f64c2ee34 --- /dev/null +++ b/engines/titanic/game/sgt/deskchair.cpp @@ -0,0 +1,89 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/sgt/deskchair.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CDeskchair, CSGTStateRoom) + ON_MESSAGE(TurnOn) + ON_MESSAGE(TurnOff) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + +void CDeskchair::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void CDeskchair::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +bool CDeskchair::TurnOn(CTurnOn *msg) { + if (_statics->_v8 == "Closed" && _statics->_v9 == "Closed") { + setVisible(true); + _statics->_v9 = "Open"; + _fieldE0 = false; + _startFrame = 0; + _endFrame = 16; + playMovie(0, 16, MOVIE_GAMESTATE); + playSound("b#8.wav"); + } + + return true; +} + +bool CDeskchair::TurnOff(CTurnOff *msg) { + if (_statics->_v9 == "Open") { + _statics->_v9 = "Closed"; + _fieldE0 = true; + _startFrame = 16; + _endFrame = 32; + playMovie(16, 32, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playSound("b#2.wav"); + } + + return true; +} + +bool CDeskchair::ActMsg(CActMsg *msg) { + if (msg->_action == "Smash") { + setVisible(false); + _statics->_v9 = "Closed"; + _fieldE0 = true; + loadFrame(0); + return true; + } else { + return CSGTStateRoom::ActMsg(msg); + } +} + +bool CDeskchair::MovieEndMsg(CMovieEndMsg *msg) { + if (_statics->_v9 == "Closed") + setVisible(false); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/deskchair.h b/engines/titanic/game/sgt/deskchair.h new file mode 100644 index 0000000000..6e7bbe4169 --- /dev/null +++ b/engines/titanic/game/sgt/deskchair.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_DESKCHAIR_H +#define TITANIC_DESKCHAIR_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class CDeskchair : public CSGTStateRoom { + DECLARE_MESSAGE_MAP; + bool TurnOn(CTurnOn *msg); + bool TurnOff(CTurnOff *msg); + bool ActMsg(CActMsg *msg); + bool MovieEndMsg(CMovieEndMsg *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_DESKCHAIR_H */ diff --git a/engines/titanic/game/sgt/drawer.cpp b/engines/titanic/game/sgt/drawer.cpp new file mode 100644 index 0000000000..b8e93c37a6 --- /dev/null +++ b/engines/titanic/game/sgt/drawer.cpp @@ -0,0 +1,83 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/sgt/drawer.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CDrawer, CSGTStateRoom) + ON_MESSAGE(TurnOn) + ON_MESSAGE(TurnOff) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + +CDrawer::CDrawer() : CSGTStateRoom(), _fieldF4(0) { +} + +void CDrawer::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldF4, indent); + CSGTStateRoom::save(file, indent); +} + +void CDrawer::load(SimpleFile *file) { + file->readNumber(); + _fieldF4 = file->readNumber(); + CSGTStateRoom::load(file); +} + +bool CDrawer::TurnOn(CTurnOn *msg) { + if (_statics->_v7 == "Closed" && _statics->_v6 == "Open") { + _statics->_v7 = "Open"; + _fieldE0 = false; + _startFrame = 50; + _endFrame = 75; + setVisible(true); + _statics->_v7 = "Open"; + playMovie(_startFrame, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playSound("b#10.wav"); + } + + return true; +} + +bool CDrawer::TurnOff(CTurnOff *msg) { + if (_statics->_v7 == "Open") { + _statics->_v7 = "Closed"; + _startFrame = 75; + _endFrame = 100; + _fieldE0 = true; + playMovie(_startFrame, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playSound("b#10.wav"); + } + + return true; +} + +bool CDrawer::MovieEndMsg(CMovieEndMsg *msg) { + if (_statics->_v7 == "Closed") + setVisible(false); + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/drawer.h b/engines/titanic/game/sgt/drawer.h new file mode 100644 index 0000000000..e8afe66068 --- /dev/null +++ b/engines/titanic/game/sgt/drawer.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_DRAWER_H +#define TITANIC_DRAWER_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class CDrawer : public CSGTStateRoom { + DECLARE_MESSAGE_MAP; + bool TurnOn(CTurnOn *msg); + bool TurnOff(CTurnOff *msg); + bool MovieEndMsg(CMovieEndMsg *msg); +private: + int _fieldF4; +public: + CLASSDEF; + CDrawer(); + + /** + * 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_DRAWER_H */ diff --git a/engines/titanic/game/sgt/sgt_doors.cpp b/engines/titanic/game/sgt/sgt_doors.cpp new file mode 100644 index 0000000000..516b0f1351 --- /dev/null +++ b/engines/titanic/game/sgt/sgt_doors.cpp @@ -0,0 +1,43 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/sgt/sgt_doors.h" + +namespace Titanic { + +void CSGTDoors::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value1, indent); + file->writeNumberLine(_value2, indent); + + CGameObject::save(file, indent); +} + +void CSGTDoors::load(SimpleFile *file) { + file->readNumber(); + _value1 = file->readNumber(); + _value2 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/sgt_doors.h b/engines/titanic/game/sgt/sgt_doors.h new file mode 100644 index 0000000000..4b4f4a3153 --- /dev/null +++ b/engines/titanic/game/sgt/sgt_doors.h @@ -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. + * + */ + +#ifndef TITANIC_SGT_DOORS_H +#define TITANIC_SGT_DOORS_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CSGTDoors : public CGameObject { +public: + int _value1, _value2; +public: + CLASSDEF; + CSGTDoors() : CGameObject(), _value1(0), _value2(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_SGT_DOORS_H */ diff --git a/engines/titanic/game/sgt/sgt_nav.cpp b/engines/titanic/game/sgt/sgt_nav.cpp new file mode 100644 index 0000000000..f98e486fd0 --- /dev/null +++ b/engines/titanic/game/sgt/sgt_nav.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/game/sgt/sgt_nav.h" + +namespace Titanic { + +void SGTNav::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void SGTNav::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/sgt_nav.h b/engines/titanic/game/sgt/sgt_nav.h new file mode 100644 index 0000000000..40fdc4eff1 --- /dev/null +++ b/engines/titanic/game/sgt/sgt_nav.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_SGT_NAV_H +#define TITANIC_SGT_NAV_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class SGTNav : public CSGTStateRoom { +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_SGT_NAV_H */ diff --git a/engines/titanic/game/sgt/sgt_navigation.cpp b/engines/titanic/game/sgt/sgt_navigation.cpp new file mode 100644 index 0000000000..7bb64f934d --- /dev/null +++ b/engines/titanic/game/sgt/sgt_navigation.cpp @@ -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. + * + */ + +#include "titanic/game/sgt/sgt_navigation.h" + +namespace Titanic { + +CSGTNavigationStatics *CSGTNavigation::_statics; + +void CSGTNavigation::init() { + _statics = new CSGTNavigationStatics(); +} + +void CSGTNavigation::deinit() { + delete _statics; +} + +void CSGTNavigation::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_statics->_changeViewFlag, indent); + file->writeQuotedLine(_statics->_destView, indent); + file->writeQuotedLine(_statics->_destRoom, indent); + + CGameObject::save(file, indent); +} + +void CSGTNavigation::load(SimpleFile *file) { + file->readNumber(); + _statics->_changeViewFlag = file->readNumber(); + _statics->_destView = file->readString(); + _statics->_destRoom = file->readString(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/sgt_navigation.h b/engines/titanic/game/sgt/sgt_navigation.h new file mode 100644 index 0000000000..ed58d918e9 --- /dev/null +++ b/engines/titanic/game/sgt/sgt_navigation.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_SGT_NAVIGATION_H +#define TITANIC_SGT_NAVIGATION_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +struct CSGTNavigationStatics { + bool _changeViewFlag; + CString _destView; + CString _destRoom; +}; + +class CSGTNavigation : public CGameObject { +protected: + static CSGTNavigationStatics *_statics; +public: + CLASSDEF; + 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_SGT_NAVIGATION_H */ diff --git a/engines/titanic/game/sgt/sgt_restaurant_doors.cpp b/engines/titanic/game/sgt/sgt_restaurant_doors.cpp new file mode 100644 index 0000000000..74a71e75b2 --- /dev/null +++ b/engines/titanic/game/sgt/sgt_restaurant_doors.cpp @@ -0,0 +1,39 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/sgt/sgt_restaurant_doors.h" + +namespace Titanic { + +void CSGTRestaurantDoors::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + CGameObject::save(file, indent); +} + +void CSGTRestaurantDoors::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/sgt_restaurant_doors.h b/engines/titanic/game/sgt/sgt_restaurant_doors.h new file mode 100644 index 0000000000..2a10d8f059 --- /dev/null +++ b/engines/titanic/game/sgt/sgt_restaurant_doors.h @@ -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. + * + */ + +#ifndef TITANIC_SGT_RESTAURANT_DOORS_H +#define TITANIC_SGT_RESTAURANT_DOORS_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CSGTRestaurantDoors : public CGameObject { +private: + int _fieldBC; +public: + CLASSDEF; + CSGTRestaurantDoors() : CGameObject(), _fieldBC(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_SGT_RESTAURANT_DOORS_H */ diff --git a/engines/titanic/game/sgt/sgt_state_control.cpp b/engines/titanic/game/sgt/sgt_state_control.cpp new file mode 100644 index 0000000000..07c1f5efc0 --- /dev/null +++ b/engines/titanic/game/sgt/sgt_state_control.cpp @@ -0,0 +1,39 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/sgt/sgt_state_control.h" + +namespace Titanic { + +void CSGTStateControl::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + CBackground::save(file, indent); +} + +void CSGTStateControl::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/sgt_state_control.h b/engines/titanic/game/sgt/sgt_state_control.h new file mode 100644 index 0000000000..49fd5113cd --- /dev/null +++ b/engines/titanic/game/sgt/sgt_state_control.h @@ -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. + * + */ + +#ifndef TITANIC_SGT_STATE_CONTROL_H +#define TITANIC_SGT_STATE_CONTROL_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CSGTStateControl : public CBackground { +private: + int _fieldE0; +public: + CLASSDEF; + CSGTStateControl() : CBackground(), _fieldE0(1) {} + + /** + * 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_SGT_STATE_CONTROL_H */ diff --git a/engines/titanic/game/sgt/sgt_state_room.cpp b/engines/titanic/game/sgt/sgt_state_room.cpp new file mode 100644 index 0000000000..c089e401b8 --- /dev/null +++ b/engines/titanic/game/sgt/sgt_state_room.cpp @@ -0,0 +1,179 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/sgt/sgt_state_room.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CSGTStateRoom, CBackground) + ON_MESSAGE(ActMsg) + ON_MESSAGE(VisibleMsg) + ON_MESSAGE(EnterRoomMsg) + ON_MESSAGE(LeaveRoomMsg) +END_MESSAGE_MAP() + +CSGTStateRoomStatics *CSGTStateRoom::_statics; + +void CSGTStateRoom::init() { + _statics = new CSGTStateRoomStatics(); + _statics->_v1 = "Closed"; +} + +void CSGTStateRoom::deinit() { + delete _statics; +} + +CSGTStateRoom::CSGTStateRoom() : CBackground(), _fieldE0(1), + _fieldE4(1), _fieldE8(0), _fieldEC(1), _fieldF0(1) { +} + +void CSGTStateRoom::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_statics->_v1, indent); + file->writeQuotedLine(_statics->_v2, indent); + file->writeQuotedLine(_statics->_v3, indent); + file->writeQuotedLine(_statics->_v4, indent); + file->writeQuotedLine(_statics->_v5, indent); + file->writeQuotedLine(_statics->_v6, indent); + file->writeQuotedLine(_statics->_v7, indent); + file->writeQuotedLine(_statics->_v8, indent); + file->writeQuotedLine(_statics->_v9, indent); + file->writeQuotedLine(_statics->_v10, indent); + file->writeQuotedLine(_statics->_v11, indent); + file->writeQuotedLine(_statics->_v12, indent); + + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_statics->_v13, indent); + file->writeNumberLine(_statics->_v14, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_fieldF0, indent); + + CBackground::save(file, indent); +} + +void CSGTStateRoom::load(SimpleFile *file) { + file->readNumber(); + _statics->_v1 = file->readString(); + _statics->_v2 = file->readString(); + _statics->_v3 = file->readString(); + _statics->_v4 = file->readString(); + _statics->_v5 = file->readString(); + _statics->_v6 = file->readString(); + _statics->_v7 = file->readString(); + _statics->_v8 = file->readString(); + _statics->_v9 = file->readString(); + _statics->_v10 = file->readString(); + _statics->_v11 = file->readString(); + _statics->_v12 = file->readString(); + + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _statics->_v13 = file->readNumber(); + _statics->_v14 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + _fieldF0 = file->readNumber(); + + CBackground::load(file); +} + +bool CSGTStateRoom::ActMsg(CActMsg *msg) { + CPetControl *pet = getPetControl(); + uint roomFlags = pet->getRoomFlags(); + uint assignedRoom = pet->getAssignedRoomFlags(); + + if (roomFlags != assignedRoom) { + petDisplayMessage("This is not your assigned room. Please do not enjoy."); + } else if (_fieldE0) { + CTurnOn onMsg; + onMsg.execute(this); + } else { + CTurnOff offMsg; + offMsg.execute(this); + } + + return true; +} + +bool CSGTStateRoom::VisibleMsg(CVisibleMsg *msg) { + setVisible(msg->_visible); + return true; +} + +bool CSGTStateRoom::EnterRoomMsg(CEnterRoomMsg *msg) { + CPetControl *pet = getPetControl(); + uint roomFlags = pet->getRoomFlags(); + uint assignedRoom = pet->getAssignedRoomFlags(); + + if (roomFlags == assignedRoom) { + loadFrame(_fieldE8); + _fieldE0 = _fieldEC; + setVisible(_fieldF0); + + if (isEquals("Desk") && _statics->_v5 == "Closed") + loadFrame(1); + } + + if (isEquals("Drawer")) { + petSetArea(PET_REMOTE); + if (roomFlags == assignedRoom && getPassengerClass() == 3 + && _statics->_v13) { + playSound("b#21.wav"); + _statics->_v13 = 0; + } + + _statics->_v7 = "Closed"; + setVisible(false); + _fieldE0 = true; + } else if (roomFlags != assignedRoom) { + loadFrame(0); + if (_fieldE4) { + setVisible(true); + if (isEquals("Desk")) + loadFrame(1); + } else { + setVisible(false); + } + } + + return true; +} + +bool CSGTStateRoom::LeaveRoomMsg(CLeaveRoomMsg *msg) { + CPetControl *pet = getPetControl(); + uint roomFlags = pet->getRoomFlags(); + uint assignedRoom = pet->getAssignedRoomFlags(); + + if (roomFlags == assignedRoom) { + _fieldE8 = getMovieFrame(); + _fieldEC = _fieldE0; + _fieldF0 = _visible; + } + + _statics->_v14 = roomFlags; + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/sgt_state_room.h b/engines/titanic/game/sgt/sgt_state_room.h new file mode 100644 index 0000000000..3975f7b59b --- /dev/null +++ b/engines/titanic/game/sgt/sgt_state_room.h @@ -0,0 +1,81 @@ +/* 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_SGT_STATE_ROOM_H +#define TITANIC_SGT_STATE_ROOM_H + +#include "titanic/core/background.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +struct CSGTStateRoomStatics { + CString _v1; + CString _v2; + CString _v3; + CString _v4; + CString _v5; + CString _v6; + CString _v7; + CString _v8; + CString _v9; + CString _v10; + CString _v11; + CString _v12; + int _v13; + int _v14; +}; + +class CSGTStateRoom : public CBackground { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool VisibleMsg(CVisibleMsg *msg); + bool EnterRoomMsg(CEnterRoomMsg *msg); + bool LeaveRoomMsg(CLeaveRoomMsg *msg); +protected: + static CSGTStateRoomStatics *_statics; +protected: + bool _fieldE0; + int _fieldE4; + int _fieldE8; + bool _fieldEC; + bool _fieldF0; +public: + CLASSDEF; + CSGTStateRoom(); + 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_SGT_STATE_ROOM_H */ diff --git a/engines/titanic/game/sgt/sgt_tv.cpp b/engines/titanic/game/sgt/sgt_tv.cpp new file mode 100644 index 0000000000..ae4c59e2f9 --- /dev/null +++ b/engines/titanic/game/sgt/sgt_tv.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/game/sgt/sgt_tv.h" + +namespace Titanic { + +void CSGTTV::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void CSGTTV::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/sgt_tv.h b/engines/titanic/game/sgt/sgt_tv.h new file mode 100644 index 0000000000..90fed90efe --- /dev/null +++ b/engines/titanic/game/sgt/sgt_tv.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_SGT_TV_H +#define TITANIC_SGT_TV_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class CSGTTV : public CSGTStateRoom { +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_SGT_TV_H */ diff --git a/engines/titanic/game/sgt/sgt_upper_doors_sound.cpp b/engines/titanic/game/sgt/sgt_upper_doors_sound.cpp new file mode 100644 index 0000000000..72cd7f9037 --- /dev/null +++ b/engines/titanic/game/sgt/sgt_upper_doors_sound.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/game/sgt/sgt_upper_doors_sound.h" + +namespace Titanic { + +CSGTUpperDoorsSound::CSGTUpperDoorsSound() { + _soundName = "b#53.wav"; +} + +void CSGTUpperDoorsSound::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_soundName, indent); + + CClickResponder::save(file, indent); +} + +void CSGTUpperDoorsSound::load(SimpleFile *file) { + file->readNumber(); + _soundName = file->readString(); + + CClickResponder::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/sgt_upper_doors_sound.h b/engines/titanic/game/sgt/sgt_upper_doors_sound.h new file mode 100644 index 0000000000..fc8c6c2bf1 --- /dev/null +++ b/engines/titanic/game/sgt/sgt_upper_doors_sound.h @@ -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. + * + */ + +#ifndef TITANIC_SGT_UPPER_DOORS_SOUND_H +#define TITANIC_SGT_UPPER_DOORS_SOUND_H + +#include "titanic/core/click_responder.h" + +namespace Titanic { + +class CSGTUpperDoorsSound : public CClickResponder { +public: + CLASSDEF; + CSGTUpperDoorsSound(); + + /** + * 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_SGT_UPPER_DOORS_SOUND_H */ diff --git a/engines/titanic/game/sgt/toilet.cpp b/engines/titanic/game/sgt/toilet.cpp new file mode 100644 index 0000000000..799abd6c76 --- /dev/null +++ b/engines/titanic/game/sgt/toilet.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/game/sgt/toilet.h" + +namespace Titanic { + +void CToilet::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void CToilet::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/toilet.h b/engines/titanic/game/sgt/toilet.h new file mode 100644 index 0000000000..d87531ad7a --- /dev/null +++ b/engines/titanic/game/sgt/toilet.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_TOILET_H +#define TITANIC_TOILET_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class CToilet : public CSGTStateRoom { +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_TOILET_H */ diff --git a/engines/titanic/game/sgt/vase.cpp b/engines/titanic/game/sgt/vase.cpp new file mode 100644 index 0000000000..3e04b5db9e --- /dev/null +++ b/engines/titanic/game/sgt/vase.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/game/sgt/vase.h" + +namespace Titanic { + +void CVase::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void CVase::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/vase.h b/engines/titanic/game/sgt/vase.h new file mode 100644 index 0000000000..8aa35acdf5 --- /dev/null +++ b/engines/titanic/game/sgt/vase.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_VASE_H +#define TITANIC_VASE_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class CVase : public CSGTStateRoom { +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_VASE_H */ diff --git a/engines/titanic/game/sgt/washstand.cpp b/engines/titanic/game/sgt/washstand.cpp new file mode 100644 index 0000000000..8127a59a59 --- /dev/null +++ b/engines/titanic/game/sgt/washstand.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/game/sgt/washstand.h" + +namespace Titanic { + +void CWashstand::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void CWashstand::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/washstand.h b/engines/titanic/game/sgt/washstand.h new file mode 100644 index 0000000000..f140b17f49 --- /dev/null +++ b/engines/titanic/game/sgt/washstand.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_WASHSTAND_H +#define TITANIC_WASHSTAND_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class CWashstand : public CSGTStateRoom { +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_WASHSTAND_H */ diff --git a/engines/titanic/game/ship_setting.cpp b/engines/titanic/game/ship_setting.cpp new file mode 100644 index 0000000000..462f396501 --- /dev/null +++ b/engines/titanic/game/ship_setting.cpp @@ -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. + * + */ + +#include "titanic/game/ship_setting.h" + +namespace Titanic { + +CShipSetting::CShipSetting() : CBackground(), + _string4("NULL"), _string5("NULL") { +} + +void CShipSetting::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string3, indent); + file->writePoint(_pos1, indent); + file->writeQuotedLine(_string4, indent); + file->writeQuotedLine(_string5, indent); + + CBackground::save(file, indent); +} + +void CShipSetting::load(SimpleFile *file) { + file->readNumber(); + _string3 = file->readString(); + _pos1 = file->readPoint(); + _string4 = file->readString(); + _string5 = file->readString(); + + CBackground::load(file); +} + +bool CShipSetting::EnterRoomMsg(CEnterRoomMsg *msg) { + warning("CShipSetting::handleEvent"); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/ship_setting.h b/engines/titanic/game/ship_setting.h new file mode 100644 index 0000000000..4fcc10a424 --- /dev/null +++ b/engines/titanic/game/ship_setting.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_SHIP_SETTING_H +#define TITANIC_SHIP_SETTING_H + +#include "titanic/core/background.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CShipSetting : public CBackground { + bool EnterRoomMsg(CEnterRoomMsg *msg); +public: + CString _string3; + Point _pos1; + CString _string4; + CString _string5; +public: + CLASSDEF; + CShipSetting(); + + /** + * 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_SHIP_SETTING_H */ diff --git a/engines/titanic/game/ship_setting_button.cpp b/engines/titanic/game/ship_setting_button.cpp new file mode 100644 index 0000000000..7dc2cabac0 --- /dev/null +++ b/engines/titanic/game/ship_setting_button.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/game/ship_setting_button.h" + +namespace Titanic { + +CShipSettingButton::CShipSettingButton() : CGameObject(), _fieldC8(0), _fieldCC(0) { +} + +void CShipSettingButton::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_fieldCC, indent); + + CGameObject::save(file, indent); +} + +void CShipSettingButton::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + _fieldC8 = file->readNumber(); + _fieldCC = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/ship_setting_button.h b/engines/titanic/game/ship_setting_button.h new file mode 100644 index 0000000000..e152e8e2c3 --- /dev/null +++ b/engines/titanic/game/ship_setting_button.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_SHIP_SETTING_BUTTON_H +#define TITANIC_SHIP_SETTING_BUTTON_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CShipSettingButton : public CGameObject { +private: + CString _string1; + int _fieldC8; + int _fieldCC; +public: + CLASSDEF; + CShipSettingButton(); + + /** + * 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_SHIP_SETTING_BUTTON_H */ diff --git a/engines/titanic/game/show_cell_points.cpp b/engines/titanic/game/show_cell_points.cpp new file mode 100644 index 0000000000..7d54401a02 --- /dev/null +++ b/engines/titanic/game/show_cell_points.cpp @@ -0,0 +1,41 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/show_cell_points.h" + +namespace Titanic { + +void CShowCellpoints::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_strValue, indent); + file->writeNumberLine(_numValue, indent); + CGameObject::save(file, indent); +} + +void CShowCellpoints::load(SimpleFile *file) { + file->readNumber(); + _strValue = file->readString(); + _numValue = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/show_cell_points.h b/engines/titanic/game/show_cell_points.h new file mode 100644 index 0000000000..9de2e06dca --- /dev/null +++ b/engines/titanic/game/show_cell_points.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 SHOW_CELL_POINTS_H +#define SHOW_CELL_POINTS_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CShowCellpoints : public CGameObject { +public: + CString _strValue; + int _numValue; +public: + CLASSDEF; + CShowCellpoints() : CGameObject(), _numValue(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 /* SHOW_CELL_POINTS_H */ diff --git a/engines/titanic/game/speech_dispensor.cpp b/engines/titanic/game/speech_dispensor.cpp new file mode 100644 index 0000000000..f9cc019672 --- /dev/null +++ b/engines/titanic/game/speech_dispensor.cpp @@ -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. + * + */ + +#include "titanic/game/speech_dispensor.h" + +namespace Titanic { + +void CSpeechDispensor::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_fieldF0, indent); + file->writeNumberLine(_fieldF4, indent); + file->writeNumberLine(_fieldF8, indent); + file->writeNumberLine(_fieldFC, indent); + + CBackground::save(file, indent); +} + +void CSpeechDispensor::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldEC = file->readNumber(); + _fieldF0 = file->readNumber(); + _fieldF4 = file->readNumber(); + _fieldF8 = file->readNumber(); + _fieldFC = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/speech_dispensor.h b/engines/titanic/game/speech_dispensor.h new file mode 100644 index 0000000000..3b877e8d99 --- /dev/null +++ b/engines/titanic/game/speech_dispensor.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_SPEECH_DISPENSOR_H +#define TITANIC_SPEECH_DISPENSOR_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CSpeechDispensor : public CBackground { +private: + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; + int _fieldF0; + int _fieldF4; + int _fieldF8; + int _fieldFC; +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_SPEECH_DISPENSOR_H */ diff --git a/engines/titanic/game/splash_animation.cpp b/engines/titanic/game/splash_animation.cpp new file mode 100644 index 0000000000..2094ec14fa --- /dev/null +++ b/engines/titanic/game/splash_animation.cpp @@ -0,0 +1,39 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/splash_animation.h" + +namespace Titanic { + +EMPTY_MESSAGE_MAP(CSplashAnimation, CGameObject); + +void CSplashAnimation::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CSplashAnimation::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/splash_animation.h b/engines/titanic/game/splash_animation.h new file mode 100644 index 0000000000..11715b4d73 --- /dev/null +++ b/engines/titanic/game/splash_animation.h @@ -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. + * + */ + +#ifndef TITANIC_SPLASH_ANIMATION_H +#define TITANIC_SPLASH_ANIMATION_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CSplashAnimation : public CGameObject { + DECLARE_MESSAGE_MAP; +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_SPLASH_ANIMATION_H */ diff --git a/engines/titanic/game/starling_puret.cpp b/engines/titanic/game/starling_puret.cpp new file mode 100644 index 0000000000..359ad774df --- /dev/null +++ b/engines/titanic/game/starling_puret.cpp @@ -0,0 +1,39 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/starling_puret.h" + +namespace Titanic { + +void CStarlingPuret::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CStarlingPuret::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/starling_puret.h b/engines/titanic/game/starling_puret.h new file mode 100644 index 0000000000..fcd3319958 --- /dev/null +++ b/engines/titanic/game/starling_puret.h @@ -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. + * + */ + +#ifndef TITANIC_STARLING_PURET_H +#define TITANIC_STARLING_PURET_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CStarlingPuret : public CGameObject { +private: + int _value; +public: + CLASSDEF; + CStarlingPuret() : CGameObject(), _value(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_STARLING_PURET_H */ diff --git a/engines/titanic/game/start_action.cpp b/engines/titanic/game/start_action.cpp new file mode 100644 index 0000000000..ab356ea1f4 --- /dev/null +++ b/engines/titanic/game/start_action.cpp @@ -0,0 +1,64 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/start_action.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CStartAction, CBackground) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MouseButtonUpMsg) +END_MESSAGE_MAP() + +CStartAction::CStartAction() : CBackground() { +} + +void CStartAction::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_msgTarget, indent); + file->writeQuotedLine(_msgAction, indent); + + CBackground::save(file, indent); +} + +void CStartAction::load(SimpleFile *file) { + file->readNumber(); + _msgTarget = file->readString(); + _msgAction = file->readString(); + + CBackground::load(file); +} + +bool CStartAction::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + // Dispatch the desired action to the desired target + CActMsg actMsg(_msgAction); + actMsg.execute(_msgTarget); + + return true; +} + +bool CStartAction::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/start_action.h b/engines/titanic/game/start_action.h new file mode 100644 index 0000000000..60381bad2f --- /dev/null +++ b/engines/titanic/game/start_action.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_START_ACTION_H +#define TITANIC_START_ACTION_H + +#include "titanic/core/background.h" +#include "titanic/messages/mouse_messages.h" + +namespace Titanic { + +class CStartAction : public CBackground { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); +protected: + CString _msgTarget; + CString _msgAction; +public: + CLASSDEF; + CStartAction(); + + /** + * 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_START_ACTION_H */ diff --git a/engines/titanic/game/stop_phonograph_button.cpp b/engines/titanic/game/stop_phonograph_button.cpp new file mode 100644 index 0000000000..d18f4713ac --- /dev/null +++ b/engines/titanic/game/stop_phonograph_button.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/game/stop_phonograph_button.h" + +namespace Titanic { + +void CStopPhonographButton::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CBackground::save(file, indent); +} + +void CStopPhonographButton::load(SimpleFile *file) { + file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/stop_phonograph_button.h b/engines/titanic/game/stop_phonograph_button.h new file mode 100644 index 0000000000..b469375e20 --- /dev/null +++ b/engines/titanic/game/stop_phonograph_button.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_STOP_PHONOGRAPH_BUTTON_H +#define TITANIC_STOP_PHONOGRAPH_BUTTON_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CStopPhonographButton : public CBackground { +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_STOP_PHONOGRAPH_BUTTON_H */ diff --git a/engines/titanic/game/sub_glass.cpp b/engines/titanic/game/sub_glass.cpp new file mode 100644 index 0000000000..f1349f06ea --- /dev/null +++ b/engines/titanic/game/sub_glass.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/game/sub_glass.h" + +namespace Titanic { + +CSUBGlass::CSUBGlass() : _fieldBC(0), _fieldC0(0), _fieldC4(1), _fieldC8(0) { +} + +void CSUBGlass::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_fieldCC, indent); + file->writeQuotedLine(_string, indent); + + CGameObject::save(file, indent); +} + +void CSUBGlass::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + _fieldC8 = file->readNumber(); + _fieldCC = file->readNumber(); + _string = file->readString(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sub_glass.h b/engines/titanic/game/sub_glass.h new file mode 100644 index 0000000000..aab5c8400e --- /dev/null +++ b/engines/titanic/game/sub_glass.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_SUB_GLASS_H +#define TITANIC_SUB_GLASS_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CSUBGlass : public CGameObject { +private: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; + int _fieldCC; + CString _string; +public: + CLASSDEF; + CSUBGlass(); + + /** + * 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_ROOM_ITEM_H */ diff --git a/engines/titanic/game/sub_wrapper.cpp b/engines/titanic/game/sub_wrapper.cpp new file mode 100644 index 0000000000..dcc489316b --- /dev/null +++ b/engines/titanic/game/sub_wrapper.cpp @@ -0,0 +1,39 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/sub_wrapper.h" + +namespace Titanic { + +void CSUBWrapper::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CSUBWrapper::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sub_wrapper.h b/engines/titanic/game/sub_wrapper.h new file mode 100644 index 0000000000..81f8fdc941 --- /dev/null +++ b/engines/titanic/game/sub_wrapper.h @@ -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. + * + */ + +#ifndef TITANIC_SUB_WRAPPER_H +#define TITANIC_SUB_WRAPPER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CSUBWrapper : public CGameObject { +public: + int _value; +public: + CLASSDEF; + CSUBWrapper() : CGameObject(), _value(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_SUB_WRAPPER_H */ diff --git a/engines/titanic/game/sweet_bowl.cpp b/engines/titanic/game/sweet_bowl.cpp new file mode 100644 index 0000000000..e14f900e77 --- /dev/null +++ b/engines/titanic/game/sweet_bowl.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/game/sweet_bowl.h" + +namespace Titanic { + +void CSweetBowl::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CSweetBowl::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sweet_bowl.h b/engines/titanic/game/sweet_bowl.h new file mode 100644 index 0000000000..cf3d0023a4 --- /dev/null +++ b/engines/titanic/game/sweet_bowl.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_SWEET_BOWL_H +#define TITANIC_SWEET_BOWL_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CSweetBowl : public CGameObject { +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_CREDITS_H */ diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp new file mode 100644 index 0000000000..ba30fbe281 --- /dev/null +++ b/engines/titanic/game/television.cpp @@ -0,0 +1,298 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/television.h" +#include "titanic/game/get_lift_eye2.h" +#include "titanic/core/project_item.h" +#include "titanic/carry/magazine.h" +#include "titanic/pet_control/pet_control.h" +#include "titanic/titanic.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CTelevision, CGameObject) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(ChangeSeasonMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(PETUpMsg) + ON_MESSAGE(PETDownMsg) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(PETActivateMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(ShipSettingMsg) + ON_MESSAGE(TurnOff) + ON_MESSAGE(TurnOn) + ON_MESSAGE(LightsMsg) +END_MESSAGE_MAP() + +int CTelevision::_v1; +bool CTelevision::_turnOn; +int CTelevision::_v3; +int CTelevision::_v4; +int CTelevision::_v5; +int CTelevision::_v6; + +CTelevision::CTelevision() : CBackground(), _fieldE0(1), + _fieldE4(7), _isOn(false), _fieldEC(0), _soundHandle(0) { +} + +void CTelevision::init() { + _v1 = 531; + _turnOn = true; + _v3 = 0; + _v4 = 27; + _v5 = 1; + _v6 = 1; +} + +void CTelevision::deinit() { +} + +void CTelevision::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_turnOn, indent); + file->writeNumberLine(_isOn, indent); + file->writeNumberLine(_v3, indent); + file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_v4, indent); + file->writeNumberLine(_soundHandle, indent); + file->writeNumberLine(_v5, indent); + file->writeNumberLine(_v6, indent); + + CBackground::save(file, indent); +} + +void CTelevision::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _v1 = file->readNumber(); + _fieldE4 = file->readNumber(); + _turnOn = file->readNumber() != 0; + _isOn = file->readNumber() != 0; + _v3 = file->readNumber(); + _fieldEC = file->readNumber(); + _v4 = file->readNumber(); + _soundHandle = file->readNumber(); + _v5 = file->readNumber(); + _v6 = file->readNumber(); + + CBackground::load(file); +} + +bool CTelevision::LeaveViewMsg(CLeaveViewMsg *msg) { + petClear(); + if (_isOn) { + if (isSoundActive(_soundHandle)) + stopSound(_soundHandle, 0); + + loadFrame(622); + stopMovie(); + setVisible(0); + _isOn = false; + + if (compareRoomNameTo("CSGState")) { + CVisibleMsg visibleMsg(true); + visibleMsg.execute("Tellypic"); + } + } + + return true; +} + +bool CTelevision::ChangeSeasonMsg(CChangeSeasonMsg *msg) { + if (msg->_season == "Autumn") { + _v1 = 545; + _v3 = 0; + } else if (msg->_season == "Winter") { + _v1 = 503; + _v3 = 0; + } else if (msg->_season == "Spring") { + _v1 = 517; + _v3 = 0; + } else if (msg->_season == "Summer") { + _v1 = 531; + _v3 = 0; + } + + return true; +} + +bool CTelevision::EnterViewMsg(CEnterViewMsg *msg) { + petSetArea(PET_REMOTE); + petHighlightGlyph(GLYPH_TELEVISION_CONTROL); + petSetRemoteTarget(); + setVisible(0); + _fieldE0 = 1; + + return true; +} + +static const int START_FRAMES[9] = { 0, 0, 56, 112, 168, 224, 280, 336, 392 }; +static const int END_FRAMES[8] = { 0, 55, 111, 167, 223, 279, 335, 391 }; + +bool CTelevision::PETUpMsg(CPETUpMsg *msg) { + if (msg->_name == "Television" && _isOn) { + if (isSoundActive(_soundHandle)) + stopSound(_soundHandle, 0); + + _fieldE0 = _fieldE0 % _fieldE4 + 1; + stopMovie(); + playMovie(START_FRAMES[_fieldE0], END_FRAMES[_fieldE0], 4); + } + + return true; +} + +bool CTelevision::PETDownMsg(CPETDownMsg *msg) { + if (msg->_name == "Television" && _isOn) { + if (isSoundActive(_soundHandle)) + stopSound(_soundHandle, 0); + if (--_fieldE0 < 1) + _fieldE0 += _fieldE4; + + _fieldE0 = _fieldE0 % _fieldE4 + 1; + stopMovie(); + playMovie(START_FRAMES[_fieldE0], END_FRAMES[_fieldE0], 4); + } + + return true; +} + +bool CTelevision::StatusChangeMsg(CStatusChangeMsg *msg) { + if (_isOn) { + stopMovie(); + playMovie(0); + } + + return true; +} + +bool CTelevision::ActMsg(CActMsg *msg) { + if (msg->_action == "TurnTVOnOff") { + _isOn = !_isOn; + if (_isOn) { + setVisible(true); + CStatusChangeMsg changeMsg; + changeMsg.execute(this); + } else { + setVisible(_isOn); + stopMovie(); + } + } + + return true; +} + +bool CTelevision::PETActivateMsg(CPETActivateMsg *msg) { + if (msg->_name == "Television") { + CVisibleMsg visibleMsg(_isOn); + _isOn = !_isOn; + + if (_isOn) { + setVisible(true); + playMovie(0, 55, 0); + _fieldE0 = 1; + } else { + stopMovie(); + if (isSoundActive(_soundHandle)) + stopSound(_soundHandle, 0); + + setVisible(false); + } + + if (compareRoomNameTo("SGTState")) + visibleMsg.execute("Tellypic"); + } + + return true; +} + +bool CTelevision::MovieEndMsg(CMovieEndMsg *msg) { + if (getRandomNumber(6) == 0) { + CParrotSpeakMsg parrotMsg("Television", ""); + parrotMsg.execute("PerchedParrot"); + } + + if (_fieldE0 == 3 && compareRoomNameTo("SGTState") && !getPassengerClass()) { + playSound("z#47.wav", 100, 0, 0); + _soundHandle = playSound("b#20.wav", 100, 0, 0); + CMagazine *magazine = dynamic_cast<CMagazine *>(getRoot()->findByName("Magazine")); + + if (magazine) { + CPetControl *pet = getPetControl(); + uint roomFlags = pet->getRoomFlags(); + + debugC(kDebugScripts, "Assigned room - %d", roomFlags); + magazine->addMail(roomFlags); + magazine->removeMail(roomFlags, roomFlags); + } + + loadFrame(561); + } else if (_fieldE0 == 2) { + loadFrame(_v1); + } else if (_fieldE0 == 4 && _v5) { + if (_turnOn) + loadFrame(502); + else + warning("There is currently nothing available for your viewing pleasure on this channel."); + } else if (_fieldE0 == 5 && *CGetLiftEye2::_destObject != "NULL") { + loadFrame(393 + _v4); + } else { + warning("There is currently nothing available for your viewing pleasure on this channel."); + } + + return true; +} + +bool CTelevision::ShipSettingMsg(CShipSettingMsg *msg) { + _v4 = msg->_value; + return true; +} + +bool CTelevision::TurnOff(CTurnOff *msg) { + _turnOn = false; + return true; +} + +bool CTelevision::TurnOn(CTurnOn *msg) { + _turnOn = true; + return true; +} + +bool CTelevision::LightsMsg(CLightsMsg *msg) { + CPetControl *pet = getPetControl(); + bool flag = false; + + if (pet) + flag = pet->isRoom59706(); + + if (msg->_flag2 || !flag) + _turnOn = true; + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/television.h b/engines/titanic/game/television.h new file mode 100644 index 0000000000..2e8d469bde --- /dev/null +++ b/engines/titanic/game/television.h @@ -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. + * + */ + +#ifndef TITANIC_TELEVISION_H +#define TITANIC_TELEVISION_H + +#include "titanic/core/background.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/pet_messages.h" + +namespace Titanic { + +class CTelevision : public CBackground { + DECLARE_MESSAGE_MAP; + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool ChangeSeasonMsg(CChangeSeasonMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool PETUpMsg(CPETUpMsg *msg); + bool PETDownMsg(CPETDownMsg *msg); + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool ActMsg(CActMsg *msg); + bool PETActivateMsg(CPETActivateMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool ShipSettingMsg(CShipSettingMsg *msg); + bool TurnOff(CTurnOff *msg); + bool TurnOn(CTurnOn *msg); + bool LightsMsg(CLightsMsg *msg); +private: + int _fieldE0; + int _fieldE4; + bool _isOn; + int _fieldEC; + int _soundHandle; +public: + static int _v1; + static bool _turnOn; + static int _v3; + static int _v4; + static int _v5; + static int _v6; +public: + CLASSDEF; + CTelevision(); + 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_TELEVISION_H */ diff --git a/engines/titanic/game/third_class_canal.cpp b/engines/titanic/game/third_class_canal.cpp new file mode 100644 index 0000000000..6b0a101f7b --- /dev/null +++ b/engines/titanic/game/third_class_canal.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/game/third_class_canal.h" + +namespace Titanic { + +void CThirdClassCanal::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CBackground::save(file, indent); +} + +void CThirdClassCanal::load(SimpleFile *file) { + file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/third_class_canal.h b/engines/titanic/game/third_class_canal.h new file mode 100644 index 0000000000..f6fc471444 --- /dev/null +++ b/engines/titanic/game/third_class_canal.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_THIRD_CLASS_CANAL_H +#define TITANIC_THIRD_CLASS_CANAL_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CThirdClassCanal : public CBackground { +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_THIRD_CLASS_CANAL_H */ diff --git a/engines/titanic/game/throw_tv_down_well.cpp b/engines/titanic/game/throw_tv_down_well.cpp new file mode 100644 index 0000000000..c8a9fc7c9e --- /dev/null +++ b/engines/titanic/game/throw_tv_down_well.cpp @@ -0,0 +1,41 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/throw_tv_down_well.h" + +namespace Titanic { + +void CThrowTVDownWell::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_strValue, indent); + file->writeNumberLine(_numValue, indent); + CGameObject::save(file, indent); +} + +void CThrowTVDownWell::load(SimpleFile *file) { + file->readNumber(); + _strValue = file->readString(); + _numValue = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/throw_tv_down_well.h b/engines/titanic/game/throw_tv_down_well.h new file mode 100644 index 0000000000..b6003aa3ef --- /dev/null +++ b/engines/titanic/game/throw_tv_down_well.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_THROW_TV_DOWN_WELL_H +#define TITANIC_THROW_TV_DOWN_WELL_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CThrowTVDownWell : public CGameObject { +public: + CString _strValue; + int _numValue; +public: + CLASSDEF; + CThrowTVDownWell() : CGameObject(), _numValue(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_THROW_TV_DOWN_WELL_H */ diff --git a/engines/titanic/game/titania_still_control.cpp b/engines/titanic/game/titania_still_control.cpp new file mode 100644 index 0000000000..67866ecdcb --- /dev/null +++ b/engines/titanic/game/titania_still_control.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/game/titania_still_control.h" + +namespace Titanic { + +void CTitaniaStillControl::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CTitaniaStillControl::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/titania_still_control.h b/engines/titanic/game/titania_still_control.h new file mode 100644 index 0000000000..66c3045187 --- /dev/null +++ b/engines/titanic/game/titania_still_control.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_TITANIA_STILL_CONTROL_H +#define TITANIC_TITANIA_STILL_CONTROL_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CTitaniaStillControl : public CGameObject { +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_TITANIA_STILL_CONTROL_H */ diff --git a/engines/titanic/game/tow_parrot_nav.cpp b/engines/titanic/game/tow_parrot_nav.cpp new file mode 100644 index 0000000000..9361808870 --- /dev/null +++ b/engines/titanic/game/tow_parrot_nav.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/game/tow_parrot_nav.h" + +namespace Titanic { + +void CTOWParrotNav::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CTOWParrotNav::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/tow_parrot_nav.h b/engines/titanic/game/tow_parrot_nav.h new file mode 100644 index 0000000000..17618ff6de --- /dev/null +++ b/engines/titanic/game/tow_parrot_nav.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_TOW_PARROT_NAV_H +#define TITANIC_TOW_PARROT_NAV_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CTOWParrotNav : public CGameObject { +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_TOW_PARROT_NAV_H */ diff --git a/engines/titanic/game/transport/exit_pellerator.cpp b/engines/titanic/game/transport/exit_pellerator.cpp new file mode 100644 index 0000000000..400214a140 --- /dev/null +++ b/engines/titanic/game/transport/exit_pellerator.cpp @@ -0,0 +1,46 @@ +/* ScummVM - Graphic Adventure Engine +* +* ScummVM is the legal property of its developers, whose names +* are too numerous to list here. Please refer to the COPYRIGHT +* file distributed with this source distribution. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +* +*/ + +#include "titanic/game/transport/pellerator.h" + +namespace Titanic { + +int CPellerator::_v1; +int CPellerator::_v2; + +void CPellerator::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_v2, indent); + + CTransport::save(file, indent); +} + +void CPellerator::load(SimpleFile *file) { + file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); + + CTransport::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/transport/exit_pellerator.h b/engines/titanic/game/transport/exit_pellerator.h new file mode 100644 index 0000000000..53056c7417 --- /dev/null +++ b/engines/titanic/game/transport/exit_pellerator.h @@ -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. +* +*/ + +#ifndef TITANIC_PELLERATOR_H +#define TITANIC_PELLERATOR_H + +#include "titanic/game/transport/transport.h" + +namespace Titanic { + +class CPellerator : public CTransport { +private: + static int _v1; + static int _v2; +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_PELLERATOR_H */ diff --git a/engines/titanic/game/transport/gondolier.cpp b/engines/titanic/game/transport/gondolier.cpp new file mode 100644 index 0000000000..8c28ff9b66 --- /dev/null +++ b/engines/titanic/game/transport/gondolier.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/game/transport/gondolier.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CGondolier, CTransport) + ON_MESSAGE(StatusChangeMsg) +END_MESSAGE_MAP() + +int CGondolier::_v1; +int CGondolier::_v2; + +void CGondolier::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_v2, indent); + CTransport::save(file, indent); +} + +void CGondolier::load(SimpleFile *file) { + file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); + CTransport::load(file); +} + +bool CGondolier::StatusChangeMsg(CStatusChangeMsg *msg) { + CShowTextMsg textMsg("Only First Class passengers are allowed to use the Gondoliers."); + textMsg.execute("PET"); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/transport/gondolier.h b/engines/titanic/game/transport/gondolier.h new file mode 100644 index 0000000000..3b1e6d5a8a --- /dev/null +++ b/engines/titanic/game/transport/gondolier.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_GONDOLIER_H +#define TITANIC_GONDOLIER_H + +#include "titanic/game/transport/transport.h" + +namespace Titanic { + +class CGondolier : public CTransport { + DECLARE_MESSAGE_MAP; + bool StatusChangeMsg(CStatusChangeMsg *msg); +private: + static int _v1; + static int _v2; +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_GONDOLIER_H */ diff --git a/engines/titanic/game/transport/lift.cpp b/engines/titanic/game/transport/lift.cpp new file mode 100644 index 0000000000..114e840007 --- /dev/null +++ b/engines/titanic/game/transport/lift.cpp @@ -0,0 +1,318 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/transport/lift.h" +#include "titanic/pet_control/pet_control.h" +#include "titanic/titanic.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CLift, CTransport) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(EnterRoomMsg) + ON_MESSAGE(LeaveRoomMsg) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + +int CLift::_v1; +int CLift::_elevator1Floor; +int CLift::_elevator2Floor; +int CLift::_elevator3Floor; +int CLift::_elevator4Floor; +int CLift::_v6; + +void CLift::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_elevator1Floor, indent); + file->writeNumberLine(_elevator2Floor, indent); + file->writeNumberLine(_elevator3Floor, indent); + file->writeNumberLine(_elevator4Floor, indent); + file->writeNumberLine(_liftNum, indent); + file->writeNumberLine(_v6, indent); + + CTransport::save(file, indent); +} + +void CLift::load(SimpleFile *file) { + file->readNumber(); + _v1 = file->readNumber(); + _elevator1Floor = file->readNumber(); + _elevator2Floor = file->readNumber(); + _elevator3Floor = file->readNumber(); + _elevator4Floor = file->readNumber(); + _liftNum = file->readNumber(); + _v6 = file->readNumber(); + + CTransport::load(file); +} + +bool CLift::StatusChangeMsg(CStatusChangeMsg *msg) { + CPetControl *pet = getPetControl(); + if ((!_v1 && pet->getRoomsElevatorNum() == 4) || + (!_v6 && pet->getRoomsElevatorNum() == 4)) + return true; + + int oldFloorNum = msg->_oldStatus; + int floorNum = msg->_newStatus; + int oldClass = 0, newClass = 0; + if (oldFloorNum == 19) + oldClass = 2; + if (oldFloorNum == 27) + oldClass = 3; + if (floorNum == 19) + newClass = 2; + if (floorNum == 27) + newClass = 3; + + static const int UP_FRAME_NUMBERS[40] = { + 0, 8, 13, 18, 23, 28, 33, 38, 43, 48, 53, 58, + 63, 68, 73, 78, 83, 88, 93, 118, 123, 128, 133, + 138, 143, 148, 153, 228, 233, 238, 243, 248, 253, + 258, 263, 268, 273, 278, 298, 299 + }; + static const int DOWN_FRAME_NUMBERS[39] = { + 598, 589, 584, 579, 574, 569, 564, 559, 554, 549, + 544, 539, 534, 529, 524, 519, 514, 509, 504, 479, + 474, 469, 464, 459, 454, 449, 444, 369, 364, 359, + 354, 349, 344, 339, 334, 329, 324, 319 + }; + + if (pet) + pet->setRoomsFloorNum(floorNum); + if (pet->getRoomsElevatorNum() == 2 || pet->getRoomsElevatorNum() == 4) { + if (floorNum > 27) + floorNum = 27; + if (oldFloorNum > 27) + oldFloorNum = 27; + } + + changeView("Lift.Node 1.N"); + CTurnOn onMsg; + onMsg.execute("LiftHood"); + + CString debugStr; + if (floorNum > oldFloorNum) { + // Animate lift going up + _startFrame = UP_FRAME_NUMBERS[oldFloorNum - 1]; + _endFrame = UP_FRAME_NUMBERS[floorNum - 1]; + + if (oldClass == newClass) { + debugStr = CString::format("Same (%d-%d)", _startFrame, _endFrame); + playMovie(_startFrame, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + } else if (oldClass == 1 && newClass == 2) { + debugStr = CString::format("1 to 2 (%d-108, 108-%d)", _startFrame, _endFrame); + playMovie(_startFrame, 108, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(108, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + } else if (oldClass == 1 && newClass == 3) { + debugStr = CString::format("1 to 3 (%d-108, 108-190, 190-%d)", _startFrame, _endFrame); + playMovie(_startFrame, 108, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(108, 190, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(190, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + } else { + debugStr = CString::format("2 to 3 (%d-190, 190-%d)", _startFrame, _endFrame); + playMovie(_startFrame, 190, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(190, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + } + } + + if (floorNum < oldFloorNum) { + // Animate lift going down + _startFrame = DOWN_FRAME_NUMBERS[floorNum - 1]; + _endFrame = DOWN_FRAME_NUMBERS[oldFloorNum - 1]; + + if (oldClass == newClass) { + debugStr = CString::format("Same (%d-%d)", _startFrame, _endFrame); + playMovie(_startFrame, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + } else if (oldClass == 3 && newClass == 2) { + debugStr = CString::format("3 to 2 (%d-407, 407-%d)", _startFrame, _endFrame); + playMovie(_startFrame, 407, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(407, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + } else if (oldClass == 3 && newClass == 1) { + debugStr = CString::format("3 to 1 (%d-407, 407-489, 489-%d)", _startFrame, _endFrame); + playMovie(_startFrame, 407, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(407, 489, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(489, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + } else { + debugStr = CString::format("2 to 1 (%d-489, 489-%d)", _startFrame, _endFrame); + playMovie(_startFrame, 489, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(489, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + } + } + + CShipSettingMsg settingMsg; + switch (pet->getRoomsElevatorNum()) { + case 1: + _elevator1Floor = floorNum; + break; + case 2: + _elevator2Floor = floorNum; + _elevator4Floor = oldFloorNum; + settingMsg._value = oldFloorNum; + settingMsg.execute("SGTStateroomTV"); + break; + case 3: + _elevator3Floor = floorNum; + break; + case 4: + _elevator4Floor = floorNum; + break; + default: + break; + } + + debugC(1, kDebugScripts, "%s", debugStr.c_str()); + return true; +} + +bool CLift::MovieEndMsg(CMovieEndMsg *msg) { + switch (msg->_endFrame) { + case 108: + setGlobalSoundVolume(-4, 1, 2); + setGlobalSoundVolume(-2, 1, 1); + break; + + case 190: + setGlobalSoundVolume(-4, 1, 1); + setGlobalSoundVolume(-2, 1, 2); + break; + + case 407: + setGlobalSoundVolume(-4, 1, 0); + setGlobalSoundVolume(-2, 1, 1); + break; + + case 489: + setGlobalSoundVolume(-4, 1, 1); + setGlobalSoundVolume(-2, 1, 0); + break; + + default: { + CActMsg actMsg("LiftArrive"); + actMsg.execute("Liftbot"); + sleep(500); + playSound("352 gp button 1.wav"); + + CTurnOff offMsg; + offMsg.execute("LiftHood"); + changeView("Lift.Node 1.W"); + break; + } + } + + return true; +} + +bool CLift::EnterViewMsg(CEnterViewMsg *msg) { + static const int FRAME_NUMBERS[40] = { + 0, 8, 13, 18, 23, 28, 33, 38, 43, 48, 53, 58, 63, 68, 73, + 78, 83, 88, 93, 118, 123, 128, 133, 138, 143, 148, 153, + 228, 233, 238, 243, 248, 253, 258, 263, 268, 273, 278, 298 + }; + + CPetControl *pet = getPetControl(); + loadFrame(FRAME_NUMBERS[pet->getRoomsFloorNum() - 1]); + return true; +} + +bool CLift::EnterRoomMsg(CEnterRoomMsg *msg) { + if (isEquals("Well")) { + CPetControl *pet = getPetControl(); + int floorNum = pet->getRoomsFloorNum(); + int elevNum = pet->getRoomsElevatorNum(); + loadSound("z#520.wav"); + loadSound("z#519.wav"); + loadSound("z#518.wav"); + + if (elevNum == 4 && _v1 == 1 && !_v6) { + CVisibleMsg visibleMsg; + visibleMsg.execute("GetLiftEye"); + } + + if (floorNum < 20) { + playGlobalSound("z#520.wav", -2, true, true, 0); + playGlobalSound("z#519.wav", -4, false, true, 1); + playGlobalSound("z#518.wav", -4, false, true, 2); + } else if (floorNum < 28) { + playGlobalSound("z#520.wav", -4, false, true, 0); + playGlobalSound("z#519.wav", -2, true, true, 1); + playGlobalSound("z#518.wav", -4, false, true, 2); + } else { + playGlobalSound("z#520.wav", -4, false, true, 0); + playGlobalSound("z#519.wav", -4, false, true, 1); + playGlobalSound("z#518.wav", -2, true, true, 2); + } + } + + return true; +} + +bool CLift::LeaveRoomMsg(CLeaveRoomMsg *msg) { + stopGlobalSound(true, -1); + + CPetControl *pet = getPetControl(); + if (pet->getRoomsElevatorNum() == 4 && _v1 == 1 && !_v6) { + CVisibleMsg visibleMsg; + visibleMsg.execute("Eye2"); + } + + return true; +} + +bool CLift::ActMsg(CActMsg *msg) { + if (msg->_action == "LoseHead") { + _v1 = 0; + _v6 = 0; + + CActMsg actMsg1("Lift.Node 2.N"); + actMsg1.execute("RPanInLiftW"); + CActMsg actMsg2("Lift.Node 2.S"); + actMsg2.execute("LPanInLiftW"); + } else if (msg->_action == "AddWrongHead") { + _v1 = 1; + _v6 = 0; + + CActMsg actMsg1("Lift.Node 1.N"); + actMsg1.execute("RPanInLiftW"); + CActMsg actMsg2("Lift.Node 1.S"); + actMsg2.execute("LPanInLiftW"); + } else if (msg->_action == "AddRightHead") { + _v1 = 1; + _v6 = 1; + petSetRooms1D4(0); + + CActMsg actMsg1("Lift.Node 1.N"); + actMsg1.execute("RPanInLiftW"); + CActMsg actMsg2("Lift.Node 1.S"); + actMsg2.execute("LPanInLiftW"); + CActMsg actMsg3("ActivateLift"); + actMsg3.execute("Liftbot"); + } + + CVisibleMsg visibleMsg; + visibleMsg.execute("LiftbotWithoutHead"); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/transport/lift.h b/engines/titanic/game/transport/lift.h new file mode 100644 index 0000000000..c45d2b64d0 --- /dev/null +++ b/engines/titanic/game/transport/lift.h @@ -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. +* +*/ + +#ifndef TITANIC_LIFT_H +#define TITANIC_LIFT_H + +#include "titanic/game/transport/transport.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CLift : public CTransport { + DECLARE_MESSAGE_MAP; + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool EnterRoomMsg(CEnterRoomMsg *msg); + bool LeaveRoomMsg(CLeaveRoomMsg *msg); + bool ActMsg(CActMsg *msg); +public: + static int _v1; + static int _elevator1Floor; + static int _elevator2Floor; + static int _elevator3Floor; + static int _elevator4Floor; + static int _v6; + + int _liftNum; +public: + CLASSDEF; + CLift() : CTransport(), _liftNum(1) {} + + /** + * 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_LIFT_H */ diff --git a/engines/titanic/game/transport/lift_indicator.cpp b/engines/titanic/game/transport/lift_indicator.cpp new file mode 100644 index 0000000000..7471affc36 --- /dev/null +++ b/engines/titanic/game/transport/lift_indicator.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/game/transport/lift_indicator.h" +#include "titanic/game/transport/lift.h" +#include "titanic/pet_control/pet_control.h" +#include "titanic/titanic.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CLiftindicator, CLift) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(PETActivateMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(EnterRoomMsg) + ON_MESSAGE(LeaveRoomMsg) + ON_MESSAGE(TimerMsg) +END_MESSAGE_MAP() + +CLiftindicator::CLiftindicator() : CLift(), + _fieldFC(0), _start(0), _end(0) { +} + +void CLiftindicator::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldFC, indent); + file->writePoint(_indicatorPos, indent); + file->writeNumberLine(_start, indent); + file->writeNumberLine(_end, indent); + + CLift::save(file, indent); +} + +void CLiftindicator::load(SimpleFile *file) { + file->readNumber(); + _fieldFC = file->readNumber(); + _indicatorPos = file->readPoint(); + _start = file->readNumber(); + _end = file->readNumber(); + + CLift::load(file); +} + +bool CLiftindicator::EnterViewMsg(CEnterViewMsg *msg) { + double multiplier = _fieldFC * 0.037037037; + CPetControl *pet = getPetControl(); + int floorNum = pet->getRoomsFloorNum(); + debugC(kDebugScripts, "Lifts = %d,%d,%d,%d, %d", + CLift::_elevator1Floor, CLift::_elevator2Floor, + CLift::_elevator3Floor, CLift::_elevator4Floor, + floorNum); + + if ((pet->petGetRoomsWellEntry() & 1) == (_fieldFC & 1)) { + petSetRemoteTarget(); + petSetArea(PET_REMOTE); + + CString str = CString::format("You are standing outside Elevator %d", + petGetRoomsWellEntry()); + petDisplayMessage(-1, str); + + debugC(kDebugScripts, "Claiming PET - %d, Multiplier = %f", + _liftNum, multiplier); + } + + switch (_liftNum) { + case 0: + loadFrame(pet->getRoomsFloorNum()); + break; + + case 1: + case 3: + switch (petGetRoomsWellEntry()) { + case 1: + case 2: + setPosition(Point(_bounds.left, _indicatorPos.y + + (int)(multiplier * CLift::_elevator1Floor))); + _startFrame = CLift::_elevator1Floor; + break; + + case 3: + case 4: + setPosition(Point(_bounds.left, _indicatorPos.y + + (int)(multiplier * CLift::_elevator3Floor))); + _startFrame = CLift::_elevator3Floor; + break; + + default: + break; + } + break; + + case 2: + case 4: + switch (petGetRoomsWellEntry()) { + case 1: + case 2: + setPosition(Point(_bounds.left, _indicatorPos.y + + (int)(multiplier * CLift::_elevator2Floor))); + _startFrame = CLift::_elevator2Floor; + break; + + case 3: + case 4: + setPosition(Point(_bounds.left, _indicatorPos.y + + (int)(multiplier * CLift::_elevator4Floor))); + _startFrame = CLift::_elevator4Floor; + break; + + default: + break; + } + break; + + default: + break; + } + + return true; +} + +bool CLiftindicator::LeaveViewMsg(CLeaveViewMsg *msg) { + petClear(); + return true; +} + +bool CLiftindicator::PETActivateMsg(CPETActivateMsg *msg) { + double multiplier = _fieldFC * 0.037037037; + CPetControl *pet = getPetControl(); + + if (msg->_name == "Lift") { + if (petDoorOrBellbotPresent()) { + petDisplayMessage(1, "I'm sorry, you cannot enter this elevator at present " + "as a bot is in the way."); + } else { + _endFrame = pet->getRoomsFloorNum(); + + if (petGetRoomsWellEntry() == 4 && !CLift::_v6 + && pet->getRoomsFloorNum() != CLift::_elevator4Floor) { + petDisplayMessage(1, "This elevator is currently in an advanced state of non-functionality."); + } else { + _start = _indicatorPos.y + (int)(_startFrame * multiplier); + _end = _indicatorPos.y + (int)(_endFrame * multiplier); + lockMouse(); + addTimer(100); + + if (petGetRoomsWellEntry() == 2) { + CLift::_elevator4Floor = CLift::_elevator2Floor; + CShipSettingMsg settingMsg; + settingMsg._value = CLift::_elevator4Floor; + settingMsg.execute("SGTStateroomTV"); + } + + switch (petGetRoomsWellEntry()) { + case 1: + CLift::_elevator1Floor = pet->getRoomsFloorNum(); + break; + case 2: + CLift::_elevator2Floor = pet->getRoomsFloorNum(); + break; + case 3: + CLift::_elevator3Floor = pet->getRoomsFloorNum(); + break; + case 4: + CLift::_elevator4Floor = pet->getRoomsFloorNum(); + break; + default: + break; + } + + debugC(kDebugScripts, "Lifts = %d,%d,%d,%d %d", + CLift::_elevator1Floor, CLift::_elevator2Floor, + CLift::_elevator3Floor, CLift::_elevator4Floor, + petGetRoomsWellEntry()); + } + } + } + + return true; +} + +bool CLiftindicator::MovieEndMsg(CMovieEndMsg *msg) { + playSound("357 gp button 1.wav"); + sleep(100); + changeView("Lift.Node 1.N"); + + unlockMouse(); + return true; +} + +bool CLiftindicator::EnterRoomMsg(CEnterRoomMsg *msg) { + return true; +} + +bool CLiftindicator::LeaveRoomMsg(CLeaveRoomMsg *msg) { + return true; +} + +bool CLiftindicator::TimerMsg(CTimerMsg *msg) { + debugC(kDebugScripts, "Start %d, End %d", _start, _end); + + if (_start > _end) { + setPosition(Point(_bounds.left, _bounds.top - 1)); + --_start; + addTimer(20); + } else if (_start < _end) { + setPosition(Point(_bounds.left, _bounds.top + 1)); + ++_start; + addTimer(20); + } else { + CMovieEndMsg endMsg(0, 0); + endMsg.execute(this); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/transport/lift_indicator.h b/engines/titanic/game/transport/lift_indicator.h new file mode 100644 index 0000000000..5d0bc45d7b --- /dev/null +++ b/engines/titanic/game/transport/lift_indicator.h @@ -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. + * + */ + +#ifndef TITANIC_LIFT_INDICATOR_H +#define TITANIC_LIFT_INDICATOR_H + +#include "titanic/game/transport/lift.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/pet_messages.h" + +namespace Titanic { + +class CLiftindicator : public CLift { + DECLARE_MESSAGE_MAP; + bool EnterViewMsg(CEnterViewMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool PETActivateMsg(CPETActivateMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool EnterRoomMsg(CEnterRoomMsg *msg); + bool LeaveRoomMsg(CLeaveRoomMsg *msg); + bool TimerMsg(CTimerMsg *msg); +private: + int _fieldFC; + Point _indicatorPos; + int _start; + int _end; +public: + CLASSDEF; + CLiftindicator(); + + /** + * 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_LIFT_INDICATOR_H */ diff --git a/engines/titanic/game/transport/pellerator.cpp b/engines/titanic/game/transport/pellerator.cpp new file mode 100644 index 0000000000..5bc2423478 --- /dev/null +++ b/engines/titanic/game/transport/pellerator.cpp @@ -0,0 +1,365 @@ +/* ScummVM - Graphic Adventure Engine +* +* ScummVM is the legal property of its developers, whose names +* are too numerous to list here. Please refer to the COPYRIGHT +* file distributed with this source distribution. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +* +*/ + +#include "titanic/game/transport/pellerator.h" +#include "titanic/core/room_item.h" + +namespace Titanic { + +static const char *const WAVE_NAMES[10] = { + "z#465.wav", "z#456.wav", "z#455.wav", "z#453.wav", + "z#452.wav", "NoStandingInFunnyWays", "z#450.wav", + "z#449.wav", "z#435.wav", "z#434.wav" +}; + +BEGIN_MESSAGE_MAP(CPellerator, CTransport) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(EnterRoomMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(TimerMsg) +END_MESSAGE_MAP() + +int CPellerator::_soundHandle; +int CPellerator::_destination; + +CPellerator::CPellerator() : CTransport() { +} + +void CPellerator::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_soundHandle, indent); + file->writeNumberLine(_destination, indent); + + CTransport::save(file, indent); +} + +void CPellerator::load(SimpleFile *file) { + file->readNumber(); + _soundHandle = file->readNumber(); + _destination = file->readNumber(); + + CTransport::load(file); +} + +bool CPellerator::StatusChangeMsg(CStatusChangeMsg *msg) { + setVisible(true); + playGlobalSound("z#74.wav", -2, true, true, 0); + int classNum = getPassengerClass(); + int newDest = msg->_newStatus; + + if (msg->_newStatus == _destination) { + petDisplayMessage(1, "You are already at your chosen destination."); + } else if (classNum == 3 || (msg->_newStatus > 4 && classNum != 1)) { + petDisplayMessage(1, "Passengers of your class are not permitted to enter this area."); + } else if (newDest > _destination) { + CString name = getName(); + changeView(name == "PelleratorObject2" ? + "Pellerator.Node 1.N" : "Pellerator.Node 1.S"); + + if (name == "PelleratorObject") { + for (; _destination < newDest; ++_destination) { + switch (_destination) { + case 0: + case 1: + playMovie(315, 323, 0); + for (int idx = 0; idx < 3; ++idx) + playMovie(299, 304, 0); + playMovie(305, 313, MOVIE_GAMESTATE); + break; + + case 2: + playMovie(315, 323, 0); + for (int idx = 0; idx < 3; ++idx) + playMovie(299, 304, 0); + for (int idx = 0; idx < 5; ++idx) + playMovie(253, 263, 0); + playMovie(153, 197, 0); + for (int idx = 0; idx < 5; ++idx) + playMovie(253, 263, 0); + playMovie(290, 293, MOVIE_GAMESTATE); + break; + + case 4: + playMovie(267, 270, 0); + for (int idx = 0; idx < 5; ++idx) + playMovie(253, 263, 0); + playMovie(3, 71, 0); + for (int idx = 0; idx < 3; ++idx) + playMovie(253, 263, 0); + for (int idx = 0; idx < 7; ++idx) + playMovie(336, 341, 0); + playMovie(342, 348, MOVIE_GAMESTATE); + break; + + case 5: + playMovie(315, 323, 0); + for (int idx = 0; idx < 7; ++idx) + playMovie(299, 304, 0); + for (int idx = 0; idx < 3; ++idx) + playMovie(253, 263, 0); + playMovie(3, 71, 0); + for (int idx = 0; idx < 3; ++idx) + playMovie(299, 304, 0); + + } + } + } else { + for (; _destination < newDest; ++_destination) { + switch (_destination) { + case 0: + case 1: + playMovie(315, 323, 0); + for (int idx = 0; idx < 3; ++idx) + playMovie(299, 304, 0); + playMovie(305, 313, MOVIE_GAMESTATE); + break; + + case 2: + playMovie(315, 323, 0); + for (int idx = 0; idx < 4; ++idx) + playMovie(299, 304, 0); + for (int idx = 0; idx < 15; ++idx) + playMovie(245, 255, 0); + playMovie(264, 267, MOVIE_GAMESTATE); + ++_destination; + break; + + case 4: + playMovie(241, 244, 0); + for (int idx = 0; idx < 15; ++idx) + playMovie(245, 255, 0); + for (int idx = 0; idx < 7; ++idx) + playMovie(336, 341, 0); + playMovie(342, 348, MOVIE_GAMESTATE); + break; + + case 5: + playMovie(315, 323, 0); + for (int idx = 0; idx < 7; ++idx) + playMovie(229, 304, 0); + for (int idx = 0; idx < 12; ++idx) + playMovie(245, 255, 0); + for (int idx = 0; idx < 3; ++idx) + playMovie(299, 304, 0); + playMovie(305, 313, MOVIE_GAMESTATE); + break; + + default: + break; + } + } + } + + playMovie(264, 264, MOVIE_NOTIFY_OBJECT); + _destination = newDest; + } else if (newDest < _destination) { + CString name = getName(); + changeView(name == "PelleratorObject2" ? + "Pellerator.Node 1.N" : "Pellerator.Node 1.S"); + + if (name == "PelleratorObject") { + for (; _destination > newDest; --_destination) { + switch (_destination) { + case 0: + case 1: + playMovie(351, 359, 0); + for (int idx = 0; idx < 3; ++idx) + playMovie(336, 341, 0); + playMovie(342, 348, MOVIE_GAMESTATE); + break; + + case 3: + playMovie(241, 244, 0); + for (int idx = 0; idx < 5; ++idx) + playMovie(245, 255, 0); + playMovie(197, 239, 0); + for (int idx = 0; idx < 5; ++idx) + playMovie(245, 255, 0); + for (int idx = 0; idx < 3; ++idx) + playMovie(336, 341, 0); + playMovie(342, 348, MOVIE_GAMESTATE); + --_destination; + break; + + case 4: + playMovie(315, 323, 0); + for (int idx = 0; idx < 7; ++idx) + playMovie(299, 304, 0); + for (int idx = 0; idx < 3; ++idx) + playMovie(245, 255, 0); + playMovie(78, 149, 0); + for (int idx = 0; idx < 5; ++idx) + playMovie(245, 255, 0); + playMovie(264, 267, MOVIE_GAMESTATE); + break; + + case 5: + playMovie(351, 359, 0); + for (int idx = 0; idx < 7; ++idx) + playMovie(336, 341, 0); + for (int idx = 0; idx < 3; ++idx) + playMovie(245, 255, 0); + playMovie(78, 149, 0); + for (int idx = 0; idx < 3; ++idx) + playMovie(336, 341, 0); + playMovie(342, 348, MOVIE_GAMESTATE); + break; + + default: + break; + } + } + } else { + for (; _destination > newDest; --_destination) { + switch (_destination) { + case 0: + case 1: + playMovie(351, 359, 0); + for (int idx = 0; idx < 3; ++idx) + playMovie(336, 341, 0); + playMovie(342, 348, MOVIE_GAMESTATE); + break; + + case 3: + playMovie(267, 270, 0); + for (int idx = 0; idx < 15; ++idx) + playMovie(253, 263, 0); + for (int idx = 0; idx < 3; ++idx) + playMovie(336, 341, 0); + playMovie(342, 348, MOVIE_GAMESTATE); + --_destination; + break; + + case 4: + playMovie(315, 323, 0); + for (int idx = 0; idx < 7; ++idx) + playMovie(299, 304, 0); + for (int idx = 0; idx < 15; ++idx) + playMovie(253, 263, 0); + playMovie(290, 293, MOVIE_GAMESTATE); + break; + + case 5: + playMovie(351, 359, 0); + for (int idx = 0; idx < 7; ++idx) + playMovie(336, 341, 0); + for (int idx = 0; idx < 13; ++idx) + playMovie(253, 263, 0); + for (int idx = 0; idx < 3; ++idx) + playMovie(336, 341, 0); + playMovie(342, 348, MOVIE_GAMESTATE); + break; + + default: + break; + } + } + } + + playMovie(264, 264, MOVIE_NOTIFY_OBJECT); + _destination = newDest; + } + + CStatusChangeMsg statusMsg; + statusMsg._newStatus = _destination; + statusMsg.execute("ExitPellerator"); + + return true; +} + +bool CPellerator::EnterRoomMsg(CEnterRoomMsg *msg) { + if (isEquals("PelleratorObject")) { + for (int idx = 0; idx < 10; ++idx) + loadSound(WAVE_NAMES[idx]); + addTimer(10000); + } + + CString name = msg->_oldRoom ? msg->_oldRoom->getName() : ""; + int oldVal = _destination; + + if (name.empty()) { + _destination = 4; + oldVal = 4; + } else if (name == "PromenadeDeck") { + _destination = 0; + } else if (name == "MusicRoomLobby") { + _destination = 1; + } else if (name == "Bar") { + _destination = 2; + } else if (name == "TopOfWell") { + _destination = 4; + } else if (name == "1stClassRestaurant") { + _destination = 5; + } else if (name == "Arboretum" || name == "FrozenArboretum") { + _destination = 6; + } + + if (_destination != oldVal) { + CStatusChangeMsg statusMsg; + statusMsg._newStatus = _destination; + statusMsg.execute("ExitPellerator"); + } + + loadFrame(264); + return true; +} + +bool CPellerator::MovieEndMsg(CMovieEndMsg *msg) { + setVisible(false); + stopGlobalSound(true, -1); + + switch (_destination) { + case 0: + _soundHandle = queueSound("z#429.wav", _soundHandle); + break; + case 1: + _soundHandle = queueSound("z#430.wav", _soundHandle); + break; + case 2: + _soundHandle = queueSound("z#431.wav", _soundHandle); + break; + case 4: + _soundHandle = queueSound("z#428.wav", _soundHandle); + break; + case 5: + _soundHandle = queueSound("z#433.wav", _soundHandle); + break; + case 6: + _soundHandle = queueSound("z#432.wav", _soundHandle); + break; + default: + break; + } + + return true; +} + +bool CPellerator::TimerMsg(CTimerMsg *msg) { + if (compareRoomNameTo("Pellerator")) { + _soundHandle = queueSound(WAVE_NAMES[getRandomNumber(9)], _soundHandle); + addTimer(20000 + getRandomNumber(10000)); + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/transport/pellerator.h b/engines/titanic/game/transport/pellerator.h new file mode 100644 index 0000000000..c634f435cc --- /dev/null +++ b/engines/titanic/game/transport/pellerator.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_PELLERATOR_H +#define TITANIC_PELLERATOR_H + +#include "titanic/game/transport/transport.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CPellerator : public CTransport { + DECLARE_MESSAGE_MAP; + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool EnterRoomMsg(CEnterRoomMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool TimerMsg(CTimerMsg *msg); +public: + static int _soundHandle; + static int _destination; +public: + CLASSDEF; + CPellerator(); + + /** + * 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_PELLERATOR_H */ diff --git a/engines/titanic/game/transport/service_elevator.cpp b/engines/titanic/game/transport/service_elevator.cpp new file mode 100644 index 0000000000..1ea8d14e36 --- /dev/null +++ b/engines/titanic/game/transport/service_elevator.cpp @@ -0,0 +1,61 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/transport/service_elevator.h" + +namespace Titanic { + +int CServiceElevator::_v1; +int CServiceElevator::_v2; +int CServiceElevator::_v3; + +CServiceElevator::CServiceElevator() : CTransport(), + _fieldF8(0), _fieldFC(0), _field100(0), _field104(0) { +} + +void CServiceElevator::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_v2, indent); + file->writeNumberLine(_v3, indent); + file->writeNumberLine(_fieldF8, indent); + file->writeNumberLine(_fieldFC, indent); + file->writeNumberLine(_field100, indent); + file->writeNumberLine(_field104, indent); + + CTransport::save(file, indent); +} + +void CServiceElevator::load(SimpleFile *file) { + file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); + _v3 = file->readNumber(); + _fieldF8 = file->readNumber(); + _fieldFC = file->readNumber(); + _field100 = file->readNumber(); + _field104 = file->readNumber(); + + CTransport::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/transport/service_elevator.h b/engines/titanic/game/transport/service_elevator.h new file mode 100644 index 0000000000..b2c135021a --- /dev/null +++ b/engines/titanic/game/transport/service_elevator.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_SERVICE_ELEVATOR_H +#define TITANIC_SERVICE_ELEVATOR_H + +#include "titanic/game/transport/transport.h" + +namespace Titanic { + +class CServiceElevator : public CTransport { +private: + static int _v1; + static int _v2; + static int _v3; + + int _fieldF8; + int _fieldFC; + int _field100; + int _field104; +public: + CLASSDEF; + CServiceElevator(); + + /** + * 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_SERVICE_ELEVATOR_H */ diff --git a/engines/titanic/game/transport/transport.cpp b/engines/titanic/game/transport/transport.cpp new file mode 100644 index 0000000000..6fe45c2fc8 --- /dev/null +++ b/engines/titanic/game/transport/transport.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/game/transport/transport.h" + +namespace Titanic { + +EMPTY_MESSAGE_MAP(CTransport, CMobile); + +CTransport::CTransport() : CMobile(), _string1("*.*.*") { +} + +void CTransport::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + + CMobile::save(file, indent); +} + +void CTransport::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + + CMobile::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/transport/transport.h b/engines/titanic/game/transport/transport.h new file mode 100644 index 0000000000..d87251212a --- /dev/null +++ b/engines/titanic/game/transport/transport.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_TRANSPORT_H +#define TITANIC_TRANSPORT_H + +#include "titanic/npcs/mobile.h" + +namespace Titanic { + +class CTransport : public CMobile { + DECLARE_MESSAGE_MAP; +public: + CString _string1; + CString _string2; +public: + CLASSDEF; + CTransport(); + + /** + * 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_TRANSPORT_H */ diff --git a/engines/titanic/game/up_lighter.cpp b/engines/titanic/game/up_lighter.cpp new file mode 100644 index 0000000000..f03b8f37a0 --- /dev/null +++ b/engines/titanic/game/up_lighter.cpp @@ -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. + * + */ + +#include "titanic/game/up_lighter.h" + +namespace Titanic { + +CUpLighter::CUpLighter() : CDropTarget(), _field118(0), + _field11C(0), _field120(0), _field124(0) { +} + +void CUpLighter::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field118, indent); + file->writeNumberLine(_field11C, indent); + file->writeNumberLine(_field120, indent); + file->writeNumberLine(_field124, indent); + + CDropTarget::save(file, indent); +} + +void CUpLighter::load(SimpleFile *file) { + file->readNumber(); + _field118 = file->readNumber(); + _field11C = file->readNumber(); + _field120 = file->readNumber(); + _field124 = file->readNumber(); + + CDropTarget::load(file); +} + +bool CUpLighter::EnterRoomMsg(CEnterRoomMsg *msg) { + warning("CUpLighter::handleEvent"); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/up_lighter.h b/engines/titanic/game/up_lighter.h new file mode 100644 index 0000000000..2367e41314 --- /dev/null +++ b/engines/titanic/game/up_lighter.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_UP_LIGHTER_H +#define TITANIC_UP_LIGHTER_H + +#include "titanic/core/drop_target.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CUpLighter : public CDropTarget { + bool EnterRoomMsg(CEnterRoomMsg *msg); +private: + int _field118; + int _field11C; + int _field120; + int _field124; +public: + CLASSDEF; + CUpLighter(); + + /** + * 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_UP_LIGHTER_H */ diff --git a/engines/titanic/game/useless_lever.cpp b/engines/titanic/game/useless_lever.cpp new file mode 100644 index 0000000000..e48ad55a71 --- /dev/null +++ b/engines/titanic/game/useless_lever.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/game/useless_lever.h" + +namespace Titanic { + +void CUselessLever::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CToggleButton::save(file, indent); +} + +void CUselessLever::load(SimpleFile *file) { + file->readNumber(); + CToggleButton::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/useless_lever.h b/engines/titanic/game/useless_lever.h new file mode 100644 index 0000000000..27397de216 --- /dev/null +++ b/engines/titanic/game/useless_lever.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_USELESS_LEVER_H +#define TITANIC_USELESS_LEVER_H + +#include "titanic/gfx/toggle_button.h" + +namespace Titanic { + +class CUselessLever : public CToggleButton { +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_UP_LIGHTER_H */ diff --git a/engines/titanic/game/volume_control.cpp b/engines/titanic/game/volume_control.cpp new file mode 100644 index 0000000000..c6b0e414ae --- /dev/null +++ b/engines/titanic/game/volume_control.cpp @@ -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. + * + */ + +#include "titanic/game/volume_control.h" + +namespace Titanic { + +CVolumeControl::CVolumeControl() : CGameObject() { +} + +void CVolumeControl::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_fieldCC, indent); + + CGameObject::save(file, indent); +} + +void CVolumeControl::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _string1 = file->readString(); + _fieldCC = file->readNumber(); + + CGameObject::load(file); +} + +bool CVolumeControl::EnterNodeMsg(CEnterNodeMsg *msg) { + warning("CVolumeControl::handleEvent"); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/volume_control.h b/engines/titanic/game/volume_control.h new file mode 100644 index 0000000000..dcc6f63781 --- /dev/null +++ b/engines/titanic/game/volume_control.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_VOLUME_CONTROL_H +#define TITANIC_VOLUME_CONTROL_H + +#include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CVolumeControl : public CGameObject { + bool EnterNodeMsg(CEnterNodeMsg *msg); +private: + int _fieldBC; + CString _string1; + int _fieldCC; +public: + CLASSDEF; + CVolumeControl(); + + /** + * 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_VOLUME_CONTROL_H */ diff --git a/engines/titanic/game/wheel_button.cpp b/engines/titanic/game/wheel_button.cpp new file mode 100644 index 0000000000..19c42a8807 --- /dev/null +++ b/engines/titanic/game/wheel_button.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/game/wheel_button.h" + +namespace Titanic { + +CWheelButton::CWheelButton() : CBackground(), + _fieldE0(0), _fieldE4(0), _fieldE8(0) { +} + +void CWheelButton::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + + CBackground::save(file, indent); +} + +void CWheelButton::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/wheel_button.h b/engines/titanic/game/wheel_button.h new file mode 100644 index 0000000000..cb089a660f --- /dev/null +++ b/engines/titanic/game/wheel_button.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_WHEEL_BUTTON_H +#define TITANIC_WHEEL_BUTTON_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CWheelButton : public CBackground { +public: + int _fieldE0; + int _fieldE4; + int _fieldE8; +public: + CLASSDEF; + CWheelButton(); + + /** + * 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_WHEEL_BUTTON_H */ diff --git a/engines/titanic/game/wheel_hotspot.cpp b/engines/titanic/game/wheel_hotspot.cpp new file mode 100644 index 0000000000..f9af594cd5 --- /dev/null +++ b/engines/titanic/game/wheel_hotspot.cpp @@ -0,0 +1,43 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/wheel_hotspot.h" + +namespace Titanic { + +void CWheelHotSpot::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + + CBackground::save(file, indent); +} + +void CWheelHotSpot::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/wheel_hotspot.h b/engines/titanic/game/wheel_hotspot.h new file mode 100644 index 0000000000..364fe9a060 --- /dev/null +++ b/engines/titanic/game/wheel_hotspot.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_WHEEL_HOTSPOT_H +#define TITANIC_WHEEL_HOTSPOT_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CWheelHotSpot : public CBackground { +public: + int _fieldE0; + int _fieldE4; +public: + CLASSDEF; + CWheelHotSpot() : CBackground(), _fieldE0(0), _fieldE4(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_WHEEL_HOTSPOT_H */ diff --git a/engines/titanic/game/wheel_spin.cpp b/engines/titanic/game/wheel_spin.cpp new file mode 100644 index 0000000000..daa9918e29 --- /dev/null +++ b/engines/titanic/game/wheel_spin.cpp @@ -0,0 +1,39 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/wheel_spin.h" + +namespace Titanic { + +void CWheelSpin::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CBackground::save(file, indent); +} + +void CWheelSpin::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/wheel_spin.h b/engines/titanic/game/wheel_spin.h new file mode 100644 index 0000000000..509db1a4bf --- /dev/null +++ b/engines/titanic/game/wheel_spin.h @@ -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. + * + */ + +#ifndef TITANIC_WHEEL_SPIN_H +#define TITANIC_WHEEL_SPIN_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CWheelSpin : public CBackground { +public: + int _value; +public: + CLASSDEF; + CWheelSpin() : CBackground(), _value(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_WHEEL_SPIN_H */ diff --git a/engines/titanic/game/wheel_spin_horn.cpp b/engines/titanic/game/wheel_spin_horn.cpp new file mode 100644 index 0000000000..b01cc678df --- /dev/null +++ b/engines/titanic/game/wheel_spin_horn.cpp @@ -0,0 +1,43 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/game/wheel_spin_horn.h" + +namespace Titanic { + +void CWheelSpinHorn::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + + CWheelSpin::save(file, indent); +} + +void CWheelSpinHorn::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + + CWheelSpin::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/wheel_spin_horn.h b/engines/titanic/game/wheel_spin_horn.h new file mode 100644 index 0000000000..21182253b3 --- /dev/null +++ b/engines/titanic/game/wheel_spin_horn.h @@ -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. + * + */ + +#ifndef TITANIC_WHEEL_SPIN_HORN_H +#define TITANIC_WHEEL_SPIN_HORN_H + +#include "titanic/game/wheel_spin.h" + +namespace Titanic { + +class CWheelSpinHorn : public CWheelSpin { +public: + CString _string1; + CString _string2; +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_WHEEL_SPIN_HORN_H */ |