aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2016-05-29 16:01:39 -0400
committerPaul Gilbert2016-07-15 19:17:02 -0400
commit2f4cf6a26aab58f932c06806a952cbd047c02ed0 (patch)
tree847da5be94a81dcd7337ec2a32213c0bc6c7339d /engines
parentb9ad4ff7277505054b0de88b78e0034a462a026b (diff)
downloadscummvm-rg350-2f4cf6a26aab58f932c06806a952cbd047c02ed0.tar.gz
scummvm-rg350-2f4cf6a26aab58f932c06806a952cbd047c02ed0.tar.bz2
scummvm-rg350-2f4cf6a26aab58f932c06806a952cbd047c02ed0.zip
TITANIC: Beginnings of TTresponse class
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/module.mk1
-rw-r--r--engines/titanic/true_talk/tt_response.cpp71
-rw-r--r--engines/titanic/true_talk/tt_response.h54
-rw-r--r--engines/titanic/true_talk/tt_word.h4
4 files changed, 130 insertions, 0 deletions
diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index 19e4aff31b..c97b30f7b0 100644
--- a/engines/titanic/module.mk
+++ b/engines/titanic/module.mk
@@ -471,6 +471,7 @@ MODULE_OBJS := \
true_talk/tt_parser.o \
true_talk/tt_picture.o \
true_talk/tt_pronoun.o \
+ true_talk/tt_response.o \
true_talk/tt_room_script.o \
true_talk/tt_script_base.o \
true_talk/tt_scripts.o \
diff --git a/engines/titanic/true_talk/tt_response.cpp b/engines/titanic/true_talk/tt_response.cpp
new file mode 100644
index 0000000000..8d580ec198
--- /dev/null
+++ b/engines/titanic/true_talk/tt_response.cpp
@@ -0,0 +1,71 @@
+/* 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/true_talk/tt_response.h"
+
+namespace Titanic {
+
+TTresponse::TTresponse(const TTstring &src) : _field0(0), _text(src),
+ _fieldC(0), _nextP(nullptr), _linkP(nullptr) {
+}
+
+TTresponse::TTresponse(int val1, int val2) : _field0(val2), _text(" "),
+ _fieldC(val1), _nextP(nullptr), _linkP(nullptr) {
+}
+
+TTresponse::TTresponse(const TTresponse *src) : _field0(src->_field0),
+ _text(src->_text), _fieldC(src->_fieldC), _nextP(src->_nextP),
+ _linkP(src->_linkP) {
+}
+
+TTresponse::~TTresponse() {
+ // Iterate through destroying any successive linked response items
+ TTresponse *nextP;
+ for (TTresponse *currP = _nextP; currP; currP = nextP) {
+ // Get the following response and detach it from the current one,
+ // so that when the current is destroyed, it will only destroy itself
+ nextP = currP->_nextP;
+ currP->_nextP = nullptr;
+ delete currP;
+ }
+}
+
+TTresponse *TTresponse::copyChain() const {
+ TTresponse *returnResponseP = new TTresponse(this);
+
+ for (TTresponse *srcP = _nextP, *destP = returnResponseP;
+ srcP; srcP = srcP->_nextP, destP = destP->_nextP) {
+ destP->_nextP = new TTresponse(*srcP);
+ }
+
+ return returnResponseP;
+}
+
+void TTresponse::addLink(TTresponse *item) {
+ TTresponse *currP = this;
+ while (currP->_linkP)
+ currP = currP->_linkP;
+
+ currP->_linkP = item;
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/true_talk/tt_response.h b/engines/titanic/true_talk/tt_response.h
new file mode 100644
index 0000000000..c4119763ea
--- /dev/null
+++ b/engines/titanic/true_talk/tt_response.h
@@ -0,0 +1,54 @@
+/* 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_TT_RESPONSE_H
+#define TITANIC_TT_RESPONSE_H
+
+#include "titanic/true_talk/tt_string.h"
+namespace Titanic {
+
+class TTsentence;
+
+class TTresponse {
+private:
+ int _field0;
+ TTstring _text;
+ int _fieldC;
+ TTresponse *_nextP;
+ TTresponse *_linkP;
+
+ TTresponse *copyChain() const;
+private:
+ /**
+ *
+ */
+ void addLink(TTresponse *item);
+public:
+ TTresponse(const TTstring &src);
+ TTresponse(int val1, int val2);
+ TTresponse(const TTresponse *src);
+ virtual ~TTresponse();
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_TT_RESPONSE_H */
diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h
index b16e6a50ce..349e9e9910 100644
--- a/engines/titanic/true_talk/tt_word.h
+++ b/engines/titanic/true_talk/tt_word.h
@@ -29,10 +29,14 @@
namespace Titanic {
+/**
+ * Types of words
+ */
enum WordClass {
WC_UNKNOWN = 0, WC_ACTION = 1, WC_THING = 2, WC_ABSTRACT = 3,
WC_ARTICLE = 4, WC_CONJUNCTION = 5, WC_PRONOUN = 6,
WC_PREPOSITION = 7, WC_ADJECTIVE = 8, WC_ADVERB = 9,
+ // TODO: These may not actually be part of this enum
WC_UNK_ACTION = 10,
WC_ATRANS = 11, // transfer possession, eg: give/take
WC_PTRANS = 12, // physical transfer, eg: go