* map_object() * * Map the given object. This routine assumes that the hero can physically * see the location of the object. Update the screen if directed. * [Note: feel_location() -> map_location() -> map_object() contradicts * the claim here that the hero can see obj's .] */
| 330 | * the claim here that the hero can see obj's <ox,oy>.] |
| 331 | */ |
| 332 | void |
| 333 | map_object(struct obj *obj, int show) |
| 334 | { |
| 335 | coordxy x = obj->ox, y = obj->oy; |
| 336 | int glyph = obj_to_glyph(obj, newsym_rn2); |
| 337 | |
| 338 | /* if this object is already displayed as a generic object, it might |
| 339 | become a specific one now */ |
| 340 | if (glyph_is_generic_object(glyph) && cansee(x, y) && !Hallucination) { |
| 341 | /* these 'r' and 'neardist' calculations match distant_name(objnam.c) |
| 342 | and see_nearby_objects(below); we assume that this is a lone |
| 343 | object or a pile-top, not something below the top of a pile */ |
| 344 | int r = (u.xray_range > 2) ? u.xray_range : 2, |
| 345 | /* neardist produces a small square with rounded corners */ |
| 346 | neardist = (r * r) * 2 - r; /* same as r*r + r*(r-1) */ |
| 347 | |
| 348 | if (distu(x, y) <= neardist) { |
| 349 | observe_object(obj); |
| 350 | glyph = obj_to_glyph(obj, newsym_rn2); |
| 351 | } |
| 352 | } |
| 353 | |
| 354 | if (svl.level.flags.hero_memory) { |
| 355 | /* MRKR: While hallucinating, statues are seen as random monsters */ |
| 356 | /* but remembered as random objects. */ |
| 357 | |
| 358 | if (Hallucination && obj->otyp == STATUE) { |
| 359 | levl[x][y].glyph = random_obj_to_glyph(newsym_rn2); |
| 360 | } else { |
| 361 | levl[x][y].glyph = glyph; |
| 362 | } |
| 363 | } |
| 364 | if (show) |
| 365 | show_glyph(x, y, glyph); |
| 366 | } |
| 367 | |
| 368 | /* |
| 369 | * map_invisible() |
no test coverage detected