-/* NetHack 3.6 winstat.c $NHDT-Date: 1452920162 2016/01/16 04:56:02 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.16 $ */
+/* NetHack 3.6 winstat.c $NHDT-Date: 1540247293 2018/10/22 22:28:13 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.18 $ */
/* Copyright (c) Dean Luick, 1992 */
/* NetHack may be freely redistributed. See license for details. */
BL_CAP, BL_CONDITION, BL_FLUSH }
};
-static boolean X11_labels_created = FALSE;
+/* static boolean X11_labels_created = FALSE; */
static Widget X11_status_widget;
static Widget X11_status_labels[MAXBLSTATS];
static Widget X11_cond_labels[32]; /* Ugh */
return;
label = X11_cond_labels[idx];
- if ((X11_condition_bits & bm)) {
+ if ((X11_condition_bits & bm) != 0) {
int attrmask, coloridx;
XFontStruct *font;
Position lbl_x;
Position lbl_y;
+
#ifdef TEXTCOLOR
coloridx = condcolor(bm, colormasks);
+#else
+ coloridx = NO_COLOR;
#endif
attrmask = condattr(bm, colormasks);
num_args = 0;
XtSetArg(args[num_args], nhStr(XtNlabel), (text && *text) ? text : ""); num_args++;
XtSetArg(args[num_args], nhStr(XtNwidth), lbl_wid); num_args++;
- fg = (coloridx != NO_COLOR) ? X11_colors[coloridx] : X11_status_widget_fg;
+ fg = (coloridx != NO_COLOR) ? X11_colors[coloridx]
+ : X11_status_widget_fg;
if (attrmask & HL_INVERSE) {
Pixel tmppx = fg;
fg = bg;
void
X11_status_update_tty(fld, ptr, chg, percent, color, colormasks)
-int fld, chg UNUSED, percent UNUSED, color;
+int fld, chg UNUSED, percent, color;
genericptr_t ptr;
unsigned long *colormasks;
{
+ static boolean oncearound = FALSE; /* prevent premature partial display */
long *condptr = (long *) ptr;
- int i, j, attrmask = 0;
-#ifdef TEXTCOLOR
int coloridx = NO_COLOR;
-#endif
const char *text = (char *) ptr;
char tmpbuf[BUFSZ];
- static boolean oncearound = FALSE; /* prevent premature partial display */
int attridx = 0;
XFontStruct *font;
- int direction;
- int ascent;
- int descent;
- XCharStruct overall;
Arg args[10];
Cardinal num_args;
Position lbl_x;
Widget label;
Pixel fg = X11_status_widget_fg, bg = X11_status_widget_bg;
+#ifndef TEXTCOLOR
+ color = NO_COLOR;
+#endif
+
if (fld < BL_RESET || fld >= MAXBLSTATS)
return;
(fld == BL_TITLE && iflags.wc2_hitpointbar) ? "%-30s" :
status_fieldfmt[fld] ? status_fieldfmt[fld] : "%s",
text);
-#ifdef TEXTCOLOR
X11_status_colors[fld] = color;
-#else
- X11_status_colors[fld] = NO_COLOR;
-#endif
if (iflags.wc2_hitpointbar && fld == BL_HP) {
hpbar_percent = percent;
-#ifdef TEXTCOLOR
hpbar_color = color;
-#else
- hpbar_color = NO_COLOR;
-#endif
}
break;
}
text = status_vals[fld];
if (fld == BL_GOLD)
text = decode_mixed(tmpbuf, text);
-
#ifdef TEXTCOLOR
coloridx = X11_status_colors[fld] & 0x00FF;
#endif
attridx = (X11_status_colors[fld] & 0xFF00) >> 8;
-
num_args = 0;
XtSetArg(args[num_args], nhStr(XtNfont), &font); num_args++;
XtSetArg(args[num_args], nhStr(XtNx), &lbl_x); num_args++;
XtSetArg(args[num_args], nhStr(XtNborderWidth), &lbl_border_wid); num_args++;
XtGetValues(label, args, num_args);
- /*raw_printf("font: %i-%i", font->min_bounds.width, font->max_bounds.width);*/
+ /*raw_printf("font: %i-%i",
+ font->min_bounds.width, font->max_bounds.width);*/
if (text && *text)
lbl_wid = lbl_iwidth + font->max_bounds.width * strlen(text);
/*raw_printf("1:lbl_wid=%i('%s')", lbl_wid, text);*/
num_args = 0;
- XtSetArg(args[num_args], nhStr(XtNlabel), (text && *text) ? text : ""); num_args++;
+ XtSetArg(args[num_args], nhStr(XtNlabel),
+ (text && *text) ? text : ""); num_args++;
XtSetArg(args[num_args], nhStr(XtNwidth), lbl_wid); num_args++;
- fg = (coloridx != NO_COLOR) ? X11_colors[coloridx] : X11_status_widget_fg;
+ fg = (coloridx != NO_COLOR) ? X11_colors[coloridx]
+ : X11_status_widget_fg;
if (attridx & HL_INVERSE) {
Pixel tmppx = fg;
+
fg = bg;
bg = tmppx;
}
XtResizeWidget(label, lbl_wid, lbl_hei, lbl_border_wid);
}
} else {
- int x,y;
+ int x, y;
+
for (y = 0; y < X11_NUM_STATUS_LINES; y++) {
Cardinal dx = 0;
+
for (x = 0; x < X11_NUM_STATUS_FIELD; x++) {
int f = X11_fieldorder[y][x];
XtSetArg(args[num_args], nhStr(XtNy), &lbl_y); num_args++;
XtSetArg(args[num_args], nhStr(XtNwidth), &lbl_wid); num_args++;
XtSetArg(args[num_args], nhStr(XtNheight), &lbl_hei); num_args++;
- XtSetArg(args[num_args], nhStr(XtNborderWidth), &lbl_border_wid); num_args++;
+ XtSetArg(args[num_args], nhStr(XtNborderWidth),
+ &lbl_border_wid); num_args++;
XtGetValues(label, args, num_args);
lbl_x = dx;
num_args = 0;
XtSetArg(args[num_args], nhStr(XtNx), lbl_x); num_args++;
XtSetValues(label, args, num_args);
- XtConfigureWidget(label, lbl_x, lbl_y, lbl_wid, lbl_hei, lbl_border_wid);
+ XtConfigureWidget(label, lbl_x, lbl_y,
+ lbl_wid, lbl_hei, lbl_border_wid);
if (lbl_wid > 1)
dx += lbl_wid;
XtSetArg(args[num_args], nhStr(XtNy), &lbl_y); num_args++;
XtSetArg(args[num_args], nhStr(XtNwidth), &lbl_wid); num_args++;
XtSetArg(args[num_args], nhStr(XtNheight), &lbl_hei); num_args++;
- XtSetArg(args[num_args], nhStr(XtNborderWidth), &lbl_border_wid); num_args++;
+ XtSetArg(args[num_args], nhStr(XtNborderWidth),
+ &lbl_border_wid); num_args++;
XtGetValues(label, args, num_args);
lbl_x = dx;
XtSetArg(args[num_args], nhStr(XtNx), lbl_x); num_args++;
XtSetArg(args[num_args], nhStr(XtNlabel), text); num_args++;
XtSetValues(label, args, num_args);
- XtConfigureWidget(label, lbl_x, lbl_y, lbl_wid, lbl_hei, lbl_border_wid);
+ XtConfigureWidget(label, lbl_x, lbl_y,
+ lbl_wid, lbl_hei, lbl_border_wid);
dx += lbl_wid;
}
}
}
+/*ARGSUSED*/
void
X11_status_update_fancy(fld, ptr, chg, percent, color, colormasks)
-int fld, chg UNUSED, percent UNUSED, color;
+int fld, chg UNUSED, percent UNUSED, color UNUSED;
genericptr_t ptr;
-unsigned long *colormasks;
+unsigned long *colormasks UNUSED;
{
- int i;
- struct {
+ static const struct {
int bl, ff;
} bl_to_fancyfield[] = {
{ BL_TITLE, F_NAME },
{ BL_LEVELDESC, F_DLEVEL },
{ BL_EXP, F_EXP }
};
-
- struct {
- long mask;
+ static const struct {
+ unsigned long mask;
int ff;
} mask_to_fancyfield[] = {
{ BL_MASK_STONE, F_STONE },
{ BL_MASK_FLY, F_FLY },
{ BL_MASK_RIDE, F_RIDE }
};
+ int i;
if (fld == BL_RESET || fld == BL_FLUSH) {
if (WIN_STATUS != WIN_ERR) {
struct xwindow *wp = &window_list[WIN_STATUS];
+
update_fancy_status(wp);
}
return;
Widget w;
Arg args[16];
Cardinal num_args;
- char buf[32];
int i, x, y;
- Widget testlabel;
num_args = 0;
if (top != (Widget) 0) {
int fld = X11_fieldorder[y][x];
char labelname[BUFSZ];
int prevfld;
+
if (fld <= BL_FLUSH)
continue;
Sprintf(labelname, "label_%s", bl_idx_to_fldname(fld));
num_args = 0;
if (y > 0) {
prevfld = X11_fieldorder[y-1][0];
- XtSetArg(args[num_args], nhStr(XtNfromVert), X11_status_labels[prevfld]); num_args++;
+ XtSetArg(args[num_args], nhStr(XtNfromVert),
+ X11_status_labels[prevfld]); num_args++;
}
if (x > 0) {
prevfld = X11_fieldorder[y][x-1];
- XtSetArg(args[num_args], nhStr(XtNfromHoriz), X11_status_labels[prevfld]); num_args++;
+ XtSetArg(args[num_args], nhStr(XtNfromHoriz),
+ X11_status_labels[prevfld]); num_args++;
}
XtSetArg(args[num_args], nhStr(XtNhorizDistance), 0); num_args++;
XtSetArg(args[num_args], nhStr(XtNjustify), XtJustifyLeft); num_args++;
XtSetArg(args[num_args], nhStr(XtNborderWidth), 0); num_args++;
/*
- XtSetArg(args[num_args], nhStr(XtNlabel), bl_idx_to_fldname(fld)); num_args++;
+ XtSetArg(args[num_args], nhStr(XtNlabel),
+ bl_idx_to_fldname(fld)); num_args++;
*/
XtSetArg(args[num_args], nhStr(XtNlabel), ""); num_args++;
X11_status_labels[fld] = XtCreateManagedWidget(labelname,
num_args = 0;
prevfld = X11_fieldorder[0][0];
- XtSetArg(args[num_args], nhStr(XtNfromVert), X11_status_labels[prevfld]); num_args++;
+ XtSetArg(args[num_args], nhStr(XtNfromVert),
+ X11_status_labels[prevfld]); num_args++;
XtSetArg(args[num_args], nhStr(XtNfromHoriz),
(i == 0) ? X11_status_labels[BL_CONDITION]
return w;
}
+/*ARGSUSED*/
void
create_status_window_tty(wp, create_popup, parent)
struct xwindow *wp; /* window pointer */
-boolean create_popup;
+boolean create_popup UNUSED;
Widget parent;
{
Arg args[10];
wp->type = NHW_NONE;
}
+/*ARGSUSED*/
void
adjust_status_tty(wp, str)
-struct xwindow *wp;
-const char *str;
+struct xwindow *wp UNUSED;
+const char *str UNUSED;
{
/* nothing */
}
update_val(sv, val);
}
+/*ARGUSED*/
static void
update_fancy_status(wp)
-struct xwindow *wp;
+struct xwindow *wp UNUSED;
{
- struct X_status_value *sv;
- long val;
int i;
/*if (wp->cursy != 0)