ENHANCED_SYMBOLS: store all CLR_ colors specially

The 0x1000000 bit (NH_BASIC_COLOR bit) was used to mark
CLR_BLACK when storing it in u->ucolor. Now, all of the basic CLR_*
colors are stored that way.

The NH_BASIC_COLOR bit indicates that the value in u->ucolor is
not an rgb value, rather it is one of the 0-15 basic NetHack colors.
The window-ports need to strip the NH_BASIC_COLOR bit off before using
it for color changes.
This commit is contained in:
nhmall
2024-03-03 18:31:11 -05:00
parent 3fb35e390b
commit 6619d10d90
10 changed files with 103 additions and 69 deletions
+12 -5
View File
@@ -133,6 +133,12 @@ X11_print_glyph(
color = glyphinfo->gm.sym.color;
special = glyphinfo->gm.glyphflags;
ch = glyph_char(glyphinfo);
#ifdef ENHANCED_SYMBOLS
if (SYMHANDLING(H_UTF8) && glyphinfo->gm.u != NULL
&& glyphinfo->gm.u->ucolor != 0
&& (glyphinfo->gm.u->ucolor & NH_BASIC_COLOR) != 0)
color = glyphinfo->gm.u->ucolor & ~NH_BASIC_COLOR;
#endif
if (special != map_info->tile_map.glyphs[y][x].glyphflags) {
map_info->tile_map.glyphs[y][x].glyphflags = special;
@@ -156,11 +162,12 @@ X11_print_glyph(
color += colordif;
#ifdef ENHANCED_SYMBOLS
if (SYMHANDLING(H_UTF8) && glyphinfo->gm.u != NULL
&& glyphinfo->gm.u->ucolor != 0) {
color = glyphinfo->gm.u->ucolor | 0x80000000;
if (colordif != 0) {
color |= 0x40000000;
}
&& glyphinfo->gm.u->ucolor != 0
&& (glyphinfo->gm.u->ucolor & NH_BASIC_COLOR) == 0) {
color = glyphinfo->gm.u->ucolor | 0x80000000;
if (colordif != 0) {
color |= 0x40000000;
}
}
#endif
if (*co_ptr != color) {