1 /* NetHack 3.6 cmd.c $NHDT-Date: 1523306904 2018/04/09 20:48:24 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.281 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /*-Copyright (c) Robert Patrick Rankin, 2013. */
4 /* NetHack may be freely redistributed. See license for details. */
6 /* JNetHack Copyright */
7 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000 */
8 /* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2018 */
9 /* JNetHack may be freely redistributed. See license for details. */
16 STATIC_VAR boolean alt_esc = FALSE;
19 struct cmd Cmd = { 0 }; /* flag.h */
21 extern const char *hu_stat[]; /* hunger status from eat.c */
22 extern const char *enc_stat[]; /* encumbrance status from botl.c */
26 * Some systems may have getchar() return EOF for various reasons, and
27 * we should not quit before seeing at least NR_OF_EOFS consecutive EOFs.
29 #if defined(SYSV) || defined(DGUX) || defined(HPUX)
34 #define CMD_TRAVEL (char) 0x90
35 #define CMD_CLICKLOOK (char) 0x8F
38 extern int NDECL(wiz_debug_cmd_bury);
39 extern int NDECL(wiz_debug_cmd_traveldisplay);
42 #ifdef DUMB /* stuff commented out in extern.h, but needed here */
43 extern int NDECL(doapply); /**/
44 extern int NDECL(dorub); /**/
45 extern int NDECL(dojump); /**/
46 extern int NDECL(doextlist); /**/
47 extern int NDECL(enter_explore_mode); /**/
48 extern int NDECL(dodrop); /**/
49 extern int NDECL(doddrop); /**/
50 extern int NDECL(dodown); /**/
51 extern int NDECL(doup); /**/
52 extern int NDECL(donull); /**/
53 extern int NDECL(dowipe); /**/
54 extern int NDECL(docallcnd); /**/
55 extern int NDECL(dotakeoff); /**/
56 extern int NDECL(doremring); /**/
57 extern int NDECL(dowear); /**/
58 extern int NDECL(doputon); /**/
59 extern int NDECL(doddoremarm); /**/
60 extern int NDECL(dokick); /**/
61 extern int NDECL(dofire); /**/
62 extern int NDECL(dothrow); /**/
63 extern int NDECL(doeat); /**/
64 extern int NDECL(done2); /**/
65 extern int NDECL(vanquished); /**/
66 extern int NDECL(doengrave); /**/
67 extern int NDECL(dopickup); /**/
68 extern int NDECL(ddoinv); /**/
69 extern int NDECL(dotypeinv); /**/
70 extern int NDECL(dolook); /**/
71 extern int NDECL(doprgold); /**/
72 extern int NDECL(doprwep); /**/
73 extern int NDECL(doprarm); /**/
74 extern int NDECL(doprring); /**/
75 extern int NDECL(dopramulet); /**/
76 extern int NDECL(doprtool); /**/
77 extern int NDECL(dosuspend); /**/
78 extern int NDECL(doforce); /**/
79 extern int NDECL(doopen); /**/
80 extern int NDECL(doclose); /**/
81 extern int NDECL(dosh); /**/
82 extern int NDECL(dodiscovered); /**/
83 extern int NDECL(doclassdisco); /**/
84 extern int NDECL(doset); /**/
85 extern int NDECL(dotogglepickup); /**/
86 extern int NDECL(dowhatis); /**/
87 extern int NDECL(doquickwhatis); /**/
88 extern int NDECL(dowhatdoes); /**/
89 extern int NDECL(dohelp); /**/
90 extern int NDECL(dohistory); /**/
91 extern int NDECL(doloot); /**/
92 extern int NDECL(dodrink); /**/
93 extern int NDECL(dodip); /**/
94 extern int NDECL(dosacrifice); /**/
95 extern int NDECL(dopray); /**/
96 extern int NDECL(dotip); /**/
97 extern int NDECL(doturn); /**/
98 extern int NDECL(doredraw); /**/
99 extern int NDECL(doread); /**/
100 extern int NDECL(dosave); /**/
101 extern int NDECL(dosearch); /**/
102 extern int NDECL(doidtrap); /**/
103 extern int NDECL(dopay); /**/
104 extern int NDECL(dosit); /**/
105 extern int NDECL(dotalk); /**/
106 extern int NDECL(docast); /**/
107 extern int NDECL(dovspell); /**/
108 extern int NDECL(dotele); /**/
109 extern int NDECL(dountrap); /**/
110 extern int NDECL(doversion); /**/
111 extern int NDECL(doextversion); /**/
112 extern int NDECL(doswapweapon); /**/
113 extern int NDECL(dowield); /**/
114 extern int NDECL(dowieldquiver); /**/
115 extern int NDECL(dozap); /**/
116 extern int NDECL(doorganize); /**/
119 static int NDECL(dosuspend_core); /**/
121 static int NDECL((*timed_occ_fn));
123 STATIC_PTR int NDECL(doherecmdmenu);
124 STATIC_PTR int NDECL(dotherecmdmenu);
125 STATIC_PTR int NDECL(doprev_message);
126 STATIC_PTR int NDECL(timed_occupation);
127 STATIC_PTR int NDECL(doextcmd);
128 STATIC_PTR int NDECL(dotravel);
129 STATIC_PTR int NDECL(doterrain);
130 STATIC_PTR int NDECL(wiz_wish);
131 STATIC_PTR int NDECL(wiz_identify);
132 STATIC_PTR int NDECL(wiz_intrinsic);
133 STATIC_PTR int NDECL(wiz_map);
134 STATIC_PTR int NDECL(wiz_makemap);
135 STATIC_PTR int NDECL(wiz_genesis);
136 STATIC_PTR int NDECL(wiz_where);
137 STATIC_PTR int NDECL(wiz_detect);
138 STATIC_PTR int NDECL(wiz_panic);
139 STATIC_PTR int NDECL(wiz_polyself);
140 STATIC_PTR int NDECL(wiz_level_tele);
141 STATIC_PTR int NDECL(wiz_level_change);
142 STATIC_PTR int NDECL(wiz_show_seenv);
143 STATIC_PTR int NDECL(wiz_show_vision);
144 STATIC_PTR int NDECL(wiz_smell);
145 STATIC_PTR int NDECL(wiz_intrinsic);
146 STATIC_PTR int NDECL(wiz_mon_polycontrol);
147 STATIC_PTR int NDECL(wiz_show_wmodes);
148 STATIC_DCL void NDECL(wiz_map_levltyp);
149 STATIC_DCL void NDECL(wiz_levltyp_legend);
150 #if defined(__BORLANDC__) && !defined(_WIN32)
151 extern void FDECL(show_borlandc_stats, (winid));
153 #ifdef DEBUG_MIGRATING_MONS
154 STATIC_PTR int NDECL(wiz_migrate_mons);
156 STATIC_DCL int FDECL(size_monst, (struct monst *, BOOLEAN_P));
157 STATIC_DCL int FDECL(size_obj, (struct obj *));
158 STATIC_DCL void FDECL(count_obj, (struct obj *, long *, long *,
159 BOOLEAN_P, BOOLEAN_P));
160 STATIC_DCL void FDECL(obj_chain, (winid, const char *, struct obj *,
161 BOOLEAN_P, long *, long *));
162 STATIC_DCL void FDECL(mon_invent_chain, (winid, const char *, struct monst *,
164 STATIC_DCL void FDECL(mon_chain, (winid, const char *, struct monst *,
165 BOOLEAN_P, long *, long *));
166 STATIC_DCL void FDECL(contained_stats, (winid, const char *, long *, long *));
167 STATIC_DCL void FDECL(misc_stats, (winid, long *, long *));
168 STATIC_PTR int NDECL(wiz_show_stats);
169 STATIC_DCL boolean FDECL(accept_menu_prefix, (int NDECL((*))));
171 STATIC_DCL int NDECL(wiz_port_debug);
173 STATIC_PTR int NDECL(wiz_rumor_check);
174 STATIC_PTR int NDECL(doattributes);
176 STATIC_DCL void FDECL(enlght_line, (const char *, const char *, const char *,
178 STATIC_DCL char *FDECL(enlght_combatinc, (const char *, int, int, char *));
179 STATIC_DCL void FDECL(enlght_halfdmg, (int, int));
180 STATIC_DCL boolean NDECL(walking_on_water);
181 STATIC_DCL boolean FDECL(cause_known, (int));
182 STATIC_DCL char *FDECL(attrval, (int, int, char *));
183 STATIC_DCL void FDECL(background_enlightenment, (int, int));
184 STATIC_DCL void FDECL(characteristics_enlightenment, (int, int));
185 STATIC_DCL void FDECL(one_characteristic, (int, int, int));
186 STATIC_DCL void FDECL(status_enlightenment, (int, int));
187 STATIC_DCL void FDECL(attributes_enlightenment, (int, int));
189 static const char *readchar_queue = "";
190 static coord clicklook_cc;
192 STATIC_DCL void FDECL(add_herecmd_menuitem, (winid, int NDECL((*)),
194 STATIC_DCL char FDECL(here_cmd_menu, (BOOLEAN_P));
195 STATIC_DCL char FDECL(there_cmd_menu, (BOOLEAN_P, int, int));
196 STATIC_DCL char *NDECL(parse);
197 STATIC_DCL void FDECL(show_direction_keys, (winid, CHAR_P, BOOLEAN_P));
198 STATIC_DCL boolean FDECL(help_dir, (CHAR_P, int, const char *));
201 doprev_message(VOID_ARGS)
203 return nh_doprev_message();
206 /* Count down by decrementing multi */
208 timed_occupation(VOID_ARGS)
216 /* If you have moved since initially setting some occupations, they
217 * now shouldn't be able to restart.
219 * The basic rule is that if you are carrying it, you can continue
220 * since it is with you. If you are acting on something at a distance,
221 * your orientation to it must have changed when you moved.
223 * The exception to this is taking off items, since they can be taken
224 * off in a number of ways in the intervening time, screwing up ordering.
226 * Currently: Take off all armor.
227 * Picking Locks / Forcing Chests.
238 /* If a time is given, use it to timeout this function, otherwise the
239 * function times out by its own means.
242 set_occupation(fn, txt, xtime)
248 occupation = timed_occupation;
257 STATIC_DCL char NDECL(popch);
259 /* Provide a means to redo the last command. The flag `in_doagain' is set
260 * to true while redoing the command. This flag is tested in commands that
261 * require additional input (like `throw' which requires a thing and a
262 * direction), and the input prompt is not shown. Also, while in_doagain is
263 * TRUE, no keystrokes can be saved into the saveq.
266 static char pushq[BSIZE], saveq[BSIZE];
267 static NEARDATA int phead, ptail, shead, stail;
272 /* If occupied, return '\0', letting tgetch know a character should
273 * be read from the keyboard. If the character read is not the
274 * ABORT character (as checked in pcmain.c), that character will be
275 * pushed back on the pushq.
280 return (char) ((shead != stail) ? saveq[stail++] : '\0');
282 return (char) ((phead != ptail) ? pushq[ptail++] : '\0');
286 pgetchar() /* courtesy of aeb@cwi.nl */
295 /* A ch == 0 resets the pushq */
307 /* A ch == 0 resets the saveq. Only save keystrokes when not
308 * replaying a previous command.
316 phead = ptail = shead = stail = 0;
317 else if (shead < BSIZE)
323 /* here after # - now read a full-word command */
330 /* keep repeating until we don't run help or quit */
336 func = extcmdlist[idx].ef_funct;
337 if (!wizard && (extcmdlist[idx].flags & WIZMODECMD)) {
339 You("can't do that.");
341 pline("
\82»
\82ê
\82Í
\82Å
\82«
\82Ü
\82¹
\82ñ
\81D");
344 if (iflags.menu_requested && !accept_menu_prefix(func)) {
346 pline("'%s' prefix has no effect for the %s command.",
347 visctrl(Cmd.spkeys[NHKF_REQMENU]),
348 extcmdlist[idx].ef_txt);
350 pline("'%s'
\90Ú
\93ª
\8e«
\82Í%s
\83R
\83}
\83\93\83h
\82É
\82Í
\96³
\8cø
\81D",
351 visctrl(Cmd.spkeys[NHKF_REQMENU]),
352 extcmdlist[idx].ef_txt);
354 iflags.menu_requested = FALSE;
357 } while (func == doextlist);
362 /* here after #? - now list all full-word commands */
366 register const struct ext_func_tab *efp;
369 char ch = cmd_from_func(doextcmd);
371 datawin = create_nhwindow(NHW_TEXT);
372 putstr(datawin, 0, "");
374 putstr(datawin, 0, " Extended Commands List");
376 putstr(datawin, 0, "
\8ag
\92£
\83R
\83}
\83\93\83h
\88ê
\97\97");
377 putstr(datawin, 0, "");
380 Sprintf(buf, " Press '%s', then type:",
383 Sprintf(buf, " '%s'
\82ð
\89\9f\82µ
\82½
\82 \82Æ
\83^
\83C
\83v
\82¹
\82æ:",
386 putstr(datawin, 0, buf);
387 putstr(datawin, 0, "");
390 for (efp = extcmdlist; efp->ef_txt; efp++) {
391 if (!wizard && (efp->flags & WIZMODECMD))
393 Sprintf(buf, " %-15s %c %s.",
395 (efp->flags & AUTOCOMPLETE) ? '*' : ' ',
397 putstr(datawin, 0, buf);
399 putstr(datawin, 0, "");
401 putstr(datawin, 0, " Commands marked with a * will be autocompleted.");
403 putstr(datawin, 0, " *
\95t
\82«
\82Ì
\83R
\83}
\83\93\83h
\82Í
\8e©
\93®
\95â
\8a®
\82³
\82ê
\82Ü
\82·
\81D");
404 display_nhwindow(datawin, FALSE);
405 destroy_nhwindow(datawin);
410 #define MAX_EXT_CMD 200 /* Change if we ever have more ext cmds */
413 * This is currently used only by the tty interface and is
414 * controlled via runtime option 'extmenu'. (Most other interfaces
415 * already use a menu all the time for extended commands.)
417 * ``# ?'' is counted towards the limit of the number of commands,
418 * so we actually support MAX_EXT_CMD-1 "real" extended commands.
420 * Here after # - now show pick-list of possible commands.
425 const struct ext_func_tab *efp;
426 menu_item *pick_list = (menu_item *) 0;
429 const struct ext_func_tab *choices[MAX_EXT_CMD + 1];
431 char cbuf[QBUFSZ], prompt[QBUFSZ], fmtstr[20];
432 int i, n, nchoices, acount;
433 int ret, len, biggest;
434 int accelerator, prevaccelerator;
436 boolean wastoolong, one_per_line;
444 /* populate choices */
445 for (efp = extcmdlist; efp->ef_txt; efp++) {
446 if (!(efp->flags & AUTOCOMPLETE)
447 || (!wizard && (efp->flags & WIZMODECMD)))
449 if (!matchlevel || !strncmp(efp->ef_txt, cbuf, matchlevel)) {
451 if ((len = (int) strlen(efp->ef_desc)) > biggest)
453 if (++i > MAX_EXT_CMD) {
456 "Exceeded %d extended commands in doextcmd() menu; 'extmenu' disabled.",
464 choices[i] = (struct ext_func_tab *) 0;
466 /* if we're down to one, we have our selection so get out of here */
468 ret = (nchoices == 1) ? (int) (choices[0] - extcmdlist) : -1;
473 win = create_nhwindow(NHW_MENU);
475 Sprintf(fmtstr, "%%-%ds", biggest + 15);
477 wastoolong = FALSE; /* True => had to wrap due to line width
478 * ('w' in wizard mode) */
479 /* -3: two line menu header, 1 line menu footer (for prompt) */
480 one_per_line = (nchoices < ROWNO - 3);
481 accelerator = prevaccelerator = 0;
483 for (i = 0; choices[i]; ++i) {
484 accelerator = choices[i]->ef_txt[matchlevel];
485 if (accelerator != prevaccelerator || one_per_line)
487 if (accelerator != prevaccelerator || one_per_line
489 /* +4: + sizeof " or " - sizeof "" */
490 && (strlen(prompt) + 4 + strlen(choices[i]->ef_txt)
491 /* -6: enough room for 1 space left margin
492 * + "%c - " menu selector + 1 space right margin */
493 >= min(sizeof prompt, COLNO - 6)))) {
495 /* flush extended cmds for that letter already in buf */
496 Sprintf(buf, fmtstr, prompt);
497 any.a_char = prevaccelerator;
498 add_menu(win, NO_GLYPH, &any, any.a_char, 0, ATR_NONE,
501 if (!(accelerator != prevaccelerator || one_per_line))
505 prevaccelerator = accelerator;
506 if (!acount || one_per_line) {
508 Sprintf(prompt, "%s%s [%s]", wastoolong ? "or " : "",
509 choices[i]->ef_txt, choices[i]->ef_desc);
511 Sprintf(prompt, "%s%s [%s]", wastoolong ? "
\82Ü
\82½
\82Í" : "",
512 choices[i]->ef_txt, choices[i]->ef_desc);
514 } else if (acount == 1) {
516 Sprintf(prompt, "%s%s or %s", wastoolong ? "or " : "",
517 choices[i - 1]->ef_txt, choices[i]->ef_txt);
519 Sprintf(prompt, "%s%s
\82Ü
\82½
\82Í%s", wastoolong ? "
\82Ü
\82½
\82Í" : "",
520 choices[i - 1]->ef_txt, choices[i]->ef_txt);
524 Strcat(prompt, " or ");
526 Strcat(prompt,"
\82Ü
\82½
\82Í ");
527 Strcat(prompt, choices[i]->ef_txt);
533 Sprintf(buf, fmtstr, prompt);
534 any.a_char = prevaccelerator;
535 add_menu(win, NO_GLYPH, &any, any.a_char, 0, ATR_NONE, buf,
539 Sprintf(prompt, "Extended Command: %s", cbuf);
541 Sprintf(prompt, "
\8ag
\92£
\83R
\83}
\83\93\83h: %s", cbuf);
542 end_menu(win, prompt);
543 n = select_menu(win, PICK_ONE, &pick_list);
544 destroy_nhwindow(win);
546 if (matchlevel > (QBUFSZ - 2)) {
547 free((genericptr_t) pick_list);
549 impossible("Too many chars (%d) entered in extcmd_via_menu()",
554 cbuf[matchlevel++] = pick_list[0].item.a_char;
555 cbuf[matchlevel] = '\0';
556 free((genericptr_t) pick_list);
568 #endif /* TTY_GRAPHICS */
570 /* #monster command - use special monster ability while polymorphed */
572 domonability(VOID_ARGS)
574 if (can_breathe(youmonst.data))
576 else if (attacktype(youmonst.data, AT_SPIT))
578 else if (youmonst.data->mlet == S_NYMPH)
580 else if (attacktype(youmonst.data, AT_GAZE))
582 else if (is_were(youmonst.data))
584 else if (webmaker(youmonst.data))
586 else if (is_hider(youmonst.data))
588 else if (is_mind_flayer(youmonst.data))
589 return domindblast();
590 else if (u.umonnum == PM_GREMLIN) {
591 if (IS_FOUNTAIN(levl[u.ux][u.uy].typ)) {
592 if (split_mon(&youmonst, (struct monst *) 0))
593 dryup(u.ux, u.uy, TRUE);
596 There("is no fountain here.");
598 pline("
\82±
\82±
\82É
\82Í
\90ò
\82Í
\82È
\82¢
\81D");
599 } else if (is_unicorn(youmonst.data)) {
600 use_unicorn_horn((struct obj *) 0);
602 } else if (youmonst.data->msound == MS_SHRIEK) {
606 You("
\8bà
\90Ø
\82è
\90º
\82ð
\82 \82°
\82½
\81D");
609 pline("Unfortunately sound does not carry well through rock.");
611 pline("
\8ec
\94O
\82È
\82ª
\82ç
\89¹
\82Í
\8aâ
\82ð
\82¤
\82Ü
\82
\93`
\82í
\82ç
\82È
\82¢
\81D");
614 } else if (youmonst.data->mlet == S_VAMPIRE)
618 pline("Any special ability you may have is purely reflexive.");
620 pline("
\82 \82È
\82½
\82Ì
\8e\9d\82Á
\82Ä
\82¢
\82é
\93Á
\8eê
\94\
\97Í
\82Í
\82Ç
\82ê
\82à
\8eó
\93®
\93I
\82¾
\81D");
623 You("don't have a special ability in your normal form!");
625 You("
\95\81\92i
\82Ì
\8ep
\82Å
\82Ì
\93Á
\8eê
\94\
\97Í
\82ð
\8e\9d\82Á
\82Ä
\82¢
\82È
\82¢
\81I");
630 enter_explore_mode(VOID_ARGS)
634 You("are in debug mode.");
636 You("
\82·
\82Å
\82É
\83f
\83o
\83b
\83O
\83\82\81[
\83h
\82¾
\81D");
637 } else if (discover) {
639 You("are already in explore mode.");
641 You("
\82·
\82Å
\82É
\92T
\8c\9f\83\82\81[
\83h
\82¾
\81D");
645 if (!sysopt.explorers || !sysopt.explorers[0]
646 || !check_user_string(sysopt.explorers)) {
648 You("cannot access explore mode.");
650 You("
\92T
\8c\9f\83\82\81[
\83h
\82É
\83A
\83N
\83Z
\83X
\82Å
\82«
\82È
\82¢
\81D");
657 "Beware! From explore mode there will be no return to normal game.");
659 "
\8cx
\8d\90\81I
\94
\8c©
\83\82\81[
\83h
\82É
\93ü
\82Á
\82½
\82ç
\92Ê
\8fí
\83\82\81[
\83h
\82É
\82Í
\96ß
\82ê
\82È
\82¢
\81D");
660 if (paranoid_query(ParanoidQuit,
662 "Do you want to enter explore mode?")) {
664 "
\94
\8c©
\83\82\81[
\83h
\82É
\88Ú
\82è
\82Ü
\82·
\82©
\81H")) {
665 clear_nhwindow(WIN_MESSAGE);
667 You("are now in non-scoring explore mode.");
669 You("
\83X
\83R
\83A
\82ª
\82Ì
\82ç
\82È
\82¢
\94
\8c©
\83\82\81[
\83h
\82É
\88Ú
\8ds
\82µ
\82½
\81D");
672 clear_nhwindow(WIN_MESSAGE);
674 pline("Resuming normal game.");
676 pline("
\92Ê
\8fí
\83\82\81[
\83h
\82ð
\91±
\82¯
\82é
\81D");
682 /* ^W command - wish for something */
684 wiz_wish(VOID_ARGS) /* Unlimited wishes for debug mode by Paul Polderman */
687 boolean save_verbose = flags.verbose;
689 flags.verbose = FALSE;
691 flags.verbose = save_verbose;
692 (void) encumber_msg();
695 pline("Unavailable command '%s'.",
697 pline("'%s'
\83R
\83}
\83\93\83h
\82Í
\8eg
\82¦
\82È
\82¢
\81D",
698 visctrl((int) cmd_from_func(wiz_wish)));
702 /* ^I command - reveal and optionally identify hero's inventory */
704 wiz_identify(VOID_ARGS)
707 iflags.override_ID = (int) cmd_from_func(wiz_identify);
708 if (display_inventory((char *) 0, TRUE) == -1)
709 identify_pack(0, FALSE);
710 iflags.override_ID = 0;
713 pline("Unavailable command '%s'.",
715 pline("'%s'
\83R
\83}
\83\93\83h
\82Í
\8eg
\82¦
\82È
\82¢
\81D",
716 visctrl((int) cmd_from_func(wiz_identify)));
721 wiz_makemap(VOID_ARGS)
723 /* FIXME: doesn't handle riding */
727 rm_mapseen(ledger_no(&u.uz));
728 for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
735 check_special_room(TRUE);
737 savelev(-1, ledger_no(&u.uz), FREE_SAVE);
740 vision_full_recalc = 1;
742 (void) safe_teleds(TRUE);
753 /* ^F command - reveal the level map and any traps on it */
759 long save_Hconf = HConfusion, save_Hhallu = HHallucination;
761 HConfusion = HHallucination = 0L;
762 for (t = ftrap; t != 0; t = t->ntrap) {
767 HConfusion = save_Hconf;
768 HHallucination = save_Hhallu;
771 pline("Unavailable command '%s'.",
773 pline("'%s'
\83R
\83}
\83\93\83h
\82Í
\8eg
\82¦
\82È
\82¢
\81D",
774 visctrl((int) cmd_from_func(wiz_map)));
778 /* ^G command - generate monster(s); a count prefix will be honored */
780 wiz_genesis(VOID_ARGS)
783 (void) create_particular();
786 pline("Unavailable command '%s'.",
788 pline("'%s'
\83R
\83}
\83\93\83h
\82Í
\8eg
\82¦
\82È
\82¢
\81D",
789 visctrl((int) cmd_from_func(wiz_genesis)));
793 /* ^O command - display dungeon layout */
798 (void) print_dungeon(FALSE, (schar *) 0, (xchar *) 0);
801 pline("Unavailable command '%s'.",
803 pline("'%s'
\83R
\83}
\83\93\83h
\82Í
\8eg
\82¦
\82È
\82¢
\81D",
804 visctrl((int) cmd_from_func(wiz_where)));
808 /* ^E command - detect unseen (secret doors, traps, hidden monsters) */
810 wiz_detect(VOID_ARGS)
816 pline("Unavailable command '%s'.",
818 pline("'%s'
\83R
\83}
\83\93\83h
\82Í
\8eg
\82¦
\82È
\82¢
\81D",
819 visctrl((int) cmd_from_func(wiz_detect)));
823 /* ^V command - level teleport */
825 wiz_level_tele(VOID_ARGS)
831 pline("Unavailable command '%s'.",
833 pline("'%s'
\83R
\83}
\83\93\83h
\82Í
\8eg
\82¦
\82È
\82¢
\81D",
834 visctrl((int) cmd_from_func(wiz_level_tele)));
838 /* #monpolycontrol command - choose new form for shapechangers, polymorphees */
840 wiz_mon_polycontrol(VOID_ARGS)
842 iflags.mon_polycontrol = !iflags.mon_polycontrol;
844 pline("Monster polymorph control is %s.",
845 iflags.mon_polycontrol ? "on" : "off");
847 pline("
\89ö
\95¨
\82Ì
\95Ï
\89»
\90§
\8cä: %s",
848 iflags.mon_polycontrol ? "
\83I
\83\93" : "
\83I
\83t");
853 /* #levelchange command - adjust hero's experience level */
855 wiz_level_change(VOID_ARGS)
857 char buf[BUFSZ] = DUMMY;
862 getlin("To what experience level do you want to be set?", buf);
864 getlin("
\8co
\8c±
\83\8c\83x
\83\8b\82ð
\82¢
\82
\82Â
\82É
\90Ý
\92è
\82µ
\82Ü
\82·
\82©
\81H", buf);
865 (void) mungspaces(buf);
866 if (buf[0] == '\033' || buf[0] == '\0')
869 ret = sscanf(buf, "%d", &newlevel);
875 if (newlevel == u.ulevel) {
877 You("are already that experienced.");
879 You("
\82·
\82Å
\82É
\82»
\82Ì
\8co
\8c±
\83\8c\83x
\83\8b\82¾
\81D");
880 } else if (newlevel < u.ulevel) {
883 You("are already as inexperienced as you can get.");
885 You("
\82·
\82Å
\82É
\89Â
\94\
\82È
\8cÀ
\82è
\82Ì
\8dÅ
\92á
\82Ì
\8co
\8c±
\83\8c\83x
\83\8b\82¾
\81D");
890 while (u.ulevel > newlevel)
892 losexp("#levelchange");
894 losexp("#levelchange
\83R
\83}
\83\93\83h
\82Å");
896 if (u.ulevel >= MAXULEV) {
898 You("are already as experienced as you can get.");
900 You("
\82·
\82Å
\82É
\89Â
\94\
\82È
\8cÀ
\82è
\82Ì
\8dÅ
\91å
\82Ì
\8co
\8c±
\83\8c\83x
\83\8b\82¾
\81D");
903 if (newlevel > MAXULEV)
905 while (u.ulevel < newlevel)
908 u.ulevelmax = u.ulevel;
912 /* #panic command - test program's panic handling */
917 if (yn("Do you want to call panic() and end your game?") == 'y')
919 if (yn("panic()
\8aÖ
\90\94\82ð
\8cÄ
\82Ñ
\8fo
\82µ
\82Ä
\83Q
\81[
\83\80\82ð
\8fI
\97¹
\82³
\82¹
\82Ü
\82·
\82©
\81H") == 'y')
920 panic("Crash test.");
924 /* #polyself command - change hero's form */
926 wiz_polyself(VOID_ARGS)
934 wiz_show_seenv(VOID_ARGS)
937 int x, y, v, startx, stopx, curx;
940 win = create_nhwindow(NHW_TEXT);
942 * Each seenv description takes up 2 characters, so center
943 * the seenv display around the hero.
945 startx = max(1, u.ux - (COLNO / 4));
946 stopx = min(startx + (COLNO / 2), COLNO);
947 /* can't have a line exactly 80 chars long */
948 if (stopx - startx == COLNO / 2)
951 for (y = 0; y < ROWNO; y++) {
952 for (x = startx, curx = 0; x < stopx; x++, curx += 2) {
953 if (x == u.ux && y == u.uy) {
954 row[curx] = row[curx + 1] = '@';
956 v = levl[x][y].seenv & 0xff;
958 row[curx] = row[curx + 1] = ' ';
960 Sprintf(&row[curx], "%02x", v);
963 /* remove trailing spaces */
964 for (x = curx - 1; x >= 0; x--)
971 display_nhwindow(win, TRUE);
972 destroy_nhwindow(win);
976 /* #vision command */
978 wiz_show_vision(VOID_ARGS)
984 win = create_nhwindow(NHW_TEXT);
985 Sprintf(row, "Flags: 0x%x could see, 0x%x in sight, 0x%x temp lit",
986 COULD_SEE, IN_SIGHT, TEMP_LIT);
989 for (y = 0; y < ROWNO; y++) {
990 for (x = 1; x < COLNO; x++) {
991 if (x == u.ux && y == u.uy)
994 v = viz_array[y][x]; /* data access should be hidden */
998 row[x] = '0' + viz_array[y][x];
1001 /* remove trailing spaces */
1002 for (x = COLNO - 1; x >= 1; x--)
1007 putstr(win, 0, &row[1]);
1009 display_nhwindow(win, TRUE);
1010 destroy_nhwindow(win);
1014 /* #wmode command */
1016 wiz_show_wmodes(VOID_ARGS)
1020 char row[COLNO + 1];
1022 boolean istty = !strcmp(windowprocs.name, "tty");
1024 win = create_nhwindow(NHW_TEXT);
1026 putstr(win, 0, ""); /* tty only: blank top line */
1027 for (y = 0; y < ROWNO; y++) {
1028 for (x = 0; x < COLNO; x++) {
1030 if (x == u.ux && y == u.uy)
1032 else if (IS_WALL(lev->typ) || lev->typ == SDOOR)
1033 row[x] = '0' + (lev->wall_info & WM_MASK);
1034 else if (lev->typ == CORR)
1036 else if (IS_ROOM(lev->typ) || IS_DOOR(lev->typ))
1042 /* map column 0, levl[0][], is off the left edge of the screen */
1043 putstr(win, 0, &row[1]);
1045 display_nhwindow(win, TRUE);
1046 destroy_nhwindow(win);
1050 /* wizard mode variant of #terrain; internal levl[][].typ values in base-36 */
1052 wiz_map_levltyp(VOID_ARGS)
1056 char row[COLNO + 1];
1057 boolean istty = !strcmp(windowprocs.name, "tty");
1059 win = create_nhwindow(NHW_TEXT);
1060 /* map row 0, levl[][0], is drawn on the second line of tty screen */
1062 putstr(win, 0, ""); /* tty only: blank top line */
1063 for (y = 0; y < ROWNO; y++) {
1064 /* map column 0, levl[0][], is off the left edge of the screen;
1065 it should always have terrain type "undiggable stone" */
1066 for (x = 1; x < COLNO; x++) {
1067 terrain = levl[x][y].typ;
1068 /* assumes there aren't more than 10+26+26 terrain types */
1069 row[x - 1] = (char) ((terrain == STONE && !may_dig(x, y))
1074 ? 'a' + terrain - 10
1075 : 'A' + terrain - 36);
1078 if (levl[0][y].typ != STONE || may_dig(0, y))
1081 putstr(win, 0, row);
1086 s_level *slev = Is_special(&u.uz);
1088 Sprintf(dsc, "D:%d,L:%d", u.uz.dnum, u.uz.dlevel);
1089 /* [dungeon branch features currently omitted] */
1090 /* special level features */
1092 Sprintf(eos(dsc), " \"%s\"", slev->proto);
1093 /* special level flags (note: dungeon.def doesn't set `maze'
1094 or `hell' for any specific levels so those never show up) */
1095 if (slev->flags.maze_like)
1096 Strcat(dsc, " mazelike");
1097 if (slev->flags.hellish)
1098 Strcat(dsc, " hellish");
1099 if (slev->flags.town)
1100 Strcat(dsc, " town");
1101 if (slev->flags.rogue_like)
1102 Strcat(dsc, " roguelike");
1103 /* alignment currently omitted to save space */
1105 /* level features */
1106 if (level.flags.nfountains)
1107 Sprintf(eos(dsc), " %c:%d", defsyms[S_fountain].sym,
1108 (int) level.flags.nfountains);
1109 if (level.flags.nsinks)
1110 Sprintf(eos(dsc), " %c:%d", defsyms[S_sink].sym,
1111 (int) level.flags.nsinks);
1112 if (level.flags.has_vault)
1113 Strcat(dsc, " vault");
1114 if (level.flags.has_shop)
1115 Strcat(dsc, " shop");
1116 if (level.flags.has_temple)
1117 Strcat(dsc, " temple");
1118 if (level.flags.has_court)
1119 Strcat(dsc, " throne");
1120 if (level.flags.has_zoo)
1121 Strcat(dsc, " zoo");
1122 if (level.flags.has_morgue)
1123 Strcat(dsc, " morgue");
1124 if (level.flags.has_barracks)
1125 Strcat(dsc, " barracks");
1126 if (level.flags.has_beehive)
1127 Strcat(dsc, " hive");
1128 if (level.flags.has_swamp)
1129 Strcat(dsc, " swamp");
1131 if (level.flags.noteleport)
1132 Strcat(dsc, " noTport");
1133 if (level.flags.hardfloor)
1134 Strcat(dsc, " noDig");
1135 if (level.flags.nommap)
1136 Strcat(dsc, " noMMap");
1137 if (!level.flags.hero_memory)
1138 Strcat(dsc, " noMem");
1139 if (level.flags.shortsighted)
1140 Strcat(dsc, " shortsight");
1141 if (level.flags.graveyard)
1142 Strcat(dsc, " graveyard");
1143 if (level.flags.is_maze_lev)
1144 Strcat(dsc, " maze");
1145 if (level.flags.is_cavernous_lev)
1146 Strcat(dsc, " cave");
1147 if (level.flags.arboreal)
1148 Strcat(dsc, " tree");
1150 Strcat(dsc, " sokoban-rules");
1151 /* non-flag info; probably should include dungeon branching
1152 checks (extra stairs and magic portals) here */
1153 if (Invocation_lev(&u.uz))
1154 Strcat(dsc, " invoke");
1155 if (On_W_tower_level(&u.uz))
1156 Strcat(dsc, " tower");
1157 /* append a branch identifier for completeness' sake */
1159 Strcat(dsc, " dungeon");
1160 else if (u.uz.dnum == mines_dnum)
1161 Strcat(dsc, " mines");
1162 else if (In_sokoban(&u.uz))
1163 Strcat(dsc, " sokoban");
1164 else if (u.uz.dnum == quest_dnum)
1165 Strcat(dsc, " quest");
1166 else if (Is_knox(&u.uz))
1167 Strcat(dsc, " ludios");
1168 else if (u.uz.dnum == 1)
1169 Strcat(dsc, " gehennom");
1170 else if (u.uz.dnum == tower_dnum)
1171 Strcat(dsc, " vlad");
1172 else if (In_endgame(&u.uz))
1173 Strcat(dsc, " endgame");
1175 /* somebody's added a dungeon branch we're not expecting */
1176 const char *brname = dungeons[u.uz.dnum].dname;
1178 if (!brname || !*brname)
1180 if (!strncmpi(brname, "the ", 4))
1182 Sprintf(eos(dsc), " %s", brname);
1184 /* limit the line length to map width */
1185 if (strlen(dsc) >= COLNO)
1186 dsc[COLNO - 1] = '\0'; /* truncate */
1187 putstr(win, 0, dsc);
1190 display_nhwindow(win, TRUE);
1191 destroy_nhwindow(win);
1195 /* temporary? hack, since level type codes aren't the same as screen
1196 symbols and only the latter have easily accessible descriptions */
1197 static const char *levltyp[] = {
1198 "stone", "vertical wall", "horizontal wall", "top-left corner wall",
1199 "top-right corner wall", "bottom-left corner wall",
1200 "bottom-right corner wall", "cross wall", "tee-up wall", "tee-down wall",
1201 "tee-left wall", "tee-right wall", "drawbridge wall", "tree",
1202 "secret door", "secret corridor", "pool", "moat", "water",
1203 "drawbridge up", "lava pool", "iron bars", "door", "corridor", "room",
1204 "stairs", "ladder", "fountain", "throne", "sink", "grave", "altar", "ice",
1205 "drawbridge down", "air", "cloud",
1206 /* not a real terrain type, but used for undiggable stone
1207 by wiz_map_levltyp() */
1208 "unreachable/undiggable",
1209 /* padding in case the number of entries above is odd */
1213 /* explanation of base-36 output from wiz_map_levltyp() */
1215 wiz_levltyp_legend(VOID_ARGS)
1219 const char *dsc, *fmt;
1222 win = create_nhwindow(NHW_TEXT);
1223 putstr(win, 0, "#terrain encodings:");
1225 fmt = " %c - %-28s"; /* TODO: include tab-separated variant for win32 */
1227 /* output in pairs, left hand column holds [0],[1],...,[N/2-1]
1228 and right hand column holds [N/2],[N/2+1],...,[N-1];
1229 N ('last') will always be even, and may or may not include
1230 the empty string entry to pad out the final pair, depending
1231 upon how many other entries are present in levltyp[] */
1232 last = SIZE(levltyp) & ~1;
1233 for (i = 0; i < last / 2; ++i)
1234 for (j = i; j < last; j += last / 2) {
1237 : !strncmp(dsc, "unreachable", 11) ? '*'
1238 /* same int-to-char conversion as wiz_map_levltyp() */
1239 : (j < 10) ? '0' + j
1240 : (j < 36) ? 'a' + j - 10
1242 Sprintf(eos(buf), fmt, c, dsc);
1244 putstr(win, 0, buf);
1248 display_nhwindow(win, TRUE);
1249 destroy_nhwindow(win);
1253 /* #wizsmell command - test usmellmon(). */
1255 wiz_smell(VOID_ARGS)
1258 int mndx; /* monster index */
1259 coord cc; /* screen pos of unknown glyph */
1260 int glyph; /* glyph at selected position */
1264 mndx = 0; /* gcc -Wall lint */
1265 if (!olfaction(youmonst.data)) {
1266 You("are incapable of detecting odors in your present form.");
1270 pline("You can move the cursor to a monster that you want to smell.");
1272 pline("Pick a monster to smell.");
1273 ans = getpos(&cc, TRUE, "a monster");
1274 if (ans < 0 || cc.x < 0) {
1275 return 0; /* done */
1277 /* Convert the glyph at the selected position to a mndxbol. */
1278 glyph = glyph_at(cc.x, cc.y);
1279 if (glyph_is_monster(glyph))
1280 mndx = glyph_to_mon(glyph);
1283 /* Is it a monster? */
1285 if (!usmellmon(&mons[mndx]))
1286 pline("That monster seems to give off no smell.");
1288 pline("That is not a monster.");
1293 /* #wizinstrinsic command to set some intrinsics for testing */
1295 wiz_intrinsic(VOID_ARGS)
1298 extern const struct propname {
1300 const char *prop_name;
1301 } propertynames[]; /* timeout.c */
1302 static const char wizintrinsic[] = "#wizintrinsic";
1303 static const char fmt[] = "You are%s %s.";
1307 int i, j, n, p, amt, typ;
1308 long oldtimeout, newtimeout;
1309 const char *propname;
1310 menu_item *pick_list = (menu_item *) 0;
1313 win = create_nhwindow(NHW_MENU);
1315 for (i = 0; (propname = propertynames[i].prop_name) != 0; ++i) {
1316 p = propertynames[i].prop_num;
1317 if (p == HALLUC_RES) {
1318 /* Grayswandir vs hallucination; ought to be redone to
1319 use u.uprops[HALLUC].blocked instead of being treated
1320 as a separate property; letting in be manually toggled
1321 even only in wizard mode would be asking for trouble... */
1324 if (p == FIRE_RES) {
1326 add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "--", FALSE);
1328 any.a_int = i + 1; /* +1: avoid 0 */
1329 oldtimeout = u.uprops[p].intrinsic & TIMEOUT;
1331 Sprintf(buf, "%-27s [%li]", propname, oldtimeout);
1333 Sprintf(buf, "%s", propname);
1334 add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
1336 end_menu(win, "Which intrinsics?");
1337 n = select_menu(win, PICK_ANY, &pick_list);
1338 destroy_nhwindow(win);
1340 amt = 30; /* TODO: prompt for duration */
1341 for (j = 0; j < n; ++j) {
1342 i = pick_list[j].item.a_int - 1; /* -1: reverse +1 above */
1343 p = propertynames[i].prop_num;
1344 oldtimeout = u.uprops[p].intrinsic & TIMEOUT;
1345 newtimeout = oldtimeout + (long) amt;
1350 if (oldtimeout > 0L && newtimeout > oldtimeout)
1351 newtimeout = oldtimeout;
1357 make_blinded(newtimeout, TRUE);
1359 #if 0 /* make_confused() only gives feedback when confusion is
1360 * ending so use the 'default' case for it instead */
1362 make_confused(newtimeout, TRUE);
1366 make_deaf(newtimeout, TRUE);
1369 make_hallucinated(newtimeout, TRUE, 0L);
1372 typ = !rn2(2) ? SICK_VOMITABLE : SICK_NONVOMITABLE;
1373 make_sick(newtimeout, wizintrinsic, TRUE, typ);
1377 !Slimed ? "" : " still", "turning into slime");
1378 make_slimed(newtimeout, buf);
1382 !Stoned ? "" : " still", "turning into stone");
1383 make_stoned(newtimeout, buf, KILLED_BY, wizintrinsic);
1386 make_stunned(newtimeout, TRUE);
1389 Sprintf(buf, fmt, !Vomiting ? "" : " still", "vomiting");
1390 make_vomiting(newtimeout, FALSE);
1394 pline("Timeout for %s %s %d.", propertynames[i].prop_name,
1395 oldtimeout ? "increased by" : "set to", amt);
1396 incr_itimeout(&u.uprops[p].intrinsic, amt);
1399 context.botl = 1; /* probably not necessary... */
1402 free((genericptr_t) pick_list);
1405 pline("Unavailable command '%s'.",
1406 visctrl((int) cmd_from_func(wiz_intrinsic)));
1410 /* #wizrumorcheck command - verify each rumor access */
1412 wiz_rumor_check(VOID_ARGS)
1418 /* #terrain command -- show known map, inspired by crawl's '|' command */
1420 doterrain(VOID_ARGS)
1429 * normal play: choose between known map without mons, obj, and traps
1430 * (to see underlying terrain only), or
1431 * known map without mons and objs (to see traps under mons and objs), or
1432 * known map without mons (to see objects under monsters);
1433 * explore mode: normal choices plus full map (w/o mons, objs, traps);
1434 * wizard mode: normal and explore choices plus
1435 * a dump of the internal levl[][].typ codes w/ level flags, or
1436 * a legend for the levl[][].typ codes dump
1438 men = create_nhwindow(NHW_MENU);
1442 add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE,
1444 "known map without monsters, objects, and traps",
1446 "
\89ö
\95¨
\81C
\95¨
\81Cã©
\82È
\82µ
\82Ì
\92n
\90}",
1449 add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE,
1451 "known map without monsters and objects",
1453 "
\89ö
\95¨
\81C
\95¨
\82È
\82µ
\82Ì
\92n
\90}",
1456 add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE,
1458 "known map without monsters",
1460 "
\89ö
\95¨
\82È
\82µ
\82Ì
\92n
\90}",
1462 if (discover || wizard) {
1464 add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE,
1466 "full map without monsters, objects, and traps",
1468 "
\89ö
\95¨
\81C
\95¨
\81Cã©
\82È
\82µ
\82Ì
\8a®
\91S
\82È
\92n
\90}",
1472 add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE,
1473 "internal levl[][].typ codes in base-36",
1476 add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE,
1477 "legend of base-36 levl[][].typ codes",
1482 end_menu(men, "View which?");
1484 end_menu(men, "
\82Ç
\82ê
\82ð
\8c©
\82é
\81H");
1486 n = select_menu(men, PICK_ONE, &sel);
1487 destroy_nhwindow(men);
1489 * n < 0: player used ESC to cancel;
1490 * n == 0: preselected entry was explicitly chosen and got toggled off;
1491 * n == 1: preselected entry was implicitly chosen via <space>|<enter>;
1492 * n == 2: another entry was explicitly chosen, so skip preselected one.
1494 which = (n < 0) ? -1 : (n == 0) ? 1 : sel[0].item.a_int;
1495 if (n > 1 && which == 1)
1496 which = sel[1].item.a_int;
1498 free((genericptr_t) sel);
1501 case 1: /* known map */
1502 reveal_terrain(0, TER_MAP);
1504 case 2: /* known map with known traps */
1505 reveal_terrain(0, TER_MAP | TER_TRP);
1507 case 3: /* known map with known traps and objects */
1508 reveal_terrain(0, TER_MAP | TER_TRP | TER_OBJ);
1510 case 4: /* full map */
1511 reveal_terrain(1, TER_MAP);
1513 case 5: /* map internals */
1516 case 6: /* internal details */
1517 wiz_levltyp_legend();
1522 return 0; /* no time elapses */
1525 /* -enlightenment and conduct- */
1526 static winid en_win = WIN_ERR;
1528 static const char You_[] = "You ", are[] = "are ", were[] = "were ",
1529 have[] = "have ", had[] = "had ", can[] = "can ",
1532 static const char You_[] = "
\82 \82È
\82½
\82Í",
1533 are[] = "
\82Å
\82 \82é", were[] = "
\82Å
\82 \82Á
\82½",
1534 have[] = "
\82ð
\82à
\82Á
\82Ä
\82¢
\82é", had[] = "
\82ð
\82à
\82Á
\82Ä
\82¢
\82½",
1535 can[] = "
\82Å
\82«
\82é", could[] = "
\82Å
\82«
\82½",
1536 iru[] = "
\82¢
\82é", ita[] = "
\82¢
\82½";
1538 #if 0 /*JP*//* not used */
1539 static const char have_been[] = "have been ", have_never[] = "have never ",
1544 #define enl_msg(prefix, present, past, suffix, ps) \
1545 enlght_line(prefix, final ? past : present, suffix, ps)
1547 #define enl_msg(prefix, present, past, suffix, ps) \
1548 enlght_line(prefix, ps, suffix, final ? past : present)
1550 #define you_are(attr, ps) enl_msg(You_, are, were, attr, ps)
1551 #define you_have(attr, ps) enl_msg(You_, have, had, attr, ps)
1552 #define you_can(attr, ps) enl_msg(You_, can, could, attr, ps)
1554 #define you_have_been(goodthing) enl_msg(You_, have_been, were, goodthing, "")
1556 #define you_have_been(goodthing) enl_msg(You_, are, were, goodthing, "")
1558 #define you_have_never(badthing) \
1559 enl_msg(You_, have_never, never, badthing, "")
1561 #define you_have_never(badthing) \
1562 enl_msg(badthing, "
\82Ä
\82¢
\82È
\82¢", "
\82È
\82©
\82Á
\82½", "", "")
1565 #define you_have_X(something) \
1566 enl_msg(You_, have, (const char *) "", something, "")
1568 #define you_have_X(something) \
1569 enl_msg(something, "
\82Ä
\82¢
\82é", "
\82½", "", "")
1572 #define you_are_ing(goodthing, ps) enl_msg(You_, iru, ita, goodthing, ps)
1576 enlght_line(start, middle, end, ps)
1577 const char *start, *middle, *end, *ps;
1582 Sprintf(buf, " %s%s%s%s.", start, middle, end, ps);
1584 Sprintf(buf, "%s%s%s%s
\81D", start, middle, end, ps);
1585 putstr(en_win, 0, buf);
1588 /* format increased chance to hit or damage or defense (Protection) */
1590 enlght_combatinc(inctyp, incamt, final, outbuf)
1595 const char *modif, *bonus;
1599 absamt = abs(incamt);
1600 /* Protection amount is typically larger than damage or to-hit;
1601 reduce magnitude by a third in order to stretch modifier ranges
1602 (small:1..5, moderate:6..10, large:11..19, huge:20+) */
1604 if (!strcmp(inctyp, "defense"))
1606 if (!strcmp(inctyp, "
\96h
\8cä"))
1608 absamt = (absamt * 2) / 3;
1614 modif = "
\8bÍ
\82©
\82È";
1615 else if (absamt <= 6)
1619 modif = "
\92\86\92ö
\93x
\82Ì";
1620 else if (absamt <= 12)
1624 modif = "
\91å
\82«
\82È";
1629 modif = "
\8b
\91å
\82È";
1632 modif = !incamt ? "no" : an(modif); /* ("no" case shouldn't happen) */
1635 bonus = (incamt >= 0) ? "bonus" : "penalty";
1637 bonus = (incamt > 0) ? "
\83{
\81[
\83i
\83X" : "
\83y
\83i
\83\8b\83e
\83B";
1638 /* "bonus <foo>" (to hit) vs "<bar> bonus" (damage, defense) */
1640 invrt = strcmp(inctyp, "to hit") ? TRUE : FALSE;
1642 invrt = strcmp(inctyp, "
\96½
\92\86\97¦") ? TRUE : FALSE;
1646 Sprintf(outbuf, "%s %s %s", modif, invrt ? inctyp : bonus,
1647 invrt ? bonus : inctyp);
1649 Sprintf(outbuf, "%s
\82É%s%s", inctyp, modif, bonus);
1651 if (final || wizard)
1652 Sprintf(eos(outbuf), " (%s%d)", (incamt > 0) ? "+" : "", incamt);
1657 /* report half physical or half spell damage */
1659 enlght_halfdmg(category, final)
1663 const char *category_name;
1669 category_name = "physical";
1671 category_name = "
\95¨
\97\9d";
1675 category_name = "spell";
1677 category_name = "
\8eô
\95¶";
1681 category_name = "unknown";
1683 category_name = "
\95s
\96¾";
1687 Sprintf(buf, " %s %s damage", (final || wizard) ? "half" : "reduced",
1689 enl_msg(You_, "take", "took", buf, from_what(category));
1691 Sprintf(buf, " %s
\83_
\83\81\81[
\83W
\82ð%s", (final || wizard) ? "
\94¼
\8c¸" : "
\8c¸
\8f",
1693 enl_msg(You_, "
\82µ
\82Ä
\82¢
\82é", "
\82µ
\82Ä
\82¢
\82½", buf, from_what(category));
1697 /* is hero actively using water walking capability on water (or lava)? */
1701 if (u.uinwater || Levitation || Flying)
1703 return (boolean) (Wwalking
1704 && (is_pool(u.ux, u.uy) || is_lava(u.ux, u.uy)));
1707 /* check whether hero is wearing something that player definitely knows
1708 confers the target property; item must have been seen and its type
1709 discovered but it doesn't necessarily have to be fully identified */
1711 cause_known(propindx)
1712 int propindx; /* index of a property which can be conveyed by worn item */
1714 register struct obj *o;
1715 long mask = W_ARMOR | W_AMUL | W_RING | W_TOOL;
1717 /* simpler than from_what()/what_gives(); we don't attempt to
1718 handle artifacts and we deliberately ignore wielded items */
1719 for (o = invent; o; o = o->nobj) {
1720 if (!(o->owornmask & mask))
1722 if ((int) objects[o->otyp].oc_oprop == propindx
1723 && objects[o->otyp].oc_name_known && o->dknown)
1729 /* format a characteristic value, accommodating Strength's strangeness */
1731 attrval(attrindx, attrvalue, resultbuf)
1732 int attrindx, attrvalue;
1733 char resultbuf[]; /* should be at least [7] to hold "18/100\0" */
1735 if (attrindx != A_STR || attrvalue <= 18)
1736 Sprintf(resultbuf, "%d", attrvalue);
1737 else if (attrvalue > STR18(100)) /* 19 to 25 */
1738 Sprintf(resultbuf, "%d", attrvalue - 100);
1739 else /* simplify "18/ **" to be "18/100" */
1740 Sprintf(resultbuf, "18/%02d", attrvalue - 18);
1745 enlightenment(mode, final)
1746 int mode; /* BASICENLIGHTENMENT | MAGICENLIGHTENMENT (| both) */
1747 int final; /* ENL_GAMEINPROGRESS:0, ENL_GAMEOVERALIVE, ENL_GAMEOVERDEAD */
1749 char buf[BUFSZ], tmpbuf[BUFSZ];
1751 Strcpy(tmpbuf, plname);
1752 *tmpbuf = highc(*tmpbuf); /* same adjustment as bottom line */
1753 /* as in background_enlightenment, when poly'd we need to use the saved
1754 gender in u.mfemale rather than the current you-as-monster gender */
1756 Sprintf(buf, "%s the %s's attributes:", tmpbuf,
1757 ((Upolyd ? u.mfemale : flags.female) && urole.name.f)
1761 Sprintf(buf, "%s
\82Ì%s
\82Ì
\91®
\90«:",
1762 ((Upolyd ? u.mfemale : flags.female) && urole.name.f)
1768 en_win = create_nhwindow(NHW_MENU);
1770 putstr(en_win, 0, buf); /* "Conan the Archeologist's attributes:" */
1771 /* background and characteristics; ^X or end-of-game disclosure */
1772 if (mode & BASICENLIGHTENMENT) {
1773 /* role, race, alignment, deities */
1774 background_enlightenment(mode, final);
1775 /* strength, dexterity, &c */
1776 characteristics_enlightenment(mode, final);
1778 /* expanded status line information, including things which aren't
1779 included there due to space considerations--such as obvious
1780 alternative movement indicators (riding, levitation, &c), and
1781 various troubles (turning to stone, trapped, confusion, &c);
1782 shown for both basic and magic enlightenment */
1783 status_enlightenment(mode, final);
1784 /* remaining attributes; shown for potion,&c or wizard mode and
1785 explore mode ^X or end of game disclosure */
1786 if (mode & MAGICENLIGHTENMENT) {
1787 /* intrinsics and other traditional enlightenment feedback */
1788 attributes_enlightenment(mode, final);
1790 display_nhwindow(en_win, TRUE);
1791 destroy_nhwindow(en_win);
1796 /* display role, race, alignment and such to en_win */
1798 background_enlightenment(unused_mode, final)
1799 int unused_mode UNUSED;
1802 const char *role_titl, *rank_titl;
1803 int innategend, difgend, difalgn;
1804 char buf[BUFSZ], tmpbuf[BUFSZ];
1806 /* note that if poly'd, we need to use u.mfemale instead of flags.female
1807 to access hero's saved gender-as-human/elf/&c rather than current one */
1808 innategend = (Upolyd ? u.mfemale : flags.female) ? 1 : 0;
1809 role_titl = (innategend && urole.name.f) ? urole.name.f : urole.name.m;
1810 rank_titl = rank_of(u.ulevel, Role_switch, innategend);
1812 putstr(en_win, 0, ""); /* separator after title */
1814 putstr(en_win, 0, "Background:");
1816 putstr(en_win, 0, "
\94w
\8ci
\8fî
\95ñ:");
1818 /* if polymorphed, report current shape before underlying role;
1819 will be repeated as first status: "you are transformed" and also
1820 among various attributes: "you are in beast form" (after being
1821 told about lycanthropy) or "you are polymorphed into <a foo>"
1822 (with countdown timer appended for wizard mode); we really want
1823 the player to know he's not a samurai at the moment... */
1825 struct permonst *uasmon = youmonst.data;
1828 /* here we always use current gender, not saved role gender */
1829 if (!is_male(uasmon) && !is_female(uasmon) && !is_neuter(uasmon))
1831 Sprintf(tmpbuf, "%s ", genders[flags.female ? 1 : 0].adj);
1833 Sprintf(tmpbuf, "%s
\82Ì", genders[flags.female ? 1 : 0].adj);
1835 Sprintf(buf, "%sin %s%s form", !final ? "currently " : "", tmpbuf,
1838 Sprintf(buf, "%s%s%s
\82Ì
\8ep", !final ? "
\8d¡
\82Ì
\82Æ
\82±
\82ë" : "", tmpbuf,
1844 you_are_ing(buf, "");
1847 /* report role; omit gender if it's redundant (eg, "female priestess") */
1850 && ((urole.allow & ROLE_GENDMASK) == (ROLE_MALE | ROLE_FEMALE)
1851 || innategend != flags.initgend))
1853 Sprintf(tmpbuf, "%s ", genders[innategend].adj);
1855 Sprintf(tmpbuf, "%s", genders[innategend].adj);
1859 Strcpy(buf, "actually "); /* "You are actually a ..." */
1861 Strcpy(buf, "
\8eÀ
\8dÛ
\82É
\82Í"); /* "
\82 \82È
\82½
\82Í
\8eÀ
\8dÛ
\82É
\82Í..." */
1863 if (!strcmpi(rank_titl, role_titl)) {
1864 /* omit role when rank title matches it */
1866 Sprintf(eos(buf), "%s, level %d %s%s", an(rank_titl), u.ulevel,
1867 tmpbuf, urace.noun);
1869 Sprintf(eos(buf), "
\83\8c\83x
\83\8b%d
\82Ì%s
\82Ì%s%s", u.ulevel,
1870 tmpbuf, urace.adj, role_titl);
1874 Sprintf(eos(buf), "%s, a level %d %s%s %s", an(rank_titl), u.ulevel,
1875 tmpbuf, urace.adj, role_titl);
1877 Sprintf(eos(buf), "
\83\8c\83x
\83\8b%d
\82Ì%s
\82Ì%s%s
\82Ì%s", u.ulevel,
1878 tmpbuf, urace.adj, role_titl, rank_titl);
1883 /* report alignment (bypass you_are() in order to omit ending period);
1884 adverb is used to distinguish between temporary change (helm of opp.
1885 alignment), permanent change (one-time conversion), and original */
1887 Sprintf(buf, " %s%s%s, %son a mission for %s",
1888 You_, !final ? are : were,
1889 align_str(u.ualign.type),
1890 /* helm of opposite alignment (might hide conversion) */
1891 (u.ualign.type != u.ualignbase[A_CURRENT])
1892 /* what's the past tense of "currently"? if we used "formerly"
1893 it would sound like a reference to the original alignment */
1894 ? (!final ? "currently " : "temporarily ")
1895 /* permanent conversion */
1896 : (u.ualign.type != u.ualignbase[A_ORIGINAL])
1897 /* and what's the past tense of "now"? certainly not "then"
1898 in a context like this...; "belatedly" == weren't that
1899 way sooner (in other words, didn't start that way) */
1900 ? (!final ? "now " : "belatedly ")
1901 /* atheist (ignored in very early game) */
1902 : (!u.uconduct.gnostic && moves > 1000L)
1904 /* lastly, normal case */
1908 Sprintf(buf, "
\82 \82È
\82½
\82Í%s
\82Å, %s%s
\82Ì
\82½
\82ß
\82Ì
\94C
\96±
\82ð
\8ds
\82Á
\82Ä%s
\81D",
1909 align_str(u.ualign.type),
1910 /* helm of opposite alignment (might hide conversion) */
1911 (u.ualign.type != u.ualignbase[A_CURRENT]) ? "
\88ê
\8e\9e\93I
\82É"
1912 /* permanent conversion */
1913 : (u.ualign.type != u.ualignbase[A_ORIGINAL]) ? "
\8c»
\8dÝ"
1914 /* atheist (ignored in very early game) */
1915 : (!u.uconduct.gnostic && moves > 1000L) ? "
\96¼
\8b`
\8fã"
1916 /* lastly, normal case */
1918 u_gname(), !final ? iru : ita);
1920 putstr(en_win, 0, buf);
1921 /* show the rest of this game's pantheon (finishes previous sentence)
1922 [appending "also Moloch" at the end would allow for straightforward
1923 trailing "and" on all three aligned entries but looks too verbose] */
1925 Sprintf(buf, " who %s opposed by", !final ? "is" : "was");
1927 Strcpy(buf, "
\82 \82È
\82½
\82Í");
1929 if (u.ualign.type != A_LAWFUL)
1931 Sprintf(eos(buf), " %s (%s) and", align_gname(A_LAWFUL),
1932 align_str(A_LAWFUL));
1934 Sprintf(eos(buf), "%s(%s)
\82¨
\82æ
\82Ñ", align_gname(A_LAWFUL),
1935 align_str(A_LAWFUL));
1937 if (u.ualign.type != A_NEUTRAL)
1939 Sprintf(eos(buf), " %s (%s)%s", align_gname(A_NEUTRAL),
1940 align_str(A_NEUTRAL),
1941 (u.ualign.type != A_CHAOTIC) ? " and" : "");
1943 Sprintf(eos(buf), "%s(%s)%s", align_gname(A_NEUTRAL),
1944 align_str(A_NEUTRAL),
1945 (u.ualign.type != A_CHAOTIC) ? "
\82¨
\82æ
\82Ñ" : "");
1948 if (u.ualign.type != A_CHAOTIC)
1949 Sprintf(eos(buf), " %s (%s)", align_gname(A_CHAOTIC),
1950 align_str(A_CHAOTIC));
1952 if (u.ualign.type != A_CHAOTIC)
1953 Sprintf(eos(buf), "%s(%s)", align_gname(A_CHAOTIC),
1954 align_str(A_CHAOTIC));
1957 Strcat(buf, "."); /* terminate sentence */
1959 Sprintf(eos(buf), "
\82Æ
\91Î
\97§
\82µ
\82Ä%s
\81D", !final ? iru : ita);
1961 putstr(en_win, 0, buf);
1963 /* show original alignment,gender,race,role if any have been changed;
1964 giving separate message for temporary alignment change bypasses need
1965 for tricky phrasing otherwise necessitated by possibility of having
1966 helm of opposite alignment mask a permanent alignment conversion */
1967 difgend = (innategend != flags.initgend);
1968 difalgn = (((u.ualign.type != u.ualignbase[A_CURRENT]) ? 1 : 0)
1969 + ((u.ualignbase[A_CURRENT] != u.ualignbase[A_ORIGINAL])
1971 if (difalgn & 1) { /* have temporary alignment so report permanent one */
1973 Sprintf(buf, "actually %s", align_str(u.ualignbase[A_CURRENT]));
1975 Sprintf(buf, "
\8eÀ
\8dÛ
\82É
\82Í%s", align_str(u.ualignbase[A_CURRENT]));
1979 enl_msg(buf, "
\82Ä
\82¢
\82é", "
\82Ä
\82¢
\82½", "", "");
1980 difalgn &= ~1; /* suppress helm from "started out <foo>" message */
1982 if (difgend || difalgn) { /* sex change or perm align change or both */
1984 Sprintf(buf, " You started out %s%s%s.",
1985 difgend ? genders[flags.initgend].adj : "",
1986 (difgend && difalgn) ? " and " : "",
1987 difalgn ? align_str(u.ualignbase[A_ORIGINAL]) : "");
1989 Sprintf(buf, "
\82 \82È
\82½
\82Í%s%s%s
\82Å
\8aJ
\8en
\82µ
\82½
\81D",
1990 difgend ? genders[flags.initgend].adj : "",
1991 (difgend && difalgn) ? "
\82©
\82Â" : "",
1992 difalgn ? align_str(u.ualignbase[A_ORIGINAL]) : "");
1994 putstr(en_win, 0, buf);
1998 /* characteristics: expanded version of bottom line strength, dexterity, &c;
1999 [3.6.1: now includes all status info (except things already shown in the
2000 'background' section), primarily so that blind players can suppress the
2001 status line(s) altogether and use ^X feedback on demand to view HP, &c] */
2003 characteristics_enlightenment(mode, final)
2008 int hp = Upolyd ? u.mh : u.uhp;
2009 int hpmax = Upolyd ? u.mhmax : u.uhpmax;
2011 putstr(en_win, 0, ""); /* separator after background */
2014 final ? "Final Characteristics:" : "Current Characteristics:");
2016 final ? "
\8dÅ
\8fI
\91®
\90«
\81F" : "
\8c»
\8dÝ
\82Ì
\91®
\90«
\81F");
2021 Sprintf(buf, "%d hit points (max:%d)", hp, hpmax);
2023 Sprintf(buf, "%d
\83q
\83b
\83g
\83|
\83C
\83\93\83g(
\8dÅ
\91å:%d)", hp, hpmax);
2027 Sprintf(buf, "%d magic power (max:%d)", u.uen, u.uenmax);
2029 Sprintf(buf, "%d
\96\82\97Í
\83|
\83C
\83\93\83g(
\8dÅ
\91å:%d)", u.uen, u.uenmax);
2032 Sprintf(buf, "%d", u.uac);
2034 enl_msg("Your armor class ", "is ", "was ", buf, "");
2036 enl_msg("
\82 \82È
\82½
\82Ì
\96h
\8cä
\92l
\82Í", "
\82Å
\82 \82é", "
\82Å
\82 \82Á
\82½", buf, "");
2039 switch (mons[u.umonnum].mlevel) {
2041 /* status line currently being explained shows "HD:0" */
2043 Strcpy(buf, "0 hit dice (actually 1/2)");
2045 Strcpy(buf, "HD0(
\8eÀ
\8dÛ
\82É
\82Í1/2)");
2049 Strcpy(buf, "1 hit die");
2055 Sprintf(buf, "%d hit dice", mons[u.umonnum].mlevel);
2057 Sprintf(buf, "HD%d", mons[u.umonnum].mlevel);
2061 /* flags.showexp does not matter */
2062 /* experience level is already shown in the Background section */
2064 Sprintf(buf, "%-1ld experience point%s",
2065 u.uexp, plur(u.uexp));
2067 Sprintf(buf, "
\8co
\8c±
\92l%-1ld
\83|
\83C
\83\93\83g",
2073 /* this is shown even if the 'time' option is off */
2075 Sprintf(buf, "the dungeon %ld turn%s ago", moves, plur(moves));
2077 Sprintf(buf, "%ld
\83^
\81[
\83\93\91O
\82É
\96À
\8b{
\82É
\93ü
\82Á
\82½", moves);
2078 /* same phrasing at end of game: "entered" is unconditional */
2079 enlght_line(You_, "", buf, "");
2081 #ifdef SCORE_ON_BOTL
2082 if (flags.showscore) {
2083 /* describes what's shown on status line, which is an approximation;
2084 only show it here if player has the 'showscore' option enabled */
2086 Sprintf(buf, "%ld%s", botl_score(),
2087 !final ? "" : " before end-of-game adjustments");
2088 enl_msg("Your score ", "is ", "was ", buf, "");
2090 Sprintf(buf, "%s%ld", botl_score(),
2091 !final ? "" : "
\83Q
\81[
\83\80\8fI
\97¹
\8e\9e\82Ì
\92²
\90®
\91O
\82Í");
2092 enl_msg("
\82 \82È
\82½
\82Ì
\83X
\83R
\83A
\82Í", "
\82Å
\82 \82é", "
\82Å
\82 \82Á
\82½", buf, "");
2097 /* bottom line order */
2098 one_characteristic(mode, final, A_STR); /* strength */
2099 one_characteristic(mode, final, A_DEX); /* dexterity */
2100 one_characteristic(mode, final, A_CON); /* constitution */
2101 one_characteristic(mode, final, A_INT); /* intelligence */
2102 one_characteristic(mode, final, A_WIS); /* wisdom */
2103 one_characteristic(mode, final, A_CHA); /* charisma */
2106 /* display one attribute value for characteristics_enlightenment() */
2108 one_characteristic(mode, final, attrindx)
2109 int mode, final, attrindx;
2111 extern const char *const attrname[]; /* attrib.c */
2112 boolean hide_innate_value = FALSE, interesting_alimit;
2113 int acurrent, abase, apeak, alimit;
2114 const char *paren_pfx;
2115 char subjbuf[BUFSZ], valubuf[BUFSZ], valstring[32];
2117 /* being polymorphed or wearing certain cursed items prevents
2118 hero from reliably tracking changes to characteristics so
2119 we don't show base & peak values then; when the items aren't
2120 cursed, hero could take them off to check underlying values
2121 and we show those in such case so that player doesn't need
2122 to actually resort to doing that */
2124 hide_innate_value = TRUE;
2125 } else if (Fixed_abil) {
2126 if (stuck_ring(uleft, RIN_SUSTAIN_ABILITY)
2127 || stuck_ring(uright, RIN_SUSTAIN_ABILITY))
2128 hide_innate_value = TRUE;
2132 if (uarmg && uarmg->otyp == GAUNTLETS_OF_POWER && uarmg->cursed)
2133 hide_innate_value = TRUE;
2138 if (uwep && uwep->oartifact == ART_OGRESMASHER && uwep->cursed)
2139 hide_innate_value = TRUE;
2142 if (uarmh && uarmh->otyp == DUNCE_CAP && uarmh->cursed)
2143 hide_innate_value = TRUE;
2146 if (uarmh && uarmh->otyp == DUNCE_CAP && uarmh->cursed)
2147 hide_innate_value = TRUE;
2152 return; /* impossible */
2154 /* note: final disclosure includes MAGICENLIGHTENTMENT */
2155 if ((mode & MAGICENLIGHTENMENT) && !Upolyd)
2156 hide_innate_value = FALSE;
2158 acurrent = ACURR(attrindx);
2159 (void) attrval(attrindx, acurrent, valubuf); /* Sprintf(valubuf,"%d",) */
2161 Sprintf(subjbuf, "Your %s ", attrname[attrindx]);
2163 Sprintf(subjbuf, "
\82 \82È
\82½
\82Ì%s
\82Í", attrname[attrindx]);
2165 if (!hide_innate_value) {
2166 /* show abase, amax, and/or attrmax if acurr doesn't match abase
2167 (a magic bonus or penalty is in effect) or abase doesn't match
2168 amax (some points have been lost to poison or exercise abuse
2169 and are restorable) or attrmax is different from normal human
2170 (while game is in progress; trying to reduce dependency on
2171 spoilers to keep track of such stuff) or attrmax was different
2172 from abase (at end of game; this attribute wasn't maxed out) */
2173 abase = ABASE(attrindx);
2174 apeak = AMAX(attrindx);
2175 alimit = ATTRMAX(attrindx);
2176 /* criterium for whether the limit is interesting varies */
2177 interesting_alimit =
2178 final ? TRUE /* was originally `(abase != alimit)' */
2179 : (alimit != (attrindx != A_STR ? 18 : STR18(100)));
2181 paren_pfx = final ? " (" : " (current; ";
2183 paren_pfx = final ? " (" : " (
\8c»
\8dÝ; ";
2184 if (acurrent != abase) {
2186 Sprintf(eos(valubuf), "%sbase:%s", paren_pfx,
2187 attrval(attrindx, abase, valstring));
2189 Sprintf(eos(valubuf), "%s
\8aî
\96{:%s", paren_pfx,
2190 attrval(attrindx, abase, valstring));
2194 if (abase != apeak) {
2196 Sprintf(eos(valubuf), "%speak:%s", paren_pfx,
2197 attrval(attrindx, apeak, valstring));
2199 Sprintf(eos(valubuf), "%s
\8dÅ
\91å:%s", paren_pfx,
2200 attrval(attrindx, apeak, valstring));
2204 if (interesting_alimit) {
2206 Sprintf(eos(valubuf), "%s%slimit:%s", paren_pfx,
2207 /* more verbose if exceeding 'limit' due to magic bonus */
2208 (acurrent > alimit) ? "innate " : "",
2209 attrval(attrindx, alimit, valstring));
2211 Sprintf(eos(valubuf), "%s%s
\8fã
\8cÀ:%s", paren_pfx,
2212 /* more verbose if exceeding 'limit' due to magic bonus */
2213 (acurrent > alimit) ? "
\96{
\97\88\82Ì" : "",
2214 attrval(attrindx, alimit, valstring));
2216 /* paren_pfx = ", "; */
2218 if (acurrent != abase || abase != apeak || interesting_alimit)
2219 Strcat(valubuf, ")");
2222 enl_msg(subjbuf, "is ", "was ", valubuf, "");
2224 enl_msg(subjbuf, "
\82¾", "
\82¾
\82Á
\82½", valubuf, "");
2227 /* status: selected obvious capabilities, assorted troubles */
2229 status_enlightenment(mode, final)
2233 boolean magic = (mode & MAGICENLIGHTENMENT) ? TRUE : FALSE;
2235 char buf[BUFSZ], youtoo[BUFSZ];
2236 boolean Riding = (u.usteed
2237 /* if hero dies while dismounting, u.usteed will still
2238 be set; we want to ignore steed in that situation */
2239 && !(final == ENL_GAMEOVERDEAD
2241 && !strcmp(killer.name, "riding accident")));
2243 && !strcmp(killer.name, "
\8bR
\8fæ
\8e\96\8cÌ
\82Å")));
2244 const char *steedname = (!Riding ? (char *) 0
2245 : x_monnam(u.usteed,
2246 u.usteed->mtame ? ARTICLE_YOUR : ARTICLE_THE,
2248 (SUPPRESS_SADDLE | SUPPRESS_HALLUCINATION),
2252 * Status (many are abbreviated on bottom line; others are or
2253 * should be discernible to the hero hence to the player)
2255 putstr(en_win, 0, ""); /* separator after title or characteristics */
2257 putstr(en_win, 0, final ? "Final Status:" : "Current Status:");
2259 putstr(en_win, 0, final ? "
\8dÅ
\8fI
\8fó
\91Ô:" : "
\8c»
\8dÝ
\82Ì
\8fó
\91Ô:");
2261 Strcpy(youtoo, You_);
2262 /* not a traditional status but inherently obvious to player; more
2263 detail given below (attributes section) for magic enlightenment */
2266 Strcpy(buf, "transformed");
2268 Sprintf(eos(buf), " and %s %s inside",
2269 final ? "felt" : "feel", udeadinside());
2271 #else /*JP:TODO:
\95Ï
\89»+
\8bs
\8eE
\83p
\83^
\81[
\83\93*/
2272 you_are_ing("
\95Ï
\89»
\82µ
\82Ä", "");
2275 /* not a trouble, but we want to display riding status before maybe
2276 reporting steed as trapped or hero stuck to cursed saddle */
2279 Sprintf(buf, "riding %s", steedname);
2282 Sprintf(buf, "%s
\82É
\8fæ
\82Á
\82Ä", steedname);
2283 you_are_ing(buf, "");
2286 Sprintf(eos(youtoo), "and %s ", steedname);
2288 Sprintf(youtoo, "
\82 \82È
\82½
\82Æ%s
\82Í", steedname);
2290 /* other movement situations that hero should always know */
2292 if (Lev_at_will && magic)
2294 you_are("levitating, at will", "");
2296 you_are_ing("
\8e©
\95ª
\82Ì
\88Ó
\8eu
\82Å
\95\82\97V
\82µ
\82Ä", "");
2299 enl_msg(youtoo, are, were, "levitating", from_what(LEVITATION));
2301 enl_msg(youtoo, "
\82¢
\82é", "
\82¢
\82½", "
\95\82\97V
\82µ
\82Ä", from_what(LEVITATION));
2302 } else if (Flying) { /* can only fly when not levitating */
2304 enl_msg(youtoo, are, were, "flying", from_what(FLYING));
2306 enl_msg(youtoo, "
\82¢
\82é", "
\82¢
\82½", "
\94ò
\82ñ
\82Å", from_what(FLYING));
2310 you_are("underwater", "");
2312 enl_msg(You_, "
\82¢
\82é", "
\82¢
\82½", "
\90\85\96Ê
\89º
\82É", "");
2313 } else if (u.uinwater) {
2315 you_are(Swimming ? "swimming" : "in water", from_what(SWIMMING));
2317 enl_msg(You_, Swimming ? "
\89j
\82¢
\82Å" : "
\90\85\92\86\82É", "
\82¢
\82é", "
\82¢
\82½", from_what(SWIMMING));
2318 } else if (walking_on_water()) {
2319 /* show active Wwalking here, potential Wwalking elsewhere */
2321 Sprintf(buf, "walking on %s",
2322 is_pool(u.ux, u.uy) ? "water"
2323 : is_lava(u.ux, u.uy) ? "lava"
2324 : surface(u.ux, u.uy)); /* catchall; shouldn't happen */
2325 you_are(buf, from_what(WWALKING));
2327 Sprintf(buf, "%s
\82Ì
\8fã
\82ð
\95à
\82¢
\82Ä",
2328 is_pool(u.ux, u.uy) ? "
\90\85"
2329 : is_lava(u.ux, u.uy) ? "
\97n
\8aâ"
2330 : surface(u.ux, u.uy)); /* catchall; shouldn't happen */
2331 you_are_ing(buf, from_what(WWALKING));
2334 if (Upolyd && (u.uundetected || youmonst.m_ap_type != M_AP_NOTHING))
2335 youhiding(TRUE, final);
2337 /* internal troubles, mostly in the order that prayer ranks them */
2340 you_are("turning to stone", "");
2342 enl_msg("
\82 \82È
\82½
\82Í", "
\82È
\82è
\82Â
\82Â
\82 \82é", "
\82È
\82Á
\82½", "
\90Î
\82É", "");
2345 you_are("turning into slime", "");
2347 enl_msg("
\82 \82È
\82½
\82Í", "
\82È
\82è
\82Â
\82Â
\82 \82é", "
\82È
\82Á
\82½", "
\83X
\83\89\83C
\83\80\82É", "");
2351 you_are("buried", "");
2353 you_are_ing("
\92\82\91§
\82µ
\82Ä", "");
2356 Strcpy(buf, "being strangled");
2358 Strcpy(buf, "
\8eñ
\82ð
\8di
\82ß
\82ç
\82ê
\82Ä");
2360 Sprintf(eos(buf), " (%ld)", (Strangled & TIMEOUT));
2362 you_are(buf, from_what(STRANGLED));
2364 enl_msg("
\82 \82È
\82½
\82Í", "
\82¢
\82é", "
\82¢
\82½", buf, from_what(STRANGLED));
2368 /* prayer lumps these together; botl puts Ill before FoodPois */
2369 if (u.usick_type & SICK_NONVOMITABLE)
2371 you_are("terminally sick from illness", "");
2373 enl_msg("
\82 \82È
\82½
\82Í
\95a
\8bC
\82Å
\92v
\96½
\93I
\82É
\8bC
\95ª
\82ª
\88«", "
\82¢", "
\82©
\82Á
\82½", "", "");
2374 if (u.usick_type & SICK_VOMITABLE)
2376 you_are("terminally sick from food poisoning", "");
2378 enl_msg("
\82 \82È
\82½
\82Í
\90H
\92\86\93Å
\82Å
\92v
\96½
\93I
\82É
\8bC
\95ª
\82ª
\88«", "
\82¢", "
\82©
\82Á
\82½", "", "");
2382 you_are("nauseated", "");
2384 enl_msg(You_, "
\93f
\82«
\8bC
\82ª", "
\82 \82é", "
\82 \82Á
\82½", "");
2387 you_are("stunned", "");
2389 you_are("
\82
\82ç
\82
\82ç
\8fó
\91Ô", "");
2392 you_are("confused", "");
2394 you_are("
\8d¬
\97\90\8fó
\91Ô", "");
2397 you_are("hallucinating", "");
2399 you_are("
\8c¶
\8ao
\8fó
\91Ô", "");
2401 /* from_what() (currently wizard-mode only) checks !haseyes()
2402 before u.uroleplay.blind, so we should too */
2404 Sprintf(buf, "%s blind",
2405 !haseyes(youmonst.data) ? "innately"
2406 : u.uroleplay.blind ? "permanently"
2407 /* better phrasing desperately wanted... */
2408 : Blindfolded_only ? "deliberately"
2411 Sprintf(buf, "%s
\96Ó
\96Ú",
2412 !haseyes(youmonst.data) ? "
\90¶
\82Ü
\82ê
\82È
\82ª
\82ç
\82É"
2413 : u.uroleplay.blind ? "
\8dP
\8bv
\93I
\82É"
2414 /* better phrasing desperately wanted... */
2415 : Blindfolded_only ? "
\8cÌ
\88Ó
\82É"
2416 : "
\88ê
\8e\9e\93I
\82É");
2418 if (wizard && (Blinded & TIMEOUT) != 0L
2419 && !u.uroleplay.blind && haseyes(youmonst.data))
2420 Sprintf(eos(buf), " (%ld)", (Blinded & TIMEOUT));
2421 /* !haseyes: avoid "you are innately blind innately" */
2422 you_are(buf, !haseyes(youmonst.data) ? "" : from_what(BLINDED));
2426 you_are("deaf", from_what(DEAF));
2428 you_are("
\8e¨
\82ª
\95·
\82±
\82¦
\82È
\82¢
\8fó
\91Ô", from_what(DEAF));
2430 /* external troubles, more or less */
2434 Sprintf(buf, "chained to %s", ansimpleoname(uball));
2436 Sprintf(buf, "%s
\82É
\82Â
\82È
\82ª
\82ê
\82Ä", ansimpleoname(uball));
2438 impossible("Punished without uball?");
2440 Strcpy(buf, "punished");
2442 Strcpy(buf, "
\94±
\82ð
\8eó
\82¯
\82Ä");
2447 char predicament[BUFSZ];
2449 boolean anchored = (u.utraptype == TT_BURIEDBALL);
2453 Strcpy(predicament, "tethered to something buried");
2455 Strcpy(predicament, "
\89½
\82©
\96\84\82Ü
\82Á
\82Ä
\82¢
\82é
\82à
\82Ì
\82É
\82Â
\82È
\82ª
\82ê
\82Ä");
2456 } else if (u.utraptype == TT_INFLOOR || u.utraptype == TT_LAVA) {
2458 Sprintf(predicament, "stuck in %s", the(surface(u.ux, u.uy)));
2460 Sprintf(predicament, "%s
\82É
\96\84\82Ü
\82Á
\82Ä", surface(u.ux, u.uy));
2463 Strcpy(predicament, "trapped");
2464 if ((t = t_at(u.ux, u.uy)) != 0)
2465 Sprintf(eos(predicament), " in %s",
2466 an(defsyms[trap_to_defsym(t->ttyp)].explanation));
2468 predicament[0] = '\0';
2469 if ((t = t_at(u.ux, u.uy)) != 0)
2470 Sprintf(predicament, "%s
\82É",
2471 defsyms[trap_to_defsym(t->ttyp)].explanation);
2472 Strcat(predicament, "
\82Ð
\82Á
\82©
\82©
\82Á
\82Ä");
2475 if (u.usteed) { /* not `Riding' here */
2477 Sprintf(buf, "%s%s ", anchored ? "you and " : "", steedname);
2479 enl_msg(buf, (anchored ? "are " : "is "),
2480 (anchored ? "were " : "was "), predicament, "");
2482 Sprintf(buf, "%s%s
\82Í", anchored ? "
\82 \82È
\82½
\82Æ" : "", steedname);
2483 enl_msg(buf, "
\82¢
\82é", "
\82¢
\82½" , predicament, "");
2486 you_are(predicament, "");
2490 Sprintf(buf, "swallowed by %s", a_monnam(u.ustuck));
2492 Sprintf(buf, "%s
\82É
\88ù
\82Ý
\8d\9e\82Ü
\82ê
\82Ä", a_monnam(u.ustuck));
2494 Sprintf(eos(buf), " (%u)", u.uswldtim);
2496 } else if (u.ustuck) {
2498 Sprintf(buf, "%s %s",
2499 (Upolyd && sticks(youmonst.data)) ? "holding" : "held by",
2500 a_monnam(u.ustuck));
2503 Sprintf(buf, "%s%s",
2505 (Upolyd && sticks(youmonst.data)) ? "
\82ð
\95ß
\82Ü
\82¦
\82Ä" : "
\82É
\95ß
\82Ü
\82Á
\82Ä");
2506 you_are_ing(buf, "");
2510 struct obj *saddle = which_armor(u.usteed, W_SADDLE);
2512 if (saddle && saddle->cursed) {
2514 Sprintf(buf, "stuck to %s %s", s_suffix(steedname),
2515 simpleonames(saddle));
2518 Sprintf(buf, "%s
\82Ì%s
\82É
\82Â
\82©
\82Ü
\82Á
\82Ä", steedname,
2519 simpleonames(saddle));
2520 you_are_ing(buf, "");
2525 /* when mounted, Wounded_legs applies to steed rather than to
2526 hero; we only report steed's wounded legs in wizard mode */
2527 if (u.usteed) { /* not `Riding' here */
2528 if (wizard && steedname) {
2530 Strcpy(buf, steedname);
2532 enl_msg(buf, " has", " had", " wounded legs", "");
2534 enl_msg(buf, iru, ita, "
\82Í
\8e\88\82ð
\89ö
\89ä
\82µ
\82Ä", "");
2539 Sprintf(buf, "wounded %s", makeplural(body_part(LEG)));
2542 Sprintf(buf, "%s
\82ð
\89ö
\89ä
\82µ
\82Ä", makeplural(body_part(LEG)));
2543 you_are_ing(buf, "");
2549 Sprintf(buf, "slippery %s", makeplural(body_part(FINGER)));
2552 Sprintf(buf, "%s
\82ª
\82Ê
\82é
\82Ê
\82é
\82µ
\82Ä", body_part(FINGER));
2553 enl_msg(buf, iru, ita, "", "");
2557 if (magic || cause_known(FUMBLING))
2559 enl_msg(You_, "fumble", "fumbled", "", from_what(FUMBLING));
2561 you_are_ing("
\95s
\8aí
\97p
\82É
\82È
\82Á
\82Ä", from_what(FUMBLING));
2564 if (magic || cause_known(SLEEPY)) {
2565 Strcpy(buf, from_what(SLEEPY));
2567 Sprintf(eos(buf), " (%ld)", (HSleepy & TIMEOUT));
2569 enl_msg("You ", "fall", "fell", " asleep uncontrollably", buf);
2571 you_are_ing("
\96°
\82Á
\82Ä", buf);
2574 /* hunger/nutrition */
2576 if (magic || cause_known(HUNGER))
2578 enl_msg(You_, "hunger", "hungered", " rapidly",
2581 enl_msg("
\82 \82È
\82½
\82Í
\82·
\82®
\82É
\95 \82ª
\8c¸
\82é
\8fó
\91Ô", "
\82Å
\82 \82é", "
\82¾
\82Á
\82½", "", "");
2584 Strcpy(buf, hu_stat[u.uhs]); /* hunger status; omitted if "normal" */
2585 mungspaces(buf); /* strip trailing spaces */
2588 *buf = lowc(*buf); /* override capitalization */
2589 if (!strcmp(buf, "weak"))
2590 Strcat(buf, " from severe hunger");
2591 else if (!strncmp(buf, "faint", 5)) /* fainting, fainted */
2592 Strcat(buf, " due to starvation");
2595 Strcat(buf, "
\8fó
\91Ô");
2600 if ((cap = near_capacity()) > UNENCUMBERED) {
2602 const char *adj = "?_?"; /* (should always get overridden) */
2604 Strcpy(buf, enc_stat[cap]);
2609 break; /* burdened */
2612 break; /* stressed */
2615 break; /* strained */
2618 break; /* overtaxed */
2620 adj = "not possible";
2623 Sprintf(eos(buf), "; movement %s %s%s", !final ? "is" : "was", adj,
2624 (cap < OVERLOADED) ? " slowed" : "");
2627 Sprintf(buf, "
\89×
\95¨
\82É
\82æ
\82Á
\82Ä%s
\8fó
\91Ô", enc_stat[cap]);
2631 /* last resort entry, guarantees Status section is non-empty
2632 (no longer needed for that purpose since weapon status added;
2633 still useful though) */
2635 you_are("unencumbered", "");
2637 you_are("
\89×
\95¨
\82Í
\8e×
\96\82\82É
\82È
\82ç
\82È
\82¢
\8fó
\91Ô", "");
2639 /* report being weaponless; distinguish whether gloves are worn */
2642 you_are(uarmg ? "empty handed" /* gloves imply hands */
2643 : humanoid(youmonst.data)
2644 /* hands but no weapon and no gloves */
2646 /* alternate phrasing for paws or lack of hands */
2647 : "not wielding anything",
2650 enl_msg(You_, "
\82¢", "
\82©
\82Á
\82½", "
\95\90\8aí
\82ð
\91\95\94õ
\82µ
\82Ä
\82¢
\82È", "");
2652 /* two-weaponing implies a weapon (not other odd stuff) in each hand */
2653 } else if (u.twoweap) {
2655 you_are("wielding two weapons at once", "");
2657 you_are("
\93ñ
\93\81\97¬", "");
2658 /* report most weapons by their skill class (so a katana will be
2659 described as a long sword, for instance; mattock and hook are
2660 exceptions), or wielded non-weapon item by its object class */
2662 const char *what = weapon_descr(uwep);
2665 if (!strcmpi(what, "armor") || !strcmpi(what, "food")
2666 || !strcmpi(what, "venom"))
2667 Sprintf(buf, "wielding some %s", what);
2669 Sprintf(buf, "wielding %s",
2670 (uwep->quan == 1L) ? an(what) : makeplural(what));
2673 Sprintf(buf, "%s
\82ð
\91\95\94õ
\82µ
\82Ä", what);
2674 enl_msg(You_, "
\82¢
\82é", "
\82¢
\82½", buf, "");
2677 /* report 'nudity' */
2678 if (!uarm && !uarmu && !uarmc && !uarmg && !uarmf && !uarmh) {
2679 if (u.uroleplay.nudist)
2681 enl_msg(You_, "do", "did", " not wear any armor", "");
2683 enl_msg(You_, "
\82¢", "
\82©
\82Á
\82½", "
\89½
\82Ì
\8aZ
\82à
\91\95\94õ
\82µ
\82È", "");
2687 you_are("not wearing any armor", "");
2689 enl_msg(You_, "
\82¢", "
\82©
\82Á
\82½", "
\89½
\82Ì
\8aZ
\82à
\91\95\94õ
\82µ
\82Ä
\82¢
\82È", "");
2694 /* attributes: intrinsics and the like, other non-obvious capabilities */
2696 attributes_enlightenment(unused_mode, final)
2697 int unused_mode UNUSED;
2700 static NEARDATA const char if_surroundings_permitted[] =
2701 " if surroundings permitted";
2708 putstr(en_win, 0, "");
2710 putstr(en_win, 0, final ? "Final Attributes:" : "Current Attributes:");
2712 putstr(en_win, 0, final ? "
\8dÅ
\8fI
\91®
\90«:" : "
\8c»
\8dÝ
\82Ì
\91®
\90«:");
2714 if (u.uevent.uhand_of_elbereth) {
2716 static const char *const hofe_titles[3] = { "the Hand of Elbereth",
2717 "the Envoy of Balance",
2718 "the Glory of Arioch" };
2720 static const char *const hofe_titles[3] = { "
\83G
\83\8b\83x
\83\8c\83X
\82Ì
\8cä
\8eè",
2721 "
\92²
\98a
\82Ì
\8eg
\8eÒ",
2722 "
\83A
\83\8a\83I
\83b
\83`
\82Ì
\96¼
\97_" };
2724 you_are(hofe_titles[u.uevent.uhand_of_elbereth - 1], "");
2728 Sprintf(buf, "%s", piousness(TRUE, "aligned"));
2730 Sprintf(buf, "%s", piousness(TRUE, "
\90M
\8bÂ
\90S"));
2731 if (u.ualign.record >= 0)
2738 Sprintf(buf, " %d", u.ualign.record);
2739 enl_msg("Your alignment ", "is", "was", buf, "");
2741 Sprintf(buf, "
\82 \82È
\82½
\82Ì
\91®
\90«
\92l
\82Í%d", u.ualign.record);
2742 enl_msg(buf, "
\82Å
\82 \82é", "
\82¾
\82Á
\82½", "", "");
2746 /*** Resistances to troubles ***/
2749 you_are("invulnerable", from_what(INVULNERABLE));
2751 you_are("
\95s
\8e\80\90g", from_what(INVULNERABLE));
2754 you_are("magic-protected", from_what(ANTIMAGIC));
2756 you_have("
\96\82\96@
\96h
\8cä
\94\
\97Í", from_what(ANTIMAGIC));
2757 if (Fire_resistance)
2759 you_are("fire resistant", from_what(FIRE_RES));
2761 you_have("
\89Î
\82Ö
\82Ì
\91Ï
\90«", from_what(FIRE_RES));
2762 if (Cold_resistance)
2764 you_are("cold resistant", from_what(COLD_RES));
2766 you_have("
\8a¦
\82³
\82Ö
\82Ì
\91Ï
\90«", from_what(COLD_RES));
2767 if (Sleep_resistance)
2769 you_are("sleep resistant", from_what(SLEEP_RES));
2771 you_have("
\96°
\82è
\82Ö
\82Ì
\91Ï
\90«", from_what(SLEEP_RES));
2772 if (Disint_resistance)
2774 you_are("disintegration-resistant", from_what(DISINT_RES));
2776 you_have("
\95²
\8dÓ
\82Ö
\82Ì
\91Ï
\90«", from_what(DISINT_RES));
2777 if (Shock_resistance)
2779 you_are("shock resistant", from_what(SHOCK_RES));
2781 you_have("
\93d
\8c\82\82Ö
\82Ì
\91Ï
\90«", from_what(SHOCK_RES));
2782 if (Poison_resistance)
2784 you_are("poison resistant", from_what(POISON_RES));
2786 you_have("
\93Å
\82Ö
\82Ì
\91Ï
\90«", from_what(POISON_RES));
2787 if (Acid_resistance)
2789 you_are("acid resistant", from_what(ACID_RES));
2791 you_have("
\8e_
\82Ö
\82Ì
\91Ï
\90«", from_what(ACID_RES));
2792 if (Drain_resistance)
2794 you_are("level-drain resistant", from_what(DRAIN_RES));
2796 you_have("
\83\8c\83x
\83\8b\83_
\83E
\83\93\82Ö
\82Ì
\91Ï
\90«", from_what(DRAIN_RES));
2797 if (Sick_resistance)
2799 you_are("immune to sickness", from_what(SICK_RES));
2801 you_have("
\95a
\8bC
\82É
\91Î
\82·
\82é
\96Æ
\89u", from_what(SICK_RES));
2802 if (Stone_resistance)
2804 you_are("petrification resistant", from_what(STONE_RES));
2806 you_have("
\90Î
\89»
\82Ö
\82Ì
\91Ï
\90«", from_what(STONE_RES));
2807 if (Halluc_resistance)
2809 enl_msg(You_, "resist", "resisted", " hallucinations",
2810 from_what(HALLUC_RES));
2812 you_have("
\8c¶
\8ao
\82Ö
\82Ì
\91Ï
\90«", from_what(HALLUC_RES));
2816 you_can("recognize detrimental food", "");
2818 you_can("
\97L
\8aQ
\82È
\90H
\97¿
\82ð
\8e¯
\95Ê", "");
2820 /*** Vision and senses ***/
2821 if (!Blind && (Blinded || !haseyes(youmonst.data)))
2822 you_can("see", from_what(-BLINDED)); /* Eyes of the Overworld */
2823 if (See_invisible) {
2826 enl_msg(You_, "see", "saw", " invisible", from_what(SEE_INVIS));
2828 enl_msg("
\82 \82È
\82½
\82Í
\93§
\96¾
\82È
\82à
\82Ì
\82ð
\8c©
\82ç
\82ê", "
\82é", "
\82½", "", from_what(SEE_INVIS));
2831 enl_msg(You_, "will see", "would have seen",
2832 " invisible when not blind", from_what(SEE_INVIS));
2834 enl_msg(You_, "
\82é", "
\82½",
2835 "
\96Ó
\96Ú
\82Å
\82È
\82¢
\82Æ
\82«
\82É
\82Í
\93§
\96¾
\82È
\82à
\82Ì
\82ð
\8c©
\82ç
\82ê", from_what(SEE_INVIS));
2840 you_are("telepathic", from_what(TELEPAT));
2842 you_have("
\83e
\83\8c\83p
\83V
\81[", from_what(TELEPAT));
2845 you_are("warned", from_what(WARNING));
2847 you_have("
\8cx
\89ú
\94\
\97Í", from_what(WARNING));
2848 if (Warn_of_mon && context.warntype.obj) {
2850 Sprintf(buf, "aware of the presence of %s",
2851 (context.warntype.obj & M2_ORC) ? "orcs"
2852 : (context.warntype.obj & M2_ELF) ? "elves"
2853 : (context.warntype.obj & M2_DEMON) ? "demons" : something);
2854 you_are(buf, from_what(WARN_OF_MON));
2856 Sprintf(buf, "%s
\82Ì
\91¶
\8dÝ
\82ð
\8a´
\82¶
\82é
\94\
\97Í",
2857 (context.warntype.obj & M2_ORC) ? "
\83I
\81[
\83N"
2858 : (context.warntype.obj & M2_ELF) ? "
\83G
\83\8b\83t"
2859 : (context.warntype.obj & M2_DEMON) ? "
\88«
\96\82" : something);
2863 if (Warn_of_mon && context.warntype.polyd) {
2865 Sprintf(buf, "aware of the presence of %s",
2866 ((context.warntype.polyd & (M2_HUMAN | M2_ELF))
2867 == (M2_HUMAN | M2_ELF))
2868 ? "humans and elves"
2869 : (context.warntype.polyd & M2_HUMAN)
2871 : (context.warntype.polyd & M2_ELF)
2873 : (context.warntype.polyd & M2_ORC)
2875 : (context.warntype.polyd & M2_DEMON)
2877 : "certain monsters");
2880 Sprintf(buf, "%s
\82Ì
\91¶
\8dÝ
\82ð
\8a´
\82¶
\82é
\94\
\97Í",
2881 ((context.warntype.polyd & (M2_HUMAN | M2_ELF))
2882 == (M2_HUMAN | M2_ELF))
2883 ? "
\90l
\8aÔ
\82Æ
\83G
\83\8b\83t"
2884 : (context.warntype.polyd & M2_HUMAN)
2886 : (context.warntype.polyd & M2_ELF)
2888 : (context.warntype.polyd & M2_ORC)
2890 : (context.warntype.polyd & M2_DEMON)
2892 : "
\82 \82é
\8eí
\82Ì
\89ö
\95¨");
2896 if (Warn_of_mon && context.warntype.speciesidx >= LOW_PM) {
2898 Sprintf(buf, "aware of the presence of %s",
2899 makeplural(mons[context.warntype.speciesidx].mname));
2900 you_are(buf, from_what(WARN_OF_MON));
2902 Sprintf(buf, "%s
\82Ì
\91¶
\8dÝ
\82ð
\8a´
\82¶
\82é
\94\
\97Í",
2903 mons[context.warntype.speciesidx].mname);
2904 you_have(buf, from_what(WARN_OF_MON));
2909 you_are("warned of undead", from_what(WARN_UNDEAD));
2911 you_have("
\95s
\8e\80\82Ì
\90¶
\95¨
\82Ö
\82Ì
\8cx
\89ú
\94\
\97Í", from_what(WARN_UNDEAD));
2914 you_have("automatic searching", from_what(SEARCHING));
2916 you_have("
\92T
\8d¸
\94\
\97Í", from_what(SEARCHING));
2919 you_are("clairvoyant", from_what(CLAIRVOYANT));
2921 you_have("
\90ç
\97¢
\8aá
\94\
\97Í", from_what(CLAIRVOYANT));
2922 else if ((HClairvoyant || EClairvoyant) && BClairvoyant) {
2923 Strcpy(buf, from_what(-CLAIRVOYANT));
2925 if (!strncmp(buf, " because of ", 12))
2926 /* overwrite substring; strncpy doesn't add terminator */
2927 (void) strncpy(buf, " if not for ", 12);
2928 enl_msg(You_, "could be", "could have been", " clairvoyant", buf);
2930 /*JP:
\81u
\81c
\82É
\82æ
\82Á
\82Ä
\81v*/
2931 if (!strncmp(buf, "
\82É
\82æ
\82Á
\82Ä", 8))
2932 /*JP:
\81u
\81c
\82ª
\82È
\82¯
\82ê
\82Î
\81v
\82É
\8f\91\82«
\8a·
\82¦
\82é*/
2933 strcpy(eos(buf) - 8, "
\82ª
\82È
\82¯
\82ê
\82Î");
2934 you_have("
\90ç
\97¢
\8aá
\94\
\97Í", buf);
2939 you_have("infravision", from_what(INFRAVISION));
2941 you_have("
\90Ô
\8aO
\90ü
\82ª
\8c©
\82¦
\82é
\8e\8b\8ao", from_what(INFRAVISION));
2942 if (Detect_monsters)
2944 you_are("sensing the presence of monsters", "");
2946 you_have("
\89ö
\95¨
\82ð
\92T
\82·
\94\
\97Í", "");
2949 you_are("going to confuse monsters", "");
2951 you_have("
\89ö
\95¨
\82ð
\8d¬
\97\90\82³
\82¹
\82é
\94\
\97Í", "");
2953 /*** Appearance and behavior ***/
2957 if (uleft && uleft->otyp == RIN_ADORNMENT)
2958 adorn += uleft->spe;
2959 if (uright && uright->otyp == RIN_ADORNMENT)
2960 adorn += uright->spe;
2961 /* the sum might be 0 (+0 ring or two which negate each other);
2962 that yields "you are charismatic" (which isn't pointless
2963 because it potentially impacts seduction attacks) */
2965 Sprintf(buf, "%scharismatic",
2966 (adorn > 0) ? "more " : (adorn < 0) ? "less " : "");
2967 you_are(buf, from_what(ADORNED));
2969 Sprintf(buf, "
\96£
\97Í%s
\82Ä",
2970 (adorn > 0) ? "
\82ª
\91\9d\89Á
\82µ" : (adorn < 0) ? "
\82ª
\8c¸
\8f
\82µ" : "
\93I
\82É
\82È
\82Á");
2971 enl_msg(You_, "
\82Ä
\82¢
\82é", "
\82½", buf, "");
2976 you_are("invisible", from_what(INVIS));
2978 you_are("
\93§
\96¾", from_what(INVIS));
2981 you_are("invisible to others", from_what(INVIS));
2983 you_are("
\91¼
\90l
\82É
\91Î
\82µ
\82Ä
\93§
\96¾", from_what(INVIS));
2984 /* ordinarily "visible" is redundant; this is a special case for
2985 the situation when invisibility would be an expected attribute */
2986 else if ((HInvis || EInvis) && BInvis)
2988 you_are("visible", from_what(-INVIS));
2990 you_are("
\95s
\93§
\96¾", from_what(-INVIS));
2993 you_are("displaced", from_what(DISPLACED));
2995 you_have("
\8c¶
\89e
\94\
\97Í", from_what(DISPLACED));
2998 you_are("stealthy", from_what(STEALTH));
3000 you_have("
\90l
\96Ú
\82ð
\93\90\82Þ
\94\
\97Í", from_what(STEALTH));
3001 if (Aggravate_monster)
3003 enl_msg("You aggravate", "", "d", " monsters",
3004 from_what(AGGRAVATE_MONSTER));
3006 you_are_ing("
\94½
\8a´
\82ð
\82©
\82Á
\82Ä", from_what(AGGRAVATE_MONSTER));
3010 enl_msg("You cause", "", "d", " conflict", from_what(CONFLICT));
3012 you_are_ing("
\93¬
\91\88\82ð
\88ø
\82«
\8bN
\82±
\82µ
\82Ä", from_what(CONFLICT));
3014 /*** Transportation ***/
3017 you_can("jump", from_what(JUMPING));
3019 you_can("
\92µ
\96ô
\82·
\82é
\82±
\82Æ
\82ª", from_what(JUMPING));
3022 you_can("teleport", from_what(TELEPORT));
3024 you_can("
\8fu
\8aÔ
\88Ú
\93®
\82ª", from_what(TELEPORT));
3025 if (Teleport_control)
3027 you_have("teleport control", from_what(TELEPORT_CONTROL));
3029 you_have("
\8fu
\8aÔ
\88Ú
\93®
\82Ì
\90§
\8cä
\94\
\97Í", from_what(TELEPORT_CONTROL));
3030 /* actively levitating handled earlier as a status condition */
3031 if (BLevitation) { /* levitation is blocked */
3032 long save_BLev = BLevitation;
3037 enl_msg(You_, "would levitate", "would have levitated",
3038 if_surroundings_permitted, "");
3040 you_are("
\95\82\97V
\8fó
\91Ô", "");
3042 BLevitation = save_BLev;
3044 /* actively flying handled earlier as a status condition */
3045 if (BFlying) { /* flight is blocked */
3046 long save_BFly = BFlying;
3051 enl_msg(You_, "would fly", "would have flown",
3053 ? "if you weren't levitating"
3054 : (save_BFly == FROMOUTSIDE)
3055 ? if_surroundings_permitted
3056 /* both surroundings and [latent] levitation */
3057 : " if circumstances permitted",
3060 you_can("
\94ò
\82Ô
\82±
\82Æ
\82ª", "");
3062 BFlying = save_BFly;
3064 /* actively walking on water handled earlier as a status condition */
3065 if (Wwalking && !walking_on_water())
3067 you_can("walk on water", from_what(WWALKING));
3069 you_can("
\90\85\82Ì
\8fã
\82ð
\95à
\82
\82±
\82Æ
\82ª", from_what(WWALKING));
3070 /* actively swimming (in water but not under it) handled earlier */
3071 if (Swimming && (Underwater || !u.uinwater))
3073 you_can("swim", from_what(SWIMMING));
3075 you_can("
\89j
\82®
\82±
\82Æ
\82ª", from_what(SWIMMING));
3078 you_can("survive without air", from_what(MAGICAL_BREATHING));
3080 you_can("
\8bó
\8bC
\82È
\82µ
\82Å
\90¶
\82«
\89\84\82Ñ
\82é
\82±
\82Æ
\82ª", from_what(MAGICAL_BREATHING));
3081 else if (Amphibious)
3083 you_can("breathe water", from_what(MAGICAL_BREATHING));
3085 you_can("
\90\85\92\86\82Å
\8cÄ
\8bz
\82ª", from_what(MAGICAL_BREATHING));
3088 you_can("walk through walls", from_what(PASSES_WALLS));
3090 you_can("
\95Ç
\82ð
\92Ê
\82è
\94²
\82¯
\82é
\82±
\82Æ
\82ª", from_what(PASSES_WALLS));
3092 /*** Physical attributes ***/
3095 enl_msg("You regenerate", "", "d", "", from_what(REGENERATION));
3097 you_have("
\8dÄ
\90¶
\94\
\97Í", from_what(REGENERATION));
3100 you_have("slower digestion", from_what(SLOW_DIGESTION));
3102 enl_msg("
\90H
\95¨
\82Ì
\8fÁ
\89»
\82ª
\92x", "
\82¢", "
\82©
\82Á
\82½", "", from_what(SLOW_DIGESTION));
3105 you_have(enlght_combatinc("to hit", u.uhitinc, final, buf), "");
3107 you_have(enlght_combatinc("
\96½
\92\86\97¦", u.uhitinc, final, buf), "");
3110 you_have(enlght_combatinc("damage", u.udaminc, final, buf), "");
3112 you_have(enlght_combatinc("
\83_
\83\81\81[
\83W", u.udaminc, final, buf), "");
3113 if (u.uspellprot || Protection) {
3116 if (uleft && uleft->otyp == RIN_PROTECTION)
3118 if (uright && uright->otyp == RIN_PROTECTION)
3119 prot += uright->spe;
3120 if (HProtection & INTRINSIC)
3122 prot += u.uspellprot;
3125 you_have(enlght_combatinc("defense", prot, final, buf), "");
3127 you_have(enlght_combatinc("
\96h
\8cä", prot, final, buf), "");
3129 if ((armpro = magic_negation(&youmonst)) > 0) {
3130 /* magic cancellation factor, conferred by worn armor */
3131 static const char *const mc_types[] = {
3133 "" /*ordinary*/, "warded", "guarded", "protected",
3135 "" /*ordinary*/, "
\89q
\82ç
\82ê
\82Ä", "
\8cì
\82ç
\82ê
\82Ä", "
\8eç
\82ç
\82ê
\82Ä",
3139 if (armpro >= SIZE(mc_types))
3140 armpro = SIZE(mc_types) - 1;
3142 you_are(mc_types[armpro], "");
3144 you_are_ing(mc_types[armpro], "");
3146 if (Half_physical_damage)
3147 enlght_halfdmg(HALF_PHDAM, final);
3148 if (Half_spell_damage)
3149 enlght_halfdmg(HALF_SPDAM, final);
3150 /* polymorph and other shape change */
3151 if (Protection_from_shape_changers)
3153 you_are("protected from shape changers",
3154 from_what(PROT_FROM_SHAPE_CHANGERS));
3156 you_have("
\95Ï
\89»
\89ö
\95¨
\82Ö
\82Ì
\91Ï
\90«", from_what(PROT_FROM_SHAPE_CHANGERS));
3159 const char *what = 0;
3161 if (!Upolyd) /* Upolyd handled below after current form */
3163 you_can("not change from your current form",
3165 you_are("
\8c»
\8dÝ
\82Ì
\8ep
\82©
\82ç
\95Ï
\89»
\82Å
\82«
\82È
\82¢
\8fó
\91Ô",
3166 from_what(UNCHANGING));
3167 /* blocked shape changes */
3170 what = !final ? "polymorph" : "have polymorphed";
3172 what = "
\95Ï
\89»
\82µ
\82Ä";
3173 else if (u.ulycn >= LOW_PM)
3175 what = !final ? "change shape" : "have changed shape";
3177 what = "
\8ep
\82ð
\95Ï
\82¦
\82Ä";
3180 Sprintf(buf, "would %s periodically", what);
3181 /* omit from_what(UNCHANGING); too verbose */
3182 enl_msg(You_, buf, buf, " if not locked into your current form",
3185 Sprintf(buf, "
\82à
\82µ
\8c»
\8dÝ
\82Ì
\8ep
\82É
\8cÅ
\92è
\82³
\82ê
\82Ä
\82¢
\82È
\82¯
\82ê
\82Î
\92è
\8aú
\93I
\82É%s", what);
3186 you_are_ing(buf, "");
3189 } else if (Polymorph) {
3191 you_are("polymorphing periodically", from_what(POLYMORPH));
3193 you_are("
\92è
\8aú
\93I
\82É
\95Ï
\89»
\82µ
\82Ä", from_what(POLYMORPH));
3195 if (Polymorph_control)
3197 you_have("polymorph control", from_what(POLYMORPH_CONTROL));
3199 you_have("
\95Ï
\89»
\82Ì
\90§
\8cä
\94\
\97Í", from_what(POLYMORPH_CONTROL));
3200 if (Upolyd && u.umonnum != u.ulycn) {
3201 /* foreign shape (except were-form which is handled below) */
3203 Sprintf(buf, "polymorphed into %s", an(youmonst.data->mname));
3205 Sprintf(buf, "%s
\82É
\95Ï
\89»
\82µ
\82Ä", youmonst.data->mname);
3207 Sprintf(eos(buf), " (%d)", u.mtimedone);
3210 if (lays_eggs(youmonst.data) && flags.female) /* Upolyd */
3212 you_can("lay eggs", "");
3214 you_can("
\97\91\82ð
\8eY
\82Þ
\82±
\82Æ
\82ª", "");
3215 if (u.ulycn >= LOW_PM) {
3217 /* "you are a werecreature [in beast form]" */
3218 Strcpy(buf, an(mons[u.ulycn].mname));
3219 if (u.umonnum == u.ulycn) {
3220 Strcat(buf, " in beast form");
3222 Sprintf(eos(buf), " (%d)", u.mtimedone);
3225 /*JP:
\81u
\82 \82È
\82½
\82Í[
\8fb
\82Ì
\8ep
\82Ì]
\81\9b\81\9b\90l
\8aÔ
\82Å
\82 \82é
\81v*/
3227 if (u.umonnum == u.ulycn) {
3228 Strcpy(buf, "
\8fb
\82Ì
\8ep
\82Ì");
3230 Sprintf(eos(buf), " (%d)", u.mtimedone);
3232 Strcat(buf, mons[u.ulycn].mname);
3236 if (Unchanging && Upolyd) /* !Upolyd handled above */
3238 you_can("not change from your current form", from_what(UNCHANGING));
3240 enl_msg("
\8d¡
\82Ì
\8ep
\82©
\82ç
\95Ï
\89»
\82·
\82é
\82±
\82Æ
\82ª
\82Å
\82«
\82È", "
\82¢", "
\82©
\82Á
\82½", "", from_what(UNCHANGING));
3243 you_are("harmed by silver", "");
3245 enl_msg("
\82 \82È
\82½
\82Í
\8bâ
\82É
\8eã", "
\82¢", "
\82©
\82Á
\82½", "", "");
3246 /* movement and non-armor-based protection */
3249 you_are(Very_fast ? "very fast" : "fast", from_what(FAST));
3251 you_have(Very_fast ? "
\82Æ
\82Ä
\82à
\91f
\91\81\82
\8ds
\93®
\82·
\82é
\94\
\97Í" : "
\91f
\91\81\82
\8ds
\93®
\82·
\82é
\94\
\97Í", from_what(FAST));
3254 you_have("reflection", from_what(REFLECTING));
3256 you_have("
\94½
\8eË
\94\
\97Í", from_what(REFLECTING));
3259 you_have("free action", from_what(FREE_ACTION));
3261 you_have("
\8dS
\91©
\82³
\82ê
\82È
\82¢
\94\
\97Í", from_what(FREE_ACTION));
3264 you_have("fixed abilities", from_what(FIXED_ABIL));
3266 enl_msg("
\94\
\97Í
\82ª
\95Ï
\89»
\82µ
\82È", "
\82¢", "
\82©
\82Á
\82½", "", from_what(FIXED_ABIL));
3269 enl_msg("Your life ", "will be", "would have been", " saved", "");
3271 enl_msg("
\82 \82È
\82½
\82Ì
\90¶
\96½
\82Í
\95Û
\91¶
\82³
\82ê
\82Ä", iru, ita, "", "");
3273 /*** Miscellany ***/
3275 ltmp = abs((int) Luck);
3277 Sprintf(buf, "%s%slucky",
3278 ltmp >= 10 ? "extremely " : ltmp >= 5 ? "very " : "",
3279 Luck < 0 ? "un" : "");
3281 Sprintf(buf, "%s%s",
3282 ltmp >= 10 ? "
\96Ò
\97ó
\82É" : ltmp >= 5 ? "
\82Æ
\82Ä
\82à" : "",
3283 Luck < 0 ? "
\95s
\8dK" : "
\8dK
\95\9f");
3286 Sprintf(eos(buf), " (%d)", Luck);
3290 enl_msg("Your luck ", "is", "was", " zero", "");
3292 enl_msg("
\82 \82È
\82½
\82Ì
\89^
\82Í
\83[
\83\8d", "
\82Å
\82 \82é", "
\82¾
\82Á
\82½", "", "");
3295 you_have("extra luck", "");
3297 you_have("
\82³
\82ç
\82È
\82é
\8dK
\89^", "");
3298 else if (u.moreluck < 0)
3300 you_have("reduced luck", "");
3302 you_have("
\82³
\82ç
\82È
\82é
\95s
\89^", "");
3303 if (carrying(LUCKSTONE) || stone_luck(TRUE)) {
3304 ltmp = stone_luck(0);
3307 enl_msg("Bad luck ", "does", "did", " not time out for you", "");
3309 enl_msg("
\95s
\89^
\82Í
\8e\9e\8aÔ
\90Ø
\82ê
\82É
\82È
\82ç
\82È", "
\82¢", "
\82©
\82Á
\82½", "", "");
3312 enl_msg("Good luck ", "does", "did", " not time out for you", "");
3314 enl_msg("
\8dK
\89^
\82Í
\8e\9e\8aÔ
\90Ø
\82ê
\82É
\82È
\82ç
\82È", "
\82¢", "
\82©
\82Á
\82½", "", "");
3319 Sprintf(buf, " %sangry with you",
3320 u.ugangr > 6 ? "extremely " : u.ugangr > 3 ? "very " : "");
3322 Sprintf(buf, "%s
\82Í%s
\93{
\82Á
\82Ä%s", u_gname(),
3323 u.ugangr > 6 ? "
\96Ò
\97ó
\82É" : u.ugangr > 3 ? "
\82Æ
\82Ä
\82à" : "", final ? ita : iru);
3326 Sprintf(eos(buf), " (%d)", u.ugangr);
3328 enl_msg(u_gname(), " is", " was", buf, "");
3330 enl_msg(buf, "", "", "", "");
3334 * We need to suppress this when the game is over, because death
3335 * can change the value calculated by can_pray(), potentially
3336 * resulting in a false claim that you could have prayed safely.
3341 /* "can [not] safely pray" vs "could [not] have safely prayed" */
3342 Sprintf(buf, "%s%ssafely pray%s", can_pray(FALSE) ? "" : "not ",
3343 final ? "have " : "", final ? "ed" : "");
3345 Sprintf(buf, "%ssafely pray", can_pray(FALSE) ? "" : "not ");
3348 Sprintf(eos(buf), " (%d)", u.ublesscnt);
3351 Sprintf(buf, "
\82 \82È
\82½
\82Í
\88À
\91S
\82É
\8bF
\82é
\82±
\82Æ
\82ª");
3352 Strcat(buf, can_pray(FALSE) ? can : "
\82Å
\82«
\82È
\82¢");
3354 Sprintf(eos(buf), " (%d)", u.ublesscnt);
3355 enl_msg(buf, "", "", "", "");
3361 /* named fruit debugging (doesn't really belong here...); to enable,
3362 include 'fruit' in DEBUGFILES list (even though it isn't a file...) */
3363 if (wizard && explicitdebug("fruit")) {
3366 reorder_fruit(TRUE); /* sort by fruit index, from low to high;
3367 * this modifies the ffruit chain, so could
3368 * possibly mask or even introduce a problem,
3369 * but it does useful sanity checking */
3370 for (f = ffruit; f; f = f->nextf) {
3372 Sprintf(buf, "Fruit #%d ", f->fid);
3374 Sprintf(buf, "fruit $%d
\82Í", f->fid);
3376 enl_msg(buf, "is ", "was ", f->fname, "");
3378 enl_msg(buf, "
\82¾", "
\82¾
\82Á
\82½", f->fname, "");
3381 enl_msg("The current fruit ", "is ", "was ", pl_fruit, "");
3383 enl_msg("
\8c»
\8dÝ
\82Ì fruit
\82Í", "
\82¾", "
\82¾
\82Á
\82½", pl_fruit, "");
3384 Sprintf(buf, "%d", flags.made_fruit);
3386 enl_msg("The made fruit flag ", "is ", "was ", buf, "");
3388 enl_msg("made fruit flag
\82Í", "
\82¾", "
\82¾
\82Á
\82½", buf, "");
3396 if (final < 2) { /* still in progress, or quit/escaped/ascended */
3398 p = "survived after being killed ";
3400 p = "
\8e\80\82ñ
\82¾
\8cã
\95\9c\8a\88\82µ
\82Ä
\82¢
\82½";
3401 switch (u.umortality) {
3404 p = !final ? (char *) 0 : "survived";
3406 p = !final ? (char *)0 : "
\90¶
\82«
\89\84\82Ñ
\82½";
3410 Strcpy(buf, "once");
3412 Strcpy(buf, "
\88ê
\93x");
3416 Strcpy(buf, "twice");
3418 Strcpy(buf, "
\93ñ
\93x");
3422 Strcpy(buf, "thrice");
3424 Strcpy(buf, "
\8eO
\93x");
3428 Sprintf(buf, "%d times", u.umortality);
3430 Sprintf(buf, "%d
\89ñ", u.umortality);
3433 } else { /* game ended in character's death */
3437 p = "
\8e\80\82ñ
\82Å
\82¢
\82é";
3438 switch (u.umortality) {
3440 impossible("dead without dying?");
3442 break; /* just "are dead" */
3445 Sprintf(buf, " (%d%s time!)", u.umortality,
3446 ordin(u.umortality));
3448 Sprintf(buf, "(%d
\89ñ
\81I)", u.umortality);
3455 enl_msg(You_, "have been killed ", p, buf, "");
3457 enl_msg(You_, "
\8e\80\82ñ
\82Å
\82¢
\82é", p, buf, "");
3461 #if 0 /* no longer used */
3462 STATIC_DCL boolean NDECL(minimal_enlightenment);
3465 * Courtesy function for non-debug, non-explorer mode players
3466 * to help refresh them about who/what they are.
3467 * Returns FALSE if menu cancelled (dismissed with ESC), TRUE otherwise.
3470 minimal_enlightenment()
3473 menu_item *selected;
3476 char buf[BUFSZ], buf2[BUFSZ];
3477 static const char untabbed_fmtstr[] = "%-15s: %-12s";
3478 static const char untabbed_deity_fmtstr[] = "%-17s%s";
3479 static const char tabbed_fmtstr[] = "%s:\t%-12s";
3480 static const char tabbed_deity_fmtstr[] = "%s\t%s";
3481 static const char *fmtstr;
3482 static const char *deity_fmtstr;
3484 fmtstr = iflags.menu_tab_sep ? tabbed_fmtstr : untabbed_fmtstr;
3485 deity_fmtstr = iflags.menu_tab_sep ? tabbed_deity_fmtstr
3486 : untabbed_deity_fmtstr;
3488 buf[0] = buf2[0] = '\0';
3489 tmpwin = create_nhwindow(NHW_MENU);
3491 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
3497 /* Starting name, race, role, gender */
3499 Sprintf(buf, fmtstr, "name", plname);
3501 Sprintf(buf, fmtstr, "
\96¼
\91O", plname);
3502 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3504 Sprintf(buf, fmtstr, "race", urace.noun);
3506 Sprintf(buf, fmtstr, "
\8eí
\91°", urace.noun);
3507 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3509 Sprintf(buf, fmtstr, "role",
3511 Sprintf(buf, fmtstr, "
\90E
\8bÆ",
3512 (flags.initgend && urole.name.f) ? urole.name.f : urole.name.m);
3513 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3515 Sprintf(buf, fmtstr, "gender", genders[flags.initgend].adj);
3517 Sprintf(buf, fmtstr, "
\90«
\95Ê", genders[flags.initgend].adj);
3518 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3520 /* Starting alignment */
3522 Sprintf(buf, fmtstr, "alignment", align_str(u.ualignbase[A_ORIGINAL]));
3524 Sprintf(buf, fmtstr, "
\91®
\90«", align_str(u.ualignbase[A_ORIGINAL]));
3525 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3527 /* Current name, race, role, gender */
3528 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", FALSE);
3529 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
3535 Sprintf(buf, fmtstr, "race", Upolyd ? youmonst.data->mname : urace.noun);
3537 Sprintf(buf, fmtstr, "
\8eí
\91°", Upolyd ? youmonst.data->mname : urace.noun);
3538 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3541 Sprintf(buf, fmtstr, "role (base)",
3543 Sprintf(buf, fmtstr, "
\90E
\8bÆ(
\8aî
\96{)",
3544 (u.mfemale && urole.name.f) ? urole.name.f
3546 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3549 Sprintf(buf, fmtstr, "role",
3551 Sprintf(buf, fmtstr, "
\90E
\8bÆ",
3552 (flags.female && urole.name.f) ? urole.name.f
3554 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3556 /* don't want poly_gender() here; it forces `2' for non-humanoids */
3557 genidx = is_neuter(youmonst.data) ? 2 : flags.female;
3559 Sprintf(buf, fmtstr, "gender", genders[genidx].adj);
3561 Sprintf(buf, fmtstr, "
\90«
\95Ê", genders[genidx].adj);
3562 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3563 if (Upolyd && (int) u.mfemale != genidx) {
3565 Sprintf(buf, fmtstr, "gender (base)", genders[u.mfemale].adj);
3567 Sprintf(buf, fmtstr, "
\90«
\95Ê(
\8aî
\96{)", genders[u.mfemale].adj);
3568 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3571 /* Current alignment */
3573 Sprintf(buf, fmtstr, "alignment", align_str(u.ualign.type));
3575 Sprintf(buf, fmtstr, "
\91®
\90«", align_str(u.ualign.type));
3576 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3579 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", FALSE);
3580 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
3586 Sprintf(buf2, deity_fmtstr, align_gname(A_CHAOTIC),
3587 (u.ualignbase[A_ORIGINAL] == u.ualign.type
3588 && u.ualign.type == A_CHAOTIC) ? " (s,c)"
3589 : (u.ualignbase[A_ORIGINAL] == A_CHAOTIC) ? " (s)"
3590 : (u.ualign.type == A_CHAOTIC) ? " (c)" : "");
3592 Sprintf(buf2, deity_fmtstr, align_gname(A_CHAOTIC),
3593 (u.ualignbase[A_ORIGINAL] == u.ualign.type
3594 && u.ualign.type == A_CHAOTIC) ? " (
\8f\89\81C
\8c»)"
3595 : (u.ualignbase[A_ORIGINAL] == A_CHAOTIC) ? " (
\8f\89)"
3596 : (u.ualign.type == A_CHAOTIC) ? " (
\8c»)" : "");
3599 Sprintf(buf, fmtstr, "Chaotic", buf2);
3601 Sprintf(buf, fmtstr, "
\8d¬
\93×", buf2);
3602 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3605 Sprintf(buf2, deity_fmtstr, align_gname(A_NEUTRAL),
3606 (u.ualignbase[A_ORIGINAL] == u.ualign.type
3607 && u.ualign.type == A_NEUTRAL) ? " (s,c)"
3608 : (u.ualignbase[A_ORIGINAL] == A_NEUTRAL) ? " (s)"
3609 : (u.ualign.type == A_NEUTRAL) ? " (c)" : "");
3611 Sprintf(buf2, deity_fmtstr, align_gname(A_NEUTRAL),
3612 (u.ualignbase[A_ORIGINAL] == u.ualign.type
3613 && u.ualign.type == A_NEUTRAL) ? " (
\8f\89\81C
\8c»)"
3614 : (u.ualignbase[A_ORIGINAL] == A_NEUTRAL) ? " (
\8f\89)"
3615 : (u.ualign.type == A_NEUTRAL) ? " (
\8c»)" : "");
3618 Sprintf(buf, fmtstr, "Neutral", buf2);
3620 Sprintf(buf, fmtstr, "
\92\86\97§", buf2);
3621 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3624 Sprintf(buf2, deity_fmtstr, align_gname(A_LAWFUL),
3625 (u.ualignbase[A_ORIGINAL] == u.ualign.type
3626 && u.ualign.type == A_LAWFUL) ? " (s,c)"
3627 : (u.ualignbase[A_ORIGINAL] == A_LAWFUL) ? " (s)"
3628 : (u.ualign.type == A_LAWFUL) ? " (c)" : "");
3630 Sprintf(buf2, deity_fmtstr, align_gname(A_LAWFUL),
3631 (u.ualignbase[A_ORIGINAL] == u.ualign.type
3632 && u.ualign.type == A_LAWFUL) ? " (
\8f\89\81C
\8c»)"
3633 : (u.ualignbase[A_ORIGINAL] == A_LAWFUL) ? " (
\8f\89)"
3634 : (u.ualign.type == A_LAWFUL) ? " (
\8c»)" : "");
3637 Sprintf(buf, fmtstr, "Lawful", buf2);
3639 Sprintf(buf, fmtstr, "
\92\81\8f\98", buf2);
3640 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3643 end_menu(tmpwin, "Base Attributes");
3645 end_menu(tmpwin, "
\8aî
\96{
\91®
\90«");
3646 n = select_menu(tmpwin, PICK_NONE, &selected);
3647 destroy_nhwindow(tmpwin);
3648 return (boolean) (n != -1);
3654 doattributes(VOID_ARGS)
3656 int mode = BASICENLIGHTENMENT;
3658 /* show more--as if final disclosure--for wizard and explore modes */
3659 if (wizard || discover)
3660 mode |= MAGICENLIGHTENMENT;
3662 enlightenment(mode, ENL_GAMEINPROGRESS);
3667 youhiding(via_enlghtmt, msgflag)
3668 boolean via_enlghtmt; /* englightment line vs topl message */
3669 int msgflag; /* for variant message phrasing */
3671 char *bp, buf[BUFSZ];
3674 Strcpy(buf, "hiding");
3676 Strcpy(buf, "
\89B
\82ê");
3677 if (youmonst.m_ap_type != M_AP_NOTHING) {
3678 /* mimic; hero is only able to mimic a strange object or gold
3679 or hallucinatory alternative to gold, so we skip the details
3680 for the hypothetical furniture and monster cases */
3681 #if 0 /*JP*//*
\8cã
\82ë
\82É
\89ñ
\82·*//* not used */
3682 bp = eos(strcpy(buf, "mimicking"));
3684 if (youmonst.m_ap_type == M_AP_OBJECT) {
3686 Sprintf(bp, " %s", an(simple_typename(youmonst.mappearance)));
3688 Strcpy(buf, simple_typename(youmonst.mappearance));
3689 } else if (youmonst.m_ap_type == M_AP_FURNITURE) {
3691 Strcpy(bp, " something");
3693 Strcpy(buf, "
\89½
\82©");
3694 } else if (youmonst.m_ap_type == M_AP_MONSTER) {
3696 Strcpy(bp, " someone");
3698 Strcpy(buf, "
\89½
\8eÒ
\82©");
3700 ; /* something unexpected; leave 'buf' as-is */
3702 #if 1 /*JP*//*
\82±
\82±
\82Å
\92Ç
\89Á*/
3703 Strcat(buf, "
\82Ì
\82Ó
\82è
\82ð
\82µ");
3705 } else if (u.uundetected) {
3706 bp = eos(buf); /* points past "hiding" */
3707 if (youmonst.data->mlet == S_EEL) {
3708 if (is_pool(u.ux, u.uy))
3710 Sprintf(bp, " in the %s", waterbody_name(u.ux, u.uy));
3712 Sprintf(bp, "%s
\82Ì
\92\86\82É", waterbody_name(u.ux, u.uy));
3713 } else if (hides_under(youmonst.data)) {
3714 struct obj *o = level.objects[u.ux][u.uy];
3718 Sprintf(bp, " underneath %s", ansimpleoname(o));
3720 Sprintf(bp, "%s
\82Ì
\89º
\82É", ansimpleoname(o));
3721 } else if (is_clinger(youmonst.data) || Flying) {
3722 /* Flying: 'lurker above' hides on ceiling but doesn't cling */
3724 Sprintf(bp, " on the %s", ceiling(u.ux, u.uy));
3726 Sprintf(bp, "%s
\82É", ceiling(u.ux, u.uy));
3728 /* on floor; is_hider() but otherwise not special: 'trapper' */
3729 if (u.utrap && u.utraptype == TT_PIT) {
3730 struct trap *t = t_at(u.ux, u.uy);
3733 Sprintf(bp, " in a %spit",
3734 (t && t->ttyp == SPIKED_PIT) ? "spiked " : "");
3736 Sprintf(bp, "%s
\97\8e\82µ
\8c\8a\82Ì
\92\86\82É",
3737 (t && t->ttyp == SPIKED_PIT) ? "
\83g
\83Q
\82¾
\82ç
\82¯
\82Ì" : "");
3741 Sprintf(bp, " on the %s", surface(u.ux, u.uy));
3743 Sprintf(bp, "%s
\82É", surface(u.ux, u.uy));
3745 #if 1 /*JP*//*
\82±
\82±
\82Å
\92Ç
\89Á*/
3746 Strcat(buf, "
\89B
\82ê");
3749 ; /* shouldn't happen; will result in generic "you are hiding" */
3753 int final = msgflag; /* 'final' is used by you_are() macro */
3757 /* for dohide(), when player uses '#monster' command */
3759 You("are %s %s.", msgflag ? "already" : "now", buf);
3762 You("
\82·
\82Å
\82É%s
\82Ä
\82¢
\82é
\81D", buf);
3764 You("%s
\82½
\81D", buf);
3771 * (shares enlightenment's tense handling)
3774 doconduct(VOID_ARGS)
3787 /* Create the conduct window */
3788 en_win = create_nhwindow(NHW_MENU);
3790 putstr(en_win, 0, "Voluntary challenges:");
3792 putstr(en_win, 0, "
\8e©
\94
\93I
\92§
\90í:");
3794 if (u.uroleplay.blind)
3796 you_have_been("blind from birth");
3798 you_have_been("
\90¶
\82Ü
\82ê
\82È
\82ª
\82ç
\82É
\96Ó
\96Ú");
3799 if (u.uroleplay.nudist)
3801 you_have_been("faithfully nudist");
3803 you_have_been("
\92\89\8eÀ
\82È
\97\87\91°");
3805 if (!u.uconduct.food)
3807 enl_msg(You_, "have gone", "went", " without food", "");
3809 enl_msg("
\82 \82È
\82½
\82Í
\90H
\8e\96\82ð
\82µ", "
\82Ä
\82¢
\82È
\82¢", "
\82È
\82©
\82Á
\82½", "", "");
3810 /* but beverages are okay */
3811 else if (!u.uconduct.unvegan)
3813 you_have_X("followed a strict vegan diet");
3815 you_have_been("
\8cµ
\8ai
\82È
\8dØ
\90H
\8eå
\8b`
\8eÒ");
3816 else if (!u.uconduct.unvegetarian)
3818 you_have_been("vegetarian");
3820 you_have_been("
\8dØ
\90H
\8eå
\8b`
\8eÒ");
3822 if (!u.uconduct.gnostic)
3824 you_have_been("an atheist");
3826 you_have_been("
\96³
\90_
\98_
\8eÒ");
3828 if (!u.uconduct.weaphit) {
3830 you_have_never("hit with a wielded weapon");
3832 you_have_never("
\82 \82È
\82½
\82Í
\91\95\94õ
\82µ
\82Ä
\82¢
\82é
\95\90\8aí
\82Å
\8dU
\8c\82\82µ");
3833 } else if (wizard) {
3835 Sprintf(buf, "used a wielded weapon %ld time%s", u.uconduct.weaphit,
3836 plur(u.uconduct.weaphit));
3839 Sprintf(buf, "
\82 \82È
\82½
\82Í%ld
\89ñ
\91\95\94õ
\82µ
\82½
\95\90\8aí
\82ð
\8eg
\97p
\82µ", u.uconduct.weaphit);
3843 if (!u.uconduct.killer)
3845 you_have_been("a pacifist");
3847 you_have_been("
\95½
\98a
\8eå
\8b`
\8eÒ");
3849 if (!u.uconduct.literate) {
3851 you_have_been("illiterate");
3853 you_have_never("
\82 \82È
\82½
\82Í
\93Ç
\82Ý
\8f\91\82«
\82µ");
3854 } else if (wizard) {
3856 Sprintf(buf, "read items or engraved %ld time%s", u.uconduct.literate,
3857 plur(u.uconduct.literate));
3860 Sprintf(buf, "%ld
\89ñ
\93Ç
\82ñ
\82¾
\82è
\8f\91\82¢
\82½
\82è
\82µ", u.uconduct.literate);
3865 ngenocided = num_genocides();
3866 if (ngenocided == 0) {
3868 you_have_never("genocided any monsters");
3870 you_have_never("
\82 \82È
\82½
\82Í
\89ö
\95¨
\82ð
\8bs
\8eE
\82µ");
3873 Sprintf(buf, "genocided %d type%s of monster%s", ngenocided,
3874 plur(ngenocided), plur(ngenocided));
3877 Sprintf(buf, "%d
\8eí
\82Ì
\89ö
\95¨
\82ð
\8bs
\8eE
\82µ", ngenocided);
3882 if (!u.uconduct.polypiles) {
3884 you_have_never("polymorphed an object");
3886 you_have_never("
\82 \82È
\82½
\82Í
\95¨
\91Ì
\82ð
\95Ï
\89»
\82³
\82¹");
3887 } else if (wizard) {
3889 Sprintf(buf, "polymorphed %ld item%s", u.uconduct.polypiles,
3890 plur(u.uconduct.polypiles));
3893 Sprintf(buf, "%ld
\8cÂ
\82Ì
\95¨
\82ð
\95Ï
\89»
\82³
\82¹", u.uconduct.polypiles);
3898 if (!u.uconduct.polyselfs) {
3900 you_have_never("changed form");
3902 you_have_never("
\82 \82È
\82½
\82Í
\95Ï
\89»
\82µ");
3903 } else if (wizard) {
3905 Sprintf(buf, "changed form %ld time%s", u.uconduct.polyselfs,
3906 plur(u.uconduct.polyselfs));
3909 Sprintf(buf, "%ld
\89ñ
\8ep
\82ð
\95Ï
\82¦", u.uconduct.polyselfs);
3914 if (!u.uconduct.wishes) {
3916 you_have_X("used no wishes");
3918 you_have_never("
\82 \82È
\82½
\82Í
\8aè
\82¢
\8e\96\82ð
\82µ");
3921 Sprintf(buf, "used %ld wish%s", u.uconduct.wishes,
3922 (u.uconduct.wishes > 1L) ? "es" : "");
3924 Sprintf(buf, "%ld
\89ñ
\8aè
\82¢
\8e\96\82ð
\82µ", u.uconduct.wishes);
3926 if (u.uconduct.wisharti) {
3927 /* if wisharti == wishes
3928 * 1 wish (for an artifact)
3929 * 2 wishes (both for artifacts)
3930 * N wishes (all for artifacts)
3931 * else (N is at least 2 in order to get here; M < N)
3932 * N wishes (1 for an artifact)
3933 * N wishes (M for artifacts)
3935 if (u.uconduct.wisharti == u.uconduct.wishes)
3936 Sprintf(eos(buf), " (%s",
3937 (u.uconduct.wisharti > 2L) ? "all "
3938 : (u.uconduct.wisharti == 2L) ? "both " : "");
3940 Sprintf(eos(buf), " (%ld ", u.uconduct.wisharti);
3942 Sprintf(eos(buf), "for %s)",
3943 (u.uconduct.wisharti == 1L) ? "an artifact"
3948 if (!u.uconduct.wisharti)
3950 enl_msg(You_, "have not wished", "did not wish",
3951 " for any artifacts", "");
3953 enl_msg("
\82 \82È
\82½
\82Í
\90¹
\8aí
\82ð
\8aè", "
\82Á
\82Ä
\82¢
\82È
\82¢", "
\82í
\82È
\82©
\82Á
\82½", "", "");
3957 /* Pop up the window and wait for a key */
3958 display_nhwindow(en_win, TRUE);
3959 destroy_nhwindow(en_win);
3963 /* Macros for meta and ctrl modifiers:
3964 * M and C return the meta/ctrl code for the given character;
3965 * e.g., (C('c') is ctrl-c
3969 #define M(c) (0x80 | (c))
3971 #define M(c) ((c) - 128)
3976 #define C(c) (0x1f & (c))
3979 /* ordered by command name */
3980 struct ext_func_tab extcmdlist[] = {
3981 { '#', "#", "perform an extended command",
3982 doextcmd, IFBURIED | GENERALCMD },
3984 { M('?'), "?", "list all extended commands",
3986 { M('?'), "?", "
\82±
\82Ì
\8ag
\92£
\83R
\83}
\83\93\83h
\88ê
\97\97\82ð
\95\
\8e¦
\82·
\82é",
3988 doextlist, IFBURIED | AUTOCOMPLETE | GENERALCMD },
3990 { M('a'), "adjust", "adjust inventory letters",
3992 { M('a'), "adjust", "
\8e\9d\82¿
\95¨
\88ê
\97\97\82Ì
\92²
\90®",
3994 doorganize, IFBURIED | AUTOCOMPLETE },
3996 { M('A'), "annotate", "name current level",
3998 { M('A'), "annotate", "
\8c»
\8dÝ
\82Ì
\8aK
\82É
\96¼
\91O
\82ð
\82Â
\82¯
\82é",
4000 donamelevel, IFBURIED | AUTOCOMPLETE },
4001 { 'a', "apply", "apply (use) a tool (pick-axe, key, lamp...)",
4003 { C('x'), "attributes", "show your attributes",
4004 doattributes, IFBURIED },
4005 { '@', "autopickup", "toggle the pickup option on/off",
4006 dotogglepickup, IFBURIED },
4007 { 'C', "call", "call (name) something", docallcmd, IFBURIED },
4008 { 'Z', "cast", "zap (cast) a spell", docast, IFBURIED },
4010 { M('c'), "chat", "talk to someone", dotalk, IFBURIED | AUTOCOMPLETE },
4012 { M('c'), "chat", "
\92N
\82©
\82Æ
\98b
\82·", dotalk, IFBURIED | AUTOCOMPLETE },
4014 { 'c', "close", "close a door", doclose },
4016 { M('C'), "conduct", "list voluntary challenges you have maintained",
4018 { M('C'), "conduct", "
\82Ç
\82¤
\82¢
\82¤
\8ds
\93®
\82ð
\82Æ
\82Á
\82½
\82©
\8c©
\82é",
4020 doconduct, IFBURIED | AUTOCOMPLETE },
4022 { M('d'), "dip", "dip an object into something", dodip, AUTOCOMPLETE },
4024 { M('d'), "dip", "
\89½
\82©
\82É
\95¨
\82ð
\90Z
\82·", dodip, AUTOCOMPLETE },
4026 { '>', "down", "go down a staircase", dodown },
4027 { 'd', "drop", "drop an item", dodrop },
4028 { 'D', "droptype", "drop specific item types", doddrop },
4029 { 'e', "eat", "eat something", doeat },
4030 { 'E', "engrave", "engrave writing on the floor", doengrave },
4032 { M('e'), "enhance", "advance or check weapon and spell skills",
4034 { M('e'), "enhance", "
\95\90\8aí
\8fn
\97û
\93x
\82ð
\8d\82\82ß
\82é",
4036 enhance_weapon_skill, IFBURIED | AUTOCOMPLETE },
4038 { '\0', "exploremode", "enter explore (discovery) mode",
4040 { '\0', "exploremode", "
\92T
\8c\9f(
\94
\8c©)
\83\82\81[
\83h
\82É
\93ü
\82é",
4042 enter_explore_mode, IFBURIED },
4043 { 'f', "fire", "fire ammunition from quiver", dofire },
4045 { M('f'), "force", "force a lock", doforce, AUTOCOMPLETE },
4047 { M('f'), "force", "
\8c®
\82ð
\82±
\82¶
\82 \82¯
\82é", doforce, AUTOCOMPLETE },
4049 { ';', "glance", "show what type of thing a map symbol corresponds to",
4050 doquickwhatis, IFBURIED | GENERALCMD },
4051 { '?', "help", "give a help message", dohelp, IFBURIED | GENERALCMD },
4052 { '\0', "herecmdmenu", "show menu of commands you can do here",
4053 doherecmdmenu, IFBURIED },
4054 { 'V', "history", "show long version and game history",
4055 dohistory, IFBURIED | GENERALCMD },
4056 { 'i', "inventory", "show your inventory", ddoinv, IFBURIED },
4057 { 'I', "inventtype", "inventory specific item types",
4058 dotypeinv, IFBURIED },
4060 { M('i'), "invoke", "invoke an object's special powers",
4062 { M('i'), "invoke", "
\95¨
\82Ì
\93Á
\95Ê
\82È
\97Í
\82ð
\8eg
\82¤",
4064 doinvoke, IFBURIED | AUTOCOMPLETE },
4066 { M('j'), "jump", "jump to another location", dojump, AUTOCOMPLETE },
4068 { M('j'), "jump", "
\91¼
\82Ì
\88Ê
\92u
\82É
\94ò
\82Ñ
\82¤
\82Â
\82é", dojump, AUTOCOMPLETE },
4070 { C('d'), "kick", "kick something", dokick },
4071 { '\\', "known", "show what object types have been discovered",
4072 dodiscovered, IFBURIED | GENERALCMD },
4073 { '`', "knownclass", "show discovered types for one class of objects",
4074 doclassdisco, IFBURIED | GENERALCMD },
4076 { '\0', "levelchange", "change experience level",
4078 { '\0', "levelchange", "
\8co
\8c±
\83\8c\83x
\83\8b\82ð
\95Ï
\82¦
\82é",
4080 wiz_level_change, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4082 { '\0', "lightsources", "show mobile light sources",
4084 { '\0', "lightsources", "
\88Ú
\93®
\8cõ
\8c¹
\82ð
\8c©
\82é",
4086 wiz_light_sources, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4087 { ':', "look", "look at what is here", dolook, IFBURIED },
4089 { M('l'), "loot", "loot a box on the floor", doloot, AUTOCOMPLETE },
4091 { M('l'), "loot", "
\8f°
\82Ì
\8fã
\82Ì
\94 \82ð
\8aJ
\82¯
\82é", doloot, AUTOCOMPLETE },
4093 #ifdef DEBUG_MIGRATING_MONS
4095 { '\0', "migratemons", "migrate N random monsters",
4097 { '\0', "migratemons", "
\83\89\83\93\83_
\83\80\82È
\89ö
\95¨
\82ð
\89½
\91Ì
\82©
\88Ú
\8fZ
\82³
\82¹
\82é",
4099 wiz_migrate_mons, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4102 { '\0', "monpolycontrol", "control monster polymorphs",
4104 { '\0', "monpolycontrol", "
\89ö
\95¨
\82Ö
\82Ì
\95Ï
\89»
\82ð
\90§
\8cä
\82·
\82é",
4106 wiz_mon_polycontrol, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4108 { M('m'), "monster", "use monster's special ability",
4110 { M('m'), "monster", "
\89ö
\95¨
\82Ì
\93Á
\95Ê
\94\
\97Í
\82ð
\8eg
\82¤",
4112 domonability, IFBURIED | AUTOCOMPLETE },
4114 { 'N', "name", "name a monster or an object",
4116 { 'N', "name", "
\83A
\83C
\83e
\83\80\82â
\95¨
\82É
\96¼
\91O
\82ð
\82Â
\82¯
\82é",
4118 docallcmd, IFBURIED | AUTOCOMPLETE },
4120 { M('o'), "offer", "offer a sacrifice to the gods",
4122 { M('o'), "offer", "
\90_
\82É
\8b\9f\95¨
\82ð
\95ù
\82°
\82é",
4124 dosacrifice, AUTOCOMPLETE },
4125 { 'o', "open", "open a door", doopen },
4126 { 'O', "options", "show option settings, possibly change them",
4127 doset, IFBURIED | GENERALCMD },
4129 { C('o'), "overview", "show a summary of the explored dungeon",
4131 { C('o'), "overview", "
\92T
\8dõ
\82µ
\82½
\96À
\8b{
\82Ì
\8aT
\97v
\82ð
\95\
\8e¦
\82·
\82é",
4133 dooverview, IFBURIED | AUTOCOMPLETE },
4135 { '\0', "panic", "test panic routine (fatal to game)",
4137 { '\0', "panic", "
\83p
\83j
\83b
\83N
\83\8b\81[
\83`
\83\93\82ð
\83e
\83X
\83g
\82·
\82é(
\92v
\96½
\93I)",
4139 wiz_panic, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4140 { 'p', "pay", "pay your shopping bill", dopay },
4141 { ',', "pickup", "pick up things at the current location", dopickup },
4143 { '\0', "polyself", "polymorph self",
4145 { '\0', "polyself", "
\95Ï
\89»
\82·
\82é",
4147 wiz_polyself, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4150 { '\0', "portdebug", "wizard port debug command",
4152 { '\0', "portdebug", "
\83E
\83B
\83U
\81[
\83h
\83|
\81[
\83g
\83f
\83o
\83b
\83O
\83R
\83}
\83\93\83h",
4154 wiz_port_debug, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4157 { M('p'), "pray", "pray to the gods for help",
4159 { M('p'), "pray", "
\90_
\82É
\8bF
\82é",
4161 dopray, IFBURIED | AUTOCOMPLETE },
4162 { C('p'), "prevmsg", "view recent game messages",
4163 doprev_message, IFBURIED | GENERALCMD },
4164 { 'P', "puton", "put on an accessory (ring, amulet, etc)", doputon },
4165 { 'q', "quaff", "quaff (drink) something", dodrink },
4167 { M('q'), "quit", "exit without saving current game",
4169 { M('q'), "quit", "
\83Z
\81[
\83u
\82µ
\82È
\82¢
\82Å
\8fI
\97¹",
4171 done2, IFBURIED | AUTOCOMPLETE | GENERALCMD },
4172 { 'Q', "quiver", "select ammunition for quiver", dowieldquiver },
4173 { 'r', "read", "read a scroll or spellbook", doread },
4174 { C('r'), "redraw", "redraw screen", doredraw, IFBURIED | GENERALCMD },
4175 { 'R', "remove", "remove an accessory (ring, amulet, etc)", doremring },
4177 { M('R'), "ride", "mount or dismount a saddled steed",
4179 { M('R'), "ride", "
\89ö
\95¨
\82É
\8fæ
\82é(
\82Ü
\82½
\82Í
\8d~
\82è
\82é)",
4181 doride, AUTOCOMPLETE },
4183 { M('r'), "rub", "rub a lamp or a stone", dorub, AUTOCOMPLETE },
4185 { M('r'), "rub", "
\83\89\83\93\83v
\82ð
\82±
\82·
\82é", dorub, AUTOCOMPLETE },
4187 { 'S', "save", "save the game and exit", dosave, IFBURIED | GENERALCMD },
4189 { 's', "search", "search for traps and secret doors",
4190 dosearch, IFBURIED, "searching" },
4192 { 's', "search", "ã©
\82â
\89B
\82µ
\94à
\82ð
\92T
\82·",
4193 dosearch, IFBURIED, "
\92T
\82·" },
4195 { '*', "seeall", "show all equipment in use", doprinuse, IFBURIED },
4196 { AMULET_SYM, "seeamulet", "show the amulet currently worn",
4197 dopramulet, IFBURIED },
4198 { ARMOR_SYM, "seearmor", "show the armor currently worn",
4199 doprarm, IFBURIED },
4200 { GOLD_SYM, "seegold", "count your gold", doprgold, IFBURIED },
4202 { '\0', "seenv", "show seen vectors",
4204 { '\0', "seenv", "
\8e\8b\90ü
\83x
\83N
\83g
\83\8b\82ð
\8c©
\82é",
4206 wiz_show_seenv, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4207 { RING_SYM, "seerings", "show the ring(s) currently worn",
4208 doprring, IFBURIED },
4209 { SPBOOK_SYM, "seespells", "list and reorder known spells",
4210 dovspell, IFBURIED },
4211 { TOOL_SYM, "seetools", "show the tools currently in use",
4212 doprtool, IFBURIED },
4213 { '^', "seetrap", "show the type of adjacent trap", doidtrap, IFBURIED },
4214 { WEAPON_SYM, "seeweapon", "show the weapon currently wielded",
4215 doprwep, IFBURIED },
4217 { '!', "shell", "do a shell escape", dosh, IFBURIED | GENERALCMD },
4220 { M('s'), "sit", "sit down", dosit, AUTOCOMPLETE },
4221 { '\0', "stats", "show memory statistics",
4223 { M('s'), "sit", "
\8dÀ
\82é", dosit, AUTOCOMPLETE },
4224 { '\0', "stats", "
\83\81\83\82\83\8a\8fó
\91Ô
\82ð
\8c©
\82é",
4226 wiz_show_stats, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4228 { C('z'), "suspend", "suspend the game",
4229 dosuspend_core, IFBURIED | GENERALCMD },
4230 #endif /* SUSPEND */
4231 { 'x', "swap", "swap wielded and secondary weapons", doswapweapon },
4232 { 'T', "takeoff", "take off one piece of armor", dotakeoff },
4233 { 'A', "takeoffall", "remove all armor", doddoremarm },
4234 { C('t'), "teleport", "teleport around the level", dotele, IFBURIED },
4236 { '\0', "terrain", "show map without obstructions",
4238 { '\0', "terrain", "
\8e×
\96\82\82³
\82ê
\82¸
\82É
\92n
\90}
\82ð
\8c©
\82é",
4240 doterrain, IFBURIED | AUTOCOMPLETE },
4241 { '\0', "therecmdmenu",
4242 "menu of commands you can do from here to adjacent spot",
4244 { 't', "throw", "throw something", dothrow },
4246 { '\0', "timeout", "look at timeout queue and hero's timed intrinsics",
4248 { '\0', "timeout", "
\8e\9e\8aÔ
\90Ø
\82ê
\83L
\83\85\81[
\82Æ
\83v
\83\8c\83C
\83\84\81[
\82Ì
\8e\9e\8aÔ
\8co
\89ß
\82ð
\8c©
\82é",
4250 wiz_timeout_queue, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4252 { M('T'), "tip", "empty a container", dotip, AUTOCOMPLETE },
4254 { M('T'), "tip", "
\93ü
\82ê
\95¨
\82ð
\8bó
\82É
\82·
\82é", dotip, AUTOCOMPLETE },
4256 { '_', "travel", "travel to a specific location on the map", dotravel },
4258 { M('t'), "turn", "turn undead away", doturn, IFBURIED | AUTOCOMPLETE },
4260 { M('t'), "turn", "
\83A
\83\93\83f
\83b
\83g
\82ð
\93y
\82É
\95Ô
\82·", doturn, IFBURIED | AUTOCOMPLETE },
4263 { 'X', "twoweapon", "toggle two-weapon combat",
4265 { 'X', "twoweapon", "
\97¼
\8eè
\8e\9d\82¿
\82Ì
\90Ø
\82è
\91Ö
\82¦",
4267 dotwoweapon, AUTOCOMPLETE },
4269 { M('u'), "untrap", "untrap something", dountrap, AUTOCOMPLETE },
4271 { M('u'), "untrap", "ã©
\82ð
\82Í
\82¸
\82·", dountrap, AUTOCOMPLETE },
4273 { '<', "up", "go up a staircase", doup },
4275 { '\0', "vanquished", "list vanquished monsters",
4277 { '\0', "vanquished", "
\93|
\82µ
\82½
\89ö
\95¨
\82Ì
\88ê
\97\97\82ð
\8c©
\82é",
4279 dovanquished, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4280 { M('v'), "version",
4282 "list compile time options for this version of NetHack",
4284 "
\83R
\83\93\83p
\83C
\83\8b\8e\9e\82Ì
\83I
\83v
\83V
\83\87\83\93\82ð
\95\
\8e¦
\82·
\82é",
4286 doextversion, IFBURIED | AUTOCOMPLETE | GENERALCMD },
4287 { 'v', "versionshort", "show version", doversion, IFBURIED | GENERALCMD },
4289 { '\0', "vision", "show vision array",
4291 { '\0', "vision", "
\8e\8b\8aE
\94z
\97ñ
\82ð
\8c©
\82é",
4293 wiz_show_vision, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4295 { '.', "wait", "rest one move while doing nothing",
4296 donull, IFBURIED, "waiting" },
4298 { '.', "wait", "
\88ê
\95à
\95ª
\89½
\82à
\82µ
\82È
\82¢",
4299 donull, IFBURIED, "
\8bx
\8ce
\82·
\82é" },
4301 { 'W', "wear", "wear a piece of armor", dowear },
4302 { '&', "whatdoes", "tell what a command does", dowhatdoes, IFBURIED },
4303 { '/', "whatis", "show what type of thing a symbol corresponds to",
4304 dowhatis, IFBURIED | GENERALCMD },
4305 { 'w', "wield", "wield (put in use) a weapon", dowield },
4307 { M('w'), "wipe", "wipe off your face", dowipe, AUTOCOMPLETE },
4309 { M('w'), "wipe", "
\8aç
\82ð
\90@
\82¤", dowipe, AUTOCOMPLETE },
4313 { '\0', "wizdebug_bury", "wizard debug: bury objs under and around you",
4315 { '\0', "wizdebug_bury", "
\83E
\83B
\83U
\81[
\83h
\82Å
\83o
\83b
\83O:
\95¨
\82ð
\82 \82È
\82½
\82Ì
\8eü
\82è
\82É
\96\84\82ß
\82é",
4317 wiz_debug_cmd_bury, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4319 { '\0', "wizdebug_traveldisplay", "wizard debug: toggle travel display",
4321 { '\0', "wizdebug_traveldisplay", "
\83E
\83B
\83U
\81[
\83h
\83f
\83o
\83b
\83O:
\88Ú
\93®
\95\
\8e¦
\82ð
\90Ø
\82è
\91Ö
\82¦
\82é",
4323 wiz_debug_cmd_traveldisplay, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4325 { C('e'), "wizdetect", "reveal hidden things within a small radius",
4326 wiz_detect, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4327 { C('g'), "wizgenesis", "create a monster",
4328 wiz_genesis, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4329 { C('i'), "wizidentify", "identify all items in inventory",
4330 wiz_identify, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4331 { '\0', "wizintrinsic", "set an intrinsic",
4332 wiz_intrinsic, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4333 { C('v'), "wizlevelport", "teleport to another level",
4334 wiz_level_tele, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4335 { '\0', "wizmakemap", "recreate the current level",
4336 wiz_makemap, IFBURIED | WIZMODECMD },
4337 { C('f'), "wizmap", "map the level",
4338 wiz_map, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4340 { '\0', "wizrumorcheck", "verify rumor boundaries",
4342 { '\0', "wizrumorcheck", "
\89\
\82Ì
\8b«
\8aE
\82ð
\8c\9f\8fØ
\82·
\82é",
4344 wiz_rumor_check, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4346 { '\0', "wizsmell", "smell monster",
4348 { '\0', "wizsmell", "
\89ö
\95¨
\82Ì
\93õ
\82¢
\82ð
\9ak
\82®",
4350 wiz_smell, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4351 { '\0', "wizwhere", "show locations of special levels",
4352 wiz_where, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4353 { C('w'), "wizwish", "wish for something",
4354 wiz_wish, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4356 { '\0', "wmode", "show wall modes",
4358 { '\0', "wmode", "
\95Ç
\83\82\81[
\83h
\82ð
\8c©
\82é",
4360 wiz_show_wmodes, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4361 { 'z', "zap", "zap a wand", dozap },
4362 { '\0', (char *) 0, (char *) 0, donull, 0, (char *) 0 } /* sentinel */
4369 if (Cmd.commands[key] && Cmd.commands[key]->ef_txt)
4370 return Cmd.commands[key]->ef_desc;
4375 bind_key(key, command)
4377 const char *command;
4379 struct ext_func_tab *extcmd;
4381 /* special case: "nothing" is reserved for unbinding */
4382 if (!strcmp(command, "nothing")) {
4383 Cmd.commands[key] = (struct ext_func_tab *) 0;
4387 for (extcmd = extcmdlist; extcmd->ef_txt; extcmd++) {
4388 if (strcmp(command, extcmd->ef_txt))
4390 Cmd.commands[key] = extcmd;
4397 /* initialize all keyboard commands */
4401 struct ext_func_tab *extcmd;
4403 for (extcmd = extcmdlist; extcmd->ef_txt; extcmd++)
4405 Cmd.commands[extcmd->key] = extcmd;
4407 (void) bind_key(C('l'), "redraw"); /* if number_pad is set */
4408 /* 'b', 'B' : go sw */
4409 /* 'F' : fight (one time) */
4410 /* 'g', 'G' : multiple go */
4411 /* 'h', 'H' : go west */
4412 (void) bind_key('h', "help"); /* if number_pad is set */
4413 (void) bind_key('j', "jump"); /* if number_pad is on */
4414 /* 'j', 'J', 'k', 'K', 'l', 'L', 'm', 'M', 'n', 'N' move commands */
4415 (void) bind_key('k', "kick"); /* if number_pad is on */
4416 (void) bind_key('l', "loot"); /* if number_pad is on */
4417 (void) bind_key(C('n'), "annotate"); /* if number_pad is on */
4418 (void) bind_key(M('n'), "name");
4419 (void) bind_key(M('N'), "name");
4420 (void) bind_key('u', "untrap"); /* if number_pad is on */
4423 (void) bind_key(M('O'), "overview");
4424 (void) bind_key(M('2'), "twoweapon");
4427 (void) bind_key(' ', "wait");
4431 dokeylist_putcmds(datawin, docount, cmdflags, exflags, keys_used)
4434 int cmdflags, exflags;
4435 boolean *keys_used; /* boolean keys_used[256] */
4442 for (i = 0; i < 256; i++) {
4443 const struct ext_func_tab *extcmd;
4444 uchar key = (uchar) i;
4448 if (key == ' ' && !flags.rest_on_space)
4450 if ((extcmd = Cmd.commands[i]) != (struct ext_func_tab *) 0) {
4451 if ((cmdflags && !(extcmd->flags & cmdflags))
4452 || (exflags && (extcmd->flags & exflags)))
4458 Sprintf(buf, "%-8s %-12s %s", key2txt(key, buf2),
4461 putstr(datawin, 0, buf);
4462 keys_used[i] = TRUE;
4468 /* list all keys and their bindings, like dat/hh but dynamic */
4470 dokeylist(VOID_ARGS)
4472 char buf[BUFSZ], buf2[BUFSZ];
4474 boolean keys_used[256] = {0};
4478 run_desc[] = "Prefix: run until something very interesting is seen",
4480 "Prefix: force fight even if you don't see a monster";
4481 static const struct {
4486 { NHKF_ESC, "escape from the current query/action", FALSE },
4488 "Prefix: rush until something interesting is seen", FALSE },
4489 { NHKF_RUN, run_desc, FALSE },
4490 { NHKF_RUN2, run_desc, TRUE },
4491 { NHKF_FIGHT, forcefight_desc, FALSE },
4492 { NHKF_FIGHT2, forcefight_desc, TRUE } ,
4494 "Prefix: move without picking up objects/fighting", FALSE },
4495 { NHKF_RUN_NOPICKUP,
4496 "Prefix: run without picking up objects/fighting", FALSE },
4497 { NHKF_DOINV, "view inventory", TRUE },
4498 { NHKF_REQMENU, "Prefix: request a menu", FALSE },
4500 { NHKF_DOAGAIN , "re-do: perform the previous command again", FALSE },
4502 { 0, (const char *) 0, FALSE }
4505 datawin = create_nhwindow(NHW_TEXT);
4506 putstr(datawin, 0, "");
4507 putstr(datawin, 0, " Full Current Key Bindings List");
4509 /* directional keys */
4510 putstr(datawin, 0, "");
4511 putstr(datawin, 0, "Directional keys:");
4512 show_direction_keys(datawin, '.', FALSE); /* '.'==self in direction grid */
4514 keys_used[(uchar) Cmd.move_NW] = keys_used[(uchar) Cmd.move_N]
4515 = keys_used[(uchar) Cmd.move_NE] = keys_used[(uchar) Cmd.move_W]
4516 = keys_used[(uchar) Cmd.move_E] = keys_used[(uchar) Cmd.move_SW]
4517 = keys_used[(uchar) Cmd.move_S] = keys_used[(uchar) Cmd.move_SE]
4520 if (!iflags.num_pad) {
4521 keys_used[(uchar) highc(Cmd.move_NW)]
4522 = keys_used[(uchar) highc(Cmd.move_N)]
4523 = keys_used[(uchar) highc(Cmd.move_NE)]
4524 = keys_used[(uchar) highc(Cmd.move_W)]
4525 = keys_used[(uchar) highc(Cmd.move_E)]
4526 = keys_used[(uchar) highc(Cmd.move_SW)]
4527 = keys_used[(uchar) highc(Cmd.move_S)]
4528 = keys_used[(uchar) highc(Cmd.move_SE)] = TRUE;
4529 keys_used[(uchar) C(Cmd.move_NW)]
4530 = keys_used[(uchar) C(Cmd.move_N)]
4531 = keys_used[(uchar) C(Cmd.move_NE)]
4532 = keys_used[(uchar) C(Cmd.move_W)]
4533 = keys_used[(uchar) C(Cmd.move_E)]
4534 = keys_used[(uchar) C(Cmd.move_SW)]
4535 = keys_used[(uchar) C(Cmd.move_S)]
4536 = keys_used[(uchar) C(Cmd.move_SE)] = TRUE;
4537 putstr(datawin, 0, "");
4539 "Shift-<direction> will move in specified direction until you hit");
4540 putstr(datawin, 0, " a wall or run into something.");
4542 "Ctrl-<direction> will run in specified direction until something");
4543 putstr(datawin, 0, " very interesting is seen.");
4546 putstr(datawin, 0, "");
4547 putstr(datawin, 0, "Miscellaneous keys:");
4548 for (i = 0; misc_keys[i].desc; i++) {
4549 key = Cmd.spkeys[misc_keys[i].nhkf];
4550 if (key && ((misc_keys[i].numpad && iflags.num_pad)
4551 || !misc_keys[i].numpad)) {
4552 keys_used[(uchar) key] = TRUE;
4553 Sprintf(buf, "%-8s %s", key2txt(key, buf2), misc_keys[i].desc);
4554 putstr(datawin, 0, buf);
4558 putstr(datawin, 0, "^c break out of NetHack (SIGINT)");
4559 keys_used[(uchar) C('c')] = TRUE;
4562 putstr(datawin, 0, "");
4563 show_menu_controls(datawin, TRUE);
4565 if (dokeylist_putcmds(datawin, TRUE, GENERALCMD, WIZMODECMD, keys_used)) {
4566 putstr(datawin, 0, "");
4567 putstr(datawin, 0, "General commands:");
4568 (void) dokeylist_putcmds(datawin, FALSE, GENERALCMD, WIZMODECMD,
4572 if (dokeylist_putcmds(datawin, TRUE, 0, WIZMODECMD, keys_used)) {
4573 putstr(datawin, 0, "");
4574 putstr(datawin, 0, "Game commands:");
4575 (void) dokeylist_putcmds(datawin, FALSE, 0, WIZMODECMD, keys_used);
4579 && dokeylist_putcmds(datawin, TRUE, WIZMODECMD, 0, keys_used)) {
4580 putstr(datawin, 0, "");
4581 putstr(datawin, 0, "Wizard-mode commands:");
4582 (void) dokeylist_putcmds(datawin, FALSE, WIZMODECMD, 0, keys_used);
4585 display_nhwindow(datawin, FALSE);
4586 destroy_nhwindow(datawin);
4595 for (i = 0; i < 256; ++i)
4596 if (Cmd.commands[i] && Cmd.commands[i]->ef_funct == fn)
4602 * wizard mode sanity_check code
4605 static const char template[] = "%-27s %4ld %6ld";
4606 static const char stats_hdr[] = " count bytes";
4607 static const char stats_sep[] = "--------------------------- ----- -------";
4613 int sz = (int) sizeof(struct obj);
4616 sz += (int) sizeof(struct oextra);
4618 sz += (int) strlen(ONAME(otmp)) + 1;
4620 sz += (int) sizeof(struct monst);
4622 sz += (int) sizeof(unsigned);
4624 sz += (int) sizeof(long);
4626 sz += (int) strlen(OMAILCMD(otmp)) + 1;
4632 count_obj(chain, total_count, total_size, top, recurse)
4642 for (count = size = 0, obj = chain; obj; obj = obj->nobj) {
4645 size += size_obj(obj);
4647 if (recurse && obj->cobj)
4648 count_obj(obj->cobj, total_count, total_size, TRUE, TRUE);
4650 *total_count += count;
4651 *total_size += size;
4655 obj_chain(win, src, chain, force, total_count, total_size)
4664 long count = 0L, size = 0L;
4666 count_obj(chain, &count, &size, TRUE, FALSE);
4668 if (count || size || force) {
4669 *total_count += count;
4670 *total_size += size;
4671 Sprintf(buf, template, src, count, size);
4672 putstr(win, 0, buf);
4677 mon_invent_chain(win, src, chain, total_count, total_size)
4680 struct monst *chain;
4685 long count = 0, size = 0;
4688 for (mon = chain; mon; mon = mon->nmon)
4689 count_obj(mon->minvent, &count, &size, TRUE, FALSE);
4691 if (count || size) {
4692 *total_count += count;
4693 *total_size += size;
4694 Sprintf(buf, template, src, count, size);
4695 putstr(win, 0, buf);
4700 contained_stats(win, src, total_count, total_size)
4707 long count = 0, size = 0;
4710 count_obj(invent, &count, &size, FALSE, TRUE);
4711 count_obj(fobj, &count, &size, FALSE, TRUE);
4712 count_obj(level.buriedobjlist, &count, &size, FALSE, TRUE);
4713 count_obj(migrating_objs, &count, &size, FALSE, TRUE);
4714 /* DEADMONSTER check not required in this loop since they have no
4716 for (mon = fmon; mon; mon = mon->nmon)
4717 count_obj(mon->minvent, &count, &size, FALSE, TRUE);
4718 for (mon = migrating_mons; mon; mon = mon->nmon)
4719 count_obj(mon->minvent, &count, &size, FALSE, TRUE);
4721 if (count || size) {
4722 *total_count += count;
4723 *total_size += size;
4724 Sprintf(buf, template, src, count, size);
4725 putstr(win, 0, buf);
4730 size_monst(mtmp, incl_wsegs)
4734 int sz = (int) sizeof (struct monst);
4736 if (mtmp->wormno && incl_wsegs)
4737 sz += size_wseg(mtmp);
4740 sz += (int) sizeof (struct mextra);
4742 sz += (int) strlen(MNAME(mtmp)) + 1;
4744 sz += (int) sizeof (struct egd);
4746 sz += (int) sizeof (struct epri);
4748 sz += (int) sizeof (struct eshk);
4750 sz += (int) sizeof (struct emin);
4752 sz += (int) sizeof (struct edog);
4753 /* mextra->mcorpsenm doesn't point to more memory */
4759 mon_chain(win, src, chain, force, total_count, total_size)
4762 struct monst *chain;
4770 /* mon->wormno means something different for migrating_mons and mydogs */
4771 boolean incl_wsegs = !strcmpi(src, "fmon");
4774 for (mon = chain; mon; mon = mon->nmon) {
4776 size += size_monst(mon, incl_wsegs);
4778 if (count || size || force) {
4779 *total_count += count;
4780 *total_size += size;
4781 Sprintf(buf, template, src, count, size);
4782 putstr(win, 0, buf);
4787 misc_stats(win, total_count, total_size)
4792 char buf[BUFSZ], hdrbuf[QBUFSZ];
4796 struct damage *sd; /* shop damage */
4797 struct cemetery *bi; /* bones info */
4799 /* traps and engravings are output unconditionally;
4800 * others only if nonzero
4803 for (tt = ftrap; tt; tt = tt->ntrap) {
4805 size += (long) sizeof *tt;
4807 *total_count += count;
4808 *total_size += size;
4809 Sprintf(hdrbuf, "traps, size %ld", (long) sizeof (struct trap));
4810 Sprintf(buf, template, hdrbuf, count, size);
4811 putstr(win, 0, buf);
4814 engr_stats("engravings, size %ld+text", hdrbuf, &count, &size);
4815 *total_count += count;
4816 *total_size += size;
4817 Sprintf(buf, template, hdrbuf, count, size);
4818 putstr(win, 0, buf);
4821 light_stats("light sources, size %ld", hdrbuf, &count, &size);
4822 if (count || size) {
4823 *total_count += count;
4824 *total_size += size;
4825 Sprintf(buf, template, hdrbuf, count, size);
4826 putstr(win, 0, buf);
4830 timer_stats("timers, size %ld", hdrbuf, &count, &size);
4831 if (count || size) {
4832 *total_count += count;
4833 *total_size += size;
4834 Sprintf(buf, template, hdrbuf, count, size);
4835 putstr(win, 0, buf);
4839 for (sd = level.damagelist; sd; sd = sd->next) {
4841 size += (long) sizeof *sd;
4843 if (count || size) {
4844 *total_count += count;
4845 *total_size += size;
4846 Sprintf(hdrbuf, "shop damage, size %ld",
4847 (long) sizeof (struct damage));
4848 Sprintf(buf, template, hdrbuf, count, size);
4849 putstr(win, 0, buf);
4853 region_stats("regions, size %ld+%ld*rect+N", hdrbuf, &count, &size);
4854 if (count || size) {
4855 *total_count += count;
4856 *total_size += size;
4857 Sprintf(buf, template, hdrbuf, count, size);
4858 putstr(win, 0, buf);
4862 for (bi = level.bonesinfo; bi; bi = bi->next) {
4864 size += (long) sizeof *bi;
4866 if (count || size) {
4867 *total_count += count;
4868 *total_size += size;
4869 Sprintf(hdrbuf, "bones history, size %ld",
4870 (long) sizeof (struct cemetery));
4871 Sprintf(buf, template, hdrbuf, count, size);
4872 putstr(win, 0, buf);
4876 for (idx = 0; idx < NUM_OBJECTS; ++idx)
4877 if (objects[idx].oc_uname) {
4879 size += (long) (strlen(objects[idx].oc_uname) + 1);
4881 if (count || size) {
4882 *total_count += count;
4883 *total_size += size;
4884 Strcpy(hdrbuf, "object type names, text");
4885 Sprintf(buf, template, hdrbuf, count, size);
4886 putstr(win, 0, buf);
4891 * Display memory usage of all monsters and objects on the level.
4898 long total_obj_size, total_obj_count,
4899 total_mon_size, total_mon_count,
4900 total_ovr_size, total_ovr_count,
4901 total_misc_size, total_misc_count;
4903 win = create_nhwindow(NHW_TEXT);
4904 putstr(win, 0, "Current memory statistics:");
4906 total_obj_count = total_obj_size = 0L;
4907 putstr(win, 0, stats_hdr);
4908 Sprintf(buf, " Objects, base size %ld", (long) sizeof (struct obj));
4909 putstr(win, 0, buf);
4910 obj_chain(win, "invent", invent, TRUE, &total_obj_count, &total_obj_size);
4911 obj_chain(win, "fobj", fobj, TRUE, &total_obj_count, &total_obj_size);
4912 obj_chain(win, "buried", level.buriedobjlist, FALSE,
4913 &total_obj_count, &total_obj_size);
4914 obj_chain(win, "migrating obj", migrating_objs, FALSE,
4915 &total_obj_count, &total_obj_size);
4916 obj_chain(win, "billobjs", billobjs, FALSE,
4917 &total_obj_count, &total_obj_size);
4918 mon_invent_chain(win, "minvent", fmon, &total_obj_count, &total_obj_size);
4919 mon_invent_chain(win, "migrating minvent", migrating_mons,
4920 &total_obj_count, &total_obj_size);
4921 contained_stats(win, "contained", &total_obj_count, &total_obj_size);
4922 putstr(win, 0, stats_sep);
4923 Sprintf(buf, template, " Obj total", total_obj_count, total_obj_size);
4924 putstr(win, 0, buf);
4926 total_mon_count = total_mon_size = 0L;
4928 Sprintf(buf, " Monsters, base size %ld", (long) sizeof (struct monst));
4929 putstr(win, 0, buf);
4930 mon_chain(win, "fmon", fmon, TRUE, &total_mon_count, &total_mon_size);
4931 mon_chain(win, "migrating", migrating_mons, FALSE,
4932 &total_mon_count, &total_mon_size);
4933 /* 'mydogs' is only valid during level change or end of game disclosure,
4934 but conceivably we've been called from within debugger at such time */
4935 if (mydogs) /* monsters accompanying hero */
4936 mon_chain(win, "mydogs", mydogs, FALSE,
4937 &total_mon_count, &total_mon_size);
4938 putstr(win, 0, stats_sep);
4939 Sprintf(buf, template, " Mon total", total_mon_count, total_mon_size);
4940 putstr(win, 0, buf);
4942 total_ovr_count = total_ovr_size = 0L;
4944 putstr(win, 0, " Overview");
4945 overview_stats(win, template, &total_ovr_count, &total_ovr_size);
4946 putstr(win, 0, stats_sep);
4947 Sprintf(buf, template, " Over total", total_ovr_count, total_ovr_size);
4948 putstr(win, 0, buf);
4950 total_misc_count = total_misc_size = 0L;
4952 putstr(win, 0, " Miscellaneous");
4953 misc_stats(win, &total_misc_count, &total_misc_size);
4954 putstr(win, 0, stats_sep);
4955 Sprintf(buf, template, " Misc total", total_misc_count, total_misc_size);
4956 putstr(win, 0, buf);
4959 putstr(win, 0, stats_sep);
4960 Sprintf(buf, template, " Grand total",
4961 (total_obj_count + total_mon_count
4962 + total_ovr_count + total_misc_count),
4963 (total_obj_size + total_mon_size
4964 + total_ovr_size + total_misc_size));
4965 putstr(win, 0, buf);
4967 #if defined(__BORLANDC__) && !defined(_WIN32)
4968 show_borlandc_stats(win);
4971 display_nhwindow(win, FALSE);
4972 destroy_nhwindow(win);
4980 timer_sanity_check();
4982 light_sources_sanity_check();
4985 #ifdef DEBUG_MIGRATING_MONS
4990 char inbuf[BUFSZ] = DUMMY;
4991 struct permonst *ptr;
4995 getlin("How many random monsters to migrate? [0]", inbuf);
4996 if (*inbuf == '\033')
4998 mcount = atoi(inbuf);
4999 if (mcount < 0 || mcount > (COLNO * ROWNO) || Is_botlevel(&u.uz))
5001 while (mcount > 0) {
5002 if (Is_stronghold(&u.uz))
5003 assign_level(&tolevel, &valley_level);
5005 get_level(&tolevel, depth(&u.uz) + 1);
5007 mtmp = makemon(ptr, 0, 0, NO_MM_FLAGS);
5009 migrate_to_level(mtmp, ledger_no(&tolevel), MIGR_RANDOM,
5017 #define unctrl(c) ((c) <= C('z') ? (0x60 | (c)) : (c))
5018 #define unmeta(c) (0x7f & (c))
5024 } const spkeys_binds[] = {
5025 { NHKF_ESC, '\033', (char *) 0 }, /* no binding */
5026 { NHKF_DOAGAIN, DOAGAIN, "repeat" },
5027 { NHKF_REQMENU, 'm', "reqmenu" },
5028 { NHKF_RUN, 'G', "run" },
5029 { NHKF_RUN2, '5', "run.numpad" },
5030 { NHKF_RUSH, 'g', "rush" },
5031 { NHKF_FIGHT, 'F', "fight" },
5032 { NHKF_FIGHT2, '-', "fight.numpad" },
5033 { NHKF_NOPICKUP, 'm', "nopickup" },
5034 { NHKF_RUN_NOPICKUP, 'M', "run.nopickup" },
5035 { NHKF_DOINV, '0', "doinv" },
5036 { NHKF_TRAVEL, CMD_TRAVEL, (char *) 0 }, /* no binding */
5037 { NHKF_CLICKLOOK, CMD_CLICKLOOK, (char *) 0 }, /* no binding */
5038 { NHKF_REDRAW, C('r'), "redraw" },
5039 { NHKF_REDRAW2, C('l'), "redraw.numpad" },
5040 { NHKF_GETDIR_SELF, '.', "getdir.self" },
5041 { NHKF_GETDIR_SELF2, 's', "getdir.self2" },
5042 { NHKF_GETDIR_HELP, '?', "getdir.help" },
5043 { NHKF_COUNT, 'n', "count" },
5044 { NHKF_GETPOS_SELF, '@', "getpos.self" },
5045 { NHKF_GETPOS_PICK, '.', "getpos.pick" },
5046 { NHKF_GETPOS_PICK_Q, ',', "getpos.pick.quick" },
5047 { NHKF_GETPOS_PICK_O, ';', "getpos.pick.once" },
5048 { NHKF_GETPOS_PICK_V, ':', "getpos.pick.verbose" },
5049 { NHKF_GETPOS_SHOWVALID, '$', "getpos.valid" },
5050 { NHKF_GETPOS_AUTODESC, '#', "getpos.autodescribe" },
5051 { NHKF_GETPOS_MON_NEXT, 'm', "getpos.mon.next" },
5052 { NHKF_GETPOS_MON_PREV, 'M', "getpos.mon.prev" },
5053 { NHKF_GETPOS_OBJ_NEXT, 'o', "getpos.obj.next" },
5054 { NHKF_GETPOS_OBJ_PREV, 'O', "getpos.obj.prev" },
5055 { NHKF_GETPOS_DOOR_NEXT, 'd', "getpos.door.next" },
5056 { NHKF_GETPOS_DOOR_PREV, 'D', "getpos.door.prev" },
5057 { NHKF_GETPOS_UNEX_NEXT, 'x', "getpos.unexplored.next" },
5058 { NHKF_GETPOS_UNEX_PREV, 'X', "getpos.unexplored.prev" },
5059 { NHKF_GETPOS_VALID_NEXT, 'z', "getpos.valid.next" },
5060 { NHKF_GETPOS_VALID_PREV, 'Z', "getpos.valid.prev" },
5061 { NHKF_GETPOS_INTERESTING_NEXT, 'a', "getpos.all.next" },
5062 { NHKF_GETPOS_INTERESTING_PREV, 'A', "getpos.all.prev" },
5063 { NHKF_GETPOS_HELP, '?', "getpos.help" },
5064 { NHKF_GETPOS_LIMITVIEW, '"', "getpos.filter" },
5065 { NHKF_GETPOS_MOVESKIP, '*', "getpos.moveskip" },
5066 { NHKF_GETPOS_MENU, '!', "getpos.menu" }
5070 bind_specialkey(key, command)
5072 const char *command;
5075 for (i = 0; i < SIZE(spkeys_binds); i++) {
5076 if (!spkeys_binds[i].name || strcmp(command, spkeys_binds[i].name))
5078 Cmd.spkeys[spkeys_binds[i].nhkf] = key;
5084 /* returns a one-byte character from the text (it may massacre the txt
5090 txt = trimspaces(txt);
5094 /* simple character */
5098 /* a few special entries */
5099 if (!strcmp(txt, "<enter>"))
5101 if (!strcmp(txt, "<space>"))
5103 if (!strcmp(txt, "<esc>"))
5106 /* control and meta keys */
5108 case 'm': /* can be mx, Mx, m-x, M-x */
5111 if (*txt == '-' && txt[1])
5116 case 'c': /* can be cx, Cx, ^x, c-x, C-x, ^-x */
5120 if (*txt == '-' && txt[1])
5127 /* ascii codes: must be three-digit decimal */
5128 if (*txt >= '0' && *txt <= '9') {
5132 for (i = 0; i < 3; i++) {
5133 if (txt[i] < '0' || txt[i] > '9')
5135 key = 10 * key + txt[i] - '0';
5143 /* returns the text for a one-byte encoding;
5144 * must be shorter than a tab for proper formatting */
5148 char *txt; /* sufficiently long buffer */
5150 /* should probably switch to "SPC", "ESC", "RET"
5151 since nethack's documentation uses ESC for <escape> */
5153 Sprintf(txt, "<space>");
5154 else if (c == '\033')
5155 Sprintf(txt, "<esc>");
5157 Sprintf(txt, "<enter>");
5158 else if (c == '\177')
5159 Sprintf(txt, "<del>"); /* "<delete>" won't fit */
5161 Strcpy(txt, visctrl((char) c));
5167 parseautocomplete(autocomplete, condition)
5171 struct ext_func_tab *efp;
5172 register char *autoc;
5174 /* break off first autocomplete from the rest; parse the rest */
5175 if ((autoc = index(autocomplete, ',')) != 0
5176 || (autoc = index(autocomplete, ':')) != 0) {
5178 parseautocomplete(autoc, condition);
5181 /* strip leading and trailing white space */
5182 autocomplete = trimspaces(autocomplete);
5187 /* take off negation */
5188 if (*autocomplete == '!') {
5189 /* unlike most options, a leading "no" might actually be a part of
5190 * the extended command. Thus you have to use ! */
5192 autocomplete = trimspaces(autocomplete);
5193 condition = !condition;
5196 /* find and modify the extended command */
5197 for (efp = extcmdlist; efp->ef_txt; efp++) {
5198 if (!strcmp(autocomplete, efp->ef_txt)) {
5200 efp->flags |= AUTOCOMPLETE;
5202 efp->flags &= ~AUTOCOMPLETE;
5207 /* not a real extended command */
5208 raw_printf("Bad autocomplete: invalid extended command '%s'.",
5213 /* called at startup and after number_pad is twiddled */
5215 reset_commands(initial)
5218 static const char sdir[] = "hykulnjb><",
5219 sdir_swap_yz[] = "hzkulnjb><",
5220 ndir[] = "47896321><",
5221 ndir_phone_layout[] = "41236987><";
5222 static const int ylist[] = {
5223 'y', 'Y', C('y'), M('y'), M('Y'), M(C('y'))
5225 static struct ext_func_tab *back_dir_cmd[8];
5226 const struct ext_func_tab *cmdtmp;
5228 int c, i, updated = 0;
5229 static boolean backed_dir_cmd = FALSE;
5233 Cmd.num_pad = FALSE;
5234 Cmd.pcHack_compat = Cmd.phone_layout = Cmd.swap_yz = FALSE;
5235 for (i = 0; i < SIZE(spkeys_binds); i++)
5236 Cmd.spkeys[spkeys_binds[i].nhkf] = spkeys_binds[i].key;
5240 if (backed_dir_cmd) {
5241 for (i = 0; i < 8; i++) {
5242 Cmd.commands[(uchar) Cmd.dirchars[i]] = back_dir_cmd[i];
5247 flagtemp = iflags.num_pad;
5248 if (flagtemp != Cmd.num_pad) {
5249 Cmd.num_pad = flagtemp;
5252 /* swap_yz mode (only applicable for !num_pad); intended for
5253 QWERTZ keyboard used in Central Europe, particularly Germany */
5254 flagtemp = (iflags.num_pad_mode & 1) ? !Cmd.num_pad : FALSE;
5255 if (flagtemp != Cmd.swap_yz) {
5256 Cmd.swap_yz = flagtemp;
5258 /* Cmd.swap_yz has been toggled;
5259 perform the swap (or reverse previous one) */
5260 for (i = 0; i < SIZE(ylist); i++) {
5261 c = ylist[i] & 0xff;
5262 cmdtmp = Cmd.commands[c]; /* tmp = [y] */
5263 Cmd.commands[c] = Cmd.commands[c + 1]; /* [y] = [z] */
5264 Cmd.commands[c + 1] = cmdtmp; /* [z] = tmp */
5267 /* MSDOS compatibility mode (only applicable for num_pad) */
5268 flagtemp = (iflags.num_pad_mode & 1) ? Cmd.num_pad : FALSE;
5269 if (flagtemp != Cmd.pcHack_compat) {
5270 Cmd.pcHack_compat = flagtemp;
5272 /* pcHack_compat has been toggled */
5274 cmdtmp = Cmd.commands['5'];
5275 Cmd.commands['5'] = Cmd.commands[c];
5276 Cmd.commands[c] = cmdtmp;
5278 Cmd.commands[c] = Cmd.pcHack_compat ? Cmd.commands['I'] : 0;
5280 /* phone keypad layout (only applicable for num_pad) */
5281 flagtemp = (iflags.num_pad_mode & 2) ? Cmd.num_pad : FALSE;
5282 if (flagtemp != Cmd.phone_layout) {
5283 Cmd.phone_layout = flagtemp;
5285 /* phone_layout has been toggled */
5286 for (i = 0; i < 3; i++) {
5287 c = '1' + i; /* 1,2,3 <-> 7,8,9 */
5288 cmdtmp = Cmd.commands[c]; /* tmp = [1] */
5289 Cmd.commands[c] = Cmd.commands[c + 6]; /* [1] = [7] */
5290 Cmd.commands[c + 6] = cmdtmp; /* [7] = tmp */
5291 c = (M('1') & 0xff) + i; /* M-1,M-2,M-3 <-> M-7,M-8,M-9 */
5292 cmdtmp = Cmd.commands[c]; /* tmp = [M-1] */
5293 Cmd.commands[c] = Cmd.commands[c + 6]; /* [M-1] = [M-7] */
5294 Cmd.commands[c + 6] = cmdtmp; /* [M-7] = tmp */
5301 Cmd.dirchars = !Cmd.num_pad
5302 ? (!Cmd.swap_yz ? sdir : sdir_swap_yz)
5303 : (!Cmd.phone_layout ? ndir : ndir_phone_layout);
5304 Cmd.alphadirchars = !Cmd.num_pad ? Cmd.dirchars : sdir;
5306 Cmd.move_W = Cmd.dirchars[0];
5307 Cmd.move_NW = Cmd.dirchars[1];
5308 Cmd.move_N = Cmd.dirchars[2];
5309 Cmd.move_NE = Cmd.dirchars[3];
5310 Cmd.move_E = Cmd.dirchars[4];
5311 Cmd.move_SE = Cmd.dirchars[5];
5312 Cmd.move_S = Cmd.dirchars[6];
5313 Cmd.move_SW = Cmd.dirchars[7];
5316 for (i = 0; i < 8; i++) {
5318 (struct ext_func_tab *) Cmd.commands[(uchar) Cmd.dirchars[i]];
5319 Cmd.commands[(uchar) Cmd.dirchars[i]] = (struct ext_func_tab *) 0;
5321 backed_dir_cmd = TRUE;
5322 for (i = 0; i < 8; i++)
5323 (void) bind_key(Cmd.dirchars[i], "nothing");
5327 /* non-movement commands which accept 'm' prefix to request menu operation */
5329 accept_menu_prefix(cmd_func)
5330 int NDECL((*cmd_func));
5332 if (cmd_func == dopickup || cmd_func == dotip
5333 /* eat, #offer, and apply tinning-kit all use floorfood() to pick
5334 an item on floor or in invent; 'm' skips picking from floor
5335 (ie, inventory only) rather than request use of menu operation */
5336 || cmd_func == doeat || cmd_func == dosacrifice || cmd_func == doapply
5337 /* 'm' for removing saddle from adjacent monster without checking
5338 for containers at <u.ux,u.uy> */
5339 || cmd_func == doloot
5340 /* travel: pop up a menu of interesting targets in view */
5341 || cmd_func == dotravel
5342 /* wizard mode ^V */
5343 || cmd_func == wiz_level_tele
5344 /* 'm' prefix allowed for some extended commands */
5345 || cmd_func == doextcmd || cmd_func == doextlist)
5351 ch2spkeys(c, start, end)
5357 for (i = start; i <= end; i++)
5358 if (Cmd.spkeys[i] == c)
5368 boolean do_walk, do_rush, prefix_seen, bad_command,
5369 firsttime = (cmd == 0);
5371 iflags.menu_requested = FALSE;
5373 if (program_state.done_hup)
5380 if (*cmd == Cmd.spkeys[NHKF_ESC]) {
5381 context.move = FALSE;
5384 if (*cmd == DOAGAIN && !in_doagain && saveq[0]) {
5387 rhack((char *) 0); /* read and execute command */
5391 /* Special case of *cmd == ' ' handled better below */
5392 if (!*cmd || *cmd == (char) 0377) {
5394 context.move = FALSE;
5395 return; /* probably we just had an interrupt */
5398 /* handle most movement commands */
5399 do_walk = do_rush = prefix_seen = FALSE;
5400 context.travel = context.travel1 = 0;
5401 spkey = ch2spkeys(*cmd, NHKF_RUN, NHKF_CLICKLOOK);
5405 if (movecmd(cmd[1])) {
5416 if (movecmd(lowc(cmd[1]))) {
5426 /* Effects of movement commands and invisible monsters:
5427 * m: always move onto space (even if 'I' remembered)
5428 * F: always attack space (even if 'I' not remembered)
5429 * normal movement: attack if 'I', move otherwise.
5432 if (movecmd(cmd[1])) {
5433 context.forcefight = 1;
5439 if (movecmd(cmd[1]) || u.dz) {
5445 cmd[0] = cmd[1]; /* "m<" or "m>" */
5449 case NHKF_RUN_NOPICKUP:
5450 if (movecmd(lowc(cmd[1]))) {
5460 (void) ddoinv(); /* a convenience borrowed from the PC */
5461 context.move = FALSE;
5464 case NHKF_CLICKLOOK:
5465 if (iflags.clicklook) {
5466 context.move = FALSE;
5467 do_look(2, &clicklook_cc);
5471 if (flags.travelcmd) {
5473 context.travel1 = 1;
5481 if (movecmd(*cmd)) { /* ordinary movement */
5482 context.run = 0; /* only matters here if it was 8 */
5484 } else if (movecmd(Cmd.num_pad ? unmeta(*cmd) : lowc(*cmd))) {
5487 } else if (movecmd(unctrl(*cmd))) {
5494 /* some special prefix handling */
5495 /* overload 'm' prefix to mean "request a menu" */
5496 if (prefix_seen && cmd[0] == Cmd.spkeys[NHKF_REQMENU]) {
5497 /* (for func_tab cast, see below) */
5498 const struct ext_func_tab *ft = Cmd.commands[cmd[1] & 0xff];
5499 int NDECL((*func)) = ft ? ((struct ext_func_tab *) ft)->ef_funct : 0;
5501 if (func && accept_menu_prefix(func)) {
5502 iflags.menu_requested = TRUE;
5507 if ((do_walk || do_rush) && !context.travel && !dxdy_moveok()) {
5508 /* trying to move diagonally as a grid bug;
5509 this used to be treated by movecmd() as not being
5510 a movement attempt, but that didn't provide for any
5511 feedback and led to strangeness if the key pressed
5512 ('u' in particular) was overloaded for num_pad use */
5514 You_cant("get there from here...");
5516 You_cant("
\82±
\82±
\82©
\82ç
\82»
\82±
\82Ö
\82Í
\8ds
\82¯
\82Ü
\82¹
\82ñ
\81D
\81D
\81D");
5518 context.nopick = context.forcefight = FALSE;
5519 context.move = context.mv = FALSE;
5528 context.forcefight = 0;
5530 } else if (do_rush) {
5533 multi = max(COLNO, ROWNO);
5534 u.last_str_turn = 0;
5539 } else if (prefix_seen && cmd[1] == Cmd.spkeys[NHKF_ESC]) {
5540 /* <prefix><escape> */
5541 /* don't report "unknown command" for change of heart... */
5542 bad_command = FALSE;
5543 } else if (*cmd == ' ' && !flags.rest_on_space) {
5544 bad_command = TRUE; /* skip cmdlist[] loop */
5546 /* handle all other commands */
5548 register const struct ext_func_tab *tlist;
5549 int res, NDECL((*func));
5551 /* current - use *cmd to directly index cmdlist array */
5552 if ((tlist = Cmd.commands[*cmd & 0xff]) != 0) {
5553 if (!wizard && (tlist->flags & WIZMODECMD)) {
5555 You_cant("do that!");
5557 pline("
\82»
\82ê
\82Í
\82Å
\82«
\82Ü
\82¹
\82ñ
\81I");
5559 } else if (u.uburied && !(tlist->flags & IFBURIED)) {
5561 You_cant("do that while you are buried!");
5563 You("
\96\84\82Ü
\82Á
\82Ä
\82¢
\82é
\8e\9e\82É
\82»
\82ñ
\82È
\82±
\82Æ
\82Í
\82Å
\82«
\82È
\82¢
\81I");
5566 /* we discard 'const' because some compilers seem to have
5567 trouble with the pointer passed to set_occupation() */
5568 func = ((struct ext_func_tab *) tlist)->ef_funct;
5569 if (tlist->f_text && !occupation && multi)
5570 set_occupation(func, tlist->f_text, multi);
5571 res = (*func)(); /* perform the command */
5574 context.move = FALSE;
5579 /* if we reach here, cmd wasn't found in cmdlist[] */
5584 char expcmd[20]; /* we expect 'cmd' to point to 1 or 2 chars */
5585 char c, c1 = cmd[1];
5588 while ((c = *cmd++) != '\0')
5589 Strcat(expcmd, visctrl(c)); /* add 1..4 chars plus terminator */
5592 if (!prefix_seen || !help_dir(c1, spkey, "Invalid direction key!"))
5594 if (!prefix_seen || !help_dir(c1, spkey, "
\96³
\8cø
\82È
\95û
\8cü
\8ew
\92è
\82Å
\82·
\81I"))
5596 Norep("Unknown command '%s'.", expcmd);
5598 Norep("'%s'
\83R
\83}
\83\93\83h
\81H", expcmd);
5601 context.move = FALSE;
5606 /* convert an x,y pair into a direction code */
5613 for (dd = 0; dd < 8; dd++)
5614 if (x == xdir[dd] && y == ydir[dd])
5619 /* convert a direction code into an x,y pair */
5630 /* also sets u.dz, but returns false for <> */
5635 register const char *dp = index(Cmd.dirchars, sym);
5640 u.dx = xdir[dp - Cmd.dirchars];
5641 u.dy = ydir[dp - Cmd.dirchars];
5642 u.dz = zdir[dp - Cmd.dirchars];
5643 #if 0 /* now handled elsewhere */
5644 if (u.dx && u.dy && NODIAG(u.umonnum)) {
5652 /* grid bug handling which used to be in movecmd() */
5656 if (u.dx && u.dy && NODIAG(u.umonnum))
5658 return u.dx || u.dy;
5661 /* decide whether a character (user input keystroke) requests screen repaint */
5666 return (boolean) (c == Cmd.spkeys[NHKF_REDRAW]
5667 || (Cmd.num_pad && c == Cmd.spkeys[NHKF_REDRAW2]));
5674 return (c == Cmd.spkeys[NHKF_RUSH]
5675 || c == Cmd.spkeys[NHKF_RUN]
5676 || c == Cmd.spkeys[NHKF_NOPICKUP]
5677 || c == Cmd.spkeys[NHKF_RUN_NOPICKUP]
5678 || c == Cmd.spkeys[NHKF_FIGHT]
5679 || (Cmd.num_pad && (c == Cmd.spkeys[NHKF_RUN2]
5680 || c == Cmd.spkeys[NHKF_FIGHT2])));
5684 * uses getdir() but unlike getdir() it specifically
5685 * produces coordinates using the direction from getdir()
5686 * and verifies that those coordinates are ok.
5688 * If the call to getdir() returns 0, Never_mind is displayed.
5689 * If the resulting coordinates are not okay, emsg is displayed.
5691 * Returns non-zero if coordinates in cc are valid.
5694 get_adjacent_loc(prompt, emsg, x, y, cc)
5695 const char *prompt, *emsg;
5700 if (!getdir(prompt)) {
5706 if (cc && isok(new_x, new_y)) {
5725 if (in_doagain || *readchar_queue)
5726 dirsym = readchar();
5729 dirsym = yn_function((s && *s != '^') ? s : "In what direction?",
5731 dirsym = yn_function((s && *s != '^') ? s : "
\82Ç
\82Ì
\95û
\8cü
\81H",
5733 /* remove the prompt string so caller won't have to */
5734 clear_nhwindow(WIN_MESSAGE);
5736 if (redraw_cmd(dirsym)) { /* ^R */
5737 docrt(); /* redraw */
5742 if (dirsym == Cmd.spkeys[NHKF_GETDIR_SELF]
5743 || dirsym == Cmd.spkeys[NHKF_GETDIR_SELF2]) {
5744 u.dx = u.dy = u.dz = 0;
5745 } else if (!(is_mov = movecmd(dirsym)) && !u.dz) {
5746 boolean did_help = FALSE, help_requested;
5748 if (!index(quitchars, dirsym)) {
5749 help_requested = (dirsym == Cmd.spkeys[NHKF_GETDIR_HELP]);
5750 if (help_requested || iflags.cmdassist) {
5751 did_help = help_dir((s && *s == '^') ? dirsym : '\0',
5753 help_requested ? (const char *) 0
5755 : "Invalid direction key!");
5757 : "
\96³
\8cø
\82È
\95û
\8cü
\8ew
\92è
\82Å
\82·
\81I");
5763 pline("What a strange direction!");
5765 pline("
\82¸
\82¢
\82Ô
\82ñ
\82Æ
\8aï
\96
\82È
\95û
\8cü
\82¾
\81I");
5768 } else if (is_mov && !dxdy_moveok()) {
5770 You_cant("orient yourself that direction.");
5772 You_cant("
\8cü
\82«
\82É
\8e©
\95ª
\8e©
\90g
\82ð
\8ew
\92è
\82Å
\82«
\82È
\82¢
\81D");
5775 if (!u.dz && (Stunned || (Confusion && !rn2(5))))
5781 show_direction_keys(win, centerchar, nodiag)
5782 winid win; /* should specify a window which is using a fixed-width font... */
5783 char centerchar; /* '.' or '@' or ' ' */
5792 Sprintf(buf, " %c ", Cmd.move_N);
5793 putstr(win, 0, buf);
5794 putstr(win, 0, " | ");
5795 Sprintf(buf, " %c- %c -%c",
5796 Cmd.move_W, centerchar, Cmd.move_E);
5797 putstr(win, 0, buf);
5798 putstr(win, 0, " | ");
5799 Sprintf(buf, " %c ", Cmd.move_S);
5800 putstr(win, 0, buf);
5802 Sprintf(buf, " %c %c %c",
5803 Cmd.move_NW, Cmd.move_N, Cmd.move_NE);
5804 putstr(win, 0, buf);
5805 putstr(win, 0, " \\ | / ");
5806 Sprintf(buf, " %c- %c -%c",
5807 Cmd.move_W, centerchar, Cmd.move_E);
5808 putstr(win, 0, buf);
5809 putstr(win, 0, " / | \\ ");
5810 Sprintf(buf, " %c %c %c",
5811 Cmd.move_SW, Cmd.move_S, Cmd.move_SE);
5812 putstr(win, 0, buf);
5816 /* explain choices if player has asked for getdir() help or has given
5817 an invalid direction after a prefix key ('F', 'g', 'm', &c), which
5818 might be bogus but could be up, down, or self when not applicable */
5820 help_dir(sym, spkey, msg)
5822 int spkey; /* NHKF_ code for prefix key, if one was used, or for ESC */
5825 static const char wiz_only_list[] = "EFGIVW";
5828 char buf[BUFSZ], buf2[BUFSZ], *explain;
5829 const char *dothat, *how;
5830 boolean prefixhandling, viawindow;
5832 /* NHKF_ESC indicates that player asked for help at getdir prompt */
5833 viawindow = (spkey == NHKF_ESC || iflags.cmdassist);
5834 prefixhandling = (spkey != NHKF_ESC);
5836 * Handling for prefix keys that don't want special directions.
5837 * Delivered via pline if 'cmdassist' is off, or instead of the
5838 * general message if it's on.
5841 how = " at"; /* for "<action> at yourself"; not used for up/down */
5854 case NHKF_RUN_NOPICKUP:
5863 how = ""; /* avoid "fight at yourself" */
5866 prefixhandling = FALSE;
5871 /* for movement prefix followed by '.' or (numpad && 's') to mean 'self';
5872 note: '-' for hands (inventory form of 'self') is not handled here */
5874 && (sym == Cmd.spkeys[NHKF_GETDIR_SELF]
5875 || (Cmd.num_pad && sym == Cmd.spkeys[NHKF_GETDIR_SELF2]))) {
5876 Sprintf(buf, "You can't %s%s yourself.", dothat, how);
5877 /* for movement prefix followed by up or down */
5878 } else if (prefixhandling && (sym == '<' || sym == '>')) {
5879 Sprintf(buf, "You can't %s %s.", dothat,
5880 /* was "upwards" and "downwards", but they're considered
5881 to be variants of canonical "upward" and "downward" */
5882 (sym == '<') ? "upward" : "downward");
5885 /* if '!cmdassist', display via pline() and we're done (note: asking
5886 for help at getdir() prompt forces cmdassist for this operation) */
5888 if (prefixhandling) {
5890 Sprintf(buf, "Invalid direction for '%s' prefix.",
5891 visctrl(Cmd.spkeys[spkey]));
5895 /* when 'cmdassist' is off and caller doesn't insist, do nothing */
5899 win = create_nhwindow(NHW_TEXT);
5904 /* show bad-prefix message instead of general invalid-direction one */
5905 putstr(win, 0, buf);
5908 Sprintf(buf, "cmdassist: %s", msg);
5909 putstr(win, 0, buf);
5913 if (!prefixhandling && (letter(sym) || sym == '[')) {
5914 /* '[': old 'cmdhelp' showed ESC as ^[ */
5915 sym = highc(sym); /* @A-Z[ (note: letter() accepts '@') */
5916 ctrl = (sym - 'A') + 1; /* 0-27 (note: 28-31 aren't applicable) */
5917 if ((explain = dowhatdoes_core(ctrl, buf2)) != 0
5918 && (!index(wiz_only_list, sym) || wizard)) {
5919 Sprintf(buf, "Are you trying to use ^%c%s?", sym,
5920 index(wiz_only_list, sym) ? ""
5921 : " as specified in the Guidebook");
5922 putstr(win, 0, buf);
5924 putstr(win, 0, explain);
5927 "To use that command, hold down the <Ctrl> key as a shift");
5928 Sprintf(buf, "and press the <%c> key.", sym);
5929 putstr(win, 0, buf);
5934 Sprintf(buf, "Valid direction keys%s%s%s are:",
5935 prefixhandling ? " to " : "", prefixhandling ? dothat : "",
5936 NODIAG(u.umonnum) ? " in your current form" : "");
5937 putstr(win, 0, buf);
5938 show_direction_keys(win, !prefixhandling ? '.' : ' ', NODIAG(u.umonnum));
5940 if (!prefixhandling || spkey == NHKF_NOPICKUP) {
5941 /* NOPICKUP: unlike the other prefix keys, 'm' allows up/down for
5942 stair traversal; we won't get here when "m<" or "m>" has been
5943 given but we include up and down for 'm'+invalid_direction;
5944 self is excluded as a viable direction for every prefix */
5946 putstr(win, 0, " < up");
5947 putstr(win, 0, " > down");
5948 if (!prefixhandling) {
5949 int selfi = Cmd.num_pad ? NHKF_GETDIR_SELF2 : NHKF_GETDIR_SELF;
5951 Sprintf(buf, " %4s direct at yourself",
5952 visctrl(Cmd.spkeys[selfi]));
5953 putstr(win, 0, buf);
5958 /* non-null msg means that this wasn't an explicit user request */
5962 "(Suppress this message with !cmdassist in config file.)");
5964 "(
\82±
\82Ì
\83\81\83b
\83Z
\81[
\83W
\82ð
\95\
\8e¦
\82µ
\82½
\82
\82È
\82¢
\8fê
\8d\87\82Í
\90Ý
\92è
\83t
\83@
\83C
\83\8b\82É !cmdassist
\82ð
\90Ý
\92è
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81D)");
5966 display_nhwindow(win, FALSE);
5967 destroy_nhwindow(win);
5974 register int x = NODIAG(u.umonnum) ? 2 * rn2(4) : rn2(8);
5985 static NEARDATA const char *const dirnames[] = {
5986 "west", "northwest", "north", "northeast", "east",
5987 "southeast", "south", "southwest", "down", "up",
5990 if (dir < 0 || dir >= SIZE(dirnames))
5992 return dirnames[dir];
5999 /* x corresponds to curx, so x==1 is the first column. Ach. %% */
6000 return x >= 1 && x <= COLNO - 1 && y >= 0 && y <= ROWNO - 1;
6003 /* #herecmdmenu command */
6005 doherecmdmenu(VOID_ARGS)
6007 char ch = here_cmd_menu(TRUE);
6012 /* #therecmdmenu command, a way to test there_cmd_menu without mouse */
6014 dotherecmdmenu(VOID_ARGS)
6018 if (!getdir((const char *) 0) || !isok(u.ux + u.dx, u.uy + u.dy))
6022 ch = there_cmd_menu(TRUE, u.ux + u.dx, u.uy + u.dy);
6024 ch = here_cmd_menu(TRUE);
6030 add_herecmd_menuitem(win, func, text)
6038 if ((ch = cmd_from_func(func)) != '\0') {
6041 add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, text, MENU_UNSELECTED);
6046 there_cmd_menu(doit, x, y)
6053 schar typ = levl[x][y].typ;
6055 menu_item *picks = (menu_item *) 0;
6059 win = create_nhwindow(NHW_MENU);
6063 boolean key_or_pick, card;
6064 int dm = levl[x][y].doormask;
6066 if ((dm & (D_CLOSED | D_LOCKED))) {
6067 add_herecmd_menuitem(win, doopen, "Open the door"), ++K;
6068 /* unfortunately there's no lknown flag for doors to
6069 remember the locked/unlocked state */
6070 key_or_pick = (carrying(SKELETON_KEY) || carrying(LOCK_PICK));
6071 card = (carrying(CREDIT_CARD) != 0);
6072 if (key_or_pick || card) {
6073 Sprintf(buf, "%sunlock the door",
6074 key_or_pick ? "lock or " : "");
6075 add_herecmd_menuitem(win, doapply, upstart(buf)), ++K;
6077 /* unfortunately there's no tknown flag for doors (or chests)
6078 to remember whether a trap had been found */
6079 add_herecmd_menuitem(win, dountrap,
6080 "Search the door for a trap"), ++K;
6081 /* [what about #force?] */
6082 add_herecmd_menuitem(win, dokick, "Kick the door"), ++K;
6083 } else if ((dm & D_ISOPEN)) {
6084 add_herecmd_menuitem(win, doclose, "Close the door"), ++K;
6089 add_herecmd_menuitem(win, dosearch, "Search for secret doors"), ++K;
6091 if ((ttmp = t_at(x, y)) != 0 && ttmp->tseen) {
6092 add_herecmd_menuitem(win, doidtrap, "Examine trap"), ++K;
6093 if (ttmp->ttyp != VIBRATING_SQUARE)
6094 add_herecmd_menuitem(win, dountrap, "Attempt to disarm trap"), ++K;
6098 if (mtmp && !canspotmon(mtmp))
6100 if (mtmp && which_armor(mtmp, W_SADDLE)) {
6101 char *mnam = x_monnam(mtmp, ARTICLE_THE, (char *) 0,
6102 SUPPRESS_SADDLE, FALSE);
6105 Sprintf(buf, "Ride %s", mnam);
6106 add_herecmd_menuitem(win, doride, buf), ++K;
6108 Sprintf(buf, "Remove saddle from %s", mnam);
6109 add_herecmd_menuitem(win, doloot, buf), ++K;
6111 if (mtmp && can_saddle(mtmp) && !which_armor(mtmp, W_SADDLE)
6112 && carrying(SADDLE)) {
6113 Sprintf(buf, "Put saddle on %s", mon_nam(mtmp)), ++K;
6114 add_herecmd_menuitem(win, doapply, buf);
6117 if (mtmp || glyph_is_invisible(glyph_at(x, y))) {
6118 /* "Attack %s", mtmp ? mon_nam(mtmp) : "unseen creature" */
6120 /* "Move %s", direction */
6125 end_menu(win, "What do you want to do?");
6126 npick = select_menu(win, PICK_ONE, &picks);
6128 pline("No applicable actions.");
6131 destroy_nhwindow(win);
6134 int NDECL((*func)) = picks->item.a_nfunc;
6135 free((genericptr_t) picks);
6138 int ret = (*func)();
6142 ch = cmd_from_func(func);
6155 schar typ = levl[u.ux][u.uy].typ;
6157 menu_item *picks = (menu_item *) 0;
6159 win = create_nhwindow(NHW_MENU);
6162 if (IS_FOUNTAIN(typ) || IS_SINK(typ)) {
6163 Sprintf(buf, "Drink from the %s",
6164 defsyms[IS_FOUNTAIN(typ) ? S_fountain : S_sink].explanation);
6165 add_herecmd_menuitem(win, dodrink, buf);
6167 if (IS_FOUNTAIN(typ))
6168 add_herecmd_menuitem(win, dodip,
6169 "Dip something into the fountain");
6171 add_herecmd_menuitem(win, dosit,
6172 "Sit on the throne");
6174 if ((u.ux == xupstair && u.uy == yupstair)
6175 || (u.ux == sstairs.sx && u.uy == sstairs.sy && sstairs.up)
6176 || (u.ux == xupladder && u.uy == yupladder)) {
6177 Sprintf(buf, "Go up the %s",
6178 (u.ux == xupladder && u.uy == yupladder)
6179 ? "ladder" : "stairs");
6180 add_herecmd_menuitem(win, doup, buf);
6182 if ((u.ux == xdnstair && u.uy == ydnstair)
6183 || (u.ux == sstairs.sx && u.uy == sstairs.sy && !sstairs.up)
6184 || (u.ux == xdnladder && u.uy == ydnladder)) {
6185 Sprintf(buf, "Go down the %s",
6186 (u.ux == xupladder && u.uy == yupladder)
6187 ? "ladder" : "stairs");
6188 add_herecmd_menuitem(win, dodown, buf);
6190 if (u.usteed) { /* another movement choice */
6191 Sprintf(buf, "Dismount %s",
6192 x_monnam(u.usteed, ARTICLE_THE, (char *) 0,
6193 SUPPRESS_SADDLE, FALSE));
6194 add_herecmd_menuitem(win, doride, buf);
6198 if (Upolyd) { /* before objects */
6199 Sprintf(buf, "Use %s special ability",
6200 s_suffix(mons[u.umonnum].mname));
6201 add_herecmd_menuitem(win, domonability, buf);
6205 if (OBJ_AT(u.ux, u.uy)) {
6206 struct obj *otmp = level.objects[u.ux][u.uy];
6208 Sprintf(buf, "Pick up %s", otmp->nexthere ? "items" : doname(otmp));
6209 add_herecmd_menuitem(win, dopickup, buf);
6211 if (Is_container(otmp)) {
6212 Sprintf(buf, "Loot %s", doname(otmp));
6213 add_herecmd_menuitem(win, doloot, buf);
6215 if (otmp->oclass == FOOD_CLASS) {
6216 Sprintf(buf, "Eat %s", doname(otmp));
6217 add_herecmd_menuitem(win, doeat, buf);
6222 add_herecmd_menuitem(win, dodrop, "Drop items");
6224 add_herecmd_menuitem(win, donull, "Rest one turn");
6225 add_herecmd_menuitem(win, dosearch, "Search around you");
6226 add_herecmd_menuitem(win, dolook, "Look at what is here");
6228 end_menu(win, "What do you want to do?");
6229 npick = select_menu(win, PICK_ONE, &picks);
6230 destroy_nhwindow(win);
6233 int NDECL((*func)) = picks->item.a_nfunc;
6234 free((genericptr_t) picks);
6237 int ret = (*func)();
6241 ch = cmd_from_func(func);
6248 static NEARDATA int last_multi;
6251 * convert a MAP window position into a movecmd
6254 click_to_cmd(x, y, mod)
6261 if (iflags.clicklook && mod == CLICK_2) {
6264 cmd[0] = Cmd.spkeys[NHKF_CLICKLOOK];
6271 if (flags.travelcmd) {
6272 if (abs(x) <= 1 && abs(y) <= 1) {
6273 x = sgn(x), y = sgn(y);
6277 cmd[0] = Cmd.spkeys[NHKF_TRAVEL];
6281 if (x == 0 && y == 0) {
6282 if (iflags.herecmd_menu) {
6283 cmd[0] = here_cmd_menu(FALSE);
6288 if (IS_FOUNTAIN(levl[u.ux][u.uy].typ)
6289 || IS_SINK(levl[u.ux][u.uy].typ)) {
6290 cmd[0] = cmd_from_func(mod == CLICK_1 ? dodrink : dodip);
6292 } else if (IS_THRONE(levl[u.ux][u.uy].typ)) {
6293 cmd[0] = cmd_from_func(dosit);
6295 } else if ((u.ux == xupstair && u.uy == yupstair)
6296 || (u.ux == sstairs.sx && u.uy == sstairs.sy
6298 || (u.ux == xupladder && u.uy == yupladder)) {
6299 cmd[0] = cmd_from_func(doup);
6301 } else if ((u.ux == xdnstair && u.uy == ydnstair)
6302 || (u.ux == sstairs.sx && u.uy == sstairs.sy
6304 || (u.ux == xdnladder && u.uy == ydnladder)) {
6305 cmd[0] = cmd_from_func(dodown);
6307 } else if (OBJ_AT(u.ux, u.uy)) {
6308 cmd[0] = cmd_from_func(Is_container(level.objects[u.ux][u.uy])
6309 ? doloot : dopickup);
6312 cmd[0] = cmd_from_func(donull); /* just rest */
6317 /* directional commands */
6321 if (!m_at(u.ux + x, u.uy + y)
6322 && !test_move(u.ux, u.uy, x, y, TEST_MOVE)) {
6323 cmd[1] = Cmd.dirchars[dir];
6325 if (iflags.herecmd_menu) {
6326 cmd[0] = there_cmd_menu(FALSE, u.ux + x, u.uy + y);
6332 if (IS_DOOR(levl[u.ux + x][u.uy + y].typ)) {
6333 /* slight assistance to the player: choose kick/open for them
6335 if (levl[u.ux + x][u.uy + y].doormask & D_LOCKED) {
6336 cmd[0] = cmd_from_func(dokick);
6339 if (levl[u.ux + x][u.uy + y].doormask & D_CLOSED) {
6340 cmd[0] = cmd_from_func(doopen);
6344 if (levl[u.ux + x][u.uy + y].typ <= SCORR) {
6345 cmd[0] = cmd_from_func(dosearch);
6351 /* convert without using floating point, allowing sloppy clicking */
6354 else if (y > 2 * abs(x))
6356 else if (x < -2 * abs(y))
6358 else if (y < -2 * abs(x))
6361 x = sgn(x), y = sgn(y);
6363 if (x == 0 && y == 0) {
6364 /* map click on player to "rest" command */
6365 cmd[0] = cmd_from_func(donull);
6371 /* move, attack, etc. */
6373 if (mod == CLICK_1) {
6374 cmd[0] = Cmd.dirchars[dir];
6376 cmd[0] = (Cmd.num_pad
6377 ? M(Cmd.dirchars[dir])
6378 : (Cmd.dirchars[dir] - 'a' + 'A')); /* run command */
6385 get_count(allowchars, inkey, maxcount, count, historical)
6390 boolean historical; /* whether to include in message history: True => yes */
6395 boolean backspaced = FALSE;
6396 /* this should be done in port code so that we have erase_char
6397 and kill_char available; we can at least fake erase_char */
6398 #define STANDBY_erase_char '\177'
6408 cnt = 10L * cnt + (long) (key - '0');
6411 else if (maxcount > 0 && cnt > maxcount)
6413 } else if (cnt && (key == '\b' || key == STANDBY_erase_char)) {
6416 } else if (key == Cmd.spkeys[NHKF_ESC]) {
6418 } else if (!allowchars || index(allowchars, key)) {
6423 if (cnt > 9 || backspaced) {
6424 clear_nhwindow(WIN_MESSAGE);
6425 if (backspaced && !cnt) {
6427 Sprintf(qbuf, "Count: ");
6429 Sprintf(qbuf, "
\90\94: ");
6432 Sprintf(qbuf, "Count: %ld", cnt);
6434 Sprintf(qbuf, "
\90\94: %ld", cnt);
6437 /* bypassing pline() keeps intermediate prompt out of
6438 DUMPLOG message history */
6439 putstr(WIN_MESSAGE, 0, qbuf);
6446 Sprintf(qbuf, "Count: %ld ", *count);
6448 Sprintf(qbuf, "
\90\94: %ld ", *count);
6449 (void) key2txt((uchar) key, eos(qbuf));
6450 putmsghistory(qbuf, FALSE);
6460 #ifdef LINT /* static char in_line[COLNO]; */
6461 char in_line[COLNO];
6463 static char in_line[COLNO];
6466 boolean prezero = FALSE;
6468 iflags.in_parse = TRUE;
6471 flush_screen(1); /* Flush screen buffer. Put the cursor on the hero. */
6474 alt_esc = iflags.altmeta; /* readchar() hack */
6476 if (!Cmd.num_pad || (foo = readchar()) == Cmd.spkeys[NHKF_COUNT]) {
6477 long tmpmulti = multi;
6479 foo = get_count((char *) 0, '\0', LARGEST_INT, &tmpmulti, FALSE);
6480 last_multi = multi = tmpmulti;
6483 alt_esc = FALSE; /* readchar() reset */
6486 if (foo == Cmd.spkeys[NHKF_ESC]) { /* esc cancels count (TH) */
6487 clear_nhwindow(WIN_MESSAGE);
6488 multi = last_multi = 0;
6489 } else if (foo == Cmd.spkeys[NHKF_DOAGAIN] || in_doagain) {
6493 savech(0); /* reset input queue */
6501 save_cm = (char *) 0;
6503 /* in 3.4.3 this was in rhack(), where it was too late to handle M-5 */
6504 if (Cmd.pcHack_compat) {
6505 /* This handles very old inconsistent DOS/Windows behaviour
6506 in a different way: earlier, the keyboard handler mapped
6507 these, which caused counts to be strange when entered
6508 from the number pad. Now do not map them until here. */
6511 foo = Cmd.spkeys[NHKF_RUSH];
6514 foo = Cmd.spkeys[NHKF_RUN];
6517 foo = Cmd.spkeys[NHKF_DOINV];
6526 if (prefix_cmd(foo)) {
6532 clear_nhwindow(WIN_MESSAGE);
6534 in_line[0] = Cmd.spkeys[NHKF_ESC];
6536 iflags.in_parse = FALSE;
6540 #ifdef HANGUPHANDLING
6541 /* some very old systems, or descendents of such systems, expect signal
6542 handlers to have return type `int', but they don't actually inspect
6543 the return value so we should be safe using `void' unconditionally */
6546 hangup(sig_unused) /* called as signal() handler, so sent at least one arg */
6547 int sig_unused UNUSED;
6549 if (program_state.exiting)
6550 program_state.in_moveloop = 0;
6553 /* When using SAFERHANGUP, the done_hup flag it tested in rhack
6554 and a couple of other places; actual hangup handling occurs then.
6555 This is 'safer' because it disallows certain cheats and also
6556 protects against losing objects in the process of being thrown,
6557 but also potentially riskier because the disconnected program
6558 must continue running longer before attempting a hangup save. */
6559 program_state.done_hup++;
6560 /* defer hangup iff game appears to be in progress */
6561 if (program_state.in_moveloop && program_state.something_worth_saving)
6563 #endif /* SAFERHANGUP */
6570 #ifdef NOSAVEONHANGUP
6572 if (flags.ins_chkpt && program_state.something_worth_saving)
6573 program_statue.preserve_locks = 1; /* keep files for recovery */
6575 program_state.something_worth_saving = 0; /* don't save */
6579 if (!program_state.done_hup++)
6581 if (program_state.something_worth_saving)
6583 if (iflags.window_inited)
6584 exit_nhwindows((char *) 0);
6586 nh_terminate(EXIT_SUCCESS);
6587 /*NOTREACHED*/ /* not necessarily true for vms... */
6590 #endif /* HANGUPHANDLING */
6596 int x = u.ux, y = u.uy, mod = 0;
6598 if (*readchar_queue)
6599 sym = *readchar_queue++;
6601 sym = in_doagain ? pgetchar() : nh_poskey(&x, &y, &mod);
6605 register int cnt = NR_OF_EOFS;
6607 * Some SYSV systems seem to return EOFs for various reasons
6608 * (?like when one hits break or for interrupted systemcalls?),
6609 * and we must see several before we quit.
6612 clearerr(stdin); /* omit if clearerr is undefined */
6614 } while (--cnt && sym == EOF);
6616 #endif /* NR_OF_EOFS */
6619 #ifdef HANGUPHANDLING
6620 hangup(0); /* call end_of_input() or set program_state.done_hup */
6624 } else if (sym == '\033' && alt_esc) {
6625 /* iflags.altmeta: treat two character ``ESC c'' as single `M-c' */
6626 sym = *readchar_queue ? *readchar_queue++ : pgetchar();
6627 if (sym == EOF || sym == 0)
6629 else if (sym != '\033')
6630 sym |= 0200; /* force 8th bit on */
6632 } else if (sym == 0) {
6634 readchar_queue = click_to_cmd(x, y, mod);
6635 sym = *readchar_queue++;
6643 /* Keyboard travel command */
6647 if (!flags.travelcmd)
6650 cc.x = iflags.travelcc.x;
6651 cc.y = iflags.travelcc.y;
6652 if (cc.x == -1 && cc.y == -1) {
6653 /* No cached destination, start attempt from current position */
6657 iflags.getloc_travelmode = TRUE;
6658 if (iflags.menu_requested) {
6659 int gf = iflags.getloc_filter;
6660 iflags.getloc_filter = GFILTER_VIEW;
6661 if (!getpos_menu(&cc, GLOC_INTERESTING)) {
6662 iflags.getloc_filter = gf;
6663 iflags.getloc_travelmode = FALSE;
6666 iflags.getloc_filter = gf;
6669 pline("Where do you want to travel to?");
6671 pline("
\82Ç
\82±
\82É
\88Ú
\93®
\82·
\82é
\81H");
6673 if (getpos(&cc, TRUE, "the desired destination") < 0) {
6675 if (getpos(&cc, TRUE, "
\88Ú
\93®
\90æ") < 0) {
6676 /* user pressed ESC */
6677 iflags.getloc_travelmode = FALSE;
6681 iflags.getloc_travelmode = FALSE;
6682 iflags.travelcc.x = u.tx = cc.x;
6683 iflags.travelcc.y = u.ty = cc.y;
6684 cmd[0] = Cmd.spkeys[NHKF_TRAVEL];
6685 readchar_queue = cmd;
6690 extern void NDECL(win32con_debug_keystrokes);
6691 extern void NDECL(win32con_handler_info);
6700 int num_menu_selections;
6701 struct menu_selection_struct {
6704 } menu_selections[] = {
6706 { "test win32 keystrokes (tty only)", win32con_debug_keystrokes },
6707 { "show keystroke handler information (tty only)",
6708 win32con_handler_info },
6710 { (char *) 0, (void NDECL((*))) 0 } /* array terminator */
6713 num_menu_selections = SIZE(menu_selections) - 1;
6714 if (num_menu_selections > 0) {
6715 menu_item *pick_list;
6717 win = create_nhwindow(NHW_MENU);
6719 for (k = 0; k < num_menu_selections; ++k) {
6721 add_menu(win, NO_GLYPH, &any, item++, 0, ATR_NONE,
6722 menu_selections[k].menutext, MENU_UNSELECTED);
6724 end_menu(win, "Which port debugging feature?");
6725 n = select_menu(win, PICK_ONE, &pick_list);
6726 destroy_nhwindow(win);
6728 n = pick_list[0].item.a_int - 1;
6729 free((genericptr_t) pick_list);
6730 /* execute the function */
6731 (*menu_selections[n].fn)();
6734 pline("No port-specific debug capability defined.");
6737 #endif /*PORT_DEBUG*/
6740 * Parameter validator for generic yes/no function to prevent
6741 * the core from sending too long a prompt string to the
6742 * window port causing a buffer overflow there.
6745 yn_function(query, resp, def)
6746 const char *query, *resp;
6749 char res, qbuf[QBUFSZ];
6751 extern unsigned saved_pline_index; /* pline.c */
6752 unsigned idx = saved_pline_index;
6753 /* buffer to hold query+space+formatted_single_char_response */
6754 char dumplog_buf[QBUFSZ + 1 + 15]; /* [QBUFSZ+1+7] should suffice */
6757 iflags.last_msg = PLNMSG_UNKNOWN; /* most recent pline is clobbered */
6759 /* maximum acceptable length is QBUFSZ-1 */
6760 if (strlen(query) >= QBUFSZ) {
6761 /* caller shouldn't have passed anything this long */
6762 paniclog("Query truncated: ", query);
6763 (void) strncpy(qbuf, query, QBUFSZ - 1 - 3);
6764 Strcpy(&qbuf[QBUFSZ - 1 - 3], "...");
6767 res = (*windowprocs.win_yn_function)(query, resp, def);
6769 if (idx == saved_pline_index) {
6770 /* when idx is still the same as saved_pline_index, the interface
6771 didn't put the prompt into saved_plines[]; we put a simplified
6772 version in there now (without response choices or default) */
6773 Sprintf(dumplog_buf, "%s ", query);
6774 (void) key2txt((uchar) res, eos(dumplog_buf));
6775 dumplogmsg(dumplog_buf);
6781 /* for paranoid_confirm:quit,die,attack prompting */
6783 paranoid_query(be_paranoid, prompt)
6784 boolean be_paranoid;
6787 boolean confirmed_ok;
6789 /* when paranoid, player must respond with "yes" rather than just 'y'
6790 to give the go-ahead for this query; default is "no" unless the
6791 ParanoidConfirm flag is set in which case there's no default */
6793 char qbuf[QBUFSZ], ans[BUFSZ] = DUMMY;
6794 const char *promptprefix = "", *responsetype = ParanoidConfirm
6797 int trylimit = 6; /* 1 normal, 5 more with "Yes or No:" prefix */
6799 /* in addition to being paranoid about this particular
6800 query, we might be even more paranoid about all paranoia
6801 responses (ie, ParanoidConfirm is set) in which case we
6802 require "no" to reject in addition to "yes" to confirm
6803 (except we won't loop if response is ESC; it means no) */
6805 Sprintf(qbuf, "%s%s %s", promptprefix, prompt, responsetype);
6807 (void) mungspaces(ans);
6808 confirmed_ok = !strcmpi(ans, "yes");
6809 if (confirmed_ok || *ans == '\033')
6811 promptprefix = "\"Yes\" or \"No\": ";
6812 } while (ParanoidConfirm && strcmpi(ans, "no") && --trylimit);
6814 confirmed_ok = (yn(prompt) == 'y');
6816 return confirmed_ok;
6823 /* Does current window system support suspend? */
6824 if ((*windowprocs.win_can_suspend)()) {
6825 /* NB: SYSCF SHELLERS handled in port code. */
6830 Norep("Suspend command not available.");
6832 Norep("
\92\86\92f
\83R
\83}
\83\93\83h
\82Í
\97\98\97p
\82Å
\82«
\82Ü
\82¹
\82ñ
\81D");