revert one Windows change
Windows stores things a bit differently. Use a static function in consoletty.c to preserve that behavior, but still utilize the core colortable[] array.
This commit is contained in:
+24
-16
@@ -349,6 +349,7 @@ const char *esc_seq_bkcolors[CLR_MAX] = { 0 };
|
||||
|
||||
void buffer_fill_to_end(cell_t * buffer, cell_t * fill, int x, int y);
|
||||
void buffer_write(cell_t * buffer, cell_t * cell, COORD pos);
|
||||
static int32 rgbtable_to_int32(const struct nethack_color *tbl);
|
||||
void term_start_256color(int idx);
|
||||
void set_cp_map(void);
|
||||
#ifdef PORT_DEBUG
|
||||
@@ -356,6 +357,13 @@ void win32con_debug_keystrokes(void);
|
||||
void win32con_toggle_cursor_info(void);
|
||||
#endif
|
||||
|
||||
static int32
|
||||
rgbtable_to_int32(const struct nethack_color *tbl)
|
||||
{
|
||||
int32 rgbint32 = (tbl->r << 0) | (tbl->g << 8) | (tbl->b << 16);
|
||||
return rgbint32;
|
||||
}
|
||||
|
||||
#define rgbtable_offset 16
|
||||
|
||||
static void
|
||||
@@ -363,22 +371,22 @@ init_custom_colors(void)
|
||||
{
|
||||
char bkcolorbuf[32];
|
||||
|
||||
customcolors[CLR_BLACK] = colortable_to_int32(&colortable[rgbtable_offset + 131]);
|
||||
customcolors[CLR_RED] = colortable_to_int32(&colortable[rgbtable_offset + 5]);
|
||||
customcolors[CLR_GREEN] = colortable_to_int32(&colortable[rgbtable_offset + 31]);
|
||||
customcolors[CLR_BROWN] = colortable_to_int32(&colortable[rgbtable_offset + 104]);
|
||||
customcolors[CLR_BLUE] = colortable_to_int32(&colortable[rgbtable_offset + 58]);
|
||||
customcolors[CLR_MAGENTA] = colortable_to_int32(&colortable[rgbtable_offset + 76]);
|
||||
customcolors[CLR_CYAN] = colortable_to_int32(&colortable[rgbtable_offset + 48]);
|
||||
customcolors[CLR_GRAY] = colortable_to_int32(&colortable[rgbtable_offset + 73]);
|
||||
customcolors[NO_COLOR] = colortable_to_int32(&colortable[rgbtable_offset + 137]);
|
||||
customcolors[CLR_ORANGE] = colortable_to_int32(&colortable[rgbtable_offset + 15]);
|
||||
customcolors[CLR_BRIGHT_GREEN] = colortable_to_int32(&colortable[rgbtable_offset + 34]);
|
||||
customcolors[CLR_YELLOW] = colortable_to_int32(&colortable[rgbtable_offset + 18]);
|
||||
customcolors[CLR_BRIGHT_BLUE] = colortable_to_int32(&colortable[rgbtable_offset + 69]);
|
||||
customcolors[CLR_BRIGHT_MAGENTA] = colortable_to_int32(&colortable[rgbtable_offset + 84]);
|
||||
customcolors[CLR_BRIGHT_CYAN] = colortable_to_int32(&colortable[rgbtable_offset + 49]);
|
||||
customcolors[CLR_WHITE] = colortable_to_int32(&colortable[rgbtable_offset + 138]);
|
||||
customcolors[CLR_BLACK] = rgbtable_to_int32(&colortable[rgbtable_offset + 131]);
|
||||
customcolors[CLR_RED] = rgbtable_to_int32(&colortable[rgbtable_offset + 5]);
|
||||
customcolors[CLR_GREEN] = rgbtable_to_int32(&colortable[rgbtable_offset + 31]);
|
||||
customcolors[CLR_BROWN] = rgbtable_to_int32(&colortable[rgbtable_offset + 104]);
|
||||
customcolors[CLR_BLUE] = rgbtable_to_int32(&colortable[rgbtable_offset + 58]);
|
||||
customcolors[CLR_MAGENTA] = rgbtable_to_int32(&colortable[rgbtable_offset + 76]);
|
||||
customcolors[CLR_CYAN] = rgbtable_to_int32(&colortable[rgbtable_offset + 48]);
|
||||
customcolors[CLR_GRAY] = rgbtable_to_int32(&colortable[rgbtable_offset + 73]);
|
||||
customcolors[NO_COLOR] = rgbtable_to_int32(&colortable[rgbtable_offset + 137]);
|
||||
customcolors[CLR_ORANGE] = rgbtable_to_int32(&colortable[rgbtable_offset + 15]);
|
||||
customcolors[CLR_BRIGHT_GREEN] = rgbtable_to_int32(&colortable[rgbtable_offset + 34]);
|
||||
customcolors[CLR_YELLOW] = rgbtable_to_int32(&colortable[rgbtable_offset + 18]);
|
||||
customcolors[CLR_BRIGHT_BLUE] = rgbtable_to_int32(&colortable[rgbtable_offset + 69]);
|
||||
customcolors[CLR_BRIGHT_MAGENTA] = rgbtable_to_int32(&colortable[rgbtable_offset + 84]);
|
||||
customcolors[CLR_BRIGHT_CYAN] = rgbtable_to_int32(&colortable[rgbtable_offset + 49]);
|
||||
customcolors[CLR_WHITE] = rgbtable_to_int32(&colortable[rgbtable_offset + 138]);
|
||||
|
||||
/* esc_seq_colors[CLR_BLACK] = "\x1b[30m"; */
|
||||
esc_seq_colors[CLR_BLACK] = "\x1b[38;2;47;79;79m";
|
||||
|
||||
Reference in New Issue
Block a user