Lines 23-28
Link Here
|
23 |
#define PREFER_TILED FALSE |
23 |
#define PREFER_TILED FALSE |
24 |
#endif |
24 |
#endif |
25 |
|
25 |
|
|
|
26 |
static struct Char_Gfx { |
27 |
int gfx; |
28 |
char *txt; |
29 |
char let; |
30 |
} const chargfx[] = { |
31 |
{ASCII_GRAPHICS, "ASCII", 'a'}, |
32 |
{DEC_GRAPHICS, "DEC", 'd'}, |
33 |
{IBM_GRAPHICS, "IBM", 'i'}, |
34 |
#ifdef MAC_GRAPHICS_ENV |
35 |
{MAC_GRAPHICS, "Mac", 'm'}, |
36 |
#endif |
37 |
}; |
38 |
|
39 |
|
26 |
/* |
40 |
/* |
27 |
* NOTE: If you add (or delete) an option, please update the short |
41 |
* NOTE: If you add (or delete) an option, please update the short |
28 |
* options help (option_help()), the long options help (dat/opthelp), |
42 |
* options help (option_help()), the long options help (dat/opthelp), |
Lines 76-82
Link Here
|
76 |
# endif |
90 |
# endif |
77 |
{"confirm",&flags.confirm, TRUE, SET_IN_GAME}, |
91 |
{"confirm",&flags.confirm, TRUE, SET_IN_GAME}, |
78 |
#if defined(TERMLIB) && !defined(MAC_GRAPHICS_ENV) |
92 |
#if defined(TERMLIB) && !defined(MAC_GRAPHICS_ENV) |
79 |
{"DECgraphics", &iflags.DECgraphics, FALSE, SET_IN_GAME}, |
93 |
{"DECgraphics", &iflags.DECgraphics, FALSE, SET_IN_FILE}, |
80 |
#else |
94 |
#else |
81 |
{"DECgraphics", (boolean *)0, FALSE, SET_IN_FILE}, |
95 |
{"DECgraphics", (boolean *)0, FALSE, SET_IN_FILE}, |
82 |
#endif |
96 |
#endif |
Lines 102-108
Link Here
|
102 |
{"help", &flags.help, TRUE, SET_IN_GAME}, |
116 |
{"help", &flags.help, TRUE, SET_IN_GAME}, |
103 |
{"hilite_pet", &iflags.wc_hilite_pet, FALSE, SET_IN_GAME}, /*WC*/ |
117 |
{"hilite_pet", &iflags.wc_hilite_pet, FALSE, SET_IN_GAME}, /*WC*/ |
104 |
#ifdef ASCIIGRAPH |
118 |
#ifdef ASCIIGRAPH |
105 |
{"IBMgraphics", &iflags.IBMgraphics, FALSE, SET_IN_GAME}, |
119 |
{"IBMgraphics", &iflags.IBMgraphics, FALSE, SET_IN_FILE}, |
106 |
#else |
120 |
#else |
107 |
{"IBMgraphics", (boolean *)0, FALSE, SET_IN_FILE}, |
121 |
{"IBMgraphics", (boolean *)0, FALSE, SET_IN_FILE}, |
108 |
#endif |
122 |
#endif |
Lines 116-122
Link Here
|
116 |
{"lit_corridor", &flags.lit_corridor, FALSE, SET_IN_GAME}, |
130 |
{"lit_corridor", &flags.lit_corridor, FALSE, SET_IN_GAME}, |
117 |
{"lootabc", &iflags.lootabc, FALSE, SET_IN_GAME}, |
131 |
{"lootabc", &iflags.lootabc, FALSE, SET_IN_GAME}, |
118 |
#ifdef MAC_GRAPHICS_ENV |
132 |
#ifdef MAC_GRAPHICS_ENV |
119 |
{"Macgraphics", &iflags.MACgraphics, TRUE, SET_IN_GAME}, |
133 |
{"Macgraphics", &iflags.MACgraphics, TRUE, SET_IN_FILE}, |
120 |
#else |
134 |
#else |
121 |
{"Macgraphics", (boolean *)0, FALSE, SET_IN_FILE}, |
135 |
{"Macgraphics", (boolean *)0, FALSE, SET_IN_FILE}, |
122 |
#endif |
136 |
#endif |
Lines 125-130
Link Here
|
125 |
#else |
139 |
#else |
126 |
{"mail", (boolean *)0, TRUE, SET_IN_FILE}, |
140 |
{"mail", (boolean *)0, TRUE, SET_IN_FILE}, |
127 |
#endif |
141 |
#endif |
|
|
142 |
#if defined(STATUS_COLORS) && defined(TEXTCOLOR) |
143 |
{"statuscolors", &iflags.use_status_colors, TRUE, SET_IN_GAME}, |
144 |
#else |
145 |
{"statuscolors", (boolean *)0, TRUE, SET_IN_GAME}, |
146 |
#endif |
147 |
#ifdef MENU_COLOR |
148 |
# ifdef MICRO |
149 |
{"menucolors", &iflags.use_menu_color, TRUE, SET_IN_GAME}, |
150 |
# else |
151 |
{"menucolors", &iflags.use_menu_color, FALSE, SET_IN_GAME}, |
152 |
# endif |
153 |
#else |
154 |
{"menucolors", (boolean *)0, FALSE, SET_IN_GAME}, |
155 |
#endif |
128 |
#ifdef WIZARD |
156 |
#ifdef WIZARD |
129 |
/* for menu debugging only*/ |
157 |
/* for menu debugging only*/ |
130 |
{"menu_tab_sep", &iflags.menu_tab_sep, FALSE, SET_IN_GAME}, |
158 |
{"menu_tab_sep", &iflags.menu_tab_sep, FALSE, SET_IN_GAME}, |
Lines 143-148
Link Here
|
143 |
#else |
171 |
#else |
144 |
{"page_wait", (boolean *)0, FALSE, SET_IN_FILE}, |
172 |
{"page_wait", (boolean *)0, FALSE, SET_IN_FILE}, |
145 |
#endif |
173 |
#endif |
|
|
174 |
#ifdef PARANOID |
175 |
{"paranoid_hit", &iflags.paranoid_hit, FALSE, SET_IN_GAME}, |
176 |
{"paranoid_quit", &iflags.paranoid_quit, FALSE, SET_IN_GAME}, |
177 |
{"paranoid_remove", &iflags.paranoid_remove, FALSE, SET_IN_GAME}, |
178 |
#endif |
146 |
{"perm_invent", &flags.perm_invent, FALSE, SET_IN_GAME}, |
179 |
{"perm_invent", &flags.perm_invent, FALSE, SET_IN_GAME}, |
147 |
{"popup_dialog", &iflags.wc_popup_dialog, FALSE, SET_IN_GAME}, /*WC*/ |
180 |
{"popup_dialog", &iflags.wc_popup_dialog, FALSE, SET_IN_GAME}, /*WC*/ |
148 |
{"prayconfirm", &flags.prayconfirm, TRUE, SET_IN_GAME}, |
181 |
{"prayconfirm", &flags.prayconfirm, TRUE, SET_IN_GAME}, |
Lines 160-165
Link Here
|
160 |
#else |
193 |
#else |
161 |
{"sanity_check", (boolean *)0, FALSE, SET_IN_FILE}, |
194 |
{"sanity_check", (boolean *)0, FALSE, SET_IN_FILE}, |
162 |
#endif |
195 |
#endif |
|
|
196 |
#ifdef SHOW_BORN |
197 |
{"showborn", &iflags.show_born, FALSE, SET_IN_GAME}, |
198 |
#endif |
163 |
#ifdef EXP_ON_BOTL |
199 |
#ifdef EXP_ON_BOTL |
164 |
{"showexp", &flags.showexp, FALSE, SET_IN_GAME}, |
200 |
{"showexp", &flags.showexp, FALSE, SET_IN_GAME}, |
165 |
#else |
201 |
#else |
Lines 219-229
Link Here
|
219 |
1, SET_IN_GAME }, |
255 |
1, SET_IN_GAME }, |
220 |
{ "catname", "the name of your (first) cat (e.g., catname:Tabby)", |
256 |
{ "catname", "the name of your (first) cat (e.g., catname:Tabby)", |
221 |
PL_PSIZ, DISP_IN_GAME }, |
257 |
PL_PSIZ, DISP_IN_GAME }, |
|
|
258 |
{ "chargfx", "use special character set for display", PL_PSIZ, SET_IN_GAME }, |
222 |
{ "disclose", "the kinds of information to disclose at end of game", |
259 |
{ "disclose", "the kinds of information to disclose at end of game", |
223 |
sizeof(flags.end_disclose) * 2, |
260 |
sizeof(flags.end_disclose) * 2, |
224 |
SET_IN_GAME }, |
261 |
SET_IN_GAME }, |
225 |
{ "dogname", "the name of your (first) dog (e.g., dogname:Fang)", |
262 |
{ "dogname", "the name of your (first) dog (e.g., dogname:Fang)", |
226 |
PL_PSIZ, DISP_IN_GAME }, |
263 |
PL_PSIZ, DISP_IN_GAME }, |
|
|
264 |
#ifdef DUMP_LOG |
265 |
{ "dumpfile", "where to dump data (e.g., dumpfile:/tmp/dump.nh)", |
266 |
#ifdef DUMP_FN |
267 |
PL_PSIZ, DISP_IN_GAME }, |
268 |
#else |
269 |
PL_PSIZ, SET_IN_GAME }, |
270 |
#endif |
271 |
#endif |
227 |
{ "dungeon", "the symbols to use in drawing the dungeon map", |
272 |
{ "dungeon", "the symbols to use in drawing the dungeon map", |
228 |
MAXDCHARS+1, SET_IN_FILE }, |
273 |
MAXDCHARS+1, SET_IN_FILE }, |
229 |
{ "effects", "the symbols to use in drawing special effects", |
274 |
{ "effects", "the symbols to use in drawing special effects", |
Lines 246-251
Link Here
|
246 |
{ "horsename", "the name of your (first) horse (e.g., horsename:Silver)", |
291 |
{ "horsename", "the name of your (first) horse (e.g., horsename:Silver)", |
247 |
PL_PSIZ, DISP_IN_GAME }, |
292 |
PL_PSIZ, DISP_IN_GAME }, |
248 |
{ "map_mode", "map display mode under Windows", 20, DISP_IN_GAME }, /*WC*/ |
293 |
{ "map_mode", "map display mode under Windows", 20, DISP_IN_GAME }, /*WC*/ |
|
|
294 |
{ "menucolor", "set menu colors", PL_PSIZ, SET_IN_FILE }, |
249 |
{ "menustyle", "user interface for object selection", |
295 |
{ "menustyle", "user interface for object selection", |
250 |
MENUTYPELEN, SET_IN_GAME }, |
296 |
MENUTYPELEN, SET_IN_GAME }, |
251 |
{ "menu_deselect_all", "deselect all items in a menu", 4, SET_IN_FILE }, |
297 |
{ "menu_deselect_all", "deselect all items in a menu", 4, SET_IN_FILE }, |
Lines 306-314
Link Here
|
306 |
{ "scroll_amount", "amount to scroll map when scroll_margin is reached", |
352 |
{ "scroll_amount", "amount to scroll map when scroll_margin is reached", |
307 |
20, DISP_IN_GAME }, /*WC*/ |
353 |
20, DISP_IN_GAME }, /*WC*/ |
308 |
{ "scroll_margin", "scroll map when this far from the edge", 20, DISP_IN_GAME }, /*WC*/ |
354 |
{ "scroll_margin", "scroll map when this far from the edge", 20, DISP_IN_GAME }, /*WC*/ |
|
|
355 |
#ifdef SORTLOOT |
356 |
{ "sortloot", "sort object selection lists by description", 4, SET_IN_GAME }, |
357 |
#endif |
309 |
#ifdef MSDOS |
358 |
#ifdef MSDOS |
310 |
{ "soundcard", "type of sound card to use", 20, SET_IN_FILE }, |
359 |
{ "soundcard", "type of sound card to use", 20, SET_IN_FILE }, |
311 |
#endif |
360 |
#endif |
|
|
361 |
{ "statuscolor", "set status colors", PL_PSIZ, SET_IN_FILE }, |
312 |
{ "suppress_alert", "suppress alerts about version-specific features", |
362 |
{ "suppress_alert", "suppress alerts about version-specific features", |
313 |
8, SET_IN_GAME }, |
363 |
8, SET_IN_GAME }, |
314 |
{ "tile_width", "width of tiles", 20, DISP_IN_GAME}, /*WC*/ |
364 |
{ "tile_width", "width of tiles", 20, DISP_IN_GAME}, /*WC*/ |
Lines 532-537
Link Here
|
532 |
flags.warnlevel = 1; |
582 |
flags.warnlevel = 1; |
533 |
flags.warntype = 0L; |
583 |
flags.warntype = 0L; |
534 |
|
584 |
|
|
|
585 |
#ifdef SORTLOOT |
586 |
iflags.sortloot = 'n'; |
587 |
#endif |
588 |
|
535 |
/* assert( sizeof flags.inv_order == sizeof def_inv_order ); */ |
589 |
/* assert( sizeof flags.inv_order == sizeof def_inv_order ); */ |
536 |
(void)memcpy((genericptr_t)flags.inv_order, |
590 |
(void)memcpy((genericptr_t)flags.inv_order, |
537 |
(genericptr_t)def_inv_order, sizeof flags.inv_order); |
591 |
(genericptr_t)def_inv_order, sizeof flags.inv_order); |
Lines 551-556
Link Here
|
551 |
*/ |
605 |
*/ |
552 |
/* this detects the IBM-compatible console on most 386 boxes */ |
606 |
/* this detects the IBM-compatible console on most 386 boxes */ |
553 |
if ((opts = nh_getenv("TERM")) && !strncmp(opts, "AT", 2)) { |
607 |
if ((opts = nh_getenv("TERM")) && !strncmp(opts, "AT", 2)) { |
|
|
608 |
iflags.chargfx = IBM_GRAPHICS; |
554 |
switch_graphics(IBM_GRAPHICS); |
609 |
switch_graphics(IBM_GRAPHICS); |
555 |
# ifdef TEXTCOLOR |
610 |
# ifdef TEXTCOLOR |
556 |
iflags.use_color = TRUE; |
611 |
iflags.use_color = TRUE; |
Lines 563-574
Link Here
|
563 |
if ((opts = nh_getenv("TERM")) && |
618 |
if ((opts = nh_getenv("TERM")) && |
564 |
!strncmpi(opts, "vt", 2) && AS && AE && |
619 |
!strncmpi(opts, "vt", 2) && AS && AE && |
565 |
index(AS, '\016') && index(AE, '\017')) { |
620 |
index(AS, '\016') && index(AE, '\017')) { |
|
|
621 |
iflags.chargfx = DEC_GRAPHICS; |
566 |
switch_graphics(DEC_GRAPHICS); |
622 |
switch_graphics(DEC_GRAPHICS); |
567 |
} |
623 |
} |
568 |
# endif |
624 |
# endif |
569 |
#endif /* UNIX || VMS */ |
625 |
#endif /* UNIX || VMS */ |
570 |
|
626 |
|
571 |
#ifdef MAC_GRAPHICS_ENV |
627 |
#ifdef MAC_GRAPHICS_ENV |
|
|
628 |
iflags.chargfx = MAC_GRAPHICS; |
572 |
switch_graphics(MAC_GRAPHICS); |
629 |
switch_graphics(MAC_GRAPHICS); |
573 |
#endif /* MAC_GRAPHICS_ENV */ |
630 |
#endif /* MAC_GRAPHICS_ENV */ |
574 |
flags.menu_style = MENU_FULL; |
631 |
flags.menu_style = MENU_FULL; |
Lines 891-896
Link Here
|
891 |
return 1; |
948 |
return 1; |
892 |
} |
949 |
} |
893 |
|
950 |
|
|
|
951 |
#ifdef MENU_COLOR |
952 |
extern struct menucoloring *menu_colorings; |
953 |
|
954 |
static const struct { |
955 |
const char *name; |
956 |
const int color; |
957 |
} colornames[] = { |
958 |
{"black", CLR_BLACK}, |
959 |
{"red", CLR_RED}, |
960 |
{"green", CLR_GREEN}, |
961 |
{"brown", CLR_BROWN}, |
962 |
{"blue", CLR_BLUE}, |
963 |
{"magenta", CLR_MAGENTA}, |
964 |
{"cyan", CLR_CYAN}, |
965 |
{"gray", CLR_GRAY}, |
966 |
{"orange", CLR_ORANGE}, |
967 |
{"lightgreen", CLR_BRIGHT_GREEN}, |
968 |
{"yellow", CLR_YELLOW}, |
969 |
{"lightblue", CLR_BRIGHT_BLUE}, |
970 |
{"lightmagenta", CLR_BRIGHT_MAGENTA}, |
971 |
{"lightcyan", CLR_BRIGHT_CYAN}, |
972 |
{"white", CLR_WHITE} |
973 |
}; |
974 |
|
975 |
static const struct { |
976 |
const char *name; |
977 |
const int attr; |
978 |
} attrnames[] = { |
979 |
{"none", ATR_NONE}, |
980 |
{"bold", ATR_BOLD}, |
981 |
{"dim", ATR_DIM}, |
982 |
{"underline", ATR_ULINE}, |
983 |
{"blink", ATR_BLINK}, |
984 |
{"inverse", ATR_INVERSE} |
985 |
|
986 |
}; |
987 |
|
988 |
/* parse '"regex_string"=color&attr' and add it to menucoloring */ |
989 |
boolean |
990 |
add_menu_coloring(str) |
991 |
char *str; |
992 |
{ |
993 |
int i, c = NO_COLOR, a = ATR_NONE; |
994 |
struct menucoloring *tmp; |
995 |
char *tmps, *cs = strchr(str, '='); |
996 |
#ifdef MENU_COLOR_REGEX_POSIX |
997 |
int errnum; |
998 |
char errbuf[80]; |
999 |
#endif |
1000 |
const char *err = (char *)0; |
1001 |
|
1002 |
if (!cs || !str) return FALSE; |
1003 |
|
1004 |
tmps = cs; |
1005 |
tmps++; |
1006 |
while (*tmps && isspace(*tmps)) tmps++; |
1007 |
|
1008 |
for (i = 0; i < SIZE(colornames); i++) |
1009 |
if (strstri(tmps, colornames[i].name) == tmps) { |
1010 |
c = colornames[i].color; |
1011 |
break; |
1012 |
} |
1013 |
if ((i == SIZE(colornames)) && (*tmps >= '0' && *tmps <='9')) |
1014 |
c = atoi(tmps); |
1015 |
|
1016 |
if (c > 15) return FALSE; |
1017 |
|
1018 |
tmps = strchr(str, '&'); |
1019 |
if (tmps) { |
1020 |
tmps++; |
1021 |
while (*tmps && isspace(*tmps)) tmps++; |
1022 |
for (i = 0; i < SIZE(attrnames); i++) |
1023 |
if (strstri(tmps, attrnames[i].name) == tmps) { |
1024 |
a = attrnames[i].attr; |
1025 |
break; |
1026 |
} |
1027 |
if ((i == SIZE(attrnames)) && (*tmps >= '0' && *tmps <='9')) |
1028 |
a = atoi(tmps); |
1029 |
} |
1030 |
|
1031 |
*cs = '\0'; |
1032 |
tmps = str; |
1033 |
if ((*tmps == '"') || (*tmps == '\'')) { |
1034 |
cs--; |
1035 |
while (isspace(*cs)) cs--; |
1036 |
if (*cs == *tmps) { |
1037 |
*cs = '\0'; |
1038 |
tmps++; |
1039 |
} |
1040 |
} |
1041 |
|
1042 |
tmp = (struct menucoloring *)alloc(sizeof(struct menucoloring)); |
1043 |
#ifdef MENU_COLOR_REGEX |
1044 |
#ifdef MENU_COLOR_REGEX_POSIX |
1045 |
errnum = regcomp(&tmp->match, tmps, REG_EXTENDED | REG_NOSUB); |
1046 |
if (errnum != 0) |
1047 |
{ |
1048 |
regerror(errnum, &tmp->match, errbuf, sizeof(errbuf)); |
1049 |
err = errbuf; |
1050 |
} |
1051 |
#else |
1052 |
tmp->match.translate = 0; |
1053 |
tmp->match.fastmap = 0; |
1054 |
tmp->match.buffer = 0; |
1055 |
tmp->match.allocated = 0; |
1056 |
tmp->match.regs_allocated = REGS_FIXED; |
1057 |
err = re_compile_pattern(tmps, strlen(tmps), &tmp->match); |
1058 |
#endif |
1059 |
#else |
1060 |
tmp->match = (char *)alloc(strlen(tmps)+1); |
1061 |
(void) memcpy((genericptr_t)tmp->match, (genericptr_t)tmps, strlen(tmps)+1); |
1062 |
#endif |
1063 |
if (err) { |
1064 |
raw_printf("\nMenucolor regex error: %s\n", err); |
1065 |
wait_synch(); |
1066 |
free(tmp); |
1067 |
return FALSE; |
1068 |
} else { |
1069 |
tmp->next = menu_colorings; |
1070 |
tmp->color = c; |
1071 |
tmp->attr = a; |
1072 |
menu_colorings = tmp; |
1073 |
return TRUE; |
1074 |
} |
1075 |
} |
1076 |
#endif /* MENU_COLOR */ |
1077 |
|
894 |
void |
1078 |
void |
895 |
set_duplicate_opt_detection(on_or_off) |
1079 |
set_duplicate_opt_detection(on_or_off) |
896 |
int on_or_off; |
1080 |
int on_or_off; |
Lines 964-969
Link Here
|
964 |
} |
1148 |
} |
965 |
} |
1149 |
} |
966 |
|
1150 |
|
|
|
1151 |
#if defined(STATUS_COLORS) && defined(TEXTCOLOR) |
1152 |
|
1153 |
struct name_value { |
1154 |
char *name; |
1155 |
int value; |
1156 |
}; |
1157 |
|
1158 |
const struct name_value status_colornames[] = { |
1159 |
{ "black", CLR_BLACK }, |
1160 |
{ "red", CLR_RED }, |
1161 |
{ "green", CLR_GREEN }, |
1162 |
{ "brown", CLR_BROWN }, |
1163 |
{ "blue", CLR_BLUE }, |
1164 |
{ "magenta", CLR_MAGENTA }, |
1165 |
{ "cyan", CLR_CYAN }, |
1166 |
{ "gray", CLR_GRAY }, |
1167 |
{ "orange", CLR_ORANGE }, |
1168 |
{ "lightgreen", CLR_BRIGHT_GREEN }, |
1169 |
{ "yellow", CLR_YELLOW }, |
1170 |
{ "lightblue", CLR_BRIGHT_BLUE }, |
1171 |
{ "lightmagenta", CLR_BRIGHT_MAGENTA }, |
1172 |
{ "lightcyan", CLR_BRIGHT_CYAN }, |
1173 |
{ "white", CLR_WHITE }, |
1174 |
{ NULL, -1 } |
1175 |
}; |
1176 |
|
1177 |
const struct name_value status_attrnames[] = { |
1178 |
{ "none", ATR_NONE }, |
1179 |
{ "bold", ATR_BOLD }, |
1180 |
{ "dim", ATR_DIM }, |
1181 |
{ "underline", ATR_ULINE }, |
1182 |
{ "blink", ATR_BLINK }, |
1183 |
{ "inverse", ATR_INVERSE }, |
1184 |
{ NULL, -1 } |
1185 |
}; |
1186 |
|
1187 |
int |
1188 |
value_of_name(name, name_values) |
1189 |
const char *name; |
1190 |
const struct name_value *name_values; |
1191 |
{ |
1192 |
while (name_values->name && !strstri(name_values->name, name)) |
1193 |
++name_values; |
1194 |
return name_values->value; |
1195 |
} |
1196 |
|
1197 |
struct color_option |
1198 |
parse_color_option(start) |
1199 |
char *start; |
1200 |
{ |
1201 |
struct color_option result = {NO_COLOR, 0}; |
1202 |
char last; |
1203 |
char *end; |
1204 |
int attr; |
1205 |
|
1206 |
for (end = start; *end != '&' && *end != '\0'; ++end); |
1207 |
last = *end; |
1208 |
*end = '\0'; |
1209 |
result.color = value_of_name(start, status_colornames); |
1210 |
|
1211 |
while (last == '&') { |
1212 |
for (start = ++end; *end != '&' && *end != '\0'; ++end); |
1213 |
last = *end; |
1214 |
*end = '\0'; |
1215 |
attr = value_of_name(start, status_attrnames); |
1216 |
if (attr >= 0) |
1217 |
result.attr_bits |= 1 << attr; |
1218 |
} |
1219 |
|
1220 |
return result; |
1221 |
} |
1222 |
|
1223 |
const struct percent_color_option *hp_colors = NULL; |
1224 |
const struct percent_color_option *pw_colors = NULL; |
1225 |
const struct text_color_option *text_colors = NULL; |
1226 |
|
1227 |
struct percent_color_option * |
1228 |
add_percent_option(new_option, list_head) |
1229 |
struct percent_color_option *new_option; |
1230 |
struct percent_color_option *list_head; |
1231 |
{ |
1232 |
if (list_head == NULL) |
1233 |
return new_option; |
1234 |
if (new_option->percentage <= list_head->percentage) { |
1235 |
new_option->next = list_head; |
1236 |
return new_option; |
1237 |
} |
1238 |
list_head->next = add_percent_option(new_option, list_head->next); |
1239 |
return list_head; |
1240 |
} |
1241 |
|
1242 |
boolean |
1243 |
parse_status_color_option(start) |
1244 |
char *start; |
1245 |
{ |
1246 |
char *middle; |
1247 |
|
1248 |
while (*start && isspace(*start)) start++; |
1249 |
for (middle = start; *middle != ':' && *middle != '=' && *middle != '\0'; ++middle); |
1250 |
*middle++ = '\0'; |
1251 |
if (middle - start > 2 && start[2] == '%') { |
1252 |
struct percent_color_option *percent_color_option = |
1253 |
(struct percent_color_option *)alloc(sizeof(*percent_color_option)); |
1254 |
percent_color_option->next = NULL; |
1255 |
percent_color_option->percentage = atoi(start + 3); |
1256 |
percent_color_option->color_option = parse_color_option(middle); |
1257 |
start[2] = '\0'; |
1258 |
if (percent_color_option->color_option.color >= 0 |
1259 |
&& percent_color_option->color_option.attr_bits >= 0) { |
1260 |
if (!strcmpi(start, "hp")) { |
1261 |
hp_colors = add_percent_option(percent_color_option, hp_colors); |
1262 |
return TRUE; |
1263 |
} |
1264 |
if (!strcmpi(start, "pw")) { |
1265 |
pw_colors = add_percent_option(percent_color_option, pw_colors); |
1266 |
return TRUE; |
1267 |
} |
1268 |
} |
1269 |
free(percent_color_option); |
1270 |
return FALSE; |
1271 |
} else { |
1272 |
int length = strlen(start) + 1; |
1273 |
struct text_color_option *text_color_option = |
1274 |
(struct text_color_option *)alloc(sizeof(*text_color_option)); |
1275 |
text_color_option->next = NULL; |
1276 |
text_color_option->text = (char *)alloc(length); |
1277 |
memcpy((char *)text_color_option->text, start, length); |
1278 |
text_color_option->color_option = parse_color_option(middle); |
1279 |
if (text_color_option->color_option.color >= 0 |
1280 |
&& text_color_option->color_option.attr_bits >= 0) { |
1281 |
text_color_option->next = text_colors; |
1282 |
text_colors = text_color_option; |
1283 |
return TRUE; |
1284 |
} |
1285 |
free(text_color_option->text); |
1286 |
free(text_color_option); |
1287 |
return FALSE; |
1288 |
} |
1289 |
} |
1290 |
|
1291 |
boolean |
1292 |
parse_status_color_options(start) |
1293 |
char *start; |
1294 |
{ |
1295 |
char last = ','; |
1296 |
char *end = start - 1; |
1297 |
boolean ok = TRUE; |
1298 |
while (last == ',') { |
1299 |
for (start = ++end; *end != ',' && *end != '\0'; ++end); |
1300 |
last = *end; |
1301 |
*end = '\0'; |
1302 |
ok = parse_status_color_option(start) && ok; |
1303 |
} |
1304 |
return ok; |
1305 |
} |
1306 |
|
1307 |
|
1308 |
#endif /* STATUS_COLORS */ |
1309 |
|
967 |
void |
1310 |
void |
968 |
parseoptions(opts, tinitial, tfrom_file) |
1311 |
parseoptions(opts, tinitial, tfrom_file) |
969 |
register char *opts; |
1312 |
register char *opts; |
Lines 1077-1082
Link Here
|
1077 |
return; |
1420 |
return; |
1078 |
} |
1421 |
} |
1079 |
|
1422 |
|
|
|
1423 |
#ifdef DUMP_LOG |
1424 |
fullname = "dumpfile"; |
1425 |
if (match_optname(opts, fullname, 3, TRUE)) { |
1426 |
#ifndef DUMP_FN |
1427 |
if (negated) bad_negation(fullname, FALSE); |
1428 |
else if ((op = string_for_opt(opts, !tfrom_file)) != 0 |
1429 |
&& strlen(op) > 1) |
1430 |
nmcpy(dump_fn, op, PL_PSIZ); |
1431 |
#endif |
1432 |
return; |
1433 |
} |
1434 |
#endif |
1435 |
|
1080 |
fullname = "horsename"; |
1436 |
fullname = "horsename"; |
1081 |
if (match_optname(opts, fullname, 5, TRUE)) { |
1437 |
if (match_optname(opts, fullname, 5, TRUE)) { |
1082 |
if (negated) bad_negation(fullname, FALSE); |
1438 |
if (negated) bad_negation(fullname, FALSE); |
Lines 1114-1119
Link Here
|
1114 |
return; |
1470 |
return; |
1115 |
} |
1471 |
} |
1116 |
|
1472 |
|
|
|
1473 |
fullname = "chargfx"; |
1474 |
if (match_optname(opts, fullname, 5, TRUE)) { |
1475 |
if (negated) { |
1476 |
iflags.chargfx = ASCII_GRAPHICS; |
1477 |
} else if ((op = string_for_opt(opts, FALSE)) != 0) { |
1478 |
int i; |
1479 |
for (i = 0; i < SIZE(chargfx); i++) |
1480 |
if (!strncmpi(op, chargfx[i].txt, strlen(op))) { |
1481 |
iflags.chargfx = chargfx[i].gfx; |
1482 |
need_redraw = TRUE; |
1483 |
# ifdef REINCARNATION |
1484 |
if (!initial && Is_rogue_level(&u.uz)) |
1485 |
assign_rogue_graphics(FALSE); |
1486 |
# endif |
1487 |
switch_graphics(iflags.chargfx); |
1488 |
# ifdef REINCARNATION |
1489 |
if (!initial && Is_rogue_level(&u.uz)) |
1490 |
assign_rogue_graphics(TRUE); |
1491 |
# endif |
1492 |
return; |
1493 |
} |
1494 |
badoption(opts); |
1495 |
} |
1496 |
return; |
1497 |
} |
1498 |
|
1117 |
fullname = "runmode"; |
1499 |
fullname = "runmode"; |
1118 |
if (match_optname(opts, fullname, 4, TRUE)) { |
1500 |
if (match_optname(opts, fullname, 4, TRUE)) { |
1119 |
if (negated) { |
1501 |
if (negated) { |
Lines 1133-1138
Link Here
|
1133 |
return; |
1515 |
return; |
1134 |
} |
1516 |
} |
1135 |
|
1517 |
|
|
|
1518 |
/* menucolor:"regex_string"=color */ |
1519 |
fullname = "menucolor"; |
1520 |
if (match_optname(opts, fullname, 9, TRUE)) { |
1521 |
#ifdef MENU_COLOR |
1522 |
if (negated) bad_negation(fullname, FALSE); |
1523 |
else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) |
1524 |
if (!add_menu_coloring(op)) |
1525 |
badoption(opts); |
1526 |
#endif |
1527 |
return; |
1528 |
} |
1529 |
|
1530 |
fullname = "statuscolor"; |
1531 |
if (match_optname(opts, fullname, 11, TRUE)) { |
1532 |
#if defined(STATUS_COLORS) && defined(TEXTCOLOR) |
1533 |
if (negated) bad_negation(fullname, FALSE); |
1534 |
else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) |
1535 |
if (!parse_status_color_options(op)) |
1536 |
badoption(opts); |
1537 |
#endif |
1538 |
return; |
1539 |
} |
1540 |
|
1136 |
fullname = "msghistory"; |
1541 |
fullname = "msghistory"; |
1137 |
if (match_optname(opts, fullname, 3, TRUE)) { |
1542 |
if (match_optname(opts, fullname, 3, TRUE)) { |
1138 |
op = string_for_env_opt(fullname, opts, negated); |
1543 |
op = string_for_env_opt(fullname, opts, negated); |
Lines 1839-1844
Link Here
|
1839 |
return; |
2244 |
return; |
1840 |
} |
2245 |
} |
1841 |
|
2246 |
|
|
|
2247 |
#ifdef SORTLOOT |
2248 |
fullname = "sortloot"; |
2249 |
if (match_optname(opts, fullname, 4, TRUE)) { |
2250 |
op = string_for_env_opt(fullname, opts, FALSE); |
2251 |
if (op) { |
2252 |
switch (tolower(*op)) { |
2253 |
case 'n': |
2254 |
case 'l': |
2255 |
case 'f': iflags.sortloot = tolower(*op); |
2256 |
break; |
2257 |
default: badoption(opts); |
2258 |
return; |
2259 |
} |
2260 |
} |
2261 |
return; |
2262 |
} |
2263 |
#endif /* SORTLOOT */ |
2264 |
|
1842 |
fullname = "suppress_alert"; |
2265 |
fullname = "suppress_alert"; |
1843 |
if (match_optname(opts, fullname, 4, TRUE)) { |
2266 |
if (match_optname(opts, fullname, 4, TRUE)) { |
1844 |
op = string_for_opt(opts, negated); |
2267 |
op = string_for_opt(opts, negated); |
Lines 2168-2186
Link Here
|
2168 |
need_redraw = TRUE; |
2591 |
need_redraw = TRUE; |
2169 |
# ifdef TERMLIB |
2592 |
# ifdef TERMLIB |
2170 |
if ((boolopt[i].addr) == &iflags.DECgraphics) |
2593 |
if ((boolopt[i].addr) == &iflags.DECgraphics) |
2171 |
switch_graphics(iflags.DECgraphics ? |
2594 |
iflags.chargfx = iflags.DECgraphics ? |
2172 |
DEC_GRAPHICS : ASCII_GRAPHICS); |
2595 |
DEC_GRAPHICS : ASCII_GRAPHICS; |
2173 |
# endif |
2596 |
# endif |
2174 |
# ifdef ASCIIGRAPH |
2597 |
# ifdef ASCIIGRAPH |
2175 |
if ((boolopt[i].addr) == &iflags.IBMgraphics) |
2598 |
if ((boolopt[i].addr) == &iflags.IBMgraphics) |
2176 |
switch_graphics(iflags.IBMgraphics ? |
2599 |
iflags.chargfx = iflags.IBMgraphics ? |
2177 |
IBM_GRAPHICS : ASCII_GRAPHICS); |
2600 |
IBM_GRAPHICS : ASCII_GRAPHICS; |
2178 |
# endif |
2601 |
# endif |
2179 |
# ifdef MAC_GRAPHICS_ENV |
2602 |
# ifdef MAC_GRAPHICS_ENV |
2180 |
if ((boolopt[i].addr) == &iflags.MACgraphics) |
2603 |
if ((boolopt[i].addr) == &iflags.MACgraphics) |
2181 |
switch_graphics(iflags.MACgraphics ? |
2604 |
iflags.chargfx = iflags.MACgraphics ? |
2182 |
MAC_GRAPHICS : ASCII_GRAPHICS); |
2605 |
MAC_GRAPHICS : ASCII_GRAPHICS; |
2183 |
# endif |
2606 |
# endif |
|
|
2607 |
switch_graphics(iflags.chargfx); |
2184 |
# ifdef REINCARNATION |
2608 |
# ifdef REINCARNATION |
2185 |
if (!initial && Is_rogue_level(&u.uz)) |
2609 |
if (!initial && Is_rogue_level(&u.uz)) |
2186 |
assign_rogue_graphics(TRUE); |
2610 |
assign_rogue_graphics(TRUE); |
Lines 2263-2268
Link Here
|
2263 |
"teleport", "run", "walk", "crawl" |
2687 |
"teleport", "run", "walk", "crawl" |
2264 |
}; |
2688 |
}; |
2265 |
|
2689 |
|
|
|
2690 |
#ifdef SORTLOOT |
2691 |
static NEARDATA const char *sortltype[] = { |
2692 |
"none", "loot", "full" |
2693 |
}; |
2694 |
#endif |
2695 |
|
2266 |
/* |
2696 |
/* |
2267 |
* Convert the given string of object classes to a string of default object |
2697 |
* Convert the given string of object classes to a string of default object |
2268 |
* symbols. |
2698 |
* symbols. |
Lines 2540-2546
Link Here
|
2540 |
boolean retval = FALSE; |
2970 |
boolean retval = FALSE; |
2541 |
|
2971 |
|
2542 |
/* Special handling of menustyle, pickup_burden, pickup_types, |
2972 |
/* Special handling of menustyle, pickup_burden, pickup_types, |
2543 |
* disclose, runmode, msg_window, menu_headings, and number_pad options. |
2973 |
* disclose, runmode, msg_window, menu_headings, number_pad and sortloot |
2544 |
#ifdef AUTOPICKUP_EXCEPTIONS |
2974 |
#ifdef AUTOPICKUP_EXCEPTIONS |
2545 |
* Also takes care of interactive autopickup_exception_handling changes. |
2975 |
* Also takes care of interactive autopickup_exception_handling changes. |
2546 |
#endif |
2976 |
#endif |
Lines 2565-2570
Link Here
|
2565 |
} |
2995 |
} |
2566 |
destroy_nhwindow(tmpwin); |
2996 |
destroy_nhwindow(tmpwin); |
2567 |
retval = TRUE; |
2997 |
retval = TRUE; |
|
|
2998 |
} else if (!strcmp("chargfx", optname)) { |
2999 |
menu_item *gfx_pick = (menu_item *)0; |
3000 |
tmpwin = create_nhwindow(NHW_MENU); |
3001 |
start_menu(tmpwin); |
3002 |
for (i = 0; i < SIZE(chargfx); i++) { |
3003 |
const char *t = chargfx[i].txt; |
3004 |
any.a_int = chargfx[i].gfx + 1; |
3005 |
add_menu(tmpwin, NO_GLYPH, &any, chargfx[i].let, 0, ATR_NONE, t, MENU_UNSELECTED); |
3006 |
} |
3007 |
end_menu(tmpwin, "Select character graphics type"); |
3008 |
if (select_menu(tmpwin, PICK_ONE, &gfx_pick) > 0) { |
3009 |
iflags.chargfx = gfx_pick->item.a_int-1; |
3010 |
# ifdef REINCARNATION |
3011 |
if (Is_rogue_level(&u.uz)) |
3012 |
assign_rogue_graphics(FALSE); |
3013 |
# endif |
3014 |
switch_graphics(iflags.chargfx); |
3015 |
# ifdef REINCARNATION |
3016 |
if (Is_rogue_level(&u.uz)) |
3017 |
assign_rogue_graphics(TRUE); |
3018 |
# endif |
3019 |
need_redraw = TRUE; |
3020 |
free((genericptr_t)gfx_pick); |
3021 |
} |
3022 |
destroy_nhwindow(tmpwin); |
3023 |
retval = TRUE; |
2568 |
} else if (!strcmp("pickup_burden", optname)) { |
3024 |
} else if (!strcmp("pickup_burden", optname)) { |
2569 |
const char *burden_name, *burden_letters = "ubsntl"; |
3025 |
const char *burden_name, *burden_letters = "ubsntl"; |
2570 |
menu_item *burden_pick = (menu_item *)0; |
3026 |
menu_item *burden_pick = (menu_item *)0; |
Lines 2761-2766
Link Here
|
2761 |
} |
3217 |
} |
2762 |
destroy_nhwindow(tmpwin); |
3218 |
destroy_nhwindow(tmpwin); |
2763 |
retval = TRUE; |
3219 |
retval = TRUE; |
|
|
3220 |
#ifdef SORTLOOT |
3221 |
} else if (!strcmp("sortloot", optname)) { |
3222 |
const char *sortl_name; |
3223 |
menu_item *sortl_pick = (menu_item *)0; |
3224 |
tmpwin = create_nhwindow(NHW_MENU); |
3225 |
start_menu(tmpwin); |
3226 |
for (i = 0; i < SIZE(sortltype); i++) { |
3227 |
sortl_name = sortltype[i]; |
3228 |
any.a_char = *sortl_name; |
3229 |
add_menu(tmpwin, NO_GLYPH, &any, *sortl_name, 0, |
3230 |
ATR_NONE, sortl_name, MENU_UNSELECTED); |
3231 |
} |
3232 |
end_menu(tmpwin, "Select loot sorting type:"); |
3233 |
if (select_menu(tmpwin, PICK_ONE, &sortl_pick) > 0) { |
3234 |
iflags.sortloot = sortl_pick->item.a_char; |
3235 |
free((genericptr_t)sortl_pick); |
3236 |
} |
3237 |
destroy_nhwindow(tmpwin); |
3238 |
retval = TRUE; |
3239 |
#endif /* SORTLOOT */ |
2764 |
} else if (!strcmp("menu_headings", optname)) { |
3240 |
} else if (!strcmp("menu_headings", optname)) { |
2765 |
static const char *mhchoices[3] = {"bold", "inverse", "underline"}; |
3241 |
static const char *mhchoices[3] = {"bold", "inverse", "underline"}; |
2766 |
const char *npletters = "biu"; |
3242 |
const char *npletters = "biu"; |
Lines 2875-2880
Link Here
|
2875 |
retval = TRUE; |
3351 |
retval = TRUE; |
2876 |
#endif /* AUTOPICKUP_EXCEPTIONS */ |
3352 |
#endif /* AUTOPICKUP_EXCEPTIONS */ |
2877 |
} |
3353 |
} |
|
|
3354 |
if (need_redraw) |
3355 |
(void) doredraw(); |
2878 |
return retval; |
3356 |
return retval; |
2879 |
} |
3357 |
} |
2880 |
|
3358 |
|
Lines 2920-2926
Link Here
|
2920 |
iflags.bouldersym : oc_syms[(int)objects[BOULDER].oc_class]); |
3398 |
iflags.bouldersym : oc_syms[(int)objects[BOULDER].oc_class]); |
2921 |
else if (!strcmp(optname, "catname")) |
3399 |
else if (!strcmp(optname, "catname")) |
2922 |
Sprintf(buf, "%s", catname[0] ? catname : none ); |
3400 |
Sprintf(buf, "%s", catname[0] ? catname : none ); |
2923 |
else if (!strcmp(optname, "disclose")) { |
3401 |
else if (!strcmp(optname, "chargfx")) { |
|
|
3402 |
Sprintf(buf, "Unknown"); |
3403 |
for (i = 0; i < SIZE(chargfx); i++) |
3404 |
if (iflags.chargfx == chargfx[i].gfx) { |
3405 |
Sprintf(buf, "%s", chargfx[i].txt); |
3406 |
break; |
3407 |
} |
3408 |
} else if (!strcmp(optname, "disclose")) { |
2924 |
for (i = 0; i < NUM_DISCLOSURE_OPTIONS; i++) { |
3409 |
for (i = 0; i < NUM_DISCLOSURE_OPTIONS; i++) { |
2925 |
char topt[2]; |
3410 |
char topt[2]; |
2926 |
if (i) Strcat(buf," "); |
3411 |
if (i) Strcat(buf," "); |
Lines 2933-2938
Link Here
|
2933 |
} |
3418 |
} |
2934 |
else if (!strcmp(optname, "dogname")) |
3419 |
else if (!strcmp(optname, "dogname")) |
2935 |
Sprintf(buf, "%s", dogname[0] ? dogname : none ); |
3420 |
Sprintf(buf, "%s", dogname[0] ? dogname : none ); |
|
|
3421 |
#ifdef DUMP_LOG |
3422 |
else if (!strcmp(optname, "dumpfile")) |
3423 |
Sprintf(buf, "%s", dump_fn[0] ? dump_fn: none ); |
3424 |
#endif |
2936 |
else if (!strcmp(optname, "dungeon")) |
3425 |
else if (!strcmp(optname, "dungeon")) |
2937 |
Sprintf(buf, "%s", to_be_done); |
3426 |
Sprintf(buf, "%s", to_be_done); |
2938 |
else if (!strcmp(optname, "effects")) |
3427 |
else if (!strcmp(optname, "effects")) |
Lines 3072-3077
Link Here
|
3072 |
if (iflags.wc_scroll_margin) Sprintf(buf, "%d",iflags.wc_scroll_margin); |
3561 |
if (iflags.wc_scroll_margin) Sprintf(buf, "%d",iflags.wc_scroll_margin); |
3073 |
else Strcpy(buf, defopt); |
3562 |
else Strcpy(buf, defopt); |
3074 |
} |
3563 |
} |
|
|
3564 |
#ifdef SORTLOOT |
3565 |
else if (!strcmp(optname, "sortloot")) { |
3566 |
char *sortname = (char *)NULL; |
3567 |
for (i=0; i < SIZE(sortltype) && sortname==(char *)NULL; i++) { |
3568 |
if (iflags.sortloot == sortltype[i][0]) |
3569 |
sortname = (char *)sortltype[i]; |
3570 |
} |
3571 |
if (sortname != (char *)NULL) |
3572 |
Sprintf(buf, "%s", sortname); |
3573 |
} |
3574 |
#endif /* SORTLOOT */ |
3075 |
else if (!strcmp(optname, "player_selection")) |
3575 |
else if (!strcmp(optname, "player_selection")) |
3076 |
Sprintf(buf, "%s", iflags.wc_player_selection ? "prompts" : "dialog"); |
3576 |
Sprintf(buf, "%s", iflags.wc_player_selection ? "prompts" : "dialog"); |
3077 |
#ifdef MSDOS |
3577 |
#ifdef MSDOS |
Lines 3262-3267
Link Here
|
3262 |
} |
3762 |
} |
3263 |
#endif /* AUTOPICKUP_EXCEPTIONS */ |
3763 |
#endif /* AUTOPICKUP_EXCEPTIONS */ |
3264 |
|
3764 |
|
|
|
3765 |
#ifdef DYNKEY |
3766 |
void |
3767 |
add_dkb(bufp, swap) |
3768 |
char *bufp; |
3769 |
boolean swap; |
3770 |
{ |
3771 |
char *p; |
3772 |
char b, c; |
3773 |
|
3774 |
if(!(p=index(bufp,' '))) { |
3775 |
raw_printf("DYNKEY MAP: bad mapping: %s.", bufp); |
3776 |
return; |
3777 |
} |
3778 |
*p++='\0'; |
3779 |
|
3780 |
b=keydesc2char(bufp); |
3781 |
c=keydesc2char(p); |
3782 |
if(b && c) { |
3783 |
if(!map_dkb(b, c) || (swap && !map_dkb(c, b))) |
3784 |
raw_printf("DYNKEY MAP: map_dkb error"); |
3785 |
} else |
3786 |
raw_printf("DYNKEY MAP: invalid key: %s.", b==0?bufp:p); |
3787 |
} |
3788 |
#endif /* DYNKEY */ |
3789 |
|
3265 |
/* data for option_help() */ |
3790 |
/* data for option_help() */ |
3266 |
static const char *opt_intro[] = { |
3791 |
static const char *opt_intro[] = { |
3267 |
"", |
3792 |
"", |