Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2019-04-06 21:08:01 -04:00
12 changed files with 110 additions and 79 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.298 $ $NHDT-Date: 1554425733 2019/04/05 00:55:33 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.299 $ $NHDT-Date: 1554580624 2019/04/06 19:57:04 $
This fixes36.2 file is here to capture information about updates in the 3.6.x This fixes36.2 file is here to capture information about updates in the 3.6.x
lineage following the release of 3.6.1 in April 2018. Please note, however, lineage following the release of 3.6.1 in April 2018. Please note, however,
@@ -406,6 +406,9 @@ shorten the getpos prompt for teleport destination so that it won't yield a
once a status highlight for a temporary rule ('up', 'down', 'changed') timed once a status highlight for a temporary rule ('up', 'down', 'changed') timed
out, further spurious status updates (evaluating all fields) would out, further spurious status updates (evaluating all fields) would
occur every 'statushilites' turns even if no fields had changed occur every 'statushilites' turns even if no fields had changed
if a migrating long worm couldn't be placed, or some other monster was given
an existing long worm's place and it couldn't be put somewhere else,
a "trying to place monster at <0,0>" warning would occur
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 botl.h $NHDT-Date: 1553387147 2019/03/24 00:25:47 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.23 $ */ /* NetHack 3.6 botl.h $NHDT-Date: 1554591222 2019/04/06 22:53:42 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.24 $ */
/* Copyright (c) Michael Allison, 2003 */ /* Copyright (c) Michael Allison, 2003 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -27,12 +27,10 @@ Astral Plane \GXXXXNNNN:123456 HP:1234(1234) Pw:1234(1234) AC:-127
#define MAXCO (COLNO + 40) #define MAXCO (COLNO + 40)
#endif #endif
#ifdef STATUS_HILITES
struct condmap { struct condmap {
const char *id; const char *id;
unsigned long bitmask; unsigned long bitmask;
}; };
#endif
enum statusfields { enum statusfields {
BL_CHARACTERISTICS = -3, /* alias for BL_STR..BL_CH */ BL_CHARACTERISTICS = -3, /* alias for BL_STR..BL_CH */
@@ -72,6 +70,9 @@ enum relationships { NO_LTEQGT = -1,
#define BL_MASK_BITS 13 /* number of mask bits that can be set */ #define BL_MASK_BITS 13 /* number of mask bits that can be set */
/* clang-format on */ /* clang-format on */
#define VIA_WINDOWPORT() \
((windowprocs.wincap2 & (WC2_HILITE_STATUS | WC2_FLUSH_STATUS)) != 0)
#define REASSESS_ONLY TRUE #define REASSESS_ONLY TRUE
/* #ifdef STATUS_HILITES */ /* #ifdef STATUS_HILITES */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 allmain.c $NHDT-Date: 1554045808 2019/03/31 15:23:28 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.96 $ */ /* NetHack 3.6 allmain.c $NHDT-Date: 1554591223 2019/04/06 22:53:43 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.97 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -542,11 +542,11 @@ void
display_gamewindows() display_gamewindows()
{ {
WIN_MESSAGE = create_nhwindow(NHW_MESSAGE); WIN_MESSAGE = create_nhwindow(NHW_MESSAGE);
#ifdef STATUS_HILITES if (VIA_WINDOWPORT()) {
status_initialize(0); status_initialize(0);
#else } else {
WIN_STATUS = create_nhwindow(NHW_STATUS); WIN_STATUS = create_nhwindow(NHW_STATUS);
#endif }
WIN_MAP = create_nhwindow(NHW_MAP); WIN_MAP = create_nhwindow(NHW_MAP);
WIN_INVEN = create_nhwindow(NHW_MENU); WIN_INVEN = create_nhwindow(NHW_MENU);
/* in case of early quit where WIN_INVEN could be destroyed before /* in case of early quit where WIN_INVEN could be destroyed before

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 botl.c $NHDT-Date: 1554554180 2019/04/06 12:36:20 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.142 $ */ /* NetHack 3.6 botl.c $NHDT-Date: 1554591223 2019/04/06 22:53:43 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.143 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */ /*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -14,10 +14,8 @@ const char *const enc_stat[] = { "", "Burdened", "Stressed",
"Strained", "Overtaxed", "Overloaded" }; "Strained", "Overtaxed", "Overloaded" };
STATIC_DCL const char *NDECL(rank); STATIC_DCL const char *NDECL(rank);
#ifdef STATUS_HILITES
STATIC_DCL void NDECL(bot_via_windowport); STATIC_DCL void NDECL(bot_via_windowport);
STATIC_DCL void NDECL(stat_update_time); STATIC_DCL void NDECL(stat_update_time);
#endif
static char * static char *
get_strength_str() get_strength_str()
@@ -235,14 +233,14 @@ bot()
{ {
/* dosave() flags completion by setting u.uhp to -1 */ /* dosave() flags completion by setting u.uhp to -1 */
if ((u.uhp != -1) && g.youmonst.data && iflags.status_updates) { if ((u.uhp != -1) && g.youmonst.data && iflags.status_updates) {
#ifdef STATUS_HILITES if (VIA_WINDOWPORT()) {
bot_via_windowport(); bot_via_windowport();
#else } else {
curs(WIN_STATUS, 1, 0); curs(WIN_STATUS, 1, 0);
putstr(WIN_STATUS, 0, do_statusline1()); putstr(WIN_STATUS, 0, do_statusline1());
curs(WIN_STATUS, 1, 1); curs(WIN_STATUS, 1, 1);
putmixed(WIN_STATUS, 0, do_statusline2()); putmixed(WIN_STATUS, 0, do_statusline2());
#endif }
} }
g.context.botl = g.context.botlx = iflags.time_botl = FALSE; g.context.botl = g.context.botlx = iflags.time_botl = FALSE;
} }
@@ -250,13 +248,13 @@ bot()
void void
timebot() timebot()
{ {
if (flags.time) { if (flags.time && iflags.status_updates) {
#ifdef STATUS_HILITES if (VIA_WINDOWPORT()) {
stat_update_time(); stat_update_time();
#else } else {
/* old status display updates everything */ /* old status display updates everything */
bot(); bot();
#endif }
} }
iflags.time_botl = FALSE; iflags.time_botl = FALSE;
} }
@@ -696,11 +694,6 @@ bot_via_windowport()
evaluate_and_notify_windowport(g.valset, idx); evaluate_and_notify_windowport(g.valset, idx);
} }
#ifdef STATUS_HILITES
/* stat_update_time() isn't really a STATUS_HILITES routine
* but timebot() will only ever call it for that configuration.
*/
/* update just the status lines' 'time' field */ /* update just the status lines' 'time' field */
STATIC_OVL void STATIC_OVL void
stat_update_time() stat_update_time()
@@ -718,7 +711,6 @@ stat_update_time()
NO_COLOR, (unsigned long *) 0); NO_COLOR, (unsigned long *) 0);
return; return;
} }
#endif
STATIC_OVL boolean STATIC_OVL boolean
eval_notify_windowport_field(fld, valsetlist, idx) eval_notify_windowport_field(fld, valsetlist, idx)
@@ -2161,6 +2153,7 @@ boolean from_configfile;
return TRUE; return TRUE;
} }
#endif /* STATUS_HILITES */
const struct condmap valid_conditions[] = { const struct condmap valid_conditions[] = {
{ "stone", BL_MASK_STONE }, { "stone", BL_MASK_STONE },
@@ -2178,6 +2171,8 @@ const struct condmap valid_conditions[] = {
{ "ride", BL_MASK_RIDE }, { "ride", BL_MASK_RIDE },
}; };
#ifdef STATUS_HILITES
const struct condmap condition_aliases[] = { const struct condmap condition_aliases[] = {
{ "strangled", BL_MASK_STRNGL }, { "strangled", BL_MASK_STRNGL },
{ "all", BL_MASK_STONE | BL_MASK_SLIME | BL_MASK_STRNGL { "all", BL_MASK_STONE | BL_MASK_SLIME | BL_MASK_STRNGL

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 dog.c $NHDT-Date: 1545439150 2018/12/22 00:39:10 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.85 $ */ /* NetHack 3.6 dog.c $NHDT-Date: 1554580624 2019/04/06 19:57:04 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.85 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -7,11 +7,6 @@
STATIC_DCL int NDECL(pet_type); STATIC_DCL int NDECL(pet_type);
/* cloned from mon.c; used here if mon_arrive() can't place mon */
#define LEVEL_SPECIFIC_NOCORPSE(mdat) \
(Is_rogue_level(&u.uz) \
|| (g.level.flags.graveyard && is_undead(mdat) && rn2(3)))
void void
newedog(mtmp) newedog(mtmp)
struct monst *mtmp; struct monst *mtmp;
@@ -696,7 +691,8 @@ coord *cc; /* optional destination coordinates */
/* **** NOTE: worm is truncated to # segs = max wormno size **** */ /* **** NOTE: worm is truncated to # segs = max wormno size **** */
num_segs = min(cnt, MAX_NUM_WORMS - 1); /* used below */ num_segs = min(cnt, MAX_NUM_WORMS - 1); /* used below */
wormgone(mtmp); /* destroys tail and takes head off map */ wormgone(mtmp); /* destroys tail and takes head off map */
place_monster(mtmp, mtmp->mx, mtmp->my); /* put head back for relmon */ /* there used to be a place_monster() here for the relmon() below,
but it doesn't require the monster to be on the map anymore */
} }
/* set minvent's obj->no_charge to 0 */ /* set minvent's obj->no_charge to 0 */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 end.c $NHDT-Date: 1554045810 2019/03/31 15:23:30 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.167 $ */ /* NetHack 3.6 end.c $NHDT-Date: 1554591224 2019/04/06 22:53:44 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.168 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1349,9 +1349,8 @@ int how;
} }
display_nhwindow(WIN_MESSAGE, TRUE); display_nhwindow(WIN_MESSAGE, TRUE);
destroy_nhwindow(WIN_MAP), WIN_MAP = WIN_ERR; destroy_nhwindow(WIN_MAP), WIN_MAP = WIN_ERR;
#ifndef STATUS_HILITES if (WIN_STATUS != WIN_ERR)
destroy_nhwindow(WIN_STATUS), WIN_STATUS = WIN_ERR; destroy_nhwindow(WIN_STATUS), WIN_STATUS = WIN_ERR;
#endif
destroy_nhwindow(WIN_MESSAGE), WIN_MESSAGE = WIN_ERR; destroy_nhwindow(WIN_MESSAGE), WIN_MESSAGE = WIN_ERR;
if (!done_stopprint || flags.tombstone) if (!done_stopprint || flags.tombstone)

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mon.c $NHDT-Date: 1550524562 2019/02/18 21:16:02 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.279 $ */ /* NetHack 3.6 mon.c $NHDT-Date: 1554580625 2019/04/06 19:57:05 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.280 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */ /*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -2647,7 +2647,7 @@ boolean move_other; /* make sure mtmp gets to x, y! so move m_at(x, y) */
xchar newx, newy; xchar newx, newy;
coord mm; coord mm;
if (mtmp->mx == x && mtmp->my == y && m_at(x,y) == mtmp) if (mtmp->mx == x && mtmp->my == y && m_at(x, y) == mtmp)
return TRUE; return TRUE;
if (move_other && (othermon = m_at(x, y)) != 0) { if (move_other && (othermon = m_at(x, y)) != 0) {
@@ -2666,7 +2666,7 @@ boolean move_other; /* make sure mtmp gets to x, y! so move m_at(x, y) */
*/ */
if (!enexto(&mm, newx, newy, mtmp->data)) if (!enexto(&mm, newx, newy, mtmp->data))
return FALSE; return FALSE;
if (!isok(mm.x,mm.y)) if (!isok(mm.x, mm.y))
return FALSE; return FALSE;
newx = mm.x; newx = mm.x;
newy = mm.y; newy = mm.y;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 options.c $NHDT-Date: 1554155747 2019/04/01 21:55:47 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.362 $ */ /* NetHack 3.6 options.c $NHDT-Date: 1554591224 2019/04/06 22:53:44 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.363 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2008. */ /*-Copyright (c) Michael Allison, 2008. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -4034,9 +4034,8 @@ boolean tinitial, tfrom_file;
|| boolopt[i].addr == &flags.showscore || boolopt[i].addr == &flags.showscore
#endif #endif
|| boolopt[i].addr == &flags.showexp) { || boolopt[i].addr == &flags.showexp) {
#ifdef STATUS_HILITES if (VIA_WINDOWPORT())
status_initialize(REASSESS_ONLY); status_initialize(REASSESS_ONLY);
#endif
g.context.botl = TRUE; g.context.botl = TRUE;
} else if (boolopt[i].addr == &flags.invlet_constant) { } else if (boolopt[i].addr == &flags.invlet_constant) {
if (flags.invlet_constant) { if (flags.invlet_constant) {
@@ -4077,11 +4076,12 @@ boolean tinitial, tfrom_file;
iflags.wc2_petattr = curses_read_attrs("I"); iflags.wc2_petattr = curses_read_attrs("I");
} }
#endif #endif
#ifdef STATUS_HILITES
} else if (boolopt[i].addr == &iflags.wc2_hitpointbar) { } else if (boolopt[i].addr == &iflags.wc2_hitpointbar) {
status_initialize(REASSESS_ONLY); if (VIA_WINDOWPORT()) {
g.opt_need_redraw = TRUE; /* [is reassessment really needed here?] */
#endif status_initialize(REASSESS_ONLY);
g.opt_need_redraw = TRUE;
}
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
} else if (boolopt[i].addr == &iflags.use_color) { } else if (boolopt[i].addr == &iflags.use_color) {
g.opt_need_redraw = TRUE; g.opt_need_redraw = TRUE;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 save.c $NHDT-Date: 1543972194 2018/12/05 01:09:54 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.115 $ */ /* NetHack 3.6 save.c $NHDT-Date: 1554591225 2019/04/06 22:53:45 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.117 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2009. */ /*-Copyright (c) Michael Allison, 2009. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1401,9 +1401,8 @@ freedynamicdata()
/* free_pickinv_cache(); -- now done from really_done()... */ /* free_pickinv_cache(); -- now done from really_done()... */
free_symsets(); free_symsets();
#endif /* FREE_ALL_MEMORY */ #endif /* FREE_ALL_MEMORY */
#ifdef STATUS_HILITES if (VIA_WINDOWPORT())
status_finish(); status_finish();
#endif
#ifdef DUMPLOG #ifdef DUMPLOG
dumplogfreemessages(); dumplogfreemessages();
#endif #endif

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 steal.c $NHDT-Date: 1496614914 2017/06/04 22:21:54 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.69 $ */ /* NetHack 3.6 steal.c $NHDT-Date: 1554580626 2019/04/06 19:57:06 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.72 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -693,7 +693,17 @@ struct monst *mon;
for the other roles are not */ for the other roles are not */
if (obj_resists(obj, 0, 0) || is_quest_artifact(obj)) { if (obj_resists(obj, 0, 0) || is_quest_artifact(obj)) {
obj_extract_self(obj); obj_extract_self(obj);
mdrop_obj(mon, obj, FALSE); if (mon->mx) {
mdrop_obj(mon, obj, FALSE);
} else { /* migrating monster not on map */
if (obj->owornmask) {
mon->misc_worn_check &= ~obj->owornmask;
if (obj->owornmask & W_WEP)
setmnotwielded(mon, obj);
obj->owornmask = 0L;
}
rloco(obj);
}
} }
} }
} }

View File

@@ -354,7 +354,8 @@ curses_destroy_nhwindow(winid wid)
curses_teardown_messages(); /* discard ^P message history data */ curses_teardown_messages(); /* discard ^P message history data */
break; break;
case STATUS_WIN: case STATUS_WIN:
curses_status_finish(); /* discard cached status data */ if (VIA_WINDOWPORT())
curses_status_finish(); /* discard cached status data */
break; break;
case INV_WIN: case INV_WIN:
iflags.perm_invent = 0; /* avoid unexpected update_inventory() */ iflags.perm_invent = 0; /* avoid unexpected update_inventory() */

View File

@@ -24,25 +24,25 @@ extern boolean status_activefields[MAXBLSTATS];
/* Long format fields for vertical window */ /* Long format fields for vertical window */
static char *status_vals_long[MAXBLSTATS]; static char *status_vals_long[MAXBLSTATS];
#ifdef STATUS_HILITES
static unsigned long *curses_colormasks; static unsigned long *curses_colormasks;
static long curses_condition_bits; static long curses_condition_bits;
static int curses_status_colors[MAXBLSTATS]; static int curses_status_colors[MAXBLSTATS];
static int hpbar_percent, hpbar_color; static int hpbar_percent, hpbar_color;
static int vert_status_dirty; static int vert_status_dirty;
#ifdef TEXTCOLOR
static int FDECL(condcolor, (long, unsigned long *));
#endif
static int FDECL(condattr, (long, unsigned long *));
static int FDECL(nhattr2curses, (int));
#endif /* STATUS_HILITES */
static void NDECL(draw_status); static void NDECL(draw_status);
static void FDECL(draw_vertical, (BOOLEAN_P)); static void FDECL(draw_vertical, (BOOLEAN_P));
static void FDECL(draw_horizontal, (BOOLEAN_P)); static void FDECL(draw_horizontal, (BOOLEAN_P));
static void curs_HPbar(char *, int); static void curs_HPbar(char *, int);
static void curs_stat_conds(int, int *, int *, char *, boolean *); static void curs_stat_conds(int, int *, int *, char *, boolean *);
static void curs_vert_status_vals(int); static void curs_vert_status_vals(int);
#ifdef STATUS_HILITES
#ifdef TEXTCOLOR
static int FDECL(condcolor, (long, unsigned long *));
#endif
static int FDECL(condattr, (long, unsigned long *));
static int FDECL(nhattr2curses, (int));
#endif /* STATUS_HILITES */
/* width of a single line in vertical status orientation (one field per line; /* width of a single line in vertical status orientation (one field per line;
everything but title fits within 30 even with prefix and longest value) */ everything but title fits within 30 even with prefix and longest value) */
@@ -51,7 +51,6 @@ static void curs_vert_status_vals(int);
void void
curses_status_init() curses_status_init()
{ {
#ifdef STATUS_HILITES
int i; int i;
for (i = 0; i < MAXBLSTATS; ++i) { for (i = 0; i < MAXBLSTATS; ++i) {
@@ -62,7 +61,6 @@ curses_status_init()
curses_condition_bits = 0L; curses_condition_bits = 0L;
hpbar_percent = 0, hpbar_color = NO_COLOR; hpbar_percent = 0, hpbar_color = NO_COLOR;
vert_status_dirty = 1; vert_status_dirty = 1;
#endif /* STATUS_HILITES */
/* let genl_status_init do most of the initialization */ /* let genl_status_init do most of the initialization */
genl_status_init(); genl_status_init();
@@ -72,14 +70,12 @@ curses_status_init()
void void
curses_status_finish() curses_status_finish()
{ {
#ifdef STATUS_HILITES
int i; int i;
for (i = 0; i < MAXBLSTATS; ++i) { for (i = 0; i < MAXBLSTATS; ++i) {
if (status_vals_long[i]) if (status_vals_long[i])
free(status_vals_long[i]), status_vals_long[i] = (char *) 0; free(status_vals_long[i]), status_vals_long[i] = (char *) 0;
} }
#endif /* STATUS_HILITES */
genl_status_finish(); genl_status_finish();
return; return;
@@ -138,7 +134,6 @@ curses_status_finish()
* See doc/window.doc for more details. * See doc/window.doc for more details.
*/ */
#ifdef STATUS_HILITES
static int changed_fields = 0; static int changed_fields = 0;
void void
@@ -304,7 +299,9 @@ boolean border;
cap_and_hunger, exp_points, sho_score, cap_and_hunger, exp_points, sho_score,
height, width, w, xtra, clen, x, y, t, ex, ey, height, width, w, xtra, clen, x, y, t, ex, ey,
condstart = 0, conddummy = 0; condstart = 0, conddummy = 0;
#ifdef STATUS_HILITES
int coloridx = NO_COLOR, attrmask = 0; int coloridx = NO_COLOR, attrmask = 0;
#endif /* STATUS_HILITES */
boolean asis = FALSE; boolean asis = FALSE;
WINDOW *win = curses_get_nhwin(STATUS_WIN); WINDOW *win = curses_get_nhwin(STATUS_WIN);
@@ -562,6 +559,7 @@ boolean border;
} else if (fld != BL_CONDITION) { } else if (fld != BL_CONDITION) {
/* regular field, including title if no hitpointbar */ /* regular field, including title if no hitpointbar */
#ifdef STATUS_HILITES
coloridx = curses_status_colors[fld]; /* includes attribute */ coloridx = curses_status_colors[fld]; /* includes attribute */
if (iflags.hilite_delta && coloridx != NO_COLOR) { if (iflags.hilite_delta && coloridx != NO_COLOR) {
/* expect 1 leading space; don't highlight it */ /* expect 1 leading space; don't highlight it */
@@ -580,9 +578,11 @@ boolean border;
curses_toggle_color_attr(win, coloridx, NONE, ON); curses_toggle_color_attr(win, coloridx, NONE, ON);
#endif #endif
} }
#endif /* STATUS_HILITES */
waddstr(win, text); waddstr(win, text);
#ifdef STATUS_HILITES
if (iflags.hilite_delta) { if (iflags.hilite_delta) {
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
if (coloridx != NO_COLOR) if (coloridx != NO_COLOR)
@@ -591,6 +591,7 @@ boolean border;
if (attrmask) if (attrmask)
wattroff(win, attrmask); wattroff(win, attrmask);
} }
#endif /* STATUS_HILITES */
} else { } else {
/* status conditions */ /* status conditions */
@@ -677,8 +678,11 @@ boolean border;
}; };
xchar spacing[MAXBLSTATS]; xchar spacing[MAXBLSTATS];
int i, fld, cap_and_hunger, time_and_score, cond_count; int i, fld, cap_and_hunger, time_and_score, cond_count;
char *text, *p, savedch = '\0'; char *text;
#ifdef STATUS_HILITES
char *p, savedch = '\0';
int coloridx = NO_COLOR, attrmask = 0; int coloridx = NO_COLOR, attrmask = 0;
#endif /* STATUS_HILITES */
int height_needed, height, width, x = 0, y = 0; int height_needed, height, width, x = 0, y = 0;
WINDOW *win = curses_get_nhwin(STATUS_WIN); WINDOW *win = curses_get_nhwin(STATUS_WIN);
@@ -827,6 +831,7 @@ boolean border;
&& (fld == BL_HUNGER && (fld == BL_HUNGER
|| (fld == BL_CAP && cap_and_hunger != 3))) || (fld == BL_CAP && cap_and_hunger != 3)))
++text; ++text;
#ifdef STATUS_HILITES
coloridx = curses_status_colors[fld]; /* includes attributes */ coloridx = curses_status_colors[fld]; /* includes attributes */
if (iflags.hilite_delta && coloridx != NO_COLOR) { if (iflags.hilite_delta && coloridx != NO_COLOR) {
/* most status_vals_long[] are "long-text : value" and /* most status_vals_long[] are "long-text : value" and
@@ -864,9 +869,11 @@ boolean border;
curses_toggle_color_attr(win, coloridx, NONE, ON); curses_toggle_color_attr(win, coloridx, NONE, ON);
#endif #endif
} /* highlighting active */ } /* highlighting active */
#endif /* STATUS_HILITES */
waddstr(win, text); waddstr(win, text);
#ifdef STATUS_HILITES
if (iflags.hilite_delta) { if (iflags.hilite_delta) {
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
if (coloridx != NO_COLOR) if (coloridx != NO_COLOR)
@@ -879,6 +886,7 @@ boolean border;
*p = savedch; *p = savedch;
waddstr(win, p); waddstr(win, p);
} }
#endif /* STATUS_HILITES */
} else { } else {
/* status conditions */ /* status conditions */
@@ -897,9 +905,11 @@ static void
curs_HPbar(char *text, /* pre-padded with trailing spaces if short */ curs_HPbar(char *text, /* pre-padded with trailing spaces if short */
int bar_len) /* width of space within the brackets */ int bar_len) /* width of space within the brackets */
{ {
#ifdef STATUS_HILITES
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
int coloridx; int coloridx;
#endif #endif
#endif /* STATUS_HILITES */
int k, bar_pos; int k, bar_pos;
char bar[STATVAL_WIDTH], *bar2 = (char *) 0, savedch = '\0'; char bar[STATVAL_WIDTH], *bar2 = (char *) 0, savedch = '\0';
boolean twoparts = (hpbar_percent < 100); boolean twoparts = (hpbar_percent < 100);
@@ -927,6 +937,7 @@ curs_HPbar(char *text, /* pre-padded with trailing spaces if short */
if (*bar) { /* True unless dead (0 HP => bar_pos == 0) */ if (*bar) { /* True unless dead (0 HP => bar_pos == 0) */
/* fixed attribute, not nhattr2curses((hpbar_color >> 8) & 0x00FF) */ /* fixed attribute, not nhattr2curses((hpbar_color >> 8) & 0x00FF) */
wattron(win, A_REVERSE); /* do this even if hilite_delta is 0 */ wattron(win, A_REVERSE); /* do this even if hilite_delta is 0 */
#ifdef STATUS_HILITES
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
if (iflags.hilite_delta) { if (iflags.hilite_delta) {
coloridx = hpbar_color & 0x00FF; coloridx = hpbar_color & 0x00FF;
@@ -934,16 +945,19 @@ curs_HPbar(char *text, /* pre-padded with trailing spaces if short */
curses_toggle_color_attr(win, coloridx, NONE, ON); curses_toggle_color_attr(win, coloridx, NONE, ON);
} }
#endif #endif
#endif /* STATUS_HILITES */
/* portion of title corresponding to current hit points */ /* portion of title corresponding to current hit points */
waddstr(win, bar); waddstr(win, bar);
#ifdef STATUS_HILITES
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
if (iflags.hilite_delta) { if (iflags.hilite_delta) {
if (coloridx != NO_COLOR) if (coloridx != NO_COLOR)
curses_toggle_color_attr(win, coloridx, NONE, OFF); curses_toggle_color_attr(win, coloridx, NONE, OFF);
} }
#endif #endif
#endif /* STATUS_HILITES */
wattroff(win, A_REVERSE); /* do this even if hilite_delta is 0 */ wattroff(win, A_REVERSE); /* do this even if hilite_delta is 0 */
} /* *bar (current HP > 0) */ } /* *bar (current HP > 0) */
@@ -983,16 +997,20 @@ curs_stat_conds(int vert_cond, /* 0 => horizontal, 1 => vertical */
if (curses_condition_bits & bitmsk) { if (curses_condition_bits & bitmsk) {
Strcpy(condnam, valid_conditions[i].id); Strcpy(condnam, valid_conditions[i].id);
Strcat(strcat(condbuf, " "), upstart(condnam)); Strcat(strcat(condbuf, " "), upstart(condnam));
#ifdef STATUS_HILITES
if (nohilite && *nohilite if (nohilite && *nohilite
&& (condcolor(bitmsk, curses_colormasks) != NO_COLOR && (condcolor(bitmsk, curses_colormasks) != NO_COLOR
|| condattr(bitmsk, curses_colormasks) != 0)) || condattr(bitmsk, curses_colormasks) != 0))
*nohilite = FALSE; *nohilite = FALSE;
#endif /* STATUS_HILITES */
} }
} }
} else if (curses_condition_bits) { } else if (curses_condition_bits) {
unsigned long cond_bits; unsigned long cond_bits;
int height = 0, width, cx, cy, cy0, cndlen, int height = 0, width, cx, cy, cy0, cndlen;
attrmask = 0, color = NO_COLOR; #ifdef STATUS_HILITES
int attrmask = 0, color = NO_COLOR;
#endif /* STATUS_HILITES */
boolean border, do_vert = (vert_cond != 0); boolean border, do_vert = (vert_cond != 0);
WINDOW *win = curses_get_nhwin(STATUS_WIN); WINDOW *win = curses_get_nhwin(STATUS_WIN);
@@ -1023,6 +1041,7 @@ curs_stat_conds(int vert_cond, /* 0 => horizontal, 1 => vertical */
/* output unhighlighted leading space unless at #1 of 3 */ /* output unhighlighted leading space unless at #1 of 3 */
if (!do_vert || (vert_cond % 3) != 1) if (!do_vert || (vert_cond % 3) != 1)
waddch(win, ' '); waddch(win, ' ');
#ifdef STATUS_HILITES
if (iflags.hilite_delta) { if (iflags.hilite_delta) {
if ((attrmask = condattr(bitmsk, curses_colormasks)) if ((attrmask = condattr(bitmsk, curses_colormasks))
!= 0) { != 0) {
@@ -1035,10 +1054,12 @@ curs_stat_conds(int vert_cond, /* 0 => horizontal, 1 => vertical */
curses_toggle_color_attr(win, color, NONE, ON); curses_toggle_color_attr(win, color, NONE, ON);
#endif #endif
} }
#endif /* STATUS_HILITES */
/* output the condition name */ /* output the condition name */
waddstr(win, upstart(condnam)); waddstr(win, upstart(condnam));
#ifdef STATUS_HILITES
if (iflags.hilite_delta) { if (iflags.hilite_delta) {
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
if (color != NO_COLOR) if (color != NO_COLOR)
@@ -1047,6 +1068,7 @@ curs_stat_conds(int vert_cond, /* 0 => horizontal, 1 => vertical */
if (attrmask) if (attrmask)
wattroff(win, attrmask); wattroff(win, attrmask);
} }
#endif /* STATUS_HILITES */
/* if that was #3 of 3 advance to next line */ /* if that was #3 of 3 advance to next line */
if (do_vert && (++vert_cond % 3) == 1) if (do_vert && (++vert_cond % 3) == 1)
wmove(win, (*y)++, *x); wmove(win, (*y)++, *x);
@@ -1199,6 +1221,7 @@ curs_vert_status_vals(int win_width)
vert_status_dirty = 0; vert_status_dirty = 0;
} }
#ifdef STATUS_HILITES
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
/* /*
* Return what color this condition should * Return what color this condition should
@@ -1277,6 +1300,8 @@ int attrmask;
} }
#endif /* STATUS_HILITES */ #endif /* STATUS_HILITES */
/* ======================================================================== */
#if 0 /* old stuff; some may be re-incorporated, most should be discarded */ #if 0 /* old stuff; some may be re-incorporated, most should be discarded */
/* Private declarations */ /* Private declarations */
@@ -2216,4 +2241,6 @@ curses_decrement_highlights(boolean zero)
if (unhighlight) if (unhighlight)
curses_update_stats(); curses_update_stats();
} }
#endif #endif /*0*/
/*cursstat.c*/