some symbol tweaks

A few symbol-related modifications:

- fulfill a request from a blind player to allow them to
  specify a unique/recognizable character for all pets and/or
  the player in the config file for use when using a screen
  reader (S_player_override, S_pet_override). Requires sysconf
  setting ACCESSIBILITY to be set to have an effect, although
  they can still be specified in the config file.

- Config file SYMBOLS entries were not working properly on
  the rogue level. Allow ROGUESYMBOLS as well as SYMBOLS to be
  specified in the config file independently.

- When values are moved into showsyms[], the overriding SYMBOLS
  or ROGUESYMBOLS entry from the config file is used if there is
  one; if there is no overriding value for a particular symbol,
  the loaded symset value is used; if there is no symset entry
  loaded for the symbol then a default symbol is used.
This commit is contained in:
nhmall
2019-10-27 23:12:11 -04:00
parent 4f94bcaa8b
commit a399151d01
16 changed files with 306 additions and 127 deletions

View File

@@ -24,7 +24,7 @@
.ds vr "NetHack 3.6
.ds f0 "\*(vr
.ds f1
.ds f2 "October 1, 2019
.ds f2 "October 27, 2019
.
.\" A note on some special characters:
.\" \(lq = left double quote
@@ -2731,7 +2731,7 @@ See the \(lqConfiguring Message Types\(rq section.
.lp MENUCOLOR
Highlight menu lines with different colors.
See the \(lqConfiguring Menu Colors\(rq section.
.lp SYMBOLS
.lp SYMBOLS, ROGUESYMBOLS
Override one or more symbols in the symbols files.
See the \(lqModifying NetHack Symbols\(rq section.
.pg
@@ -4375,8 +4375,8 @@ Set the name of the symbol set that you want to load.
Set the name of the symbol set that you want to load for display
on the rogue level.
.pg
You can also override one or more symbols using the SYMBOLS config
file option. Symbols are specified as name:value pairs.
You can also override one or more symbols using the SYMBOLS and
ROGUESYMBOLS config file options. Symbols are specified as name:value pairs.
Note that
NetHack escape-processes the value string in conventional C fashion.
This means that \\ is a prefix to take the following character literally.
@@ -4570,6 +4570,8 @@ X S_xorn (xorn)
Y S_yeti (apelike creature)
Z S_zombie (zombie)
z S_zruty (zruty)
S_pet_override (pet override if sysconf accessibility is set)
S_player_override (player override if sysconf accessibility is set)
.\"TABLE_END Do not delete this line.
.TE
.pg
@@ -4612,7 +4614,12 @@ configuration file will cause the game to run in a manner accessible
to the blind.
After you have gained some experience with the game
and with editing files, you may want to alter settings via \fBSYMBOLS=\fP
and \fBROGUESYMBOLS=\fP
in your configuration file to better suit your preferences.
See the previous section for the special symbols S_pet_override
to force a consistent symbol for all pets and and
S_player_override to force a unique symbol for the player character
if \fBaccessibility\fP is enabled in the sysconf file.
The most crucial settings to make the game accessible are:
.pg
.lp symset:NHAccess

View File

@@ -45,7 +45,7 @@
%.au
\author{Original version - Eric S. Raymond\\
(Edited and expanded for 3.6 by Mike Stephenson and others)}
\date{October 1, 2019}
\date{October 22, 2019}
\maketitle
@@ -3000,7 +3000,7 @@ See the ``Configuring Message Types`` section.
Highlight menu lines with different colors.
See the ``Configuring Menu Colors`` section.
%.lp
\item[\bb{SYMBOLS}]
\item[\bb{SYMBOLS},\bb{ROGUESYMBOLS}]
Override one or more symbols in the symbols files.
See the ``Modifying {\it NetHack\/} Symbols'' section.
%.pg
@@ -4870,11 +4870,12 @@ Set the name of the symbol set that you want to load for display
on the rogue level.
\elist
You can also override one or more symbols using the {\it SYMBOLS\/} config
file option. Symbols are specified as {\it name:value\/} pairs. Note that
{\it NetHack\/} escape-processes the {\it value\/} string in conventional C
fashion. This means that `\verb+\+' is a prefix to take the following
character literally. Thus `\verb+\+' needs to be represented as `\verb+\\+'.
You can also override one or more symbols using the {\it SYMBOLS\/} and
{\it ROGUESYMBOLS\/} config file options. Symbols are specified as
{\it name:value\/} pairs. Note that {\it NetHack\/} escape-processes
the {\it value\/} string in conventional C fashion. This means that `\verb+\+'
is a prefix to take the following character literally. Thus `\verb+\+' needs
to be represented as `\verb+\\+'.
The special prefix
`\verb+\m+' switches on the meta bit in the symbol value, and the
`{\tt \^{}}' prefix causes the following character to be treated as a control
@@ -5060,7 +5061,9 @@ Default & Symbol Name & Description\\
\verb@X@ & S\verb+_+xorn & (xorn)\\
\verb@Y@ & S\verb+_+yeti & (apelike creature)\\
\verb@Z@ & S\verb+_+zombie & (zombie)\\
\verb@z@ & S\verb+_+zruty & (zruty)
\verb@z@ & S\verb+_+zruty & (zruty)\\
\verb@ @ & S\verb+_+pet\verb+_+override & (pet override if sysconf accessibility is set)\\
\verb@ @ & S\verb+_+player\verb+_+override & (player override if sysconf accessibility is set)
\end{longtable}%
}
@@ -5105,7 +5108,12 @@ is a symset called {\it NHAccess\/}. Selecting that symset in your
configuration file will cause the game to run in a manner accessible
to the blind. After you have gained some experience with the game
and with editing files, you may want to alter settings via {\it SYMBOLS=\/}
and {\it ROGUESYMBOLS=\/}
in your configuration file to better suit your preferences.
See the previous section for the special symbols S\verb+_+pet\verb+_+override
to force a consistent symbol for all pets and S\verb+_+player\verb+_+override
to force a unique symbol for the player character if {\it accessibility\/}
is enabled in the {\it sysconf\/} file.
The most crucial settings to make the game accessible are:
%.pg
\blist{}

View File

@@ -379,6 +379,9 @@ curses+'perm_invent': since persistent inventory is narrow, strip off "a",
curses+'curses': change the curses map display to use new symbol set 'curses'
instead of hard-coded values; it attempts to show IBMgraphics-style
map using DECgraphics characters; DECgraphics can also be used as-is
fulfill a request from a blind player to have a unique overriding SYMBOL for pets
and for the player
ROGUESYMBOLS can be overridden in config files like SYMBOLS can
NetHack Community Patches (or Variation) Included

View File

@@ -584,15 +584,19 @@ E int FDECL(def_char_to_monclass, (CHAR_P));
#if !defined(MAKEDEFS_C) && !defined(LEV_LEX_C)
E void FDECL(switch_symbols, (int));
E void FDECL(assign_graphics, (int));
E void NDECL(init_r_symbols);
E void NDECL(init_symbols);
E void NDECL(update_bouldersym);
E void NDECL(init_showsyms);
E void NDECL(init_l_symbols);
E void NDECL(init_primary_symbols);
E void NDECL(init_rogue_symbols);
E void NDECL(init_ov_primary_symbols);
E void NDECL(init_ov_rogue_symbols);
E void FDECL(clear_symsetentry, (int, BOOLEAN_P));
E void FDECL(update_l_symset, (struct symparse *, int));
E void FDECL(update_r_symset, (struct symparse *, int));
E void FDECL(update_primary_symset, (struct symparse *, int));
E void FDECL(update_rogue_symset, (struct symparse *, int));
E void FDECL(update_ov_primary_symset, (struct symparse *, int));
E void FDECL(update_ov_rogue_symset, (struct symparse *, int));
E boolean FDECL(cursed_object_at, (int, int));
E nhsym FDECL(get_othersym, (int, int));
/* ### dungeon.c ### */
@@ -1781,7 +1785,7 @@ E int FDECL(add_autopickup_exception, (const char *));
E void NDECL(free_autopickup_exceptions);
E int FDECL(load_symset, (const char *, int));
E void NDECL(free_symsets);
E boolean FDECL(parsesymbols, (char *));
E boolean FDECL(parsesymbols, (char *, int));
E struct symparse *FDECL(match_sym, (char *));
E void NDECL(set_playmode);
E int FDECL(sym_val, (const char *));

View File

@@ -266,7 +266,9 @@ struct symparse {
/* misc symbol definitions */
#define SYM_BOULDER 0
#define SYM_INVISIBLE 1
#define MAXOTHER 2
#define SYM_PET_OVERRIDE 2
#define SYM_PLAYER_OVERRIDE 3
#define MAXOTHER 4
/* linked list of symsets and their characteristics */
struct symsetentry {
@@ -306,8 +308,10 @@ extern const struct symdef defsyms[MAXPCHARS]; /* defaults */
extern const struct symdef def_warnsyms[WARNCOUNT];
extern int currentgraphics; /* from drawing.c */
extern nhsym showsyms[];
extern nhsym l_syms[];
extern nhsym r_syms[];
extern nhsym primary_syms[];
extern nhsym rogue_syms[];
extern nhsym ov_primary_syms[];
extern nhsym ov_rogue_syms[];
extern struct symsetentry symset[NUM_GRAPHICS]; /* from drawing.c */
#define SYMHANDLING(ht) (symset[currentgraphics].handling == (ht))

View File

@@ -41,6 +41,9 @@ struct sysopt {
char *greppath;
int panictrace_gdb;
int panictrace_libc;
/* enable accessibility options */
int accessibility;
};
extern struct sysopt sysopt;

View File

@@ -600,13 +600,13 @@ int class; /* an object class, 0 for all */
}
/* Special boulder symbol check - does the class symbol happen
* to match iflags.bouldersym which is a user-defined?
* to match showsyms[SYM_BOULDER + SYM_OFF_X] which is user-defined.
* If so, that means we aren't sure what they really wanted to
* detect. Rather than trump anything, show both possibilities.
* We can exclude checking the buried obj chain for boulders below.
*/
sym = class ? def_oc_syms[class].sym : 0;
if (sym && iflags.bouldersym && sym == iflags.bouldersym)
if (sym && showsyms[SYM_BOULDER + SYM_OFF_X] && sym == showsyms[SYM_BOULDER + SYM_OFF_X])
boulder = ROCK_CLASS;
if (Hallucination || (Confusion && class == SCROLL_CLASS))
@@ -1208,7 +1208,8 @@ struct obj **optr;
ret = object_detect((struct obj *) 0, class);
else if ((class = def_char_to_monclass(ch)) != MAXMCLASSES)
ret = monster_detect((struct obj *) 0, class);
else if (iflags.bouldersym && (ch == iflags.bouldersym))
else if (showsyms[SYM_BOULDER + SYM_OFF_X]
&& (ch == showsyms[SYM_BOULDER + SYM_OFF_X]))
ret = object_detect((struct obj *) 0, ROCK_CLASS);
else
switch (ch) {

View File

@@ -22,13 +22,14 @@ struct symsetentry symset[NUM_GRAPHICS];
int currentgraphics = 0;
nhsym showsyms[SYM_MAX] = DUMMY; /* symbols to be displayed */
nhsym l_syms[SYM_MAX] = DUMMY; /* loaded symbols */
nhsym r_syms[SYM_MAX] = DUMMY; /* rogue symbols */
nhsym primary_syms[SYM_MAX] = DUMMY; /* primary symbols */
nhsym rogue_syms[SYM_MAX] = DUMMY; /* rogue symbols */
nhsym ov_primary_syms[SYM_MAX] = DUMMY; /* overides via config SYMBOL */
nhsym ov_rogue_syms[SYM_MAX] = DUMMY; /* overides via config ROGUESYMBOL */
nhsym warnsyms[WARNCOUNT] = DUMMY; /* the current warning display symbols */
const char invisexplain[] = "remembered, unseen, creature",
altinvisexplain[] = "unseen creature"; /* for clairvoyance */
/* Default object class symbols. See objclass.h.
* {symbol, name, explain}
* name: used in object_detect().
@@ -306,7 +307,7 @@ char ch;
* init_symbols()
* Sets the current display symbols, the
* loadable symbols to the default NetHack
* symbols, including the r_syms rogue level
* symbols, including the rogue_syms rogue level
* symbols. This would typically be done
* immediately after execution begins. Any
* previously loaded external symbol sets are
@@ -322,8 +323,8 @@ char ch;
*
* If (arg != 0), which is the normal expected
* usage, then showsyms are taken from the
* adjustable display symbols found in l_syms.
* l_syms may have been loaded from an external
* adjustable display symbols found in primary_syms.
* primary_syms may have been loaded from an external
* symbol file by config file options or interactively
* in the Options menu.
*
@@ -333,37 +334,33 @@ char ch;
* out of other {rogue} level display modes.
*
* If arg is ROGUESET, this places the rogue level
* symbols from r_syms into showsyms.
* symbols from rogue_syms into showsyms.
*
* If arg is PRIMARY, this places the symbols
* from l_monsyms into showsyms.
*
* update_l_symset()
* Update a member of the loadable (l_*) symbol set.
* update_primary_symset()
* Update a member of the primary(primary_*) symbol set.
*
* update_r_symset()
* Update a member of the rogue (r_*) symbol set.
* update_rogue_symset()
* Update a member of the rogue (rogue_*) symbol set.
*
* update_ov_primary_symset()
* Update a member of the overrides for primary symbol set.
*
* update_ov_rogue_symset()
* Update a member of the overrides for rogue symbol set.
*
*/
void
init_symbols()
{
init_l_symbols();
init_ov_primary_symbols();
init_ov_rogue_symbols();
init_primary_symbols();
init_showsyms();
init_r_symbols();
}
void
update_bouldersym()
{
nhsym boulder = (nhsym) iflags.bouldersym;
if (!boulder)
boulder = def_oc_syms[ROCK_CLASS].sym; /* (nhsym) ROCK_SYM */
showsyms[SYM_BOULDER + SYM_OFF_X] = boulder;
l_syms[SYM_BOULDER + SYM_OFF_X] = boulder;
r_syms[SYM_BOULDER + SYM_OFF_X] = boulder;
init_rogue_symbols();
}
void
@@ -379,44 +376,78 @@ init_showsyms()
showsyms[i + SYM_OFF_M] = def_monsyms[i].sym;
for (i = 0; i < WARNCOUNT; i++)
showsyms[i + SYM_OFF_W] = def_warnsyms[i].sym;
for (i = 0; i < MAXOTHER; i++) {
if (i == SYM_BOULDER)
showsyms[i + SYM_OFF_X] = iflags.bouldersym
? iflags.bouldersym
: def_oc_syms[ROCK_CLASS].sym;
else if (i == SYM_INVISIBLE)
showsyms[i + SYM_OFF_X] = DEF_INVISIBLE;
}
for (i = 0; i < MAXOTHER; i++)
showsyms[i + SYM_OFF_X] = get_othersym(i, PRIMARY);
}
/* initialize defaults for the loadable symset */
/* initialize defaults for the overrides to the rogue symset */
void
init_l_symbols()
init_ov_rogue_symbols()
{
register int i;
for (i = 0; i < SYM_MAX; i++)
ov_rogue_syms[i] = (nhsym) 0;
}
/* initialize defaults for the overrides to the primary symset */
void
init_ov_primary_symbols()
{
register int i;
for (i = 0; i < SYM_MAX; i++)
ov_primary_syms[i] = (nhsym) 0;
}
nhsym
get_othersym(idx, which_set)
int idx, which_set;
{
nhsym sym = (nhsym) 0;
int oidx = idx + SYM_OFF_X;
if (which_set == ROGUESET)
sym = ov_rogue_syms[oidx] ? ov_rogue_syms[oidx]
: rogue_syms[oidx];
else
sym = ov_primary_syms[oidx] ? ov_primary_syms[oidx]
: primary_syms[oidx];
if (!sym) {
switch(idx) {
case SYM_BOULDER:
sym = def_oc_syms[ROCK_CLASS].sym;
break;
case SYM_INVISIBLE:
sym = DEF_INVISIBLE;
break;
}
}
return sym;
}
/* initialize defaults for the primary symset */
void
init_primary_symbols()
{
register int i;
for (i = 0; i < MAXPCHARS; i++)
l_syms[i + SYM_OFF_P] = defsyms[i].sym;
primary_syms[i + SYM_OFF_P] = defsyms[i].sym;
for (i = 0; i < MAXOCLASSES; i++)
l_syms[i + SYM_OFF_O] = def_oc_syms[i].sym;
primary_syms[i + SYM_OFF_O] = def_oc_syms[i].sym;
for (i = 0; i < MAXMCLASSES; i++)
l_syms[i + SYM_OFF_M] = def_monsyms[i].sym;
primary_syms[i + SYM_OFF_M] = def_monsyms[i].sym;
for (i = 0; i < WARNCOUNT; i++)
l_syms[i + SYM_OFF_W] = def_warnsyms[i].sym;
for (i = 0; i < MAXOTHER; i++) {
if (i == SYM_BOULDER)
l_syms[i + SYM_OFF_X] = iflags.bouldersym
? iflags.bouldersym
: def_oc_syms[ROCK_CLASS].sym;
else if (i == SYM_INVISIBLE)
l_syms[i + SYM_OFF_X] = DEF_INVISIBLE;
}
primary_syms[i + SYM_OFF_W] = def_warnsyms[i].sym;
for (i = 0; i < MAXOTHER; i++)
primary_syms[i + SYM_OFF_X] = get_othersym(i, PRIMARY);
clear_symsetentry(PRIMARY, FALSE);
}
/* initialize defaults for the rogue symset */
void
init_r_symbols()
init_rogue_symbols()
{
register int i;
@@ -424,24 +455,18 @@ init_r_symbols()
later by the roguesymbols option */
for (i = 0; i < MAXPCHARS; i++)
r_syms[i + SYM_OFF_P] = defsyms[i].sym;
r_syms[S_vodoor] = r_syms[S_hodoor] = r_syms[S_ndoor] = '+';
r_syms[S_upstair] = r_syms[S_dnstair] = '%';
rogue_syms[i + SYM_OFF_P] = defsyms[i].sym;
rogue_syms[S_vodoor] = rogue_syms[S_hodoor] = rogue_syms[S_ndoor] = '+';
rogue_syms[S_upstair] = rogue_syms[S_dnstair] = '%';
for (i = 0; i < MAXOCLASSES; i++)
r_syms[i + SYM_OFF_O] = def_r_oc_syms[i];
rogue_syms[i + SYM_OFF_O] = def_r_oc_syms[i];
for (i = 0; i < MAXMCLASSES; i++)
r_syms[i + SYM_OFF_M] = def_monsyms[i].sym;
rogue_syms[i + SYM_OFF_M] = def_monsyms[i].sym;
for (i = 0; i < WARNCOUNT; i++)
r_syms[i + SYM_OFF_W] = def_warnsyms[i].sym;
for (i = 0; i < MAXOTHER; i++) {
if (i == SYM_BOULDER)
r_syms[i + SYM_OFF_X] = iflags.bouldersym
? iflags.bouldersym
: def_oc_syms[ROCK_CLASS].sym;
else if (i == SYM_INVISIBLE)
r_syms[i + SYM_OFF_X] = DEF_INVISIBLE;
}
rogue_syms[i + SYM_OFF_W] = def_warnsyms[i].sym;
for (i = 0; i < MAXOTHER; i++)
rogue_syms[i + SYM_OFF_X] = get_othersym(i, ROGUESET);
clear_symsetentry(ROGUESET, FALSE);
/* default on Rogue level is no color
@@ -461,7 +486,8 @@ int whichset;
/* Adjust graphics display characters on Rogue levels */
for (i = 0; i < SYM_MAX; i++)
showsyms[i] = r_syms[i];
showsyms[i] = ov_rogue_syms[i] ? ov_rogue_syms[i]
: rogue_syms[i];
#if defined(MSDOS) && defined(USE_TILES)
if (iflags.grmode)
@@ -473,7 +499,8 @@ int whichset;
case PRIMARY:
default:
for (i = 0; i < SYM_MAX; i++)
showsyms[i] = l_syms[i];
showsyms[i] = ov_primary_syms[i] ? ov_primary_syms[i]
: primary_syms[i];
#if defined(MSDOS) && defined(USE_TILES)
if (iflags.grmode)
@@ -492,7 +519,8 @@ int nondefault;
if (nondefault) {
for (i = 0; i < SYM_MAX; i++)
showsyms[i] = l_syms[i];
showsyms[i] = ov_primary_syms[i] ? ov_primary_syms[i]
: primary_syms[i];
#ifdef PC9800
if (SYMHANDLING(H_IBM) && ibmgraphics_mode_callback)
(*ibmgraphics_mode_callback)();
@@ -513,25 +541,41 @@ int nondefault;
# endif
#endif
} else {
init_l_symbols();
init_primary_symbols();
init_showsyms();
}
}
void
update_l_symset(symp, val)
update_ov_primary_symset(symp, val)
struct symparse *symp;
int val;
{
l_syms[symp->idx] = val;
ov_primary_syms[symp->idx] = val;
}
void
update_r_symset(symp, val)
update_ov_rogue_symset(symp, val)
struct symparse *symp;
int val;
{
r_syms[symp->idx] = val;
ov_rogue_syms[symp->idx] = val;
}
void
update_primary_symset(symp, val)
struct symparse *symp;
int val;
{
primary_syms[symp->idx] = val;
}
void
update_rogue_symset(symp, val)
struct symparse *symp;
int val;
{
rogue_syms[symp->idx] = val;
}
void
@@ -772,6 +816,8 @@ struct symparse loadsyms[] = {
{ SYM_MON, S_MIMIC_DEF + SYM_OFF_M, "S_mimic_def" },
{ SYM_OTH, SYM_BOULDER + SYM_OFF_X, "S_boulder" },
{ SYM_OTH, SYM_INVISIBLE + SYM_OFF_X, "S_invisible" },
{ SYM_OTH, SYM_PET_OVERRIDE + SYM_OFF_X, "S_pet_override" },
{ SYM_OTH, SYM_PLAYER_OVERRIDE + SYM_OFF_X, "S_player_override" },
{ 0, 0, (const char *) 0 } /* fence post */
};

View File

@@ -2540,10 +2540,18 @@ char *origbuf;
if (sysopt.greppath)
free((genericptr_t) sysopt.greppath);
sysopt.greppath = dupstr(bufp);
} else if (src == SET_IN_SYS
&& match_varname(buf, "ACCESSIBILITY", 19)) {
n = atoi(bufp);
if (n < 0 || n > 1) {
config_error_add("Illegal value in ACCESSIBILITY (not 0,1).");
return FALSE;
}
sysopt.accessibility = n;
#endif /* SYSCF */
} else if (match_varname(buf, "BOULDER", 3)) {
(void) get_uchars(bufp, &iflags.bouldersym, TRUE, 1,
(void) get_uchars(bufp, &ov_primary_syms[SYM_BOULDER + SYM_OFF_X], TRUE, 1,
"BOULDER");
} else if (match_varname(buf, "MENUCOLOR", 9)) {
if (!add_menu_coloring(bufp))
@@ -2557,8 +2565,14 @@ char *origbuf;
(void) get_uchars(bufp, translate, FALSE, WARNCOUNT,
"WARNINGS");
assign_warnings(translate);
} else if (match_varname(buf, "ROGUESYMBOLS", 4)) {
if (!parsesymbols(bufp, ROGUESET)) {
config_error_add("Error in ROGUESYMBOLS definition '%s'", bufp);
retval = FALSE;
}
switch_symbols(TRUE);
} else if (match_varname(buf, "SYMBOLS", 4)) {
if (!parsesymbols(bufp)) {
if (!parsesymbols(bufp, PRIMARY)) {
config_error_add("Error in SYMBOLS definition '%s'", bufp);
retval = FALSE;
}
@@ -3338,9 +3352,9 @@ int which_set;
chosen_symset_start = TRUE;
/* these init_*() functions clear symset fields too */
if (which_set == ROGUESET)
init_r_symbols();
init_rogue_symbols();
else if (which_set == PRIMARY)
init_l_symbols();
init_primary_symbols();
}
break;
case 1:
@@ -3393,9 +3407,9 @@ int which_set;
val = sym_val(bufp);
if (chosen_symset_start) {
if (which_set == PRIMARY) {
update_l_symset(symp, val);
update_primary_symset(symp, val);
} else if (which_set == ROGUESET) {
update_r_symset(symp, val);
update_rogue_symset(symp, val);
}
}
}

View File

@@ -66,11 +66,12 @@ unsigned *ospecial;
{
register int offset, idx;
int color = NO_COLOR;
nhsym ch;
nhsym ch, ovsym;
unsigned special = 0;
/* condense multiple tests in macro version down to single */
boolean has_rogue_ibm_graphics = HAS_ROGUE_IBM_GRAPHICS;
boolean has_rogue_color = (has_rogue_ibm_graphics
boolean has_rogue_ibm_graphics = HAS_ROGUE_IBM_GRAPHICS,
is_you = (x == u.ux && y == u.uy),
has_rogue_color = (has_rogue_ibm_graphics
&& symset[currentgraphics].nocolor == 0);
/*
@@ -206,7 +207,7 @@ unsigned *ospecial;
} else { /* a monster */
idx = mons[glyph].mlet + SYM_OFF_M;
if (has_rogue_color && iflags.use_color) {
if (x == u.ux && y == u.uy)
if (is_you)
/* actually player should be yellow-on-gray if in corridor */
color = CLR_YELLOW;
else
@@ -215,13 +216,26 @@ unsigned *ospecial;
mon_color(glyph);
#ifdef TEXTCOLOR
/* special case the hero for `showrace' option */
if (iflags.use_color && x == u.ux && y == u.uy
&& flags.showrace && !Upolyd)
if (iflags.use_color && is_you && flags.showrace && !Upolyd)
color = HI_DOMESTIC;
#endif
}
}
/* These were requested by a blind player to enhance screen reader use */
if (sysopt.accessibility == 1) {
ovsym = Is_rogue_level(&u.uz)
? ov_rogue_syms[SYM_PET_OVERRIDE + SYM_OFF_X]
: ov_primary_syms[SYM_PET_OVERRIDE + SYM_OFF_X];
if (ovsym && (special & MG_PET))
idx = SYM_PET_OVERRIDE + SYM_OFF_X;
ovsym = Is_rogue_level(&u.uz)
? ov_rogue_syms[SYM_PLAYER_OVERRIDE + SYM_OFF_X]
: ov_primary_syms[SYM_PLAYER_OVERRIDE + SYM_OFF_X];
if (ovsym && is_you)
idx = SYM_PLAYER_OVERRIDE + SYM_OFF_X;
}
ch = showsyms[idx];
#ifdef TEXTCOLOR
/* Turn off color if no color defined, or rogue level w/o PC graphics. */

View File

@@ -751,11 +751,12 @@ initoptions_init()
flags.initrole = flags.initrace = flags.initgend = flags.initalign
= ROLE_NONE;
init_ov_primary_symbols();
init_ov_rogue_symbols();
/* Set the default monster and object class symbols. */
init_symbols();
for (i = 0; i < WARNCOUNT; i++)
warnsyms[i] = def_warnsyms[i].sym;
iflags.bouldersym = 0;
/* for "special achievement" tracking (see obj.h,
create_object(sp_lev.c), addinv_core1(invent.c) */
@@ -773,7 +774,7 @@ initoptions_init()
for (i = 0; i < NUM_DISCLOSURE_OPTIONS; i++)
flags.end_disclose[i] = DISCLOSE_PROMPT_DEFAULT_NO;
switch_symbols(FALSE); /* set default characters */
init_r_symbols();
init_rogue_symbols();
#if defined(UNIX) && defined(TTY_GRAPHICS)
/*
* Set defaults for some options depending on what we can
@@ -837,6 +838,7 @@ initoptions_init()
void
initoptions_finish()
{
nhsym sym = 0;
#ifndef MAC
char *opts = getenv("NETHACKOPTIONS");
@@ -880,8 +882,10 @@ initoptions_finish()
*/
obj_descr[SLIME_MOLD].oc_name = "fruit";
if (iflags.bouldersym)
update_bouldersym();
sym = get_othersym(SYM_BOULDER,
Is_rogue_level(&u.uz) ? ROGUESET : PRIMARY);
if (sym)
showsyms[SYM_BOULDER + SYM_OFF_X] = sym;
reglyph_darkroom();
#ifdef STATUS_HILITES
@@ -2754,12 +2758,16 @@ boolean tinitial, tfrom_file;
/*
* Override the default boulder symbol.
*/
iflags.bouldersym = (uchar) opts[0];
/* for 'initial', update_bouldersym() is done in
ov_primary_syms[SYM_BOULDER + SYM_OFF_X] = (nhsym) opts[0];
ov_rogue_syms[SYM_BOULDER + SYM_OFF_X] = (nhsym) opts[0];
/* for 'initial', update of BOULDER symbol is done in
initoptions_finish(), after all symset options
have been processed */
if (!initial) {
update_bouldersym();
nhsym sym = get_othersym(SYM_BOULDER,
Is_rogue_level(&u.uz) ? ROGUESET : PRIMARY);
if (sym)
showsyms[SYM_BOULDER + SYM_OFF_X] = sym;
need_redraw = TRUE;
}
}
@@ -4119,12 +4127,14 @@ boolean tinitial, tfrom_file;
}
}
#if 0
/* Is it a symbol? */
if (strstr(opts, "S_") == opts && parsesymbols(opts)) {
if (strstr(opts, "S_") == opts && parsesymbols(opts, PRIMARY)) {
switch_symbols(TRUE);
check_gold_symbol();
return retval;
}
#endif
/* out of valid options */
config_error_add("Unknown option '%s'", opts);
@@ -5544,9 +5554,9 @@ boolean setinitial, setfromfile;
/* Set default symbols and clear the handling value */
if (rogueflag)
init_r_symbols();
init_rogue_symbols();
else
init_l_symbols();
init_primary_symbols();
if (symset[which_set].name) {
/* non-default symbols */
@@ -5613,8 +5623,8 @@ char *buf;
#ifdef BACKWARD_COMPAT
else if (!strcmp(optname, "boulder"))
Sprintf(buf, "%c",
iflags.bouldersym
? iflags.bouldersym
ov_primary_syms[SYM_BOULDER + SYM_OFF_X]
? ov_primary_syms[SYM_BOULDER + SYM_OFF_X]
: showsyms[(int) objects[BOULDER].oc_class + SYM_OFF_O]);
#endif
else if (!strcmp(optname, "catname"))
@@ -6099,16 +6109,20 @@ free_symsets()
/* Parse the value of a SYMBOLS line from a config file */
boolean
parsesymbols(opts)
parsesymbols(opts, which_set)
register char *opts;
int which_set;
{
int val;
char *op, *symname, *strval;
struct symparse *symp;
#ifdef DEBUG
int sym_max = SYM_MAX;
#endif
if ((op = index(opts, ',')) != 0) {
*op++ = 0;
if (!parsesymbols(op))
if (!parsesymbols(op, which_set))
return FALSE;
}
@@ -6131,7 +6145,10 @@ register char *opts;
if (symp->range && symp->range != SYM_CONTROL) {
val = sym_val(strval);
update_l_symset(symp, val);
if (which_set == ROGUESET)
update_ov_rogue_symset(symp, val);
else
update_ov_primary_symset(symp, val);
}
return TRUE;
}

View File

@@ -813,11 +813,12 @@ struct permonst **for_supplement;
unreconnoitered[] = "unreconnoitered";
static char look_buf[BUFSZ];
char prefix[BUFSZ];
int i, alt_i, glyph = NO_GLYPH,
int i, alt_i, j, glyph = NO_GLYPH,
skipped_venom = 0, found = 0; /* count of matching syms found */
boolean hit_trap, need_to_look = FALSE,
submerged = (Underwater && !Is_waterlevel(&u.uz));
const char *x_str;
nhsym tmpsym;
if (looked) {
int oc;
@@ -881,7 +882,7 @@ struct permonst **for_supplement;
if (x_str == unreconnoitered)
goto didlook;
}
check_monsters:
/* Check for monsters */
if (!iflags.terrainmode || (iflags.terrainmode & TER_MON) != 0) {
for (i = 1; i < MAXMCLASSES; i++) {
@@ -1034,8 +1035,53 @@ struct permonst **for_supplement;
}
}
/* Finally, handle some optional overriding symbols */
for (j = SYM_OFF_X; j < SYM_MAX; ++j) {
if (j == (SYM_INVISIBLE + SYM_OFF_X))
continue; /* already handled above */
tmpsym = Is_rogue_level(&u.uz) ? ov_rogue_syms[j] : ov_primary_syms[j];
if (tmpsym && sym == tmpsym) {
switch(j) {
case SYM_BOULDER + SYM_OFF_X:
if (!found) {
*firstmatch = "boulder";
Sprintf(out_str, "%s%s", prefix, an(*firstmatch));
found++;
} else {
found += append_str(out_str, "boulder");
}
break;
case SYM_PET_OVERRIDE + SYM_OFF_X:
if (looked) {
int oc = 0;
unsigned os = 0;
nhsym save_override;
if (Is_rogue_level(&u.uz)) {
save_override = ov_rogue_syms[SYM_PET_OVERRIDE + SYM_OFF_X];
ov_rogue_syms[SYM_PET_OVERRIDE + SYM_OFF_X] = 0;
} else {
save_override = ov_primary_syms[SYM_PET_OVERRIDE + SYM_OFF_X];
ov_primary_syms[SYM_PET_OVERRIDE + SYM_OFF_X] = 0;
}
/* convert to symbol without the override in effect */
(void) mapglyph(glyph, &sym, &oc, &os, cc.x, cc.y);
if (Is_rogue_level(&u.uz))
ov_rogue_syms[SYM_PET_OVERRIDE + SYM_OFF_X] = save_override;
else
ov_primary_syms[SYM_PET_OVERRIDE + SYM_OFF_X] = save_override;
goto check_monsters;
}
break;
case SYM_PLAYER_OVERRIDE + SYM_OFF_X:
sym = showsyms[S_HUMAN + SYM_OFF_M];
goto check_monsters;
}
}
}
#if 0
/* handle optional boulder symbol as a special case */
if (iflags.bouldersym && sym == iflags.bouldersym) {
if (o_syms[SYM_BOULDER + SYM_OFF_X] && sym == o_syms[SYM_BOULDER + SYM_OFF_X]) {
if (!found) {
*firstmatch = "boulder";
Sprintf(out_str, "%s%s", prefix, an(*firstmatch));
@@ -1044,6 +1090,7 @@ struct permonst **for_supplement;
found += append_str(out_str, "boulder");
}
}
#endif
/*
* If we are looking at the screen, follow multiple possibilities or

View File

@@ -80,6 +80,7 @@ sys_early_init()
sysopt.check_plname = 0;
sysopt.seduce = 1; /* if it's compiled in, default to on */
sysopt_seduce_set(sysopt.seduce);
sysopt.accessibility = 0;
return;
}

View File

@@ -61,6 +61,11 @@ MAXPLAYERS=10
# incubi to use nymphs' charm behavior rather than their own seduce behavior.
#SEDUCE=0
# Uncomment the next line to enable some accessibility features such
# as S_player_override and S_pet_override symbols for screen readers
# in the user config file.
#ACCESSIBILITY=1
# Uncomment to disable savefile UID checking.
#CHECK_SAVE_UID=0

View File

@@ -1599,8 +1599,8 @@ check_font_widths()
boolean used[256];
memset(used, 0, sizeof(used));
for (int i = 0; i < SYM_MAX; i++) {
used[l_syms[i]] = TRUE;
used[r_syms[i]] = TRUE;
used[primary_syms[i]] = TRUE;
used[rogue_syms[i]] = TRUE;
}
int wcUsedCount = 0;

View File

@@ -52,6 +52,11 @@ WIZARDS=*
# Uncomment the next line to disable the SEDUCE option.
#SEDUCE=0
# Uncomment the next line to enable some accessibility features such
# as S_player_override and S_pet_override symbols for screen readers
# in the user config file.
#ACCESSIBILITY=1
# Record (high score) file options.
# CAUTION: changing these after people have started playing games can
# lead to lost high scores!