sever extracolors from utf8map and ENHANCED_SYMBOLS
move the custom color data into its own field in the glyphmap and disassociate it from the unicode/utf8 stuff. move the glyphcache stuff during options processing and parsing into new file glyphs.c and out of utf8map.c, and make it general, and not part of ENHANCED_SYMBOLS. Do the groundwork for allowing glyph color customizations to work when any symset is loaded and not restrict it only to the enhanced1 H_UTF8 symsets. The customizations in effect are still affiliated with a particular symset. Also closes #1224, but the PR itself references a data structure made obsolete by this commit. The curses comment from the PR was added into the code. The PR also made several suggestions, but only the first one has been included in this commit (and no longer based on the handler), that being: "allow defining colors if other symbol handling modes are used (possibly limited to the standard 16 colors)." FredrIQ also wrote the following suggestions in PR#1224: Something I was also contemplating, unrelated to implementation of this support in curses, would be the ability for the following: allow defining colors if other symbol handling modes are used (possibly limited to the standard 16 colors) allow defining attributes (for example: glyph:G_pet_female_kitten:U+0066/red/underline) allow specifying glyphs as wildcards for defining global color/attribute changes Something I also want to see are keywords for "don't change the current defined data". If this were to be added, you could for example do this: OPTIONS=glyph:G_*_fox:U+0064/blue OPTIONS=glyph:G_statue_*:basechar/gray/underline for "make all foxes use a blue color, make all statues gray with underline" without needing to specify the relevant character for every statue. This ("basechar", "basefg", etc) should perhaps also be added for MENUCOLORS and statushilites, so that you can, for example, underline all items being worn without needing to specify a bunch of near-duplicate rules for combining BUC colors + underline worn items as per #1064
This commit is contained in:
@@ -318,6 +318,11 @@ extern void free_menu_coloring(void);
|
||||
extern int count_menucolors(void);
|
||||
extern int32 check_enhanced_colors(char *) NONNULLARG1;
|
||||
extern const char *wc_color_name(int32) NONNULL;
|
||||
extern int32_t rgbstr_to_int32(const char *rgbstr);
|
||||
extern boolean closest_color(uint32_t lcolor, uint32_t *closecolor, int *clridx);
|
||||
extern int color_distance(uint32_t, uint32_t);
|
||||
extern boolean onlyhexdigits(const char *buf);
|
||||
extern uint32 get_nhcolor_from_256_index(int idx);
|
||||
|
||||
/* ### cmd.c ### */
|
||||
|
||||
@@ -1079,6 +1084,29 @@ extern void getpos_sethilite(void(*f)(boolean), boolean(*d)(coordxy,coordxy));
|
||||
extern boolean mapxy_valid(coordxy, coordxy);
|
||||
extern boolean gather_locs_interesting(coordxy, coordxy, int);
|
||||
|
||||
/* ### glyphs.c ### */
|
||||
|
||||
extern int glyphrep_to_custom_map_entries(const char *op,
|
||||
int *glyph) NONNULLPTRS;
|
||||
extern int add_custom_urep_entry(const char *symset_name, int glyphidx,
|
||||
uint32 utf32ch, const uint8 *utf8str,
|
||||
enum graphics_sets which_set) NONNULLARG1;
|
||||
extern int add_custom_nhcolor_entry(const char *customization_name,
|
||||
int glyphidx, uint32 nhcolor,
|
||||
enum graphics_sets which_set) NONNULLARG1;
|
||||
int set_map_nhcolor(glyph_map *gm, uint32 nhcolor) NONNULLARG1;
|
||||
extern int unicode_val(const char *);
|
||||
extern int glyphrep(const char *) NONNULLARG1;
|
||||
extern int match_glyph(char *) NONNULLARG1;
|
||||
extern void dump_all_glyphids(FILE *fp) NONNULLARG1;
|
||||
extern void fill_glyphid_cache(void);
|
||||
extern void free_glyphid_cache(void);
|
||||
extern boolean glyphid_cache_status(void);
|
||||
extern void apply_customizations(enum graphics_sets which_set);
|
||||
extern void purge_custom_entries(enum graphics_sets which_set);
|
||||
extern void purge_all_custom_entries(void);
|
||||
extern void dump_glyphids(void);
|
||||
|
||||
/* ### hack.c ### */
|
||||
|
||||
extern boolean is_valid_travelpt(coordxy, coordxy);
|
||||
@@ -1399,9 +1427,6 @@ extern void runtime_info_init(void);
|
||||
extern const char *do_runtime_info(int *) NO_NNARGS;
|
||||
extern void release_runtime_info(void);
|
||||
extern char *mdlib_version_string(char *, const char *) NONNULL NONNULLPTRS;
|
||||
#ifdef ENHANCED_SYMBOLS
|
||||
extern void dump_glyphids(void);
|
||||
#endif
|
||||
|
||||
/* ### mhitm.c ### */
|
||||
|
||||
@@ -3002,12 +3027,7 @@ extern const struct symparse *match_sym(char *) NONNULLARG1;
|
||||
extern void savedsym_free(void);
|
||||
extern void savedsym_strbuf(strbuf_t *) NONNULLARG1;
|
||||
extern boolean parsesymbols(char *, int) NONNULLARG1;
|
||||
#ifdef ENHANCED_SYMBOLS
|
||||
extern struct customization_detail *find_matching_symset_customiz(
|
||||
const char *symset_name, int custtype,
|
||||
enum graphics_sets which_set) NONNULLARG1;
|
||||
extern void apply_customizations_to_symset(enum graphics_sets which_set);
|
||||
#endif
|
||||
extern void clear_all_glyphmap_colors(void);
|
||||
|
||||
/* ### sys.c ### */
|
||||
|
||||
@@ -3353,21 +3373,10 @@ extern int hide_privileges(boolean);
|
||||
/* ### utf8map.c ### */
|
||||
|
||||
#ifdef ENHANCED_SYMBOLS
|
||||
extern int glyphrep(const char *) NONNULLARG1;
|
||||
extern char *mixed_to_utf8(char *buf, size_t bufsz, const char *str,
|
||||
int *) NONNULLARG1;
|
||||
extern int match_glyph(char *) NONNULLARG1;
|
||||
extern void dump_all_glyphids(FILE *fp) NONNULLARG1;
|
||||
extern void fill_glyphid_cache(void);
|
||||
extern void free_glyphid_cache(void);
|
||||
extern boolean glyphid_cache_status(void);
|
||||
extern int glyphrep_to_custom_map_entries(const char *op, int *glyph) NONNULLPTRS;
|
||||
void free_all_glyphmap_u(void);
|
||||
int add_custom_urep_entry(const char *symset_name, int glyphidx,
|
||||
uint32 utf32ch, const uint8 *utf8str, long ucolor,
|
||||
enum graphics_sets which_set) NONNULLARG1;
|
||||
int set_map_u(glyph_map *gm, uint32 utf32ch, const uint8 *utf8str,
|
||||
long ucolor) NONNULLPTRS;
|
||||
int set_map_u(glyph_map *gm, uint32 utf32ch, const uint8 *utf8str) NONNULLPTRS;
|
||||
#endif /* ENHANCED_SYMBOLS */
|
||||
|
||||
/* ### vault.c ### */
|
||||
|
||||
Reference in New Issue
Block a user