This is a slightly modified version of Stefano Busti's auto-open doors patch. The differences are: - Re-worked for use with patchable Nethack. - Updated for 3.4.1. - Auto-open doesn't happen if you're confused, stunned, or fumbling. - Added option to help and Guidebook. Bones/save compatibility: This patch doesn't affect saved games or bones files. This patch is available at http://www.argon.org/~roderick/nethack/. Roderick Schertler diff -r -X /home/roderick/.diff-exclude -uN base.patchable/dat/opthelp work.autoopen/dat/opthelp --- base.patchable/dat/opthelp 2003-02-23 09:43:16.000000000 -0500 +++ work.autoopen/dat/opthelp 2003-03-29 11:30:35.000000000 -0500 @@ -3,6 +3,7 @@ option setting, which is reached via the 'O' cmd.) autodig dig if moving and wielding digging tool [FALSE] +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 suitable inventory weapon to fill the quiver [FALSE] diff -r -X /home/roderick/.diff-exclude -uN base.patchable/doc/Guidebook.mn work.autoopen/doc/Guidebook.mn --- base.patchable/doc/Guidebook.mn 2003-02-23 09:43:18.000000000 -0500 +++ work.autoopen/doc/Guidebook.mn 2003-03-29 11:32:50.000000000 -0500 @@ -1626,6 +1626,8 @@ .lp autodig Automatically dig if you are wielding a digging tool and moving into a place that can be dug (default false). +.lp autoopen +Walking into a door attempts to open it (default true). .lp "autopickup " Automatically pick up things onto which you move (default on). .lp "autoquiver " diff -r -X /home/roderick/.diff-exclude -uN base.patchable/doc/Guidebook.tex work.autoopen/doc/Guidebook.tex --- base.patchable/doc/Guidebook.tex 2003-02-23 09:43:18.000000000 -0500 +++ work.autoopen/doc/Guidebook.tex 2003-03-29 11:32:32.000000000 -0500 @@ -2040,6 +2040,9 @@ Automatically dig if you are wielding a digging tool and moving into a place that can be dug (default false). %.lp +\item[\ib{autoopen}] +Walking into a door attempts to open it (default true). +%.lp \item[\ib{autopickup}] Automatically pick up things onto which you move (default on). %.Ip diff -r -X /home/roderick/.diff-exclude -uN base.patchable/include/config.h work.autoopen/include/config.h --- base.patchable/include/config.h 2003-03-20 16:41:57.000000000 -0500 +++ work.autoopen/include/config.h 2003-03-29 10:09:37.000000000 -0500 @@ -364,6 +364,12 @@ /* * options patch point; see $top/README.patchable */ + +#define AUTO_OPEN /* open doors by walking into them */ + +/* + * options patch point; see $top/README.patchable + */ /* * options patch point; see $top/README.patchable */ diff -r -X /home/roderick/.diff-exclude -uN base.patchable/include/flag.h work.autoopen/include/flag.h --- base.patchable/include/flag.h 2003-03-20 16:41:57.000000000 -0500 +++ work.autoopen/include/flag.h 2003-03-29 10:12:23.000000000 -0500 @@ -279,6 +279,10 @@ /* * compat instance_flags patch point; see $top/README.patchable */ + boolean autoopen; /* open doors by walking into them */ + /* + * compat instance_flags patch point; see $top/README.patchable + */ /* * compat instance_flags patch point; see $top/README.patchable */ diff -r -X /home/roderick/.diff-exclude -uN base.patchable/src/hack.c work.autoopen/src/hack.c --- base.patchable/src/hack.c 2003-02-23 09:43:27.000000000 -0500 +++ work.autoopen/src/hack.c 2003-03-29 11:26:17.000000000 -0500 @@ -594,6 +594,13 @@ if (amorphous(youmonst.data)) You("try to ooze under the door, but can't squeeze your possessions through."); else if (x == ux || y == uy) { +#ifdef AUTO_OPEN + if (iflags.autoopen && !flags.run + && !Confusion && !Stunned && !Fumbling) { + flags.move = doopen_indir(x, y); + } else + +#endif if (Blind || Stunned || ACURR(A_DEX) < 10 || Fumbling) { #ifdef STEED if (u.usteed) { diff -r -X /home/roderick/.diff-exclude -uN base.patchable/src/lock.c work.autoopen/src/lock.c --- base.patchable/src/lock.c 2003-02-23 09:43:27.000000000 -0500 +++ work.autoopen/src/lock.c 2003-03-29 11:27:54.000000000 -0500 @@ -489,6 +489,15 @@ int doopen() /* try to open a door */ { +#ifdef AUTO_OPEN + return doopen_indir(0, 0); +} + +int +doopen_indir(x, y) /* try to open a door in direction u.dx/u.dy */ + int x, y; /* if true, prompt for direction */ +{ +#endif /* AUTO_OPEN */ coord cc; register struct rm *door; struct monst *mtmp; @@ -503,6 +512,13 @@ return 0; } +#ifdef AUTO_OPEN + if (x > 0 && y > 0) { + cc.x = x; + cc.y = y; + } + else +#endif if(!get_adjacent_loc((char *)0, (char *)0, u.ux, u.uy, &cc)) return(0); if((cc.x == u.ux) && (cc.y == u.uy)) return(0); diff -r -X /home/roderick/.diff-exclude -uN base.patchable/src/options.c work.autoopen/src/options.c --- base.patchable/src/options.c 2003-03-18 20:58:07.000000000 -0500 +++ work.autoopen/src/options.c 2003-03-28 22:05:30.000000000 -0500 @@ -55,6 +55,9 @@ {"asksavedisk", (boolean *)0, FALSE, SET_IN_FILE}, #endif {"autodig", &flags.autodig, FALSE, SET_IN_GAME}, +#ifdef AUTO_OPEN + {"autoopen", &iflags.autoopen, TRUE, SET_IN_GAME}, +#endif /* AUTO_OPEN */ {"autopickup", &flags.pickup, TRUE, SET_IN_GAME}, {"autoquiver", &flags.autoquiver, FALSE, SET_IN_GAME}, #if defined(MICRO) && !defined(AMIGA) diff -r -X /home/roderick/.diff-exclude -uN base.patchable/util/makedefs.c work.autoopen/util/makedefs.c --- base.patchable/util/makedefs.c 2003-03-24 09:48:40.000000000 -0500 +++ work.autoopen/util/makedefs.c 2003-03-28 22:06:19.000000000 -0500 @@ -752,6 +752,12 @@ /* * patch list patch point; see $top/README.patchable */ +#ifdef AUTO_OPEN + "patch: auto open doors-patchable", +#endif /* AUTO_OPEN */ + /* + * patch list patch point; see $top/README.patchable + */ /* * patch list patch point; see $top/README.patchable */