-/* 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) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */
STATIC_OVL NEARDATA int mrank_sz = 0; /* loaded by max_rank_sz (from u_init) */
STATIC_DCL const char *NDECL(rank);
-#ifdef STATUS_HILITES
STATIC_DCL void NDECL(bot_via_windowport);
STATIC_DCL void NDECL(stat_update_time);
-#endif
static char *
get_strength_str()
{
/* dosave() flags completion by setting u.uhp to -1 */
if ((u.uhp != -1) && youmonst.data && iflags.status_updates) {
-#ifdef STATUS_HILITES
- bot_via_windowport();
-#else
- curs(WIN_STATUS, 1, 0);
- putstr(WIN_STATUS, 0, do_statusline1());
- curs(WIN_STATUS, 1, 1);
- putmixed(WIN_STATUS, 0, do_statusline2());
-#endif
+ if (VIA_WINDOWPORT()) {
+ bot_via_windowport();
+ } else {
+ curs(WIN_STATUS, 1, 0);
+ putstr(WIN_STATUS, 0, do_statusline1());
+ curs(WIN_STATUS, 1, 1);
+ putmixed(WIN_STATUS, 0, do_statusline2());
+ }
}
context.botl = context.botlx = iflags.time_botl = FALSE;
}
void
timebot()
{
- if (flags.time) {
-#ifdef STATUS_HILITES
- stat_update_time();
-#else
- /* old status display updates everything */
- bot();
-#endif
+ if (flags.time && iflags.status_updates) {
+ if (VIA_WINDOWPORT()) {
+ stat_update_time();
+ } else {
+ /* old status display updates everything */
+ bot();
+ }
}
iflags.time_botl = FALSE;
}
evaluate_and_notify_windowport(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 */
STATIC_OVL void
stat_update_time()
NO_COLOR, (unsigned long *) 0);
return;
}
-#endif
STATIC_OVL boolean
eval_notify_windowport_field(fld, valsetlist, idx)
return TRUE;
}
+#endif /* STATUS_HILITES */
const struct condmap valid_conditions[] = {
{ "stone", BL_MASK_STONE },
{ "ride", BL_MASK_RIDE },
};
+#ifdef STATUS_HILITES
+
const struct condmap condition_aliases[] = {
{ "strangled", BL_MASK_STRNGL },
{ "all", BL_MASK_STONE | BL_MASK_SLIME | BL_MASK_STRNGL
/* Long format fields for vertical window */
static char *status_vals_long[MAXBLSTATS];
-#ifdef STATUS_HILITES
static unsigned long *curses_colormasks;
static long curses_condition_bits;
static int curses_status_colors[MAXBLSTATS];
static int hpbar_percent, hpbar_color;
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 FDECL(draw_vertical, (BOOLEAN_P));
static void FDECL(draw_horizontal, (BOOLEAN_P));
static void curs_HPbar(char *, int);
static void curs_stat_conds(int, int *, int *, char *, boolean *);
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;
everything but title fits within 30 even with prefix and longest value) */
void
curses_status_init()
{
-#ifdef STATUS_HILITES
int i;
for (i = 0; i < MAXBLSTATS; ++i) {
curses_condition_bits = 0L;
hpbar_percent = 0, hpbar_color = NO_COLOR;
vert_status_dirty = 1;
-#endif /* STATUS_HILITES */
/* let genl_status_init do most of the initialization */
genl_status_init();
void
curses_status_finish()
{
-#ifdef STATUS_HILITES
int i;
for (i = 0; i < MAXBLSTATS; ++i) {
if (status_vals_long[i])
free(status_vals_long[i]), status_vals_long[i] = (char *) 0;
}
-#endif /* STATUS_HILITES */
genl_status_finish();
return;
* See doc/window.doc for more details.
*/
-#ifdef STATUS_HILITES
static int changed_fields = 0;
void
cap_and_hunger, exp_points, sho_score,
height, width, w, xtra, clen, x, y, t, ex, ey,
condstart = 0, conddummy = 0;
+#ifdef STATUS_HILITES
int coloridx = NO_COLOR, attrmask = 0;
+#endif /* STATUS_HILITES */
boolean asis = FALSE;
WINDOW *win = curses_get_nhwin(STATUS_WIN);
} else if (fld != BL_CONDITION) {
/* regular field, including title if no hitpointbar */
+#ifdef STATUS_HILITES
coloridx = curses_status_colors[fld]; /* includes attribute */
if (iflags.hilite_delta && coloridx != NO_COLOR) {
/* expect 1 leading space; don't highlight it */
curses_toggle_color_attr(win, coloridx, NONE, ON);
#endif
}
+#endif /* STATUS_HILITES */
waddstr(win, text);
+#ifdef STATUS_HILITES
if (iflags.hilite_delta) {
#ifdef TEXTCOLOR
if (coloridx != NO_COLOR)
if (attrmask)
wattroff(win, attrmask);
}
+#endif /* STATUS_HILITES */
} else {
/* status conditions */
};
xchar spacing[MAXBLSTATS];
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;
+#endif /* STATUS_HILITES */
int height_needed, height, width, x = 0, y = 0;
WINDOW *win = curses_get_nhwin(STATUS_WIN);
&& (fld == BL_HUNGER
|| (fld == BL_CAP && cap_and_hunger != 3)))
++text;
+#ifdef STATUS_HILITES
coloridx = curses_status_colors[fld]; /* includes attributes */
if (iflags.hilite_delta && coloridx != NO_COLOR) {
/* most status_vals_long[] are "long-text : value" and
curses_toggle_color_attr(win, coloridx, NONE, ON);
#endif
} /* highlighting active */
+#endif /* STATUS_HILITES */
waddstr(win, text);
+#ifdef STATUS_HILITES
if (iflags.hilite_delta) {
#ifdef TEXTCOLOR
if (coloridx != NO_COLOR)
*p = savedch;
waddstr(win, p);
}
+#endif /* STATUS_HILITES */
} else {
/* status conditions */
curs_HPbar(char *text, /* pre-padded with trailing spaces if short */
int bar_len) /* width of space within the brackets */
{
+#ifdef STATUS_HILITES
#ifdef TEXTCOLOR
int coloridx;
#endif
+#endif /* STATUS_HILITES */
int k, bar_pos;
char bar[STATVAL_WIDTH], *bar2 = (char *) 0, savedch = '\0';
boolean twoparts = (hpbar_percent < 100);
if (*bar) { /* True unless dead (0 HP => bar_pos == 0) */
/* fixed attribute, not nhattr2curses((hpbar_color >> 8) & 0x00FF) */
wattron(win, A_REVERSE); /* do this even if hilite_delta is 0 */
+#ifdef STATUS_HILITES
#ifdef TEXTCOLOR
if (iflags.hilite_delta) {
coloridx = hpbar_color & 0x00FF;
curses_toggle_color_attr(win, coloridx, NONE, ON);
}
#endif
+#endif /* STATUS_HILITES */
/* portion of title corresponding to current hit points */
waddstr(win, bar);
+#ifdef STATUS_HILITES
#ifdef TEXTCOLOR
if (iflags.hilite_delta) {
if (coloridx != NO_COLOR)
curses_toggle_color_attr(win, coloridx, NONE, OFF);
}
#endif
+#endif /* STATUS_HILITES */
wattroff(win, A_REVERSE); /* do this even if hilite_delta is 0 */
} /* *bar (current HP > 0) */
if (curses_condition_bits & bitmsk) {
Strcpy(condnam, valid_conditions[i].id);
Strcat(strcat(condbuf, " "), upstart(condnam));
+#ifdef STATUS_HILITES
if (nohilite && *nohilite
&& (condcolor(bitmsk, curses_colormasks) != NO_COLOR
|| condattr(bitmsk, curses_colormasks) != 0))
*nohilite = FALSE;
+#endif /* STATUS_HILITES */
}
}
} else if (curses_condition_bits) {
unsigned long cond_bits;
- int height = 0, width, cx, cy, cy0, cndlen,
- attrmask = 0, color = NO_COLOR;
+ int height = 0, width, cx, cy, cy0, cndlen;
+#ifdef STATUS_HILITES
+ int attrmask = 0, color = NO_COLOR;
+#endif /* STATUS_HILITES */
boolean border, do_vert = (vert_cond != 0);
WINDOW *win = curses_get_nhwin(STATUS_WIN);
/* output unhighlighted leading space unless at #1 of 3 */
if (!do_vert || (vert_cond % 3) != 1)
waddch(win, ' ');
+#ifdef STATUS_HILITES
if (iflags.hilite_delta) {
if ((attrmask = condattr(bitmsk, curses_colormasks))
!= 0) {
curses_toggle_color_attr(win, color, NONE, ON);
#endif
}
+#endif /* STATUS_HILITES */
/* output the condition name */
waddstr(win, upstart(condnam));
+#ifdef STATUS_HILITES
if (iflags.hilite_delta) {
#ifdef TEXTCOLOR
if (color != NO_COLOR)
if (attrmask)
wattroff(win, attrmask);
}
+#endif /* STATUS_HILITES */
/* if that was #3 of 3 advance to next line */
if (do_vert && (++vert_cond % 3) == 1)
wmove(win, (*y)++, *x);
vert_status_dirty = 0;
}
+#ifdef STATUS_HILITES
#ifdef TEXTCOLOR
/*
* Return what color this condition should
}
#endif /* STATUS_HILITES */
+/* ======================================================================== */
+
#if 0 /* old stuff; some may be re-incorporated, most should be discarded */
/* Private declarations */
if (unhighlight)
curses_update_stats();
}
-#endif
+#endif /*0*/
+
+/*cursstat.c*/