aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2016-06-03 23:01:44 -0400
committerPaul Gilbert2016-07-15 19:19:15 -0400
commitf02efd2d9e762c9f79e983603b5684e5eb357496 (patch)
treee636ab2b865429ee7828f706c55fccb0ccc0b5f2 /engines
parent3196e488f196a6c33f89eea389cf8d9a90d5f90d (diff)
downloadscummvm-rg350-f02efd2d9e762c9f79e983603b5684e5eb357496.tar.gz
scummvm-rg350-f02efd2d9e762c9f79e983603b5684e5eb357496.tar.bz2
scummvm-rg350-f02efd2d9e762c9f79e983603b5684e5eb357496.zip
TITANIC: Beginnings of TTquotes class
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/module.mk1
-rw-r--r--engines/titanic/true_talk/tt_quotes.cpp86
-rw-r--r--engines/titanic/true_talk/tt_quotes.h61
3 files changed, 148 insertions, 0 deletions
diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index c97b30f7b0..2b604ec29d 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_quotes.o \
true_talk/tt_response.o \
true_talk/tt_room_script.o \
true_talk/tt_script_base.o \
diff --git a/engines/titanic/true_talk/tt_quotes.cpp b/engines/titanic/true_talk/tt_quotes.cpp
new file mode 100644
index 0000000000..ced7f8e454
--- /dev/null
+++ b/engines/titanic/true_talk/tt_quotes.cpp
@@ -0,0 +1,86 @@
+/* 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 "common/algorithm.h"
+#include "titanic/true_talk/tt_quotes.h"
+
+namespace Titanic {
+
+TTquotes::TTquotes() {
+ Common::fill(&_array[0], &_array[256], 0);
+ _dataP = nullptr;
+ _field540 = 0;
+ _field544 = 0;
+}
+
+TTquotes::~TTquotes() {
+ for (int idx = 0; idx < 26; ++idx)
+ delete _alphabet[idx]._dataP;
+
+ delete _dataP;
+}
+
+void TTquotes::load(const CString &name) {
+ // TODO
+}
+
+int TTquotes::read(const char *str) {
+ if (!str || !*str)
+ return 0;
+
+ // Find start and end of string
+ const char *startP = str, *endP = str;
+ while (*endP)
+ ++endP;
+
+ do {
+ int result = read(startP, endP);
+ if (result)
+ return result;
+
+ // Move to next following space or end of string
+ while (*startP && *startP != ' ')
+ ++startP;
+ // If it's a space, then move past it to start of next word
+ while (*startP && *startP == ' ')
+ ++startP;
+
+ } while (*startP);
+
+ return 0;
+}
+
+int TTquotes::read(const char *startP, const char *endP) {
+ int size = endP - startP;
+ if (size < 3)
+ return 0;
+
+ uint index = MIN((uint)(*startP - 'a'), (uint)25);
+ TTquotesEntry &entry = _alphabet[index];
+ if (!entry._dataP || entry._field4 <= 0)
+ return 0;
+
+ // TODO
+ return 0;
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/true_talk/tt_quotes.h b/engines/titanic/true_talk/tt_quotes.h
new file mode 100644
index 0000000000..2af612ca32
--- /dev/null
+++ b/engines/titanic/true_talk/tt_quotes.h
@@ -0,0 +1,61 @@
+/* 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_QUOTES_H
+#define TITANIC_TT_QUOTES_H
+
+#include "common/scummsys.h"
+#include "titanic/support/string.h"
+
+namespace Titanic {
+
+class TTquotes {
+ struct TTquotesEntry {
+ byte *_dataP;
+ int _field4;
+ int _field8;
+
+ TTquotesEntry() : _dataP(nullptr), _field4(0), _field8(0) {}
+ };
+private:
+ TTquotesEntry _alphabet[26];
+ uint _array[256];
+ byte *_dataP;
+ int _field540;
+ int _field544;
+private:
+ int read(const char *startP, const char *endP);
+public:
+ TTquotes();
+ ~TTquotes();
+
+ /**
+ * Load quotes from the specified resource
+ */
+ void load(const CString &name);
+
+ int read(const char *str);
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_TT_QUOTES_H */