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-2019 */
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;
1601 absamt = abs(incamt);
1602 /* Protection amount is typically larger than damage or to-hit;
1603 reduce magnitude by a third in order to stretch modifier ranges
1604 (small:1..5, moderate:6..10, large:11..19, huge:20+) */
1606 if (!strcmp(inctyp, "defense"))
1608 if (!strcmp(inctyp, "
\96h
\8cä"))
1610 absamt = (absamt * 2) / 3;
1616 modif = "
\8bÍ
\82©
\82È";
1617 else if (absamt <= 6)
1621 modif = "
\92\86\92ö
\93x
\82Ì";
1622 else if (absamt <= 12)
1626 modif = "
\91å
\82«
\82È";
1631 modif = "
\8b
\91å
\82È";
1634 modif = !incamt ? "no" : an(modif); /* ("no" case shouldn't happen) */
1637 bonus = (incamt >= 0) ? "bonus" : "penalty";
1639 bonus = (incamt > 0) ? "
\83{
\81[
\83i
\83X" : "
\83y
\83i
\83\8b\83e
\83B";
1640 /* "bonus <foo>" (to hit) vs "<bar> bonus" (damage, defense) */
1642 invrt = strcmp(inctyp, "to hit") ? 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;
2701 static NEARDATA const char if_surroundings_permitted[] =
2702 " if surroundings permitted";
2710 putstr(en_win, 0, "");
2712 putstr(en_win, 0, final ? "Final Attributes:" : "Current Attributes:");
2714 putstr(en_win, 0, final ? "
\8dÅ
\8fI
\91®
\90«:" : "
\8c»
\8dÝ
\82Ì
\91®
\90«:");
2716 if (u.uevent.uhand_of_elbereth) {
2718 static const char *const hofe_titles[3] = { "the Hand of Elbereth",
2719 "the Envoy of Balance",
2720 "the Glory of Arioch" };
2722 static const char *const hofe_titles[3] = { "
\83G
\83\8b\83x
\83\8c\83X
\82Ì
\8cä
\8eè",
2723 "
\92²
\98a
\82Ì
\8eg
\8eÒ",
2724 "
\83A
\83\8a\83I
\83b
\83`
\82Ì
\96¼
\97_" };
2726 you_are(hofe_titles[u.uevent.uhand_of_elbereth - 1], "");
2730 Sprintf(buf, "%s", piousness(TRUE, "aligned"));
2732 Sprintf(buf, "%s", piousness(TRUE, "
\90M
\8bÂ
\90S"));
2733 if (u.ualign.record >= 0)
2740 Sprintf(buf, " %d", u.ualign.record);
2741 enl_msg("Your alignment ", "is", "was", buf, "");
2743 Sprintf(buf, "
\82 \82È
\82½
\82Ì
\91®
\90«
\92l
\82Í%d", u.ualign.record);
2744 enl_msg(buf, "
\82Å
\82 \82é", "
\82¾
\82Á
\82½", "", "");
2748 /*** Resistances to troubles ***/
2751 you_are("invulnerable", from_what(INVULNERABLE));
2753 you_are("
\95s
\8e\80\90g", from_what(INVULNERABLE));
2756 you_are("magic-protected", from_what(ANTIMAGIC));
2758 you_have("
\96\82\96@
\96h
\8cä
\94\
\97Í", from_what(ANTIMAGIC));
2759 if (Fire_resistance)
2761 you_are("fire resistant", from_what(FIRE_RES));
2763 you_have("
\89Î
\82Ö
\82Ì
\91Ï
\90«", from_what(FIRE_RES));
2764 if (Cold_resistance)
2766 you_are("cold resistant", from_what(COLD_RES));
2768 you_have("
\8a¦
\82³
\82Ö
\82Ì
\91Ï
\90«", from_what(COLD_RES));
2769 if (Sleep_resistance)
2771 you_are("sleep resistant", from_what(SLEEP_RES));
2773 you_have("
\96°
\82è
\82Ö
\82Ì
\91Ï
\90«", from_what(SLEEP_RES));
2774 if (Disint_resistance)
2776 you_are("disintegration-resistant", from_what(DISINT_RES));
2778 you_have("
\95²
\8dÓ
\82Ö
\82Ì
\91Ï
\90«", from_what(DISINT_RES));
2779 if (Shock_resistance)
2781 you_are("shock resistant", from_what(SHOCK_RES));
2783 you_have("
\93d
\8c\82\82Ö
\82Ì
\91Ï
\90«", from_what(SHOCK_RES));
2784 if (Poison_resistance)
2786 you_are("poison resistant", from_what(POISON_RES));
2788 you_have("
\93Å
\82Ö
\82Ì
\91Ï
\90«", from_what(POISON_RES));
2789 if (Acid_resistance)
2791 you_are("acid resistant", from_what(ACID_RES));
2793 you_have("
\8e_
\82Ö
\82Ì
\91Ï
\90«", from_what(ACID_RES));
2794 if (Drain_resistance)
2796 you_are("level-drain resistant", from_what(DRAIN_RES));
2798 you_have("
\83\8c\83x
\83\8b\83_
\83E
\83\93\82Ö
\82Ì
\91Ï
\90«", from_what(DRAIN_RES));
2799 if (Sick_resistance)
2801 you_are("immune to sickness", from_what(SICK_RES));
2803 you_have("
\95a
\8bC
\82É
\91Î
\82·
\82é
\96Æ
\89u", from_what(SICK_RES));
2804 if (Stone_resistance)
2806 you_are("petrification resistant", from_what(STONE_RES));
2808 you_have("
\90Î
\89»
\82Ö
\82Ì
\91Ï
\90«", from_what(STONE_RES));
2809 if (Halluc_resistance)
2811 enl_msg(You_, "resist", "resisted", " hallucinations",
2812 from_what(HALLUC_RES));
2814 you_have("
\8c¶
\8ao
\82Ö
\82Ì
\91Ï
\90«", from_what(HALLUC_RES));
2818 you_can("recognize detrimental food", "");
2820 you_can("
\97L
\8aQ
\82È
\90H
\97¿
\82ð
\8e¯
\95Ê", "");
2822 /*** Vision and senses ***/
2823 if (!Blind && (Blinded || !haseyes(youmonst.data)))
2824 you_can("see", from_what(-BLINDED)); /* Eyes of the Overworld */
2825 if (See_invisible) {
2828 enl_msg(You_, "see", "saw", " invisible", from_what(SEE_INVIS));
2830 enl_msg("
\82 \82È
\82½
\82Í
\93§
\96¾
\82È
\82à
\82Ì
\82ð
\8c©
\82ç
\82ê", "
\82é", "
\82½", "", from_what(SEE_INVIS));
2833 enl_msg(You_, "will see", "would have seen",
2834 " invisible when not blind", from_what(SEE_INVIS));
2836 enl_msg(You_, "
\82é", "
\82½",
2837 "
\96Ó
\96Ú
\82Å
\82È
\82¢
\82Æ
\82«
\82É
\82Í
\93§
\96¾
\82È
\82à
\82Ì
\82ð
\8c©
\82ç
\82ê", from_what(SEE_INVIS));
2842 you_are("telepathic", from_what(TELEPAT));
2844 you_have("
\83e
\83\8c\83p
\83V
\81[", from_what(TELEPAT));
2847 you_are("warned", from_what(WARNING));
2849 you_have("
\8cx
\89ú
\94\
\97Í", from_what(WARNING));
2850 if (Warn_of_mon && context.warntype.obj) {
2852 Sprintf(buf, "aware of the presence of %s",
2853 (context.warntype.obj & M2_ORC) ? "orcs"
2854 : (context.warntype.obj & M2_ELF) ? "elves"
2855 : (context.warntype.obj & M2_DEMON) ? "demons" : something);
2856 you_are(buf, from_what(WARN_OF_MON));
2858 Sprintf(buf, "%s
\82Ì
\91¶
\8dÝ
\82ð
\8a´
\82¶
\82é
\94\
\97Í",
2859 (context.warntype.obj & M2_ORC) ? "
\83I
\81[
\83N"
2860 : (context.warntype.obj & M2_ELF) ? "
\83G
\83\8b\83t"
2861 : (context.warntype.obj & M2_DEMON) ? "
\88«
\96\82" : something);
2865 if (Warn_of_mon && context.warntype.polyd) {
2867 Sprintf(buf, "aware of the presence of %s",
2868 ((context.warntype.polyd & (M2_HUMAN | M2_ELF))
2869 == (M2_HUMAN | M2_ELF))
2870 ? "humans and elves"
2871 : (context.warntype.polyd & M2_HUMAN)
2873 : (context.warntype.polyd & M2_ELF)
2875 : (context.warntype.polyd & M2_ORC)
2877 : (context.warntype.polyd & M2_DEMON)
2879 : "certain monsters");
2882 Sprintf(buf, "%s
\82Ì
\91¶
\8dÝ
\82ð
\8a´
\82¶
\82é
\94\
\97Í",
2883 ((context.warntype.polyd & (M2_HUMAN | M2_ELF))
2884 == (M2_HUMAN | M2_ELF))
2885 ? "
\90l
\8aÔ
\82Æ
\83G
\83\8b\83t"
2886 : (context.warntype.polyd & M2_HUMAN)
2888 : (context.warntype.polyd & M2_ELF)
2890 : (context.warntype.polyd & M2_ORC)
2892 : (context.warntype.polyd & M2_DEMON)
2894 : "
\82 \82é
\8eí
\82Ì
\89ö
\95¨");
2898 if (Warn_of_mon && context.warntype.speciesidx >= LOW_PM) {
2900 Sprintf(buf, "aware of the presence of %s",
2901 makeplural(mons[context.warntype.speciesidx].mname));
2902 you_are(buf, from_what(WARN_OF_MON));
2904 Sprintf(buf, "%s
\82Ì
\91¶
\8dÝ
\82ð
\8a´
\82¶
\82é
\94\
\97Í",
2905 mons[context.warntype.speciesidx].mname);
2906 you_have(buf, from_what(WARN_OF_MON));
2911 you_are("warned of undead", from_what(WARN_UNDEAD));
2913 you_have("
\95s
\8e\80\82Ì
\90¶
\95¨
\82Ö
\82Ì
\8cx
\89ú
\94\
\97Í", from_what(WARN_UNDEAD));
2916 you_have("automatic searching", from_what(SEARCHING));
2918 you_have("
\92T
\8d¸
\94\
\97Í", from_what(SEARCHING));
2921 you_are("clairvoyant", from_what(CLAIRVOYANT));
2923 you_have("
\90ç
\97¢
\8aá
\94\
\97Í", from_what(CLAIRVOYANT));
2924 else if ((HClairvoyant || EClairvoyant) && BClairvoyant) {
2925 Strcpy(buf, from_what(-CLAIRVOYANT));
2927 if (!strncmp(buf, " because of ", 12))
2928 /* overwrite substring; strncpy doesn't add terminator */
2929 (void) strncpy(buf, " if not for ", 12);
2930 enl_msg(You_, "could be", "could have been", " clairvoyant", buf);
2932 /*JP:
\81u
\81c
\82É
\82æ
\82Á
\82Ä
\81v*/
2933 if (!strncmp(buf, "
\82É
\82æ
\82Á
\82Ä", 8))
2934 /*JP:
\81u
\81c
\82ª
\82È
\82¯
\82ê
\82Î
\81v
\82É
\8f\91\82«
\8a·
\82¦
\82é*/
2935 strcpy(eos(buf) - 8, "
\82ª
\82È
\82¯
\82ê
\82Î");
2936 you_have("
\90ç
\97¢
\8aá
\94\
\97Í", buf);
2941 you_have("infravision", from_what(INFRAVISION));
2943 you_have("
\90Ô
\8aO
\90ü
\82ª
\8c©
\82¦
\82é
\8e\8b\8ao", from_what(INFRAVISION));
2944 if (Detect_monsters)
2946 you_are("sensing the presence of monsters", "");
2948 you_have("
\89ö
\95¨
\82ð
\92T
\82·
\94\
\97Í", "");
2951 you_are("going to confuse monsters", "");
2953 you_have("
\89ö
\95¨
\82ð
\8d¬
\97\90\82³
\82¹
\82é
\94\
\97Í", "");
2955 /*** Appearance and behavior ***/
2959 if (uleft && uleft->otyp == RIN_ADORNMENT)
2960 adorn += uleft->spe;
2961 if (uright && uright->otyp == RIN_ADORNMENT)
2962 adorn += uright->spe;
2963 /* the sum might be 0 (+0 ring or two which negate each other);
2964 that yields "you are charismatic" (which isn't pointless
2965 because it potentially impacts seduction attacks) */
2967 Sprintf(buf, "%scharismatic",
2968 (adorn > 0) ? "more " : (adorn < 0) ? "less " : "");
2969 you_are(buf, from_what(ADORNED));
2971 Sprintf(buf, "
\96£
\97Í%s
\82Ä",
2972 (adorn > 0) ? "
\82ª
\91\9d\89Á
\82µ" : (adorn < 0) ? "
\82ª
\8c¸
\8f
\82µ" : "
\93I
\82É
\82È
\82Á");
2973 enl_msg(You_, "
\82Ä
\82¢
\82é", "
\82½", buf, "");
2978 you_are("invisible", from_what(INVIS));
2980 you_are("
\93§
\96¾", from_what(INVIS));
2983 you_are("invisible to others", from_what(INVIS));
2985 you_are("
\91¼
\90l
\82É
\91Î
\82µ
\82Ä
\93§
\96¾", from_what(INVIS));
2986 /* ordinarily "visible" is redundant; this is a special case for
2987 the situation when invisibility would be an expected attribute */
2988 else if ((HInvis || EInvis) && BInvis)
2990 you_are("visible", from_what(-INVIS));
2992 you_are("
\95s
\93§
\96¾", from_what(-INVIS));
2995 you_are("displaced", from_what(DISPLACED));
2997 you_have("
\8c¶
\89e
\94\
\97Í", from_what(DISPLACED));
3000 you_are("stealthy", from_what(STEALTH));
3002 you_have("
\90l
\96Ú
\82ð
\93\90\82Þ
\94\
\97Í", from_what(STEALTH));
3003 if (Aggravate_monster)
3005 enl_msg("You aggravate", "", "d", " monsters",
3006 from_what(AGGRAVATE_MONSTER));
3008 you_are_ing("
\94½
\8a´
\82ð
\82©
\82Á
\82Ä", from_what(AGGRAVATE_MONSTER));
3012 enl_msg("You cause", "", "d", " conflict", from_what(CONFLICT));
3014 you_are_ing("
\93¬
\91\88\82ð
\88ø
\82«
\8bN
\82±
\82µ
\82Ä", from_what(CONFLICT));
3016 /*** Transportation ***/
3019 you_can("jump", from_what(JUMPING));
3021 you_can("
\92µ
\96ô
\82·
\82é
\82±
\82Æ
\82ª", from_what(JUMPING));
3024 you_can("teleport", from_what(TELEPORT));
3026 you_can("
\8fu
\8aÔ
\88Ú
\93®
\82ª", from_what(TELEPORT));
3027 if (Teleport_control)
3029 you_have("teleport control", from_what(TELEPORT_CONTROL));
3031 you_have("
\8fu
\8aÔ
\88Ú
\93®
\82Ì
\90§
\8cä
\94\
\97Í", from_what(TELEPORT_CONTROL));
3032 /* actively levitating handled earlier as a status condition */
3033 if (BLevitation) { /* levitation is blocked */
3034 long save_BLev = BLevitation;
3039 enl_msg(You_, "would levitate", "would have levitated",
3040 if_surroundings_permitted, "");
3042 you_are("
\8fó
\8bµ
\82ª
\8b\96\82¹
\82Î
\95\82\97V
\82·
\82é
\8fó
\91Ô", "");
3044 BLevitation = save_BLev;
3046 /* actively flying handled earlier as a status condition */
3047 if (BFlying) { /* flight is blocked */
3048 long save_BFly = BFlying;
3053 enl_msg(You_, "would fly", "would have flown",
3055 ? "if you weren't levitating"
3056 : (save_BFly == FROMOUTSIDE)
3057 ? if_surroundings_permitted
3058 /* both surroundings and [latent] levitation */
3059 : " if circumstances permitted",
3062 enl_msg(You_, "
\82Å
\82«
\82é", "
\82Å
\82«
\82½",
3063 "
\94ò
\82Ô
\82±
\82Æ
\82ª",
3065 ? "
\95\82\97V
\82µ
\82Ä
\82¢
\82È
\82¯
\82ê
\82Î"
3066 : (save_BFly == FROMOUTSIDE)
3067 ? "
\8fó
\8bµ
\82ª
\8b\96\82¹
\82Î"
3068 /* both surroundings and [latent] levitation */
3069 : "
\8e\96\8fî
\82ª
\8b\96\82¹
\82Î");
3071 BFlying = save_BFly;
3073 /* actively walking on water handled earlier as a status condition */
3074 if (Wwalking && !walking_on_water())
3076 you_can("walk on water", from_what(WWALKING));
3078 you_can("
\90\85\82Ì
\8fã
\82ð
\95à
\82
\82±
\82Æ
\82ª", from_what(WWALKING));
3079 /* actively swimming (in water but not under it) handled earlier */
3080 if (Swimming && (Underwater || !u.uinwater))
3082 you_can("swim", from_what(SWIMMING));
3084 you_can("
\89j
\82®
\82±
\82Æ
\82ª", from_what(SWIMMING));
3087 you_can("survive without air", from_what(MAGICAL_BREATHING));
3089 you_can("
\8bó
\8bC
\82È
\82µ
\82Å
\90¶
\82«
\89\84\82Ñ
\82é
\82±
\82Æ
\82ª", from_what(MAGICAL_BREATHING));
3090 else if (Amphibious)
3092 you_can("breathe water", from_what(MAGICAL_BREATHING));
3094 you_can("
\90\85\92\86\82Å
\8cÄ
\8bz
\82ª", from_what(MAGICAL_BREATHING));
3097 you_can("walk through walls", from_what(PASSES_WALLS));
3099 you_can("
\95Ç
\82ð
\92Ê
\82è
\94²
\82¯
\82é
\82±
\82Æ
\82ª", from_what(PASSES_WALLS));
3101 /*** Physical attributes ***/
3104 enl_msg("You regenerate", "", "d", "", from_what(REGENERATION));
3106 you_have("
\8dÄ
\90¶
\94\
\97Í", from_what(REGENERATION));
3109 you_have("slower digestion", from_what(SLOW_DIGESTION));
3111 enl_msg("
\90H
\95¨
\82Ì
\8fÁ
\89»
\82ª
\92x", "
\82¢", "
\82©
\82Á
\82½", "", from_what(SLOW_DIGESTION));
3114 you_have(enlght_combatinc("to hit", u.uhitinc, final, buf), "");
3116 you_have(enlght_combatinc("
\96½
\92\86\97¦", u.uhitinc, final, buf), "");
3119 you_have(enlght_combatinc("damage", u.udaminc, final, buf), "");
3121 you_have(enlght_combatinc("
\83_
\83\81\81[
\83W", u.udaminc, final, buf), "");
3122 if (u.uspellprot || Protection) {
3125 if (uleft && uleft->otyp == RIN_PROTECTION)
3127 if (uright && uright->otyp == RIN_PROTECTION)
3128 prot += uright->spe;
3129 if (HProtection & INTRINSIC)
3131 prot += u.uspellprot;
3134 you_have(enlght_combatinc("defense", prot, final, buf), "");
3136 you_have(enlght_combatinc("
\96h
\8cä", prot, final, buf), "");
3138 if ((armpro = magic_negation(&youmonst)) > 0) {
3139 /* magic cancellation factor, conferred by worn armor */
3140 static const char *const mc_types[] = {
3142 "" /*ordinary*/, "warded", "guarded", "protected",
3144 "" /*ordinary*/, "
\89q
\82ç
\82ê
\82Ä", "
\8cì
\82ç
\82ê
\82Ä", "
\8eç
\82ç
\82ê
\82Ä",
3148 if (armpro >= SIZE(mc_types))
3149 armpro = SIZE(mc_types) - 1;
3151 you_are(mc_types[armpro], "");
3153 you_are_ing(mc_types[armpro], "");
3155 if (Half_physical_damage)
3156 enlght_halfdmg(HALF_PHDAM, final);
3157 if (Half_spell_damage)
3158 enlght_halfdmg(HALF_SPDAM, final);
3159 /* polymorph and other shape change */
3160 if (Protection_from_shape_changers)
3162 you_are("protected from shape changers",
3163 from_what(PROT_FROM_SHAPE_CHANGERS));
3165 you_have("
\95Ï
\89»
\89ö
\95¨
\82Ö
\82Ì
\91Ï
\90«", from_what(PROT_FROM_SHAPE_CHANGERS));
3168 const char *what = 0;
3170 if (!Upolyd) /* Upolyd handled below after current form */
3172 you_can("not change from your current form",
3174 you_are("
\8c»
\8dÝ
\82Ì
\8ep
\82©
\82ç
\95Ï
\89»
\82Å
\82«
\82È
\82¢
\8fó
\91Ô",
3175 from_what(UNCHANGING));
3176 /* blocked shape changes */
3179 what = !final ? "polymorph" : "have polymorphed";
3181 what = "
\95Ï
\89»
\82µ
\82Ä";
3182 else if (u.ulycn >= LOW_PM)
3184 what = !final ? "change shape" : "have changed shape";
3186 what = "
\8ep
\82ð
\95Ï
\82¦
\82Ä";
3189 Sprintf(buf, "would %s periodically", what);
3190 /* omit from_what(UNCHANGING); too verbose */
3191 enl_msg(You_, buf, buf, " if not locked into your current form",
3194 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);
3195 you_are_ing(buf, "");
3198 } else if (Polymorph) {
3200 you_are("polymorphing periodically", from_what(POLYMORPH));
3202 you_are("
\92è
\8aú
\93I
\82É
\95Ï
\89»
\82µ
\82Ä", from_what(POLYMORPH));
3204 if (Polymorph_control)
3206 you_have("polymorph control", from_what(POLYMORPH_CONTROL));
3208 you_have("
\95Ï
\89»
\82Ì
\90§
\8cä
\94\
\97Í", from_what(POLYMORPH_CONTROL));
3209 if (Upolyd && u.umonnum != u.ulycn) {
3210 /* foreign shape (except were-form which is handled below) */
3212 Sprintf(buf, "polymorphed into %s", an(youmonst.data->mname));
3214 Sprintf(buf, "%s
\82É
\95Ï
\89»
\82µ
\82Ä", youmonst.data->mname);
3216 Sprintf(eos(buf), " (%d)", u.mtimedone);
3219 if (lays_eggs(youmonst.data) && flags.female) /* Upolyd */
3221 you_can("lay eggs", "");
3223 you_can("
\97\91\82ð
\8eY
\82Þ
\82±
\82Æ
\82ª", "");
3224 if (u.ulycn >= LOW_PM) {
3226 /* "you are a werecreature [in beast form]" */
3227 Strcpy(buf, an(mons[u.ulycn].mname));
3228 if (u.umonnum == u.ulycn) {
3229 Strcat(buf, " in beast form");
3231 Sprintf(eos(buf), " (%d)", u.mtimedone);
3234 /*JP:
\81u
\82 \82È
\82½
\82Í[
\8fb
\82Ì
\8ep
\82Ì]
\81\9b\81\9b\90l
\8aÔ
\82Å
\82 \82é
\81v*/
3236 if (u.umonnum == u.ulycn) {
3237 Strcpy(buf, "
\8fb
\82Ì
\8ep
\82Ì");
3239 Sprintf(eos(buf), " (%d)", u.mtimedone);
3241 Strcat(buf, mons[u.ulycn].mname);
3245 if (Unchanging && Upolyd) /* !Upolyd handled above */
3247 you_can("not change from your current form", from_what(UNCHANGING));
3249 enl_msg("
\8d¡
\82Ì
\8ep
\82©
\82ç
\95Ï
\89»
\82·
\82é
\82±
\82Æ
\82ª
\82Å
\82«
\82È", "
\82¢", "
\82©
\82Á
\82½", "", from_what(UNCHANGING));
3252 you_are("harmed by silver", "");
3254 enl_msg("
\82 \82È
\82½
\82Í
\8bâ
\82É
\8eã", "
\82¢", "
\82©
\82Á
\82½", "", "");
3255 /* movement and non-armor-based protection */
3258 you_are(Very_fast ? "very fast" : "fast", from_what(FAST));
3260 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));
3263 you_have("reflection", from_what(REFLECTING));
3265 you_have("
\94½
\8eË
\94\
\97Í", from_what(REFLECTING));
3268 you_have("free action", from_what(FREE_ACTION));
3270 you_have("
\8dS
\91©
\82³
\82ê
\82È
\82¢
\94\
\97Í", from_what(FREE_ACTION));
3273 you_have("fixed abilities", from_what(FIXED_ABIL));
3275 enl_msg("
\94\
\97Í
\82ª
\95Ï
\89»
\82µ
\82È", "
\82¢", "
\82©
\82Á
\82½", "", from_what(FIXED_ABIL));
3278 enl_msg("Your life ", "will be", "would have been", " saved", "");
3280 enl_msg("
\82 \82È
\82½
\82Ì
\90¶
\96½
\82Í
\95Û
\91¶
\82³
\82ê
\82Ä", iru, ita, "", "");
3282 /*** Miscellany ***/
3284 ltmp = abs((int) Luck);
3286 Sprintf(buf, "%s%slucky",
3287 ltmp >= 10 ? "extremely " : ltmp >= 5 ? "very " : "",
3288 Luck < 0 ? "un" : "");
3290 Sprintf(buf, "%s%s",
3291 ltmp >= 10 ? "
\96Ò
\97ó
\82É" : ltmp >= 5 ? "
\82Æ
\82Ä
\82à" : "",
3292 Luck < 0 ? "
\95s
\8dK" : "
\8dK
\95\9f");
3295 Sprintf(eos(buf), " (%d)", Luck);
3299 enl_msg("Your luck ", "is", "was", " zero", "");
3301 enl_msg("
\82 \82È
\82½
\82Ì
\89^
\82Í
\83[
\83\8d", "
\82Å
\82 \82é", "
\82¾
\82Á
\82½", "", "");
3304 you_have("extra luck", "");
3306 you_have("
\82³
\82ç
\82È
\82é
\8dK
\89^", "");
3307 else if (u.moreluck < 0)
3309 you_have("reduced luck", "");
3311 you_have("
\82³
\82ç
\82È
\82é
\95s
\89^", "");
3312 if (carrying(LUCKSTONE) || stone_luck(TRUE)) {
3313 ltmp = stone_luck(0);
3316 enl_msg("Bad luck ", "does", "did", " not time out for you", "");
3318 enl_msg("
\95s
\89^
\82Í
\8e\9e\8aÔ
\90Ø
\82ê
\82É
\82È
\82ç
\82È", "
\82¢", "
\82©
\82Á
\82½", "", "");
3321 enl_msg("Good luck ", "does", "did", " not time out for you", "");
3323 enl_msg("
\8dK
\89^
\82Í
\8e\9e\8aÔ
\90Ø
\82ê
\82É
\82È
\82ç
\82È", "
\82¢", "
\82©
\82Á
\82½", "", "");
3328 Sprintf(buf, " %sangry with you",
3329 u.ugangr > 6 ? "extremely " : u.ugangr > 3 ? "very " : "");
3331 Sprintf(buf, "%s
\82Í%s
\93{
\82Á
\82Ä%s", u_gname(),
3332 u.ugangr > 6 ? "
\96Ò
\97ó
\82É" : u.ugangr > 3 ? "
\82Æ
\82Ä
\82à" : "", final ? ita : iru);
3335 Sprintf(eos(buf), " (%d)", u.ugangr);
3337 enl_msg(u_gname(), " is", " was", buf, "");
3339 enl_msg(buf, "", "", "", "");
3343 * We need to suppress this when the game is over, because death
3344 * can change the value calculated by can_pray(), potentially
3345 * resulting in a false claim that you could have prayed safely.
3350 /* "can [not] safely pray" vs "could [not] have safely prayed" */
3351 Sprintf(buf, "%s%ssafely pray%s", can_pray(FALSE) ? "" : "not ",
3352 final ? "have " : "", final ? "ed" : "");
3354 Sprintf(buf, "%ssafely pray", can_pray(FALSE) ? "" : "not ");
3357 Sprintf(eos(buf), " (%d)", u.ublesscnt);
3360 Sprintf(buf, "
\82 \82È
\82½
\82Í
\88À
\91S
\82É
\8bF
\82é
\82±
\82Æ
\82ª");
3361 Strcat(buf, can_pray(FALSE) ? can : "
\82Å
\82«
\82È
\82¢");
3363 Sprintf(eos(buf), " (%d)", u.ublesscnt);
3364 enl_msg(buf, "", "", "", "");
3370 /* named fruit debugging (doesn't really belong here...); to enable,
3371 include 'fruit' in DEBUGFILES list (even though it isn't a file...) */
3372 if (wizard && explicitdebug("fruit")) {
3375 reorder_fruit(TRUE); /* sort by fruit index, from low to high;
3376 * this modifies the ffruit chain, so could
3377 * possibly mask or even introduce a problem,
3378 * but it does useful sanity checking */
3379 for (f = ffruit; f; f = f->nextf) {
3381 Sprintf(buf, "Fruit #%d ", f->fid);
3383 Sprintf(buf, "fruit $%d
\82Í", f->fid);
3385 enl_msg(buf, "is ", "was ", f->fname, "");
3387 enl_msg(buf, "
\82¾", "
\82¾
\82Á
\82½", f->fname, "");
3390 enl_msg("The current fruit ", "is ", "was ", pl_fruit, "");
3392 enl_msg("
\8c»
\8dÝ
\82Ì fruit
\82Í", "
\82¾", "
\82¾
\82Á
\82½", pl_fruit, "");
3393 Sprintf(buf, "%d", flags.made_fruit);
3395 enl_msg("The made fruit flag ", "is ", "was ", buf, "");
3397 enl_msg("made fruit flag
\82Í", "
\82¾", "
\82¾
\82Á
\82½", buf, "");
3405 if (final < 2) { /* still in progress, or quit/escaped/ascended */
3407 p = "survived after being killed ";
3409 p = "
\8e\80\82ñ
\82¾
\8cã
\95\9c\8a\88\82µ
\82Ä
\82¢
\82½";
3410 switch (u.umortality) {
3413 p = !final ? (char *) 0 : "survived";
3415 p = !final ? (char *)0 : "
\90¶
\82«
\89\84\82Ñ
\82½";
3419 Strcpy(buf, "once");
3421 Strcpy(buf, "
\88ê
\93x");
3425 Strcpy(buf, "twice");
3427 Strcpy(buf, "
\93ñ
\93x");
3431 Strcpy(buf, "thrice");
3433 Strcpy(buf, "
\8eO
\93x");
3437 Sprintf(buf, "%d times", u.umortality);
3439 Sprintf(buf, "%d
\89ñ", u.umortality);
3442 } else { /* game ended in character's death */
3446 p = "
\8e\80\82ñ
\82Å
\82¢
\82é";
3447 switch (u.umortality) {
3449 impossible("dead without dying?");
3451 break; /* just "are dead" */
3454 Sprintf(buf, " (%d%s time!)", u.umortality,
3455 ordin(u.umortality));
3457 Sprintf(buf, "(%d
\89ñ
\81I)", u.umortality);
3464 enl_msg(You_, "have been killed ", p, buf, "");
3466 enl_msg(You_, "
\8e\80\82ñ
\82Å
\82¢
\82é", p, buf, "");
3470 #if 0 /* no longer used */
3471 STATIC_DCL boolean NDECL(minimal_enlightenment);
3474 * Courtesy function for non-debug, non-explorer mode players
3475 * to help refresh them about who/what they are.
3476 * Returns FALSE if menu cancelled (dismissed with ESC), TRUE otherwise.
3479 minimal_enlightenment()
3482 menu_item *selected;
3485 char buf[BUFSZ], buf2[BUFSZ];
3486 static const char untabbed_fmtstr[] = "%-15s: %-12s";
3487 static const char untabbed_deity_fmtstr[] = "%-17s%s";
3488 static const char tabbed_fmtstr[] = "%s:\t%-12s";
3489 static const char tabbed_deity_fmtstr[] = "%s\t%s";
3490 static const char *fmtstr;
3491 static const char *deity_fmtstr;
3493 fmtstr = iflags.menu_tab_sep ? tabbed_fmtstr : untabbed_fmtstr;
3494 deity_fmtstr = iflags.menu_tab_sep ? tabbed_deity_fmtstr
3495 : untabbed_deity_fmtstr;
3497 buf[0] = buf2[0] = '\0';
3498 tmpwin = create_nhwindow(NHW_MENU);
3500 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
3506 /* Starting name, race, role, gender */
3508 Sprintf(buf, fmtstr, "name", plname);
3510 Sprintf(buf, fmtstr, "
\96¼
\91O", plname);
3511 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3513 Sprintf(buf, fmtstr, "race", urace.noun);
3515 Sprintf(buf, fmtstr, "
\8eí
\91°", urace.noun);
3516 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3518 Sprintf(buf, fmtstr, "role",
3520 Sprintf(buf, fmtstr, "
\90E
\8bÆ",
3521 (flags.initgend && urole.name.f) ? urole.name.f : urole.name.m);
3522 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3524 Sprintf(buf, fmtstr, "gender", genders[flags.initgend].adj);
3526 Sprintf(buf, fmtstr, "
\90«
\95Ê", genders[flags.initgend].adj);
3527 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3529 /* Starting alignment */
3531 Sprintf(buf, fmtstr, "alignment", align_str(u.ualignbase[A_ORIGINAL]));
3533 Sprintf(buf, fmtstr, "
\91®
\90«", align_str(u.ualignbase[A_ORIGINAL]));
3534 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3536 /* Current name, race, role, gender */
3537 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", FALSE);
3538 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
3544 Sprintf(buf, fmtstr, "race", Upolyd ? youmonst.data->mname : urace.noun);
3546 Sprintf(buf, fmtstr, "
\8eí
\91°", Upolyd ? youmonst.data->mname : urace.noun);
3547 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3550 Sprintf(buf, fmtstr, "role (base)",
3552 Sprintf(buf, fmtstr, "
\90E
\8bÆ(
\8aî
\96{)",
3553 (u.mfemale && urole.name.f) ? urole.name.f
3555 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3558 Sprintf(buf, fmtstr, "role",
3560 Sprintf(buf, fmtstr, "
\90E
\8bÆ",
3561 (flags.female && urole.name.f) ? urole.name.f
3563 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3565 /* don't want poly_gender() here; it forces `2' for non-humanoids */
3566 genidx = is_neuter(youmonst.data) ? 2 : flags.female;
3568 Sprintf(buf, fmtstr, "gender", genders[genidx].adj);
3570 Sprintf(buf, fmtstr, "
\90«
\95Ê", genders[genidx].adj);
3571 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3572 if (Upolyd && (int) u.mfemale != genidx) {
3574 Sprintf(buf, fmtstr, "gender (base)", genders[u.mfemale].adj);
3576 Sprintf(buf, fmtstr, "
\90«
\95Ê(
\8aî
\96{)", genders[u.mfemale].adj);
3577 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3580 /* Current alignment */
3582 Sprintf(buf, fmtstr, "alignment", align_str(u.ualign.type));
3584 Sprintf(buf, fmtstr, "
\91®
\90«", align_str(u.ualign.type));
3585 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3588 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", FALSE);
3589 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
3595 Sprintf(buf2, deity_fmtstr, align_gname(A_CHAOTIC),
3596 (u.ualignbase[A_ORIGINAL] == u.ualign.type
3597 && u.ualign.type == A_CHAOTIC) ? " (s,c)"
3598 : (u.ualignbase[A_ORIGINAL] == A_CHAOTIC) ? " (s)"
3599 : (u.ualign.type == A_CHAOTIC) ? " (c)" : "");
3601 Sprintf(buf2, deity_fmtstr, align_gname(A_CHAOTIC),
3602 (u.ualignbase[A_ORIGINAL] == u.ualign.type
3603 && u.ualign.type == A_CHAOTIC) ? " (
\8f\89\81C
\8c»)"
3604 : (u.ualignbase[A_ORIGINAL] == A_CHAOTIC) ? " (
\8f\89)"
3605 : (u.ualign.type == A_CHAOTIC) ? " (
\8c»)" : "");
3608 Sprintf(buf, fmtstr, "Chaotic", buf2);
3610 Sprintf(buf, fmtstr, "
\8d¬
\93×", buf2);
3611 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3614 Sprintf(buf2, deity_fmtstr, align_gname(A_NEUTRAL),
3615 (u.ualignbase[A_ORIGINAL] == u.ualign.type
3616 && u.ualign.type == A_NEUTRAL) ? " (s,c)"
3617 : (u.ualignbase[A_ORIGINAL] == A_NEUTRAL) ? " (s)"
3618 : (u.ualign.type == A_NEUTRAL) ? " (c)" : "");
3620 Sprintf(buf2, deity_fmtstr, align_gname(A_NEUTRAL),
3621 (u.ualignbase[A_ORIGINAL] == u.ualign.type
3622 && u.ualign.type == A_NEUTRAL) ? " (
\8f\89\81C
\8c»)"
3623 : (u.ualignbase[A_ORIGINAL] == A_NEUTRAL) ? " (
\8f\89)"
3624 : (u.ualign.type == A_NEUTRAL) ? " (
\8c»)" : "");
3627 Sprintf(buf, fmtstr, "Neutral", buf2);
3629 Sprintf(buf, fmtstr, "
\92\86\97§", buf2);
3630 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3633 Sprintf(buf2, deity_fmtstr, align_gname(A_LAWFUL),
3634 (u.ualignbase[A_ORIGINAL] == u.ualign.type
3635 && u.ualign.type == A_LAWFUL) ? " (s,c)"
3636 : (u.ualignbase[A_ORIGINAL] == A_LAWFUL) ? " (s)"
3637 : (u.ualign.type == A_LAWFUL) ? " (c)" : "");
3639 Sprintf(buf2, deity_fmtstr, align_gname(A_LAWFUL),
3640 (u.ualignbase[A_ORIGINAL] == u.ualign.type
3641 && u.ualign.type == A_LAWFUL) ? " (
\8f\89\81C
\8c»)"
3642 : (u.ualignbase[A_ORIGINAL] == A_LAWFUL) ? " (
\8f\89)"
3643 : (u.ualign.type == A_LAWFUL) ? " (
\8c»)" : "");
3646 Sprintf(buf, fmtstr, "Lawful", buf2);
3648 Sprintf(buf, fmtstr, "
\92\81\8f\98", buf2);
3649 add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
3652 end_menu(tmpwin, "Base Attributes");
3654 end_menu(tmpwin, "
\8aî
\96{
\91®
\90«");
3655 n = select_menu(tmpwin, PICK_NONE, &selected);
3656 destroy_nhwindow(tmpwin);
3657 return (boolean) (n != -1);
3663 doattributes(VOID_ARGS)
3665 int mode = BASICENLIGHTENMENT;
3667 /* show more--as if final disclosure--for wizard and explore modes */
3668 if (wizard || discover)
3669 mode |= MAGICENLIGHTENMENT;
3671 enlightenment(mode, ENL_GAMEINPROGRESS);
3676 youhiding(via_enlghtmt, msgflag)
3677 boolean via_enlghtmt; /* englightment line vs topl message */
3678 int msgflag; /* for variant message phrasing */
3680 char *bp, buf[BUFSZ];
3683 Strcpy(buf, "hiding");
3685 Strcpy(buf, "
\89B
\82ê");
3686 if (youmonst.m_ap_type != M_AP_NOTHING) {
3687 /* mimic; hero is only able to mimic a strange object or gold
3688 or hallucinatory alternative to gold, so we skip the details
3689 for the hypothetical furniture and monster cases */
3690 #if 0 /*JP*//*
\8cã
\82ë
\82É
\89ñ
\82·*//* not used */
3691 bp = eos(strcpy(buf, "mimicking"));
3693 if (youmonst.m_ap_type == M_AP_OBJECT) {
3695 Sprintf(bp, " %s", an(simple_typename(youmonst.mappearance)));
3697 Strcpy(buf, simple_typename(youmonst.mappearance));
3698 } else if (youmonst.m_ap_type == M_AP_FURNITURE) {
3700 Strcpy(bp, " something");
3702 Strcpy(buf, "
\89½
\82©");
3703 } else if (youmonst.m_ap_type == M_AP_MONSTER) {
3705 Strcpy(bp, " someone");
3707 Strcpy(buf, "
\89½
\8eÒ
\82©");
3709 ; /* something unexpected; leave 'buf' as-is */
3711 #if 1 /*JP*//*
\82±
\82±
\82Å
\92Ç
\89Á*/
3712 Strcat(buf, "
\82Ì
\82Ó
\82è
\82ð
\82µ");
3714 } else if (u.uundetected) {
3715 bp = eos(buf); /* points past "hiding" */
3716 if (youmonst.data->mlet == S_EEL) {
3717 if (is_pool(u.ux, u.uy))
3719 Sprintf(bp, " in the %s", waterbody_name(u.ux, u.uy));
3721 Sprintf(bp, "%s
\82Ì
\92\86\82É", waterbody_name(u.ux, u.uy));
3722 } else if (hides_under(youmonst.data)) {
3723 struct obj *o = level.objects[u.ux][u.uy];
3727 Sprintf(bp, " underneath %s", ansimpleoname(o));
3729 Sprintf(bp, "%s
\82Ì
\89º
\82É", ansimpleoname(o));
3730 } else if (is_clinger(youmonst.data) || Flying) {
3731 /* Flying: 'lurker above' hides on ceiling but doesn't cling */
3733 Sprintf(bp, " on the %s", ceiling(u.ux, u.uy));
3735 Sprintf(bp, "%s
\82É", ceiling(u.ux, u.uy));
3737 /* on floor; is_hider() but otherwise not special: 'trapper' */
3738 if (u.utrap && u.utraptype == TT_PIT) {
3739 struct trap *t = t_at(u.ux, u.uy);
3742 Sprintf(bp, " in a %spit",
3743 (t && t->ttyp == SPIKED_PIT) ? "spiked " : "");
3745 Sprintf(bp, "%s
\97\8e\82µ
\8c\8a\82Ì
\92\86\82É",
3746 (t && t->ttyp == SPIKED_PIT) ? "
\83g
\83Q
\82¾
\82ç
\82¯
\82Ì" : "");
3750 Sprintf(bp, " on the %s", surface(u.ux, u.uy));
3752 Sprintf(bp, "%s
\82É", surface(u.ux, u.uy));
3754 #if 1 /*JP*//*
\82±
\82±
\82Å
\92Ç
\89Á*/
3755 Strcat(buf, "
\89B
\82ê");
3758 ; /* shouldn't happen; will result in generic "you are hiding" */
3762 int final = msgflag; /* 'final' is used by you_are() macro */
3766 /* for dohide(), when player uses '#monster' command */
3768 You("are %s %s.", msgflag ? "already" : "now", buf);
3771 You("
\82·
\82Å
\82É%s
\82Ä
\82¢
\82é
\81D", buf);
3773 You("%s
\82½
\81D", buf);
3780 * (shares enlightenment's tense handling)
3783 doconduct(VOID_ARGS)
3796 /* Create the conduct window */
3797 en_win = create_nhwindow(NHW_MENU);
3799 putstr(en_win, 0, "Voluntary challenges:");
3801 putstr(en_win, 0, "
\8e©
\94
\93I
\92§
\90í:");
3803 if (u.uroleplay.blind)
3805 you_have_been("blind from birth");
3807 you_have_been("
\90¶
\82Ü
\82ê
\82È
\82ª
\82ç
\82É
\96Ó
\96Ú");
3808 if (u.uroleplay.nudist)
3810 you_have_been("faithfully nudist");
3812 you_have_been("
\92\89\8eÀ
\82È
\97\87\91°");
3814 if (!u.uconduct.food)
3816 enl_msg(You_, "have gone", "went", " without food", "");
3818 enl_msg("
\82 \82È
\82½
\82Í
\90H
\8e\96\82ð
\82µ", "
\82Ä
\82¢
\82È
\82¢", "
\82È
\82©
\82Á
\82½", "", "");
3819 /* but beverages are okay */
3820 else if (!u.uconduct.unvegan)
3822 you_have_X("followed a strict vegan diet");
3824 you_have_been("
\8cµ
\8ai
\82È
\8dØ
\90H
\8eå
\8b`
\8eÒ");
3825 else if (!u.uconduct.unvegetarian)
3827 you_have_been("vegetarian");
3829 you_have_been("
\8dØ
\90H
\8eå
\8b`
\8eÒ");
3831 if (!u.uconduct.gnostic)
3833 you_have_been("an atheist");
3835 you_have_been("
\96³
\90_
\98_
\8eÒ");
3837 if (!u.uconduct.weaphit) {
3839 you_have_never("hit with a wielded weapon");
3841 you_have_never("
\82 \82È
\82½
\82Í
\91\95\94õ
\82µ
\82Ä
\82¢
\82é
\95\90\8aí
\82Å
\8dU
\8c\82\82µ");
3842 } else if (wizard) {
3844 Sprintf(buf, "used a wielded weapon %ld time%s", u.uconduct.weaphit,
3845 plur(u.uconduct.weaphit));
3848 Sprintf(buf, "
\82 \82È
\82½
\82Í%ld
\89ñ
\91\95\94õ
\82µ
\82½
\95\90\8aí
\82ð
\8eg
\97p
\82µ", u.uconduct.weaphit);
3852 if (!u.uconduct.killer)
3854 you_have_been("a pacifist");
3856 you_have_been("
\95½
\98a
\8eå
\8b`
\8eÒ");
3858 if (!u.uconduct.literate) {
3860 you_have_been("illiterate");
3862 you_have_never("
\82 \82È
\82½
\82Í
\93Ç
\82Ý
\8f\91\82«
\82µ");
3863 } else if (wizard) {
3865 Sprintf(buf, "read items or engraved %ld time%s", u.uconduct.literate,
3866 plur(u.uconduct.literate));
3869 Sprintf(buf, "%ld
\89ñ
\93Ç
\82ñ
\82¾
\82è
\8f\91\82¢
\82½
\82è
\82µ", u.uconduct.literate);
3874 ngenocided = num_genocides();
3875 if (ngenocided == 0) {
3877 you_have_never("genocided any monsters");
3879 you_have_never("
\82 \82È
\82½
\82Í
\89ö
\95¨
\82ð
\8bs
\8eE
\82µ");
3882 Sprintf(buf, "genocided %d type%s of monster%s", ngenocided,
3883 plur(ngenocided), plur(ngenocided));
3886 Sprintf(buf, "%d
\8eí
\82Ì
\89ö
\95¨
\82ð
\8bs
\8eE
\82µ", ngenocided);
3891 if (!u.uconduct.polypiles) {
3893 you_have_never("polymorphed an object");
3895 you_have_never("
\82 \82È
\82½
\82Í
\95¨
\91Ì
\82ð
\95Ï
\89»
\82³
\82¹");
3896 } else if (wizard) {
3898 Sprintf(buf, "polymorphed %ld item%s", u.uconduct.polypiles,
3899 plur(u.uconduct.polypiles));
3902 Sprintf(buf, "%ld
\8cÂ
\82Ì
\95¨
\82ð
\95Ï
\89»
\82³
\82¹", u.uconduct.polypiles);
3907 if (!u.uconduct.polyselfs) {
3909 you_have_never("changed form");
3911 you_have_never("
\82 \82È
\82½
\82Í
\95Ï
\89»
\82µ");
3912 } else if (wizard) {
3914 Sprintf(buf, "changed form %ld time%s", u.uconduct.polyselfs,
3915 plur(u.uconduct.polyselfs));
3918 Sprintf(buf, "%ld
\89ñ
\8ep
\82ð
\95Ï
\82¦", u.uconduct.polyselfs);
3923 if (!u.uconduct.wishes) {
3925 you_have_X("used no wishes");
3927 you_have_never("
\82 \82È
\82½
\82Í
\8aè
\82¢
\8e\96\82ð
\82µ");
3930 Sprintf(buf, "used %ld wish%s", u.uconduct.wishes,
3931 (u.uconduct.wishes > 1L) ? "es" : "");
3933 Sprintf(buf, "%ld
\89ñ
\8aè
\82¢
\8e\96\82ð
\82µ", u.uconduct.wishes);
3935 if (u.uconduct.wisharti) {
3936 /* if wisharti == wishes
3937 * 1 wish (for an artifact)
3938 * 2 wishes (both for artifacts)
3939 * N wishes (all for artifacts)
3940 * else (N is at least 2 in order to get here; M < N)
3941 * N wishes (1 for an artifact)
3942 * N wishes (M for artifacts)
3944 if (u.uconduct.wisharti == u.uconduct.wishes)
3945 Sprintf(eos(buf), " (%s",
3946 (u.uconduct.wisharti > 2L) ? "all "
3947 : (u.uconduct.wisharti == 2L) ? "both " : "");
3949 Sprintf(eos(buf), " (%ld ", u.uconduct.wisharti);
3951 Sprintf(eos(buf), "for %s)",
3952 (u.uconduct.wisharti == 1L) ? "an artifact"
3957 if (!u.uconduct.wisharti)
3959 enl_msg(You_, "have not wished", "did not wish",
3960 " for any artifacts", "");
3962 enl_msg("
\82 \82È
\82½
\82Í
\90¹
\8aí
\82ð
\8aè", "
\82Á
\82Ä
\82¢
\82È
\82¢", "
\82í
\82È
\82©
\82Á
\82½", "", "");
3966 /* Pop up the window and wait for a key */
3967 display_nhwindow(en_win, TRUE);
3968 destroy_nhwindow(en_win);
3972 /* Macros for meta and ctrl modifiers:
3973 * M and C return the meta/ctrl code for the given character;
3974 * e.g., (C('c') is ctrl-c
3978 #define M(c) (0x80 | (c))
3980 #define M(c) ((c) - 128)
3985 #define C(c) (0x1f & (c))
3988 /* ordered by command name */
3989 struct ext_func_tab extcmdlist[] = {
3990 { '#', "#", "perform an extended command",
3991 doextcmd, IFBURIED | GENERALCMD },
3993 { M('?'), "?", "list all extended commands",
3995 { M('?'), "?", "
\82±
\82Ì
\8ag
\92£
\83R
\83}
\83\93\83h
\88ê
\97\97\82ð
\95\
\8e¦
\82·
\82é",
3997 doextlist, IFBURIED | AUTOCOMPLETE | GENERALCMD },
3999 { M('a'), "adjust", "adjust inventory letters",
4001 { M('a'), "adjust", "
\8e\9d\82¿
\95¨
\88ê
\97\97\82Ì
\92²
\90®",
4003 doorganize, IFBURIED | AUTOCOMPLETE },
4005 { M('A'), "annotate", "name current level",
4007 { M('A'), "annotate", "
\8c»
\8dÝ
\82Ì
\8aK
\82É
\96¼
\91O
\82ð
\82Â
\82¯
\82é",
4009 donamelevel, IFBURIED | AUTOCOMPLETE },
4010 { 'a', "apply", "apply (use) a tool (pick-axe, key, lamp...)",
4012 { C('x'), "attributes", "show your attributes",
4013 doattributes, IFBURIED },
4014 { '@', "autopickup", "toggle the pickup option on/off",
4015 dotogglepickup, IFBURIED },
4016 { 'C', "call", "call (name) something", docallcmd, IFBURIED },
4017 { 'Z', "cast", "zap (cast) a spell", docast, IFBURIED },
4019 { M('c'), "chat", "talk to someone", dotalk, IFBURIED | AUTOCOMPLETE },
4021 { M('c'), "chat", "
\92N
\82©
\82Æ
\98b
\82·", dotalk, IFBURIED | AUTOCOMPLETE },
4023 { 'c', "close", "close a door", doclose },
4025 { M('C'), "conduct", "list voluntary challenges you have maintained",
4027 { M('C'), "conduct", "
\82Ç
\82¤
\82¢
\82¤
\8ds
\93®
\82ð
\82Æ
\82Á
\82½
\82©
\8c©
\82é",
4029 doconduct, IFBURIED | AUTOCOMPLETE },
4031 { M('d'), "dip", "dip an object into something", dodip, AUTOCOMPLETE },
4033 { M('d'), "dip", "
\89½
\82©
\82É
\95¨
\82ð
\90Z
\82·", dodip, AUTOCOMPLETE },
4035 { '>', "down", "go down a staircase", dodown },
4036 { 'd', "drop", "drop an item", dodrop },
4037 { 'D', "droptype", "drop specific item types", doddrop },
4038 { 'e', "eat", "eat something", doeat },
4039 { 'E', "engrave", "engrave writing on the floor", doengrave },
4041 { M('e'), "enhance", "advance or check weapon and spell skills",
4043 { M('e'), "enhance", "
\95\90\8aí
\8fn
\97û
\93x
\82ð
\8d\82\82ß
\82é",
4045 enhance_weapon_skill, IFBURIED | AUTOCOMPLETE },
4047 { '\0', "exploremode", "enter explore (discovery) mode",
4049 { '\0', "exploremode", "
\92T
\8c\9f(
\94
\8c©)
\83\82\81[
\83h
\82É
\93ü
\82é",
4051 enter_explore_mode, IFBURIED },
4052 { 'f', "fire", "fire ammunition from quiver", dofire },
4054 { M('f'), "force", "force a lock", doforce, AUTOCOMPLETE },
4056 { M('f'), "force", "
\8c®
\82ð
\82±
\82¶
\82 \82¯
\82é", doforce, AUTOCOMPLETE },
4058 { ';', "glance", "show what type of thing a map symbol corresponds to",
4059 doquickwhatis, IFBURIED | GENERALCMD },
4060 { '?', "help", "give a help message", dohelp, IFBURIED | GENERALCMD },
4061 { '\0', "herecmdmenu", "show menu of commands you can do here",
4062 doherecmdmenu, IFBURIED },
4063 { 'V', "history", "show long version and game history",
4064 dohistory, IFBURIED | GENERALCMD },
4065 { 'i', "inventory", "show your inventory", ddoinv, IFBURIED },
4066 { 'I', "inventtype", "inventory specific item types",
4067 dotypeinv, IFBURIED },
4069 { M('i'), "invoke", "invoke an object's special powers",
4071 { M('i'), "invoke", "
\95¨
\82Ì
\93Á
\95Ê
\82È
\97Í
\82ð
\8eg
\82¤",
4073 doinvoke, IFBURIED | AUTOCOMPLETE },
4075 { M('j'), "jump", "jump to another location", dojump, AUTOCOMPLETE },
4077 { M('j'), "jump", "
\91¼
\82Ì
\88Ê
\92u
\82É
\94ò
\82Ñ
\82¤
\82Â
\82é", dojump, AUTOCOMPLETE },
4079 { C('d'), "kick", "kick something", dokick },
4080 { '\\', "known", "show what object types have been discovered",
4081 dodiscovered, IFBURIED | GENERALCMD },
4082 { '`', "knownclass", "show discovered types for one class of objects",
4083 doclassdisco, IFBURIED | GENERALCMD },
4085 { '\0', "levelchange", "change experience level",
4087 { '\0', "levelchange", "
\8co
\8c±
\83\8c\83x
\83\8b\82ð
\95Ï
\82¦
\82é",
4089 wiz_level_change, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4091 { '\0', "lightsources", "show mobile light sources",
4093 { '\0', "lightsources", "
\88Ú
\93®
\8cõ
\8c¹
\82ð
\8c©
\82é",
4095 wiz_light_sources, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4096 { ':', "look", "look at what is here", dolook, IFBURIED },
4098 { M('l'), "loot", "loot a box on the floor", doloot, AUTOCOMPLETE },
4100 { M('l'), "loot", "
\8f°
\82Ì
\8fã
\82Ì
\94 \82ð
\8aJ
\82¯
\82é", doloot, AUTOCOMPLETE },
4102 #ifdef DEBUG_MIGRATING_MONS
4104 { '\0', "migratemons", "migrate N random monsters",
4106 { '\0', "migratemons", "
\83\89\83\93\83_
\83\80\82È
\89ö
\95¨
\82ð
\89½
\91Ì
\82©
\88Ú
\8fZ
\82³
\82¹
\82é",
4108 wiz_migrate_mons, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4111 { '\0', "monpolycontrol", "control monster polymorphs",
4113 { '\0', "monpolycontrol", "
\89ö
\95¨
\82Ö
\82Ì
\95Ï
\89»
\82ð
\90§
\8cä
\82·
\82é",
4115 wiz_mon_polycontrol, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4117 { M('m'), "monster", "use monster's special ability",
4119 { M('m'), "monster", "
\89ö
\95¨
\82Ì
\93Á
\95Ê
\94\
\97Í
\82ð
\8eg
\82¤",
4121 domonability, IFBURIED | AUTOCOMPLETE },
4123 { 'N', "name", "name a monster or an object",
4125 { 'N', "name", "
\83A
\83C
\83e
\83\80\82â
\95¨
\82É
\96¼
\91O
\82ð
\82Â
\82¯
\82é",
4127 docallcmd, IFBURIED | AUTOCOMPLETE },
4129 { M('o'), "offer", "offer a sacrifice to the gods",
4131 { M('o'), "offer", "
\90_
\82É
\8b\9f\95¨
\82ð
\95ù
\82°
\82é",
4133 dosacrifice, AUTOCOMPLETE },
4134 { 'o', "open", "open a door", doopen },
4135 { 'O', "options", "show option settings, possibly change them",
4136 doset, IFBURIED | GENERALCMD },
4138 { C('o'), "overview", "show a summary of the explored dungeon",
4140 { C('o'), "overview", "
\92T
\8dõ
\82µ
\82½
\96À
\8b{
\82Ì
\8aT
\97v
\82ð
\95\
\8e¦
\82·
\82é",
4142 dooverview, IFBURIED | AUTOCOMPLETE },
4144 { '\0', "panic", "test panic routine (fatal to game)",
4146 { '\0', "panic", "
\83p
\83j
\83b
\83N
\83\8b\81[
\83`
\83\93\82ð
\83e
\83X
\83g
\82·
\82é(
\92v
\96½
\93I)",
4148 wiz_panic, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4149 { 'p', "pay", "pay your shopping bill", dopay },
4150 { ',', "pickup", "pick up things at the current location", dopickup },
4152 { '\0', "polyself", "polymorph self",
4154 { '\0', "polyself", "
\95Ï
\89»
\82·
\82é",
4156 wiz_polyself, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4159 { '\0', "portdebug", "wizard port debug command",
4161 { '\0', "portdebug", "
\83E
\83B
\83U
\81[
\83h
\83|
\81[
\83g
\83f
\83o
\83b
\83O
\83R
\83}
\83\93\83h",
4163 wiz_port_debug, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4166 { M('p'), "pray", "pray to the gods for help",
4168 { M('p'), "pray", "
\90_
\82É
\8bF
\82é",
4170 dopray, IFBURIED | AUTOCOMPLETE },
4171 { C('p'), "prevmsg", "view recent game messages",
4172 doprev_message, IFBURIED | GENERALCMD },
4173 { 'P', "puton", "put on an accessory (ring, amulet, etc)", doputon },
4174 { 'q', "quaff", "quaff (drink) something", dodrink },
4176 { M('q'), "quit", "exit without saving current game",
4178 { M('q'), "quit", "
\83Z
\81[
\83u
\82µ
\82È
\82¢
\82Å
\8fI
\97¹",
4180 done2, IFBURIED | AUTOCOMPLETE | GENERALCMD },
4181 { 'Q', "quiver", "select ammunition for quiver", dowieldquiver },
4182 { 'r', "read", "read a scroll or spellbook", doread },
4183 { C('r'), "redraw", "redraw screen", doredraw, IFBURIED | GENERALCMD },
4184 { 'R', "remove", "remove an accessory (ring, amulet, etc)", doremring },
4186 { M('R'), "ride", "mount or dismount a saddled steed",
4188 { M('R'), "ride", "
\89ö
\95¨
\82É
\8fæ
\82é(
\82Ü
\82½
\82Í
\8d~
\82è
\82é)",
4190 doride, AUTOCOMPLETE },
4192 { M('r'), "rub", "rub a lamp or a stone", dorub, AUTOCOMPLETE },
4194 { M('r'), "rub", "
\83\89\83\93\83v
\82ð
\82±
\82·
\82é", dorub, AUTOCOMPLETE },
4196 { 'S', "save", "save the game and exit", dosave, IFBURIED | GENERALCMD },
4198 { 's', "search", "search for traps and secret doors",
4199 dosearch, IFBURIED, "searching" },
4201 { 's', "search", "ã©
\82â
\89B
\82µ
\94à
\82ð
\92T
\82·",
4202 dosearch, IFBURIED, "
\92T
\82·" },
4204 { '*', "seeall", "show all equipment in use", doprinuse, IFBURIED },
4205 { AMULET_SYM, "seeamulet", "show the amulet currently worn",
4206 dopramulet, IFBURIED },
4207 { ARMOR_SYM, "seearmor", "show the armor currently worn",
4208 doprarm, IFBURIED },
4209 { GOLD_SYM, "seegold", "count your gold", doprgold, IFBURIED },
4211 { '\0', "seenv", "show seen vectors",
4213 { '\0', "seenv", "
\8e\8b\90ü
\83x
\83N
\83g
\83\8b\82ð
\8c©
\82é",
4215 wiz_show_seenv, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4216 { RING_SYM, "seerings", "show the ring(s) currently worn",
4217 doprring, IFBURIED },
4218 { SPBOOK_SYM, "seespells", "list and reorder known spells",
4219 dovspell, IFBURIED },
4220 { TOOL_SYM, "seetools", "show the tools currently in use",
4221 doprtool, IFBURIED },
4222 { '^', "seetrap", "show the type of adjacent trap", doidtrap, IFBURIED },
4223 { WEAPON_SYM, "seeweapon", "show the weapon currently wielded",
4224 doprwep, IFBURIED },
4226 { '!', "shell", "do a shell escape", dosh, IFBURIED | GENERALCMD },
4229 { M('s'), "sit", "sit down", dosit, AUTOCOMPLETE },
4230 { '\0', "stats", "show memory statistics",
4232 { M('s'), "sit", "
\8dÀ
\82é", dosit, AUTOCOMPLETE },
4233 { '\0', "stats", "
\83\81\83\82\83\8a\8fó
\91Ô
\82ð
\8c©
\82é",
4235 wiz_show_stats, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4237 { C('z'), "suspend", "suspend the game",
4238 dosuspend_core, IFBURIED | GENERALCMD },
4239 #endif /* SUSPEND */
4240 { 'x', "swap", "swap wielded and secondary weapons", doswapweapon },
4241 { 'T', "takeoff", "take off one piece of armor", dotakeoff },
4242 { 'A', "takeoffall", "remove all armor", doddoremarm },
4243 { C('t'), "teleport", "teleport around the level", dotele, IFBURIED },
4245 { '\0', "terrain", "show map without obstructions",
4247 { '\0', "terrain", "
\8e×
\96\82\82³
\82ê
\82¸
\82É
\92n
\90}
\82ð
\8c©
\82é",
4249 doterrain, IFBURIED | AUTOCOMPLETE },
4250 { '\0', "therecmdmenu",
4251 "menu of commands you can do from here to adjacent spot",
4253 { 't', "throw", "throw something", dothrow },
4255 { '\0', "timeout", "look at timeout queue and hero's timed intrinsics",
4257 { '\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é",
4259 wiz_timeout_queue, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4261 { M('T'), "tip", "empty a container", dotip, AUTOCOMPLETE },
4263 { M('T'), "tip", "
\93ü
\82ê
\95¨
\82ð
\8bó
\82É
\82·
\82é", dotip, AUTOCOMPLETE },
4265 { '_', "travel", "travel to a specific location on the map", dotravel },
4267 { M('t'), "turn", "turn undead away", doturn, IFBURIED | AUTOCOMPLETE },
4269 { M('t'), "turn", "
\83A
\83\93\83f
\83b
\83g
\82ð
\93y
\82É
\95Ô
\82·", doturn, IFBURIED | AUTOCOMPLETE },
4272 { 'X', "twoweapon", "toggle two-weapon combat",
4274 { 'X', "twoweapon", "
\97¼
\8eè
\8e\9d\82¿
\82Ì
\90Ø
\82è
\91Ö
\82¦",
4276 dotwoweapon, AUTOCOMPLETE },
4278 { M('u'), "untrap", "untrap something", dountrap, AUTOCOMPLETE },
4280 { M('u'), "untrap", "ã©
\82ð
\82Í
\82¸
\82·", dountrap, AUTOCOMPLETE },
4282 { '<', "up", "go up a staircase", doup },
4284 { '\0', "vanquished", "list vanquished monsters",
4286 { '\0', "vanquished", "
\93|
\82µ
\82½
\89ö
\95¨
\82Ì
\88ê
\97\97\82ð
\8c©
\82é",
4288 dovanquished, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4289 { M('v'), "version",
4291 "list compile time options for this version of NetHack",
4293 "
\83R
\83\93\83p
\83C
\83\8b\8e\9e\82Ì
\83I
\83v
\83V
\83\87\83\93\82ð
\95\
\8e¦
\82·
\82é",
4295 doextversion, IFBURIED | AUTOCOMPLETE | GENERALCMD },
4296 { 'v', "versionshort", "show version", doversion, IFBURIED | GENERALCMD },
4298 { '\0', "vision", "show vision array",
4300 { '\0', "vision", "
\8e\8b\8aE
\94z
\97ñ
\82ð
\8c©
\82é",
4302 wiz_show_vision, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4304 { '.', "wait", "rest one move while doing nothing",
4305 donull, IFBURIED, "waiting" },
4307 { '.', "wait", "
\88ê
\95à
\95ª
\89½
\82à
\82µ
\82È
\82¢",
4308 donull, IFBURIED, "
\8bx
\8ce
\82·
\82é" },
4310 { 'W', "wear", "wear a piece of armor", dowear },
4311 { '&', "whatdoes", "tell what a command does", dowhatdoes, IFBURIED },
4312 { '/', "whatis", "show what type of thing a symbol corresponds to",
4313 dowhatis, IFBURIED | GENERALCMD },
4314 { 'w', "wield", "wield (put in use) a weapon", dowield },
4316 { M('w'), "wipe", "wipe off your face", dowipe, AUTOCOMPLETE },
4318 { M('w'), "wipe", "
\8aç
\82ð
\90@
\82¤", dowipe, AUTOCOMPLETE },
4322 { '\0', "wizdebug_bury", "wizard debug: bury objs under and around you",
4324 { '\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é",
4326 wiz_debug_cmd_bury, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4328 { '\0', "wizdebug_traveldisplay", "wizard debug: toggle travel display",
4330 { '\0', "wizdebug_traveldisplay", "
\83E
\83B
\83U
\81[
\83h
\83f
\83o
\83b
\83O:
\88Ú
\93®
\95\
\8e¦
\82ð
\90Ø
\82è
\91Ö
\82¦
\82é",
4332 wiz_debug_cmd_traveldisplay, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4334 { C('e'), "wizdetect", "reveal hidden things within a small radius",
4335 wiz_detect, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4336 { C('g'), "wizgenesis", "create a monster",
4337 wiz_genesis, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4338 { C('i'), "wizidentify", "identify all items in inventory",
4339 wiz_identify, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4340 { '\0', "wizintrinsic", "set an intrinsic",
4341 wiz_intrinsic, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4342 { C('v'), "wizlevelport", "teleport to another level",
4343 wiz_level_tele, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4344 { '\0', "wizmakemap", "recreate the current level",
4345 wiz_makemap, IFBURIED | WIZMODECMD },
4346 { C('f'), "wizmap", "map the level",
4347 wiz_map, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4349 { '\0', "wizrumorcheck", "verify rumor boundaries",
4351 { '\0', "wizrumorcheck", "
\89\
\82Ì
\8b«
\8aE
\82ð
\8c\9f\8fØ
\82·
\82é",
4353 wiz_rumor_check, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4355 { '\0', "wizsmell", "smell monster",
4357 { '\0', "wizsmell", "
\89ö
\95¨
\82Ì
\93õ
\82¢
\82ð
\9ak
\82®",
4359 wiz_smell, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4360 { '\0', "wizwhere", "show locations of special levels",
4361 wiz_where, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4362 { C('w'), "wizwish", "wish for something",
4363 wiz_wish, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4365 { '\0', "wmode", "show wall modes",
4367 { '\0', "wmode", "
\95Ç
\83\82\81[
\83h
\82ð
\8c©
\82é",
4369 wiz_show_wmodes, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
4370 { 'z', "zap", "zap a wand", dozap },
4371 { '\0', (char *) 0, (char *) 0, donull, 0, (char *) 0 } /* sentinel */
4378 if (Cmd.commands[key] && Cmd.commands[key]->ef_txt)
4379 return Cmd.commands[key]->ef_desc;
4384 bind_key(key, command)
4386 const char *command;
4388 struct ext_func_tab *extcmd;
4390 /* special case: "nothing" is reserved for unbinding */
4391 if (!strcmp(command, "nothing")) {
4392 Cmd.commands[key] = (struct ext_func_tab *) 0;
4396 for (extcmd = extcmdlist; extcmd->ef_txt; extcmd++) {
4397 if (strcmp(command, extcmd->ef_txt))
4399 Cmd.commands[key] = extcmd;
4406 /* initialize all keyboard commands */
4410 struct ext_func_tab *extcmd;
4412 for (extcmd = extcmdlist; extcmd->ef_txt; extcmd++)
4414 Cmd.commands[extcmd->key] = extcmd;
4416 (void) bind_key(C('l'), "redraw"); /* if number_pad is set */
4417 /* 'b', 'B' : go sw */
4418 /* 'F' : fight (one time) */
4419 /* 'g', 'G' : multiple go */
4420 /* 'h', 'H' : go west */
4421 (void) bind_key('h', "help"); /* if number_pad is set */
4422 (void) bind_key('j', "jump"); /* if number_pad is on */
4423 /* 'j', 'J', 'k', 'K', 'l', 'L', 'm', 'M', 'n', 'N' move commands */
4424 (void) bind_key('k', "kick"); /* if number_pad is on */
4425 (void) bind_key('l', "loot"); /* if number_pad is on */
4426 (void) bind_key(C('n'), "annotate"); /* if number_pad is on */
4427 (void) bind_key(M('n'), "name");
4428 (void) bind_key(M('N'), "name");
4429 (void) bind_key('u', "untrap"); /* if number_pad is on */
4432 (void) bind_key(M('O'), "overview");
4433 (void) bind_key(M('2'), "twoweapon");
4436 (void) bind_key(' ', "wait");
4440 dokeylist_putcmds(datawin, docount, cmdflags, exflags, keys_used)
4443 int cmdflags, exflags;
4444 boolean *keys_used; /* boolean keys_used[256] */
4451 for (i = 0; i < 256; i++) {
4452 const struct ext_func_tab *extcmd;
4453 uchar key = (uchar) i;
4457 if (key == ' ' && !flags.rest_on_space)
4459 if ((extcmd = Cmd.commands[i]) != (struct ext_func_tab *) 0) {
4460 if ((cmdflags && !(extcmd->flags & cmdflags))
4461 || (exflags && (extcmd->flags & exflags)))
4467 Sprintf(buf, "%-8s %-12s %s", key2txt(key, buf2),
4470 putstr(datawin, 0, buf);
4471 keys_used[i] = TRUE;
4477 /* list all keys and their bindings, like dat/hh but dynamic */
4479 dokeylist(VOID_ARGS)
4481 char buf[BUFSZ], buf2[BUFSZ];
4483 boolean keys_used[256] = {0};
4487 run_desc[] = "Prefix: run until something very interesting is seen",
4489 "Prefix: force fight even if you don't see a monster";
4490 static const struct {
4495 { NHKF_ESC, "escape from the current query/action", FALSE },
4497 "Prefix: rush until something interesting is seen", FALSE },
4498 { NHKF_RUN, run_desc, FALSE },
4499 { NHKF_RUN2, run_desc, TRUE },
4500 { NHKF_FIGHT, forcefight_desc, FALSE },
4501 { NHKF_FIGHT2, forcefight_desc, TRUE } ,
4503 "Prefix: move without picking up objects/fighting", FALSE },
4504 { NHKF_RUN_NOPICKUP,
4505 "Prefix: run without picking up objects/fighting", FALSE },
4506 { NHKF_DOINV, "view inventory", TRUE },
4507 { NHKF_REQMENU, "Prefix: request a menu", FALSE },
4509 { NHKF_DOAGAIN , "re-do: perform the previous command again", FALSE },
4511 { 0, (const char *) 0, FALSE }
4514 datawin = create_nhwindow(NHW_TEXT);
4515 putstr(datawin, 0, "");
4516 putstr(datawin, 0, " Full Current Key Bindings List");
4518 /* directional keys */
4519 putstr(datawin, 0, "");
4520 putstr(datawin, 0, "Directional keys:");
4521 show_direction_keys(datawin, '.', FALSE); /* '.'==self in direction grid */
4523 keys_used[(uchar) Cmd.move_NW] = keys_used[(uchar) Cmd.move_N]
4524 = keys_used[(uchar) Cmd.move_NE] = keys_used[(uchar) Cmd.move_W]
4525 = keys_used[(uchar) Cmd.move_E] = keys_used[(uchar) Cmd.move_SW]
4526 = keys_used[(uchar) Cmd.move_S] = keys_used[(uchar) Cmd.move_SE]
4529 if (!iflags.num_pad) {
4530 keys_used[(uchar) highc(Cmd.move_NW)]
4531 = keys_used[(uchar) highc(Cmd.move_N)]
4532 = keys_used[(uchar) highc(Cmd.move_NE)]
4533 = keys_used[(uchar) highc(Cmd.move_W)]
4534 = keys_used[(uchar) highc(Cmd.move_E)]
4535 = keys_used[(uchar) highc(Cmd.move_SW)]
4536 = keys_used[(uchar) highc(Cmd.move_S)]
4537 = keys_used[(uchar) highc(Cmd.move_SE)] = TRUE;
4538 keys_used[(uchar) C(Cmd.move_NW)]
4539 = keys_used[(uchar) C(Cmd.move_N)]
4540 = keys_used[(uchar) C(Cmd.move_NE)]
4541 = keys_used[(uchar) C(Cmd.move_W)]
4542 = keys_used[(uchar) C(Cmd.move_E)]
4543 = keys_used[(uchar) C(Cmd.move_SW)]
4544 = keys_used[(uchar) C(Cmd.move_S)]
4545 = keys_used[(uchar) C(Cmd.move_SE)] = TRUE;
4546 putstr(datawin, 0, "");
4548 "Shift-<direction> will move in specified direction until you hit");
4549 putstr(datawin, 0, " a wall or run into something.");
4551 "Ctrl-<direction> will run in specified direction until something");
4552 putstr(datawin, 0, " very interesting is seen.");
4555 putstr(datawin, 0, "");
4556 putstr(datawin, 0, "Miscellaneous keys:");
4557 for (i = 0; misc_keys[i].desc; i++) {
4558 key = Cmd.spkeys[misc_keys[i].nhkf];
4559 if (key && ((misc_keys[i].numpad && iflags.num_pad)
4560 || !misc_keys[i].numpad)) {
4561 keys_used[(uchar) key] = TRUE;
4562 Sprintf(buf, "%-8s %s", key2txt(key, buf2), misc_keys[i].desc);
4563 putstr(datawin, 0, buf);
4567 putstr(datawin, 0, "^c break out of NetHack (SIGINT)");
4568 keys_used[(uchar) C('c')] = TRUE;
4571 putstr(datawin, 0, "");
4572 show_menu_controls(datawin, TRUE);
4574 if (dokeylist_putcmds(datawin, TRUE, GENERALCMD, WIZMODECMD, keys_used)) {
4575 putstr(datawin, 0, "");
4576 putstr(datawin, 0, "General commands:");
4577 (void) dokeylist_putcmds(datawin, FALSE, GENERALCMD, WIZMODECMD,
4581 if (dokeylist_putcmds(datawin, TRUE, 0, WIZMODECMD, keys_used)) {
4582 putstr(datawin, 0, "");
4583 putstr(datawin, 0, "Game commands:");
4584 (void) dokeylist_putcmds(datawin, FALSE, 0, WIZMODECMD, keys_used);
4588 && dokeylist_putcmds(datawin, TRUE, WIZMODECMD, 0, keys_used)) {
4589 putstr(datawin, 0, "");
4590 putstr(datawin, 0, "Wizard-mode commands:");
4591 (void) dokeylist_putcmds(datawin, FALSE, WIZMODECMD, 0, keys_used);
4594 display_nhwindow(datawin, FALSE);
4595 destroy_nhwindow(datawin);
4604 for (i = 0; i < 256; ++i)
4605 if (Cmd.commands[i] && Cmd.commands[i]->ef_funct == fn)
4611 * wizard mode sanity_check code
4614 static const char template[] = "%-27s %4ld %6ld";
4615 static const char stats_hdr[] = " count bytes";
4616 static const char stats_sep[] = "--------------------------- ----- -------";
4622 int sz = (int) sizeof(struct obj);
4625 sz += (int) sizeof(struct oextra);
4627 sz += (int) strlen(ONAME(otmp)) + 1;
4629 sz += (int) sizeof(struct monst);
4631 sz += (int) sizeof(unsigned);
4633 sz += (int) sizeof(long);
4635 sz += (int) strlen(OMAILCMD(otmp)) + 1;
4641 count_obj(chain, total_count, total_size, top, recurse)
4651 for (count = size = 0, obj = chain; obj; obj = obj->nobj) {
4654 size += size_obj(obj);
4656 if (recurse && obj->cobj)
4657 count_obj(obj->cobj, total_count, total_size, TRUE, TRUE);
4659 *total_count += count;
4660 *total_size += size;
4664 obj_chain(win, src, chain, force, total_count, total_size)
4673 long count = 0L, size = 0L;
4675 count_obj(chain, &count, &size, TRUE, FALSE);
4677 if (count || size || force) {
4678 *total_count += count;
4679 *total_size += size;
4680 Sprintf(buf, template, src, count, size);
4681 putstr(win, 0, buf);
4686 mon_invent_chain(win, src, chain, total_count, total_size)
4689 struct monst *chain;
4694 long count = 0, size = 0;
4697 for (mon = chain; mon; mon = mon->nmon)
4698 count_obj(mon->minvent, &count, &size, TRUE, FALSE);
4700 if (count || size) {
4701 *total_count += count;
4702 *total_size += size;
4703 Sprintf(buf, template, src, count, size);
4704 putstr(win, 0, buf);
4709 contained_stats(win, src, total_count, total_size)
4716 long count = 0, size = 0;
4719 count_obj(invent, &count, &size, FALSE, TRUE);
4720 count_obj(fobj, &count, &size, FALSE, TRUE);
4721 count_obj(level.buriedobjlist, &count, &size, FALSE, TRUE);
4722 count_obj(migrating_objs, &count, &size, FALSE, TRUE);
4723 /* DEADMONSTER check not required in this loop since they have no
4725 for (mon = fmon; mon; mon = mon->nmon)
4726 count_obj(mon->minvent, &count, &size, FALSE, TRUE);
4727 for (mon = migrating_mons; mon; mon = mon->nmon)
4728 count_obj(mon->minvent, &count, &size, FALSE, TRUE);
4730 if (count || size) {
4731 *total_count += count;
4732 *total_size += size;
4733 Sprintf(buf, template, src, count, size);
4734 putstr(win, 0, buf);
4739 size_monst(mtmp, incl_wsegs)
4743 int sz = (int) sizeof (struct monst);
4745 if (mtmp->wormno && incl_wsegs)
4746 sz += size_wseg(mtmp);
4749 sz += (int) sizeof (struct mextra);
4751 sz += (int) strlen(MNAME(mtmp)) + 1;
4753 sz += (int) sizeof (struct egd);
4755 sz += (int) sizeof (struct epri);
4757 sz += (int) sizeof (struct eshk);
4759 sz += (int) sizeof (struct emin);
4761 sz += (int) sizeof (struct edog);
4762 /* mextra->mcorpsenm doesn't point to more memory */
4768 mon_chain(win, src, chain, force, total_count, total_size)
4771 struct monst *chain;
4779 /* mon->wormno means something different for migrating_mons and mydogs */
4780 boolean incl_wsegs = !strcmpi(src, "fmon");
4783 for (mon = chain; mon; mon = mon->nmon) {
4785 size += size_monst(mon, incl_wsegs);
4787 if (count || size || force) {
4788 *total_count += count;
4789 *total_size += size;
4790 Sprintf(buf, template, src, count, size);
4791 putstr(win, 0, buf);
4796 misc_stats(win, total_count, total_size)
4801 char buf[BUFSZ], hdrbuf[QBUFSZ];
4805 struct damage *sd; /* shop damage */
4806 struct cemetery *bi; /* bones info */
4808 /* traps and engravings are output unconditionally;
4809 * others only if nonzero
4812 for (tt = ftrap; tt; tt = tt->ntrap) {
4814 size += (long) sizeof *tt;
4816 *total_count += count;
4817 *total_size += size;
4818 Sprintf(hdrbuf, "traps, size %ld", (long) sizeof (struct trap));
4819 Sprintf(buf, template, hdrbuf, count, size);
4820 putstr(win, 0, buf);
4823 engr_stats("engravings, size %ld+text", hdrbuf, &count, &size);
4824 *total_count += count;
4825 *total_size += size;
4826 Sprintf(buf, template, hdrbuf, count, size);
4827 putstr(win, 0, buf);
4830 light_stats("light sources, 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 timer_stats("timers, size %ld", hdrbuf, &count, &size);
4840 if (count || size) {
4841 *total_count += count;
4842 *total_size += size;
4843 Sprintf(buf, template, hdrbuf, count, size);
4844 putstr(win, 0, buf);
4848 for (sd = level.damagelist; sd; sd = sd->next) {
4850 size += (long) sizeof *sd;
4852 if (count || size) {
4853 *total_count += count;
4854 *total_size += size;
4855 Sprintf(hdrbuf, "shop damage, size %ld",
4856 (long) sizeof (struct damage));
4857 Sprintf(buf, template, hdrbuf, count, size);
4858 putstr(win, 0, buf);
4862 region_stats("regions, size %ld+%ld*rect+N", hdrbuf, &count, &size);
4863 if (count || size) {
4864 *total_count += count;
4865 *total_size += size;
4866 Sprintf(buf, template, hdrbuf, count, size);
4867 putstr(win, 0, buf);
4871 for (bi = level.bonesinfo; bi; bi = bi->next) {
4873 size += (long) sizeof *bi;
4875 if (count || size) {
4876 *total_count += count;
4877 *total_size += size;
4878 Sprintf(hdrbuf, "bones history, size %ld",
4879 (long) sizeof (struct cemetery));
4880 Sprintf(buf, template, hdrbuf, count, size);
4881 putstr(win, 0, buf);
4885 for (idx = 0; idx < NUM_OBJECTS; ++idx)
4886 if (objects[idx].oc_uname) {
4888 size += (long) (strlen(objects[idx].oc_uname) + 1);
4890 if (count || size) {
4891 *total_count += count;
4892 *total_size += size;
4893 Strcpy(hdrbuf, "object type names, text");
4894 Sprintf(buf, template, hdrbuf, count, size);
4895 putstr(win, 0, buf);
4900 * Display memory usage of all monsters and objects on the level.
4907 long total_obj_size, total_obj_count,
4908 total_mon_size, total_mon_count,
4909 total_ovr_size, total_ovr_count,
4910 total_misc_size, total_misc_count;
4912 win = create_nhwindow(NHW_TEXT);
4913 putstr(win, 0, "Current memory statistics:");
4915 total_obj_count = total_obj_size = 0L;
4916 putstr(win, 0, stats_hdr);
4917 Sprintf(buf, " Objects, base size %ld", (long) sizeof (struct obj));
4918 putstr(win, 0, buf);
4919 obj_chain(win, "invent", invent, TRUE, &total_obj_count, &total_obj_size);
4920 obj_chain(win, "fobj", fobj, TRUE, &total_obj_count, &total_obj_size);
4921 obj_chain(win, "buried", level.buriedobjlist, FALSE,
4922 &total_obj_count, &total_obj_size);
4923 obj_chain(win, "migrating obj", migrating_objs, FALSE,
4924 &total_obj_count, &total_obj_size);
4925 obj_chain(win, "billobjs", billobjs, FALSE,
4926 &total_obj_count, &total_obj_size);
4927 mon_invent_chain(win, "minvent", fmon, &total_obj_count, &total_obj_size);
4928 mon_invent_chain(win, "migrating minvent", migrating_mons,
4929 &total_obj_count, &total_obj_size);
4930 contained_stats(win, "contained", &total_obj_count, &total_obj_size);
4931 putstr(win, 0, stats_sep);
4932 Sprintf(buf, template, " Obj total", total_obj_count, total_obj_size);
4933 putstr(win, 0, buf);
4935 total_mon_count = total_mon_size = 0L;
4937 Sprintf(buf, " Monsters, base size %ld", (long) sizeof (struct monst));
4938 putstr(win, 0, buf);
4939 mon_chain(win, "fmon", fmon, TRUE, &total_mon_count, &total_mon_size);
4940 mon_chain(win, "migrating", migrating_mons, FALSE,
4941 &total_mon_count, &total_mon_size);
4942 /* 'mydogs' is only valid during level change or end of game disclosure,
4943 but conceivably we've been called from within debugger at such time */
4944 if (mydogs) /* monsters accompanying hero */
4945 mon_chain(win, "mydogs", mydogs, FALSE,
4946 &total_mon_count, &total_mon_size);
4947 putstr(win, 0, stats_sep);
4948 Sprintf(buf, template, " Mon total", total_mon_count, total_mon_size);
4949 putstr(win, 0, buf);
4951 total_ovr_count = total_ovr_size = 0L;
4953 putstr(win, 0, " Overview");
4954 overview_stats(win, template, &total_ovr_count, &total_ovr_size);
4955 putstr(win, 0, stats_sep);
4956 Sprintf(buf, template, " Over total", total_ovr_count, total_ovr_size);
4957 putstr(win, 0, buf);
4959 total_misc_count = total_misc_size = 0L;
4961 putstr(win, 0, " Miscellaneous");
4962 misc_stats(win, &total_misc_count, &total_misc_size);
4963 putstr(win, 0, stats_sep);
4964 Sprintf(buf, template, " Misc total", total_misc_count, total_misc_size);
4965 putstr(win, 0, buf);
4968 putstr(win, 0, stats_sep);
4969 Sprintf(buf, template, " Grand total",
4970 (total_obj_count + total_mon_count
4971 + total_ovr_count + total_misc_count),
4972 (total_obj_size + total_mon_size
4973 + total_ovr_size + total_misc_size));
4974 putstr(win, 0, buf);
4976 #if defined(__BORLANDC__) && !defined(_WIN32)
4977 show_borlandc_stats(win);
4980 display_nhwindow(win, FALSE);
4981 destroy_nhwindow(win);
4989 timer_sanity_check();
4991 light_sources_sanity_check();
4994 #ifdef DEBUG_MIGRATING_MONS
4999 char inbuf[BUFSZ] = DUMMY;
5000 struct permonst *ptr;
5004 getlin("How many random monsters to migrate? [0]", inbuf);
5005 if (*inbuf == '\033')
5007 mcount = atoi(inbuf);
5008 if (mcount < 0 || mcount > (COLNO * ROWNO) || Is_botlevel(&u.uz))
5010 while (mcount > 0) {
5011 if (Is_stronghold(&u.uz))
5012 assign_level(&tolevel, &valley_level);
5014 get_level(&tolevel, depth(&u.uz) + 1);
5016 mtmp = makemon(ptr, 0, 0, NO_MM_FLAGS);
5018 migrate_to_level(mtmp, ledger_no(&tolevel), MIGR_RANDOM,
5026 #define unctrl(c) ((c) <= C('z') ? (0x60 | (c)) : (c))
5027 #define unmeta(c) (0x7f & (c))
5033 } const spkeys_binds[] = {
5034 { NHKF_ESC, '\033', (char *) 0 }, /* no binding */
5035 { NHKF_DOAGAIN, DOAGAIN, "repeat" },
5036 { NHKF_REQMENU, 'm', "reqmenu" },
5037 { NHKF_RUN, 'G', "run" },
5038 { NHKF_RUN2, '5', "run.numpad" },
5039 { NHKF_RUSH, 'g', "rush" },
5040 { NHKF_FIGHT, 'F', "fight" },
5041 { NHKF_FIGHT2, '-', "fight.numpad" },
5042 { NHKF_NOPICKUP, 'm', "nopickup" },
5043 { NHKF_RUN_NOPICKUP, 'M', "run.nopickup" },
5044 { NHKF_DOINV, '0', "doinv" },
5045 { NHKF_TRAVEL, CMD_TRAVEL, (char *) 0 }, /* no binding */
5046 { NHKF_CLICKLOOK, CMD_CLICKLOOK, (char *) 0 }, /* no binding */
5047 { NHKF_REDRAW, C('r'), "redraw" },
5048 { NHKF_REDRAW2, C('l'), "redraw.numpad" },
5049 { NHKF_GETDIR_SELF, '.', "getdir.self" },
5050 { NHKF_GETDIR_SELF2, 's', "getdir.self2" },
5051 { NHKF_GETDIR_HELP, '?', "getdir.help" },
5052 { NHKF_COUNT, 'n', "count" },
5053 { NHKF_GETPOS_SELF, '@', "getpos.self" },
5054 { NHKF_GETPOS_PICK, '.', "getpos.pick" },
5055 { NHKF_GETPOS_PICK_Q, ',', "getpos.pick.quick" },
5056 { NHKF_GETPOS_PICK_O, ';', "getpos.pick.once" },
5057 { NHKF_GETPOS_PICK_V, ':', "getpos.pick.verbose" },
5058 { NHKF_GETPOS_SHOWVALID, '$', "getpos.valid" },
5059 { NHKF_GETPOS_AUTODESC, '#', "getpos.autodescribe" },
5060 { NHKF_GETPOS_MON_NEXT, 'm', "getpos.mon.next" },
5061 { NHKF_GETPOS_MON_PREV, 'M', "getpos.mon.prev" },
5062 { NHKF_GETPOS_OBJ_NEXT, 'o', "getpos.obj.next" },
5063 { NHKF_GETPOS_OBJ_PREV, 'O', "getpos.obj.prev" },
5064 { NHKF_GETPOS_DOOR_NEXT, 'd', "getpos.door.next" },
5065 { NHKF_GETPOS_DOOR_PREV, 'D', "getpos.door.prev" },
5066 { NHKF_GETPOS_UNEX_NEXT, 'x', "getpos.unexplored.next" },
5067 { NHKF_GETPOS_UNEX_PREV, 'X', "getpos.unexplored.prev" },
5068 { NHKF_GETPOS_VALID_NEXT, 'z', "getpos.valid.next" },
5069 { NHKF_GETPOS_VALID_PREV, 'Z', "getpos.valid.prev" },
5070 { NHKF_GETPOS_INTERESTING_NEXT, 'a', "getpos.all.next" },
5071 { NHKF_GETPOS_INTERESTING_PREV, 'A', "getpos.all.prev" },
5072 { NHKF_GETPOS_HELP, '?', "getpos.help" },
5073 { NHKF_GETPOS_LIMITVIEW, '"', "getpos.filter" },
5074 { NHKF_GETPOS_MOVESKIP, '*', "getpos.moveskip" },
5075 { NHKF_GETPOS_MENU, '!', "getpos.menu" }
5079 bind_specialkey(key, command)
5081 const char *command;
5084 for (i = 0; i < SIZE(spkeys_binds); i++) {
5085 if (!spkeys_binds[i].name || strcmp(command, spkeys_binds[i].name))
5087 Cmd.spkeys[spkeys_binds[i].nhkf] = key;
5093 /* returns a one-byte character from the text (it may massacre the txt
5099 txt = trimspaces(txt);
5103 /* simple character */
5107 /* a few special entries */
5108 if (!strcmp(txt, "<enter>"))
5110 if (!strcmp(txt, "<space>"))
5112 if (!strcmp(txt, "<esc>"))
5115 /* control and meta keys */
5117 case 'm': /* can be mx, Mx, m-x, M-x */
5120 if (*txt == '-' && txt[1])
5125 case 'c': /* can be cx, Cx, ^x, c-x, C-x, ^-x */
5129 if (*txt == '-' && txt[1])
5136 /* ascii codes: must be three-digit decimal */
5137 if (*txt >= '0' && *txt <= '9') {
5141 for (i = 0; i < 3; i++) {
5142 if (txt[i] < '0' || txt[i] > '9')
5144 key = 10 * key + txt[i] - '0';
5152 /* returns the text for a one-byte encoding;
5153 * must be shorter than a tab for proper formatting */
5157 char *txt; /* sufficiently long buffer */
5159 /* should probably switch to "SPC", "ESC", "RET"
5160 since nethack's documentation uses ESC for <escape> */
5162 Sprintf(txt, "<space>");
5163 else if (c == '\033')
5164 Sprintf(txt, "<esc>");
5166 Sprintf(txt, "<enter>");
5167 else if (c == '\177')
5168 Sprintf(txt, "<del>"); /* "<delete>" won't fit */
5170 Strcpy(txt, visctrl((char) c));
5176 parseautocomplete(autocomplete, condition)
5180 struct ext_func_tab *efp;
5181 register char *autoc;
5183 /* break off first autocomplete from the rest; parse the rest */
5184 if ((autoc = index(autocomplete, ',')) != 0
5185 || (autoc = index(autocomplete, ':')) != 0) {
5187 parseautocomplete(autoc, condition);
5190 /* strip leading and trailing white space */
5191 autocomplete = trimspaces(autocomplete);
5196 /* take off negation */
5197 if (*autocomplete == '!') {
5198 /* unlike most options, a leading "no" might actually be a part of
5199 * the extended command. Thus you have to use ! */
5201 autocomplete = trimspaces(autocomplete);
5202 condition = !condition;
5205 /* find and modify the extended command */
5206 for (efp = extcmdlist; efp->ef_txt; efp++) {
5207 if (!strcmp(autocomplete, efp->ef_txt)) {
5209 efp->flags |= AUTOCOMPLETE;
5211 efp->flags &= ~AUTOCOMPLETE;
5216 /* not a real extended command */
5217 raw_printf("Bad autocomplete: invalid extended command '%s'.",
5222 /* called at startup and after number_pad is twiddled */
5224 reset_commands(initial)
5227 static const char sdir[] = "hykulnjb><",
5228 sdir_swap_yz[] = "hzkulnjb><",
5229 ndir[] = "47896321><",
5230 ndir_phone_layout[] = "41236987><";
5231 static const int ylist[] = {
5232 'y', 'Y', C('y'), M('y'), M('Y'), M(C('y'))
5234 static struct ext_func_tab *back_dir_cmd[8];
5235 const struct ext_func_tab *cmdtmp;
5237 int c, i, updated = 0;
5238 static boolean backed_dir_cmd = FALSE;
5242 Cmd.num_pad = FALSE;
5243 Cmd.pcHack_compat = Cmd.phone_layout = Cmd.swap_yz = FALSE;
5244 for (i = 0; i < SIZE(spkeys_binds); i++)
5245 Cmd.spkeys[spkeys_binds[i].nhkf] = spkeys_binds[i].key;
5249 if (backed_dir_cmd) {
5250 for (i = 0; i < 8; i++) {
5251 Cmd.commands[(uchar) Cmd.dirchars[i]] = back_dir_cmd[i];
5256 flagtemp = iflags.num_pad;
5257 if (flagtemp != Cmd.num_pad) {
5258 Cmd.num_pad = flagtemp;
5261 /* swap_yz mode (only applicable for !num_pad); intended for
5262 QWERTZ keyboard used in Central Europe, particularly Germany */
5263 flagtemp = (iflags.num_pad_mode & 1) ? !Cmd.num_pad : FALSE;
5264 if (flagtemp != Cmd.swap_yz) {
5265 Cmd.swap_yz = flagtemp;
5267 /* Cmd.swap_yz has been toggled;
5268 perform the swap (or reverse previous one) */
5269 for (i = 0; i < SIZE(ylist); i++) {
5270 c = ylist[i] & 0xff;
5271 cmdtmp = Cmd.commands[c]; /* tmp = [y] */
5272 Cmd.commands[c] = Cmd.commands[c + 1]; /* [y] = [z] */
5273 Cmd.commands[c + 1] = cmdtmp; /* [z] = tmp */
5276 /* MSDOS compatibility mode (only applicable for num_pad) */
5277 flagtemp = (iflags.num_pad_mode & 1) ? Cmd.num_pad : FALSE;
5278 if (flagtemp != Cmd.pcHack_compat) {
5279 Cmd.pcHack_compat = flagtemp;
5281 /* pcHack_compat has been toggled */
5283 cmdtmp = Cmd.commands['5'];
5284 Cmd.commands['5'] = Cmd.commands[c];
5285 Cmd.commands[c] = cmdtmp;
5287 Cmd.commands[c] = Cmd.pcHack_compat ? Cmd.commands['I'] : 0;
5289 /* phone keypad layout (only applicable for num_pad) */
5290 flagtemp = (iflags.num_pad_mode & 2) ? Cmd.num_pad : FALSE;
5291 if (flagtemp != Cmd.phone_layout) {
5292 Cmd.phone_layout = flagtemp;
5294 /* phone_layout has been toggled */
5295 for (i = 0; i < 3; i++) {
5296 c = '1' + i; /* 1,2,3 <-> 7,8,9 */
5297 cmdtmp = Cmd.commands[c]; /* tmp = [1] */
5298 Cmd.commands[c] = Cmd.commands[c + 6]; /* [1] = [7] */
5299 Cmd.commands[c + 6] = cmdtmp; /* [7] = tmp */
5300 c = (M('1') & 0xff) + i; /* M-1,M-2,M-3 <-> M-7,M-8,M-9 */
5301 cmdtmp = Cmd.commands[c]; /* tmp = [M-1] */
5302 Cmd.commands[c] = Cmd.commands[c + 6]; /* [M-1] = [M-7] */
5303 Cmd.commands[c + 6] = cmdtmp; /* [M-7] = tmp */
5310 Cmd.dirchars = !Cmd.num_pad
5311 ? (!Cmd.swap_yz ? sdir : sdir_swap_yz)
5312 : (!Cmd.phone_layout ? ndir : ndir_phone_layout);
5313 Cmd.alphadirchars = !Cmd.num_pad ? Cmd.dirchars : sdir;
5315 Cmd.move_W = Cmd.dirchars[0];
5316 Cmd.move_NW = Cmd.dirchars[1];
5317 Cmd.move_N = Cmd.dirchars[2];
5318 Cmd.move_NE = Cmd.dirchars[3];
5319 Cmd.move_E = Cmd.dirchars[4];
5320 Cmd.move_SE = Cmd.dirchars[5];
5321 Cmd.move_S = Cmd.dirchars[6];
5322 Cmd.move_SW = Cmd.dirchars[7];
5325 for (i = 0; i < 8; i++) {
5327 (struct ext_func_tab *) Cmd.commands[(uchar) Cmd.dirchars[i]];
5328 Cmd.commands[(uchar) Cmd.dirchars[i]] = (struct ext_func_tab *) 0;
5330 backed_dir_cmd = TRUE;
5331 for (i = 0; i < 8; i++)
5332 (void) bind_key(Cmd.dirchars[i], "nothing");
5336 /* non-movement commands which accept 'm' prefix to request menu operation */
5338 accept_menu_prefix(cmd_func)
5339 int NDECL((*cmd_func));
5341 if (cmd_func == dopickup || cmd_func == dotip
5342 /* eat, #offer, and apply tinning-kit all use floorfood() to pick
5343 an item on floor or in invent; 'm' skips picking from floor
5344 (ie, inventory only) rather than request use of menu operation */
5345 || cmd_func == doeat || cmd_func == dosacrifice || cmd_func == doapply
5346 /* 'm' for removing saddle from adjacent monster without checking
5347 for containers at <u.ux,u.uy> */
5348 || cmd_func == doloot
5349 /* travel: pop up a menu of interesting targets in view */
5350 || cmd_func == dotravel
5351 /* wizard mode ^V */
5352 || cmd_func == wiz_level_tele
5353 /* 'm' prefix allowed for some extended commands */
5354 || cmd_func == doextcmd || cmd_func == doextlist)
5360 ch2spkeys(c, start, end)
5366 for (i = start; i <= end; i++)
5367 if (Cmd.spkeys[i] == c)
5377 boolean do_walk, do_rush, prefix_seen, bad_command,
5378 firsttime = (cmd == 0);
5380 iflags.menu_requested = FALSE;
5382 if (program_state.done_hup)
5389 if (*cmd == Cmd.spkeys[NHKF_ESC]) {
5390 context.move = FALSE;
5393 if (*cmd == DOAGAIN && !in_doagain && saveq[0]) {
5396 rhack((char *) 0); /* read and execute command */
5400 /* Special case of *cmd == ' ' handled better below */
5401 if (!*cmd || *cmd == (char) 0377) {
5403 context.move = FALSE;
5404 return; /* probably we just had an interrupt */
5407 /* handle most movement commands */
5408 do_walk = do_rush = prefix_seen = FALSE;
5409 context.travel = context.travel1 = 0;
5410 spkey = ch2spkeys(*cmd, NHKF_RUN, NHKF_CLICKLOOK);
5414 if (movecmd(cmd[1])) {
5425 if (movecmd(lowc(cmd[1]))) {
5435 /* Effects of movement commands and invisible monsters:
5436 * m: always move onto space (even if 'I' remembered)
5437 * F: always attack space (even if 'I' not remembered)
5438 * normal movement: attack if 'I', move otherwise.
5441 if (movecmd(cmd[1])) {
5442 context.forcefight = 1;
5448 if (movecmd(cmd[1]) || u.dz) {
5454 cmd[0] = cmd[1]; /* "m<" or "m>" */
5458 case NHKF_RUN_NOPICKUP:
5459 if (movecmd(lowc(cmd[1]))) {
5469 (void) ddoinv(); /* a convenience borrowed from the PC */
5470 context.move = FALSE;
5473 case NHKF_CLICKLOOK:
5474 if (iflags.clicklook) {
5475 context.move = FALSE;
5476 do_look(2, &clicklook_cc);
5480 if (flags.travelcmd) {
5482 context.travel1 = 1;
5490 if (movecmd(*cmd)) { /* ordinary movement */
5491 context.run = 0; /* only matters here if it was 8 */
5493 } else if (movecmd(Cmd.num_pad ? unmeta(*cmd) : lowc(*cmd))) {
5496 } else if (movecmd(unctrl(*cmd))) {
5503 /* some special prefix handling */
5504 /* overload 'm' prefix to mean "request a menu" */
5505 if (prefix_seen && cmd[0] == Cmd.spkeys[NHKF_REQMENU]) {
5506 /* (for func_tab cast, see below) */
5507 const struct ext_func_tab *ft = Cmd.commands[cmd[1] & 0xff];
5508 int NDECL((*func)) = ft ? ((struct ext_func_tab *) ft)->ef_funct : 0;
5510 if (func && accept_menu_prefix(func)) {
5511 iflags.menu_requested = TRUE;
5516 if ((do_walk || do_rush) && !context.travel && !dxdy_moveok()) {
5517 /* trying to move diagonally as a grid bug;
5518 this used to be treated by movecmd() as not being
5519 a movement attempt, but that didn't provide for any
5520 feedback and led to strangeness if the key pressed
5521 ('u' in particular) was overloaded for num_pad use */
5523 You_cant("get there from here...");
5525 You_cant("
\82±
\82±
\82©
\82ç
\82»
\82±
\82Ö
\82Í
\8ds
\82¯
\82Ü
\82¹
\82ñ
\81D
\81D
\81D");
5527 context.nopick = context.forcefight = FALSE;
5528 context.move = context.mv = FALSE;
5537 context.forcefight = 0;
5539 } else if (do_rush) {
5542 multi = max(COLNO, ROWNO);
5543 u.last_str_turn = 0;
5548 } else if (prefix_seen && cmd[1] == Cmd.spkeys[NHKF_ESC]) {
5549 /* <prefix><escape> */
5550 /* don't report "unknown command" for change of heart... */
5551 bad_command = FALSE;
5552 } else if (*cmd == ' ' && !flags.rest_on_space) {
5553 bad_command = TRUE; /* skip cmdlist[] loop */
5555 /* handle all other commands */
5557 register const struct ext_func_tab *tlist;
5558 int res, NDECL((*func));
5560 /* current - use *cmd to directly index cmdlist array */
5561 if ((tlist = Cmd.commands[*cmd & 0xff]) != 0) {
5562 if (!wizard && (tlist->flags & WIZMODECMD)) {
5564 You_cant("do that!");
5566 pline("
\82»
\82ê
\82Í
\82Å
\82«
\82Ü
\82¹
\82ñ
\81I");
5568 } else if (u.uburied && !(tlist->flags & IFBURIED)) {
5570 You_cant("do that while you are buried!");
5572 You("
\96\84\82Ü
\82Á
\82Ä
\82¢
\82é
\8e\9e\82É
\82»
\82ñ
\82È
\82±
\82Æ
\82Í
\82Å
\82«
\82È
\82¢
\81I");
5575 /* we discard 'const' because some compilers seem to have
5576 trouble with the pointer passed to set_occupation() */
5577 func = ((struct ext_func_tab *) tlist)->ef_funct;
5578 if (tlist->f_text && !occupation && multi)
5579 set_occupation(func, tlist->f_text, multi);
5580 res = (*func)(); /* perform the command */
5583 context.move = FALSE;
5588 /* if we reach here, cmd wasn't found in cmdlist[] */
5593 char expcmd[20]; /* we expect 'cmd' to point to 1 or 2 chars */
5594 char c, c1 = cmd[1];
5597 while ((c = *cmd++) != '\0')
5598 Strcat(expcmd, visctrl(c)); /* add 1..4 chars plus terminator */
5601 if (!prefix_seen || !help_dir(c1, spkey, "Invalid direction key!"))
5603 if (!prefix_seen || !help_dir(c1, spkey, "
\96³
\8cø
\82È
\95û
\8cü
\8ew
\92è
\82Å
\82·
\81I"))
5605 Norep("Unknown command '%s'.", expcmd);
5607 Norep("'%s'
\83R
\83}
\83\93\83h
\81H", expcmd);
5610 context.move = FALSE;
5615 /* convert an x,y pair into a direction code */
5622 for (dd = 0; dd < 8; dd++)
5623 if (x == xdir[dd] && y == ydir[dd])
5628 /* convert a direction code into an x,y pair */
5639 /* also sets u.dz, but returns false for <> */
5644 register const char *dp = index(Cmd.dirchars, sym);
5649 u.dx = xdir[dp - Cmd.dirchars];
5650 u.dy = ydir[dp - Cmd.dirchars];
5651 u.dz = zdir[dp - Cmd.dirchars];
5652 #if 0 /* now handled elsewhere */
5653 if (u.dx && u.dy && NODIAG(u.umonnum)) {
5661 /* grid bug handling which used to be in movecmd() */
5665 if (u.dx && u.dy && NODIAG(u.umonnum))
5667 return u.dx || u.dy;
5670 /* decide whether a character (user input keystroke) requests screen repaint */
5675 return (boolean) (c == Cmd.spkeys[NHKF_REDRAW]
5676 || (Cmd.num_pad && c == Cmd.spkeys[NHKF_REDRAW2]));
5683 return (c == Cmd.spkeys[NHKF_RUSH]
5684 || c == Cmd.spkeys[NHKF_RUN]
5685 || c == Cmd.spkeys[NHKF_NOPICKUP]
5686 || c == Cmd.spkeys[NHKF_RUN_NOPICKUP]
5687 || c == Cmd.spkeys[NHKF_FIGHT]
5688 || (Cmd.num_pad && (c == Cmd.spkeys[NHKF_RUN2]
5689 || c == Cmd.spkeys[NHKF_FIGHT2])));
5693 * uses getdir() but unlike getdir() it specifically
5694 * produces coordinates using the direction from getdir()
5695 * and verifies that those coordinates are ok.
5697 * If the call to getdir() returns 0, Never_mind is displayed.
5698 * If the resulting coordinates are not okay, emsg is displayed.
5700 * Returns non-zero if coordinates in cc are valid.
5703 get_adjacent_loc(prompt, emsg, x, y, cc)
5704 const char *prompt, *emsg;
5709 if (!getdir(prompt)) {
5715 if (cc && isok(new_x, new_y)) {
5734 if (in_doagain || *readchar_queue)
5735 dirsym = readchar();
5738 dirsym = yn_function((s && *s != '^') ? s : "In what direction?",
5740 dirsym = yn_function((s && *s != '^') ? s : "
\82Ç
\82Ì
\95û
\8cü
\81H",
5742 /* remove the prompt string so caller won't have to */
5743 clear_nhwindow(WIN_MESSAGE);
5745 if (redraw_cmd(dirsym)) { /* ^R */
5746 docrt(); /* redraw */
5751 if (dirsym == Cmd.spkeys[NHKF_GETDIR_SELF]
5752 || dirsym == Cmd.spkeys[NHKF_GETDIR_SELF2]) {
5753 u.dx = u.dy = u.dz = 0;
5754 } else if (!(is_mov = movecmd(dirsym)) && !u.dz) {
5755 boolean did_help = FALSE, help_requested;
5757 if (!index(quitchars, dirsym)) {
5758 help_requested = (dirsym == Cmd.spkeys[NHKF_GETDIR_HELP]);
5759 if (help_requested || iflags.cmdassist) {
5760 did_help = help_dir((s && *s == '^') ? dirsym : '\0',
5762 help_requested ? (const char *) 0
5764 : "Invalid direction key!");
5766 : "
\96³
\8cø
\82È
\95û
\8cü
\8ew
\92è
\82Å
\82·
\81I");
5772 pline("What a strange direction!");
5774 pline("
\82¸
\82¢
\82Ô
\82ñ
\82Æ
\8aï
\96
\82È
\95û
\8cü
\82¾
\81I");
5777 } else if (is_mov && !dxdy_moveok()) {
5779 You_cant("orient yourself that direction.");
5781 You_cant("
\8cü
\82«
\82É
\8e©
\95ª
\8e©
\90g
\82ð
\8ew
\92è
\82Å
\82«
\82È
\82¢
\81D");
5784 if (!u.dz && (Stunned || (Confusion && !rn2(5))))
5790 show_direction_keys(win, centerchar, nodiag)
5791 winid win; /* should specify a window which is using a fixed-width font... */
5792 char centerchar; /* '.' or '@' or ' ' */
5801 Sprintf(buf, " %c ", Cmd.move_N);
5802 putstr(win, 0, buf);
5803 putstr(win, 0, " | ");
5804 Sprintf(buf, " %c- %c -%c",
5805 Cmd.move_W, centerchar, Cmd.move_E);
5806 putstr(win, 0, buf);
5807 putstr(win, 0, " | ");
5808 Sprintf(buf, " %c ", Cmd.move_S);
5809 putstr(win, 0, buf);
5811 Sprintf(buf, " %c %c %c",
5812 Cmd.move_NW, Cmd.move_N, Cmd.move_NE);
5813 putstr(win, 0, buf);
5814 putstr(win, 0, " \\ | / ");
5815 Sprintf(buf, " %c- %c -%c",
5816 Cmd.move_W, centerchar, Cmd.move_E);
5817 putstr(win, 0, buf);
5818 putstr(win, 0, " / | \\ ");
5819 Sprintf(buf, " %c %c %c",
5820 Cmd.move_SW, Cmd.move_S, Cmd.move_SE);
5821 putstr(win, 0, buf);
5825 /* explain choices if player has asked for getdir() help or has given
5826 an invalid direction after a prefix key ('F', 'g', 'm', &c), which
5827 might be bogus but could be up, down, or self when not applicable */
5829 help_dir(sym, spkey, msg)
5831 int spkey; /* NHKF_ code for prefix key, if one was used, or for ESC */
5834 static const char wiz_only_list[] = "EFGIVW";
5837 char buf[BUFSZ], buf2[BUFSZ], *explain;
5838 const char *dothat, *how;
5839 boolean prefixhandling, viawindow;
5841 /* NHKF_ESC indicates that player asked for help at getdir prompt */
5842 viawindow = (spkey == NHKF_ESC || iflags.cmdassist);
5843 prefixhandling = (spkey != NHKF_ESC);
5845 * Handling for prefix keys that don't want special directions.
5846 * Delivered via pline if 'cmdassist' is off, or instead of the
5847 * general message if it's on.
5850 how = " at"; /* for "<action> at yourself"; not used for up/down */
5863 case NHKF_RUN_NOPICKUP:
5872 how = ""; /* avoid "fight at yourself" */
5875 prefixhandling = FALSE;
5880 /* for movement prefix followed by '.' or (numpad && 's') to mean 'self';
5881 note: '-' for hands (inventory form of 'self') is not handled here */
5883 && (sym == Cmd.spkeys[NHKF_GETDIR_SELF]
5884 || (Cmd.num_pad && sym == Cmd.spkeys[NHKF_GETDIR_SELF2]))) {
5885 Sprintf(buf, "You can't %s%s yourself.", dothat, how);
5886 /* for movement prefix followed by up or down */
5887 } else if (prefixhandling && (sym == '<' || sym == '>')) {
5888 Sprintf(buf, "You can't %s %s.", dothat,
5889 /* was "upwards" and "downwards", but they're considered
5890 to be variants of canonical "upward" and "downward" */
5891 (sym == '<') ? "upward" : "downward");
5894 /* if '!cmdassist', display via pline() and we're done (note: asking
5895 for help at getdir() prompt forces cmdassist for this operation) */
5897 if (prefixhandling) {
5899 Sprintf(buf, "Invalid direction for '%s' prefix.",
5900 visctrl(Cmd.spkeys[spkey]));
5904 /* when 'cmdassist' is off and caller doesn't insist, do nothing */
5908 win = create_nhwindow(NHW_TEXT);
5913 /* show bad-prefix message instead of general invalid-direction one */
5914 putstr(win, 0, buf);
5917 Sprintf(buf, "cmdassist: %s", msg);
5918 putstr(win, 0, buf);
5922 if (!prefixhandling && (letter(sym) || sym == '[')) {
5923 /* '[': old 'cmdhelp' showed ESC as ^[ */
5924 sym = highc(sym); /* @A-Z[ (note: letter() accepts '@') */
5925 ctrl = (sym - 'A') + 1; /* 0-27 (note: 28-31 aren't applicable) */
5926 if ((explain = dowhatdoes_core(ctrl, buf2)) != 0
5927 && (!index(wiz_only_list, sym) || wizard)) {
5928 Sprintf(buf, "Are you trying to use ^%c%s?", sym,
5929 index(wiz_only_list, sym) ? ""
5930 : " as specified in the Guidebook");
5931 putstr(win, 0, buf);
5933 putstr(win, 0, explain);
5936 "To use that command, hold down the <Ctrl> key as a shift");
5937 Sprintf(buf, "and press the <%c> key.", sym);
5938 putstr(win, 0, buf);
5943 Sprintf(buf, "Valid direction keys%s%s%s are:",
5944 prefixhandling ? " to " : "", prefixhandling ? dothat : "",
5945 NODIAG(u.umonnum) ? " in your current form" : "");
5946 putstr(win, 0, buf);
5947 show_direction_keys(win, !prefixhandling ? '.' : ' ', NODIAG(u.umonnum));
5949 if (!prefixhandling || spkey == NHKF_NOPICKUP) {
5950 /* NOPICKUP: unlike the other prefix keys, 'm' allows up/down for
5951 stair traversal; we won't get here when "m<" or "m>" has been
5952 given but we include up and down for 'm'+invalid_direction;
5953 self is excluded as a viable direction for every prefix */
5955 putstr(win, 0, " < up");
5956 putstr(win, 0, " > down");
5957 if (!prefixhandling) {
5958 int selfi = Cmd.num_pad ? NHKF_GETDIR_SELF2 : NHKF_GETDIR_SELF;
5960 Sprintf(buf, " %4s direct at yourself",
5961 visctrl(Cmd.spkeys[selfi]));
5962 putstr(win, 0, buf);
5967 /* non-null msg means that this wasn't an explicit user request */
5971 "(Suppress this message with !cmdassist in config file.)");
5973 "(
\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)");
5975 display_nhwindow(win, FALSE);
5976 destroy_nhwindow(win);
5983 register int x = NODIAG(u.umonnum) ? 2 * rn2(4) : rn2(8);
5994 static NEARDATA const char *const dirnames[] = {
5995 "west", "northwest", "north", "northeast", "east",
5996 "southeast", "south", "southwest", "down", "up",
5999 if (dir < 0 || dir >= SIZE(dirnames))
6001 return dirnames[dir];
6008 /* x corresponds to curx, so x==1 is the first column. Ach. %% */
6009 return x >= 1 && x <= COLNO - 1 && y >= 0 && y <= ROWNO - 1;
6012 /* #herecmdmenu command */
6014 doherecmdmenu(VOID_ARGS)
6016 char ch = here_cmd_menu(TRUE);
6021 /* #therecmdmenu command, a way to test there_cmd_menu without mouse */
6023 dotherecmdmenu(VOID_ARGS)
6027 if (!getdir((const char *) 0) || !isok(u.ux + u.dx, u.uy + u.dy))
6031 ch = there_cmd_menu(TRUE, u.ux + u.dx, u.uy + u.dy);
6033 ch = here_cmd_menu(TRUE);
6039 add_herecmd_menuitem(win, func, text)
6047 if ((ch = cmd_from_func(func)) != '\0') {
6050 add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, text, MENU_UNSELECTED);
6055 there_cmd_menu(doit, x, y)
6062 schar typ = levl[x][y].typ;
6064 menu_item *picks = (menu_item *) 0;
6068 win = create_nhwindow(NHW_MENU);
6072 boolean key_or_pick, card;
6073 int dm = levl[x][y].doormask;
6075 if ((dm & (D_CLOSED | D_LOCKED))) {
6076 add_herecmd_menuitem(win, doopen, "Open the door"), ++K;
6077 /* unfortunately there's no lknown flag for doors to
6078 remember the locked/unlocked state */
6079 key_or_pick = (carrying(SKELETON_KEY) || carrying(LOCK_PICK));
6080 card = (carrying(CREDIT_CARD) != 0);
6081 if (key_or_pick || card) {
6082 Sprintf(buf, "%sunlock the door",
6083 key_or_pick ? "lock or " : "");
6084 add_herecmd_menuitem(win, doapply, upstart(buf)), ++K;
6086 /* unfortunately there's no tknown flag for doors (or chests)
6087 to remember whether a trap had been found */
6088 add_herecmd_menuitem(win, dountrap,
6089 "Search the door for a trap"), ++K;
6090 /* [what about #force?] */
6091 add_herecmd_menuitem(win, dokick, "Kick the door"), ++K;
6092 } else if ((dm & D_ISOPEN)) {
6093 add_herecmd_menuitem(win, doclose, "Close the door"), ++K;
6098 add_herecmd_menuitem(win, dosearch, "Search for secret doors"), ++K;
6100 if ((ttmp = t_at(x, y)) != 0 && ttmp->tseen) {
6101 add_herecmd_menuitem(win, doidtrap, "Examine trap"), ++K;
6102 if (ttmp->ttyp != VIBRATING_SQUARE)
6103 add_herecmd_menuitem(win, dountrap, "Attempt to disarm trap"), ++K;
6107 if (mtmp && !canspotmon(mtmp))
6109 if (mtmp && which_armor(mtmp, W_SADDLE)) {
6110 char *mnam = x_monnam(mtmp, ARTICLE_THE, (char *) 0,
6111 SUPPRESS_SADDLE, FALSE);
6114 Sprintf(buf, "Ride %s", mnam);
6115 add_herecmd_menuitem(win, doride, buf), ++K;
6117 Sprintf(buf, "Remove saddle from %s", mnam);
6118 add_herecmd_menuitem(win, doloot, buf), ++K;
6120 if (mtmp && can_saddle(mtmp) && !which_armor(mtmp, W_SADDLE)
6121 && carrying(SADDLE)) {
6122 Sprintf(buf, "Put saddle on %s", mon_nam(mtmp)), ++K;
6123 add_herecmd_menuitem(win, doapply, buf);
6126 if (mtmp || glyph_is_invisible(glyph_at(x, y))) {
6127 /* "Attack %s", mtmp ? mon_nam(mtmp) : "unseen creature" */
6129 /* "Move %s", direction */
6134 end_menu(win, "What do you want to do?");
6135 npick = select_menu(win, PICK_ONE, &picks);
6137 pline("No applicable actions.");
6140 destroy_nhwindow(win);
6143 int NDECL((*func)) = picks->item.a_nfunc;
6144 free((genericptr_t) picks);
6147 int ret = (*func)();
6151 ch = cmd_from_func(func);
6164 schar typ = levl[u.ux][u.uy].typ;
6166 menu_item *picks = (menu_item *) 0;
6168 win = create_nhwindow(NHW_MENU);
6171 if (IS_FOUNTAIN(typ) || IS_SINK(typ)) {
6172 Sprintf(buf, "Drink from the %s",
6173 defsyms[IS_FOUNTAIN(typ) ? S_fountain : S_sink].explanation);
6174 add_herecmd_menuitem(win, dodrink, buf);
6176 if (IS_FOUNTAIN(typ))
6177 add_herecmd_menuitem(win, dodip,
6178 "Dip something into the fountain");
6180 add_herecmd_menuitem(win, dosit,
6181 "Sit on the throne");
6183 if ((u.ux == xupstair && u.uy == yupstair)
6184 || (u.ux == sstairs.sx && u.uy == sstairs.sy && sstairs.up)
6185 || (u.ux == xupladder && u.uy == yupladder)) {
6186 Sprintf(buf, "Go up the %s",
6187 (u.ux == xupladder && u.uy == yupladder)
6188 ? "ladder" : "stairs");
6189 add_herecmd_menuitem(win, doup, buf);
6191 if ((u.ux == xdnstair && u.uy == ydnstair)
6192 || (u.ux == sstairs.sx && u.uy == sstairs.sy && !sstairs.up)
6193 || (u.ux == xdnladder && u.uy == ydnladder)) {
6194 Sprintf(buf, "Go down the %s",
6195 (u.ux == xupladder && u.uy == yupladder)
6196 ? "ladder" : "stairs");
6197 add_herecmd_menuitem(win, dodown, buf);
6199 if (u.usteed) { /* another movement choice */
6200 Sprintf(buf, "Dismount %s",
6201 x_monnam(u.usteed, ARTICLE_THE, (char *) 0,
6202 SUPPRESS_SADDLE, FALSE));
6203 add_herecmd_menuitem(win, doride, buf);
6207 if (Upolyd) { /* before objects */
6208 Sprintf(buf, "Use %s special ability",
6209 s_suffix(mons[u.umonnum].mname));
6210 add_herecmd_menuitem(win, domonability, buf);
6214 if (OBJ_AT(u.ux, u.uy)) {
6215 struct obj *otmp = level.objects[u.ux][u.uy];
6217 Sprintf(buf, "Pick up %s", otmp->nexthere ? "items" : doname(otmp));
6218 add_herecmd_menuitem(win, dopickup, buf);
6220 if (Is_container(otmp)) {
6221 Sprintf(buf, "Loot %s", doname(otmp));
6222 add_herecmd_menuitem(win, doloot, buf);
6224 if (otmp->oclass == FOOD_CLASS) {
6225 Sprintf(buf, "Eat %s", doname(otmp));
6226 add_herecmd_menuitem(win, doeat, buf);
6231 add_herecmd_menuitem(win, dodrop, "Drop items");
6233 add_herecmd_menuitem(win, donull, "Rest one turn");
6234 add_herecmd_menuitem(win, dosearch, "Search around you");
6235 add_herecmd_menuitem(win, dolook, "Look at what is here");
6237 end_menu(win, "What do you want to do?");
6238 npick = select_menu(win, PICK_ONE, &picks);
6239 destroy_nhwindow(win);
6242 int NDECL((*func)) = picks->item.a_nfunc;
6243 free((genericptr_t) picks);
6246 int ret = (*func)();
6250 ch = cmd_from_func(func);
6257 static NEARDATA int last_multi;
6260 * convert a MAP window position into a movecmd
6263 click_to_cmd(x, y, mod)
6270 if (iflags.clicklook && mod == CLICK_2) {
6273 cmd[0] = Cmd.spkeys[NHKF_CLICKLOOK];
6280 if (flags.travelcmd) {
6281 if (abs(x) <= 1 && abs(y) <= 1) {
6282 x = sgn(x), y = sgn(y);
6286 cmd[0] = Cmd.spkeys[NHKF_TRAVEL];
6290 if (x == 0 && y == 0) {
6291 if (iflags.herecmd_menu) {
6292 cmd[0] = here_cmd_menu(FALSE);
6297 if (IS_FOUNTAIN(levl[u.ux][u.uy].typ)
6298 || IS_SINK(levl[u.ux][u.uy].typ)) {
6299 cmd[0] = cmd_from_func(mod == CLICK_1 ? dodrink : dodip);
6301 } else if (IS_THRONE(levl[u.ux][u.uy].typ)) {
6302 cmd[0] = cmd_from_func(dosit);
6304 } else if ((u.ux == xupstair && u.uy == yupstair)
6305 || (u.ux == sstairs.sx && u.uy == sstairs.sy
6307 || (u.ux == xupladder && u.uy == yupladder)) {
6308 cmd[0] = cmd_from_func(doup);
6310 } else if ((u.ux == xdnstair && u.uy == ydnstair)
6311 || (u.ux == sstairs.sx && u.uy == sstairs.sy
6313 || (u.ux == xdnladder && u.uy == ydnladder)) {
6314 cmd[0] = cmd_from_func(dodown);
6316 } else if (OBJ_AT(u.ux, u.uy)) {
6317 cmd[0] = cmd_from_func(Is_container(level.objects[u.ux][u.uy])
6318 ? doloot : dopickup);
6321 cmd[0] = cmd_from_func(donull); /* just rest */
6326 /* directional commands */
6330 if (!m_at(u.ux + x, u.uy + y)
6331 && !test_move(u.ux, u.uy, x, y, TEST_MOVE)) {
6332 cmd[1] = Cmd.dirchars[dir];
6334 if (iflags.herecmd_menu) {
6335 cmd[0] = there_cmd_menu(FALSE, u.ux + x, u.uy + y);
6341 if (IS_DOOR(levl[u.ux + x][u.uy + y].typ)) {
6342 /* slight assistance to the player: choose kick/open for them
6344 if (levl[u.ux + x][u.uy + y].doormask & D_LOCKED) {
6345 cmd[0] = cmd_from_func(dokick);
6348 if (levl[u.ux + x][u.uy + y].doormask & D_CLOSED) {
6349 cmd[0] = cmd_from_func(doopen);
6353 if (levl[u.ux + x][u.uy + y].typ <= SCORR) {
6354 cmd[0] = cmd_from_func(dosearch);
6360 /* convert without using floating point, allowing sloppy clicking */
6363 else if (y > 2 * abs(x))
6365 else if (x < -2 * abs(y))
6367 else if (y < -2 * abs(x))
6370 x = sgn(x), y = sgn(y);
6372 if (x == 0 && y == 0) {
6373 /* map click on player to "rest" command */
6374 cmd[0] = cmd_from_func(donull);
6380 /* move, attack, etc. */
6382 if (mod == CLICK_1) {
6383 cmd[0] = Cmd.dirchars[dir];
6385 cmd[0] = (Cmd.num_pad
6386 ? M(Cmd.dirchars[dir])
6387 : (Cmd.dirchars[dir] - 'a' + 'A')); /* run command */
6394 get_count(allowchars, inkey, maxcount, count, historical)
6399 boolean historical; /* whether to include in message history: True => yes */
6404 boolean backspaced = FALSE;
6405 /* this should be done in port code so that we have erase_char
6406 and kill_char available; we can at least fake erase_char */
6407 #define STANDBY_erase_char '\177'
6417 cnt = 10L * cnt + (long) (key - '0');
6420 else if (maxcount > 0 && cnt > maxcount)
6422 } else if (cnt && (key == '\b' || key == STANDBY_erase_char)) {
6425 } else if (key == Cmd.spkeys[NHKF_ESC]) {
6427 } else if (!allowchars || index(allowchars, key)) {
6432 if (cnt > 9 || backspaced) {
6433 clear_nhwindow(WIN_MESSAGE);
6434 if (backspaced && !cnt) {
6436 Sprintf(qbuf, "Count: ");
6438 Sprintf(qbuf, "
\90\94: ");
6441 Sprintf(qbuf, "Count: %ld", cnt);
6443 Sprintf(qbuf, "
\90\94: %ld", cnt);
6446 /* bypassing pline() keeps intermediate prompt out of
6447 DUMPLOG message history */
6448 putstr(WIN_MESSAGE, 0, qbuf);
6455 Sprintf(qbuf, "Count: %ld ", *count);
6457 Sprintf(qbuf, "
\90\94: %ld ", *count);
6458 (void) key2txt((uchar) key, eos(qbuf));
6459 putmsghistory(qbuf, FALSE);
6469 #ifdef LINT /* static char in_line[COLNO]; */
6470 char in_line[COLNO];
6472 static char in_line[COLNO];
6475 boolean prezero = FALSE;
6477 iflags.in_parse = TRUE;
6480 flush_screen(1); /* Flush screen buffer. Put the cursor on the hero. */
6483 alt_esc = iflags.altmeta; /* readchar() hack */
6485 if (!Cmd.num_pad || (foo = readchar()) == Cmd.spkeys[NHKF_COUNT]) {
6486 long tmpmulti = multi;
6488 foo = get_count((char *) 0, '\0', LARGEST_INT, &tmpmulti, FALSE);
6489 last_multi = multi = tmpmulti;
6492 alt_esc = FALSE; /* readchar() reset */
6495 if (foo == Cmd.spkeys[NHKF_ESC]) { /* esc cancels count (TH) */
6496 clear_nhwindow(WIN_MESSAGE);
6497 multi = last_multi = 0;
6498 } else if (foo == Cmd.spkeys[NHKF_DOAGAIN] || in_doagain) {
6502 savech(0); /* reset input queue */
6510 save_cm = (char *) 0;
6512 /* in 3.4.3 this was in rhack(), where it was too late to handle M-5 */
6513 if (Cmd.pcHack_compat) {
6514 /* This handles very old inconsistent DOS/Windows behaviour
6515 in a different way: earlier, the keyboard handler mapped
6516 these, which caused counts to be strange when entered
6517 from the number pad. Now do not map them until here. */
6520 foo = Cmd.spkeys[NHKF_RUSH];
6523 foo = Cmd.spkeys[NHKF_RUN];
6526 foo = Cmd.spkeys[NHKF_DOINV];
6535 if (prefix_cmd(foo)) {
6541 clear_nhwindow(WIN_MESSAGE);
6543 in_line[0] = Cmd.spkeys[NHKF_ESC];
6545 iflags.in_parse = FALSE;
6549 #ifdef HANGUPHANDLING
6550 /* some very old systems, or descendents of such systems, expect signal
6551 handlers to have return type `int', but they don't actually inspect
6552 the return value so we should be safe using `void' unconditionally */
6555 hangup(sig_unused) /* called as signal() handler, so sent at least one arg */
6556 int sig_unused UNUSED;
6558 if (program_state.exiting)
6559 program_state.in_moveloop = 0;
6562 /* When using SAFERHANGUP, the done_hup flag it tested in rhack
6563 and a couple of other places; actual hangup handling occurs then.
6564 This is 'safer' because it disallows certain cheats and also
6565 protects against losing objects in the process of being thrown,
6566 but also potentially riskier because the disconnected program
6567 must continue running longer before attempting a hangup save. */
6568 program_state.done_hup++;
6569 /* defer hangup iff game appears to be in progress */
6570 if (program_state.in_moveloop && program_state.something_worth_saving)
6572 #endif /* SAFERHANGUP */
6579 #ifdef NOSAVEONHANGUP
6581 if (flags.ins_chkpt && program_state.something_worth_saving)
6582 program_statue.preserve_locks = 1; /* keep files for recovery */
6584 program_state.something_worth_saving = 0; /* don't save */
6588 if (!program_state.done_hup++)
6590 if (program_state.something_worth_saving)
6592 if (iflags.window_inited)
6593 exit_nhwindows((char *) 0);
6595 nh_terminate(EXIT_SUCCESS);
6596 /*NOTREACHED*/ /* not necessarily true for vms... */
6599 #endif /* HANGUPHANDLING */
6605 int x = u.ux, y = u.uy, mod = 0;
6607 if (*readchar_queue)
6608 sym = *readchar_queue++;
6610 sym = in_doagain ? pgetchar() : nh_poskey(&x, &y, &mod);
6614 register int cnt = NR_OF_EOFS;
6616 * Some SYSV systems seem to return EOFs for various reasons
6617 * (?like when one hits break or for interrupted systemcalls?),
6618 * and we must see several before we quit.
6621 clearerr(stdin); /* omit if clearerr is undefined */
6623 } while (--cnt && sym == EOF);
6625 #endif /* NR_OF_EOFS */
6628 #ifdef HANGUPHANDLING
6629 hangup(0); /* call end_of_input() or set program_state.done_hup */
6633 } else if (sym == '\033' && alt_esc) {
6634 /* iflags.altmeta: treat two character ``ESC c'' as single `M-c' */
6635 sym = *readchar_queue ? *readchar_queue++ : pgetchar();
6636 if (sym == EOF || sym == 0)
6638 else if (sym != '\033')
6639 sym |= 0200; /* force 8th bit on */
6641 } else if (sym == 0) {
6643 readchar_queue = click_to_cmd(x, y, mod);
6644 sym = *readchar_queue++;
6652 /* Keyboard travel command */
6656 if (!flags.travelcmd)
6659 cc.x = iflags.travelcc.x;
6660 cc.y = iflags.travelcc.y;
6661 if (cc.x == -1 && cc.y == -1) {
6662 /* No cached destination, start attempt from current position */
6666 iflags.getloc_travelmode = TRUE;
6667 if (iflags.menu_requested) {
6668 int gf = iflags.getloc_filter;
6669 iflags.getloc_filter = GFILTER_VIEW;
6670 if (!getpos_menu(&cc, GLOC_INTERESTING)) {
6671 iflags.getloc_filter = gf;
6672 iflags.getloc_travelmode = FALSE;
6675 iflags.getloc_filter = gf;
6678 pline("Where do you want to travel to?");
6680 pline("
\82Ç
\82±
\82É
\88Ú
\93®
\82·
\82é
\81H");
6682 if (getpos(&cc, TRUE, "the desired destination") < 0) {
6684 if (getpos(&cc, TRUE, "
\88Ú
\93®
\90æ") < 0) {
6685 /* user pressed ESC */
6686 iflags.getloc_travelmode = FALSE;
6690 iflags.getloc_travelmode = FALSE;
6691 iflags.travelcc.x = u.tx = cc.x;
6692 iflags.travelcc.y = u.ty = cc.y;
6693 cmd[0] = Cmd.spkeys[NHKF_TRAVEL];
6694 readchar_queue = cmd;
6699 extern void NDECL(win32con_debug_keystrokes);
6700 extern void NDECL(win32con_handler_info);
6709 int num_menu_selections;
6710 struct menu_selection_struct {
6713 } menu_selections[] = {
6715 { "test win32 keystrokes (tty only)", win32con_debug_keystrokes },
6716 { "show keystroke handler information (tty only)",
6717 win32con_handler_info },
6719 { (char *) 0, (void NDECL((*))) 0 } /* array terminator */
6722 num_menu_selections = SIZE(menu_selections) - 1;
6723 if (num_menu_selections > 0) {
6724 menu_item *pick_list;
6726 win = create_nhwindow(NHW_MENU);
6728 for (k = 0; k < num_menu_selections; ++k) {
6730 add_menu(win, NO_GLYPH, &any, item++, 0, ATR_NONE,
6731 menu_selections[k].menutext, MENU_UNSELECTED);
6733 end_menu(win, "Which port debugging feature?");
6734 n = select_menu(win, PICK_ONE, &pick_list);
6735 destroy_nhwindow(win);
6737 n = pick_list[0].item.a_int - 1;
6738 free((genericptr_t) pick_list);
6739 /* execute the function */
6740 (*menu_selections[n].fn)();
6743 pline("No port-specific debug capability defined.");
6746 #endif /*PORT_DEBUG*/
6749 * Parameter validator for generic yes/no function to prevent
6750 * the core from sending too long a prompt string to the
6751 * window port causing a buffer overflow there.
6754 yn_function(query, resp, def)
6755 const char *query, *resp;
6758 char res, qbuf[QBUFSZ];
6760 extern unsigned saved_pline_index; /* pline.c */
6761 unsigned idx = saved_pline_index;
6762 /* buffer to hold query+space+formatted_single_char_response */
6763 char dumplog_buf[QBUFSZ + 1 + 15]; /* [QBUFSZ+1+7] should suffice */
6766 iflags.last_msg = PLNMSG_UNKNOWN; /* most recent pline is clobbered */
6768 /* maximum acceptable length is QBUFSZ-1 */
6769 if (strlen(query) >= QBUFSZ) {
6770 /* caller shouldn't have passed anything this long */
6771 paniclog("Query truncated: ", query);
6772 (void) strncpy(qbuf, query, QBUFSZ - 1 - 3);
6773 Strcpy(&qbuf[QBUFSZ - 1 - 3], "...");
6776 res = (*windowprocs.win_yn_function)(query, resp, def);
6778 if (idx == saved_pline_index) {
6779 /* when idx is still the same as saved_pline_index, the interface
6780 didn't put the prompt into saved_plines[]; we put a simplified
6781 version in there now (without response choices or default) */
6782 Sprintf(dumplog_buf, "%s ", query);
6783 (void) key2txt((uchar) res, eos(dumplog_buf));
6784 dumplogmsg(dumplog_buf);
6790 /* for paranoid_confirm:quit,die,attack prompting */
6792 paranoid_query(be_paranoid, prompt)
6793 boolean be_paranoid;
6796 boolean confirmed_ok;
6798 /* when paranoid, player must respond with "yes" rather than just 'y'
6799 to give the go-ahead for this query; default is "no" unless the
6800 ParanoidConfirm flag is set in which case there's no default */
6802 char qbuf[QBUFSZ], ans[BUFSZ] = DUMMY;
6803 const char *promptprefix = "", *responsetype = ParanoidConfirm
6806 int trylimit = 6; /* 1 normal, 5 more with "Yes or No:" prefix */
6808 /* in addition to being paranoid about this particular
6809 query, we might be even more paranoid about all paranoia
6810 responses (ie, ParanoidConfirm is set) in which case we
6811 require "no" to reject in addition to "yes" to confirm
6812 (except we won't loop if response is ESC; it means no) */
6814 Sprintf(qbuf, "%s%s %s", promptprefix, prompt, responsetype);
6816 (void) mungspaces(ans);
6817 confirmed_ok = !strcmpi(ans, "yes");
6818 if (confirmed_ok || *ans == '\033')
6820 promptprefix = "\"Yes\" or \"No\": ";
6821 } while (ParanoidConfirm && strcmpi(ans, "no") && --trylimit);
6823 confirmed_ok = (yn(prompt) == 'y');
6825 return confirmed_ok;
6832 /* Does current window system support suspend? */
6833 if ((*windowprocs.win_can_suspend)()) {
6834 /* NB: SYSCF SHELLERS handled in port code. */
6839 Norep("Suspend command not available.");
6841 Norep("
\92\86\92f
\83R
\83}
\83\93\83h
\82Í
\97\98\97p
\82Å
\82«
\82Ü
\82¹
\82ñ
\81D");