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

Function map_glyphinfo

src/display.c:2593–2655  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2591#define GMAP_ROGUELEVEL 0x0002
2592
2593void
2594map_glyphinfo(
2595 coordxy x, coordxy y,
2596 int glyph,
2597 unsigned mgflags,
2598 glyph_info *glyphinfo)
2599{
2600 int offset;
2601 boolean is_you = (u_at(x, y)
2602 /* verify hero or steed (not something underneath
2603 when hero is invisible without see invisible,
2604 or a temporary display effect like an explosion);
2605 this is only approximate, because hero might be
2606 mimicking an object (after eating mimic corpse or
2607 if polyd into mimic) or furniture (only if polyd) */
2608 && glyph_is_monster(glyph));
2609 const glyph_map *gmap = &glyphmap[glyph];
2610
2611 glyphinfo->gm = *gmap; /* glyphflags, sym.symidx, sym.color, tileidx */
2612 /*
2613 * Only hero tinkering permitted on-the-fly (who).
2614 * Unique glyphs in glyphmap[] determine everything else (what).
2615 *
2616 * (Note: if hero is invisible without see invisible, he/she usually
2617 * can't see himself/herself. This applies to accessibility hacks
2618 * as well as to regular display.)
2619 */
2620 if (is_you) {
2621 if (!iflags.use_color || Upolyd || glyph != hero_glyph) {
2622 ; /* color tweak not needed (!use_color) or not wanted (poly'd
2623 or riding--which uses steed's color, not hero's) */
2624 } else if (HAS_ROGUE_IBM_GRAPHICS
2625 && gs.symset[gc.currentgraphics].nocolor == 0) {
2626 /* actually player should be yellow-on-gray if in corridor */
2627 glyphinfo->gm.sym.color = CLR_YELLOW;
2628 } else if (flags.showrace) {
2629 /* for showrace, non-human hero is displayed by the symbol of
2630 corresponding type of monster rather than by '@' (handled
2631 by newsym()); we change the color to same as human hero */
2632 glyphinfo->gm.sym.color = HI_DOMESTIC;
2633 }
2634 /* accessibility
2635 This unchanging display character for hero was requested by
2636 a blind player to enhance screen reader use.
2637 Turn on override symbol if caller hasn't specified NOOVERRIDE. */
2638 if (sysopt.accessibility == 1 && !(mgflags & MG_FLAG_NOOVERRIDE)) {
2639 offset = SYM_HERO_OVERRIDE + SYM_OFF_X;
2640 if ((gg.glyphmap_perlevel_flags & GMAP_ROGUELEVEL)
2641 ? go.ov_rogue_syms[offset]
2642 : go.ov_primary_syms[offset])
2643 glyphinfo->gm.sym.symidx = offset;
2644 }
2645 glyphinfo->gm.glyphflags |= MG_HERO;
2646 }
2647 if (sysopt.accessibility == 1
2648 && (mgflags & MG_FLAG_NOOVERRIDE) && glyph_is_pet(glyph)) {
2649 /* one more accessibility kludge;
2650 turn off override symbol if caller has specified NOOVERRIDE */

Callers 15

drawWornMethod · 0.85
NhPSListViewRoleMethod · 0.85
NhPSListViewRaceMethod · 0.85
populate_rolesMethod · 0.85
populate_racesMethod · 0.85
AddRowMethod · 0.85
map_all_unexploredFunction · 0.85
GlyphToIconFunction · 0.85
dump_mapFunction · 0.85
mixed_to_utf8Function · 0.85
reroll_menuFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected