add customcolors option

customcolors (default) and !customcolors toggle whether the
custom colors get applied to the glyphmap.
This commit is contained in:
nhmall
2024-03-24 16:55:23 -04:00
parent f5c3445e80
commit 0b35079acc
8 changed files with 46 additions and 19 deletions
+1
View File
@@ -752,6 +752,7 @@ 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;
/* pickup.c */ /* pickup.c */
int oldcap; /* last encumbrance */ int oldcap; /* last encumbrance */
+2 -1
View File
@@ -1110,6 +1110,8 @@ extern void apply_customizations(enum graphics_sets which_set);
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 reset_customizations(void);
/* ### hack.c ### */ /* ### hack.c ### */
@@ -3031,7 +3033,6 @@ extern const struct symparse *match_sym(char *) NONNULLARG1;
extern void savedsym_free(void); extern void savedsym_free(void);
extern void savedsym_strbuf(strbuf_t *) NONNULLARG1; extern void savedsym_strbuf(strbuf_t *) NONNULLARG1;
extern boolean parsesymbols(char *, int) NONNULLARG1; extern boolean parsesymbols(char *, int) NONNULLARG1;
extern void clear_all_glyphmap_colors(void);
/* ### sys.c ### */ /* ### sys.c ### */
+1
View File
@@ -375,6 +375,7 @@ struct instance_flags {
boolean fireassist; /* autowield launcher when using fire-command */ boolean fireassist; /* autowield launcher when using fire-command */
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 */
/* /*
* Window capability support. * Window capability support.
*/ */
+3
View File
@@ -250,6 +250,9 @@ static int optfn_##a(int, int, boolean, char *, char *);
No, Yes, No, No, NoAlias, No, Yes, No, No, NoAlias,
"load curses display symbols into symset") "load curses display symbols into symset")
#endif #endif
NHOPTB(customcolors, Map, 0, opt_out, set_in_game,
On, Yes, No, No, "customcolours", &iflags.customcolors,
Term_False, "use custom colors 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")
+1
View File
@@ -655,6 +655,7 @@ 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 */
/* pickup.c */ /* pickup.c */
0, /* oldcap */ 0, /* oldcap */
/* restore.c */ /* restore.c */
+25 -4
View File
@@ -474,10 +474,12 @@ apply_customizations(enum graphics_sets which_set)
details->content.urep.u.utf8str); details->content.urep.u.utf8str);
} }
#endif #endif
if (sc->custtype == custom_nhcolor) { if (iflags.customcolors) {
gmap = &glyphmap[details->content.ccolor.glyphidx]; if (sc->custtype == custom_nhcolor) {
(void) set_map_nhcolor(gmap, gmap = &glyphmap[details->content.ccolor.glyphidx];
details->content.ccolor.nhcolor); (void) set_map_nhcolor(gmap,
details->content.ccolor.nhcolor);
}
} }
details = details->next; details = details->next;
} }
@@ -1033,6 +1035,25 @@ parse_id(const char *id, struct find_struct *findwhat)
return 0; return 0;
} }
/* extern glyph_map glyphmap[MAX_GLYPH]; */
void
clear_all_glyphmap_colors(void)
{
int glyph;
for (glyph = 0; glyph < MAX_GLYPH; ++glyph) {
if (glyphmap[glyph].customcolor)
glyphmap[glyph].customcolor = 0;
}
}
void reset_customizations(void)
{
clear_all_glyphmap_colors();
apply_customizations(gc.currentgraphics);
}
/* not used yet */ /* not used yet */
#if 0 #if 0
+13 -1
View File
@@ -5229,6 +5229,9 @@ optfn_boolean(
go.opt_need_redraw = TRUE; go.opt_need_redraw = TRUE;
go.opt_need_glyph_reset = TRUE; go.opt_need_glyph_reset = TRUE;
break; break;
case opt_customcolors:
go.opt_reset_customizations = TRUE;
break;
case opt_menucolors: case opt_menucolors:
case opt_guicolor: case opt_guicolor:
update_inventory(); update_inventory();
@@ -8389,6 +8392,7 @@ 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;
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 */
@@ -8479,7 +8483,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) {
reset_customizations();
docrt_flags(opt_crt_flags);
}
/*
* I don't think the status window requires updating between * I don't think the status window requires updating between
* simplemenu iterations. * simplemenu iterations.
if (disp.botl || disp.botlx) { if (disp.botl || disp.botlx) {
@@ -8729,6 +8737,10 @@ 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) {
reset_customizations();
docrt();
}
if (go.opt_need_redraw) { if (go.opt_need_redraw) {
check_gold_symbol(); check_gold_symbol();
reglyph_darkroom(); reglyph_darkroom();
-13
View File
@@ -1094,19 +1094,6 @@ do_symset(boolean rogueflag)
return TRUE; return TRUE;
} }
extern glyph_map glyphmap[MAX_GLYPH];
void
clear_all_glyphmap_colors(void)
{
int glyph;
for (glyph = 0; glyph < MAX_GLYPH; ++glyph) {
if (glyphmap[glyph].customcolor)
glyphmap[glyph].customcolor = 0;
}
}
RESTORE_WARNING_FORMAT_NONLITERAL RESTORE_WARNING_FORMAT_NONLITERAL
/*symbols.c*/ /*symbols.c*/