MCPcopy Create free account
hub / github.com/NetHack/NetHack / describe_decor

Function describe_decor

src/pickup.c:352–426  ·  view source on GitHub ↗

handle 'mention_decor' (when walking onto a dungeon feature such as stairs or altar, describe it even if it isn't covered up by an object) */

Source from the content-addressed store, hash-verified

350/* handle 'mention_decor' (when walking onto a dungeon feature such as
351 stairs or altar, describe it even if it isn't covered up by an object) */
352staticfn boolean
353describe_decor(void)
354{
355 char outbuf[BUFSZ], fbuf[QBUFSZ];
356 boolean doorhere, waterhere, res = TRUE;
357 const char *dfeature;
358 int ltyp;
359
360 if ((HFumbling & TIMEOUT) == 1L /* about to slip_or_trip */
361 && !iflags.defer_decor
362 && !gd.decor_fumble_override) { /* probe_decor() */
363 /*
364 * Work around a message sequencing issue if Fumbling's periodic
365 * timeout is about to kick in: avoid the combination
366 * |You are back on floor.
367 * |You trip over <object>. or You flounder.
368 * when the trip is being caused by moving on ice as hero
369 * steps off ice onto non-ice. Defer the back-on-floor part if
370 * that is about to happen.
371 */
372 deferred_decor(TRUE);
373 return FALSE;
374 }
375
376 ltyp = SURFACE_AT(u.ux, u.uy);
377 dfeature = dfeature_at(u.ux, u.uy, fbuf);
378
379 /* we don't mention "ordinary" doors but do mention broken ones (and
380 closed ones, which will only happen for Passes_walls) */
381 doorhere = dfeature && (!strcmp(dfeature, "open door")
382 || !strcmp(dfeature, "doorway"));
383 waterhere = dfeature && !strcmp(dfeature, "pool of water");
384 if (doorhere || Underwater
385 || (ltyp == ICE && IS_POOL(iflags.prev_decor))) /* pooleffects() */
386 dfeature = 0;
387 /*
388 * TODO: if on ice, report moving between thicker and thinner ice (based
389 * on ice_descr()'s classification) as if moving onto different terrain.
390 */
391
392 if (ltyp == iflags.prev_decor && !IS_FURNITURE(ltyp)) {
393 res = FALSE;
394 } else if (dfeature) {
395 if (waterhere)
396 dfeature = strcpy(fbuf, waterbody_name(u.ux, u.uy));
397 if (strcmp(dfeature, "swamp") && ltyp != ICE)
398 dfeature = an(dfeature);
399
400 if (flags.verbose) {
401 Sprintf(outbuf, "There is %s here.", dfeature);
402 } else {
403 if (dfeature != fbuf)
404 Strcpy(fbuf, dfeature);
405 Sprintf(outbuf, "%s.", upstart(fbuf));
406 }
407 if (ltyp == ICE && flags.mention_decor)
408 Norep("%s", outbuf);
409 else

Callers 4

force_decorFunction · 0.85
deferred_decorFunction · 0.85
check_hereFunction · 0.85
pickupFunction · 0.85

Calls 8

deferred_decorFunction · 0.85
dfeature_atFunction · 0.85
waterbody_nameFunction · 0.85
anFunction · 0.85
upstartFunction · 0.85
NorepFunction · 0.85
back_on_groundFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected