more monster/door interaction
Apply visibility fixups for monsters triggering door trap explosions or digging through doors similar to the monster-opens- door-handling from a couple of days. Again, the issue is that hero/player can see a closed door in situations where they can't see an open one, and messages about the door being opened or destroyed need to take that into account when seeing a closed door go away. Not as thoroughly tested as monster just opening closed door.
This commit is contained in:
@@ -1491,7 +1491,7 @@ extern boolean olfaction(struct permonst *);
|
||||
/* ### monmove.c ### */
|
||||
|
||||
extern boolean itsstuck(struct monst *);
|
||||
extern boolean mb_trapped(struct monst *);
|
||||
extern boolean mb_trapped(struct monst *, boolean);
|
||||
extern boolean monhaskey(struct monst *, boolean);
|
||||
extern void mon_regen(struct monst *, boolean);
|
||||
extern int dochugw(struct monst *);
|
||||
|
||||
20
src/dig.c
20
src/dig.c
@@ -1254,6 +1254,7 @@ boolean
|
||||
mdig_tunnel(struct monst *mtmp)
|
||||
{
|
||||
register struct rm *here;
|
||||
boolean sawit, seeit, trapped;
|
||||
int pile = rnd(12);
|
||||
|
||||
here = &levl[mtmp->mx][mtmp->my];
|
||||
@@ -1264,19 +1265,24 @@ mdig_tunnel(struct monst *mtmp)
|
||||
if (closed_door(mtmp->mx, mtmp->my)) {
|
||||
if (*in_rooms(mtmp->mx, mtmp->my, SHOPBASE))
|
||||
add_damage(mtmp->mx, mtmp->my, 0L);
|
||||
/* sawit: closed door location is more visible than an open one */
|
||||
sawit = canseemon(mtmp); /* before door state change and unblock_pt */
|
||||
trapped = (here->doormask & D_TRAPPED) ? TRUE : FALSE;
|
||||
here->doormask = trapped ? D_NODOOR : D_BROKEN;
|
||||
unblock_point(mtmp->mx, mtmp->my); /* vision */
|
||||
if (here->doormask & D_TRAPPED) {
|
||||
here->doormask = D_NODOOR;
|
||||
if (mb_trapped(mtmp)) { /* mtmp is killed */
|
||||
newsym(mtmp->mx, mtmp->my);
|
||||
if (trapped) {
|
||||
seeit = canseemon(mtmp);
|
||||
if (mb_trapped(mtmp, sawit || seeit)) { /* mtmp is killed */
|
||||
newsym(mtmp->mx, mtmp->my);
|
||||
return TRUE;
|
||||
}
|
||||
} else {
|
||||
if (!rn2(3) && flags.verbose) /* not too often.. */
|
||||
draft_message(TRUE); /* "You feel an unexpected draft." */
|
||||
here->doormask = D_BROKEN;
|
||||
if (flags.verbose) {
|
||||
if (!Unaware && !rn2(3)) /* not too often.. */
|
||||
draft_message(TRUE); /* "You feel an unexpected draft." */
|
||||
}
|
||||
}
|
||||
newsym(mtmp->mx, mtmp->my);
|
||||
return FALSE;
|
||||
} else if (here->typ == SCORR) {
|
||||
here->typ = CORR, here->flags = 0;
|
||||
|
||||
40
src/lock.c
40
src/lock.c
@@ -1092,30 +1092,44 @@ doorlock(struct obj *otmp, int x, int y)
|
||||
case WAN_STRIKING:
|
||||
case SPE_FORCE_BOLT:
|
||||
if (door->doormask & (D_LOCKED | D_CLOSED)) {
|
||||
/* sawit: closed door location is more visible than open */
|
||||
boolean sawit, seeit;
|
||||
|
||||
if (door->doormask & D_TRAPPED) {
|
||||
if (MON_AT(x, y))
|
||||
(void) mb_trapped(m_at(x, y));
|
||||
else if (flags.verbose) {
|
||||
if (cansee(x, y))
|
||||
pline("KABOOM!! You see a door explode.");
|
||||
else
|
||||
You_hear("a distant explosion.");
|
||||
}
|
||||
struct monst *mtmp = m_at(x, y);
|
||||
|
||||
sawit = mtmp ? canseemon(mtmp) : cansee(x, y);
|
||||
door->doormask = D_NODOOR;
|
||||
unblock_point(x, y);
|
||||
newsym(x, y);
|
||||
loudness = 40;
|
||||
seeit = mtmp ? canseemon(mtmp) : cansee(x, y);
|
||||
if (mtmp) {
|
||||
(void) mb_trapped(mtmp, sawit || seeit);
|
||||
} else {
|
||||
/* for mtmp, mb_trapped() does is own wake_nearto() */
|
||||
loudness = 40;
|
||||
if (flags.verbose) {
|
||||
if ((sawit || seeit) && !Unaware)
|
||||
pline("KABOOM!! You see a door explode.");
|
||||
else if (!Deaf)
|
||||
You_hear("a %s explosion.",
|
||||
(distu(x, y) > 7 * 7) ? "distant"
|
||||
: "nearby");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
sawit = cansee(x, y);
|
||||
door->doormask = D_BROKEN;
|
||||
unblock_point(x, y);
|
||||
seeit = cansee(x, y);
|
||||
newsym(x, y);
|
||||
if (flags.verbose) {
|
||||
if (cansee(x, y))
|
||||
if ((sawit || seeit) && !Unaware)
|
||||
pline_The("door crashes open!");
|
||||
else
|
||||
else if (!Deaf)
|
||||
You_hear("a crashing sound.");
|
||||
}
|
||||
unblock_point(x, y);
|
||||
newsym(x, y);
|
||||
/* force vision recalc before printing more messages */
|
||||
if (g.vision_full_recalc)
|
||||
vision_recalc(0);
|
||||
|
||||
@@ -18,23 +18,24 @@ static int vamp_shift(struct monst *, struct permonst *, boolean);
|
||||
|
||||
/* True if mtmp died */
|
||||
boolean
|
||||
mb_trapped(struct monst* mtmp)
|
||||
mb_trapped(struct monst *mtmp, boolean canseeit)
|
||||
{
|
||||
if (flags.verbose) {
|
||||
if (cansee(mtmp->mx, mtmp->my) && !Unaware)
|
||||
if (canseeit && !Unaware)
|
||||
pline("KABOOM!! You see a door explode.");
|
||||
else if (!Deaf)
|
||||
You_hear("a distant explosion.");
|
||||
You_hear("a %s explosion.",
|
||||
(distu(mtmp->mx, mtmp->my) > 7 * 7) ? "distant"
|
||||
: "nearby");
|
||||
}
|
||||
wake_nearto(mtmp->mx, mtmp->my, 7 * 7);
|
||||
mtmp->mstun = 1;
|
||||
mtmp->mhp -= rnd(15);
|
||||
if (DEADMONSTER(mtmp)) {
|
||||
mondied(mtmp);
|
||||
if (!DEADMONSTER(mtmp)) /* lifesaved */
|
||||
return FALSE;
|
||||
else
|
||||
if (DEADMONSTER(mtmp))
|
||||
return TRUE;
|
||||
/* will get here if lifesaved */
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1401,7 +1402,7 @@ m_move(register struct monst* mtmp, register int after)
|
||||
|
||||
UnblockDoor(here, mtmp, !btrapped ? D_ISOPEN : D_NODOOR);
|
||||
if (btrapped) {
|
||||
if (mb_trapped(mtmp))
|
||||
if (mb_trapped(mtmp, canseeit))
|
||||
return 2;
|
||||
} else {
|
||||
if (flags.verbose) {
|
||||
@@ -1417,7 +1418,7 @@ m_move(register struct monst* mtmp, register int after)
|
||||
} else if (here->doormask == D_CLOSED && can_open) {
|
||||
UnblockDoor(here, mtmp, !btrapped ? D_ISOPEN : D_NODOOR);
|
||||
if (btrapped) {
|
||||
if (mb_trapped(mtmp))
|
||||
if (mb_trapped(mtmp, canseeit))
|
||||
return 2;
|
||||
} else {
|
||||
if (flags.verbose) {
|
||||
@@ -1438,7 +1439,7 @@ m_move(register struct monst* mtmp, register int after)
|
||||
: D_BROKEN);
|
||||
UnblockDoor(here, mtmp, mask);
|
||||
if (btrapped) {
|
||||
if (mb_trapped(mtmp))
|
||||
if (mb_trapped(mtmp, canseeit))
|
||||
return 2;
|
||||
} else {
|
||||
if (flags.verbose) {
|
||||
|
||||
Reference in New Issue
Block a user