From fde400c33267fcb7b48ba1508e6191008a1de4de Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Aug 2016 22:55:34 -0400 Subject: TITANIC: Implemented nav helmet classes --- engines/titanic/carry/napkin.cpp | 1 - engines/titanic/game/nav_helmet.cpp | 99 ++++++++++++++++++++++++++++++++- engines/titanic/game/nav_helmet.h | 13 ++++- engines/titanic/game/nav_helmet_off.cpp | 49 ++++++++++++++++ engines/titanic/game/nav_helmet_off.h | 53 ++++++++++++++++++ engines/titanic/game/nav_helmet_on.cpp | 49 ++++++++++++++++ engines/titanic/game/nav_helmet_on.h | 53 ++++++++++++++++++ engines/titanic/module.mk | 2 + 8 files changed, 314 insertions(+), 5 deletions(-) create mode 100644 engines/titanic/game/nav_helmet_off.cpp create mode 100644 engines/titanic/game/nav_helmet_off.h create mode 100644 engines/titanic/game/nav_helmet_on.cpp create mode 100644 engines/titanic/game/nav_helmet_on.h diff --git a/engines/titanic/carry/napkin.cpp b/engines/titanic/carry/napkin.cpp index ace5a389a0..d25e8b5975 100644 --- a/engines/titanic/carry/napkin.cpp +++ b/engines/titanic/carry/napkin.cpp @@ -57,5 +57,4 @@ bool CNapkin::UseWithOtherMsg(CUseWithOtherMsg *msg) { return CCarry::UseWithOtherMsg(msg); } - } // End of namespace Titanic diff --git a/engines/titanic/game/nav_helmet.cpp b/engines/titanic/game/nav_helmet.cpp index 770eb7375e..08ff073c26 100644 --- a/engines/titanic/game/nav_helmet.cpp +++ b/engines/titanic/game/nav_helmet.cpp @@ -21,19 +21,114 @@ */ #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(_value, indent); + file->writeNumberLine(_flag, indent); CGameObject::save(file, indent); } void CNavHelmet::load(SimpleFile *file) { file->readNumber(); - _value = 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 index 74caa52534..c408d05c97 100644 --- a/engines/titanic/game/nav_helmet.h +++ b/engines/titanic/game/nav_helmet.h @@ -24,15 +24,24 @@ #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: - int _value; + bool _flag; public: CLASSDEF; - CNavHelmet() : CGameObject(), _value(0) {} + CNavHelmet() : CGameObject(), _flag(false) {} /** * Save the data for the class to file 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/module.mk b/engines/titanic/module.mk index 924adb61ae..2182f58ac3 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -157,6 +157,8 @@ MODULE_OBJS := \ game/music_system_lock.o \ game/musical_instrument.o \ game/nav_helmet.o \ + game/nav_helmet_off.o \ + game/nav_helmet_on.o \ game/navigation_computer.o \ game/no_nut_bowl.o \ game/nose_holder.o \ -- cgit v1.2.3