From cf82bef02ee2941ddad6664e34f3c94e35e015a3 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 8 Oct 2010 22:30:39 +0000 Subject: TOON: Merged Toon engine to ScummVM trunk svn-id: r53087 --- tools/create_toon/create_toon.cpp | 163 ++++++++++++ tools/create_toon/create_toon.h | 47 ++++ tools/create_toon/dists/msvc9/create_toon.sln | 20 ++ tools/create_toon/dists/msvc9/create_toon.vcproj | 187 +++++++++++++ tools/create_toon/module.mk | 10 + tools/create_toon/staticdata.h | 324 +++++++++++++++++++++++ 6 files changed, 751 insertions(+) create mode 100644 tools/create_toon/create_toon.cpp create mode 100644 tools/create_toon/create_toon.h create mode 100644 tools/create_toon/dists/msvc9/create_toon.sln create mode 100644 tools/create_toon/dists/msvc9/create_toon.vcproj create mode 100644 tools/create_toon/module.mk create mode 100644 tools/create_toon/staticdata.h (limited to 'tools') diff --git a/tools/create_toon/create_toon.cpp b/tools/create_toon/create_toon.cpp new file mode 100644 index 0000000000..e6253ae21f --- /dev/null +++ b/tools/create_toon/create_toon.cpp @@ -0,0 +1,163 @@ +/* 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. + * + * $URL$ + * $Id$ + * + * This is a utility for storing all the hardcoded data of Toonstruck in a separate + * data file, used by the game engine + */ + +// 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 +#include +#include + +#include "common/scummsys.h" +#include "common/events.h" + +#include "create_toon.h" +#include "staticdata.h" + +static void writeByte(FILE *fp, uint8 b) { + fwrite(&b, 1, 1, fp); +} + +static void writeUint16BE(FILE *fp, uint16 value) { + writeByte(fp, (uint8)(value >> 8)); + writeByte(fp, (uint8)(value & 0xFF)); +} + +void writeSint16BE(FILE *fp, int16 value) { + writeUint16BE(fp, (uint16)value); +} + +static void writeUint32BE(FILE *fp, uint32 value) { + writeByte(fp, (uint8)(value >> 24)); + writeByte(fp, (uint8)((value >> 16) & 0xFF)); + writeByte(fp, (uint8)((value >> 8) & 0xFF)); + writeByte(fp, (uint8)(value & 0xFF)); +} + +void writeSint32BE(FILE *fp, int32 value) { + writeUint32BE(fp, (uint16)value); +} + +int main(int argc, char *argv[]) { + FILE *outFile; + int nbrElem; + + outFile = fopen("toon.dat", "wb"); + + // Write header + fwrite("TOON", 4, 1, outFile); + + writeByte(outFile, TOON_DAT_VER_MAJ); + writeByte(outFile, TOON_DAT_VER_MIN); + + // game versions/variantes + writeUint16BE(outFile, NUM_VARIANTE); + + // Write locationDirNotVisited + nbrElem = sizeof(locationDirNotVisited_EN) / sizeof(char *); + writeTextArray(outFile, locationDirNotVisited_EN, nbrElem); + + nbrElem = sizeof(locationDirNotVisited_FR) / sizeof(char *); + writeTextArray(outFile, locationDirNotVisited_FR, nbrElem); + + nbrElem = sizeof(locationDirNotVisited_DE) / sizeof(char *); + writeTextArray(outFile, locationDirNotVisited_DE, nbrElem); + + nbrElem = sizeof(locationDirNotVisited_RU) / sizeof(char *); + writeTextArray(outFile, locationDirNotVisited_RU, nbrElem); + + nbrElem = sizeof(locationDirNotVisited_SP) / sizeof(char *); + writeTextArray(outFile, locationDirNotVisited_SP, nbrElem); + + // Write locationDirVisited + nbrElem = sizeof(locationDirVisited_EN) / sizeof(char *); + writeTextArray(outFile, locationDirVisited_EN, nbrElem); + + nbrElem = sizeof(locationDirVisited_FR) / sizeof(char *); + writeTextArray(outFile, locationDirVisited_FR, nbrElem); + + nbrElem = sizeof(locationDirVisited_DE) / sizeof(char *); + writeTextArray(outFile, locationDirVisited_DE, nbrElem); + + nbrElem = sizeof(locationDirVisited_RU) / sizeof(char *); + writeTextArray(outFile, locationDirVisited_RU, nbrElem); + + nbrElem = sizeof(locationDirVisited_SP) / sizeof(char *); + writeTextArray(outFile, locationDirVisited_SP, nbrElem); + + // Write specialInfoLine + nbrElem = sizeof(specialInfoLine_EN) / sizeof(char *); + writeTextArray(outFile, specialInfoLine_EN, nbrElem); + + nbrElem = sizeof(specialInfoLine_FR) / sizeof(char *); + writeTextArray(outFile, specialInfoLine_FR, nbrElem); + + nbrElem = sizeof(specialInfoLine_DE) / sizeof(char *); + writeTextArray(outFile, specialInfoLine_DE, nbrElem); + + nbrElem = sizeof(specialInfoLine_RU) / sizeof(char *); + writeTextArray(outFile, specialInfoLine_RU, nbrElem); + + nbrElem = sizeof(specialInfoLine_SP) / sizeof(char *); + writeTextArray(outFile, specialInfoLine_SP, nbrElem); + +// Not yet handled : miscTexts, endingLine and exitLine. Are they useful? + + fclose(outFile); + return 0; +} + +void writeTextArray(FILE *outFile, const char *textArray[], int nbrText) { + int len, len1, pad; + uint8 padBuf[DATAALIGNMENT]; + + for (int i = 0; i < DATAALIGNMENT; i++) + padBuf[i] = 0; + + writeUint16BE(outFile, nbrText); + len = DATAALIGNMENT - 2; + for (int i = 0; i < nbrText; i++) { + len1 = strlen(textArray[i]) + 1; + pad = DATAALIGNMENT - (len1 + 2) % DATAALIGNMENT; + len += 2 + len1 + pad; + } + writeUint16BE(outFile, len); + + fwrite(padBuf, DATAALIGNMENT - 2, 1, outFile); // padding + for (int i = 0; i < nbrText; i++) { + len = strlen(textArray[i]) + 1; + pad = DATAALIGNMENT - (len + 2) % DATAALIGNMENT; + + writeUint16BE(outFile, len + pad + 2); + fwrite(textArray[i], len, 1, outFile); + fwrite(padBuf, pad, 1, outFile); + } +} + diff --git a/tools/create_toon/create_toon.h b/tools/create_toon/create_toon.h new file mode 100644 index 0000000000..0695944b17 --- /dev/null +++ b/tools/create_toon/create_toon.h @@ -0,0 +1,47 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ + +#ifndef CREATE_TOON_H +#define CREATE_TOON_H + +#define ARRAYSIZE(x) ((int)(sizeof(x) / sizeof(x[0]))) + +#define DATAALIGNMENT 4 + +#define TOON_DAT_VER_MAJ 0 // 1 byte +#define TOON_DAT_VER_MIN 3 // 1 byte + +// Number of Variante of the game. For the moment, it's the same +// than the number of languages +#define NUM_VARIANTE 5 + +typedef unsigned char uint8; +typedef unsigned char byte; +typedef unsigned short uint16; +typedef signed short int16; + +void writeTextArray(FILE *outFile, const char *textData[], int nbrText); + +#endif // CREATE_TOON_H diff --git a/tools/create_toon/dists/msvc9/create_toon.sln b/tools/create_toon/dists/msvc9/create_toon.sln new file mode 100644 index 0000000000..e9c3750590 --- /dev/null +++ b/tools/create_toon/dists/msvc9/create_toon.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "create_toon", "create_toon.vcproj", "{5F280130-349D-11DD-AE16-0800200C9A66}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5F280130-349D-11DD-AE16-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 + {5F280130-349D-11DD-AE16-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 + {5F280130-349D-11DD-AE16-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 + {5F280130-349D-11DD-AE16-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/tools/create_toon/dists/msvc9/create_toon.vcproj b/tools/create_toon/dists/msvc9/create_toon.vcproj new file mode 100644 index 0000000000..f860b8b201 --- /dev/null +++ b/tools/create_toon/dists/msvc9/create_toon.vcproj @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/create_toon/module.mk b/tools/create_toon/module.mk new file mode 100644 index 0000000000..761afb7a7f --- /dev/null +++ b/tools/create_toon/module.mk @@ -0,0 +1,10 @@ +MODULE := tools/create_toon + +MODULE_OBJS := \ + create_toon.o + +# Set the name of the executable +TOOL_EXECUTABLE := create_toon + +# Include common rules +include $(srcdir)/rules.mk diff --git a/tools/create_toon/staticdata.h b/tools/create_toon/staticdata.h new file mode 100644 index 0000000000..b8e68406ec --- /dev/null +++ b/tools/create_toon/staticdata.h @@ -0,0 +1,324 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ + +#ifndef STATICDATA_H +#define STATICDATA_H + +const char *locationDirNotVisited_EN[] = { + "Lab", "Path", "Outside", "Pothole", "Palace Hallway", + "Door", "Secret Passage", "Doorway", "Doorway", "DUMMY", + "Path", "Shop", "Shop", "Shop", "Shop", + "Path", "Malevolated Countryside", "Malevolated Countryside", "Entrance", "Entrance", + "Path", "Path", "Central Zanydu", "Lower Zanydu", "Wacme Entrance", + "Upper Zanydu", "Entrance", "Entrance", "Path", "Path", + "Path", "Seedy's", "Entrance", "Entrance", "Path", + "DUMMY", "DUMMY", "Dungeon", "Hallway", "Air Vent", + "Upstairs", "Doorway", "Doorway", "Downstairs", "Rec Room", + "Doorway", "Secret Passageway", "Upstairs", "Upstairs", "Up", + "Doorway", "Upstairs", "Doorway", "Doorway", "Doorway", + "Swamp", "Forest", "Meadow", "Farmland", "Main Street", + "Costume Shop", "Shuttle Station", "Central Zanydu", "Upper North-Southeast Zanydu", "Lower South-Northwest Zanydu", + "Way-Outback", "High Road", "Frank's Lab", "Cryo-Crypt", "Fantasyworld", + "Vulture Falls", "Vulture Falls", "Vincent van Gogh's Studio", "Fearworld", "Attic", + "Unorthodontist's Office", "Bedroom", "The Malevolands", "Inhuman Robots, Inc.", "Inhuman Robots, Inc. Workshop", + "The End of the World", "Castle Ramparts", "Castle Top", "Kitchen", "Living Room", + "Bedroom", "Laboratory", "Storage Center First Floor", "Storage Center Second Floor", "Storage Center Third Floor", + "King Hugh's Palace", "Trophy Room", "Hallway", "Hallway", "Throne Room", + "Office", "Balcony", "Lighthouse", "Bedroom", "Hall of Reflection", + "Seedy's", "Barn", "WACME", "Lab" +}; + +const char *locationDirNotVisited_FR[] = { + "Labo", "Chemin", "Ext\351rieur", "Trou", "Hall du Palais", + "Porte", "Passage Secret", "Porte", "Porte", "DUMMY", + "Chemin", "Boutique", "Boutique", "Boutique", "Boutique", + "Chemin", "Champ perfidifi\351", "Champ perfidifi\351", "Entr\351e", "Entr\351e", + "Chemin", "Chemin", "Zanydu-Centre", "Bas de Zanydu", "Entr\351e des 3 Belges", + "Hauts de Zanydu", "Entr\351e", "Entr\351e", "Chemin", "Chemin", + "Chemin", "Bouling", "Entr\351e", "Entr\351e", "Chemin", + "DUMMY", "DUMMY", "Donjon", "Hall", "Conduit d'a\351ration", + "Etage sup\351rieur", "Porte", "Porte", "Etage inf\351rieur", "Salle de jeux", + "Porte", "Passage Secret", "Etage sup\351rieur", "Etage sup\351rieur", "Vers le haut", + "Porte", "Etage sup\351rieur", "Porte", "Porte", "Porte", + "Mar\351cage", "For\352t", "Prairie", "Champ", "Rue Principale", + "Boutique de costumes", "Gare Navette", "Zanydu-Centre", "Hauts de Zanydu Sud-Est du Nord", "Bas de Zanydu Nord-Ouest du Sud", + "Lointain lointain", "High Road", "Labo de Frank", "Cryo-Crypt", "Fantasyworld", + "Vulture Falls", "Vulture Falls", "Vincent van Gogh's Studio", "Fearworld", "Grenier", + "Unorthodontist's Office", "Chambre", "Perfidia", "Robots Inhumains SARL", "Robots Inhumains SARL. Atelier", + "La Fin du Monde", "Remparts du ch\342teau", "Castle Top", "Cuisine", "Salon", + "Chambre", "Laboratoire", "Storage Center First Floor", "Storage Center Second Floor", "Storage Center Third Floor", + "Ch\342teau de Hilarius 1er", "Salle des Troph\351es", "Hall", "Hall", "Salle du Tr\364ne", + "Bureau", "Balcon", "Lighthouse", "Chambre", "Hall of Reflection", + "Bouling", "Grange", "LES 3 BELGES", "Labo" +}; + +const char *locationDirNotVisited_DE[] = { + "Labor", "Weg", "Drau\337en", "Schlagloch", "Palastflur", + "T\374r", "Geheimgang", "T\374r", "T\374r", "DUMMY", + "Weg", "Laden", "Laden", "Laden", "Laden", + "Weg", "\334belierte Landschaft", "\334belierte Landschaft", "Eingang", "Eingang", + "Weg", "Weg", "Mittel-Trickreich", "Nieder-Trickreich", "Eingang der Fa. Wacme", + "Ober-Trickreich", "Eingang", "Eingang", "Weg", "Weg", + "Weg", "Seedys", "Eingang", "Eingang", "Weg", + "DUMMY", "DUMMY", "Kerker", "Flur", "Luftschacht", + "Nach oben", "T\374r", "T\374r", "Nach unten", "Ruheraum", + "T\374r", "Geheimgang", "Nach oben", "Nach oben", "Rauf", + "T\374r", "Nach oben", "T\374r", "T\374r", "T\374r", + "Sumpf", "Wald", "Wiese", "Ackerland", "Hauptstra\337e", + "Kost\374mverleih", "Bahnhaltestelle", "Mittel-Trickreich", "Ober-Nord-S\374dost-Trickreich", "Unteres S\374d-Nordwest-Trickreich", + "Weite W\374ste Wildnis", "Hochstra\337e", "Franks Labor", "K\344lteschlafkammer", "Phantasiawelt", + "Geierf\344lle", "Geierf\344lle", "Vincent van Goghs Studio", "Angstwelt", "Dachboden", + "Praxis des Unorthodontisten", "Schlafzimmer", "Das \334beland", "Unmenschliche Roboter AG", "Unmenschliche Roboter AG - Werkstatt", + "Das Ende der Welt", "Schlo\337w\344lle", "Oberer Teil des Schlosses", "K\374che", "Wohnzimmer", + "Schlafzimmer", "Labor", "Lager 1. Stock", "Lager 2. Stock", "Lager 3. Stock", + "K\366nig Nicks Palast", "Pokalsaal", "Flur", "Flur", "Thronsaal", + "B\374ro", "Balkon", "Leuchtturm", "Schlafzimmer", "Saal der Reflektion", + "Seedys", "Scheune", "WACME", "Labor" +}; + +const char *locationDirNotVisited_RU[] = { + "YBB", "Nelf", "Ds[jl", "Hsndbyf", "Dtcnb,.km", + "D[jl", "Nfqysq ghj[jl", "Ghj[jl", "Ghj[jl", "VFRTN", + "Nelf", "Ijg", "Ijg", "Ijg", "Ijg", + "Nelf", "Bcrjdthrfyyfz ptvkz", "Bcrjdthrfyyfz ptvkz", "D[jl", "D[jl", + "Nelf", "Nelf", "Wtynh", "Yb;yzz pjyf", "Gfhflysq d[jl", + "Dth[yzz pjyf", "D[jl", "D[jl", "Nelf", "Nelf", + "Nelf", "D[jl", "D[jl", "D[jl", "Nelf", + "VFRTN", "VFRTN", "Gjldfk", "Rjhbljh", "Kfp", + "Ddth[", "Ghj[jl", "Ghj[jl", "Dybp", "Buhjdfz", + "Ghj[jl", "Nfqysq ghj[jl", "Ddth[", "Ddth[", "!", + "Ghj[jl", "Ddth[", "Ghj[jl", "Ghj[jl", "Ghj[jl", + "Njgm", "Ktc", "Keu", "Athvf", "Ghjcgtrn", + "Jlt;lf", "Cnfywbz", "Wtynh", "Dth[ybq Ctdthj-.uj-djcnjr", "Yb;ybq >uj-ctdthj-pfgfl", + "Jrhfbyf", "Ljhjuf", "Kf,jhfnjhbz", "Crktg", "Vbh Afynfpbq", + "Cnthdjgfl", "Cnthdjgfl", "Cnelbz Dbyctynf dfy Ujuf", "Rjivfhbz", "Fnnbr", + "Rf,bytn Ytjhnjljrcf", "Cgfkmyz", "Pkjdtybz", "FJPN +Ytuevfyjbl+", "Vfcnthcrfz FJPN +Ytuevfyjbl+", + "Rhfq cdtnf", "Rhtgjcnyjq dfk", "uj-ctdthj-pfgfl", + "Jrhfbyf", "Ljhjuf", "Kf,jhfnjhbz", "Crktg", "Vbh Afynfpbq", + "Cnthdjgfl", "Cnthdjgfl", "Cnelbz Dbyctynf dfy Ujuf", "Rjivfhbz", "Fnnbr", + "Rf,bytn Ytjhnjljrcf", "Cgfkmyz", "Pkjdtybz", "FJPN +Ytuevfyjbl+", "Vfcnthcrfz FJPN +Ytuevfyjbl+", + "Rhfq cdtnf", "Rhtgjcnyjq dfk", "