clairvoyance */
| 1445 | |
| 1446 | /* clairvoyance */ |
| 1447 | void |
| 1448 | do_vicinity_map( |
| 1449 | struct obj *sobj) /* scroll--actually fake spellbook--object */ |
| 1450 | { |
| 1451 | int zx, zy; |
| 1452 | struct monst *mtmp; |
| 1453 | struct obj *otmp; |
| 1454 | long save_EDetect_mons; |
| 1455 | char save_viz_uyux; |
| 1456 | boolean unconstrained, refresh = FALSE, |
| 1457 | mdetected = FALSE, odetected = FALSE, |
| 1458 | /* fake spellbook 'sobj' implies hero has cast the spell; |
| 1459 | when book is blessed, casting is skilled or expert level; |
| 1460 | if already clairvoyant, non-skilled spell acts like skilled */ |
| 1461 | extended = (sobj && (sobj->blessed || Clairvoyant)), |
| 1462 | random_farsight = !sobj; |
| 1463 | int newglyph, oldglyph, |
| 1464 | lo_y = ((u.uy - 5 < 0) ? 0 : u.uy - 5), |
| 1465 | hi_y = ((u.uy + 6 >= ROWNO) ? ROWNO - 1 : u.uy + 6), |
| 1466 | lo_x = ((u.ux - 9 < 1) ? 1 : u.ux - 9), /* avoid column 0 */ |
| 1467 | hi_x = ((u.ux + 10 >= COLNO) ? COLNO - 1 : u.ux + 10), |
| 1468 | ter_typ = TER_DETECT | TER_MAP | TER_TRP | TER_OBJ; |
| 1469 | |
| 1470 | /* |
| 1471 | * 3.6.0 attempted to emphasize terrain over transient map |
| 1472 | * properties (monsters and objects) but that led to problems. |
| 1473 | * Notably, known trap would be displayed instead of a monster |
| 1474 | * on or in it and then the display remained that way after the |
| 1475 | * clairvoyant snapshot finished. That could have been fixed by |
| 1476 | * issuing --More-- and then regular vision update, but we want |
| 1477 | * to avoid that when having a clairvoyant episode every N turns |
| 1478 | * (from donating to a temple priest or by carrying the Amulet). |
| 1479 | * Unlike when casting the spell, it is much too intrusive when |
| 1480 | * in the midst of walking around or combatting monsters. |
| 1481 | * |
| 1482 | * As of 3.6.2, show terrain, then object, then monster like regular |
| 1483 | * map updating, except in this case the map locations get marked |
| 1484 | * as seen from every direction rather than just from direction of |
| 1485 | * hero. Skilled spell marks revealed objects as 'seen up close' |
| 1486 | * (but for piles, only the top item) and shows monsters as if |
| 1487 | * detected. Non-skilled and timed clairvoyance reveals non-visible |
| 1488 | * monsters as 'remembered, unseen'. |
| 1489 | */ |
| 1490 | |
| 1491 | /* if hero is engulfed, show engulfer at <u.ux,u.uy> */ |
| 1492 | save_viz_uyux = gv.viz_array[u.uy][u.ux]; |
| 1493 | if (u.uswallow) |
| 1494 | gv.viz_array[u.uy][u.ux] |= IN_SIGHT; /* <x,y> are reversed, [y][x] */ |
| 1495 | save_EDetect_mons = EDetect_monsters; |
| 1496 | /* for skilled spell, getpos() scanning of the map will display all |
| 1497 | monsters within range; otherwise, "unseen creature" will be shown */ |
| 1498 | EDetect_monsters |= I_SPECIAL; |
| 1499 | unconstrained = unconstrain_map(); |
| 1500 | for (zx = lo_x; zx <= hi_x; zx++) |
| 1501 | for (zy = lo_y; zy <= hi_y; zy++) { |
| 1502 | oldglyph = glyph_at(zx, zy); |
| 1503 | /* this will remove 'remembered, unseen mon' (and objects) */ |
| 1504 | show_map_spot(zx, zy, Confusion); |
no test coverage detected