-static bool do_command(FILE *cmdin) {
- long LL, KQ, VERB, KK, K2, V1, V2;
- long obj, i;
- static long IGO = 0;
-
- /* Can't leave cave once it's closing (except by main office). */
- if(OUTSID(game.newloc) && game.newloc != 0 && game.closng) {
- RSPEAK(130);
- game.newloc=game.loc;
- if(!game.panic)game.clock2=15;
- game.panic=true;
- }
-
- /* See if a dwarf has seen him and has come from where he
- * wants to go. If so, the dwarf's blocking his way. If
- * coming from place forbidden to pirate (dwarves rooted in
- * place) let him get out (and attacked). */
- if(game.newloc != game.loc && !FORCED(game.loc) && !CNDBIT(game.loc,3)) {
- for (i=1; i<=NDWARVES-1; i++) {
- if(game.odloc[i] == game.newloc && game.dseen[i]) {
- game.newloc=game.loc;
- RSPEAK(2);
- break;
- }
- }
- }
- game.loc=game.newloc;
-
- if (!dwarfmove())
- goto L99;
-
-/* Describe the current location and (maybe) get next command. */
-
-/* Print text for current loc. */
-
-L2000: if(game.loc == 0) goto L99;
- KK=STEXT[game.loc];
- if(MOD(game.abbrev[game.loc],game.abbnum) == 0 || KK == 0)KK=LTEXT[game.loc];
- if(FORCED(game.loc) || !DARK(0)) goto L2001;
- if(game.wzdark && PCT(35)) goto L90;
- KK=RTEXT[16];
-L2001: if(TOTING(BEAR))RSPEAK(141);
- SPEAK(KK);
- K=1;
- if(FORCED(game.loc)) goto L8;
- if(game.loc == 33 && PCT(25) && !game.closng)RSPEAK(7);
-
-/* Print out descriptions of objects at this location. If not closing and
- * property value is negative, tally off another treasure. Rug is special
- * case; once seen, its game.prop is 1 (dragon on it) till dragon is killed.
- * Similarly for chain; game.prop is initially 1 (locked to bear). These hacks
- * are because game.prop=0 is needed to get full score. */
-
- if(DARK(0)) goto L2012;
- game.abbrev[game.loc]=game.abbrev[game.loc]+1;
- I=game.atloc[game.loc];
-L2004: if(I == 0) goto L2012;
- obj=I;
- if(obj > NOBJECTS)obj=obj-NOBJECTS;
- if(obj == STEPS && TOTING(NUGGET)) goto L2008;
- if(game.prop[obj] >= 0) goto L2006;
- if(game.closed) goto L2008;
- game.prop[obj]=0;
- if(obj == RUG || obj == CHAIN)game.prop[obj]=1;
- game.tally=game.tally-1;
-/* Note: There used to be a test here to see whether the player had blown it
- * so badly that he could never ever see the remaining treasures, and if so
- * the lamp was zapped to 35 turns. But the tests were too simple-minded;
- * things like killing the bird before the snake was gone (can never see
- * jewelry), and doing it "right" was hopeless. E.G., could cross troll
- * bridge several times, using up all available treasures, breaking vase,
- * using coins to buy batteries, etc., and eventually never be able to get
- * across again. If bottle were left on far side, could then never get eggs
- * or trident, and the effects propagate. So the whole thing was flushed.
- * anyone who makes such a gross blunder isn't likely to find everything
- * else anyway (so goes the rationalisation). */
-L2006: KK=game.prop[obj];
- if(obj == STEPS && game.loc == game.fixed[STEPS])KK=1;
- PSPEAK(obj,KK);
-L2008: I=game.link[I];
- goto L2004;
-
-L2009: K=54;
-L2010: SPK=K;
-L2011: RSPEAK(SPK);
-
-L2012: VERB=0;
- game.oldobj=obj;
- obj=0;
-
-/* Check if this loc is eligible for any hints. If been here long enough,
- * branch to help section (on later page). Hints all come back here eventually
- * to finish the loop. Ignore "HINTS" < 4 (special stuff, see database notes).
- */
-L2600: if(COND[game.loc] < game.conds) goto L2603;
- /* 2602 */ for (HINT=1; HINT<=HNTMAX; HINT++) {
- if(game.hinted[HINT]) goto L2602;
- if(!CNDBIT(game.loc,HINT+10))game.hintlc[HINT]= -1;
- game.hintlc[HINT]=game.hintlc[HINT]+1;
- if(game.hintlc[HINT] >= HINTS[HINT][1]) goto L40000;
-L2602: /*etc*/ ;
- } /* end loop */
-
- /* If closing time, check for any objects being toted with
- * game.prop < 0 and set the prop to -1-game.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 game.clock1 unless well into cave (and not at Y2). */
-L2603: if(game.closed) {
- if(game.prop[OYSTER] < 0 && TOTING(OYSTER))
- PSPEAK(OYSTER,1);
- for (i=1; i<=NOBJECTS; i++) {
- if(TOTING(i) && game.prop[i] < 0)
- game.prop[i] = -1-game.prop[i];
+/* "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". */
+
+static void croak(FILE *cmdin)
+/* Okay, he's dead. Let's get on with it. */
+{
+ ++game.numdie;
+ if (game.closng) {
+ /* He died during closing time. No resurrection. Tally up a
+ * death and exit. */
+ RSPEAK(DEATH_CLOSING);
+ score(0);
+ } else {
+ /* FIXME: Arithmetic on message numbers */
+ if (!YES(cmdin,WATCH_IT+game.numdie*2,WHICH_WAY+game.numdie*2,OK_MAN))
+ score(0);
+ if (game.numdie == MAXDIE)
+ score(0);
+ game.place[WATER]=0;
+ game.place[OIL]=0;
+ if (TOTING(LAMP))
+ game.prop[LAMP]=0;
+ for (int j=1; j<=NOBJECTS; j++) {
+ int i=NOBJECTS + 1 - j;
+ if (TOTING(i)) {
+ /* Always leave lamp where it's accessible aboveground */
+ DROP(i, (i == LAMP) ? 1 : game.oldlc2);