Accessibility: mon_movement

Adds a new boolean option, mon_movement. When hero notices monster
movement, give a message. Use with spot_monsters and accessiblemsg.
This commit is contained in:
Pasi Kallinen
2024-02-07 19:46:53 +02:00
parent e5e63b886e
commit 6b9f411a32
6 changed files with 40 additions and 2 deletions

View File

@@ -4179,6 +4179,8 @@ Default \(oq}\(cq.
." Format menu entries using TAB to separate columns (default off).
." Only applicable to some menus, and only useful to some interfaces.
." Debug mode only.
.lp mon_movement
Show a message when hero notices a monster movement (default is off).
.lp monpolycontrol
Prompt for new form whenever any monster changes shape (default off).
Debug mode only.
@@ -5947,6 +5949,9 @@ Prevent walking into water or lava.
Adds direction or location information to messages.
.lp spot_monsters
Shows a message when hero notices a monster; combine with accessiblemsg.
.lp mon_movement
Shows a message when hero notices a monster movement;
combine with spot_monsters and accessiblemsg.
.lp autodescribe
Automatically describe the terrain under the cursor when targeting.
.lp mention_walls

View File

@@ -4572,6 +4572,9 @@ Default `{\tt \verb+}+}'.
% Only applicable to some menus, and only useful to some interfaces.
% Debug mode only.
%.lp
\item[\ib{mon\verb+_+movement}]
Show a message when hero notices a monster movement (default is off).
%.lp
\item[\ib{monpolycontrol}]
Prompt for new form whenever any monster changes shape (default off).
Debug mode only.
@@ -6546,6 +6549,10 @@ Adds direction or location information to messages.
\item[\ib{spot\verb+_+monsters}]
Shows a message when hero notices a monster; combine with accessiblemsg.
%.lp
\item[\ib{mon\verb+_+movement}]
Shows a message when hero notices a monster movement;
combine with spot\verb+_+monsters and accessiblemsg.
%.lp
\item[\ib{autodescribe}]
Automatically describe the terrain under the cursor when targeting.
%.lp

View File

@@ -2470,8 +2470,9 @@ allow the ')', '[', '(', '=', '"', and '*' commands to be preceded by the 'm'
hot ground (Gehennom / Plane of Fire) often destroys dropped potions
erinyes overhaul; they now attempt to punish heroes who have violated their
alignment and get stronger with greater alignment abuse
accessibility options to tell where on map a message happened (accessiblemsg)
and to notify when a monster is spotted (spot_monsters)
accessibility options to tell where on map a message happened (accessiblemsg),
to notify when a monster is spotted (spot_monsters), and when
a monster moved (mon_movement)
Platform- and/or Interface-Specific New Features

View File

@@ -193,6 +193,7 @@ struct accessibility_data {
coord msg_loc; /* accessiblemsg: location */
boolean mon_notices; /* msg when hero notices a monster */
int mon_notices_blocked; /* temp disable mon_notices */
boolean mon_movement; /* msg when hero sees monster move */
};
/* Use notice_mon_off() / notice_mon_on() to temporarily disable

View File

@@ -460,6 +460,9 @@ static int optfn_##a(int, int, boolean, char *, char *);
NHOPTO("message types", Advanced, o_message_types, BUFSZ,
opt_in, set_in_game,
No, Yes, No, NoAlias, "edit message types")
NHOPTB(mon_movement, Advanced, 0, opt_in, set_in_game,
Off, Yes, No, No, NoAlias, &a11y.mon_movement, Term_False,
"message when hero sees monster movement")
NHOPTB(monpolycontrol, Advanced, 0, opt_in, set_wizonly,
Off, Yes, No, No, NoAlias, &iflags.mon_polycontrol, Term_False,
"control monster polymorphs")

View File

@@ -7,6 +7,7 @@
#include "mfndpos.h"
#include "artifact.h"
static void msg_mon_movement(struct monst *, coordxy, coordxy) NONNULLARG1;
static void watch_on_duty(struct monst *);
static int disturb(struct monst *);
static void release_hero(struct monst *);
@@ -26,6 +27,25 @@ static boolean m_balks_at_approaching(struct monst *);
static boolean stuff_prevents_passage(struct monst *);
static int vamp_shift(struct monst *, struct permonst *, boolean);
/* a11y: give a message when monster moved */
static void
msg_mon_movement(struct monst *mtmp, coordxy omx, coordxy omy)
{
if (a11y.mon_movement && canspotmon(mtmp) && mtmp->mspotted) {
coordxy nix = mtmp->mx, niy = mtmp->my;
boolean n2u = next2u(nix, niy),
close = !n2u && (distu(nix, niy) <= (BOLT_LIM * BOLT_LIM)),
closer = !n2u && (distu(nix, niy) <= distu(omx, omy));
pline_xy(nix, niy, "%s %s%s.", Monnam(mtmp),
vtense((char *) 0, locomotion(mtmp->data, "move")),
n2u ? " next to you"
: (close && closer) ? " closer"
: (close && !closer) ? " further away"
: " in the distance");
}
}
/* monster has triggered trapped door lock or was present when it got
triggered remotely (at door spot, door hit by zap);
returns True if mtmp dies */
@@ -1870,6 +1890,7 @@ m_move(register struct monst *mtmp, int after)
place_monster() only manipulate the head; they leave tail as-is */
remove_monster(omx, omy);
place_monster(mtmp, nix, niy);
msg_mon_movement(mtmp, omx, omy);
/* for a long worm, insert a new segment to reconnect the head
with the tail; worm_move() keeps the end of the tail if worm
is scheduled to grow, removes that for move-without-growing */