4 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6 * This software may be copied and distributed for educational, research,
7 * and not for profit purposes provided that this copyright and statement
8 * are included in all such copies. Other copyrights may also apply.
11 /* Purpose: Interface commands */
18 * A set of functions to maintain automatic dumps of various kinds.
21 * remove_auto_dump(orig_file, mark)
22 * Remove the old automatic dump of type "mark".
23 * auto_dump_printf(fmt, ...)
24 * Dump a formatted string using fprintf().
25 * open_auto_dump(buf, mark)
26 * Open a file, remove old dump, and add new header.
27 * close_auto_dump(void)
28 * Add a footer, and close the file.
30 * The dump commands of original Angband simply add new lines to
31 * existing files; these files will become bigger and bigger unless
32 * an user deletes some or all of these files by hand at some
35 * These three functions automatically delete old dumped lines
36 * before adding new ones. Since there are various kinds of automatic
37 * dumps in a single file, we add a header and a footer with a type
38 * name for every automatic dump, and kill old lines only when the
39 * lines have the correct type of header and footer.
41 * We need to be quite paranoid about correctness; the user might
42 * (mistakenly) edit the file by hand, and see all their work come
43 * to nothing on the next auto dump otherwise. The current code only
44 * detects changes by noting inconsistencies between the actual number
45 * of lines and the number written in the footer. Note that this will
46 * not catch single-line edits.
50 * Mark strings for auto dump
52 static char auto_dump_header[] = "# vvvvvvv== %s ==vvvvvvv";
53 static char auto_dump_footer[] = "# ^^^^^^^== %s ==^^^^^^^";
56 * Variables for auto dump
58 static FILE *auto_dump_stream;
59 static cptr auto_dump_mark;
60 static int auto_dump_line_num;
63 * Remove old lines automatically generated before.
65 static void remove_auto_dump(cptr orig_file)
67 FILE *tmp_fff, *orig_fff;
71 bool between_mark = FALSE;
74 long header_location = 0;
75 char header_mark_str[80];
76 char footer_mark_str[80];
79 /* Prepare a header/footer mark string */
80 sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
81 sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
83 mark_len = strlen(footer_mark_str);
85 /* Open an old dump file in read-only mode */
86 orig_fff = my_fopen(orig_file, "r");
88 /* If original file does not exist, nothing to do */
89 if (!orig_fff) return;
91 /* Open a new (temporary) file */
92 tmp_fff = my_fopen_temp(tmp_file, 1024);
97 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", tmp_file);
99 msg_format("Failed to create temporary file %s.", tmp_file);
105 /* Loop for every line */
109 if (my_fgets(orig_fff, buf, sizeof(buf)))
111 /* Read error: Assume End of File */
114 * Was looking for the footer, but not found.
116 * Since automatic dump might be edited by hand,
117 * it's dangerous to kill these lines.
118 * Seek back to the next line of the (pseudo) header,
123 fseek(orig_fff, header_location, SEEK_SET);
124 between_mark = FALSE;
128 /* Success -- End the loop */
135 /* We are looking for the header mark of automatic dump */
138 /* Is this line a header? */
139 if (!strcmp(buf, header_mark_str))
141 /* Memorise seek point of this line */
142 header_location = ftell(orig_fff);
144 /* Initialize counter for number of lines */
147 /* Look for the footer from now */
150 /* There are some changes */
157 /* Copy orginally lines */
158 fprintf(tmp_fff, "%s\n", buf);
162 /* We are looking for the footer mark of automatic dump */
165 /* Is this line a footer? */
166 if (!strncmp(buf, footer_mark_str, mark_len))
171 * Compare the number of lines
173 * If there is an inconsistency between
174 * actual number of lines and the
175 * number here, the automatic dump
176 * might be edited by hand. So it's
177 * dangerous to kill these lines.
178 * Seek back to the next line of the
179 * (pseudo) header, and read again.
181 if (!sscanf(buf + mark_len, " (%d)", &tmp)
184 fseek(orig_fff, header_location, SEEK_SET);
187 /* Look for another header */
188 between_mark = FALSE;
194 /* Ignore old line, and count number of lines */
204 /* If there are some changes, overwrite the original file with new one */
207 /* Copy contents of temporary file */
209 tmp_fff = my_fopen(tmp_file, "r");
210 orig_fff = my_fopen(orig_file, "w");
212 while (!my_fgets(tmp_fff, buf, sizeof(buf)))
213 fprintf(orig_fff, "%s\n", buf);
219 /* Kill the temporary file */
227 * Dump a formatted line, using "vstrnfmt()".
229 static void auto_dump_printf(cptr fmt, ...)
236 /* Begin the Varargs Stuff */
239 /* Format the args, save the length */
240 (void)vstrnfmt(buf, sizeof(buf), fmt, vp);
242 /* End the Varargs Stuff */
245 /* Count number of lines */
246 for (p = buf; *p; p++)
248 if (*p == '\n') auto_dump_line_num++;
252 fprintf(auto_dump_stream, "%s", buf);
257 * Open file to append auto dump.
259 static bool open_auto_dump(cptr buf, cptr mark)
262 char header_mark_str[80];
264 /* Save the mark string */
265 auto_dump_mark = mark;
267 /* Prepare a header mark string */
268 sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
270 /* Remove old macro dumps */
271 remove_auto_dump(buf);
273 /* Append to the file */
274 auto_dump_stream = my_fopen(buf, "a");
277 if (!auto_dump_stream) {
279 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
281 msg_format("Failed to open %s.", buf);
290 fprintf(auto_dump_stream, "%s\n", header_mark_str);
292 /* Initialize counter */
293 auto_dump_line_num = 0;
296 auto_dump_printf("# *·Ù¹ð!!* °Ê¹ß¤Î¹Ô¤Ï¼«Æ°À¸À®¤µ¤ì¤¿¤â¤Î¤Ç¤¹¡£\n");
297 auto_dump_printf("# *·Ù¹ð!!* ¸å¤Ç¼«Æ°Åª¤Ëºï½ü¤µ¤ì¤ë¤Î¤ÇÊÔ½¸¤·¤Ê¤¤¤Ç¤¯¤À¤µ¤¤¡£\n");
299 auto_dump_printf("# *Warning!* The lines below are an automatic dump.\n");
300 auto_dump_printf("# Don't edit them; changes will be deleted and replaced automatically.\n");
308 * Append foot part and close auto dump.
310 static void close_auto_dump(void)
312 char footer_mark_str[80];
314 /* Prepare a footer mark string */
315 sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
318 auto_dump_printf("# *·Ù¹ð!!* °Ê¾å¤Î¹Ô¤Ï¼«Æ°À¸À®¤µ¤ì¤¿¤â¤Î¤Ç¤¹¡£\n");
319 auto_dump_printf("# *·Ù¹ð!!* ¸å¤Ç¼«Æ°Åª¤Ëºï½ü¤µ¤ì¤ë¤Î¤ÇÊÔ½¸¤·¤Ê¤¤¤Ç¤¯¤À¤µ¤¤¡£\n");
321 auto_dump_printf("# *Warning!* The lines above are an automatic dump.\n");
322 auto_dump_printf("# Don't edit them; changes will be deleted and replaced automatically.\n");
326 fprintf(auto_dump_stream, "%s (%d)\n", footer_mark_str, auto_dump_line_num);
329 my_fclose(auto_dump_stream);
337 * Return suffix of ordinal number
339 cptr get_ordinal_number_suffix(int num)
341 num = ABS(num) % 100;
345 return (num == 11) ? "th" : "st";
347 return (num == 12) ? "th" : "nd";
349 return (num == 13) ? "th" : "rd";
358 * Take note to the diary.
360 errr do_cmd_write_nikki(int type, int num, cptr note)
366 cptr note_level = "";
367 bool do_level = TRUE;
368 char note_level_buf[40];
371 static bool disable_nikki = FALSE;
373 extract_day_hour_min(&day, &hour, &min);
375 if (disable_nikki) return(-1);
377 if (type == NIKKI_FIX_QUEST_C ||
378 type == NIKKI_FIX_QUEST_F ||
379 type == NIKKI_RAND_QUEST_C ||
380 type == NIKKI_RAND_QUEST_F ||
381 type == NIKKI_TO_QUEST)
385 old_quest = p_ptr->inside_quest;
386 p_ptr->inside_quest = (quest[num].type == QUEST_TYPE_RANDOM) ? 0 : num;
388 /* Get the quest text */
389 init_flags = INIT_ASSIGN;
391 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
393 /* Reset the old quest number */
394 p_ptr->inside_quest = old_quest;
398 sprintf(file_name,"playrecord-%s.txt",savefile_base);
400 /* different filne name to avoid mixing */
401 sprintf(file_name,"playrec-%s.txt",savefile_base);
404 /* Build the filename */
405 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
407 /* File type is "TEXT" */
408 FILE_TYPE(FILE_TYPE_TEXT);
410 fff = my_fopen(buf, "a");
416 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£¥×¥ì¥¤µÏ¿¤ò°ì»þÄä»ß¤·¤Þ¤¹¡£", buf);
418 msg_format("Failed to open %s. Play-Record is disabled temporally.", buf);
425 q_idx = quest_number(dun_level);
429 if (p_ptr->inside_arena)
431 note_level = "¥¢¥ê¡¼¥Ê:";
433 note_level = "Arane:";
437 note_level = "ÃϾå:";
439 note_level = "Surface:";
441 else if (q_idx && (is_fixed_quest_idx(q_idx)
442 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
444 note_level = "¥¯¥¨¥¹¥È:";
446 note_level = "Quest:";
451 sprintf(note_level_buf, "%d³¬(%s):", dun_level, d_name+d_info[dungeon_type].name);
453 sprintf(note_level_buf, "%s L%d:", d_name+d_info[dungeon_type].name, dun_level);
455 note_level = note_level_buf;
464 if (day < MAX_DAYS) fprintf(fff, "%dÆüÌÜ\n", day);
465 else fputs("*****ÆüÌÜ\n", fff);
467 if (day < MAX_DAYS) fprintf(fff, "Day %d\n", day);
468 else fputs("Day *****\n", fff);
477 fprintf(fff, "%s\n",note);
481 fprintf(fff, " %2d:%02d %20s %s\n",hour, min, note_level, note);
487 fprintf(fff, " %2d:%02d %20s %s¤òȯ¸«¤·¤¿¡£\n", hour, min, note_level, note);
489 fprintf(fff, " %2d:%02d %20s discovered %s.\n", hour, min, note_level, note);
496 fprintf(fff, " %2d:%02d %20s %s¤òÅݤ·¤¿¡£\n", hour, min, note_level, note);
498 fprintf(fff, " %2d:%02d %20s defeated %s.\n", hour, min, note_level, note);
502 case NIKKI_FIX_QUEST_C:
504 if (quest[num].flags & QUEST_FLAG_SILENT) break;
506 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
508 fprintf(fff, " %2d:%02d %20s completed quest '%s'.\n", hour, min, note_level, quest[num].name);
512 case NIKKI_FIX_QUEST_F:
514 if (quest[num].flags & QUEST_FLAG_SILENT) break;
516 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤«¤éÌ¿¤«¤é¤¬¤éƨ¤²µ¢¤Ã¤¿¡£\n", hour, min, note_level, quest[num].name);
518 fprintf(fff, " %2d:%02d %20s run away from quest '%s'.\n", hour, min, note_level, quest[num].name);
522 case NIKKI_RAND_QUEST_C:
525 strcpy(name, r_name+r_info[quest[num].r_idx].name);
527 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, name);
529 fprintf(fff, " %2d:%02d %20s completed random quest '%s'\n", hour, min, note_level, name);
533 case NIKKI_RAND_QUEST_F:
536 strcpy(name, r_name+r_info[quest[num].r_idx].name);
538 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤«¤éƨ¤²½Ð¤·¤¿¡£\n", hour, min, note_level, name);
540 fprintf(fff, " %2d:%02d %20s ran away from quest '%s'.\n", hour, min, note_level, name);
544 case NIKKI_MAXDEAPTH:
547 fprintf(fff, " %2d:%02d %20s %s¤ÎºÇ¿¼³¬%d³¬¤ËÅþ㤷¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, num);
549 fprintf(fff, " %2d:%02d %20s reached level %d of %s for the first time.\n", hour, min, note_level, num, d_name+d_info[dungeon_type].name);
556 fprintf(fff, " %2d:%02d %20s %s%s¤ÎºÇ¿¼³¬¤ò%d³¬¤Ë¥»¥Ã¥È¤·¤¿¡£\n", hour, min, note_level, note, d_name + d_info[num].name, max_dlv[num]);
558 fprintf(fff, " %2d:%02d %20s reset recall level of %s to %d %s.\n", hour, min, note_level, d_name + d_info[num].name, max_dlv[num], note);
565 if (q_idx && (is_fixed_quest_idx(q_idx)
566 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
577 if (!(dun_level+num)) to = "ÃϾå";
578 else to = format("%d³¬", dun_level+num);
580 if (!(dun_level+num)) to = "the surface";
581 else to = format("level %d", dun_level+num);
586 fprintf(fff, " %2d:%02d %20s %s¤Ø%s¡£\n", hour, min, note_level, to, note);
588 fprintf(fff, " %2d:%02d %20s %s %s.\n", hour, min, note_level, note, to);
596 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤Æ%s¤Î%d³¬¤Ø²¼¤ê¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, max_dlv[dungeon_type]);
598 fprintf(fff, " %2d:%02d %20s recalled to dungeon level %d of %s.\n", hour, min, note_level, max_dlv[dungeon_type], d_name+d_info[dungeon_type].name);
602 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤ÆÃϾå¤Ø¤ÈÌá¤Ã¤¿¡£\n", hour, min, note_level);
604 fprintf(fff, " %2d:%02d %20s recalled from dungeon to surface.\n", hour, min, note_level);
610 if (quest[num].flags & QUEST_FLAG_SILENT) break;
612 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤Ø¤ÈÆÍÆþ¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
614 fprintf(fff, " %2d:%02d %20s entered the quest '%s'.\n", hour, min, note_level, quest[num].name);
621 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¡¦¥Æ¥ì¥Ý¡¼¥È¤Çæ½Ð¤·¤¿¡£\n", hour, min, note_level);
623 fprintf(fff, " %2d:%02d %20s Got out using teleport level.\n", hour, min, note_level);
630 fprintf(fff, " %2d:%02d %20s %s¤ò¹ØÆþ¤·¤¿¡£\n", hour, min, note_level, note);
632 fprintf(fff, " %2d:%02d %20s bought %s.\n", hour, min, note_level, note);
639 fprintf(fff, " %2d:%02d %20s %s¤òÇäµÑ¤·¤¿¡£\n", hour, min, note_level, note);
641 fprintf(fff, " %2d:%02d %20s sold %s.\n", hour, min, note_level, note);
650 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï¤Ç¡¢%s¤ÎÁ°¤ËÇÔ¤ìµî¤Ã¤¿¡£\n", hour, min, note_level, -num, note);
653 fprintf(fff, " %2d:%02d %20s beaten by %s in the %d%s fight.\n", hour, min, note_level, note, n, get_ordinal_number_suffix(n));
658 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï(%s)¤Ë¾¡Íø¤·¤¿¡£\n", hour, min, note_level, num, note);
660 fprintf(fff, " %2d:%02d %20s won the %d%s fight (%s).\n", hour, min, note_level, num, get_ordinal_number_suffix(num), note);
662 if (num == MAX_ARENA_MONS)
665 fprintf(fff, " Æ®µ»¾ì¤Î¤¹¤Ù¤Æ¤ÎŨ¤Ë¾¡Íø¤·¡¢¥Á¥ã¥ó¥Ô¥ª¥ó¤È¤Ê¤Ã¤¿¡£\n");
667 fprintf(fff, " won all fight to become a Chanpion.\n");
676 fprintf(fff, " %2d:%02d %20s %s¤ò¼±Ê̤·¤¿¡£\n", hour, min, note_level, note);
678 fprintf(fff, " %2d:%02d %20s identified %s.\n", hour, min, note_level, note);
693 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
695 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
699 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥¦¥£¥¶¡¼¥É¡¦¥Æ¥ì¥Ý¡¼¥È¤Ç°ÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
701 fprintf(fff, " %2d:%02d %20s wizard-teleport to %s.\n", hour, min, note_level, to);
716 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
718 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
722 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥Ñ¥¿¡¼¥ó¤ÎÎϤǰÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
724 fprintf(fff, " %2d:%02d %20s used Pattern to teleport to %s.\n", hour, min, note_level, to);
731 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¤¬%d¤Ë¾å¤¬¤Ã¤¿¡£\n", hour, min, note_level, num);
733 fprintf(fff, " %2d:%02d %20s reached player level %d.\n", hour, min, note_level, num);
737 case NIKKI_GAMESTART:
739 time_t ct = time((time_t*)0);
743 fprintf(fff, "%s %s",note, ctime(&ct));
746 fprintf(fff, " %2d:%02d %20s %s %s",hour, min, note_level, note, ctime(&ct));
749 case NIKKI_NAMED_PET:
751 fprintf(fff, " %2d:%02d %20s ", hour, min, note_level);
754 case RECORD_NAMED_PET_NAME:
756 fprintf(fff, "%s¤òι¤Îͧ¤Ë¤¹¤ë¤³¤È¤Ë·è¤á¤¿¡£\n", note);
758 fprintf(fff, "decided to travel together with %s.\n", note);
761 case RECORD_NAMED_PET_UNNAME:
763 fprintf(fff, "%s¤Î̾Á°¤ò¾Ã¤·¤¿¡£\n", note);
765 fprintf(fff, "unnamed %s.\n", note);
768 case RECORD_NAMED_PET_DISMISS:
770 fprintf(fff, "%s¤ò²òÊü¤·¤¿¡£\n", note);
772 fprintf(fff, "dismissed %s.\n", note);
775 case RECORD_NAMED_PET_DEATH:
777 fprintf(fff, "%s¤¬»à¤ó¤Ç¤·¤Þ¤Ã¤¿¡£\n", note);
779 fprintf(fff, "%s died.\n", note);
782 case RECORD_NAMED_PET_MOVED:
784 fprintf(fff, "%s¤ò¤ª¤¤¤ÆÊ̤ΥޥåפذÜÆ°¤·¤¿¡£\n", note);
786 fprintf(fff, "moved to another map leaving %s behind.\n", note);
789 case RECORD_NAMED_PET_LOST_SIGHT:
791 fprintf(fff, "%s¤È¤Ï¤°¤ì¤Æ¤·¤Þ¤Ã¤¿¡£\n", note);
793 fprintf(fff, "lost sight of %s.\n", note);
796 case RECORD_NAMED_PET_DESTROY:
798 fprintf(fff, "%s¤¬*Ç˲õ*¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
800 fprintf(fff, "%s was made disappeared by *destruction*.\n", note);
803 case RECORD_NAMED_PET_EARTHQUAKE:
805 fprintf(fff, "%s¤¬´äÀФ˲¡¤·ÄÙ¤µ¤ì¤¿¡£\n", note);
807 fprintf(fff, "%s was crushed by falling rocks.\n", note);
810 case RECORD_NAMED_PET_GENOCIDE:
812 fprintf(fff, "%s¤¬Ëõ»¦¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
814 fprintf(fff, "%s was made disappeared by genocide.\n", note);
817 case RECORD_NAMED_PET_WIZ_ZAP:
819 fprintf(fff, "%s¤¬¥Ç¥Ð¥Ã¥°¥³¥Þ¥ó¥É¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
821 fprintf(fff, "%s was removed by debug command.\n", note);
824 case RECORD_NAMED_PET_TELE_LEVEL:
826 fprintf(fff, "%s¤¬¥Æ¥ì¥Ý¡¼¥È¡¦¥ì¥Ù¥ë¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
828 fprintf(fff, "%s was made disappeared by teleport level.\n", note);
831 case RECORD_NAMED_PET_BLAST:
833 fprintf(fff, "%s¤òÇúÇˤ·¤¿¡£\n", note);
835 fprintf(fff, "blasted %s.\n", note);
838 case RECORD_NAMED_PET_HEAL_LEPER:
840 fprintf(fff, "%s¤Îɵ¤¤¬¼£¤ê餫¤é³°¤ì¤¿¡£\n", note);
842 fprintf(fff, "%s was healed and left.\n", note);
845 case RECORD_NAMED_PET_COMPACT:
847 fprintf(fff, "%s¤¬¥â¥ó¥¹¥¿¡¼¾ðÊ󰵽̤ˤè¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
849 fprintf(fff, "%s was made disappeared by compacting monsters.\n", note);
852 case RECORD_NAMED_PET_LOSE_PARENT:
854 fprintf(fff, "%s¤Î¾¤´¼Ô¤¬´û¤Ë¤¤¤Ê¤¤¤¿¤á¾Ã¤¨µî¤Ã¤¿¡£\n", note);
856 fprintf(fff, "%s disappeared because there does not exist summoner.\n", note);
871 if (do_level) write_level = FALSE;
877 #define MAX_SUBTITLE (sizeof(subtitle)/sizeof(subtitle[0]))
879 static void do_cmd_disp_nikki(void)
881 char nikki_title[256];
886 static const char subtitle[][30] = {"ºÇ¶¯¤ÎÆùÂΤòµá¤á¤Æ",
887 "¿ÍÀ¸¤½¤ì¤Ï¤Ï¤«¤Ê¤¤",
898 "Åݤ¹¤Ù¤Å¨¤Ï¥²¡û¥Ä",
899 "¤ó¡Á¡©Ê¹¤³¤¨¤ó¤Ê¤¡",
900 "¥ª¥ì¤Î̾¤ò¸À¤Ã¤Æ¤ß¤í",
901 "Ƭ¤¬ÊѤˤʤäÁ¤ã¤Ã¤¿",
906 "¤³¤ó¤Ê¤â¤ó¤¸¤ã¤Ê¤¤",
915 "ºÇ¹â¤ÎƬǾ¤òµá¤á¤Æ"};
917 static const char subtitle[][51] ={"Quest of The World's Toughest Body",
918 "Attack is the best form of defence.",
920 "An unexpected windfall",
921 "A drowning man will catch at a straw",
922 "Don't count your chickens before they are hatched.",
923 "It is no use crying over spilt milk.",
924 "Seeing is believing.",
925 "Strike the iron while it is hot.",
926 "I don't care what follows.",
927 "To dig a well to put out a house on fire.",
928 "Tomorrow is another day.",
929 "Easy come, easy go.",
930 "The more haste, the less speed.",
931 "Where there is life, there is hope.",
932 "There is no royal road to *WINNER*.",
933 "Danger past, God forgotten.",
934 "The best thing to do now is to run away.",
935 "Life is but an empty dream.",
936 "Dead men tell no tales.",
937 "A book that remains shut is but a block.",
938 "Misfortunes never come singly.",
939 "A little knowledge is a dangerous thing.",
940 "History repeats itself.",
941 "*WINNER* was not built in a day.",
942 "Ignorance is bliss.",
943 "To lose is to win?",
944 "No medicine can cure folly.",
945 "All good things come to an end.",
946 "M$ Empire strikes back.",
947 "To see is to believe",
949 "Quest of The World's Greatest Brain"};
952 sprintf(file_name,"playrecord-%s.txt",savefile_base);
954 sprintf(file_name,"playrec-%s.txt",savefile_base);
957 /* Build the filename */
958 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
960 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_MONK || p_ptr->pclass == CLASS_SAMURAI || p_ptr->pclass == CLASS_BERSERKER)
961 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)]);
962 else if (p_ptr->pclass == CLASS_MAGE || p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
963 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)+1]);
964 else strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-2)+1]);
967 sprintf(nikki_title, "¡Ö%s%s%s¤ÎÅÁÀâ -%s-¡×",
968 ap_ptr->title, ap_ptr->no ? "¤Î" : "", player_name, tmp);
970 sprintf(nikki_title, "Legend of %s %s '%s'",
971 ap_ptr->title, player_name, tmp);
974 /* Display the file contents */
975 show_file(FALSE, buf, nikki_title, -1, 0);
978 static void do_cmd_bunshou(void)
981 char bunshou[80] = "\0";
984 if (get_string("ÆâÍÆ: ", tmp, 79))
986 if (get_string("diary note: ", tmp, 79))
989 strcpy(bunshou, tmp);
991 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, bunshou);
995 static void do_cmd_last_get(void)
1000 if (record_o_name[0] == '\0') return;
1003 sprintf(buf,"%s¤ÎÆþ¼ê¤òµÏ¿¤·¤Þ¤¹¡£",record_o_name);
1005 sprintf(buf,"Do you really want to record getting %s? ",record_o_name);
1007 if (!get_check(buf)) return;
1012 sprintf(buf,"%s¤ò¼ê¤ËÆþ¤ì¤¿¡£", record_o_name);
1014 sprintf(buf,"descover %s.", record_o_name);
1016 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
1020 static void do_cmd_erase_nikki(void)
1027 if (!get_check("ËÜÅö¤ËµÏ¿¤ò¾Ãµî¤·¤Þ¤¹¤«¡©")) return;
1029 if (!get_check("Do you really want to delete all your record? ")) return;
1033 sprintf(file_name,"playrecord-%s.txt",savefile_base);
1035 sprintf(file_name,"playrec-%s.txt",savefile_base);
1038 /* Build the filename */
1039 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
1041 /* Remove the file */
1044 fff = my_fopen(buf, "w");
1048 msg_format("µÏ¿¤ò¾Ãµî¤·¤Þ¤·¤¿¡£");
1050 msg_format("deleted record.");
1054 msg_format("%s ¤Î¾Ãµî¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£", buf);
1056 msg_format("failed to delete %s.", buf);
1063 void do_cmd_nikki(void)
1067 /* File type is "TEXT" */
1068 FILE_TYPE(FILE_TYPE_TEXT);
1070 /* Save the screen */
1073 /* Interact until done */
1079 /* Ask for a choice */
1081 prt("[ µÏ¿¤ÎÀßÄê ]", 2, 0);
1083 prt("[ Play Record ]", 2, 0);
1087 /* Give some choices */
1089 prt("(1) µÏ¿¤ò¸«¤ë", 4, 5);
1090 prt("(2) ʸ¾Ï¤òµÏ¿¤¹¤ë", 5, 5);
1091 prt("(3) ľÁ°¤ËÆþ¼êËô¤Ï´ÕÄꤷ¤¿¤â¤Î¤òµÏ¿¤¹¤ë", 6, 5);
1092 prt("(4) µÏ¿¤ò¾Ãµî¤¹¤ë", 7, 5);
1094 prt("(1) Display your record", 4, 5);
1095 prt("(2) Add record", 5, 5);
1096 prt("(3) Record item you last get/identify", 6, 5);
1097 prt("(4) Delete your record", 7, 5);
1103 prt("¥³¥Þ¥ó¥É:", 18, 0);
1105 prt("Command: ", 18, 0);
1113 if (i == ESCAPE) break;
1118 do_cmd_disp_nikki();
1127 do_cmd_erase_nikki();
1129 default: /* Unknown option */
1133 /* Flush messages */
1137 /* Restore the screen */
1142 * Hack -- redraw the screen
1144 * This command performs various low level updates, clears all the "extra"
1145 * windows, does a total redraw of the main window, and requests all of the
1146 * interesting updates and redraws that I can think of.
1148 * This command is also used to "instantiate" the results of the user
1149 * selecting various things, such as graphics mode, so it must call
1150 * the "TERM_XTRA_REACT" hook before redrawing the windows.
1152 void do_cmd_redraw(void)
1159 /* Hack -- react to changes */
1160 Term_xtra(TERM_XTRA_REACT, 0);
1163 /* Combine and Reorder the pack (later) */
1164 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1168 p_ptr->update |= (PU_TORCH);
1171 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
1173 /* Forget lite/view */
1174 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1176 /* Update lite/view */
1177 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
1179 /* Update monsters */
1180 p_ptr->update |= (PU_MONSTERS);
1182 /* Redraw everything */
1183 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1186 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
1189 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
1193 /* Hack -- update */
1196 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
1199 /* Redraw every window */
1200 for (j = 0; j < 8; j++)
1203 if (!angband_term[j]) continue;
1206 Term_activate(angband_term[j]);
1221 * Hack -- change name
1223 void do_cmd_change_name(void)
1232 /* Save the screen */
1240 /* Display the player */
1241 display_player(mode);
1246 display_player(mode);
1251 Term_putstr(2, 23, -1, TERM_WHITE,
1252 "['c'¤Ç̾Á°Êѹ¹, 'f'¤Ç¥Õ¥¡¥¤¥ë¤Ø½ñ½Ð, 'h'¤Ç¥â¡¼¥ÉÊѹ¹, ESC¤Ç½ªÎ»]");
1254 Term_putstr(2, 23, -1, TERM_WHITE,
1255 "['c' to change name, 'f' to file, 'h' to change mode, or ESC]");
1263 if (c == ESCAPE) break;
1270 /* Process the player name */
1271 process_player_name(FALSE);
1277 sprintf(tmp, "%s.txt", player_base);
1279 if (get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
1281 if (get_string("File name: ", tmp, 80))
1285 if (tmp[0] && (tmp[0] != ' '))
1287 file_character(tmp);
1304 /* Flush messages */
1308 /* Restore the screen */
1311 /* Redraw everything */
1312 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1319 * Recall the most recent message
1321 void do_cmd_message_one(void)
1323 /* Recall one message XXX XXX XXX */
1324 prt(format("> %s", message_str(0)), 0, 0);
1329 * Show previous messages to the user -BEN-
1331 * The screen format uses line 0 and 23 for headers and prompts,
1332 * skips line 1 and 22, and uses line 2 thru 21 for old messages.
1334 * This command shows you which commands you are viewing, and allows
1335 * you to "search" for strings in the recall.
1337 * Note that messages may be longer than 80 characters, but they are
1338 * displayed using "infinite" length, with a special sub-command to
1339 * "slide" the virtual display to the left or right.
1341 * Attempt to only hilite the matching portions of the string.
1343 void do_cmd_messages(int num_now)
1347 char shower_str[81];
1348 char finder_str[81];
1355 Term_get_size(&wid, &hgt);
1357 /* Number of message lines in a screen */
1358 num_lines = hgt - 4;
1361 strcpy(finder_str, "");
1364 strcpy(shower_str, "");
1366 /* Total messages */
1369 /* Start on first message */
1372 /* Save the screen */
1378 /* Process requests until done */
1384 /* Dump up to 20 lines of messages */
1385 for (j = 0; (j < num_lines) && (i + j < n); j++)
1387 cptr msg = message_str(i+j);
1389 /* Dump the messages, bottom to top */
1390 c_prt((i + j < num_now ? TERM_WHITE : TERM_SLATE), msg, num_lines + 1 - j, 0);
1392 /* Hilite "shower" */
1393 if (shower && shower[0])
1397 /* Display matches */
1398 while ((str = my_strstr(str, shower)) != NULL)
1400 int len = strlen(shower);
1402 /* Display the match */
1403 Term_putstr(str-msg, num_lines + 1 - j, len, TERM_YELLOW, shower);
1411 /* Erase remaining lines */
1412 for (; j < num_lines; j++)
1414 Term_erase(0, num_lines + 1 - j, 255);
1417 /* Display header XXX XXX XXX */
1420 prt(format("°ÊÁ°¤Î¥á¥Ã¥»¡¼¥¸ %d-%d Á´Éô¤Ç(%d)",
1421 i, i + j - 1, n), 0, 0);
1423 prt(format("Message Recall (%d-%d of %d)",
1424 i, i + j - 1, n), 0, 0);
1427 /* Display prompt (not very informative) */
1429 prt("[ 'p' ¤Ç¹¹¤Ë¸Å¤¤¤â¤Î, 'n' ¤Ç¹¹¤Ë¿·¤·¤¤¤â¤Î, '/' ¤Ç¸¡º÷, ESC ¤ÇÃæÃÇ ]", hgt - 1, 0);
1431 prt("[Press 'p' for older, 'n' for newer, ..., or ESCAPE]", hgt - 1, 0);
1435 skey = inkey_special(TRUE);
1437 /* Exit on Escape */
1438 if (skey == ESCAPE) break;
1440 /* Hack -- Save the old index */
1445 /* Hack -- handle show */
1449 prt("¶¯Ä´: ", hgt - 1, 0);
1451 prt("Show: ", hgt - 1, 0);
1454 /* Get a "shower" string, or continue */
1455 strcpy(back_str, shower_str);
1456 if (askfor(shower_str, 80))
1459 shower = shower_str[0] ? shower_str : NULL;
1461 else strcpy(shower_str, back_str);
1466 /* Hack -- handle find */
1474 prt("¸¡º÷: ", hgt - 1, 0);
1476 prt("Find: ", hgt - 1, 0);
1479 /* Get a "finder" string, or continue */
1480 strcpy(back_str, finder_str);
1481 if (!askfor(finder_str, 80))
1483 strcpy(finder_str, back_str);
1486 else if (!finder_str[0])
1488 shower = NULL; /* Stop showing */
1493 shower = finder_str;
1496 for (z = i + 1; z < n; z++)
1498 cptr msg = message_str(z);
1501 if (my_strstr(msg, finder_str))
1513 /* Recall 1 older message */
1515 /* Go to the oldest line */
1519 /* Recall 1 newer message */
1521 /* Go to the newest line */
1525 /* Recall 1 older message */
1530 /* Go older if legal */
1531 i = MIN(i + 1, n - num_lines);
1534 /* Recall 10 older messages */
1536 /* Go older if legal */
1537 i = MIN(i + 10, n - num_lines);
1540 /* Recall 20 older messages */
1545 /* Go older if legal */
1546 i = MIN(i + num_lines, n - num_lines);
1549 /* Recall 20 newer messages */
1553 /* Go newer (if able) */
1554 i = MAX(0, i - num_lines);
1557 /* Recall 10 newer messages */
1559 /* Go newer (if able) */
1563 /* Recall 1 newer messages */
1566 /* Go newer (if able) */
1571 /* Hack -- Error of some kind */
1575 /* Restore the screen */
1582 * Number of cheating options
1589 static option_type cheat_info[CHEAT_MAX] =
1591 { &cheat_peek, FALSE, 255, 0x01, 0x00,
1593 "cheat_peek", "¥¢¥¤¥Æ¥à¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1595 "cheat_peek", "Peek into object creation"
1599 { &cheat_hear, FALSE, 255, 0x02, 0x00,
1601 "cheat_hear", "¥â¥ó¥¹¥¿¡¼¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1603 "cheat_hear", "Peek into monster creation"
1607 { &cheat_room, FALSE, 255, 0x04, 0x00,
1609 "cheat_room", "¥À¥ó¥¸¥ç¥ó¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1611 "cheat_room", "Peek into dungeon creation"
1615 { &cheat_xtra, FALSE, 255, 0x08, 0x00,
1617 "cheat_xtra", "¤½¤Î¾¤Î»ö¤ò¤Î¤¾¤¸«¤ë"
1619 "cheat_xtra", "Peek into something else"
1623 { &cheat_know, FALSE, 255, 0x10, 0x00,
1625 "cheat_know", "´°Á´¤Ê¥â¥ó¥¹¥¿¡¼¤Î»×¤¤½Ð¤òÃΤë"
1627 "cheat_know", "Know complete monster info"
1631 { &cheat_live, FALSE, 255, 0x20, 0x00,
1633 "cheat_live", "»à¤ò²óÈò¤¹¤ë¤³¤È¤ò²Äǽ¤Ë¤¹¤ë"
1635 "cheat_live", "Allow player to avoid death"
1639 { &cheat_save, FALSE, 255, 0x40, 0x00,
1641 "cheat_save", "»à¤ó¤À»þ¥»¡¼¥Ö¤¹¤ë¤«³Îǧ¤¹¤ë"
1643 "cheat_save", "Ask for saving death"
1649 * Interact with some options for cheating
1651 static void do_cmd_options_cheat(cptr info)
1655 int i, k = 0, n = CHEAT_MAX;
1663 /* Interact with the player */
1668 /* Prompt XXX XXX XXX */
1670 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, ESC ¤Ç·èÄê )", info);
1672 sprintf(buf, "%s (RET to advance, y/n to set, ESC to accept) ", info);
1678 /* º¾µ½¥ª¥×¥·¥ç¥ó¤ò¤¦¤Ã¤«¤ê¤¤¤¸¤Ã¤Æ¤·¤Þ¤¦¿Í¤¬¤¤¤ë¤è¤¦¤Ê¤Î¤ÇÃí°Õ */
1679 prt(" << Ãí°Õ >>", 11, 0);
1680 prt(" º¾µ½¥ª¥×¥·¥ç¥ó¤ò°ìÅ٤ǤâÀßÄꤹ¤ë¤È¡¢¥¹¥³¥¢µÏ¿¤¬»Ä¤é¤Ê¤¯¤Ê¤ê¤Þ¤¹¡ª", 12, 0);
1681 prt(" ¸å¤Ë²ò½ü¤·¤Æ¤â¥À¥á¤Ç¤¹¤Î¤Ç¡¢¾¡Íø¼Ô¤òÌܻؤ¹Êý¤Ï¤³¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¤¤", 13, 0);
1682 prt(" ¤¸¤é¤Ê¤¤¤è¤¦¤Ë¤·¤Æ²¼¤µ¤¤¡£", 14, 0);
1684 /* Display the options */
1685 for (i = 0; i < n; i++)
1687 byte a = TERM_WHITE;
1689 /* Color current option */
1690 if (i == k) a = TERM_L_BLUE;
1692 /* Display the option text */
1693 sprintf(buf, "%-48s: %s (%s)",
1694 cheat_info[i].o_desc,
1696 (*cheat_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1698 (*cheat_info[i].o_var ? "yes" : "no "),
1701 cheat_info[i].o_text);
1702 c_prt(a, buf, i + 2, 0);
1705 /* Hilite current option */
1706 move_cursor(k + 2, 50);
1712 * HACK - Try to translate the key into a direction
1713 * to allow using the roguelike keys for navigation.
1715 dir = get_keymap_dir(ch);
1716 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1730 k = (n + k - 1) % n;
1749 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "º¾µ½¥ª¥×¥·¥ç¥ó¤òON¤Ë¤·¤Æ¡¢¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
1751 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use cheating options.");
1753 p_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit);
1754 (*cheat_info[k].o_var) = TRUE;
1763 (*cheat_info[k].o_var) = FALSE;
1771 strnfmt(buf, sizeof(buf), "joption.txt#%s", cheat_info[k].o_text);
1773 strnfmt(buf, sizeof(buf), "option.txt#%s", cheat_info[k].o_text);
1775 /* Peruse the help file */
1776 (void)show_file(TRUE, buf, NULL, 0, 0);
1792 static option_type autosave_info[2] =
1794 { &autosave_l, FALSE, 255, 0x01, 0x00,
1796 "autosave_l", "¿·¤·¤¤³¬¤ËÆþ¤ëÅ٤˼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1798 "autosave_l", "Autosave when entering new levels" },
1802 { &autosave_t, FALSE, 255, 0x02, 0x00,
1804 "autosave_t", "°ìÄ꥿¡¼¥óËè¤Ë¼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1806 "autosave_t", "Timed autosave" },
1812 static s16b toggle_frequency(s16b current)
1817 case 50: return 100;
1818 case 100: return 250;
1819 case 250: return 500;
1820 case 500: return 1000;
1821 case 1000: return 2500;
1822 case 2500: return 5000;
1823 case 5000: return 10000;
1824 case 10000: return 25000;
1831 * Interact with some options for cheating
1833 static void do_cmd_options_autosave(cptr info)
1837 int i, k = 0, n = 2;
1845 /* Interact with the player */
1848 /* Prompt XXX XXX XXX */
1850 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, F ¤ÇÉÑÅÙ¤òÆþÎÏ, ESC ¤Ç·èÄê ) ", info);
1852 sprintf(buf, "%s (RET to advance, y/n to set, 'F' for frequency, ESC to accept) ", info);
1857 /* Display the options */
1858 for (i = 0; i < n; i++)
1860 byte a = TERM_WHITE;
1862 /* Color current option */
1863 if (i == k) a = TERM_L_BLUE;
1865 /* Display the option text */
1866 sprintf(buf, "%-48s: %s (%s)",
1867 autosave_info[i].o_desc,
1869 (*autosave_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1871 (*autosave_info[i].o_var ? "yes" : "no "),
1874 autosave_info[i].o_text);
1875 c_prt(a, buf, i + 2, 0);
1879 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè", autosave_freq), 5, 0);
1881 prt(format("Timed autosave frequency: every %d turns", autosave_freq), 5, 0);
1886 /* Hilite current option */
1887 move_cursor(k + 2, 50);
1903 k = (n + k - 1) % n;
1921 (*autosave_info[k].o_var) = TRUE;
1930 (*autosave_info[k].o_var) = FALSE;
1938 autosave_freq = toggle_frequency(autosave_freq);
1940 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè",
1941 autosave_freq), 5, 0);
1943 prt(format("Timed autosave frequency: every %d turns",
1944 autosave_freq), 5, 0);
1952 (void)show_file(TRUE, "joption.txt#Autosave", NULL, 0, 0);
1954 (void)show_file(TRUE, "option.txt#Autosave", NULL, 0, 0);
1973 * Interact with some options
1975 void do_cmd_options_aux(int page, cptr info)
1978 int i, k = 0, n = 0, l;
1981 bool browse_only = (page == OPT_PAGE_BIRTH) && character_generated &&
1982 (!p_ptr->wizard || !allow_debug_opts);
1985 /* Lookup the options */
1986 for (i = 0; i < 24; i++) opt[i] = 0;
1988 /* Scan the options */
1989 for (i = 0; option_info[i].o_desc; i++)
1991 /* Notice options on this "page" */
1992 if (option_info[i].o_page == page) opt[n++] = i;
1999 /* Interact with the player */
2004 /* Prompt XXX XXX XXX */
2006 sprintf(buf, "%s (¥ê¥¿¡¼¥ó:¼¡, %sESC:½ªÎ», ?:¥Ø¥ë¥×) ", info, browse_only ? "" : "y/n:Êѹ¹, ");
2008 sprintf(buf, "%s (RET:next, %s, ?:help) ", info, browse_only ? "ESC:exit" : "y/n:change, ESC:accept");
2014 /* HACK -- description for easy-auto-destroy options */
2016 if (page == OPT_PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "°Ê²¼¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢´Ê°×¼«Æ°Ç˲õ¤ò»ÈÍѤ¹¤ë¤È¤¤Î¤ß͸ú", 6, 6);
2018 if (page == OPT_PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "Following options will protect items from easy auto-destroyer.", 6, 3);
2021 /* Display the options */
2022 for (i = 0; i < n; i++)
2024 byte a = TERM_WHITE;
2026 /* Color current option */
2027 if (i == k) a = TERM_L_BLUE;
2029 /* Display the option text */
2030 sprintf(buf, "%-48s: %s (%.19s)",
2031 option_info[opt[i]].o_desc,
2033 (*option_info[opt[i]].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
2035 (*option_info[opt[i]].o_var ? "yes" : "no "),
2038 option_info[opt[i]].o_text);
2039 if ((page == OPT_PAGE_AUTODESTROY) && i > 2) c_prt(a, buf, i + 5, 0);
2040 else c_prt(a, buf, i + 2, 0);
2043 if ((page == OPT_PAGE_AUTODESTROY) && (k > 2)) l = 3;
2046 /* Hilite current option */
2047 move_cursor(k + 2 + l, 50);
2053 * HACK - Try to translate the key into a direction
2054 * to allow using the roguelike keys for navigation.
2056 dir = get_keymap_dir(ch);
2057 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
2071 k = (n + k - 1) % n;
2088 if (browse_only) break;
2089 (*option_info[opt[k]].o_var) = TRUE;
2098 if (browse_only) break;
2099 (*option_info[opt[k]].o_var) = FALSE;
2107 if (!browse_only) (*option_info[opt[k]].o_var) = !(*option_info[opt[k]].o_var);
2114 strnfmt(buf, sizeof(buf), "joption.txt#%s", option_info[opt[k]].o_text);
2116 strnfmt(buf, sizeof(buf), "option.txt#%s", option_info[opt[k]].o_text);
2118 /* Peruse the help file */
2119 (void)show_file(TRUE, buf, NULL, 0, 0);
2136 * Modify the "window" options
2138 static void do_cmd_options_win(void)
2152 /* Memorize old flags */
2153 for (j = 0; j < 8; j++)
2155 /* Acquire current flags */
2156 old_flag[j] = window_flag[j];
2166 /* Prompt XXX XXX XXX */
2168 prt("¥¦¥£¥ó¥É¥¦¡¦¥Õ¥é¥° (<Êý¸þ>¤Ç°ÜÆ°, t¤Ç¥Á¥§¥ó¥¸, y/n ¤Ç¥»¥Ã¥È, ESC)", 0, 0);
2170 prt("Window Flags (<dir>, t, y, n, ESC) ", 0, 0);
2174 /* Display the windows */
2175 for (j = 0; j < 8; j++)
2177 byte a = TERM_WHITE;
2179 cptr s = angband_term_name[j];
2182 if (j == x) a = TERM_L_BLUE;
2184 /* Window name, staggered, centered */
2185 Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s);
2188 /* Display the options */
2189 for (i = 0; i < 16; i++)
2191 byte a = TERM_WHITE;
2193 cptr str = window_flag_desc[i];
2196 if (i == y) a = TERM_L_BLUE;
2200 if (!str) str = "(̤»ÈÍÑ)";
2202 if (!str) str = "(Unused option)";
2207 Term_putstr(0, i + 5, -1, a, str);
2209 /* Display the windows */
2210 for (j = 0; j < 8; j++)
2212 byte a = TERM_WHITE;
2217 if ((i == y) && (j == x)) a = TERM_L_BLUE;
2220 if (window_flag[j] & (1L << i)) c = 'X';
2223 Term_putch(35 + j * 5, i + 5, a, c);
2228 Term_gotoxy(35 + x * 5, y + 5);
2246 for (j = 0; j < 8; j++)
2248 window_flag[j] &= ~(1L << y);
2252 for (i = 0; i < 16; i++)
2254 window_flag[x] &= ~(1L << i);
2267 window_flag[x] |= (1L << y);
2275 window_flag[x] &= ~(1L << y);
2282 (void)show_file(TRUE, "joption.txt#Window", NULL, 0, 0);
2284 (void)show_file(TRUE, "option.txt#Window", NULL, 0, 0);
2294 d = get_keymap_dir(ch);
2296 x = (x + ddx[d] + 8) % 8;
2297 y = (y + ddy[d] + 16) % 16;
2304 /* Notice changes */
2305 for (j = 0; j < 8; j++)
2310 if (!angband_term[j]) continue;
2312 /* Ignore non-changes */
2313 if (window_flag[j] == old_flag[j]) continue;
2316 Term_activate(angband_term[j]);
2333 * Set or unset various options.
2335 * The user must use the "Ctrl-R" command to "adapt" to changes
2336 * in any options which control "visual" aspects of the game.
2338 void do_cmd_options(void)
2343 /* Save the screen */
2352 /* Why are we here */
2354 prt("[ ¥ª¥×¥·¥ç¥ó¤ÎÀßÄê ]", 1, 0);
2356 prt("Options", 1, 0);
2360 /* Give some choices */
2362 prt("(1) ¥¡¼ÆþÎÏ ¥ª¥×¥·¥ç¥ó", 2, 5);
2363 prt("(2) ¥Þ¥Ã¥×²èÌÌ ¥ª¥×¥·¥ç¥ó", 3, 5);
2364 prt("(3) ¥Æ¥¥¹¥Èɽ¼¨ ¥ª¥×¥·¥ç¥ó", 4, 5);
2365 prt("(4) ¥²¡¼¥à¥×¥ì¥¤ ¥ª¥×¥·¥ç¥ó", 5, 5);
2366 prt("(5) ¹ÔÆ°Ãæ»ß´Ø·¸ ¥ª¥×¥·¥ç¥ó", 6, 5);
2367 prt("(6) ´Ê°×¼«Æ°Ç˲õ ¥ª¥×¥·¥ç¥ó", 7, 5);
2368 prt("(R) ¥×¥ì¥¤µÏ¿ ¥ª¥×¥·¥ç¥ó", 8, 5);
2370 /* Special choices */
2371 prt("(P) ¼«Æ°½¦¤¤¥¨¥Ç¥£¥¿", 10, 5);
2372 prt("(D) ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 11, 5);
2373 prt("(H) Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 12, 5);
2374 prt("(M) ÄãËâÎÏ¿§ïçÃÍ", 13, 5);
2375 prt("(A) ¼«Æ°¥»¡¼¥Ö ¥ª¥×¥·¥ç¥ó", 14, 5);
2377 prt("(W) ¥¦¥¤¥ó¥É¥¦¥Õ¥é¥°", 15, 5);
2379 prt("(1) Input Options", 2, 5);
2380 prt("(2) Map Screen Options", 3, 5);
2381 prt("(3) Text Display Options", 4, 5);
2382 prt("(4) Game-Play Options", 5, 5);
2383 prt("(5) Disturbance Options", 6, 5);
2384 prt("(6) Easy Auto-Destroyer Options", 7, 5);
2385 prt("(R) Play-record Options", 8, 5);
2386 /* Special choices */
2387 prt("(P) Auto-picker/destroyer editor", 10, 5);
2388 prt("(D) Base Delay Factor", 11, 5);
2389 prt("(H) Hitpoint Warning", 12, 5);
2390 prt("(M) Mana Color Threshold", 13, 5);
2391 prt("(A) Autosave Options", 14, 5);
2393 prt("(W) Window Flags", 15, 5);
2396 if (!p_ptr->wizard || !allow_debug_opts)
2400 prt("(B) ½é´ü ¥ª¥×¥·¥ç¥ó (»²¾È¤Î¤ß)", 16, 5);
2402 prt("(B) Birth Options (Browse Only)", 16, 5);
2409 prt("(B) ½é´ü ¥ª¥×¥·¥ç¥ó", 16, 5);
2411 prt("(B) Birth Options", 16, 5);
2416 if (p_ptr->noscore || allow_debug_opts)
2420 prt("(C) º¾µ½ ¥ª¥×¥·¥ç¥ó", 17, 5);
2422 prt("(C) Cheating Options", 17, 5);
2429 prt("¥³¥Þ¥ó¥É:", 19, 0);
2431 prt("Command: ", 19, 0);
2439 if (k == ESCAPE) break;
2446 /* Process the general options */
2448 do_cmd_options_aux(OPT_PAGE_INPUT, "¥¡¼ÆþÎÏ¥ª¥×¥·¥ç¥ó");
2450 do_cmd_options_aux(OPT_PAGE_INPUT, "Input Options");
2458 /* Process the general options */
2460 do_cmd_options_aux(OPT_PAGE_MAPSCREEN, "¥Þ¥Ã¥×²èÌÌ¥ª¥×¥·¥ç¥ó");
2462 do_cmd_options_aux(OPT_PAGE_MAPSCREEN, "Map Screen Options");
2472 do_cmd_options_aux(OPT_PAGE_TEXT, "¥Æ¥¥¹¥Èɽ¼¨¥ª¥×¥·¥ç¥ó");
2474 do_cmd_options_aux(OPT_PAGE_TEXT, "Text Display Options");
2484 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, "¥²¡¼¥à¥×¥ì¥¤¡¦¥ª¥×¥·¥ç¥ó");
2486 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, "Game-Play Options");
2496 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, "¹ÔÆ°Ãæ»ß´Ø·¸¤Î¥ª¥×¥·¥ç¥ó");
2498 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, "Disturbance Options");
2508 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, "´Ê°×¼«Æ°Ç˲õ¥ª¥×¥·¥ç¥ó");
2510 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, "Easy Auto-Destroyer Options");
2515 /* Play-record Options */
2521 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, "¥×¥ì¥¤µÏ¿¥ª¥×¥·¥ç¥ó");
2523 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, "Play-record Options");
2534 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ? "½é´ü¥ª¥×¥·¥ç¥ó(»²¾È¤Î¤ß)" : "½é´ü¥ª¥×¥·¥ç¥ó((*)¤Ï¥¹¥³¥¢¤Ë±Æ¶Á)");
2536 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ? "Birth Options(browse only)" : "Birth Options((*)s effect score)");
2542 /* Cheating Options */
2545 if (!p_ptr->noscore && !allow_debug_opts)
2547 /* Cheat options are not permitted */
2554 do_cmd_options_cheat("º¾µ½»Õ¤Ï·è¤·¤Æ¾¡Íø¤Ç¤¤Ê¤¤¡ª");
2556 do_cmd_options_cheat("Cheaters never win");
2566 do_cmd_options_autosave("¼«Æ°¥»¡¼¥Ö");
2568 do_cmd_options_autosave("Autosave");
2579 do_cmd_options_win();
2580 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL |
2581 PW_PLAYER | PW_MESSAGE | PW_OVERHEAD |
2582 PW_MONSTER | PW_OBJECT | PW_SNAPSHOT |
2583 PW_BORG_1 | PW_BORG_2 | PW_DUNGEON);
2587 /* Auto-picker/destroyer editor */
2591 do_cmd_edit_autopick();
2595 /* Hack -- Delay Speed */
2601 prt("¥³¥Þ¥ó¥É: ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 19, 0);
2603 prt("Command: Base Delay Factor", 19, 0);
2607 /* Get a new value */
2610 int msec = delay_factor * delay_factor * delay_factor;
2612 prt(format("¸½ºß¤Î¥¦¥§¥¤¥È: %d (%d¥ß¥êÉÃ)",
2613 delay_factor, msec), 22, 0);
2615 prt(format("Current base delay factor: %d (%d msec)",
2616 delay_factor, msec), 22, 0);
2620 prt("¥¦¥§¥¤¥È (0-9) ESC¤Ç·èÄê: ", 20, 0);
2622 prt("Delay Factor (0-9 or ESC to accept): ", 20, 0);
2626 if (k == ESCAPE) break;
2630 (void)show_file(TRUE, "joption.txt#BaseDelay", NULL, 0, 0);
2632 (void)show_file(TRUE, "option.txt#BaseDelay", NULL, 0, 0);
2636 else if (isdigit(k)) delay_factor = D2I(k);
2643 /* Hack -- hitpoint warning factor */
2649 prt("¥³¥Þ¥ó¥É: Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 19, 0);
2651 prt("Command: Hitpoint Warning", 19, 0);
2655 /* Get a new value */
2659 prt(format("¸½ºß¤ÎÄã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð: %d0%%",
2660 hitpoint_warn), 22, 0);
2662 prt(format("Current hitpoint warning: %d0%%",
2663 hitpoint_warn), 22, 0);
2667 prt("Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð (0-9) ESC¤Ç·èÄê: ", 20, 0);
2669 prt("Hitpoint Warning (0-9 or ESC to accept): ", 20, 0);
2673 if (k == ESCAPE) break;
2677 (void)show_file(TRUE, "joption.txt#Hitpoint", NULL, 0, 0);
2679 (void)show_file(TRUE, "option.txt#Hitpoint", NULL, 0, 0);
2683 else if (isdigit(k)) hitpoint_warn = D2I(k);
2690 /* Hack -- mana color factor */
2696 prt("¥³¥Þ¥ó¥É: ÄãËâÎÏ¿§ïçÃÍ", 19, 0);
2698 prt("Command: Mana Color Threshold", 19, 0);
2702 /* Get a new value */
2706 prt(format("¸½ºß¤ÎÄãËâÎÏ¿§ïçÃÍ: %d0%%",
2709 prt(format("Current mana color threshold: %d0%%",
2714 prt("ÄãËâÎÏïçÃÍ (0-9) ESC¤Ç·èÄê: ", 20, 0);
2716 prt("Mana color Threshold (0-9 or ESC to accept): ", 20, 0);
2720 if (k == ESCAPE) break;
2724 (void)show_file(TRUE, "joption.txt#Manapoint", NULL, 0, 0);
2726 (void)show_file(TRUE, "option.txt#Manapoint", NULL, 0, 0);
2730 else if (isdigit(k)) mana_warn = D2I(k);
2739 (void)show_file(TRUE, "joption.txt", NULL, 0, 0);
2741 (void)show_file(TRUE, "option.txt", NULL, 0, 0);
2746 /* Unknown option */
2755 /* Flush messages */
2760 /* Restore the screen */
2763 /* Hack - Redraw equippy chars */
2764 p_ptr->redraw |= (PR_EQUIPPY);
2770 * Ask for a "user pref line" and process it
2772 * XXX XXX XXX Allow absolute file names?
2774 void do_cmd_pref(void)
2781 /* Ask for a "user pref command" */
2783 if (!get_string("ÀßÄêÊѹ¹¥³¥Þ¥ó¥É: ", buf, 80)) return;
2785 if (!get_string("Pref: ", buf, 80)) return;
2789 /* Process that pref command */
2790 (void)process_pref_file_command(buf);
2793 void do_cmd_reload_autopick(void)
2796 if (!get_check("¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹¤«? ")) return;
2798 if (!get_check("Reload auto-pick preference file? ")) return;
2801 /* Load the file with messages */
2802 autopick_load_pref(TRUE);
2808 * Hack -- append all current macros to the given file
2810 static errr macro_dump(cptr fname)
2812 static cptr mark = "Macro Dump";
2818 /* Build the filename */
2819 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2821 /* File type is "TEXT" */
2822 FILE_TYPE(FILE_TYPE_TEXT);
2824 /* Append to the file */
2825 if (!open_auto_dump(buf, mark)) return (-1);
2829 auto_dump_printf("\n# ¼«Æ°¥Þ¥¯¥í¥»¡¼¥Ö\n\n");
2831 auto_dump_printf("\n# Automatic macro dump\n\n");
2835 for (i = 0; i < macro__num; i++)
2837 /* Extract the action */
2838 ascii_to_text(buf, macro__act[i]);
2840 /* Dump the macro */
2841 auto_dump_printf("A:%s\n", buf);
2843 /* Extract the action */
2844 ascii_to_text(buf, macro__pat[i]);
2846 /* Dump normal macros */
2847 auto_dump_printf("P:%s\n", buf);
2850 auto_dump_printf("\n");
2862 * Hack -- ask for a "trigger" (see below)
2864 * Note the complex use of the "inkey()" function from "util.c".
2866 * Note that both "flush()" calls are extremely important.
2868 static void do_cmd_macro_aux(char *buf)
2878 /* Do not process macros */
2884 /* Read the pattern */
2890 /* Do not process macros */
2893 /* Do not wait for keys */
2896 /* Attempt to read a key */
2907 /* Convert the trigger */
2908 ascii_to_text(tmp, buf);
2910 /* Hack -- display the trigger */
2911 Term_addstr(-1, TERM_WHITE, tmp);
2918 * Hack -- ask for a keymap "trigger" (see below)
2920 * Note that both "flush()" calls are extremely important. This may
2921 * no longer be true, since "util.c" is much simpler now. XXX XXX XXX
2923 static void do_cmd_macro_aux_keymap(char *buf)
2937 /* Convert to ascii */
2938 ascii_to_text(tmp, buf);
2940 /* Hack -- display the trigger */
2941 Term_addstr(-1, TERM_WHITE, tmp);
2950 * Hack -- append all keymaps to the given file
2952 static errr keymap_dump(cptr fname)
2954 static cptr mark = "Keymap Dump";
2963 if (rogue_like_commands)
2965 mode = KEYMAP_MODE_ROGUE;
2971 mode = KEYMAP_MODE_ORIG;
2975 /* Build the filename */
2976 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2978 /* File type is "TEXT" */
2979 FILE_TYPE(FILE_TYPE_TEXT);
2981 /* Append to the file */
2982 if (!open_auto_dump(buf, mark)) return -1;
2986 auto_dump_printf("\n# ¼«Æ°¥¡¼ÇÛÃÖ¥»¡¼¥Ö\n\n");
2988 auto_dump_printf("\n# Automatic keymap dump\n\n");
2992 for (i = 0; i < 256; i++)
2996 /* Loop up the keymap */
2997 act = keymap_act[mode][i];
2999 /* Skip empty keymaps */
3002 /* Encode the key */
3005 ascii_to_text(key, buf);
3007 /* Encode the action */
3008 ascii_to_text(buf, act);
3010 /* Dump the macro */
3011 auto_dump_printf("A:%s\n", buf);
3012 auto_dump_printf("C:%d:%s\n", mode, key);
3025 * Interact with "macros"
3027 * Note that the macro "action" must be defined before the trigger.
3029 * Could use some helpful instructions on this page. XXX XXX XXX
3031 void do_cmd_macros(void)
3043 if (rogue_like_commands)
3045 mode = KEYMAP_MODE_ROGUE;
3051 mode = KEYMAP_MODE_ORIG;
3054 /* File type is "TEXT" */
3055 FILE_TYPE(FILE_TYPE_TEXT);
3062 /* Process requests until done */
3070 prt("[ ¥Þ¥¯¥í¤ÎÀßÄê ]", 2, 0);
3072 prt("Interact with Macros", 2, 0);
3077 /* Describe that action */
3079 prt("¥Þ¥¯¥í¹ÔÆ°¤¬(¤â¤·¤¢¤ì¤Ð)²¼¤Ëɽ¼¨¤µ¤ì¤Þ¤¹:", 20, 0);
3081 prt("Current action (if any) shown below:", 20, 0);
3085 /* Analyze the current action */
3086 ascii_to_text(buf, macro__buf);
3088 /* Display the current action */
3094 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
3096 prt("(1) Load a user pref file", 4, 5);
3101 prt("(2) ¥Õ¥¡¥¤¥ë¤Ë¥Þ¥¯¥í¤òÄɲÃ", 5, 5);
3102 prt("(3) ¥Þ¥¯¥í¤Î³Îǧ", 6, 5);
3103 prt("(4) ¥Þ¥¯¥í¤ÎºîÀ®", 7, 5);
3104 prt("(5) ¥Þ¥¯¥í¤Îºï½ü", 8, 5);
3105 prt("(6) ¥Õ¥¡¥¤¥ë¤Ë¥¡¼ÇÛÃÖ¤òÄɲÃ", 9, 5);
3106 prt("(7) ¥¡¼ÇÛÃ֤γÎǧ", 10, 5);
3107 prt("(8) ¥¡¼ÇÛÃ֤κîÀ®", 11, 5);
3108 prt("(9) ¥¡¼ÇÛÃ֤κï½ü", 12, 5);
3109 prt("(0) ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 13, 5);
3111 prt("(2) Append macros to a file", 5, 5);
3112 prt("(3) Query a macro", 6, 5);
3113 prt("(4) Create a macro", 7, 5);
3114 prt("(5) Remove a macro", 8, 5);
3115 prt("(6) Append keymaps to a file", 9, 5);
3116 prt("(7) Query a keymap", 10, 5);
3117 prt("(8) Create a keymap", 11, 5);
3118 prt("(9) Remove a keymap", 12, 5);
3119 prt("(0) Enter a new action", 13, 5);
3122 #endif /* ALLOW_MACROS */
3126 prt("¥³¥Þ¥ó¥É: ", 16, 0);
3128 prt("Command: ", 16, 0);
3136 if (i == ESCAPE) break;
3138 /* Load a 'macro' file */
3145 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 16, 0);
3147 prt("Command: Load a user pref file", 16, 0);
3153 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3155 prt("File: ", 18, 0);
3159 /* Default filename */
3160 sprintf(tmp, "%s.prf", player_base);
3162 /* Ask for a file */
3163 if (!askfor(tmp, 80)) continue;
3165 /* Process the given filename */
3166 err = process_pref_file(tmp);
3170 msg_format("ɸ½à¤ÎÀßÄê¥Õ¥¡¥¤¥ë'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3172 msg_format("Loaded default '%s'.", tmp);
3179 msg_format("'%s'¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡ª", tmp);
3181 msg_format("Failed to load '%s'!");
3187 msg_format("'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3189 msg_format("Loaded '%s'.", tmp);
3201 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3203 prt("Command: Append macros to a file", 16, 0);
3209 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3211 prt("File: ", 18, 0);
3215 /* Default filename */
3216 sprintf(tmp, "%s.prf", player_base);
3218 /* Ask for a file */
3219 if (!askfor(tmp, 80)) continue;
3221 /* Dump the macros */
3222 (void)macro_dump(tmp);
3226 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3228 msg_print("Appended macros.");
3240 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Î³Îǧ", 16, 0);
3242 prt("Command: Query a macro", 16, 0);
3248 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3250 prt("Trigger: ", 18, 0);
3254 /* Get a macro trigger */
3255 do_cmd_macro_aux(buf);
3257 /* Acquire action */
3258 k = macro_find_exact(buf);
3265 msg_print("¤½¤Î¥¡¼¤Ë¤Ï¥Þ¥¯¥í¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3267 msg_print("Found no macro.");
3275 /* Obtain the action */
3276 strcpy(macro__buf, macro__act[k]);
3278 /* Analyze the current action */
3279 ascii_to_text(buf, macro__buf);
3281 /* Display the current action */
3286 msg_print("¥Þ¥¯¥í¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3288 msg_print("Found a macro.");
3294 /* Create a macro */
3299 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ÎºîÀ®", 16, 0);
3301 prt("Command: Create a macro", 16, 0);
3307 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3309 prt("Trigger: ", 18, 0);
3313 /* Get a macro trigger */
3314 do_cmd_macro_aux(buf);
3321 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3323 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3328 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3330 prt("Action: ", 20, 0);
3334 /* Convert to text */
3335 ascii_to_text(tmp, macro__buf);
3337 /* Get an encoded action */
3338 if (askfor(tmp, 80))
3340 /* Convert to ascii */
3341 text_to_ascii(macro__buf, tmp);
3343 /* Link the macro */
3344 macro_add(buf, macro__buf);
3348 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3350 msg_print("Added a macro.");
3356 /* Remove a macro */
3361 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Îºï½ü", 16, 0);
3363 prt("Command: Remove a macro", 16, 0);
3369 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3371 prt("Trigger: ", 18, 0);
3375 /* Get a macro trigger */
3376 do_cmd_macro_aux(buf);
3378 /* Link the macro */
3379 macro_add(buf, buf);
3383 msg_print("¥Þ¥¯¥í¤òºï½ü¤·¤Þ¤·¤¿¡£");
3385 msg_print("Removed a macro.");
3395 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃÖ¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3397 prt("Command: Append keymaps to a file", 16, 0);
3403 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3405 prt("File: ", 18, 0);
3409 /* Default filename */
3410 sprintf(tmp, "%s.prf", player_base);
3412 /* Ask for a file */
3413 if (!askfor(tmp, 80)) continue;
3415 /* Dump the macros */
3416 (void)keymap_dump(tmp);
3420 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3422 msg_print("Appended keymaps.");
3427 /* Query a keymap */
3434 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤γÎǧ", 16, 0);
3436 prt("Command: Query a keymap", 16, 0);
3442 prt("²¡¤¹¥¡¼: ", 18, 0);
3444 prt("Keypress: ", 18, 0);
3448 /* Get a keymap trigger */
3449 do_cmd_macro_aux_keymap(buf);
3451 /* Look up the keymap */
3452 act = keymap_act[mode][(byte)(buf[0])];
3459 msg_print("¥¡¼ÇÛÃÖ¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3461 msg_print("Found no keymap.");
3469 /* Obtain the action */
3470 strcpy(macro__buf, act);
3472 /* Analyze the current action */
3473 ascii_to_text(buf, macro__buf);
3475 /* Display the current action */
3480 msg_print("¥¡¼ÇÛÃÖ¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3482 msg_print("Found a keymap.");
3488 /* Create a keymap */
3493 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κîÀ®", 16, 0);
3495 prt("Command: Create a keymap", 16, 0);
3501 prt("²¡¤¹¥¡¼: ", 18, 0);
3503 prt("Keypress: ", 18, 0);
3507 /* Get a keymap trigger */
3508 do_cmd_macro_aux_keymap(buf);
3515 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3517 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3522 prt("¹ÔÆ°: ", 20, 0);
3524 prt("Action: ", 20, 0);
3528 /* Convert to text */
3529 ascii_to_text(tmp, macro__buf);
3531 /* Get an encoded action */
3532 if (askfor(tmp, 80))
3534 /* Convert to ascii */
3535 text_to_ascii(macro__buf, tmp);
3537 /* Free old keymap */
3538 string_free(keymap_act[mode][(byte)(buf[0])]);
3540 /* Make new keymap */
3541 keymap_act[mode][(byte)(buf[0])] = string_make(macro__buf);
3545 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3547 msg_print("Added a keymap.");
3553 /* Remove a keymap */
3558 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κï½ü", 16, 0);
3560 prt("Command: Remove a keymap", 16, 0);
3566 prt("²¡¤¹¥¡¼: ", 18, 0);
3568 prt("Keypress: ", 18, 0);
3572 /* Get a keymap trigger */
3573 do_cmd_macro_aux_keymap(buf);
3575 /* Free old keymap */
3576 string_free(keymap_act[mode][(byte)(buf[0])]);
3578 /* Make new keymap */
3579 keymap_act[mode][(byte)(buf[0])] = NULL;
3583 msg_print("¥¡¼ÇÛÃÖ¤òºï½ü¤·¤Þ¤·¤¿¡£");
3585 msg_print("Removed a keymap.");
3590 /* Enter a new action */
3595 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 16, 0);
3597 prt("Command: Enter a new action", 16, 0);
3605 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3607 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3612 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3614 prt("Action: ", 20, 0);
3617 /* Hack -- limit the value */
3620 /* Get an encoded action */
3621 if (!askfor(buf, 80)) continue;
3623 /* Extract an action */
3624 text_to_ascii(macro__buf, buf);
3627 #endif /* ALLOW_MACROS */
3636 /* Flush messages */
3645 static cptr lighting_level_str[F_LIT_MAX] =
3659 static bool cmd_visuals_aux(int i, int *num, int max)
3666 sprintf(str, "%d", *num);
3668 if (!get_string(format("Input new number(0-%d): ", max-1), str, 4))
3671 tmp = strtol(str, NULL, 0);
3672 if (tmp >= 0 && tmp < max)
3675 else if (isupper(i))
3676 *num = (*num + max - 1) % max;
3678 *num = (*num + 1) % max;
3683 static void print_visuals_menu(cptr choice_msg)
3686 prt("[ ²èÌÌɽ¼¨¤ÎÀßÄê ]", 1, 0);
3688 prt("Interact with Visuals", 1, 0);
3691 /* Give some choices */
3693 prt("(0) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 3, 5);
3695 prt("(0) Load a user pref file", 3, 5);
3698 #ifdef ALLOW_VISUALS
3700 prt("(1) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 4, 5);
3701 prt("(2) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
3702 prt("(3) ÃÏ·Á¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 6, 5);
3703 prt("(4) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 7, 5);
3704 prt("(5) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 8, 5);
3705 prt("(6) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 9, 5);
3706 prt("(7) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 10, 5);
3707 prt("(8) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 11, 5);
3708 prt("(9) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 12, 5);
3710 prt("(1) Dump monster attr/chars", 4, 5);
3711 prt("(2) Dump object attr/chars", 5, 5);
3712 prt("(3) Dump feature attr/chars", 6, 5);
3713 prt("(4) Change monster attr/chars (numeric operation)", 7, 5);
3714 prt("(5) Change object attr/chars (numeric operation)", 8, 5);
3715 prt("(6) Change feature attr/chars (numeric operation)", 9, 5);
3716 prt("(7) Change monster attr/chars (visual mode)", 10, 5);
3717 prt("(8) Change object attr/chars (visual mode)", 11, 5);
3718 prt("(9) Change feature attr/chars (visual mode)", 12, 5);
3721 #endif /* ALLOW_VISUALS */
3724 prt("(R) ²èÌÌɽ¼¨ÊýË¡¤Î½é´ü²½", 13, 5);
3726 prt("(R) Reset visuals", 13, 5);
3731 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg ? choice_msg : ""), 15, 0);
3733 prt(format("Command: %s", choice_msg ? choice_msg : ""), 15, 0);
3737 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, int direct_r_idx);
3738 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int direct_k_idx);
3739 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int direct_f_idx, int *lighting_level);
3742 * Interact with "visuals"
3744 void do_cmd_visuals(void)
3749 bool need_redraw = FALSE;
3750 const char *empty_symbol = "<< ? >>";
3752 if (use_bigtile) empty_symbol = "<< ?? >>";
3754 /* File type is "TEXT" */
3755 FILE_TYPE(FILE_TYPE_TEXT);
3757 /* Save the screen */
3760 /* Interact until done */
3766 /* Ask for a choice */
3767 print_visuals_menu(NULL);
3773 if (i == ESCAPE) break;
3777 /* Load a 'pref' file */
3781 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 15, 0);
3783 prt("Command: Load a user pref file", 15, 0);
3788 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3790 prt("File: ", 17, 0);
3793 /* Default filename */
3794 sprintf(tmp, "%s.prf", player_base);
3797 if (!askfor(tmp, 70)) continue;
3799 /* Process the given filename */
3800 (void)process_pref_file(tmp);
3805 #ifdef ALLOW_VISUALS
3807 /* Dump monster attr/chars */
3810 static cptr mark = "Monster attr/chars";
3814 prt("¥³¥Þ¥ó¥É: ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3816 prt("Command: Dump monster attr/chars", 15, 0);
3821 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3823 prt("File: ", 17, 0);
3826 /* Default filename */
3827 sprintf(tmp, "%s.prf", player_base);
3829 /* Get a filename */
3830 if (!askfor(tmp, 70)) continue;
3832 /* Build the filename */
3833 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3835 /* Append to the file */
3836 if (!open_auto_dump(buf, mark)) continue;
3840 auto_dump_printf("\n# ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3842 auto_dump_printf("\n# Monster attr/char definitions\n\n");
3846 for (i = 0; i < max_r_idx; i++)
3848 monster_race *r_ptr = &r_info[i];
3850 /* Skip non-entries */
3851 if (!r_ptr->name) continue;
3853 /* Dump a comment */
3854 auto_dump_printf("# %s\n", (r_name + r_ptr->name));
3856 /* Dump the monster attr/char info */
3857 auto_dump_printf("R:%d:0x%02X/0x%02X\n\n", i,
3858 (byte)(r_ptr->x_attr), (byte)(r_ptr->x_char));
3866 msg_print("¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3868 msg_print("Dumped monster attr/chars.");
3874 /* Dump object attr/chars */
3877 static cptr mark = "Object attr/chars";
3881 prt("¥³¥Þ¥ó¥É: ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3883 prt("Command: Dump object attr/chars", 15, 0);
3888 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3890 prt("File: ", 17, 0);
3893 /* Default filename */
3894 sprintf(tmp, "%s.prf", player_base);
3896 /* Get a filename */
3897 if (!askfor(tmp, 70)) continue;
3899 /* Build the filename */
3900 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3902 /* Append to the file */
3903 if (!open_auto_dump(buf, mark)) continue;
3907 auto_dump_printf("\n# ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3909 auto_dump_printf("\n# Object attr/char definitions\n\n");
3913 for (i = 0; i < max_k_idx; i++)
3916 object_kind *k_ptr = &k_info[i];
3918 /* Skip non-entries */
3919 if (!k_ptr->name) continue;
3924 strip_name(o_name, i);
3930 /* Prepare dummy object */
3931 object_prep(&forge, i);
3933 /* Get un-shuffled flavor name */
3934 object_desc(o_name, &forge, OD_FORCE_FLAVOR);
3937 /* Dump a comment */
3938 auto_dump_printf("# %s\n", o_name);
3940 /* Dump the object attr/char info */
3941 auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", i,
3942 (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char));
3950 msg_print("¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3952 msg_print("Dumped object attr/chars.");
3958 /* Dump feature attr/chars */
3961 static cptr mark = "Feature attr/chars";
3965 prt("¥³¥Þ¥ó¥É: ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3967 prt("Command: Dump feature attr/chars", 15, 0);
3972 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3974 prt("File: ", 17, 0);
3977 /* Default filename */
3978 sprintf(tmp, "%s.prf", player_base);
3980 /* Get a filename */
3981 if (!askfor(tmp, 70)) continue;
3983 /* Build the filename */
3984 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3986 /* Append to the file */
3987 if (!open_auto_dump(buf, mark)) continue;
3991 auto_dump_printf("\n# ÃÏ·Á¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3993 auto_dump_printf("\n# Feature attr/char definitions\n\n");
3997 for (i = 0; i < max_f_idx; i++)
3999 feature_type *f_ptr = &f_info[i];
4001 /* Skip non-entries */
4002 if (!f_ptr->name) continue;
4004 /* Skip mimiccing features */
4005 if (f_ptr->mimic != i) continue;
4007 /* Dump a comment */
4008 auto_dump_printf("# %s\n", (f_name + f_ptr->name));
4010 /* Dump the feature attr/char info */
4011 auto_dump_printf("F:%d:0x%02X/0x%02X:0x%02X/0x%02X:0x%02X/0x%02X\n\n", i,
4012 (byte)(f_ptr->x_attr[F_LIT_STANDARD]), (byte)(f_ptr->x_char[F_LIT_STANDARD]),
4013 (byte)(f_ptr->x_attr[F_LIT_LITE]), (byte)(f_ptr->x_char[F_LIT_LITE]),
4014 (byte)(f_ptr->x_attr[F_LIT_DARK]), (byte)(f_ptr->x_char[F_LIT_DARK]));
4022 msg_print("ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
4024 msg_print("Dumped feature attr/chars.");
4030 /* Modify monster attr/chars (numeric operation) */
4034 static cptr choice_msg = "¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4036 static cptr choice_msg = "Change monster attr/chars";
4041 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4043 prt(format("Command: %s", choice_msg), 15, 0);
4046 /* Hack -- query until done */
4049 monster_race *r_ptr = &r_info[r];
4053 byte da = r_ptr->d_attr;
4054 byte dc = r_ptr->d_char;
4055 byte ca = r_ptr->x_attr;
4056 byte cc = r_ptr->x_char;
4058 /* Label the object */
4060 Term_putstr(5, 17, -1, TERM_WHITE,
4061 format("¥â¥ó¥¹¥¿¡¼ = %d, ̾Á° = %-40.40s",
4062 r, (r_name + r_ptr->name)));
4064 Term_putstr(5, 17, -1, TERM_WHITE,
4065 format("Monster = %d, Name = %-40.40s",
4066 r, (r_name + r_ptr->name)));
4069 /* Label the Default values */
4071 Term_putstr(10, 19, -1, TERM_WHITE,
4072 format("½é´üÃÍ ¿§ / ʸ»ú = %3u / %3u", da, dc));
4074 Term_putstr(10, 19, -1, TERM_WHITE,
4075 format("Default attr/char = %3u / %3u", da, dc));
4078 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4079 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4081 /* Label the Current values */
4083 Term_putstr(10, 20, -1, TERM_WHITE,
4084 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3u / %3u", ca, cc));
4086 Term_putstr(10, 20, -1, TERM_WHITE,
4087 format("Current attr/char = %3u / %3u", ca, cc));
4090 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4091 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4095 Term_putstr(0, 22, -1, TERM_WHITE,
4096 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4098 Term_putstr(0, 22, -1, TERM_WHITE,
4099 "Command (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4106 if (i == ESCAPE) break;
4108 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4109 else if (isupper(i)) c = 'a' + i - 'A';
4119 if (!cmd_visuals_aux(i, &r, max_r_idx))
4125 while (!r_info[r].name);
4129 t = (int)r_ptr->x_attr;
4130 (void)cmd_visuals_aux(i, &t, 256);
4131 r_ptr->x_attr = (byte)t;
4135 t = (int)r_ptr->x_char;
4136 (void)cmd_visuals_aux(i, &t, 256);
4137 r_ptr->x_char = (byte)t;
4141 do_cmd_knowledge_monsters(&need_redraw, TRUE, r);
4145 print_visuals_menu(choice_msg);
4153 /* Modify object attr/chars (numeric operation) */
4157 static cptr choice_msg = "¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4159 static cptr choice_msg = "Change object attr/chars";
4164 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4166 prt(format("Command: %s", choice_msg), 15, 0);
4169 /* Hack -- query until done */
4172 object_kind *k_ptr = &k_info[k];
4176 byte da = k_ptr->d_attr;
4177 byte dc = k_ptr->d_char;
4178 byte ca = k_ptr->x_attr;
4179 byte cc = k_ptr->x_char;
4181 /* Label the object */
4183 Term_putstr(5, 17, -1, TERM_WHITE,
4184 format("¥¢¥¤¥Æ¥à = %d, ̾Á° = %-40.40s",
4185 k, k_name + (!k_ptr->flavor ? k_ptr->name : k_ptr->flavor_name)));
4187 Term_putstr(5, 17, -1, TERM_WHITE,
4188 format("Object = %d, Name = %-40.40s",
4189 k, k_name + (!k_ptr->flavor ? k_ptr->name : k_ptr->flavor_name)));
4192 /* Label the Default values */
4194 Term_putstr(10, 19, -1, TERM_WHITE,
4195 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4197 Term_putstr(10, 19, -1, TERM_WHITE,
4198 format("Default attr/char = %3d / %3d", da, dc));
4201 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4202 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4204 /* Label the Current values */
4206 Term_putstr(10, 20, -1, TERM_WHITE,
4207 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4209 Term_putstr(10, 20, -1, TERM_WHITE,
4210 format("Current attr/char = %3d / %3d", ca, cc));
4213 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4214 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4218 Term_putstr(0, 22, -1, TERM_WHITE,
4219 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4221 Term_putstr(0, 22, -1, TERM_WHITE,
4222 "Command (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4229 if (i == ESCAPE) break;
4231 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4232 else if (isupper(i)) c = 'a' + i - 'A';
4242 if (!cmd_visuals_aux(i, &k, max_k_idx))
4248 while (!k_info[k].name);
4252 t = (int)k_ptr->x_attr;
4253 (void)cmd_visuals_aux(i, &t, 256);
4254 k_ptr->x_attr = (byte)t;
4258 t = (int)k_ptr->x_char;
4259 (void)cmd_visuals_aux(i, &t, 256);
4260 k_ptr->x_char = (byte)t;
4264 do_cmd_knowledge_objects(&need_redraw, TRUE, k);
4268 print_visuals_menu(choice_msg);
4276 /* Modify feature attr/chars (numeric operation) */
4280 static cptr choice_msg = "ÃÏ·Á¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4282 static cptr choice_msg = "Change feature attr/chars";
4285 static int lighting_level = F_LIT_STANDARD;
4288 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4290 prt(format("Command: %s", choice_msg), 15, 0);
4293 /* Hack -- query until done */
4296 feature_type *f_ptr = &f_info[f];
4300 byte da = f_ptr->d_attr[lighting_level];
4301 byte dc = f_ptr->d_char[lighting_level];
4302 byte ca = f_ptr->x_attr[lighting_level];
4303 byte cc = f_ptr->x_char[lighting_level];
4305 /* Label the object */
4308 Term_putstr(5, 17, -1, TERM_WHITE,
4309 format("ÃÏ·Á = %d, ̾Á° = %s, ÌÀÅÙ = %s",
4310 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
4312 Term_putstr(5, 17, -1, TERM_WHITE,
4313 format("Terrain = %d, Name = %s, Lighting = %s",
4314 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
4317 /* Label the Default values */
4319 Term_putstr(10, 19, -1, TERM_WHITE,
4320 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4322 Term_putstr(10, 19, -1, TERM_WHITE,
4323 format("Default attr/char = %3d / %3d", da, dc));
4326 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4328 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4330 /* Label the Current values */
4332 Term_putstr(10, 20, -1, TERM_WHITE,
4333 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4335 Term_putstr(10, 20, -1, TERM_WHITE,
4336 format("Current attr/char = %3d / %3d", ca, cc));
4339 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4340 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4344 Term_putstr(0, 22, -1, TERM_WHITE,
4345 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
4347 Term_putstr(0, 22, -1, TERM_WHITE,
4348 "Command (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
4355 if (i == ESCAPE) break;
4357 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4358 else if (isupper(i)) c = 'a' + i - 'A';
4368 if (!cmd_visuals_aux(i, &f, max_f_idx))
4374 while (!f_info[f].name || (f_info[f].mimic != f));
4378 t = (int)f_ptr->x_attr[lighting_level];
4379 (void)cmd_visuals_aux(i, &t, 256);
4380 f_ptr->x_attr[lighting_level] = (byte)t;
4384 t = (int)f_ptr->x_char[lighting_level];
4385 (void)cmd_visuals_aux(i, &t, 256);
4386 f_ptr->x_char[lighting_level] = (byte)t;
4390 (void)cmd_visuals_aux(i, &lighting_level, F_LIT_MAX);
4393 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
4397 do_cmd_knowledge_features(&need_redraw, TRUE, f, &lighting_level);
4401 print_visuals_menu(choice_msg);
4409 /* Modify monster attr/chars (visual mode) */
4411 do_cmd_knowledge_monsters(&need_redraw, TRUE, -1);
4414 /* Modify object attr/chars (visual mode) */
4416 do_cmd_knowledge_objects(&need_redraw, TRUE, -1);
4419 /* Modify feature attr/chars (visual mode) */
4422 int lighting_level = F_LIT_STANDARD;
4423 do_cmd_knowledge_features(&need_redraw, TRUE, -1, &lighting_level);
4427 #endif /* ALLOW_VISUALS */
4437 msg_print("²èÌ̾å¤Î[¿§/ʸ»ú]¤ò½é´üÃͤ˥ꥻ¥Ã¥È¤·¤Þ¤·¤¿¡£");
4439 msg_print("Visual attr/char tables reset.");
4445 /* Unknown option */
4451 /* Flush messages */
4455 /* Restore the screen */
4458 if (need_redraw) do_cmd_redraw();
4463 * Interact with "colors"
4465 void do_cmd_colors(void)
4474 /* File type is "TEXT" */
4475 FILE_TYPE(FILE_TYPE_TEXT);
4478 /* Save the screen */
4482 /* Interact until done */
4488 /* Ask for a choice */
4490 prt("[ ¥«¥é¡¼¤ÎÀßÄê ]", 2, 0);
4492 prt("Interact with Colors", 2, 0);
4496 /* Give some choices */
4498 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
4500 prt("(1) Load a user pref file", 4, 5);
4505 prt("(2) ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
4506 prt("(3) ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤¹¤ë", 6, 5);
4508 prt("(2) Dump colors", 5, 5);
4509 prt("(3) Modify colors", 6, 5);
4516 prt("¥³¥Þ¥ó¥É: ", 8, 0);
4518 prt("Command: ", 8, 0);
4526 if (i == ESCAPE) break;
4528 /* Load a 'pref' file */
4533 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹", 8, 0);
4535 prt("Command: Load a user pref file", 8, 0);
4541 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4543 prt("File: ", 10, 0);
4548 sprintf(tmp, "%s.prf", player_base);
4551 if (!askfor(tmp, 70)) continue;
4553 /* Process the given filename */
4554 (void)process_pref_file(tmp);
4556 /* Mega-Hack -- react to changes */
4557 Term_xtra(TERM_XTRA_REACT, 0);
4559 /* Mega-Hack -- redraw */
4568 static cptr mark = "Colors";
4572 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 8, 0);
4574 prt("Command: Dump colors", 8, 0);
4580 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4582 prt("File: ", 10, 0);
4586 /* Default filename */
4587 sprintf(tmp, "%s.prf", player_base);
4589 /* Get a filename */
4590 if (!askfor(tmp, 70)) continue;
4592 /* Build the filename */
4593 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
4595 /* Append to the file */
4596 if (!open_auto_dump(buf, mark)) continue;
4600 auto_dump_printf("\n# ¥«¥é¡¼¤ÎÀßÄê\n\n");
4602 auto_dump_printf("\n# Color redefinitions\n\n");
4606 for (i = 0; i < 256; i++)
4608 int kv = angband_color_table[i][0];
4609 int rv = angband_color_table[i][1];
4610 int gv = angband_color_table[i][2];
4611 int bv = angband_color_table[i][3];
4616 cptr name = "unknown";
4620 /* Skip non-entries */
4621 if (!kv && !rv && !gv && !bv) continue;
4623 /* Extract the color name */
4624 if (i < 16) name = color_names[i];
4626 /* Dump a comment */
4628 auto_dump_printf("# ¥«¥é¡¼ '%s'\n", name);
4630 auto_dump_printf("# Color '%s'\n", name);
4633 /* Dump the monster attr/char info */
4634 auto_dump_printf("V:%d:0x%02X:0x%02X:0x%02X:0x%02X\n\n",
4643 msg_print("¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
4645 msg_print("Dumped color redefinitions.");
4657 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤·¤Þ¤¹", 8, 0);
4659 prt("Command: Modify colors", 8, 0);
4663 /* Hack -- query until done */
4672 /* Exhibit the normal colors */
4673 for (j = 0; j < 16; j++)
4675 /* Exhibit this color */
4676 Term_putstr(j*4, 20, -1, a, "###");
4678 /* Exhibit all colors */
4679 Term_putstr(j*4, 22, -1, j, format("%3d", j));
4682 /* Describe the color */
4684 name = ((a < 16) ? color_names[a] : "̤ÄêµÁ");
4686 name = ((a < 16) ? color_names[a] : "undefined");
4690 /* Describe the color */
4692 Term_putstr(5, 10, -1, TERM_WHITE,
4693 format("¥«¥é¡¼ = %d, ̾Á° = %s", a, name));
4695 Term_putstr(5, 10, -1, TERM_WHITE,
4696 format("Color = %d, Name = %s", a, name));
4700 /* Label the Current values */
4701 Term_putstr(5, 12, -1, TERM_WHITE,
4702 format("K = 0x%02x / R,G,B = 0x%02x,0x%02x,0x%02x",
4703 angband_color_table[a][0],
4704 angband_color_table[a][1],
4705 angband_color_table[a][2],
4706 angband_color_table[a][3]));
4710 Term_putstr(0, 14, -1, TERM_WHITE,
4711 "¥³¥Þ¥ó¥É (n/N/k/K/r/R/g/G/b/B): ");
4713 Term_putstr(0, 14, -1, TERM_WHITE,
4714 "Command (n/N/k/K/r/R/g/G/b/B): ");
4722 if (i == ESCAPE) break;
4725 if (i == 'n') a = (byte)(a + 1);
4726 if (i == 'N') a = (byte)(a - 1);
4727 if (i == 'k') angband_color_table[a][0] = (byte)(angband_color_table[a][0] + 1);
4728 if (i == 'K') angband_color_table[a][0] = (byte)(angband_color_table[a][0] - 1);
4729 if (i == 'r') angband_color_table[a][1] = (byte)(angband_color_table[a][1] + 1);
4730 if (i == 'R') angband_color_table[a][1] = (byte)(angband_color_table[a][1] - 1);
4731 if (i == 'g') angband_color_table[a][2] = (byte)(angband_color_table[a][2] + 1);
4732 if (i == 'G') angband_color_table[a][2] = (byte)(angband_color_table[a][2] - 1);
4733 if (i == 'b') angband_color_table[a][3] = (byte)(angband_color_table[a][3] + 1);
4734 if (i == 'B') angband_color_table[a][3] = (byte)(angband_color_table[a][3] - 1);
4736 /* Hack -- react to changes */
4737 Term_xtra(TERM_XTRA_REACT, 0);
4739 /* Hack -- redraw */
4746 /* Unknown option */
4752 /* Flush messages */
4757 /* Restore the screen */
4763 * Note something in the message recall
4765 void do_cmd_note(void)
4774 if (!get_string("¥á¥â: ", buf, 60)) return;
4776 if (!get_string("Note: ", buf, 60)) return;
4780 /* Ignore empty notes */
4781 if (!buf[0] || (buf[0] == ' ')) return;
4783 /* Add the note to the message recall */
4785 msg_format("¥á¥â: %s", buf);
4787 msg_format("Note: %s", buf);
4794 * Mention the current version
4796 void do_cmd_version(void)
4801 msg_format("ÊѶòÈÚÅÜ(Hengband) %d.%d.%d",
4802 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4804 msg_format("You are playing Hengband %d.%d.%d.",
4805 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4812 * Array of feeling strings
4814 static cptr do_cmd_feeling_text[11] =
4817 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4819 "Looks like any other level.",
4823 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4825 "You feel there is something special about this level.",
4829 "¶²¤í¤·¤¤»à¤Î¸¸¤¬ÌܤËÉ⤫¤Ó¡¢µ¤À䤷¤½¤¦¤Ë¤Ê¤Ã¤¿¡ª",
4831 "You nearly faint as horrible visions of death fill your mind!",
4835 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4837 "This level looks very dangerous.",
4841 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4843 "You have a very bad feeling...",
4847 "°¤¤Í½´¶¤¬¤¹¤ë...",
4849 "You have a bad feeling...",
4855 "You feel nervous.",
4859 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4861 "You feel your luck is turning...",
4865 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4867 "You don't like the look of this place.",
4871 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4873 "This level looks reasonably safe.",
4877 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4879 "What a boring place..."
4884 static cptr do_cmd_feeling_text_combat[11] =
4887 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4889 "Looks like any other level.",
4893 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4895 "You feel there is something special about this level.",
4899 "º£Ìë¤â¤Þ¤¿¡¢Ã¯¤«¤¬Ì¿¤òÍî¤È¤¹...",
4901 "You nearly faint as horrible visions of death fill your mind!",
4905 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4907 "This level looks very dangerous.",
4911 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4913 "You have a very bad feeling...",
4917 "°¤¤Í½´¶¤¬¤¹¤ë...",
4919 "You have a bad feeling...",
4925 "You feel nervous.",
4929 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4931 "You feel your luck is turning...",
4935 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4937 "You don't like the look of this place.",
4941 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4943 "This level looks reasonably safe.",
4947 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4949 "What a boring place..."
4954 static cptr do_cmd_feeling_text_lucky[11] =
4957 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4958 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4959 "¤³¤Î³¬¤Ï¤³¤Î¾å¤Ê¤¯ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë¡£",
4960 "ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë...",
4961 "¤È¤Æ¤âÎɤ¤´¶¤¸¤¬¤¹¤ë...",
4962 "Îɤ¤´¶¤¸¤¬¤¹¤ë...",
4963 "¤Á¤ç¤Ã¤È¹¬±¿¤Ê´¶¤¸¤¬¤¹¤ë...",
4964 "¿¾¯¤Ï±¿¤¬¸þ¤¤¤Æ¤¤¿¤«...",
4965 "¸«¤¿´¶¤¸°¤¯¤Ï¤Ê¤¤...",
4966 "Á´Á³ÂÌÌܤȤ¤¤¦¤³¤È¤Ï¤Ê¤¤¤¬...",
4967 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4969 "Looks like any other level.",
4970 "You feel there is something special about this level.",
4971 "You have a superb feeling about this level.",
4972 "You have an excellent feeling...",
4973 "You have a very good feeling...",
4974 "You have a good feeling...",
4975 "You feel strangely lucky...",
4976 "You feel your luck is turning...",
4977 "You like the look of this place...",
4978 "This level can't be all bad...",
4979 "What a boring place..."
4985 * Note that "feeling" is set to zero unless some time has passed.
4986 * Note that this is done when the level is GENERATED, not entered.
4988 void do_cmd_feeling(void)
4990 /* No useful feeling in quests */
4991 if (p_ptr->inside_quest && !random_quest_number(dun_level))
4994 msg_print("ŵ·¿Åª¤Ê¥¯¥¨¥¹¥È¤Î¥À¥ó¥¸¥ç¥ó¤Î¤è¤¦¤À¡£");
4996 msg_print("Looks like a typical quest level.");
5002 /* No useful feeling in town */
5003 else if (p_ptr->town_num && !dun_level)
5006 if (!strcmp(town[p_ptr->town_num].name, "¹ÓÌî"))
5008 if (!strcmp(town[p_ptr->town_num].name, "wilderness"))
5012 msg_print("²¿¤«¤¢¤ê¤½¤¦¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
5014 msg_print("Looks like a strange wilderness.");
5022 msg_print("ŵ·¿Åª¤ÊÄ®¤Î¤è¤¦¤À¡£");
5024 msg_print("Looks like a typical town.");
5031 /* No useful feeling in the wilderness */
5032 else if (!dun_level)
5035 msg_print("ŵ·¿Åª¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
5037 msg_print("Looks like a typical wilderness.");
5043 /* Display the feeling */
5044 if (p_ptr->muta3 & MUT3_GOOD_LUCK)
5045 msg_print(do_cmd_feeling_text_lucky[p_ptr->feeling]);
5046 else if (p_ptr->pseikaku == SEIKAKU_COMBAT ||
5047 inventory[INVEN_BOW].name1 == ART_CRIMSON)
5048 msg_print(do_cmd_feeling_text_combat[p_ptr->feeling]);
5050 msg_print(do_cmd_feeling_text[p_ptr->feeling]);
5056 * Description of each monster group.
5058 static cptr monster_group_text[] =
5061 "¥æ¥Ë¡¼¥¯", /* "Uniques" */
5062 "¾èÇϲÄǽ¤Ê¥â¥ó¥¹¥¿¡¼", /* "Riding" */
5091 /* "¸ÅÂå¥É¥é¥´¥ó/¥ï¥¤¥¢¡¼¥à", */
5108 /* "¾åµé¥Ç¡¼¥â¥ó", */
5150 /* "Ancient Dragon/Wyrm", */
5159 "Multi-Headed Reptile",
5164 "Reptile/Amphibian",
5165 "Spider/Scorpion/Tick",
5167 /* "Major Demon", */
5184 * Symbols of monsters in each group. Note the "Uniques" group
5185 * is handled differently.
5187 static cptr monster_group_char[] =
5242 "!$&()+./=>?[\\]`{|~",
5252 * hook function to sort monsters by level
5254 static bool ang_sort_comp_monster_level(vptr u, vptr v, int a, int b)
5256 u16b *who = (u16b*)(u);
5261 monster_race *r_ptr1 = &r_info[w1];
5262 monster_race *r_ptr2 = &r_info[w2];
5267 if (r_ptr2->level > r_ptr1->level) return TRUE;
5268 if (r_ptr1->level > r_ptr2->level) return FALSE;
5270 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return TRUE;
5271 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return FALSE;
5276 * Build a list of monster indexes in the given group. Return the number
5277 * of monsters in the group.
5279 * mode & 0x01 : check for non-empty group
5280 * mode & 0x02 : visual operation only
5282 static int collect_monsters(int grp_cur, s16b mon_idx[], byte mode)
5287 /* Get a list of x_char in this group */
5288 cptr group_char = monster_group_char[grp_cur];
5290 /* XXX Hack -- Check if this is the "Uniques" group */
5291 bool grp_unique = (monster_group_char[grp_cur] == (char *) -1L);
5293 /* XXX Hack -- Check if this is the "Riding" group */
5294 bool grp_riding = (monster_group_char[grp_cur] == (char *) -2L);
5296 /* Check every race */
5297 for (i = 0; i < max_r_idx; i++)
5299 /* Access the race */
5300 monster_race *r_ptr = &r_info[i];
5302 /* Skip empty race */
5303 if (!r_ptr->name) continue ;
5305 /* Require known monsters */
5306 if (!(mode & 0x02) && !cheat_know && !r_ptr->r_sights) continue;
5310 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
5313 else if (grp_riding)
5315 if (!(r_ptr->flags7 & RF7_RIDING)) continue;
5320 /* Check for race in the group */
5321 if (!my_strchr(group_char, r_ptr->d_char)) continue;
5325 mon_idx[mon_cnt++] = i;
5327 /* XXX Hack -- Just checking for non-empty group */
5328 if (mode & 0x01) break;
5331 /* Terminate the list */
5332 mon_idx[mon_cnt] = -1;
5334 /* Select the sort method */
5335 ang_sort_comp = ang_sort_comp_monster_level;
5336 ang_sort_swap = ang_sort_swap_hook;
5338 /* Sort by monster level */
5339 ang_sort(mon_idx, &dummy_why, mon_cnt);
5341 /* Return the number of races */
5347 * Description of each monster group.
5349 static cptr object_group_text[] =
5352 "¥¥Î¥³", /* "Mushrooms" */
5353 "Ìô", /* "Potions" */
5354 "Ìý¤Ä¤Ü", /* "Flasks" */
5355 "´¬Êª", /* "Scrolls" */
5356 "»ØÎØ", /* "Rings" */
5357 "¥¢¥ß¥å¥ì¥Ã¥È", /* "Amulets" */
5358 "ū", /* "Whistle" */
5359 "¸÷¸»", /* "Lanterns" */
5360 "ËâË¡ËÀ", /* "Wands" */
5361 "¾ó", /* "Staffs" */
5362 "¥í¥Ã¥É", /* "Rods" */
5363 "¥«¡¼¥É", /* "Cards" */
5364 "¥¥ã¥×¥Á¥ã¡¼¡¦¥Ü¡¼¥ë",
5374 "Åá·õÎà", /* "Swords" */
5375 "Æß´ï", /* "Blunt Weapons" */
5376 "ĹÊÁÉð´ï", /* "Polearms" */
5377 "ºÎ·¡Æ»¶ñ", /* "Diggers" */
5378 "Èô¤ÓÆ»¶ñ", /* "Bows" */
5382 "·ÚÁõ³»", /* "Soft Armor" */
5383 "½ÅÁõ³»", /* "Hard Armor" */
5384 "¥É¥é¥´¥ó³»", /* "Dragon Armor" */
5385 "½â", /* "Shields" */
5386 "¥¯¥í¡¼¥¯", /* "Cloaks" */
5387 "äƼê", /* "Gloves" */
5388 "¥Ø¥ë¥á¥Ã¥È", /* "Helms" */
5389 "´§", /* "Crowns" */
5390 "¥Ö¡¼¥Ä", /* "Boots" */
5443 * TVALs of items in each group
5445 static byte object_group_tval[] =
5486 TV_LIFE_BOOK, /* Hack -- all spellbooks */
5494 * Build a list of object indexes in the given group. Return the number
5495 * of objects in the group.
5497 * mode & 0x01 : check for non-empty group
5498 * mode & 0x02 : visual operation only
5500 static int collect_objects(int grp_cur, int object_idx[], byte mode)
5502 int i, j, k, object_cnt = 0;
5504 /* Get a list of x_char in this group */
5505 byte group_tval = object_group_tval[grp_cur];
5507 /* Check every object */
5508 for (i = 0; i < max_k_idx; i++)
5510 /* Access the object */
5511 object_kind *k_ptr = &k_info[i];
5513 /* Skip empty objects */
5514 if (!k_ptr->name) continue;
5518 /* Any objects will be displayed */
5524 /* Skip non-flavoured objects */
5525 if (!k_ptr->flavor) continue;
5527 /* Require objects ever seen */
5528 if (!k_ptr->aware) continue;
5531 /* Skip items with no distribution (special artifacts) */
5532 for (j = 0, k = 0; j < 4; j++) k += k_ptr->chance[j];
5536 /* Check for objects in the group */
5537 if (TV_LIFE_BOOK == group_tval)
5539 /* Hack -- All spell books */
5540 if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HISSATSU_BOOK)
5542 /* Add the object */
5543 object_idx[object_cnt++] = i;
5547 else if (k_ptr->tval == group_tval)
5549 /* Add the object */
5550 object_idx[object_cnt++] = i;
5554 /* XXX Hack -- Just checking for non-empty group */
5555 if (mode & 0x01) break;
5558 /* Terminate the list */
5559 object_idx[object_cnt] = -1;
5561 /* Return the number of objects */
5567 * Description of each feature group.
5569 static cptr feature_group_text[] =
5577 * Build a list of feature indexes in the given group. Return the number
5578 * of features in the group.
5580 * mode & 0x01 : check for non-empty group
5582 static int collect_features(int grp_cur, int *feat_idx, byte mode)
5584 int i, feat_cnt = 0;
5586 /* Unused; There is a single group. */
5589 /* Check every feature */
5590 for (i = 0; i < max_f_idx; i++)
5592 /* Access the index */
5593 feature_type *f_ptr = &f_info[i];
5595 /* Skip empty index */
5596 if (!f_ptr->name) continue;
5598 /* Skip mimiccing features */
5599 if (f_ptr->mimic != i) continue;
5602 feat_idx[feat_cnt++] = i;
5604 /* XXX Hack -- Just checking for non-empty group */
5605 if (mode & 0x01) break;
5608 /* Terminate the list */
5609 feat_idx[feat_cnt] = -1;
5611 /* Return the number of races */
5618 * Build a list of monster indexes in the given group. Return the number
5619 * of monsters in the group.
5621 static int collect_artifacts(int grp_cur, int object_idx[])
5623 int i, object_cnt = 0;
5625 /* Get a list of x_char in this group */
5626 byte group_tval = object_group_tval[grp_cur];
5628 /* Check every object */
5629 for (i = 0; i < max_a_idx; i++)
5631 /* Access the artifact */
5632 artifact_type *a_ptr = &a_info[i];
5634 /* Skip empty artifacts */
5635 if (!a_ptr->name) continue;
5637 /* Skip "uncreated" artifacts */
5638 if (!a_ptr->cur_num) continue;
5640 /* Check for race in the group */
5641 if (a_ptr->tval == group_tval)
5644 object_idx[object_cnt++] = i;
5648 /* Terminate the list */
5649 object_idx[object_cnt] = 0;
5651 /* Return the number of races */
5658 * Encode the screen colors
5660 static char hack[17] = "dwsorgbuDWvyRGBU";
5664 * Hack -- load a screen dump from a file
5666 void do_cmd_load_screen(void)
5681 Term_get_size(&wid, &hgt);
5683 /* Build the filename */
5684 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
5686 /* Append to the file */
5687 fff = my_fopen(buf, "r");
5692 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
5694 msg_format("Failed to open %s.", buf);
5701 /* Save the screen */
5704 /* Clear the screen */
5708 /* Load the screen */
5709 for (y = 0; okay; y++)
5711 /* Get a line of data including control code */
5712 if (!fgets(buf, 1024, fff)) okay = FALSE;
5714 /* Get the blank line */
5715 if (buf[0] == '\n' || buf[0] == '\0') break;
5717 /* Ignore too large screen image */
5718 if (y >= hgt) continue;
5721 for (x = 0; x < wid - 1; x++)
5724 if (buf[x] == '\n' || buf[x] == '\0') break;
5726 /* Put the attr/char */
5727 Term_draw(x, y, TERM_WHITE, buf[x]);
5731 /* Dump the screen */
5732 for (y = 0; okay; y++)
5734 /* Get a line of data including control code */
5735 if (!fgets(buf, 1024, fff)) okay = FALSE;
5737 /* Get the blank line */
5738 if (buf[0] == '\n' || buf[0] == '\0') break;
5740 /* Ignore too large screen image */
5741 if (y >= hgt) continue;
5744 for (x = 0; x < wid - 1; x++)
5747 if (buf[x] == '\n' || buf[x] == '\0') break;
5749 /* Get the attr/char */
5750 (void)(Term_what(x, y, &a, &c));
5752 /* Look up the attr */
5753 for (i = 0; i < 16; i++)
5755 /* Use attr matches */
5756 if (hack[i] == buf[x]) a = i;
5759 /* Put the attr/char */
5760 Term_draw(x, y, a, c);
5771 prt("¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤µ¤ì¤¿²èÌÌ(µÇ°»£±Æ)¤ò¥í¡¼¥É¤·¤Þ¤·¤¿¡£", 0, 0);
5773 msg_print("Screen dump loaded.");
5780 /* Restore the screen */
5787 cptr inven_res_label =
5789 " »ÀÅŲÐÎäÆǸ÷°ÇÇ˹ì¹ö°øÆÙÎô ÌÕÉÝÍðáãÆ©Ì¿´¶¾ÃÉüÉâ";
5791 " AcElFiCoPoLiDkShSoNtNxCaDi BlFeCfFaSeHlEpSdRgLv";
5796 #define IM_FLAG_STR "¡ö"
5797 #define HAS_FLAG_STR "¡Ü"
5798 #define NO_FLAG_STR "¡¦"
5800 #define IM_FLAG_STR "* "
5801 #define HAS_FLAG_STR "+ "
5802 #define NO_FLAG_STR ". "
5805 #define print_im_or_res_flag(IM, RES) \
5807 fputs(have_flag(flgs, (IM)) ? IM_FLAG_STR : \
5808 (have_flag(flgs, (RES)) ? HAS_FLAG_STR : NO_FLAG_STR), fff); \
5811 #define print_flag(TR) \
5813 fputs(have_flag(flgs, (TR)) ? HAS_FLAG_STR : NO_FLAG_STR, fff); \
5817 /* XTRA HACK RESLIST */
5818 static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, byte tval, char *where)
5820 char o_name[MAX_NLEN];
5821 u32b flgs[TR_FLAG_SIZE];
5823 if (!o_ptr->k_idx) return;
5824 if (o_ptr->tval != tval) return;
5826 /* Identified items only */
5827 if (!object_is_known(o_ptr)) return;
5830 * HACK:Ring of Lordly protection and Dragon equipment
5831 * have random resistances.
5833 if ((object_is_wearable(o_ptr) && object_is_ego(o_ptr))
5834 || ((tval == TV_AMULET) && (o_ptr->sval == SV_AMULET_RESISTANCE))
5835 || ((tval == TV_RING) && (o_ptr->sval == SV_RING_LORDLY))
5836 || ((tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD))
5837 || ((tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM))
5838 || ((tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES))
5839 || ((tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE))
5840 || object_is_artifact(o_ptr))
5843 object_desc(o_name, o_ptr, OD_NAME_ONLY);
5845 while (o_name[i] && (i < 26))
5848 if (iskanji(o_name[i])) i++;
5857 o_name[i] = ' '; i++;
5862 fprintf(fff, "%s %s", where, o_name);
5864 if (!(o_ptr->ident & (IDENT_MENTAL)))
5867 fputs("-------ÉÔÌÀ--------------- -------ÉÔÌÀ---------\n", fff);
5869 fputs("-------unknown------------ -------unknown------\n", fff);
5874 object_flags_known(o_ptr, flgs);
5876 print_im_or_res_flag(TR_IM_ACID, TR_RES_ACID);
5877 print_im_or_res_flag(TR_IM_ELEC, TR_RES_ELEC);
5878 print_im_or_res_flag(TR_IM_FIRE, TR_RES_FIRE);
5879 print_im_or_res_flag(TR_IM_COLD, TR_RES_COLD);
5880 print_flag(TR_RES_POIS);
5881 print_flag(TR_RES_LITE);
5882 print_flag(TR_RES_DARK);
5883 print_flag(TR_RES_SHARDS);
5884 print_flag(TR_RES_SOUND);
5885 print_flag(TR_RES_NETHER);
5886 print_flag(TR_RES_NEXUS);
5887 print_flag(TR_RES_CHAOS);
5888 print_flag(TR_RES_DISEN);
5892 print_flag(TR_RES_BLIND);
5893 print_flag(TR_RES_FEAR);
5894 print_flag(TR_RES_CONF);
5895 print_flag(TR_FREE_ACT);
5896 print_flag(TR_SEE_INVIS);
5897 print_flag(TR_HOLD_LIFE);
5898 print_flag(TR_TELEPATHY);
5899 print_flag(TR_SLOW_DIGEST);
5900 print_flag(TR_REGEN);
5901 print_flag(TR_LEVITATION);
5909 fprintf(fff, "%s\n", inven_res_label);
5915 * Display *ID* ed weapons/armors's resistances
5917 static void do_cmd_knowledge_inven(void)
5921 char file_name[1024];
5931 /* Open a new file */
5932 fff = my_fopen_temp(file_name, 1024);
5936 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
5938 msg_format("Failed to create temporary file %s.", file_name);
5943 fprintf(fff, "%s\n", inven_res_label);
5945 for (tval = TV_WEARABLE_BEGIN; tval <= TV_WEARABLE_END; tval++)
5949 for (; j < 9; j++) fputc('\n', fff);
5951 fprintf(fff, "%s\n", inven_res_label);
5955 strcpy(where, "Áõ");
5957 strcpy(where, "E ");
5959 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
5961 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
5965 strcpy(where, "»ý");
5967 strcpy(where, "I ");
5969 for (i = 0; i < INVEN_PACK; i++)
5971 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
5974 st_ptr = &town[1].store[STORE_HOME];
5976 strcpy(where, "²È");
5978 strcpy(where, "H ");
5981 for (i = 0; i < st_ptr->stock_num; i++)
5983 do_cmd_knowledge_inven_aux(fff, &st_ptr->stock[i], &j, tval, where);
5987 /* Close the file */
5990 /* Display the file contents */
5992 show_file(TRUE, file_name, "*´ÕÄê*ºÑ¤ßÉð´ï/Ëɶñ¤ÎÂÑÀ¥ê¥¹¥È", 0, 0);
5994 show_file(TRUE, file_name, "Resistances of *identified* equipment", 0, 0);
5997 /* Remove the file */
6002 void do_cmd_save_screen_html_aux(char *filename, int message)
6006 byte a = 0, old_a = 0;
6020 cptr html_head[] = {
6021 "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
6025 cptr html_foot[] = {
6027 "</body>\n</html>\n",
6033 Term_get_size(&wid, &hgt);
6035 /* File type is "TEXT" */
6036 FILE_TYPE(FILE_TYPE_TEXT);
6038 /* Append to the file */
6039 fff = my_fopen(filename, "w");
6045 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", filename);
6047 msg_format("Failed to open file %s.", filename);
6055 /* Save the screen */
6059 /* Build the filename */
6060 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
6061 tmpfff = my_fopen(buf, "r");
6063 for (i = 0; html_head[i]; i++)
6064 fprintf(fff, html_head[i]);
6068 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
6070 if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
6074 if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
6076 fprintf(fff, "%s\n", buf);
6081 /* Dump the screen */
6082 for (y = 0; y < hgt; y++)
6089 for (x = 0; x < wid - 1; x++)
6093 /* Get the attr/char */
6094 (void)(Term_what(x, y, &a, &c));
6098 case '&': cc = "&"; break;
6099 case '<': cc = "<"; break;
6100 case '>': cc = ">"; break;
6102 case 0x1f: c = '.'; break;
6103 case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
6108 if ((y == 0 && x == 0) || a != old_a) {
6109 rv = angband_color_table[a][1];
6110 gv = angband_color_table[a][2];
6111 bv = angband_color_table[a][3];
6112 fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
6113 ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
6117 fprintf(fff, "%s", cc);
6119 fprintf(fff, "%c", c);
6122 fprintf(fff, "</font>");
6125 for (i = 0; html_foot[i]; i++)
6126 fprintf(fff, html_foot[i]);
6131 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
6133 if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
6137 if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
6139 fprintf(fff, "%s\n", buf);
6154 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6156 msg_print("Screen dump saved.");
6161 /* Restore the screen */
6167 * Hack -- save a screen dump to a file
6169 static void do_cmd_save_screen_html(void)
6171 char buf[1024], tmp[256] = "screen.html";
6174 if (!get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
6176 if (!get_string("File name: ", tmp, 80))
6180 /* Build the filename */
6181 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
6185 do_cmd_save_screen_html_aux(buf, 1);
6190 * Redefinable "save_screen" action
6192 void (*screendump_aux)(void) = NULL;
6196 * Hack -- save a screen dump to a file
6198 void do_cmd_save_screen(void)
6200 bool old_use_graphics = use_graphics;
6201 bool html_dump = FALSE;
6206 prt("µÇ°»£±Æ¤·¤Þ¤¹¤«¡© [(y)es/(h)tml/(n)o] ", 0, 0);
6208 prt("Save screen dump? [(y)es/(h)tml/(n)o] ", 0, 0);
6213 if (c == 'Y' || c == 'y')
6215 else if (c == 'H' || c == 'h')
6227 Term_get_size(&wid, &hgt);
6229 if (old_use_graphics)
6231 use_graphics = FALSE;
6234 /* Redraw everything */
6235 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6237 /* Hack -- update */
6243 do_cmd_save_screen_html();
6247 /* Do we use a special screendump function ? */
6248 else if (screendump_aux)
6250 /* Dump the screen to a graphics file */
6251 (*screendump_aux)();
6253 else /* Dump the screen as text */
6264 /* Build the filename */
6265 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
6267 /* File type is "TEXT" */
6268 FILE_TYPE(FILE_TYPE_TEXT);
6270 /* Append to the file */
6271 fff = my_fopen(buf, "w");
6277 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
6279 msg_format("Failed to open file %s.", buf);
6286 /* Save the screen */
6290 /* Dump the screen */
6291 for (y = 0; y < hgt; y++)
6294 for (x = 0; x < wid - 1; x++)
6296 /* Get the attr/char */
6297 (void)(Term_what(x, y, &a, &c));
6307 fprintf(fff, "%s\n", buf);
6314 /* Dump the screen */
6315 for (y = 0; y < hgt; y++)
6318 for (x = 0; x < wid - 1; x++)
6320 /* Get the attr/char */
6321 (void)(Term_what(x, y, &a, &c));
6324 buf[x] = hack[a&0x0F];
6331 fprintf(fff, "%s\n", buf);
6343 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6345 msg_print("Screen dump saved.");
6351 /* Restore the screen */
6355 if (old_use_graphics)
6357 use_graphics = TRUE;
6360 /* Redraw everything */
6361 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6363 /* Hack -- update */
6370 * Sorting hook -- Comp function -- see below
6372 * We use "u" to point to array of monster indexes,
6373 * and "v" to select the type of sorting to perform on "u".
6375 static bool ang_sort_art_comp(vptr u, vptr v, int a, int b)
6377 u16b *who = (u16b*)(u);
6379 u16b *why = (u16b*)(v);
6386 /* Sort by total kills */
6389 /* Extract total kills */
6390 z1 = a_info[w1].tval;
6391 z2 = a_info[w2].tval;
6393 /* Compare total kills */
6394 if (z1 < z2) return (TRUE);
6395 if (z1 > z2) return (FALSE);
6399 /* Sort by monster level */
6402 /* Extract levels */
6403 z1 = a_info[w1].sval;
6404 z2 = a_info[w2].sval;
6406 /* Compare levels */
6407 if (z1 < z2) return (TRUE);
6408 if (z1 > z2) return (FALSE);
6412 /* Sort by monster experience */
6415 /* Extract experience */
6416 z1 = a_info[w1].level;
6417 z2 = a_info[w2].level;
6419 /* Compare experience */
6420 if (z1 < z2) return (TRUE);
6421 if (z1 > z2) return (FALSE);
6425 /* Compare indexes */
6431 * Sorting hook -- Swap function -- see below
6433 * We use "u" to point to array of monster indexes,
6434 * and "v" to select the type of sorting to perform.
6436 static void ang_sort_art_swap(vptr u, vptr v, int a, int b)
6438 u16b *who = (u16b*)(u);
6453 * Check the status of "artifacts"
6455 static void do_cmd_knowledge_artifacts(void)
6457 int i, k, z, x, y, n = 0;
6463 char file_name[1024];
6465 char base_name[MAX_NLEN];
6469 /* Open a new file */
6470 fff = my_fopen_temp(file_name, 1024);
6474 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6476 msg_format("Failed to create temporary file %s.", file_name);
6482 /* Allocate the "who" array */
6483 C_MAKE(who, max_a_idx, s16b);
6485 /* Allocate the "okay" array */
6486 C_MAKE(okay, max_a_idx, bool);
6488 /* Scan the artifacts */
6489 for (k = 0; k < max_a_idx; k++)
6491 artifact_type *a_ptr = &a_info[k];
6496 /* Skip "empty" artifacts */
6497 if (!a_ptr->name) continue;
6499 /* Skip "uncreated" artifacts */
6500 if (!a_ptr->cur_num) continue;
6506 /* Check the dungeon */
6507 for (y = 0; y < cur_hgt; y++)
6509 for (x = 0; x < cur_wid; x++)
6511 cave_type *c_ptr = &cave[y][x];
6513 s16b this_o_idx, next_o_idx = 0;
6515 /* Scan all objects in the grid */
6516 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
6520 /* Acquire object */
6521 o_ptr = &o_list[this_o_idx];
6523 /* Acquire next object */
6524 next_o_idx = o_ptr->next_o_idx;
6526 /* Ignore non-artifacts */
6527 if (!object_is_fixed_artifact(o_ptr)) continue;
6529 /* Ignore known items */
6530 if (object_is_known(o_ptr)) continue;
6532 /* Note the artifact */
6533 okay[o_ptr->name1] = FALSE;
6538 /* Check the inventory and equipment */
6539 for (i = 0; i < INVEN_TOTAL; i++)
6541 object_type *o_ptr = &inventory[i];
6543 /* Ignore non-objects */
6544 if (!o_ptr->k_idx) continue;
6546 /* Ignore non-artifacts */
6547 if (!object_is_fixed_artifact(o_ptr)) continue;
6549 /* Ignore known items */
6550 if (object_is_known(o_ptr)) continue;
6552 /* Note the artifact */
6553 okay[o_ptr->name1] = FALSE;
6556 for (k = 0; k < max_a_idx; k++)
6558 if (okay[k]) who[n++] = k;
6561 /* Select the sort method */
6562 ang_sort_comp = ang_sort_art_comp;
6563 ang_sort_swap = ang_sort_art_swap;
6565 /* Sort the array by dungeon depth of monsters */
6566 ang_sort(who, &why, n);
6568 /* Scan the artifacts */
6569 for (k = 0; k < n; k++)
6571 artifact_type *a_ptr = &a_info[who[k]];
6575 strcpy(base_name, "̤ÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à");
6577 strcpy(base_name, "Unknown Artifact");
6581 /* Obtain the base object type */
6582 z = lookup_kind(a_ptr->tval, a_ptr->sval);
6590 /* Get local object */
6593 /* Create fake object */
6594 object_prep(q_ptr, z);
6596 /* Make it an artifact */
6597 q_ptr->name1 = (byte)who[k];
6599 /* Display as if known */
6600 q_ptr->ident |= IDENT_STORE;
6602 /* Describe the artifact */
6603 object_desc(base_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
6606 /* Hack -- Build the artifact name */
6608 fprintf(fff, " %s\n", base_name);
6610 fprintf(fff, " The %s\n", base_name);
6615 /* Free the "who" array */
6616 C_KILL(who, max_a_idx, s16b);
6618 /* Free the "okay" array */
6619 C_KILL(okay, max_a_idx, bool);
6621 /* Close the file */
6624 /* Display the file contents */
6626 show_file(TRUE, file_name, "´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à", 0, 0);
6628 show_file(TRUE, file_name, "Artifacts Seen", 0, 0);
6632 /* Remove the file */
6638 * Display known uniques
6639 * With "XTRA HACK UNIQHIST" (Originally from XAngband)
6641 static void do_cmd_knowledge_uniques(void)
6649 char file_name[1024];
6652 int n_alive_surface = 0;
6653 int n_alive_over100 = 0;
6654 int n_alive_total = 0;
6657 for (i = 0; i < 10; i++) n_alive[i] = 0;
6659 /* Open a new file */
6660 fff = my_fopen_temp(file_name, 1024);
6665 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6667 msg_format("Failed to create temporary file %s.", file_name);
6673 /* Allocate the "who" array */
6674 C_MAKE(who, max_r_idx, s16b);
6676 /* Scan the monsters */
6677 for (i = 1; i < max_r_idx; i++)
6679 monster_race *r_ptr = &r_info[i];
6682 if (!r_ptr->name) continue;
6684 /* Require unique monsters */
6685 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6687 /* Only display "known" uniques */
6688 if (!cheat_know && !r_ptr->r_sights) continue;
6690 /* Only print rarity <= 100 uniques */
6691 if (!r_ptr->rarity || ((r_ptr->rarity > 100) && !(r_ptr->flags1 & RF1_QUESTOR))) continue;
6693 /* Only "alive" uniques */
6694 if (r_ptr->max_num == 0) continue;
6698 lev = (r_ptr->level - 1) / 10;
6702 if (max_lev < lev) max_lev = lev;
6704 else n_alive_over100++;
6706 else n_alive_surface++;
6708 /* Collect "appropriate" monsters */
6712 /* Select the sort method */
6713 ang_sort_comp = ang_sort_comp_hook;
6714 ang_sort_swap = ang_sort_swap_hook;
6716 /* Sort the array by dungeon depth of monsters */
6717 ang_sort(who, &why, n);
6719 if (n_alive_surface)
6722 fprintf(fff, " ÃϾå À¸Â¸: %3dÂÎ\n", n_alive_surface);
6724 fprintf(fff, " Surface alive: %3d\n", n_alive_surface);
6726 n_alive_total += n_alive_surface;
6728 for (i = 0; i <= max_lev; i++)
6731 fprintf(fff, "%3d-%3d³¬ À¸Â¸: %3dÂÎ\n", 1 + i * 10, 10 + i * 10, n_alive[i]);
6733 fprintf(fff, "Level %3d-%3d alive: %3d\n", 1 + i * 10, 10 + i * 10, n_alive[i]);
6735 n_alive_total += n_alive[i];
6737 if (n_alive_over100)
6740 fprintf(fff, "101- ³¬ À¸Â¸: %3dÂÎ\n", n_alive_over100);
6742 fprintf(fff, "Level 101- alive: %3d\n", n_alive_over100);
6744 n_alive_total += n_alive_over100;
6750 fputs("--------- -----------\n", fff);
6751 fprintf(fff, " ¹ç·× À¸Â¸: %3dÂÎ\n\n", n_alive_total);
6753 fputs("------------- ----------\n", fff);
6754 fprintf(fff, " Total alive: %3d\n\n", n_alive_total);
6760 fputs("¸½ºß¤Ï´ûÃΤÎÀ¸Â¸¥æ¥Ë¡¼¥¯¤Ï¤¤¤Þ¤»¤ó¡£\n", fff);
6762 fputs("No known uniques alive.\n", fff);
6766 /* Scan the monster races */
6767 for (k = 0; k < n; k++)
6769 monster_race *r_ptr = &r_info[who[k]];
6771 /* Print a message */
6773 fprintf(fff, " %s (¥ì¥Ù¥ë%d)\n", r_name + r_ptr->name, r_ptr->level);
6775 fprintf(fff, " %s (level %d)\n", r_name + r_ptr->name, r_ptr->level);
6779 /* Free the "who" array */
6780 C_KILL(who, max_r_idx, s16b);
6782 /* Close the file */
6785 /* Display the file contents */
6787 show_file(TRUE, file_name, "¤Þ¤ÀÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼", 0, 0);
6789 show_file(TRUE, file_name, "Alive Uniques", 0, 0);
6793 /* Remove the file */
6799 * Display weapon-exp
6801 static void do_cmd_knowledge_weapon_exp(void)
6803 int i, j, num, weapon_exp;
6807 char file_name[1024];
6810 /* Open a new file */
6811 fff = my_fopen_temp(file_name, 1024);
6814 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6816 msg_format("Failed to create temporary file %s.", file_name);
6822 for (i = 0; i < 5; i++)
6824 for (num = 0; num < 64; num++)
6826 for (j = 0; j < max_k_idx; j++)
6828 object_kind *k_ptr = &k_info[j];
6830 if ((k_ptr->tval == TV_SWORD - i) && (k_ptr->sval == num))
6832 if ((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON)) continue;
6834 weapon_exp = p_ptr->weapon_exp[4 - i][num];
6836 fprintf(fff, "%-25s ", tmp);
6837 if (weapon_exp >= s_info[p_ptr->pclass].w_max[4 - i][num]) fprintf(fff, "!");
6838 else fprintf(fff, " ");
6839 fprintf(fff, "%s", exp_level_str[weapon_exp_level(weapon_exp)]);
6840 if (cheat_xtra) fprintf(fff, " %d", weapon_exp);
6848 /* Close the file */
6851 /* Display the file contents */
6853 show_file(TRUE, file_name, "Éð´ï¤Î·Ð¸³ÃÍ", 0, 0);
6855 show_file(TRUE, file_name, "Weapon Proficiency", 0, 0);
6859 /* Remove the file */
6867 static void do_cmd_knowledge_spell_exp(void)
6869 int i = 0, spell_exp, exp_level;
6874 char file_name[1024];
6876 /* Open a new file */
6877 fff = my_fopen_temp(file_name, 1024);
6880 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6882 msg_format("Failed to create temporary file %s.", file_name);
6888 if (p_ptr->realm1 != REALM_NONE)
6891 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm1]);
6893 fprintf(fff, "%s Spellbook\n", realm_names[p_ptr->realm1]);
6895 for (i = 0; i < 32; i++)
6897 if (!is_magic(p_ptr->realm1))
6899 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][i];
6903 s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][i];
6905 if (s_ptr->slevel >= 99) continue;
6906 spell_exp = p_ptr->spell_exp[i];
6907 exp_level = spell_exp_level(spell_exp);
6908 fprintf(fff, "%-25s ", do_spell(p_ptr->realm1, i, SPELL_NAME));
6909 if (p_ptr->realm1 == REALM_HISSATSU)
6910 fprintf(fff, "[--]");
6913 if (exp_level >= EXP_LEVEL_MASTER) fprintf(fff, "!");
6914 else fprintf(fff, " ");
6915 fprintf(fff, "%s", exp_level_str[exp_level]);
6917 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6922 if (p_ptr->realm2 != REALM_NONE)
6925 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm2]);
6927 fprintf(fff, "\n%s Spellbook\n", realm_names[p_ptr->realm2]);
6929 for (i = 0; i < 32; i++)
6931 if (!is_magic(p_ptr->realm1))
6933 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][i];
6937 s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][i];
6939 if (s_ptr->slevel >= 99) continue;
6941 spell_exp = p_ptr->spell_exp[i + 32];
6942 exp_level = spell_exp_level(spell_exp);
6943 fprintf(fff, "%-25s ", do_spell(p_ptr->realm2, i, SPELL_NAME));
6944 if (exp_level >= EXP_LEVEL_EXPERT) fprintf(fff, "!");
6945 else fprintf(fff, " ");
6946 fprintf(fff, "%s", exp_level_str[exp_level]);
6947 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6952 /* Close the file */
6955 /* Display the file contents */
6957 show_file(TRUE, file_name, "ËâË¡¤Î·Ð¸³ÃÍ", 0, 0);
6959 show_file(TRUE, file_name, "Spell Proficiency", 0, 0);
6963 /* Remove the file */
6971 static void do_cmd_knowledge_skill_exp(void)
6973 int i = 0, skill_exp;
6977 char file_name[1024];
6979 char skill_name[3][17]={"¥Þ¡¼¥·¥ã¥ë¥¢¡¼¥Ä", "ÆóÅáή ", "¾èÇÏ "};
6981 char skill_name[3][20]={"Martial Arts ", "Dual Wielding ", "Riding "};
6984 /* Open a new file */
6985 fff = my_fopen_temp(file_name, 1024);
6988 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6990 msg_format("Failed to create temporary file %s.", file_name);
6996 for (i = 0; i < 3; i++)
6998 skill_exp = p_ptr->skill_exp[i];
6999 fprintf(fff, "%-20s ", skill_name[i]);
7000 if (skill_exp >= s_info[p_ptr->pclass].s_max[i]) fprintf(fff, "!");
7001 else fprintf(fff, " ");
7002 fprintf(fff, "%s", exp_level_str[(i == GINOU_RIDING) ? riding_exp_level(skill_exp) : weapon_exp_level(skill_exp)]);
7003 if (cheat_xtra) fprintf(fff, " %d", skill_exp);
7007 /* Close the file */
7010 /* Display the file contents */
7012 show_file(TRUE, file_name, "µ»Ç½¤Î·Ð¸³ÃÍ", 0, 0);
7014 show_file(TRUE, file_name, "Miscellaneous Proficiency", 0, 0);
7018 /* Remove the file */
7024 * Pluralize a monster name
7026 void plural_aux(char *Name)
7028 int NameLen = strlen(Name);
7030 if (my_strstr(Name, "Disembodied hand"))
7032 strcpy(Name, "Disembodied hands that strangled people");
7034 else if (my_strstr(Name, "Colour out of space"))
7036 strcpy(Name, "Colours out of space");
7038 else if (my_strstr(Name, "stairway to hell"))
7040 strcpy(Name, "stairways to hell");
7042 else if (my_strstr(Name, "Dweller on the threshold"))
7044 strcpy(Name, "Dwellers on the threshold");
7046 else if (my_strstr(Name, " of "))
7048 cptr aider = my_strstr(Name, " of ");
7059 if (dummy[i-1] == 's')
7061 strcpy(&(dummy[i]), "es");
7066 strcpy(&(dummy[i]), "s");
7069 strcpy(&(dummy[i+1]), aider);
7070 strcpy(Name, dummy);
7072 else if (my_strstr(Name, "coins"))
7075 strcpy(dummy, "piles of ");
7076 strcat(dummy, Name);
7077 strcpy(Name, dummy);
7080 else if (my_strstr(Name, "Manes"))
7084 else if (streq(&(Name[NameLen - 2]), "ey"))
7086 strcpy(&(Name[NameLen - 2]), "eys");
7088 else if (Name[NameLen - 1] == 'y')
7090 strcpy(&(Name[NameLen - 1]), "ies");
7092 else if (streq(&(Name[NameLen - 4]), "ouse"))
7094 strcpy(&(Name[NameLen - 4]), "ice");
7096 else if (streq(&(Name[NameLen - 2]), "us"))
7098 strcpy(&(Name[NameLen - 2]), "i");
7100 else if (streq(&(Name[NameLen - 6]), "kelman"))
7102 strcpy(&(Name[NameLen - 6]), "kelmen");
7104 else if (streq(&(Name[NameLen - 8]), "wordsman"))
7106 strcpy(&(Name[NameLen - 8]), "wordsmen");
7108 else if (streq(&(Name[NameLen - 7]), "oodsman"))
7110 strcpy(&(Name[NameLen - 7]), "oodsmen");
7112 else if (streq(&(Name[NameLen - 7]), "eastman"))
7114 strcpy(&(Name[NameLen - 7]), "eastmen");
7116 else if (streq(&(Name[NameLen - 8]), "izardman"))
7118 strcpy(&(Name[NameLen - 8]), "izardmen");
7120 else if (streq(&(Name[NameLen - 5]), "geist"))
7122 strcpy(&(Name[NameLen - 5]), "geister");
7124 else if (streq(&(Name[NameLen - 2]), "ex"))
7126 strcpy(&(Name[NameLen - 2]), "ices");
7128 else if (streq(&(Name[NameLen - 2]), "lf"))
7130 strcpy(&(Name[NameLen - 2]), "lves");
7132 else if (suffix(Name, "ch") ||
7133 suffix(Name, "sh") ||
7134 suffix(Name, "nx") ||
7135 suffix(Name, "s") ||
7138 strcpy(&(Name[NameLen]), "es");
7142 strcpy(&(Name[NameLen]), "s");
7147 * Display current pets
7149 static void do_cmd_knowledge_pets(void)
7153 monster_type *m_ptr;
7156 int show_upkeep = 0;
7157 char file_name[1024];
7160 /* Open a new file */
7161 fff = my_fopen_temp(file_name, 1024);
7164 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7166 msg_format("Failed to create temporary file %s.", file_name);
7172 /* Process the monsters (backwards) */
7173 for (i = m_max - 1; i >= 1; i--)
7175 /* Access the monster */
7178 /* Ignore "dead" monsters */
7179 if (!m_ptr->r_idx) continue;
7181 /* Calculate "upkeep" for pets */
7185 monster_desc(pet_name, m_ptr, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
7186 fprintf(fff, "%s (%s)\n", pet_name, look_mon_desc(m_ptr, 0x00));
7190 show_upkeep = calculate_upkeep();
7192 fprintf(fff, "----------------------------------------------\n");
7194 fprintf(fff, " ¹ç·×: %d ÂΤΥڥåÈ\n", t_friends);
7195 fprintf(fff, " °Ý»ý¥³¥¹¥È: %d%% MP\n", show_upkeep);
7197 fprintf(fff, " Total: %d pet%s.\n",
7198 t_friends, (t_friends == 1 ? "" : "s"));
7199 fprintf(fff, " Upkeep: %d%% mana.\n", show_upkeep);
7204 /* Close the file */
7207 /* Display the file contents */
7209 show_file(TRUE, file_name, "¸½ºß¤Î¥Ú¥Ã¥È", 0, 0);
7211 show_file(TRUE, file_name, "Current Pets", 0, 0);
7215 /* Remove the file */
7223 * Note that the player ghosts are ignored. XXX XXX XXX
7225 static void do_cmd_knowledge_kill_count(void)
7233 char file_name[1024];
7238 /* Open a new file */
7239 fff = my_fopen_temp(file_name, 1024);
7243 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7245 msg_format("Failed to create temporary file %s.", file_name);
7251 /* Allocate the "who" array */
7252 C_MAKE(who, max_r_idx, s16b);
7255 /* Monsters slain */
7258 for (kk = 1; kk < max_r_idx; kk++)
7260 monster_race *r_ptr = &r_info[kk];
7262 if (r_ptr->flags1 & (RF1_UNIQUE))
7264 bool dead = (r_ptr->max_num == 0);
7273 s16b This = r_ptr->r_pkills;
7284 fprintf(fff,"¤¢¤Ê¤¿¤Ï¤Þ¤ÀŨ¤òÅݤ·¤Æ¤¤¤Ê¤¤¡£\n\n");
7286 fprintf(fff,"You have defeated no enemies yet.\n\n");
7290 fprintf(fff,"¤¢¤Ê¤¿¤Ï%ldÂΤÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n", Total);
7292 fprintf(fff,"You have defeated %ld %s.\n\n", Total, (Total == 1) ? "enemy" : "enemies");
7298 /* Scan the monsters */
7299 for (i = 1; i < max_r_idx; i++)
7301 monster_race *r_ptr = &r_info[i];
7303 /* Use that monster */
7304 if (r_ptr->name) who[n++] = i;
7307 /* Select the sort method */
7308 ang_sort_comp = ang_sort_comp_hook;
7309 ang_sort_swap = ang_sort_swap_hook;
7311 /* Sort the array by dungeon depth of monsters */
7312 ang_sort(who, &why, n);
7314 /* Scan the monster races */
7315 for (k = 0; k < n; k++)
7317 monster_race *r_ptr = &r_info[who[k]];
7319 if (r_ptr->flags1 & (RF1_UNIQUE))
7321 bool dead = (r_ptr->max_num == 0);
7325 /* Print a message */
7326 fprintf(fff, " %s\n",
7327 (r_name + r_ptr->name));
7333 s16b This = r_ptr->r_pkills;
7338 /* p,t¤Ï¿Í¤È¿ô¤¨¤ë by ita */
7339 if (my_strchr("pt", r_ptr->d_char))
7340 fprintf(fff, " %3d ¿Í¤Î %s\n", This, r_name + r_ptr->name);
7342 fprintf(fff, " %3d ÂΤΠ%s\n", This, r_name + r_ptr->name);
7346 if (my_strstr(r_name + r_ptr->name, "coins"))
7348 fprintf(fff, " 1 pile of %s\n", (r_name + r_ptr->name));
7352 fprintf(fff, " 1 %s\n", (r_name + r_ptr->name));
7358 strcpy(ToPlural, (r_name + r_ptr->name));
7359 plural_aux(ToPlural);
7360 fprintf(fff, " %d %s\n", This, ToPlural);
7370 fprintf(fff,"----------------------------------------------\n");
7372 fprintf(fff," ¹ç·×: %lu ÂΤòÅݤ·¤¿¡£\n", Total);
7374 fprintf(fff," Total: %lu creature%s killed.\n",
7375 Total, (Total == 1 ? "" : "s"));
7379 /* Free the "who" array */
7380 C_KILL(who, max_r_idx, s16b);
7382 /* Close the file */
7385 /* Display the file contents */
7387 show_file(TRUE, file_name, "Åݤ·¤¿Å¨¤Î¿ô", 0, 0);
7389 show_file(TRUE, file_name, "Kill Count", 0, 0);
7393 /* Remove the file */
7399 * Display the object groups.
7401 static void display_group_list(int col, int row, int wid, int per_page,
7402 int grp_idx[], cptr group_text[], int grp_cur, int grp_top)
7406 /* Display lines until done */
7407 for (i = 0; i < per_page && (grp_idx[i] >= 0); i++)
7409 /* Get the group index */
7410 int grp = grp_idx[grp_top + i];
7412 /* Choose a color */
7413 byte attr = (grp_top + i == grp_cur) ? TERM_L_BLUE : TERM_WHITE;
7415 /* Erase the entire line */
7416 Term_erase(col, row + i, wid);
7418 /* Display the group label */
7419 c_put_str(attr, group_text[grp], row + i, col);
7425 * Move the cursor in a browser window
7427 static void browser_cursor(char ch, int *column, int *grp_cur, int grp_cnt,
7428 int *list_cur, int list_cnt)
7433 int list = *list_cur;
7435 /* Extract direction */
7438 /* Hack -- scroll up full screen */
7443 /* Hack -- scroll down full screen */
7448 d = get_keymap_dir(ch);
7453 /* Diagonals - hack */
7454 if ((ddx[d] > 0) && ddy[d])
7460 Term_get_size(&wid, &hgt);
7462 browser_rows = hgt - 8;
7464 /* Browse group list */
7469 /* Move up or down */
7470 grp += ddy[d] * (browser_rows - 1);
7473 if (grp >= grp_cnt) grp = grp_cnt - 1;
7474 if (grp < 0) grp = 0;
7475 if (grp != old_grp) list = 0;
7478 /* Browse sub-list list */
7481 /* Move up or down */
7482 list += ddy[d] * browser_rows;
7485 if (list >= list_cnt) list = list_cnt - 1;
7486 if (list < 0) list = 0;
7498 if (col < 0) col = 0;
7499 if (col > 1) col = 1;
7506 /* Browse group list */
7511 /* Move up or down */
7515 if (grp >= grp_cnt) grp = grp_cnt - 1;
7516 if (grp < 0) grp = 0;
7517 if (grp != old_grp) list = 0;
7520 /* Browse sub-list list */
7523 /* Move up or down */
7527 if (list >= list_cnt) list = list_cnt - 1;
7528 if (list < 0) list = 0;
7539 static void display_visual_list(int col, int row, int height, int width, byte attr_top, byte char_left)
7543 /* Clear the display lines */
7544 for (i = 0; i < height; i++)
7546 Term_erase(col, row + i, width);
7549 /* Bigtile mode uses double width */
7550 if (use_bigtile) width /= 2;
7552 /* Display lines until done */
7553 for (i = 0; i < height; i++)
7555 /* Display columns until done */
7556 for (j = 0; j < width; j++)
7564 /* Bigtile mode uses double width */
7565 if (use_bigtile) x += j;
7570 /* Ignore illegal characters */
7571 if (ia > 0x7f || ic > 0xff || ic < ' ' ||
7572 (!use_graphics && ic > 0x7f))
7578 /* Force correct code for both ASCII character and tile */
7579 if (c & 0x80) a |= 0x80;
7581 /* Display symbol */
7582 Term_queue_bigchar(x, y, a, c, 0, 0);
7589 * Place the cursor at the collect position for visual mode
7591 static void place_visual_list_cursor(int col, int row, byte a, byte c, byte attr_top, byte char_left)
7593 int i = (a & 0x7f) - attr_top;
7594 int j = c - char_left;
7599 /* Bigtile mode uses double width */
7600 if (use_bigtile) x += j;
7602 /* Place the cursor */
7608 * Clipboard variables for copy&paste in visual mode
7610 static byte attr_idx = 0;
7611 static byte char_idx = 0;
7613 /* Hack -- for feature lighting */
7614 static byte attr_idx_feat[F_LIT_MAX];
7615 static byte char_idx_feat[F_LIT_MAX];
7618 * Do visual mode command -- Change symbols
7620 static bool visual_mode_command(char ch, bool *visual_list_ptr,
7621 int height, int width,
7622 byte *attr_top_ptr, byte *char_left_ptr,
7623 byte *cur_attr_ptr, byte *cur_char_ptr, bool *need_redraw)
7625 static byte attr_old = 0, char_old = 0;
7630 if (*visual_list_ptr)
7633 *cur_attr_ptr = attr_old;
7634 *cur_char_ptr = char_old;
7635 *visual_list_ptr = FALSE;
7643 if (*visual_list_ptr)
7646 *visual_list_ptr = FALSE;
7647 *need_redraw = TRUE;
7655 if (!*visual_list_ptr)
7657 *visual_list_ptr = TRUE;
7659 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7660 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7662 attr_old = *cur_attr_ptr;
7663 char_old = *cur_char_ptr;
7674 /* Set the visual */
7675 attr_idx = *cur_attr_ptr;
7676 char_idx = *cur_char_ptr;
7678 /* Hack -- for feature lighting */
7679 for (i = 0; i < F_LIT_MAX; i++)
7681 attr_idx_feat[i] = 0;
7682 char_idx_feat[i] = 0;
7689 if (attr_idx || (!(char_idx & 0x80) && char_idx)) /* Allow TERM_DARK text */
7692 *cur_attr_ptr = attr_idx;
7693 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7694 if (!*visual_list_ptr) *need_redraw = TRUE;
7700 *cur_char_ptr = char_idx;
7701 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7702 if (!*visual_list_ptr) *need_redraw = TRUE;
7708 if (*visual_list_ptr)
7711 int d = get_keymap_dir(ch);
7712 byte a = (*cur_attr_ptr & 0x7f);
7713 byte c = *cur_char_ptr;
7715 if (use_bigtile) eff_width = width / 2;
7716 else eff_width = width;
7718 /* Restrict direction */
7719 if ((a == 0) && (ddy[d] < 0)) d = 0;
7720 if ((c == 0) && (ddx[d] < 0)) d = 0;
7721 if ((a == 0x7f) && (ddy[d] > 0)) d = 0;
7722 if ((c == 0xff) && (ddx[d] > 0)) d = 0;
7727 /* Force correct code for both ASCII character and tile */
7728 if (c & 0x80) a |= 0x80;
7730 /* Set the visual */
7735 /* Move the frame */
7736 if ((ddx[d] < 0) && *char_left_ptr > MAX(0, (int)c - 10)) (*char_left_ptr)--;
7737 if ((ddx[d] > 0) && *char_left_ptr + eff_width < MIN(0xff, (int)c + 10)) (*char_left_ptr)++;
7738 if ((ddy[d] < 0) && *attr_top_ptr > MAX(0, (int)(a & 0x7f) - 4)) (*attr_top_ptr)--;
7739 if ((ddy[d] > 0) && *attr_top_ptr + height < MIN(0x7f, (a & 0x7f) + 4)) (*attr_top_ptr)++;
7745 /* Visual mode command is not used */
7751 * Display the monsters in a group.
7753 static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
7754 int mon_cur, int mon_top, bool visual_only)
7758 /* Display lines until done */
7759 for (i = 0; i < per_page && (mon_idx[mon_top + i] >= 0); i++)
7763 /* Get the race index */
7764 int r_idx = mon_idx[mon_top + i] ;
7766 /* Access the race */
7767 monster_race *r_ptr = &r_info[r_idx];
7769 /* Choose a color */
7770 attr = ((i + mon_top == mon_cur) ? TERM_L_BLUE : TERM_WHITE);
7772 /* Display the name */
7773 c_prt(attr, (r_name + r_ptr->name), row + i, col);
7775 /* Hack -- visual_list mode */
7778 c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, (p_ptr->wizard || visual_only) ? 56 : 61);
7780 if (p_ptr->wizard || visual_only)
7782 c_prt(attr, format("%d", r_idx), row + i, 62);
7785 /* Erase chars before overwritten by the race letter */
7786 Term_erase(69, row + i, 255);
7788 /* Display symbol */
7789 Term_queue_bigchar(use_bigtile ? 69 : 70, row + i, r_ptr->x_attr, r_ptr->x_char, 0, 0);
7794 if (!(r_ptr->flags1 & RF1_UNIQUE)) put_str(format("%5d", r_ptr->r_pkills), row + i, 73);
7796 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? "»àË´" : "À¸Â¸"), row + i, 74);
7798 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? " dead" : "alive"), row + i, 73);
7803 /* Clear remaining lines */
7804 for (; i < per_page; i++)
7806 Term_erase(col, row + i, 255);
7812 * Display known monsters.
7814 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, int direct_r_idx)
7817 int grp_cur, grp_top, old_grp_cur;
7818 int mon_cur, mon_top;
7819 int grp_cnt, grp_idx[100];
7827 bool visual_list = FALSE;
7828 byte attr_top = 0, char_left = 0;
7836 Term_get_size(&wid, &hgt);
7838 browser_rows = hgt - 8;
7840 /* Allocate the "mon_idx" array */
7841 C_MAKE(mon_idx, max_r_idx, s16b);
7846 if (direct_r_idx < 0)
7848 mode = visual_only ? 0x03 : 0x01;
7850 /* Check every group */
7851 for (i = 0; monster_group_text[i] != NULL; i++)
7853 /* Measure the label */
7854 len = strlen(monster_group_text[i]);
7856 /* Save the maximum length */
7857 if (len > max) max = len;
7859 /* See if any monsters are known */
7860 if ((monster_group_char[i] == ((char *) -1L)) || collect_monsters(i, mon_idx, mode))
7862 /* Build a list of groups with known monsters */
7863 grp_idx[grp_cnt++] = i;
7871 mon_idx[0] = direct_r_idx;
7874 /* Terminate the list */
7877 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
7878 &attr_top, &char_left, &r_info[direct_r_idx].x_attr, &r_info[direct_r_idx].x_char, need_redraw);
7881 /* Terminate the list */
7882 grp_idx[grp_cnt] = -1;
7885 grp_cur = grp_top = 0;
7886 mon_cur = mon_top = 0;
7891 mode = visual_only ? 0x02 : 0x00;
7896 monster_race *r_ptr;
7903 prt(format("%s - ¥â¥ó¥¹¥¿¡¼", !visual_only ? "Ãμ±" : "ɽ¼¨"), 2, 0);
7904 if (direct_r_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
7905 prt("̾Á°", 4, max + 3);
7906 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7908 if (!visual_only) prt("»¦³²¿ô", 4, 72);
7910 prt(format("%s - monsters", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
7911 if (direct_r_idx < 0) prt("Group", 4, 0);
7912 prt("Name", 4, max + 3);
7913 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7915 if (!visual_only) prt("Kills", 4, 73);
7918 for (i = 0; i < 78; i++)
7920 Term_putch(i, 5, TERM_WHITE, '=');
7923 if (direct_r_idx < 0)
7925 for (i = 0; i < browser_rows; i++)
7927 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7934 if (direct_r_idx < 0)
7936 /* Scroll group list */
7937 if (grp_cur < grp_top) grp_top = grp_cur;
7938 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7940 /* Display a list of monster groups */
7941 display_group_list(0, 6, max, browser_rows, grp_idx, monster_group_text, grp_cur, grp_top);
7943 if (old_grp_cur != grp_cur)
7945 old_grp_cur = grp_cur;
7947 /* Get a list of monsters in the current group */
7948 mon_cnt = collect_monsters(grp_idx[grp_cur], mon_idx, mode);
7951 /* Scroll monster list */
7952 while (mon_cur < mon_top)
7953 mon_top = MAX(0, mon_top - browser_rows/2);
7954 while (mon_cur >= mon_top + browser_rows)
7955 mon_top = MIN(mon_cnt - browser_rows, mon_top + browser_rows/2);
7960 /* Display a list of monsters in the current group */
7961 display_monster_list(max + 3, 6, browser_rows, mon_idx, mon_cur, mon_top, visual_only);
7967 /* Display a monster name */
7968 display_monster_list(max + 3, 6, 1, mon_idx, mon_cur, mon_top, visual_only);
7970 /* Display visual list below first monster */
7971 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7976 prt(format("<Êý¸þ>%s%s%s, ESC",
7977 (!visual_list && !visual_only) ? ", 'r'¤Ç»×¤¤½Ð¤ò¸«¤ë" : "",
7978 visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
7979 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
7982 prt(format("<dir>%s%s%s, ESC",
7983 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
7984 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
7985 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
7989 /* Get the current monster */
7990 r_ptr = &r_info[mon_idx[mon_cur]];
7994 /* Mega Hack -- track this monster race */
7995 if (mon_cnt) monster_race_track(mon_idx[mon_cur]);
7997 /* Hack -- handle stuff */
8003 place_visual_list_cursor(max + 3, 7, r_ptr->x_attr, r_ptr->x_char, attr_top, char_left);
8007 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8011 Term_gotoxy(max + 3, 6 + (mon_cur - mon_top));
8016 /* Do visual mode command if needed */
8017 if (visual_mode_command(ch, &visual_list, browser_rows-1, wid - (max + 3), &attr_top, &char_left, &r_ptr->x_attr, &r_ptr->x_char, need_redraw))
8019 if (direct_r_idx >= 0)
8044 /* Recall on screen */
8045 if (!visual_list && !visual_only && (mon_idx[mon_cur] > 0))
8047 screen_roff(mon_idx[mon_cur], 0);
8058 /* Move the cursor */
8059 browser_cursor(ch, &column, &grp_cur, grp_cnt, &mon_cur, mon_cnt);
8066 /* Free the "mon_idx" array */
8067 C_KILL(mon_idx, max_r_idx, s16b);
8072 * Display the objects in a group.
8074 static void display_object_list(int col, int row, int per_page, int object_idx[],
8075 int object_cur, int object_top, bool visual_only)
8079 /* Display lines until done */
8080 for (i = 0; i < per_page && (object_idx[object_top + i] >= 0); i++)
8084 object_kind *flavor_k_ptr;
8086 /* Get the object index */
8087 int k_idx = object_idx[object_top + i];
8089 /* Access the object */
8090 object_kind *k_ptr = &k_info[k_idx];
8092 /* Choose a color */
8093 byte attr = ((k_ptr->aware || visual_only) ? TERM_WHITE : TERM_SLATE);
8094 byte cursor = ((k_ptr->aware || visual_only) ? TERM_L_BLUE : TERM_BLUE);
8097 if (!visual_only && k_ptr->flavor)
8099 /* Appearance of this object is shuffled */
8100 flavor_k_ptr = &k_info[k_ptr->flavor];
8104 /* Appearance of this object is very normal */
8105 flavor_k_ptr = k_ptr;
8110 attr = ((i + object_top == object_cur) ? cursor : attr);
8112 if (!k_ptr->flavor || (!visual_only && k_ptr->aware))
8115 strip_name(o_name, k_idx);
8120 strcpy(o_name, k_name + flavor_k_ptr->flavor_name);
8123 /* Display the name */
8124 c_prt(attr, o_name, row + i, col);
8126 /* Hack -- visual_list mode */
8129 c_prt(attr, format("%02x/%02x", flavor_k_ptr->x_attr, flavor_k_ptr->x_char), row + i, (p_ptr->wizard || visual_only) ? 64 : 68);
8131 if (p_ptr->wizard || visual_only)
8133 c_prt(attr, format("%d", k_idx), row + i, 70);
8136 a = flavor_k_ptr->x_attr;
8137 c = flavor_k_ptr->x_char;
8139 /* Display symbol */
8140 Term_queue_bigchar(use_bigtile ? 76 : 77, row + i, a, c, 0, 0);
8143 /* Clear remaining lines */
8144 for (; i < per_page; i++)
8146 Term_erase(col, row + i, 255);
8151 * Describe fake object
8153 static void desc_obj_fake(int k_idx)
8156 object_type object_type_body;
8158 /* Get local object */
8159 o_ptr = &object_type_body;
8161 /* Wipe the object */
8164 /* Create the artifact */
8165 object_prep(o_ptr, k_idx);
8167 /* It's fully know */
8168 o_ptr->ident |= IDENT_KNOWN;
8170 /* Track the object */
8171 /* object_actual_track(o_ptr); */
8173 /* Hack - mark as fake */
8174 /* term_obj_real = FALSE; */
8176 /* Hack -- Handle stuff */
8179 if (!screen_object(o_ptr, SCROBJ_FAKE_OBJECT | SCROBJ_FORCE_DETAIL))
8182 msg_print("ÆäËÊѤï¤Ã¤¿¤È¤³¤í¤Ï¤Ê¤¤¤è¤¦¤À¡£");
8184 msg_print("You see nothing special.");
8193 * Display known objects
8195 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int direct_k_idx)
8198 int grp_cur, grp_top, old_grp_cur;
8199 int object_old, object_cur, object_top;
8200 int grp_cnt, grp_idx[100];
8208 bool visual_list = FALSE;
8209 byte attr_top = 0, char_left = 0;
8217 Term_get_size(&wid, &hgt);
8219 browser_rows = hgt - 8;
8221 /* Allocate the "object_idx" array */
8222 C_MAKE(object_idx, max_k_idx, int);
8227 if (direct_k_idx < 0)
8229 mode = visual_only ? 0x03 : 0x01;
8231 /* Check every group */
8232 for (i = 0; object_group_text[i] != NULL; i++)
8234 /* Measure the label */
8235 len = strlen(object_group_text[i]);
8237 /* Save the maximum length */
8238 if (len > max) max = len;
8240 /* See if any monsters are known */
8241 if (collect_objects(i, object_idx, mode))
8243 /* Build a list of groups with known monsters */
8244 grp_idx[grp_cnt++] = i;
8253 object_kind *k_ptr = &k_info[direct_k_idx];
8254 object_kind *flavor_k_ptr;
8256 if (!visual_only && k_ptr->flavor)
8258 /* Appearance of this object is shuffled */
8259 flavor_k_ptr = &k_info[k_ptr->flavor];
8263 /* Appearance of this object is very normal */
8264 flavor_k_ptr = k_ptr;
8267 object_idx[0] = direct_k_idx;
8268 object_old = direct_k_idx;
8271 /* Terminate the list */
8274 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
8275 &attr_top, &char_left, &flavor_k_ptr->x_attr, &flavor_k_ptr->x_char, need_redraw);
8278 /* Terminate the list */
8279 grp_idx[grp_cnt] = -1;
8282 grp_cur = grp_top = 0;
8283 object_cur = object_top = 0;
8288 mode = visual_only ? 0x02 : 0x00;
8293 object_kind *k_ptr, *flavor_k_ptr;
8300 prt(format("%s - ¥¢¥¤¥Æ¥à", !visual_only ? "Ãμ±" : "ɽ¼¨"), 2, 0);
8301 if (direct_k_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
8302 prt("̾Á°", 4, max + 3);
8303 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
8306 prt(format("%s - objects", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
8307 if (direct_k_idx < 0) prt("Group", 4, 0);
8308 prt("Name", 4, max + 3);
8309 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
8313 for (i = 0; i < 78; i++)
8315 Term_putch(i, 5, TERM_WHITE, '=');
8318 if (direct_k_idx < 0)
8320 for (i = 0; i < browser_rows; i++)
8322 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8329 if (direct_k_idx < 0)
8331 /* Scroll group list */
8332 if (grp_cur < grp_top) grp_top = grp_cur;
8333 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8335 /* Display a list of object groups */
8336 display_group_list(0, 6, max, browser_rows, grp_idx, object_group_text, grp_cur, grp_top);
8338 if (old_grp_cur != grp_cur)
8340 old_grp_cur = grp_cur;
8342 /* Get a list of objects in the current group */
8343 object_cnt = collect_objects(grp_idx[grp_cur], object_idx, mode);
8346 /* Scroll object list */
8347 while (object_cur < object_top)
8348 object_top = MAX(0, object_top - browser_rows/2);
8349 while (object_cur >= object_top + browser_rows)
8350 object_top = MIN(object_cnt - browser_rows, object_top + browser_rows/2);
8355 /* Display a list of objects in the current group */
8356 display_object_list(max + 3, 6, browser_rows, object_idx, object_cur, object_top, visual_only);
8360 object_top = object_cur;
8362 /* Display a list of objects in the current group */
8363 display_object_list(max + 3, 6, 1, object_idx, object_cur, object_top, visual_only);
8365 /* Display visual list below first object */
8366 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8369 /* Get the current object */
8370 k_ptr = &k_info[object_idx[object_cur]];
8372 if (!visual_only && k_ptr->flavor)
8374 /* Appearance of this object is shuffled */
8375 flavor_k_ptr = &k_info[k_ptr->flavor];
8379 /* Appearance of this object is very normal */
8380 flavor_k_ptr = k_ptr;
8385 prt(format("<Êý¸þ>%s%s%s, ESC",
8386 (!visual_list && !visual_only) ? ", 'r'¤Ç¾ÜºÙ¤ò¸«¤ë" : "",
8387 visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
8388 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
8391 prt(format("<dir>%s%s%s, ESC",
8392 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
8393 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
8394 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
8400 /* Mega Hack -- track this object */
8401 if (object_cnt) object_kind_track(object_idx[object_cur]);
8403 /* The "current" object changed */
8404 if (object_old != object_idx[object_cur])
8406 /* Hack -- handle stuff */
8409 /* Remember the "current" object */
8410 object_old = object_idx[object_cur];
8416 place_visual_list_cursor(max + 3, 7, flavor_k_ptr->x_attr, flavor_k_ptr->x_char, attr_top, char_left);
8420 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8424 Term_gotoxy(max + 3, 6 + (object_cur - object_top));
8429 /* Do visual mode command if needed */
8430 if (visual_mode_command(ch, &visual_list, browser_rows-1, wid - (max + 3), &attr_top, &char_left, &flavor_k_ptr->x_attr, &flavor_k_ptr->x_char, need_redraw))
8432 if (direct_k_idx >= 0)
8457 /* Recall on screen */
8458 if (!visual_list && !visual_only && (grp_cnt > 0))
8460 desc_obj_fake(object_idx[object_cur]);
8468 /* Move the cursor */
8469 browser_cursor(ch, &column, &grp_cur, grp_cnt, &object_cur, object_cnt);
8475 /* Free the "object_idx" array */
8476 C_KILL(object_idx, max_k_idx, int);
8481 * Display the features in a group.
8483 static void display_feature_list(int col, int row, int per_page, int *feat_idx,
8484 int feat_cur, int feat_top, bool visual_only, int lighting_level)
8486 int lit_col[F_LIT_MAX], i, j;
8487 int f_idx_col = use_bigtile ? 62 : 64;
8489 /* Correct columns 1 and 4 */
8490 lit_col[F_LIT_STANDARD] = use_bigtile ? (71 - F_LIT_MAX) : 71;
8491 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
8492 lit_col[i] = lit_col[F_LIT_STANDARD] + 2 + (i - F_LIT_NS_BEGIN) * 2 + (use_bigtile ? i : 0);
8494 /* Display lines until done */
8495 for (i = 0; i < per_page && (feat_idx[feat_top + i] >= 0); i++)
8500 int f_idx = feat_idx[feat_top + i];
8502 /* Access the index */
8503 feature_type *f_ptr = &f_info[f_idx];
8505 int row_i = row + i;
8507 /* Choose a color */
8508 attr = ((i + feat_top == feat_cur) ? TERM_L_BLUE : TERM_WHITE);
8510 /* Display the name */
8511 c_prt(attr, f_name + f_ptr->name, row_i, col);
8513 /* Hack -- visual_list mode */
8516 /* Display lighting level */
8517 c_prt(attr, format("(%s)", lighting_level_str[lighting_level]), row_i, col + 1 + strlen(f_name + f_ptr->name));
8519 c_prt(attr, format("%02x/%02x", f_ptr->x_attr[lighting_level], f_ptr->x_char[lighting_level]), row_i, f_idx_col - ((p_ptr->wizard || visual_only) ? 6 : 2));
8521 if (p_ptr->wizard || visual_only)
8523 c_prt(attr, format("%d", f_idx), row_i, f_idx_col);
8526 /* Display symbol */
8527 Term_queue_bigchar(lit_col[F_LIT_STANDARD], row_i, f_ptr->x_attr[F_LIT_STANDARD], f_ptr->x_char[F_LIT_STANDARD], 0, 0);
8529 Term_putch(lit_col[F_LIT_NS_BEGIN], row_i, TERM_SLATE, '(');
8530 for (j = F_LIT_NS_BEGIN + 1; j < F_LIT_MAX; j++)
8532 Term_putch(lit_col[j], row_i, TERM_SLATE, '/');
8534 Term_putch(lit_col[F_LIT_MAX - 1] + (use_bigtile ? 3 : 2), row_i, TERM_SLATE, ')');
8536 /* Mega-hack -- Use non-standard colour */
8537 for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
8539 Term_queue_bigchar(lit_col[j] + 1, row_i, f_ptr->x_attr[j], f_ptr->x_char[j], 0, 0);
8543 /* Clear remaining lines */
8544 for (; i < per_page; i++)
8546 Term_erase(col, row + i, 255);
8552 * Interact with feature visuals.
8554 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int direct_f_idx, int *lighting_level)
8557 int grp_cur, grp_top, old_grp_cur;
8558 int feat_cur, feat_top;
8559 int grp_cnt, grp_idx[100];
8567 bool visual_list = FALSE;
8568 byte attr_top = 0, char_left = 0;
8573 byte attr_old[F_LIT_MAX];
8574 byte char_old[F_LIT_MAX];
8575 byte *cur_attr_ptr, *cur_char_ptr;
8577 C_WIPE(attr_old, F_LIT_MAX, byte);
8578 C_WIPE(char_old, F_LIT_MAX, byte);
8581 Term_get_size(&wid, &hgt);
8583 browser_rows = hgt - 8;
8585 /* Allocate the "feat_idx" array */
8586 C_MAKE(feat_idx, max_f_idx, int);
8591 if (direct_f_idx < 0)
8593 /* Check every group */
8594 for (i = 0; feature_group_text[i] != NULL; i++)
8596 /* Measure the label */
8597 len = strlen(feature_group_text[i]);
8599 /* Save the maximum length */
8600 if (len > max) max = len;
8602 /* See if any features are known */
8603 if (collect_features(i, feat_idx, 0x01))
8605 /* Build a list of groups with known features */
8606 grp_idx[grp_cnt++] = i;
8614 feature_type *f_ptr = &f_info[direct_f_idx];
8616 feat_idx[0] = direct_f_idx;
8619 /* Terminate the list */
8622 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
8623 &attr_top, &char_left, &f_ptr->x_attr[*lighting_level], &f_ptr->x_char[*lighting_level], need_redraw);
8625 for (i = 0; i < F_LIT_MAX; i++)
8627 attr_old[i] = f_ptr->x_attr[i];
8628 char_old[i] = f_ptr->x_char[i];
8632 /* Terminate the list */
8633 grp_idx[grp_cnt] = -1;
8636 grp_cur = grp_top = 0;
8637 feat_cur = feat_top = 0;
8645 feature_type *f_ptr;
8652 prt("ɽ¼¨ - ÃÏ·Á", 2, 0);
8653 if (direct_f_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
8654 prt("̾Á°", 4, max + 3);
8657 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
8658 prt("ʸ»ú ( l/ d)", 4, 66);
8662 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
8663 prt("ʸ»ú (l/d)", 4, 68);
8666 prt("Visuals - features", 2, 0);
8667 if (direct_f_idx < 0) prt("Group", 4, 0);
8668 prt("Name", 4, max + 3);
8671 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
8672 prt("Sym ( l/ d)", 4, 67);
8676 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
8677 prt("Sym (l/d)", 4, 69);
8681 for (i = 0; i < 78; i++)
8683 Term_putch(i, 5, TERM_WHITE, '=');
8686 if (direct_f_idx < 0)
8688 for (i = 0; i < browser_rows; i++)
8690 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8697 if (direct_f_idx < 0)
8699 /* Scroll group list */
8700 if (grp_cur < grp_top) grp_top = grp_cur;
8701 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8703 /* Display a list of feature groups */
8704 display_group_list(0, 6, max, browser_rows, grp_idx, feature_group_text, grp_cur, grp_top);
8706 if (old_grp_cur != grp_cur)
8708 old_grp_cur = grp_cur;
8710 /* Get a list of features in the current group */
8711 feat_cnt = collect_features(grp_idx[grp_cur], feat_idx, 0x00);
8714 /* Scroll feature list */
8715 while (feat_cur < feat_top)
8716 feat_top = MAX(0, feat_top - browser_rows/2);
8717 while (feat_cur >= feat_top + browser_rows)
8718 feat_top = MIN(feat_cnt - browser_rows, feat_top + browser_rows/2);
8723 /* Display a list of features in the current group */
8724 display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top, visual_only, F_LIT_STANDARD);
8728 feat_top = feat_cur;
8730 /* Display a list of features in the current group */
8731 display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top, visual_only, *lighting_level);
8733 /* Display visual list below first object */
8734 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8739 prt(format("<Êý¸þ>%s, 'd'¤Çɸ½à¸÷¸»¸ú²Ì%s, ESC",
8740 visual_list ? ", ENTER¤Ç·èÄê, 'a'¤ÇÂоÝÌÀÅÙÊѹ¹" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
8741 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
8744 prt(format("<dir>%s, 'd' for default lighting%s, ESC",
8745 visual_list ? ", ENTER to accept, 'a' for lighting level" : ", 'v' for visuals",
8746 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
8750 /* Get the current feature */
8751 f_ptr = &f_info[feat_idx[feat_cur]];
8752 cur_attr_ptr = &f_ptr->x_attr[*lighting_level];
8753 cur_char_ptr = &f_ptr->x_char[*lighting_level];
8757 place_visual_list_cursor(max + 3, 7, *cur_attr_ptr, *cur_char_ptr, attr_top, char_left);
8761 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8765 Term_gotoxy(max + 3, 6 + (feat_cur - feat_top));
8770 if (visual_list && ((ch == 'A') || (ch == 'a')))
8772 int prev_lighting_level = *lighting_level;
8776 if (*lighting_level <= 0) *lighting_level = F_LIT_MAX - 1;
8777 else (*lighting_level)--;
8781 if (*lighting_level >= F_LIT_MAX - 1) *lighting_level = 0;
8782 else (*lighting_level)++;
8785 if (f_ptr->x_attr[prev_lighting_level] != f_ptr->x_attr[*lighting_level])
8786 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
8788 if (f_ptr->x_char[prev_lighting_level] != f_ptr->x_char[*lighting_level])
8789 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
8794 else if ((ch == 'D') || (ch == 'd'))
8796 byte prev_x_attr = f_ptr->x_attr[*lighting_level];
8797 byte prev_x_char = f_ptr->x_char[*lighting_level];
8799 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
8803 if (prev_x_attr != f_ptr->x_attr[*lighting_level])
8804 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
8806 if (prev_x_char != f_ptr->x_char[*lighting_level])
8807 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
8809 else *need_redraw = TRUE;
8814 /* Do visual mode command if needed */
8815 else if (visual_mode_command(ch, &visual_list, browser_rows-1, wid - (max + 3), &attr_top, &char_left, cur_attr_ptr, cur_char_ptr, need_redraw))
8819 /* Restore previous visual settings */
8821 for (i = 0; i < F_LIT_MAX; i++)
8823 f_ptr->x_attr[i] = attr_old[i];
8824 f_ptr->x_char[i] = char_old[i];
8831 if (direct_f_idx >= 0) flag = TRUE;
8832 else *lighting_level = F_LIT_STANDARD;
8835 /* Preserve current visual settings */
8838 for (i = 0; i < F_LIT_MAX; i++)
8840 attr_old[i] = f_ptr->x_attr[i];
8841 char_old[i] = f_ptr->x_char[i];
8843 *lighting_level = F_LIT_STANDARD;
8850 for (i = 0; i < F_LIT_MAX; i++)
8852 attr_idx_feat[i] = f_ptr->x_attr[i];
8853 char_idx_feat[i] = f_ptr->x_char[i];
8862 /* Allow TERM_DARK text */
8863 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
8865 if (attr_idx_feat[i] || (!(char_idx_feat[i] & 0x80) && char_idx_feat[i])) f_ptr->x_attr[i] = attr_idx_feat[i];
8866 if (char_idx_feat[i]) f_ptr->x_char[i] = char_idx_feat[i];
8884 /* Move the cursor */
8885 browser_cursor(ch, &column, &grp_cur, grp_cnt, &feat_cur, feat_cnt);
8891 /* Free the "feat_idx" array */
8892 C_KILL(feat_idx, max_f_idx, int);
8897 * List wanted monsters
8899 static void do_cmd_knowledge_kubi(void)
8904 char file_name[1024];
8907 /* Open a new file */
8908 fff = my_fopen_temp(file_name, 1024);
8911 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8913 msg_format("Failed to create temporary file %s.", file_name);
8921 bool listed = FALSE;
8924 fprintf(fff, "º£Æü¤Î¥¿¡¼¥²¥Ã¥È : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "ÉÔÌÀ"));
8926 fprintf(fff, "¾Þ¶â¼ó¥ê¥¹¥È\n");
8928 fprintf(fff, "Today target : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "unknown"));
8930 fprintf(fff, "List of wanted monsters\n");
8932 fprintf(fff, "----------------------------------------------\n");
8934 for (i = 0; i < MAX_KUBI; i++)
8936 if (kubi_r_idx[i] <= 10000)
8938 fprintf(fff,"%s\n", r_name + r_info[kubi_r_idx[i]].name);
8947 fprintf(fff,"\n%s\n", "¾Þ¶â¼ó¤Ï¤â¤¦»Ä¤Ã¤Æ¤¤¤Þ¤»¤ó¡£");
8949 fprintf(fff,"\n%s\n", "There is no more wanted monster.");
8954 /* Close the file */
8957 /* Display the file contents */
8959 show_file(TRUE, file_name, "¾Þ¶â¼ó¤Î°ìÍ÷", 0, 0);
8961 show_file(TRUE, file_name, "Wanted monsters", 0, 0);
8965 /* Remove the file */
8970 * List virtues & status
8972 static void do_cmd_knowledge_virtues(void)
8976 char file_name[1024];
8979 /* Open a new file */
8980 fff = my_fopen_temp(file_name, 1024);
8983 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8985 msg_format("Failed to create temporary file %s.", file_name);
8994 fprintf(fff, "¸½ºß¤Î°À : %s\n\n", your_alignment());
8996 fprintf(fff, "Your alighnment : %s\n\n", your_alignment());
9001 /* Close the file */
9004 /* Display the file contents */
9006 show_file(TRUE, file_name, "Ȭ¤Ä¤ÎÆÁ", 0, 0);
9008 show_file(TRUE, file_name, "Virtues", 0, 0);
9012 /* Remove the file */
9020 static void do_cmd_knowledge_dungeon(void)
9024 char file_name[1024];
9028 /* Open a new file */
9029 fff = my_fopen_temp(file_name, 1024);
9032 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9034 msg_format("Failed to create temporary file %s.", file_name);
9042 for (i = 1; i < max_d_idx; i++)
9046 if (!d_info[i].maxdepth) continue;
9047 if (!max_dlv[i]) continue;
9048 if (d_info[i].final_guardian)
9050 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
9052 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
9054 fprintf(fff,"%c%-12s : %3d ³¬\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
9056 fprintf(fff,"%c%-16s : level %3d\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
9061 /* Close the file */
9064 /* Display the file contents */
9066 show_file(TRUE, file_name, "º£¤Þ¤Ç¤ËÆþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó", 0, 0);
9068 show_file(TRUE, file_name, "Dungeon", 0, 0);
9072 /* Remove the file */
9077 * List virtues & status
9080 static void do_cmd_knowledge_stat(void)
9084 char file_name[1024];
9087 /* Open a new file */
9088 fff = my_fopen_temp(file_name, 1024);
9091 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9093 msg_format("Failed to create temporary file %s.", file_name);
9101 percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
9102 (2 * p_ptr->hitdie +
9103 ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
9106 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : %d/100\n\n", percent);
9107 else fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : ???\n\n");
9108 fprintf(fff, "ǽÎϤκÇÂçÃÍ\n\n");
9110 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "Your current Life Rating is %d/100.\n\n", percent);
9111 else fprintf(fff, "Your current Life Rating is ???.\n\n");
9112 fprintf(fff, "Limits of maximum stats\n\n");
9114 for (v_nr = 0; v_nr < 6; v_nr++)
9116 if ((p_ptr->knowledge & KNOW_STAT) || p_ptr->stat_max[v_nr] == p_ptr->stat_max_max[v_nr]) fprintf(fff, "%s 18/%d\n", stat_names[v_nr], p_ptr->stat_max_max[v_nr]-18);
9117 else fprintf(fff, "%s ???\n", stat_names[v_nr]);
9123 /* Close the file */
9126 /* Display the file contents */
9128 show_file(TRUE, file_name, "¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó", 0, 0);
9130 show_file(TRUE, file_name, "HP-rate & Max stat", 0, 0);
9134 /* Remove the file */
9140 * Print all active quests
9142 static void do_cmd_knowledge_quests_current(FILE *fff)
9145 char rand_tmp_str[120] = "\0";
9147 monster_race *r_ptr;
9149 int rand_level = 100;
9153 fprintf(fff, "¡Ô¿ë¹ÔÃæ¤Î¥¯¥¨¥¹¥È¡Õ\n");
9155 fprintf(fff, "< Current Quest >\n");
9158 for (i = 1; i < max_quests; i++)
9160 if ((quest[i].status == QUEST_STATUS_TAKEN) || (quest[i].status == QUEST_STATUS_COMPLETED))
9162 /* Set the quest number temporary */
9163 int old_quest = p_ptr->inside_quest;
9166 /* Clear the text */
9167 for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
9168 quest_text_line = 0;
9170 p_ptr->inside_quest = i;
9172 /* Get the quest text */
9173 init_flags = INIT_SHOW_TEXT;
9175 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9177 /* Reset the old quest number */
9178 p_ptr->inside_quest = old_quest;
9180 /* No info from "silent" quests */
9181 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
9185 if (quest[i].type != QUEST_TYPE_RANDOM)
9187 char note[80] = "\0";
9189 if (quest[i].status == QUEST_STATUS_TAKEN)
9191 switch (quest[i].type)
9193 case QUEST_TYPE_KILL_LEVEL:
9194 case QUEST_TYPE_KILL_ANY_LEVEL:
9195 r_ptr = &r_info[quest[i].r_idx];
9196 strcpy(name, r_name + r_ptr->name);
9197 if (quest[i].max_num > 1)
9200 sprintf(note," - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
9201 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
9204 sprintf(note," - kill %d %s, have killed %d.",
9205 quest[i].max_num, name, quest[i].cur_num);
9210 sprintf(note," - %s¤òÅݤ¹¡£",name);
9212 sprintf(note," - kill %s.",name);
9216 case QUEST_TYPE_FIND_ARTIFACT:
9217 strcpy(name, a_name + a_info[quest[i].k_idx].name);
9219 sprintf(note," - %s¤ò¸«¤Ä¤±½Ð¤¹¡£", name);
9221 sprintf(note," - Find out %s.", name);
9225 case QUEST_TYPE_FIND_EXIT:
9227 sprintf(note," - õº÷¤¹¤ë¡£");
9229 sprintf(note," - Search.");
9233 case QUEST_TYPE_KILL_NUMBER:
9235 sprintf(note," - %d ÂΤΥâ¥ó¥¹¥¿¡¼¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
9236 quest[i].max_num, quest[i].max_num - quest[i].cur_num);
9238 sprintf(note," - Kill %d monsters, have killed %d.",
9239 quest[i].max_num, quest[i].cur_num);
9243 case QUEST_TYPE_KILL_ALL:
9245 sprintf(note," - Á´¤Æ¤Î¥â¥ó¥¹¥¿¡¼¤òÅݤ¹¡£");
9247 sprintf(note," - Kill all monsters.");
9253 /* Print the quest info */
9255 sprintf(tmp_str, " %s (´í¸±ÅÙ:%d³¬ÁêÅö)%s\n",
9256 quest[i].name, quest[i].level, note);
9258 sprintf(tmp_str, " %s (Danger level: %d)%s\n",
9259 quest[i].name, quest[i].level, note);
9262 fprintf(fff, tmp_str);
9264 if (quest[i].status == QUEST_STATUS_COMPLETED)
9267 sprintf(tmp_str, " ¥¯¥¨¥¹¥ÈãÀ® - ¤Þ¤ÀÊó½·¤ò¼õ¤±¤È¤Ã¤Æ¤Ê¤¤¡£\n");
9269 sprintf(tmp_str, " Quest Completed - Unrewarded\n");
9271 fprintf(fff, tmp_str);
9277 while (quest_text[j][0] && j < 10)
9279 fprintf(fff, " %s\n", quest_text[j]);
9284 else if (quest[i].level < rand_level) /* QUEST_TYPE_RANDOM */
9287 rand_level = quest[i].level;
9289 if (max_dlv[DUNGEON_ANGBAND] >= rand_level)
9291 /* Print the quest info */
9292 r_ptr = &r_info[quest[i].r_idx];
9293 strcpy(name, r_name + r_ptr->name);
9295 if (quest[i].max_num > 1)
9298 sprintf(rand_tmp_str," %s (%d ³¬) - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)\n",
9299 quest[i].name, quest[i].level,
9300 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
9304 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
9305 quest[i].name, quest[i].level,
9306 quest[i].max_num, name, quest[i].cur_num);
9312 sprintf(rand_tmp_str," %s (%d ³¬) - %s¤òÅݤ¹¡£\n",
9313 quest[i].name, quest[i].level, name);
9315 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %s.\n",
9316 quest[i].name, quest[i].level, name);
9324 /* Print the current random quest */
9325 if (rand_tmp_str[0]) fprintf(fff, rand_tmp_str);
9328 if (!total) fprintf(fff, " ¤Ê¤·\n");
9330 if (!total) fprintf(fff, " Nothing.\n");
9336 * Print all finished quests
9338 void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[])
9345 fprintf(fff, "¡ÔãÀ®¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
9347 fprintf(fff, "< Completed Quest >\n");
9349 for (i = 1; i < max_quests; i++)
9351 int q_idx = quest_num[i];
9353 if (quest[q_idx].status == QUEST_STATUS_FINISHED)
9355 if (is_fixed_quest_idx(q_idx))
9357 /* Set the quest number temporary */
9358 int old_quest = p_ptr->inside_quest;
9360 p_ptr->inside_quest = q_idx;
9363 init_flags = INIT_ASSIGN;
9365 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9367 /* Reset the old quest number */
9368 p_ptr->inside_quest = old_quest;
9370 /* No info from "silent" quests */
9371 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
9376 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
9378 /* Print the quest info */
9380 if (quest[q_idx].complev == 0)
9384 " %-40s (%3d³¬) - ÉÔÀᄀ\n",
9386 " %-40s (Dungeon level: %3d) - (Cancelled)\n",
9388 r_name+r_info[quest[q_idx].r_idx].name,
9389 quest[q_idx].level);
9395 " %-40s (%3d³¬) - ¥ì¥Ù¥ë%2d\n",
9397 " %-40s (Dungeon level: %3d) - level %2d\n",
9399 r_name+r_info[quest[q_idx].r_idx].name,
9401 quest[q_idx].complev);
9406 /* Print the quest info */
9408 sprintf(tmp_str, " %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
9409 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9411 sprintf(tmp_str, " %-40s (Danger level: %3d) - level %2d\n",
9412 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9416 fprintf(fff, tmp_str);
9420 if (!total) fprintf(fff, " ¤Ê¤·\n");
9422 if (!total) fprintf(fff, " Nothing.\n");
9428 * Print all failed quests
9430 void do_cmd_knowledge_quests_failed(FILE *fff, int quest_num[])
9437 fprintf(fff, "¡Ô¼ºÇÔ¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
9439 fprintf(fff, "< Failed Quest >\n");
9441 for (i = 1; i < max_quests; i++)
9443 int q_idx = quest_num[i];
9445 if ((quest[q_idx].status == QUEST_STATUS_FAILED_DONE) || (quest[q_idx].status == QUEST_STATUS_FAILED))
9447 if (is_fixed_quest_idx(q_idx))
9449 /* Set the quest number temporary */
9450 int old_quest = p_ptr->inside_quest;
9452 p_ptr->inside_quest = q_idx;
9454 /* Get the quest text */
9455 init_flags = INIT_ASSIGN;
9457 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9459 /* Reset the old quest number */
9460 p_ptr->inside_quest = old_quest;
9462 /* No info from "silent" quests */
9463 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
9468 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
9470 /* Print the quest info */
9472 sprintf(tmp_str, " %-40s (%3d³¬) - ¥ì¥Ù¥ë%2d\n",
9473 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
9475 sprintf(tmp_str, " %-40s (Dungeon level: %3d) - level %2d\n",
9476 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
9481 /* Print the quest info */
9483 sprintf(tmp_str, " %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
9484 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9486 sprintf(tmp_str, " %-40s (Danger level: %3d) - level %2d\n",
9487 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9490 fprintf(fff, tmp_str);
9494 if (!total) fprintf(fff, " ¤Ê¤·\n");
9496 if (!total) fprintf(fff, " Nothing.\n");
9502 * Print all random quests
9504 static void do_cmd_knowledge_quests_wiz_random(FILE *fff)
9511 fprintf(fff, "¡Ô»Ä¤ê¤Î¥é¥ó¥À¥à¥¯¥¨¥¹¥È¡Õ\n");
9513 fprintf(fff, "< Remaining Random Quest >\n");
9515 for (i = 1; i < max_quests; i++)
9517 /* No info from "silent" quests */
9518 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
9520 if ((quest[i].type == QUEST_TYPE_RANDOM) && (quest[i].status == QUEST_STATUS_TAKEN))
9524 /* Print the quest info */
9526 sprintf(tmp_str, " %s (%d³¬, %s)\n",
9527 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
9529 sprintf(tmp_str, " %s (%d, %s)\n",
9530 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
9532 fprintf(fff, tmp_str);
9536 if (!total) fprintf(fff, " ¤Ê¤·\n");
9538 if (!total) fprintf(fff, " Nothing.\n");
9543 bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b)
9545 int *q_num = (int *)u;
9546 quest_type *qa = &quest[q_num[a]];
9547 quest_type *qb = &quest[q_num[b]];
9552 if (qa->complev < qb->complev) return TRUE;
9553 if (qa->complev > qb->complev) return FALSE;
9554 if (qa->level <= qb->level) return TRUE;
9558 void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b)
9560 int *q_num = (int *)u;
9567 q_num[a] = q_num[b];
9573 * Print quest status of all active quests
9575 static void do_cmd_knowledge_quests(void)
9578 char file_name[1024];
9579 int *quest_num, dummy, i;
9581 /* Open a new file */
9582 fff = my_fopen_temp(file_name, 1024);
9586 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9588 msg_format("Failed to create temporary file %s.", file_name);
9594 /* Allocate Memory */
9595 C_MAKE(quest_num, max_quests, int);
9597 /* Sort by compete level */
9598 for (i = 1; i < max_quests; i++) quest_num[i] = i;
9599 ang_sort_comp = ang_sort_comp_quest_num;
9600 ang_sort_swap = ang_sort_swap_quest_num;
9601 ang_sort(quest_num, &dummy, max_quests);
9603 /* Dump Quest Information */
9604 do_cmd_knowledge_quests_current(fff);
9606 do_cmd_knowledge_quests_completed(fff, quest_num);
9608 do_cmd_knowledge_quests_failed(fff, quest_num);
9612 do_cmd_knowledge_quests_wiz_random(fff);
9615 /* Close the file */
9618 /* Display the file contents */
9620 show_file(TRUE, file_name, "¥¯¥¨¥¹¥ÈãÀ®¾õ¶·", 0, 0);
9622 show_file(TRUE, file_name, "Quest status", 0, 0);
9625 /* Remove the file */
9629 C_KILL(quest_num, max_quests, int);
9636 static void do_cmd_knowledge_home(void)
9641 char file_name[1024];
9643 char o_name[MAX_NLEN];
9646 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
9648 /* Open a new file */
9649 fff = my_fopen_temp(file_name, 1024);
9652 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9654 msg_format("Failed to create temporary file %s.", file_name);
9662 /* Print all homes in the different towns */
9663 st_ptr = &town[1].store[STORE_HOME];
9665 /* Home -- if anything there */
9666 if (st_ptr->stock_num)
9671 /* Header with name of the town */
9673 fprintf(fff, " [ ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ]\n");
9675 fprintf(fff, " [Home Inventory]\n");
9678 /* Dump all available items */
9679 for (i = 0; i < st_ptr->stock_num; i++)
9682 if ((i % 12) == 0) fprintf(fff, "\n ( %d ¥Ú¡¼¥¸ )\n", x++);
9683 object_desc(o_name, &st_ptr->stock[i], 0);
9684 if (strlen(o_name) <= 80-3)
9686 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9692 for (n = 0, t = o_name; n < 80-3; n++, t++)
9693 if(iskanji(*t)) {t++; n++;}
9694 if (n == 81-3) n = 79-3; /* ºÇ¸å¤¬´Á»úȾʬ */
9696 fprintf(fff, "%c%s %.*s\n", I2A(i%12), paren, n, o_name);
9697 fprintf(fff, " %.77s\n", o_name+n);
9700 object_desc(o_name, &st_ptr->stock[i], 0);
9701 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9706 /* Add an empty line */
9707 fprintf(fff, "\n\n");
9711 /* Close the file */
9714 /* Display the file contents */
9716 show_file(TRUE, file_name, "²æ¤¬²È¤Î¥¢¥¤¥Æ¥à", 0, 0);
9718 show_file(TRUE, file_name, "Home Inventory", 0, 0);
9722 /* Remove the file */
9728 * Check the status of "autopick"
9730 static void do_cmd_knowledge_autopick(void)
9734 char file_name[1024];
9736 /* Open a new file */
9737 fff = my_fopen_temp(file_name, 1024);
9742 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9744 msg_format("Failed to create temporary file %s.", file_name);
9753 fprintf(fff, "¼«Æ°Ç˲õ/½¦¤¤¤Ë¤Ï²¿¤âÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
9755 fprintf(fff, "No preference for auto picker/destroyer.");
9761 fprintf(fff, " ¼«Æ°½¦¤¤/Ç˲õ¤Ë¤Ï¸½ºß %d¹ÔÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤¹¡£\n\n", max_autopick);
9763 fprintf(fff, " There are %d registered lines for auto picker/destroyer.\n\n", max_autopick);
9767 for (k = 0; k < max_autopick; k++)
9770 byte act = autopick_list[k].action;
9771 if (act & DONT_AUTOPICK)
9779 else if (act & DO_AUTODESTROY)
9787 else if (act & DO_AUTOPICK)
9795 else /* if (act & DO_QUERY_AUTOPICK) */ /* Obvious */
9804 if (act & DO_DISPLAY)
9805 fprintf(fff, "%11s", format("[%s]", tmp));
9807 fprintf(fff, "%11s", format("(%s)", tmp));
9809 tmp = autopick_line_from_entry(&autopick_list[k]);
9810 fprintf(fff, " %s", tmp);
9814 /* Close the file */
9816 /* Display the file contents */
9818 show_file(TRUE, file_name, "¼«Æ°½¦¤¤/Ç˲õ ÀßÄê¥ê¥¹¥È", 0, 0);
9820 show_file(TRUE, file_name, "Auto-picker/Destroyer", 0, 0);
9823 /* Remove the file */
9829 * Interact with "knowledge"
9831 void do_cmd_knowledge(void)
9834 bool need_redraw = FALSE;
9836 /* File type is "TEXT" */
9837 FILE_TYPE(FILE_TYPE_TEXT);
9839 /* Save the screen */
9842 /* Interact until done */
9848 /* Ask for a choice */
9850 prt(format("%d/2 ¥Ú¡¼¥¸", (p+1)), 2, 65);
9851 prt("¸½ºß¤ÎÃ챤ò³Îǧ¤¹¤ë", 3, 0);
9853 prt(format("page %d/2", (p+1)), 2, 65);
9854 prt("Display current knowledge", 3, 0);
9857 /* Give some choices */
9861 prt("(1) ´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 6, 5);
9862 prt("(2) ´ûÃΤΥ¢¥¤¥Æ¥à ¤Î°ìÍ÷", 7, 5);
9863 prt("(3) ´ûÃΤÎÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 8, 5);
9864 prt("(4) ´ûÃΤΥâ¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 9, 5);
9865 prt("(5) Åݤ·¤¿Å¨¤Î¿ô ¤Î°ìÍ÷", 10, 5);
9866 if (!vanilla_town) prt("(6) ¾Þ¶â¼ó ¤Î°ìÍ÷", 11, 5);
9867 prt("(7) ¸½ºß¤Î¥Ú¥Ã¥È ¤Î°ìÍ÷", 12, 5);
9868 prt("(8) ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 13, 5);
9869 prt("(9) *´ÕÄê*ºÑ¤ßÁõÈ÷¤ÎÂÑÀ ¤Î°ìÍ÷", 14, 5);
9870 prt("(0) ÃÏ·Á¤Îɽ¼¨Ê¸»ú/¥¿¥¤¥ë ¤Î°ìÍ÷", 15, 5);
9874 prt("(a) ¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó ¤Î°ìÍ÷", 6, 5);
9875 prt("(b) ÆÍÁ³ÊÑ°Û ¤Î°ìÍ÷", 7, 5);
9876 prt("(c) Éð´ï¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 8, 5);
9877 prt("(d) ËâË¡¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 9, 5);
9878 prt("(e) µ»Ç½¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 10, 5);
9879 prt("(f) ¥×¥ì¥¤¥ä¡¼¤ÎÆÁ ¤Î°ìÍ÷", 11, 5);
9880 prt("(g) Æþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó ¤Î°ìÍ÷", 12, 5);
9881 prt("(h) ¼Â¹ÔÃæ¤Î¥¯¥¨¥¹¥È ¤Î°ìÍ÷", 13, 5);
9882 prt("(i) ¸½ºß¤Î¼«Æ°½¦¤¤/Ç˲õÀßÄê ¤Î°ìÍ÷", 14, 5);
9887 prt("(1) Display known artifacts", 6, 5);
9888 prt("(2) Display known objects", 7, 5);
9889 prt("(3) Display remaining uniques", 8, 5);
9890 prt("(4) Display known monster", 9, 5);
9891 prt("(5) Display kill count", 10, 5);
9892 if (!vanilla_town) prt("(6) Display wanted monsters", 11, 5);
9893 prt("(7) Display current pets", 12, 5);
9894 prt("(8) Display home inventory", 13, 5);
9895 prt("(9) Display *identified* equip.", 14, 5);
9896 prt("(0) Display terrain symbols.", 15, 5);
9900 prt("(a) Display about yourself", 6, 5);
9901 prt("(b) Display mutations", 7, 5);
9902 prt("(c) Display weapon proficiency", 8, 5);
9903 prt("(d) Display spell proficiency", 9, 5);
9904 prt("(e) Display misc. proficiency", 10, 5);
9905 prt("(f) Display virtues", 11, 5);
9906 prt("(g) Display dungeons", 12, 5);
9907 prt("(h) Display current quests", 13, 5);
9908 prt("(i) Display auto pick/destroy", 14, 5);
9913 prt("-³¤¯-", 17, 8);
9914 prt("ESC) È´¤±¤ë", 21, 1);
9915 prt("SPACE) ¼¡¥Ú¡¼¥¸", 21, 30);
9916 /*prt("-) Á°¥Ú¡¼¥¸", 21, 60);*/
9917 prt("¥³¥Þ¥ó¥É:", 20, 0);
9919 prt("-more-", 17, 8);
9920 prt("ESC) Exit menu", 21, 1);
9921 prt("SPACE) Next page", 21, 30);
9922 /*prt("-) Previous page", 21, 60);*/
9923 prt("Command: ", 20, 0);
9930 if (i == ESCAPE) break;
9933 case ' ': /* Page change */
9937 case '1': /* Artifacts */
9938 do_cmd_knowledge_artifacts();
9940 case '2': /* Objects */
9941 do_cmd_knowledge_objects(&need_redraw, FALSE, -1);
9943 case '3': /* Uniques */
9944 do_cmd_knowledge_uniques();
9946 case '4': /* Monsters */
9947 do_cmd_knowledge_monsters(&need_redraw, FALSE, -1);
9949 case '5': /* Kill count */
9950 do_cmd_knowledge_kill_count();
9952 case '6': /* wanted */
9953 if (!vanilla_town) do_cmd_knowledge_kubi();
9955 case '7': /* Pets */
9956 do_cmd_knowledge_pets();
9958 case '8': /* Home */
9959 do_cmd_knowledge_home();
9961 case '9': /* Resist list */
9962 do_cmd_knowledge_inven();
9964 case '0': /* Feature list */
9966 int lighting_level = F_LIT_STANDARD;
9967 do_cmd_knowledge_features(&need_redraw, FALSE, -1, &lighting_level);
9971 case 'a': /* Max stat */
9972 do_cmd_knowledge_stat();
9974 case 'b': /* Mutations */
9975 do_cmd_knowledge_mutations();
9977 case 'c': /* weapon-exp */
9978 do_cmd_knowledge_weapon_exp();
9980 case 'd': /* spell-exp */
9981 do_cmd_knowledge_spell_exp();
9983 case 'e': /* skill-exp */
9984 do_cmd_knowledge_skill_exp();
9986 case 'f': /* Virtues */
9987 do_cmd_knowledge_virtues();
9989 case 'g': /* Dungeon */
9990 do_cmd_knowledge_dungeon();
9992 case 'h': /* Quests */
9993 do_cmd_knowledge_quests();
9995 case 'i': /* Autopick */
9996 do_cmd_knowledge_autopick();
9998 default: /* Unknown option */
10002 /* Flush messages */
10006 /* Restore the screen */
10009 if (need_redraw) do_cmd_redraw();
10014 * Check on the status of an active quest
10016 void do_cmd_checkquest(void)
10018 /* File type is "TEXT" */
10019 FILE_TYPE(FILE_TYPE_TEXT);
10021 /* Save the screen */
10025 do_cmd_knowledge_quests();
10027 /* Restore the screen */
10033 * Display the time and date
10035 void do_cmd_time(void)
10037 int day, hour, min, full, start, end, num;
10045 extract_day_hour_min(&day, &hour, &min);
10047 full = hour * 100 + min;
10055 strcpy(desc, "ÊѤʻþ¹ï¤À¡£");
10057 strcpy(desc, "It is a strange time.");
10061 if (day < MAX_DAYS) sprintf(day_buf, "%d", day);
10062 else strcpy(day_buf, "*****");
10066 msg_format("%sÆüÌÜ, »þ¹ï¤Ï%d:%02d %s¤Ç¤¹¡£",
10067 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
10068 min, (hour < 12) ? "AM" : "PM");
10070 msg_format("This is day %s. The time is %d:%02d %s.",
10071 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
10072 min, (hour < 12) ? "AM" : "PM");
10076 /* Find the path */
10077 if (!randint0(10) || p_ptr->image)
10080 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun_j.txt");
10082 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun.txt");
10089 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm_j.txt");
10091 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm.txt");
10096 /* Open this file */
10097 fff = my_fopen(buf, "rt");
10102 /* Find this time */
10103 while (!my_fgets(fff, buf, sizeof(buf)))
10105 /* Ignore comments */
10106 if (!buf[0] || (buf[0] == '#')) continue;
10108 /* Ignore invalid lines */
10109 if (buf[1] != ':') continue;
10111 /* Process 'Start' */
10114 /* Extract the starting time */
10115 start = atoi(buf + 2);
10117 /* Assume valid for an hour */
10124 /* Process 'End' */
10127 /* Extract the ending time */
10128 end = atoi(buf + 2);
10134 /* Ignore incorrect range */
10135 if ((start > full) || (full > end)) continue;
10137 /* Process 'Description' */
10142 /* Apply the randomizer */
10143 if (!randint0(num)) strcpy(desc, buf + 2);
10153 /* Close the file */