long ABB[186], ATLOC[186], BLKLIN = true, DFLAG,
long ABB[186], ATLOC[186], BLKLIN = true, DFLAG,
- DLOC[7], FIXED[101], HOLDNG,
- LINK[201], LNLENG, LNPOSN,
- PARMS[26], PLACE[101],
+ FIXED[NOBJECTS+1], HOLDNG,
+ LINK[NOBJECTS*2 + 1], LNLENG, LNPOSN,
+ PARMS[26], PLACE[NOBJECTS+1],
-signed char rawbuf[LINESIZE], INLINE[LINESIZE+1], MAP1[129], MAP2[129];
+char rawbuf[LINESIZE], INLINE[LINESIZE+1], MAP1[129], MAP2[129];
long ABBNUM, AMBER, ATTACK, AXE, BACK, BATTER, BEAR, BIRD, BLOOD, BONUS,
BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST, CHLOC, CHLOC2,
CLAM, CLOCK1, CLOCK2, CLOSED, CLOSNG, CLSHNT,
COINS, CONDS, DALTLC, DETAIL,
long ABBNUM, AMBER, ATTACK, AXE, BACK, BATTER, BEAR, BIRD, BLOOD, BONUS,
BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST, CHLOC, CHLOC2,
CLAM, CLOCK1, CLOCK2, CLOSED, CLOSNG, CLSHNT,
COINS, CONDS, DALTLC, DETAIL,
- DKILL, DOOR, DPRSSN, DRAGON, DSEEN[7], DTOTAL, DWARF, EGGS,
+ DKILL, DOOR, DPRSSN, DRAGON, DTOTAL, DWARF, EGGS,
EMRALD, ENTER, ENTRNC, FIND, FISSUR, FOOBAR, FOOD,
GRATE, HINT, HINTED[21], HINTLC[21],
I, INVENT, IGO, IWEST, J, JADE, K, K2, KEYS, KK,
KNFLOC, KNIFE, KQ, L, LAMP, LIMIT, LL,
LMWARN, LOC, LOCK, LOOK,
EMRALD, ENTER, ENTRNC, FIND, FISSUR, FOOBAR, FOOD,
GRATE, HINT, HINTED[21], HINTLC[21],
I, INVENT, IGO, IWEST, J, JADE, K, K2, KEYS, KK,
KNFLOC, KNIFE, KQ, L, LAMP, LIMIT, LL,
LMWARN, LOC, LOCK, LOOK,
- MAGZIN, MAXDIE, MAXTRS, MESH = 123456789,
+ MAGZIN, MAXDIE, MAXTRS,
MESSAG, MIRROR, MXSCOR,
NEWLOC, NOVICE, NUGGET, NUL, NUMDIE, OBJ,
MESSAG, MIRROR, MXSCOR,
NEWLOC, NOVICE, NUGGET, NUL, NUMDIE, OBJ,
- ODLOC[7], OGRE, OIL, OLDLC2, OLDLOC, OLDOBJ, OYSTER,
- PANIC, PEARL, PILLOW, PLANT, PLANT2, PROP[101], PYRAM,
+ OGRE, OIL, OLDOBJ, OYSTER,
+ PANIC, PEARL, PILLOW, PLANT, PLANT2, PROP[NOBJECTS+1], PYRAM,
RESER, ROD, ROD2, RUBY, RUG, SAPPH, SAVED, SAY,
SCORE, SECT, SIGN, SNAKE, SPK, STEPS, STICK,
STREAM, TALLY, THRESH, THROW, TK[21], TRIDNT,
TRNDEX, TRNLUZ, TROLL, TROLL2,
RESER, ROD, ROD2, RUBY, RUG, SAPPH, SAVED, SAY,
SCORE, SECT, SIGN, SNAKE, SPK, STEPS, STICK,
STREAM, TALLY, THRESH, THROW, TK[21], TRIDNT,
TRNDEX, TRNLUZ, TROLL, TROLL2,
- TURNS, URN, V1, V2, VASE, VEND, VERB,
+ TURNS, URN, V1, V2, VASE, VEND, VERB,
VOLCAN, VRSION = 25, WATER, WD1, WD1X, WD2, WD2X,
VOLCAN, VRSION = 25, WATER, WD1, WD1X, WD2, WD2X,
NOVICE=YES(stdin, 65,1,0);
NEWLOC=1;
LOC=1;
NOVICE=YES(stdin, 65,1,0);
NEWLOC=1;
LOC=1;
/* fallback handler for commands not handled by FORTRANish parser */
{
long sv;
if (sscanf(buf, "seed %ld", &sv) == 1) {
set_seed(sv);
printf("Seed set to %ld\n", sv);
/* fallback handler for commands not handled by FORTRANish parser */
{
long sv;
if (sscanf(buf, "seed %ld", &sv) == 1) {
set_seed(sv);
printf("Seed set to %ld\n", sv);
* (dwarves rooted in place) let him get out (and attacked). */
L71: if(NEWLOC == LOC || FORCED(LOC) || CNDBIT(LOC,3)) goto L74;
* (dwarves rooted in place) let him get out (and attacked). */
L71: if(NEWLOC == LOC || FORCED(LOC) || CNDBIT(LOC,3)) goto L74;
- if(NEWLOC > 300 || !INDEEP(NEWLOC) || NEWLOC == ODLOC[I] || (J > 1 &&
- NEWLOC == TK[x]) || J >= 20 || NEWLOC == DLOC[I] ||
+ if(NEWLOC > 300 || !INDEEP(NEWLOC) || NEWLOC == game.odloc[I] || (J > 1 &&
+ NEWLOC == TK[x]) || J >= 20 || NEWLOC == game.dloc[I] ||
- ODLOC[I]=DLOC[I];
- DLOC[I]=TK[J];
- DSEEN[I]=(DSEEN[I] && INDEEP(LOC)) || (DLOC[I] == LOC || ODLOC[I] == LOC);
- if(!DSEEN[I]) goto L6030;
- DLOC[I]=LOC;
+ game.odloc[I]=game.dloc[I];
+ game.dloc[I]=TK[J];
+ game.dseen[I]=(game.dseen[I] && INDEEP(LOC)) || (game.dloc[I] == LOC || game.odloc[I] == LOC);
+ if(!game.dseen[I]) goto L6030;
+ game.dloc[I]=LOC;
-/* Kick the random number generator just to add variety to the chase. Also,
- * if closing time, check for any objects being toted with PROP < 0 and set
+/* If closing time, check for any objects being toted with PROP < 0 and set
* the prop to -1-PROP. This way objects won't be described until they've
* been picked up and put down separate from their respective piles. Don't
* tick CLOCK1 unless well into cave (and not at Y2). */
L2603: if(!CLOSED) goto L2605;
if(PROP[OYSTER] < 0 && TOTING(OYSTER))PSPEAK(OYSTER,1);
* the prop to -1-PROP. This way objects won't be described until they've
* been picked up and put down separate from their respective piles. Don't
* tick CLOCK1 unless well into cave (and not at Y2). */
L2603: if(!CLOSED) goto L2605;
if(PROP[OYSTER] < 0 && TOTING(OYSTER))PSPEAK(OYSTER,1);
- if(TRNDEX <= TRNVLS)THRESH=MOD(TRNVAL[TRNDEX],100000)+1;
-L2608: if(VERB == SAY && WD2 > 0)VERB=0;
+ if(TRNDEX <= TRNVLS)
+ THRESH=MOD(TRNVAL[TRNDEX],100000)+1;
+ }
+ if(VERB == SAY && WD2 > 0)VERB=0;
if(VERB == SAY) goto L4090;
if(TALLY == 0 && INDEEP(LOC) && LOC != 33)CLOCK1=CLOCK1-1;
if(CLOCK1 == 0) goto L10000;
if(VERB == SAY) goto L4090;
if(TALLY == 0 && INDEEP(LOC) && LOC != 33)CLOCK1=CLOCK1-1;
if(CLOCK1 == 0) goto L10000;
if((V1 != 1000+WATER && V1 != 1000+OIL) || (V2 != 1000+PLANT && V2 !=
1000+DOOR)) goto L2610;
{long x = V2-1000; if(AT(x))WD2=MAKEWD(16152118);}
if((V1 != 1000+WATER && V1 != 1000+OIL) || (V2 != 1000+PLANT && V2 !=
1000+DOOR)) goto L2610;
{long x = V2-1000; if(AT(x))WD2=MAKEWD(16152118);}
-L2610: if(V1 == 1000+CAGE && V2 == 1000+BIRD && HERE(CAGE) &&
- HERE(BIRD))WD1=MAKEWD(301200308);
-L2620: if(WD1 != MAKEWD(23051920)) goto L2625;
- IWEST=IWEST+1;
- if(IWEST == 10)RSPEAK(17);
-L2625: if(WD1 != MAKEWD( 715) || WD2 == 0) goto L2630;
+L2610: if(V1 == 1000+CAGE && V2 == 1000+BIRD && HERE(CAGE) && HERE(BIRD))
+ WD1=MAKEWD(301200308);
+L2620: if(WD1 == MAKEWD(23051920)) {
+ IWEST=IWEST+1;
+ if(IWEST == 10)RSPEAK(17);
+ }
+ if(WD1 != MAKEWD( 715) || WD2 == 0) goto L2630;
/* Figure out the new location
*
* Given the current location in "LOC", and a motion verb number in "K", put
/* Figure out the new location
*
* Given the current location in "LOC", and a motion verb number in "K", put
- * the new location in "NEWLOC". The current loc is saved in "OLDLOC" in case
- * he wants to retreat. The current OLDLOC is saved in OLDLC2, in case he
- * dies. (if he does, NEWLOC will be limbo, and OLDLOC will be what killed
- * him, so we need OLDLC2, which is the last place he was safe.) */
+ * the new location in "NEWLOC". The current loc is saved in "OLgame.dloc" in case
+ * he wants to retreat. The current OLgame.dloc is saved in game.oldlc2, in case he
+ * dies. (if he does, NEWLOC will be limbo, and OLgame.dloc will be what killed
+ * him, so we need game.oldlc2, which is the last place he was safe.) */
if(MOD(LL,1000) == 1 || MOD(LL,1000) == K) goto L10;
if(TRAVEL[KK] < 0) goto L50;
KK=KK+1;
if(MOD(LL,1000) == 1 || MOD(LL,1000) == K) goto L10;
if(TRAVEL[KK] < 0) goto L50;
KK=KK+1;
if(NEWLOC <= 300) goto L13;
if(PROP[K] != NEWLOC/100-3) goto L16;
L12: if(TRAVEL[KK] < 0)BUG(25);
KK=KK+1;
if(NEWLOC <= 300) goto L13;
if(PROP[K] != NEWLOC/100-3) goto L16;
L12: if(TRAVEL[KK] < 0)BUG(25);
KK=KK+1;
* table must include "useless" entries going through passage, which can never
* be used for actual motion, but can be spotted by "go back". */
* table must include "useless" entries going through passage, which can never
* be used for actual motion, but can be spotted by "go back". */
-/* Handle "go back". Look for verb which goes from LOC to OLDLOC, or to OLDLC2
- * If OLDLOC has forced-motion. K2 saves entry -> forced loc -> previous loc. */
+/* Handle "go back". Look for verb which goes from LOC to game.oldloc, or to game.oldlc2
+ * If game.oldloc has forced-motion. K2 saves entry -> forced loc -> previous loc. */
-L21: LL=MOD((IABS(TRAVEL[KK])/1000),1000);
- if(LL == K) goto L25;
- if(LL > 300) goto L22;
- J=KEY[LL];
- if(FORCED(LL) && MOD((IABS(TRAVEL[J])/1000),1000) == K)K2=KK;
-L22: if(TRAVEL[KK] < 0) goto L23;
- KK=KK+1;
- goto L21;
-
-L23: KK=K2;
- if(KK != 0) goto L25;
- RSPEAK(140);
- return true;
+L21: LL=MOD((labs(TRAVEL[KK])/1000),1000);
+ if(LL != K) {
+ if(LL <= 300) {
+ J=KEY[LL];
+ if(FORCED(LL) && MOD((labs(TRAVEL[J])/1000),1000) == K)
+ K2=KK;
+ }
+ if(TRAVEL[KK] < 0) goto L23;
+ KK=KK+1;
+ goto L21;
+
+L23: KK=K2;
+ if(KK == 0) {
+ RSPEAK(140);
+ return true;
+ }
+ }
* snide messages available. Each death results in a message (81, 83, etc.)
* which offers reincarnation; if accepted, this results in message 82, 84,
* etc. The last time, if he wants another chance, he gets a snide remark as
* snide messages available. Each death results in a message (81, 83, etc.)
* which offers reincarnation; if accepted, this results in message 82, 84,
* etc. The last time, if he wants another chance, he gets a snide remark as
* (presumably the last place prior to being killed) without change of props.
* the loop runs backwards to assure that the bird is dropped before the cage.
* (this kluge could be changed once we're sure all references to bird and cage
* (presumably the last place prior to being killed) without change of props.
* the loop runs backwards to assure that the bird is dropped before the cage.
* (this kluge could be changed once we're sure all references to bird and cage
* it in the cave). It is turned off and left outside the building (only if he
* was carrying it, of course). He himself is left inside the building (and
* heaven help him if he tries to xyzzy back into the cave without the lamp!).
* it in the cave). It is turned off and left outside the building (only if he
* was carrying it, of course). He himself is left inside the building (and
* heaven help him if he tries to xyzzy back into the cave without the lamp!).
PROP[ROD]=PUT(ROD,115,0);
PROP[DWARF]=PUT(DWARF,115,0);
LOC=115;
PROP[ROD]=PUT(ROD,115,0);
PROP[DWARF]=PUT(DWARF,115,0);
LOC=115;