From ed80d6dd2f9aa01fd21efd512c431e6ca5d0df0e Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 7 Jun 2017 15:33:22 -0400 Subject: [PATCH] Move MAXDIE computation to dungeonmaker. --- advent.h | 2 +- adventure.text | 2 ++ dungeon.c | 9 +++++++++ init.c | 5 ----- main.c | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/advent.h b/advent.h index 328847d..36cf345 100644 --- a/advent.h +++ b/advent.h @@ -145,5 +145,5 @@ extern long AMBER, ATTACK, AXE, BACK, BATTER, BEAR, STEPS, STICK, STREAM, THROW, TRIDNT, TROLL, TROLL2, URN, VASE, VEND, VOLCAN, WATER; /* evrything else */ -extern long I, J, K, L, MAXDIE, SPK, V1, V2, VRSION, WD1, WD1X, WD2, WD2X; +extern long I, J, K, L, SPK, V1, V2, VRSION, WD1, WD1X, WD2, WD2X; diff --git a/adventure.text b/adventure.text index 936a1b0..10fd20d 100644 --- a/adventure.text +++ b/adventure.text @@ -1764,6 +1764,7 @@ 78 You can't pour that. 79 Watch it! 80 Which way? +# Sequence of the death & reincarnation messages must not be altered 81 Oh dear, you seem to have gotten yourself killed. I might be able to 81 help you out, but I've never really done this before. Do you want me 81 to try to reincarnate you? @@ -1779,6 +1780,7 @@ 85 me to do a decent reincarnation without any orange smoke, do you? 86 Okay, if you're so smart, do it yourself! I'm leaving! 90 >>> messages 81 thru 90 are reserved for "obituaries". <<< +# Death & reincarnation messages end here 91 Sorry, but I no longer seem to remember how it was you got here. 92 You can't carry anything more. You'll have to drop something first. 93 You can't go through a locked steel grate! diff --git a/dungeon.c b/dungeon.c index 62c0772..73f1476 100644 --- a/dungeon.c +++ b/dungeon.c @@ -33,6 +33,7 @@ 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; @@ -556,6 +557,13 @@ 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, "#define RTXSIZ 277\n"); @@ -568,6 +576,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 diff --git a/init.c b/init.c index 5d44be5..a0d8f1c 100644 --- a/init.c +++ b/init.c @@ -369,11 +369,6 @@ void initialise(void) game.knfloc=0; game.detail=0; game.abbnum=5; - for (i=0; i<=4; i++) { - long x = 2*i+81; - if(RTEXT[x] != 0) - MAXDIE=i+1; - } game.numdie=0; game.holdng=0; game.dkill=0; diff --git a/main.c b/main.c index 3f6db0d..28f1712 100644 --- a/main.c +++ b/main.c @@ -22,7 +22,7 @@ long AMBER, ATTACK, AXE, BACK, BATTER, BEAR, BIRD, BLOOD, CLAM, COINS, DOOR, DPRSSN, DRAGON, DWARF, EGGS, EMRALD, ENTER, ENTRNC, FIND, FISSUR, FOOD, GRATE, HINT, I, INVENT, J, JADE, K, KEYS, - KNIFE, L, LAMP, LOCK, LOOK, MAGZIN, MAXDIE, + KNIFE, L, LAMP, LOCK, LOOK, MAGZIN, MESSAG, MIRROR, NUGGET, NUL, OGRE, OIL, OYSTER, PEARL, PILLOW, PLANT, PLANT2, PYRAM, RESER, ROD, ROD2, RUBY, RUG, SAPPH, SAY, SECT, SIGN, SNAKE, SPK, -- 2.31.1