diff --git a/doc/fixes36.3 b/doc/fixes36.3 index e15c6b746..697e7a9d0 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.49 $ $NHDT-Date: 1560089250 2019/06/09 14:07:30 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.50 $ $NHDT-Date: 1560161804 2019/06/10 10:16:44 $ This fixes36.3 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.2 in May 2019. Please note, however, @@ -68,6 +68,11 @@ unlike watching a monster trying to swap out a cursed weapon for some other that weapon becoming welded to the monster's hand/claw/whatever accept "hidden" as an attribute for wizard mode ^G monster creation; created monsters which can't be seen will have their locations highlighted +don't give feedback for monster zapping a wand if a monster plays a fire horn + directed at self to burn away slime +if hero knows the number of charges in a wand or magical horn and a monster + acquires it and zaps/plays it when not in view, remove the hero's + memory of the number of charges Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/include/extern.h b/include/extern.h index da249c05e..97662eb76 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 extern.h $NHDT-Date: 1560085861 2019/06/09 13:11:01 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.713 $ */ +/* NetHack 3.6 extern.h $NHDT-Date: 1560161804 2019/06/10 10:16:44 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.714 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -448,6 +448,7 @@ E char *FDECL(Adjmonnam, (struct monst *, const char *)); E char *FDECL(Amonnam, (struct monst *)); E char *FDECL(a_monnam, (struct monst *)); E char *FDECL(distant_monnam, (struct monst *, int, char *)); +E char *FDECL(mon_nam_too, (struct monst *, struct monst *)); E char *FDECL(rndmonnam, (char *)); E const char *FDECL(hcolor, (const char *)); E const char *NDECL(rndcolor); diff --git a/src/do_name.c b/src/do_name.c index 0d59a32f7..7f69ce59e 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 do_name.c $NHDT-Date: 1555627306 2019/04/18 22:41:46 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.145 $ */ +/* NetHack 3.6 do_name.c $NHDT-Date: 1560161806 2019/06/10 10:16:46 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.147 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1924,6 +1924,33 @@ char *outbuf; return outbuf; } +/* returns mon_nam(mon) relative to other_mon; normal name unless they're + the same, in which case the reference is to {him|her|it} self */ +char * +mon_nam_too(mon, other_mon) +struct monst *mon, *other_mon; +{ + char *outbuf; + + if (mon != other_mon) { + outbuf = mon_nam(mon); + } else { + outbuf = nextmbuf(); + switch (pronoun_gender(mon, FALSE)) { + case 0: + Strcpy(outbuf, "himself"); + break; + case 1: + Strcpy(outbuf, "herself"); + break; + default: + Strcpy(outbuf, "itself"); + break; + } + } + return outbuf; +} + /* fake monsters used to be in a hard-coded array, now in a data file */ STATIC_OVL char * bogusmon(buf, code) diff --git a/src/mhitm.c b/src/mhitm.c index c50e25b27..4ec135520 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mhitm.c $NHDT-Date: 1555720096 2019/04/20 00:28:16 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.113 $ */ +/* NetHack 3.6 mhitm.c $NHDT-Date: 1560161806 2019/06/10 10:16:46 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.116 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -9,7 +9,6 @@ static const char brief_feeling[] = "have a %s feeling for a moment, then it passes."; -STATIC_DCL char *FDECL(mon_nam_too, (char *, struct monst *, struct monst *)); STATIC_DCL int FDECL(hitmm, (struct monst *, struct monst *, struct attack *)); STATIC_DCL int FDECL(gazemm, (struct monst *, struct monst *, @@ -29,30 +28,6 @@ STATIC_DCL int FDECL(passivemm, (struct monst *, struct monst *, BOOLEAN_P, int)); -/* returns mon_nam(mon) relative to other_mon; normal name unless they're - the same, in which case the reference is to {him|her|it} self */ -STATIC_OVL char * -mon_nam_too(outbuf, mon, other_mon) -char *outbuf; -struct monst *mon, *other_mon; -{ - if (mon != other_mon) - Strcpy(outbuf, mon_nam(mon)); - else - switch (pronoun_gender(mon, FALSE)) { - case 0: - Strcpy(outbuf, "himself"); - break; - case 1: - Strcpy(outbuf, "herself"); - break; - default: - Strcpy(outbuf, "itself"); - break; - } - return outbuf; -} - STATIC_OVL void noises(magr, mattk) register struct monst *magr; @@ -76,7 +51,7 @@ register struct monst *magr, *mdef; struct attack *mattk; { const char *fmt; - char buf[BUFSZ], mdef_name[BUFSZ]; + char buf[BUFSZ]; if (g.vis) { if (!canspotmon(magr)) @@ -91,7 +66,7 @@ struct attack *mattk; ? "%s pretends to be friendly to" : "%s misses"; Sprintf(buf, fmt, Monnam(magr)); - pline("%s %s.", buf, mon_nam_too(mdef_name, mdef, magr)); + pline("%s %s.", buf, mon_nam_too(mdef, magr)); } else noises(magr, mattk); } @@ -528,7 +503,7 @@ struct attack *mattk; { if (g.vis) { int compat; - char buf[BUFSZ], mdef_name[BUFSZ]; + char buf[BUFSZ]; if (!canspotmon(magr)) map_invisible(magr->mx, magr->my); @@ -572,7 +547,7 @@ struct attack *mattk; default: Sprintf(buf, "%s hits", magr_name); } - pline("%s %s.", buf, mon_nam_too(mdef_name, mdef, magr)); + pline("%s %s.", buf, mon_nam_too(mdef, magr)); } } else noises(magr, mattk); diff --git a/src/muse.c b/src/muse.c index 9bf71d8d1..d1ee5472a 100644 --- a/src/muse.c +++ b/src/muse.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 muse.c $NHDT-Date: 1547025167 2019/01/09 09:12:47 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.92 $ */ +/* NetHack 3.6 muse.c $NHDT-Date: 1560161807 2019/06/10 10:16:47 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.96 $ */ /* Copyright (C) 1990 by Ken Arromdee */ /* NetHack may be freely redistributed. See license for details. */ @@ -16,7 +16,8 @@ STATIC_DCL struct permonst *FDECL(muse_newcham_mon, (struct monst *)); STATIC_DCL int FDECL(precheck, (struct monst *, struct obj *)); -STATIC_DCL void FDECL(mzapmsg, (struct monst *, struct obj *, BOOLEAN_P)); +STATIC_DCL void FDECL(mzapwand, (struct monst *, struct obj *, BOOLEAN_P)); +STATIC_DCL void FDECL(mplayhorn, (struct monst *, struct obj *, BOOLEAN_P)); STATIC_DCL void FDECL(mreadmsg, (struct monst *, struct obj *)); STATIC_DCL void FDECL(mquaffmsg, (struct monst *, struct obj *)); STATIC_DCL boolean FDECL(m_use_healing, (struct monst *)); @@ -124,7 +125,7 @@ struct obj *obj; pline("%s zaps %s, which suddenly explodes!", Monnam(mon), an(xname(obj))); } else { - /* same near/far threshold as mzapmsg() */ + /* same near/far threshold as mzapwand() */ int range = couldsee(mon->mx, mon->my) /* 9 or 5 */ ? (BOLT_LIM + 1) : (BOLT_LIM - 3); @@ -144,8 +145,10 @@ struct obj *obj; return 0; } +/* when a monster zaps a wand give a message, deduct a charge, and if it + isn't directly seen, remove hero's memory of the number of charges */ STATIC_OVL void -mzapmsg(mtmp, otmp, self) +mzapwand(mtmp, otmp, self) struct monst *mtmp; struct obj *otmp; boolean self; @@ -156,6 +159,7 @@ boolean self; You_hear("a %s zap.", (distu(mtmp->mx, mtmp->my) <= range * range) ? "nearby" : "distant"); + otmp->known = 0; } else if (self) { pline("%s zaps %sself with %s!", Monnam(mtmp), mhim(mtmp), doname(otmp)); @@ -163,6 +167,33 @@ boolean self; pline("%s zaps %s!", Monnam(mtmp), an(xname(otmp))); stop_occupation(); } + otmp->spe -= 1; +} + +/* similar to mzapwand() but for magical horns (only instrument mons play) */ +STATIC_OVL void +mplayhorn(mtmp, otmp, self) +struct monst *mtmp; +struct obj *otmp; +boolean self; +{ + if (!canseemon(mtmp)) { + int range = couldsee(mtmp->mx, mtmp->my) /* 9 or 5 */ + ? (BOLT_LIM + 1) : (BOLT_LIM - 3); + + You_hear("a horn being played %s.", + (distu(mtmp->mx, mtmp->my) <= range * range) + ? "nearby" : "in the distance"); + otmp->known = 0; /* hero doesn't know how many charges are left */ + } else { + otmp->dknown = 1; + pline("%s plays a %s directed at %s!", Monnam(mtmp), xname(otmp), + self ? mon_nam_too(mtmp, mtmp) : (char *) "you"); + makeknown(otmp->otyp); /* (wands handle this slightly differently) */ + if (!self) + stop_occupation(); + } + otmp->spe -= 1; /* use a charge */ } STATIC_OVL void @@ -626,8 +657,7 @@ struct monst *mtmp; if ((mtmp->isshk && inhishop(mtmp)) || mtmp->isgd || mtmp->ispriest) return 2; m_flee(mtmp); - mzapmsg(mtmp, otmp, TRUE); - otmp->spe--; + mzapwand(mtmp, otmp, TRUE); how = WAN_TELEPORTATION; mon_tele: if (tele_restrict(mtmp)) { /* mysterious force... */ @@ -649,8 +679,7 @@ struct monst *mtmp; return 2; case MUSE_WAN_TELEPORTATION: g.zap_oseen = oseen; - mzapmsg(mtmp, otmp, FALSE); - otmp->spe--; + mzapwand(mtmp, otmp, FALSE); g.m_using = TRUE; mbhit(mtmp, rn1(8, 6), mbhitm, bhito, otmp); /* monster learns that teleportation isn't useful here */ @@ -696,8 +725,7 @@ struct monst *mtmp; struct trap *ttmp; m_flee(mtmp); - mzapmsg(mtmp, otmp, FALSE); - otmp->spe--; + mzapwand(mtmp, otmp, FALSE); if (oseen) makeknown(WAN_DIGGING); if (IS_FURNITURE(levl[mtmp->mx][mtmp->my].typ) @@ -742,8 +770,7 @@ struct monst *mtmp; if (!enexto(&cc, mtmp->mx, mtmp->my, pm)) return 0; - mzapmsg(mtmp, otmp, FALSE); - otmp->spe--; + mzapwand(mtmp, otmp, FALSE); mon = makemon((struct permonst *) 0, cc.x, cc.y, NO_MM_FLAGS); if (mon && canspotmon(mon) && oseen) makeknown(WAN_CREATE_MONSTER); @@ -1376,8 +1403,7 @@ struct monst *mtmp; case MUSE_WAN_COLD: case MUSE_WAN_LIGHTNING: case MUSE_WAN_MAGIC_MISSILE: - mzapmsg(mtmp, otmp, FALSE); - otmp->spe--; + mzapwand(mtmp, otmp, FALSE); if (oseen) makeknown(otmp->otyp); g.m_using = TRUE; @@ -1388,12 +1414,7 @@ struct monst *mtmp; return (DEADMONSTER(mtmp)) ? 1 : 2; case MUSE_FIRE_HORN: case MUSE_FROST_HORN: - if (oseen) { - makeknown(otmp->otyp); - pline("%s plays a %s!", Monnam(mtmp), xname(otmp)); - } else - You_hear("a horn being played."); - otmp->spe--; + mplayhorn(mtmp, otmp, FALSE); g.m_using = TRUE; buzz(-30 - ((otmp->otyp == FROST_HORN) ? AD_COLD - 1 : AD_FIRE - 1), rn1(6, 6), mtmp->mx, mtmp->my, sgn(mtmp->mux - mtmp->mx), @@ -1403,8 +1424,7 @@ struct monst *mtmp; case MUSE_WAN_TELEPORTATION: case MUSE_WAN_STRIKING: g.zap_oseen = oseen; - mzapmsg(mtmp, otmp, FALSE); - otmp->spe--; + mzapwand(mtmp, otmp, FALSE); g.m_using = TRUE; mbhit(mtmp, rn1(8, 6), mbhitm, bhito, otmp); g.m_using = FALSE; @@ -1795,8 +1815,7 @@ struct monst *mtmp; case MUSE_WAN_MAKE_INVISIBLE: case MUSE_POT_INVISIBILITY: if (otmp->otyp == WAN_MAKE_INVISIBLE) { - mzapmsg(mtmp, otmp, TRUE); - otmp->spe--; + mzapwand(mtmp, otmp, TRUE); } else mquaffmsg(mtmp, otmp); /* format monster's name before altering its visibility */ @@ -1822,8 +1841,7 @@ struct monst *mtmp; } return 2; case MUSE_WAN_SPEED_MONSTER: - mzapmsg(mtmp, otmp, TRUE); - otmp->spe--; + mzapwand(mtmp, otmp, TRUE); mon_adjust_speed(mtmp, 1, otmp); return 2; case MUSE_POT_SPEED: @@ -1836,8 +1854,7 @@ struct monst *mtmp; m_useup(mtmp, otmp); return 2; case MUSE_WAN_POLYMORPH: - mzapmsg(mtmp, otmp, TRUE); - otmp->spe--; + mzapwand(mtmp, otmp, TRUE); (void) newcham(mtmp, muse_newcham_mon(mtmp), TRUE, FALSE); if (oseen) makeknown(WAN_POLYMORPH); @@ -2470,8 +2487,7 @@ boolean by_you; /* true: if mon kills itself, hero gets credit/blame */ dmg = 0; /* damage has been applied by explode() */ } } else { /* wand/horn of fire w/ positive charge count */ - mzapmsg(mon, obj, TRUE); - obj->spe--; + mplayhorn(mon, obj, TRUE); /* -1 => monster's wand of fire; 2 => # of damage dice */ dmg = zhitm(mon, by_you ? 1 : -1, 2, &odummyp); } diff --git a/src/read.c b/src/read.c index f242d1f14..56d28e18b 100644 --- a/src/read.c +++ b/src/read.c @@ -2594,13 +2594,13 @@ struct _create_particular_data *d; or vision issues (line-of-sight, invisibility, blindness) */ if (d->hidden && !canspotmon(mtmp)) { int count = couldsee(mx, my) ? 8 : 4; - char saveviz = viz_array[my][mx]; + char saveviz = g.viz_array[my][mx]; if (!flags.sparkle) count /= 2; - viz_array[my][mx] |= (IN_SIGHT | COULD_SEE); + g.viz_array[my][mx] |= (IN_SIGHT | COULD_SEE); flash_glyph_at(mx, my, mon_to_glyph(mtmp, newsym_rn2), count); - viz_array[my][mx] = saveviz; + g.viz_array[my][mx] = saveviz; newsym(mx, my); } madeany = TRUE;