aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2016-02-25 07:40:04 -0500
committerPaul Gilbert2016-02-25 07:40:04 -0500
commitf509f3322b54e2ffddc0244dca365756e0b47401 (patch)
treef951a14cb8d68cdc4033d25642a4e2167645cbbb /engines
parent45043cc6e1da458a16e64e55ef5bed624421794d (diff)
downloadscummvm-rg350-f509f3322b54e2ffddc0244dca365756e0b47401.tar.gz
scummvm-rg350-f509f3322b54e2ffddc0244dca365756e0b47401.tar.bz2
scummvm-rg350-f509f3322b54e2ffddc0244dca365756e0b47401.zip
TITANIC: Implemented CLinkItem class
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/module.mk1
-rw-r--r--engines/titanic/objects/link_item.cpp100
-rw-r--r--engines/titanic/objects/link_item.h69
-rw-r--r--engines/titanic/objects/saveable_object.cpp3
4 files changed, 173 insertions, 0 deletions
diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index b14ec0f601..1120f699b0 100644
--- a/engines/titanic/module.mk
+++ b/engines/titanic/module.mk
@@ -19,6 +19,7 @@ MODULE_OBJS := \
objects/dont_save_file_item.o \
objects/file_item.o \
objects/game_object.o \
+ objects/link_item.o \
objects/list.o \
objects/message_target.o \
objects/movie_clip.o \
diff --git a/engines/titanic/objects/link_item.cpp b/engines/titanic/objects/link_item.cpp
new file mode 100644
index 0000000000..90774ad43c
--- /dev/null
+++ b/engines/titanic/objects/link_item.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/objects/link_item.h"
+
+namespace Titanic {
+
+CLinkItemSub::CLinkItemSub() : _field0(0), _field4(0), _field8(0), _fieldC(0) {
+}
+
+CLinkItem::CLinkItem() : CNamedItem() {
+ _field24 = -1;
+ _field28 = -1;
+ _field2C = -1;
+ _field30 = 0;
+ _field34 = 1;
+ _name = "Link";
+}
+
+void CLinkItem::save(SimpleFile *file, int indent) const {
+ file->writeNumberLine(2, indent);
+ file->writeQuotedLine("L", indent);
+ file->writeNumberLine(_field34, indent + 1);
+ file->writeNumberLine(_field30, indent + 1);
+ file->writeNumberLine(_field24, indent + 1);
+ file->writeNumberLine(_field28, indent + 1);
+ file->writeNumberLine(_field2C, indent + 1);
+
+ file->writeQuotedLine("Hotspot", indent + 1);
+ file->writeNumberLine(_sub._field0, indent + 2);
+ file->writeNumberLine(_sub._field4, indent + 2);
+ file->writeNumberLine(_sub._field8, indent + 2);
+ file->writeNumberLine(_sub._fieldC, indent + 2);
+
+ CNamedItem::save(file, indent);
+}
+
+void CLinkItem::load(SimpleFile *file) {
+ int val = file->readNumber();
+ file->readBuffer();
+
+ switch (val) {
+ case 3:
+ _field34 = file->readNumber();
+ // Deliberate fall-through
+
+ case 1:
+ _field30 = file->readNumber();
+ // Deliberate fall-through
+
+ case 0:
+ _field24 = file->readNumber();
+ _field28 = file->readNumber();
+ _field2C = file->readNumber();
+ break;
+
+ default:
+ break;
+ }
+
+ CNamedItem::load(file);
+
+ if (val < 2) {
+ switch (_field30) {
+ case 2:
+ _field34 = 2;
+ break;
+ case 3:
+ _field34 = 3;
+ break;
+ case 5:
+ _field34 = 7;
+ break;
+ default:
+ _field34 = 4;
+ break;
+ }
+ }
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/objects/link_item.h b/engines/titanic/objects/link_item.h
new file mode 100644
index 0000000000..efe5ec1cf5
--- /dev/null
+++ b/engines/titanic/objects/link_item.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_LINK_ITEM_H
+#define TITANIC_LINK_ITEM_H
+
+#include "titanic/objects/named_item.h"
+
+namespace Titanic {
+
+class CLinkItemSub {
+public:
+ int _field0;
+ int _field4;
+ int _field8;
+ int _fieldC;
+public:
+ CLinkItemSub();
+};
+
+class CLinkItem : public CNamedItem {
+protected:
+ int _field24;
+ int _field28;
+ int _field2C;
+ int _field30;
+ int _field34;
+ CLinkItemSub _sub;
+public:
+ CLinkItem();
+
+ /**
+ * Return the class name
+ */
+ virtual const char *getClassName() const { return "CLinkItem"; }
+
+ /**
+ * Save the data for the class to file
+ */
+ virtual void save(SimpleFile *file, int indent) const;
+
+ /**
+ * Load the data for the class from file
+ */
+ virtual void load(SimpleFile *file);
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_LINK_ITEM_H */
diff --git a/engines/titanic/objects/saveable_object.cpp b/engines/titanic/objects/saveable_object.cpp
index cd5f7eba6e..b6611680ed 100644
--- a/engines/titanic/objects/saveable_object.cpp
+++ b/engines/titanic/objects/saveable_object.cpp
@@ -22,6 +22,7 @@
#include "titanic/objects/saveable_object.h"
#include "titanic/objects/file_item.h"
+#include "titanic/objects/link_item.h"
#include "titanic/objects/list.h"
#include "titanic/objects/message_target.h"
#include "titanic/objects/movie_clip.h"
@@ -42,6 +43,7 @@ Common::HashMap<Common::String, CSaveableObject::CreateFunction> *
DEFFN(CFileItem);
DEFFN(CFileListItem);
+DEFFN(CLinkItem);
DEFFN(CMessageTarget);
DEFFN(CMovieClip);
DEFFN(CMovieClipList);
@@ -56,6 +58,7 @@ void CSaveableObject::initClassList() {
_classList = new Common::HashMap<Common::String, CreateFunction>();
ADDFN(CFileItem);
ADDFN(CFileListItem);
+ ADDFN(CLinkItem);
ADDFN(CMessageTarget);
ADDFN(CMovieClip);
ADDFN(CMovieClipList);