CHANGE_COLOR palette option adjustments

It was too early to call the windowport change_color() routine
while processing the config file. The windowport was not yet
fully operational.

Now the palette option processing will just place the rgb
value into the appropriate ga.altpalette[CLR_MAX] entry.

init_sound_disp_gamewindows(void) [allmain.c] calls
change_palette() [coloratt.c] and it will call the windowport
change_color() function for each ga.altpalette[] entry that
has been set.

Notes:
The rgb values stored in ga.altpalette[] have the NH_ALTPALETTE bit set
so that the rgb value of 0 can be stored and be distinguishable from
a "not set" entry.

The NH_ALTPALETTE bit is cleared from the rgb value in change_palette()
prior to calling the windowport change_color() function.

The syntax for palette is colorname/r-g-b.
For example: palette:black/12-12-12

colorname must be one of the NH_BASIC_COLOR names or a suitable
alias for one of those 16 entries.

Some of the windowport CHANGE_COLOR functions had the wrong parameters,
perhaps due to bitrot. Those have been corrected to match the prototype.
This commit is contained in:
nhmall
2024-04-12 21:57:27 -04:00
parent 749f2ffb0e
commit 15db874f71
13 changed files with 239 additions and 62 deletions
+36 -1
View File
@@ -293,6 +293,27 @@ char erase_char, kill_char;
#define DEFTEXTCOLOR ttycolors[7]
static INPUT_RECORD bogus_key;
/*
Windows console palette:
Color Name Console Legacy RGB Values New Default RGB Values
BLACK 0,0,0 12,12,12
DARK_BLUE 0,0,128 0,55,218
DARK_GREEN 0,128,0 19,161,14
DARK_CYAN 0,128,128 58,150,221
DARK_RED 128,0,0 197,15,31
DARK_MAGENTA 128,0,128 136,23,152
DARK_YELLOW 128,128,0 193,156,0
DARK_WHITE 192,192,192 204,204,204
BRIGHT_BLACK 128,128,128 118,118,118
BRIGHT_BLUE 0,0,255 59,120,255
BRIGHT_GREEN 0,255,0 22,198,12
BRIGHT_CYAN 0,255,255 97,214,214
BRIGHT_RED 255,0,0 231,72,86
BRIGHT_MAGENTA 255,0,255 180,0,158
BRIGHT_YELLOW 255,255,0 249,241,165
WHITE 255,255,255 242,242,242
*/
#ifdef VIRTUAL_TERMINAL_SEQUENCES
long customcolors[CLR_MAX];
const char *esc_seq_colors[CLR_MAX];
@@ -1979,6 +2000,21 @@ tty_ibmgraphics_fixup(void)
#endif /* VIRTUAL_TERMINAL_SEQUENCES */
}
#ifdef CHANGE_COLOR
#ifdef NO_TERMS
void
tty_change_color(int color UNUSED, long rgb UNUSED, int reverse UNUSED)
{
}
char *
tty_get_color_string(void)
{
return ("");
}
#endif
#endif /* CHANGE_COLOR */
#ifdef PORT_DEBUG
void
win32con_debug_keystrokes(void)
@@ -3896,5 +3932,4 @@ nh340_checkinput(
}
return mode ? 0 : ch;
}
#endif /* WIN32 */