Merge branch 'NetHack-3.6.2-beta01' into NetHack-3.6.2

This commit is contained in:
nhmall
2019-03-27 07:11:43 -04:00
4 changed files with 68 additions and 60 deletions
+6 -1
View File
@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.282 $ $NHDT-Date: 1553480403 2019/03/25 02:20:03 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.285 $ $NHDT-Date: 1553653612 2019/03/27 02:26:52 $
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,
@@ -396,6 +396,8 @@ status lines' dungeon location field in the elemental planes now shows Earth
or Air or Fire or Water instead of generic End Game or Air or Fire or Water instead of generic End Game
avoid spurious status refresh when hero gains experience while 'showexp' and avoid spurious status refresh when hero gains experience while 'showexp' and
'showscore' options are off 'showscore' options are off
using Cleaver to attack a worm tail segment but kill adjacent head first would
result in an impossible warning from cutworm
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
@@ -465,6 +467,8 @@ having an artifact wish be refused ("for a moment you feel <artifact> in
using 'O' to set status hilites for any status condition (Blind, &c) and using 'O' to set status hilites for any status condition (Blind, &c) and
specifying more than one attribute (Bold, Inverse, &c) it would only specifying more than one attribute (Bold, Inverse, &c) it would only
retain one of the chosen attributes retain one of the chosen attributes
when u.uhp==-1 became a flag to suppress status updating, if game ended when
hero died with exactly -1 HP, status would be blank during disclosure
tty: turn off an optimization that is the suspected cause of Windows reported tty: turn off an optimization that is the suspected cause of Windows reported
partial status lines following level changes partial status lines following level changes
tty: ensure that current status fields are always copied to prior status tty: ensure that current status fields are always copied to prior status
@@ -473,6 +477,7 @@ tty: fix an out of bounds error in tty_status_update() for BL_HUNGER case
tty: fix leftover display artifact when the last field on the row got placed tty: fix leftover display artifact when the last field on the row got placed
to the left of where it was previously due to it, or one of the fields to the left of where it was previously due to it, or one of the fields
to its left, getting shorter to its left, getting shorter
tty: support hitpointbar even when statushilites is set to 0
X11: its use of genl_status_update exposed a negative index use that could X11: its use of genl_status_update exposed a negative index use that could
lead to a segfault lead to a segfault
X11: rollback disabling of keystroke input for PICK_NONE menus (for scrolling) X11: rollback disabling of keystroke input for PICK_NONE menus (for scrolling)
+6 -5
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 end.c $NHDT-Date: 1549921169 2019/02/11 21:39:29 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.163 $ */ /* NetHack 3.6 end.c $NHDT-Date: 1553652951 2019/03/27 02:15:51 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.166 $ */
/* 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. */
@@ -1086,10 +1086,11 @@ int how;
if (how < PANICKED) { if (how < PANICKED) {
u.umortality++; u.umortality++;
/* in case caller hasn't already done this */ /* in case caller hasn't already done this */
if (u.uhp > 0 || (Upolyd && u.mh > 0)) { if (u.uhp != 0 || (Upolyd && u.mh != 0)) {
/* for deaths not triggered by loss of hit points, force /* force HP to zero in case it is still positive (some
current HP to zero (0 HP when turning into green slime deaths aren't triggered by loss of hit points), or
is iffy but we don't have much choice--that is fatal) */ negative (-1 is used as a flag in some circumstances
which don't apply when actually dying due to HP loss) */
u.uhp = u.mh = 0; u.uhp = u.mh = 0;
context.botl = 1; context.botl = 1;
} }
+14 -6
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 uhitm.c $NHDT-Date: 1548209742 2019/01/23 02:15:42 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.203 $ */ /* NetHack 3.6 uhitm.c $NHDT-Date: 1553644725 2019/03/26 23:58:45 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.206 $ */
/* 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. */
@@ -481,7 +481,7 @@ int dieroll;
if (!*mhit) { if (!*mhit) {
missum(mon, uattk, (rollneeded + armorpenalty > dieroll)); missum(mon, uattk, (rollneeded + armorpenalty > dieroll));
} else { } else {
int oldhp = mon->mhp, x = u.ux + u.dx, y = u.uy + u.dy; int oldhp = mon->mhp;
long oldweaphit = u.uconduct.weaphit; long oldweaphit = u.uconduct.weaphit;
/* KMH, conduct */ /* KMH, conduct */
@@ -490,7 +490,7 @@ int dieroll;
/* we hit the monster; be careful: it might die or /* we hit the monster; be careful: it might die or
be knocked into a different location */ be knocked into a different location */
notonhead = (mon->mx != x || mon->my != y); notonhead = (mon->mx != bhitpos.x || mon->my != bhitpos.y);
malive = hmon(mon, weapon, HMON_MELEE, dieroll); malive = hmon(mon, weapon, HMON_MELEE, dieroll);
if (malive) { if (malive) {
/* monster still alive */ /* monster still alive */
@@ -510,7 +510,7 @@ int dieroll;
u.uconduct.weaphit = oldweaphit; u.uconduct.weaphit = oldweaphit;
} }
if (mon->wormno && *mhit) if (mon->wormno && *mhit)
cutworm(mon, x, y, slice_or_chop); cutworm(mon, bhitpos.x, bhitpos.y, slice_or_chop);
} }
} }
return malive; return malive;
@@ -530,6 +530,7 @@ struct attack *uattk; /* ... but we don't enforce that here; Null works ok */
simulation attempt a bit */ simulation attempt a bit */
static boolean clockwise = FALSE; static boolean clockwise = FALSE;
unsigned i; unsigned i;
coord save_bhitpos;
int count, umort, x = u.ux, y = u.uy; int count, umort, x = u.ux, y = u.uy;
/* find the direction toward primary target */ /* find the direction toward primary target */
@@ -546,6 +547,7 @@ struct attack *uattk; /* ... but we don't enforce that here; Null works ok */
to primary target */ to primary target */
i = (i + (clockwise ? 6 : 2)) % 8; i = (i + (clockwise ? 6 : 2)) % 8;
umort = u.umortality; /* used to detect life-saving */ umort = u.umortality; /* used to detect life-saving */
save_bhitpos = bhitpos;
/* /*
* Three attacks: adjacent to primary, primary, adjacent on other * Three attacks: adjacent to primary, primary, adjacent on other
@@ -576,6 +578,7 @@ struct attack *uattk; /* ... but we don't enforce that here; Null works ok */
&attknum, &armorpenalty); &attknum, &armorpenalty);
dieroll = rnd(20); dieroll = rnd(20);
mhit = (tmp > dieroll); mhit = (tmp > dieroll);
bhitpos.x = tx, bhitpos.y = ty; /* normally set up by attack() */
(void) known_hitum(mtmp, uwep, &mhit, tmp, armorpenalty, (void) known_hitum(mtmp, uwep, &mhit, tmp, armorpenalty,
uattk, dieroll); uattk, dieroll);
(void) passive(mtmp, uwep, mhit, !DEADMONSTER(mtmp), AT_WEAP, !uwep); (void) passive(mtmp, uwep, mhit, !DEADMONSTER(mtmp), AT_WEAP, !uwep);
@@ -587,6 +590,8 @@ struct attack *uattk; /* ... but we don't enforce that here; Null works ok */
} }
/* set up for next time */ /* set up for next time */
clockwise = !clockwise; /* alternate */ clockwise = !clockwise; /* alternate */
bhitpos = save_bhitpos; /* in case somebody relies on bhitpos
* designating the primary target */
/* return False if primary target died, True otherwise; note: if 'target' /* return False if primary target died, True otherwise; note: if 'target'
was nonNull upon entry then it's still nonNull even if *target died */ was nonNull upon entry then it's still nonNull even if *target died */
@@ -616,6 +621,7 @@ struct attack *uattk;
if (tmp > dieroll) if (tmp > dieroll)
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
/* bhitpos is set up by caller */
malive = known_hitum(mon, uwep, &mhit, tmp, armorpenalty, uattk, dieroll); malive = known_hitum(mon, uwep, &mhit, tmp, armorpenalty, uattk, dieroll);
if (wepbefore && !uwep) if (wepbefore && !uwep)
wep_was_destroyed = TRUE; wep_was_destroyed = TRUE;
@@ -2285,13 +2291,14 @@ register struct monst *mon;
struct attack *mattk, alt_attk; struct attack *mattk, alt_attk;
struct obj *weapon, **originalweapon; struct obj *weapon, **originalweapon;
boolean altwep = FALSE, weapon_used = FALSE, odd_claw = TRUE; boolean altwep = FALSE, weapon_used = FALSE, odd_claw = TRUE;
int i, tmp, armorpenalty, sum[NATTK] = { 0 }, nsum = 0, dhit = 0, attknum = 0; int i, tmp, armorpenalty, sum[NATTK], nsum = 0, dhit = 0, attknum = 0;
int dieroll, multi_claw = 0; int dieroll, multi_claw = 0;
/* with just one touch/claw/weapon attack, both rings matter; /* with just one touch/claw/weapon attack, both rings matter;
with more than one, alternate right and left when checking with more than one, alternate right and left when checking
whether silver ring causes successful hit */ whether silver ring causes successful hit */
for (i = 0; i < NATTK; i++) { for (i = 0; i < NATTK; i++) {
sum[i] = 0;
mattk = getmattk(&youmonst, mon, i, sum, &alt_attk); mattk = getmattk(&youmonst, mon, i, sum, &alt_attk);
if (mattk->aatyp == AT_WEAP if (mattk->aatyp == AT_WEAP
|| mattk->aatyp == AT_CLAW || mattk->aatyp == AT_TUCH) || mattk->aatyp == AT_CLAW || mattk->aatyp == AT_TUCH)
@@ -2300,7 +2307,7 @@ register struct monst *mon;
multi_claw = (multi_claw > 1); /* switch from count to yes/no */ multi_claw = (multi_claw > 1); /* switch from count to yes/no */
for (i = 0; i < NATTK; i++) { for (i = 0; i < NATTK; i++) {
sum[i] = 0; /* sum[i] = 0; -- now done above */
mattk = getmattk(&youmonst, mon, i, sum, &alt_attk); mattk = getmattk(&youmonst, mon, i, sum, &alt_attk);
weapon = 0; weapon = 0;
switch (mattk->aatyp) { switch (mattk->aatyp) {
@@ -2357,6 +2364,7 @@ register struct monst *mon;
&armorpenalty); &armorpenalty);
dieroll = rnd(20); dieroll = rnd(20);
dhit = (tmp > dieroll || u.uswallow); dhit = (tmp > dieroll || u.uswallow);
/* caller must set bhitpos */
if (!known_hitum(mon, weapon, &dhit, tmp, if (!known_hitum(mon, weapon, &dhit, tmp,
armorpenalty, mattk, dieroll)) { armorpenalty, mattk, dieroll)) {
/* enemy dead, before any special abilities used */ /* enemy dead, before any special abilities used */
+42 -48
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 wintty.c $NHDT-Date: 1550629490 2019/02/20 02:24:50 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.196 $ */ /* NetHack 3.6 wintty.c $NHDT-Date: 1553653619 2019/03/27 02:26:59 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.197 $ */
/* Copyright (c) David Cohrs, 1991 */ /* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -3838,9 +3838,6 @@ unsigned long *colormasks;
/* Special additional processing for hitpointbar */ /* Special additional processing for hitpointbar */
hpbar_percent = percent; hpbar_percent = percent;
hpbar_color = (color & 0x00FF); hpbar_color = (color & 0x00FF);
}
if (iflags.wc2_hitpointbar
&& (tty_procs.wincap2 & WC2_FLUSH_STATUS) != 0L) {
tty_status[NOW][BL_TITLE].color = hpbar_color; tty_status[NOW][BL_TITLE].color = hpbar_color;
tty_status[NOW][BL_TITLE].dirty = TRUE; tty_status[NOW][BL_TITLE].dirty = TRUE;
} }
@@ -3850,17 +3847,18 @@ unsigned long *colormasks;
/* The core sends trailing blanks for some fields. /* The core sends trailing blanks for some fields.
Let's suppress the trailing blanks */ Let's suppress the trailing blanks */
if (tty_status[NOW][fldidx].lth > 0) { if (tty_status[NOW][fldidx].lth > 0) {
lastchar = eos(status_vals[fldidx]); p = eos(status_vals[fldidx]);
lastchar--; for (lastchar = eos(p); lastchar > p && *--lastchar == ' '; ) {
while (lastchar >= status_vals[fldidx] && *lastchar == ' ') { *lastchar = '\0';
*lastchar-- = '\0';
tty_status[NOW][fldidx].lth--; tty_status[NOW][fldidx].lth--;
} }
} }
break; break;
case BL_TITLE: case BL_TITLE:
/* when hitpointbar is enabled, rendering will enforce a length
of 30 on title, padding with spaces or truncating if necessary */
if (iflags.wc2_hitpointbar) if (iflags.wc2_hitpointbar)
tty_status[NOW][fldidx].lth += 2; /* '[' and ']' */ tty_status[NOW][fldidx].lth = 30 + 2; /* '[' and ']' */
break; break;
case BL_GOLD: case BL_GOLD:
/* \GXXXXNNNN counts as 1 */ /* \GXXXXNNNN counts as 1 */
@@ -4371,54 +4369,50 @@ render_status(VOID_ARGS)
* +-------------------------+ * +-------------------------+
*/ */
/* hitpointbar using hp percent calculation */ /* hitpointbar using hp percent calculation */
int bar_pos, bar_len; int bar_len, bar_pos = 0;
char *bar2 = (char *)0; char bar[MAXCO], *bar2 = (char *) 0, savedch = '\0';
char bar[MAXCO], savedch = 0; boolean twoparts = (hpbar_percent < 100);
boolean twoparts = FALSE;
bar_len = strlen(text); /* force exactly 30 characters, padded with spaces
if (bar_len < MAXCO-1) { if shorter or truncated if longer */
if (strlen(text) != 30) {
Sprintf(bar, "%-30.30s", text);
Strcpy(status_vals[BL_TITLE], bar);
} else
Strcpy(bar, text); Strcpy(bar, text);
bar_len = (int) strlen(bar); /* always 30 */
/* when at full HP, the whole title will be highlighted;
when injured or dead, there will be a second portion
which is not highlighted */
if (twoparts) {
/* figure out where to separate the two parts */
bar_pos = (bar_len * hpbar_percent) / 100; bar_pos = (bar_len * hpbar_percent) / 100;
if (bar_pos < 1 && hpbar_percent > 0) if (bar_pos < 1 && hpbar_percent > 0)
bar_pos = 1; bar_pos = 1;
if (bar_pos >= bar_len && hpbar_percent < 100) if (bar_pos >= bar_len && hpbar_percent < 100)
bar_pos = bar_len - 1; bar_pos = bar_len - 1;
if (bar_pos > 0 && bar_pos < bar_len) { bar2 = &bar[bar_pos];
twoparts = TRUE; savedch = *bar2;
bar2 = &bar[bar_pos]; *bar2 = '\0';
savedch = *bar2;
*bar2 = '\0';
}
} }
if (iflags.hilite_delta) { tty_putstatusfield(nullfield, "[", x++, y);
char *s = bar; if (*bar) { /* always True, unless twoparts+dead (0 HP) */
tty_putstatusfield(nullfield, "[", x++, y); term_start_attr(ATR_INVERSE);
if (hpbar_percent > 0) { if (iflags.hilite_delta && hpbar_color != NO_COLOR)
if (hpbar_color != NO_COLOR && coloridx != CLR_MAX) term_start_color(hpbar_color);
term_start_color(hpbar_color); tty_putstatusfield(nullfield, bar, x, y);
term_start_attr(ATR_INVERSE); x += (int) strlen(bar);
} if (iflags.hilite_delta && hpbar_color != NO_COLOR)
if (hpbar_percent == 0) term_end_color();
s = text; term_end_attr(ATR_INVERSE);
tty_putstatusfield(nullfield, s, x, y);
x += (int) strlen(s);
if (hpbar_percent > 0) {
term_end_attr(ATR_INVERSE);
if (hpbar_color != NO_COLOR && coloridx != CLR_MAX)
term_end_color();
}
if (twoparts && hpbar_percent > 0) {
*bar2 = savedch;
tty_putstatusfield(nullfield, bar2, x, y);
x += (int) strlen(bar2);
tty_curs(WIN_STATUS, x, y);
}
tty_putstatusfield(nullfield, "]", x++, y);
} else {
tty_putstatusfield(&tty_status[NOW][idx],
(char *) 0, x, y);
} }
if (twoparts) { /* no highlighting for second part */
*bar2 = savedch;
tty_putstatusfield(nullfield, bar2, x, y);
x += (int) strlen(bar2);
/*tty_curs(WIN_STATUS, x, y);*/
}
tty_putstatusfield(nullfield, "]", x++, y);
} else { } else {
/* /*
* +-----------------------------+ * +-----------------------------+