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/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 ++++++++++++++++++++ 4 files changed, 295 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 (limited to 'engines/titanic/game') 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 */ -- cgit v1.2.3