Add Auto open doors -patch
This commit is contained in:
15
src/hack.c
15
src/hack.c
@@ -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. */
|
||||
|
||||
13
src/lock.c
13
src/lock.c
@@ -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);
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user