1 /* NetHack 3.6 options.c $NHDT-Date: 1578996303 2020/01/14 10:05:03 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.396 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /*-Copyright (c) Michael Allison, 2008. */
4 /* NetHack may be freely redistributed. See license for details. */
6 /* JNetHack Copyright */
7 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000 */
8 /* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2020 */
9 /* JNetHack may be freely redistributed. See license for details. */
11 #ifdef OPTION_LISTS_ONLY /* (AMIGA) external program for opt lists */
15 NEARDATA struct flag flags; /* provide linkage */
17 NEARDATA struct sysflag sysflags; /* provide linkage */
19 NEARDATA struct instance_flags iflags; /* provide linkage */
27 #define BACKWARD_COMPAT
29 #ifdef DEFAULT_WC_TILED_MAP
30 #define PREFER_TILED TRUE
32 #define PREFER_TILED FALSE
35 #ifdef CURSES_GRAPHICS
36 extern int curses_read_attrs(const char *attrs);
37 extern char *curses_fmt_attrs(char *);
40 enum window_option_types {
48 #define PILE_LIMIT_DFLT 5
50 static char empty_optstr[] = { '\0' };
53 * NOTE: If you add (or delete) an option, please update the short
54 * options help (option_help()), the long options help (dat/opthelp),
55 * and the current options setting display function (doset()),
56 * and also the Guidebooks.
58 * The order matters. If an option is a an initial substring of another
59 * option (e.g. time and timed_delay) the shorter one must come first.
62 static struct Bool_Opt {
64 boolean *addr, initvalue;
67 { "acoustics", &flags.acoustics, TRUE, SET_IN_GAME },
68 #if defined(SYSFLAGS) && defined(AMIGA)
69 /* Amiga altmeta causes Alt+key to be converted into Meta+key by
70 low level nethack code; on by default, can be toggled off if
71 Alt+key is needed for some ASCII chars on non-ASCII keyboard */
72 { "altmeta", &sysflags.altmeta, TRUE, DISP_IN_GAME },
75 /* non-Amiga altmeta causes nethack's top level command loop to treat
76 two character sequence "ESC c" as M-c, for terminals or emulators
77 which send "ESC c" when Alt+c is pressed; off by default, enabling
78 this can potentially make trouble if user types ESC when nethack
79 is honoring this conversion request (primarily after starting a
80 count prefix prior to a command and then deciding to cancel it) */
81 { "altmeta", &iflags.altmeta, FALSE, SET_IN_GAME },
83 { "altmeta", (boolean *) 0, TRUE, DISP_IN_GAME },
86 { "ascii_map", &iflags.wc_ascii_map, !PREFER_TILED, SET_IN_GAME }, /*WC*/
87 #if defined(SYSFLAGS) && defined(MFLOPPY)
88 { "asksavedisk", &sysflags.asksavedisk, FALSE, SET_IN_GAME },
90 { "asksavedisk", (boolean *) 0, FALSE, SET_IN_FILE },
92 { "autodescribe", &iflags.autodescribe, TRUE, SET_IN_GAME },
93 { "autodig", &flags.autodig, FALSE, SET_IN_GAME },
94 { "autoopen", &flags.autoopen, TRUE, SET_IN_GAME },
95 { "autopickup", &flags.pickup, TRUE, SET_IN_GAME },
96 { "autoquiver", &flags.autoquiver, FALSE, SET_IN_GAME },
97 #if defined(MICRO) && !defined(AMIGA)
98 { "BIOS", &iflags.BIOS, FALSE, SET_IN_FILE },
100 { "BIOS", (boolean *) 0, FALSE, SET_IN_FILE },
102 { "blind", &u.uroleplay.blind, FALSE, DISP_IN_GAME },
103 { "bones", &flags.bones, TRUE, SET_IN_FILE },
105 { "checkpoint", &flags.ins_chkpt, TRUE, SET_IN_GAME },
107 { "checkpoint", (boolean *) 0, FALSE, SET_IN_FILE },
110 { "checkspace", &iflags.checkspace, TRUE, SET_IN_GAME },
112 { "checkspace", (boolean *) 0, FALSE, SET_IN_FILE },
114 { "clicklook", &iflags.clicklook, FALSE, SET_IN_GAME },
115 { "cmdassist", &iflags.cmdassist, TRUE, SET_IN_GAME },
116 #if defined(MICRO) || defined(WIN32) || defined(CURSES_GRAPHICS)
117 { "color", &iflags.wc_color, TRUE, SET_IN_GAME }, /* on/off: use WC or not */
118 #else /* systems that support multiple terminals, many monochrome */
119 { "color", &iflags.wc_color, FALSE, SET_IN_GAME },
121 { "confirm", &flags.confirm, TRUE, SET_IN_GAME },
122 { "dark_room", &flags.dark_room, TRUE, SET_IN_GAME },
123 { "eight_bit_tty", &iflags.wc_eight_bit_input, FALSE, SET_IN_GAME }, /*WC*/
124 #if defined(TTY_GRAPHICS) || defined(CURSES_GRAPHICS) || defined(X11_GRAPHICS)
125 { "extmenu", &iflags.extmenu, FALSE, SET_IN_GAME },
127 { "extmenu", (boolean *) 0, FALSE, SET_IN_FILE },
130 { "fast_map", &flags.fast_map, TRUE, SET_IN_GAME },
132 { "fast_map", (boolean *) 0, TRUE, SET_IN_FILE },
134 { "female", &flags.female, FALSE, DISP_IN_GAME },
135 { "fixinv", &flags.invlet_constant, TRUE, SET_IN_GAME },
136 #if defined(SYSFLAGS) && defined(AMIFLUSH)
137 { "flush", &sysflags.amiflush, FALSE, SET_IN_GAME },
139 { "flush", (boolean *) 0, FALSE, SET_IN_FILE },
141 { "force_invmenu", &iflags.force_invmenu, FALSE, SET_IN_GAME },
142 { "fullscreen", &iflags.wc2_fullscreen, FALSE, SET_IN_FILE }, /*WC2*/
143 { "goldX", &iflags.goldX, FALSE, SET_IN_GAME },
144 { "guicolor", &iflags.wc2_guicolor, TRUE, SET_IN_GAME}, /*WC2*/
145 { "help", &flags.help, TRUE, SET_IN_GAME },
146 { "herecmd_menu", &iflags.herecmd_menu, FALSE, SET_IN_GAME },
147 { "hilite_pet", &iflags.wc_hilite_pet, FALSE, SET_IN_GAME }, /*WC*/
148 { "hilite_pile", &iflags.hilite_pile, FALSE, SET_IN_GAME },
149 { "hitpointbar", &iflags.wc2_hitpointbar, FALSE, SET_IN_GAME }, /*WC2*/
151 { "ignintr", &flags.ignintr, FALSE, SET_IN_GAME },
153 { "ignintr", (boolean *) 0, FALSE, SET_IN_FILE },
155 { "implicit_uncursed", &iflags.implicit_uncursed, TRUE, SET_IN_GAME },
156 { "large_font", &iflags.obsolete, FALSE, SET_IN_FILE }, /* OBSOLETE */
157 { "legacy", &flags.legacy, TRUE, DISP_IN_GAME },
158 { "lit_corridor", &flags.lit_corridor, FALSE, SET_IN_GAME },
159 { "lootabc", &flags.lootabc, FALSE, SET_IN_GAME },
161 { "mail", &flags.biff, TRUE, SET_IN_GAME },
163 { "mail", (boolean *) 0, TRUE, SET_IN_FILE },
165 { "mention_walls", &iflags.mention_walls, FALSE, SET_IN_GAME },
166 { "menucolors", &iflags.use_menu_color, FALSE, SET_IN_GAME },
167 /* for menu debugging only*/
168 { "menu_tab_sep", &iflags.menu_tab_sep, FALSE, SET_IN_WIZGAME },
169 { "menu_objsyms", &iflags.menu_head_objsym, FALSE, SET_IN_GAME },
171 { "menu_overlay", &iflags.menu_overlay, TRUE, SET_IN_GAME },
173 { "menu_overlay", (boolean *) 0, FALSE, SET_IN_FILE },
175 { "monpolycontrol", &iflags.mon_polycontrol, FALSE, SET_IN_WIZGAME },
177 { "news", &iflags.news, TRUE, DISP_IN_GAME },
179 { "news", (boolean *) 0, FALSE, SET_IN_FILE },
181 { "nudist", &u.uroleplay.nudist, FALSE, DISP_IN_GAME },
182 { "null", &flags.null, TRUE, SET_IN_GAME },
183 #if defined(SYSFLAGS) && defined(MAC)
184 { "page_wait", &sysflags.page_wait, TRUE, SET_IN_GAME },
186 { "page_wait", (boolean *) 0, FALSE, SET_IN_FILE },
188 /* moved perm_invent from flags to iflags and out of save file in 3.6.2 */
189 { "perm_invent", &iflags.perm_invent, FALSE, SET_IN_GAME },
190 { "pickup_thrown", &flags.pickup_thrown, TRUE, SET_IN_GAME },
191 { "popup_dialog", &iflags.wc_popup_dialog, FALSE, SET_IN_GAME }, /*WC*/
192 { "preload_tiles", &iflags.wc_preload_tiles, TRUE, DISP_IN_GAME }, /*WC*/
193 { "pushweapon", &flags.pushweapon, FALSE, SET_IN_GAME },
194 #if defined(MICRO) && !defined(AMIGA)
195 { "rawio", &iflags.rawio, FALSE, DISP_IN_GAME },
197 { "rawio", (boolean *) 0, FALSE, SET_IN_FILE },
199 { "rest_on_space", &flags.rest_on_space, FALSE, SET_IN_GAME },
201 { "rlecomp", &iflags.rlecomp,
202 #if defined(COMPRESS) || defined(ZLIB_COMP)
209 { "safe_pet", &flags.safe_dog, TRUE, SET_IN_GAME },
210 { "sanity_check", &iflags.sanity_check, FALSE, SET_IN_WIZGAME },
211 { "selectsaved", &iflags.wc2_selectsaved, TRUE, DISP_IN_GAME }, /*WC*/
212 { "showexp", &flags.showexp, FALSE, SET_IN_GAME },
213 { "showrace", &flags.showrace, FALSE, SET_IN_GAME },
215 { "showscore", &flags.showscore, FALSE, SET_IN_GAME },
217 { "showscore", (boolean *) 0, FALSE, SET_IN_FILE },
219 { "silent", &flags.silent, TRUE, SET_IN_GAME },
220 { "softkeyboard", &iflags.wc2_softkeyboard, FALSE, SET_IN_FILE }, /*WC2*/
221 { "sortpack", &flags.sortpack, TRUE, SET_IN_GAME },
222 { "sparkle", &flags.sparkle, TRUE, SET_IN_GAME },
223 { "splash_screen", &iflags.wc_splash_screen, TRUE, DISP_IN_GAME }, /*WC*/
224 { "standout", &flags.standout, FALSE, SET_IN_GAME },
225 { "status_updates", &iflags.status_updates, TRUE, DISP_IN_GAME },
226 { "tiled_map", &iflags.wc_tiled_map, PREFER_TILED, DISP_IN_GAME }, /*WC*/
227 { "time", &flags.time, FALSE, SET_IN_GAME },
229 { "timed_delay", &flags.nap, TRUE, SET_IN_GAME },
231 { "timed_delay", (boolean *) 0, FALSE, SET_IN_GAME },
233 { "tombstone", &flags.tombstone, TRUE, SET_IN_GAME },
234 { "toptenwin", &iflags.toptenwin, FALSE, SET_IN_GAME },
235 { "travel", &flags.travelcmd, TRUE, SET_IN_GAME },
237 { "travel_debug", &iflags.trav_debug, FALSE, SET_IN_WIZGAME }, /*hack.c*/
239 { "use_darkgray", &iflags.wc2_darkgray, TRUE, SET_IN_FILE }, /*WC2*/
241 { "use_inverse", &iflags.wc_inverse, TRUE, SET_IN_GAME }, /*WC*/
243 { "use_inverse", &iflags.wc_inverse, FALSE, SET_IN_GAME }, /*WC*/
245 { "verbose", &flags.verbose, TRUE, SET_IN_GAME },
246 #ifdef TTY_TILES_ESCCODES
247 { "vt_tiledata", &iflags.vt_tiledata, FALSE, SET_IN_FILE },
249 { "vt_tiledata", (boolean *) 0, FALSE, SET_IN_FILE },
251 { "whatis_menu", &iflags.getloc_usemenu, FALSE, SET_IN_GAME },
252 { "whatis_moveskip", &iflags.getloc_moveskip, FALSE, SET_IN_GAME },
253 { "wizweight", &iflags.wizweight, FALSE, SET_IN_WIZGAME },
254 { "wraptext", &iflags.wc2_wraptext, FALSE, SET_IN_GAME }, /*WC2*/
256 { "zerocomp", &iflags.zerocomp,
257 #if defined(COMPRESS) || defined(ZLIB_COMP)
264 { (char *) 0, (boolean *) 0, FALSE, 0 }
267 /* compound options, for option_help() and external programs like Amiga
269 static struct Comp_Opt {
270 const char *name, *descr;
271 int size; /* for frontends and such allocating space --
272 * usually allowed size of data in game, but
273 * occasionally maximum reasonable size for
274 * typing when game maintains information in
275 * a different format */
279 { "align", "your starting alignment (lawful, neutral, or chaotic)", 8,
281 { "align", "
\83Q
\81[
\83\80\83X
\83^
\81[
\83g
\8e\9e\82Ì
\91®
\90« (lawful, neutral, or chaotic
\82Ì
\82¢
\82¸
\82ê
\82©)", 8,
284 { "align_message", "message window alignment", 20, DISP_IN_GAME }, /*WC*/
286 { "align_message", "
\83\81\83b
\83Z
\81[
\83W
\83E
\83B
\83\93\83h
\83E
\82Ì
\91µ
\82¦", 20, DISP_IN_GAME }, /*WC*/
289 { "align_status", "status window alignment", 20, DISP_IN_GAME }, /*WC*/
291 { "align_status", "
\8fó
\8bµ
\83E
\83B
\83\93\83h
\83E
\82Ì
\91µ
\82¦", 20, DISP_IN_GAME }, /*WC*/
294 { "altkeyhandler", "alternate key handler", 20, SET_IN_GAME },
296 { "altkeyhandler", "ALT
\83L
\81[
\83n
\83\93\83h
\83\89", 20, SET_IN_GAME },
297 #ifdef BACKWARD_COMPAT
299 { "boulder", "deprecated (use S_boulder in sym file instead)", 1,
301 { "boulder", "
\8b\90\8aâ
\82ð
\95\
\8e¦
\82·
\82é
\83V
\83\93\83{
\83\8b\95¶
\8e\9a", 1,
305 { "catname", "the name of your (first) cat (e.g., catname:Tabby)",
307 { "catname", "
\96`
\8c¯
\82ð
\8b\9f\82É
\82·
\82é(
\8dÅ
\8f\89\82Ì)
\94L
\82Ì
\96¼
\91O (
\97á catname:
\82½
\82Ü)",
308 PL_PSIZ, DISP_IN_GAME },
310 { "disclose", "the kinds of information to disclose at end of game",
312 { "disclose", "
\83Q
\81[
\83\80\8fI
\97¹
\8e\9e\82É
\8c©
\82é
\8fî
\95ñ
\82Ì
\8eí
\97Þ",
313 sizeof flags.end_disclose * 2, SET_IN_GAME },
315 { "dogname", "the name of your (first) dog (e.g., dogname:Fang)", PL_PSIZ,
317 { "dogname", "
\96`
\8c¯
\82ð
\8b\9f\82É
\82·
\82é(
\8dÅ
\8f\89\82Ì)
\8c¢
\82Ì
\96¼
\91O (
\97á dogname:
\83|
\83`)", PL_PSIZ,
320 { "dungeon", "the symbols to use in drawing the dungeon map",
322 { "dungeon", "
\83_
\83\93\83W
\83\87\83\93\82ð
\95`
\89æ
\82·
\82é
\83V
\83\93\83{
\83\8b\95¶
\8e\9a",
323 MAXDCHARS + 1, SET_IN_FILE },
325 { "effects", "the symbols to use in drawing special effects",
327 { "effects", "
\93Á
\8eê
\8cø
\89Ê
\82ð
\95`
\89æ
\82·
\82é
\83V
\83\93\83{
\83\8b\95¶
\8e\9a",
328 MAXECHARS + 1, SET_IN_FILE },
330 { "font_map", "the font to use in the map window", 40,
332 { "font_map", "
\83}
\83b
\83v
\83E
\83B
\83\93\83h
\83E
\82É
\8eg
\97p
\82·
\82é
\83t
\83H
\83\93\83g", 40,
333 DISP_IN_GAME }, /*WC*/
335 { "font_menu", "the font to use in menus", 40, DISP_IN_GAME }, /*WC*/
337 { "font_menu", "
\83\81\83j
\83\85\81[
\82É
\8eg
\97p
\82·
\82é
\83t
\83H
\83\93\83g", 40, DISP_IN_GAME }, /*WC*/
340 { "font_message", "the font to use in the message window", 40,
342 { "font_message", "
\83\81\83b
\83Z
\81[
\83W
\83E
\83B
\83\93\83h
\83E
\82É
\8eg
\97p
\82·
\82é
\83t
\83H
\83\93\83g", 40,
343 DISP_IN_GAME }, /*WC*/
345 { "font_size_map", "the size of the map font", 20, DISP_IN_GAME }, /*WC*/
347 { "font_size_map", "
\83}
\83b
\83v
\83t
\83H
\83\93\83g
\82Ì
\83T
\83C
\83Y", 20, DISP_IN_GAME }, /*WC*/
350 { "font_size_menu", "the size of the menu font", 20,
352 { "font_size_menu", "
\83\81\83j
\83\85\81[
\83t
\83H
\83\93\83g
\82Ì
\83T
\83C
\83Y", 20,
353 DISP_IN_GAME }, /*WC*/
355 { "font_size_message", "the size of the message font", 20,
357 { "font_size_message", "
\83\81\83b
\83Z
\81[
\83W
\83t
\83H
\83\93\83g
\82Ì
\83T
\83C
\83Y", 20,
358 DISP_IN_GAME }, /*WC*/
360 { "font_size_status", "the size of the status font", 20,
362 { "font_size_status", "
\8fó
\8bµ
\83t
\83H
\83\93\83g
\82Ì
\83T
\83C
\83Y", 20,
363 DISP_IN_GAME }, /*WC*/
365 { "font_size_text", "the size of the text font", 20,
367 { "font_size_text", "
\83e
\83L
\83X
\83g
\83t
\83H
\83\93\83g
\82Ì
\83T
\83C
\83Y", 20,
368 DISP_IN_GAME }, /*WC*/
370 { "font_status", "the font to use in status window", 40,
372 { "font_status", "
\8fó
\8bµ
\83E
\83B
\83\93\83h
\83E
\82É
\8eg
\97p
\82·
\82é
\83t
\83H
\83\93\83g", 40,
373 DISP_IN_GAME }, /*WC*/
375 { "font_text", "the font to use in text windows", 40,
377 { "font_text", "
\83e
\83L
\83X
\83g
\83E
\83B
\83\93\83h
\83E
\82É
\8eg
\97p
\82·
\82é
\83t
\83H
\83\93\83g", 40,
378 DISP_IN_GAME }, /*WC*/
380 { "fruit", "the name of a fruit you enjoy eating", PL_FSIZ, SET_IN_GAME },
382 { "fruit", "
\8dD
\95¨
\82Ì
\89Ê
\95¨
\82Ì
\96¼
\91O", PL_FSIZ, SET_IN_GAME },
384 { "gender", "your starting gender (male or female)", 8, DISP_IN_GAME },
386 { "gender", "
\83Q
\81[
\83\80\8aJ
\8en
\8e\9e\82Ì
\90«
\95Ê(male
\82Ü
\82½
\82Í female)", 8, DISP_IN_GAME },
388 { "horsename", "the name of your (first) horse (e.g., horsename:Silver)",
390 { "horsename", "
\96`
\8c¯
\82ð
\8b\9f\82É
\82·
\82é(
\8dÅ
\8f\89\82Ì)
\94n
\82Ì
\96¼
\91O (
\97á ghoulname:
\83V
\83\8b\83o
\81[)",
391 PL_PSIZ, DISP_IN_GAME },
393 { "map_mode", "map display mode under Windows", 20, DISP_IN_GAME }, /*WC*/
395 { "map_mode", "
\83E
\83B
\83\93\83h
\83E
\95\
\8e¦
\8e\9e\82Ì
\83}
\83b
\83v
\82Ì
\95\
\8e¦
\83\82\81[
\83h", 20, DISP_IN_GAME }, /*WC*/
398 { "menustyle", "user interface for object selection", MENUTYPELEN,
400 { "menustyle", "
\83I
\83u
\83W
\83F
\83N
\83g
\82ð
\91I
\91ð
\82·
\82é
\82Æ
\82«
\82Ì
\83\86\81[
\83U
\81[
\83C
\83\93\83^
\83t
\83F
\81[
\83X", MENUTYPELEN,
403 { "menu_deselect_all", "deselect all items in a menu", 4, SET_IN_FILE },
405 { "menu_deselect_all", "
\91S
\82Ä
\82Ì
\83A
\83C
\83e
\83\80\82ð
\94ñ
\91I
\91ð", 4, SET_IN_FILE },
407 { "menu_deselect_page", "deselect all items on this page of a menu", 4,
409 { "menu_deselect_page", "
\8c»
\8dÝ
\95\
\8e¦
\82³
\82ê
\82Ä
\82¢
\82é
\83y
\81[
\83W
\82Ì
\83A
\83C
\83e
\83\80\82ð
\94ñ
\91I
\91ð", 4,
412 { "menu_first_page", "jump to the first page in a menu", 4, SET_IN_FILE },
414 { "menu_first_page", "
\83\81\83j
\83\85\81[
\82Ì
\8dÅ
\8f\89\82Ì
\83y
\81[
\83W
\82Ö", 4, SET_IN_FILE },
416 { "menu_headings", "text attribute for menu headings", 9, SET_IN_GAME },
418 { "menu_headings", "
\8b
\92²
\81C
\94½
\93]
\82Ü
\82½
\82Í
\89º
\90ü
\82Å
\8eí
\97Þ
\82ð
\95\
\8e¦
\82·
\82é", 9, SET_IN_GAME },
420 { "menu_invert_all", "invert all items in a menu", 4, SET_IN_FILE },
422 { "menu_invert_all", "
\91S
\82Ä
\82Ì
\83A
\83C
\83e
\83\80\82ð
\94½
\93]", 4, SET_IN_FILE },
424 { "menu_invert_page", "invert all items on this page of a menu", 4,
426 { "menu_invert_page", "
\8c»
\8dÝ
\95\
\8e¦
\82³
\82ê
\82Ä
\82¢
\82é
\83y
\81[
\83W
\82Ì
\83A
\83C
\83e
\83\80\82ð
\94½
\93]",
429 { "menu_last_page", "jump to the last page in a menu", 4, SET_IN_FILE },
431 { "menu_last_page", "
\83\81\83j
\83\85\81[
\82Ì
\8dÅ
\8cã
\82Ì
\83y
\81[
\83W
\82Ö", 4, SET_IN_FILE },
433 { "menu_next_page", "goto the next menu page", 4, SET_IN_FILE },
435 { "menu_next_page", "
\8e\9f\82Ì
\83\81\83j
\83\85\81[
\82Ì
\83y
\81[
\83W
\82Ö", 4, SET_IN_FILE },
437 { "menu_previous_page", "goto the previous menu page", 4, SET_IN_FILE },
439 { "menu_previous_page", "
\91O
\82Ì
\83\81\83j
\83\85\81[
\82Ì
\83y
\81[
\83W
\82Ö", 4, SET_IN_FILE },
441 { "menu_search", "search for a menu item", 4, SET_IN_FILE },
443 { "menu_search", "
\83\81\83j
\83\85\81[
\82Ì
\8c\9f\8dõ", 4, SET_IN_FILE },
445 { "menu_select_all", "select all items in a menu", 4, SET_IN_FILE },
447 { "menu_select_all", "
\91S
\82Ä
\82Ì
\83A
\83C
\83e
\83\80\82ð
\91I
\91ð", 4, SET_IN_FILE },
449 { "menu_select_page", "select all items on this page of a menu", 4,
451 { "menu_select_page", "
\8c»
\8dÝ
\95\
\8e¦
\82³
\82ê
\82Ä
\82¢
\82é
\91S
\82Ä
\82Ì
\83A
\83C
\83e
\83\80\82ð
\91I
\91ð", 4,
454 { "monsters", "the symbols to use for monsters", MAXMCLASSES,
456 { "monsters", "
\83\82\83\93\83X
\83^
\81[
\82É
\8eg
\97p
\82³
\82ê
\82é
\83V
\83\93\83{
\83\8b\95¶
\8e\9a", MAXMCLASSES,
459 { "msghistory", "number of top line messages to save", 5, DISP_IN_GAME },
461 { "msghistory", "
\90æ
\93ª
\8ds
\82É
\95\
\8e¦
\82³
\82ê
\82½
\83\81\83b
\83Z
\81[
\83W
\97\9a\97ð
\82Ì
\95Û
\91¶
\90\94", 5, DISP_IN_GAME },
462 #if defined(TTY_GRAPHICS) || defined(CURSES_GRAPHICS)
464 { "msg_window", "the type of message window required", 1, SET_IN_GAME },
466 { "msg_window", "
\83\81\83b
\83Z
\81[
\83W
\83E
\83B
\83\93\83h
\83E
\82Ì
\83^
\83C
\83v
\82ð
\90Ý
\92è",1, SET_IN_GAME },
469 { "msg_window", "the type of message window required", 1, SET_IN_FILE },
471 { "msg_window", "
\83\81\83b
\83Z
\81[
\83W
\83E
\83B
\83\93\83h
\83E
\82Ì
\83^
\83C
\83v
\82ð
\90Ý
\92è", 1, SET_IN_FILE },
474 { "name", "your character's name (e.g., name:Merlin-W)", PL_NSIZ,
476 { "name", "
\82 \82È
\82½
\82Ì
\96¼
\91O (
\97á name:
\83}
\81[
\83\8a\83\93-W)", PL_NSIZ,
479 { "mouse_support", "game receives click info from mouse", 0, SET_IN_GAME },
481 { "mouse_support", "
\83Q
\81[
\83\80\82ª
\83}
\83E
\83X
\82©
\82ç
\82Ì
\83N
\83\8a\83b
\83N
\8fî
\95ñ
\82ð
\8eó
\82¯
\8eæ
\82é", 0, SET_IN_GAME },
483 { "number_pad", "use the number pad for movement", 1, SET_IN_GAME },
485 { "number_pad", "
\83i
\83\93\83o
\81[
\83p
\83b
\83h
\82ð
\8eg
\97p
\82·
\82é", 1, SET_IN_GAME },
487 { "objects", "the symbols to use for objects", MAXOCLASSES, SET_IN_FILE },
489 { "objects", "
\83A
\83C
\83e
\83\80\82É
\8eg
\97p
\82³
\82ê
\82é
\83V
\83\93\83{
\83\8b\95¶
\8e\9a", MAXOCLASSES, SET_IN_FILE },
491 { "packorder", "the inventory order of the items in your pack",
493 { "packorder", "
\94w
\95\89\82¢
\91Ü
\93à
\82Ì
\95¨
\82Ì
\8f\87\94Ô",
494 MAXOCLASSES, SET_IN_GAME },
499 "palette (00c/880/-fff is blue/yellow/reverse white)", 15, SET_IN_GAME
501 "
\83p
\83\8c\83b
\83g (00c/880/-fff
\82Í
\82»
\82ê
\82¼
\82ê
\90Â/
\89©/
\94½
\93]
\94\92\82ð
\8e¦
\82·)", 15, SET_IN_GAME
504 "palette (adjust an RGB color in palette (color-R-G-B)", 15, SET_IN_FILE
506 "
\83p
\83\8c\83b
\83g (
\83p
\83\8c\83b
\83g
\82ÌRGB
\90F
\82ð
\92²
\90®
\82·
\82é (
\90F-R-G-B)", 15, SET_IN_FILE
511 { "hicolor", "same as palette, only order is reversed", 15, SET_IN_FILE },
513 { "hicolor", "
\83p
\83\8c\83b
\83g
\82ª
\93¯
\82¶
\82Æ
\82«
\81A
\8ew
\8e¦
\82µ
\82½
\82à
\82Ì
\82¾
\82¯
\94½
\93]
\82³
\82¹
\82é", 15, SET_IN_FILE },
517 { "paranoid_confirmation", "extra prompting in certain situations", 28,
520 { "paranoid_confirmation", "
\88ê
\95\94\82Ì
\8fó
\8bµ
\82Å
\92Ç
\89Á
\82Ì
\8am
\94F
\82ð
\82·
\82é", 28,
524 { "petattr", "attributes for highlighting pets", 88, SET_IN_GAME },
526 { "petattr", "
\83y
\83b
\83g
\82ð
\83n
\83C
\83\89\83C
\83g
\82·
\82é
\82½
\82ß
\82Ì
\91®
\90«", 88, SET_IN_GAME },
528 { "pettype", "your preferred initial pet type", 4, DISP_IN_GAME },
530 { "pettype", "
\82 \82È
\82½
\82Ì
\91I
\91ð
\82µ
\82½
\8f\89\8aú
\83y
\83b
\83g
\82Ì
\8eí
\97Þ", 4, DISP_IN_GAME },
532 { "pickup_burden", "maximum burden picked up before prompt", 20,
534 { "pickup_burden", "
\8fE
\82¤
\82Æ
\82«
\82É
\8dÅ
\91å
\89×
\8fd
\82É
\82È
\82é
\8eè
\91O
\82Å
\8am
\94F
\82·
\82é", 20,
537 { "pickup_types", "types of objects to pick up automatically",
539 { "pickup_types", "
\8e©
\93®
\82Å
\8fE
\82¢
\82 \82°
\82é
\95¨
\82Ì
\83V
\83\93\83{
\83\8b",
540 MAXOCLASSES, SET_IN_GAME },
542 { "pile_limit", "threshold for \"there are many objects here\"", 24,
545 { "pile_limit", "
\81u
\82±
\82±
\82É
\82Í
\82½
\82
\82³
\82ñ
\82Ì
\82à
\82Ì
\82ª
\82 \82é
\81v
\82Ì
\82µ
\82«
\82¢
\92l", 24,
549 { "playmode", "normal play, non-scoring explore mode, or debug mode", 8,
552 { "playmode", "
\92Ê
\8fí
\83\82\81[
\83h
\81C
\92T
\8c\9f\83\82\81[
\83h
\81C
\83f
\83o
\83b
\83O
\83\82\81[
\83h
\82Ì
\82¢
\82¸
\82ê
\82©", 8,
556 { "player_selection", "choose character via dialog or prompts", 12,
558 { "player_selection", "
\83L
\83\83\83\89\83N
\83^
\81[
\91I
\91ð
\82É
\83_
\83C
\83A
\83\8d\83O
\82â
\8am
\94F
\89æ
\96Ê
\82ð
\8eg
\82¤", 12,
561 { "race", "your starting race (e.g., Human, Elf)", PL_CSIZ,
563 { "race", "
\83Q
\81[
\83\80\8aJ
\8en
\8e\9e\82Ì
\8eí
\91° (
\97á Human, Elf)", PL_CSIZ,
566 { "role", "your starting role (e.g., Barbarian, Valkyrie)", PL_CSIZ,
568 { "role", "
\83Q
\81[
\83\80\8aJ
\8en
\8e\9e\82Ì
\90E
\8bÆ (
\97á Barbarian, Valkyrie)", PL_CSIZ,
571 { "runmode", "display frequency when `running' or `travelling'",
573 { "runmode", "
\83g
\83\89\83x
\83\8b\83R
\83}
\83\93\83h
\93\99\82Å
\82Ì
\98A
\91±
\88Ú
\93®
\8e\9e\82Ì
\95`
\89æ
\95p
\93x",
574 sizeof "teleport", SET_IN_GAME },
576 { "scores", "the parts of the score list you wish to see", 32,
578 { "scores", "
\83Q
\81[
\83\80\8fI
\97¹
\8e\9e\82É
\8c©
\82é
\83X
\83R
\83A
\82Ì
\8eí
\97Þ", 32,
581 { "scroll_amount", "amount to scroll map when scroll_margin is reached",
583 { "scroll_amount", "scroll_margin
\82É
\93Í
\82¢
\82½
\82Æ
\82«
\82Ì
\83}
\83b
\83v
\83X
\83N
\83\8d\81[
\83\8b\97Ê",
584 20, DISP_IN_GAME }, /*WC*/
586 { "scroll_margin", "scroll map when this far from the edge", 20,
588 { "scroll_margin", "
\83}
\83b
\83v
\92[
\82©
\82ç
\82Ì
\83}
\83b
\83v
\83X
\83N
\83\8d\81[
\83\8b\8aJ
\8en
\8b\97\97£", 20,
589 DISP_IN_GAME }, /*WC*/
591 { "sortloot", "sort object selection lists by description", 4,
593 { "sortloot", "
\95¨
\91Ì
\91I
\91ð
\83\8a\83X
\83g
\82ð
\90à
\96¾
\82Å
\83\
\81[
\83g
\82·
\82é", 4,
597 { "soundcard", "type of sound card to use", 20, SET_IN_FILE },
599 { "soundcard", "
\8eg
\97p
\82µ
\82Ä
\82¢
\82é
\83T
\83E
\83\93\83h
\83J
\81[
\83h
\82Ì
\8eí
\97Þ", 20, SET_IN_FILE },
602 #ifdef STATUS_HILITES
604 "0=no status highlighting, N=show highlights for N turns",
606 "0=
\83X
\83e
\81[
\83^
\83X
\83n
\83C
\83\89\83C
\83g
\82È
\82µ
\81CN
\83^
\81[
\83\93\96\88\82É
\83n
\83C
\83\89\83C
\83g
\95\
\8e¦",
611 "highlight control", 20, SET_IN_FILE
613 "
\83n
\83C
\83\89\83C
\83g
\82Ì
\90§
\8cä", 20, SET_IN_FILE
617 #ifdef CURSES_GRAPHICS
619 "2 or 3 lines for horizontal (bottom or top) status display",
621 "
\90\82\92¼(
\89º
\82©
\8fã)
\82Ì
\83X
\83e
\81[
\83^
\83X
\95\
\8e¦
\82É2,3
\8ds
\8eg
\82¤",
625 "2 or 3 lines for status display",
627 "
\83X
\83e
\81[
\83^
\83X
\95\
\8e¦
\82É2,3
\8ds
\8eg
\82¤",
632 { "symset", "load a set of display symbols from the symbols file", 70,
635 { "symset", "symbols
\83t
\83@
\83C
\83\8b\82©
\82ç
\95\
\8e¦
\83V
\83\93\83{
\83\8b\82Ì
\90Ý
\92è
\82ð
\93Ç
\82Ý
\8d\9e\82Þ", 70,
640 "load a set of rogue display symbols from the symbols file", 70,
644 "symbols
\83t
\83@
\83C
\83\8b\82©
\82ç
\83\8d\81[
\83O
\83\8c\83x
\83\8b\82Ì
\95\
\8e¦
\83V
\83\93\83{
\83\8b\82Ì
\90Ý
\92è
\82ð
\93Ç
\82Ý
\8d\9e\82Þ", 70,
649 { "subkeyvalue", "override keystroke value", 7, SET_IN_FILE },
651 { "subkeyvalue", "
\83L
\81[
\83}
\83b
\83s
\83\93\83O
\82ð
\95Ï
\8dX
\82·
\82é", 7, SET_IN_FILE },
654 { "suppress_alert", "suppress alerts about version-specific features", 8,
656 { "suppress_alert", "
\83o
\81[
\83W
\83\87\83\93\8aÔ
\82Ì
\88á
\82¢
\82É
\8aÖ
\82·
\82é
\8cx
\8d\90\83\81\83b
\83Z
\81[
\83W
\82Ì
\96³
\8cø
\89»", 8,
658 /* term_cols,term_rows -> WC2_TERM_SIZE (6: room to format 1..32767) */
660 { "term_cols", "number of columns", 6, SET_IN_FILE }, /*WC2*/
662 { "term_cols", "
\8c\85\90\94", 6, SET_IN_FILE }, /*WC2*/
665 { "term_rows", "number of rows", 6, SET_IN_FILE }, /*WC2*/
667 { "term_rows", "
\8ds
\90\94", 6, SET_IN_FILE }, /*WC2*/
670 { "tile_width", "width of tiles", 20, DISP_IN_GAME }, /*WC*/
672 { "tile_width", "
\83^
\83C
\83\8b\82Ì
\95\9d", 20, DISP_IN_GAME }, /*WC*/
675 { "tile_height", "height of tiles", 20, DISP_IN_GAME }, /*WC*/
677 { "tile_height", "
\83^
\83C
\83\8b\82Ì
\8d\82\82³", 20, DISP_IN_GAME }, /*WC*/
680 { "tile_file", "name of tile file", 70, DISP_IN_GAME }, /*WC*/
682 { "tile_file", "
\83^
\83C
\83\8b\83t
\83@
\83C
\83\8b\82Ì
\96¼
\91O", 70, DISP_IN_GAME }, /*WC*/
685 { "traps", "the symbols to use in drawing traps", MAXTCHARS + 1,
687 { "traps", "ã©
\82ð
\95`
\89æ
\82·
\82é
\83V
\83\93\83{
\83\8b\95¶
\8e\9a", MAXTCHARS + 1,
690 { "vary_msgcount", "show more old messages at a time", 20,
692 { "vary_msgcount", "
\88ê
\93x
\82É
\95\
\8e¦
\82·
\82é
\83\81\83b
\83Z
\81[
\83W
\82Ì
\90\94", 20,
693 DISP_IN_GAME }, /*WC*/
696 { "video", "method of video updating", 20, SET_IN_FILE },
698 { "video", "
\8eg
\97p
\82·
\82é
\83r
\83f
\83I
\83\82\81[
\83h
\82ð
\90Ý
\92è
\82·
\82é", 20, SET_IN_FILE },
702 { "videocolors", "color mappings for internal screen routines", 40,
704 { "videocolors", "
\93à
\91 \83X
\83N
\83\8a\81[
\83\93\83\8b\81[
\83`
\83\93\97p
\82Ì
\83J
\83\89\81[
\83}
\83b
\83v
\82ð
\97p
\82¢
\82é", 40,
707 { "videoshades", "gray shades to map to black/gray/white", 32,
709 { "videoshades", "
\95\
\8e¦
\82É
\83O
\83\8c\83C
\83X
\83P
\81[
\83\8b\82ð
\97p
\82¢
\82é", 32,
713 { "whatis_coord", "show coordinates when auto-describing cursor position",
716 { "whatis_coord", "
\83J
\81[
\83\
\83\8b\88Ê
\92u
\82ð
\8e©
\93®
\90à
\96¾
\82·
\82é
\82Æ
\82«
\82É
\8dÀ
\95W
\82ð
\95\
\8e¦
\82·
\82é",
721 "filter coordinate locations when targeting next or previous",
725 "
\8e\9f\82â
\8eè
\91O
\82ð
\83^
\81[
\83Q
\83b
\83g
\82·
\82é
\82Æ
\82«
\82É
\8dÀ
\95W
\88Ê
\92u
\82ð
\83t
\83B
\83\8b\83^
\82·
\82é",
728 { "windowborders", "0 (off), 1 (on), 2 (auto)", 9, SET_IN_GAME }, /*WC2*/
730 { "windowcolors", "the foreground/background colors of windows", /*WC*/
733 { "windowcolors", "
\83E
\83B
\83\93\83h
\83E
\82ð
\8ew
\92è
\82µ
\82½
\91O
\8ci
\90F/
\94w
\8ci
\90F
\82Å
\95\
\8e¦
\82·
\82é", /*WC*/
737 { "windowtype", "windowing system to use", WINTYPELEN, DISP_IN_GAME },
739 { "windowtype", "
\8eg
\97p
\82·
\82é
\83E
\83C
\83\93\83h
\83E
\83V
\83X
\83e
\83\80", WINTYPELEN, DISP_IN_GAME },
742 { "windowchain", "window processor to use", WINTYPELEN, SET_IN_SYS },
744 { "windowchain", "
\8eg
\97p
\82·
\82é
\83E
\83B
\83\93\83h
\83E
\83v
\83\8d\83Z
\83b
\83T", WINTYPELEN, SET_IN_SYS },
746 #ifdef BACKWARD_COMPAT
748 { "DECgraphics", "load DECGraphics display symbols", 70, SET_IN_FILE },
750 { "DECgraphics", "DECGraphics
\95\
\8e¦
\83V
\83\93\83{
\83\8b\82ð
\93Ç
\82Ý
\8d\9e\82Þ", 70, SET_IN_FILE },
752 { "IBMgraphics", "load IBMGraphics display symbols", 70, SET_IN_FILE },
754 { "IBMgraphics", "IBMGraphics
\95\
\8e¦
\83V
\83\93\83{
\83\8b\82ð
\93Ç
\82Ý
\8d\9e\82Þ", 70, SET_IN_FILE },
755 #ifdef CURSES_GRAPHICS
757 { "cursesgraphics", "load curses display symbols", 70, SET_IN_FILE },
759 { "cursesgraphics", "curses
\95\
\8e¦
\83V
\83\93\83{
\83\8b\82ð
\93Ç
\82Ý
\8d\9e\82Þ", 70, SET_IN_FILE },
761 #ifdef MAC_GRAPHICS_ENV
763 { "Macgraphics", "load MACGraphics display symbols", 70, SET_IN_FILE },
765 { "Macgraphics", "MACGraphics
\95\
\8e¦
\83V
\83\93\83{
\83\8b\82ð
\93Ç
\82Ý
\8d\9e\82Þ", 70, SET_IN_FILE },
769 { "kcode", "
\92[
\96\96\82Ì
\8a¿
\8e\9a\83R
\81[
\83h,", 4, SET_IN_FILE },
771 { (char *) 0, (char *) 0, 0, 0 }
774 #ifdef OPTION_LISTS_ONLY
777 #else /* use rest of file */
779 extern char configfile[]; /* for messages */
781 extern struct symparse loadsyms[];
782 static boolean need_redraw; /* for doset() */
784 #if defined(TOS) && defined(TEXTCOLOR)
785 extern boolean colors_changed; /* in tos.c */
789 extern char *shade[3]; /* in sys/msdos/video.c */
790 extern char ttycolors[CLR_MAX]; /* in sys/msdos/video.c */
793 static char def_inv_order[MAXOCLASSES] = {
794 COIN_CLASS, AMULET_CLASS, WEAPON_CLASS, ARMOR_CLASS, FOOD_CLASS,
795 SCROLL_CLASS, SPBOOK_CLASS, POTION_CLASS, RING_CLASS, WAND_CLASS,
796 TOOL_CLASS, GEM_CLASS, ROCK_CLASS, BALL_CLASS, CHAIN_CLASS, 0,
800 * Default menu manipulation command accelerators. These may _not_ be:
802 * + a number - reserved for counts
803 * + an upper or lower case US ASCII letter - used for accelerators
804 * + ESC - reserved for escaping the menu
805 * + NULL, CR or LF - reserved for commiting the selection(s). NULL
806 * is kind of odd, but the tty's xwaitforspace() will return it if
807 * someone hits a <ret>.
808 * + a default object class symbol - used for object class accelerators
810 * Standard letters (for now) are:
823 * The command name list is duplicated in the compopt array.
831 static const menu_cmd_t default_menu_cmd_info[] = {
833 { "menu_first_page", MENU_FIRST_PAGE, "Go to first page" },
835 { "menu_first_page", MENU_FIRST_PAGE, "
\90æ
\93ª
\83y
\81[
\83W
\82É
\88Ú
\93®" },
837 { "menu_last_page", MENU_LAST_PAGE, "Go to last page" },
839 { "menu_last_page", MENU_LAST_PAGE, "
\8dÅ
\8fI
\83y
\81[
\83W
\82É
\88Ú
\93®" },
841 { "menu_next_page", MENU_NEXT_PAGE, "Go to next page" },
843 { "menu_next_page", MENU_NEXT_PAGE, "
\8e\9f\82Ì
\83y
\81[
\83W
\82É
\88Ú
\93®" },
845 { "menu_previous_page", MENU_PREVIOUS_PAGE, "Go to previous page" },
847 { "menu_previous_page", MENU_PREVIOUS_PAGE, "
\91O
\82Ì
\83y
\81[
\83W
\82É
\88Ú
\93®" },
849 { "menu_select_all", MENU_SELECT_ALL, "Select all items" },
851 { "menu_select_all", MENU_SELECT_ALL, "
\91S
\82Ä
\82ð
\91I
\91ð" },
853 { "menu_deselect_all", MENU_UNSELECT_ALL, "Unselect all items" },
855 { "menu_deselect_all", MENU_UNSELECT_ALL, "
\91S
\82Ä
\82Ì
\91I
\91ð
\82ð
\89ð
\8f\9c" },
857 { "menu_invert_all", MENU_INVERT_ALL, "Invert selection" },
859 { "menu_invert_all", MENU_INVERT_ALL, "
\91I
\91ð
\82ð
\94½
\93]" },
861 { "menu_select_page", MENU_SELECT_PAGE, "Select items in current page" },
863 { "menu_select_page", MENU_SELECT_PAGE, "
\8c»
\8dÝ
\82Ì
\83y
\81[
\83W
\82Ì
\83A
\83C
\83e
\83\80\82ð
\91I
\91ð" },
864 { "menu_deselect_page", MENU_UNSELECT_PAGE,
866 "Unselect items in current page" },
868 "Unselect items in current page" },
870 { "menu_invert_page", MENU_INVERT_PAGE, "Invert current page selection" },
872 { "menu_invert_page", MENU_INVERT_PAGE, "
\8c»
\8dÝ
\82Ì
\83y
\81[
\83W
\82Ì
\91I
\91ð
\82ð
\94½
\93]" },
874 { "menu_search", MENU_SEARCH, "Search and toggle matching items" },
876 { "menu_search", MENU_SEARCH, "
\8c\9f\8dõ
\82µ
\82Ä
\83}
\83b
\83`
\83\93\83O
\82µ
\82½
\83A
\83C
\83e
\83\80\82ð
\83g
\83O
\83\8b" },
880 * Allow the user to map incoming characters to various menu commands.
881 * The accelerator list must be a valid C string.
883 #define MAX_MENU_MAPPED_CMDS 32 /* some number */
884 char mapped_menu_cmds[MAX_MENU_MAPPED_CMDS + 1]; /* exported */
885 static char mapped_menu_op[MAX_MENU_MAPPED_CMDS + 1];
886 static short n_menu_mapped = 0;
888 static boolean initial, from_file;
890 STATIC_DCL void FDECL(nmcpy, (char *, const char *, int));
891 STATIC_DCL void FDECL(escapes, (const char *, char *));
892 STATIC_DCL void FDECL(rejectoption, (const char *));
893 STATIC_DCL char *FDECL(string_for_opt, (char *, BOOLEAN_P));
894 STATIC_DCL char *FDECL(string_for_env_opt, (const char *, char *, BOOLEAN_P));
895 STATIC_DCL void FDECL(bad_negation, (const char *, BOOLEAN_P));
896 STATIC_DCL int FDECL(change_inv_order, (char *));
897 STATIC_DCL boolean FDECL(warning_opts, (char *, const char *));
898 STATIC_DCL int FDECL(feature_alert_opts, (char *, const char *));
899 STATIC_DCL boolean FDECL(duplicate_opt_detection, (const char *, int));
900 STATIC_DCL void FDECL(complain_about_duplicate, (const char *, int));
902 STATIC_DCL const char *FDECL(attr2attrname, (int));
903 STATIC_DCL const char * FDECL(msgtype2name, (int));
904 STATIC_DCL int NDECL(query_msgtype);
905 STATIC_DCL boolean FDECL(msgtype_add, (int, char *));
906 STATIC_DCL void FDECL(free_one_msgtype, (int));
907 STATIC_DCL int NDECL(msgtype_count);
908 STATIC_DCL boolean FDECL(test_regex_pattern, (const char *, const char *));
909 STATIC_DCL boolean FDECL(add_menu_coloring_parsed, (char *, int, int));
910 STATIC_DCL void FDECL(free_one_menu_coloring, (int));
911 STATIC_DCL int NDECL(count_menucolors);
912 STATIC_DCL boolean FDECL(parse_role_opts, (BOOLEAN_P, const char *,
915 STATIC_DCL void FDECL(doset_add_menu, (winid, const char *, int));
916 STATIC_DCL void FDECL(opts_add_others, (winid, const char *, int,
918 STATIC_DCL int FDECL(handle_add_list_remove, (const char *, int));
919 STATIC_DCL boolean FDECL(special_handling, (const char *,
920 BOOLEAN_P, BOOLEAN_P));
921 STATIC_DCL const char *FDECL(get_compopt_value, (const char *, char *));
922 STATIC_DCL void FDECL(remove_autopickup_exception,
923 (struct autopickup_exception *));
925 STATIC_DCL boolean FDECL(is_wc_option, (const char *));
926 STATIC_DCL boolean FDECL(wc_supported, (const char *));
927 STATIC_DCL boolean FDECL(is_wc2_option, (const char *));
928 STATIC_DCL boolean FDECL(wc2_supported, (const char *));
929 STATIC_DCL void FDECL(wc_set_font_name, (int, char *));
930 STATIC_DCL int FDECL(wc_set_window_colors, (char *));
937 for (x = 0; x < COLNO; x++)
938 for (y = 0; y < ROWNO; y++) {
939 struct rm *lev = &levl[x][y];
941 if (!flags.dark_room || !iflags.use_color
942 || Is_rogue_level(&u.uz)) {
943 if (lev->glyph == cmap_to_glyph(S_darkroom))
944 lev->glyph = lev->waslit ? cmap_to_glyph(S_room)
945 : cmap_to_glyph(S_stone);
947 if (lev->glyph == cmap_to_glyph(S_room) && lev->seenv
948 && lev->waslit && !cansee(x, y))
949 lev->glyph = cmap_to_glyph(S_darkroom);
950 else if (lev->glyph == cmap_to_glyph(S_stone)
951 && lev->typ == ROOM && lev->seenv && !cansee(x, y))
952 lev->glyph = cmap_to_glyph(S_darkroom);
955 if (flags.dark_room && iflags.use_color)
956 showsyms[S_darkroom] = showsyms[S_room];
958 showsyms[S_darkroom] = showsyms[S_stone];
961 /* check whether a user-supplied option string is a proper leading
962 substring of a particular option name; option string might have
963 a colon or equals sign and arbitrary value appended to it */
965 match_optname(user_string, opt_name, min_length, val_allowed)
966 const char *user_string, *opt_name;
970 int len = (int) strlen(user_string);
973 const char *p = index(user_string, ':'),
974 *q = index(user_string, '=');
976 if (!p || (q && q < p))
979 /* 'user_string' hasn't necessarily been through mungspaces()
980 so might have tabs or consecutive spaces */
981 while (p > user_string && isspace((uchar) *(p - 1)))
983 len = (int) (p - user_string);
987 return (boolean) (len >= min_length
988 && !strncmpi(opt_name, user_string, len));
991 /* most environment variables will eventually be printed in an error
992 * message if they don't work, and most error message paths go through
993 * BUFSZ buffers, which could be overflowed by a maliciously long
994 * environment variable. If a variable can legitimately be long, or
995 * if it's put in a smaller buffer, the responsible code will have to
996 * bounds-check itself.
1002 char *getev = getenv(ev);
1004 if (getev && strlen(getev) <= (BUFSZ / 2))
1010 /* process options, possibly including SYSCF */
1016 /* someday there may be other SYSCF alternatives besides text file */
1018 /* If SYSCF_FILE is specified, it _must_ exist... */
1019 assure_syscf_file();
1020 config_error_init(TRUE, SYSCF_FILE, FALSE);
1022 /* ... and _must_ parse correctly. */
1023 if (!read_config_file(SYSCF_FILE, SET_IN_SYS)) {
1024 if (config_error_done() && !iflags.initoptions_noterminate)
1025 nh_terminate(EXIT_FAILURE);
1027 config_error_done();
1029 * TODO [maybe]: parse the sysopt entries which are space-separated
1030 * lists of usernames into arrays with one name per element.
1034 initoptions_finish();
1040 #if (defined(UNIX) || defined(VMS)) && defined(TTY_GRAPHICS)
1045 /* set up the command parsing */
1046 reset_commands(TRUE); /* init */
1048 /* initialize the random number generator(s) */
1050 init_random(rn2_on_display_rng);
1052 /* for detection of configfile options specified multiple times */
1053 iflags.opt_booldup = iflags.opt_compdup = (int *) 0;
1055 for (i = 0; boolopt[i].name; i++) {
1056 if (boolopt[i].addr)
1057 *(boolopt[i].addr) = boolopt[i].initvalue;
1059 #if defined(COMPRESS) || defined(ZLIB_COMP)
1060 set_savepref("externalcomp");
1061 set_restpref("externalcomp");
1063 set_savepref("!rlecomp");
1064 set_restpref("!rlecomp");
1068 set_savepref("zerocomp");
1069 set_restpref("zerocomp");
1072 set_savepref("rlecomp");
1073 set_restpref("rlecomp");
1077 Strcpy(sysflags.sysflagsid, "sysflags");
1078 sysflags.sysflagsid[9] = (char) sizeof (struct sysflag);
1080 flags.end_own = FALSE;
1082 flags.end_around = 2;
1083 flags.paranoia_bits = PARANOID_PRAY; /* old prayconfirm=TRUE */
1084 flags.pile_limit = PILE_LIMIT_DFLT; /* 5 */
1085 flags.runmode = RUN_LEAP;
1086 iflags.msg_history = 20;
1087 /* msg_window has conflicting defaults for multi-interface binary */
1089 iflags.prevmsg_window = 's';
1091 #ifdef CURSES_GRAPHICS
1092 iflags.prevmsg_window = 'r';
1095 iflags.menu_headings = ATR_INVERSE;
1096 iflags.getpos_coords = GPCOORDS_NONE;
1098 /* hero's role, race, &c haven't been chosen yet */
1099 flags.initrole = flags.initrace = flags.initgend = flags.initalign
1102 init_ov_primary_symbols();
1103 init_ov_rogue_symbols();
1104 /* Set the default monster and object class symbols. */
1106 for (i = 0; i < WARNCOUNT; i++)
1107 warnsyms[i] = def_warnsyms[i].sym;
1109 /* for "special achievement" tracking (see obj.h,
1110 create_object(sp_lev.c), addinv_core1(invent.c) */
1111 iflags.mines_prize_type = LUCKSTONE;
1112 iflags.soko_prize_type1 = BAG_OF_HOLDING;
1113 iflags.soko_prize_type2 = AMULET_OF_REFLECTION;
1115 /* assert( sizeof flags.inv_order == sizeof def_inv_order ); */
1116 (void) memcpy((genericptr_t) flags.inv_order,
1117 (genericptr_t) def_inv_order, sizeof flags.inv_order);
1118 flags.pickup_types[0] = '\0';
1119 flags.pickup_burden = MOD_ENCUMBER;
1120 flags.sortloot = 'l'; /* sort only loot by default */
1122 for (i = 0; i < NUM_DISCLOSURE_OPTIONS; i++)
1123 flags.end_disclose[i] = DISCLOSE_PROMPT_DEFAULT_NO;
1124 switch_symbols(FALSE); /* set default characters */
1125 init_rogue_symbols();
1126 #if defined(UNIX) && defined(TTY_GRAPHICS)
1128 * Set defaults for some options depending on what we can
1129 * detect about the environment's capabilities.
1130 * This has to be done after the global initialization above
1131 * and before reading user-specific initialization via
1132 * config file/environment variable below.
1134 /* this detects the IBM-compatible console on most 386 boxes */
1135 if ((opts = nh_getenv("TERM")) && !strncmp(opts, "AT", 2)) {
1136 if (!symset[PRIMARY].explicitly)
1137 load_symset("IBMGraphics", PRIMARY);
1138 if (!symset[ROGUESET].explicitly)
1139 load_symset("RogueIBM", ROGUESET);
1140 switch_symbols(TRUE);
1142 iflags.use_color = TRUE;
1145 #endif /* UNIX && TTY_GRAPHICS */
1146 #if defined(UNIX) || defined(VMS)
1148 /* detect whether a "vt" terminal can handle alternate charsets */
1149 if ((opts = nh_getenv("TERM"))
1150 /* [could also check "xterm" which emulates vtXXX by default] */
1151 && !strncmpi(opts, "vt", 2)
1152 && AS && AE && index(AS, '\016') && index(AE, '\017')) {
1153 if (!symset[PRIMARY].explicitly)
1154 load_symset("DECGraphics", PRIMARY);
1155 switch_symbols(TRUE);
1158 #endif /* UNIX || VMS */
1160 #if defined(MSDOS) || defined(WIN32)
1161 /* Use IBM defaults. Can be overridden via config file */
1162 if (!symset[PRIMARY].explicitly)
1163 load_symset("IBMGraphics_2", PRIMARY);
1164 if (!symset[ROGUESET].explicitly)
1165 load_symset("RogueEpyx", ROGUESET);
1167 #ifdef MAC_GRAPHICS_ENV
1168 if (!symset[PRIMARY].explicitly)
1169 load_symset("MACGraphics", PRIMARY);
1170 switch_symbols(TRUE);
1171 #endif /* MAC_GRAPHICS_ENV */
1172 flags.menu_style = MENU_FULL;
1174 iflags.wc_align_message = ALIGN_TOP;
1175 iflags.wc_align_status = ALIGN_BOTTOM;
1176 /* used by tty and curses */
1177 iflags.wc2_statuslines = 2;
1178 /* only used by curses */
1179 iflags.wc2_windowborders = 2; /* 'Auto' */
1181 /* since this is done before init_objects(), do partial init here */
1182 objects[SLIME_MOLD].oc_name_idx = SLIME_MOLD;
1183 nmcpy(pl_fruit, OBJ_NAME(objects[SLIME_MOLD]), PL_FSIZ);
1187 initoptions_finish()
1191 char *opts = getenv("NETHACKOPTIONS");
1194 opts = getenv("HACKOPTIONS");
1196 if (*opts == '/' || *opts == '\\' || *opts == '@') {
1198 opts++; /* @filename */
1199 /* looks like a filename */
1200 if (strlen(opts) < BUFSZ / 2) {
1201 config_error_init(TRUE, opts, CONFIG_ERROR_SECURE);
1202 read_config_file(opts, SET_IN_FILE);
1203 config_error_done();
1206 config_error_init(TRUE, (char *) 0, FALSE);
1207 read_config_file((char *) 0, SET_IN_FILE);
1208 config_error_done();
1209 /* let the total length of options be long;
1210 * parseoptions() will check each individually
1212 config_error_init(FALSE, "NETHACKOPTIONS", FALSE);
1213 (void) parseoptions(opts, TRUE, FALSE);
1214 config_error_done();
1219 config_error_init(TRUE, (char *) 0, FALSE);
1220 read_config_file((char *) 0, SET_IN_FILE);
1221 config_error_done();
1224 (void) fruitadd(pl_fruit, (struct fruit *) 0);
1226 * Remove "slime mold" from list of object names. This will
1227 * prevent it from being wished unless it's actually present
1228 * as a named (or default) fruit. Wishing for "fruit" will
1229 * result in the player's preferred fruit [better than "\033"].
1231 obj_descr[SLIME_MOLD].oc_name = "fruit";
1233 sym = get_othersym(SYM_BOULDER,
1234 Is_rogue_level(&u.uz) ? ROGUESET : PRIMARY);
1236 showsyms[SYM_BOULDER + SYM_OFF_X] = sym;
1239 #ifdef STATUS_HILITES
1241 * A multi-interface binary might only support status highlighting
1242 * for some of the interfaces; check whether we asked for it but are
1243 * using one which doesn't.
1245 * Option processing can take place before a user-decided WindowPort
1246 * is even initialized, so check for that too.
1248 if (!WINDOWPORT("safe-startup")) {
1249 if (iflags.hilite_delta && !wc2_supported("statushilites")) {
1250 raw_printf("Status highlighting not supported for %s interface.",
1252 iflags.hilite_delta = 0;
1259 /* copy up to maxlen-1 characters; 'dest' must be able to hold maxlen;
1260 treat comma as alternate end of 'src' */
1262 nmcpy(dest, src, maxlen)
1269 for (count = 1; count < maxlen; count++) {
1270 if (*src == ',' || *src == '\0')
1271 break; /*exit on \0 terminator*/
1278 * escapes(): escape expansion for showsyms. C-style escapes understood
1279 * include \n, \b, \t, \r, \xnnn (hex), \onnn (octal), \nnn (decimal).
1280 * (Note: unlike in C, leading digit 0 is not used to indicate octal;
1281 * the letter o (either upper or lower case) is used for that.
1282 * The ^-prefix for control characters is also understood, and \[mM]
1283 * has the effect of 'meta'-ing the value which follows (so that the
1284 * alternate character set will be enabled).
1290 * For 3.4.3 and earlier, input ending with "\M", backslash, or caret
1291 * prior to terminating '\0' would pull that '\0' into the output and then
1292 * keep processing past it, potentially overflowing the output buffer.
1293 * Now, trailing \ or ^ will act like \\ or \^ and add '\\' or '^' to the
1294 * output and stop there; trailing \M will fall through to \<other> and
1295 * yield 'M', then stop. Any \X or \O followed by something other than
1296 * an appropriate digit will also fall through to \<other> and yield 'X'
1297 * or 'O', plus stop if the non-digit is end-of-string.
1301 const char *cp; /* might be 'tp', updating in place */
1302 char *tp; /* result is never longer than 'cp' */
1304 static NEARDATA const char oct[] = "01234567", dec[] = "0123456789",
1305 hex[] = "00112233445566778899aAbBcCdDeEfF";
1307 int cval, meta, dcount;
1310 /* \M has to be followed by something to do meta conversion,
1311 otherwise it will just be \M which ultimately yields 'M' */
1312 meta = (*cp == '\\' && (cp[1] == 'm' || cp[1] == 'M') && cp[2]);
1316 cval = dcount = 0; /* for decimal, octal, hexadecimal cases */
1317 if ((*cp != '\\' && *cp != '^') || !cp[1]) {
1318 /* simple character, or nothing left for \ or ^ to escape */
1320 } else if (*cp == '^') { /* expand control-character syntax */
1321 cval = (*++cp & 0x1f);
1324 /* remaining cases are all for backslash; we know cp[1] is not \0 */
1325 } else if (index(dec, cp[1])) {
1326 ++cp; /* move past backslash to first digit */
1328 cval = (cval * 10) + (*cp - '0');
1329 } while (*++cp && index(dec, *cp) && ++dcount < 3);
1330 } else if ((cp[1] == 'o' || cp[1] == 'O') && cp[2]
1331 && index(oct, cp[2])) {
1332 cp += 2; /* move past backslash and 'O' */
1334 cval = (cval * 8) + (*cp - '0');
1335 } while (*++cp && index(oct, *cp) && ++dcount < 3);
1336 } else if ((cp[1] == 'x' || cp[1] == 'X') && cp[2]
1337 && (dp = index(hex, cp[2])) != 0) {
1338 cp += 2; /* move past backslash and 'X' */
1340 cval = (cval * 16) + ((int) (dp - hex) / 2);
1341 } while (*++cp && (dp = index(hex, *cp)) != 0 && ++dcount < 2);
1342 } else { /* C-style character escapes */
1367 *tp++ = (char) cval;
1373 rejectoption(optname)
1374 const char *optname;
1377 pline("\"%s\" settable only from %s.", optname, configfile);
1379 pline("%s can be set only from NETHACKOPTIONS or %s.", optname,
1387 OPTIONS=aaaaaaaaaa[ more than 247 (255 - 8 for 'OPTIONS=') total ]aaaaaaaaaa
1390 MSGTYPE=stop"You swap places with "
1391 MSGTYPE=st.op "You swap places with "
1392 MSGTYPE=stop "You swap places with \"
1393 MENUCOLOR=" blessed "green&none
1394 MENUCOLOR=" holy " = green&reverse
1395 MENUCOLOR=" cursed " = red&uline
1396 MENUCOLOR=" unholy " = reed
1397 OPTIONS=!legacy:true,fooo
1404 string_for_opt(opts, val_optional)
1406 boolean val_optional;
1408 char *colon, *equals;
1410 colon = index(opts, ':');
1411 equals = index(opts, '=');
1412 if (!colon || (equals && equals < colon))
1415 if (!colon || !*++colon) {
1418 config_error_add("Missing parameter for '%s'", opts);
1420 config_error_add("'%s'
\82Ì
\88ø
\90\94\82ª
\82 \82è
\82Ü
\82¹
\82ñ", opts);
1421 return empty_optstr;
1427 string_for_env_opt(optname, opts, val_optional)
1428 const char *optname;
1430 boolean val_optional;
1433 rejectoption(optname);
1434 return empty_optstr;
1436 return string_for_opt(opts, val_optional);
1440 bad_negation(optname, with_parameter)
1441 const char *optname;
1442 boolean with_parameter;
1445 pline_The("%s option may not %sbe negated.", optname,
1446 with_parameter ? "both have a value and " : "");
1448 pline_The("%s
\83I
\83v
\83V
\83\87\83\93\82Í
\94Û
\92è%s
\82Å
\82«
\82È
\82¢
\81D", optname,
1449 with_parameter ? "
\82Æ
\92l
\8ew
\92è
\82Ì
\97¼
\95û
\82Í" : "");
1454 * Change the inventory order, using the given string as the new order.
1455 * Missing characters in the new order are filled in at the end from
1456 * the current inv_order, except for gold, which is forced to be first
1457 * if not explicitly present.
1459 * This routine returns 1 unless there is a duplicate or bad char in
1463 change_inv_order(op)
1467 char *sp, buf[QBUFSZ];
1471 if (!index(op, GOLD_SYM))
1472 buf[num++] = COIN_CLASS;
1474 for (sp = op; *sp; sp++) {
1475 boolean fail = FALSE;
1476 oc_sym = def_char_to_objclass(*sp);
1477 /* reject bad or duplicate entries */
1478 if (oc_sym == MAXOCLASSES) { /* not an object class char */
1479 config_error_add("Not an object class '%c'", *sp);
1482 } else if (!index(flags.inv_order, oc_sym)) {
1483 /* VENOM_CLASS, RANDOM_CLASS, and ILLOBJ_CLASS are excluded
1484 because they aren't in def_inv_order[] so don't make it
1485 into flags.inv_order, hence always fail this index() test */
1486 config_error_add("Object class '%c' not allowed", *sp);
1489 } else if (index(sp + 1, *sp)) {
1490 config_error_add("Duplicate object class '%c'", *sp);
1494 /* retain good ones */
1496 buf[num++] = (char) oc_sym;
1500 /* fill in any omitted classes, using previous ordering */
1501 for (sp = flags.inv_order; *sp; sp++)
1502 if (!index(buf, *sp))
1503 (void) strkitten(&buf[num++], *sp);
1504 buf[MAXOCLASSES - 1] = '\0';
1506 Strcpy(flags.inv_order, buf);
1511 warning_opts(opts, optype)
1512 register char *opts;
1515 uchar translate[WARNCOUNT];
1518 if ((opts = string_for_env_opt(optype, opts, FALSE)) == empty_optstr)
1520 escapes(opts, opts);
1522 length = (int) strlen(opts);
1523 /* match the form obtained from PC configuration files */
1524 for (i = 0; i < WARNCOUNT; i++)
1525 translate[i] = (i >= length) ? 0
1526 : opts[i] ? (uchar) opts[i]
1527 : def_warnsyms[i].sym;
1528 assign_warnings(translate);
1533 assign_warnings(graph_chars)
1534 register uchar *graph_chars;
1538 for (i = 0; i < WARNCOUNT; i++)
1540 warnsyms[i] = graph_chars[i];
1544 feature_alert_opts(op, optn)
1549 unsigned long fnv = get_feature_notice_ver(op); /* version.c */
1553 if (fnv > get_current_feature_ver()) {
1556 You_cant("disable new feature alerts for future versions.");
1558 You_cant("
\8f«
\97\88\82Ì
\83o
\81[
\83W
\83\87\83\93\82Ì
\8b@
\94\
\8cx
\8d\90\82ð
\96³
\8cø
\82É
\82·
\82é
\82±
\82Æ
\82Í
\82Å
\82«
\82È
\82¢
\81D");
1561 "%s=%s Invalid reference to a future version ignored",
1567 flags.suppress_alert = fnv;
1569 Sprintf(buf, "%lu.%lu.%lu", FEATURE_NOTICE_VER_MAJ,
1570 FEATURE_NOTICE_VER_MIN, FEATURE_NOTICE_VER_PATCH);
1573 "Feature change alerts disabled for NetHack %s features and prior.",
1577 "NetHack %s
\88È
\91O
\82Ì
\8b@
\94\
\82É
\91Î
\82·
\82é
\8b@
\94\
\95Ï
\8dX
\8cx
\8d\90\82ð
\96³
\8cø
\82É
\82µ
\82½
\81D",
1585 set_duplicate_opt_detection(on_or_off)
1590 if (on_or_off != 0) {
1592 if (iflags.opt_booldup)
1593 impossible("iflags.opt_booldup already on (memory leak)");
1594 iflags.opt_booldup = (int *) alloc(SIZE(boolopt) * sizeof (int));
1595 optptr = iflags.opt_booldup;
1596 for (k = 0; k < SIZE(boolopt); ++k)
1599 if (iflags.opt_compdup)
1600 impossible("iflags.opt_compdup already on (memory leak)");
1601 iflags.opt_compdup = (int *) alloc(SIZE(compopt) * sizeof (int));
1602 optptr = iflags.opt_compdup;
1603 for (k = 0; k < SIZE(compopt); ++k)
1607 if (iflags.opt_booldup)
1608 free((genericptr_t) iflags.opt_booldup);
1609 iflags.opt_booldup = (int *) 0;
1610 if (iflags.opt_compdup)
1611 free((genericptr_t) iflags.opt_compdup);
1612 iflags.opt_compdup = (int *) 0;
1617 duplicate_opt_detection(opts, iscompound)
1619 int iscompound; /* 0 == boolean option, 1 == compound */
1623 if (!iscompound && iflags.opt_booldup && initial && from_file) {
1624 for (i = 0; boolopt[i].name; i++) {
1625 if (match_optname(opts, boolopt[i].name, 3, FALSE)) {
1626 optptr = iflags.opt_booldup + i;
1634 } else if (iscompound && iflags.opt_compdup && initial && from_file) {
1635 for (i = 0; compopt[i].name; i++) {
1636 if (match_optname(opts, compopt[i].name, strlen(compopt[i].name),
1638 optptr = iflags.opt_compdup + i;
1651 complain_about_duplicate(opts, iscompound)
1653 int iscompound; /* 0 == boolean option, 1 == compound */
1656 /* the Mac has trouble dealing with the output of messages while
1657 * processing the config file. That should get fixed one day.
1658 * For now just return.
1662 config_error_add("%s option specified multiple times: %s",
1663 iscompound ? "compound" : "boolean", opts);
1665 config_error_add("%s
\83I
\83v
\83V
\83\87\83\93\82ª
\95¡
\90\94\89ñ
\8ew
\92è
\82³
\82ê
\82Ä
\82¢
\82Ü
\82·
\81F%s",
1666 iscompound ? "
\95¡
\8d\87" : "
\90^
\8bU
\92l", opts);
1672 /* paranoia[] - used by parseoptions() and special_handling() */
1673 STATIC_VAR const struct paranoia_opts {
1674 int flagmask; /* which paranoid option */
1675 const char *argname; /* primary name */
1676 int argMinLen; /* minimum number of letters to match */
1677 const char *synonym; /* alternate name (optional) */
1679 const char *explain; /* for interactive menu */
1681 /* there are some initial-letter conflicts: "a"ttack vs "a"ll, "attack"
1682 takes precedence and "all" isn't present in the interactive menu,
1683 and "d"ie vs "d"eath, synonyms for each other so doesn't matter;
1684 (also "p"ray vs "P"aranoia, "pray" takes precedence since "Paranoia"
1685 is just a synonym for "Confirm"); "b"ones vs "br"eak-wand, the
1686 latter requires at least two letters; "e"at vs "ex"plore,
1687 "cont"inue eating vs "C"onfirm; "wand"-break vs "Were"-change,
1688 both require at least two letters during config processing and use
1689 case-senstivity for 'O's interactive menu */
1690 { PARANOID_CONFIRM, "Confirm", 1, "Paranoia", 2,
1692 "for \"yes\" confirmations, require \"no\" to reject" },
1694 "\"yes\"
\82ð
\8am
\94F
\82·
\82é
\82Æ
\82«
\82É
\81C
\8b\91\94Û
\82·
\82é
\82Æ
\82«
\82É
\82Í\"no\"
\82ª
\95K
\97v" },
1695 { PARANOID_QUIT, "quit", 1, "explore", 2,
1697 "yes vs y to quit or to enter explore mode" },
1699 "
\8fI
\97¹
\82Ü
\82½
\82Í
\92T
\8c\9f\83\82\81[
\83h
\82É
\93ü
\82é
\82Æ
\82«
\82Éy
\82Å
\82Í
\82È
\82yes" },
1700 { PARANOID_DIE, "die", 1, "death", 2,
1702 "yes vs y to die (explore mode or debug mode)" },
1704 "(
\92T
\8c\9f\83\82\81[
\83h
\82©
\83f
\83o
\83b
\83O
\83\82\81[
\83h
\82Å)
\8e\80\82Ê
\82Æ
\82«
\82Éy
\82Å
\82Í
\82È
\82yes" },
1705 { PARANOID_BONES, "bones", 1, 0, 0,
1707 "yes vs y to save bones data when dying in debug mode" },
1709 "
\83f
\83o
\83b
\83O
\83\82\81[
\83h
\82Å
\8e\80\82ñ
\82Å
\8d\9c\83f
\81[
\83^
\82ð
\95Û
\91¶
\82·
\82é
\82Æ
\82«
\82Éy
\82Å
\82Í
\82È
\82yes" },
1710 { PARANOID_HIT, "attack", 1, "hit", 1,
1712 "yes vs y to attack a peaceful monster" },
1714 "
\97F
\8dD
\93I
\89ö
\95¨
\82ð
\8dU
\8c\82\82·
\82é
\82Æ
\82«
\82Éy
\82Å
\82Í
\82È
\82yes" },
1715 { PARANOID_BREAKWAND, "wand-break", 2, "break-wand", 2,
1717 "yes vs y to break a wand via (a)pply" },
1719 "(a)pply
\82Å
\8fñ
\82ð
\90Ü
\82é
\82Æ
\82«
\82Éy
\82Å
\82Í
\82È
\82yes" },
1720 { PARANOID_EATING, "eat", 1, "continue", 4,
1722 "yes vs y to continue eating after first bite when satiated" },
1724 "
\96\9e\95 \82Ì
\8e\9e\82É
\88ê
\8cû
\90H
\82×
\82½
\8cã
\90H
\82×
\91±
\82¯
\82é
\82Æ
\82«
\82Éy
\82Å
\82Í
\82È
\82yes" },
1725 { PARANOID_WERECHANGE, "Were-change", 2, (const char *) 0, 0,
1727 "yes vs y to change form when lycanthropy is controllable" },
1729 "
\8fb
\89»
\95a
\82ª
\90§
\8cä
\89Â
\94\
\82È
\8fê
\8d\87\82É
\95Ï
\89»
\82·
\82é
\82Æ
\82«
\82Éy
\82Å
\82Í
\82È
\82yes" },
1730 { PARANOID_PRAY, "pray", 1, 0, 0,
1732 "y to pray (supersedes old \"prayconfirm\" option)" },
1734 "
\8bF
\82é
\82Æ
\82«
\82Éy
\82ª
\95K
\97v(
\8cÃ
\82¢\"prayconfirm\"
\83I
\83v
\83V
\83\87\83\93\82ð
\8fã
\8f\91\82«
\82·
\82é)" },
1735 { PARANOID_REMOVE, "Remove", 1, "Takeoff", 1,
1737 "always pick from inventory for Remove and Takeoff" },
1739 "Remove
\82ÆTakeoff
\82Å
\8fí
\82É
\8e\9d\82¿
\95¨
\88ê
\97\97\82©
\82ç
\91I
\82Ô" },
1740 /* for config file parsing; interactive menu skips these */
1741 { 0, "none", 4, 0, 0, 0 }, /* require full word match */
1742 { ~0, "all", 3, 0, 0, 0 }, /* ditto */
1745 extern struct menucoloring *menu_colorings;
1747 static const struct {
1751 { "black", CLR_BLACK },
1753 { "green", CLR_GREEN },
1754 { "brown", CLR_BROWN },
1755 { "blue", CLR_BLUE },
1756 { "magenta", CLR_MAGENTA },
1757 { "cyan", CLR_CYAN },
1758 { "gray", CLR_GRAY },
1759 { "orange", CLR_ORANGE },
1760 { "light green", CLR_BRIGHT_GREEN },
1761 { "yellow", CLR_YELLOW },
1762 { "light blue", CLR_BRIGHT_BLUE },
1763 { "light magenta", CLR_BRIGHT_MAGENTA },
1764 { "light cyan", CLR_BRIGHT_CYAN },
1765 { "white", CLR_WHITE },
1766 { "no color", NO_COLOR },
1767 { NULL, CLR_BLACK }, /* everything after this is an alias */
1768 { "transparent", NO_COLOR },
1769 { "purple", CLR_MAGENTA },
1770 { "light purple", CLR_BRIGHT_MAGENTA },
1771 { "bright purple", CLR_BRIGHT_MAGENTA },
1772 { "grey", CLR_GRAY },
1773 { "bright red", CLR_ORANGE },
1774 { "bright green", CLR_BRIGHT_GREEN },
1775 { "bright blue", CLR_BRIGHT_BLUE },
1776 { "bright magenta", CLR_BRIGHT_MAGENTA },
1777 { "bright cyan", CLR_BRIGHT_CYAN }
1780 static const struct {
1784 { "none", ATR_NONE },
1785 { "bold", ATR_BOLD },
1787 { "underline", ATR_ULINE },
1788 { "blink", ATR_BLINK },
1789 { "inverse", ATR_INVERSE },
1790 { NULL, ATR_NONE }, /* everything after this is an alias */
1791 { "normal", ATR_NONE },
1792 { "uline", ATR_ULINE },
1793 { "reverse", ATR_INVERSE },
1802 for (i = 0; i < SIZE(colornames); i++)
1803 if (colornames[i].name && colornames[i].color == clr)
1804 return colornames[i].name;
1814 /* allow "lightblue", "light blue", and "light-blue" to match "light blue"
1815 (also junk like "_l i-gh_t---b l u e" but we won't worry about that);
1816 also copes with trailing space; caller has removed any leading space */
1817 for (i = 0; i < SIZE(colornames); i++)
1818 if (colornames[i].name
1819 && fuzzymatch(str, colornames[i].name, " -_", TRUE)) {
1820 c = colornames[i].color;
1823 if (i == SIZE(colornames) && digit(*str))
1826 if (c < 0 || c >= CLR_MAX) {
1827 config_error_add("Unknown color '%.60s'", str);
1828 c = CLR_MAX; /* "none of the above" */
1834 STATIC_OVL const char *
1840 for (i = 0; i < SIZE(attrnames); i++)
1841 if (attrnames[i].attr == attr)
1842 return attrnames[i].name;
1847 match_str2attr(str, complain)
1853 for (i = 0; i < SIZE(attrnames); i++)
1854 if (attrnames[i].name
1855 && fuzzymatch(str, attrnames[i].name, " -_", TRUE)) {
1856 a = attrnames[i].attr;
1860 if (a == -1 && complain)
1861 config_error_add("Unknown text attribute '%.50s'", str);
1873 menu_item *picks = (menu_item *) 0;
1875 tmpwin = create_nhwindow(NHW_MENU);
1878 for (i = 0; i < SIZE(colornames); i++) {
1879 if (!colornames[i].name)
1882 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, colornames[i].name,
1883 (colornames[i].color == NO_COLOR) ? MENU_SELECTED
1886 end_menu(tmpwin, (prompt && *prompt) ? prompt : "Pick a color");
1887 pick_cnt = select_menu(tmpwin, PICK_ONE, &picks);
1888 destroy_nhwindow(tmpwin);
1890 i = colornames[picks[0].item.a_int - 1].color;
1891 /* pick_cnt==2: explicitly picked something other than the
1892 preselected entry */
1893 if (pick_cnt == 2 && i == NO_COLOR)
1894 i = colornames[picks[1].item.a_int - 1].color;
1895 free((genericptr_t) picks);
1897 } else if (pick_cnt == 0) {
1898 /* pick_cnt==0: explicitly picking preselected entry toggled it off */
1904 /* ask about highlighting attribute; for menu headers and menu
1905 coloring patterns, only one attribute at a time is allowed;
1906 for status highlighting, multiple attributes are allowed [overkill;
1907 life would be much simpler if that were restricted to one also...] */
1915 menu_item *picks = (menu_item *) 0;
1916 boolean allow_many = (prompt && !strncmpi(prompt, "Choose", 6));
1917 int default_attr = ATR_NONE;
1919 if (prompt && strstri(prompt, "menu headings"))
1920 default_attr = iflags.menu_headings;
1921 tmpwin = create_nhwindow(NHW_MENU);
1924 for (i = 0; i < SIZE(attrnames); i++) {
1925 if (!attrnames[i].name)
1928 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, attrnames[i].attr,
1930 (attrnames[i].attr == default_attr) ? MENU_SELECTED
1933 end_menu(tmpwin, (prompt && *prompt) ? prompt : "Pick an attribute");
1934 pick_cnt = select_menu(tmpwin, allow_many ? PICK_ANY : PICK_ONE, &picks);
1935 destroy_nhwindow(tmpwin);
1940 /* PICK_ANY, with one preselected entry (ATR_NONE) which
1941 should be excluded if any other choices were picked */
1942 for (i = 0; i < pick_cnt; ++i) {
1943 j = picks[i].item.a_int - 1;
1944 if (attrnames[j].attr != ATR_NONE || pick_cnt == 1) {
1945 switch (attrnames[j].attr) {
1968 /* PICK_ONE, but might get 0 or 2 due to preselected entry */
1969 j = picks[0].item.a_int - 1;
1970 /* pick_cnt==2: explicitly picked something other than the
1971 preselected entry */
1972 if (pick_cnt == 2 && attrnames[j].attr == default_attr)
1973 j = picks[1].item.a_int - 1;
1974 k = attrnames[j].attr;
1976 free((genericptr_t) picks);
1978 } else if (pick_cnt == 0 && !allow_many) {
1979 /* PICK_ONE, preselected entry explicitly chosen */
1980 return default_attr;
1982 /* either ESC to explicitly cancel (pick_cnt==-1) or
1983 PICK_ANY with preselected entry toggled off and nothing chosen */
1987 static const struct {
1991 } msgtype_names[] = {
1993 { "show", MSGTYP_NORMAL, "Show message normally" },
1995 { "show", MSGTYP_NORMAL, "
\92Ê
\8fí
\92Ê
\82è
\83\81\83b
\83Z
\81[
\83W
\82ð
\95\
\8e¦
\82·
\82é" },
1997 { "hide", MSGTYP_NOSHOW, "Hide message" },
1999 { "hide", MSGTYP_NOSHOW, "
\83\81\83b
\83Z
\81[
\83W
\82ð
\95\
\8e¦
\82µ
\82È
\82¢" },
2000 { "noshow", MSGTYP_NOSHOW, NULL },
2002 { "stop", MSGTYP_STOP, "Prompt for more after the message" },
2004 { "stop", MSGTYP_STOP, "more
\83v
\83\8d\83\93\83v
\83g
\82Å
\91Ò
\82Â" },
2005 { "more", MSGTYP_STOP, NULL },
2007 { "norep", MSGTYP_NOREP, "Do not repeat the message" }
2009 { "norep", MSGTYP_NOREP, "
\82±
\82Ì
\83\81\83b
\83Z
\81[
\83W
\82Í
\8cJ
\82è
\95Ô
\82³
\82È
\82¢" }
2012 STATIC_OVL const char *
2018 for (i = 0; i < SIZE(msgtype_names); i++)
2019 if (msgtype_names[i].descr && msgtype_names[i].msgtyp == typ)
2020 return msgtype_names[i].name;
2030 menu_item *picks = (menu_item *) 0;
2032 tmpwin = create_nhwindow(NHW_MENU);
2035 for (i = 0; i < SIZE(msgtype_names); i++)
2036 if (msgtype_names[i].descr) {
2037 any.a_int = msgtype_names[i].msgtyp + 1;
2038 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
2039 msgtype_names[i].descr, MENU_UNSELECTED);
2042 end_menu(tmpwin, "How to show the message");
2044 end_menu(tmpwin, "
\83\81\83b
\83Z
\81[
\83W
\82Ì
\95\
\8e¦
\95û
\96@");
2045 pick_cnt = select_menu(tmpwin, PICK_ONE, &picks);
2046 destroy_nhwindow(tmpwin);
2048 i = picks->item.a_int - 1;
2049 free((genericptr_t) picks);
2056 msgtype_add(typ, pattern)
2060 struct plinemsg_type *tmp = (struct plinemsg_type *) alloc(sizeof *tmp);
2063 tmp->regex = regex_init();
2064 if (!regex_compile(pattern, tmp->regex)) {
2065 static const char *re_error = "MSGTYPE regex error";
2067 config_error_add("%s: %s", re_error, regex_error_desc(tmp->regex));
2068 regex_free(tmp->regex);
2069 free((genericptr_t) tmp);
2072 tmp->pattern = dupstr(pattern);
2073 tmp->next = plinemsg_types;
2074 plinemsg_types = tmp;
2081 struct plinemsg_type *tmp, *tmp2 = 0;
2083 for (tmp = plinemsg_types; tmp; tmp = tmp2) {
2085 free((genericptr_t) tmp->pattern);
2086 regex_free(tmp->regex);
2087 free((genericptr_t) tmp);
2089 plinemsg_types = (struct plinemsg_type *) 0;
2093 free_one_msgtype(idx)
2096 struct plinemsg_type *tmp = plinemsg_types;
2097 struct plinemsg_type *prev = NULL;
2101 struct plinemsg_type *next = tmp->next;
2103 regex_free(tmp->regex);
2104 free((genericptr_t) tmp->pattern);
2105 free((genericptr_t) tmp);
2109 plinemsg_types = next;
2119 msgtype_type(msg, norepeat)
2121 boolean norepeat; /* called from Norep(via pline) */
2123 struct plinemsg_type *tmp = plinemsg_types;
2126 /* we don't exclude entries with negative msgtype values
2127 because then the msg might end up matching a later pattern */
2128 if (regex_match(msg, tmp->regex))
2129 return tmp->msgtype;
2132 return norepeat ? MSGTYP_NOREP : MSGTYP_NORMAL;
2135 /* negate one or more types of messages so that their type handling will
2136 be disabled or re-enabled; MSGTYPE_NORMAL (value 0) is not affected */
2138 hide_unhide_msgtypes(hide, hide_mask)
2142 struct plinemsg_type *tmp;
2145 /* negative msgtype value won't be recognized by pline, so does nothing */
2146 for (tmp = plinemsg_types; tmp; tmp = tmp->next) {
2149 mt = -mt; /* unhide: negate negative, yielding positive */
2150 if (mt > 0 && ((1 << mt) & hide_mask))
2151 tmp->msgtype = -tmp->msgtype;
2156 msgtype_count(VOID_ARGS)
2159 struct plinemsg_type *tmp = plinemsg_types;
2169 msgtype_parse_add(str)
2175 if (sscanf(str, "%10s \"%255[^\"]\"", msgtype, pattern) == 2) {
2179 for (i = 0; i < SIZE(msgtype_names); i++)
2180 if (!strncmpi(msgtype_names[i].name, msgtype, strlen(msgtype))) {
2181 typ = msgtype_names[i].msgtyp;
2185 return msgtype_add(typ, pattern);
2187 config_error_add("Unknown message type '%s'", msgtype);
2189 config_error_add("Malformed MSGTYPE");
2195 test_regex_pattern(str, errmsg)
2199 static const char re_error[] = "Regex error";
2200 struct nhregex *match;
2201 boolean retval = TRUE;
2206 match = regex_init();
2208 config_error_add("NHregex error");
2212 if (!regex_compile(str, match)) {
2213 config_error_add("%s: %s", errmsg ? errmsg : re_error,
2214 regex_error_desc(match));
2222 add_menu_coloring_parsed(str, c, a)
2226 static const char re_error[] = "Menucolor regex error";
2227 struct menucoloring *tmp;
2231 tmp = (struct menucoloring *) alloc(sizeof *tmp);
2232 tmp->match = regex_init();
2233 if (!regex_compile(str, tmp->match)) {
2234 config_error_add("%s: %s", re_error, regex_error_desc(tmp->match));
2235 regex_free(tmp->match);
2239 tmp->next = menu_colorings;
2240 tmp->origstr = dupstr(str);
2243 menu_colorings = tmp;
2248 /* parse '"regex_string"=color&attr' and add it to menucoloring */
2250 add_menu_coloring(tmpstr)
2251 char *tmpstr; /* never Null but could be empty */
2253 int c = NO_COLOR, a = ATR_NONE;
2254 char *tmps, *cs, *amp;
2257 (void) strncpy(str, tmpstr, sizeof str - 1);
2258 str[sizeof str - 1] = '\0';
2260 if ((cs = index(str, '=')) == 0) {
2261 config_error_add("Malformed MENUCOLOR");
2265 tmps = cs + 1; /* advance past '=' */
2267 if ((amp = index(tmps, '&')) != 0)
2270 c = match_str2clr(tmps);
2275 tmps = amp + 1; /* advance past '&' */
2276 a = match_str2attr(tmps, TRUE);
2281 /* the regexp portion here has not been condensed by mungspaces() */
2284 if (*tmps == '"' || *tmps == '\'') {
2286 while (isspace((uchar) *cs))
2293 return add_menu_coloring_parsed(tmps, c, a);
2297 get_menu_coloring(str, color, attr)
2301 struct menucoloring *tmpmc;
2303 if (iflags.use_menu_color)
2304 for (tmpmc = menu_colorings; tmpmc; tmpmc = tmpmc->next)
2305 if (regex_match(str, tmpmc->match)) {
2306 *color = tmpmc->color;
2307 *attr = tmpmc->attr;
2314 free_menu_coloring()
2316 struct menucoloring *tmp, *tmp2;
2318 for (tmp = menu_colorings; tmp; tmp = tmp2) {
2320 regex_free(tmp->match);
2321 free((genericptr_t) tmp->origstr);
2322 free((genericptr_t) tmp);
2327 free_one_menu_coloring(idx)
2330 struct menucoloring *tmp = menu_colorings;
2331 struct menucoloring *prev = NULL;
2335 struct menucoloring *next = tmp->next;
2337 regex_free(tmp->match);
2338 free((genericptr_t) tmp->origstr);
2339 free((genericptr_t) tmp);
2343 menu_colorings = next;
2353 count_menucolors(VOID_ARGS)
2355 struct menucoloring *tmp;
2358 for (tmp = menu_colorings; tmp; tmp = tmp->next)
2364 parse_role_opts(negated, fullname, opts, opp)
2366 const char *fullname;
2373 bad_negation(fullname, FALSE);
2374 } else if ((op = string_for_env_opt(fullname, opts, FALSE))
2376 boolean val_negated = FALSE;
2378 while ((*op == '!') || !strncmpi(op, "no", 2)) {
2383 val_negated = !val_negated;
2386 if (!setrolefilter(op)) {
2387 config_error_add("Unknown negated parameter '%s'", op);
2391 if (duplicate_opt_detection(opts, 1))
2392 complain_about_duplicate(opts, 1);
2400 /* Check if character c is illegal as a menu command key */
2402 illegal_menu_cmd_key(c)
2405 if (c == 0 || c == '\r' || c == '\n' || c == '\033'
2406 || c == ' ' || digit(c) || (letter(c) && c != '@')) {
2407 config_error_add("Reserved menu command key '%s'", visctrl(c));
2409 } else { /* reject default object class symbols */
2411 for (j = 1; j < MAXOCLASSES; j++)
2412 if (c == def_oc_syms[j].sym) {
2413 config_error_add("Menu command key '%s' is an object class",
2422 parseoptions(opts, tinitial, tfrom_file)
2423 register char *opts;
2424 boolean tinitial, tfrom_file;
2428 boolean negated, duplicate;
2430 const char *fullname;
2431 boolean retval = TRUE;
2434 from_file = tfrom_file;
2435 if ((op = index(opts, ',')) != 0) {
2437 if (!parseoptions(op, initial, from_file))
2440 if (strlen(opts) > BUFSZ / 2) {
2441 config_error_add("Option too long, max length is %i characters",
2446 /* strip leading and trailing white space */
2447 while (isspace((uchar) *opts))
2450 while (--op >= opts && isspace((uchar) *op))
2454 config_error_add("Empty statement");
2458 while ((*opts == '!') || !strncmpi(opts, "no", 2)) {
2466 /* variant spelling */
2468 if (match_optname(opts, "colour", 5, FALSE))
2469 Strcpy(opts, "color"); /* fortunately this isn't longer */
2471 /* special boolean options */
2473 if (match_optname(opts, "female", 3, FALSE)) {
2474 if (duplicate_opt_detection(opts, 0))
2475 complain_about_duplicate(opts, 0);
2476 if (!initial && flags.female == negated) {
2477 config_error_add("That is not anatomically possible.");
2480 flags.initgend = flags.female = !negated;
2484 if (match_optname(opts, "male", 4, FALSE)) {
2485 if (duplicate_opt_detection(opts, 0))
2486 complain_about_duplicate(opts, 0);
2487 if (!initial && flags.female != negated) {
2488 config_error_add("That is not anatomically possible.");
2491 flags.initgend = flags.female = negated;
2495 #if defined(MICRO) && !defined(AMIGA)
2496 /* included for compatibility with old NetHack.cnf files */
2497 if (match_optname(opts, "IBM_", 4, FALSE)) {
2498 iflags.BIOS = !negated;
2503 /* compound options */
2505 /* This first batch can be duplicated if their values are negated */
2509 if (match_optname(opts, fullname, sizeof "align" - 1, TRUE)) {
2510 if (parse_role_opts(negated, fullname, opts, &op)) {
2511 if ((flags.initalign = str2align(op)) == ROLE_NONE) {
2512 config_error_add("Unknown %s '%s'", fullname, op);
2520 /* role:string or character:string */
2522 if (match_optname(opts, fullname, 4, TRUE)
2523 || match_optname(opts, (fullname = "character"), 4, TRUE)) {
2524 if (parse_role_opts(negated, fullname, opts, &op)) {
2525 if ((flags.initrole = str2role(op)) == ROLE_NONE) {
2526 config_error_add("Unknown %s '%s'", fullname, op);
2528 } else /* Backwards compatibility */
2529 nmcpy(pl_character, op, PL_NSIZ);
2537 if (match_optname(opts, fullname, 4, TRUE)) {
2538 if (parse_role_opts(negated, fullname, opts, &op)) {
2539 if ((flags.initrace = str2race(op)) == ROLE_NONE) {
2540 config_error_add("Unknown %s '%s'", fullname, op);
2542 } else /* Backwards compatibility */
2550 fullname = "gender";
2551 if (match_optname(opts, fullname, 4, TRUE)) {
2552 if (parse_role_opts(negated, fullname, opts, &op)) {
2553 if ((flags.initgend = str2gend(op)) == ROLE_NONE) {
2554 config_error_add("Unknown %s '%s'", fullname, op);
2557 flags.female = flags.initgend;
2563 /* We always check for duplicates on the remaining compound options,
2564 although individual option processing can choose to complain or not */
2566 duplicate = duplicate_opt_detection(opts, 1); /* 1: check compounds */
2568 fullname = "pettype";
2569 if (match_optname(opts, fullname, 3, TRUE)) {
2571 complain_about_duplicate(opts, 1);
2572 if ((op = string_for_env_opt(fullname, opts, negated))
2575 bad_negation(fullname, TRUE);
2578 switch (lowc(*op)) {
2580 preferred_pet = 'd';
2583 case 'f': /* feline */
2584 preferred_pet = 'c';
2586 case 'h': /* horse */
2587 case 'q': /* quadruped */
2588 /* avoids giving "unrecognized type of pet" but
2589 pet_type(dog.c) won't actually honor this */
2590 preferred_pet = 'h';
2592 case 'n': /* no pet */
2593 preferred_pet = 'n';
2595 case '*': /* random */
2596 preferred_pet = '\0';
2600 config_error_add("Unrecognized pet type '%s'.", op);
2602 pline("'%s'
\82Í
\83y
\83b
\83g
\82Ì
\8eí
\97Þ
\82Æ
\82µ
\82Ä
\8eó
\82¯
\95t
\82¯
\82ç
\82ê
\82Ü
\82¹
\82ñ
\81D", op);
2607 preferred_pet = 'n';
2611 fullname = "catname";
2612 if (match_optname(opts, fullname, 3, TRUE)) {
2614 complain_about_duplicate(opts, 1);
2616 bad_negation(fullname, FALSE);
2618 } else if ((op = string_for_env_opt(fullname, opts, FALSE))
2620 nmcpy(catname, op, PL_PSIZ);
2623 sanitize_name(catname);
2627 fullname = "dogname";
2628 if (match_optname(opts, fullname, 3, TRUE)) {
2630 complain_about_duplicate(opts, 1);
2632 bad_negation(fullname, FALSE);
2634 } else if ((op = string_for_env_opt(fullname, opts, FALSE))
2636 nmcpy(dogname, op, PL_PSIZ);
2639 sanitize_name(dogname);
2643 fullname = "horsename";
2644 if (match_optname(opts, fullname, 5, TRUE)) {
2646 complain_about_duplicate(opts, 1);
2648 bad_negation(fullname, FALSE);
2650 } else if ((op = string_for_env_opt(fullname, opts, FALSE))
2652 nmcpy(horsename, op, PL_PSIZ);
2655 sanitize_name(horsename);
2659 fullname = "mouse_support";
2660 if (match_optname(opts, fullname, 13, TRUE)) {
2661 boolean compat = (strlen(opts) <= 13);
2664 complain_about_duplicate(opts, 1);
2665 op = string_for_opt(opts, (compat || !initial));
2666 if (op == empty_optstr) {
2667 if (compat || negated || initial) {
2668 /* for backwards compatibility, "mouse_support" without a
2669 value is a synonym for mouse_support:1 */
2670 iflags.wc_mouse_support = !negated;
2672 } else if (negated) {
2673 bad_negation(fullname, TRUE);
2676 int mode = atoi(op);
2678 if (mode < 0 || mode > 2 || (mode == 0 && *op != '0')) {
2679 config_error_add("Illegal %s parameter '%s'", fullname, op);
2681 } else { /* mode >= 0 */
2682 iflags.wc_mouse_support = mode;
2688 fullname = "number_pad";
2689 if (match_optname(opts, fullname, 10, TRUE)) {
2690 boolean compat = (strlen(opts) <= 10);
2693 complain_about_duplicate(opts, 1);
2694 op = string_for_opt(opts, (compat || !initial));
2695 if (op == empty_optstr) {
2696 if (compat || negated || initial) {
2697 /* for backwards compatibility, "number_pad" without a
2698 value is a synonym for number_pad:1 */
2699 iflags.num_pad = !negated;
2700 iflags.num_pad_mode = 0;
2702 } else if (negated) {
2703 bad_negation(fullname, TRUE);
2706 int mode = atoi(op);
2708 if (mode < -1 || mode > 4 || (mode == 0 && *op != '0')) {
2709 config_error_add("Illegal %s parameter '%s'", fullname, op);
2711 } else if (mode <= 0) {
2712 iflags.num_pad = FALSE;
2713 /* German keyboard; y and z keys swapped */
2714 iflags.num_pad_mode = (mode < 0); /* 0 or 1 */
2715 } else { /* mode > 0 */
2716 iflags.num_pad = TRUE;
2717 iflags.num_pad_mode = 0;
2718 /* PC Hack / MSDOS compatibility */
2719 if (mode == 2 || mode == 4)
2720 iflags.num_pad_mode |= 1;
2721 /* phone keypad layout */
2722 if (mode == 3 || mode == 4)
2723 iflags.num_pad_mode |= 2;
2726 reset_commands(FALSE);
2727 number_pad(iflags.num_pad ? 1 : 0);
2731 fullname = "roguesymset";
2732 if (match_optname(opts, fullname, 7, TRUE)) {
2734 complain_about_duplicate(opts, 1);
2736 bad_negation(fullname, FALSE);
2738 } else if ((op = string_for_opt(opts, FALSE)) != empty_optstr) {
2739 symset[ROGUESET].name = dupstr(op);
2740 if (!read_sym_file(ROGUESET)) {
2741 clear_symsetentry(ROGUESET, TRUE);
2743 "Unable to load symbol set \"%s\" from \"%s\"",
2747 if (!initial && Is_rogue_level(&u.uz))
2748 assign_graphics(ROGUESET);
2756 fullname = "symset";
2757 if (match_optname(opts, fullname, 6, TRUE)) {
2759 complain_about_duplicate(opts, 1);
2761 bad_negation(fullname, FALSE);
2763 } else if ((op = string_for_opt(opts, FALSE)) != empty_optstr) {
2764 symset[PRIMARY].name = dupstr(op);
2765 if (!read_sym_file(PRIMARY)) {
2766 clear_symsetentry(PRIMARY, TRUE);
2768 "Unable to load symbol set \"%s\" from \"%s\"",
2772 switch_symbols(symset[PRIMARY].name != (char *) 0);
2780 fullname = "runmode";
2781 if (match_optname(opts, fullname, 4, TRUE)) {
2783 complain_about_duplicate(opts, 1);
2785 flags.runmode = RUN_TPORT;
2786 } else if ((op = string_for_opt(opts, FALSE)) != empty_optstr) {
2787 if (!strncmpi(op, "teleport", strlen(op)))
2788 flags.runmode = RUN_TPORT;
2789 else if (!strncmpi(op, "run", strlen(op)))
2790 flags.runmode = RUN_LEAP;
2791 else if (!strncmpi(op, "walk", strlen(op)))
2792 flags.runmode = RUN_STEP;
2793 else if (!strncmpi(op, "crawl", strlen(op)))
2794 flags.runmode = RUN_CRAWL;
2796 config_error_add("Unknown %s parameter '%s'", fullname, op);
2804 /* menucolor:"regex_string"=color */
2805 fullname = "menucolor";
2806 if (match_optname(opts, fullname, 9, TRUE)) {
2808 bad_negation(fullname, FALSE);
2810 } else if ((op = string_for_env_opt(fullname, opts, FALSE))
2812 if (!add_menu_coloring(op))
2819 fullname = "msghistory";
2820 if (match_optname(opts, fullname, 3, TRUE)) {
2822 complain_about_duplicate(opts, 1);
2823 op = string_for_env_opt(fullname, opts, negated);
2824 if ((negated && op == empty_optstr)
2825 || (!negated && op != empty_optstr)) {
2826 iflags.msg_history = negated ? 0 : atoi(op);
2827 } else if (negated) {
2828 bad_negation(fullname, TRUE);
2834 fullname = "msg_window";
2835 /* msg_window:single, combo, full or reversed */
2836 if (match_optname(opts, fullname, 4, TRUE)) {
2837 /* allow option to be silently ignored by non-tty ports */
2842 complain_about_duplicate(opts, 1);
2843 if ((op = string_for_opt(opts, TRUE)) == empty_optstr) {
2844 tmp = negated ? 's' : 'f';
2847 bad_negation(fullname, TRUE);
2853 case 's': /* single message history cycle (default if negated) */
2854 iflags.prevmsg_window = 's';
2856 case 'c': /* combination: two singles, then full page */
2857 iflags.prevmsg_window = 'c';
2859 case 'f': /* full page (default if specified without argument) */
2860 iflags.prevmsg_window = 'f';
2862 case 'r': /* full page (reversed) */
2863 iflags.prevmsg_window = 'r';
2866 config_error_add("Unknown %s parameter '%s'", fullname, op);
2874 * setting font options */
2876 if (!strncmpi(opts, fullname, 4)) {
2878 char *fontopts = opts + 4;
2880 if (!strncmpi(fontopts, "map", 3) || !strncmpi(fontopts, "_map", 4))
2881 opttype = MAP_OPTION;
2882 else if (!strncmpi(fontopts, "message", 7)
2883 || !strncmpi(fontopts, "_message", 8))
2884 opttype = MESSAGE_OPTION;
2885 else if (!strncmpi(fontopts, "text", 4)
2886 || !strncmpi(fontopts, "_text", 5))
2887 opttype = TEXT_OPTION;
2888 else if (!strncmpi(fontopts, "menu", 4)
2889 || !strncmpi(fontopts, "_menu", 5))
2890 opttype = MENU_OPTION;
2891 else if (!strncmpi(fontopts, "status", 6)
2892 || !strncmpi(fontopts, "_status", 7))
2893 opttype = STATUS_OPTION;
2894 else if (!strncmpi(fontopts, "_size", 5)) {
2895 if (!strncmpi(fontopts, "_size_map", 8))
2896 opttype = MAP_OPTION;
2897 else if (!strncmpi(fontopts, "_size_message", 12))
2898 opttype = MESSAGE_OPTION;
2899 else if (!strncmpi(fontopts, "_size_text", 9))
2900 opttype = TEXT_OPTION;
2901 else if (!strncmpi(fontopts, "_size_menu", 9))
2902 opttype = MENU_OPTION;
2903 else if (!strncmpi(fontopts, "_size_status", 11))
2904 opttype = STATUS_OPTION;
2906 config_error_add("Unknown %s parameter '%s'", fullname, opts);
2910 complain_about_duplicate(opts, 1);
2911 if (opttype > 0 && !negated
2912 && (op = string_for_opt(opts, FALSE)) != empty_optstr) {
2915 iflags.wc_fontsiz_map = atoi(op);
2917 case MESSAGE_OPTION:
2918 iflags.wc_fontsiz_message = atoi(op);
2921 iflags.wc_fontsiz_text = atoi(op);
2924 iflags.wc_fontsiz_menu = atoi(op);
2927 iflags.wc_fontsiz_status = atoi(op);
2933 config_error_add("Unknown %s parameter '%s'", fullname, opts);
2937 && (op = string_for_opt(opts, FALSE)) != empty_optstr) {
2938 wc_set_font_name(opttype, op);
2940 set_font_name(opttype, op);
2943 } else if (negated) {
2944 bad_negation(fullname, TRUE);
2951 if (match_optname(opts, "palette", 3, TRUE)
2953 || match_optname(opts, "hicolor", 3, TRUE)
2956 int color_number, color_incr;
2960 complain_about_duplicate(opts, 1);
2963 if (match_optname(opts, "hicolor", 3, TRUE)) {
2965 bad_negation("hicolor", FALSE);
2968 color_number = CLR_MAX + 4; /* HARDCODED inverse number */
2974 bad_negation("palette", FALSE);
2981 op = string_for_opt(opts, TRUE);
2982 if (op == empty_optstr || !alternative_palette(op)) {
2983 config_error_add("Error in palette parameter '%s'", op);
2987 if ((op = string_for_opt(opts, FALSE)) != empty_optstr) {
2989 int cnt, tmp, reverse;
2992 while (*pt && color_number >= 0) {
3002 if (*pt && *pt != '/') {
3009 if (isalpha((uchar) tmp)) {
3010 tmp = (tmp + 9) & 0xf; /* Assumes ASCII... */
3012 tmp &= 0xf; /* Digits in ASCII too... */
3015 /* Add an extra so we fill f -> ff and 0 -> 00 */
3023 change_color(color_number, rgb, reverse);
3024 color_number += color_incr;
3033 #endif /* CHANGE_COLOR */
3035 if (match_optname(opts, "fruit", 2, TRUE)) {
3036 struct fruit *forig = 0;
3039 complain_about_duplicate(opts, 1);
3040 op = string_for_opt(opts, negated || !initial);
3042 if (op != empty_optstr) {
3043 bad_negation("fruit", TRUE);
3049 if (op == empty_optstr)
3051 /* strip leading/trailing spaces, condense internal ones (3.6.2) */
3057 /* count number of named fruits; if 'op' is found among them,
3058 then the count doesn't matter because we won't be adding it */
3059 f = fruit_from_name(op, FALSE, &fnum);
3061 if (!flags.made_fruit)
3062 forig = fruit_from_name(pl_fruit, FALSE, (int *) 0);
3064 if (!forig && fnum >= 100) {
3067 "Doing that so many times isn't very fruitful.");
3070 "
\82»
\82ñ
\82È
\82É
\89½
\89ñ
\82à
\82â
\82Á
\82Ä
\82à
\82Ù
\82Æ
\82ñ
\82Ç
\88Ó
\96¡
\82Í
\82È
\82¢
\81D");
3077 nmcpy(pl_fruit, op, PL_FSIZ);
3078 sanitize_name(pl_fruit);
3079 /* OBJ_NAME(objects[SLIME_MOLD]) won't work for this after
3080 initialization; it gets changed to generic "fruit" */
3082 nmcpy(pl_fruit, "slime mold", PL_FSIZ);
3084 /* if 'forig' is nonNull, we replace it rather than add
3085 a new fruit; it can only be nonNull if no fruits have
3086 been created since the previous name was put in place */
3087 (void) fruitadd(pl_fruit, forig);
3088 pline("Fruit is now \"%s\".", pl_fruit);
3090 /* If initial, then initoptions is allowed to do it instead
3091 * of here (initoptions always has to do it even if there's
3092 * no fruit option at all. Also, we don't want people
3093 * setting multiple fruits in their options.)
3098 fullname = "whatis_coord";
3099 if (match_optname(opts, fullname, 8, TRUE)) {
3101 complain_about_duplicate(opts, 1);
3103 iflags.getpos_coords = GPCOORDS_NONE;
3105 } else if ((op = string_for_env_opt(fullname, opts, FALSE))
3107 static char gpcoords[] = { GPCOORDS_NONE, GPCOORDS_COMPASS,
3108 GPCOORDS_COMFULL, GPCOORDS_MAP,
3109 GPCOORDS_SCREEN, '\0' };
3112 if (c && index(gpcoords, c))
3113 iflags.getpos_coords = c;
3115 config_error_add("Unknown %s parameter '%s'", fullname, op);
3123 fullname = "whatis_filter";
3124 if (match_optname(opts, fullname, 8, TRUE)) {
3126 complain_about_duplicate(opts, 1);
3128 iflags.getloc_filter = GFILTER_NONE;
3130 } else if ((op = string_for_env_opt(fullname, opts, FALSE))
3136 iflags.getloc_filter = GFILTER_NONE;
3139 iflags.getloc_filter = GFILTER_VIEW;
3142 iflags.getloc_filter = GFILTER_AREA;
3145 config_error_add("Unknown %s parameter '%s'", fullname, op);
3154 fullname = "warnings";
3155 if (match_optname(opts, fullname, 5, TRUE)) {
3157 complain_about_duplicate(opts, 1);
3159 bad_negation(fullname, FALSE);
3162 return warning_opts(opts, fullname);
3165 /* boulder:symbol */
3166 fullname = "boulder";
3167 if (match_optname(opts, fullname, 7, TRUE)) {
3168 #ifdef BACKWARD_COMPAT
3172 complain_about_duplicate(opts, 1);
3174 bad_negation(fullname, FALSE);
3177 /* if ((opts = string_for_env_opt(fullname, opts, FALSE))
3180 if ((opts = string_for_opt(opts, FALSE)) == empty_optstr)
3182 escapes(opts, opts);
3183 /* note: dummy monclass #0 has symbol value '\0'; we allow that--
3184 attempting to set bouldersym to '^@'/'\0' will reset to default */
3185 if (def_char_to_monclass(opts[0]) != MAXMCLASSES)
3186 clash = opts[0] ? 1 : 0;
3187 else if (opts[0] >= '1' && opts[0] < WARNCOUNT + '0')
3190 /* symbol chosen matches a used monster or warning
3191 symbol which is not good - reject it */
3193 "Badoption - boulder symbol '%s' would conflict with a %s symbol",
3195 (clash == 1) ? "monster" : "warning");
3198 * Override the default boulder symbol.
3200 ov_primary_syms[SYM_BOULDER + SYM_OFF_X] = (nhsym) opts[0];
3201 ov_rogue_syms[SYM_BOULDER + SYM_OFF_X] = (nhsym) opts[0];
3202 /* for 'initial', update of BOULDER symbol is done in
3203 initoptions_finish(), after all symset options
3204 have been processed */
3206 nhsym sym = get_othersym(SYM_BOULDER,
3207 Is_rogue_level(&u.uz) ? ROGUESET : PRIMARY);
3209 showsyms[SYM_BOULDER + SYM_OFF_X] = sym;
3215 config_error_add("'%s' no longer supported; use S_boulder:c instead",
3223 if (match_optname(opts, fullname, 4, TRUE)) {
3225 complain_about_duplicate(opts, 1);
3227 bad_negation(fullname, FALSE);
3229 } else if ((op = string_for_env_opt(fullname, opts, FALSE))
3231 nmcpy(plname, op, PL_NSIZ);
3237 /* altkeyhandler:string */
3238 fullname = "altkeyhandler";
3239 if (match_optname(opts, fullname, 4, TRUE)) {
3241 complain_about_duplicate(opts, 1);
3243 bad_negation(fullname, FALSE);
3245 } else if ((op = string_for_opt(opts, negated)) != empty_optstr) {
3246 #if defined(WIN32) && defined(TTY_GRAPHICS)
3247 set_altkeyhandler(op);
3255 * align_status:[left|top|right|bottom] */
3256 fullname = "align_status";
3257 if (match_optname(opts, fullname, sizeof "align_status" - 1, TRUE)) {
3258 op = string_for_opt(opts, negated);
3259 if ((op != empty_optstr) && !negated) {
3260 if (!strncmpi(op, "left", sizeof "left" - 1))
3261 iflags.wc_align_status = ALIGN_LEFT;
3262 else if (!strncmpi(op, "top", sizeof "top" - 1))
3263 iflags.wc_align_status = ALIGN_TOP;
3264 else if (!strncmpi(op, "right", sizeof "right" - 1))
3265 iflags.wc_align_status = ALIGN_RIGHT;
3266 else if (!strncmpi(op, "bottom", sizeof "bottom" - 1))
3267 iflags.wc_align_status = ALIGN_BOTTOM;
3269 config_error_add("Unknown %s parameter '%s'", fullname, op);
3272 } else if (negated) {
3273 bad_negation(fullname, TRUE);
3280 * align_message:[left|top|right|bottom] */
3281 fullname = "align_message";
3282 if (match_optname(opts, fullname, sizeof "align_message" - 1, TRUE)) {
3284 complain_about_duplicate(opts, 1);
3285 op = string_for_opt(opts, negated);
3286 if ((op != empty_optstr) && !negated) {
3287 if (!strncmpi(op, "left", sizeof "left" - 1))
3288 iflags.wc_align_message = ALIGN_LEFT;
3289 else if (!strncmpi(op, "top", sizeof "top" - 1))
3290 iflags.wc_align_message = ALIGN_TOP;
3291 else if (!strncmpi(op, "right", sizeof "right" - 1))
3292 iflags.wc_align_message = ALIGN_RIGHT;
3293 else if (!strncmpi(op, "bottom", sizeof "bottom" - 1))
3294 iflags.wc_align_message = ALIGN_BOTTOM;
3296 config_error_add("Unknown %s parameter '%s'", fullname, op);
3299 } else if (negated) {
3300 bad_negation(fullname, TRUE);
3306 /* the order to list inventory */
3307 fullname = "packorder";
3308 if (match_optname(opts, fullname, 4, TRUE)) {
3310 complain_about_duplicate(opts, 1);
3312 bad_negation(fullname, FALSE);
3314 } else if ((op = string_for_opt(opts, FALSE)) == empty_optstr)
3317 if (!change_inv_order(op))
3322 /* user can change required response for some prompts (quit, die, hit),
3323 or add an extra prompt (pray, Remove) that isn't ordinarily there */
3324 fullname = "paranoid_confirmation";
3325 if (match_optname(opts, fullname, 8, TRUE)) {
3326 /* at present we don't complain about duplicates for this
3327 option, but we do throw away the old settings whenever
3328 we process a new one [clearing old flags is essential
3329 for handling default paranoid_confirm:pray sanely] */
3330 flags.paranoia_bits = 0; /* clear all */
3332 flags.paranoia_bits = 0; /* [now redundant...] */
3333 } else if ((op = string_for_opt(opts, TRUE)) != empty_optstr) {
3334 char *pp, buf[BUFSZ];
3336 strncpy(buf, op, sizeof buf - 1);
3337 buf[sizeof buf - 1] = '\0';
3338 op = mungspaces(buf);
3340 /* We're looking to parse
3341 "paranoid_confirm:whichone wheretwo whothree"
3342 and "paranoid_confirm:" prefix has already
3343 been stripped off by the time we get here */
3344 pp = index(op, ' ');
3347 /* we aren't matching option names but match_optname()
3348 does what we want once we've broken the space
3349 delimited aggregate into separate tokens */
3350 for (i = 0; i < SIZE(paranoia); ++i) {
3351 if (match_optname(op, paranoia[i].argname,
3352 paranoia[i].argMinLen, FALSE)
3353 || (paranoia[i].synonym
3354 && match_optname(op, paranoia[i].synonym,
3355 paranoia[i].synMinLen, FALSE))) {
3356 if (paranoia[i].flagmask)
3357 flags.paranoia_bits |= paranoia[i].flagmask;
3358 else /* 0 == "none", so clear all */
3359 flags.paranoia_bits = 0;
3363 if (i == SIZE(paranoia)) {
3364 /* didn't match anything, so arg is bad;
3365 any flags already set will stay set */
3366 config_error_add("Unknown %s parameter '%s'",
3370 /* move on to next token */
3374 break; /* no next token */
3381 /* accept deprecated boolean; superseded by paranoid_confirm:pray */
3382 fullname = "prayconfirm";
3383 if (match_optname(opts, fullname, 4, FALSE)) {
3385 flags.paranoia_bits &= ~PARANOID_PRAY;
3387 flags.paranoia_bits |= PARANOID_PRAY;
3391 /* maximum burden picked up before prompt (Warren Cheung) */
3392 fullname = "pickup_burden";
3393 if (match_optname(opts, fullname, 8, TRUE)) {
3395 complain_about_duplicate(opts, 1);
3397 bad_negation(fullname, FALSE);
3399 } else if ((op = string_for_env_opt(fullname, opts, FALSE))
3401 switch (lowc(*op)) {
3402 case 'u': /* Unencumbered */
3403 flags.pickup_burden = UNENCUMBERED;
3405 case 'b': /* Burdened (slight encumbrance) */
3406 flags.pickup_burden = SLT_ENCUMBER;
3408 case 's': /* streSsed (moderate encumbrance) */
3409 flags.pickup_burden = MOD_ENCUMBER;
3411 case 'n': /* straiNed (heavy encumbrance) */
3412 flags.pickup_burden = HVY_ENCUMBER;
3414 case 'o': /* OverTaxed (extreme encumbrance) */
3416 flags.pickup_burden = EXT_ENCUMBER;
3418 case 'l': /* overLoaded */
3419 flags.pickup_burden = OVERLOADED;
3422 config_error_add("Unknown %s parameter '%s'", fullname, op);
3430 /* types of objects to pick up automatically */
3431 fullname = "pickup_types";
3432 if (match_optname(opts, fullname, 8, TRUE)) {
3433 char ocl[MAXOCLASSES + 1], tbuf[MAXOCLASSES + 1],
3434 qbuf[QBUFSZ], abuf[BUFSZ];
3436 boolean badopt = FALSE, compat = (strlen(opts) <= 6), use_menu;
3439 complain_about_duplicate(opts, 1);
3440 oc_to_str(flags.pickup_types, tbuf);
3441 flags.pickup_types[0] = '\0'; /* all */
3442 op = string_for_opt(opts, (compat || !initial));
3443 if (op == empty_optstr) {
3444 if (compat || negated || initial) {
3445 /* for backwards compatibility, "pickup" without a
3446 value is a synonym for autopickup of all types
3447 (and during initialization, we can't prompt yet) */
3448 flags.pickup = !negated;
3451 oc_to_str(flags.inv_order, ocl);
3453 if (flags.menu_style == MENU_TRADITIONAL
3454 || flags.menu_style == MENU_COMBINATION) {
3459 Sprintf(qbuf, "New %s: [%s am] (%s)", fullname, ocl,
3460 *tbuf ? tbuf : "all");
3462 Sprintf(qbuf, "
\90V
\82µ
\82¢%s: [%s am] (%s)", fullname, ocl,
3463 *tbuf ? tbuf : "all");
3467 wasspace = (abuf[0] == ' '); /* before mungspaces */
3468 op = mungspaces(abuf);
3469 if (wasspace && !abuf[0])
3470 ; /* one or more spaces will remove old value */
3471 else if (!abuf[0] || abuf[0] == '\033')
3472 op = tbuf; /* restore */
3473 else if (abuf[0] == 'm')
3475 /* note: abuf[0]=='a' is already handled via clearing the
3476 the old value (above) as a default action */
3479 if (wizard && !index(ocl, VENOM_SYM))
3480 strkitten(ocl, VENOM_SYM);
3482 (void) choose_classes_menu("Autopickup what?", 1, TRUE, ocl,
3485 (void) choose_classes_menu("
\82Ç
\82ê
\82ð
\8e©
\93®
\8fE
\82¢
\82É
\90Ý
\92è
\82·
\82é
\81H", 1, TRUE, ocl,
3492 bad_negation(fullname, TRUE);
3497 if (*op != 'a' && *op != 'A') {
3500 oc_sym = def_char_to_objclass(*op);
3501 /* make sure all are valid obj symbols occurring once */
3502 if (oc_sym != MAXOCLASSES
3503 && !index(flags.pickup_types, oc_sym)) {
3504 flags.pickup_types[num] = (char) oc_sym;
3505 flags.pickup_types[++num] = '\0';
3511 config_error_add("Unknown %s parameter '%s'", fullname, op);
3518 /* pile limit: when walking over objects, number which triggers
3519 "there are several/many objects here" instead of listing them */
3520 fullname = "pile_limit";
3521 if (match_optname(opts, fullname, 4, TRUE)) {
3523 complain_about_duplicate(opts, 1);
3524 op = string_for_opt(opts, negated);
3525 if ((negated && op == empty_optstr)
3526 || (!negated && op != empty_optstr))
3527 flags.pile_limit = negated ? 0 : atoi(op);
3529 bad_negation(fullname, TRUE);
3531 } else /* op == empty_optstr */
3532 flags.pile_limit = PILE_LIMIT_DFLT;
3534 if (flags.pile_limit < 0)
3535 flags.pile_limit = PILE_LIMIT_DFLT;
3539 /* play mode: normal, explore/discovery, or debug/wizard */
3540 fullname = "playmode";
3541 if (match_optname(opts, fullname, 4, TRUE)) {
3543 complain_about_duplicate(opts, 1);
3545 bad_negation(fullname, FALSE);
3546 if (duplicate || negated)
3548 op = string_for_opt(opts, FALSE);
3549 if (op == empty_optstr)
3551 if (!strncmpi(op, "normal", 6) || !strcmpi(op, "play")) {
3552 wizard = discover = FALSE;
3553 } else if (!strncmpi(op, "explore", 6)
3554 || !strncmpi(op, "discovery", 6)) {
3555 wizard = FALSE, discover = TRUE;
3556 } else if (!strncmpi(op, "debug", 5) || !strncmpi(op, "wizard", 6)) {
3557 wizard = TRUE, discover = FALSE;
3559 config_error_add("Invalid value for \"%s\":%s", fullname, op);
3566 * player_selection: dialog | prompt/prompts/prompting */
3567 fullname = "player_selection";
3568 if (match_optname(opts, fullname, sizeof "player_selection" - 1, TRUE)) {
3570 complain_about_duplicate(opts, 1);
3571 op = string_for_opt(opts, negated);
3572 if (op != empty_optstr && !negated) {
3573 if (!strncmpi(op, "dialog", sizeof "dialog" - 1)) {
3574 iflags.wc_player_selection = VIA_DIALOG;
3575 } else if (!strncmpi(op, "prompt", sizeof "prompt" - 1)) {
3576 iflags.wc_player_selection = VIA_PROMPTS;
3578 config_error_add("Unknown %s parameter '%s'", fullname, op);
3581 } else if (negated) {
3582 bad_negation(fullname, TRUE);
3588 /* things to disclose at end of game */
3589 fullname = "disclose";
3590 if (match_optname(opts, fullname, 7, TRUE)) {
3592 * The order that the end_disclose options are stored:
3593 * inventory, attribs, vanquished, genocided,
3594 * conduct, overview.
3595 * There is an array in flags:
3596 * end_disclose[NUM_DISCLOSURE_OPT];
3597 * with option settings for the each of the following:
3598 * iagvc [see disclosure_options in decl.c]:
3599 * Allowed setting values in that array are:
3600 * DISCLOSE_PROMPT_DEFAULT_YES ask with default answer yes
3601 * DISCLOSE_PROMPT_DEFAULT_NO ask with default answer no
3602 * DISCLOSE_YES_WITHOUT_PROMPT always disclose and don't ask
3603 * DISCLOSE_NO_WITHOUT_PROMPT never disclose and don't ask
3604 * DISCLOSE_PROMPT_DEFAULT_SPECIAL for 'vanquished' only...
3605 * DISCLOSE_SPECIAL_WITHOUT_PROMPT ...to set up sort order.
3607 * Those setting values can be used in the option
3608 * string as a prefix to get the desired behaviour.
3610 * For backward compatibility, no prefix is required,
3611 * and the presence of a i,a,g,v, or c without a prefix
3612 * sets the corresponding value to DISCLOSE_YES_WITHOUT_PROMPT.
3614 int idx, prefix_val;
3617 complain_about_duplicate(opts, 1);
3618 op = string_for_opt(opts, TRUE);
3619 if (op != empty_optstr && negated) {
3620 bad_negation(fullname, TRUE);
3623 /* "disclose" without a value means "all with prompting"
3624 and negated means "none without prompting" */
3625 if (op == empty_optstr
3626 || !strcmpi(op, "all") || !strcmpi(op, "none")) {
3627 if (op != empty_optstr && !strcmpi(op, "none"))
3629 for (num = 0; num < NUM_DISCLOSURE_OPTIONS; num++)
3630 flags.end_disclose[num] = negated
3631 ? DISCLOSE_NO_WITHOUT_PROMPT
3632 : DISCLOSE_PROMPT_DEFAULT_YES;
3638 while (*op && num < sizeof flags.end_disclose - 1) {
3639 static char valid_settings[] = {
3640 DISCLOSE_PROMPT_DEFAULT_YES, DISCLOSE_PROMPT_DEFAULT_NO,
3641 DISCLOSE_PROMPT_DEFAULT_SPECIAL,
3642 DISCLOSE_YES_WITHOUT_PROMPT, DISCLOSE_NO_WITHOUT_PROMPT,
3643 DISCLOSE_SPECIAL_WITHOUT_PROMPT, '\0'
3645 register char c, *dop;
3649 c = 'v'; /* killed -> vanquished */
3651 c = 'o'; /* dungeon -> overview */
3652 dop = index(disclosure_options, c);
3654 idx = (int) (dop - disclosure_options);
3655 if (idx < 0 || idx > NUM_DISCLOSURE_OPTIONS - 1) {
3656 impossible("bad disclosure index %d %c", idx, c);
3659 if (prefix_val != -1) {
3661 if (prefix_val == DISCLOSE_PROMPT_DEFAULT_SPECIAL)
3662 prefix_val = DISCLOSE_PROMPT_DEFAULT_YES;
3663 if (prefix_val == DISCLOSE_SPECIAL_WITHOUT_PROMPT)
3664 prefix_val = DISCLOSE_YES_WITHOUT_PROMPT;
3666 flags.end_disclose[idx] = prefix_val;
3669 flags.end_disclose[idx] = DISCLOSE_YES_WITHOUT_PROMPT;
3670 } else if (index(valid_settings, c)) {
3672 } else if (c == ' ') {
3675 config_error_add("Unknown %s parameter '%c'", fullname, *op);
3683 if (!strncmpi(opts, "kcode", 3)){
3684 if ((op = string_for_env_opt("kcode", opts, FALSE)) != 0){
3691 /* scores:5t[op] 5a[round] o[wn] */
3692 fullname = "scores";
3693 if (match_optname(opts, fullname, 4, TRUE)) {
3695 complain_about_duplicate(opts, 1);
3697 bad_negation(fullname, FALSE);
3700 if ((op = string_for_opt(opts, FALSE)) == empty_optstr)
3710 } else if (*op == '!') {
3720 flags.end_top = inum;
3724 flags.end_around = inum;
3728 flags.end_own = !negated;
3731 config_error_add("Unknown %s parameter '%s'", fullname, op);
3734 /* "3a" is sufficient but accept "3around" (or "3abracadabra") */
3737 /* t, a, and o can be separated by space(s) or slash or both */
3746 fullname = "sortloot";
3747 if (match_optname(opts, fullname, 4, TRUE)) {
3748 op = string_for_env_opt(fullname, opts, FALSE);
3749 if (op != empty_optstr) {
3753 case 'n': /* none */
3754 case 'l': /* loot (pickup) */
3755 case 'f': /* full (pickup + invent) */
3759 config_error_add("Unknown %s parameter '%s'", fullname, op);
3767 fullname = "suppress_alert";
3768 if (match_optname(opts, fullname, 4, TRUE)) {
3770 complain_about_duplicate(opts, 1);
3771 op = string_for_opt(opts, negated);
3773 bad_negation(fullname, FALSE);
3775 } else if (op != empty_optstr)
3776 (void) feature_alert_opts(op, fullname);
3781 /* videocolors:string */
3782 fullname = "videocolors";
3783 if (match_optname(opts, fullname, 6, TRUE)
3784 || match_optname(opts, "videocolours", 10, TRUE)) {
3786 complain_about_duplicate(opts, 1);
3788 bad_negation(fullname, FALSE);
3790 } else if ((opts = string_for_env_opt(fullname, opts, FALSE))
3794 if (!assign_videocolors(opts)) {
3795 config_error_add("Unknown error handling '%s'", fullname);
3800 /* videoshades:string */
3801 fullname = "videoshades";
3802 if (match_optname(opts, fullname, 6, TRUE)) {
3804 complain_about_duplicate(opts, 1);
3806 bad_negation(fullname, FALSE);
3808 } else if ((opts = string_for_env_opt(fullname, opts, FALSE))
3812 if (!assign_videoshades(opts)) {
3813 config_error_add("Unknown error handling '%s'", fullname);
3818 #endif /* VIDEOSHADES */
3822 /* video:string -- must be after longer tests */
3824 if (match_optname(opts, fullname, 5, TRUE)) {
3826 complain_about_duplicate(opts, 1);
3828 bad_negation(fullname, FALSE);
3830 } else if ((opts = string_for_env_opt(fullname, opts, FALSE))
3834 if (!assign_video(opts)) {
3835 config_error_add("Unknown error handling '%s'", fullname);
3840 #endif /* NO_TERMS */
3841 /* soundcard:string -- careful not to match boolean 'sound' */
3842 fullname = "soundcard";
3843 if (match_optname(opts, fullname, 6, TRUE)) {
3845 complain_about_duplicate(opts, 1);
3847 bad_negation(fullname, FALSE);
3849 } else if ((opts = string_for_env_opt(fullname, opts, FALSE))
3853 if (!assign_soundcard(opts)) {
3854 config_error_add("Unknown error handling '%s'", fullname);
3863 * map_mode:[tiles|ascii4x6|ascii6x8|ascii8x8|ascii16x8|ascii7x12
3864 * |ascii8x12|ascii16x12|ascii12x16|ascii10x18|fit_to_screen
3865 * |ascii_fit_to_screen|tiles_fit_to_screen]
3867 fullname = "map_mode";
3868 if (match_optname(opts, fullname, sizeof "map_mode" - 1, TRUE)) {
3870 complain_about_duplicate(opts, 1);
3871 op = string_for_opt(opts, negated);
3872 if (op != empty_optstr && !negated) {
3873 if (!strcmpi(op, "tiles"))
3874 iflags.wc_map_mode = MAP_MODE_TILES;
3875 else if (!strncmpi(op, "ascii4x6", sizeof "ascii4x6" - 1))
3876 iflags.wc_map_mode = MAP_MODE_ASCII4x6;
3877 else if (!strncmpi(op, "ascii6x8", sizeof "ascii6x8" - 1))
3878 iflags.wc_map_mode = MAP_MODE_ASCII6x8;
3879 else if (!strncmpi(op, "ascii8x8", sizeof "ascii8x8" - 1))
3880 iflags.wc_map_mode = MAP_MODE_ASCII8x8;
3881 else if (!strncmpi(op, "ascii16x8", sizeof "ascii16x8" - 1))
3882 iflags.wc_map_mode = MAP_MODE_ASCII16x8;
3883 else if (!strncmpi(op, "ascii7x12", sizeof "ascii7x12" - 1))
3884 iflags.wc_map_mode = MAP_MODE_ASCII7x12;
3885 else if (!strncmpi(op, "ascii8x12", sizeof "ascii8x12" - 1))
3886 iflags.wc_map_mode = MAP_MODE_ASCII8x12;
3887 else if (!strncmpi(op, "ascii16x12", sizeof "ascii16x12" - 1))
3888 iflags.wc_map_mode = MAP_MODE_ASCII16x12;
3889 else if (!strncmpi(op, "ascii12x16", sizeof "ascii12x16" - 1))
3890 iflags.wc_map_mode = MAP_MODE_ASCII12x16;
3891 else if (!strncmpi(op, "ascii10x18", sizeof "ascii10x18" - 1))
3892 iflags.wc_map_mode = MAP_MODE_ASCII10x18;
3893 else if (!strncmpi(op, "fit_to_screen",
3894 sizeof "fit_to_screen" - 1))
3895 iflags.wc_map_mode = MAP_MODE_ASCII_FIT_TO_SCREEN;
3896 else if (!strncmpi(op, "ascii_fit_to_screen",
3897 sizeof "ascii_fit_to_screen" - 1))
3898 iflags.wc_map_mode = MAP_MODE_ASCII_FIT_TO_SCREEN;
3899 else if (!strncmpi(op, "tiles_fit_to_screen",
3900 sizeof "tiles_fit_to_screen" - 1))
3901 iflags.wc_map_mode = MAP_MODE_TILES_FIT_TO_SCREEN;
3903 config_error_add("Unknown %s parameter '%s'", fullname, op);
3906 } else if (negated) {
3907 bad_negation(fullname, TRUE);
3914 * scroll_amount:nn */
3915 fullname = "scroll_amount";
3916 if (match_optname(opts, fullname, sizeof "scroll_amount" - 1, TRUE)) {
3918 complain_about_duplicate(opts, 1);
3919 op = string_for_opt(opts, negated);
3920 if ((negated && op == empty_optstr)
3921 || (!negated && op != empty_optstr)) {
3922 iflags.wc_scroll_amount = negated ? 1 : atoi(op);
3923 } else if (negated) {
3924 bad_negation(fullname, TRUE);
3931 * scroll_margin:nn */
3932 fullname = "scroll_margin";
3933 if (match_optname(opts, fullname, sizeof "scroll_margin" - 1, TRUE)) {
3935 complain_about_duplicate(opts, 1);
3936 op = string_for_opt(opts, negated);
3937 if ((negated && op == empty_optstr)
3938 || (!negated && op != empty_optstr)) {
3939 iflags.wc_scroll_margin = negated ? 5 : atoi(op);
3940 } else if (negated) {
3941 bad_negation(fullname, TRUE);
3947 fullname = "subkeyvalue";
3948 if (match_optname(opts, fullname, 5, TRUE)) {
3949 /* no duplicate complaint here */
3951 bad_negation(fullname, FALSE);
3955 op = string_for_opt(opts, 0);
3956 if (op == empty_optstr)
3959 map_subkeyvalue(op);
3968 fullname = "tile_width";
3969 if (match_optname(opts, fullname, sizeof "tile_width" - 1, TRUE)) {
3971 complain_about_duplicate(opts, 1);
3972 op = string_for_opt(opts, negated);
3973 if ((negated && op == empty_optstr)
3974 || (!negated && op != empty_optstr)) {
3975 iflags.wc_tile_width = negated ? 0 : atoi(op);
3976 } else if (negated) {
3977 bad_negation(fullname, TRUE);
3984 fullname = "tile_file";
3985 if (match_optname(opts, fullname, sizeof "tile_file" - 1, TRUE)) {
3987 complain_about_duplicate(opts, 1);
3988 if ((op = string_for_opt(opts, FALSE)) != empty_optstr) {
3989 if (iflags.wc_tile_file)
3990 free(iflags.wc_tile_file);
3991 iflags.wc_tile_file = dupstr(op);
3998 fullname = "tile_height";
3999 if (match_optname(opts, fullname, sizeof "tile_height" - 1, TRUE)) {
4001 complain_about_duplicate(opts, 1);
4002 op = string_for_opt(opts, negated);
4003 if ((negated && op == empty_optstr)
4004 || (!negated && op != empty_optstr)) {
4005 iflags.wc_tile_height = negated ? 0 : atoi(op);
4006 } else if (negated) {
4007 bad_negation(fullname, TRUE);
4014 * vary_msgcount:nn */
4015 fullname = "vary_msgcount";
4016 if (match_optname(opts, fullname, sizeof "vary_msgcount" - 1, TRUE)) {
4018 complain_about_duplicate(opts, 1);
4019 op = string_for_opt(opts, negated);
4020 if ((negated && op == empty_optstr)
4021 || (!negated && op != empty_optstr)) {
4022 iflags.wc_vary_msgcount = negated ? 0 : atoi(op);
4023 } else if (negated) {
4024 bad_negation(fullname, TRUE);
4031 * windowtype: option to choose the interface for binaries built
4032 * with support for more than one interface (tty + X11, for instance).
4034 * Ideally, 'windowtype' should be processed first, because it
4035 * causes the wc_ and wc2_ flags to be set up.
4036 * For user, making it be first in a config file is trivial, use
4037 * OPTIONS=windowtype:Foo
4038 * as the first non-comment line of the file.
4039 * Making it first in NETHACKOPTIONS requires it to be at the _end_
4040 * because comma-separated option strings are processed from right
4043 fullname = "windowtype";
4044 if (match_optname(opts, fullname, 3, TRUE)) {
4045 if (iflags.windowtype_locked)
4048 complain_about_duplicate(opts, 1);
4050 bad_negation(fullname, FALSE);
4052 } else if ((op = string_for_env_opt(fullname, opts, FALSE))
4054 if (!iflags.windowtype_deferred) {
4055 char buf[WINTYPELEN];
4057 nmcpy(buf, op, WINTYPELEN);
4058 choose_windows(buf);
4060 nmcpy(chosen_windowtype, op, WINTYPELEN);
4068 fullname = "windowchain";
4069 if (match_optname(opts, fullname, 3, TRUE)) {
4071 bad_negation(fullname, FALSE);
4073 } else if ((op = string_for_env_opt(fullname, opts, FALSE))
4075 char buf[WINTYPELEN];
4077 nmcpy(buf, op, WINTYPELEN);
4078 addto_windowchain(buf);
4086 * setting window colors
4087 * syntax: windowcolors=menu foregrnd/backgrnd text foregrnd/backgrnd
4089 fullname = "windowcolors";
4090 if (match_optname(opts, fullname, 7, TRUE)) {
4092 complain_about_duplicate(opts, 1);
4093 if ((op = string_for_opt(opts, FALSE)) != empty_optstr) {
4094 if (!wc_set_window_colors(op)) {
4095 config_error_add("Could not set %s '%s'", fullname, op);
4098 } else if (negated) {
4099 bad_negation(fullname, TRUE);
4105 #ifdef CURSES_GRAPHICS
4107 * term_cols:amount or term_rows:amount */
4108 fullname = "term_cols";
4109 if (match_optname(opts, fullname, 8, TRUE)
4110 /* alternate spelling */
4111 || match_optname(opts, "term_columns", 9, TRUE)
4112 /* different option but identical handlng */
4113 || (fullname = "term_rows", match_optname(opts, fullname, 8, TRUE))) {
4116 if ((op = string_for_opt(opts, negated)) != empty_optstr) {
4119 bad_negation(fullname, FALSE);
4122 /* just checks atol() sanity, not logical window size sanity */
4123 } else if (ltmp <= 0L || ltmp >= (long) LARGEST_INT) {
4124 config_error_add("Invalid %s: %ld", fullname, ltmp);
4128 if (!strcmp(fullname, "term_rows"))
4129 iflags.wc2_term_rows = (int) ltmp;
4130 else /* !strcmp(fullname, "term_cols") */
4131 iflags.wc2_term_cols = (int) ltmp;
4139 fullname = "petattr";
4140 if (match_optname(opts, fullname, sizeof "petattr" - 1, TRUE)) {
4141 op = string_for_opt(opts, negated);
4142 if (op != empty_optstr && negated) {
4143 bad_negation(fullname, TRUE);
4145 } else if (op != empty_optstr) {
4146 #ifdef CURSES_GRAPHICS
4147 int itmp = curses_read_attrs(op);
4150 config_error_add("Unknown %s parameter '%s'", fullname, opts);
4153 iflags.wc2_petattr = itmp;
4155 /* non-curses windowports will not use this flag anyway
4156 * but the above will not compile if we don't have curses.
4157 * Just set it to a sensible default: */
4158 iflags.wc2_petattr = ATR_INVERSE;
4160 } else if (negated) {
4161 iflags.wc2_petattr = ATR_NONE;
4164 iflags.hilite_pet = (iflags.wc2_petattr != ATR_NONE);
4172 * windowborders:n */
4173 fullname = "windowborders";
4174 if (match_optname(opts, fullname, 10, TRUE)) {
4175 op = string_for_opt(opts, negated);
4176 if (negated && op != empty_optstr) {
4177 bad_negation(fullname, TRUE);
4184 else if (op == empty_optstr)
4186 else /* Value supplied; expect 0 (off), 1 (on), or 2 (auto) */
4189 if (itmp < 0 || itmp > 2) {
4190 config_error_add("Invalid %s (should be 0, 1, or 2): %s",
4194 iflags.wc2_windowborders = itmp;
4199 #endif /* CURSES_GRAPHICS */
4203 fullname = "statuslines";
4204 if (match_optname(opts, fullname, 11, TRUE)) {
4207 op = string_for_opt(opts, negated);
4209 bad_negation(fullname, TRUE);
4212 } else if (op != empty_optstr) {
4215 if (itmp < 2 || itmp > 3) {
4216 config_error_add("'%s' requires a value of 2 or 3", fullname);
4219 iflags.wc2_statuslines = itmp;
4226 /* menustyle:traditional or combination or full or partial */
4227 fullname = "menustyle";
4228 if (match_optname(opts, fullname, 4, TRUE)) {
4230 boolean val_required = (strlen(opts) > 5 && !negated);
4233 complain_about_duplicate(opts, 1);
4234 if ((op = string_for_opt(opts, !val_required)) == empty_optstr) {
4236 return FALSE; /* string_for_opt gave feedback */
4237 tmp = negated ? 'n' : 'f';
4242 case 'n': /* none */
4243 case 't': /* traditional: prompt for class(es) by symbol,
4244 prompt for each item within class(es) one at a time */
4245 flags.menu_style = MENU_TRADITIONAL;
4247 case 'c': /* combination: prompt for class(es) by symbol,
4248 choose items within selected class(es) by menu */
4249 flags.menu_style = MENU_COMBINATION;
4251 case 'f': /* full: choose class(es) by first menu,
4252 choose items within selected class(es) by second menu */
4253 flags.menu_style = MENU_FULL;
4255 case 'p': /* partial: skip class filtering,
4256 choose items among all classes by menu */
4257 flags.menu_style = MENU_PARTIAL;
4260 config_error_add("Unknown %s parameter '%s'", fullname, op);
4266 fullname = "menu_headings";
4267 if (match_optname(opts, fullname, 12, TRUE)) {
4271 complain_about_duplicate(opts, 1);
4273 bad_negation(fullname, FALSE);
4275 } else if ((opts = string_for_env_opt(fullname, opts, FALSE))
4279 tmpattr = match_str2attr(opts, TRUE);
4283 iflags.menu_headings = tmpattr;
4287 /* check for menu command mapping */
4288 for (i = 0; i < SIZE(default_menu_cmd_info); i++) {
4289 fullname = default_menu_cmd_info[i].name;
4291 complain_about_duplicate(opts, 1);
4292 if (match_optname(opts, fullname, (int) strlen(fullname), TRUE)) {
4294 bad_negation(fullname, FALSE);
4296 } else if ((op = string_for_opt(opts, FALSE)) != empty_optstr) {
4297 char c, op_buf[BUFSZ];
4299 escapes(op, op_buf);
4302 if (illegal_menu_cmd_key(c))
4305 add_menu_cmd_alias(c, default_menu_cmd_info[i].cmd);
4311 /* hilite fields in status prompt */
4312 fullname = "hilite_status";
4313 if (match_optname(opts, fullname, 13, TRUE)) {
4314 #ifdef STATUS_HILITES
4316 complain_about_duplicate(opts, 1);
4317 op = string_for_opt(opts, TRUE);
4318 if (op != empty_optstr && negated) {
4319 clear_status_hilites();
4321 } else if (op == empty_optstr) {
4322 config_error_add("Value is mandatory for hilite_status");
4325 if (!parse_status_hl1(op, tfrom_file))
4329 config_error_add("'%s' is not supported", fullname);
4334 /* control over whether highlights should be displayed, and for how long */
4335 fullname = "statushilites";
4336 if (match_optname(opts, fullname, 9, TRUE)) {
4337 #ifdef STATUS_HILITES
4339 iflags.hilite_delta = 0L;
4341 op = string_for_opt(opts, TRUE);
4342 iflags.hilite_delta = (op == empty_optstr || !*op) ? 3L : atol(op);
4343 if (iflags.hilite_delta < 0L)
4344 iflags.hilite_delta = 1L;
4347 reset_status_hilites();
4350 config_error_add("'%s' is not supported", fullname);
4355 fullname = "DECgraphics";
4356 if (match_optname(opts, fullname, 3, TRUE)) {
4357 #ifdef BACKWARD_COMPAT
4358 boolean badflag = FALSE;
4361 complain_about_duplicate(opts, 1);
4363 /* There is no rogue level DECgraphics-specific set */
4364 if (symset[PRIMARY].name) {
4367 symset[PRIMARY].name = dupstr(fullname);
4368 if (!read_sym_file(PRIMARY)) {
4370 clear_symsetentry(PRIMARY, TRUE);
4372 switch_symbols(TRUE);
4375 config_error_add("Failure to load symbol set %s.", fullname);
4381 config_error_add("'%s' no longer supported; use 'symset:%s' instead",
4382 fullname, fullname);
4385 } /* "DECgraphics" */
4387 fullname = "IBMgraphics";
4388 if (match_optname(opts, fullname, 3, TRUE)) {
4389 #ifdef BACKWARD_COMPAT
4390 const char *sym_name = fullname;
4391 boolean badflag = FALSE;
4394 complain_about_duplicate(opts, 1);
4396 for (i = 0; i < NUM_GRAPHICS; ++i) {
4397 if (symset[i].name) {
4401 sym_name = "RogueIBM";
4402 symset[i].name = dupstr(sym_name);
4403 if (!read_sym_file(i)) {
4405 clear_symsetentry(i, TRUE);
4411 config_error_add("Failure to load symbol set %s.", sym_name);
4414 switch_symbols(TRUE);
4415 if (!initial && Is_rogue_level(&u.uz))
4416 assign_graphics(ROGUESET);
4421 config_error_add("'%s' no longer supported; use 'symset:%s' instead",
4422 fullname, fullname);
4425 } /* "IBMgraphics" */
4427 fullname = "MACgraphics";
4428 if (match_optname(opts, fullname, 3, TRUE)) {
4429 #if defined(MAC_GRAPHICS_ENV) && defined(BACKWARD_COMPAT)
4430 boolean badflag = FALSE;
4433 complain_about_duplicate(opts, 1);
4435 if (symset[PRIMARY].name) {
4438 symset[PRIMARY].name = dupstr(fullname);
4439 if (!read_sym_file(PRIMARY)) {
4441 clear_symsetentry(PRIMARY, TRUE);
4445 config_error_add("Failure to load symbol set %s.", fullname);
4448 switch_symbols(TRUE);
4449 if (!initial && Is_rogue_level(&u.uz))
4450 assign_graphics(ROGUESET);
4454 #else /* !(MAC_GRAPHICS_ENV && BACKWARD_COMPAT) */
4455 config_error_add("'%s' %s; use 'symset:%s' instead",
4457 #ifdef MAC_GRAPHICS_ENV /* implies BACKWARD_COMPAT is not defined */
4458 "no longer supported",
4464 #endif /* ?(MAC_GRAPHICS_ENV && BACKWARD_COMPAT) */
4465 } /* "MACgraphics" */
4468 * OK, if we still haven't recognized the option, check the boolean
4471 for (i = 0; boolopt[i].name; i++) {
4472 if (match_optname(opts, boolopt[i].name, 3, TRUE)) {
4473 /* options that don't exist */
4474 if (!boolopt[i].addr) {
4475 if (!initial && !negated)
4476 pline_The("\"%s\" option is not available.",
4480 /* options that must come from config file */
4481 if (!initial && (boolopt[i].optflags == SET_IN_FILE)) {
4482 rejectoption(boolopt[i].name);
4486 op = string_for_opt(opts, TRUE);
4487 if (op != empty_optstr) {
4490 "Negated boolean '%s' should not have a parameter",
4494 if (!strcmp(op, "true") || !strcmp(op, "yes")) {
4496 } else if (!strcmp(op, "false") || !strcmp(op, "no")) {
4499 config_error_add("Illegal parameter for a boolean");
4503 if (iflags.debug_fuzzer && !initial) {
4504 /* don't randomly toggle this/these */
4505 if (boolopt[i].addr == &flags.silent)
4509 *(boolopt[i].addr) = !negated;
4511 /* 0 means boolean opts */
4512 if (duplicate_opt_detection(boolopt[i].name, 0))
4513 complain_about_duplicate(boolopt[i].name, 0);
4515 if (boolopt[i].addr == &iflags.rlecomp)
4516 set_savepref(iflags.rlecomp ? "rlecomp" : "!rlecomp");
4519 if (boolopt[i].addr == &iflags.zerocomp)
4520 set_savepref(iflags.zerocomp ? "zerocomp" : "externalcomp");
4522 if (boolopt[i].addr == &iflags.wc_ascii_map) {
4523 /* toggling ascii_map; set tiled_map to its opposite;
4524 what does it mean to turn off ascii map if tiled map
4525 isn't supported? -- right now, we do nothing */
4526 iflags.wc_tiled_map = negated;
4527 } else if (boolopt[i].addr == &iflags.wc_tiled_map) {
4528 /* toggling tiled_map; set ascii_map to its opposite;
4529 as with ascii_map, what does it mean to turn off tiled
4530 map if ascii map isn't supported? */
4531 iflags.wc_ascii_map = negated;
4533 /* only do processing below if setting with doset() */
4537 if (boolopt[i].addr == &flags.time
4538 #ifdef SCORE_ON_BOTL
4539 || boolopt[i].addr == &flags.showscore
4541 || boolopt[i].addr == &flags.showexp) {
4542 if (VIA_WINDOWPORT())
4543 status_initialize(REASSESS_ONLY);
4544 context.botl = TRUE;
4545 } else if (boolopt[i].addr == &flags.invlet_constant
4546 || boolopt[i].addr == &flags.sortpack
4547 || boolopt[i].addr == &iflags.implicit_uncursed) {
4548 if (!flags.invlet_constant)
4551 } else if (boolopt[i].addr == &flags.lit_corridor
4552 || boolopt[i].addr == &flags.dark_room) {
4554 * All corridor squares seen via night vision or
4555 * candles & lamps change. Update them by calling
4556 * newsym() on them. Don't do this if we are
4557 * initializing the options --- the vision system
4560 vision_recalc(2); /* shut down vision */
4561 vision_full_recalc = 1; /* delayed recalc */
4562 if (iflags.use_color)
4563 need_redraw = TRUE; /* darkroom refresh */
4564 } else if (boolopt[i].addr == &flags.showrace
4565 || boolopt[i].addr == &iflags.use_inverse
4566 || boolopt[i].addr == &iflags.hilite_pile
4567 || boolopt[i].addr == &iflags.perm_invent
4568 #ifdef CURSES_GRAPHICS
4569 || boolopt[i].addr == &iflags.cursesgraphics
4571 || boolopt[i].addr == &iflags.wc_ascii_map
4572 || boolopt[i].addr == &iflags.wc_tiled_map) {
4574 } else if (boolopt[i].addr == &iflags.hilite_pet) {
4575 #ifdef CURSES_GRAPHICS
4576 if (WINDOWPORT("curses")) {
4577 /* if we're enabling hilite_pet and petattr isn't set,
4578 set it to Inverse; if we're disabling, leave petattr
4579 alone so that re-enabling will get current value back */
4580 if (iflags.hilite_pet && !iflags.wc2_petattr)
4581 iflags.wc2_petattr = curses_read_attrs("I");
4585 } else if (boolopt[i].addr == &iflags.wc2_hitpointbar) {
4586 if (VIA_WINDOWPORT()) {
4587 /* [is reassessment really needed here?] */
4588 status_initialize(REASSESS_ONLY);
4592 } else if (boolopt[i].addr == &iflags.use_color) {
4602 } else if (boolopt[i].addr == &iflags.use_menu_color
4603 || boolopt[i].addr == &iflags.wc2_guicolor) {
4605 #endif /* TEXTCOLOR */
4611 /* Is it a symbol? */
4612 if (strstr(opts, "S_") == opts && parsesymbols(opts, PRIMARY)) {
4613 switch_symbols(TRUE);
4614 check_gold_symbol();
4618 /* out of valid options */
4619 config_error_add("Unknown option '%s'", opts);
4623 /* parse key:command */
4625 parsebindings(bindings)
4631 boolean ret = FALSE;
4633 /* break off first binding from the rest; parse the rest */
4634 if ((bind = index(bindings, ',')) != 0) {
4636 ret |= parsebindings(bind);
4639 /* parse a single binding: first split around : */
4640 if (! (bind = index(bindings, ':')))
4641 return FALSE; /* it's not a binding */
4644 /* read the key to be bound */
4645 key = txt2key(bindings);
4647 config_error_add("Unknown key binding key '%s'", bindings);
4651 bind = trimspaces(bind);
4653 /* is it a special key? */
4654 if (bind_specialkey(key, bind))
4657 /* is it a menu command? */
4658 for (i = 0; i < SIZE(default_menu_cmd_info); i++) {
4659 if (!strcmp(default_menu_cmd_info[i].name, bind)) {
4660 if (illegal_menu_cmd_key(key)) {
4661 config_error_add("Bad menu key %s:%s", visctrl(key), bind);
4664 add_menu_cmd_alias(key, default_menu_cmd_info[i].cmd);
4669 /* extended command? */
4670 if (!bind_key(key, bind)) {
4671 config_error_add("Unknown key binding command '%s'", bind);
4677 static NEARDATA const char *menutype[] = { "traditional", "combination",
4678 "full", "partial" };
4680 static NEARDATA const char *burdentype[] = { "unencumbered", "burdened",
4681 "stressed", "strained",
4682 "overtaxed", "overloaded" };
4684 static NEARDATA const char *runmodes[] = { "teleport", "run", "walk",
4687 static NEARDATA const char *sortltype[] = { "none", "loot", "full" };
4690 * Convert the given string of object classes to a string of default object
4694 oc_to_str(src, dest)
4699 while ((i = (int) *src++) != 0) {
4700 if (i < 0 || i >= MAXOCLASSES)
4701 impossible("oc_to_str: illegal object class %d", i);
4703 *dest++ = def_oc_syms[i].sym;
4709 * Add the given mapping to the menu command map list. Always keep the
4710 * maps valid C strings.
4713 add_menu_cmd_alias(from_ch, to_ch)
4714 char from_ch, to_ch;
4716 if (n_menu_mapped >= MAX_MENU_MAPPED_CMDS) {
4717 pline("out of menu map space.");
4719 mapped_menu_cmds[n_menu_mapped] = from_ch;
4720 mapped_menu_op[n_menu_mapped] = to_ch;
4722 mapped_menu_cmds[n_menu_mapped] = '\0';
4723 mapped_menu_op[n_menu_mapped] = '\0';
4728 get_menu_cmd_key(ch)
4731 char *found = index(mapped_menu_op, ch);
4734 int idx = (int) (found - mapped_menu_op);
4736 ch = mapped_menu_cmds[idx];
4742 * Map the given character to its corresponding menu command. If it
4743 * doesn't match anything, just return the original.
4749 char *found = index(mapped_menu_cmds, ch);
4752 int idx = (int) (found - mapped_menu_cmds);
4754 ch = mapped_menu_op[idx];
4760 show_menu_controls(win, dolist)
4766 putstr(win, 0, "Menu control keys:");
4770 for (i = 0; i < SIZE(default_menu_cmd_info); i++) {
4771 Sprintf(buf, "%-8s %s",
4772 visctrl(get_menu_cmd_key(default_menu_cmd_info[i].cmd)),
4773 default_menu_cmd_info[i].desc);
4774 putstr(win, 0, buf);
4778 fmt3[] = " %-12s %-2s %-2s %s",
4779 fmt2[] = " %-12s %-2s %-2s",
4780 fmt1[] = " %10s %-2s %s",
4781 fmt0[] = " %14s %s";
4784 putstr(win, 0, "Selection: On page Full menu");
4785 Sprintf(buf, fmt2, "Select all",
4786 visctrl(get_menu_cmd_key(MENU_SELECT_PAGE)),
4787 visctrl(get_menu_cmd_key(MENU_SELECT_ALL)));
4788 putstr(win, 0, buf);
4789 Sprintf(buf, fmt2, "Deselect all",
4790 visctrl(get_menu_cmd_key(MENU_UNSELECT_PAGE)),
4791 visctrl(get_menu_cmd_key(MENU_UNSELECT_ALL)));
4792 putstr(win, 0, buf);
4793 Sprintf(buf, fmt2, "Invert all",
4794 visctrl(get_menu_cmd_key(MENU_INVERT_PAGE)),
4795 visctrl(get_menu_cmd_key(MENU_INVERT_ALL)));
4796 putstr(win, 0, buf);
4797 Sprintf(buf, fmt3, "Text match", "",
4798 visctrl(get_menu_cmd_key(MENU_SEARCH)),
4799 "Search and toggle matching entries");
4800 putstr(win, 0, buf);
4802 putstr(win, 0, "Navigation:");
4803 Sprintf(buf, fmt1, "Go to ",
4804 visctrl(get_menu_cmd_key(MENU_NEXT_PAGE)),
4806 putstr(win, 0, buf);
4807 Sprintf(buf, fmt1, "",
4808 visctrl(get_menu_cmd_key(MENU_PREVIOUS_PAGE)),
4810 putstr(win, 0, buf);
4811 Sprintf(buf, fmt1, "",
4812 visctrl(get_menu_cmd_key(MENU_FIRST_PAGE)),
4814 putstr(win, 0, buf);
4815 Sprintf(buf, fmt1, "",
4816 visctrl(get_menu_cmd_key(MENU_LAST_PAGE)),
4818 putstr(win, 0, buf);
4819 Sprintf(buf, fmt0, "SPACE", "Next page, if any, otherwise RETURN");
4820 putstr(win, 0, buf);
4821 Sprintf(buf, fmt0, "RETURN/ENTER",
4822 "Finish menu with any selection(s) made");
4823 putstr(win, 0, buf);
4824 Sprintf(buf, fmt0, "ESCAPE",
4825 "Cancel menu without selecting anything");
4826 putstr(win, 0, buf);
4830 #if defined(MICRO) || defined(MAC) || defined(WIN32)
4831 #define OPTIONS_HEADING "OPTIONS"
4833 #define OPTIONS_HEADING "NETHACKOPTIONS"
4836 static char fmtstr_doset[] = "%s%-15s [%s] ";
4837 static char fmtstr_doset_tab[] = "%s\t[%s]";
4839 static char n_currently_set[] = "(%d currently set)";
4841 static char n_currently_set[] = "(%d
\8cÂ
\90Ý
\92è
\92\86)";
4843 /* doset('O' command) menu entries for compound options */
4845 doset_add_menu(win, option, indexoffset)
4846 winid win; /* window to add to */
4847 const char *option; /* option name */
4848 int indexoffset; /* value to add to index in compopt[], or zero
4849 if option cannot be changed */
4851 const char *value = "unknown"; /* current value */
4852 char buf[BUFSZ], buf2[BUFSZ];
4857 if (indexoffset == 0) {
4859 value = get_compopt_value(option, buf2);
4861 for (i = 0; compopt[i].name; i++)
4862 if (strcmp(option, compopt[i].name) == 0)
4865 if (compopt[i].name) {
4866 any.a_int = i + 1 + indexoffset;
4867 value = get_compopt_value(option, buf2);
4869 /* We are trying to add an option not found in compopt[].
4870 This is almost certainly bad, but we'll let it through anyway
4871 (with a zero value, so it can't be selected). */
4875 /* " " replaces "a - " -- assumes menus follow that style */
4876 if (!iflags.menu_tab_sep)
4877 Sprintf(buf, fmtstr_doset, any.a_int ? "" : " ", option,
4880 Sprintf(buf, fmtstr_doset_tab, option, value);
4881 add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED);
4885 opts_add_others(win, name, id, bufx, nset)
4892 char buf[BUFSZ], buf2[BUFSZ];
4893 anything any = zeroany;
4897 Sprintf(buf2, n_currently_set, nset);
4899 Sprintf(buf2, "%s", bufx);
4900 if (!iflags.menu_tab_sep)
4901 Sprintf(buf, fmtstr_doset, any.a_int ? "" : " ",
4904 Sprintf(buf, fmtstr_doset_tab, name, buf2);
4905 add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED);
4909 count_apes(VOID_ARGS)
4912 struct autopickup_exception *ape = apelist;
4922 enum opt_other_enums {
4923 OPT_OTHER_MSGTYPE = -4,
4924 OPT_OTHER_MENUCOLOR = -3,
4925 OPT_OTHER_STATHILITE = -2,
4926 OPT_OTHER_APEXC = -1
4927 /* these must be < 0 */
4930 static struct other_opts {
4933 enum opt_other_enums code;
4934 int NDECL((*othr_count_func));
4936 { "autopickup exceptions", SET_IN_GAME, OPT_OTHER_APEXC, count_apes },
4937 { "menu colors", SET_IN_GAME, OPT_OTHER_MENUCOLOR, count_menucolors },
4938 { "message types", SET_IN_GAME, OPT_OTHER_MSGTYPE, msgtype_count },
4939 #ifdef STATUS_HILITES
4940 { "status hilite rules", SET_IN_GAME, OPT_OTHER_STATHILITE,
4941 count_status_hilites },
4943 { (char *) 0, 0, (enum opt_other_enums) 0 },
4946 /* the 'O' command */
4948 doset() /* changing options via menu by Per Liboriussen */
4950 static boolean made_fmtstr = FALSE;
4953 int i = 0, pass, boolcount, pick_cnt, pick_idx, opt_indx;
4957 menu_item *pick_list;
4958 int indexoffset, startpass, endpass, optflags;
4959 boolean setinitial = FALSE, fromfile = FALSE;
4960 unsigned longest_name_len;
4962 tmpwin = create_nhwindow(NHW_MENU);
4965 #ifdef notyet /* SYSCF */
4966 /* XXX I think this is still fragile. Fixing initial/from_file and/or
4967 changing the SET_* etc to bitmaps will let me make this better. */
4969 startpass = SET_IN_SYS;
4972 startpass = DISP_IN_GAME;
4973 endpass = (wizard) ? SET_IN_WIZGAME : SET_IN_GAME;
4975 if (!made_fmtstr && !iflags.menu_tab_sep) {
4976 /* spin through the options to find the longest name
4977 and adjust the format string accordingly */
4978 longest_name_len = 0;
4979 for (pass = 0; pass <= 2; pass++)
4980 for (i = 0; (name = ((pass == 0) ? boolopt[i].name
4981 : (pass == 1) ? compopt[i].name
4982 : othropt[i].name)) != 0; i++) {
4983 if (pass == 0 && !boolopt[i].addr)
4985 optflags = (pass == 0) ? boolopt[i].optflags
4986 : (pass == 1) ? compopt[i].optflags
4987 : othropt[i].optflags;
4988 if (optflags < startpass || optflags > endpass)
4990 if ((is_wc_option(name) && !wc_supported(name))
4991 || (is_wc2_option(name) && !wc2_supported(name)))
4994 if (strlen(name) > longest_name_len)
4995 longest_name_len = strlen(name);
4997 Sprintf(fmtstr_doset, "%%s%%-%us [%%s]", longest_name_len);
5002 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
5004 "Booleans (selecting will toggle value):", MENU_UNSELECTED);
5006 "
\90^
\8bU
\83I
\83v
\83V
\83\87\83\93 (
\91I
\91ð
\82·
\82é
\82Æ
\92l
\82ª
\90Ø
\82è
\91Ö
\82í
\82è
\82Ü
\82·)
\81F", MENU_UNSELECTED);
5008 /* first list any other non-modifiable booleans, then modifiable ones */
5009 for (pass = 0; pass <= 1; pass++)
5010 for (i = 0; (name = boolopt[i].name) != 0; i++)
5011 if ((bool_p = boolopt[i].addr) != 0
5012 && ((boolopt[i].optflags <= DISP_IN_GAME && pass == 0)
5013 || (boolopt[i].optflags >= SET_IN_GAME && pass == 1))) {
5014 if (bool_p == &flags.female)
5015 continue; /* obsolete */
5016 if (boolopt[i].optflags == SET_IN_WIZGAME && !wizard)
5018 if ((is_wc_option(name) && !wc_supported(name))
5019 || (is_wc2_option(name) && !wc2_supported(name)))
5022 any.a_int = (pass == 0) ? 0 : i + 1;
5023 if (!iflags.menu_tab_sep)
5024 Sprintf(buf, fmtstr_doset, (pass == 0) ? " " : "",
5025 name, *bool_p ? "true" : "false");
5027 Sprintf(buf, fmtstr_doset_tab,
5028 name, *bool_p ? "true" : "false");
5029 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
5034 indexoffset = boolcount;
5036 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED);
5038 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
5039 "Compounds (selecting will prompt for new value):",
5042 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
5043 "
\95¶
\8e\9a\97ñ
\83I
\83v
\83V
\83\87\83\93 (
\91I
\91ð
\82·
\82é
\82Æ
\90V
\82µ
\82¢
\92l
\82Ì
\93ü
\97Í
\82ð
\8b\81\82ß
\82Ü
\82·)
\81F",
5047 /* deliberately put playmode, name, role+race+gender+align first */
5048 doset_add_menu(tmpwin, "playmode", 0);
5049 doset_add_menu(tmpwin, "name", 0);
5050 doset_add_menu(tmpwin, "role", 0);
5051 doset_add_menu(tmpwin, "race", 0);
5052 doset_add_menu(tmpwin, "gender", 0);
5053 doset_add_menu(tmpwin, "align", 0);
5055 for (pass = startpass; pass <= endpass; pass++)
5056 for (i = 0; (name = compopt[i].name) != 0; i++)
5057 if (compopt[i].optflags == pass) {
5058 if (!strcmp(name, "playmode") || !strcmp(name, "name")
5059 || !strcmp(name, "role") || !strcmp(name, "race")
5060 || !strcmp(name, "gender") || !strcmp(name, "align"))
5062 if ((is_wc_option(name) && !wc_supported(name))
5063 || (is_wc2_option(name) && !wc2_supported(name)))
5066 doset_add_menu(tmpwin, name,
5067 (pass == DISP_IN_GAME) ? 0 : indexoffset);
5071 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED);
5072 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
5073 "Other settings:", MENU_UNSELECTED);
5075 for (i = 0; (name = othropt[i].name) != 0; i++) {
5076 if ((is_wc_option(name) && !wc_supported(name))
5077 || (is_wc2_option(name) && !wc2_supported(name)))
5079 opts_add_others(tmpwin, name, othropt[i].code,
5080 (char *) 0, othropt[i].othr_count_func());
5083 #ifdef PREFIXES_IN_USE
5085 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED);
5086 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
5087 "Variable playground locations:", MENU_UNSELECTED);
5088 for (i = 0; i < PREFIX_COUNT; i++)
5089 doset_add_menu(tmpwin, fqn_prefix_names[i], 0);
5092 end_menu(tmpwin, "Set what options?");
5094 end_menu(tmpwin, "
\82Ç
\82Ì
\83I
\83v
\83V
\83\87\83\93\82ð
\90Ý
\92è
\82µ
\82Ü
\82·
\82©
\81H");
5095 need_redraw = FALSE;
5096 if ((pick_cnt = select_menu(tmpwin, PICK_ANY, &pick_list)) > 0) {
5098 * Walk down the selection list and either invert the booleans
5099 * or prompt for new values. In most cases, call parseoptions()
5100 * to take care of options that require special attention, like
5103 for (pick_idx = 0; pick_idx < pick_cnt; ++pick_idx) {
5104 opt_indx = pick_list[pick_idx].item.a_int - 1;
5106 opt_indx++; /* -1 offset for select_menu() */
5107 if (opt_indx == OPT_OTHER_APEXC) {
5108 (void) special_handling("autopickup_exception", setinitial,
5110 #ifdef STATUS_HILITES
5111 } else if (opt_indx == OPT_OTHER_STATHILITE) {
5112 if (!status_hilite_menu()) {
5113 pline("Bad status hilite(s) specified.");
5115 if (wc2_supported("hilite_status"))
5116 preference_update("hilite_status");
5119 } else if (opt_indx == OPT_OTHER_MENUCOLOR) {
5120 (void) special_handling("menu_colors", setinitial,
5122 } else if (opt_indx == OPT_OTHER_MSGTYPE) {
5123 (void) special_handling("msgtype", setinitial, fromfile);
5124 } else if (opt_indx < boolcount) {
5125 /* boolean option */
5126 Sprintf(buf, "%s%s", *boolopt[opt_indx].addr ? "!" : "",
5127 boolopt[opt_indx].name);
5128 (void) parseoptions(buf, setinitial, fromfile);
5129 if (wc_supported(boolopt[opt_indx].name)
5130 || wc2_supported(boolopt[opt_indx].name))
5131 preference_update(boolopt[opt_indx].name);
5133 /* compound option */
5134 opt_indx -= boolcount;
5136 if (!special_handling(compopt[opt_indx].name, setinitial,
5141 Sprintf(buf, "Set %s to what?", compopt[opt_indx].name);
5143 Sprintf(buf, "%s
\82É
\89½
\82ð
\90Ý
\92è
\82·
\82é
\81H", compopt[opt_indx].name);
5146 if (abuf[0] == '\033')
5148 Sprintf(buf, "%s:", compopt[opt_indx].name);
5149 (void) strncat(eos(buf), abuf,
5150 (sizeof buf - 1 - strlen(buf)));
5152 (void) parseoptions(buf, setinitial, fromfile);
5154 if (wc_supported(compopt[opt_indx].name)
5155 || wc2_supported(compopt[opt_indx].name))
5156 preference_update(compopt[opt_indx].name);
5159 free((genericptr_t) pick_list), pick_list = (menu_item *) 0;
5162 destroy_nhwindow(tmpwin);
5164 check_gold_symbol();
5171 /* common to msg-types, menu-colors, autopickup-exceptions */
5173 handle_add_list_remove(optname, numtotal)
5174 const char *optname;
5179 int i, pick_cnt, opt_idx;
5180 menu_item *pick_list = (menu_item *) 0;
5181 static const struct action {
5184 } action_titles[] = {
5186 { 'a', "add new %s" }, /* [0] */
5188 { 'a', "
\90V
\82µ
\82¢%s
\82ð
\92Ç
\89Á" }, /* [0] */
5191 { 'l', "list %s" }, /* [1] */
5193 { 'l', "%s
\82ð
\88ê
\97\97\95\
\8e¦" }, /* [1] */
5196 { 'r', "remove existing %s" }, /* [2] */
5198 { 'r', "
\8aù
\82É
\82 \82é%s
\82ð
\8dí
\8f\9c" }, /* [2] */
5201 { 'x', "exit this menu" }, /* [3] */
5203 { 'x', "
\82±
\82Ì
\83\81\83j
\83\85\81[
\82ð
\95Â
\82¶
\82é" }, /* [3] */
5208 tmpwin = create_nhwindow(NHW_MENU);
5211 for (i = 0; i < SIZE(action_titles); i++) {
5215 /* omit list and remove if there aren't any yet */
5216 if (!numtotal && (i == 1 || i == 2))
5218 Sprintf(tmpbuf, action_titles[i].desc,
5219 (i == 1) ? makeplural(optname) : optname);
5220 add_menu(tmpwin, NO_GLYPH, &any, action_titles[i].letr, 0, ATR_NONE,
5221 tmpbuf, (i == 3) ? MENU_SELECTED : MENU_UNSELECTED);
5224 end_menu(tmpwin, "Do what?");
5226 end_menu(tmpwin, "
\82Ç
\82¤
\82·
\82é
\81H");
5227 if ((pick_cnt = select_menu(tmpwin, PICK_ONE, &pick_list)) > 0) {
5228 opt_idx = pick_list[0].item.a_int - 1;
5229 if (pick_cnt > 1 && opt_idx == 3)
5230 opt_idx = pick_list[1].item.a_int - 1;
5231 free((genericptr_t) pick_list);
5233 opt_idx = 3; /* none selected, exit menu */
5234 destroy_nhwindow(tmpwin);
5238 struct symsetentry *symset_list = 0; /* files.c will populate this with
5239 * list of available sets */
5242 special_handling(optname, setinitial, setfromfile)
5243 const char *optname;
5244 boolean setinitial, setfromfile;
5251 /* Special handling of menustyle, pickup_burden, pickup_types,
5252 * disclose, runmode, msg_window, menu_headings, sortloot,
5253 * and number_pad options.
5254 * Also takes care of interactive autopickup_exception_handling changes.
5256 if (!strcmp("menustyle", optname)) {
5257 const char *style_name;
5258 menu_item *style_pick = (menu_item *) 0;
5260 tmpwin = create_nhwindow(NHW_MENU);
5263 for (i = 0; i < SIZE(menutype); i++) {
5264 style_name = menutype[i];
5265 /* note: separate `style_name' variable used
5266 to avoid an optimizer bug in VAX C V2.3 */
5268 add_menu(tmpwin, NO_GLYPH, &any, *style_name, 0, ATR_NONE,
5269 style_name, MENU_UNSELECTED);
5272 end_menu(tmpwin, "Select menustyle:");
5274 end_menu(tmpwin, "
\83\81\83j
\83\85\81[
\83X
\83^
\83C
\83\8b\82ð
\91I
\91ð
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81F");
5275 if (select_menu(tmpwin, PICK_ONE, &style_pick) > 0) {
5276 flags.menu_style = style_pick->item.a_int - 1;
5277 free((genericptr_t) style_pick);
5279 destroy_nhwindow(tmpwin);
5280 } else if (!strcmp("paranoid_confirmation", optname)) {
5281 menu_item *paranoia_picks = (menu_item *) 0;
5283 tmpwin = create_nhwindow(NHW_MENU);
5286 for (i = 0; paranoia[i].flagmask != 0; ++i) {
5287 if (paranoia[i].flagmask == PARANOID_BONES && !wizard)
5289 any.a_int = paranoia[i].flagmask;
5290 add_menu(tmpwin, NO_GLYPH, &any, *paranoia[i].argname, 0,
5291 ATR_NONE, paranoia[i].explain,
5292 (flags.paranoia_bits & paranoia[i].flagmask)
5296 end_menu(tmpwin, "Actions requiring extra confirmation:");
5297 i = select_menu(tmpwin, PICK_ANY, ¶noia_picks);
5299 /* player didn't cancel; we reset all the paranoia options
5300 here even if there were no items picked, since user
5301 could have toggled off preselected ones to end up with 0 */
5302 flags.paranoia_bits = 0;
5304 /* at least 1 item set, either preselected or newly picked */
5306 flags.paranoia_bits |= paranoia_picks[i].item.a_int;
5307 free((genericptr_t) paranoia_picks);
5310 destroy_nhwindow(tmpwin);
5311 } else if (!strcmp("pickup_burden", optname)) {
5312 const char *burden_name, *burden_letters = "ubsntl";
5313 menu_item *burden_pick = (menu_item *) 0;
5315 tmpwin = create_nhwindow(NHW_MENU);
5318 for (i = 0; i < SIZE(burdentype); i++) {
5319 burden_name = burdentype[i];
5321 add_menu(tmpwin, NO_GLYPH, &any, burden_letters[i], 0, ATR_NONE,
5322 burden_name, MENU_UNSELECTED);
5325 end_menu(tmpwin, "Select encumbrance level:");
5327 end_menu(tmpwin, "
\8cx
\8d\90\82ð
\8fo
\82·
\89×
\8fd
\83\8c\83x
\83\8b\82ð
\91I
\91ð
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81F");
5328 if (select_menu(tmpwin, PICK_ONE, &burden_pick) > 0) {
5329 flags.pickup_burden = burden_pick->item.a_int - 1;
5330 free((genericptr_t) burden_pick);
5332 destroy_nhwindow(tmpwin);
5333 } else if (!strcmp("pickup_types", optname)) {
5334 /* parseoptions will prompt for the list of types */
5335 (void) parseoptions(strcpy(buf, "pickup_types"),
5336 setinitial, setfromfile);
5337 } else if (!strcmp("disclose", optname)) {
5338 /* order of disclose_names[] must correspond to
5339 disclosure_options in decl.c */
5340 static const char *disclosure_names[] = {
5341 "inventory", "attributes", "vanquished",
5342 "genocides", "conduct", "overview",
5344 int disc_cat[NUM_DISCLOSURE_OPTIONS];
5345 int pick_cnt, pick_idx, opt_idx;
5347 menu_item *disclosure_pick = (menu_item *) 0;
5349 tmpwin = create_nhwindow(NHW_MENU);
5352 for (i = 0; i < NUM_DISCLOSURE_OPTIONS; i++) {
5353 Sprintf(buf, "%-12s[%c%c]", disclosure_names[i],
5354 flags.end_disclose[i], disclosure_options[i]);
5356 add_menu(tmpwin, NO_GLYPH, &any, disclosure_options[i], 0,
5357 ATR_NONE, buf, MENU_UNSELECTED);
5361 end_menu(tmpwin, "Change which disclosure options categories:");
5363 end_menu(tmpwin, "
\82Ç
\82Ì
\83J
\83e
\83S
\83\8a\82Ì
\95\
\8e¦
\8fî
\95ñ
\83I
\83v
\83V
\83\87\83\93\82ð
\95Ï
\8dX
\82µ
\82Ü
\82·
\82©
\81F");
5364 pick_cnt = select_menu(tmpwin, PICK_ANY, &disclosure_pick);
5366 for (pick_idx = 0; pick_idx < pick_cnt; ++pick_idx) {
5367 opt_idx = disclosure_pick[pick_idx].item.a_int - 1;
5368 disc_cat[opt_idx] = 1;
5370 free((genericptr_t) disclosure_pick);
5371 disclosure_pick = (menu_item *) 0;
5373 destroy_nhwindow(tmpwin);
5375 for (i = 0; i < NUM_DISCLOSURE_OPTIONS; i++) {
5377 c = flags.end_disclose[i];
5379 Sprintf(buf, "Disclosure options for %s:",
5381 Sprintf(buf, "%s
\82Ì
\8fo
\97Í
\8c`
\8e®
\81F",
5382 disclosure_names[i]);
5383 tmpwin = create_nhwindow(NHW_MENU);
5386 /* 'y','n',and '+' work as alternate selectors; '-' doesn't */
5387 any.a_char = DISCLOSE_NO_WITHOUT_PROMPT;
5388 add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE,
5390 "Never disclose, without prompting",
5392 "
\8am
\94F
\82¹
\82¸
\82É
\8fo
\97Í
\82à
\82µ
\82È
\82¢",
5393 (c == any.a_char) ? MENU_SELECTED : MENU_UNSELECTED);
5394 any.a_char = DISCLOSE_YES_WITHOUT_PROMPT;
5395 add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE,
5397 "Always disclose, without prompting",
5399 "
\8am
\94F
\82¹
\82¸
\82É
\8fo
\97Í
\82·
\82é",
5400 (c == any.a_char) ? MENU_SELECTED : MENU_UNSELECTED);
5401 if (*disclosure_names[i] == 'v') {
5402 any.a_char = DISCLOSE_SPECIAL_WITHOUT_PROMPT; /* '#' */
5403 add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE,
5404 "Always disclose, pick sort order from menu",
5405 (c == any.a_char) ? MENU_SELECTED
5408 any.a_char = DISCLOSE_PROMPT_DEFAULT_NO;
5409 add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE,
5411 "Prompt, with default answer of \"No\"",
5413 "
\8am
\94F
\82·
\82é
\81C
\83f
\83t
\83H
\83\8b\83g
\82Í
\81u
\8fo
\97Í
\82µ
\82È
\82¢
\81v",
5414 (c == any.a_char) ? MENU_SELECTED : MENU_UNSELECTED);
5415 any.a_char = DISCLOSE_PROMPT_DEFAULT_YES;
5416 add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE,
5418 "Prompt, with default answer of \"Yes\"",
5420 "
\8am
\94F
\82·
\82é
\81C
\83f
\83t
\83H
\83\8b\83g
\82Í
\81u
\8fo
\97Í
\82·
\82é
\81v",
5421 (c == any.a_char) ? MENU_SELECTED : MENU_UNSELECTED);
5422 if (*disclosure_names[i] == 'v') {
5423 any.a_char = DISCLOSE_PROMPT_DEFAULT_SPECIAL; /* '?' */
5424 add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE,
5425 "Prompt, with default answer of \"Ask\" to request sort menu",
5426 (c == any.a_char) ? MENU_SELECTED
5429 end_menu(tmpwin, buf);
5430 n = select_menu(tmpwin, PICK_ONE, &disclosure_pick);
5432 flags.end_disclose[i] = disclosure_pick[0].item.a_char;
5433 if (n > 1 && flags.end_disclose[i] == c)
5434 flags.end_disclose[i] = disclosure_pick[1].item.a_char;
5435 free((genericptr_t) disclosure_pick);
5437 destroy_nhwindow(tmpwin);
5440 } else if (!strcmp("runmode", optname)) {
5441 const char *mode_name;
5442 menu_item *mode_pick = (menu_item *) 0;
5444 tmpwin = create_nhwindow(NHW_MENU);
5447 for (i = 0; i < SIZE(runmodes); i++) {
5448 mode_name = runmodes[i];
5450 add_menu(tmpwin, NO_GLYPH, &any, *mode_name, 0, ATR_NONE,
5451 mode_name, MENU_UNSELECTED);
5454 end_menu(tmpwin, "Select run/travel display mode:");
5456 end_menu(tmpwin, "
\91\96\8ds/
\83g
\83\89\83x
\83\8b\82Ì
\95\
\8e¦
\83\82\81[
\83h
\82ð
\91I
\91ð
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81F");
5457 if (select_menu(tmpwin, PICK_ONE, &mode_pick) > 0) {
5458 flags.runmode = mode_pick->item.a_int - 1;
5459 free((genericptr_t) mode_pick);
5461 destroy_nhwindow(tmpwin);
5462 } else if (!strcmp("whatis_coord", optname)) {
5463 menu_item *window_pick = (menu_item *) 0;
5465 char gp = iflags.getpos_coords;
5467 tmpwin = create_nhwindow(NHW_MENU);
5470 any.a_char = GPCOORDS_COMPASS;
5471 add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_COMPASS, 0, ATR_NONE,
5472 "compass ('east' or '3s' or '2n,4w')",
5473 (gp == GPCOORDS_COMPASS) ? MENU_SELECTED : MENU_UNSELECTED);
5474 any.a_char = GPCOORDS_COMFULL;
5475 add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_COMFULL, 0, ATR_NONE,
5476 "full compass ('east' or '3south' or '2north,4west')",
5477 (gp == GPCOORDS_COMFULL) ? MENU_SELECTED : MENU_UNSELECTED);
5478 any.a_char = GPCOORDS_MAP;
5479 add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_MAP, 0, ATR_NONE,
5481 (gp == GPCOORDS_MAP) ? MENU_SELECTED : MENU_UNSELECTED);
5482 any.a_char = GPCOORDS_SCREEN;
5483 add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_SCREEN, 0, ATR_NONE,
5484 "screen [row,column]",
5485 (gp == GPCOORDS_SCREEN) ? MENU_SELECTED : MENU_UNSELECTED);
5486 any.a_char = GPCOORDS_NONE;
5487 add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_NONE, 0, ATR_NONE,
5488 "none (no coordinates displayed)",
5489 (gp == GPCOORDS_NONE) ? MENU_SELECTED : MENU_UNSELECTED);
5491 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED);
5492 Sprintf(buf, "map: upper-left: <%d,%d>, lower-right: <%d,%d>%s",
5493 1, 0, COLNO - 1, ROWNO - 1,
5494 flags.verbose ? "; column 0 unused, off left edge" : "");
5495 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED);
5496 if (strcmp(windowprocs.name, "tty")) /* only show for non-tty */
5497 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
5498 "screen: row is offset to accommodate tty interface's use of top line",
5501 #define COL80ARG flags.verbose ? "; column 80 is not used" : ""
5505 Sprintf(buf, "screen: upper-left: [%02d,%02d], lower-right: [%d,%d]%s",
5506 0 + 2, 1, ROWNO - 1 + 2, COLNO - 1, COL80ARG);
5508 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED);
5509 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED);
5511 "Select coordinate display when auto-describing a map position:");
5512 if ((pick_cnt = select_menu(tmpwin, PICK_ONE, &window_pick)) > 0) {
5513 iflags.getpos_coords = window_pick[0].item.a_char;
5514 /* PICK_ONE doesn't unselect preselected entry when
5515 selecting another one */
5516 if (pick_cnt > 1 && iflags.getpos_coords == gp)
5517 iflags.getpos_coords = window_pick[1].item.a_char;
5518 free((genericptr_t) window_pick);
5520 destroy_nhwindow(tmpwin);
5521 } else if (!strcmp("whatis_filter", optname)) {
5522 menu_item *window_pick = (menu_item *) 0;
5524 char gf = iflags.getloc_filter;
5526 tmpwin = create_nhwindow(NHW_MENU);
5529 any.a_char = (GFILTER_NONE + 1);
5530 add_menu(tmpwin, NO_GLYPH, &any, 'n',
5531 0, ATR_NONE, "no filtering",
5532 (gf == GFILTER_NONE) ? MENU_SELECTED : MENU_UNSELECTED);
5533 any.a_char = (GFILTER_VIEW + 1);
5534 add_menu(tmpwin, NO_GLYPH, &any, 'v',
5535 0, ATR_NONE, "in view only",
5536 (gf == GFILTER_VIEW) ? MENU_SELECTED : MENU_UNSELECTED);
5537 any.a_char = (GFILTER_AREA + 1);
5538 add_menu(tmpwin, NO_GLYPH, &any, 'a',
5539 0, ATR_NONE, "in same area",
5540 (gf == GFILTER_AREA) ? MENU_SELECTED : MENU_UNSELECTED);
5542 "Select location filtering when going for next/previous map position:");
5543 if ((pick_cnt = select_menu(tmpwin, PICK_ONE, &window_pick)) > 0) {
5544 iflags.getloc_filter = (window_pick[0].item.a_char - 1);
5545 /* PICK_ONE doesn't unselect preselected entry when
5546 selecting another one */
5547 if (pick_cnt > 1 && iflags.getloc_filter == gf)
5548 iflags.getloc_filter = (window_pick[1].item.a_char - 1);
5549 free((genericptr_t) window_pick);
5551 destroy_nhwindow(tmpwin);
5552 } else if (!strcmp("msg_window", optname)) {
5553 #if defined(TTY_GRAPHICS) || defined(CURSES_GRAPHICS)
5554 if (WINDOWPORT("tty") || WINDOWPORT("curses")) {
5555 /* by Christian W. Cooper */
5556 menu_item *window_pick = (menu_item *) 0;
5558 tmpwin = create_nhwindow(NHW_MENU);
5561 if (!WINDOWPORT("curses")) {
5563 add_menu(tmpwin, NO_GLYPH, &any, 's', 0, ATR_NONE,
5564 "single", MENU_UNSELECTED);
5566 add_menu(tmpwin, NO_GLYPH, &any, 'c', 0, ATR_NONE,
5567 "combination", MENU_UNSELECTED);
5570 add_menu(tmpwin, NO_GLYPH, &any, 'f', 0, ATR_NONE, "full",
5573 add_menu(tmpwin, NO_GLYPH, &any, 'r', 0, ATR_NONE, "reversed",
5576 end_menu(tmpwin, "Select message history display type:");
5578 end_menu(tmpwin, "
\83\81\83b
\83Z
\81[
\83W
\97\9a\97ð
\82Ì
\95\
\8e¦
\95û
\96@
\82ð
\91I
\91ð
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81F");
5579 if (select_menu(tmpwin, PICK_ONE, &window_pick) > 0) {
5580 iflags.prevmsg_window = window_pick->item.a_char;
5581 free((genericptr_t) window_pick);
5583 destroy_nhwindow(tmpwin);
5585 #endif /* msg_window for tty or curses */
5586 pline("'%s' option is not supported for '%s'.",
5587 optname, windowprocs.name);
5588 } else if (!strcmp("sortloot", optname)) {
5589 const char *sortl_name;
5590 menu_item *sortl_pick = (menu_item *) 0;
5592 tmpwin = create_nhwindow(NHW_MENU);
5595 for (i = 0; i < SIZE(sortltype); i++) {
5596 sortl_name = sortltype[i];
5597 any.a_char = *sortl_name;
5598 add_menu(tmpwin, NO_GLYPH, &any, *sortl_name, 0, ATR_NONE,
5599 sortl_name, (flags.sortloot == *sortl_name)
5600 ? MENU_SELECTED : MENU_UNSELECTED);
5602 end_menu(tmpwin, "Select loot sorting type:");
5603 n = select_menu(tmpwin, PICK_ONE, &sortl_pick);
5605 char c = sortl_pick[0].item.a_char;
5607 if (n > 1 && c == flags.sortloot)
5608 c = sortl_pick[1].item.a_char;
5610 free((genericptr_t) sortl_pick);
5612 destroy_nhwindow(tmpwin);
5613 } else if (!strcmp("align_message", optname)
5614 || !strcmp("align_status", optname)) {
5615 menu_item *window_pick = (menu_item *) 0;
5617 boolean msg = (*(optname + 6) == 'm');
5619 tmpwin = create_nhwindow(NHW_MENU);
5622 any.a_int = ALIGN_TOP;
5623 add_menu(tmpwin, NO_GLYPH, &any, 't', 0, ATR_NONE, "top",
5625 any.a_int = ALIGN_BOTTOM;
5626 add_menu(tmpwin, NO_GLYPH, &any, 'b', 0, ATR_NONE, "bottom",
5628 any.a_int = ALIGN_LEFT;
5629 add_menu(tmpwin, NO_GLYPH, &any, 'l', 0, ATR_NONE, "left",
5631 any.a_int = ALIGN_RIGHT;
5632 add_menu(tmpwin, NO_GLYPH, &any, 'r', 0, ATR_NONE, "right",
5635 Sprintf(abuf, "Select %s window placement relative to the map:",
5636 msg ? "message" : "status");
5638 Sprintf(abuf, "%s
\83E
\83B
\83\93\83h
\83E
\82Ì
\83}
\83b
\83v
\82É
\91Î
\82·
\82é
\95\
\8e¦
\88Ê
\92u
\82ð
\91I
\91ð
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81F",
5639 msg ? "
\83\81\83b
\83Z
\81[
\83W" : "
\8fó
\91Ô");
5641 end_menu(tmpwin, abuf);
5642 if (select_menu(tmpwin, PICK_ONE, &window_pick) > 0) {
5644 iflags.wc_align_message = window_pick->item.a_int;
5646 iflags.wc_align_status = window_pick->item.a_int;
5647 free((genericptr_t) window_pick);
5649 destroy_nhwindow(tmpwin);
5650 } else if (!strcmp("number_pad", optname)) {
5651 static const char *npchoices[] = {
5653 " 0 (off)", " 1 (on)", " 2 (on, MSDOS compatible)",
5655 "0 (
\96³
\8cø)", "1 (
\97L
\8cø)", "2 (
\97L
\8cø
\81CMSDOS
\8cÝ
\8a·)",
5657 " 3 (on, phone-style digit layout)",
5659 " 3 (
\97L
\8cø
\81C
\93d
\98b
\8e®
\82Ì
\90\94\8e\9a\94z
\92u)",
5661 " 4 (on, phone-style layout, MSDOS compatible)",
5663 " 4 (
\97L
\8cø
\81C
\93d
\98b
\8e®
\82Ì
\94z
\92u
\81CMSDOS
\8cÝ
\8a·)",
5665 "-1 (off, 'z' to move upper-left, 'y' to zap wands)"
5667 "-1 (
\96³
\8cø
\81C'z'
\82Å
\8d¶
\8fã
\82É
\88Ú
\93®
\81C'y'
\82Å
\8fñ
\82ð
\90U
\82é)"
5669 menu_item *mode_pick = (menu_item *) 0;
5671 tmpwin = create_nhwindow(NHW_MENU);
5674 for (i = 0; i < SIZE(npchoices); i++) {
5676 add_menu(tmpwin, NO_GLYPH, &any, 'a' + i, 0, ATR_NONE,
5677 npchoices[i], MENU_UNSELECTED);
5680 end_menu(tmpwin, "Select number_pad mode:");
5682 end_menu(tmpwin, "number_pad
\83\82\81[
\83h
\82ð
\91I
\91ð
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81F");
5683 if (select_menu(tmpwin, PICK_ONE, &mode_pick) > 0) {
5684 switch (mode_pick->item.a_int - 1) {
5686 iflags.num_pad = FALSE;
5687 iflags.num_pad_mode = 0;
5690 iflags.num_pad = TRUE;
5691 iflags.num_pad_mode = 0;
5694 iflags.num_pad = TRUE;
5695 iflags.num_pad_mode = 1;
5698 iflags.num_pad = TRUE;
5699 iflags.num_pad_mode = 2;
5702 iflags.num_pad = TRUE;
5703 iflags.num_pad_mode = 3;
5705 /* last menu choice: number_pad == -1 */
5707 iflags.num_pad = FALSE;
5708 iflags.num_pad_mode = 1;
5711 reset_commands(FALSE);
5712 number_pad(iflags.num_pad ? 1 : 0);
5713 free((genericptr_t) mode_pick);
5715 destroy_nhwindow(tmpwin);
5716 } else if (!strcmp("menu_headings", optname)) {
5718 int mhattr = query_attr("How to highlight menu headings:");
5720 int mhattr = query_attr("
\83\81\83j
\83\85\81[
\83w
\83b
\83_
\82Ì
\8b
\92²
\95û
\96@
\82ð
\91I
\91ð
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81F");
5723 iflags.menu_headings = mhattr;
5724 } else if (!strcmp("msgtype", optname)) {
5725 int opt_idx, nmt, mttyp;
5729 nmt = msgtype_count();
5731 opt_idx = handle_add_list_remove("message type", nmt);
5733 opt_idx = handle_add_list_remove("
\83\81\83b
\83Z
\81[
\83W
\8c^", nmt);
5734 if (opt_idx == 3) { /* done */
5736 } else if (opt_idx == 0) { /* add new */
5739 getlin("What new message pattern?", mtbuf);
5741 getlin("
\90V
\82µ
\82¢
\83\81\83b
\83Z
\81[
\83W
\83p
\83^
\81[
\83\93\81F", mtbuf);
5742 if (*mtbuf == '\033')
5745 && test_regex_pattern(mtbuf, (const char *)0)
5746 && (mttyp = query_msgtype()) != -1
5747 && !msgtype_add(mttyp, mtbuf)) {
5749 pline("Error adding the message type.");
5751 pline("
\83\81\83b
\83Z
\81[
\83W
\8c^
\92Ç
\89Á
\83G
\83\89\81[
\81D");
5754 goto msgtypes_again;
5755 } else { /* list (1) or remove (2) */
5756 int pick_idx, pick_cnt;
5760 menu_item *pick_list = (menu_item *) 0;
5761 struct plinemsg_type *tmp = plinemsg_types;
5763 tmpwin = create_nhwindow(NHW_MENU);
5768 mtype = msgtype2name(tmp->msgtype);
5769 any.a_int = ++mt_idx;
5770 Sprintf(mtbuf, "%-5s \"", mtype);
5771 ln = sizeof mtbuf - strlen(mtbuf) - sizeof "\"";
5772 if (strlen(tmp->pattern) > ln)
5773 Strcat(strncat(mtbuf, tmp->pattern, ln - 3), "...\"");
5775 Strcat(strcat(mtbuf, tmp->pattern), "\"");
5776 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, mtbuf,
5781 Sprintf(mtbuf, "%s message types",
5782 (opt_idx == 1) ? "List of" : "Remove which");
5784 Strcpy(mtbuf, (opt_idx == 1) ?
5785 "
\83\81\83b
\83Z
\81[
\83W
\8c^
\88ê
\97\97" : "
\8dí
\8f\9c\82·
\82é
\83\81\83b
\83Z
\81[
\83W
\8c^");
5787 end_menu(tmpwin, mtbuf);
5788 pick_cnt = select_menu(tmpwin,
5789 (opt_idx == 1) ? PICK_NONE : PICK_ANY,
5792 for (pick_idx = 0; pick_idx < pick_cnt; ++pick_idx)
5793 free_one_msgtype(pick_list[pick_idx].item.a_int - 1
5795 free((genericptr_t) pick_list), pick_list = (menu_item *) 0;
5797 destroy_nhwindow(tmpwin);
5799 goto msgtypes_again;
5801 } else if (!strcmp("menu_colors", optname)) {
5802 int opt_idx, nmc, mcclr, mcattr;
5806 nmc = count_menucolors();
5808 opt_idx = handle_add_list_remove("menucolor", nmc);
5810 opt_idx = handle_add_list_remove("
\83\81\83j
\83\85\81[
\90F", nmc);
5811 if (opt_idx == 3) { /* done */
5813 /* in case we've made a change which impacts current persistent
5814 inventory window; we don't track whether an actual changed
5815 occurred, so just assume there was one and that it matters;
5816 if we're wrong, a redundant update is cheap... */
5817 if (iflags.use_menu_color)
5820 /* menu colors aren't being used; if any are defined, remind
5821 player how to use them */
5824 "To have menu colors become active, toggle 'menucolors' option to True.");
5827 } else if (opt_idx == 0) { /* add new */
5830 getlin("What new menucolor pattern?", mcbuf);
5832 getlin("
\90V
\82µ
\82¢
\83\81\83j
\83\85\81[
\90F
\83p
\83^
\81[
\83\93\81F", mcbuf);
5833 if (*mcbuf == '\033')
5834 goto menucolors_done;
5836 && test_regex_pattern(mcbuf, (const char *)0)
5837 && (mcclr = query_color((char *) 0)) != -1
5838 && (mcattr = query_attr((char *) 0)) != -1
5839 && !add_menu_coloring_parsed(mcbuf, mcclr, mcattr)) {
5841 pline("Error adding the menu color.");
5843 pline("
\83\81\83j
\83\85\81[
\90F
\92Ç
\89Á
\83G
\83\89\81[
\81D");
5846 goto menucolors_again;
5848 } else { /* list (1) or remove (2) */
5849 int pick_idx, pick_cnt;
5852 const char *sattr, *sclr;
5853 menu_item *pick_list = (menu_item *) 0;
5854 struct menucoloring *tmp = menu_colorings;
5855 char clrbuf[QBUFSZ];
5857 tmpwin = create_nhwindow(NHW_MENU);
5862 sattr = attr2attrname(tmp->attr);
5863 sclr = strcpy(clrbuf, clr2colorname(tmp->color));
5864 (void) strNsubst(clrbuf, " ", "-", 0);
5865 any.a_int = ++mc_idx;
5866 /* construct suffix */
5867 Sprintf(buf, "\"\"=%s%s%s", sclr,
5868 (tmp->attr != ATR_NONE) ? "&" : "",
5869 (tmp->attr != ATR_NONE) ? sattr : "");
5870 /* now main string */
5871 ln = sizeof buf - strlen(buf) - 1; /* length available */
5872 Strcpy(mcbuf, "\"");
5873 if (strlen(tmp->origstr) > ln)
5874 Strcat(strncat(mcbuf, tmp->origstr, ln - 3), "...");
5876 Strcat(mcbuf, tmp->origstr);
5877 /* combine main string and suffix */
5878 Strcat(mcbuf, &buf[1]); /* skip buf[]'s initial quote */
5879 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, mcbuf,
5884 Sprintf(mcbuf, "%s menu colors",
5885 (opt_idx == 1) ? "List of" : "Remove which");
5887 Strcpy(mcbuf, (opt_idx == 1) ?
5888 "
\83\81\83j
\83\85\81[
\90F
\88ê
\97\97" : "
\8dí
\8f\9c\82·
\82é
\83\81\83j
\83\85\81[
\90F");
5890 end_menu(tmpwin, mcbuf);
5891 pick_cnt = select_menu(tmpwin,
5892 (opt_idx == 1) ? PICK_NONE : PICK_ANY,
5895 for (pick_idx = 0; pick_idx < pick_cnt; ++pick_idx)
5896 free_one_menu_coloring(pick_list[pick_idx].item.a_int - 1
5898 free((genericptr_t) pick_list), pick_list = (menu_item *) 0;
5900 destroy_nhwindow(tmpwin);
5902 goto menucolors_again;
5904 } else if (!strcmp("autopickup_exception", optname)) {
5905 int opt_idx, numapes = 0;
5906 char apebuf[2 + BUFSZ]; /* so &apebuf[1] is BUFSZ long for getlin() */
5907 struct autopickup_exception *ape;
5910 numapes = count_apes();
5912 opt_idx = handle_add_list_remove("autopickup exception", numapes);
5914 opt_idx = handle_add_list_remove("
\8e©
\93®
\8fE
\82¢
\97á
\8aO", numapes);
5915 if (opt_idx == 3) { /* done */
5917 } else if (opt_idx == 0) { /* add new */
5918 /* EDIT_GETLIN: assume user doesn't user want previous
5919 exception used as default input string for this one... */
5920 apebuf[0] = apebuf[1] = '\0';
5922 getlin("What new autopickup exception pattern?", &apebuf[1]);
5924 getlin("
\90V
\82µ
\82¢
\8e©
\93®
\8fE
\82¢
\97á
\8aO
\82Ì
\83p
\83^
\81[
\83\93\82ð
\93ü
\97Í
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81F", &apebuf[1]);
5925 mungspaces(&apebuf[1]); /* regularize whitespace */
5926 if (apebuf[1] == '\033')
5930 /* guarantee room for \" prefix and \"\0 suffix;
5931 -2 is good enough for apebuf[] but -3 makes
5932 sure the whole thing fits within normal BUFSZ */
5933 apebuf[sizeof apebuf - 2] = '\0';
5934 Strcat(apebuf, "\"");
5935 add_autopickup_exception(apebuf);
5938 } else { /* list (1) or remove (2) */
5939 int pick_idx, pick_cnt;
5940 menu_item *pick_list = (menu_item *) 0;
5942 tmpwin = create_nhwindow(NHW_MENU);
5948 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
5949 "Always pickup '<'; never pickup '>'",
5952 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
5953 "
\8fí
\82É
\8fE
\82¤ '<';
\8fí
\82É
\8fE
\82í
\82È
\82¢ '>'",
5956 for (i = 0; i < numapes && ape; i++) {
5957 any.a_void = (opt_idx == 1) ? 0 : ape;
5958 /* length of pattern plus quotes (plus '<'/'>') is
5960 Sprintf(apebuf, "\"%c%s\"", ape->grab ? '<' : '>',
5962 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, apebuf,
5968 Sprintf(apebuf, "%s autopickup exceptions",
5969 (opt_idx == 1) ? "List of" : "Remove which");
5971 Sprintf(apebuf, "%s
\8e©
\93®
\8fE
\82¢
\97á
\8aO%s",
5972 (opt_idx == 1) ? "" : "
\82Ç
\82Ì",
5973 (opt_idx == 1) ? "
\82Ì
\88ê
\97\97" : "
\82ð
\8dí
\8f\9c\82µ
\82Ü
\82·
\82©
\81H");
5975 end_menu(tmpwin, apebuf);
5976 pick_cnt = select_menu(tmpwin,
5977 (opt_idx == 1) ? PICK_NONE : PICK_ANY,
5980 for (pick_idx = 0; pick_idx < pick_cnt; ++pick_idx)
5981 remove_autopickup_exception(
5982 (struct autopickup_exception *)
5983 pick_list[pick_idx].item.a_void);
5984 free((genericptr_t) pick_list), pick_list = (menu_item *) 0;
5986 destroy_nhwindow(tmpwin);
5990 } else if (!strcmp("symset", optname)
5991 || !strcmp("roguesymset", optname)) {
5992 menu_item *symset_pick = (menu_item *) 0;
5993 boolean rogueflag = (*optname == 'r'),
5994 ready_to_switch = FALSE,
5995 nothing_to_do = FALSE;
5996 char *symset_name, fmtstr[20];
5997 struct symsetentry *sl;
5998 int res, which_set, setcount = 0, chosen = -2, defindx = 0;
6000 which_set = rogueflag ? ROGUESET : PRIMARY;
6001 symset_list = (struct symsetentry *) 0;
6002 /* clear symset[].name as a flag to read_sym_file() to build list */
6003 symset_name = symset[which_set].name;
6004 symset[which_set].name = (char *) 0;
6006 res = read_sym_file(which_set);
6007 /* put symset name back */
6008 symset[which_set].name = symset_name;
6010 if (res && symset_list) {
6012 biggest = (int) (sizeof "Default Symbols" - sizeof ""),
6015 for (sl = symset_list; sl; sl = sl->next) {
6016 /* check restrictions */
6017 if (rogueflag ? sl->primary : sl->rogue)
6019 #ifndef MAC_GRAPHICS_ENV
6020 if (sl->handling == H_MAC)
6025 /* find biggest name */
6026 thissize = sl->name ? (int) strlen(sl->name) : 0;
6027 if (thissize > biggest)
6029 thissize = sl->desc ? (int) strlen(sl->desc) : 0;
6030 if (thissize > big_desc)
6031 big_desc = thissize;
6035 pline("There are no appropriate %s symbol sets available.",
6036 rogueflag ? "rogue level" : "primary");
6038 pline("
\93K
\90Ø
\82È%s
\83V
\83\93\83{
\83\8b\90Ý
\92è
\82ª
\82 \82è
\82Ü
\82¹
\82ñ
\81D",
6039 rogueflag ? "rogue
\83\8c\83x
\83\8b" : "
\97D
\90æ");
6044 Sprintf(fmtstr, "%%-%ds %%s", biggest + 2);
6045 tmpwin = create_nhwindow(NHW_MENU);
6048 any.a_int = 1; /* -1 + 2 [see 'if (sl->name) {' below]*/
6050 defindx = any.a_int;
6051 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
6053 (any.a_int == defindx) ? MENU_SELECTED
6056 for (sl = symset_list; sl; sl = sl->next) {
6057 /* check restrictions */
6058 if (rogueflag ? sl->primary : sl->rogue)
6060 #ifndef MAC_GRAPHICS_ENV
6061 if (sl->handling == H_MAC)
6065 /* +2: sl->idx runs from 0 to N-1 for N symsets;
6066 +1 because Defaults are implicitly in slot [0];
6067 +1 again so that valid data is never 0 */
6068 any.a_int = sl->idx + 2;
6069 if (symset_name && !strcmpi(sl->name, symset_name))
6070 defindx = any.a_int;
6071 Sprintf(buf, fmtstr, sl->name, sl->desc ? sl->desc : "");
6072 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
6073 (any.a_int == defindx) ? MENU_SELECTED
6078 Sprintf(buf, "Select %ssymbol set:",
6079 rogueflag ? "rogue level " : "");
6081 Sprintf(buf, "%s
\83V
\83\93\83{
\83\8b\90Ý
\92è
\82ð
\91I
\91ð
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81F",
6082 rogueflag ? "rogue
\83\8c\83x
\83\8b" : "");
6084 end_menu(tmpwin, buf);
6085 n = select_menu(tmpwin, PICK_ONE, &symset_pick);
6087 chosen = symset_pick[0].item.a_int;
6088 /* if picking non-preselected entry yields 2, make sure
6089 that we're going with the non-preselected one */
6090 if (n == 2 && chosen == defindx)
6091 chosen = symset_pick[1].item.a_int;
6092 chosen -= 2; /* convert menu index to symset index;
6093 * "Default symbols" have index -1 */
6094 free((genericptr_t) symset_pick);
6095 } else if (n == 0 && defindx > 0) {
6096 chosen = defindx - 2;
6098 destroy_nhwindow(tmpwin);
6101 /* chose an actual symset name from file */
6102 for (sl = symset_list; sl; sl = sl->next)
6103 if (sl->idx == chosen)
6106 /* free the now stale attributes */
6107 clear_symsetentry(which_set, TRUE);
6109 /* transfer only the name of the symbol set */
6110 symset[which_set].name = dupstr(sl->name);
6111 ready_to_switch = TRUE;
6113 } else if (chosen == -1) {
6114 /* explicit selection of defaults */
6115 /* free the now stale symset attributes */
6116 clear_symsetentry(which_set, TRUE);
6118 nothing_to_do = TRUE;
6120 /* The symbols file could not be accessed */
6122 pline("Unable to access \"%s\" file.", SYMBOLS);
6124 pline("\"%s\"
\83t
\83@
\83C
\83\8b\82É
\83A
\83N
\83Z
\83X
\82Å
\82«
\82Ü
\82¹
\82ñ
\81D", SYMBOLS);
6126 } else if (!symset_list) {
6127 /* The symbols file was empty */
6129 pline("There were no symbol sets found in \"%s\".", SYMBOLS);
6131 pline("\"%s\"
\82É
\83V
\83\93\83{
\83\8b\90Ý
\92è
\82ª
\82 \82è
\82Ü
\82¹
\82ñ
\81D", SYMBOLS);
6136 while ((sl = symset_list) != 0) {
6137 symset_list = sl->next;
6139 free((genericptr_t) sl->name), sl->name = (char *) 0;
6141 free((genericptr_t) sl->desc), sl->desc = (char *) 0;
6142 free((genericptr_t) sl);
6148 /* Set default symbols and clear the handling value */
6150 init_rogue_symbols();
6152 init_primary_symbols();
6154 if (symset[which_set].name) {
6155 /* non-default symbols */
6156 if (read_sym_file(which_set)) {
6157 ready_to_switch = TRUE;
6159 clear_symsetentry(which_set, TRUE);
6164 if (ready_to_switch)
6165 switch_symbols(TRUE);
6167 if (Is_rogue_level(&u.uz)) {
6169 assign_graphics(ROGUESET);
6170 } else if (!rogueflag)
6171 assign_graphics(PRIMARY);
6172 preference_update("symset");
6176 /* didn't match any of the special options */
6182 #define rolestring(val, array, field) \
6183 ((val >= 0) ? array[val].field : (val == ROLE_RANDOM) ? randomrole : none)
6185 /* This is ugly. We have all the option names in the compopt[] array,
6186 but we need to look at each option individually to get the value. */
6187 STATIC_OVL const char *
6188 get_compopt_value(optname, buf)
6189 const char *optname;
6193 static const char none[] = "(none)", randomrole[] = "random",
6194 to_be_done[] = "(to be done)",
6195 defopt[] = "default", defbrief[] = "def";
6197 static const char none[] = "(
\82È
\82µ)", randomrole[] = "
\83\89\83\93\83_
\83\80",
6198 to_be_done[] = "(
\96¢
\90Ý
\92è)",
6199 defopt[] = "
\83f
\83t
\83H
\83\8b\83g", defbrief[] = "def";
6201 char ocl[MAXOCLASSES + 1];
6205 if (!strcmp(optname, "align_message")
6206 || !strcmp(optname, "align_status")) {
6207 int which = !strcmp(optname, "align_status") ? iflags.wc_align_status
6208 : iflags.wc_align_message;
6211 (which == ALIGN_TOP) ? "top"
6212 : (which == ALIGN_LEFT) ? "left"
6213 : (which == ALIGN_BOTTOM) ? "bottom"
6214 : (which == ALIGN_RIGHT) ? "right"
6218 (which == ALIGN_TOP) ? "
\8fã
\91¤"
6219 : (which == ALIGN_LEFT) ? "
\8d¶
\91¤"
6220 : (which == ALIGN_BOTTOM) ? "
\89º
\91¤"
6221 : (which == ALIGN_RIGHT) ? "
\89E
\91¤"
6224 } else if (!strcmp(optname, "align"))
6226 Sprintf(buf, "%s", rolestring(flags.initalign, aligns, adj));
6228 Sprintf(buf, "%s", rolestring(flags.initalign, aligns, noun));
6231 else if (!strcmp(optname, "altkeyhandler"))
6234 iflags.altkeyhandler[0] ? iflags.altkeyhandler : "default");
6236 iflags.altkeyhandler[0] ? iflags.altkeyhandler : defopt);
6238 #ifdef BACKWARD_COMPAT
6239 else if (!strcmp(optname, "boulder"))
6241 ov_primary_syms[SYM_BOULDER + SYM_OFF_X]
6242 ? ov_primary_syms[SYM_BOULDER + SYM_OFF_X]
6243 : showsyms[(int) objects[BOULDER].oc_class + SYM_OFF_O]);
6245 else if (!strcmp(optname, "catname"))
6246 Sprintf(buf, "%s", catname[0] ? catname : none);
6247 else if (!strcmp(optname, "disclose"))
6248 for (i = 0; i < NUM_DISCLOSURE_OPTIONS; i++) {
6250 (void) strkitten(buf, ' ');
6251 (void) strkitten(buf, flags.end_disclose[i]);
6252 (void) strkitten(buf, disclosure_options[i]);
6254 else if (!strcmp(optname, "dogname"))
6255 Sprintf(buf, "%s", dogname[0] ? dogname : none);
6256 else if (!strcmp(optname, "dungeon"))
6257 Sprintf(buf, "%s", to_be_done);
6258 else if (!strcmp(optname, "effects"))
6259 Sprintf(buf, "%s", to_be_done);
6260 else if (!strcmp(optname, "font_map"))
6261 Sprintf(buf, "%s", iflags.wc_font_map ? iflags.wc_font_map : defopt);
6262 else if (!strcmp(optname, "font_message"))
6264 iflags.wc_font_message ? iflags.wc_font_message : defopt);
6265 else if (!strcmp(optname, "font_status"))
6267 iflags.wc_font_status ? iflags.wc_font_status : defopt);
6268 else if (!strcmp(optname, "font_menu"))
6270 iflags.wc_font_menu ? iflags.wc_font_menu : defopt);
6271 else if (!strcmp(optname, "font_text"))
6273 iflags.wc_font_text ? iflags.wc_font_text : defopt);
6274 else if (!strcmp(optname, "font_size_map")) {
6275 if (iflags.wc_fontsiz_map)
6276 Sprintf(buf, "%d", iflags.wc_fontsiz_map);
6278 Strcpy(buf, defopt);
6279 } else if (!strcmp(optname, "font_size_message")) {
6280 if (iflags.wc_fontsiz_message)
6281 Sprintf(buf, "%d", iflags.wc_fontsiz_message);
6283 Strcpy(buf, defopt);
6284 } else if (!strcmp(optname, "font_size_status")) {
6285 if (iflags.wc_fontsiz_status)
6286 Sprintf(buf, "%d", iflags.wc_fontsiz_status);
6288 Strcpy(buf, defopt);
6289 } else if (!strcmp(optname, "font_size_menu")) {
6290 if (iflags.wc_fontsiz_menu)
6291 Sprintf(buf, "%d", iflags.wc_fontsiz_menu);
6293 Strcpy(buf, defopt);
6294 } else if (!strcmp(optname, "font_size_text")) {
6295 if (iflags.wc_fontsiz_text)
6296 Sprintf(buf, "%d", iflags.wc_fontsiz_text);
6298 Strcpy(buf, defopt);
6299 } else if (!strcmp(optname, "fruit"))
6300 Sprintf(buf, "%s", pl_fruit);
6301 else if (!strcmp(optname, "gender"))
6302 Sprintf(buf, "%s", rolestring(flags.initgend, genders, adj));
6303 else if (!strcmp(optname, "horsename"))
6304 Sprintf(buf, "%s", horsename[0] ? horsename : none);
6305 else if (!strcmp(optname, "map_mode")) {
6306 i = iflags.wc_map_mode;
6308 (i == MAP_MODE_TILES) ? "tiles"
6309 : (i == MAP_MODE_ASCII4x6) ? "ascii4x6"
6310 : (i == MAP_MODE_ASCII6x8) ? "ascii6x8"
6311 : (i == MAP_MODE_ASCII8x8) ? "ascii8x8"
6312 : (i == MAP_MODE_ASCII16x8) ? "ascii16x8"
6313 : (i == MAP_MODE_ASCII7x12) ? "ascii7x12"
6314 : (i == MAP_MODE_ASCII8x12) ? "ascii8x12"
6315 : (i == MAP_MODE_ASCII16x12) ? "ascii16x12"
6316 : (i == MAP_MODE_ASCII12x16) ? "ascii12x16"
6317 : (i == MAP_MODE_ASCII10x18) ? "ascii10x18"
6318 : (i == MAP_MODE_ASCII_FIT_TO_SCREEN)
6321 } else if (!strcmp(optname, "menustyle"))
6322 Sprintf(buf, "%s", menutype[(int) flags.menu_style]);
6323 else if (!strcmp(optname, "menu_deselect_all"))
6324 Sprintf(buf, "%s", to_be_done);
6325 else if (!strcmp(optname, "menu_deselect_page"))
6326 Sprintf(buf, "%s", to_be_done);
6327 else if (!strcmp(optname, "menu_first_page"))
6328 Sprintf(buf, "%s", to_be_done);
6329 else if (!strcmp(optname, "menu_invert_all"))
6330 Sprintf(buf, "%s", to_be_done);
6331 else if (!strcmp(optname, "menu_headings"))
6332 Sprintf(buf, "%s", attr2attrname(iflags.menu_headings));
6333 else if (!strcmp(optname, "menu_invert_page"))
6334 Sprintf(buf, "%s", to_be_done);
6335 else if (!strcmp(optname, "menu_last_page"))
6336 Sprintf(buf, "%s", to_be_done);
6337 else if (!strcmp(optname, "menu_next_page"))
6338 Sprintf(buf, "%s", to_be_done);
6339 else if (!strcmp(optname, "menu_previous_page"))
6340 Sprintf(buf, "%s", to_be_done);
6341 else if (!strcmp(optname, "menu_search"))
6342 Sprintf(buf, "%s", to_be_done);
6343 else if (!strcmp(optname, "menu_select_all"))
6344 Sprintf(buf, "%s", to_be_done);
6345 else if (!strcmp(optname, "menu_select_page"))
6346 Sprintf(buf, "%s", to_be_done);
6347 else if (!strcmp(optname, "monsters")) {
6348 Sprintf(buf, "%s", to_be_done);
6349 } else if (!strcmp(optname, "msghistory")) {
6350 Sprintf(buf, "%u", iflags.msg_history);
6352 } else if (!strcmp(optname, "msg_window")) {
6353 Sprintf(buf, "%s", (iflags.prevmsg_window == 's') ? "single"
6354 : (iflags.prevmsg_window == 'c') ? "combination"
6355 : (iflags.prevmsg_window == 'f') ? "full"
6358 } else if (!strcmp(optname, "name")) {
6359 Sprintf(buf, "%s", plname);
6360 } else if (!strcmp(optname, "mouse_support")) {
6362 #define MOUSEFIX1 ", QuickEdit off"
6363 #define MOUSEFIX2 ", QuickEdit unchanged"
6365 #define MOUSEFIX1 ", O/S adjusted"
6366 #define MOUSEFIX2 ", O/S unchanged"
6368 static const char *mousemodes[][2] = {
6370 { "1=on", MOUSEFIX1 },
6371 { "2=on", MOUSEFIX2 },
6375 int ms = iflags.wc_mouse_support;
6377 if (ms >= 0 && ms <= 2)
6378 Sprintf(buf, "%s%s", mousemodes[ms][0], mousemodes[ms][1]);
6379 } else if (!strcmp(optname, "number_pad")) {
6380 static const char *numpadmodes[] = {
6382 "0=off", "1=on", "2=on, MSDOS compatible",
6384 "0=
\96³
\8cø", "1=
\97L
\8cø", "2=
\97L
\8cø
\81CDOS
\8cÝ
\8a·",
6386 "3=on, phone-style layout",
6388 "3=
\97L
\8cø
\81C
\93d
\98b
\8e®
\82Ì
\90\94\8e\9a\94z
\92u",
6390 "4=on, phone layout, MSDOS compatible",
6392 "4=
\97L
\8cø
\81C
\93d
\98b
\8e®
\82Ì
\94z
\92u
\81CMSDOS
\8cÝ
\8a·",
6394 "-1=off, y & z swapped", /*[5]*/
6396 "-1=
\96³
\8cø
\81Cy
\82Æz
\82ð
\93ü
\82ê
\91Ö
\82¦", /*[5]*/
6399 int indx = Cmd.num_pad
6400 ? (Cmd.phone_layout ? (Cmd.pcHack_compat ? 4 : 3)
6401 : (Cmd.pcHack_compat ? 2 : 1))
6402 : Cmd.swap_yz ? 5 : 0;
6404 Strcpy(buf, numpadmodes[indx]);
6405 } else if (!strcmp(optname, "objects")) {
6406 Sprintf(buf, "%s", to_be_done);
6407 } else if (!strcmp(optname, "packorder")) {
6408 oc_to_str(flags.inv_order, ocl);
6409 Sprintf(buf, "%s", ocl);
6411 } else if (!strcmp(optname, "palette")) {
6412 Sprintf(buf, "%s", get_color_string());
6414 } else if (!strcmp(optname, "paranoid_confirmation")) {
6415 char tmpbuf[QBUFSZ];
6418 for (i = 0; paranoia[i].flagmask != 0; ++i)
6419 if (flags.paranoia_bits & paranoia[i].flagmask)
6420 Sprintf(eos(tmpbuf), " %s", paranoia[i].argname);
6421 Strcpy(buf, tmpbuf[0] ? &tmpbuf[1] : "none");
6422 } else if (!strcmp(optname, "petattr")) {
6423 #ifdef CURSES_GRAPHICS
6424 if (WINDOWPORT("curses")) {
6425 char tmpbuf[QBUFSZ];
6427 Strcpy(buf, curses_fmt_attrs(tmpbuf));
6430 if (iflags.wc2_petattr != 0)
6431 Sprintf(buf, "0x%08x", iflags.wc2_petattr);
6433 Strcpy(buf, defopt);
6434 } else if (!strcmp(optname, "pettype")) {
6436 Sprintf(buf, "%s", (preferred_pet == 'c') ? "cat"
6437 : (preferred_pet == 'd') ? "dog"
6438 : (preferred_pet == 'h') ? "horse"
6439 : (preferred_pet == 'n') ? "none"
6442 Sprintf(buf, "%s", (preferred_pet == 'c') ? "
\94L"
6443 : (preferred_pet == 'd') ? "
\8c¢"
6444 : (preferred_pet == 'h') ? "
\94n"
6445 : (preferred_pet == 'n') ? "
\82È
\82µ"
6446 : "
\83\89\83\93\83_
\83\80");
6448 } else if (!strcmp(optname, "pickup_burden")) {
6449 Sprintf(buf, "%s", burdentype[flags.pickup_burden]);
6450 } else if (!strcmp(optname, "pickup_types")) {
6451 oc_to_str(flags.pickup_types, ocl);
6452 Sprintf(buf, "%s", ocl[0] ? ocl : "all");
6453 } else if (!strcmp(optname, "pile_limit")) {
6454 Sprintf(buf, "%d", flags.pile_limit);
6455 } else if (!strcmp(optname, "playmode")) {
6456 Strcpy(buf, wizard ? "debug" : discover ? "explore" : "normal");
6457 } else if (!strcmp(optname, "race")) {
6458 Sprintf(buf, "%s", rolestring(flags.initrace, races, noun));
6459 } else if (!strcmp(optname, "roguesymset")) {
6461 symset[ROGUESET].name ? symset[ROGUESET].name : "default");
6462 if (currentgraphics == ROGUESET && symset[ROGUESET].name)
6463 Strcat(buf, ", active");
6464 } else if (!strcmp(optname, "role")) {
6465 Sprintf(buf, "%s", rolestring(flags.initrole, roles, name.m));
6466 } else if (!strcmp(optname, "runmode")) {
6467 Sprintf(buf, "%s", runmodes[flags.runmode]);
6468 } else if (!strcmp(optname, "whatis_coord")) {
6470 (iflags.getpos_coords == GPCOORDS_MAP) ? "map"
6471 : (iflags.getpos_coords == GPCOORDS_COMPASS) ? "compass"
6472 : (iflags.getpos_coords == GPCOORDS_COMFULL) ? "full compass"
6473 : (iflags.getpos_coords == GPCOORDS_SCREEN) ? "screen"
6475 } else if (!strcmp(optname, "whatis_filter")) {
6477 (iflags.getloc_filter == GFILTER_VIEW) ? "view"
6478 : (iflags.getloc_filter == GFILTER_AREA) ? "area"
6480 } else if (!strcmp(optname, "scores")) {
6481 Sprintf(buf, "%d top/%d around%s", flags.end_top, flags.end_around,
6482 flags.end_own ? "/own" : "");
6483 } else if (!strcmp(optname, "scroll_amount")) {
6484 if (iflags.wc_scroll_amount)
6485 Sprintf(buf, "%d", iflags.wc_scroll_amount);
6487 Strcpy(buf, defopt);
6488 } else if (!strcmp(optname, "scroll_margin")) {
6489 if (iflags.wc_scroll_margin)
6490 Sprintf(buf, "%d", iflags.wc_scroll_margin);
6492 Strcpy(buf, defopt);
6493 } else if (!strcmp(optname, "sortloot")) {
6494 for (i = 0; i < SIZE(sortltype); i++)
6495 if (flags.sortloot == sortltype[i][0]) {
6496 Strcpy(buf, sortltype[i]);
6499 } else if (!strcmp(optname, "player_selection")) {
6501 Sprintf(buf, "%s", iflags.wc_player_selection ? "prompts" : "dialog");
6503 Sprintf(buf, "%s
\93ü
\97Í", iflags.wc_player_selection ? "
\83v
\83\8d\83\93\83v
\83g" : "
\83_
\83C
\83A
\83\8d\83O");
6506 } else if (!strcmp(optname, "soundcard")) {
6507 Sprintf(buf, "%s", to_be_done);
6509 #ifdef STATUS_HILITES
6510 } else if (!strcmp("statushilites", optname)) {
6511 if (!iflags.hilite_delta)
6512 Strcpy(buf, "0 (off: don't highlight status fields)");
6514 Sprintf(buf, "%ld (on: highlight status for %ld turns)",
6515 iflags.hilite_delta, iflags.hilite_delta);
6517 } else if (!strcmp(optname,"statuslines")) {
6518 if (wc2_supported(optname))
6519 Strcpy(buf, (iflags.wc2_statuslines < 3) ? "2" : "3");
6520 /* else default to "unknown" */
6521 } else if (!strcmp(optname, "suppress_alert")) {
6522 if (flags.suppress_alert == 0L)
6525 Sprintf(buf, "%lu.%lu.%lu", FEATURE_NOTICE_VER_MAJ,
6526 FEATURE_NOTICE_VER_MIN, FEATURE_NOTICE_VER_PATCH);
6527 } else if (!strcmp(optname, "symset")) {
6529 symset[PRIMARY].name ? symset[PRIMARY].name : "default");
6530 if (currentgraphics == PRIMARY && symset[PRIMARY].name)
6531 Strcat(buf, ", active");
6532 } else if (!strcmp(optname, "term_cols")) {
6533 if (iflags.wc2_term_cols)
6534 Sprintf(buf, "%d", iflags.wc2_term_cols);
6536 Strcpy(buf, defopt);
6537 } else if (!strcmp(optname, "term_rows")) {
6538 if (iflags.wc2_term_rows)
6539 Sprintf(buf, "%d", iflags.wc2_term_rows);
6541 Strcpy(buf, defopt);
6542 } else if (!strcmp(optname, "tile_file")) {
6544 iflags.wc_tile_file ? iflags.wc_tile_file : defopt);
6545 } else if (!strcmp(optname, "tile_height")) {
6546 if (iflags.wc_tile_height)
6547 Sprintf(buf, "%d", iflags.wc_tile_height);
6549 Strcpy(buf, defopt);
6550 } else if (!strcmp(optname, "tile_width")) {
6551 if (iflags.wc_tile_width)
6552 Sprintf(buf, "%d", iflags.wc_tile_width);
6554 Strcpy(buf, defopt);
6555 } else if (!strcmp(optname, "traps")) {
6556 Sprintf(buf, "%s", to_be_done);
6557 } else if (!strcmp(optname, "vary_msgcount")) {
6558 if (iflags.wc_vary_msgcount)
6559 Sprintf(buf, "%d", iflags.wc_vary_msgcount);
6561 Strcpy(buf, defopt);
6563 } else if (!strcmp(optname, "video")) {
6564 Sprintf(buf, "%s", to_be_done);
6567 } else if (!strcmp(optname, "videoshades")) {
6568 Sprintf(buf, "%s-%s-%s", shade[0], shade[1], shade[2]);
6569 } else if (!strcmp(optname, "videocolors")) {
6570 Sprintf(buf, "%d-%d-%d-%d-%d-%d-%d-%d-%d-%d-%d-%d",
6571 ttycolors[CLR_RED], ttycolors[CLR_GREEN],
6572 ttycolors[CLR_BROWN], ttycolors[CLR_BLUE],
6573 ttycolors[CLR_MAGENTA], ttycolors[CLR_CYAN],
6574 ttycolors[CLR_ORANGE], ttycolors[CLR_BRIGHT_GREEN],
6575 ttycolors[CLR_YELLOW], ttycolors[CLR_BRIGHT_BLUE],
6576 ttycolors[CLR_BRIGHT_MAGENTA], ttycolors[CLR_BRIGHT_CYAN]);
6577 #endif /* VIDEOSHADES */
6578 } else if (!strcmp(optname,"windowborders")) {
6580 (iflags.wc2_windowborders == 0) ? "0=off"
6581 : (iflags.wc2_windowborders == 1) ? "1=on"
6582 : (iflags.wc2_windowborders == 2) ? "2=auto"
6584 } else if (!strcmp(optname, "windowtype")) {
6585 Sprintf(buf, "%s", windowprocs.name);
6586 } else if (!strcmp(optname, "windowcolors")) {
6588 buf, "%s/%s %s/%s %s/%s %s/%s",
6589 iflags.wc_foregrnd_menu ? iflags.wc_foregrnd_menu : defbrief,
6590 iflags.wc_backgrnd_menu ? iflags.wc_backgrnd_menu : defbrief,
6591 iflags.wc_foregrnd_message ? iflags.wc_foregrnd_message
6593 iflags.wc_backgrnd_message ? iflags.wc_backgrnd_message
6595 iflags.wc_foregrnd_status ? iflags.wc_foregrnd_status : defbrief,
6596 iflags.wc_backgrnd_status ? iflags.wc_backgrnd_status : defbrief,
6597 iflags.wc_foregrnd_text ? iflags.wc_foregrnd_text : defbrief,
6598 iflags.wc_backgrnd_text ? iflags.wc_backgrnd_text : defbrief);
6599 #ifdef PREFIXES_IN_USE
6601 for (i = 0; i < PREFIX_COUNT; ++i)
6602 if (!strcmp(optname, fqn_prefix_names[i]) && fqn_prefix[i])
6603 Sprintf(buf, "%s", fqn_prefix[i]);
6609 Strcpy(buf, "unknown");
6611 Strcpy(buf, "
\95s
\96¾");
6618 char buf[BUFSZ], ocl[MAXOCLASSES + 1];
6620 flags.pickup = !flags.pickup;
6622 oc_to_str(flags.pickup_types, ocl);
6624 Sprintf(buf, "ON, for %s objects%s", ocl[0] ? ocl : "all",
6626 ? ((count_apes() == 1)
6627 ? ", with one exception"
6628 : ", with some exceptions")
6631 Sprintf(buf, "%s
\83A
\83C
\83e
\83\80\82É
\82Â
\82¢
\82Ä
\83I
\83\93%s", ocl[0] ? ocl : "
\91S
\82Ä
\82Ì",
6633 ? "
\81C
\97á
\8aO
\82 \82è"
6640 Strcpy(buf, "
\83I
\83t");
6643 pline("Autopickup: %s.", buf);
6645 pline("
\8e©
\93®
\8fE
\82¢
\81F%s
\81D", buf);
6650 add_autopickup_exception(mapping)
6651 const char *mapping;
6654 APE_regex_error[] = "regex error in AUTOPICKUP_EXCEPTION",
6655 APE_syntax_error[] = "syntax error in AUTOPICKUP_EXCEPTION";
6657 struct autopickup_exception *ape;
6658 char text[256], end;
6660 boolean grab = FALSE;
6662 /* scan length limit used to be 255, but smaller size allows the
6663 quoted value to fit within BUFSZ, simplifying formatting elsewhere;
6664 this used to ignore the possibility of trailing junk but now checks
6665 for it, accepting whitespace but rejecting anything else unless it
6666 starts with '#" for a comment */
6668 if ((n = sscanf(mapping, "\"<%253[^\"]\" %c", text, &end)) == 1
6669 || (n == 2 && end == '#')) {
6671 } else if ((n = sscanf(mapping, "\">%253[^\"]\" %c", text, &end)) == 1
6672 || (n = sscanf(mapping, "\"%253[^\"]\" %c", text, &end)) == 1
6673 || (n == 2 && end == '#')) {
6676 config_error_add("%s", APE_syntax_error);
6680 ape = (struct autopickup_exception *) alloc(sizeof *ape);
6681 ape->regex = regex_init();
6682 if (!regex_compile(text, ape->regex)) {
6683 config_error_add("%s: %s", APE_regex_error,
6684 regex_error_desc(ape->regex));
6685 regex_free(ape->regex);
6686 free((genericptr_t) ape);
6690 ape->pattern = dupstr(text);
6692 ape->next = apelist;
6698 remove_autopickup_exception(whichape)
6699 struct autopickup_exception *whichape;
6701 struct autopickup_exception *ape, *freeape, *prev = 0;
6703 for (ape = apelist; ape;) {
6704 if (ape == whichape) {
6711 regex_free(freeape->regex);
6712 free((genericptr_t) freeape->pattern);
6713 free((genericptr_t) freeape);
6722 free_autopickup_exceptions()
6724 struct autopickup_exception *ape = apelist;
6726 while ((ape = apelist) != 0) {
6727 regex_free(ape->regex);
6728 free((genericptr_t) ape->pattern);
6729 apelist = ape->next;
6730 free((genericptr_t) ape);
6734 /* bundle some common usage into one easy-to-use routine */
6736 load_symset(s, which_set)
6740 clear_symsetentry(which_set, TRUE);
6742 if (symset[which_set].name)
6743 free((genericptr_t) symset[which_set].name);
6744 symset[which_set].name = dupstr(s);
6746 if (read_sym_file(which_set)) {
6747 switch_symbols(TRUE);
6749 clear_symsetentry(which_set, TRUE);
6758 clear_symsetentry(PRIMARY, TRUE);
6759 clear_symsetentry(ROGUESET, TRUE);
6761 /* symset_list is cleaned up as soon as it's used, so we shouldn't
6762 have to anything about it here */
6763 /* assert( symset_list == NULL ); */
6766 /* Parse the value of a SYMBOLS line from a config file */
6768 parsesymbols(opts, which_set)
6769 register char *opts;
6773 char *op, *symname, *strval;
6774 struct symparse *symp;
6776 if ((op = index(opts, ',')) != 0) {
6778 if (!parsesymbols(op, which_set))
6782 /* S_sample:string */
6784 strval = index(opts, ':');
6786 strval = index(opts, '=');
6791 /* strip leading and trailing white space from symname and strval */
6792 mungspaces(symname);
6795 symp = match_sym(symname);
6799 if (symp->range && symp->range != SYM_CONTROL) {
6800 val = sym_val(strval);
6801 if (which_set == ROGUESET)
6802 update_ov_rogue_symset(symp, val);
6804 update_ov_primary_symset(symp, val);
6813 size_t len = strlen(buf);
6814 const char *p = index(buf, ':'), *q = index(buf, '=');
6815 struct symparse *sp = loadsyms;
6817 if (!p || (q && q < p))
6820 /* note: there will be at most one space before the '='
6821 because caller has condensed buf[] with mungspaces() */
6822 if (p > buf && p[-1] == ' ')
6824 len = (int) (p - buf);
6827 if ((len >= strlen(sp->name)) && !strncmpi(buf, sp->name, len))
6831 return (struct symparse *) 0;
6836 const char *strval; /* up to 4*BUFSZ-1 long; only first few chars matter */
6838 char buf[QBUFSZ], tmp[QBUFSZ]; /* to hold trucated copy of 'strval' */
6841 if (!strval[0] || !strval[1]) { /* empty, or single character */
6842 /* if single char is space or tab, leave buf[0]=='\0' */
6843 if (!isspace((uchar) strval[0]))
6845 } else if (strval[0] == '\'') { /* single quote */
6846 /* simple matching single quote; we know strval[1] isn't '\0' */
6847 if (strval[2] == '\'' && !strval[3]) {
6848 /* accepts '\' as backslash and ''' as single quote */
6851 /* if backslash, handle single or double quote or second backslash */
6852 } else if (strval[1] == '\\' && strval[2] && strval[3] == '\''
6853 && index("'\"\\", strval[2]) && !strval[4]) {
6856 /* not simple quote or basic backslash;
6857 strip closing quote and let escapes() deal with it */
6861 /* +1: skip opening single quote */
6862 (void) strncpy(tmp, strval + 1, sizeof tmp - 1);
6863 tmp[sizeof tmp - 1] = '\0';
6864 if ((p = rindex(tmp, '\'')) != 0) {
6867 } /* else buf[0] stays '\0' */
6869 } else { /* not lone char nor single quote */
6870 (void) strncpy(tmp, strval, sizeof tmp - 1);
6871 tmp[sizeof tmp - 1] = '\0';
6878 /* data for option_help() */
6879 static const char *opt_intro[] = {
6882 " NetHack Options Help:", "",
6884 " NetHack
\83I
\83v
\83V
\83\87\83\93\83w
\83\8b\83v
\81F", "",
6885 #define CONFIG_SLOT 3 /* fill in next value at run-time */
6887 #if !defined(MICRO) && !defined(MAC)
6889 "or use `NETHACKOPTIONS=\"<options>\"' in your environment",
6891 "
\82Ü
\82½
\82Í
\8aÂ
\8b«
\95Ï
\90\94\82É`NETHACKOPTIONS=\"<options>\"'
\82Æ
\92è
\8b`
\82Å
\82«
\82Ü
\82·",
6894 "(<options> is a list of options separated by commas)",
6896 "(<options>
\82Í
\83J
\83\93\83}
\82Å
\8bæ
\90Ø
\82Á
\82½
\83I
\83v
\83V
\83\87\83\93\82Å
\82·)",
6899 "-- for example, $ DEFINE NETHACKOPTIONS \"noautopickup,fruit:kumquat\"",
6901 "--
\97á
\82¦
\82Î
\8e\9f\82Ì
\82æ
\82¤
\82É
\82µ
\82Ü
\82·
\81F$ DEFINE NETHACKOPTIONS \"noautopickup,fruit:kumquat\"",
6904 "or press \"O\" while playing and use the menu.",
6906 "
\82à
\82µ
\82
\82Í
\83Q
\81[
\83\80\83v
\83\8c\83C
\92\86\82É\"O\"
\83{
\83^
\83\93\82ð
\89\9f\82·
\82±
\82Æ
\82Å
\90Ý
\92è
\89Â
\94\
\82Å
\82·
\81D",
6909 "Boolean options (which can be negated by prefixing them with '!' or \"no\"):",
6911 "
\90^
\8bU
\92l
\83I
\83v
\83V
\83\87\83\93 (
\94Û
\92è
\82Ì
\92l
\82ð
\8ew
\92è
\82·
\82é
\8fê
\8d\87\81C'!'
\82à
\82µ
\82
\82Í\"no\"
\82ð
\90æ
\93ª
\82É
\95t
\89Á
\82µ
\82Ü
\82·):",
6915 static const char *opt_epilog[] = {
6918 "Some of the options can be set only before the game is started; those",
6920 "
\83I
\83v
\83V
\83\87\83\93\82É
\82Í
\83Q
\81[
\83\80\8aJ
\8en
\91O
\82Ì
\82Ý
\82É
\82µ
\82©
\90Ý
\92è
\82Å
\82«
\82È
\82¢
\82à
\82Ì
\82ª
\82 \82è
\82Ü
\82·
\81D",
6922 "items will not be selectable in the 'O' command's menu.",
6924 "
\82»
\82ê
\82ç
\82Í'O'
\83R
\83}
\83\93\83h
\82Ì
\83\81\83j
\83\85\81[
\82Å
\82Í
\91I
\91ð
\82·
\82é
\82±
\82Æ
\82ª
\82Å
\82«
\82Ü
\82¹
\82ñ
\81D",
6931 char buf[BUFSZ], buf2[BUFSZ];
6935 datawin = create_nhwindow(NHW_TEXT);
6937 Sprintf(buf, "Set options as OPTIONS=<options> in %s", configfile);
6939 Sprintf(buf, "
\83I
\83v
\83V
\83\87\83\93\82Í%s
\82Ì
\92\86\82ÅOPTIONS=<options>
\82Æ
\90Ý
\92è
\82µ
\82Ü
\82·", configfile);
6940 opt_intro[CONFIG_SLOT] = (const char *) buf;
6941 for (i = 0; opt_intro[i]; i++)
6942 putstr(datawin, 0, opt_intro[i]);
6944 /* Boolean options */
6945 for (i = 0; boolopt[i].name; i++) {
6946 if (boolopt[i].addr) {
6947 if (boolopt[i].addr == &iflags.sanity_check && !wizard)
6949 if (boolopt[i].addr == &iflags.menu_tab_sep && !wizard)
6951 next_opt(datawin, boolopt[i].name);
6954 next_opt(datawin, "");
6956 /* Compound options */
6958 putstr(datawin, 0, "Compound options:");
6960 putstr(datawin, 0, "
\95¶
\8e\9a\97ñ
\83I
\83v
\83V
\83\87\83\93:");
6961 for (i = 0; compopt[i].name; i++) {
6962 Sprintf(buf2, "`%s'", compopt[i].name);
6963 Sprintf(buf, "%-20s - %s%c", buf2, compopt[i].descr,
6964 compopt[i + 1].name ? ',' : '.');
6965 putstr(datawin, 0, buf);
6968 for (i = 0; opt_epilog[i]; i++)
6969 putstr(datawin, 0, opt_epilog[i]);
6971 display_nhwindow(datawin, FALSE);
6972 destroy_nhwindow(datawin);
6977 * prints the next boolean option, on the same line if possible, on a new
6978 * line if not. End with next_opt("").
6981 next_opt(datawin, str)
6985 static char *buf = 0;
6990 *(buf = (char *) alloc(BUFSZ)) = '\0';
6994 if (s > &buf[1] && s[-2] == ',')
6995 Strcpy(s - 2, "."); /* replace last ", " */
6996 i = COLNO; /* (greater than COLNO - 2) */
6998 i = strlen(buf) + strlen(str) + 2;
7001 if (i > COLNO - 2) { /* rule of thumb */
7002 putstr(datawin, 0, buf);
7009 putstr(datawin, 0, str);
7010 free((genericptr_t) buf), buf = 0;
7015 /* Returns the fid of the fruit type; if that type already exists, it
7016 * returns the fid of that one; if it does not exist, it adds a new fruit
7017 * type to the chain and returns the new one.
7018 * If replace_fruit is sent in, replace the fruit in the chain rather than
7019 * adding a new entry--for user specified fruits only.
7022 fruitadd(str, replace_fruit)
7024 struct fruit *replace_fruit;
7027 register struct fruit *f;
7028 int highest_fruit_id = 0, globpfx;
7029 char buf[PL_FSIZ], altname[PL_FSIZ];
7030 boolean user_specified = (str == pl_fruit);
7031 /* if not user-specified, then it's a fruit name for a fruit on
7032 * a bones level or from orctown raider's loot...
7035 /* Note: every fruit has an id (kept in obj->spe) of at least 1;
7038 if (user_specified) {
7039 boolean found = FALSE, numeric = FALSE;
7041 /* force fruit to be singular; this handling is not
7042 needed--or wanted--for fruits from bones because
7043 they already received it in their original game;
7044 str==pl_fruit but makesingular() creates a copy
7045 so we need to copy that back into pl_fruit */
7046 nmcpy(pl_fruit, makesingular(str), PL_FSIZ);
7047 /* (assertion doesn't matter; we use 'pl_fruit' from here on out) */
7048 /* assert( str == pl_fruit ); */
7050 /* disallow naming after other foods (since it'd be impossible
7051 * to tell the difference); globs might have a size prefix which
7052 * needs to be skipped in order to match the object type name
7054 globpfx = (!strncmp(pl_fruit, "small ", 6)
7055 || !strncmp(pl_fruit, "large ", 6)) ? 6
7056 : (!strncmp(pl_fruit, "very large ", 11)) ? 11
7058 for (i = bases[FOOD_CLASS]; objects[i].oc_class == FOOD_CLASS; i++) {
7059 if (!strcmp(OBJ_NAME(objects[i]), pl_fruit)
7061 && !strcmp(OBJ_NAME(objects[i]), &pl_fruit[globpfx]))) {
7069 for (c = pl_fruit; *c >= '0' && *c <= '9'; c++)
7071 if (!*c || isspace((uchar) *c))
7074 if (found || numeric
7075 /* these checks for applying food attributes to actual items
7076 are case sensitive; "glob of foo" is caught by 'found'
7077 if 'foo' is a valid glob; when not valid, allow it as-is */
7078 || !strncmp(pl_fruit, "cursed ", 7)
7079 || !strncmp(pl_fruit, "uncursed ", 9)
7080 || !strncmp(pl_fruit, "blessed ", 8)
7081 || !strncmp(pl_fruit, "partly eaten ", 13)
7082 || (!strncmp(pl_fruit, "tin of ", 7)
7083 && (!strcmp(pl_fruit + 7, "spinach")
7084 || name_to_mon(pl_fruit + 7) >= LOW_PM))
7085 || !strcmp(pl_fruit, "empty tin")
7086 || (!strcmp(pl_fruit, "glob")
7087 || (globpfx > 0 && !strcmp("glob", &pl_fruit[globpfx])))
7088 || ((str_end_is(pl_fruit, " corpse")
7089 || str_end_is(pl_fruit, " egg"))
7090 && name_to_mon(pl_fruit) >= LOW_PM)) {
7091 Strcpy(buf, pl_fruit);
7092 Strcpy(pl_fruit, "candied ");
7093 nmcpy(pl_fruit + 8, buf, PL_FSIZ - 8);
7096 /* This flag indicates that a fruit has been made since the
7097 * last time the user set the fruit. If it hasn't, we can
7098 * safely overwrite the current fruit, preventing the user from
7099 * setting many fruits in a row and overflowing.
7100 * Possible expansion: check for specific fruit IDs, not for
7103 flags.made_fruit = FALSE;
7104 if (replace_fruit) {
7105 /* replace_fruit is already part of the fruit chain;
7106 update it in place rather than looking it up again */
7108 copynchars(f->fname, pl_fruit, PL_FSIZ - 1);
7112 /* not user_supplied, so assumed to be from bones (or orc gang) */
7113 copynchars(altname, str, PL_FSIZ - 1);
7114 sanitize_name(altname);
7115 flags.made_fruit = TRUE; /* for safety. Any fruit name added from a
7116 * bones level should exist anyway. */
7118 f = fruit_from_name(*altname ? altname : str, FALSE, &highest_fruit_id);
7122 /* Maximum number of named fruits is 127, even if obj->spe can
7123 handle bigger values. If adding another fruit would overflow,
7124 use a random fruit instead... we've got a lot to choose from.
7125 current_fruit remains as is. */
7126 if (highest_fruit_id >= 127)
7130 (void) memset((genericptr_t) f, 0, sizeof (struct fruit));
7131 copynchars(f->fname, *altname ? altname : str, PL_FSIZ - 1);
7132 f->fid = ++highest_fruit_id;
7133 /* we used to go out of our way to add it at the end of the list,
7134 but the order is arbitrary so use simpler insertion at start */
7139 context.current_fruit = f->fid;
7144 * This is a somewhat generic menu for taking a list of NetHack style
7145 * class choices and presenting them via a description
7146 * rather than the traditional NetHack characters.
7147 * (Benefits users whose first exposure to NetHack is via tiles).
7150 * The title at the top of the menu.
7152 * category: 0 = monster class
7156 * FALSE = PICK_ONE, TRUE = PICK_ANY
7159 * a null terminated string containing the list of choices.
7162 * a null terminated string containing the selected characters.
7164 * Returns number selected.
7167 choose_classes_menu(prompt, category, way, class_list, class_select)
7174 menu_item *pick_list = (menu_item *) 0;
7180 int next_accelerator, accelerator;
7182 if (class_list == (char *) 0 || class_select == (char *) 0)
7185 next_accelerator = 'a';
7187 win = create_nhwindow(NHW_MENU);
7189 while (*class_list) {
7197 text = def_monsyms[def_char_to_monclass(*class_list)].explain;
7198 accelerator = *class_list;
7199 Sprintf(buf, "%s", text);
7202 text = def_oc_syms[def_char_to_objclass(*class_list)].explain;
7203 accelerator = next_accelerator;
7204 Sprintf(buf, "%c %s", *class_list, text);
7207 impossible("choose_classes_menu: invalid category %d", category);
7209 if (way && *class_select) { /* Selections there already */
7210 if (index(class_select, *class_list)) {
7214 any.a_int = *class_list;
7215 add_menu(win, NO_GLYPH, &any, accelerator, category ? *class_list : 0,
7216 ATR_NONE, buf, selected);
7220 if (next_accelerator == ('z' + 1))
7221 next_accelerator = 'A';
7222 if (next_accelerator == ('Z' + 1))
7226 if (category == 1 && next_accelerator <= 'z') {
7227 /* for objects, add "A - ' ' all classes", after a separator */
7229 add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED);
7230 any.a_int = (int) ' ';
7231 Sprintf(buf, "%c %s", (char) any.a_int, "all classes of objects");
7232 /* we won't preselect this even if the incoming list is empty;
7233 having it selected means that it would have to be explicitly
7234 de-selected in order to select anything else */
7235 add_menu(win, NO_GLYPH, &any, 'A', 0, ATR_NONE, buf, MENU_UNSELECTED);
7237 end_menu(win, prompt);
7238 n = select_menu(win, way ? PICK_ANY : PICK_ONE, &pick_list);
7239 destroy_nhwindow(win);
7241 if (category == 1) {
7242 /* for object classes, first check for 'all'; it means 'use
7243 a blank list' rather than 'collect every possible choice' */
7244 for (i = 0; i < n; ++i)
7245 if (pick_list[i].item.a_int == ' ') {
7246 pick_list[0].item.a_int = ' ';
7247 n = 1; /* return 1; also an implicit 'break;' */
7250 for (i = 0; i < n; ++i)
7251 *class_select++ = (char) pick_list[i].item.a_int;
7252 free((genericptr_t) pick_list);
7254 } else if (n == -1) {
7255 class_select = eos(class_select);
7259 *class_select = '\0';
7263 static struct wc_Opt wc_options[] = {
7264 { "ascii_map", WC_ASCII_MAP },
7265 { "color", WC_COLOR },
7266 { "eight_bit_tty", WC_EIGHT_BIT_IN },
7267 { "hilite_pet", WC_HILITE_PET },
7268 { "popup_dialog", WC_POPUP_DIALOG },
7269 { "player_selection", WC_PLAYER_SELECTION },
7270 { "preload_tiles", WC_PRELOAD_TILES },
7271 { "tiled_map", WC_TILED_MAP },
7272 { "tile_file", WC_TILE_FILE },
7273 { "tile_width", WC_TILE_WIDTH },
7274 { "tile_height", WC_TILE_HEIGHT },
7275 { "use_inverse", WC_INVERSE },
7276 { "align_message", WC_ALIGN_MESSAGE },
7277 { "align_status", WC_ALIGN_STATUS },
7278 { "font_map", WC_FONT_MAP },
7279 { "font_menu", WC_FONT_MENU },
7280 { "font_message", WC_FONT_MESSAGE },
7282 {"perm_invent", WC_PERM_INVENT},
7284 { "font_size_map", WC_FONTSIZ_MAP },
7285 { "font_size_menu", WC_FONTSIZ_MENU },
7286 { "font_size_message", WC_FONTSIZ_MESSAGE },
7287 { "font_size_status", WC_FONTSIZ_STATUS },
7288 { "font_size_text", WC_FONTSIZ_TEXT },
7289 { "font_status", WC_FONT_STATUS },
7290 { "font_text", WC_FONT_TEXT },
7291 { "map_mode", WC_MAP_MODE },
7292 { "scroll_amount", WC_SCROLL_AMOUNT },
7293 { "scroll_margin", WC_SCROLL_MARGIN },
7294 { "splash_screen", WC_SPLASH_SCREEN },
7295 { "vary_msgcount", WC_VARY_MSGCOUNT },
7296 { "windowcolors", WC_WINDOWCOLORS },
7297 { "mouse_support", WC_MOUSE_SUPPORT },
7300 static struct wc_Opt wc2_options[] = {
7301 { "fullscreen", WC2_FULLSCREEN },
7302 { "softkeyboard", WC2_SOFTKEYBOARD },
7303 { "wraptext", WC2_WRAPTEXT },
7304 { "use_darkgray", WC2_DARKGRAY },
7305 { "hitpointbar", WC2_HITPOINTBAR },
7306 { "hilite_status", WC2_HILITE_STATUS },
7307 /* name shown in 'O' menu is different */
7308 { "status hilite rules", WC2_HILITE_STATUS },
7309 /* statushilites doesn't have its own bit */
7310 { "statushilites", WC2_HILITE_STATUS },
7311 { "term_cols", WC2_TERM_SIZE },
7312 { "term_rows", WC2_TERM_SIZE },
7313 { "petattr", WC2_PETATTR },
7314 { "guicolor", WC2_GUICOLOR },
7315 { "statuslines", WC2_STATUSLINES },
7316 { "windowborders", WC2_WINDOWBORDERS },
7321 * If a port wants to change or ensure that the SET_IN_SYS,
7322 * SET_IN_FILE, DISP_IN_GAME, or SET_IN_GAME status of an option is
7323 * correct (for controlling its display in the option menu) call
7324 * set_option_mod_status()
7325 * with the appropriate second argument.
7328 set_option_mod_status(optnam, status)
7334 if (SET__IS_VALUE_VALID(status)) {
7335 impossible("set_option_mod_status: status out of range %d.", status);
7338 for (k = 0; boolopt[k].name; k++) {
7339 if (!strncmpi(boolopt[k].name, optnam, strlen(optnam))) {
7340 boolopt[k].optflags = status;
7344 for (k = 0; compopt[k].name; k++) {
7345 if (!strncmpi(compopt[k].name, optnam, strlen(optnam))) {
7346 compopt[k].optflags = status;
7353 * You can set several wc_options in one call to
7354 * set_wc_option_mod_status() by setting
7355 * the appropriate bits for each option that you
7356 * are setting in the optmask argument
7358 * example: set_wc_option_mod_status(WC_COLOR|WC_SCROLL_MARGIN,
7362 set_wc_option_mod_status(optmask, status)
7363 unsigned long optmask;
7368 if (SET__IS_VALUE_VALID(status)) {
7369 impossible("set_wc_option_mod_status: status out of range %d.",
7373 while (wc_options[k].wc_name) {
7374 if (optmask & wc_options[k].wc_bit) {
7375 set_option_mod_status(wc_options[k].wc_name, status);
7382 is_wc_option(optnam)
7387 while (wc_options[k].wc_name) {
7388 if (strcmp(wc_options[k].wc_name, optnam) == 0)
7396 wc_supported(optnam)
7401 for (k = 0; wc_options[k].wc_name; ++k) {
7402 if (!strcmp(wc_options[k].wc_name, optnam))
7403 return (windowprocs.wincap & wc_options[k].wc_bit) ? TRUE : FALSE;
7409 * You can set several wc2_options in one call to
7410 * set_wc2_option_mod_status() by setting
7411 * the appropriate bits for each option that you
7412 * are setting in the optmask argument
7415 * set_wc2_option_mod_status(WC2_FULLSCREEN|WC2_SOFTKEYBOARD|WC2_WRAPTEXT,
7420 set_wc2_option_mod_status(optmask, status)
7421 unsigned long optmask;
7426 if (SET__IS_VALUE_VALID(status)) {
7427 impossible("set_wc2_option_mod_status: status out of range %d.",
7431 while (wc2_options[k].wc_name) {
7432 if (optmask & wc2_options[k].wc_bit) {
7433 set_option_mod_status(wc2_options[k].wc_name, status);
7440 is_wc2_option(optnam)
7445 while (wc2_options[k].wc_name) {
7446 if (strcmp(wc2_options[k].wc_name, optnam) == 0)
7454 wc2_supported(optnam)
7459 for (k = 0; wc2_options[k].wc_name; ++k) {
7460 if (!strcmp(wc2_options[k].wc_name, optnam))
7461 return (windowprocs.wincap2 & wc2_options[k].wc_bit) ? TRUE
7468 wc_set_font_name(opttype, fontname)
7472 char **fn = (char **) 0;
7478 fn = &iflags.wc_font_map;
7480 case MESSAGE_OPTION:
7481 fn = &iflags.wc_font_message;
7484 fn = &iflags.wc_font_text;
7487 fn = &iflags.wc_font_menu;
7490 fn = &iflags.wc_font_status;
7497 free((genericptr_t) *fn);
7498 *fn = dupstr(fontname);
7504 wc_set_window_colors(op)
7508 * menu white/black message green/yellow status white/blue text
7513 char *wn, *tfg, *tbg, *newop;
7514 static const char *wnames[] = { "menu", "message", "status", "text" };
7515 static const char *shortnames[] = { "mnu", "msg", "sts", "txt" };
7516 static char **fgp[] = { &iflags.wc_foregrnd_menu,
7517 &iflags.wc_foregrnd_message,
7518 &iflags.wc_foregrnd_status,
7519 &iflags.wc_foregrnd_text };
7520 static char **bgp[] = { &iflags.wc_backgrnd_menu,
7521 &iflags.wc_backgrnd_message,
7522 &iflags.wc_backgrnd_status,
7523 &iflags.wc_backgrnd_text };
7526 newop = mungspaces(buf);
7527 while (newop && *newop) {
7528 wn = tfg = tbg = (char *) 0;
7530 /* until first non-space in case there's leading spaces - before
7539 /* until first space - colorname*/
7540 while (*newop && *newop != ' ')
7548 /* until first non-space - before foreground*/
7556 /* until slash - foreground */
7557 while (*newop && *newop != '/')
7565 /* until first non-space (in case there's leading space after slash) -
7566 * before background */
7574 /* until first space - background */
7575 while (*newop && *newop != ' ')
7580 for (j = 0; j < 4; ++j) {
7581 if (!strcmpi(wn, wnames[j]) || !strcmpi(wn, shortnames[j])) {
7582 if (tfg && !strstri(tfg, " ")) {
7584 free((genericptr_t) *fgp[j]);
7585 *fgp[j] = dupstr(tfg);
7587 if (tbg && !strstri(tbg, " ")) {
7589 free((genericptr_t) *bgp[j]);
7590 *bgp[j] = dupstr(tbg);
7599 /* set up for wizard mode if player or save file has requested to it;
7600 called from port-specific startup code to handle `nethack -D' or
7601 OPTIONS=playmode:debug, or from dorecover()'s restgamestate() if
7602 restoring a game which was saved in wizard mode */
7607 if (authorize_wizard_mode())
7608 Strcpy(plname, "wizard");
7610 wizard = FALSE; /* not allowed or not available */
7611 /* force explore mode if we didn't make it into wizard mode */
7613 iflags.deferred_X = FALSE;
7615 /* don't need to do anything special for explore mode or normal play */
7618 #endif /* OPTION_LISTS_ONLY */