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

@@ -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)