Unify stumbling on door mimic
This commit is contained in:
@@ -984,6 +984,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 boolean FDECL(stumble_on_door_mimic, (int,int));
|
||||||
E int FDECL(doopen_indir, (int,int));
|
E int FDECL(doopen_indir, (int,int));
|
||||||
E int NDECL(doclose);
|
E int NDECL(doclose);
|
||||||
|
|
||||||
|
|||||||
26
src/lock.c
26
src/lock.c
@@ -526,6 +526,22 @@ doopen() /* try to open a door */
|
|||||||
return doopen_indir(0, 0);
|
return doopen_indir(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean
|
||||||
|
stumble_on_door_mimic(x,y)
|
||||||
|
int x,y;
|
||||||
|
{
|
||||||
|
struct monst *mtmp;
|
||||||
|
if ((mtmp = m_at(x,y)) &&
|
||||||
|
mtmp->m_ap_type == M_AP_FURNITURE &&
|
||||||
|
(mtmp->mappearance == S_hcdoor ||
|
||||||
|
mtmp->mappearance == S_vcdoor) &&
|
||||||
|
!Protection_from_shape_changers) {
|
||||||
|
stumble_onto_mimic(mtmp);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
doopen_indir(x, y) /* try to open a door in direction u.dx/u.dy */
|
doopen_indir(x, y) /* try to open a door in direction u.dx/u.dy */
|
||||||
int x, y;
|
int x, y;
|
||||||
@@ -554,15 +570,7 @@ int x, y;
|
|||||||
|
|
||||||
if((cc.x == u.ux) && (cc.y == u.uy)) return(0);
|
if((cc.x == u.ux) && (cc.y == u.uy)) return(0);
|
||||||
|
|
||||||
if ((mtmp = m_at(cc.x,cc.y)) &&
|
if (stumble_on_door_mimic(cc.x, cc.y)) return 1;
|
||||||
mtmp->m_ap_type == M_AP_FURNITURE &&
|
|
||||||
(mtmp->mappearance == S_hcdoor ||
|
|
||||||
mtmp->mappearance == S_vcdoor) &&
|
|
||||||
!Protection_from_shape_changers) {
|
|
||||||
|
|
||||||
stumble_onto_mimic(mtmp);
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* when choosing a direction is impaired, use a turn
|
/* when choosing a direction is impaired, use a turn
|
||||||
regardless of whether a door is successfully targetted */
|
regardless of whether a door is successfully targetted */
|
||||||
|
|||||||
@@ -4108,14 +4108,7 @@ boolean force;
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mtmp = m_at(x,y)) &&
|
if (stumble_on_door_mimic(x,y)) return 1;
|
||||||
mtmp->m_ap_type == M_AP_FURNITURE &&
|
|
||||||
(mtmp->mappearance == S_hcdoor ||
|
|
||||||
mtmp->mappearance == S_vcdoor) &&
|
|
||||||
!Protection_from_shape_changers) {
|
|
||||||
stumble_onto_mimic(mtmp);
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
} /* deal_with_floor_trap */
|
} /* deal_with_floor_trap */
|
||||||
/* doors can be manipulated even while levitating/unskilled riding */
|
/* doors can be manipulated even while levitating/unskilled riding */
|
||||||
|
|||||||
Reference in New Issue
Block a user