ENHANCED_SYMBOLS

A new feature, enabled by default to maximize testing, but one which can
be disabled by commenting it out in config.h

With this, some additional information is added to the glyphmap entries
in a new optional substructure called u with these fields:
    ucolor          RGB color for use with truecolor terminals/platforms.
                    A ucolor value of zero means "not set." The actual
                    rgb value of 0 has the 0x1000000 bit set.
    u256coloridx    256 color index value for use with 256 color
                    terminals, the closest color match to ucolor.
    utf8str         Custom representation via utf-8 string (can be null).

There is a new symset included in the symbols file, called enhanced1.

Some initial code has been added to parse individual
OPTIONS=glyph:glyphid/R-G-B entries in the config file.

The glyphid can, in theory, either be an individual glyph (G_* glyphid)
for a single glyph, or it can be an existing symbol S_ value
(monster, object, or cmap symbol) to store the custom representation for
all the glyphs that match that symbol.

Examples:
   OPTIONS=glyph:G_fountain/U+03A8/0-150-255

(Your platform/terminal font needs to be able to include/display the
character, of course.)

The NetHack core code does parsing and storing the customized
entries, and adding them to the glyphmap data structure.

Any window port can utilize the additional information in the glyphinfo
that is passed to them, once code is added to do so.

Also, consolidate some symbol-related code into symbols.c, and remove it from
files.c and options.c
This commit is contained in:
nhmall
2022-05-07 10:25:13 -04:00
parent 132e1d433a
commit cb0c21e91d
50 changed files with 3072 additions and 1242 deletions

View File

@@ -25,7 +25,6 @@ enum mon_syms {
};
#ifndef MAKEDEFS_C
/* Default characters for dungeon surroundings and furniture */
enum cmap_symbols {
#define PCHAR_S_ENUM
@@ -34,6 +33,22 @@ enum cmap_symbols {
MAXPCHARS
};
/*
* special symbol set handling types ( for invoking callbacks, etc.)
* Must match the order of the known_handlers strings
* in drawing.c
*/
enum symset_handling_types {
H_UNK = 0,
H_IBM = 1,
H_DEC = 2,
H_CURS = 3,
H_MAC = 4, /* obsolete; needed so that the listing of available
* symsets by 'O' can skip it for !MAC_GRAPHICS_ENV */
H_UTF8 = 5
};
struct symdef {
uchar sym;
const char *explanation;
@@ -51,7 +66,7 @@ enum symparse_range {
};
struct symparse {
unsigned range;
enum symparse_range range;
int idx;
const char *name;
};
@@ -62,7 +77,7 @@ struct symsetentry {
char *name; /* ptr to symset name */
char *desc; /* ptr to description */
int idx; /* an index value */
int handling; /* known handlers value */
enum symset_handling_types handling; /* known handlers value */
Bitfield(nocolor, 1); /* don't use color if set */
Bitfield(primary, 1); /* restricted for use as primary set */
Bitfield(rogue, 1); /* restricted for use as rogue lev set */
@@ -109,25 +124,41 @@ enum misc_symbols {
*/
#define DEFAULT_GRAPHICS 0 /* regular characters: '-', '+', &c */
enum graphics_sets {
PRIMARY = 0, /* primary graphics set */
PRIMARYSET = 0, /* primary graphics set */
ROGUESET = 1, /* rogue graphics set */
NUM_GRAPHICS
NUM_GRAPHICS,
UNICODESET = NUM_GRAPHICS
};
/*
* special symbol set handling types ( for invoking callbacks, etc.)
* Must match the order of the known_handlers strings
* in drawing.c
*/
#ifdef ENHANCED_SYMBOLS
enum customization_types { custom_none, custom_symbols, custom_ureps };
enum symset_handling_types {
H_UNK = 0,
H_IBM = 1,
H_DEC = 2,
H_CURS = 3,
H_MAC = 4 /* obsolete; needed so that the listing of available
* symsets by 'O' can skip it for !MAC_GRAPHICS_ENV */
struct custom_symbol {
const struct symparse *symparse;
unsigned char val;
};
struct custom_urep {
int glyphidx;
struct unicode_representation u;
};
union customization_content {
struct custom_symbol sym;
struct custom_urep urep;
};
struct customization_detail {
union customization_content content;
struct customization_detail *next;
};
/* one set per symset_name */
struct symset_customization {
const char *customization_name;
int count;
int custtype;
struct customization_detail *details;
};
#endif /* ENHANCED_SYMBOLS */
extern const struct symdef defsyms[MAXPCHARS]; /* defaults */
#define WARNCOUNT 6 /* number of different warning levels */