Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2018-09-28 20:01:41 -04:00
13 changed files with 168 additions and 89 deletions

View File

@@ -103,7 +103,7 @@ struct window_procs tty_procs = {
#endif
tty_getmsghistory, tty_putmsghistory,
tty_status_init,
genl_status_finish, genl_status_enablefield,
genl_status_finish, tty_status_enablefield,
#ifdef STATUS_HILITES
tty_status_update,
#else
@@ -187,6 +187,7 @@ STATIC_DCL int NDECL(condition_size);
STATIC_DCL int FDECL(make_things_fit, (BOOLEAN_P));
STATIC_DCL void FDECL(shrink_enc, (int));
STATIC_DCL void FDECL(shrink_dlvl, (int));
STATIC_DCL void NDECL(do_setlast);
#endif
/*
@@ -3530,7 +3531,8 @@ static const char *encvals[3][6] = {
{ "", "Burden", "Stress", "Strain", "Overtax", "Overload" },
{ "", "Brd", "Strs", "Strn", "Ovtx", "Ovld" }
};
static enum statusfields fieldorder[2][15] = { /* 2: two status lines */
#define MAX_PER_ROW 15
static enum statusfields fieldorder[2][MAX_PER_ROW] = { /* 2: two status lines */
{ BL_TITLE, BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH, BL_ALIGN,
BL_SCORE, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH,
BL_FLUSH },
@@ -3539,6 +3541,8 @@ static enum statusfields fieldorder[2][15] = { /* 2: two status lines */
BL_CAP, BL_CONDITION, BL_FLUSH }
};
static int last_on_row[2];
static boolean setlast = FALSE;
static boolean windowdata_init = FALSE;
static int cond_shrinklvl = 0, cond_width_at_shrink = 0;
static int enclev = 0, enc_shrinklvl = 0;
@@ -3584,6 +3588,7 @@ tty_status_init()
tty_status[NOW][i].valid = FALSE;
tty_status[NOW][i].dirty = FALSE;
tty_status[NOW][i].redraw = FALSE;
tty_status[NOW][i].padright = FALSE;
tty_status[BEFORE][i] = tty_status[NOW][i];
}
tty_condition_bits = 0L;
@@ -3594,6 +3599,36 @@ tty_status_init()
genl_status_init();
}
void
tty_status_enablefield(fieldidx, nm, fmt, enable)
int fieldidx;
const char *nm;
const char *fmt;
boolean enable;
{
genl_status_enablefield(fieldidx, nm, fmt, enable);
/* force re-evaluation of last field on the row */
setlast = FALSE;
}
void
do_setlast()
{
int i, row, fld;
setlast = TRUE;
for (row = 0; row < 2; ++row)
for (i = MAX_PER_ROW - 1; i > 0; --i) {
fld = fieldorder[row][i];
if (fld == BL_FLUSH || !status_activefields[fld])
continue;
last_on_row[row] = fld;
break;
}
}
#ifdef STATUS_HILITES
/*
@@ -3672,6 +3707,9 @@ unsigned long *colormasks;
if ((fldidx >= 0 && fldidx < MAXBLSTATS) && !status_activefields[fldidx])
return;
if (!setlast)
do_setlast();
#ifndef TEXTCOLOR
color = (color & ~0x00FF) | NO_COLOR;
#endif
@@ -3845,8 +3883,12 @@ int *topsz, *bottomsz;
/* On a change to the field length, everything
further to the right must be updated as well */
if (tty_status[NOW][idx].lth != tty_status[BEFORE][idx].lth)
if (tty_status[NOW][idx].lth != tty_status[BEFORE][idx].lth) {
update_right = TRUE;
if ((tty_status[NOW][idx].lth < tty_status[BEFORE][idx].lth) &&
idx == last_on_row[row])
tty_status[NOW][idx].padright = TRUE;
}
if (!update_right && !forcefields) {
/*
@@ -4291,17 +4333,26 @@ render_status(VOID_ARGS)
term_start_color(coloridx);
}
tty_putstatusfield(&tty_status[NOW][fldidx],
text, x, y);
text, x, y);
if (iflags.hilite_delta) {
if (coloridx != NO_COLOR && coloridx != CLR_MAX)
term_end_color();
End_Attr(attridx);
}
if (tty_status[NOW][fldidx].padright) {
int cnt = tty_status[BEFORE][fldidx].lth
- tty_status[NOW][fldidx].lth;
x += (tty_status[NOW][fldidx].lth - 1);
while (cnt-- > 0)
tty_putstatusfield(nullfield, " ", x++, y);
}
}
}
/* reset .redraw and .dirty now that they've been rendered */
/* reset .redraw, .dirty, .padright now that they've been rendered */
tty_status[NOW][fldidx].dirty = FALSE;
tty_status[NOW][fldidx].redraw = FALSE;
tty_status[NOW][fldidx].padright = FALSE;
/*
* Make a copy of the entire tty_status struct for comparison