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

@@ -829,7 +829,10 @@ static const struct early_opt earlyopts[] = {
{ARG_SHOWPATHS, "showpaths", 9, FALSE},
#ifndef NODUMPENUMS
{ARG_DUMPENUMS, "dumpenums", 9, FALSE},
#ifdef ENHANCED_SYMBOLS
{ARG_DUMPGLYPHIDS, "dumpglyphids", 12, FALSE},
#endif
#endif /* NODUMPENUMS */
#ifdef WIN32
{ARG_WINDOWS, "windows", 4, TRUE},
#endif
@@ -913,7 +916,13 @@ argcheck(int argc, char *argv[], enum earlyarg e_arg)
dump_enums();
return 2;
}
#ifdef ENHANCED_SYMBOLS
case ARG_DUMPGLYPHIDS: {
dump_glyphids();
return 2;
}
#endif
#endif /* NODUMPENUMS */
#ifdef WIN32
case ARG_WINDOWS: {
if (extended_opt) {
@@ -1006,6 +1015,17 @@ timet_delta(time_t etim, time_t stim) /* end and start times */
}
#ifndef NODUMPENUMS
#define DUMP_ENUMS
struct enum_dump monsdump[] = {
#include "monsters.h"
{ NUMMONS, "NUMMONS" },
};
struct enum_dump objdump[] = {
#include "objects.h"
{ NUM_OBJECTS, "NUM_OBJECTS" },
};
#undef DUMP_ENUMS
void
dump_enums(void)
{
@@ -1018,21 +1038,6 @@ dump_enums(void)
};
static const char *const titles[NUM_ENUM_DUMPS] =
{ "monnums", "objects_nums" , "misc_object_nums" };
struct enum_dump {
int val;
const char *nm;
};
#define DUMP_ENUMS
struct enum_dump monsdump[] = {
#include "monsters.h"
{ NUMMONS, "NUMMONS" },
};
struct enum_dump objdump[] = {
#include "objects.h"
{ NUM_OBJECTS, "NUM_OBJECTS" },
};
#undef DUMP_ENUMS
struct enum_dump omdump[] = {
{ LAST_GEM, "LAST_GEM" },
@@ -1058,6 +1063,14 @@ dump_enums(void)
}
raw_print("");
}
#ifdef ENHANCED_SYMBOLS
void
dump_glyphids(void)
{
dump_all_glyphids(stdout);
}
#endif /* ENHANCED_SYMBOLS */
#endif /* NODUMPENUMS */
/*allmain.c*/