more window port interface adjustments

further adjustments to the window port interface to pass a pointer
to a glyph_info struct which describes not just the glyph number
itself, but also the ttychar, the color, the glyphflags, and the
symset index.

This affects two existing window port calls that get passed glyphs
and does the parameter consistently for both of them using the
glyph_info struct pointer:
	print_glyph()
	add_menu().

The recently added glyphmod parameter is now unnecessary and has been
removed.
This commit is contained in:
nhmall
2021-01-05 10:09:37 -05:00
parent 2a9a18fa2f
commit c9673b3d9e
63 changed files with 841 additions and 705 deletions
+5 -4
View File
@@ -9,7 +9,7 @@ hero polymorphed into a vampire can use #monster to shape-shift rather than
adjust bones filename buffer sizes to accommodate suffix adjust bones filename buffer sizes to accommodate suffix
fix internal self-recover to work with recent fields added to checkpoint file fix internal self-recover to work with recent fields added to checkpoint file
improvements to pronoun usage when hallucinating improvements to pronoun usage when hallucinating
function calls made from map_glyphmod() based on dungeon level are now called function calls made from map_glyphinfo() based on dungeon level are now called
once per level once per level
fast hero could have random clairvoyance happen more than once on same turn fast hero could have random clairvoyance happen more than once on same turn
using 'Q' on wielded weapon would offer to split stack; make using 'w' on a using 'Q' on wielded weapon would offer to split stack; make using 'w' on a
@@ -868,6 +868,7 @@ unify special attack damages from separate you-hit-monster, monster-hits-you,
unify trap effects for hero and monster stepping on the trap by trap type unify trap effects for hero and monster stepping on the trap by trap type
replace the single permonst mname field with male, female, and gender-neutral replace the single permonst mname field with male, female, and gender-neutral
names pmnames[NUM_MGENDERS] fields names pmnames[NUM_MGENDERS] fields
add a new glyphmod parameter to window interface *_print_glyph() to be used adjust window port interface to pass a pointer to a glyph_info struct which
to provide additional details to the window port beyond the glyph; contains the glyph itself, the ttychar, the color, the glyphflags,
window port mapglyph() calls and the function itself were removed and the symset index; this affects two window port calls that get
passed glyphs: print_glyph() and add_menu().
+26 -17
View File
@@ -191,19 +191,27 @@ int nh_poskey(int *x, int *y, int *mod)
B. High-level routines: B. High-level routines:
print_glyph(window, x, y, glyph, bkglyph, glyphmod[3]) print_glyph(window, x, y, glyphinfo, bkglyphinfo)
-- Print the glyph at (x,y) on the given window. Glyphs are -- Print a glyph found within the glyphinfo at (x,y) on the
integers at the interface, mapped to whatever the window- given window. The glyphs within the glyph_info struct are
integers and can be mapped to whatever the window-
port wants (symbol, font, color, attributes, ...there's port wants (symbol, font, color, attributes, ...there's
a 1-1 map between glyphs and distinct things on the map). a 1-1 map between glyphs and distinct things on the map).
-- bkglyph is a background glyph for potential use by some -- bkglyphinfo contains a background glyph for potential use
graphical or tiled environments to allow the depiction by some graphical or tiled environments to allow the depiction
to fall against a background consistent with the grid to fall against a background consistent with the grid
around x,y. If bkglyph is NO_GLYPH, then the parameter around x,y. If bkglyphinfo->glyph is NO_GLYPH, then the
should be ignored (do nothing with it). parameter should be ignored (do nothing with it).
-- glyphmod (glyphmod[NUM_GLYPHNOD]) provides extended -- glyph_info struct fields:
information about the glyph that window ports can use to int glyph; /* the display entity */
enhance the display in various ways. int color; /* color for window ports not using a tile */
int ttychar; /* the character mapping for the original tty
interace. Most or all window ports wanted
and used this for various things so it is
provided in 3.7+ */
short int symidx; /* offset into syms array */
unsigned glyphflags; /* more detail about the entity */
char yn_function(const char *ques, const char *choices, char default) char yn_function(const char *ques, const char *choices, char default)
-- Print a prompt made up of ques, choices and default. -- Print a prompt made up of ques, choices and default.
@@ -312,9 +320,9 @@ start_menu(window, unsigned long mbehavior)
be used for menus. be used for menus.
-- mbehavior allows flags to be passed to alter the appearance -- mbehavior allows flags to be passed to alter the appearance
and/or behavior of the menu. and/or behavior of the menu.
add_menu(windid window, int glyph, const anything identifier, add_menu(windid window, glyphinfo, const anything identifier, char accelerator,
char accelerator, char groupacc, char groupacc, int attr, char *str,
int attr, char *str, unsigned itemflags) unsigned itemflags)
-- Add a text line str to the given menu window. If identifier -- Add a text line str to the given menu window. If identifier
is 0, then the line cannot be selected (e.g. a title). is 0, then the line cannot be selected (e.g. a title).
Otherwise, identifier is the value returned if the line is Otherwise, identifier is the value returned if the line is
@@ -324,10 +332,11 @@ add_menu(windid window, int glyph, const anything identifier,
accelerator. It is up to the window-port to make the accelerator. It is up to the window-port to make the
accelerator visible to the user (e.g. put "a - " in front accelerator visible to the user (e.g. put "a - " in front
of str). The value attr is the same as in putstr(). of str). The value attr is the same as in putstr().
Glyph is an optional glyph to accompany the line. If -- glyphinfo (glyph_info type) may optionally contain a glyph
window port cannot or does not want to display it, this to accompany the line. If a window port cannot
is OK. If there is no glyph applicable, then this or does not want to display it, this is OK. If there is no
value will be NO_GLYPH. glyph provided, then the value of glyphinfo->glyph will
be NO_GLYPH.
-- All accelerators should be in the range [A-Za-z], -- All accelerators should be in the range [A-Za-z],
but there are a few exceptions such as the tty player but there are a few exceptions such as the tty player
selection code which uses '*'. selection code which uses '*'.
+4 -2
View File
@@ -524,8 +524,8 @@ struct trapinfo {
typedef struct { typedef struct {
xchar gnew; /* perhaps move this bit into the rm structure. */ xchar gnew; /* perhaps move this bit into the rm structure. */
int glyph; int glyph;
#ifndef UNBUFFERED_GLYPHMOD #ifndef UNBUFFERED_GLYPHINFO
unsigned glyphmod[NUM_GLYPHMOD]; glyph_info glyphinfo;
#endif #endif
} gbuf_entry; } gbuf_entry;
@@ -1213,6 +1213,8 @@ struct const_globals {
E const struct const_globals cg; E const struct const_globals cg;
E const glyph_info nul_glyphinfo;
#undef E #undef E
#endif /* DECL_H */ #endif /* DECL_H */
+3 -3
View File
@@ -475,14 +475,14 @@ enum explosion_types {
#define glyph_is_unexplored(glyph) ((glyph) == GLYPH_UNEXPLORED) #define glyph_is_unexplored(glyph) ((glyph) == GLYPH_UNEXPLORED)
#define glyph_is_nothing(glyph) ((glyph) == GLYPH_NOTHING) #define glyph_is_nothing(glyph) ((glyph) == GLYPH_NOTHING)
/* flags for map_glyphmod */ /* glyphflags for map_glyphinfo */
/* mgflags for altering map_glyphmod() internal behaviour */ /* mgflags for altering map_glyphinfo() internal behaviour */
#define MG_FLAG_NORMAL 0x00 #define MG_FLAG_NORMAL 0x00
#define MG_FLAG_NOOVERRIDE 0x01 #define MG_FLAG_NOOVERRIDE 0x01
#define MG_FLAG_RETURNIDX 0x02 #define MG_FLAG_RETURNIDX 0x02
/* Special mapped glyph flags encoded in glyphmod[GM_FLAGS] by map_glyphmod() */ /* Special mapped glyphflags encoded by map_glyphinfo() */
#define MG_CORPSE 0x0001 #define MG_CORPSE 0x0001
#define MG_INVIS 0x0002 #define MG_INVIS 0x0002
#define MG_DETECT 0x0004 #define MG_DETECT 0x0004
+2 -1
View File
@@ -376,7 +376,7 @@ E void NDECL(reglyph_darkroom);
E void NDECL(set_wall_state); E void NDECL(set_wall_state);
E void FDECL(unset_seenv, (struct rm *, int, int, int, int)); E void FDECL(unset_seenv, (struct rm *, int, int, int, int));
E int FDECL(warning_of, (struct monst *)); E int FDECL(warning_of, (struct monst *));
E void FDECL(map_glyphmod, (XCHAR_P, XCHAR_P, int, unsigned, unsigned *)); E void FDECL(map_glyphinfo, (XCHAR_P, XCHAR_P, int, unsigned, glyph_info *));
/* ### do.c ### */ /* ### do.c ### */
@@ -3037,6 +3037,7 @@ E void FDECL(dump_redirect, (BOOLEAN_P));
E void FDECL(dump_forward_putstr, (winid, int, const char*, int)); E void FDECL(dump_forward_putstr, (winid, int, const char*, int));
E int FDECL(has_color, (int)); E int FDECL(has_color, (int));
E int FDECL(glyph2ttychar, (int)); E int FDECL(glyph2ttychar, (int));
E int FDECL(glyph2symidx, (int));
E char *FDECL(encglyph, (int)); E char *FDECL(encglyph, (int));
E char *FDECL(decode_mixed, (char *, const char *)); E char *FDECL(decode_mixed, (char *, const char *));
E void FDECL(genl_putmixed, (winid, int, const char *)); E void FDECL(genl_putmixed, (winid, int, const char *));
+4 -3
View File
@@ -65,7 +65,7 @@ struct text_map_info_t {
struct tile_glyph_info_t { struct tile_glyph_info_t {
unsigned short glyph; unsigned short glyph;
unsigned special; unsigned glyphflags;
}; };
struct tile_map_info_t { struct tile_map_info_t {
@@ -443,7 +443,8 @@ E void FDECL(X11_curs, (winid, int, int));
E void FDECL(X11_putstr, (winid, int, const char *)); E void FDECL(X11_putstr, (winid, int, const char *));
E void FDECL(X11_display_file, (const char *, BOOLEAN_P)); E void FDECL(X11_display_file, (const char *, BOOLEAN_P));
E void FDECL(X11_start_menu, (winid, unsigned long)); E void FDECL(X11_start_menu, (winid, unsigned long));
E void FDECL(X11_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, int, E void FDECL(X11_add_menu, (winid, const glyph_info *, const ANY_P *,
CHAR_P, CHAR_P, int,
const char *, unsigned int)); const char *, unsigned int));
E void FDECL(X11_end_menu, (winid, const char *)); E void FDECL(X11_end_menu, (winid, const char *));
E int FDECL(X11_select_menu, (winid, int, MENU_ITEM_P **)); E int FDECL(X11_select_menu, (winid, int, MENU_ITEM_P **));
@@ -454,7 +455,7 @@ E void NDECL(X11_wait_synch);
E void FDECL(X11_cliparound, (int, int)); E void FDECL(X11_cliparound, (int, int));
#endif #endif
E void FDECL(X11_print_glyph, (winid, XCHAR_P, XCHAR_P, E void FDECL(X11_print_glyph, (winid, XCHAR_P, XCHAR_P,
int, int, unsigned *)); const glyph_info *, const glyph_info *));
E void FDECL(X11_raw_print, (const char *)); E void FDECL(X11_raw_print, (const char *));
E void FDECL(X11_raw_print_bold, (const char *)); E void FDECL(X11_raw_print_bold, (const char *));
E int NDECL(X11_nhgetch); E int NDECL(X11_nhgetch);
+6 -4
View File
@@ -80,7 +80,8 @@ extern void curses_curs(winid wid, int x, int y);
extern void curses_putstr(winid wid, int attr, const char *text); extern void curses_putstr(winid wid, int attr, const char *text);
extern void curses_display_file(const char *filename, BOOLEAN_P must_exist); extern void curses_display_file(const char *filename, BOOLEAN_P must_exist);
extern void curses_start_menu(winid wid, unsigned long); extern void curses_start_menu(winid wid, unsigned long);
extern void curses_add_menu(winid wid, int glyph, const ANY_P * identifier, extern void curses_add_menu(winid wid, const glyph_info *,
const ANY_P * identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr, CHAR_P accelerator, CHAR_P group_accel, int attr,
const char *str, unsigned int itemflags); const char *str, unsigned int itemflags);
extern void curses_end_menu(winid wid, const char *prompt); extern void curses_end_menu(winid wid, const char *prompt);
@@ -90,7 +91,7 @@ extern void curses_mark_synch(void);
extern void curses_wait_synch(void); extern void curses_wait_synch(void);
extern void curses_cliparound(int x, int y); extern void curses_cliparound(int x, int y);
extern void curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, extern void curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y,
int glyph, int bkglyph, unsigned *glyphmod); const glyph_info *, const glyph_info *);
extern void curses_raw_print(const char *str); extern void curses_raw_print(const char *str);
extern void curses_raw_print_bold(const char *str); extern void curses_raw_print_bold(const char *str);
extern int curses_nhgetch(void); extern int curses_nhgetch(void);
@@ -174,7 +175,7 @@ extern int curses_character_input_dialog(const char *prompt,
const char *choices, CHAR_P def); const char *choices, CHAR_P def);
extern int curses_ext_cmd(void); extern int curses_ext_cmd(void);
extern void curses_create_nhmenu(winid wid, unsigned long); extern void curses_create_nhmenu(winid wid, unsigned long);
extern void curses_add_nhmenu_item(winid wid, int glyph, extern void curses_add_nhmenu_item(winid wid, const glyph_info *,
const ANY_P *identifier, CHAR_P accelerator, const ANY_P *identifier, CHAR_P accelerator,
CHAR_P group_accel, int attr, CHAR_P group_accel, int attr,
const char *str, unsigned itemflags); const char *str, unsigned itemflags);
@@ -194,7 +195,8 @@ extern void curses_status_update(int, genericptr_t, int, int, int,
/* cursinvt.c */ /* cursinvt.c */
extern void curses_update_inv(void); extern void curses_update_inv(void);
extern void curses_add_inv(int, int, CHAR_P, attr_t, const char *); extern void curses_add_inv(int, const glyph_info *,
CHAR_P, attr_t, const char *);
/* cursinit.c */ /* cursinit.c */
+4 -3
View File
@@ -36,7 +36,7 @@ E char NDECL(mar_ask_class);
E char *NDECL(mar_ask_name); E char *NDECL(mar_ask_name);
E int FDECL(mar_create_window, (int)); E int FDECL(mar_create_window, (int));
E void FDECL(mar_destroy_nhwindow, (int)); E void FDECL(mar_destroy_nhwindow, (int));
E void FDECL(mar_print_glyph, (int, int, int, int, int)); E void FDECL(mar_print_glyph, (int, int, int, const glyph_info *, const glyph_info *));
E void FDECL(mar_print_line, (int, int, int, char *)); E void FDECL(mar_print_line, (int, int, int, char *));
E void FDECL(mar_set_message, (char *, char *, char *)); E void FDECL(mar_set_message, (char *, char *, char *));
E Gem_menu_item *NDECL(mar_hol_inv); E Gem_menu_item *NDECL(mar_hol_inv);
@@ -70,7 +70,8 @@ E void FDECL(Gem_curs, (winid, int, int));
E void FDECL(Gem_putstr, (winid, int, const char *)); E void FDECL(Gem_putstr, (winid, int, const char *));
E void FDECL(Gem_display_file, (const char *, BOOLEAN_P)); E void FDECL(Gem_display_file, (const char *, BOOLEAN_P));
E void FDECL(Gem_start_menu, (winid, unsigned long)); E void FDECL(Gem_start_menu, (winid, unsigned long));
E void FDECL(Gem_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, int, E void FDECL(Gem_add_menu, (winid, const glyph_info *,
const ANY_P *, CHAR_P, CHAR_P, int,
const char *, unsigned int)); const char *, unsigned int));
E void FDECL(Gem_end_menu, (winid, const char *)); E void FDECL(Gem_end_menu, (winid, const char *));
E int FDECL(Gem_select_menu, (winid, int, MENU_ITEM_P **)); E int FDECL(Gem_select_menu, (winid, int, MENU_ITEM_P **));
@@ -85,7 +86,7 @@ E void FDECL(Gem_cliparound, (int, int));
E void FDECL(Gem_update_positionbar, (char *)); E void FDECL(Gem_update_positionbar, (char *));
#endif #endif
E void FDECL(Gem_print_glyph, (winid, XCHAR_P, XCHAR_P, E void FDECL(Gem_print_glyph, (winid, XCHAR_P, XCHAR_P,
int, int, unsigned *)); const glyph_info *, const glyph_info *));
E void FDECL(Gem_raw_print, (const char *)); E void FDECL(Gem_raw_print, (const char *));
E void FDECL(Gem_raw_print_bold, (const char *)); E void FDECL(Gem_raw_print_bold, (const char *));
E int NDECL(Gem_nhgetch); E int NDECL(Gem_nhgetch);
+13 -9
View File
@@ -31,8 +31,9 @@ struct window_procs {
void FDECL((*win_putmixed), (winid, int, const char *)); void FDECL((*win_putmixed), (winid, int, const char *));
void FDECL((*win_display_file), (const char *, BOOLEAN_P)); void FDECL((*win_display_file), (const char *, BOOLEAN_P));
void FDECL((*win_start_menu), (winid, unsigned long)); void FDECL((*win_start_menu), (winid, unsigned long));
void FDECL((*win_add_menu), (winid, int, const ANY_P *, CHAR_P, CHAR_P, void FDECL((*win_add_menu), (winid, const glyph_info *, const ANY_P *,
int, const char *, unsigned int)); CHAR_P, CHAR_P, int,
const char *, unsigned int));
void FDECL((*win_end_menu), (winid, const char *)); void FDECL((*win_end_menu), (winid, const char *));
int FDECL((*win_select_menu), (winid, int, MENU_ITEM_P **)); int FDECL((*win_select_menu), (winid, int, MENU_ITEM_P **));
char FDECL((*win_message_menu), (CHAR_P, int, const char *)); char FDECL((*win_message_menu), (CHAR_P, int, const char *));
@@ -46,7 +47,7 @@ struct window_procs {
void FDECL((*win_update_positionbar), (char *)); void FDECL((*win_update_positionbar), (char *));
#endif #endif
void FDECL((*win_print_glyph), (winid, XCHAR_P, XCHAR_P, void FDECL((*win_print_glyph), (winid, XCHAR_P, XCHAR_P,
int, int, unsigned *)); const glyph_info *, const glyph_info *));
void FDECL((*win_raw_print), (const char *)); void FDECL((*win_raw_print), (const char *));
void FDECL((*win_raw_print_bold), (const char *)); void FDECL((*win_raw_print_bold), (const char *));
int NDECL((*win_nhgetch)); int NDECL((*win_nhgetch));
@@ -332,8 +333,9 @@ struct chain_procs {
void FDECL((*win_putmixed), (CARGS, winid, int, const char *)); void FDECL((*win_putmixed), (CARGS, winid, int, const char *));
void FDECL((*win_display_file), (CARGS, const char *, BOOLEAN_P)); void FDECL((*win_display_file), (CARGS, const char *, BOOLEAN_P));
void FDECL((*win_start_menu), (CARGS, winid, unsigned long)); void FDECL((*win_start_menu), (CARGS, winid, unsigned long));
void FDECL((*win_add_menu), (CARGS, winid, int, const ANY_P *, CHAR_P, void FDECL((*win_add_menu), (CARGS, winid, const glyph_info *,
CHAR_P, int, const char *, unsigned int)); const ANY_P *, CHAR_P, CHAR_P, int,
const char *, unsigned int));
void FDECL((*win_end_menu), (CARGS, winid, const char *)); void FDECL((*win_end_menu), (CARGS, winid, const char *));
int FDECL((*win_select_menu), (CARGS, winid, int, MENU_ITEM_P **)); int FDECL((*win_select_menu), (CARGS, winid, int, MENU_ITEM_P **));
char FDECL((*win_message_menu), (CARGS, CHAR_P, int, const char *)); char FDECL((*win_message_menu), (CARGS, CHAR_P, int, const char *));
@@ -347,7 +349,8 @@ struct chain_procs {
void FDECL((*win_update_positionbar), (CARGS, char *)); void FDECL((*win_update_positionbar), (CARGS, char *));
#endif #endif
void FDECL((*win_print_glyph), (CARGS, winid, XCHAR_P, XCHAR_P, void FDECL((*win_print_glyph), (CARGS, winid, XCHAR_P, XCHAR_P,
int, int, unsigned *)); const glyph_info *,
const glyph_info *));
void FDECL((*win_raw_print), (CARGS, const char *)); void FDECL((*win_raw_print), (CARGS, const char *));
void FDECL((*win_raw_print_bold), (CARGS, const char *)); void FDECL((*win_raw_print_bold), (CARGS, const char *));
int FDECL((*win_nhgetch), (CARGS)); int FDECL((*win_nhgetch), (CARGS));
@@ -408,8 +411,9 @@ extern void FDECL(safe_putstr, (winid, int, const char *));
extern void FDECL(safe_putmixed, (winid, int, const char *)); extern void FDECL(safe_putmixed, (winid, int, const char *));
extern void FDECL(safe_display_file, (const char *, BOOLEAN_P)); extern void FDECL(safe_display_file, (const char *, BOOLEAN_P));
extern void FDECL(safe_start_menu, (winid, unsigned long)); extern void FDECL(safe_start_menu, (winid, unsigned long));
extern void FDECL(safe_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, extern void FDECL(safe_add_menu, (winid, const glyph_info *, const ANY_P *,
int, const char *, unsigned int)); CHAR_P, CHAR_P, int, const char *,
unsigned int));
extern void FDECL(safe_end_menu, (winid, const char *)); extern void FDECL(safe_end_menu, (winid, const char *));
extern int FDECL(safe_select_menu, (winid, int, MENU_ITEM_P **)); extern int FDECL(safe_select_menu, (winid, int, MENU_ITEM_P **));
extern char FDECL(safe_message_menu, (CHAR_P, int, const char *)); extern char FDECL(safe_message_menu, (CHAR_P, int, const char *));
@@ -423,7 +427,7 @@ extern void FDECL(safe_cliparound, (int, int));
extern void FDECL(safe_update_positionbar, (char *)); extern void FDECL(safe_update_positionbar, (char *));
#endif #endif
extern void FDECL(safe_print_glyph, (winid, XCHAR_P, XCHAR_P, extern void FDECL(safe_print_glyph, (winid, XCHAR_P, XCHAR_P,
int, int, unsigned *)); const glyph_info *, const glyph_info *));
extern void FDECL(safe_raw_print, (const char *)); extern void FDECL(safe_raw_print, (const char *));
extern void FDECL(safe_raw_print_bold, (const char *)); extern void FDECL(safe_raw_print_bold, (const char *));
extern int NDECL(safe_nhgetch); extern int NDECL(safe_nhgetch);
+5 -3
View File
@@ -197,8 +197,9 @@ E void FDECL(tty_curs, (winid, int, int));
E void FDECL(tty_putstr, (winid, int, const char *)); E void FDECL(tty_putstr, (winid, int, const char *));
E void FDECL(tty_display_file, (const char *, BOOLEAN_P)); E void FDECL(tty_display_file, (const char *, BOOLEAN_P));
E void FDECL(tty_start_menu, (winid, unsigned long)); E void FDECL(tty_start_menu, (winid, unsigned long));
E void FDECL(tty_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, int, E void FDECL(tty_add_menu, (winid, const glyph_info *, const ANY_P *,
const char *, unsigned int)); CHAR_P, CHAR_P, int, const char *,
unsigned int));
E void FDECL(tty_end_menu, (winid, const char *)); E void FDECL(tty_end_menu, (winid, const char *));
E int FDECL(tty_select_menu, (winid, int, MENU_ITEM_P **)); E int FDECL(tty_select_menu, (winid, int, MENU_ITEM_P **));
E char FDECL(tty_message_menu, (CHAR_P, int, const char *)); E char FDECL(tty_message_menu, (CHAR_P, int, const char *));
@@ -211,7 +212,8 @@ E void FDECL(tty_cliparound, (int, int));
#ifdef POSITIONBAR #ifdef POSITIONBAR
E void FDECL(tty_update_positionbar, (char *)); E void FDECL(tty_update_positionbar, (char *));
#endif #endif
E void FDECL(tty_print_glyph, (winid, XCHAR_P, XCHAR_P, int, int, unsigned *)); E void FDECL(tty_print_glyph, (winid, XCHAR_P, XCHAR_P,
const glyph_info *, const glyph_info *));
E void FDECL(tty_raw_print, (const char *)); E void FDECL(tty_raw_print, (const char *));
E void FDECL(tty_raw_print_bold, (const char *)); E void FDECL(tty_raw_print_bold, (const char *));
E int NDECL(tty_nhgetch); E int NDECL(tty_nhgetch);
+13
View File
@@ -52,6 +52,19 @@ enum any_types {
ANY_MASK32 /* 32-bit mask (stored as unsigned long) */ ANY_MASK32 /* 32-bit mask (stored as unsigned long) */
}; };
/* glyph plus additional info */
typedef struct gi {
int glyph; /* the display entity */
int color; /* color for window ports not using a tile */
int ttychar; /* the character mapping for the original tty
interace. Most or all window ports wanted
and used this for various things so it is
provided in 3.7+ */
short int symidx; /* offset into syms array */
unsigned glyphflags; /* more detail about the nature of the entity */
} glyph_info;
#define GLYPH_INFO_P struct gi
/* menu return list */ /* menu return list */
typedef struct mi { typedef struct mi {
anything item; /* identifier */ anything item; /* identifier */
+4 -4
View File
@@ -3308,14 +3308,14 @@ struct obj *obj;
start_menu(tmpwin, MENU_BEHAVE_STANDARD); start_menu(tmpwin, MENU_BEHAVE_STANDARD);
any.a_int++; any.a_int++;
Sprintf(buf, "an object on the %s", surface(cc.x, cc.y)); Sprintf(buf, "an object on the %s", surface(cc.x, cc.y));
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
any.a_int++; any.a_int++;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "a monster", add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
MENU_ITEMFLAGS_NONE); "a monster", MENU_ITEMFLAGS_NONE);
any.a_int++; any.a_int++;
Sprintf(buf, "the %s", surface(cc.x, cc.y)); Sprintf(buf, "the %s", surface(cc.x, cc.y));
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
end_menu(tmpwin, "Aim for what?"); end_menu(tmpwin, "Aim for what?");
tohit = rn2(4); tohit = rn2(4);
+2 -2
View File
@@ -1545,8 +1545,8 @@ struct obj *obj;
if (!g.dungeons[i].dunlev_ureached) if (!g.dungeons[i].dunlev_ureached)
continue; continue;
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
g.dungeons[i].dname, MENU_ITEMFLAGS_NONE); ATR_NONE, g.dungeons[i].dname, MENU_ITEMFLAGS_NONE);
num_ok_dungeons++; num_ok_dungeons++;
last_ok_dungeon = i; last_ok_dungeon = i;
} }
+27 -27
View File
@@ -1075,19 +1075,19 @@ cond_menu(VOID_ARGS)
Sprintf(mbuf, "change sort order from \"%s\" to \"%s\"", Sprintf(mbuf, "change sort order from \"%s\" to \"%s\"",
menutitle[g.condmenu_sortorder], menutitle[g.condmenu_sortorder],
menutitle[1 - g.condmenu_sortorder]); menutitle[1 - g.condmenu_sortorder]);
add_menu(tmpwin, NO_GLYPH, &any, 'S', 0, ATR_NONE, mbuf, add_menu(tmpwin, &nul_glyphinfo, &any, 'S', 0, ATR_NONE,
MENU_ITEMFLAGS_NONE); mbuf, MENU_ITEMFLAGS_NONE);
any = cg.zeroany; any = cg.zeroany;
Sprintf(mbuf, "sorted %s", menutitle[g.condmenu_sortorder]); Sprintf(mbuf, "sorted %s", menutitle[g.condmenu_sortorder]);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, mbuf, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
MENU_ITEMFLAGS_NONE); iflags.menu_headings, mbuf, MENU_ITEMFLAGS_NONE);
for (i = 0; i < SIZE(condtests); i++) { for (i = 0; i < SIZE(condtests); i++) {
idx = sequence[i]; idx = sequence[i];
Sprintf(mbuf, "cond_%-14s", condtests[idx].useroption); Sprintf(mbuf, "cond_%-14s", condtests[idx].useroption);
any = cg.zeroany; any = cg.zeroany;
any.a_int = idx + 2; /* avoid zero and the sort change pick */ any.a_int = idx + 2; /* avoid zero and the sort change pick */
condtests[idx].choice = FALSE; condtests[idx].choice = FALSE;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
mbuf, mbuf,
condtests[idx].enabled condtests[idx].enabled
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
@@ -2346,7 +2346,7 @@ int arrmin, arrmax;
for (i = arrmin; i < arrmax; i++) { for (i = arrmin; i < arrmax; i++) {
any = cg.zeroany; any = cg.zeroany;
any.a_int = i + adj; any.a_int = i + adj;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
arr[i], MENU_ITEMFLAGS_NONE); arr[i], MENU_ITEMFLAGS_NONE);
} }
@@ -2691,7 +2691,7 @@ query_conditions()
for (i = 0; i < SIZE(conditions); i++) { for (i = 0; i < SIZE(conditions); i++) {
any = cg.zeroany; any = cg.zeroany;
any.a_ulong = conditions[i].mask; any.a_ulong = conditions[i].mask;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
conditions[i].text[0], MENU_ITEMFLAGS_NONE); conditions[i].text[0], MENU_ITEMFLAGS_NONE);
} }
@@ -3260,7 +3260,7 @@ status_hilite_menu_choose_field()
#endif #endif
any = cg.zeroany; any = cg.zeroany;
any.a_int = (i + 1); any.a_int = (i + 1);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
initblstats[i].fldname, MENU_ITEMFLAGS_NONE); initblstats[i].fldname, MENU_ITEMFLAGS_NONE);
} }
@@ -3299,7 +3299,7 @@ int fld;
any = cg.zeroany; any = cg.zeroany;
any.a_int = onlybeh = BL_TH_ALWAYS_HILITE; any.a_int = onlybeh = BL_TH_ALWAYS_HILITE;
Sprintf(buf, "Always highlight %s", initblstats[fld].fldname); Sprintf(buf, "Always highlight %s", initblstats[fld].fldname);
add_menu(tmpwin, NO_GLYPH, &any, 'a', 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 'a', 0, ATR_NONE,
buf, MENU_ITEMFLAGS_NONE); buf, MENU_ITEMFLAGS_NONE);
nopts++; nopts++;
} }
@@ -3307,7 +3307,7 @@ int fld;
if (fld == BL_CONDITION) { if (fld == BL_CONDITION) {
any = cg.zeroany; any = cg.zeroany;
any.a_int = onlybeh = BL_TH_CONDITION; any.a_int = onlybeh = BL_TH_CONDITION;
add_menu(tmpwin, NO_GLYPH, &any, 'b', 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 'b', 0, ATR_NONE,
"Bitmask of conditions", MENU_ITEMFLAGS_NONE); "Bitmask of conditions", MENU_ITEMFLAGS_NONE);
nopts++; nopts++;
} }
@@ -3316,7 +3316,7 @@ int fld;
any = cg.zeroany; any = cg.zeroany;
any.a_int = onlybeh = BL_TH_UPDOWN; any.a_int = onlybeh = BL_TH_UPDOWN;
Sprintf(buf, "%s value changes", initblstats[fld].fldname); Sprintf(buf, "%s value changes", initblstats[fld].fldname);
add_menu(tmpwin, NO_GLYPH, &any, 'c', 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 'c', 0, ATR_NONE,
buf, MENU_ITEMFLAGS_NONE); buf, MENU_ITEMFLAGS_NONE);
nopts++; nopts++;
} }
@@ -3325,7 +3325,7 @@ int fld;
&& (at == ANY_INT || at == ANY_LONG)) { && (at == ANY_INT || at == ANY_LONG)) {
any = cg.zeroany; any = cg.zeroany;
any.a_int = onlybeh = BL_TH_VAL_ABSOLUTE; any.a_int = onlybeh = BL_TH_VAL_ABSOLUTE;
add_menu(tmpwin, NO_GLYPH, &any, 'n', 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 'n', 0, ATR_NONE,
"Number threshold", MENU_ITEMFLAGS_NONE); "Number threshold", MENU_ITEMFLAGS_NONE);
nopts++; nopts++;
} }
@@ -3333,7 +3333,7 @@ int fld;
if (initblstats[fld].idxmax >= 0) { if (initblstats[fld].idxmax >= 0) {
any = cg.zeroany; any = cg.zeroany;
any.a_int = onlybeh = BL_TH_VAL_PERCENTAGE; any.a_int = onlybeh = BL_TH_VAL_PERCENTAGE;
add_menu(tmpwin, NO_GLYPH, &any, 'p', 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 'p', 0, ATR_NONE,
"Percentage threshold", MENU_ITEMFLAGS_NONE); "Percentage threshold", MENU_ITEMFLAGS_NONE);
nopts++; nopts++;
} }
@@ -3343,7 +3343,7 @@ int fld;
any = cg.zeroany; any = cg.zeroany;
any.a_int = onlybeh = BL_TH_TEXTMATCH; any.a_int = onlybeh = BL_TH_TEXTMATCH;
Sprintf(buf, "%s text match", initblstats[fld].fldname); Sprintf(buf, "%s text match", initblstats[fld].fldname);
add_menu(tmpwin, NO_GLYPH, &any, 't', 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 't', 0, ATR_NONE,
buf, MENU_ITEMFLAGS_NONE); buf, MENU_ITEMFLAGS_NONE);
nopts++; nopts++;
} }
@@ -3390,7 +3390,7 @@ boolean ltok, gtok;
Sprintf(buf, "Value goes down"); Sprintf(buf, "Value goes down");
any = cg.zeroany; any = cg.zeroany;
any.a_int = 10 + LT_VALUE; any.a_int = 10 + LT_VALUE;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
buf, MENU_ITEMFLAGS_NONE); buf, MENU_ITEMFLAGS_NONE);
if (str) { if (str) {
@@ -3398,7 +3398,7 @@ boolean ltok, gtok;
str, (fld == BL_AC) ? "better (lower)" : "less"); str, (fld == BL_AC) ? "better (lower)" : "less");
any = cg.zeroany; any = cg.zeroany;
any.a_int = 10 + LE_VALUE; any.a_int = 10 + LE_VALUE;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
buf, MENU_ITEMFLAGS_NONE); buf, MENU_ITEMFLAGS_NONE);
} }
} }
@@ -3409,7 +3409,7 @@ boolean ltok, gtok;
Sprintf(buf, "Value changes"); Sprintf(buf, "Value changes");
any = cg.zeroany; any = cg.zeroany;
any.a_int = 10 + EQ_VALUE; any.a_int = 10 + EQ_VALUE;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
buf, MENU_ITEMFLAGS_NONE); buf, MENU_ITEMFLAGS_NONE);
if (gtok) { if (gtok) {
@@ -3418,7 +3418,7 @@ boolean ltok, gtok;
str, (fld == BL_AC) ? "worse (higher)" : "more"); str, (fld == BL_AC) ? "worse (higher)" : "more");
any = cg.zeroany; any = cg.zeroany;
any.a_int = 10 + GE_VALUE; any.a_int = 10 + GE_VALUE;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
buf, MENU_ITEMFLAGS_NONE); buf, MENU_ITEMFLAGS_NONE);
} }
@@ -3429,7 +3429,7 @@ boolean ltok, gtok;
Sprintf(buf, "Value goes up"); Sprintf(buf, "Value goes up");
any = cg.zeroany; any = cg.zeroany;
any.a_int = 10 + GT_VALUE; any.a_int = 10 + GT_VALUE;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
buf, MENU_ITEMFLAGS_NONE); buf, MENU_ITEMFLAGS_NONE);
} }
Sprintf(buf, "Select field %s value:", initblstats[fld].fldname); Sprintf(buf, "Select field %s value:", initblstats[fld].fldname);
@@ -3931,7 +3931,7 @@ int fld;
if (hlstr->fld == fld) { if (hlstr->fld == fld) {
any = cg.zeroany; any = cg.zeroany;
any.a_int = hlstr->id; any.a_int = hlstr->id;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
hlstr->str, MENU_ITEMFLAGS_NONE); hlstr->str, MENU_ITEMFLAGS_NONE);
} }
hlstr = hlstr->next; hlstr = hlstr->next;
@@ -3939,19 +3939,19 @@ int fld;
} else { } else {
any = cg.zeroany; any = cg.zeroany;
Sprintf(buf, "No current hilites for %s", initblstats[fld].fldname); Sprintf(buf, "No current hilites for %s", initblstats[fld].fldname);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
} }
/* separator line */ /* separator line */
any = cg.zeroany; any = cg.zeroany;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, "",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
if (count) { if (count) {
any = cg.zeroany; any = cg.zeroany;
any.a_int = -1; any.a_int = -1;
add_menu(tmpwin, NO_GLYPH, &any, 'X', 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 'X', 0, ATR_NONE,
"Remove selected hilites", "Remove selected hilites",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
} }
@@ -3968,7 +3968,7 @@ int fld;
{ {
any = cg.zeroany; any = cg.zeroany;
any.a_int = -2; any.a_int = -2;
add_menu(tmpwin, NO_GLYPH, &any, 'Z', 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 'Z', 0, ATR_NONE,
"Add a new hilite", MENU_ITEMFLAGS_NONE); "Add a new hilite", MENU_ITEMFLAGS_NONE);
} }
@@ -4064,12 +4064,12 @@ shlmenu_redo:
if (countall) { if (countall) {
any = cg.zeroany; any = cg.zeroany;
any.a_int = -1; any.a_int = -1;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"View all hilites in config format", "View all hilites in config format",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
any = cg.zeroany; any = cg.zeroany;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, "",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
} }
@@ -4090,7 +4090,7 @@ shlmenu_redo:
Sprintf(buf, "%-18s", initblstats[i].fldname); Sprintf(buf, "%-18s", initblstats[i].fldname);
if (count) if (count)
Sprintf(eos(buf), " (%d defined)", count); Sprintf(eos(buf), " (%d defined)", count);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
buf, MENU_ITEMFLAGS_NONE); buf, MENU_ITEMFLAGS_NONE);
} }
+27 -27
View File
@@ -356,11 +356,11 @@ const struct ext_func_tab *efp; /* if Null, add a footnote to the menu */
char qbuf[QBUFSZ]; char qbuf[QBUFSZ];
anything any = cg.zeroany; anything any = cg.zeroany;
add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(menuwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"[A] Command autocompletes", MENU_ITEMFLAGS_NONE); "[A] Command autocompletes", MENU_ITEMFLAGS_NONE);
Sprintf(qbuf, "[m] Command accepts '%c' prefix", Sprintf(qbuf, "[m] Command accepts '%c' prefix",
g.Cmd.spkeys[NHKF_REQMENU]); g.Cmd.spkeys[NHKF_REQMENU]);
add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE, qbuf, add_menu(menuwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, qbuf,
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
return (char *) 0; return (char *) 0;
} else { } else {
@@ -405,16 +405,16 @@ doextlist(VOID_ARGS)
redisplay = FALSE; redisplay = FALSE;
any = cg.zeroany; any = cg.zeroany;
start_menu(menuwin, MENU_BEHAVE_STANDARD); start_menu(menuwin, MENU_BEHAVE_STANDARD);
add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(menuwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"Extended Commands List", "Extended Commands List",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(menuwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"", MENU_ITEMFLAGS_NONE); "", MENU_ITEMFLAGS_NONE);
Sprintf(buf, "Switch to %s commands that don't autocomplete", Sprintf(buf, "Switch to %s commands that don't autocomplete",
menumode ? "including" : "excluding"); menumode ? "including" : "excluding");
any.a_int = 1; any.a_int = 1;
add_menu(menuwin, NO_GLYPH, &any, 'a', 0, ATR_NONE, buf, add_menu(menuwin, &nul_glyphinfo, &any, 'a', 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
if (!*searchbuf) { if (!*searchbuf) {
@@ -424,7 +424,7 @@ doextlist(VOID_ARGS)
actual list of extended commands shown via separator lines; actual list of extended commands shown via separator lines;
having ':' as an explicit selector overrides the default having ':' as an explicit selector overrides the default
menu behavior for it; we retain 's' as a group accelerator */ menu behavior for it; we retain 's' as a group accelerator */
add_menu(menuwin, NO_GLYPH, &any, ':', 's', ATR_NONE, add_menu(menuwin, &nul_glyphinfo, &any, ':', 's', ATR_NONE,
"Search extended commands", "Search extended commands",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
} else { } else {
@@ -437,18 +437,18 @@ doextlist(VOID_ARGS)
also want to hide it from general menu use) because it won't also want to hide it from general menu use) because it won't
work for interfaces which support ':' to search; use as a work for interfaces which support ':' to search; use as a
general menu command takes precedence over group accelerator */ general menu command takes precedence over group accelerator */
add_menu(menuwin, NO_GLYPH, &any, 's', ':', ATR_NONE, add_menu(menuwin, &nul_glyphinfo, &any, 's', ':', ATR_NONE,
buf, MENU_ITEMFLAGS_NONE); buf, MENU_ITEMFLAGS_NONE);
} }
if (wizard) { if (wizard) {
any.a_int = 4; any.a_int = 4;
add_menu(menuwin, NO_GLYPH, &any, 'z', 0, ATR_NONE, add_menu(menuwin, &nul_glyphinfo, &any, 'z', 0, ATR_NONE,
onelist ? "Switch to showing debugging commands in separate section" onelist ? "Switch to showing debugging commands in separate section"
: "Switch to showing all alphabetically, including debugging commands", : "Switch to showing all alphabetically, including debugging commands",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
} }
any = cg.zeroany; any = cg.zeroany;
add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(menuwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"", MENU_ITEMFLAGS_NONE); "", MENU_ITEMFLAGS_NONE);
menushown[0] = menushown[1] = 0; menushown[0] = menushown[1] = 0;
n = 0; n = 0;
@@ -490,7 +490,7 @@ doextlist(VOID_ARGS)
results menu. */ results menu. */
if (!menushown[pass]) { if (!menushown[pass]) {
Strcpy(buf, headings[pass]); Strcpy(buf, headings[pass]);
add_menu(menuwin, NO_GLYPH, &any, 0, 0, add_menu(menuwin, &nul_glyphinfo, &any, 0, 0,
iflags.menu_headings, buf, iflags.menu_headings, buf,
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
menushown[pass] = 1; menushown[pass] = 1;
@@ -499,16 +499,16 @@ doextlist(VOID_ARGS)
2nd field will be " " or " [A]" or " [m]" or "[mA]" */ 2nd field will be " " or " [A]" or " [m]" or "[mA]" */
Sprintf(buf, " %-14s %4s %s", efp->ef_txt, Sprintf(buf, " %-14s %4s %s", efp->ef_txt,
doc_extcmd_flagstr(menuwin, efp), efp->ef_desc); doc_extcmd_flagstr(menuwin, efp), efp->ef_desc);
add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(menuwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
buf, MENU_ITEMFLAGS_NONE); buf, MENU_ITEMFLAGS_NONE);
++n; ++n;
} }
if (n) if (n)
add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(menuwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"", MENU_ITEMFLAGS_NONE); "", MENU_ITEMFLAGS_NONE);
} }
if (*searchbuf && !n) if (*searchbuf && !n)
add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(menuwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"no matches", MENU_ITEMFLAGS_NONE); "no matches", MENU_ITEMFLAGS_NONE);
else else
(void) doc_extcmd_flagstr(menuwin, (struct ext_func_tab *) 0); (void) doc_extcmd_flagstr(menuwin, (struct ext_func_tab *) 0);
@@ -647,8 +647,8 @@ extcmd_via_menu()
/* flush extended cmds for that letter already in buf */ /* flush extended cmds for that letter already in buf */
Sprintf(buf, fmtstr, prompt); Sprintf(buf, fmtstr, prompt);
any.a_char = prevaccelerator; any.a_char = prevaccelerator;
add_menu(win, NO_GLYPH, &any, any.a_char, 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, any.a_char,
buf, MENU_ITEMFLAGS_NONE); 0, ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
acount = 0; acount = 0;
if (!(accelerator != prevaccelerator || one_per_line)) if (!(accelerator != prevaccelerator || one_per_line))
wastoolong = TRUE; wastoolong = TRUE;
@@ -671,8 +671,8 @@ extcmd_via_menu()
/* flush buf */ /* flush buf */
Sprintf(buf, fmtstr, prompt); Sprintf(buf, fmtstr, prompt);
any.a_char = prevaccelerator; any.a_char = prevaccelerator;
add_menu(win, NO_GLYPH, &any, any.a_char, 0, ATR_NONE, buf, add_menu(win, &nul_glyphinfo, &any, any.a_char, 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
} }
Sprintf(prompt, "Extended Command: %s", cbuf); Sprintf(prompt, "Extended Command: %s", cbuf);
end_menu(win, prompt); end_menu(win, prompt);
@@ -1584,8 +1584,8 @@ wiz_intrinsic(VOID_ARGS)
ordering, not their numerical PROP values), can only be ordering, not their numerical PROP values), can only be
set to timed values here so show a separator */ set to timed values here so show a separator */
any.a_int = 0; any.a_int = 0;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "--", add_menu(win, &nul_glyphinfo, &any, 0, 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, "--", MENU_ITEMFLAGS_NONE);
} }
any.a_int = i + 1; /* +1: avoid 0 */ any.a_int = i + 1; /* +1: avoid 0 */
oldtimeout = u.uprops[p].intrinsic & TIMEOUT; oldtimeout = u.uprops[p].intrinsic & TIMEOUT;
@@ -1593,7 +1593,7 @@ wiz_intrinsic(VOID_ARGS)
Sprintf(buf, "%-27s [%li]", propname, oldtimeout); Sprintf(buf, "%-27s [%li]", propname, oldtimeout);
else else
Sprintf(buf, "%s", propname); Sprintf(buf, "%s", propname);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
} }
end_menu(win, "Which intrinsics?"); end_menu(win, "Which intrinsics?");
@@ -1719,29 +1719,29 @@ doterrain(VOID_ARGS)
start_menu(men, MENU_BEHAVE_STANDARD); start_menu(men, MENU_BEHAVE_STANDARD);
any = cg.zeroany; any = cg.zeroany;
any.a_int = 1; any.a_int = 1;
add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(men, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"known map without monsters, objects, and traps", "known map without monsters, objects, and traps",
MENU_ITEMFLAGS_SELECTED); MENU_ITEMFLAGS_SELECTED);
any.a_int = 2; any.a_int = 2;
add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(men, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"known map without monsters and objects", "known map without monsters and objects",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
any.a_int = 3; any.a_int = 3;
add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(men, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"known map without monsters", "known map without monsters",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
if (discover || wizard) { if (discover || wizard) {
any.a_int = 4; any.a_int = 4;
add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(men, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"full map without monsters, objects, and traps", "full map without monsters, objects, and traps",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
if (wizard) { if (wizard) {
any.a_int = 5; any.a_int = 5;
add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(men, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"internal levl[][].typ codes in base-36", "internal levl[][].typ codes in base-36",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
any.a_int = 6; any.a_int = 6;
add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(men, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"legend of base-36 levl[][].typ codes", "legend of base-36 levl[][].typ codes",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
} }
@@ -4072,7 +4072,7 @@ const char *text;
if ((ch = cmd_from_func(func)) != '\0') { if ((ch = cmd_from_func(func)) != '\0') {
any = cg.zeroany; any = cg.zeroany;
any.a_nfunc = func; any.a_nfunc = func;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, text, add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, text,
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
} }
} }
+4
View File
@@ -700,6 +700,10 @@ const struct const_globals cg = {
DUMMY, /* zeroany */ DUMMY, /* zeroany */
}; };
/* glyph, color, ttychar, symidx, glyphflags */
const glyph_info nul_glyphinfo =
{ NO_GLYPH, NO_COLOR, ' ', 0, MG_UNEXPL };
#define ZERO(x) memset(&x, 0, sizeof(x)) #define ZERO(x) memset(&x, 0, sizeof(x))
void void
+3 -3
View File
@@ -2006,12 +2006,12 @@ dump_map()
lastnonblank = -1; /* buf[] index rather than map's x */ lastnonblank = -1; /* buf[] index rather than map's x */
for (x = 1; x < COLNO; x++) { for (x = 1; x < COLNO; x++) {
int ch; int ch;
unsigned glyphmod[NUM_GLYPHMOD]; glyph_info glyphinfo;
glyph = reveal_terrain_getglyph(x, y, FALSE, u.uswallow, glyph = reveal_terrain_getglyph(x, y, FALSE, u.uswallow,
default_glyph, subset); default_glyph, subset);
map_glyphmod(x, y, glyph, 0, glyphmod); map_glyphinfo(x, y, glyph, 0, &glyphinfo);
ch = (int) glyphmod[GM_TTYCHAR]; ch = glyphinfo.ttychar;
buf[x - 1] = ch; buf[x - 1] = ch;
if (ch != ' ') { if (ch != ' ') {
blankrow = FALSE; blankrow = FALSE;
+78 -68
View File
@@ -132,8 +132,8 @@ static void FDECL(display_warning, (struct monst *));
static int FDECL(check_pos, (int, int, int)); static int FDECL(check_pos, (int, int, int));
static int FDECL(get_bk_glyph, (XCHAR_P, XCHAR_P)); static int FDECL(get_bk_glyph, (XCHAR_P, XCHAR_P));
static int FDECL(tether_glyph, (int, int)); static int FDECL(tether_glyph, (int, int));
#ifdef UNBUFFERED_GLYPHMOD #ifdef UNBUFFERED_GLYPHINFO
static unsigned *FDECL(glyphmod_at, (XCHAR_P, XCHAR_P, int)); static glyph_info *FDECL(glyphinfo_at, (XCHAR_P, XCHAR_P, int));
#endif #endif
/*#define WA_VERBOSE*/ /* give (x,y) locations for all "bad" spots */ /*#define WA_VERBOSE*/ /* give (x,y) locations for all "bad" spots */
@@ -1370,16 +1370,16 @@ see_traps()
} }
} }
static unsigned no_gm[NUM_GLYPHMOD] = { static glyph_info no_ginfo = {
MG_BADXY, (unsigned) ' ', (unsigned) NO_COLOR NO_GLYPH, 0, NO_COLOR, ' ', MG_BADXY
}; };
#ifndef UNBUFFERED_GLYPHMOD #ifndef UNBUFFERED_GLYPHINFO
#define Glyphmod_at(x, y, glyph) \ #define Glyphinfo_at(x, y, glyph) \
(((x) < 0 || (y) < 0 || (x) >= COLNO || (y) >= ROWNO) ? &no_gm[0] \ (((x) < 0 || (y) < 0 || (x) >= COLNO || (y) >= ROWNO) ? &no_ginfo \
: &g.gbuf[(y)][(x)].glyphmod[0]) : &g.gbuf[(y)][(x)].glyphinfo)
#else #else
static unsigned gm[NUM_GLYPHMOD]; static glyph_info ginfo;
#define Glyphmod_at(x, y, glyph) glyphmod_at(x, y, glyph) #define Glyphinfo_at(x, y, glyph) glyphinfo_at(x, y, glyph)
#endif #endif
/* /*
@@ -1457,6 +1457,7 @@ void
redraw_map() redraw_map()
{ {
int x, y, glyph; int x, y, glyph;
glyph_info bkglyphinfo = nul_glyphinfo;
/* /*
* Not sure whether this is actually necessary; save and restore did * Not sure whether this is actually necessary; save and restore did
@@ -1477,8 +1478,9 @@ redraw_map()
for (y = 0; y < ROWNO; ++y) for (y = 0; y < ROWNO; ++y)
for (x = 1; x < COLNO; ++x) { for (x = 1; x < COLNO; ++x) {
glyph = glyph_at(x, y); /* not levl[x][y].glyph */ glyph = glyph_at(x, y); /* not levl[x][y].glyph */
print_glyph(WIN_MAP, x, y, glyph, get_bk_glyph(x, y), bkglyphinfo.glyph = get_bk_glyph(x, y);
Glyphmod_at(x, y, glyph)); print_glyph(WIN_MAP, x, y,
Glyphinfo_at(x, y, glyph), &bkglyphinfo);
} }
flush_screen(1); flush_screen(1);
} }
@@ -1540,8 +1542,8 @@ void
show_glyph(x, y, glyph) show_glyph(x, y, glyph)
int x, y, glyph; int x, y, glyph;
{ {
#ifndef UNBUFFERED_GLYPHMOD #ifndef UNBUFFERED_GLYPHINFO
unsigned glyphmod[NUM_GLYPHMOD]; glyph_info glyphinfo;
#endif #endif
/* /*
@@ -1608,26 +1610,27 @@ int x, y, glyph;
MAX_GLYPH, x, y); MAX_GLYPH, x, y);
return; return;
} }
#ifndef UNBUFFERED_GLYPHMOD #ifndef UNBUFFERED_GLYPHINFO
/* without UNBUFFERED_GLYPHMOD defined the glyphmod values are buffered /* without UNBUFFERED_GLYPHINFO defined the glyphinfo values are buffered
alongside the glyphs themselves for better performance, increased alongside the glyphs themselves for better performance, increased
buffer size */ buffer size */
map_glyphmod(x, y, glyph, 0, glyphmod); map_glyphinfo(x, y, glyph, 0, &glyphinfo);
#endif #endif
if (g.gbuf[y][x].glyph != glyph if (g.gbuf[y][x].glyph != glyph
#ifndef UNBUFFERED_GLYPHMOD #ifndef UNBUFFERED_GLYPHINFO
/* I don't think we have to test for changes in TTYCHAR or COLOR /* I don't think we have to test for changes in TTYCHAR or COLOR
because they typically only change if the glyph changed */ because they typically only change if the glyph changed */
|| g.gbuf[y][x].glyphmod[GM_FLAGS] != glyphmod[GM_FLAGS] || g.gbuf[y][x].glyphinfo.glyphflags != glyphinfo.glyphflags
#endif #endif
|| iflags.use_background_glyph ) { || iflags.use_background_glyph ) {
g.gbuf[y][x].glyph = glyph; g.gbuf[y][x].glyph = glyph;
g.gbuf[y][x].gnew = 1; g.gbuf[y][x].gnew = 1;
#ifndef UNBUFFERED_GLYPHMOD #ifndef UNBUFFERED_GLYPHINFO
g.gbuf[y][x].glyphmod[GM_FLAGS] = glyphmod[GM_FLAGS]; g.gbuf[y][x].glyphinfo.glyph = glyphinfo.glyph;
g.gbuf[y][x].glyphmod[GM_TTYCHAR] = glyphmod[GM_TTYCHAR]; g.gbuf[y][x].glyphinfo.glyphflags = glyphinfo.glyphflags;
g.gbuf[y][x].glyphmod[GM_COLOR] = glyphmod[GM_COLOR]; g.gbuf[y][x].glyphinfo.ttychar = glyphinfo.ttychar;
g.gbuf[y][x].glyphinfo.color = glyphinfo.color;
#endif #endif
if (g.gbuf_start[y] > x) if (g.gbuf_start[y] > x)
g.gbuf_start[y] = x; g.gbuf_start[y] = x;
@@ -1653,7 +1656,7 @@ int x, y, glyph;
static gbuf_entry nul_gbuf = { static gbuf_entry nul_gbuf = {
0, /* gnew */ 0, /* gnew */
GLYPH_UNEXPLORED, /* glyph */ GLYPH_UNEXPLORED, /* glyph */
#ifndef UNBUFFERED_GLYPHMOD #ifndef UNBUFFERED_GLYPHINFO
{(unsigned) ' ', (unsigned) NO_COLOR, MG_UNEXPL}, {(unsigned) ' ', (unsigned) NO_COLOR, MG_UNEXPL},
#endif #endif
}; };
@@ -1666,22 +1669,22 @@ clear_glyph_buffer()
{ {
register int x, y; register int x, y;
gbuf_entry *gptr = &g.gbuf[0][0]; gbuf_entry *gptr = &g.gbuf[0][0];
unsigned *gmptr = glyph_info *giptr =
#ifndef UNBUFFERED_GLYPHMOD #ifndef UNBUFFERED_GLYPHINFO
&gptr->glyphmod[0]; &gptr->glyphinfo;
#else #else
&gm[0]; &ginfo;
map_glyphmod(0, 0, GLYPH_UNEXPLORED, 0, gmptr); map_glyphinfo(0, 0, GLYPH_UNEXPLORED, 0, giptr);
#endif #endif
#ifndef UNBUFFERED_GLYPHMOD #ifndef UNBUFFERED_GLYPHINFO
nul_gbuf.gnew = (gmptr[GM_TTYCHAR] != nul_gbuf.glyphmod[GM_TTYCHAR] nul_gbuf.gnew = (giptr->ttychar != nul_gbuf.glyphinfo.ttychar
|| gmptr[GM_COLOR] != nul_gbuf.glyphmod[GM_COLOR] || giptr->color != nul_gbuf.glyphinfo.color
|| gmptr[GM_FLAGS] != nul_gbuf.glyphmod[GM_FLAGS]) || giptr->glyphflags != nul_gbuf.glyphinfo.glyphflags)
#else #else
nul_gbuf.gnew = (gmptr[GM_TTYCHAR] != ' ' nul_gbuf.gnew = (giptr->ttychar != ' '
|| gmptr[GM_COLOR] != NO_COLOR || giptr->color != NO_COLOR
|| (gmptr[GM_FLAGS] & ~MG_UNEXPL) != 0) || (giptr->glyphflags & ~MG_UNEXPL) != 0)
#endif #endif
? 1 : 0; ? 1 : 0;
for (y = 0; y < ROWNO; y++) { for (y = 0; y < ROWNO; y++) {
@@ -1703,30 +1706,33 @@ int start, stop, y;
register int x, glyph; register int x, glyph;
register boolean force; register boolean force;
gbuf_entry *gptr = &g.gbuf[0][0]; gbuf_entry *gptr = &g.gbuf[0][0];
unsigned *gmptr = glyph_info bkglyphinfo = nul_glyphinfo;
#ifndef UNBUFFERED_GLYPHMOD glyph_info *giptr =
&gptr->glyphmod[0]; #ifndef UNBUFFERED_GLYPHINFO
&gptr->glyphinfo;
#else #else
&gm[0]; &ginfo;
map_glyphmod(0, 0, GLYPH_UNEXPLORED, 0, gmptr); map_glyphinfo(0, 0, GLYPH_UNEXPLORED, 0U, giptr);
#endif #endif
#ifndef UNBUFFERED_GLYPHMOD #ifndef UNBUFFERED_GLYPHINFO
force = (gmptr[GM_TTYCHAR] != nul_gbuf.glyphmod[GM_TTYCHAR] force = (giptr->ttychar != nul_gbuf.glyphinfo.ttychar
|| gmptr[GM_COLOR] != nul_gbuf.glyphmod[GM_COLOR] || giptr->color != nul_gbuf.glyphinfo.color
|| gmptr[GM_FLAGS] != nul_gbuf.glyphmod[GM_FLAGS]) || giptr->glyphflags != nul_gbuf.glyphinfo.glyphflags)
#else #else
force = (gmptr[GM_TTYCHAR] != ' ' force = (giptr->ttychar != ' '
|| gmptr[GM_COLOR] != NO_COLOR || giptr->color != NO_COLOR
|| (gmptr[GM_FLAGS] & ~MG_UNEXPL) != 0) || (giptr->glyphflags & ~MG_UNEXPL) != 0)
#endif #endif
? 1 : 0; ? 1 : 0;
for (x = start; x <= stop; x++) { for (x = start; x <= stop; x++) {
gptr = &g.gbuf[y][x]; gptr = &g.gbuf[y][x];
glyph = gptr->glyph; glyph = gptr->glyph;
if (force || glyph != GLYPH_UNEXPLORED) if (force || glyph != GLYPH_UNEXPLORED) {
print_glyph(WIN_MAP, x, y, glyph, bkglyphinfo.glyph = get_bk_glyph(x, y);
get_bk_glyph(x, y), Glyphmod_at(x, y, glyph)); print_glyph(WIN_MAP, x, y,
Glyphinfo_at(x, y, glyph), &bkglyphinfo);
}
} }
} }
@@ -1759,6 +1765,7 @@ int cursor_on_u;
static int flushing = 0; static int flushing = 0;
static int delay_flushing = 0; static int delay_flushing = 0;
register int x, y; register int x, y;
glyph_info bkglyphinfo = nul_glyphinfo;
/* 3.7: don't update map, status, or perm_invent during save/restore */ /* 3.7: don't update map, status, or perm_invent during save/restore */
if (g.program_state.saving || g.program_state.restoring) if (g.program_state.saving || g.program_state.restoring)
@@ -1781,8 +1788,9 @@ int cursor_on_u;
for (; x <= g.gbuf_stop[y]; gptr++, x++) for (; x <= g.gbuf_stop[y]; gptr++, x++)
if (gptr->gnew) { if (gptr->gnew) {
print_glyph(WIN_MAP, x, y, gptr->glyph, bkglyphinfo.glyph = get_bk_glyph(x, y);
get_bk_glyph(x, y), Glyphmod_at(x, y, gptr->glyph)); print_glyph(WIN_MAP, x, y,
Glyphinfo_at(x, y, gptr->glyph), &bkglyphinfo);
gptr->gnew = 0; gptr->gnew = 0;
} }
} }
@@ -2000,14 +2008,14 @@ xchar x, y;
return g.gbuf[y][x].glyph; return g.gbuf[y][x].glyph;
} }
#ifdef UNBUFFERED_GLYPHMOD #ifdef UNBUFFERED_GLYPHINFO
unsigned * glyph_info *
glyphmod_at(x, y, glyph) glyphinfo_at(x, y, glyph)
xchar x, y; xchar x, y;
int glyph; int glyph;
{ {
map_glyphmod(x, y, glyph, 0, gm); map_glyphinfo(x, y, glyph, 0, &ginfo);
return &gm[0]; return &ginfo;
} }
#endif #endif
@@ -2133,10 +2141,11 @@ static const int explcolors[] = {
#define GMAP_ALTARCOLOR 0x00000004 #define GMAP_ALTARCOLOR 0x00000004
void void
map_glyphmod(x, y, glyph, mgflags, glyphmod) map_glyphinfo(x, y, glyph, mgflags, glyphinfo)
xchar x, y; xchar x, y;
int glyph; int glyph;
unsigned mgflags, *glyphmod; unsigned mgflags;
glyph_info *glyphinfo;
{ {
register int offset, idx; register int offset, idx;
int color = NO_COLOR; int color = NO_COLOR;
@@ -2151,9 +2160,10 @@ unsigned mgflags, *glyphmod;
do_mon_checks = FALSE; do_mon_checks = FALSE;
if (x < 0 || y < 0 || x >= COLNO || y >= ROWNO) { if (x < 0 || y < 0 || x >= COLNO || y >= ROWNO) {
glyphmod[GM_FLAGS] = MG_BADXY; glyphinfo->glyph = NO_GLYPH;
glyphmod[GM_COLOR] = NO_COLOR; glyphinfo->glyphflags = MG_BADXY;
glyphmod[GM_TTYCHAR] = ' '; glyphinfo->color = NO_COLOR;
glyphinfo->ttychar = ' ';
return; return;
} }
@@ -2426,17 +2436,17 @@ unsigned mgflags, *glyphmod;
} }
} }
glyphmod[GM_TTYCHAR] = ((mgflags & MG_FLAG_RETURNIDX) != 0) ? idx glyphinfo->symidx = idx;
: g.showsyms[idx]; glyphinfo->ttychar = g.showsyms[idx];
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
/* Turn off color if no color defined, or rogue level w/o PC graphics. */ /* Turn off color if no color defined, or rogue level w/o PC graphics. */
if (!has_color(color) if (!has_color(color)
|| ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL) && !has_rogue_color)) || ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL) && !has_rogue_color))
#endif #endif
color = NO_COLOR; color = NO_COLOR;
glyphmod[GM_COLOR] = color; glyphinfo->color = color;
glyphmod[GM_FLAGS] = special; glyphinfo->glyphflags = special;
glyphinfo->glyph = glyph;
} }
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
+1 -1
View File
@@ -1617,7 +1617,7 @@ boolean at_stairs, falling, portal;
/* Reset the screen. */ /* Reset the screen. */
vision_reset(); /* reset the blockages */ vision_reset(); /* reset the blockages */
g.glyphmap_perlevel_flags = 0L; /* force per-level map_glyphmod() changes */ g.glyphmap_perlevel_flags = 0L; /* force per-level map_glyphinfo() changes */
docrt(); /* does a full vision recalc */ docrt(); /* does a full vision recalc */
flush_screen(-1); flush_screen(-1);
+19 -14
View File
@@ -612,8 +612,8 @@ int gloc;
iflags.getpos_coords); iflags.getpos_coords);
Sprintf(fullbuf, "%s%s%s", firstmatch, Sprintf(fullbuf, "%s%s%s", firstmatch,
(*tmpbuf ? " " : ""), tmpbuf); (*tmpbuf ? " " : ""), tmpbuf);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, fullbuf, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, fullbuf, MENU_ITEMFLAGS_NONE);
} }
} }
@@ -1364,27 +1364,32 @@ docallcmd()
start_menu(win, MENU_BEHAVE_STANDARD); start_menu(win, MENU_BEHAVE_STANDARD);
any = cg.zeroany; any = cg.zeroany;
any.a_char = 'm'; /* group accelerator 'C' */ any.a_char = 'm'; /* group accelerator 'C' */
add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, 'C', ATR_NONE, add_menu(win, &nul_glyphinfo, &any, abc ? 0 : any.a_char, 'C',
"a monster", MENU_ITEMFLAGS_NONE); ATR_NONE, "a monster", MENU_ITEMFLAGS_NONE);
if (g.invent) { if (g.invent) {
/* we use y and n as accelerators so that we can accept user's /* we use y and n as accelerators so that we can accept user's
response keyed to old "name an individual object?" prompt */ response keyed to old "name an individual object?" prompt */
any.a_char = 'i'; /* group accelerator 'y' */ any.a_char = 'i'; /* group accelerator 'y' */
add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, 'y', ATR_NONE, add_menu(win, &nul_glyphinfo, &any, abc ? 0 : any.a_char, 'y',
"a particular object in inventory", MENU_ITEMFLAGS_NONE); ATR_NONE, "a particular object in inventory",
MENU_ITEMFLAGS_NONE);
any.a_char = 'o'; /* group accelerator 'n' */ any.a_char = 'o'; /* group accelerator 'n' */
add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, 'n', ATR_NONE, add_menu(win, &nul_glyphinfo, &any, abc ? 0 : any.a_char, 'n',
"the type of an object in inventory", MENU_ITEMFLAGS_NONE); ATR_NONE, "the type of an object in inventory",
MENU_ITEMFLAGS_NONE);
} }
any.a_char = 'f'; /* group accelerator ',' (or ':' instead?) */ any.a_char = 'f'; /* group accelerator ',' (or ':' instead?) */
add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, ',', ATR_NONE, add_menu(win, &nul_glyphinfo, &any, abc ? 0 : any.a_char, ',',
"the type of an object upon the floor", MENU_ITEMFLAGS_NONE); ATR_NONE, "the type of an object upon the floor",
MENU_ITEMFLAGS_NONE);
any.a_char = 'd'; /* group accelerator '\' */ any.a_char = 'd'; /* group accelerator '\' */
add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, '\\', ATR_NONE, add_menu(win, &nul_glyphinfo, &any, abc ? 0 : any.a_char, '\\',
"the type of an object on discoveries list", MENU_ITEMFLAGS_NONE); ATR_NONE, "the type of an object on discoveries list",
MENU_ITEMFLAGS_NONE);
any.a_char = 'a'; /* group accelerator 'l' */ any.a_char = 'a'; /* group accelerator 'l' */
add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, 'l', ATR_NONE, add_menu(win, &nul_glyphinfo, &any, abc ? 0 : any.a_char, 'l',
"record an annotation for the current level", MENU_ITEMFLAGS_NONE); ATR_NONE, "record an annotation for the current level",
MENU_ITEMFLAGS_NONE);
end_menu(win, "What do you want to name?"); end_menu(win, "What do you want to name?");
if (select_menu(win, PICK_ONE, &pick_list) > 0) { if (select_menu(win, PICK_ONE, &pick_list) > 0) {
ch = pick_list[0].item.a_char; ch = pick_list[0].item.a_char;
+4 -4
View File
@@ -152,7 +152,7 @@ const struct symdef defsyms[MAXPCHARS] = {
{ '.', "floor of a room", C(CLR_GRAY) }, /* room */ { '.', "floor of a room", C(CLR_GRAY) }, /* room */
/*20*/ { '.', "dark part of a room", C(CLR_BLACK) }, /* dark room */ /*20*/ { '.', "dark part of a room", C(CLR_BLACK) }, /* dark room */
{ '#', "corridor", C(CLR_GRAY) }, /* dark corr */ { '#', "corridor", C(CLR_GRAY) }, /* dark corr */
{ '#', "lit corridor", C(CLR_GRAY) }, /* lit corr, see map_glyphmod() */ { '#', "lit corridor", C(CLR_GRAY) }, /* lit corr, see map_glyphinfo() */
{ '<', "staircase up", C(CLR_GRAY) }, /* upstair */ { '<', "staircase up", C(CLR_GRAY) }, /* upstair */
{ '>', "staircase down", C(CLR_GRAY) }, /* dnstair */ { '>', "staircase down", C(CLR_GRAY) }, /* dnstair */
{ '<', "ladder up", C(CLR_BROWN) }, /* upladder */ { '<', "ladder up", C(CLR_BROWN) }, /* upladder */
@@ -195,7 +195,7 @@ const struct symdef defsyms[MAXPCHARS] = {
{ '^', "anti-magic field", C(HI_ZAP) }, /* trap */ { '^', "anti-magic field", C(HI_ZAP) }, /* trap */
{ '^', "polymorph trap", C(CLR_BRIGHT_GREEN) }, /* trap */ { '^', "polymorph trap", C(CLR_BRIGHT_GREEN) }, /* trap */
{ '~', "vibrating square", C(CLR_MAGENTA) }, /* "trap" */ { '~', "vibrating square", C(CLR_MAGENTA) }, /* "trap" */
/* zap colors are changed by map_glyphmod() to match type of beam */ /* zap colors are changed by map_glyphinfo() to match type of beam */
{ '|', "", C(CLR_GRAY) }, /* vbeam */ { '|', "", C(CLR_GRAY) }, /* vbeam */
{ '-', "", C(CLR_GRAY) }, /* hbeam */ { '-', "", C(CLR_GRAY) }, /* hbeam */
{ '\\', "", C(CLR_GRAY) }, /* lslant */ { '\\', "", C(CLR_GRAY) }, /* lslant */
@@ -210,7 +210,7 @@ const struct symdef defsyms[MAXPCHARS] = {
{ '*', "", C(HI_ZAP) }, { '*', "", C(HI_ZAP) },
{ '#', "poison cloud", C(CLR_BRIGHT_GREEN) }, /* part of a cloud */ { '#', "poison cloud", C(CLR_BRIGHT_GREEN) }, /* part of a cloud */
{ '?', "valid position", C(CLR_BRIGHT_GREEN) }, /* target position */ { '?', "valid position", C(CLR_BRIGHT_GREEN) }, /* target position */
/* swallow colors are changed by map_glyphmod() to match engulfing monst */ /* swallow colors are changed by map_glyphinfo() to match engulfing monst */
{ '/', "", C(CLR_GREEN) }, /* swallow top left */ { '/', "", C(CLR_GREEN) }, /* swallow top left */
{ '-', "", C(CLR_GREEN) }, /* swallow top center */ { '-', "", C(CLR_GREEN) }, /* swallow top center */
{ '\\', "", C(CLR_GREEN) }, /* swallow top right */ { '\\', "", C(CLR_GREEN) }, /* swallow top right */
@@ -219,7 +219,7 @@ const struct symdef defsyms[MAXPCHARS] = {
{ '\\', "", C(CLR_GREEN) }, /* swallow bottom left */ { '\\', "", C(CLR_GREEN) }, /* swallow bottom left */
{ '-', "", C(CLR_GREEN) }, /* swallow bottom center */ { '-', "", C(CLR_GREEN) }, /* swallow bottom center */
{ '/', "", C(CLR_GREEN) }, /* swallow bottom right */ { '/', "", C(CLR_GREEN) }, /* swallow bottom right */
/* explosion colors are changed by map_glyphmod() to match type of expl. */ /* explosion colors are changed by map_glyphinfo() to match type of expl. */
{ '/', "", C(CLR_ORANGE) }, /* explosion top left */ { '/', "", C(CLR_ORANGE) }, /* explosion top left */
{ '-', "", C(CLR_ORANGE) }, /* explosion top center */ { '-', "", C(CLR_ORANGE) }, /* explosion top center */
{ '\\', "", C(CLR_ORANGE) }, /* explosion top right */ { '\\', "", C(CLR_ORANGE) }, /* explosion top right */
+4 -4
View File
@@ -2183,8 +2183,8 @@ boolean unreachable;
} else { } else {
any.a_int = lchoices->idx + 1; any.a_int = lchoices->idx + 1;
} }
add_menu(win, NO_GLYPH, &any, lchoices->menuletter, 0, ATR_NONE, entry, add_menu(win, &nul_glyphinfo, &any, lchoices->menuletter, 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, entry, MENU_ITEMFLAGS_NONE);
/* this assumes there are at most 52 interesting levels */ /* this assumes there are at most 52 interesting levels */
if (lchoices->menuletter == 'z') if (lchoices->menuletter == 'z')
lchoices->menuletter = 'A'; lchoices->menuletter = 'A';
@@ -2295,8 +2295,8 @@ xchar *rdgn;
} }
if (bymenu) { if (bymenu) {
any = cg.zeroany; any = cg.zeroany;
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, buf, add_menu(win, &nul_glyphinfo, &any, 0, 0,
MENU_ITEMFLAGS_NONE); iflags.menu_headings, buf, MENU_ITEMFLAGS_NONE);
} else } else
putstr(win, 0, buf); putstr(win, 0, buf);
+3 -2
View File
@@ -63,7 +63,7 @@ const char *buf;
anything any; anything any;
any = cg.zeroany; any = cg.zeroany;
add_menu(g.en_win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, add_menu(g.en_win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
} else } else
putstr(g.en_win, 0, buf); putstr(g.en_win, 0, buf);
@@ -2307,7 +2307,8 @@ set_vanq_order()
if (i == VANQ_ALPHA_MIX || i == VANQ_MCLS_HTOL) /* skip these */ if (i == VANQ_ALPHA_MIX || i == VANQ_MCLS_HTOL) /* skip these */
continue; continue;
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, vanqorders[i], add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
vanqorders[i],
(i == g.vanq_sortmode) (i == g.vanq_sortmode)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
} }
+33 -21
View File
@@ -2747,9 +2747,10 @@ long *out_cnt;
Sprintf(eos(prompt), Sprintf(eos(prompt),
" -- unidentified or partially identified item%s", " -- unidentified or partially identified item%s",
plur(unid_cnt)); plur(unid_cnt));
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, prompt, MENU_ITEMFLAGS_NONE); add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, prompt,
MENU_ITEMFLAGS_NONE);
if (!unid_cnt) { if (!unid_cnt) {
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"(all items are permanently identified already)", "(all items are permanently identified already)",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
gotsomething = TRUE; gotsomething = TRUE;
@@ -2765,23 +2766,27 @@ long *out_cnt;
if (unid_cnt > 1) if (unid_cnt > 1)
Sprintf(eos(prompt), " (%s for all)", Sprintf(eos(prompt), " (%s for all)",
visctrl(iflags.override_ID)); visctrl(iflags.override_ID));
add_menu(win, NO_GLYPH, &any, '_', iflags.override_ID, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, '_', iflags.override_ID,
prompt, MENU_ITEMFLAGS_NONE); ATR_NONE, prompt, MENU_ITEMFLAGS_NONE);
gotsomething = TRUE; gotsomething = TRUE;
} }
} else if (xtra_choice) { } else if (xtra_choice) {
/* wizard override ID and xtra_choice are mutually exclusive */ /* wizard override ID and xtra_choice are mutually exclusive */
if (flags.sortpack) if (flags.sortpack)
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, add_menu(win, &nul_glyphinfo, &any, 0, 0,
"Miscellaneous", MENU_ITEMFLAGS_NONE); iflags.menu_headings,
"Miscellaneous", MENU_ITEMFLAGS_NONE);
any.a_char = HANDS_SYM; /* '-' */ any.a_char = HANDS_SYM; /* '-' */
add_menu(win, NO_GLYPH, &any, HANDS_SYM, 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, HANDS_SYM, 0, ATR_NONE,
xtra_choice, MENU_ITEMFLAGS_NONE); xtra_choice, MENU_ITEMFLAGS_NONE);
gotsomething = TRUE; gotsomething = TRUE;
} }
nextclass: nextclass:
classcount = 0; classcount = 0;
for (srtinv = sortedinvent; (otmp = srtinv->obj) != 0; ++srtinv) { for (srtinv = sortedinvent; (otmp = srtinv->obj) != 0; ++srtinv) {
int tmpglyph;
glyph_info tmpglyphinfo = nul_glyphinfo;
if (lets && !index(lets, otmp->invlet)) if (lets && !index(lets, otmp->invlet))
continue; continue;
if (!flags.sortpack || otmp->oclass == *invlet) { if (!flags.sortpack || otmp->oclass == *invlet) {
@@ -2790,7 +2795,8 @@ long *out_cnt;
any = cg.zeroany; /* all bits zero */ any = cg.zeroany; /* all bits zero */
ilet = otmp->invlet; ilet = otmp->invlet;
if (flags.sortpack && !classcount) { if (flags.sortpack && !classcount) {
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, add_menu(win, &nul_glyphinfo, &any, 0, 0,
iflags.menu_headings,
let_to_name(*invlet, FALSE, let_to_name(*invlet, FALSE,
(want_reply && iflags.menu_head_objsym)), (want_reply && iflags.menu_head_objsym)),
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
@@ -2800,7 +2806,9 @@ long *out_cnt;
any.a_obj = otmp; any.a_obj = otmp;
else else
any.a_char = ilet; any.a_char = ilet;
add_menu(win, obj_to_glyph(otmp, rn2_on_display_rng), &any, ilet, tmpglyph = obj_to_glyph(otmp, rn2_on_display_rng);
map_glyphinfo(0, 0, tmpglyph, 0U, &tmpglyphinfo);
add_menu(win, &tmpglyphinfo, &any, ilet,
wizid ? def_oc_syms[(int) otmp->oclass].sym : 0, wizid ? def_oc_syms[(int) otmp->oclass].sym : 0,
ATR_NONE, doname(otmp), MENU_ITEMFLAGS_NONE); ATR_NONE, doname(otmp), MENU_ITEMFLAGS_NONE);
gotsomething = TRUE; gotsomething = TRUE;
@@ -2816,10 +2824,10 @@ long *out_cnt;
} }
if (iflags.force_invmenu && lets && want_reply) { if (iflags.force_invmenu && lets && want_reply) {
any = cg.zeroany; any = cg.zeroany;
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, add_menu(win, &nul_glyphinfo, &any, 0, 0,
"Special", MENU_ITEMFLAGS_NONE); iflags.menu_headings, "Special", MENU_ITEMFLAGS_NONE);
any.a_char = '*'; any.a_char = '*';
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, '*', 0, ATR_NONE,
"(list everything)", MENU_ITEMFLAGS_NONE); "(list everything)", MENU_ITEMFLAGS_NONE);
gotsomething = TRUE; gotsomething = TRUE;
} }
@@ -2830,7 +2838,7 @@ long *out_cnt;
into the menu */ into the menu */
if (iflags.perm_invent && !lets && !gotsomething) { if (iflags.perm_invent && !lets && !gotsomething) {
any = cg.zeroany; any = cg.zeroany;
add_menu(win, NO_GLYPH, &any, 0, 0, 0, add_menu(win, &nul_glyphinfo, &any, 0, 0, 0,
not_carrying_anything, MENU_ITEMFLAGS_NONE); not_carrying_anything, MENU_ITEMFLAGS_NONE);
want_reply = FALSE; want_reply = FALSE;
} }
@@ -2896,7 +2904,8 @@ char avoidlet;
struct obj *otmp; struct obj *otmp;
char ilet, ret = 0; char ilet, ret = 0;
char *invlet = flags.inv_order; char *invlet = flags.inv_order;
int n, classcount, invdone = 0; int n, classcount, invdone = 0, tmpglyph;
glyph_info tmpglyphinfo = nul_glyphinfo;
winid win; winid win;
anything any; anything any;
menu_item *selected; menu_item *selected;
@@ -2914,16 +2923,17 @@ char avoidlet;
if (!flags.sortpack || otmp->oclass == *invlet) { if (!flags.sortpack || otmp->oclass == *invlet) {
if (flags.sortpack && !classcount) { if (flags.sortpack && !classcount) {
any = cg.zeroany; /* zero */ any = cg.zeroany; /* zero */
add_menu(win, NO_GLYPH, &any, 0, 0, add_menu(win, &nul_glyphinfo, &any, 0, 0,
iflags.menu_headings, iflags.menu_headings,
let_to_name(*invlet, FALSE, FALSE), let_to_name(*invlet, FALSE, FALSE),
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
classcount++; classcount++;
} }
any.a_char = ilet; any.a_char = ilet;
add_menu(win, obj_to_glyph(otmp, rn2_on_display_rng), tmpglyph = obj_to_glyph(otmp, rn2_on_display_rng);
&any, ilet, 0, ATR_NONE, map_glyphinfo(0, 0, tmpglyph, 0U, &tmpglyphinfo);
doname(otmp), MENU_ITEMFLAGS_NONE); add_menu(win, &tmpglyphinfo, &any, ilet, 0,
ATR_NONE, doname(otmp), MENU_ITEMFLAGS_NONE);
} }
} }
if (flags.sortpack && *++invlet) if (flags.sortpack && *++invlet)
@@ -4383,10 +4393,12 @@ const char *hdr, *txt;
any = cg.zeroany; any = cg.zeroany;
win = create_nhwindow(NHW_MENU); win = create_nhwindow(NHW_MENU);
start_menu(win, MENU_BEHAVE_STANDARD); start_menu(win, MENU_BEHAVE_STANDARD);
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, hdr, add_menu(win, &nul_glyphinfo, &any, 0, 0, iflags.menu_headings,
hdr, MENU_ITEMFLAGS_NONE);
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"", MENU_ITEMFLAGS_NONE);
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, txt,
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, txt, MENU_ITEMFLAGS_NONE);
end_menu(win, (char *) 0); end_menu(win, (char *) 0);
if (select_menu(win, PICK_NONE, &selected) > 0) if (select_menu(win, PICK_NONE, &selected) > 0)
free((genericptr_t) selected); free((genericptr_t) selected);
+1 -1
View File
@@ -518,7 +518,7 @@ lua_State *L;
any = cg.zeroany; any = cg.zeroany;
if (*key) if (*key)
any.a_char = key[0]; any.a_char = key[0];
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, str, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, str,
(*defval && *key && defval[0] == key[0]) (*defval && *key && defval[0] == key[0])
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
+17 -13
View File
@@ -541,7 +541,8 @@ int mode; /* 0 => 'O' cmd, 1 => full discoveries; 2 => class discoveries */
any = cg.zeroany; /* zero out all bits */ any = cg.zeroany; /* zero out all bits */
for (i = 0; disco_orders_descr[i]; ++i) { for (i = 0; disco_orders_descr[i]; ++i) {
any.a_int = disco_order_let[i]; any.a_int = disco_order_let[i];
add_menu(tmpwin, NO_GLYPH, &any, (char) any.a_int, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, (char) any.a_int,
0, ATR_NONE,
disco_orders_descr[i], disco_orders_descr[i],
(disco_order_let[i] == flags.discosort) (disco_order_let[i] == flags.discosort)
? MENU_ITEMFLAGS_SELECTED ? MENU_ITEMFLAGS_SELECTED
@@ -552,15 +553,15 @@ int mode; /* 0 => 'O' cmd, 1 => full discoveries; 2 => class discoveries */
(only showing one class so can't span all classes) but the (only showing one class so can't span all classes) but the
chosen sort will stick and also apply to '\' usage */ chosen sort will stick and also apply to '\' usage */
any = cg.zeroany; any = cg.zeroany;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"", MENU_ITEMFLAGS_NONE); "", MENU_ITEMFLAGS_NONE);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"Note: full alphabetical and alphabetical within class", "Note: full alphabetical and alphabetical within class",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
" are equivalent for single class discovery, but", " are equivalent for single class discovery, but",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
" will matter for future use of total discoveries.", " will matter for future use of total discoveries.",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
} }
@@ -756,8 +757,8 @@ doclassdisco()
Strcat(discosyms, "u"); Strcat(discosyms, "u");
if (!traditional) { if (!traditional) {
any.a_int = 'u'; any.a_int = 'u';
add_menu(tmpwin, NO_GLYPH, &any, menulet++, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, menulet++,
unique_items, MENU_ITEMFLAGS_NONE); 0, ATR_NONE, unique_items, MENU_ITEMFLAGS_NONE);
} }
break; break;
} }
@@ -767,8 +768,8 @@ doclassdisco()
Strcat(discosyms, "a"); Strcat(discosyms, "a");
if (!traditional) { if (!traditional) {
any.a_int = 'a'; any.a_int = 'a';
add_menu(tmpwin, NO_GLYPH, &any, menulet++, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, menulet++,
artifact_items, MENU_ITEMFLAGS_NONE); 0, ATR_NONE, artifact_items, MENU_ITEMFLAGS_NONE);
} }
} }
@@ -788,8 +789,9 @@ doclassdisco()
Sprintf(eos(discosyms), "%c", c); Sprintf(eos(discosyms), "%c", c);
if (!traditional) { if (!traditional) {
any.a_int = c; any.a_int = c;
add_menu(tmpwin, NO_GLYPH, &any, menulet++, c, add_menu(tmpwin, &nul_glyphinfo, &any,
ATR_NONE, oclass_to_name(oclass, buf), menulet++, c, ATR_NONE,
oclass_to_name(oclass, buf),
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
} }
} }
@@ -950,13 +952,15 @@ rename_disco()
if (oclass != prev_class) { if (oclass != prev_class) {
any.a_int = 0; any.a_int = 0;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
iflags.menu_headings,
let_to_name(oclass, FALSE, FALSE), let_to_name(oclass, FALSE, FALSE),
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
prev_class = oclass; prev_class = oclass;
} }
any.a_int = dis; any.a_int = dis;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
ATR_NONE,
obj_typename(dis), MENU_ITEMFLAGS_NONE); obj_typename(dis), MENU_ITEMFLAGS_NONE);
} }
} }
+104 -79
View File
@@ -4766,8 +4766,8 @@ handler_menustyle()
/* note: separate `style_name' variable used /* note: separate `style_name' variable used
to avoid an optimizer bug in VAX C V2.3 */ to avoid an optimizer bug in VAX C V2.3 */
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, *style_name, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, *style_name, 0,
style_name, MENU_ITEMFLAGS_NONE); ATR_NONE, style_name, MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, "Select menustyle:"); end_menu(tmpwin, "Select menustyle:");
if (select_menu(tmpwin, PICK_ONE, &style_pick) > 0) { if (select_menu(tmpwin, PICK_ONE, &style_pick) > 0) {
@@ -4791,16 +4791,16 @@ int optidx;
start_menu(tmpwin, MENU_BEHAVE_STANDARD); start_menu(tmpwin, MENU_BEHAVE_STANDARD);
any = cg.zeroany; any = cg.zeroany;
any.a_int = ALIGN_TOP; any.a_int = ALIGN_TOP;
add_menu(tmpwin, NO_GLYPH, &any, 't', 0, ATR_NONE, "top", add_menu(tmpwin, &nul_glyphinfo, &any, 't', 0, ATR_NONE, "top",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
any.a_int = ALIGN_BOTTOM; any.a_int = ALIGN_BOTTOM;
add_menu(tmpwin, NO_GLYPH, &any, 'b', 0, ATR_NONE, "bottom", add_menu(tmpwin, &nul_glyphinfo, &any, 'b', 0, ATR_NONE, "bottom",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
any.a_int = ALIGN_LEFT; any.a_int = ALIGN_LEFT;
add_menu(tmpwin, NO_GLYPH, &any, 'l', 0, ATR_NONE, "left", add_menu(tmpwin, &nul_glyphinfo, &any, 'l', 0, ATR_NONE, "left",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
any.a_int = ALIGN_RIGHT; any.a_int = ALIGN_RIGHT;
add_menu(tmpwin, NO_GLYPH, &any, 'r', 0, ATR_NONE, "right", add_menu(tmpwin, &nul_glyphinfo, &any, 'r', 0, ATR_NONE, "right",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
Sprintf(abuf, "Select %s window placement relative to the map:", Sprintf(abuf, "Select %s window placement relative to the map:",
(optidx == opt_align_message) ? "message" : "status"); (optidx == opt_align_message) ? "message" : "status");
@@ -4841,8 +4841,8 @@ handler_disclose(VOID_ARGS)
Sprintf(buf, "%-12s[%c%c]", disclosure_names[i], Sprintf(buf, "%-12s[%c%c]", disclosure_names[i],
flags.end_disclose[i], disclosure_options[i]); flags.end_disclose[i], disclosure_options[i]);
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, disclosure_options[i], 0, add_menu(tmpwin, &nul_glyphinfo, &any, disclosure_options[i],
ATR_NONE, buf, MENU_ITEMFLAGS_NONE); 0, ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
disc_cat[i] = 0; disc_cat[i] = 0;
} }
end_menu(tmpwin, "Change which disclosure options categories:"); end_menu(tmpwin, "Change which disclosure options categories:");
@@ -4867,35 +4867,41 @@ handler_disclose(VOID_ARGS)
any = cg.zeroany; any = cg.zeroany;
/* 'y','n',and '+' work as alternate selectors; '-' doesn't */ /* 'y','n',and '+' work as alternate selectors; '-' doesn't */
any.a_char = DISCLOSE_NO_WITHOUT_PROMPT; any.a_char = DISCLOSE_NO_WITHOUT_PROMPT;
add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0,
any.a_char, ATR_NONE,
"Never disclose, without prompting", "Never disclose, without prompting",
(c == any.a_char) ? MENU_ITEMFLAGS_SELECTED (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED
: MENU_ITEMFLAGS_NONE); : MENU_ITEMFLAGS_NONE);
any.a_char = DISCLOSE_YES_WITHOUT_PROMPT; any.a_char = DISCLOSE_YES_WITHOUT_PROMPT;
add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0,
any.a_char, ATR_NONE,
"Always disclose, without prompting", "Always disclose, without prompting",
(c == any.a_char) ? MENU_ITEMFLAGS_SELECTED (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED
: MENU_ITEMFLAGS_NONE); : MENU_ITEMFLAGS_NONE);
if (*disclosure_names[i] == 'v') { if (*disclosure_names[i] == 'v') {
any.a_char = DISCLOSE_SPECIAL_WITHOUT_PROMPT; /* '#' */ any.a_char = DISCLOSE_SPECIAL_WITHOUT_PROMPT; /* '#' */
add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0,
any.a_char, ATR_NONE,
"Always disclose, pick sort order from menu", "Always disclose, pick sort order from menu",
(c == any.a_char) ? MENU_ITEMFLAGS_SELECTED (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED
: MENU_ITEMFLAGS_NONE); : MENU_ITEMFLAGS_NONE);
} }
any.a_char = DISCLOSE_PROMPT_DEFAULT_NO; any.a_char = DISCLOSE_PROMPT_DEFAULT_NO;
add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0,
any.a_char, ATR_NONE,
"Prompt, with default answer of \"No\"", "Prompt, with default answer of \"No\"",
(c == any.a_char) ? MENU_ITEMFLAGS_SELECTED (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED
: MENU_ITEMFLAGS_NONE); : MENU_ITEMFLAGS_NONE);
any.a_char = DISCLOSE_PROMPT_DEFAULT_YES; any.a_char = DISCLOSE_PROMPT_DEFAULT_YES;
add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0,
any.a_char, ATR_NONE,
"Prompt, with default answer of \"Yes\"", "Prompt, with default answer of \"Yes\"",
(c == any.a_char) ? MENU_ITEMFLAGS_SELECTED (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED
: MENU_ITEMFLAGS_NONE); : MENU_ITEMFLAGS_NONE);
if (*disclosure_names[i] == 'v') { if (*disclosure_names[i] == 'v') {
any.a_char = DISCLOSE_PROMPT_DEFAULT_SPECIAL; /* '?' */ any.a_char = DISCLOSE_PROMPT_DEFAULT_SPECIAL; /* '?' */
add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0,
any.a_char, ATR_NONE,
"Prompt, with default answer of \"Ask\" to request sort menu", "Prompt, with default answer of \"Ask\" to request sort menu",
(c == any.a_char) ? MENU_ITEMFLAGS_SELECTED (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED
: MENU_ITEMFLAGS_NONE); : MENU_ITEMFLAGS_NONE);
@@ -4940,18 +4946,18 @@ handler_msg_window(VOID_ARGS)
any = cg.zeroany; any = cg.zeroany;
if (!WINDOWPORT("curses")) { if (!WINDOWPORT("curses")) {
any.a_char = 's'; any.a_char = 's';
add_menu(tmpwin, NO_GLYPH, &any, 's', 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 's',
"single", MENU_ITEMFLAGS_NONE); 0, ATR_NONE, "single", MENU_ITEMFLAGS_NONE);
any.a_char = 'c'; any.a_char = 'c';
add_menu(tmpwin, NO_GLYPH, &any, 'c', 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 'c',
"combination", MENU_ITEMFLAGS_NONE); 0, ATR_NONE, "combination", MENU_ITEMFLAGS_NONE);
} }
any.a_char = 'f'; any.a_char = 'f';
add_menu(tmpwin, NO_GLYPH, &any, 'f', 0, ATR_NONE, "full", add_menu(tmpwin, &nul_glyphinfo, &any, 'f',
MENU_ITEMFLAGS_NONE); 0, ATR_NONE, "full", MENU_ITEMFLAGS_NONE);
any.a_char = 'r'; any.a_char = 'r';
add_menu(tmpwin, NO_GLYPH, &any, 'r', 0, ATR_NONE, "reversed", add_menu(tmpwin, &nul_glyphinfo, &any, 'r',
MENU_ITEMFLAGS_NONE); 0, ATR_NONE, "reversed", MENU_ITEMFLAGS_NONE);
end_menu(tmpwin, "Select message history display type:"); end_menu(tmpwin, "Select message history display type:");
if (select_menu(tmpwin, PICK_ONE, &window_pick) > 0) { if (select_menu(tmpwin, PICK_ONE, &window_pick) > 0) {
iflags.prevmsg_window = window_pick->item.a_char; iflags.prevmsg_window = window_pick->item.a_char;
@@ -4984,8 +4990,8 @@ handler_number_pad(VOID_ARGS)
any = cg.zeroany; any = cg.zeroany;
for (i = 0; i < SIZE(npchoices); i++) { for (i = 0; i < SIZE(npchoices); i++) {
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, 'a' + i, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 'a' + i,
npchoices[i], MENU_ITEMFLAGS_NONE); 0, ATR_NONE, npchoices[i], MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, "Select number_pad mode:"); end_menu(tmpwin, "Select number_pad mode:");
if (select_menu(tmpwin, PICK_ONE, &mode_pick) > 0) { if (select_menu(tmpwin, PICK_ONE, &mode_pick) > 0) {
@@ -5039,8 +5045,8 @@ handler_paranoid_confirmation(VOID_ARGS)
if (paranoia[i].flagmask == PARANOID_BONES && !wizard) if (paranoia[i].flagmask == PARANOID_BONES && !wizard)
continue; continue;
any.a_int = paranoia[i].flagmask; any.a_int = paranoia[i].flagmask;
add_menu(tmpwin, NO_GLYPH, &any, *paranoia[i].argname, 0, add_menu(tmpwin, &nul_glyphinfo, &any, *paranoia[i].argname,
ATR_NONE, paranoia[i].explain, 0, ATR_NONE, paranoia[i].explain,
(flags.paranoia_bits & paranoia[i].flagmask) (flags.paranoia_bits & paranoia[i].flagmask)
? MENU_ITEMFLAGS_SELECTED ? MENU_ITEMFLAGS_SELECTED
: MENU_ITEMFLAGS_NONE); : MENU_ITEMFLAGS_NONE);
@@ -5078,8 +5084,8 @@ handler_pickup_burden(VOID_ARGS)
for (i = 0; i < SIZE(burdentype); i++) { for (i = 0; i < SIZE(burdentype); i++) {
burden_name = burdentype[i]; burden_name = burdentype[i];
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, burden_letters[i], 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, burden_letters[i],
burden_name, MENU_ITEMFLAGS_NONE); 0, ATR_NONE, burden_name, MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, "Select encumbrance level:"); end_menu(tmpwin, "Select encumbrance level:");
if (select_menu(tmpwin, PICK_ONE, &burden_pick) > 0) { if (select_menu(tmpwin, PICK_ONE, &burden_pick) > 0) {
@@ -5116,8 +5122,8 @@ handler_runmode(VOID_ARGS)
for (i = 0; i < SIZE(runmodes); i++) { for (i = 0; i < SIZE(runmodes); i++) {
mode_name = runmodes[i]; mode_name = runmodes[i];
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, *mode_name, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, *mode_name,
mode_name, MENU_ITEMFLAGS_NONE); 0, ATR_NONE, mode_name, MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, "Select run/travel display mode:"); end_menu(tmpwin, "Select run/travel display mode:");
if (select_menu(tmpwin, PICK_ONE, &mode_pick) > 0) { if (select_menu(tmpwin, PICK_ONE, &mode_pick) > 0) {
@@ -5143,7 +5149,8 @@ handler_sortloot(VOID_ARGS)
for (i = 0; i < SIZE(sortltype); i++) { for (i = 0; i < SIZE(sortltype); i++) {
sortl_name = sortltype[i]; sortl_name = sortltype[i];
any.a_char = *sortl_name; any.a_char = *sortl_name;
add_menu(tmpwin, NO_GLYPH, &any, *sortl_name, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, *sortl_name,
0, ATR_NONE,
sortl_name, (flags.sortloot == *sortl_name) sortl_name, (flags.sortloot == *sortl_name)
? MENU_ITEMFLAGS_SELECTED ? MENU_ITEMFLAGS_SELECTED
: MENU_ITEMFLAGS_NONE); : MENU_ITEMFLAGS_NONE);
@@ -5176,38 +5183,42 @@ handler_whatis_coord(VOID_ARGS)
start_menu(tmpwin, MENU_BEHAVE_STANDARD); start_menu(tmpwin, MENU_BEHAVE_STANDARD);
any = cg.zeroany; any = cg.zeroany;
any.a_char = GPCOORDS_COMPASS; any.a_char = GPCOORDS_COMPASS;
add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_COMPASS, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, GPCOORDS_COMPASS,
0, ATR_NONE,
"compass ('east' or '3s' or '2n,4w')", "compass ('east' or '3s' or '2n,4w')",
(gp == GPCOORDS_COMPASS) (gp == GPCOORDS_COMPASS)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
any.a_char = GPCOORDS_COMFULL; any.a_char = GPCOORDS_COMFULL;
add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_COMFULL, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, GPCOORDS_COMFULL,
0, ATR_NONE,
"full compass ('east' or '3south' or '2north,4west')", "full compass ('east' or '3south' or '2north,4west')",
(gp == GPCOORDS_COMFULL) (gp == GPCOORDS_COMFULL)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
any.a_char = GPCOORDS_MAP; any.a_char = GPCOORDS_MAP;
add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_MAP, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, GPCOORDS_MAP,
"map <x,y>", 0, ATR_NONE, "map <x,y>",
(gp == GPCOORDS_MAP) (gp == GPCOORDS_MAP)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
any.a_char = GPCOORDS_SCREEN; any.a_char = GPCOORDS_SCREEN;
add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_SCREEN, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, GPCOORDS_SCREEN,
"screen [row,column]", 0, ATR_NONE, "screen [row,column]",
(gp == GPCOORDS_SCREEN) (gp == GPCOORDS_SCREEN)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
any.a_char = GPCOORDS_NONE; any.a_char = GPCOORDS_NONE;
add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_NONE, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, GPCOORDS_NONE,
"none (no coordinates displayed)", 0, ATR_NONE, "none (no coordinates displayed)",
(gp == GPCOORDS_NONE) (gp == GPCOORDS_NONE)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
any.a_long = 0L; any.a_long = 0L;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"", MENU_ITEMFLAGS_NONE);
Sprintf(buf, "map: upper-left: <%d,%d>, lower-right: <%d,%d>%s", Sprintf(buf, "map: upper-left: <%d,%d>, lower-right: <%d,%d>%s",
1, 0, COLNO - 1, ROWNO - 1, 1, 0, COLNO - 1, ROWNO - 1,
flags.verbose ? "; column 0 unused, off left edge" : ""); flags.verbose ? "; column 0 unused, off left edge" : "");
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_ITEMFLAGS_NONE); add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
if (strcmp(windowprocs.name, "tty")) /* only show for non-tty */ if (strcmp(windowprocs.name, "tty")) /* only show for non-tty */
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"screen: row is offset to accommodate tty interface's use of top line", "screen: row is offset to accommodate tty interface's use of top line",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
#if COLNO == 80 #if COLNO == 80
@@ -5218,8 +5229,10 @@ handler_whatis_coord(VOID_ARGS)
Sprintf(buf, "screen: upper-left: [%02d,%02d], lower-right: [%d,%d]%s", Sprintf(buf, "screen: upper-left: [%02d,%02d], lower-right: [%d,%d]%s",
0 + 2, 1, ROWNO - 1 + 2, COLNO - 1, COL80ARG); 0 + 2, 1, ROWNO - 1 + 2, COLNO - 1, COL80ARG);
#undef COL80ARG #undef COL80ARG
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_ITEMFLAGS_NONE); add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); buf, MENU_ITEMFLAGS_NONE);
add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"", MENU_ITEMFLAGS_NONE);
end_menu(tmpwin, end_menu(tmpwin,
"Select coordinate display when auto-describing a map position:"); "Select coordinate display when auto-describing a map position:");
if ((pick_cnt = select_menu(tmpwin, PICK_ONE, &window_pick)) > 0) { if ((pick_cnt = select_menu(tmpwin, PICK_ONE, &window_pick)) > 0) {
@@ -5247,17 +5260,17 @@ handler_whatis_filter(VOID_ARGS)
start_menu(tmpwin, MENU_BEHAVE_STANDARD); start_menu(tmpwin, MENU_BEHAVE_STANDARD);
any = cg.zeroany; any = cg.zeroany;
any.a_char = (GFILTER_NONE + 1); any.a_char = (GFILTER_NONE + 1);
add_menu(tmpwin, NO_GLYPH, &any, 'n', add_menu(tmpwin, &nul_glyphinfo, &any, 'n',
0, ATR_NONE, "no filtering", 0, ATR_NONE, "no filtering",
(gf == GFILTER_NONE) (gf == GFILTER_NONE)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
any.a_char = (GFILTER_VIEW + 1); any.a_char = (GFILTER_VIEW + 1);
add_menu(tmpwin, NO_GLYPH, &any, 'v', add_menu(tmpwin, &nul_glyphinfo, &any, 'v',
0, ATR_NONE, "in view only", 0, ATR_NONE, "in view only",
(gf == GFILTER_VIEW) (gf == GFILTER_VIEW)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
any.a_char = (GFILTER_AREA + 1); any.a_char = (GFILTER_AREA + 1);
add_menu(tmpwin, NO_GLYPH, &any, 'a', add_menu(tmpwin, &nul_glyphinfo, &any, 'a',
0, ATR_NONE, "in same area", 0, ATR_NONE, "in same area",
(gf == GFILTER_AREA) (gf == GFILTER_AREA)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
@@ -5337,7 +5350,7 @@ int optidx;
any.a_int = 1; /* -1 + 2 [see 'if (sl->name) {' below]*/ any.a_int = 1; /* -1 + 2 [see 'if (sl->name) {' below]*/
if (!symset_name) if (!symset_name)
defindx = any.a_int; defindx = any.a_int;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"Default Symbols", "Default Symbols",
(any.a_int == defindx) ? MENU_ITEMFLAGS_SELECTED (any.a_int == defindx) ? MENU_ITEMFLAGS_SELECTED
: MENU_ITEMFLAGS_NONE); : MENU_ITEMFLAGS_NONE);
@@ -5358,7 +5371,8 @@ int optidx;
if (symset_name && !strcmpi(sl->name, symset_name)) if (symset_name && !strcmpi(sl->name, symset_name))
defindx = any.a_int; defindx = any.a_int;
Sprintf(buf, fmtstr, sl->name, sl->desc ? sl->desc : ""); Sprintf(buf, fmtstr, sl->name, sl->desc ? sl->desc : "");
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
ATR_NONE, buf,
(any.a_int == defindx) ? MENU_ITEMFLAGS_SELECTED (any.a_int == defindx) ? MENU_ITEMFLAGS_SELECTED
: MENU_ITEMFLAGS_NONE); : MENU_ITEMFLAGS_NONE);
} }
@@ -5494,7 +5508,8 @@ handler_autopickup_exception(VOID_ARGS)
if (numapes) { if (numapes) {
ape = g.apelist; ape = g.apelist;
any = cg.zeroany; any = cg.zeroany;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
iflags.menu_headings,
"Always pickup '<'; never pickup '>'", "Always pickup '<'; never pickup '>'",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
for (i = 0; i < numapes && ape; i++) { for (i = 0; i < numapes && ape; i++) {
@@ -5503,8 +5518,8 @@ handler_autopickup_exception(VOID_ARGS)
less than BUFSZ */ less than BUFSZ */
Sprintf(apebuf, "\"%c%s\"", ape->grab ? '<' : '>', Sprintf(apebuf, "\"%c%s\"", ape->grab ? '<' : '>',
ape->pattern); ape->pattern);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, apebuf, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, apebuf, MENU_ITEMFLAGS_NONE);
ape = ape->next; ape = ape->next;
} }
} }
@@ -5602,8 +5617,8 @@ handler_menu_colors(VOID_ARGS)
Strcat(mcbuf, tmp->origstr); Strcat(mcbuf, tmp->origstr);
/* combine main string and suffix */ /* combine main string and suffix */
Strcat(mcbuf, &buf[1]); /* skip buf[]'s initial quote */ Strcat(mcbuf, &buf[1]); /* skip buf[]'s initial quote */
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, mcbuf, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, mcbuf, MENU_ITEMFLAGS_NONE);
tmp = tmp->next; tmp = tmp->next;
} }
Sprintf(mcbuf, "%s menu colors", Sprintf(mcbuf, "%s menu colors",
@@ -5672,8 +5687,8 @@ handler_msgtype(VOID_ARGS)
Strcat(strncat(mtbuf, tmp->pattern, ln - 3), "...\""); Strcat(strncat(mtbuf, tmp->pattern, ln - 3), "...\"");
else else
Strcat(strcat(mtbuf, tmp->pattern), "\""); Strcat(strcat(mtbuf, tmp->pattern), "\"");
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, mtbuf, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, mtbuf, MENU_ITEMFLAGS_NONE);
tmp = tmp->next; tmp = tmp->next;
} }
Sprintf(mtbuf, "%s message types", Sprintf(mtbuf, "%s message types",
@@ -6679,7 +6694,8 @@ const char *prompt;
if (!colornames[i].name) if (!colornames[i].name)
break; break;
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, colornames[i].name, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
ATR_NONE, colornames[i].name,
(colornames[i].color == NO_COLOR) ? MENU_ITEMFLAGS_SELECTED (colornames[i].color == NO_COLOR) ? MENU_ITEMFLAGS_SELECTED
: MENU_ITEMFLAGS_NONE); : MENU_ITEMFLAGS_NONE);
} }
@@ -6730,8 +6746,8 @@ const char *prompt;
if (!attrnames[i].name) if (!attrnames[i].name)
break; break;
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, attrnames[i].attr, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
attrnames[i].name, attrnames[i].attr, attrnames[i].name,
(attrnames[i].attr == default_attr) ? MENU_ITEMFLAGS_SELECTED (attrnames[i].attr == default_attr) ? MENU_ITEMFLAGS_SELECTED
: MENU_ITEMFLAGS_NONE); : MENU_ITEMFLAGS_NONE);
} }
@@ -6828,8 +6844,8 @@ query_msgtype()
for (i = 0; i < SIZE(msgtype_names); i++) for (i = 0; i < SIZE(msgtype_names); i++)
if (msgtype_names[i].descr) { if (msgtype_names[i].descr) {
any.a_int = msgtype_names[i].msgtyp + 1; any.a_int = msgtype_names[i].msgtyp + 1;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
msgtype_names[i].descr, MENU_ITEMFLAGS_NONE); ATR_NONE, msgtype_names[i].descr, MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, "How to show the message"); end_menu(tmpwin, "How to show the message");
pick_cnt = select_menu(tmpwin, PICK_ONE, &picks); pick_cnt = select_menu(tmpwin, PICK_ONE, &picks);
@@ -7537,7 +7553,7 @@ doset() /* changing options via menu by Per Liboriussen */
indexoffset = 1; indexoffset = 1;
any = cg.zeroany; any = cg.zeroany;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, iflags.menu_headings,
"Booleans (selecting will toggle value):", MENU_ITEMFLAGS_NONE); "Booleans (selecting will toggle value):", MENU_ITEMFLAGS_NONE);
any.a_int = 0; any.a_int = 0;
/* first list any other non-modifiable booleans, then modifiable ones */ /* first list any other non-modifiable booleans, then modifiable ones */
@@ -7562,13 +7578,14 @@ doset() /* changing options via menu by Per Liboriussen */
else else
Sprintf(buf, fmtstr_doset_tab, Sprintf(buf, fmtstr_doset_tab,
name, *bool_p ? "true" : "false"); name, *bool_p ? "true" : "false");
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
} }
any = cg.zeroany; any = cg.zeroany;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, iflags.menu_headings,
"Compounds (selecting will prompt for new value):", "Compounds (selecting will prompt for new value):",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
@@ -7599,9 +7616,10 @@ doset() /* changing options via menu by Per Liboriussen */
} }
any = cg.zeroany; any = cg.zeroany;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
"Other settings:", MENU_ITEMFLAGS_NONE); add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
iflags.menu_headings, "Other settings:", MENU_ITEMFLAGS_NONE);
for (i = 0; (name = othropt[i].name) != 0; i++) { for (i = 0; (name = othropt[i].name) != 0; i++) {
if ((is_wc_option(name) && !wc_supported(name)) if ((is_wc_option(name) && !wc_supported(name))
@@ -7613,8 +7631,10 @@ doset() /* changing options via menu by Per Liboriussen */
#ifdef PREFIXES_IN_USE #ifdef PREFIXES_IN_USE
any = cg.zeroany; any = cg.zeroany;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
iflags.menu_headings,
"Variable playground locations:", MENU_ITEMFLAGS_NONE); "Variable playground locations:", MENU_ITEMFLAGS_NONE);
for (i = 0; i < PREFIX_COUNT; i++) for (i = 0; i < PREFIX_COUNT; i++)
doset_add_menu(tmpwin, fqn_prefix_names[i], -1, 0); doset_add_menu(tmpwin, fqn_prefix_names[i], -1, 0);
@@ -7745,7 +7765,8 @@ int indexoffset; /* value to add to index in allopt[], or zero
value); value);
else else
Sprintf(buf, fmtstr_doset_tab, option, value); Sprintf(buf, fmtstr_doset_tab, option, value);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_ITEMFLAGS_NONE); add_menu(win, &nul_glyphinfo, &any, 0, 0,
ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
} }
static void static void
@@ -7769,7 +7790,8 @@ int nset;
name, buf2); name, buf2);
else else
Sprintf(buf, fmtstr_doset_tab, name, buf2); Sprintf(buf, fmtstr_doset_tab, name, buf2);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_ITEMFLAGS_NONE); add_menu(win, &nul_glyphinfo, &any, 0, 0,
ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
} }
/* display keys for menu actions; used by cmd.c '?i' and pager.c '?k' */ /* display keys for menu actions; used by cmd.c '?i' and pager.c '?k' */
@@ -7924,8 +7946,9 @@ int numtotal;
continue; continue;
Sprintf(tmpbuf, action_titles[i].desc, Sprintf(tmpbuf, action_titles[i].desc,
(i == 1) ? makeplural(optname) : optname); (i == 1) ? makeplural(optname) : optname);
add_menu(tmpwin, NO_GLYPH, &any, action_titles[i].letr, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo,&any, action_titles[i].letr,
tmpbuf, (i == 3) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); 0, ATR_NONE, tmpbuf,
(i == 3) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, "Do what?"); end_menu(tmpwin, "Do what?");
if ((pick_cnt = select_menu(tmpwin, PICK_ONE, &pick_list)) > 0) { if ((pick_cnt = select_menu(tmpwin, PICK_ONE, &pick_list)) > 0) {
@@ -8411,8 +8434,8 @@ char *class_select;
} }
} }
any.a_int = *class_list; any.a_int = *class_list;
add_menu(win, NO_GLYPH, &any, accelerator, category ? *class_list : 0, add_menu(win, &nul_glyphinfo, &any, accelerator,
ATR_NONE, buf, category ? *class_list : 0, ATR_NONE, buf,
selected ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); selected ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
++class_list; ++class_list;
if (category > 0) { if (category > 0) {
@@ -8426,13 +8449,15 @@ char *class_select;
if (category == 1 && next_accelerator <= 'z') { if (category == 1 && next_accelerator <= 'z') {
/* for objects, add "A - ' ' all classes", after a separator */ /* for objects, add "A - ' ' all classes", after a separator */
any = cg.zeroany; any = cg.zeroany;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); add_menu(win, &nul_glyphinfo, &any, 0, 0,
ATR_NONE, "", MENU_ITEMFLAGS_NONE);
any.a_int = (int) ' '; any.a_int = (int) ' ';
Sprintf(buf, "%c %s", (char) any.a_int, "all classes of objects"); Sprintf(buf, "%c %s", (char) any.a_int, "all classes of objects");
/* we won't preselect this even if the incoming list is empty; /* we won't preselect this even if the incoming list is empty;
having it selected means that it would have to be explicitly having it selected means that it would have to be explicitly
de-selected in order to select anything else */ de-selected in order to select anything else */
add_menu(win, NO_GLYPH, &any, 'A', 0, ATR_NONE, buf, MENU_ITEMFLAGS_NONE); add_menu(win, &nul_glyphinfo, &any, 'A', 0,
ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
} }
end_menu(win, prompt); end_menu(win, prompt);
n = select_menu(win, way ? PICK_ANY : PICK_ONE, &pick_list); n = select_menu(win, way ? PICK_ANY : PICK_ONE, &pick_list);
+15 -16
View File
@@ -893,16 +893,15 @@ struct permonst **for_supplement;
hallucinate = (Hallucination && !g.program_state.gameover); hallucinate = (Hallucination && !g.program_state.gameover);
const char *x_str; const char *x_str;
nhsym tmpsym; nhsym tmpsym;
unsigned glyphmod[NUM_GLYPHMOD]; glyph_info glyphinfo = nul_glyphinfo;
gobbledygook[0] = '\0'; /* no hallucinatory liquid (yet) */ gobbledygook[0] = '\0'; /* no hallucinatory liquid (yet) */
if (looked) { if (looked) {
glyph = glyph_at(cc.x, cc.y); glyph = glyph_at(cc.x, cc.y);
/* Convert glyph at selected position to a symbol for use below. */ /* Convert glyph at selected position to a symbol for use below. */
map_glyphmod(cc.x, cc.y, glyph, 0, glyphmod); map_glyphinfo(cc.x, cc.y, glyph, 0, &glyphinfo);
sym = glyphmod[GM_TTYCHAR]; sym = glyphinfo.symidx;
Sprintf(prefix, "%s ", encglyph(glyphinfo.glyph));
Sprintf(prefix, "%s ", encglyph(glyph));
} else } else
Sprintf(prefix, "%c ", sym); Sprintf(prefix, "%c ", sym);
@@ -1154,8 +1153,8 @@ struct permonst **for_supplement;
case SYM_PET_OVERRIDE + SYM_OFF_X: case SYM_PET_OVERRIDE + SYM_OFF_X:
if (looked) { if (looked) {
/* convert to symbol without override in effect */ /* convert to symbol without override in effect */
map_glyphmod(cc.x, cc.y, glyph, MG_FLAG_NOOVERRIDE, glyphmod); map_glyphinfo(cc.x, cc.y, glyph, 0, &glyphinfo);
sym = (int) glyphmod[GM_TTYCHAR]; sym = glyphinfo.ttychar;
goto check_monsters; goto check_monsters;
} }
break; break;
@@ -1264,21 +1263,21 @@ coord *click_cc;
any.a_char = '/'; any.a_char = '/';
/* 'y' and 'n' to keep backwards compatibility with previous /* 'y' and 'n' to keep backwards compatibility with previous
versions: "Specify unknown object by cursor?" */ versions: "Specify unknown object by cursor?" */
add_menu(win, NO_GLYPH, &any, add_menu(win, &nul_glyphinfo, &any,
flags.lootabc ? 0 : any.a_char, 'y', ATR_NONE, flags.lootabc ? 0 : any.a_char, 'y', ATR_NONE,
"something on the map", MENU_ITEMFLAGS_NONE); "something on the map", MENU_ITEMFLAGS_NONE);
any.a_char = 'i'; any.a_char = 'i';
add_menu(win, NO_GLYPH, &any, add_menu(win, &nul_glyphinfo, &any,
flags.lootabc ? 0 : any.a_char, 0, ATR_NONE, flags.lootabc ? 0 : any.a_char, 0, ATR_NONE,
"something you're carrying", MENU_ITEMFLAGS_NONE); "something you're carrying", MENU_ITEMFLAGS_NONE);
any.a_char = '?'; any.a_char = '?';
add_menu(win, NO_GLYPH, &any, add_menu(win, &nul_glyphinfo, &any,
flags.lootabc ? 0 : any.a_char, 'n', ATR_NONE, flags.lootabc ? 0 : any.a_char, 'n', ATR_NONE,
"something else (by symbol or name)", "something else (by symbol or name)",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
if (!u.uswallow && !Hallucination) { if (!u.uswallow && !Hallucination) {
any = cg.zeroany; any = cg.zeroany;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"", MENU_ITEMFLAGS_NONE); "", MENU_ITEMFLAGS_NONE);
/* these options work sensibly for the swallowed case, /* these options work sensibly for the swallowed case,
but there's no reason for the player to use them then; but there's no reason for the player to use them then;
@@ -1286,19 +1285,19 @@ coord *click_cc;
symbol/monster class letter doesn't match up with symbol/monster class letter doesn't match up with
bogus monster type, so suppress when hallucinating */ bogus monster type, so suppress when hallucinating */
any.a_char = 'm'; any.a_char = 'm';
add_menu(win, NO_GLYPH, &any, add_menu(win, &nul_glyphinfo, &any,
flags.lootabc ? 0 : any.a_char, 0, ATR_NONE, flags.lootabc ? 0 : any.a_char, 0, ATR_NONE,
"nearby monsters", MENU_ITEMFLAGS_NONE); "nearby monsters", MENU_ITEMFLAGS_NONE);
any.a_char = 'M'; any.a_char = 'M';
add_menu(win, NO_GLYPH, &any, add_menu(win, &nul_glyphinfo, &any,
flags.lootabc ? 0 : any.a_char, 0, ATR_NONE, flags.lootabc ? 0 : any.a_char, 0, ATR_NONE,
"all monsters shown on map", MENU_ITEMFLAGS_NONE); "all monsters shown on map", MENU_ITEMFLAGS_NONE);
any.a_char = 'o'; any.a_char = 'o';
add_menu(win, NO_GLYPH, &any, add_menu(win, &nul_glyphinfo, &any,
flags.lootabc ? 0 : any.a_char, 0, ATR_NONE, flags.lootabc ? 0 : any.a_char, 0, ATR_NONE,
"nearby objects", MENU_ITEMFLAGS_NONE); "nearby objects", MENU_ITEMFLAGS_NONE);
any.a_char = 'O'; any.a_char = 'O';
add_menu(win, NO_GLYPH, &any, add_menu(win, &nul_glyphinfo, &any,
flags.lootabc ? 0 : any.a_char, 0, ATR_NONE, flags.lootabc ? 0 : any.a_char, 0, ATR_NONE,
"all objects shown on map", MENU_ITEMFLAGS_NONE); "all objects shown on map", MENU_ITEMFLAGS_NONE);
} }
@@ -2154,7 +2153,7 @@ dohelp()
Strcpy(helpbuf, help_menu_items[i].text); Strcpy(helpbuf, help_menu_items[i].text);
} }
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
helpbuf, MENU_ITEMFLAGS_NONE); helpbuf, MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, "Select one item:"); end_menu(tmpwin, "Select one item:");
+49 -39
View File
@@ -907,7 +907,7 @@ menu_item **pick_list; /* return list of items picked */
int how; /* type of query */ int how; /* type of query */
boolean FDECL((*allow), (OBJ_P)); /* allow function */ boolean FDECL((*allow), (OBJ_P)); /* allow function */
{ {
int i, n; int i, n, tmpglyph;
winid win; winid win;
struct obj *curr, *last, fake_hero_object, *olist = *olist_p; struct obj *curr, *last, fake_hero_object, *olist = *olist_p;
char *pack, packbuf[MAXOCLASSES + 1]; char *pack, packbuf[MAXOCLASSES + 1];
@@ -917,6 +917,7 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */
engulfer = (qflags & INCLUDE_HERO) != 0, engulfer = (qflags & INCLUDE_HERO) != 0,
engulfer_minvent; engulfer_minvent;
unsigned sortflags; unsigned sortflags;
glyph_info tmpglyphinfo = nul_glyphinfo;
Loot *sortedolist, *srtoli; Loot *sortedolist, *srtoli;
*pick_list = (menu_item *) 0; *pick_list = (menu_item *) 0;
@@ -990,7 +991,8 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */
/* if sorting, print type name (once only) */ /* if sorting, print type name (once only) */
if (sorted && !printed_type_name) { if (sorted && !printed_type_name) {
any = cg.zeroany; any = cg.zeroany;
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, add_menu(win, &nul_glyphinfo, &any, 0, 0,
iflags.menu_headings,
let_to_name(*pack, FALSE, let_to_name(*pack, FALSE,
((how != PICK_NONE) ((how != PICK_NONE)
&& iflags.menu_head_objsym)), && iflags.menu_head_objsym)),
@@ -999,7 +1001,9 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */
} }
any.a_obj = curr; any.a_obj = curr;
add_menu(win, obj_to_glyph(curr, rn2_on_display_rng), &any, tmpglyph = obj_to_glyph(curr, rn2_on_display_rng);
map_glyphinfo(0, 0, tmpglyph, 0U, &tmpglyphinfo);
add_menu(win, &tmpglyphinfo, &any,
(qflags & USE_INVLET) ? curr->invlet (qflags & USE_INVLET) ? curr->invlet
: (first && curr->oclass == COIN_CLASS) ? '$' : 0, : (first && curr->oclass == COIN_CLASS) ? '$' : 0,
def_oc_syms[(int) objects[curr->otyp].oc_class].sym, def_oc_syms[(int) objects[curr->otyp].oc_class].sym,
@@ -1018,13 +1022,15 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */
if (sorted && n > 1) { if (sorted && n > 1) {
Sprintf(buf, "%s Creatures", Sprintf(buf, "%s Creatures",
is_animal(u.ustuck->data) ? "Swallowed" : "Engulfed"); is_animal(u.ustuck->data) ? "Swallowed" : "Engulfed");
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, buf, add_menu(win, &nul_glyphinfo, &any, 0, 0, iflags.menu_headings, buf,
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
} }
fake_hero_object = cg.zeroobj; fake_hero_object = cg.zeroobj;
fake_hero_object.quan = 1L; /* not strictly necessary... */ fake_hero_object.quan = 1L; /* not strictly necessary... */
any.a_obj = &fake_hero_object; any.a_obj = &fake_hero_object;
add_menu(win, mon_to_glyph(&g.youmonst, rn2_on_display_rng), &any, tmpglyph = mon_to_glyph(&g.youmonst, rn2_on_display_rng);
map_glyphinfo(0, 0, tmpglyph, 0U, &tmpglyphinfo);
add_menu(win, &tmpglyphinfo, &any,
/* fake inventory letter, no group accelerator */ /* fake inventory letter, no group accelerator */
CONTAINED_SYM, 0, ATR_NONE, an(self_lookat(buf)), CONTAINED_SYM, 0, ATR_NONE, an(self_lookat(buf)),
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
@@ -1166,13 +1172,14 @@ int how; /* type of query */
any = cg.zeroany; any = cg.zeroany;
any.a_int = 'A'; any.a_int = 'A';
itemflags = MENU_ITEMFLAGS_SKIPINVERT; itemflags = MENU_ITEMFLAGS_SKIPINVERT;
add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, invlet, 0, ATR_NONE,
(qflags & WORN_TYPES) ? "Auto-select every item being worn" (qflags & WORN_TYPES) ? "Auto-select every item being worn"
: "Auto-select every item", : "Auto-select every item",
itemflags); itemflags);
any = cg.zeroany; any = cg.zeroany;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); add_menu(win, &nul_glyphinfo, &any, 0, 0,
ATR_NONE, "", MENU_ITEMFLAGS_NONE);
} }
if ((qflags & ALL_TYPES) && (ccount > 1)) { if ((qflags & ALL_TYPES) && (ccount > 1)) {
@@ -1180,7 +1187,7 @@ int how; /* type of query */
any = cg.zeroany; any = cg.zeroany;
any.a_int = ALL_TYPES_SELECTED; any.a_int = ALL_TYPES_SELECTED;
itemflags = MENU_ITEMFLAGS_SKIPINVERT; itemflags = MENU_ITEMFLAGS_SKIPINVERT;
add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, invlet, 0, ATR_NONE,
(qflags & WORN_TYPES) ? "All worn types" : "All types", (qflags & WORN_TYPES) ? "All worn types" : "All types",
itemflags); itemflags);
invlet = 'b'; invlet = 'b';
@@ -1196,7 +1203,7 @@ int how; /* type of query */
any = cg.zeroany; any = cg.zeroany;
any.a_int = curr->oclass; any.a_int = curr->oclass;
add_menu( add_menu(
win, NO_GLYPH, &any, invlet++, win, &nul_glyphinfo, &any, invlet++,
def_oc_syms[(int) objects[curr->otyp].oc_class].sym, def_oc_syms[(int) objects[curr->otyp].oc_class].sym,
ATR_NONE, let_to_name(*pack, FALSE, ATR_NONE, let_to_name(*pack, FALSE,
(how != PICK_NONE) (how != PICK_NONE)
@@ -1217,7 +1224,8 @@ int how; /* type of query */
if (do_unpaid || (qflags & BILLED_TYPES) || do_blessed || do_cursed if (do_unpaid || (qflags & BILLED_TYPES) || do_blessed || do_cursed
|| do_uncursed || do_buc_unknown) { || do_uncursed || do_buc_unknown) {
any = cg.zeroany; any = cg.zeroany;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); add_menu(win, &nul_glyphinfo, &any, 0, 0,
ATR_NONE, "", MENU_ITEMFLAGS_NONE);
} }
/* unpaid items if there are any */ /* unpaid items if there are any */
@@ -1225,15 +1233,15 @@ int how; /* type of query */
invlet = 'u'; invlet = 'u';
any = cg.zeroany; any = cg.zeroany;
any.a_int = 'u'; any.a_int = 'u';
add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, "Unpaid items", add_menu(win, &nul_glyphinfo, &any, invlet, 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, "Unpaid items", MENU_ITEMFLAGS_NONE);
} }
/* billed items: checked by caller, so always include if BILLED_TYPES */ /* billed items: checked by caller, so always include if BILLED_TYPES */
if (qflags & BILLED_TYPES) { if (qflags & BILLED_TYPES) {
invlet = 'x'; invlet = 'x';
any = cg.zeroany; any = cg.zeroany;
any.a_int = 'x'; any.a_int = 'x';
add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, invlet, 0, ATR_NONE,
"Unpaid items already used up", MENU_ITEMFLAGS_NONE); "Unpaid items already used up", MENU_ITEMFLAGS_NONE);
} }
@@ -1245,28 +1253,28 @@ int how; /* type of query */
invlet = 'B'; invlet = 'B';
any = cg.zeroany; any = cg.zeroany;
any.a_int = 'B'; any.a_int = 'B';
add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, invlet, 0, ATR_NONE,
"Items known to be Blessed", itemflags); "Items known to be Blessed", itemflags);
} }
if (do_cursed) { if (do_cursed) {
invlet = 'C'; invlet = 'C';
any = cg.zeroany; any = cg.zeroany;
any.a_int = 'C'; any.a_int = 'C';
add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, invlet, 0, ATR_NONE,
"Items known to be Cursed", itemflags); "Items known to be Cursed", itemflags);
} }
if (do_uncursed) { if (do_uncursed) {
invlet = 'U'; invlet = 'U';
any = cg.zeroany; any = cg.zeroany;
any.a_int = 'U'; any.a_int = 'U';
add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, invlet, 0, ATR_NONE,
"Items known to be Uncursed", itemflags); "Items known to be Uncursed", itemflags);
} }
if (do_buc_unknown) { if (do_buc_unknown) {
invlet = 'X'; invlet = 'X';
any = cg.zeroany; any = cg.zeroany;
any.a_int = 'X'; any.a_int = 'X';
add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, invlet, 0, ATR_NONE,
"Items of unknown Bless/Curse status", itemflags); "Items of unknown Bless/Curse status", itemflags);
} }
end_menu(win, qstr); end_menu(win, qstr);
@@ -1943,8 +1951,8 @@ doloot()
cobj = cobj->nexthere) cobj = cobj->nexthere)
if (Is_container(cobj)) { if (Is_container(cobj)) {
any.a_obj = cobj; any.a_obj = cobj;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, 0, 0,
doname(cobj), MENU_ITEMFLAGS_NONE); ATR_NONE, doname(cobj), MENU_ITEMFLAGS_NONE);
} }
end_menu(win, "Loot which containers?"); end_menu(win, "Loot which containers?");
n = select_menu(win, PICK_ANY, &pick_list); n = select_menu(win, PICK_ANY, &pick_list);
@@ -3055,47 +3063,49 @@ boolean outokay, inokay, alreadyused, more_containers;
any.a_int = 1; /* ':' */ any.a_int = 1; /* ':' */
Sprintf(buf, "Look inside %s", thesimpleoname(obj)); Sprintf(buf, "Look inside %s", thesimpleoname(obj));
add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, buf, add_menu(win, &nul_glyphinfo, &any, menuselector[any.a_int], 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
if (outokay) { if (outokay) {
any.a_int = 2; /* 'o' */ any.a_int = 2; /* 'o' */
Sprintf(buf, "take %s out", something); Sprintf(buf, "take %s out", something);
add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, menuselector[any.a_int], 0,
buf, MENU_ITEMFLAGS_NONE); ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
} }
if (inokay) { if (inokay) {
any.a_int = 3; /* 'i' */ any.a_int = 3; /* 'i' */
Sprintf(buf, "put %s in", something); Sprintf(buf, "put %s in", something);
add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, menuselector[any.a_int], 0,
buf, MENU_ITEMFLAGS_NONE); ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
} }
if (outokay) { if (outokay) {
any.a_int = 4; /* 'b' */ any.a_int = 4; /* 'b' */
Sprintf(buf, "%stake out, then put in", inokay ? "both; " : ""); Sprintf(buf, "%stake out, then put in", inokay ? "both; " : "");
add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, menuselector[any.a_int], 0,
buf, MENU_ITEMFLAGS_NONE); ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
} }
if (inokay) { if (inokay) {
any.a_int = 5; /* 'r' */ any.a_int = 5; /* 'r' */
Sprintf(buf, "%sput in, then take out", Sprintf(buf, "%sput in, then take out",
outokay ? "both reversed; " : ""); outokay ? "both reversed; " : "");
add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, menuselector[any.a_int], 0,
buf, MENU_ITEMFLAGS_NONE); ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
any.a_int = 6; /* 's' */ any.a_int = 6; /* 's' */
Sprintf(buf, "stash one item into %s", thesimpleoname(obj)); Sprintf(buf, "stash one item into %s", thesimpleoname(obj));
add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, menuselector[any.a_int], 0,
buf, MENU_ITEMFLAGS_NONE); ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
} }
any.a_int = 0; any.a_int = 0;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); add_menu(win, &nul_glyphinfo, &any, 0, 0,
ATR_NONE, "", MENU_ITEMFLAGS_NONE);
if (more_containers) { if (more_containers) {
any.a_int = 7; /* 'n' */ any.a_int = 7; /* 'n' */
add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, menuselector[any.a_int], 0,
"loot next container", MENU_ITEMFLAGS_SELECTED); ATR_NONE, "loot next container", MENU_ITEMFLAGS_SELECTED);
} }
any.a_int = 8; /* 'q' */ any.a_int = 8; /* 'q' */
Strcpy(buf, alreadyused ? "done" : "do nothing"); Strcpy(buf, alreadyused ? "done" : "do nothing");
add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, buf, add_menu(win, &nul_glyphinfo, &any, menuselector[any.a_int], 0,
ATR_NONE, buf,
more_containers ? MENU_ITEMFLAGS_NONE : MENU_ITEMFLAGS_SELECTED); more_containers ? MENU_ITEMFLAGS_NONE : MENU_ITEMFLAGS_SELECTED);
end_menu(win, prompt); end_menu(win, prompt);
@@ -3155,18 +3165,18 @@ dotip()
if (Is_container(cobj)) { if (Is_container(cobj)) {
++i; ++i;
any.a_obj = cobj; any.a_obj = cobj;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, 0, 0,
doname(cobj), MENU_ITEMFLAGS_NONE); ATR_NONE, doname(cobj), MENU_ITEMFLAGS_NONE);
} }
if (g.invent) { if (g.invent) {
any = cg.zeroany; any = cg.zeroany;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"", MENU_ITEMFLAGS_NONE); "", MENU_ITEMFLAGS_NONE);
any.a_obj = &dummyobj; any.a_obj = &dummyobj;
/* use 'i' for inventory unless there are so many /* use 'i' for inventory unless there are so many
containers that it's already being used */ containers that it's already being used */
i = (i <= 'i' - 'a' && !flags.lootabc) ? 'i' : 0; i = (i <= 'i' - 'a' && !flags.lootabc) ? 'i' : 0;
add_menu(win, NO_GLYPH, &any, i, 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, i, 0, ATR_NONE,
"tip something being carried", MENU_ITEMFLAGS_SELECTED); "tip something being carried", MENU_ITEMFLAGS_SELECTED);
} }
end_menu(win, "Tip which container?"); end_menu(win, "Tip which container?");
+7 -7
View File
@@ -1390,25 +1390,25 @@ winid bannerwin; /* if not WIN_ERR, clear window and show copyright in menu */
clear_nhwindow(bannerwin); clear_nhwindow(bannerwin);
/* COPYRIGHT_BANNER_[ABCD] */ /* COPYRIGHT_BANNER_[ABCD] */
for (k = 1; k <= 4; ++k) for (k = 1; k <= 4; ++k)
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
copyright_banner_line(k), MENU_ITEMFLAGS_NONE); copyright_banner_line(k), MENU_ITEMFLAGS_NONE);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, "",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
} }
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"Select one of your saved games", MENU_ITEMFLAGS_NONE); "Select one of your saved games", MENU_ITEMFLAGS_NONE);
for (k = 0; saved[k]; ++k) { for (k = 0; saved[k]; ++k) {
any.a_int = k + 1; any.a_int = k + 1;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, saved[k], add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, saved[k], MENU_ITEMFLAGS_NONE);
} }
clet = (k <= 'n' - 'a') ? 'n' : 0; /* new game */ clet = (k <= 'n' - 'a') ? 'n' : 0; /* new game */
any.a_int = -1; /* not >= 0 */ any.a_int = -1; /* not >= 0 */
add_menu(tmpwin, NO_GLYPH, &any, clet, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, clet, 0, ATR_NONE,
"Start a new character", MENU_ITEMFLAGS_NONE); "Start a new character", MENU_ITEMFLAGS_NONE);
clet = (k + 1 <= 'q' - 'a') ? 'q' : 0; /* quit */ clet = (k + 1 <= 'q' - 'a') ? 'q' : 0; /* quit */
any.a_int = -2; any.a_int = -2;
add_menu(tmpwin, NO_GLYPH, &any, clet, 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, clet, 0, ATR_NONE,
"Never mind (quit)", MENU_ITEMFLAGS_SELECTED); "Never mind (quit)", MENU_ITEMFLAGS_SELECTED);
/* no prompt on end_menu, as we've done our own at the top */ /* no prompt on end_menu, as we've done our own at the top */
end_menu(tmpwin, (char *) 0); end_menu(tmpwin, (char *) 0);
+8 -6
View File
@@ -1904,28 +1904,30 @@ boolean preselect;
any.a_int = 0; any.a_int = 0;
/* use four spaces of padding to fake a grayed out menu choice */ /* use four spaces of padding to fake a grayed out menu choice */
Sprintf(buf, "%4s%s forces %s", "", constrainer, forcedvalue); Sprintf(buf, "%4s%s forces %s", "", constrainer, forcedvalue);
add_menu(where, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, add_menu(where, &nul_glyphinfo, &any, 0, 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
} else if (what) { } else if (what) {
any.a_int = RS_menu_arg(which); any.a_int = RS_menu_arg(which);
Sprintf(buf, "Pick%s %s first", (f >= 0) ? " another" : "", what); Sprintf(buf, "Pick%s %s first", (f >= 0) ? " another" : "", what);
add_menu(where, NO_GLYPH, &any, RS_menu_let[which], 0, ATR_NONE, buf, add_menu(where, &nul_glyphinfo, &any, RS_menu_let[which], 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
} else if (which == RS_filter) { } else if (which == RS_filter) {
char setfiltering[40]; char setfiltering[40];
any.a_int = RS_menu_arg(RS_filter); any.a_int = RS_menu_arg(RS_filter);
Sprintf(setfiltering, "%s role/race/&c filtering", Sprintf(setfiltering, "%s role/race/&c filtering",
gotrolefilter() ? "Reset" : "Set"); gotrolefilter() ? "Reset" : "Set");
add_menu(where, NO_GLYPH, &any, '~', 0, ATR_NONE, add_menu(where, &nul_glyphinfo, &any, '~', 0, ATR_NONE,
setfiltering, MENU_ITEMFLAGS_NONE); setfiltering, MENU_ITEMFLAGS_NONE);
} else if (which == ROLE_RANDOM) { } else if (which == ROLE_RANDOM) {
any.a_int = ROLE_RANDOM; any.a_int = ROLE_RANDOM;
add_menu(where, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", add_menu(where, &nul_glyphinfo, &any, '*', 0,
ATR_NONE, "Random",
preselect ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); preselect ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
} else if (which == ROLE_NONE) { } else if (which == ROLE_NONE) {
any.a_int = ROLE_NONE; any.a_int = ROLE_NONE;
add_menu(where, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(where, &nul_glyphinfo, &any, 'q', 0,
ATR_NONE, "Quit",
preselect ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); preselect ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
} else { } else {
impossible("role_menu_extra: bad arg (%d)", which); impossible("role_menu_extra: bad arg (%d)", which);
+12 -9
View File
@@ -1583,13 +1583,14 @@ spellsortmenu()
let = 'z'; /* assumes fewer than 26 sort choices... */ let = 'z'; /* assumes fewer than 26 sort choices... */
/* separate final choice from others with a blank line */ /* separate final choice from others with a blank line */
any.a_int = 0; any.a_int = 0;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, "", MENU_ITEMFLAGS_NONE);
} else { } else {
let = 'a' + i; let = 'a' + i;
} }
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, let, 0, ATR_NONE, spl_sortchoices[i], add_menu(tmpwin, &nul_glyphinfo, &any, let, 0,
ATR_NONE, spl_sortchoices[i],
(i == g.spl_sortmode) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); (i == g.spl_sortmode) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, "View known spells list sorted"); end_menu(tmpwin, "View known spells list sorted");
@@ -1676,8 +1677,8 @@ int *spell_no;
Sprintf(buf, "Name\tLevel\tCategory\tFail\tRetention"); Sprintf(buf, "Name\tLevel\tCategory\tFail\tRetention");
fmt = "%s\t%-d\t%s\t%-d%%\t%s"; fmt = "%s\t%-d\t%s\t%-d%%\t%s";
} }
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, buf, add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
MENU_ITEMFLAGS_NONE); iflags.menu_headings, buf, MENU_ITEMFLAGS_NONE);
for (i = 0; i < MAXSPELL && spellid(i) != NO_SPELL; i++) { for (i = 0; i < MAXSPELL && spellid(i) != NO_SPELL; i++) {
splnum = !g.spl_orderindx ? i : g.spl_orderindx[i]; splnum = !g.spl_orderindx ? i : g.spl_orderindx[i];
Sprintf(buf, fmt, spellname(splnum), spellev(splnum), Sprintf(buf, fmt, spellname(splnum), spellev(splnum),
@@ -1686,8 +1687,10 @@ int *spell_no;
spellretention(splnum, retentionbuf)); spellretention(splnum, retentionbuf));
any.a_int = splnum + 1; /* must be non-zero */ any.a_int = splnum + 1; /* must be non-zero */
add_menu(tmpwin, NO_GLYPH, &any, spellet(splnum), 0, ATR_NONE, buf, add_menu(tmpwin, &nul_glyphinfo, &any, spellet(splnum), 0,
(splnum == splaction) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); ATR_NONE, buf,
(splnum == splaction)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
} }
how = PICK_ONE; how = PICK_ONE;
if (splaction == SPELLMENU_VIEW) { if (splaction == SPELLMENU_VIEW) {
@@ -1697,8 +1700,8 @@ int *spell_no;
} else { } else {
/* more than 1 spell, add an extra menu entry */ /* more than 1 spell, add an extra menu entry */
any.a_int = SPELLMENU_SORT + 1; any.a_int = SPELLMENU_SORT + 1;
add_menu(tmpwin, NO_GLYPH, &any, '+', 0, ATR_NONE, add_menu(tmpwin, &nul_glyphinfo, &any, '+', 0,
"[sort spells]", MENU_ITEMFLAGS_NONE); ATR_NONE, "[sort spells]", MENU_ITEMFLAGS_NONE);
} }
} }
end_menu(tmpwin, prompt); end_menu(tmpwin, prompt);
+2 -2
View File
@@ -617,8 +617,8 @@ dotelecmd()
any = cg.zeroany; any = cg.zeroany;
for (i = 0; i < SIZE(tports); ++i) { for (i = 0; i < SIZE(tports); ++i) {
any.a_int = (int) tports[i].menulet; any.a_int = (int) tports[i].menulet;
add_menu(win, NO_GLYPH, &any, (char) any.a_int, 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, (char) any.a_int, 0,
tports[i].menudesc, ATR_NONE, tports[i].menudesc,
(tports[i].menulet == 'w') ? MENU_ITEMFLAGS_SELECTED (tports[i].menulet == 'w') ? MENU_ITEMFLAGS_SELECTED
: MENU_ITEMFLAGS_NONE); : MENU_ITEMFLAGS_NONE);
} }
+10 -9
View File
@@ -1220,18 +1220,18 @@ enhance_weapon_skill()
(u.ulevel < MAXULEV) (u.ulevel < MAXULEV)
? "when you're more experienced" ? "when you're more experienced"
: "if skill slots become available"); : "if skill slots become available");
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, add_menu(win, &nul_glyphinfo, &any, 0, 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
} }
if (maxxed_cnt > 0) { if (maxxed_cnt > 0) {
Sprintf(buf, Sprintf(buf,
"(Skill%s flagged by \"#\" cannot be enhanced any further.)", "(Skill%s flagged by \"#\" cannot be enhanced any further.)",
plur(maxxed_cnt)); plur(maxxed_cnt));
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, add_menu(win, &nul_glyphinfo, &any, 0, 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
} }
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", add_menu(win, &nul_glyphinfo, &any, 0, 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, "", MENU_ITEMFLAGS_NONE);
} }
/* List the skills, making ones that could be advanced /* List the skills, making ones that could be advanced
@@ -1244,7 +1244,8 @@ enhance_weapon_skill()
/* Print headings for skill types */ /* Print headings for skill types */
any = cg.zeroany; any = cg.zeroany;
if (i == skill_ranges[pass].first) if (i == skill_ranges[pass].first)
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, add_menu(win, &nul_glyphinfo, &any, 0, 0,
iflags.menu_headings,
skill_ranges[pass].name, MENU_ITEMFLAGS_NONE); skill_ranges[pass].name, MENU_ITEMFLAGS_NONE);
if (P_RESTRICTED(i)) if (P_RESTRICTED(i))
@@ -1286,8 +1287,8 @@ enhance_weapon_skill()
sklnambuf); sklnambuf);
} }
any.a_int = can_advance(i, speedy) ? i + 1 : 0; any.a_int = can_advance(i, speedy) ? i + 1 : 0;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, add_menu(win, &nul_glyphinfo, &any, 0, 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
} }
Strcpy(buf, (to_advance > 0) ? "Pick a skill to advance:" Strcpy(buf, (to_advance > 0) ? "Pick a skill to advance:"
+31 -24
View File
@@ -70,7 +70,7 @@ static void FDECL(dump_clear_nhwindow, (winid));
static void FDECL(dump_display_nhwindow, (winid, BOOLEAN_P)); static void FDECL(dump_display_nhwindow, (winid, BOOLEAN_P));
static void FDECL(dump_destroy_nhwindow, (winid)); static void FDECL(dump_destroy_nhwindow, (winid));
static void FDECL(dump_start_menu, (winid, unsigned long)); static void FDECL(dump_start_menu, (winid, unsigned long));
static void FDECL(dump_add_menu, (winid, int, const ANY_P *, CHAR_P, static void FDECL(dump_add_menu, (winid, const glyph_info *, const ANY_P *, CHAR_P,
CHAR_P, int, const char *, unsigned int)); CHAR_P, int, const char *, unsigned int));
static void FDECL(dump_end_menu, (winid, const char *)); static void FDECL(dump_end_menu, (winid, const char *));
static int FDECL(dump_select_menu, (winid, int, MENU_ITEM_P **)); static int FDECL(dump_select_menu, (winid, int, MENU_ITEM_P **));
@@ -516,11 +516,13 @@ static void FDECL(hup_init_nhwindows, (int *, char **));
static void FDECL(hup_exit_nhwindows, (const char *)); static void FDECL(hup_exit_nhwindows, (const char *));
static winid FDECL(hup_create_nhwindow, (int)); static winid FDECL(hup_create_nhwindow, (int));
static int FDECL(hup_select_menu, (winid, int, MENU_ITEM_P **)); static int FDECL(hup_select_menu, (winid, int, MENU_ITEM_P **));
static void FDECL(hup_add_menu, (winid, int, const anything *, CHAR_P, CHAR_P, static void FDECL(hup_add_menu, (winid, const glyph_info *, const anything *,
int, const char *, unsigned int)); CHAR_P, CHAR_P, int, const char *,
unsigned int));
static void FDECL(hup_end_menu, (winid, const char *)); static void FDECL(hup_end_menu, (winid, const char *));
static void FDECL(hup_putstr, (winid, int, const char *)); static void FDECL(hup_putstr, (winid, int, const char *));
static void FDECL(hup_print_glyph, (winid, XCHAR_P, XCHAR_P, int, int, unsigned *)); static void FDECL(hup_print_glyph, (winid, XCHAR_P, XCHAR_P,
const glyph_info *, const glyph_info *));
static void FDECL(hup_outrip, (winid, int, time_t)); static void FDECL(hup_outrip, (winid, int, time_t));
static void FDECL(hup_curs, (winid, int, int)); static void FDECL(hup_curs, (winid, int, int));
static void FDECL(hup_display_nhwindow, (winid, BOOLEAN_P)); static void FDECL(hup_display_nhwindow, (winid, BOOLEAN_P));
@@ -704,9 +706,10 @@ struct mi **menu_list UNUSED;
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
hup_add_menu(window, glyph, identifier, sel, grpsel, attr, txt, itemflags) hup_add_menu(window, glyphinfo, identifier, sel, grpsel, attr, txt, itemflags)
winid window UNUSED; winid window UNUSED;
int glyph UNUSED, attr UNUSED; const glyph_info *glyphinfo UNUSED;
int attr UNUSED;
const anything *identifier UNUSED; const anything *identifier UNUSED;
char sel UNUSED, grpsel UNUSED; char sel UNUSED, grpsel UNUSED;
const char *txt UNUSED; const char *txt UNUSED;
@@ -736,12 +739,11 @@ const char *text UNUSED;
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
hup_print_glyph(window, x, y, glyph, bkglyph, glyphmod) hup_print_glyph(window, x, y, glyphinfo, bkglyphinfo)
winid window UNUSED; winid window UNUSED;
xchar x UNUSED, y UNUSED; xchar x UNUSED, y UNUSED;
int glyph UNUSED; const glyph_info *glyphinfo UNUSED;
int bkglyph UNUSED; const glyph_info *bkglyphinfo UNUSED;
unsigned *glyphmod UNUSED;
{ {
return; return;
} }
@@ -1340,9 +1342,9 @@ unsigned long mbehavior UNUSED;
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
dump_add_menu(win, glyph, identifier, ch, gch, attr, str, itemflags) dump_add_menu(win, glyphinfo, identifier, ch, gch, attr, str, itemflags)
winid win UNUSED; winid win UNUSED;
int glyph; const glyph_info *glyphinfo;
const anything *identifier UNUSED; const anything *identifier UNUSED;
char ch; char ch;
char gch UNUSED; char gch UNUSED;
@@ -1351,7 +1353,7 @@ const char *str;
unsigned int itemflags UNUSED; unsigned int itemflags UNUSED;
{ {
if (dumplog_file) { if (dumplog_file) {
if (glyph == NO_GLYPH) if (glyphinfo->glyph == NO_GLYPH)
fprintf(dumplog_file, " %s\n", str); fprintf(dumplog_file, " %s\n", str);
else else
fprintf(dumplog_file, " %c - %s\n", ch, str); fprintf(dumplog_file, " %c - %s\n", ch, str);
@@ -1434,15 +1436,20 @@ int
glyph2ttychar(glyph) glyph2ttychar(glyph)
int glyph; int glyph;
{ {
int so; glyph_info glyphinfo;
unsigned glyphmod[NUM_GLYPHMOD];
map_glyphmod(0, 0, glyph, MG_FLAG_RETURNIDX, glyphmod); map_glyphinfo(0, 0, glyph, 0, &glyphinfo);
so = (int) glyphmod[GM_TTYCHAR]; return glyphinfo.ttychar;
if (so >= 0 && so < SYM_MAX) }
return (int) g.showsyms[so];
else int
return ' '; glyph2symidx(glyph)
int glyph;
{
glyph_info glyphinfo;
map_glyphinfo(0, 0, glyph, 0, &glyphinfo);
return glyphinfo.symidx;
} }
char * char *
@@ -1462,7 +1469,7 @@ const char *str;
{ {
static const char hex[] = "00112233445566778899aAbBcCdDeEfF"; static const char hex[] = "00112233445566778899aAbBcCdDeEfF";
char *put = buf; char *put = buf;
unsigned glyphmod[NUM_GLYPHMOD]; glyph_info glyphinfo = nul_glyphinfo;
if (!str) if (!str)
return strcpy(buf, ""); return strcpy(buf, "");
@@ -1488,8 +1495,8 @@ const char *str;
gv = (gv * 16) + ((int) (dp - hex) / 2); gv = (gv * 16) + ((int) (dp - hex) / 2);
else else
break; break;
map_glyphmod(0, 0, gv, MG_FLAG_RETURNIDX, glyphmod); map_glyphinfo(0, 0, gv, 0, &glyphinfo);
so = glyphmod[GM_TTYCHAR]; so = glyphinfo.symidx;
*put++ = g.showsyms[so]; *put++ = g.showsyms[so];
/* 'str' is ready for the next loop iteration and '*str' /* 'str' is ready for the next loop iteration and '*str'
should not be copied at the end of this iteration */ should not be copied at the end of this iteration */
+6 -5
View File
@@ -423,12 +423,12 @@ void NetHackQtBind::qt_start_menu(winid wid, unsigned long mbehavior UNUSED)
window->StartMenu(wid == WIN_INVEN); window->StartMenu(wid == WIN_INVEN);
} }
void NetHackQtBind::qt_add_menu(winid wid, int glyph, void NetHackQtBind::qt_add_menu(winid wid, const glyph_info *glyphinfo,
const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr, const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr,
const char *str, unsigned itemflags) const char *str, unsigned itemflags)
{ {
NetHackQtWindow* window=id_to_window[(int)wid]; NetHackQtWindow* window=id_to_window[(int)wid];
window->AddMenu(glyph, identifier, ch, gch, attr, window->AddMenu(glyphinfo->glyph, identifier, ch, gch, attr,
QString::fromLatin1(str), QString::fromLatin1(str),
itemflags); itemflags);
} }
@@ -474,12 +474,13 @@ void NetHackQtBind::qt_cliparound_window(winid wid, int x, int y)
NetHackQtWindow* window=id_to_window[(int)wid]; NetHackQtWindow* window=id_to_window[(int)wid];
window->ClipAround(x,y); window->ClipAround(x,y);
} }
void NetHackQtBind::qt_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,int glyph, void NetHackQtBind::qt_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,
int bkglyph UNUSED, unsigned *glyphmod) const glyph_info *glyphinfo,
const glyph_info *bkglyphinfo UNUSED)
{ {
/* TODO: bkglyph */ /* TODO: bkglyph */
NetHackQtWindow* window=id_to_window[(int)wid]; NetHackQtWindow* window=id_to_window[(int)wid];
window->PrintGlyph(x,y,glyph,glyphmod); window->PrintGlyph(x,y,glyphinfo);
} }
//void NetHackQtBind::qt_print_glyph_compose(winid wid,xchar x,xchar y,int glyph1, int glyph2) //void NetHackQtBind::qt_print_glyph_compose(winid wid,xchar x,xchar y,int glyph1, int glyph2)
//{ //{
+3 -2
View File
@@ -52,7 +52,7 @@ public:
static void qt_putstr(winid wid, int attr, const QString& text); static void qt_putstr(winid wid, int attr, const QString& text);
static void qt_display_file(const char *filename, BOOLEAN_P must_exist); static void qt_display_file(const char *filename, BOOLEAN_P must_exist);
static void qt_start_menu(winid wid, unsigned long mbehavior); static void qt_start_menu(winid wid, unsigned long mbehavior);
static void qt_add_menu(winid wid, int glyph, static void qt_add_menu(winid wid, const glyph_info *glyphinfo,
const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr, const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr,
const char *str, unsigned int itemflags); const char *str, unsigned int itemflags);
static void qt_end_menu(winid wid, const char *prompt); static void qt_end_menu(winid wid, const char *prompt);
@@ -64,7 +64,8 @@ public:
static void qt_cliparound(int x, int y); static void qt_cliparound(int x, int y);
static void qt_cliparound_window(winid wid, int x, int y); static void qt_cliparound_window(winid wid, int x, int y);
static void qt_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, static void qt_print_glyph(winid wid, XCHAR_P x, XCHAR_P y,
int glyph, int bkglyph, unsigned int *); const glyph_info *glyphingo,
const glyph_info *bkglyphinfo);
static void qt_raw_print(const char *str); static void qt_raw_print(const char *str);
static void qt_raw_print_bold(const char *str); static void qt_raw_print_bold(const char *str);
static int qt_nhgetch(); static int qt_nhgetch();
+14 -13
View File
@@ -536,13 +536,13 @@ void NetHackQtMapViewport::CursorTo(int x,int y)
Changed(cursor.x(), cursor.y()); Changed(cursor.x(), cursor.y());
} }
void NetHackQtMapViewport::PrintGlyph(int x, int y, int theglyph, void NetHackQtMapViewport::PrintGlyph(int x, int y,
unsigned *glyphmod) const glyph_info *glyphinfo)
{ {
Glyph(x, y) = (unsigned short) theglyph; Glyph(x, y) = (unsigned short) glyphinfo->glyph;
Glyphttychar(x, y) = (unsigned short) glyphmod[GM_TTYCHAR]; Glyphttychar(x, y) = (unsigned short) glyphinfo->ttychar;
Glyphcolor(x, y) = (unsigned short) glyphmod[GM_COLOR]; Glyphcolor(x, y) = (unsigned short) glyphinfo->color;
Glyphflags(x, y) = glyphmod[GM_FLAGS]; Glyphflags(x, y) = glyphinfo->glyphflags;
Changed(x, y); Changed(x, y);
} }
@@ -647,9 +647,10 @@ void NetHackQtMapWindow2::ClipAround(int x,int y)
ensureVisible(x,y,width()*0.45,height()*0.45); ensureVisible(x,y,width()*0.45,height()*0.45);
} }
void NetHackQtMapWindow2::PrintGlyph(int x,int y,int glyph, unsigned *glyphmod) void NetHackQtMapWindow2::PrintGlyph(int x,int y,
const glyph_info *glyphinfo)
{ {
m_viewport->PrintGlyph(x, y, glyph, glyphmod); m_viewport->PrintGlyph(x, y, glyphinfo);
} }
#if 0 //RLC #if 0 //RLC
@@ -1004,12 +1005,12 @@ void NetHackQtMapWindow::ClipAround(int x,int y)
viewport.center(x,y,0.45,0.45); viewport.center(x,y,0.45,0.45);
} }
void NetHackQtMapWindow::PrintGlyph(int x,int y,int glyph, unsigned *glyphmod) void NetHackQtMapWindow::PrintGlyph(int x,int y, const glyph_info *glyphinfo)
{ {
Glyph(x,y)=glyph; Glyph(x,y)=glyphinfo->glyph;
Glyphttychar(x,y)=glyphmod[GM_TTYCHAR]; Glyphttychar(x,y)=glyphinfo->ttychar;
Glyphcolor(x,y)=glyphmod[GM_COLOR]; Glyphcolor(x,y)=glyphinfo->color;
Glyphflags(x,y)=glyphmod[GM_FLAGS]; Glyphflags(x,y)=glyphinfo->glyphflags;
Changed(x,y); Changed(x,y);
} }
+2 -2
View File
@@ -56,7 +56,7 @@ private:
void Clear(); void Clear();
void Display(bool block); void Display(bool block);
void CursorTo(int x,int y); void CursorTo(int x,int y);
void PrintGlyph(int x,int y,int glyph,unsigned *glyphmod); void PrintGlyph(int x,int y, const glyph_info *glyphinfo);
void Changed(int x, int y); void Changed(int x, int y);
void updateTiles(); void updateTiles();
void SetupTextmapFont(QPainter &painter); void SetupTextmapFont(QPainter &painter);
@@ -79,7 +79,7 @@ public:
virtual void CursorTo(int x,int y); virtual void CursorTo(int x,int y);
virtual void PutStr(int attr, const QString& text); virtual void PutStr(int attr, const QString& text);
virtual void ClipAround(int x,int y); virtual void ClipAround(int x,int y);
virtual void PrintGlyph(int x,int y,int glyph,unsigned *glyphmod); virtual void PrintGlyph(int x,int y, const glyph_info *glyphinfo);
signals: signals:
void resized(); void resized();
+1 -1
View File
@@ -109,7 +109,7 @@ void NetHackQtWindow::EndMenu(const QString& prompt UNUSED) { puts("unexpected E
int NetHackQtWindow::SelectMenu(int how UNUSED, MENU_ITEM_P **menu_list UNUSED) int NetHackQtWindow::SelectMenu(int how UNUSED, MENU_ITEM_P **menu_list UNUSED)
{ puts("unexpected SelectMenu"); return 0; } { puts("unexpected SelectMenu"); return 0; }
void NetHackQtWindow::ClipAround(int x UNUSED,int y UNUSED) { puts("unexpected ClipAround"); } void NetHackQtWindow::ClipAround(int x UNUSED,int y UNUSED) { puts("unexpected ClipAround"); }
void NetHackQtWindow::PrintGlyph(int x UNUSED,int y UNUSED,int glyph UNUSED, unsigned *glyphmod UNUSED) { puts("unexpected PrintGlyph"); } void NetHackQtWindow::PrintGlyph(int x UNUSED,int y UNUSED,const glyph_info *glyphinfo UNUSED) { puts("unexpected PrintGlyph"); }
//void NetHackQtWindow::PrintGlyphCompose(int x,int y,int,int) { puts("unexpected PrintGlyphCompose"); } //void NetHackQtWindow::PrintGlyphCompose(int x,int y,int,int) { puts("unexpected PrintGlyphCompose"); }
void NetHackQtWindow::UseRIP(int how UNUSED, time_t when UNUSED) { puts("unexpected UseRIP"); } void NetHackQtWindow::UseRIP(int how UNUSED, time_t when UNUSED) { puts("unexpected UseRIP"); }
+1 -1
View File
@@ -40,7 +40,7 @@ public:
virtual void EndMenu(const QString& prompt); virtual void EndMenu(const QString& prompt);
virtual int SelectMenu(int how, MENU_ITEM_P **menu_list); virtual int SelectMenu(int how, MENU_ITEM_P **menu_list);
virtual void ClipAround(int x, int y); virtual void ClipAround(int x, int y);
virtual void PrintGlyph(int x, int y, int glyph, unsigned *glyphmod); virtual void PrintGlyph(int x, int y, const glyph_info *glyphinfo);
virtual void UseRIP(int how, time_t when); virtual void UseRIP(int how, time_t when);
int nhid; int nhid;
+1 -1
View File
@@ -1962,7 +1962,7 @@ boolean complain;
any = cg.zeroany; any = cg.zeroany;
while (dlb_fgets(line, LLEN, fp)) { while (dlb_fgets(line, LLEN, fp)) {
X11_add_menu(newwin, NO_GLYPH, &any, 0, 0, ATR_NONE, X11_add_menu(newwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
line, MENU_ITEMFLAGS_NONE); line, MENU_ITEMFLAGS_NONE);
} }
(void) dlb_fclose(fp); (void) dlb_fclose(fp);
+14 -15
View File
@@ -73,12 +73,11 @@ static void FDECL(display_cursor, (struct xwindow *));
/* Global functions ======================================================= */ /* Global functions ======================================================= */
void void
X11_print_glyph(window, x, y, glyph, bkglyph, glyphmod) X11_print_glyph(window, x, y, glyphinfo, bkglyphinfo)
winid window; winid window;
xchar x, y; xchar x, y;
int glyph; const glyph_info *glyphinfo;
int bkglyph UNUSED; const glyph_info *bkglyphinfo UNUSED;
unsigned *glyphmod UNUSED;
{ {
struct map_info_t *map_info; struct map_info_t *map_info;
boolean update_bbox = FALSE; boolean update_bbox = FALSE;
@@ -94,8 +93,8 @@ unsigned *glyphmod UNUSED;
{ {
unsigned short *t_ptr = &map_info->tile_map.glyphs[y][x].glyph; unsigned short *t_ptr = &map_info->tile_map.glyphs[y][x].glyph;
if (*t_ptr != glyph) { if (*t_ptr != glyphinfo->glyph) {
*t_ptr = glyph; *t_ptr = glyphinfo->glyph;
if (map_info->is_tile) if (map_info->is_tile)
update_bbox = TRUE; update_bbox = TRUE;
} }
@@ -110,13 +109,13 @@ unsigned *glyphmod UNUSED;
register unsigned char *co_ptr; register unsigned char *co_ptr;
#endif #endif
color = glyphmod[GM_COLOR]; color = glyphinfo->color;
special = glyphmod[GM_FLAGS]; special = glyphinfo->glyphflags;
och = glyphmod[GM_TTYCHAR]; och = glyphinfo->ttychar;
ch = (uchar) och; ch = (uchar) och;
if (special != map_info->tile_map.glyphs[y][x].special) { if (special != map_info->tile_map.glyphs[y][x].glyphflags) {
map_info->tile_map.glyphs[y][x].special = special; map_info->tile_map.glyphs[y][x].glyphflags = special;
update_bbox = TRUE; update_bbox = TRUE;
} }
@@ -948,7 +947,7 @@ struct map_info_t *map_info;
for (x = 0; x < COLNO; x++) for (x = 0; x < COLNO; x++)
for (y = 0; y < ROWNO; y++) { for (y = 0; y < ROWNO; y++) {
tile_map->glyphs[y][x].glyph = !x ? g_nothg : g_unexp; tile_map->glyphs[y][x].glyph = !x ? g_nothg : g_unexp;
tile_map->glyphs[y][x].special = 0; tile_map->glyphs[y][x].glyphflags = 0;
text_map->text[y][x] = (uchar) (!x ? mgnothg : mgunexp); text_map->text[y][x] = (uchar) (!x ? mgnothg : mgunexp);
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
@@ -1297,7 +1296,7 @@ boolean inverted;
int dest_x = (cur_col - COL0_OFFSET) * tile_map->square_width; int dest_x = (cur_col - COL0_OFFSET) * tile_map->square_width;
int dest_y = row * tile_map->square_height; int dest_y = row * tile_map->square_height;
if ((tile_map->glyphs[row][cur_col].special & MG_FEMALE)) if ((tile_map->glyphs[row][cur_col].glyphflags & MG_FEMALE))
tile++; /* advance to the female tile variation */ tile++; /* advance to the female tile variation */
src_x = (tile % TILES_PER_ROW) * tile_width; src_x = (tile % TILES_PER_ROW) * tile_width;
src_y = (tile / TILES_PER_ROW) * tile_height; src_y = (tile / TILES_PER_ROW) * tile_height;
@@ -1306,7 +1305,7 @@ boolean inverted;
src_x, src_y, tile_width, tile_height, src_x, src_y, tile_width, tile_height,
dest_x, dest_y); dest_x, dest_y);
if (glyph_is_pet(glyph) && iflags.hilite_pet) { if ((tile_map->glyphs[row][cur_col].glyphflags & MG_PET) && iflags.hilite_pet) {
/* draw pet annotation (a heart) */ /* draw pet annotation (a heart) */
XSetForeground(dpy, tile_map->black_gc, XSetForeground(dpy, tile_map->black_gc,
pet_annotation.foreground); pet_annotation.foreground);
@@ -1321,7 +1320,7 @@ boolean inverted;
XSetForeground(dpy, tile_map->black_gc, XSetForeground(dpy, tile_map->black_gc,
BlackPixelOfScreen(screen)); BlackPixelOfScreen(screen));
} }
if ((tile_map->glyphs[row][cur_col].special & MG_OBJPILE)) { if ((tile_map->glyphs[row][cur_col].glyphflags & MG_OBJPILE)) {
/* draw object pile annotation (a plus sign) */ /* draw object pile annotation (a plus sign) */
XSetForeground(dpy, tile_map->black_gc, XSetForeground(dpy, tile_map->black_gc,
pile_annotation.foreground); pile_annotation.foreground);
+2 -4
View File
@@ -631,9 +631,9 @@ unsigned long mbehavior UNUSED;
/*ARGSUSED*/ /*ARGSUSED*/
void void
X11_add_menu(window, glyph, identifier, ch, gch, attr, str, itemflags) X11_add_menu(window, glyphinfo, identifier, ch, gch, attr, str, itemflags)
winid window; winid window;
int glyph; /* unused (for now) */ const glyph_info *glyphinfo UNUSED;
const anything *identifier; const anything *identifier;
char ch; char ch;
char gch; /* group accelerator (0 = no group) */ char gch; /* group accelerator (0 = no group) */
@@ -645,8 +645,6 @@ unsigned itemflags;
struct menu_info_t *menu_info; struct menu_info_t *menu_info;
boolean preselected = (itemflags & MENU_ITEMFLAGS_SELECTED) != 0; boolean preselected = (itemflags & MENU_ITEMFLAGS_SELECTED) != 0;
nhUse(glyph);
check_winid(window); check_winid(window);
menu_info = window_list[window].menu_information; menu_info = window_list[window].menu_information;
if (!menu_info->is_menu) { if (!menu_info->is_menu) {
+8 -8
View File
@@ -183,9 +183,9 @@ unsigned long mbehavior;
} }
void void
chainin_add_menu(window, glyph, identifier, ch, gch, attr, str, itemflags) chainin_add_menu(window, glyphinfo, identifier, ch, gch, attr, str, itemflags)
winid window; /* window to use, must be of type NHW_MENU */ winid window; /* window to use, must be of type NHW_MENU */
int glyph; /* glyph to display with item (unused) */ const glyph_info *glyphinfo; /* glyph and other glyph info to display with item */
const anything *identifier; /* what to return if selected */ const anything *identifier; /* what to return if selected */
char ch; /* keyboard accelerator (0 = pick our own) */ char ch; /* keyboard accelerator (0 = pick our own) */
char gch; /* group accelerator (0 = no group) */ char gch; /* group accelerator (0 = no group) */
@@ -194,8 +194,8 @@ const char *str; /* menu string */
unsigned int itemflags; /* flags such as item is marked as selected unsigned int itemflags; /* flags such as item is marked as selected
MENU_ITEMFLAGS_SELECTED */ MENU_ITEMFLAGS_SELECTED */
{ {
(*cibase->nprocs->win_add_menu)(cibase->ndata, window, glyph, identifier, (*cibase->nprocs->win_add_menu)(cibase->ndata, window, glyphinfo,
ch, gch, attr, str, itemflags); identifier, ch, gch, attr, str, itemflags);
} }
void void
@@ -272,13 +272,13 @@ char *posbar;
/* XXX can we decode the glyph in a meaningful way? */ /* XXX can we decode the glyph in a meaningful way? */
void void
chainin_print_glyph(window, x, y, glyph, bkglyph, glyphmod) chainin_print_glyph(window, x, y, glyphinfo, bkglyphinfo)
winid window; winid window;
xchar x, y; xchar x, y;
int glyph, bkglyph; const glyph_info *glyphinfo;
int glyphmod[NUM_GLYPHMOD]; const glyph_info *bkglyphinfo;
{ {
(*cibase->nprocs->win_print_glyph)(cibase->ndata, window, x, y, glyph, bkglyph, glyphmod); (*cibase->nprocs->win_print_glyph)(cibase->ndata, window, x, y, glyphinfo, bkglyphinfo);
} }
void void
+8 -8
View File
@@ -224,11 +224,11 @@ unsigned long mbehavior;
} }
void void
chainout_add_menu(vp, window, glyph, identifier, ch, gch, attr, str, chainout_add_menu(vp, window, glyphinfo, identifier, ch, gch, attr, str,
itemflags) itemflags)
void *vp; void *vp;
winid window; /* window to use, must be of type NHW_MENU */ winid window; /* window to use, must be of type NHW_MENU */
int glyph; /* glyph to display with item (unused) */ const glyph_info *glyphinfo /* glyph plus glyph info to display with item */
const anything *identifier; /* what to return if selected */ const anything *identifier; /* what to return if selected */
char ch; /* keyboard accelerator (0 = pick our own) */ char ch; /* keyboard accelerator (0 = pick our own) */
char gch; /* group accelerator (0 = no group) */ char gch; /* group accelerator (0 = no group) */
@@ -238,8 +238,8 @@ unsigned int itemflags; /* itemflags such as marked as selected */
{ {
struct chainout_data *tdp = vp; struct chainout_data *tdp = vp;
(*tdp->nprocs->win_add_menu)(window, glyph, identifier, ch, gch, attr, (*tdp->nprocs->win_add_menu)(window, glyphinfo, identifier, ch, gch,
str, itemflags); attr, str, itemflags);
} }
void void
@@ -336,16 +336,16 @@ char *posbar;
#endif #endif
void void
chainout_print_glyph(vp, window, x, y, glyph, bkglyph, glyphmod) chainout_print_glyph(vp, window, x, y, glyphinfo, bkglyphinfo)
void *vp; void *vp;
winid window; winid window;
xchar x, y; xchar x, y;
int glyph, bkglyph; const glyph_info *glyphinfo;
int glyphmod[NUM_GLYPHMOD]; const glyph_info *bkglyphinfo;
{ {
struct chainout_data *tdp = vp; struct chainout_data *tdp = vp;
(*tdp->nprocs->win_print_glyph)(window, x, y, glyph, bkglyph, glyphmod); (*tdp->nprocs->win_print_glyph)(window, x, y, glyphinfo, bkglyphinfo);
} }
void void
+17 -17
View File
@@ -372,10 +372,10 @@ unsigned long mbehavior;
} }
void void
trace_add_menu(vp, window, glyph, identifier, ch, gch, attr, str, itemflags) trace_add_menu(vp, window, glyphinfo, identifier, ch, gch, attr, str, itemflags)
void *vp; void *vp;
winid window; /* window to use, must be of type NHW_MENU */ winid window; /* window to use, must be of type NHW_MENU */
int glyph; /* glyph to display with item (unused) */ const glyph_info *glyphinfo /* glyph plus glyph info to display with item */
const anything *identifier; /* what to return if selected */ const anything *identifier; /* what to return if selected */
char ch; /* keyboard accelerator (0 = pick our own) */ char ch; /* keyboard accelerator (0 = pick our own) */
char gch; /* group accelerator (0 = no group) */ char gch; /* group accelerator (0 = no group) */
@@ -402,19 +402,19 @@ unsigned int itemflags; /* itemflags such as marked as selected */
if (str) { if (str) {
fprintf(wc_tracelogf, fprintf(wc_tracelogf,
"%sadd_menu(%d, %d, %p, %s, %s, %d, '%s'(%d), %u)\n", INDENT, "%sadd_menu(%d, %d, %u, %p, %s, %s, %d, '%s'(%d), %u)\n", INDENT,
window, glyph, (void *) identifier, buf_ch, buf_gch, attr, window, glyphinfo->glyph, glyphinfo->flags, (void *) identifier,
str, (int) strlen(str), itemflags); buf_ch, buf_gch, attr, str, (int) strlen(str), itemflags);
} else { } else {
fprintf(wc_tracelogf, fprintf(wc_tracelogf,
"%sadd_menu(%d, %d, %p, %s, %s, %d, NULL, %u)\n", INDENT, "%sadd_menu(%d, %d, %u, %p, %s, %s, %d, NULL, %u)\n", INDENT,
window, glyph, (void *) identifier, buf_ch, buf_gch, attr, window, glyphinfo->glyph, glyphinfo->flags, (void *) identifier,
itemflags); buf_ch, buf_gch, attr, itemflags);
} }
PRE; PRE;
(*tdp->nprocs->win_add_menu)(tdp->ndata, window, glyph, identifier, ch, (*tdp->nprocs->win_add_menu)(tdp->ndata, window, glyphinfo,
gch, attr, str, itemflags); identifier,ch, gch, attr, str, itemflags);
POST; POST;
} }
@@ -575,23 +575,23 @@ char *posbar;
} }
#endif #endif
/* XXX can we decode the glyph in a meaningful way? see map_glyphmod()? /* XXX can we decode the glyph in a meaningful way? see map_glyphinfo()?
genl_putmixed? */ genl_putmixed? */
void void
trace_print_glyph(vp, window, x, y, glyph, bkglyph, glyphmod) trace_print_glyph(vp, window, x, y, glyphinfo, bkglyphinfo)
void *vp; void *vp;
winid window; winid window;
xchar x, y; xchar x, y;
int glyph, bkglyph; const glyph_info *glyphinfo;
int glyphmod[NUM_GLYPHMOD]; const glyph_info *bkglyphinfo;
{ {
struct trace_data *tdp = vp; struct trace_data *tdp = vp;
fprintf(wc_tracelogf, "%sprint_glyph(%d, %d, %d, %d, %d, %lu)\n", INDENT, window, fprintf(wc_tracelogf, "%sprint_glyph(%d, %d, %d, %d, %d)\n", INDENT, window,
x, y, glyph, bkglyph, glyphmod); x, y, glyphinfo->glyph, bkglyphinfo->glyph);
PRE; PRE;
(*tdp->nprocs->win_print_glyph)(tdp->ndata, window, x, y, glyph, bkglyph, glyphmod); (*tdp->nprocs->win_print_glyph)(tdp->ndata, window, x, y, glyphinfo, bkglyphinfo);
POST; POST;
} }
+9 -11
View File
@@ -58,7 +58,7 @@ int func(CHAR_P arg) { ... }
typedef struct nhmi { typedef struct nhmi {
winid wid; /* NetHack window id */ winid wid; /* NetHack window id */
int glyph; /* Menu glyphs */ glyph_info glyphinfo; /* holds menu glyph and additional glyph info */
anything identifier; /* Value returned if item selected */ anything identifier; /* Value returned if item selected */
CHAR_P accelerator; /* Character used to select item from menu */ CHAR_P accelerator; /* Character used to select item from menu */
CHAR_P group_accel; /* Group accelerator for menu item, if any */ CHAR_P group_accel; /* Group accelerator for menu item, if any */
@@ -582,7 +582,7 @@ curs_new_menu_item(winid wid, const char *str)
curses_rtrim(new_str); curses_rtrim(new_str);
new_item = (nhmenu_item *) alloc((unsigned) sizeof (nhmenu_item)); new_item = (nhmenu_item *) alloc((unsigned) sizeof (nhmenu_item));
new_item->wid = wid; new_item->wid = wid;
new_item->glyph = NO_GLYPH; new_item->glyphinfo = nul_glyphinfo;
new_item->identifier = cg.zeroany; new_item->identifier = cg.zeroany;
new_item->accelerator = '\0'; new_item->accelerator = '\0';
new_item->group_accel = '\0'; new_item->group_accel = '\0';
@@ -601,8 +601,9 @@ curs_new_menu_item(winid wid, const char *str)
/* Add a menu item to the given menu window */ /* Add a menu item to the given menu window */
void void
curses_add_nhmenu_item(winid wid, int glyph, const ANY_P *identifier, curses_add_nhmenu_item(winid wid, const glyph_info *glyphinfo,
CHAR_P accelerator, CHAR_P group_accel, int attr, const ANY_P *identifier, CHAR_P accelerator,
CHAR_P group_accel, int attr,
const char *str, unsigned itemflags) const char *str, unsigned itemflags)
{ {
nhmenu_item *new_item, *current_items, *menu_item_ptr; nhmenu_item *new_item, *current_items, *menu_item_ptr;
@@ -620,7 +621,8 @@ curses_add_nhmenu_item(winid wid, int glyph, const ANY_P *identifier,
} }
new_item = curs_new_menu_item(wid, str); new_item = curs_new_menu_item(wid, str);
new_item->glyph = glyph; if (glyphinfo)
new_item->glyphinfo = *glyphinfo;
new_item->identifier = *identifier; new_item->identifier = *identifier;
new_item->accelerator = accelerator; new_item->accelerator = accelerator;
new_item->group_accel = group_accel; new_item->group_accel = group_accel;
@@ -1179,12 +1181,8 @@ menu_display_page(nhmenu *menu, WINDOW * win, int page_num, char *selectors)
} }
#if 0 #if 0
/* FIXME: menuglyphs not implemented yet */ /* FIXME: menuglyphs not implemented yet */
if (menu_item_ptr->glyph != NO_GLYPH && iflags.use_menu_glyphs) { if (menu_item_ptr->glyphinfo.glyph != NO_GLYPH && iflags.use_menu_glyphs) {
unsigned glyphmod[NUM_GLYPHMOD]; color = (int) menu_item_ptr->glyphinfo.color;
map_glyphmod(0, 0, menu_item_ptr->glyph, 0U, glyphmod);
color = (int) glyphmod[GM_COLOR];
curses_toggle_color_attr(win, color, NONE, ON); curses_toggle_color_attr(win, color, NONE, ON);
mvwaddch(win, menu_item_ptr->line_num + 1, start_col, curletter); mvwaddch(win, menu_item_ptr->line_num + 1, start_col, curletter);
curses_toggle_color_attr(win, color, NONE, OFF); curses_toggle_color_attr(win, color, NONE, OFF);
+3 -2
View File
@@ -13,8 +13,9 @@ int curses_character_input_dialog(const char *prompt, const char *choices,
CHAR_P def); CHAR_P def);
int curses_ext_cmd(void); int curses_ext_cmd(void);
void curses_create_nhmenu(winid wid, unsigned long); void curses_create_nhmenu(winid wid, unsigned long);
void curses_add_nhmenu_item(winid wid, int glyph, const ANY_P *identifier, void curses_add_nhmenu_item(winid wid, const glyph_info *glyphinfo,
CHAR_P accelerator, CHAR_P group_accel, int attr, const ANY_P *identifier, CHAR_P accelerator,
CHAR_P group_accel, int attr,
const char *str, unsigned itemflags); const char *str, unsigned itemflags);
void curs_menu_set_bottom_heavy(winid); void curs_menu_set_bottom_heavy(winid);
void curses_finalize_nhmenu(winid wid, const char *prompt); void curses_finalize_nhmenu(winid wid, const char *prompt);
+5 -5
View File
@@ -742,20 +742,20 @@ curses_character_dialog(const char **choices, const char *prompt)
} }
identifier.a_int = (count + 1); /* Must be non-zero */ identifier.a_int = (count + 1); /* Must be non-zero */
curses_add_menu(wid, NO_GLYPH, &identifier, curletter, 0, curses_add_menu(wid, &nul_glyphinfo, &identifier, curletter, 0,
A_NORMAL, choices[count], MENU_ITEMFLAGS_NONE); A_NORMAL, choices[count], MENU_ITEMFLAGS_NONE);
used_letters[count] = curletter; used_letters[count] = curletter;
} }
/* Random Selection */ /* Random Selection */
identifier.a_int = ROLE_RANDOM; identifier.a_int = ROLE_RANDOM;
curses_add_menu(wid, NO_GLYPH, &identifier, '*', 0, A_NORMAL, "Random", curses_add_menu(wid, &nul_glyphinfo, &identifier, '*', 0,
MENU_ITEMFLAGS_NONE); A_NORMAL, "Random", MENU_ITEMFLAGS_NONE);
/* Quit prompt */ /* Quit prompt */
identifier.a_int = ROLE_NONE; identifier.a_int = ROLE_NONE;
curses_add_menu(wid, NO_GLYPH, &identifier, 'q', 0, A_NORMAL, "Quit", curses_add_menu(wid, &nul_glyphinfo, &identifier, 'q', 0,
MENU_ITEMFLAGS_NONE); A_NORMAL, "Quit", MENU_ITEMFLAGS_NONE);
curses_end_menu(wid, prompt); curses_end_menu(wid, prompt);
ret = curses_select_menu(wid, PICK_ONE, &selected); ret = curses_select_menu(wid, PICK_ONE, &selected);
if (ret == 1) { if (ret == 1) {
+4 -7
View File
@@ -55,9 +55,8 @@ curses_update_inv(void)
/* Adds an inventory item. 'y' is 1 rather than 0 for the first item. */ /* Adds an inventory item. 'y' is 1 rather than 0 for the first item. */
void void
curses_add_inv(int y, curses_add_inv(int y, const glyph_info *glyphinfo UNUSED, CHAR_P accelerator,
int glyph UNUSED, attr_t attr, const char *str)
CHAR_P accelerator, attr_t attr, const char *str)
{ {
WINDOW *win = curses_get_nhwin(INV_WIN); WINDOW *win = curses_get_nhwin(INV_WIN);
int color = NO_COLOR; int color = NO_COLOR;
@@ -120,13 +119,11 @@ curses_add_inv(int y,
} }
#if 0 /* FIXME: MENU GLYPHS */ #if 0 /* FIXME: MENU GLYPHS */
if (accelerator && glyph != NO_GLYPH && iflags.use_menu_glyphs) { if (accelerator && glyph != NO_GLYPH && iflags.use_menu_glyphs) {
unsigned glyphmod[NUM_GLYPHMOD];
int symbol; int symbol;
attr_t glyphclr; attr_t glyphclr;
map_glyphmod(0, 0, glyph, 0U, glyphmod); symbol = glyphinfo->ttychar;
symbol = (int) glyphmod[GM_TTYCHAR]; color = glyphinfo->color;
color = (int) glyphmod[GM_COLOR];
glyphclr = curses_color_attr(color, 0); glyphclr = curses_color_attr(color, 0);
wattron(win, glyphclr); wattron(win, glyphclr);
+36 -18
View File
@@ -524,7 +524,8 @@ curses_start_menu(winid wid, unsigned long mbehavior)
} }
/* /*
add_menu(winid wid, int glyph, const anything identifier, add_menu(winid wid, const glyph_info *glyphinfo,
const anything identifier,
char accelerator, char groupacc, char accelerator, char groupacc,
int attr, char *str, unsigned int itemflags) int attr, char *str, unsigned int itemflags)
-- Add a text line str to the given menu window. If identifier -- Add a text line str to the given menu window. If identifier
@@ -536,7 +537,8 @@ add_menu(winid wid, int glyph, const anything identifier,
accelerator. It is up to the window-port to make the accelerator. It is up to the window-port to make the
accelerator visible to the user (e.g. put "a - " in front accelerator visible to the user (e.g. put "a - " in front
of str). The value attr is the same as in putstr(). of str). The value attr is the same as in putstr().
Glyph is an optional glyph to accompany the line. If -- Glyph is an optional glyph to accompany the line and its
modifiers (if any) can be found in glyphinfo. If
window port cannot or does not want to display it, this window port cannot or does not want to display it, this
is OK. If there is no glyph applicable, then this is OK. If there is no glyph applicable, then this
value will be NO_GLYPH. value will be NO_GLYPH.
@@ -555,7 +557,8 @@ add_menu(winid wid, int glyph, const anything identifier,
menu is displayed, set bit MENU_ITEMFLAGS_SELECTED. menu is displayed, set bit MENU_ITEMFLAGS_SELECTED.
*/ */
void void
curses_add_menu(winid wid, int glyph, const ANY_P * identifier, curses_add_menu(winid wid, const glyph_info *glyphinfo,
const ANY_P * identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr, CHAR_P accelerator, CHAR_P group_accel, int attr,
const char *str, unsigned itemflags) const char *str, unsigned itemflags)
{ {
@@ -565,12 +568,12 @@ curses_add_menu(winid wid, int glyph, const ANY_P * identifier,
curses_attr = curses_convert_attr(attr); curses_attr = curses_convert_attr(attr);
if (inv_update) { if (inv_update) {
curses_add_inv(inv_update, glyph, accelerator, curses_attr, str); curses_add_inv(inv_update, glyphinfo, accelerator, curses_attr, str);
inv_update++; inv_update++;
return; return;
} }
curses_add_nhmenu_item(wid, glyph, identifier, accelerator, group_accel, curses_add_nhmenu_item(wid, glyphinfo, identifier, accelerator, group_accel,
curses_attr, str, itemflags); curses_attr, str, itemflags);
} }
@@ -686,30 +689,45 @@ curses_cliparound(int x, int y)
} }
/* /*
print_glyph(window, x, y, glyph, bkglyph, glyphmod) print_glyph(window, x, y, glyphinfo, bkglyphinfo)
-- Print the glyph at (x,y) on the given window. Glyphs are -- Print glyph at (x,y) on the given window. Glyphs are
integers at the interface, mapped to whatever the window- integers within the glyph_info struct that is passed
at the interface, mapped to whatever the window-
port wants (symbol, font, color, attributes, ...there's port wants (symbol, font, color, attributes, ...there's
a 1-1 map between glyphs and distinct things on the map). a 1-1 map between glyphs and distinct things on the map).
bkglyph is to render the background behind the glyph. bkglyphinfo is to render the background behind the glyph.
It's not used here. It's not used here.
-- glyphmod (glyphmod[NUM_GLYPHNOD]) provides extended -- bkglyphinfo contains a background glyph for potential use
information about the glyph that window ports can use to by some graphical or tiled environments to allow the depiction
enhance the display in various ways. to fall against a background consistent with the grid
around x,y. If bkglyphinfo->glyph is NO_GLYPH, then the
parameter should be ignored (do nothing with it).
-- glyph_info struct fields:
int glyph; the display entity
int color; color for window ports not using a tile
int ttychar; the character mapping for the original tty
interace. Most or all window ports wanted
and used this for various things so it is
provided in 3.7+
short int symidx; offset into syms array
unsigned glyphflags; more detail about the entity
*/ */
void void
curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph, curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y,
int bkglyph UNUSED, unsigned *glyphmod) const glyph_info *glyphinfo, const glyph_info *bkglyphinfo UNUSED)
{ {
int glyph;
int ch; int ch;
int color; int color;
unsigned int special; unsigned int special;
int attr = -1; int attr = -1;
special = glyphmod[GM_FLAGS]; glyph = glyphinfo->glyph;
ch = (int) glyphmod[GM_TTYCHAR]; special = glyphinfo->glyphflags;
color = (int) glyphmod[GM_COLOR]; ch = glyphinfo->ttychar;
color = glyphinfo->color;
if ((special & MG_PET) && iflags.hilite_pet) { if ((special & MG_PET) && iflags.hilite_pet) {
attr = iflags.wc2_petattr; attr = iflags.wc2_petattr;
} }
@@ -734,7 +752,7 @@ curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph,
/* water and lava look the same except for color; when color is off, /* water and lava look the same except for color; when color is off,
render lava in inverse video so that they look different */ render lava in inverse video so that they look different */
if ((special & (MG_BW_LAVA | MG_BW_ICE)) != 0 && iflags.use_inverse) { if ((special & (MG_BW_LAVA | MG_BW_ICE)) != 0 && iflags.use_inverse) {
attr = A_REVERSE; /* map_glyphmod() only sets this if color is off */ attr = A_REVERSE; /* map_glyphinfo() only sets this if color is off */
} }
} }
+6 -6
View File
@@ -373,16 +373,16 @@ curses_prev_mesg()
for (count = 0; count < num_messages; ++count) { for (count = 0; count < num_messages; ++count) {
mesg = get_msg_line(do_lifo, count); mesg = get_msg_line(do_lifo, count);
if (turn != mesg->turn && count != 0) { if (turn != mesg->turn && count != 0) {
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, "---", curses_add_menu(wid, &nul_glyphinfo, &Id, 0, 0,
MENU_ITEMFLAGS_NONE); A_NORMAL, "---", MENU_ITEMFLAGS_NONE);
} }
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, mesg->str, curses_add_menu(wid, &nul_glyphinfo, &Id, 0, 0,
MENU_ITEMFLAGS_NONE); A_NORMAL, mesg->str, MENU_ITEMFLAGS_NONE);
turn = mesg->turn; turn = mesg->turn;
} }
if (!count) if (!count)
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, curses_add_menu(wid, &nul_glyphinfo, &Id, 0, 0,
"[No past messages available.]", A_NORMAL, "[No past messages available.]",
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
curses_end_menu(wid, ""); curses_end_menu(wid, "");
+2 -1
View File
@@ -675,7 +675,8 @@ curses_view_file(const char *filename, boolean must_exist)
Id = cg.zeroany; Id = cg.zeroany;
while (dlb_fgets(buf, BUFSZ, fp) != NULL) { while (dlb_fgets(buf, BUFSZ, fp) != NULL) {
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, buf, FALSE); curses_add_menu(wid, &nul_glyphinfo, &Id, 0, 0,
A_NORMAL, buf, FALSE);
} }
dlb_fclose(fp); dlb_fclose(fp);
+2 -2
View File
@@ -509,8 +509,8 @@ curses_puts(winid wid, int attr, const char *text)
return; return;
} }
Id = cg.zeroany; Id = cg.zeroany;
curses_add_nhmenu_item(wid, NO_GLYPH, &Id, 0, 0, attr, text, curses_add_nhmenu_item(wid, &nul_glyphinfo, &Id, 0, 0,
MENU_ITEMFLAGS_NONE); attr, text, MENU_ITEMFLAGS_NONE);
} else { } else {
waddstr(win, text); waddstr(win, text);
wnoutrefresh(win); wnoutrefresh(win);
+7 -8
View File
@@ -248,9 +248,9 @@ unsigned long mbehavior;
* later. * later.
*/ */
void void
safe_add_menu(window, glyph, identifier, ch, gch, attr, str, itemflags) safe_add_menu(window, glyphinfo, identifier, ch, gch, attr, str, itemflags)
winid window; /* window to use, must be of type NHW_MENU */ winid window; /* window to use, must be of type NHW_MENU */
int glyph UNUSED; /* glyph to display with item (not used) */ const glyph_info *glyphinfo UNUSED; /* glyph plus glyph info */
const anything *identifier; /* what to return if selected */ const anything *identifier; /* what to return if selected */
char ch; /* keyboard accelerator (0 = pick our own) */ char ch; /* keyboard accelerator (0 = pick our own) */
char gch; /* group accelerator (0 = no group) */ char gch; /* group accelerator (0 = no group) */
@@ -321,12 +321,11 @@ int x, y;
* Print the glyph to the output device. Don't flush the output device. * Print the glyph to the output device. Don't flush the output device.
*/ */
void void
safe_print_glyph(window, x, y, glyph, bkglyph, glyphmod) safe_print_glyph(window, x, y, glyphinfo, bkglyphinfo)
winid window; winid window UNUSED;
xchar x, y; xchar x UNUSED, y UNUSED;
int glyph; const glyph_info *glyphinfo UNUSED;
int bkglyph UNUSED; const glyph_info *bkglyphinfo UNUSED;
int glyphmod[NUM_GLYPHMOD] UNUSED;
{ {
return; return;
} }
+3 -3
View File
@@ -118,9 +118,9 @@ VDECLCB(shim_putstr,(winid w, int attr, const char *str), "viis", A2P w, A2P att
VDECLCB(shim_display_file,(const char *name, BOOLEAN_P complain), "vsi", P2V name, A2P complain) VDECLCB(shim_display_file,(const char *name, BOOLEAN_P complain), "vsi", P2V name, A2P complain)
VDECLCB(shim_start_menu,(winid window, unsigned long mbehavior), "vii", A2P window, A2P mbehavior) VDECLCB(shim_start_menu,(winid window, unsigned long mbehavior), "vii", A2P window, A2P mbehavior)
VDECLCB(shim_add_menu, VDECLCB(shim_add_menu,
(winid window, int glyph, const ANY_P *identifier, CHAR_P ch, CHAR_P gch, int attr, const char *str, unsigned int itemflags), (winid window, const glyph_info *glyphinfo, const ANY_P *identifier, CHAR_P ch, CHAR_P gch, int attr, const char *str, unsigned int itemflags),
"viipiiisi", "viipiiisi",
A2P window, A2P glyph, P2V identifier, A2P ch, A2P gch, A2P attr, P2V str, A2P itemflags) A2P window, P2VP glyphinfo, P2V identifier, A2P ch, A2P gch, A2P attr, P2V str, A2P itemflags)
VDECLCB(shim_end_menu,(winid window, const char *prompt), "vis", A2P window, P2V prompt) VDECLCB(shim_end_menu,(winid window, const char *prompt), "vis", A2P window, P2V prompt)
/* XXX: shim_select_menu menu_list is an output */ /* 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) DECLCB(int, shim_select_menu,(winid window, int how, MENU_ITEM_P **menu_list), "iiio", A2P window, A2P how, P2V menu_list)
@@ -129,7 +129,7 @@ VDECLCB(shim_mark_synch,(void), "v")
VDECLCB(shim_wait_synch,(void), "v") VDECLCB(shim_wait_synch,(void), "v")
VDECLCB(shim_cliparound,(int x, int y), "vii", A2P x, A2P y) VDECLCB(shim_cliparound,(int x, int y), "vii", A2P x, A2P y)
VDECLCB(shim_update_positionbar,(char *posbar), "vp", P2V posbar) VDECLCB(shim_update_positionbar,(char *posbar), "vp", P2V posbar)
VDECLCB(shim_print_glyph,(winid w, int x, int y, int glyph, int bkglyph, int glyphmod[NUM_GLYPHMOD]), "viiiii", A2P w, A2P x, A2P y, A2P glyph, A2P bkglyph, A2P glyphmod) VDECLCB(shim_print_glyph,(winid w, int x, int y, const glyph_info *glyph, const glyph_info *bkglyph), "viiiii", A2P w, A2P x, A2P y, V2P glyphinfo, V2P bkglyphinfo)
VDECLCB(shim_raw_print,(const char *str), "vs", P2V str) VDECLCB(shim_raw_print,(const char *str), "vs", P2V str)
VDECLCB(shim_raw_print_bold,(const char *str), "vs", P2V str) VDECLCB(shim_raw_print_bold,(const char *str), "vs", P2V str)
DECLCB(int, shim_nhgetch,(void), "i") DECLCB(int, shim_nhgetch,(void), "i")
+47 -43
View File
@@ -600,8 +600,8 @@ tty_player_selection()
/* add miscellaneous menu entries */ /* add miscellaneous menu entries */
role_menu_extra(ROLE_RANDOM, win, TRUE); role_menu_extra(ROLE_RANDOM, win, TRUE);
any = cg.zeroany; /* separator, not a choice */ any = cg.zeroany; /* separator, not a choice */
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", add_menu(win, &nul_glyphinfo, &any, 0, 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, "", MENU_ITEMFLAGS_NONE);
role_menu_extra(RS_RACE, win, FALSE); role_menu_extra(RS_RACE, win, FALSE);
role_menu_extra(RS_GENDER, win, FALSE); role_menu_extra(RS_GENDER, win, FALSE);
role_menu_extra(RS_ALGNMNT, win, FALSE); role_menu_extra(RS_ALGNMNT, win, FALSE);
@@ -698,8 +698,8 @@ tty_player_selection()
/* add miscellaneous menu entries */ /* add miscellaneous menu entries */
role_menu_extra(ROLE_RANDOM, win, TRUE); role_menu_extra(ROLE_RANDOM, win, TRUE);
any.a_int = 0; /* separator, not a choice */ any.a_int = 0; /* separator, not a choice */
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", add_menu(win, &nul_glyphinfo, &any, 0, 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, "", MENU_ITEMFLAGS_NONE);
role_menu_extra(RS_ROLE, win, FALSE); role_menu_extra(RS_ROLE, win, FALSE);
role_menu_extra(RS_GENDER, win, FALSE); role_menu_extra(RS_GENDER, win, FALSE);
role_menu_extra(RS_ALGNMNT, win, FALSE); role_menu_extra(RS_ALGNMNT, win, FALSE);
@@ -790,8 +790,8 @@ tty_player_selection()
/* add miscellaneous menu entries */ /* add miscellaneous menu entries */
role_menu_extra(ROLE_RANDOM, win, TRUE); role_menu_extra(ROLE_RANDOM, win, TRUE);
any.a_int = 0; /* separator, not a choice */ any.a_int = 0; /* separator, not a choice */
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", add_menu(win, &nul_glyphinfo, &any, 0, 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, "", MENU_ITEMFLAGS_NONE);
role_menu_extra(RS_ROLE, win, FALSE); role_menu_extra(RS_ROLE, win, FALSE);
role_menu_extra(RS_RACE, win, FALSE); role_menu_extra(RS_RACE, win, FALSE);
role_menu_extra(RS_ALGNMNT, win, FALSE); role_menu_extra(RS_ALGNMNT, win, FALSE);
@@ -878,8 +878,8 @@ tty_player_selection()
setup_algnmenu(win, TRUE, ROLE, RACE, GEND); setup_algnmenu(win, TRUE, ROLE, RACE, GEND);
role_menu_extra(ROLE_RANDOM, win, TRUE); role_menu_extra(ROLE_RANDOM, win, TRUE);
any.a_int = 0; /* separator, not a choice */ any.a_int = 0; /* separator, not a choice */
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", add_menu(win, &nul_glyphinfo, &any, 0, 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, "", MENU_ITEMFLAGS_NONE);
role_menu_extra(RS_ROLE, win, FALSE); role_menu_extra(RS_ROLE, win, FALSE);
role_menu_extra(RS_RACE, win, FALSE); role_menu_extra(RS_RACE, win, FALSE);
role_menu_extra(RS_GENDER, win, FALSE); role_menu_extra(RS_GENDER, win, FALSE);
@@ -965,26 +965,27 @@ tty_player_selection()
races[RACE].adj, races[RACE].adj,
(GEND == 1 && roles[ROLE].name.f) ? roles[ROLE].name.f (GEND == 1 && roles[ROLE].name.f) ? roles[ROLE].name.f
: roles[ROLE].name.m); : roles[ROLE].name.m);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, pbuf, add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, pbuf,
MENU_ITEMFLAGS_NONE); MENU_ITEMFLAGS_NONE);
/* blank separator */ /* blank separator */
any.a_int = 0; any.a_int = 0;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); add_menu(win, &nul_glyphinfo, &any, 0, 0,
ATR_NONE, "", MENU_ITEMFLAGS_NONE);
/* [ynaq] menu choices */ /* [ynaq] menu choices */
any.a_int = 1; any.a_int = 1;
add_menu(win, NO_GLYPH, &any, 'y', 0, ATR_NONE, "Yes; start game", add_menu(win, &nul_glyphinfo, &any, 'y', 0,
MENU_ITEMFLAGS_SELECTED); ATR_NONE, "Yes; start game", MENU_ITEMFLAGS_SELECTED);
any.a_int = 2; any.a_int = 2;
add_menu(win, NO_GLYPH, &any, 'n', 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, 'n', 0,
"No; choose role again", MENU_ITEMFLAGS_NONE); ATR_NONE, "No; choose role again", MENU_ITEMFLAGS_NONE);
if (iflags.renameallowed) { if (iflags.renameallowed) {
any.a_int = 3; any.a_int = 3;
add_menu(win, NO_GLYPH, &any, 'a', 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, 'a', 0, ATR_NONE,
"Not yet; choose another name", MENU_ITEMFLAGS_NONE); "Not yet; choose another name", MENU_ITEMFLAGS_NONE);
} }
any.a_int = -1; any.a_int = -1;
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(win, &nul_glyphinfo, &any, 'q', 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, "Quit", MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Is this ok? [yn%sq]", iflags.renameallowed ? "a" : ""); Sprintf(pbuf, "Is this ok? [yn%sq]", iflags.renameallowed ? "a" : "");
end_menu(win, pbuf); end_menu(win, pbuf);
n = select_menu(win, PICK_ONE, &selected); n = select_menu(win, PICK_ONE, &selected);
@@ -1059,22 +1060,22 @@ reset_role_filtering()
any = cg.zeroany; any = cg.zeroany;
/* no extra blank line preceding this entry; end_menu supplies one */ /* no extra blank line preceding this entry; end_menu supplies one */
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"Unacceptable roles", MENU_ITEMFLAGS_NONE); "Unacceptable roles", MENU_ITEMFLAGS_NONE);
setup_rolemenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE); setup_rolemenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"Unacceptable races", MENU_ITEMFLAGS_NONE); "Unacceptable races", MENU_ITEMFLAGS_NONE);
setup_racemenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE); setup_racemenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"Unacceptable genders", MENU_ITEMFLAGS_NONE); "Unacceptable genders", MENU_ITEMFLAGS_NONE);
setup_gendmenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE); setup_gendmenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE); add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
"Unacceptable alignments", MENU_ITEMFLAGS_NONE); "Unacceptable alignments", MENU_ITEMFLAGS_NONE);
setup_algnmenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE); setup_algnmenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE);
@@ -1143,7 +1144,8 @@ int race, gend, algn; /* all ROLE_NONE for !filtering case */
} }
/* !filtering implies reset_role_filtering() where we want to /* !filtering implies reset_role_filtering() where we want to
mark this role as preseleted if current filter excludes it */ mark this role as preseleted if current filter excludes it */
add_menu(win, NO_GLYPH, &any, thisch, 0, ATR_NONE, an(rolenamebuf), add_menu(win, &nul_glyphinfo, &any, thisch, 0,
ATR_NONE, an(rolenamebuf),
(!filtering && !role_ok) (!filtering && !role_ok)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE); ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
lastch = thisch; lastch = thisch;
@@ -1178,7 +1180,7 @@ int role, gend, algn;
capital letter as unseen accelerator; capital letter as unseen accelerator;
!filtering: resetting filter rather than picking, choose by !filtering: resetting filter rather than picking, choose by
capital letter since lowercase role letters will be present */ capital letter since lowercase role letters will be present */
add_menu(win, NO_GLYPH, &any, add_menu(win, &nul_glyphinfo, &any,
filtering ? this_ch : highc(this_ch), filtering ? this_ch : highc(this_ch),
filtering ? highc(this_ch) : 0, filtering ? highc(this_ch) : 0,
ATR_NONE, races[i].noun, ATR_NONE, races[i].noun,
@@ -1213,7 +1215,7 @@ int role, race, algn;
this_ch = *genders[i].adj; this_ch = *genders[i].adj;
/* (see setup_racemenu for explanation of selector letters /* (see setup_racemenu for explanation of selector letters
and setup_rolemenu for preselection) */ and setup_rolemenu for preselection) */
add_menu(win, NO_GLYPH, &any, add_menu(win, &nul_glyphinfo, &any,
filtering ? this_ch : highc(this_ch), filtering ? this_ch : highc(this_ch),
filtering ? highc(this_ch) : 0, filtering ? highc(this_ch) : 0,
ATR_NONE, genders[i].adj, ATR_NONE, genders[i].adj,
@@ -1248,7 +1250,7 @@ int role, race, gend;
this_ch = *aligns[i].adj; this_ch = *aligns[i].adj;
/* (see setup_racemenu for explanation of selector letters /* (see setup_racemenu for explanation of selector letters
and setup_rolemenu for preselection) */ and setup_rolemenu for preselection) */
add_menu(win, NO_GLYPH, &any, add_menu(win, &nul_glyphinfo, &any,
filtering ? this_ch : highc(this_ch), filtering ? this_ch : highc(this_ch),
filtering ? highc(this_ch) : 0, filtering ? highc(this_ch) : 0,
ATR_NONE, aligns[i].adj, ATR_NONE, aligns[i].adj,
@@ -2950,9 +2952,9 @@ unsigned long mbehavior;
* later. * later.
*/ */
void void
tty_add_menu(window, glyph, identifier, ch, gch, attr, str, itemflags) tty_add_menu(window, glyphinfo, identifier, ch, gch, attr, str, itemflags)
winid window; /* window to use, must be of type NHW_MENU */ winid window; /* window to use, must be of type NHW_MENU */
int glyph UNUSED; /* glyph to display with item (not used) */ const glyph_info *glyphinfo UNUSED; /* glyph info w/glyph to display w/item */
const anything *identifier; /* what to return if selected */ const anything *identifier; /* what to return if selected */
char ch; /* keyboard accelerator (0 = pick our own) */ char ch; /* keyboard accelerator (0 = pick our own) */
char gch; /* group accelerator (0 = no group) */ char gch; /* group accelerator (0 = no group) */
@@ -3050,10 +3052,10 @@ const char *prompt; /* prompt to for menu */
anything any; anything any;
any = cg.zeroany; /* not selectable */ any = cg.zeroany; /* not selectable */
tty_add_menu(window, NO_GLYPH, &any, 0, 0, ATR_NONE, "", tty_add_menu(window, &nul_glyphinfo, &any, 0, 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, "", MENU_ITEMFLAGS_NONE);
tty_add_menu(window, NO_GLYPH, &any, 0, 0, ATR_NONE, prompt, tty_add_menu(window, &nul_glyphinfo, &any, 0, 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, prompt, MENU_ITEMFLAGS_NONE);
} }
/* 52: 'a'..'z' and 'A'..'Z'; avoids selector duplication within a page */ /* 52: 'a'..'z' and 'A'..'Z'; avoids selector duplication within a page */
@@ -3415,19 +3417,21 @@ int x, y;
*/ */
void void
tty_print_glyph(window, x, y, glyph, bkglyph, glyphmod) tty_print_glyph(window, x, y, glyphinfo, bkglyphinfo)
winid window; winid window;
xchar x, y; xchar x, y;
#ifdef TTY_TILES_ESCCODES #if defined(TTY_TILES_ESCCODES) || defined(MSDOS)
int glyph; const glyph_info *glyphinfo;
#else #else
int glyph UNUSED; const glyph_info *glyphinfo UNUSED;
#endif #endif
int bkglyph UNUSED; const glyph_info *bkglyphinfo UNUSED;
unsigned *glyphmod; /* don't mark UNUSED as we need to revisit */
{ {
boolean inverse_on = FALSE; boolean inverse_on = FALSE;
int ch, color; int ch, color;
#if defined(TTY_TILES_ESCCODES) || defined(MSDOS)
int glyph;
#endif
unsigned special; unsigned special;
HUPSKIP(); HUPSKIP();
@@ -3438,9 +3442,9 @@ unsigned *glyphmod; /* don't mark UNUSED as we need to revisit */
} }
#endif #endif
/* get glyph ttychar, color, and special flags */ /* get glyph ttychar, color, and special flags */
ch = (int) glyphmod[GM_TTYCHAR]; ch = glyphinfo->ttychar;
color = (int) glyphmod[GM_COLOR]; color = glyphinfo->color;
special = glyphmod[GM_FLAGS]; special = glyphinfo->glyphflags;
print_vt_code2(AVTC_SELECT_WINDOW, window); print_vt_code2(AVTC_SELECT_WINDOW, window);
+28 -33
View File
@@ -35,9 +35,8 @@ extern short glyph2tile[];
typedef struct mswin_nethack_map_window { typedef struct mswin_nethack_map_window {
HWND hWnd; /* window */ HWND hWnd; /* window */
int map[COLNO][ROWNO]; /* glyph map */ glyph_info map[COLNO][ROWNO];
int bkmap[COLNO][ROWNO]; /* backround glyph map */ glyph_info bkmap[COLNO][ROWNO];
unsigned glyphmod[COLNO][ROWNO][NUM_GLYPHMOD];
boolean mapDirty[COLNO][ROWNO]; /* dirty flag for map */ boolean mapDirty[COLNO][ROWNO]; /* dirty flag for map */
int mapMode; /* current map mode */ int mapMode; /* current map mode */
boolean bAsciiMode; /* switch ASCII/tiled mode */ boolean bAsciiMode; /* switch ASCII/tiled mode */
@@ -86,7 +85,8 @@ static void nhcoord2display(PNHMapWindow data, int x, int y, LPRECT lpOut);
static void paint(PNHMapWindow data, int i, int j); static void paint(PNHMapWindow data, int i, int j);
static void dirtyAll(PNHMapWindow data); static void dirtyAll(PNHMapWindow data);
static void dirty(PNHMapWindow data, int i, int j); static void dirty(PNHMapWindow data, int i, int j);
static void setGlyph(PNHMapWindow data, int i, int j, int fg, int bg, unsigned *glyphmod); static void setGlyph(PNHMapWindow data, int i, int j,
const glyph_info *fg, const glyph_info *bg);
static void clearAll(PNHMapWindow data); static void clearAll(PNHMapWindow data);
#if (VERSION_MAJOR < 4) && (VERSION_MINOR < 4) && (PATCHLEVEL < 2) #if (VERSION_MAJOR < 4) && (VERSION_MINOR < 4) && (PATCHLEVEL < 2)
@@ -639,7 +639,7 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
case MSNH_MSG_PRINT_GLYPH: { case MSNH_MSG_PRINT_GLYPH: {
PMSNHMsgPrintGlyph msg_data = (PMSNHMsgPrintGlyph) lParam; PMSNHMsgPrintGlyph msg_data = (PMSNHMsgPrintGlyph) lParam;
setGlyph(data, msg_data->x, msg_data->y, setGlyph(data, msg_data->x, msg_data->y,
msg_data->glyph, msg_data->bkglyph, msg_data->glyphmod); &msg_data->glyphinfo, &msg_data->bkglyphinfo);
} break; } break;
case MSNH_MSG_CLIPAROUND: { case MSNH_MSG_CLIPAROUND: {
@@ -719,9 +719,9 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
for (col = 0; col < COLNO; col++) { for (col = 0; col < COLNO; col++) {
if (index >= msg_data->max_size) if (index >= msg_data->max_size)
break; break;
if (data->map[col][row] == NO_GLYPH) if (data->map[col][row].glyph == NO_GLYPH)
mgch = ' '; mgch = ' ';
msg_data->buffer[index] = data->glyphmod[col][row][GM_TTYCHAR]; msg_data->buffer[index] = data->map[col][row].ttychar;
index++; index++;
} }
if (index >= msg_data->max_size - 1) if (index >= msg_data->max_size - 1)
@@ -788,8 +788,8 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect)
// int mgch; // int mgch;
#endif #endif
layer = 0; layer = 0;
glyph = data->map[i][j]; glyph = data->map[i][j].glyph;
bkglyph = data->bkmap[i][j]; bkglyph = data->bkmap[i][j].glyph;
if (glyph == NO_GLYPH && bkglyph == NO_GLYPH) { if (glyph == NO_GLYPH && bkglyph == NO_GLYPH) {
HBRUSH blackBrush = CreateSolidBrush(RGB(0, 0, 0)); HBRUSH blackBrush = CreateSolidBrush(RGB(0, 0, 0));
@@ -812,7 +812,7 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect)
if ((glyph != NO_GLYPH) && (glyph != bkglyph)) { if ((glyph != NO_GLYPH) && (glyph != bkglyph)) {
/* rely on NetHack core helper routine */ /* rely on NetHack core helper routine */
ntile = glyph2tile[glyph]; ntile = glyph2tile[glyph];
if (data->glyphmod[i][j][GM_FLAGS] & MG_FEMALE) if (data->map[i][j].glyphflags & MG_FEMALE)
ntile++; ntile++;
t_x = TILEBMP_X(ntile); t_x = TILEBMP_X(ntile);
t_y = TILEBMP_Y(ntile); t_y = TILEBMP_Y(ntile);
@@ -834,7 +834,7 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect)
} }
#ifdef USE_PILEMARK #ifdef USE_PILEMARK
if ((glyph != NO_GLYPH) && (data->glyphmod[i][j][GM_FLAGS] & MG_PET) if ((glyph != NO_GLYPH) && (data->map[i][j].glyphflags & MG_PET)
#else #else
if ((glyph != NO_GLYPH) && glyph_is_pet(glyph) if ((glyph != NO_GLYPH) && glyph_is_pet(glyph)
#endif #endif
@@ -857,7 +857,7 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect)
DeleteDC(hdcPetMark); DeleteDC(hdcPetMark);
} }
#ifdef USE_PILEMARK #ifdef USE_PILEMARK
if ((glyph != NO_GLYPH) && (data->glyphmod[i][j][GM_FLAGS] & MG_OBJPILE) if ((glyph != NO_GLYPH) && (data->map[i][j].glyphflags & MG_OBJPILE)
&& iflags.hilite_pile) { && iflags.hilite_pile) {
/* apply pilemark transparently over other image */ /* apply pilemark transparently over other image */
HDC hdcPileMark; HDC hdcPileMark;
@@ -886,7 +886,7 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect)
static void static void
paintGlyph(PNHMapWindow data, int i, int j, RECT * rect) paintGlyph(PNHMapWindow data, int i, int j, RECT * rect)
{ {
if (data->map[i][j] >= 0) { if (data->map[i][j].glyph >= 0) {
char ch; char ch;
WCHAR wch; WCHAR wch;
@@ -906,10 +906,10 @@ paintGlyph(PNHMapWindow data, int i, int j, RECT * rect)
nhglyph2charcolor(data->map[i][j], &ch, &color); nhglyph2charcolor(data->map[i][j], &ch, &color);
OldFg = SetTextColor(hDC, nhcolor_to_RGB(color)); OldFg = SetTextColor(hDC, nhcolor_to_RGB(color));
#else #else
ch = (char) data->glyphmod[i][j][GM_TTYCHAR]; ch = (char) data->map[i][j].ttychar;
color = (int) data->glyphmod[i][j][GM_COLOR]; color = (int) data->map[i][j].color;
if (((data->glyphmod[i][j][GM_FLAGS] & MG_PET) && iflags.hilite_pet) if (((data->map[i][j].glyphflags & MG_PET) && iflags.hilite_pet)
|| ((data->glyphmod[i][j][GM_FLAGS] & (MG_DETECT | MG_BW_LAVA)) || ((data->map[i][j].glyphflags & (MG_DETECT | MG_BW_LAVA))
&& iflags.use_inverse)) { && iflags.use_inverse)) {
back_brush = back_brush =
CreateSolidBrush(nhcolor_to_RGB(CLR_GRAY)); CreateSolidBrush(nhcolor_to_RGB(CLR_GRAY));
@@ -968,19 +968,17 @@ paintGlyph(PNHMapWindow data, int i, int j, RECT * rect)
} }
} }
static void setGlyph(PNHMapWindow data, int i, int j, int fg, int bg, unsigned *glyphmod) static void setGlyph(PNHMapWindow data, int i, int j,
const glyph_info *fg, const glyph_info *bg)
{ {
int gm; if ((data->map[i][j].glyph != fg->glyph)
|| (data->bkmap[i][j].glyph != bg->glyph)
if ((data->map[i][j] != fg) || (data->bkmap[i][j] != bg) || data->map[i][j].ttychar != fg->ttychar
|| data->glyphmod[i][j][GM_TTYCHAR] != glyphmod[GM_TTYCHAR] || data->map[i][j].color != fg->color
|| data->glyphmod[i][j][GM_COLOR] != glyphmod[GM_COLOR] || data->map[i][j].glyphflags != fg->glyphflags) {
|| data->glyphmod[i][j][GM_FLAGS] != glyphmod[GM_FLAGS]) { data->map[i][j] = *fg;
data->map[i][j] = fg; data->bkmap[i][j] = *bg;
data->bkmap[i][j] = bg;
data->mapDirty[i][j] = TRUE; data->mapDirty[i][j] = TRUE;
for (gm = 0; gm < NUM_GLYPHMOD; ++gm)
data->glyphmod[i][j][gm] = glyphmod[gm];
RECT rect; RECT rect;
nhcoord2display(data, i, j, &rect); nhcoord2display(data, i, j, &rect);
InvalidateRect(data->hWnd, &rect, FALSE); InvalidateRect(data->hWnd, &rect, FALSE);
@@ -991,11 +989,8 @@ static void clearAll(PNHMapWindow data)
{ {
for (int x = 0; x < COLNO; x++) for (int x = 0; x < COLNO; x++)
for (int y = 0; y < ROWNO; y++) { for (int y = 0; y < ROWNO; y++) {
data->map[x][y] = NO_GLYPH; data->map[x][y] = nul_glyphinfo;
data->bkmap[x][y] = NO_GLYPH; data->bkmap[x][y] = nul_glyphinfo;
data->glyphmod[x][y][GM_TTYCHAR] = ' ';
data->glyphmod[x][y][GM_COLOR] = NO_COLOR;
data->glyphmod[x][y][GM_FLAGS] = 0U;
data->mapDirty[x][y] = TRUE; data->mapDirty[x][y] = TRUE;
} }
InvalidateRect(data->hWnd, NULL, FALSE); InvalidateRect(data->hWnd, NULL, FALSE);
+5 -5
View File
@@ -27,7 +27,7 @@
#define CHECK_HEIGHT 16 #define CHECK_HEIGHT 16
typedef struct mswin_menu_item { typedef struct mswin_menu_item {
int glyph; glyph_info glyphinfo;
ANY_P identifier; ANY_P identifier;
CHAR_P accelerator; CHAR_P accelerator;
CHAR_P group_accel; CHAR_P group_accel;
@@ -78,7 +78,7 @@ static WNDPROC editControlWndProc = NULL;
#define NHMENU_IS_SELECTABLE(item) ((item).identifier.a_obj != NULL) #define NHMENU_IS_SELECTABLE(item) ((item).identifier.a_obj != NULL)
#define NHMENU_IS_SELECTED(item) ((item).count != 0) #define NHMENU_IS_SELECTED(item) ((item).count != 0)
#define NHMENU_HAS_GLYPH(item) ((item).glyph != NO_GLYPH) #define NHMENU_HAS_GLYPH(item) ((item).glyphinfo.glyph != NO_GLYPH)
INT_PTR CALLBACK MenuWndProc(HWND, UINT, WPARAM, LPARAM); INT_PTR CALLBACK MenuWndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK NHMenuListWndProc(HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK NHMenuListWndProc(HWND, UINT, WPARAM, LPARAM);
@@ -618,7 +618,7 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
new_item = data->menu.size; new_item = data->menu.size;
ZeroMemory(&data->menu.items[new_item], ZeroMemory(&data->menu.items[new_item],
sizeof(data->menu.items[new_item])); sizeof(data->menu.items[new_item]));
data->menu.items[new_item].glyph = msg_data->glyph; data->menu.items[new_item].glyphinfo = msg_data->glyphinfo;
data->menu.items[new_item].identifier = *msg_data->identifier; data->menu.items[new_item].identifier = *msg_data->identifier;
data->menu.items[new_item].accelerator = msg_data->accelerator; data->menu.items[new_item].accelerator = msg_data->accelerator;
data->menu.items[new_item].group_accel = msg_data->group_accel; data->menu.items[new_item].group_accel = msg_data->group_accel;
@@ -1082,7 +1082,7 @@ onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
double monitorScale = win10_monitor_scale(hWnd); double monitorScale = win10_monitor_scale(hWnd);
saveBmp = SelectObject(tileDC, GetNHApp()->bmpMapTiles); saveBmp = SelectObject(tileDC, GetNHApp()->bmpMapTiles);
ntile = glyph2tile[item->glyph]; ntile = glyph2tile[item->glyphinfo.glyph];
t_x = t_x =
(ntile % GetNHApp()->mapTilesPerLine) * GetNHApp()->mapTile_X; (ntile % GetNHApp()->mapTilesPerLine) * GetNHApp()->mapTile_X;
t_y = t_y =
@@ -1166,7 +1166,7 @@ onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
client_rt.right = min(client_rt.right, lpdis->rcItem.right); client_rt.right = min(client_rt.right, lpdis->rcItem.right);
if (NHMENU_IS_SELECTABLE(*item) if (NHMENU_IS_SELECTABLE(*item)
&& data->menu.items[lpdis->itemID].count != 0 && data->menu.items[lpdis->itemID].count != 0
&& item->glyph != NO_GLYPH) { && item->glyphinfo.glyph != NO_GLYPH) {
if (data->menu.items[lpdis->itemID].count == -1) { if (data->menu.items[lpdis->itemID].count == -1) {
_stprintf(wbuf, TEXT("Count: All")); _stprintf(wbuf, TEXT("Count: All"));
} else { } else {
+3 -4
View File
@@ -36,9 +36,8 @@ typedef struct mswin_nhmsg_putstr {
typedef struct mswin_nhmsg_print_glyph { typedef struct mswin_nhmsg_print_glyph {
XCHAR_P x; XCHAR_P x;
XCHAR_P y; XCHAR_P y;
int glyph; glyph_info glyphinfo;
int bkglyph; glyph_info bkglyphinfo;
int glyphmod[NUM_GLYPHMOD];
} MSNHMsgPrintGlyph, *PMSNHMsgPrintGlyph; } MSNHMsgPrintGlyph, *PMSNHMsgPrintGlyph;
typedef struct mswin_nhmsg_cliparound { typedef struct mswin_nhmsg_cliparound {
@@ -47,7 +46,7 @@ typedef struct mswin_nhmsg_cliparound {
} MSNHMsgClipAround, *PMSNHMsgClipAround; } MSNHMsgClipAround, *PMSNHMsgClipAround;
typedef struct mswin_nhmsg_add_menu { typedef struct mswin_nhmsg_add_menu {
int glyph; glyph_info glyphinfo;
const ANY_P *identifier; const ANY_P *identifier;
CHAR_P accelerator; CHAR_P accelerator;
CHAR_P group_accel; CHAR_P group_accel;
+50 -47
View File
@@ -428,8 +428,8 @@ prompt_for_player_selection(void)
} else } else
Strcpy(rolenamebuf, roles[i].name.m); Strcpy(rolenamebuf, roles[i].name.m);
} }
add_menu(win, NO_GLYPH, &any, thisch, 0, ATR_NONE, add_menu(win, &nul_glyphinfo, &any, thisch, 0,
an(rolenamebuf), MENU_ITEMFLAGS_NONE); ATR_NONE, an(rolenamebuf), MENU_ITEMFLAGS_NONE);
lastch = thisch; lastch = thisch;
} }
} }
@@ -437,11 +437,11 @@ prompt_for_player_selection(void)
flags.initalign, PICK_RANDOM) + 1; flags.initalign, PICK_RANDOM) + 1;
if (any.a_int == 0) /* must be non-zero */ if (any.a_int == 0) /* must be non-zero */
any.a_int = randrole(FALSE) + 1; any.a_int = randrole(FALSE) + 1;
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", add_menu(win, &nul_glyphinfo, &any, '*', 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, "Random", MENU_ITEMFLAGS_NONE);
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(win, &nul_glyphinfo, &any, 'q', 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, "Quit", MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Pick a role for your %s", plbuf); Sprintf(pbuf, "Pick a role for your %s", plbuf);
end_menu(win, pbuf); end_menu(win, pbuf);
n = select_menu(win, PICK_ONE, &selected); n = select_menu(win, PICK_ONE, &selected);
@@ -503,18 +503,19 @@ prompt_for_player_selection(void)
if (ok_race(flags.initrole, i, flags.initgend, if (ok_race(flags.initrole, i, flags.initgend,
flags.initalign)) { flags.initalign)) {
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, races[i].noun[0], 0, add_menu(win, &nul_glyphinfo, &any,
ATR_NONE, races[i].noun, MENU_ITEMFLAGS_NONE); races[i].noun[0], 0, ATR_NONE,
races[i].noun, MENU_ITEMFLAGS_NONE);
} }
any.a_int = pick_race(flags.initrole, flags.initgend, any.a_int = pick_race(flags.initrole, flags.initgend,
flags.initalign, PICK_RANDOM) + 1; flags.initalign, PICK_RANDOM) + 1;
if (any.a_int == 0) /* must be non-zero */ if (any.a_int == 0) /* must be non-zero */
any.a_int = randrace(flags.initrole) + 1; any.a_int = randrace(flags.initrole) + 1;
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", add_menu(win, &nul_glyphinfo, &any, '*', 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, "Random", MENU_ITEMFLAGS_NONE);
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(win, &nul_glyphinfo, &any, 'q', 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, "Quit", MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Pick the race of your %s", plbuf); Sprintf(pbuf, "Pick the race of your %s", plbuf);
end_menu(win, pbuf); end_menu(win, pbuf);
n = select_menu(win, PICK_ONE, &selected); n = select_menu(win, PICK_ONE, &selected);
@@ -577,18 +578,19 @@ prompt_for_player_selection(void)
if (ok_gend(flags.initrole, flags.initrace, i, if (ok_gend(flags.initrole, flags.initrace, i,
flags.initalign)) { flags.initalign)) {
any.a_int = i + 1; any.a_int = i + 1;
add_menu(win, NO_GLYPH, &any, genders[i].adj[0], 0, add_menu(win, &nul_glyphinfo, &any,
ATR_NONE, genders[i].adj, MENU_ITEMFLAGS_NONE); genders[i].adj[0], 0, ATR_NONE,
genders[i].adj, MENU_ITEMFLAGS_NONE);
} }
any.a_int = pick_gend(flags.initrole, flags.initrace, any.a_int = pick_gend(flags.initrole, flags.initrace,
flags.initalign, PICK_RANDOM) + 1; flags.initalign, PICK_RANDOM) + 1;
if (any.a_int == 0) /* must be non-zero */ if (any.a_int == 0) /* must be non-zero */
any.a_int = randgend(flags.initrole, flags.initrace) + 1; any.a_int = randgend(flags.initrole, flags.initrace) + 1;
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", add_menu(win, &nul_glyphinfo, &any, '*', 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, "Random", MENU_ITEMFLAGS_NONE);
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(win, &nul_glyphinfo, &any, 'q', 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, "Quit", MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Pick the gender of your %s", plbuf); Sprintf(pbuf, "Pick the gender of your %s", plbuf);
end_menu(win, pbuf); end_menu(win, pbuf);
n = select_menu(win, PICK_ONE, &selected); n = select_menu(win, PICK_ONE, &selected);
@@ -650,18 +652,19 @@ prompt_for_player_selection(void)
if (ok_align(flags.initrole, flags.initrace, if (ok_align(flags.initrole, flags.initrace,
flags.initgend, i)) { flags.initgend, i)) {
any.a_int = i + 1; any.a_int = i + 1;
add_menu(win, NO_GLYPH, &any, aligns[i].adj[0], 0, add_menu(win, &nul_glyphinfo, &any,
ATR_NONE, aligns[i].adj, MENU_ITEMFLAGS_NONE); aligns[i].adj[0], 0, ATR_NONE,
aligns[i].adj, MENU_ITEMFLAGS_NONE);
} }
any.a_int = pick_align(flags.initrole, flags.initrace, any.a_int = pick_align(flags.initrole, flags.initrace,
flags.initgend, PICK_RANDOM) + 1; flags.initgend, PICK_RANDOM) + 1;
if (any.a_int == 0) /* must be non-zero */ if (any.a_int == 0) /* must be non-zero */
any.a_int = randalign(flags.initrole, flags.initrace) + 1; any.a_int = randalign(flags.initrole, flags.initrace) + 1;
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", add_menu(win, &nul_glyphinfo, &any, '*', 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, "Random", MENU_ITEMFLAGS_NONE);
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(win, &nul_glyphinfo, &any, 'q', 0,
MENU_ITEMFLAGS_NONE); ATR_NONE, "Quit", MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Pick the alignment of your %s", plbuf); Sprintf(pbuf, "Pick the alignment of your %s", plbuf);
end_menu(win, pbuf); end_menu(win, pbuf);
n = select_menu(win, PICK_ONE, &selected); n = select_menu(win, PICK_ONE, &selected);
@@ -1093,12 +1096,12 @@ mswin_start_menu(winid wid, unsigned long mbehavior)
} }
/* /*
add_menu(windid window, int glyph, const anything identifier, add_menu(windid window, const glyph_info *glyphinfo,
const anything identifier,
char accelerator, char groupacc, char accelerator, char groupacc,
int attr, char *str, unsigned int itemflags) int attr, char *str, unsigned int itemflags)
-- Add a text line str to the given menu window. If -- Add a text line str to the given menu window. If
identifier identifier is 0, then the line cannot be selected (e.g. a title).
is 0, then the line cannot be selected (e.g. a title).
Otherwise, identifier is the value returned if the line is Otherwise, identifier is the value returned if the line is
selected. Accelerator is a keyboard key that can be used selected. Accelerator is a keyboard key that can be used
to select the line. If the accelerator of a selectable to select the line. If the accelerator of a selectable
@@ -1106,8 +1109,8 @@ identifier
accelerator. It is up to the window-port to make the accelerator. It is up to the window-port to make the
accelerator visible to the user (e.g. put "a - " in front accelerator visible to the user (e.g. put "a - " in front
of str). The value attr is the same as in putstr(). of str). The value attr is the same as in putstr().
Glyph is an optional glyph to accompany the line. If Glyphinfo->glyph is an optional glyph to accompany the line.
window port cannot or does not want to display it, this If window port cannot or does not want to display it, this
is OK. If there is no glyph applicable, then this is OK. If there is no glyph applicable, then this
value will be NO_GLYPH. value will be NO_GLYPH.
-- All accelerators should be in the range [A-Za-z]. -- All accelerators should be in the range [A-Za-z].
@@ -1125,19 +1128,22 @@ identifier
menu is displayed, set preselected to TRUE. menu is displayed, set preselected to TRUE.
*/ */
void void
mswin_add_menu(winid wid, int glyph, const ANY_P *identifier, mswin_add_menu(winid wid, const glyph_info *glyphinfo,
const ANY_P *identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr, CHAR_P accelerator, CHAR_P group_accel, int attr,
const char *str, unsigned int itemflags) const char *str, unsigned int itemflags)
{ {
boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0); boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0);
logDebug("mswin_add_menu(%d, %d, %p, %c, %c, %d, %s, %u)\n", wid, glyph, logDebug("mswin_add_menu(%d, %d, %u, %p, %c, %c, %d, %s, %u)\n", wid,
glyphinfo->glyph, glyphinfo->glyphflags,
identifier, (char) accelerator, (char) group_accel, attr, str, identifier, (char) accelerator, (char) group_accel, attr, str,
itemflags); itemflags);
if ((wid >= 0) && (wid < MAXWINDOWS) if ((wid >= 0) && (wid < MAXWINDOWS)
&& (GetNHApp()->windowlist[wid].win != NULL)) { && (GetNHApp()->windowlist[wid].win != NULL)) {
MSNHMsgAddMenu data; MSNHMsgAddMenu data;
ZeroMemory(&data, sizeof(data)); ZeroMemory(&data, sizeof(data));
data.glyph = glyph; if (glyphinfo)
data.glyphinfo = *glyphinfo;
data.identifier = identifier; data.identifier = identifier;
data.accelerator = accelerator; data.accelerator = accelerator;
data.group_accel = group_accel; data.group_accel = group_accel;
@@ -1281,24 +1287,22 @@ mswin_cliparound(int x, int y)
} }
/* /*
print_glyph(window, x, y, glyph, bkglyph, glyphmod) print_glyph(window, x, y, glyphinfo, bkglyphinfo)
-- Print the glyph at (x,y) on the given window. Glyphs are -- Print a glyph (glyphinfo->glyph) at (x,y) on the given
integers at the interface, mapped to whatever the window- window. Glyphs are integers mapped to whatever the window-
port wants (symbol, font, color, attributes, ...there's port wants (symbol, font, color, attributes, ...there's
a 1-1 map between glyphs and distinct things on the map). a 1-1 map between glyphs and distinct things on the map).
-- bkglyph is a background glyph for potential use by some -- bkglyphinfo contains a background glyph for potential use
graphical or tiled environments to allow the depiction by some graphical or tiled environments to allow the depiction
to fall against a background consistent with the grid to fall against a background consistent with the grid
around x,y. around x,y.
-- glyphmod provides extended information about the glyph
that window ports can use to enhance the display in
various ways.
*/ */
void void
mswin_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph, int bkglyph, unsigned *glyphmod) mswin_print_glyph(winid wid, XCHAR_P x, XCHAR_P y,
const glyph_info *glyphinfo, const glyph_info *bkglyphinfo)
{ {
logDebug("mswin_print_glyph(%d, %d, %d, %d, %d, %lu)\n", wid, x, y, glyph, bkglyph, glyphmod); logDebug("mswin_print_glyph(%d, %d, %d, %d, %d, %lu)\n", wid, x, y, glyphinfo->glyph, bkglyphinfo->glyph);
if ((wid >= 0) && (wid < MAXWINDOWS) if ((wid >= 0) && (wid < MAXWINDOWS)
&& (GetNHApp()->windowlist[wid].win != NULL)) { && (GetNHApp()->windowlist[wid].win != NULL)) {
@@ -1307,11 +1311,10 @@ mswin_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph, int bkglyph, unsig
ZeroMemory(&data, sizeof(data)); ZeroMemory(&data, sizeof(data));
data.x = x; data.x = x;
data.y = y; data.y = y;
data.glyph = glyph; if (glyphinfo)
data.bkglyph = bkglyph; data.glyphinfo = *glyphinfo;
data.glyphmod[GM_TTYCHAR] = glyphmod[GM_TTYCHAR]; if (bkglyphinfo)
data.glyphmod[GM_COLOR] = glyphmod[GM_COLOR]; data.bkglyphinfo = *bkglyphinfo;
data.glyphmod[GM_FLAGS] = glyphmod[GM_FLAGS];
SendMessage(GetNHApp()->windowlist[wid].win, WM_MSNH_COMMAND, SendMessage(GetNHApp()->windowlist[wid].win, WM_MSNH_COMMAND,
(WPARAM) MSNH_MSG_PRINT_GLYPH, (LPARAM) &data); (WPARAM) MSNH_MSG_PRINT_GLYPH, (LPARAM) &data);
} }
+4 -2
View File
@@ -153,7 +153,8 @@ void mswin_putstr(winid wid, int attr, const char *text);
void mswin_putstr_ex(winid wid, int attr, const char *text, int); void mswin_putstr_ex(winid wid, int attr, const char *text, int);
void mswin_display_file(const char *filename, BOOLEAN_P must_exist); void mswin_display_file(const char *filename, BOOLEAN_P must_exist);
void mswin_start_menu(winid wid, unsigned long mbehavior); void mswin_start_menu(winid wid, unsigned long mbehavior);
void mswin_add_menu(winid wid, int glyph, const ANY_P *identifier, void mswin_add_menu(winid wid, const glyph_info *glyphinfo,
const ANY_P *identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr, CHAR_P accelerator, CHAR_P group_accel, int attr,
const char *str, unsigned int itemflags); const char *str, unsigned int itemflags);
void mswin_end_menu(winid wid, const char *prompt); void mswin_end_menu(winid wid, const char *prompt);
@@ -162,7 +163,8 @@ void mswin_update_inventory(void);
void mswin_mark_synch(void); void mswin_mark_synch(void);
void mswin_wait_synch(void); void mswin_wait_synch(void);
void mswin_cliparound(int x, int y); void mswin_cliparound(int x, int y);
void mswin_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph, int bkglyph, unsigned *glyphmod); void mswin_print_glyph(winid wid, XCHAR_P x, XCHAR_P y,
const glyph_info *glyph, const glyph_info *bkglyph);
void mswin_raw_print(const char *str); void mswin_raw_print(const char *str);
void mswin_raw_print_bold(const char *str); void mswin_raw_print_bold(const char *str);
void mswin_raw_print_flush(); void mswin_raw_print_flush();