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

Function curses_print_glyph

win/curses/cursmain.c:933–1012  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

931*/
932
933void
934curses_print_glyph(
935 winid wid,
936 coordxy x, coordxy y,
937 const glyph_info *glyphinfo,
938 const glyph_info *bkglyphinfo)
939{
940 int glyph;
941 int ch;
942 int color;
943 int nhcolor = 0;
944 unsigned int special;
945 int attr = -1;
946
947 glyph = glyphinfo->glyph;
948 special = glyphinfo->gm.glyphflags;
949 ch = glyphinfo->ttychar;
950 color = glyphinfo->gm.sym.color;
951 /* Extra color handling
952 * FIQ: The curses library does not support truecolor, only the more limited 256
953 * color mode. On top of this, the windowport only supports 16 color mode.
954 * Thus, we only allow users to customize glyph colors to the basic NetHack
955 * colors. */
956 if (glyphinfo->gm.customcolor != 0
957 && (curses_procs.wincap2 & WC2_EXTRACOLORS) != 0) {
958 if ((glyphinfo->gm.customcolor & NH_BASIC_COLOR) != 0) {
959 color = COLORVAL(glyphinfo->gm.customcolor);
960#if 0
961 } else {
962 /* 24-bit color, NH_BASIC_COLOR == 0 */
963 nhcolor = COLORVAL(glyphinfo->gm.customcolor);
964#endif
965 }
966 }
967 if ((special & MG_PET) && iflags.hilite_pet) {
968 attr = curses_convert_attr(iflags.wc2_petattr);
969 }
970 if ((special & MG_DETECT) && iflags.use_inverse) {
971 attr = A_REVERSE;
972 }
973 if (SYMHANDLING(H_DEC))
974 ch = curses_convert_glyph(ch, glyph);
975
976 if (wid == NHW_MAP) {
977/* hilite stairs not in 3.6, yet
978 if ((special & MG_STAIRS) && iflags.hilite_hidden_stairs) {
979 color = 16 + (color * 2);
980 } else
981*/
982 if ((special & MG_OBJPILE) && iflags.hilite_pile) {
983 if (iflags.wc_color)
984 color = get_framecolor(color, CLR_BLUE);
985 else /* if (iflags.use_inverse) */
986 attr = A_REVERSE;
987 }
988 /* water and lava look the same except for color; when color is off
989 (checked by core), render lava in inverse video so that it looks
990 different from water; similar for floor vs ice, fountain vs sink,

Callers

nothing calls this directly

Calls 4

curses_convert_attrFunction · 0.85
curses_convert_glyphFunction · 0.85
get_framecolorFunction · 0.85
curses_putchFunction · 0.85

Tested by

no test coverage detected