+/*
+ * 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
* 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;
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");