From ec38f356b3aa30273bf9655d8da0b467440b31e2 Mon Sep 17 00:00:00 2001 From: pixel Date: Tue, 14 Jan 2003 20:36:39 +0000 Subject: Plop... --- Xenogears/Makefile | 5 +++-- Xenogears/compil.lex | 49 ++++++++++++++++++++++++++++++++++++++++++----- Xenogears/script-comp.cpp | 24 ++++++++++++----------- 3 files changed, 60 insertions(+), 18 deletions(-) diff --git a/Xenogears/Makefile b/Xenogears/Makefile index 61f4486..5fbefb7 100755 --- a/Xenogears/Makefile +++ b/Xenogears/Makefile @@ -3,6 +3,7 @@ CPPFLAGS=-Wall -g -O3 -mcpu=i686 -pedantic -pedantic-errors -I../includes -DHAVE_ZLIB CXX=g++ CC=gcc +LEX=flex LIBS=-lz #-lefence @@ -35,10 +36,10 @@ compil-2: compil-2.o ${CC} ${LDFLAGS} compil-2.o -o compil-2 compil.c: compil.lex - lex -ocompil.c compil.lex + ${LEX} -ocompil.c compil.lex compil-2.c: compil-2.lex - lex -ocompil-2.c compil-2.lex + ${LEX} -ocompil-2.c compil-2.lex clean: rm -f *.o ${TARGET} compil.c diff --git a/Xenogears/compil.lex b/Xenogears/compil.lex index 21e0572..c52ebae 100644 --- a/Xenogears/compil.lex +++ b/Xenogears/compil.lex @@ -172,6 +172,8 @@ BEGIN(I); } + /* The "primary" charset. */ + " " yputc(0x10, 2); "+" yputc(0x11, 2); "," yputc(0x12, 2); @@ -229,6 +231,9 @@ "<...>" yputc(0x8e, 3); "<'>" yputc(0x8f, 3); + + /* Conversion for all the kanas */ + "" { int d = atoi(yytext + 7); if (d > 255) { @@ -251,6 +256,8 @@ } } + /* All the unknow things */ + "" { char str[5] = {'0', 'x', 0, 0, 0}; int d; @@ -267,14 +274,35 @@ } } -à|â|ä unput('a'); -é|è|ê|ë unput('e'); -î|ï unput('i'); -ô|ö unput('o'); -û|ü|ù unput('u'); + /* The special characters that are/has to be translated */ + +à unput('a'); +â unput('a'); +ä unput('a'); +é unput('e'); +è unput('e'); +ê unput('e'); +ë unput('e'); +î unput('i'); +ï unput('i'); +ô unput('o'); +ö unput('o'); +û unput('u'); +ü unput('u'); +ù unput('u'); +Ä unput('A'); +Ë unput('E'); +Ï unput('I'); +Ô unput('O'); +Ö unput('O'); +Ü unput('U'); ç unput('c'); "" unput('e'); unput('o'); "" unput('e'); unput('a'); +ß unput('s'); unput('s'); + + + /* The Gears names. */ "" unputs(""); "" unputs(""); @@ -332,6 +360,7 @@ \n num_lines++; . /* Eat up comments */ + /* Translating all the "not common" (windows) charset. */ \210 unputs("à"); \211 unputs("â"); @@ -388,6 +417,16 @@ void yputc(int c, int a) { putc(c, yyout); } +void ypute1c(int c, int a) { + putc(0xfe, yyout); + yputc(c, a); +} + +void ypute2c(int c, int a) { + putc(0xff, yyout); + yputc(c, a); +} + void unputs(char * s) { int l = strlen(s), i; diff --git a/Xenogears/script-comp.cpp b/Xenogears/script-comp.cpp index 76eab1d..9f8520c 100644 --- a/Xenogears/script-comp.cpp +++ b/Xenogears/script-comp.cpp @@ -17,7 +17,7 @@ void process_one_file(Handle * f, Handle * d, int n) { char zeros[4] = {0, 0, 0, 0}, * datas; long script_position, true_length, delta, data_length; Handle * f_part; - + char tmpNm[256]; printm(M_BARE, " Copying header\n"); f->seek(0x14c); @@ -34,14 +34,16 @@ void process_one_file(Handle * f, Handle * d, int n) { datas = (char *) malloc(data_length); f->read(datas, data_length); - printm(M_BARE, " Processing script\n"); - nom_du_fichier = String("xeno_d1/ROOMS/") + n + "/script.comp"; + printm(M_BARE, " Processing script\n"); + char tmpNm[256]; + sprintf(tmpNm,"xeno_d1/ROOMS/%04d/script.comp",n); + nom_du_fichier = String(tmpNm); f_part = new Input(nom_du_fichier); true_length = f_part->GetSize(); - script_position = d->seek(0); - d->seek(0x14c); + script_position = d->tell(); + d->seek(0x14c); d->write(&script_position, 4); d->seek(0x128); d->write(&true_length, 4); @@ -59,9 +61,9 @@ void process_one_file(Handle * f, Handle * d, int n) { printm(M_BARE, " Processing extra datas\n"); script_position = d->tell(); d->seek(0x150); - d->write(&script_position, 4); - d->seek(0); - + d->write(&script_position, 4); + + d->seek(0,SEEK_END); d->write(datas, data_length); free(datas); @@ -74,7 +76,7 @@ virtual int startup() throw (GeneralException) int num = 0; String nom_du_fichier; - for (i = 384; i < 1844; i = i + 2) { + for (i = 384; i < 1844; i = i + 2) { printm(M_BARE, "CD1 - File %d -> Script %d\n", i, num); nom_du_fichier.set("xeno_d1/ROOMS/%04d.out", i); f_script_comp = new Input(nom_du_fichier); @@ -88,7 +90,7 @@ virtual int startup() throw (GeneralException) num++; } num = 0; - + /* for (i = 379; i < 1838; i = i + 2) { printm(M_BARE, "CD2 - File %d -> Script %d\n", i, num); @@ -102,7 +104,7 @@ virtual int startup() throw (GeneralException) delete f_script_comp; delete f_new_script; num++; - } + }*/ printm(M_BARE, "Done !\n"); return 0; -- cgit v1.2.3