ENHANCED_SYMBOLS
A new feature, enabled by default to maximize testing, but one which can
be disabled by commenting it out in config.h
With this, some additional information is added to the glyphmap entries
in a new optional substructure called u with these fields:
ucolor RGB color for use with truecolor terminals/platforms.
A ucolor value of zero means "not set." The actual
rgb value of 0 has the 0x1000000 bit set.
u256coloridx 256 color index value for use with 256 color
terminals, the closest color match to ucolor.
utf8str Custom representation via utf-8 string (can be null).
There is a new symset included in the symbols file, called enhanced1.
Some initial code has been added to parse individual
OPTIONS=glyph:glyphid/R-G-B entries in the config file.
The glyphid can, in theory, either be an individual glyph (G_* glyphid)
for a single glyph, or it can be an existing symbol S_ value
(monster, object, or cmap symbol) to store the custom representation for
all the glyphs that match that symbol.
Examples:
OPTIONS=glyph:G_fountain/U+03A8/0-150-255
(Your platform/terminal font needs to be able to include/display the
character, of course.)
The NetHack core code does parsing and storing the customized
entries, and adding them to the glyphmap data structure.
Any window port can utilize the additional information in the glyphinfo
that is passed to them, once code is added to do so.
Also, consolidate some symbol-related code into symbols.c, and remove it from
files.c and options.c
This commit is contained in:
+15
-1
@@ -33,6 +33,7 @@ typedef struct nhchar {
|
||||
int ch; /* character */
|
||||
int color; /* color info for character */
|
||||
int attr; /* attributes of character */
|
||||
struct unicode_representation *unicode_representation;
|
||||
} nethack_char;
|
||||
|
||||
static boolean map_clipped; /* Map window smaller than 80x21 */
|
||||
@@ -363,7 +364,13 @@ curs_destroy_all_wins(void)
|
||||
/* Print a single character in the given window at the given coordinates */
|
||||
|
||||
void
|
||||
#ifdef ENHANCED_SYMBOLS
|
||||
curses_putch(winid wid, int x, int y, int ch,
|
||||
struct unicode_representation *unicode_representation,
|
||||
int color, int attr)
|
||||
#else
|
||||
curses_putch(winid wid, int x, int y, int ch, int color, int attr)
|
||||
#endif
|
||||
{
|
||||
static boolean map_initted = FALSE;
|
||||
int sx, sy, ex, ey;
|
||||
@@ -387,6 +394,9 @@ curses_putch(winid wid, int x, int y, int ch, int color, int attr)
|
||||
map[y][x].ch = ch;
|
||||
map[y][x].color = color;
|
||||
map[y][x].attr = attr;
|
||||
#ifdef ENHANCED_SYMBOLS
|
||||
map[y][x].unicode_representation = unicode_representation;
|
||||
#endif
|
||||
nch = map[y][x];
|
||||
|
||||
(void) curses_map_borders(&sx, &sy, &ex, &ey, -1, -1);
|
||||
@@ -589,7 +599,10 @@ write_char(WINDOW * win, int x, int y, nethack_char nch)
|
||||
#ifdef PDCURSES
|
||||
mvwaddrawch(win, y, x, nch.ch);
|
||||
#else
|
||||
mvwaddch(win, y, x, nch.ch);
|
||||
if (nch.unicode_representation && nch.unicode_representation->utf8str)
|
||||
mvwprintw(win, y, x, "%s", nch.unicode_representation->utf8str);
|
||||
else
|
||||
mvwaddch(win, y, x, nch.ch);
|
||||
#endif
|
||||
curses_toggle_color_attr(win, nch.color, nch.attr, OFF);
|
||||
}
|
||||
@@ -694,6 +707,7 @@ clear_map(void)
|
||||
map[y][x].ch = ' ';
|
||||
map[y][x].color = NO_COLOR;
|
||||
map[y][x].attr = A_NORMAL;
|
||||
map[y][x].unicode_representation = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user