diff options
-rw-r--r-- | tools/create_drascula/create_drascula.cpp | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/tools/create_drascula/create_drascula.cpp b/tools/create_drascula/create_drascula.cpp index 118540db81..000122c485 100644 --- a/tools/create_drascula/create_drascula.cpp +++ b/tools/create_drascula/create_drascula.cpp @@ -52,6 +52,7 @@ static void writeUint16BE(FILE *fp, uint16 value) { int main(int argc, char *argv[]) { FILE* outFile; int i, lang; + int len; outFile = fopen("drascula.dat", "wb"); @@ -169,6 +170,12 @@ int main(int argc, char *argv[]) { // Write _text writeUint16BE(outFile, NUM_TEXT); for (lang = 0; lang < NUM_LANGS; lang++) { + len = 0; + for (i = 0; i < NUM_TEXT; i++) { + len += strlen(_text[lang][i]) + 2; + } + writeUint16BE(outFile, len); + for (i = 0; i < NUM_TEXT; i++) { writeUint16BE(outFile, strlen(_text[lang][i])); fwrite(_text[lang][i], strlen(_text[lang][i]), 1, outFile); @@ -178,6 +185,12 @@ int main(int argc, char *argv[]) { // Write _textd writeUint16BE(outFile, NUM_TEXTD); for (lang = 0; lang < NUM_LANGS; lang++) { + len = 0; + for (i = 0; i < NUM_TEXTD; i++) { + len += strlen(_textd[lang][i]) + 2; + } + writeUint16BE(outFile, len); + for (i = 0; i < NUM_TEXTD; i++) { writeUint16BE(outFile, strlen(_textd[lang][i])); fwrite(_textd[lang][i], strlen(_textd[lang][i]), 1, outFile); @@ -187,6 +200,12 @@ int main(int argc, char *argv[]) { // Write _textb writeUint16BE(outFile, NUM_TEXTB); for (lang = 0; lang < NUM_LANGS; lang++) { + len = 0; + for (i = 0; i < NUM_TEXTB; i++) { + len += strlen(_textb[lang][i]) + 2; + } + writeUint16BE(outFile, len); + for (i = 0; i < NUM_TEXTB; i++) { writeUint16BE(outFile, strlen(_textb[lang][i])); fwrite(_textb[lang][i], strlen(_textb[lang][i]), 1, outFile); @@ -196,6 +215,12 @@ int main(int argc, char *argv[]) { // Write _textbj writeUint16BE(outFile, NUM_TEXTBJ); for (lang = 0; lang < NUM_LANGS; lang++) { + len = 0; + for (i = 0; i < NUM_TEXTBJ; i++) { + len += strlen(_textbj[lang][i]) + 2; + } + writeUint16BE(outFile, len); + for (i = 0; i < NUM_TEXTBJ; i++) { writeUint16BE(outFile, strlen(_textbj[lang][i])); fwrite(_textbj[lang][i], strlen(_textbj[lang][i]), 1, outFile); @@ -205,6 +230,12 @@ int main(int argc, char *argv[]) { // Write _texte writeUint16BE(outFile, NUM_TEXTE); for (lang = 0; lang < NUM_LANGS; lang++) { + len = 0; + for (i = 0; i < NUM_TEXTE; i++) { + len += strlen(_texte[lang][i]) + 2; + } + writeUint16BE(outFile, len); + for (i = 0; i < NUM_TEXTE; i++) { writeUint16BE(outFile, strlen(_texte[lang][i])); fwrite(_texte[lang][i], strlen(_texte[lang][i]), 1, outFile); @@ -214,6 +245,12 @@ int main(int argc, char *argv[]) { // Write _texti writeUint16BE(outFile, NUM_TEXTI); for (lang = 0; lang < NUM_LANGS; lang++) { + len = 0; + for (i = 0; i < NUM_TEXTI; i++) { + len += strlen(_texti[lang][i]) + 2; + } + writeUint16BE(outFile, len); + for (i = 0; i < NUM_TEXTI; i++) { writeUint16BE(outFile, strlen(_texti[lang][i])); fwrite(_texti[lang][i], strlen(_texti[lang][i]), 1, outFile); @@ -223,6 +260,12 @@ int main(int argc, char *argv[]) { // Write _textl writeUint16BE(outFile, NUM_TEXTL); for (lang = 0; lang < NUM_LANGS; lang++) { + len = 0; + for (i = 0; i < NUM_TEXTL; i++) { + len += strlen(_textl[lang][i]) + 2; + } + writeUint16BE(outFile, len); + for (i = 0; i < NUM_TEXTL; i++) { writeUint16BE(outFile, strlen(_textl[lang][i])); fwrite(_textl[lang][i], strlen(_textl[lang][i]), 1, outFile); @@ -232,6 +275,12 @@ int main(int argc, char *argv[]) { // Write _textp writeUint16BE(outFile, NUM_TEXTP); for (lang = 0; lang < NUM_LANGS; lang++) { + len = 0; + for (i = 0; i < NUM_TEXTP; i++) { + len += strlen(_textp[lang][i]) + 2; + } + writeUint16BE(outFile, len); + for (i = 0; i < NUM_TEXTP; i++) { writeUint16BE(outFile, strlen(_textp[lang][i])); fwrite(_textp[lang][i], strlen(_textp[lang][i]), 1, outFile); @@ -241,6 +290,12 @@ int main(int argc, char *argv[]) { // Write _textt writeUint16BE(outFile, NUM_TEXTT); for (lang = 0; lang < NUM_LANGS; lang++) { + len = 0; + for (i = 0; i < NUM_TEXTT; i++) { + len += strlen(_textt[lang][i]) + 2; + } + writeUint16BE(outFile, len); + for (i = 0; i < NUM_TEXTT; i++) { writeUint16BE(outFile, strlen(_textt[lang][i])); fwrite(_textt[lang][i], strlen(_textt[lang][i]), 1, outFile); @@ -250,6 +305,12 @@ int main(int argc, char *argv[]) { // Write _textvb writeUint16BE(outFile, NUM_TEXTVB); for (lang = 0; lang < NUM_LANGS; lang++) { + len = 0; + for (i = 0; i < NUM_TEXTVB; i++) { + len += strlen(_textvb[lang][i]) + 2; + } + writeUint16BE(outFile, len); + for (i = 0; i < NUM_TEXTVB; i++) { writeUint16BE(outFile, strlen(_textvb[lang][i])); fwrite(_textvb[lang][i], strlen(_textvb[lang][i]), 1, outFile); @@ -259,6 +320,12 @@ int main(int argc, char *argv[]) { // Write _textsys writeUint16BE(outFile, NUM_TEXTSYS); for (lang = 0; lang < NUM_LANGS; lang++) { + len = 0; + for (i = 0; i < NUM_TEXTSYS; i++) { + len += strlen(_textsys[lang][i]) + 2; + } + writeUint16BE(outFile, len); + for (i = 0; i < NUM_TEXTSYS; i++) { writeUint16BE(outFile, strlen(_textsys[lang][i])); fwrite(_textsys[lang][i], strlen(_textsys[lang][i]), 1, outFile); @@ -268,6 +335,12 @@ int main(int argc, char *argv[]) { // Write _texthis writeUint16BE(outFile, NUM_TEXTHIS); for (lang = 0; lang < NUM_LANGS; lang++) { + len = 0; + for (i = 0; i < NUM_TEXTHIS; i++) { + len += strlen(_texthis[lang][i]) + 2; + } + writeUint16BE(outFile, len); + for (i = 0; i < NUM_TEXTHIS; i++) { writeUint16BE(outFile, strlen(_texthis[lang][i])); fwrite(_texthis[lang][i], strlen(_texthis[lang][i]), 1, outFile); @@ -277,6 +350,12 @@ int main(int argc, char *argv[]) { // Write _textverbs writeUint16BE(outFile, NUM_TEXTVERBS); for (lang = 0; lang < NUM_LANGS; lang++) { + len = 0; + for (i = 0; i < NUM_TEXTVERBS; i++) { + len += strlen(_textverbs[lang][i]) + 2; + } + writeUint16BE(outFile, len); + for (i = 0; i < NUM_TEXTVERBS; i++) { writeUint16BE(outFile, strlen(_textverbs[lang][i])); fwrite(_textverbs[lang][i], strlen(_textverbs[lang][i]), 1, outFile); @@ -286,6 +365,12 @@ int main(int argc, char *argv[]) { // Write _textmisc writeUint16BE(outFile, NUM_TEXTMISC); for (lang = 0; lang < NUM_LANGS; lang++) { + len = 0; + for (i = 0; i < NUM_TEXTMISC; i++) { + len += strlen(_textmisc[lang][i]) + 2; + } + writeUint16BE(outFile, len); + for (i = 0; i < NUM_TEXTMISC; i++) { writeUint16BE(outFile, strlen(_textmisc[lang][i])); fwrite(_textmisc[lang][i], strlen(_textmisc[lang][i]), 1, outFile); @@ -295,6 +380,12 @@ int main(int argc, char *argv[]) { // Write _textd1 writeUint16BE(outFile, NUM_TEXTD1); for (lang = 0; lang < NUM_LANGS; lang++) { + len = 0; + for (i = 0; i < NUM_TEXTD1; i++) { + len += strlen(_textd1[lang][i]) + 2; + } + writeUint16BE(outFile, len); + for (i = 0; i < NUM_TEXTD1; i++) { writeUint16BE(outFile, strlen(_textd1[lang][i])); fwrite(_textd1[lang][i], strlen(_textd1[lang][i]), 1, outFile); |