Accessibility: Show a message when monster is spotted

Adds a new boolean option, spot_monsters.  If on, every time
the hero notices a monster which was out of sight before,
a message is given.  Combine with accessiblemsg to get the
monster location:

(3north): You see a newt.

Breaks saves and bones.
This commit is contained in:
Pasi Kallinen
2024-01-14 13:28:52 +02:00
parent 627b40fb57
commit 3160112ece
13 changed files with 119 additions and 1 deletions

View File

@@ -1074,6 +1074,8 @@ extern boolean test_move(coordxy, coordxy, coordxy, coordxy, int);
extern int wiz_debug_cmd_traveldisplay(void);
#endif
extern boolean u_rooted(void);
extern void notice_mon(struct monst *) NONNULLARG1;
extern void notice_all_mons(boolean);
extern void impact_disturbs_zombies(struct obj *, boolean) NONNULLARG1;
extern void disturb_buried_zombies(coordxy, coordxy);
extern boolean u_maybe_impaired(void);

View File

@@ -191,8 +191,20 @@ struct debug_flags {
struct accessibility_data {
boolean accessiblemsg; /* use msg_loc for plined messages */
coord msg_loc; /* accessiblemsg: location */
boolean mon_notices; /* msg when hero notices a monster */
int mon_notices_blocked; /* temp disable mon_notices */
};
/* Use notice_mon_off() / notice_mon_on() to temporarily disable
noticing the monsters in the vision code - perhaps the game
needs to output some other messages in between.
Call notice_all_mons() afterwards to catch up. */
#define notice_mon_off() do { a11y.mon_notices_blocked++; } while(0)
#define notice_mon_on() do { if (--a11y.mon_notices_blocked < 0) { \
impossible("mon_notices_blocked<0"); \
a11y.mon_notices_blocked = 0; \
} } while(0)
/*
* Stuff that really isn't option or platform related and does not
* get saved and restored. They are set and cleared during the game

View File

@@ -160,6 +160,8 @@ struct monst {
Bitfield(mtemplit, 1); /* temporarily seen; only valid during bhit() */
Bitfield(meverseen, 1); /* mon has been seen at some point */
Bitfield(mspotted, 1); /* mon is currently seen by hero */
#define MAX_NUM_WORMS 32 /* should be 2^(wormno bitfield size) */
unsigned long mstrategy; /* for monsters with mflag3: current strategy */

View File

@@ -654,6 +654,9 @@ static int optfn_##a(int, int, boolean, char *, char *);
NHOPTB(sparkle, Map, 0, opt_out, set_in_game,
On, Yes, No, No, NoAlias, &flags.sparkle, Term_False,
"display sparkly effect when resisting magic")
NHOPTB(spot_monsters, Advanced, 0, opt_in, set_in_game,
Off, Yes, No, No, NoAlias, &a11y.mon_notices, Term_False,
"message when hero spots a monster")
NHOPTB(splash_screen, Advanced, 0, opt_out, set_in_config,
On, Yes, No, No, NoAlias, &iflags.wc_splash_screen, Term_False,
(char *)0)

View File

@@ -17,7 +17,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files.
*/
#define EDITLEVEL 96
#define EDITLEVEL 97
/*
* Development status possibilities.