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
+9 -4
View File
@@ -978,10 +978,15 @@ paintGlyph(PNHMapWindow data, int i, int j, RECT * rect)
&& glyphinfo->gm.u->utf8str) {
ch = glyphinfo->gm.u->utf32ch;
if (glyphinfo->gm.u->ucolor != 0) {
rgbcolor = RGB(
(glyphinfo->gm.u->ucolor >> 16) & 0xFF,
(glyphinfo->gm.u->ucolor >> 8) & 0xFF,
(glyphinfo->gm.u->ucolor >> 0) & 0xFF);
if ((glyphinfo->gm.u->ucolor & NH_BASIC_COLOR) == 0) {
rgbcolor = RGB(
(glyphinfo->gm.u->ucolor >> 16) & 0xFF,
(glyphinfo->gm.u->ucolor >> 8) & 0xFF,
(glyphinfo->gm.u->ucolor >> 0) & 0xFF);
} else {
color = (int) (glyphinfo->gm.u->ucolor & ~NH_BASIC_COLOR);
rgbcolor = nhcolor_to_RGB(color);
}
}
}
#endif