aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/core/game_object.h2
-rw-r--r--engines/titanic/core/game_object_desc_item.cpp57
-rw-r--r--engines/titanic/core/game_object_desc_item.h56
-rw-r--r--engines/titanic/core/saveable_object.cpp8
-rw-r--r--engines/titanic/core/saveable_object.h2
-rw-r--r--engines/titanic/core/tree_item.cpp38
-rw-r--r--engines/titanic/core/tree_item.h34
-rw-r--r--engines/titanic/module.mk1
-rw-r--r--engines/titanic/pet_control/pet_control_sub1.h2
9 files changed, 192 insertions, 8 deletions
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index 0d9f9184b2..3809ae38d0 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -75,4 +75,4 @@ public:
} // End of namespace Titanic
-#endif /* TITANIC_PET_CONTROL_H */
+#endif /* TITANIC_GAME_OBJECT_H */
diff --git a/engines/titanic/core/game_object_desc_item.cpp b/engines/titanic/core/game_object_desc_item.cpp
new file mode 100644
index 0000000000..77174e5d06
--- /dev/null
+++ b/engines/titanic/core/game_object_desc_item.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/core/game_object_desc_item.h"
+
+namespace Titanic {
+
+CGameObjectDescItem::CGameObjectDescItem(): CTreeItem() {
+}
+
+void CGameObjectDescItem::save(SimpleFile *file, int indent) const {
+ file->writeNumberLine(1, indent);
+ _clipList.save(file, indent);
+ file->writeQuotedLine(_string1, indent);
+ file->writeQuotedLine(_string2, indent);
+ _list1.save(file, indent);
+ _list2.save(file, indent);
+
+ CTreeItem::save(file, indent);
+}
+
+void CGameObjectDescItem::load(SimpleFile *file) {
+ int val = file->readNumber();
+
+ if (val != 1) {
+ if (val)
+ _clipList.load(file);
+
+ _string1 = file->readString();
+ _string2 = file->readString();
+ _list1.load(file);
+ _list1.load(file);
+ }
+
+ CTreeItem::load(file);
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/core/game_object_desc_item.h b/engines/titanic/core/game_object_desc_item.h
new file mode 100644
index 0000000000..4ac5816dbc
--- /dev/null
+++ b/engines/titanic/core/game_object_desc_item.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_GAME_OBJECT_DESK_ITEM_H
+#define TITANIC_GAME_OBJECT_DESK_ITEM_H
+
+#include "titanic/core/movie_clip.h"
+#include "titanic/core/tree_item.h"
+#include "titanic/core/list.h"
+
+namespace Titanic {
+
+class CGameObjectDescItem : public CTreeItem {
+protected:
+ CString _string1;
+ CString _string2;
+ List<ListItem> _list1;
+ List<ListItem> _list2;
+ CMovieClipList _clipList;
+public:
+ CLASSDEF
+ CGameObjectDescItem();
+
+ /**
+ * 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_GAME_OBJECT_DESK_ITEM_H */
diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp
index 8e9ec4e1d6..95175ca174 100644
--- a/engines/titanic/core/saveable_object.cpp
+++ b/engines/titanic/core/saveable_object.cpp
@@ -64,6 +64,8 @@
#include "titanic/core/dont_save_file_item.h"
#include "titanic/core/drop_target.h"
#include "titanic/core/file_item.h"
+#include "titanic/core/game_object.h"
+#include "titanic/core/game_object_desc_item.h"
#include "titanic/core/link_item.h"
#include "titanic/core/list.h"
#include "titanic/core/message_target.h"
@@ -467,6 +469,7 @@ DEFFN(CDropTarget)
DEFFN(CFileItem)
DEFFN(CFileListItem)
DEFFN(CGameObject)
+DEFFN(CGameObjectDescItem)
DEFFN(CLinkItem)
DEFFN(ListItem)
DEFFN(CMessageTarget)
@@ -1031,6 +1034,7 @@ void CSaveableObject::initClassList() {
ADDFN(CFileItem, CTreeItem);
ADDFN(CFileListItem, ListItem);
ADDFN(CGameObject, CNamedItem);
+ ADDFN(CGameObjectDescItem, CTreeItem);
ADDFN(CLinkItem, CNamedItem);
ADDFN(ListItem, CSaveableObject);
ADDFN(CMessageTarget, CSaveableObject);
@@ -1581,7 +1585,7 @@ void CSaveableObject::saveFooter(SimpleFile *file, int indent) const {
file->writeClassEnd(indent);
}
-bool CSaveableObject::isInstanceOf(const ClassDef *classDef) {
+bool CSaveableObject::isInstanceOf(const ClassDef *classDef) const {
for (ClassDef *def = getType(); def != nullptr; def = def->_parent) {
if (def == classDef)
return true;
@@ -1590,6 +1594,4 @@ bool CSaveableObject::isInstanceOf(const ClassDef *classDef) {
return false;
}
-
-
} // End of namespace Titanic
diff --git a/engines/titanic/core/saveable_object.h b/engines/titanic/core/saveable_object.h
index 1fb509bf20..5a6e4c999d 100644
--- a/engines/titanic/core/saveable_object.h
+++ b/engines/titanic/core/saveable_object.h
@@ -80,7 +80,7 @@ public:
CLASSDEF
virtual ~CSaveableObject() {}
- bool isInstanceOf(const ClassDef *classDef);
+ bool isInstanceOf(const ClassDef *classDef) const;
/**
* Save the data for the class to file
diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp
index ffcee40c6a..127a95071a 100644
--- a/engines/titanic/core/tree_item.cpp
+++ b/engines/titanic/core/tree_item.cpp
@@ -23,7 +23,13 @@
#include "titanic/core/tree_item.h"
#include "titanic/core/dont_save_file_item.h"
#include "titanic/core/file_item.h"
+#include "titanic/core/game_object.h"
+#include "titanic/core/game_object_desc_item.h"
+#include "titanic/core/link_item.h"
#include "titanic/core/named_item.h"
+#include "titanic/core/node_item.h"
+#include "titanic/core/view_item.h"
+#include "titanic/game/room_item.h"
namespace Titanic {
@@ -31,6 +37,38 @@ CTreeItem::CTreeItem() : _parent(nullptr), _firstChild(nullptr),
_nextSibling(nullptr), _priorSibling(nullptr), _field14(0) {
}
+bool CTreeItem::isFileItem() const {
+ return isInstanceOf(CFileItem::_type);
+}
+
+bool CTreeItem::isRoomItem() const {
+ return isInstanceOf(CRoomItem::_type);
+}
+
+bool CTreeItem::isNodeItem() const {
+ return isInstanceOf(CNodeItem::_type);
+}
+
+bool CTreeItem::isViewItem() const {
+ return isInstanceOf(CViewItem::_type);
+}
+
+bool CTreeItem::isLinkItem() const {
+ return isInstanceOf(CLinkItem::_type);
+}
+
+bool CTreeItem::isNamedItem() const {
+ return isInstanceOf(CNamedItem::_type);
+}
+
+bool CTreeItem::isGameObject() const {
+ return isInstanceOf(CGameObject::_type);
+}
+
+bool CTreeItem::isGameObjectDescItem() const {
+ return isInstanceOf(CGameObjectDescItem::_type);
+}
+
void CTreeItem::save(SimpleFile *file, int indent) const {
file->writeNumberLine(0, indent);
CMessageTarget::save(file, indent);
diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h
index e218cf3dbb..32b76c987e 100644
--- a/engines/titanic/core/tree_item.h
+++ b/engines/titanic/core/tree_item.h
@@ -60,12 +60,42 @@ public:
/**
* Returns true if the item is a file item
*/
- virtual bool isFileItem() const { return false; }
+ virtual bool isFileItem() const;
+
+ /**
+ * Returns true if the item is a room item
+ */
+ virtual bool isRoomItem() const;
+
+ /**
+ * Returns true if the item is a node item
+ */
+ virtual bool isNodeItem() const;
+
+ /**
+ * Returns true if the item is a view item
+ */
+ virtual bool isViewItem() const;
+
+ /**
+ * Returns true if the item is a link item
+ */
+ virtual bool isLinkItem() const;
/**
* Returns true if the item is a named item
*/
- virtual bool isNamedItem() const { return false; }
+ virtual bool isNamedItem() const;
+
+ /**
+ * Returns true if the item is a game object
+ */
+ virtual bool isGameObject() const;
+
+ /**
+ * Returns true if the item is a game object desc item
+ */
+ virtual bool isGameObjectDescItem() const;
/**
* Gets the name of the item, if any
diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index e95977ab56..3c82bdba99 100644
--- a/engines/titanic/module.mk
+++ b/engines/titanic/module.mk
@@ -62,6 +62,7 @@ MODULE_OBJS := \
core/drop_target.o \
core/file_item.o \
core/game_object.o \
+ core/game_object_desc_item.o \
core/link_item.o \
core/list.o \
core/message_target.o \
diff --git a/engines/titanic/pet_control/pet_control_sub1.h b/engines/titanic/pet_control/pet_control_sub1.h
index e826182afc..5d0edb6c9f 100644
--- a/engines/titanic/pet_control/pet_control_sub1.h
+++ b/engines/titanic/pet_control/pet_control_sub1.h
@@ -66,4 +66,4 @@ public:
} // End of namespace Titanic
-#endif /* TITANIC_PET_CONTROL_H */
+#endif /* TITANIC_PET_CONTROL_SUB1_H */