hack.read.c revision 1.7 1 1.7 jsm /* $NetBSD: hack.read.c,v 1.7 2001/03/25 20:44:02 jsm Exp $ */
2 1.4 christos
3 1.2 mycroft /*
4 1.2 mycroft * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
5 1.2 mycroft */
6 1.2 mycroft
7 1.4 christos #include <sys/cdefs.h>
8 1.2 mycroft #ifndef lint
9 1.7 jsm __RCSID("$NetBSD: hack.read.c,v 1.7 2001/03/25 20:44:02 jsm Exp $");
10 1.4 christos #endif /* not lint */
11 1.1 cgd
12 1.4 christos #include <stdlib.h>
13 1.1 cgd #include "hack.h"
14 1.4 christos #include "extern.h"
15 1.1 cgd
16 1.4 christos int
17 1.4 christos doread()
18 1.4 christos {
19 1.4 christos struct obj *scroll;
20 1.4 christos boolean confused = (Confusion != 0);
21 1.4 christos boolean known = FALSE;
22 1.1 cgd
23 1.1 cgd scroll = getobj("?", "read");
24 1.4 christos if (!scroll)
25 1.4 christos return (0);
26 1.4 christos if (!scroll->dknown && Blind) {
27 1.4 christos pline("Being blind, you cannot read the formula on the scroll.");
28 1.4 christos return (0);
29 1.1 cgd }
30 1.4 christos if (Blind)
31 1.4 christos pline("As you pronounce the formula on it, the scroll disappears.");
32 1.1 cgd else
33 1.4 christos pline("As you read the scroll, it disappears.");
34 1.4 christos if (confused)
35 1.4 christos pline("Being confused, you mispronounce the magic words ... ");
36 1.1 cgd
37 1.4 christos switch (scroll->otyp) {
38 1.1 cgd #ifdef MAIL
39 1.1 cgd case SCR_MAIL:
40 1.4 christos readmail( /* scroll */ );
41 1.1 cgd break;
42 1.4 christos #endif /* MAIL */
43 1.1 cgd case SCR_ENCHANT_ARMOR:
44 1.4 christos {
45 1.4 christos struct obj *otmp = some_armor();
46 1.4 christos if (!otmp) {
47 1.4 christos strange_feeling(scroll, "Your skin glows then fades.");
48 1.4 christos return (1);
49 1.4 christos }
50 1.4 christos if (confused) {
51 1.4 christos pline("Your %s glows silver for a moment.",
52 1.4 christos objects[otmp->otyp].oc_name);
53 1.4 christos otmp->rustfree = 1;
54 1.4 christos break;
55 1.4 christos }
56 1.4 christos if (otmp->spe > 3 && rn2(otmp->spe)) {
57 1.4 christos pline("Your %s glows violently green for a while, then evaporates.",
58 1.4 christos objects[otmp->otyp].oc_name);
59 1.4 christos useup(otmp);
60 1.4 christos break;
61 1.4 christos }
62 1.4 christos pline("Your %s glows green for a moment.",
63 1.4 christos objects[otmp->otyp].oc_name);
64 1.4 christos otmp->cursed = 0;
65 1.4 christos otmp->spe++;
66 1.1 cgd break;
67 1.1 cgd }
68 1.1 cgd case SCR_DESTROY_ARMOR:
69 1.4 christos if (confused) {
70 1.4 christos struct obj *otmp = some_armor();
71 1.4 christos if (!otmp) {
72 1.4 christos strange_feeling(scroll, "Your bones itch.");
73 1.4 christos return (1);
74 1.1 cgd }
75 1.1 cgd pline("Your %s glows purple for a moment.",
76 1.4 christos objects[otmp->otyp].oc_name);
77 1.1 cgd otmp->rustfree = 0;
78 1.1 cgd break;
79 1.1 cgd }
80 1.4 christos if (uarm) {
81 1.4 christos pline("Your armor turns to dust and falls to the floor!");
82 1.4 christos useup(uarm);
83 1.4 christos } else if (uarmh) {
84 1.4 christos pline("Your helmet turns to dust and is blown away!");
85 1.4 christos useup(uarmh);
86 1.4 christos } else if (uarmg) {
87 1.1 cgd pline("Your gloves vanish!");
88 1.1 cgd useup(uarmg);
89 1.1 cgd selftouch("You");
90 1.1 cgd } else {
91 1.4 christos strange_feeling(scroll, "Your skin itches.");
92 1.4 christos return (1);
93 1.1 cgd }
94 1.1 cgd break;
95 1.1 cgd case SCR_CONFUSE_MONSTER:
96 1.4 christos if (confused) {
97 1.1 cgd pline("Your hands begin to glow purple.");
98 1.1 cgd Confusion += rnd(100);
99 1.1 cgd } else {
100 1.1 cgd pline("Your hands begin to glow blue.");
101 1.1 cgd u.umconf = 1;
102 1.1 cgd }
103 1.1 cgd break;
104 1.1 cgd case SCR_SCARE_MONSTER:
105 1.4 christos {
106 1.4 christos int ct = 0;
107 1.4 christos struct monst *mtmp;
108 1.4 christos
109 1.4 christos for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
110 1.4 christos if (cansee(mtmp->mx, mtmp->my)) {
111 1.4 christos if (confused)
112 1.4 christos mtmp->mflee = mtmp->mfroz =
113 1.4 christos mtmp->msleep = 0;
114 1.4 christos else
115 1.4 christos mtmp->mflee = 1;
116 1.4 christos ct++;
117 1.4 christos }
118 1.4 christos if (!ct) {
119 1.4 christos if (confused)
120 1.4 christos pline("You hear sad wailing in the distance.");
121 1.1 cgd else
122 1.4 christos pline("You hear maniacal laughter in the distance.");
123 1.1 cgd }
124 1.4 christos break;
125 1.1 cgd }
126 1.1 cgd case SCR_BLANK_PAPER:
127 1.4 christos if (confused)
128 1.4 christos pline("You see strange patterns on this scroll.");
129 1.1 cgd else
130 1.4 christos pline("This scroll seems to be blank.");
131 1.1 cgd break;
132 1.1 cgd case SCR_REMOVE_CURSE:
133 1.4 christos {
134 1.4 christos struct obj *obj;
135 1.4 christos if (confused)
136 1.4 christos pline("You feel like you need some help.");
137 1.4 christos else
138 1.4 christos pline("You feel like someone is helping you.");
139 1.4 christos for (obj = invent; obj; obj = obj->nobj)
140 1.4 christos if (obj->owornmask)
141 1.4 christos obj->cursed = confused;
142 1.4 christos if (Punished && !confused) {
143 1.4 christos Punished = 0;
144 1.4 christos freeobj(uchain);
145 1.4 christos unpobj(uchain);
146 1.4 christos free((char *) uchain);
147 1.4 christos uball->spe = 0;
148 1.4 christos uball->owornmask &= ~W_BALL;
149 1.4 christos uchain = uball = (struct obj *) 0;
150 1.4 christos }
151 1.4 christos break;
152 1.1 cgd }
153 1.1 cgd case SCR_CREATE_MONSTER:
154 1.4 christos {
155 1.4 christos int cnt = 1;
156 1.1 cgd
157 1.4 christos if (!rn2(73))
158 1.4 christos cnt += rnd(4);
159 1.4 christos if (confused)
160 1.4 christos cnt += 12;
161 1.4 christos while (cnt--)
162 1.4 christos (void) makemon(confused ? PM_ACID_BLOB :
163 1.4 christos (struct permonst *) 0, u.ux, u.uy);
164 1.4 christos break;
165 1.4 christos }
166 1.1 cgd case SCR_ENCHANT_WEAPON:
167 1.4 christos if (uwep && confused) {
168 1.1 cgd pline("Your %s glows silver for a moment.",
169 1.4 christos objects[uwep->otyp].oc_name);
170 1.1 cgd uwep->rustfree = 1;
171 1.4 christos } else if (!chwepon(scroll, 1)) /* tests for !uwep */
172 1.4 christos return (1);
173 1.1 cgd break;
174 1.1 cgd case SCR_DAMAGE_WEAPON:
175 1.4 christos if (uwep && confused) {
176 1.1 cgd pline("Your %s glows purple for a moment.",
177 1.4 christos objects[uwep->otyp].oc_name);
178 1.1 cgd uwep->rustfree = 0;
179 1.4 christos } else if (!chwepon(scroll, -1)) /* tests for !uwep */
180 1.4 christos return (1);
181 1.1 cgd break;
182 1.1 cgd case SCR_TAMING:
183 1.4 christos {
184 1.4 christos int i, j;
185 1.4 christos int bd = confused ? 5 : 1;
186 1.4 christos struct monst *mtmp;
187 1.4 christos
188 1.4 christos for (i = -bd; i <= bd; i++)
189 1.4 christos for (j = -bd; j <= bd; j++)
190 1.4 christos if ((mtmp = m_at(u.ux + i, u.uy + j)) != NULL)
191 1.4 christos (void) tamedog(mtmp, (struct obj *) 0);
192 1.4 christos break;
193 1.4 christos }
194 1.1 cgd case SCR_GENOCIDE:
195 1.4 christos {
196 1.4 christos char buf[BUFSZ];
197 1.4 christos struct monst *mtmp, *mtmp2;
198 1.1 cgd
199 1.4 christos pline("You have found a scroll of genocide!");
200 1.4 christos known = TRUE;
201 1.4 christos if (confused)
202 1.4 christos *buf = u.usym;
203 1.4 christos else
204 1.4 christos do {
205 1.4 christos pline("What monster do you want to genocide (Type the letter)? ");
206 1.4 christos getlin(buf);
207 1.4 christos } while (strlen(buf) != 1 || !monstersym(*buf));
208 1.4 christos if (!strchr(fut_geno, *buf))
209 1.4 christos charcat(fut_geno, *buf);
210 1.4 christos if (!strchr(genocided, *buf))
211 1.4 christos charcat(genocided, *buf);
212 1.4 christos else {
213 1.4 christos pline("Such monsters do not exist in this world.");
214 1.4 christos break;
215 1.4 christos }
216 1.4 christos for (mtmp = fmon; mtmp; mtmp = mtmp2) {
217 1.4 christos mtmp2 = mtmp->nmon;
218 1.4 christos if (mtmp->data->mlet == *buf)
219 1.4 christos mondead(mtmp);
220 1.4 christos }
221 1.4 christos pline("Wiped out all %c's.", *buf);
222 1.4 christos if (*buf == u.usym) {
223 1.4 christos killer = "scroll of genocide";
224 1.4 christos u.uhp = -1;
225 1.4 christos }
226 1.1 cgd break;
227 1.1 cgd }
228 1.1 cgd case SCR_LIGHT:
229 1.4 christos if (!Blind)
230 1.4 christos known = TRUE;
231 1.1 cgd litroom(!confused);
232 1.1 cgd break;
233 1.1 cgd case SCR_TELEPORTATION:
234 1.4 christos if (confused)
235 1.1 cgd level_tele();
236 1.1 cgd else {
237 1.1 cgd #ifdef QUEST
238 1.4 christos int oux = u.ux, ouy = u.uy;
239 1.1 cgd tele();
240 1.4 christos if (dist(oux, ouy) > 100)
241 1.4 christos known = TRUE;
242 1.4 christos #else /* QUEST */
243 1.4 christos int uroom = inroom(u.ux, u.uy);
244 1.1 cgd tele();
245 1.4 christos if (uroom != inroom(u.ux, u.uy))
246 1.4 christos known = TRUE;
247 1.4 christos #endif /* QUEST */
248 1.1 cgd }
249 1.1 cgd break;
250 1.1 cgd case SCR_GOLD_DETECTION:
251 1.4 christos /*
252 1.4 christos * Unfortunately this code has become slightly less elegant,
253 1.4 christos * now that gold and traps no longer are of the same type.
254 1.4 christos */
255 1.4 christos if (confused) {
256 1.4 christos struct trap *ttmp;
257 1.4 christos
258 1.4 christos if (!ftrap) {
259 1.4 christos strange_feeling(scroll, "Your toes stop itching.");
260 1.4 christos return (1);
261 1.4 christos } else {
262 1.4 christos for (ttmp = ftrap; ttmp; ttmp = ttmp->ntrap)
263 1.4 christos if (ttmp->tx != u.ux || ttmp->ty != u.uy)
264 1.4 christos goto outtrapmap;
265 1.4 christos /*
266 1.4 christos * only under me - no separate display
267 1.4 christos * required
268 1.4 christos */
269 1.4 christos pline("Your toes itch!");
270 1.4 christos break;
271 1.1 cgd outtrapmap:
272 1.4 christos cls();
273 1.4 christos for (ttmp = ftrap; ttmp; ttmp = ttmp->ntrap)
274 1.4 christos at(ttmp->tx, ttmp->ty, '$');
275 1.4 christos prme();
276 1.4 christos pline("You feel very greedy!");
277 1.4 christos }
278 1.1 cgd } else {
279 1.4 christos struct gold *gtmp;
280 1.4 christos
281 1.4 christos if (!fgold) {
282 1.4 christos strange_feeling(scroll, "You feel materially poor.");
283 1.4 christos return (1);
284 1.4 christos } else {
285 1.4 christos known = TRUE;
286 1.4 christos for (gtmp = fgold; gtmp; gtmp = gtmp->ngold)
287 1.4 christos if (gtmp->gx != u.ux || gtmp->gy != u.uy)
288 1.4 christos goto outgoldmap;
289 1.4 christos /*
290 1.4 christos * only under me - no separate display
291 1.4 christos * required
292 1.4 christos */
293 1.4 christos pline("You notice some gold between your feet.");
294 1.4 christos break;
295 1.1 cgd outgoldmap:
296 1.4 christos cls();
297 1.4 christos for (gtmp = fgold; gtmp; gtmp = gtmp->ngold)
298 1.4 christos at(gtmp->gx, gtmp->gy, '$');
299 1.4 christos prme();
300 1.4 christos pline("You feel very greedy, and sense gold!");
301 1.4 christos }
302 1.1 cgd }
303 1.1 cgd /* common sequel */
304 1.1 cgd more();
305 1.1 cgd docrt();
306 1.1 cgd break;
307 1.1 cgd case SCR_FOOD_DETECTION:
308 1.4 christos {
309 1.4 christos int ct = 0, ctu = 0;
310 1.4 christos struct obj *obj;
311 1.4 christos char foodsym = confused ? POTION_SYM : FOOD_SYM;
312 1.4 christos
313 1.4 christos for (obj = fobj; obj; obj = obj->nobj)
314 1.4 christos if (obj->olet == FOOD_SYM) {
315 1.4 christos if (obj->ox == u.ux && obj->oy == u.uy)
316 1.4 christos ctu++;
317 1.4 christos else
318 1.4 christos ct++;
319 1.4 christos }
320 1.4 christos if (!ct && !ctu) {
321 1.4 christos strange_feeling(scroll, "Your nose twitches.");
322 1.4 christos return (1);
323 1.4 christos } else if (!ct) {
324 1.4 christos known = TRUE;
325 1.4 christos pline("You smell %s close nearby.",
326 1.4 christos confused ? "something" : "food");
327 1.4 christos
328 1.4 christos } else {
329 1.4 christos known = TRUE;
330 1.4 christos cls();
331 1.4 christos for (obj = fobj; obj; obj = obj->nobj)
332 1.4 christos if (obj->olet == foodsym)
333 1.4 christos at(obj->ox, obj->oy, FOOD_SYM);
334 1.4 christos prme();
335 1.4 christos pline("Your nose tingles and you smell %s!",
336 1.4 christos confused ? "something" : "food");
337 1.4 christos more();
338 1.4 christos docrt();
339 1.4 christos }
340 1.4 christos break;
341 1.1 cgd }
342 1.1 cgd case SCR_IDENTIFY:
343 1.1 cgd /* known = TRUE; */
344 1.4 christos if (confused)
345 1.1 cgd pline("You identify this as an identify scroll.");
346 1.1 cgd else
347 1.1 cgd pline("This is an identify scroll.");
348 1.1 cgd useup(scroll);
349 1.1 cgd objects[SCR_IDENTIFY].oc_name_known = 1;
350 1.4 christos if (!confused)
351 1.4 christos while (
352 1.4 christos !ggetobj("identify", identify, rn2(5) ? 1 : rn2(5))
353 1.4 christos && invent
354 1.4 christos );
355 1.4 christos return (1);
356 1.1 cgd case SCR_MAGIC_MAPPING:
357 1.4 christos {
358 1.4 christos struct rm *lev;
359 1.4 christos int num, zx, zy;
360 1.1 cgd
361 1.4 christos known = TRUE;
362 1.4 christos pline("On this scroll %s a map!",
363 1.4 christos confused ? "was" : "is");
364 1.4 christos for (zy = 0; zy < ROWNO; zy++)
365 1.4 christos for (zx = 0; zx < COLNO; zx++) {
366 1.4 christos if (confused && rn2(7))
367 1.4 christos continue;
368 1.4 christos lev = &(levl[zx][zy]);
369 1.4 christos if ((num = lev->typ) == 0)
370 1.4 christos continue;
371 1.4 christos if (num == SCORR) {
372 1.4 christos lev->typ = CORR;
373 1.4 christos lev->scrsym = CORR_SYM;
374 1.4 christos } else if (num == SDOOR) {
375 1.4 christos lev->typ = DOOR;
376 1.4 christos lev->scrsym = '+';
377 1.4 christos /* do sth in doors ? */
378 1.4 christos } else if (lev->seen)
379 1.4 christos continue;
380 1.1 cgd #ifndef QUEST
381 1.4 christos if (num != ROOM)
382 1.4 christos #endif /* QUEST */
383 1.4 christos {
384 1.4 christos lev->seen = lev->new = 1;
385 1.4 christos if (lev->scrsym == ' ' || !lev->scrsym)
386 1.4 christos newsym(zx, zy);
387 1.4 christos else
388 1.4 christos on_scr(zx, zy);
389 1.4 christos }
390 1.1 cgd }
391 1.4 christos break;
392 1.4 christos }
393 1.1 cgd case SCR_AMNESIA:
394 1.4 christos {
395 1.4 christos int zx, zy;
396 1.1 cgd
397 1.4 christos known = TRUE;
398 1.4 christos for (zx = 0; zx < COLNO; zx++)
399 1.4 christos for (zy = 0; zy < ROWNO; zy++)
400 1.4 christos if (!confused || rn2(7))
401 1.4 christos if (!cansee(zx, zy))
402 1.4 christos levl[zx][zy].seen = 0;
403 1.4 christos docrt();
404 1.4 christos pline("Thinking of Maud you forget everything else.");
405 1.4 christos break;
406 1.4 christos }
407 1.1 cgd case SCR_FIRE:
408 1.4 christos {
409 1.4 christos int num = 0;
410 1.4 christos struct monst *mtmp;
411 1.1 cgd
412 1.4 christos known = TRUE;
413 1.4 christos if (confused) {
414 1.4 christos pline("The scroll catches fire and you burn your hands.");
415 1.4 christos losehp(1, "scroll of fire");
416 1.4 christos } else {
417 1.4 christos pline("The scroll erupts in a tower of flame!");
418 1.4 christos if (Fire_resistance)
419 1.4 christos pline("You are uninjured.");
420 1.4 christos else {
421 1.4 christos num = rnd(6);
422 1.4 christos u.uhpmax -= num;
423 1.4 christos losehp(num, "scroll of fire");
424 1.4 christos }
425 1.4 christos }
426 1.4 christos num = (2 * num + 1) / 3;
427 1.4 christos for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
428 1.4 christos if (dist(mtmp->mx, mtmp->my) < 3) {
429 1.4 christos mtmp->mhp -= num;
430 1.4 christos if (strchr("FY", mtmp->data->mlet))
431 1.4 christos mtmp->mhp -= 3 * num; /* this might well kill
432 1.4 christos * 'F's */
433 1.4 christos if (mtmp->mhp < 1) {
434 1.4 christos killed(mtmp);
435 1.4 christos break; /* primitive */
436 1.4 christos }
437 1.4 christos }
438 1.1 cgd }
439 1.4 christos break;
440 1.1 cgd }
441 1.1 cgd case SCR_PUNISHMENT:
442 1.1 cgd known = TRUE;
443 1.4 christos if (confused) {
444 1.1 cgd pline("You feel guilty.");
445 1.1 cgd break;
446 1.1 cgd }
447 1.1 cgd pline("You are being punished for your misbehaviour!");
448 1.4 christos if (Punished) {
449 1.1 cgd pline("Your iron ball gets heavier.");
450 1.1 cgd uball->owt += 15;
451 1.1 cgd break;
452 1.1 cgd }
453 1.1 cgd Punished = INTRINSIC;
454 1.1 cgd setworn(mkobj_at(CHAIN_SYM, u.ux, u.uy), W_CHAIN);
455 1.1 cgd setworn(mkobj_at(BALL_SYM, u.ux, u.uy), W_BALL);
456 1.4 christos uball->spe = 1; /* special ball (see save) */
457 1.1 cgd break;
458 1.1 cgd default:
459 1.1 cgd impossible("What weird language is this written in? (%u)",
460 1.4 christos scroll->otyp);
461 1.1 cgd }
462 1.4 christos if (!objects[scroll->otyp].oc_name_known) {
463 1.4 christos if (known && !confused) {
464 1.1 cgd objects[scroll->otyp].oc_name_known = 1;
465 1.4 christos more_experienced(0, 10);
466 1.4 christos } else if (!objects[scroll->otyp].oc_uname)
467 1.1 cgd docall(scroll);
468 1.1 cgd }
469 1.1 cgd useup(scroll);
470 1.4 christos return (1);
471 1.1 cgd }
472 1.1 cgd
473 1.4 christos int
474 1.4 christos identify(otmp) /* also called by newmail() */
475 1.4 christos struct obj *otmp;
476 1.1 cgd {
477 1.1 cgd objects[otmp->otyp].oc_name_known = 1;
478 1.1 cgd otmp->known = otmp->dknown = 1;
479 1.1 cgd prinv(otmp);
480 1.4 christos return (1);
481 1.1 cgd }
482 1.1 cgd
483 1.4 christos void
484 1.1 cgd litroom(on)
485 1.4 christos boolean on;
486 1.1 cgd {
487 1.4 christos #ifndef QUEST
488 1.4 christos int num, zx, zy;
489 1.4 christos #endif
490 1.1 cgd
491 1.1 cgd /* first produce the text (provided he is not blind) */
492 1.4 christos if (Blind)
493 1.4 christos goto do_it;
494 1.4 christos if (!on) {
495 1.4 christos if (u.uswallow || !xdnstair || levl[u.ux][u.uy].typ == CORR ||
496 1.1 cgd !levl[u.ux][u.uy].lit) {
497 1.1 cgd pline("It seems even darker in here than before.");
498 1.1 cgd return;
499 1.1 cgd } else
500 1.1 cgd pline("It suddenly becomes dark in here.");
501 1.1 cgd } else {
502 1.4 christos if (u.uswallow) {
503 1.1 cgd pline("%s's stomach is lit.", Monnam(u.ustuck));
504 1.1 cgd return;
505 1.1 cgd }
506 1.4 christos if (!xdnstair) {
507 1.1 cgd pline("Nothing Happens.");
508 1.1 cgd return;
509 1.1 cgd }
510 1.1 cgd #ifdef QUEST
511 1.1 cgd pline("The cave lights up around you, then fades.");
512 1.1 cgd return;
513 1.4 christos #else /* QUEST */
514 1.4 christos if (levl[u.ux][u.uy].typ == CORR) {
515 1.4 christos pline("The corridor lights up around you, then fades.");
516 1.4 christos return;
517 1.4 christos } else if (levl[u.ux][u.uy].lit) {
518 1.4 christos pline("The light here seems better now.");
519 1.4 christos return;
520 1.1 cgd } else
521 1.4 christos pline("The room is lit.");
522 1.4 christos #endif /* QUEST */
523 1.1 cgd }
524 1.1 cgd
525 1.1 cgd do_it:
526 1.1 cgd #ifdef QUEST
527 1.1 cgd return;
528 1.4 christos #else /* QUEST */
529 1.4 christos if (levl[u.ux][u.uy].lit == on)
530 1.1 cgd return;
531 1.4 christos if (levl[u.ux][u.uy].typ == DOOR) {
532 1.4 christos if (IS_ROOM(levl[u.ux][u.uy + 1].typ))
533 1.4 christos zy = u.uy + 1;
534 1.4 christos else if (IS_ROOM(levl[u.ux][u.uy - 1].typ))
535 1.4 christos zy = u.uy - 1;
536 1.4 christos else
537 1.4 christos zy = u.uy;
538 1.4 christos if (IS_ROOM(levl[u.ux + 1][u.uy].typ))
539 1.4 christos zx = u.ux + 1;
540 1.4 christos else if (IS_ROOM(levl[u.ux - 1][u.uy].typ))
541 1.4 christos zx = u.ux - 1;
542 1.4 christos else
543 1.4 christos zx = u.ux;
544 1.1 cgd } else {
545 1.1 cgd zx = u.ux;
546 1.1 cgd zy = u.uy;
547 1.1 cgd }
548 1.4 christos for (seelx = u.ux; (num = levl[seelx - 1][zy].typ) != CORR && num != 0;
549 1.4 christos seelx--);
550 1.4 christos for (seehx = u.ux; (num = levl[seehx + 1][zy].typ) != CORR && num != 0;
551 1.4 christos seehx++);
552 1.4 christos for (seely = u.uy; (num = levl[zx][seely - 1].typ) != CORR && num != 0;
553 1.4 christos seely--);
554 1.4 christos for (seehy = u.uy; (num = levl[zx][seehy + 1].typ) != CORR && num != 0;
555 1.4 christos seehy++);
556 1.4 christos for (zy = seely; zy <= seehy; zy++)
557 1.4 christos for (zx = seelx; zx <= seehx; zx++) {
558 1.1 cgd levl[zx][zy].lit = on;
559 1.5 veego if (!Blind && dist(zx, zy) > 2) {
560 1.4 christos if (on)
561 1.4 christos prl(zx, zy);
562 1.4 christos else
563 1.4 christos nosee(zx, zy);
564 1.5 veego }
565 1.1 cgd }
566 1.4 christos if (!on)
567 1.4 christos seehx = 0;
568 1.4 christos #endif /* QUEST */
569 1.1 cgd }
570 1.1 cgd
571 1.1 cgd /* Test whether we may genocide all monsters with symbol ch */
572 1.4 christos int
573 1.4 christos monstersym(ch) /* arnold@ucsfcgl */
574 1.4 christos char ch;
575 1.1 cgd {
576 1.7 jsm const struct permonst *mp;
577 1.1 cgd
578 1.1 cgd /*
579 1.1 cgd * can't genocide certain monsters
580 1.1 cgd */
581 1.4 christos if (strchr("12 &:", ch))
582 1.1 cgd return FALSE;
583 1.1 cgd
584 1.1 cgd if (ch == pm_eel.mlet)
585 1.1 cgd return TRUE;
586 1.4 christos for (mp = mons; mp < &mons[CMNUM + 2]; mp++)
587 1.1 cgd if (mp->mlet == ch)
588 1.1 cgd return TRUE;
589 1.1 cgd return FALSE;
590 1.1 cgd }
591