Add Auto open doors -patch

This commit is contained in:
Pasi Kallinen
2015-04-13 20:49:38 +03:00
parent 1dd43be266
commit 879f6d55c2
11 changed files with 34 additions and 7 deletions

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.)
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]

View File

@@ -1905,6 +1905,8 @@ Cannot be set with the `O' command.
.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).
See

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
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).
See ``{\it pickup\_types\/}'' to refine the behavior.

View File

@@ -1165,6 +1165,7 @@ Aardvark Joe's Extended Logfile
Michael Deutschmann's use_darkgray
Clive Crous' dark_room
sortloot by Jeroen Demeyer and Jukka Lahtinen
Auto open doors by Stefano Busti
Code Cleanup and Reorganization

View File

@@ -110,6 +110,7 @@ struct context_info {
boolean bypasses; /* bypass flag is set on at least one fobj */
boolean botl; /* partially redo status 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 victual_info victual;
struct tin_info tin;

View File

@@ -980,6 +980,7 @@ E int NDECL(doforce);
E boolean FDECL(boxlock, (struct obj *,struct obj *));
E boolean FDECL(doorlock, (struct obj *,int,int));
E int NDECL(doopen);
E int FDECL(doopen_indir, (int,int));
E int NDECL(doclose);
#ifdef MAC

View File

@@ -19,6 +19,7 @@ struct flag {
boolean acoustics; /* allow dungeon sound messages */
boolean autodig; /* MRKR: Automatically dig */
boolean autoquiver; /* Automatically fill quiver */
boolean autoopen; /* open doors by walking into them */
boolean beginner;
boolean biff; /* enable checking for mail */
boolean bones; /* allow saving/loading bones */

View File

@@ -14,7 +14,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files.
*/
#define EDITLEVEL 60
#define EDITLEVEL 61
#define COPYRIGHT_BANNER_A \
"NetHack, Copyright 1985-2015"

View File

@@ -627,6 +627,7 @@ int mode;
register struct rm *tmpr = &levl[x][y];
register struct rm *ust;
context.door_opened = FALSE;
/*
* Check for physical obstacles. First, the place we are going.
*/
@@ -680,8 +681,10 @@ int mode;
if (mode == DO_MOVE) {
if (amorphous(youmonst.data))
You("try to ooze under the door, but can't squeeze your possessions through.");
else if (x == ux || y == uy) {
if (Blind || Stunned || ACURR(A_DEX) < 10 || Fumbling) {
if (flags.autoopen && !context.run && !Confusion && !Stunned && !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) {
You_cant("lead %s through that closed door.",
y_monnam(u.usteed));
@@ -1405,9 +1408,11 @@ domove()
}
if (!test_move(u.ux, u.uy, x-u.ux, y-u.uy, DO_MOVE)) {
context.move = 0;
nomul(0);
return;
if (!context.door_opened) {
context.move = 0;
nomul(0);
}
return;
}
/* Move ball and chain. */

View File

@@ -523,6 +523,14 @@ doforce() /* try to force a chest with your weapon */
int
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;
register struct rm *door;
struct monst *mtmp;
@@ -539,7 +547,10 @@ doopen() /* try to open a door */
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);

View File

@@ -78,6 +78,7 @@ static struct Bool_Opt
{"asksavedisk", (boolean *)0, FALSE, SET_IN_FILE},
#endif
{"autodig", &flags.autodig, FALSE, SET_IN_GAME},
{"autoopen", &flags.autoopen, TRUE, SET_IN_GAME},
{"autopickup", &flags.pickup, TRUE, SET_IN_GAME},
{"autoquiver", &flags.autoquiver, FALSE, SET_IN_GAME},
#if defined(MICRO) && !defined(AMIGA)