aboutsummaryrefslogtreecommitdiff
path: root/devtools
diff options
context:
space:
mode:
authorEugene Sandulenko2016-08-01 00:27:28 +0300
committerGitHub2016-08-01 00:27:28 +0300
commit9d3a2c1c7f9365f65908f583e62047830f60693d (patch)
treed7ba49593a1e3d79f17b350e700b1fbcf71f5b22 /devtools
parent567054d8298a013f93dd9e0e332e2a08402b10a6 (diff)
parent19f8a0965be832a71a101054748cf000adf16add (diff)
downloadscummvm-rg350-9d3a2c1c7f9365f65908f583e62047830f60693d.tar.gz
scummvm-rg350-9d3a2c1c7f9365f65908f583e62047830f60693d.tar.bz2
scummvm-rg350-9d3a2c1c7f9365f65908f583e62047830f60693d.zip
Merge pull request #786 from dreammaster/titanic
TITANIC: Starship Titanic engine
Diffstat (limited to 'devtools')
-rw-r--r--devtools/create_titanic/create_titanic_dat.cpp758
-rw-r--r--devtools/create_titanic/file.h215
-rw-r--r--devtools/create_titanic/hash-str.h86
-rw-r--r--devtools/create_titanic/hashmap.cpp109
-rw-r--r--devtools/create_titanic/hashmap.h637
-rw-r--r--devtools/create_titanic/memorypool.cpp182
-rw-r--r--devtools/create_titanic/memorypool.h162
-rw-r--r--devtools/create_titanic/module.mk22
-rw-r--r--devtools/create_titanic/script_preresponses.cpp156
-rw-r--r--devtools/create_titanic/script_preresponses.h37
-rw-r--r--devtools/create_titanic/script_quotes.cpp457
-rw-r--r--devtools/create_titanic/script_quotes.h38
-rw-r--r--devtools/create_titanic/script_ranges.cpp1804
-rw-r--r--devtools/create_titanic/script_ranges.h39
-rw-r--r--devtools/create_titanic/script_responses.cpp629
-rw-r--r--devtools/create_titanic/script_responses.h32
-rw-r--r--devtools/create_titanic/script_states.cpp548
-rw-r--r--devtools/create_titanic/script_states.h43
-rw-r--r--devtools/create_titanic/str.cpp786
-rw-r--r--devtools/create_titanic/str.h386
-rw-r--r--devtools/create_titanic/tag_maps.cpp391
-rw-r--r--devtools/create_titanic/tag_maps.h37
-rw-r--r--devtools/create_titanic/winexe.cpp83
-rw-r--r--devtools/create_titanic/winexe.h70
-rw-r--r--devtools/create_titanic/winexe_pe.cpp260
-rw-r--r--devtools/create_titanic/winexe_pe.h120
26 files changed, 8087 insertions, 0 deletions
diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp
new file mode 100644
index 0000000000..2fe6679822
--- /dev/null
+++ b/devtools/create_titanic/create_titanic_dat.cpp
@@ -0,0 +1,758 @@
+/* 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.
+ *
+ */
+
+ // Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+// HACK to allow building with the SDL backend on MinGW
+// see bug #1800764 "TOOLS: MinGW tools building broken"
+#ifdef main
+#undef main
+#endif // main
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "common/language.h"
+#include "common/rect.h"
+#include "winexe_pe.h"
+#include "file.h"
+#include "script_preresponses.h"
+#include "script_quotes.h"
+#include "script_responses.h"
+#include "script_ranges.h"
+#include "script_states.h"
+#include "tag_maps.h"
+
+/**
+ * Format of the access.dat file that will be created:
+ * 4 Bytes - Magic string 'SVTN' to identify valid data file
+ * 2 bytes - Version number
+ *
+ * Following is a series of index entries with the following fields:
+ * 4 bytes - offset in file of entry
+ * 4 bytes - size of entry in the file
+ * ASCIIZ - name of the resource
+ */
+
+#define VERSION_NUMBER 1
+#define HEADER_SIZE 0xD00
+
+Common::File inputFile, outputFile;
+Common::PEResources res;
+uint headerOffset = 6;
+uint dataOffset = HEADER_SIZE;
+#define SEGMENT_OFFSET 0x401C00
+
+const int FILE_DIFF = 0x401C00;
+
+static const char *const ITEM_NAMES[46] = {
+ "LeftArmWith", "LeftArmWithout", "RightArmWith", "RightArmWithout", "BridgeRed",
+ "BridgeYellow", "BridgeBlue", "BridgeGreen", "Parrot", "CentralCore", "BrainGreen",
+ "BrainYellow", "BrainRed", "BrainBlue", "ChickenGreasy", "ChickenPlain", "ChickenPurple",
+ "ChickenRed", "ChickenYellow", "CrushedTV", "Ear", "Ear1", "Eyeball", "Eyeball1",
+ "Feather", "Lemon", "GlassEmpty", "GlassPurple", "GlassRed", "GlassYellow", "Hammer",
+ "Hose", "HoseEnd", "LiftHead", "LongStick", "Magazine", "Mouth", "MusicKey", "Napkin",
+ "Nose", "Perch", "PhonoCylinder", "PhonoCylinder1", "PhonoCylinder2", "PhonoCylinder3",
+ "Photo"
+};
+
+static const char *const ITEM_DESCRIPTIONS[46] = {
+ "The Maitre d'Bot's left arm holding a key", "The Maitre d'Bot's left arm",
+ "The Maitre d'Bot's right arm holding Titania's auditory center",
+ "The Maitre d'Bot's right arm", "Red Fuse", "Yellow Fuse", "Blue Fuse",
+ "Green Fuse", "The Parrot", "Titania's central intelligence core",
+ "Titania's auditory center", "Titania's olfactory center",
+ "Titania's speech center", "Titania's vision center", "rather greasy chicken",
+ "very plain chicken", "chicken smeared with starling pur$e",
+ "chicken covered with tomato sauce", "chicken coated in mustard sauce",
+ "A crushed television set", "Titania's ear", "Titania's ear", "Titania's eye",
+ "Titania's eye", "A parrot feather", "A nice fat juicy lemon",
+ "An empty beer glass", "A beer glass containing pur$ed flock of starlings",
+ "A beer glass containing tomato sauce", "A beer glass containing mustard sauce",
+ "A hammer", "A hose", "The other end of a hose", "The LiftBot's head",
+ "A rather long stick", "A magazine", "Titania's mouth", "A key",
+ "A super-absorbent napkin", "Titania's nose", "A perch", "A phonograph cylinder",
+ "A phonograph cylinder", "A phonograph cylinder", "A phonograph cylinder",
+ "A photograph"
+};
+
+static const char *const ITEM_IDS[40] = {
+ "MaitreD Left Arm", "MaitreD Right Arm", "OlfactoryCentre", "AuditoryCentre",
+ "SpeechCentre", "VisionCentre", "CentralCore", "Perch", "SeasonBridge",
+ "FanBridge", "BeamBridge", "ChickenBridge", "CarryParrot", "Chicken",
+ "CrushedTV", "Feathers", "Lemon", "BeerGlass", "BigHammer", "Ear1", "Ear 2",
+ "Eye1", "Eye2", "Mouth", "Nose", "NoseSpare", "Hose", "DeadHoseSpare",
+ "HoseEnd", "DeadHoseEndSpare", "BrokenLiftbotHead", "LongStick", "Magazine",
+ "Napkin", "Phonograph Cylinder", "Phonograph Cylinder 1", "Phonograph Cylinder 2",
+ "Phonograph Cylinder 3", "Photograph", "Music System Key"
+};
+
+static const char *const ROOM_NAMES[34] = {
+ "1stClassLobby", "1stClassRestaurant", "1stClassState",
+ "2ndClassLobby", "secClassState", "Arboretum", "FrozenArboretum",
+ "Bar", "BilgeRoom", "BilgeRoomWith", "BottomOfWell", "Bridge",
+ "CreatorsChamber", "CreatorsChamberOn", "Dome", "Home", "Lift",
+ "EmbLobby", "MoonEmbLobby", "MusicRoomLobby", "MusicRoom",
+ "ParrotLobby", "Pellerator", "PromenadeDeck", "SculptureChamber",
+ "SecClassLittleLift", "ServiceElevator", "SGTLeisure", "SGTLittleLift",
+ "SgtLobby", "SGTState", "Titania", "TopOfWell", "PlayersRoom"
+};
+
+struct NumberEntry {
+ const char *_text;
+ int _value;
+ uint _flags;
+};
+
+const NumberEntry NUMBERS[76] = {
+ { "a", 1, 3 },
+ { "and", 0, 1 },
+ { "negative", 0, 10 },
+ { "minus", 0, 10 },
+ { "below zeor", 0, 8 },
+ { "degrees below zero", 0, 8 },
+ { "nil", 0, 2 },
+ { "zero", 0, 2 },
+ { "one", 1, 0x12 },
+ { "two", 2, 0x12 },
+ { "three", 3, 0x12 },
+ { "four", 4, 0x12 },
+ { "five", 5, 0x12 },
+ { "six", 6, 0x12 },
+ { "seven", 7, 0x12 },
+ { "eight", 8, 0x12 },
+ { "nine", 9, 0x12 },
+ { "0", 0, 2 },
+ { "1", 1, 2 },
+ { "2", 2, 2 },
+ { "3", 3, 2 },
+ { "4", 4, 2 },
+ { "5", 5, 2 },
+ { "6", 6, 2 },
+ { "7", 7, 2 },
+ { "8", 8, 2 },
+ { "9", 9, 2 },
+ { "first", 1, 2 },
+ { "second", 2, 2 },
+ { "third", 3, 2 },
+ { "fourth", 4, 2 },
+ { "fifth", 5, 2 },
+ { "sixth", 6, 2 },
+ { "seventh", 7, 2 },
+ { "eighth", 8, 2 },
+ { "ninth", 9, 2 },
+ { "ten", 10, 2 },
+ { "eleven", 11, 2 },
+ { "twelve", 12, 2 },
+ { "thirteen", 13, 2 },
+ { "fourteen", 14, 2 },
+ { "fifteen", 15, 2 },
+ { "sixteen", 16, 2 },
+ { "seventeen", 17, 2 },
+ { "eighteen", 18, 2 },
+ { "nineteen", 19, 2 },
+ { "tenth", 10, 2 },
+ { "eleventh", 11, 2 },
+ { "twelfth", 12, 2 },
+ { "thirteenth", 13, 2 },
+ { "fourteenth", 14, 2 },
+ { "fifteenth", 15, 2 },
+ { "sixteenth", 16, 2 },
+ { "seventeenth", 17, 2 },
+ { "eighteenth", 18, 2 },
+ { "nineteenth", 19, 2 },
+ { "twenty", 20, 0x12 },
+ { "thirty", 30, 0x12 },
+ { "forty", 40, 0x12 },
+ { "fourty", 40, 0x12 },
+ { "fifty", 50, 0x12 },
+ { "sixty", 60, 0x12 },
+ { "seventy", 70, 0x12 },
+ { "eighty", 80, 0x12 },
+ { "ninety", 90, 0x12 },
+ { "twentieth", 20, 2 },
+ { "thirtieth", 30, 2 },
+ { "fortieth", 40, 2 },
+ { "fiftieth", 50, 2 },
+ { "sixtieth", 60, 2 },
+ { "seventieth", 70, 2 },
+ { "eightieth", 80, 2 },
+ { "ninetieth", 90, 2 },
+ { "hundred", 100, 4 },
+ { "hundredth", 100, 6 }
+};
+
+struct CommonPhrase {
+ const char *_str;
+ uint _dialogueId;
+ uint _roomNum;
+ uint _val1;
+};
+
+static const CommonPhrase BELLBOT_COMMON_PHRASES[] = {
+ { "what is wrong with her", 0x30FF9, 0x7B, 0 },
+ { "what is wrong with titania", 0x30FF9, 0x7B, 0 },
+ { "something for the weekend", 0x30D8B, 0x00, 0 },
+ { "other food", 0x30E1D, 0x00, 3 },
+ { "different food", 0x30E1D, 0x00, 3 },
+ { "alternative food", 0x30E1D, 0x00, 3 },
+ { "decent food", 0x30E1D, 0x00, 3 },
+ { "nice food", 0x30E1D, 0x00, 3 },
+ { "nicer food", 0x30E1D, 0x00, 3 },
+ { "make me happy", 0x31011, 0x00, 0 },
+ { "cheer me up", 0x31011, 0x00, 0 },
+ { "help me if im unhappy", 0x31011, 0x00, 0 },
+ { "i obtain a better room", 0x30E8A, 0x00, 3 },
+ { "i obtain a better room", 0x30E8A, 0x00, 2 },
+ { "i get a better room", 0x30E8A, 0x00, 3 },
+ { "i get a better room", 0x30E8A, 0x00, 2 },
+ { "i want a better room", 0x30E8A, 0x00, 3 },
+ { "i want a better room", 0x30E8A, 0x00, 2 },
+ { "i understood", 0x30D75, 0x6D, 0 },
+ { "i knew", 0x30D75, 0x6D, 0 },
+ { "i know", 0x30D75, 0x6D, 0 },
+ { "not stupid", 0x30D75, 0x6D, 0 },
+ { "cheeky", 0x30D75, 0x6D, 0 },
+ { "not help", 0x30D6F, 0x6D, 0 },
+ { "not helpful", 0x30D6F, 0x6D, 0 },
+ { "dont help", 0x30D6F, 0x6D, 0 },
+ { "no help", 0x30D6F, 0x6D, 0 },
+ { "sorry", 0x30D76, 0x6D, 0 },
+ { "not mean that", 0x30D76, 0x6D, 0 },
+ { "didnt mean that", 0x30D76, 0x6D, 0 },
+ { "apologise", 0x30D76, 0x6D, 0 },
+ { "play golf", 0x313B6, 0x00, 0 },
+ { "is not the captain meant to go down with the ship", 0x31482, 0x00, 0 },
+ { "is not the captain supposed to go down with the ship", 0x31482, 0x00, 0 },
+ { "sauce sticks to the chicken", 0x3156B, 0x00, 0 },
+ { "sauce gets stuck to the chicken", 0x3156B, 0x00, 0 },
+ { nullptr, 0, 0, 0 }
+};
+
+
+void NORETURN_PRE error(const char *s, ...) {
+ printf("%s\n", s);
+ exit(1);
+}
+
+void writeEntryHeader(const char *name, uint offset, uint size) {
+ assert(headerOffset < HEADER_SIZE);
+ outputFile.seek(headerOffset);
+ outputFile.writeLong(offset);
+ outputFile.writeLong(size);
+ outputFile.writeString(name);
+
+ headerOffset += 8 + strlen(name) + 1;
+}
+
+void writeFinalEntryHeader() {
+ assert(headerOffset <= (HEADER_SIZE - 8));
+ outputFile.seek(headerOffset);
+ outputFile.writeLong(0);
+ outputFile.writeLong(0);
+}
+
+void writeStringArray(const char *name, uint offset, int count) {
+ outputFile.seek(dataOffset);
+
+ inputFile.seek(offset);
+ uint *offsets = new uint[count];
+ for (int idx = 0; idx < count; ++idx)
+ offsets[idx] = inputFile.readLong();
+
+ // Iterate through reading each string
+ for (int idx = 0; idx < count; ++idx) {
+ if (offsets[idx]) {
+ inputFile.seek(offsets[idx] - SEGMENT_OFFSET);
+ outputFile.writeString(inputFile);
+ } else {
+ outputFile.writeString("");
+ }
+ }
+
+ uint size = outputFile.size() - dataOffset;
+ writeEntryHeader(name, dataOffset, size);
+ dataOffset += size;
+
+ delete[] offsets;
+}
+
+void writeStringArray(const char *name, const char *const *strings, int count) {
+ outputFile.seek(dataOffset);
+
+ // Iterate through writing each string
+ for (int idx = 0; idx < count; ++idx) {
+ outputFile.writeString(strings[idx]);
+ }
+
+ uint size = outputFile.size() - dataOffset;
+ writeEntryHeader(name, dataOffset, size);
+ dataOffset += size;
+}
+
+Common::WinResourceID getResId(uint id) {
+ return Common::WinResourceID(id);
+}
+
+Common::WinResourceID getResId(const char *id) {
+ if (!strcmp(id, "Bitmap"))
+ return Common::WinResourceID(2);
+
+ return Common::WinResourceID(id);
+}
+
+void writeResource(const char *name, Common::File *file) {
+ outputFile.seek(dataOffset);
+ outputFile.write(*file, file->size());
+
+ writeEntryHeader(name, dataOffset, file->size());
+ dataOffset += file->size();
+ delete file;
+}
+
+void writeResource(const char *sectionStr, uint32 resId) {
+ char nameBuffer[256];
+ sprintf(nameBuffer, "%s/%u", sectionStr, resId);
+
+ Common::File *file = res.getResource(getResId(sectionStr), resId);
+ assert(file);
+ writeResource(nameBuffer, file);
+}
+
+void writeResource(const char *sectionStr, const char *resId) {
+ char nameBuffer[256];
+ sprintf(nameBuffer, "%s/%s", sectionStr, resId);
+
+ Common::File *file = res.getResource(getResId(sectionStr),
+ Common::WinResourceID(resId));
+ assert(file);
+ writeResource(nameBuffer, file);
+}
+
+void writeBitmap(const char *name, Common::File *file) {
+ outputFile.seek(dataOffset);
+
+ // Write out the necessary bitmap header so that the ScummVM
+ // BMP decoder can properly handle decoding the bitmaps
+ outputFile.write("BM", 2);
+ outputFile.writeLong(file->size() + 14); // Filesize
+ outputFile.writeLong(0); // res1 & res2
+ outputFile.writeLong(0x436); // image offset
+
+ outputFile.write(*file, file->size() + 14);
+
+ writeEntryHeader(name, dataOffset, file->size() + 14);
+ dataOffset += file->size() + 14;
+ delete file;
+}
+
+void writeBitmap(const char *sectionStr, const char *resId) {
+ char nameBuffer[256];
+ sprintf(nameBuffer, "%s/%s", sectionStr, resId);
+
+ Common::File *file = res.getResource(getResId(sectionStr),
+ Common::WinResourceID(resId));
+ assert(file);
+ writeBitmap(nameBuffer, file);
+}
+
+void writeBitmap(const char *sectionStr, uint32 resId) {
+ char nameBuffer[256];
+ sprintf(nameBuffer, "%s/%u", sectionStr, resId);
+
+ Common::File *file = res.getResource(getResId(sectionStr),
+ Common::WinResourceID(resId));
+ assert(file);
+ writeBitmap(nameBuffer, file);
+}
+
+void writeNumbers() {
+ outputFile.seek(dataOffset);
+
+ // Iterate through writing each string
+ for (int idx = 0; idx < 76; ++idx) {
+ outputFile.writeString(NUMBERS[idx]._text);
+ outputFile.writeLong(NUMBERS[idx]._value);
+ outputFile.writeLong(NUMBERS[idx]._flags);
+ }
+
+ uint size = outputFile.size() - dataOffset;
+ writeEntryHeader("TEXT/NUMBERS", dataOffset, size);
+ dataOffset += size;
+}
+
+void writeString(uint offset) {
+ inputFile.seek(offset - FILE_DIFF);
+ char c;
+ do {
+ c = inputFile.readByte();
+ outputFile.writeByte(c);
+ } while (c);
+}
+
+void writeResponseTree() {
+ outputFile.seek(dataOffset);
+
+ inputFile.seek(0x619500 - FILE_DIFF);
+ char buffer[32];
+ inputFile.read(buffer, 32);
+ if (strcmp(buffer, "ReadInt(): No number to read")) {
+ printf("Could not find tree data at expected position\n");
+ exit(1);
+ }
+
+ for (int idx = 0; idx < 1022; ++idx) {
+ inputFile.seek(0x619520 - FILE_DIFF + idx * 8);
+ uint id = inputFile.readLong();
+ uint offset = inputFile.readLong();
+
+ outputFile.writeLong(id);
+ if (!id) {
+ // An end of list id
+ } else if (offset >= 0x619520 && offset <= 0x61B510) {
+ // Offset to another table
+ outputFile.writeByte(0);
+ outputFile.writeLong((offset - 0x619520) / 8);
+ } else {
+ // Offset to ASCIIZ string
+ outputFile.writeByte(1);
+ writeString(offset);
+ }
+ }
+
+ uint size = outputFile.size() - dataOffset;
+ writeEntryHeader("TEXT/TREE", dataOffset, size);
+ dataOffset += size;
+}
+
+void writeSentenceEntries(const char *name, uint tableOffset) {
+ outputFile.seek(dataOffset);
+
+ uint v1, v2, v4, v9, v11, v12, v13;
+ uint offset3, offset5, offset6, offset7, offset8, offset10;
+
+ for (uint idx = 0; ; ++idx) {
+ inputFile.seek(tableOffset - FILE_DIFF + idx * 0x34);
+ v1 = inputFile.readLong();
+ if (!v1)
+ // Reached end of list
+ break;
+
+ // Read data fields
+ v2 = inputFile.readLong();
+ offset3 = inputFile.readLong();
+ v4 = inputFile.readLong();
+ offset5 = inputFile.readLong();
+ offset6 = inputFile.readLong();
+ offset7 = inputFile.readLong();
+ offset8 = inputFile.readLong();
+ v9 = inputFile.readLong();
+ offset10 = inputFile.readLong();
+ v11 = inputFile.readLong();
+ v12 = inputFile.readLong();
+ v13 = inputFile.readLong();
+
+ outputFile.writeLong(v1);
+ outputFile.writeLong(v2);
+ writeString(offset3);
+ outputFile.writeLong(v1);
+ writeString(offset5);
+ writeString(offset6);
+ writeString(offset7);
+ writeString(offset8);
+ outputFile.writeLong(v9);
+ writeString(offset10);
+ outputFile.writeLong(v11);
+ outputFile.writeLong(v12);
+ outputFile.writeLong(v13);
+ }
+
+ uint size = outputFile.size() - dataOffset;
+ writeEntryHeader(name, dataOffset, size);
+ dataOffset += size;
+}
+
+void writeWords(const char *name, uint tableOffset, int recordCount = 2) {
+ outputFile.seek(dataOffset);
+ int recordSize = recordCount * 4;
+
+ uint val, strOffset;
+ for (uint idx = 0; ; ++idx) {
+ inputFile.seek(tableOffset - FILE_DIFF + idx * recordSize);
+ val = inputFile.readLong();
+ strOffset = inputFile.readLong();
+
+ if (!val)
+ // Reached end of list
+ break;
+
+ outputFile.writeLong(val);
+ writeString(strOffset);
+ }
+
+ uint size = outputFile.size() - dataOffset;
+ writeEntryHeader(name, dataOffset, size);
+ dataOffset += size;
+}
+
+void writeSentenceMappings(const char *name, uint offset, int numValues) {
+ inputFile.seek(offset - FILE_DIFF);
+ outputFile.seek(dataOffset);
+
+ uint id;
+ while ((id = inputFile.readLong()) != 0) {
+ outputFile.writeLong(id);
+
+ for (int ctr = 0; ctr < numValues; ++ctr)
+ outputFile.writeLong(inputFile.readLong());
+ }
+
+ uint size = outputFile.size() - dataOffset;
+ writeEntryHeader(name, dataOffset, size);
+ dataOffset += size;
+}
+
+void writeStarfieldPoints() {
+ outputFile.seek(dataOffset);
+
+ inputFile.seek(0x59DE4C - FILE_DIFF);
+ uint size = 876 * 12;
+
+ outputFile.write(inputFile, size);
+ writeEntryHeader("STARFIELD/POINTS", dataOffset, size);
+ dataOffset += size;
+}
+
+void writeStarfieldPoints2() {
+ outputFile.seek(dataOffset);
+
+ for (int rootCtr = 0; rootCtr < 80; ++rootCtr) {
+ inputFile.seek(0x5A2F28 - FILE_DIFF + rootCtr * 8);
+ uint offset = inputFile.readUint32LE();
+ uint count = inputFile.readUint32LE();
+
+ outputFile.writeLong(count);
+ inputFile.seek(offset - FILE_DIFF);
+ outputFile.write(inputFile, count * 4 * 4);
+ }
+
+ uint size = outputFile.size() - dataOffset;
+ outputFile.write(inputFile, size);
+ writeEntryHeader("STARFIELD/POINTS2", dataOffset, size);
+ dataOffset += size;
+}
+
+void writePhrases(const char *name, const CommonPhrase *phrases) {
+ for (uint idx = 0; phrases->_str; ++idx, ++phrases) {
+ outputFile.seek(dataOffset + idx * 4);
+ outputFile.writeString(phrases->_str);
+ outputFile.writeLong(phrases->_dialogueId);
+ outputFile.writeLong(phrases->_roomNum);
+ outputFile.writeLong(phrases->_val1);
+ }
+
+ uint size = outputFile.size() - dataOffset;
+ writeEntryHeader("Phrases/Bellbot", dataOffset, size);
+ dataOffset += size;
+}
+
+void writeHeader() {
+ // Write out magic string
+ const char *MAGIC_STR = "SVTN";
+ outputFile.write(MAGIC_STR, 4);
+
+ // Write out version number
+ outputFile.writeWord(VERSION_NUMBER);
+}
+
+void writeData() {
+ writeBitmap("Bitmap", "BACKDROP");
+ writeBitmap("Bitmap", "EVILTWIN");
+ writeBitmap("Bitmap", "RESTORED");
+ writeBitmap("Bitmap", "RESTOREF");
+ writeBitmap("Bitmap", "RESTOREU");
+ writeBitmap("Bitmap", "STARTD");
+ writeBitmap("Bitmap", "STARTF");
+ writeBitmap("Bitmap", "STARTU");
+ writeBitmap("Bitmap", "TITANIC");
+ writeBitmap("Bitmap", 133);
+ writeBitmap("Bitmap", 164);
+ writeBitmap("Bitmap", 165);
+
+ writeResource("STFONT", 149);
+ writeResource("STFONT", 151);
+ writeResource("STFONT", 152);
+ writeResource("STFONT", 153);
+
+ writeResource("STARFIELD", 132);
+ writeStarfieldPoints();
+ writeStarfieldPoints2();
+
+ writeResource("TEXT", "STVOCAB.TXT");
+ writeResource("TEXT", "JRQUOTES.TXT");
+ writeResource("TEXT", 155);
+
+ writeStringArray("TEXT/ITEM_DESCRIPTIONS", ITEM_DESCRIPTIONS, 46);
+ writeStringArray("TEXT/ITEM_NAMES", ITEM_NAMES, 46);
+ writeStringArray("TEXT/ITEM_IDS", ITEM_IDS, 40);
+ writeStringArray("TEXT/ROOM_NAMES", ROOM_NAMES, 34);
+
+ writeStringArray("TEXT/PHRASES", 0x21B7C8, 376);
+ writeStringArray("TEXT/REPLACEMENTS1", 0x21BDB0, 218);
+ writeStringArray("TEXT/REPLACEMENTS2", 0x21C120, 1576);
+ writeStringArray("TEXT/REPLACEMENTS3", 0x21D9C8, 82);
+ writeStringArray("TEXT/PRONOUNS", 0x22F718, 15);
+
+ writeSentenceEntries("Sentences/Default", 0x5C0130);
+ writeSentenceEntries("Sentences/Barbot", 0x5ABE60);
+ writeSentenceEntries("Sentences/Barbot2", 0x5BD4E8);
+ writeSentenceEntries("Sentences/Bellbot", 0x5C2230);
+ writeSentenceEntries("Sentences/Bellbot/1", 0x5D1670);
+ writeSentenceEntries("Sentences/Bellbot/2", 0x5D1A80);
+ writeSentenceEntries("Sentences/Bellbot/3", 0x5D1AE8);
+ writeSentenceEntries("Sentences/Bellbot/4", 0x5D1B88);
+ writeSentenceEntries("Sentences/Bellbot/5", 0x5D2A60);
+ writeSentenceEntries("Sentences/Bellbot/6", 0x5D2CD0);
+ writeSentenceEntries("Sentences/Bellbot/7", 0x5D3488);
+ writeSentenceEntries("Sentences/Bellbot/8", 0x5D3900);
+ writeSentenceEntries("Sentences/Bellbot/9", 0x5D3968);
+ writeSentenceEntries("Sentences/Bellbot/10", 0x5D4668);
+ writeSentenceEntries("Sentences/Bellbot/11", 0x5D47A0);
+ writeSentenceEntries("Sentences/Bellbot/12", 0x5D4EC0);
+ writeSentenceEntries("Sentences/Bellbot/13", 0x5D5100);
+ writeSentenceEntries("Sentences/Bellbot/14", 0x5D5370);
+ writeSentenceEntries("Sentences/Bellbot/15", 0x5D5548);
+ writeSentenceEntries("Sentences/Bellbot/16", 0x5D56B8);
+ writeSentenceEntries("Sentences/Bellbot/17", 0x5D57C0);
+ writeSentenceEntries("Sentences/Bellbot/18", 0x5D5B38);
+ writeSentenceEntries("Sentences/Bellbot/19", 0x5D61B8);
+
+ writeSentenceEntries("Sentences/Deskbot", 0x5DCD10);
+ writeSentenceEntries("Sentences/Deskbot/2", 0x5E8E18);
+ writeSentenceEntries("Sentences/Deskbot/3", 0x5E8BA8);
+
+ writeSentenceEntries("Sentences/Doorbot", 0x5EC110);
+ writeSentenceEntries("Sentences/Doorbot/2", 0x5FD930);
+ writeSentenceEntries("Sentences/Doorbot/100", 0x5FD930);
+ writeSentenceEntries("Sentences/Doorbot/101", 0x5FE668);
+ writeSentenceEntries("Sentences/Doorbot/102", 0x5FDD40);
+ writeSentenceEntries("Sentences/Doorbot/107", 0x5FFF08);
+ writeSentenceEntries("Sentences/Doorbot/110", 0x5FE3C0);
+ writeSentenceEntries("Sentences/Doorbot/111", 0x5FF0C8);
+ writeSentenceEntries("Sentences/Doorbot/124", 0x5FF780);
+ writeSentenceEntries("Sentences/Doorbot/129", 0x5FFAC0);
+ writeSentenceEntries("Sentences/Doorbot/131", 0x5FFC30);
+ writeSentenceEntries("Sentences/Doorbot/132", 0x6000E0);
+
+ writeSentenceEntries("Sentences/Liftbot", 0x6026B0);
+ writeSentenceEntries("Sentences/MaitreD", 0x60CFD8);
+ writeSentenceEntries("Sentences/Parrot", 0x615858);
+ writeSentenceEntries("Sentences/SuccUBus", 0x616698);
+ writeSentenceMappings("Mappings/Barbot", 0x5B28A0, 8);
+ writeSentenceMappings("Mappings/Bellbot", 0x5CD830, 1);
+ writeSentenceMappings("Mappings/Deskbot", 0x5E2BB8, 4);
+ writeSentenceMappings("Mappings/Doorbot", 0x5F7950, 4);
+ writeSentenceMappings("Mappings/Liftbot", 0x608660, 4);
+ writeSentenceMappings("Mappings/MaitreD", 0x6125C8, 1);
+ writeSentenceMappings("Mappings/Parrot", 0x615B68, 1);
+ writeSentenceMappings("Mappings/SuccUBus", 0x6189F0, 1);
+ writeWords("Words/Barbot", 0x5BE2E0);
+ writeWords("Words/Bellbot", 0x5D8230);
+ writeWords("Words/Deskbot", 0x5EAAA8);
+ writeWords("Words/Doorbot", 0x601098, 3);
+ writeWords("Words/Liftbot", 0x60C788);
+ writePhrases("Phrases/Bellbot", BELLBOT_COMMON_PHRASES);
+
+ writeResponseTree();
+ writeNumbers();
+ writeAllScriptQuotes();
+ writeAllScriptResponses();
+ writeAllScriptRanges();
+ writeAllTagMappings();
+ writeAllUpdateStates();
+ writeAllScriptPreResponses();
+}
+
+void createScriptMap() {
+ Common::File inFile;
+ char line[80];
+ char c[2];
+ c[0] = c[1] = '\0';
+ int counter = 0;
+
+ inFile.open("d:\\temp\\map.txt");
+ printf("static const TagMapping xxxx_ID_MAP[] = {\n");
+
+ do {
+ strcpy(line, "");
+
+ while (!inFile.eof()) {
+ c[0] = inFile.readByte();
+ if (c[0] == '\n')
+ c[0] = ' ';
+ else if (c[0] == '\r')
+ continue;
+ strcat(line, c);
+ if (inFile.eof() || strlen(line) == (2 * 9))
+ break;
+ }
+
+ int v1, v2;
+ sscanf(line, "%x %x", &v1, &v2);
+
+ if (counter != 0 && (counter % 3) == 0)
+ printf("\r\n");
+ if ((counter % 3) == 0)
+ printf("\t");
+
+ printf("{ 0x%.5x, 0x%.5x }, ", v1, v2);
+ ++counter;
+ } while (!inFile.eof());
+
+ printf("};\r\n");
+ inFile.close();
+}
+
+int main(int argc, char *argv[]) {
+ if (argc != 3) {
+ printf("Format: %s ST.exe titanic.dat\n", argv[0]);
+ exit(0);
+ }
+
+ if (!inputFile.open(argv[1])) {
+ error("Could not open input file");
+ }
+ res.loadFromEXE(argv[1]);
+
+ if (!outputFile.open(argv[2], Common::kFileWriteMode)) {
+ error("Could not open output file");
+ }
+
+ writeHeader();
+ writeData();
+ writeFinalEntryHeader();
+
+ inputFile.close();
+ outputFile.close();
+ return 0;
+}
diff --git a/devtools/create_titanic/file.h b/devtools/create_titanic/file.h
new file mode 100644
index 0000000000..4580e83b19
--- /dev/null
+++ b/devtools/create_titanic/file.h
@@ -0,0 +1,215 @@
+/* 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 __FILE_H__
+#define __FILE_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+#include "common/scummsys.h"
+#include "common/endian.h"
+#include "common/algorithm.h"
+
+namespace Common {
+
+enum AccessMode {
+ kFileReadMode = 1,
+ kFileWriteMode = 2
+};
+
+class File {
+private:
+ ::FILE *_f;
+ const byte *_memPtr;
+ size_t _offset, _size;
+public:
+ File() : _f(nullptr), _memPtr(nullptr), _offset(0), _size(0) {}
+
+ bool open(const char *filename, AccessMode mode = kFileReadMode) {
+ _memPtr = nullptr;
+ _f = fopen(filename, (mode == kFileReadMode) ? "rb" : "wb+");
+ return (_f != NULL);
+ }
+ bool open(const byte *data, uint size) {
+ close();
+ _f = nullptr;
+ _memPtr = data;
+ _size = size;
+ return true;
+ }
+
+ void close() {
+ if (_f)
+ fclose(_f);
+ _f = nullptr;
+ delete[] _memPtr;
+ _memPtr = nullptr;
+ }
+ int seek(int offset, int whence = SEEK_SET) {
+ if (_f)
+ return fseek(_f, offset, whence);
+
+ switch (whence) {
+ case SEEK_SET:
+ _offset = offset;
+ break;
+ case SEEK_CUR:
+ _offset += offset;
+ break;
+ case SEEK_END:
+ _offset = _size + offset;
+ break;
+ default:
+ break;
+ }
+
+ return _offset;
+ }
+ void skip(int offset) {
+ if (_f)
+ fseek(_f, offset, SEEK_CUR);
+ else
+ _offset += offset;
+ }
+ long read(void *buffer, size_t len) {
+ if (_f)
+ return fread(buffer, 1, len, _f);
+
+ uint bytesToRead = CLIP(len, (size_t)0, _size - _offset);
+ memcpy(buffer, &_memPtr[_offset], bytesToRead);
+ _offset += bytesToRead;
+ return bytesToRead;
+ }
+ void write(const void *buffer, size_t len) {
+ assert(_f);
+ fwrite(buffer, 1, len, _f);
+ }
+ void write(File &src, size_t len) {
+ for (size_t idx = 0; idx < len; ++idx)
+ writeByte(src.readByte());
+ }
+ byte readByte() {
+ byte v;
+ read(&v, sizeof(byte));
+ return v;
+ }
+ uint16 readWord() {
+ uint16 v;
+ read(&v, sizeof(uint16));
+ return FROM_LE_16(v);
+ }
+ uint readLong() {
+ uint v;
+ read(&v, sizeof(uint));
+ return FROM_LE_32(v);
+ }
+
+ uint readUint16BE() {
+ uint16 v;
+ read(&v, sizeof(uint16));
+ return FROM_BE_16(v);
+ }
+ uint readUint16LE() {
+ uint16 v;
+ read(&v, sizeof(uint16));
+ return FROM_LE_16(v);
+ }
+ uint readUint32BE() {
+ uint32 v;
+ read(&v, sizeof(uint32));
+ return FROM_BE_32(v);
+ }
+ uint readUint32LE() {
+ uint32 v;
+ read(&v, sizeof(uint32));
+ return FROM_LE_32(v);
+ }
+
+ void writeByte(byte v) {
+ write(&v, sizeof(byte));
+ }
+ void writeByte(byte v, int len) {
+ byte *b = new byte[len];
+ memset(b, v, len);
+ write(b, len);
+ delete[] b;
+ }
+ void writeWord(uint16 v) {
+ uint16 vTemp = TO_LE_16(v);
+ write(&vTemp, sizeof(uint16));
+ }
+ void writeLong(uint v) {
+ uint vTemp = TO_LE_32(v);
+ write(&vTemp, sizeof(uint));
+ }
+ void writeString(const char *msg) {
+ if (!msg) {
+ writeByte(0);
+ } else {
+ do {
+ writeByte(*msg);
+ } while (*msg++);
+ }
+ }
+ void writeString(File &src) {
+ char c;
+ do {
+ c = src.readByte();
+ writeByte(c);
+ } while (c);
+ }
+ uint pos() const {
+ if (_f)
+ return ftell(_f);
+ else
+ return _offset;
+ }
+ uint size() const {
+ if (_f) {
+ uint currentPos = pos();
+ fseek(_f, 0, SEEK_END);
+ uint result = pos();
+ fseek(_f, currentPos, SEEK_SET);
+ return result;
+ } else if (_memPtr) {
+ return _size;
+ } else {
+ return 0;
+ }
+ }
+ bool eof() const {
+ if (_f)
+ return feof(_f) != 0;
+ else if (_memPtr)
+ return _offset >= _size;
+ return false;
+ }
+};
+
+}
+
+extern Common::File inputFile, outputFile;
+
+#endif
diff --git a/devtools/create_titanic/hash-str.h b/devtools/create_titanic/hash-str.h
new file mode 100644
index 0000000000..b9f6d503f8
--- /dev/null
+++ b/devtools/create_titanic/hash-str.h
@@ -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.
+ *
+ */
+
+#ifndef COMMON_HASH_STR_H
+#define COMMON_HASH_STR_H
+
+#include "hashmap.h"
+#include "str.h"
+
+namespace Common {
+
+uint hashit(const char *str);
+uint hashit_lower(const char *str); // Generate a hash based on the lowercase version of the string
+inline uint hashit(const String &str) { return hashit(str.c_str()); }
+inline uint hashit_lower(const String &str) { return hashit_lower(str.c_str()); }
+
+
+// FIXME: The following functors obviously are not consistently named
+
+struct CaseSensitiveString_EqualTo {
+ bool operator()(const String& x, const String& y) const { return x.equals(y); }
+};
+
+struct CaseSensitiveString_Hash {
+ uint operator()(const String& x) const { return hashit(x.c_str()); }
+};
+
+
+struct IgnoreCase_EqualTo {
+ bool operator()(const String& x, const String& y) const { return x.equalsIgnoreCase(y); }
+};
+
+struct IgnoreCase_Hash {
+ uint operator()(const String& x) const { return hashit_lower(x.c_str()); }
+};
+
+
+
+// Specalization of the Hash functor for String objects.
+// We do case sensitve hashing here, because that is what
+// the default EqualTo is compatible with. If one wants to use
+// case insensitve hashing, then only because one wants to use
+// IgnoreCase_EqualTo, and then one has to specify a custom
+// hash anyway.
+template<>
+struct Hash<String> {
+ uint operator()(const String& s) const {
+ return hashit(s.c_str());
+ }
+};
+
+template<>
+struct Hash<const char *> {
+ uint operator()(const char *s) const {
+ return hashit(s);
+ }
+};
+
+// String map -- by default case insensitive
+typedef HashMap<String, String, IgnoreCase_Hash, IgnoreCase_EqualTo> StringMap;
+
+
+
+} // End of namespace Common
+
+
+#endif
diff --git a/devtools/create_titanic/hashmap.cpp b/devtools/create_titanic/hashmap.cpp
new file mode 100644
index 0000000000..99840993ce
--- /dev/null
+++ b/devtools/create_titanic/hashmap.cpp
@@ -0,0 +1,109 @@
+/* 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.
+ *
+ */
+
+// The hash map (associative array) implementation in this file is
+// based on the PyDict implementation of CPython. The erase() method
+// is based on example code in the Wikipedia article on Hash tables.
+
+#include "common/hashmap.h"
+
+namespace Common {
+
+// Hash function for strings, taken from CPython.
+uint hashit(const char *p) {
+ uint hash = *p << 7;
+ byte c;
+ int size = 0;
+ while ((c = *p++)) {
+ hash = (1000003 * hash) ^ c;
+ size++;
+ }
+ return hash ^ size;
+}
+
+// Like hashit, but converts every char to lowercase before hashing.
+uint hashit_lower(const char *p) {
+ uint hash = tolower(*p) << 7;
+ byte c;
+ int size = 0;
+ while ((c = *p++)) {
+ hash = (1000003 * hash) ^ tolower(c);
+ size++;
+ }
+ return hash ^ size;
+}
+
+#ifdef DEBUG_HASH_COLLISIONS
+static double
+ g_collisions = 0,
+ g_dummyHits = 0,
+ g_lookups = 0,
+ g_collPerLook = 0,
+ g_capacity = 0,
+ g_size = 0;
+static int g_max_capacity = 0, g_max_size = 0;
+static int g_totalHashmaps = 0;
+static int g_stats[4] = {0,0,0,0};
+
+void updateHashCollisionStats(int collisions, int dummyHits, int lookups, int arrsize, int nele) {
+ g_collisions += collisions;
+ g_lookups += lookups;
+ g_dummyHits += dummyHits;
+ if (lookups)
+ g_collPerLook += (double)collisions / (double)lookups;
+ g_capacity += arrsize;
+ g_size += nele;
+ g_totalHashmaps++;
+
+ if (3*nele <= 2*8)
+ g_stats[0]++;
+ if (3*nele <= 2*16)
+ g_stats[1]++;
+ if (3*nele <= 2*32)
+ g_stats[2]++;
+ if (3*nele <= 2*64)
+ g_stats[3]++;
+
+ g_max_capacity = MAX(g_max_capacity, arrsize);
+ g_max_size = MAX(g_max_size, nele);
+
+ debug("%d hashmaps: colls %.1f; dummies hit %.1f, lookups %.1f; ratio %.3f%%; size %f (max: %d); capacity %f (max: %d)",
+ g_totalHashmaps,
+ g_collisions / g_totalHashmaps,
+ g_dummyHits / g_totalHashmaps,
+ g_lookups / g_totalHashmaps,
+ 100 * g_collPerLook / g_totalHashmaps,
+ g_size / g_totalHashmaps, g_max_size,
+ g_capacity / g_totalHashmaps, g_max_capacity);
+ debug(" %d less than %d; %d less than %d; %d less than %d; %d less than %d",
+ g_stats[0], 2*8/3,
+ g_stats[1],2*16/3,
+ g_stats[2],2*32/3,
+ g_stats[3],2*64/3);
+
+ // TODO:
+ // * Should record the maximal size of the map during its lifetime, not that at its death
+ // * Should do some statistics: how many maps are less than 2/3*8, 2/3*16, 2/3*32, ...
+}
+#endif
+
+} // End of namespace Common
diff --git a/devtools/create_titanic/hashmap.h b/devtools/create_titanic/hashmap.h
new file mode 100644
index 0000000000..c8691aeb42
--- /dev/null
+++ b/devtools/create_titanic/hashmap.h
@@ -0,0 +1,637 @@
+/* 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.
+ *
+ */
+
+// The hash map (associative array) implementation in this file is
+// based on the PyDict implementation of CPython.
+
+#ifndef COMMON_HASHMAP_H
+#define COMMON_HASHMAP_H
+
+/**
+ * @def DEBUG_HASH_COLLISIONS
+ * Enable the following #define if you want to check how many collisions the
+ * code produces (many collisions indicate either a bad hash function, or a
+ * hash table that is too small).
+ */
+//#define DEBUG_HASH_COLLISIONS
+
+/**
+ * @def USE_HASHMAP_MEMORY_POOL
+ * Enable the following define to let HashMaps use a memory pool for the
+ nodes they contain. * This increases memory usage, but also can improve
+ speed quite a bit.
+ */
+#define USE_HASHMAP_MEMORY_POOL
+
+
+#include "common/func.h"
+
+#ifdef DEBUG_HASH_COLLISIONS
+#include "common/debug.h"
+#endif
+
+#ifdef USE_HASHMAP_MEMORY_POOL
+#include "memorypool.h"
+#endif
+
+
+
+namespace Common {
+
+// The sgi IRIX MIPSpro Compiler has difficulties with nested templates.
+// This and the other __sgi conditionals below work around these problems.
+// The Intel C++ Compiler suffers from the same problems.
+#if (defined(__sgi) && !defined(__GNUC__)) || defined(__INTEL_COMPILER)
+template<class T> class IteratorImpl;
+#endif
+
+
+/**
+ * HashMap<Key,Val> maps objects of type Key to objects of type Val.
+ * For each used Key type, we need an "size_type hashit(Key,size_type)" function
+ * that computes a hash for the given Key object and returns it as an
+ * an integer from 0 to hashsize-1, and also an "equality functor".
+ * that returns true if if its two arguments are to be considered
+ * equal. Also, we assume that "=" works on Val objects for assignment.
+ *
+ * If aa is an HashMap<Key,Val>, then space is allocated each time aa[key] is
+ * referenced, for a new key. If the object is const, then an assertion is
+ * triggered instead. Hence if you are not sure whether a key is contained in
+ * the map, use contains() first to check for its presence.
+ */
+template<class Key, class Val, class HashFunc = Hash<Key>, class EqualFunc = EqualTo<Key> >
+class HashMap {
+public:
+ typedef uint size_type;
+
+private:
+
+ typedef HashMap<Key, Val, HashFunc, EqualFunc> HM_t;
+
+ struct Node {
+ const Key _key;
+ Val _value;
+ explicit Node(const Key &key) : _key(key), _value() {}
+ Node() : _key(), _value() {}
+ };
+
+ enum {
+ HASHMAP_PERTURB_SHIFT = 5,
+ HASHMAP_MIN_CAPACITY = 16,
+
+ // The quotient of the next two constants controls how much the
+ // internal storage of the hashmap may fill up before being
+ // increased automatically.
+ // Note: the quotient of these two must be between and different
+ // from 0 and 1.
+ HASHMAP_LOADFACTOR_NUMERATOR = 2,
+ HASHMAP_LOADFACTOR_DENOMINATOR = 3,
+
+ HASHMAP_MEMORYPOOL_SIZE = HASHMAP_MIN_CAPACITY * HASHMAP_LOADFACTOR_NUMERATOR / HASHMAP_LOADFACTOR_DENOMINATOR
+ };
+
+#ifdef USE_HASHMAP_MEMORY_POOL
+ ObjectPool<Node, HASHMAP_MEMORYPOOL_SIZE> _nodePool;
+#endif
+
+ Node **_storage; ///< hashtable of size arrsize.
+ size_type _mask; ///< Capacity of the HashMap minus one; must be a power of two of minus one
+ size_type _size;
+ size_type _deleted; ///< Number of deleted elements (_dummyNodes)
+
+ HashFunc _hash;
+ EqualFunc _equal;
+
+ /** Default value, returned by the const getVal. */
+ const Val _defaultVal;
+
+ /** Dummy node, used as marker for erased objects. */
+ #define HASHMAP_DUMMY_NODE ((Node *)1)
+
+#ifdef DEBUG_HASH_COLLISIONS
+ mutable int _collisions, _lookups, _dummyHits;
+#endif
+
+ Node *allocNode(const Key &key) {
+#ifdef USE_HASHMAP_MEMORY_POOL
+ return new (_nodePool) Node(key);
+#else
+ return new Node(key);
+#endif
+ }
+
+ void freeNode(Node *node) {
+ if (node && node != HASHMAP_DUMMY_NODE)
+#ifdef USE_HASHMAP_MEMORY_POOL
+ _nodePool.deleteChunk(node);
+#else
+ delete node;
+#endif
+ }
+
+ void assign(const HM_t &map);
+ size_type lookup(const Key &key) const;
+ size_type lookupAndCreateIfMissing(const Key &key);
+ void expandStorage(size_type newCapacity);
+
+#if !defined(__sgi) || defined(__GNUC__)
+ template<class T> friend class IteratorImpl;
+#endif
+
+ /**
+ * Simple HashMap iterator implementation.
+ */
+ template<class NodeType>
+ class IteratorImpl {
+ friend class HashMap;
+#if (defined(__sgi) && !defined(__GNUC__)) || defined(__INTEL_COMPILER)
+ template<class T> friend class Common::IteratorImpl;
+#else
+ template<class T> friend class IteratorImpl;
+#endif
+ protected:
+ typedef const HashMap hashmap_t;
+
+ size_type _idx;
+ hashmap_t *_hashmap;
+
+ protected:
+ IteratorImpl(size_type idx, hashmap_t *hashmap) : _idx(idx), _hashmap(hashmap) {}
+
+ NodeType *deref() const {
+ assert(_hashmap != 0);
+ assert(_idx <= _hashmap->_mask);
+ Node *node = _hashmap->_storage[_idx];
+ assert(node != 0);
+ assert(node != HASHMAP_DUMMY_NODE);
+ return node;
+ }
+
+ public:
+ IteratorImpl() : _idx(0), _hashmap(0) {}
+ template<class T>
+ IteratorImpl(const IteratorImpl<T> &c) : _idx(c._idx), _hashmap(c._hashmap) {}
+
+ NodeType &operator*() const { return *deref(); }
+ NodeType *operator->() const { return deref(); }
+
+ bool operator==(const IteratorImpl &iter) const { return _idx == iter._idx && _hashmap == iter._hashmap; }
+ bool operator!=(const IteratorImpl &iter) const { return !(*this == iter); }
+
+ IteratorImpl &operator++() {
+ assert(_hashmap);
+ do {
+ _idx++;
+ } while (_idx <= _hashmap->_mask && (_hashmap->_storage[_idx] == 0 || _hashmap->_storage[_idx] == HASHMAP_DUMMY_NODE));
+ if (_idx > _hashmap->_mask)
+ _idx = (size_type)-1;
+
+ return *this;
+ }
+
+ IteratorImpl operator++(int) {
+ IteratorImpl old = *this;
+ operator ++();
+ return old;
+ }
+ };
+
+public:
+ typedef IteratorImpl<Node> iterator;
+ typedef IteratorImpl<const Node> const_iterator;
+
+ HashMap();
+ HashMap(const HM_t &map);
+ ~HashMap();
+
+ HM_t &operator=(const HM_t &map) {
+ if (this == &map)
+ return *this;
+
+ // Remove the previous content and ...
+ clear();
+ delete[] _storage;
+ // ... copy the new stuff.
+ assign(map);
+ return *this;
+ }
+
+ bool contains(const Key &key) const;
+
+ Val &operator[](const Key &key);
+ const Val &operator[](const Key &key) const;
+
+ Val &getVal(const Key &key);
+ const Val &getVal(const Key &key) const;
+ const Val &getVal(const Key &key, const Val &defaultVal) const;
+ void setVal(const Key &key, const Val &val);
+
+ void clear(bool shrinkArray = 0);
+
+ void erase(iterator entry);
+ void erase(const Key &key);
+
+ size_type size() const { return _size; }
+
+ iterator begin() {
+ // Find and return the first non-empty entry
+ for (size_type ctr = 0; ctr <= _mask; ++ctr) {
+ if (_storage[ctr] && _storage[ctr] != HASHMAP_DUMMY_NODE)
+ return iterator(ctr, this);
+ }
+ return end();
+ }
+ iterator end() {
+ return iterator((size_type)-1, this);
+ }
+
+ const_iterator begin() const {
+ // Find and return the first non-empty entry
+ for (size_type ctr = 0; ctr <= _mask; ++ctr) {
+ if (_storage[ctr] && _storage[ctr] != HASHMAP_DUMMY_NODE)
+ return const_iterator(ctr, this);
+ }
+ return end();
+ }
+ const_iterator end() const {
+ return const_iterator((size_type)-1, this);
+ }
+
+ iterator find(const Key &key) {
+ size_type ctr = lookup(key);
+ if (_storage[ctr])
+ return iterator(ctr, this);
+ return end();
+ }
+
+ const_iterator find(const Key &key) const {
+ size_type ctr = lookup(key);
+ if (_storage[ctr])
+ return const_iterator(ctr, this);
+ return end();
+ }
+
+ // TODO: insert() method?
+
+ bool empty() const {
+ return (_size == 0);
+ }
+};
+
+//-------------------------------------------------------
+// HashMap functions
+
+/**
+ * Base constructor, creates an empty hashmap.
+ */
+template<class Key, class Val, class HashFunc, class EqualFunc>
+HashMap<Key, Val, HashFunc, EqualFunc>::HashMap()
+//
+// We have to skip _defaultVal() on PS2 to avoid gcc 3.2.2 ICE
+//
+#ifdef __PLAYSTATION2__
+ {
+#else
+ : _defaultVal() {
+#endif
+ _mask = HASHMAP_MIN_CAPACITY - 1;
+ _storage = new Node *[HASHMAP_MIN_CAPACITY];
+ assert(_storage != NULL);
+ memset(_storage, 0, HASHMAP_MIN_CAPACITY * sizeof(Node *));
+
+ _size = 0;
+ _deleted = 0;
+
+#ifdef DEBUG_HASH_COLLISIONS
+ _collisions = 0;
+ _lookups = 0;
+ _dummyHits = 0;
+#endif
+}
+
+/**
+ * Copy constructor, creates a full copy of the given hashmap.
+ * We must provide a custom copy constructor as we use pointers
+ * to heap buffers for the internal storage.
+ */
+template<class Key, class Val, class HashFunc, class EqualFunc>
+HashMap<Key, Val, HashFunc, EqualFunc>::HashMap(const HM_t &map) :
+ _defaultVal() {
+#ifdef DEBUG_HASH_COLLISIONS
+ _collisions = 0;
+ _lookups = 0;
+ _dummyHits = 0;
+#endif
+ assign(map);
+}
+
+/**
+ * Destructor, frees all used memory.
+ */
+template<class Key, class Val, class HashFunc, class EqualFunc>
+HashMap<Key, Val, HashFunc, EqualFunc>::~HashMap() {
+ for (size_type ctr = 0; ctr <= _mask; ++ctr)
+ freeNode(_storage[ctr]);
+
+ delete[] _storage;
+#ifdef DEBUG_HASH_COLLISIONS
+ extern void updateHashCollisionStats(int, int, int, int, int);
+ updateHashCollisionStats(_collisions, _dummyHits, _lookups, _mask+1, _size);
+#endif
+}
+
+/**
+ * Internal method for assigning the content of another HashMap
+ * to this one.
+ *
+ * @note We do *not* deallocate the previous storage here -- the caller is
+ * responsible for doing that!
+ */
+template<class Key, class Val, class HashFunc, class EqualFunc>
+void HashMap<Key, Val, HashFunc, EqualFunc>::assign(const HM_t &map) {
+ _mask = map._mask;
+ _storage = new Node *[_mask+1];
+ assert(_storage != NULL);
+ memset(_storage, 0, (_mask+1) * sizeof(Node *));
+
+ // Simply clone the map given to us, one by one.
+ _size = 0;
+ _deleted = 0;
+ for (size_type ctr = 0; ctr <= _mask; ++ctr) {
+ if (map._storage[ctr] == HASHMAP_DUMMY_NODE) {
+ _storage[ctr] = HASHMAP_DUMMY_NODE;
+ _deleted++;
+ } else if (map._storage[ctr] != NULL) {
+ _storage[ctr] = allocNode(map._storage[ctr]->_key);
+ _storage[ctr]->_value = map._storage[ctr]->_value;
+ _size++;
+ }
+ }
+ // Perform a sanity check (to help track down hashmap corruption)
+ assert(_size == map._size);
+ assert(_deleted == map._deleted);
+}
+
+
+template<class Key, class Val, class HashFunc, class EqualFunc>
+void HashMap<Key, Val, HashFunc, EqualFunc>::clear(bool shrinkArray) {
+ for (size_type ctr = 0; ctr <= _mask; ++ctr) {
+ freeNode(_storage[ctr]);
+ _storage[ctr] = NULL;
+ }
+
+#ifdef USE_HASHMAP_MEMORY_POOL
+ _nodePool.freeUnusedPages();
+#endif
+
+ if (shrinkArray && _mask >= HASHMAP_MIN_CAPACITY) {
+ delete[] _storage;
+
+ _mask = HASHMAP_MIN_CAPACITY;
+ _storage = new Node *[HASHMAP_MIN_CAPACITY];
+ assert(_storage != NULL);
+ memset(_storage, 0, HASHMAP_MIN_CAPACITY * sizeof(Node *));
+ }
+
+ _size = 0;
+ _deleted = 0;
+}
+
+template<class Key, class Val, class HashFunc, class EqualFunc>
+void HashMap<Key, Val, HashFunc, EqualFunc>::expandStorage(size_type newCapacity) {
+ assert(newCapacity > _mask+1);
+
+#ifndef NDEBUG
+ const size_type old_size = _size;
+#endif
+ const size_type old_mask = _mask;
+ Node **old_storage = _storage;
+
+ // allocate a new array
+ _size = 0;
+ _deleted = 0;
+ _mask = newCapacity - 1;
+ _storage = new Node *[newCapacity];
+ assert(_storage != NULL);
+ memset(_storage, 0, newCapacity * sizeof(Node *));
+
+ // rehash all the old elements
+ for (size_type ctr = 0; ctr <= old_mask; ++ctr) {
+ if (old_storage[ctr] == NULL || old_storage[ctr] == HASHMAP_DUMMY_NODE)
+ continue;
+
+ // Insert the element from the old table into the new table.
+ // Since we know that no key exists twice in the old table, we
+ // can do this slightly better than by calling lookup, since we
+ // don't have to call _equal().
+ const size_type hash = _hash(old_storage[ctr]->_key);
+ size_type idx = hash & _mask;
+ for (size_type perturb = hash; _storage[idx] != NULL && _storage[idx] != HASHMAP_DUMMY_NODE; perturb >>= HASHMAP_PERTURB_SHIFT) {
+ idx = (5 * idx + perturb + 1) & _mask;
+ }
+
+ _storage[idx] = old_storage[ctr];
+ _size++;
+ }
+
+ // Perform a sanity check: Old number of elements should match the new one!
+ // This check will fail if some previous operation corrupted this hashmap.
+ assert(_size == old_size);
+
+ delete[] old_storage;
+
+ return;
+}
+
+template<class Key, class Val, class HashFunc, class EqualFunc>
+typename HashMap<Key, Val, HashFunc, EqualFunc>::size_type HashMap<Key, Val, HashFunc, EqualFunc>::lookup(const Key &key) const {
+ const size_type hash = _hash(key);
+ size_type ctr = hash & _mask;
+ for (size_type perturb = hash; ; perturb >>= HASHMAP_PERTURB_SHIFT) {
+ if (_storage[ctr] == NULL)
+ break;
+ if (_storage[ctr] == HASHMAP_DUMMY_NODE) {
+#ifdef DEBUG_HASH_COLLISIONS
+ _dummyHits++;
+#endif
+ } else if (_equal(_storage[ctr]->_key, key))
+ break;
+
+ ctr = (5 * ctr + perturb + 1) & _mask;
+
+#ifdef DEBUG_HASH_COLLISIONS
+ _collisions++;
+#endif
+ }
+
+#ifdef DEBUG_HASH_COLLISIONS
+ _lookups++;
+ debug("collisions %d, dummies hit %d, lookups %d, ratio %f in HashMap %p; size %d num elements %d",
+ _collisions, _dummyHits, _lookups, ((double) _collisions / (double)_lookups),
+ (const void *)this, _mask+1, _size);
+#endif
+
+ return ctr;
+}
+
+template<class Key, class Val, class HashFunc, class EqualFunc>
+typename HashMap<Key, Val, HashFunc, EqualFunc>::size_type HashMap<Key, Val, HashFunc, EqualFunc>::lookupAndCreateIfMissing(const Key &key) {
+ const size_type hash = _hash(key);
+ size_type ctr = hash & _mask;
+ const size_type NONE_FOUND = _mask + 1;
+ size_type first_free = NONE_FOUND;
+ bool found = false;
+ for (size_type perturb = hash; ; perturb >>= HASHMAP_PERTURB_SHIFT) {
+ if (_storage[ctr] == NULL)
+ break;
+ if (_storage[ctr] == HASHMAP_DUMMY_NODE) {
+#ifdef DEBUG_HASH_COLLISIONS
+ _dummyHits++;
+#endif
+ if (first_free != _mask + 1)
+ first_free = ctr;
+ } else if (_equal(_storage[ctr]->_key, key)) {
+ found = true;
+ break;
+ }
+
+ ctr = (5 * ctr + perturb + 1) & _mask;
+
+#ifdef DEBUG_HASH_COLLISIONS
+ _collisions++;
+#endif
+ }
+
+#ifdef DEBUG_HASH_COLLISIONS
+ _lookups++;
+ debug("collisions %d, dummies hit %d, lookups %d, ratio %f in HashMap %p; size %d num elements %d",
+ _collisions, _dummyHits, _lookups, ((double) _collisions / (double)_lookups),
+ (const void *)this, _mask+1, _size);
+#endif
+
+ if (!found && first_free != _mask + 1)
+ ctr = first_free;
+
+ if (!found) {
+ if (_storage[ctr])
+ _deleted--;
+ _storage[ctr] = allocNode(key);
+ assert(_storage[ctr] != NULL);
+ _size++;
+
+ // Keep the load factor below a certain threshold.
+ // Deleted nodes are also counted
+ size_type capacity = _mask + 1;
+ if ((_size + _deleted) * HASHMAP_LOADFACTOR_DENOMINATOR >
+ capacity * HASHMAP_LOADFACTOR_NUMERATOR) {
+ capacity = capacity < 500 ? (capacity * 4) : (capacity * 2);
+ expandStorage(capacity);
+ ctr = lookup(key);
+ assert(_storage[ctr] != NULL);
+ }
+ }
+
+ return ctr;
+}
+
+
+template<class Key, class Val, class HashFunc, class EqualFunc>
+bool HashMap<Key, Val, HashFunc, EqualFunc>::contains(const Key &key) const {
+ size_type ctr = lookup(key);
+ return (_storage[ctr] != NULL);
+}
+
+template<class Key, class Val, class HashFunc, class EqualFunc>
+Val &HashMap<Key, Val, HashFunc, EqualFunc>::operator[](const Key &key) {
+ return getVal(key);
+}
+
+template<class Key, class Val, class HashFunc, class EqualFunc>
+const Val &HashMap<Key, Val, HashFunc, EqualFunc>::operator[](const Key &key) const {
+ return getVal(key);
+}
+
+template<class Key, class Val, class HashFunc, class EqualFunc>
+Val &HashMap<Key, Val, HashFunc, EqualFunc>::getVal(const Key &key) {
+ size_type ctr = lookupAndCreateIfMissing(key);
+ assert(_storage[ctr] != NULL);
+ return _storage[ctr]->_value;
+}
+
+template<class Key, class Val, class HashFunc, class EqualFunc>
+const Val &HashMap<Key, Val, HashFunc, EqualFunc>::getVal(const Key &key) const {
+ return getVal(key, _defaultVal);
+}
+
+template<class Key, class Val, class HashFunc, class EqualFunc>
+const Val &HashMap<Key, Val, HashFunc, EqualFunc>::getVal(const Key &key, const Val &defaultVal) const {
+ size_type ctr = lookup(key);
+ if (_storage[ctr] != NULL)
+ return _storage[ctr]->_value;
+ else
+ return defaultVal;
+}
+
+template<class Key, class Val, class HashFunc, class EqualFunc>
+void HashMap<Key, Val, HashFunc, EqualFunc>::setVal(const Key &key, const Val &val) {
+ size_type ctr = lookupAndCreateIfMissing(key);
+ assert(_storage[ctr] != NULL);
+ _storage[ctr]->_value = val;
+}
+
+template<class Key, class Val, class HashFunc, class EqualFunc>
+void HashMap<Key, Val, HashFunc, EqualFunc>::erase(iterator entry) {
+ // Check whether we have a valid iterator
+ assert(entry._hashmap == this);
+ const size_type ctr = entry._idx;
+ assert(ctr <= _mask);
+ Node * const node = _storage[ctr];
+ assert(node != NULL);
+ assert(node != HASHMAP_DUMMY_NODE);
+
+ // If we remove a key, we replace it with a dummy node.
+ freeNode(node);
+ _storage[ctr] = HASHMAP_DUMMY_NODE;
+ _size--;
+ _deleted++;
+}
+
+template<class Key, class Val, class HashFunc, class EqualFunc>
+void HashMap<Key, Val, HashFunc, EqualFunc>::erase(const Key &key) {
+
+ size_type ctr = lookup(key);
+ if (_storage[ctr] == NULL)
+ return;
+
+ // If we remove a key, we replace it with a dummy node.
+ freeNode(_storage[ctr]);
+ _storage[ctr] = HASHMAP_DUMMY_NODE;
+ _size--;
+ _deleted++;
+ return;
+}
+
+#undef HASHMAP_DUMMY_NODE
+
+} // End of namespace Common
+
+#endif
diff --git a/devtools/create_titanic/memorypool.cpp b/devtools/create_titanic/memorypool.cpp
new file mode 100644
index 0000000000..13c640b6ad
--- /dev/null
+++ b/devtools/create_titanic/memorypool.cpp
@@ -0,0 +1,182 @@
+/* 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 "memorypool.h"
+#include "common/util.h"
+
+namespace Common {
+
+enum {
+ INITIAL_CHUNKS_PER_PAGE = 8
+};
+
+static size_t adjustChunkSize(size_t chunkSize) {
+ // You must at least fit the pointer in the node (technically unneeded considering the next rounding statement)
+ chunkSize = MAX(chunkSize, sizeof(void *));
+ // There might be an alignment problem on some platforms when trying to load a void* on a non natural boundary
+ // so we round to the next sizeof(void *)
+ chunkSize = (chunkSize + sizeof(void *) - 1) & (~(sizeof(void *) - 1));
+
+ return chunkSize;
+}
+
+
+MemoryPool::MemoryPool(size_t chunkSize)
+ : _chunkSize(adjustChunkSize(chunkSize)) {
+
+ _next = NULL;
+
+ _chunksPerPage = INITIAL_CHUNKS_PER_PAGE;
+}
+
+MemoryPool::~MemoryPool() {
+#if 0
+ freeUnusedPages();
+ if (!_pages.empty())
+ warning("Memory leak found in pool");
+#endif
+
+ for (size_t i = 0; i < _pages.size(); ++i)
+ ::free(_pages[i].start);
+}
+
+void MemoryPool::allocPage() {
+ Page page;
+
+ // Allocate a new page
+ page.numChunks = _chunksPerPage;
+ assert(page.numChunks * _chunkSize < 16*1024*1024); // Refuse to allocate pages bigger than 16 MB
+
+ page.start = ::malloc(page.numChunks * _chunkSize);
+ assert(page.start);
+ _pages.push_back(page);
+
+
+ // Next time, we'll allocate a page twice as big as this one.
+ _chunksPerPage *= 2;
+
+ // Add the page to the pool of free chunk
+ addPageToPool(page);
+}
+
+void MemoryPool::addPageToPool(const Page &page) {
+ // Add all chunks of the new page to the linked list (pool) of free chunks
+ void *current = page.start;
+ for (size_t i = 1; i < page.numChunks; ++i) {
+ void *next = (byte *)current + _chunkSize;
+ *(void **)current = next;
+
+ current = next;
+ }
+
+ // Last chunk points to the old _next
+ *(void **)current = _next;
+
+ // From now on, the first free chunk is the first chunk of the new page
+ _next = page.start;
+}
+
+void *MemoryPool::allocChunk() {
+ // No free chunks left? Allocate a new page
+ if (!_next)
+ allocPage();
+
+ assert(_next);
+ void *result = _next;
+ _next = *(void **)result;
+ return result;
+}
+
+void MemoryPool::freeChunk(void *ptr) {
+ // Add the chunk back to (the start of) the list of free chunks
+ *(void **)ptr = _next;
+ _next = ptr;
+}
+
+// Technically not compliant C++ to compare unrelated pointers. In practice...
+bool MemoryPool::isPointerInPage(void *ptr, const Page &page) {
+ return (ptr >= page.start) && (ptr < (char *)page.start + page.numChunks * _chunkSize);
+}
+
+void MemoryPool::freeUnusedPages() {
+ //std::sort(_pages.begin(), _pages.end());
+ Array<size_t> numberOfFreeChunksPerPage;
+ numberOfFreeChunksPerPage.resize(_pages.size());
+ for (size_t i = 0; i < numberOfFreeChunksPerPage.size(); ++i) {
+ numberOfFreeChunksPerPage[i] = 0;
+ }
+
+ // Compute for each page how many chunks in it are still in use.
+ void *iterator = _next;
+ while (iterator) {
+ // TODO: This should be a binary search (requiring us to keep _pages sorted)
+ for (size_t i = 0; i < _pages.size(); ++i) {
+ if (isPointerInPage(iterator, _pages[i])) {
+ ++numberOfFreeChunksPerPage[i];
+ break;
+ }
+ }
+
+ iterator = *(void **)iterator;
+ }
+
+ // Free all pages which are not in use.
+ size_t freedPagesCount = 0;
+ for (size_t i = 0; i < _pages.size(); ++i) {
+ if (numberOfFreeChunksPerPage[i] == _pages[i].numChunks) {
+ // Remove all chunks of this page from the list of free chunks
+ void **iter2 = &_next;
+ while (*iter2) {
+ if (isPointerInPage(*iter2, _pages[i]))
+ *iter2 = **(void ***)iter2;
+ else
+ iter2 = *(void ***)iter2;
+ }
+
+ ::free(_pages[i].start);
+ ++freedPagesCount;
+ _pages[i].start = NULL;
+ }
+ }
+
+// debug("freed %d pages out of %d", (int)freedPagesCount, (int)_pages.size());
+
+ // Remove all now unused pages
+ size_t newSize = 0;
+ for (size_t i = 0; i < _pages.size(); ++i) {
+ if (_pages[i].start != NULL) {
+ if (newSize != i)
+ _pages[newSize] = _pages[i];
+ ++newSize;
+ }
+ }
+ _pages.resize(newSize);
+
+ // Reset _chunksPerPage
+ _chunksPerPage = INITIAL_CHUNKS_PER_PAGE;
+ for (size_t i = 0; i < _pages.size(); ++i) {
+ if (_chunksPerPage < _pages[i].numChunks)
+ _chunksPerPage = _pages[i].numChunks;
+ }
+}
+
+} // End of namespace Common
diff --git a/devtools/create_titanic/memorypool.h b/devtools/create_titanic/memorypool.h
new file mode 100644
index 0000000000..c8a8fc7a53
--- /dev/null
+++ b/devtools/create_titanic/memorypool.h
@@ -0,0 +1,162 @@
+/* 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 COMMON_MEMORYPOOL_H
+#define COMMON_MEMORYPOOL_H
+
+#include "common/array.h"
+
+
+namespace Common {
+
+/**
+ * This class provides a pool of memory 'chunks' of identical size.
+ * The size of a chunk is determined when creating the memory pool.
+ *
+ * Using a memory pool may yield better performance and memory usage
+ * when allocating and deallocating many memory blocks of equal size.
+ * E.g. the Common::String class uses a memory pool for the refCount
+ * variables (each the size of an int) it allocates for each string
+ * instance.
+ */
+class MemoryPool {
+protected:
+ MemoryPool(const MemoryPool&);
+ MemoryPool& operator=(const MemoryPool&);
+
+ struct Page {
+ void *start;
+ size_t numChunks;
+ };
+
+ const size_t _chunkSize;
+ Array<Page> _pages;
+ void *_next;
+ size_t _chunksPerPage;
+
+ void allocPage();
+ void addPageToPool(const Page &page);
+ bool isPointerInPage(void *ptr, const Page &page);
+
+public:
+ /**
+ * Constructor for a memory pool with the given chunk size.
+ * @param chunkSize the chunk size of this memory pool
+ */
+ explicit MemoryPool(size_t chunkSize);
+ ~MemoryPool();
+
+ /**
+ * Allocate a new chunk from the memory pool.
+ */
+ void *allocChunk();
+ /**
+ * Return a chunk to the memory pool. The given pointer must have
+ * been obtained from calling the allocChunk() method of the very
+ * same MemoryPool instance. Passing any other pointer (e.g. to
+ * a chunk from another MemoryPool, or a malloc'ed memory block)
+ * will lead to undefined behavior and may result in a crash (if
+ * you are lucky) or in silent data corruption.
+ */
+ void freeChunk(void *ptr);
+
+ /**
+ * Perform garbage collection. The memory pool stores all the
+ * chunks it manages in memory 'pages' obtained via the classic
+ * memory allocation APIs (i.e. malloc/free). Ordinarily, once
+ * a page has been allocated, it won't be released again during
+ * the life time of the memory pool. The exception is when this
+ * method is called.
+ */
+ void freeUnusedPages();
+
+ /**
+ * Return the chunk size used by this memory pool.
+ */
+ size_t getChunkSize() const { return _chunkSize; }
+};
+
+/**
+ * This is a memory pool which already contains in itself some storage
+ * space for a fixed number of chunks. Thus if the memory pool is only
+ * lightly used, no malloc() calls have to be made at all.
+ */
+template<size_t CHUNK_SIZE, size_t NUM_INTERNAL_CHUNKS = 32>
+class FixedSizeMemoryPool : public MemoryPool {
+private:
+ enum {
+ REAL_CHUNK_SIZE = (CHUNK_SIZE + sizeof(void *) - 1) & (~(sizeof(void *) - 1))
+ };
+
+ byte _storage[NUM_INTERNAL_CHUNKS * REAL_CHUNK_SIZE];
+public:
+ FixedSizeMemoryPool() : MemoryPool(CHUNK_SIZE) {
+ assert(REAL_CHUNK_SIZE == _chunkSize);
+ // Insert some static storage
+ Page internalPage = { _storage, NUM_INTERNAL_CHUNKS };
+ addPageToPool(internalPage);
+ }
+};
+
+// Ensure NUM_INTERNAL_CHUNKS == 0 results in a compile error
+template<size_t CHUNK_SIZE>
+class FixedSizeMemoryPool<CHUNK_SIZE,0> : public MemoryPool {
+public:
+ FixedSizeMemoryPool() : MemoryPool(CHUNK_SIZE) {}
+};
+
+/**
+ * A memory pool for C++ objects.
+ */
+template<class T, size_t NUM_INTERNAL_CHUNKS = 32>
+class ObjectPool : public FixedSizeMemoryPool<sizeof(T), NUM_INTERNAL_CHUNKS> {
+public:
+ /**
+ * Return the memory chunk used as storage for the given object back
+ * to the pool, after calling its destructor.
+ */
+ void deleteChunk(T *ptr) {
+ ptr->~T();
+ this->freeChunk(ptr);
+ }
+};
+
+} // End of namespace Common
+
+/**
+ * A custom placement new operator, using an arbitrary MemoryPool.
+ *
+ * This *should* work with all C++ implementations, but may not.
+ *
+ * For details on using placement new for custom allocators, see e.g.
+ * <http://www.parashift.com/c++-faq-lite/dtors.html#faq-11.14>
+ */
+inline void *operator new(size_t nbytes, Common::MemoryPool &pool) {
+ assert(nbytes <= pool.getChunkSize());
+ return pool.allocChunk();
+}
+
+inline void operator delete(void *p, Common::MemoryPool &pool) {
+ pool.freeChunk(p);
+}
+
+#endif
diff --git a/devtools/create_titanic/module.mk b/devtools/create_titanic/module.mk
new file mode 100644
index 0000000000..9f77866d45
--- /dev/null
+++ b/devtools/create_titanic/module.mk
@@ -0,0 +1,22 @@
+
+MODULE := devtools/create_titanic
+
+MODULE_OBJS := \
+ create_titanic_dat.o \
+ hashmap.o \
+ memorypool.o \
+ script_preresponses.o \
+ script_quotes.o \
+ script_ranges.o \
+ script_responses.o \
+ script_states.o \
+ str.o \
+ tag_maps.o \
+ winexe.o \
+ winexe_pe.o
+
+# Set the name of the executable
+TOOL_EXECUTABLE := create_titanic
+
+# Include common rules
+include $(srcdir)/rules.mk
diff --git a/devtools/create_titanic/script_preresponses.cpp b/devtools/create_titanic/script_preresponses.cpp
new file mode 100644
index 0000000000..d906015296
--- /dev/null
+++ b/devtools/create_titanic/script_preresponses.cpp
@@ -0,0 +1,156 @@
+/* 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.
+ *
+ */
+
+ // Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+// HACK to allow building with the SDL backend on MinGW
+// see bug #1800764 "TOOLS: MinGW tools building broken"
+#ifdef main
+#undef main
+#endif // main
+
+#include "file.h"
+#include "script_preresponses.h"
+
+static const PreResponse BARBOT_PRERESPONSES[] = {
+ { 0x0000CA02, 0x0003D102 },
+ { 0x0000CA68, 0x0003D102 },
+ { 0x0000C9DA, 0x0003D102 },
+ { 0x0000CA6A, 0x0003D103 },
+ { 0x0000C922, 0x0003D099 },
+ { 0x0000C97C, 0x0003D099 },
+ { 0x0000CA0B, 0x0003D099 },
+ { 0x0000CA72, 0x0003D099 },
+ { 0x0000CA0E, 0x0003D107 },
+ { 0x0000CA73, 0x0003D107 },
+ { 0x0000CA12, 0x0003D108 },
+ { 0x0000CA1C, 0x0003D10E },
+ { 0x0000CA83, 0x0003D10E },
+ { 0x0000CA1F, 0x0003D110 },
+ { 0x0000CA86, 0x0003D110 },
+ { 0x0000CA23, 0x0003D112 },
+ { 0x0000CA8A, 0x0003D112 },
+ { 0x0000CA92, 0x0003D122 },
+ { 0x0000CA30, 0x0003D116 },
+ { 0x0000CA96, 0x0003D116 },
+ { 0x0000CA36, 0x0003D117 },
+ { 0x0000C9FC, 0x0003D117 },
+ { 0x0000CA9B, 0x0003D117 },
+ { 0x0000CA63, 0x0003D117 },
+ { 0x0000CA38, 0x0003D11B },
+ { 0x0000CA15, 0x0003D109 },
+ { 0x0000CA7B, 0x0003D109 },
+ { 0x0000CA2E, 0x0003D115 },
+ { 0x0000CA94, 0x0003D115 },
+ { 0x0000CA5C, 0x0003D115 },
+ { 0x0000CA21, 0x0003D111 },
+ { 0x0000CA88, 0x0003D111 },
+ { 0x0000CA2A, 0x0003D114 },
+ { 0x0000CA28, 0x0003D119 },
+ { 0x0000CA8E, 0x0003D119 },
+ { 0x0000CA17, 0x0003D10B },
+ { 0x0000CA7D, 0x0003D10B },
+ { 0x0000CA4C, 0x0003D10B },
+ { 0x0000CA06, 0x0003D105 },
+ { 0x0000CA6C, 0x0003D105 },
+ { 0x0000CA0A, 0x0003D106 },
+ { 0x0000CA70, 0x0003D106 },
+ { 0x0000CA19, 0x0003D10C },
+ { 0x0000CA7F, 0x0003D10C },
+ { 0x0000C9FF, 0x0003D101 },
+ { 0x0000CA65, 0x0003D101 },
+ { 0x00000000, 0x00000000 }
+};
+
+static const PreResponse BELLBOT_PRERESPONSES[] = {
+ { 0x000052DC, 0x00030D40 },
+ { 0x000054E9, 0x00030D40 },
+ { 0x000054EC, 0x00030D40 },
+ { 0x000054F0, 0x00030D40 },
+ { 0x0000532C, 0x00031625 },
+ { 0x00005330, 0x00031625 },
+ { 0x00005368, 0x00031625 },
+ { 0x00005369, 0x00031625 },
+ { 0x0000536A, 0x00031625 },
+ { 0x0000536B, 0x00031625 },
+ { 0x0000536C, 0x00031625 },
+ { 0x0000536D, 0x00031625 },
+ { 0x000053A4, 0x00031625 },
+ { 0x0000558A, 0x00031625 },
+ { 0x00005485, 0x00031625 },
+ { 0x00004EE7, 0x00031625 },
+ { 0x00004EE8, 0x00031625 },
+ { 0x0000530A, 0x00031625 },
+ { 0x0000530B, 0x00031625 },
+ { 0x000053F6, 0x00031625 },
+ { 0x000053F7, 0x00031625 },
+ { 0x000053F8, 0x00031625 },
+ { 0x000053F9, 0x00031625 },
+ { 0x000053FA, 0x00031625 },
+ { 0x000053FB, 0x00031625 },
+ { 0x000053FC, 0x00031625 },
+ { 0x000053FD, 0x00031625 },
+ { 0x0000556B, 0x00031041 },
+ { 0x00005499, 0x00030D40 },
+ { 0x000053E9, 0x00030E01 },
+ { 0x000053EB, 0x00030E01 },
+ { 0x000053EC, 0x00030E01 },
+ { 0x000053ED, 0x00030E01 },
+ { 0x000053EE, 0x00030E01 },
+ { 0x000053EF, 0x00030E01 },
+ { 0x000053F0, 0x00030E01 },
+ { 0x000053F1, 0x00030E01 },
+ { 0x000053F2, 0x00030E01 },
+ { 0x000053EA, 0x00030E01 },
+ { 0x00005441, 0x00030F00 },
+ { 0x00005444, 0x00030F00 },
+ { 0x00005445, 0x00030F00 },
+ { 0x00005443, 0x00030F00 },
+ { 0x00005446, 0x00030F00 },
+ { 0x00005447, 0x00030F00 },
+ { 0x00005448, 0x00030F00 },
+ { 0x00005449, 0x00030F00 },
+ { 0x0000544A, 0x00030F00 },
+ { 0x0000544B, 0x00030F00 },
+ { 0x00005442, 0x00030F00 },
+ { 0x0000527C, 0x000315C8 },
+ { 0x00000000, 0x00000000 }
+};
+
+void writeScriptPreResponses(const char *name, const PreResponse *states) {
+ outputFile.seek(dataOffset);
+
+ for (; states->_src; ++states) {
+ outputFile.writeLong(states->_src);
+ outputFile.writeLong(states->_dest);
+ }
+
+ uint size = outputFile.size() - dataOffset;
+ writeEntryHeader(name, dataOffset, size);
+ dataOffset += size;
+}
+
+void writeAllScriptPreResponses() {
+ writeScriptPreResponses("PreResponses/Barbot", BARBOT_PRERESPONSES);
+ writeScriptPreResponses("PreResponses/Bellbot", BELLBOT_PRERESPONSES);
+} \ No newline at end of file
diff --git a/devtools/create_titanic/script_preresponses.h b/devtools/create_titanic/script_preresponses.h
new file mode 100644
index 0000000000..b4377be1c7
--- /dev/null
+++ b/devtools/create_titanic/script_preresponses.h
@@ -0,0 +1,37 @@
+/* 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 COMMON_SCRIPT_PRERESPONSES_H
+#define COMMON_SCRIPT_PRERESPONSES_H
+
+#include "common/scummsys.h"
+
+struct PreResponse {
+ uint _src;
+ uint _dest;
+};
+
+extern void writeAllScriptPreResponses();
+extern void writeEntryHeader(const char *name, uint offset, uint size);
+extern uint dataOffset;
+
+#endif
diff --git a/devtools/create_titanic/script_quotes.cpp b/devtools/create_titanic/script_quotes.cpp
new file mode 100644
index 0000000000..7e4838c338
--- /dev/null
+++ b/devtools/create_titanic/script_quotes.cpp
@@ -0,0 +1,457 @@
+/* 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.
+ *
+ */
+
+ // Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+// HACK to allow building with the SDL backend on MinGW
+// see bug #1800764 "TOOLS: MinGW tools building broken"
+#ifdef main
+#undef main
+#endif // main
+
+#include "file.h"
+#include "script_quotes.h"
+
+static const ScriptQuote BARBOT_QUOTES[] = {
+ { 0x00000008, 0x00000000, 0x0003D372 },
+ { 0x00000007, 0x00000000, 0x0003D72B },
+ { 0x00000004, 0x00000000, 0x0003D722 },
+ { 0x00000006, 0x00000000, 0x0003D264 },
+ { 0x00000005, 0x00000000, 0x0003D72F },
+ { 0x00000001, 0x00000032, 0x00000001 },
+ { 0x00000002, 0x00000032, 0x00000001 },
+ { 0x00000003, 0x00000032, 0x00000001 },
+ { 0x00000010, 0x54524156, 0x0003D2B1 },
+ { 0x00000010, 0x0000003C, 0x00000000 },
+ { 0x00000011, 0x00000000, 0x0003D484 },
+ { 0x00000015, 0x00000032, 0x0003D2B2 },
+ { 0x00000012, 0x00000042, 0x0003D499 },
+ { 0x00000013, 0x00000021, 0x0003D31E },
+ { 0x0000001D, 0x00000021, 0x0003D31E },
+ { 0x00000014, 0x00000042, 0x0003D49E },
+ { 0x00000016, 0x0000003C, 0x0003D2B6 },
+ { 0x00000017, 0x00000028, 0x0003D2B5 },
+ { 0x00000018, 0x00000000, 0x0003D35E },
+ { 0x00000019, 0x00000000, 0x0003D35E },
+ { 0x0000001A, 0x0000003C, 0x0003D38B },
+ { 0x0000001B, 0x00000000, 0x0003D2F8 },
+ { 0x00000009, 0x00000019, 0x0003D326 },
+ { 0x0000000A, 0x00000019, 0x0003D314 },
+ { 0x0000000B, 0x00000028, 0x0003D311 },
+ { 0x0000001E, 0x00000000, 0x0003D6F2 },
+ { 0x0000001F, 0x00000000, 0x0003D26C },
+ { 0x0000000C, 0x00000000, 0x0003D2F4 },
+ { 0x0000000D, 0x00000000, 0x0003D2F4 },
+ { 0x0000000E, 0x00000000, 0x0003D2F4 },
+ { 0x0000000F, 0x00000000, 0x0003D2F4 },
+ { 0x00000020, 0x00000019, 0x0003D389 },
+ { 0x00000021, 0x0000000F, 0x0003D29C },
+ { 0x00000022, 0x0000000F, 0x0003D494 },
+ { 0x0000001C, 0x00000032, 0x00000000 },
+ { 0x00000023, 0x00000000, 0x0003D7F8 },
+ { 0x00000024, 0x00000000, 0x0003D7F9 },
+ { 0x00000031, 0x00000000, 0x0003D722 },
+ { 0x00000032, 0x00000000, 0x0003D722 },
+ { 0x00000033, 0x00000000, 0x0003D372 },
+ { 0x00000034, 0x00000000, 0x0003D323 },
+ { 0x0000003E, 0x00000000, 0x0003D163 },
+ { 0x0000003F, 0x00000000, 0x0003D163 },
+ { 0x00000040, 0x00000000, 0x0003D163 },
+ { 0x00000041, 0x00000000, 0x0003D691 },
+ { 0x00000000, 0x00000000, 0x00000000 }
+};
+
+static const ScriptQuote BELLBOT_QUOTES[] = {
+ { 0x00000008, 0x00000000, 0x00031116 },
+ { 0x00000007, 0x00000000, 0x00031447 },
+ { 0x00000006, 0x00000000, 0x000310F9 },
+ { 0x00000005, 0x00000000, 0x000313A1 },
+ { 0x00000001, 0x56424144, 0x000313D7 },
+ { 0x00000001, 0x52554445, 0x000313D7 },
+ { 0x00000001, 0x5052534E, 0x00041EB3 },
+ { 0x00000001, 0x424F5953, 0x00041EB3 },
+ { 0x00000001, 0x4749524C, 0x00041EB3 },
+ { 0x00000001, 0x464F4F44, 0x00041EB3 },
+ { 0x00000001, 0x00000032, 0x00041EB1 },
+ { 0x0000001C, 0x00000032, 0x00041EB0 },
+ { 0x00000010, 0x54524156, 0x000313C6 },
+ { 0x00000010, 0x0000003C, 0x00041EB0 },
+ { 0x00000011, 0x00000000, 0x0003139E },
+ { 0x00000015, 0x00000032, 0x0003139F },
+ { 0x00000012, 0x00000042, 0x000313A0 },
+ { 0x00000013, 0x00000021, 0x000313A7 },
+ { 0x0000001D, 0x00000021, 0x000313A7 },
+ { 0x00000014, 0x00000042, 0x000313A4 },
+ { 0x0000001B, 0x00000000, 0x0003139B },
+ { 0x0000001E, 0x00000000, 0x000313A2 },
+ { 0x0000001F, 0x00000000, 0x00030DC0 },
+ { 0x0000000C, 0x00000000, 0x000313A9 },
+ { 0x0000000D, 0x00000000, 0x000313A9 },
+ { 0x0000000E, 0x00000000, 0x000313A8 },
+ { 0x0000000F, 0x00000000, 0x000313A8 },
+ { 0x00000020, 0x00000019, 0x000313AB },
+ { 0x00000021, 0x0000000F, 0x000313AC },
+ { 0x00000023, 0x00000000, 0x00031337 },
+ { 0x00000024, 0x00000000, 0x0003135A },
+ { 0x00000025, 0x00000000, 0x000311AB },
+ { 0x00000026, 0x00000000, 0x0003112E },
+ { 0x00000030, 0x00000000, 0x0003106C },
+ { 0x00000027, 0x424F5953, 0x0003140C },
+ { 0x00000027, 0x4749524C, 0x0003140D },
+ { 0x00000027, 0x00000000, 0x0003140D },
+ { 0x00000028, 0x00000000, 0x00031404 },
+ { 0x00000029, 0x00000000, 0x00031405 },
+ { 0x0000002A, 0x00000000, 0x00031406 },
+ { 0x0000002B, 0x00000000, 0x00031407 },
+ { 0x0000002C, 0x00000000, 0x00031408 },
+ { 0x0000002D, 0x00000000, 0x00031409 },
+ { 0x0000002E, 0x424F5953, 0x0003140A },
+ { 0x0000002E, 0x4749524C, 0x0003140B },
+ { 0x0000002E, 0x00000000, 0x0003140B },
+ { 0x00000032, 0x00000000, 0x000313D6 },
+ { 0x00000033, 0x00000000, 0x000313D7 },
+ { 0x00000034, 0x00000000, 0x000313D8 },
+ { 0x00000035, 0x00000000, 0x0003113D },
+ { 0x00000036, 0x00000000, 0x00030DCB },
+ { 0x00000031, 0x00000000, 0x00030DB5 },
+ { 0x00000037, 0x00000000, 0x000313DD },
+ { 0x00000038, 0x00000000, 0x00030EE4 },
+ { 0x00000039, 0x00000000, 0x0003160B },
+ { 0x0000003A, 0x00000000, 0x000310C4 },
+ { 0x0000003B, 0x00000000, 0x000310C5 },
+ { 0x0000003C, 0x00000000, 0x0003121C },
+ { 0x0000003D, 0x00000000, 0x00031623 },
+ { 0x0000003F, 0x00000000, 0x00030D99 },
+ { 0x0000003E, 0x00000000, 0x00030D99 },
+ { 0x00000040, 0x00000000, 0x000315CE },
+ { 0x00000041, 0x00000000, 0x000315DC },
+ { 0x00000042, 0x00000000, 0x00031478 },
+ { 0x00000043, 0x00000000, 0x00030FC8 },
+ { 0x00000044, 0x00000000, 0x0003106D },
+ { 0x00000054, 0x00000000, 0x00031514 },
+ { 0x00000055, 0x00000000, 0x00031515 },
+ { 0x00000056, 0x00000000, 0x000315CF },
+ { 0x0000005A, 0x00000000, 0x000310F9 },
+ { 0x00000058, 0x00000000, 0x000315DF },
+ { 0x0000005B, 0x00000000, 0x00031620 },
+ { 0x0000005C, 0x00000000, 0x0003134B },
+ { 0x00000059, 0x00000000, 0x0003150F },
+ { 0x00000057, 0x00000000, 0x00030D58 },
+ { 0x00000045, 0x0000000A, 0x000310C3 },
+ { 0x00000046, 0x00000000, 0x00030EAD },
+ { 0x00000000, 0x00000000, 0x00000000 }
+};
+
+static const ScriptQuote DESKBOT_QUOTES[] = {
+ { 0x00000008, 0x00000000, 0x0003ACD0 },
+ { 0x00000007, 0x00000000, 0x0003ACDC },
+ { 0x00000006, 0x00000000, 0x0003ABF9 },
+ { 0x00000005, 0x00000000, 0x0003AD04 },
+ { 0x00000001, 0x56424144, 0x0003AE27 },
+ { 0x00000001, 0x52554445, 0x0003AE27 },
+ { 0x00000001, 0x5052534E, 0x00041EB3 },
+ { 0x00000001, 0x464F4F44, 0x00041EB3 },
+ { 0x00000001, 0x00000032, 0x00041EB1 },
+ { 0x00000002, 0x56424144, 0x0003AE27 },
+ { 0x00000002, 0x52554445, 0x0003AE27 },
+ { 0x00000002, 0x5052534E, 0x00041EB3 },
+ { 0x00000002, 0x464F4F44, 0x00041EB3 },
+ { 0x00000002, 0x00000032, 0x00041EB1 },
+ { 0x00000003, 0x56424144, 0x0003AE0E },
+ { 0x00000003, 0x52554445, 0x0003AE0E },
+ { 0x00000003, 0x5052534E, 0x00041EB3 },
+ { 0x00000003, 0x464F4F44, 0x00041EB3 },
+ { 0x00000003, 0x00000032, 0x00041EB1 },
+ { 0x00000010, 0x54524156, 0x0003ACFE },
+ { 0x00000010, 0x0000003C, 0x00041EB0 },
+ { 0x00000011, 0x00000000, 0x0003ABF9 },
+ { 0x00000015, 0x00000032, 0x0003AC70 },
+ { 0x00000012, 0x00000042, 0x0003AC7E },
+ { 0x00000013, 0x00000021, 0x0003AC70 },
+ { 0x0000001D, 0x00000021, 0x0003AC09 },
+ { 0x00000014, 0x00000042, 0x0003AE07 },
+ { 0x0000001B, 0x00000000, 0x00041EB2 },
+ { 0x0000001E, 0x00000000, 0x0003ACC1 },
+ { 0x0000001F, 0x00000000, 0x0003AC3E },
+ { 0x0000000C, 0x00000000, 0x0003AE4C },
+ { 0x0000000D, 0x00000000, 0x0003AE4C },
+ { 0x0000000E, 0x00000000, 0x0003AE4B },
+ { 0x0000000F, 0x00000000, 0x0003AE4B },
+ { 0x00000020, 0x00000019, 0x0003AE24 },
+ { 0x00000021, 0x0000000F, 0x0003AE10 },
+ { 0x0000001C, 0x00000032, 0x00041EB0 },
+ { 0x00000023, 0x00000000, 0x0003AC46 },
+ { 0x00000024, 0x00000000, 0x0003AE1F },
+ { 0x00000025, 0x00000000, 0x0003AE14 },
+ { 0x00000026, 0x00000000, 0x0003AC7B },
+ { 0x00000030, 0x00000000, 0x0003AE3D },
+ { 0x00000027, 0x424F5953, 0x0003AE5D },
+ { 0x00000027, 0x4749524C, 0x0003AE5E },
+ { 0x00000027, 0x00000000, 0x0003AE5C },
+ { 0x00000028, 0x00000000, 0x0003AE5B },
+ { 0x00000029, 0x00000000, 0x0003AE58 },
+ { 0x0000002A, 0x00000000, 0x0003AE59 },
+ { 0x0000002B, 0x00000000, 0x0003AE5A },
+ { 0x0000002C, 0x00000000, 0x0003AE57 },
+ { 0x0000002D, 0x00000000, 0x0003AE5C },
+ { 0x0000002E, 0x424F5953, 0x0003AE5A },
+ { 0x0000002E, 0x4749524C, 0x0003AE5A },
+ { 0x0000002E, 0x00000000, 0x0003AE5A },
+ { 0x00000032, 0x00000000, 0x0003AE0E },
+ { 0x00000033, 0x00000000, 0x0003AE27 },
+ { 0x00000034, 0x00000000, 0x0003AE24 },
+ { 0x00000035, 0x00000000, 0x0003AE3E },
+ { 0x00000037, 0x00000000, 0x0003AE26 },
+ { 0x00000038, 0x00000000, 0x0003AEC0 },
+ { 0x00000039, 0x00000000, 0x0003AEC1 },
+ { 0x0000003A, 0x00000000, 0x0003AC7F },
+ { 0x0000003B, 0x00000000, 0x0003ADD5 },
+ { 0x0000003C, 0x00000000, 0x0003AEC5 },
+ { 0x0000003D, 0x00000000, 0x0003AEC9 },
+ { 0x0000003F, 0x00000000, 0x0003ABC5 },
+ { 0x0000003E, 0x00000000, 0x0003ABC5 },
+ { 0x00000040, 0x00000000, 0x0003AFB0 },
+ { 0x00000041, 0x00000000, 0x0003AFDC },
+ { 0x00000042, 0x00000000, 0x0003AFB5 },
+ { 0x00000043, 0x00000000, 0x0003AFDD },
+ { 0x00000044, 0x00000000, 0x0003AFDD },
+ { 0x00000045, 0x0000000A, 0x0003AC7E },
+ { 0x00000046, 0x00000000, 0x0003AF6E },
+ { 0x00000000, 0x00000000, 0x00000000 }
+};
+
+static const ScriptQuote DOORBOT_QUOTES[] = {
+ { 0x00000008, 0x00000000, 0x00035F14 },
+ { 0x00000007, 0x00000000, 0x00035F6F },
+ { 0x00000004, 0x00000000, 0x000360BF },
+ { 0x00000006, 0x00000000, 0x000360AF },
+ { 0x00000005, 0x00000000, 0x000360BC },
+ { 0x00000001, 0x56424144, 0x000360C0 },
+ { 0x00000001, 0x52554445, 0x000360C0 },
+ { 0x00000001, 0x5052534E, 0x00000003 },
+ { 0x00000001, 0x464F4F44, 0x00000003 },
+ { 0x00000001, 0x00000032, 0x00000001 },
+ { 0x00000002, 0x56424144, 0x000360C0 },
+ { 0x00000002, 0x52554445, 0x000360C0 },
+ { 0x00000002, 0x5052534E, 0x00000003 },
+ { 0x00000002, 0x464F4F44, 0x00000003 },
+ { 0x00000002, 0x00000032, 0x00000001 },
+ { 0x00000003, 0x56424144, 0x000360C0 },
+ { 0x00000003, 0x52554445, 0x000360C0 },
+ { 0x00000003, 0x5052534E, 0x00000003 },
+ { 0x00000003, 0x464F4F44, 0x00000003 },
+ { 0x00000003, 0x00000032, 0x00000001 },
+ { 0x00000010, 0x54524156, 0x00035F6A },
+ { 0x00000010, 0x0000003C, 0x00000000 },
+ { 0x00000011, 0x00000000, 0x0003604F },
+ { 0x00000015, 0x00000032, 0x00036046 },
+ { 0x00000012, 0x00000042, 0x00036057 },
+ { 0x00000013, 0x00000021, 0x00035FC8 },
+ { 0x0000001D, 0x00000021, 0x00035FC8 },
+ { 0x00000014, 0x00000042, 0x00036059 },
+ { 0x00000016, 0x0000003C, 0x00035F6E },
+ { 0x00000017, 0x00000028, 0x00035F6D },
+ { 0x00000018, 0x00000000, 0x00035F68 },
+ { 0x00000019, 0x00000000, 0x00035F68 },
+ { 0x0000001A, 0x0000003C, 0x00035F67 },
+ { 0x0000001B, 0x00000000, 0x00035FA0 },
+ { 0x00000009, 0x00000019, 0x00035FD3 },
+ { 0x0000000A, 0x00000019, 0x00036051 },
+ { 0x0000000B, 0x00000028, 0x00035FC4 },
+ { 0x0000001E, 0x00000000, 0x00035F5C },
+ { 0x0000001F, 0x00000000, 0x00035F5C },
+ { 0x0000000C, 0x00000000, 0x00035F9D },
+ { 0x0000000D, 0x00000000, 0x00035F9D },
+ { 0x0000000E, 0x00000000, 0x00035F9C },
+ { 0x0000000F, 0x00000000, 0x00035F9C },
+ { 0x00000020, 0x00000019, 0x00035FFF },
+ { 0x00000021, 0x0000000F, 0x00035F59 },
+ { 0x00000022, 0x0000000F, 0x00036055 },
+ { 0x0000001C, 0x00000032, 0x00000000 },
+ { 0x00000023, 0x00000000, 0x000360C3 },
+ { 0x00000024, 0x00000000, 0x00035F5B },
+ { 0x00000025, 0x00000000, 0x00035EFE },
+ { 0x00000026, 0x00000000, 0x00035F03 },
+ { 0x0000002C, 0x00000000, 0x000360C0 },
+ { 0x0000002D, 0x00000000, 0x000360C0 },
+ { 0x00000030, 0x00000000, 0x00035F42 },
+ { 0x00000031, 0x00000000, 0x000360BF },
+ { 0x00000032, 0x00000000, 0x000360BF },
+ { 0x00000033, 0x00000000, 0x000360C0 },
+ { 0x00000034, 0x00000000, 0x00035FC9 },
+ { 0x00000035, 0x00000000, 0x00035E8B },
+ { 0x00000036, 0x00000000, 0x00035DFA },
+ { 0x00000037, 0x00000000, 0x000363AB },
+ { 0x00000038, 0x00000000, 0x00035F0F },
+ { 0x0000003C, 0x00000000, 0x00036379 },
+ { 0x0000003E, 0x00000000, 0x00036262 },
+ { 0x0000003F, 0x00000000, 0x00036262 },
+ { 0x00000040, 0x00000000, 0x00036271 },
+ { 0x00000041, 0x00000000, 0x0003626C },
+ { 0x00000042, 0x00000000, 0x0003625D },
+ { 0x00000043, 0x00000000, 0x0003649B },
+ { 0x00000044, 0x00000000, 0x0003649B },
+ { 0x00000046, 0x00000000, 0x00036035 },
+ { 0x00000000, 0x00000000, 0x00000000 }
+};
+
+static const ScriptQuote LIFTBOT_QUOTES[] = {
+ { 0x00000008, 0x00000000, 0x00033655 },
+ { 0x00000007, 0x00000000, 0x000335A0 },
+ { 0x00000006, 0x00000000, 0x0003368B },
+ { 0x00000005, 0x00000028, 0x00033693 },
+ { 0x00000001, 0x56424144, 0x00033695 },
+ { 0x00000001, 0x52554445, 0x00033695 },
+ { 0x00000001, 0x5052534E, 0x00000003 },
+ { 0x00000001, 0x464F4F44, 0x00000003 },
+ { 0x00000001, 0x00000032, 0x00000001 },
+ { 0x00000002, 0x56424144, 0x00033695 },
+ { 0x00000002, 0x52554445, 0x00033695 },
+ { 0x00000002, 0x5052534E, 0x00000003 },
+ { 0x00000002, 0x464F4F44, 0x00000003 },
+ { 0x00000002, 0x00000032, 0x00000001 },
+ { 0x00000003, 0x56424144, 0x00033695 },
+ { 0x00000003, 0x52554445, 0x00033695 },
+ { 0x00000003, 0x5052534E, 0x00000003 },
+ { 0x00000003, 0x464F4F44, 0x00000003 },
+ { 0x00000003, 0x00000032, 0x00000001 },
+ { 0x00000010, 0x54524156, 0x000335A4 },
+ { 0x00000010, 0x0000003C, 0x00000000 },
+ { 0x00000011, 0x00000000, 0x0003367B },
+ { 0x00000015, 0x00000032, 0x000335A1 },
+ { 0x00000012, 0x00000042, 0x00033672 },
+ { 0x00000013, 0x00000021, 0x00033679 },
+ { 0x0000001D, 0x00000021, 0x00033679 },
+ { 0x00000014, 0x00000042, 0x00033688 },
+ { 0x00000016, 0x0000003C, 0x000335A4 },
+ { 0x00000017, 0x00000028, 0x00033689 },
+ { 0x00000018, 0x00000000, 0x00033670 },
+ { 0x00000019, 0x00000000, 0x000335A0 },
+ { 0x0000001A, 0x0000003C, 0x0003368F },
+ { 0x0000001B, 0x00000000, 0x00033695 },
+ { 0x00000009, 0x00000019, 0x000335A2 },
+ { 0x0000000A, 0x00000019, 0x000335A6 },
+ { 0x0000000B, 0x00000028, 0x00033668 },
+ { 0x0000001E, 0x00000000, 0x00033691 },
+ { 0x0000001F, 0x00000000, 0x00033691 },
+ { 0x0000000C, 0x00000014, 0x00033666 },
+ { 0x0000000D, 0x00000014, 0x00033666 },
+ { 0x0000000E, 0x00000014, 0x0003367A },
+ { 0x0000000F, 0x00000014, 0x0003367A },
+ { 0x00000020, 0x00000019, 0x0003367C },
+ { 0x00000021, 0x0000000F, 0x00033690 },
+ { 0x00000022, 0x0000000F, 0x00033682 },
+ { 0x0000001C, 0x00000032, 0x00000000 },
+ { 0x00000023, 0x00000000, 0x00033698 },
+ { 0x00000024, 0x00000000, 0x00033699 },
+ { 0x00000031, 0x00000000, 0x00033694 },
+ { 0x00000032, 0x00000000, 0x00033694 },
+ { 0x00000033, 0x00000000, 0x00033695 },
+ { 0x00000034, 0x00000000, 0x0003369F },
+ { 0x00000035, 0x00000000, 0x000336A0 },
+ { 0x00000036, 0x00000000, 0x00033585 },
+ { 0x0000003E, 0x00000000, 0x0003380D },
+ { 0x0000003F, 0x00000000, 0x0003380D },
+ { 0x00000040, 0x00000000, 0x0003380D },
+ { 0x00000041, 0x00000000, 0x000337E7 },
+ { 0x00000042, 0x00000000, 0x00033711 },
+ { 0x00000000, 0x00000000, 0x00000000 }
+};
+
+static const ScriptQuote MAITRED_QUOTES[] = {
+ { 0x00000008, 0x00000000, 0x0003F967 },
+ { 0x00000007, 0x00000000, 0x0003F995 },
+ { 0x00000006, 0x00000000, 0x0003F833 },
+ { 0x00000005, 0x00000000, 0x0003F95B },
+ { 0x00000001, 0x56424144, 0x0003F847 },
+ { 0x00000001, 0x52554445, 0x0003F847 },
+ { 0x00000001, 0x5052534E, 0x00041EB3 },
+ { 0x00000001, 0x464F4F44, 0x0003FB88 },
+ { 0x00000001, 0x00000032, 0x00041EB1 },
+ { 0x00000010, 0x54524156, 0x0003F9FA },
+ { 0x00000010, 0x0000003C, 0x00041EB0 },
+ { 0x00000011, 0x00000000, 0x0003F967 },
+ { 0x00000015, 0x00000032, 0x0003F83D },
+ { 0x00000012, 0x00000042, 0x0003F83D },
+ { 0x00000013, 0x00000021, 0x0003F95B },
+ { 0x0000001D, 0x00000021, 0x0003F971 },
+ { 0x00000014, 0x00000042, 0x0003F96C },
+ { 0x0000001B, 0x00000000, 0x0003F95B },
+ { 0x0000001E, 0x00000000, 0x0003FA3C },
+ { 0x0000001F, 0x00000000, 0x0003F991 },
+ { 0x0000000C, 0x00000000, 0x0003F9C9 },
+ { 0x0000000D, 0x00000000, 0x0003F9C9 },
+ { 0x0000000E, 0x00000000, 0x0003F9C9 },
+ { 0x0000000F, 0x00000000, 0x0003F9C9 },
+ { 0x00000020, 0x00000019, 0x0003F847 },
+ { 0x00000021, 0x0000000F, 0x0003FA22 },
+ { 0x00000037, 0x00000000, 0x0003FA9C },
+ { 0x0000003C, 0x00000000, 0x0003FAA0 },
+ { 0x00000047, 0x00000000, 0x0003FAA1 },
+ { 0x0000003F, 0x00000000, 0x0003FABD },
+ { 0x0000003E, 0x00000000, 0x0003FABD },
+ { 0x00000040, 0x00000000, 0x0003FABB },
+ { 0x00000041, 0x00000000, 0x0003FABB },
+ { 0x00000042, 0x00000000, 0x0003FABC },
+ { 0x00000048, 0x00000000, 0x0003FB45 },
+ { 0x00000049, 0x00000000, 0x0003FB48 },
+ { 0x0000004A, 0x00000000, 0x0003FB52 },
+ { 0x0000004B, 0x00000000, 0x0003FB4A },
+ { 0x0000004C, 0x00000000, 0x0003FB47 },
+ { 0x0000004D, 0x00000000, 0x0003FB49 },
+ { 0x0000004E, 0x00000000, 0x0003FB53 },
+ { 0x0000004F, 0x00000000, 0x0003FB4C },
+ { 0x00000050, 0x00000000, 0x0003FB4E },
+ { 0x00000051, 0x00000000, 0x0003FB50 },
+ { 0x00000052, 0x00000000, 0x0003FB75 },
+ { 0x00000053, 0x00000000, 0x0003F9A8 },
+ { 0x00000000, 0x00000000, 0x00000000 }
+};
+
+void writeScriptQuotes(const char *name, const ScriptQuote *quotes,
+ uint tag1, uint tag2, uint rangeStart, uint rangeEnd) {
+ outputFile.seek(dataOffset);
+ outputFile.writeLong(tag1);
+ outputFile.writeLong(tag2);
+ outputFile.writeLong(rangeStart);
+ outputFile.writeLong(rangeEnd);
+
+ for (; quotes->_index; ++quotes) {
+ outputFile.writeLong(quotes->_index);
+ outputFile.writeLong(quotes->_tagId);
+ outputFile.writeLong(quotes->_dialogueId);
+ }
+
+ uint size = outputFile.size() - dataOffset;
+ writeEntryHeader(name, dataOffset, size);
+ dataOffset += size;
+}
+
+void writeAllScriptQuotes() {
+ writeScriptQuotes("Quotes/Barbot", BARBOT_QUOTES, 221376, 221375, 0, 999);
+ writeScriptQuotes("Quotes/Bellbot", BELLBOT_QUOTES, 201687, 201686, 270000, 270500);
+ writeScriptQuotes("Quotes/Deskbot", DESKBOT_QUOTES, 241191, 241166, 270000, 270500);
+ writeScriptQuotes("Quotes/Doorbot", DOORBOT_QUOTES, 221376, 221375, 0, 999);
+ writeScriptQuotes("Quotes/Liftbot", LIFTBOT_QUOTES, 210581, 210580, 0, 999);
+ writeScriptQuotes("Quotes/MaitreD", MAITRED_QUOTES, 260167, 260147, 270000, 270500);
+} \ No newline at end of file
diff --git a/devtools/create_titanic/script_quotes.h b/devtools/create_titanic/script_quotes.h
new file mode 100644
index 0000000000..5b4f25c3c8
--- /dev/null
+++ b/devtools/create_titanic/script_quotes.h
@@ -0,0 +1,38 @@
+/* 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 COMMON_SCRIPT_QUOTES_H
+#define COMMON_SCRIPT_QUOTES_H
+
+#include "common/scummsys.h"
+
+struct ScriptQuote {
+ uint _index;
+ uint _tagId;
+ uint _dialogueId;
+};
+
+extern void writeAllScriptQuotes();
+extern void writeEntryHeader(const char *name, uint offset, uint size);
+extern uint dataOffset;
+
+#endif
diff --git a/devtools/create_titanic/script_ranges.cpp b/devtools/create_titanic/script_ranges.cpp
new file mode 100644
index 0000000000..6ac8092e3a
--- /dev/null
+++ b/devtools/create_titanic/script_ranges.cpp
@@ -0,0 +1,1804 @@
+/* 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.
+ *
+ */
+
+ // Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+// HACK to allow building with the SDL backend on MinGW
+// see bug #1800764 "TOOLS: MinGW tools building broken"
+#ifdef main
+#undef main
+#endif // main
+
+#include "file.h"
+#include "script_ranges.h"
+
+const uint BARBOT_RANGE1[] = { 250062, 250064, 250065, 250066, 250067, 250068, 250069, 250070, 250071, 250063, 0 };
+const uint BARBOT_RANGE2[] = { 250200, 250201, 250202, 250203, 250204, 250205, 250206, 250207, 0 };
+const uint BARBOT_RANGE3[] = { 250160, 250161, 250162, 250163, 0 };
+const uint BARBOT_RANGE4[] = { 250175, 250176, 250177, 250178, 250179, 250180, 250181, 250182, 250183, 0 };
+const uint BARBOT_RANGE5[] = { 250114, 250004, 0 };
+const uint BARBOT_RANGE6[] = { 250042, 250009, 250010, 250011, 251692, 251693, 251694, 0 };
+const uint BARBOT_RANGE7[] = { 250012, 250111, 0 };
+const uint BARBOT_RANGE8[] = { 250013, 250119, 0 };
+const uint BARBOT_RANGE9[] = { 250027, 250126, 250055, 0 };
+const uint BARBOT_RANGE10[] = { 250032, 250130, 0 };
+const uint BARBOT_RANGE11[] = { 250038, 250134, 0 };
+const uint BARBOT_RANGE12[] = { 250039, 250135, 250050, 0 };
+const uint BARBOT_RANGE13[] = { 250016, 250120, 250136, 250145, 250143, 0 };
+const uint BARBOT_RANGE14[] = { 250040, 250138, 250139, 0 };
+const uint BARBOT_RANGE15[] = { 250037, 250133, 250617, 0 };
+const uint BARBOT_RANGE16[] = { 250031, 250129, 0 };
+const uint BARBOT_RANGE17[] = { 250036, 250132, 0 };
+const uint BARBOT_RANGE18[] = { 250035, 250137, 0 };
+const uint BARBOT_RANGE19[] = { 250021, 250123, 0 };
+const uint BARBOT_RANGE20[] = { 250006, 250117, 0 };
+const uint BARBOT_RANGE21[] = { 250024, 250124, 0 };
+const uint BARBOT_RANGE22[] = { 250002, 250113, 0 };
+const uint BARBOT_RANGE23[] = { 250152, 250153, 250079, 250194, 250149, 250151, 250150,
+250208, 250209, 250157, 250195, 250076, 250156, 250074,
+250075, 250080, 250192, 250109, 250159, 250110, 250148,
+250053, 250155, 250197, 250072, 250077, 250001, 250154,
+250196, 250198, 250199, 250158, 250073, 0 };
+const uint BARBOT_RANGE24[] = { 251831, 251832, 251833, 251834, 251835, 250617, 0 };
+const uint BARBOT_RANGE25[] = { 250033, 251838, 0 };
+const uint BARBOT_RANGE26[] = { 250014, 251827, 251781, 250617, 0 };
+const uint BARBOT_RANGE27[] = { 251855, 251856, 0 };
+const uint BARBOT_RANGE28[] = { 251852, 251853, 0 };
+const uint BARBOT_RANGE29[] = { 251250, 251261, 251272, 251277, 251278, 251279, 251280,
+251281, 251282, 251251, 251252, 251253, 251254, 251255,
+251256, 251257, 251258, 251259, 251260, 251262, 251263,
+251264, 251265, 251266, 251267, 251268, 251269, 251270,
+251271, 251273, 251274, 251275, 251276, 0 };
+const uint BARBOT_RANGE30[] = { 251283, 251284, 251285, 251286, 0 };
+const uint BARBOT_RANGE31[] = { 250527, 250530, 250531, 250532, 250533, 250534, 250535,
+250536, 250537, 250528, 250529, 0 };
+const uint BARBOT_RANGE32[] = { 250593, 250594, 0 };
+const uint BARBOT_RANGE33[] = { 250263, 250264, 250265, 250266, 0 };
+const uint BARBOT_RANGE34[] = { 250227, 250228, 250229, 250230, 0 };
+const uint BARBOT_RANGE35[] = { 250239, 250240, 250241, 250242, 250243, 0 };
+const uint BARBOT_RANGE36[] = { 250507, 250222, 250678, 250588, 0 };
+const uint BARBOT_RANGE37[] = { 250365, 250366, 250367, 250368, 0 };
+const uint BARBOT_RANGE38[] = { 250936, 250937, 250938, 0 };
+const uint BARBOT_RANGE39[] = { 250610, 250611, 0 };
+const uint BARBOT_RANGE40[] = { 250082, 250093, 250102, 250104, 250105, 250106, 250107,
+250108, 250091, 250092, 250094, 250095, 250096, 250097,
+250098, 250099, 250100, 250101, 251700, 251701, 251702,
+251703, 251704, 251862, 250617, 250268, 250272, 0 };
+const uint BARBOT_RANGE41[] = { 250584, 250585, 0 };
+const uint BARBOT_RANGE42[] = { 250579, 251142, 0 };
+const uint BARBOT_RANGE43[] = { 250577, 250578, 0 };
+const uint BARBOT_RANGE44[] = { 250244, 250245, 250246, 250247, 250248, 250249, 250250,
+250251, 250252, 250253, 250254, 250255, 250256, 250257,
+250258, 250259, 250260, 250261, 250262, 0 };
+const uint BARBOT_RANGE45[] = { 250286, 250288, 250289, 250290, 250291, 250292, 250293,
+250294, 250295, 250287, 0 };
+const uint BARBOT_RANGE46[] = { 250296, 250299, 250300, 250301, 250302, 250303, 250304,
+250305, 250306, 250297, 250298, 0 };
+const uint BARBOT_RANGE47[] = { 250307, 250309, 250310, 250311, 250312, 250313, 250314,
+250315, 250316, 0 };
+const uint BARBOT_RANGE48[] = { 251682, 251683, 251684, 251685, 251686, 251687, 251688,
+251689, 250756, 250757, 250758, 250759, 0 };
+const uint BARBOT_RANGE49[] = { 250738, 250742, 250743, 250744, 250745, 250746, 250747,
+250748, 250749, 250739, 250740, 250741, 0 };
+const uint BARBOT_RANGE50[] = { 250659, 250660, 250661, 250379, 0 };
+const uint BARBOT_RANGE51[] = { 251761, 251762, 251763, 251764, 0 };
+const uint BARBOT_RANGE52[] = { 251754, 251755, 251756, 251757, 251758, 251759, 0 };
+const uint BARBOT_RANGE53[] = { 250482, 250504, 250424, 250463, 250466, 250467, 250468,
+250478, 250501, 250502, 250503, 250506, 250413, 251014,
+250614, 250756, 250758, 250759, 250223, 250737, 250658,
+251027, 250633, 250935, 250237, 251618, 0 };
+const uint BARBOT_RANGE54[] = { 250504, 250434, 250436, 250466, 250467, 250468, 250469,
+250470, 250472, 250501, 250502, 250503, 250505, 250413,
+251681, 250756, 250758, 250759, 250223, 251027, 250633,
+250935, 250237, 251618, 250371, 0 };
+const uint BARBOT_RANGE55[] = { 250952, 250953, 0 };
+const uint BARBOT_RANGE56[] = { 251777, 250951, 0 };
+const uint BARBOT_RANGE57[] = { 251871, 251877, 251878, 251879, 251880, 251883, 251884,
+251872, 251873, 0 };
+const uint BARBOT_RANGE58[] = { 250228, 250236, 250258, 250259, 250378, 250465, 250536,
+251016, 251048, 251068, 0 };
+const uint BARBOT_RANGE59[] = { 250141, 250378, 251048, 0 };
+const uint BARBOT_RANGE60[] = { 251621, 251622, 251623, 251624, 251625, 251626, 0 };
+const uint BARBOT_RANGE61[] = { 251650, 251651, 0 };
+const uint BARBOT_RANGE62[] = { 251305, 251306, 251307, 251308, 0 };
+const uint BARBOT_RANGE63[] = { 251836, 251890, 251891, 251892, 0 };
+const uint BARBOT_RANGE64[] = { 250760, 251246, 251156, 251335, 251510, 251059, 251097,
+251136, 250374, 250375, 250376, 250377, 251015, 251016,
+251017, 251018, 0 };
+const uint BARBOT_RANGE65[] = { 250899, 250906, 250948, 250713, 250690, 0 };
+const uint BARBOT_RANGE66[] = { 250906, 250948, 250713, 250899, 250690, 0 };
+const uint BARBOT_RANGE67[] = { 250949, 250713, 250711, 250152, 250153, 250690, 250906, 0 };
+const uint BARBOT_RANGE68[] = { 251815, 250711, 0 };
+const uint BARBOT_RANGE69[] = { 251829, 250711, 0 };
+const uint BARBOT_RANGE70[] = { 251779, 250712, 0 };
+
+#define BARBOT_RANGE_COUNT 70
+const ScriptRange BARBOT_RANGES[70] = {
+ { 250062, BARBOT_RANGE1, false, false },
+ { 250200, BARBOT_RANGE2, false, false },
+ { 250160, BARBOT_RANGE3, false, false },
+ { 250175, BARBOT_RANGE4, false, false },
+ { 250004, BARBOT_RANGE5, false, false },
+ { 250042, BARBOT_RANGE6, true, false },
+ { 250012, BARBOT_RANGE7, false, false },
+ { 250013, BARBOT_RANGE8, false, false },
+ { 250027, BARBOT_RANGE9, false, false },
+ { 250032, BARBOT_RANGE10, false, false },
+ { 250038, BARBOT_RANGE11, false, false },
+ { 250039, BARBOT_RANGE12, false, false },
+ { 250016, BARBOT_RANGE13, false, false },
+ { 250040, BARBOT_RANGE14, false, false },
+ { 250037, BARBOT_RANGE15, false, false },
+ { 250031, BARBOT_RANGE16, false, false },
+ { 250036, BARBOT_RANGE17, false, false },
+ { 250035, BARBOT_RANGE18, false, false },
+ { 250021, BARBOT_RANGE19, false, false },
+ { 250006, BARBOT_RANGE20, false, false },
+
+ { 250024, BARBOT_RANGE21, false, false },
+ { 250002, BARBOT_RANGE22, false, false },
+ { 250210, BARBOT_RANGE23, false, false },
+ { 251831, BARBOT_RANGE24, false, false },
+ { 250033, BARBOT_RANGE25, false, false },
+ { 250014, BARBOT_RANGE26, false, false },
+ { 251855, BARBOT_RANGE27, false, false },
+ { 251852, BARBOT_RANGE28, false, false },
+ { 251250, BARBOT_RANGE29, false, false },
+ { 251283, BARBOT_RANGE30, false, false },
+ { 250527, BARBOT_RANGE31, false, false },
+ { 250593, BARBOT_RANGE32, false, false },
+ { 250263, BARBOT_RANGE33, false, false },
+ { 250227, BARBOT_RANGE34, false, false },
+ { 250239, BARBOT_RANGE35, false, false },
+ { 250507, BARBOT_RANGE36, false, false },
+ { 250365, BARBOT_RANGE37, false, false },
+ { 250936, BARBOT_RANGE38, false, false },
+ { 250610, BARBOT_RANGE39, false, false },
+ { 250082, BARBOT_RANGE40, true, false },
+
+ { 250584, BARBOT_RANGE41, false, false },
+ { 250579, BARBOT_RANGE42, false, false },
+ { 250577, BARBOT_RANGE43, false, false },
+ { 250244, BARBOT_RANGE44, true, false },
+ { 250286, BARBOT_RANGE45, true, false },
+ { 250296, BARBOT_RANGE46, true, false },
+ { 250307, BARBOT_RANGE47, true, false },
+ { 251682, BARBOT_RANGE48, true, false },
+ { 250738, BARBOT_RANGE49, true, false },
+ { 250659, BARBOT_RANGE50, true, false },
+ { 251761, BARBOT_RANGE51, false, false },
+ { 251754, BARBOT_RANGE52, false, false },
+ { 251896, BARBOT_RANGE53, true, false },
+ { 251897, BARBOT_RANGE54, true, false },
+ { 250952, BARBOT_RANGE55, false, false },
+ { 251777, BARBOT_RANGE56, false, false },
+ { 251871, BARBOT_RANGE57, true, false },
+ { 250140, BARBOT_RANGE58, true, false },
+ { 250141, BARBOT_RANGE59, false, false },
+ { 251621, BARBOT_RANGE60, false, false },
+
+ { 251650, BARBOT_RANGE61, false, false },
+ { 251305, BARBOT_RANGE62, false, false },
+ { 251836, BARBOT_RANGE63, false, false },
+ { 251018, BARBOT_RANGE64, true, false },
+ { 250899, BARBOT_RANGE65, false, false },
+ { 250899, BARBOT_RANGE66, false, false },
+ { 251899, BARBOT_RANGE67, false, false },
+ { 251815, BARBOT_RANGE68, false, false },
+ { 251829, BARBOT_RANGE69, false, false },
+ { 251779, BARBOT_RANGE70, false, false }
+};
+
+const uint BELLBOT_RANGE1[] = { 200059, 200637, 0 };
+const uint BELLBOT_RANGE2[] = { 200001, 200002, 200003, 200004, 200005, 200006, 0 };
+const uint BELLBOT_RANGE3[] = { 200020, 200021, 202117, 202118, 0 };
+const uint BELLBOT_RANGE4[] = { 200023, 200024, 200025, 0 };
+const uint BELLBOT_RANGE5[] = { 200029, 0 };
+const uint BELLBOT_RANGE6[] = { 200034, 200035, 0 };
+const uint BELLBOT_RANGE7[] = { 200038, 200039, 0 };
+const uint BELLBOT_RANGE8[] = { 200061, 200062, 200063, 200064, 200065, 200066, 200201, 200202, 200203, 200204,
+ 200205, 0 };
+const uint BELLBOT_RANGE9[] = { 200068, 200069, 200070, 200071, 200072, 0 };
+const uint BELLBOT_RANGE10[] = { 200076, 200077, 0 };
+
+const uint BELLBOT_RANGE11[] = { 200079, 200080, 200081, 200082, 200083, 200084, 0 };
+const uint BELLBOT_RANGE12[] = { 200119, 200120, 200121, 200122, 200123, 200124, 200125, 200126, 0 };
+const uint BELLBOT_RANGE13[] = { 200134, 200135, 0 };
+const uint BELLBOT_RANGE14[] = { 200141, 200149, 200150, 200151, 200152, 200153, 200154, 200155, 200156, 200142,
+200143, 200144, 200145, 200147, 200148, 0 };
+const uint BELLBOT_RANGE15[] = { 200158, 200168, 200169, 200170, 200171, 200172, 200173, 200174, 200175, 200159,
+200160, 200161, 200162, 200146, 200163, 200164, 200165, 200166, 200167, 0 };
+const uint BELLBOT_RANGE16[] = {
+ 200177, 200182, 200183, 200184, 200185, 200186, 200187, 200188, 200189, 200191,
+ 200178, 200179, 200180, 200181, 0
+};
+const uint BELLBOT_RANGE17[] = { 200194, 200195, 200196, 200197, 200198, 200199, 0 };
+const uint BELLBOT_RANGE18[] = { 200201, 200202, 200203, 200204, 200205, 200078, 0 };
+const uint BELLBOT_RANGE19[] = { 200236, 200237, 200238, 200239, 200240, 0 };
+const uint BELLBOT_RANGE20[] = { 200244, 200245, 200246, 200247, 200248, 0 };
+
+const uint BELLBOT_RANGE21[] = { 200262, 200263, 200264, 200265, 200266, 200267, 200268, 200269, 200270, 200271, 0 };
+const uint BELLBOT_RANGE22[] = { 200280, 200281, 200282, 0 };
+const uint BELLBOT_RANGE23[] = { 200284, 200285, 200286, 200287, 200288, 200289, 0 };
+const uint BELLBOT_RANGE24[] = { 200291, 200292, 202254, 0 };
+const uint BELLBOT_RANGE25[] = { 200294, 200295, 200296, 200297, 200298, 200299, 200300, 200301, 200481, 200481,
+200481, 0 };
+const uint BELLBOT_RANGE26[] = { 200307, 200308, 200309, 0 };
+const uint BELLBOT_RANGE27[] = { 200312, 200313, 0 };
+const uint BELLBOT_RANGE28[] = { 200324, 200325, 200326, 200327, 200328, 0 };
+const uint BELLBOT_RANGE29[] = { 200331, 200332, 200722, 200723, 0 };
+const uint BELLBOT_RANGE30[] = { 200337, 200338, 200339, 200340, 200341, 200342, 200343, 200344, 200345, 200346, 0 };
+
+const uint BELLBOT_RANGE31[] = { 200351, 200352, 200353, 200354, 200355, 200356, 200357, 200358, 0 };
+const uint BELLBOT_RANGE32[] = { 200360, 200361, 0 };
+const uint BELLBOT_RANGE33[] = { 200363, 200364, 0 };
+const uint BELLBOT_RANGE34[] = { 200371, 200372, 200373, 0 };
+const uint BELLBOT_RANGE35[] = { 200375, 200376, 0 };
+const uint BELLBOT_RANGE36[] = { 200394, 200395, 200396, 0 };
+const uint BELLBOT_RANGE37[] = { 200406, 200407, 0 };
+const uint BELLBOT_RANGE38[] = { 200414, 200415, 0 };
+const uint BELLBOT_RANGE39[] = { 200423, 200424, 0 };
+const uint BELLBOT_RANGE40[] = { 200433, 200434, 200435, 0 };
+
+const uint BELLBOT_RANGE41[] = { 200437, 200440, 200441, 200442, 200443, 200444, 200445, 200446, 200447, 200438,
+200439, 0 };
+const uint BELLBOT_RANGE42[] = { 200449, 200450, 200451, 200452, 200453, 200454, 0 };
+const uint BELLBOT_RANGE43[] = { 200456, 200457, 200458, 0 };
+const uint BELLBOT_RANGE44[] = {
+ 201036, 201037, 200997, 200998, 200999, 201000, 201009, 201010, 200482, 200483,
+ 200484, 200485, 200486, 200487, 200488, 200489, 200490, 200691, 202215, 200666,
+ 200665, 200375, 200788, 200687, 200985, 200986, 201011, 201021, 0
+};
+const uint BELLBOT_RANGE45[] = { 200497, 200498, 200499, 200500, 200501, 200502, 200503, 0 };
+const uint BELLBOT_RANGE46[] = { 200508, 200509, 200510, 202219, 0 };
+const uint BELLBOT_RANGE47[] = { 200517, 200518, 200519, 200520, 200521, 200522, 200523, 200524, 0 };
+const uint BELLBOT_RANGE48[] = { 200529, 200530, 200531, 0 };
+const uint BELLBOT_RANGE49[] = { 200540, 200541, 0 };
+const uint BELLBOT_RANGE50[] = { 200558, 200559, 200560, 200561, 0 };
+
+const uint BELLBOT_RANGE51[] = { 200563, 200564, 200565, 200566, 200567, 200568, 200569, 0 };
+const uint BELLBOT_RANGE52[] = { 200572, 200573, 200574, 0 };
+const uint BELLBOT_RANGE53[] = { 200584, 200586, 200587, 200588, 200589, 0 };
+const uint BELLBOT_RANGE54[] = { 200591, 200592, 200593, 0 };
+const uint BELLBOT_RANGE55[] = { 200602, 200603, 200604, 0 };
+const uint BELLBOT_RANGE56[] = { 200606, 200607, 0 };
+const uint BELLBOT_RANGE57[] = { 200619, 200620, 200621, 200622, 200623, 200624, 200625, 200626, 0 };
+const uint BELLBOT_RANGE58[] = { 200636, 200637, 0 };
+const uint BELLBOT_RANGE59[] = { 200672, 200671, 0 };
+const uint BELLBOT_RANGE60[] = { 200679, 201977, 0 };
+
+const uint BELLBOT_RANGE61[] = { 200687, 200688, 200689, 200690, 200691, 200692, 0 };
+const uint BELLBOT_RANGE62[] = { 200699, 200700, 0 };
+const uint BELLBOT_RANGE63[] = { 200705, 200706, 200707, 0 };
+const uint BELLBOT_RANGE64[] = { 200711, 200712, 200713, 0 };
+const uint BELLBOT_RANGE65[] = { 200717, 200718, 0 };
+const uint BELLBOT_RANGE66[] = { 200724, 200725, 200726, 200727, 200728, 0 };
+const uint BELLBOT_RANGE67[] = { 200734, 200735, 200736, 0 };
+const uint BELLBOT_RANGE68[] = { 200749, 200750, 200751, 200752, 200753, 200481, 200481, 200481, 0 };
+const uint BELLBOT_RANGE69[] = { 200758, 200759, 0 };
+const uint BELLBOT_RANGE70[] = { 200774, 200775, 200776, 201820, 0 };
+
+const uint BELLBOT_RANGE71[] = { 200778, 200779, 200780, 200781, 200481, 200481, 0 };
+const uint BELLBOT_RANGE72[] = { 200783, 200784, 200785, 200786, 200787, 200481, 200481, 0 };
+const uint BELLBOT_RANGE73[] = { 200800, 200801, 200802, 200803, 200804, 200805, 200806, 200807, 200808, 200809,
+ 200481, 200481, 0 };
+const uint BELLBOT_RANGE74[] = { 200815, 200816, 200481, 0 };
+const uint BELLBOT_RANGE75[] = { 200827, 200828, 200829, 200481, 0 };
+const uint BELLBOT_RANGE76[] = { 200867, 200868, 200869, 200481, 0 };
+const uint BELLBOT_RANGE77[] = { 200875, 200876, 0 };
+const uint BELLBOT_RANGE78[] = { 200878, 200879, 200880, 200481, 0 };
+const uint BELLBOT_RANGE79[] = { 200889, 200890, 200891, 200481, 0 };
+const uint BELLBOT_RANGE80[] = { 200893, 200894, 200895, 200896, 200897, 200898, 200481, 0 };
+
+const uint BELLBOT_RANGE81[] = { 200400, 200399, 0 };
+const uint BELLBOT_RANGE82[] = { 200114, 200115, 0 };
+const uint BELLBOT_RANGE83[] = { 200660, 200659, 0 };
+const uint BELLBOT_RANGE84[] = { 200303, 200304, 0 };
+const uint BELLBOT_RANGE85[] = { 200837, 200838, 0 };
+const uint BELLBOT_RANGE86[] = { 200790, 200791, 0 };
+const uint BELLBOT_RANGE87[] = { 200771, 200772, 0 };
+const uint BELLBOT_RANGE88[] = { 200137, 200138, 0 };
+const uint BELLBOT_RANGE89[] = { 200548, 200551, 200555, 200549, 200547, 200553, 200552, 200545, 200550, 200554,
+200546, 200556, 0 };
+const uint BELLBOT_RANGE90[] = {
+ 200906, 200907, 200908, 200909, 200910, 200911, 200912, 200913, 200914, 200915,
+ 200916, 200917, 200918, 200919, 200922, 200923, 200924, 200925, 200926, 200927,
+ 200928, 200929, 200930, 0
+};
+
+const uint BELLBOT_RANGE91[] = {
+ 200931, 200932, 200933, 200934, 200935, 200936, 200937, 200938, 200939, 200940,
+ 200941, 200942, 200943, 200944, 200947, 200948, 200949, 200950, 200951, 200952,
+ 200953, 200954, 200955, 200956, 200957, 200958, 200959, 200960, 200962, 200965,
+ 200966, 201028, 201029, 201030, 201033, 202051, 0
+};
+const uint BELLBOT_RANGE92[] = {
+ 200967, 200968, 200969, 200970, 200971, 200972, 200973, 200974, 200975, 200976,
+ 200977, 200978, 200979, 200980, 200981, 200982, 200983, 200984, 200985, 200986,
+ 200987, 200988, 200989, 201036, 201037, 0
+};
+const uint BELLBOT_RANGE93[] = { 200991, 200992, 200993, 200994, 200995, 200996, 201001, 201002, 201003, 201004,
+201007, 0 };
+const uint BELLBOT_RANGE94[] = { 200997, 200998, 200999, 201000, 201009, 201010, 0 };
+const uint BELLBOT_RANGE95[] = { 201014, 201015, 201016, 201017, 201018, 201019, 201020, 201023, 201024, 0 };
+const uint BELLBOT_RANGE96[] = { 201025, 201026, 201027, 0 };
+const uint BELLBOT_RANGE97[] = { 201044, 201045, 201046, 201047, 0 };
+const uint BELLBOT_RANGE98[] = { 201048, 201051, 201059, 201063, 201065, 201068, 201069, 200236, 200237, 200238,
+200239, 201882, 0 };
+const uint BELLBOT_RANGE99[] = { 201060, 201061, 201062, 0 };
+const uint BELLBOT_RANGE100[] = { 201053, 201054, 0 };
+
+const uint BELLBOT_RANGE101[] = { 201055, 201056, 201057, 201058, 0 };
+const uint BELLBOT_RANGE102[] = { 201073, 201074, 201075, 0 };
+const uint BELLBOT_RANGE103[] = { 202158, 201076, 201077, 201078, 202159, 0 };
+const uint BELLBOT_RANGE104[] = { 201079, 201080, 201081, 201082, 201087, 201088, 0 };
+const uint BELLBOT_RANGE105[] = { 201084, 201085, 0 };
+const uint BELLBOT_RANGE106[] = { 201090, 201091, 201092, 201093, 201094, 201095, 201096, 201097, 0 };
+const uint BELLBOT_RANGE107[] = { 201098, 201099, 201100, 201101, 201102, 201105, 201106, 201107, 201108, 0 };
+const uint BELLBOT_RANGE108[] = {
+ 201111, 201112, 201113, 201114, 201115, 201116, 201117, 201118, 201119, 201120,
+ 201121, 201122, 201123, 201124, 201125, 201126, 201127, 201128, 201130, 201131,
+ 201132, 201133, 0
+};
+const uint BELLBOT_RANGE109[] = { 201134, 201136, 201137, 201138, 0 };
+const uint BELLBOT_RANGE110[] = { 201139, 201140, 201141, 201142, 201143, 201144, 201145, 201146, 201147, 201148, 0 };
+
+const uint BELLBOT_RANGE111[] = { 201149, 201150, 201151, 201152, 201153, 201154, 201155, 201156, 201157, 0 };
+const uint BELLBOT_RANGE112[] = { 201158, 201159, 201160, 201161, 201162, 201163, 201164, 201165, 201166, 0 };
+const uint BELLBOT_RANGE113[] = {
+ 201170, 201171, 201172, 201173, 201174, 201175, 201176, 201177, 201178, 201179,
+ 201180, 201181, 201182, 201183, 201184, 201185, 201186, 201187, 201188, 201189,
+ 201190, 201191, 201192, 201193, 201194, 201195, 201196, 201197, 201198, 201199,
+ 201200, 201201, 201202, 201203, 201204, 201205, 201206, 201207, 201208, 201209,
+ 201210, 201211, 201212, 201213, 201214, 201215, 0
+};
+const uint BELLBOT_RANGE114[] = { 201170, 0 };
+const uint BELLBOT_RANGE115[] = { 201239, 201240, 201241, 0 };
+const uint BELLBOT_RANGE116[] = { 201242, 201243, 0 };
+const uint BELLBOT_RANGE117[] = { 201245, 201246, 201247, 201248, 0 };
+const uint BELLBOT_RANGE118[] = { 201249, 201250, 201251, 201252, 0 };
+const uint BELLBOT_RANGE119[] = { 201253, 201254, 201255, 0 };
+const uint BELLBOT_RANGE120[] = { 201258, 201259, 202138, 201260, 202139, 201261, 202138, 0 };
+
+const uint BELLBOT_RANGE121[] = { 201265, 201266, 201267, 201268, 0 };
+const uint BELLBOT_RANGE122[] = { 201310, 201312, 0 };
+const uint BELLBOT_RANGE123[] = { 201313, 201314, 201315, 201316, 201317, 201318, 201319, 201320, 201321, 0 };
+const uint BELLBOT_RANGE124[] = { 201340, 201342, 0 };
+const uint BELLBOT_RANGE125[] = { 201344, 201432, 0 };
+const uint BELLBOT_RANGE126[] = { 201345, 201458, 0 };
+const uint BELLBOT_RANGE127[] = { 201346, 201484, 0 };
+const uint BELLBOT_RANGE128[] = { 201444, 0 };
+const uint BELLBOT_RANGE129[] = { 201348, 201406, 201456, 0 };
+const uint BELLBOT_RANGE130[] = { 201350, 201351, 0 };
+
+const uint BELLBOT_RANGE131[] = { 201398, 201352, 201429, 0 };
+const uint BELLBOT_RANGE132[] = { 201354, 201460, 0 };
+const uint BELLBOT_RANGE133[] = { 201355, 201465, 0 };
+const uint BELLBOT_RANGE134[] = { 201356, 201415, 0 };
+const uint BELLBOT_RANGE135[] = { 201357, 201358, 0 };
+const uint BELLBOT_RANGE136[] = { 201359, 201410, 0 };
+const uint BELLBOT_RANGE137[] = { 201360, 201477, 0 };
+const uint BELLBOT_RANGE138[] = { 201361, 201422, 0 };
+const uint BELLBOT_RANGE139[] = { 201362, 201481, 0 };
+const uint BELLBOT_RANGE140[] = { 201363, 201364, 201440, 0 };
+
+const uint BELLBOT_RANGE141[] = { 201365, 201366, 0 };
+const uint BELLBOT_RANGE142[] = { 201367, 201390, 0 };
+const uint BELLBOT_RANGE143[] = { 201368, 201461, 0 };
+const uint BELLBOT_RANGE144[] = { 201370, 201419, 0 };
+const uint BELLBOT_RANGE145[] = { 201371, 201462, 0 };
+const uint BELLBOT_RANGE146[] = { 201372, 201423, 201453, 0 };
+const uint BELLBOT_RANGE147[] = { 201374, 201443, 0 };
+const uint BELLBOT_RANGE148[] = { 201376, 201420, 0 };
+const uint BELLBOT_RANGE149[] = { 201377, 201409, 0 };
+const uint BELLBOT_RANGE150[] = { 201378, 201434, 0 };
+
+const uint BELLBOT_RANGE151[] = { 201380, 201381, 0 };
+const uint BELLBOT_RANGE152[] = { 201382, 201396, 201414, 201446, 201463, 0 };
+const uint BELLBOT_RANGE153[] = { 201383, 201413, 0 };
+const uint BELLBOT_RANGE154[] = { 201401, 201402, 0 };
+const uint BELLBOT_RANGE155[] = { 201438, 201439, 0 };
+const uint BELLBOT_RANGE156[] = { 201493, 201494, 201495, 201496, 201497, 201498, 201499, 201500, 0 };
+const uint BELLBOT_RANGE157[] = { 201502, 201503, 201504, 201505, 201506, 201507, 201508, 201509, 0 };
+const uint BELLBOT_RANGE158[] = { 201513, 201514, 201515, 201516, 201517, 201518, 201519, 201520, 0 };
+const uint BELLBOT_RANGE159[] = { 201628, 201629, 0 };
+const uint BELLBOT_RANGE160[] = { 201640, 201641, 0 };
+
+const uint BELLBOT_RANGE161[] = { 201663, 201664, 0 };
+const uint BELLBOT_RANGE162[] = { 201031, 201032, 0 };
+const uint BELLBOT_RANGE163[] = { 201442, 0 };
+const uint BELLBOT_RANGE164[] = { 201384, 201442, 0 };
+const uint BELLBOT_RANGE165[] = {
+ 200451, 200452, 200056, 200057, 200228, 201686, 201687, 201688, 201025, 201028,
+ 201029, 201030, 201033, 201051, 201060, 201061, 201086, 201703, 201315, 201316,
+ 201497, 201533, 201529, 201525, 201537, 201543, 201546, 201547, 201550, 201559,
+ 201565, 201573, 201580, 201584, 201594, 201595, 201596, 201597, 201598, 201599,
+ 201602, 201601, 201605, 201607, 201620, 201625, 201639, 201684, 0 };
+const uint BELLBOT_RANGE166[] = { 200083, 200084, 201335, 0 };
+const uint BELLBOT_RANGE167[] = { 200951, 200952, 200953, 200956, 201029, 200660, 201003, 201060, 201066, 201111,
+201115, 0 };
+const uint BELLBOT_RANGE168[] = { 200109, 200110, 0 };
+const uint BELLBOT_RANGE169[] = { 200864, 200865, 0 };
+const uint BELLBOT_RANGE170[] = { 200090, 200091, 0 };
+
+const uint BELLBOT_RANGE171[] = { 200675, 200676, 0 };
+const uint BELLBOT_RANGE172[] = {
+ 201979, 201980, 201981, 201982, 201983, 200442, 200238, 200236, 201098, 201101,
+ 201102, 201105, 201108, 201270, 201510, 0
+};
+const uint BELLBOT_RANGE173[] = { 202134, 202135, 202136, 202137, 202138, 202139, 0 };
+const uint BELLBOT_RANGE174[] = { 202276, 202232, 200858, 202276, 202276, 202276, 0 };
+const uint BELLBOT_RANGE175[] = { 202214, 202215, 200845, 0 };
+const uint BELLBOT_RANGE176[] = { 201852, 201853, 0 };
+const uint BELLBOT_RANGE177[] = { 202017, 202018, 0 };
+const uint BELLBOT_RANGE178[] = { 202023, 202024, 0 };
+const uint BELLBOT_RANGE179[] = { 202028, 202029, 0 };
+const uint BELLBOT_RANGE180[] = { 202031, 202032, 202033, 202034, 0 };
+
+const uint BELLBOT_RANGE181[] = { 202036, 202037, 0 };
+const uint BELLBOT_RANGE182[] = { 202039, 202040, 202041, 0 };
+const uint BELLBOT_RANGE183[] = { 201810, 201811, 0 };
+const uint BELLBOT_RANGE184[] = { 201817, 201818, 201819, 0 };
+const uint BELLBOT_RANGE185[] = { 201823, 201824, 201825, 201826, 201827, 0 };
+const uint BELLBOT_RANGE186[] = { 201829, 201830, 201831, 0 };
+const uint BELLBOT_RANGE187[] = { 201833, 201834, 201838, 200273, 201840, 0 };
+const uint BELLBOT_RANGE188[] = { 201836, 201837, 201838, 0 };
+const uint BELLBOT_RANGE189[] = { 201842, 201843, 0 };
+const uint BELLBOT_RANGE190[] = { 201845, 201846, 0 };
+
+const uint BELLBOT_RANGE191[] = { 201860, 201861, 201862, 201867, 201866, 0 };
+const uint BELLBOT_RANGE192[] = { 201866, 201867, 0 };
+const uint BELLBOT_RANGE193[] = { 201871, 201872, 201873, 201874, 0 };
+const uint BELLBOT_RANGE194[] = { 201878, 201879, 0 };
+const uint BELLBOT_RANGE195[] = { 201907, 201908, 201909, 201910, 0 };
+const uint BELLBOT_RANGE196[] = { 201917, 201918, 201919, 201920, 0 };
+const uint BELLBOT_RANGE197[] = { 201925, 201926, 201927, 201808, 0 };
+const uint BELLBOT_RANGE198[] = { 201931, 201932, 201810, 201811, 0 };
+const uint BELLBOT_RANGE199[] = { 201989, 201990, 0 };
+const uint BELLBOT_RANGE200[] = { 202049, 202050, 0 };
+
+const uint BELLBOT_RANGE201[] = { 202053, 202054, 0 };
+const uint BELLBOT_RANGE202[] = { 202057, 202058, 202068, 200274, 0 };
+const uint BELLBOT_RANGE203[] = { 202060, 202061, 202062, 202063, 202064, 0 };
+const uint BELLBOT_RANGE204[] = { 202093, 202094, 200275, 202095, 0 };
+const uint BELLBOT_RANGE205[] = { 202097, 202098, 202099, 202100, 202101, 0 };
+const uint BELLBOT_RANGE206[] = { 202104, 202105, 202106, 0 };
+const uint BELLBOT_RANGE207[] = { 202112, 202113, 202114, 200277, 0 };
+const uint BELLBOT_RANGE208[] = { 200020, 200021, 202117, 202118, 200276, 0 };
+const uint BELLBOT_RANGE209[] = { 202120, 202121, 202122, 202123, 202124, 202125, 202126, 0 };
+const uint BELLBOT_RANGE210[] = { 202128, 202129, 202130, 0 };
+
+const uint BELLBOT_RANGE211[] = { 202146, 202147, 202148, 201116, 0 };
+const uint BELLBOT_RANGE212[] = { 202151, 202152, 202153, 202154, 202155, 0 };
+const uint BELLBOT_RANGE213[] = { 202163, 202164, 200325, 202023, 202024, 202189, 0 };
+const uint BELLBOT_RANGE214[] = { 202166, 202167, 202168, 0 };
+const uint BELLBOT_RANGE215[] = { 202172, 202173, 0 };
+const uint BELLBOT_RANGE216[] = { 202176, 202177, 0 };
+const uint BELLBOT_RANGE217[] = { 202186, 202187, 0 };
+const uint BELLBOT_RANGE218[] = { 202192, 202193, 0 };
+const uint BELLBOT_RANGE219[] = { 202195, 202196, 202197, 202198, 202199, 202200, 0 };
+const uint BELLBOT_RANGE220[] = { 202158, 202159, 201076, 201077, 201078, 0 };
+
+const uint BELLBOT_RANGE221[] = { 200849, 202001, 0 };
+const uint BELLBOT_RANGE222[] = { 202000, 200844, 0 };
+const uint BELLBOT_RANGE223[] = { 201915, 200272, 0 };
+const uint BELLBOT_RANGE224[] = { 200239, 201049, 201063, 201089, 201113, 202150, 201062, 0 };
+const uint BELLBOT_RANGE225[] = { 201984, 201985, 201049, 201065, 201068, 0 };
+const uint BELLBOT_RANGE226[] = { 200001, 200003, 200004, 200005, 200121, 200122, 200351, 200352, 200353, 200354,
+200355, 200356, 200357, 200358, 202174, 201085, 200510, 202261, 0 };
+const uint BELLBOT_RANGE227[] = { 202134, 202135, 202136, 202137, 202138, 202139, 200352, 200358, 201084, 0 };
+const uint BELLBOT_RANGE228[] = { 200444, 200081, 200082, 200083, 200084, 200923, 201331, 201343, 202109, 0 };
+const uint BELLBOT_RANGE229[] = { 200280, 200080, 200287, 200922, 201337, 201338, 201339, 201908, 201909, 0 };
+const uint BELLBOT_RANGE230[] = { 201324, 200917, 200281, 200282, 200727, 200924, 200926, 0 };
+
+const uint BELLBOT_RANGE231[] = { 201323, 200925, 200927, 200928, 200919, 200906, 201333, 202176, 202178, 202177,
+201987, 201989, 201990, 0 };
+const uint BELLBOT_RANGE232[] = {
+ 200916, 200915, 200918, 200907, 200908, 200909, 200910, 200911, 200912, 200913,
+ 201325, 201326, 201327, 201328, 201329, 201330, 201332, 201334, 201335, 201336,
+ 201340, 201341, 201342, 201833, 201834, 0
+};
+const uint BELLBOT_RANGE233[] = {
+ 200125, 200205, 200264, 200419, 200440, 200443, 200445, 200446, 200447, 200438,
+ 200420, 200620, 200621, 200622, 200624, 200669, 200771, 200787, 200093, 201026,
+ 201047, 201088, 201271, 201086, 200664, 2006642, 0 };
+const uint BELLBOT_RANGE234[] = { 200729, 0 };
+const uint BELLBOT_RANGE235[] = { 200252, 200766, 201105, 201106, 201107, 201108, 0 };
+const uint BELLBOT_RANGE236[] = { 202220, 200537, 0 };
+const uint BELLBOT_RANGE237[] = { 202230, 202144, 0 };
+const uint BELLBOT_RANGE238[] = { 202019, 202018, 202017, 201049, 201050, 200891, 201043, 201521, 0 };
+const uint BELLBOT_RANGE239[] = { 200476, 202203, 0 };
+const uint BELLBOT_RANGE240[] = { 200475, 201856, 0 };
+
+#define BELLBOT_RANGE_COUNT 283
+static ScriptRange BELLBOT_RANGES[283] = {
+ { 200058, BELLBOT_RANGE1, false, false },
+ { 200000, BELLBOT_RANGE2, true, false },
+ { 200019, BELLBOT_RANGE3, true, false },
+ { 200022, BELLBOT_RANGE4, true, false },
+ { 200027, BELLBOT_RANGE5, false, false },
+ { 200033, BELLBOT_RANGE6, false, false },
+ { 200037, BELLBOT_RANGE7, false, false },
+ { 200060, BELLBOT_RANGE8, true, false },
+ { 200067, BELLBOT_RANGE9, true, false },
+ { 200075, BELLBOT_RANGE10, false, false },
+
+ { 200078, BELLBOT_RANGE11, false, false },
+ { 200118, BELLBOT_RANGE12, false, false },
+ { 200133, BELLBOT_RANGE13, false, false },
+ { 200140, BELLBOT_RANGE14, true, false },
+ { 200157, BELLBOT_RANGE15, true, false },
+ { 200176, BELLBOT_RANGE16, true, false },
+ { 200193, BELLBOT_RANGE17, true, false },
+ { 200200, BELLBOT_RANGE18, false, false },
+ { 200235, BELLBOT_RANGE19, false, false },
+ { 200243, BELLBOT_RANGE20, false, false },
+
+ { 200261, BELLBOT_RANGE21, false, false },
+ { 200279, BELLBOT_RANGE22, false, false },
+ { 200283, BELLBOT_RANGE23, false, false },
+ { 200290, BELLBOT_RANGE24, true, false },
+ { 200293, BELLBOT_RANGE25, false, false },
+ { 200306, BELLBOT_RANGE26, false, false },
+ { 200311, BELLBOT_RANGE27, false, false },
+ { 200323, BELLBOT_RANGE28, false, false },
+ { 200330, BELLBOT_RANGE29, true, false },
+ { 200336, BELLBOT_RANGE30, false, false },
+
+ { 200350, BELLBOT_RANGE31, false, false },
+ { 200359, BELLBOT_RANGE32, false, false },
+ { 200362, BELLBOT_RANGE33, false, false },
+ { 200370, BELLBOT_RANGE34, false, false },
+ { 200374, BELLBOT_RANGE35, false, false },
+ { 200393, BELLBOT_RANGE36, false, false },
+ { 200405, BELLBOT_RANGE37, false, false },
+ { 200413, BELLBOT_RANGE38, false, false },
+ { 200422, BELLBOT_RANGE39, false, false },
+ { 200432, BELLBOT_RANGE40, true, false },
+
+ { 200436, BELLBOT_RANGE41, true, false },
+ { 200448, BELLBOT_RANGE42, true, false },
+ { 200455, BELLBOT_RANGE43, false, false },
+ { 200481, BELLBOT_RANGE44, true, false },
+ { 200496, BELLBOT_RANGE45, false, false },
+ { 200507, BELLBOT_RANGE46, true, false },
+ { 200516, BELLBOT_RANGE47, true, false },
+ { 200528, BELLBOT_RANGE48, true, false },
+ { 200539, BELLBOT_RANGE49, true, false },
+ { 200557, BELLBOT_RANGE50, true, false },
+
+ { 200562, BELLBOT_RANGE51, true, false },
+ { 200571, BELLBOT_RANGE52, true, false },
+ { 200585, BELLBOT_RANGE53, true, false },
+ { 200590, BELLBOT_RANGE54, true, false },
+ { 200601, BELLBOT_RANGE55, true, false },
+ { 200605, BELLBOT_RANGE56, true, false },
+ { 200617, BELLBOT_RANGE57, true, false },
+ { 200635, BELLBOT_RANGE58, false, false },
+ { 200670, BELLBOT_RANGE59, false, false },
+ { 200677, BELLBOT_RANGE60, true, false },
+
+ { 200686, BELLBOT_RANGE61, false, false },
+ { 200698, BELLBOT_RANGE62, false, false },
+ { 200704, BELLBOT_RANGE63, false, false },
+ { 200710, BELLBOT_RANGE64, true, false },
+ { 200716, BELLBOT_RANGE65, false, false },
+ { 200723, BELLBOT_RANGE66, true, false },
+ { 200733, BELLBOT_RANGE67, false, false },
+ { 200748, BELLBOT_RANGE68, true, false },
+ { 200757, BELLBOT_RANGE69, false, false },
+ { 200773, BELLBOT_RANGE70, true, false },
+
+ { 200777, BELLBOT_RANGE71, true, false },
+ { 200782, BELLBOT_RANGE72, true, false },
+ { 200799, BELLBOT_RANGE73, true, false },
+ { 200814, BELLBOT_RANGE74, true, false },
+ { 200826, BELLBOT_RANGE75, true, false },
+ { 200866, BELLBOT_RANGE76, true, false },
+ { 200874, BELLBOT_RANGE77, false, false },
+ { 200877, BELLBOT_RANGE78, true, false },
+ { 200888, BELLBOT_RANGE79, true, false },
+ { 200892, BELLBOT_RANGE80, true, false },
+
+ { 200398, BELLBOT_RANGE81, false, false },
+ { 200113, BELLBOT_RANGE82, false, false },
+ { 200658, BELLBOT_RANGE83, false, false },
+ { 200302, BELLBOT_RANGE84, false, false },
+ { 200836, BELLBOT_RANGE85, false, false },
+ { 200789, BELLBOT_RANGE86, false, false },
+ { 200770, BELLBOT_RANGE87, false, false },
+ { 200136, BELLBOT_RANGE88, false, false },
+ { 200544, BELLBOT_RANGE89, false, false },
+ { 201685, BELLBOT_RANGE90, false, false },
+
+ { 201686, BELLBOT_RANGE91, true, false },
+ { 201687, BELLBOT_RANGE92, true, false },
+ { 201688, BELLBOT_RANGE93, true, false },
+ { 201689, BELLBOT_RANGE94, false, false },
+ { 201690, BELLBOT_RANGE95, false, false },
+ { 201691, BELLBOT_RANGE96, false, false },
+ { 201692, BELLBOT_RANGE97, true, false },
+ { 201693, BELLBOT_RANGE98, true, false },
+ { 201694, BELLBOT_RANGE99, false, false },
+ { 201695, BELLBOT_RANGE100, true, false },
+
+ { 201696, BELLBOT_RANGE101, true, false },
+ { 201697, BELLBOT_RANGE102, true, false },
+ { 201698, BELLBOT_RANGE103, false, false },
+ { 201699, BELLBOT_RANGE104, true, false },
+ { 201700, BELLBOT_RANGE105, true, false },
+ { 201701, BELLBOT_RANGE106, false, false },
+ { 201702, BELLBOT_RANGE107, false, false },
+ { 201703, BELLBOT_RANGE108, true, false },
+ { 201704, BELLBOT_RANGE109, true, false },
+ { 201705, BELLBOT_RANGE110, true, false },
+
+ { 201706, BELLBOT_RANGE111, true, false },
+ { 201707, BELLBOT_RANGE112, true, false },
+ { 201708, BELLBOT_RANGE113, false, false },
+
+ { 201709, BELLBOT_RANGE114, false, false },
+ { 201710, BELLBOT_RANGE114, false, false },
+ { 201711, BELLBOT_RANGE114, false, false },
+ { 201712, BELLBOT_RANGE114, false, false },
+ { 201713, BELLBOT_RANGE114, false, false },
+ { 201714, BELLBOT_RANGE114, false, false },
+ { 201715, BELLBOT_RANGE114, false, false },
+ { 201716, BELLBOT_RANGE114, false, false },
+ { 201717, BELLBOT_RANGE114, false, false },
+ { 201718, BELLBOT_RANGE114, false, false },
+ { 201719, BELLBOT_RANGE114, false, false },
+ { 201720, BELLBOT_RANGE114, false, false },
+ { 201721, BELLBOT_RANGE114, false, false },
+ { 201722, BELLBOT_RANGE114, false, false },
+ { 201723, BELLBOT_RANGE114, false, false },
+ { 201724, BELLBOT_RANGE114, false, false },
+ { 201725, BELLBOT_RANGE114, false, false },
+ { 201726, BELLBOT_RANGE114, false, false },
+ { 201727, BELLBOT_RANGE114, false, false },
+ { 201728, BELLBOT_RANGE114, false, false },
+ { 201729, BELLBOT_RANGE114, false, false },
+ { 201730, BELLBOT_RANGE114, false, false },
+ { 201731, BELLBOT_RANGE114, false, false },
+ { 201732, BELLBOT_RANGE114, false, false },
+ { 201733, BELLBOT_RANGE114, false, false },
+ { 201735, BELLBOT_RANGE114, false, false },
+ { 201736, BELLBOT_RANGE114, false, false },
+ { 201737, BELLBOT_RANGE114, false, false },
+ { 201738, BELLBOT_RANGE114, false, false },
+ { 201739, BELLBOT_RANGE114, false, false },
+ { 201740, BELLBOT_RANGE114, false, false },
+ { 201741, BELLBOT_RANGE114, false, false },
+ { 201743, BELLBOT_RANGE114, false, false },
+ { 201744, BELLBOT_RANGE114, false, false },
+ { 201745, BELLBOT_RANGE114, false, false },
+ { 201746, BELLBOT_RANGE114, false, false },
+ { 201747, BELLBOT_RANGE114, false, false },
+ { 201748, BELLBOT_RANGE114, false, false },
+ { 201749, BELLBOT_RANGE114, false, false },
+ { 201750, BELLBOT_RANGE114, false, false },
+ { 201751, BELLBOT_RANGE114, false, false },
+ { 201752, BELLBOT_RANGE114, false, false },
+ { 201753, BELLBOT_RANGE114, false, false },
+ { 201754, BELLBOT_RANGE114, false, false },
+
+ { 201755, BELLBOT_RANGE115, true, false },
+ { 201756, BELLBOT_RANGE116, true, false },
+ { 201757, BELLBOT_RANGE117, true, false },
+ { 201758, BELLBOT_RANGE118, true, false },
+ { 201759, BELLBOT_RANGE119, true, false },
+ { 201760, BELLBOT_RANGE120, false, false },
+
+ { 201761, BELLBOT_RANGE121, true, false },
+ { 201762, BELLBOT_RANGE122, true, false },
+ { 201763, BELLBOT_RANGE123, true, false },
+ { 201764, BELLBOT_RANGE124, false, false },
+ { 201765, BELLBOT_RANGE125, false, false },
+ { 201766, BELLBOT_RANGE126, false, false },
+ { 201767, BELLBOT_RANGE127, false, false },
+ { 201768, BELLBOT_RANGE128, false, false },
+ { 201769, BELLBOT_RANGE129, false, false },
+ { 201770, BELLBOT_RANGE130, false, false },
+
+ { 201771, BELLBOT_RANGE131, true, false },
+ { 201772, BELLBOT_RANGE132, false, false },
+ { 201773, BELLBOT_RANGE133, false, false },
+ { 201774, BELLBOT_RANGE134, false, false },
+ { 201775, BELLBOT_RANGE135, false, false },
+ { 201776, BELLBOT_RANGE136, false, false },
+ { 201777, BELLBOT_RANGE137, false, false },
+ { 201778, BELLBOT_RANGE138, false, false },
+ { 201779, BELLBOT_RANGE139, false, false },
+ { 201780, BELLBOT_RANGE140, false, false },
+
+ { 201781, BELLBOT_RANGE141, false, false },
+ { 201782, BELLBOT_RANGE142, false, false },
+ { 201783, BELLBOT_RANGE143, false, false },
+ { 201784, BELLBOT_RANGE144, false, false },
+ { 201785, BELLBOT_RANGE145, false, false },
+ { 201786, BELLBOT_RANGE146, false, false },
+ { 201787, BELLBOT_RANGE147, false, false },
+ { 201788, BELLBOT_RANGE148, false, false },
+ { 201789, BELLBOT_RANGE149, false, false },
+ { 201790, BELLBOT_RANGE150, false, false },
+
+ { 201791, BELLBOT_RANGE151, false, false },
+ { 201792, BELLBOT_RANGE152, false, false },
+ { 201793, BELLBOT_RANGE153, false, false },
+ { 201794, BELLBOT_RANGE154, false, false },
+ { 201795, BELLBOT_RANGE155, false, false },
+ { 201796, BELLBOT_RANGE156, true, false },
+ { 201797, BELLBOT_RANGE157, false, false },
+ { 201798, BELLBOT_RANGE158, false, false },
+ { 201799, BELLBOT_RANGE159, false, false },
+ { 201800, BELLBOT_RANGE160, false, false },
+
+ { 201801, BELLBOT_RANGE161, false, false },
+ { 201802, BELLBOT_RANGE162, false, false },
+ { 201803, BELLBOT_RANGE163, false, false },
+ { 201804, BELLBOT_RANGE164, true, false },
+ { 201805, BELLBOT_RANGE165, true, false },
+ { 201806, BELLBOT_RANGE166, true, false },
+ { 201807, BELLBOT_RANGE167, true, false },
+ { 200108, BELLBOT_RANGE168, false, false },
+ { 200863, BELLBOT_RANGE169, false, false },
+ { 200089, BELLBOT_RANGE170, false, false },
+
+ { 200674, BELLBOT_RANGE171, false, false },
+ { 201978, BELLBOT_RANGE172, true, false },
+ { 202133, BELLBOT_RANGE173, true, false },
+ { 202231, BELLBOT_RANGE174, true, false },
+ { 202213, BELLBOT_RANGE175, true, false },
+ { 201851, BELLBOT_RANGE176, true, false },
+ { 202016, BELLBOT_RANGE177, false, false },
+ { 202022, BELLBOT_RANGE178, false, false },
+ { 202027, BELLBOT_RANGE179, false, false },
+ { 202030, BELLBOT_RANGE180, true, false },
+
+ { 202035, BELLBOT_RANGE181, false, false },
+ { 202038, BELLBOT_RANGE182, false, false },
+ { 201809, BELLBOT_RANGE183, true, false },
+ { 201816, BELLBOT_RANGE184, true, false },
+ { 201822, BELLBOT_RANGE185, false, false },
+ { 201828, BELLBOT_RANGE186, true, false },
+ { 201832, BELLBOT_RANGE187, true, false },
+ { 201835, BELLBOT_RANGE188, true, false },
+ { 201841, BELLBOT_RANGE189, true, false },
+ { 201844, BELLBOT_RANGE190, true, false },
+
+ { 201859, BELLBOT_RANGE191, true, false },
+ { 201865, BELLBOT_RANGE192, true, false },
+ { 201870, BELLBOT_RANGE193, false, false },
+ { 201877, BELLBOT_RANGE194, false, false },
+ { 201906, BELLBOT_RANGE195, true, false },
+ { 201916, BELLBOT_RANGE196, true, false },
+ { 201924, BELLBOT_RANGE197, true, false },
+ { 201930, BELLBOT_RANGE198, true, false },
+ { 201988, BELLBOT_RANGE199, true, false },
+ { 202048, BELLBOT_RANGE200, true, false },
+
+ { 202052, BELLBOT_RANGE201, true, false },
+ { 202056, BELLBOT_RANGE202, true, false },
+ { 202059, BELLBOT_RANGE203, true, false },
+ { 202092, BELLBOT_RANGE204, true, false },
+ { 202096, BELLBOT_RANGE205, false, false },
+ { 202103, BELLBOT_RANGE206, true, false },
+ { 202111, BELLBOT_RANGE207, true, false },
+ { 202116, BELLBOT_RANGE208, true, true },
+ { 202119, BELLBOT_RANGE209, true, false },
+ { 202127, BELLBOT_RANGE210, true, false },
+
+ { 202145, BELLBOT_RANGE211, true, false },
+ { 202150, BELLBOT_RANGE212, true, false },
+ { 202162, BELLBOT_RANGE213, true, false },
+ { 202165, BELLBOT_RANGE214, true, false },
+ { 202171, BELLBOT_RANGE215, true, false },
+ { 202175, BELLBOT_RANGE216, false, false },
+ { 202185, BELLBOT_RANGE217, false, false },
+ { 202191, BELLBOT_RANGE218, false, false },
+ { 202194, BELLBOT_RANGE219, false, false },
+ { 202157, BELLBOT_RANGE220, false, false },
+
+ { 202256, BELLBOT_RANGE221, true, false },
+ { 202255, BELLBOT_RANGE222, true, false },
+ { 202257, BELLBOT_RANGE223, true, false },
+ { 202258, BELLBOT_RANGE224, true, false },
+ { 202259, BELLBOT_RANGE225, true, false },
+ { 202260, BELLBOT_RANGE226, true, false },
+ { 202261, BELLBOT_RANGE227, true, false },
+ { 202262, BELLBOT_RANGE228, true, false },
+ { 202263, BELLBOT_RANGE229, true, false },
+ { 202264, BELLBOT_RANGE230, true, false },
+
+ { 202265, BELLBOT_RANGE231, true, false },
+ { 202266, BELLBOT_RANGE232, true, false },
+ { 202267, BELLBOT_RANGE233, true, false },
+ { 202268, BELLBOT_RANGE234, true, false },
+ { 202269, BELLBOT_RANGE235, true, false },
+ { 202270, BELLBOT_RANGE236, true, false },
+ { 202271, BELLBOT_RANGE237, true, false },
+ { 202272, BELLBOT_RANGE238, true, false },
+ { 202273, BELLBOT_RANGE239, true, false },
+ { 202274, BELLBOT_RANGE240, true, false }
+};
+
+const uint DESKBOT_RANGE1[] = { 240002, 240003, 240006, 240007, 0 };
+const uint DESKBOT_RANGE2[] = { 240008, 240009, 240010, 240011, 240012, 240013, 240004, 240005, 0 };
+const uint DESKBOT_RANGE3[] = { 240336, 240337, 240338, 240339, 240340, 240341, 240342, 240343, 240344, 0 };
+const uint DESKBOT_RANGE4[] = { 240345, 240346, 240347, 0 };
+const uint DESKBOT_RANGE5[] = { 240348, 240349, 240350, 0 };
+const uint DESKBOT_RANGE6[] = { 240351, 240352, 240353, 0 };
+const uint DESKBOT_RANGE7[] = { 240355, 240356, 240357, 0 };
+const uint DESKBOT_RANGE8[] = { 240359, 240360, 240361, 0 };
+const uint DESKBOT_RANGE9[] = { 240362, 240363, 240364, 240365, 240366, 240367, 0 };
+const uint DESKBOT_RANGE10[] = { 240368, 240369, 240370, 240371, 0 };
+
+const uint DESKBOT_RANGE11[] = { 240372, 240373, 240374, 0 };
+const uint DESKBOT_RANGE12[] = { 240375, 240376, 240377, 0 };
+const uint DESKBOT_RANGE13[] = { 240378, 240379, 240380, 0 };
+const uint DESKBOT_RANGE14[] = { 240381, 240382, 240383, 240384, 0 };
+const uint DESKBOT_RANGE15[] = { 240385, 240386, 240387, 0 };
+const uint DESKBOT_RANGE16[] = { 240388, 240389, 240390, 0 };
+const uint DESKBOT_RANGE17[] = { 240391, 240392, 240393, 0 };
+const uint DESKBOT_RANGE18[] = { 240394, 240395, 240396, 240397, 0 };
+const uint DESKBOT_RANGE19[] = { 240399, 0 };
+const uint DESKBOT_RANGE20[] = { 240401, 240402, 240403, 0 };
+
+const uint DESKBOT_RANGE21[] = { 240404, 240405, 240406, 0 };
+const uint DESKBOT_RANGE22[] = { 240407, 240408, 240409, 240900, 240410, 240411, 240412, 240900, 241671, 241672,
+241673, 241671, 241672, 241673, 241671, 241672, 241673, 0 };
+const uint DESKBOT_RANGE23[] = { 240421, 240422, 0 };
+const uint DESKBOT_RANGE24[] = { 240451, 240424, 240425, 240426, 240452, 240455, 240456, 240457, 240458, 240459, 240460, 0 };
+const uint DESKBOT_RANGE25[] = { 240451, 240424, 240425, 240426, 240452, 240455, 240456, 240457, 240458, 0 };
+const uint DESKBOT_RANGE26[] = { 240428, 240429, 240430, 0 };
+const uint DESKBOT_RANGE27[] = { 240431, 240432, 0 };
+const uint DESKBOT_RANGE28[] = { 240435, 240436, 240437, 240438, 240439, 0 };
+const uint DESKBOT_RANGE29[] = { 240440, 240441, 240442, 240443, 240444, 0 };
+const uint DESKBOT_RANGE30[] = { 240451, 240452, 0 };
+
+const uint DESKBOT_RANGE31[] = { 240455, 240456, 240457, 240458, 240459, 240460, 0 };
+const uint DESKBOT_RANGE32[] = { 240461, 240462, 240463, 240464, 240977, 240978, 240979, 240980, 240804, 240806,
+ 240807, 240808, 0 };
+const uint DESKBOT_RANGE33[] = { 241742, 241743, 241744, 241745, 241746, 241747, 241748, 240954, 0 };
+const uint DESKBOT_RANGE34[] = { 240480, 240481, 240482, 0 };
+const uint DESKBOT_RANGE35[] = { 241117, 241515, 0 };
+const uint DESKBOT_RANGE36[] = { 240486, 241585, 240487, 241585, 240488, 241585, 0 };
+const uint DESKBOT_RANGE37[] = { 240490, 240491, 0 };
+const uint DESKBOT_RANGE38[] = { 240496, 240507, 240518, 240529, 240540, 240542, 240543, 240544, 240545, 240497,
+ 240498, 240499, 240500, 240501, 240502, 240503, 240504, 240505, 240506, 240508,
+ 240509, 240510, 240511, 240512, 240513, 240514, 240515, 240516, 240517, 240519,
+ 240520, 240521, 240522, 240523, 240524, 240525, 240526, 240527, 240528, 240530,
+ 240531, 240532, 240533, 240534, 240535, 240536, 240537, 240538, 240539, 240541, 0 };
+const uint DESKBOT_RANGE39[] = { 240587, 240588, 0 };
+const uint DESKBOT_RANGE40[] = { 240589, 240590, 240591, 241652, 0 };
+
+const uint DESKBOT_RANGE41[] = { 240592, 240593, 240594, 241653, 0 };
+const uint DESKBOT_RANGE42[] = { 240595, 240596, 0 };
+const uint DESKBOT_RANGE43[] = { 240597, 240598, 0 };
+const uint DESKBOT_RANGE44[] = { 240602, 240613, 240622, 240623, 240624, 240627, 240603, 240606, 240609, 0 };
+const uint DESKBOT_RANGE45[] = { 240629, 240630, 240354, 0 };
+const uint DESKBOT_RANGE46[] = { 240635, 240636, 240637, 0 };
+const uint DESKBOT_RANGE47[] = {
+ 240640, 240656, 240667, 240678, 240689, 240699, 240710, 240721, 240732, 240641,
+ 240647, 240648, 240649, 240650, 240651, 240652, 240653, 240654, 240655, 240657,
+ 240658, 240659, 240660, 240661, 240662, 240663, 240664, 240665, 240666, 240668,
+ 240669, 240670, 240671, 240672, 240673, 240674, 240675, 240676, 240677, 240679,
+ 240680, 240681, 240682, 240683, 240684, 240685, 240686, 240687, 240688, 240690,
+ 240691, 240692, 240693, 240694, 240695, 240696, 240697, 240698, 240700, 240701,
+ 240702, 240703, 240704, 240705, 240706, 240707, 240708, 240709, 240711, 240712,
+ 240713, 240714, 240715, 240716, 240717, 240718, 240719, 240720, 240722, 240723,
+ 240724, 240725, 240726, 240727, 240728, 240729, 240730, 240731, 240733, 240734,
+ 240735, 240736, 240737, 240738, 240739, 240740, 240741, 240742, 240642, 240643,
+ 240644, 240645, 240646, 0
+};
+const uint DESKBOT_RANGE48[] = { 240758, 240759, 240760, 0 };
+const uint DESKBOT_RANGE49[] = { 240761, 240762, 240764, 240766, 0 };
+const uint DESKBOT_RANGE50[] = { 240335, 240776, 240778, 240779, 240780, 240781, 0 };
+
+const uint DESKBOT_RANGE51[] = { 240335, 240776, 240777, 240778, 240779, 240780, 240781, 0 };
+const uint DESKBOT_RANGE52[] = { 240782, 240783, 240834, 240592, 240589, 240768, 240770, 240771, 240769, 240772,
+240773, 240590, 240593, 240595, 240587, 240597, 240591, 240594, 240596, 240588,
+240598, 241120, 240675, 241124, 0 };
+const uint DESKBOT_RANGE53[] = { 240787, 240788, 240789, 240790, 240791, 241635, 0 };
+const uint DESKBOT_RANGE54[] = { 240792, 240793, 240794, 240795, 240796, 240797, 241635, 0 };
+const uint DESKBOT_RANGE55[] = { 240798, 240799, 240800, 241635, 0 };
+const uint DESKBOT_RANGE56[] = { 240804, 240806, 240807, 240808, 0 };
+const uint DESKBOT_RANGE57[] = { 240809, 240820, 240822, 240823, 240824, 240825, 240826, 240827, 240828, 240829,
+240810, 240811, 240812, 240813, 240814, 240815, 240816, 240817, 240818, 240819,
+240821, 0 };
+const uint DESKBOT_RANGE58[] = { 240835, 240836, 240837, 240838, 240839, 240840, 0 };
+const uint DESKBOT_RANGE59[] = { 240861, 240862, 240863, 0 };
+const uint DESKBOT_RANGE60[] = { 240881, 240883, 240884, 240885, 240886, 240887, 240888, 240889, 240890, 240882, 0 };
+
+const uint DESKBOT_RANGE61[] = { 240894, 240895, 240896, 240897, 240898, 240899, 240900, 240901, 240902, 0 };
+const uint DESKBOT_RANGE62[] = { 240904, 240905, 240906, 240907, 240908, 241342, 0 };
+const uint DESKBOT_RANGE63[] = { 240911, 240922, 240930, 240932, 240933, 240934, 240935, 240936, 240937, 240912,
+ 240913, 240914, 240915, 240916, 240917, 240918, 240919, 240920, 240921, 240923,
+ 240931, 240925, 240926, 240927, 240928, 240929, 0
+};
+const uint DESKBOT_RANGE64[] = { 240948, 240949, 240950, 240951, 0 };
+const uint DESKBOT_RANGE65[] = { 240959, 240960, 240961, 240962, 0 };
+const uint DESKBOT_RANGE66[] = { 240965, 240966, 0 };
+const uint DESKBOT_RANGE67[] = { 240972, 240973, 240974, 0 };
+const uint DESKBOT_RANGE68[] = { 240977, 240978, 240979, 240980, 0 };
+const uint DESKBOT_RANGE69[] = { 240982, 240983, 240984, 240985, 0 };
+const uint DESKBOT_RANGE70[] = { 240988, 240989, 240990, 240991, 0 };
+
+const uint DESKBOT_RANGE71[] = { 240992, 240994, 240995, 240996, 240997, 240998, 241000, 241001, 0 };
+const uint DESKBOT_RANGE72[] = { 241002, 241004, 241005, 241006, 241007, 241008, 241009, 241010, 241011, 241003, 0 };
+const uint DESKBOT_RANGE73[] = {
+ 241012, 241023, 241034, 241045, 241050, 241051, 241052, 241053, 241054, 241013,
+ 241014, 241015, 241016, 241017, 241018, 241019, 241020, 241021, 241022, 241024,
+ 241025, 241026, 241027, 241028, 241029, 241030, 241031, 241032, 241033, 241035,
+ 241036, 241037, 241038, 241039, 241040, 241041, 241042, 241043, 241044, 241046,
+ 241047, 241048, 241049, 0
+};
+const uint DESKBOT_RANGE74[] = { 241055, 241057, 241058, 241059, 241060, 241061, 241062, 241063, 241064, 241056, 0 };
+const uint DESKBOT_RANGE75[] = { 241078, 241079, 241080, 241081, 241082, 241083, 241084, 241085, 0 };
+const uint DESKBOT_RANGE76[] = { 241091, 241092, 241093, 241094, 241095, 0 };
+const uint DESKBOT_RANGE77[] = { 241103, 241104, 241105, 241106, 241107, 0 };
+const uint DESKBOT_RANGE78[] = {
+ 241132, 241127, 241133, 241140, 241151, 241152, 241153, 241154, 241155, 241156,
+ 241157, 241128, 241129, 241130, 241131, 241136, 241137, 241138, 241139, 241141,
+ 241142, 241143, 241144, 241145, 241146, 241147, 241148, 241149, 241150, 0
+};
+const uint DESKBOT_RANGE79[] = { 240404, 241099, 0 };
+const uint DESKBOT_RANGE80[] = { 241125, 241124, 241125, 241125, 240649, 240729, 241686, 241680, 241738, 0 };
+
+const uint DESKBOT_RANGE81[] = { 241096, 241112, 240727, 241679, 241738, 0 };
+const uint DESKBOT_RANGE82[] = { 240833, 240845, 241464, 241465, 241674, 241738, 0 };
+const uint DESKBOT_RANGE83[] = { 240726, 241684, 241738, 0 };
+const uint DESKBOT_RANGE84[] = { 240728, 240728, 240728, 240644, 240953, 240728, 240601, 240728, 241075, 240728,
+240952, 240728, 240600, 241120, 241683, 241738, 241738, 241738, 0 };
+const uint DESKBOT_RANGE85[] = { 240730, 241738, 0 };
+const uint DESKBOT_RANGE86[] = { 240008, 240009, 240010, 240011, 240012, 240013, 240004, 240005, 0 };
+const uint DESKBOT_RANGE87[] = { 240677, 240680, 240766, 241109, 240633, 240747, 240940, 241187, 241120, 240665,
+240669, 240620, 0 };
+const uint DESKBOT_RANGE88[] = {
+ 240948, 240602, 240613, 240622, 240624, 240625, 240626, 240627, 240603, 240605,
+ 240607, 240609, 240610, 241150, 240925, 240882, 240864, 241072, 240942, 240867,
+ 241096, 240971, 240785, 240868, 240833, 240955, 241077, 240877, 240754, 241163,
+ 241071, 241161, 240871, 241114, 240963, 240956, 240750, 240958, 240851, 240866,
+ 241100, 240941, 241115, 241088, 240628, 240846, 240857, 241164, 241165, 240954,
+ 241087, 240869, 240784, 240637, 240700, 240701, 240704, 240929, 240716, 240717,
+ 240720, 240689, 240732, 240648, 240653, 240664, 240676, 0
+};
+const uint DESKBOT_RANGE89[] = { 241012, 0 };
+const uint DESKBOT_RANGE90[] = { 240775, 240419, 240701, 240642, 240802, 240891, 241110, 241568, 241569, 241570, 241571, 0 };
+
+const uint DESKBOT_RANGE91[] = { 241338, 240831, 0 };
+const uint DESKBOT_RANGE92[] = { 240416, 241343, 0 };
+const uint DESKBOT_RANGE93[] = { 241577, 241578, 241579, 241580, 241581, 241582, 0 };
+const uint DESKBOT_RANGE94[] = { 241383, 241586, 0 };
+const uint DESKBOT_RANGE95[] = { 241446, 241447, 241448, 0 };
+const uint DESKBOT_RANGE96[] = { 241443, 241444, 241445, 0 };
+const uint DESKBOT_RANGE97[] = { 241116, 241365, 0 };
+const uint DESKBOT_RANGE98[] = {
+ 241522, 241523, 241524, 241525, 241526, 241527, 241528, 241529, 241530, 241531,
+ 241532, 241533, 241534, 241535, 241536, 241537, 241538, 241539, 241540, 241541,
+ 241542, 241543, 241544, 241545, 241546, 241547, 241548, 241549, 241550, 241551,
+ 241552, 241553, 241554, 0
+};
+const uint DESKBOT_RANGE99[] = { 241341, 241634, 0 };
+const uint DESKBOT_RANGE100[] = { 241449, 241635, 241450, 241635, 0 };
+
+const uint DESKBOT_RANGE101[] = { 241638, 241639, 241640, 241654, 241655, 241643, 0 };
+const uint DESKBOT_RANGE102[] = { 241702, 241703, 241704, 0 };
+const uint DESKBOT_RANGE103[] = { 240465, 241641, 0 };
+const uint DESKBOT_RANGE104[] = { 241371, 241111, 0 };
+
+#define DESKBOT_RANGE_COUNT 146
+const ScriptRange DESKBOT_RANGES[146] = {
+ { 240546, DESKBOT_RANGE1, false, false },
+ { 240547, DESKBOT_RANGE2, false, false },
+ { 240548, DESKBOT_RANGE3, false, false },
+ { 240549, DESKBOT_RANGE4, false, false },
+ { 240550, DESKBOT_RANGE5, false, false },
+ { 240551, DESKBOT_RANGE6, false, false },
+ { 240552, DESKBOT_RANGE7, false, false },
+ { 240553, DESKBOT_RANGE8, false, false },
+ { 240554, DESKBOT_RANGE9, false, false },
+ { 240555, DESKBOT_RANGE10, false, false },
+
+ { 240556, DESKBOT_RANGE11, false, false },
+ { 240557, DESKBOT_RANGE12, false, false },
+ { 240558, DESKBOT_RANGE13, false, false },
+ { 240559, DESKBOT_RANGE14, false, false },
+ { 240560, DESKBOT_RANGE15, false, false },
+ { 240561, DESKBOT_RANGE16, false, false },
+ { 240562, DESKBOT_RANGE17, false, false },
+ { 240563, DESKBOT_RANGE18, false, false },
+ { 240564, DESKBOT_RANGE19, false, false },
+ { 240565, DESKBOT_RANGE20, false, false },
+
+ { 240566, DESKBOT_RANGE21, false, false },
+ { 240567, DESKBOT_RANGE22, true, false },
+ { 240568, DESKBOT_RANGE23, false, false },
+ { 240569, DESKBOT_RANGE24, false, false },
+ { 240570, DESKBOT_RANGE25, false, false },
+ { 240571, DESKBOT_RANGE26, false, false },
+ { 240572, DESKBOT_RANGE27, false, false },
+ { 240573, DESKBOT_RANGE28, true, false },
+ { 240574, DESKBOT_RANGE29, false, false },
+ { 240575, DESKBOT_RANGE30, false, false },
+
+ { 240576, DESKBOT_RANGE31, false, false },
+ { 240577, DESKBOT_RANGE32, true, false },
+ { 240578, DESKBOT_RANGE33, true, false },
+ { 240579, DESKBOT_RANGE34, false, false },
+ { 240580, DESKBOT_RANGE35, true, false },
+ { 240581, DESKBOT_RANGE36, false, false },
+ { 240582, DESKBOT_RANGE37, false, false },
+ { 240583, DESKBOT_RANGE38, false, false },
+ { 241167, DESKBOT_RANGE39, false, false },
+ { 241168, DESKBOT_RANGE40, true, false },
+
+ { 241169, DESKBOT_RANGE41, true, false },
+ { 241170, DESKBOT_RANGE42, false, false },
+ { 241171, DESKBOT_RANGE43, false, false },
+ { 241172, DESKBOT_RANGE44, false, false },
+ { 241173, DESKBOT_RANGE45, false, false },
+ { 241174, DESKBOT_RANGE46, false, false },
+ { 241175, DESKBOT_RANGE47, false, false },
+ { 241176, DESKBOT_RANGE48, false, false },
+ { 241177, DESKBOT_RANGE49, false, false },
+ { 241178, DESKBOT_RANGE50, true, false },
+
+ { 241179, DESKBOT_RANGE51, true, false },
+ { 241180, DESKBOT_RANGE52, true, false },
+ { 241181, DESKBOT_RANGE53, true, false },
+ { 241182, DESKBOT_RANGE54, true, false },
+ { 241183, DESKBOT_RANGE55, true, false },
+ { 241184, DESKBOT_RANGE56, true, false },
+ { 241185, DESKBOT_RANGE57, false, false },
+ { 241186, DESKBOT_RANGE58, false, false },
+ { 241187, DESKBOT_RANGE59, false, false },
+ { 241188, DESKBOT_RANGE60, true, false },
+
+ { 241189, DESKBOT_RANGE61, false, false },
+ { 241190, DESKBOT_RANGE62, true, false },
+ { 241191, DESKBOT_RANGE63, true, false },
+ { 241192, DESKBOT_RANGE64, false, false },
+ { 241193, DESKBOT_RANGE65, false, false },
+ { 241194, DESKBOT_RANGE66, false, false },
+ { 241195, DESKBOT_RANGE67, false, false },
+ { 241196, DESKBOT_RANGE68, false, false },
+ { 241197, DESKBOT_RANGE69, true, false },
+ { 241198, DESKBOT_RANGE70, true, false },
+
+ { 241199, DESKBOT_RANGE71, false, false },
+ { 241200, DESKBOT_RANGE72, false, false },
+ { 241201, DESKBOT_RANGE73, false, false },
+ { 241202, DESKBOT_RANGE74, false, false },
+ { 241203, DESKBOT_RANGE75, false, false },
+ { 241204, DESKBOT_RANGE76, false, false },
+ { 241205, DESKBOT_RANGE77, false, false },
+ { 241166, DESKBOT_RANGE78, false, false },
+ { 241206, DESKBOT_RANGE79, false, false },
+ { 241207, DESKBOT_RANGE80, true, false },
+
+ { 241208, DESKBOT_RANGE81, true, false },
+ { 241209, DESKBOT_RANGE82, true, false },
+ { 241210, DESKBOT_RANGE83, true, false },
+ { 241211, DESKBOT_RANGE84, true, false },
+ { 241212, DESKBOT_RANGE85, true, false },
+ { 241213, DESKBOT_RANGE86, true, false },
+ { 241214, DESKBOT_RANGE87, true, false },
+ { 241215, DESKBOT_RANGE88, true, false },
+
+ { 241217, DESKBOT_RANGE89, false, false },
+ { 241218, DESKBOT_RANGE89, false, false },
+ { 241219, DESKBOT_RANGE89, false, false },
+ { 241220, DESKBOT_RANGE89, false, false },
+ { 241221, DESKBOT_RANGE89, false, false },
+ { 241222, DESKBOT_RANGE89, false, false },
+ { 241223, DESKBOT_RANGE89, false, false },
+ { 241224, DESKBOT_RANGE89, false, false },
+ { 241225, DESKBOT_RANGE89, false, false },
+ { 241226, DESKBOT_RANGE89, false, false },
+ { 241227, DESKBOT_RANGE89, false, false },
+ { 241228, DESKBOT_RANGE89, false, false },
+ { 241229, DESKBOT_RANGE89, false, false },
+ { 241230, DESKBOT_RANGE89, false, false },
+ { 241231, DESKBOT_RANGE89, false, false },
+ { 241232, DESKBOT_RANGE89, false, false },
+ { 241233, DESKBOT_RANGE89, false, false },
+ { 241234, DESKBOT_RANGE89, false, false },
+ { 241235, DESKBOT_RANGE89, false, false },
+ { 241236, DESKBOT_RANGE89, false, false },
+ { 241237, DESKBOT_RANGE89, false, false },
+ { 241238, DESKBOT_RANGE89, false, false },
+ { 241239, DESKBOT_RANGE89, false, false },
+ { 241240, DESKBOT_RANGE89, false, false },
+ { 241241, DESKBOT_RANGE89, false, false },
+ { 241242, DESKBOT_RANGE89, false, false },
+ { 241243, DESKBOT_RANGE89, false, false },
+ { 241244, DESKBOT_RANGE89, false, false },
+ { 241245, DESKBOT_RANGE89, false, false },
+ { 241246, DESKBOT_RANGE89, false, false },
+ { 241247, DESKBOT_RANGE89, false, false },
+ { 241248, DESKBOT_RANGE89, false, false },
+ { 241249, DESKBOT_RANGE89, false, false },
+ { 241250, DESKBOT_RANGE89, false, false },
+ { 241251, DESKBOT_RANGE89, false, false },
+ { 241252, DESKBOT_RANGE89, false, false },
+ { 241253, DESKBOT_RANGE89, false, false },
+ { 241254, DESKBOT_RANGE89, false, false },
+ { 241255, DESKBOT_RANGE89, false, false },
+ { 241256, DESKBOT_RANGE89, false, false },
+ { 241257, DESKBOT_RANGE89, false, false },
+ { 241258, DESKBOT_RANGE89, false, false },
+ { 241259, DESKBOT_RANGE89, false, false },
+
+ { 241216, DESKBOT_RANGE90, true, false },
+ { 241625, DESKBOT_RANGE91, false, false },
+ { 241626, DESKBOT_RANGE92, true, false },
+ { 241627, DESKBOT_RANGE93, false, false },
+ { 241628, DESKBOT_RANGE94, true, false },
+ { 241629, DESKBOT_RANGE95, true, false },
+ { 241630, DESKBOT_RANGE96, true, false },
+ { 241631, DESKBOT_RANGE97, true, false },
+ { 241632, DESKBOT_RANGE98, true, false },
+ { 241633, DESKBOT_RANGE99, true, false },
+ { 241634, DESKBOT_RANGE100, true, false },
+
+ { 241738, DESKBOT_RANGE101, true, false },
+ { 241739, DESKBOT_RANGE102, true, false },
+ { 241740, DESKBOT_RANGE103, true, false },
+ { 241741, DESKBOT_RANGE104, true, false }
+};
+
+const uint DOORBOT_RANGE1[] = { 220075, 220078, 220080, 220081, 220082, 220083, 220084, 0 };
+const uint DOORBOT_RANGE2[] = { 220077, 220079, 220076, 0 };
+const uint DOORBOT_RANGE3[] = {
+ 220008, 220009, 220010, 220011, 220012, 220013, 220014,
+ 220015, 220016, 221053, 221054, 221055, 221056, 221057,
+ 221058, 221059, 221060, 221061, 0
+};
+const uint DOORBOT_RANGE4[] = {
+ 221062, 221063, 221064, 221065, 221066, 221067, 221068,
+ 221069, 221070, 221071, 221072, 221073, 221074, 221075,
+ 221076, 221077, 221078, 221079, 221080, 221081, 221082,
+ 0
+};
+const uint DOORBOT_RANGE5[] = { 220737, 220738, 220739, 220740, 0 };
+const uint DOORBOT_RANGE6[] = { 220759, 220760, 220761, 0 };
+const uint DOORBOT_RANGE7[] = { 220771, 220772, 220773, 220774, 220775, 0 };
+const uint DOORBOT_RANGE8[] = { 220792, 220793, 220794, 220795, 220796, 220797, 220798, 0 };
+const uint DOORBOT_RANGE9[] = { 220017, 220018, 220019, 220020, 220833, 0 };
+const uint DOORBOT_RANGE10[] = { 220035, 220036, 220038, 0 };
+
+const uint DOORBOT_RANGE11[] = { 220093, 220094, 220095, 0 };
+const uint DOORBOT_RANGE12[] = { 220109, 220117, 0 };
+const uint DOORBOT_RANGE13[] = { 220837, 220838, 220839, 0 };
+const uint DOORBOT_RANGE14[] = { 220849, 220850, 220851, 220852, 0 };
+const uint DOORBOT_RANGE15[] = { 220858, 220860, 0 };
+const uint DOORBOT_RANGE16[] = { 221043, 221045, 221046, 221047, 221048, 221049, 221050,
+ 221051, 221052, 221044, 0 };
+const uint DOORBOT_RANGE17[] = { 221140, 221141, 221142, 221143, 221144, 221145, 221146,
+ 221147, 0 };
+const uint DOORBOT_RANGE18[] = { 220885, 220886, 220887, 220888, 220890, 220883, 220884,
+ 220889, 0 };
+const uint DOORBOT_RANGE19[] = {
+ 221356, 221364, 221365, 221366, 221129, 221367, 221368,
+ 221132, 221369, 221357, 221359, 221363, 220902, 0
+};
+const uint DOORBOT_RANGE20[] = { 221129, 221130, 221131, 221132, 221133, 221136, 221137,
+ 221138, 0 };
+const uint DOORBOT_RANGE21[] = { 221157, 221165, 221166, 221167, 221130, 221168, 221169,
+ 221132, 221170, 221171, 221158, 220910, 0 };
+const uint DOORBOT_RANGE22[] = { 221356, 221364, 221366, 221129, 221368, 221132, 221369,
+ 221357, 221359, 221363, 220902, 220919, 220911, 220936,
+ 220942, 220946, 220988, 0
+};
+const uint DOORBOT_RANGE23[] = {
+ 221157, 221165, 221166, 221167, 221130, 221168, 221169,
+ 221132, 221170, 221171, 221158, 220910, 220911, 220929,
+ 220944, 220948, 220909, 0
+};
+const uint DOORBOT_RANGE24[] = { 220980, 220981, 220982, 220984, 220956, 220931, 220926,
+ 220916, 220914, 220913, 220974, 220952, 0 };
+const uint DOORBOT_RANGE25[] = { 220873, 220874, 220875, 220876, 220877, 0 };
+const uint DOORBOT_RANGE26[] = { 221242, 221243, 221244, 221242, 221243, 221244, 221251, 0 };
+const uint DOORBOT_RANGE27[] = { 221245, 221246, 221247, 221248, 221249, 221250, 0 };
+const uint DOORBOT_RANGE28[] = { 221777, 221780, 0 };
+const uint DOORBOT_RANGE29[] = { 221966, 221967, 0 };
+const uint DOORBOT_RANGE30[] = { 220986, 222096, 222099, 222102, 0 };
+const uint DOORBOT_RANGE31[] = { 222193, 222197, 222198, 222199, 222200, 222201, 222202,
+ 222203, 222204, 222194, 222195, 222196, 0 };
+const uint DOORBOT_RANGE32[] = { 221927, 221931, 0 };
+const uint DOORBOT_RANGE33[] = { 221945, 221948, 0 };
+const uint DOORBOT_RANGE34[] = { 222004, 222001, 0 };
+const uint DOORBOT_RANGE35[] = { 222259, 222262, 222265, 222268, 222271, 222274, 222277,
+ 222280, 222283, 222254, 222257, 0 };
+const uint DOORBOT_RANGE36[] = { 221364, 221365, 221360, 221252, 220952, 220916, 220996,
+ 220924, 220926, 220931, 220956, 220967, 220968, 220980,
+ 220981, 220982, 220984, 220988, 0 };
+const uint DOORBOT_RANGE37[] = {
+ 221166, 221252, 220984, 220952, 220996, 220916, 220926,
+ 220931, 220948, 220965, 220967, 220980, 220981, 220982,
+ 220983, 220988, 220903, 221019, 221355, 0 };
+const uint DOORBOT_RANGE38[] = { 222248, 220081, 220082, 220083, 220084, 0 };
+const uint DOORBOT_RANGE39[] = { 221095, 222202, 222239, 221758, 221759, 221762, 221763,
+ 221766, 221767, 221768, 0 };
+
+#define DOORBOT_RANGE_COUNT 39
+const ScriptRange DOORBOT_RANGES[39] = {
+ { 220074, DOORBOT_RANGE1, false, false },
+ { 221381, DOORBOT_RANGE2, false, false },
+ { 220000, DOORBOT_RANGE3, true, false },
+ { 221380, DOORBOT_RANGE4, true, false },
+ { 220736, DOORBOT_RANGE5, false, false },
+ { 220759, DOORBOT_RANGE6, false, false },
+ { 220771, DOORBOT_RANGE7, false, false },
+ { 220792, DOORBOT_RANGE8, false, false },
+ { 220017, DOORBOT_RANGE9, false, false },
+ { 220037, DOORBOT_RANGE10, false, false },
+
+ { 220093, DOORBOT_RANGE11, false, false },
+ { 220109, DOORBOT_RANGE12, false, false },
+ { 220837, DOORBOT_RANGE13, false, false },
+ { 220849, DOORBOT_RANGE14, false, false },
+ { 220858, DOORBOT_RANGE15, false, false },
+ { 221043, DOORBOT_RANGE16, false, false },
+ { 221140, DOORBOT_RANGE17, false, false },
+ { 220883, DOORBOT_RANGE18, false, false },
+ { 221375, DOORBOT_RANGE19, true, false },
+ { 221129, DOORBOT_RANGE20, true, false },
+
+ { 221376, DOORBOT_RANGE21, true, false },
+ { 221377, DOORBOT_RANGE22, true, false },
+ { 221378, DOORBOT_RANGE23, true, false },
+ { 221379, DOORBOT_RANGE24, true, false },
+ { 220873, DOORBOT_RANGE25, false, false },
+ { 221242, DOORBOT_RANGE26, false, false },
+ { 221245, DOORBOT_RANGE27, false, false },
+ { 221777, DOORBOT_RANGE28, false, false },
+ { 221966, DOORBOT_RANGE29, false, false },
+ { 220986, DOORBOT_RANGE30, false, false },
+
+ { 222193, DOORBOT_RANGE31, false, false },
+ { 221927, DOORBOT_RANGE32, false, false },
+ { 221948, DOORBOT_RANGE33, false, true },
+ { 222000, DOORBOT_RANGE34, false, false },
+ { 222259, DOORBOT_RANGE35, false, false },
+ { 222415, DOORBOT_RANGE36, true, false },
+ { 222416, DOORBOT_RANGE37, true, false },
+ { 222248, DOORBOT_RANGE38, false, false },
+ { 221095, DOORBOT_RANGE39, true, false }
+};
+
+const uint LIFTBOT_RANGE1[] = { 210028, 210034, 210039, 210044, 210049, 210054, 0 };
+const uint LIFTBOT_RANGE2[] = { 210321, 210322, 210323, 210324, 210792, 210794, 210796, 210793, 210795, 210797, 0 };
+const uint LIFTBOT_RANGE3[] = {
+ 210572, 210568, 210338, 210341, 210355, 210419, 210430, 210441, 210460, 210463,
+ 210464, 210475, 210477, 210496, 210497, 210503, 210357, 210359, 210372, 210382,
+ 210388, 210393, 210394, 210400, 210415, 0
+};
+const uint LIFTBOT_RANGE4[] = {
+ 210568, 210342, 210555, 210551, 210534, 210557, 210334, 210474, 210504, 210505,
+ 210517, 210358, 210359, 210360, 210376, 210378, 210379, 210382, 210396, 210398,
+ 210402, 0
+};
+const uint LIFTBOT_RANGE5[] = {
+ 210572, 210568, 210397, 210408, 210419, 210430, 210441, 210460, 210463, 210464,
+ 210475, 210477, 210496, 210497, 210503, 210357, 210359, 210372, 210382, 210388,
+ 210393, 210394, 210400, 210415, 0
+};
+const uint LIFTBOT_RANGE6[] = {
+ 210555, 210551, 210534, 210557, 210334, 210474, 210504, 210505, 210517, 210358,
+ 210359, 210360, 210376, 210378, 210379, 210382, 210396, 210398, 210402, 0
+};
+const uint LIFTBOT_RANGE7[] = { 210344, 210447, 210529, 210530, 210351, 210356, 210378, 0 };
+const uint LIFTBOT_RANGE8[] = { 210512, 210513, 210345, 0 };
+const uint LIFTBOT_RANGE9[] = { 210847, 210848, 210153, 0 };
+const uint LIFTBOT_RANGE10[] = { 210846, 210153, 0 };
+
+const uint LIFTBOT_RANGE11[] = { 210595, 210601, 210602, 210603, 210604, 210605, 210606, 210607, 210608, 210596,
+ 210597, 210598, 210599, 210600, 0 };
+const uint LIFTBOT_RANGE12[] = { 210489, 210570, 210610, 210610, 210610, 210610, 210610, 0 };
+const uint LIFTBOT_RANGE13[] = { 210819, 210822, 210823, 210824, 210825, 210827, 210828, 210829, 210820, 210821,
+ 210965, 210969, 210965, 210969, 0 };
+const uint LIFTBOT_RANGE14[] = { 210869, 210870, 210871, 210872, 210873, 0 };
+const uint LIFTBOT_RANGE15[] = { 210875, 210876, 210877, 210878, 210879, 0 };
+const uint LIFTBOT_RANGE16[] = { 210866, 210867, 0 };
+const uint LIFTBOT_RANGE17[] = { 210853, 210854, 0 };
+const uint LIFTBOT_RANGE18[] = { 210858, 210859, 0 };
+const uint LIFTBOT_RANGE19[] = { 210860, 210861, 210862, 210863, 210864, 210865, 0 };
+const uint LIFTBOT_RANGE20[] = { 210771, 210914, 0 };
+
+const uint LIFTBOT_RANGE21[] = { 210764, 210765, 210766, 210767, 210768, 210769, 210770, 0 };
+const uint LIFTBOT_RANGE22[] = { 210607, 210799, 210800, 210801, 210802, 210815, 210890, 210892, 0 };
+const uint LIFTBOT_RANGE23[] = { 210355, 210359, 210376, 210388, 210416, 210568, 210551, 0 };
+const uint LIFTBOT_RANGE24[] = { 210511, 210522, 210382, 210383, 210392, 210337, 210546, 210576, 0 };
+const uint LIFTBOT_RANGE25[] = { 210775, 210777, 210778, 210779, 210780, 210781, 210782, 210783, 210784, 210776,
+ 210459, 210789, 210790, 210791, 0 };
+const uint LIFTBOT_RANGE26[] = { 210780, 210781, 210782, 210783, 210784, 210780, 210781, 210782, 210783, 210784,
+ 210789, 210790, 210791, 0 };
+const uint LIFTBOT_RANGE27[] = { 210440, 210442, 0 };
+const uint LIFTBOT_RANGE28[] = { 210906, 210907, 210908, 210909, 210910, 210911, 210912, 0 };
+const uint LIFTBOT_RANGE29[] = { 210901, 210902, 210903, 210904, 210905, 0 };
+const uint LIFTBOT_RANGE30[] = { 210970, 210971, 210974, 210975, 210976, 210977, 210978, 210979, 210980, 210981,
+ 210972, 210973, 0 };
+
+const uint LIFTBOT_RANGE31[] = { 210830, 210831, 210832, 210833, 210834, 210835, 210836, 210837, 0 };
+const uint LIFTBOT_RANGE32[] = { 210692, 210695, 210696, 210697, 210698, 210699, 210700, 210701, 210702, 210693, 210694, 0 };
+const uint LIFTBOT_RANGE33[] = { 210915, 210916, 210917, 0 };
+const uint LIFTBOT_RANGE34[] = { 210688, 210689, 210690, 0 };
+const uint LIFTBOT_RANGE35[] = { 210946, 210947, 210948, 210949, 210950, 210951, 210952, 210953, 210954, 0 };
+const uint LIFTBOT_RANGE36[] = { 210923, 210924, 0 };
+const uint LIFTBOT_RANGE37[] = { 210925, 210926, 210927, 210928, 210929, 210930, 210931, 210932, 210933, 0 };
+const uint LIFTBOT_RANGE38[] = { 210413, 210799, 210800, 210801, 210802, 210888, 210889, 210890, 210891, 210892, 0 };
+const uint LIFTBOT_RANGE39[] = { 210682, 210684, 210028, 210034, 210683, 210039, 210685, 210044, 210049, 210686,
+ 210054, 0 };
+
+#define LIFTBOT_RANGE_COUNT 39
+const ScriptRange LIFTBOT_RANGES[39] = {
+ { 210033, LIFTBOT_RANGE1, false, false },
+ { 210321, LIFTBOT_RANGE2, true, false },
+ { 210580, LIFTBOT_RANGE3, true, false },
+ { 210581, LIFTBOT_RANGE4, true, false },
+ { 210582, LIFTBOT_RANGE5, true, false },
+ { 210583, LIFTBOT_RANGE6, true, false },
+ { 210584, LIFTBOT_RANGE7, true, false },
+ { 210585, LIFTBOT_RANGE8, true, false },
+ { 210586, LIFTBOT_RANGE9, false, false },
+ { 210587, LIFTBOT_RANGE10, false, false },
+
+ { 210588, LIFTBOT_RANGE11, true, false },
+ { 210589, LIFTBOT_RANGE12, true, false },
+ { 210590, LIFTBOT_RANGE13, true, false },
+ { 210869, LIFTBOT_RANGE14, false, false },
+ { 210875, LIFTBOT_RANGE15, false, false },
+ { 210866, LIFTBOT_RANGE16, false, false },
+ { 210853, LIFTBOT_RANGE17, false, false },
+ { 210858, LIFTBOT_RANGE18, false, false },
+ { 210860, LIFTBOT_RANGE19, false, false },
+ { 210771, LIFTBOT_RANGE20, false, false },
+
+ { 210764, LIFTBOT_RANGE21, false, false },
+ { 210958, LIFTBOT_RANGE22, true, false },
+ { 210591, LIFTBOT_RANGE23, true, false },
+ { 210592, LIFTBOT_RANGE24, true, false },
+ { 210594, LIFTBOT_RANGE25, true, false },
+ { 210593, LIFTBOT_RANGE26, true, false },
+ { 210440, LIFTBOT_RANGE27, false, false },
+ { 210906, LIFTBOT_RANGE28, true, false },
+ { 210901, LIFTBOT_RANGE29, true, false },
+ { 210970, LIFTBOT_RANGE30, false, false },
+
+ { 210830, LIFTBOT_RANGE31, true, false },
+ { 210692, LIFTBOT_RANGE32, false, false },
+ { 210915, LIFTBOT_RANGE33, false, false },
+ { 210688, LIFTBOT_RANGE34, false, false },
+ { 210946, LIFTBOT_RANGE35, true, false },
+ { 210923, LIFTBOT_RANGE36, false, false },
+ { 210925, LIFTBOT_RANGE37, true, false },
+ { 210413, LIFTBOT_RANGE38, true, false },
+ { 210682, LIFTBOT_RANGE39, false, false }
+};
+
+const uint MAITRED_RANGE1[] = { 260009, 260010, 260011, 260012, 0 };
+const uint MAITRED_RANGE2[] = {
+ 260043, 260013, 260044, 260014, 260017, 260015, 260016, 260040, 260042, 260019,
+ 260029, 260021, 260018, 260020, 260022, 260023, 260041, 260028, 260045, 260031,
+ 260032, 260033, 260030, 260046, 260034, 260039, 0
+};
+const uint MAITRED_RANGE3[] = {
+ 260013, 260014, 260029, 260040, 260041, 260042, 260043, 260044, 260045, 260046,
+ 260015, 260016, 260017, 260018, 260019, 260020, 260021, 260022, 260023, 260028,
+ 260030, 260031, 260032, 260033, 260034, 260035, 260039, 0
+};
+const uint MAITRED_RANGE4[] = {
+ 260013, 260014, 260029, 260040, 260041, 260042, 260043, 260044, 260045, 260046,
+ 260015, 260016, 260017, 260018, 260019, 260020, 260021, 260022, 260023, 260025,
+ 260028, 260030, 260031, 260032, 260033, 260034, 260036, 260039, 0
+};
+const uint MAITRED_RANGE5[] = {
+ 260013, 260014, 260029, 260040, 260041, 260042, 260043, 260044, 260045, 260046,
+ 260015, 260016, 260017, 260018, 260019, 260020, 260021, 260022, 260023, 260026,
+ 260028, 260030, 260031, 260032, 260033, 260034, 260037, 260039, 0
+};
+const uint MAITRED_RANGE6[] = {
+ 260013, 260014, 260029, 260040, 260041, 260042, 260043, 260044, 260045, 260046,
+ 260015, 260016, 260017, 260018, 260019, 260020, 260021, 260022, 260023, 260027,
+ 260028, 260030, 260031, 260032, 260033, 260034, 260038, 260039, 0
+};
+const uint MAITRED_RANGE7[] = { 260048, 260049, 260050, 0 };
+const uint MAITRED_RANGE8[] = { 260054, 260055, 260056, 260057, 260058, 260059, 260060, 0 };
+const uint MAITRED_RANGE9[] = { 260061, 260062, 0 };
+const uint MAITRED_RANGE10[] = { 260064, 260065, 260066, 0 };
+const uint MAITRED_RANGE11[] = { 260068, 260110, 260069, 260070, 260075, 261010, 260181, 260076, 0 };
+const uint MAITRED_RANGE12[] = { 260068, 260110, 260069, 260070, 260075, 261010, 260181, 260076, 0 };
+const uint MAITRED_RANGE13[] = { 260068, 260110, 260069, 260071, 260075, 261010, 260181, 260076, 0 };
+const uint MAITRED_RANGE14[] = { 260068, 260110, 260069, 260072, 260075, 261010, 260181, 260076, 0 };
+const uint MAITRED_RANGE15[] = { 260068, 260110, 260069, 260073, 260075, 261010, 260181, 260076, 0 };
+const uint MAITRED_RANGE16[] = { 260068, 260110, 260069, 260074, 260075, 261010, 260181, 260076, 0 };
+const uint MAITRED_RANGE17[] = { 260078, 260079, 260080, 0 };
+const uint MAITRED_RANGE18[] = { 260081, 260082, 260083, 260084, 260085, 0 };
+const uint MAITRED_RANGE19[] = { 260103, 260104, 260105, 0 };
+const uint MAITRED_RANGE20[] = { 260092, 260093, 260088, 260090, 0 };
+const uint MAITRED_RANGE21[] = {
+ 260132, 260133, 260134, 260135, 260136, 260137, 260138, 260139, 260140, 260141,
+ 260142, 260143, 260144, 260145, 260146, 260147, 260148, 260149, 260150, 260151,
+ 260152, 260153, 260154, 260155, 260156, 0
+};
+const uint MAITRED_RANGE22[] = {
+ 260158, 260159, 260160, 260161, 260162, 260163, 260164, 260165, 260166, 260167,
+ 260168, 260169, 260170, 260171, 260172, 260173, 260174, 260175, 260176, 260177,
+ 260178, 260179, 260180, 0
+};
+const uint MAITRED_RANGE23[] = { 260185, 260186, 260187, 260188, 0 };
+const uint MAITRED_RANGE24[] = { 260191, 260192, 260193, 0 };
+const uint MAITRED_RANGE25[] = { 260203, 260204, 0 };
+const uint MAITRED_RANGE26[] = { 260217, 260218, 260219, 260220, 0 };
+const uint MAITRED_RANGE27[] = { 260263, 260264, 260265, 260427, 260053, 0 };
+const uint MAITRED_RANGE28[] = { 260266, 260267, 260268, 0 };
+const uint MAITRED_RANGE29[] = { 260274, 260278, 260287, 260288, 0 };
+const uint MAITRED_RANGE30[] = { 260275, 260276, 260281, 260283, 260289, 260361, 0 };
+const uint MAITRED_RANGE31[] = { 260277, 260280, 260284, 260286, 260359, 0 };
+const uint MAITRED_RANGE32[] = { 260279, 260285, 0 };
+const uint MAITRED_RANGE33[] = { 260275, 260276, 260281, 260283, 260289, 260361, 0 };
+const uint MAITRED_RANGE34[] = { 260282, 260360, 0 };
+const uint MAITRED_RANGE35[] = { 260432, 260306, 0 };
+const uint MAITRED_RANGE36[] = { 260319, 260320, 260321, 0 };
+const uint MAITRED_RANGE37[] = { 260322, 260485, 0 };
+const uint MAITRED_RANGE38[] = { 260324, 260325, 0 };
+const uint MAITRED_RANGE39[] = { 260326, 260327, 0 };
+const uint MAITRED_RANGE40[] = { 260338, 260339, 260340, 260341, 260342, 260343, 0 };
+const uint MAITRED_RANGE41[] = {
+ 260054, 260055, 260056, 260057, 260058, 260059, 260345, 260346, 260347, 260348,
+ 260349, 260350, 260351, 260352, 260353, 260354, 260355, 260356, 260357, 260358, 0
+};
+const uint MAITRED_RANGE42[] = { 260369, 260370, 0 };
+const uint MAITRED_RANGE43[] = { 260207, 260375, 260767, 0 };
+const uint MAITRED_RANGE44[] = { 260381, 260382, 260383, 260384, 260385, 0 };
+const uint MAITRED_RANGE45[] = { 260389, 260390, 260391, 260392, 260393, 260394, 260395, 260396, 260397, 260398, 0 };
+const uint MAITRED_RANGE46[] = { 260403, 260404, 260763, 0 };
+const uint MAITRED_RANGE47[] = { 260424, 260425, 260426, 0 };
+const uint MAITRED_RANGE48[] = { 260450, 260451, 0 };
+const uint MAITRED_RANGE49[] = { 260521, 260501, 0 };
+const uint MAITRED_RANGE50[] = { 260526, 260429, 0 };
+const uint MAITRED_RANGE51[] = { 260527, 260430, 0 };
+const uint MAITRED_RANGE52[] = { 260528, 260431, 0 };
+const uint MAITRED_RANGE53[] = { 260567, 260568, 0 };
+const uint MAITRED_RANGE54[] = { 260495, 260496, 0 };
+const uint MAITRED_RANGE55[] = { 260511, 260512, 0 };
+const uint MAITRED_RANGE56[] = { 260573, 260572, 0 };
+const uint MAITRED_RANGE57[] = { 260595, 260596, 260597, 260598, 260599, 260600, 0 };
+const uint MAITRED_RANGE58[] = { 260620, 260621, 0 };
+const uint MAITRED_RANGE59[] = { 260623, 260630, 260636, 0 };
+const uint MAITRED_RANGE60[] = { 260215, 260690, 260223, 260691, 0 };
+const uint MAITRED_RANGE61[] = { 260000, 260212, 0 };
+const uint MAITRED_RANGE62[] = { 260213, 260252, 0 };
+const uint MAITRED_RANGE63[] = {
+ 260700, 260701, 260702, 260703, 260704, 260705, 260706, 260707, 260708, 260709,
+ 260710, 260711, 260712, 260713, 260714, 260715, 260716, 260717, 260718, 260719,
+ 260720, 260721, 260731, 260732, 260733, 260734, 260735, 260736, 260737, 260738,
+ 260739, 260740, 260741, 260742, 260743, 260744, 260745, 260746, 260747, 260748,
+ 260749, 260750, 260751, 260752, 260753, 260754, 260755, 260756, 260757, 260758,
+ 260759, 260760, 0
+};
+const uint MAITRED_RANGE64[] = { 260723, 260724, 260725, 260726, 260727, 260728, 260729, 260730, 0 };
+const uint MAITRED_RANGE65[] = { 260765, 260766, 0 };
+const uint MAITRED_RANGE66[] = { 260770, 260771, 0 };
+const uint MAITRED_RANGE67[] = { 260773, 260774, 260775, 260776, 260271, 0 };
+const uint MAITRED_RANGE68[] = { 260801, 260802, 0 };
+const uint MAITRED_RANGE69[] = { 260804, 260805, 260806, 260807, 260808, 0 };
+const uint MAITRED_RANGE70[] = { 260810, 260811, 0 };
+const uint MAITRED_RANGE71[] = { 260813, 260814, 260815, 0 };
+const uint MAITRED_RANGE72[] = { 260818, 260819, 0 };
+const uint MAITRED_RANGE73[] = { 260844, 260845, 260846, 260847, 260848, 0 };
+const uint MAITRED_RANGE74[] = { 260857, 260858, 260859, 0 };
+const uint MAITRED_RANGE75[] = { 260861, 260862, 0 };
+const uint MAITRED_RANGE76[] = { 260864, 260865, 260866, 260867, 260868, 260869, 260870, 260871, 260872, 0 };
+const uint MAITRED_RANGE77[] = { 260876, 260877, 260878, 260879, 0 };
+const uint MAITRED_RANGE78[] = { 260881, 260882, 260883, 260884, 0 };
+const uint MAITRED_RANGE79[] = { 260899, 260900, 260901, 260902, 260903, 260904, 260905, 260906, 260907, 260908,
+260909, 260910, 260911, 260912, 0 };
+const uint MAITRED_RANGE80[] = { 260914, 260915, 0 };
+const uint MAITRED_RANGE81[] = { 260917, 260918, 260919, 0 };
+const uint MAITRED_RANGE82[] = { 260921, 260922, 260923, 260924, 260925, 260926, 260927, 260928, 260929, 260930,
+ 260931, 0 };
+const uint MAITRED_RANGE83[] = { 260933, 260946, 0 };
+const uint MAITRED_RANGE84[] = { 260935, 260947, 0 };
+const uint MAITRED_RANGE85[] = { 260939, 260948, 0 };
+const uint MAITRED_RANGE86[] = { 260941, 260949, 0 };
+const uint MAITRED_RANGE87[] = { 260943, 260950, 0 };
+const uint MAITRED_RANGE88[] = { 260945, 260951, 0 };
+const uint MAITRED_RANGE89[] = { 260953, 260954, 260955, 0 };
+const uint MAITRED_RANGE90[] = { 260957, 260958, 0 };
+const uint MAITRED_RANGE91[] = { 260962, 260963, 260964, 260965, 0 };
+const uint MAITRED_RANGE92[] = { 260967, 260968, 260969, 260970, 260971, 260972, 260973, 0 };
+const uint MAITRED_RANGE93[] = { 260982, 260983, 260984, 0 };
+const uint MAITRED_RANGE94[] = { 260993, 260994, 260995, 0 };
+const uint MAITRED_RANGE95[] = { 261013, 261014, 261015, 0 };
+const uint MAITRED_RANGE96[] = { 260798, 260211, 0 };
+const uint MAITRED_RANGE97[] = { 260790, 260416, 260417, 0 };
+
+#define MAITRED_RANGE_COUNT 97
+const ScriptRange MAITRED_RANGES[97] = {
+ { 260112, MAITRED_RANGE1, true, false },
+ { 260131, MAITRED_RANGE2, false, false },
+ { 260113, MAITRED_RANGE3, true, false },
+ { 260114, MAITRED_RANGE4, true, false },
+ { 260115, MAITRED_RANGE5, true, false },
+ { 260116, MAITRED_RANGE6, true, false },
+ { 260117, MAITRED_RANGE7, false, false },
+ { 260118, MAITRED_RANGE8, true, false },
+ { 260120, MAITRED_RANGE9, false, false },
+ { 260119, MAITRED_RANGE10, false, false },
+
+ { 260121, MAITRED_RANGE11, false, false },
+ { 260122, MAITRED_RANGE12, false, false },
+ { 260123, MAITRED_RANGE13, false, false },
+ { 260124, MAITRED_RANGE14, false, false },
+ { 260125, MAITRED_RANGE15, false, false },
+ { 260126, MAITRED_RANGE16, false, false },
+ { 260127, MAITRED_RANGE17, false, false },
+ { 260128, MAITRED_RANGE18, true, false },
+ { 260129, MAITRED_RANGE19, false, false },
+ { 260130, MAITRED_RANGE20, false, false },
+
+ { 260674, MAITRED_RANGE21, true, false },
+ { 260675, MAITRED_RANGE22, true, false },
+ { 260676, MAITRED_RANGE23, false, false },
+ { 260677, MAITRED_RANGE24, false, false },
+ { 260678, MAITRED_RANGE25, false, false },
+ { 260679, MAITRED_RANGE26, false, false },
+ { 260680, MAITRED_RANGE27, true, false },
+ { 260681, MAITRED_RANGE28, false, false },
+ { 260682, MAITRED_RANGE29, true, false },
+ { 260644, MAITRED_RANGE30, true, false },
+
+ { 260645, MAITRED_RANGE31, true, false },
+ { 260646, MAITRED_RANGE32, true, false },
+ { 260647, MAITRED_RANGE33, true, false },
+ { 260648, MAITRED_RANGE34, true, false },
+ { 260649, MAITRED_RANGE35, true, false },
+ { 260650, MAITRED_RANGE36, false, false },
+ { 260651, MAITRED_RANGE37, false, false },
+ { 260652, MAITRED_RANGE38, false, false },
+ { 260653, MAITRED_RANGE39, false, false },
+ { 260654, MAITRED_RANGE40, true, false },
+
+ { 260655, MAITRED_RANGE41, true, false },
+ { 260656, MAITRED_RANGE42, false, false },
+ { 260657, MAITRED_RANGE43, true, false },
+ { 260658, MAITRED_RANGE44, false, false },
+ { 260659, MAITRED_RANGE45, false, false },
+ { 260660, MAITRED_RANGE46, true, false },
+ { 260661, MAITRED_RANGE47, false, false },
+ { 260662, MAITRED_RANGE48, false, false },
+ { 260663, MAITRED_RANGE49, false, false },
+ { 260664, MAITRED_RANGE50, false, false },
+
+ { 260665, MAITRED_RANGE51, false, false },
+ { 260666, MAITRED_RANGE52, false, false },
+ { 260667, MAITRED_RANGE53, false, false },
+ { 260668, MAITRED_RANGE54, false, false },
+ { 260669, MAITRED_RANGE55, false, false },
+ { 260670, MAITRED_RANGE56, false, false },
+ { 260671, MAITRED_RANGE57, false, false },
+ { 260672, MAITRED_RANGE58, false, false },
+ { 260673, MAITRED_RANGE59, false, false },
+ { 260683, MAITRED_RANGE60, false, false },
+
+ { 260684, MAITRED_RANGE61, false, false },
+ { 260685, MAITRED_RANGE62, false, false },
+ { 260699, MAITRED_RANGE63, true, false },
+ { 260722, MAITRED_RANGE64, true, false },
+ { 260764, MAITRED_RANGE65, true, false },
+ { 260769, MAITRED_RANGE66, true, false },
+ { 260772, MAITRED_RANGE67, true, false },
+ { 260800, MAITRED_RANGE68, true, false },
+ { 260803, MAITRED_RANGE69, true, false },
+ { 260809, MAITRED_RANGE70, true, false },
+
+ { 260812, MAITRED_RANGE71, true, false },
+ { 260817, MAITRED_RANGE72, true, false },
+ { 260843, MAITRED_RANGE73, true, false },
+ { 260856, MAITRED_RANGE74, true, false },
+ { 260860, MAITRED_RANGE75, true, false },
+ { 260863, MAITRED_RANGE76, true, false },
+ { 260875, MAITRED_RANGE77, true, false },
+ { 260880, MAITRED_RANGE78, true, false },
+ { 260898, MAITRED_RANGE79, true, false },
+ { 260913, MAITRED_RANGE80, true, false },
+
+ { 260916, MAITRED_RANGE81, true, false },
+ { 260920, MAITRED_RANGE82, true, false },
+ { 260932, MAITRED_RANGE83, true, false },
+ { 260934, MAITRED_RANGE84, true, false },
+ { 260938, MAITRED_RANGE85, true, false },
+ { 260940, MAITRED_RANGE86, true, false },
+ { 260942, MAITRED_RANGE87, true, false },
+ { 260944, MAITRED_RANGE88, true, false },
+ { 260952, MAITRED_RANGE89, true, false },
+ { 260956, MAITRED_RANGE90, true, false },
+
+ { 260961, MAITRED_RANGE91, true, false },
+ { 260966, MAITRED_RANGE92, true, false },
+ { 260981, MAITRED_RANGE93, false, false },
+ { 260992, MAITRED_RANGE94, true, false },
+ { 261012, MAITRED_RANGE95, true, false },
+ { 261016, MAITRED_RANGE96, true, false },
+ { 261017, MAITRED_RANGE97, true, false }
+};
+
+const uint PARROT_RANGE1[] = { 280171, 280172, 280173, 280174, 280175, 280176, 280153, 280154, 280155, 0 };
+const uint PARROT_RANGE2[] = { 280004, 280005, 280006, 280007, 280008, 280009, 280010, 280011, 280012, 0 };
+const uint PARROT_RANGE3[] = { 280000, 280001, 280002, 0 };
+const uint PARROT_RANGE4[] = { 280161, 280162, 280163, 280164, 280165, 0 };
+const uint PARROT_RANGE5[] = { 280156, 280157, 0 };
+const uint PARROT_RANGE6[] = { 280158, 280159, 280160, 0 };
+const uint PARROT_RANGE7[] = { 280166, 280167, 280168, 0 };
+const uint PARROT_RANGE8[] = { 280179, 280180, 280181, 0 };
+const uint PARROT_RANGE9[] = { 280086, 280087, 280088, 280089, 280090, 280091, 0 };
+const uint PARROT_RANGE10[] = { 280153, 280154, 280155, 0 };
+const uint PARROT_RANGE11[] = { 280043, 280044, 280045, 280046, 280047, 280048, 280049, 280050, 280051, 280052, 0 };
+const uint PARROT_RANGE12[] = { 280014, 280015, 280016, 0 };
+const uint PARROT_RANGE13[] = { 280217, 280039, 280040, 280041, 280042, 0 };
+const uint PARROT_RANGE14[] = { 280119, 280120, 280121, 280122, 280028, 280029, 280030, 280031, 280116, 280117,
+ 280118, 0 };
+const uint PARROT_RANGE15[] = { 280028, 280029, 280030, 280031, 0 };
+const uint PARROT_RANGE16[] = { 280123, 280124, 280125, 280126, 280127, 280128, 0 };
+const uint PARROT_RANGE17[] = { 280129, 280130, 280131, 280132, 280133, 280134, 280135, 280136, 280137, 280138, 0 };
+const uint PARROT_RANGE18[] = { 280035, 280036, 280037, 280038, 0 };
+const uint PARROT_RANGE19[] = { 280094, 280095, 280096, 280097, 280098, 280099, 280100, 280101, 280102, 280103,
+ 280104, 0 };
+const uint PARROT_RANGE20[] = { 280078, 280079, 280080, 280081, 280082, 280083, 280084, 0 };
+const uint PARROT_RANGE21[] = { 280067, 280068, 0 };
+const uint PARROT_RANGE22[] = { 280139, 280140, 280141, 0 };
+const uint PARROT_RANGE23[] = { 280017, 280018, 280019, 280020, 280021, 280022, 280023, 280024, 280025, 280026,
+ 280027, 0 };
+const uint PARROT_RANGE24[] = { 280065, 280143, 280142, 280190, 280144, 280066, 280145, 280146, 280147, 0 };
+const uint PARROT_RANGE25[] = { 280148, 280062, 280063, 0 };
+const uint PARROT_RANGE26[] = { 280071, 280072, 280073, 280074, 280075, 280076, 280077, 0 };
+const uint PARROT_RANGE27[] = { 280218, 280219, 0 };
+const uint PARROT_RANGE28[] = { 280057, 280058, 280059, 280060, 280061, 0 };
+const uint PARROT_RANGE29[] = { 280196, 280197, 280198, 280199, 280200, 0 };
+const uint PARROT_RANGE30[] = { 280202, 280203, 280204, 280205, 0 };
+const uint PARROT_RANGE31[] = { 280193, 280194, 280195, 0 };
+const uint PARROT_RANGE32[] = { 280149, 280069, 280070, 0 };
+const uint PARROT_RANGE33[] = { 280222, 280223, 280224, 280225, 280226, 280227, 280228, 280229, 280230, 280231,
+ 280232, 280233, 280234, 0 };
+const uint PARROT_RANGE34[] = { 280268, 280269, 280270, 280271, 280272, 280273, 280274, 0 };
+
+#define PARROT_RANGE_COUNT 34
+const ScriptRange PARROT_RANGES[34] = {
+ { 280235, PARROT_RANGE1, true, false },
+ { 280236, PARROT_RANGE2, false, false },
+ { 280237, PARROT_RANGE3, false, false },
+ { 280238, PARROT_RANGE4, false, false },
+ { 280239, PARROT_RANGE5, false, false },
+ { 280240, PARROT_RANGE6, false, false },
+ { 280241, PARROT_RANGE7, false, false },
+ { 280242, PARROT_RANGE8, false, false },
+ { 280243, PARROT_RANGE9, false, false },
+ { 280244, PARROT_RANGE10, false, false },
+
+ { 280245, PARROT_RANGE11, false, false },
+ { 280246, PARROT_RANGE12, false, false },
+ { 280247, PARROT_RANGE13, false, false },
+ { 280248, PARROT_RANGE14, false, false },
+ { 280249, PARROT_RANGE15, false, false },
+ { 280250, PARROT_RANGE16, false, false },
+ { 280251, PARROT_RANGE17, false, false },
+ { 280252, PARROT_RANGE18, false, false },
+ { 280253, PARROT_RANGE19, false, false },
+ { 280254, PARROT_RANGE20, false, false },
+
+ { 280255, PARROT_RANGE21, false, false },
+ { 280256, PARROT_RANGE22, false, false },
+ { 280257, PARROT_RANGE23, true, false },
+ { 280258, PARROT_RANGE24, false, true },
+ { 280259, PARROT_RANGE25, false, false },
+ { 280260, PARROT_RANGE26, false, false },
+ { 280261, PARROT_RANGE27, false, false },
+ { 280262, PARROT_RANGE28, false, false },
+ { 280263, PARROT_RANGE29, false, false },
+ { 280264, PARROT_RANGE30, false, false },
+
+ { 280265, PARROT_RANGE31, false, false },
+ { 280266, PARROT_RANGE32, false, false },
+ { 280222, PARROT_RANGE33, true, false },
+ { 280267, PARROT_RANGE34, true, false }
+};
+
+const uint SUCCUBUS_RANGE1[] = { 230001, 230149, 230078, 230002, 230033, 230067, 230003, 230079, 230034, 230055,
+ 230080, 230081, 230064, 230035, 0 };
+const uint SUCCUBUS_RANGE2[] = { 230005, 230085, 230006, 230091, 0 };
+const uint SUCCUBUS_RANGE3[] = { 230009, 230010, 230011, 0 };
+const uint SUCCUBUS_RANGE4[] = { 230030, 230031, 230032, 230033, 230034, 230035, 230036, 230037, 230038, 230142,
+ 230097, 0 };
+const uint SUCCUBUS_RANGE5[] = { 230100, 230101, 230102, 230104, 230105, 230113, 0 };
+const uint SUCCUBUS_RANGE6[] = { 230106, 230107, 230108, 230109, 230110, 0 };
+const uint SUCCUBUS_RANGE7[] = { 230119, 230120, 0 };
+const uint SUCCUBUS_RANGE8[] = { 230150, 230152, 230153, 230151, 0 };
+const uint SUCCUBUS_RANGE9[] = { 230154, 230155, 0 };
+const uint SUCCUBUS_RANGE10[] = { 230163, 230164, 230167, 230165, 230166, 230168, 0 };
+const uint SUCCUBUS_RANGE11[] = { 230123, 230124, 230126, 230127, 230128, 230129, 230130, 230131, 0 };
+const uint SUCCUBUS_RANGE12[] = { 230117, 230115, 0 };
+const uint SUCCUBUS_RANGE13[] = { 230179, 230180, 230057, 230181, 230068, 230182, 230118, 230048, 230058, 0 };
+const uint SUCCUBUS_RANGE14[] = { 230191, 230192, 230193, 230194, 0 };
+const uint SUCCUBUS_RANGE15[] = { 230239, 230240, 230241, 0 };
+const uint SUCCUBUS_RANGE16[] = { 230200, 230201, 230202, 230203, 230204, 230205, 230206, 0 };
+const uint SUCCUBUS_RANGE17[] = { 230122, 230073, 230074, 230075, 230076, 230077, 0 };
+const uint SUCCUBUS_RANGE18[] = { 230103, 230114, 230125, 230136, 230147, 230158, 230169, 230079, 230080, 230081,
+ 230082, 0 };
+const uint SUCCUBUS_RANGE19[] = { 230207, 230072, 0 };
+
+#define SUCCUBUS_RANGE_COUNT 19
+const ScriptRange SUCCUBUS_RANGES[19] = {
+ { 230001, SUCCUBUS_RANGE1, false, false },
+ { 230005, SUCCUBUS_RANGE2, false, false },
+ { 230009, SUCCUBUS_RANGE3, false, false },
+ { 230030, SUCCUBUS_RANGE4, false, false },
+ { 230244, SUCCUBUS_RANGE5, false, false },
+ { 230106, SUCCUBUS_RANGE6, false, false },
+ { 230119, SUCCUBUS_RANGE7, false, false },
+ { 230150, SUCCUBUS_RANGE8, false, false },
+ { 230154, SUCCUBUS_RANGE9, false, false },
+ { 230163, SUCCUBUS_RANGE10, false, false },
+
+ { 230123, SUCCUBUS_RANGE11, false, false },
+ { 230117, SUCCUBUS_RANGE12, false, false },
+ { 230179, SUCCUBUS_RANGE13, false, false },
+ { 230191, SUCCUBUS_RANGE14, false, false },
+ { 230239, SUCCUBUS_RANGE15, false, false },
+ { 230200, SUCCUBUS_RANGE16, false, false },
+ { 230122, SUCCUBUS_RANGE17, false, false },
+ { 230103, SUCCUBUS_RANGE18, false, false },
+ { 230207, SUCCUBUS_RANGE19, false, false }
+};
+
+void writeScriptRange(const char *name, const ScriptRange *ranges, int count) {
+ outputFile.seek(dataOffset);
+
+ for (int idx = 0; idx < count; ++idx) {
+ outputFile.writeLong(ranges[idx]._id);
+ outputFile.writeByte(ranges[idx]._isRandom);
+ outputFile.writeByte(ranges[idx]._isSequential);
+
+ const uint *v = ranges[idx]._array;
+ do {
+ outputFile.writeLong(*v);
+ } while (*v++ != 0);
+ }
+
+ uint size = outputFile.size() - dataOffset;
+ writeEntryHeader(name, dataOffset, size);
+ dataOffset += size;
+}
+
+void writeAllScriptRanges() {
+ writeScriptRange("Ranges/Barbot", BARBOT_RANGES, BARBOT_RANGE_COUNT);
+ writeScriptRange("Ranges/Bellbot", BELLBOT_RANGES, BELLBOT_RANGE_COUNT);
+ writeScriptRange("Ranges/Deskbot", DESKBOT_RANGES, DESKBOT_RANGE_COUNT);
+ writeScriptRange("Ranges/Doorbot", DOORBOT_RANGES, DOORBOT_RANGE_COUNT);
+ writeScriptRange("Ranges/Liftbot", LIFTBOT_RANGES, LIFTBOT_RANGE_COUNT);
+ writeScriptRange("Ranges/MaitreD", MAITRED_RANGES, MAITRED_RANGE_COUNT);
+ writeScriptRange("Ranges/Parrot", PARROT_RANGES, PARROT_RANGE_COUNT);
+ writeScriptRange("Ranges/SuccUBus", SUCCUBUS_RANGES, SUCCUBUS_RANGE_COUNT);
+} \ No newline at end of file
diff --git a/devtools/create_titanic/script_ranges.h b/devtools/create_titanic/script_ranges.h
new file mode 100644
index 0000000000..3013a32139
--- /dev/null
+++ b/devtools/create_titanic/script_ranges.h
@@ -0,0 +1,39 @@
+/* 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 COMMON_SCRIPT_RANGES_H
+#define COMMON_SCRIPT_RANGES_H
+
+#include "common/scummsys.h"
+
+struct ScriptRange {
+ uint _id;
+ const uint *_array;
+ bool _isRandom;
+ bool _isSequential;
+};
+
+extern void writeAllScriptRanges();
+extern void writeEntryHeader(const char *name, uint offset, uint size);
+extern uint dataOffset;
+
+#endif
diff --git a/devtools/create_titanic/script_responses.cpp b/devtools/create_titanic/script_responses.cpp
new file mode 100644
index 0000000000..30d0c7f1bd
--- /dev/null
+++ b/devtools/create_titanic/script_responses.cpp
@@ -0,0 +1,629 @@
+/* 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.
+ *
+ */
+
+ // Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+// HACK to allow building with the SDL backend on MinGW
+// see bug #1800764 "TOOLS: MinGW tools building broken"
+#ifdef main
+#undef main
+#endif // main
+
+#include "file.h"
+#include "script_responses.h"
+
+static const int DESKBOT_RESPONSES[128][5] = {
+ { MKTAG('P', 'K', 'U', 'P'), 240573, 0, 0, 0 },
+ { MKTAG('S', 'E', 'X', '1'), 240573, 0, 0, 0 },
+ { MKTAG('D', 'E', 'S', '1'), 240354, 0, 0, 0 },
+ { MKTAG('D', 'E', 'S', '2'), 240547, 0, 0, 0 },
+ { MKTAG('S', 'W', 'E', 'R'), 240578, 0, 0, 0 },
+ { MKTAG('B', 'Y', 'Z', 'A'), 241173, 0, 0, 0 },
+ { MKTAG('S', 'A', 'S', 'S'), 240986, 0, 0, 0 },
+ { MKTAG('S', 'U', 'M', 'S'), 240453, 0, 0, 0 },
+ { MKTAG('F', 'O', 'O', 'D'), 240849, 0, 0, 0 },
+ { MKTAG('J', 'F', 'O', 'D'), 240849, 0, 0, 0 },
+ { MKTAG('C', 'H', 'S', 'E'), 240849, 0, 0, 0 },
+ { MKTAG('A', 'C', 'T', 'R'), 240654, 0, 0, 0 },
+ { MKTAG('A', 'C', 'T', 'S'), 240655, 0, 0, 0 },
+ { MKTAG('M', 'U', 'S', 'I'), 240681, 241621, 0, 0 },
+ { MKTAG('S', 'O', 'N', 'G'), 240681, 241621, 0, 0 },
+ { MKTAG('S', 'O', 'A', 'P'), 240681, 0, 0, 0 },
+ { MKTAG('T', 'V', 'S', 'H'), 240681, 0, 0, 0 },
+ { MKTAG('A', 'R', 'T', 'I'), 240657, 0, 0, 0 },
+ { MKTAG('A', 'U', 'T', 'H'), 240657, 0, 0, 0 },
+ { MKTAG('C', 'O', 'M', 'D'), 240657, 240785, 0, 0 },
+ { MKTAG('C', 'O', 'O', 'K'), 240657, 0, 0, 0 },
+ { MKTAG('C', 'O', 'P', 'S'), 240657, 0, 0, 0 },
+ { MKTAG('H', 'E', 'R', 'O'), 240657, 0, 0, 0 },
+ { MKTAG('H', 'O', 'S', 'T'), 240657, 0, 0, 0 },
+ { MKTAG('P', 'T', 'I', 'C'), 240657, 0, 0, 0 },
+ { MKTAG('S', 'C', 'I', 'T'), 240657, 0, 0, 0 },
+ { MKTAG('E', 'A', 'R', 'T'), 240728, 0, 0, 0 },
+ { MKTAG('P', 'L', 'A', 'N'), 240728, 0, 0, 0 },
+ { MKTAG('F', 'I', 'L', 'M'), 240939, 0, 0, 0 },
+ { MKTAG('F', 'I', 'S', 'H'), 240437, 0, 0, 0 },
+ { MKTAG('H', 'H', 'G', 'Q'), 241065, 240453, 0, 0 },
+ { MKTAG('L', 'I', 'Q', 'D'), 241167, 0, 0, 0 },
+ { MKTAG('P', 'H', 'I', 'L'), 240607, 0, 0, 0 },
+ { MKTAG('S', 'I', 'C', 'K'), 241170, 0, 0, 0 },
+ { MKTAG('T', 'W', 'A', 'T'), 240975, 0, 0, 0 },
+ { MKTAG('H', 'A', 'H', 'A'), 240785, 0, 0, 0 },
+ { MKTAG('S', 'C', 'I', 'T'), 240968, 241617, 0, 0 },
+ { MKTAG('S', 'C', 'I', 'E'), 240967, 241616, 0, 0 },
+ { MKTAG('S', 'L', 'O', 'W'), 241614, 0, 0, 0 },
+ { MKTAG('T', 'H', 'R', 'T'), 240760, 241615, 0, 0 },
+ { MKTAG('T', 'D', 'V', 'P'), 241161, 241618, 0, 0 },
+ { MKTAG('T', 'I', 'T', 'A'), 241619, 0, 0, 0 },
+ { MKTAG('C', 'S', 'P', 'Y'), 241620, 0, 0, 0 },
+ { MKTAG('M', 'I', 'N', 'S'), 241621, 0, 0, 0 },
+ { MKTAG('M', 'C', 'P', 'Y'), 241622, 0, 0, 0 },
+ { MKTAG('D', 'N', 'C', 'E'), 241623, 0, 0, 0 },
+ { MKTAG('N', 'A', 'U', 'T'), 241624, 0, 0, 0 },
+ { MKTAG('A', 'D', 'V', 'T'), 240939, 241622, 0, 0 },
+ { MKTAG('A', 'N', 'S', 'W'), 240453, 0, 0, 0 },
+ { MKTAG('A', 'R', 'T', 'Y'), 240658, 0, 0, 0 },
+ { MKTAG('B', 'A', 'R', '1'), 240491, 0, 0, 0 },
+ { MKTAG('B', 'A', 'R', '3'), 240610, 0, 0, 0 },
+ { MKTAG('B', 'A', 'R', 'K'), 240768, 0, 0, 0 },
+ { MKTAG('B', 'A', 'R', 'U'), 240768, 0, 0, 0 },
+ { MKTAG('B', 'E', 'L', '1'), 240940, 0, 0, 0 },
+ { MKTAG('B', 'E', 'L', '2'), 240591, 0, 0, 0 },
+ { MKTAG('B', 'E', 'L', '3'), 240775, 0, 0, 0 },
+ { MKTAG('B', 'E', 'L', '4'), 240558, 0, 0, 0 },
+ { MKTAG('B', 'E', 'L', '5'), 240336, 0, 0, 0 },
+ { MKTAG('B', 'E', 'L', '6'), 240759, 240760, 0, 0 },
+ { MKTAG('B', 'E', 'L', '7'), 240726, 0, 0, 0 },
+ { MKTAG('B', 'L', 'F', '1'), 241652, 0, 0, 0 },
+ { MKTAG('B', 'L', 'F', '2'), 240939, 0, 0, 0 },
+ { MKTAG('B', 'L', 'P', '1'), 240654, 0, 0, 0 },
+ { MKTAG('B', 'L', 'P', '2'), 240654, 0, 0, 0 },
+ { MKTAG('B', 'L', 'P', '3'), 240654, 0, 0, 0 },
+ { MKTAG('B', 'L', 'P', '4'), 240655, 0, 0, 0 },
+ { MKTAG('B', 'L', 'R', '1'), 240654, 0, 0, 0 },
+ { MKTAG('B', 'L', 'R', '2'), 240655, 0, 0, 0 },
+ { MKTAG('B', 'L', 'T', '1'), 240718, 0, 0, 0 },
+ { MKTAG('B', 'L', 'T', '2'), 240681, 0, 0, 0 },
+ { MKTAG('B', 'L', 'T', '3'), 240655, 0, 0, 0 },
+ { MKTAG('B', 'L', 'T', '4'), 240664, 0, 0, 0 },
+ { MKTAG('B', 'L', 'T', '5'), 240681, 0, 0, 0 },
+ { MKTAG('B', 'O', 'D', 'Y'), 240596, 0, 0, 0 },
+ { MKTAG('B', 'O', 'Y', 'S'), 240654, 0, 0, 0 },
+ { MKTAG('B', 'R', 'N', 'D'), 240939, 241622, 0, 0 },
+ { MKTAG('C', 'L', 'U', 'B'), 241675, 240681, 241623, 0 },
+ { MKTAG('C', 'M', 'N', 'T'), 240849, 0, 0, 0 },
+ { MKTAG('C', 'R', 'I', 'M'), 241096, 240725, 240729, 0 },
+ { MKTAG('D', 'C', 'T', 'R'), 240681, 0, 0, 0 },
+ { MKTAG('D', 'O', 'R', '2'), 241405, 241404, 241403, 241402 },
+ { MKTAG('D', 'R', 'U', 'G'), 240922, 240931, 0, 0 },
+ { MKTAG('F', 'A', 'M', 'E'), 240726, 0, 0, 0 },
+ { MKTAG('F', 'A', 'S', 'H'), 241172, 0, 0, 0 },
+ { MKTAG('F', 'A', 'U', 'N'), 240939, 0, 0, 0 },
+ { MKTAG('F', 'L', 'O', 'R'), 240825, 0, 0, 0 },
+ { MKTAG('F', 'U', 'L', 'N'), 240864, 241072, 0, 0 },
+ { MKTAG('G', 'I', 'R', 'L'), 240655, 0, 0, 0 },
+ { MKTAG('H', 'B', 'B', 'Y'), 241144, 0, 0, 0 },
+ { MKTAG('H', 'H', 'L', 'D'), 241144, 0, 0, 0 },
+ { MKTAG('H', 'O', 'M', 'E'), 240844, 240626, 0, 0 },
+ { MKTAG('I', 'S', 'H', 'E'), 240731, 0, 0, 0 },
+ { MKTAG('J', 'N', 'A', 'M'), 240785, 0, 0, 0 },
+ { MKTAG('J', 'O', 'K', 'E'), 240785, 0, 0, 0 },
+ { MKTAG('K', 'N', 'O', 'B'), 240657, 0, 0, 0 },
+ { MKTAG('K', 'P', 'L', 'C'), 240844, 240626, 0, 0 },
+ { MKTAG('L', 'I', 'F', '3'), 240722, 0, 0, 0 },
+ { MKTAG('L', 'I', 'T', 'E'), 240785, 0, 0, 0 },
+ { MKTAG('L', 'I', 'T', 'R'), 241404, 241405, 241403, 241406 },
+ { MKTAG('M', 'A', 'D', '1'), 241124, 240971, 241615, 0 },
+ { MKTAG('M', 'A', 'D', '4'), 241341, 0, 0, 0 },
+ { MKTAG('M', 'A', 'D', '6'), 240860, 241114, 0, 0 },
+ { MKTAG('M', 'A', 'G', 'S'), 241404, 241405, 241403, 241407 },
+ { MKTAG('M', 'L', 'T', 'Y'), 240718, 240719, 0, 0 },
+ { MKTAG('N', 'I', 'K', 'E'), 241622, 0, 0, 0 },
+ { MKTAG('N', 'I', 'K', 'N'), 240785, 0, 0, 0 },
+ { MKTAG('N', 'P', 'L', 'C'), 240844, 240626, 0, 0 },
+ { MKTAG('O', 'R', 'D', '1'), 240695, 0, 0, 0 },
+ { MKTAG('O', 'R', 'D', '2'), 240744, 240650, 0, 0 },
+ { MKTAG('O', 'R', 'D', '3'), 240647, 0, 0, 0 },
+ { MKTAG('O', 'R', 'D', '4'), 240647, 0, 0, 0 },
+ { MKTAG('O', 'R', 'D', '5'), 241191, 0, 0, 0 },
+ { MKTAG('P', 'G', 'R', 'P'), 240681, 0, 0, 0 },
+ { MKTAG('P', 'L', 'A', 'C'), 240728, 0, 0, 0 },
+ { MKTAG('R', 'C', 'K', 'T'), 241070, 241161, 0, 0 },
+ { MKTAG('S', 'F', 'S', 'F'), 241172, 0, 0, 0 },
+ { MKTAG('S', 'P', 'R', 'T'), 241172, 0, 0, 0 },
+ { MKTAG('S', 'U', 'C', '1'), 240467, 0, 0, 0 },
+ { MKTAG('T', 'E', 'A', 'M'), 241172, 0, 0, 0 },
+ { MKTAG('T', 'L', 'A', ' '), 240727, 240658, 0, 0 },
+ { MKTAG('T', 'O', 'Y', 'S'), 240607, 240606, 0, 0 },
+ { MKTAG('T', 'R', 'A', '2'), 240611, 0, 0, 0 },
+ { MKTAG('T', 'R', 'A', '3'), 240611, 0, 0, 0 },
+ { MKTAG('W', 'E', 'A', 'P'), 240939, 0, 0, 0 },
+ { MKTAG('W', 'E', 'A', 'T'), 241093, 241094, 241095, 0 },
+ { MKTAG('W', 'T', 'H', 'R'), 241093, 241094, 241095, 0 },
+ { MKTAG('W', 'W', 'E', 'B'), 241172, 0, 0, 0 }
+};
+
+static const int BELLBOT_RESPONSES[130][5] = {
+ { MKTAG('A', 'C', 'T', 'R'), 200505, 0, 0, 0 },
+ { MKTAG('A', 'C', 'T', 'S'), 200505, 0, 0, 0 },
+ { MKTAG('F', 'A', 'M', 'E'), 200532, 200585, 0, 0 },
+ { MKTAG('A', 'D', 'V', 'T'), 200506, 0, 0, 0 },
+ { MKTAG('L', 'I', 'Q', 'D'), 200507, 200527, 0, 0 },
+ { MKTAG('F', 'A', 'U', 'N'), 200511, 0, 0, 0 },
+ { MKTAG('H', 'B', 'B', 'Y'), 200514, 0, 0, 0 },
+ { MKTAG('N', 'I', 'K', 'E'), 200514, 0, 0, 0 },
+ { MKTAG('B', 'R', 'N', 'D'), 200514, 0, 0, 0 },
+ { MKTAG('P', 'G', 'R', 'P'), 200514, 0, 0, 0 },
+ { MKTAG('R', 'C', 'K', 'T'), 200514, 0, 0, 0 },
+ { MKTAG('D', 'R', 'U', 'G'), 200528, 0, 0, 0 },
+ { MKTAG('F', 'A', 'S', 'H'), 200533, 0, 0, 0 },
+ { MKTAG('T', 'O', 'Y', 'S'), 200533, 0, 0, 0 },
+ { MKTAG('F', 'O', 'O', 'D'), 202270, 0, 0, 0 },
+ { MKTAG('J', 'F', 'O', 'D'), 202270, 0, 0, 0 },
+ { MKTAG('A', 'R', 'T', 'I'), 200538, 0, 0, 0 },
+ { MKTAG('A', 'R', 'T', 'Y'), 200538, 0, 0, 0 },
+ { MKTAG('L', 'I', 'T', 'R'), 200538, 0, 0, 0 },
+ { MKTAG('C', 'R', 'I', 'M'), 200538, 0, 0, 0 },
+ { MKTAG('C', 'S', 'P', 'Y'), 200538, 0, 0, 0 },
+ { MKTAG('W', 'E', 'A', 'T'), 200538, 0, 0, 0 },
+ { MKTAG('M', 'U', 'S', 'I'), 200539, 0, 0, 0 },
+ { MKTAG('S', 'O', 'N', 'G'), 200539, 0, 0, 0 },
+ { MKTAG('F', 'I', 'L', 'M'), 200534, 0, 0, 0 },
+ { MKTAG('B', 'L', 'F', '1'), 200535, 0, 0, 0 },
+ { MKTAG('B', 'L', 'F', '2'), 200536, 0, 0, 0 },
+ { MKTAG('M', 'A', 'G', 'S'), 200542, 0, 0, 0 },
+ { MKTAG('P', 'H', 'I', 'L'), 200557, 0, 0, 0 },
+ { MKTAG('P', 'L', 'A', 'N'), 200562, 0, 0, 0 },
+ { MKTAG('E', 'A', 'R', 'T'), 200562, 202252, 0, 0 },
+ { MKTAG('P', 'L', 'A', 'C'), 200562, 202252, 0, 0 },
+ { MKTAG('F', 'L', 'O', 'R'), 200570, 0, 0, 0 },
+ { MKTAG('P', 'T', 'I', 'C'), 200571, 0, 0, 0 },
+ { MKTAG('B', 'L', 'P', '1'), 200577, 0, 0, 0 },
+ { MKTAG('B', 'L', 'P', '2'), 200575, 0, 0, 0 },
+ { MKTAG('B', 'L', 'P', '3'), 200576, 0, 0, 0 },
+ { MKTAG('B', 'L', 'P', '4'), 200578, 0, 0, 0 },
+ { MKTAG('K', 'N', 'O', 'B'), 200579, 0, 0, 0 },
+ { MKTAG('B', 'L', 'R', '1'), 200580, 0, 0, 0 },
+ { MKTAG('B', 'L', 'R', '2'), 200581, 0, 0, 0 },
+ { MKTAG('S', 'E', 'X', '1'), 200582, 0, 0, 0 },
+ { MKTAG('S', 'P', 'R', 'T'), 200584, 0, 0, 0 },
+ { MKTAG('T', 'E', 'A', 'M'), 200584, 0, 0, 0 },
+ { MKTAG('H', 'E', 'R', 'O'), 200585, 0, 0, 0 },
+ { MKTAG('T', 'W', 'A', 'T'), 200588, 0, 0, 0 },
+ { MKTAG('S', 'W', 'E', 'R'), 200590, 200336, 0, 0 },
+ { MKTAG('T', 'R', 'A', '2'), 200594, 0, 0, 0 },
+ { MKTAG('T', 'R', 'A', '3'), 200594, 0, 0, 0 },
+ { MKTAG('T', 'V', 'S', 'H'), 200595, 0, 0, 0 },
+ { MKTAG('S', 'O', 'A', 'P'), 200595, 0, 0, 0 },
+ { MKTAG('C', 'O', 'M', 'D'), 200595, 0, 0, 0 },
+ { MKTAG('C', 'O', 'O', 'K'), 200595, 0, 0, 0 },
+ { MKTAG('C', 'O', 'P', 'S'), 200595, 0, 0, 0 },
+ { MKTAG('D', 'C', 'T', 'R'), 200595, 0, 0, 0 },
+ { MKTAG('S', 'F', 'S', 'F'), 200595, 0, 0, 0 },
+ { MKTAG('H', 'O', 'S', 'T'), 200595, 0, 0, 0 },
+ { MKTAG('B', 'L', 'T', '1'), 200596, 0, 0, 0 },
+ { MKTAG('B', 'L', 'T', '2'), 200597, 0, 0, 0 },
+ { MKTAG('B', 'L', 'T', '3'), 200598, 0, 0, 0 },
+ { MKTAG('B', 'L', 'T', '4'), 200599, 0, 0, 0 },
+ { MKTAG('B', 'L', 'T', '5'), 200600, 0, 0, 0 },
+ { MKTAG('W', 'E', 'A', 'P'), 200601, 0, 0, 0 },
+ { MKTAG('A', 'U', 'T', 'H'), 200605, 0, 0, 0 },
+ { MKTAG('H', 'H', 'L', 'D'), 200536, 0, 0, 0 },
+ { MKTAG('W', 'W', 'E', 'B'), 200608, 0, 0, 0 },
+ { MKTAG('M', 'L', 'T', 'Y'), 200608, 0, 0, 0 },
+ { MKTAG('P', 'K', 'U', 'P'), 200067, 0, 0, 0 },
+ { MKTAG('S', 'U', 'C', '1'), 200067, 0, 0, 0 },
+ { MKTAG('B', 'E', 'L', '1'), 200684, 0, 0, 0 },
+ { MKTAG('B', 'E', 'L', '2'), 200887, 0, 0, 0 },
+ { MKTAG('B', 'E', 'L', '3'), 200610, 0, 0, 0 },
+ { MKTAG('B', 'E', 'L', '4'), 200015, 0, 0, 0 },
+ { MKTAG('B', 'E', 'L', '5'), 200043, 0, 0, 0 },
+ { MKTAG('B', 'E', 'L', '6'), 200333, 0, 0, 0 },
+ { MKTAG('B', 'E', 'L', '7'), 200884, 0, 0, 0 },
+ { MKTAG('H', 'H', 'G', 'Q'), 200516, 0, 0, 0 },
+ { MKTAG('C', 'H', 'A', 'N'), 200961, 0, 0, 0 },
+ { MKTAG('B', 'Y', 'Z', 'A'), 201271, 0, 0, 0 },
+ { MKTAG('F', 'I', 'S', 'H'), 201242, 0, 0, 0 },
+ { MKTAG('S', 'A', 'S', 'S'), 201256, 0, 0, 0 },
+ { MKTAG('S', 'I', 'C', 'K'), 201704, 0, 0, 0 },
+ { MKTAG('N', 'H', 'R', 'O'), 201704, 0, 0, 0 },
+ { MKTAG('S', 'C', 'I', 'E'), 201675, 0, 0, 0 },
+ { MKTAG('S', 'C', 'I', 'T'), 201676, 0, 0, 0 },
+ { MKTAG('T', 'D', 'V', 'P'), 200490, 0, 0, 0 },
+ { MKTAG('H', 'A', 'H', 'A'), 200950, 0, 0, 0 },
+ { MKTAG('S', 'U', 'C', '1'), 200582, 0, 0, 0 },
+ { MKTAG('T', 'L', 'A', ' '), 201243, 0, 0, 0 },
+ { MKTAG('J', 'O', 'K', 'E'), 201244, 0, 0, 0 },
+ { MKTAG('C', 'H', 'S', 'E'), 202270, 0, 0, 0 },
+ { MKTAG('C', 'L', 'U', 'B'), 201654, 0, 0, 0 },
+ { MKTAG('S', 'L', 'O', 'W'), 201877, 0, 0, 0 },
+ { MKTAG('T', 'H', 'R', 'T'), 201238, 201269, 201982, 200336 },
+ { MKTAG('A', 'N', 'S', 'W'), 200139, 0, 0, 0 },
+ { MKTAG('B', 'A', 'R', '1'), 202051, 200473, 200229, 0 },
+ { MKTAG('B', 'A', 'R', 'K'), 200510, 201326, 0, 0 },
+ { MKTAG('B', 'A', 'R', 'U'), 200510, 201326, 0, 0 },
+ { MKTAG('B', 'O', 'D', 'Y'), 201704, 0, 0, 0 },
+ { MKTAG('C', 'M', 'N', 'T'), 202270, 0, 0, 0 },
+ { MKTAG('D', 'E', 'S', '2'), 201529, 0, 0, 0 },
+ { MKTAG('D', 'N', 'C', 'E'), 200952, 200953, 200960, 0 },
+ { MKTAG('D', 'O', 'R', '2'), 200372, 0, 0, 0 },
+ { MKTAG('F', 'U', 'L', 'N'), 202035, 202044, 0, 0 },
+ { MKTAG('H', 'O', 'M', 'E'), 202252, 0, 0, 0 },
+ { MKTAG('I', 'S', 'H', 'E'), 201609, 0, 0, 0 },
+ { MKTAG('J', 'N', 'A', 'M'), 202035, 0, 0, 0 },
+ { MKTAG('L', 'I', 'F', '1'), 201704, 0, 0, 0 },
+ { MKTAG('L', 'I', 'F', '2'), 201704, 0, 0, 0 },
+ { MKTAG('L', 'I', 'F', '3'), 201704, 0, 0, 0 },
+ { MKTAG('M', 'A', 'D', '1'), 201238, 0, 0, 0 },
+ { MKTAG('M', 'A', 'D', '4'), 200292, 0, 0, 0 },
+ { MKTAG('M', 'A', 'D', '5'), 200140, 0, 0, 0 },
+ { MKTAG('M', 'A', 'D', '6'), 200968, 0, 0, 0 },
+ { MKTAG('M', 'C', 'P', 'Y'), 200514, 0, 0, 0 },
+ { MKTAG('M', 'I', 'N', 'S'), 200541, 0, 0, 0 },
+ { MKTAG('N', 'A', 'U', 'T'), 200529, 0, 0, 0 },
+ { MKTAG('N', 'O', 'N', 'O'), 200127, 0, 0, 0 },
+ { MKTAG('N', 'P', 'L', 'C'), 200234, 201625, 0, 0 },
+ { MKTAG('O', 'R', 'D', '1'), 200473, 0, 0, 0 },
+ { MKTAG('O', 'R', 'D', '2'), 200473, 0, 0, 0 },
+ { MKTAG('O', 'R', 'D', '3'), 200473, 0, 0, 0 },
+ { MKTAG('O', 'R', 'D', '4'), 200473, 0, 0, 0 },
+ { MKTAG('O', 'R', 'D', '5'), 200473, 0, 0, 0 },
+ { MKTAG('S', 'U', 'C', '2'), 200024, 0, 0, 0 },
+ { MKTAG('S', 'U', 'M', 'S'), 200139, 0, 0, 0 },
+ { MKTAG('T', 'I', 'T', 'A'), 200606, 0, 0, 0 },
+ { MKTAG('W', 'T', 'H', 'R'), 201094, 201097, 201092, 0 },
+ { MKTAG('Y', 'E', 'S', 'S'), 201525, 201529, 0, 0 },
+};
+
+const int BARBOT_RESPONSES[93][2] = {
+ { MKTAG('S', 'L', 'O', 'W'), 0x3D09E },
+ { MKTAG('T', 'H', 'R', 'T'), 0x3D0B1 },
+ { MKTAG('A', 'C', 'T', 'R'), 0x3D77F },
+ { MKTAG('A', 'C', 'T', 'S'), 0x3D780 },
+ { MKTAG('A', 'D', 'V', 'T'), 0x3D781 },
+ { MKTAG('A', 'R', 'T', 'I'), 0x3D782 },
+ { MKTAG('A', 'R', 'T', 'Y'), 0x3D783 },
+ { MKTAG('A', 'U', 'T', 'H'), 0x3D784 },
+ { MKTAG('B', 'A', 'R', 'K'), 0x3D786 },
+ { MKTAG('B', 'A', 'R', 'U'), 0x3D786 },
+ { MKTAG('B', 'O', 'Y', 'S'), 0x3D239 },
+ { MKTAG('G', 'I', 'R', 'L'), 0x3D23A },
+ { MKTAG('B', 'R', 'N', 'D'), 0x3D787 },
+ { MKTAG('C', 'H', 'S', 'E'), 0x3D788 },
+ { MKTAG('C', 'O', 'M', 'D'), 0x3D789 },
+ { MKTAG('C', 'O', 'O', 'K'), 0x3D78A },
+ { MKTAG('C', 'O', 'P', 'S'), 0x3D78B },
+ { MKTAG('C', 'R', 'I', 'M'), 0x3D78C },
+ { MKTAG('C', 'S', 'P', 'Y'), 0x3D78D },
+ { MKTAG('D', 'C', 'T', 'R'), 0x3D78E },
+ { MKTAG('D', 'N', 'C', 'E'), 0x3D78F },
+ { MKTAG('D', 'R', 'U', 'G'), 0x3D790 },
+ { MKTAG('E', 'A', 'R', 'T'), 0x3D791 },
+ { MKTAG('E', 'M', 'O', 'T'), 0x3D792 },
+ { MKTAG('F', 'A', 'M', 'E'), 0x3D793 },
+ { MKTAG('A', 'S', 'H', '1'), 0x3D794 },
+ { MKTAG('A', 'S', 'H', '2'), 0x3D795 },
+ { MKTAG('F', 'A', 'U', 'N'), 0x3D796 },
+ { MKTAG('F', 'I', 'L', 'M'), 0x3D797 },
+ { MKTAG('F', 'I', 'S', 'H'), 0x3D798 },
+ { MKTAG('F', 'L', 'O', 'R'), 0x3D799 },
+ { MKTAG('F', 'O', 'O', 'D'), 0x3D79A },
+ { MKTAG('J', 'F', 'O', 'D'), 0x3D79A },
+ { MKTAG('H', 'B', 'B', 'Y'), 0x3D79B },
+ { MKTAG('H', 'E', 'R', 'O'), 0x3D79C },
+ { MKTAG('H', 'H', 'L', 'D'), 0x3D79D },
+ { MKTAG('H', 'O', 'M', 'E'), 0x3D79E },
+ { MKTAG('H', 'O', 'S', 'T'), 0x3D79F },
+ { MKTAG('K', 'N', 'O', 'B'), 0x3D7A0 },
+ { MKTAG('L', 'I', 'Q', 'D'), 0x3D7A1 },
+ { MKTAG('L', 'I', 'T', 'R'), 0x3D7A2 },
+ { MKTAG('M', 'A', 'G', 'S'), 0x3D7A3 },
+ { MKTAG('M', 'C', 'P', 'Y'), 0x3D7A4 },
+ { MKTAG('M', 'I', 'N', 'S'), 0x3D7A5 },
+ { MKTAG('M', 'L', 'T', 'Y'), 0x3D7A6 },
+ { MKTAG('M', 'U', 'S', 'I'), 0x3D7A7 },
+ { MKTAG('N', 'A', 'U', 'T'), 0x3D7A8 },
+ { MKTAG('P', 'G', 'R', 'P'), 0x3D7A9 },
+ { MKTAG('P', 'H', 'I', 'L'), 0x3D7AA },
+ { MKTAG('P', 'K', 'U', 'P'), 0x3D7AB },
+ { MKTAG('P', 'L', 'A', 'N'), 0x3D7AC },
+ { MKTAG('B', 'L', 'P', '1'), 0x3D7AD },
+ { MKTAG('B', 'L', 'P', '2'), 0x3D7AD },
+ { MKTAG('P', 'T', 'I', 'C'), 0x3D7AD },
+ { MKTAG('R', 'C', 'K', 'T'), 0x3D7AE },
+ { MKTAG('S', 'C', 'I', 'E'), 0x3D7AF },
+ { MKTAG('S', 'C', 'I', 'T'), 0x3D7B0 },
+ { MKTAG('S', 'E', 'X', '1'), 0x3D7B1 },
+ { MKTAG('S', 'F', 'S', 'F'), 0x3D7B2 },
+ { MKTAG('S', 'O', 'A', 'P'), 0x3D7B4 },
+ { MKTAG('S', 'O', 'N', 'G'), 0x3D7B5 },
+ { MKTAG('S', 'P', 'R', 'T'), 0x3D7B6 },
+ { MKTAG('S', 'W', 'E', 'R'), 0x3D7B7 },
+ { MKTAG('T', 'D', 'V', 'P'), 0x3D7BC },
+ { MKTAG('T', 'E', 'A', 'M'), 0x3D7BD },
+ { MKTAG('T', 'I', 'T', 'A'), 0x3D7BF },
+ { MKTAG('T', 'L', 'A', ' '), 0x3D7C0 },
+ { MKTAG('T', 'O', 'Y', 'S'), 0x3D7C1 },
+ { MKTAG('T', 'R', 'A', '2'), 0x3D7C2 },
+ { MKTAG('T', 'R', 'A', '3'), 0x3D7C3 },
+ { MKTAG('T', 'V', 'S', 'H'), 0x3D7C4 },
+ { MKTAG('W', 'E', 'A', 'P'), 0x3D7C5 },
+ { MKTAG('W', 'E', 'A', 'T'), 0x3D7C6 },
+ { MKTAG('W', 'W', 'E', 'B'), 0x3D7C7 },
+ { MKTAG('I', 'S', 'H', 'E'), 0x3D221 },
+ { MKTAG('L', 'I', 'T', 'E'), 0x3D31B },
+ { MKTAG('B', 'Y', 'Z', 'A'), 0x3D448 },
+ { MKTAG('W', 'T', 'H', 'R'), 0x3D6E5 },
+ { MKTAG('N', 'P', 'L', 'C'), 0x3D231 },
+ { MKTAG('B', 'A', 'R', '1'), 0x3D095 },
+ { MKTAG('B', 'A', 'R', '2'), 0x3D107 },
+ { MKTAG('B', 'A', 'R', '3'), 0x3D09D },
+ { MKTAG('M', 'P', 'O', 'P'), 0x3D0D3 },
+ { MKTAG('J', 'O', 'K', 'E'), 0x3D5A9 },
+ { MKTAG('J', 'N', 'A', 'M'), 0x3D5A9 },
+ { MKTAG('N', 'I', 'B', '1'), 0x3D128 },
+ { MKTAG('N', 'I', 'B', '2'), 0x3D0DC },
+ { MKTAG('N', 'I', 'B', '3'), 0x3D345 },
+ { MKTAG('N', 'I', 'B', '4'), 0x3D125 },
+ { MKTAG('N', 'I', 'B', '5'), 0x3D369 },
+ { MKTAG('N', 'I', 'B', '6'), 0x3D444 },
+ { MKTAG('B', 'A', 'R', '4'), 0x3D0DF },
+ { MKTAG('F', 'U', 'L', 'N'), 0x3D32C }
+};
+
+const int DOORBOT_RESPONSES[101][2] = {
+ { MKTAG('W', 'E', 'A', 'T'), 0x2E29 },
+ { MKTAG('T', 'W', 'A', 'T'), 0x2E29 },
+ { MKTAG('B', 'A', 'R', 'M'), 0x2E29 },
+ { MKTAG('B', 'A', 'R', 'U'), 0x2E29 },
+ { MKTAG('B', 'A', 'R', 'K'), 0x2E29 },
+ { MKTAG('B', 'Y', 'Z', 'A'), 0x274E },
+ { MKTAG('S', 'I', 'C', 'K'), 0x28AC },
+ { MKTAG('B', 'O', 'D', 'Y'), 0x28AC },
+ { MKTAG('N', 'H', 'R', 'O'), 0x28A8 },
+ { MKTAG('N', 'P', 'L', 'C'), 0x28A7 },
+ { MKTAG('H', 'O', 'M', 'E'), 0x28A7 },
+ { MKTAG('S', 'C', 'I', 'E'), 0x28A9 },
+ { MKTAG('P', 'T', 'I', 'C'), 0x2E42 },
+ { MKTAG('P', 'G', 'R', 'P'), 0x2E42 },
+ { MKTAG('B', 'L', 'P', '1'), 0x2E42 },
+ { MKTAG('B', 'L', 'P', '2'), 0x2E42 },
+ { MKTAG('B', 'L', 'P', '3'), 0x2E42 },
+ { MKTAG('B', 'L', 'P', '4'), 0x2E42 },
+ { MKTAG('B', 'L', 'F', '1'), 0x2E3C },
+ { MKTAG('B', 'L', 'F', '2'), 0x2E3C },
+ { MKTAG('B', 'L', 'R', '1'), 0x2E42 },
+ { MKTAG('B', 'L', 'T', '1'), 0x2E56 },
+ { MKTAG('B', 'L', 'T', '2'), 0x2E48 },
+ { MKTAG('B', 'L', 'T', '3'), 0x2E55 },
+ { MKTAG('B', 'L', 'T', '4'), 0x2E56 },
+ { MKTAG('B', 'L', 'T', '5'), 0x2E56 },
+ { MKTAG('S', 'W', 'E', 'R'), 0x2E4E },
+ { MKTAG('S', 'O', 'N', 'G'), 0x2E49 },
+ { MKTAG('L', 'I', 'T', 'R'), 0x2E40 },
+ { MKTAG('A', 'R', 'T', 'I'), 0x2E1F },
+ { MKTAG('N', 'I', 'K', 'E'), 0x2E22 },
+ { MKTAG('E', 'M', 'O', 'T'), 0x2E38 },
+ { MKTAG('D', 'R', 'U', 'G'), 0x2E36 },
+ { MKTAG('E', 'A', 'R', 'T'), 0x2E37 },
+ { MKTAG('F', 'A', 'M', 'E'), 0x2E39 },
+ { MKTAG('F', 'A', 'U', 'N'), 0x2E3B },
+ { MKTAG('F', 'I', 'S', 'H'), 0x2E3B },
+ { MKTAG('F', 'L', 'O', 'R'), 0x2E3D },
+ { MKTAG('F', 'O', 'O', 'D'), 0x2E3E },
+ { MKTAG('J', 'F', 'O', 'D'), 0x2E3E },
+ { MKTAG('H', 'B', 'B', 'Y'), 0x2E3F },
+ { MKTAG('H', 'E', 'R', 'O'), 0x2E4D },
+ { MKTAG('H', 'O', 'S', 'T'), 0x2E55 },
+ { MKTAG('L', 'I', 'Q', 'D'), 0x2E35 },
+ { MKTAG('M', 'A', 'G', 'S'), 0x2E40 },
+ { MKTAG('P', 'H', 'I', 'L'), 0x2E44 },
+ { MKTAG('P', 'K', 'U', 'P'), 0x2E24 },
+ { MKTAG('P', 'L', 'A', 'N'), 0x2E45 },
+ { MKTAG('R', 'C', 'K', 'T'), 0x2E4A },
+ { MKTAG('S', 'E', 'X', '1'), 0x2E47 },
+ { MKTAG('S', 'U', 'C', '1'), 0x2E47 },
+ { MKTAG('S', 'O', 'A', 'P'), 0x2E48 },
+ { MKTAG('T', 'O', 'Y', 'S'), 0x2E50 },
+ { MKTAG('H', 'H', 'L', 'D'), 0x2E50 },
+ { MKTAG('A', 'C', 'T', 'R'), 0x2E1B },
+ { MKTAG('A', 'C', 'T', 'S'), 0x2E1C },
+ { MKTAG('A', 'D', 'V', 'T'), 0x2E1D },
+ { MKTAG('B', 'R', 'N', 'D'), 0x2E21 },
+ { MKTAG('B', 'R', 'N', '2'), 0x2E22 },
+ { MKTAG('B', 'R', 'N', '3'), 0x2E23 },
+ { MKTAG('F', 'A', 'S', 'H'), 0x2E3A },
+ { MKTAG('F', 'I', 'L', 'M'), 0x2E3C },
+ { MKTAG('K', 'N', 'O', 'B'), 0x2E42 },
+ { MKTAG('M', 'U', 'S', 'I'), 0x2E43 },
+ { MKTAG('S', 'F', 'S', 'F'), 0x2E46 },
+ { MKTAG('S', 'P', 'R', 'T'), 0x2E4B },
+ { MKTAG('T', 'E', 'A', 'M'), 0x2E4C },
+ { MKTAG('T', 'R', 'A', 'V'), 0x2E52 },
+ { MKTAG('T', 'V', 'S', 'H'), 0x2E56 },
+ { MKTAG('W', 'E', 'A', 'P'), 0x2E57 },
+ { MKTAG('W', 'W', 'E', 'B'), 0x2E58 },
+ { MKTAG('A', 'R', 'T', 'Y'), 0x2E1E },
+ { MKTAG('C', 'O', 'M', 'D'), 0x2E25 },
+ { MKTAG('C', 'O', 'O', 'K'), 0x2E26 },
+ { MKTAG('C', 'O', 'P', 'S'), 0x2E27 },
+ { MKTAG('C', 'R', 'I', 'M'), 0x2E28 },
+ { MKTAG('D', 'C', 'T', 'R'), 0x2E29 },
+ { MKTAG('A', 'U', 'T', 'H'), 0x2E29 },
+ { MKTAG('M', 'L', 'T', 'Y'), 0x2E41 },
+ { MKTAG('S', 'A', 'S', 'S'), 0x28C3 },
+ { MKTAG('B', 'O', 'Y', 'S'), 0x2768 },
+ { MKTAG('G', 'I', 'R', 'L'), 0x2769 },
+ { MKTAG('T', 'D', 'V', 'P'), 0x277D },
+ { MKTAG('I', 'S', 'H', 'E'), 0x27B6 },
+ { MKTAG('J', 'O', 'K', 'E'), 0x29FF },
+ { MKTAG('J', 'N', 'A', 'M'), 0x29FF },
+ { MKTAG('S', 'L', 'O', 'W'), 0x2823 },
+ { MKTAG('T', 'H', 'R', 'T'), 0x2823 },
+ { MKTAG('D', 'O', 'R', '2'), 0x2BC0 },
+ { MKTAG('M', 'P', 'O', 'P'), 0x2BC0 },
+ { MKTAG('C', 'L', 'U', 'B'), 0x2E39 },
+ { MKTAG('C', 'O', 'L', 'R'), 0x2776 },
+ { MKTAG('D', 'N', 'C', 'E'), 0x2931 },
+ { MKTAG('M', 'C', 'P', 'Y'), 0x276B },
+ { MKTAG('M', 'I', 'N', 'S'), 0x2E43 },
+ { MKTAG('P', 'L', 'A', 'C'), 0x2E37 },
+ { MKTAG('T', 'I', 'T', 'A'), 0x2E40 },
+ { MKTAG('T', 'L', 'A', ' '), 0x277D },
+ { MKTAG('H', 'A', 'H', 'A'), 0x27A8 },
+ { MKTAG('F', 'U', 'L', 'N'), 0x2B15 },
+ { MKTAG('B', 'A', 'R', '1'), 0x2E35 }
+};
+
+const int LIFTBOT_RESPONSES[34][2] = {
+ { MKTAG('L', 'I', 'F', '1'), 0x33453 },
+ { MKTAG('L', 'I', 'F', '2'), 0x3345D },
+ { MKTAG('L', 'I', 'F', '3'), 0x3354E },
+ { MKTAG('L', 'I', 'F', '4'), 0x3374B },
+ { MKTAG('I', 'S', 'H', 'E'), 0x335F7 },
+ { MKTAG('J', 'O', 'K', 'E'), 0x3374B },
+ { MKTAG('J', 'N', 'A', 'M'), 0x3374B },
+ { MKTAG('S', 'L', 'O', 'W'), 0x337B5 },
+ { MKTAG('T', 'H', 'R', 'T'), 0x337BB },
+ { MKTAG('S', 'C', 'I', 'E'), 0x337B2 },
+ { MKTAG('S', 'C', 'I', 'T'), 0x337B4 },
+ { MKTAG('T', 'D', 'V', 'P'), 0x337BA },
+ { MKTAG('T', 'I', 'T', 'A'), 0x337C0 },
+ { MKTAG('C', 'S', 'P', 'Y'), 0x337A5 },
+ { MKTAG('M', 'U', 'S', 'I'), 0x337AA },
+ { MKTAG('M', 'C', 'P', 'Y'), 0x337A9 },
+ { MKTAG('D', 'N', 'C', 'E'), 0x337A7 },
+ { MKTAG('N', 'A', 'U', 'T'), 0x337AC },
+ { MKTAG('T', 'L', 'A', ' '), 0x337C1 },
+ { MKTAG('S', 'U', 'M', 'S'), 0x33598 },
+ { MKTAG('O', 'R', 'D', '1'), 0x33776 },
+ { MKTAG('O', 'R', 'D', '2'), 0x33779 },
+ { MKTAG('O', 'R', 'D', '3'), 0x3377A },
+ { MKTAG('O', 'R', 'D', '4'), 0x3377B },
+ { MKTAG('O', 'R', 'D', '5'), 0x3377C },
+ { MKTAG('O', 'R', 'D', '6'), 0x3377D },
+ { MKTAG('O', 'R', 'D', '7'), 0x3377E },
+ { MKTAG('L', 'I', 'Q', 'D'), 0x337FC },
+ { MKTAG('F', 'O', 'O', 'D'), 0x337FD },
+ { MKTAG('J', 'F', 'O', 'D'), 0x337FD },
+ { MKTAG('W', 'E', 'A', 'T'), 0x337E3 },
+ { MKTAG('S', 'I', 'C', 'K'), 0x336A1 },
+ { MKTAG('B', 'O', 'D', 'Y'), 0x33624 },
+ { MKTAG('B', 'Y', 'Z', 'A'), 0x33617 }
+};
+
+const int MAITRED_RESPONSES[74][2] = {
+ { MKTAG('M', 'A', 'D', '1'), 0x3F7E2 },
+ { MKTAG('M', 'A', 'D', '2'), 0x3F916 },
+ { MKTAG('M', 'A', 'D', '3'), 0x3F931 },
+ { MKTAG('M', 'A', 'D', '4'), 0x3F936 },
+ { MKTAG('M', 'A', 'D', '5'), 0x3F938 },
+ { MKTAG('M', 'A', 'D', '6'), 0x3F943 },
+ { MKTAG('M', 'A', 'D', '7'), 0x3F947 },
+ { MKTAG('M', 'A', 'D', '8'), 0x3F945 },
+ { MKTAG('M', 'A', 'D', '9'), 0x3F946 },
+ { MKTAG('M', 'D', '1', '0'), 0x3F9F5 },
+ { MKTAG('M', 'D', '1', '1'), 0x3F982 },
+ { MKTAG('J', 'F', 'O', 'D'), 0x3F930 },
+ { MKTAG('C', 'M', 'N', 'T'), 0x3F937 },
+ { MKTAG('H', 'A', 'H', 'A'), 0x3FA47 },
+ { MKTAG('S', 'U', 'M', 'S'), 0x3F9FE },
+ { MKTAG('A', 'N', 'S', 'W'), 0x3F90B },
+ { MKTAG('M', 'U', 'S', 'I'), 0x3FA35 },
+ { MKTAG('S', 'O', 'N', 'G'), 0x3FA35 },
+ { MKTAG('A', 'C', 'T', 'R'), 0x3F9B6 },
+ { MKTAG('A', 'C', 'T', 'S'), 0x3F9B7 },
+ { MKTAG('A', 'R', 'T', 'I'), 0x3F9CE },
+ { MKTAG('A', 'R', 'T', 'Y'), 0x3F9CE },
+ { MKTAG('A', 'U', 'T', 'H'), 0x3FAB6 },
+ { MKTAG('C', 'O', 'M', 'D'), 0x3F963 },
+ { MKTAG('C', 'O', 'P', 'S'), 0x3F9F8 },
+ { MKTAG('C', 'R', 'I', 'M'), 0x3F9F8 },
+ { MKTAG('C', 'S', 'P', 'Y'), 0x3F965 },
+ { MKTAG('D', 'C', 'T', 'R'), 0x3F9B6 },
+ { MKTAG('D', 'R', 'U', 'G'), 0x3F96F },
+ { MKTAG('E', 'A', 'R', 'T'), 0x3F9E3 },
+ { MKTAG('E', 'M', 'O', 'T'), 0x3FA29 },
+ { MKTAG('F', 'A', 'M', 'E'), 0x3FAB6 },
+ { MKTAG('F', 'A', 'S', 'H'), 0x3F8EA },
+ { MKTAG('F', 'A', 'U', 'N'), 0x3F969 },
+ { MKTAG('F', 'I', 'L', 'M'), 0x3F9CE },
+ { MKTAG('F', 'L', 'O', 'R'), 0x3F9A3 },
+ { MKTAG('H', 'B', 'B', 'Y'), 0x3F987 },
+ { MKTAG('H', 'E', 'R', 'O'), 0x3F8DA },
+ { MKTAG('H', 'H', 'G', 'Q'), 0x3F96B },
+ { MKTAG('H', 'H', 'L', 'D'), 0x3FA2B },
+ { MKTAG('H', 'O', 'S', 'T'), 0x3F9E1 },
+ { MKTAG('K', 'N', 'O', 'B'), 0x3F9E1 },
+ { MKTAG('L', 'I', 'Q', 'D'), 0x3F91C },
+ { MKTAG('L', 'I', 'T', 'R'), 0x3F9CE },
+ { MKTAG('M', 'A', 'G', 'S'), 0x3F912 },
+ { MKTAG('M', 'L', 'T', 'Y'), 0x3F9F7 },
+ { MKTAG('P', 'G', 'R', 'P'), 0x3F8D0 },
+ { MKTAG('P', 'H', 'I', 'L'), 0x3F8E9 },
+ { MKTAG('P', 'K', 'U', 'P'), 0x3F9FB },
+ { MKTAG('P', 'L', 'A', 'C'), 0x3FA22 },
+ { MKTAG('P', 'T', 'I', 'C'), 0x3F8D0 },
+ { MKTAG('R', 'C', 'K', 'T'), 0x3F9A3 },
+ { MKTAG('S', 'C', 'I', 'E'), 0x3F968 },
+ { MKTAG('S', 'C', 'I', 'T'), 0x3F9E2 },
+ { MKTAG('S', 'E', 'X', '1'), 0x3F9C9 },
+ { MKTAG('S', 'F', 'S', 'F'), 0x3F988 },
+ { MKTAG('S', 'O', 'A', 'P'), 0x3FA3C },
+ { MKTAG('S', 'P', 'R', 'T'), 0x3FAB6 },
+ { MKTAG('S', 'W', 'E', 'R'), 0x3F96B },
+ { MKTAG('T', 'E', 'A', 'M'), 0x3F9B8 },
+ { MKTAG('T', 'O', 'Y', 'S'), 0x3F96D },
+ { MKTAG('T', 'V', 'S', 'H'), 0x3F9CE },
+ { MKTAG('W', 'E', 'A', 'P'), 0x3F9D8 },
+ { MKTAG('W', 'W', 'E', 'B'), 0x3F987 },
+ { MKTAG('B', 'Y', 'Z', 'A'), 0x3F9A5 },
+ { MKTAG('T', 'W', 'A', 'T'), 0x3F96F },
+ { MKTAG('M', 'C', 'P', 'Y'), 0x3F9B9 },
+ { MKTAG('T', 'H', 'R', 'T'), 0x3FB15 },
+ { MKTAG('T', 'D', 'V', 'P'), 0x3FB17 },
+ { MKTAG('T', 'I', 'T', 'A'), 0x3FB18 },
+ { MKTAG('M', 'I', 'N', 'S'), 0x3FB19 },
+ { MKTAG('D', 'N', 'C', 'E'), 0x3FB1A },
+ { MKTAG('N', 'A', 'U', 'T'), 0x3FB1B },
+ { MKTAG('T', 'L', 'A', ' '), 0x3FB1C }
+};
+
+void writeScriptResponses(const char *name, const int *tags, uint count, int valuesPerTag) {
+ outputFile.seek(dataOffset);
+
+ for (int idx = 0; idx < count * (valuesPerTag + 1); ++idx, ++tags)
+ outputFile.writeLong(*tags);
+
+ writeEntryHeader(name, dataOffset, count * (valuesPerTag + 1) * 4);
+ dataOffset += count * (valuesPerTag + 1) * 4;
+}
+
+void writeAllScriptResponses() {
+ writeScriptResponses("Responses/Barbot", &BARBOT_RESPONSES[0][0], 93, 1);
+ writeScriptResponses("Responses/Bellbot", &BELLBOT_RESPONSES[0][0], 130, 4);
+ writeScriptResponses("Responses/Deskbot", &DESKBOT_RESPONSES[0][0], 128, 4);
+ writeScriptResponses("Responses/Doorbot", &DOORBOT_RESPONSES[0][0], 101, 1);
+ writeScriptResponses("Responses/Liftbot", &LIFTBOT_RESPONSES[0][0], 34, 1);
+ writeScriptResponses("Responses/MaitreD", &MAITRED_RESPONSES[0][0], 74, 1);
+} \ No newline at end of file
diff --git a/devtools/create_titanic/script_responses.h b/devtools/create_titanic/script_responses.h
new file mode 100644
index 0000000000..ca927e0ccd
--- /dev/null
+++ b/devtools/create_titanic/script_responses.h
@@ -0,0 +1,32 @@
+/* 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 COMMON_SCRIPT_TAGS_H
+#define COMMON_SCRIPT_TAGS_H
+
+#include "common/scummsys.h"
+
+extern void writeAllScriptResponses();
+extern void writeEntryHeader(const char *name, uint offset, uint size);
+extern uint dataOffset;
+
+#endif
diff --git a/devtools/create_titanic/script_states.cpp b/devtools/create_titanic/script_states.cpp
new file mode 100644
index 0000000000..81157441e4
--- /dev/null
+++ b/devtools/create_titanic/script_states.cpp
@@ -0,0 +1,548 @@
+/* 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.
+ *
+ */
+
+ // Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+// HACK to allow building with the SDL backend on MinGW
+// see bug #1800764 "TOOLS: MinGW tools building broken"
+#ifdef main
+#undef main
+#endif // main
+
+#include "file.h"
+#include "script_states.h"
+
+static const UpdateState12 BARBOT_STATES[] = {
+ { 0x0003AB24, 0x00000005, 0x00 },
+ { 0x0003AD33, 0x00000005, 0x00 },
+ { 0x0003AB40, 0x00000008, 0x00 },
+ { 0x0003AC6A, 0x00000008, 0x00 },
+ { 0x0003AB3E, 0x00000006, 0x00 },
+ { 0x0003AB3D, 0x00000006, 0x00 },
+ { 0x0003AB41, 0x00000007, 0x00 },
+ { 0x0003AB69, 0x00000008, 0x00 },
+ { 0x0003AE6D, 0x0000004E, 0x00 },
+ { 0x0003AC69, 0x0000004E, 0x00 },
+ { 0x0003AE6E, 0x0000004F, 0x00 },
+ { 0x0003AE6F, 0x00000051, 0x00 },
+ { 0x0003AE70, 0x00000051, 0x00 },
+ { 0x0003AE71, 0x00000051, 0x00 },
+ { 0x0003AE72, 0x00000051, 0x00 },
+ { 0x0003AE73, 0x00000051, 0x00 },
+ { 0x0003AE74, 0x00000051, 0x00 },
+ { 0x0003AE75, 0x00000051, 0x00 },
+ { 0x0003AE76, 0x00000051, 0x00 },
+ { 0x0003AE77, 0x00000051, 0x00 },
+ { 0x0003AEB8, 0x00000051, 0x00 },
+ { 0x0003AB20, 0x00000009, 0x00 },
+ { 0x0003AB14, 0x0000000A, 0x00 },
+ { 0x0003AB15, 0x0000000B, 0x00 },
+ { 0x0003AB16, 0x0000000C, 0x00 },
+ { 0x0003AB63, 0x0000000D, 0x00 },
+ { 0x0003AB64, 0x0000000D, 0x00 },
+ { 0x0003AB44, 0x00000001, 0x00 },
+ { 0x0003AB43, 0x00000001, 0x0B },
+ { 0x0003AB2A, 0x00000002, 0x00 },
+ { 0x0003AB4A, 0x00000003, 0x0B },
+ { 0x0003AB4C, 0x00000003, 0x0B },
+ { 0x0003AB65, 0x00000004, 0x00 },
+ { 0x0003AB2F, 0x0000000E, 0x00 },
+ { 0x0003AB30, 0x0000000F, 0x00 },
+ { 0x0003AB17, 0x00000010, 0x0B },
+ { 0x0003AB18, 0x00000010, 0x0B },
+ { 0x0003AAE3, 0x0000003E, 0x00 },
+ { 0x0003AAE4, 0x0000003E, 0x00 },
+ { 0x0003AAE5, 0x0000003E, 0x00 },
+ { 0x0003AB0F, 0x00000011, 0x00 },
+ { 0x0003AB11, 0x00000012, 0x00 },
+ { 0x0003AB12, 0x00000013, 0x00 },
+ { 0x0003AB13, 0x00000014, 0x00 },
+ { 0x0003AADC, 0x00000019, 0x00 },
+ { 0x0003AADD, 0x0000001A, 0x00 },
+ { 0x0003AADE, 0x0000001B, 0x00 },
+ { 0x0003AAFD, 0x00000015, 0x00 },
+ { 0x0003AAFE, 0x00000016, 0x00 },
+ { 0x0003AAFF, 0x00000017, 0x00 },
+ { 0x0003AB00, 0x00000018, 0x00 },
+ { 0x0003AAF4, 0x0000001C, 0x00 },
+ { 0x0003AAF5, 0x0000001D, 0x00 },
+ { 0x0003AAF6, 0x0000001E, 0x00 },
+ { 0x0003AAD9, 0x0000001F, 0x00 },
+ { 0x0003AADA, 0x00000020, 0x00 },
+ { 0x0003AADB, 0x00000021, 0x00 },
+ { 0x0003AAF7, 0x00000022, 0x00 },
+ { 0x0003AAF8, 0x00000023, 0x00 },
+ { 0x0003AAF9, 0x00000024, 0x00 },
+ { 0x0003AB04, 0x0000002C, 0x00 },
+ { 0x0003AB05, 0x0000002D, 0x00 },
+ { 0x0003AB06, 0x0000002E, 0x00 },
+ { 0x0003AADF, 0x00000029, 0x00 },
+ { 0x0003AAE0, 0x0000002A, 0x00 },
+ { 0x0003AAE1, 0x0000002B, 0x00 },
+ { 0x0003AB07, 0x00000038, 0x00 },
+ { 0x0003AB08, 0x00000039, 0x00 },
+ { 0x0003AB09, 0x0000003A, 0x00 },
+ { 0x0003AB01, 0x0000003B, 0x00 },
+ { 0x0003AB02, 0x0000003C, 0x00 },
+ { 0x0003AB03, 0x0000003D, 0x00 },
+ { 0x0003AAF0, 0x00000025, 0x00 },
+ { 0x0003AAF1, 0x00000026, 0x00 },
+ { 0x0003AAF2, 0x00000027, 0x00 },
+ { 0x0003AAF3, 0x00000028, 0x00 },
+ { 0x0003AB0A, 0x0000002F, 0x00 },
+ { 0x0003AB0B, 0x00000030, 0x00 },
+ { 0x0003AB0C, 0x00000031, 0x00 },
+ { 0x0003AB0D, 0x00000032, 0x00 },
+ { 0x0003AAEA, 0x00000033, 0x00 },
+ { 0x0003AAEB, 0x00000034, 0x00 },
+ { 0x0003AAEC, 0x00000035, 0x00 },
+ { 0x0003AAED, 0x00000036, 0x00 },
+ { 0x0003AAEE, 0x00000037, 0x00 },
+ { 0x0003ACC3, 0x0000003F, 0x00 },
+ { 0x0003ACC4, 0x00000040, 0x00 },
+ { 0x0003ACC5, 0x00000041, 0x00 },
+ { 0x0003ACC6, 0x00000042, 0x00 },
+ { 0x0003ACC7, 0x00000043, 0x00 },
+ { 0x0003ACC8, 0x00000044, 0x00 },
+ { 0x0003ADCF, 0x00000045, 0x00 },
+ { 0x0003ADD0, 0x00000046, 0x00 },
+ { 0x0003ADD1, 0x00000047, 0x00 },
+ { 0x0003ADD2, 0x00000048, 0x00 },
+ { 0x0003ADD3, 0x00000049, 0x00 },
+ { 0x0003ACA4, 0x0000004A, 0x00 },
+ { 0x0003ACA7, 0x0000004B, 0x00 },
+ { 0x0003ADD5, 0x0000004C, 0x00 },
+ { 0x0003AC7E, 0x0000004C, 0x00 },
+ { 0x0003ABF9, 0x0000004C, 0x00 },
+ { 0x0003AD14, 0x0000004C, 0x00 },
+ { 0x0003AD15, 0x0000004C, 0x00 },
+ { 0x0003AD10, 0x0000004C, 0x00 },
+ { 0x0003AD17, 0x0000004C, 0x00 },
+ { 0x0003AD21, 0x0000004C, 0x00 },
+ { 0x0003AD2F, 0x0000004C, 0x00 },
+ { 0x0003AC7F, 0x0000004D, 0x00 },
+ { 0x0003AEBA, 0x00000052, 0x0E },
+ { 0x0003AED5, 0x00000053, 0x00 },
+ { 0x0003B034, 0x00000054, 0x00 },
+ { 0x0003B037, 0x00000054, 0x00 },
+ { 0x0003B036, 0x00000055, 0x00 },
+ { 0x0003B035, 0x00000055, 0x00 },
+ { 0x0003B02D, 0x00000055, 0x00 },
+ { 0x0003B02F, 0x00000055, 0x00 },
+ { 0x0003B02E, 0x00000056, 0x00 },
+ { 0x0003B031, 0x00000056, 0x00 },
+ { 0x0003B033, 0x00000056, 0x00 },
+ { 0x0003B032, 0x00000057, 0x00 },
+ { 0x0003B023, 0x00000057, 0x00 },
+ { 0x0003B025, 0x00000057, 0x00 },
+ { 0x0003B024, 0x00000058, 0x00 },
+ { 0x0003B017, 0x00000058, 0x00 },
+ { 0x0003B01C, 0x00000058, 0x00 },
+ { 0x0003B01A, 0x00000059, 0x00 },
+ { 0x0003B01B, 0x0000005A, 0x00 },
+ { 0x0003B018, 0x0000005B, 0x00 },
+ { 0x0003B019, 0x0000005D, 0x00 },
+ { 0x0003B01D, 0x0000005D, 0x00 },
+ { 0x0003B01E, 0x0000005D, 0x00 },
+ { 0x0003B01F, 0x0000005D, 0x00 },
+ { 0x0003B026, 0x0000005D, 0x00 },
+ { 0x0003B027, 0x0000005D, 0x00 },
+ { 0x0003B028, 0x0000005D, 0x00 },
+ { 0x0003B029, 0x0000005D, 0x00 },
+ { 0x0003B030, 0x0000005D, 0x00 },
+ { 0x0003B02A, 0x0000005E, 0x00 },
+ { 0x0003ABF7, 0x0000005F, 0x00 },
+ { 0x0003AF6A, 0x00000060, 0x00 },
+ { 0x0003AEC6, 0x00000061, 0x00 },
+ { 0x00000000, 0x00000000, 0x00 }
+};
+
+static const UpdateState8 BELLBOT_STATES[] = {
+ { 0x00031070, 0x00000001 }, { 0x0003107B, 0x00000002 }, { 0x0003107E, 0x00000003 },
+ { 0x0003104F, 0x00000004 }, { 0x00030F23, 0x00000005 }, { 0x00030F2A, 0x00000006 },
+ { 0x00030F31, 0x00000007 }, { 0x00030F32, 0x00000007 }, { 0x00030F33, 0x00000007 },
+ { 0x00030F34, 0x00000007 }, { 0x00030F35, 0x00000007 }, { 0x00030F36, 0x00000007 },
+ { 0x00030F37, 0x00000008 }, { 0x00030F2E, 0x00000009 }, { 0x00030E78, 0x0000000A },
+ { 0x00030E42, 0x0000000C }, { 0x00030E0C, 0x0000000D }, { 0x00030E9C, 0x0000000E },
+ { 0x00030DC1, 0x0000000F }, { 0x00030DC2, 0x00000010 }, { 0x00030D6B, 0x00000011 },
+ { 0x00030D6C, 0x00000011 }, { 0x00030E1D, 0x00000012 }, { 0x00030E1E, 0x00000013 },
+ { 0x00030E3B, 0x00000014 }, { 0x00030EBA, 0x00000015 }, { 0x00031086, 0x00000016 },
+ { 0x000310A4, 0x00000017 }, { 0x00031058, 0x00000018 }, { 0x00031059, 0x00000019 },
+ { 0x00030E3F, 0x0000001A }, { 0x00030EBC, 0x0000001B }, { 0x00030E9B, 0x0000001C },
+ { 0x00030E32, 0x0000001D }, { 0x00030E76, 0x0000001E }, { 0x00031060, 0x0000001F },
+ { 0x00031065, 0x00000020 }, { 0x00031075, 0x00000021 }, { 0x00031077, 0x00000022 },
+ { 0x00031041, 0x00000023 }, { 0x00031038, 0x00000024 }, { 0x00030FAB, 0x00000025 },
+ { 0x00030FAF, 0x00000026 }, { 0x00030FB1, 0x00000027 }, { 0x00030FB8, 0x00000028 },
+ { 0x00030FB2, 0x00000029 }, { 0x00030FC1, 0x0000002A }, { 0x00030FC2, 0x0000002B },
+ { 0x00030FA4, 0x0000002C }, { 0x00030FA5, 0x0000002D }, { 0x00030FA7, 0x0000002E },
+ { 0x00030FA8, 0x0000002C }, { 0x00030FA6, 0x0000002C }, { 0x00030EAD, 0x0000002F },
+ { 0x00030EAE, 0x00000030 }, { 0x00030ED6, 0x00000031 }, { 0x00030ED7, 0x00000032 },
+ { 0x00030ED8, 0x00000033 }, { 0x000310A9, 0x00000034 }, { 0x00030F4C, 0x00000035 },
+ { 0x00030DA7, 0x00000036 }, { 0x00030D9F, 0x00000037 }, { 0x00030FC8, 0x00000038 },
+ { 0x00030FC9, 0x00000039 }, { 0x00030FCF, 0x0000003A }, { 0x00030FCA, 0x0000003B },
+ { 0x00030FCB, 0x0000003C }, { 0x00030FCC, 0x0000003D }, { 0x00030E41, 0x0000003E },
+ { 0x00030E12, 0x0000003F }, { 0x00030D72, 0x00000040 }, { 0x00030D76, 0x00000041 },
+ { 0x00030D78, 0x00000042 }, { 0x00030D79, 0x00000043 }, { 0x000310AE, 0x00000044 },
+ { 0x0003112C, 0x00000044 }, { 0x00031132, 0x00000045 }, { 0x00031133, 0x00000046 },
+ { 0x00031134, 0x00000047 }, { 0x000310D7, 0x00000048 }, { 0x0003113C, 0x00000049 },
+ { 0x0003113E, 0x0000004A }, { 0x0003113D, 0x0000004A }, { 0x00031146, 0x0000004B },
+ { 0x00031149, 0x0000004C }, { 0x0003114A, 0x0000004D }, { 0x0003114E, 0x0000004E },
+ { 0x00031151, 0x0000004E }, { 0x0003114F, 0x0000004E }, { 0x00031152, 0x0000004E },
+ { 0x0003115B, 0x0000004F }, { 0x00031163, 0x00000050 }, { 0x00031164, 0x00000051 },
+ { 0x00031165, 0x00000051 }, { 0x00031166, 0x00000051 }, { 0x00031167, 0x00000052 },
+ { 0x0003117A, 0x00000053 }, { 0x0003149A, 0x00000054 }, { 0x00031454, 0x00000055 },
+ { 0x0003157B, 0x00000056 }, { 0x00031177, 0x00000057 }, { 0x00031171, 0x00000057 },
+ { 0x0003117A, 0x00000057 }, { 0x00031507, 0x00000057 }, { 0x0003159D, 0x00000058 },
+ { 0x000315DD, 0x00000059 }, { 0x00031147, 0x0000005A }, { 0x00031148, 0x0000005A },
+ { 0x00000000, 0x00000000 }
+};
+
+static const UpdateState12 DESKBOT_STATES[] = {
+ { 0x0003AB24, 0x00000005, 0x00 },
+ { 0x0003AD33, 0x00000005, 0x00 },
+ { 0x0003AB40, 0x00000008, 0x00 },
+ { 0x0003AC6A, 0x00000008, 0x00 },
+ { 0x0003AB3E, 0x00000006, 0x00 },
+ { 0x0003AB3D, 0x00000006, 0x00 },
+ { 0x0003AB41, 0x00000007, 0x00 },
+ { 0x0003AB69, 0x00000008, 0x00 },
+ { 0x0003AE6D, 0x0000004E, 0x00 },
+ { 0x0003AC69, 0x0000004E, 0x00 },
+ { 0x0003AE6E, 0x0000004F, 0x00 },
+ { 0x0003AE6F, 0x00000051, 0x00 },
+ { 0x0003AE70, 0x00000051, 0x00 },
+ { 0x0003AE71, 0x00000051, 0x00 },
+ { 0x0003AE72, 0x00000051, 0x00 },
+ { 0x0003AE73, 0x00000051, 0x00 },
+ { 0x0003AE74, 0x00000051, 0x00 },
+ { 0x0003AE75, 0x00000051, 0x00 },
+ { 0x0003AE76, 0x00000051, 0x00 },
+ { 0x0003AE77, 0x00000051, 0x00 },
+ { 0x0003AEB8, 0x00000051, 0x00 },
+ { 0x0003AB20, 0x00000009, 0x00 },
+ { 0x0003AB14, 0x0000000A, 0x00 },
+ { 0x0003AB15, 0x0000000B, 0x00 },
+ { 0x0003AB16, 0x0000000C, 0x00 },
+ { 0x0003AB63, 0x0000000D, 0x00 },
+ { 0x0003AB64, 0x0000000D, 0x00 },
+ { 0x0003AB44, 0x00000001, 0x00 },
+ { 0x0003AB43, 0x00000001, 0x0B },
+ { 0x0003AB2A, 0x00000002, 0x00 },
+ { 0x0003AB4A, 0x00000003, 0x0B },
+ { 0x0003AB4C, 0x00000003, 0x0B },
+ { 0x0003AB65, 0x00000004, 0x00 },
+ { 0x0003AB2F, 0x0000000E, 0x00 },
+ { 0x0003AB30, 0x0000000F, 0x00 },
+ { 0x0003AB17, 0x00000010, 0x0B },
+ { 0x0003AB18, 0x00000010, 0x0B },
+ { 0x0003AAE3, 0x0000003E, 0x00 },
+ { 0x0003AAE4, 0x0000003E, 0x00 },
+ { 0x0003AAE5, 0x0000003E, 0x00 },
+ { 0x0003AB0F, 0x00000011, 0x00 },
+ { 0x0003AB11, 0x00000012, 0x00 },
+ { 0x0003AB12, 0x00000013, 0x00 },
+ { 0x0003AB13, 0x00000014, 0x00 },
+ { 0x0003AADC, 0x00000019, 0x00 },
+ { 0x0003AADD, 0x0000001A, 0x00 },
+ { 0x0003AADE, 0x0000001B, 0x00 },
+ { 0x0003AAFD, 0x00000015, 0x00 },
+ { 0x0003AAFE, 0x00000016, 0x00 },
+ { 0x0003AAFF, 0x00000017, 0x00 },
+ { 0x0003AB00, 0x00000018, 0x00 },
+ { 0x0003AAF4, 0x0000001C, 0x00 },
+ { 0x0003AAF5, 0x0000001D, 0x00 },
+ { 0x0003AAF6, 0x0000001E, 0x00 },
+ { 0x0003AAD9, 0x0000001F, 0x00 },
+ { 0x0003AADA, 0x00000020, 0x00 },
+ { 0x0003AADB, 0x00000021, 0x00 },
+ { 0x0003AAF7, 0x00000022, 0x00 },
+ { 0x0003AAF8, 0x00000023, 0x00 },
+ { 0x0003AAF9, 0x00000024, 0x00 },
+ { 0x0003AB04, 0x0000002C, 0x00 },
+ { 0x0003AB05, 0x0000002D, 0x00 },
+ { 0x0003AB06, 0x0000002E, 0x00 },
+ { 0x0003AADF, 0x00000029, 0x00 },
+ { 0x0003AAE0, 0x0000002A, 0x00 },
+ { 0x0003AAE1, 0x0000002B, 0x00 },
+ { 0x0003AB07, 0x00000038, 0x00 },
+ { 0x0003AB08, 0x00000039, 0x00 },
+ { 0x0003AB09, 0x0000003A, 0x00 },
+ { 0x0003AB01, 0x0000003B, 0x00 },
+ { 0x0003AB02, 0x0000003C, 0x00 },
+ { 0x0003AB03, 0x0000003D, 0x00 },
+ { 0x0003AAF0, 0x00000025, 0x00 },
+ { 0x0003AAF1, 0x00000026, 0x00 },
+ { 0x0003AAF2, 0x00000027, 0x00 },
+ { 0x0003AAF3, 0x00000028, 0x00 },
+ { 0x0003AB0A, 0x0000002F, 0x00 },
+ { 0x0003AB0B, 0x00000030, 0x00 },
+ { 0x0003AB0C, 0x00000031, 0x00 },
+ { 0x0003AB0D, 0x00000032, 0x00 },
+ { 0x0003AAEA, 0x00000033, 0x00 },
+ { 0x0003AAEB, 0x00000034, 0x00 },
+ { 0x0003AAEC, 0x00000035, 0x00 },
+ { 0x0003AAED, 0x00000036, 0x00 },
+ { 0x0003AAEE, 0x00000037, 0x00 },
+ { 0x0003ACC3, 0x0000003F, 0x00 },
+ { 0x0003ACC4, 0x00000040, 0x00 },
+ { 0x0003ACC5, 0x00000041, 0x00 },
+ { 0x0003ACC6, 0x00000042, 0x00 },
+ { 0x0003ACC7, 0x00000043, 0x00 },
+ { 0x0003ACC8, 0x00000044, 0x00 },
+ { 0x0003ADCF, 0x00000045, 0x00 },
+ { 0x0003ADD0, 0x00000046, 0x00 },
+ { 0x0003ADD1, 0x00000047, 0x00 },
+ { 0x0003ADD2, 0x00000048, 0x00 },
+ { 0x0003ADD3, 0x00000049, 0x00 },
+ { 0x0003ACA4, 0x0000004A, 0x00 },
+ { 0x0003ACA7, 0x0000004B, 0x00 },
+ { 0x0003ADD5, 0x0000004C, 0x00 },
+ { 0x0003AC7E, 0x0000004C, 0x00 },
+ { 0x0003ABF9, 0x0000004C, 0x00 },
+ { 0x0003AD14, 0x0000004C, 0x00 },
+ { 0x0003AD15, 0x0000004C, 0x00 },
+ { 0x0003AD10, 0x0000004C, 0x00 },
+ { 0x0003AD17, 0x0000004C, 0x00 },
+ { 0x0003AD21, 0x0000004C, 0x00 },
+ { 0x0003AD2F, 0x0000004C, 0x00 },
+ { 0x0003AC7F, 0x0000004D, 0x00 },
+ { 0x0003AEBA, 0x00000052, 0x0E },
+ { 0x0003AED5, 0x00000053, 0x00 },
+ { 0x0003B034, 0x00000054, 0x00 },
+ { 0x0003B037, 0x00000054, 0x00 },
+ { 0x0003B036, 0x00000055, 0x00 },
+ { 0x0003B035, 0x00000055, 0x00 },
+ { 0x0003B02D, 0x00000055, 0x00 },
+ { 0x0003B02F, 0x00000055, 0x00 },
+ { 0x0003B02E, 0x00000056, 0x00 },
+ { 0x0003B031, 0x00000056, 0x00 },
+ { 0x0003B033, 0x00000056, 0x00 },
+ { 0x0003B032, 0x00000057, 0x00 },
+ { 0x0003B023, 0x00000057, 0x00 },
+ { 0x0003B025, 0x00000057, 0x00 },
+ { 0x0003B024, 0x00000058, 0x00 },
+ { 0x0003B017, 0x00000058, 0x00 },
+ { 0x0003B01C, 0x00000058, 0x00 },
+ { 0x0003B01A, 0x00000059, 0x00 },
+ { 0x0003B01B, 0x0000005A, 0x00 },
+ { 0x0003B018, 0x0000005B, 0x00 },
+ { 0x0003B019, 0x0000005D, 0x00 },
+ { 0x0003B01D, 0x0000005D, 0x00 },
+ { 0x0003B01E, 0x0000005D, 0x00 },
+ { 0x0003B01F, 0x0000005D, 0x00 },
+ { 0x0003B026, 0x0000005D, 0x00 },
+ { 0x0003B027, 0x0000005D, 0x00 },
+ { 0x0003B028, 0x0000005D, 0x00 },
+ { 0x0003B029, 0x0000005D, 0x00 },
+ { 0x0003B030, 0x0000005D, 0x00 },
+ { 0x0003B02A, 0x0000005E, 0x00 },
+ { 0x0003ABF7, 0x0000005F, 0x00 },
+ { 0x0003AF6A, 0x00000060, 0x00 },
+ { 0x0003AEC6, 0x00000061, 0x00 },
+ { 0x00000000, 0x00000000, 0x00 }
+};
+
+static const UpdateState12 DOORBOT_STATES[] = {
+ { 0x00035BD0, 0x00000004, 0x06 },
+ { 0x00035BE7, 0x00000005, 0x00 },
+ { 0x00035BED, 0x00000006, 0x0A },
+ { 0x00035E41, 0x0000000C, 0x0A },
+ { 0x00035F9D, 0x0000000F, 0x00 },
+ { 0x00035F81, 0x00000010, 0x00 },
+ { 0x00035F82, 0x00000010, 0x00 },
+ { 0x00035F83, 0x00000010, 0x00 },
+ { 0x00035F84, 0x00000010, 0x00 },
+ { 0x00035F85, 0x00000010, 0x00 },
+ { 0x00035FC5, 0x00000011, 0x00 },
+ { 0x00035B6C, 0x00000021, 0x02 },
+ { 0x00035B6D, 0x00000022, 0x02 },
+ { 0x00035FCD, 0x00000012, 0x00 },
+ { 0x00035EF0, 0x00000020, 0x00 },
+ { 0x00035EF1, 0x00000020, 0x00 },
+ { 0x00035F0A, 0x00000020, 0x00 },
+ { 0x000362B0, 0x00000013, 0x00 },
+ { 0x000362B1, 0x00000013, 0x00 },
+ { 0x000362B2, 0x00000013, 0x00 },
+ { 0x000362B3, 0x00000013, 0x00 },
+ { 0x000362B4, 0x00000013, 0x00 },
+ { 0x000362B5, 0x00000013, 0x00 },
+ { 0x000362B9, 0x00000013, 0x00 },
+ { 0x000362BB, 0x00000013, 0x00 },
+ { 0x000362BA, 0x00000013, 0x00 },
+ { 0x000362BC, 0x00000013, 0x00 },
+ { 0x000362B8, 0x00000013, 0x00 },
+ { 0x000362BD, 0x00000013, 0x00 },
+ { 0x000362BE, 0x00000013, 0x00 },
+ { 0x000362BF, 0x00000013, 0x00 },
+ { 0x000362C0, 0x00000013, 0x00 },
+ { 0x000362C1, 0x00000013, 0x00 },
+ { 0x000362C2, 0x00000013, 0x00 },
+ { 0x000362B6, 0x00000014, 0x00 },
+ { 0x00035F8A, 0x00000015, 0x00 },
+ { 0x00036407, 0x00000016, 0x00 },
+ { 0x0003640C, 0x00000016, 0x00 },
+ { 0x0003641A, 0x00000016, 0x00 },
+ { 0x00036420, 0x00000016, 0x00 },
+ { 0x00036421, 0x00000016, 0x00 },
+ { 0x00036422, 0x00000016, 0x00 },
+ { 0x00036408, 0x00000016, 0x00 },
+ { 0x0003640A, 0x00000016, 0x00 },
+ { 0x0003640B, 0x00000016, 0x00 },
+ { 0x0003640D, 0x00000018, 0x00 },
+ { 0x00036415, 0x00000016, 0x00 },
+ { 0x00036416, 0x00000016, 0x00 },
+ { 0x00036417, 0x00000016, 0x00 },
+ { 0x00036418, 0x00000016, 0x00 },
+ { 0x00036419, 0x00000016, 0x00 },
+ { 0x0003640E, 0x00000016, 0x00 },
+ { 0x0003640F, 0x00000016, 0x00 },
+ { 0x00036410, 0x00000016, 0x00 },
+ { 0x00036411, 0x00000019, 0x00 },
+ { 0x00036412, 0x0000001A, 0x00 },
+ { 0x0003641B, 0x00000016, 0x00 },
+ { 0x0003641C, 0x00000016, 0x00 },
+ { 0x0003641D, 0x00000016, 0x00 },
+ { 0x0003641F, 0x00000016, 0x00 },
+ { 0x00035FF6, 0x0000001B, 0x00 },
+ { 0x00035FF7, 0x0000001C, 0x00 },
+ { 0x00035FF8, 0x0000001D, 0x00 },
+ { 0x00035FF9, 0x0000001E, 0x00 },
+ { 0x0003627F, 0x00000023, 0x00 },
+ { 0x00036280, 0x00000024, 0x00 },
+ { 0x00036281, 0x00000025, 0x00 },
+ { 0x00036282, 0x00000025, 0x00 },
+ { 0x00036457, 0x00000026, 0x00 },
+ { 0x00000000, 0x00000000, 0x00 }
+};
+
+static const UpdateState8 LIFTBOT_STATES[] = {
+ { 0x000335D6, 0x00000004 },
+ { 0x000337A7, 0x00000005 },
+ { 0x00033781, 0x00000006 },
+ { 0x0003381A, 0x00000009 },
+ { 0x0003381B, 0x00000009 },
+ { 0x0003381E, 0x00000009 },
+ { 0x0003381F, 0x00000009 },
+ { 0x00033820, 0x00000009 },
+ { 0x00033821, 0x00000009 },
+ { 0x00033822, 0x00000009 },
+ { 0x00033823, 0x00000009 },
+ { 0x00033824, 0x00000009 },
+ { 0x00033825, 0x00000009 },
+ { 0x0003381C, 0x00000009 },
+ { 0x0003381D, 0x00000009 },
+ { 0x00000000, 0x00000000 }
+};
+
+static const UpdateState8 MAITRED_STATES[] = {
+ { 0x0003F7D4, 0x00000002 },
+ { 0x0003F808, 0x00000003 },
+ { 0x0003F809, 0x00000009 },
+ { 0x0003F7F9, 0x00000009 },
+ { 0x0003F7D2, 0x00000009 },
+ { 0x0003F7F6, 0x00000004 },
+ { 0x0003F7D3, 0x00000005 },
+ { 0x0003F800, 0x00000006 },
+ { 0x0003F801, 0x00000007 },
+ { 0x0003F7FC, 0x00000008 },
+ { 0x0003F7FD, 0x00000008 },
+ { 0x0003F7F8, 0x00000008 },
+ { 0x0003F7FA, 0x00000008 },
+ { 0x0003F7F1, 0x0000000A },
+ { 0x0003F7F2, 0x0000000A },
+ { 0x0003F7F3, 0x0000000A },
+ { 0x0003F7F4, 0x0000000A },
+ { 0x0003F7F5, 0x0000000A },
+ { 0x0003F877, 0x0000000B },
+ { 0x0003FA55, 0x0000000C },
+ { 0x0003F863, 0x0000000C },
+ { 0x0003F864, 0x0000000C },
+ { 0x0003F865, 0x0000000C },
+ { 0x0003F866, 0x0000000D },
+ { 0x0003F867, 0x0000000E },
+ { 0x0003F86E, 0x0000000E },
+ { 0x0003F868, 0x0000000F },
+ { 0x0003F869, 0x0000000C },
+ { 0x0003F870, 0x00000010 },
+ { 0x0003F87C, 0x00000011 },
+ { 0x0003F87D, 0x00000011 },
+ { 0x0003F886, 0x00000012 },
+ { 0x0003F889, 0x00000013 },
+ { 0x0003F88A, 0x00000014 },
+ { 0x0003F88B, 0x00000015 },
+ { 0x0003F88C, 0x00000015 },
+ { 0x0003F88D, 0x00000016 },
+ { 0x0003F88E, 0x00000016 },
+ { 0x0003F895, 0x00000016 },
+ { 0x0003F893, 0x00000017 },
+ { 0x0003F89A, 0x00000018 },
+ { 0x0003F875, 0x00000019 },
+ { 0x0003F89C, 0x00000019 },
+ { 0x0003F8A3, 0x00000019 },
+ { 0x0003F8A2, 0x00000019 },
+ { 0x0003F89D, 0x0000001A },
+ { 0x0003F89E, 0x0000001A },
+ { 0x0003F89F, 0x0000001A },
+ { 0x0003F8A5, 0x0000001B },
+ { 0x0003F921, 0x0000001C },
+ { 0x0003F922, 0x0000001C },
+ { 0x0003FA56, 0x0000001E },
+ { 0x00000000, 0x00000000 }
+};
+
+void writeUpdateStates(const char *name, const UpdateState8 *states) {
+ outputFile.seek(dataOffset);
+
+ for (; states->_src; ++states) {
+ outputFile.writeLong(states->_src);
+ outputFile.writeLong(states->_dest);
+ }
+
+ uint size = outputFile.size() - dataOffset;
+ writeEntryHeader(name, dataOffset, size);
+ dataOffset += size;
+}
+
+void writeUpdateStates(const char *name, const UpdateState12 *states) {
+ outputFile.seek(dataOffset);
+
+ for (; states->_newId; ++states) {
+ outputFile.writeLong(states->_newId);
+ outputFile.writeLong(states->_newValue);
+ outputFile.writeLong(states->_idMatch);
+ }
+
+ uint size = outputFile.size() - dataOffset;
+ writeEntryHeader(name, dataOffset, size);
+ dataOffset += size;
+}
+
+void writeAllUpdateStates() {
+ writeUpdateStates("States/Barbot", BARBOT_STATES);
+ writeUpdateStates("States/Bellbot", BELLBOT_STATES);
+ writeUpdateStates("States/Deskbot", DESKBOT_STATES);
+ writeUpdateStates("States/Doorbot", DOORBOT_STATES);
+ writeUpdateStates("States/Liftbot", LIFTBOT_STATES);
+ writeUpdateStates("States/MaitreD", MAITRED_STATES);
+
+} \ No newline at end of file
diff --git a/devtools/create_titanic/script_states.h b/devtools/create_titanic/script_states.h
new file mode 100644
index 0000000000..27dfe22ed4
--- /dev/null
+++ b/devtools/create_titanic/script_states.h
@@ -0,0 +1,43 @@
+/* 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 COMMON_SCRIPT_STATES_H
+#define COMMON_SCRIPT_STATES_H
+
+#include "common/scummsys.h"
+
+struct UpdateState12 {
+ uint _newId;
+ uint _newValue;
+ uint _idMatch;
+};
+
+struct UpdateState8 {
+ uint _src;
+ uint _dest;
+};
+
+extern void writeAllUpdateStates();
+extern void writeEntryHeader(const char *name, uint offset, uint size);
+extern uint dataOffset;
+
+#endif
diff --git a/devtools/create_titanic/str.cpp b/devtools/create_titanic/str.cpp
new file mode 100644
index 0000000000..6aa66d0d20
--- /dev/null
+++ b/devtools/create_titanic/str.cpp
@@ -0,0 +1,786 @@
+/* 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/hash-str.h"
+#include "common/list.h"
+#include "memorypool.h"
+#include "common/str.h"
+#include "common/util.h"
+
+namespace Common {
+
+MemoryPool *g_refCountPool = 0; // FIXME: This is never freed right now
+
+static uint32 computeCapacity(uint32 len) {
+ // By default, for the capacity we use the next multiple of 32
+ return ((len + 32 - 1) & ~0x1F);
+}
+
+String::String(const char *str) : _size(0), _str(_storage) {
+ if (str == 0) {
+ _storage[0] = 0;
+ _size = 0;
+ } else
+ initWithCStr(str, strlen(str));
+}
+
+String::String(const char *str, uint32 len) : _size(0), _str(_storage) {
+ initWithCStr(str, len);
+}
+
+String::String(const char *beginP, const char *endP) : _size(0), _str(_storage) {
+ assert(endP >= beginP);
+ initWithCStr(beginP, endP - beginP);
+}
+
+void String::initWithCStr(const char *str, uint32 len) {
+ assert(str);
+
+ // Init _storage member explicitly (ie. without calling its constructor)
+ // for GCC 2.95.x compatibility (see also tracker item #1602879).
+ _storage[0] = 0;
+
+ _size = len;
+
+ if (len >= _builtinCapacity) {
+ // Not enough internal storage, so allocate more
+ _extern._capacity = computeCapacity(len+1);
+ _extern._refCount = 0;
+ _str = new char[_extern._capacity];
+ assert(_str != 0);
+ }
+
+ // Copy the string into the storage area
+ memmove(_str, str, len);
+ _str[len] = 0;
+}
+
+String::String(const String &str)
+ : _size(str._size) {
+ if (str.isStorageIntern()) {
+ // String in internal storage: just copy it
+ memcpy(_storage, str._storage, _builtinCapacity);
+ _str = _storage;
+ } else {
+ // String in external storage: use refcount mechanism
+ str.incRefCount();
+ _extern._refCount = str._extern._refCount;
+ _extern._capacity = str._extern._capacity;
+ _str = str._str;
+ }
+ assert(_str != 0);
+}
+
+String::String(char c)
+ : _size(0), _str(_storage) {
+
+ _storage[0] = c;
+ _storage[1] = 0;
+
+ _size = (c == 0) ? 0 : 1;
+}
+
+String::~String() {
+ decRefCount(_extern._refCount);
+}
+
+void String::makeUnique() {
+ ensureCapacity(_size, true);
+}
+
+/**
+ * Ensure that enough storage is available to store at least new_size
+ * characters plus a null byte. In addition, if we currently share
+ * the storage with another string, unshare it, so that we can safely
+ * write to the storage.
+ */
+void String::ensureCapacity(uint32 new_size, bool keep_old) {
+ bool isShared;
+ uint32 curCapacity, newCapacity;
+ char *newStorage;
+ int *oldRefCount = _extern._refCount;
+
+ if (isStorageIntern()) {
+ isShared = false;
+ curCapacity = _builtinCapacity;
+ } else {
+ isShared = (oldRefCount && *oldRefCount > 1);
+ curCapacity = _extern._capacity;
+ }
+
+ // Special case: If there is enough space, and we do not share
+ // the storage, then there is nothing to do.
+ if (!isShared && new_size < curCapacity)
+ return;
+
+ if (isShared && new_size < _builtinCapacity) {
+ // We share the storage, but there is enough internal storage: Use that.
+ newStorage = _storage;
+ newCapacity = _builtinCapacity;
+ } else {
+ // We need to allocate storage on the heap!
+
+ // Compute a suitable new capacity limit
+ // If the current capacity is sufficient we use the same capacity
+ if (new_size < curCapacity)
+ newCapacity = curCapacity;
+ else
+ newCapacity = MAX(curCapacity * 2, computeCapacity(new_size+1));
+
+ // Allocate new storage
+ newStorage = new char[newCapacity];
+ assert(newStorage);
+ }
+
+ // Copy old data if needed, elsewise reset the new storage.
+ if (keep_old) {
+ assert(_size < newCapacity);
+ memcpy(newStorage, _str, _size + 1);
+ } else {
+ _size = 0;
+ newStorage[0] = 0;
+ }
+
+ // Release hold on the old storage ...
+ decRefCount(oldRefCount);
+
+ // ... in favor of the new storage
+ _str = newStorage;
+
+ if (!isStorageIntern()) {
+ // Set the ref count & capacity if we use an external storage.
+ // It is important to do this *after* copying any old content,
+ // else we would override data that has not yet been copied!
+ _extern._refCount = 0;
+ _extern._capacity = newCapacity;
+ }
+}
+
+void String::incRefCount() const {
+ assert(!isStorageIntern());
+ if (_extern._refCount == 0) {
+ if (g_refCountPool == 0) {
+ g_refCountPool = new MemoryPool(sizeof(int));
+ assert(g_refCountPool);
+ }
+
+ _extern._refCount = (int *)g_refCountPool->allocChunk();
+ *_extern._refCount = 2;
+ } else {
+ ++(*_extern._refCount);
+ }
+}
+
+void String::decRefCount(int *oldRefCount) {
+ if (isStorageIntern())
+ return;
+
+ if (oldRefCount) {
+ --(*oldRefCount);
+ }
+ if (!oldRefCount || *oldRefCount <= 0) {
+ // The ref count reached zero, so we free the string storage
+ // and the ref count storage.
+ if (oldRefCount) {
+ assert(g_refCountPool);
+ g_refCountPool->freeChunk(oldRefCount);
+ }
+ delete[] _str;
+
+ // Even though _str points to a freed memory block now,
+ // we do not change its value, because any code that calls
+ // decRefCount will have to do this afterwards anyway.
+ }
+}
+
+String &String::operator=(const char *str) {
+ uint32 len = strlen(str);
+ ensureCapacity(len, false);
+ _size = len;
+ memmove(_str, str, len + 1);
+ return *this;
+}
+
+String &String::operator=(const String &str) {
+ if (&str == this)
+ return *this;
+
+ if (str.isStorageIntern()) {
+ decRefCount(_extern._refCount);
+ _size = str._size;
+ _str = _storage;
+ memcpy(_str, str._str, _size + 1);
+ } else {
+ str.incRefCount();
+ decRefCount(_extern._refCount);
+
+ _extern._refCount = str._extern._refCount;
+ _extern._capacity = str._extern._capacity;
+ _size = str._size;
+ _str = str._str;
+ }
+
+ return *this;
+}
+
+String &String::operator=(char c) {
+ decRefCount(_extern._refCount);
+ _str = _storage;
+
+ _str[0] = c;
+ _str[1] = 0;
+
+ _size = (c == 0) ? 0 : 1;
+ return *this;
+}
+
+String &String::operator+=(const char *str) {
+ if (_str <= str && str <= _str + _size)
+ return operator+=(String(str));
+
+ int len = strlen(str);
+ if (len > 0) {
+ ensureCapacity(_size + len, true);
+
+ memcpy(_str + _size, str, len + 1);
+ _size += len;
+ }
+ return *this;
+}
+
+String &String::operator+=(const String &str) {
+ if (&str == this)
+ return operator+=(String(str));
+
+ int len = str._size;
+ if (len > 0) {
+ ensureCapacity(_size + len, true);
+
+ memcpy(_str + _size, str._str, len + 1);
+ _size += len;
+ }
+ return *this;
+}
+
+String &String::operator+=(char c) {
+ ensureCapacity(_size + 1, true);
+
+ _str[_size++] = c;
+ _str[_size] = 0;
+
+ return *this;
+}
+
+bool String::hasPrefix(const String &x) const {
+ return hasPrefix(x.c_str());
+}
+
+bool String::hasPrefix(const char *x) const {
+ assert(x != 0);
+ // Compare x with the start of _str.
+ const char *y = c_str();
+ while (*x && *x == *y) {
+ ++x;
+ ++y;
+ }
+ // It's a prefix, if and only if all letters in x are 'used up' before
+ // _str ends.
+ return *x == 0;
+}
+
+bool String::hasSuffix(const String &x) const {
+ return hasSuffix(x.c_str());
+}
+
+bool String::hasSuffix(const char *x) const {
+ assert(x != 0);
+ // Compare x with the end of _str.
+ const uint32 x_size = strlen(x);
+ if (x_size > _size)
+ return false;
+ const char *y = c_str() + _size - x_size;
+ while (*x && *x == *y) {
+ ++x;
+ ++y;
+ }
+ // It's a suffix, if and only if all letters in x are 'used up' before
+ // _str ends.
+ return *x == 0;
+}
+
+bool String::contains(const String &x) const {
+ return strstr(c_str(), x.c_str()) != NULL;
+}
+
+bool String::contains(const char *x) const {
+ assert(x != 0);
+ return strstr(c_str(), x) != NULL;
+}
+
+bool String::contains(char x) const {
+ return strchr(c_str(), x) != NULL;
+}
+
+void String::deleteLastChar() {
+ if (_size > 0)
+ deleteChar(_size - 1);
+}
+
+void String::deleteChar(uint32 p) {
+ assert(p < _size);
+
+ makeUnique();
+ while (p++ < _size)
+ _str[p - 1] = _str[p];
+ _size--;
+}
+
+void String::erase(uint32 p, uint32 len) {
+ assert(p < _size);
+
+ makeUnique();
+ // If len == npos or p + len is over the end, remove all the way to the end
+ if (len == npos || p + len >= _size) {
+ // Delete char at p as well. So _size = (p - 1) + 1
+ _size = p;
+ // Null terminate
+ _str[_size] = 0;
+ return;
+ }
+
+ for ( ; p + len <= _size; p++) {
+ _str[p] = _str[p + len];
+ }
+ _size -= len;
+}
+
+void String::clear() {
+ decRefCount(_extern._refCount);
+
+ _size = 0;
+ _str = _storage;
+ _storage[0] = 0;
+}
+
+void String::setChar(char c, uint32 p) {
+ assert(p < _size);
+
+ makeUnique();
+ _str[p] = c;
+}
+
+void String::insertChar(char c, uint32 p) {
+ assert(p <= _size);
+
+ ensureCapacity(_size + 1, true);
+ _size++;
+ for (uint32 i = _size; i > p; --i)
+ _str[i] = _str[i - 1];
+ _str[p] = c;
+}
+
+void String::toLowercase() {
+ makeUnique();
+ for (uint32 i = 0; i < _size; ++i)
+ _str[i] = tolower(_str[i]);
+}
+
+void String::toUppercase() {
+ makeUnique();
+ for (uint32 i = 0; i < _size; ++i)
+ _str[i] = toupper(_str[i]);
+}
+
+uint String::hash() const {
+ return hashit(c_str());
+}
+
+// static
+String String::format(const char *fmt, ...) {
+ String output;
+
+ va_list va;
+ va_start(va, fmt);
+ output = String::vformat(fmt, va);
+ va_end(va);
+
+ return output;
+}
+
+// static
+String String::vformat(const char *fmt, va_list args) {
+ String output;
+ assert(output.isStorageIntern());
+
+ va_list va;
+ scumm_va_copy(va, args);
+ int len = vsnprintf(output._str, _builtinCapacity, fmt, va);
+ va_end(va);
+
+ if (len == -1 || len == _builtinCapacity - 1) {
+ // MSVC and IRIX don't return the size the full string would take up.
+ // MSVC returns -1, IRIX returns the number of characters actually written,
+ // which is at the most the size of the buffer minus one, as the string is
+ // truncated to fit.
+
+ // We assume MSVC failed to output the correct, null-terminated string
+ // if the return value is either -1 or size.
+ // For IRIX, because we lack a better mechanism, we assume failure
+ // if the return value equals size - 1.
+ // The downside to this is that whenever we try to format a string where the
+ // size is 1 below the built-in capacity, the size is needlessly increased.
+
+ // Try increasing the size of the string until it fits.
+ int size = _builtinCapacity;
+ do {
+ size *= 2;
+ output.ensureCapacity(size - 1, false);
+ assert(!output.isStorageIntern());
+ size = output._extern._capacity;
+
+ scumm_va_copy(va, args);
+ len = vsnprintf(output._str, size, fmt, va);
+ va_end(va);
+ } while (len == -1 || len >= size - 1);
+ output._size = len;
+ } else if (len < (int)_builtinCapacity) {
+ // vsnprintf succeeded
+ output._size = len;
+ } else {
+ // vsnprintf didn't have enough space, so grow buffer
+ output.ensureCapacity(len, false);
+ scumm_va_copy(va, args);
+ int len2 = vsnprintf(output._str, len+1, fmt, va);
+ va_end(va);
+ assert(len == len2);
+ output._size = len2;
+ }
+
+ return output;
+}
+
+
+#pragma mark -
+
+bool String::operator==(const String &x) const {
+ return equals(x);
+}
+
+bool String::operator==(const char *x) const {
+ assert(x != 0);
+ return equals(x);
+}
+
+bool String::operator!=(const String &x) const {
+ return !equals(x);
+}
+
+bool String::operator !=(const char *x) const {
+ assert(x != 0);
+ return !equals(x);
+}
+
+bool String::operator<(const String &x) const {
+ return compareTo(x) < 0;
+}
+
+bool String::operator<=(const String &x) const {
+ return compareTo(x) <= 0;
+}
+
+bool String::operator>(const String &x) const {
+ return compareTo(x) > 0;
+}
+
+bool String::operator>=(const String &x) const {
+ return compareTo(x) >= 0;
+}
+
+#pragma mark -
+
+bool operator==(const char* y, const String &x) {
+ return (x == y);
+}
+
+bool operator!=(const char* y, const String &x) {
+ return x != y;
+}
+
+#pragma mark -
+
+bool String::equals(const String &x) const {
+ return (0 == compareTo(x));
+}
+
+bool String::equals(const char *x) const {
+ assert(x != 0);
+ return (0 == compareTo(x));
+}
+
+bool String::equalsIgnoreCase(const String &x) const {
+ return (0 == compareToIgnoreCase(x));
+}
+
+bool String::equalsIgnoreCase(const char *x) const {
+ assert(x != 0);
+ return (0 == compareToIgnoreCase(x));
+}
+
+int String::compareTo(const String &x) const {
+ return compareTo(x.c_str());
+}
+
+int String::compareTo(const char *x) const {
+ assert(x != 0);
+ return strcmp(c_str(), x);
+}
+
+int String::compareToIgnoreCase(const String &x) const {
+ return compareToIgnoreCase(x.c_str());
+}
+
+int String::compareToIgnoreCase(const char *x) const {
+ assert(x != 0);
+ return scumm_stricmp(c_str(), x);
+}
+
+#pragma mark -
+
+String operator+(const String &x, const String &y) {
+ String temp(x);
+ temp += y;
+ return temp;
+}
+
+String operator+(const char *x, const String &y) {
+ String temp(x);
+ temp += y;
+ return temp;
+}
+
+String operator+(const String &x, const char *y) {
+ String temp(x);
+ temp += y;
+ return temp;
+}
+
+String operator+(char x, const String &y) {
+ String temp(x);
+ temp += y;
+ return temp;
+}
+
+String operator+(const String &x, char y) {
+ String temp(x);
+ temp += y;
+ return temp;
+}
+
+String lastPathComponent(const String &path, const char sep) {
+ const char *str = path.c_str();
+ const char *last = str + path.size();
+
+ // Skip over trailing slashes
+ while (last > str && *(last-1) == sep)
+ --last;
+
+ // Path consisted of only slashes -> return empty string
+ if (last == str)
+ return String();
+
+ // Now scan the whole component
+ const char *first = last - 1;
+ while (first > str && *first != sep)
+ --first;
+
+ if (*first == sep)
+ first++;
+
+ return String(first, last);
+}
+
+String normalizePath(const String &path, const char sep) {
+ if (path.empty())
+ return path;
+
+ const char *cur = path.c_str();
+ String result;
+
+ // If there is a leading slash, preserve that:
+ if (*cur == sep) {
+ result += sep;
+ // Skip over multiple leading slashes, so "//" equals "/"
+ while (*cur == sep)
+ ++cur;
+ }
+
+ // Scan for path components till the end of the String
+ List<String> comps;
+ while (*cur != 0) {
+ const char *start = cur;
+
+ // Scan till the next path separator resp. the end of the string
+ while (*cur != sep && *cur != 0)
+ cur++;
+
+ const String component(start, cur);
+
+ if (component.empty() || component == ".") {
+ // Skip empty components and dot components
+ } else if (!comps.empty() && component == ".." && comps.back() != "..") {
+ // If stack is non-empty and top is not "..", remove top
+ comps.pop_back();
+ } else {
+ // Add the component to the stack
+ comps.push_back(component);
+ }
+
+ // Skip over separator chars
+ while (*cur == sep)
+ cur++;
+ }
+
+ // Finally, assemble all components back into a path
+ while (!comps.empty()) {
+ result += comps.front();
+ comps.pop_front();
+ if (!comps.empty())
+ result += sep;
+ }
+
+ return result;
+}
+
+size_t strlcpy(char *dst, const char *src, size_t size) {
+ // Our backup of the source's start, we need this
+ // to calculate the source's length.
+ const char * const srcStart = src;
+
+ // In case a non-empty size was specified we
+ // copy over (size - 1) bytes at max.
+ if (size != 0) {
+ // Copy over (size - 1) bytes at max.
+ while (--size != 0) {
+ if ((*dst++ = *src) == 0)
+ break;
+ ++src;
+ }
+
+ // In case the source string was longer than the
+ // destination, we need to add a terminating
+ // zero.
+ if (size == 0)
+ *dst = 0;
+ }
+
+ // Move to the terminating zero of the source
+ // string, we need this to determine the length
+ // of the source string.
+ while (*src)
+ ++src;
+
+ // Return the source string's length.
+ return src - srcStart;
+}
+
+size_t strlcat(char *dst, const char *src, size_t size) {
+ // In case the destination buffer does not contain
+ // space for at least 1 character, we will just
+ // return the source string's length.
+ if (size == 0)
+ return strlen(src);
+
+ // Our backup of the source's start, we need this
+ // to calculate the source's length.
+ const char * const srcStart = src;
+
+ // Our backup of the destination's start, we need
+ // this to calculate the destination's length.
+ const char * const dstStart = dst;
+
+ // Search the end of the destination, but do not
+ // move past the terminating zero.
+ while (size-- != 0 && *dst != 0)
+ ++dst;
+
+ // Calculate the destination's length;
+ const size_t dstLength = dst - dstStart;
+
+ // In case we reached the end of the destination
+ // buffer before we had a chance to append any
+ // characters we will just return the destination
+ // length plus the source string's length.
+ if (size == 0)
+ return dstLength + strlen(srcStart);
+
+ // Copy over all of the source that fits
+ // the destination buffer. We also need
+ // to take the terminating zero we will
+ // add into consideration.
+ while (size-- != 0 && *src != 0)
+ *dst++ = *src++;
+ *dst = 0;
+
+ // Move to the terminating zero of the source
+ // string, we need this to determine the length
+ // of the source string.
+ while (*src)
+ ++src;
+
+ // Return the total length of the result string
+ return dstLength + (src - srcStart);
+}
+
+} // End of namespace Common
+
+// Portable implementation of stricmp / strcasecmp / strcmpi.
+// TODO: Rename this to Common::strcasecmp
+int scumm_stricmp(const char *s1, const char *s2) {
+ byte l1, l2;
+ do {
+ // Don't use ++ inside tolower, in case the macro uses its
+ // arguments more than once.
+ l1 = (byte)*s1++;
+ l1 = tolower(l1);
+ l2 = (byte)*s2++;
+ l2 = tolower(l2);
+ } while (l1 == l2 && l1 != 0);
+ return l1 - l2;
+}
+
+// Portable implementation of strnicmp / strncasecmp / strncmpi.
+// TODO: Rename this to Common::strncasecmp
+int scumm_strnicmp(const char *s1, const char *s2, uint n) {
+ byte l1, l2;
+ do {
+ if (n-- == 0)
+ return 0; // no difference found so far -> signal equality
+
+ // Don't use ++ inside tolower, in case the macro uses its
+ // arguments more than once.
+ l1 = (byte)*s1++;
+ l1 = tolower(l1);
+ l2 = (byte)*s2++;
+ l2 = tolower(l2);
+ } while (l1 == l2 && l1 != 0);
+ return l1 - l2;
+}
diff --git a/devtools/create_titanic/str.h b/devtools/create_titanic/str.h
new file mode 100644
index 0000000000..2f954dcfca
--- /dev/null
+++ b/devtools/create_titanic/str.h
@@ -0,0 +1,386 @@
+/* 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 COMMON_STRING_H
+#define COMMON_STRING_H
+
+#include "common/scummsys.h"
+
+#include <stdarg.h>
+
+namespace Common {
+
+/**
+ * Simple string class for ScummVM. Provides automatic storage managment,
+ * and overloads several operators in a 'natural' fashion, mimicking
+ * the std::string class. Even provides simple iterators.
+ *
+ * This class tries to avoid allocating lots of small blocks on the heap,
+ * since that is inefficient on several platforms supported by ScummVM.
+ * Instead, small strings are stored 'inside' the string object (i.e. on
+ * the stack, for stack allocated objects), and only for strings exceeding
+ * a certain length do we allocate a buffer on the heap.
+ *
+ * The presence of \0 characters in the string will cause undefined
+ * behavior in some operations.
+ */
+class String {
+public:
+ static const uint32 npos = 0xFFFFFFFF;
+protected:
+ /**
+ * The size of the internal storage. Increasing this means less heap
+ * allocations are needed, at the cost of more stack memory usage,
+ * and of course lots of wasted memory. Empirically, 90% or more of
+ * all String instances are less than 32 chars long. If a platform
+ * is very short on stack space, it would be possible to lower this.
+ * A value of 24 still seems acceptable, though considerably worse,
+ * while 16 seems to be the lowest you want to go... Anything lower
+ * than 8 makes no sense, since that's the size of member _extern
+ * (on 32 bit machines; 12 bytes on systems with 64bit pointers).
+ */
+ static const uint32 _builtinCapacity = 32 - sizeof(uint32) - sizeof(char *);
+
+ /**
+ * Length of the string. Stored to avoid having to call strlen
+ * a lot. Yes, we limit ourselves to strings shorter than 4GB --
+ * on purpose :-).
+ */
+ uint32 _size;
+
+ /**
+ * Pointer to the actual string storage. Either points to _storage,
+ * or to a block allocated on the heap via malloc.
+ */
+ char *_str;
+
+
+ union {
+ /**
+ * Internal string storage.
+ */
+ char _storage[_builtinCapacity];
+ /**
+ * External string storage data -- the refcounter, and the
+ * capacity of the string _str points to.
+ */
+ struct {
+ mutable int *_refCount;
+ uint32 _capacity;
+ } _extern;
+ };
+
+ inline bool isStorageIntern() const {
+ return _str == _storage;
+ }
+
+public:
+ /** Construct a new empty string. */
+ String() : _size(0), _str(_storage) { _storage[0] = 0; }
+
+ /** Construct a new string from the given NULL-terminated C string. */
+ String(const char *str);
+
+ /** Construct a new string containing exactly len characters read from address str. */
+ String(const char *str, uint32 len);
+
+ /** Construct a new string containing the characters between beginP (including) and endP (excluding). */
+ String(const char *beginP, const char *endP);
+
+ /** Construct a copy of the given string. */
+ String(const String &str);
+
+ /** Construct a string consisting of the given character. */
+ explicit String(char c);
+
+ ~String();
+
+ String &operator=(const char *str);
+ String &operator=(const String &str);
+ String &operator=(char c);
+ String &operator+=(const char *str);
+ String &operator+=(const String &str);
+ String &operator+=(char c);
+
+ bool operator==(const String &x) const;
+ bool operator==(const char *x) const;
+ bool operator!=(const String &x) const;
+ bool operator!=(const char *x) const;
+
+ bool operator<(const String &x) const;
+ bool operator<=(const String &x) const;
+ bool operator>(const String &x) const;
+ bool operator>=(const String &x) const;
+
+ bool equals(const String &x) const;
+ bool equalsIgnoreCase(const String &x) const;
+ int compareTo(const String &x) const; // strcmp clone
+ int compareToIgnoreCase(const String &x) const; // stricmp clone
+
+ bool equals(const char *x) const;
+ bool equalsIgnoreCase(const char *x) const;
+ int compareTo(const char *x) const; // strcmp clone
+ int compareToIgnoreCase(const char *x) const; // stricmp clone
+
+ bool hasSuffix(const String &x) const;
+ bool hasSuffix(const char *x) const;
+
+ bool hasPrefix(const String &x) const;
+ bool hasPrefix(const char *x) const;
+
+ bool contains(const String &x) const;
+ bool contains(const char *x) const;
+ bool contains(char x) const;
+
+ inline const char *c_str() const { return _str; }
+ inline uint size() const { return _size; }
+
+ inline bool empty() const { return (_size == 0); }
+ char firstChar() const { return (_size > 0) ? _str[0] : 0; }
+ char lastChar() const { return (_size > 0) ? _str[_size - 1] : 0; }
+
+ char operator[](int idx) const {
+ assert(_str && idx >= 0 && idx < (int)_size);
+ return _str[idx];
+ }
+
+ /** Remove the last character from the string. */
+ void deleteLastChar();
+
+ /** Remove the character at position p from the string. */
+ void deleteChar(uint32 p);
+
+ /** Remove all characters from position p to the p + len. If len = String::npos, removes all characters to the end */
+ void erase(uint32 p, uint32 len = npos);
+
+ /** Set character c at position p, replacing the previous character there. */
+ void setChar(char c, uint32 p);
+
+ /** Insert character c before position p. */
+ void insertChar(char c, uint32 p);
+
+ /** Clears the string, making it empty. */
+ void clear();
+
+ /** Convert all characters in the string to lowercase. */
+ void toLowercase();
+
+ /** Convert all characters in the string to uppercase. */
+ void toUppercase();
+
+ /**
+ * Removes trailing and leading whitespaces. Uses isspace() to decide
+ * what is whitespace and what not.
+ */
+ void trim();
+
+ uint hash() const;
+
+ /**
+ * Print formatted data into a String object. Similar to sprintf,
+ * except that it stores the result in (variably sized) String
+ * instead of a fixed size buffer.
+ */
+ static String format(const char *fmt, ...) GCC_PRINTF(1,2);
+
+ /**
+ * Print formatted data into a String object. Similar to vsprintf,
+ * except that it stores the result in (variably sized) String
+ * instead of a fixed size buffer.
+ */
+ static String vformat(const char *fmt, va_list args);
+
+public:
+ typedef char value_type;
+ /**
+ * Unsigned version of the underlying type. This can be used to cast
+ * individual string characters to bigger integer types without sign
+ * extension happening.
+ */
+ typedef unsigned char unsigned_type;
+ typedef char * iterator;
+ typedef const char * const_iterator;
+
+ iterator begin() {
+ // Since the user could potentially
+ // change the string via the returned
+ // iterator we have to assure we are
+ // pointing to a unique storage.
+ makeUnique();
+
+ return _str;
+ }
+
+ iterator end() {
+ return begin() + size();
+ }
+
+ const_iterator begin() const {
+ return _str;
+ }
+
+ const_iterator end() const {
+ return begin() + size();
+ }
+
+protected:
+ void makeUnique();
+ void ensureCapacity(uint32 new_size, bool keep_old);
+ void incRefCount() const;
+ void decRefCount(int *oldRefCount);
+ void initWithCStr(const char *str, uint32 len);
+};
+
+// Append two strings to form a new (temp) string
+String operator+(const String &x, const String &y);
+
+String operator+(const char *x, const String &y);
+String operator+(const String &x, const char *y);
+
+String operator+(const String &x, char y);
+String operator+(char x, const String &y);
+
+// Some useful additional comparison operators for Strings
+bool operator==(const char *x, const String &y);
+bool operator!=(const char *x, const String &y);
+
+// Utility functions to remove leading and trailing whitespaces
+extern char *ltrim(char *t);
+extern char *rtrim(char *t);
+extern char *trim(char *t);
+
+
+/**
+ * Returns the last component of a given path.
+ *
+ * Examples:
+ * /foo/bar.txt would return 'bar.txt'
+ * /foo/bar/ would return 'bar'
+ * /foo/./bar// would return 'bar'
+ *
+ * @param path the path of which we want to know the last component
+ * @param sep character used to separate path components
+ * @return The last component of the path.
+ */
+String lastPathComponent(const String &path, const char sep);
+
+/**
+ * Normalize a given path to a canonical form. In particular:
+ * - trailing separators are removed: /foo/bar/ -> /foo/bar
+ * - double separators (= empty components) are removed: /foo//bar -> /foo/bar
+ * - dot components are removed: /foo/./bar -> /foo/bar
+ *
+ * @todo remove double dot components: /foo/baz/../bar -> /foo/bar
+ *
+ * @param path the path to normalize
+ * @param sep the separator token (usually '/' on Unix-style systems, or '\\' on Windows based stuff)
+ * @return the normalized path
+ */
+String normalizePath(const String &path, const char sep);
+
+
+/**
+ * Simple DOS-style pattern matching function (understands * and ? like used in DOS).
+ * Taken from exult/files/listfiles.cc
+ *
+ * Token meaning:
+ * "*": any character, any amount of times.
+ * "?": any character, only once.
+ * "#": any decimal digit, only once.
+ *
+ * Example strings/patterns:
+ * String: monkey.s01 Pattern: monkey.s?? => true
+ * String: monkey.s101 Pattern: monkey.s?? => false
+ * String: monkey.s99 Pattern: monkey.s?1 => false
+ * String: monkey.s101 Pattern: monkey.s* => true
+ * String: monkey.s99 Pattern: monkey.s*1 => false
+ * String: monkey.s01 Pattern: monkey.s## => true
+ * String: monkey.s01 Pattern: monkey.### => false
+ *
+ * @param str Text to be matched against the given pattern.
+ * @param pat Glob pattern.
+ * @param ignoreCase Whether to ignore the case when doing pattern match
+ * @param pathMode Whether to use path mode, i.e., whether slashes must be matched explicitly.
+ *
+ * @return true if str matches the pattern, false otherwise.
+ */
+bool matchString(const char *str, const char *pat, bool ignoreCase = false, bool pathMode = false);
+
+
+/**
+ * Take a 32 bit value and turn it into a four character string, where each of
+ * the four bytes is turned into one character. Most significant byte is printed
+ * first.
+ */
+String tag2string(uint32 tag);
+
+/**
+ * Copy up to size - 1 characters from src to dst and also zero terminate the
+ * result. Note that src must be a zero terminated string.
+ *
+ * In case size is zero this function just returns the length of the source
+ * string.
+ *
+ * @note This is modeled after OpenBSD's strlcpy. See the manpage here:
+ * http://www.openbsd.org/cgi-bin/man.cgi?query=strlcpy
+ *
+ * @param dst The destination buffer.
+ * @param src The source string.
+ * @param size The size of the destination buffer.
+ * @return The length of the (non-truncated) result, i.e. strlen(src).
+ */
+size_t strlcpy(char *dst, const char *src, size_t size);
+
+/**
+ * Append the string src to the string dst. Note that both src and dst must be
+ * zero terminated. The result will be zero terminated. At most
+ * "size - strlen(dst) - 1" bytes will be appended.
+ *
+ * In case the dst string does not contain a zero within the first "size" bytes
+ * the dst string will not be changed and size + strlen(src) is returned.
+ *
+ * @note This is modeled after OpenBSD's strlcat. See the manpage here:
+ * http://www.openbsd.org/cgi-bin/man.cgi?query=strlcat
+ *
+ * @param dst The string the source string should be appended to.
+ * @param src The source string.
+ * @param size The (total) size of the destination buffer.
+ * @return The length of the (non-truncated) result. That is
+ * strlen(dst) + strlen(src). In case strlen(dst) > size
+ * size + strlen(src) is returned.
+ */
+size_t strlcat(char *dst, const char *src, size_t size);
+
+/**
+ * Convenience wrapper for tag2string which "returns" a C string.
+ * Note: It is *NOT* safe to do anything with the return value other than directly
+ * copying or printing it.
+ */
+#define tag2str(x) Common::tag2string(x).c_str()
+
+
+} // End of namespace Common
+
+extern int scumm_stricmp(const char *s1, const char *s2);
+extern int scumm_strnicmp(const char *s1, const char *s2, uint n);
+
+#endif
diff --git a/devtools/create_titanic/tag_maps.cpp b/devtools/create_titanic/tag_maps.cpp
new file mode 100644
index 0000000000..d3640f8404
--- /dev/null
+++ b/devtools/create_titanic/tag_maps.cpp
@@ -0,0 +1,391 @@
+/* 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.
+ *
+ */
+
+ // Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+// HACK to allow building with the SDL backend on MinGW
+// see bug #1800764 "TOOLS: MinGW tools building broken"
+#ifdef main
+#undef main
+#endif // main
+
+#include "file.h"
+#include "tag_maps.h"
+
+#define BARBOT_COUNT 250
+static const TagMapping BARBOT_MAP[250] = {
+ { 0x46cd0, 0x3d21e }, { 0x46ce2, 0x3d23b }, { 0x46ced, 0x3d246 },
+ { 0x46cf8, 0x3d251 }, { 0x46d03, 0x3d25c }, { 0x46d0e, 0x3d267 },
+ { 0x46d19, 0x3d272 }, { 0x46d24, 0x3d27d }, { 0x46d2f, 0x3d288 },
+ { 0x46cd1, 0x3d21f }, { 0x46cd9, 0x3d22a }, { 0x46cda, 0x3d233 },
+ { 0x46cdb, 0x3d234 }, { 0x46cdc, 0x3d235 }, { 0x46cdd, 0x3d236 },
+ { 0x46cde, 0x3d237 }, { 0x46cdf, 0x3d238 }, { 0x46ce0, 0x3d239 },
+ { 0x46ce1, 0x3d23a }, { 0x46ce3, 0x3d23c }, { 0x46ce4, 0x3d23d },
+ { 0x46ce5, 0x3d23e }, { 0x46ce6, 0x3d23f }, { 0x46ce7, 0x3d240 },
+ { 0x46ce8, 0x3d241 }, { 0x46ce9, 0x3d242 }, { 0x46cea, 0x3d243 },
+ { 0x46ceb, 0x3d244 }, { 0x46cec, 0x3d245 }, { 0x46cee, 0x3d26b },
+ { 0x46cef, 0x3d247 }, { 0x46cf0, 0x3d248 }, { 0x46cf1, 0x3d249 },
+ { 0x46cf2, 0x3d24a }, { 0x46cf3, 0x3d24b }, { 0x46cf4, 0x3d24c },
+ { 0x46cf5, 0x3d24d }, { 0x46cf6, 0x3d24e }, { 0x46cf7, 0x3d24f },
+ { 0x46cf9, 0x3d250 }, { 0x46cfa, 0x3d252 }, { 0x46cfb, 0x3d253 },
+ { 0x46cfc, 0x3d254 }, { 0x46cfd, 0x3d255 }, { 0x46cfe, 0x3d256 },
+ { 0x46cff, 0x3d257 }, { 0x46d00, 0x3d258 }, { 0x46d01, 0x3d259 },
+ { 0x46d02, 0x3d25a }, { 0x46d04, 0x3d25b }, { 0x46d05, 0x3d25d },
+ { 0x46d06, 0x3d25e }, { 0x46d07, 0x3d25f }, { 0x46d08, 0x3d260 },
+ { 0x46d09, 0x3d26f }, { 0x46d0a, 0x3d270 }, { 0x46d0b, 0x3d271 },
+ { 0x46d0c, 0x3d273 }, { 0x46d0d, 0x3d274 }, { 0x46d0f, 0x3d275 },
+ { 0x46d10, 0x3d276 }, { 0x46d11, 0x3d277 }, { 0x46d12, 0x3d278 },
+ { 0x46d13, 0x3d279 }, { 0x46d14, 0x3d27a }, { 0x46d15, 0x3d27b },
+ { 0x46d16, 0x3d27c }, { 0x46d17, 0x3d27e }, { 0x46d18, 0x3d27f },
+ { 0x46d1a, 0x3d280 }, { 0x46d1b, 0x3d281 }, { 0x46d1c, 0x3d282 },
+ { 0x46d1d, 0x3d283 }, { 0x46d1e, 0x3d284 }, { 0x46d1f, 0x3d285 },
+ { 0x46d20, 0x3d286 }, { 0x46d21, 0x3d287 }, { 0x46d22, 0x3d289 },
+ { 0x46d23, 0x3d28a }, { 0x46d25, 0x3d28b }, { 0x46d26, 0x3d28c },
+ { 0x46d27, 0x3d28d }, { 0x46d28, 0x3d28e }, { 0x46d29, 0x3d28f },
+ { 0x46d2a, 0x3d290 }, { 0x46d2b, 0x3d291 }, { 0x46d2c, 0x3d292 },
+ { 0x46d2d, 0x3d220 }, { 0x46d2e, 0x3d221 }, { 0x46d30, 0x3d222 },
+ { 0x46d31, 0x3d223 }, { 0x46d32, 0x3d224 }, { 0x46d33, 0x3d225 },
+ { 0x46d34, 0x3d226 }, { 0x46d35, 0x3d227 }, { 0x46d36, 0x3d228 },
+ { 0x46d37, 0x3d229 }, { 0x46d38, 0x3d22b }, { 0x46d39, 0x3d22c },
+ { 0x46cd2, 0x3d22d }, { 0x46cd3, 0x3d22e }, { 0x46cd5, 0x3d22f },
+ { 0x46cd6, 0x3d230 }, { 0x46cd7, 0x3d231 }, { 0x46cd8, 0x3d232 },
+ { 0x46d3a, 0x3d768 }, { 0x46d3b, 0x3d372 }, { 0x46d47, 0x3d43c },
+ { 0x46d48, 0x3d7ce }, { 0x46d49, 0x3d7cf }, { 0x46d4a, 0x3d6f1 },
+ { 0x46d4b, 0x3d77c }, { 0x46d4c, 0x3d49d }, { 0x46d4d, 0x3d77c },
+ { 0x46d4e, 0x3d0b5 }, { 0x46d4f, 0x3d177 }, { 0x46d50, 0x3d2d7 },
+ { 0x46d51, 0x3d77c }, { 0x46d52, 0x3d77c }, { 0x46d53, 0x3d30b },
+ { 0x46d55, 0x3d706 }, { 0x46d56, 0x3d704 }, { 0x46d57, 0x3d77c },
+ { 0x46d54, 0x3d0a0 }, { 0x46d58, 0x3d722 }, { 0x46d5a, 0x3d44a },
+ { 0x46d5b, 0x3d452 }, { 0x46d5c, 0x3d469 }, { 0x46d5d, 0x3d475 },
+ { 0x46d5e, 0x3d476 }, { 0x46d5f, 0x3d477 }, { 0x46d60, 0x3d478 },
+ { 0x46d61, 0x3d479 }, { 0x46d62, 0x3d47a }, { 0x46d63, 0x3d44b },
+ { 0x46d64, 0x3d44c }, { 0x46d65, 0x3d44d }, { 0x46d66, 0x3d44e },
+ { 0x46d67, 0x3d44f }, { 0x46d68, 0x3d450 }, { 0x46d69, 0x3d451 },
+ { 0x46d6a, 0x3d453 }, { 0x46d6b, 0x3d460 }, { 0x46d6c, 0x3d462 },
+ { 0x46d6d, 0x3d463 }, { 0x46d6e, 0x3d464 }, { 0x46d6f, 0x3d465 },
+ { 0x46d70, 0x3d466 }, { 0x46d71, 0x3d467 }, { 0x46d72, 0x3d468 },
+ { 0x46d73, 0x3d454 }, { 0x46d74, 0x3d455 }, { 0x46d75, 0x3d456 },
+ { 0x46d76, 0x3d457 }, { 0x46d77, 0x3d458 }, { 0x46d78, 0x3d459 },
+ { 0x46d79, 0x3d45a }, { 0x46d7a, 0x3d45b }, { 0x46d7b, 0x3d45c },
+ { 0x46d7c, 0x3d45f }, { 0x46d7d, 0x3d461 }, { 0x46d7e, 0x3d46a },
+ { 0x46d7f, 0x3d46d }, { 0x46d80, 0x3d46e }, { 0x46d81, 0x3d46f },
+ { 0x46d82, 0x3d470 }, { 0x46d83, 0x3d471 }, { 0x46d84, 0x3d472 },
+ { 0x46d85, 0x3d473 }, { 0x46d86, 0x3d474 }, { 0x46d87, 0x3d46b },
+ { 0x46d88, 0x3d75d }, { 0x46d89, 0x3d75e }, { 0x46d8a, 0x3d75f },
+ { 0x46d8b, 0x3d760 }, { 0x46d8c, 0x3d761 }, { 0x46d8d, 0x3d762 },
+ { 0x46d8e, 0x3d763 }, { 0x46d8f, 0x3d766 }, { 0x46d90, 0x3d767 },
+ { 0x46d91, 0x3d77c }, { 0x46d92, 0x3d768 }, { 0x46d93, 0x3d765 },
+ { 0x46d94, 0x3d769 }, { 0x46d95, 0x3d770 }, { 0x46d96, 0x3d775 },
+ { 0x46d97, 0x3d776 }, { 0x46d98, 0x3d777 }, { 0x46d99, 0x3d778 },
+ { 0x46d9a, 0x3d779 }, { 0x46d9b, 0x3d77a }, { 0x46d9c, 0x3d77b },
+ { 0x46d9d, 0x3d764 }, { 0x46d9e, 0x3d739 }, { 0x46d9f, 0x3d73a },
+ { 0x46da0, 0x3d73b }, { 0x46da1, 0x3d73c }, { 0x46da2, 0x3d73d },
+ { 0x46da3, 0x3d73e }, { 0x46da4, 0x3d742 }, { 0x46da5, 0x3d744 },
+ { 0x46da6, 0x3d743 }, { 0x46da7, 0x3d745 }, { 0x46da8, 0x3d741 },
+ { 0x46da9, 0x3d746 }, { 0x46daa, 0x3d747 }, { 0x46dab, 0x3d748 },
+ { 0x46dac, 0x3d749 }, { 0x46dad, 0x3d74a }, { 0x46dae, 0x3d74b },
+ { 0x46daf, 0x3d73f }, { 0x46db0, 0x3d771 }, { 0x46db1, 0x3d74c },
+ { 0x46db2, 0x3d74d }, { 0x46db3, 0x3d74e }, { 0x46db4, 0x3d74f },
+ { 0x46db5, 0x3d750 }, { 0x46db6, 0x3d751 }, { 0x46db7, 0x3d753 },
+ { 0x46db8, 0x3d755 }, { 0x46db9, 0x3d754 }, { 0x46dba, 0x3d756 },
+ { 0x46dbb, 0x3d752 }, { 0x46dbc, 0x3d757 }, { 0x46dbd, 0x3d758 },
+ { 0x46dbe, 0x3d759 }, { 0x46dbf, 0x3d75a }, { 0x46dc0, 0x3d75b },
+ { 0x46dc1, 0x3d75c }, { 0x46dc2, 0x3d4a7 }, { 0x46dc3, 0x3d2bf },
+ { 0x46dc4, 0x3d6fa }, { 0x46dc5, 0x3d6f9 }, { 0x46dc6, 0x3d6fb },
+ { 0x46dc7, 0x3d6f5 }, { 0x46dc8, 0x3d6fc }, { 0x46dc9, 0x3d6ff },
+ { 0x46dca, 0x3d2ab }, { 0x46dcb, 0x3d715 }, { 0x46dcc, 0x3d710 },
+ { 0x46dcd, 0x3d70c }, { 0x46dce, 0x3d712 }, { 0x46dcf, 0x3d70f },
+ { 0x46dd0, 0x3d717 }, { 0x46dd1, 0x3d716 }, { 0x46dd2, 0x3d285 },
+ { 0x46dd3, 0x3d269 }, { 0x46dd4, 0x3d2f8 }, { 0x46dd5, 0x0c421 },
+ { 0x46dd6, 0x0c3fc }
+};
+
+#define BELLBOT_COUNT 108
+static const TagMapping BELLBOT_MAP[108] = {
+ { 0x46cd0, 0x31331 }, { 0x46ce2, 0x31332 }, { 0x46ced, 0x31333 },
+ { 0x46cf8, 0x31334 }, { 0x46d03, 0x31335 }, { 0x46d0e, 0x31336 },
+ { 0x46d19, 0x31337 }, { 0x46d24, 0x31338 }, { 0x46d2f, 0x31339 },
+ { 0x46cd1, 0x3133a }, { 0x46cd9, 0x3133b }, { 0x46cda, 0x3133c },
+ { 0x46cdb, 0x3133d }, { 0x46cdc, 0x3133e }, { 0x46cdd, 0x3133f },
+ { 0x46cde, 0x31340 }, { 0x46cdf, 0x31341 }, { 0x46ce0, 0x31342 },
+ { 0x46ce1, 0x31343 }, { 0x46ce3, 0x31344 }, { 0x46ce4, 0x31345 },
+ { 0x46ce5, 0x31346 }, { 0x46ce6, 0x31347 }, { 0x46ce7, 0x31348 },
+ { 0x46ce8, 0x31349 }, { 0x46ce9, 0x3134a }, { 0x46cea, 0x3134b },
+ { 0x46ceb, 0x3134c }, { 0x46cec, 0x3134d }, { 0x46cee, 0x3134e },
+ { 0x46cef, 0x3134f }, { 0x46cf0, 0x31350 }, { 0x46cf1, 0x31351 },
+ { 0x46cf2, 0x31352 }, { 0x46cf3, 0x31353 }, { 0x46cf4, 0x31354 },
+ { 0x46cf5, 0x31355 }, { 0x46cf6, 0x31356 }, { 0x46cf7, 0x31357 },
+ { 0x46cf9, 0x31358 }, { 0x46cfa, 0x31359 }, { 0x46cfb, 0x3135a },
+ { 0x46cfc, 0x3135b }, { 0x46cfd, 0x3135c }, { 0x46cfe, 0x3135d },
+ { 0x46cff, 0x3135e }, { 0x46d00, 0x3135f }, { 0x46d01, 0x31360 },
+ { 0x46d02, 0x31361 }, { 0x46d04, 0x31362 }, { 0x46d05, 0x31363 },
+ { 0x46d06, 0x31364 }, { 0x46d07, 0x31365 }, { 0x46d08, 0x31366 },
+ { 0x46d09, 0x31367 }, { 0x46d0a, 0x31368 }, { 0x46d0b, 0x31369 },
+ { 0x46d0c, 0x3136a }, { 0x46d0d, 0x3136b }, { 0x46d0f, 0x3136c },
+ { 0x46d10, 0x3136d }, { 0x46d11, 0x3136e }, { 0x46d12, 0x3136f },
+ { 0x46d13, 0x31370 }, { 0x46d14, 0x31371 }, { 0x46d15, 0x31372 },
+ { 0x46d16, 0x31373 }, { 0x46d17, 0x31374 }, { 0x46d18, 0x31375 },
+ { 0x46d1a, 0x31376 }, { 0x46d1b, 0x31377 }, { 0x46d1c, 0x31378 },
+ { 0x46d1d, 0x31379 }, { 0x46d1e, 0x3137a }, { 0x46d1f, 0x3137b },
+ { 0x46d20, 0x3137c }, { 0x46d21, 0x3137d }, { 0x46d22, 0x3137e },
+ { 0x46d23, 0x3137f }, { 0x46d25, 0x31380 }, { 0x46d26, 0x31381 },
+ { 0x46d27, 0x31382 }, { 0x46d28, 0x31383 }, { 0x46d29, 0x31384 },
+ { 0x46d2a, 0x31385 }, { 0x46d2b, 0x31386 }, { 0x46d2c, 0x31387 },
+ { 0x46d2d, 0x31388 }, { 0x46d2e, 0x31389 }, { 0x46d30, 0x3138a },
+ { 0x46d31, 0x3138b }, { 0x46d32, 0x3138c }, { 0x46d33, 0x3138d },
+ { 0x46d34, 0x3138e }, { 0x46d35, 0x3138f }, { 0x46d36, 0x31390 },
+ { 0x46d37, 0x31391 }, { 0x46d38, 0x31392 }, { 0x46d39, 0x31393 },
+ { 0x46cd2, 0x31394 }, { 0x46cd3, 0x31395 }, { 0x46cd4, 0x31396 },
+ { 0x46cd5, 0x31397 }, { 0x46cd6, 0x31398 }, { 0x46cd7, 0x31399 },
+ { 0x46cd8, 0x3139a }, { 0x46d3b, 0x313d7 }, { 0x46d58, 0x313d6 }
+};
+
+#define DESKBOT_COUNT 108
+static const TagMapping DESKBOT_MAP[108] = {
+ { 0x46cd0, 0x3ac00 }, { 0x46ce2, 0x3ac10 }, { 0x46ced, 0x3ac1b },
+ { 0x46cf8, 0x3ac26 }, { 0x46d03, 0x3ac31 }, { 0x46d0e, 0x3ac3b },
+ { 0x46d19, 0x3ac46 }, { 0x46d24, 0x3ac51 }, { 0x46d2f, 0x3ac5c },
+ { 0x46cd1, 0x3ac01 }, { 0x46cd9, 0x3ac07 }, { 0x46cda, 0x3ac08 },
+ { 0x46cdb, 0x3ac09 }, { 0x46cdc, 0x3ac0a }, { 0x46cdd, 0x3ac0b },
+ { 0x46cde, 0x3ac0c }, { 0x46cdf, 0x3ac0d }, { 0x46ce0, 0x3ac0e },
+ { 0x46ce1, 0x3ac0f }, { 0x46ce3, 0x3ac11 }, { 0x46ce4, 0x3ac12 },
+ { 0x46ce5, 0x3ac13 }, { 0x46ce6, 0x3ac15 }, { 0x46ce7, 0x3ac16 },
+ { 0x46ce8, 0x3ac17 }, { 0x46ce9, 0x3ac18 }, { 0x46cea, 0x3ac19 },
+ { 0x46ceb, 0x3ac1a }, { 0x46cec, 0x3ac1c }, { 0x46cee, 0x3abf2 },
+ { 0x46cef, 0x3ac1d }, { 0x46cf0, 0x3ac1e }, { 0x46cf1, 0x3ac1f },
+ { 0x46cf2, 0x3ac20 }, { 0x46cf3, 0x3ac21 }, { 0x46cf4, 0x3ac22 },
+ { 0x46cf5, 0x3ac23 }, { 0x46cf6, 0x3ac24 }, { 0x46cf7, 0x3ac25 },
+ { 0x46cf9, 0x3ac27 }, { 0x46cfa, 0x3ac28 }, { 0x46cfb, 0x3ac29 },
+ { 0x46cfc, 0x3ac2a }, { 0x46cfd, 0x3ac2b }, { 0x46cfe, 0x3ac2c },
+ { 0x46cff, 0x3ac2d }, { 0x46d00, 0x3ac2e }, { 0x46d01, 0x3ac2f },
+ { 0x46d02, 0x3ac30 }, { 0x46d04, 0x3ac32 }, { 0x46d05, 0x3ac33 },
+ { 0x46d06, 0x3ac34 }, { 0x46d07, 0x3ac35 }, { 0x46d08, 0x3ac36 },
+ { 0x46d09, 0x3acd2 }, { 0x46d0a, 0x3ac37 }, { 0x46d0b, 0x3ac38 },
+ { 0x46d0c, 0x3ac39 }, { 0x46d0d, 0x3ac3a }, { 0x46d0f, 0x3ac3c },
+ { 0x46d10, 0x3ac3d }, { 0x46d11, 0x3ac3e }, { 0x46d12, 0x3ac3f },
+ { 0x46d13, 0x3ac40 }, { 0x46d14, 0x3ac41 }, { 0x46d15, 0x3ac42 },
+ { 0x46d16, 0x3ac43 }, { 0x46d17, 0x3ac44 }, { 0x46d18, 0x3ac45 },
+ { 0x46d1a, 0x3ac47 }, { 0x46d1b, 0x3ac48 }, { 0x46d1c, 0x3ac49 },
+ { 0x46d1d, 0x3ac4a }, { 0x46d1e, 0x3ac4b }, { 0x46d1f, 0x3ac4c },
+ { 0x46d20, 0x3ac4d }, { 0x46d21, 0x3ac4e }, { 0x46d22, 0x3ac4f },
+ { 0x46d23, 0x3ac50 }, { 0x46d25, 0x3ac52 }, { 0x46d26, 0x3ac53 },
+ { 0x46d27, 0x3ac54 }, { 0x46d28, 0x3ac55 }, { 0x46d29, 0x3ac56 },
+ { 0x46d2a, 0x3ac57 }, { 0x46d2b, 0x3ac58 }, { 0x46d2c, 0x3ac59 },
+ { 0x46d2d, 0x3ac5a }, { 0x46d2e, 0x3ac5b }, { 0x46d30, 0x3ac5d },
+ { 0x46d31, 0x3ac5e }, { 0x46d32, 0x3ac5f }, { 0x46d33, 0x3ac60 },
+ { 0x46d34, 0x3ac61 }, { 0x46d35, 0x3ac62 }, { 0x46d36, 0x3ac63 },
+ { 0x46d37, 0x3ac64 }, { 0x46d38, 0x3ac65 }, { 0x46d39, 0x3ac66 },
+ { 0x46cd2, 0x3ac02 }, { 0x46cd3, 0x3ac03 }, { 0x46cd4, 0x3ac04 },
+ { 0x46cd5, 0x3ac05 }, { 0x46cd6, 0x3ac06 }, { 0x46d3b, 0x3ae27 },
+ { 0x46d58, 0x3ae0e }, { 0x46dd2, 0x3aebc }, { 0x46dd6, 0x3aebd }
+};
+
+#define DOORBOT_COUNT 240
+static const TagMapping DOORBOT_MAP[240] = {
+ { 0x46cd1, 0x35ee6 }, { 0x46cd2, 0x35ee7 }, { 0x46cd3, 0x35ee8 },
+ { 0x46cd4, 0x35ee9 }, { 0x46cd5, 0x35eea }, { 0x46cd6, 0x35eeb },
+ { 0x46cd7, 0x35eec }, { 0x46cd8, 0x35eed }, { 0x46cd9, 0x35eee },
+ { 0x46cda, 0x35eef }, { 0x46cdb, 0x35ef0 }, { 0x46cdc, 0x35ef1 },
+ { 0x46cdd, 0x35ef2 }, { 0x46cde, 0x35ef3 }, { 0x46cdf, 0x35ef4 },
+ { 0x46ce0, 0x35ef5 }, { 0x46ce1, 0x35ef6 }, { 0x46ce2, 0x35ef7 },
+ { 0x46ce3, 0x35ef8 }, { 0x46ce4, 0x35ef9 }, { 0x46ce5, 0x35efa },
+ { 0x46ce6, 0x35efb }, { 0x46ce7, 0x35efc }, { 0x46ce8, 0x35efd },
+ { 0x46ce9, 0x35efe }, { 0x46cea, 0x35eff }, { 0x46ceb, 0x35f00 },
+ { 0x46cec, 0x35f01 }, { 0x46ced, 0x35f02 }, { 0x46cee, 0x35f03 },
+ { 0x46cef, 0x35f04 }, { 0x46cf0, 0x35f05 }, { 0x46cf1, 0x35f06 },
+ { 0x46cf2, 0x35f07 }, { 0x46cf3, 0x35f08 }, { 0x46cf4, 0x35f09 },
+ { 0x46cf5, 0x35f0a }, { 0x46cf6, 0x35f0b }, { 0x46cf7, 0x35f0c },
+ { 0x46cf8, 0x35f0d }, { 0x46cf9, 0x35f0e }, { 0x46cfa, 0x35f0f },
+ { 0x46cfb, 0x35f10 }, { 0x46cfc, 0x35f11 }, { 0x46cfd, 0x35f12 },
+ { 0x46cfe, 0x35f13 }, { 0x46cff, 0x35f14 }, { 0x46d00, 0x35f15 },
+ { 0x46d01, 0x35f16 }, { 0x46d02, 0x35f17 }, { 0x46d03, 0x35f18 },
+ { 0x46d04, 0x35f19 }, { 0x46d05, 0x35f1a }, { 0x46d06, 0x35f1b },
+ { 0x46d07, 0x35f1c }, { 0x46d08, 0x35f1d }, { 0x46d09, 0x35f1e },
+ { 0x46d0a, 0x35f1f }, { 0x46d0b, 0x35f20 }, { 0x46d0c, 0x35f21 },
+ { 0x46d0d, 0x35f22 }, { 0x46d0e, 0x35f23 }, { 0x46d0f, 0x35f24 },
+ { 0x46d10, 0x35f25 }, { 0x46d11, 0x35f26 }, { 0x46d12, 0x35f27 },
+ { 0x46d13, 0x35f28 }, { 0x46d14, 0x35f29 }, { 0x46d15, 0x35f2a },
+ { 0x46d16, 0x35f2b }, { 0x46d17, 0x35f2c }, { 0x46d18, 0x35f2d },
+ { 0x46d19, 0x35f2e }, { 0x46d1a, 0x35f2f }, { 0x46d1b, 0x35f30 },
+ { 0x46d1c, 0x35f31 }, { 0x46d1d, 0x35f32 }, { 0x46d1e, 0x35f33 },
+ { 0x46d1f, 0x35f34 }, { 0x46d20, 0x35f35 }, { 0x46d21, 0x35f36 },
+ { 0x46d22, 0x35f37 }, { 0x46d23, 0x35f38 }, { 0x46d24, 0x35f39 },
+ { 0x46d25, 0x35f3a }, { 0x46d26, 0x35f3b }, { 0x46d27, 0x35f3c },
+ { 0x46d28, 0x35f3d }, { 0x46d29, 0x35f3e }, { 0x46d2a, 0x35f3f },
+ { 0x46d2b, 0x35f40 }, { 0x46d2c, 0x35f41 }, { 0x46d2d, 0x35f42 },
+ { 0x46d2e, 0x35f43 }, { 0x46d2f, 0x35f44 }, { 0x46d30, 0x35f45 },
+ { 0x46d31, 0x35f46 }, { 0x46d32, 0x35f47 }, { 0x46d33, 0x35f48 },
+ { 0x46d34, 0x35f49 }, { 0x46d35, 0x35f4a }, { 0x46d36, 0x35f4b },
+ { 0x46d37, 0x35f4c }, { 0x46d38, 0x35f4d }, { 0x46d39, 0x35f4e },
+ { 0x46d3a, 0x35bf5 }, { 0x46d3b, 0x360c0 }, { 0x46d3d, 0x36027 },
+ { 0x46d3e, 0x36028 }, { 0x46d3f, 0x36029 }, { 0x46d40, 0x3602a },
+ { 0x46d41, 0x3602e }, { 0x46d42, 0x3602f }, { 0x46d43, 0x36030 },
+ { 0x46d44, 0x36031 }, { 0x46d45, 0x3602c }, { 0x46d46, 0x3602d },
+ { 0x46d47, 0x36227 }, { 0x46d48, 0x36084 }, { 0x46d49, 0x36085 },
+ { 0x46d4a, 0x36467 }, { 0x46d4b, 0x36457 }, { 0x46d4c, 0x36457 },
+ { 0x46d4d, 0x36457 }, { 0x46d4e, 0x3646d }, { 0x46d4f, 0x36457 },
+ { 0x46d50, 0x36470 }, { 0x46d51, 0x36457 }, { 0x46d52, 0x36457 },
+ { 0x46d53, 0x36457 }, { 0x46d55, 0x360a3 }, { 0x46d56, 0x3634c },
+ { 0x46d57, 0x36457 }, { 0x46d54, 0x36457 }, { 0x46d58, 0x360bf },
+ { 0x46d5a, 0x36407 }, { 0x46d5b, 0x3640c }, { 0x46d5c, 0x3641a },
+ { 0x46d5d, 0x36420 }, { 0x46d5e, 0x36421 }, { 0x46d5f, 0x36422 },
+ { 0x46d60, 0x36423 }, { 0x46d61, 0x36424 }, { 0x46d66, 0x36408 },
+ { 0x46d67, 0x36409 }, { 0x46d68, 0x3640a }, { 0x46d69, 0x3640b },
+ { 0x46d6a, 0x3640d }, { 0x46d6e, 0x36415 }, { 0x46d6f, 0x36416 },
+ { 0x46d70, 0x36417 }, { 0x46d71, 0x36418 }, { 0x46d72, 0x36419 },
+ { 0x46d73, 0x3640e }, { 0x46d74, 0x3640f }, { 0x46d75, 0x36410 },
+ { 0x46d76, 0x36411 }, { 0x46d77, 0x36412 }, { 0x46d7e, 0x3641b },
+ { 0x46d7f, 0x3641c }, { 0x46d80, 0x3641d }, { 0x46d81, 0x3641e },
+ { 0x46d82, 0x3641f }, { 0x46d88, 0x362d4 }, { 0x46d89, 0x362db },
+ { 0x46d8a, 0x362e2 }, { 0x46d8b, 0x362e3 }, { 0x46d8c, 0x362e7 },
+ { 0x46d8d, 0x362eb }, { 0x46d8e, 0x362f2 }, { 0x46d8f, 0x362f5 },
+ { 0x46d90, 0x36305 }, { 0x46d91, 0x36457 }, { 0x46d92, 0x36309 },
+ { 0x46d93, 0x362f4 }, { 0x46d94, 0x3630a }, { 0x46d96, 0x36318 },
+ { 0x46d97, 0x36319 }, { 0x46d98, 0x36326 }, { 0x46d99, 0x36327 },
+ { 0x46d9a, 0x3632e }, { 0x46d9b, 0x3632f }, { 0x46d9c, 0x36330 },
+ { 0x46d9d, 0x362f3 }, { 0x46d9e, 0x362b0 }, { 0x46d9f, 0x362b1 },
+ { 0x46da0, 0x362b2 }, { 0x46da1, 0x362b3 }, { 0x46da2, 0x362b4 },
+ { 0x46da3, 0x362b5 }, { 0x46da4, 0x362b9 }, { 0x46da5, 0x362bb },
+ { 0x46da6, 0x362ba }, { 0x46da7, 0x362bc }, { 0x46da8, 0x362b8 },
+ { 0x46da9, 0x362bd }, { 0x46daa, 0x362be }, { 0x46dab, 0x362bf },
+ { 0x46dac, 0x362c0 }, { 0x46dad, 0x362c1 }, { 0x46dae, 0x362c2 },
+ { 0x46daf, 0x362b6 }, { 0x46db0, 0x36314 }, { 0x46db1, 0x362c3 },
+ { 0x46db2, 0x362c4 }, { 0x46db3, 0x362c5 }, { 0x46db4, 0x362c6 },
+ { 0x46db5, 0x362c7 }, { 0x46db6, 0x362c8 }, { 0x46db7, 0x362ca },
+ { 0x46db8, 0x362cc }, { 0x46db9, 0x362cb }, { 0x46dba, 0x362cd },
+ { 0x46dbb, 0x362c9 }, { 0x46dbc, 0x362ce }, { 0x46dbd, 0x362cf },
+ { 0x46dbe, 0x362d0 }, { 0x46dbf, 0x362d1 }, { 0x46dc0, 0x362d2 },
+ { 0x46dc1, 0x362d3 }, { 0x46dc2, 0x3637c }, { 0x46dc3, 0x3627c },
+ { 0x46dc4, 0x36497 }, { 0x46dc5, 0x36493 }, { 0x46dc6, 0x3647f },
+ { 0x46dc7, 0x3647c }, { 0x46dc8, 0x36482 }, { 0x46dc9, 0x3648a },
+ { 0x46dca, 0x3649b }, { 0x46dcb, 0x364b6 }, { 0x46dcc, 0x364aa },
+ { 0x46dcd, 0x364a1 }, { 0x46dce, 0x364b0 }, { 0x46dcf, 0x364a7 },
+ { 0x46dd1, 0x364b9 }, { 0x46dd2, 0x36370 }, { 0x46dd3, 0x363ab },
+ { 0x46dd4, 0x36404 }, { 0x46dd5, 0x362ab }, { 0x46dd6, 0x3636d }
+};
+
+#define LIFTBOT_COUNT 118
+static const TagMapping LIFTBOT_MAP[118] = {
+ { 0x46cd1, 0x335b5 }, { 0x46cd2, 0x33603 }, { 0x46cd3, 0x33604 },
+ { 0x46cd4, 0x33605 }, { 0x46cd5, 0x33606 }, { 0x46cd6, 0x33607 },
+ { 0x46cd7, 0x33608 }, { 0x46cd8, 0x33607 }, { 0x46cd9, 0x335b6 },
+ { 0x46cda, 0x335b7 }, { 0x46cdb, 0x335b8 }, { 0x46cdc, 0x335b9 },
+ { 0x46cdd, 0x335ba }, { 0x46cde, 0x335bb }, { 0x46cdf, 0x335bc },
+ { 0x46ce0, 0x335bd }, { 0x46ce1, 0x335bf }, { 0x46ce2, 0x335ac },
+ { 0x46ce3, 0x335c0 }, { 0x46ce4, 0x335c1 }, { 0x46ce5, 0x335c2 },
+ { 0x46ce6, 0x335c4 }, { 0x46ce7, 0x335c5 }, { 0x46ce8, 0x335c6 },
+ { 0x46ce9, 0x335c7 }, { 0x46cea, 0x335c8 }, { 0x46ceb, 0x335ca },
+ { 0x46cec, 0x335cb }, { 0x46ced, 0x335ad }, { 0x46cee, 0x335cc },
+ { 0x46cef, 0x335ce }, { 0x46cf0, 0x335d0 }, { 0x46cf1, 0x335d1 },
+ { 0x46cf2, 0x335d2 }, { 0x46cf3, 0x335d4 }, { 0x46cf4, 0x335d5 },
+ { 0x46cf5, 0x335d6 }, { 0x46cf6, 0x335d7 }, { 0x46cf7, 0x335d8 },
+ { 0x46cf8, 0x335ae }, { 0x46cf9, 0x335d9 }, { 0x46cfa, 0x335db },
+ { 0x46cfb, 0x335de }, { 0x46cfc, 0x335df }, { 0x46cfd, 0x335e0 },
+ { 0x46cfe, 0x335e1 }, { 0x46cff, 0x335e2 }, { 0x46d00, 0x335e3 },
+ { 0x46d01, 0x335e4 }, { 0x46d02, 0x335e5 }, { 0x46d03, 0x335af },
+ { 0x46d04, 0x335e6 }, { 0x46d05, 0x335e7 }, { 0x46d06, 0x335ea },
+ { 0x46d07, 0x335eb }, { 0x46d08, 0x335ec }, { 0x46d09, 0x3364a },
+ { 0x46d0a, 0x3364b }, { 0x46d0b, 0x3364c }, { 0x46d0c, 0x3364d },
+ { 0x46d0d, 0x3364e }, { 0x46d0e, 0x335b0 }, { 0x46d0f, 0x33650 },
+ { 0x46d10, 0x33651 }, { 0x46d11, 0x33652 }, { 0x46d12, 0x33653 },
+ { 0x46d13, 0x33654 }, { 0x46d14, 0x33656 }, { 0x46d15, 0x33657 },
+ { 0x46d16, 0x33658 }, { 0x46d17, 0x33659 }, { 0x46d18, 0x3365b },
+ { 0x46d19, 0x335b1 }, { 0x46d1a, 0x3365c }, { 0x46d1b, 0x3365d },
+ { 0x46d1c, 0x3365e }, { 0x46d1d, 0x3365f }, { 0x46d1e, 0x33660 },
+ { 0x46d1f, 0x33661 }, { 0x46d20, 0x33662 }, { 0x46d21, 0x33663 },
+ { 0x46d22, 0x335a9 }, { 0x46d23, 0x335aa }, { 0x46d24, 0x335b2 },
+ { 0x46d25, 0x335ed }, { 0x46d26, 0x335ee }, { 0x46d27, 0x335ef },
+ { 0x46d28, 0x335f0 }, { 0x46d29, 0x335f1 }, { 0x46d2a, 0x335f2 },
+ { 0x46d2b, 0x335f4 }, { 0x46d2c, 0x335f5 }, { 0x46d2d, 0x335f6 },
+ { 0x46d2e, 0x335f7 }, { 0x46d2f, 0x335b4 }, { 0x46d30, 0x335f8 },
+ { 0x46d31, 0x335f9 }, { 0x46d32, 0x335fa }, { 0x46d33, 0x335fb },
+ { 0x46d34, 0x335fc }, { 0x46d35, 0x335fd }, { 0x46d36, 0x335ff },
+ { 0x46d37, 0x33600 }, { 0x46d38, 0x33601 }, { 0x46d39, 0x33602 },
+ { 0x46d3a, 0x3380f }, { 0x46d3b, 0x33695 }, { 0x46d47, 0x07536 },
+ { 0x46d4a, 0x3360c }, { 0x46d4e, 0x337fc }, { 0x46d50, 0x337fd },
+ { 0x46d56, 0x33800 }, { 0x46d58, 0x33694 }, { 0x46dc2, 0x337f3 },
+ { 0x46dc6, 0x337fb }, { 0x46dc7, 0x337f9 }, { 0x46dca, 0x33802 },
+ { 0x46dd3, 0x33775 }
+};
+
+#define MAITRED_COUNT 108
+static const TagMapping MAITRED_MAP[] = {
+ { 0x46cd0, 0x3f94c }, { 0x46ce2, 0x3f9a6 }, { 0x46ced, 0x3f9a7 },
+ { 0x46cf8, 0x3f9a8 }, { 0x46d03, 0x3f9a9 }, { 0x46d0e, 0x3f9aa },
+ { 0x46d19, 0x3f9ab }, { 0x46d24, 0x3f9ac }, { 0x46d2f, 0x3f9ad },
+ { 0x46cd1, 0x3f9ae }, { 0x46cd9, 0x3f9af }, { 0x46cda, 0x3f9b0 },
+ { 0x46cdb, 0x3f9b1 }, { 0x46cdc, 0x3f9b2 }, { 0x46cdd, 0x3f9b3 },
+ { 0x46cde, 0x3f9b4 }, { 0x46cdf, 0x3f9b5 }, { 0x46ce0, 0x3f9b6 },
+ { 0x46ce1, 0x3f9b7 }, { 0x46ce3, 0x3f9b8 }, { 0x46ce4, 0x3f9b9 },
+ { 0x46ce5, 0x3f9ba }, { 0x46ce6, 0x3f9bb }, { 0x46ce7, 0x3f9bc },
+ { 0x46ce8, 0x3f9bd }, { 0x46ce9, 0x3f9be }, { 0x46cea, 0x3f9bf },
+ { 0x46ceb, 0x3f9c0 }, { 0x46cec, 0x3f9c1 }, { 0x46cee, 0x3f9c2 },
+ { 0x46cef, 0x3f9c3 }, { 0x46cf0, 0x3f9c4 }, { 0x46cf1, 0x3f9c5 },
+ { 0x46cf2, 0x3f9c6 }, { 0x46cf3, 0x3f9c7 }, { 0x46cf4, 0x3f9c8 },
+ { 0x46cf5, 0x3f9c9 }, { 0x46cf6, 0x3f9ca }, { 0x46cf7, 0x3f9cb },
+ { 0x46cf9, 0x3f9cc }, { 0x46cfa, 0x3f9cd }, { 0x46cfb, 0x3f9ce },
+ { 0x46cfc, 0x3f9cf }, { 0x46cfd, 0x3f9d0 }, { 0x46cfe, 0x3f9d1 },
+ { 0x46cff, 0x3f9d2 }, { 0x46d00, 0x3f9d3 }, { 0x46d01, 0x3f9d4 },
+ { 0x46d02, 0x3f9d5 }, { 0x46d04, 0x3f9d6 }, { 0x46d05, 0x3f9d7 },
+ { 0x46d06, 0x3f9d9 }, { 0x46d07, 0x3f9da }, { 0x46d08, 0x3f9db },
+ { 0x46d09, 0x3f98a }, { 0x46d0a, 0x3f98b }, { 0x46d0b, 0x3f98c },
+ { 0x46d0c, 0x3f98d }, { 0x46d0d, 0x3f98e }, { 0x46d0f, 0x3f98f },
+ { 0x46d10, 0x3f991 }, { 0x46d11, 0x3f992 }, { 0x46d12, 0x3f993 },
+ { 0x46d13, 0x3f994 }, { 0x46d14, 0x3f996 }, { 0x46d15, 0x3f997 },
+ { 0x46d16, 0x3f998 }, { 0x46d17, 0x3f999 }, { 0x46d18, 0x3f99a },
+ { 0x46d1a, 0x3f99b }, { 0x46d1b, 0x3f99c }, { 0x46d1c, 0x3f99d },
+ { 0x46d1d, 0x3f99e }, { 0x46d1e, 0x3f99f }, { 0x46d1f, 0x3f9a1 },
+ { 0x46d20, 0x3f9a2 }, { 0x46d21, 0x3f9a3 }, { 0x46d22, 0x3f9a4 },
+ { 0x46d23, 0x3f9a5 }, { 0x46d25, 0x3f9dd }, { 0x46d26, 0x3f9de },
+ { 0x46d27, 0x3f9df }, { 0x46d28, 0x3f9e0 }, { 0x46d29, 0x3f9e1 },
+ { 0x46d2a, 0x3f9e2 }, { 0x46d2b, 0x3f9e3 }, { 0x46d2c, 0x3f9e4 },
+ { 0x46d2d, 0x3f9e5 }, { 0x46d2e, 0x3f9e6 }, { 0x46d30, 0x3f9e7 },
+ { 0x46d31, 0x3f9e8 }, { 0x46d32, 0x3f9e9 }, { 0x46d33, 0x3f9ea },
+ { 0x46d34, 0x3f9eb }, { 0x46d35, 0x3f9ec }, { 0x46d36, 0x3f9ed },
+ { 0x46d37, 0x3f9ee }, { 0x46d38, 0x3f9ef }, { 0x46d39, 0x3f9f0 },
+ { 0x46cd2, 0x3f9f1 }, { 0x46cd3, 0x3f9f2 }, { 0x46cd4, 0x3f9f3 },
+ { 0x46cd5, 0x3f9f9 }, { 0x46cd6, 0x3f9fa }, { 0x46cd7, 0x3f9fb },
+ { 0x46cd8, 0x3f9fc }, { 0x46d3b, 0x3f853 }, { 0x46d58, 0x3f83c }
+};
+
+void writeTagMappings(const char *name, const TagMapping *map, int count) {
+ outputFile.seek(dataOffset);
+
+ for (int idx = 0; idx < count; ++idx, ++map) {
+ outputFile.writeLong(map->_src);
+ outputFile.writeLong(map->_dest);
+ }
+
+ uint size = outputFile.size() - dataOffset;
+ writeEntryHeader(name, dataOffset, size);
+ dataOffset += size;
+}
+
+void writeAllTagMappings() {
+ writeTagMappings("TagMap/Barbot", BARBOT_MAP, BARBOT_COUNT);
+ writeTagMappings("TagMap/Bellbot", BELLBOT_MAP, BELLBOT_COUNT);
+ writeTagMappings("TagMap/Deskbot", DESKBOT_MAP, DESKBOT_COUNT);
+ writeTagMappings("TagMap/Doorbot", DOORBOT_MAP, DOORBOT_COUNT);
+ writeTagMappings("TagMap/Liftbot", LIFTBOT_MAP, LIFTBOT_COUNT);
+ writeTagMappings("TagMap/MaitreD", MAITRED_MAP, MAITRED_COUNT);
+} \ No newline at end of file
diff --git a/devtools/create_titanic/tag_maps.h b/devtools/create_titanic/tag_maps.h
new file mode 100644
index 0000000000..33dd8e648c
--- /dev/null
+++ b/devtools/create_titanic/tag_maps.h
@@ -0,0 +1,37 @@
+/* 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 COMMON_TAG_MAPS_H
+#define COMMON_TAG_MAPS_H
+
+#include "common/scummsys.h"
+
+struct TagMapping {
+ uint _src;
+ uint _dest;
+};
+
+extern void writeAllTagMappings();
+extern void writeEntryHeader(const char *name, uint offset, uint size);
+extern uint dataOffset;
+
+#endif
diff --git a/devtools/create_titanic/winexe.cpp b/devtools/create_titanic/winexe.cpp
new file mode 100644
index 0000000000..c23bd84a89
--- /dev/null
+++ b/devtools/create_titanic/winexe.cpp
@@ -0,0 +1,83 @@
+/* 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.
+ *
+ */
+
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+#include "str.h"
+#include "winexe.h"
+
+namespace Common {
+
+WinResourceID &WinResourceID::operator=(const String &x) {
+ _name = x;
+ _idType = kIDTypeString;
+ return *this;
+}
+
+WinResourceID &WinResourceID::operator=(uint32 x) {
+ _id = x;
+ _idType = kIDTypeNumerical;
+ return *this;
+}
+
+bool WinResourceID::operator==(const String &x) const {
+ return _idType == kIDTypeString && _name.equalsIgnoreCase(x);
+}
+
+bool WinResourceID::operator==(const uint32 &x) const {
+ return _idType == kIDTypeNumerical && _id == x;
+}
+
+bool WinResourceID::operator==(const WinResourceID &x) const {
+ if (_idType != x._idType)
+ return false;
+ if (_idType == kIDTypeString)
+ return _name.equalsIgnoreCase(x._name);
+ if (_idType == kIDTypeNumerical)
+ return _id == x._id;
+ return true;
+}
+
+String WinResourceID::getString() const {
+ if (_idType != kIDTypeString)
+ return "";
+
+ return _name;
+}
+
+uint32 WinResourceID::getID() const {
+ if (_idType != kIDTypeNumerical)
+ return 0xffffffff;
+
+ return _id;
+}
+
+String WinResourceID::toString() const {
+ if (_idType == kIDTypeString)
+ return _name;
+ else if (_idType == kIDTypeNumerical)
+ return String::format("0x%08x", _id);
+
+ return "";
+}
+
+} // End of namespace Common
diff --git a/devtools/create_titanic/winexe.h b/devtools/create_titanic/winexe.h
new file mode 100644
index 0000000000..da99c769be
--- /dev/null
+++ b/devtools/create_titanic/winexe.h
@@ -0,0 +1,70 @@
+/* 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 COMMON_WINEXE_H
+#define COMMON_WINEXE_H
+
+#include "hash-str.h"
+#include "str.h"
+
+namespace Common {
+
+class WinResourceID {
+public:
+ WinResourceID() { _idType = kIDTypeNull; }
+ WinResourceID(String x) { _idType = kIDTypeString; _name = x; }
+ WinResourceID(uint32 x) { _idType = kIDTypeNumerical; _id = x; }
+
+ WinResourceID &operator=(const String &x);
+ WinResourceID &operator=(uint32 x);
+
+ bool operator==(const String &x) const;
+ bool operator==(const uint32 &x) const;
+ bool operator==(const WinResourceID &x) const;
+
+ String getString() const;
+ uint32 getID() const;
+ String toString() const;
+
+private:
+ /** An ID Type. */
+ enum IDType {
+ kIDTypeNull, ///< No type set
+ kIDTypeNumerical, ///< A numerical ID.
+ kIDTypeString ///< A string ID.
+ } _idType;
+
+ String _name; ///< The resource's string ID.
+ uint32 _id; ///< The resource's numerical ID.
+};
+
+struct WinResourceID_Hash {
+ uint operator()(const WinResourceID &id) const { return hashit(id.toString()); }
+};
+
+struct WinResourceID_EqualTo {
+ bool operator()(const WinResourceID &id1, const WinResourceID &id2) const { return id1 == id2; }
+};
+
+} // End of namespace Common
+
+#endif
diff --git a/devtools/create_titanic/winexe_pe.cpp b/devtools/create_titanic/winexe_pe.cpp
new file mode 100644
index 0000000000..16ad16ab63
--- /dev/null
+++ b/devtools/create_titanic/winexe_pe.cpp
@@ -0,0 +1,260 @@
+/* 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.
+ *
+ */
+
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+#include "file.h"
+#include "str.h"
+#include "winexe_pe.h"
+#include "common/array.h"
+#include "common/endian.h"
+
+namespace Common {
+
+PEResources::PEResources() {
+ _exe = 0;
+}
+
+PEResources::~PEResources() {
+ clear();
+}
+
+void PEResources::clear() {
+ _sections.clear();
+ _resources.clear();
+ delete _exe; _exe = 0;
+}
+
+bool PEResources::loadFromEXE(const String &fileName) {
+ if (fileName.empty())
+ return false;
+
+ File *file = new File();
+
+ if (!file->open(fileName.c_str())) {
+ delete file;
+ return false;
+ }
+
+ return loadFromEXE(file);
+}
+
+bool PEResources::loadFromEXE(File *stream) {
+ clear();
+
+ if (!stream)
+ return false;
+
+ if (stream->readUint16BE() != MKTAG16('M', 'Z'))
+ return false;
+
+ stream->skip(58);
+
+ uint32 peOffset = stream->readUint32LE();
+
+ if (!peOffset || peOffset >= (uint32)stream->size())
+ return false;
+
+ stream->seek(peOffset);
+
+ if (stream->readUint32BE() != MKTAG('P','E',0,0))
+ return false;
+
+ stream->skip(2);
+ uint16 sectionCount = stream->readUint16LE();
+ stream->skip(12);
+ uint16 optionalHeaderSize = stream->readUint16LE();
+ stream->skip(optionalHeaderSize + 2);
+
+ // Read in all the sections
+ for (uint16 i = 0; i < sectionCount; i++) {
+ char sectionName[9];
+ stream->read(sectionName, 8);
+ sectionName[8] = 0;
+
+ Section section;
+ stream->skip(4);
+ section.virtualAddress = stream->readUint32LE();
+ section.size = stream->readUint32LE();
+ section.offset = stream->readUint32LE();
+ stream->skip(16);
+
+ _sections[sectionName] = section;
+ }
+
+ // Currently, we require loading a resource section
+ if (!_sections.contains(".rsrc")) {
+ clear();
+ return false;
+ }
+
+ _exe = stream;
+
+ Section &resSection = _sections[".rsrc"];
+ parseResourceLevel(resSection, resSection.offset, 0);
+
+ return true;
+}
+
+void PEResources::parseResourceLevel(Section &section, uint32 offset, int level) {
+ _exe->seek(offset + 12);
+
+ uint16 namedEntryCount = _exe->readUint16LE();
+ uint16 intEntryCount = _exe->readUint16LE();
+
+ for (uint32 i = 0; i < (uint32)(namedEntryCount + intEntryCount); i++) {
+ uint32 value = _exe->readUint32LE();
+
+ WinResourceID id;
+
+ if (value & 0x80000000) {
+ value &= 0x7fffffff;
+
+ uint32 startPos = _exe->pos();
+ _exe->seek(section.offset + (value & 0x7fffffff));
+
+ // Read in the name, truncating from unicode to ascii
+ String name;
+ uint16 nameLength = _exe->readUint16LE();
+ while (nameLength--)
+ name += (char)(_exe->readUint16LE() & 0xff);
+
+ _exe->seek(startPos);
+
+ id = name;
+ } else {
+ id = value;
+ }
+
+ uint32 nextOffset = _exe->readUint32LE();
+ uint32 lastOffset = _exe->pos();
+
+ if (level == 0)
+ _curType = id;
+ else if (level == 1)
+ _curName = id;
+ else if (level == 2)
+ _curLang = id;
+
+ if (level < 2) {
+ // Time to dive down further
+ parseResourceLevel(section, section.offset + (nextOffset & 0x7fffffff), level + 1);
+ } else {
+ _exe->seek(section.offset + nextOffset);
+
+ Resource resource;
+ resource.offset = _exe->readUint32LE() + section.offset - section.virtualAddress;
+ resource.size = _exe->readUint32LE();
+
+ _resources[_curType][_curName][_curLang] = resource;
+ }
+
+ _exe->seek(lastOffset);
+ }
+}
+
+const Array<WinResourceID> PEResources::getTypeList() const {
+ Array<WinResourceID> array;
+
+ if (!_exe)
+ return array;
+
+ for (TypeMap::const_iterator it = _resources.begin(); it != _resources.end(); it++)
+ array.push_back(it->_key);
+
+ return array;
+}
+
+const Array<WinResourceID> PEResources::getNameList(const WinResourceID &type) const {
+ Array<WinResourceID> array;
+
+ if (!_exe || !_resources.contains(type))
+ return array;
+
+ const NameMap &nameMap = _resources[type];
+
+ for (NameMap::const_iterator it = nameMap.begin(); it != nameMap.end(); it++)
+ array.push_back(it->_key);
+
+ return array;
+}
+
+const Array<WinResourceID> PEResources::getLangList(const WinResourceID &type, const WinResourceID &name) const {
+ Array<WinResourceID> array;
+
+ if (!_exe || !_resources.contains(type))
+ return array;
+
+ const NameMap &nameMap = _resources[type];
+
+ if (!nameMap.contains(name))
+ return array;
+
+ const LangMap &langMap = nameMap[name];
+
+ for (LangMap::const_iterator it = langMap.begin(); it != langMap.end(); it++)
+ array.push_back(it->_key);
+
+ return array;
+}
+
+File *PEResources::getResource(const WinResourceID &type, const WinResourceID &name) {
+ Array<WinResourceID> langList = getLangList(type, name);
+
+ if (langList.empty())
+ return 0;
+
+ const Resource &resource = _resources[type][name][langList[0]];
+ byte *data = (byte *)malloc(resource.size);
+ _exe->seek(resource.offset);
+ _exe->read(data, resource.size);
+
+ File *file = new File();
+ file->open(data, resource.size);
+ return file;
+}
+
+File *PEResources::getResource(const WinResourceID &type, const WinResourceID &name, const WinResourceID &lang) {
+ if (!_exe || !_resources.contains(type))
+ return 0;
+
+ const NameMap &nameMap = _resources[type];
+
+ if (!nameMap.contains(name))
+ return 0;
+
+ const LangMap &langMap = nameMap[name];
+
+ if (!langMap.contains(lang))
+ return 0;
+
+ const Resource &resource = langMap[lang];
+ byte *data = (byte *)malloc(resource.size);
+ _exe->seek(resource.offset);
+ _exe->read(data, resource.size);
+
+ File *file = new File();
+ file->open(data, resource.size);
+ return file;
+}
+
+} // End of namespace Common
diff --git a/devtools/create_titanic/winexe_pe.h b/devtools/create_titanic/winexe_pe.h
new file mode 100644
index 0000000000..49e29b7a56
--- /dev/null
+++ b/devtools/create_titanic/winexe_pe.h
@@ -0,0 +1,120 @@
+/* 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 COMMON_WINEXE_PE_H
+#define COMMON_WINEXE_PE_H
+
+#include "file.h"
+#include "hash-str.h"
+#include "hashmap.h"
+#include "str.h"
+#include "winexe.h"
+
+namespace Common {
+
+template<class T> class Array;
+class SeekableReadStream;
+
+/** The default Windows PE resources. */
+enum PEResourceType {
+ kPECursor = 0x01,
+ kPEBitmap = 0x02,
+ kPEIcon = 0x03,
+ kPEMenu = 0x04,
+ kPEDialog = 0x05,
+ kPEString = 0x06,
+ kPEFontDir = 0x07,
+ kPEFont = 0x08,
+ kPEAccelerator = 0x09,
+ kPERCData = 0x0A,
+ kPEMessageTable = 0x0B,
+ kPEGroupCursor = 0x0C,
+ kPEGroupIcon = 0x0E,
+ kPEVersion = 0x10,
+ kPEDlgInclude = 0x11,
+ kPEPlugPlay = 0x13,
+ kPEVXD = 0x14,
+ kPEAniCursor = 0x15,
+ kPEAniIcon = 0x16
+};
+
+/**
+ * A class able to load resources from a Windows Portable Executable, such
+ * as cursors, bitmaps, and sounds.
+ */
+class PEResources {
+public:
+ PEResources();
+ ~PEResources();
+
+ /** Clear all information. */
+ void clear();
+
+ /** Load from an EXE file. */
+ bool loadFromEXE(const String &fileName);
+
+ bool loadFromEXE(File *stream);
+
+ /** Return a list of resource types. */
+ const Array<WinResourceID> getTypeList() const;
+
+ /** Return a list of names for a given type. */
+ const Array<WinResourceID> getNameList(const WinResourceID &type) const;
+
+ /** Return a list of languages for a given type and name. */
+ const Array<WinResourceID> getLangList(const WinResourceID &type, const WinResourceID &name) const;
+
+ /** Return a stream to the specified resource, taking the first language found (or 0 if non-existent). */
+ File *getResource(const WinResourceID &type, const WinResourceID &name);
+
+ /** Return a stream to the specified resource (or 0 if non-existent). */
+ File *getResource(const WinResourceID &type, const WinResourceID &name, const WinResourceID &lang);
+
+private:
+ struct Section {
+ uint32 virtualAddress;
+ uint32 size;
+ uint32 offset;
+ };
+
+ HashMap<String, Section, IgnoreCase_Hash, IgnoreCase_EqualTo> _sections;
+
+ File *_exe;
+
+ void parseResourceLevel(Section &section, uint32 offset, int level);
+ WinResourceID _curType, _curName, _curLang;
+
+ struct Resource {
+ uint32 offset;
+ uint32 size;
+ };
+
+ typedef HashMap<WinResourceID, Resource, WinResourceID_Hash, WinResourceID_EqualTo> LangMap;
+ typedef HashMap<WinResourceID, LangMap, WinResourceID_Hash, WinResourceID_EqualTo> NameMap;
+ typedef HashMap<WinResourceID, NameMap, WinResourceID_Hash, WinResourceID_EqualTo> TypeMap;
+
+ TypeMap _resources;
+};
+
+} // End of namespace Common
+
+#endif