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

View File

@@ -115,7 +115,7 @@ struct window_procs mswin_procs = {
mswin_nh_poskey, mswin_nhbell, mswin_doprev_message, mswin_yn_function,
mswin_getlin, mswin_get_ext_cmd, mswin_number_pad, mswin_delay_output,
#ifdef CHANGE_COLOR /* only a Mac option currently */
mswin, mswin_change_background,
mswin_change_color, mswin_get_color_string,
#endif
/* other defs that really should go away (they're tty specific) */
mswin_start_screen, mswin_end_screen, mswin_outrip,
@@ -1901,9 +1901,9 @@ mswin_delay_output(void)
}
void
mswin_change_color(void)
mswin_change_color(int color, long rgb, int reverse)
{
logDebug("mswin_change_color()\n");
logDebug("mswin_change_color(%d, %ld, %d)\n", color, rgb, reverse);
}
char *