Skip to content

Commit

Permalink
Make curses windowport support the red and blue background for items.
Browse files Browse the repository at this point in the history
  • Loading branch information
root authored and tycho committed Apr 30, 2016
1 parent 06840f0 commit 54b88b0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
15 changes: 15 additions & 0 deletions win/curses/cursinit.c
Expand Up @@ -546,6 +546,21 @@ void curses_init_nhcolors()
init_pair(7, COLOR_CYAN, -1);
init_pair(8, -1, -1);

{
int i;
for (i = 0; i < 16; i++) {
int clr_remap[16] = {
COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_YELLOW, COLOR_BLUE,
COLOR_MAGENTA, COLOR_CYAN, -1, COLOR_WHITE,
COLOR_RED+8, COLOR_GREEN+8, COLOR_YELLOW+8, COLOR_BLUE+8,
COLOR_MAGENTA+8, COLOR_CYAN+8, COLOR_WHITE+8
};
init_pair(17 + (i*2) + 0, clr_remap[i], COLOR_RED);
init_pair(17 + (i*2) + 1, clr_remap[i], COLOR_BLUE);
}
}


if (COLORS >= 16)
{
init_pair(9, COLOR_WHITE, -1);
Expand Down
9 changes: 9 additions & 0 deletions win/curses/cursmain.c
Expand Up @@ -507,6 +507,15 @@ void curses_print_glyph(winid wid, xchar x, xchar y, int glyph)
{
ch = curses_convert_glyph(ch, glyph);
}

if (wid == NHW_MAP) {
if ((special & MG_STAIRS) && iflags.hilite_hidden_stairs) {
color = 16 + (color*2);
} else if ((special & MG_OBJPILE) && iflags.hilite_obj_piles) {
color = 16 + (color*2) + 1;
}
}

curses_putch(wid, x, y, ch, color, attr);
}

Expand Down
7 changes: 5 additions & 2 deletions win/curses/cursmisc.c
Expand Up @@ -111,14 +111,17 @@ void curses_toggle_color_attr(WINDOW *win, int color, int attr, int onoff)
curses_color = color + 1;
if (COLORS < 16)
{
if (curses_color > 8)
if (curses_color > 8 && curses_color < 17)
curses_color -= 8;
else if (curses_color > (17+16))
curses_color -= 16;
}
if (onoff == ON) /* Turn on color/attributes */
{
if (color != NONE)
{
if ((color > 7) && (COLORS < 16))
if ((((color > 7) && (color < 17)) ||
(color > 17+17)) && (COLORS < 16))
{
wattron(win, A_BOLD);
}
Expand Down

0 comments on commit 54b88b0

Please sign in to comment.