summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpixel <pixel>2003-01-14 20:36:39 +0000
committerpixel <pixel>2003-01-14 20:36:39 +0000
commitec38f356b3aa30273bf9655d8da0b467440b31e2 (patch)
tree5c11d7fc9211fda74b6ad0e00f0dcbda4a33f1e7
parent10ae629edf1f285a295df85664c075f58cf56a87 (diff)
Plop...
-rwxr-xr-xXenogears/Makefile5
-rw-r--r--Xenogears/compil.lex49
-rw-r--r--Xenogears/script-comp.cpp24
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. */
+
<I>" " yputc(0x10, 2);
<I>"+" yputc(0x11, 2);
<I>"," yputc(0x12, 2);
@@ -229,6 +231,9 @@
<I>"<...>" yputc(0x8e, 3);
<I>"<'>" yputc(0x8f, 3);
+
+ /* Conversion for all the kanas */
+
<I>"<Extra1"\ +[[:digit:]]+">" {
int d = atoi(yytext + 7);
if (d > 255) {
@@ -251,6 +256,8 @@
}
}
+ /* All the unknow things */
+
<I>"<Bare"\ +[[:xdigit:]]{1,2}">" {
char str[5] = {'0', 'x', 0, 0, 0};
int d;
@@ -267,14 +274,35 @@
}
}
-<I>à|â|ä unput('a');
-<I>é|è|ê|ë unput('e');
-<I>î|ï unput('i');
-<I>ô|ö unput('o');
-<I>û|ü|ù unput('u');
+ /* The special characters that are/has to be translated */
+
+<I>à unput('a');
+<I>â unput('a');
+<I>ä unput('a');
+<I>é unput('e');
+<I>è unput('e');
+<I>ê unput('e');
+<I>ë unput('e');
+<I>î unput('i');
+<I>ï unput('i');
+<I>ô unput('o');
+<I>ö unput('o');
+<I>û unput('u');
+<I>ü unput('u');
+<I>ù unput('u');
+<I>Ä unput('A');
+<I>Ë unput('E');
+<I>Ï unput('I');
+<I>Ô unput('O');
+<I>Ö unput('O');
+<I>Ü unput('U');
<I>ç unput('c');
<I>"<oe>" unput('e'); unput('o');
<I>"<ae>" unput('e'); unput('a');
+<I>ß unput('s'); unput('s');
+
+
+ /* The Gears names. */
<I>"<Fei>" unputs("<Gear 00>");
<I>"<Elly>" unputs("<Gear 01>");
@@ -332,6 +360,7 @@
<O>\n num_lines++;
<O>. /* Eat up comments */
+ /* Translating all the "not common" (windows) charset. */
<I>\210 unputs("à");
<I>\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;