Accessibility: Add location info to messages

Adds a new boolean option, accessiblemsg.  If on, some game messages
are prefixed with direction or location information, for example:

   (west): The newt bites!
   (northwest): You find a hidden door.

I added the info to the most common messages, but several are
still missing it.
This commit is contained in:
Pasi Kallinen
2024-01-01 18:19:17 +02:00
parent d86e6e9717
commit dc8d9d6cd0
18 changed files with 138 additions and 29 deletions

View File

@@ -2336,6 +2336,10 @@ extern void dumplogmsg(const char *);
extern void dumplogfreemessages(void);
#endif
extern void pline(const char *, ...) PRINTF_F(1, 2);
extern void pline_dir(int, const char *, ...) PRINTF_F(2, 3);
extern void pline_xy(coordxy, coordxy, const char *, ...) PRINTF_F(3, 4);
extern void set_msg_dir(int);
extern void set_msg_xy(coordxy, coordxy);
extern void custompline(unsigned, const char *, ...) PRINTF_F(2, 3);
extern void urgent_pline(const char *, ...) PRINTF_F(1, 2);
extern void Norep(const char *, ...) PRINTF_F(1, 2);

View File

@@ -188,6 +188,11 @@ struct debug_flags {
#endif
};
struct accessibility_data {
boolean accessiblemsg; /* use msg_loc for plined messages */
coord msg_loc; /* accessiblemsg: location */
};
/*
* Stuff that really isn't option or platform related and does not
* get saved and restored. They are set and cleared during the game
@@ -438,6 +443,7 @@ struct instance_flags {
extern NEARDATA struct flag flags;
extern NEARDATA struct instance_flags iflags;
extern NEARDATA struct accessibility_data a11y;
/* last_msg values
* Usage:

View File

@@ -135,6 +135,9 @@ static int optfn_##a(int, int, boolean, char *, char *);
"your starting alignment (lawful, neutral, or chaotic)")
/* end of special ordering; remainder of entries are in alphabetical order
*/
NHOPTB(accessiblemsg, Advanced, 0, opt_out, set_in_game,
Off, Yes, No, No, NoAlias, &a11y.accessiblemsg, Term_False,
"add location information to messages")
NHOPTB(acoustics, Advanced, 0, opt_out, set_in_game,
On, Yes, No, No, NoAlias, &flags.acoustics, Term_False,
"can your character hear anything")