9 _PROTOTYPE(void descitem
, (void));
10 _PROTOTYPE(void domove
, (void));
11 _PROTOTYPE(void goback
, (void));
12 _PROTOTYPE(void copytrv
, (struct trav
*, struct trav
*));
13 _PROTOTYPE(void dotrav
, (void));
14 _PROTOTYPE(void badmove
, (void));
15 _PROTOTYPE(void spcmove
, (int));
16 _PROTOTYPE(void death
, (void));
17 _PROTOTYPE(void dwarves
, (void));
18 _PROTOTYPE(void dopirate
, (void));
19 _PROTOTYPE(int stimer
, (void));
20 _PROTOTYPE(void do_hint
, (int));
24 Routine to take 1 turn
32 /* If closing, then he can't leave except via the main office. */
33 if (outside(g
.newloc
) && g
.newloc
!= 0 && g
.closing
) {
40 /* See if a dwarf has seen him and has come from where he wants
42 if (g
.newloc
!= g
.loc
&& !forced(g
.loc
) && g
.loc_attrib
[g
.loc
] & NOPIRAT
== 0)
43 for (i
= 1; i
< (DWARFMAX
- 1); ++i
)
44 if (g
.odloc
[i
] == g
.newloc
&& g
.dseen
[i
]) {
51 dwarves(); /* & special dwarf(pirate who
59 /* Check for forced move */
66 /* Check for wandering in dark */
67 if (g
.wzdark
&& dark() && pct(35)) {
73 /* see if he is wasting his batteies out in the open */
74 if (outside(g
.loc
) && g
.prop
[LAMP
]) {
83 /* If wumpus is chasing stooge, see if wumpus gets him */
86 g
.prop
[WUMPUS
] = g
.chase
/ 2;
96 /* check for radiation poisoning. */
97 g
.health
+= (outside(g
.loc
)) ? 3 : 1;
100 if (here(RADIUM
) && (g
.place
[RADIUM
] != -SHIELD
|| ajar(SHIELD
)))
103 rspeak(391 + (60 - g
.health
) / 10);
109 if ((g
.oldloc
== 188) && (g
.loc
!= 188 && g
.loc
!= 189)
110 && (g
.prop
[BOOTH
] == 1)) {
114 /* Describe his situation */
120 } /* end of newtravel start for
121 second entry point */
122 /* Check if this location is eligible for any hints. If been here
123 long enough, branch to help section. Ignore "hints" < HNTMIN
124 (special stuff, see database notes. */
125 for (hint
= HNTMIN
; hint
<= HNTMAX
; hint
++) {
128 if (g
.loc_attrib
[g
.loc
] / 256 != hint
- 6)
131 if (g
.hintlc
[hint
] >= g
.hints
[hint
][1])
136 if (g
.prop
[OYSTER
] < 0 && toting(OYSTER
))
138 for (i
= 1; i
< MAXOBJ
; ++i
)
139 if (toting(i
) && g
.prop
[i
] < 0)
140 g
.prop
[i
] = -1 - g
.prop
[i
];
143 if (g
.knfloc
> 0 && g
.knfloc
!= g
.loc
)
148 if (stimer()) /* as the grains of sand slip
152 while (!english()) /* retrieve player instructions */
156 objx
= objs
[1] ? 1 : 0;
157 iobx
= iobjs
[1] ? 1 : 0;
158 verb
= VAL(verbs
[vrbx
]);
160 object
= objx
? objs
[objx
] : 0;
161 iobj
= iobx
? iobjs
[iobx
] : 0;
162 if (object
&& (objs
[2] || iobjs
[2])) {
166 switch (CLASS(verbs
[vrbx
])) {
192 if ((!objx
|| !objs
[objx
]) && iobx
) {
194 if (iobjs
[iobx
] == 0)
196 if (iobx
&& iobjs
[1])
199 } while (objx
|| iobx
);
204 Routine to describe current location
212 else if ((g
.terse
&& verb
!= LOOK
) || g
.visited
[g
.loc
] % g
.abbnum
)
216 if (g
.loc
== 33 && pct(25) && !g
.closing
)
218 if (g
.loc
== 147 && !g
.visited
[g
.loc
])
224 Routine to describe visible items
230 for (i
= 1; i
< MAXOBJ
; ++i
) {
232 if (i
== STEPS
&& toting(NUGGET
))
239 if (i
== RUG
|| i
== CHAIN
240 || i
== SWORD
|| i
== CASK
)
242 if (i
== CLOAK
|| i
== RING
)
247 if (i
== STEPS
&& g
.loc
== g
.fixed
[STEPS
])
250 state
= g
.prop
[i
] % 8;
255 /* If remaining treasures too elusive, zap his lamp */
256 if (g
.tally
== g
.tally2
&& g
.tally
!= 0 && g
.limit
> 35)
262 Routine to handle player's demise via
263 waking up the dwarves...
283 Routine to handle the passing on of one
284 of the player's incarnations...
296 yea
= yes(81 + g
.numdie
* 2, 82 + g
.numdie
* 2, 54);
297 if (++g
.numdie
>= MAXDIE
|| !yea
)
306 for (j
= 1; j
< MAXOBJ
; ++j
) {
308 drop(j
, j
== LAMP
? 1 : g
.oldloc2
);
319 /* Closing -- no resurrection... */
331 int i
, j
, k
, attack
, stick
, dtotal
;
333 /* See if dwarves allowed here */
334 if (g
.newloc
== 0 || forced(g
.newloc
) || g
.loc_attrib
[g
.newloc
] & NOPIRAT
)
337 /* See if dwarves are active. */
339 if (inside(g
.newloc
))
343 /* If first close encounter (of 3rd kind) */
345 if (!inside(g
.newloc
) || pct(85))
349 /* kill 0, 1 or 2 of the dwarfs */
350 for (i
= 1; i
< 3; ++i
)
352 g
.dloc
[(ranz(DWARFMAX
- 1)) + 1] = 0;
354 /* If any of the survivors is at location, use alternate choise */
355 for (i
= 1; i
<= DWARFMAX
; ++i
) {
356 if (g
.dloc
[i
] == g
.newloc
)
357 g
.dloc
[i
] = g
.daltloc
;
358 g
.odloc
[i
] = g
.dloc
[i
];
364 /* Things are in full swing. Move each dwarf at random, except if
365 he's seen us then he sticks with us. Dwarfs never go to
366 locations outside or meet the bear or following him into dead
367 end in maze. And of couse, dead dwarves don't do much of
370 dtotal
= attack
= stick
= 0;
371 for (i
= 1; i
<= DWARFMAX
; ++i
) {
374 /* Move a dwarf at random. we don't have a matrix around to do
375 it as in the original version... */
379 while (j
== g
.odloc
[i
] || j
== g
.dloc
[i
]
380 || g
.loc_attrib
[j
] & NOPIRAT
);
384 g
.odloc
[i
] = g
.dloc
[i
];
387 g
.dseen
[i
] = ((g
.dseen
[i
] && inside(g
.newloc
))
388 || g
.dloc
[i
] == g
.newloc
389 || g
.odloc
[i
] == g
.newloc
);
392 g
.dloc
[i
] = g
.newloc
;
397 if (g
.odloc
[i
] == g
.dloc
[i
]) {
401 if (ranz(1000) < (45 * (g
.dflag
- 2)))
408 /* Now we know shat's happing, let's tell the poor sucker about it */
412 printf("There are %d threatening little dwarves in the room with you!\n", dtotal
);
420 printf("%d of them throw knives at you!!\n", attack
);
431 printf("%d of them get you !!!\n", stick
);
432 g
.oldloc2
= g
.newloc
;
445 if (g
.newloc
== g
.chloc
|| g
.prop
[CHEST
] >= 0)
448 /* Pirate won't take pyramid from plover room or dark room (too
450 for (j
= 1; j
< MAXOBJ
; ++j
)
451 if (treasr(j
) && !(j
== CASK
&& liq(CASK
) == WINE
)
452 && !(j
== PYRAMID
&& (g
.newloc
== g
.place
[PYRAMID
]
453 || g
.newloc
== g
.place
[EMERALD
]))) {
454 if (toting(j
) && athand(j
))
459 if (g
.tally
== g
.tally2
+ 1 && k
== FALSE
&& g
.place
[CHEST
] == 0 &&
460 athand(LAMP
) && g
.prop
[LAMP
] == 1) {
462 move(CHEST
, g
.chloc
);
463 move(MESSAGE
, g
.chloc2
);
464 g
.dloc
[DWARFMAX
] = g
.chloc
;
465 g
.odloc
[DWARFMAX
] = g
.chloc
;
466 g
.dseen
[DWARFMAX
] = 0;
469 if (g
.odloc
[DWARFMAX
] != g
.dloc
[DWARFMAX
] && pct(30))
476 /* don't steal chest back from troll! */
477 if (g
.place
[MESSAGE
] == 0)
478 move(CHEST
, g
.chloc
);
479 move(MESSAGE
, g
.chloc2
);
480 for (j
= 1; j
< MAXOBJ
; ++j
) {
481 if (!treasr(j
) || !athand(j
)
483 (g
.newloc
== plac
[PYRAMID
] || g
.newloc
== plac
[EMERALD
]))
484 || (j
== CASK
&& (liq(CASK
) != WINE
)))
494 g
.dloc
[DWARFMAX
] = g
.chloc
;
495 g
.odloc
[DWARFMAX
] = g
.chloc
;
496 g
.dseen
[DWARFMAX
] = FALSE
;
501 special time limit stuff...
508 g
.foobar
= g
.foobar
> 0 ? -g
.foobar
: 0;
509 g
.combo
= g
.combo
> 0 ? -g
.combo
: 0;
510 if (g
.turns
> 310 && g
.abbnum
!= 10000 && !g
.terse
)
513 /* Bump all the right clocks for reconning battery life and closing */
520 } else if (clock3
< -7) {
526 if (g
.tally
== 0 && inside(g
.loc
) && g
.loc
!= Y2
)
529 /* Start closing the cave */
531 biton(GRATE
, LOCKBT
);
532 bitoff(GRATE
, OPENBT
);
535 biton(TDOOR
, LOCKBT
);
536 bitoff(TDOOR
, OPENBT
);
538 biton(TDOOR2
, LOCKBT
);
539 bitoff(TDOOR2
, OPENBT
);
540 for (i
= 1; i
<= DWARFMAX
; ++i
) {
545 move((TROLL
+ MAXOBJ
), 0);
546 move(TROLL2
, plac
[TROLL
]);
547 move((TROLL2
+ MAXOBJ
), fixd
[TROLL
]);
549 if (g
.prop
[BEAR
] != 3)
563 /* Set up storage room... and close the cave... */
564 g
.prop
[BOTTLE
] = put(BOTTLE
, 115, 8);
565 g
.holder
[BOTTLE
] = WATER
;
566 g
.place
[WATER
] = -BOTTLE
;
568 bitoff(BOTTLE
, OPENBT
);
569 g
.prop
[PLANT
] = put(PLANT
, 115, 0);
570 g
.prop
[OYSTER
] = put(OYSTER
, 115, 0);
571 g
.prop
[LAMP
] = put(LAMP
, 115, 0);
572 g
.prop
[ROD
] = put(ROD
, 115, 0);
573 g
.prop
[DWARF
] = put(DWARF
, 115, 0);
577 /* Leave the grate with normal (non-negative property). */
579 biton(GRATE
, LOCKBT
);
580 bitoff(GRATE
, OPENBT
);
581 g
.prop
[SNAKE
] = put(SNAKE
, 116, 1);
582 g
.prop
[BIRD
] = put(BIRD
, 116, 1);
583 g
.prop
[CAGE
] = put(CAGE
, 116, 0);
584 g
.prop
[ROD2
] = put(ROD2
, 116, 0);
585 g
.prop
[PILLOW
] = put(PILLOW
, 116, 0);
587 g
.prop
[BOOTH
] = put(BOOTH
, 116, -3);
588 g
.fixed
[BOOTH
] = 115;
589 g
.prop
[PHONE
] = put(PHONE
, 212, -4);
591 g
.prop
[MIRROR
] = put(MIRROR
, 115, 0);
592 g
.fixed
[MIRROR
] = 116;
593 g
.prop
[BOOK2
] = put(BOOK2
, 115, 0);
595 for (i
= 1; i
< MAXOBJ
; ++i
) {
596 if (toting(i
) && enclosed(i
))
603 clock3
= 20 + ranz(20);
607 if (g
.prop
[LAMP
] == 1)
616 if (g
.limit
< 0 && outside(g
.loc
)) {
622 if (g
.lmwarn
|| !here(LAMP
))
626 if (g
.prop
[BATTERIES
] == 1)
628 if (g
.place
[BATTERIES
] == 0)
630 if (g
.prop
[VEND
] == 1)
639 come here if he's been long enough at required location(s)
640 for some unused hint, hint number is in variable "hint".
641 Branch to quick test for additional conditions, then
642 do neet stuff. If conditions are met and we want to offer
643 hint. Clear hintlc if no action is taken.
663 switch (hint
+ 1 - HNTMIN
) {
665 if (!at(g
.loc
) && !at(g
.oldloc
)
666 && !at(g
.loc
) && burden(0) > 1)
671 if (g
.prop
[EMERALD
] != -1 && g
.prop
[PYRAMID
] == -1)
678 if ((g
.prop
[SWORD
] == 1 || g
.prop
[SWORD
] == 5)
686 if (g
.prop
[GRATE
] == 0 && !athand(KEYS
))
691 if (here(BIRD
) && athand(ROD
) && object
== BIRD
)
701 if (!toting(SHOES
) || g
.visited
[205])
706 if (!athand(LYRE
) && g
.prop
[DOG
] != 1)
711 if (here(SNAKE
) && !here(BIRD
))
718 printf(" TRYING TO PRINT HINT # %d\n", hint
);
721 if (!yes(g
.hints
[hint
][3], 0, 54))
723 printf("\nI am prepared to give you a hint,");
724 printf(" but it will cost you %2d points\n", g
.hints
[hint
][2]);
725 g
.hinted
[hint
] = yes(175, g
.hints
[hint
][4], 54);
726 if (g
.hinted
[hint
] && g
.limit
> 30)
727 g
.limit
+= 30 * g
.hints
[hint
][2];