runtime toggle of ENHANCED_SYMBOLS customsymbols
This commit is contained in:
+2
-1
@@ -752,7 +752,8 @@ struct instance_globals_o {
|
|||||||
boolean opt_need_redraw; /* for doset() */
|
boolean opt_need_redraw; /* for doset() */
|
||||||
boolean opt_need_glyph_reset;
|
boolean opt_need_glyph_reset;
|
||||||
boolean opt_need_promptstyle;
|
boolean opt_need_promptstyle;
|
||||||
boolean opt_reset_customizations;
|
boolean opt_reset_customcolors;
|
||||||
|
boolean opt_reset_customsymbols;
|
||||||
|
|
||||||
/* pickup.c */
|
/* pickup.c */
|
||||||
int oldcap; /* last encumbrance */
|
int oldcap; /* last encumbrance */
|
||||||
|
|||||||
+4
-2
@@ -1106,12 +1106,13 @@ extern void dump_all_glyphids(FILE *fp) NONNULLARG1;
|
|||||||
extern void fill_glyphid_cache(void);
|
extern void fill_glyphid_cache(void);
|
||||||
extern void free_glyphid_cache(void);
|
extern void free_glyphid_cache(void);
|
||||||
extern boolean glyphid_cache_status(void);
|
extern boolean glyphid_cache_status(void);
|
||||||
extern void apply_customizations(enum graphics_sets which_set);
|
extern void apply_customizations(enum graphics_sets which_set,
|
||||||
|
enum do_customizations docustomize);
|
||||||
extern void purge_custom_entries(enum graphics_sets which_set);
|
extern void purge_custom_entries(enum graphics_sets which_set);
|
||||||
extern void purge_all_custom_entries(void);
|
extern void purge_all_custom_entries(void);
|
||||||
extern void dump_glyphids(void);
|
extern void dump_glyphids(void);
|
||||||
extern void clear_all_glyphmap_colors(void);
|
extern void clear_all_glyphmap_colors(void);
|
||||||
extern void reset_customizations(void);
|
extern void reset_customcolors(void);
|
||||||
|
|
||||||
/* ### hack.c ### */
|
/* ### hack.c ### */
|
||||||
|
|
||||||
@@ -3383,6 +3384,7 @@ extern char *mixed_to_utf8(char *buf, size_t bufsz, const char *str,
|
|||||||
void free_all_glyphmap_u(void);
|
void free_all_glyphmap_u(void);
|
||||||
int set_map_u(glyph_map *gm, uint32 utf32ch, const uint8 *utf8str) NONNULLPTRS;
|
int set_map_u(glyph_map *gm, uint32 utf32ch, const uint8 *utf8str) NONNULLPTRS;
|
||||||
#endif /* ENHANCED_SYMBOLS */
|
#endif /* ENHANCED_SYMBOLS */
|
||||||
|
extern void reset_customsymbols(void);
|
||||||
|
|
||||||
/* ### vault.c ### */
|
/* ### vault.c ### */
|
||||||
|
|
||||||
|
|||||||
@@ -376,6 +376,7 @@ struct instance_flags {
|
|||||||
boolean wizweight; /* display weight of everything in wizard mode */
|
boolean wizweight; /* display weight of everything in wizard mode */
|
||||||
boolean wizmgender; /* test gender info from core in window port */
|
boolean wizmgender; /* test gender info from core in window port */
|
||||||
boolean customcolors; /* support customcolors defined in glyphmap */
|
boolean customcolors; /* support customcolors defined in glyphmap */
|
||||||
|
boolean customsymbols; /* support customsymbols defined in glyphmap */
|
||||||
/*
|
/*
|
||||||
* Window capability support.
|
* Window capability support.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -253,6 +253,9 @@ static int optfn_##a(int, int, boolean, char *, char *);
|
|||||||
NHOPTB(customcolors, Map, 0, opt_out, set_in_game,
|
NHOPTB(customcolors, Map, 0, opt_out, set_in_game,
|
||||||
On, Yes, No, No, "customcolours", &iflags.customcolors,
|
On, Yes, No, No, "customcolours", &iflags.customcolors,
|
||||||
Term_False, "use custom colors in map")
|
Term_False, "use custom colors in map")
|
||||||
|
NHOPTB(customsymbols, Map, 0, opt_out, set_in_game,
|
||||||
|
On, Yes, No, No, "customsymbols", &iflags.customsymbols,
|
||||||
|
Term_False, "use custom utf8 symbols in map")
|
||||||
NHOPTB(dark_room, Advanced, 0, opt_out, set_in_game,
|
NHOPTB(dark_room, Advanced, 0, opt_out, set_in_game,
|
||||||
On, Yes, No, No, NoAlias, &flags.dark_room, Term_False,
|
On, Yes, No, No, NoAlias, &flags.dark_room, Term_False,
|
||||||
"show floor outside line of sight differently")
|
"show floor outside line of sight differently")
|
||||||
|
|||||||
@@ -129,6 +129,12 @@ enum graphics_sets {
|
|||||||
UNICODESET = NUM_GRAPHICS
|
UNICODESET = NUM_GRAPHICS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum do_customizations {
|
||||||
|
do_custom_none,
|
||||||
|
do_custom_colors,
|
||||||
|
do_custom_symbols
|
||||||
|
};
|
||||||
|
|
||||||
enum customization_types { custom_none, custom_symbols,
|
enum customization_types { custom_none, custom_symbols,
|
||||||
custom_ureps, custom_nhcolor, custom_count };
|
custom_ureps, custom_nhcolor, custom_count };
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -655,7 +655,8 @@ static const struct instance_globals_o g_init_o = {
|
|||||||
FALSE, /* opt_need_redraw */
|
FALSE, /* opt_need_redraw */
|
||||||
FALSE, /* opt_need_glyph_reset */
|
FALSE, /* opt_need_glyph_reset */
|
||||||
FALSE, /* opt_need_promptstyle */
|
FALSE, /* opt_need_promptstyle */
|
||||||
FALSE, /* opt_reset_customizations */
|
FALSE, /* opt_reset_customcolors */
|
||||||
|
FALSE, /* opt_reset_customsymbols */
|
||||||
/* pickup.c */
|
/* pickup.c */
|
||||||
0, /* oldcap */
|
0, /* oldcap */
|
||||||
/* restore.c */
|
/* restore.c */
|
||||||
|
|||||||
+17
-11
@@ -449,12 +449,16 @@ add_custom_nhcolor_entry(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
apply_customizations(enum graphics_sets which_set)
|
apply_customizations(
|
||||||
|
enum graphics_sets which_set,
|
||||||
|
enum do_customizations docustomize)
|
||||||
{
|
{
|
||||||
glyph_map *gmap;
|
glyph_map *gmap;
|
||||||
struct customization_detail *details;
|
struct customization_detail *details;
|
||||||
struct symset_customization *sc;
|
struct symset_customization *sc;
|
||||||
boolean at_least_one = FALSE;
|
boolean at_least_one = FALSE,
|
||||||
|
do_colors = ((docustomize & do_custom_colors) != 0),
|
||||||
|
do_symbols = ((docustomize & do_custom_symbols) != 0);
|
||||||
int custs;
|
int custs;
|
||||||
|
|
||||||
for (custs = 0; custs < (int) custom_count; ++custs) {
|
for (custs = 0; custs < (int) custom_count; ++custs) {
|
||||||
@@ -466,15 +470,17 @@ apply_customizations(enum graphics_sets which_set)
|
|||||||
details = sc->details;
|
details = sc->details;
|
||||||
while (details) {
|
while (details) {
|
||||||
#ifdef ENHANCED_SYMBOLS
|
#ifdef ENHANCED_SYMBOLS
|
||||||
if (sc->custtype == custom_ureps) {
|
if (iflags.customsymbols && do_symbols) {
|
||||||
gmap = &glyphmap[details->content.urep.glyphidx];
|
if (sc->custtype == custom_ureps) {
|
||||||
if (gs.symset[which_set].handling == H_UTF8)
|
gmap = &glyphmap[details->content.urep.glyphidx];
|
||||||
(void) set_map_u(gmap,
|
if (gs.symset[which_set].handling == H_UTF8)
|
||||||
details->content.urep.u.utf32ch,
|
(void) set_map_u(gmap,
|
||||||
details->content.urep.u.utf8str);
|
details->content.urep.u.utf32ch,
|
||||||
|
details->content.urep.u.utf8str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (iflags.customcolors) {
|
if (iflags.customcolors && do_colors) {
|
||||||
if (sc->custtype == custom_nhcolor) {
|
if (sc->custtype == custom_nhcolor) {
|
||||||
gmap = &glyphmap[details->content.ccolor.glyphidx];
|
gmap = &glyphmap[details->content.ccolor.glyphidx];
|
||||||
(void) set_map_nhcolor(gmap,
|
(void) set_map_nhcolor(gmap,
|
||||||
@@ -1048,10 +1054,10 @@ clear_all_glyphmap_colors(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset_customizations(void)
|
void reset_customcolors(void)
|
||||||
{
|
{
|
||||||
clear_all_glyphmap_colors();
|
clear_all_glyphmap_colors();
|
||||||
apply_customizations(gc.currentgraphics);
|
apply_customizations(gc.currentgraphics, do_custom_colors);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* not used yet */
|
/* not used yet */
|
||||||
|
|||||||
+25
-13
@@ -4078,7 +4078,8 @@ optfn_symset(
|
|||||||
reslt = handler_symset(optidx);
|
reslt = handler_symset(optidx);
|
||||||
if (glyphid_cache_status())
|
if (glyphid_cache_status())
|
||||||
free_glyphid_cache();
|
free_glyphid_cache();
|
||||||
/* apply_customizations(gc.currentgraphics); */
|
/* apply_customizations(gc.currentgraphics,
|
||||||
|
(do_custom_colors | do_custom_symbols)); */
|
||||||
return reslt;
|
return reslt;
|
||||||
}
|
}
|
||||||
return optn_ok;
|
return optn_ok;
|
||||||
@@ -5230,7 +5231,10 @@ optfn_boolean(
|
|||||||
go.opt_need_glyph_reset = TRUE;
|
go.opt_need_glyph_reset = TRUE;
|
||||||
break;
|
break;
|
||||||
case opt_customcolors:
|
case opt_customcolors:
|
||||||
go.opt_reset_customizations = TRUE;
|
go.opt_reset_customcolors = TRUE;
|
||||||
|
break;
|
||||||
|
case opt_customsymbols:
|
||||||
|
go.opt_reset_customsymbols = TRUE;
|
||||||
break;
|
break;
|
||||||
case opt_menucolors:
|
case opt_menucolors:
|
||||||
case opt_guicolor:
|
case opt_guicolor:
|
||||||
@@ -7193,7 +7197,8 @@ initoptions_finish(void)
|
|||||||
|
|
||||||
if (glyphid_cache_status())
|
if (glyphid_cache_status())
|
||||||
free_glyphid_cache();
|
free_glyphid_cache();
|
||||||
apply_customizations(gc.currentgraphics);
|
apply_customizations(gc.currentgraphics,
|
||||||
|
(do_custom_colors | do_custom_symbols));
|
||||||
go.opt_initial = FALSE;
|
go.opt_initial = FALSE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -8392,7 +8397,8 @@ doset_simple_menu(void)
|
|||||||
|
|
||||||
go.opt_need_redraw = FALSE;
|
go.opt_need_redraw = FALSE;
|
||||||
go.opt_need_glyph_reset = FALSE;
|
go.opt_need_glyph_reset = FALSE;
|
||||||
go.opt_reset_customizations = FALSE;
|
go.opt_reset_customcolors = FALSE;
|
||||||
|
go.opt_reset_customsymbols = FALSE;
|
||||||
pick_cnt = select_menu(tmpwin, PICK_ONE, &pick_list);
|
pick_cnt = select_menu(tmpwin, PICK_ONE, &pick_list);
|
||||||
/* note: without the complication of a preselected entry, a PICK_ONE
|
/* note: without the complication of a preselected entry, a PICK_ONE
|
||||||
menu returning pick_cnt > 0 implies exactly 1 */
|
menu returning pick_cnt > 0 implies exactly 1 */
|
||||||
@@ -8483,8 +8489,11 @@ doset_simple(void)
|
|||||||
}
|
}
|
||||||
if (go.opt_need_promptstyle)
|
if (go.opt_need_promptstyle)
|
||||||
adjust_menu_promptstyle(WIN_INVEN, &iflags.menu_headings);
|
adjust_menu_promptstyle(WIN_INVEN, &iflags.menu_headings);
|
||||||
if (go.opt_reset_customizations) {
|
if (go.opt_reset_customcolors || go.opt_reset_customsymbols) {
|
||||||
reset_customizations();
|
if (go.opt_reset_customcolors)
|
||||||
|
reset_customcolors();
|
||||||
|
if (go.opt_reset_customsymbols)
|
||||||
|
reset_customsymbols();
|
||||||
docrt_flags(opt_crt_flags);
|
docrt_flags(opt_crt_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8738,13 +8747,16 @@ doset(void) /* changing options via menu by Per Liboriussen */
|
|||||||
if (go.opt_need_glyph_reset) {
|
if (go.opt_need_glyph_reset) {
|
||||||
reset_glyphmap(gm_optionchange);
|
reset_glyphmap(gm_optionchange);
|
||||||
}
|
}
|
||||||
if (go.opt_reset_customizations) {
|
if (go.opt_reset_customcolors
|
||||||
reset_customizations();
|
|| go.opt_reset_customsymbols || go.opt_need_redraw) {
|
||||||
docrt();
|
if (go.opt_reset_customcolors)
|
||||||
}
|
reset_customcolors();
|
||||||
if (go.opt_need_redraw) {
|
if (go.opt_reset_customsymbols)
|
||||||
check_gold_symbol();
|
reset_customsymbols();
|
||||||
reglyph_darkroom();
|
if (go.opt_need_redraw) {
|
||||||
|
check_gold_symbol();
|
||||||
|
reglyph_darkroom();
|
||||||
|
}
|
||||||
docrt();
|
docrt();
|
||||||
}
|
}
|
||||||
if (go.opt_need_promptstyle) {
|
if (go.opt_need_promptstyle) {
|
||||||
|
|||||||
+4
-2
@@ -680,7 +680,8 @@ load_symset(const char *s, int which_set)
|
|||||||
|
|
||||||
if (read_sym_file(which_set)) {
|
if (read_sym_file(which_set)) {
|
||||||
switch_symbols(TRUE);
|
switch_symbols(TRUE);
|
||||||
apply_customizations(gc.currentgraphics);
|
apply_customizations(gc.currentgraphics,
|
||||||
|
do_custom_symbols | do_custom_colors);
|
||||||
} else {
|
} else {
|
||||||
clear_symsetentry(which_set, TRUE);
|
clear_symsetentry(which_set, TRUE);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1089,7 +1090,8 @@ do_symset(boolean rogueflag)
|
|||||||
assign_graphics(ROGUESET);
|
assign_graphics(ROGUESET);
|
||||||
} else if (!rogueflag)
|
} else if (!rogueflag)
|
||||||
assign_graphics(PRIMARYSET);
|
assign_graphics(PRIMARYSET);
|
||||||
apply_customizations(rogueflag ? ROGUESET : PRIMARYSET);
|
apply_customizations(rogueflag ? ROGUESET : PRIMARYSET,
|
||||||
|
(do_custom_symbols | do_custom_colors));
|
||||||
preference_update("symset");
|
preference_update("symset");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -208,6 +208,14 @@ add_custom_urep_entry(
|
|||||||
}
|
}
|
||||||
#endif /* ENHANCED_SYMBOLS */
|
#endif /* ENHANCED_SYMBOLS */
|
||||||
|
|
||||||
|
void reset_customsymbols(void)
|
||||||
|
{
|
||||||
|
#ifdef ENHANCED_SYMBOLS
|
||||||
|
free_all_glyphmap_u();
|
||||||
|
apply_customizations(gc.currentgraphics, do_custom_symbols);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* utf8map.c */
|
/* utf8map.c */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user