Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2018-12-02 10:01:27 -05:00
20 changed files with 159 additions and 154 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 artifact.c $NHDT-Date: 1509836679 2017/11/04 23:04:39 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.106 $ */
/* NetHack 3.6 artifact.c $NHDT-Date: 1543745353 2018/12/02 10:09:13 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.127 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
@@ -27,6 +27,7 @@ STATIC_DCL boolean FDECL(Mb_hit, (struct monst * magr, struct monst *mdef,
struct obj *, int *, int, BOOLEAN_P, char *));
STATIC_DCL unsigned long FDECL(abil_to_spfx, (long *));
STATIC_DCL uchar FDECL(abil_to_adtyp, (long *));
STATIC_DCL int FDECL(glow_strength, (int));
STATIC_DCL boolean FDECL(untouchable, (struct obj *, BOOLEAN_P));
STATIC_DCL int FDECL(count_surround_traps, (int, int));
@@ -1852,6 +1853,37 @@ int arti_indx;
return hcolor(colorstr);
}
/* glow verb; [0] holds the value used when blind */
static const char *glow_verbs[] = {
"quiver", "flicker", "glimmer", "gleam"
};
/* relative strength that Sting is glowing (0..3), to select verb */
STATIC_OVL int
glow_strength(count)
int count;
{
/* glow strength should also be proportional to proximity and
probably difficulty, but we don't have that information and
gathering it is more trouble than this would be worth */
return (count > 12) ? 3 : (count > 4) ? 2 : (count > 0);
}
const char *
glow_verb(count, ingsfx)
int count; /* 0 means blind rather than no applicable creatures */
boolean ingsfx;
{
static char resbuf[20];
Strcpy(resbuf, glow_verbs[glow_strength(count)]);
/* ing_suffix() will double the last consonant for all the words
we're using and none of them should have that, so bypass it */
if (ingsfx)
Strcat(resbuf, "ing");
return resbuf;
}
/* use for warning "glow" for Sting, Orcrist, and Grimtooth */
void
Sting_effects(orc_count)
@@ -1861,22 +1893,28 @@ int orc_count; /* new count (warn_obj_cnt is old count); -1 is a flag value */
&& (uwep->oartifact == ART_STING
|| uwep->oartifact == ART_ORCRIST
|| uwep->oartifact == ART_GRIMTOOTH)) {
int oldstr = glow_strength(warn_obj_cnt),
newstr = glow_strength(orc_count);
if (orc_count == -1 && warn_obj_cnt > 0) {
/* -1 means that blindness has just been toggled; give a
'continue' message that eventual 'stop' message will match */
pline("%s is %s.", bare_artifactname(uwep),
!Blind ? "glowing" : "quivering");
} else if (orc_count > 0 && warn_obj_cnt == 0) {
glow_verb(Blind ? 0 : warn_obj_cnt, TRUE));
} else if (newstr > 0 && newstr != oldstr) {
/* 'start' message */
if (!Blind)
pline("%s %s %s!", bare_artifactname(uwep),
otense(uwep, "glow"), glow_color(uwep->oartifact));
else
pline("%s quivers slightly.", bare_artifactname(uwep));
pline("%s %s %s%c", bare_artifactname(uwep),
otense(uwep, glow_verb(orc_count, FALSE)),
glow_color(uwep->oartifact),
(newstr > oldstr) ? '!' : '.');
else if (oldstr == 0) /* quivers */
pline("%s %s slightly.", bare_artifactname(uwep),
otense(uwep, glow_verb(0, FALSE)));
} else if (orc_count == 0 && warn_obj_cnt > 0) {
/* 'stop' message */
pline("%s stops %s.", bare_artifactname(uwep),
!Blind ? "glowing" : "quivering");
glow_verb(Blind ? 0 : warn_obj_cnt, TRUE));
}
}
}

View File

@@ -193,7 +193,7 @@ sanitize_name(namebuf)
char *namebuf;
{
int c;
boolean strip_8th_bit = (!strcmp(windowprocs.name, "tty")
boolean strip_8th_bit = (WINDOWPORT("tty")
&& !iflags.wc_eight_bit_input);
/* it's tempting to skip this for single-user platforms, since

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 cmd.c $NHDT-Date: 1542673290 2018/11/20 00:21:30 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.302 $ */
/* NetHack 3.6 cmd.c $NHDT-Date: 1543711385 2018/12/02 00:43:05 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.309 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
@@ -176,9 +176,6 @@ STATIC_DCL void FDECL(contained_stats, (winid, const char *, long *, long *));
STATIC_DCL void FDECL(misc_stats, (winid, long *, long *));
STATIC_PTR int NDECL(wiz_show_stats);
STATIC_DCL boolean FDECL(accept_menu_prefix, (int NDECL((*))));
#ifdef PORT_DEBUG
STATIC_DCL int NDECL(wiz_port_debug);
#endif
STATIC_PTR int NDECL(wiz_rumor_check);
STATIC_PTR int NDECL(doattributes);
@@ -1052,7 +1049,7 @@ wiz_show_wmodes(VOID_ARGS)
int x, y;
char row[COLNO + 1];
struct rm *lev;
boolean istty = !strcmp(windowprocs.name, "tty");
boolean istty = WINDOWPORT("tty");
win = create_nhwindow(NHW_TEXT);
if (istty)
@@ -3272,10 +3269,6 @@ struct ext_func_tab extcmdlist[] = {
{ ',', "pickup", "pick up things at the current location", dopickup },
{ '\0', "polyself", "polymorph self",
wiz_polyself, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
#ifdef PORT_DEBUG
{ '\0', "portdebug", "wizard port debug command",
wiz_port_debug, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
#endif
{ M('p'), "pray", "pray to the gods for help",
dopray, IFBURIED | AUTOCOMPLETE },
{ C('p'), "prevmsg", "view recent game messages",
@@ -5508,6 +5501,15 @@ parse()
alt_esc = FALSE; /* readchar() reset */
#endif
if (iflags.debug_fuzzer /* if fuzzing, override '!' and ^Z */
&& (Cmd.commands[foo & 0x0ff]
&& (Cmd.commands[foo & 0x0ff]->ef_funct == dosuspend_core
#ifdef SHELL
|| Cmd.commands[foo & 0x0ff]->ef_funct == dosh
#endif
)))
foo = Cmd.spkeys[NHKF_ESC];
if (foo == Cmd.spkeys[NHKF_ESC]) { /* esc cancels count (TH) */
clear_nhwindow(WIN_MESSAGE);
multi = last_multi = 0;
@@ -5707,58 +5709,6 @@ dotravel(VOID_ARGS)
return 0;
}
#ifdef PORT_DEBUG
#if defined(WIN32) && defined(TTY_GRAPHICS)
extern void NDECL(win32con_debug_keystrokes);
extern void NDECL(win32con_handler_info);
#endif
int
wiz_port_debug()
{
int n, k;
winid win;
anything any;
int item = 'a';
int num_menu_selections;
struct menu_selection_struct {
char *menutext;
void NDECL((*fn));
} menu_selections[] = {
#if defined(WIN32) && defined(TTY_GRAPHICS)
{ "test win32 keystrokes (tty only)", win32con_debug_keystrokes },
{ "show keystroke handler information (tty only)",
win32con_handler_info },
#endif
{ (char *) 0, (void NDECL((*))) 0 } /* array terminator */
};
num_menu_selections = SIZE(menu_selections) - 1;
if (num_menu_selections > 0) {
menu_item *pick_list;
win = create_nhwindow(NHW_MENU);
start_menu(win);
for (k = 0; k < num_menu_selections; ++k) {
any.a_int = k + 1;
add_menu(win, NO_GLYPH, &any, item++, 0, ATR_NONE,
menu_selections[k].menutext, MENU_UNSELECTED);
}
end_menu(win, "Which port debugging feature?");
n = select_menu(win, PICK_ONE, &pick_list);
destroy_nhwindow(win);
if (n > 0) {
n = pick_list[0].item.a_int - 1;
free((genericptr_t) pick_list);
/* execute the function */
(*menu_selections[n].fn)();
}
} else
pline("No port-specific debug capability defined.");
return 0;
}
#endif /*PORT_DEBUG*/
/*
* Parameter validator for generic yes/no function to prevent
* the core from sending too long a prompt string to the

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 do_wear.c $NHDT-Date: 1514072526 2017/12/23 23:42:06 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.100 $ */
/* NetHack 3.6 do_wear.c $NHDT-Date: 1543745354 2018/12/02 10:09:14 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.103 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1112,13 +1112,7 @@ register struct obj *otmp;
You("can see!");
}
if (changed) {
/* blindness has just been toggled */
if (Blind_telepat || Infravision)
see_monsters();
vision_full_recalc = 1; /* recalc vision limits */
if (!Blind)
learn_unseen_invent();
context.botl = 1;
toggle_blindness(); /* potion.c */
}
}
@@ -1157,13 +1151,7 @@ register struct obj *otmp;
}
}
if (changed) {
/* blindness has just been toggled */
if (Blind_telepat || Infravision)
see_monsters();
vision_full_recalc = 1; /* recalc vision limits */
if (!Blind)
learn_unseen_invent();
context.botl = 1;
toggle_blindness(); /* potion.c */
}
}

View File

@@ -1279,7 +1279,7 @@ boolean uncomp;
int i = 0;
int f;
#ifdef TTY_GRAPHICS
boolean istty = !strncmpi(windowprocs.name, "tty", 3);
boolean istty = WINDOWPORT("tty");
#endif
Strcpy(cfn, filename);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 objnam.c $NHDT-Date: 1543544340 2018/11/30 02:19:00 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.226 $ */
/* NetHack 3.6 objnam.c $NHDT-Date: 1543745355 2018/12/02 10:09:15 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.227 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1150,15 +1150,16 @@ unsigned doname_flags;
if (bimanual(obj))
hand_s = makeplural(hand_s);
/* note: Sting's glow message, if added, will insert text
in front of "(weapon in hand)"'s closing paren */
Sprintf(eos(bp), " (%sweapon in %s)",
(obj->otyp == AKLYS) ? "tethered " : "", hand_s);
if (warn_obj_cnt && obj == uwep && (EWarn_of_mon & W_WEP) != 0L) {
/* this used to be "(glowing <color>)" when sighted or
"(glowing)" when blind (via feeling warmth), but it
isn't a light source so describe something fainter */
if (!Blind)
Sprintf(eos(bp), " (%s aura)", glow_color(obj->oartifact));
if (!Blind) /* we know bp[] ends with ')'; overwrite that */
Sprintf(eos(bp) - 1, ", %s %s)",
glow_verb(warn_obj_cnt, TRUE),
glow_color(obj->oartifact));
}
}
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 potion.c $NHDT-Date: 1520797133 2018/03/11 19:38:53 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.144 $ */
/* NetHack 3.6 potion.c $NHDT-Date: 1543745356 2018/12/02 10:09:16 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.155 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
@@ -306,32 +306,43 @@ boolean talk;
set_itimeout(&Blinded, xtime);
if (u_could_see ^ can_see_now) { /* one or the other but not both */
context.botl = TRUE;
vision_full_recalc = 1; /* blindness just got toggled */
/* this vision recalculation used to be deferred until
moveloop(), but that made it possible for vision
irregularities to occur (cited case was force bolt
hitting adjacent potion of blindness and then a
secret door; hero was blinded by vapors but then
got the message "a door appears in the wall") */
vision_recalc(0);
if (Blind_telepat || Infravision)
see_monsters();
/* avoid either of the sequences
"Sting starts glowing", [become blind], "Sting stops quivering" or
"Sting starts quivering", [regain sight], "Sting stops glowing"
by giving "Sting is quivering" when becoming blind or
"Sting is glowing" when regaining sight so that the eventual
"stops" message matches */
if (warn_obj_cnt && uwep && (EWarn_of_mon & W_WEP) != 0L)
Sting_effects(-1);
/* update dknown flag for inventory picked up while blind */
if (can_see_now)
learn_unseen_invent();
toggle_blindness();
}
}
/* blindness has just started or just ended--caller enforces that;
called by Blindf_on(), Blindf_off(), and make_blinded() */
void
toggle_blindness()
{
boolean Stinging = (uwep && (EWarn_of_mon & W_WEP) != 0L);
/* blindness has just been toggled */
context.botl = TRUE; /* status conditions need update */
vision_full_recalc = 1; /* vision has changed */
/* this vision recalculation used to be deferred until moveloop(),
but that made it possible for vision irregularities to occur
(cited case was force bolt hitting an adjacent potion of blindness
and then a secret door; hero was blinded by vapors but then got the
message "a door appears in the wall" because wall spot was IN_SIGHT) */
vision_recalc(0);
if (Blind_telepat || Infravision || Stinging)
see_monsters(); /* also counts EWarn_of_mon monsters */
/*
* Avoid either of the sequences
* "Sting starts glowing", [become blind], "Sting stops quivering" or
* "Sting starts quivering", [regain sight], "Sting stops glowing"
* by giving "Sting is quivering" when becoming blind or
* "Sting is glowing" when regaining sight so that the eventual
* "stops" message matches the most recent "Sting is ..." one.
*/
if (Stinging)
Sting_effects(-1);
/* update dknown flag for inventory picked up while blind */
if (!Blind)
learn_unseen_invent();
}
boolean
make_hallucinated(xtime, talk, mask)
long xtime; /* nonzero if this is an attempt to turn on hallucination */

View File

@@ -828,7 +828,7 @@ register int fd;
#ifdef AMII_GRAPHICS
{
extern struct window_procs amii_procs;
if (windowprocs.win_init_nhwindows == amii_procs.win_init_nhwindows) {
if (WINDOWPORT("amii") {
extern winid WIN_BASE;
clear_nhwindow(WIN_BASE); /* hack until there's a hook for this */
}
@@ -844,7 +844,7 @@ register int fd;
curs(WIN_MAP, 1, 1);
dotcnt = 0;
dotrow = 2;
if (strncmpi("X11", windowprocs.name, 3))
if (!WINDOWPORT("X11"))
putstr(WIN_MAP, 0, "Restoring:");
#endif
restoreprocs.mread_flags = 1; /* return despite error */
@@ -859,7 +859,7 @@ register int fd;
dotrow++;
dotcnt = 0;
}
if (strncmpi("X11", windowprocs.name, 3)) {
if (!WINDOWPORT("X11")) {
putstr(WIN_MAP, 0, ".");
}
mark_synch();

View File

@@ -178,7 +178,7 @@ dosave0()
dotcnt = 0;
dotrow = 2;
curs(WIN_MAP, 1, 1);
if (strncmpi("X11", windowprocs.name, 3))
if (!WINDOWPORT("X11"))
putstr(WIN_MAP, 0, "Saving:");
#endif
#ifdef MFLOPPY
@@ -242,7 +242,7 @@ dosave0()
dotrow++;
dotcnt = 0;
}
if (strncmpi("X11", windowprocs.name, 3)) {
if (!WINDOWPORT("X11")) {
putstr(WIN_MAP, 0, ".");
}
mark_synch();

View File

@@ -1277,7 +1277,7 @@ winid win UNUSED;
STATIC_OVL void
dump_add_menu(win, glyph, identifier, ch, gch, attr, str, preselected)
winid win UNUSED;
int glyph UNUSED;
int glyph;
const anything *identifier UNUSED;
char ch;
char gch UNUSED;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 zap.c $NHDT-Date: 1542798627 2018/11/21 11:10:27 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.289 $ */
/* NetHack 3.6 zap.c $NHDT-Date: 1543744276 2018/12/02 09:51:16 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.299 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
@@ -433,7 +433,8 @@ struct obj *otmp;
dmg = spell_damage_bonus(dmg);
if (resists_drli(mtmp)) {
shieldeff(mtmp->mx, mtmp->my);
} else if (!resist(mtmp, otmp->oclass, dmg, NOTELL) && !DEADMONSTER(mtmp)) {
} else if (!resist(mtmp, otmp->oclass, dmg, NOTELL)
&& !DEADMONSTER(mtmp)) {
mtmp->mhp -= dmg;
mtmp->mhpmax -= dmg;
/* die if already level 0, regardless of hit points */
@@ -782,7 +783,7 @@ boolean by_hero;
if ((mons[montype].mlet == S_EEL && !IS_POOL(levl[x][y].typ))
|| (mons[montype].mlet == S_TROLL
&& uwep && uwep->oartifact == ART_TROLLSBANE)) {
if (by_hero && cansee(x,y))
if (by_hero && cansee(x, y))
pline("%s twitches feebly.",
upstart(corpse_xname(corpse, (const char *) 0, CXN_PFX_THE)));
return (struct monst *) 0;
@@ -1831,10 +1832,9 @@ struct obj *obj, *otmp;
* from its inventory as a result of the change.
* If the items fall to the floor, they are not
* subject to direct subsequent polymorphing
* themselves on that same zap. This makes it
* consistent with items that remain in the
* monster's inventory. They are not polymorphed
* either.
* themselves on that same zap. This makes it
* consistent with items that remain in the monster's
* inventory. They are not polymorphed either.
* UNDEAD_TURNING - When an undead creature gets killed via
* undead turning, prevent its corpse from being
* immediately revived by the same effect.