MCPcopy Index your code
hub / github.com/NetHack/NetHack / reset_glyphmap

Function reset_glyphmap

src/display.c:2738–3086  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2736*/
2737
2738void
2739reset_glyphmap(enum glyphmap_change_triggers trigger)
2740{
2741 int glyph;
2742 int offset;
2743 int color = NO_COLOR;
2744
2745 /* condense multiple tests in macro version down to single */
2746 boolean has_rogue_ibm_graphics = HAS_ROGUE_IBM_GRAPHICS,
2747 has_rogue_color = (has_rogue_ibm_graphics
2748 && gs.symset[gc.currentgraphics].nocolor == 0);
2749 if (trigger == gm_levelchange)
2750 gg.glyphmap_perlevel_flags = 0;
2751
2752 if (!gg.glyphmap_perlevel_flags) {
2753 /*
2754 * GMAP_SET 0x00000001
2755 * GMAP_ROGUELEVEL 0x00000002
2756 */
2757 gg.glyphmap_perlevel_flags |= GMAP_SET;
2758
2759 if (Is_rogue_level(&u.uz)) {
2760 gg.glyphmap_perlevel_flags |= GMAP_ROGUELEVEL;
2761 }
2762 }
2763
2764 for (glyph = 0; glyph < MAX_GLYPH; ++glyph) {
2765 glyph_map *gmap = &glyphmap[glyph];
2766
2767 gmap->glyphflags = 0U;
2768 /*
2769 * Map the glyph to a character and color.
2770 *
2771 * Warning: For speed, this makes an assumption on the order of
2772 * offsets. The order is set in display.h.
2773 */
2774 if ((offset = (glyph - GLYPH_NOTHING_OFF)) >= 0) {
2775 gmap->sym.symidx = SYM_NOTHING + SYM_OFF_X;
2776 color = NO_COLOR;
2777 gmap->glyphflags |= MG_NOTHING;
2778 } else if ((offset = (glyph - GLYPH_UNEXPLORED_OFF)) >= 0) {
2779 gmap->sym.symidx = SYM_UNEXPLORED + SYM_OFF_X;
2780 color = NO_COLOR;
2781 gmap->glyphflags |= MG_UNEXPL;
2782 } else if ((offset = (glyph - GLYPH_STATUE_FEM_PILETOP_OFF)) >= 0) {
2783 gmap->sym.symidx = mons[offset].mlet + SYM_OFF_M;
2784 if (has_rogue_color)
2785 color = CLR_RED;
2786 else
2787 obj_color(STATUE);
2788 gmap->glyphflags |= (MG_STATUE | MG_FEMALE | MG_OBJPILE);
2789 } else if ((offset = (glyph - GLYPH_STATUE_MALE_PILETOP_OFF)) >= 0) {
2790 gmap->sym.symidx = mons[offset].mlet + SYM_OFF_M;
2791 if (has_rogue_color)
2792 color = CLR_RED;
2793 else
2794 obj_color(STATUE);
2795 gmap->glyphflags |= (MG_STATUE | MG_MALE | MG_OBJPILE);

Callers 6

initoptions_finishFunction · 0.85
reset_needed_visualsFunction · 0.85
newgameFunction · 0.85
assign_graphicsFunction · 0.85
goto_levelFunction · 0.85
dorecoverFunction · 0.85

Calls 2

cmap_to_roguecolorFunction · 0.85
has_colorFunction · 0.70

Tested by

no test coverage detected