diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/README | 14 | ||||
-rw-r--r-- | tools/agi-palex.py | 12 | ||||
-rw-r--r-- | tools/convbdf.c | 44 | ||||
-rw-r--r-- | tools/create_kyradat/Makefile | 4 | ||||
-rw-r--r-- | tools/create_kyradat/create_kyradat.cpp | 100 | ||||
-rw-r--r-- | tools/create_kyradat/create_kyradat.h | 8 | ||||
-rw-r--r-- | tools/create_kyradat/hof_floppy.h | 2 | ||||
-rw-r--r-- | tools/create_kyradat/hof_towns.h | 2 | ||||
-rw-r--r-- | tools/create_kyradat/md5.cpp | 2 | ||||
-rw-r--r-- | tools/create_kyradat/pak.cpp | 38 | ||||
-rw-r--r-- | tools/create_kyradat/pak.h | 12 | ||||
-rw-r--r-- | tools/create_kyradat/towns.h | 16 | ||||
-rw-r--r-- | tools/create_kyradat/util.h | 2 | ||||
-rw-r--r-- | tools/create_lure/create_lure_dat.cpp | 284 | ||||
-rw-r--r-- | tools/create_lure/create_lure_dat.h | 12 | ||||
-rw-r--r-- | tools/create_lure/process_actions.cpp | 66 | ||||
-rwxr-xr-x | tools/credits.pl | 30 | ||||
-rw-r--r-- | tools/md5table.c | 10 | ||||
-rw-r--r-- | tools/module.mk | 2 | ||||
-rw-r--r-- | tools/skycpt/KmpSearch.cpp | 8 | ||||
-rw-r--r-- | tools/skycpt/ReadMe.txt | 2 | ||||
-rw-r--r-- | tools/skycpt/cptcompiler.cpp | 12 | ||||
-rw-r--r-- | tools/skycpt/idFinder.cpp | 2 | ||||
-rwxr-xr-x | tools/update-version.pl | 4 |
24 files changed, 344 insertions, 344 deletions
diff --git a/tools/README b/tools/README index d1c9e08e8d..8e5a267daf 100644 --- a/tools/README +++ b/tools/README @@ -6,12 +6,12 @@ at all, documented. Use at your own risk. You've been warned :-) convbdf ------- Tool which converts BDF fonts (BDF = Bitmap Distribution Format) to C++ - source. That source, after being slightly tweaked, can be used to + source. That source, after being slightly tweaked, can be used to replace or add fonts for the ScummVM GUI. - + There is also a ttf2bdf tool which allows you to convert TrueType fonts to BDF. - + Hint from SumthinWicked: If you use ttf2bdf, it'll convert all glyphs to bitmaps, but ScummVM only needs some of them. So you may want to do your conversion like this: @@ -32,15 +32,15 @@ dist-scummvm.sh releases. After tagging a branch for release, you can invoke it like this: ./dist-scummvm.sh scummvm 0.7.1 - + Note #1: This creates .zip, .tar.bz2 and .tar.gz archives in /tmp by default. To do that it performs a "cvs export" in /tmp first. If you want to use another location, you can specify it as the thirds param to the script. - - Note #2: This assumes that our naming conventions for release tags are + + Note #2: This assumes that our naming conventions for release tags are being followed. I.e. the tag must be named "release-0-7-1" in the above example. You can, however, specify an alternate tag as the fourth param. - + Note #3: Since SF.net anon CVS tends to lag behind developer CVS, if you just tagged CVS, anon CVS may not yet have this. So if you are in a hurry, modify the cvsroot in the script to use your dev CVS account. diff --git a/tools/agi-palex.py b/tools/agi-palex.py index 58306dddbe..1e0fa9d54f 100644 --- a/tools/agi-palex.py +++ b/tools/agi-palex.py @@ -67,7 +67,7 @@ def printPalette(palette, filename, arrayname): comments = ["A 16-color, 12-bit RGB palette from an Amiga AGI game."] comments.append("Extracted from file " + os.path.basename(filename)) printCommentLineList(comments) - + # Print the palette as a C-style array print "static const unsigned char " + arrayname + "[] = {" for color in palette[:-1]: @@ -80,20 +80,20 @@ def isAmigaPalette(palette): # Palette must be of correct size if len(palette) != colorsPerPalette: return False - + # First palette color must be black and last palette color must be black if palette[whiteColorNum] != decodedWhite or palette[blackColorNum] != decodedBlack: return False - + # All colors must be 12-bit (i.e. 4 bits per color component) for color in palette: if not isColor12Bit(color): return False - + # All colors must be unique if len(set(palette)) != colorsPerPalette: return False - + return True def preliminaryPaletteTest(data, pos): @@ -128,7 +128,7 @@ def searchForAmigaPalettes(filename): # Save good candidates to a list if isAmigaPalette(palette): foundPalettes.append(tuple(palette)) - # Close source file and return unique found palettes + # Close source file and return unique found palettes file.close() return set(foundPalettes) except IOError: diff --git a/tools/convbdf.c b/tools/convbdf.c index 55de73a648..526f34bdf5 100644 --- a/tools/convbdf.c +++ b/tools/convbdf.c @@ -83,7 +83,7 @@ struct font { BBX* bbx; /* character bounding box or NULL if fixed*/ int defaultchar; /* default char (not glyph index)*/ long bits_size; /* # words of bitmap_t bits*/ - + /* unused by runtime system, read in by convbdf*/ char * facename; /* facename of font*/ char * copyright; /* copyright info for loadable fonts*/ @@ -161,11 +161,11 @@ void getopts(int *pac, char ***pav) const char *p; char **av; int ac; - + ac = *pac; av = *pav; while (ac > 0 && av[0][0] == '-') { - p = &av[0][1]; + p = &av[0][1]; while (*p) { switch (*p++) { case ' ': /* multiple -args on av[]*/ @@ -254,7 +254,7 @@ int convbdf(char *path) pf = bdf_read_font(path); if (!pf) exit(1); - + if (!oflag) { strcpy(outfile, basename(path)); strcat(outfile, ".cpp"); @@ -280,12 +280,12 @@ int main(int ac, char *av[]) usage(); exit(1); } - + while (ac > 0) { ret |= convbdf(av[0]); ++av; --ac; } - + exit(ret); } @@ -313,11 +313,11 @@ struct font* bdf_read_font(char *path) fprintf(stderr, "Error opening file: %s\n", path); return NULL; } - + pf = (struct font*)calloc(1, sizeof(struct font)); if (!pf) goto errout; - + pf->name = strdup(basename(path)); if (!bdf_read_header(fp, pf)) { @@ -422,8 +422,8 @@ int bdf_read_header(FILE *fp, struct font* pf) fprintf(stderr, "Error: bad 'ENCODING'\n"); return 0; } - if (encoding >= 0 && - encoding <= limit_char && + if (encoding >= 0 && + encoding <= limit_char && encoding >= start_char) { if (firstchar > encoding) @@ -445,15 +445,15 @@ int bdf_read_header(FILE *fp, struct font* pf) pf->height = pf->ascent + pf->descent; /* calc default char*/ - if (pf->defaultchar < 0 || - pf->defaultchar < firstchar || + if (pf->defaultchar < 0 || + pf->defaultchar < firstchar || pf->defaultchar > limit_char ) pf->defaultchar = firstchar; /* calc font size (offset/width entries)*/ pf->firstchar = firstchar; pf->size = lastchar - firstchar + 1; - + /* use the font boundingbox to get initial maxwidth*/ /*maxwidth = pf->fbbw - pf->fbbx;*/ maxwidth = pf->fbbw; @@ -466,7 +466,7 @@ int bdf_read_header(FILE *fp, struct font* pf) pf->offset = (unsigned long *)malloc(pf->size * sizeof(unsigned long)); pf->width = (unsigned char *)malloc(pf->size * sizeof(unsigned char)); pf->bbx = (BBX *)malloc(pf->size * sizeof(BBX)); - + if (!pf->bits || !pf->offset || !pf->width) { fprintf(stderr, "Error: no memory for font load\n"); return 0; @@ -570,7 +570,7 @@ int bdf_read_bitmaps(FILE *fp, struct font* pf) for (k = 0; k < ch_words; ++k) { bitmap_t value; - + value = bdf_hexval((unsigned char *)buf); if (bbw > 8) { @@ -714,7 +714,7 @@ bitmap_t bdf_hexval(unsigned char *buf) { c = c - 'A' + 10; else if (c >= 'a' && c <= 'f') c = c - 'a' + 10; - else + else c = 0; val = (val << 4) | c; } @@ -767,7 +767,7 @@ int gen_c_source(struct font* pf, char *path) strcpy(buf, ctime(&t)); buf[strlen(buf) - 1] = 0; - fprintf(ofp, hdr1, buf, + fprintf(ofp, hdr1, buf, pf->name, pf->facename? pf->facename: "", pf->maxwidth, pf->height, @@ -796,7 +796,7 @@ int gen_c_source(struct font* pf, char *path) * the default character in encode map, or the default * character hasn't been generated yet. */ - if (pf->offset && + if (pf->offset && (pf->offset[i] == pf->offset[pf->defaultchar-pf->firstchar])) { if (did_defaultchar) continue; @@ -849,7 +849,7 @@ int gen_c_source(struct font* pf, char *path) fprintf(stderr, "Warning: found encoding values in non-sorted order (not an error).\n"); did_syncmsg = 1; } - } + } } fprintf(ofp, "};\n\n"); @@ -859,7 +859,7 @@ int gen_c_source(struct font* pf, char *path) "static const unsigned long _sysfont_offset[] = {\n"); for (i = 0; i < pf->size; ++i) - fprintf(ofp, " %ld,\t/* (0x%02x) */\n", + fprintf(ofp, " %ld,\t/* (0x%02x) */\n", pf->offset[i], i+pf->firstchar); fprintf(ofp, "};\n\n"); } @@ -870,7 +870,7 @@ int gen_c_source(struct font* pf, char *path) "static const unsigned char _sysfont_width[] = {\n"); for (i = 0; i < pf->size; ++i) - fprintf(ofp, " %d,\t/* (0x%02x) */\n", + fprintf(ofp, " %d,\t/* (0x%02x) */\n", pf->width[i], i+pf->firstchar); fprintf(ofp, "};\n\n"); } @@ -936,6 +936,6 @@ int gen_c_source(struct font* pf, char *path) fprintf(ofp, "DEFINE_FONT(g_sysfont)\n"); fprintf(ofp, "#endif\n"); fprintf(ofp, "\n} // End of namespace Graphics\n"); - + return 0; } diff --git a/tools/create_kyradat/Makefile b/tools/create_kyradat/Makefile index 7319ad0658..b4deafe6d4 100644 --- a/tools/create_kyradat/Makefile +++ b/tools/create_kyradat/Makefile @@ -1,10 +1,10 @@ CXX ?= g++ CC ?= gcc -LDFLAGS ?= +LDFLAGS ?= CXXFLAGS ?= -O2 CFLAGS ?= -O2 -CPPFLAGS ?= +CPPFLAGS ?= BIN=create_kyradat diff --git a/tools/create_kyradat/create_kyradat.cpp b/tools/create_kyradat/create_kyradat.cpp index af002b5935..1fcd9ae882 100644 --- a/tools/create_kyradat/create_kyradat.cpp +++ b/tools/create_kyradat/create_kyradat.cpp @@ -123,7 +123,7 @@ const ExtractFilename extractFilenames[] = { // GUI strings table { kGUIStrings, kTypeLanguageList, "GUISTRINGS" }, { kConfigStrings, kTypeLanguageList, "CONFIGSTRINGS" }, - + // ROOM table/filenames { kRoomList, kTypeRoomList, "ROOM-TABLE.ROOM" }, { kRoomFilenames, kTypeStringList, "ROOM-FILENAMES.TXT" }, @@ -186,7 +186,7 @@ const ExtractFilename extractFilenames[] = { { kPaletteList31, kTypeRawData, "PALTABLE31.PAL" }, { kPaletteList32, kTypeRawData, "PALTABLE32.PAL" }, { kPaletteList33, kTypeRawData, "PALTABLE33.PAL" }, - + // FM-TOWNS specific { kKyra1TownsSFXwdTable, kTypeRawData, "SFXWDTABLE" }, { kKyra1TownsSFXbtTable, kTypeRawData, "SFXBTTABLE" }, @@ -205,14 +205,14 @@ const ExtractFilename extractFilenames[] = { { k2SeqplayTlkFiles, kTypeLanguageList, "S_TLKFILES" }, { k2SeqplaySeqData, k2TypeSeqData, "S_DATA.SEQ" }, { k2SeqplayIntroTracks, kTypeStringList, "S_INTRO.TRA" }, - { k2SeqplayFinaleTracks, kTypeStringList, "S_FINALE.TRA" }, + { k2SeqplayFinaleTracks, kTypeStringList, "S_FINALE.TRA" }, { k2SeqplayIntroCDA, kTypeRawData, "S_INTRO.CDA" }, { k2SeqplayFinaleCDA, kTypeRawData, "S_FINALE.CDA" }, // Ingame { k2IngamePakFiles, kTypeStringList, "I_PAKFILES.TXT" }, { k2IngameSfxFiles, kTypeStringList, "I_SFXFILES.TXT" }, - { k2IngameSfxIndex, kTypeRawData, "I_SFXINDEX.TRA" }, + { k2IngameSfxIndex, kTypeRawData, "I_SFXINDEX.TRA" }, { k2IngameTracks, kTypeStringList, "I_TRACKS.TRA" }, { k2IngameCDA, kTypeRawData, "I_TRACKS.CDA" }, @@ -253,9 +253,9 @@ bool getFilename(char *dstFilename, const Game *g, const int id) { void createFilename(char *dstFilename, const int gid, const int lang, const int special, const char *filename) { strcpy(dstFilename, filename); - static const char *gidExtensions[] = { "", ".K2", ".K3" }; + static const char *gidExtensions[] = { "", ".K2", ".K3" }; strcat(dstFilename, gidExtensions[gid]); - + for (const SpecialExtension *specialE = specialTable; specialE->special != -1; ++specialE) { if (specialE->special == special) { strcat(dstFilename, "."); @@ -276,9 +276,9 @@ void createLangFilename(char *dstFilename, const int gid, const int lang, const } } - static const char *gidExtensions[] = { "", ".K2", ".K3" }; + static const char *gidExtensions[] = { "", ".K2", ".K3" }; strcat(dstFilename, gidExtensions[gid]); - + for (const SpecialExtension *specialE = specialTable; specialE->special != -1; ++specialE) { if (specialE->special == special) { strcat(dstFilename, "."); @@ -314,13 +314,13 @@ int hashEntries(const Game *game, const GameNeed *need, const PAKFile *file) { hash += *i; continue; } - + if (file) { filename[0] = 0; if (!getFilename(filename, game, *i)) error("couldn't find filename for id %d", *i); - + PAKFile::cFileList *list = file->getFileList(); if (list && list->findEntry(filename) != 0) hash += *i; @@ -328,7 +328,7 @@ int hashEntries(const Game *game, const GameNeed *need, const PAKFile *file) { } return hash; -} +} bool hasNeededEntries(const Game *game, const PAKFile *file) { for (const GameNeed *need = gameNeedTable; need->game != -1; ++need) { @@ -383,7 +383,7 @@ bool extractStrings(PAKFile &out, const Game *g, const byte *data, const uint32 targetsize--; } if (fmtPatch == 1) { - // Here is the first step of the extra treatment for all fm-towns string arrays that + // Here is the first step of the extra treatment for all fm-towns string arrays that // contain more than one string and which the original code // addresses via stringname[boolJapanese]. // We simply skip every other string @@ -406,7 +406,7 @@ bool extractStrings(PAKFile &out, const Game *g, const byte *data, const uint32 } } } - + if (fmtPatch == 2) { if (g->special == kFMTownsVersionE) targetsize--; @@ -423,7 +423,7 @@ bool extractStrings(PAKFile &out, const Game *g, const byte *data, const uint32 if (fmtPatch == 4) { targetsize -= 9; } - + uint8 *buffer = new uint8[targetsize]; assert(buffer); uint8 *output = buffer; @@ -465,7 +465,7 @@ bool extractStrings(PAKFile &out, const Game *g, const byte *data, const uint32 } if (fmtPatch == 1) { - // Here is the extra treatment for all fm-towns string arrays that + // Here is the extra treatment for all fm-towns string arrays that // contain more than one string and which the original code // addresses via stringname[boolJapanese]. // We simply skip every other string @@ -610,7 +610,7 @@ bool extractHofSeqData(PAKFile &out, const Game *g, const byte *data, const uint memcpy(output , ptr, 30); ptr += 30; output += 30; - + if (g->special == k2TownsFile1E) { memcpy(output , ptr, 2); ptr += 2; @@ -620,7 +620,7 @@ bool extractHofSeqData(PAKFile &out, const Game *g, const byte *data, const uint ptr += 2; *output++ = READ_LE_UINT16(ptr) & 0xff; ptr += 2; - } + } memcpy(output, ptr, 14); ptr += 18; @@ -651,7 +651,7 @@ bool extractHofSeqData(PAKFile &out, const Game *g, const byte *data, const uint memcpy(output, ctrStart, ctrSize); output += ctrSize; } - } + } numNestedSequences++; uint16 relOffs = (uint16) (output - buffer); @@ -674,7 +674,7 @@ bool extractHofSeqData(PAKFile &out, const Game *g, const byte *data, const uint controlOffs = 0; //else if (controlOffs) // debug(1, "assigning frame control with output file offset 0x%x to item %s (output file offset: 0x%x)", controlOffs, cc, relOffs); - + WRITE_LE_UINT16(output, controlOffs); if (g->special != k2DemoVersion) ptr += 4; @@ -726,7 +726,7 @@ bool extractHofSeqData(PAKFile &out, const Game *g, const byte *data, const uint assert(finBuffer); uint16 diff = headerSize - finHeaderSize; uint16 *finHeader = (uint16*) finBuffer; - + for (int i = 1; i < finHeaderSize; i++) WRITE_LE_UINT16(&finHeader[i], (READ_LE_UINT16(&header[i]) - diff)); WRITE_LE_UINT16(finHeader, numSequences); @@ -760,7 +760,7 @@ int extractHofSeqData_checkString(const void *ptr, uint8 checkSize) { while (c--) { if (*s > 31 && *s < 123) t++; - s++; + s++; } if (t == checkSize) @@ -781,7 +781,7 @@ int extractHofSeqData_isSequence(const void *ptr, const Game *g, uint32 maxCheck if (maxCheckSize < 30) return -2; - + const uint8 * s = (const uint8*)ptr; int c1 = extractHofSeqData_checkString(s + 2, 6); int c2 = extractHofSeqData_checkString(s + 16, 6); @@ -806,11 +806,11 @@ int extractHofSeqData_isSequence(const void *ptr, const Game *g, uint32 maxCheck if (c0 == 0 && c5 == 4 && c3 == 0 && c4 == 0) { if (maxCheckSize >= 41 && READ_LE_UINT32(s + 34) && !(s[39] | s[41]) && s[40] > s[38]) return 1; - } + } if (c0 == 0 && c5 && c1 == 1 && c4 == -1 && s[20]) return 0; - + return -1; } @@ -876,7 +876,7 @@ uint32 getFeatures(const Game *g) { features |= GF_ITALIAN; else if (g->lang == JA_JPN) features |= GF_JAPANESE; - + return features; } @@ -895,7 +895,7 @@ bool updateIndex(byte *dst, const int dstSize, const Game *g) { bool checkIndex(const byte *s, const int srcSize) { if ((size_t)srcSize < sizeof(uint32)) - return false; + return false; uint32 version = READ_BE_UINT32(s); return (version == kKyraDatVersion); } @@ -903,28 +903,28 @@ bool checkIndex(const byte *s, const int srcSize) { bool updateIndex(PAKFile &out, const Game *g) { char filename[32]; createFilename(filename, g->game, -1, g->special, "INDEX"); - + byte *index = new byte[kIndexSize]; assert(index); memset(index, 0, kIndexSize); - + uint32 size = 0; const uint8 *data = out.getFileData(filename, &size); if (data) memcpy(index, data, size); - + if (!updateIndex(index, kIndexSize, g)) { delete [] index; return false; } - + out.removeFile(filename); if (!out.addFile(filename, index, kIndexSize)) { fprintf(stderr, "ERROR: couldn't update %s file", filename); delete [] index; return false; } - + return true; } @@ -955,7 +955,7 @@ int main(int argc, char *argv[]) { printHelp(argv[0]); return -1; } - + PAKFile out; out.loadFile(argv[1], false); @@ -969,10 +969,10 @@ int main(int argc, char *argv[]) { uint32 size = fileSize(input); fseek(input, 0, SEEK_SET); - + byte *buffer = new uint8[size]; assert(buffer); - + if (fread(buffer, 1, size, input) != size) { warning("couldn't read from file '%s', skipping it", argv[i]); delete [] buffer; @@ -980,23 +980,23 @@ int main(int argc, char *argv[]) { continue; } fclose(input); - + const Game *g = findGame(buffer, size); if (!g) { warning("skipping unknown file '%s'", argv[i]); delete [] buffer; continue; } - + if (!hasNeededEntries(g, &out)) { warning("file '%s' is missing offset entries and thus can't be processed", argv[i]); delete [] buffer; continue; } - + if (!process(out, g, buffer, size)) fprintf(stderr, "ERROR: couldn't process file '%s'", argv[i]); - + if (g->special == kFMTownsVersionE || g->special == k2TownsFile1E || g->special == k2TownsFile2E || g->special == k2CDFile1E || g->special == k2CDFile2E) { // This is for executables which contain support for at least 2 languages @@ -1022,7 +1022,7 @@ int main(int argc, char *argv[]) { if (!process(out, g, buffer, size)) fprintf(stderr, "ERROR: couldn't process file '%s'", argv[i]); } - + delete [] buffer; } @@ -1038,7 +1038,7 @@ int main(int argc, char *argv[]) { if (fwrite(digest, 1, 16, f) != 16) error("couldn't write md5sum to file '%s'", argv[1]); fclose(f); - + return 0; } @@ -1055,7 +1055,7 @@ bool process(PAKFile &out, const Game *g, const byte *data, const uint32 size) { fprintf(stderr, "ERROR: couldn't get filename for id %d\n", i->id); return false; } - + const ExtractFilename *fDesc = getFilenameDesc(i->id); if (!fDesc) { @@ -1064,16 +1064,16 @@ bool process(PAKFile &out, const Game *g, const byte *data, const uint32 size) { } const ExtractType *tDesc = findExtractType(fDesc->type); - + if (!tDesc) { fprintf(stderr, "ERROR: couldn't find type description for id %d\n", i->id); return false; } - + PAKFile::cFileList *list = out.getFileList(); if (list && list->findEntry(filename) != 0) continue; - + int patch = 0; if (g->special == kFMTownsVersionE || g->special == kFMTownsVersionJ) { // FM Towns files that need addional patches @@ -1081,14 +1081,14 @@ bool process(PAKFile &out, const Game *g, const byte *data, const uint32 size) { i->id == kThePoisonStrings || i->id == kFluteStrings || i->id == kWispJewelStrings) patch = 1; else if (i->id == kIntroStrings || i->id == kKyra1TownsSFXwdTable) - patch = 2; + patch = 2; } if (g->special == k2TownsFile1E || g->special == k2TownsFile1J) { if (i->id == k2SeqplayStrings) patch = 3; } - + if (g->special == k2FloppyFile2) { if (i->id == k2IngamePakFiles) patch = 4; @@ -1097,8 +1097,8 @@ bool process(PAKFile &out, const Game *g, const byte *data, const uint32 size) { if (g->special == k2FloppyFile2 || g->special == k2CDFile2E) { if (i->id == k2IngameSfxFiles) patch = 5; - } - + } + if (!tDesc->extract(out, g, data + i->startOff, i->endOff - i->startOff, filename, patch)) { fprintf(stderr, "ERROR: couldn't extract id %d\n", i->id); return false; @@ -1140,11 +1140,11 @@ const Game *findGame(const byte *buffer, const uint32 size) { md5_starts(&ctx); md5_update(&ctx, buffer, size); md5_finish(&ctx, digest); - + for (int j = 0; j < 16; ++j) { sprintf(md5str + j*2, "%02x", (int)digest[j]); } - + for (const Game **i = gameDescs; *i != 0; ++i) { for (const Game *p = *i; p->game != -1; ++p) { if (strcmp(md5str, p->md5) == 0) diff --git a/tools/create_kyradat/create_kyradat.h b/tools/create_kyradat/create_kyradat.h index 85c5f8973d..9a5c2ce033 100644 --- a/tools/create_kyradat/create_kyradat.h +++ b/tools/create_kyradat/create_kyradat.h @@ -62,7 +62,7 @@ enum kExtractID { kAudioTracks, kAudioTracksIntro, - + kItemNames, kTakenStrings, kPlacedStrings, @@ -85,7 +85,7 @@ enum kExtractID { kVeryCleverString, kNewGameString, - + kDefaultShapes, kHealing1Shapes, kHealing2Shapes, @@ -135,7 +135,7 @@ enum kExtractID { kGUIStrings, kConfigStrings, - + kKyra1TownsSFXwdTable, kKyra1TownsSFXbtTable, kKyra1TownsCDATable, @@ -158,7 +158,7 @@ enum kExtractID { k2IngameSfxIndex, k2IngameTracks, k2IngameCDA, - + kMaxResIDs }; diff --git a/tools/create_kyradat/hof_floppy.h b/tools/create_kyradat/hof_floppy.h index c446b513b4..a4aee16ced 100644 --- a/tools/create_kyradat/hof_floppy.h +++ b/tools/create_kyradat/hof_floppy.h @@ -59,6 +59,6 @@ const Game kyra2FloppyGames[] = { { kKyra2, DE_DEU, k2FloppyFile1, "0ca4f9a1438264a4c63c3218e064ed3b", kyra2File1G}, { kKyra2, EN_ANY, k2FloppyFile2, "7c3eadbe5122722cf2e5e1611e19dfb9", kyra2File2E}, { kKyra2, FR_FRA, k2FloppyFile2, "fc2c6782778e6c6d5a553d1cb73c98ad", kyra2File2F}, - { kKyra2, DE_DEU, k2FloppyFile2, "0d9b0eb7b0ad889ec942d74d80dde1bf", kyra2File2G}, + { kKyra2, DE_DEU, k2FloppyFile2, "0d9b0eb7b0ad889ec942d74d80dde1bf", kyra2File2G}, GAME_DUMMY_ENTRY }; diff --git a/tools/create_kyradat/hof_towns.h b/tools/create_kyradat/hof_towns.h index 5455e153bb..e6f3d11197 100644 --- a/tools/create_kyradat/hof_towns.h +++ b/tools/create_kyradat/hof_towns.h @@ -17,7 +17,7 @@ const ExtractEntry kyra2File2FMTownsE[] = { { k2IngamePakFiles, 0x00000540, 0x0000065C }, { k2IngameSfxFiles, 0x00003E3C, 0x000047A3 }, { k2IngameSfxIndex, 0x00013980, 0x00013CD8 }, - { k2IngameCDA, 0x0001808C, 0x000181BC }, + { k2IngameCDA, 0x0001808C, 0x000181BC }, { -1, 0, 0 } }; diff --git a/tools/create_kyradat/md5.cpp b/tools/create_kyradat/md5.cpp index 8f23d2c958..73ec80d9b0 100644 --- a/tools/create_kyradat/md5.cpp +++ b/tools/create_kyradat/md5.cpp @@ -243,7 +243,7 @@ bool md5_file(const char *name, uint8 digest[16], uint32 length) { md5_starts(&ctx); - + while ((i = (uint32)fread(buf, 1, readlen, f)) > 0) { md5_update(&ctx, buf, i); diff --git a/tools/create_kyradat/pak.cpp b/tools/create_kyradat/pak.cpp index 63e9792d23..f3446df291 100644 --- a/tools/create_kyradat/pak.cpp +++ b/tools/create_kyradat/pak.cpp @@ -39,21 +39,21 @@ bool PAKFile::loadFile(const char *file, const bool isAmiga) { // TODO: get rid of temp. buffer uint8 *buffer = new uint8[filesize]; assert(buffer); - + fread(buffer, filesize, 1, pakfile); - + fclose(pakfile); - + const char *currentName = 0; - + uint32 startoffset = _isAmiga ? READ_BE_UINT32(buffer) : READ_LE_UINT32(buffer); uint32 endoffset = 0; uint8* position = buffer + 4; - + while (true) { uint32 strlgt = strlen((const char*)position); currentName = (const char*)position; - + if (!(*currentName)) break; @@ -65,19 +65,19 @@ bool PAKFile::loadFile(const char *file, const bool isAmiga) { endoffset = filesize; } position += 4; - + uint8 *data = new uint8[endoffset - startoffset]; assert(data); memcpy(data, buffer + startoffset, endoffset - startoffset); addFile(currentName, data, endoffset - startoffset); data = 0; - + if (endoffset == filesize) break; - + startoffset = endoffset; } - + delete [] buffer; return true; } @@ -91,11 +91,11 @@ bool PAKFile::saveFile(const char *file) { error("couldn't open file '%s' for writing", file); return false; } - + // TODO: implement error handling uint32 startAddr = _fileList->getTableSize()+5+4; static const char *zeroName = "\0\0\0\0\0"; - + uint32 curAddr = startAddr; for (FileList *cur = _fileList; cur; cur = cur->next) { if (_isAmiga) @@ -110,11 +110,11 @@ bool PAKFile::saveFile(const char *file) { else writeUint32LE(f, curAddr); fwrite(zeroName, 1, 5, f); - + for (FileList *cur = _fileList; cur; cur = cur->next) fwrite(cur->data, 1, cur->size, f); - - fclose(f); + + fclose(f); return true; } @@ -176,7 +176,7 @@ const uint8 *PAKFile::getFileData(const char *file, uint32 *size) { if (!cur) return 0; - + if (size) *size = cur->size; return cur->data; @@ -187,13 +187,13 @@ bool PAKFile::addFile(const char *name, const char *file) { error("entry '%s' already exists"); return false; } - + FILE *f = fopen(file, "rb"); if (!f) { error("couldn't open file '%s'", file); return false; } - + uint32 filesize = fileSize(f); uint8 *data = new uint8[filesize]; assert(data); @@ -201,7 +201,7 @@ bool PAKFile::addFile(const char *name, const char *file) { error("couldn't read from file '%s'", file); return false; } - fclose(f); + fclose(f); return addFile(name, data, filesize); } diff --git a/tools/create_kyradat/pak.h b/tools/create_kyradat/pak.h index f81e0be011..1634411f4c 100644 --- a/tools/create_kyradat/pak.h +++ b/tools/create_kyradat/pak.h @@ -34,7 +34,7 @@ public: bool loadFile(const char *file, const bool isAmiga); bool saveFile(const char *file); void clearFile() { delete _fileList; _fileList = 0; } - + const uint32 getFileSize() const { return _fileList->getTableSize()+5+4+_fileList->getFileSize(); } void drawFileList(); @@ -47,7 +47,7 @@ public: bool addFile(const char *name, const char *file); bool addFile(const char *name, uint8 *data, uint32 size); - + bool removeFile(const char *name); public: struct FileList { @@ -57,7 +57,7 @@ public: delete [] data; delete next; } - + FileList *findEntry(const char *f) { for (FileList *cur = this; cur; cur = cur->next) { if (scumm_stricmp(cur->filename, f) != 0) @@ -66,7 +66,7 @@ public: } return 0; } - + const FileList *findEntry(const char *f) const { for (const FileList *cur = this; cur; cur = cur->next) { if (scumm_stricmp(cur->filename, f) != 0) @@ -92,12 +92,12 @@ public: char *filename; uint32 size; uint8 *data; - + FileList *next; }; typedef const FileList cFileList; - + cFileList *getFileList() const { return _fileList; } private: FileList *_fileList; diff --git a/tools/create_kyradat/towns.h b/tools/create_kyradat/towns.h index 4df7c05b0e..4e632ec571 100644 --- a/tools/create_kyradat/towns.h +++ b/tools/create_kyradat/towns.h @@ -10,12 +10,12 @@ const ExtractEntry kyra1FMTownsE[] = { { kIntroCOLStrings, 0x00027E06, 0x00027E36 }, { kIntroStrings, 0x00027E36, 0x0002837B }, { kRoomList, 0x0002FF90, 0x00036478 }, - { kRoomFilenames, 0x00028B20, 0x00028E6C}, + { kRoomFilenames, 0x00028B20, 0x00028E6C}, { kCharacterImageFilenames, 0x0002606E, 0x00026165 }, { kDefaultShapes, 0x00037CF9, 0x00038183 }, - { kItemNames, 0x00029724, 0x00029C29 }, + { kItemNames, 0x00029724, 0x00029C29 }, { kTakenStrings, 0x00028978, 0x00028994 }, - { kPlacedStrings, 0x000289A0, 0x000289A9 }, + { kPlacedStrings, 0x000289A0, 0x000289A9 }, { kDroppedStrings, 0x000289E4, 0x000289EE }, { kNoDropStrings, 0x00027C0E, 0x00027C88 }, { kAmuleteAnimSeq, 0x0002A814, 0x0002A83E }, @@ -52,7 +52,7 @@ const ExtractEntry kyra1FMTownsE[] = { { kPaletteList31, 0x0002ED27, 0x0002ED4E }, { kPaletteList32, 0x0002ED4F, 0x0002ED76 }, { kPaletteList33, 0x0002ED77, 0x0002EDB3 }, - { kPutDownString, 0x00025BD6, 0x00025BFC }, + { kPutDownString, 0x00025BD6, 0x00025BFC }, { kWaitAmuletString, 0x00025C2A, 0x00025C67 }, { kBlackJewelString, 0x00025C96, 0x00025CB9 }, { kHealingTipString, 0x00025CF2, 0x00025D1F }, @@ -89,13 +89,13 @@ const ExtractEntry kyra1FMTownsE[] = { }; const ExtractEntry kyra1FMTownsJ[] = { - { kIntroStrings, 0x0002837C, 0x00028977 }, - { kItemNames, 0x00029C2C, 0x0002A1B3 }, + { kIntroStrings, 0x0002837C, 0x00028977 }, + { kItemNames, 0x00029C2C, 0x0002A1B3 }, { kTakenStrings, 0x00028980, 0x0002899F }, - { kPlacedStrings, 0x000289AC, 0x000289B9 }, + { kPlacedStrings, 0x000289AC, 0x000289B9 }, { kDroppedStrings, 0x000289F0, 0x000289FB }, { kNoDropStrings, 0x00027C3E, 0x00027C9F }, - { kPutDownString, 0x00025BFE, 0x00025C27 }, + { kPutDownString, 0x00025BFE, 0x00025C27 }, { kWaitAmuletString, 0x00025C6A, 0x00025C93 }, { kBlackJewelString, 0x00025CBA, 0x00025CEF }, { kHealingTipString, 0x00025D22, 0x00025D4D }, diff --git a/tools/create_kyradat/util.h b/tools/create_kyradat/util.h index c22e07f523..8ce6e8acb2 100644 --- a/tools/create_kyradat/util.h +++ b/tools/create_kyradat/util.h @@ -80,7 +80,7 @@ typedef uint8 bool; #define START_PACK_STRUCTS pack(push, 1) #define END_PACK_STRUCTS pack(pop) - + #elif defined(__MINGW32__) #define scumm_stricmp stricmp diff --git a/tools/create_lure/create_lure_dat.cpp b/tools/create_lure/create_lure_dat.cpp index a89593d9c5..445a65fb80 100644 --- a/tools/create_lure/create_lure_dat.cpp +++ b/tools/create_lure/create_lure_dat.cpp @@ -22,8 +22,8 @@ * $Id$ * * This is a utility for extracting needed resource data from different language - * version of the Lure of the Temptress lure.exe executable files into a new file - * lure.dat - this file is required for the ScummVM Lure of the Temptress module + * version of the Lure of the Temptress lure.exe executable files into a new file + * lure.dat - this file is required for the ScummVM Lure of the Temptress module * to work properly */ @@ -92,16 +92,16 @@ AnimListRecord animDataList[] = { {{0x5647, 0x5707, 0x5727, 0x5757, 0x5727}}, // Pig recoiling from hit {{0x5650, 0x5710, 0x5730, 0x5760, 0x5730}}, // Pig dies {{0x5810, 0x58D0, 0x58F0, 0x5920, 0x58f0}}, // Voice bubble - {{0x5915, 0x59D5, 0x59F5, 0x5a25, 0x59f5}}, // Blacksmith hammering + {{0x5915, 0x59D5, 0x59F5, 0x5a25, 0x59f5}}, // Blacksmith hammering {{0x59E4, 0x5AA4, 0x5AC4, 0x5af4, 0x5ac4}}, // Ewan's standard animation {{0x59ED, 0x5AAD, 0x5ACD, 0x5afd, 0x5acd}}, // Ewan's alternate animation {{0x59FF, 0x5ABF, 0x5ADF, 0x5b0f, 0x5adf}}, // Dragon breathing fire {{0x5A08, 0x5AC8, 0x5AE8, 0x5b18, 0x5af1}}, // Dragon breathing fire 2 {{0x5A11, 0x5AD1, 0x5AF1, 0x5b21, 0x5af1}}, // Dragon breathing fire 3 {{0x5A1A, 0x5ADA, 0x5AFA, 0x5b2a, 0x5afa}}, // Player turning winch in room #48 - {{0x5A59, 0x5B19, 0x5B39, 0x5b69, 0x5b39}}, // Player pulling lever in room #48 + {{0x5A59, 0x5B19, 0x5B39, 0x5b69, 0x5b39}}, // Player pulling lever in room #48 {{0x5A62, 0x5B22, 0x5B42, 0x5b72, 0x5b42}}, // Minnow pulling lever in room #48 - {{0x5AAA, 0x5B6A, 0x5B8A, 0x5bba, 0x5b8a}}, // Goewin mixing potion + {{0x5AAA, 0x5B6A, 0x5B8A, 0x5bba, 0x5b8a}}, // Goewin mixing potion {{0x5C80, 0x5D40, 0x5D60, 0x5d90, 0x5d60}}, // Player standard animation {{0x5C95, 0x5D55, 0x5D75, 0x5da5, 0x5d75}}, // Player operating rack {{0x5CAA, 0x5D6A, 0x5D8A, 0x5dba, 0x5d8a}}, // Selena animation @@ -232,7 +232,7 @@ void read_room_data(byte *&data, uint16 &totalSize) { break; case FR_FRA: dataStart = 0xc020; - walkAreaOffset = 0x2ed0; + walkAreaOffset = 0x2ed0; break; case DE_DEU: dataStart = 0xc050; @@ -251,7 +251,7 @@ void read_room_data(byte *&data, uint16 &totalSize) { lureExe.seek(dataSegment + dataStart + index * 9); lureExe.read(&headerEntry, sizeof(RoomHeaderEntry)); - if ((FROM_LE_16(headerEntry.offset) != 0) && + if ((FROM_LE_16(headerEntry.offset) != 0) && (FROM_LE_16(headerEntry.offset) != 0xffff) && (FROM_LE_16(headerEntry.roomNumber) != 0)) { // Store offset of room entry @@ -263,13 +263,13 @@ void read_room_data(byte *&data, uint16 &totalSize) { RoomResourceOutput *rec = (RoomResourceOutput *) (data + offset); rec->hdrFlags = headerEntry.hdrFlags; rec->actions = FROM_LE_32(buffer.actions); - rec->roomNumber = index; + rec->roomNumber = index; rec->descId = headerEntry.descId; rec->numLayers = buffer.numLayers; memcpy(rec->layers, buffer.layers, 8); - rec->sequenceOffset = buffer.sequenceOffset; + rec->sequenceOffset = buffer.sequenceOffset; rec->clippingXStart = TO_LE_16(FROM_LE_16(buffer.clippingXStart) - 0x80); - rec->clippingXEnd = (FROM_LE_16(buffer.clippingXEnd) == 0) ? 0 : + rec->clippingXEnd = (FROM_LE_16(buffer.clippingXEnd) == 0) ? 0 : TO_LE_16(FROM_LE_16(buffer.clippingXEnd) - 0x80); rec->exitTime = FROM_LE_32(buffer.exitTime); rec->areaFlag = buffer.areaFlag; @@ -283,7 +283,7 @@ void read_room_data(byte *&data, uint16 &totalSize) { lureExe.read(p, sizeof(RoomResourceExit1)); if (FROM_LE_16(p->xs) == 0xffff) break; - if (++rec->numExits == 255) + if (++rec->numExits == 255) errorExit("Too many rooms read in"); p->xs = TO_LE_16(FROM_LE_16(p->xs) - 0x80); @@ -310,7 +310,7 @@ void read_room_data(byte *&data, uint16 &totalSize) { // Handle the random destination walk bounds for the room - lureExe.seek(dataSegment + walkAreaOffset + + lureExe.seek(dataSegment + walkAreaOffset + buffer.walkBoundsIndex * sizeof(RoomRectIn)); lureExe.read(&bounds, sizeof(RoomRectIn)); rec->walkBounds.xs = TO_LE_16(FROM_LE_16(bounds.xs) - 0x80); @@ -338,38 +338,38 @@ uint16 englishTickProcOffsets[] = { 0x41BD, 0x4f82, 0x5e44, 0x625e, 0x6571, 0x7207, 0x7c14, 0x7c24, 0x7efa, 0x7f02, 0x7F37, 0x7f3a, 0x7f54, 0x7f69, 0x7fa1, 0x8009, 0x80c6, 0x813f, 0x8180, 0x81b3, 0x81f3, 0x820e, 0x8241, 0x82a0, 0x85ce, 0x862d, 0x865A, 0x86FA, 0x86FF, 0x871E, - 0x873D, 0x8742, 0x8747, 0x87B3, 0x87EC, 0x882A, 0x8ABD, 0x982D, 0x98B6, + 0x873D, 0x8742, 0x8747, 0x87B3, 0x87EC, 0x882A, 0x8ABD, 0x982D, 0x98B6, 0xffff }; uint16 italianTickProcOffsets[] = { 0x4205, 0x4fca, 0x5e8c, 0x62a6, 0x65b9, 0x724f, 0x7c5c, 0x7c6c, 0x7f58, 0x7f60, - 0x7f95, 0x7f98, 0x7fb2, 0x7fc7, 0x7fff, 0x8067, 0x8124, 0x819d, 0x81de, 0x8211, - 0x8251, 0x826c, 0x829f, 0x82fe, 0x862c, 0x868b, 0x86b8, 0x8758, 0x875D, 0x877C, - 0x879B, 0x87a0, 0x87a5, 0x8811, 0x884a, 0x8888, 0x8b20, 0x988f, 0x9918, + 0x7f95, 0x7f98, 0x7fb2, 0x7fc7, 0x7fff, 0x8067, 0x8124, 0x819d, 0x81de, 0x8211, + 0x8251, 0x826c, 0x829f, 0x82fe, 0x862c, 0x868b, 0x86b8, 0x8758, 0x875D, 0x877C, + 0x879B, 0x87a0, 0x87a5, 0x8811, 0x884a, 0x8888, 0x8b20, 0x988f, 0x9918, 0xffff }; uint16 frenchTickProcOffsets[] = { - 0x457b, 0x5340, 0x6202, 0x661c, 0x692f, 0x75fb, 0x8008, 0x8018, 0x82f8, 0x8300, - 0x8335, 0x8338, 0x8352, 0x8367, 0x839f, 0x8407, 0x84c4, 0x853d, 0x857e, 0x85b1, - 0x85f1, 0x860c, 0x863f, 0x869e, 0x89cf, 0x8a2e, 0x8a5b, 0x8afb, 0x8b00, 0x8b1f, + 0x457b, 0x5340, 0x6202, 0x661c, 0x692f, 0x75fb, 0x8008, 0x8018, 0x82f8, 0x8300, + 0x8335, 0x8338, 0x8352, 0x8367, 0x839f, 0x8407, 0x84c4, 0x853d, 0x857e, 0x85b1, + 0x85f1, 0x860c, 0x863f, 0x869e, 0x89cf, 0x8a2e, 0x8a5b, 0x8afb, 0x8b00, 0x8b1f, 0x8b3e, 0x8b43, 0x8b48, 0x8bb4, 0x8bed, 0x8c26, 0x8ebe, 0x9c41, 0x9cca, 0xffff }; uint16 germanTickProcOffsets[] = { - 0x4543, 0x5308, 0x61ca, 0x65e4, 0x68fa, 0x7591, 0x7f9e, 0x7fae, 0x8358, 0x8360, - 0x8395, 0x8398, 0x83b2, 0x83c7, 0x83ff, 0x8467, 0x8524, 0x859d, 0x85de, 0x8611, - 0x8651, 0x866c, 0x869f, 0x86fe, 0x8a2c, 0x8a8b, 0x8ab8, 0x8b58, 0x8b5d, 0x8b7c, + 0x4543, 0x5308, 0x61ca, 0x65e4, 0x68fa, 0x7591, 0x7f9e, 0x7fae, 0x8358, 0x8360, + 0x8395, 0x8398, 0x83b2, 0x83c7, 0x83ff, 0x8467, 0x8524, 0x859d, 0x85de, 0x8611, + 0x8651, 0x866c, 0x869f, 0x86fe, 0x8a2c, 0x8a8b, 0x8ab8, 0x8b58, 0x8b5d, 0x8b7c, 0x8b9b, 0x8ba0, 0x8ba5, 0x8c11, 0x8c4a, 0x8c83, 0x8f1a, 0x9c9b, 0x9d24, 0xffff }; uint16 spanishTickProcOffsets[] = { - 0x4247, 0x500c, 0x5ece, 0x62e8, 0x65fb, 0x7291, 0x7c9e, 0x7cae, 0x7fbe, 0x7fc6, - 0x7ffb, 0x7ffe, 0x8018, 0x802d, 0x8065, 0x80cd, 0x818a, 0x8203, 0x8244, 0x8277, - 0x82b7, 0x82d2, 0x8305, 0x8364, 0x8692, 0x86f1, 0x871e, 0x87be, 0x87c3, 0x87e2, + 0x4247, 0x500c, 0x5ece, 0x62e8, 0x65fb, 0x7291, 0x7c9e, 0x7cae, 0x7fbe, 0x7fc6, + 0x7ffb, 0x7ffe, 0x8018, 0x802d, 0x8065, 0x80cd, 0x818a, 0x8203, 0x8244, 0x8277, + 0x82b7, 0x82d2, 0x8305, 0x8364, 0x8692, 0x86f1, 0x871e, 0x87be, 0x87c3, 0x87e2, 0x8801, 0x8806, 0x880b, 0x8877, 0x88b0, 0x88ee, 0x8b86, 0x98f5, 0x997e, 0xffff }; @@ -425,7 +425,7 @@ void read_hotspot_data(byte *&data, uint16 &totalSize) { procList = &germanTickProcOffsets[0]; walkToOffset = 0xBD5B; loadOffsets = &germanLoadOffsets[0]; - break; + break; case ES_ESP: offsets = &spanishOffsets[0]; procList = &spanishTickProcOffsets[0]; @@ -475,14 +475,14 @@ void read_hotspot_data(byte *&data, uint16 &totalSize) { memset(r, 0, sizeof(HotspotResourceOutput)); r->hotspotId = TO_LE_16(startId[tableNum] + hotspotIndex); r->nameId = entryHeader.resourceId; - r->descId = entryHeader.descId; + r->descId = entryHeader.descId; r->descId2 = entryHeader.descId2; r->hdrFlags = entryHeader.hdrFlags; // Get the hotspot data lureExe.seek(dataSegment + entryHeader.offset); lureExe.read(&entry, sizeof(HotspotResource)); - + r->actions = entry.actions; r->roomNumber = entry.roomNumber; r->startX = TO_LE_16(FROM_LE_16(entry.startX) - 0x80); @@ -519,7 +519,7 @@ void read_hotspot_data(byte *&data, uint16 &totalSize) { ++loadIndex; if (loadOffsets[loadIndex] == 0) { - printf("Unknown load offset encountered for hotspot %xh offset %xh\n", + printf("Unknown load offset encountered for hotspot %xh offset %xh\n", startId[tableNum] + hotspotIndex, FROM_LE_16(entry.loadOffset)); exit(1); @@ -540,7 +540,7 @@ void read_hotspot_data(byte *&data, uint16 &totalSize) { if (procList[procIndex] == 0xffff) { if ((FROM_LE_16(entry.tickProcOffset) != 0xe00) && (FROM_LE_16(entry.tickProcOffset) != 2)) -// printf("Could not find a tick proc handler for hotspot %xh offset %xh\n", +// printf("Could not find a tick proc handler for hotspot %xh offset %xh\n", // startId[tableNum] + hotspotIndex, printf("%xh,\n", FROM_LE_16(entry.tickProcOffset)); @@ -550,7 +550,7 @@ printf("%xh,\n", r->tickProcId = TO_LE_16(procIndex + 1); } - // WORKAROUND: Special check for the tinderbox hotspot to set it's room number correctly - the original + // WORKAROUND: Special check for the tinderbox hotspot to set it's room number correctly - the original // game used this as a backup against people trying to hack the copy protection if (currentHotspotId == 0x271C) r->roomNumber = TO_LE_16(28); @@ -567,7 +567,7 @@ printf("%xh,\n", break; ++walkCtr; } - + if (walkCtr == walkNumEntries) { r->walkX = 0; r->walkY = 0; @@ -578,7 +578,7 @@ printf("%xh,\n", // WORKAROUND: Edwina's walk-to position is actually inside the table, which meant that walking over // to her could fail, depending on your start position. This increments it into the clear int tempY = (int16) (y & 0x7fff) - 0x80; - if (currentHotspotId == 0x442) + if (currentHotspotId == 0x442) tempY += 8; r->walkY = TO_LE_16((y & 0x8000) | (uint16) tempY); } @@ -601,7 +601,7 @@ printf("%xh,\n", lureExe.seek(dataSegment + entryHeader.offset + 0x63); lureExe.read(&action, sizeof(CurrentActionInput)); - if (action.action != 2) + if (action.action != 2) r->npcSchedule = 0; else { r->npcSchedule = get_sequence_index(FROM_LE_16(action.dataOffset)); @@ -626,7 +626,7 @@ printf("%xh,\n", free(walkList); } -void read_hotspot_override_data(byte *&data, uint16 &totalSize) +void read_hotspot_override_data(byte *&data, uint16 &totalSize) { lureExe.seek(dataSegment + HOTSPOT_OVERRIDE_OFFSET); int numOverrides = 0; @@ -695,7 +695,7 @@ void read_room_exits(byte *&data, uint16 &totalSize) { uint16 *offset = (uint16 *) data; uint16 destIndex = (NUM_ROOM_EXITS + 1) * sizeof(uint16); uint16 entryCtr; - + // Loop to build up the result table for (roomCtr = 0; roomCtr < NUM_ROOM_EXITS; ++roomCtr) { @@ -705,7 +705,7 @@ void read_room_exits(byte *&data, uint16 &totalSize) { // Read in the entries for the room *offset++ = TO_LE_16(destIndex); - RoomExitHotspotOutputRecord *destP = (RoomExitHotspotOutputRecord *) + RoomExitHotspotOutputRecord *destP = (RoomExitHotspotOutputRecord *) (data + destIndex); lureExe.seek(dataSegment + offsets[roomCtr]); @@ -722,7 +722,7 @@ void read_room_exits(byte *&data, uint16 &totalSize) { destP->cursorNum = rec.cursorNum; destP->destRoomNumber = rec.destRoomNumber; } - + destIndex += numEntries[roomCtr] * sizeof(RoomExitHotspotOutputRecord); WRITE_LE_UINT16(data + destIndex, 0xffff); destIndex += sizeof(uint16); @@ -738,7 +738,7 @@ void read_room_exit_joins(byte *&data, uint16 &totalSize) { uint16 dataStart = 0xce30; if (language == IT_ITA) dataStart = 0xcef0; - else if (language == FR_FRA) dataStart = 0xcf10; + else if (language == FR_FRA) dataStart = 0xcf10; else if (language == DE_DEU) dataStart = 0xcf40; else if (language == ES_ESP) dataStart = 0xcf10; else if (language != EN_ANY) errorExit("read_room_exit_joins: Unknown language"); @@ -756,7 +756,7 @@ void read_room_exit_joins(byte *&data, uint16 &totalSize) { totalSize = (numRecords * sizeof(RoomExitHotspotJoinRecord)) + 2; data = (byte *) malloc(totalSize); lureExe.seek(dataSegment + dataStart); - + p = (RoomExitHotspotJoinRecord *) data; for (int recordCtr = 0; recordCtr < numRecords; ++recordCtr) { @@ -785,7 +785,7 @@ void read_anim_data(byte *&data, uint16 &totalSize) { lureExe.seek(dataSegment + animOffsets[ctr]); lureExe.read(&inRec, sizeof(AnimRecord)); - if ((FROM_LE_16(inRec.leftOffset) < 0x5000) || + if ((FROM_LE_16(inRec.leftOffset) < 0x5000) || (FROM_LE_16(inRec.rightOffset) < 0x5000) || (abs(FROM_LE_16(inRec.leftOffset)-FROM_LE_16(inRec.rightOffset)) > 0x800) || (abs(FROM_LE_16(inRec.rightOffset)-FROM_LE_16(inRec.upOffset)) > 0x800) || @@ -837,7 +837,7 @@ void read_anim_data(byte *&data, uint16 &totalSize) { rec->animId = inRec.animId; rec->flags = TO_LE_16(inRec.flags); - rec->leftOffset = 0; + rec->leftOffset = 0; rec->rightOffset = 0; rec->upOffset = 0; rec->downOffset = 0; @@ -875,7 +875,7 @@ void read_anim_data(byte *&data, uint16 &totalSize) { ++destMove; lureExe.read(&move, sizeof(MovementRecord)); } - + destMove->frameNumber = TO_LE_16(0xffff); moveOffset += 2; } @@ -897,7 +897,7 @@ void read_script_data(byte *&data, uint16 &totalSize) { else if (language == ES_ESP) segmentOffset = 0x1e0b0; else if (language != EN_ANY) errorExit("read_script_data: Unknown language"); lureExe.seek(segmentOffset); - + totalSize = SCRIPT_SEGMENT_SIZE; data = (byte *) malloc(totalSize); lureExe.read(data, totalSize); @@ -911,7 +911,7 @@ void read_script2_data(byte *&data, uint16 &totalSize) { else if (language == ES_ESP) segmentOffset = 0x19e20; else if (language != EN_ANY) errorExit("read_script2_data: Unknown language"); lureExe.seek(segmentOffset); - + totalSize = SCRIPT2_SEGMENT_SIZE; data = (byte *) malloc(totalSize); lureExe.read(data, totalSize); @@ -971,10 +971,10 @@ void read_actions_list(byte *&data, uint16 &totalSize) { header->recordId = TO_LE_16(0xffff); } -// Reads in the talk data +// Reads in the talk data void add_talk_offset(uint16 offset) { - for (int ctr = 0; ctr < talkOffsetIndex; ++ctr) + for (int ctr = 0; ctr < talkOffsetIndex; ++ctr) if (talkOffsets[ctr] == offset) return; if (talkOffsetIndex == MAX_TALK_LISTS) { printf("Exceeded maximum talk offset list size\n"); @@ -1010,7 +1010,7 @@ void read_talk_headers(byte *&data, uint16 &totalSize) { currVal = 0xffff; for (subentryCtr = 0; subentryCtr < TALK_NUM_ENTRIES; ++subentryCtr) { if ((FROM_LE_16(entries[subentryCtr].offset) < currVal) && - (FROM_LE_16(entries[subentryCtr].offset) > prevVal)) + (FROM_LE_16(entries[subentryCtr].offset) > prevVal)) currVal = FROM_LE_16(entries[subentryCtr].offset); } if (currVal == 0xffff) break; @@ -1019,7 +1019,7 @@ void read_talk_headers(byte *&data, uint16 &totalSize) { prevVal = currVal; } - // Assume that the last talk header will have the same number of entries across language versions, + // Assume that the last talk header will have the same number of entries across language versions, // so create an end address based on the start of the last entry using start/end from English version sortedOffsets[entryCtr] = sortedOffsets[entryCtr - 1] + (0x5540 - 0x5504); @@ -1041,7 +1041,7 @@ void read_talk_headers(byte *&data, uint16 &totalSize) { break; } } - if (nextOffset == 0) + if (nextOffset == 0) exit(1); // Read in line entries into the data @@ -1051,7 +1051,7 @@ void read_talk_headers(byte *&data, uint16 &totalSize) { lureExe.read(talkOffset, size); while (size > 0) { - if (READ_UINT16(talkOffset) != 0) + if (READ_UINT16(talkOffset) != 0) add_talk_offset(READ_UINT16(talkOffset)); size -= sizeof(uint16); offset += sizeof(uint16); @@ -1115,7 +1115,7 @@ void read_talk_data(byte *&data, uint16 &totalSize) { currVal = 0xffff; for (subentryCtr = 0; subentryCtr < talkOffsetIndex; ++subentryCtr) { if ((talkOffsets[subentryCtr] < currVal) && - (talkOffsets[subentryCtr] > prevVal)) + (talkOffsets[subentryCtr] > prevVal)) currVal = talkOffsets[subentryCtr]; } if (currVal == 0xffff) break; @@ -1134,7 +1134,7 @@ void read_talk_data(byte *&data, uint16 &totalSize) { header->recordId = startOffset; header->listOffset = offset; - + lureExe.seek(dataSegment + startOffset); responseOffset = lureExe.readWord(); startOffset += 2; @@ -1173,7 +1173,7 @@ void read_talk_data(byte *&data, uint16 &totalSize) { for (subentryCtr = 0; subentryCtr < numTalks; ++subentryCtr) { if ((responseOffset >= sortedList[subentryCtr]) && (responseOffset < sortedList[subentryCtr+1])) { - // Found a record + // Found a record nextOffset = sortedList[subentryCtr+1]; break; } @@ -1182,7 +1182,7 @@ void read_talk_data(byte *&data, uint16 &totalSize) { printf("Failure reading talk data: no response found\n"); exit(1); } - + size = nextOffset - responseOffset; if ((size % 6) != 0) size -= (size % 6); @@ -1212,20 +1212,20 @@ void read_room_pathfinding_data(byte *&data, uint16 &totalSize) { else if (language == ES_ESP) dataStart = 0x992A; else if (language != EN_ANY) errorExit("read_room_pathfinding_data: Unknown language"); lureExe.seek(dataSegment + dataStart); - + totalSize = PATHFIND_SIZE; data = (byte *) malloc(totalSize); lureExe.read(data, totalSize); } -void read_room_exit_coordinate_data(byte *&data, uint16 &totalSize) +void read_room_exit_coordinate_data(byte *&data, uint16 &totalSize) { - // Read in the exit coordinates list + // Read in the exit coordinates list int roomNum, entryNum; uint16 x, y; RoomExitCoordinateEntryInputResource dataIn; - totalSize = EXIT_COORDINATES_NUM_ROOMS * sizeof(RoomExitCoordinateEntryOutputResource) + 2; + totalSize = EXIT_COORDINATES_NUM_ROOMS * sizeof(RoomExitCoordinateEntryOutputResource) + 2; data = (byte *) malloc(totalSize); lureExe.seek(dataSegment + EXIT_COORDINATES_OFFSET); WRITE_LE_UINT16(data + totalSize - 2, 0xffff); @@ -1253,7 +1253,7 @@ void read_room_exit_coordinate_data(byte *&data, uint16 &totalSize) rec->roomIndex[entryNum] = TO_LE_16(FROM_LE_16(dataIn.roomIndex[entryNum]) / 6); } - // WORKAROUND: Bugfix for the original game data to get to room #27 via rooms #10 or #11 + // WORKAROUND: Bugfix for the original game data to get to room #27 via rooms #10 or #11 if ((roomNum == 10) || (roomNum == 11)) rec->roomIndex[26] = TO_LE_16(1); } @@ -1264,7 +1264,7 @@ void read_room_exit_hotspots_data(byte *&data, uint16 &totalSize) { data = (byte *) malloc(MAX_DATA_SIZE); RoomExitIndexedHotspotResource *rec = (RoomExitIndexedHotspotResource *) data; - + uint16 dataStart = 0x2E57; if (language == IT_ITA) dataStart = 0x2E66; else if (language == FR_FRA) dataStart = 0x2e76; @@ -1272,7 +1272,7 @@ void read_room_exit_hotspots_data(byte *&data, uint16 &totalSize) { else if (language == ES_ESP) dataStart = 0x2e71; else if (language != EN_ANY) errorExit("read_room_exit_hotspots_data: Unknown language"); lureExe.seek(dataSegment + dataStart); - + lureExe.read(rec, sizeof(RoomExitIndexedHotspotResource)); while (FROM_LE_16(rec->roomNumber) != 0) { ++rec; @@ -1292,7 +1292,7 @@ void save_fight_segment(byte *&data, uint16 &totalSize) { else if (language == ES_ESP) fightSegment = 0x1c5b0; else if (language != EN_ANY) errorExit("save_fight_segment: Unknown language"); lureExe.seek(fightSegment); - + totalSize = FIGHT_SEGMENT_SIZE; data = (byte *) malloc(totalSize); lureExe.read(data, totalSize); @@ -1300,11 +1300,11 @@ void save_fight_segment(byte *&data, uint16 &totalSize) { #define NUM_TEXT_ENTRIES 56 const char *englishTextStrings[NUM_TEXT_ENTRIES] = { - "Get", NULL, "Push", "Pull", "Operate", "Open", "Close", "Lock", "Unlock", "Use", - "Give", "Talk to", "Tell", "Buy", "Look", "Look at", "Look through", "Ask", NULL, + "Get", NULL, "Push", "Pull", "Operate", "Open", "Close", "Lock", "Unlock", "Use", + "Give", "Talk to", "Tell", "Buy", "Look", "Look at", "Look through", "Ask", NULL, "Drink", "Status", "Go to", "Return", "Bribe", "Examine", - "Credits", "Restart game", "Save game", "Restore game", "Quit", "Fast Text\x8B", - "Slow Text\x8B", "Sound on", "Sound off", "(nothing)", " for ", " to ", " on ", + "Credits", "Restart game", "Save game", "Restore game", "Quit", "Fast Text\x8B", + "Slow Text\x8B", "Sound on", "Sound off", "(nothing)", " for ", " to ", " on ", "and then", "finish", "Are you sure (y/n)?", "You are carrying ", "nothing", "You have ", "groat", "groats", NULL, "the ", "a ", "a ", "an ", "an ", "an ", "an ", NULL, NULL @@ -1315,9 +1315,9 @@ const char *italianTextStrings[NUM_TEXT_ENTRIES] = { "Sblocca", "Usa", "Dai", "Parla con", "Ordina a", "Buy", "Guarda", "Osserva", "Guarda tra", "Chiedi", NULL, "Bevi", "Stato", "Vai a", "Ritorna", "Corrompi", "Esamina", - "Inform", "Reavvia", "Salva gioco", "Ripristina", "Abbandona", "Testo lento\x8B", - "Testo veloce\x8B", "Sonoro acceso", "Sonoro spento", - "(niente)", " per ", " a ", " su ", + "Inform", "Reavvia", "Salva gioco", "Ripristina", "Abbandona", "Testo lento\x8B", + "Testo veloce\x8B", "Sonoro acceso", "Sonoro spento", + "(niente)", " per ", " a ", " su ", "e poi", "finito", "Sei sicuro (s/n)?", "Stai portando ", "niente", "e hai ", "soldi", "soldis", NULL, "l' ", "la ", NULL, "le ", "i ", "il ", NULL, NULL, NULL @@ -1330,7 +1330,7 @@ const char *frenchTextStrings[NUM_TEXT_ENTRIES] = { "Prends", NULL, "Pousse", "Tire", "Actionne", "Ouvre", "Ferme", "Verrouille", frenchUnlockStr, "Utilise", "Donne", "Parle \0x81", "Dis \x81", NULL, "Regarde", "Observe", "Regarde par", "Demande \x81", NULL, "Bois", "Statut", - "Va \x81", "Reviens", "Corromps", "Examine", + "Va \x81", "Reviens", "Corromps", "Examine", frenchCreditsStr, "Recommencer", "Sauvegarder", "Restituer", "Quitter", "Texte rapide\x8b", "Texte lent \x8b", "Avec son", "Sans son", "(rien)", " avec ", " \x81 ", " sur ", "et puis", "fin", @@ -1344,7 +1344,7 @@ const char *germanTextStrings[NUM_TEXT_ENTRIES] = { "Sperre", "Steck Schl\x8cssel in", "Benutze", "Gib", "Sprich mit", "Befehl an", NULL, "Betrachte", "Betrachte", "Schau durch", "Verlange", NULL, "Trink", "Status", "Geh zu", "Zur\x8c" "ck", "Besteche", "Untersuche", - "Mitwirkende", "Spiel neu starten", "Spiel sichern", "Gesichertes Spiel laden", + "Mitwirkende", "Spiel neu starten", "Spiel sichern", "Gesichertes Spiel laden", "Abbrechen", "Schneller Text\x8b", "Langsamer Text\x8b", "Sound an", "Sound aus", "(nichts)", " nach ", " an ", " f\x8cr ", "und dann", "Schlu\x92", "Sicher (j/n)?", @@ -1376,7 +1376,7 @@ void save_text_strings(byte *&data, uint16 &totalSize) { // Calculate the total needed space totalSize = sizeof(uint16); for (index = 0; index < NUM_TEXT_ENTRIES; ++index) { - if (textStrings[index] != NULL) + if (textStrings[index] != NULL) totalSize += strlen(textStrings[index]); ++totalSize; } @@ -1404,7 +1404,7 @@ void save_sound_desc_data(byte *&data, uint16 &totalSize) { else if (language == ES_ESP) dataStart = 0x5751; else if (language != EN_ANY) errorExit("save_sound_desc_data: Unknown language"); lureExe.seek(dataSegment + dataStart); - + totalSize = SOUND_DESCS_SIZE; data = (byte *) malloc(totalSize); lureExe.read(data, totalSize); @@ -1416,33 +1416,33 @@ struct DecoderEntry { }; const DecoderEntry englishDecoders[] = { - {"00", ' '}, {"0100", 'e'}, {"0101", 'o'}, {"0110", 't'}, {"01110", 'a'}, - {"01111", 'n'}, {"1000", 's'}, {"1001", 'i'}, {"1010", 'r'}, {"10110", 'h'}, - {"101110", 'u'}, {"1011110", 'l'}, {"1011111", 'd'}, {"11000", 'y'}, - {"110010", 'g'}, {"110011", '\0'}, {"110100", 'w'}, {"110101", 'c'}, - {"110110", 'f'}, {"1101110", '.'}, {"1101111", 'm'}, {"111000", 'p'}, - {"111001", 'b'}, {"1110100", ','}, {"1110101", 'k'}, {"1110110", '\''}, - {"11101110", 'I'}, {"11101111", 'v'}, {"1111000", '!'}, {"1111001", '\xb4'}, - {"11110100", 'T'}, {"11110101", '\xb5'}, {"11110110", '?'}, {"111101110", '\xb2'}, - {"111101111", '\xb3'}, {"11111000", 'W'}, {"111110010", 'H'}, {"111110011", 'A'}, - {"111110100", '\xb1'}, {"111110101", 'S'}, {"111110110", 'Y'}, {"1111101110", 'G'}, - {"11111011110", 'M'}, {"11111011111", 'N'}, {"111111000", 'O'}, {"1111110010", 'E'}, - {"1111110011", 'L'}, {"1111110100", '-'}, {"1111110101", 'R'}, {"1111110110", 'B'}, - {"11111101110", 'D'}, {"11111101111", '\xa6'}, {"1111111000", 'C'}, - {"11111110010", 'x'}, {"11111110011", 'j'}, {"1111111010", '\xac'}, - {"11111110110", '\xa3'}, {"111111101110", 'P'}, {"111111101111", 'U'}, - {"11111111000", 'q'}, {"11111111001", '\xad'}, {"111111110100", 'F'}, - {"111111110101", '1'}, {"111111110110", '\xaf'}, {"1111111101110", ';'}, - {"1111111101111", 'z'}, {"111111111000", '\xa5'}, {"1111111110010", '2'}, - {"1111111110011", '\xb0'}, {"111111111010", 'K'}, {"1111111110110", '%'}, - {"11111111101110", '\xa2'}, {"11111111101111", '5'}, {"1111111111000", ':'}, - {"1111111111001", 'J'}, {"1111111111010", 'V'}, {"11111111110110", '6'}, - {"11111111110111", '3'}, {"1111111111100", '\xab'}, {"11111111111010", '\xae'}, - {"111111111110110", '0'}, {"111111111110111", '4'}, {"11111111111100", '7'}, - {"111111111111010", '9'}, {"111111111111011", '"'}, {"111111111111100", '8'}, - {"111111111111101", '\xa7'}, {"1111111111111100", '/'}, {"1111111111111101", 'Q'}, - {"11111111111111100", '\xa8'}, {"11111111111111101", '('}, {"111111111111111100", ')'}, - {"111111111111111101", '\x99'}, {"11111111111111111", '\xa9'}, + {"00", ' '}, {"0100", 'e'}, {"0101", 'o'}, {"0110", 't'}, {"01110", 'a'}, + {"01111", 'n'}, {"1000", 's'}, {"1001", 'i'}, {"1010", 'r'}, {"10110", 'h'}, + {"101110", 'u'}, {"1011110", 'l'}, {"1011111", 'd'}, {"11000", 'y'}, + {"110010", 'g'}, {"110011", '\0'}, {"110100", 'w'}, {"110101", 'c'}, + {"110110", 'f'}, {"1101110", '.'}, {"1101111", 'm'}, {"111000", 'p'}, + {"111001", 'b'}, {"1110100", ','}, {"1110101", 'k'}, {"1110110", '\''}, + {"11101110", 'I'}, {"11101111", 'v'}, {"1111000", '!'}, {"1111001", '\xb4'}, + {"11110100", 'T'}, {"11110101", '\xb5'}, {"11110110", '?'}, {"111101110", '\xb2'}, + {"111101111", '\xb3'}, {"11111000", 'W'}, {"111110010", 'H'}, {"111110011", 'A'}, + {"111110100", '\xb1'}, {"111110101", 'S'}, {"111110110", 'Y'}, {"1111101110", 'G'}, + {"11111011110", 'M'}, {"11111011111", 'N'}, {"111111000", 'O'}, {"1111110010", 'E'}, + {"1111110011", 'L'}, {"1111110100", '-'}, {"1111110101", 'R'}, {"1111110110", 'B'}, + {"11111101110", 'D'}, {"11111101111", '\xa6'}, {"1111111000", 'C'}, + {"11111110010", 'x'}, {"11111110011", 'j'}, {"1111111010", '\xac'}, + {"11111110110", '\xa3'}, {"111111101110", 'P'}, {"111111101111", 'U'}, + {"11111111000", 'q'}, {"11111111001", '\xad'}, {"111111110100", 'F'}, + {"111111110101", '1'}, {"111111110110", '\xaf'}, {"1111111101110", ';'}, + {"1111111101111", 'z'}, {"111111111000", '\xa5'}, {"1111111110010", '2'}, + {"1111111110011", '\xb0'}, {"111111111010", 'K'}, {"1111111110110", '%'}, + {"11111111101110", '\xa2'}, {"11111111101111", '5'}, {"1111111111000", ':'}, + {"1111111111001", 'J'}, {"1111111111010", 'V'}, {"11111111110110", '6'}, + {"11111111110111", '3'}, {"1111111111100", '\xab'}, {"11111111111010", '\xae'}, + {"111111111110110", '0'}, {"111111111110111", '4'}, {"11111111111100", '7'}, + {"111111111111010", '9'}, {"111111111111011", '"'}, {"111111111111100", '8'}, + {"111111111111101", '\xa7'}, {"1111111111111100", '/'}, {"1111111111111101", 'Q'}, + {"11111111111111100", '\xa8'}, {"11111111111111101", '('}, {"111111111111111100", ')'}, + {"111111111111111101", '\x99'}, {"11111111111111111", '\xa9'}, {NULL, '\0'} }; @@ -1481,8 +1481,8 @@ const DecoderEntry italianDecoders[] = { const DecoderEntry frenchDecoders[] = { {"00", (char) 0x20}, {"0100", (char) 0x65}, {"0101", (char) 0x73}, {"0110", (char) 0x61}, {"01110", (char) 0x69}, - {"011110", (char) 0x6E}, {"011111", (char) 0x72}, {"1000", (char) 0x6F}, {"10010", (char) 0x74}, - {"100110", (char) 0x75}, {"100111", (char) 0x70}, {"10100", (char) 0x6C}, {"10101", (char) 0x6D}, + {"011110", (char) 0x6E}, {"011111", (char) 0x72}, {"1000", (char) 0x6F}, {"10010", (char) 0x74}, + {"100110", (char) 0x75}, {"100111", (char) 0x70}, {"10100", (char) 0x6C}, {"10101", (char) 0x6D}, {"101100", (char) 0x63}, {"101101", (char) 0x76}, {"101110", (char) 0x00}, {"1011110", (char) 0x2E}, {"1011111", (char) 0x7F}, {"110000", (char) 0xAA}, {"110001", (char) 0x27}, {"110010", (char) 0x64}, {"1100110", (char) 0xB8}, {"1100111", (char) 0x2C}, {"110100", (char) 0x62}, {"1101010", (char) 0x68}, @@ -1526,7 +1526,7 @@ const DecoderEntry frenchDecoders[] = { const DecoderEntry germanDecoders[] = { {"000", (char) 0x20}, {"001", (char) 0x65}, {"0100", (char) 0x6E}, {"0101", (char) 0x61}, {"0110", (char) 0x72}, - {"01110", (char) 0x69}, {"011110", (char) 0x74}, {"011111", (char) 0x73}, {"10000", (char) 0x68}, + {"01110", (char) 0x69}, {"011110", (char) 0x74}, {"011111", (char) 0x73}, {"10000", (char) 0x68}, {"10001", (char) 0x6C}, {"10010", (char) 0x75}, {"100110", (char) 0x6D}, {"100111", (char) 0xB0}, {"10100", (char) 0x67}, {"101010", (char) 0x00}, {"101011", (char) 0x62}, {"101100", (char) 0x63}, {"101101", (char) 0x2C}, {"101110", (char) 0x6F}, {"1011110", (char) 0xAA}, {"1011111", (char) 0x77}, @@ -1569,36 +1569,36 @@ const DecoderEntry germanDecoders[] = { }; const DecoderEntry spanishDecoders[] = { - {"00", (char) 0x20}, {"010", (char) 0x61}, {"0110", (char) 0x6F}, {"01110", (char) 0x65}, - {"01111", (char) 0x72}, {"1000", (char) 0x73}, {"1001", (char) 0x6E}, {"10100", (char) 0x69}, - {"10101", (char) 0x75}, {"10110", (char) 0x63}, {"101110", (char) 0x74}, {"1011110", (char) 0x6C}, - {"1011111", (char) 0x64}, {"11000", (char) 0x70}, {"110010", (char) 0x2E}, {"110011", (char) 0x6D}, - {"110100", (char) 0x00}, {"110101", (char) 0xB3}, {"1101100", (char) 0x62}, {"1101101", (char) 0x2C}, - {"1101110", (char) 0x68}, {"11011110", (char) 0x67}, {"11011111", (char) 0xB1}, {"1110000", (char) 0x76}, - {"1110001", (char) 0xB5}, {"1110010", (char) 0x79}, {"11100110", (char) 0xAB}, {"11100111", (char) 0xB4}, - {"1110100", (char) 0x97}, {"11101010", (char) 0xB2}, {"11101011", (char) 0x98}, {"11101100", (char) 0x45}, - {"11101101", (char) 0x66}, {"11101110", (char) 0x95}, {"111011110", (char) 0x21}, {"111011111", (char) 0x6A}, - {"11110000", (char) 0x4C}, {"11110001", (char) 0x4E}, {"11110010", (char) 0x7F}, {"111100110", (char) 0x96}, - {"111100111", (char) 0x3F}, {"11110100", (char) 0xAC}, {"11110101", (char) 0x94}, {"11110110", (char) 0x7A}, - {"111101110", (char) 0x41}, {"1111011110", (char) 0x53}, {"1111011111", (char) 0x71}, {"11111000", (char) 0x54}, - {"111110010", (char) 0x93}, {"1111100110", (char) 0xAF}, {"1111100111", (char) 0x43}, {"111110100", (char) 0x50}, + {"00", (char) 0x20}, {"010", (char) 0x61}, {"0110", (char) 0x6F}, {"01110", (char) 0x65}, + {"01111", (char) 0x72}, {"1000", (char) 0x73}, {"1001", (char) 0x6E}, {"10100", (char) 0x69}, + {"10101", (char) 0x75}, {"10110", (char) 0x63}, {"101110", (char) 0x74}, {"1011110", (char) 0x6C}, + {"1011111", (char) 0x64}, {"11000", (char) 0x70}, {"110010", (char) 0x2E}, {"110011", (char) 0x6D}, + {"110100", (char) 0x00}, {"110101", (char) 0xB3}, {"1101100", (char) 0x62}, {"1101101", (char) 0x2C}, + {"1101110", (char) 0x68}, {"11011110", (char) 0x67}, {"11011111", (char) 0xB1}, {"1110000", (char) 0x76}, + {"1110001", (char) 0xB5}, {"1110010", (char) 0x79}, {"11100110", (char) 0xAB}, {"11100111", (char) 0xB4}, + {"1110100", (char) 0x97}, {"11101010", (char) 0xB2}, {"11101011", (char) 0x98}, {"11101100", (char) 0x45}, + {"11101101", (char) 0x66}, {"11101110", (char) 0x95}, {"111011110", (char) 0x21}, {"111011111", (char) 0x6A}, + {"11110000", (char) 0x4C}, {"11110001", (char) 0x4E}, {"11110010", (char) 0x7F}, {"111100110", (char) 0x96}, + {"111100111", (char) 0x3F}, {"11110100", (char) 0xAC}, {"11110101", (char) 0x94}, {"11110110", (char) 0x7A}, + {"111101110", (char) 0x41}, {"1111011110", (char) 0x53}, {"1111011111", (char) 0x71}, {"11111000", (char) 0x54}, + {"111110010", (char) 0x93}, {"1111100110", (char) 0xAF}, {"1111100111", (char) 0x43}, {"111110100", (char) 0x50}, {"111110101", (char) 0x4D}, {"111110110", (char) 0x44}, {"1111101110", (char) 0xAE}, {"11111011110", (char) 0xAD}, - {"11111011111", (char) 0xB0}, {"111111000", (char) 0x48}, {"1111110010", (char) 0x51}, {"1111110011", (char) 0x55}, - {"1111110100", (char) 0x4F}, {"1111110101", (char) 0x47}, {"1111110110", (char) 0x99}, - {"11111101110", (char) 0xA8}, {"11111101111", (char) 0x22}, {"1111111000", (char) 0xA9}, - {"11111110010", (char) 0xA6}, {"11111110011", (char) 0x52}, {"1111111010", (char) 0x59}, - {"11111110110", (char) 0xA3}, {"111111101110", (char) 0x78}, {"111111101111", (char) 0x56}, - {"11111111000", (char) 0x77}, {"11111111001", (char) 0x42}, {"111111110100", (char) 0x6B}, - {"111111110101", (char) 0x49}, {"111111110110", (char) 0x31}, {"1111111101110", (char) 0xAA}, - {"1111111101111", (char) 0x2D}, {"111111111000", (char) 0x46}, {"111111111001", (char) 0xA5}, - {"1111111110100", (char) 0x32}, {"1111111110101", (char) 0x3B}, {"1111111110110", (char) 0xA7}, - {"11111111101110", (char) 0x35}, {"11111111101111", (char) 0x25}, {"1111111111000", (char) 0x3A}, - {"1111111111001", (char) 0xA2}, {"1111111111010", (char) 0x57}, {"11111111110110", (char) 0x36}, - {"11111111110111", (char) 0x33}, {"1111111111100", (char) 0x4A}, {"11111111111010", (char) 0x30}, - {"11111111111011", (char) 0x34}, {"11111111111100", (char) 0x37}, {"111111111111010", (char) 0x39}, - {"111111111111011", (char) 0x38}, {"111111111111100", (char) 0xA4}, {"111111111111101", (char) 0x2F}, - {"1111111111111100", (char) 0x5A}, {"1111111111111101", (char) 0x8C}, {"11111111111111100", (char) 0x28}, - {"11111111111111101", (char) 0x29}, {"11111111111111110", (char) 0x4B}, {"111111111111111110", (char) 0x58}, + {"11111011111", (char) 0xB0}, {"111111000", (char) 0x48}, {"1111110010", (char) 0x51}, {"1111110011", (char) 0x55}, + {"1111110100", (char) 0x4F}, {"1111110101", (char) 0x47}, {"1111110110", (char) 0x99}, + {"11111101110", (char) 0xA8}, {"11111101111", (char) 0x22}, {"1111111000", (char) 0xA9}, + {"11111110010", (char) 0xA6}, {"11111110011", (char) 0x52}, {"1111111010", (char) 0x59}, + {"11111110110", (char) 0xA3}, {"111111101110", (char) 0x78}, {"111111101111", (char) 0x56}, + {"11111111000", (char) 0x77}, {"11111111001", (char) 0x42}, {"111111110100", (char) 0x6B}, + {"111111110101", (char) 0x49}, {"111111110110", (char) 0x31}, {"1111111101110", (char) 0xAA}, + {"1111111101111", (char) 0x2D}, {"111111111000", (char) 0x46}, {"111111111001", (char) 0xA5}, + {"1111111110100", (char) 0x32}, {"1111111110101", (char) 0x3B}, {"1111111110110", (char) 0xA7}, + {"11111111101110", (char) 0x35}, {"11111111101111", (char) 0x25}, {"1111111111000", (char) 0x3A}, + {"1111111111001", (char) 0xA2}, {"1111111111010", (char) 0x57}, {"11111111110110", (char) 0x36}, + {"11111111110111", (char) 0x33}, {"1111111111100", (char) 0x4A}, {"11111111111010", (char) 0x30}, + {"11111111111011", (char) 0x34}, {"11111111111100", (char) 0x37}, {"111111111111010", (char) 0x39}, + {"111111111111011", (char) 0x38}, {"111111111111100", (char) 0xA4}, {"111111111111101", (char) 0x2F}, + {"1111111111111100", (char) 0x5A}, {"1111111111111101", (char) 0x8C}, {"11111111111111100", (char) 0x28}, + {"11111111111111101", (char) 0x29}, {"11111111111111110", (char) 0x4B}, {"111111111111111110", (char) 0x58}, {"111111111111111111", (char) 0x91}, {NULL, '\0'} }; @@ -1708,7 +1708,7 @@ void getEntry(uint8 entryIndex, uint16 &resourceId, byte *&data, uint16 &size) { break; case 14: - // Get the messages segment + // Get the messages segment read_messages_segment(data, size); break; @@ -1761,7 +1761,7 @@ void getEntry(uint8 entryIndex, uint16 &resourceId, byte *&data, uint16 &size) { // Save the decoder sequence list save_string_decoder_data(data, size); break; - + default: data = NULL; size = 0; @@ -1827,7 +1827,7 @@ void createFile(const char *outFilename) { // Get next data entry if (resourceFlag) // Get resource details - getEntry(resIndex, resourceId, resourceData, resourceSize); + getEntry(resIndex, resourceId, resourceData, resourceSize); // Write out the next header entry outputFile.seek(outputStart + (resIndex + 1) * 8); @@ -1854,7 +1854,7 @@ void createFile(const char *outFilename) { // Write out enough bytes to move to the next 32 byte boundary numBytes = 0x20 * ((startOffset + 0x1f) / 0x20) - startOffset; - if (numBytes != 0) + if (numBytes != 0) { outputFile.write(tempBuffer, numBytes); startOffset += numBytes; @@ -1869,13 +1869,13 @@ void createFile(const char *outFilename) { // validate_executable // Validates that the correct executable is being used to generate the // resource file. Eventually the resource file creator will need to work -// with the other language executables, but for now just make +// with the other language executables, but for now just make bool validate_executable() { uint32 sumTotal = 0; byte buffer[NUM_BYTES_VALIDATE]; lureExe.read(buffer, NUM_BYTES_VALIDATE); - for (int ctr = 0; ctr < NUM_BYTES_VALIDATE; ++ctr) + for (int ctr = 0; ctr < NUM_BYTES_VALIDATE; ++ctr) sumTotal += buffer[ctr]; if (sumTotal == ENGLISH_FILE_CHECKSUM) { @@ -1927,11 +1927,11 @@ int main(int argc, char *argv[]) { openOutputFile(argv[1]); for (int argi = 2; argi < argc; ++argi) { - if (!lureExe.open(argv[argi])) + if (!lureExe.open(argv[argi])) printf("Could not open file: %s\n", argv[argi]); else { - if (validate_executable()) - createFile(outFilename); + if (validate_executable()) + createFile(outFilename); lureExe.close(); } } diff --git a/tools/create_lure/create_lure_dat.h b/tools/create_lure/create_lure_dat.h index 1677c10b97..d9903da85d 100644 --- a/tools/create_lure/create_lure_dat.h +++ b/tools/create_lure/create_lure_dat.h @@ -59,7 +59,7 @@ #define MAX_HOTSPOTS 0x100 #define MAX_DATA_SIZE 0x4000 -#define PATHFIND_SIZE (120 * ROOM_NUM_ENTRIES) +#define PATHFIND_SIZE (120 * ROOM_NUM_ENTRIES) #define EXIT_COORDINATES_OFFSET 0x1929 #define EXIT_COORDINATES_NUM_ROOMS 49 @@ -344,7 +344,7 @@ struct RoomExitCoordinateEntryOutputResource { }; -enum CurrentAction {NO_ACTION, START_WALKING, DISPATCH_ACTION, EXEC_HOTSPOT_SCRIPT, +enum CurrentAction {NO_ACTION, START_WALKING, DISPATCH_ACTION, EXEC_HOTSPOT_SCRIPT, PROCESSING_PATH, WALKING}; extern void read_action_sequence(byte *&data, uint16 &totalSize); @@ -381,7 +381,7 @@ public: void write(const void *buffer, int len) { fwrite(buffer, 1, len, f); } - byte readByte() { + byte readByte() { byte v; read(&v, sizeof(byte)); return v; @@ -396,14 +396,14 @@ public: read(&v, sizeof(uint32)); return FROM_LE_32(v); } - void writeByte(byte v) { + void writeByte(byte v) { write(&v, sizeof(byte)); } - void writeWord(uint16 v) { + void writeWord(uint16 v) { uint16 vTemp = TO_LE_16(v); write(&vTemp, sizeof(uint16)); } - void writeLong(uint32 v) { + void writeLong(uint32 v) { uint32 vTemp = TO_LE_32(v); write(&vTemp, sizeof(uint32)); } diff --git a/tools/create_lure/process_actions.cpp b/tools/create_lure/process_actions.cpp index b28dc46919..81db0de022 100644 --- a/tools/create_lure/process_actions.cpp +++ b/tools/create_lure/process_actions.cpp @@ -34,10 +34,10 @@ enum Action { UNLOCK = 9, USE = 10, GIVE = 11, TALK_TO = 12, TELL = 13, BUY = 14, LOOK = 15, LOOK_AT = 16, LOOK_THROUGH = 17, ASK = 18, DRINK = 20, STATUS = 21, GO_TO = 22, RETURN = 23, BRIBE = 24, EXAMINE = 25, - NPC_SET_ROOM_AND_BLOCKED_OFFSET = 28, NPC_HEY_SIR = 29, NPC_EXEC_SCRIPT = 30, - NPC_RESET_PAUSED_LIST = 31, NPC_SET_RAND_DEST = 32, NPC_WALKING_CHECK = 33, - NPC_SET_SUPPORT_OFFSET = 34, NPC_SUPPORT_OFFSET_COND = 35, - NPC_DISPATCH_ACTION = 36, NPC_TALK_NPC_TO_NPC = 37, NPC_PAUSE = 38, + NPC_SET_ROOM_AND_BLOCKED_OFFSET = 28, NPC_HEY_SIR = 29, NPC_EXEC_SCRIPT = 30, + NPC_RESET_PAUSED_LIST = 31, NPC_SET_RAND_DEST = 32, NPC_WALKING_CHECK = 33, + NPC_SET_SUPPORT_OFFSET = 34, NPC_SUPPORT_OFFSET_COND = 35, + NPC_DISPATCH_ACTION = 36, NPC_TALK_NPC_TO_NPC = 37, NPC_PAUSE = 38, NPC_START_TALKING = 39, NPC_JUMP_ADDRESS = 40, NONE = 0 }; @@ -50,7 +50,7 @@ struct CurrentActionOutput { uint16 usedId; }; -int numParams[NPC_JUMP_ADDRESS+1] = {0, +int numParams[NPC_JUMP_ADDRESS+1] = {0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 0, 1, 0, 1, 1, 1, 1, 0, 0, 2, 1, 1, 0, 0, 1, 1, 2, 2, 5, 2, 2, 1}; @@ -77,7 +77,7 @@ JumpOffsetsRecord jumpOffsets[] = { struct SupportStructure { uint16 offset; int numInstructions; - uint16 instructionOffsets[MAX_INSTRUCTION_ENTRIES]; + uint16 instructionOffsets[MAX_INSTRUCTION_ENTRIES]; uint16 resourceOffset; }; @@ -101,7 +101,7 @@ uint16 get_sequence_index(uint16 offset, int supportIndex) { SupportStructure &rec = supportList[index]; if ((rec.numInstructions > 0) && - (offset >= rec.instructionOffsets[0]) && + (offset >= rec.instructionOffsets[0]) && (offset <= rec.instructionOffsets[rec.numInstructions - 1])) { // Scan through the entry's insruction list for (int iIndex = 0; iIndex < rec.numInstructions; ++iIndex) { @@ -236,11 +236,11 @@ uint16 process_action_sequence_entry(int supportIndex, byte *data, uint16 remain // Special check for forward references - it's considered to be in // the same block if it's forward within 100h blocks - if ((params[paramIndex] > offset) && + if ((params[paramIndex] > offset) && (params[paramIndex] < offset + FORWARD_JUMP_ALLOWANCE) && (params[paramIndex] > maxOffset)) { maxOffset = params[paramIndex]; - } + } break; case NPC_JUMP_ADDRESS: @@ -250,9 +250,9 @@ uint16 process_action_sequence_entry(int supportIndex, byte *data, uint16 remain index = 0; while ((index < NUM_JUMP_OFFSETS) && (jmpOffset->jumpOffsets[index] != params[0])) ++index; - + if (index != NUM_JUMP_OFFSETS) - // Replace code offset with an index + // Replace code offset with an index params[0] = index; else { printf("\nEncountered unrecognised NPC code jump point: %xh\n", params[0]); @@ -261,7 +261,7 @@ uint16 process_action_sequence_entry(int supportIndex, byte *data, uint16 remain break; case NPC_HEY_SIR: - // The 'Hey Sir' opcode causes the NPC to request your attention, and sets the active talk + // The 'Hey Sir' opcode causes the NPC to request your attention, and sets the active talk // record to a designated offset. So any offset occurances need to be saved so that it can // be included in the resource for talk records add_talk_offset(params[0]); @@ -280,7 +280,7 @@ uint16 process_action_sequence_entry(int supportIndex, byte *data, uint16 remain //printf("\n"); // Increase size - totalSize += (numParams[actionNum] + 1) * sizeof(uint16); + totalSize += (numParams[actionNum] + 1) * sizeof(uint16); offset = startOffset + totalSize; remainingSize -= (numParams[actionNum] + 1) * sizeof(uint16); } @@ -292,19 +292,19 @@ uint16 process_action_sequence_entry(int supportIndex, byte *data, uint16 remain // handle post-processing of the symbol list for (int symbolCtr = 0; symbolCtr < numSymbols; ++symbolCtr) { - if (READ_LE_UINT16(symbolTable[symbolCtr].p) == 0) + if (READ_LE_UINT16(symbolTable[symbolCtr].p) == 0) // No Id special constant WRITE_LE_UINT16(symbolTable[symbolCtr].p, 0xffff); else { // Handle resolving the constant - index = get_sequence_index(READ_LE_UINT16(symbolTable[symbolCtr].p), + index = get_sequence_index(READ_LE_UINT16(symbolTable[symbolCtr].p), symbolTable[symbolCtr].globalNeeded ? -1 : supportIndex); //printf("Symbol %xh => %xh\n", *symbolTable[symbolCtr].p, index); if (index != 0xffff) { - // Jump found - so replace symbol entry with it + // Jump found - so replace symbol entry with it WRITE_LE_UINT16(symbolTable[symbolCtr].p, index); } else { - printf("Sequence contained unknown offset %xh\n", + printf("Sequence contained unknown offset %xh\n", READ_LE_UINT16(symbolTable[symbolCtr].p)); exit(1); } @@ -328,7 +328,7 @@ void process_entry(uint16 offset, byte *data, uint16 &totalSize) { } //printf("process_entry index=%d, offset=%xh\n", numSupportEntries, offset); - totalSize += process_action_sequence_entry(numSupportEntries - 1, + totalSize += process_action_sequence_entry(numSupportEntries - 1, data + totalSize, MAX_DATA_SIZE - totalSize); } } @@ -344,7 +344,7 @@ struct RoomRandomActionSet { RoomRandomActionEntry *entries; }; -void read_action_sequence(byte *&data, uint16 &totalSize) +void read_action_sequence(byte *&data, uint16 &totalSize) { uint16 hotspotIndex; HotspotHeaderEntry entryHeader; @@ -364,7 +364,7 @@ void read_action_sequence(byte *&data, uint16 &totalSize) /* Process the list of random actions that your follower can do in each room */ RoomRandomActionSet *randomActions = new RoomRandomActionSet[RANDOM_ROOM_NUM_ENTRIES]; - + // Get a list of the offsets for each room uint16 raOffset = 0x4D10; if (language == IT_ITA) raOffset = 0x4dc0; @@ -399,11 +399,11 @@ void read_action_sequence(byte *&data, uint16 &totalSize) offset += 2; uint16 firstCommand = lureExe.readWord(); - randomActions[roomIndex].entries[entryCtr].offset = + randomActions[roomIndex].entries[entryCtr].offset = (firstCommand == 0xfffe) ? 0 : offset; - + offset += sizeof(uint16); - while (lureExe.readWord() != 0xffff) + while (lureExe.readWord() != 0xffff) offset += sizeof(uint16); offset += sizeof(uint16); } @@ -424,8 +424,8 @@ void read_action_sequence(byte *&data, uint16 &totalSize) process_entry(0x13c2, data, totalSize); // RETURN sequence process_entry(0xbb95, data, totalSize); // Exit blocked sequence process_entry(0x706c, data, totalSize); // Jump proc #2 - go to castle basement - process_entry(0x728a, data, totalSize); - process_entry(0x76ec, data, totalSize); + process_entry(0x728a, data, totalSize); + process_entry(0x76ec, data, totalSize); process_entry(0x4ebb, data, totalSize); // Goewin as a follower in cave process_entry(0x7D9D, data, totalSize); // Goewin standard handler break; @@ -453,9 +453,9 @@ void read_action_sequence(byte *&data, uint16 &totalSize) errorExit("read_action_sequence: Unknown language"); } - // Process the script engine list - - for (index = 0; index < NUM_TABLED_ACTION_BLOCKS; ++index) + // Process the script engine list + + for (index = 0; index < NUM_TABLED_ACTION_BLOCKS; ++index) if (offsetList[index] != 0) process_entry(offsetList[index], data, totalSize); @@ -470,7 +470,7 @@ void read_action_sequence(byte *&data, uint16 &totalSize) hotspotIndex = 0; for (;;) { - lureExe.seek(dataSegment + hsOffset + + lureExe.seek(dataSegment + hsOffset + hotspotIndex * sizeof(HotspotHeaderEntry)); lureExe.read(&entryHeader, sizeof(HotspotHeaderEntry)); if (FROM_LE_16(entryHeader.offset) == 0xffff) break; @@ -479,7 +479,7 @@ void read_action_sequence(byte *&data, uint16 &totalSize) // Move to the action sequence area of the hotspot lureExe.seek(dataSegment + entryHeader.offset + 0x63); lureExe.read(&action, sizeof(CurrentActionInput)); - if (FROM_LE_16(action.action) == 2) + if (FROM_LE_16(action.action) == 2) process_entry(FROM_LE_16(action.dataOffset), data, totalSize); } @@ -500,7 +500,7 @@ void read_action_sequence(byte *&data, uint16 &totalSize) // Output the list used in the script engine pHeader = (uint16 *) data; - for (index = 0; index < NUM_TABLED_ACTION_BLOCKS; ++index) + for (index = 0; index < NUM_TABLED_ACTION_BLOCKS; ++index) if (offsetList[index] == 0) *pHeader++ = 0; else @@ -535,7 +535,7 @@ void read_action_sequence(byte *&data, uint16 &totalSize) // Output the offsets of each action set - for (index = 0; index < numSupportEntries; ++index) + for (index = 0; index < numSupportEntries; ++index) *pHeader++ = TO_LE_16(supportList[index].resourceOffset); *pHeader++ = TO_LE_16(0xffff); @@ -546,4 +546,4 @@ void read_action_sequence(byte *&data, uint16 &totalSize) delete randomActions[roomIndex].entries; } delete randomActions; -} +} diff --git a/tools/credits.pl b/tools/credits.pl index 19ee4d7979..48cd200667 100755 --- a/tools/credits.pl +++ b/tools/credits.pl @@ -58,7 +58,7 @@ if ($mode eq "TEXT") { # Convert HTML entities to ASCII for the plain text mode sub html_entities_to_ascii { my $text = shift; - + # For now we hardcode these mappings # á -> a # é -> e @@ -82,7 +82,7 @@ sub html_entities_to_ascii { $text =~ s/ö/oe/g; $text =~ s/&/&/g; - + return $text; } @@ -101,14 +101,14 @@ sub html_entities_to_cpp { $text =~ s/ü/\\374/g; $text =~ s/&/&/g; - + return $text; } # Convert HTML entities to RTF codes sub html_entities_to_rtf { my $text = shift; - + $text =~ s/á/\\'87/g; $text =~ s/é/\\'8e/g; $text =~ s/ó/\\'97/g; @@ -120,14 +120,14 @@ sub html_entities_to_rtf { $text =~ s/ü/\\'9f/g; $text =~ s/&/&/g; - + return $text; } # Convert HTML entities to TeX codes sub html_entities_to_tex { my $text = shift; - + $text =~ s/á/\\'a/g; $text =~ s/é/\\'e/g; $text =~ s/ó/\\'o/g; @@ -139,11 +139,11 @@ sub html_entities_to_tex { $text =~ s/ü/\\"u/g; $text =~ s/&/\\&/g; - + return $text; } -# +# # Small reference of the RTF commands used here: # # \fs28 switches to 14 point font (28 = 2 * 14) @@ -224,7 +224,7 @@ sub begin_section { if ($section_level >= 2) { $title .= ":" } - + print " " x $section_level . $title."\n"; if ($section_level eq 0) { print " " x $section_level . "*" x (length $title)."\n"; @@ -251,7 +251,7 @@ sub begin_section { } elsif ($section_level eq 1) { print '\fs32 '; } - + # Insert an empty line before this section header, *unless* # this is the very first section header in the file. if ($section_level > 0 || @section_count[0] > 0) { @@ -261,7 +261,7 @@ sub begin_section { print '\f1\b0\fs24 \cf0 \\' . "\n"; } elsif ($mode eq "CPP") { if ($section_level eq 0) { - # TODO: Would be nice to have a 'fat' or 'large' mode for + # TODO: Would be nice to have a 'fat' or 'large' mode for # headlines... $title = html_entities_to_cpp($title); print '"\\\\C\\\\c1""'.$title.'",' . "\n"; @@ -347,15 +347,15 @@ sub add_person { my $nick = shift; my $desc = shift; my $tab; - + if ($mode eq "TEXT") { $name = $nick if $name eq ""; $name = html_entities_to_ascii($name); $desc = html_entities_to_ascii($desc); - + $tab = " " x ($section_level * 2 + 1); printf $tab."%-".$max_name_width.".".$max_name_width."s", $name; - + # Print desc wrapped if (length $desc > 0) { my $inner_indent = ($section_level * 2 + 1) + $max_name_width + 3; @@ -418,7 +418,7 @@ sub add_person { sub add_paragraph { my $text = shift; my $tab; - + if ($mode eq "TEXT") { $tab = " " x ($section_level * 2 + 1); print wrap($tab, $tab, html_entities_to_ascii($text))."\n"; diff --git a/tools/md5table.c b/tools/md5table.c index b57f39e7bd..342e60986c 100644 --- a/tools/md5table.c +++ b/tools/md5table.c @@ -152,7 +152,7 @@ static const char *c_footer = static void parseEntry(Entry *entry, char *line) { assert(entry); assert(line); - + /* Split at the tabs */ entry->md5 = strtok(line, "\t\n\r"); entry->size = strtok(NULL, "\t\n\r"); @@ -238,7 +238,7 @@ int main(int argc, char *argv[]) } else { showhelp(argv[0]); } - + time(&theTime); generationDate = strdup(asctime(gmtime(&theTime))); @@ -260,7 +260,7 @@ int main(int argc, char *argv[]) parseEntry(&entry, line+1); if (outputMode == kPHPOutput) { fprintf(outFile, "\taddEntry("); - + // Print the description string fprintf(outFile, "\""); if (entry.extra && strcmp(entry.extra, "-")) { @@ -342,7 +342,7 @@ int main(int argc, char *argv[]) if (outputMode == kPHPOutput) { if (gameid[0] != 0) // If there is an active section, close it now fprintf(outFile, "endSection();\n"); - + fprintf(outFile, "?>\n"); } @@ -365,7 +365,7 @@ int main(int argc, char *argv[]) /* Finally, print the footer */ fprintf(outFile, c_footer); } - + free(entriesBuffer); return 0; diff --git a/tools/module.mk b/tools/module.mk index cb91912b7f..97cc5d0b9a 100644 --- a/tools/module.mk +++ b/tools/module.mk @@ -57,7 +57,7 @@ md5scumm: tools/md5table$(EXEEXT) # -# Rules which automatically and implicitly rebuild the credits and +# Rules which automatically and implicitly rebuild the credits and # MD5 tables when needed. # These are currently disabled, because if the input data changes, then # the generated files should be checked in, too. Otherwise, we'd reduce diff --git a/tools/skycpt/KmpSearch.cpp b/tools/skycpt/KmpSearch.cpp index 93318de15e..c70a0a77d8 100644 --- a/tools/skycpt/KmpSearch.cpp +++ b/tools/skycpt/KmpSearch.cpp @@ -41,11 +41,11 @@ __declspec(naked) void __fastcall KmpSearch::init(const char *subStr) { lea edi, [ecx + KmpSearch::_subStr] // this + 0x100 lea ebx, [ecx + KmpSearch::_retarget] // this lea ebp, [ecx + 1] - + mov byte ptr [ebx], -1 xor eax, eax - + loopStart: shr ecx, 8 test al, 3 @@ -107,7 +107,7 @@ __declspec(naked) char * __fastcall KmpSearch::search(const char *str) { jz short endOfString // goto endOfString xor edx, edx // index - + mov cl, 3 searchLoop: shr eax, 8 @@ -117,7 +117,7 @@ __declspec(naked) char * __fastcall KmpSearch::search(const char *str) { lodsd xor cl, cl skipRead: - + test al, al jz short endOfString diff --git a/tools/skycpt/ReadMe.txt b/tools/skycpt/ReadMe.txt index f66c4f9f4f..396f9c3080 100644 --- a/tools/skycpt/ReadMe.txt +++ b/tools/skycpt/ReadMe.txt @@ -44,7 +44,7 @@ If you still want to waste your time by creating this file: 9) Rename this file to SKY.CPT. 10) DELETE IT BECAUSE IT'S PROBABLY BROKEN, NOT WORTH BOTHERING WITH ANYWAYS AND DOWNLOAD THE SKY.CPT FILE FROM THE URL ABOVE!! - + Oh, I almost forgot. The program only works on little endian systems and probably isn't alignment safe either. It may also leak memory or accidentially reformat your harddisk. Who knows. diff --git a/tools/skycpt/cptcompiler.cpp b/tools/skycpt/cptcompiler.cpp index 326390ce8d..0572bc1537 100644 --- a/tools/skycpt/cptcompiler.cpp +++ b/tools/skycpt/cptcompiler.cpp @@ -244,7 +244,7 @@ void processSymlinks(FILE *inf, CptObj *destArr, uint16 *baseLists) { assertEmpty(from); dlinkNames[dlinkCount] = (char*)malloc(strlen(cptName) + 1); strcpy(dlinkNames[dlinkCount], cptName); - + dofgets(line, 1024, inf); assert((line[0] == '\t') && (line[1] == '\t') && (line[2] == '-') && (line[3] == '>')); char *stopCh; @@ -256,7 +256,7 @@ void processSymlinks(FILE *inf, CptObj *destArr, uint16 *baseLists) { dlinks[dlinkCount * 2 + 1] = destId; dlinkCount++; - + dofgets(line, 1024, inf); assert(isEndOfObject(line, "SYMLINK", fromId)); } else @@ -303,7 +303,7 @@ void doCompile(FILE *inf, FILE *debOutf, FILE *resOutf, TextFile *cptDef, FILE * if (resCpts[id].data || resCpts[id].dbgName || resCpts[id].len) dataListLen[cnt] = elemCnt + 1; } - + // write the header uint32 rev = 0; fwrite(&rev, 2, 1, debOutf); @@ -432,7 +432,7 @@ void doCompile(FILE *inf, FILE *debOutf, FILE *resOutf, TextFile *cptDef, FILE * pos++; diff[diffDest++] = (uint16)strtoul(pos, &pos, 16); } - assert(diff[diffDest - 1] == 0xFFFF); + assert(diff[diffDest - 1] == 0xFFFF); diffNo++; } } @@ -457,7 +457,7 @@ void doCompile(FILE *inf, FILE *debOutf, FILE *resOutf, TextFile *cptDef, FILE * else { saveIds[numIds] = resId; numIds++; - } + } } printf("%d saveIds\n", numIds); fwrite(&numIds, 2, 1, debOutf); @@ -481,7 +481,7 @@ void doCompile(FILE *inf, FILE *debOutf, FILE *resOutf, TextFile *cptDef, FILE * printf("File %s not found\n", inName); } } - + if (filesExist) { FILE *res288 = fopen("RESET.288", "rb"); fseek(res288, 0, SEEK_END); diff --git a/tools/skycpt/idFinder.cpp b/tools/skycpt/idFinder.cpp index 70452363e1..e97dd7d6fe 100644 --- a/tools/skycpt/idFinder.cpp +++ b/tools/skycpt/idFinder.cpp @@ -35,7 +35,7 @@ uint16 findCptId(char *name, TextFile *cptFile) { cLine = cptFile->findLine(kmp, cLine); if (cLine >= 0) { char *line = cptFile->giveLine(cLine); - if ((strncmp(line, "COMPACT::", 9) == 0) || + if ((strncmp(line, "COMPACT::", 9) == 0) || (strncmp(line, "SCRATCH::", 9) == 0) || (strncmp(line, "GET_TOS::", 9) == 0)) { char *stopCh; diff --git a/tools/update-version.pl b/tools/update-version.pl index b3d5a72b69..f1563282e5 100755 --- a/tools/update-version.pl +++ b/tools/update-version.pl @@ -61,14 +61,14 @@ foreach my $file (@subs_files) { print "Processing $file...\n"; open(INPUT, "< $file.in") or die "Can't open '$file.in' for reading: $!\n"; open(OUTPUT, "> $file") or die "Can't open '$file' for writing: $!\n"; - + while (<INPUT>) { while (my ($key, $value) = each(%subs)) { s/\@$key\@/$value/; } print OUTPUT; } - + close(INPUT); close(OUTPUT); } |