1 /* NetHack 3.6 options.c $NHDT-Date: 1448241657 2015/11/23 01:20:57 $ $NHDT-Branch: master $:$NHDT-Revision: 1.243 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
5 #ifdef OPTION_LISTS_ONLY /* (AMIGA) external program for opt lists */
9 NEARDATA struct flag flags; /* provide linkage */
11 NEARDATA struct sysflag sysflags; /* provide linkage */
13 NEARDATA struct instance_flags iflags; /* provide linkage */
21 #define BACKWARD_COMPAT
24 #ifdef DEFAULT_WC_TILED_MAP
25 #define PREFER_TILED TRUE
27 #define PREFER_TILED FALSE
30 #define MESSAGE_OPTION 1
31 #define STATUS_OPTION 2
36 #define PILE_LIMIT_DFLT 5
39 * NOTE: If you add (or delete) an option, please update the short
40 * options help (option_help()), the long options help (dat/opthelp),
41 * and the current options setting display function (doset()),
42 * and also the Guidebooks.
44 * The order matters. If an option is a an initial substring of another
45 * option (e.g. time and timed_delay) the shorter one must come first.
48 static struct Bool_Opt {
50 boolean *addr, initvalue;
53 { "acoustics", &flags.acoustics, TRUE, SET_IN_GAME },
54 #if defined(SYSFLAGS) && defined(AMIGA)
55 /* Amiga altmeta causes Alt+key to be converted into Meta+key by
56 low level nethack code; on by default, can be toggled off if
57 Alt+key is needed for some ASCII chars on non-ASCII keyboard */
58 { "altmeta", &sysflags.altmeta, TRUE, DISP_IN_GAME },
61 /* non-Amiga altmeta causes nethack's top level command loop to treat
62 two character sequence "ESC c" as M-c, for terminals or emulators
63 which send "ESC c" when Alt+c is pressed; off by default, enabling
64 this can potentially make trouble if user types ESC when nethack
65 is honoring this conversion request (primarily after starting a
66 count prefix prior to a command and then deciding to cancel it) */
67 { "altmeta", &iflags.altmeta, FALSE, SET_IN_GAME },
69 { "altmeta", (boolean *) 0, TRUE, DISP_IN_GAME },
72 { "ascii_map", &iflags.wc_ascii_map, !PREFER_TILED, SET_IN_GAME }, /*WC*/
73 #if defined(SYSFLAGS) && defined(MFLOPPY)
74 { "asksavedisk", &sysflags.asksavedisk, FALSE, SET_IN_GAME },
76 { "asksavedisk", (boolean *) 0, FALSE, SET_IN_FILE },
78 { "autodig", &flags.autodig, FALSE, SET_IN_GAME },
79 { "autoopen", &flags.autoopen, TRUE, SET_IN_GAME },
80 { "autopickup", &flags.pickup, TRUE, SET_IN_GAME },
81 { "autoquiver", &flags.autoquiver, FALSE, SET_IN_GAME },
82 #if defined(MICRO) && !defined(AMIGA)
83 { "BIOS", &iflags.BIOS, FALSE, SET_IN_FILE },
85 { "BIOS", (boolean *) 0, FALSE, SET_IN_FILE },
87 { "blind", &u.uroleplay.blind, FALSE, DISP_IN_GAME },
88 { "bones", &flags.bones, TRUE, SET_IN_FILE },
90 { "checkpoint", &flags.ins_chkpt, TRUE, SET_IN_GAME },
92 { "checkpoint", (boolean *) 0, FALSE, SET_IN_FILE },
95 { "checkspace", &iflags.checkspace, TRUE, SET_IN_GAME },
97 { "checkspace", (boolean *) 0, FALSE, SET_IN_FILE },
99 { "clicklook", &iflags.clicklook, FALSE, SET_IN_GAME },
100 { "cmdassist", &iflags.cmdassist, TRUE, SET_IN_GAME },
101 #if defined(MICRO) || defined(WIN32)
102 { "color", &iflags.wc_color, TRUE, SET_IN_GAME }, /*WC*/
103 #else /* systems that support multiple terminals, many monochrome */
104 { "color", &iflags.wc_color, FALSE, SET_IN_GAME }, /*WC*/
106 { "confirm", &flags.confirm, TRUE, SET_IN_GAME },
107 { "dark_room", &flags.dark_room, TRUE, SET_IN_GAME },
108 { "eight_bit_tty", &iflags.wc_eight_bit_input, FALSE,
109 SET_IN_GAME }, /*WC*/
111 { "extmenu", &iflags.extmenu, FALSE, SET_IN_GAME },
113 { "extmenu", (boolean *) 0, FALSE, SET_IN_FILE },
116 { "fast_map", &flags.fast_map, TRUE, SET_IN_GAME },
118 { "fast_map", (boolean *) 0, TRUE, SET_IN_FILE },
120 { "female", &flags.female, FALSE, DISP_IN_GAME },
121 { "fixinv", &flags.invlet_constant, TRUE, SET_IN_GAME },
122 #if defined(SYSFLAGS) && defined(AMIFLUSH)
123 { "flush", &sysflags.amiflush, FALSE, SET_IN_GAME },
125 { "flush", (boolean *) 0, FALSE, SET_IN_FILE },
127 { "fullscreen", &iflags.wc2_fullscreen, FALSE, SET_IN_FILE },
128 { "help", &flags.help, TRUE, SET_IN_GAME },
129 { "hilite_pet", &iflags.wc_hilite_pet, FALSE, SET_IN_GAME }, /*WC*/
130 { "hilite_pile", &iflags.hilite_pile, FALSE, SET_IN_GAME },
132 { "ignintr", &flags.ignintr, FALSE, SET_IN_GAME },
134 { "ignintr", (boolean *) 0, FALSE, SET_IN_FILE },
136 { "implicit_uncursed", &iflags.implicit_uncursed, TRUE, SET_IN_GAME },
137 { "large_font", &iflags.obsolete, FALSE, SET_IN_FILE }, /* OBSOLETE */
138 { "legacy", &flags.legacy, TRUE, DISP_IN_GAME },
139 { "lit_corridor", &flags.lit_corridor, FALSE, SET_IN_GAME },
140 { "lootabc", &flags.lootabc, FALSE, SET_IN_GAME },
142 { "mail", &flags.biff, TRUE, SET_IN_GAME },
144 { "mail", (boolean *) 0, TRUE, SET_IN_FILE },
146 { "mention_walls", &iflags.mention_walls, FALSE, SET_IN_GAME },
147 { "menucolors", &iflags.use_menu_color, FALSE, SET_IN_GAME },
148 /* for menu debugging only*/
149 { "menu_tab_sep", &iflags.menu_tab_sep, FALSE, SET_IN_GAME },
150 { "menu_objsyms", &iflags.menu_head_objsym, FALSE, SET_IN_GAME },
151 { "mouse_support", &iflags.wc_mouse_support, TRUE, DISP_IN_GAME }, /*WC*/
153 { "news", &iflags.news, TRUE, DISP_IN_GAME },
155 { "news", (boolean *) 0, FALSE, SET_IN_FILE },
157 { "nudist", &u.uroleplay.nudist, FALSE, DISP_IN_GAME },
158 { "null", &flags.null, TRUE, SET_IN_GAME },
159 #if defined(SYSFLAGS) && defined(MAC)
160 { "page_wait", &sysflags.page_wait, TRUE, SET_IN_GAME },
162 { "page_wait", (boolean *) 0, FALSE, SET_IN_FILE },
164 { "perm_invent", &flags.perm_invent, FALSE, SET_IN_GAME },
165 { "pickup_thrown", &flags.pickup_thrown, TRUE, SET_IN_GAME },
166 { "popup_dialog", &iflags.wc_popup_dialog, FALSE, SET_IN_GAME }, /*WC*/
167 { "preload_tiles", &iflags.wc_preload_tiles, TRUE, DISP_IN_GAME }, /*WC*/
168 { "pushweapon", &flags.pushweapon, FALSE, SET_IN_GAME },
169 #if defined(MICRO) && !defined(AMIGA)
170 { "rawio", &iflags.rawio, FALSE, DISP_IN_GAME },
172 { "rawio", (boolean *) 0, FALSE, SET_IN_FILE },
174 { "rest_on_space", &flags.rest_on_space, FALSE, SET_IN_GAME },
176 { "rlecomp", &iflags.rlecomp,
177 #if defined(COMPRESS) || defined(ZLIB_COMP)
184 { "safe_pet", &flags.safe_dog, TRUE, SET_IN_GAME },
185 { "sanity_check", &iflags.sanity_check, FALSE, SET_IN_GAME },
186 { "selectsaved", &iflags.wc2_selectsaved, TRUE, DISP_IN_GAME }, /*WC*/
187 { "showexp", &flags.showexp, FALSE, SET_IN_GAME },
188 { "showrace", &flags.showrace, FALSE, SET_IN_GAME },
190 { "showscore", &flags.showscore, FALSE, SET_IN_GAME },
192 { "showscore", (boolean *) 0, FALSE, SET_IN_FILE },
194 { "silent", &flags.silent, TRUE, SET_IN_GAME },
195 { "softkeyboard", &iflags.wc2_softkeyboard, FALSE, SET_IN_FILE },
196 { "sortpack", &flags.sortpack, TRUE, SET_IN_GAME },
197 { "sparkle", &flags.sparkle, TRUE, SET_IN_GAME },
198 { "splash_screen", &iflags.wc_splash_screen, TRUE, DISP_IN_GAME }, /*WC*/
199 { "standout", &flags.standout, FALSE, SET_IN_GAME },
200 #if defined(STATUS_VIA_WINDOWPORT) && defined(STATUS_HILITES)
201 { "statushilites", &iflags.use_status_hilites, TRUE, SET_IN_GAME },
203 { "statushilites", &iflags.use_status_hilites, FALSE, DISP_IN_GAME },
205 { "tiled_map", &iflags.wc_tiled_map, PREFER_TILED, DISP_IN_GAME }, /*WC*/
206 { "time", &flags.time, FALSE, SET_IN_GAME },
208 { "timed_delay", &flags.nap, TRUE, SET_IN_GAME },
210 { "timed_delay", (boolean *) 0, FALSE, SET_IN_GAME },
212 { "tombstone", &flags.tombstone, TRUE, SET_IN_GAME },
213 { "toptenwin", &iflags.toptenwin, FALSE, SET_IN_GAME },
214 { "travel", &flags.travelcmd, TRUE, SET_IN_GAME },
215 { "use_darkgray", &iflags.wc2_darkgray, TRUE, SET_IN_FILE },
217 { "use_inverse", &iflags.wc_inverse, TRUE, SET_IN_GAME }, /*WC*/
219 { "use_inverse", &iflags.wc_inverse, FALSE, SET_IN_GAME }, /*WC*/
221 { "verbose", &flags.verbose, TRUE, SET_IN_GAME },
222 { "wraptext", &iflags.wc2_wraptext, FALSE, SET_IN_GAME },
224 { "zerocomp", &iflags.zerocomp,
225 #if defined(COMPRESS) || defined(ZLIB_COMP)
232 { (char *) 0, (boolean *) 0, FALSE, 0 }
235 /* compound options, for option_help() and external programs like Amiga
237 static struct Comp_Opt {
238 const char *name, *descr;
239 int size; /* for frontends and such allocating space --
240 * usually allowed size of data in game, but
241 * occasionally maximum reasonable size for
242 * typing when game maintains information in
243 * a different format */
247 { "align", "your starting alignment (lawful, neutral, or chaotic)", 8,
249 { "align", "
\83Q
\81[
\83\80\83X
\83^
\81[
\83g
\8e\9e\82Ì
\91®
\90« (lawful, neutral, or chaotic
\82Ì
\82¢
\82¸
\82ê
\82©)", 8,
252 { "align_message", "message window alignment", 20, DISP_IN_GAME }, /*WC*/
254 { "align_message", "
\83\81\83b
\83Z
\81[
\83W
\83E
\83B
\83\93\83h
\83E
\82Ì
\91µ
\82¦", 20, DISP_IN_GAME }, /*WC*/
257 { "align_status", "status window alignment", 20, DISP_IN_GAME }, /*WC*/
259 { "align_status", "
\8fó
\8bµ
\83E
\83B
\83\93\83h
\83E
\82Ì
\91µ
\82¦", 20, DISP_IN_GAME }, /*WC*/
262 { "altkeyhandler", "alternate key handler", 20, DISP_IN_GAME },
264 { "altkeyhandler", "ALT
\83L
\81[
\83n
\83\93\83h
\83\89", 20, DISP_IN_GAME },
265 #ifdef BACKWARD_COMPAT
267 { "boulder", "deprecated (use S_boulder in sym file instead)", 1,
269 { "boulder", "
\8b\90\8aâ
\82ð
\95\
\8e¦
\82·
\82é
\83V
\83\93\83{
\83\8b\95¶
\8e\9a", 1,
273 { "catname", "the name of your (first) cat (e.g., catname:Tabby)",
275 { "catname", "
\96`
\8c¯
\82ð
\8b\9f\82É
\82·
\82é(
\8dÅ
\8f\89\82Ì)
\94L
\82Ì
\96¼
\91O (
\97á catname:
\82½
\82Ü)",
276 PL_PSIZ, DISP_IN_GAME },
278 { "disclose", "the kinds of information to disclose at end of game",
280 { "disclose", "
\83Q
\81[
\83\80\8fI
\97¹
\8e\9e\82É
\8c©
\82é
\8fî
\95ñ
\82Ì
\8eí
\97Þ",
281 sizeof(flags.end_disclose) * 2, SET_IN_GAME },
283 { "dogname", "the name of your (first) dog (e.g., dogname:Fang)", PL_PSIZ,
285 { "dogname", "
\96`
\8c¯
\82ð
\8b\9f\82É
\82·
\82é(
\8dÅ
\8f\89\82Ì)
\8c¢
\82Ì
\96¼
\91O (
\97á dogname:
\83|
\83`)", PL_PSIZ,
288 { "dungeon", "the symbols to use in drawing the dungeon map",
290 { "dungeon", "
\83_
\83\93\83W
\83\87\83\93\82ð
\95`
\89æ
\82·
\82é
\83V
\83\93\83{
\83\8b\95¶
\8e\9a",
291 MAXDCHARS + 1, SET_IN_FILE },
293 { "effects", "the symbols to use in drawing special effects",
295 { "effects", "
\93Á
\8eê
\8cø
\89Ê
\82ð
\95`
\89æ
\82·
\82é
\83V
\83\93\83{
\83\8b\95¶
\8e\9a",
296 MAXECHARS + 1, SET_IN_FILE },
298 { "font_map", "the font to use in the map window", 40,
300 { "font_map", "
\83}
\83b
\83v
\83E
\83B
\83\93\83h
\83E
\82É
\8eg
\97p
\82·
\82é
\83t
\83H
\83\93\83g", 40,
301 DISP_IN_GAME }, /*WC*/
303 { "font_menu", "the font to use in menus", 40, DISP_IN_GAME }, /*WC*/
305 { "font_menu", "
\83\81\83j
\83\85\81[
\82É
\8eg
\97p
\82·
\82é
\83t
\83H
\83\93\83g", 40, DISP_IN_GAME }, /*WC*/
308 { "font_message", "the font to use in the message window", 40,
310 { "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,
311 DISP_IN_GAME }, /*WC*/
313 { "font_size_map", "the size of the map font", 20, DISP_IN_GAME }, /*WC*/
315 { "font_size_map", "
\83}
\83b
\83v
\83t
\83H
\83\93\83g
\82Ì
\83T
\83C
\83Y", 20, DISP_IN_GAME }, /*WC*/
318 { "font_size_menu", "the size of the menu font", 20,
320 { "font_size_menu", "
\83\81\83j
\83\85\81[
\83t
\83H
\83\93\83g
\82Ì
\83T
\83C
\83Y", 20,
321 DISP_IN_GAME }, /*WC*/
323 { "font_size_message", "the size of the message font", 20,
325 { "font_size_message", "
\83\81\83b
\83Z
\81[
\83W
\83t
\83H
\83\93\83g
\82Ì
\83T
\83C
\83Y", 20,
326 DISP_IN_GAME }, /*WC*/
328 { "font_size_status", "the size of the status font", 20,
330 { "font_size_status", "
\8fó
\8bµ
\83t
\83H
\83\93\83g
\82Ì
\83T
\83C
\83Y", 20,
331 DISP_IN_GAME }, /*WC*/
333 { "font_size_text", "the size of the text font", 20,
335 { "font_size_text", "
\83e
\83L
\83X
\83g
\83t
\83H
\83\93\83g
\82Ì
\83T
\83C
\83Y", 20,
336 DISP_IN_GAME }, /*WC*/
338 { "font_status", "the font to use in status window", 40,
340 { "font_status", "
\8fó
\8bµ
\83E
\83B
\83\93\83h
\83E
\82É
\8eg
\97p
\82·
\82é
\83t
\83H
\83\93\83g", 40,
341 DISP_IN_GAME }, /*WC*/
343 { "font_text", "the font to use in text windows", 40,
345 { "font_text", "
\83e
\83L
\83X
\83g
\83E
\83B
\83\93\83h
\83E
\82É
\8eg
\97p
\82·
\82é
\83t
\83H
\83\93\83g", 40,
346 DISP_IN_GAME }, /*WC*/
348 { "fruit", "the name of a fruit you enjoy eating", PL_FSIZ, SET_IN_GAME },
350 { "fruit", "
\8dD
\95¨
\82Ì
\89Ê
\95¨
\82Ì
\96¼
\91O", PL_FSIZ, SET_IN_GAME },
352 { "gender", "your starting gender (male or female)", 8, DISP_IN_GAME },
354 { "gender", "
\83Q
\81[
\83\80\8aJ
\8en
\8e\9e\82Ì
\90«
\95Ê(male
\82Ü
\82½
\82Í female)", 8, DISP_IN_GAME },
356 { "horsename", "the name of your (first) horse (e.g., horsename:Silver)",
358 { "horsename", "
\96`
\8c¯
\82ð
\8b\9f\82É
\82·
\82é(
\8dÅ
\8f\89\82Ì)
\94n
\82Ì
\96¼
\91O (
\97á ghoulname:
\83V
\83\8b\83o
\81[)",
359 PL_PSIZ, DISP_IN_GAME },
361 { "map_mode", "map display mode under Windows", 20, DISP_IN_GAME }, /*WC*/
363 { "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*/
366 { "menustyle", "user interface for object selection", MENUTYPELEN,
368 { "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,
371 { "menu_deselect_all", "deselect all items in a menu", 4, SET_IN_FILE },
373 { "menu_deselect_all", "
\91S
\82Ä
\82Ì
\83A
\83C
\83e
\83\80\82ð
\94ñ
\91I
\91ð", 4, SET_IN_FILE },
375 { "menu_deselect_page", "deselect all items on this page of a menu", 4,
377 { "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,
380 { "menu_first_page", "jump to the first page in a menu", 4, SET_IN_FILE },
382 { "menu_first_page", "
\83\81\83j
\83\85\81[
\82Ì
\8dÅ
\8f\89\82Ì
\83y
\81[
\83W
\82Ö", 4, SET_IN_FILE },
384 { "menu_headings", "text attribute for menu headings", 9, SET_IN_GAME },
386 { "menu_headings", "
\8b
\92²
\81C
\94½
\93]
\82Ü
\82½
\82Í
\89º
\90ü
\82Å
\8eí
\97Þ
\82ð
\95\
\8e¦
\82·
\82é", 9, SET_IN_GAME },
388 { "menu_invert_all", "invert all items in a menu", 4, SET_IN_FILE },
390 { "menu_invert_all", "
\91S
\82Ä
\82Ì
\83A
\83C
\83e
\83\80\82ð
\94½
\93]", 4, SET_IN_FILE },
392 { "menu_invert_page", "invert all items on this page of a menu", 4,
394 { "menu_invert_page", "
\8c»
\8dÝ
\95\
\8e¦
\82³
\82ê
\82Ä
\82¢
\82é
\83y
\81[
\83W
\82Ì
\83A
\83C
\83e
\83\80\82ð
\94½
\93]",
397 { "menu_last_page", "jump to the last page in a menu", 4, SET_IN_FILE },
399 { "menu_last_page", "
\83\81\83j
\83\85\81[
\82Ì
\8dÅ
\8cã
\82Ì
\83y
\81[
\83W
\82Ö", 4, SET_IN_FILE },
401 { "menu_next_page", "goto the next menu page", 4, SET_IN_FILE },
403 { "menu_next_page", "
\8e\9f\82Ì
\83\81\83j
\83\85\81[
\82Ì
\83y
\81[
\83W
\82Ö", 4, SET_IN_FILE },
405 { "menu_previous_page", "goto the previous menu page", 4, SET_IN_FILE },
407 { "menu_previous_page", "
\91O
\82Ì
\83\81\83j
\83\85\81[
\82Ì
\83y
\81[
\83W
\82Ö", 4, SET_IN_FILE },
409 { "menu_search", "search for a menu item", 4, SET_IN_FILE },
411 { "menu_search", "
\83\81\83j
\83\85\81[
\82Ì
\8c\9f\8dõ", 4, SET_IN_FILE },
413 { "menu_select_all", "select all items in a menu", 4, SET_IN_FILE },
415 { "menu_select_all", "
\91S
\82Ä
\82Ì
\83A
\83C
\83e
\83\80\82ð
\91I
\91ð", 4, SET_IN_FILE },
417 { "menu_select_page", "select all items on this page of a menu", 4,
419 { "menu_select_page", "
\8c»
\8dÝ
\95\
\8e¦
\82³
\82ê
\82Ä
\82¢
\82é
\91S
\82Ä
\82Ì
\83A
\83C
\83e
\83\80\82ð
\91I
\91ð", 4,
422 { "monsters", "the symbols to use for monsters", MAXMCLASSES,
424 { "monsters", "
\83\82\83\93\83X
\83^
\81[
\82É
\8eg
\97p
\82³
\82ê
\82é
\83V
\83\93\83{
\83\8b\95¶
\8e\9a", MAXMCLASSES,
427 { "msghistory", "number of top line messages to save", 5, DISP_IN_GAME },
429 { "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 },
432 { "msg_window", "the type of message window required", 1, SET_IN_GAME },
434 {"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 },
437 { "msg_window", "the type of message window required", 1, SET_IN_FILE },
439 {"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 },
442 { "name", "your character's name (e.g., name:Merlin-W)", PL_NSIZ,
444 { "name", "
\82 \82È
\82½
\82Ì
\96¼
\91O (
\97á name:
\83}
\81[
\83\8a\83\93-W)", PL_NSIZ,
447 { "number_pad", "use the number pad for movement", 1, SET_IN_GAME },
449 { "number_pad", "
\83i
\83\93\83o
\81[
\83p
\83b
\83h
\82ð
\8eg
\97p
\82·
\82é", 1, SET_IN_GAME },
451 { "objects", "the symbols to use for objects", MAXOCLASSES, SET_IN_FILE },
453 { "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 },
455 { "packorder", "the inventory order of the items in your pack",
457 { "packorder", "
\94w
\95\89\82¢
\91Ü
\93à
\82Ì
\95¨
\82Ì
\8f\87\94Ô",
458 MAXOCLASSES, SET_IN_GAME },
463 "palette (00c/880/-fff is blue/yellow/reverse white)", 15,
465 "
\83p
\83\8c\83b
\83g (00c/880/-fff
\82Í
\82»
\82ê
\82¼
\82ê
\90Â/
\89©/
\94½
\93]
\94\92\82ð
\8e¦
\82·)", 15,
469 "palette (adjust an RGB color in palette (color-R-G-B)", 15,
471 "
\83p
\83\8c\83b
\83g (
\83p
\83\8c\83b
\83g
\82ÌRGB
\90F
\82ð
\92²
\90®
\82·
\82é (
\90F-R-G-B)", 15,
476 { "hicolor", "same as palette, only order is reversed", 15, SET_IN_FILE },
478 { "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 },
481 { "paranoid_confirmation", "extra prompting in certain situations", 28,
484 { "pettype", "your preferred initial pet type", 4, DISP_IN_GAME },
486 { "pettype", "
\82 \82È
\82½
\82Ì
\91I
\91ð
\82µ
\82½
\8f\89\8aú
\83y
\83b
\83g
\82Ì
\8eí
\97Þ", 4, DISP_IN_GAME },
488 { "pickup_burden", "maximum burden picked up before prompt", 20,
490 { "pickup_burden", "
\8fE
\82¤
\82Æ
\82«
\82É
\8dÅ
\91å
\89×
\8fd
\82É
\82È
\82é
\8eè
\91O
\82Å
\8am
\94F
\82·
\82é", 20,
493 { "pickup_types", "types of objects to pick up automatically",
495 { "pickup_types", "
\8e©
\93®
\82Å
\8fE
\82¢
\82 \82°
\82é
\95¨
\82Ì
\83V
\83\93\83{
\83\8b",
496 MAXOCLASSES, SET_IN_GAME },
497 { "pile_limit", "threshold for \"there are many objects here\"", 24,
499 { "playmode", "normal play, non-scoring explore mode, or debug mode", 8,
502 { "player_selection", "choose character via dialog or prompts", 12,
504 { "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,
507 { "race", "your starting race (e.g., Human, Elf)", PL_CSIZ,
509 { "race", "
\83Q
\81[
\83\80\8aJ
\8en
\8e\9e\82Ì
\8eí
\91° (
\97á Human, Elf)", PL_CSIZ,
512 { "role", "your starting role (e.g., Barbarian, Valkyrie)", PL_CSIZ,
514 { "role", "
\83Q
\81[
\83\80\8aJ
\8en
\8e\9e\82Ì
\90E
\8bÆ (
\97á Barbarian, Valkyrie)", PL_CSIZ,
517 { "runmode", "display frequency when `running' or `travelling'",
519 { "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",
520 sizeof "teleport", SET_IN_GAME },
522 { "scores", "the parts of the score list you wish to see", 32,
524 { "scores", "
\83Q
\81[
\83\80\8fI
\97¹
\8e\9e\82É
\8c©
\82é
\83X
\83R
\83A
\82Ì
\8eí
\97Þ", 32,
527 { "scroll_amount", "amount to scroll map when scroll_margin is reached",
529 { "scroll_amount", "scroll_margin
\82É
\93Í
\82¢
\82½
\82Æ
\82«
\82Ì
\83}
\83b
\83v
\83X
\83N
\83\8d\81[
\83\8b\97Ê",
530 20, DISP_IN_GAME }, /*WC*/
532 { "scroll_margin", "scroll map when this far from the edge", 20,
534 { "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,
535 DISP_IN_GAME }, /*WC*/
536 { "sortloot", "sort object selection lists by description", 4,
540 { "soundcard", "type of sound card to use", 20, SET_IN_FILE },
542 { "soundcard", "
\8eg
\97p
\82µ
\82Ä
\82¢
\82é
\83T
\83E
\83\93\83h
\83J
\81[
\83h
\82Ì
\8eí
\97Þ", 20, SET_IN_FILE },
544 { "symset", "load a set of display symbols from the symbols file", 70,
547 "load a set of rogue display symbols from the symbols file", 70,
550 { "suppress_alert", "suppress alerts about version-specific features", 8,
552 { "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,
555 { "tile_width", "width of tiles", 20, DISP_IN_GAME }, /*WC*/
557 { "tile_width", "
\83^
\83C
\83\8b\82Ì
\95\9d", 20, DISP_IN_GAME }, /*WC*/
560 { "tile_height", "height of tiles", 20, DISP_IN_GAME }, /*WC*/
562 { "tile_height", "
\83^
\83C
\83\8b\82Ì
\8d\82\82³", 20, DISP_IN_GAME }, /*WC*/
565 { "tile_file", "name of tile file", 70, DISP_IN_GAME }, /*WC*/
567 { "tile_file", "
\83^
\83C
\83\8b\83t
\83@
\83C
\83\8b\82Ì
\96¼
\91O", 70, DISP_IN_GAME }, /*WC*/
570 { "traps", "the symbols to use in drawing traps", MAXTCHARS + 1,
572 { "traps", "ã©
\82ð
\95`
\89æ
\82·
\82é
\83V
\83\93\83{
\83\8b\95¶
\8e\9a", MAXTCHARS + 1,
575 { "vary_msgcount", "show more old messages at a time", 20,
577 { "vary_msgcount", "
\88ê
\93x
\82É
\95\
\8e¦
\82·
\82é
\83\81\83b
\83Z
\81[
\83W
\82Ì
\90\94", 20,
578 DISP_IN_GAME }, /*WC*/
581 { "video", "method of video updating", 20, SET_IN_FILE },
583 { "video", "
\8eg
\97p
\82·
\82é
\83r
\83f
\83I
\83\82\81[
\83h
\82ð
\90Ý
\92è
\82·
\82é", 20, SET_IN_FILE },
587 { "videocolors", "color mappings for internal screen routines", 40,
589 { "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,
592 { "videoshades", "gray shades to map to black/gray/white", 32,
594 { "videoshades", "
\95\
\8e¦
\82É
\83O
\83\8c\83C
\83X
\83P
\81[
\83\8b\82ð
\97p
\82¢
\82é", 32,
599 { "subkeyvalue", "override keystroke value", 7, SET_IN_FILE },
601 {"subkeyvalue", "
\83L
\81[
\83}
\83b
\83s
\83\93\83O
\82ð
\95Ï
\8dX
\82·
\82é", 7, SET_IN_FILE },
604 { "windowcolors", "the foreground/background colors of windows", /*WC*/
606 { "windowcolors", "
\83E
\83B
\83\93\83h
\83E
\82ð
\8ew
\92è
\82µ
\82½
\91O
\8ci
\90F/
\94w
\8ci
\90F
\82Å
\95\
\8e¦
\82·
\82é", /*WC*/
610 { "windowtype", "windowing system to use", WINTYPELEN, DISP_IN_GAME },
612 { "windowtype", "
\8eg
\97p
\82·
\82é
\83E
\83C
\83\93\83h
\83E
\83V
\83X
\83e
\83\80", WINTYPELEN, DISP_IN_GAME },
614 { "windowchain", "window processor to use", WINTYPELEN, SET_IN_SYS },
616 #ifdef BACKWARD_COMPAT
617 { "DECgraphics", "load DECGraphics display symbols", 70, SET_IN_FILE },
618 { "IBMgraphics", "load IBMGraphics display symbols", 70, SET_IN_FILE },
619 #ifdef MAC_GRAPHICS_ENV
620 { "Macgraphics", "load MACGraphics display symbols", 70, SET_IN_FILE },
624 { "kcode", "
\92[
\96\96\82Ì
\8a¿
\8e\9a\83R
\81[
\83h,", 4, SET_IN_FILE },
626 { (char *) 0, (char *) 0, 0, 0 }
629 #ifdef OPTION_LISTS_ONLY
632 #else /* use rest of file */
634 extern struct symparse loadsyms[];
635 static boolean need_redraw; /* for doset() */
637 #if defined(TOS) && defined(TEXTCOLOR)
638 extern boolean colors_changed; /* in tos.c */
642 extern char *shade[3]; /* in sys/msdos/video.c */
643 extern char ttycolors[CLR_MAX]; /* in sys/msdos/video.c */
646 static char def_inv_order[MAXOCLASSES] = {
647 COIN_CLASS, AMULET_CLASS, WEAPON_CLASS, ARMOR_CLASS, FOOD_CLASS,
648 SCROLL_CLASS, SPBOOK_CLASS, POTION_CLASS, RING_CLASS, WAND_CLASS,
649 TOOL_CLASS, GEM_CLASS, ROCK_CLASS, BALL_CLASS, CHAIN_CLASS, 0,
653 * Default menu manipulation command accelerators. These may _not_ be:
655 * + a number - reserved for counts
656 * + an upper or lower case US ASCII letter - used for accelerators
657 * + ESC - reserved for escaping the menu
658 * + NULL, CR or LF - reserved for commiting the selection(s). NULL
659 * is kind of odd, but the tty's xwaitforspace() will return it if
660 * someone hits a <ret>.
661 * + a default object class symbol - used for object class accelerators
663 * Standard letters (for now) are:
676 * The command name list is duplicated in the compopt array.
683 #define NUM_MENU_CMDS 11
684 static const menu_cmd_t default_menu_cmd_info[NUM_MENU_CMDS] = {
685 /* 0*/ { "menu_first_page", MENU_FIRST_PAGE },
686 { "menu_last_page", MENU_LAST_PAGE },
687 { "menu_next_page", MENU_NEXT_PAGE },
688 { "menu_previous_page", MENU_PREVIOUS_PAGE },
689 { "menu_select_all", MENU_SELECT_ALL },
690 /* 5*/ { "menu_deselect_all", MENU_UNSELECT_ALL },
691 { "menu_invert_all", MENU_INVERT_ALL },
692 { "menu_select_page", MENU_SELECT_PAGE },
693 { "menu_deselect_page", MENU_UNSELECT_PAGE },
694 { "menu_invert_page", MENU_INVERT_PAGE },
695 /*10*/ { "menu_search", MENU_SEARCH },
699 * Allow the user to map incoming characters to various menu commands.
700 * The accelerator list must be a valid C string.
702 #define MAX_MENU_MAPPED_CMDS 32 /* some number */
703 char mapped_menu_cmds[MAX_MENU_MAPPED_CMDS + 1]; /* exported */
704 static char mapped_menu_op[MAX_MENU_MAPPED_CMDS + 1];
705 static short n_menu_mapped = 0;
707 static boolean initial, from_file;
709 STATIC_DCL void FDECL(doset_add_menu, (winid, const char *, int));
710 STATIC_DCL void FDECL(nmcpy, (char *, const char *, int));
711 STATIC_DCL void FDECL(escapes, (const char *, char *));
712 STATIC_DCL void FDECL(rejectoption, (const char *));
713 STATIC_DCL void FDECL(badoption, (const char *));
714 STATIC_DCL char *FDECL(string_for_opt, (char *, BOOLEAN_P));
715 STATIC_DCL char *FDECL(string_for_env_opt, (const char *, char *, BOOLEAN_P));
716 STATIC_DCL void FDECL(bad_negation, (const char *, BOOLEAN_P));
717 STATIC_DCL int FDECL(change_inv_order, (char *));
718 STATIC_DCL void FDECL(oc_to_str, (char *, char *));
719 STATIC_DCL int FDECL(feature_alert_opts, (char *, const char *));
720 STATIC_DCL const char *FDECL(get_compopt_value, (const char *, char *));
721 STATIC_DCL boolean FDECL(special_handling, (const char *,
722 BOOLEAN_P, BOOLEAN_P));
723 STATIC_DCL void FDECL(warning_opts, (char *, const char *));
724 STATIC_DCL boolean FDECL(duplicate_opt_detection, (const char *, int));
725 STATIC_DCL void FDECL(complain_about_duplicate, (const char *, int));
727 STATIC_OVL void FDECL(wc_set_font_name, (int, char *));
728 STATIC_OVL int FDECL(wc_set_window_colors, (char *));
729 STATIC_OVL boolean FDECL(is_wc_option, (const char *));
730 STATIC_OVL boolean FDECL(wc_supported, (const char *));
731 STATIC_OVL boolean FDECL(is_wc2_option, (const char *));
732 STATIC_OVL boolean FDECL(wc2_supported, (const char *));
733 STATIC_DCL void FDECL(remove_autopickup_exception,
734 (struct autopickup_exception *));
735 STATIC_OVL int FDECL(count_ape_maps, (int *, int *));
736 STATIC_DCL const char *FDECL(attr2attrname, (int));
737 STATIC_DCL int NDECL(query_color);
738 STATIC_DCL int NDECL(query_msgtype);
739 STATIC_DCL int FDECL(query_attr, (const char *));
740 STATIC_DCL const char * FDECL(msgtype2name, (int));
741 STATIC_DCL boolean FDECL(msgtype_add, (int, char *));
742 STATIC_DCL void FDECL(free_one_msgtype, (int));
743 STATIC_DCL int NDECL(msgtype_count);
744 STATIC_DCL boolean FDECL(add_menu_coloring_parsed, (char *, int, int));
745 STATIC_DCL void FDECL(free_one_menu_coloring, (int));
746 STATIC_DCL int NDECL(count_menucolors);
747 STATIC_DCL int FDECL(handle_add_list_remove, (const char *, int));
754 for (x = 0; x < COLNO; x++)
755 for (y = 0; y < ROWNO; y++) {
756 struct rm *lev = &levl[x][y];
758 if (!flags.dark_room || !iflags.use_color
759 || Is_rogue_level(&u.uz)) {
760 if (lev->glyph == cmap_to_glyph(S_darkroom))
761 lev->glyph = lev->waslit ? cmap_to_glyph(S_room)
762 : cmap_to_glyph(S_stone);
764 if (lev->glyph == cmap_to_glyph(S_room) && lev->seenv
765 && lev->waslit && !cansee(x, y))
766 lev->glyph = cmap_to_glyph(S_darkroom);
767 else if (lev->glyph == cmap_to_glyph(S_stone)
768 && lev->typ == ROOM && lev->seenv && !cansee(x, y))
769 lev->glyph = cmap_to_glyph(S_darkroom);
772 if (flags.dark_room && iflags.use_color)
773 showsyms[S_darkroom] = showsyms[S_room];
775 showsyms[S_darkroom] = showsyms[S_stone];
778 /* check whether a user-supplied option string is a proper leading
779 substring of a particular option name; option string might have
780 a colon or equals sign and arbitrary value appended to it */
782 match_optname(user_string, opt_name, min_length, val_allowed)
783 const char *user_string, *opt_name;
787 int len = (int) strlen(user_string);
790 const char *p = index(user_string, ':'),
791 *q = index(user_string, '=');
793 if (!p || (q && q < p))
795 while (p && p > user_string && isspace((uchar) * (p - 1)))
798 len = (int) (p - user_string);
801 return (boolean) (len >= min_length
802 && !strncmpi(opt_name, user_string, len));
805 /* most environment variables will eventually be printed in an error
806 * message if they don't work, and most error message paths go through
807 * BUFSZ buffers, which could be overflowed by a maliciously long
808 * environment variable. If a variable can legitimately be long, or
809 * if it's put in a smaller buffer, the responsible code will have to
810 * bounds-check itself.
816 char *getev = getenv(ev);
818 if (getev && strlen(getev) <= (BUFSZ / 2))
824 /* process options, possibly including SYSCF */
830 /* someday there may be other SYSCF alternatives besides text file */
832 /* If SYSCF_FILE is specified, it _must_ exist... */
834 /* ... and _must_ parse correctly. */
835 if (!read_config_file(SYSCF_FILE, SET_IN_SYS)) {
836 raw_printf("Error(s) found in SYSCF_FILE, quitting.");
837 terminate(EXIT_FAILURE);
840 * TODO [maybe]: parse the sysopt entries which are space-separated
841 * lists of usernames into arrays with one name per element.
845 initoptions_finish();
851 #if defined(UNIX) || defined(VMS)
856 /* set up the command parsing */
857 reset_commands(TRUE); /* init */
859 /* initialize the random number generator */
862 /* for detection of configfile options specified multiple times */
863 iflags.opt_booldup = iflags.opt_compdup = (int *) 0;
865 for (i = 0; boolopt[i].name; i++) {
867 *(boolopt[i].addr) = boolopt[i].initvalue;
869 #if defined(COMPRESS) || defined(ZLIB_COMP)
870 set_savepref("externalcomp");
871 set_restpref("externalcomp");
873 set_savepref("!rlecomp");
874 set_restpref("!rlecomp");
878 set_savepref("zerocomp");
879 set_restpref("zerocomp");
882 set_savepref("rlecomp");
883 set_restpref("rlecomp");
887 Strcpy(sysflags.sysflagsid, "sysflags");
888 sysflags.sysflagsid[9] = (char) sizeof(struct sysflag);
890 flags.end_own = FALSE;
892 flags.end_around = 2;
893 flags.paranoia_bits = PARANOID_PRAY; /* old prayconfirm=TRUE */
894 flags.pile_limit = PILE_LIMIT_DFLT; /* 5 */
895 flags.runmode = RUN_LEAP;
896 iflags.msg_history = 20;
898 iflags.prevmsg_window = 's';
900 iflags.menu_headings = ATR_INVERSE;
902 /* hero's role, race, &c haven't been chosen yet */
903 flags.initrole = flags.initrace = flags.initgend = flags.initalign =
906 /* Set the default monster and object class symbols. */
908 for (i = 0; i < WARNCOUNT; i++)
909 warnsyms[i] = def_warnsyms[i].sym;
910 iflags.bouldersym = 0;
912 iflags.travelcc.x = iflags.travelcc.y = -1;
914 /* assert( sizeof flags.inv_order == sizeof def_inv_order ); */
915 (void) memcpy((genericptr_t) flags.inv_order,
916 (genericptr_t) def_inv_order, sizeof flags.inv_order);
917 flags.pickup_types[0] = '\0';
918 flags.pickup_burden = MOD_ENCUMBER;
919 flags.sortloot = 'l'; /* sort only loot by default */
921 for (i = 0; i < NUM_DISCLOSURE_OPTIONS; i++)
922 flags.end_disclose[i] = DISCLOSE_PROMPT_DEFAULT_NO;
923 switch_symbols(FALSE); /* set default characters */
924 #if defined(UNIX) && defined(TTY_GRAPHICS)
926 * Set defaults for some options depending on what we can
927 * detect about the environment's capabilities.
928 * This has to be done after the global initialization above
929 * and before reading user-specific initialization via
930 * config file/environment variable below.
932 /* this detects the IBM-compatible console on most 386 boxes */
933 if ((opts = nh_getenv("TERM")) && !strncmp(opts, "AT", 2)) {
934 if (!symset[PRIMARY].name)
935 load_symset("IBMGraphics", PRIMARY);
936 if (!symset[ROGUESET].name)
937 load_symset("RogueIBM", ROGUESET);
938 switch_symbols(TRUE);
940 iflags.use_color = TRUE;
943 #endif /* UNIX && TTY_GRAPHICS */
944 #if defined(UNIX) || defined(VMS)
946 /* detect whether a "vt" terminal can handle alternate charsets */
947 if ((opts = nh_getenv("TERM"))
948 /* [could also check "xterm" which emulates vtXXX by default] */
949 && !strncmpi(opts, "vt", 2)
950 && AS && AE && index(AS, '\016') && index(AE, '\017')) {
951 if (!symset[PRIMARY].name)
952 load_symset("DECGraphics", PRIMARY);
953 switch_symbols(TRUE);
956 #endif /* UNIX || VMS */
958 #ifdef MAC_GRAPHICS_ENV
959 if (!symset[PRIMARY].name)
960 load_symset("MACGraphics", PRIMARY);
961 switch_symbols(TRUE);
962 #endif /* MAC_GRAPHICS_ENV */
963 flags.menu_style = MENU_FULL;
965 /* since this is done before init_objects(), do partial init here */
966 objects[SLIME_MOLD].oc_name_idx = SLIME_MOLD;
967 nmcpy(pl_fruit, OBJ_NAME(objects[SLIME_MOLD]), PL_FSIZ);
974 char *opts = getenv("NETHACKOPTIONS");
977 opts = getenv("HACKOPTIONS");
979 if (*opts == '/' || *opts == '\\' || *opts == '@') {
981 opts++; /* @filename */
982 /* looks like a filename */
983 if (strlen(opts) < BUFSZ / 2)
984 read_config_file(opts, SET_IN_FILE);
986 read_config_file((char *) 0, SET_IN_FILE);
987 /* let the total length of options be long;
988 * parseoptions() will check each individually
990 parseoptions(opts, TRUE, FALSE);
994 read_config_file((char *) 0, SET_IN_FILE);
996 (void) fruitadd(pl_fruit, (struct fruit *) 0);
998 * Remove "slime mold" from list of object names. This will
999 * prevent it from being wished unless it's actually present
1000 * as a named (or default) fruit. Wishing for "fruit" will
1001 * result in the player's preferred fruit [better than "\033"].
1003 obj_descr[SLIME_MOLD].oc_name = "fruit";
1005 if (iflags.bouldersym)
1006 update_bouldersym();
1012 nmcpy(dest, src, maxlen)
1019 for (count = 1; count < maxlen; count++) {
1020 if (*src == ',' || *src == '\0')
1021 break; /*exit on \0 terminator*/
1028 * escapes(): escape expansion for showsyms. C-style escapes understood
1029 * include \n, \b, \t, \r, \xnnn (hex), \onnn (octal), \nnn (decimal).
1030 * The ^-prefix for control characters is also understood, and \[mM]
1031 * has the effect of 'meta'-ing the value which follows (so that the
1032 * alternate character set will be enabled).
1034 * For 3.4.3 and earlier, input ending with "\M", backslash, or caret
1035 * prior to terminating '\0' would pull that '\0' into the output and then
1036 * keep processing past it, potentially overflowing the output buffer.
1037 * Now, trailing \ or ^ will act like \\ or \^ and add '\\' or '^' to the
1038 * output and stop there; trailing \M will fall through to \<other> and
1039 * yield 'M', then stop. Any \X or \O followed by something other than
1040 * an appropriate digit will also fall through to \<other> and yield 'X'
1041 * or 'O', plus stop if the non-digit is end-of-string.
1048 static NEARDATA const char oct[] = "01234567", dec[] = "0123456789",
1049 hex[] = "00112233445566778899aAbBcCdDeEfF";
1051 int cval, meta, dcount;
1054 /* \M has to be followed by something to do meta conversion,
1055 otherwise it will just be \M which ultimately yields 'M' */
1056 meta = (*cp == '\\' && (cp[1] == 'm' || cp[1] == 'M') && cp[2]);
1060 cval = dcount = 0; /* for decimal, octal, hexadecimal cases */
1061 if ((*cp != '\\' && *cp != '^') || !cp[1]) {
1062 /* simple character, or nothing left for \ or ^ to escape */
1064 } else if (*cp == '^') { /* expand control-character syntax */
1065 cval = (*++cp & 0x1f);
1067 /* remaining cases are all for backslash and we know cp[1] is not
1069 } else if (index(dec, cp[1])) {
1070 ++cp; /* move past backslash to first digit */
1072 cval = (cval * 10) + (*cp - '0');
1073 } while (*++cp && index(dec, *cp) && ++dcount < 3);
1074 } else if ((cp[1] == 'o' || cp[1] == 'O') && cp[2]
1075 && index(oct, cp[2])) {
1076 cp += 2; /* move past backslash and 'O' */
1078 cval = (cval * 8) + (*cp - '0');
1079 } while (*++cp && index(oct, *cp) && ++dcount < 3);
1080 } else if ((cp[1] == 'x' || cp[1] == 'X') && cp[2]
1081 && (dp = index(hex, cp[2])) != 0) {
1082 cp += 2; /* move past backslash and 'X' */
1084 cval = (cval * 16) + ((int) (dp - hex) / 2);
1085 } while (*++cp && (dp = index(hex, *cp)) != 0 && ++dcount < 2);
1086 } else { /* C-style character escapes */
1111 *tp++ = (char) cval;
1117 rejectoption(optname)
1118 const char *optname;
1121 pline("\"%s\" settable only from %s.", optname, lastconfigfile);
1123 pline("%s can be set only from NETHACKOPTIONS or %s.", optname,
1133 if (!strncmp(opts, "h", 1) || !strncmp(opts, "?", 1))
1136 pline("Bad syntax: %s. Enter \"?g\" for help.", opts);
1145 raw_printf("Bad syntax in OPTIONS in %s: %s%s.\n", lastconfigfile,
1153 raw_printf("Bad syntax in NETHACKOPTIONS: %s%s.\n",
1164 string_for_opt(opts, val_optional)
1166 boolean val_optional;
1168 char *colon, *equals;
1170 colon = index(opts, ':');
1171 equals = index(opts, '=');
1172 if (!colon || (equals && equals < colon))
1175 if (!colon || !*++colon) {
1184 string_for_env_opt(optname, opts, val_optional)
1185 const char *optname;
1187 boolean val_optional;
1190 rejectoption(optname);
1193 return string_for_opt(opts, val_optional);
1197 bad_negation(optname, with_parameter)
1198 const char *optname;
1199 boolean with_parameter;
1201 pline_The("%s option may not %sbe negated.", optname,
1202 with_parameter ? "both have a value and " : "");
1206 * Change the inventory order, using the given string as the new order.
1207 * Missing characters in the new order are filled in at the end from
1208 * the current inv_order, except for gold, which is forced to be first
1209 * if not explicitly present.
1211 * This routine returns 1 unless there is a duplicate or bad char in
1215 change_inv_order(op)
1219 char *sp, buf[BUFSZ];
1222 /* !!!! probably unnecessary with gold as normal inventory */
1224 for (sp = op; *sp; sp++) {
1225 oc_sym = def_char_to_objclass(*sp);
1226 /* reject bad or duplicate entries */
1227 if (oc_sym == MAXOCLASSES || oc_sym == RANDOM_CLASS
1228 || oc_sym == ILLOBJ_CLASS || !index(flags.inv_order, oc_sym)
1229 || index(sp + 1, *sp))
1231 /* retain good ones */
1232 buf[num++] = (char) oc_sym;
1236 /* fill in any omitted classes, using previous ordering */
1237 for (sp = flags.inv_order; *sp; sp++)
1238 if (!index(buf, *sp)) {
1240 buf[num] = '\0'; /* explicitly terminate for next index() */
1243 Strcpy(flags.inv_order, buf);
1248 warning_opts(opts, optype)
1249 register char *opts;
1252 uchar translate[WARNCOUNT];
1255 if (!(opts = string_for_env_opt(optype, opts, FALSE)))
1257 escapes(opts, opts);
1259 length = (int) strlen(opts);
1260 /* match the form obtained from PC configuration files */
1261 for (i = 0; i < WARNCOUNT; i++)
1262 translate[i] = (i >= length) ? 0
1263 : opts[i] ? (uchar) opts[i]
1264 : def_warnsyms[i].sym;
1265 assign_warnings(translate);
1269 assign_warnings(graph_chars)
1270 register uchar *graph_chars;
1274 for (i = 0; i < WARNCOUNT; i++)
1276 warnsyms[i] = graph_chars[i];
1280 feature_alert_opts(op, optn)
1285 boolean rejectver = FALSE;
1286 unsigned long fnv = get_feature_notice_ver(op); /* version.c */
1290 if (fnv > get_current_feature_ver())
1293 flags.suppress_alert = fnv;
1296 You_cant("disable new feature alerts for future versions.");
1299 "\n%s=%s Invalid reference to a future version ignored",
1306 Sprintf(buf, "%lu.%lu.%lu", FEATURE_NOTICE_VER_MAJ,
1307 FEATURE_NOTICE_VER_MIN, FEATURE_NOTICE_VER_PATCH);
1309 "Feature change alerts disabled for NetHack %s features and prior.",
1316 set_duplicate_opt_detection(on_or_off)
1321 if (on_or_off != 0) {
1323 if (iflags.opt_booldup)
1324 impossible("iflags.opt_booldup already on (memory leak)");
1325 iflags.opt_booldup = (int *) alloc(SIZE(boolopt) * sizeof(int));
1326 optptr = iflags.opt_booldup;
1327 for (k = 0; k < SIZE(boolopt); ++k)
1330 if (iflags.opt_compdup)
1331 impossible("iflags.opt_compdup already on (memory leak)");
1332 iflags.opt_compdup = (int *) alloc(SIZE(compopt) * sizeof(int));
1333 optptr = iflags.opt_compdup;
1334 for (k = 0; k < SIZE(compopt); ++k)
1338 if (iflags.opt_booldup)
1339 free((genericptr_t) iflags.opt_booldup);
1340 iflags.opt_booldup = (int *) 0;
1341 if (iflags.opt_compdup)
1342 free((genericptr_t) iflags.opt_compdup);
1343 iflags.opt_compdup = (int *) 0;
1348 duplicate_opt_detection(opts, iscompound)
1350 int iscompound; /* 0 == boolean option, 1 == compound */
1354 if (!iscompound && iflags.opt_booldup && initial && from_file) {
1355 for (i = 0; boolopt[i].name; i++) {
1356 if (match_optname(opts, boolopt[i].name, 3, FALSE)) {
1357 optptr = iflags.opt_booldup + i;
1365 } else if (iscompound && iflags.opt_compdup && initial && from_file) {
1366 for (i = 0; compopt[i].name; i++) {
1367 if (match_optname(opts, compopt[i].name, strlen(compopt[i].name),
1369 optptr = iflags.opt_compdup + i;
1382 complain_about_duplicate(opts, iscompound)
1384 int iscompound; /* 0 == boolean option, 1 == compound */
1387 /* the Mac has trouble dealing with the output of messages while
1388 * processing the config file. That should get fixed one day.
1389 * For now just return.
1392 raw_printf("\nWarning - %s option specified multiple times: %s.\n",
1393 iscompound ? "compound" : "boolean", opts);
1399 /* paranoia[] - used by parseoptions() and special_handling() */
1400 STATIC_VAR const struct paranoia_opts {
1401 int flagmask; /* which paranoid option */
1402 const char *argname; /* primary name */
1403 int argMinLen; /* minimum number of letters to match */
1404 const char *synonym; /* alternate name (optional) */
1406 const char *explain; /* for interactive menu */
1408 /* there are some initial-letter conflicts: "a"ttack vs "a"ll, "attack"
1409 takes precedence and "all" isn't present in the interactive menu,
1410 and "d"ie vs "d"eath, synonyms for each other so doesn't matter;
1411 (also "p"ray vs "P"aranoia, "pray" takes precedence since "Paranoia"
1412 is just a synonym for "Confirm") */
1413 { PARANOID_CONFIRM, "Confirm", 1, "Paranoia", 2,
1414 "for \"yes\" confirmations, require \"no\" to reject" },
1415 { PARANOID_QUIT, "quit", 1, "explore", 1,
1416 "yes vs y to quit or to enter explore mode" },
1417 { PARANOID_DIE, "die", 1, "death", 2,
1418 "yes vs y to die (explore mode or debug mode)" },
1419 { PARANOID_BONES, "bones", 1, 0, 0,
1420 "yes vs y to save bones data when dying in debug mode" },
1421 { PARANOID_HIT, "attack", 1, "hit", 1,
1422 "yes vs y to attack a peaceful monster" },
1423 { PARANOID_PRAY, "pray", 1, 0, 0,
1424 "y to pray (supersedes old \"prayconfirm\" option)" },
1425 { PARANOID_REMOVE, "Remove", 1, "Takeoff", 1,
1426 "always pick from inventory for Remove and Takeoff" },
1427 { PARANOID_BREAKWAND, "wand", 1, "breakwand", 2,
1428 "yes vs y to break a wand" },
1429 /* for config file parsing; interactive menu skips these */
1430 { 0, "none", 4, 0, 0, 0 }, /* require full word match */
1431 { ~0, "all", 3, 0, 0, 0 }, /* ditto */
1434 extern struct menucoloring *menu_colorings;
1436 static const struct {
1440 { "black", CLR_BLACK },
1442 { "green", CLR_GREEN },
1443 { "brown", CLR_BROWN },
1444 { "blue", CLR_BLUE },
1445 { "magenta", CLR_MAGENTA },
1446 { "cyan", CLR_CYAN },
1447 { "gray", CLR_GRAY },
1448 { "grey", CLR_GRAY },
1449 { "orange", CLR_ORANGE },
1450 { "light green", CLR_BRIGHT_GREEN },
1451 { "yellow", CLR_YELLOW },
1452 { "light blue", CLR_BRIGHT_BLUE },
1453 { "light magenta", CLR_BRIGHT_MAGENTA },
1454 { "light cyan", CLR_BRIGHT_CYAN },
1455 { "white", CLR_WHITE }
1458 static const struct {
1462 { "none", ATR_NONE },
1463 { "bold", ATR_BOLD },
1465 { "underline", ATR_ULINE },
1466 { "blink", ATR_BLINK },
1467 { "inverse", ATR_INVERSE }
1476 for (i = 0; i < SIZE(colornames); i++)
1477 if (colornames[i].color == clr)
1478 return colornames[i].name;
1488 for (i = 0; i < SIZE(attrnames); i++)
1489 if (attrnames[i].attr == attr)
1490 return attrnames[i].name;
1500 menu_item *picks = (menu_item *) 0;
1502 tmpwin = create_nhwindow(NHW_MENU);
1505 for (i = 0; i < SIZE(colornames); i++) {
1506 if (!strcmp(colornames[i].name, "grey"))
1509 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, colornames[i].name,
1512 end_menu(tmpwin, "Pick a color");
1513 pick_cnt = select_menu(tmpwin, PICK_ONE, &picks);
1514 destroy_nhwindow(tmpwin);
1516 i = colornames[picks->item.a_int - 1].color;
1517 free((genericptr_t) picks);
1530 menu_item *picks = (menu_item *) 0;
1532 tmpwin = create_nhwindow(NHW_MENU);
1535 for (i = 0; i < SIZE(attrnames); i++) {
1537 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, attrnames[i].attr,
1538 attrnames[i].name, MENU_UNSELECTED);
1540 end_menu(tmpwin, prompt ? prompt : "Pick an attribute");
1541 pick_cnt = select_menu(tmpwin, PICK_ONE, &picks);
1542 destroy_nhwindow(tmpwin);
1544 i = attrnames[picks->item.a_int - 1].attr;
1545 free((genericptr_t) picks);
1551 static const struct {
1555 } msgtype_names[] = {
1556 { "show", MSGTYP_NORMAL, "Show message normally" },
1557 { "hide", MSGTYP_NOSHOW, "Hide message" },
1558 { "noshow", MSGTYP_NOSHOW, NULL },
1559 { "stop", MSGTYP_STOP, "Prompt for more after the message" },
1560 { "more", MSGTYP_STOP, NULL },
1561 { "norep", MSGTYP_NOREP, "Do not repeat the message" }
1570 for (i = 0; i < SIZE(msgtype_names); i++)
1571 if (msgtype_names[i].descr && msgtype_names[i].msgtyp == typ)
1572 return msgtype_names[i].name;
1582 menu_item *picks = (menu_item *) 0;
1584 tmpwin = create_nhwindow(NHW_MENU);
1587 for (i = 0; i < SIZE(msgtype_names); i++)
1588 if (msgtype_names[i].descr) {
1589 any.a_int = msgtype_names[i].msgtyp + 1;
1590 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
1591 msgtype_names[i].descr, MENU_UNSELECTED);
1593 end_menu(tmpwin, "How to show the message");
1594 pick_cnt = select_menu(tmpwin, PICK_ONE, &picks);
1595 destroy_nhwindow(tmpwin);
1597 i = picks->item.a_int - 1;
1598 free((genericptr_t) picks);
1605 msgtype_add(typ, pattern)
1609 struct plinemsg_type *tmp
1610 = (struct plinemsg_type *) alloc(sizeof (struct plinemsg_type));
1615 tmp->regex = regex_init();
1616 if (!regex_compile(pattern, tmp->regex)) {
1617 static const char *re_error = "MSGTYPE regex error";
1619 if (!iflags.window_inited)
1620 raw_printf("\n%s: %s\n", re_error, regex_error_desc(tmp->regex));
1622 pline("%s: %s", re_error, regex_error_desc(tmp->regex));
1624 regex_free(tmp->regex);
1625 free((genericptr_t) tmp);
1628 tmp->pattern = dupstr(pattern);
1629 tmp->next = plinemsg_types;
1630 plinemsg_types = tmp;
1637 struct plinemsg_type *tmp, *tmp2 = 0;
1639 for (tmp = plinemsg_types; tmp; tmp = tmp2) {
1641 free((genericptr_t) tmp->pattern);
1642 regex_free(tmp->regex);
1643 free((genericptr_t) tmp);
1645 plinemsg_types = (struct plinemsg_type *) 0;
1649 free_one_msgtype(idx)
1652 struct plinemsg_type *tmp = plinemsg_types;
1653 struct plinemsg_type *prev = NULL;
1657 struct plinemsg_type *next = tmp->next;
1659 regex_free(tmp->regex);
1660 free((genericptr_t) tmp->pattern);
1661 free((genericptr_t) tmp);
1665 plinemsg_types = next;
1678 struct plinemsg_type *tmp = plinemsg_types;
1681 if (regex_match(msg, tmp->regex))
1682 return tmp->msgtype;
1685 return MSGTYP_NORMAL;
1692 struct plinemsg_type *tmp = plinemsg_types;
1702 msgtype_parse_add(str)
1708 if (sscanf(str, "%10s \"%255[^\"]\"", msgtype, pattern) == 2) {
1712 for (i = 0; i < SIZE(msgtype_names); i++)
1713 if (!strncmpi(msgtype_names[i].name, msgtype, strlen(msgtype))) {
1714 typ = msgtype_names[i].msgtyp;
1718 return msgtype_add(typ, pattern);
1724 add_menu_coloring_parsed(str, c, a)
1728 static const char re_error[] = "Menucolor regex error";
1729 struct menucoloring *tmp;
1733 tmp = (struct menucoloring *) alloc(sizeof (struct menucoloring));
1734 tmp->match = regex_init();
1735 if (!regex_compile(str, tmp->match)) {
1736 if (!iflags.window_inited)
1737 raw_printf("\n%s: %s\n", re_error, regex_error_desc(tmp->match));
1739 pline("%s: %s", re_error, regex_error_desc(tmp->match));
1741 regex_free(tmp->match);
1745 tmp->next = menu_colorings;
1746 tmp->origstr = dupstr(str);
1749 menu_colorings = tmp;
1754 /* parse '"regex_string"=color&attr' and add it to menucoloring */
1756 add_menu_coloring(str)
1759 int i, c = NO_COLOR, a = ATR_NONE;
1760 char *tmps, *cs, *amp;
1762 if (!str || (cs = index(str, '=')) == 0)
1765 tmps = cs + 1; /* advance past '=' */
1767 if ((amp = index(tmps, '&')) != 0)
1770 /* allow "lightblue", "light blue", and "light-blue" to match "light blue"
1771 (also junk like "_l i-gh_t---b l u e" but we won't worry about that);
1772 also copes with trailing space; mungspaces removed any leading space */
1773 for (i = 0; i < SIZE(colornames); i++)
1774 if (fuzzymatch(tmps, colornames[i].name, " -_", TRUE)) {
1775 c = colornames[i].color;
1778 if (i == SIZE(colornames) && (*tmps >= '0' && *tmps <= '9'))
1785 tmps = amp + 1; /* advance past '&' */
1786 /* unlike colors, none of he attribute names has any embedded spaces,
1787 but use of fuzzymatch() allows us ignore the presence of leading
1788 and/or trailing (and also embedded) spaces in the user's string;
1789 dash and underscore skipping could be omitted but does no harm */
1790 for (i = 0; i < SIZE(attrnames); i++)
1791 if (fuzzymatch(tmps, attrnames[i].name, " -_", TRUE)) {
1792 a = attrnames[i].attr;
1795 if (i == SIZE(attrnames) && (*tmps >= '0' && *tmps <= '9'))
1799 /* the regexp portion here has not been condensed by mungspaces() */
1802 if (*tmps == '"' || *tmps == '\'') {
1804 while (isspace((uchar) *cs))
1812 return add_menu_coloring_parsed(tmps, c, a);
1816 get_menu_coloring(str, color, attr)
1820 struct menucoloring *tmpmc;
1822 if (iflags.use_menu_color)
1823 for (tmpmc = menu_colorings; tmpmc; tmpmc = tmpmc->next)
1824 if (regex_match(str, tmpmc->match)) {
1825 *color = tmpmc->color;
1826 *attr = tmpmc->attr;
1833 free_menu_coloring()
1835 struct menucoloring *tmp = menu_colorings;
1838 struct menucoloring *tmp2 = tmp->next;
1840 regex_free(tmp->match);
1841 free((genericptr_t) tmp->origstr);
1842 free((genericptr_t) tmp);
1848 free_one_menu_coloring(idx)
1851 struct menucoloring *tmp = menu_colorings;
1852 struct menucoloring *prev = NULL;
1856 struct menucoloring *next = tmp->next;
1858 regex_free(tmp->match);
1859 free((genericptr_t) tmp->origstr);
1860 free((genericptr_t) tmp);
1864 menu_colorings = next;
1877 struct menucoloring *tmp = menu_colorings;
1887 parseoptions(opts, tinitial, tfrom_file)
1888 register char *opts;
1889 boolean tinitial, tfrom_file;
1893 boolean negated, val_negated, duplicate;
1895 const char *fullname;
1898 from_file = tfrom_file;
1899 if ((op = index(opts, ',')) != 0) {
1901 parseoptions(op, initial, from_file);
1903 if (strlen(opts) > BUFSZ / 2) {
1904 badoption("option too long");
1908 /* strip leading and trailing white space */
1909 while (isspace((uchar) *opts))
1912 while (--op >= opts && isspace((uchar) *op))
1918 while ((*opts == '!') || !strncmpi(opts, "no", 2)) {
1926 /* variant spelling */
1928 if (match_optname(opts, "colour", 5, FALSE))
1929 Strcpy(opts, "color"); /* fortunately this isn't longer */
1931 /* special boolean options */
1933 if (match_optname(opts, "female", 3, FALSE)) {
1934 if (duplicate_opt_detection(opts, 0))
1935 complain_about_duplicate(opts, 0);
1936 if (!initial && flags.female == negated)
1937 pline("That is not anatomically possible.");
1939 flags.initgend = flags.female = !negated;
1943 if (match_optname(opts, "male", 4, FALSE)) {
1944 if (duplicate_opt_detection(opts, 0))
1945 complain_about_duplicate(opts, 0);
1946 if (!initial && flags.female != negated)
1947 pline("That is not anatomically possible.");
1949 flags.initgend = flags.female = negated;
1953 #if defined(MICRO) && !defined(AMIGA)
1954 /* included for compatibility with old NetHack.cnf files */
1955 if (match_optname(opts, "IBM_", 4, FALSE)) {
1956 iflags.BIOS = !negated;
1961 /* compound options */
1963 /* This first batch can be duplicated if their values are negated */
1967 if (match_optname(opts, fullname, sizeof("align") - 1, TRUE)) {
1969 bad_negation(fullname, FALSE);
1970 } else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
1971 val_negated = FALSE;
1972 while ((*op == '!') || !strncmpi(op, "no", 2)) {
1977 val_negated = !val_negated;
1980 if (!setrolefilter(op))
1983 if (duplicate_opt_detection(opts, 1))
1984 complain_about_duplicate(opts, 1);
1985 if ((flags.initalign = str2align(op)) == ROLE_NONE)
1992 /* role:string or character:string */
1994 if (match_optname(opts, fullname, 4, TRUE)
1995 || match_optname(opts, (fullname = "character"), 4, TRUE)) {
1997 bad_negation(fullname, FALSE);
1998 } else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
1999 val_negated = FALSE;
2000 while ((*op == '!') || !strncmpi(op, "no", 2)) {
2005 val_negated = !val_negated;
2008 if (!setrolefilter(op))
2011 if (duplicate_opt_detection(opts, 1))
2012 complain_about_duplicate(opts, 1);
2013 if ((flags.initrole = str2role(op)) == ROLE_NONE)
2015 else /* Backwards compatibility */
2016 nmcpy(pl_character, op, PL_NSIZ);
2024 if (match_optname(opts, fullname, 4, TRUE)) {
2026 bad_negation(fullname, FALSE);
2027 } else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
2028 val_negated = FALSE;
2029 while ((*op == '!') || !strncmpi(op, "no", 2)) {
2034 val_negated = !val_negated;
2037 if (!setrolefilter(op))
2040 if (duplicate_opt_detection(opts, 1))
2041 complain_about_duplicate(opts, 1);
2042 if ((flags.initrace = str2race(op)) == ROLE_NONE)
2044 else /* Backwards compatibility */
2052 fullname = "gender";
2053 if (match_optname(opts, fullname, 4, TRUE)) {
2055 bad_negation(fullname, FALSE);
2056 } else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
2057 val_negated = FALSE;
2058 while ((*op == '!') || !strncmpi(op, "no", 2)) {
2063 val_negated = !val_negated;
2066 if (!setrolefilter(op))
2069 if (duplicate_opt_detection(opts, 1))
2070 complain_about_duplicate(opts, 1);
2071 if ((flags.initgend = str2gend(op)) == ROLE_NONE)
2074 flags.female = flags.initgend;
2080 /* We always check for duplicates on the remaining compound options,
2081 although individual option processing can choose to complain or not */
2084 duplicate_opt_detection(opts, 1); /* 1 means check compounds */
2086 fullname = "pettype";
2087 if (match_optname(opts, fullname, 3, TRUE)) {
2089 complain_about_duplicate(opts, 1);
2090 if ((op = string_for_env_opt(fullname, opts, negated)) != 0) {
2092 bad_negation(fullname, TRUE);
2094 switch (lowc(*op)) {
2096 preferred_pet = 'd';
2099 case 'f': /* feline */
2100 preferred_pet = 'c';
2102 case 'h': /* horse */
2103 case 'q': /* quadruped */
2104 /* avoids giving "unrecognized type of pet" but
2105 pet_type(dog.c) won't actually honor this */
2106 preferred_pet = 'h';
2108 case 'n': /* no pet */
2109 preferred_pet = 'n';
2111 case '*': /* random */
2112 preferred_pet = '\0';
2116 pline("Unrecognized pet type '%s'.", op);
2118 pline("'%s'
\82Í
\83y
\83b
\83g
\82Ì
\8eí
\97Þ
\82Æ
\82µ
\82Ä
\8eó
\82¯
\95t
\82¯
\82ç
\82ê
\82Ü
\82¹
\82ñ
\81D", op);
2123 preferred_pet = 'n';
2127 fullname = "catname";
2128 if (match_optname(opts, fullname, 3, TRUE)) {
2130 complain_about_duplicate(opts, 1);
2132 bad_negation(fullname, FALSE);
2133 else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0)
2134 nmcpy(catname, op, PL_PSIZ);
2135 sanitize_name(catname);
2139 fullname = "dogname";
2140 if (match_optname(opts, fullname, 3, TRUE)) {
2142 complain_about_duplicate(opts, 1);
2144 bad_negation(fullname, FALSE);
2145 else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0)
2146 nmcpy(dogname, op, PL_PSIZ);
2147 sanitize_name(dogname);
2151 fullname = "horsename";
2152 if (match_optname(opts, fullname, 5, TRUE)) {
2154 complain_about_duplicate(opts, 1);
2156 bad_negation(fullname, FALSE);
2157 else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0)
2158 nmcpy(horsename, op, PL_PSIZ);
2159 sanitize_name(horsename);
2163 fullname = "number_pad";
2164 if (match_optname(opts, fullname, 10, TRUE)) {
2165 boolean compat = (strlen(opts) <= 10);
2168 complain_about_duplicate(opts, 1);
2169 op = string_for_opt(opts, (compat || !initial));
2171 if (compat || negated || initial) {
2172 /* for backwards compatibility, "number_pad" without a
2173 value is a synonym for number_pad:1 */
2174 iflags.num_pad = !negated;
2175 iflags.num_pad_mode = 0;
2177 } else if (negated) {
2178 bad_negation("number_pad", TRUE);
2181 int mode = atoi(op);
2183 if (mode < -1 || mode > 4 || (mode == 0 && *op != '0')) {
2186 } else if (mode <= 0) {
2187 iflags.num_pad = FALSE;
2188 /* German keyboard; y and z keys swapped */
2189 iflags.num_pad_mode = (mode < 0); /* 0 or 1 */
2190 } else { /* mode > 0 */
2191 iflags.num_pad = TRUE;
2192 iflags.num_pad_mode = 0;
2193 /* PC Hack / MSDOS compatibility */
2194 if (mode == 2 || mode == 4)
2195 iflags.num_pad_mode |= 1;
2196 /* phone keypad layout */
2197 if (mode == 3 || mode == 4)
2198 iflags.num_pad_mode |= 2;
2201 reset_commands(FALSE);
2202 number_pad(iflags.num_pad ? 1 : 0);
2206 fullname = "roguesymset";
2207 if (match_optname(opts, fullname, 7, TRUE)) {
2209 complain_about_duplicate(opts, 1);
2211 bad_negation(fullname, FALSE);
2212 } else if ((op = string_for_opt(opts, FALSE)) != 0) {
2213 symset[ROGUESET].name = dupstr(op);
2214 if (!read_sym_file(ROGUESET)) {
2215 clear_symsetentry(ROGUESET, TRUE);
2216 raw_printf("Unable to load symbol set \"%s\" from \"%s\".",
2220 if (!initial && Is_rogue_level(&u.uz))
2221 assign_graphics(ROGUESET);
2228 fullname = "symset";
2229 if (match_optname(opts, fullname, 6, TRUE)) {
2231 complain_about_duplicate(opts, 1);
2233 bad_negation(fullname, FALSE);
2234 } else if ((op = string_for_opt(opts, FALSE)) != 0) {
2235 symset[PRIMARY].name = dupstr(op);
2236 if (!read_sym_file(PRIMARY)) {
2237 clear_symsetentry(PRIMARY, TRUE);
2238 raw_printf("Unable to load symbol set \"%s\" from \"%s\".",
2242 switch_symbols(TRUE);
2249 fullname = "runmode";
2250 if (match_optname(opts, fullname, 4, TRUE)) {
2252 complain_about_duplicate(opts, 1);
2254 flags.runmode = RUN_TPORT;
2255 } else if ((op = string_for_opt(opts, FALSE)) != 0) {
2256 if (!strncmpi(op, "teleport", strlen(op)))
2257 flags.runmode = RUN_TPORT;
2258 else if (!strncmpi(op, "run", strlen(op)))
2259 flags.runmode = RUN_LEAP;
2260 else if (!strncmpi(op, "walk", strlen(op)))
2261 flags.runmode = RUN_STEP;
2262 else if (!strncmpi(op, "crawl", strlen(op)))
2263 flags.runmode = RUN_CRAWL;
2270 /* menucolor:"regex_string"=color */
2271 fullname = "menucolor";
2272 if (match_optname(opts, fullname, 9, TRUE)) {
2274 bad_negation(fullname, FALSE);
2275 else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0)
2276 if (!add_menu_coloring(op))
2281 fullname = "msghistory";
2282 if (match_optname(opts, fullname, 3, TRUE)) {
2284 complain_about_duplicate(opts, 1);
2285 op = string_for_env_opt(fullname, opts, negated);
2286 if ((negated && !op) || (!negated && op)) {
2287 iflags.msg_history = negated ? 0 : atoi(op);
2289 bad_negation(fullname, TRUE);
2293 fullname = "msg_window";
2294 /* msg_window:single, combo, full or reversed */
2295 if (match_optname(opts, fullname, 4, TRUE)) {
2296 /* allow option to be silently ignored by non-tty ports */
2301 complain_about_duplicate(opts, 1);
2302 if (!(op = string_for_opt(opts, TRUE))) {
2303 tmp = negated ? 's' : 'f';
2306 bad_negation(fullname, TRUE);
2312 case 's': /* single message history cycle (default if negated) */
2313 iflags.prevmsg_window = 's';
2315 case 'c': /* combination: two singles, then full page reversed */
2316 iflags.prevmsg_window = 'c';
2318 case 'f': /* full page (default if no opts) */
2319 iflags.prevmsg_window = 'f';
2321 case 'r': /* full page (reversed) */
2322 iflags.prevmsg_window = 'r';
2332 * setting font options */
2334 if (!strncmpi(opts, fullname, 4)) {
2336 char *fontopts = opts + 4;
2338 if (!strncmpi(fontopts, "map", 3) || !strncmpi(fontopts, "_map", 4))
2339 opttype = MAP_OPTION;
2340 else if (!strncmpi(fontopts, "message", 7)
2341 || !strncmpi(fontopts, "_message", 8))
2342 opttype = MESSAGE_OPTION;
2343 else if (!strncmpi(fontopts, "text", 4)
2344 || !strncmpi(fontopts, "_text", 5))
2345 opttype = TEXT_OPTION;
2346 else if (!strncmpi(fontopts, "menu", 4)
2347 || !strncmpi(fontopts, "_menu", 5))
2348 opttype = MENU_OPTION;
2349 else if (!strncmpi(fontopts, "status", 6)
2350 || !strncmpi(fontopts, "_status", 7))
2351 opttype = STATUS_OPTION;
2352 else if (!strncmpi(fontopts, "_size", 5)) {
2353 if (!strncmpi(fontopts, "_size_map", 8))
2354 opttype = MAP_OPTION;
2355 else if (!strncmpi(fontopts, "_size_message", 12))
2356 opttype = MESSAGE_OPTION;
2357 else if (!strncmpi(fontopts, "_size_text", 9))
2358 opttype = TEXT_OPTION;
2359 else if (!strncmpi(fontopts, "_size_menu", 9))
2360 opttype = MENU_OPTION;
2361 else if (!strncmpi(fontopts, "_size_status", 11))
2362 opttype = STATUS_OPTION;
2368 complain_about_duplicate(opts, 1);
2369 if (opttype > 0 && !negated
2370 && (op = string_for_opt(opts, FALSE)) != 0) {
2373 iflags.wc_fontsiz_map = atoi(op);
2375 case MESSAGE_OPTION:
2376 iflags.wc_fontsiz_message = atoi(op);
2379 iflags.wc_fontsiz_text = atoi(op);
2382 iflags.wc_fontsiz_menu = atoi(op);
2385 iflags.wc_fontsiz_status = atoi(op);
2393 if (opttype > 0 && (op = string_for_opt(opts, FALSE)) != 0) {
2394 wc_set_font_name(opttype, op);
2396 set_font_name(opttype, op);
2400 bad_negation(fullname, TRUE);
2404 if (match_optname(opts, "palette", 3, TRUE)
2406 || match_optname(opts, "hicolor", 3, TRUE)
2409 int color_number, color_incr;
2413 complain_about_duplicate(opts, 1);
2416 if (match_optname(opts, "hicolor", 3, TRUE)) {
2418 bad_negation("hicolor", FALSE);
2421 color_number = CLR_MAX + 4; /* HARDCODED inverse number */
2426 bad_negation("palette", FALSE);
2435 op = string_for_opt(opts, TRUE);
2436 if (!alternative_palette(op))
2439 if ((op = string_for_opt(opts, FALSE)) != (char *) 0) {
2441 int cnt, tmp, reverse;
2444 while (*pt && color_number >= 0) {
2454 if (*pt && *pt != '/') {
2462 tmp = (tmp + 9) & 0xf; /* Assumes ASCII... */
2464 tmp &= 0xf; /* Digits in ASCII too... */
2467 /* Add an extra so we fill f -> ff and 0 -> 00 */
2476 change_color(color_number, rgb, reverse);
2477 color_number += color_incr;
2486 #endif /* CHANGE_COLOR */
2488 if (match_optname(opts, "fruit", 2, TRUE)) {
2489 struct fruit *forig = 0;
2490 char empty_str = '\0';
2493 complain_about_duplicate(opts, 1);
2494 op = string_for_opt(opts, negated);
2497 bad_negation("fruit", TRUE);
2509 for (f = ffruit; f; f = f->nextf) {
2510 if (!strcmp(op, f->fname))
2514 if (!flags.made_fruit) {
2515 for (forig = ffruit; forig; forig = forig->nextf) {
2516 if (!strcmp(pl_fruit, forig->fname)) {
2521 if (!forig && num >= 100) {
2523 pline("Doing that so many times isn't very fruitful.");
2525 pline("
\82»
\82ñ
\82È
\82É
\89½
\89ñ
\82à
\82â
\82Á
\82Ä
\82à
\82Ù
\82Æ
\82ñ
\82Ç
\88Ó
\96¡
\82Í
\82È
\82¢
\81D");
2530 nmcpy(pl_fruit, op, PL_FSIZ);
2531 sanitize_name(pl_fruit);
2532 /* OBJ_NAME(objects[SLIME_MOLD]) won't work after initialization */
2534 nmcpy(pl_fruit, "slime mold", PL_FSIZ);
2536 (void) fruitadd(pl_fruit, forig);
2537 pline("Fruit is now \"%s\".", pl_fruit);
2539 /* If initial, then initoptions is allowed to do it instead
2540 * of here (initoptions always has to do it even if there's
2541 * no fruit option at all. Also, we don't want people
2542 * setting multiple fruits in their options.)
2547 fullname = "warnings";
2548 if (match_optname(opts, fullname, 5, TRUE)) {
2550 complain_about_duplicate(opts, 1);
2552 bad_negation(fullname, FALSE);
2554 warning_opts(opts, fullname);
2558 #ifdef BACKWARD_COMPAT
2559 /* boulder:symbol */
2560 fullname = "boulder";
2561 if (match_optname(opts, fullname, 7, TRUE)) {
2564 complain_about_duplicate(opts, 1);
2566 bad_negation(fullname, FALSE);
2569 /* if (!(opts = string_for_env_opt(fullname, opts, FALSE)))
2571 if (!(opts = string_for_opt(opts, FALSE)))
2573 escapes(opts, opts);
2574 if (def_char_to_monclass(opts[0]) != MAXMCLASSES)
2576 else if (opts[0] >= '1' && opts[0] <= '5')
2579 /* symbol chosen matches a used monster or warning
2580 symbol which is not good - reject it*/
2582 "Badoption - boulder symbol '%c' conflicts with a %s symbol.",
2583 opts[0], (clash == 1) ? "monster" : "warning");
2586 * Override the default boulder symbol.
2588 iflags.bouldersym = (uchar) opts[0];
2598 if (match_optname(opts, fullname, 4, TRUE)) {
2600 complain_about_duplicate(opts, 1);
2602 bad_negation(fullname, FALSE);
2603 else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0)
2604 nmcpy(plname, op, PL_NSIZ);
2608 /* altkeyhandler:string */
2609 fullname = "altkeyhandler";
2610 if (match_optname(opts, fullname, 4, TRUE)) {
2612 complain_about_duplicate(opts, 1);
2614 bad_negation(fullname, FALSE);
2615 } else if ((op = string_for_opt(opts, negated)) != 0) {
2617 (void) strncpy(iflags.altkeyhandler, op, MAX_ALTKEYHANDLER - 5);
2618 load_keyboard_handler();
2625 * align_status:[left|top|right|bottom] */
2626 fullname = "align_status";
2627 if (match_optname(opts, fullname, sizeof("align_status") - 1, TRUE)) {
2628 op = string_for_opt(opts, negated);
2629 if (op && !negated) {
2630 if (!strncmpi(op, "left", sizeof("left") - 1))
2631 iflags.wc_align_status = ALIGN_LEFT;
2632 else if (!strncmpi(op, "top", sizeof("top") - 1))
2633 iflags.wc_align_status = ALIGN_TOP;
2634 else if (!strncmpi(op, "right", sizeof("right") - 1))
2635 iflags.wc_align_status = ALIGN_RIGHT;
2636 else if (!strncmpi(op, "bottom", sizeof("bottom") - 1))
2637 iflags.wc_align_status = ALIGN_BOTTOM;
2641 bad_negation(fullname, TRUE);
2645 * align_message:[left|top|right|bottom] */
2646 fullname = "align_message";
2647 if (match_optname(opts, fullname, sizeof("align_message") - 1, TRUE)) {
2649 complain_about_duplicate(opts, 1);
2650 op = string_for_opt(opts, negated);
2651 if (op && !negated) {
2652 if (!strncmpi(op, "left", sizeof("left") - 1))
2653 iflags.wc_align_message = ALIGN_LEFT;
2654 else if (!strncmpi(op, "top", sizeof("top") - 1))
2655 iflags.wc_align_message = ALIGN_TOP;
2656 else if (!strncmpi(op, "right", sizeof("right") - 1))
2657 iflags.wc_align_message = ALIGN_RIGHT;
2658 else if (!strncmpi(op, "bottom", sizeof("bottom") - 1))
2659 iflags.wc_align_message = ALIGN_BOTTOM;
2663 bad_negation(fullname, TRUE);
2666 /* the order to list the pack */
2667 fullname = "packorder";
2668 if (match_optname(opts, fullname, 4, TRUE)) {
2670 complain_about_duplicate(opts, 1);
2672 bad_negation(fullname, FALSE);
2674 } else if (!(op = string_for_opt(opts, FALSE)))
2677 if (!change_inv_order(op))
2682 /* user can change required response for some prompts (quit, die, hit),
2683 or add an extra prompt (pray, Remove) that isn't ordinarily there */
2684 fullname = "paranoid_confirmation";
2685 if (match_optname(opts, fullname, 8, TRUE)) {
2686 /* at present we don't complain about duplicates for this
2687 option, but we do throw away the old settings whenever
2688 we process a new one [clearing old flags is essential
2689 for handling default paranoid_confirm:pray sanely] */
2690 flags.paranoia_bits = 0; /* clear all */
2692 flags.paranoia_bits = 0; /* [now redundant...] */
2693 } else if ((op = string_for_opt(opts, TRUE)) != 0) {
2694 char *pp, buf[BUFSZ];
2696 op = mungspaces(strcpy(buf, op));
2698 /* We're looking to parse
2699 "paranoid_confirm:whichone wheretwo whothree"
2700 and "paranoid_confirm:" prefix has already
2701 been stripped off by the time we get here */
2702 pp = index(op, ' ');
2705 /* we aren't matching option names but match_optname
2706 does what we want once we've broken the space
2707 delimited aggregate into separate tokens */
2708 for (i = 0; i < SIZE(paranoia); ++i) {
2709 if (match_optname(op, paranoia[i].argname,
2710 paranoia[i].argMinLen, FALSE)
2711 || (paranoia[i].synonym
2712 && match_optname(op, paranoia[i].synonym,
2713 paranoia[i].synMinLen, FALSE))) {
2714 if (paranoia[i].flagmask)
2715 flags.paranoia_bits |= paranoia[i].flagmask;
2716 else /* 0 == "none", so clear all */
2717 flags.paranoia_bits = 0;
2721 if (i == SIZE(paranoia)) {
2722 /* didn't match anything, so arg is bad;
2723 any flags already set will stay set */
2727 /* move on to next token */
2731 break; /* no next token */
2737 /* accept deprecated boolean; superseded by paranoid_confirm:pray */
2738 fullname = "prayconfirm";
2739 if (match_optname(opts, fullname, 4, FALSE)) {
2741 flags.paranoia_bits &= ~PARANOID_PRAY;
2743 flags.paranoia_bits |= PARANOID_PRAY;
2747 /* maximum burden picked up before prompt (Warren Cheung) */
2748 fullname = "pickup_burden";
2749 if (match_optname(opts, fullname, 8, TRUE)) {
2751 complain_about_duplicate(opts, 1);
2753 bad_negation(fullname, FALSE);
2755 } else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
2756 switch (tolower(*op)) {
2759 flags.pickup_burden = UNENCUMBERED;
2761 /* Burdened (slight encumbrance) */
2763 flags.pickup_burden = SLT_ENCUMBER;
2765 /* streSsed (moderate encumbrance) */
2767 flags.pickup_burden = MOD_ENCUMBER;
2769 /* straiNed (heavy encumbrance) */
2771 flags.pickup_burden = HVY_ENCUMBER;
2773 /* OverTaxed (extreme encumbrance) */
2776 flags.pickup_burden = EXT_ENCUMBER;
2780 flags.pickup_burden = OVERLOADED;
2789 /* types of objects to pick up automatically */
2790 if (match_optname(opts, "pickup_types", 8, TRUE)) {
2791 char ocl[MAXOCLASSES + 1], tbuf[MAXOCLASSES + 1], qbuf[QBUFSZ],
2794 boolean badopt = FALSE, compat = (strlen(opts) <= 6), use_menu;
2797 complain_about_duplicate(opts, 1);
2798 oc_to_str(flags.pickup_types, tbuf);
2799 flags.pickup_types[0] = '\0'; /* all */
2800 op = string_for_opt(opts, (compat || !initial));
2802 if (compat || negated || initial) {
2803 /* for backwards compatibility, "pickup" without a
2804 value is a synonym for autopickup of all types
2805 (and during initialization, we can't prompt yet) */
2806 flags.pickup = !negated;
2809 oc_to_str(flags.inv_order, ocl);
2811 if (flags.menu_style == MENU_TRADITIONAL
2812 || flags.menu_style == MENU_COMBINATION) {
2815 Sprintf(qbuf, "New pickup_types: [%s am] (%s)", ocl,
2816 *tbuf ? tbuf : "all");
2818 Sprintf(qbuf, "
\90V
\82µ
\82¢pickup_type
\82ð
\93ü
\97Í
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81F[%s am] (%s)", ocl,
2819 *tbuf ? tbuf : "all");
2822 op = mungspaces(abuf);
2823 if (abuf[0] == '\0' || abuf[0] == '\033')
2824 op = tbuf; /* restore */
2825 else if (abuf[0] == 'm')
2830 (void) choose_classes_menu("Auto-Pickup what?", 1, TRUE, ocl,
2833 (void) choose_classes_menu("
\82Ç
\82ê
\82ð
\8e©
\93®
\8fE
\82¢
\82É
\90Ý
\92è
\82·
\82é
\81H", 1, TRUE, ocl,
2840 bad_negation("pickup_types", TRUE);
2845 if (*op != 'a' && *op != 'A') {
2848 oc_sym = def_char_to_objclass(*op);
2849 /* make sure all are valid obj symbols occurring once */
2850 if (oc_sym != MAXOCLASSES
2851 && !index(flags.pickup_types, oc_sym)) {
2852 flags.pickup_types[num] = (char) oc_sym;
2853 flags.pickup_types[++num] = '\0';
2864 /* pile limit: when walking over objects, number which triggers
2865 "there are several/many objects here" instead of listing them */
2866 fullname = "pile_limit";
2867 if (match_optname(opts, fullname, 4, TRUE)) {
2869 complain_about_duplicate(opts, 1);
2870 op = string_for_opt(opts, negated);
2871 if ((negated && !op) || (!negated && op))
2872 flags.pile_limit = negated ? 0 : atoi(op);
2874 bad_negation(fullname, TRUE);
2876 flags.pile_limit = PILE_LIMIT_DFLT;
2878 if (flags.pile_limit < 0)
2879 flags.pile_limit = PILE_LIMIT_DFLT;
2883 /* play mode: normal, explore/discovery, or debug/wizard */
2884 fullname = "playmode";
2885 if (match_optname(opts, fullname, 4, TRUE)) {
2887 complain_about_duplicate(opts, 1);
2889 bad_negation(fullname, FALSE);
2890 if (duplicate || negated)
2892 op = string_for_opt(opts, TRUE);
2893 if (!strncmpi(op, "normal", 6) || !strcmpi(op, "play")) {
2894 wizard = discover = FALSE;
2895 } else if (!strncmpi(op, "explore", 6)
2896 || !strncmpi(op, "discovery", 6)) {
2897 wizard = FALSE, discover = TRUE;
2898 } else if (!strncmpi(op, "debug", 5) || !strncmpi(op, "wizard", 6)) {
2899 wizard = TRUE, discover = FALSE;
2901 raw_printf("Invalid value for \"%s\":%s.", fullname, op);
2907 * player_selection: dialog | prompts */
2908 fullname = "player_selection";
2909 if (match_optname(opts, fullname, sizeof("player_selection") - 1, TRUE)) {
2911 complain_about_duplicate(opts, 1);
2912 op = string_for_opt(opts, negated);
2913 if (op && !negated) {
2914 if (!strncmpi(op, "dialog", sizeof("dialog") - 1))
2915 iflags.wc_player_selection = VIA_DIALOG;
2916 else if (!strncmpi(op, "prompt", sizeof("prompt") - 1))
2917 iflags.wc_player_selection = VIA_PROMPTS;
2921 bad_negation(fullname, TRUE);
2925 /* things to disclose at end of game */
2926 if (match_optname(opts, "disclose", 7, TRUE)) {
2928 * The order that the end_disclose options are stored:
2929 * inventory, attribs, vanquished, genocided,
2930 * conduct, overview.
2931 * There is an array in flags:
2932 * end_disclose[NUM_DISCLOSURE_OPT];
2933 * with option settings for the each of the following:
2934 * iagvc [see disclosure_options in decl.c]:
2935 * Legal setting values in that array are:
2936 * DISCLOSE_PROMPT_DEFAULT_YES ask with default answer yes
2937 * DISCLOSE_PROMPT_DEFAULT_NO ask with default answer no
2938 * DISCLOSE_YES_WITHOUT_PROMPT always disclose and don't ask
2939 * DISCLOSE_NO_WITHOUT_PROMPT never disclose and don't ask
2941 * Those setting values can be used in the option
2942 * string as a prefix to get the desired behaviour.
2944 * For backward compatibility, no prefix is required,
2945 * and the presence of a i,a,g,v, or c without a prefix
2946 * sets the corresponding value to DISCLOSE_YES_WITHOUT_PROMPT.
2948 boolean badopt = FALSE;
2949 int idx, prefix_val;
2952 complain_about_duplicate(opts, 1);
2953 op = string_for_opt(opts, TRUE);
2954 if (op && negated) {
2955 bad_negation("disclose", TRUE);
2958 /* "disclose" without a value means "all with prompting"
2959 and negated means "none without prompting" */
2960 if (!op || !strcmpi(op, "all") || !strcmpi(op, "none")) {
2961 if (op && !strcmpi(op, "none"))
2963 for (num = 0; num < NUM_DISCLOSURE_OPTIONS; num++)
2964 flags.end_disclose[num] = negated
2965 ? DISCLOSE_NO_WITHOUT_PROMPT
2966 : DISCLOSE_PROMPT_DEFAULT_YES;
2972 while (*op && num < sizeof flags.end_disclose - 1) {
2973 static char valid_settings[] = {
2974 DISCLOSE_PROMPT_DEFAULT_YES, DISCLOSE_PROMPT_DEFAULT_NO,
2975 DISCLOSE_YES_WITHOUT_PROMPT, DISCLOSE_NO_WITHOUT_PROMPT, '\0'
2977 register char c, *dop;
2981 c = 'v'; /* killed -> vanquished */
2983 c = 'o'; /* dungeon -> overview */
2984 dop = index(disclosure_options, c);
2986 idx = (int) (dop - disclosure_options);
2987 if (idx < 0 || idx > NUM_DISCLOSURE_OPTIONS - 1) {
2988 impossible("bad disclosure index %d %c", idx, c);
2991 if (prefix_val != -1) {
2992 flags.end_disclose[idx] = prefix_val;
2995 flags.end_disclose[idx] = DISCLOSE_YES_WITHOUT_PROMPT;
2996 } else if (index(valid_settings, c)) {
2998 } else if (c == ' ') {
3009 if (!strncmpi(opts, "kcode", 3)){
3010 if ((op = string_for_env_opt("kcode", opts, FALSE)) != 0){
3017 /* scores:5t[op] 5a[round] o[wn] */
3018 if (match_optname(opts, "scores", 4, TRUE)) {
3020 complain_about_duplicate(opts, 1);
3022 bad_negation("scores", FALSE);
3025 if (!(op = string_for_opt(opts, FALSE)))
3035 } else if (*op == '!') {
3045 flags.end_top = inum;
3049 flags.end_around = inum;
3053 flags.end_own = !negated;
3059 while (letter(*++op) || *op == ' ')
3067 fullname = "sortloot";
3068 if (match_optname(opts, fullname, 4, TRUE)) {
3069 op = string_for_env_opt(fullname, opts, FALSE);
3071 switch (tolower(*op)) {
3075 flags.sortloot = tolower(*op);
3085 fullname = "suppress_alert";
3086 if (match_optname(opts, fullname, 4, TRUE)) {
3088 complain_about_duplicate(opts, 1);
3089 op = string_for_opt(opts, negated);
3091 bad_negation(fullname, FALSE);
3093 (void) feature_alert_opts(op, fullname);
3098 /* videocolors:string */
3099 fullname = "videocolors";
3100 if (match_optname(opts, fullname, 6, TRUE)
3101 || match_optname(opts, "videocolours", 10, TRUE)) {
3103 complain_about_duplicate(opts, 1);
3105 bad_negation(fullname, FALSE);
3107 } else if (!(opts = string_for_env_opt(fullname, opts, FALSE))) {
3110 if (!assign_videocolors(opts))
3114 /* videoshades:string */
3115 fullname = "videoshades";
3116 if (match_optname(opts, fullname, 6, TRUE)) {
3118 complain_about_duplicate(opts, 1);
3120 bad_negation(fullname, FALSE);
3122 } else if (!(opts = string_for_env_opt(fullname, opts, FALSE))) {
3125 if (!assign_videoshades(opts))
3129 #endif /* VIDEOSHADES */
3132 /* video:string -- must be after longer tests */
3134 if (match_optname(opts, fullname, 5, TRUE)) {
3136 complain_about_duplicate(opts, 1);
3138 bad_negation(fullname, FALSE);
3140 } else if (!(opts = string_for_env_opt(fullname, opts, FALSE))) {
3143 if (!assign_video(opts))
3147 #endif /* NO_TERMS */
3148 /* soundcard:string -- careful not to match boolean 'sound' */
3149 fullname = "soundcard";
3150 if (match_optname(opts, fullname, 6, TRUE)) {
3152 complain_about_duplicate(opts, 1);
3154 bad_negation(fullname, FALSE);
3156 } else if (!(opts = string_for_env_opt(fullname, opts, FALSE))) {
3159 if (!assign_soundcard(opts))
3167 * map_mode:[tiles|ascii4x6|ascii6x8|ascii8x8|ascii16x8|ascii7x12|
3168 * ascii8x12|ascii16x12|ascii12x16|ascii10x18|fit_to_screen]
3170 fullname = "map_mode";
3171 if (match_optname(opts, fullname, sizeof("map_mode") - 1, TRUE)) {
3173 complain_about_duplicate(opts, 1);
3174 op = string_for_opt(opts, negated);
3175 if (op && !negated) {
3176 if (!strncmpi(op, "tiles", sizeof("tiles") - 1))
3177 iflags.wc_map_mode = MAP_MODE_TILES;
3178 else if (!strncmpi(op, "ascii4x6", sizeof("ascii4x6") - 1))
3179 iflags.wc_map_mode = MAP_MODE_ASCII4x6;
3180 else if (!strncmpi(op, "ascii6x8", sizeof("ascii6x8") - 1))
3181 iflags.wc_map_mode = MAP_MODE_ASCII6x8;
3182 else if (!strncmpi(op, "ascii8x8", sizeof("ascii8x8") - 1))
3183 iflags.wc_map_mode = MAP_MODE_ASCII8x8;
3184 else if (!strncmpi(op, "ascii16x8", sizeof("ascii16x8") - 1))
3185 iflags.wc_map_mode = MAP_MODE_ASCII16x8;
3186 else if (!strncmpi(op, "ascii7x12", sizeof("ascii7x12") - 1))
3187 iflags.wc_map_mode = MAP_MODE_ASCII7x12;
3188 else if (!strncmpi(op, "ascii8x12", sizeof("ascii8x12") - 1))
3189 iflags.wc_map_mode = MAP_MODE_ASCII8x12;
3190 else if (!strncmpi(op, "ascii16x12", sizeof("ascii16x12") - 1))
3191 iflags.wc_map_mode = MAP_MODE_ASCII16x12;
3192 else if (!strncmpi(op, "ascii12x16", sizeof("ascii12x16") - 1))
3193 iflags.wc_map_mode = MAP_MODE_ASCII12x16;
3194 else if (!strncmpi(op, "ascii10x18", sizeof("ascii10x18") - 1))
3195 iflags.wc_map_mode = MAP_MODE_ASCII10x18;
3196 else if (!strncmpi(op, "fit_to_screen",
3197 sizeof("fit_to_screen") - 1))
3198 iflags.wc_map_mode = MAP_MODE_ASCII_FIT_TO_SCREEN;
3202 bad_negation(fullname, TRUE);
3206 * scroll_amount:nn */
3207 fullname = "scroll_amount";
3208 if (match_optname(opts, fullname, sizeof("scroll_amount") - 1, TRUE)) {
3210 complain_about_duplicate(opts, 1);
3211 op = string_for_opt(opts, negated);
3212 if ((negated && !op) || (!negated && op)) {
3213 iflags.wc_scroll_amount = negated ? 1 : atoi(op);
3215 bad_negation(fullname, TRUE);
3219 * scroll_margin:nn */
3220 fullname = "scroll_margin";
3221 if (match_optname(opts, fullname, sizeof("scroll_margin") - 1, TRUE)) {
3223 complain_about_duplicate(opts, 1);
3224 op = string_for_opt(opts, negated);
3225 if ((negated && !op) || (!negated && op)) {
3226 iflags.wc_scroll_margin = negated ? 5 : atoi(op);
3228 bad_negation(fullname, TRUE);
3231 fullname = "subkeyvalue";
3232 if (match_optname(opts, fullname, 5, TRUE)) {
3233 /* no duplicate complaint here */
3235 bad_negation(fullname, FALSE);
3238 op = string_for_opt(opts, 0);
3239 map_subkeyvalue(op);
3246 fullname = "tile_width";
3247 if (match_optname(opts, fullname, sizeof("tile_width") - 1, TRUE)) {
3249 complain_about_duplicate(opts, 1);
3250 op = string_for_opt(opts, negated);
3251 if ((negated && !op) || (!negated && op)) {
3252 iflags.wc_tile_width = negated ? 0 : atoi(op);
3254 bad_negation(fullname, TRUE);
3259 fullname = "tile_file";
3260 if (match_optname(opts, fullname, sizeof("tile_file") - 1, TRUE)) {
3262 complain_about_duplicate(opts, 1);
3263 if ((op = string_for_opt(opts, FALSE)) != 0) {
3264 if (iflags.wc_tile_file)
3265 free(iflags.wc_tile_file);
3266 iflags.wc_tile_file = (char *) alloc(strlen(op) + 1);
3267 Strcpy(iflags.wc_tile_file, op);
3273 fullname = "tile_height";
3274 if (match_optname(opts, fullname, sizeof("tile_height") - 1, TRUE)) {
3276 complain_about_duplicate(opts, 1);
3277 op = string_for_opt(opts, negated);
3278 if ((negated && !op) || (!negated && op)) {
3279 iflags.wc_tile_height = negated ? 0 : atoi(op);
3281 bad_negation(fullname, TRUE);
3285 * vary_msgcount:nn */
3286 fullname = "vary_msgcount";
3287 if (match_optname(opts, fullname, sizeof("vary_msgcount") - 1, TRUE)) {
3289 complain_about_duplicate(opts, 1);
3290 op = string_for_opt(opts, negated);
3291 if ((negated && !op) || (!negated && op)) {
3292 iflags.wc_vary_msgcount = negated ? 0 : atoi(op);
3294 bad_negation(fullname, TRUE);
3297 fullname = "windowtype";
3298 if (match_optname(opts, fullname, 3, TRUE)) {
3300 complain_about_duplicate(opts, 1);
3302 bad_negation(fullname, FALSE);
3304 } else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
3305 char buf[WINTYPELEN];
3306 nmcpy(buf, op, WINTYPELEN);
3307 choose_windows(buf);
3312 fullname = "windowchain";
3313 if (match_optname(opts, fullname, 3, TRUE)) {
3315 bad_negation(fullname, FALSE);
3317 } else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
3318 char buf[WINTYPELEN];
3319 nmcpy(buf, op, WINTYPELEN);
3320 addto_windowchain(buf);
3327 * setting window colors
3328 * syntax: windowcolors=menu foregrnd/backgrnd text foregrnd/backgrnd
3330 fullname = "windowcolors";
3331 if (match_optname(opts, fullname, 7, TRUE)) {
3333 complain_about_duplicate(opts, 1);
3334 if ((op = string_for_opt(opts, FALSE)) != 0) {
3335 if (!wc_set_window_colors(op))
3338 bad_negation(fullname, TRUE);
3342 /* menustyle:traditional or combination or full or partial */
3343 if (match_optname(opts, "menustyle", 4, TRUE)) {
3345 boolean val_required = (strlen(opts) > 5 && !negated);
3348 complain_about_duplicate(opts, 1);
3349 if (!(op = string_for_opt(opts, !val_required))) {
3351 return; /* string_for_opt gave feedback */
3352 tmp = negated ? 'n' : 'f';
3357 case 'n': /* none */
3358 case 't': /* traditional */
3359 flags.menu_style = MENU_TRADITIONAL;
3361 case 'c': /* combo: trad.class sel+menu */
3362 flags.menu_style = MENU_COMBINATION;
3364 case 'p': /* partial: no class menu */
3365 flags.menu_style = MENU_PARTIAL;
3367 case 'f': /* full: class menu + menu */
3368 flags.menu_style = MENU_FULL;
3376 fullname = "menu_headings";
3377 if (match_optname(opts, fullname, 12, TRUE)) {
3379 complain_about_duplicate(opts, 1);
3381 bad_negation(fullname, FALSE);
3383 } else if (!(opts = string_for_env_opt(fullname, opts, FALSE))) {
3386 for (i = 0; i < SIZE(attrnames); i++)
3387 if (!strcmpi(opts, attrnames[i].name)) {
3388 iflags.menu_headings = attrnames[i].attr;
3395 /* check for menu command mapping */
3396 for (i = 0; i < NUM_MENU_CMDS; i++) {
3397 fullname = default_menu_cmd_info[i].name;
3399 complain_about_duplicate(opts, 1);
3400 if (match_optname(opts, fullname, (int) strlen(fullname), TRUE)) {
3402 bad_negation(fullname, FALSE);
3403 } else if ((op = string_for_opt(opts, FALSE)) != 0) {
3405 char c, op_buf[BUFSZ];
3406 boolean isbad = FALSE;
3408 escapes(op, op_buf);
3411 if (c == 0 || c == '\r' || c == '\n' || c == '\033'
3412 || c == ' ' || digit(c) || (letter(c) && c != '@'))
3414 else /* reject default object class symbols */
3415 for (j = 1; j < MAXOCLASSES; j++)
3416 if (c == def_oc_syms[i].sym) {
3424 add_menu_cmd_alias(c, default_menu_cmd_info[i].cmd);
3429 #if defined(STATUS_VIA_WINDOWPORT) && defined(STATUS_HILITES)
3430 /* hilite fields in status prompt */
3431 if (match_optname(opts, "hilite_status", 13, TRUE)) {
3433 complain_about_duplicate(opts, 1);
3434 op = string_for_opt(opts, TRUE);
3435 if (op && negated) {
3436 clear_status_hilites(tfrom_file);
3439 /* a value is mandatory */
3443 if (!set_status_hilites(op, tfrom_file))
3449 #if defined(BACKWARD_COMPAT)
3450 fullname = "DECgraphics";
3451 if (match_optname(opts, fullname, 3, TRUE)) {
3452 boolean badflag = FALSE;
3455 complain_about_duplicate(opts, 1);
3457 /* There is no rogue level DECgraphics-specific set */
3458 if (symset[PRIMARY].name) {
3461 symset[PRIMARY].name = dupstr(fullname);
3462 if (!read_sym_file(PRIMARY)) {
3464 clear_symsetentry(PRIMARY, TRUE);
3466 switch_symbols(TRUE);
3469 pline("Failure to load symbol set %s.", fullname);
3475 fullname = "IBMgraphics";
3476 if (match_optname(opts, fullname, 3, TRUE)) {
3477 const char *sym_name = fullname;
3478 boolean badflag = FALSE;
3481 complain_about_duplicate(opts, 1);
3483 for (i = 0; i < NUM_GRAPHICS; ++i) {
3484 if (symset[i].name) {
3488 sym_name = "RogueIBM";
3489 symset[i].name = dupstr(sym_name);
3490 if (!read_sym_file(i)) {
3492 clear_symsetentry(i, TRUE);
3498 pline("Failure to load symbol set %s.", sym_name);
3501 switch_symbols(TRUE);
3502 if (!initial && Is_rogue_level(&u.uz))
3503 assign_graphics(ROGUESET);
3509 #ifdef MAC_GRAPHICS_ENV
3510 fullname = "MACgraphics";
3511 if (match_optname(opts, fullname, 3, TRUE)) {
3512 boolean badflag = FALSE;
3515 complain_about_duplicate(opts, 1);
3517 if (symset[PRIMARY].name) {
3520 symset[PRIMARY].name = dupstr(fullname);
3521 if (!read_sym_file(PRIMARY)) {
3523 clear_symsetentry(PRIMARY, TRUE);
3527 pline("Failure to load symbol set %s.", fullname);
3530 switch_symbols(TRUE);
3531 if (!initial && Is_rogue_level(&u.uz))
3532 assign_graphics(ROGUESET);
3539 /* OK, if we still haven't recognized the option, check the boolean
3542 for (i = 0; boolopt[i].name; i++) {
3543 if (match_optname(opts, boolopt[i].name, 3, FALSE)) {
3544 /* options that don't exist */
3545 if (!boolopt[i].addr) {
3546 if (!initial && !negated)
3547 pline_The("\"%s\" option is not available.",
3551 /* options that must come from config file */
3552 if (!initial && (boolopt[i].optflags == SET_IN_FILE)) {
3553 rejectoption(boolopt[i].name);
3557 *(boolopt[i].addr) = !negated;
3559 /* 0 means boolean opts */
3560 if (duplicate_opt_detection(boolopt[i].name, 0))
3561 complain_about_duplicate(boolopt[i].name, 0);
3564 if ((boolopt[i].addr) == &iflags.rlecomp) {
3565 if (*boolopt[i].addr)
3566 set_savepref("rlecomp");
3568 set_savepref("!rlecomp");
3572 if ((boolopt[i].addr) == &iflags.zerocomp) {
3573 if (*boolopt[i].addr)
3574 set_savepref("zerocomp");
3576 set_savepref("externalcomp");
3579 /* only do processing below if setting with doset() */
3583 if ((boolopt[i].addr) == &flags.time
3584 || (boolopt[i].addr) == &flags.showexp
3585 #ifdef SCORE_ON_BOTL
3586 || (boolopt[i].addr) == &flags.showscore
3589 #ifdef STATUS_VIA_WINDOWPORT
3590 status_initialize(REASSESS_ONLY);
3592 context.botl = TRUE;
3593 } else if ((boolopt[i].addr) == &flags.invlet_constant) {
3594 if (flags.invlet_constant)
3596 } else if (((boolopt[i].addr) == &flags.lit_corridor)
3597 || ((boolopt[i].addr) == &flags.dark_room)) {
3599 * All corridor squares seen via night vision or
3600 * candles & lamps change. Update them by calling
3601 * newsym() on them. Don't do this if we are
3602 * initializing the options --- the vision system
3605 vision_recalc(2); /* shut down vision */
3606 vision_full_recalc = 1; /* delayed recalc */
3607 if (iflags.use_color)
3608 need_redraw = TRUE; /* darkroom refresh */
3609 } else if ((boolopt[i].addr) == &iflags.use_inverse
3610 || (boolopt[i].addr) == &flags.showrace
3611 || (boolopt[i].addr) == &iflags.hilite_pet) {
3614 } else if ((boolopt[i].addr) == &iflags.use_color) {
3617 if ((boolopt[i].addr) == &iflags.use_color && iflags.BIOS) {
3624 #endif /* TEXTCOLOR */
3630 /* out of valid options */
3634 static NEARDATA const char *menutype[] = { "traditional", "combination",
3635 "full", "partial" };
3637 static NEARDATA const char *burdentype[] = { "unencumbered", "burdened",
3638 "stressed", "strained",
3639 "overtaxed", "overloaded" };
3641 static NEARDATA const char *runmodes[] = { "teleport", "run", "walk",
3644 static NEARDATA const char *sortltype[] = { "none", "loot", "full" };
3647 * Convert the given string of object classes to a string of default object
3651 oc_to_str(src, dest)
3656 while ((i = (int) *src++) != 0) {
3657 if (i < 0 || i >= MAXOCLASSES)
3658 impossible("oc_to_str: illegal object class %d", i);
3660 *dest++ = def_oc_syms[i].sym;
3666 * Add the given mapping to the menu command map list. Always keep the
3667 * maps valid C strings.
3670 add_menu_cmd_alias(from_ch, to_ch)
3671 char from_ch, to_ch;
3673 if (n_menu_mapped >= MAX_MENU_MAPPED_CMDS) {
3674 pline("out of menu map space.");
3676 mapped_menu_cmds[n_menu_mapped] = from_ch;
3677 mapped_menu_op[n_menu_mapped] = to_ch;
3679 mapped_menu_cmds[n_menu_mapped] = 0;
3680 mapped_menu_op[n_menu_mapped] = 0;
3685 * Map the given character to its corresponding menu command. If it
3686 * doesn't match anything, just return the original.
3692 char *found = index(mapped_menu_cmds, ch);
3694 int idx = (int) (found - mapped_menu_cmds);
3695 ch = mapped_menu_op[idx];
3700 #if defined(MICRO) || defined(MAC) || defined(WIN32)
3701 #define OPTIONS_HEADING "OPTIONS"
3703 #define OPTIONS_HEADING "NETHACKOPTIONS"
3706 static char fmtstr_doset_add_menu[] = "%s%-15s [%s] ";
3707 static char fmtstr_doset_add_menu_tab[] = "%s\t[%s]";
3710 doset_add_menu(win, option, indexoffset)
3711 winid win; /* window to add to */
3712 const char *option; /* option name */
3713 int indexoffset; /* value to add to index in compopt[], or zero
3714 if option cannot be changed */
3716 const char *value = "unknown"; /* current value */
3717 char buf[BUFSZ], buf2[BUFSZ];
3722 if (indexoffset == 0) {
3724 value = get_compopt_value(option, buf2);
3726 for (i = 0; compopt[i].name; i++)
3727 if (strcmp(option, compopt[i].name) == 0)
3730 if (compopt[i].name) {
3731 any.a_int = i + 1 + indexoffset;
3732 value = get_compopt_value(option, buf2);
3734 /* We are trying to add an option not found in compopt[].
3735 This is almost certainly bad, but we'll let it through anyway
3736 (with a zero value, so it can't be selected). */
3740 /* " " replaces "a - " -- assumes menus follow that style */
3741 if (!iflags.menu_tab_sep)
3742 Sprintf(buf, fmtstr_doset_add_menu, any.a_int ? "" : " ", option,
3745 Sprintf(buf, fmtstr_doset_add_menu_tab, option, value);
3746 add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED);
3749 /* Changing options via menu by Per Liboriussen */
3753 char buf[BUFSZ], buf2[BUFSZ];
3754 int i = 0, pass, boolcount, pick_cnt, pick_idx, opt_indx;
3758 menu_item *pick_list;
3759 int indexoffset, startpass, endpass;
3760 boolean setinitial = FALSE, fromfile = FALSE;
3761 int biggest_name = 0;
3762 const char *n_currently_set = "(%d currently set)";
3764 tmpwin = create_nhwindow(NHW_MENU);
3768 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
3770 "Booleans (selecting will toggle value):", MENU_UNSELECTED);
3772 "
\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);
3774 /* first list any other non-modifiable booleans, then modifiable ones */
3775 for (pass = 0; pass <= 1; pass++)
3776 for (i = 0; boolopt[i].name; i++)
3777 if ((bool_p = boolopt[i].addr) != 0
3778 && ((boolopt[i].optflags == DISP_IN_GAME && pass == 0)
3779 || (boolopt[i].optflags == SET_IN_GAME && pass == 1))) {
3780 if (bool_p == &flags.female)
3781 continue; /* obsolete */
3782 if (bool_p == &iflags.sanity_check && !wizard)
3784 if (bool_p == &iflags.menu_tab_sep && !wizard)
3786 if (is_wc_option(boolopt[i].name)
3787 && !wc_supported(boolopt[i].name))
3789 if (is_wc2_option(boolopt[i].name)
3790 && !wc2_supported(boolopt[i].name))
3792 any.a_int = (pass == 0) ? 0 : i + 1;
3793 if (!iflags.menu_tab_sep)
3794 Sprintf(buf, "%s%-17s [%s]", pass == 0 ? " " : "",
3795 boolopt[i].name, *bool_p ? "true" : "false");
3797 Sprintf(buf, "%s\t[%s]", boolopt[i].name,
3798 *bool_p ? "true" : "false");
3799 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
3804 indexoffset = boolcount;
3806 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED);
3808 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
3809 "Compounds (selecting will prompt for new value):",
3812 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
3813 "
\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",
3817 #ifdef notyet /* SYSCF */
3818 /* XXX I think this is still fragile. Fixing initial/from_file and/or
3820 the SET_* etc to bitmaps will let me make this better. */
3822 startpass = SET_IN_SYS;
3825 startpass = DISP_IN_GAME;
3826 endpass = SET_IN_GAME;
3828 /* spin through the options to find the biggest name
3829 and adjust the format string accordingly if needed */
3831 for (i = 0; compopt[i].name; i++)
3832 if (compopt[i].optflags >= startpass && compopt[i].optflags <= endpass
3833 && strlen(compopt[i].name) > (unsigned) biggest_name)
3834 biggest_name = (int) strlen(compopt[i].name);
3835 if (biggest_name > 30)
3837 if (!iflags.menu_tab_sep)
3838 Sprintf(fmtstr_doset_add_menu, "%%s%%-%ds [%%s]", biggest_name);
3840 /* deliberately put `playmode', `name', `role', `race', `gender' first
3841 (also alignment if anything ever comes before it in compopt[]) */
3842 doset_add_menu(tmpwin, "playmode", 0);
3843 doset_add_menu(tmpwin, "name", 0);
3844 doset_add_menu(tmpwin, "role", 0);
3845 doset_add_menu(tmpwin, "race", 0);
3846 doset_add_menu(tmpwin, "gender", 0);
3848 for (pass = startpass; pass <= endpass; pass++)
3849 for (i = 0; compopt[i].name; i++)
3850 if (compopt[i].optflags == pass) {
3851 if (!strcmp(compopt[i].name, "playmode")
3852 || !strcmp(compopt[i].name, "name")
3853 || !strcmp(compopt[i].name, "role")
3854 || !strcmp(compopt[i].name, "race")
3855 || !strcmp(compopt[i].name, "gender"))
3857 else if (is_wc_option(compopt[i].name)
3858 && !wc_supported(compopt[i].name))
3860 else if (is_wc2_option(compopt[i].name)
3861 && !wc2_supported(compopt[i].name))
3864 doset_add_menu(tmpwin, compopt[i].name,
3865 (pass == DISP_IN_GAME) ? 0 : indexoffset);
3868 Sprintf(buf2, n_currently_set, msgtype_count());
3869 Sprintf(buf, fmtstr_doset_add_menu, any.a_int ? "" : " ",
3870 "message types", buf2);
3871 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED);
3873 Sprintf(buf2, n_currently_set, count_menucolors());
3874 Sprintf(buf, fmtstr_doset_add_menu, any.a_int ? "" : " ",
3875 "menucolors", buf2);
3876 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED);
3877 #ifdef STATUS_VIA_WINDOWPORT
3878 #ifdef STATUS_HILITES
3880 get_status_hilites(buf2, 60);
3882 Sprintf(buf2, "%s", "(none)");
3883 if (!iflags.menu_tab_sep)
3884 Sprintf(buf, fmtstr_doset_add_menu, any.a_int ? "" : " ",
3885 "status_hilites", buf2);
3887 Sprintf(buf, fmtstr_doset_add_menu_tab, "status_hilites", buf2);
3888 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED);
3892 Sprintf(buf2, n_currently_set, count_ape_maps((int *) 0, (int *) 0));
3893 Sprintf(buf, fmtstr_doset_add_menu, any.a_int ? "" : " ",
3894 "autopickup exceptions", buf2);
3895 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED);
3896 #ifdef PREFIXES_IN_USE
3898 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED);
3899 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
3900 "Variable playground locations:", MENU_UNSELECTED);
3901 for (i = 0; i < PREFIX_COUNT; i++)
3902 doset_add_menu(tmpwin, fqn_prefix_names[i], 0);
3905 end_menu(tmpwin, "Set what options?");
3907 end_menu(tmpwin, "
\82Ç
\82Ì
\83I
\83v
\83V
\83\87\83\93\82ð
\90Ý
\92è
\82µ
\82Ü
\82·
\82©
\81H");
3908 need_redraw = FALSE;
3909 if ((pick_cnt = select_menu(tmpwin, PICK_ANY, &pick_list)) > 0) {
3911 * Walk down the selection list and either invert the booleans
3912 * or prompt for new values. In most cases, call parseoptions()
3913 * to take care of options that require special attention, like
3916 for (pick_idx = 0; pick_idx < pick_cnt; ++pick_idx) {
3917 opt_indx = pick_list[pick_idx].item.a_int - 1;
3918 if (opt_indx == -2) {
3919 /* -2 due to -1 offset for select_menu() */
3920 (void) special_handling("autopickup_exception", setinitial,
3922 #ifdef STATUS_VIA_WINDOWPORT
3923 #ifdef STATUS_HILITES
3924 } else if (opt_indx == -3) {
3925 /* -3 due to -1 offset for select_menu() */
3926 if (!status_hilite_menu()) {
3927 pline("Bad status hilite(s) specified.");
3929 if (wc2_supported("status_hilites"))
3930 preference_update("status_hilites");
3934 } else if (opt_indx == -4) {
3935 (void) special_handling("menucolors", setinitial,
3937 } else if (opt_indx == -5) {
3938 (void) special_handling("msgtype", setinitial, fromfile);
3939 } else if (opt_indx < boolcount) {
3940 /* boolean option */
3941 Sprintf(buf, "%s%s", *boolopt[opt_indx].addr ? "!" : "",
3942 boolopt[opt_indx].name);
3943 parseoptions(buf, setinitial, fromfile);
3944 if (wc_supported(boolopt[opt_indx].name)
3945 || wc2_supported(boolopt[opt_indx].name))
3946 preference_update(boolopt[opt_indx].name);
3948 /* compound option */
3949 opt_indx -= boolcount;
3951 if (!special_handling(compopt[opt_indx].name, setinitial,
3954 Sprintf(buf, "Set %s to what?", compopt[opt_indx].name);
3956 Sprintf(buf, "%s
\82É
\89½
\82ð
\90Ý
\92è
\82·
\82é
\81H", compopt[opt_indx].name);
3958 if (buf2[0] == '\033')
3960 Sprintf(buf, "%s:%s", compopt[opt_indx].name, buf2);
3962 parseoptions(buf, setinitial, fromfile);
3964 if (wc_supported(compopt[opt_indx].name)
3965 || wc2_supported(compopt[opt_indx].name))
3966 preference_update(compopt[opt_indx].name);
3969 free((genericptr_t) pick_list);
3970 pick_list = (menu_item *) 0;
3973 destroy_nhwindow(tmpwin);
3982 handle_add_list_remove(optname, numtotal)
3983 const char *optname;
3988 int i, pick_cnt, pick_idx, opt_idx;
3989 menu_item *pick_list = (menu_item *) 0;
3990 static const struct action {
3993 } action_titles[] = {
3995 { 'a', "add new %s" }, /* [0] */
3997 { 'a', "
\90V
\82µ
\82¢%s
\82ð
\92Ç
\89Á" }, /* [0] */
4000 { 'l', "list %s" }, /* [1] */
4002 { 'l', "%s
\82ð
\88ê
\97\97\95\
\8e¦" }, /* [1] */
4005 { 'r', "remove existing %s" }, /* [2] */
4007 { 'r', "
\8aù
\82É
\82 \82é%s
\82ð
\8dí
\8f\9c" }, /* [2] */
4010 { 'x', "exit this menu" }, /* [3] */
4012 { 'x', "
\82±
\82Ì
\83\81\83j
\83\85\81[
\82ð
\95Â
\82¶
\82é" }, /* [3] */
4017 tmpwin = create_nhwindow(NHW_MENU);
4020 for (i = 0; i < SIZE(action_titles); i++) {
4023 /* omit list and remove if there aren't any yet */
4024 if (!numtotal && (i == 1 || i == 2))
4026 Sprintf(tmpbuf, action_titles[i].desc,
4027 (i == 1) ? makeplural(optname) : optname);
4028 add_menu(tmpwin, NO_GLYPH, &any, action_titles[i].letr, 0, ATR_NONE,
4030 #if 0 /* this ought to work but doesn't... */
4031 (action_titles[i].letr == 'x') ? MENU_SELECTED :
4036 end_menu(tmpwin, "Do what?");
4038 end_menu(tmpwin, "
\82Ç
\82¤
\82·
\82é
\81H");
4039 if ((pick_cnt = select_menu(tmpwin, PICK_ONE, &pick_list)) > 0) {
4040 for (pick_idx = 0; pick_idx < pick_cnt; ++pick_idx) {
4041 opt_idx = pick_list[pick_idx].item.a_int - 1;
4043 free((genericptr_t) pick_list);
4044 pick_list = (menu_item *) 0;
4046 destroy_nhwindow(tmpwin);
4049 opt_idx = 3; /* none selected, exit menu */
4053 struct symsetentry *symset_list = 0; /* files.c will populate this with
4054 list of available sets */
4057 special_handling(optname, setinitial, setfromfile)
4058 const char *optname;
4059 boolean setinitial, setfromfile;
4066 /* Special handling of menustyle, pickup_burden, pickup_types,
4067 * disclose, runmode, msg_window, menu_headings, sortloot,
4068 * and number_pad options.
4069 * Also takes care of interactive autopickup_exception_handling changes.
4071 if (!strcmp("menustyle", optname)) {
4072 const char *style_name;
4073 menu_item *style_pick = (menu_item *) 0;
4074 tmpwin = create_nhwindow(NHW_MENU);
4077 for (i = 0; i < SIZE(menutype); i++) {
4078 style_name = menutype[i];
4079 /* note: separate `style_name' variable used
4080 to avoid an optimizer bug in VAX C V2.3 */
4082 add_menu(tmpwin, NO_GLYPH, &any, *style_name, 0, ATR_NONE,
4083 style_name, MENU_UNSELECTED);
4086 end_menu(tmpwin, "Select menustyle:");
4088 end_menu(tmpwin, "
\83\81\83j
\83\85\81[
\83X
\83^
\83C
\83\8b\82ð
\91I
\91ð
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81F");
4089 if (select_menu(tmpwin, PICK_ONE, &style_pick) > 0) {
4090 flags.menu_style = style_pick->item.a_int - 1;
4091 free((genericptr_t) style_pick);
4093 destroy_nhwindow(tmpwin);
4094 } else if (!strcmp("paranoid_confirmation", optname)) {
4095 menu_item *paranoia_picks = (menu_item *) 0;
4097 tmpwin = create_nhwindow(NHW_MENU);
4100 for (i = 0; paranoia[i].flagmask != 0; ++i) {
4101 if (paranoia[i].flagmask == PARANOID_BONES && !wizard)
4103 any.a_int = paranoia[i].flagmask;
4104 add_menu(tmpwin, NO_GLYPH, &any, *paranoia[i].argname, 0,
4105 ATR_NONE, paranoia[i].explain,
4106 (flags.paranoia_bits & paranoia[i].flagmask)
4110 end_menu(tmpwin, "Actions requiring extra confirmation:");
4111 i = select_menu(tmpwin, PICK_ANY, ¶noia_picks);
4113 /* player didn't cancel; we reset all the paranoia options
4114 here even if there were no items picked, since user
4115 could have toggled off preselected ones to end up with 0 */
4116 flags.paranoia_bits = 0;
4118 /* at least 1 item set, either preselected or newly picked */
4120 flags.paranoia_bits |= paranoia_picks[i].item.a_int;
4121 free((genericptr_t) paranoia_picks);
4124 destroy_nhwindow(tmpwin);
4125 } else if (!strcmp("pickup_burden", optname)) {
4126 const char *burden_name, *burden_letters = "ubsntl";
4127 menu_item *burden_pick = (menu_item *) 0;
4129 tmpwin = create_nhwindow(NHW_MENU);
4132 for (i = 0; i < SIZE(burdentype); i++) {
4133 burden_name = burdentype[i];
4135 add_menu(tmpwin, NO_GLYPH, &any, burden_letters[i], 0, ATR_NONE,
4136 burden_name, MENU_UNSELECTED);
4139 end_menu(tmpwin, "Select encumbrance level:");
4141 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");
4142 if (select_menu(tmpwin, PICK_ONE, &burden_pick) > 0) {
4143 flags.pickup_burden = burden_pick->item.a_int - 1;
4144 free((genericptr_t) burden_pick);
4146 destroy_nhwindow(tmpwin);
4147 } else if (!strcmp("pickup_types", optname)) {
4148 /* parseoptions will prompt for the list of types */
4149 parseoptions(strcpy(buf, "pickup_types"), setinitial, setfromfile);
4150 } else if (!strcmp("disclose", optname)) {
4151 /* order of disclose_names[] must correspond to
4152 disclosure_options in decl.c */
4153 static const char *disclosure_names[] = {
4154 "inventory", "attributes", "vanquished",
4155 "genocides", "conduct", "overview",
4157 int disc_cat[NUM_DISCLOSURE_OPTIONS];
4158 int pick_cnt, pick_idx, opt_idx;
4159 menu_item *disclosure_pick = (menu_item *) 0;
4161 tmpwin = create_nhwindow(NHW_MENU);
4164 for (i = 0; i < NUM_DISCLOSURE_OPTIONS; i++) {
4165 Sprintf(buf, "%-12s[%c%c]", disclosure_names[i],
4166 flags.end_disclose[i], disclosure_options[i]);
4168 add_menu(tmpwin, NO_GLYPH, &any, disclosure_options[i], 0,
4169 ATR_NONE, buf, MENU_UNSELECTED);
4173 end_menu(tmpwin, "Change which disclosure options categories:");
4175 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");
4176 pick_cnt = select_menu(tmpwin, PICK_ANY, &disclosure_pick);
4178 for (pick_idx = 0; pick_idx < pick_cnt; ++pick_idx) {
4179 opt_idx = disclosure_pick[pick_idx].item.a_int - 1;
4180 disc_cat[opt_idx] = 1;
4182 free((genericptr_t) disclosure_pick);
4183 disclosure_pick = (menu_item *) 0;
4185 destroy_nhwindow(tmpwin);
4187 for (i = 0; i < NUM_DISCLOSURE_OPTIONS; i++) {
4190 Sprintf(buf, "Disclosure options for %s:",
4192 Sprintf(buf, "%s
\82Ì
\8fo
\97Í
\8c`
\8e®
\81F",
4193 disclosure_names[i]);
4194 tmpwin = create_nhwindow(NHW_MENU);
4197 /* 'y','n',and '+' work as alternate selectors; '-' doesn't */
4198 any.a_char = DISCLOSE_NO_WITHOUT_PROMPT;
4199 add_menu(tmpwin, NO_GLYPH, &any, 'a', any.a_char, ATR_NONE,
4201 "Never disclose, without prompting",
4203 "
\8am
\94F
\82¹
\82¸
\82É
\8fo
\97Í
\82à
\82µ
\82È
\82¢",
4205 any.a_char = DISCLOSE_YES_WITHOUT_PROMPT;
4206 add_menu(tmpwin, NO_GLYPH, &any, 'b', any.a_char, ATR_NONE,
4208 "Always disclose, without prompting",
4210 "
\8am
\94F
\82¹
\82¸
\82É
\8fo
\97Í
\82·
\82é",
4212 any.a_char = DISCLOSE_PROMPT_DEFAULT_NO;
4213 add_menu(tmpwin, NO_GLYPH, &any, 'c', any.a_char, ATR_NONE,
4215 "Prompt, with default answer of \"No\"",
4217 "
\8am
\94F
\82·
\82é
\81C
\83f
\83t
\83H
\83\8b\83g
\82Í
\81u
\8fo
\97Í
\82µ
\82È
\82¢
\81v",
4219 any.a_char = DISCLOSE_PROMPT_DEFAULT_YES;
4220 add_menu(tmpwin, NO_GLYPH, &any, 'd', any.a_char, ATR_NONE,
4222 "Prompt, with default answer of \"Yes\"",
4224 "
\8am
\94F
\82·
\82é
\81C
\83f
\83t
\83H
\83\8b\83g
\82Í
\81u
\8fo
\97Í
\82·
\82é
\81v",
4226 end_menu(tmpwin, buf);
4227 if (select_menu(tmpwin, PICK_ONE, &disclosure_pick) > 0) {
4228 flags.end_disclose[i] = disclosure_pick->item.a_char;
4229 free((genericptr_t) disclosure_pick);
4231 destroy_nhwindow(tmpwin);
4234 } else if (!strcmp("runmode", optname)) {
4235 const char *mode_name;
4236 menu_item *mode_pick = (menu_item *) 0;
4238 tmpwin = create_nhwindow(NHW_MENU);
4241 for (i = 0; i < SIZE(runmodes); i++) {
4242 mode_name = runmodes[i];
4244 add_menu(tmpwin, NO_GLYPH, &any, *mode_name, 0, ATR_NONE,
4245 mode_name, MENU_UNSELECTED);
4248 end_menu(tmpwin, "Select run/travel display mode:");
4250 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");
4251 if (select_menu(tmpwin, PICK_ONE, &mode_pick) > 0) {
4252 flags.runmode = mode_pick->item.a_int - 1;
4253 free((genericptr_t) mode_pick);
4255 destroy_nhwindow(tmpwin);
4256 } else if (!strcmp("msg_window", optname)) {
4258 /* by Christian W. Cooper */
4259 menu_item *window_pick = (menu_item *) 0;
4261 tmpwin = create_nhwindow(NHW_MENU);
4265 add_menu(tmpwin, NO_GLYPH, &any, 's', 0, ATR_NONE, "single",
4268 add_menu(tmpwin, NO_GLYPH, &any, 'c', 0, ATR_NONE, "combination",
4271 add_menu(tmpwin, NO_GLYPH, &any, 'f', 0, ATR_NONE, "full",
4274 add_menu(tmpwin, NO_GLYPH, &any, 'r', 0, ATR_NONE, "reversed",
4277 end_menu(tmpwin, "Select message history display type:");
4279 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");
4280 if (select_menu(tmpwin, PICK_ONE, &window_pick) > 0) {
4281 iflags.prevmsg_window = window_pick->item.a_char;
4282 free((genericptr_t) window_pick);
4284 destroy_nhwindow(tmpwin);
4286 } else if (!strcmp("sortloot", optname)) {
4287 const char *sortl_name;
4288 menu_item *sortl_pick = (menu_item *) 0;
4290 tmpwin = create_nhwindow(NHW_MENU);
4293 for (i = 0; i < SIZE(sortltype); i++) {
4294 sortl_name = sortltype[i];
4295 any.a_char = *sortl_name;
4296 add_menu(tmpwin, NO_GLYPH, &any, *sortl_name, 0, ATR_NONE,
4297 sortl_name, MENU_UNSELECTED);
4299 end_menu(tmpwin, "Select loot sorting type:");
4300 if (select_menu(tmpwin, PICK_ONE, &sortl_pick) > 0) {
4301 flags.sortloot = sortl_pick->item.a_char;
4302 free((genericptr_t) sortl_pick);
4304 destroy_nhwindow(tmpwin);
4305 } else if (!strcmp("align_message", optname)
4306 || !strcmp("align_status", optname)) {
4307 menu_item *window_pick = (menu_item *) 0;
4309 boolean msg = (*(optname + 6) == 'm');
4311 tmpwin = create_nhwindow(NHW_MENU);
4314 any.a_int = ALIGN_TOP;
4315 add_menu(tmpwin, NO_GLYPH, &any, 't', 0, ATR_NONE, "top",
4317 any.a_int = ALIGN_BOTTOM;
4318 add_menu(tmpwin, NO_GLYPH, &any, 'b', 0, ATR_NONE, "bottom",
4320 any.a_int = ALIGN_LEFT;
4321 add_menu(tmpwin, NO_GLYPH, &any, 'l', 0, ATR_NONE, "left",
4323 any.a_int = ALIGN_RIGHT;
4324 add_menu(tmpwin, NO_GLYPH, &any, 'r', 0, ATR_NONE, "right",
4327 Sprintf(abuf, "Select %s window placement relative to the map:",
4328 msg ? "message" : "status");
4330 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",
4331 msg ? "
\83\81\83b
\83Z
\81[
\83W" : "
\8fó
\91Ô");
4333 end_menu(tmpwin, abuf);
4334 if (select_menu(tmpwin, PICK_ONE, &window_pick) > 0) {
4336 iflags.wc_align_message = window_pick->item.a_int;
4338 iflags.wc_align_status = window_pick->item.a_int;
4339 free((genericptr_t) window_pick);
4341 destroy_nhwindow(tmpwin);
4342 } else if (!strcmp("number_pad", optname)) {
4343 static const char *npchoices[] = {
4345 " 0 (off)", " 1 (on)", " 2 (on, MSDOS compatible)",
4347 "0 (
\96³
\8cø)", "1 (
\97L
\8cø)", "2 (
\97L
\8cø
\81CMSDOS
\8cÝ
\8a·)",
4349 " 3 (on, phone-style digit layout)",
4351 " 3 (
\97L
\8cø
\81C
\93d
\98b
\8e®
\82Ì
\90\94\8e\9a\94z
\92u)",
4353 " 4 (on, phone-style layout, MSDOS compatible)",
4355 " 4 (
\97L
\8cø
\81C
\93d
\98b
\8e®
\82Ì
\94z
\92u
\81CMSDOS
\8cÝ
\8a·)",
4357 "-1 (off, 'z' to move upper-left, 'y' to zap wands)"
4359 "-1 (
\96³
\8cø
\81C'z'
\82Å
\8d¶
\8fã
\82É
\88Ú
\93®
\81C'y'
\82Å
\8fñ
\82ð
\90U
\82é)"
4361 menu_item *mode_pick = (menu_item *) 0;
4363 tmpwin = create_nhwindow(NHW_MENU);
4366 for (i = 0; i < SIZE(npchoices); i++) {
4368 add_menu(tmpwin, NO_GLYPH, &any, 'a' + i, 0, ATR_NONE,
4369 npchoices[i], MENU_UNSELECTED);
4372 end_menu(tmpwin, "Select number_pad mode:");
4374 end_menu(tmpwin, "number_pad
\83\82\81[
\83h
\82ð
\91I
\91ð
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81F");
4375 if (select_menu(tmpwin, PICK_ONE, &mode_pick) > 0) {
4376 switch (mode_pick->item.a_int - 1) {
4378 iflags.num_pad = FALSE;
4379 iflags.num_pad_mode = 0;
4382 iflags.num_pad = TRUE;
4383 iflags.num_pad_mode = 0;
4386 iflags.num_pad = TRUE;
4387 iflags.num_pad_mode = 1;
4390 iflags.num_pad = TRUE;
4391 iflags.num_pad_mode = 2;
4394 iflags.num_pad = TRUE;
4395 iflags.num_pad_mode = 3;
4397 /* last menu choice: number_pad == -1 */
4399 iflags.num_pad = FALSE;
4400 iflags.num_pad_mode = 1;
4403 reset_commands(FALSE);
4404 number_pad(iflags.num_pad ? 1 : 0);
4405 free((genericptr_t) mode_pick);
4407 destroy_nhwindow(tmpwin);
4408 } else if (!strcmp("menu_headings", optname)) {
4410 int mhattr = query_attr("How to highlight menu headings:");
4412 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");
4415 iflags.menu_headings = mhattr;
4416 } else if (!strcmp("msgtype", optname)) {
4417 int opt_idx, nmt, mttyp;
4421 nmt = msgtype_count();
4422 opt_idx = handle_add_list_remove("message type", nmt);
4424 ; /* done--fall through to function exit */
4425 } else if (opt_idx == 0) { /* add new */
4426 getlin("What new message pattern?", mtbuf);
4427 if (*mtbuf == '\033' || !*mtbuf)
4428 goto msgtypes_again;
4429 mttyp = query_msgtype();
4431 goto msgtypes_again;
4432 if (!msgtype_add(mttyp, mtbuf)) {
4433 pline("Error adding the message type.");
4435 goto msgtypes_again;
4437 } else { /* list or remove */
4438 int pick_idx, pick_cnt;
4440 menu_item *pick_list = (menu_item *) 0;
4441 struct plinemsg_type *tmp = plinemsg_types;
4443 tmpwin = create_nhwindow(NHW_MENU);
4448 const char *mtype = msgtype2name(tmp->msgtype);
4450 any.a_int = ++mt_idx;
4451 Sprintf(mtbuf, "%-5s \"%s\"", mtype, tmp->pattern);
4452 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, mtbuf,
4456 Sprintf(mtbuf, "%s message types",
4457 (opt_idx == 1) ? "List of" : "Remove which");
4458 end_menu(tmpwin, mtbuf);
4459 pick_cnt = select_menu(tmpwin,
4460 (opt_idx == 1) ? PICK_NONE : PICK_ANY,
4463 for (pick_idx = 0; pick_idx < pick_cnt; ++pick_idx)
4464 free_one_msgtype(pick_list[pick_idx].item.a_int - 1
4466 free((genericptr_t) pick_list), pick_list = (menu_item *) 0;
4468 destroy_nhwindow(tmpwin);
4470 goto msgtypes_again;
4472 } else if (!strcmp("menucolors", optname)) {
4473 int opt_idx, nmc, mcclr, mcattr;
4477 nmc = count_menucolors();
4478 opt_idx = handle_add_list_remove("menucolor", nmc);
4480 ; /* done--fall through to function exit */
4481 } else if (opt_idx == 0) { /* add new */
4482 getlin("What new menucolor pattern?", mcbuf);
4483 if (*mcbuf == '\033' || !*mcbuf)
4484 goto menucolors_again;
4485 mcclr = query_color();
4487 goto menucolors_again;
4488 mcattr = query_attr(NULL);
4490 goto menucolors_again;
4491 if (!add_menu_coloring_parsed(mcbuf, mcclr, mcattr)) {
4492 pline("Error adding the menu color.");
4494 goto menucolors_again;
4496 } else { /* list or remove */
4497 int pick_idx, pick_cnt;
4499 menu_item *pick_list = (menu_item *) 0;
4500 struct menucoloring *tmp = menu_colorings;
4502 tmpwin = create_nhwindow(NHW_MENU);
4507 const char *sattr = attr2attrname(tmp->attr);
4508 const char *sclr = clr2colorname(tmp->color);
4510 any.a_int = (++mc_idx);
4511 Sprintf(mcbuf, "\"%s\"=%s%s%s", tmp->origstr, sclr,
4512 (tmp->attr != ATR_NONE) ? " & " : "",
4513 (tmp->attr != ATR_NONE) ? sattr : "");
4514 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, mcbuf,
4518 Sprintf(mcbuf, "%s menu colors",
4519 (opt_idx == 1) ? "List of" : "Remove which");
4520 end_menu(tmpwin, mcbuf);
4521 pick_cnt = select_menu(tmpwin,
4522 (opt_idx == 1) ? PICK_NONE : PICK_ANY,
4525 for (pick_idx = 0; pick_idx < pick_cnt; ++pick_idx)
4526 free_one_menu_coloring(pick_list[pick_idx].item.a_int - 1
4528 free((genericptr_t) pick_list), pick_list = (menu_item *) 0;
4530 destroy_nhwindow(tmpwin);
4532 goto menucolors_again;
4534 } else if (!strcmp("autopickup_exception", optname)) {
4535 int opt_idx, pass, totalapes = 0, numapes[2] = { 0, 0 };
4536 char apebuf[1 + BUFSZ]; /* so &apebuf[1] is BUFSZ long for getlin() */
4537 struct autopickup_exception *ape;
4540 totalapes = count_ape_maps(&numapes[AP_LEAVE], &numapes[AP_GRAB]);
4541 opt_idx = handle_add_list_remove("autopickup exception", totalapes);
4543 ; /* done--fall through to function exit */
4544 } else if (opt_idx == 0) { /* add new */
4546 getlin("What new autopickup exception pattern?", &apebuf[1]);
4548 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]);
4549 mungspaces(&apebuf[1]); /* regularize whitespace */
4550 if (apebuf[1] == '\033') {
4551 ; /* fall through to function exit */
4555 /* guarantee room for \" prefix and \"\0 suffix;
4556 -2 is good enough for apebuf[] but -3 makes
4557 sure the whole thing fits within normal BUFSZ */
4558 apebuf[sizeof apebuf - 3] = '\0';
4559 Strcat(apebuf, "\"");
4560 add_autopickup_exception(apebuf);
4564 } else { /* list or remove */
4565 int pick_idx, pick_cnt;
4566 menu_item *pick_list = (menu_item *) 0;
4568 tmpwin = create_nhwindow(NHW_MENU);
4570 for (pass = AP_LEAVE; pass <= AP_GRAB; ++pass) {
4571 if (numapes[pass] == 0)
4573 ape = iflags.autopickup_exceptions[pass];
4575 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
4577 (pass == 0) ? "Never pickup" : "Always pickup",
4579 (pass == 0) ? "
\8fí
\82É
\8fE
\82í
\82È
\82¢" : "
\8fí
\82É
\8fE
\82¤",
4581 for (i = 0; i < numapes[pass] && ape; i++) {
4582 any.a_void = (opt_idx == 1) ? 0 : ape;
4583 Sprintf(apebuf, "\"%s\"", ape->pattern);
4584 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, apebuf,
4590 Sprintf(apebuf, "%s autopickup exceptions",
4591 (opt_idx == 1) ? "List of" : "Remove which");
4593 Sprintf(apebuf, "%s
\8e©
\93®
\8fE
\82¢
\97á
\8aO%s",
4594 (opt_idx == 1) ? "" : "
\82Ç
\82Ì",
4595 (opt_idx == 1) ? "
\82Ì
\88ê
\97\97" : "
\82ð
\8dí
\8f\9c\82µ
\82Ü
\82·
\82©
\81H");
4597 end_menu(tmpwin, apebuf);
4598 pick_cnt = select_menu(tmpwin,
4599 (opt_idx == 1) ? PICK_NONE : PICK_ANY,
4602 for (pick_idx = 0; pick_idx < pick_cnt; ++pick_idx)
4603 remove_autopickup_exception(
4604 (struct autopickup_exception *)
4605 pick_list[pick_idx].item.a_void);
4606 free((genericptr_t) pick_list), pick_list = (menu_item *) 0;
4608 destroy_nhwindow(tmpwin);
4612 } else if (!strcmp("symset", optname)
4613 || !strcmp("roguesymset", optname)) {
4614 menu_item *symset_pick = (menu_item *) 0;
4615 boolean primaryflag = (*optname == 's'),
4616 rogueflag = (*optname == 'r'),
4617 ready_to_switch = FALSE,
4618 nothing_to_do = FALSE;
4619 char *symset_name, fmtstr[20];
4620 struct symsetentry *sl;
4621 int res, which_set, setcount = 0, chosen = -2;
4624 which_set = ROGUESET;
4626 which_set = PRIMARY;
4628 /* clear symset[].name as a flag to read_sym_file() to build list */
4629 symset_name = symset[which_set].name;
4630 symset[which_set].name = (char *) 0;
4631 symset_list = (struct symsetentry *) 0;
4633 res = read_sym_file(which_set);
4634 if (res && symset_list) {
4635 char symsetchoice[BUFSZ];
4636 int let = 'a', biggest = 0, thissize = 0;
4640 /* check restrictions */
4641 if ((!rogueflag && sl->rogue)
4642 || (!primaryflag && sl->primary)) {
4647 /* find biggest name */
4649 thissize = strlen(sl->name);
4650 if (thissize > biggest)
4655 pline("There are no appropriate %ssymbol sets available.",
4656 (rogueflag) ? "rogue level "
4657 : (primaryflag) ? "primary " : "");
4661 Sprintf(fmtstr, "%%-%ds %%s", biggest + 5);
4662 tmpwin = create_nhwindow(NHW_MENU);
4666 add_menu(tmpwin, NO_GLYPH, &any, let++, 0, ATR_NONE,
4667 "Default Symbols", MENU_UNSELECTED);
4671 /* check restrictions */
4672 if ((!rogueflag && sl->rogue)
4673 || (!primaryflag && sl->primary)) {
4678 any.a_int = sl->idx + 2;
4679 Sprintf(symsetchoice, fmtstr, sl->name,
4680 sl->desc ? sl->desc : "");
4681 add_menu(tmpwin, NO_GLYPH, &any, let, 0, ATR_NONE,
4682 symsetchoice, MENU_UNSELECTED);
4690 end_menu(tmpwin, "Select symbol set:");
4691 if (select_menu(tmpwin, PICK_ONE, &symset_pick) > 0) {
4692 chosen = symset_pick->item.a_int - 2;
4693 free((genericptr_t) symset_pick);
4695 destroy_nhwindow(tmpwin);
4698 /* chose an actual symset name from file */
4701 if (sl->idx == chosen) {
4703 free((genericptr_t) symset_name);
4704 symset_name = (char *) 0;
4706 /* free the now stale attributes */
4707 clear_symsetentry(which_set, TRUE);
4709 /* transfer only the name of the symbol set */
4710 symset[which_set].name = dupstr(sl->name);
4711 ready_to_switch = TRUE;
4716 } else if (chosen == -1) {
4717 /* explicit selection of defaults */
4718 /* free the now stale symset attributes */
4720 free((genericptr_t) symset_name);
4721 symset_name = (char *) 0;
4723 clear_symsetentry(which_set, TRUE);
4725 nothing_to_do = TRUE;
4727 /* The symbols file could not be accessed */
4728 pline("Unable to access \"%s\" file.", SYMBOLS);
4730 } else if (!symset_list) {
4731 /* The symbols file was empty */
4732 pline("There were no symbol sets found in \"%s\".", SYMBOLS);
4737 while (symset_list) {
4740 free((genericptr_t) sl->name);
4741 sl->name = (char *) 0;
4744 free((genericptr_t) sl->desc);
4745 sl->desc = (char *) 0;
4747 symset_list = sl->next;
4748 free((genericptr_t) sl);
4754 if (!symset[which_set].name && symset_name)
4755 symset[which_set].name = symset_name; /* not dupstr() here */
4757 /* Set default symbols and clear the handling value */
4763 if (symset[which_set].name) {
4764 if (read_sym_file(which_set)) {
4765 ready_to_switch = TRUE;
4767 clear_symsetentry(which_set, TRUE);
4772 if (ready_to_switch)
4773 switch_symbols(TRUE);
4775 if (Is_rogue_level(&u.uz)) {
4777 assign_graphics(ROGUESET);
4778 } else if (!rogueflag)
4779 assign_graphics(PRIMARY);
4784 /* didn't match any of the special options */
4790 #define rolestring(val, array, field) \
4791 ((val >= 0) ? array[val].field : (val == ROLE_RANDOM) ? randomrole : none)
4793 /* This is ugly. We have all the option names in the compopt[] array,
4794 but we need to look at each option individually to get the value. */
4795 STATIC_OVL const char *
4796 get_compopt_value(optname, buf)
4797 const char *optname;
4800 char ocl[MAXOCLASSES + 1];
4802 static const char none[] = "(none)", randomrole[] = "random",
4803 to_be_done[] = "(to be done)", defopt[] = "default",
4806 static const char none[] = "(
\82È
\82µ)", randomrole[] = "
\83\89\83\93\83_
\83\80",
4807 to_be_done[] = "(
\96¢
\90Ý
\92è)", defopt[] = "
\83f
\83t
\83H
\83\8b\83g",
4813 if (!strcmp(optname, "align_message"))
4816 iflags.wc_align_message == ALIGN_TOP
4818 : iflags.wc_align_message == ALIGN_LEFT
4820 : iflags.wc_align_message == ALIGN_BOTTOM
4822 : iflags.wc_align_message == ALIGN_RIGHT
4827 iflags.wc_align_message == ALIGN_TOP
4829 : iflags.wc_align_message == ALIGN_LEFT
4831 : iflags.wc_align_message == ALIGN_BOTTOM
4833 : iflags.wc_align_message == ALIGN_RIGHT
4834 ? "
\89E
\91¤" : defopt);
4836 else if (!strcmp(optname, "align_status"))
4839 iflags.wc_align_status == ALIGN_TOP
4841 : iflags.wc_align_status == ALIGN_LEFT
4843 : iflags.wc_align_status == ALIGN_BOTTOM
4845 : iflags.wc_align_status == ALIGN_RIGHT
4850 iflags.wc_align_status == ALIGN_TOP
4852 : iflags.wc_align_status == ALIGN_LEFT
4854 : iflags.wc_align_status == ALIGN_BOTTOM
4856 : iflags.wc_align_status == ALIGN_RIGHT
4860 else if (!strcmp(optname, "align"))
4861 Sprintf(buf, "%s", rolestring(flags.initalign, aligns, adj));
4863 else if (!strcmp(optname, "altkeyhandler"))
4866 iflags.altkeyhandler[0] ? iflags.altkeyhandler : "default");
4868 iflags.altkeyhandler[0] ? iflags.altkeyhandler : defopt);
4870 #ifdef BACKWARD_COMPAT
4871 else if (!strcmp(optname, "boulder"))
4875 : showsyms[(int) objects[BOULDER].oc_class + SYM_OFF_O]);
4877 else if (!strcmp(optname, "catname"))
4878 Sprintf(buf, "%s", catname[0] ? catname : none);
4879 else if (!strcmp(optname, "disclose"))
4880 for (i = 0; i < NUM_DISCLOSURE_OPTIONS; i++) {
4882 (void) strkitten(buf, ' ');
4883 (void) strkitten(buf, flags.end_disclose[i]);
4884 (void) strkitten(buf, disclosure_options[i]);
4886 else if (!strcmp(optname, "dogname"))
4887 Sprintf(buf, "%s", dogname[0] ? dogname : none);
4888 else if (!strcmp(optname, "dungeon"))
4889 Sprintf(buf, "%s", to_be_done);
4890 else if (!strcmp(optname, "effects"))
4891 Sprintf(buf, "%s", to_be_done);
4892 else if (!strcmp(optname, "font_map"))
4893 Sprintf(buf, "%s", iflags.wc_font_map ? iflags.wc_font_map : defopt);
4894 else if (!strcmp(optname, "font_message"))
4896 iflags.wc_font_message ? iflags.wc_font_message : defopt);
4897 else if (!strcmp(optname, "font_status"))
4899 iflags.wc_font_status ? iflags.wc_font_status : defopt);
4900 else if (!strcmp(optname, "font_menu"))
4902 iflags.wc_font_menu ? iflags.wc_font_menu : defopt);
4903 else if (!strcmp(optname, "font_text"))
4905 iflags.wc_font_text ? iflags.wc_font_text : defopt);
4906 else if (!strcmp(optname, "font_size_map")) {
4907 if (iflags.wc_fontsiz_map)
4908 Sprintf(buf, "%d", iflags.wc_fontsiz_map);
4910 Strcpy(buf, defopt);
4911 } else if (!strcmp(optname, "font_size_message")) {
4912 if (iflags.wc_fontsiz_message)
4913 Sprintf(buf, "%d", iflags.wc_fontsiz_message);
4915 Strcpy(buf, defopt);
4916 } else if (!strcmp(optname, "font_size_status")) {
4917 if (iflags.wc_fontsiz_status)
4918 Sprintf(buf, "%d", iflags.wc_fontsiz_status);
4920 Strcpy(buf, defopt);
4921 } else if (!strcmp(optname, "font_size_menu")) {
4922 if (iflags.wc_fontsiz_menu)
4923 Sprintf(buf, "%d", iflags.wc_fontsiz_menu);
4925 Strcpy(buf, defopt);
4926 } else if (!strcmp(optname, "font_size_text")) {
4927 if (iflags.wc_fontsiz_text)
4928 Sprintf(buf, "%d", iflags.wc_fontsiz_text);
4930 Strcpy(buf, defopt);
4931 } else if (!strcmp(optname, "fruit"))
4932 Sprintf(buf, "%s", pl_fruit);
4933 else if (!strcmp(optname, "gender"))
4934 Sprintf(buf, "%s", rolestring(flags.initgend, genders, adj));
4935 else if (!strcmp(optname, "horsename"))
4936 Sprintf(buf, "%s", horsename[0] ? horsename : none);
4937 else if (!strcmp(optname, "map_mode"))
4939 iflags.wc_map_mode == MAP_MODE_TILES
4941 : iflags.wc_map_mode == MAP_MODE_ASCII4x6
4943 : iflags.wc_map_mode == MAP_MODE_ASCII6x8
4945 : iflags.wc_map_mode == MAP_MODE_ASCII8x8
4947 : iflags.wc_map_mode == MAP_MODE_ASCII16x8
4949 : iflags.wc_map_mode == MAP_MODE_ASCII7x12
4951 : iflags.wc_map_mode == MAP_MODE_ASCII8x12
4953 : iflags.wc_map_mode
4954 == MAP_MODE_ASCII16x12
4956 : iflags.wc_map_mode
4957 == MAP_MODE_ASCII12x16
4959 : iflags.wc_map_mode
4960 == MAP_MODE_ASCII10x18
4962 : iflags.wc_map_mode
4963 == MAP_MODE_ASCII_FIT_TO_SCREEN
4966 else if (!strcmp(optname, "menustyle"))
4967 Sprintf(buf, "%s", menutype[(int) flags.menu_style]);
4968 else if (!strcmp(optname, "menu_deselect_all"))
4969 Sprintf(buf, "%s", to_be_done);
4970 else if (!strcmp(optname, "menu_deselect_page"))
4971 Sprintf(buf, "%s", to_be_done);
4972 else if (!strcmp(optname, "menu_first_page"))
4973 Sprintf(buf, "%s", to_be_done);
4974 else if (!strcmp(optname, "menu_invert_all"))
4975 Sprintf(buf, "%s", to_be_done);
4976 else if (!strcmp(optname, "menu_headings"))
4977 Sprintf(buf, "%s", attr2attrname(iflags.menu_headings));
4978 else if (!strcmp(optname, "menu_invert_page"))
4979 Sprintf(buf, "%s", to_be_done);
4980 else if (!strcmp(optname, "menu_last_page"))
4981 Sprintf(buf, "%s", to_be_done);
4982 else if (!strcmp(optname, "menu_next_page"))
4983 Sprintf(buf, "%s", to_be_done);
4984 else if (!strcmp(optname, "menu_previous_page"))
4985 Sprintf(buf, "%s", to_be_done);
4986 else if (!strcmp(optname, "menu_search"))
4987 Sprintf(buf, "%s", to_be_done);
4988 else if (!strcmp(optname, "menu_select_all"))
4989 Sprintf(buf, "%s", to_be_done);
4990 else if (!strcmp(optname, "menu_select_page"))
4991 Sprintf(buf, "%s", to_be_done);
4992 else if (!strcmp(optname, "monsters")) {
4993 Sprintf(buf, "%s", to_be_done);
4994 } else if (!strcmp(optname, "msghistory")) {
4995 Sprintf(buf, "%u", iflags.msg_history);
4997 } else if (!strcmp(optname, "msg_window")) {
4998 Sprintf(buf, "%s", (iflags.prevmsg_window == 's')
5000 : (iflags.prevmsg_window == 'c')
5002 : (iflags.prevmsg_window == 'f')
5006 } else if (!strcmp(optname, "name")) {
5007 Sprintf(buf, "%s", plname);
5008 } else if (!strcmp(optname, "number_pad")) {
5009 static const char *numpadmodes[] = {
5011 "0=off", "1=on", "2=on, MSDOS compatible",
5013 "0=
\96³
\8cø", "1=
\97L
\8cø", "2=
\97L
\8cø
\81CDOS
\8cÝ
\8a·",
5015 "3=on, phone-style layout",
5017 "3=
\97L
\8cø
\81C
\93d
\98b
\8e®
\82Ì
\90\94\8e\9a\94z
\92u",
5019 "4=on, phone layout, MSDOS compatible",
5021 "4=
\97L
\8cø
\81C
\93d
\98b
\8e®
\82Ì
\94z
\92u
\81CMSDOS
\8cÝ
\8a·",
5023 "-1=off, y & z swapped", /*[5]*/
5025 "-1=
\96³
\8cø
\81Cy
\82Æz
\82ð
\93ü
\82ê
\91Ö
\82¦", /*[5]*/
5028 int indx = Cmd.num_pad
5029 ? (Cmd.phone_layout ? (Cmd.pcHack_compat ? 4 : 3)
5030 : (Cmd.pcHack_compat ? 2 : 1))
5031 : Cmd.swap_yz ? 5 : 0;
5033 Strcpy(buf, numpadmodes[indx]);
5034 } else if (!strcmp(optname, "objects")) {
5035 Sprintf(buf, "%s", to_be_done);
5036 } else if (!strcmp(optname, "packorder")) {
5037 oc_to_str(flags.inv_order, ocl);
5038 Sprintf(buf, "%s", ocl);
5040 } else if (!strcmp(optname, "palette")) {
5041 Sprintf(buf, "%s", get_color_string());
5043 } else if (!strcmp(optname, "paranoid_confirmation")) {
5044 char tmpbuf[QBUFSZ];
5047 if (ParanoidConfirm)
5048 Strcat(tmpbuf, " Confirm");
5050 Strcat(tmpbuf, " quit");
5052 Strcat(tmpbuf, " die");
5054 Strcat(tmpbuf, " bones");
5056 Strcat(tmpbuf, " attack");
5058 Strcat(tmpbuf, " pray");
5060 Strcat(tmpbuf, " Remove");
5061 Strcpy(buf, tmpbuf[0] ? &tmpbuf[1] : "none");
5062 } else if (!strcmp(optname, "pettype")) {
5064 Sprintf(buf, "%s", (preferred_pet == 'c') ? "cat"
5065 : (preferred_pet == 'd') ? "dog"
5066 : (preferred_pet == 'h') ? "horse"
5067 : (preferred_pet == 'n') ? "none"
5070 Sprintf(buf, "%s", (preferred_pet == 'c') ? "
\94L"
5071 : (preferred_pet == 'd') ? "
\8c¢"
5072 : (preferred_pet == 'h') ? "
\94n"
5073 : (preferred_pet == 'n') ? "
\82È
\82µ"
5074 : "
\83\89\83\93\83_
\83\80");
5076 } else if (!strcmp(optname, "pickup_burden")) {
5077 Sprintf(buf, "%s", burdentype[flags.pickup_burden]);
5078 } else if (!strcmp(optname, "pickup_types")) {
5079 oc_to_str(flags.pickup_types, ocl);
5080 Sprintf(buf, "%s", ocl[0] ? ocl : "all");
5081 } else if (!strcmp(optname, "pile_limit")) {
5082 Sprintf(buf, "%d", flags.pile_limit);
5083 } else if (!strcmp(optname, "playmode")) {
5084 Strcpy(buf, wizard ? "debug" : discover ? "explore" : "normal");
5085 } else if (!strcmp(optname, "race")) {
5086 Sprintf(buf, "%s", rolestring(flags.initrace, races, noun));
5087 } else if (!strcmp(optname, "roguesymset")) {
5089 symset[ROGUESET].name ? symset[ROGUESET].name : "default");
5090 if (currentgraphics == ROGUESET && symset[ROGUESET].name)
5091 Strcat(buf, ", active");
5092 } else if (!strcmp(optname, "role")) {
5093 Sprintf(buf, "%s", rolestring(flags.initrole, roles, name.m));
5094 } else if (!strcmp(optname, "runmode")) {
5095 Sprintf(buf, "%s", runmodes[flags.runmode]);
5096 } else if (!strcmp(optname, "scores")) {
5097 Sprintf(buf, "%d top/%d around%s", flags.end_top, flags.end_around,
5098 flags.end_own ? "/own" : "");
5099 } else if (!strcmp(optname, "scroll_amount")) {
5100 if (iflags.wc_scroll_amount)
5101 Sprintf(buf, "%d", iflags.wc_scroll_amount);
5103 Strcpy(buf, defopt);
5104 } else if (!strcmp(optname, "scroll_margin")) {
5105 if (iflags.wc_scroll_margin)
5106 Sprintf(buf, "%d", iflags.wc_scroll_margin);
5108 Strcpy(buf, defopt);
5109 } else if (!strcmp(optname, "sortloot")) {
5110 for (i = 0; i < SIZE(sortltype); i++)
5111 if (flags.sortloot == sortltype[i][0]) {
5112 Strcpy(buf, sortltype[i]);
5115 } else if (!strcmp(optname, "player_selection")) {
5117 Sprintf(buf, "%s", iflags.wc_player_selection ? "prompts" : "dialog");
5119 Sprintf(buf, "%s
\93ü
\97Í", iflags.wc_player_selection ? "
\83v
\83\8d\83\93\83v
\83g" : "
\83_
\83C
\83A
\83\8d\83O");
5122 } else if (!strcmp(optname, "soundcard")) {
5123 Sprintf(buf, "%s", to_be_done);
5125 } else if (!strcmp(optname, "suppress_alert")) {
5126 if (flags.suppress_alert == 0L)
5129 Sprintf(buf, "%lu.%lu.%lu", FEATURE_NOTICE_VER_MAJ,
5130 FEATURE_NOTICE_VER_MIN, FEATURE_NOTICE_VER_PATCH);
5131 } else if (!strcmp(optname, "symset")) {
5133 symset[PRIMARY].name ? symset[PRIMARY].name : "default");
5134 if (currentgraphics == PRIMARY && symset[PRIMARY].name)
5135 Strcat(buf, ", active");
5136 } else if (!strcmp(optname, "tile_file")) {
5138 iflags.wc_tile_file ? iflags.wc_tile_file : defopt);
5139 } else if (!strcmp(optname, "tile_height")) {
5140 if (iflags.wc_tile_height)
5141 Sprintf(buf, "%d", iflags.wc_tile_height);
5143 Strcpy(buf, defopt);
5144 } else if (!strcmp(optname, "tile_width")) {
5145 if (iflags.wc_tile_width)
5146 Sprintf(buf, "%d", iflags.wc_tile_width);
5148 Strcpy(buf, defopt);
5149 } else if (!strcmp(optname, "traps")) {
5150 Sprintf(buf, "%s", to_be_done);
5151 } else if (!strcmp(optname, "vary_msgcount")) {
5152 if (iflags.wc_vary_msgcount)
5153 Sprintf(buf, "%d", iflags.wc_vary_msgcount);
5155 Strcpy(buf, defopt);
5157 } else if (!strcmp(optname, "video")) {
5158 Sprintf(buf, "%s", to_be_done);
5161 } else if (!strcmp(optname, "videoshades")) {
5162 Sprintf(buf, "%s-%s-%s", shade[0], shade[1], shade[2]);
5163 } else if (!strcmp(optname, "videocolors")) {
5164 Sprintf(buf, "%d-%d-%d-%d-%d-%d-%d-%d-%d-%d-%d-%d",
5165 ttycolors[CLR_RED], ttycolors[CLR_GREEN],
5166 ttycolors[CLR_BROWN], ttycolors[CLR_BLUE],
5167 ttycolors[CLR_MAGENTA], ttycolors[CLR_CYAN],
5168 ttycolors[CLR_ORANGE], ttycolors[CLR_BRIGHT_GREEN],
5169 ttycolors[CLR_YELLOW], ttycolors[CLR_BRIGHT_BLUE],
5170 ttycolors[CLR_BRIGHT_MAGENTA], ttycolors[CLR_BRIGHT_CYAN]);
5171 #endif /* VIDEOSHADES */
5172 } else if (!strcmp(optname, "windowtype")) {
5173 Sprintf(buf, "%s", windowprocs.name);
5174 } else if (!strcmp(optname, "windowcolors")) {
5176 buf, "%s/%s %s/%s %s/%s %s/%s",
5177 iflags.wc_foregrnd_menu ? iflags.wc_foregrnd_menu : defbrief,
5178 iflags.wc_backgrnd_menu ? iflags.wc_backgrnd_menu : defbrief,
5179 iflags.wc_foregrnd_message ? iflags.wc_foregrnd_message
5181 iflags.wc_backgrnd_message ? iflags.wc_backgrnd_message
5183 iflags.wc_foregrnd_status ? iflags.wc_foregrnd_status : defbrief,
5184 iflags.wc_backgrnd_status ? iflags.wc_backgrnd_status : defbrief,
5185 iflags.wc_foregrnd_text ? iflags.wc_foregrnd_text : defbrief,
5186 iflags.wc_backgrnd_text ? iflags.wc_backgrnd_text : defbrief);
5187 #ifdef PREFIXES_IN_USE
5189 for (i = 0; i < PREFIX_COUNT; ++i)
5190 if (!strcmp(optname, fqn_prefix_names[i]) && fqn_prefix[i])
5191 Sprintf(buf, "%s", fqn_prefix[i]);
5207 char buf[BUFSZ], ocl[MAXOCLASSES + 1];
5209 flags.pickup = !flags.pickup;
5211 oc_to_str(flags.pickup_types, ocl);
5213 Sprintf(buf, "ON, for %s objects%s", ocl[0] ? ocl : "all",
5214 (iflags.autopickup_exceptions[AP_LEAVE]
5215 || iflags.autopickup_exceptions[AP_GRAB])
5216 ? ((count_ape_maps((int *) 0, (int *) 0) == 1)
5217 ? ", with one exception"
5218 : ", with some exceptions")
5221 Sprintf(buf, "%s
\83A
\83C
\83e
\83\80\82É
\82Â
\82¢
\82Ä
\83I
\83\93%s", ocl[0] ? ocl : "
\91S
\82Ä
\82Ì",
5222 (iflags.autopickup_exceptions[AP_LEAVE]
5223 || iflags.autopickup_exceptions[AP_GRAB])
5224 ? "
\81C
\97á
\8aO
\82 \82è"
5231 Strcpy(buf, "
\83I
\83t");
5234 pline("Autopickup: %s.", buf);
5236 pline("
\8e©
\93®
\8fE
\82¢
\81F%s
\81D", buf);
5241 add_autopickup_exception(mapping)
5242 const char *mapping;
5244 struct autopickup_exception *ape, **apehead;
5245 char text[256], *text2;
5246 boolean grab = FALSE;
5248 if (sscanf(mapping, "\"%255[^\"]\"", text) == 1) {
5250 if (*text2 == '<') { /* force autopickup */
5253 } else if (*text2 == '>') { /* default - Do not pickup */
5257 apehead = (grab) ? &iflags.autopickup_exceptions[AP_GRAB]
5258 : &iflags.autopickup_exceptions[AP_LEAVE];
5259 ape = (struct autopickup_exception *) alloc(
5260 sizeof (struct autopickup_exception));
5261 ape->regex = regex_init();
5262 if (!regex_compile(text2, ape->regex)) {
5263 raw_print("regex error in AUTOPICKUP_EXCEPTION");
5264 regex_free(ape->regex);
5265 free((genericptr_t) ape);
5268 ape->pattern = (char *) alloc(strlen(text2) + 1);
5269 strcpy(ape->pattern, text2);
5271 ape->next = *apehead;
5274 raw_print("syntax error in AUTOPICKUP_EXCEPTION");
5281 remove_autopickup_exception(whichape)
5282 struct autopickup_exception *whichape;
5284 struct autopickup_exception *ape, *prev = 0;
5285 int chain = whichape->grab ? AP_GRAB : AP_LEAVE;
5287 for (ape = iflags.autopickup_exceptions[chain]; ape;) {
5288 if (ape == whichape) {
5289 struct autopickup_exception *freeape = ape;
5295 iflags.autopickup_exceptions[chain] = ape;
5296 regex_free(freeape->regex);
5297 free((genericptr_t) freeape->pattern);
5298 free((genericptr_t) freeape);
5307 count_ape_maps(leave, grab)
5310 struct autopickup_exception *ape;
5311 int pass, totalapes, numapes[2] = { 0, 0 };
5313 for (pass = AP_LEAVE; pass <= AP_GRAB; ++pass) {
5314 ape = iflags.autopickup_exceptions[pass];
5320 totalapes = numapes[AP_LEAVE] + numapes[AP_GRAB];
5322 *leave = numapes[AP_LEAVE];
5324 *grab = numapes[AP_GRAB];
5329 free_autopickup_exceptions()
5331 struct autopickup_exception *ape;
5334 for (pass = AP_LEAVE; pass <= AP_GRAB; ++pass) {
5335 while ((ape = iflags.autopickup_exceptions[pass]) != 0) {
5336 regex_free(ape->regex);
5337 free((genericptr_t) ape->pattern);
5338 iflags.autopickup_exceptions[pass] = ape->next;
5339 free((genericptr_t) ape);
5344 /* bundle some common usage into one easy-to-use routine */
5346 load_symset(s, which_set)
5350 clear_symsetentry(which_set, TRUE);
5352 if (symset[which_set].name)
5353 free((genericptr_t) symset[which_set].name);
5354 symset[which_set].name = dupstr(s);
5356 if (read_sym_file(which_set)) {
5357 switch_symbols(TRUE);
5359 clear_symsetentry(which_set, TRUE);
5368 clear_symsetentry(PRIMARY, TRUE);
5369 clear_symsetentry(ROGUESET, TRUE);
5371 /* symset_list is cleaned up as soon as it's used, so we shouldn't
5372 have to anything about it here */
5373 /* assert( symset_list == NULL ); */
5376 /* Parse the value of a SYMBOLS line from a config file */
5379 register char *opts;
5382 char *op, *symname, *strval;
5383 struct symparse *symp;
5385 if ((op = index(opts, ',')) != 0) {
5390 /* S_sample:string */
5392 strval = index(opts, ':');
5394 strval = index(opts, '=');
5399 /* strip leading and trailing white space from symname and strval */
5400 mungspaces(symname);
5403 symp = match_sym(symname);
5407 if (symp->range && symp->range != SYM_CONTROL) {
5408 val = sym_val(strval);
5409 update_l_symset(symp, val);
5417 size_t len = strlen(buf);
5418 const char *p = index(buf, ':'), *q = index(buf, '=');
5419 struct symparse *sp = loadsyms;
5421 if (!p || (q && q < p))
5424 /* note: there will be at most one space before the '='
5425 because caller has condensed buf[] with mungspaces() */
5426 if (p > buf && p[-1] == ' ')
5428 len = (int) (p - buf);
5431 if ((len >= strlen(sp->name)) && !strncmpi(buf, sp->name, len))
5435 return (struct symparse *) 0;
5444 escapes(strval, buf);
5448 /* data for option_help() */
5449 static const char *opt_intro[] = {
5451 "", " NetHack Options Help:", "",
5453 "", " NetHack
\83I
\83v
\83V
\83\87\83\93\83w
\83\8b\83v
\81F", "",
5454 #define CONFIG_SLOT 3 /* fill in next value at run-time */
5456 #if !defined(MICRO) && !defined(MAC)
5458 "or use `NETHACKOPTIONS=\"<options>\"' in your environment",
5460 "
\82Ü
\82½
\82Í
\8aÂ
\8b«
\95Ï
\90\94\82É`NETHACKOPTIONS=\"<options>\"'
\82Æ
\92è
\8b`
\82Å
\82«
\82Ü
\82·",
5463 "(<options> is a list of options separated by commas)",
5465 "(<options>
\82Í
\83J
\83\93\83}
\82Å
\8bæ
\90Ø
\82Á
\82½
\83I
\83v
\83V
\83\87\83\93\82Å
\82·)",
5468 "-- for example, $ DEFINE NETHACKOPTIONS \"noautopickup,fruit:kumquat\"",
5470 "--
\97á
\82¦
\82Î
\8e\9f\82Ì
\82æ
\82¤
\82É
\82µ
\82Ü
\82·
\81F$ DEFINE NETHACKOPTIONS \"noautopickup,fruit:kumquat\"",
5473 "or press \"O\" while playing and use the menu.", "",
5475 "
\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",
5477 "Boolean options (which can be negated by prefixing them with '!' or \"no\"):",
5479 "
\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·):",
5483 static const char *opt_epilog[] = {
5486 "Some of the options can be set only before the game is started; those",
5488 "
\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",
5490 "items will not be selectable in the 'O' command's menu.", (char *) 0
5492 "
\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", (char *) 0
5498 char buf[BUFSZ], buf2[BUFSZ];
5502 datawin = create_nhwindow(NHW_TEXT);
5504 Sprintf(buf, "Set options as OPTIONS=<options> in %s", lastconfigfile);
5506 Sprintf(buf, "
\83I
\83v
\83V
\83\87\83\93\82Í%s
\82Ì
\92\86\82ÅOPTIONS=<options>
\82Æ
\90Ý
\92è
\82µ
\82Ü
\82·", lastconfigfile);
5507 opt_intro[CONFIG_SLOT] = (const char *) buf;
5508 for (i = 0; opt_intro[i]; i++)
5509 putstr(datawin, 0, opt_intro[i]);
5511 /* Boolean options */
5512 for (i = 0; boolopt[i].name; i++) {
5513 if (boolopt[i].addr) {
5514 if (boolopt[i].addr == &iflags.sanity_check && !wizard)
5516 if (boolopt[i].addr == &iflags.menu_tab_sep && !wizard)
5518 next_opt(datawin, boolopt[i].name);
5521 next_opt(datawin, "");
5523 /* Compound options */
5525 putstr(datawin, 0, "Compound options:");
5527 putstr(datawin, 0, "
\95¶
\8e\9a\97ñ
\83I
\83v
\83V
\83\87\83\93:");
5528 for (i = 0; compopt[i].name; i++) {
5529 Sprintf(buf2, "`%s'", compopt[i].name);
5530 Sprintf(buf, "%-20s - %s%c", buf2, compopt[i].descr,
5531 compopt[i + 1].name ? ',' : '.');
5532 putstr(datawin, 0, buf);
5535 for (i = 0; opt_epilog[i]; i++)
5536 putstr(datawin, 0, opt_epilog[i]);
5538 display_nhwindow(datawin, FALSE);
5539 destroy_nhwindow(datawin);
5544 * prints the next boolean option, on the same line if possible, on a new
5545 * line if not. End with next_opt("").
5548 next_opt(datawin, str)
5552 static char *buf = 0;
5557 *(buf = (char *) alloc(BUFSZ)) = '\0';
5561 if (s > &buf[1] && s[-2] == ',')
5562 Strcpy(s - 2, "."); /* replace last ", " */
5563 i = COLNO; /* (greater than COLNO - 2) */
5565 i = strlen(buf) + strlen(str) + 2;
5568 if (i > COLNO - 2) { /* rule of thumb */
5569 putstr(datawin, 0, buf);
5576 putstr(datawin, 0, str);
5577 free((genericptr_t) buf), buf = 0;
5582 /* Returns the fid of the fruit type; if that type already exists, it
5583 * returns the fid of that one; if it does not exist, it adds a new fruit
5584 * type to the chain and returns the new one.
5585 * If replace_fruit is sent in, replace the fruit in the chain rather than
5586 * adding a new entry--for user specified fruits only.
5589 fruitadd(str, replace_fruit)
5591 struct fruit *replace_fruit;
5594 register struct fruit *f;
5595 int highest_fruit_id = 0;
5596 char buf[PL_FSIZ], altname[PL_FSIZ];
5597 boolean user_specified = (str == pl_fruit);
5598 /* if not user-specified, then it's a fruit name for a fruit on
5602 /* Note: every fruit has an id (kept in obj->spe) of at least 1;
5605 if (user_specified) {
5606 boolean found = FALSE, numeric = FALSE;
5608 /* force fruit to be singular; this handling is not
5609 needed--or wanted--for fruits from bones because
5610 they already received it in their original game */
5611 nmcpy(pl_fruit, makesingular(str), PL_FSIZ);
5612 /* assert( str == pl_fruit ); */
5614 /* disallow naming after other foods (since it'd be impossible
5615 * to tell the difference)
5618 for (i = bases[FOOD_CLASS]; objects[i].oc_class == FOOD_CLASS; i++) {
5619 if (!strcmp(OBJ_NAME(objects[i]), pl_fruit)) {
5629 for (c = pl_fruit; *c >= '0' && *c <= '9'; c++)
5631 if (isspace((uchar) *c) || *c == 0)
5634 if (found || numeric || !strncmp(str, "cursed ", 7)
5635 || !strncmp(str, "uncursed ", 9) || !strncmp(str, "blessed ", 8)
5636 || !strncmp(str, "partly eaten ", 13)
5637 || (!strncmp(str, "tin of ", 7)
5638 && (!strcmp(str + 7, "spinach")
5639 || name_to_mon(str + 7) >= LOW_PM))
5640 || !strcmp(str, "empty tin")
5641 || ((str_end_is(str, " corpse")
5642 || str_end_is(str, " egg"))
5643 && name_to_mon(str) >= LOW_PM)) {
5644 Strcpy(buf, pl_fruit);
5645 Strcpy(pl_fruit, "candied ");
5646 nmcpy(pl_fruit + 8, buf, PL_FSIZ - 8);
5649 /* This flag indicates that a fruit has been made since the
5650 * last time the user set the fruit. If it hasn't, we can
5651 * safely overwrite the current fruit, preventing the user from
5652 * setting many fruits in a row and overflowing.
5653 * Possible expansion: check for specific fruit IDs, not for
5656 flags.made_fruit = FALSE;
5657 if (replace_fruit) {
5658 for (f = ffruit; f; f = f->nextf) {
5659 if (f == replace_fruit) {
5660 copynchars(f->fname, str, PL_FSIZ - 1);
5666 /* not user_supplied, so assumed to be from bones */
5667 copynchars(altname, str, PL_FSIZ - 1);
5668 sanitize_name(altname);
5669 flags.made_fruit = TRUE; /* for safety. Any fruit name added from a
5670 bones level should exist anyway. */
5672 for (f = ffruit; f; f = f->nextf) {
5673 if (f->fid > highest_fruit_id)
5674 highest_fruit_id = f->fid;
5675 if (!strncmp(str, f->fname, PL_FSIZ - 1)
5676 || (*altname && !strcmp(altname, f->fname)))
5679 /* if adding another fruit would overflow spe, use a random
5680 fruit instead... we've got a lot to choose from.
5681 current_fruit remains as is. */
5682 if (highest_fruit_id >= 127)
5686 copynchars(f->fname, *altname ? altname : str, PL_FSIZ - 1);
5687 f->fid = ++highest_fruit_id;
5688 /* we used to go out of our way to add it at the end of the list,
5689 but the order is arbitrary so use simpler insertion at start */
5694 context.current_fruit = f->fid;
5699 * This is a somewhat generic menu for taking a list of NetHack style
5700 * class choices and presenting them via a description
5701 * rather than the traditional NetHack characters.
5702 * (Benefits users whose first exposure to NetHack is via tiles).
5705 * The title at the top of the menu.
5707 * category: 0 = monster class
5711 * FALSE = PICK_ONE, TRUE = PICK_ANY
5714 * a null terminated string containing the list of choices.
5717 * a null terminated string containing the selected characters.
5719 * Returns number selected.
5722 choose_classes_menu(prompt, category, way, class_list, class_select)
5729 menu_item *pick_list = (menu_item *) 0;
5735 int next_accelerator, accelerator;
5737 if (class_list == (char *) 0 || class_select == (char *) 0)
5740 next_accelerator = 'a';
5742 win = create_nhwindow(NHW_MENU);
5744 while (*class_list) {
5752 text = def_monsyms[def_char_to_monclass(*class_list)].explain;
5753 accelerator = *class_list;
5754 Sprintf(buf, "%s", text);
5757 text = def_oc_syms[def_char_to_objclass(*class_list)].explain;
5758 accelerator = next_accelerator;
5759 Sprintf(buf, "%c %s", *class_list, text);
5762 impossible("choose_classes_menu: invalid category %d", category);
5764 if (way && *class_select) { /* Selections there already */
5765 if (index(class_select, *class_list)) {
5769 any.a_int = *class_list;
5770 add_menu(win, NO_GLYPH, &any, accelerator, category ? *class_list : 0,
5771 ATR_NONE, buf, selected);
5775 if (next_accelerator == ('z' + 1))
5776 next_accelerator = 'A';
5777 if (next_accelerator == ('Z' + 1))
5781 end_menu(win, prompt);
5782 n = select_menu(win, way ? PICK_ANY : PICK_ONE, &pick_list);
5783 destroy_nhwindow(win);
5785 for (i = 0; i < n; ++i)
5786 *class_select++ = (char) pick_list[i].item.a_int;
5787 free((genericptr_t) pick_list);
5789 } else if (n == -1) {
5790 class_select = eos(class_select);
5794 *class_select = '\0';
5798 struct wc_Opt wc_options[] = { { "ascii_map", WC_ASCII_MAP },
5799 { "color", WC_COLOR },
5800 { "eight_bit_tty", WC_EIGHT_BIT_IN },
5801 { "hilite_pet", WC_HILITE_PET },
5802 { "popup_dialog", WC_POPUP_DIALOG },
5803 { "player_selection", WC_PLAYER_SELECTION },
5804 { "preload_tiles", WC_PRELOAD_TILES },
5805 { "tiled_map", WC_TILED_MAP },
5806 { "tile_file", WC_TILE_FILE },
5807 { "tile_width", WC_TILE_WIDTH },
5808 { "tile_height", WC_TILE_HEIGHT },
5809 { "use_inverse", WC_INVERSE },
5810 { "align_message", WC_ALIGN_MESSAGE },
5811 { "align_status", WC_ALIGN_STATUS },
5812 { "font_map", WC_FONT_MAP },
5813 { "font_menu", WC_FONT_MENU },
5814 { "font_message", WC_FONT_MESSAGE },
5816 {"perm_invent", WC_PERM_INVENT},
5818 { "font_size_map", WC_FONTSIZ_MAP },
5819 { "font_size_menu", WC_FONTSIZ_MENU },
5820 { "font_size_message", WC_FONTSIZ_MESSAGE },
5821 { "font_size_status", WC_FONTSIZ_STATUS },
5822 { "font_size_text", WC_FONTSIZ_TEXT },
5823 { "font_status", WC_FONT_STATUS },
5824 { "font_text", WC_FONT_TEXT },
5825 { "map_mode", WC_MAP_MODE },
5826 { "scroll_amount", WC_SCROLL_AMOUNT },
5827 { "scroll_margin", WC_SCROLL_MARGIN },
5828 { "splash_screen", WC_SPLASH_SCREEN },
5829 { "vary_msgcount", WC_VARY_MSGCOUNT },
5830 { "windowcolors", WC_WINDOWCOLORS },
5831 { "mouse_support", WC_MOUSE_SUPPORT },
5832 { (char *) 0, 0L } };
5834 struct wc_Opt wc2_options[] = { { "fullscreen", WC2_FULLSCREEN },
5835 { "softkeyboard", WC2_SOFTKEYBOARD },
5836 { "wraptext", WC2_WRAPTEXT },
5837 { "use_darkgray", WC2_DARKGRAY },
5838 #ifdef STATUS_VIA_WINDOWPORT
5839 { "hilite_status", WC2_HILITE_STATUS },
5841 { (char *) 0, 0L } };
5844 * If a port wants to change or ensure that the SET_IN_SYS,
5845 * SET_IN_FILE, DISP_IN_GAME, or SET_IN_GAME status of an option is
5846 * correct (for controlling its display in the option menu) call
5847 * set_option_mod_status()
5848 * with the appropriate second argument.
5851 set_option_mod_status(optnam, status)
5857 if (SET__IS_VALUE_VALID(status)) {
5858 impossible("set_option_mod_status: status out of range %d.", status);
5861 for (k = 0; boolopt[k].name; k++) {
5862 if (!strncmpi(boolopt[k].name, optnam, strlen(optnam))) {
5863 boolopt[k].optflags = status;
5867 for (k = 0; compopt[k].name; k++) {
5868 if (!strncmpi(compopt[k].name, optnam, strlen(optnam))) {
5869 compopt[k].optflags = status;
5876 * You can set several wc_options in one call to
5877 * set_wc_option_mod_status() by setting
5878 * the appropriate bits for each option that you
5879 * are setting in the optmask argument
5881 * example: set_wc_option_mod_status(WC_COLOR|WC_SCROLL_MARGIN,
5885 set_wc_option_mod_status(optmask, status)
5886 unsigned long optmask;
5891 if (SET__IS_VALUE_VALID(status)) {
5892 impossible("set_wc_option_mod_status: status out of range %d.",
5896 while (wc_options[k].wc_name) {
5897 if (optmask & wc_options[k].wc_bit) {
5898 set_option_mod_status(wc_options[k].wc_name, status);
5905 is_wc_option(optnam)
5910 while (wc_options[k].wc_name) {
5911 if (strcmp(wc_options[k].wc_name, optnam) == 0)
5919 wc_supported(optnam)
5924 while (wc_options[k].wc_name) {
5925 if (!strcmp(wc_options[k].wc_name, optnam)
5926 && (windowprocs.wincap & wc_options[k].wc_bit))
5934 * You can set several wc2_options in one call to
5935 * set_wc2_option_mod_status() by setting
5936 * the appropriate bits for each option that you
5937 * are setting in the optmask argument
5940 * set_wc2_option_mod_status(WC2_FULLSCREEN|WC2_SOFTKEYBOARD|WC2_WRAPTEXT,
5945 set_wc2_option_mod_status(optmask, status)
5946 unsigned long optmask;
5951 if (SET__IS_VALUE_VALID(status)) {
5952 impossible("set_wc2_option_mod_status: status out of range %d.",
5956 while (wc2_options[k].wc_name) {
5957 if (optmask & wc2_options[k].wc_bit) {
5958 set_option_mod_status(wc2_options[k].wc_name, status);
5965 is_wc2_option(optnam)
5970 while (wc2_options[k].wc_name) {
5971 if (strcmp(wc2_options[k].wc_name, optnam) == 0)
5979 wc2_supported(optnam)
5984 while (wc2_options[k].wc_name) {
5985 if (!strcmp(wc2_options[k].wc_name, optnam)
5986 && (windowprocs.wincap2 & wc2_options[k].wc_bit))
5994 wc_set_font_name(opttype, fontname)
5998 char **fn = (char **) 0;
6004 fn = &iflags.wc_font_map;
6006 case MESSAGE_OPTION:
6007 fn = &iflags.wc_font_message;
6010 fn = &iflags.wc_font_text;
6013 fn = &iflags.wc_font_menu;
6016 fn = &iflags.wc_font_status;
6023 free((genericptr_t) *fn);
6024 *fn = dupstr(fontname);
6030 wc_set_window_colors(op)
6034 * menu white/black message green/yellow status white/blue text
6039 char *wn, *tfg, *tbg, *newop;
6040 static const char *wnames[] = { "menu", "message", "status", "text" };
6041 static const char *shortnames[] = { "mnu", "msg", "sts", "txt" };
6042 static char **fgp[] = { &iflags.wc_foregrnd_menu,
6043 &iflags.wc_foregrnd_message,
6044 &iflags.wc_foregrnd_status,
6045 &iflags.wc_foregrnd_text };
6046 static char **bgp[] = { &iflags.wc_backgrnd_menu,
6047 &iflags.wc_backgrnd_message,
6048 &iflags.wc_backgrnd_status,
6049 &iflags.wc_backgrnd_text };
6052 newop = mungspaces(buf);
6053 while (newop && *newop) {
6054 wn = tfg = tbg = (char *) 0;
6056 /* until first non-space in case there's leading spaces - before
6065 /* until first space - colorname*/
6066 while (*newop && *newop != ' ')
6074 /* until first non-space - before foreground*/
6082 /* until slash - foreground */
6083 while (*newop && *newop != '/')
6091 /* until first non-space (in case there's leading space after slash) -
6092 * before background */
6100 /* until first space - background */
6101 while (*newop && *newop != ' ')
6106 for (j = 0; j < 4; ++j) {
6107 if (!strcmpi(wn, wnames[j]) || !strcmpi(wn, shortnames[j])) {
6108 if (tfg && !strstri(tfg, " ")) {
6110 free((genericptr_t) *fgp[j]);
6111 *fgp[j] = dupstr(tfg);
6113 if (tbg && !strstri(tbg, " ")) {
6115 free((genericptr_t) *bgp[j]);
6116 *bgp[j] = dupstr(tbg);
6125 /* set up for wizard mode if player or save file has requested to it;
6126 called from port-specific startup code to handle `nethack -D' or
6127 OPTIONS=playmode:debug, or from dorecover()'s restgamestate() if
6128 restoring a game which was saved in wizard mode */
6133 if (authorize_wizard_mode())
6134 Strcpy(plname, "wizard");
6136 wizard = FALSE; /* not allowed or not available */
6137 /* force explore mode if we didn't make it into wizard mode */
6139 iflags.deferred_X = FALSE;
6141 /* don't need to do anything special for explore mode or normal play */
6144 #endif /* OPTION_LISTS_ONLY */