-/* Random intransitive verbs come here. Clear obj just in case (see "attack").
- */
-
-L8000: SETPRM(1,WD1,WD1X);
- RSPEAK(257);
- OBJ=0;
- goto L2600;
-
-/* Figure out the new location
- *
- * Given the current location in "LOC", and a motion verb number in
- * "K", put the new location in "game.newloc". The current loc is saved
- * in "game.olddloc" in case he wants to retreat. The current
- * game.oldloc is saved in game.oldlc2, in case he dies. (if he
- * does, game.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.) */
-
-L8: KK=KEY[LOC];
- game.newloc=LOC;
- if(KK == 0)BUG(26);
- if(K == NUL) return true;
- if(K == BACK) goto L20;
- if(K == LOOK) goto L30;
- if(K == CAVE) goto L40;
- game.oldlc2=game.oldloc;
- game.oldloc=LOC;
-
-L9: LL=labs(TRAVEL[KK]);
- if(MOD(LL,1000) == 1 || MOD(LL,1000) == K) goto L10;
- if(TRAVEL[KK] < 0) goto L50;
- KK=KK+1;
- goto L9;
-
-L10: LL=LL/1000;
-L11: game.newloc=LL/1000;
- K=MOD(game.newloc,100); /* ESR: an instance of NOBJECTS? */
- if(game.newloc <= 300) goto L13;
- if(PROP[K] != game.newloc/100-3) goto L16;
-L12: if(TRAVEL[KK] < 0)BUG(25);
- KK=KK+1;
- game.newloc=labs(TRAVEL[KK])/1000;
- if(game.newloc == LL) goto L12;
- LL=game.newloc;
- goto L11;
-
-L13: if(game.newloc <= 100) goto L14; /* ESR: an instance of NOBJECTS? */
- if(TOTING(K) || (game.newloc > 200 && AT(K))) goto L16;
- goto L12;
-
-L14: if(game.newloc != 0 && !PCT(game.newloc)) goto L12;
-L16: game.newloc=MOD(LL,1000);
- if(game.newloc <= 300) return true;
- if(game.newloc <= 500) goto L30000;
- RSPEAK(game.newloc-500);
- game.newloc=LOC;
- return true;
-
-/* Special motions come here. Labelling convention: statement numbers NNNXX
- * (XX=00-99) are used for special case number NNN (NNN=301-500). */
-
-L30000: game.newloc=game.newloc-300;
- switch (game.newloc) { case 1: goto L30100; case 2: goto L30200; case 3: goto
- L30300; }
- BUG(20);
-
-/* Travel 301. Plover-alcove passage. Can carry only emerald. Note: travel
- * table must include "useless" entries going through passage, which can never
- * be used for actual motion, but can be spotted by "go back". */
-
-L30100: game.newloc=99+100-LOC; /* ESR: an instance of NOBJECTS? */
- if(game.holdng == 0 || (game.holdng == 1 && TOTING(EMRALD))) return true;
- game.newloc=LOC;
- RSPEAK(117);
- return true;
-
-/* Travel 302. Plover transport. Drop the emerald (only use special travel if
- * toting it), so he's forced to use the plover-passage to get it out. Having
- * dropped it, go back and pretend he wasn't carrying it after all. */
-
-L30200: DROP(EMRALD,LOC);
- goto L12;
-
-/* Travel 303. Troll bridge. Must be done only as special motion so that
- * dwarves won't wander across and encounter the bear. (They won't follow the
- * player there because that region is forbidden to the pirate.) If
- * PROP(TROLL)=1, he's crossed since paying, so step out and block him.
- * (standard travel entries check for PROP(TROLL)=0.) Special stuff for bear. */
-
-L30300: if(PROP[TROLL] != 1) goto L30310;
- PSPEAK(TROLL,1);
- PROP[TROLL]=0;
- MOVE(TROLL2,0);
- MOVE(TROLL2+NOBJECTS,0);
- MOVE(TROLL,PLAC[TROLL]);
- MOVE(TROLL+NOBJECTS,FIXD[TROLL]);
- JUGGLE(CHASM);
- game.newloc=LOC;
- return true;
-
-L30310: game.newloc=PLAC[TROLL]+FIXD[TROLL]-LOC;
- if(PROP[TROLL] == 0)PROP[TROLL]=1;
- if(!TOTING(BEAR)) return true;
- RSPEAK(162);
- PROP[CHASM]=1;
- PROP[TROLL]=2;
- DROP(BEAR,game.newloc);
- FIXED[BEAR]= -1;
- PROP[BEAR]=3;
- game.oldlc2=game.newloc;
- goto L99;
-
-/* End of specials. */
-
-/* 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. */
-
-L20: K=game.oldloc;
- if(FORCED(K))K=game.oldlc2;
- game.oldlc2=game.oldloc;
- game.oldloc=LOC;
- K2=0;
- if(K == LOC)K2=91;
- if(CNDBIT(LOC,4))K2=274;
- if(K2 == 0) goto L21;
- RSPEAK(K2);
- 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;
- }
- }
-
- K=MOD(labs(TRAVEL[KK]),1000);
- KK=KEY[LOC];
- goto L9;
-
-/* Look. Can't give more detail. Pretend it wasn't dark (though it may "now"
- * be dark) so he won't fall into a pit while staring into the gloom. */
-
-L30: if(game.detail < 3)RSPEAK(15);
- game.detail=game.detail+1;
- game.wzdark=false;
- game.abbrev[LOC]=0;
- return true;
-
-/* Cave. Different messages depending on whether above ground. */
-
-L40: K=58;
- if(OUTSID(LOC) && LOC != 8)K=57;
- RSPEAK(K);
- return true;
-
-/* Non-applicable motion. Various messages depending on word given. */
-
-L50: SPK=12;
- if(K >= 43 && K <= 50)SPK=52;
- if(K == 29 || K == 30)SPK=52;
- if(K == 7 || K == 36 || K == 37)SPK=10;
- if(K == 11 || K == 19)SPK=11;
- if(VERB == FIND || VERB == INVENT)SPK=59;
- if(K == 62 || K == 65)SPK=42;
- if(K == 17)SPK=80;
- RSPEAK(SPK);
- return true;
-
-/* "You're dead, Jim."
- *
- * If the current loc is zero, it means the clown got himself killed. We'll
- * allow this maxdie times. MAXDIE is automatically set based on the number of
- * 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
- * we exit. When reincarnated, all objects being carried get dropped at game.oldlc2
- * (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
- * are done by keywords.) The lamp is a special case (it wouldn't do to leave
- * 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!).
- * game.oldloc is zapped so he can't just "retreat". */
-
-/* The easiest way to get killed is to fall into a pit in pitch darkness. */
-
-L90: RSPEAK(23);
- game.oldlc2=LOC;
-
-/* Okay, he's dead. Let's get on with it. */
-
-L99: if(game.closng) goto L95;
- game.numdie=game.numdie+1;
- if(!YES(cmdin,79+game.numdie*2,80+game.numdie*2,54)) score(0);
- if(game.numdie == MAXDIE) score(0);
- PLACE[WATER]=0;
- PLACE[OIL]=0;
- if(TOTING(LAMP))PROP[LAMP]=0;
- /* 98 */ for (J=1; J<=NOBJECTS; J++) {
- I=NOBJECTS + 1 - J;
- if(!TOTING(I)) goto L98;
- K=game.oldlc2;
- if(I == LAMP)K=1;
- DROP(I,K);
-L98: /*etc*/ ;
- } /* end loop */
- LOC=3;
- game.oldloc=LOC;
- goto L2000;
-
-/* He died during closing time. No resurrection. Tally up a death and exit. */
-
-L95: RSPEAK(131);
- game.numdie=game.numdie+1;
- score(0);
-
-
-
-
-/* Hints */
-
-/* Come here if he's been long enough at required loc(s) for some unused hint.
- * hint number is in variable "hint". Branch to quick test for additional
- * conditions, then come back to do neat stuff. Goto 40010 if conditions are
- * met and we want to offer the hint. Goto 40020 to clear HINTLC back to zero,
- * 40030 to take no action yet. */
-
-L40000: switch (HINT-1) { case 0: goto L40100; case 1: goto L40200; case 2: goto
- L40300; case 3: goto L40400; case 4: goto L40500; case 5: goto
- L40600; case 6: goto L40700; case 7: goto L40800; case 8: goto
- L40900; case 9: goto L41000; }
-/* CAVE BIRD SNAKE MAZE DARK WITT URN WOODS OGRE
- * JADE */
- BUG(27);
-
-L40010: HINTLC[HINT]=0;
- if(!YES(cmdin,HINTS[HINT][3],0,54)) goto L2602;
- SETPRM(1,HINTS[HINT][2],HINTS[HINT][2]);
- RSPEAK(261);
- HINTED[HINT]=YES(cmdin,175,HINTS[HINT][4],54);
- if(HINTED[HINT] && game.limit > 30)game.limit=game.limit+30*HINTS[HINT][2];
-L40020: HINTLC[HINT]=0;
-L40030: goto L2602;
-
-/* Now for the quick tests. See database description for one-line notes. */
-
-L40100: if(PROP[GRATE] == 0 && !HERE(KEYS)) goto L40010;
- goto L40020;
-
-L40200: if(PLACE[BIRD] == LOC && TOTING(ROD) && game.oldobj == BIRD) goto L40010;
- goto L40030;
-
-L40300: if(HERE(SNAKE) && !HERE(BIRD)) goto L40010;
- goto L40020;
-
-L40400: if(ATLOC[LOC] == 0 && ATLOC[game.oldloc] == 0 && ATLOC[game.oldlc2] == 0 && game.holdng >
- 1) goto L40010;
- goto L40020;
-
-L40500: if(PROP[EMRALD] != -1 && PROP[PYRAM] == -1) goto L40010;
- goto L40020;
-
-L40600: goto L40010;
-
-L40700: if(game.dflag == 0) goto L40010;
- goto L40020;
-
-L40800: if(ATLOC[LOC] == 0 && ATLOC[game.oldloc] == 0 && ATLOC[game.oldlc2] == 0) goto
- L40010;
- goto L40030;
-
-L40900: I=ATDWRF(LOC);
- if(I < 0) goto L40020;
- if(HERE(OGRE) && I == 0) goto L40010;
- goto L40030;
-
-L41000: if(game.tally == 1 && PROP[JADE] < 0) goto L40010;
- goto L40020;
-
-
-
-
-
-/* Cave closing and scoring */
-
-
-/* These sections handle the closing of the cave. The cave closes "clock1"
- * turns after the last treasure has been located (including the pirate's
- * chest, which may of course never show up). Note that the treasures need not
- * have been taken yet, just located. Hence clock1 must be large enough to get
- * out of the cave (it only ticks while inside the cave). When it hits zero,
- * we branch to 10000 to start closing the cave, and then sit back and wait for
- * him to try to get out. If he doesn't within clock2 turns, we close the
- * cave; if he does try, we assume he panics, and give him a few additional
- * turns to get frantic before we close. When clock2 hits zero, we branch to
- * 11000 to transport him into the final puzzle. Note that the puzzle depends
- * upon all sorts of random things. For instance, there must be no water or
- * oil, since there are beanstalks which we don't want to be able to water,
- * since the code can't handle it. Also, we can have no keys, since there is a
- * grate (having moved the fixed object!) there separating him from all the
- * treasures. Most of these problems arise from the use of negative prop
- * numbers to suppress the object descriptions until he's actually moved the
- * objects. */
-
-/* When the first warning comes, we lock the grate, destroy the bridge, kill
- * all the dwarves (and the pirate), remove the troll and bear (unless dead),
- * and set "closng" to true. Leave the dragon; too much trouble to move it.
- * from now until clock2 runs out, he cannot unlock the grate, move to any
- * location outside the cave, or create the bridge. Nor can he be
- * resurrected if he dies. Note that the snake is already gone, since he got
- * to the treasure accessible only via the hall of the mountain king. Also, he's
- * been in giant room (to get eggs), so we can refer to it. Also also, he's
- * gotten the pearl, so we know the bivalve is an oyster. *And*, the dwarves
- * must have been activated, since we've found chest. */
-
-L10000: PROP[GRATE]=0;
- PROP[FISSUR]=0;
- for (I=1; I<=NDWARVES; I++) {
- game.dseen[I]=false;
- game.dloc[I]=0;
- } /* end loop */
- MOVE(TROLL,0);
- MOVE(TROLL+NOBJECTS,0);
- MOVE(TROLL2,PLAC[TROLL]);
- MOVE(TROLL2+NOBJECTS,FIXD[TROLL]);
- JUGGLE(CHASM);
- if(PROP[BEAR] != 3)DSTROY(BEAR);
- PROP[CHAIN]=0;
- FIXED[CHAIN]=0;
- PROP[AXE]=0;
- FIXED[AXE]=0;
- RSPEAK(129);
- game.clock1= -1;
- game.closng=true;
- goto L19999;
-
-/* Once he's panicked, and clock2 has run out, we come here to set up the
- * storage room. The room has two locs, hardwired as 115 (ne) and 116 (sw).
- * At the ne end, we place empty bottles, a nursery of plants, a bed of
- * oysters, a pile of lamps, rods with stars, sleeping dwarves, and him. At
- * the sw end we place grate over treasures, snake pit, covey of caged birds,
- * more rods, and pillows. A mirror stretches across one wall. Many of the
- * objects come from known locations and/or states (e.g. the snake is known to
- * have been destroyed and needn't be carried away from its old "place"),
- * making the various objects be handled differently. We also drop all other
- * objects he might be carrying (lest he have some which could cause trouble,
- * such as the keys). We describe the flash of light and trundle back. */
-
-L11000: PROP[BOTTLE]=PUT(BOTTLE,115,1);
- PROP[PLANT]=PUT(PLANT,115,0);
- PROP[OYSTER]=PUT(OYSTER,115,0);
- OBJTXT[OYSTER]=3;
- PROP[LAMP]=PUT(LAMP,115,0);
- PROP[ROD]=PUT(ROD,115,0);
- PROP[DWARF]=PUT(DWARF,115,0);
- LOC=115;
- game.oldloc=115;
- game.newloc=115;
-
-/* Leave the grate with normal (non-negative) property. Reuse sign. */
-
- I=PUT(GRATE,116,0);
- I=PUT(SIGN,116,0);
- OBJTXT[SIGN]=OBJTXT[SIGN]+1;
- PROP[SNAKE]=PUT(SNAKE,116,1);
- PROP[BIRD]=PUT(BIRD,116,1);
- PROP[CAGE]=PUT(CAGE,116,0);
- PROP[ROD2]=PUT(ROD2,116,0);
- PROP[PILLOW]=PUT(PILLOW,116,0);
-
- PROP[MIRROR]=PUT(MIRROR,115,0);
- FIXED[MIRROR]=116;
-
- for (I=1; I<=NOBJECTS; I++) {
- if(TOTING(I))
- DSTROY(I);
- } /* end loop */
-
- RSPEAK(132);
- game.closed=true;
- return true;
-
-/* Another way we can force an end to things is by having the lamp give out.
- * When it gets close, we come here to warn him. We go to 12000 if the lamp
- * and fresh batteries are here, in which case we replace the batteries and
- * continue. 12200 is for other cases of lamp dying. 12400 is when it goes
- * out. Even then, he can explore outside for a while if desired. */
-
-L12000: RSPEAK(188);
- PROP[BATTER]=1;
- if(TOTING(BATTER))DROP(BATTER,LOC);
- game.limit=game.limit+2500;
- game.lmwarn=false;
- goto L19999;
-
-L12200: if(game.lmwarn || !HERE(LAMP)) goto L19999;
- game.lmwarn=true;
- SPK=187;
- if(PLACE[BATTER] == 0)SPK=183;
- if(PROP[BATTER] == 1)SPK=189;
- RSPEAK(SPK);
- goto L19999;
-
-L12400: game.limit= -1;
- PROP[LAMP]=0;
- if(HERE(LAMP))RSPEAK(184);
- goto L19999;
-
-/* Oh dear, he's disturbed the dwarves. */
-
-L18999: RSPEAK(SPK);
-L19000: RSPEAK(136);
- score(0);
- return true;