- switch (hint-1)
- {
- case 0:
- /* cave */
- if (game.prop[GRATE] == 0 && !HERE(KEYS))
- break;
- game.hintlc[hint]=0;
- return;
- case 1: /* bird */
- if (game.place[BIRD] == game.loc && TOTING(ROD) && game.oldobj == BIRD)
- break;
- return;
- case 2: /* snake */
- if (HERE(SNAKE) && !HERE(BIRD))
- break;
- game.hintlc[hint]=0;
- return;
- case 3: /* maze */
- if (game.atloc[game.loc] == 0 &&
- game.atloc[game.oldloc] == 0 &&
- game.atloc[game.oldlc2] == 0 &&
- game.holdng > 1)
- break;
- game.hintlc[hint]=0;
- return;
- case 4: /* dark */
- if (game.prop[EMRALD] != -1 && game.prop[PYRAM] == -1)
- break;
- game.hintlc[hint]=0;
- return;
- case 5: /* witt */
- break;
- case 6: /* urn */
- if (game.dflag == 0)
- break;
- game.hintlc[hint]=0;
- return;
- case 7: /* woods */
- if (game.atloc[game.loc] == 0 &&
- game.atloc[game.oldloc] == 0 &&
- game.atloc[game.oldlc2] == 0)
- break;
- return;
- case 8: /* ogre */
- i=ATDWRF(game.loc);
- if (i < 0) {
- game.hintlc[hint]=0;
- return;
- }
- if (HERE(OGRE) && i == 0)
- break;
- return;
- case 9: /* jade */
- if (game.tally == 1 && game.prop[JADE] < 0)
- break;
- game.hintlc[hint]=0;
- return;
- default:
- BUG(27);
- break;
- }
-
- /* Fall through to hint display */
- game.hintlc[hint]=0;
- if (!YES(cmdin,HINTS[hint][3],0,54))
- return;
- SETPRM(1,HINTS[hint][2],HINTS[hint][2]);
- RSPEAK(261);
- game.hinted[hint]=YES(cmdin,175,HINTS[hint][4],54);
- if (game.hinted[hint] && game.limit > 30)
- game.limit=game.limit+30*HINTS[hint][2];
- }
- }
+ switch (hint - 1) {
+ case 0:
+ /* cave */
+ if (game.prop[GRATE] == 0 && !HERE(KEYS))
+ break;
+ game.hintlc[hint] = 0;
+ return;
+ case 1: /* bird */
+ if (game.place[BIRD] == game.loc && TOTING(ROD) && game.oldobj == BIRD)
+ break;
+ return;
+ case 2: /* snake */
+ if (HERE(SNAKE) && !HERE(BIRD))
+ break;
+ game.hintlc[hint] = 0;
+ return;
+ case 3: /* maze */
+ if (game.atloc[game.loc] == 0 &&
+ game.atloc[game.oldloc] == 0 &&
+ game.atloc[game.oldlc2] == 0 &&
+ game.holdng > 1)
+ break;
+ game.hintlc[hint] = 0;
+ return;
+ case 4: /* dark */
+ if (game.prop[EMERALD] != -1 && game.prop[PYRAMID] == -1)
+ break;
+ game.hintlc[hint] = 0;
+ return;
+ case 5: /* witt */
+ break;
+ case 6: /* urn */
+ if (game.dflag == 0)
+ break;
+ game.hintlc[hint] = 0;
+ return;
+ case 7: /* woods */
+ if (game.atloc[game.loc] == 0 &&
+ game.atloc[game.oldloc] == 0 &&
+ game.atloc[game.oldlc2] == 0)
+ break;
+ return;
+ case 8: /* ogre */
+ i = ATDWRF(game.loc);
+ if (i < 0) {
+ game.hintlc[hint] = 0;
+ return;
+ }
+ if (HERE(OGRE) && i == 0)
+ break;
+ return;
+ case 9: /* jade */
+ if (game.tally == 1 && game.prop[JADE] < 0)
+ break;
+ game.hintlc[hint] = 0;
+ return;
+ default:
+ BUG(HINT_NUMBER_EXCEEDS_GOTO_LIST);
+ break;
+ }
+
+ /* Fall through to hint display */
+ game.hintlc[hint] = 0;
+ if (!YES(arbitrary_messages[HINTS[hint][3]], arbitrary_messages[NO_MESSAGE], arbitrary_messages[OK_MAN]))
+ return;
+ SETPRM(1, HINTS[hint][2], HINTS[hint][2]);
+ RSPEAK(HINT_COST);
+ game.hinted[hint] = YES(arbitrary_messages[WANT_HINT], arbitrary_messages[HINTS[hint][4]], arbitrary_messages[OK_MAN]);
+ if (game.hinted[hint] && game.limit > WARNTIME)
+ game.limit += WARNTIME * HINTS[hint][2];
+ }
+ }
+ }
+}
+
+static bool spotted_by_pirate(int i)
+{
+ if (i != PIRATE)
+ return false;
+
+ /* The pirate's spotted him. He leaves him alone once we've
+ * found chest. K counts if a treasure is here. If not, and
+ * tally=1 for an unseen chest, let the pirate be spotted. Note
+ * that game.place[CHEST] = LOC_NOWHERE might mean that he's thrown
+ * it to the troll, but in that case he's seen the chest
+ * (game.prop=0). */
+ if (game.loc == game.chloc || game.prop[CHEST] >= 0)
+ return true;
+ int snarfed = 0;
+ bool movechest = false, robplayer = false;
+ for (int treasure = MINTRS; treasure <= MAXTRS; treasure++) {
+ /* Pirate won't take pyramid from plover room or dark
+ * room (too easy!). */
+ if (treasure == PYRAMID && (game.loc == PLAC[PYRAMID] || game.loc == PLAC[EMERALD])) {
+ continue;
+ }
+ if (TOTING(treasure) || HERE(treasure))
+ ++snarfed;
+ if (TOTING(treasure)) {
+ movechest = true;
+ robplayer = true;
+ }
+ }
+ /* Force chest placement before player finds last treasure */
+ if (game.tally == 1 && snarfed == 0 && game.place[CHEST] == LOC_NOWHERE && HERE(LAMP) && game.prop[LAMP] == 1) {
+ RSPEAK(PIRATE_SPOTTED);
+ movechest = true;
+ }
+ /* Do things in this order (chest move before robbery) so chest is listed
+ * last at the maze location. */
+ if (movechest) {
+ MOVE(CHEST, game.chloc);
+ MOVE(MESSAG, game.chloc2);
+ game.dloc[PIRATE] = game.chloc;
+ game.odloc[PIRATE] = game.chloc;
+ game.dseen[PIRATE] = false;
+ } else {
+ /* You might get a hint of the pirate's presence even if the
+ * chest doesn't move... */
+ if (game.odloc[PIRATE] != game.dloc[PIRATE] && PCT(20))
+ RSPEAK(PIRATE_RUSTLES);
+ }
+ if (robplayer) {
+ RSPEAK(PIRATE_POUNCES);
+ for (int treasure = MINTRS; treasure <= MAXTRS; treasure++) {
+ if (!(treasure == PYRAMID && (game.loc == PLAC[PYRAMID] || game.loc == PLAC[EMERALD]))) {
+ if (AT(treasure) && game.fixed[treasure] == 0)
+ CARRY(treasure, game.loc);
+ if (TOTING(treasure))
+ DROP(treasure, game.chloc);
+ }
+ }