Add Auto open doors -patch

This commit is contained in:
Pasi Kallinen
2015-04-13 21:11:44 +03:00
parent 1dd43be266
commit 879f6d55c2
11 changed files with 34 additions and 7 deletions
+1
View File
@@ -3,6 +3,7 @@ Boolean options not under specific compile flags (with default values in []):
option setting, which is reached via the 'O' cmd.) option setting, which is reached via the 'O' cmd.)
autodig dig if moving and wielding digging tool [FALSE] 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] autopickup automatically pick up objects you move over [TRUE]
autoquiver when firing with an empty quiver, select some autoquiver when firing with an empty quiver, select some
suitable inventory weapon to fill the quiver [FALSE] suitable inventory weapon to fill the quiver [FALSE]
+2
View File
@@ -1905,6 +1905,8 @@ Cannot be set with the `O' command.
.lp autodig .lp autodig
Automatically dig if you are wielding a digging tool and moving into a place Automatically dig if you are wielding a digging tool and moving into a place
that can be dug (default false). that can be dug (default false).
.lp autoopen
Walking into a door attempts to open it (default true).
.lp "autopickup " .lp "autopickup "
Automatically pick up things onto which you move (default on). Automatically pick up things onto which you move (default on).
See See
+3
View File
@@ -2306,6 +2306,9 @@ Cannot be set with the `{\tt O}' command.
Automatically dig if you are wielding a digging tool and moving into a place Automatically dig if you are wielding a digging tool and moving into a place
that can be dug (default false). that can be dug (default false).
%.lp %.lp
\item[\ib{autoopen}]
Walking into a door attempts to open it (default true).
%.lp
\item[\ib{autopickup}] \item[\ib{autopickup}]
Automatically pick up things onto which you move (default on). Automatically pick up things onto which you move (default on).
See ``{\it pickup\_types\/}'' to refine the behavior. See ``{\it pickup\_types\/}'' to refine the behavior.
+1
View File
@@ -1165,6 +1165,7 @@ Aardvark Joe's Extended Logfile
Michael Deutschmann's use_darkgray Michael Deutschmann's use_darkgray
Clive Crous' dark_room Clive Crous' dark_room
sortloot by Jeroen Demeyer and Jukka Lahtinen sortloot by Jeroen Demeyer and Jukka Lahtinen
Auto open doors by Stefano Busti
Code Cleanup and Reorganization Code Cleanup and Reorganization
+1
View File
@@ -110,6 +110,7 @@ struct context_info {
boolean bypasses; /* bypass flag is set on at least one fobj */ boolean bypasses; /* bypass flag is set on at least one fobj */
boolean botl; /* partially redo status line */ boolean botl; /* partially redo status line */
boolean botlx; /* print an entirely new bottom line */ boolean botlx; /* print an entirely new bottom line */
boolean door_opened; /* set to true if door was opened during test_move */
struct dig_info digging; struct dig_info digging;
struct victual_info victual; struct victual_info victual;
struct tin_info tin; struct tin_info tin;
+1
View File
@@ -980,6 +980,7 @@ E int NDECL(doforce);
E boolean FDECL(boxlock, (struct obj *,struct obj *)); E boolean FDECL(boxlock, (struct obj *,struct obj *));
E boolean FDECL(doorlock, (struct obj *,int,int)); E boolean FDECL(doorlock, (struct obj *,int,int));
E int NDECL(doopen); E int NDECL(doopen);
E int FDECL(doopen_indir, (int,int));
E int NDECL(doclose); E int NDECL(doclose);
#ifdef MAC #ifdef MAC
+1
View File
@@ -19,6 +19,7 @@ struct flag {
boolean acoustics; /* allow dungeon sound messages */ boolean acoustics; /* allow dungeon sound messages */
boolean autodig; /* MRKR: Automatically dig */ boolean autodig; /* MRKR: Automatically dig */
boolean autoquiver; /* Automatically fill quiver */ boolean autoquiver; /* Automatically fill quiver */
boolean autoopen; /* open doors by walking into them */
boolean beginner; boolean beginner;
boolean biff; /* enable checking for mail */ boolean biff; /* enable checking for mail */
boolean bones; /* allow saving/loading bones */ boolean bones; /* allow saving/loading bones */
+1 -1
View File
@@ -14,7 +14,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones * Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files. * and save files.
*/ */
#define EDITLEVEL 60 #define EDITLEVEL 61
#define COPYRIGHT_BANNER_A \ #define COPYRIGHT_BANNER_A \
"NetHack, Copyright 1985-2015" "NetHack, Copyright 1985-2015"
+10 -5
View File
@@ -627,6 +627,7 @@ int mode;
register struct rm *tmpr = &levl[x][y]; register struct rm *tmpr = &levl[x][y];
register struct rm *ust; register struct rm *ust;
context.door_opened = FALSE;
/* /*
* Check for physical obstacles. First, the place we are going. * Check for physical obstacles. First, the place we are going.
*/ */
@@ -680,8 +681,10 @@ int mode;
if (mode == DO_MOVE) { if (mode == DO_MOVE) {
if (amorphous(youmonst.data)) if (amorphous(youmonst.data))
You("try to ooze under the door, but can't squeeze your possessions through."); You("try to ooze under the door, but can't squeeze your possessions through.");
else if (x == ux || y == uy) { if (flags.autoopen && !context.run && !Confusion && !Stunned && !Fumbling) {
if (Blind || Stunned || ACURR(A_DEX) < 10 || Fumbling) { context.door_opened = context.move = doopen_indir(x, y);
} else if (x == ux || y == uy) {
if (Blind || Stunned || ACURR(A_DEX) < 10 || Fumbling) {
if (u.usteed) { if (u.usteed) {
You_cant("lead %s through that closed door.", You_cant("lead %s through that closed door.",
y_monnam(u.usteed)); y_monnam(u.usteed));
@@ -1405,9 +1408,11 @@ domove()
} }
if (!test_move(u.ux, u.uy, x-u.ux, y-u.uy, DO_MOVE)) { if (!test_move(u.ux, u.uy, x-u.ux, y-u.uy, DO_MOVE)) {
context.move = 0; if (!context.door_opened) {
nomul(0); context.move = 0;
return; nomul(0);
}
return;
} }
/* Move ball and chain. */ /* Move ball and chain. */
+12 -1
View File
@@ -523,6 +523,14 @@ doforce() /* try to force a chest with your weapon */
int int
doopen() /* try to open a door */ doopen() /* try to open a door */
{ {
return doopen_indir(0, 0);
}
int
doopen_indir(x, y) /* try to open a door in direction u.dx/u.dy */
int x, y;
{
coord cc; coord cc;
register struct rm *door; register struct rm *door;
struct monst *mtmp; struct monst *mtmp;
@@ -539,7 +547,10 @@ doopen() /* try to open a door */
return 0; return 0;
} }
if(!get_adjacent_loc((char *)0, (char *)0, u.ux, u.uy, &cc)) return(0); if (x > 0 && y > 0) {
cc.x = x;
cc.y = y;
} else 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); if((cc.x == u.ux) && (cc.y == u.uy)) return(0);
+1
View File
@@ -78,6 +78,7 @@ static struct Bool_Opt
{"asksavedisk", (boolean *)0, FALSE, SET_IN_FILE}, {"asksavedisk", (boolean *)0, FALSE, SET_IN_FILE},
#endif #endif
{"autodig", &flags.autodig, FALSE, SET_IN_GAME}, {"autodig", &flags.autodig, FALSE, SET_IN_GAME},
{"autoopen", &flags.autoopen, TRUE, SET_IN_GAME},
{"autopickup", &flags.pickup, TRUE, SET_IN_GAME}, {"autopickup", &flags.pickup, TRUE, SET_IN_GAME},
{"autoquiver", &flags.autoquiver, FALSE, SET_IN_GAME}, {"autoquiver", &flags.autoquiver, FALSE, SET_IN_GAME},
#if defined(MICRO) && !defined(AMIGA) #if defined(MICRO) && !defined(AMIGA)