X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=compile.c;h=4360d97b767b317484592741cadef7cae4c7b76c;hb=60a3a6d1fe65dd15507d0e9e9472df4d1e097b89;hp=c04806519eea0e714322fff2c8838fa812161c2c;hpb=dda636bbc1c15fc28e5d52ad08ef3bcc30a3e682;p=open-adventure.git diff --git a/compile.c b/compile.c index c048065..4360d97 100644 --- a/compile.c +++ b/compile.c @@ -1,7 +1,13 @@ +/* + * The dungeon compiler. Turns adventure.text into a set of C initializers + * defining (mostly) invariant state. A couple of slots are messed with + * at runtime. + */ +#include "sizes.h" + #define LINESIZE 100 #define RTXSIZ 277 #define CLSMAX 12 -#define LOCSIZ 185 #define LINSIZ 12600 #define TRNSIZ 5 #define TABSIZ 330 @@ -262,13 +268,18 @@ int read_database(FILE* database) { * section 6's stuff. CTEXT(N) points to a player-class message. TTEXT is for * section 14. We also clear COND (see description of section 9 for details). */ - for (int I=1; I<=300; I++) { - if(I <= NOBJECTS) PTEXT[I] = 0; - if(I <= RTXSIZ) RTEXT[I] = 0; - if(I <= CLSMAX) CTEXT[I] = 0; - if(I <= NOBJECTS) OBJSND[I] = 0; - if(I <= NOBJECTS) OBJTXT[I] = 0; - if(I > LOCSIZ) break; + for (int I=1; I<=NOBJECTS; I++) { + PTEXT[I] = 0; + OBJSND[I] = 0; + OBJTXT[I] = 0; + } + for (int I=1; I<=RTXSIZ; I++) { + RTEXT[I] = 0; + } + for (int I=1; I<=CLSMAX; I++) { + CTEXT[I] = 0; + } + for (int I=1; I<=LOCSIZ; I++) { STEXT[I] = 0; LTEXT[I] = 0; COND[I] = 0; @@ -548,10 +559,9 @@ void write_hints(FILE* c_file, FILE* header_file, long matrix[][HINTLEN], long d void write_files(FILE* c_file, FILE* header_file) { // preprocessor defines for the header - fprintf(header_file, "#define NOBJECTS %d\n", NOBJECTS); + fprintf(header_file, "#include \"sizes.h\"\n"); fprintf(header_file, "#define RTXSIZ 277\n"); fprintf(header_file, "#define CLSMAX 12\n"); - fprintf(header_file, "#define LOCSIZ 185\n"); fprintf(header_file, "#define LINSIZ %d\n", LINSIZ); fprintf(header_file, "#define TRNSIZ 5\n"); fprintf(header_file, "#define TABSIZ 330\n");