1 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
2 /* hack.search.c - version 1.0.3 */
3 /* $FreeBSD: src/games/hack/hack.search.c,v 1.3 1999/11/16 02:57:11 billf Exp $ */
4 /* $DragonFly: src/games/hack/hack.search.c,v 1.3 2006/08/21 19:45:32 pavalos Exp $ */
9 findit(void) /* returns number of things found */
19 for (lx = u.ux; (num = levl[lx - 1][u.uy].typ) && num != CORR; lx--) ;
20 for (hx = u.ux; (num = levl[hx + 1][u.uy].typ) && num != CORR; hx++) ;
21 for (ly = u.uy; (num = levl[u.ux][ly - 1].typ) && num != CORR; ly--) ;
22 for (hy = u.uy; (num = levl[u.ux][hy + 1].typ) && num != CORR; hy++) ;
24 for (zy = ly; zy <= hy; zy++)
25 for (zx = lx; zx <= hx; zx++) {
26 if (levl[zx][zy].typ == SDOOR) {
27 levl[zx][zy].typ = DOOR;
30 } else if (levl[zx][zy].typ == SCORR) {
31 levl[zx][zy].typ = CORR;
32 atl(zx, zy, CORR_SYM);
34 } else if ((ttmp = t_at(zx, zy)) != NULL) {
35 if (ttmp->ttyp == PIERC) {
36 makemon(PM_PIERCER, zx, zy);
39 } else if (!ttmp->tseen) {
45 } else if ((mtmp = m_at(zx, zy)) != NULL)
62 pline("What are you looking for? The exit?");
64 for (x = u.ux - 1; x < u.ux + 2; x++)
65 for (y = u.uy - 1; y < u.uy + 2; y++)
66 if (x != u.ux || y != u.uy) {
67 if (levl[x][y].typ == SDOOR) {
70 levl[x][y].typ = DOOR;
71 levl[x][y].seen = 0; /* force prl */
74 } else if (levl[x][y].typ == SCORR) {
77 levl[x][y].typ = CORR;
78 levl[x][y].seen = 0; /* force prl */
82 /* Be careful not to find anything in an SCORR or SDOOR */
83 if ((mtmp = m_at(x, y)))
86 pline("You find a mimic.");
89 for (trap = ftrap; trap; trap = trap->ntrap)
90 if (trap->tx == x && trap->ty == y &&
91 !trap->tseen && !rn2(8)) {
93 pline("You find a%s.", traps[trap->ttyp]);
94 if (trap->ttyp == PIERC) {
96 makemon(PM_PIERCER, x, y);
118 for (trap = ftrap; trap; trap = trap->ntrap)
119 if (trap->tx == x && trap->ty == y && trap->tseen) {
121 if ((u.dz < 0) != (!xdnstair && trap->ttyp == TRAPDOOR))
123 pline("That is a%s.", traps[trap->ttyp]);
126 pline("I can't see a trap there.");
131 wakeup(struct monst *mtmp)
139 /* NOTE: we must check if (mtmp->mimic) before calling this routine */
141 seemimic(struct monst *mtmp)
144 mtmp->mappearance = 0;