From 49bc276ea3e297c23098d4f0e6ab331f0b89f6ee Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 11 Sep 2016 09:27:51 -0400 Subject: TTIANIC: Add CPlaceHolderItem, CVariableList classes --- engines/titanic/core/saveable_object.cpp | 6 ++ engines/titanic/game/place_holder_item.cpp | 96 ++++++++++++++++++++++++++++++ engines/titanic/game/place_holder_item.h | 63 ++++++++++++++++++++ engines/titanic/game/variable_list.cpp | 73 +++++++++++++++++++++++ engines/titanic/game/variable_list.h | 63 ++++++++++++++++++++ engines/titanic/module.mk | 2 + 6 files changed, 303 insertions(+) create mode 100644 engines/titanic/game/place_holder_item.cpp create mode 100644 engines/titanic/game/place_holder_item.h create mode 100644 engines/titanic/game/variable_list.cpp create mode 100644 engines/titanic/game/variable_list.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index db3249c107..d74f9a26ef 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -175,6 +175,7 @@ #include "titanic/game/pet_disabler.h" #include "titanic/game/phonograph.h" #include "titanic/game/phonograph_lid.h" +#include "titanic/game/place_holder_item.h" #include "titanic/game/play_music_button.h" #include "titanic/game/play_on_act.h" #include "titanic/game/port_hole.h" @@ -207,6 +208,7 @@ #include "titanic/game/tow_parrot_nav.h" #include "titanic/game/up_lighter.h" #include "titanic/game/useless_lever.h" +#include "titanic/game/variable_list.h" #include "titanic/game/volume_control.h" #include "titanic/game/wheel_button.h" #include "titanic/game/wheel_hotspot.h" @@ -586,6 +588,7 @@ DEFFN(CNutReplacer); DEFFN(CPetDisabler); DEFFN(CPhonograph); DEFFN(CPhonographLid); +DEFFN(CPlaceHolderItem); DEFFN(CPlayMusicButton); DEFFN(CPlayOnAct); DEFFN(CPortHole); @@ -618,6 +621,7 @@ DEFFN(CTitaniaStillControl); DEFFN(CTOWParrotNav); DEFFN(CUpLighter); DEFFN(CUselessLever); +DEFFN(CVariableListItem); DEFFN(CVolumeControl); DEFFN(CWheelButton); DEFFN(CWheelHotSpot); @@ -1174,6 +1178,7 @@ void CSaveableObject::initClassList() { ADDFN(CPetDisabler, CGameObject); ADDFN(CPhonograph, CMusicPlayer); ADDFN(CPhonographLid, CGameObject); + ADDFN(CPlaceHolderItem, CNamedItem); ADDFN(CPlayMusicButton, CBackground); ADDFN(CPlayOnAct, CBackground); ADDFN(CPortHole, CGameObject); @@ -1206,6 +1211,7 @@ void CSaveableObject::initClassList() { ADDFN(CTOWParrotNav, CGameObject); ADDFN(CUpLighter, CDropTarget); ADDFN(CUselessLever, CToggleButton); + ADDFN(CVariableListItem, ListItem); ADDFN(CVolumeControl, CGameObject); ADDFN(CWheelButton, CBackground); ADDFN(CWheelHotSpot, CBackground); diff --git a/engines/titanic/game/place_holder_item.cpp b/engines/titanic/game/place_holder_item.cpp new file mode 100644 index 0000000000..ecd9c9a10b --- /dev/null +++ b/engines/titanic/game/place_holder_item.cpp @@ -0,0 +1,96 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public 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/place_holder_item.h" + +namespace Titanic { + +EMPTY_MESSAGE_MAP(CPlaceHolderItem, CNamedItem); + +CPlaceHolderItem::CPlaceHolderItem() : + _field4C(0), _field60(0), _field64(0), _field68(0), _field7C(0) { +} + +void CPlaceHolderItem::save(SimpleFile *file, int indent) { + file->writeNumberLine(7, indent); + file->writeNumberLine(_field7C, indent); + file->writeQuotedLine("Movies", indent); + _clips.save(file, indent + 1); + file->writeNumberLine(_field68, indent); + file->writeNumberLine(_field64, indent); + file->writeNumberLine(_field60, indent); + _list.save(file, indent); + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_field4C, indent); + file->writePoint(_pos1, indent); + file->writePoint(_pos2, indent); + file->writeQuotedLine(_string1, indent); + + CNamedItem::save(file, indent); +} + +void CPlaceHolderItem::load(SimpleFile *file) { + switch (file->readNumber()) { + case 7: + _field7C = file->readNumber(); + // Deliberate fall-through + + case 6: + file->readString(); + _clips.load(file); + // Deliberate fall-through + + case 5: + _field68 = file->readNumber(); + // Deliberate fall-through + + case 4: + _field64 = file->readNumber(); + // Deliberate fall-through + + case 3: + _field60 = file->readNumber(); + // Deliberate fall-through + + case 2: + _list.load(file); + // Deliberate fall-through + + case 1: + _string2 = file->readString(); + _field4C = file->readNumber(); + _pos1 = file->readPoint(); + _pos2 = file->readPoint(); + // Deliberate fall-through + + case 0: + _string1 = file->readString(); + break; + + default: + break; + } + + CNamedItem::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/place_holder_item.h b/engines/titanic/game/place_holder_item.h new file mode 100644 index 0000000000..c4850377db --- /dev/null +++ b/engines/titanic/game/place_holder_item.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_PLACE_HOLDER_ITEM_H +#define TITANIC_PLACE_HOLDER_ITEM_H + +#include "titanic/core/named_item.h" +#include "titanic/game/variable_list.h" +#include "titanic/support/movie_clip.h" + +namespace Titanic { + +class CPlaceHolderItem : public CNamedItem { + DECLARE_MESSAGE_MAP; +public: + CString _string1; + Point _pos1; + Point _pos2; + CString _string2; + int _field4C; + CVariableList _list; + int _field60; + int _field64; + int _field68; + CMovieClipList _clips; + int _field7C; +public: + CLASSDEF; + CPlaceHolderItem(); + + /** + * 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_ITEM_H */ diff --git a/engines/titanic/game/variable_list.cpp b/engines/titanic/game/variable_list.cpp new file mode 100644 index 0000000000..1ddf1bc957 --- /dev/null +++ b/engines/titanic/game/variable_list.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/variable_list.h" + +namespace Titanic { + +void CVariableListItem::save(SimpleFile *file, int indent) { + file->writeNumberLine(3, indent); + file->writeNumberLine(_field44, indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_field18, indent); + file->writeNumberLine(_field40, indent); + file->writeQuotedLine(_string2, indent); + file->writeQuotedLine(_string3, indent); + file->writeQuotedLine(_string4, indent); + + ListItem::save(file, indent); +} + +void CVariableListItem::load(SimpleFile *file) { + int field40 = 0, field44 = 0; + + switch (file->readNumber()) { + case 3: + field44 = file->readNumber(); + // Deliberate fall-through + + case 2: + _string1 = file->readString(); + _field18 = file->readNumber(); + // Deliberate fall-through + + case 1: + field40 = file->readNumber(); + // Deliberate fall-through + + case 0: + _string2 = file->readString(); + _string3 = file->readString(); + _string4 = file->readString(); + break; + + default: + break; + } + + _field40 = field40; + _field44 = field44; + + ListItem::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/variable_list.h b/engines/titanic/game/variable_list.h new file mode 100644 index 0000000000..9309e19ac5 --- /dev/null +++ b/engines/titanic/game/variable_list.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_VARIABLE_LIST_H +#define TITANIC_VARIABLE_LIST_H + +#include "titanic/core/list.h" + +namespace Titanic { + +class CVariableListItem : public ListItem { +public: + CString _string1; + int _field18; + CString _string2; + CString _string3; + CString _string4; + int _field40; + int _field44; +public: + CLASSDEF; + CVariableListItem() : ListItem(), _field18(0), _field40(0), _field44(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); +}; + + +/** + * Movie clip list + */ +class CVariableList: public List { +}; + +} // End of namespace Titanic + +#endif /* TITANIC_VARIABLE_LIST_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 87f4124df7..798d81dbe5 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -167,6 +167,7 @@ MODULE_OBJS := \ game/pet_disabler.o \ game/phonograph.o \ game/phonograph_lid.o \ + game/place_holder_item.o \ game/play_music_button.o \ game/play_on_act.o \ game/port_hole.o \ @@ -199,6 +200,7 @@ MODULE_OBJS := \ game/titania_still_control.o \ game/up_lighter.o \ game/useless_lever.o \ + game/variable_list.o \ game/volume_control.o \ game/wheel_button.o \ game/wheel_hotspot.o \ -- cgit v1.2.3