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:
+6
-5
@@ -423,12 +423,12 @@ void NetHackQtBind::qt_start_menu(winid wid, unsigned long mbehavior UNUSED)
|
||||
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 char *str, unsigned itemflags)
|
||||
{
|
||||
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),
|
||||
itemflags);
|
||||
}
|
||||
@@ -474,12 +474,13 @@ void NetHackQtBind::qt_cliparound_window(winid wid, int x, int y)
|
||||
NetHackQtWindow* window=id_to_window[(int)wid];
|
||||
window->ClipAround(x,y);
|
||||
}
|
||||
void NetHackQtBind::qt_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,int glyph,
|
||||
int bkglyph UNUSED, unsigned *glyphmod)
|
||||
void NetHackQtBind::qt_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,
|
||||
const glyph_info *glyphinfo,
|
||||
const glyph_info *bkglyphinfo UNUSED)
|
||||
{
|
||||
/* TODO: bkglyph */
|
||||
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)
|
||||
//{
|
||||
|
||||
+3
-2
@@ -52,7 +52,7 @@ public:
|
||||
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_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 char *str, unsigned int itemflags);
|
||||
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_window(winid wid, int x, int 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_bold(const char *str);
|
||||
static int qt_nhgetch();
|
||||
|
||||
+14
-13
@@ -536,13 +536,13 @@ void NetHackQtMapViewport::CursorTo(int x,int y)
|
||||
Changed(cursor.x(), cursor.y());
|
||||
}
|
||||
|
||||
void NetHackQtMapViewport::PrintGlyph(int x, int y, int theglyph,
|
||||
unsigned *glyphmod)
|
||||
void NetHackQtMapViewport::PrintGlyph(int x, int y,
|
||||
const glyph_info *glyphinfo)
|
||||
{
|
||||
Glyph(x, y) = (unsigned short) theglyph;
|
||||
Glyphttychar(x, y) = (unsigned short) glyphmod[GM_TTYCHAR];
|
||||
Glyphcolor(x, y) = (unsigned short) glyphmod[GM_COLOR];
|
||||
Glyphflags(x, y) = glyphmod[GM_FLAGS];
|
||||
Glyph(x, y) = (unsigned short) glyphinfo->glyph;
|
||||
Glyphttychar(x, y) = (unsigned short) glyphinfo->ttychar;
|
||||
Glyphcolor(x, y) = (unsigned short) glyphinfo->color;
|
||||
Glyphflags(x, y) = glyphinfo->glyphflags;
|
||||
Changed(x, y);
|
||||
}
|
||||
|
||||
@@ -647,9 +647,10 @@ void NetHackQtMapWindow2::ClipAround(int x,int y)
|
||||
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
|
||||
@@ -1004,12 +1005,12 @@ void NetHackQtMapWindow::ClipAround(int x,int y)
|
||||
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;
|
||||
Glyphttychar(x,y)=glyphmod[GM_TTYCHAR];
|
||||
Glyphcolor(x,y)=glyphmod[GM_COLOR];
|
||||
Glyphflags(x,y)=glyphmod[GM_FLAGS];
|
||||
Glyph(x,y)=glyphinfo->glyph;
|
||||
Glyphttychar(x,y)=glyphinfo->ttychar;
|
||||
Glyphcolor(x,y)=glyphinfo->color;
|
||||
Glyphflags(x,y)=glyphinfo->glyphflags;
|
||||
Changed(x,y);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -56,7 +56,7 @@ private:
|
||||
void Clear();
|
||||
void Display(bool block);
|
||||
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 updateTiles();
|
||||
void SetupTextmapFont(QPainter &painter);
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
virtual void CursorTo(int x,int y);
|
||||
virtual void PutStr(int attr, const QString& text);
|
||||
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:
|
||||
void resized();
|
||||
|
||||
+1
-1
@@ -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)
|
||||
{ puts("unexpected SelectMenu"); return 0; }
|
||||
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::UseRIP(int how UNUSED, time_t when UNUSED) { puts("unexpected UseRIP"); }
|
||||
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ public:
|
||||
virtual void EndMenu(const QString& prompt);
|
||||
virtual int SelectMenu(int how, MENU_ITEM_P **menu_list);
|
||||
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);
|
||||
|
||||
int nhid;
|
||||
|
||||
+1
-1
@@ -1962,7 +1962,7 @@ boolean complain;
|
||||
|
||||
any = cg.zeroany;
|
||||
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);
|
||||
}
|
||||
(void) dlb_fclose(fp);
|
||||
|
||||
+14
-15
@@ -73,12 +73,11 @@ static void FDECL(display_cursor, (struct xwindow *));
|
||||
/* Global functions ======================================================= */
|
||||
|
||||
void
|
||||
X11_print_glyph(window, x, y, glyph, bkglyph, glyphmod)
|
||||
X11_print_glyph(window, x, y, glyphinfo, bkglyphinfo)
|
||||
winid window;
|
||||
xchar x, y;
|
||||
int glyph;
|
||||
int bkglyph UNUSED;
|
||||
unsigned *glyphmod UNUSED;
|
||||
const glyph_info *glyphinfo;
|
||||
const glyph_info *bkglyphinfo UNUSED;
|
||||
{
|
||||
struct map_info_t *map_info;
|
||||
boolean update_bbox = FALSE;
|
||||
@@ -94,8 +93,8 @@ unsigned *glyphmod UNUSED;
|
||||
{
|
||||
unsigned short *t_ptr = &map_info->tile_map.glyphs[y][x].glyph;
|
||||
|
||||
if (*t_ptr != glyph) {
|
||||
*t_ptr = glyph;
|
||||
if (*t_ptr != glyphinfo->glyph) {
|
||||
*t_ptr = glyphinfo->glyph;
|
||||
if (map_info->is_tile)
|
||||
update_bbox = TRUE;
|
||||
}
|
||||
@@ -110,13 +109,13 @@ unsigned *glyphmod UNUSED;
|
||||
register unsigned char *co_ptr;
|
||||
#endif
|
||||
|
||||
color = glyphmod[GM_COLOR];
|
||||
special = glyphmod[GM_FLAGS];
|
||||
och = glyphmod[GM_TTYCHAR];
|
||||
color = glyphinfo->color;
|
||||
special = glyphinfo->glyphflags;
|
||||
och = glyphinfo->ttychar;
|
||||
ch = (uchar) och;
|
||||
|
||||
if (special != map_info->tile_map.glyphs[y][x].special) {
|
||||
map_info->tile_map.glyphs[y][x].special = special;
|
||||
if (special != map_info->tile_map.glyphs[y][x].glyphflags) {
|
||||
map_info->tile_map.glyphs[y][x].glyphflags = special;
|
||||
update_bbox = TRUE;
|
||||
}
|
||||
|
||||
@@ -948,7 +947,7 @@ struct map_info_t *map_info;
|
||||
for (x = 0; x < COLNO; x++)
|
||||
for (y = 0; y < ROWNO; y++) {
|
||||
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);
|
||||
#ifdef TEXTCOLOR
|
||||
@@ -1297,7 +1296,7 @@ boolean inverted;
|
||||
int dest_x = (cur_col - COL0_OFFSET) * tile_map->square_width;
|
||||
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 */
|
||||
src_x = (tile % TILES_PER_ROW) * tile_width;
|
||||
src_y = (tile / TILES_PER_ROW) * tile_height;
|
||||
@@ -1306,7 +1305,7 @@ boolean inverted;
|
||||
src_x, src_y, tile_width, tile_height,
|
||||
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) */
|
||||
XSetForeground(dpy, tile_map->black_gc,
|
||||
pet_annotation.foreground);
|
||||
@@ -1321,7 +1320,7 @@ boolean inverted;
|
||||
XSetForeground(dpy, tile_map->black_gc,
|
||||
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) */
|
||||
XSetForeground(dpy, tile_map->black_gc,
|
||||
pile_annotation.foreground);
|
||||
|
||||
+2
-4
@@ -631,9 +631,9 @@ unsigned long mbehavior UNUSED;
|
||||
|
||||
/*ARGSUSED*/
|
||||
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;
|
||||
int glyph; /* unused (for now) */
|
||||
const glyph_info *glyphinfo UNUSED;
|
||||
const anything *identifier;
|
||||
char ch;
|
||||
char gch; /* group accelerator (0 = no group) */
|
||||
@@ -645,8 +645,6 @@ unsigned itemflags;
|
||||
struct menu_info_t *menu_info;
|
||||
boolean preselected = (itemflags & MENU_ITEMFLAGS_SELECTED) != 0;
|
||||
|
||||
nhUse(glyph);
|
||||
|
||||
check_winid(window);
|
||||
menu_info = window_list[window].menu_information;
|
||||
if (!menu_info->is_menu) {
|
||||
|
||||
@@ -183,9 +183,9 @@ unsigned long mbehavior;
|
||||
}
|
||||
|
||||
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 */
|
||||
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 */
|
||||
char ch; /* keyboard accelerator (0 = pick our own) */
|
||||
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
|
||||
MENU_ITEMFLAGS_SELECTED */
|
||||
{
|
||||
(*cibase->nprocs->win_add_menu)(cibase->ndata, window, glyph, identifier,
|
||||
ch, gch, attr, str, itemflags);
|
||||
(*cibase->nprocs->win_add_menu)(cibase->ndata, window, glyphinfo,
|
||||
identifier, ch, gch, attr, str, itemflags);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -272,13 +272,13 @@ char *posbar;
|
||||
|
||||
/* XXX can we decode the glyph in a meaningful way? */
|
||||
void
|
||||
chainin_print_glyph(window, x, y, glyph, bkglyph, glyphmod)
|
||||
chainin_print_glyph(window, x, y, glyphinfo, bkglyphinfo)
|
||||
winid window;
|
||||
xchar x, y;
|
||||
int glyph, bkglyph;
|
||||
int glyphmod[NUM_GLYPHMOD];
|
||||
const glyph_info *glyphinfo;
|
||||
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
|
||||
|
||||
@@ -224,11 +224,11 @@ unsigned long mbehavior;
|
||||
}
|
||||
|
||||
void
|
||||
chainout_add_menu(vp, window, glyph, identifier, ch, gch, attr, str,
|
||||
chainout_add_menu(vp, window, glyphinfo, identifier, ch, gch, attr, str,
|
||||
itemflags)
|
||||
void *vp;
|
||||
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 */
|
||||
char ch; /* keyboard accelerator (0 = pick our own) */
|
||||
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;
|
||||
|
||||
(*tdp->nprocs->win_add_menu)(window, glyph, identifier, ch, gch, attr,
|
||||
str, itemflags);
|
||||
(*tdp->nprocs->win_add_menu)(window, glyphinfo, identifier, ch, gch,
|
||||
attr, str, itemflags);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -336,16 +336,16 @@ char *posbar;
|
||||
#endif
|
||||
|
||||
void
|
||||
chainout_print_glyph(vp, window, x, y, glyph, bkglyph, glyphmod)
|
||||
chainout_print_glyph(vp, window, x, y, glyphinfo, bkglyphinfo)
|
||||
void *vp;
|
||||
winid window;
|
||||
xchar x, y;
|
||||
int glyph, bkglyph;
|
||||
int glyphmod[NUM_GLYPHMOD];
|
||||
const glyph_info *glyphinfo;
|
||||
const glyph_info *bkglyphinfo;
|
||||
{
|
||||
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
|
||||
|
||||
+17
-17
@@ -372,10 +372,10 @@ unsigned long mbehavior;
|
||||
}
|
||||
|
||||
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;
|
||||
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 */
|
||||
char ch; /* keyboard accelerator (0 = pick our own) */
|
||||
char gch; /* group accelerator (0 = no group) */
|
||||
@@ -402,19 +402,19 @@ unsigned int itemflags; /* itemflags such as marked as selected */
|
||||
|
||||
if (str) {
|
||||
fprintf(wc_tracelogf,
|
||||
"%sadd_menu(%d, %d, %p, %s, %s, %d, '%s'(%d), %u)\n", INDENT,
|
||||
window, glyph, (void *) identifier, buf_ch, buf_gch, attr,
|
||||
str, (int) strlen(str), itemflags);
|
||||
"%sadd_menu(%d, %d, %u, %p, %s, %s, %d, '%s'(%d), %u)\n", INDENT,
|
||||
window, glyphinfo->glyph, glyphinfo->flags, (void *) identifier,
|
||||
buf_ch, buf_gch, attr, str, (int) strlen(str), itemflags);
|
||||
} else {
|
||||
fprintf(wc_tracelogf,
|
||||
"%sadd_menu(%d, %d, %p, %s, %s, %d, NULL, %u)\n", INDENT,
|
||||
window, glyph, (void *) identifier, buf_ch, buf_gch, attr,
|
||||
itemflags);
|
||||
"%sadd_menu(%d, %d, %u, %p, %s, %s, %d, NULL, %u)\n", INDENT,
|
||||
window, glyphinfo->glyph, glyphinfo->flags, (void *) identifier,
|
||||
buf_ch, buf_gch, attr, itemflags);
|
||||
}
|
||||
|
||||
PRE;
|
||||
(*tdp->nprocs->win_add_menu)(tdp->ndata, window, glyph, identifier, ch,
|
||||
gch, attr, str, itemflags);
|
||||
(*tdp->nprocs->win_add_menu)(tdp->ndata, window, glyphinfo,
|
||||
identifier,ch, gch, attr, str, itemflags);
|
||||
POST;
|
||||
}
|
||||
|
||||
@@ -575,23 +575,23 @@ char *posbar;
|
||||
}
|
||||
#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? */
|
||||
void
|
||||
trace_print_glyph(vp, window, x, y, glyph, bkglyph, glyphmod)
|
||||
trace_print_glyph(vp, window, x, y, glyphinfo, bkglyphinfo)
|
||||
void *vp;
|
||||
winid window;
|
||||
xchar x, y;
|
||||
int glyph, bkglyph;
|
||||
int glyphmod[NUM_GLYPHMOD];
|
||||
const glyph_info *glyphinfo;
|
||||
const glyph_info *bkglyphinfo;
|
||||
{
|
||||
struct trace_data *tdp = vp;
|
||||
|
||||
fprintf(wc_tracelogf, "%sprint_glyph(%d, %d, %d, %d, %d, %lu)\n", INDENT, window,
|
||||
x, y, glyph, bkglyph, glyphmod);
|
||||
fprintf(wc_tracelogf, "%sprint_glyph(%d, %d, %d, %d, %d)\n", INDENT, window,
|
||||
x, y, glyphinfo->glyph, bkglyphinfo->glyph);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
+9
-11
@@ -58,7 +58,7 @@ int func(CHAR_P arg) { ... }
|
||||
|
||||
typedef struct nhmi {
|
||||
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 */
|
||||
CHAR_P accelerator; /* Character used to select item from menu */
|
||||
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);
|
||||
new_item = (nhmenu_item *) alloc((unsigned) sizeof (nhmenu_item));
|
||||
new_item->wid = wid;
|
||||
new_item->glyph = NO_GLYPH;
|
||||
new_item->glyphinfo = nul_glyphinfo;
|
||||
new_item->identifier = cg.zeroany;
|
||||
new_item->accelerator = '\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 */
|
||||
|
||||
void
|
||||
curses_add_nhmenu_item(winid wid, int glyph, const ANY_P *identifier,
|
||||
CHAR_P accelerator, CHAR_P group_accel, int attr,
|
||||
curses_add_nhmenu_item(winid wid, const glyph_info *glyphinfo,
|
||||
const ANY_P *identifier, CHAR_P accelerator,
|
||||
CHAR_P group_accel, int attr,
|
||||
const char *str, unsigned itemflags)
|
||||
{
|
||||
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->glyph = glyph;
|
||||
if (glyphinfo)
|
||||
new_item->glyphinfo = *glyphinfo;
|
||||
new_item->identifier = *identifier;
|
||||
new_item->accelerator = accelerator;
|
||||
new_item->group_accel = group_accel;
|
||||
@@ -1179,12 +1181,8 @@ menu_display_page(nhmenu *menu, WINDOW * win, int page_num, char *selectors)
|
||||
}
|
||||
#if 0
|
||||
/* FIXME: menuglyphs not implemented yet */
|
||||
if (menu_item_ptr->glyph != NO_GLYPH && iflags.use_menu_glyphs) {
|
||||
unsigned glyphmod[NUM_GLYPHMOD];
|
||||
|
||||
map_glyphmod(0, 0, menu_item_ptr->glyph, 0U, glyphmod);
|
||||
color = (int) glyphmod[GM_COLOR];
|
||||
|
||||
if (menu_item_ptr->glyphinfo.glyph != NO_GLYPH && iflags.use_menu_glyphs) {
|
||||
color = (int) menu_item_ptr->glyphinfo.color;
|
||||
curses_toggle_color_attr(win, color, NONE, ON);
|
||||
mvwaddch(win, menu_item_ptr->line_num + 1, start_col, curletter);
|
||||
curses_toggle_color_attr(win, color, NONE, OFF);
|
||||
|
||||
@@ -13,8 +13,9 @@ int curses_character_input_dialog(const char *prompt, const char *choices,
|
||||
CHAR_P def);
|
||||
int curses_ext_cmd(void);
|
||||
void curses_create_nhmenu(winid wid, unsigned long);
|
||||
void curses_add_nhmenu_item(winid wid, int glyph, const ANY_P *identifier,
|
||||
CHAR_P accelerator, CHAR_P group_accel, int attr,
|
||||
void curses_add_nhmenu_item(winid wid, const glyph_info *glyphinfo,
|
||||
const ANY_P *identifier, CHAR_P accelerator,
|
||||
CHAR_P group_accel, int attr,
|
||||
const char *str, unsigned itemflags);
|
||||
void curs_menu_set_bottom_heavy(winid);
|
||||
void curses_finalize_nhmenu(winid wid, const char *prompt);
|
||||
|
||||
@@ -742,20 +742,20 @@ curses_character_dialog(const char **choices, const char *prompt)
|
||||
}
|
||||
|
||||
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);
|
||||
used_letters[count] = curletter;
|
||||
}
|
||||
|
||||
/* Random Selection */
|
||||
identifier.a_int = ROLE_RANDOM;
|
||||
curses_add_menu(wid, NO_GLYPH, &identifier, '*', 0, A_NORMAL, "Random",
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
curses_add_menu(wid, &nul_glyphinfo, &identifier, '*', 0,
|
||||
A_NORMAL, "Random", MENU_ITEMFLAGS_NONE);
|
||||
|
||||
/* Quit prompt */
|
||||
identifier.a_int = ROLE_NONE;
|
||||
curses_add_menu(wid, NO_GLYPH, &identifier, 'q', 0, A_NORMAL, "Quit",
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
curses_add_menu(wid, &nul_glyphinfo, &identifier, 'q', 0,
|
||||
A_NORMAL, "Quit", MENU_ITEMFLAGS_NONE);
|
||||
curses_end_menu(wid, prompt);
|
||||
ret = curses_select_menu(wid, PICK_ONE, &selected);
|
||||
if (ret == 1) {
|
||||
|
||||
@@ -55,9 +55,8 @@ curses_update_inv(void)
|
||||
|
||||
/* Adds an inventory item. 'y' is 1 rather than 0 for the first item. */
|
||||
void
|
||||
curses_add_inv(int y,
|
||||
int glyph UNUSED,
|
||||
CHAR_P accelerator, attr_t attr, const char *str)
|
||||
curses_add_inv(int y, const glyph_info *glyphinfo UNUSED, CHAR_P accelerator,
|
||||
attr_t attr, const char *str)
|
||||
{
|
||||
WINDOW *win = curses_get_nhwin(INV_WIN);
|
||||
int color = NO_COLOR;
|
||||
@@ -120,13 +119,11 @@ curses_add_inv(int y,
|
||||
}
|
||||
#if 0 /* FIXME: MENU GLYPHS */
|
||||
if (accelerator && glyph != NO_GLYPH && iflags.use_menu_glyphs) {
|
||||
unsigned glyphmod[NUM_GLYPHMOD];
|
||||
int symbol;
|
||||
attr_t glyphclr;
|
||||
|
||||
map_glyphmod(0, 0, glyph, 0U, glyphmod);
|
||||
symbol = (int) glyphmod[GM_TTYCHAR];
|
||||
color = (int) glyphmod[GM_COLOR];
|
||||
symbol = glyphinfo->ttychar;
|
||||
color = glyphinfo->color;
|
||||
|
||||
glyphclr = curses_color_attr(color, 0);
|
||||
wattron(win, glyphclr);
|
||||
|
||||
+36
-18
@@ -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,
|
||||
int attr, char *str, unsigned int itemflags)
|
||||
-- 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 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
|
||||
-- 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
|
||||
is OK. If there is no glyph applicable, then this
|
||||
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.
|
||||
*/
|
||||
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,
|
||||
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);
|
||||
|
||||
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++;
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -686,30 +689,45 @@ curses_cliparound(int x, int y)
|
||||
}
|
||||
|
||||
/*
|
||||
print_glyph(window, x, y, glyph, bkglyph, glyphmod)
|
||||
-- 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 glyph at (x,y) on the given window. Glyphs are
|
||||
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
|
||||
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.
|
||||
-- glyphmod (glyphmod[NUM_GLYPHNOD]) provides extended
|
||||
information about the glyph that window ports can use to
|
||||
enhance the display in various ways.
|
||||
-- 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 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
|
||||
curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph,
|
||||
int bkglyph UNUSED, unsigned *glyphmod)
|
||||
curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y,
|
||||
const glyph_info *glyphinfo, const glyph_info *bkglyphinfo UNUSED)
|
||||
{
|
||||
int glyph;
|
||||
int ch;
|
||||
int color;
|
||||
unsigned int special;
|
||||
int attr = -1;
|
||||
|
||||
special = glyphmod[GM_FLAGS];
|
||||
ch = (int) glyphmod[GM_TTYCHAR];
|
||||
color = (int) glyphmod[GM_COLOR];
|
||||
glyph = glyphinfo->glyph;
|
||||
special = glyphinfo->glyphflags;
|
||||
ch = glyphinfo->ttychar;
|
||||
color = glyphinfo->color;
|
||||
if ((special & MG_PET) && iflags.hilite_pet) {
|
||||
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,
|
||||
render lava in inverse video so that they look different */
|
||||
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 */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -373,16 +373,16 @@ curses_prev_mesg()
|
||||
for (count = 0; count < num_messages; ++count) {
|
||||
mesg = get_msg_line(do_lifo, count);
|
||||
if (turn != mesg->turn && count != 0) {
|
||||
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, "---",
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
curses_add_menu(wid, &nul_glyphinfo, &Id, 0, 0,
|
||||
A_NORMAL, "---", MENU_ITEMFLAGS_NONE);
|
||||
}
|
||||
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, mesg->str,
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
curses_add_menu(wid, &nul_glyphinfo, &Id, 0, 0,
|
||||
A_NORMAL, mesg->str, MENU_ITEMFLAGS_NONE);
|
||||
turn = mesg->turn;
|
||||
}
|
||||
if (!count)
|
||||
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL,
|
||||
"[No past messages available.]",
|
||||
curses_add_menu(wid, &nul_glyphinfo, &Id, 0, 0,
|
||||
A_NORMAL, "[No past messages available.]",
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
|
||||
curses_end_menu(wid, "");
|
||||
|
||||
@@ -675,7 +675,8 @@ curses_view_file(const char *filename, boolean must_exist)
|
||||
Id = cg.zeroany;
|
||||
|
||||
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);
|
||||
|
||||
@@ -509,8 +509,8 @@ curses_puts(winid wid, int attr, const char *text)
|
||||
return;
|
||||
}
|
||||
Id = cg.zeroany;
|
||||
curses_add_nhmenu_item(wid, NO_GLYPH, &Id, 0, 0, attr, text,
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
curses_add_nhmenu_item(wid, &nul_glyphinfo, &Id, 0, 0,
|
||||
attr, text, MENU_ITEMFLAGS_NONE);
|
||||
} else {
|
||||
waddstr(win, text);
|
||||
wnoutrefresh(win);
|
||||
|
||||
@@ -248,9 +248,9 @@ unsigned long mbehavior;
|
||||
* later.
|
||||
*/
|
||||
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 */
|
||||
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 */
|
||||
char ch; /* keyboard accelerator (0 = pick our own) */
|
||||
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.
|
||||
*/
|
||||
void
|
||||
safe_print_glyph(window, x, y, glyph, bkglyph, glyphmod)
|
||||
winid window;
|
||||
xchar x, y;
|
||||
int glyph;
|
||||
int bkglyph UNUSED;
|
||||
int glyphmod[NUM_GLYPHMOD] UNUSED;
|
||||
safe_print_glyph(window, x, y, glyphinfo, bkglyphinfo)
|
||||
winid window UNUSED;
|
||||
xchar x UNUSED, y UNUSED;
|
||||
const glyph_info *glyphinfo UNUSED;
|
||||
const glyph_info *bkglyphinfo UNUSED;
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
+3
-3
@@ -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_start_menu,(winid window, unsigned long mbehavior), "vii", A2P window, A2P mbehavior)
|
||||
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",
|
||||
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)
|
||||
/* 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)
|
||||
@@ -129,7 +129,7 @@ VDECLCB(shim_mark_synch,(void), "v")
|
||||
VDECLCB(shim_wait_synch,(void), "v")
|
||||
VDECLCB(shim_cliparound,(int x, int y), "vii", A2P x, A2P y)
|
||||
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_bold,(const char *str), "vs", P2V str)
|
||||
DECLCB(int, shim_nhgetch,(void), "i")
|
||||
|
||||
+47
-43
@@ -600,8 +600,8 @@ tty_player_selection()
|
||||
/* add miscellaneous menu entries */
|
||||
role_menu_extra(ROLE_RANDOM, win, TRUE);
|
||||
any = cg.zeroany; /* separator, not a choice */
|
||||
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);
|
||||
role_menu_extra(RS_RACE, win, FALSE);
|
||||
role_menu_extra(RS_GENDER, win, FALSE);
|
||||
role_menu_extra(RS_ALGNMNT, win, FALSE);
|
||||
@@ -698,8 +698,8 @@ tty_player_selection()
|
||||
/* add miscellaneous menu entries */
|
||||
role_menu_extra(ROLE_RANDOM, win, TRUE);
|
||||
any.a_int = 0; /* separator, not a choice */
|
||||
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);
|
||||
role_menu_extra(RS_ROLE, win, FALSE);
|
||||
role_menu_extra(RS_GENDER, win, FALSE);
|
||||
role_menu_extra(RS_ALGNMNT, win, FALSE);
|
||||
@@ -790,8 +790,8 @@ tty_player_selection()
|
||||
/* add miscellaneous menu entries */
|
||||
role_menu_extra(ROLE_RANDOM, win, TRUE);
|
||||
any.a_int = 0; /* separator, not a choice */
|
||||
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);
|
||||
role_menu_extra(RS_ROLE, win, FALSE);
|
||||
role_menu_extra(RS_RACE, win, FALSE);
|
||||
role_menu_extra(RS_ALGNMNT, win, FALSE);
|
||||
@@ -878,8 +878,8 @@ tty_player_selection()
|
||||
setup_algnmenu(win, TRUE, ROLE, RACE, GEND);
|
||||
role_menu_extra(ROLE_RANDOM, win, TRUE);
|
||||
any.a_int = 0; /* separator, not a choice */
|
||||
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);
|
||||
role_menu_extra(RS_ROLE, win, FALSE);
|
||||
role_menu_extra(RS_RACE, win, FALSE);
|
||||
role_menu_extra(RS_GENDER, win, FALSE);
|
||||
@@ -965,26 +965,27 @@ tty_player_selection()
|
||||
races[RACE].adj,
|
||||
(GEND == 1 && roles[ROLE].name.f) ? roles[ROLE].name.f
|
||||
: 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);
|
||||
/* blank separator */
|
||||
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 */
|
||||
any.a_int = 1;
|
||||
add_menu(win, NO_GLYPH, &any, 'y', 0, ATR_NONE, "Yes; start game",
|
||||
MENU_ITEMFLAGS_SELECTED);
|
||||
add_menu(win, &nul_glyphinfo, &any, 'y', 0,
|
||||
ATR_NONE, "Yes; start game", MENU_ITEMFLAGS_SELECTED);
|
||||
any.a_int = 2;
|
||||
add_menu(win, NO_GLYPH, &any, 'n', 0, ATR_NONE,
|
||||
"No; choose role again", MENU_ITEMFLAGS_NONE);
|
||||
add_menu(win, &nul_glyphinfo, &any, 'n', 0,
|
||||
ATR_NONE, "No; choose role again", MENU_ITEMFLAGS_NONE);
|
||||
if (iflags.renameallowed) {
|
||||
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);
|
||||
}
|
||||
any.a_int = -1;
|
||||
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
add_menu(win, &nul_glyphinfo, &any, 'q', 0,
|
||||
ATR_NONE, "Quit", MENU_ITEMFLAGS_NONE);
|
||||
Sprintf(pbuf, "Is this ok? [yn%sq]", iflags.renameallowed ? "a" : "");
|
||||
end_menu(win, pbuf);
|
||||
n = select_menu(win, PICK_ONE, &selected);
|
||||
@@ -1059,22 +1060,22 @@ reset_role_filtering()
|
||||
any = cg.zeroany;
|
||||
|
||||
/* 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);
|
||||
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, NO_GLYPH, &any, 0, 0, ATR_NONE,
|
||||
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
|
||||
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
|
||||
"Unacceptable races", MENU_ITEMFLAGS_NONE);
|
||||
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, NO_GLYPH, &any, 0, 0, ATR_NONE,
|
||||
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
|
||||
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
|
||||
"Unacceptable genders", MENU_ITEMFLAGS_NONE);
|
||||
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, NO_GLYPH, &any, 0, 0, ATR_NONE,
|
||||
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
|
||||
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
|
||||
"Unacceptable alignments", MENU_ITEMFLAGS_NONE);
|
||||
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
|
||||
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)
|
||||
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
|
||||
lastch = thisch;
|
||||
@@ -1178,7 +1180,7 @@ int role, gend, algn;
|
||||
capital letter as unseen accelerator;
|
||||
!filtering: resetting filter rather than picking, choose by
|
||||
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 ? highc(this_ch) : 0,
|
||||
ATR_NONE, races[i].noun,
|
||||
@@ -1213,7 +1215,7 @@ int role, race, algn;
|
||||
this_ch = *genders[i].adj;
|
||||
/* (see setup_racemenu for explanation of selector letters
|
||||
and setup_rolemenu for preselection) */
|
||||
add_menu(win, NO_GLYPH, &any,
|
||||
add_menu(win, &nul_glyphinfo, &any,
|
||||
filtering ? this_ch : highc(this_ch),
|
||||
filtering ? highc(this_ch) : 0,
|
||||
ATR_NONE, genders[i].adj,
|
||||
@@ -1248,7 +1250,7 @@ int role, race, gend;
|
||||
this_ch = *aligns[i].adj;
|
||||
/* (see setup_racemenu for explanation of selector letters
|
||||
and setup_rolemenu for preselection) */
|
||||
add_menu(win, NO_GLYPH, &any,
|
||||
add_menu(win, &nul_glyphinfo, &any,
|
||||
filtering ? this_ch : highc(this_ch),
|
||||
filtering ? highc(this_ch) : 0,
|
||||
ATR_NONE, aligns[i].adj,
|
||||
@@ -2950,9 +2952,9 @@ unsigned long mbehavior;
|
||||
* later.
|
||||
*/
|
||||
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 */
|
||||
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 */
|
||||
char ch; /* keyboard accelerator (0 = pick our own) */
|
||||
char gch; /* group accelerator (0 = no group) */
|
||||
@@ -3050,10 +3052,10 @@ const char *prompt; /* prompt to for menu */
|
||||
anything any;
|
||||
|
||||
any = cg.zeroany; /* not selectable */
|
||||
tty_add_menu(window, NO_GLYPH, &any, 0, 0, ATR_NONE, "",
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
tty_add_menu(window, NO_GLYPH, &any, 0, 0, ATR_NONE, prompt,
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
tty_add_menu(window, &nul_glyphinfo, &any, 0, 0,
|
||||
ATR_NONE, "", MENU_ITEMFLAGS_NONE);
|
||||
tty_add_menu(window, &nul_glyphinfo, &any, 0, 0,
|
||||
ATR_NONE, prompt, MENU_ITEMFLAGS_NONE);
|
||||
}
|
||||
|
||||
/* 52: 'a'..'z' and 'A'..'Z'; avoids selector duplication within a page */
|
||||
@@ -3415,19 +3417,21 @@ int x, y;
|
||||
*/
|
||||
|
||||
void
|
||||
tty_print_glyph(window, x, y, glyph, bkglyph, glyphmod)
|
||||
tty_print_glyph(window, x, y, glyphinfo, bkglyphinfo)
|
||||
winid window;
|
||||
xchar x, y;
|
||||
#ifdef TTY_TILES_ESCCODES
|
||||
int glyph;
|
||||
#if defined(TTY_TILES_ESCCODES) || defined(MSDOS)
|
||||
const glyph_info *glyphinfo;
|
||||
#else
|
||||
int glyph UNUSED;
|
||||
const glyph_info *glyphinfo UNUSED;
|
||||
#endif
|
||||
int bkglyph UNUSED;
|
||||
unsigned *glyphmod; /* don't mark UNUSED as we need to revisit */
|
||||
const glyph_info *bkglyphinfo UNUSED;
|
||||
{
|
||||
boolean inverse_on = FALSE;
|
||||
int ch, color;
|
||||
#if defined(TTY_TILES_ESCCODES) || defined(MSDOS)
|
||||
int glyph;
|
||||
#endif
|
||||
unsigned special;
|
||||
|
||||
HUPSKIP();
|
||||
@@ -3438,9 +3442,9 @@ unsigned *glyphmod; /* don't mark UNUSED as we need to revisit */
|
||||
}
|
||||
#endif
|
||||
/* get glyph ttychar, color, and special flags */
|
||||
ch = (int) glyphmod[GM_TTYCHAR];
|
||||
color = (int) glyphmod[GM_COLOR];
|
||||
special = glyphmod[GM_FLAGS];
|
||||
ch = glyphinfo->ttychar;
|
||||
color = glyphinfo->color;
|
||||
special = glyphinfo->glyphflags;
|
||||
|
||||
print_vt_code2(AVTC_SELECT_WINDOW, window);
|
||||
|
||||
|
||||
+28
-33
@@ -35,9 +35,8 @@ extern short glyph2tile[];
|
||||
typedef struct mswin_nethack_map_window {
|
||||
HWND hWnd; /* window */
|
||||
|
||||
int map[COLNO][ROWNO]; /* glyph map */
|
||||
int bkmap[COLNO][ROWNO]; /* backround glyph map */
|
||||
unsigned glyphmod[COLNO][ROWNO][NUM_GLYPHMOD];
|
||||
glyph_info map[COLNO][ROWNO];
|
||||
glyph_info bkmap[COLNO][ROWNO];
|
||||
boolean mapDirty[COLNO][ROWNO]; /* dirty flag for map */
|
||||
int mapMode; /* current map 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 dirtyAll(PNHMapWindow data);
|
||||
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);
|
||||
|
||||
#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: {
|
||||
PMSNHMsgPrintGlyph msg_data = (PMSNHMsgPrintGlyph) lParam;
|
||||
setGlyph(data, msg_data->x, msg_data->y,
|
||||
msg_data->glyph, msg_data->bkglyph, msg_data->glyphmod);
|
||||
&msg_data->glyphinfo, &msg_data->bkglyphinfo);
|
||||
} break;
|
||||
|
||||
case MSNH_MSG_CLIPAROUND: {
|
||||
@@ -719,9 +719,9 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
for (col = 0; col < COLNO; col++) {
|
||||
if (index >= msg_data->max_size)
|
||||
break;
|
||||
if (data->map[col][row] == NO_GLYPH)
|
||||
if (data->map[col][row].glyph == NO_GLYPH)
|
||||
mgch = ' ';
|
||||
msg_data->buffer[index] = data->glyphmod[col][row][GM_TTYCHAR];
|
||||
msg_data->buffer[index] = data->map[col][row].ttychar;
|
||||
index++;
|
||||
}
|
||||
if (index >= msg_data->max_size - 1)
|
||||
@@ -788,8 +788,8 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect)
|
||||
// int mgch;
|
||||
#endif
|
||||
layer = 0;
|
||||
glyph = data->map[i][j];
|
||||
bkglyph = data->bkmap[i][j];
|
||||
glyph = data->map[i][j].glyph;
|
||||
bkglyph = data->bkmap[i][j].glyph;
|
||||
|
||||
if (glyph == NO_GLYPH && bkglyph == NO_GLYPH) {
|
||||
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)) {
|
||||
/* rely on NetHack core helper routine */
|
||||
ntile = glyph2tile[glyph];
|
||||
if (data->glyphmod[i][j][GM_FLAGS] & MG_FEMALE)
|
||||
if (data->map[i][j].glyphflags & MG_FEMALE)
|
||||
ntile++;
|
||||
t_x = TILEBMP_X(ntile);
|
||||
t_y = TILEBMP_Y(ntile);
|
||||
@@ -834,7 +834,7 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect)
|
||||
}
|
||||
|
||||
#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
|
||||
if ((glyph != NO_GLYPH) && glyph_is_pet(glyph)
|
||||
#endif
|
||||
@@ -857,7 +857,7 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect)
|
||||
DeleteDC(hdcPetMark);
|
||||
}
|
||||
#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) {
|
||||
/* apply pilemark transparently over other image */
|
||||
HDC hdcPileMark;
|
||||
@@ -886,7 +886,7 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect)
|
||||
static void
|
||||
paintGlyph(PNHMapWindow data, int i, int j, RECT * rect)
|
||||
{
|
||||
if (data->map[i][j] >= 0) {
|
||||
if (data->map[i][j].glyph >= 0) {
|
||||
|
||||
char ch;
|
||||
WCHAR wch;
|
||||
@@ -906,10 +906,10 @@ paintGlyph(PNHMapWindow data, int i, int j, RECT * rect)
|
||||
nhglyph2charcolor(data->map[i][j], &ch, &color);
|
||||
OldFg = SetTextColor(hDC, nhcolor_to_RGB(color));
|
||||
#else
|
||||
ch = (char) data->glyphmod[i][j][GM_TTYCHAR];
|
||||
color = (int) data->glyphmod[i][j][GM_COLOR];
|
||||
if (((data->glyphmod[i][j][GM_FLAGS] & MG_PET) && iflags.hilite_pet)
|
||||
|| ((data->glyphmod[i][j][GM_FLAGS] & (MG_DETECT | MG_BW_LAVA))
|
||||
ch = (char) data->map[i][j].ttychar;
|
||||
color = (int) data->map[i][j].color;
|
||||
if (((data->map[i][j].glyphflags & MG_PET) && iflags.hilite_pet)
|
||||
|| ((data->map[i][j].glyphflags & (MG_DETECT | MG_BW_LAVA))
|
||||
&& iflags.use_inverse)) {
|
||||
back_brush =
|
||||
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] != fg) || (data->bkmap[i][j] != bg)
|
||||
|| data->glyphmod[i][j][GM_TTYCHAR] != glyphmod[GM_TTYCHAR]
|
||||
|| data->glyphmod[i][j][GM_COLOR] != glyphmod[GM_COLOR]
|
||||
|| data->glyphmod[i][j][GM_FLAGS] != glyphmod[GM_FLAGS]) {
|
||||
data->map[i][j] = fg;
|
||||
data->bkmap[i][j] = bg;
|
||||
if ((data->map[i][j].glyph != fg->glyph)
|
||||
|| (data->bkmap[i][j].glyph != bg->glyph)
|
||||
|| data->map[i][j].ttychar != fg->ttychar
|
||||
|| data->map[i][j].color != fg->color
|
||||
|| data->map[i][j].glyphflags != fg->glyphflags) {
|
||||
data->map[i][j] = *fg;
|
||||
data->bkmap[i][j] = *bg;
|
||||
data->mapDirty[i][j] = TRUE;
|
||||
for (gm = 0; gm < NUM_GLYPHMOD; ++gm)
|
||||
data->glyphmod[i][j][gm] = glyphmod[gm];
|
||||
RECT rect;
|
||||
nhcoord2display(data, i, j, &rect);
|
||||
InvalidateRect(data->hWnd, &rect, FALSE);
|
||||
@@ -991,11 +989,8 @@ static void clearAll(PNHMapWindow data)
|
||||
{
|
||||
for (int x = 0; x < COLNO; x++)
|
||||
for (int y = 0; y < ROWNO; y++) {
|
||||
data->map[x][y] = NO_GLYPH;
|
||||
data->bkmap[x][y] = NO_GLYPH;
|
||||
data->glyphmod[x][y][GM_TTYCHAR] = ' ';
|
||||
data->glyphmod[x][y][GM_COLOR] = NO_COLOR;
|
||||
data->glyphmod[x][y][GM_FLAGS] = 0U;
|
||||
data->map[x][y] = nul_glyphinfo;
|
||||
data->bkmap[x][y] = nul_glyphinfo;
|
||||
data->mapDirty[x][y] = TRUE;
|
||||
}
|
||||
InvalidateRect(data->hWnd, NULL, FALSE);
|
||||
|
||||
+5
-5
@@ -27,7 +27,7 @@
|
||||
#define CHECK_HEIGHT 16
|
||||
|
||||
typedef struct mswin_menu_item {
|
||||
int glyph;
|
||||
glyph_info glyphinfo;
|
||||
ANY_P identifier;
|
||||
CHAR_P accelerator;
|
||||
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_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);
|
||||
LRESULT CALLBACK NHMenuListWndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
@@ -618,7 +618,7 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
new_item = data->menu.size;
|
||||
ZeroMemory(&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].accelerator = msg_data->accelerator;
|
||||
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);
|
||||
|
||||
saveBmp = SelectObject(tileDC, GetNHApp()->bmpMapTiles);
|
||||
ntile = glyph2tile[item->glyph];
|
||||
ntile = glyph2tile[item->glyphinfo.glyph];
|
||||
t_x =
|
||||
(ntile % GetNHApp()->mapTilesPerLine) * GetNHApp()->mapTile_X;
|
||||
t_y =
|
||||
@@ -1166,7 +1166,7 @@ onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
client_rt.right = min(client_rt.right, lpdis->rcItem.right);
|
||||
if (NHMENU_IS_SELECTABLE(*item)
|
||||
&& data->menu.items[lpdis->itemID].count != 0
|
||||
&& item->glyph != NO_GLYPH) {
|
||||
&& item->glyphinfo.glyph != NO_GLYPH) {
|
||||
if (data->menu.items[lpdis->itemID].count == -1) {
|
||||
_stprintf(wbuf, TEXT("Count: All"));
|
||||
} else {
|
||||
|
||||
+3
-4
@@ -36,9 +36,8 @@ typedef struct mswin_nhmsg_putstr {
|
||||
typedef struct mswin_nhmsg_print_glyph {
|
||||
XCHAR_P x;
|
||||
XCHAR_P y;
|
||||
int glyph;
|
||||
int bkglyph;
|
||||
int glyphmod[NUM_GLYPHMOD];
|
||||
glyph_info glyphinfo;
|
||||
glyph_info bkglyphinfo;
|
||||
} MSNHMsgPrintGlyph, *PMSNHMsgPrintGlyph;
|
||||
|
||||
typedef struct mswin_nhmsg_cliparound {
|
||||
@@ -47,7 +46,7 @@ typedef struct mswin_nhmsg_cliparound {
|
||||
} MSNHMsgClipAround, *PMSNHMsgClipAround;
|
||||
|
||||
typedef struct mswin_nhmsg_add_menu {
|
||||
int glyph;
|
||||
glyph_info glyphinfo;
|
||||
const ANY_P *identifier;
|
||||
CHAR_P accelerator;
|
||||
CHAR_P group_accel;
|
||||
|
||||
+50
-47
@@ -428,8 +428,8 @@ prompt_for_player_selection(void)
|
||||
} else
|
||||
Strcpy(rolenamebuf, roles[i].name.m);
|
||||
}
|
||||
add_menu(win, NO_GLYPH, &any, thisch, 0, ATR_NONE,
|
||||
an(rolenamebuf), MENU_ITEMFLAGS_NONE);
|
||||
add_menu(win, &nul_glyphinfo, &any, thisch, 0,
|
||||
ATR_NONE, an(rolenamebuf), MENU_ITEMFLAGS_NONE);
|
||||
lastch = thisch;
|
||||
}
|
||||
}
|
||||
@@ -437,11 +437,11 @@ prompt_for_player_selection(void)
|
||||
flags.initalign, PICK_RANDOM) + 1;
|
||||
if (any.a_int == 0) /* must be non-zero */
|
||||
any.a_int = randrole(FALSE) + 1;
|
||||
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
add_menu(win, &nul_glyphinfo, &any, '*', 0,
|
||||
ATR_NONE, "Random", MENU_ITEMFLAGS_NONE);
|
||||
any.a_int = i + 1; /* must be non-zero */
|
||||
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
add_menu(win, &nul_glyphinfo, &any, 'q', 0,
|
||||
ATR_NONE, "Quit", MENU_ITEMFLAGS_NONE);
|
||||
Sprintf(pbuf, "Pick a role for your %s", plbuf);
|
||||
end_menu(win, pbuf);
|
||||
n = select_menu(win, PICK_ONE, &selected);
|
||||
@@ -503,18 +503,19 @@ prompt_for_player_selection(void)
|
||||
if (ok_race(flags.initrole, i, flags.initgend,
|
||||
flags.initalign)) {
|
||||
any.a_int = i + 1; /* must be non-zero */
|
||||
add_menu(win, NO_GLYPH, &any, races[i].noun[0], 0,
|
||||
ATR_NONE, races[i].noun, MENU_ITEMFLAGS_NONE);
|
||||
add_menu(win, &nul_glyphinfo, &any,
|
||||
races[i].noun[0], 0, ATR_NONE,
|
||||
races[i].noun, MENU_ITEMFLAGS_NONE);
|
||||
}
|
||||
any.a_int = pick_race(flags.initrole, flags.initgend,
|
||||
flags.initalign, PICK_RANDOM) + 1;
|
||||
if (any.a_int == 0) /* must be non-zero */
|
||||
any.a_int = randrace(flags.initrole) + 1;
|
||||
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
add_menu(win, &nul_glyphinfo, &any, '*', 0,
|
||||
ATR_NONE, "Random", MENU_ITEMFLAGS_NONE);
|
||||
any.a_int = i + 1; /* must be non-zero */
|
||||
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
add_menu(win, &nul_glyphinfo, &any, 'q', 0,
|
||||
ATR_NONE, "Quit", MENU_ITEMFLAGS_NONE);
|
||||
Sprintf(pbuf, "Pick the race of your %s", plbuf);
|
||||
end_menu(win, pbuf);
|
||||
n = select_menu(win, PICK_ONE, &selected);
|
||||
@@ -577,18 +578,19 @@ prompt_for_player_selection(void)
|
||||
if (ok_gend(flags.initrole, flags.initrace, i,
|
||||
flags.initalign)) {
|
||||
any.a_int = i + 1;
|
||||
add_menu(win, NO_GLYPH, &any, genders[i].adj[0], 0,
|
||||
ATR_NONE, genders[i].adj, MENU_ITEMFLAGS_NONE);
|
||||
add_menu(win, &nul_glyphinfo, &any,
|
||||
genders[i].adj[0], 0, ATR_NONE,
|
||||
genders[i].adj, MENU_ITEMFLAGS_NONE);
|
||||
}
|
||||
any.a_int = pick_gend(flags.initrole, flags.initrace,
|
||||
flags.initalign, PICK_RANDOM) + 1;
|
||||
if (any.a_int == 0) /* must be non-zero */
|
||||
any.a_int = randgend(flags.initrole, flags.initrace) + 1;
|
||||
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
add_menu(win, &nul_glyphinfo, &any, '*', 0,
|
||||
ATR_NONE, "Random", MENU_ITEMFLAGS_NONE);
|
||||
any.a_int = i + 1; /* must be non-zero */
|
||||
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
add_menu(win, &nul_glyphinfo, &any, 'q', 0,
|
||||
ATR_NONE, "Quit", MENU_ITEMFLAGS_NONE);
|
||||
Sprintf(pbuf, "Pick the gender of your %s", plbuf);
|
||||
end_menu(win, pbuf);
|
||||
n = select_menu(win, PICK_ONE, &selected);
|
||||
@@ -650,18 +652,19 @@ prompt_for_player_selection(void)
|
||||
if (ok_align(flags.initrole, flags.initrace,
|
||||
flags.initgend, i)) {
|
||||
any.a_int = i + 1;
|
||||
add_menu(win, NO_GLYPH, &any, aligns[i].adj[0], 0,
|
||||
ATR_NONE, aligns[i].adj, MENU_ITEMFLAGS_NONE);
|
||||
add_menu(win, &nul_glyphinfo, &any,
|
||||
aligns[i].adj[0], 0, ATR_NONE,
|
||||
aligns[i].adj, MENU_ITEMFLAGS_NONE);
|
||||
}
|
||||
any.a_int = pick_align(flags.initrole, flags.initrace,
|
||||
flags.initgend, PICK_RANDOM) + 1;
|
||||
if (any.a_int == 0) /* must be non-zero */
|
||||
any.a_int = randalign(flags.initrole, flags.initrace) + 1;
|
||||
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
add_menu(win, &nul_glyphinfo, &any, '*', 0,
|
||||
ATR_NONE, "Random", MENU_ITEMFLAGS_NONE);
|
||||
any.a_int = i + 1; /* must be non-zero */
|
||||
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
add_menu(win, &nul_glyphinfo, &any, 'q', 0,
|
||||
ATR_NONE, "Quit", MENU_ITEMFLAGS_NONE);
|
||||
Sprintf(pbuf, "Pick the alignment of your %s", plbuf);
|
||||
end_menu(win, pbuf);
|
||||
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,
|
||||
int attr, char *str, unsigned int itemflags)
|
||||
-- Add a text line str to the given menu window. If
|
||||
identifier
|
||||
is 0, then the line cannot be selected (e.g. a title).
|
||||
identifier is 0, then the line cannot be selected (e.g. a title).
|
||||
Otherwise, identifier is the value returned if the line is
|
||||
selected. Accelerator is a keyboard key that can be used
|
||||
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 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
|
||||
Glyphinfo->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.
|
||||
-- All accelerators should be in the range [A-Za-z].
|
||||
@@ -1125,19 +1128,22 @@ identifier
|
||||
menu is displayed, set preselected to TRUE.
|
||||
*/
|
||||
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,
|
||||
const char *str, unsigned int itemflags)
|
||||
{
|
||||
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,
|
||||
itemflags);
|
||||
if ((wid >= 0) && (wid < MAXWINDOWS)
|
||||
&& (GetNHApp()->windowlist[wid].win != NULL)) {
|
||||
MSNHMsgAddMenu data;
|
||||
ZeroMemory(&data, sizeof(data));
|
||||
data.glyph = glyph;
|
||||
if (glyphinfo)
|
||||
data.glyphinfo = *glyphinfo;
|
||||
data.identifier = identifier;
|
||||
data.accelerator = accelerator;
|
||||
data.group_accel = group_accel;
|
||||
@@ -1281,24 +1287,22 @@ mswin_cliparound(int x, int y)
|
||||
}
|
||||
|
||||
/*
|
||||
print_glyph(window, x, y, glyph, bkglyph, glyphmod)
|
||||
-- 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 (glyphinfo->glyph) at (x,y) on the given
|
||||
window. Glyphs are integers 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.
|
||||
-- glyphmod provides extended information about the glyph
|
||||
that window ports can use to enhance the display in
|
||||
various ways.
|
||||
|
||||
*/
|
||||
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)
|
||||
&& (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));
|
||||
data.x = x;
|
||||
data.y = y;
|
||||
data.glyph = glyph;
|
||||
data.bkglyph = bkglyph;
|
||||
data.glyphmod[GM_TTYCHAR] = glyphmod[GM_TTYCHAR];
|
||||
data.glyphmod[GM_COLOR] = glyphmod[GM_COLOR];
|
||||
data.glyphmod[GM_FLAGS] = glyphmod[GM_FLAGS];
|
||||
if (glyphinfo)
|
||||
data.glyphinfo = *glyphinfo;
|
||||
if (bkglyphinfo)
|
||||
data.bkglyphinfo = *bkglyphinfo;
|
||||
SendMessage(GetNHApp()->windowlist[wid].win, WM_MSNH_COMMAND,
|
||||
(WPARAM) MSNH_MSG_PRINT_GLYPH, (LPARAM) &data);
|
||||
}
|
||||
|
||||
+4
-2
@@ -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_display_file(const char *filename, BOOLEAN_P must_exist);
|
||||
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,
|
||||
const char *str, unsigned int itemflags);
|
||||
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_wait_synch(void);
|
||||
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_bold(const char *str);
|
||||
void mswin_raw_print_flush();
|
||||
|
||||
Reference in New Issue
Block a user