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_NAME_ONLY;
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("(R) ¥×¥ì¥¤Æ°²è¤òµÏ¿¤¹¤ë/Ãæ»ß¤¹¤ë", 9, 5);
1096 prt("(1) Display your record", 4, 5);
1097 prt("(2) Add record", 5, 5);
1098 prt("(3) Record item you last get/identify", 6, 5);
1099 prt("(4) Delete your record", 7, 5);
1101 prt("(R) Record playing movie / or stop it", 9, 5);
1107 prt("¥³¥Þ¥ó¥É:", 18, 0);
1109 prt("Command: ", 18, 0);
1117 if (i == ESCAPE) break;
1122 do_cmd_disp_nikki();
1131 do_cmd_erase_nikki();
1135 prepare_movie_hooks();
1137 default: /* Unknown option */
1141 /* Flush messages */
1145 /* Restore the screen */
1150 * Hack -- redraw the screen
1152 * This command performs various low level updates, clears all the "extra"
1153 * windows, does a total redraw of the main window, and requests all of the
1154 * interesting updates and redraws that I can think of.
1156 * This command is also used to "instantiate" the results of the user
1157 * selecting various things, such as graphics mode, so it must call
1158 * the "TERM_XTRA_REACT" hook before redrawing the windows.
1160 void do_cmd_redraw(void)
1167 /* Hack -- react to changes */
1168 Term_xtra(TERM_XTRA_REACT, 0);
1171 /* Combine and Reorder the pack (later) */
1172 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1176 p_ptr->update |= (PU_TORCH);
1179 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
1181 /* Forget lite/view */
1182 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1184 /* Update lite/view */
1185 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
1187 /* Update monsters */
1188 p_ptr->update |= (PU_MONSTERS);
1190 /* Redraw everything */
1191 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1194 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
1197 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
1201 /* Hack -- update */
1204 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
1207 /* Redraw every window */
1208 for (j = 0; j < 8; j++)
1211 if (!angband_term[j]) continue;
1214 Term_activate(angband_term[j]);
1229 * Hack -- change name
1231 void do_cmd_change_name(void)
1240 /* Save the screen */
1248 /* Display the player */
1249 display_player(mode);
1254 display_player(mode);
1259 Term_putstr(2, 23, -1, TERM_WHITE,
1260 "['c'¤Ç̾Á°Êѹ¹, 'f'¤Ç¥Õ¥¡¥¤¥ë¤Ø½ñ½Ð, 'h'¤Ç¥â¡¼¥ÉÊѹ¹, ESC¤Ç½ªÎ»]");
1262 Term_putstr(2, 23, -1, TERM_WHITE,
1263 "['c' to change name, 'f' to file, 'h' to change mode, or ESC]");
1271 if (c == ESCAPE) break;
1278 /* Process the player name */
1279 process_player_name(FALSE);
1285 sprintf(tmp, "%s.txt", player_base);
1287 if (get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
1289 if (get_string("File name: ", tmp, 80))
1293 if (tmp[0] && (tmp[0] != ' '))
1295 file_character(tmp);
1312 /* Flush messages */
1316 /* Restore the screen */
1319 /* Redraw everything */
1320 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1327 * Recall the most recent message
1329 void do_cmd_message_one(void)
1331 /* Recall one message XXX XXX XXX */
1332 prt(format("> %s", message_str(0)), 0, 0);
1337 * Show previous messages to the user -BEN-
1339 * The screen format uses line 0 and 23 for headers and prompts,
1340 * skips line 1 and 22, and uses line 2 thru 21 for old messages.
1342 * This command shows you which commands you are viewing, and allows
1343 * you to "search" for strings in the recall.
1345 * Note that messages may be longer than 80 characters, but they are
1346 * displayed using "infinite" length, with a special sub-command to
1347 * "slide" the virtual display to the left or right.
1349 * Attempt to only hilite the matching portions of the string.
1351 void do_cmd_messages(int num_now)
1355 char shower_str[81];
1356 char finder_str[81];
1363 Term_get_size(&wid, &hgt);
1365 /* Number of message lines in a screen */
1366 num_lines = hgt - 4;
1369 strcpy(finder_str, "");
1372 strcpy(shower_str, "");
1374 /* Total messages */
1377 /* Start on first message */
1380 /* Save the screen */
1386 /* Process requests until done */
1392 /* Dump up to 20 lines of messages */
1393 for (j = 0; (j < num_lines) && (i + j < n); j++)
1395 cptr msg = message_str(i+j);
1397 /* Dump the messages, bottom to top */
1398 c_prt((i + j < num_now ? TERM_WHITE : TERM_SLATE), msg, num_lines + 1 - j, 0);
1400 /* Hilite "shower" */
1401 if (shower && shower[0])
1405 /* Display matches */
1406 while ((str = my_strstr(str, shower)) != NULL)
1408 int len = strlen(shower);
1410 /* Display the match */
1411 Term_putstr(str-msg, num_lines + 1 - j, len, TERM_YELLOW, shower);
1419 /* Erase remaining lines */
1420 for (; j < num_lines; j++)
1422 Term_erase(0, num_lines + 1 - j, 255);
1425 /* Display header XXX XXX XXX */
1428 prt(format("°ÊÁ°¤Î¥á¥Ã¥»¡¼¥¸ %d-%d Á´Éô¤Ç(%d)",
1429 i, i + j - 1, n), 0, 0);
1431 prt(format("Message Recall (%d-%d of %d)",
1432 i, i + j - 1, n), 0, 0);
1435 /* Display prompt (not very informative) */
1437 prt("[ 'p' ¤Ç¹¹¤Ë¸Å¤¤¤â¤Î, 'n' ¤Ç¹¹¤Ë¿·¤·¤¤¤â¤Î, '/' ¤Ç¸¡º÷, ESC ¤ÇÃæÃÇ ]", hgt - 1, 0);
1439 prt("[Press 'p' for older, 'n' for newer, ..., or ESCAPE]", hgt - 1, 0);
1443 skey = inkey_special(TRUE);
1445 /* Exit on Escape */
1446 if (skey == ESCAPE) break;
1448 /* Hack -- Save the old index */
1453 /* Hack -- handle show */
1457 prt("¶¯Ä´: ", hgt - 1, 0);
1459 prt("Show: ", hgt - 1, 0);
1462 /* Get a "shower" string, or continue */
1463 strcpy(back_str, shower_str);
1464 if (askfor(shower_str, 80))
1467 shower = shower_str[0] ? shower_str : NULL;
1469 else strcpy(shower_str, back_str);
1474 /* Hack -- handle find */
1482 prt("¸¡º÷: ", hgt - 1, 0);
1484 prt("Find: ", hgt - 1, 0);
1487 /* Get a "finder" string, or continue */
1488 strcpy(back_str, finder_str);
1489 if (!askfor(finder_str, 80))
1491 strcpy(finder_str, back_str);
1494 else if (!finder_str[0])
1496 shower = NULL; /* Stop showing */
1501 shower = finder_str;
1504 for (z = i + 1; z < n; z++)
1506 cptr msg = message_str(z);
1509 if (my_strstr(msg, finder_str))
1521 /* Recall 1 older message */
1523 /* Go to the oldest line */
1527 /* Recall 1 newer message */
1529 /* Go to the newest line */
1533 /* Recall 1 older message */
1538 /* Go older if legal */
1539 i = MIN(i + 1, n - num_lines);
1542 /* Recall 10 older messages */
1544 /* Go older if legal */
1545 i = MIN(i + 10, n - num_lines);
1548 /* Recall 20 older messages */
1553 /* Go older if legal */
1554 i = MIN(i + num_lines, n - num_lines);
1557 /* Recall 20 newer messages */
1561 /* Go newer (if able) */
1562 i = MAX(0, i - num_lines);
1565 /* Recall 10 newer messages */
1567 /* Go newer (if able) */
1571 /* Recall 1 newer messages */
1574 /* Go newer (if able) */
1579 /* Hack -- Error of some kind */
1583 /* Restore the screen */
1590 * Number of cheating options
1597 static option_type cheat_info[CHEAT_MAX] =
1599 { &cheat_peek, FALSE, 255, 0x01, 0x00,
1601 "cheat_peek", "¥¢¥¤¥Æ¥à¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1603 "cheat_peek", "Peek into object creation"
1607 { &cheat_hear, FALSE, 255, 0x02, 0x00,
1609 "cheat_hear", "¥â¥ó¥¹¥¿¡¼¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1611 "cheat_hear", "Peek into monster creation"
1615 { &cheat_room, FALSE, 255, 0x04, 0x00,
1617 "cheat_room", "¥À¥ó¥¸¥ç¥ó¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1619 "cheat_room", "Peek into dungeon creation"
1623 { &cheat_xtra, FALSE, 255, 0x08, 0x00,
1625 "cheat_xtra", "¤½¤Î¾¤Î»ö¤ò¤Î¤¾¤¸«¤ë"
1627 "cheat_xtra", "Peek into something else"
1631 { &cheat_know, FALSE, 255, 0x10, 0x00,
1633 "cheat_know", "´°Á´¤Ê¥â¥ó¥¹¥¿¡¼¤Î»×¤¤½Ð¤òÃΤë"
1635 "cheat_know", "Know complete monster info"
1639 { &cheat_live, FALSE, 255, 0x20, 0x00,
1641 "cheat_live", "»à¤ò²óÈò¤¹¤ë¤³¤È¤ò²Äǽ¤Ë¤¹¤ë"
1643 "cheat_live", "Allow player to avoid death"
1647 { &cheat_save, FALSE, 255, 0x40, 0x00,
1649 "cheat_save", "»à¤ó¤À»þ¥»¡¼¥Ö¤¹¤ë¤«³Îǧ¤¹¤ë"
1651 "cheat_save", "Ask for saving death"
1657 * Interact with some options for cheating
1659 static void do_cmd_options_cheat(cptr info)
1663 int i, k = 0, n = CHEAT_MAX;
1671 /* Interact with the player */
1676 /* Prompt XXX XXX XXX */
1678 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, ESC ¤Ç·èÄê )", info);
1680 sprintf(buf, "%s (RET to advance, y/n to set, ESC to accept) ", info);
1686 /* º¾µ½¥ª¥×¥·¥ç¥ó¤ò¤¦¤Ã¤«¤ê¤¤¤¸¤Ã¤Æ¤·¤Þ¤¦¿Í¤¬¤¤¤ë¤è¤¦¤Ê¤Î¤ÇÃí°Õ */
1687 prt(" << Ãí°Õ >>", 11, 0);
1688 prt(" º¾µ½¥ª¥×¥·¥ç¥ó¤ò°ìÅ٤ǤâÀßÄꤹ¤ë¤È¡¢¥¹¥³¥¢µÏ¿¤¬»Ä¤é¤Ê¤¯¤Ê¤ê¤Þ¤¹¡ª", 12, 0);
1689 prt(" ¸å¤Ë²ò½ü¤·¤Æ¤â¥À¥á¤Ç¤¹¤Î¤Ç¡¢¾¡Íø¼Ô¤òÌܻؤ¹Êý¤Ï¤³¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¤¤", 13, 0);
1690 prt(" ¤¸¤é¤Ê¤¤¤è¤¦¤Ë¤·¤Æ²¼¤µ¤¤¡£", 14, 0);
1692 /* Display the options */
1693 for (i = 0; i < n; i++)
1695 byte a = TERM_WHITE;
1697 /* Color current option */
1698 if (i == k) a = TERM_L_BLUE;
1700 /* Display the option text */
1701 sprintf(buf, "%-48s: %s (%s)",
1702 cheat_info[i].o_desc,
1704 (*cheat_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1706 (*cheat_info[i].o_var ? "yes" : "no "),
1709 cheat_info[i].o_text);
1710 c_prt(a, buf, i + 2, 0);
1713 /* Hilite current option */
1714 move_cursor(k + 2, 50);
1720 * HACK - Try to translate the key into a direction
1721 * to allow using the roguelike keys for navigation.
1723 dir = get_keymap_dir(ch);
1724 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1738 k = (n + k - 1) % n;
1757 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "º¾µ½¥ª¥×¥·¥ç¥ó¤òON¤Ë¤·¤Æ¡¢¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
1759 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use cheating options.");
1761 p_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit);
1762 (*cheat_info[k].o_var) = TRUE;
1771 (*cheat_info[k].o_var) = FALSE;
1779 strnfmt(buf, sizeof(buf), "joption.txt#%s", cheat_info[k].o_text);
1781 strnfmt(buf, sizeof(buf), "option.txt#%s", cheat_info[k].o_text);
1783 /* Peruse the help file */
1784 (void)show_file(TRUE, buf, NULL, 0, 0);
1800 static option_type autosave_info[2] =
1802 { &autosave_l, FALSE, 255, 0x01, 0x00,
1804 "autosave_l", "¿·¤·¤¤³¬¤ËÆþ¤ëÅ٤˼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1806 "autosave_l", "Autosave when entering new levels" },
1810 { &autosave_t, FALSE, 255, 0x02, 0x00,
1812 "autosave_t", "°ìÄ꥿¡¼¥óËè¤Ë¼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1814 "autosave_t", "Timed autosave" },
1820 static s16b toggle_frequency(s16b current)
1825 case 50: return 100;
1826 case 100: return 250;
1827 case 250: return 500;
1828 case 500: return 1000;
1829 case 1000: return 2500;
1830 case 2500: return 5000;
1831 case 5000: return 10000;
1832 case 10000: return 25000;
1839 * Interact with some options for cheating
1841 static void do_cmd_options_autosave(cptr info)
1845 int i, k = 0, n = 2;
1853 /* Interact with the player */
1856 /* Prompt XXX XXX XXX */
1858 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, F ¤ÇÉÑÅÙ¤òÆþÎÏ, ESC ¤Ç·èÄê ) ", info);
1860 sprintf(buf, "%s (RET to advance, y/n to set, 'F' for frequency, ESC to accept) ", info);
1865 /* Display the options */
1866 for (i = 0; i < n; i++)
1868 byte a = TERM_WHITE;
1870 /* Color current option */
1871 if (i == k) a = TERM_L_BLUE;
1873 /* Display the option text */
1874 sprintf(buf, "%-48s: %s (%s)",
1875 autosave_info[i].o_desc,
1877 (*autosave_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1879 (*autosave_info[i].o_var ? "yes" : "no "),
1882 autosave_info[i].o_text);
1883 c_prt(a, buf, i + 2, 0);
1887 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè", autosave_freq), 5, 0);
1889 prt(format("Timed autosave frequency: every %d turns", autosave_freq), 5, 0);
1894 /* Hilite current option */
1895 move_cursor(k + 2, 50);
1911 k = (n + k - 1) % n;
1929 (*autosave_info[k].o_var) = TRUE;
1938 (*autosave_info[k].o_var) = FALSE;
1946 autosave_freq = toggle_frequency(autosave_freq);
1948 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè",
1949 autosave_freq), 5, 0);
1951 prt(format("Timed autosave frequency: every %d turns",
1952 autosave_freq), 5, 0);
1960 (void)show_file(TRUE, "joption.txt#Autosave", NULL, 0, 0);
1962 (void)show_file(TRUE, "option.txt#Autosave", NULL, 0, 0);
1981 * Interact with some options
1983 void do_cmd_options_aux(int page, cptr info)
1986 int i, k = 0, n = 0, l;
1989 bool browse_only = (page == OPT_PAGE_BIRTH) && character_generated &&
1990 (!p_ptr->wizard || !allow_debug_opts);
1993 /* Lookup the options */
1994 for (i = 0; i < 24; i++) opt[i] = 0;
1996 /* Scan the options */
1997 for (i = 0; option_info[i].o_desc; i++)
1999 /* Notice options on this "page" */
2000 if (option_info[i].o_page == page) opt[n++] = i;
2007 /* Interact with the player */
2012 /* Prompt XXX XXX XXX */
2014 sprintf(buf, "%s (¥ê¥¿¡¼¥ó:¼¡, %sESC:½ªÎ», ?:¥Ø¥ë¥×) ", info, browse_only ? "" : "y/n:Êѹ¹, ");
2016 sprintf(buf, "%s (RET:next, %s, ?:help) ", info, browse_only ? "ESC:exit" : "y/n:change, ESC:accept");
2022 /* HACK -- description for easy-auto-destroy options */
2024 if (page == OPT_PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "°Ê²¼¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢´Ê°×¼«Æ°Ç˲õ¤ò»ÈÍѤ¹¤ë¤È¤¤Î¤ß͸ú", 6, 6);
2026 if (page == OPT_PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "Following options will protect items from easy auto-destroyer.", 6, 3);
2029 /* Display the options */
2030 for (i = 0; i < n; i++)
2032 byte a = TERM_WHITE;
2034 /* Color current option */
2035 if (i == k) a = TERM_L_BLUE;
2037 /* Display the option text */
2038 sprintf(buf, "%-48s: %s (%.19s)",
2039 option_info[opt[i]].o_desc,
2041 (*option_info[opt[i]].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
2043 (*option_info[opt[i]].o_var ? "yes" : "no "),
2046 option_info[opt[i]].o_text);
2047 if ((page == OPT_PAGE_AUTODESTROY) && i > 2) c_prt(a, buf, i + 5, 0);
2048 else c_prt(a, buf, i + 2, 0);
2051 if ((page == OPT_PAGE_AUTODESTROY) && (k > 2)) l = 3;
2054 /* Hilite current option */
2055 move_cursor(k + 2 + l, 50);
2061 * HACK - Try to translate the key into a direction
2062 * to allow using the roguelike keys for navigation.
2064 dir = get_keymap_dir(ch);
2065 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
2079 k = (n + k - 1) % n;
2096 if (browse_only) break;
2097 (*option_info[opt[k]].o_var) = TRUE;
2106 if (browse_only) break;
2107 (*option_info[opt[k]].o_var) = FALSE;
2115 if (!browse_only) (*option_info[opt[k]].o_var) = !(*option_info[opt[k]].o_var);
2122 strnfmt(buf, sizeof(buf), "joption.txt#%s", option_info[opt[k]].o_text);
2124 strnfmt(buf, sizeof(buf), "option.txt#%s", option_info[opt[k]].o_text);
2126 /* Peruse the help file */
2127 (void)show_file(TRUE, buf, NULL, 0, 0);
2144 * Modify the "window" options
2146 static void do_cmd_options_win(void)
2160 /* Memorize old flags */
2161 for (j = 0; j < 8; j++)
2163 /* Acquire current flags */
2164 old_flag[j] = window_flag[j];
2174 /* Prompt XXX XXX XXX */
2176 prt("¥¦¥£¥ó¥É¥¦¡¦¥Õ¥é¥° (<Êý¸þ>¤Ç°ÜÆ°, t¤Ç¥Á¥§¥ó¥¸, y/n ¤Ç¥»¥Ã¥È, ESC)", 0, 0);
2178 prt("Window Flags (<dir>, t, y, n, ESC) ", 0, 0);
2182 /* Display the windows */
2183 for (j = 0; j < 8; j++)
2185 byte a = TERM_WHITE;
2187 cptr s = angband_term_name[j];
2190 if (j == x) a = TERM_L_BLUE;
2192 /* Window name, staggered, centered */
2193 Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s);
2196 /* Display the options */
2197 for (i = 0; i < 16; i++)
2199 byte a = TERM_WHITE;
2201 cptr str = window_flag_desc[i];
2204 if (i == y) a = TERM_L_BLUE;
2208 if (!str) str = "(̤»ÈÍÑ)";
2210 if (!str) str = "(Unused option)";
2215 Term_putstr(0, i + 5, -1, a, str);
2217 /* Display the windows */
2218 for (j = 0; j < 8; j++)
2220 byte a = TERM_WHITE;
2225 if ((i == y) && (j == x)) a = TERM_L_BLUE;
2228 if (window_flag[j] & (1L << i)) c = 'X';
2231 Term_putch(35 + j * 5, i + 5, a, c);
2236 Term_gotoxy(35 + x * 5, y + 5);
2254 for (j = 0; j < 8; j++)
2256 window_flag[j] &= ~(1L << y);
2260 for (i = 0; i < 16; i++)
2262 window_flag[x] &= ~(1L << i);
2275 window_flag[x] |= (1L << y);
2283 window_flag[x] &= ~(1L << y);
2290 (void)show_file(TRUE, "joption.txt#Window", NULL, 0, 0);
2292 (void)show_file(TRUE, "option.txt#Window", NULL, 0, 0);
2302 d = get_keymap_dir(ch);
2304 x = (x + ddx[d] + 8) % 8;
2305 y = (y + ddy[d] + 16) % 16;
2312 /* Notice changes */
2313 for (j = 0; j < 8; j++)
2318 if (!angband_term[j]) continue;
2320 /* Ignore non-changes */
2321 if (window_flag[j] == old_flag[j]) continue;
2324 Term_activate(angband_term[j]);
2347 option_fields[OPT_NUM] =
2350 { '1', " ¥¡¼ÆþÎÏ ¥ª¥×¥·¥ç¥ó", 3 },
2351 { '2', " ¥Þ¥Ã¥×²èÌÌ ¥ª¥×¥·¥ç¥ó", 4 },
2352 { '3', " ¥Æ¥¥¹¥Èɽ¼¨ ¥ª¥×¥·¥ç¥ó", 5 },
2353 { '4', " ¥²¡¼¥à¥×¥ì¥¤ ¥ª¥×¥·¥ç¥ó", 6 },
2354 { '5', " ¹ÔÆ°Ãæ»ß´Ø·¸ ¥ª¥×¥·¥ç¥ó", 7 },
2355 { '6', " ´Ê°×¼«Æ°Ç˲õ ¥ª¥×¥·¥ç¥ó", 8 },
2356 { 'r', " ¥×¥ì¥¤µÏ¿ ¥ª¥×¥·¥ç¥ó", 9 },
2358 { 'p', "¼«Æ°½¦¤¤¥¨¥Ç¥£¥¿", 11 },
2359 { 'd', " ´ðËÜ¥¦¥§¥¤¥ÈÎÌ ", 12 },
2360 { 'h', "Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È", 13 },
2361 { 'm', " ÄãËâÎÏ¿§ïçÃÍ ", 14 },
2362 { 'a', " ¼«Æ°¥»¡¼¥Ö ¥ª¥×¥·¥ç¥ó", 15 },
2363 { 'w', "¥¦¥¤¥ó¥É¥¦¥Õ¥é¥°", 16 },
2365 { 'b', " ½é´ü ¥ª¥×¥·¥ç¥ó (»²¾È¤Î¤ß)", 18 },
2366 { 'c', " º¾µ½ ¥ª¥×¥·¥ç¥ó", 19 },
2368 { '1', "Input Options", 3 },
2369 { '2', "Map Screen Options", 4 },
2370 { '3', "Text Display Options", 5 },
2371 { '4', "Game-Play Options", 6 },
2372 { '5', "Disturbance Options", 7 },
2373 { '6', "Easy Auto-Destroyer Options", 8 },
2374 { 'r', "Play record Options", 9 },
2376 { 'p', "Auto-picker/destroyer editor", 11 },
2377 { 'd', "Base Delay Factor", 12 },
2378 { 'h', "Hitpoint Warning", 13 },
2379 { 'm', "Mana Color Threshold", 14 },
2380 { 'a', "Autosave Options", 15 },
2381 { 'w', "Window Flags", 16 },
2383 { 'b', "Birth Options (Browse Only)", 18 },
2384 { 'c', "Cheat Options", 19 },
2390 * Set or unset various options.
2392 * The user must use the "Ctrl-R" command to "adapt" to changes
2393 * in any options which control "visual" aspects of the game.
2395 void do_cmd_options(void)
2401 /* Save the screen */
2409 /* Does not list cheat option when cheat option is off */
2410 if (!p_ptr->noscore && !allow_debug_opts) n--;
2415 /* Why are we here */
2417 prt("[ ¥ª¥×¥·¥ç¥ó¤ÎÀßÄê ]", 1, 0);
2419 prt("TinyAngband options", 1, 0);
2424 /* Give some choices */
2425 for (i = 0; i < n; i++)
2427 byte a = TERM_WHITE;
2428 if (i == y) a = TERM_L_BLUE;
2429 Term_putstr(5, option_fields[i].row, -1, a,
2430 format("(%c) %s", toupper(option_fields[i].key), option_fields[i].name));
2434 prt("<Êý¸þ>¤Ç°ÜÆ°, Enter¤Ç·èÄê, ESC¤Ç¥¥ã¥ó¥»¥ë, ?¤Ç¥Ø¥ë¥×: ", 21, 0);
2436 prt("Move to <dir>, Select to Enter, Cancel to ESC, ? to help: ", 21, 0);
2440 skey = inkey_special(TRUE);
2441 if (!(skey & SKEY_MASK)) k = (char)skey;
2445 if (k == ESCAPE) break;
2447 if (my_strchr("\n\r ", k))
2449 k = option_fields[y].key;
2453 for (i = 0; i < n; i++)
2455 if (tolower(k) == option_fields[i].key) break;
2458 /* Command is found */
2461 /* Hack -- browse help */
2462 if (k == '?') break;
2466 if (skey == SKEY_UP) d = 8;
2467 if (skey == SKEY_DOWN) d = 2;
2468 y = (y + ddy[d] + n) % n;
2473 if (k == ESCAPE) break;
2480 /* Process the general options */
2482 do_cmd_options_aux(OPT_PAGE_INPUT, "¥¡¼ÆþÎÏ¥ª¥×¥·¥ç¥ó");
2484 do_cmd_options_aux(OPT_PAGE_INPUT, "Input Options");
2491 /* Process the general options */
2493 do_cmd_options_aux(OPT_PAGE_MAPSCREEN, "¥Þ¥Ã¥×²èÌÌ¥ª¥×¥·¥ç¥ó");
2495 do_cmd_options_aux(OPT_PAGE_MAPSCREEN, "Map Screen Options");
2504 do_cmd_options_aux(OPT_PAGE_TEXT, "¥Æ¥¥¹¥Èɽ¼¨¥ª¥×¥·¥ç¥ó");
2506 do_cmd_options_aux(OPT_PAGE_TEXT, "Text Display Options");
2515 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, "¥²¡¼¥à¥×¥ì¥¤¡¦¥ª¥×¥·¥ç¥ó");
2517 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, "Game-Play Options");
2526 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, "¹ÔÆ°Ãæ»ß´Ø·¸¤Î¥ª¥×¥·¥ç¥ó");
2528 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, "Disturbance Options");
2537 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, "´Ê°×¼«Æ°Ç˲õ¥ª¥×¥·¥ç¥ó");
2539 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, "Easy Auto-Destroyer Options");
2544 /* Play-record Options */
2550 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, "¥×¥ì¥¤µÏ¿¥ª¥×¥·¥ç¥ó");
2552 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, "Play-record Options");
2563 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ? "½é´ü¥ª¥×¥·¥ç¥ó(»²¾È¤Î¤ß)" : "½é´ü¥ª¥×¥·¥ç¥ó((*)¤Ï¥¹¥³¥¢¤Ë±Æ¶Á)");
2565 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ? "Birth Options(browse only)" : "Birth Options((*)s effect score)");
2570 /* Cheating Options */
2573 if (!p_ptr->noscore && !allow_debug_opts)
2575 /* Cheat options are not permitted */
2582 do_cmd_options_cheat("º¾µ½»Õ¤Ï·è¤·¤Æ¾¡Íø¤Ç¤¤Ê¤¤¡ª");
2584 do_cmd_options_cheat("Cheaters never win");
2593 do_cmd_options_autosave("¼«Æ°¥»¡¼¥Ö");
2595 do_cmd_options_autosave("Autosave");
2605 do_cmd_options_win();
2606 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL |
2607 PW_PLAYER | PW_MESSAGE | PW_OVERHEAD |
2608 PW_MONSTER | PW_OBJECT | PW_SNAPSHOT |
2609 PW_BORG_1 | PW_BORG_2 | PW_DUNGEON |
2614 /* Auto-picker/destroyer editor */
2618 do_cmd_edit_autopick();
2622 /* Hack -- Delay Speed */
2629 prt("¥³¥Þ¥ó¥É: ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 19, 0);
2631 prt("Command: Base Delay Factor", 19, 0);
2634 /* Get a new value */
2637 int msec = delay_factor * delay_factor * delay_factor;
2639 prt(format("¸½ºß¤Î¥¦¥§¥¤¥È: %d (%d¥ß¥êÉÃ)",
2640 delay_factor, msec), 22, 0);
2642 prt(format("Current base delay factor: %d (%d msec)",
2643 delay_factor, msec), 22, 0);
2647 prt("¥¦¥§¥¤¥È (0-9) ESC¤Ç·èÄê: ", 20, 0);
2649 prt("Delay Factor (0-9 or ESC to accept): ", 20, 0);
2653 if (k == ESCAPE) break;
2657 (void)show_file(TRUE, "joption.txt#BaseDelay", NULL, 0, 0);
2659 (void)show_file(TRUE, "option.txt#BaseDelay", NULL, 0, 0);
2663 else if (isdigit(k)) delay_factor = D2I(k);
2670 /* Hack -- hitpoint warning factor */
2677 prt("¥³¥Þ¥ó¥É: Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 19, 0);
2679 prt("Command: Hitpoint Warning", 19, 0);
2682 /* Get a new value */
2686 prt(format("¸½ºß¤ÎÄã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð: %d0%%",
2687 hitpoint_warn), 22, 0);
2689 prt(format("Current hitpoint warning: %d0%%",
2690 hitpoint_warn), 22, 0);
2694 prt("Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð (0-9) ESC¤Ç·èÄê: ", 20, 0);
2696 prt("Hitpoint Warning (0-9 or ESC to accept): ", 20, 0);
2700 if (k == ESCAPE) break;
2704 (void)show_file(TRUE, "joption.txt#Hitpoint", NULL, 0, 0);
2706 (void)show_file(TRUE, "option.txt#Hitpoint", NULL, 0, 0);
2710 else if (isdigit(k)) hitpoint_warn = D2I(k);
2717 /* Hack -- mana color factor */
2724 prt("¥³¥Þ¥ó¥É: ÄãËâÎÏ¿§ïçÃÍ", 19, 0);
2726 prt("Command: Mana Color Threshold", 19, 0);
2729 /* Get a new value */
2733 prt(format("¸½ºß¤ÎÄãËâÎÏ¿§ïçÃÍ: %d0%%",
2736 prt(format("Current mana color threshold: %d0%%",
2741 prt("ÄãËâÎÏïçÃÍ (0-9) ESC¤Ç·èÄê: ", 20, 0);
2743 prt("Mana color Threshold (0-9 or ESC to accept): ", 20, 0);
2747 if (k == ESCAPE) break;
2751 (void)show_file(TRUE, "joption.txt#Manapoint", NULL, 0, 0);
2753 (void)show_file(TRUE, "option.txt#Manapoint", NULL, 0, 0);
2757 else if (isdigit(k)) mana_warn = D2I(k);
2766 (void)show_file(TRUE, "joption.txt", NULL, 0, 0);
2768 (void)show_file(TRUE, "option.txt", NULL, 0, 0);
2773 /* Unknown option */
2782 /* Flush messages */
2787 /* Restore the screen */
2790 /* Hack - Redraw equippy chars */
2791 p_ptr->redraw |= (PR_EQUIPPY);
2797 * Ask for a "user pref line" and process it
2799 * XXX XXX XXX Allow absolute file names?
2801 void do_cmd_pref(void)
2808 /* Ask for a "user pref command" */
2810 if (!get_string("ÀßÄêÊѹ¹¥³¥Þ¥ó¥É: ", buf, 80)) return;
2812 if (!get_string("Pref: ", buf, 80)) return;
2816 /* Process that pref command */
2817 (void)process_pref_file_command(buf);
2820 void do_cmd_reload_autopick(void)
2823 if (!get_check("¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹¤«? ")) return;
2825 if (!get_check("Reload auto-pick preference file? ")) return;
2828 /* Load the file with messages */
2829 autopick_load_pref(TRUE);
2835 * Hack -- append all current macros to the given file
2837 static errr macro_dump(cptr fname)
2839 static cptr mark = "Macro Dump";
2845 /* Build the filename */
2846 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2848 /* File type is "TEXT" */
2849 FILE_TYPE(FILE_TYPE_TEXT);
2851 /* Append to the file */
2852 if (!open_auto_dump(buf, mark)) return (-1);
2856 auto_dump_printf("\n# ¼«Æ°¥Þ¥¯¥í¥»¡¼¥Ö\n\n");
2858 auto_dump_printf("\n# Automatic macro dump\n\n");
2862 for (i = 0; i < macro__num; i++)
2864 /* Extract the action */
2865 ascii_to_text(buf, macro__act[i]);
2867 /* Dump the macro */
2868 auto_dump_printf("A:%s\n", buf);
2870 /* Extract the action */
2871 ascii_to_text(buf, macro__pat[i]);
2873 /* Dump normal macros */
2874 auto_dump_printf("P:%s\n", buf);
2877 auto_dump_printf("\n");
2889 * Hack -- ask for a "trigger" (see below)
2891 * Note the complex use of the "inkey()" function from "util.c".
2893 * Note that both "flush()" calls are extremely important.
2895 static void do_cmd_macro_aux(char *buf)
2905 /* Do not process macros */
2911 /* Read the pattern */
2917 /* Do not process macros */
2920 /* Do not wait for keys */
2923 /* Attempt to read a key */
2934 /* Convert the trigger */
2935 ascii_to_text(tmp, buf);
2937 /* Hack -- display the trigger */
2938 Term_addstr(-1, TERM_WHITE, tmp);
2945 * Hack -- ask for a keymap "trigger" (see below)
2947 * Note that both "flush()" calls are extremely important. This may
2948 * no longer be true, since "util.c" is much simpler now. XXX XXX XXX
2950 static void do_cmd_macro_aux_keymap(char *buf)
2964 /* Convert to ascii */
2965 ascii_to_text(tmp, buf);
2967 /* Hack -- display the trigger */
2968 Term_addstr(-1, TERM_WHITE, tmp);
2977 * Hack -- append all keymaps to the given file
2979 static errr keymap_dump(cptr fname)
2981 static cptr mark = "Keymap Dump";
2990 if (rogue_like_commands)
2992 mode = KEYMAP_MODE_ROGUE;
2998 mode = KEYMAP_MODE_ORIG;
3002 /* Build the filename */
3003 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
3005 /* File type is "TEXT" */
3006 FILE_TYPE(FILE_TYPE_TEXT);
3008 /* Append to the file */
3009 if (!open_auto_dump(buf, mark)) return -1;
3013 auto_dump_printf("\n# ¼«Æ°¥¡¼ÇÛÃÖ¥»¡¼¥Ö\n\n");
3015 auto_dump_printf("\n# Automatic keymap dump\n\n");
3019 for (i = 0; i < 256; i++)
3023 /* Loop up the keymap */
3024 act = keymap_act[mode][i];
3026 /* Skip empty keymaps */
3029 /* Encode the key */
3032 ascii_to_text(key, buf);
3034 /* Encode the action */
3035 ascii_to_text(buf, act);
3037 /* Dump the macro */
3038 auto_dump_printf("A:%s\n", buf);
3039 auto_dump_printf("C:%d:%s\n", mode, key);
3052 * Interact with "macros"
3054 * Note that the macro "action" must be defined before the trigger.
3056 * Could use some helpful instructions on this page. XXX XXX XXX
3058 void do_cmd_macros(void)
3070 if (rogue_like_commands)
3072 mode = KEYMAP_MODE_ROGUE;
3078 mode = KEYMAP_MODE_ORIG;
3081 /* File type is "TEXT" */
3082 FILE_TYPE(FILE_TYPE_TEXT);
3089 /* Process requests until done */
3097 prt("[ ¥Þ¥¯¥í¤ÎÀßÄê ]", 2, 0);
3099 prt("Interact with Macros", 2, 0);
3104 /* Describe that action */
3106 prt("¥Þ¥¯¥í¹ÔÆ°¤¬(¤â¤·¤¢¤ì¤Ð)²¼¤Ëɽ¼¨¤µ¤ì¤Þ¤¹:", 20, 0);
3108 prt("Current action (if any) shown below:", 20, 0);
3112 /* Analyze the current action */
3113 ascii_to_text(buf, macro__buf);
3115 /* Display the current action */
3121 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
3123 prt("(1) Load a user pref file", 4, 5);
3128 prt("(2) ¥Õ¥¡¥¤¥ë¤Ë¥Þ¥¯¥í¤òÄɲÃ", 5, 5);
3129 prt("(3) ¥Þ¥¯¥í¤Î³Îǧ", 6, 5);
3130 prt("(4) ¥Þ¥¯¥í¤ÎºîÀ®", 7, 5);
3131 prt("(5) ¥Þ¥¯¥í¤Îºï½ü", 8, 5);
3132 prt("(6) ¥Õ¥¡¥¤¥ë¤Ë¥¡¼ÇÛÃÖ¤òÄɲÃ", 9, 5);
3133 prt("(7) ¥¡¼ÇÛÃ֤γÎǧ", 10, 5);
3134 prt("(8) ¥¡¼ÇÛÃ֤κîÀ®", 11, 5);
3135 prt("(9) ¥¡¼ÇÛÃ֤κï½ü", 12, 5);
3136 prt("(0) ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 13, 5);
3138 prt("(2) Append macros to a file", 5, 5);
3139 prt("(3) Query a macro", 6, 5);
3140 prt("(4) Create a macro", 7, 5);
3141 prt("(5) Remove a macro", 8, 5);
3142 prt("(6) Append keymaps to a file", 9, 5);
3143 prt("(7) Query a keymap", 10, 5);
3144 prt("(8) Create a keymap", 11, 5);
3145 prt("(9) Remove a keymap", 12, 5);
3146 prt("(0) Enter a new action", 13, 5);
3149 #endif /* ALLOW_MACROS */
3153 prt("¥³¥Þ¥ó¥É: ", 16, 0);
3155 prt("Command: ", 16, 0);
3163 if (i == ESCAPE) break;
3165 /* Load a 'macro' file */
3172 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 16, 0);
3174 prt("Command: Load a user pref file", 16, 0);
3180 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3182 prt("File: ", 18, 0);
3186 /* Default filename */
3187 sprintf(tmp, "%s.prf", player_base);
3189 /* Ask for a file */
3190 if (!askfor(tmp, 80)) continue;
3192 /* Process the given filename */
3193 err = process_pref_file(tmp);
3197 msg_format("ɸ½à¤ÎÀßÄê¥Õ¥¡¥¤¥ë'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3199 msg_format("Loaded default '%s'.", tmp);
3206 msg_format("'%s'¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡ª", tmp);
3208 msg_format("Failed to load '%s'!");
3214 msg_format("'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3216 msg_format("Loaded '%s'.", tmp);
3228 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3230 prt("Command: Append macros to a file", 16, 0);
3236 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3238 prt("File: ", 18, 0);
3242 /* Default filename */
3243 sprintf(tmp, "%s.prf", player_base);
3245 /* Ask for a file */
3246 if (!askfor(tmp, 80)) continue;
3248 /* Dump the macros */
3249 (void)macro_dump(tmp);
3253 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3255 msg_print("Appended macros.");
3267 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Î³Îǧ", 16, 0);
3269 prt("Command: Query a macro", 16, 0);
3275 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3277 prt("Trigger: ", 18, 0);
3281 /* Get a macro trigger */
3282 do_cmd_macro_aux(buf);
3284 /* Acquire action */
3285 k = macro_find_exact(buf);
3292 msg_print("¤½¤Î¥¡¼¤Ë¤Ï¥Þ¥¯¥í¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3294 msg_print("Found no macro.");
3302 /* Obtain the action */
3303 strcpy(macro__buf, macro__act[k]);
3305 /* Analyze the current action */
3306 ascii_to_text(buf, macro__buf);
3308 /* Display the current action */
3313 msg_print("¥Þ¥¯¥í¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3315 msg_print("Found a macro.");
3321 /* Create a macro */
3326 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ÎºîÀ®", 16, 0);
3328 prt("Command: Create a macro", 16, 0);
3334 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3336 prt("Trigger: ", 18, 0);
3340 /* Get a macro trigger */
3341 do_cmd_macro_aux(buf);
3348 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3350 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3355 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3357 prt("Action: ", 20, 0);
3361 /* Convert to text */
3362 ascii_to_text(tmp, macro__buf);
3364 /* Get an encoded action */
3365 if (askfor(tmp, 80))
3367 /* Convert to ascii */
3368 text_to_ascii(macro__buf, tmp);
3370 /* Link the macro */
3371 macro_add(buf, macro__buf);
3375 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3377 msg_print("Added a macro.");
3383 /* Remove a macro */
3388 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Îºï½ü", 16, 0);
3390 prt("Command: Remove a macro", 16, 0);
3396 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3398 prt("Trigger: ", 18, 0);
3402 /* Get a macro trigger */
3403 do_cmd_macro_aux(buf);
3405 /* Link the macro */
3406 macro_add(buf, buf);
3410 msg_print("¥Þ¥¯¥í¤òºï½ü¤·¤Þ¤·¤¿¡£");
3412 msg_print("Removed a macro.");
3422 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃÖ¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3424 prt("Command: Append keymaps to a file", 16, 0);
3430 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3432 prt("File: ", 18, 0);
3436 /* Default filename */
3437 sprintf(tmp, "%s.prf", player_base);
3439 /* Ask for a file */
3440 if (!askfor(tmp, 80)) continue;
3442 /* Dump the macros */
3443 (void)keymap_dump(tmp);
3447 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3449 msg_print("Appended keymaps.");
3454 /* Query a keymap */
3461 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤γÎǧ", 16, 0);
3463 prt("Command: Query a keymap", 16, 0);
3469 prt("²¡¤¹¥¡¼: ", 18, 0);
3471 prt("Keypress: ", 18, 0);
3475 /* Get a keymap trigger */
3476 do_cmd_macro_aux_keymap(buf);
3478 /* Look up the keymap */
3479 act = keymap_act[mode][(byte)(buf[0])];
3486 msg_print("¥¡¼ÇÛÃÖ¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3488 msg_print("Found no keymap.");
3496 /* Obtain the action */
3497 strcpy(macro__buf, act);
3499 /* Analyze the current action */
3500 ascii_to_text(buf, macro__buf);
3502 /* Display the current action */
3507 msg_print("¥¡¼ÇÛÃÖ¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3509 msg_print("Found a keymap.");
3515 /* Create a keymap */
3520 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κîÀ®", 16, 0);
3522 prt("Command: Create a keymap", 16, 0);
3528 prt("²¡¤¹¥¡¼: ", 18, 0);
3530 prt("Keypress: ", 18, 0);
3534 /* Get a keymap trigger */
3535 do_cmd_macro_aux_keymap(buf);
3542 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3544 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3549 prt("¹ÔÆ°: ", 20, 0);
3551 prt("Action: ", 20, 0);
3555 /* Convert to text */
3556 ascii_to_text(tmp, macro__buf);
3558 /* Get an encoded action */
3559 if (askfor(tmp, 80))
3561 /* Convert to ascii */
3562 text_to_ascii(macro__buf, tmp);
3564 /* Free old keymap */
3565 string_free(keymap_act[mode][(byte)(buf[0])]);
3567 /* Make new keymap */
3568 keymap_act[mode][(byte)(buf[0])] = string_make(macro__buf);
3572 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3574 msg_print("Added a keymap.");
3580 /* Remove a keymap */
3585 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κï½ü", 16, 0);
3587 prt("Command: Remove a keymap", 16, 0);
3593 prt("²¡¤¹¥¡¼: ", 18, 0);
3595 prt("Keypress: ", 18, 0);
3599 /* Get a keymap trigger */
3600 do_cmd_macro_aux_keymap(buf);
3602 /* Free old keymap */
3603 string_free(keymap_act[mode][(byte)(buf[0])]);
3605 /* Make new keymap */
3606 keymap_act[mode][(byte)(buf[0])] = NULL;
3610 msg_print("¥¡¼ÇÛÃÖ¤òºï½ü¤·¤Þ¤·¤¿¡£");
3612 msg_print("Removed a keymap.");
3617 /* Enter a new action */
3622 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 16, 0);
3624 prt("Command: Enter a new action", 16, 0);
3632 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3634 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3639 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3641 prt("Action: ", 20, 0);
3644 /* Hack -- limit the value */
3647 /* Get an encoded action */
3648 if (!askfor(buf, 80)) continue;
3650 /* Extract an action */
3651 text_to_ascii(macro__buf, buf);
3654 #endif /* ALLOW_MACROS */
3663 /* Flush messages */
3672 static cptr lighting_level_str[F_LIT_MAX] =
3686 static bool cmd_visuals_aux(int i, int *num, int max)
3693 sprintf(str, "%d", *num);
3695 if (!get_string(format("Input new number(0-%d): ", max-1), str, 4))
3698 tmp = strtol(str, NULL, 0);
3699 if (tmp >= 0 && tmp < max)
3702 else if (isupper(i))
3703 *num = (*num + max - 1) % max;
3705 *num = (*num + 1) % max;
3710 static void print_visuals_menu(cptr choice_msg)
3713 prt("[ ²èÌÌɽ¼¨¤ÎÀßÄê ]", 1, 0);
3715 prt("Interact with Visuals", 1, 0);
3718 /* Give some choices */
3720 prt("(0) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 3, 5);
3722 prt("(0) Load a user pref file", 3, 5);
3725 #ifdef ALLOW_VISUALS
3727 prt("(1) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 4, 5);
3728 prt("(2) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
3729 prt("(3) ÃÏ·Á¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 6, 5);
3730 prt("(4) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 7, 5);
3731 prt("(5) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 8, 5);
3732 prt("(6) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 9, 5);
3733 prt("(7) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 10, 5);
3734 prt("(8) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 11, 5);
3735 prt("(9) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 12, 5);
3737 prt("(1) Dump monster attr/chars", 4, 5);
3738 prt("(2) Dump object attr/chars", 5, 5);
3739 prt("(3) Dump feature attr/chars", 6, 5);
3740 prt("(4) Change monster attr/chars (numeric operation)", 7, 5);
3741 prt("(5) Change object attr/chars (numeric operation)", 8, 5);
3742 prt("(6) Change feature attr/chars (numeric operation)", 9, 5);
3743 prt("(7) Change monster attr/chars (visual mode)", 10, 5);
3744 prt("(8) Change object attr/chars (visual mode)", 11, 5);
3745 prt("(9) Change feature attr/chars (visual mode)", 12, 5);
3748 #endif /* ALLOW_VISUALS */
3751 prt("(R) ²èÌÌɽ¼¨ÊýË¡¤Î½é´ü²½", 13, 5);
3753 prt("(R) Reset visuals", 13, 5);
3758 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg ? choice_msg : ""), 15, 0);
3760 prt(format("Command: %s", choice_msg ? choice_msg : ""), 15, 0);
3764 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, int direct_r_idx);
3765 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int direct_k_idx);
3766 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int direct_f_idx, int *lighting_level);
3769 * Interact with "visuals"
3771 void do_cmd_visuals(void)
3776 bool need_redraw = FALSE;
3777 const char *empty_symbol = "<< ? >>";
3779 if (use_bigtile) empty_symbol = "<< ?? >>";
3781 /* File type is "TEXT" */
3782 FILE_TYPE(FILE_TYPE_TEXT);
3784 /* Save the screen */
3787 /* Interact until done */
3793 /* Ask for a choice */
3794 print_visuals_menu(NULL);
3800 if (i == ESCAPE) break;
3804 /* Load a 'pref' file */
3808 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 15, 0);
3810 prt("Command: Load a user pref file", 15, 0);
3815 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3817 prt("File: ", 17, 0);
3820 /* Default filename */
3821 sprintf(tmp, "%s.prf", player_base);
3824 if (!askfor(tmp, 70)) continue;
3826 /* Process the given filename */
3827 (void)process_pref_file(tmp);
3832 #ifdef ALLOW_VISUALS
3834 /* Dump monster attr/chars */
3837 static cptr mark = "Monster attr/chars";
3841 prt("¥³¥Þ¥ó¥É: ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3843 prt("Command: Dump monster attr/chars", 15, 0);
3848 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3850 prt("File: ", 17, 0);
3853 /* Default filename */
3854 sprintf(tmp, "%s.prf", player_base);
3856 /* Get a filename */
3857 if (!askfor(tmp, 70)) continue;
3859 /* Build the filename */
3860 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3862 /* Append to the file */
3863 if (!open_auto_dump(buf, mark)) continue;
3867 auto_dump_printf("\n# ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3869 auto_dump_printf("\n# Monster attr/char definitions\n\n");
3873 for (i = 0; i < max_r_idx; i++)
3875 monster_race *r_ptr = &r_info[i];
3877 /* Skip non-entries */
3878 if (!r_ptr->name) continue;
3880 /* Dump a comment */
3881 auto_dump_printf("# %s\n", (r_name + r_ptr->name));
3883 /* Dump the monster attr/char info */
3884 auto_dump_printf("R:%d:0x%02X/0x%02X\n\n", i,
3885 (byte)(r_ptr->x_attr), (byte)(r_ptr->x_char));
3893 msg_print("¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3895 msg_print("Dumped monster attr/chars.");
3901 /* Dump object attr/chars */
3904 static cptr mark = "Object attr/chars";
3908 prt("¥³¥Þ¥ó¥É: ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3910 prt("Command: Dump object attr/chars", 15, 0);
3915 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3917 prt("File: ", 17, 0);
3920 /* Default filename */
3921 sprintf(tmp, "%s.prf", player_base);
3923 /* Get a filename */
3924 if (!askfor(tmp, 70)) continue;
3926 /* Build the filename */
3927 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3929 /* Append to the file */
3930 if (!open_auto_dump(buf, mark)) continue;
3934 auto_dump_printf("\n# ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3936 auto_dump_printf("\n# Object attr/char definitions\n\n");
3940 for (i = 0; i < max_k_idx; i++)
3943 object_kind *k_ptr = &k_info[i];
3945 /* Skip non-entries */
3946 if (!k_ptr->name) continue;
3951 strip_name(o_name, i);
3957 /* Prepare dummy object */
3958 object_prep(&forge, i);
3960 /* Get un-shuffled flavor name */
3961 object_desc(o_name, &forge, OD_FORCE_FLAVOR);
3964 /* Dump a comment */
3965 auto_dump_printf("# %s\n", o_name);
3967 /* Dump the object attr/char info */
3968 auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", i,
3969 (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char));
3977 msg_print("¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3979 msg_print("Dumped object attr/chars.");
3985 /* Dump feature attr/chars */
3988 static cptr mark = "Feature attr/chars";
3992 prt("¥³¥Þ¥ó¥É: ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3994 prt("Command: Dump feature attr/chars", 15, 0);
3999 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
4001 prt("File: ", 17, 0);
4004 /* Default filename */
4005 sprintf(tmp, "%s.prf", player_base);
4007 /* Get a filename */
4008 if (!askfor(tmp, 70)) continue;
4010 /* Build the filename */
4011 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
4013 /* Append to the file */
4014 if (!open_auto_dump(buf, mark)) continue;
4018 auto_dump_printf("\n# ÃÏ·Á¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
4020 auto_dump_printf("\n# Feature attr/char definitions\n\n");
4024 for (i = 0; i < max_f_idx; i++)
4026 feature_type *f_ptr = &f_info[i];
4028 /* Skip non-entries */
4029 if (!f_ptr->name) continue;
4031 /* Skip mimiccing features */
4032 if (f_ptr->mimic != i) continue;
4034 /* Dump a comment */
4035 auto_dump_printf("# %s\n", (f_name + f_ptr->name));
4037 /* Dump the feature attr/char info */
4038 auto_dump_printf("F:%d:0x%02X/0x%02X:0x%02X/0x%02X:0x%02X/0x%02X\n\n", i,
4039 (byte)(f_ptr->x_attr[F_LIT_STANDARD]), (byte)(f_ptr->x_char[F_LIT_STANDARD]),
4040 (byte)(f_ptr->x_attr[F_LIT_LITE]), (byte)(f_ptr->x_char[F_LIT_LITE]),
4041 (byte)(f_ptr->x_attr[F_LIT_DARK]), (byte)(f_ptr->x_char[F_LIT_DARK]));
4049 msg_print("ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
4051 msg_print("Dumped feature attr/chars.");
4057 /* Modify monster attr/chars (numeric operation) */
4061 static cptr choice_msg = "¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4063 static cptr choice_msg = "Change monster attr/chars";
4068 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4070 prt(format("Command: %s", choice_msg), 15, 0);
4073 /* Hack -- query until done */
4076 monster_race *r_ptr = &r_info[r];
4080 byte da = r_ptr->d_attr;
4081 byte dc = r_ptr->d_char;
4082 byte ca = r_ptr->x_attr;
4083 byte cc = r_ptr->x_char;
4085 /* Label the object */
4087 Term_putstr(5, 17, -1, TERM_WHITE,
4088 format("¥â¥ó¥¹¥¿¡¼ = %d, ̾Á° = %-40.40s",
4089 r, (r_name + r_ptr->name)));
4091 Term_putstr(5, 17, -1, TERM_WHITE,
4092 format("Monster = %d, Name = %-40.40s",
4093 r, (r_name + r_ptr->name)));
4096 /* Label the Default values */
4098 Term_putstr(10, 19, -1, TERM_WHITE,
4099 format("½é´üÃÍ ¿§ / ʸ»ú = %3u / %3u", da, dc));
4101 Term_putstr(10, 19, -1, TERM_WHITE,
4102 format("Default attr/char = %3u / %3u", da, dc));
4105 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4106 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4108 /* Label the Current values */
4110 Term_putstr(10, 20, -1, TERM_WHITE,
4111 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3u / %3u", ca, cc));
4113 Term_putstr(10, 20, -1, TERM_WHITE,
4114 format("Current attr/char = %3u / %3u", ca, cc));
4117 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4118 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4122 Term_putstr(0, 22, -1, TERM_WHITE,
4123 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4125 Term_putstr(0, 22, -1, TERM_WHITE,
4126 "Command (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4133 if (i == ESCAPE) break;
4135 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4136 else if (isupper(i)) c = 'a' + i - 'A';
4146 if (!cmd_visuals_aux(i, &r, max_r_idx))
4152 while (!r_info[r].name);
4156 t = (int)r_ptr->x_attr;
4157 (void)cmd_visuals_aux(i, &t, 256);
4158 r_ptr->x_attr = (byte)t;
4162 t = (int)r_ptr->x_char;
4163 (void)cmd_visuals_aux(i, &t, 256);
4164 r_ptr->x_char = (byte)t;
4168 do_cmd_knowledge_monsters(&need_redraw, TRUE, r);
4172 print_visuals_menu(choice_msg);
4180 /* Modify object attr/chars (numeric operation) */
4184 static cptr choice_msg = "¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4186 static cptr choice_msg = "Change object attr/chars";
4191 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4193 prt(format("Command: %s", choice_msg), 15, 0);
4196 /* Hack -- query until done */
4199 object_kind *k_ptr = &k_info[k];
4203 byte da = k_ptr->d_attr;
4204 byte dc = k_ptr->d_char;
4205 byte ca = k_ptr->x_attr;
4206 byte cc = k_ptr->x_char;
4208 /* Label the object */
4210 Term_putstr(5, 17, -1, TERM_WHITE,
4211 format("¥¢¥¤¥Æ¥à = %d, ̾Á° = %-40.40s",
4212 k, k_name + (!k_ptr->flavor ? k_ptr->name : k_ptr->flavor_name)));
4214 Term_putstr(5, 17, -1, TERM_WHITE,
4215 format("Object = %d, Name = %-40.40s",
4216 k, k_name + (!k_ptr->flavor ? k_ptr->name : k_ptr->flavor_name)));
4219 /* Label the Default values */
4221 Term_putstr(10, 19, -1, TERM_WHITE,
4222 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4224 Term_putstr(10, 19, -1, TERM_WHITE,
4225 format("Default attr/char = %3d / %3d", da, dc));
4228 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4229 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4231 /* Label the Current values */
4233 Term_putstr(10, 20, -1, TERM_WHITE,
4234 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4236 Term_putstr(10, 20, -1, TERM_WHITE,
4237 format("Current attr/char = %3d / %3d", ca, cc));
4240 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4241 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4245 Term_putstr(0, 22, -1, TERM_WHITE,
4246 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4248 Term_putstr(0, 22, -1, TERM_WHITE,
4249 "Command (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4256 if (i == ESCAPE) break;
4258 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4259 else if (isupper(i)) c = 'a' + i - 'A';
4269 if (!cmd_visuals_aux(i, &k, max_k_idx))
4275 while (!k_info[k].name);
4279 t = (int)k_ptr->x_attr;
4280 (void)cmd_visuals_aux(i, &t, 256);
4281 k_ptr->x_attr = (byte)t;
4285 t = (int)k_ptr->x_char;
4286 (void)cmd_visuals_aux(i, &t, 256);
4287 k_ptr->x_char = (byte)t;
4291 do_cmd_knowledge_objects(&need_redraw, TRUE, k);
4295 print_visuals_menu(choice_msg);
4303 /* Modify feature attr/chars (numeric operation) */
4307 static cptr choice_msg = "ÃÏ·Á¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4309 static cptr choice_msg = "Change feature attr/chars";
4312 static int lighting_level = F_LIT_STANDARD;
4315 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4317 prt(format("Command: %s", choice_msg), 15, 0);
4320 /* Hack -- query until done */
4323 feature_type *f_ptr = &f_info[f];
4327 byte da = f_ptr->d_attr[lighting_level];
4328 byte dc = f_ptr->d_char[lighting_level];
4329 byte ca = f_ptr->x_attr[lighting_level];
4330 byte cc = f_ptr->x_char[lighting_level];
4332 /* Label the object */
4335 Term_putstr(5, 17, -1, TERM_WHITE,
4336 format("ÃÏ·Á = %d, ̾Á° = %s, ÌÀÅÙ = %s",
4337 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
4339 Term_putstr(5, 17, -1, TERM_WHITE,
4340 format("Terrain = %d, Name = %s, Lighting = %s",
4341 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
4344 /* Label the Default values */
4346 Term_putstr(10, 19, -1, TERM_WHITE,
4347 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4349 Term_putstr(10, 19, -1, TERM_WHITE,
4350 format("Default attr/char = %3d / %3d", da, dc));
4353 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4355 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4357 /* Label the Current values */
4359 Term_putstr(10, 20, -1, TERM_WHITE,
4360 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4362 Term_putstr(10, 20, -1, TERM_WHITE,
4363 format("Current attr/char = %3d / %3d", ca, cc));
4366 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4367 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4371 Term_putstr(0, 22, -1, TERM_WHITE,
4372 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
4374 Term_putstr(0, 22, -1, TERM_WHITE,
4375 "Command (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
4382 if (i == ESCAPE) break;
4384 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4385 else if (isupper(i)) c = 'a' + i - 'A';
4395 if (!cmd_visuals_aux(i, &f, max_f_idx))
4401 while (!f_info[f].name || (f_info[f].mimic != f));
4405 t = (int)f_ptr->x_attr[lighting_level];
4406 (void)cmd_visuals_aux(i, &t, 256);
4407 f_ptr->x_attr[lighting_level] = (byte)t;
4411 t = (int)f_ptr->x_char[lighting_level];
4412 (void)cmd_visuals_aux(i, &t, 256);
4413 f_ptr->x_char[lighting_level] = (byte)t;
4417 (void)cmd_visuals_aux(i, &lighting_level, F_LIT_MAX);
4420 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
4424 do_cmd_knowledge_features(&need_redraw, TRUE, f, &lighting_level);
4428 print_visuals_menu(choice_msg);
4436 /* Modify monster attr/chars (visual mode) */
4438 do_cmd_knowledge_monsters(&need_redraw, TRUE, -1);
4441 /* Modify object attr/chars (visual mode) */
4443 do_cmd_knowledge_objects(&need_redraw, TRUE, -1);
4446 /* Modify feature attr/chars (visual mode) */
4449 int lighting_level = F_LIT_STANDARD;
4450 do_cmd_knowledge_features(&need_redraw, TRUE, -1, &lighting_level);
4454 #endif /* ALLOW_VISUALS */
4464 msg_print("²èÌ̾å¤Î[¿§/ʸ»ú]¤ò½é´üÃͤ˥ꥻ¥Ã¥È¤·¤Þ¤·¤¿¡£");
4466 msg_print("Visual attr/char tables reset.");
4472 /* Unknown option */
4478 /* Flush messages */
4482 /* Restore the screen */
4485 if (need_redraw) do_cmd_redraw();
4490 * Interact with "colors"
4492 void do_cmd_colors(void)
4501 /* File type is "TEXT" */
4502 FILE_TYPE(FILE_TYPE_TEXT);
4505 /* Save the screen */
4509 /* Interact until done */
4515 /* Ask for a choice */
4517 prt("[ ¥«¥é¡¼¤ÎÀßÄê ]", 2, 0);
4519 prt("Interact with Colors", 2, 0);
4523 /* Give some choices */
4525 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
4527 prt("(1) Load a user pref file", 4, 5);
4532 prt("(2) ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
4533 prt("(3) ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤¹¤ë", 6, 5);
4535 prt("(2) Dump colors", 5, 5);
4536 prt("(3) Modify colors", 6, 5);
4543 prt("¥³¥Þ¥ó¥É: ", 8, 0);
4545 prt("Command: ", 8, 0);
4553 if (i == ESCAPE) break;
4555 /* Load a 'pref' file */
4560 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹", 8, 0);
4562 prt("Command: Load a user pref file", 8, 0);
4568 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4570 prt("File: ", 10, 0);
4575 sprintf(tmp, "%s.prf", player_base);
4578 if (!askfor(tmp, 70)) continue;
4580 /* Process the given filename */
4581 (void)process_pref_file(tmp);
4583 /* Mega-Hack -- react to changes */
4584 Term_xtra(TERM_XTRA_REACT, 0);
4586 /* Mega-Hack -- redraw */
4595 static cptr mark = "Colors";
4599 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 8, 0);
4601 prt("Command: Dump colors", 8, 0);
4607 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4609 prt("File: ", 10, 0);
4613 /* Default filename */
4614 sprintf(tmp, "%s.prf", player_base);
4616 /* Get a filename */
4617 if (!askfor(tmp, 70)) continue;
4619 /* Build the filename */
4620 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
4622 /* Append to the file */
4623 if (!open_auto_dump(buf, mark)) continue;
4627 auto_dump_printf("\n# ¥«¥é¡¼¤ÎÀßÄê\n\n");
4629 auto_dump_printf("\n# Color redefinitions\n\n");
4633 for (i = 0; i < 256; i++)
4635 int kv = angband_color_table[i][0];
4636 int rv = angband_color_table[i][1];
4637 int gv = angband_color_table[i][2];
4638 int bv = angband_color_table[i][3];
4643 cptr name = "unknown";
4647 /* Skip non-entries */
4648 if (!kv && !rv && !gv && !bv) continue;
4650 /* Extract the color name */
4651 if (i < 16) name = color_names[i];
4653 /* Dump a comment */
4655 auto_dump_printf("# ¥«¥é¡¼ '%s'\n", name);
4657 auto_dump_printf("# Color '%s'\n", name);
4660 /* Dump the monster attr/char info */
4661 auto_dump_printf("V:%d:0x%02X:0x%02X:0x%02X:0x%02X\n\n",
4670 msg_print("¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
4672 msg_print("Dumped color redefinitions.");
4684 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤·¤Þ¤¹", 8, 0);
4686 prt("Command: Modify colors", 8, 0);
4690 /* Hack -- query until done */
4699 /* Exhibit the normal colors */
4700 for (j = 0; j < 16; j++)
4702 /* Exhibit this color */
4703 Term_putstr(j*4, 20, -1, a, "###");
4705 /* Exhibit all colors */
4706 Term_putstr(j*4, 22, -1, j, format("%3d", j));
4709 /* Describe the color */
4711 name = ((a < 16) ? color_names[a] : "̤ÄêµÁ");
4713 name = ((a < 16) ? color_names[a] : "undefined");
4717 /* Describe the color */
4719 Term_putstr(5, 10, -1, TERM_WHITE,
4720 format("¥«¥é¡¼ = %d, ̾Á° = %s", a, name));
4722 Term_putstr(5, 10, -1, TERM_WHITE,
4723 format("Color = %d, Name = %s", a, name));
4727 /* Label the Current values */
4728 Term_putstr(5, 12, -1, TERM_WHITE,
4729 format("K = 0x%02x / R,G,B = 0x%02x,0x%02x,0x%02x",
4730 angband_color_table[a][0],
4731 angband_color_table[a][1],
4732 angband_color_table[a][2],
4733 angband_color_table[a][3]));
4737 Term_putstr(0, 14, -1, TERM_WHITE,
4738 "¥³¥Þ¥ó¥É (n/N/k/K/r/R/g/G/b/B): ");
4740 Term_putstr(0, 14, -1, TERM_WHITE,
4741 "Command (n/N/k/K/r/R/g/G/b/B): ");
4749 if (i == ESCAPE) break;
4752 if (i == 'n') a = (byte)(a + 1);
4753 if (i == 'N') a = (byte)(a - 1);
4754 if (i == 'k') angband_color_table[a][0] = (byte)(angband_color_table[a][0] + 1);
4755 if (i == 'K') angband_color_table[a][0] = (byte)(angband_color_table[a][0] - 1);
4756 if (i == 'r') angband_color_table[a][1] = (byte)(angband_color_table[a][1] + 1);
4757 if (i == 'R') angband_color_table[a][1] = (byte)(angband_color_table[a][1] - 1);
4758 if (i == 'g') angband_color_table[a][2] = (byte)(angband_color_table[a][2] + 1);
4759 if (i == 'G') angband_color_table[a][2] = (byte)(angband_color_table[a][2] - 1);
4760 if (i == 'b') angband_color_table[a][3] = (byte)(angband_color_table[a][3] + 1);
4761 if (i == 'B') angband_color_table[a][3] = (byte)(angband_color_table[a][3] - 1);
4763 /* Hack -- react to changes */
4764 Term_xtra(TERM_XTRA_REACT, 0);
4766 /* Hack -- redraw */
4773 /* Unknown option */
4779 /* Flush messages */
4784 /* Restore the screen */
4790 * Note something in the message recall
4792 void do_cmd_note(void)
4801 if (!get_string("¥á¥â: ", buf, 60)) return;
4803 if (!get_string("Note: ", buf, 60)) return;
4807 /* Ignore empty notes */
4808 if (!buf[0] || (buf[0] == ' ')) return;
4810 /* Add the note to the message recall */
4812 msg_format("¥á¥â: %s", buf);
4814 msg_format("Note: %s", buf);
4821 * Mention the current version
4823 void do_cmd_version(void)
4828 msg_format("ÊѶòÈÚÅÜ(Hengband) %d.%d.%d",
4829 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4831 msg_format("You are playing Hengband %d.%d.%d.",
4832 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4839 * Array of feeling strings
4841 static cptr do_cmd_feeling_text[11] =
4844 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4846 "Looks like any other level.",
4850 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4852 "You feel there is something special about this level.",
4856 "¶²¤í¤·¤¤»à¤Î¸¸¤¬ÌܤËÉ⤫¤Ó¡¢µ¤À䤷¤½¤¦¤Ë¤Ê¤Ã¤¿¡ª",
4858 "You nearly faint as horrible visions of death fill your mind!",
4862 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4864 "This level looks very dangerous.",
4868 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4870 "You have a very bad feeling...",
4874 "°¤¤Í½´¶¤¬¤¹¤ë...",
4876 "You have a bad feeling...",
4882 "You feel nervous.",
4886 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4888 "You feel your luck is turning...",
4892 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4894 "You don't like the look of this place.",
4898 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4900 "This level looks reasonably safe.",
4904 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4906 "What a boring place..."
4911 static cptr do_cmd_feeling_text_combat[11] =
4914 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4916 "Looks like any other level.",
4920 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4922 "You feel there is something special about this level.",
4926 "º£Ìë¤â¤Þ¤¿¡¢Ã¯¤«¤¬Ì¿¤òÍî¤È¤¹...",
4928 "You nearly faint as horrible visions of death fill your mind!",
4932 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4934 "This level looks very dangerous.",
4938 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4940 "You have a very bad feeling...",
4944 "°¤¤Í½´¶¤¬¤¹¤ë...",
4946 "You have a bad feeling...",
4952 "You feel nervous.",
4956 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4958 "You feel your luck is turning...",
4962 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4964 "You don't like the look of this place.",
4968 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4970 "This level looks reasonably safe.",
4974 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4976 "What a boring place..."
4981 static cptr do_cmd_feeling_text_lucky[11] =
4984 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4985 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4986 "¤³¤Î³¬¤Ï¤³¤Î¾å¤Ê¤¯ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë¡£",
4987 "ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë...",
4988 "¤È¤Æ¤âÎɤ¤´¶¤¸¤¬¤¹¤ë...",
4989 "Îɤ¤´¶¤¸¤¬¤¹¤ë...",
4990 "¤Á¤ç¤Ã¤È¹¬±¿¤Ê´¶¤¸¤¬¤¹¤ë...",
4991 "¿¾¯¤Ï±¿¤¬¸þ¤¤¤Æ¤¤¿¤«...",
4992 "¸«¤¿´¶¤¸°¤¯¤Ï¤Ê¤¤...",
4993 "Á´Á³ÂÌÌܤȤ¤¤¦¤³¤È¤Ï¤Ê¤¤¤¬...",
4994 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4996 "Looks like any other level.",
4997 "You feel there is something special about this level.",
4998 "You have a superb feeling about this level.",
4999 "You have an excellent feeling...",
5000 "You have a very good feeling...",
5001 "You have a good feeling...",
5002 "You feel strangely lucky...",
5003 "You feel your luck is turning...",
5004 "You like the look of this place...",
5005 "This level can't be all bad...",
5006 "What a boring place..."
5012 * Note that "feeling" is set to zero unless some time has passed.
5013 * Note that this is done when the level is GENERATED, not entered.
5015 void do_cmd_feeling(void)
5017 /* No useful feeling in quests */
5018 if (p_ptr->inside_quest && !random_quest_number(dun_level))
5021 msg_print("ŵ·¿Åª¤Ê¥¯¥¨¥¹¥È¤Î¥À¥ó¥¸¥ç¥ó¤Î¤è¤¦¤À¡£");
5023 msg_print("Looks like a typical quest level.");
5029 /* No useful feeling in town */
5030 else if (p_ptr->town_num && !dun_level)
5033 if (!strcmp(town[p_ptr->town_num].name, "¹ÓÌî"))
5035 if (!strcmp(town[p_ptr->town_num].name, "wilderness"))
5039 msg_print("²¿¤«¤¢¤ê¤½¤¦¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
5041 msg_print("Looks like a strange wilderness.");
5049 msg_print("ŵ·¿Åª¤ÊÄ®¤Î¤è¤¦¤À¡£");
5051 msg_print("Looks like a typical town.");
5058 /* No useful feeling in the wilderness */
5059 else if (!dun_level)
5062 msg_print("ŵ·¿Åª¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
5064 msg_print("Looks like a typical wilderness.");
5070 /* Display the feeling */
5071 if (p_ptr->muta3 & MUT3_GOOD_LUCK)
5072 msg_print(do_cmd_feeling_text_lucky[p_ptr->feeling]);
5073 else if (p_ptr->pseikaku == SEIKAKU_COMBAT ||
5074 inventory[INVEN_BOW].name1 == ART_CRIMSON)
5075 msg_print(do_cmd_feeling_text_combat[p_ptr->feeling]);
5077 msg_print(do_cmd_feeling_text[p_ptr->feeling]);
5083 * Description of each monster group.
5085 static cptr monster_group_text[] =
5088 "¥æ¥Ë¡¼¥¯", /* "Uniques" */
5089 "¾èÇϲÄǽ¤Ê¥â¥ó¥¹¥¿¡¼", /* "Riding" */
5090 "¾Þ¶â¼ó", /* "Wanted */
5091 "¥¢¥ó¥Ð¡¼¤Î²¦Â²", /* "Ambertite" */
5120 /* "¸ÅÂå¥É¥é¥´¥ó/¥ï¥¤¥¢¡¼¥à", */
5137 /* "¾åµé¥Ç¡¼¥â¥ó", */
5181 /* "Ancient Dragon/Wyrm", */
5190 "Multi-Headed Reptile",
5195 "Reptile/Amphibian",
5196 "Spider/Scorpion/Tick",
5198 /* "Major Demon", */
5215 * Symbols of monsters in each group. Note the "Uniques" group
5216 * is handled differently.
5218 static cptr monster_group_char[] =
5275 "!$&()+./=>?[\\]`{|~",
5285 * hook function to sort monsters by level
5287 static bool ang_sort_comp_monster_level(vptr u, vptr v, int a, int b)
5289 u16b *who = (u16b*)(u);
5294 monster_race *r_ptr1 = &r_info[w1];
5295 monster_race *r_ptr2 = &r_info[w2];
5300 if (r_ptr2->level > r_ptr1->level) return TRUE;
5301 if (r_ptr1->level > r_ptr2->level) return FALSE;
5303 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return TRUE;
5304 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return FALSE;
5309 * Build a list of monster indexes in the given group. Return the number
5310 * of monsters in the group.
5312 * mode & 0x01 : check for non-empty group
5313 * mode & 0x02 : visual operation only
5315 static int collect_monsters(int grp_cur, s16b mon_idx[], byte mode)
5320 /* Get a list of x_char in this group */
5321 cptr group_char = monster_group_char[grp_cur];
5323 /* XXX Hack -- Check if this is the "Uniques" group */
5324 bool grp_unique = (monster_group_char[grp_cur] == (char *) -1L);
5326 /* XXX Hack -- Check if this is the "Riding" group */
5327 bool grp_riding = (monster_group_char[grp_cur] == (char *) -2L);
5329 /* XXX Hack -- Check if this is the "Wanted" group */
5330 bool grp_wanted = (monster_group_char[grp_cur] == (char *) -3L);
5332 /* XXX Hack -- Check if this is the "Amberite" group */
5333 bool grp_amberite = (monster_group_char[grp_cur] == (char *) -4L);
5336 /* Check every race */
5337 for (i = 0; i < max_r_idx; i++)
5339 /* Access the race */
5340 monster_race *r_ptr = &r_info[i];
5342 /* Skip empty race */
5343 if (!r_ptr->name) continue ;
5345 /* Require known monsters */
5346 if (!(mode & 0x02) && !cheat_know && !r_ptr->r_sights) continue;
5350 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
5353 else if (grp_riding)
5355 if (!(r_ptr->flags7 & RF7_RIDING)) continue;
5358 else if (grp_wanted)
5360 bool wanted = FALSE;
5362 for (j = 0; j < MAX_KUBI; j++)
5364 if (kubi_r_idx[j] == i || kubi_r_idx[j] - 10000 == i ||
5365 (p_ptr->today_mon && p_ptr->today_mon == i))
5371 if (!wanted) continue;
5374 else if (grp_amberite)
5376 if (!(r_ptr->flags3 & RF3_AMBERITE)) continue;
5381 /* Check for race in the group */
5382 if (!my_strchr(group_char, r_ptr->d_char)) continue;
5386 mon_idx[mon_cnt++] = i;
5388 /* XXX Hack -- Just checking for non-empty group */
5389 if (mode & 0x01) break;
5392 /* Terminate the list */
5393 mon_idx[mon_cnt] = -1;
5395 /* Select the sort method */
5396 ang_sort_comp = ang_sort_comp_monster_level;
5397 ang_sort_swap = ang_sort_swap_hook;
5399 /* Sort by monster level */
5400 ang_sort(mon_idx, &dummy_why, mon_cnt);
5402 /* Return the number of races */
5408 * Description of each monster group.
5410 static cptr object_group_text[] =
5413 "¥¥Î¥³", /* "Mushrooms" */
5414 "Ìô", /* "Potions" */
5415 "Ìý¤Ä¤Ü", /* "Flasks" */
5416 "´¬Êª", /* "Scrolls" */
5417 "»ØÎØ", /* "Rings" */
5418 "¥¢¥ß¥å¥ì¥Ã¥È", /* "Amulets" */
5419 "ū", /* "Whistle" */
5420 "¸÷¸»", /* "Lanterns" */
5421 "ËâË¡ËÀ", /* "Wands" */
5422 "¾ó", /* "Staffs" */
5423 "¥í¥Ã¥É", /* "Rods" */
5424 "¥«¡¼¥É", /* "Cards" */
5425 "¥¥ã¥×¥Á¥ã¡¼¡¦¥Ü¡¼¥ë",
5435 "Åá·õÎà", /* "Swords" */
5436 "Æß´ï", /* "Blunt Weapons" */
5437 "ĹÊÁÉð´ï", /* "Polearms" */
5438 "ºÎ·¡Æ»¶ñ", /* "Diggers" */
5439 "Èô¤ÓÆ»¶ñ", /* "Bows" */
5443 "·ÚÁõ³»", /* "Soft Armor" */
5444 "½ÅÁõ³»", /* "Hard Armor" */
5445 "¥É¥é¥´¥ó³»", /* "Dragon Armor" */
5446 "½â", /* "Shields" */
5447 "¥¯¥í¡¼¥¯", /* "Cloaks" */
5448 "äƼê", /* "Gloves" */
5449 "¥Ø¥ë¥á¥Ã¥È", /* "Helms" */
5450 "´§", /* "Crowns" */
5451 "¥Ö¡¼¥Ä", /* "Boots" */
5504 * TVALs of items in each group
5506 static byte object_group_tval[] =
5547 TV_LIFE_BOOK, /* Hack -- all spellbooks */
5555 * Build a list of object indexes in the given group. Return the number
5556 * of objects in the group.
5558 * mode & 0x01 : check for non-empty group
5559 * mode & 0x02 : visual operation only
5561 static int collect_objects(int grp_cur, int object_idx[], byte mode)
5563 int i, j, k, object_cnt = 0;
5565 /* Get a list of x_char in this group */
5566 byte group_tval = object_group_tval[grp_cur];
5568 /* Check every object */
5569 for (i = 0; i < max_k_idx; i++)
5571 /* Access the object */
5572 object_kind *k_ptr = &k_info[i];
5574 /* Skip empty objects */
5575 if (!k_ptr->name) continue;
5579 /* Any objects will be displayed */
5585 /* Skip non-flavoured objects */
5586 if (!k_ptr->flavor) continue;
5588 /* Require objects ever seen */
5589 if (!k_ptr->aware) continue;
5592 /* Skip items with no distribution (special artifacts) */
5593 for (j = 0, k = 0; j < 4; j++) k += k_ptr->chance[j];
5597 /* Check for objects in the group */
5598 if (TV_LIFE_BOOK == group_tval)
5600 /* Hack -- All spell books */
5601 if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HEX_BOOK)
5603 /* Add the object */
5604 object_idx[object_cnt++] = i;
5608 else if (k_ptr->tval == group_tval)
5610 /* Add the object */
5611 object_idx[object_cnt++] = i;
5615 /* XXX Hack -- Just checking for non-empty group */
5616 if (mode & 0x01) break;
5619 /* Terminate the list */
5620 object_idx[object_cnt] = -1;
5622 /* Return the number of objects */
5628 * Description of each feature group.
5630 static cptr feature_group_text[] =
5638 * Build a list of feature indexes in the given group. Return the number
5639 * of features in the group.
5641 * mode & 0x01 : check for non-empty group
5643 static int collect_features(int grp_cur, int *feat_idx, byte mode)
5645 int i, feat_cnt = 0;
5647 /* Unused; There is a single group. */
5650 /* Check every feature */
5651 for (i = 0; i < max_f_idx; i++)
5653 /* Access the index */
5654 feature_type *f_ptr = &f_info[i];
5656 /* Skip empty index */
5657 if (!f_ptr->name) continue;
5659 /* Skip mimiccing features */
5660 if (f_ptr->mimic != i) continue;
5663 feat_idx[feat_cnt++] = i;
5665 /* XXX Hack -- Just checking for non-empty group */
5666 if (mode & 0x01) break;
5669 /* Terminate the list */
5670 feat_idx[feat_cnt] = -1;
5672 /* Return the number of races */
5679 * Build a list of monster indexes in the given group. Return the number
5680 * of monsters in the group.
5682 static int collect_artifacts(int grp_cur, int object_idx[])
5684 int i, object_cnt = 0;
5686 /* Get a list of x_char in this group */
5687 byte group_tval = object_group_tval[grp_cur];
5689 /* Check every object */
5690 for (i = 0; i < max_a_idx; i++)
5692 /* Access the artifact */
5693 artifact_type *a_ptr = &a_info[i];
5695 /* Skip empty artifacts */
5696 if (!a_ptr->name) continue;
5698 /* Skip "uncreated" artifacts */
5699 if (!a_ptr->cur_num) continue;
5701 /* Check for race in the group */
5702 if (a_ptr->tval == group_tval)
5705 object_idx[object_cnt++] = i;
5709 /* Terminate the list */
5710 object_idx[object_cnt] = 0;
5712 /* Return the number of races */
5719 * Encode the screen colors
5721 static char hack[17] = "dwsorgbuDWvyRGBU";
5725 * Hack -- load a screen dump from a file
5727 void do_cmd_load_screen(void)
5742 Term_get_size(&wid, &hgt);
5744 /* Build the filename */
5745 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
5747 /* Append to the file */
5748 fff = my_fopen(buf, "r");
5753 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
5755 msg_format("Failed to open %s.", buf);
5762 /* Save the screen */
5765 /* Clear the screen */
5769 /* Load the screen */
5770 for (y = 0; okay; y++)
5772 /* Get a line of data including control code */
5773 if (!fgets(buf, 1024, fff)) okay = FALSE;
5775 /* Get the blank line */
5776 if (buf[0] == '\n' || buf[0] == '\0') break;
5778 /* Ignore too large screen image */
5779 if (y >= hgt) continue;
5782 for (x = 0; x < wid - 1; x++)
5785 if (buf[x] == '\n' || buf[x] == '\0') break;
5787 /* Put the attr/char */
5788 Term_draw(x, y, TERM_WHITE, buf[x]);
5792 /* Dump the screen */
5793 for (y = 0; okay; y++)
5795 /* Get a line of data including control code */
5796 if (!fgets(buf, 1024, fff)) okay = FALSE;
5798 /* Get the blank line */
5799 if (buf[0] == '\n' || buf[0] == '\0') break;
5801 /* Ignore too large screen image */
5802 if (y >= hgt) continue;
5805 for (x = 0; x < wid - 1; x++)
5808 if (buf[x] == '\n' || buf[x] == '\0') break;
5810 /* Get the attr/char */
5811 (void)(Term_what(x, y, &a, &c));
5813 /* Look up the attr */
5814 for (i = 0; i < 16; i++)
5816 /* Use attr matches */
5817 if (hack[i] == buf[x]) a = i;
5820 /* Put the attr/char */
5821 Term_draw(x, y, a, c);
5832 prt("¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤µ¤ì¤¿²èÌÌ(µÇ°»£±Æ)¤ò¥í¡¼¥É¤·¤Þ¤·¤¿¡£", 0, 0);
5834 msg_print("Screen dump loaded.");
5841 /* Restore the screen */
5848 cptr inven_res_label =
5850 " »ÀÅŲÐÎäÆǸ÷°ÇÇ˹ì¹ö°øÆÙÎô ÌÕÉÝÍðáãÆ©Ì¿´¶¾ÃÉüÉâ";
5852 " AcElFiCoPoLiDkShSoNtNxCaDi BlFeCfFaSeHlEpSdRgLv";
5857 #define IM_FLAG_STR "¡ö"
5858 #define HAS_FLAG_STR "¡Ü"
5859 #define NO_FLAG_STR "¡¦"
5861 #define IM_FLAG_STR "* "
5862 #define HAS_FLAG_STR "+ "
5863 #define NO_FLAG_STR ". "
5866 #define print_im_or_res_flag(IM, RES) \
5868 fputs(have_flag(flgs, (IM)) ? IM_FLAG_STR : \
5869 (have_flag(flgs, (RES)) ? HAS_FLAG_STR : NO_FLAG_STR), fff); \
5872 #define print_flag(TR) \
5874 fputs(have_flag(flgs, (TR)) ? HAS_FLAG_STR : NO_FLAG_STR, fff); \
5878 /* XTRA HACK RESLIST */
5879 static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, byte tval, char *where)
5881 char o_name[MAX_NLEN];
5882 u32b flgs[TR_FLAG_SIZE];
5884 if (!o_ptr->k_idx) return;
5885 if (o_ptr->tval != tval) return;
5887 /* Identified items only */
5888 if (!object_is_known(o_ptr)) return;
5891 * HACK:Ring of Lordly protection and Dragon equipment
5892 * have random resistances.
5894 if ((object_is_wearable(o_ptr) && object_is_ego(o_ptr))
5895 || ((tval == TV_AMULET) && (o_ptr->sval == SV_AMULET_RESISTANCE))
5896 || ((tval == TV_RING) && (o_ptr->sval == SV_RING_LORDLY))
5897 || ((tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD))
5898 || ((tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM))
5899 || ((tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES))
5900 || ((tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE))
5901 || object_is_artifact(o_ptr))
5904 object_desc(o_name, o_ptr, OD_NAME_ONLY);
5906 while (o_name[i] && (i < 26))
5909 if (iskanji(o_name[i])) i++;
5918 o_name[i] = ' '; i++;
5923 fprintf(fff, "%s %s", where, o_name);
5925 if (!(o_ptr->ident & (IDENT_MENTAL)))
5928 fputs("-------ÉÔÌÀ--------------- -------ÉÔÌÀ---------\n", fff);
5930 fputs("-------unknown------------ -------unknown------\n", fff);
5935 object_flags_known(o_ptr, flgs);
5937 print_im_or_res_flag(TR_IM_ACID, TR_RES_ACID);
5938 print_im_or_res_flag(TR_IM_ELEC, TR_RES_ELEC);
5939 print_im_or_res_flag(TR_IM_FIRE, TR_RES_FIRE);
5940 print_im_or_res_flag(TR_IM_COLD, TR_RES_COLD);
5941 print_flag(TR_RES_POIS);
5942 print_flag(TR_RES_LITE);
5943 print_flag(TR_RES_DARK);
5944 print_flag(TR_RES_SHARDS);
5945 print_flag(TR_RES_SOUND);
5946 print_flag(TR_RES_NETHER);
5947 print_flag(TR_RES_NEXUS);
5948 print_flag(TR_RES_CHAOS);
5949 print_flag(TR_RES_DISEN);
5953 print_flag(TR_RES_BLIND);
5954 print_flag(TR_RES_FEAR);
5955 print_flag(TR_RES_CONF);
5956 print_flag(TR_FREE_ACT);
5957 print_flag(TR_SEE_INVIS);
5958 print_flag(TR_HOLD_LIFE);
5959 print_flag(TR_TELEPATHY);
5960 print_flag(TR_SLOW_DIGEST);
5961 print_flag(TR_REGEN);
5962 print_flag(TR_LEVITATION);
5970 fprintf(fff, "%s\n", inven_res_label);
5976 * Display *ID* ed weapons/armors's resistances
5978 static void do_cmd_knowledge_inven(void)
5982 char file_name[1024];
5992 /* Open a new file */
5993 fff = my_fopen_temp(file_name, 1024);
5997 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
5999 msg_format("Failed to create temporary file %s.", file_name);
6004 fprintf(fff, "%s\n", inven_res_label);
6006 for (tval = TV_WEARABLE_BEGIN; tval <= TV_WEARABLE_END; tval++)
6010 for (; j < 9; j++) fputc('\n', fff);
6012 fprintf(fff, "%s\n", inven_res_label);
6016 strcpy(where, "Áõ");
6018 strcpy(where, "E ");
6020 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
6022 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
6026 strcpy(where, "»ý");
6028 strcpy(where, "I ");
6030 for (i = 0; i < INVEN_PACK; i++)
6032 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
6035 st_ptr = &town[1].store[STORE_HOME];
6037 strcpy(where, "²È");
6039 strcpy(where, "H ");
6042 for (i = 0; i < st_ptr->stock_num; i++)
6044 do_cmd_knowledge_inven_aux(fff, &st_ptr->stock[i], &j, tval, where);
6048 /* Close the file */
6051 /* Display the file contents */
6053 show_file(TRUE, file_name, "*´ÕÄê*ºÑ¤ßÉð´ï/Ëɶñ¤ÎÂÑÀ¥ê¥¹¥È", 0, 0);
6055 show_file(TRUE, file_name, "Resistances of *identified* equipment", 0, 0);
6058 /* Remove the file */
6063 void do_cmd_save_screen_html_aux(char *filename, int message)
6067 byte a = 0, old_a = 0;
6081 cptr html_head[] = {
6082 "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
6086 cptr html_foot[] = {
6088 "</body>\n</html>\n",
6094 Term_get_size(&wid, &hgt);
6096 /* File type is "TEXT" */
6097 FILE_TYPE(FILE_TYPE_TEXT);
6099 /* Append to the file */
6100 fff = my_fopen(filename, "w");
6106 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", filename);
6108 msg_format("Failed to open file %s.", filename);
6116 /* Save the screen */
6120 /* Build the filename */
6121 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
6122 tmpfff = my_fopen(buf, "r");
6124 for (i = 0; html_head[i]; i++)
6125 fputs(html_head[i], fff);
6129 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
6131 if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
6135 if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
6137 fprintf(fff, "%s\n", buf);
6142 /* Dump the screen */
6143 for (y = 0; y < hgt; y++)
6150 for (x = 0; x < wid - 1; x++)
6154 /* Get the attr/char */
6155 (void)(Term_what(x, y, &a, &c));
6159 case '&': cc = "&"; break;
6160 case '<': cc = "<"; break;
6161 case '>': cc = ">"; break;
6163 case 0x1f: c = '.'; break;
6164 case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
6169 if ((y == 0 && x == 0) || a != old_a) {
6170 rv = angband_color_table[a][1];
6171 gv = angband_color_table[a][2];
6172 bv = angband_color_table[a][3];
6173 fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
6174 ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
6178 fprintf(fff, "%s", cc);
6180 fprintf(fff, "%c", c);
6183 fprintf(fff, "</font>");
6186 for (i = 0; html_foot[i]; i++)
6187 fputs(html_foot[i], fff);
6192 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
6194 if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
6198 if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
6200 fprintf(fff, "%s\n", buf);
6215 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6217 msg_print("Screen dump saved.");
6222 /* Restore the screen */
6228 * Hack -- save a screen dump to a file
6230 static void do_cmd_save_screen_html(void)
6232 char buf[1024], tmp[256] = "screen.html";
6235 if (!get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
6237 if (!get_string("File name: ", tmp, 80))
6241 /* Build the filename */
6242 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
6246 do_cmd_save_screen_html_aux(buf, 1);
6251 * Redefinable "save_screen" action
6253 void (*screendump_aux)(void) = NULL;
6257 * Hack -- save a screen dump to a file
6259 void do_cmd_save_screen(void)
6261 bool old_use_graphics = use_graphics;
6262 bool html_dump = FALSE;
6267 prt("µÇ°»£±Æ¤·¤Þ¤¹¤«¡© [(y)es/(h)tml/(n)o] ", 0, 0);
6269 prt("Save screen dump? [(y)es/(h)tml/(n)o] ", 0, 0);
6274 if (c == 'Y' || c == 'y')
6276 else if (c == 'H' || c == 'h')
6288 Term_get_size(&wid, &hgt);
6290 if (old_use_graphics)
6292 use_graphics = FALSE;
6295 /* Redraw everything */
6296 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6298 /* Hack -- update */
6304 do_cmd_save_screen_html();
6308 /* Do we use a special screendump function ? */
6309 else if (screendump_aux)
6311 /* Dump the screen to a graphics file */
6312 (*screendump_aux)();
6314 else /* Dump the screen as text */
6325 /* Build the filename */
6326 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
6328 /* File type is "TEXT" */
6329 FILE_TYPE(FILE_TYPE_TEXT);
6331 /* Append to the file */
6332 fff = my_fopen(buf, "w");
6338 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
6340 msg_format("Failed to open file %s.", buf);
6347 /* Save the screen */
6351 /* Dump the screen */
6352 for (y = 0; y < hgt; y++)
6355 for (x = 0; x < wid - 1; x++)
6357 /* Get the attr/char */
6358 (void)(Term_what(x, y, &a, &c));
6368 fprintf(fff, "%s\n", buf);
6375 /* Dump the screen */
6376 for (y = 0; y < hgt; y++)
6379 for (x = 0; x < wid - 1; x++)
6381 /* Get the attr/char */
6382 (void)(Term_what(x, y, &a, &c));
6385 buf[x] = hack[a&0x0F];
6392 fprintf(fff, "%s\n", buf);
6404 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6406 msg_print("Screen dump saved.");
6412 /* Restore the screen */
6416 if (old_use_graphics)
6418 use_graphics = TRUE;
6421 /* Redraw everything */
6422 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6424 /* Hack -- update */
6431 * Sorting hook -- Comp 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 on "u".
6436 static bool ang_sort_art_comp(vptr u, vptr v, int a, int b)
6438 u16b *who = (u16b*)(u);
6440 u16b *why = (u16b*)(v);
6447 /* Sort by total kills */
6450 /* Extract total kills */
6451 z1 = a_info[w1].tval;
6452 z2 = a_info[w2].tval;
6454 /* Compare total kills */
6455 if (z1 < z2) return (TRUE);
6456 if (z1 > z2) return (FALSE);
6460 /* Sort by monster level */
6463 /* Extract levels */
6464 z1 = a_info[w1].sval;
6465 z2 = a_info[w2].sval;
6467 /* Compare levels */
6468 if (z1 < z2) return (TRUE);
6469 if (z1 > z2) return (FALSE);
6473 /* Sort by monster experience */
6476 /* Extract experience */
6477 z1 = a_info[w1].level;
6478 z2 = a_info[w2].level;
6480 /* Compare experience */
6481 if (z1 < z2) return (TRUE);
6482 if (z1 > z2) return (FALSE);
6486 /* Compare indexes */
6492 * Sorting hook -- Swap function -- see below
6494 * We use "u" to point to array of monster indexes,
6495 * and "v" to select the type of sorting to perform.
6497 static void ang_sort_art_swap(vptr u, vptr v, int a, int b)
6499 u16b *who = (u16b*)(u);
6514 * Check the status of "artifacts"
6516 static void do_cmd_knowledge_artifacts(void)
6518 int i, k, z, x, y, n = 0;
6524 char file_name[1024];
6526 char base_name[MAX_NLEN];
6530 /* Open a new file */
6531 fff = my_fopen_temp(file_name, 1024);
6535 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6537 msg_format("Failed to create temporary file %s.", file_name);
6543 /* Allocate the "who" array */
6544 C_MAKE(who, max_a_idx, s16b);
6546 /* Allocate the "okay" array */
6547 C_MAKE(okay, max_a_idx, bool);
6549 /* Scan the artifacts */
6550 for (k = 0; k < max_a_idx; k++)
6552 artifact_type *a_ptr = &a_info[k];
6557 /* Skip "empty" artifacts */
6558 if (!a_ptr->name) continue;
6560 /* Skip "uncreated" artifacts */
6561 if (!a_ptr->cur_num) continue;
6567 /* Check the dungeon */
6568 for (y = 0; y < cur_hgt; y++)
6570 for (x = 0; x < cur_wid; x++)
6572 cave_type *c_ptr = &cave[y][x];
6574 s16b this_o_idx, next_o_idx = 0;
6576 /* Scan all objects in the grid */
6577 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
6581 /* Acquire object */
6582 o_ptr = &o_list[this_o_idx];
6584 /* Acquire next object */
6585 next_o_idx = o_ptr->next_o_idx;
6587 /* Ignore non-artifacts */
6588 if (!object_is_fixed_artifact(o_ptr)) continue;
6590 /* Ignore known items */
6591 if (object_is_known(o_ptr)) continue;
6593 /* Note the artifact */
6594 okay[o_ptr->name1] = FALSE;
6599 /* Check the inventory and equipment */
6600 for (i = 0; i < INVEN_TOTAL; i++)
6602 object_type *o_ptr = &inventory[i];
6604 /* Ignore non-objects */
6605 if (!o_ptr->k_idx) continue;
6607 /* Ignore non-artifacts */
6608 if (!object_is_fixed_artifact(o_ptr)) continue;
6610 /* Ignore known items */
6611 if (object_is_known(o_ptr)) continue;
6613 /* Note the artifact */
6614 okay[o_ptr->name1] = FALSE;
6617 for (k = 0; k < max_a_idx; k++)
6619 if (okay[k]) who[n++] = k;
6622 /* Select the sort method */
6623 ang_sort_comp = ang_sort_art_comp;
6624 ang_sort_swap = ang_sort_art_swap;
6626 /* Sort the array by dungeon depth of monsters */
6627 ang_sort(who, &why, n);
6629 /* Scan the artifacts */
6630 for (k = 0; k < n; k++)
6632 artifact_type *a_ptr = &a_info[who[k]];
6636 strcpy(base_name, "̤ÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à");
6638 strcpy(base_name, "Unknown Artifact");
6642 /* Obtain the base object type */
6643 z = lookup_kind(a_ptr->tval, a_ptr->sval);
6651 /* Get local object */
6654 /* Create fake object */
6655 object_prep(q_ptr, z);
6657 /* Make it an artifact */
6658 q_ptr->name1 = (byte)who[k];
6660 /* Display as if known */
6661 q_ptr->ident |= IDENT_STORE;
6663 /* Describe the artifact */
6664 object_desc(base_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
6667 /* Hack -- Build the artifact name */
6669 fprintf(fff, " %s\n", base_name);
6671 fprintf(fff, " The %s\n", base_name);
6676 /* Free the "who" array */
6677 C_KILL(who, max_a_idx, s16b);
6679 /* Free the "okay" array */
6680 C_KILL(okay, max_a_idx, bool);
6682 /* Close the file */
6685 /* Display the file contents */
6687 show_file(TRUE, file_name, "´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à", 0, 0);
6689 show_file(TRUE, file_name, "Artifacts Seen", 0, 0);
6693 /* Remove the file */
6699 * Display known uniques
6700 * With "XTRA HACK UNIQHIST" (Originally from XAngband)
6702 static void do_cmd_knowledge_uniques(void)
6710 char file_name[1024];
6713 int n_alive_surface = 0;
6714 int n_alive_over100 = 0;
6715 int n_alive_total = 0;
6718 for (i = 0; i < 10; i++) n_alive[i] = 0;
6720 /* Open a new file */
6721 fff = my_fopen_temp(file_name, 1024);
6726 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6728 msg_format("Failed to create temporary file %s.", file_name);
6734 /* Allocate the "who" array */
6735 C_MAKE(who, max_r_idx, s16b);
6737 /* Scan the monsters */
6738 for (i = 1; i < max_r_idx; i++)
6740 monster_race *r_ptr = &r_info[i];
6743 if (!r_ptr->name) continue;
6745 /* Require unique monsters */
6746 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6748 /* Only display "known" uniques */
6749 if (!cheat_know && !r_ptr->r_sights) continue;
6751 /* Only print rarity <= 100 uniques */
6752 if (!r_ptr->rarity || ((r_ptr->rarity > 100) && !(r_ptr->flags1 & RF1_QUESTOR))) continue;
6754 /* Only "alive" uniques */
6755 if (r_ptr->max_num == 0) continue;
6759 lev = (r_ptr->level - 1) / 10;
6763 if (max_lev < lev) max_lev = lev;
6765 else n_alive_over100++;
6767 else n_alive_surface++;
6769 /* Collect "appropriate" monsters */
6773 /* Select the sort method */
6774 ang_sort_comp = ang_sort_comp_hook;
6775 ang_sort_swap = ang_sort_swap_hook;
6777 /* Sort the array by dungeon depth of monsters */
6778 ang_sort(who, &why, n);
6780 if (n_alive_surface)
6783 fprintf(fff, " ÃϾå À¸Â¸: %3dÂÎ\n", n_alive_surface);
6785 fprintf(fff, " Surface alive: %3d\n", n_alive_surface);
6787 n_alive_total += n_alive_surface;
6789 for (i = 0; i <= max_lev; i++)
6792 fprintf(fff, "%3d-%3d³¬ À¸Â¸: %3dÂÎ\n", 1 + i * 10, 10 + i * 10, n_alive[i]);
6794 fprintf(fff, "Level %3d-%3d alive: %3d\n", 1 + i * 10, 10 + i * 10, n_alive[i]);
6796 n_alive_total += n_alive[i];
6798 if (n_alive_over100)
6801 fprintf(fff, "101- ³¬ À¸Â¸: %3dÂÎ\n", n_alive_over100);
6803 fprintf(fff, "Level 101- alive: %3d\n", n_alive_over100);
6805 n_alive_total += n_alive_over100;
6811 fputs("--------- -----------\n", fff);
6812 fprintf(fff, " ¹ç·× À¸Â¸: %3dÂÎ\n\n", n_alive_total);
6814 fputs("------------- ----------\n", fff);
6815 fprintf(fff, " Total alive: %3d\n\n", n_alive_total);
6821 fputs("¸½ºß¤Ï´ûÃΤÎÀ¸Â¸¥æ¥Ë¡¼¥¯¤Ï¤¤¤Þ¤»¤ó¡£\n", fff);
6823 fputs("No known uniques alive.\n", fff);
6827 /* Scan the monster races */
6828 for (k = 0; k < n; k++)
6830 monster_race *r_ptr = &r_info[who[k]];
6832 /* Print a message */
6834 fprintf(fff, " %s (¥ì¥Ù¥ë%d)\n", r_name + r_ptr->name, r_ptr->level);
6836 fprintf(fff, " %s (level %d)\n", r_name + r_ptr->name, r_ptr->level);
6840 /* Free the "who" array */
6841 C_KILL(who, max_r_idx, s16b);
6843 /* Close the file */
6846 /* Display the file contents */
6848 show_file(TRUE, file_name, "¤Þ¤ÀÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼", 0, 0);
6850 show_file(TRUE, file_name, "Alive Uniques", 0, 0);
6854 /* Remove the file */
6860 * Display weapon-exp
6862 static void do_cmd_knowledge_weapon_exp(void)
6864 int i, j, num, weapon_exp;
6868 char file_name[1024];
6871 /* Open a new file */
6872 fff = my_fopen_temp(file_name, 1024);
6875 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6877 msg_format("Failed to create temporary file %s.", file_name);
6883 for (i = 0; i < 5; i++)
6885 for (num = 0; num < 64; num++)
6887 for (j = 0; j < max_k_idx; j++)
6889 object_kind *k_ptr = &k_info[j];
6891 if ((k_ptr->tval == TV_SWORD - i) && (k_ptr->sval == num))
6893 if ((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON)) continue;
6895 weapon_exp = p_ptr->weapon_exp[4 - i][num];
6897 fprintf(fff, "%-25s ", tmp);
6898 if (weapon_exp >= s_info[p_ptr->pclass].w_max[4 - i][num]) fprintf(fff, "!");
6899 else fprintf(fff, " ");
6900 fprintf(fff, "%s", exp_level_str[weapon_exp_level(weapon_exp)]);
6901 if (cheat_xtra) fprintf(fff, " %d", weapon_exp);
6909 /* Close the file */
6912 /* Display the file contents */
6914 show_file(TRUE, file_name, "Éð´ï¤Î·Ð¸³ÃÍ", 0, 0);
6916 show_file(TRUE, file_name, "Weapon Proficiency", 0, 0);
6920 /* Remove the file */
6928 static void do_cmd_knowledge_spell_exp(void)
6930 int i = 0, spell_exp, exp_level;
6933 const magic_type *s_ptr;
6935 char file_name[1024];
6937 /* Open a new file */
6938 fff = my_fopen_temp(file_name, 1024);
6941 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6943 msg_format("Failed to create temporary file %s.", file_name);
6949 if (p_ptr->realm1 != REALM_NONE)
6952 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm1]);
6954 fprintf(fff, "%s Spellbook\n", realm_names[p_ptr->realm1]);
6956 for (i = 0; i < 32; i++)
6958 if (!is_magic(p_ptr->realm1))
6960 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][i];
6964 s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][i];
6966 if (s_ptr->slevel >= 99) continue;
6967 spell_exp = p_ptr->spell_exp[i];
6968 exp_level = spell_exp_level(spell_exp);
6969 fprintf(fff, "%-25s ", do_spell(p_ptr->realm1, i, SPELL_NAME));
6970 if (p_ptr->realm1 == REALM_HISSATSU)
6971 fprintf(fff, "[--]");
6974 if (exp_level >= EXP_LEVEL_MASTER) fprintf(fff, "!");
6975 else fprintf(fff, " ");
6976 fprintf(fff, "%s", exp_level_str[exp_level]);
6978 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6983 if (p_ptr->realm2 != REALM_NONE)
6986 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm2]);
6988 fprintf(fff, "\n%s Spellbook\n", realm_names[p_ptr->realm2]);
6990 for (i = 0; i < 32; i++)
6992 if (!is_magic(p_ptr->realm1))
6994 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][i];
6998 s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][i];
7000 if (s_ptr->slevel >= 99) continue;
7002 spell_exp = p_ptr->spell_exp[i + 32];
7003 exp_level = spell_exp_level(spell_exp);
7004 fprintf(fff, "%-25s ", do_spell(p_ptr->realm2, i, SPELL_NAME));
7005 if (exp_level >= EXP_LEVEL_EXPERT) fprintf(fff, "!");
7006 else fprintf(fff, " ");
7007 fprintf(fff, "%s", exp_level_str[exp_level]);
7008 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
7013 /* Close the file */
7016 /* Display the file contents */
7018 show_file(TRUE, file_name, "ËâË¡¤Î·Ð¸³ÃÍ", 0, 0);
7020 show_file(TRUE, file_name, "Spell Proficiency", 0, 0);
7024 /* Remove the file */
7032 static void do_cmd_knowledge_skill_exp(void)
7034 int i = 0, skill_exp;
7038 char file_name[1024];
7040 char skill_name[3][17]={"¥Þ¡¼¥·¥ã¥ë¥¢¡¼¥Ä", "ÆóÅáή ", "¾èÇÏ "};
7042 char skill_name[3][20]={"Martial Arts ", "Dual Wielding ", "Riding "};
7045 /* Open a new file */
7046 fff = my_fopen_temp(file_name, 1024);
7049 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7051 msg_format("Failed to create temporary file %s.", file_name);
7057 for (i = 0; i < 3; i++)
7059 skill_exp = p_ptr->skill_exp[i];
7060 fprintf(fff, "%-20s ", skill_name[i]);
7061 if (skill_exp >= s_info[p_ptr->pclass].s_max[i]) fprintf(fff, "!");
7062 else fprintf(fff, " ");
7063 fprintf(fff, "%s", exp_level_str[(i == GINOU_RIDING) ? riding_exp_level(skill_exp) : weapon_exp_level(skill_exp)]);
7064 if (cheat_xtra) fprintf(fff, " %d", skill_exp);
7068 /* Close the file */
7071 /* Display the file contents */
7073 show_file(TRUE, file_name, "µ»Ç½¤Î·Ð¸³ÃÍ", 0, 0);
7075 show_file(TRUE, file_name, "Miscellaneous Proficiency", 0, 0);
7079 /* Remove the file */
7085 * Pluralize a monster name
7087 void plural_aux(char *Name)
7089 int NameLen = strlen(Name);
7091 if (my_strstr(Name, "Disembodied hand"))
7093 strcpy(Name, "Disembodied hands that strangled people");
7095 else if (my_strstr(Name, "Colour out of space"))
7097 strcpy(Name, "Colours out of space");
7099 else if (my_strstr(Name, "stairway to hell"))
7101 strcpy(Name, "stairways to hell");
7103 else if (my_strstr(Name, "Dweller on the threshold"))
7105 strcpy(Name, "Dwellers on the threshold");
7107 else if (my_strstr(Name, " of "))
7109 cptr aider = my_strstr(Name, " of ");
7120 if (dummy[i-1] == 's')
7122 strcpy(&(dummy[i]), "es");
7127 strcpy(&(dummy[i]), "s");
7130 strcpy(&(dummy[i+1]), aider);
7131 strcpy(Name, dummy);
7133 else if (my_strstr(Name, "coins"))
7136 strcpy(dummy, "piles of ");
7137 strcat(dummy, Name);
7138 strcpy(Name, dummy);
7141 else if (my_strstr(Name, "Manes"))
7145 else if (streq(&(Name[NameLen - 2]), "ey"))
7147 strcpy(&(Name[NameLen - 2]), "eys");
7149 else if (Name[NameLen - 1] == 'y')
7151 strcpy(&(Name[NameLen - 1]), "ies");
7153 else if (streq(&(Name[NameLen - 4]), "ouse"))
7155 strcpy(&(Name[NameLen - 4]), "ice");
7157 else if (streq(&(Name[NameLen - 2]), "us"))
7159 strcpy(&(Name[NameLen - 2]), "i");
7161 else if (streq(&(Name[NameLen - 6]), "kelman"))
7163 strcpy(&(Name[NameLen - 6]), "kelmen");
7165 else if (streq(&(Name[NameLen - 8]), "wordsman"))
7167 strcpy(&(Name[NameLen - 8]), "wordsmen");
7169 else if (streq(&(Name[NameLen - 7]), "oodsman"))
7171 strcpy(&(Name[NameLen - 7]), "oodsmen");
7173 else if (streq(&(Name[NameLen - 7]), "eastman"))
7175 strcpy(&(Name[NameLen - 7]), "eastmen");
7177 else if (streq(&(Name[NameLen - 8]), "izardman"))
7179 strcpy(&(Name[NameLen - 8]), "izardmen");
7181 else if (streq(&(Name[NameLen - 5]), "geist"))
7183 strcpy(&(Name[NameLen - 5]), "geister");
7185 else if (streq(&(Name[NameLen - 2]), "ex"))
7187 strcpy(&(Name[NameLen - 2]), "ices");
7189 else if (streq(&(Name[NameLen - 2]), "lf"))
7191 strcpy(&(Name[NameLen - 2]), "lves");
7193 else if (suffix(Name, "ch") ||
7194 suffix(Name, "sh") ||
7195 suffix(Name, "nx") ||
7196 suffix(Name, "s") ||
7199 strcpy(&(Name[NameLen]), "es");
7203 strcpy(&(Name[NameLen]), "s");
7208 * Display current pets
7210 static void do_cmd_knowledge_pets(void)
7214 monster_type *m_ptr;
7217 int show_upkeep = 0;
7218 char file_name[1024];
7221 /* Open a new file */
7222 fff = my_fopen_temp(file_name, 1024);
7225 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7227 msg_format("Failed to create temporary file %s.", file_name);
7233 /* Process the monsters (backwards) */
7234 for (i = m_max - 1; i >= 1; i--)
7236 /* Access the monster */
7239 /* Ignore "dead" monsters */
7240 if (!m_ptr->r_idx) continue;
7242 /* Calculate "upkeep" for pets */
7246 monster_desc(pet_name, m_ptr, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
7247 fprintf(fff, "%s (%s)\n", pet_name, look_mon_desc(m_ptr, 0x00));
7251 show_upkeep = calculate_upkeep();
7253 fprintf(fff, "----------------------------------------------\n");
7255 fprintf(fff, " ¹ç·×: %d ÂΤΥڥåÈ\n", t_friends);
7256 fprintf(fff, " °Ý»ý¥³¥¹¥È: %d%% MP\n", show_upkeep);
7258 fprintf(fff, " Total: %d pet%s.\n",
7259 t_friends, (t_friends == 1 ? "" : "s"));
7260 fprintf(fff, " Upkeep: %d%% mana.\n", show_upkeep);
7265 /* Close the file */
7268 /* Display the file contents */
7270 show_file(TRUE, file_name, "¸½ºß¤Î¥Ú¥Ã¥È", 0, 0);
7272 show_file(TRUE, file_name, "Current Pets", 0, 0);
7276 /* Remove the file */
7284 * Note that the player ghosts are ignored. XXX XXX XXX
7286 static void do_cmd_knowledge_kill_count(void)
7294 char file_name[1024];
7299 /* Open a new file */
7300 fff = my_fopen_temp(file_name, 1024);
7304 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7306 msg_format("Failed to create temporary file %s.", file_name);
7312 /* Allocate the "who" array */
7313 C_MAKE(who, max_r_idx, s16b);
7316 /* Monsters slain */
7319 for (kk = 1; kk < max_r_idx; kk++)
7321 monster_race *r_ptr = &r_info[kk];
7323 if (r_ptr->flags1 & (RF1_UNIQUE))
7325 bool dead = (r_ptr->max_num == 0);
7334 s16b This = r_ptr->r_pkills;
7345 fprintf(fff,"¤¢¤Ê¤¿¤Ï¤Þ¤ÀŨ¤òÅݤ·¤Æ¤¤¤Ê¤¤¡£\n\n");
7347 fprintf(fff,"You have defeated no enemies yet.\n\n");
7351 fprintf(fff,"¤¢¤Ê¤¿¤Ï%ldÂΤÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n", (long int)Total);
7353 fprintf(fff,"You have defeated %ld %s.\n\n", (long int)Total, (Total == 1) ? "enemy" : "enemies");
7359 /* Scan the monsters */
7360 for (i = 1; i < max_r_idx; i++)
7362 monster_race *r_ptr = &r_info[i];
7364 /* Use that monster */
7365 if (r_ptr->name) who[n++] = i;
7368 /* Select the sort method */
7369 ang_sort_comp = ang_sort_comp_hook;
7370 ang_sort_swap = ang_sort_swap_hook;
7372 /* Sort the array by dungeon depth of monsters */
7373 ang_sort(who, &why, n);
7375 /* Scan the monster races */
7376 for (k = 0; k < n; k++)
7378 monster_race *r_ptr = &r_info[who[k]];
7380 if (r_ptr->flags1 & (RF1_UNIQUE))
7382 bool dead = (r_ptr->max_num == 0);
7386 /* Print a message */
7387 fprintf(fff, " %s\n",
7388 (r_name + r_ptr->name));
7394 s16b This = r_ptr->r_pkills;
7399 /* p,t¤Ï¿Í¤È¿ô¤¨¤ë by ita */
7400 if (my_strchr("pt", r_ptr->d_char))
7401 fprintf(fff, " %3d ¿Í¤Î %s\n", This, r_name + r_ptr->name);
7403 fprintf(fff, " %3d ÂΤΠ%s\n", This, r_name + r_ptr->name);
7407 if (my_strstr(r_name + r_ptr->name, "coins"))
7409 fprintf(fff, " 1 pile of %s\n", (r_name + r_ptr->name));
7413 fprintf(fff, " 1 %s\n", (r_name + r_ptr->name));
7419 strcpy(ToPlural, (r_name + r_ptr->name));
7420 plural_aux(ToPlural);
7421 fprintf(fff, " %d %s\n", This, ToPlural);
7431 fprintf(fff,"----------------------------------------------\n");
7433 fprintf(fff," ¹ç·×: %lu ÂΤòÅݤ·¤¿¡£\n", (unsigned long int)Total);
7435 fprintf(fff," Total: %lu creature%s killed.\n",
7436 (unsigned long int)Total, (Total == 1 ? "" : "s"));
7440 /* Free the "who" array */
7441 C_KILL(who, max_r_idx, s16b);
7443 /* Close the file */
7446 /* Display the file contents */
7448 show_file(TRUE, file_name, "Åݤ·¤¿Å¨¤Î¿ô", 0, 0);
7450 show_file(TRUE, file_name, "Kill Count", 0, 0);
7454 /* Remove the file */
7460 * Display the object groups.
7462 static void display_group_list(int col, int row, int wid, int per_page,
7463 int grp_idx[], cptr group_text[], int grp_cur, int grp_top)
7467 /* Display lines until done */
7468 for (i = 0; i < per_page && (grp_idx[i] >= 0); i++)
7470 /* Get the group index */
7471 int grp = grp_idx[grp_top + i];
7473 /* Choose a color */
7474 byte attr = (grp_top + i == grp_cur) ? TERM_L_BLUE : TERM_WHITE;
7476 /* Erase the entire line */
7477 Term_erase(col, row + i, wid);
7479 /* Display the group label */
7480 c_put_str(attr, group_text[grp], row + i, col);
7486 * Move the cursor in a browser window
7488 static void browser_cursor(char ch, int *column, int *grp_cur, int grp_cnt,
7489 int *list_cur, int list_cnt)
7494 int list = *list_cur;
7496 /* Extract direction */
7499 /* Hack -- scroll up full screen */
7504 /* Hack -- scroll down full screen */
7509 d = get_keymap_dir(ch);
7514 /* Diagonals - hack */
7515 if ((ddx[d] > 0) && ddy[d])
7521 Term_get_size(&wid, &hgt);
7523 browser_rows = hgt - 8;
7525 /* Browse group list */
7530 /* Move up or down */
7531 grp += ddy[d] * (browser_rows - 1);
7534 if (grp >= grp_cnt) grp = grp_cnt - 1;
7535 if (grp < 0) grp = 0;
7536 if (grp != old_grp) list = 0;
7539 /* Browse sub-list list */
7542 /* Move up or down */
7543 list += ddy[d] * browser_rows;
7546 if (list >= list_cnt) list = list_cnt - 1;
7547 if (list < 0) list = 0;
7559 if (col < 0) col = 0;
7560 if (col > 1) col = 1;
7567 /* Browse group list */
7572 /* Move up or down */
7576 if (grp >= grp_cnt) grp = grp_cnt - 1;
7577 if (grp < 0) grp = 0;
7578 if (grp != old_grp) list = 0;
7581 /* Browse sub-list list */
7584 /* Move up or down */
7588 if (list >= list_cnt) list = list_cnt - 1;
7589 if (list < 0) list = 0;
7600 static void display_visual_list(int col, int row, int height, int width, byte attr_top, byte char_left)
7604 /* Clear the display lines */
7605 for (i = 0; i < height; i++)
7607 Term_erase(col, row + i, width);
7610 /* Bigtile mode uses double width */
7611 if (use_bigtile) width /= 2;
7613 /* Display lines until done */
7614 for (i = 0; i < height; i++)
7616 /* Display columns until done */
7617 for (j = 0; j < width; j++)
7625 /* Bigtile mode uses double width */
7626 if (use_bigtile) x += j;
7631 /* Ignore illegal characters */
7632 if (ia > 0x7f || ic > 0xff || ic < ' ' ||
7633 (!use_graphics && ic > 0x7f))
7639 /* Force correct code for both ASCII character and tile */
7640 if (c & 0x80) a |= 0x80;
7642 /* Display symbol */
7643 Term_queue_bigchar(x, y, a, c, 0, 0);
7650 * Place the cursor at the collect position for visual mode
7652 static void place_visual_list_cursor(int col, int row, byte a, byte c, byte attr_top, byte char_left)
7654 int i = (a & 0x7f) - attr_top;
7655 int j = c - char_left;
7660 /* Bigtile mode uses double width */
7661 if (use_bigtile) x += j;
7663 /* Place the cursor */
7669 * Clipboard variables for copy&paste in visual mode
7671 static byte attr_idx = 0;
7672 static byte char_idx = 0;
7674 /* Hack -- for feature lighting */
7675 static byte attr_idx_feat[F_LIT_MAX];
7676 static byte char_idx_feat[F_LIT_MAX];
7679 * Do visual mode command -- Change symbols
7681 static bool visual_mode_command(char ch, bool *visual_list_ptr,
7682 int height, int width,
7683 byte *attr_top_ptr, byte *char_left_ptr,
7684 byte *cur_attr_ptr, byte *cur_char_ptr, bool *need_redraw)
7686 static byte attr_old = 0, char_old = 0;
7691 if (*visual_list_ptr)
7694 *cur_attr_ptr = attr_old;
7695 *cur_char_ptr = char_old;
7696 *visual_list_ptr = FALSE;
7704 if (*visual_list_ptr)
7707 *visual_list_ptr = FALSE;
7708 *need_redraw = TRUE;
7716 if (!*visual_list_ptr)
7718 *visual_list_ptr = TRUE;
7720 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7721 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7723 attr_old = *cur_attr_ptr;
7724 char_old = *cur_char_ptr;
7735 /* Set the visual */
7736 attr_idx = *cur_attr_ptr;
7737 char_idx = *cur_char_ptr;
7739 /* Hack -- for feature lighting */
7740 for (i = 0; i < F_LIT_MAX; i++)
7742 attr_idx_feat[i] = 0;
7743 char_idx_feat[i] = 0;
7750 if (attr_idx || (!(char_idx & 0x80) && char_idx)) /* Allow TERM_DARK text */
7753 *cur_attr_ptr = attr_idx;
7754 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7755 if (!*visual_list_ptr) *need_redraw = TRUE;
7761 *cur_char_ptr = char_idx;
7762 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7763 if (!*visual_list_ptr) *need_redraw = TRUE;
7769 if (*visual_list_ptr)
7772 int d = get_keymap_dir(ch);
7773 byte a = (*cur_attr_ptr & 0x7f);
7774 byte c = *cur_char_ptr;
7776 if (use_bigtile) eff_width = width / 2;
7777 else eff_width = width;
7779 /* Restrict direction */
7780 if ((a == 0) && (ddy[d] < 0)) d = 0;
7781 if ((c == 0) && (ddx[d] < 0)) d = 0;
7782 if ((a == 0x7f) && (ddy[d] > 0)) d = 0;
7783 if ((c == 0xff) && (ddx[d] > 0)) d = 0;
7788 /* Force correct code for both ASCII character and tile */
7789 if (c & 0x80) a |= 0x80;
7791 /* Set the visual */
7796 /* Move the frame */
7797 if ((ddx[d] < 0) && *char_left_ptr > MAX(0, (int)c - 10)) (*char_left_ptr)--;
7798 if ((ddx[d] > 0) && *char_left_ptr + eff_width < MIN(0xff, (int)c + 10)) (*char_left_ptr)++;
7799 if ((ddy[d] < 0) && *attr_top_ptr > MAX(0, (int)(a & 0x7f) - 4)) (*attr_top_ptr)--;
7800 if ((ddy[d] > 0) && *attr_top_ptr + height < MIN(0x7f, (a & 0x7f) + 4)) (*attr_top_ptr)++;
7806 /* Visual mode command is not used */
7812 * Display the monsters in a group.
7814 static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
7815 int mon_cur, int mon_top, bool visual_only)
7819 /* Display lines until done */
7820 for (i = 0; i < per_page && (mon_idx[mon_top + i] >= 0); i++)
7824 /* Get the race index */
7825 int r_idx = mon_idx[mon_top + i] ;
7827 /* Access the race */
7828 monster_race *r_ptr = &r_info[r_idx];
7830 /* Choose a color */
7831 attr = ((i + mon_top == mon_cur) ? TERM_L_BLUE : TERM_WHITE);
7833 /* Display the name */
7834 c_prt(attr, (r_name + r_ptr->name), row + i, col);
7836 /* Hack -- visual_list mode */
7839 c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, (p_ptr->wizard || visual_only) ? 56 : 61);
7841 if (p_ptr->wizard || visual_only)
7843 c_prt(attr, format("%d", r_idx), row + i, 62);
7846 /* Erase chars before overwritten by the race letter */
7847 Term_erase(69, row + i, 255);
7849 /* Display symbol */
7850 Term_queue_bigchar(use_bigtile ? 69 : 70, row + i, r_ptr->x_attr, r_ptr->x_char, 0, 0);
7855 if (!(r_ptr->flags1 & RF1_UNIQUE)) put_str(format("%5d", r_ptr->r_pkills), row + i, 73);
7857 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? "»àË´" : "À¸Â¸"), row + i, 74);
7859 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? " dead" : "alive"), row + i, 73);
7864 /* Clear remaining lines */
7865 for (; i < per_page; i++)
7867 Term_erase(col, row + i, 255);
7873 * Display known monsters.
7875 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, int direct_r_idx)
7878 int grp_cur, grp_top, old_grp_cur;
7879 int mon_cur, mon_top;
7880 int grp_cnt, grp_idx[100];
7888 bool visual_list = FALSE;
7889 byte attr_top = 0, char_left = 0;
7897 Term_get_size(&wid, &hgt);
7899 browser_rows = hgt - 8;
7901 /* Allocate the "mon_idx" array */
7902 C_MAKE(mon_idx, max_r_idx, s16b);
7907 if (direct_r_idx < 0)
7909 mode = visual_only ? 0x03 : 0x01;
7911 /* Check every group */
7912 for (i = 0; monster_group_text[i] != NULL; i++)
7914 /* Measure the label */
7915 len = strlen(monster_group_text[i]);
7917 /* Save the maximum length */
7918 if (len > max) max = len;
7920 /* See if any monsters are known */
7921 if ((monster_group_char[i] == ((char *) -1L)) || collect_monsters(i, mon_idx, mode))
7923 /* Build a list of groups with known monsters */
7924 grp_idx[grp_cnt++] = i;
7932 mon_idx[0] = direct_r_idx;
7935 /* Terminate the list */
7938 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
7939 &attr_top, &char_left, &r_info[direct_r_idx].x_attr, &r_info[direct_r_idx].x_char, need_redraw);
7942 /* Terminate the list */
7943 grp_idx[grp_cnt] = -1;
7946 grp_cur = grp_top = 0;
7947 mon_cur = mon_top = 0;
7952 mode = visual_only ? 0x02 : 0x00;
7957 monster_race *r_ptr;
7964 prt(format("%s - ¥â¥ó¥¹¥¿¡¼", !visual_only ? "Ãμ±" : "ɽ¼¨"), 2, 0);
7965 if (direct_r_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
7966 prt("̾Á°", 4, max + 3);
7967 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7969 if (!visual_only) prt("»¦³²¿ô", 4, 72);
7971 prt(format("%s - monsters", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
7972 if (direct_r_idx < 0) prt("Group", 4, 0);
7973 prt("Name", 4, max + 3);
7974 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7976 if (!visual_only) prt("Kills", 4, 73);
7979 for (i = 0; i < 78; i++)
7981 Term_putch(i, 5, TERM_WHITE, '=');
7984 if (direct_r_idx < 0)
7986 for (i = 0; i < browser_rows; i++)
7988 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7995 if (direct_r_idx < 0)
7997 /* Scroll group list */
7998 if (grp_cur < grp_top) grp_top = grp_cur;
7999 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8001 /* Display a list of monster groups */
8002 display_group_list(0, 6, max, browser_rows, grp_idx, monster_group_text, grp_cur, grp_top);
8004 if (old_grp_cur != grp_cur)
8006 old_grp_cur = grp_cur;
8008 /* Get a list of monsters in the current group */
8009 mon_cnt = collect_monsters(grp_idx[grp_cur], mon_idx, mode);
8012 /* Scroll monster list */
8013 while (mon_cur < mon_top)
8014 mon_top = MAX(0, mon_top - browser_rows/2);
8015 while (mon_cur >= mon_top + browser_rows)
8016 mon_top = MIN(mon_cnt - browser_rows, mon_top + browser_rows/2);
8021 /* Display a list of monsters in the current group */
8022 display_monster_list(max + 3, 6, browser_rows, mon_idx, mon_cur, mon_top, visual_only);
8028 /* Display a monster name */
8029 display_monster_list(max + 3, 6, 1, mon_idx, mon_cur, mon_top, visual_only);
8031 /* Display visual list below first monster */
8032 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8037 prt(format("<Êý¸þ>%s%s%s, ESC",
8038 (!visual_list && !visual_only) ? ", 'r'¤Ç»×¤¤½Ð¤ò¸«¤ë" : "",
8039 visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
8040 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
8043 prt(format("<dir>%s%s%s, ESC",
8044 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
8045 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
8046 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
8050 /* Get the current monster */
8051 r_ptr = &r_info[mon_idx[mon_cur]];
8055 /* Mega Hack -- track this monster race */
8056 if (mon_cnt) monster_race_track(mon_idx[mon_cur]);
8058 /* Hack -- handle stuff */
8064 place_visual_list_cursor(max + 3, 7, r_ptr->x_attr, r_ptr->x_char, attr_top, char_left);
8068 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8072 Term_gotoxy(max + 3, 6 + (mon_cur - mon_top));
8077 /* Do visual mode command if needed */
8078 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))
8080 if (direct_r_idx >= 0)
8105 /* Recall on screen */
8106 if (!visual_list && !visual_only && (mon_idx[mon_cur] > 0))
8108 screen_roff(mon_idx[mon_cur], 0);
8119 /* Move the cursor */
8120 browser_cursor(ch, &column, &grp_cur, grp_cnt, &mon_cur, mon_cnt);
8127 /* Free the "mon_idx" array */
8128 C_KILL(mon_idx, max_r_idx, s16b);
8133 * Display the objects in a group.
8135 static void display_object_list(int col, int row, int per_page, int object_idx[],
8136 int object_cur, int object_top, bool visual_only)
8140 /* Display lines until done */
8141 for (i = 0; i < per_page && (object_idx[object_top + i] >= 0); i++)
8145 object_kind *flavor_k_ptr;
8147 /* Get the object index */
8148 int k_idx = object_idx[object_top + i];
8150 /* Access the object */
8151 object_kind *k_ptr = &k_info[k_idx];
8153 /* Choose a color */
8154 byte attr = ((k_ptr->aware || visual_only) ? TERM_WHITE : TERM_SLATE);
8155 byte cursor = ((k_ptr->aware || visual_only) ? TERM_L_BLUE : TERM_BLUE);
8158 if (!visual_only && k_ptr->flavor)
8160 /* Appearance of this object is shuffled */
8161 flavor_k_ptr = &k_info[k_ptr->flavor];
8165 /* Appearance of this object is very normal */
8166 flavor_k_ptr = k_ptr;
8171 attr = ((i + object_top == object_cur) ? cursor : attr);
8173 if (!k_ptr->flavor || (!visual_only && k_ptr->aware))
8176 strip_name(o_name, k_idx);
8181 strcpy(o_name, k_name + flavor_k_ptr->flavor_name);
8184 /* Display the name */
8185 c_prt(attr, o_name, row + i, col);
8187 /* Hack -- visual_list mode */
8190 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);
8192 if (p_ptr->wizard || visual_only)
8194 c_prt(attr, format("%d", k_idx), row + i, 70);
8197 a = flavor_k_ptr->x_attr;
8198 c = flavor_k_ptr->x_char;
8200 /* Display symbol */
8201 Term_queue_bigchar(use_bigtile ? 76 : 77, row + i, a, c, 0, 0);
8204 /* Clear remaining lines */
8205 for (; i < per_page; i++)
8207 Term_erase(col, row + i, 255);
8212 * Describe fake object
8214 static void desc_obj_fake(int k_idx)
8217 object_type object_type_body;
8219 /* Get local object */
8220 o_ptr = &object_type_body;
8222 /* Wipe the object */
8225 /* Create the artifact */
8226 object_prep(o_ptr, k_idx);
8228 /* It's fully know */
8229 o_ptr->ident |= IDENT_KNOWN;
8231 /* Track the object */
8232 /* object_actual_track(o_ptr); */
8234 /* Hack - mark as fake */
8235 /* term_obj_real = FALSE; */
8237 /* Hack -- Handle stuff */
8240 if (!screen_object(o_ptr, SCROBJ_FAKE_OBJECT | SCROBJ_FORCE_DETAIL))
8243 msg_print("ÆäËÊѤï¤Ã¤¿¤È¤³¤í¤Ï¤Ê¤¤¤è¤¦¤À¡£");
8245 msg_print("You see nothing special.");
8254 * Display known objects
8256 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int direct_k_idx)
8259 int grp_cur, grp_top, old_grp_cur;
8260 int object_old, object_cur, object_top;
8261 int grp_cnt, grp_idx[100];
8269 bool visual_list = FALSE;
8270 byte attr_top = 0, char_left = 0;
8278 Term_get_size(&wid, &hgt);
8280 browser_rows = hgt - 8;
8282 /* Allocate the "object_idx" array */
8283 C_MAKE(object_idx, max_k_idx, int);
8288 if (direct_k_idx < 0)
8290 mode = visual_only ? 0x03 : 0x01;
8292 /* Check every group */
8293 for (i = 0; object_group_text[i] != NULL; i++)
8295 /* Measure the label */
8296 len = strlen(object_group_text[i]);
8298 /* Save the maximum length */
8299 if (len > max) max = len;
8301 /* See if any monsters are known */
8302 if (collect_objects(i, object_idx, mode))
8304 /* Build a list of groups with known monsters */
8305 grp_idx[grp_cnt++] = i;
8314 object_kind *k_ptr = &k_info[direct_k_idx];
8315 object_kind *flavor_k_ptr;
8317 if (!visual_only && k_ptr->flavor)
8319 /* Appearance of this object is shuffled */
8320 flavor_k_ptr = &k_info[k_ptr->flavor];
8324 /* Appearance of this object is very normal */
8325 flavor_k_ptr = k_ptr;
8328 object_idx[0] = direct_k_idx;
8329 object_old = direct_k_idx;
8332 /* Terminate the list */
8335 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
8336 &attr_top, &char_left, &flavor_k_ptr->x_attr, &flavor_k_ptr->x_char, need_redraw);
8339 /* Terminate the list */
8340 grp_idx[grp_cnt] = -1;
8343 grp_cur = grp_top = 0;
8344 object_cur = object_top = 0;
8349 mode = visual_only ? 0x02 : 0x00;
8354 object_kind *k_ptr, *flavor_k_ptr;
8361 prt(format("%s - ¥¢¥¤¥Æ¥à", !visual_only ? "Ãμ±" : "ɽ¼¨"), 2, 0);
8362 if (direct_k_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
8363 prt("̾Á°", 4, max + 3);
8364 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
8367 prt(format("%s - objects", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
8368 if (direct_k_idx < 0) prt("Group", 4, 0);
8369 prt("Name", 4, max + 3);
8370 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
8374 for (i = 0; i < 78; i++)
8376 Term_putch(i, 5, TERM_WHITE, '=');
8379 if (direct_k_idx < 0)
8381 for (i = 0; i < browser_rows; i++)
8383 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8390 if (direct_k_idx < 0)
8392 /* Scroll group list */
8393 if (grp_cur < grp_top) grp_top = grp_cur;
8394 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8396 /* Display a list of object groups */
8397 display_group_list(0, 6, max, browser_rows, grp_idx, object_group_text, grp_cur, grp_top);
8399 if (old_grp_cur != grp_cur)
8401 old_grp_cur = grp_cur;
8403 /* Get a list of objects in the current group */
8404 object_cnt = collect_objects(grp_idx[grp_cur], object_idx, mode);
8407 /* Scroll object list */
8408 while (object_cur < object_top)
8409 object_top = MAX(0, object_top - browser_rows/2);
8410 while (object_cur >= object_top + browser_rows)
8411 object_top = MIN(object_cnt - browser_rows, object_top + browser_rows/2);
8416 /* Display a list of objects in the current group */
8417 display_object_list(max + 3, 6, browser_rows, object_idx, object_cur, object_top, visual_only);
8421 object_top = object_cur;
8423 /* Display a list of objects in the current group */
8424 display_object_list(max + 3, 6, 1, object_idx, object_cur, object_top, visual_only);
8426 /* Display visual list below first object */
8427 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8430 /* Get the current object */
8431 k_ptr = &k_info[object_idx[object_cur]];
8433 if (!visual_only && k_ptr->flavor)
8435 /* Appearance of this object is shuffled */
8436 flavor_k_ptr = &k_info[k_ptr->flavor];
8440 /* Appearance of this object is very normal */
8441 flavor_k_ptr = k_ptr;
8446 prt(format("<Êý¸þ>%s%s%s, ESC",
8447 (!visual_list && !visual_only) ? ", 'r'¤Ç¾ÜºÙ¤ò¸«¤ë" : "",
8448 visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
8449 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
8452 prt(format("<dir>%s%s%s, ESC",
8453 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
8454 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
8455 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
8461 /* Mega Hack -- track this object */
8462 if (object_cnt) object_kind_track(object_idx[object_cur]);
8464 /* The "current" object changed */
8465 if (object_old != object_idx[object_cur])
8467 /* Hack -- handle stuff */
8470 /* Remember the "current" object */
8471 object_old = object_idx[object_cur];
8477 place_visual_list_cursor(max + 3, 7, flavor_k_ptr->x_attr, flavor_k_ptr->x_char, attr_top, char_left);
8481 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8485 Term_gotoxy(max + 3, 6 + (object_cur - object_top));
8490 /* Do visual mode command if needed */
8491 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))
8493 if (direct_k_idx >= 0)
8518 /* Recall on screen */
8519 if (!visual_list && !visual_only && (grp_cnt > 0))
8521 desc_obj_fake(object_idx[object_cur]);
8529 /* Move the cursor */
8530 browser_cursor(ch, &column, &grp_cur, grp_cnt, &object_cur, object_cnt);
8536 /* Free the "object_idx" array */
8537 C_KILL(object_idx, max_k_idx, int);
8542 * Display the features in a group.
8544 static void display_feature_list(int col, int row, int per_page, int *feat_idx,
8545 int feat_cur, int feat_top, bool visual_only, int lighting_level)
8547 int lit_col[F_LIT_MAX], i, j;
8548 int f_idx_col = use_bigtile ? 62 : 64;
8550 /* Correct columns 1 and 4 */
8551 lit_col[F_LIT_STANDARD] = use_bigtile ? (71 - F_LIT_MAX) : 71;
8552 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
8553 lit_col[i] = lit_col[F_LIT_STANDARD] + 2 + (i - F_LIT_NS_BEGIN) * 2 + (use_bigtile ? i : 0);
8555 /* Display lines until done */
8556 for (i = 0; i < per_page && (feat_idx[feat_top + i] >= 0); i++)
8561 int f_idx = feat_idx[feat_top + i];
8563 /* Access the index */
8564 feature_type *f_ptr = &f_info[f_idx];
8566 int row_i = row + i;
8568 /* Choose a color */
8569 attr = ((i + feat_top == feat_cur) ? TERM_L_BLUE : TERM_WHITE);
8571 /* Display the name */
8572 c_prt(attr, f_name + f_ptr->name, row_i, col);
8574 /* Hack -- visual_list mode */
8577 /* Display lighting level */
8578 c_prt(attr, format("(%s)", lighting_level_str[lighting_level]), row_i, col + 1 + strlen(f_name + f_ptr->name));
8580 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));
8582 if (p_ptr->wizard || visual_only)
8584 c_prt(attr, format("%d", f_idx), row_i, f_idx_col);
8587 /* Display symbol */
8588 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);
8590 Term_putch(lit_col[F_LIT_NS_BEGIN], row_i, TERM_SLATE, '(');
8591 for (j = F_LIT_NS_BEGIN + 1; j < F_LIT_MAX; j++)
8593 Term_putch(lit_col[j], row_i, TERM_SLATE, '/');
8595 Term_putch(lit_col[F_LIT_MAX - 1] + (use_bigtile ? 3 : 2), row_i, TERM_SLATE, ')');
8597 /* Mega-hack -- Use non-standard colour */
8598 for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
8600 Term_queue_bigchar(lit_col[j] + 1, row_i, f_ptr->x_attr[j], f_ptr->x_char[j], 0, 0);
8604 /* Clear remaining lines */
8605 for (; i < per_page; i++)
8607 Term_erase(col, row + i, 255);
8613 * Interact with feature visuals.
8615 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int direct_f_idx, int *lighting_level)
8618 int grp_cur, grp_top, old_grp_cur;
8619 int feat_cur, feat_top;
8620 int grp_cnt, grp_idx[100];
8628 bool visual_list = FALSE;
8629 byte attr_top = 0, char_left = 0;
8634 byte attr_old[F_LIT_MAX];
8635 byte char_old[F_LIT_MAX];
8636 byte *cur_attr_ptr, *cur_char_ptr;
8638 C_WIPE(attr_old, F_LIT_MAX, byte);
8639 C_WIPE(char_old, F_LIT_MAX, byte);
8642 Term_get_size(&wid, &hgt);
8644 browser_rows = hgt - 8;
8646 /* Allocate the "feat_idx" array */
8647 C_MAKE(feat_idx, max_f_idx, int);
8652 if (direct_f_idx < 0)
8654 /* Check every group */
8655 for (i = 0; feature_group_text[i] != NULL; i++)
8657 /* Measure the label */
8658 len = strlen(feature_group_text[i]);
8660 /* Save the maximum length */
8661 if (len > max) max = len;
8663 /* See if any features are known */
8664 if (collect_features(i, feat_idx, 0x01))
8666 /* Build a list of groups with known features */
8667 grp_idx[grp_cnt++] = i;
8675 feature_type *f_ptr = &f_info[direct_f_idx];
8677 feat_idx[0] = direct_f_idx;
8680 /* Terminate the list */
8683 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
8684 &attr_top, &char_left, &f_ptr->x_attr[*lighting_level], &f_ptr->x_char[*lighting_level], need_redraw);
8686 for (i = 0; i < F_LIT_MAX; i++)
8688 attr_old[i] = f_ptr->x_attr[i];
8689 char_old[i] = f_ptr->x_char[i];
8693 /* Terminate the list */
8694 grp_idx[grp_cnt] = -1;
8697 grp_cur = grp_top = 0;
8698 feat_cur = feat_top = 0;
8706 feature_type *f_ptr;
8713 prt("ɽ¼¨ - ÃÏ·Á", 2, 0);
8714 if (direct_f_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
8715 prt("̾Á°", 4, max + 3);
8718 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
8719 prt("ʸ»ú ( l/ d)", 4, 66);
8723 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
8724 prt("ʸ»ú (l/d)", 4, 68);
8727 prt("Visuals - features", 2, 0);
8728 if (direct_f_idx < 0) prt("Group", 4, 0);
8729 prt("Name", 4, max + 3);
8732 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
8733 prt("Sym ( l/ d)", 4, 67);
8737 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
8738 prt("Sym (l/d)", 4, 69);
8742 for (i = 0; i < 78; i++)
8744 Term_putch(i, 5, TERM_WHITE, '=');
8747 if (direct_f_idx < 0)
8749 for (i = 0; i < browser_rows; i++)
8751 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8758 if (direct_f_idx < 0)
8760 /* Scroll group list */
8761 if (grp_cur < grp_top) grp_top = grp_cur;
8762 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8764 /* Display a list of feature groups */
8765 display_group_list(0, 6, max, browser_rows, grp_idx, feature_group_text, grp_cur, grp_top);
8767 if (old_grp_cur != grp_cur)
8769 old_grp_cur = grp_cur;
8771 /* Get a list of features in the current group */
8772 feat_cnt = collect_features(grp_idx[grp_cur], feat_idx, 0x00);
8775 /* Scroll feature list */
8776 while (feat_cur < feat_top)
8777 feat_top = MAX(0, feat_top - browser_rows/2);
8778 while (feat_cur >= feat_top + browser_rows)
8779 feat_top = MIN(feat_cnt - browser_rows, feat_top + browser_rows/2);
8784 /* Display a list of features in the current group */
8785 display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top, visual_only, F_LIT_STANDARD);
8789 feat_top = feat_cur;
8791 /* Display a list of features in the current group */
8792 display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top, visual_only, *lighting_level);
8794 /* Display visual list below first object */
8795 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8800 prt(format("<Êý¸þ>%s, 'd'¤Çɸ½à¸÷¸»¸ú²Ì%s, ESC",
8801 visual_list ? ", ENTER¤Ç·èÄê, 'a'¤ÇÂоÝÌÀÅÙÊѹ¹" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
8802 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
8805 prt(format("<dir>%s, 'd' for default lighting%s, ESC",
8806 visual_list ? ", ENTER to accept, 'a' for lighting level" : ", 'v' for visuals",
8807 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
8811 /* Get the current feature */
8812 f_ptr = &f_info[feat_idx[feat_cur]];
8813 cur_attr_ptr = &f_ptr->x_attr[*lighting_level];
8814 cur_char_ptr = &f_ptr->x_char[*lighting_level];
8818 place_visual_list_cursor(max + 3, 7, *cur_attr_ptr, *cur_char_ptr, attr_top, char_left);
8822 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8826 Term_gotoxy(max + 3, 6 + (feat_cur - feat_top));
8831 if (visual_list && ((ch == 'A') || (ch == 'a')))
8833 int prev_lighting_level = *lighting_level;
8837 if (*lighting_level <= 0) *lighting_level = F_LIT_MAX - 1;
8838 else (*lighting_level)--;
8842 if (*lighting_level >= F_LIT_MAX - 1) *lighting_level = 0;
8843 else (*lighting_level)++;
8846 if (f_ptr->x_attr[prev_lighting_level] != f_ptr->x_attr[*lighting_level])
8847 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
8849 if (f_ptr->x_char[prev_lighting_level] != f_ptr->x_char[*lighting_level])
8850 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
8855 else if ((ch == 'D') || (ch == 'd'))
8857 byte prev_x_attr = f_ptr->x_attr[*lighting_level];
8858 byte prev_x_char = f_ptr->x_char[*lighting_level];
8860 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
8864 if (prev_x_attr != f_ptr->x_attr[*lighting_level])
8865 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
8867 if (prev_x_char != f_ptr->x_char[*lighting_level])
8868 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
8870 else *need_redraw = TRUE;
8875 /* Do visual mode command if needed */
8876 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))
8880 /* Restore previous visual settings */
8882 for (i = 0; i < F_LIT_MAX; i++)
8884 f_ptr->x_attr[i] = attr_old[i];
8885 f_ptr->x_char[i] = char_old[i];
8892 if (direct_f_idx >= 0) flag = TRUE;
8893 else *lighting_level = F_LIT_STANDARD;
8896 /* Preserve current visual settings */
8899 for (i = 0; i < F_LIT_MAX; i++)
8901 attr_old[i] = f_ptr->x_attr[i];
8902 char_old[i] = f_ptr->x_char[i];
8904 *lighting_level = F_LIT_STANDARD;
8911 for (i = 0; i < F_LIT_MAX; i++)
8913 attr_idx_feat[i] = f_ptr->x_attr[i];
8914 char_idx_feat[i] = f_ptr->x_char[i];
8923 /* Allow TERM_DARK text */
8924 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
8926 if (attr_idx_feat[i] || (!(char_idx_feat[i] & 0x80) && char_idx_feat[i])) f_ptr->x_attr[i] = attr_idx_feat[i];
8927 if (char_idx_feat[i]) f_ptr->x_char[i] = char_idx_feat[i];
8945 /* Move the cursor */
8946 browser_cursor(ch, &column, &grp_cur, grp_cnt, &feat_cur, feat_cnt);
8952 /* Free the "feat_idx" array */
8953 C_KILL(feat_idx, max_f_idx, int);
8958 * List wanted monsters
8960 static void do_cmd_knowledge_kubi(void)
8965 char file_name[1024];
8968 /* Open a new file */
8969 fff = my_fopen_temp(file_name, 1024);
8972 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8974 msg_format("Failed to create temporary file %s.", file_name);
8982 bool listed = FALSE;
8985 fprintf(fff, "º£Æü¤Î¥¿¡¼¥²¥Ã¥È : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "ÉÔÌÀ"));
8987 fprintf(fff, "¾Þ¶â¼ó¥ê¥¹¥È\n");
8989 fprintf(fff, "Today target : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "unknown"));
8991 fprintf(fff, "List of wanted monsters\n");
8993 fprintf(fff, "----------------------------------------------\n");
8995 for (i = 0; i < MAX_KUBI; i++)
8997 if (kubi_r_idx[i] <= 10000)
8999 fprintf(fff,"%s\n", r_name + r_info[kubi_r_idx[i]].name);
9008 fprintf(fff,"\n%s\n", "¾Þ¶â¼ó¤Ï¤â¤¦»Ä¤Ã¤Æ¤¤¤Þ¤»¤ó¡£");
9010 fprintf(fff,"\n%s\n", "There is no more wanted monster.");
9015 /* Close the file */
9018 /* Display the file contents */
9020 show_file(TRUE, file_name, "¾Þ¶â¼ó¤Î°ìÍ÷", 0, 0);
9022 show_file(TRUE, file_name, "Wanted monsters", 0, 0);
9026 /* Remove the file */
9031 * List virtues & status
9033 static void do_cmd_knowledge_virtues(void)
9037 char file_name[1024];
9040 /* Open a new file */
9041 fff = my_fopen_temp(file_name, 1024);
9044 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9046 msg_format("Failed to create temporary file %s.", file_name);
9055 fprintf(fff, "¸½ºß¤Î°À : %s\n\n", your_alignment());
9057 fprintf(fff, "Your alighnment : %s\n\n", your_alignment());
9062 /* Close the file */
9065 /* Display the file contents */
9067 show_file(TRUE, file_name, "Ȭ¤Ä¤ÎÆÁ", 0, 0);
9069 show_file(TRUE, file_name, "Virtues", 0, 0);
9073 /* Remove the file */
9081 static void do_cmd_knowledge_dungeon(void)
9085 char file_name[1024];
9089 /* Open a new file */
9090 fff = my_fopen_temp(file_name, 1024);
9093 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9095 msg_format("Failed to create temporary file %s.", file_name);
9103 for (i = 1; i < max_d_idx; i++)
9107 if (!d_info[i].maxdepth) continue;
9108 if (!max_dlv[i]) continue;
9109 if (d_info[i].final_guardian)
9111 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
9113 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
9115 fprintf(fff,"%c%-12s : %3d ³¬\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
9117 fprintf(fff,"%c%-16s : level %3d\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
9122 /* Close the file */
9125 /* Display the file contents */
9127 show_file(TRUE, file_name, "º£¤Þ¤Ç¤ËÆþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó", 0, 0);
9129 show_file(TRUE, file_name, "Dungeon", 0, 0);
9133 /* Remove the file */
9138 * List virtues & status
9141 static void do_cmd_knowledge_stat(void)
9145 char file_name[1024];
9148 /* Open a new file */
9149 fff = my_fopen_temp(file_name, 1024);
9152 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9154 msg_format("Failed to create temporary file %s.", file_name);
9162 percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
9163 (2 * p_ptr->hitdie +
9164 ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
9167 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : %d/100\n\n", percent);
9168 else fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : ???\n\n");
9169 fprintf(fff, "ǽÎϤκÇÂçÃÍ\n\n");
9171 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "Your current Life Rating is %d/100.\n\n", percent);
9172 else fprintf(fff, "Your current Life Rating is ???.\n\n");
9173 fprintf(fff, "Limits of maximum stats\n\n");
9175 for (v_nr = 0; v_nr < 6; v_nr++)
9177 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);
9178 else fprintf(fff, "%s ???\n", stat_names[v_nr]);
9184 /* Close the file */
9187 /* Display the file contents */
9189 show_file(TRUE, file_name, "¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó", 0, 0);
9191 show_file(TRUE, file_name, "HP-rate & Max stat", 0, 0);
9195 /* Remove the file */
9201 * Print all active quests
9203 static void do_cmd_knowledge_quests_current(FILE *fff)
9206 char rand_tmp_str[120] = "\0";
9208 monster_race *r_ptr;
9210 int rand_level = 100;
9214 fprintf(fff, "¡Ô¿ë¹ÔÃæ¤Î¥¯¥¨¥¹¥È¡Õ\n");
9216 fprintf(fff, "< Current Quest >\n");
9219 for (i = 1; i < max_quests; i++)
9221 if ((quest[i].status == QUEST_STATUS_TAKEN) ||
9222 ((quest[i].status == QUEST_STATUS_STAGE_COMPLETED) && (quest[i].type == QUEST_TYPE_TOWER)) ||
9223 (quest[i].status == QUEST_STATUS_COMPLETED))
9225 /* Set the quest number temporary */
9226 int old_quest = p_ptr->inside_quest;
9229 /* Clear the text */
9230 for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
9231 quest_text_line = 0;
9233 p_ptr->inside_quest = i;
9235 /* Get the quest text */
9236 init_flags = INIT_SHOW_TEXT;
9238 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9240 /* Reset the old quest number */
9241 p_ptr->inside_quest = old_quest;
9243 /* No info from "silent" quests */
9244 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
9248 if (quest[i].type != QUEST_TYPE_RANDOM)
9250 char note[80] = "\0";
9252 if (quest[i].status == QUEST_STATUS_TAKEN || quest[i].status == QUEST_STATUS_STAGE_COMPLETED)
9254 switch (quest[i].type)
9256 case QUEST_TYPE_KILL_LEVEL:
9257 case QUEST_TYPE_KILL_ANY_LEVEL:
9258 r_ptr = &r_info[quest[i].r_idx];
9259 strcpy(name, r_name + r_ptr->name);
9260 if (quest[i].max_num > 1)
9263 sprintf(note," - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
9264 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
9267 sprintf(note," - kill %d %s, have killed %d.",
9268 quest[i].max_num, name, quest[i].cur_num);
9273 sprintf(note," - %s¤òÅݤ¹¡£",name);
9275 sprintf(note," - kill %s.",name);
9279 case QUEST_TYPE_FIND_ARTIFACT:
9282 artifact_type *a_ptr = &a_info[quest[i].k_idx];
9284 object_type *q_ptr = &forge;
9285 int k_idx = lookup_kind(a_ptr->tval, a_ptr->sval);
9286 object_prep(q_ptr, k_idx);
9287 q_ptr->name1 = quest[i].k_idx;
9288 q_ptr->ident = IDENT_STORE;
9289 object_desc(name, q_ptr, OD_NAME_ONLY);
9292 sprintf(note,"\n - %s¤ò¸«¤Ä¤±½Ð¤¹¡£", name);
9294 sprintf(note,"\n - Find out %s.", name);
9297 case QUEST_TYPE_FIND_EXIT:
9299 sprintf(note," - ½Ð¸ý¤ËÅþ㤹¤ë¡£");
9301 sprintf(note," - Reach to Exit.");
9305 case QUEST_TYPE_KILL_NUMBER:
9307 sprintf(note," - %d ÂΤΥâ¥ó¥¹¥¿¡¼¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
9308 quest[i].max_num, quest[i].max_num - quest[i].cur_num);
9310 sprintf(note," - Kill %d monsters, have killed %d.",
9311 quest[i].max_num, quest[i].cur_num);
9315 case QUEST_TYPE_KILL_ALL:
9316 case QUEST_TYPE_TOWER:
9318 sprintf(note," - Á´¤Æ¤Î¥â¥ó¥¹¥¿¡¼¤òÅݤ¹¡£");
9320 sprintf(note," - Kill all monsters.");
9326 /* Print the quest info */
9328 sprintf(tmp_str, " %s (´í¸±ÅÙ:%d³¬ÁêÅö)%s\n",
9329 quest[i].name, quest[i].level, note);
9331 sprintf(tmp_str, " %s (Danger level: %d)%s\n",
9332 quest[i].name, quest[i].level, note);
9335 fputs(tmp_str, fff);
9337 if (quest[i].status == QUEST_STATUS_COMPLETED)
9340 sprintf(tmp_str, " ¥¯¥¨¥¹¥ÈãÀ® - ¤Þ¤ÀÊó½·¤ò¼õ¤±¤È¤Ã¤Æ¤Ê¤¤¡£\n");
9342 sprintf(tmp_str, " Quest Completed - Unrewarded\n");
9344 fputs(tmp_str, fff);
9350 while (quest_text[j][0] && j < 10)
9352 fprintf(fff, " %s\n", quest_text[j]);
9357 else if (quest[i].level < rand_level) /* QUEST_TYPE_RANDOM */
9360 rand_level = quest[i].level;
9362 if (max_dlv[DUNGEON_ANGBAND] >= rand_level)
9364 /* Print the quest info */
9365 r_ptr = &r_info[quest[i].r_idx];
9366 strcpy(name, r_name + r_ptr->name);
9368 if (quest[i].max_num > 1)
9371 sprintf(rand_tmp_str," %s (%d ³¬) - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)\n",
9372 quest[i].name, quest[i].level,
9373 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
9377 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
9378 quest[i].name, quest[i].level,
9379 quest[i].max_num, name, quest[i].cur_num);
9385 sprintf(rand_tmp_str," %s (%d ³¬) - %s¤òÅݤ¹¡£\n",
9386 quest[i].name, quest[i].level, name);
9388 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %s.\n",
9389 quest[i].name, quest[i].level, name);
9397 /* Print the current random quest */
9398 if (rand_tmp_str[0]) fputs(rand_tmp_str, fff);
9401 if (!total) fprintf(fff, " ¤Ê¤·\n");
9403 if (!total) fprintf(fff, " Nothing.\n");
9409 * Print all finished quests
9411 void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[])
9418 fprintf(fff, "¡ÔãÀ®¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
9420 fprintf(fff, "< Completed Quest >\n");
9422 for (i = 1; i < max_quests; i++)
9424 int q_idx = quest_num[i];
9426 if (quest[q_idx].status == QUEST_STATUS_FINISHED)
9428 if (is_fixed_quest_idx(q_idx))
9430 /* Set the quest number temporary */
9431 int old_quest = p_ptr->inside_quest;
9433 p_ptr->inside_quest = q_idx;
9436 init_flags = INIT_NAME_ONLY;
9438 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9440 /* Reset the old quest number */
9441 p_ptr->inside_quest = old_quest;
9443 /* No info from "silent" quests */
9444 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
9449 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
9451 /* Print the quest info */
9453 if (quest[q_idx].complev == 0)
9457 " %-40s (%3d³¬) - ÉÔÀᄀ\n",
9459 " %-40s (Dungeon level: %3d) - (Cancelled)\n",
9461 r_name+r_info[quest[q_idx].r_idx].name,
9462 quest[q_idx].level);
9468 " %-40s (%3d³¬) - ¥ì¥Ù¥ë%2d\n",
9470 " %-40s (Dungeon level: %3d) - level %2d\n",
9472 r_name+r_info[quest[q_idx].r_idx].name,
9474 quest[q_idx].complev);
9479 /* Print the quest info */
9481 sprintf(tmp_str, " %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
9482 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9484 sprintf(tmp_str, " %-40s (Danger level: %3d) - level %2d\n",
9485 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9489 fputs(tmp_str, fff);
9493 if (!total) fprintf(fff, " ¤Ê¤·\n");
9495 if (!total) fprintf(fff, " Nothing.\n");
9501 * Print all failed quests
9503 void do_cmd_knowledge_quests_failed(FILE *fff, int quest_num[])
9510 fprintf(fff, "¡Ô¼ºÇÔ¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
9512 fprintf(fff, "< Failed Quest >\n");
9514 for (i = 1; i < max_quests; i++)
9516 int q_idx = quest_num[i];
9518 if ((quest[q_idx].status == QUEST_STATUS_FAILED_DONE) || (quest[q_idx].status == QUEST_STATUS_FAILED))
9520 if (is_fixed_quest_idx(q_idx))
9522 /* Set the quest number temporary */
9523 int old_quest = p_ptr->inside_quest;
9525 p_ptr->inside_quest = q_idx;
9527 /* Get the quest text */
9528 init_flags = INIT_NAME_ONLY;
9530 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9532 /* Reset the old quest number */
9533 p_ptr->inside_quest = old_quest;
9535 /* No info from "silent" quests */
9536 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
9541 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
9543 /* Print the quest info */
9545 sprintf(tmp_str, " %-40s (%3d³¬) - ¥ì¥Ù¥ë%2d\n",
9546 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
9548 sprintf(tmp_str, " %-40s (Dungeon level: %3d) - level %2d\n",
9549 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
9554 /* Print the quest info */
9556 sprintf(tmp_str, " %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
9557 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9559 sprintf(tmp_str, " %-40s (Danger level: %3d) - level %2d\n",
9560 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9563 fputs(tmp_str, fff);
9567 if (!total) fprintf(fff, " ¤Ê¤·\n");
9569 if (!total) fprintf(fff, " Nothing.\n");
9575 * Print all random quests
9577 static void do_cmd_knowledge_quests_wiz_random(FILE *fff)
9584 fprintf(fff, "¡Ô»Ä¤ê¤Î¥é¥ó¥À¥à¥¯¥¨¥¹¥È¡Õ\n");
9586 fprintf(fff, "< Remaining Random Quest >\n");
9588 for (i = 1; i < max_quests; i++)
9590 /* No info from "silent" quests */
9591 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
9593 if ((quest[i].type == QUEST_TYPE_RANDOM) && (quest[i].status == QUEST_STATUS_TAKEN))
9597 /* Print the quest info */
9599 sprintf(tmp_str, " %s (%d³¬, %s)\n",
9600 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
9602 sprintf(tmp_str, " %s (%d, %s)\n",
9603 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
9605 fputs(tmp_str, fff);
9609 if (!total) fprintf(fff, " ¤Ê¤·\n");
9611 if (!total) fprintf(fff, " Nothing.\n");
9616 bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b)
9618 int *q_num = (int *)u;
9619 quest_type *qa = &quest[q_num[a]];
9620 quest_type *qb = &quest[q_num[b]];
9625 if (qa->complev < qb->complev) return TRUE;
9626 if (qa->complev > qb->complev) return FALSE;
9627 if (qa->level <= qb->level) return TRUE;
9631 void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b)
9633 int *q_num = (int *)u;
9640 q_num[a] = q_num[b];
9646 * Print quest status of all active quests
9648 static void do_cmd_knowledge_quests(void)
9651 char file_name[1024];
9652 int *quest_num, dummy, i;
9654 /* Open a new file */
9655 fff = my_fopen_temp(file_name, 1024);
9659 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9661 msg_format("Failed to create temporary file %s.", file_name);
9667 /* Allocate Memory */
9668 C_MAKE(quest_num, max_quests, int);
9670 /* Sort by compete level */
9671 for (i = 1; i < max_quests; i++) quest_num[i] = i;
9672 ang_sort_comp = ang_sort_comp_quest_num;
9673 ang_sort_swap = ang_sort_swap_quest_num;
9674 ang_sort(quest_num, &dummy, max_quests);
9676 /* Dump Quest Information */
9677 do_cmd_knowledge_quests_current(fff);
9679 do_cmd_knowledge_quests_completed(fff, quest_num);
9681 do_cmd_knowledge_quests_failed(fff, quest_num);
9685 do_cmd_knowledge_quests_wiz_random(fff);
9688 /* Close the file */
9691 /* Display the file contents */
9693 show_file(TRUE, file_name, "¥¯¥¨¥¹¥ÈãÀ®¾õ¶·", 0, 0);
9695 show_file(TRUE, file_name, "Quest status", 0, 0);
9698 /* Remove the file */
9702 C_KILL(quest_num, max_quests, int);
9709 static void do_cmd_knowledge_home(void)
9714 char file_name[1024];
9716 char o_name[MAX_NLEN];
9719 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
9721 /* Open a new file */
9722 fff = my_fopen_temp(file_name, 1024);
9725 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9727 msg_format("Failed to create temporary file %s.", file_name);
9735 /* Print all homes in the different towns */
9736 st_ptr = &town[1].store[STORE_HOME];
9738 /* Home -- if anything there */
9739 if (st_ptr->stock_num)
9744 /* Header with name of the town */
9746 fprintf(fff, " [ ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ]\n");
9748 fprintf(fff, " [Home Inventory]\n");
9751 /* Dump all available items */
9752 for (i = 0; i < st_ptr->stock_num; i++)
9755 if ((i % 12) == 0) fprintf(fff, "\n ( %d ¥Ú¡¼¥¸ )\n", x++);
9756 object_desc(o_name, &st_ptr->stock[i], 0);
9757 if (strlen(o_name) <= 80-3)
9759 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9765 for (n = 0, t = o_name; n < 80-3; n++, t++)
9766 if(iskanji(*t)) {t++; n++;}
9767 if (n == 81-3) n = 79-3; /* ºÇ¸å¤¬´Á»úȾʬ */
9769 fprintf(fff, "%c%s %.*s\n", I2A(i%12), paren, n, o_name);
9770 fprintf(fff, " %.77s\n", o_name+n);
9773 object_desc(o_name, &st_ptr->stock[i], 0);
9774 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9779 /* Add an empty line */
9780 fprintf(fff, "\n\n");
9784 /* Close the file */
9787 /* Display the file contents */
9789 show_file(TRUE, file_name, "²æ¤¬²È¤Î¥¢¥¤¥Æ¥à", 0, 0);
9791 show_file(TRUE, file_name, "Home Inventory", 0, 0);
9795 /* Remove the file */
9801 * Check the status of "autopick"
9803 static void do_cmd_knowledge_autopick(void)
9807 char file_name[1024];
9809 /* Open a new file */
9810 fff = my_fopen_temp(file_name, 1024);
9815 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9817 msg_format("Failed to create temporary file %s.", file_name);
9826 fprintf(fff, "¼«Æ°Ç˲õ/½¦¤¤¤Ë¤Ï²¿¤âÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
9828 fprintf(fff, "No preference for auto picker/destroyer.");
9834 fprintf(fff, " ¼«Æ°½¦¤¤/Ç˲õ¤Ë¤Ï¸½ºß %d¹ÔÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤¹¡£\n\n", max_autopick);
9836 fprintf(fff, " There are %d registered lines for auto picker/destroyer.\n\n", max_autopick);
9840 for (k = 0; k < max_autopick; k++)
9843 byte act = autopick_list[k].action;
9844 if (act & DONT_AUTOPICK)
9852 else if (act & DO_AUTODESTROY)
9860 else if (act & DO_AUTOPICK)
9868 else /* if (act & DO_QUERY_AUTOPICK) */ /* Obvious */
9877 if (act & DO_DISPLAY)
9878 fprintf(fff, "%11s", format("[%s]", tmp));
9880 fprintf(fff, "%11s", format("(%s)", tmp));
9882 tmp = autopick_line_from_entry(&autopick_list[k]);
9883 fprintf(fff, " %s", tmp);
9887 /* Close the file */
9889 /* Display the file contents */
9891 show_file(TRUE, file_name, "¼«Æ°½¦¤¤/Ç˲õ ÀßÄê¥ê¥¹¥È", 0, 0);
9893 show_file(TRUE, file_name, "Auto-picker/Destroyer", 0, 0);
9896 /* Remove the file */
9902 * Interact with "knowledge"
9904 void do_cmd_knowledge(void)
9907 bool need_redraw = FALSE;
9909 /* File type is "TEXT" */
9910 FILE_TYPE(FILE_TYPE_TEXT);
9912 /* Save the screen */
9915 /* Interact until done */
9921 /* Ask for a choice */
9923 prt(format("%d/2 ¥Ú¡¼¥¸", (p+1)), 2, 65);
9924 prt("¸½ºß¤ÎÃ챤ò³Îǧ¤¹¤ë", 3, 0);
9926 prt(format("page %d/2", (p+1)), 2, 65);
9927 prt("Display current knowledge", 3, 0);
9930 /* Give some choices */
9934 prt("(1) ´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 6, 5);
9935 prt("(2) ´ûÃΤΥ¢¥¤¥Æ¥à ¤Î°ìÍ÷", 7, 5);
9936 prt("(3) ´ûÃΤÎÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 8, 5);
9937 prt("(4) ´ûÃΤΥâ¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 9, 5);
9938 prt("(5) Åݤ·¤¿Å¨¤Î¿ô ¤Î°ìÍ÷", 10, 5);
9939 if (!vanilla_town) prt("(6) ¾Þ¶â¼ó ¤Î°ìÍ÷", 11, 5);
9940 prt("(7) ¸½ºß¤Î¥Ú¥Ã¥È ¤Î°ìÍ÷", 12, 5);
9941 prt("(8) ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 13, 5);
9942 prt("(9) *´ÕÄê*ºÑ¤ßÁõÈ÷¤ÎÂÑÀ ¤Î°ìÍ÷", 14, 5);
9943 prt("(0) ÃÏ·Á¤Îɽ¼¨Ê¸»ú/¥¿¥¤¥ë ¤Î°ìÍ÷", 15, 5);
9947 prt("(a) ¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó ¤Î°ìÍ÷", 6, 5);
9948 prt("(b) ÆÍÁ³ÊÑ°Û ¤Î°ìÍ÷", 7, 5);
9949 prt("(c) Éð´ï¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 8, 5);
9950 prt("(d) ËâË¡¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 9, 5);
9951 prt("(e) µ»Ç½¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 10, 5);
9952 prt("(f) ¥×¥ì¥¤¥ä¡¼¤ÎÆÁ ¤Î°ìÍ÷", 11, 5);
9953 prt("(g) Æþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó ¤Î°ìÍ÷", 12, 5);
9954 prt("(h) ¼Â¹ÔÃæ¤Î¥¯¥¨¥¹¥È ¤Î°ìÍ÷", 13, 5);
9955 prt("(i) ¸½ºß¤Î¼«Æ°½¦¤¤/Ç˲õÀßÄê ¤Î°ìÍ÷", 14, 5);
9960 prt("(1) Display known artifacts", 6, 5);
9961 prt("(2) Display known objects", 7, 5);
9962 prt("(3) Display remaining uniques", 8, 5);
9963 prt("(4) Display known monster", 9, 5);
9964 prt("(5) Display kill count", 10, 5);
9965 if (!vanilla_town) prt("(6) Display wanted monsters", 11, 5);
9966 prt("(7) Display current pets", 12, 5);
9967 prt("(8) Display home inventory", 13, 5);
9968 prt("(9) Display *identified* equip.", 14, 5);
9969 prt("(0) Display terrain symbols.", 15, 5);
9973 prt("(a) Display about yourself", 6, 5);
9974 prt("(b) Display mutations", 7, 5);
9975 prt("(c) Display weapon proficiency", 8, 5);
9976 prt("(d) Display spell proficiency", 9, 5);
9977 prt("(e) Display misc. proficiency", 10, 5);
9978 prt("(f) Display virtues", 11, 5);
9979 prt("(g) Display dungeons", 12, 5);
9980 prt("(h) Display current quests", 13, 5);
9981 prt("(i) Display auto pick/destroy", 14, 5);
9986 prt("-³¤¯-", 17, 8);
9987 prt("ESC) È´¤±¤ë", 21, 1);
9988 prt("SPACE) ¼¡¥Ú¡¼¥¸", 21, 30);
9989 /*prt("-) Á°¥Ú¡¼¥¸", 21, 60);*/
9990 prt("¥³¥Þ¥ó¥É:", 20, 0);
9992 prt("-more-", 17, 8);
9993 prt("ESC) Exit menu", 21, 1);
9994 prt("SPACE) Next page", 21, 30);
9995 /*prt("-) Previous page", 21, 60);*/
9996 prt("Command: ", 20, 0);
10003 if (i == ESCAPE) break;
10006 case ' ': /* Page change */
10010 case '1': /* Artifacts */
10011 do_cmd_knowledge_artifacts();
10013 case '2': /* Objects */
10014 do_cmd_knowledge_objects(&need_redraw, FALSE, -1);
10016 case '3': /* Uniques */
10017 do_cmd_knowledge_uniques();
10019 case '4': /* Monsters */
10020 do_cmd_knowledge_monsters(&need_redraw, FALSE, -1);
10022 case '5': /* Kill count */
10023 do_cmd_knowledge_kill_count();
10025 case '6': /* wanted */
10026 if (!vanilla_town) do_cmd_knowledge_kubi();
10028 case '7': /* Pets */
10029 do_cmd_knowledge_pets();
10031 case '8': /* Home */
10032 do_cmd_knowledge_home();
10034 case '9': /* Resist list */
10035 do_cmd_knowledge_inven();
10037 case '0': /* Feature list */
10039 int lighting_level = F_LIT_STANDARD;
10040 do_cmd_knowledge_features(&need_redraw, FALSE, -1, &lighting_level);
10044 case 'a': /* Max stat */
10045 do_cmd_knowledge_stat();
10047 case 'b': /* Mutations */
10048 do_cmd_knowledge_mutations();
10050 case 'c': /* weapon-exp */
10051 do_cmd_knowledge_weapon_exp();
10053 case 'd': /* spell-exp */
10054 do_cmd_knowledge_spell_exp();
10056 case 'e': /* skill-exp */
10057 do_cmd_knowledge_skill_exp();
10059 case 'f': /* Virtues */
10060 do_cmd_knowledge_virtues();
10062 case 'g': /* Dungeon */
10063 do_cmd_knowledge_dungeon();
10065 case 'h': /* Quests */
10066 do_cmd_knowledge_quests();
10068 case 'i': /* Autopick */
10069 do_cmd_knowledge_autopick();
10071 default: /* Unknown option */
10075 /* Flush messages */
10079 /* Restore the screen */
10082 if (need_redraw) do_cmd_redraw();
10087 * Check on the status of an active quest
10089 void do_cmd_checkquest(void)
10091 /* File type is "TEXT" */
10092 FILE_TYPE(FILE_TYPE_TEXT);
10094 /* Save the screen */
10098 do_cmd_knowledge_quests();
10100 /* Restore the screen */
10106 * Display the time and date
10108 void do_cmd_time(void)
10110 int day, hour, min, full, start, end, num;
10118 extract_day_hour_min(&day, &hour, &min);
10120 full = hour * 100 + min;
10128 strcpy(desc, "ÊѤʻþ¹ï¤À¡£");
10130 strcpy(desc, "It is a strange time.");
10134 if (day < MAX_DAYS) sprintf(day_buf, "%d", day);
10135 else strcpy(day_buf, "*****");
10139 msg_format("%sÆüÌÜ, »þ¹ï¤Ï%d:%02d %s¤Ç¤¹¡£",
10140 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
10141 min, (hour < 12) ? "AM" : "PM");
10143 msg_format("This is day %s. The time is %d:%02d %s.",
10144 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
10145 min, (hour < 12) ? "AM" : "PM");
10149 /* Find the path */
10150 if (!randint0(10) || p_ptr->image)
10153 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun_j.txt");
10155 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun.txt");
10162 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm_j.txt");
10164 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm.txt");
10169 /* Open this file */
10170 fff = my_fopen(buf, "rt");
10175 /* Find this time */
10176 while (!my_fgets(fff, buf, sizeof(buf)))
10178 /* Ignore comments */
10179 if (!buf[0] || (buf[0] == '#')) continue;
10181 /* Ignore invalid lines */
10182 if (buf[1] != ':') continue;
10184 /* Process 'Start' */
10187 /* Extract the starting time */
10188 start = atoi(buf + 2);
10190 /* Assume valid for an hour */
10197 /* Process 'End' */
10200 /* Extract the ending time */
10201 end = atoi(buf + 2);
10207 /* Ignore incorrect range */
10208 if ((start > full) || (full > end)) continue;
10210 /* Process 'Description' */
10215 /* Apply the randomizer */
10216 if (!randint0(num)) strcpy(desc, buf + 2);
10226 /* Close the file */