From: nhmall Date: Sat, 25 Jun 2022 17:21:51 +0000 (-0400) Subject: interface groundwork for core-side color decisions X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2770223d10151a87e284a7e40b77bf602ba8fb79;p=nethack interface groundwork for core-side color decisions (user-side decisions really, but as it stands right now user-side decisions/options are made and processed by the core) add a parameter to add_menu so color can be passed --- diff --git a/doc/window.txt b/doc/window.txt index 6e14c53cd..0be607877 100644 --- a/doc/window.txt +++ b/doc/window.txt @@ -327,7 +327,7 @@ start_menu(window, unsigned long mbehavior) -- mbehavior allows flags to be passed to alter the appearance and/or behavior of the menu. add_menu(windid window, glyphinfo, const anything identifier, char accelerator, - char groupacc, int attr, char *str, + char groupacc, int attr, int clr, char *str, unsigned itemflags) -- Add a text line str to the given menu window. If identifier is 0, then the line cannot be selected (e.g. a title). @@ -356,6 +356,30 @@ add_menu(windid window, glyphinfo, const anything identifier, char accelerator, the menu command (or their user defined aliases), it loses. The menu commands and aliases take care not to interfere with the default object class symbols. + -- attr attributes can be one of + ATR_NONE (or 0) + ATR_ULINE + ATR_BOLD + ATR_BLINK + ATR_INVERSE + If a window-port does not support all of these, it may map + unsupported attributes to a supported one (e.g. map them + all to ATR_INVERSE). + -- clr color will hold a color value including 24-bit + true color values. To do that, and make it + distinguishable on the windowport side of things, the + windowport needs to treat it as follows: + 0 = not used, just ignore the clr value. + 1-16 = indicates a normal NetHack color value from + 0 - 15, so subtract 1 to get the NetHack + color value. + 17... = indicates a 24-bit RGB color value, so + subtract 17 to get the actual 24-bit + color value. + When placing the values into this parameter, the core + will add 1 to a NetHack color value, and add 17 to a + 24-bit RGB color value. + -- str is a pointer to the menu item text. -- itemflags on this item (such as MENU_ITEMFLAGS_SELECTED etc.). end_menu(window, prompt) diff --git a/include/winX.h b/include/winX.h index 66bb9f506..0b54aec60 100644 --- a/include/winX.h +++ b/include/winX.h @@ -447,7 +447,7 @@ extern void X11_putstr(winid, int, const char *); extern void X11_display_file(const char *, boolean); extern void X11_start_menu(winid, unsigned long); extern void X11_add_menu(winid, const glyph_info *, const ANY_P *, char, - char, int, const char *, unsigned int); + char, int, int, const char *, unsigned int); extern void X11_end_menu(winid, const char *); extern int X11_select_menu(winid, int, MENU_ITEM_P **); extern void X11_mark_synch(void); diff --git a/include/wincurs.h b/include/wincurs.h index 1c3b60efd..97380c6fd 100644 --- a/include/wincurs.h +++ b/include/wincurs.h @@ -86,7 +86,7 @@ extern void curses_start_menu(winid wid, unsigned long); extern void curses_add_menu(winid wid, const glyph_info *, const ANY_P * identifier, char accelerator, char group_accel, int attr, - const char *str, unsigned int itemflags); + int clr, const char *str, unsigned int itemflags); extern void curses_end_menu(winid wid, const char *prompt); extern int curses_select_menu(winid wid, int how, MENU_ITEM_P **selected); extern void curses_mark_synch(void); diff --git a/include/winprocs.h b/include/winprocs.h index 3f6442837..d1ae52c27 100644 --- a/include/winprocs.h +++ b/include/winprocs.h @@ -32,7 +32,7 @@ struct window_procs { void (*win_display_file)(const char *, boolean); void (*win_start_menu)(winid, unsigned long); void (*win_add_menu)(winid, const glyph_info *, const ANY_P *, - char, char, int, + char, char, int, int, const char *, unsigned int); void (*win_end_menu)(winid, const char *); int (*win_select_menu)(winid, int, MENU_ITEM_P **); @@ -341,7 +341,7 @@ struct chain_procs { void (*win_start_menu)(CARGS, winid, unsigned long); void (*win_add_menu)(CARGS, winid, const glyph_info *, const ANY_P *, char, char, int, - const char *, unsigned int); + int, const char *, unsigned int); void (*win_end_menu)(CARGS, winid, const char *); int (*win_select_menu)(CARGS, winid, int, MENU_ITEM_P **); char (*win_message_menu)(CARGS, char, int, const char *); @@ -418,7 +418,7 @@ extern void safe_putmixed(winid, int, const char *); extern void safe_display_file(const char *, boolean); extern void safe_start_menu(winid, unsigned long); extern void safe_add_menu(winid, const glyph_info *, const ANY_P *, - char, char, int, const char *, + char, char, int, int, const char *, unsigned int); extern void safe_end_menu(winid, const char *); extern int safe_select_menu(winid, int, MENU_ITEM_P **); diff --git a/include/wintty.h b/include/wintty.h index 39f8dddd9..7440543e2 100644 --- a/include/wintty.h +++ b/include/wintty.h @@ -22,9 +22,11 @@ struct tty_perminvent_cell { Bitfield(refresh, 1); Bitfield(text, 1); Bitfield(glyph, 1); - Bitfield(colorbits, 5); union ttycellcontent content; - int32_t color; + int32_t color; /* adjusted color 0 = ignore + * 1-16 = NetHack color + 1 + * 17..16,777,233 = 24-bit color + 17 + */ }; #endif @@ -235,7 +237,7 @@ E void tty_putmixed(winid window, int attr, const char *str); E void tty_display_file(const char *, boolean); E void tty_start_menu(winid, unsigned long); E void tty_add_menu(winid, const glyph_info *, const ANY_P *, char, char, - int, const char *, unsigned int); + int, int, const char *, unsigned int); E void tty_end_menu(winid, const char *); E int tty_select_menu(winid, int, MENU_ITEM_P **); E char tty_message_menu(char, int, const char *); diff --git a/include/wintype.h b/include/wintype.h index 010ea2dbb..c5c93ada1 100644 --- a/include/wintype.h +++ b/include/wintype.h @@ -192,9 +192,13 @@ struct from_core { enum from_core_requests core_request; enum inv_modes invmode; boolean force_redraw; - int slot; /* which inventory slot; 0 indicates request */ + int slot; /* which inventory slot + 1; 0 indicates request */ int invlet; char text[BUFSZ]; + int32_t clr; /* adjusted color 0 = ignore + * 1-16 = NetHack color + 1 + * 17..16,777,233 = 24-bit color + 17 + */ }; struct perminvent_info_t { diff --git a/src/apply.c b/src/apply.c index 0b3f66b83..231072cd7 100644 --- a/src/apply.c +++ b/src/apply.c @@ -3523,21 +3523,22 @@ use_grapple(struct obj *obj) anything any; char buf[BUFSZ]; menu_item *selected; + int clr = 0; any = cg.zeroany; /* set all bits to zero */ any.a_int = 1; /* use index+1 (cant use 0) as identifier */ start_menu(tmpwin, MENU_BEHAVE_STANDARD); any.a_int++; Sprintf(buf, "an object on the %s", surface(cc.x, cc.y)); - add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, buf, - MENU_ITEMFLAGS_NONE); + add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + clr, buf, MENU_ITEMFLAGS_NONE); any.a_int++; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - "a monster", MENU_ITEMFLAGS_NONE); + clr, "a monster", MENU_ITEMFLAGS_NONE); any.a_int++; Sprintf(buf, "the %s", surface(cc.x, cc.y)); - add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, buf, - MENU_ITEMFLAGS_NONE); + add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, + buf, MENU_ITEMFLAGS_NONE); end_menu(tmpwin, "Aim for what?"); tohit = rn2(4); if (select_menu(tmpwin, PICK_ONE, &selected) > 0 diff --git a/src/artifact.c b/src/artifact.c index 807f2c455..d6176e9ad 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -1749,6 +1749,7 @@ arti_invoke(struct obj *obj) d_level newlev; winid tmpwin = create_nhwindow(NHW_MENU); anything any; + int clr = 0; any = cg.zeroany; /* set all bits to zero */ start_menu(tmpwin, MENU_BEHAVE_STANDARD); @@ -1758,7 +1759,8 @@ arti_invoke(struct obj *obj) continue; any.a_int = i + 1; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, g.dungeons[i].dname, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, + g.dungeons[i].dname, MENU_ITEMFLAGS_NONE); num_ok_dungeons++; last_ok_dungeon = i; } diff --git a/src/botl.c b/src/botl.c index 5d97eff97..4c754103e 100644 --- a/src/botl.c +++ b/src/botl.c @@ -1074,6 +1074,7 @@ cond_menu(void) menu_item *picks = (menu_item *) 0; char mbuf[QBUFSZ]; boolean showmenu = TRUE; + int clr = 0; do { for (i = 0; i < CONDITION_COUNT; ++i) { @@ -1092,11 +1093,11 @@ cond_menu(void) menutitle[g.condmenu_sortorder], menutitle[1 - g.condmenu_sortorder]); add_menu(tmpwin, &nul_glyphinfo, &any, 'S', 0, ATR_NONE, - mbuf, MENU_ITEMFLAGS_NONE); + clr, mbuf, MENU_ITEMFLAGS_NONE); any = cg.zeroany; Sprintf(mbuf, "sorted %s", menutitle[g.condmenu_sortorder]); add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, - iflags.menu_headings, mbuf, MENU_ITEMFLAGS_NONE); + iflags.menu_headings, clr, mbuf, MENU_ITEMFLAGS_NONE); for (i = 0; i < SIZE(condtests); i++) { idx = sequence[i]; Sprintf(mbuf, "cond_%-14s", condtests[idx].useroption); @@ -1104,7 +1105,7 @@ cond_menu(void) any.a_int = idx + 2; /* avoid zero and the sort change pick */ condtests[idx].choice = FALSE; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - mbuf, + clr, mbuf, condtests[idx].enabled ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } @@ -2332,6 +2333,7 @@ query_arrayvalue( anything any; menu_item *picks = (menu_item *) 0; int adj = (arrmin > 0) ? 1 : arrmax; + int clr = 0; tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin, MENU_BEHAVE_STANDARD); @@ -2340,7 +2342,7 @@ query_arrayvalue( any = cg.zeroany; any.a_int = i + adj; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - arr[i], MENU_ITEMFLAGS_NONE); + clr, arr[i], MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, querystr); @@ -2683,6 +2685,7 @@ query_conditions(void) winid tmpwin; anything any; menu_item *picks = (menu_item *) 0; + int clr = 0; tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin, MENU_BEHAVE_STANDARD); @@ -2691,7 +2694,7 @@ query_conditions(void) any = cg.zeroany; any.a_ulong = conditions[i].mask; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - conditions[i].text[0], MENU_ITEMFLAGS_NONE); + clr, conditions[i].text[0], MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Choose status conditions"); @@ -3237,6 +3240,7 @@ status_hilite_menu_choose_field(void) int i, res, fld = BL_FLUSH; anything any; menu_item *picks = (menu_item *) 0; + int clr = 0; tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin, MENU_BEHAVE_STANDARD); @@ -3250,7 +3254,7 @@ status_hilite_menu_choose_field(void) any = cg.zeroany; any.a_int = (i + 1); add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - initblstats[i].fldname, MENU_ITEMFLAGS_NONE); + clr, initblstats[i].fldname, MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Select a hilite field:"); @@ -3274,6 +3278,7 @@ status_hilite_menu_choose_behavior(int fld) char buf[BUFSZ]; int at; int onlybeh = BL_TH_NONE, nopts = 0; + int clr = 0; if (fld < 0 || fld >= MAXBLSTATS) return BL_TH_NONE; @@ -3288,7 +3293,7 @@ status_hilite_menu_choose_behavior(int fld) any.a_int = onlybeh = BL_TH_ALWAYS_HILITE; Sprintf(buf, "Always highlight %s", initblstats[fld].fldname); add_menu(tmpwin, &nul_glyphinfo, &any, 'a', 0, ATR_NONE, - buf, MENU_ITEMFLAGS_NONE); + clr, buf, MENU_ITEMFLAGS_NONE); nopts++; } @@ -3296,7 +3301,7 @@ status_hilite_menu_choose_behavior(int fld) any = cg.zeroany; any.a_int = onlybeh = BL_TH_CONDITION; add_menu(tmpwin, &nul_glyphinfo, &any, 'b', 0, ATR_NONE, - "Bitmask of conditions", MENU_ITEMFLAGS_NONE); + clr, "Bitmask of conditions", MENU_ITEMFLAGS_NONE); nopts++; } @@ -3305,7 +3310,7 @@ status_hilite_menu_choose_behavior(int fld) any.a_int = onlybeh = BL_TH_UPDOWN; Sprintf(buf, "%s value changes", initblstats[fld].fldname); add_menu(tmpwin, &nul_glyphinfo, &any, 'c', 0, ATR_NONE, - buf, MENU_ITEMFLAGS_NONE); + clr, buf, MENU_ITEMFLAGS_NONE); nopts++; } @@ -3314,7 +3319,7 @@ status_hilite_menu_choose_behavior(int fld) any = cg.zeroany; any.a_int = onlybeh = BL_TH_VAL_ABSOLUTE; add_menu(tmpwin, &nul_glyphinfo, &any, 'n', 0, ATR_NONE, - "Number threshold", MENU_ITEMFLAGS_NONE); + clr, "Number threshold", MENU_ITEMFLAGS_NONE); nopts++; } @@ -3322,7 +3327,7 @@ status_hilite_menu_choose_behavior(int fld) any = cg.zeroany; any.a_int = onlybeh = BL_TH_VAL_PERCENTAGE; add_menu(tmpwin, &nul_glyphinfo, &any, 'p', 0, ATR_NONE, - "Percentage threshold", MENU_ITEMFLAGS_NONE); + clr, "Percentage threshold", MENU_ITEMFLAGS_NONE); nopts++; } @@ -3332,7 +3337,7 @@ status_hilite_menu_choose_behavior(int fld) any.a_int = onlybeh = BL_TH_TEXTMATCH; Sprintf(buf, "%s text match", initblstats[fld].fldname); add_menu(tmpwin, &nul_glyphinfo, &any, 't', 0, ATR_NONE, - buf, MENU_ITEMFLAGS_NONE); + clr, buf, MENU_ITEMFLAGS_NONE); nopts++; } @@ -3365,6 +3370,7 @@ status_hilite_menu_choose_updownboth(int fld, const char *str, char buf[BUFSZ]; anything any; menu_item *picks = (menu_item *) 0; + int clr = 0; tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin, MENU_BEHAVE_STANDARD); @@ -3378,7 +3384,7 @@ status_hilite_menu_choose_updownboth(int fld, const char *str, any = cg.zeroany; any.a_int = 10 + LT_VALUE; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - buf, MENU_ITEMFLAGS_NONE); + clr, buf, MENU_ITEMFLAGS_NONE); if (str) { Sprintf(buf, "%s or %s", @@ -3386,7 +3392,7 @@ status_hilite_menu_choose_updownboth(int fld, const char *str, any = cg.zeroany; any.a_int = 10 + LE_VALUE; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - buf, MENU_ITEMFLAGS_NONE); + clr, buf, MENU_ITEMFLAGS_NONE); } } @@ -3397,7 +3403,7 @@ status_hilite_menu_choose_updownboth(int fld, const char *str, any = cg.zeroany; any.a_int = 10 + EQ_VALUE; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - buf, MENU_ITEMFLAGS_NONE); + clr, buf, MENU_ITEMFLAGS_NONE); if (gtok) { if (str) { @@ -3406,7 +3412,7 @@ status_hilite_menu_choose_updownboth(int fld, const char *str, any = cg.zeroany; any.a_int = 10 + GE_VALUE; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - buf, MENU_ITEMFLAGS_NONE); + clr, buf, MENU_ITEMFLAGS_NONE); } if (str) @@ -3417,7 +3423,7 @@ status_hilite_menu_choose_updownboth(int fld, const char *str, any = cg.zeroany; any.a_int = 10 + GT_VALUE; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - buf, MENU_ITEMFLAGS_NONE); + clr, buf, MENU_ITEMFLAGS_NONE); } Sprintf(buf, "Select field %s value:", initblstats[fld].fldname); end_menu(tmpwin, buf); @@ -3901,6 +3907,7 @@ status_hilite_menu_fld(int fld) struct _status_hilite_line_str *hlstr; char buf[BUFSZ]; boolean acted; + int clr = 0; if (!count) { if (status_hilite_menu_add(fld)) { @@ -3921,27 +3928,27 @@ status_hilite_menu_fld(int fld) any = cg.zeroany; any.a_int = hlstr->id; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - hlstr->str, MENU_ITEMFLAGS_NONE); + clr, hlstr->str, MENU_ITEMFLAGS_NONE); } hlstr = hlstr->next; } } else { any = cg.zeroany; Sprintf(buf, "No current hilites for %s", initblstats[fld].fldname); - add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, buf, + add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); } /* separator line */ any = cg.zeroany; - add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, "", + add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, "", MENU_ITEMFLAGS_NONE); if (count) { any = cg.zeroany; any.a_int = -1; add_menu(tmpwin, &nul_glyphinfo, &any, 'X', 0, ATR_NONE, - "Remove selected hilites", + clr, "Remove selected hilites", MENU_ITEMFLAGS_NONE); } @@ -3958,7 +3965,7 @@ status_hilite_menu_fld(int fld) any = cg.zeroany; any.a_int = -2; add_menu(tmpwin, &nul_glyphinfo, &any, 'Z', 0, ATR_NONE, - "Add new hilites", MENU_ITEMFLAGS_NONE); + clr, "Add new hilites", MENU_ITEMFLAGS_NONE); } Sprintf(buf, "Current %s hilites:", initblstats[fld].fldname); @@ -4023,6 +4030,7 @@ status_hilite_menu(void) anything any; boolean redo; int countall; + int clr = 0; shlmenu_redo: redo = FALSE; @@ -4036,12 +4044,12 @@ status_hilite_menu(void) any = cg.zeroany; any.a_int = -1; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - "View all hilites in config format", + clr, "View all hilites in config format", MENU_ITEMFLAGS_NONE); any = cg.zeroany; - add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, "", - MENU_ITEMFLAGS_NONE); + add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + clr, "", MENU_ITEMFLAGS_NONE); } for (i = 0; i < MAXBLSTATS; i++) { @@ -4062,7 +4070,7 @@ status_hilite_menu(void) if (count) Sprintf(eos(buf), " (%d defined)", count); add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - buf, MENU_ITEMFLAGS_NONE); + clr, buf, MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Status hilites:"); diff --git a/src/cmd.c b/src/cmd.c index 73d175105..cb41bf676 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -496,6 +496,7 @@ doc_extcmd_flagstr( const struct ext_func_tab *efp) /* if Null, add a footnote to the menu */ { static char Abuf[10]; /* 5 would suffice: {'[','m','A',']','\0'} */ + int clr = 0; /* note: tag shown for menu prefix is 'm' even if m-prefix action has been bound to some other key */ @@ -503,11 +504,11 @@ doc_extcmd_flagstr( char qbuf[QBUFSZ]; anything any = cg.zeroany; - add_menu(menuwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + add_menu(menuwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, "[A] Command autocompletes", MENU_ITEMFLAGS_NONE); Sprintf(qbuf, "[m] Command accepts '%s' prefix", visctrl(cmd_from_func(do_reqmenu))); - add_menu(menuwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, qbuf, + add_menu(menuwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, qbuf, MENU_ITEMFLAGS_NONE); return (char *) 0; } else { @@ -544,6 +545,7 @@ doextlist(void) boolean redisplay = TRUE, search = FALSE; static const char *const headings[] = { "Extended commands", "Debugging Extended Commands" }; + int clr = 0; searchbuf[0] = '\0'; menuwin = create_nhwindow(NHW_MENU); @@ -552,16 +554,16 @@ doextlist(void) redisplay = FALSE; any = cg.zeroany; start_menu(menuwin, MENU_BEHAVE_STANDARD); - add_menu(menuwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + add_menu(menuwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, "Extended Commands List", MENU_ITEMFLAGS_NONE); - add_menu(menuwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + add_menu(menuwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, "", MENU_ITEMFLAGS_NONE); Sprintf(buf, "Switch to %s commands that don't autocomplete", menumode ? "including" : "excluding"); any.a_int = 1; - add_menu(menuwin, &nul_glyphinfo, &any, 'a', 0, ATR_NONE, buf, + add_menu(menuwin, &nul_glyphinfo, &any, 'a', 0, ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); if (!*searchbuf) { @@ -572,7 +574,7 @@ doextlist(void) having ':' as an explicit selector overrides the default menu behavior for it; we retain 's' as a group accelerator */ add_menu(menuwin, &nul_glyphinfo, &any, ':', 's', ATR_NONE, - "Search extended commands", + clr, "Search extended commands", MENU_ITEMFLAGS_NONE); } else { Strcpy(buf, "Switch back from search"); @@ -585,17 +587,17 @@ doextlist(void) work for interfaces which support ':' to search; use as a general menu command takes precedence over group accelerator */ add_menu(menuwin, &nul_glyphinfo, &any, 's', ':', ATR_NONE, - buf, MENU_ITEMFLAGS_NONE); + clr, buf, MENU_ITEMFLAGS_NONE); } if (wizard) { any.a_int = 4; - add_menu(menuwin, &nul_glyphinfo, &any, 'z', 0, ATR_NONE, + add_menu(menuwin, &nul_glyphinfo, &any, 'z', 0, ATR_NONE, clr, onelist ? "Switch to showing debugging commands in separate section" : "Switch to showing all alphabetically, including debugging commands", MENU_ITEMFLAGS_NONE); } any = cg.zeroany; - add_menu(menuwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + add_menu(menuwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, "", MENU_ITEMFLAGS_NONE); menushown[0] = menushown[1] = 0; n = 0; @@ -638,7 +640,7 @@ doextlist(void) if (!menushown[pass]) { Strcpy(buf, headings[pass]); add_menu(menuwin, &nul_glyphinfo, &any, 0, 0, - iflags.menu_headings, buf, + iflags.menu_headings, clr, buf, MENU_ITEMFLAGS_NONE); menushown[pass] = 1; } @@ -647,16 +649,16 @@ doextlist(void) Sprintf(buf, " %-14s %4s %s", efp->ef_txt, doc_extcmd_flagstr(menuwin, efp), efp->ef_desc); add_menu(menuwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - buf, MENU_ITEMFLAGS_NONE); + clr, buf, MENU_ITEMFLAGS_NONE); ++n; } if (n) add_menu(menuwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - "", MENU_ITEMFLAGS_NONE); + clr, "", MENU_ITEMFLAGS_NONE); } if (*searchbuf && !n) add_menu(menuwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - "no matches", MENU_ITEMFLAGS_NONE); + clr, "no matches", MENU_ITEMFLAGS_NONE); else (void) doc_extcmd_flagstr(menuwin, (struct ext_func_tab *) 0); @@ -734,6 +736,7 @@ extcmd_via_menu(void) int accelerator, prevaccelerator; int matchlevel = 0; boolean wastoolong, one_per_line; + int clr = 0; ret = 0; cbuf[0] = '\0'; @@ -797,7 +800,7 @@ extcmd_via_menu(void) Sprintf(buf, fmtstr, prompt); any.a_char = prevaccelerator; add_menu(win, &nul_glyphinfo, &any, any.a_char, - 0, ATR_NONE, buf, MENU_ITEMFLAGS_NONE); + 0, ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); acount = 0; if (!(accelerator != prevaccelerator || one_per_line)) wastoolong = TRUE; @@ -821,7 +824,7 @@ extcmd_via_menu(void) Sprintf(buf, fmtstr, prompt); any.a_char = prevaccelerator; add_menu(win, &nul_glyphinfo, &any, any.a_char, 0, - ATR_NONE, buf, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); } Snprintf(prompt, sizeof(prompt), "Extended Command: %s", cbuf); end_menu(win, prompt); @@ -1838,6 +1841,7 @@ wiz_intrinsic(void) long oldtimeout, newtimeout; const char *propname; menu_item *pick_list = (menu_item *) 0; + int clr = 0; any = cg.zeroany; win = create_nhwindow(NHW_MENU); @@ -1848,7 +1852,7 @@ wiz_intrinsic(void) "[Precede any selection with a count to increment by other than %d.]", DEFAULT_TIMEOUT_INCR); any.a_int = 0; - add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, buf, + add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); } for (i = 0; (propname = propertynames[i].prop_name) != 0; ++i) { @@ -1866,7 +1870,7 @@ wiz_intrinsic(void) set to timed values here so show a separator */ any.a_int = 0; add_menu(win, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, "--", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "--", MENU_ITEMFLAGS_NONE); } any.a_int = i + 1; /* +1: avoid 0 */ oldtimeout = u.uprops[p].intrinsic & TIMEOUT; @@ -1874,7 +1878,7 @@ wiz_intrinsic(void) Sprintf(buf, "%-27s [%li]", propname, oldtimeout); else Sprintf(buf, "%s", propname); - add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, buf, + add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); } end_menu(win, "Which intrinsics?"); @@ -1991,6 +1995,7 @@ doterrain(void) anything any; int n; int which; + int clr = 0; /* * normal play: choose between known map without mons, obj, and traps @@ -2006,30 +2011,30 @@ doterrain(void) start_menu(men, MENU_BEHAVE_STANDARD); any = cg.zeroany; any.a_int = 1; - add_menu(men, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + add_menu(men, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, "known map without monsters, objects, and traps", MENU_ITEMFLAGS_SELECTED); any.a_int = 2; add_menu(men, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - "known map without monsters and objects", + clr, "known map without monsters and objects", MENU_ITEMFLAGS_NONE); any.a_int = 3; add_menu(men, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - "known map without monsters", + clr, "known map without monsters", MENU_ITEMFLAGS_NONE); if (discover || wizard) { any.a_int = 4; add_menu(men, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - "full map without monsters, objects, and traps", + clr, "full map without monsters, objects, and traps", MENU_ITEMFLAGS_NONE); if (wizard) { any.a_int = 5; add_menu(men, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - "internal levl[][].typ codes in base-36", + clr, "internal levl[][].typ codes in base-36", MENU_ITEMFLAGS_NONE); any.a_int = 6; add_menu(men, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - "legend of base-36 levl[][].typ codes", + clr, "legend of base-36 levl[][].typ codes", MENU_ITEMFLAGS_NONE); } } @@ -4812,11 +4817,12 @@ static void mcmd_addmenu(winid win, int act, const char *txt) { anything any; + int clr = 0; /* TODO: fixed letters for the menu entries? */ any = cg.zeroany; any.a_int = act; - add_menu(win, &nul_glyphinfo, &any, '\0', 0, ATR_NONE, txt, + add_menu(win, &nul_glyphinfo, &any, '\0', 0, ATR_NONE, clr, txt, MENU_ITEMFLAGS_NONE); } diff --git a/src/do_name.c b/src/do_name.c index 1b007eb3f..8febc88fd 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -586,6 +586,7 @@ getpos_menu(coord *ccp, int gloc) int i, pick_cnt; menu_item *picks = (menu_item *) 0; char tmpbuf[BUFSZ]; + int clr = 0; gather_locs(&garr, &gcount, gloc); @@ -618,7 +619,7 @@ getpos_menu(coord *ccp, int gloc) Snprintf(fullbuf, sizeof fullbuf, "%s%s%s", firstmatch, (*tmpbuf ? " " : ""), tmpbuf); add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, fullbuf, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, fullbuf, MENU_ITEMFLAGS_NONE); } } @@ -1461,6 +1462,7 @@ docallcmd(void) char ch = 0; /* if player wants a,b,c instead of i,o when looting, do that here too */ boolean abc = flags.lootabc; + int clr = 0; if ((cmdq = cmdq_pop()) != 0) { cq = *cmdq; @@ -1476,30 +1478,30 @@ docallcmd(void) any = cg.zeroany; any.a_char = 'm'; /* group accelerator 'C' */ add_menu(win, &nul_glyphinfo, &any, abc ? 0 : any.a_char, 'C', - ATR_NONE, "a monster", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "a monster", MENU_ITEMFLAGS_NONE); if (g.invent) { /* we use y and n as accelerators so that we can accept user's response keyed to old "name an individual object?" prompt */ any.a_char = 'i'; /* group accelerator 'y' */ add_menu(win, &nul_glyphinfo, &any, abc ? 0 : any.a_char, 'y', - ATR_NONE, "a particular object in inventory", + ATR_NONE, clr, "a particular object in inventory", MENU_ITEMFLAGS_NONE); any.a_char = 'o'; /* group accelerator 'n' */ add_menu(win, &nul_glyphinfo, &any, abc ? 0 : any.a_char, 'n', - ATR_NONE, "the type of an object in inventory", + ATR_NONE, clr, "the type of an object in inventory", MENU_ITEMFLAGS_NONE); } any.a_char = 'f'; /* group accelerator ',' (or ':' instead?) */ add_menu(win, &nul_glyphinfo, &any, abc ? 0 : any.a_char, ',', - ATR_NONE, "the type of an object upon the floor", + ATR_NONE, clr, "the type of an object upon the floor", MENU_ITEMFLAGS_NONE); any.a_char = 'd'; /* group accelerator '\' */ add_menu(win, &nul_glyphinfo, &any, abc ? 0 : any.a_char, '\\', - ATR_NONE, "the type of an object on discoveries list", + ATR_NONE, clr, "the type of an object on discoveries list", MENU_ITEMFLAGS_NONE); any.a_char = 'a'; /* group accelerator 'l' */ add_menu(win, &nul_glyphinfo, &any, abc ? 0 : any.a_char, 'l', - ATR_NONE, "record an annotation for the current level", + ATR_NONE, clr, "record an annotation for the current level", MENU_ITEMFLAGS_NONE); end_menu(win, "What do you want to name?"); if (select_menu(win, PICK_ONE, &pick_list) > 0) { diff --git a/src/dungeon.c b/src/dungeon.c index b176b36fc..eeebf445b 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -2090,6 +2090,7 @@ tport_menu(winid win, char *entry, struct lchoice *lchoices, { char tmpbuf[BUFSZ]; anything any; + int clr = 0; lchoices->lev[lchoices->idx] = lvl_p->dlevel; lchoices->dgn[lchoices->idx] = lvl_p->dnum; @@ -2104,7 +2105,7 @@ tport_menu(winid win, char *entry, struct lchoice *lchoices, any.a_int = lchoices->idx + 1; } add_menu(win, &nul_glyphinfo, &any, lchoices->menuletter, 0, - ATR_NONE, entry, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, entry, MENU_ITEMFLAGS_NONE); /* this assumes there are at most 52 interesting levels */ if (lchoices->menuletter == 'z') lchoices->menuletter = 'A'; @@ -2236,6 +2237,7 @@ print_dungeon(boolean bymenu, schar *rlev, xchar *rdgn) anything any; struct lchoice lchoices; winid win = create_nhwindow(NHW_MENU); + int clr = 0; if (bymenu) { start_menu(win, MENU_BEHAVE_STANDARD); @@ -2268,7 +2270,7 @@ print_dungeon(boolean bymenu, schar *rlev, xchar *rdgn) if (bymenu) { any = cg.zeroany; add_menu(win, &nul_glyphinfo, &any, 0, 0, - iflags.menu_headings, buf, MENU_ITEMFLAGS_NONE); + iflags.menu_headings, clr, buf, MENU_ITEMFLAGS_NONE); } else putstr(win, 0, buf); diff --git a/src/insight.c b/src/insight.c index 3dd58b696..04b1d5bff 100644 --- a/src/insight.c +++ b/src/insight.c @@ -113,11 +113,13 @@ static struct ll_achieve_msg achieve_msg [] = { static void enlght_out(const char *buf) { + int clr = 0; + if (g.en_via_menu) { anything any; any = cg.zeroany; - add_menu(g.en_win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, buf, + add_menu(g.en_win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); } else putstr(g.en_win, 0, buf); @@ -2567,7 +2569,8 @@ set_vanq_order(void) winid tmpwin; menu_item *selected; anything any; - int i, n, choice; + int i, n, choice, + clr = 0; tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin, MENU_BEHAVE_STANDARD); @@ -2576,7 +2579,7 @@ set_vanq_order(void) if (i == VANQ_ALPHA_MIX || i == VANQ_MCLS_HTOL) /* skip these */ continue; any.a_int = i + 1; - add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, vanqorders[i], (i == g.vanq_sortmode) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); diff --git a/src/invent.c b/src/invent.c index 353df337a..7dbfaa647 100644 --- a/src/invent.c +++ b/src/invent.c @@ -2676,11 +2676,12 @@ static void ia_addmenu(winid win, int act, char let, const char *txt) { anything any; + int clr = 0; any = cg.zeroany; any.a_int = act; add_menu(win, &nul_glyphinfo, &any, let, 0, - ATR_NONE, txt, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, txt, MENU_ITEMFLAGS_NONE); } /* Show menu of possible actions hero could do with item otmp */ @@ -3177,6 +3178,7 @@ display_pickinv( unsigned sortflags; Loot *sortedinvent, *srtinv; boolean wizid = (wizard && iflags.override_ID), gotsomething = FALSE; + int clr = 0; if (lets && !*lets) lets = 0; /* simplify tests: (lets) instead of (lets && *lets) */ @@ -3268,10 +3270,10 @@ display_pickinv( Sprintf(eos(prompt), " -- unidentified or partially identified item%s", plur(unid_cnt)); - add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, prompt, + add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, prompt, MENU_ITEMFLAGS_NONE); if (!unid_cnt) { - add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, "(all items are permanently identified already)", MENU_ITEMFLAGS_NONE); gotsomething = TRUE; @@ -3288,18 +3290,18 @@ display_pickinv( Sprintf(eos(prompt), " (%s for all)", visctrl(iflags.override_ID)); add_menu(win, &nul_glyphinfo, &any, '_', iflags.override_ID, - ATR_NONE, prompt, MENU_ITEMFLAGS_SKIPINVERT); + ATR_NONE, clr, prompt, MENU_ITEMFLAGS_SKIPINVERT); gotsomething = TRUE; } } else if (xtra_choice) { /* wizard override ID and xtra_choice are mutually exclusive */ if (flags.sortpack) add_menu(win, &nul_glyphinfo, &any, 0, 0, - iflags.menu_headings, + iflags.menu_headings, clr, "Miscellaneous", MENU_ITEMFLAGS_NONE); any.a_char = HANDS_SYM; /* '-' */ add_menu(win, &nul_glyphinfo, &any, HANDS_SYM, 0, ATR_NONE, - xtra_choice, MENU_ITEMFLAGS_NONE); + clr, xtra_choice, MENU_ITEMFLAGS_NONE); gotsomething = TRUE; } @@ -3318,7 +3320,7 @@ display_pickinv( ilet = otmp->invlet; if (flags.sortpack && !classcount) { add_menu(win, &nul_glyphinfo, &any, 0, 0, - iflags.menu_headings, + iflags.menu_headings, clr, let_to_name(*invlet, FALSE, (want_reply && iflags.menu_head_objsym)), MENU_ITEMFLAGS_NONE); @@ -3333,7 +3335,7 @@ display_pickinv( formattedobj = doname(otmp); add_menu(win, &tmpglyphinfo, &any, ilet, wizid ? def_oc_syms[(int) otmp->oclass].sym : 0, - ATR_NONE, formattedobj, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, formattedobj, MENU_ITEMFLAGS_NONE); /* doname() uses a static pool of obuf[] output buffers and we don't want inventory display to overwrite all of them, so when we've used one we release it for re-use */ @@ -3357,9 +3359,9 @@ display_pickinv( && (int) strlen(lets) < inv_cnt(TRUE)) { any = cg.zeroany; add_menu(win, &nul_glyphinfo, &any, 0, 0, - iflags.menu_headings, "Special", MENU_ITEMFLAGS_NONE); + iflags.menu_headings, clr, "Special", MENU_ITEMFLAGS_NONE); any.a_char = '*'; - add_menu(win, &nul_glyphinfo, &any, '*', 0, ATR_NONE, + add_menu(win, &nul_glyphinfo, &any, '*', 0, ATR_NONE, clr, "(list everything)", MENU_ITEMFLAGS_NONE); gotsomething = TRUE; } @@ -3370,7 +3372,7 @@ display_pickinv( into the menu */ if (iflags.perm_invent && !lets && !gotsomething) { any = cg.zeroany; - add_menu(win, &nul_glyphinfo, &any, 0, 0, 0, + add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, not_carrying_anything, MENU_ITEMFLAGS_NONE); want_reply = FALSE; } @@ -3465,6 +3467,7 @@ display_used_invlets(char avoidlet) winid win; anything any; menu_item *selected; + int clr = 0; if (g.invent) { win = create_nhwindow(NHW_MENU); @@ -3480,7 +3483,7 @@ display_used_invlets(char avoidlet) if (flags.sortpack && !classcount) { any = cg.zeroany; /* zero */ add_menu(win, &nul_glyphinfo, &any, 0, 0, - iflags.menu_headings, + iflags.menu_headings, clr, let_to_name(*invlet, FALSE, FALSE), MENU_ITEMFLAGS_NONE); classcount++; @@ -3489,7 +3492,7 @@ display_used_invlets(char avoidlet) tmpglyph = obj_to_glyph(otmp, rn2_on_display_rng); map_glyphinfo(0, 0, tmpglyph, 0U, &tmpglyphinfo); add_menu(win, &tmpglyphinfo, &any, ilet, 0, - ATR_NONE, doname(otmp), MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, doname(otmp), MENU_ITEMFLAGS_NONE); } } if (flags.sortpack && *++invlet) @@ -5116,15 +5119,16 @@ invdisp_nothing(const char *hdr, const char *txt) winid win; anything any; menu_item *selected; + int clr = 0; any = cg.zeroany; win = create_nhwindow(NHW_MENU); start_menu(win, MENU_BEHAVE_STANDARD); - add_menu(win, &nul_glyphinfo, &any, 0, 0, iflags.menu_headings, + add_menu(win, &nul_glyphinfo, &any, 0, 0, iflags.menu_headings, clr, hdr, MENU_ITEMFLAGS_NONE); - add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, "", MENU_ITEMFLAGS_NONE); - add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, txt, + add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, txt, MENU_ITEMFLAGS_NONE); end_menu(win, (char *) 0); if (select_menu(win, PICK_NONE, &selected) > 0) diff --git a/src/nhlua.c b/src/nhlua.c index 4cd7a204d..a8b1905f1 100644 --- a/src/nhlua.c +++ b/src/nhlua.c @@ -667,6 +667,7 @@ nhl_menu(lua_State *L) winid tmpwin; anything any; menu_item *picks = (menu_item *) 0; + int clr = 0; if (argc < 2 || argc > 4) { nhl_error(L, "Wrong args"); @@ -709,7 +710,7 @@ nhl_menu(lua_State *L) any = cg.zeroany; if (*key) any.a_char = key[0]; - add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, str, + add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, str, (*defval && *key && defval[0] == key[0]) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); diff --git a/src/o_init.c b/src/o_init.c index 6529404c8..66065fea4 100644 --- a/src/o_init.c +++ b/src/o_init.c @@ -561,6 +561,7 @@ choose_disco_sort( menu_item *selected; anything any; int i, n, choice; + int clr = 0; tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin, MENU_BEHAVE_STANDARD); @@ -568,7 +569,7 @@ choose_disco_sort( for (i = 0; disco_orders_descr[i]; ++i) { any.a_int = disco_order_let[i]; add_menu(tmpwin, &nul_glyphinfo, &any, (char) any.a_int, - 0, ATR_NONE, + 0, ATR_NONE, clr, disco_orders_descr[i], (disco_order_let[i] == flags.discosort) ? MENU_ITEMFLAGS_SELECTED @@ -579,15 +580,15 @@ choose_disco_sort( (only showing one class so can't span all classes) but the chosen sort will stick and also apply to '\' usage */ any = cg.zeroany; - add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, "", MENU_ITEMFLAGS_NONE); - add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, "Note: full alphabetical and alphabetical within class", MENU_ITEMFLAGS_NONE); - add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, " are equivalent for single class discovery, but", MENU_ITEMFLAGS_NONE); - add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, " will matter for future use of total discoveries.", MENU_ITEMFLAGS_NONE); } @@ -755,6 +756,7 @@ doclassdisco(void) *sorted_lines[NUM_OBJECTS]; /* overkill */ int i, ct, dis, xtras, sorted_ct; boolean traditional, alphabetized, lootsort; + int clr = 0; if (!flags.discosort || !(p = index(disco_order_let, flags.discosort))) flags.discosort = 'o'; @@ -783,7 +785,7 @@ doclassdisco(void) if (!traditional) { any.a_int = 'u'; add_menu(tmpwin, &nul_glyphinfo, &any, menulet++, - 0, ATR_NONE, unique_items, MENU_ITEMFLAGS_NONE); + 0, ATR_NONE, clr, unique_items, MENU_ITEMFLAGS_NONE); } break; } @@ -794,7 +796,7 @@ doclassdisco(void) if (!traditional) { any.a_int = 'a'; add_menu(tmpwin, &nul_glyphinfo, &any, menulet++, - 0, ATR_NONE, artifact_items, MENU_ITEMFLAGS_NONE); + 0, ATR_NONE, clr, artifact_items, MENU_ITEMFLAGS_NONE); } } @@ -815,7 +817,7 @@ doclassdisco(void) if (!traditional) { any.a_int = c; add_menu(tmpwin, &nul_glyphinfo, &any, - menulet++, c, ATR_NONE, + menulet++, c, ATR_NONE, clr, oclass_to_name(oclass, buf), MENU_ITEMFLAGS_NONE); } @@ -961,6 +963,7 @@ rename_disco(void) winid tmpwin; anything any; menu_item *selected = 0; + int clr = 0; any = cg.zeroany; tmpwin = create_nhwindow(NHW_MENU); @@ -990,14 +993,14 @@ rename_disco(void) if (oclass != prev_class) { any.a_int = 0; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, - iflags.menu_headings, + iflags.menu_headings, clr, let_to_name(oclass, FALSE, FALSE), MENU_ITEMFLAGS_NONE); prev_class = oclass; } any.a_int = dis; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, + ATR_NONE, clr, obj_typename(dis), MENU_ITEMFLAGS_NONE); } } diff --git a/src/options.c b/src/options.c index 71dd7258d..72aadf7db 100644 --- a/src/options.c +++ b/src/options.c @@ -4614,6 +4614,7 @@ handler_menustyle(void) int i, n, old_menu_style = flags.menu_style; char buf[BUFSZ], sep = iflags.menu_tab_sep ? '\t' : ' '; menu_item *style_pick = (menu_item *) 0; + int clr = 0; tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin, MENU_BEHAVE_STANDARD); @@ -4621,13 +4622,13 @@ handler_menustyle(void) for (i = 0; i < SIZE(menutype); i++) { Sprintf(buf, "%-12.12s%c%.60s", menutype[i][0], sep, menutype[i][1]); any.a_int = i + 1; - add_menu(tmpwin, &nul_glyphinfo, &any, *buf, 0, ATR_NONE, buf, + add_menu(tmpwin, &nul_glyphinfo, &any, *buf, 0, ATR_NONE, clr, buf, (i == flags.menu_style) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); /* second line is prefixed by spaces that "c - " would use */ Sprintf(buf, "%4s%-12.12s%c%.60s", "", "", sep, menutype[i][2]); any.a_int = 0; - add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, buf, + add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Select menustyle:"); @@ -4655,21 +4656,22 @@ handler_align_misc(int optidx) anything any; menu_item *window_pick = (menu_item *) 0; char abuf[BUFSZ]; + int clr = 0; tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin, MENU_BEHAVE_STANDARD); any = cg.zeroany; any.a_int = ALIGN_TOP; - add_menu(tmpwin, &nul_glyphinfo, &any, 't', 0, ATR_NONE, "top", + add_menu(tmpwin, &nul_glyphinfo, &any, 't', 0, ATR_NONE, clr, "top", MENU_ITEMFLAGS_NONE); any.a_int = ALIGN_BOTTOM; - add_menu(tmpwin, &nul_glyphinfo, &any, 'b', 0, ATR_NONE, "bottom", + add_menu(tmpwin, &nul_glyphinfo, &any, 'b', 0, ATR_NONE, clr, "bottom", MENU_ITEMFLAGS_NONE); any.a_int = ALIGN_LEFT; - add_menu(tmpwin, &nul_glyphinfo, &any, 'l', 0, ATR_NONE, "left", + add_menu(tmpwin, &nul_glyphinfo, &any, 'l', 0, ATR_NONE, clr, "left", MENU_ITEMFLAGS_NONE); any.a_int = ALIGN_RIGHT; - add_menu(tmpwin, &nul_glyphinfo, &any, 'r', 0, ATR_NONE, "right", + add_menu(tmpwin, &nul_glyphinfo, &any, 'r', 0, ATR_NONE, clr, "right", MENU_ITEMFLAGS_NONE); Sprintf(abuf, "Select %s window placement relative to the map:", (optidx == opt_align_message) ? "message" : "status"); @@ -4696,6 +4698,7 @@ handler_autounlock(int optidx) char buf[BUFSZ], sep = iflags.menu_tab_sep ? '\t' : ' '; menu_item *window_pick = (menu_item *) 0; int i, n, presel, res = optn_ok; + int clr = 0; tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin, MENU_BEHAVE_STANDARD); @@ -4706,7 +4709,7 @@ handler_autounlock(int optidx) presel = !i ? !flags.autounlock : (flags.autounlock & (1 << (i - 1))); any.a_int = i + 1; add_menu(tmpwin, &nul_glyphinfo, &any, *unlocktypes[i][0], 0, - ATR_NONE, buf, + ATR_NONE, clr, buf, ((presel ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE) | (!i ? MENU_ITEMFLAGS_SKIPINVERT : 0))); } @@ -4769,6 +4772,7 @@ handler_disclose(void) int pick_cnt, pick_idx, opt_idx; char c; menu_item *disclosure_pick = (menu_item *) 0; + int clr = 0; tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin, MENU_BEHAVE_STANDARD); @@ -4778,7 +4782,7 @@ handler_disclose(void) flags.end_disclose[i], disclosure_options[i]); any.a_int = i + 1; add_menu(tmpwin, &nul_glyphinfo, &any, disclosure_options[i], - 0, ATR_NONE, buf, MENU_ITEMFLAGS_NONE); + 0, ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); disc_cat[i] = 0; } end_menu(tmpwin, "Change which disclosure options categories:"); @@ -4804,40 +4808,40 @@ handler_disclose(void) /* 'y','n',and '+' work as alternate selectors; '-' doesn't */ any.a_char = DISCLOSE_NO_WITHOUT_PROMPT; add_menu(tmpwin, &nul_glyphinfo, &any, 0, - any.a_char, ATR_NONE, + any.a_char, ATR_NONE, clr, "Never disclose, without prompting", (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); any.a_char = DISCLOSE_YES_WITHOUT_PROMPT; add_menu(tmpwin, &nul_glyphinfo, &any, 0, - any.a_char, ATR_NONE, + any.a_char, ATR_NONE, clr, "Always disclose, without prompting", (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); if (*disclosure_names[i] == 'v') { any.a_char = DISCLOSE_SPECIAL_WITHOUT_PROMPT; /* '#' */ add_menu(tmpwin, &nul_glyphinfo, &any, 0, - any.a_char, ATR_NONE, + any.a_char, ATR_NONE, clr, "Always disclose, pick sort order from menu", (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } any.a_char = DISCLOSE_PROMPT_DEFAULT_NO; add_menu(tmpwin, &nul_glyphinfo, &any, 0, - any.a_char, ATR_NONE, + any.a_char, ATR_NONE, clr, "Prompt, with default answer of \"No\"", (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); any.a_char = DISCLOSE_PROMPT_DEFAULT_YES; add_menu(tmpwin, &nul_glyphinfo, &any, 0, - any.a_char, ATR_NONE, + any.a_char, ATR_NONE, clr, "Prompt, with default answer of \"Yes\"", (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); if (*disclosure_names[i] == 'v') { any.a_char = DISCLOSE_PROMPT_DEFAULT_SPECIAL; /* '?' */ add_menu(tmpwin, &nul_glyphinfo, &any, 0, - any.a_char, ATR_NONE, + any.a_char, ATR_NONE, clr, "Prompt, with default answer of \"Ask\" to request sort menu", (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); @@ -4877,6 +4881,7 @@ handler_msg_window(void) winid tmpwin; anything any; boolean is_tty = WINDOWPORT("tty"), is_curses = WINDOWPORT("curses"); + int clr = 0; if (is_tty || is_curses) { /* by Christian W. Cooper */ @@ -4896,13 +4901,13 @@ handler_msg_window(void) continue; Sprintf(buf, "%-12.12s%c%.60s", msgwind[i][0], sep, msgwind[i][1]); any.a_char = c = *msgwind[i][0]; - add_menu(tmpwin, &nul_glyphinfo, &any, *buf, 0, ATR_NONE, buf, + add_menu(tmpwin, &nul_glyphinfo, &any, *buf, 0, ATR_NONE, clr, buf, (c == iflags.prevmsg_window) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); /* second line is prefixed by spaces that "c - " would use */ Sprintf(buf, "%4s%-12.12s%c%.60s", "", "", sep, msgwind[i][2]); any.a_char = '\0'; - add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, buf, + add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Select message history display type:"); @@ -4943,6 +4948,7 @@ handler_number_pad(void) "-1 (off, 'z' to move upper-left, 'y' to zap wands)" }; menu_item *mode_pick = (menu_item *) 0; + int clr = 0; tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin, MENU_BEHAVE_STANDARD); @@ -4950,7 +4956,7 @@ handler_number_pad(void) for (i = 0; i < SIZE(npchoices); i++) { any.a_int = i + 1; add_menu(tmpwin, &nul_glyphinfo, &any, 'a' + i, '0' + i, - ATR_NONE, npchoices[i], MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, npchoices[i], MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Select number_pad mode:"); if (select_menu(tmpwin, PICK_ONE, &mode_pick) > 0) { @@ -4996,6 +5002,7 @@ handler_paranoid_confirmation(void) anything any; int i; menu_item *paranoia_picks = (menu_item *) 0; + int clr = 0; tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin, MENU_BEHAVE_STANDARD); @@ -5005,7 +5012,7 @@ handler_paranoid_confirmation(void) continue; any.a_int = paranoia[i].flagmask; add_menu(tmpwin, &nul_glyphinfo, &any, *paranoia[i].argname, - 0, ATR_NONE, paranoia[i].explain, + 0, ATR_NONE, clr, paranoia[i].explain, (flags.paranoia_bits & paranoia[i].flagmask) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); @@ -5036,6 +5043,7 @@ handler_pickup_burden(void) int i; const char *burden_name, *burden_letters = "ubsntl"; menu_item *burden_pick = (menu_item *) 0; + int clr = 0; tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin, MENU_BEHAVE_STANDARD); @@ -5044,7 +5052,7 @@ handler_pickup_burden(void) burden_name = burdentype[i]; any.a_int = i + 1; add_menu(tmpwin, &nul_glyphinfo, &any, burden_letters[i], - 0, ATR_NONE, burden_name, MENU_ITEMFLAGS_NONE); + 0, ATR_NONE, clr, burden_name, MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Select encumbrance level:"); if (select_menu(tmpwin, PICK_ONE, &burden_pick) > 0) { @@ -5073,6 +5081,7 @@ handler_runmode(void) int i; const char *mode_name; menu_item *mode_pick = (menu_item *) 0; + int clr = 0; tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin, MENU_BEHAVE_STANDARD); @@ -5081,7 +5090,7 @@ handler_runmode(void) mode_name = runmodes[i]; any.a_int = i + 1; add_menu(tmpwin, &nul_glyphinfo, &any, *mode_name, - 0, ATR_NONE, mode_name, MENU_ITEMFLAGS_NONE); + 0, ATR_NONE, clr, mode_name, MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Select run/travel display mode:"); if (select_menu(tmpwin, PICK_ONE, &mode_pick) > 0) { @@ -5100,6 +5109,7 @@ handler_sortloot(void) int i, n; const char *sortl_name; menu_item *sortl_pick = (menu_item *) 0; + int clr = 0; tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin, MENU_BEHAVE_STANDARD); @@ -5108,7 +5118,7 @@ handler_sortloot(void) sortl_name = sortltype[i]; any.a_char = *sortl_name; add_menu(tmpwin, &nul_glyphinfo, &any, *sortl_name, - 0, ATR_NONE, + 0, ATR_NONE, clr, sortl_name, (flags.sortloot == *sortl_name) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); @@ -5139,48 +5149,49 @@ handler_whatis_coord(void) menu_item *window_pick = (menu_item *) 0; int pick_cnt; char gp = iflags.getpos_coords; + int clr = 0; tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin, MENU_BEHAVE_STANDARD); any = cg.zeroany; any.a_char = GPCOORDS_COMPASS; add_menu(tmpwin, &nul_glyphinfo, &any, GPCOORDS_COMPASS, - 0, ATR_NONE, + 0, ATR_NONE, clr, "compass ('east' or '3s' or '2n,4w')", (gp == GPCOORDS_COMPASS) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); any.a_char = GPCOORDS_COMFULL; add_menu(tmpwin, &nul_glyphinfo, &any, GPCOORDS_COMFULL, - 0, ATR_NONE, + 0, ATR_NONE, clr, "full compass ('east' or '3south' or '2north,4west')", (gp == GPCOORDS_COMFULL) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); any.a_char = GPCOORDS_MAP; add_menu(tmpwin, &nul_glyphinfo, &any, GPCOORDS_MAP, - 0, ATR_NONE, "map ", + 0, ATR_NONE, clr, "map ", (gp == GPCOORDS_MAP) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); any.a_char = GPCOORDS_SCREEN; add_menu(tmpwin, &nul_glyphinfo, &any, GPCOORDS_SCREEN, - 0, ATR_NONE, "screen [row,column]", + 0, ATR_NONE, clr, "screen [row,column]", (gp == GPCOORDS_SCREEN) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); any.a_char = GPCOORDS_NONE; add_menu(tmpwin, &nul_glyphinfo, &any, GPCOORDS_NONE, - 0, ATR_NONE, "none (no coordinates displayed)", + 0, ATR_NONE, clr, "none (no coordinates displayed)", (gp == GPCOORDS_NONE) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); any.a_long = 0L; - add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, "", MENU_ITEMFLAGS_NONE); Sprintf(buf, "map: upper-left: <%d,%d>, lower-right: <%d,%d>%s", 1, 0, COLNO - 1, ROWNO - 1, Verbose(2, handler_whatis_coord1) ? "; column 0 unused, off left edge" : ""); add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, buf, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); if (strcmp(windowprocs.name, "tty")) /* only show for non-tty */ - add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, "screen: row is offset to accommodate tty interface's use of top line", MENU_ITEMFLAGS_NONE); #if COLNO == 80 @@ -5191,9 +5202,9 @@ handler_whatis_coord(void) Sprintf(buf, "screen: upper-left: [%02d,%02d], lower-right: [%d,%d]%s", 0 + 2, 1, ROWNO - 1 + 2, COLNO - 1, COL80ARG); #undef COL80ARG - add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); - add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, "", MENU_ITEMFLAGS_NONE); end_menu(tmpwin, "Select coordinate display when auto-describing a map position:"); @@ -5217,23 +5228,24 @@ handler_whatis_filter(void) menu_item *window_pick = (menu_item *) 0; int pick_cnt; char gf = iflags.getloc_filter; + int clr = 0; tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin, MENU_BEHAVE_STANDARD); any = cg.zeroany; any.a_char = (GFILTER_NONE + 1); add_menu(tmpwin, &nul_glyphinfo, &any, 'n', - 0, ATR_NONE, "no filtering", + 0, ATR_NONE, clr, "no filtering", (gf == GFILTER_NONE) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); any.a_char = (GFILTER_VIEW + 1); add_menu(tmpwin, &nul_glyphinfo, &any, 'v', - 0, ATR_NONE, "in view only", + 0, ATR_NONE, clr, "in view only", (gf == GFILTER_VIEW) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); any.a_char = (GFILTER_AREA + 1); add_menu(tmpwin, &nul_glyphinfo, &any, 'a', - 0, ATR_NONE, "in same area", + 0, ATR_NONE, clr, "in same area", (gf == GFILTER_AREA) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); end_menu(tmpwin, @@ -5269,6 +5281,7 @@ handler_autopickup_exception(void) int opt_idx, numapes = 0; char apebuf[2 + BUFSZ]; /* so &apebuf[1] is BUFSZ long for getlin() */ struct autopickup_exception *ape; + int clr = 0; ape_again: numapes = count_apes(); @@ -5303,7 +5316,7 @@ handler_autopickup_exception(void) ape = g.apelist; any = cg.zeroany; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, - iflags.menu_headings, + iflags.menu_headings, clr, "Always pickup '<'; never pickup '>'", MENU_ITEMFLAGS_NONE); for (i = 0; i < numapes && ape; i++) { @@ -5313,7 +5326,7 @@ handler_autopickup_exception(void) Sprintf(apebuf, "\"%c%s\"", ape->grab ? '<' : '>', ape->pattern); add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, apebuf, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, apebuf, MENU_ITEMFLAGS_NONE); ape = ape->next; } } @@ -5345,6 +5358,7 @@ handler_menu_colors(void) char buf[BUFSZ]; int opt_idx, nmc, mcclr, mcattr; char mcbuf[BUFSZ]; + int clr = 0; menucolors_again: nmc = count_menucolors(); @@ -5414,7 +5428,7 @@ handler_menu_colors(void) /* combine main string and suffix */ Strcat(mcbuf, &buf[1]); /* skip buf[]'s initial quote */ add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, mcbuf, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, mcbuf, MENU_ITEMFLAGS_NONE); tmp = tmp->next; } Sprintf(mcbuf, "%s menu colors", @@ -5469,6 +5483,7 @@ handler_msgtype(void) const char *mtype; menu_item *pick_list = (menu_item *) 0; struct plinemsg_type *tmp = g.plinemsg_types; + int clr = 0; tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin, MENU_BEHAVE_STANDARD); @@ -5484,7 +5499,7 @@ handler_msgtype(void) else Strcat(strcat(mtbuf, tmp->pattern), "\""); add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, mtbuf, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, mtbuf, MENU_ITEMFLAGS_NONE); tmp = tmp->next; } Sprintf(mtbuf, "%s message types", @@ -5524,20 +5539,21 @@ handler_verbose(int optidx) " verbose_suppressor[%d] =%08X", }; char vbbuf[QBUFSZ]; + int clr = 0; tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin, MENU_BEHAVE_STANDARD); any = cg.zeroany; Snprintf(vbbuf, sizeof vbbuf, vbstrings[0], flags.verbose ? "On" : "Off"); any.a_int = 1; - add_menu(tmpwin, &nul_glyphinfo, &any, 'a', 0, ATR_NONE, + add_menu(tmpwin, &nul_glyphinfo, &any, 'a', 0, ATR_NONE, clr, vbbuf, MENU_ITEMFLAGS_NONE); for (i = 0; i < vb_elements; i++) { Snprintf(vbbuf, sizeof vbbuf, vbstrings[1], i, verbosity_suppressions[i]); any.a_int = i + 2; add_menu(tmpwin, &nul_glyphinfo, &any, 'b' + i, 0, - ATR_NONE, vbbuf, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, vbbuf, MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Select verbosity choices:"); @@ -6714,6 +6730,7 @@ query_color(const char *prompt) anything any; int i, pick_cnt; menu_item *picks = (menu_item *) 0; + int clr = 0; /* replace user patterns with color name ones and force 'menucolors' On */ basic_menu_colors(TRUE); @@ -6726,7 +6743,7 @@ query_color(const char *prompt) break; any.a_int = i + 1; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, colornames[i].name, + ATR_NONE, clr, colornames[i].name, (colornames[i].color == NO_COLOR) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } @@ -6766,6 +6783,7 @@ query_attr(const char *prompt) menu_item *picks = (menu_item *) 0; boolean allow_many = (prompt && !strncmpi(prompt, "Choose", 6)); int default_attr = ATR_NONE; + int clr = 0; if (prompt && strstri(prompt, "menu headings")) default_attr = iflags.menu_headings; @@ -6777,7 +6795,7 @@ query_attr(const char *prompt) break; any.a_int = i + 1; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, - attrnames[i].attr, attrnames[i].name, + attrnames[i].attr, clr, attrnames[i].name, (attrnames[i].attr == default_attr) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } @@ -6866,6 +6884,7 @@ query_msgtype(void) anything any; int i, pick_cnt; menu_item *picks = (menu_item *) 0; + int clr = 0; tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin, MENU_BEHAVE_STANDARD); @@ -6874,7 +6893,8 @@ query_msgtype(void) if (msgtype_names[i].descr) { any.a_int = msgtype_names[i].msgtyp + 1; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, msgtype_names[i].descr, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, + msgtype_names[i].descr, MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "How to show the message"); pick_cnt = select_menu(tmpwin, PICK_ONE, &picks); @@ -7705,6 +7725,7 @@ doset(void) /* changing options via menu by Per Liboriussen */ int indexoffset, startpass, endpass; boolean setinitial = FALSE, fromfile = FALSE, gavehelp = FALSE, skiphelp = !iflags.cmdassist; + int clr = 0; /* if we offer '?' as a choice and it is the only thing chosen, we'll end up coming back here after showing the explanatory text */ @@ -7727,12 +7748,12 @@ doset(void) /* changing options via menu by Per Liboriussen */ if (helptext[i]) { Sprintf(buf, "%4s%.75s", "", helptext[i]); any.a_int = 0; - add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, FALSE, + add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, FALSE, clr, buf, MENU_ITEMFLAGS_NONE); } else { any.a_int = '?' + 1; /* processing pick_list subtracts 1 */ add_menu(tmpwin, &nul_glyphinfo, &any, '?', '?', ATR_NONE, - "view help for options menu", + clr, "view help for options menu", MENU_ITEMFLAGS_SKIPINVERT); } } @@ -7756,7 +7777,7 @@ doset(void) /* changing options via menu by Per Liboriussen */ indexoffset = 1; any = cg.zeroany; - add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, iflags.menu_headings, + add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, iflags.menu_headings, clr, "Booleans (selecting will toggle value):", MENU_ITEMFLAGS_NONE); any.a_int = 0; /* first list any other non-modifiable booleans, then modifiable ones */ @@ -7784,12 +7805,12 @@ doset(void) /* changing options via menu by Per Liboriussen */ if (pass == 0) enhance_menu_text(buf, sizeof buf, pass, bool_p, &allopt[i]); add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, buf, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); } any = cg.zeroany; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, "", MENU_ITEMFLAGS_NONE); - add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, iflags.menu_headings, + ATR_NONE, clr, "", MENU_ITEMFLAGS_NONE); + add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, iflags.menu_headings, clr, "Compounds (selecting will prompt for new value):", MENU_ITEMFLAGS_NONE); @@ -7821,9 +7842,10 @@ doset(void) /* changing options via menu by Per Liboriussen */ any = cg.zeroany; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, "", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "", MENU_ITEMFLAGS_NONE); add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, - iflags.menu_headings, "Other settings:", MENU_ITEMFLAGS_NONE); + iflags.menu_headings, clr, + "Other settings:", MENU_ITEMFLAGS_NONE); for (pass = startpass; pass <= endpass; pass++) for (i = 0; (name = allopt[i].name) != 0; i++) { @@ -7842,9 +7864,9 @@ doset(void) /* changing options via menu by Per Liboriussen */ #ifdef PREFIXES_IN_USE any = cg.zeroany; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, "", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "", MENU_ITEMFLAGS_NONE); add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, - iflags.menu_headings, + iflags.menu_headings, clr, "Variable playground locations:", MENU_ITEMFLAGS_NONE); for (i = 0; i < PREFIX_COUNT; i++) doset_add_menu(tmpwin, fqn_prefix_names[i], -1, 0); @@ -7943,6 +7965,7 @@ doset_add_menu(winid win, /* window to add to */ #ifdef PREFIXES_IN_USE int j; #endif + int clr = 0; buf2[0] = '\0'; /* per opt functs may not guarantee this, so do it */ any = cg.zeroany; @@ -7975,7 +7998,7 @@ doset_add_menu(winid win, /* window to add to */ else Sprintf(buf, fmtstr_doset_tab, option, value); add_menu(win, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, buf, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); } @@ -8134,6 +8157,7 @@ handle_add_list_remove(const char *optname, int numtotal) { 'r', "remove existing %s" }, /* [2] */ { 'x', "exit this menu" }, /* [3] */ }; + int clr = 0; opt_idx = 0; tmpwin = create_nhwindow(NHW_MENU); @@ -8149,7 +8173,7 @@ handle_add_list_remove(const char *optname, int numtotal) Sprintf(tmpbuf, action_titles[i].desc, (i == 1) ? makeplural(optname) : optname); add_menu(tmpwin, &nul_glyphinfo,&any, action_titles[i].letr, - 0, ATR_NONE, tmpbuf, + 0, ATR_NONE, clr, tmpbuf, (i == 3) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Do what?"); @@ -8504,6 +8528,7 @@ choose_classes_menu(const char *prompt, int i, n; int ret; int next_accelerator, accelerator; + int clr = 0; if (class_list == (char *) 0 || class_select == (char *) 0) return 0; @@ -8539,7 +8564,7 @@ choose_classes_menu(const char *prompt, } any.a_int = *class_list; add_menu(win, &nul_glyphinfo, &any, accelerator, - category ? *class_list : 0, ATR_NONE, buf, + category ? *class_list : 0, ATR_NONE, clr, buf, selected ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); ++class_list; if (category > 0) { @@ -8554,14 +8579,14 @@ choose_classes_menu(const char *prompt, /* for objects, add "A - ' ' all classes", after a separator */ any = cg.zeroany; add_menu(win, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, "", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "", MENU_ITEMFLAGS_NONE); any.a_int = (int) ' '; Sprintf(buf, "%c %s", (char) any.a_int, "all classes of objects"); /* we won't preselect this even if the incoming list is empty; having it selected means that it would have to be explicitly de-selected in order to select anything else */ add_menu(win, &nul_glyphinfo, &any, 'A', 0, - ATR_NONE, buf, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); } end_menu(win, prompt); n = select_menu(win, way ? PICK_ANY : PICK_ONE, &pick_list); diff --git a/src/pager.c b/src/pager.c index b1c50873f..c7c99d31e 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1412,6 +1412,7 @@ do_look(int mode, coord *click_cc) coord cc; /* screen pos of unknown glyph */ boolean save_verbose; /* saved value of flags.verbose */ boolean from_screen; /* question from the screen */ + int clr = 0; cc.x = 0; cc.y = 0; @@ -1433,20 +1434,20 @@ do_look(int mode, coord *click_cc) versions: "Specify unknown object by cursor?" */ add_menu(win, &nul_glyphinfo, &any, flags.lootabc ? 0 : any.a_char, 'y', ATR_NONE, - "something on the map", MENU_ITEMFLAGS_NONE); + clr, "something on the map", MENU_ITEMFLAGS_NONE); any.a_char = 'i'; add_menu(win, &nul_glyphinfo, &any, flags.lootabc ? 0 : any.a_char, 0, ATR_NONE, - "something you're carrying", MENU_ITEMFLAGS_NONE); + clr, "something you're carrying", MENU_ITEMFLAGS_NONE); any.a_char = '?'; add_menu(win, &nul_glyphinfo, &any, flags.lootabc ? 0 : any.a_char, 'n', ATR_NONE, - "something else (by symbol or name)", + clr, "something else (by symbol or name)", MENU_ITEMFLAGS_NONE); if (!u.uswallow && !Hallucination) { any = cg.zeroany; add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - "", MENU_ITEMFLAGS_NONE); + clr, "", MENU_ITEMFLAGS_NONE); /* these options work sensibly for the swallowed case, but there's no reason for the player to use them then; objects work fine when hallucinating, but screen @@ -1455,27 +1456,28 @@ do_look(int mode, coord *click_cc) any.a_char = 'm'; add_menu(win, &nul_glyphinfo, &any, flags.lootabc ? 0 : any.a_char, 0, ATR_NONE, - "nearby monsters", MENU_ITEMFLAGS_NONE); + clr, "nearby monsters", MENU_ITEMFLAGS_NONE); any.a_char = 'M'; add_menu(win, &nul_glyphinfo, &any, flags.lootabc ? 0 : any.a_char, 0, ATR_NONE, - "all monsters shown on map", MENU_ITEMFLAGS_NONE); + clr, "all monsters shown on map", MENU_ITEMFLAGS_NONE); any.a_char = 'o'; add_menu(win, &nul_glyphinfo, &any, flags.lootabc ? 0 : any.a_char, 0, ATR_NONE, - "nearby objects", MENU_ITEMFLAGS_NONE); + clr, "nearby objects", MENU_ITEMFLAGS_NONE); any.a_char = 'O'; add_menu(win, &nul_glyphinfo, &any, flags.lootabc ? 0 : any.a_char, 0, ATR_NONE, - "all objects shown on map", MENU_ITEMFLAGS_NONE); + clr, "all objects shown on map", MENU_ITEMFLAGS_NONE); any.a_char = '^'; add_menu(win, &nul_glyphinfo, &any, flags.lootabc ? 0 : any.a_char, 0, ATR_NONE, - "nearby traps", MENU_ITEMFLAGS_NONE); + clr, "nearby traps", MENU_ITEMFLAGS_NONE); any.a_char = '\"'; add_menu(win, &nul_glyphinfo, &any, flags.lootabc ? 0 : any.a_char, 0, ATR_NONE, - "all seen or remembered traps", MENU_ITEMFLAGS_NONE); + clr, "all seen or remembered traps", + MENU_ITEMFLAGS_NONE); } end_menu(win, "What do you want to look at:"); if (select_menu(win, PICK_ONE, &pick_list) > 0) { @@ -2418,6 +2420,7 @@ dohelp(void) menu_item *selected; anything any; int sel; + int clr = 0; any = cg.zeroany; /* zero all bits */ start_menu(tmpwin, MENU_BEHAVE_STANDARD); @@ -2433,7 +2436,7 @@ dohelp(void) Strcpy(helpbuf, help_menu_items[i].text); } any.a_int = i + 1; - add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, helpbuf, MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Select one item:"); diff --git a/src/pickup.c b/src/pickup.c index 2a716549d..4d1efe517 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -955,6 +955,7 @@ query_objlist(const char *qstr, /* query string */ unsigned sortflags; glyph_info tmpglyphinfo = nul_glyphinfo; Loot *sortedolist, *srtoli; + int clr = 0; *pick_list = (menu_item *) 0; if (!olist && !engulfer) @@ -1005,7 +1006,7 @@ query_objlist(const char *qstr, /* query string */ /* dotypeinv() supplies g.this_title to display as initial header; intentionally avoid the menu_headings highlight attribute here */ add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - g.this_title, MENU_ITEMFLAGS_NONE); + clr, g.this_title, MENU_ITEMFLAGS_NONE); } /* * Run through the list and add the objects to the menu. If @@ -1034,7 +1035,7 @@ query_objlist(const char *qstr, /* query string */ if (sorted && !printed_type_name) { any = cg.zeroany; add_menu(win, &nul_glyphinfo, &any, 0, 0, - iflags.menu_headings, + iflags.menu_headings, clr, let_to_name(*pack, FALSE, ((how != PICK_NONE) && iflags.menu_head_objsym)), @@ -1049,7 +1050,7 @@ query_objlist(const char *qstr, /* query string */ (qflags & USE_INVLET) ? curr->invlet : (first && curr->oclass == COIN_CLASS) ? '$' : 0, def_oc_syms[(int) objects[curr->otyp].oc_class].sym, - ATR_NONE, doname_with_price(curr), + ATR_NONE, clr, doname_with_price(curr), MENU_ITEMFLAGS_NONE); first = FALSE; } @@ -1066,7 +1067,7 @@ query_objlist(const char *qstr, /* query string */ Sprintf(buf, "%s Creatures", is_animal(u.ustuck->data) ? "Swallowed" : "Engulfed"); add_menu(win, &nul_glyphinfo, &any, 0, 0, iflags.menu_headings, - buf, MENU_ITEMFLAGS_NONE); + clr, buf, MENU_ITEMFLAGS_NONE); } fake_hero_object = cg.zeroobj; fake_hero_object.quan = 1L; /* not strictly necessary... */ @@ -1075,7 +1076,7 @@ query_objlist(const char *qstr, /* query string */ map_glyphinfo(0, 0, tmpglyph, 0U, &tmpglyphinfo); add_menu(win, &tmpglyphinfo, &any, /* fake inventory letter, no group accelerator */ - CONTAINED_SYM, 0, ATR_NONE, an(self_lookat(buf)), + CONTAINED_SYM, 0, ATR_NONE, clr, an(self_lookat(buf)), MENU_ITEMFLAGS_NONE); } @@ -1157,6 +1158,7 @@ query_category(const char *qstr, /* query string */ int num_buc_types = 0; unsigned itemflags = MENU_ITEMFLAGS_NONE; int num_justpicked = 0; + int clr = 0; *pick_list = (menu_item *) 0; if (!olist) @@ -1218,14 +1220,14 @@ query_category(const char *qstr, /* query string */ any = cg.zeroany; any.a_int = 'A'; itemflags = MENU_ITEMFLAGS_SKIPINVERT; - add_menu(win, &nul_glyphinfo, &any, invlet, 0, ATR_NONE, + add_menu(win, &nul_glyphinfo, &any, invlet, 0, ATR_NONE, clr, (qflags & WORN_TYPES) ? "Auto-select every item being worn" : "Auto-select every relevant item", itemflags); any = cg.zeroany; add_menu(win, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, "", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "", MENU_ITEMFLAGS_NONE); } if ((qflags & ALL_TYPES) && (ccount > 1)) { @@ -1233,7 +1235,7 @@ query_category(const char *qstr, /* query string */ any = cg.zeroany; any.a_int = ALL_TYPES_SELECTED; itemflags = MENU_ITEMFLAGS_SKIPINVERT; - add_menu(win, &nul_glyphinfo, &any, invlet, 0, ATR_NONE, + add_menu(win, &nul_glyphinfo, &any, invlet, 0, ATR_NONE, clr, (qflags & WORN_TYPES) ? "All worn types" : "All types", itemflags); invlet = 'b'; @@ -1251,9 +1253,9 @@ query_category(const char *qstr, /* query string */ add_menu( win, &nul_glyphinfo, &any, invlet++, def_oc_syms[(int) objects[curr->otyp].oc_class].sym, - ATR_NONE, let_to_name(*pack, FALSE, - (how != PICK_NONE) - && iflags.menu_head_objsym), + ATR_NONE, clr, let_to_name(*pack, FALSE, + (how != PICK_NONE) + && iflags.menu_head_objsym), MENU_ITEMFLAGS_NONE); collected_type_name = TRUE; } @@ -1271,7 +1273,7 @@ query_category(const char *qstr, /* query string */ || do_uncursed || do_buc_unknown) { any = cg.zeroany; add_menu(win, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, "", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "", MENU_ITEMFLAGS_NONE); } /* unpaid items if there are any */ @@ -1280,14 +1282,14 @@ query_category(const char *qstr, /* query string */ any = cg.zeroany; any.a_int = 'u'; add_menu(win, &nul_glyphinfo, &any, invlet, 0, - ATR_NONE, "Unpaid items", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "Unpaid items", MENU_ITEMFLAGS_NONE); } /* billed items: checked by caller, so always include if BILLED_TYPES */ if (qflags & BILLED_TYPES) { invlet = 'x'; any = cg.zeroany; any.a_int = 'x'; - add_menu(win, &nul_glyphinfo, &any, invlet, 0, ATR_NONE, + add_menu(win, &nul_glyphinfo, &any, invlet, 0, ATR_NONE, clr, "Unpaid items already used up", MENU_ITEMFLAGS_NONE); } @@ -1300,28 +1302,28 @@ query_category(const char *qstr, /* query string */ any = cg.zeroany; any.a_int = 'B'; add_menu(win, &nul_glyphinfo, &any, invlet, 0, ATR_NONE, - "Items known to be Blessed", itemflags); + clr, "Items known to be Blessed", itemflags); } if (do_cursed) { invlet = 'C'; any = cg.zeroany; any.a_int = 'C'; add_menu(win, &nul_glyphinfo, &any, invlet, 0, ATR_NONE, - "Items known to be Cursed", itemflags); + clr, "Items known to be Cursed", itemflags); } if (do_uncursed) { invlet = 'U'; any = cg.zeroany; any.a_int = 'U'; add_menu(win, &nul_glyphinfo, &any, invlet, 0, ATR_NONE, - "Items known to be Uncursed", itemflags); + clr, "Items known to be Uncursed", itemflags); } if (do_buc_unknown) { invlet = 'X'; any = cg.zeroany; any.a_int = 'X'; add_menu(win, &nul_glyphinfo, &any, invlet, 0, ATR_NONE, - "Items of unknown Bless/Curse status", itemflags); + clr, "Items of unknown Bless/Curse status", itemflags); } if (num_justpicked) { char tmpbuf[BUFSZ]; @@ -1335,7 +1337,7 @@ query_category(const char *qstr, /* query string */ any = cg.zeroany; any.a_int = 'P'; add_menu(win, &nul_glyphinfo, &any, invlet, 0, ATR_NONE, - tmpbuf, itemflags); + clr, tmpbuf, itemflags); } end_menu(win, qstr); n = select_menu(win, how, pick_list); @@ -1983,6 +1985,7 @@ doloot_core(void) int prev_inquiry = 0; boolean prev_loot = FALSE; int num_conts = 0; + int clr = 0; g.abort_looting = FALSE; @@ -2045,7 +2048,7 @@ doloot_core(void) if (Is_container(cobj)) { any.a_obj = cobj; add_menu(win, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, doname(cobj), MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, doname(cobj), MENU_ITEMFLAGS_NONE); } end_menu(win, "Loot which containers?"); n = select_menu(win, PICK_ANY, &pick_list); @@ -3174,6 +3177,7 @@ in_or_out_menu( char buf[BUFSZ]; int n; const char *menuselector = flags.lootabc ? abc_chars : lootchars; + int clr = 0; any = cg.zeroany; win = create_nhwindow(NHW_MENU); @@ -3182,48 +3186,48 @@ in_or_out_menu( any.a_int = 1; /* ':' */ Sprintf(buf, "Look inside %s", thesimpleoname(obj)); add_menu(win, &nul_glyphinfo, &any, menuselector[any.a_int], 0, - ATR_NONE, buf, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); if (outokay) { any.a_int = 2; /* 'o' */ Sprintf(buf, "take %s out", something); add_menu(win, &nul_glyphinfo, &any, menuselector[any.a_int], 0, - ATR_NONE, buf, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); } if (inokay) { any.a_int = 3; /* 'i' */ Sprintf(buf, "put %s in", something); add_menu(win, &nul_glyphinfo, &any, menuselector[any.a_int], 0, - ATR_NONE, buf, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); } if (outokay) { any.a_int = 4; /* 'b' */ Sprintf(buf, "%stake out, then put in", inokay ? "both; " : ""); add_menu(win, &nul_glyphinfo, &any, menuselector[any.a_int], 0, - ATR_NONE, buf, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); } if (inokay) { any.a_int = 5; /* 'r' */ Sprintf(buf, "%sput in, then take out", outokay ? "both reversed; " : ""); add_menu(win, &nul_glyphinfo, &any, menuselector[any.a_int], 0, - ATR_NONE, buf, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); any.a_int = 6; /* 's' */ Sprintf(buf, "stash one item into %s", thesimpleoname(obj)); add_menu(win, &nul_glyphinfo, &any, menuselector[any.a_int], 0, - ATR_NONE, buf, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); } any.a_int = 0; add_menu(win, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, "", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "", MENU_ITEMFLAGS_NONE); if (more_containers) { any.a_int = 7; /* 'n' */ add_menu(win, &nul_glyphinfo, &any, menuselector[any.a_int], 0, - ATR_NONE, "loot next container", MENU_ITEMFLAGS_SELECTED); + ATR_NONE, clr, "loot next container", MENU_ITEMFLAGS_SELECTED); } any.a_int = 8; /* 'q' */ Strcpy(buf, alreadyused ? "done" : "do nothing"); add_menu(win, &nul_glyphinfo, &any, menuselector[any.a_int], 0, - ATR_NONE, buf, + ATR_NONE, clr, buf, more_containers ? MENU_ITEMFLAGS_NONE : MENU_ITEMFLAGS_SELECTED); end_menu(win, prompt); @@ -3292,6 +3296,7 @@ dotip(void) anything any; menu_item *pick_list = (menu_item *) 0; struct obj dummyobj, *otmp; + int clr = 0; any = cg.zeroany; win = create_nhwindow(NHW_MENU); @@ -3302,19 +3307,19 @@ dotip(void) if (Is_container(cobj)) { ++i; any.a_obj = cobj; - add_menu(win, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, doname(cobj), MENU_ITEMFLAGS_NONE); + add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + clr, doname(cobj), MENU_ITEMFLAGS_NONE); } if (g.invent) { any = cg.zeroany; add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - "", MENU_ITEMFLAGS_NONE); + clr, "", MENU_ITEMFLAGS_NONE); any.a_obj = &dummyobj; /* use 'i' for inventory unless there are so many containers that it's already being used */ i = (i <= 'i' - 'a' && !flags.lootabc) ? 'i' : 0; add_menu(win, &nul_glyphinfo, &any, i, 0, ATR_NONE, - "tip something being carried", + clr, "tip something being carried", MENU_ITEMFLAGS_SELECTED); } end_menu(win, "Tip which container?"); @@ -3566,6 +3571,7 @@ tipcontainer_gettarget(struct obj *box, boolean *cancelled) menu_item *pick_list = (menu_item *) 0; struct obj dummyobj, *otmp; int n_conts = count_containers(g.invent); + int clr = 0; /* we're carrying the box, don't count it as possible target */ if (box->where == OBJ_INVENT) @@ -3583,18 +3589,18 @@ tipcontainer_gettarget(struct obj *box, boolean *cancelled) any = cg.zeroany; any.a_obj = &dummyobj; add_menu(win, &nul_glyphinfo, &any, '-', 0, ATR_NONE, - "on the floor", MENU_ITEMFLAGS_SELECTED); + clr, "on the floor", MENU_ITEMFLAGS_SELECTED); any = cg.zeroany; add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - "", MENU_ITEMFLAGS_NONE); + clr, "", MENU_ITEMFLAGS_NONE); for (otmp = g.invent; otmp; otmp = otmp->nobj) if (Is_container(otmp) && (otmp != box)) { any = cg.zeroany; any.a_obj = otmp; add_menu(win, &nul_glyphinfo, &any, otmp->invlet, 0, - ATR_NONE, doname(otmp), MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, doname(otmp), MENU_ITEMFLAGS_NONE); } Sprintf(buf, "Where to tip the contents of %s", doname(box)); diff --git a/src/restore.c b/src/restore.c index 1652a3d7e..cb4ec066f 100644 --- a/src/restore.c +++ b/src/restore.c @@ -1392,6 +1392,7 @@ restore_menu( char **saved; menu_item *chosen_game = (menu_item *) 0; int k, clet, ch = 0; /* ch: 0 => new game */ + int clr = 0; *g.plname = '\0'; saved = get_saved_games(); /* array of character names */ @@ -1405,25 +1406,25 @@ restore_menu( /* COPYRIGHT_BANNER_[ABCD] */ for (k = 1; k <= 4; ++k) add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - copyright_banner_line(k), MENU_ITEMFLAGS_NONE); - add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, "", + clr, copyright_banner_line(k), MENU_ITEMFLAGS_NONE); + add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, "", MENU_ITEMFLAGS_NONE); } add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - "Select one of your saved games", MENU_ITEMFLAGS_NONE); + clr, "Select one of your saved games", MENU_ITEMFLAGS_NONE); for (k = 0; saved[k]; ++k) { any.a_int = k + 1; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, saved[k], MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, saved[k], MENU_ITEMFLAGS_NONE); } clet = (k <= 'n' - 'a') ? 'n' : 0; /* new game */ any.a_int = -1; /* not >= 0 */ add_menu(tmpwin, &nul_glyphinfo, &any, clet, 0, ATR_NONE, - "Start a new character", MENU_ITEMFLAGS_NONE); + clr, "Start a new character", MENU_ITEMFLAGS_NONE); clet = (k + 1 <= 'q' - 'a') ? 'q' : 0; /* quit */ any.a_int = -2; add_menu(tmpwin, &nul_glyphinfo, &any, clet, 0, ATR_NONE, - "Never mind (quit)", MENU_ITEMFLAGS_SELECTED); + clr, "Never mind (quit)", MENU_ITEMFLAGS_SELECTED); /* no prompt on end_menu, as we've done our own at the top */ end_menu(tmpwin, (char *) 0); if (select_menu(tmpwin, PICK_ONE, &chosen_game) > 0) { diff --git a/src/role.c b/src/role.c index a5efc9155..6cc00c578 100644 --- a/src/role.c +++ b/src/role.c @@ -1749,6 +1749,7 @@ role_menu_extra(int which, winid where, boolean preselect) char buf[BUFSZ]; const char *what = 0, *constrainer = 0, *forcedvalue = 0; int f = 0, r, c, gend, a, i, allowmask; + int clr = 0; r = flags.initrole; c = flags.initrace; @@ -1852,13 +1853,13 @@ role_menu_extra(int which, winid where, boolean preselect) any.a_int = 0; /* use four spaces of padding to fake a grayed out menu choice */ Sprintf(buf, "%4s%s forces %s", "", constrainer, forcedvalue); - add_menu(where, &nul_glyphinfo, &any, 0, 0, ATR_NONE, buf, + add_menu(where, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); } else if (what) { any.a_int = RS_menu_arg(which); Sprintf(buf, "Pick%s %s first", (f >= 0) ? " another" : "", what); add_menu(where, &nul_glyphinfo, &any, RS_menu_let[which], 0, - ATR_NONE, buf, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); } else if (which == RS_filter) { char setfiltering[40]; @@ -1866,16 +1867,16 @@ role_menu_extra(int which, winid where, boolean preselect) Sprintf(setfiltering, "%s role/race/&c filtering", gotrolefilter() ? "Reset" : "Set"); add_menu(where, &nul_glyphinfo, &any, '~', 0, ATR_NONE, - setfiltering, MENU_ITEMFLAGS_NONE); + clr, setfiltering, MENU_ITEMFLAGS_NONE); } else if (which == ROLE_RANDOM) { any.a_int = ROLE_RANDOM; add_menu(where, &nul_glyphinfo, &any, '*', 0, - ATR_NONE, "Random", + ATR_NONE, clr, "Random", preselect ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } else if (which == ROLE_NONE) { any.a_int = ROLE_NONE; add_menu(where, &nul_glyphinfo, &any, 'q', 0, - ATR_NONE, "Quit", + ATR_NONE, clr, "Quit", preselect ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } else { impossible("role_menu_extra: bad arg (%d)", which); diff --git a/src/spell.c b/src/spell.c index 690496073..4b8079bc5 100644 --- a/src/spell.c +++ b/src/spell.c @@ -1583,6 +1583,7 @@ spellsortmenu(void) anything any; char let; int i, n, choice; + int clr = 0; tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin, MENU_BEHAVE_STANDARD); @@ -1594,13 +1595,13 @@ spellsortmenu(void) /* separate final choice from others with a blank line */ any.a_int = 0; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, "", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "", MENU_ITEMFLAGS_NONE); } else { let = 'a' + i; } any.a_int = i + 1; add_menu(tmpwin, &nul_glyphinfo, &any, let, 0, - ATR_NONE, spl_sortchoices[i], + ATR_NONE, clr, spl_sortchoices[i], (i == g.spl_sortmode) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "View known spells list sorted"); @@ -1672,6 +1673,7 @@ dospellmenu( const char *fmt; menu_item *selected; anything any; + int clr = 0; tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin, MENU_BEHAVE_STANDARD); @@ -1698,7 +1700,7 @@ dospellmenu( Sprintf(eos(buf), "%c%6s", sep, "turns"); add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, - iflags.menu_headings, buf, MENU_ITEMFLAGS_NONE); + iflags.menu_headings, clr, buf, MENU_ITEMFLAGS_NONE); for (i = 0; i < MAXSPELL && spellid(i) != NO_SPELL; i++) { splnum = !g.spl_orderindx ? i : g.spl_orderindx[i]; Sprintf(buf, fmt, spellname(splnum), spellev(splnum), @@ -1710,7 +1712,7 @@ dospellmenu( any.a_int = splnum + 1; /* must be non-zero */ add_menu(tmpwin, &nul_glyphinfo, &any, spellet(splnum), 0, - ATR_NONE, buf, + ATR_NONE, clr, buf, (splnum == splaction) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } @@ -1723,7 +1725,7 @@ dospellmenu( /* more than 1 spell, add an extra menu entry */ any.a_int = SPELLMENU_SORT + 1; add_menu(tmpwin, &nul_glyphinfo, &any, '+', 0, - ATR_NONE, "[sort spells]", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "[sort spells]", MENU_ITEMFLAGS_NONE); } } end_menu(tmpwin, prompt); diff --git a/src/symbols.c b/src/symbols.c index 599138b11..bec0e7503 100644 --- a/src/symbols.c +++ b/src/symbols.c @@ -787,6 +787,7 @@ do_symset(boolean rogueflag) char *symset_name, fmtstr[20]; struct symsetentry *sl; int res, which_set, setcount = 0, chosen = -2, defindx = 0; + int clr = 0; which_set = rogueflag ? ROGUESET : PRIMARYSET; g.symset_list = (struct symsetentry *) 0; @@ -838,7 +839,7 @@ do_symset(boolean rogueflag) if (!symset_name) defindx = any.a_int; add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - "Default Symbols", + clr, "Default Symbols", (any.a_int == defindx) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); @@ -863,7 +864,7 @@ do_symset(boolean rogueflag) defindx = any.a_int; Sprintf(buf, fmtstr, sl->name, sl->desc ? sl->desc : ""); add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, buf, + ATR_NONE, clr, buf, (any.a_int == defindx) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } diff --git a/src/teleport.c b/src/teleport.c index 5f796e449..2ca62ab65 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -661,7 +661,7 @@ dotelecmd(void) menu_item *picks = (menu_item *) 0; anything any; winid win; - int i, tmode; + int i, tmode, clr = 0; win = create_nhwindow(NHW_MENU); start_menu(win, MENU_BEHAVE_STANDARD); @@ -669,7 +669,7 @@ dotelecmd(void) for (i = 0; i < SIZE(tports); ++i) { any.a_int = (int) tports[i].menulet; add_menu(win, &nul_glyphinfo, &any, (char) any.a_int, 0, - ATR_NONE, tports[i].menudesc, + ATR_NONE, clr, tports[i].menudesc, (tports[i].menulet == 'w') ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } diff --git a/src/weapon.c b/src/weapon.c index ab41e1fd0..d5132127f 100644 --- a/src/weapon.c +++ b/src/weapon.c @@ -1161,6 +1161,7 @@ enhance_weapon_skill(void) anything any; winid win; boolean speedy = FALSE; + int clr = 0; /* player knows about #enhance, don't show tip anymore */ g.context.enhance_tip = TRUE; @@ -1198,17 +1199,17 @@ enhance_weapon_skill(void) ? "when you're more experienced" : "if skill slots become available"); add_menu(win, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, buf, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); } if (maxxed_cnt > 0) { Sprintf(buf, "(Skill%s flagged by \"#\" cannot be enhanced any further.)", plur(maxxed_cnt)); add_menu(win, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, buf, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); } add_menu(win, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, "", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "", MENU_ITEMFLAGS_NONE); } /* List the skills, making ones that could be advanced @@ -1222,7 +1223,7 @@ enhance_weapon_skill(void) any = cg.zeroany; if (i == skill_ranges[pass].first) add_menu(win, &nul_glyphinfo, &any, 0, 0, - iflags.menu_headings, + iflags.menu_headings, clr, skill_ranges[pass].name, MENU_ITEMFLAGS_NONE); if (P_RESTRICTED(i)) @@ -1265,7 +1266,7 @@ enhance_weapon_skill(void) } any.a_int = can_advance(i, speedy) ? i + 1 : 0; add_menu(win, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, buf, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); } Strcpy(buf, (to_advance > 0) ? "Pick a skill to advance:" diff --git a/src/windows.c b/src/windows.c index 863b368a8..06a02b414 100644 --- a/src/windows.c +++ b/src/windows.c @@ -71,7 +71,7 @@ static void dump_display_nhwindow(winid, boolean); static void dump_destroy_nhwindow(winid); static void dump_start_menu(winid, unsigned long); static void dump_add_menu(winid, const glyph_info *, const ANY_P *, char, - char, int, const char *, unsigned int); + char, int, int, const char *, unsigned int); static void dump_end_menu(winid, const char *); static int dump_select_menu(winid, int, MENU_ITEM_P **); static void dump_putstr(winid, int, const char *); @@ -508,7 +508,7 @@ static void hup_exit_nhwindows(const char *); static winid hup_create_nhwindow(int); static int hup_select_menu(winid, int, MENU_ITEM_P **); static void hup_add_menu(winid, const glyph_info *, const anything *, char, - char, int, const char *, unsigned int); + char, int, int, const char *, unsigned int); static void hup_end_menu(winid, const char *); static void hup_putstr(winid, int, const char *); static void hup_print_glyph(winid, xchar, xchar, const glyph_info *, @@ -694,6 +694,7 @@ hup_add_menu(winid window UNUSED, char sel UNUSED, char grpsel UNUSED, int attr UNUSED, + int clr UNUSED, const char *txt UNUSED, unsigned int itemflags UNUSED) { @@ -1298,6 +1299,7 @@ dump_add_menu(winid win UNUSED, char ch, char gch UNUSED, int attr UNUSED, + int clr UNUSED, const char *str, unsigned int itemflags UNUSED) { diff --git a/sys/windows/consoletty.c b/sys/windows/consoletty.c index bc2927e44..7dbcfe032 100644 --- a/sys/windows/consoletty.c +++ b/sys/windows/consoletty.c @@ -2785,7 +2785,7 @@ set_keyhandling_via_option(void) { winid tmpwin; anything any; - int i; + int i, clr = 0; menu_item *console_key_handling_pick = (menu_item *) 0; tmpwin = create_nhwindow(NHW_MENU); @@ -2794,7 +2794,7 @@ set_keyhandling_via_option(void) for (i = default_keyhandling; i < SIZE(legal_key_handling); i++) { any.a_int = i + 1; add_menu(tmpwin, &nul_glyphinfo, &any, 'a' + i, - 0, ATR_NONE, + 0, ATR_NONE, clr, legal_key_handling[i], MENU_ITEMFLAGS_NONE); } end_menu(tmpwin, "Select windows console key handling:"); diff --git a/win/Qt/qt_bind.cpp b/win/Qt/qt_bind.cpp index 07229b6d3..cdc631b52 100644 --- a/win/Qt/qt_bind.cpp +++ b/win/Qt/qt_bind.cpp @@ -458,7 +458,7 @@ void NetHackQtBind::qt_start_menu(winid wid, unsigned long mbehavior UNUSED) } void NetHackQtBind::qt_add_menu(winid wid, const glyph_info *glyphinfo, - const ANY_P * identifier, char ch, char gch, int attr, + const ANY_P * identifier, char ch, char gch, int attr, int clr UNUSED, const char *str, unsigned itemflags) { NetHackQtWindow* window=id_to_window[(int)wid]; diff --git a/win/Qt/qt_bind.h b/win/Qt/qt_bind.h index 112da9f0d..5a6396014 100644 --- a/win/Qt/qt_bind.h +++ b/win/Qt/qt_bind.h @@ -54,7 +54,7 @@ public: static void qt_display_file(const char *filename, boolean must_exist); static void qt_start_menu(winid wid, unsigned long mbehavior); static void qt_add_menu(winid wid, const glyph_info *glyphinfo, - const ANY_P * identifier, char ch, char gch, int attr, + const ANY_P * identifier, char ch, char gch, int attr, int clr, const char *str, unsigned int itemflags); static void qt_end_menu(winid wid, const char *prompt); static int qt_select_menu(winid wid, int how, MENU_ITEM_P **menu_list); diff --git a/win/X11/winX.c b/win/X11/winX.c index 12e605b2b..6084c6b26 100644 --- a/win/X11/winX.c +++ b/win/X11/winX.c @@ -2011,6 +2011,7 @@ X11_display_file(const char *str, boolean complain) menu_item *menu_list; #define LLEN 128 char line[LLEN]; + int clr = 0; /* Use the port-independent file opener to see if the file exists. */ fp = dlb_fopen(str, RDTMODE); @@ -2027,7 +2028,7 @@ X11_display_file(const char *str, boolean complain) any = cg.zeroany; while (dlb_fgets(line, LLEN, fp)) { X11_add_menu(newwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - line, MENU_ITEMFLAGS_NONE); + clr, line, MENU_ITEMFLAGS_NONE); } (void) dlb_fclose(fp); diff --git a/win/X11/winmenu.c b/win/X11/winmenu.c index 4b8d15b63..4a4d7676a 100644 --- a/win/X11/winmenu.c +++ b/win/X11/winmenu.c @@ -787,6 +787,7 @@ X11_add_menu(winid window, char ch, /* selector letter; 0 if not selectable */ char gch, /* group accelerator (0 = no group) */ int attr, + int clr UNUSED, const char *str, unsigned itemflags) { diff --git a/win/chain/wc_chainin.c b/win/chain/wc_chainin.c index e990222c9..e318a9fd0 100644 --- a/win/chain/wc_chainin.c +++ b/win/chain/wc_chainin.c @@ -24,7 +24,7 @@ void chainin_putmixed(winid, int, const char *); void chainin_display_file(const char *, boolean); void chainin_start_menu(winid, unsigned long); void chainin_add_menu(winid, const glyph_info *, const ANY_P *, - char, char, int, + char, char, int, int, const char *, unsigned int); void chainin_end_menu(winid, const char *); int chainin_select_menu(winid, int, MENU_ITEM_P **); @@ -263,12 +263,13 @@ chainin_add_menu( char ch, /* keyboard accelerator (0 = pick our own) */ char gch, /* group accelerator (0 = no group) */ int attr, /* attribute for string (like tty_putstr()) */ + int clr, /* attribute for string (like tty_putstr()) */ const char *str, /* menu string */ unsigned int itemflags) /* flags such as item is marked as selected MENU_ITEMFLAGS_SELECTED */ { (*cibase->nprocs->win_add_menu)(cibase->ndata, window, glyphinfo, - identifier, ch, gch, attr, str, itemflags); + identifier, ch, gch, attr, clr, str, itemflags); } void diff --git a/win/chain/wc_chainout.c b/win/chain/wc_chainout.c index 2a118608a..734008b5c 100644 --- a/win/chain/wc_chainout.c +++ b/win/chain/wc_chainout.c @@ -24,7 +24,7 @@ void chainout_putmixed(void *,winid, int, const char *); void chainout_display_file(void *,const char *, boolean); void chainout_start_menu(void *,winid, unsigned long); void chainout_add_menu(void *,winid, const glyph_info *, const ANY_P *, - char, char, int, + char, char, int, int, const char *, unsigned int); void chainout_end_menu(void *,winid, const char *); int chainout_select_menu(void *,winid, int, MENU_ITEM_P **); @@ -300,13 +300,14 @@ chainout_add_menu( char ch, /* keyboard accelerator (0 = pick our own) */ char gch, /* group accelerator (0 = no group) */ int attr, /* attribute for string (like tty_putstr()) */ + int clr, /* clr for string */ const char *str, /* menu string */ unsigned int itemflags) /* itemflags such as marked as selected */ { struct chainout_data *tdp = vp; (*tdp->nprocs->win_add_menu)(window, glyphinfo, identifier, ch, gch, - attr, str, itemflags); + attr, clr, str, itemflags); } void diff --git a/win/chain/wc_trace.c b/win/chain/wc_trace.c index 8b6e8f07a..f19c043a5 100644 --- a/win/chain/wc_trace.c +++ b/win/chain/wc_trace.c @@ -50,7 +50,7 @@ void trace_putmixed(void *,winid, int, const char *); void trace_display_file(void *,const char *, boolean); void trace_start_menu(void *,winid, unsigned long); void trace_add_menu(void *,winid, const glyph_info *, const ANY_P *, - char, char, int, + char, char, int, int, const char *, unsigned int); void trace_end_menu(void *,winid, const char *); int trace_select_menu(void *,winid, int, MENU_ITEM_P **); @@ -446,6 +446,7 @@ trace_add_menu( char ch, /* keyboard accelerator (0 = pick our own) */ char gch, /* group accelerator (0 = no group) */ int attr, /* attribute for string (like tty_putstr()) */ + int clr, /* color for string */ const char *str, /* menu string */ unsigned int itemflags) /* itemflags such as marked as selected */ { @@ -480,7 +481,7 @@ trace_add_menu( PRE; (*tdp->nprocs->win_add_menu)(tdp->ndata, window, glyphinfo, - identifier,ch, gch, attr, str, itemflags); + identifier,ch, gch, attr, clr, str, itemflags); POST; } diff --git a/win/curses/cursinit.c b/win/curses/cursinit.c index 8928da9f3..d461fd570 100644 --- a/win/curses/cursinit.c +++ b/win/curses/cursinit.c @@ -686,6 +686,7 @@ curses_character_dialog(const char **choices, const char *prompt) anything identifier; menu_item *selected = NULL; winid wid = curses_get_wid(NHW_MENU); + int clr = 0; identifier.a_void = 0; curses_start_menu(wid, MENU_BEHAVE_STANDARD); @@ -700,19 +701,19 @@ curses_character_dialog(const char **choices, const char *prompt) identifier.a_int = (count + 1); /* Must be non-zero */ curses_add_menu(wid, &nul_glyphinfo, &identifier, curletter, 0, - A_NORMAL, choices[count], MENU_ITEMFLAGS_NONE); + A_NORMAL, clr, choices[count], MENU_ITEMFLAGS_NONE); used_letters[count] = curletter; } /* Random Selection */ identifier.a_int = ROLE_RANDOM; curses_add_menu(wid, &nul_glyphinfo, &identifier, '*', 0, - A_NORMAL, "Random", MENU_ITEMFLAGS_NONE); + A_NORMAL, clr, "Random", MENU_ITEMFLAGS_NONE); /* Quit prompt */ identifier.a_int = ROLE_NONE; curses_add_menu(wid, &nul_glyphinfo, &identifier, 'q', 0, - A_NORMAL, "Quit", MENU_ITEMFLAGS_NONE); + A_NORMAL, clr, "Quit", MENU_ITEMFLAGS_NONE); curses_end_menu(wid, prompt); ret = curses_select_menu(wid, PICK_ONE, &selected); if (ret == 1) { diff --git a/win/curses/cursmain.c b/win/curses/cursmain.c index df56cae37..4c9dd2ddc 100644 --- a/win/curses/cursmain.c +++ b/win/curses/cursmain.c @@ -557,7 +557,8 @@ curses_start_menu(winid wid, unsigned long mbehavior) add_menu(winid wid, const glyph_info *glyphinfo, const anything identifier, char accelerator, char groupacc, - int attr, char *str, unsigned int itemflags) + int attr, int color, + char *str, unsigned int itemflags) -- Add a text line str to the given menu window. If identifier is 0, then the line cannot be selected (e.g. a title). Otherwise, identifier is the value returned if the line is @@ -590,7 +591,7 @@ void curses_add_menu(winid wid, const glyph_info *glyphinfo, const ANY_P *identifier, char accelerator, char group_accel, int attr, - const char *str, unsigned itemflags) + int clr UNUSED, const char *str, unsigned itemflags) { int curses_attr; diff --git a/win/curses/cursmesg.c b/win/curses/cursmesg.c index 2d0995bbf..70f30ecbf 100644 --- a/win/curses/cursmesg.c +++ b/win/curses/cursmesg.c @@ -373,6 +373,7 @@ curses_prev_mesg(void) boolean do_lifo = (iflags.prevmsg_window != 'f'); #ifdef DEBUG static int showturn = 0; /* 1: show hero_seq value in separators */ + int clr = 0; /* * Set DEBUGFILES=MesgTurn in environment or sysconf to decorate @@ -400,16 +401,16 @@ curses_prev_mesg(void) (mesg->turn >> 3), (mesg->turn & 7L)); #endif curses_add_menu(wid, &nul_glyphinfo, &Id, 0, 0, - A_NORMAL, sepbuf, MENU_ITEMFLAGS_NONE); + A_NORMAL, clr, sepbuf, MENU_ITEMFLAGS_NONE); } turn = mesg->turn; } curses_add_menu(wid, &nul_glyphinfo, &Id, 0, 0, - A_NORMAL, mesg->str, MENU_ITEMFLAGS_NONE); + A_NORMAL, clr, mesg->str, MENU_ITEMFLAGS_NONE); } if (!count) curses_add_menu(wid, &nul_glyphinfo, &Id, 0, 0, - A_NORMAL, "[No past messages available.]", + A_NORMAL, clr, "[No past messages available.]", MENU_ITEMFLAGS_NONE); curses_end_menu(wid, ""); diff --git a/win/curses/cursmisc.c b/win/curses/cursmisc.c index ea4b9e9a8..50ee57bfa 100644 --- a/win/curses/cursmisc.c +++ b/win/curses/cursmisc.c @@ -650,6 +650,7 @@ curses_view_file(const char *filename, boolean must_exist) char buf[BUFSZ]; menu_item *selected = NULL; dlb *fp = dlb_fopen(filename, "r"); + int clr = 0; if (fp == NULL) { if (must_exist) @@ -663,7 +664,7 @@ curses_view_file(const char *filename, boolean must_exist) while (dlb_fgets(buf, BUFSZ, fp) != NULL) { curses_add_menu(wid, &nul_glyphinfo, &Id, 0, 0, - A_NORMAL, buf, FALSE); + A_NORMAL, clr, buf, FALSE); } dlb_fclose(fp); diff --git a/win/share/safeproc.c b/win/share/safeproc.c index 5c442d277..7fe6f5791 100644 --- a/win/share/safeproc.c +++ b/win/share/safeproc.c @@ -236,6 +236,7 @@ safe_add_menu( char ch, /* keyboard accelerator (0 = pick our own) */ char gch, /* group accelerator (0 = no group) */ int attr, /* attribute for string (like safe_putstr()) */ + int clr, /* colour for string */ const char *str, /* menu string */ unsigned int itemflags) /* itemflags such as marked as selected */ { diff --git a/win/shim/winshim.c b/win/shim/winshim.c index 2c4454968..9869de2a2 100644 --- a/win/shim/winshim.c +++ b/win/shim/winshim.c @@ -130,9 +130,9 @@ VDECLCB(shim_putstr,(winid w, int attr, const char *str), "viis", A2P w, A2P att VDECLCB(shim_display_file,(const char *name, boolean complain), "vsi", P2V name, A2P complain) VDECLCB(shim_start_menu,(winid window, unsigned long mbehavior), "vii", A2P window, A2P mbehavior) VDECLCB(shim_add_menu, - (winid window, const glyph_info *glyphinfo, const ANY_P *identifier, char ch, char gch, int attr, const char *str, unsigned int itemflags), + (winid window, const glyph_info *glyphinfo, const ANY_P *identifier, char ch, char gch, int attr, int clr, const char *str, unsigned int itemflags), "vippiiisi", - A2P window, P2V glyphinfo, P2V identifier, A2P ch, A2P gch, A2P attr, P2V str, A2P itemflags) + A2P window, P2V glyphinfo, P2V identifier, A2P ch, A2P gch, A2P attr, A2P clr, P2V str, A2P itemflags) VDECLCB(shim_end_menu,(winid window, const char *prompt), "vis", A2P window, P2V prompt) /* XXX: shim_select_menu menu_list is an output */ DECLCB(int, shim_select_menu,(winid window, int how, MENU_ITEM_P **menu_list), "iiio", A2P window, A2P how, P2V menu_list) diff --git a/win/tty/wintty.c b/win/tty/wintty.c index dc4ac30a6..fbf9992d0 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -273,7 +273,7 @@ static void tty_invent_box_glyph_init(struct WinDesc *cw); static boolean calling_from_update_inventory = FALSE; static boolean assesstty(enum inv_modes, short *, short *, long *, long *, long *, long *, long *); -static void ttyinv_populate_slot(struct WinDesc *, int, int, const char *); +static void ttyinv_populate_slot(struct WinDesc *, int, int, const char *, int32_t); #endif /* @@ -585,6 +585,7 @@ tty_player_selection(void) winid win; anything any; menu_item *selected = 0; + int clr = 0; /* Used to avoid "Is this ok?" if player has already specified all * four facets of role. @@ -679,7 +680,7 @@ tty_player_selection(void) role_menu_extra(ROLE_RANDOM, win, TRUE); any = cg.zeroany; /* separator, not a choice */ add_menu(win, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, "", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "", MENU_ITEMFLAGS_NONE); role_menu_extra(RS_RACE, win, FALSE); role_menu_extra(RS_GENDER, win, FALSE); role_menu_extra(RS_ALGNMNT, win, FALSE); @@ -777,7 +778,7 @@ tty_player_selection(void) role_menu_extra(ROLE_RANDOM, win, TRUE); any.a_int = 0; /* separator, not a choice */ add_menu(win, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, "", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "", MENU_ITEMFLAGS_NONE); role_menu_extra(RS_ROLE, win, FALSE); role_menu_extra(RS_GENDER, win, FALSE); role_menu_extra(RS_ALGNMNT, win, FALSE); @@ -869,7 +870,7 @@ tty_player_selection(void) role_menu_extra(ROLE_RANDOM, win, TRUE); any.a_int = 0; /* separator, not a choice */ add_menu(win, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, "", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "", MENU_ITEMFLAGS_NONE); role_menu_extra(RS_ROLE, win, FALSE); role_menu_extra(RS_RACE, win, FALSE); role_menu_extra(RS_ALGNMNT, win, FALSE); @@ -957,7 +958,7 @@ tty_player_selection(void) role_menu_extra(ROLE_RANDOM, win, TRUE); any.a_int = 0; /* separator, not a choice */ add_menu(win, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, "", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "", MENU_ITEMFLAGS_NONE); role_menu_extra(RS_ROLE, win, FALSE); role_menu_extra(RS_RACE, win, FALSE); role_menu_extra(RS_GENDER, win, FALSE); @@ -1043,27 +1044,27 @@ tty_player_selection(void) aligns[ALGN].adj, plbuf, races[RACE].adj, (GEND == 1 && roles[ROLE].name.f) ? roles[ROLE].name.f : roles[ROLE].name.m); - add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, pbuf, + add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, pbuf, MENU_ITEMFLAGS_NONE); /* blank separator */ any.a_int = 0; add_menu(win, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, "", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "", MENU_ITEMFLAGS_NONE); /* [ynaq] menu choices */ any.a_int = 1; add_menu(win, &nul_glyphinfo, &any, 'y', 0, - ATR_NONE, "Yes; start game", MENU_ITEMFLAGS_SELECTED); + ATR_NONE, clr, "Yes; start game", MENU_ITEMFLAGS_SELECTED); any.a_int = 2; add_menu(win, &nul_glyphinfo, &any, 'n', 0, - ATR_NONE, "No; choose role again", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "No; choose role again", MENU_ITEMFLAGS_NONE); if (iflags.renameallowed) { any.a_int = 3; add_menu(win, &nul_glyphinfo, &any, 'a', 0, ATR_NONE, - "Not yet; choose another name", MENU_ITEMFLAGS_NONE); + clr, "Not yet; choose another name", MENU_ITEMFLAGS_NONE); } any.a_int = -1; add_menu(win, &nul_glyphinfo, &any, 'q', 0, - ATR_NONE, "Quit", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "Quit", MENU_ITEMFLAGS_NONE); Sprintf(pbuf, "Is this ok? [yn%sq]", iflags.renameallowed ? "a" : ""); end_menu(win, pbuf); n = select_menu(win, PICK_ONE, &selected); @@ -1129,7 +1130,7 @@ reset_role_filtering(void) { winid win; anything any; - int i, n; + int i, n, clr = 0; char filterprompt[QBUFSZ]; menu_item *selected = 0; @@ -1138,23 +1139,26 @@ reset_role_filtering(void) any = cg.zeroany; /* no extra blank line preceding this entry; end_menu supplies one */ - add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, "Unacceptable roles", MENU_ITEMFLAGS_NONE); setup_rolemenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE); - add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - "Unacceptable races", MENU_ITEMFLAGS_NONE); + clr, "", MENU_ITEMFLAGS_NONE); + add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + clr, "Unacceptable races", MENU_ITEMFLAGS_NONE); setup_racemenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE); - add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - "Unacceptable genders", MENU_ITEMFLAGS_NONE); + clr, "", MENU_ITEMFLAGS_NONE); + add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + clr, "Unacceptable genders", MENU_ITEMFLAGS_NONE); setup_gendmenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE); - add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, - "Unacceptable alignments", MENU_ITEMFLAGS_NONE); + clr, "", MENU_ITEMFLAGS_NONE); + add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, + clr, "Unacceptable alignments", MENU_ITEMFLAGS_NONE); setup_algnmenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE); Sprintf(filterprompt, "Pick all that apply%s", @@ -1192,6 +1196,7 @@ setup_rolemenu( int i; boolean role_ok; char thisch, lastch = '\0', rolenamebuf[50]; + int clr = 0; any = cg.zeroany; /* zero out all bits */ for (i = 0; roles[i].name.m; i++) { @@ -1224,7 +1229,7 @@ setup_rolemenu( /* !filtering implies reset_role_filtering() where we want to mark this role as preseleted if current filter excludes it */ add_menu(win, &nul_glyphinfo, &any, thisch, 0, - ATR_NONE, an(rolenamebuf), + ATR_NONE, clr, an(rolenamebuf), (!filtering && !role_ok) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); lastch = thisch; @@ -1238,6 +1243,7 @@ setup_racemenu(winid win, boolean filtering, int role, int gend, int algn) boolean race_ok; int i; char this_ch; + int clr = 0; any = cg.zeroany; for (i = 0; races[i].noun; i++) { @@ -1259,7 +1265,7 @@ setup_racemenu(winid win, boolean filtering, int role, int gend, int algn) add_menu(win, &nul_glyphinfo, &any, filtering ? this_ch : highc(this_ch), filtering ? highc(this_ch) : 0, - ATR_NONE, races[i].noun, + ATR_NONE, clr, races[i].noun, (!filtering && !race_ok) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } @@ -1272,6 +1278,7 @@ setup_gendmenu(winid win, boolean filtering, int role, int race, int algn) boolean gend_ok; int i; char this_ch; + int clr = 0; any = cg.zeroany; for (i = 0; i < ROLE_GENDERS; i++) { @@ -1291,7 +1298,7 @@ setup_gendmenu(winid win, boolean filtering, int role, int race, int algn) add_menu(win, &nul_glyphinfo, &any, filtering ? this_ch : highc(this_ch), filtering ? highc(this_ch) : 0, - ATR_NONE, genders[i].adj, + ATR_NONE, clr, genders[i].adj, (!filtering && !gend_ok) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } @@ -1304,6 +1311,7 @@ setup_algnmenu(winid win, boolean filtering, int role, int race, int gend) boolean algn_ok; int i; char this_ch; + int clr = 0; any = cg.zeroany; for (i = 0; i < ROLE_ALIGNS; i++) { @@ -1323,7 +1331,7 @@ setup_algnmenu(winid win, boolean filtering, int role, int race, int gend) add_menu(win, &nul_glyphinfo, &any, filtering ? this_ch : highc(this_ch), filtering ? highc(this_ch) : 0, - ATR_NONE, aligns[i].adj, + ATR_NONE, clr, aligns[i].adj, (!filtering && !algn_ok) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); } @@ -3229,6 +3237,7 @@ tty_add_menu( char ch, /* selector letter (0 = pick our own) */ char gch, /* group accelerator (0 = no group) */ int attr, /* attribute for string (like tty_putstr()) */ + int clr UNUSED, /* color for string */ const char *str, /* menu string */ unsigned int itemflags) /* itemflags such as MENU_ITEMFLAGS_SELECTED */ { @@ -3307,6 +3316,7 @@ tty_end_menu(winid window, /* menu to use */ short len; int lmax, n; char menu_ch; + int clr = 0; if (window == WIN_ERR || (cw = wins[window]) == (struct WinDesc *) 0 || cw->type != NHW_MENU) @@ -3321,9 +3331,9 @@ tty_end_menu(winid window, /* menu to use */ any = cg.zeroany; /* not selectable */ tty_add_menu(window, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, "", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "", MENU_ITEMFLAGS_NONE); tty_add_menu(window, &nul_glyphinfo, &any, 0, 0, - ATR_NONE, prompt, MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, prompt, MENU_ITEMFLAGS_NONE); } /* 52: 'a'..'z' and 'A'..'Z'; avoids selector duplication within a page */ @@ -3591,7 +3601,7 @@ tty_update_inventory(int arg UNUSED) /* side: left side panel or right side panel, not a window column */ side = slot < (!show_gold ? 26 : 27) ? 0 : 1; - ttyinv_populate_slot(cw, row, side, text); + ttyinv_populate_slot(cw, row, side, text, 0); } calling_from_update_inventory = TRUE; @@ -3679,7 +3689,8 @@ tty_update_invent_slot( row = (slot % (!show_gold ? 26 : 27)) + 1; /* +1: top border */ /* side: left side panel or right side panel, not a window column */ side = slot < (!show_gold ? 26 : 27) ? 0 : 1; - ttyinv_populate_slot(cw, row, side, pi->fromcore.text); + ttyinv_populate_slot(cw, row, side, + pi->fromcore.text, pi->fromcore.clr); break; case render: if ((cw = wins[window]) == (struct WinDesc *) 0) @@ -3761,7 +3772,7 @@ ttyinv_populate_slot( struct WinDesc *cw, int row, /* 'row' within the window, not within screen */ int side, /* 'side'==0 is left panel or ==1 is right panel */ - const char *text) + const char *text, int32_t color) { struct tty_perminvent_cell *cell; char c; @@ -3770,6 +3781,9 @@ ttyinv_populate_slot( col = bordercol[side] + 1; endcol = bordercol[side + 1] - 1; cell = &cw->cells[row][col]; + if (cell->color != color) + cell->refresh = 1; + cell->color = color; for (ccnt = col; ccnt <= endcol; ++ccnt, ++cell) { /* [don't expect this to happen] if there was a glyph here, release memory allocated for it; gi pointer and ttychar character overlay diff --git a/win/win32/mhmsg.h b/win/win32/mhmsg.h index 7cffdd509..097b4fa37 100644 --- a/win/win32/mhmsg.h +++ b/win/win32/mhmsg.h @@ -51,6 +51,7 @@ typedef struct mswin_nhmsg_add_menu { char accelerator; char group_accel; int attr; + int clr; const char *str; boolean presel; unsigned int itemflags; diff --git a/win/win32/mswproc.c b/win/win32/mswproc.c index 29507a3d2..2d0d3a938 100644 --- a/win/win32/mswproc.c +++ b/win/win32/mswproc.c @@ -334,6 +334,7 @@ prompt_for_player_selection(void) anything any; menu_item *selected = 0; DWORD box_result; + int clr = 0; logDebug("prompt_for_player_selection()\n"); @@ -431,8 +432,8 @@ prompt_for_player_selection(void) } else Strcpy(rolenamebuf, roles[i].name.m); } - add_menu(win, &nul_glyphinfo, &any, thisch, 0, - ATR_NONE, an(rolenamebuf), MENU_ITEMFLAGS_NONE); + add_menu(win, &nul_glyphinfo, &any, thisch, 0, ATR_NONE, + clr, an(rolenamebuf), MENU_ITEMFLAGS_NONE); lastch = thisch; } } @@ -441,10 +442,10 @@ prompt_for_player_selection(void) if (any.a_int == 0) /* must be non-zero */ any.a_int = randrole(FALSE) + 1; add_menu(win, &nul_glyphinfo, &any, '*', 0, - ATR_NONE, "Random", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "Random", MENU_ITEMFLAGS_NONE); any.a_int = i + 1; /* must be non-zero */ add_menu(win, &nul_glyphinfo, &any, 'q', 0, - ATR_NONE, "Quit", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "Quit", MENU_ITEMFLAGS_NONE); Sprintf(pbuf, "Pick a role for your %s", plbuf); end_menu(win, pbuf); n = select_menu(win, PICK_ONE, &selected); @@ -507,7 +508,7 @@ prompt_for_player_selection(void) flags.initalign)) { any.a_int = i + 1; /* must be non-zero */ add_menu(win, &nul_glyphinfo, &any, - races[i].noun[0], 0, ATR_NONE, + races[i].noun[0], 0, ATR_NONE, clr, races[i].noun, MENU_ITEMFLAGS_NONE); } any.a_int = pick_race(flags.initrole, flags.initgend, @@ -515,10 +516,10 @@ prompt_for_player_selection(void) if (any.a_int == 0) /* must be non-zero */ any.a_int = randrace(flags.initrole) + 1; add_menu(win, &nul_glyphinfo, &any, '*', 0, - ATR_NONE, "Random", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "Random", MENU_ITEMFLAGS_NONE); any.a_int = i + 1; /* must be non-zero */ add_menu(win, &nul_glyphinfo, &any, 'q', 0, - ATR_NONE, "Quit", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "Quit", MENU_ITEMFLAGS_NONE); Sprintf(pbuf, "Pick the race of your %s", plbuf); end_menu(win, pbuf); n = select_menu(win, PICK_ONE, &selected); @@ -582,7 +583,7 @@ prompt_for_player_selection(void) flags.initalign)) { any.a_int = i + 1; add_menu(win, &nul_glyphinfo, &any, - genders[i].adj[0], 0, ATR_NONE, + genders[i].adj[0], 0, ATR_NONE, clr, genders[i].adj, MENU_ITEMFLAGS_NONE); } any.a_int = pick_gend(flags.initrole, flags.initrace, @@ -590,10 +591,10 @@ prompt_for_player_selection(void) if (any.a_int == 0) /* must be non-zero */ any.a_int = randgend(flags.initrole, flags.initrace) + 1; add_menu(win, &nul_glyphinfo, &any, '*', 0, - ATR_NONE, "Random", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "Random", MENU_ITEMFLAGS_NONE); any.a_int = i + 1; /* must be non-zero */ add_menu(win, &nul_glyphinfo, &any, 'q', 0, - ATR_NONE, "Quit", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "Quit", MENU_ITEMFLAGS_NONE); Sprintf(pbuf, "Pick the gender of your %s", plbuf); end_menu(win, pbuf); n = select_menu(win, PICK_ONE, &selected); @@ -656,7 +657,7 @@ prompt_for_player_selection(void) flags.initgend, i)) { any.a_int = i + 1; add_menu(win, &nul_glyphinfo, &any, - aligns[i].adj[0], 0, ATR_NONE, + aligns[i].adj[0], 0, ATR_NONE, clr, aligns[i].adj, MENU_ITEMFLAGS_NONE); } any.a_int = pick_align(flags.initrole, flags.initrace, @@ -664,10 +665,10 @@ prompt_for_player_selection(void) if (any.a_int == 0) /* must be non-zero */ any.a_int = randalign(flags.initrole, flags.initrace) + 1; add_menu(win, &nul_glyphinfo, &any, '*', 0, - ATR_NONE, "Random", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "Random", MENU_ITEMFLAGS_NONE); any.a_int = i + 1; /* must be non-zero */ add_menu(win, &nul_glyphinfo, &any, 'q', 0, - ATR_NONE, "Quit", MENU_ITEMFLAGS_NONE); + ATR_NONE, clr, "Quit", MENU_ITEMFLAGS_NONE); Sprintf(pbuf, "Pick the alignment of your %s", plbuf); end_menu(win, pbuf); n = select_menu(win, PICK_ONE, &selected); @@ -1102,7 +1103,8 @@ mswin_start_menu(winid wid, unsigned long mbehavior) add_menu(windid window, const glyph_info *glyphinfo, const anything identifier, char accelerator, char groupacc, - int attr, char *str, unsigned int itemflags) + int attr, int clr, + char *str, unsigned int itemflags) -- Add a text line str to the given menu window. If identifier is 0, then the line cannot be selected (e.g. a title). Otherwise, identifier is the value returned if the line is @@ -1133,13 +1135,13 @@ add_menu(windid window, const glyph_info *glyphinfo, void mswin_add_menu(winid wid, const glyph_info *glyphinfo, const ANY_P *identifier, - char accelerator, char group_accel, int attr, + char accelerator, char group_accel, int attr, int clr, const char *str, unsigned int itemflags) { boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0); - logDebug("mswin_add_menu(%d, %d, %u, %p, %c, %c, %d, %s, %u)\n", wid, + logDebug("mswin_add_menu(%d, %d, %u, %p, %c, %c, %d, %d, %s, %u)\n", wid, glyphinfo->glyph, glyphinfo->gm.glyphflags, - identifier, (char) accelerator, (char) group_accel, attr, str, + identifier, (char) accelerator, (char) group_accel, attr, clr, str, itemflags); if ((wid >= 0) && (wid < MAXWINDOWS) && (GetNHApp()->windowlist[wid].win != NULL)) { diff --git a/win/win32/winMS.h b/win/win32/winMS.h index be2f6fec7..5c4b81f38 100644 --- a/win/win32/winMS.h +++ b/win/win32/winMS.h @@ -158,7 +158,7 @@ void mswin_start_menu(winid wid, unsigned long mbehavior); void mswin_add_menu(winid wid, const glyph_info *glyphinfo, const ANY_P *identifier, char accelerator, char group_accel, int attr, - const char *str, unsigned int itemflags); + int clr, const char *str, unsigned int itemflags); void mswin_end_menu(winid wid, const char *prompt); int mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected); void mswin_mark_synch(void);