Merge branch 'NetHack-3.6'

This commit is contained in:
nhmall
2019-11-16 23:14:34 -05:00
19 changed files with 38 additions and 41 deletions
+2 -1
View File
@@ -926,7 +926,8 @@ These are not part of the interface. They may be called by your
window port routines to perform the desired task, instead of duplicating window port routines to perform the desired task, instead of duplicating
the necessary code in each window port. the necessary code in each window port.
int mapglyph(int glyph, int *ochar, int *ocolor, unsigned *special, int x, int y) int mapglyph(int glyph, int *ochar, int *ocolor, unsigned *special,
int x, int y, unsigned mgflags)
-- Maps glyph at x,y to NetHack ascii character and color. -- Maps glyph at x,y to NetHack ascii character and color.
The return value is an index into the showsyms[] array, in The return value is an index into the showsyms[] array, in
case a port wants to index into its own alternative case a port wants to index into its own alternative
+1 -1
View File
@@ -1209,7 +1209,7 @@ E boolean FDECL(usmellmon, (struct permonst *));
/* ### mapglyph.c ### */ /* ### mapglyph.c ### */
E int FDECL(mapglyph, (int, int *, int *, unsigned *, int, int)); E int FDECL(mapglyph, (int, int *, int *, unsigned *, int, int, unsigned));
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
View File
@@ -78,6 +78,10 @@ enum dismount_types {
DISMOUNT_BYCHOICE = 6 DISMOUNT_BYCHOICE = 6
}; };
/* mgflags for mapglyph() */
#define MG_FLAG_NORMAL 0x00
#define MG_FLAG_NOOVERRIDE 0x01
/* Special returns from mapglyph() */ /* Special returns from mapglyph() */
#define MG_CORPSE 0x01 #define MG_CORPSE 0x01
#define MG_INVIS 0x02 #define MG_INVIS 0x02
+1 -1
View File
@@ -1932,7 +1932,7 @@ dump_map()
glyph = reveal_terrain_getglyph(x, y, FALSE, u.uswallow, glyph = reveal_terrain_getglyph(x, y, FALSE, u.uswallow,
default_glyph, subset); default_glyph, subset);
(void) mapglyph(glyph, &ch, &color, &special, x, y); (void) mapglyph(glyph, &ch, &color, &special, x, y, 0);
buf[x - 1] = ch; buf[x - 1] = ch;
if (ch != ' ') { if (ch != ' ') {
blankrow = FALSE; blankrow = FALSE;
+4 -3
View File
@@ -59,10 +59,11 @@ static const int explcolors[] = {
/*ARGSUSED*/ /*ARGSUSED*/
int int
mapglyph(glyph, ochar, ocolor, ospecial, x, y) mapglyph(glyph, ochar, ocolor, ospecial, x, y, mgflags)
int glyph, *ocolor, x, y; int glyph, *ocolor, x, y;
int *ochar; int *ochar;
unsigned *ospecial; unsigned *ospecial;
unsigned mgflags;
{ {
register int offset, idx; register int offset, idx;
int color = NO_COLOR; int color = NO_COLOR;
@@ -223,7 +224,7 @@ unsigned *ospecial;
} }
/* These were requested by a blind player to enhance screen reader use */ /* These were requested by a blind player to enhance screen reader use */
if (sysopt.accessibility == 1) { if (sysopt.accessibility == 1 && !(mgflags & MG_FLAG_NOOVERRIDE)) {
int ovidx; int ovidx;
if ((special & MG_PET) != 0) { if ((special & MG_PET) != 0) {
@@ -300,7 +301,7 @@ const char *str;
gv = (gv * 16) + ((int) (dp - hex) / 2); gv = (gv * 16) + ((int) (dp - hex) / 2);
else else
break; break;
so = mapglyph(gv, &ch, &oc, &os, 0, 0); so = mapglyph(gv, &ch, &oc, &os, 0, 0, 0);
*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 */
+3 -14
View File
@@ -826,7 +826,7 @@ struct permonst **for_supplement;
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. */
(void) mapglyph(glyph, &sym, &oc, &os, cc.x, cc.y); (void) mapglyph(glyph, &sym, &oc, &os, cc.x, cc.y, 0);
Sprintf(prefix, "%s ", encglyph(glyph)); Sprintf(prefix, "%s ", encglyph(glyph));
} else } else
@@ -1055,21 +1055,10 @@ struct permonst **for_supplement;
if (looked) { if (looked) {
int oc = 0, idx = SYM_PET_OVERRIDE + SYM_OFF_X; int oc = 0, idx = SYM_PET_OVERRIDE + SYM_OFF_X;
unsigned os = 0; unsigned os = 0;
nhsym save_override;
if (Is_rogue_level(&u.uz)) {
save_override = g.ov_rogue_syms[idx];
g.ov_rogue_syms[idx] = 0;
} else {
save_override = g.ov_primary_syms[idx];
g.ov_primary_syms[idx] = 0;
}
/* convert to symbol without override in effect */ /* convert to symbol without override in effect */
(void) mapglyph(glyph, &sym, &oc, &os, cc.x, cc.y); (void) mapglyph(glyph, &sym, &oc, &os,
if (Is_rogue_level(&u.uz)) cc.x, cc.y, MG_FLAG_NOOVERRIDE);
g.ov_rogue_syms[idx] = save_override;
else
g.ov_primary_syms[idx] = save_override;
goto check_monsters; goto check_monsters;
} }
break; break;
+6 -4
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 region.c $NHDT-Date: 1573933605 2019/11/16 19:46:45 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.44 $ */ /* NetHack 3.6 region.c $NHDT-Date: 1573957877 2019/11/17 02:31:17 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.45 $ */
/* Copyright (c) 1996 by Jean-Christophe Collet */ /* Copyright (c) 1996 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -338,6 +338,11 @@ NhRegion *reg;
if (i == g.n_regions) if (i == g.n_regions)
return; return;
/* remove region before potential newsym() calls, but don't free it yet */
if (--g.n_regions != i)
g.regions[i] = g.regions[g.n_regions];
g.regions[g.n_regions] = (NhRegion *) 0;
/* Update screen if necessary */ /* Update screen if necessary */
reg->ttl = -2L; /* for visible_region_at */ reg->ttl = -2L; /* for visible_region_at */
if (reg->visible) if (reg->visible)
@@ -347,9 +352,6 @@ NhRegion *reg;
newsym(x, y); newsym(x, y);
free_region(reg); free_region(reg);
g.regions[i] = g.regions[g.n_regions - 1];
g.regions[g.n_regions - 1] = (NhRegion *) 0;
g.n_regions--;
} }
/* /*
+1 -1
View File
@@ -1978,7 +1978,7 @@ if(u.uz.dlevel != x){
} else /* AMII, or Rogue level in either version */ } else /* AMII, or Rogue level in either version */
{ {
/* map glyph to character and color */ /* map glyph to character and color */
(void) mapglyph(glyph, &och, &color, &special, x, y); (void) mapglyph(glyph, &och, &color, &special, x, y, 0);
ch = (uchar) och; ch = (uchar) och;
if (WINVERS_AMIV) { /* implies Rogue level here */ if (WINVERS_AMIV) { /* implies Rogue level here */
amii_curs(win, x, y); amii_curs(win, x, y);
+1 -1
View File
@@ -632,7 +632,7 @@ onPaint(HWND hWnd)
#else #else
/* rely on NetHack core helper routine */ /* rely on NetHack core helper routine */
(void) mapglyph(data->map[i][j], &mgch, &color, (void) mapglyph(data->map[i][j], &mgch, &color,
&special, i, j); &special, i, j, 0);
ch = (char) mgch; ch = (char) mgch;
if (((special & MG_PET) && iflags.hilite_pet) if (((special & MG_PET) && iflags.hilite_pet)
|| ((special & MG_DETECT) || ((special & MG_DETECT)
+1 -1
View File
@@ -1688,7 +1688,7 @@ void NetHackQtMapWindow::paintEvent(QPaintEvent* event)
painter.setPen( green ); painter.setPen( green );
/* map glyph to character and color */ /* map glyph to character and color */
(void)mapglyph(g, &och, &color, &special, i, j); (void)mapglyph(g, &och, &color, &special, i, j, 0);
ch = (uchar)och; ch = (uchar)och;
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
painter.setPen( nhcolor_to_pen(color) ); painter.setPen( nhcolor_to_pen(color) );
+4 -4
View File
@@ -137,7 +137,7 @@ void NetHackQtMapViewport::paintEvent(QPaintEvent* event)
painter.setPen( Qt::green ); painter.setPen( Qt::green );
/* map glyph to character and color */ /* map glyph to character and color */
mapglyph(g, &ch, &color, &special, i, j); mapglyph(g, &ch, &color, &special, i, j, 0);
ch = cp437(ch); ch = cp437(ch);
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
painter.setPen( nhcolor_to_pen(color) ); painter.setPen( nhcolor_to_pen(color) );
@@ -176,7 +176,7 @@ void NetHackQtMapViewport::paintEvent(QPaintEvent* event)
int color; int color;
int ch; int ch;
unsigned special; unsigned special;
mapglyph(g, &ch, &color, &special, i, j); mapglyph(g, &ch, &color, &special, i, j, 0);
qt_settings->glyphs().drawCell(painter, g, i, j); qt_settings->glyphs().drawCell(painter, g, i, j);
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
if (((special & MG_PET) != 0) && ::iflags.hilite_pet) { if (((special & MG_PET) != 0) && ::iflags.hilite_pet) {
@@ -829,7 +829,7 @@ void NetHackQtMapWindow::paintEvent(QPaintEvent* event)
painter.setPen( Qt::green ); painter.setPen( Qt::green );
/* map glyph to character and color */ /* map glyph to character and color */
mapglyph(g, &ch, &color, &special, i, j); mapglyph(g, &ch, &color, &special, i, j, 0);
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
painter.setPen( nhcolor_to_pen(color) ); painter.setPen( nhcolor_to_pen(color) );
#endif #endif
@@ -859,7 +859,7 @@ void NetHackQtMapWindow::paintEvent(QPaintEvent* event)
int color; int color;
int ch; int ch;
unsigned special; unsigned special;
mapglyph(g, &ch, &color, &special, i, j); mapglyph(g, &ch, &color, &special, i, j, 0);
qt_settings->glyphs().drawCell(painter, g, i, j); qt_settings->glyphs().drawCell(painter, g, i, j);
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
if (((special & MG_PET) != 0) && ::iflags.hilite_pet) { if (((special & MG_PET) != 0) && ::iflags.hilite_pet) {
+1 -1
View File
@@ -107,7 +107,7 @@ int bkglyph UNUSED;
#endif #endif
/* map glyph to character and color */ /* map glyph to character and color */
(void) mapglyph(glyph, &och, &color, &special, x, y); (void) mapglyph(glyph, &och, &color, &special, x, y, 0);
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].special) {
+1 -1
View File
@@ -1176,7 +1176,7 @@ menu_display_page(nhmenu *menu, WINDOW * win, int page_num, char *selectors)
if (menu_item_ptr->glyph != NO_GLYPH && iflags.use_menu_glyphs) { if (menu_item_ptr->glyph != NO_GLYPH && iflags.use_menu_glyphs) {
unsigned special; /*notused */ unsigned special; /*notused */
mapglyph(menu_item_ptr->glyph, &curletter, &color, &special, 0, 0); mapglyph(menu_item_ptr->glyph, &curletter, &color, &special, 0, 0, 0);
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);
+1 -1
View File
@@ -125,7 +125,7 @@ curses_add_inv(int y,
int symbol = 0; int symbol = 0;
attr_t glyphclr; attr_t glyphclr;
mapglyph(glyph, &symbol, &color, &dummy, u.ux, u.uy); mapglyph(glyph, &symbol, &color, &dummy, u.ux, u.uy, 0);
glyphclr = curses_color_attr(color, 0); glyphclr = curses_color_attr(color, 0);
wattron(win, glyphclr); wattron(win, glyphclr);
wprintw(win, "%c ", symbol); wprintw(win, "%c ", symbol);
+1 -1
View File
@@ -665,7 +665,7 @@ curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph,
int attr = -1; int attr = -1;
/* map glyph to character and color */ /* map glyph to character and color */
mapglyph(glyph, &ch, &color, &special, x, y); mapglyph(glyph, &ch, &color, &special, x, y, 0);
if ((special & MG_PET) && iflags.hilite_pet) { if ((special & MG_PET) && iflags.hilite_pet) {
attr = iflags.wc2_petattr; attr = iflags.wc2_petattr;
} }
+1 -1
View File
@@ -930,7 +930,7 @@ int glyph;
unsigned special; unsigned special;
/* map glyph to character and color */ /* map glyph to character and color */
(void) mapglyph(glyph, &ch, &color, &special, x, y); (void) mapglyph(glyph, &ch, &color, &special, x, y, 0);
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
/* Turn off color if rogue level. */ /* Turn off color if rogue level. */
+1 -1
View File
@@ -3376,7 +3376,7 @@ int bkglyph UNUSED;
} }
#endif #endif
/* map glyph to character and color */ /* map glyph to character and color */
(void) mapglyph(glyph, &ch, &color, &special, x, y); (void) mapglyph(glyph, &ch, &color, &special, x, y, 0);
print_vt_code2(AVTC_SELECT_WINDOW, window); print_vt_code2(AVTC_SELECT_WINDOW, window);
+3 -3
View File
@@ -710,7 +710,7 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
mgch = ' '; mgch = ' ';
} else { } else {
(void) mapglyph(data->map[col][row], &mgch, &color, (void) mapglyph(data->map[col][row], &mgch, &color,
&special, col, row); &special, col, row, 0);
} }
msg_data->buffer[index] = mgch; msg_data->buffer[index] = mgch;
index++; index++;
@@ -824,7 +824,7 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect)
#ifdef USE_PILEMARK #ifdef USE_PILEMARK
/* rely on NetHack core helper routine */ /* rely on NetHack core helper routine */
(void) mapglyph(data->map[i][j], &mgch, &color, &special, (void) mapglyph(data->map[i][j], &mgch, &color, &special,
i, j); i, j, 0);
if ((glyph != NO_GLYPH) && (special & MG_PET) if ((glyph != NO_GLYPH) && (special & MG_PET)
#else #else
if ((glyph != NO_GLYPH) && glyph_is_pet(glyph) if ((glyph != NO_GLYPH) && glyph_is_pet(glyph)
@@ -899,7 +899,7 @@ paintGlyph(PNHMapWindow data, int i, int j, RECT * rect)
#else #else
/* rely on NetHack core helper routine */ /* rely on NetHack core helper routine */
(void) mapglyph(data->map[i][j], &mgch, &color, (void) mapglyph(data->map[i][j], &mgch, &color,
&special, i, j); &special, i, j, 0);
ch = (char) mgch; ch = (char) mgch;
if (((special & MG_PET) && iflags.hilite_pet) if (((special & MG_PET) && iflags.hilite_pet)
|| ((special & (MG_DETECT | MG_BW_LAVA)) || ((special & (MG_DETECT | MG_BW_LAVA))
+1 -1
View File
@@ -3091,7 +3091,7 @@ mswin_status_update(int idx, genericptr_t ptr, int chg, int percent, int color,
ochar = GOLD_SYM; ochar = GOLD_SYM;
else else
mapglyph(objnum_to_glyph(GOLD_PIECE), mapglyph(objnum_to_glyph(GOLD_PIECE),
&ochar, &ocolor, &ospecial, 0, 0); &ochar, &ocolor, &ospecial, 0, 0, 0);
buf[0] = ochar; buf[0] = ochar;
p = strchr(text, ':'); p = strchr(text, ':');
if (p) { if (p) {