diff --git a/dat/opthelp b/dat/opthelp index 29fcb2404..73e55ab78 100644 --- a/dat/opthelp +++ b/dat/opthelp @@ -9,6 +9,8 @@ autoopen walking into a door attempts to open it [TRUE] autopickup automatically pick up objects you move over [TRUE] autoquiver when firing with an empty quiver, select some [FALSE] suitable inventory weapon to fill the quiver +autounlock when opening a locked door or looting a locked [TRUE] + container while carrying a key, offer to use it BIOS allow the use of IBM ROM BIOS calls [FALSE] blind your character is permanently blind [FALSE] bones allow loading bones files [TRUE] diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index 0b0ecd10d..f823faf06 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -1,4 +1,4 @@ -.\" $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.345 $ $NHDT-Date: 1577050469 2019/12/22 21:34:29 $ +.\" $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.346 $ $NHDT-Date: 1578448653 2020/01/08 01:57:33 $ .\" .\" This is an excerpt from the 'roff' man page from the 'groff' package. .\" NetHack's Guidebook.mn currently does *not* adhere to these guidelines. @@ -24,7 +24,7 @@ .ds vr "NetHack 3.7 .ds f0 "\*(vr .ds f1 -.ds f2 "December 18, 2019 +.ds f2 "January 7, 2020 . .\" A note on some special characters: .\" \(lq = left double quote @@ -1607,30 +1607,75 @@ Any lit areas within your line of sight will be displayed; dark areas are only displayed if they are within one space of you. Walls and corridors remain on the map as you explore them. .pg -Secret corridors are hidden. You can find them with the \(oqs\(cq (search) -command. +Secret corridors are hidden and appear to be solid rock. +You can find them with the \(oqs\(cq (search) command when adjacent +to them. +Multiple search attempts may be needed. +When searching is successful, secret corridors become ordinary open +corridor locations. +Mapping magic reveals secret corridors, so converts them into ordinary +corridors and shows them as such. .hn 2 Doorways .pg -Doorways connect rooms and corridors. Some doorways have no doors; -you can walk right through. Others have doors in them, which may be -open, closed, or locked. To open a closed door, use the \(oqo\(cq (open) +Doorways connect rooms and corridors. +Some doorways have no doors; you can walk right through. +Others have doors in them, which may be open, closed, or locked. +To open a closed door, use the \(oqo\(cq (open) command; to close it again, use the \(oqc\(cq (close) command. -.pg -You can get through a locked door by using a tool to pick the lock -with the \(oqa\(cq (apply) command, or by kicking it open with -the \(oq\(haD\(cq (kick) command. +By default the +.op autoopen +option is enabled, so simply attempting to walk onto a closed door's +location will attempt to open it without needing \(oqo\(cq. +Opening via +.op autoopen +will not work if you are \fIconfused\fP or \fIstunned\fP or suffer from +the \fIfumbling\fP attribute. .pg Open doors cannot be entered diagonally; you must approach them -straight on, horizontally or vertically. Doorways without doors are -not restricted in this fashion. +straight on, horizontally or vertically. +Doorways without doors are +not restricted in this fashion except on one particular level +.\" the rogue level +(described by \(lq#overview\(rq as \(lqa primitive area\(rq). .pg -Doors can be useful for shutting out monsters. Most monsters cannot -open doors, although a few don't need to (for example, ghosts can walk through -doors). +Unlocking magic exists but usually won't be available early on. +You can get through a locked door without magic by first using an +unlocking tool with the \(oqa\(cq (apply) command, and then opening it. +By default the +.op autounlock +option is also enabled, so if you attempt to open (via \(oqo\(cq or +.op autoopen) +a locked door while carrying an unlocking tool, you'll be asked whether +to use it on the door's lock. +Alternatively, you can break a closed door (whether locked or not) down +by kicking it via the \(oq\(haD\(cq (kick) command. +Kicking down a door destroys it and makes a lot of noise which might +wake sleeping monsters. .pg -Secret doors are hidden. You can find them with the \(oqs\(cq (search) -command. Once found they are in all ways equivalent to normal doors. +Some closed doors are booby-trapped and will explode if an attempt is made +to open (when unlocked) or unlock (when locked) or kick down. +Like kicking, an explosion destroys the door and makes a lot of noise. +The \(lq#untrap\(rq command can be used to search a door for traps but +might take multiple attempts to find one. +When one is found, you'll be asked whether to try to disarm it. +If you accede, success will eliminate the trap but +failure will set off the trap's explosion. +(If you decline, you effectively forget that a trap was found there.) +.pg +Closed doors can be useful for shutting out monsters. +Most monsters cannot open closed doors, although a few don't need to +(for example, ghosts can walk through doors and fog clouds can flow +under them). +Some monsters who can open doors can also use unlocking tools. +And some (giants) can smash doors. +.pg +Secret doors are hidden and appear to be ordinary wall (from inside a +room) or solid rock (from outside). +You can find them with the \(oqs\(cq (search) command but it might +take multiple tries. +Once found they are in all ways equivalent to normal doors. +Mapping magic does not reveal secret doors. .hn 2 Traps (\(oq\(ha\(cq) .pg @@ -2901,11 +2946,14 @@ The option controls whether the description includes map coordinates. .lp autodig Automatically dig if you are wielding a digging tool and moving into a place -that can be dug (default false). Persistent. +that can be dug (default false). +Persistent. .lp autoopen -Walking into a door attempts to open it (default true). Persistent. +Walking into a closed door attempts to open it (default true). +Persistent. .lp "autopickup " -Automatically pick up things onto which you move (default on). Persistent. +Automatically pick up things onto which you move (default on). +Persistent. See .op pickup_types to refine the behavior. @@ -2922,6 +2970,11 @@ with the \(oqQ\(cq command instead. If no weapon is found or the option is false, the \(oqt\(cq (throw) command is executed instead. Persistent. +.lp autounlock +Walking into a locked door or looting a locked container while carrying +an unlocking tool (such as a key) will ask whether to use that tool to +unlock the door or container (default true). +Persistent. .lp blind Start the character permanently blind (default false). Persistent. diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index 48ed797a9..626eb6490 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -45,7 +45,7 @@ %.au \author{Original version - Eric S. Raymond\\ (Edited and expanded for 3.6 by Mike Stephenson and others)} -\date{December 18, 2019} +\date{January 7, 2020} \maketitle @@ -1765,36 +1765,82 @@ dark areas are only displayed if they are within one space of you. Walls and corridors remain on the map as you explore them. %.pg -Secret corridors are hidden. You can find them with the `{\tt s}' (search) -command. +Secret corridors are hidden and appear to be solid rock. +You can find them with the `{\tt s}' (search) command when adjacent +to them. +Multiple search attempts may be needed. +When searching is successful, secret corridors become ordinary open +corridor locations. +Mapping magic reveals secret corridors, so converts them into ordinary +corridors and shows them as such. %.hn 2 \subsection*{Doorways} %.pg -Doorways connect rooms and corridors. Some doorways have no doors; -you can walk right through. Others have doors in them, which may be -open, closed, or locked. To open a closed door, use the `{\tt o}' (open) +Doorways connect rooms and corridors. +Some doorways have no doors; you can walk right through. +Others have doors in them, which may be open, closed, or locked. +To open a closed door, use the `{\tt o}' (open) command; to close it again, use the `{\tt c}' (close) command. - -%.pg -You can get through a locked door by using a tool to pick the lock -with the `{\tt a}' (apply) command, or by kicking it open with the -`{\tt \^{}D}' (kick) command. +By default the +{\it autoopen} +option is enabled, so simply attempting to walk onto a closed door's +location will attempt to open it without needing `{\tt o}'. +Opening via +{\it autoopen} +will not work if you are {\it confused\/} or {\it stunned\/} or suffer from +the {\it fumbling\/} attribute. %.pg Open doors cannot be entered diagonally; you must approach them -straight on, horizontally or vertically. Doorways without doors are -not restricted in this fashion. +straight on, horizontally or vertically. +Doorways without doors are +not restricted in this fashion except on one particular level +%.\" the rogue level +(described by ``{\tt \#overview}'' as ``a primitive area''). %.pg -Doors can be useful for shutting out monsters. Most monsters cannot -open doors, although a few don't need to (for example, ghosts can walk through -doors). +Unlocking magic exists but usually won't be available early on. +You can get through a locked door without magic by first using an +unlocking tool with the `{\tt a}' (apply) command, and then opening it. +By default the +{\it autounlock} +option is also enabled, so if you attempt to open (via `{\tt o}' or +{\it autoopen}) +a locked door while carrying an unlocking tool, you'll be asked whether +to use it on the door's lock. +Alternatively, you can break a closed door (whether locked or not) down +by kicking it via the ``{\tt \^{}D}'' (kick) command. +Kicking down a door destroys it and makes a lot of noise which might +wake sleeping monsters. %.pg -Secret doors are hidden. You can find them with the `{\tt s}' (search) -command. Once found they are in all ways equivalent to normal doors. +Some closed doors are booby-trapped and will explode if an attempt is made +to open (when unlocked) or unlock (when locked) or kick down. +Like kicking, an explosion destroys the door and makes a lot of noise. +The ``{\tt \#untrap}'' command can be used to search a door for traps but +might take multiple attempts to find one. +When one is found, you'll be asked whether to try to disarm it. +If you accede, success will eliminate the trap but +failure will set off the trap's explosion. +(If you decline, you effectively forget that a trap was found there.) + +%.pg +Closed doors can be useful for shutting out monsters. +Most monsters cannot open closed doors, although a few don't need to +(for example, ghosts can walk through doors and fog clouds can flow +under them). +Some monsters who can open doors can also use unlocking tools. +And some (giants) can smash doors. + +%.pg +Secret doors are hidden and appear to be ordinary wall (from inside a +room) or solid rock (from outside). +You can find them with the `{\tt s}' (search) command but it might +take multiple tries. +Once found they are in all ways equivalent to normal doors. +Mapping magic does not reveal secret doors. %.hn 2 \subsection*{Traps (`{\tt \^{}}')} @@ -3187,7 +3233,8 @@ Automatically dig if you are wielding a digging tool and moving into a place that can be dug (default false). Persistent. %.lp \item[\ib{autoopen}] -Walking into a door attempts to open it (default true). Persistent. +Walking into a closed door attempts to open it (default true). +Persistent. %.lp \item[\ib{autopickup}] Automatically pick up things onto which you move (default on). Persistent. @@ -3206,6 +3253,12 @@ with the `Q' command instead. If no weapon is found or the option is false, the `t' (throw) command is executed instead. Persistent. %.lp +\item[\ib{autounlock}] +Walking into a locked door or looting a locked container while carrying +an unlocking tool (such as a key) will ask whether to use that tool to +unlock the door or container (default true). +Persistent. +%.lp \item[\ib{blind}] Start the character permanently blind (default false). Persistent. %.lp diff --git a/src/allmain.c b/src/allmain.c index 678ff117d..5998e38b8 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 allmain.c $NHDT-Date: 1577050218 2019/12/22 21:30:18 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.136 $ */ +/* NetHack 3.6 allmain.c $NHDT-Date: 1578448653 2020/01/08 01:57:33 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.137 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -85,7 +85,7 @@ boolean resuming; initrack(); u.uz0.dlevel = u.uz.dlevel; - g.youmonst.movement = NORMAL_SPEED; /* give the hero some movement points */ + g.youmonst.movement = NORMAL_SPEED; /* give hero some movement points */ g.context.move = 0; g.program_state.in_moveloop = 1; @@ -178,7 +178,7 @@ boolean resuming; g.youmonst.movement = 0; settrack(); - g.monstermoves++; + g.monstermoves++; /* [obsolete (for a long time...)] */ g.moves++; /********************************/ @@ -468,7 +468,8 @@ boolean resuming; vision_recalc(0); /* vision! */ /* when running in non-tport mode, this gets done through domove() */ if ((!g.context.run || flags.runmode == RUN_TPORT) - && (g.multi && (!g.context.travel ? !(g.multi % 7) : !(g.moves % 7L)))) { + && (g.multi && (!g.context.travel ? !(g.multi % 7) + : !(g.moves % 7L)))) { if (flags.time && g.context.run) g.context.botl = TRUE; /* [should this be flush_screen() instead?] */ diff --git a/src/hack.c b/src/hack.c index 4d5991ffe..b80a9d362 100644 --- a/src/hack.c +++ b/src/hack.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 hack.c $NHDT-Date: 1576638500 2019/12/18 03:08:20 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.220 $ */ +/* NetHack 3.6 hack.c $NHDT-Date: 1578448654 2020/01/08 01:57:34 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.239 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -784,7 +784,8 @@ int mode; if (mode == DO_MOVE) pline("There is an obstacle there."); return FALSE; - } else if (tunnels(g.youmonst.data) && !needspick(g.youmonst.data)) { + } else if (tunnels(g.youmonst.data) + && !needspick(g.youmonst.data)) { /* Eat the door. */ if (mode == DO_MOVE && still_chewing(x, y)) return FALSE; @@ -793,10 +794,10 @@ int mode; if (amorphous(g.youmonst.data)) You( "try to ooze under the door, but can't squeeze your possessions through."); - if (flags.autoopen && !g.context.run && !Confusion - && !Stunned && !Fumbling) { - g.context.door_opened = g.context.move = - doopen_indir(x, y); + if (flags.autoopen && !g.context.run + && !Confusion && !Stunned && !Fumbling) { + g.context.door_opened + = g.context.move = doopen_indir(x, y); } else if (x == ux || y == uy) { if (Blind || Stunned || ACURR(A_DEX) < 10 || Fumbling) { @@ -807,6 +808,13 @@ int mode; pline("Ouch! You bump into a door."); exercise(A_DEX, FALSE); } + /* use current move; needed for the "ouch" case + but done for steed case too for consistency; + we haven't opened a door but we're going to + return False and without having 'door_opened' + set, 'move' would get reset by caller */ + g.context.door_opened + = g.context.move = TRUE; } else pline("That door is closed."); } @@ -1036,7 +1044,7 @@ int mode; continue; if ((!Passes_walls && !can_ooze(&g.youmonst) && closed_door(x, y)) || sobj_at(BOULDER, x, y) - || test_move(x, y, nx-x, ny-y, TEST_TRAP)) { + || test_move(x, y, nx - x, ny - y, TEST_TRAP)) { /* closed doors and boulders usually * cause a delay, so prefer another path */ if (travel[x][y] > radius - 3) {