diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 9b01667ad..b63630534 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.228 $ $NHDT-Date: 1547343820 2019/01/13 01:43:40 $ +$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.229 $ $NHDT-Date: 1547421445 2019/01/13 23:17:25 $ 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, @@ -266,6 +266,8 @@ when blocking/unblocking of levitation or flying was updated due to walking if levitating hero in pass-wall creature form jumped or teleported from terrain that allowed levitation to terrain that didn't or vice versa, blocking of levitation wasn't updated properly +digging down or level teleporting while stuck in solid rock which is blocking + levitation or flight didn't notice when that should become unblocked make it easier to clear 'pickup_types' (menustyles Traditional and Combination could do so by setting it to 'a'; now ' ' works too; Full and Partial allowed unselecting every object class; now 'all classes' is a choice) diff --git a/include/extern.h b/include/extern.h index 597082b27..cf8582c20 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 extern.h $NHDT-Date: 1546687295 2019/01/05 11:21:35 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.681 $ */ +/* NetHack 3.6 extern.h $NHDT-Date: 1547486885 2019/01/14 17:28:05 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.682 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -385,6 +385,7 @@ E int NDECL(doup); #ifdef INSURANCE E void NDECL(save_currentstate); #endif +E void FDECL(u_collide_m, (struct monst *)); E void FDECL(goto_level, (d_level *, BOOLEAN_P, BOOLEAN_P, BOOLEAN_P)); E void FDECL(schedule_goto, (d_level *, BOOLEAN_P, BOOLEAN_P, int, const char *, const char *)); diff --git a/include/mextra.h b/include/mextra.h index 92fea085d..386495cc1 100644 --- a/include/mextra.h +++ b/include/mextra.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 mextra.h $NHDT-Date: 1451836000 2016/01/03 15:46:40 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.18 $ */ +/* NetHack 3.6 mextra.h $NHDT-Date: 1547428759 2019/01/14 01:19:19 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.22 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -144,16 +144,16 @@ struct emin { /*** ** formerly edog.h -- pet extension */ -/* various types of pet food, the lower, the better liked */ +/* various types of pet food, the lower the value, the better liked */ enum dogfood_types { DOGFOOD = 0, - CADAVER, - ACCFOOD, - MANFOOD, - APPORT, - POISON, - UNDEF, - TABU + CADAVER = 1, + ACCFOOD = 2, + MANFOOD = 3, + APPORT = 4, + POISON = 5, + UNDEF = 6, + TABU = 7 }; struct edog { diff --git a/include/monst.h b/include/monst.h index 47d7d88e5..2dfca95cc 100644 --- a/include/monst.h +++ b/include/monst.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 monst.h $NHDT-Date: 1461028522 2016/04/19 01:15:22 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.24 $ */ +/* NetHack 3.6 monst.h $NHDT-Date: 1547428769 2019/01/14 01:19:29 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.27 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2016. */ /* NetHack may be freely redistributed. See license for details. */ @@ -21,13 +21,13 @@ * weapon that this is impractical. --KAA */ enum wpn_chk_flags { - NO_WEAPON_WANTED = 0, - NEED_WEAPON, - NEED_RANGED_WEAPON, - NEED_HTH_WEAPON, - NEED_PICK_AXE, - NEED_AXE, - NEED_PICK_OR_AXE + NO_WEAPON_WANTED = 0, + NEED_WEAPON = 1, + NEED_RANGED_WEAPON = 2, + NEED_HTH_WEAPON = 3, + NEED_PICK_AXE = 4, + NEED_AXE = 5, + NEED_PICK_OR_AXE = 6 }; /* The following flags are used for the second argument to display_minventory @@ -42,11 +42,12 @@ enum wpn_chk_flags { #define MINV_NOLET 0x04 #define MINV_ALL 0x08 +/* monster appearance types */ enum m_ap_types { - M_AP_NOTHING = 0, /* mappearance unused--monster appears as itself */ - M_AP_FURNITURE, /* stairs, a door, an altar, etc. */ - M_AP_OBJECT, /* an object */ - M_AP_MONSTER /* a monster */ + M_AP_NOTHING = 0, /* mappearance unused--monster appears as itself */ + M_AP_FURNITURE = 1, /* stairs, a door, an altar, etc. */ + M_AP_OBJECT = 2, /* an object */ + M_AP_MONSTER = 3 /* a monster; mostly used for cloned Wizard */ }; struct monst { diff --git a/include/monsym.h b/include/monsym.h index e4b68a05a..68737fd83 100644 --- a/include/monsym.h +++ b/include/monsym.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 monsym.h $NHDT-Date: 1524689515 2018/04/25 20:51:55 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.11 $ */ +/* NetHack 3.6 monsym.h $NHDT-Date: 1547428769 2019/01/14 01:19:29 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.12 $ */ /* Copyright (c) 2016 by Pasi Kallinen */ /* NetHack may be freely redistributed. See license for details. */ /* Monster symbols and creation information rev 1.0 */ @@ -12,69 +12,69 @@ * NULL character. */ enum mon_class_types { - S_ANT = 1, - S_BLOB, - S_COCKATRICE, - S_DOG, - S_EYE, - S_FELINE, - S_GREMLIN, - S_HUMANOID, - S_IMP, - S_JELLY, - S_KOBOLD, - S_LEPRECHAUN, - S_MIMIC, - S_NYMPH, - S_ORC, - S_PIERCER, - S_QUADRUPED, - S_RODENT, - S_SPIDER, - S_TRAPPER, - S_UNICORN, - S_VORTEX, - S_WORM, - S_XAN, - S_LIGHT, - S_ZRUTY, - S_ANGEL, - S_BAT, - S_CENTAUR, - S_DRAGON, - S_ELEMENTAL, - S_FUNGUS, - S_GNOME, - S_GIANT, - S_invisible, /* non-class present in def_monsyms[] */ - S_JABBERWOCK, - S_KOP, - S_LICH, - S_MUMMY, - S_NAGA, - S_OGRE, - S_PUDDING, - S_QUANTMECH, - S_RUSTMONST, - S_SNAKE, - S_TROLL, - S_UMBER, - S_VAMPIRE, - S_WRAITH, - S_XORN, - S_YETI, - S_ZOMBIE, - S_HUMAN, - S_GHOST, - S_GOLEM, - S_DEMON, - S_EEL, - S_LIZARD, + S_ANT = 1, /* a */ + S_BLOB = 2, /* b */ + S_COCKATRICE = 3, /* c */ + S_DOG = 4, /* d */ + S_EYE = 5, /* e */ + S_FELINE = 6, /* f: cats */ + S_GREMLIN = 7, /* g */ + S_HUMANOID = 8, /* h: small humanoids: hobbit, dwarf */ + S_IMP = 9, /* i: minor demons */ + S_JELLY = 10, /* j */ + S_KOBOLD = 11, /* k */ + S_LEPRECHAUN = 12, /* l */ + S_MIMIC = 13, /* m */ + S_NYMPH = 14, /* n */ + S_ORC = 15, /* o */ + S_PIERCER = 16, /* p */ + S_QUADRUPED = 17, /* q: excludes horses */ + S_RODENT = 18, /* r */ + S_SPIDER = 19, /* s */ + S_TRAPPER = 20, /* t */ + S_UNICORN = 21, /* u: includes horses */ + S_VORTEX = 22, /* v */ + S_WORM = 23, /* w */ + S_XAN = 24, /* x */ + S_LIGHT = 25, /* y: yellow light, black light */ + S_ZRUTY = 26, /* z */ + S_ANGEL = 27, /* A */ + S_BAT = 28, /* B */ + S_CENTAUR = 29, /* C */ + S_DRAGON = 30, /* D */ + S_ELEMENTAL = 31, /* E: includes invisible stalker */ + S_FUNGUS = 32, /* F */ + S_GNOME = 33, /* G */ + S_GIANT = 34, /* H: large humanoid: giant, ettin, minotaur */ + S_invisible = 35, /* I: non-class present in def_monsyms[] */ + S_JABBERWOCK = 36, /* J */ + S_KOP = 37, /* K */ + S_LICH = 38, /* L */ + S_MUMMY = 39, /* M */ + S_NAGA = 40, /* N */ + S_OGRE = 41, /* O */ + S_PUDDING = 42, /* P */ + S_QUANTMECH = 43, /* Q */ + S_RUSTMONST = 44, /* R */ + S_SNAKE = 45, /* S */ + S_TROLL = 46, /* T */ + S_UMBER = 47, /* U: umber hulk */ + S_VAMPIRE = 48, /* V */ + S_WRAITH = 49, /* W */ + S_XORN = 50, /* X */ + S_YETI = 51, /* Y: includes owlbear, monkey */ + S_ZOMBIE = 52, /* Z */ + S_HUMAN = 53, /* @ */ + S_GHOST = 54, /* */ + S_GOLEM = 55, /* ' */ + S_DEMON = 56, /* & */ + S_EEL = 57, /* ; (fish) */ + S_LIZARD = 58, /* : (reptiles) */ - S_WORM_TAIL, - S_MIMIC_DEF, + S_WORM_TAIL = 59, /* ~ */ + S_MIMIC_DEF = 60, /* ] */ - MAXMCLASSES /* number of monster classes */ + MAXMCLASSES = 61 /* number of monster classes */ }; /* diff --git a/src/cmd.c b/src/cmd.c index a70edf459..88ee68c9e 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 cmd.c $NHDT-Date: 1546565813 2019/01/04 01:36:53 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.324 $ */ +/* NetHack 3.6 cmd.c $NHDT-Date: 1547486885 2019/01/14 17:28:05 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.327 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -781,36 +781,88 @@ wiz_identify(VOID_ARGS) return 0; } +/* #wizmakemap - discard current dungeon level and replace with a new one */ STATIC_PTR int wiz_makemap(VOID_ARGS) { - /* FIXME: doesn't handle riding */ if (wizard) { struct monst *mtmp; rm_mapseen(ledger_no(&u.uz)); - for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) + for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { + if (mtmp->isgd) { /* vault is going away; get rid of guard */ + mtmp->isgd = 0; + mongone(mtmp); + } + if (DEADMONSTER(mtmp)) + continue; if (mtmp->isshk) setpaid(mtmp); + /* TODO? + * Reduce 'born' tally for each monster about to be discarded + * by savelev(), otherwise replacing heavily populated levels + * tends to make their inhabitants become extinct. + */ + } if (Punished) { ballrelease(FALSE); unplacebc(); } - reset_utrap(FALSE); /* also done by safe_teleds() for new level */ - check_special_room(TRUE); - dmonsfree(); + /* reset lock picking unless it's for a carried container */ + maybe_reset_pick(); + /* reset interrupted digging if it was taking place on this level */ + if (on_level(&context.digging.level, &u.uz)) + (void) memset((genericptr_t) &context.digging, 0, + sizeof (struct dig_info)); + /* reset cached targets */ + iflags.travelcc.x = iflags.travelcc.y = 0; /* travel destination */ + context.polearm.hitmon = (struct monst *) 0; /* polearm target */ + /* escape from trap */ + reset_utrap(FALSE); + check_special_room(TRUE); /* room exit */ + u.ustuck = (struct monst *) 0; + u.uswallow = 0; + u.uinwater = 0; + u.uundetected = 0; /* not hidden, even if means are available */ + dmonsfree(); /* purge dead monsters from 'fmon' */ + /* keep steed and other adjacent pets after releasing them + from traps, stopping eating, &c as if hero were ascending */ + keepdogs(TRUE); /* (pets-only; normally we'd be using 'FALSE' here) */ + + /* discard current level; "saving" is used to release dynamic data */ savelev(-1, ledger_no(&u.uz), FREE_SAVE); + /* create a new level; various things like bestowing a guardian + angel on Astral or setting off alarm on Ft.Ludios are handled + by goto_level(do.c) so won't occur for replacement levels */ mklev(); + vision_reset(); g.vision_full_recalc = 1; cls(); - (void) safe_teleds(TRUE); + /* was using safe_teleds() but that doesn't honor arrival region + on levels which have such; we don't force stairs, just area */ + u_on_rndspot((u.uhave.amulet ? 1 : 0) /* 'going up' flag */ + | (In_W_tower(u.ux, u.uy, &u.uz) ? 2 : 0)); + losedogs(); + /* u_on_rndspot() might pick a spot that has a monster, or losedogs() + might pick the hero's spot (only if there isn't already a monster + there), so we might have to move hero or the co-located monster */ + if ((mtmp = m_at(u.ux, u.uy)) != 0 && mtmp != u.usteed) + u_collide_m(mtmp); + initrack(); if (Punished) { unplacebc(); placebc(); } docrt(); flush_screen(1); + deliver_splev_message(); /* level entry */ + check_special_room(FALSE); /* room entry */ +#ifdef INSURANCE + save_currentstate(); +#endif + } else { + pline(unavailcmd, "#wizmakemap"); } return 0; } diff --git a/src/dig.c b/src/dig.c index 3be476d17..681ec2bdd 100644 --- a/src/dig.c +++ b/src/dig.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 dig.c $NHDT-Date: 1544442710 2018/12/10 11:51:50 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.116 $ */ +/* NetHack 3.6 dig.c $NHDT-Date: 1547421446 2019/01/13 23:17:26 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.117 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -610,10 +610,16 @@ int ttyp; You("dig a pit in the %s.", surface_type); if (shopdoor) pay_for_damage("ruin", FALSE); - } else if (!madeby_obj && canseemon(madeby)) + } else if (!madeby_obj && canseemon(madeby)) { pline("%s digs a pit in the %s.", Monnam(madeby), surface_type); - else if (cansee(x, y) && flags.verbose) + } else if (cansee(x, y) && flags.verbose) { pline("A pit appears in the %s.", surface_type); + } + /* in case we're digging down while encased in solid rock + which is blocking levitation or flight */ + switch_terrain(); + if (Levitation || Flying) + wont_fall = TRUE; if (at_u) { if (!wont_fall) { @@ -642,6 +648,13 @@ int ttyp; pline("A hole appears in the %s.", surface_type); if (at_u) { + /* in case we're digging down while encased in solid rock + which is blocking levitation or flight */ + switch_terrain(); + if (Levitation || Flying) + wont_fall = TRUE; + + /* check for leashed pet that can't fall right now */ if (!u.ustuck && !wont_fall && !next_to_u()) { You("are jerked back by your pet!"); wont_fall = TRUE; diff --git a/src/do.c b/src/do.c index f401f51a0..461949f7d 100644 --- a/src/do.c +++ b/src/do.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 do.c $NHDT-Date: 1547086513 2019/01/10 02:15:13 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.183 $ */ +/* NetHack 3.6 do.c $NHDT-Date: 1547486886 2019/01/14 17:28:06 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.184 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1150,6 +1150,39 @@ register xchar x, y; } */ +/* extracted from goto_level(); also used by wiz_makemap() */ +void +u_collide_m(mtmp) +struct monst *mtmp; +{ + coord cc; + + if (!mtmp || mtmp->mx != u.ux || mtmp->my != u.uy) + return; + + /* There's a monster at your target destination; it might be one + which accompanied you--see mon_arrive(dogmove.c)--or perhaps + it was already here. Randomly move you to an adjacent spot + or else the monster to any nearby location. Prior to 3.3.0 + the latter was done unconditionally. */ + if (!rn2(2) && enexto(&cc, u.ux, u.uy, g.youmonst.data) + && distu(cc.x, cc.y) <= 2) + u_on_newpos(cc.x, cc.y); /*[maybe give message here?]*/ + else + mnexto(mtmp); + + if ((mtmp = m_at(u.ux, u.uy)) != 0) { + /* there was an unconditional impossible("mnearto failed") + here, but it's not impossible and we're prepared to cope + with the situation, so only say something when debugging */ + if (wizard) + pline("(monster in hero's way)"); + if (!rloc(mtmp, TRUE) || (mtmp = m_at(u.ux, u.uy)) != 0) + /* no room to move it; send it away, to return later */ + m_into_limbo(mtmp); + } +} + void goto_level(newlevel, at_stairs, falling, portal) d_level *newlevel; @@ -1438,34 +1471,13 @@ boolean at_stairs, falling, portal; */ run_timers(); + /* hero might be arriving at a spot containing a monster; + if so, move one or the other to another location */ + if ((mtmp = m_at(u.ux, u.uy)) != 0 && mtmp != u.usteed) + u_collide_m(mtmp); + initrack(); - if ((mtmp = m_at(u.ux, u.uy)) != 0 && mtmp != u.usteed) { - /* There's a monster at your target destination; it might be one - which accompanied you--see mon_arrive(dogmove.c)--or perhaps - it was already here. Randomly move you to an adjacent spot - or else the monster to any nearby location. Prior to 3.3.0 - the latter was done unconditionally. */ - coord cc; - - if (!rn2(2) && enexto(&cc, u.ux, u.uy, g.youmonst.data) - && distu(cc.x, cc.y) <= 2) - u_on_newpos(cc.x, cc.y); /*[maybe give message here?]*/ - else - mnexto(mtmp); - - if ((mtmp = m_at(u.ux, u.uy)) != 0) { - /* there was an unconditional impossible("mnearto failed") - here, but it's not impossible and we're prepared to cope - with the situation, so only say something when debugging */ - if (wizard) - pline("(monster in hero's way)"); - if (!rloc(mtmp, TRUE) || (mtmp = m_at(u.ux, u.uy)) != 0) - /* no room to move it; send it away, to return later */ - m_into_limbo(mtmp); - } - } - /* initial movement of bubbles just before vision_recalc */ if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz)) movebubbles(); diff --git a/src/dungeon.c b/src/dungeon.c index abd49a977..54143257f 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 dungeon.c $NHDT-Date: 1523308357 2018/04/09 21:12:37 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.87 $ */ +/* NetHack 3.6 dungeon.c $NHDT-Date: 1547421449 2019/01/13 23:17:29 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.90 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1197,7 +1197,7 @@ int x, y; u.ux0 = u.ux, u.uy0 = u.uy; } -/* place you on a random location */ +/* place you on a random location when arriving on a level */ void u_on_rndspot(upflag) int upflag; @@ -1225,6 +1225,9 @@ int upflag; place_lregion(g.dndest.lx, g.dndest.ly, g.dndest.hx, g.dndest.hy, g.dndest.nlx, g.dndest.nly, g.dndest.nhx, g.dndest.nhy, LR_DOWNTELE, (d_level *) 0); + + /* might have just left solid rock and unblocked levitation */ + switch_terrain(); } /* place you on the special staircase */