X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=dungeon.c;h=19b55c1652e230b8c2cad44f59f1356f57530a1f;hb=66c22301edf3126e7525e1c52efdde8fb69e0257;hp=62c077272e6b6b06725b13b5a44dd7a2ac8521d5;hpb=844cb056199a25fa1a9bd18c1755a8697ff1f0e9;p=open-adventure.git diff --git a/dungeon.c b/dungeon.c index 62c0772..19b55c1 100644 --- a/dungeon.c +++ b/dungeon.c @@ -3,7 +3,7 @@ * defining (mostly) invariant state. A couple of slots are messed with * at runtime. */ -#include "sizes.h" +#include "common.h" #define LINESIZE 100 #define RTXSIZ 277 @@ -24,15 +24,12 @@ /* hard limit, will be propagated to database.h */ #define NOBJECTS 100 -const char advent_to_ascii[] = {0, 32, 33, 34, 39, 40, 41, 42, 43, 44, 45, 46, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 37, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 35, 36, 38, 47, 58, 59, 60, 61, 62, 63, 64, 91, 92, 93, 94, 95, 96, 123, 124, 125, 126, 0}; -/* Rendered from the now-gone MPINIT() function */ -const char ascii_to_advent[] = {0, 74, 75, 76, 77, 78, 79, 80, 81, 82, 0, 0, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 0, 1, 2, 106, 107, 63, 108, 3, 4, 5, 6, 7, 8, 9, 10, 109, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 110, 111, 112, 113, 114, 115, 116, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 117, 118, 119, 120, 121, 122, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 123, 124, 125, 126, 83}; - // Global variables for use in functions below that can gradually disappear as code is cleaned up static long LNLENG; static long LNPOSN; static char INLINE[LINESIZE+1]; static long OLDLOC; +static long MAXDIE; // Storage for what comes out of the database long LINUSE; @@ -203,7 +200,7 @@ void MAPLIN(FILE *OPENED) { LNLENG = 0; for (size_t i = 1; i <= sizeof(INLINE) && INLINE[i] != 0; ++i) { - char val = INLINE[i] + 1; + char val = INLINE[i]; INLINE[i] = ascii_to_advent[(unsigned)val]; if (INLINE[i] != 0) LNLENG = i; @@ -556,8 +553,15 @@ void write_hints(FILE* c_file, FILE* header_file, long matrix[][HINTLEN], long d void write_files(FILE* c_file, FILE* header_file) { + int i, MAXDIE; + for (i=0; i<=4; i++) { + long x = 2*i+81; + if(RTEXT[x] != 0) + MAXDIE=i+1; + } + // preprocessor defines for the header - fprintf(header_file, "#include \"sizes.h\"\n"); + fprintf(header_file, "#include \"common.h\"\n"); fprintf(header_file, "#define RTXSIZ 277\n"); fprintf(header_file, "#define CLSMAX 12\n"); fprintf(header_file, "#define LINSIZ %d\n", LINSIZ); @@ -568,6 +572,7 @@ void write_files(FILE* c_file, FILE* header_file) fprintf(header_file, "#define TRVSIZ 885\n"); fprintf(header_file, "#define TOKLEN %d\n", TOKLEN); fprintf(header_file, "#define HINTLEN %d\n", HINTLEN); + fprintf(header_file, "#define MAXDIE %d\n", MAXDIE); fprintf(header_file, "\n"); // include the header in the C file