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

View File

@@ -524,8 +524,8 @@ struct trapinfo {
typedef struct {
xchar gnew; /* perhaps move this bit into the rm structure. */
int glyph;
#ifndef UNBUFFERED_GLYPHMOD
unsigned glyphmod[NUM_GLYPHMOD];
#ifndef UNBUFFERED_GLYPHINFO
glyph_info glyphinfo;
#endif
} gbuf_entry;
@@ -1213,6 +1213,8 @@ struct const_globals {
E const struct const_globals cg;
E const glyph_info nul_glyphinfo;
#undef E
#endif /* DECL_H */

View File

@@ -475,14 +475,14 @@ enum explosion_types {
#define glyph_is_unexplored(glyph) ((glyph) == GLYPH_UNEXPLORED)
#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_NOOVERRIDE 0x01
#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_INVIS 0x0002
#define MG_DETECT 0x0004

View File

@@ -376,7 +376,7 @@ E void NDECL(reglyph_darkroom);
E void NDECL(set_wall_state);
E void FDECL(unset_seenv, (struct rm *, int, int, int, int));
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 ### */
@@ -3037,6 +3037,7 @@ E void FDECL(dump_redirect, (BOOLEAN_P));
E void FDECL(dump_forward_putstr, (winid, int, const char*, int));
E int FDECL(has_color, (int));
E int FDECL(glyph2ttychar, (int));
E int FDECL(glyph2symidx, (int));
E char *FDECL(encglyph, (int));
E char *FDECL(decode_mixed, (char *, const char *));
E void FDECL(genl_putmixed, (winid, int, const char *));

View File

@@ -65,7 +65,7 @@ struct text_map_info_t {
struct tile_glyph_info_t {
unsigned short glyph;
unsigned special;
unsigned glyphflags;
};
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_display_file, (const char *, BOOLEAN_P));
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));
E void FDECL(X11_end_menu, (winid, const char *));
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));
#endif
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_bold, (const char *));
E int NDECL(X11_nhgetch);

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_display_file(const char *filename, BOOLEAN_P must_exist);
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,
const char *str, unsigned int itemflags);
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_cliparound(int x, int 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_bold(const char *str);
extern int curses_nhgetch(void);
@@ -174,7 +175,7 @@ extern int curses_character_input_dialog(const char *prompt,
const char *choices, CHAR_P def);
extern int curses_ext_cmd(void);
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,
CHAR_P group_accel, int attr,
const char *str, unsigned itemflags);
@@ -194,7 +195,8 @@ extern void curses_status_update(int, genericptr_t, int, int, int,
/* cursinvt.c */
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 */

View File

@@ -36,7 +36,7 @@ E char NDECL(mar_ask_class);
E char *NDECL(mar_ask_name);
E int FDECL(mar_create_window, (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_set_message, (char *, char *, char *));
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_display_file, (const char *, BOOLEAN_P));
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));
E void FDECL(Gem_end_menu, (winid, const char *));
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 *));
#endif
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_bold, (const char *));
E int NDECL(Gem_nhgetch);

View File

@@ -31,8 +31,9 @@ struct window_procs {
void FDECL((*win_putmixed), (winid, int, const char *));
void FDECL((*win_display_file), (const char *, BOOLEAN_P));
void FDECL((*win_start_menu), (winid, unsigned long));
void FDECL((*win_add_menu), (winid, int, const ANY_P *, CHAR_P, CHAR_P,
int, const char *, unsigned int));
void FDECL((*win_add_menu), (winid, const glyph_info *, const ANY_P *,
CHAR_P, CHAR_P, int,
const char *, unsigned int));
void FDECL((*win_end_menu), (winid, const char *));
int FDECL((*win_select_menu), (winid, int, MENU_ITEM_P **));
char FDECL((*win_message_menu), (CHAR_P, int, const char *));
@@ -46,7 +47,7 @@ struct window_procs {
void FDECL((*win_update_positionbar), (char *));
#endif
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_bold), (const char *));
int NDECL((*win_nhgetch));
@@ -332,8 +333,9 @@ struct chain_procs {
void FDECL((*win_putmixed), (CARGS, winid, int, const char *));
void FDECL((*win_display_file), (CARGS, const char *, BOOLEAN_P));
void FDECL((*win_start_menu), (CARGS, winid, unsigned long));
void FDECL((*win_add_menu), (CARGS, winid, int, const ANY_P *, CHAR_P,
CHAR_P, int, const char *, unsigned int));
void FDECL((*win_add_menu), (CARGS, winid, const glyph_info *,
const ANY_P *, CHAR_P, CHAR_P, int,
const char *, unsigned int));
void FDECL((*win_end_menu), (CARGS, winid, const char *));
int FDECL((*win_select_menu), (CARGS, winid, int, MENU_ITEM_P **));
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 *));
#endif
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_bold), (CARGS, const char *));
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_display_file, (const char *, BOOLEAN_P));
extern void FDECL(safe_start_menu, (winid, unsigned long));
extern void FDECL(safe_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P,
int, const char *, unsigned int));
extern void FDECL(safe_add_menu, (winid, const glyph_info *, const ANY_P *,
CHAR_P, CHAR_P, int, const char *,
unsigned int));
extern void FDECL(safe_end_menu, (winid, const char *));
extern int FDECL(safe_select_menu, (winid, int, MENU_ITEM_P **));
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 *));
#endif
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_bold, (const char *));
extern int NDECL(safe_nhgetch);

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_display_file, (const char *, BOOLEAN_P));
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,
const char *, unsigned int));
E void FDECL(tty_add_menu, (winid, const glyph_info *, const ANY_P *,
CHAR_P, CHAR_P, int, const char *,
unsigned int));
E void FDECL(tty_end_menu, (winid, const char *));
E int FDECL(tty_select_menu, (winid, int, MENU_ITEM_P **));
E char FDECL(tty_message_menu, (CHAR_P, int, const char *));
@@ -211,7 +212,8 @@ E void FDECL(tty_cliparound, (int, int));
#ifdef POSITIONBAR
E void FDECL(tty_update_positionbar, (char *));
#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_bold, (const char *));
E int NDECL(tty_nhgetch);

View File

@@ -52,6 +52,19 @@ enum any_types {
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 */
typedef struct mi {
anything item; /* identifier */