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

@@ -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
fix internal self-recover to work with recent fields added to checkpoint file
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
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
@@ -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
replace the single permonst mname field with male, female, and gender-neutral
names pmnames[NUM_MGENDERS] fields
add a new glyphmod parameter to window interface *_print_glyph() to be used
to provide additional details to the window port beyond the glyph;
window port mapglyph() calls and the function itself were removed
adjust window port interface to pass a pointer to a glyph_info struct which
contains the glyph itself, the ttychar, the color, the glyphflags,
and the symset index; this affects two window port calls that get
passed glyphs: print_glyph() and add_menu().

View File

@@ -191,19 +191,27 @@ int nh_poskey(int *x, int *y, int *mod)
B. High-level routines:
print_glyph(window, x, y, glyph, bkglyph, glyphmod[3])
-- Print the glyph at (x,y) on the given window. Glyphs are
integers at the interface, mapped to whatever the window-
print_glyph(window, x, y, glyphinfo, bkglyphinfo)
-- Print a glyph found within the glyphinfo at (x,y) on the
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
a 1-1 map between glyphs and distinct things on the map).
-- bkglyph is a background glyph for potential use by some
graphical or tiled environments to allow the depiction
-- bkglyphinfo contains a background glyph for potential use
by some graphical or tiled environments to allow the depiction
to fall against a background consistent with the grid
around x,y. If bkglyph is NO_GLYPH, then the parameter
should be ignored (do nothing with it).
-- glyphmod (glyphmod[NUM_GLYPHNOD]) provides extended
information about the glyph that window ports can use to
enhance the display in various ways.
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 */
char yn_function(const char *ques, const char *choices, char 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.
-- mbehavior allows flags to be passed to alter the appearance
and/or behavior of the menu.
add_menu(windid window, int glyph, const anything identifier,
char accelerator, char groupacc,
int attr, char *str, unsigned itemflags)
add_menu(windid window, glyphinfo, const anything identifier, char accelerator,
char groupacc, int attr, char *str,
unsigned itemflags)
-- Add a text line str to the given menu window. If identifier
is 0, then the line cannot be selected (e.g. a title).
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 visible to the user (e.g. put "a - " in front
of str). The value attr is the same as in putstr().
Glyph is an optional glyph to accompany the line. If
window port cannot or does not want to display it, this
is OK. If there is no glyph applicable, then this
value will be NO_GLYPH.
-- glyphinfo (glyph_info type) may optionally contain a glyph
to accompany the line. If a window port cannot
or does not want to display it, this is OK. If there is no
glyph provided, then the value of glyphinfo->glyph will
be NO_GLYPH.
-- All accelerators should be in the range [A-Za-z],
but there are a few exceptions such as the tty player
selection code which uses '*'.