4 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6 * This software may be copied and distributed for educational, research,
7 * and not for profit purposes provided that this copyright and statement
8 * are included in all such copies. Other copyrights may also apply.
11 /* Purpose: Interface commands */
18 * A set of functions to maintain automatic dumps of various kinds.
21 * remove_auto_dump(orig_file, mark)
22 * Remove the old automatic dump of type "mark".
23 * auto_dump_printf(fmt, ...)
24 * Dump a formatted string using fprintf().
25 * open_auto_dump(buf, mark)
26 * Open a file, remove old dump, and add new header.
27 * close_auto_dump(void)
28 * Add a footer, and close the file.
30 * The dump commands of original Angband simply add new lines to
31 * existing files; these files will become bigger and bigger unless
32 * an user deletes some or all of these files by hand at some
35 * These three functions automatically delete old dumped lines
36 * before adding new ones. Since there are various kinds of automatic
37 * dumps in a single file, we add a header and a footer with a type
38 * name for every automatic dump, and kill old lines only when the
39 * lines have the correct type of header and footer.
41 * We need to be quite paranoid about correctness; the user might
42 * (mistakenly) edit the file by hand, and see all their work come
43 * to nothing on the next auto dump otherwise. The current code only
44 * detects changes by noting inconsistencies between the actual number
45 * of lines and the number written in the footer. Note that this will
46 * not catch single-line edits.
50 * Mark strings for auto dump
52 static char auto_dump_header[] = "# vvvvvvv== %s ==vvvvvvv";
53 static char auto_dump_footer[] = "# ^^^^^^^== %s ==^^^^^^^";
56 * Variables for auto dump
58 static FILE *auto_dump_stream;
59 static cptr auto_dump_mark;
60 static int auto_dump_line_num;
63 * Remove old lines automatically generated before.
65 static void remove_auto_dump(cptr orig_file)
67 FILE *tmp_fff, *orig_fff;
71 bool between_mark = FALSE;
74 long header_location = 0;
75 char header_mark_str[80];
76 char footer_mark_str[80];
79 /* Prepare a header/footer mark string */
80 sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
81 sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
83 mark_len = strlen(footer_mark_str);
85 /* Open an old dump file in read-only mode */
86 orig_fff = my_fopen(orig_file, "r");
88 /* If original file does not exist, nothing to do */
89 if (!orig_fff) return;
91 /* Open a new (temporary) file */
92 tmp_fff = my_fopen_temp(tmp_file, 1024);
97 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", tmp_file);
99 msg_format("Failed to create temporary file %s.", tmp_file);
105 /* Loop for every line */
109 if (my_fgets(orig_fff, buf, sizeof(buf)))
111 /* Read error: Assume End of File */
114 * Was looking for the footer, but not found.
116 * Since automatic dump might be edited by hand,
117 * it's dangerous to kill these lines.
118 * Seek back to the next line of the (pseudo) header,
123 fseek(orig_fff, header_location, SEEK_SET);
124 between_mark = FALSE;
128 /* Success -- End the loop */
135 /* We are looking for the header mark of automatic dump */
138 /* Is this line a header? */
139 if (!strcmp(buf, header_mark_str))
141 /* Memorise seek point of this line */
142 header_location = ftell(orig_fff);
144 /* Initialize counter for number of lines */
147 /* Look for the footer from now */
150 /* There are some changes */
157 /* Copy orginally lines */
158 fprintf(tmp_fff, "%s\n", buf);
162 /* We are looking for the footer mark of automatic dump */
165 /* Is this line a footer? */
166 if (!strncmp(buf, footer_mark_str, mark_len))
171 * Compare the number of lines
173 * If there is an inconsistency between
174 * actual number of lines and the
175 * number here, the automatic dump
176 * might be edited by hand. So it's
177 * dangerous to kill these lines.
178 * Seek back to the next line of the
179 * (pseudo) header, and read again.
181 if (!sscanf(buf + mark_len, " (%d)", &tmp)
184 fseek(orig_fff, header_location, SEEK_SET);
187 /* Look for another header */
188 between_mark = FALSE;
194 /* Ignore old line, and count number of lines */
204 /* If there are some changes, overwrite the original file with new one */
207 /* Copy contents of temporary file */
209 tmp_fff = my_fopen(tmp_file, "r");
210 orig_fff = my_fopen(orig_file, "w");
212 while (!my_fgets(tmp_fff, buf, sizeof(buf)))
213 fprintf(orig_fff, "%s\n", buf);
219 /* Kill the temporary file */
227 * Dump a formatted line, using "vstrnfmt()".
229 static void auto_dump_printf(cptr fmt, ...)
236 /* Begin the Varargs Stuff */
239 /* Format the args, save the length */
240 (void)vstrnfmt(buf, sizeof(buf), fmt, vp);
242 /* End the Varargs Stuff */
245 /* Count number of lines */
246 for (p = buf; *p; p++)
248 if (*p == '\n') auto_dump_line_num++;
252 fprintf(auto_dump_stream, "%s", buf);
257 * Open file to append auto dump.
259 static bool open_auto_dump(cptr buf, cptr mark)
262 char header_mark_str[80];
264 /* Save the mark string */
265 auto_dump_mark = mark;
267 /* Prepare a header mark string */
268 sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
270 /* Remove old macro dumps */
271 remove_auto_dump(buf);
273 /* Append to the file */
274 auto_dump_stream = my_fopen(buf, "a");
277 if (!auto_dump_stream) {
279 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
281 msg_format("Failed to open %s.", buf);
290 fprintf(auto_dump_stream, "%s\n", header_mark_str);
292 /* Initialize counter */
293 auto_dump_line_num = 0;
296 auto_dump_printf("# *·Ù¹ð!!* °Ê¹ß¤Î¹Ô¤Ï¼«Æ°À¸À®¤µ¤ì¤¿¤â¤Î¤Ç¤¹¡£\n");
297 auto_dump_printf("# *·Ù¹ð!!* ¸å¤Ç¼«Æ°Åª¤Ëºï½ü¤µ¤ì¤ë¤Î¤ÇÊÔ½¸¤·¤Ê¤¤¤Ç¤¯¤À¤µ¤¤¡£\n");
299 auto_dump_printf("# *Warning!* The lines below are an automatic dump.\n");
300 auto_dump_printf("# Don't edit them; changes will be deleted and replaced automatically.\n");
308 * Append foot part and close auto dump.
310 static void close_auto_dump(void)
312 char footer_mark_str[80];
314 /* Prepare a footer mark string */
315 sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
318 auto_dump_printf("# *·Ù¹ð!!* °Ê¾å¤Î¹Ô¤Ï¼«Æ°À¸À®¤µ¤ì¤¿¤â¤Î¤Ç¤¹¡£\n");
319 auto_dump_printf("# *·Ù¹ð!!* ¸å¤Ç¼«Æ°Åª¤Ëºï½ü¤µ¤ì¤ë¤Î¤ÇÊÔ½¸¤·¤Ê¤¤¤Ç¤¯¤À¤µ¤¤¡£\n");
321 auto_dump_printf("# *Warning!* The lines above are an automatic dump.\n");
322 auto_dump_printf("# Don't edit them; changes will be deleted and replaced automatically.\n");
326 fprintf(auto_dump_stream, "%s (%d)\n", footer_mark_str, auto_dump_line_num);
329 my_fclose(auto_dump_stream);
337 * Return suffix of ordinal number
339 cptr get_ordinal_number_suffix(int num)
341 num = ABS(num) % 100;
345 return (num == 11) ? "th" : "st";
347 return (num == 12) ? "th" : "nd";
349 return (num == 13) ? "th" : "rd";
358 * Take note to the diary.
360 errr do_cmd_write_nikki(int type, int num, cptr note)
366 cptr note_level = "";
367 bool do_level = TRUE;
368 char note_level_buf[40];
371 static bool disable_nikki = FALSE;
373 extract_day_hour_min(&day, &hour, &min);
375 if (disable_nikki) return(-1);
377 if (type == NIKKI_FIX_QUEST_C ||
378 type == NIKKI_FIX_QUEST_F ||
379 type == NIKKI_RAND_QUEST_C ||
380 type == NIKKI_RAND_QUEST_F ||
381 type == NIKKI_TO_QUEST)
385 old_quest = p_ptr->inside_quest;
386 p_ptr->inside_quest = (quest[num].type == QUEST_TYPE_RANDOM) ? 0 : num;
388 /* Get the quest text */
389 init_flags = INIT_ASSIGN;
391 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
393 /* Reset the old quest number */
394 p_ptr->inside_quest = old_quest;
398 sprintf(file_name,"playrecord-%s.txt",savefile_base);
400 /* different filne name to avoid mixing */
401 sprintf(file_name,"playrec-%s.txt",savefile_base);
404 /* Build the filename */
405 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
407 /* File type is "TEXT" */
408 FILE_TYPE(FILE_TYPE_TEXT);
410 fff = my_fopen(buf, "a");
416 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£¥×¥ì¥¤µÏ¿¤ò°ì»þÄä»ß¤·¤Þ¤¹¡£", buf);
418 msg_format("Failed to open %s. Play-Record is disabled temporally.", buf);
425 q_idx = quest_number(dun_level);
429 if (p_ptr->inside_arena)
431 note_level = "¥¢¥ê¡¼¥Ê:";
433 note_level = "Arane:";
437 note_level = "ÃϾå:";
439 note_level = "Surface:";
441 else if (q_idx && (is_fixed_quest_idx(q_idx)
442 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
444 note_level = "¥¯¥¨¥¹¥È:";
446 note_level = "Quest:";
451 sprintf(note_level_buf, "%d³¬(%s):", dun_level, d_name+d_info[dungeon_type].name);
453 sprintf(note_level_buf, "%s L%d:", d_name+d_info[dungeon_type].name, dun_level);
455 note_level = note_level_buf;
464 if (day < MAX_DAYS) fprintf(fff, "%dÆüÌÜ\n", day);
465 else fputs("*****ÆüÌÜ\n", fff);
467 if (day < MAX_DAYS) fprintf(fff, "Day %d\n", day);
468 else fputs("Day *****\n", fff);
477 fprintf(fff, "%s\n",note);
481 fprintf(fff, " %2d:%02d %20s %s\n",hour, min, note_level, note);
487 fprintf(fff, " %2d:%02d %20s %s¤òȯ¸«¤·¤¿¡£\n", hour, min, note_level, note);
489 fprintf(fff, " %2d:%02d %20s discovered %s.\n", hour, min, note_level, note);
496 fprintf(fff, " %2d:%02d %20s %s¤òÅݤ·¤¿¡£\n", hour, min, note_level, note);
498 fprintf(fff, " %2d:%02d %20s defeated %s.\n", hour, min, note_level, note);
502 case NIKKI_FIX_QUEST_C:
504 if (quest[num].flags & QUEST_FLAG_SILENT) break;
506 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
508 fprintf(fff, " %2d:%02d %20s completed quest '%s'.\n", hour, min, note_level, quest[num].name);
512 case NIKKI_FIX_QUEST_F:
514 if (quest[num].flags & QUEST_FLAG_SILENT) break;
516 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤«¤éÌ¿¤«¤é¤¬¤éƨ¤²µ¢¤Ã¤¿¡£\n", hour, min, note_level, quest[num].name);
518 fprintf(fff, " %2d:%02d %20s run away from quest '%s'.\n", hour, min, note_level, quest[num].name);
522 case NIKKI_RAND_QUEST_C:
525 strcpy(name, r_name+r_info[quest[num].r_idx].name);
527 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, name);
529 fprintf(fff, " %2d:%02d %20s completed random quest '%s'\n", hour, min, note_level, name);
533 case NIKKI_RAND_QUEST_F:
536 strcpy(name, r_name+r_info[quest[num].r_idx].name);
538 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤«¤éƨ¤²½Ð¤·¤¿¡£\n", hour, min, note_level, name);
540 fprintf(fff, " %2d:%02d %20s ran away from quest '%s'.\n", hour, min, note_level, name);
544 case NIKKI_MAXDEAPTH:
547 fprintf(fff, " %2d:%02d %20s %s¤ÎºÇ¿¼³¬%d³¬¤ËÅþ㤷¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, num);
549 fprintf(fff, " %2d:%02d %20s reached level %d of %s for the first time.\n", hour, min, note_level, num, d_name+d_info[dungeon_type].name);
556 fprintf(fff, " %2d:%02d %20s %s%s¤ÎºÇ¿¼³¬¤ò%d³¬¤Ë¥»¥Ã¥È¤·¤¿¡£\n", hour, min, note_level, note, d_name + d_info[num].name, max_dlv[num]);
558 fprintf(fff, " %2d:%02d %20s reset recall level of %s to %d %s.\n", hour, min, note_level, d_name + d_info[num].name, max_dlv[num], note);
565 if (q_idx && (is_fixed_quest_idx(q_idx)
566 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
577 if (!(dun_level+num)) to = "ÃϾå";
578 else to = format("%d³¬", dun_level+num);
580 if (!(dun_level+num)) to = "the surface";
581 else to = format("level %d", dun_level+num);
586 fprintf(fff, " %2d:%02d %20s %s¤Ø%s¡£\n", hour, min, note_level, to, note);
588 fprintf(fff, " %2d:%02d %20s %s %s.\n", hour, min, note_level, note, to);
596 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤Æ%s¤Î%d³¬¤Ø²¼¤ê¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, max_dlv[dungeon_type]);
598 fprintf(fff, " %2d:%02d %20s recalled to dungeon level %d of %s.\n", hour, min, note_level, max_dlv[dungeon_type], d_name+d_info[dungeon_type].name);
602 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤ÆÃϾå¤Ø¤ÈÌá¤Ã¤¿¡£\n", hour, min, note_level);
604 fprintf(fff, " %2d:%02d %20s recalled from dungeon to surface.\n", hour, min, note_level);
610 if (quest[num].flags & QUEST_FLAG_SILENT) break;
612 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤Ø¤ÈÆÍÆþ¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
614 fprintf(fff, " %2d:%02d %20s entered the quest '%s'.\n", hour, min, note_level, quest[num].name);
621 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¡¦¥Æ¥ì¥Ý¡¼¥È¤Çæ½Ð¤·¤¿¡£\n", hour, min, note_level);
623 fprintf(fff, " %2d:%02d %20s Got out using teleport level.\n", hour, min, note_level);
630 fprintf(fff, " %2d:%02d %20s %s¤ò¹ØÆþ¤·¤¿¡£\n", hour, min, note_level, note);
632 fprintf(fff, " %2d:%02d %20s bought %s.\n", hour, min, note_level, note);
639 fprintf(fff, " %2d:%02d %20s %s¤òÇäµÑ¤·¤¿¡£\n", hour, min, note_level, note);
641 fprintf(fff, " %2d:%02d %20s sold %s.\n", hour, min, note_level, note);
650 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï¤Ç¡¢%s¤ÎÁ°¤ËÇÔ¤ìµî¤Ã¤¿¡£\n", hour, min, note_level, -num, note);
653 fprintf(fff, " %2d:%02d %20s beaten by %s in the %d%s fight.\n", hour, min, note_level, note, n, get_ordinal_number_suffix(n));
658 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï(%s)¤Ë¾¡Íø¤·¤¿¡£\n", hour, min, note_level, num, note);
660 fprintf(fff, " %2d:%02d %20s won the %d%s fight (%s).\n", hour, min, note_level, num, get_ordinal_number_suffix(num), note);
662 if (num == MAX_ARENA_MONS)
665 fprintf(fff, " Æ®µ»¾ì¤Î¤¹¤Ù¤Æ¤ÎŨ¤Ë¾¡Íø¤·¡¢¥Á¥ã¥ó¥Ô¥ª¥ó¤È¤Ê¤Ã¤¿¡£\n");
667 fprintf(fff, " won all fight to become a Chanpion.\n");
676 fprintf(fff, " %2d:%02d %20s %s¤ò¼±Ê̤·¤¿¡£\n", hour, min, note_level, note);
678 fprintf(fff, " %2d:%02d %20s identified %s.\n", hour, min, note_level, note);
693 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
695 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
699 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥¦¥£¥¶¡¼¥É¡¦¥Æ¥ì¥Ý¡¼¥È¤Ç°ÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
701 fprintf(fff, " %2d:%02d %20s wizard-teleport to %s.\n", hour, min, note_level, to);
716 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
718 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
722 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥Ñ¥¿¡¼¥ó¤ÎÎϤǰÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
724 fprintf(fff, " %2d:%02d %20s used Pattern to teleport to %s.\n", hour, min, note_level, to);
731 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¤¬%d¤Ë¾å¤¬¤Ã¤¿¡£\n", hour, min, note_level, num);
733 fprintf(fff, " %2d:%02d %20s reached player level %d.\n", hour, min, note_level, num);
737 case NIKKI_GAMESTART:
739 time_t ct = time((time_t*)0);
743 fprintf(fff, "%s %s",note, ctime(&ct));
746 fprintf(fff, " %2d:%02d %20s %s %s",hour, min, note_level, note, ctime(&ct));
749 case NIKKI_NAMED_PET:
751 fprintf(fff, " %2d:%02d %20s ", hour, min, note_level);
754 case RECORD_NAMED_PET_NAME:
756 fprintf(fff, "%s¤òι¤Îͧ¤Ë¤¹¤ë¤³¤È¤Ë·è¤á¤¿¡£\n", note);
758 fprintf(fff, "decided to travel together with %s.\n", note);
761 case RECORD_NAMED_PET_UNNAME:
763 fprintf(fff, "%s¤Î̾Á°¤ò¾Ã¤·¤¿¡£\n", note);
765 fprintf(fff, "unnamed %s.\n", note);
768 case RECORD_NAMED_PET_DISMISS:
770 fprintf(fff, "%s¤ò²òÊü¤·¤¿¡£\n", note);
772 fprintf(fff, "dismissed %s.\n", note);
775 case RECORD_NAMED_PET_DEATH:
777 fprintf(fff, "%s¤¬»à¤ó¤Ç¤·¤Þ¤Ã¤¿¡£\n", note);
779 fprintf(fff, "%s died.\n", note);
782 case RECORD_NAMED_PET_MOVED:
784 fprintf(fff, "%s¤ò¤ª¤¤¤ÆÊ̤ΥޥåפذÜÆ°¤·¤¿¡£\n", note);
786 fprintf(fff, "moved to another map leaving %s behind.\n", note);
789 case RECORD_NAMED_PET_LOST_SIGHT:
791 fprintf(fff, "%s¤È¤Ï¤°¤ì¤Æ¤·¤Þ¤Ã¤¿¡£\n", note);
793 fprintf(fff, "lost sight of %s.\n", note);
796 case RECORD_NAMED_PET_DESTROY:
798 fprintf(fff, "%s¤¬*Ç˲õ*¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
800 fprintf(fff, "%s was made disappeared by *destruction*.\n", note);
803 case RECORD_NAMED_PET_EARTHQUAKE:
805 fprintf(fff, "%s¤¬´äÀФ˲¡¤·ÄÙ¤µ¤ì¤¿¡£\n", note);
807 fprintf(fff, "%s was crushed by falling rocks.\n", note);
810 case RECORD_NAMED_PET_GENOCIDE:
812 fprintf(fff, "%s¤¬Ëõ»¦¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
814 fprintf(fff, "%s was made disappeared by genocide.\n", note);
817 case RECORD_NAMED_PET_WIZ_ZAP:
819 fprintf(fff, "%s¤¬¥Ç¥Ð¥Ã¥°¥³¥Þ¥ó¥É¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
821 fprintf(fff, "%s was removed by debug command.\n", note);
824 case RECORD_NAMED_PET_TELE_LEVEL:
826 fprintf(fff, "%s¤¬¥Æ¥ì¥Ý¡¼¥È¡¦¥ì¥Ù¥ë¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
828 fprintf(fff, "%s was made disappeared by teleport level.\n", note);
831 case RECORD_NAMED_PET_BLAST:
833 fprintf(fff, "%s¤òÇúÇˤ·¤¿¡£\n", note);
835 fprintf(fff, "blasted %s.\n", note);
838 case RECORD_NAMED_PET_HEAL_LEPER:
840 fprintf(fff, "%s¤Îɵ¤¤¬¼£¤ê餫¤é³°¤ì¤¿¡£\n", note);
842 fprintf(fff, "%s was healed and left.\n", note);
845 case RECORD_NAMED_PET_COMPACT:
847 fprintf(fff, "%s¤¬¥â¥ó¥¹¥¿¡¼¾ðÊ󰵽̤ˤè¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
849 fprintf(fff, "%s was made disappeared by compacting monsters.\n", note);
852 case RECORD_NAMED_PET_LOSE_PARENT:
854 fprintf(fff, "%s¤Î¾¤´¼Ô¤¬´û¤Ë¤¤¤Ê¤¤¤¿¤á¾Ã¤¨µî¤Ã¤¿¡£\n", note);
856 fprintf(fff, "%s disappeared because there does not exist summoner.\n", note);
871 if (do_level) write_level = FALSE;
877 #define MAX_SUBTITLE (sizeof(subtitle)/sizeof(subtitle[0]))
879 static void do_cmd_disp_nikki(void)
881 char nikki_title[256];
886 static const char subtitle[][30] = {"ºÇ¶¯¤ÎÆùÂΤòµá¤á¤Æ",
887 "¿ÍÀ¸¤½¤ì¤Ï¤Ï¤«¤Ê¤¤",
898 "Åݤ¹¤Ù¤Å¨¤Ï¥²¡û¥Ä",
899 "¤ó¡Á¡©Ê¹¤³¤¨¤ó¤Ê¤¡",
900 "¥ª¥ì¤Î̾¤ò¸À¤Ã¤Æ¤ß¤í",
901 "Ƭ¤¬ÊѤˤʤäÁ¤ã¤Ã¤¿",
906 "¤³¤ó¤Ê¤â¤ó¤¸¤ã¤Ê¤¤",
915 "ºÇ¹â¤ÎƬǾ¤òµá¤á¤Æ"};
917 static const char subtitle[][51] ={"Quest of The World's Toughest Body",
918 "Attack is the best form of defence.",
920 "An unexpected windfall",
921 "A drowning man will catch at a straw",
922 "Don't count your chickens before they are hatched.",
923 "It is no use crying over spilt milk.",
924 "Seeing is believing.",
925 "Strike the iron while it is hot.",
926 "I don't care what follows.",
927 "To dig a well to put out a house on fire.",
928 "Tomorrow is another day.",
929 "Easy come, easy go.",
930 "The more haste, the less speed.",
931 "Where there is life, there is hope.",
932 "There is no royal road to *WINNER*.",
933 "Danger past, God forgotten.",
934 "The best thing to do now is to run away.",
935 "Life is but an empty dream.",
936 "Dead men tell no tales.",
937 "A book that remains shut is but a block.",
938 "Misfortunes never come singly.",
939 "A little knowledge is a dangerous thing.",
940 "History repeats itself.",
941 "*WINNER* was not built in a day.",
942 "Ignorance is bliss.",
943 "To lose is to win?",
944 "No medicine can cure folly.",
945 "All good things come to an end.",
946 "M$ Empire strikes back.",
947 "To see is to believe",
949 "Quest of The World's Greatest Brain"};
952 sprintf(file_name,"playrecord-%s.txt",savefile_base);
954 sprintf(file_name,"playrec-%s.txt",savefile_base);
957 /* Build the filename */
958 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
960 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_MONK || p_ptr->pclass == CLASS_SAMURAI || p_ptr->pclass == CLASS_BERSERKER)
961 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)]);
962 else if (p_ptr->pclass == CLASS_MAGE || p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
963 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)+1]);
964 else strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-2)+1]);
967 sprintf(nikki_title, "¡Ö%s%s%s¤ÎÅÁÀâ -%s-¡×",
968 ap_ptr->title, ap_ptr->no ? "¤Î" : "", player_name, tmp);
970 sprintf(nikki_title, "Legend of %s %s '%s'",
971 ap_ptr->title, player_name, tmp);
974 /* Display the file contents */
975 show_file(FALSE, buf, nikki_title, -1, 0);
978 static void do_cmd_bunshou(void)
981 char bunshou[80] = "\0";
984 if (get_string("ÆâÍÆ: ", tmp, 79))
986 if (get_string("diary note: ", tmp, 79))
989 strcpy(bunshou, tmp);
991 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, bunshou);
995 static void do_cmd_last_get(void)
1000 if (record_o_name[0] == '\0') return;
1003 sprintf(buf,"%s¤ÎÆþ¼ê¤òµÏ¿¤·¤Þ¤¹¡£",record_o_name);
1005 sprintf(buf,"Do you really want to record getting %s? ",record_o_name);
1007 if (!get_check(buf)) return;
1012 sprintf(buf,"%s¤ò¼ê¤ËÆþ¤ì¤¿¡£", record_o_name);
1014 sprintf(buf,"descover %s.", record_o_name);
1016 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
1020 static void do_cmd_erase_nikki(void)
1027 if (!get_check("ËÜÅö¤ËµÏ¿¤ò¾Ãµî¤·¤Þ¤¹¤«¡©")) return;
1029 if (!get_check("Do you really want to delete all your record? ")) return;
1033 sprintf(file_name,"playrecord-%s.txt",savefile_base);
1035 sprintf(file_name,"playrec-%s.txt",savefile_base);
1038 /* Build the filename */
1039 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
1041 /* Remove the file */
1044 fff = my_fopen(buf, "w");
1048 msg_format("µÏ¿¤ò¾Ãµî¤·¤Þ¤·¤¿¡£");
1050 msg_format("deleted record.");
1054 msg_format("%s ¤Î¾Ãµî¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£", buf);
1056 msg_format("failed to delete %s.", buf);
1063 void do_cmd_nikki(void)
1067 /* File type is "TEXT" */
1068 FILE_TYPE(FILE_TYPE_TEXT);
1070 /* Save the screen */
1073 /* Interact until done */
1079 /* Ask for a choice */
1081 prt("[ µÏ¿¤ÎÀßÄê ]", 2, 0);
1083 prt("[ Play Record ]", 2, 0);
1087 /* Give some choices */
1089 prt("(1) µÏ¿¤ò¸«¤ë", 4, 5);
1090 prt("(2) ʸ¾Ï¤òµÏ¿¤¹¤ë", 5, 5);
1091 prt("(3) ľÁ°¤ËÆþ¼êËô¤Ï´ÕÄꤷ¤¿¤â¤Î¤òµÏ¿¤¹¤ë", 6, 5);
1092 prt("(4) µÏ¿¤ò¾Ãµî¤¹¤ë", 7, 5);
1094 prt("(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);
2613 /* Auto-picker/destroyer editor */
2617 do_cmd_edit_autopick();
2621 /* Hack -- Delay Speed */
2628 prt("¥³¥Þ¥ó¥É: ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 19, 0);
2630 prt("Command: Base Delay Factor", 19, 0);
2633 /* Get a new value */
2636 int msec = delay_factor * delay_factor * delay_factor;
2638 prt(format("¸½ºß¤Î¥¦¥§¥¤¥È: %d (%d¥ß¥êÉÃ)",
2639 delay_factor, msec), 22, 0);
2641 prt(format("Current base delay factor: %d (%d msec)",
2642 delay_factor, msec), 22, 0);
2646 prt("¥¦¥§¥¤¥È (0-9) ESC¤Ç·èÄê: ", 20, 0);
2648 prt("Delay Factor (0-9 or ESC to accept): ", 20, 0);
2652 if (k == ESCAPE) break;
2656 (void)show_file(TRUE, "joption.txt#BaseDelay", NULL, 0, 0);
2658 (void)show_file(TRUE, "option.txt#BaseDelay", NULL, 0, 0);
2662 else if (isdigit(k)) delay_factor = D2I(k);
2669 /* Hack -- hitpoint warning factor */
2676 prt("¥³¥Þ¥ó¥É: Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 19, 0);
2678 prt("Command: Hitpoint Warning", 19, 0);
2681 /* Get a new value */
2685 prt(format("¸½ºß¤ÎÄã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð: %d0%%",
2686 hitpoint_warn), 22, 0);
2688 prt(format("Current hitpoint warning: %d0%%",
2689 hitpoint_warn), 22, 0);
2693 prt("Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð (0-9) ESC¤Ç·èÄê: ", 20, 0);
2695 prt("Hitpoint Warning (0-9 or ESC to accept): ", 20, 0);
2699 if (k == ESCAPE) break;
2703 (void)show_file(TRUE, "joption.txt#Hitpoint", NULL, 0, 0);
2705 (void)show_file(TRUE, "option.txt#Hitpoint", NULL, 0, 0);
2709 else if (isdigit(k)) hitpoint_warn = D2I(k);
2716 /* Hack -- mana color factor */
2723 prt("¥³¥Þ¥ó¥É: ÄãËâÎÏ¿§ïçÃÍ", 19, 0);
2725 prt("Command: Mana Color Threshold", 19, 0);
2728 /* Get a new value */
2732 prt(format("¸½ºß¤ÎÄãËâÎÏ¿§ïçÃÍ: %d0%%",
2735 prt(format("Current mana color threshold: %d0%%",
2740 prt("ÄãËâÎÏïçÃÍ (0-9) ESC¤Ç·èÄê: ", 20, 0);
2742 prt("Mana color Threshold (0-9 or ESC to accept): ", 20, 0);
2746 if (k == ESCAPE) break;
2750 (void)show_file(TRUE, "joption.txt#Manapoint", NULL, 0, 0);
2752 (void)show_file(TRUE, "option.txt#Manapoint", NULL, 0, 0);
2756 else if (isdigit(k)) mana_warn = D2I(k);
2765 (void)show_file(TRUE, "joption.txt", NULL, 0, 0);
2767 (void)show_file(TRUE, "option.txt", NULL, 0, 0);
2772 /* Unknown option */
2781 /* Flush messages */
2786 /* Restore the screen */
2789 /* Hack - Redraw equippy chars */
2790 p_ptr->redraw |= (PR_EQUIPPY);
2796 * Ask for a "user pref line" and process it
2798 * XXX XXX XXX Allow absolute file names?
2800 void do_cmd_pref(void)
2807 /* Ask for a "user pref command" */
2809 if (!get_string("ÀßÄêÊѹ¹¥³¥Þ¥ó¥É: ", buf, 80)) return;
2811 if (!get_string("Pref: ", buf, 80)) return;
2815 /* Process that pref command */
2816 (void)process_pref_file_command(buf);
2819 void do_cmd_reload_autopick(void)
2822 if (!get_check("¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹¤«? ")) return;
2824 if (!get_check("Reload auto-pick preference file? ")) return;
2827 /* Load the file with messages */
2828 autopick_load_pref(TRUE);
2834 * Hack -- append all current macros to the given file
2836 static errr macro_dump(cptr fname)
2838 static cptr mark = "Macro Dump";
2844 /* Build the filename */
2845 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2847 /* File type is "TEXT" */
2848 FILE_TYPE(FILE_TYPE_TEXT);
2850 /* Append to the file */
2851 if (!open_auto_dump(buf, mark)) return (-1);
2855 auto_dump_printf("\n# ¼«Æ°¥Þ¥¯¥í¥»¡¼¥Ö\n\n");
2857 auto_dump_printf("\n# Automatic macro dump\n\n");
2861 for (i = 0; i < macro__num; i++)
2863 /* Extract the action */
2864 ascii_to_text(buf, macro__act[i]);
2866 /* Dump the macro */
2867 auto_dump_printf("A:%s\n", buf);
2869 /* Extract the action */
2870 ascii_to_text(buf, macro__pat[i]);
2872 /* Dump normal macros */
2873 auto_dump_printf("P:%s\n", buf);
2876 auto_dump_printf("\n");
2888 * Hack -- ask for a "trigger" (see below)
2890 * Note the complex use of the "inkey()" function from "util.c".
2892 * Note that both "flush()" calls are extremely important.
2894 static void do_cmd_macro_aux(char *buf)
2904 /* Do not process macros */
2910 /* Read the pattern */
2916 /* Do not process macros */
2919 /* Do not wait for keys */
2922 /* Attempt to read a key */
2933 /* Convert the trigger */
2934 ascii_to_text(tmp, buf);
2936 /* Hack -- display the trigger */
2937 Term_addstr(-1, TERM_WHITE, tmp);
2944 * Hack -- ask for a keymap "trigger" (see below)
2946 * Note that both "flush()" calls are extremely important. This may
2947 * no longer be true, since "util.c" is much simpler now. XXX XXX XXX
2949 static void do_cmd_macro_aux_keymap(char *buf)
2963 /* Convert to ascii */
2964 ascii_to_text(tmp, buf);
2966 /* Hack -- display the trigger */
2967 Term_addstr(-1, TERM_WHITE, tmp);
2976 * Hack -- append all keymaps to the given file
2978 static errr keymap_dump(cptr fname)
2980 static cptr mark = "Keymap Dump";
2989 if (rogue_like_commands)
2991 mode = KEYMAP_MODE_ROGUE;
2997 mode = KEYMAP_MODE_ORIG;
3001 /* Build the filename */
3002 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
3004 /* File type is "TEXT" */
3005 FILE_TYPE(FILE_TYPE_TEXT);
3007 /* Append to the file */
3008 if (!open_auto_dump(buf, mark)) return -1;
3012 auto_dump_printf("\n# ¼«Æ°¥¡¼ÇÛÃÖ¥»¡¼¥Ö\n\n");
3014 auto_dump_printf("\n# Automatic keymap dump\n\n");
3018 for (i = 0; i < 256; i++)
3022 /* Loop up the keymap */
3023 act = keymap_act[mode][i];
3025 /* Skip empty keymaps */
3028 /* Encode the key */
3031 ascii_to_text(key, buf);
3033 /* Encode the action */
3034 ascii_to_text(buf, act);
3036 /* Dump the macro */
3037 auto_dump_printf("A:%s\n", buf);
3038 auto_dump_printf("C:%d:%s\n", mode, key);
3051 * Interact with "macros"
3053 * Note that the macro "action" must be defined before the trigger.
3055 * Could use some helpful instructions on this page. XXX XXX XXX
3057 void do_cmd_macros(void)
3069 if (rogue_like_commands)
3071 mode = KEYMAP_MODE_ROGUE;
3077 mode = KEYMAP_MODE_ORIG;
3080 /* File type is "TEXT" */
3081 FILE_TYPE(FILE_TYPE_TEXT);
3088 /* Process requests until done */
3096 prt("[ ¥Þ¥¯¥í¤ÎÀßÄê ]", 2, 0);
3098 prt("Interact with Macros", 2, 0);
3103 /* Describe that action */
3105 prt("¥Þ¥¯¥í¹ÔÆ°¤¬(¤â¤·¤¢¤ì¤Ð)²¼¤Ëɽ¼¨¤µ¤ì¤Þ¤¹:", 20, 0);
3107 prt("Current action (if any) shown below:", 20, 0);
3111 /* Analyze the current action */
3112 ascii_to_text(buf, macro__buf);
3114 /* Display the current action */
3120 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
3122 prt("(1) Load a user pref file", 4, 5);
3127 prt("(2) ¥Õ¥¡¥¤¥ë¤Ë¥Þ¥¯¥í¤òÄɲÃ", 5, 5);
3128 prt("(3) ¥Þ¥¯¥í¤Î³Îǧ", 6, 5);
3129 prt("(4) ¥Þ¥¯¥í¤ÎºîÀ®", 7, 5);
3130 prt("(5) ¥Þ¥¯¥í¤Îºï½ü", 8, 5);
3131 prt("(6) ¥Õ¥¡¥¤¥ë¤Ë¥¡¼ÇÛÃÖ¤òÄɲÃ", 9, 5);
3132 prt("(7) ¥¡¼ÇÛÃ֤γÎǧ", 10, 5);
3133 prt("(8) ¥¡¼ÇÛÃ֤κîÀ®", 11, 5);
3134 prt("(9) ¥¡¼ÇÛÃ֤κï½ü", 12, 5);
3135 prt("(0) ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 13, 5);
3137 prt("(2) Append macros to a file", 5, 5);
3138 prt("(3) Query a macro", 6, 5);
3139 prt("(4) Create a macro", 7, 5);
3140 prt("(5) Remove a macro", 8, 5);
3141 prt("(6) Append keymaps to a file", 9, 5);
3142 prt("(7) Query a keymap", 10, 5);
3143 prt("(8) Create a keymap", 11, 5);
3144 prt("(9) Remove a keymap", 12, 5);
3145 prt("(0) Enter a new action", 13, 5);
3148 #endif /* ALLOW_MACROS */
3152 prt("¥³¥Þ¥ó¥É: ", 16, 0);
3154 prt("Command: ", 16, 0);
3162 if (i == ESCAPE) break;
3164 /* Load a 'macro' file */
3171 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 16, 0);
3173 prt("Command: Load a user pref file", 16, 0);
3179 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3181 prt("File: ", 18, 0);
3185 /* Default filename */
3186 sprintf(tmp, "%s.prf", player_base);
3188 /* Ask for a file */
3189 if (!askfor(tmp, 80)) continue;
3191 /* Process the given filename */
3192 err = process_pref_file(tmp);
3196 msg_format("ɸ½à¤ÎÀßÄê¥Õ¥¡¥¤¥ë'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3198 msg_format("Loaded default '%s'.", tmp);
3205 msg_format("'%s'¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡ª", tmp);
3207 msg_format("Failed to load '%s'!");
3213 msg_format("'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3215 msg_format("Loaded '%s'.", tmp);
3227 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3229 prt("Command: Append macros to a file", 16, 0);
3235 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3237 prt("File: ", 18, 0);
3241 /* Default filename */
3242 sprintf(tmp, "%s.prf", player_base);
3244 /* Ask for a file */
3245 if (!askfor(tmp, 80)) continue;
3247 /* Dump the macros */
3248 (void)macro_dump(tmp);
3252 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3254 msg_print("Appended macros.");
3266 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Î³Îǧ", 16, 0);
3268 prt("Command: Query a macro", 16, 0);
3274 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3276 prt("Trigger: ", 18, 0);
3280 /* Get a macro trigger */
3281 do_cmd_macro_aux(buf);
3283 /* Acquire action */
3284 k = macro_find_exact(buf);
3291 msg_print("¤½¤Î¥¡¼¤Ë¤Ï¥Þ¥¯¥í¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3293 msg_print("Found no macro.");
3301 /* Obtain the action */
3302 strcpy(macro__buf, macro__act[k]);
3304 /* Analyze the current action */
3305 ascii_to_text(buf, macro__buf);
3307 /* Display the current action */
3312 msg_print("¥Þ¥¯¥í¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3314 msg_print("Found a macro.");
3320 /* Create a macro */
3325 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ÎºîÀ®", 16, 0);
3327 prt("Command: Create a macro", 16, 0);
3333 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3335 prt("Trigger: ", 18, 0);
3339 /* Get a macro trigger */
3340 do_cmd_macro_aux(buf);
3347 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3349 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3354 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3356 prt("Action: ", 20, 0);
3360 /* Convert to text */
3361 ascii_to_text(tmp, macro__buf);
3363 /* Get an encoded action */
3364 if (askfor(tmp, 80))
3366 /* Convert to ascii */
3367 text_to_ascii(macro__buf, tmp);
3369 /* Link the macro */
3370 macro_add(buf, macro__buf);
3374 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3376 msg_print("Added a macro.");
3382 /* Remove a macro */
3387 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Îºï½ü", 16, 0);
3389 prt("Command: Remove a macro", 16, 0);
3395 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3397 prt("Trigger: ", 18, 0);
3401 /* Get a macro trigger */
3402 do_cmd_macro_aux(buf);
3404 /* Link the macro */
3405 macro_add(buf, buf);
3409 msg_print("¥Þ¥¯¥í¤òºï½ü¤·¤Þ¤·¤¿¡£");
3411 msg_print("Removed a macro.");
3421 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃÖ¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3423 prt("Command: Append keymaps to a file", 16, 0);
3429 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3431 prt("File: ", 18, 0);
3435 /* Default filename */
3436 sprintf(tmp, "%s.prf", player_base);
3438 /* Ask for a file */
3439 if (!askfor(tmp, 80)) continue;
3441 /* Dump the macros */
3442 (void)keymap_dump(tmp);
3446 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3448 msg_print("Appended keymaps.");
3453 /* Query a keymap */
3460 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤γÎǧ", 16, 0);
3462 prt("Command: Query a keymap", 16, 0);
3468 prt("²¡¤¹¥¡¼: ", 18, 0);
3470 prt("Keypress: ", 18, 0);
3474 /* Get a keymap trigger */
3475 do_cmd_macro_aux_keymap(buf);
3477 /* Look up the keymap */
3478 act = keymap_act[mode][(byte)(buf[0])];
3485 msg_print("¥¡¼ÇÛÃÖ¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3487 msg_print("Found no keymap.");
3495 /* Obtain the action */
3496 strcpy(macro__buf, act);
3498 /* Analyze the current action */
3499 ascii_to_text(buf, macro__buf);
3501 /* Display the current action */
3506 msg_print("¥¡¼ÇÛÃÖ¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3508 msg_print("Found a keymap.");
3514 /* Create a keymap */
3519 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κîÀ®", 16, 0);
3521 prt("Command: Create a keymap", 16, 0);
3527 prt("²¡¤¹¥¡¼: ", 18, 0);
3529 prt("Keypress: ", 18, 0);
3533 /* Get a keymap trigger */
3534 do_cmd_macro_aux_keymap(buf);
3541 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3543 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3548 prt("¹ÔÆ°: ", 20, 0);
3550 prt("Action: ", 20, 0);
3554 /* Convert to text */
3555 ascii_to_text(tmp, macro__buf);
3557 /* Get an encoded action */
3558 if (askfor(tmp, 80))
3560 /* Convert to ascii */
3561 text_to_ascii(macro__buf, tmp);
3563 /* Free old keymap */
3564 string_free(keymap_act[mode][(byte)(buf[0])]);
3566 /* Make new keymap */
3567 keymap_act[mode][(byte)(buf[0])] = string_make(macro__buf);
3571 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3573 msg_print("Added a keymap.");
3579 /* Remove a keymap */
3584 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κï½ü", 16, 0);
3586 prt("Command: Remove a keymap", 16, 0);
3592 prt("²¡¤¹¥¡¼: ", 18, 0);
3594 prt("Keypress: ", 18, 0);
3598 /* Get a keymap trigger */
3599 do_cmd_macro_aux_keymap(buf);
3601 /* Free old keymap */
3602 string_free(keymap_act[mode][(byte)(buf[0])]);
3604 /* Make new keymap */
3605 keymap_act[mode][(byte)(buf[0])] = NULL;
3609 msg_print("¥¡¼ÇÛÃÖ¤òºï½ü¤·¤Þ¤·¤¿¡£");
3611 msg_print("Removed a keymap.");
3616 /* Enter a new action */
3621 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 16, 0);
3623 prt("Command: Enter a new action", 16, 0);
3631 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3633 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3638 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3640 prt("Action: ", 20, 0);
3643 /* Hack -- limit the value */
3646 /* Get an encoded action */
3647 if (!askfor(buf, 80)) continue;
3649 /* Extract an action */
3650 text_to_ascii(macro__buf, buf);
3653 #endif /* ALLOW_MACROS */
3662 /* Flush messages */
3671 static cptr lighting_level_str[F_LIT_MAX] =
3685 static bool cmd_visuals_aux(int i, int *num, int max)
3692 sprintf(str, "%d", *num);
3694 if (!get_string(format("Input new number(0-%d): ", max-1), str, 4))
3697 tmp = strtol(str, NULL, 0);
3698 if (tmp >= 0 && tmp < max)
3701 else if (isupper(i))
3702 *num = (*num + max - 1) % max;
3704 *num = (*num + 1) % max;
3709 static void print_visuals_menu(cptr choice_msg)
3712 prt("[ ²èÌÌɽ¼¨¤ÎÀßÄê ]", 1, 0);
3714 prt("Interact with Visuals", 1, 0);
3717 /* Give some choices */
3719 prt("(0) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 3, 5);
3721 prt("(0) Load a user pref file", 3, 5);
3724 #ifdef ALLOW_VISUALS
3726 prt("(1) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 4, 5);
3727 prt("(2) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
3728 prt("(3) ÃÏ·Á¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 6, 5);
3729 prt("(4) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 7, 5);
3730 prt("(5) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 8, 5);
3731 prt("(6) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 9, 5);
3732 prt("(7) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 10, 5);
3733 prt("(8) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 11, 5);
3734 prt("(9) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 12, 5);
3736 prt("(1) Dump monster attr/chars", 4, 5);
3737 prt("(2) Dump object attr/chars", 5, 5);
3738 prt("(3) Dump feature attr/chars", 6, 5);
3739 prt("(4) Change monster attr/chars (numeric operation)", 7, 5);
3740 prt("(5) Change object attr/chars (numeric operation)", 8, 5);
3741 prt("(6) Change feature attr/chars (numeric operation)", 9, 5);
3742 prt("(7) Change monster attr/chars (visual mode)", 10, 5);
3743 prt("(8) Change object attr/chars (visual mode)", 11, 5);
3744 prt("(9) Change feature attr/chars (visual mode)", 12, 5);
3747 #endif /* ALLOW_VISUALS */
3750 prt("(R) ²èÌÌɽ¼¨ÊýË¡¤Î½é´ü²½", 13, 5);
3752 prt("(R) Reset visuals", 13, 5);
3757 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg ? choice_msg : ""), 15, 0);
3759 prt(format("Command: %s", choice_msg ? choice_msg : ""), 15, 0);
3763 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, int direct_r_idx);
3764 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int direct_k_idx);
3765 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int direct_f_idx, int *lighting_level);
3768 * Interact with "visuals"
3770 void do_cmd_visuals(void)
3775 bool need_redraw = FALSE;
3776 const char *empty_symbol = "<< ? >>";
3778 if (use_bigtile) empty_symbol = "<< ?? >>";
3780 /* File type is "TEXT" */
3781 FILE_TYPE(FILE_TYPE_TEXT);
3783 /* Save the screen */
3786 /* Interact until done */
3792 /* Ask for a choice */
3793 print_visuals_menu(NULL);
3799 if (i == ESCAPE) break;
3803 /* Load a 'pref' file */
3807 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 15, 0);
3809 prt("Command: Load a user pref file", 15, 0);
3814 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3816 prt("File: ", 17, 0);
3819 /* Default filename */
3820 sprintf(tmp, "%s.prf", player_base);
3823 if (!askfor(tmp, 70)) continue;
3825 /* Process the given filename */
3826 (void)process_pref_file(tmp);
3831 #ifdef ALLOW_VISUALS
3833 /* Dump monster attr/chars */
3836 static cptr mark = "Monster attr/chars";
3840 prt("¥³¥Þ¥ó¥É: ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3842 prt("Command: Dump monster attr/chars", 15, 0);
3847 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3849 prt("File: ", 17, 0);
3852 /* Default filename */
3853 sprintf(tmp, "%s.prf", player_base);
3855 /* Get a filename */
3856 if (!askfor(tmp, 70)) continue;
3858 /* Build the filename */
3859 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3861 /* Append to the file */
3862 if (!open_auto_dump(buf, mark)) continue;
3866 auto_dump_printf("\n# ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3868 auto_dump_printf("\n# Monster attr/char definitions\n\n");
3872 for (i = 0; i < max_r_idx; i++)
3874 monster_race *r_ptr = &r_info[i];
3876 /* Skip non-entries */
3877 if (!r_ptr->name) continue;
3879 /* Dump a comment */
3880 auto_dump_printf("# %s\n", (r_name + r_ptr->name));
3882 /* Dump the monster attr/char info */
3883 auto_dump_printf("R:%d:0x%02X/0x%02X\n\n", i,
3884 (byte)(r_ptr->x_attr), (byte)(r_ptr->x_char));
3892 msg_print("¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3894 msg_print("Dumped monster attr/chars.");
3900 /* Dump object attr/chars */
3903 static cptr mark = "Object attr/chars";
3907 prt("¥³¥Þ¥ó¥É: ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3909 prt("Command: Dump object attr/chars", 15, 0);
3914 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3916 prt("File: ", 17, 0);
3919 /* Default filename */
3920 sprintf(tmp, "%s.prf", player_base);
3922 /* Get a filename */
3923 if (!askfor(tmp, 70)) continue;
3925 /* Build the filename */
3926 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3928 /* Append to the file */
3929 if (!open_auto_dump(buf, mark)) continue;
3933 auto_dump_printf("\n# ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3935 auto_dump_printf("\n# Object attr/char definitions\n\n");
3939 for (i = 0; i < max_k_idx; i++)
3942 object_kind *k_ptr = &k_info[i];
3944 /* Skip non-entries */
3945 if (!k_ptr->name) continue;
3950 strip_name(o_name, i);
3956 /* Prepare dummy object */
3957 object_prep(&forge, i);
3959 /* Get un-shuffled flavor name */
3960 object_desc(o_name, &forge, OD_FORCE_FLAVOR);
3963 /* Dump a comment */
3964 auto_dump_printf("# %s\n", o_name);
3966 /* Dump the object attr/char info */
3967 auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", i,
3968 (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char));
3976 msg_print("¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3978 msg_print("Dumped object attr/chars.");
3984 /* Dump feature attr/chars */
3987 static cptr mark = "Feature attr/chars";
3991 prt("¥³¥Þ¥ó¥É: ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3993 prt("Command: Dump feature attr/chars", 15, 0);
3998 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
4000 prt("File: ", 17, 0);
4003 /* Default filename */
4004 sprintf(tmp, "%s.prf", player_base);
4006 /* Get a filename */
4007 if (!askfor(tmp, 70)) continue;
4009 /* Build the filename */
4010 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
4012 /* Append to the file */
4013 if (!open_auto_dump(buf, mark)) continue;
4017 auto_dump_printf("\n# ÃÏ·Á¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
4019 auto_dump_printf("\n# Feature attr/char definitions\n\n");
4023 for (i = 0; i < max_f_idx; i++)
4025 feature_type *f_ptr = &f_info[i];
4027 /* Skip non-entries */
4028 if (!f_ptr->name) continue;
4030 /* Skip mimiccing features */
4031 if (f_ptr->mimic != i) continue;
4033 /* Dump a comment */
4034 auto_dump_printf("# %s\n", (f_name + f_ptr->name));
4036 /* Dump the feature attr/char info */
4037 auto_dump_printf("F:%d:0x%02X/0x%02X:0x%02X/0x%02X:0x%02X/0x%02X\n\n", i,
4038 (byte)(f_ptr->x_attr[F_LIT_STANDARD]), (byte)(f_ptr->x_char[F_LIT_STANDARD]),
4039 (byte)(f_ptr->x_attr[F_LIT_LITE]), (byte)(f_ptr->x_char[F_LIT_LITE]),
4040 (byte)(f_ptr->x_attr[F_LIT_DARK]), (byte)(f_ptr->x_char[F_LIT_DARK]));
4048 msg_print("ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
4050 msg_print("Dumped feature attr/chars.");
4056 /* Modify monster attr/chars (numeric operation) */
4060 static cptr choice_msg = "¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4062 static cptr choice_msg = "Change monster attr/chars";
4067 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4069 prt(format("Command: %s", choice_msg), 15, 0);
4072 /* Hack -- query until done */
4075 monster_race *r_ptr = &r_info[r];
4079 byte da = r_ptr->d_attr;
4080 byte dc = r_ptr->d_char;
4081 byte ca = r_ptr->x_attr;
4082 byte cc = r_ptr->x_char;
4084 /* Label the object */
4086 Term_putstr(5, 17, -1, TERM_WHITE,
4087 format("¥â¥ó¥¹¥¿¡¼ = %d, ̾Á° = %-40.40s",
4088 r, (r_name + r_ptr->name)));
4090 Term_putstr(5, 17, -1, TERM_WHITE,
4091 format("Monster = %d, Name = %-40.40s",
4092 r, (r_name + r_ptr->name)));
4095 /* Label the Default values */
4097 Term_putstr(10, 19, -1, TERM_WHITE,
4098 format("½é´üÃÍ ¿§ / ʸ»ú = %3u / %3u", da, dc));
4100 Term_putstr(10, 19, -1, TERM_WHITE,
4101 format("Default attr/char = %3u / %3u", da, dc));
4104 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4105 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4107 /* Label the Current values */
4109 Term_putstr(10, 20, -1, TERM_WHITE,
4110 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3u / %3u", ca, cc));
4112 Term_putstr(10, 20, -1, TERM_WHITE,
4113 format("Current attr/char = %3u / %3u", ca, cc));
4116 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4117 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4121 Term_putstr(0, 22, -1, TERM_WHITE,
4122 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4124 Term_putstr(0, 22, -1, TERM_WHITE,
4125 "Command (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4132 if (i == ESCAPE) break;
4134 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4135 else if (isupper(i)) c = 'a' + i - 'A';
4145 if (!cmd_visuals_aux(i, &r, max_r_idx))
4151 while (!r_info[r].name);
4155 t = (int)r_ptr->x_attr;
4156 (void)cmd_visuals_aux(i, &t, 256);
4157 r_ptr->x_attr = (byte)t;
4161 t = (int)r_ptr->x_char;
4162 (void)cmd_visuals_aux(i, &t, 256);
4163 r_ptr->x_char = (byte)t;
4167 do_cmd_knowledge_monsters(&need_redraw, TRUE, r);
4171 print_visuals_menu(choice_msg);
4179 /* Modify object attr/chars (numeric operation) */
4183 static cptr choice_msg = "¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4185 static cptr choice_msg = "Change object attr/chars";
4190 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4192 prt(format("Command: %s", choice_msg), 15, 0);
4195 /* Hack -- query until done */
4198 object_kind *k_ptr = &k_info[k];
4202 byte da = k_ptr->d_attr;
4203 byte dc = k_ptr->d_char;
4204 byte ca = k_ptr->x_attr;
4205 byte cc = k_ptr->x_char;
4207 /* Label the object */
4209 Term_putstr(5, 17, -1, TERM_WHITE,
4210 format("¥¢¥¤¥Æ¥à = %d, ̾Á° = %-40.40s",
4211 k, k_name + (!k_ptr->flavor ? k_ptr->name : k_ptr->flavor_name)));
4213 Term_putstr(5, 17, -1, TERM_WHITE,
4214 format("Object = %d, Name = %-40.40s",
4215 k, k_name + (!k_ptr->flavor ? k_ptr->name : k_ptr->flavor_name)));
4218 /* Label the Default values */
4220 Term_putstr(10, 19, -1, TERM_WHITE,
4221 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4223 Term_putstr(10, 19, -1, TERM_WHITE,
4224 format("Default attr/char = %3d / %3d", da, dc));
4227 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4228 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4230 /* Label the Current values */
4232 Term_putstr(10, 20, -1, TERM_WHITE,
4233 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4235 Term_putstr(10, 20, -1, TERM_WHITE,
4236 format("Current attr/char = %3d / %3d", ca, cc));
4239 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4240 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4244 Term_putstr(0, 22, -1, TERM_WHITE,
4245 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4247 Term_putstr(0, 22, -1, TERM_WHITE,
4248 "Command (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4255 if (i == ESCAPE) break;
4257 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4258 else if (isupper(i)) c = 'a' + i - 'A';
4268 if (!cmd_visuals_aux(i, &k, max_k_idx))
4274 while (!k_info[k].name);
4278 t = (int)k_ptr->x_attr;
4279 (void)cmd_visuals_aux(i, &t, 256);
4280 k_ptr->x_attr = (byte)t;
4284 t = (int)k_ptr->x_char;
4285 (void)cmd_visuals_aux(i, &t, 256);
4286 k_ptr->x_char = (byte)t;
4290 do_cmd_knowledge_objects(&need_redraw, TRUE, k);
4294 print_visuals_menu(choice_msg);
4302 /* Modify feature attr/chars (numeric operation) */
4306 static cptr choice_msg = "ÃÏ·Á¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4308 static cptr choice_msg = "Change feature attr/chars";
4311 static int lighting_level = F_LIT_STANDARD;
4314 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4316 prt(format("Command: %s", choice_msg), 15, 0);
4319 /* Hack -- query until done */
4322 feature_type *f_ptr = &f_info[f];
4326 byte da = f_ptr->d_attr[lighting_level];
4327 byte dc = f_ptr->d_char[lighting_level];
4328 byte ca = f_ptr->x_attr[lighting_level];
4329 byte cc = f_ptr->x_char[lighting_level];
4331 /* Label the object */
4334 Term_putstr(5, 17, -1, TERM_WHITE,
4335 format("ÃÏ·Á = %d, ̾Á° = %s, ÌÀÅÙ = %s",
4336 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
4338 Term_putstr(5, 17, -1, TERM_WHITE,
4339 format("Terrain = %d, Name = %s, Lighting = %s",
4340 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
4343 /* Label the Default values */
4345 Term_putstr(10, 19, -1, TERM_WHITE,
4346 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4348 Term_putstr(10, 19, -1, TERM_WHITE,
4349 format("Default attr/char = %3d / %3d", da, dc));
4352 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4354 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4356 /* Label the Current values */
4358 Term_putstr(10, 20, -1, TERM_WHITE,
4359 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4361 Term_putstr(10, 20, -1, TERM_WHITE,
4362 format("Current attr/char = %3d / %3d", ca, cc));
4365 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4366 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4370 Term_putstr(0, 22, -1, TERM_WHITE,
4371 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
4373 Term_putstr(0, 22, -1, TERM_WHITE,
4374 "Command (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
4381 if (i == ESCAPE) break;
4383 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4384 else if (isupper(i)) c = 'a' + i - 'A';
4394 if (!cmd_visuals_aux(i, &f, max_f_idx))
4400 while (!f_info[f].name || (f_info[f].mimic != f));
4404 t = (int)f_ptr->x_attr[lighting_level];
4405 (void)cmd_visuals_aux(i, &t, 256);
4406 f_ptr->x_attr[lighting_level] = (byte)t;
4410 t = (int)f_ptr->x_char[lighting_level];
4411 (void)cmd_visuals_aux(i, &t, 256);
4412 f_ptr->x_char[lighting_level] = (byte)t;
4416 (void)cmd_visuals_aux(i, &lighting_level, F_LIT_MAX);
4419 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
4423 do_cmd_knowledge_features(&need_redraw, TRUE, f, &lighting_level);
4427 print_visuals_menu(choice_msg);
4435 /* Modify monster attr/chars (visual mode) */
4437 do_cmd_knowledge_monsters(&need_redraw, TRUE, -1);
4440 /* Modify object attr/chars (visual mode) */
4442 do_cmd_knowledge_objects(&need_redraw, TRUE, -1);
4445 /* Modify feature attr/chars (visual mode) */
4448 int lighting_level = F_LIT_STANDARD;
4449 do_cmd_knowledge_features(&need_redraw, TRUE, -1, &lighting_level);
4453 #endif /* ALLOW_VISUALS */
4463 msg_print("²èÌ̾å¤Î[¿§/ʸ»ú]¤ò½é´üÃͤ˥ꥻ¥Ã¥È¤·¤Þ¤·¤¿¡£");
4465 msg_print("Visual attr/char tables reset.");
4471 /* Unknown option */
4477 /* Flush messages */
4481 /* Restore the screen */
4484 if (need_redraw) do_cmd_redraw();
4489 * Interact with "colors"
4491 void do_cmd_colors(void)
4500 /* File type is "TEXT" */
4501 FILE_TYPE(FILE_TYPE_TEXT);
4504 /* Save the screen */
4508 /* Interact until done */
4514 /* Ask for a choice */
4516 prt("[ ¥«¥é¡¼¤ÎÀßÄê ]", 2, 0);
4518 prt("Interact with Colors", 2, 0);
4522 /* Give some choices */
4524 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
4526 prt("(1) Load a user pref file", 4, 5);
4531 prt("(2) ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
4532 prt("(3) ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤¹¤ë", 6, 5);
4534 prt("(2) Dump colors", 5, 5);
4535 prt("(3) Modify colors", 6, 5);
4542 prt("¥³¥Þ¥ó¥É: ", 8, 0);
4544 prt("Command: ", 8, 0);
4552 if (i == ESCAPE) break;
4554 /* Load a 'pref' file */
4559 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹", 8, 0);
4561 prt("Command: Load a user pref file", 8, 0);
4567 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4569 prt("File: ", 10, 0);
4574 sprintf(tmp, "%s.prf", player_base);
4577 if (!askfor(tmp, 70)) continue;
4579 /* Process the given filename */
4580 (void)process_pref_file(tmp);
4582 /* Mega-Hack -- react to changes */
4583 Term_xtra(TERM_XTRA_REACT, 0);
4585 /* Mega-Hack -- redraw */
4594 static cptr mark = "Colors";
4598 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 8, 0);
4600 prt("Command: Dump colors", 8, 0);
4606 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4608 prt("File: ", 10, 0);
4612 /* Default filename */
4613 sprintf(tmp, "%s.prf", player_base);
4615 /* Get a filename */
4616 if (!askfor(tmp, 70)) continue;
4618 /* Build the filename */
4619 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
4621 /* Append to the file */
4622 if (!open_auto_dump(buf, mark)) continue;
4626 auto_dump_printf("\n# ¥«¥é¡¼¤ÎÀßÄê\n\n");
4628 auto_dump_printf("\n# Color redefinitions\n\n");
4632 for (i = 0; i < 256; i++)
4634 int kv = angband_color_table[i][0];
4635 int rv = angband_color_table[i][1];
4636 int gv = angband_color_table[i][2];
4637 int bv = angband_color_table[i][3];
4642 cptr name = "unknown";
4646 /* Skip non-entries */
4647 if (!kv && !rv && !gv && !bv) continue;
4649 /* Extract the color name */
4650 if (i < 16) name = color_names[i];
4652 /* Dump a comment */
4654 auto_dump_printf("# ¥«¥é¡¼ '%s'\n", name);
4656 auto_dump_printf("# Color '%s'\n", name);
4659 /* Dump the monster attr/char info */
4660 auto_dump_printf("V:%d:0x%02X:0x%02X:0x%02X:0x%02X\n\n",
4669 msg_print("¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
4671 msg_print("Dumped color redefinitions.");
4683 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤·¤Þ¤¹", 8, 0);
4685 prt("Command: Modify colors", 8, 0);
4689 /* Hack -- query until done */
4698 /* Exhibit the normal colors */
4699 for (j = 0; j < 16; j++)
4701 /* Exhibit this color */
4702 Term_putstr(j*4, 20, -1, a, "###");
4704 /* Exhibit all colors */
4705 Term_putstr(j*4, 22, -1, j, format("%3d", j));
4708 /* Describe the color */
4710 name = ((a < 16) ? color_names[a] : "̤ÄêµÁ");
4712 name = ((a < 16) ? color_names[a] : "undefined");
4716 /* Describe the color */
4718 Term_putstr(5, 10, -1, TERM_WHITE,
4719 format("¥«¥é¡¼ = %d, ̾Á° = %s", a, name));
4721 Term_putstr(5, 10, -1, TERM_WHITE,
4722 format("Color = %d, Name = %s", a, name));
4726 /* Label the Current values */
4727 Term_putstr(5, 12, -1, TERM_WHITE,
4728 format("K = 0x%02x / R,G,B = 0x%02x,0x%02x,0x%02x",
4729 angband_color_table[a][0],
4730 angband_color_table[a][1],
4731 angband_color_table[a][2],
4732 angband_color_table[a][3]));
4736 Term_putstr(0, 14, -1, TERM_WHITE,
4737 "¥³¥Þ¥ó¥É (n/N/k/K/r/R/g/G/b/B): ");
4739 Term_putstr(0, 14, -1, TERM_WHITE,
4740 "Command (n/N/k/K/r/R/g/G/b/B): ");
4748 if (i == ESCAPE) break;
4751 if (i == 'n') a = (byte)(a + 1);
4752 if (i == 'N') a = (byte)(a - 1);
4753 if (i == 'k') angband_color_table[a][0] = (byte)(angband_color_table[a][0] + 1);
4754 if (i == 'K') angband_color_table[a][0] = (byte)(angband_color_table[a][0] - 1);
4755 if (i == 'r') angband_color_table[a][1] = (byte)(angband_color_table[a][1] + 1);
4756 if (i == 'R') angband_color_table[a][1] = (byte)(angband_color_table[a][1] - 1);
4757 if (i == 'g') angband_color_table[a][2] = (byte)(angband_color_table[a][2] + 1);
4758 if (i == 'G') angband_color_table[a][2] = (byte)(angband_color_table[a][2] - 1);
4759 if (i == 'b') angband_color_table[a][3] = (byte)(angband_color_table[a][3] + 1);
4760 if (i == 'B') angband_color_table[a][3] = (byte)(angband_color_table[a][3] - 1);
4762 /* Hack -- react to changes */
4763 Term_xtra(TERM_XTRA_REACT, 0);
4765 /* Hack -- redraw */
4772 /* Unknown option */
4778 /* Flush messages */
4783 /* Restore the screen */
4789 * Note something in the message recall
4791 void do_cmd_note(void)
4800 if (!get_string("¥á¥â: ", buf, 60)) return;
4802 if (!get_string("Note: ", buf, 60)) return;
4806 /* Ignore empty notes */
4807 if (!buf[0] || (buf[0] == ' ')) return;
4809 /* Add the note to the message recall */
4811 msg_format("¥á¥â: %s", buf);
4813 msg_format("Note: %s", buf);
4820 * Mention the current version
4822 void do_cmd_version(void)
4827 msg_format("ÊѶòÈÚÅÜ(Hengband) %d.%d.%d",
4828 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4830 msg_format("You are playing Hengband %d.%d.%d.",
4831 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4838 * Array of feeling strings
4840 static cptr do_cmd_feeling_text[11] =
4843 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4845 "Looks like any other level.",
4849 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4851 "You feel there is something special about this level.",
4855 "¶²¤í¤·¤¤»à¤Î¸¸¤¬ÌܤËÉ⤫¤Ó¡¢µ¤À䤷¤½¤¦¤Ë¤Ê¤Ã¤¿¡ª",
4857 "You nearly faint as horrible visions of death fill your mind!",
4861 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4863 "This level looks very dangerous.",
4867 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4869 "You have a very bad feeling...",
4873 "°¤¤Í½´¶¤¬¤¹¤ë...",
4875 "You have a bad feeling...",
4881 "You feel nervous.",
4885 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4887 "You feel your luck is turning...",
4891 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4893 "You don't like the look of this place.",
4897 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4899 "This level looks reasonably safe.",
4903 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4905 "What a boring place..."
4910 static cptr do_cmd_feeling_text_combat[11] =
4913 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4915 "Looks like any other level.",
4919 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4921 "You feel there is something special about this level.",
4925 "º£Ìë¤â¤Þ¤¿¡¢Ã¯¤«¤¬Ì¿¤òÍî¤È¤¹...",
4927 "You nearly faint as horrible visions of death fill your mind!",
4931 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4933 "This level looks very dangerous.",
4937 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4939 "You have a very bad feeling...",
4943 "°¤¤Í½´¶¤¬¤¹¤ë...",
4945 "You have a bad feeling...",
4951 "You feel nervous.",
4955 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4957 "You feel your luck is turning...",
4961 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4963 "You don't like the look of this place.",
4967 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4969 "This level looks reasonably safe.",
4973 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4975 "What a boring place..."
4980 static cptr do_cmd_feeling_text_lucky[11] =
4983 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4984 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4985 "¤³¤Î³¬¤Ï¤³¤Î¾å¤Ê¤¯ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë¡£",
4986 "ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë...",
4987 "¤È¤Æ¤âÎɤ¤´¶¤¸¤¬¤¹¤ë...",
4988 "Îɤ¤´¶¤¸¤¬¤¹¤ë...",
4989 "¤Á¤ç¤Ã¤È¹¬±¿¤Ê´¶¤¸¤¬¤¹¤ë...",
4990 "¿¾¯¤Ï±¿¤¬¸þ¤¤¤Æ¤¤¿¤«...",
4991 "¸«¤¿´¶¤¸°¤¯¤Ï¤Ê¤¤...",
4992 "Á´Á³ÂÌÌܤȤ¤¤¦¤³¤È¤Ï¤Ê¤¤¤¬...",
4993 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4995 "Looks like any other level.",
4996 "You feel there is something special about this level.",
4997 "You have a superb feeling about this level.",
4998 "You have an excellent feeling...",
4999 "You have a very good feeling...",
5000 "You have a good feeling...",
5001 "You feel strangely lucky...",
5002 "You feel your luck is turning...",
5003 "You like the look of this place...",
5004 "This level can't be all bad...",
5005 "What a boring place..."
5011 * Note that "feeling" is set to zero unless some time has passed.
5012 * Note that this is done when the level is GENERATED, not entered.
5014 void do_cmd_feeling(void)
5016 /* No useful feeling in quests */
5017 if (p_ptr->inside_quest && !random_quest_number(dun_level))
5020 msg_print("ŵ·¿Åª¤Ê¥¯¥¨¥¹¥È¤Î¥À¥ó¥¸¥ç¥ó¤Î¤è¤¦¤À¡£");
5022 msg_print("Looks like a typical quest level.");
5028 /* No useful feeling in town */
5029 else if (p_ptr->town_num && !dun_level)
5032 if (!strcmp(town[p_ptr->town_num].name, "¹ÓÌî"))
5034 if (!strcmp(town[p_ptr->town_num].name, "wilderness"))
5038 msg_print("²¿¤«¤¢¤ê¤½¤¦¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
5040 msg_print("Looks like a strange wilderness.");
5048 msg_print("ŵ·¿Åª¤ÊÄ®¤Î¤è¤¦¤À¡£");
5050 msg_print("Looks like a typical town.");
5057 /* No useful feeling in the wilderness */
5058 else if (!dun_level)
5061 msg_print("ŵ·¿Åª¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
5063 msg_print("Looks like a typical wilderness.");
5069 /* Display the feeling */
5070 if (p_ptr->muta3 & MUT3_GOOD_LUCK)
5071 msg_print(do_cmd_feeling_text_lucky[p_ptr->feeling]);
5072 else if (p_ptr->pseikaku == SEIKAKU_COMBAT ||
5073 inventory[INVEN_BOW].name1 == ART_CRIMSON)
5074 msg_print(do_cmd_feeling_text_combat[p_ptr->feeling]);
5076 msg_print(do_cmd_feeling_text[p_ptr->feeling]);
5082 * Description of each monster group.
5084 static cptr monster_group_text[] =
5087 "¥æ¥Ë¡¼¥¯", /* "Uniques" */
5088 "¾èÇϲÄǽ¤Ê¥â¥ó¥¹¥¿¡¼", /* "Riding" */
5089 "¾Þ¶â¼ó", /* "Wanted */
5090 "¥¢¥ó¥Ð¡¼¤Î²¦Â²", /* "Ambertite" */
5119 /* "¸ÅÂå¥É¥é¥´¥ó/¥ï¥¤¥¢¡¼¥à", */
5136 /* "¾åµé¥Ç¡¼¥â¥ó", */
5180 /* "Ancient Dragon/Wyrm", */
5189 "Multi-Headed Reptile",
5194 "Reptile/Amphibian",
5195 "Spider/Scorpion/Tick",
5197 /* "Major Demon", */
5214 * Symbols of monsters in each group. Note the "Uniques" group
5215 * is handled differently.
5217 static cptr monster_group_char[] =
5274 "!$&()+./=>?[\\]`{|~",
5284 * hook function to sort monsters by level
5286 static bool ang_sort_comp_monster_level(vptr u, vptr v, int a, int b)
5288 u16b *who = (u16b*)(u);
5293 monster_race *r_ptr1 = &r_info[w1];
5294 monster_race *r_ptr2 = &r_info[w2];
5299 if (r_ptr2->level > r_ptr1->level) return TRUE;
5300 if (r_ptr1->level > r_ptr2->level) return FALSE;
5302 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return TRUE;
5303 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return FALSE;
5308 * Build a list of monster indexes in the given group. Return the number
5309 * of monsters in the group.
5311 * mode & 0x01 : check for non-empty group
5312 * mode & 0x02 : visual operation only
5314 static int collect_monsters(int grp_cur, s16b mon_idx[], byte mode)
5319 /* Get a list of x_char in this group */
5320 cptr group_char = monster_group_char[grp_cur];
5322 /* XXX Hack -- Check if this is the "Uniques" group */
5323 bool grp_unique = (monster_group_char[grp_cur] == (char *) -1L);
5325 /* XXX Hack -- Check if this is the "Riding" group */
5326 bool grp_riding = (monster_group_char[grp_cur] == (char *) -2L);
5328 /* XXX Hack -- Check if this is the "Wanted" group */
5329 bool grp_wanted = (monster_group_char[grp_cur] == (char *) -3L);
5331 /* XXX Hack -- Check if this is the "Amberite" group */
5332 bool grp_amberite = (monster_group_char[grp_cur] == (char *) -4L);
5335 /* Check every race */
5336 for (i = 0; i < max_r_idx; i++)
5338 /* Access the race */
5339 monster_race *r_ptr = &r_info[i];
5341 /* Skip empty race */
5342 if (!r_ptr->name) continue ;
5344 /* Require known monsters */
5345 if (!(mode & 0x02) && !cheat_know && !r_ptr->r_sights) continue;
5349 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
5352 else if (grp_riding)
5354 if (!(r_ptr->flags7 & RF7_RIDING)) continue;
5357 else if (grp_wanted)
5359 bool wanted = FALSE;
5361 for (j = 0; j < MAX_KUBI; j++)
5363 if (kubi_r_idx[j] == i || kubi_r_idx[j] - 10000 == i ||
5364 (p_ptr->today_mon && p_ptr->today_mon == i))
5370 if (!wanted) continue;
5373 else if (grp_amberite)
5375 if (!(r_ptr->flags3 & RF3_AMBERITE)) continue;
5380 /* Check for race in the group */
5381 if (!my_strchr(group_char, r_ptr->d_char)) continue;
5385 mon_idx[mon_cnt++] = i;
5387 /* XXX Hack -- Just checking for non-empty group */
5388 if (mode & 0x01) break;
5391 /* Terminate the list */
5392 mon_idx[mon_cnt] = -1;
5394 /* Select the sort method */
5395 ang_sort_comp = ang_sort_comp_monster_level;
5396 ang_sort_swap = ang_sort_swap_hook;
5398 /* Sort by monster level */
5399 ang_sort(mon_idx, &dummy_why, mon_cnt);
5401 /* Return the number of races */
5407 * Description of each monster group.
5409 static cptr object_group_text[] =
5412 "¥¥Î¥³", /* "Mushrooms" */
5413 "Ìô", /* "Potions" */
5414 "Ìý¤Ä¤Ü", /* "Flasks" */
5415 "´¬Êª", /* "Scrolls" */
5416 "»ØÎØ", /* "Rings" */
5417 "¥¢¥ß¥å¥ì¥Ã¥È", /* "Amulets" */
5418 "ū", /* "Whistle" */
5419 "¸÷¸»", /* "Lanterns" */
5420 "ËâË¡ËÀ", /* "Wands" */
5421 "¾ó", /* "Staffs" */
5422 "¥í¥Ã¥É", /* "Rods" */
5423 "¥«¡¼¥É", /* "Cards" */
5424 "¥¥ã¥×¥Á¥ã¡¼¡¦¥Ü¡¼¥ë",
5434 "Åá·õÎà", /* "Swords" */
5435 "Æß´ï", /* "Blunt Weapons" */
5436 "ĹÊÁÉð´ï", /* "Polearms" */
5437 "ºÎ·¡Æ»¶ñ", /* "Diggers" */
5438 "Èô¤ÓÆ»¶ñ", /* "Bows" */
5442 "·ÚÁõ³»", /* "Soft Armor" */
5443 "½ÅÁõ³»", /* "Hard Armor" */
5444 "¥É¥é¥´¥ó³»", /* "Dragon Armor" */
5445 "½â", /* "Shields" */
5446 "¥¯¥í¡¼¥¯", /* "Cloaks" */
5447 "äƼê", /* "Gloves" */
5448 "¥Ø¥ë¥á¥Ã¥È", /* "Helms" */
5449 "´§", /* "Crowns" */
5450 "¥Ö¡¼¥Ä", /* "Boots" */
5503 * TVALs of items in each group
5505 static byte object_group_tval[] =
5546 TV_LIFE_BOOK, /* Hack -- all spellbooks */
5554 * Build a list of object indexes in the given group. Return the number
5555 * of objects in the group.
5557 * mode & 0x01 : check for non-empty group
5558 * mode & 0x02 : visual operation only
5560 static int collect_objects(int grp_cur, int object_idx[], byte mode)
5562 int i, j, k, object_cnt = 0;
5564 /* Get a list of x_char in this group */
5565 byte group_tval = object_group_tval[grp_cur];
5567 /* Check every object */
5568 for (i = 0; i < max_k_idx; i++)
5570 /* Access the object */
5571 object_kind *k_ptr = &k_info[i];
5573 /* Skip empty objects */
5574 if (!k_ptr->name) continue;
5578 /* Any objects will be displayed */
5584 /* Skip non-flavoured objects */
5585 if (!k_ptr->flavor) continue;
5587 /* Require objects ever seen */
5588 if (!k_ptr->aware) continue;
5591 /* Skip items with no distribution (special artifacts) */
5592 for (j = 0, k = 0; j < 4; j++) k += k_ptr->chance[j];
5596 /* Check for objects in the group */
5597 if (TV_LIFE_BOOK == group_tval)
5599 /* Hack -- All spell books */
5600 if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HEX_BOOK)
5602 /* Add the object */
5603 object_idx[object_cnt++] = i;
5607 else if (k_ptr->tval == group_tval)
5609 /* Add the object */
5610 object_idx[object_cnt++] = i;
5614 /* XXX Hack -- Just checking for non-empty group */
5615 if (mode & 0x01) break;
5618 /* Terminate the list */
5619 object_idx[object_cnt] = -1;
5621 /* Return the number of objects */
5627 * Description of each feature group.
5629 static cptr feature_group_text[] =
5637 * Build a list of feature indexes in the given group. Return the number
5638 * of features in the group.
5640 * mode & 0x01 : check for non-empty group
5642 static int collect_features(int grp_cur, int *feat_idx, byte mode)
5644 int i, feat_cnt = 0;
5646 /* Unused; There is a single group. */
5649 /* Check every feature */
5650 for (i = 0; i < max_f_idx; i++)
5652 /* Access the index */
5653 feature_type *f_ptr = &f_info[i];
5655 /* Skip empty index */
5656 if (!f_ptr->name) continue;
5658 /* Skip mimiccing features */
5659 if (f_ptr->mimic != i) continue;
5662 feat_idx[feat_cnt++] = i;
5664 /* XXX Hack -- Just checking for non-empty group */
5665 if (mode & 0x01) break;
5668 /* Terminate the list */
5669 feat_idx[feat_cnt] = -1;
5671 /* Return the number of races */
5678 * Build a list of monster indexes in the given group. Return the number
5679 * of monsters in the group.
5681 static int collect_artifacts(int grp_cur, int object_idx[])
5683 int i, object_cnt = 0;
5685 /* Get a list of x_char in this group */
5686 byte group_tval = object_group_tval[grp_cur];
5688 /* Check every object */
5689 for (i = 0; i < max_a_idx; i++)
5691 /* Access the artifact */
5692 artifact_type *a_ptr = &a_info[i];
5694 /* Skip empty artifacts */
5695 if (!a_ptr->name) continue;
5697 /* Skip "uncreated" artifacts */
5698 if (!a_ptr->cur_num) continue;
5700 /* Check for race in the group */
5701 if (a_ptr->tval == group_tval)
5704 object_idx[object_cnt++] = i;
5708 /* Terminate the list */
5709 object_idx[object_cnt] = 0;
5711 /* Return the number of races */
5718 * Encode the screen colors
5720 static char hack[17] = "dwsorgbuDWvyRGBU";
5724 * Hack -- load a screen dump from a file
5726 void do_cmd_load_screen(void)
5741 Term_get_size(&wid, &hgt);
5743 /* Build the filename */
5744 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
5746 /* Append to the file */
5747 fff = my_fopen(buf, "r");
5752 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
5754 msg_format("Failed to open %s.", buf);
5761 /* Save the screen */
5764 /* Clear the screen */
5768 /* Load the screen */
5769 for (y = 0; okay; y++)
5771 /* Get a line of data including control code */
5772 if (!fgets(buf, 1024, fff)) okay = FALSE;
5774 /* Get the blank line */
5775 if (buf[0] == '\n' || buf[0] == '\0') break;
5777 /* Ignore too large screen image */
5778 if (y >= hgt) continue;
5781 for (x = 0; x < wid - 1; x++)
5784 if (buf[x] == '\n' || buf[x] == '\0') break;
5786 /* Put the attr/char */
5787 Term_draw(x, y, TERM_WHITE, buf[x]);
5791 /* Dump the screen */
5792 for (y = 0; okay; y++)
5794 /* Get a line of data including control code */
5795 if (!fgets(buf, 1024, fff)) okay = FALSE;
5797 /* Get the blank line */
5798 if (buf[0] == '\n' || buf[0] == '\0') break;
5800 /* Ignore too large screen image */
5801 if (y >= hgt) continue;
5804 for (x = 0; x < wid - 1; x++)
5807 if (buf[x] == '\n' || buf[x] == '\0') break;
5809 /* Get the attr/char */
5810 (void)(Term_what(x, y, &a, &c));
5812 /* Look up the attr */
5813 for (i = 0; i < 16; i++)
5815 /* Use attr matches */
5816 if (hack[i] == buf[x]) a = i;
5819 /* Put the attr/char */
5820 Term_draw(x, y, a, c);
5831 prt("¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤µ¤ì¤¿²èÌÌ(µÇ°»£±Æ)¤ò¥í¡¼¥É¤·¤Þ¤·¤¿¡£", 0, 0);
5833 msg_print("Screen dump loaded.");
5840 /* Restore the screen */
5847 cptr inven_res_label =
5849 " »ÀÅŲÐÎäÆǸ÷°ÇÇ˹ì¹ö°øÆÙÎô ÌÕÉÝÍðáãÆ©Ì¿´¶¾ÃÉüÉâ";
5851 " AcElFiCoPoLiDkShSoNtNxCaDi BlFeCfFaSeHlEpSdRgLv";
5856 #define IM_FLAG_STR "¡ö"
5857 #define HAS_FLAG_STR "¡Ü"
5858 #define NO_FLAG_STR "¡¦"
5860 #define IM_FLAG_STR "* "
5861 #define HAS_FLAG_STR "+ "
5862 #define NO_FLAG_STR ". "
5865 #define print_im_or_res_flag(IM, RES) \
5867 fputs(have_flag(flgs, (IM)) ? IM_FLAG_STR : \
5868 (have_flag(flgs, (RES)) ? HAS_FLAG_STR : NO_FLAG_STR), fff); \
5871 #define print_flag(TR) \
5873 fputs(have_flag(flgs, (TR)) ? HAS_FLAG_STR : NO_FLAG_STR, fff); \
5877 /* XTRA HACK RESLIST */
5878 static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, byte tval, char *where)
5880 char o_name[MAX_NLEN];
5881 u32b flgs[TR_FLAG_SIZE];
5883 if (!o_ptr->k_idx) return;
5884 if (o_ptr->tval != tval) return;
5886 /* Identified items only */
5887 if (!object_is_known(o_ptr)) return;
5890 * HACK:Ring of Lordly protection and Dragon equipment
5891 * have random resistances.
5893 if ((object_is_wearable(o_ptr) && object_is_ego(o_ptr))
5894 || ((tval == TV_AMULET) && (o_ptr->sval == SV_AMULET_RESISTANCE))
5895 || ((tval == TV_RING) && (o_ptr->sval == SV_RING_LORDLY))
5896 || ((tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD))
5897 || ((tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM))
5898 || ((tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES))
5899 || ((tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE))
5900 || object_is_artifact(o_ptr))
5903 object_desc(o_name, o_ptr, OD_NAME_ONLY);
5905 while (o_name[i] && (i < 26))
5908 if (iskanji(o_name[i])) i++;
5917 o_name[i] = ' '; i++;
5922 fprintf(fff, "%s %s", where, o_name);
5924 if (!(o_ptr->ident & (IDENT_MENTAL)))
5927 fputs("-------ÉÔÌÀ--------------- -------ÉÔÌÀ---------\n", fff);
5929 fputs("-------unknown------------ -------unknown------\n", fff);
5934 object_flags_known(o_ptr, flgs);
5936 print_im_or_res_flag(TR_IM_ACID, TR_RES_ACID);
5937 print_im_or_res_flag(TR_IM_ELEC, TR_RES_ELEC);
5938 print_im_or_res_flag(TR_IM_FIRE, TR_RES_FIRE);
5939 print_im_or_res_flag(TR_IM_COLD, TR_RES_COLD);
5940 print_flag(TR_RES_POIS);
5941 print_flag(TR_RES_LITE);
5942 print_flag(TR_RES_DARK);
5943 print_flag(TR_RES_SHARDS);
5944 print_flag(TR_RES_SOUND);
5945 print_flag(TR_RES_NETHER);
5946 print_flag(TR_RES_NEXUS);
5947 print_flag(TR_RES_CHAOS);
5948 print_flag(TR_RES_DISEN);
5952 print_flag(TR_RES_BLIND);
5953 print_flag(TR_RES_FEAR);
5954 print_flag(TR_RES_CONF);
5955 print_flag(TR_FREE_ACT);
5956 print_flag(TR_SEE_INVIS);
5957 print_flag(TR_HOLD_LIFE);
5958 print_flag(TR_TELEPATHY);
5959 print_flag(TR_SLOW_DIGEST);
5960 print_flag(TR_REGEN);
5961 print_flag(TR_LEVITATION);
5969 fprintf(fff, "%s\n", inven_res_label);
5975 * Display *ID* ed weapons/armors's resistances
5977 static void do_cmd_knowledge_inven(void)
5981 char file_name[1024];
5991 /* Open a new file */
5992 fff = my_fopen_temp(file_name, 1024);
5996 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
5998 msg_format("Failed to create temporary file %s.", file_name);
6003 fprintf(fff, "%s\n", inven_res_label);
6005 for (tval = TV_WEARABLE_BEGIN; tval <= TV_WEARABLE_END; tval++)
6009 for (; j < 9; j++) fputc('\n', fff);
6011 fprintf(fff, "%s\n", inven_res_label);
6015 strcpy(where, "Áõ");
6017 strcpy(where, "E ");
6019 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
6021 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
6025 strcpy(where, "»ý");
6027 strcpy(where, "I ");
6029 for (i = 0; i < INVEN_PACK; i++)
6031 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
6034 st_ptr = &town[1].store[STORE_HOME];
6036 strcpy(where, "²È");
6038 strcpy(where, "H ");
6041 for (i = 0; i < st_ptr->stock_num; i++)
6043 do_cmd_knowledge_inven_aux(fff, &st_ptr->stock[i], &j, tval, where);
6047 /* Close the file */
6050 /* Display the file contents */
6052 show_file(TRUE, file_name, "*´ÕÄê*ºÑ¤ßÉð´ï/Ëɶñ¤ÎÂÑÀ¥ê¥¹¥È", 0, 0);
6054 show_file(TRUE, file_name, "Resistances of *identified* equipment", 0, 0);
6057 /* Remove the file */
6062 void do_cmd_save_screen_html_aux(char *filename, int message)
6066 byte a = 0, old_a = 0;
6080 cptr html_head[] = {
6081 "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
6085 cptr html_foot[] = {
6087 "</body>\n</html>\n",
6093 Term_get_size(&wid, &hgt);
6095 /* File type is "TEXT" */
6096 FILE_TYPE(FILE_TYPE_TEXT);
6098 /* Append to the file */
6099 fff = my_fopen(filename, "w");
6105 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", filename);
6107 msg_format("Failed to open file %s.", filename);
6115 /* Save the screen */
6119 /* Build the filename */
6120 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
6121 tmpfff = my_fopen(buf, "r");
6123 for (i = 0; html_head[i]; i++)
6124 fprintf(fff, html_head[i]);
6128 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
6130 if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
6134 if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
6136 fprintf(fff, "%s\n", buf);
6141 /* Dump the screen */
6142 for (y = 0; y < hgt; y++)
6149 for (x = 0; x < wid - 1; x++)
6153 /* Get the attr/char */
6154 (void)(Term_what(x, y, &a, &c));
6158 case '&': cc = "&"; break;
6159 case '<': cc = "<"; break;
6160 case '>': cc = ">"; break;
6162 case 0x1f: c = '.'; break;
6163 case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
6168 if ((y == 0 && x == 0) || a != old_a) {
6169 rv = angband_color_table[a][1];
6170 gv = angband_color_table[a][2];
6171 bv = angband_color_table[a][3];
6172 fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
6173 ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
6177 fprintf(fff, "%s", cc);
6179 fprintf(fff, "%c", c);
6182 fprintf(fff, "</font>");
6185 for (i = 0; html_foot[i]; i++)
6186 fprintf(fff, html_foot[i]);
6191 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
6193 if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
6197 if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
6199 fprintf(fff, "%s\n", buf);
6214 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6216 msg_print("Screen dump saved.");
6221 /* Restore the screen */
6227 * Hack -- save a screen dump to a file
6229 static void do_cmd_save_screen_html(void)
6231 char buf[1024], tmp[256] = "screen.html";
6234 if (!get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
6236 if (!get_string("File name: ", tmp, 80))
6240 /* Build the filename */
6241 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
6245 do_cmd_save_screen_html_aux(buf, 1);
6250 * Redefinable "save_screen" action
6252 void (*screendump_aux)(void) = NULL;
6256 * Hack -- save a screen dump to a file
6258 void do_cmd_save_screen(void)
6260 bool old_use_graphics = use_graphics;
6261 bool html_dump = FALSE;
6266 prt("µÇ°»£±Æ¤·¤Þ¤¹¤«¡© [(y)es/(h)tml/(n)o] ", 0, 0);
6268 prt("Save screen dump? [(y)es/(h)tml/(n)o] ", 0, 0);
6273 if (c == 'Y' || c == 'y')
6275 else if (c == 'H' || c == 'h')
6287 Term_get_size(&wid, &hgt);
6289 if (old_use_graphics)
6291 use_graphics = FALSE;
6294 /* Redraw everything */
6295 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6297 /* Hack -- update */
6303 do_cmd_save_screen_html();
6307 /* Do we use a special screendump function ? */
6308 else if (screendump_aux)
6310 /* Dump the screen to a graphics file */
6311 (*screendump_aux)();
6313 else /* Dump the screen as text */
6324 /* Build the filename */
6325 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
6327 /* File type is "TEXT" */
6328 FILE_TYPE(FILE_TYPE_TEXT);
6330 /* Append to the file */
6331 fff = my_fopen(buf, "w");
6337 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
6339 msg_format("Failed to open file %s.", buf);
6346 /* Save the screen */
6350 /* Dump the screen */
6351 for (y = 0; y < hgt; y++)
6354 for (x = 0; x < wid - 1; x++)
6356 /* Get the attr/char */
6357 (void)(Term_what(x, y, &a, &c));
6367 fprintf(fff, "%s\n", buf);
6374 /* Dump the screen */
6375 for (y = 0; y < hgt; y++)
6378 for (x = 0; x < wid - 1; x++)
6380 /* Get the attr/char */
6381 (void)(Term_what(x, y, &a, &c));
6384 buf[x] = hack[a&0x0F];
6391 fprintf(fff, "%s\n", buf);
6403 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6405 msg_print("Screen dump saved.");
6411 /* Restore the screen */
6415 if (old_use_graphics)
6417 use_graphics = TRUE;
6420 /* Redraw everything */
6421 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6423 /* Hack -- update */
6430 * Sorting hook -- Comp function -- see below
6432 * We use "u" to point to array of monster indexes,
6433 * and "v" to select the type of sorting to perform on "u".
6435 static bool ang_sort_art_comp(vptr u, vptr v, int a, int b)
6437 u16b *who = (u16b*)(u);
6439 u16b *why = (u16b*)(v);
6446 /* Sort by total kills */
6449 /* Extract total kills */
6450 z1 = a_info[w1].tval;
6451 z2 = a_info[w2].tval;
6453 /* Compare total kills */
6454 if (z1 < z2) return (TRUE);
6455 if (z1 > z2) return (FALSE);
6459 /* Sort by monster level */
6462 /* Extract levels */
6463 z1 = a_info[w1].sval;
6464 z2 = a_info[w2].sval;
6466 /* Compare levels */
6467 if (z1 < z2) return (TRUE);
6468 if (z1 > z2) return (FALSE);
6472 /* Sort by monster experience */
6475 /* Extract experience */
6476 z1 = a_info[w1].level;
6477 z2 = a_info[w2].level;
6479 /* Compare experience */
6480 if (z1 < z2) return (TRUE);
6481 if (z1 > z2) return (FALSE);
6485 /* Compare indexes */
6491 * Sorting hook -- Swap function -- see below
6493 * We use "u" to point to array of monster indexes,
6494 * and "v" to select the type of sorting to perform.
6496 static void ang_sort_art_swap(vptr u, vptr v, int a, int b)
6498 u16b *who = (u16b*)(u);
6513 * Check the status of "artifacts"
6515 static void do_cmd_knowledge_artifacts(void)
6517 int i, k, z, x, y, n = 0;
6523 char file_name[1024];
6525 char base_name[MAX_NLEN];
6529 /* Open a new file */
6530 fff = my_fopen_temp(file_name, 1024);
6534 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6536 msg_format("Failed to create temporary file %s.", file_name);
6542 /* Allocate the "who" array */
6543 C_MAKE(who, max_a_idx, s16b);
6545 /* Allocate the "okay" array */
6546 C_MAKE(okay, max_a_idx, bool);
6548 /* Scan the artifacts */
6549 for (k = 0; k < max_a_idx; k++)
6551 artifact_type *a_ptr = &a_info[k];
6556 /* Skip "empty" artifacts */
6557 if (!a_ptr->name) continue;
6559 /* Skip "uncreated" artifacts */
6560 if (!a_ptr->cur_num) continue;
6566 /* Check the dungeon */
6567 for (y = 0; y < cur_hgt; y++)
6569 for (x = 0; x < cur_wid; x++)
6571 cave_type *c_ptr = &cave[y][x];
6573 s16b this_o_idx, next_o_idx = 0;
6575 /* Scan all objects in the grid */
6576 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
6580 /* Acquire object */
6581 o_ptr = &o_list[this_o_idx];
6583 /* Acquire next object */
6584 next_o_idx = o_ptr->next_o_idx;
6586 /* Ignore non-artifacts */
6587 if (!object_is_fixed_artifact(o_ptr)) continue;
6589 /* Ignore known items */
6590 if (object_is_known(o_ptr)) continue;
6592 /* Note the artifact */
6593 okay[o_ptr->name1] = FALSE;
6598 /* Check the inventory and equipment */
6599 for (i = 0; i < INVEN_TOTAL; i++)
6601 object_type *o_ptr = &inventory[i];
6603 /* Ignore non-objects */
6604 if (!o_ptr->k_idx) continue;
6606 /* Ignore non-artifacts */
6607 if (!object_is_fixed_artifact(o_ptr)) continue;
6609 /* Ignore known items */
6610 if (object_is_known(o_ptr)) continue;
6612 /* Note the artifact */
6613 okay[o_ptr->name1] = FALSE;
6616 for (k = 0; k < max_a_idx; k++)
6618 if (okay[k]) who[n++] = k;
6621 /* Select the sort method */
6622 ang_sort_comp = ang_sort_art_comp;
6623 ang_sort_swap = ang_sort_art_swap;
6625 /* Sort the array by dungeon depth of monsters */
6626 ang_sort(who, &why, n);
6628 /* Scan the artifacts */
6629 for (k = 0; k < n; k++)
6631 artifact_type *a_ptr = &a_info[who[k]];
6635 strcpy(base_name, "̤ÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à");
6637 strcpy(base_name, "Unknown Artifact");
6641 /* Obtain the base object type */
6642 z = lookup_kind(a_ptr->tval, a_ptr->sval);
6650 /* Get local object */
6653 /* Create fake object */
6654 object_prep(q_ptr, z);
6656 /* Make it an artifact */
6657 q_ptr->name1 = (byte)who[k];
6659 /* Display as if known */
6660 q_ptr->ident |= IDENT_STORE;
6662 /* Describe the artifact */
6663 object_desc(base_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
6666 /* Hack -- Build the artifact name */
6668 fprintf(fff, " %s\n", base_name);
6670 fprintf(fff, " The %s\n", base_name);
6675 /* Free the "who" array */
6676 C_KILL(who, max_a_idx, s16b);
6678 /* Free the "okay" array */
6679 C_KILL(okay, max_a_idx, bool);
6681 /* Close the file */
6684 /* Display the file contents */
6686 show_file(TRUE, file_name, "´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à", 0, 0);
6688 show_file(TRUE, file_name, "Artifacts Seen", 0, 0);
6692 /* Remove the file */
6698 * Display known uniques
6699 * With "XTRA HACK UNIQHIST" (Originally from XAngband)
6701 static void do_cmd_knowledge_uniques(void)
6709 char file_name[1024];
6712 int n_alive_surface = 0;
6713 int n_alive_over100 = 0;
6714 int n_alive_total = 0;
6717 for (i = 0; i < 10; i++) n_alive[i] = 0;
6719 /* Open a new file */
6720 fff = my_fopen_temp(file_name, 1024);
6725 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6727 msg_format("Failed to create temporary file %s.", file_name);
6733 /* Allocate the "who" array */
6734 C_MAKE(who, max_r_idx, s16b);
6736 /* Scan the monsters */
6737 for (i = 1; i < max_r_idx; i++)
6739 monster_race *r_ptr = &r_info[i];
6742 if (!r_ptr->name) continue;
6744 /* Require unique monsters */
6745 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6747 /* Only display "known" uniques */
6748 if (!cheat_know && !r_ptr->r_sights) continue;
6750 /* Only print rarity <= 100 uniques */
6751 if (!r_ptr->rarity || ((r_ptr->rarity > 100) && !(r_ptr->flags1 & RF1_QUESTOR))) continue;
6753 /* Only "alive" uniques */
6754 if (r_ptr->max_num == 0) continue;
6758 lev = (r_ptr->level - 1) / 10;
6762 if (max_lev < lev) max_lev = lev;
6764 else n_alive_over100++;
6766 else n_alive_surface++;
6768 /* Collect "appropriate" monsters */
6772 /* Select the sort method */
6773 ang_sort_comp = ang_sort_comp_hook;
6774 ang_sort_swap = ang_sort_swap_hook;
6776 /* Sort the array by dungeon depth of monsters */
6777 ang_sort(who, &why, n);
6779 if (n_alive_surface)
6782 fprintf(fff, " ÃϾå À¸Â¸: %3dÂÎ\n", n_alive_surface);
6784 fprintf(fff, " Surface alive: %3d\n", n_alive_surface);
6786 n_alive_total += n_alive_surface;
6788 for (i = 0; i <= max_lev; i++)
6791 fprintf(fff, "%3d-%3d³¬ À¸Â¸: %3dÂÎ\n", 1 + i * 10, 10 + i * 10, n_alive[i]);
6793 fprintf(fff, "Level %3d-%3d alive: %3d\n", 1 + i * 10, 10 + i * 10, n_alive[i]);
6795 n_alive_total += n_alive[i];
6797 if (n_alive_over100)
6800 fprintf(fff, "101- ³¬ À¸Â¸: %3dÂÎ\n", n_alive_over100);
6802 fprintf(fff, "Level 101- alive: %3d\n", n_alive_over100);
6804 n_alive_total += n_alive_over100;
6810 fputs("--------- -----------\n", fff);
6811 fprintf(fff, " ¹ç·× À¸Â¸: %3dÂÎ\n\n", n_alive_total);
6813 fputs("------------- ----------\n", fff);
6814 fprintf(fff, " Total alive: %3d\n\n", n_alive_total);
6820 fputs("¸½ºß¤Ï´ûÃΤÎÀ¸Â¸¥æ¥Ë¡¼¥¯¤Ï¤¤¤Þ¤»¤ó¡£\n", fff);
6822 fputs("No known uniques alive.\n", fff);
6826 /* Scan the monster races */
6827 for (k = 0; k < n; k++)
6829 monster_race *r_ptr = &r_info[who[k]];
6831 /* Print a message */
6833 fprintf(fff, " %s (¥ì¥Ù¥ë%d)\n", r_name + r_ptr->name, r_ptr->level);
6835 fprintf(fff, " %s (level %d)\n", r_name + r_ptr->name, r_ptr->level);
6839 /* Free the "who" array */
6840 C_KILL(who, max_r_idx, s16b);
6842 /* Close the file */
6845 /* Display the file contents */
6847 show_file(TRUE, file_name, "¤Þ¤ÀÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼", 0, 0);
6849 show_file(TRUE, file_name, "Alive Uniques", 0, 0);
6853 /* Remove the file */
6859 * Display weapon-exp
6861 static void do_cmd_knowledge_weapon_exp(void)
6863 int i, j, num, weapon_exp;
6867 char file_name[1024];
6870 /* Open a new file */
6871 fff = my_fopen_temp(file_name, 1024);
6874 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6876 msg_format("Failed to create temporary file %s.", file_name);
6882 for (i = 0; i < 5; i++)
6884 for (num = 0; num < 64; num++)
6886 for (j = 0; j < max_k_idx; j++)
6888 object_kind *k_ptr = &k_info[j];
6890 if ((k_ptr->tval == TV_SWORD - i) && (k_ptr->sval == num))
6892 if ((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON)) continue;
6894 weapon_exp = p_ptr->weapon_exp[4 - i][num];
6896 fprintf(fff, "%-25s ", tmp);
6897 if (weapon_exp >= s_info[p_ptr->pclass].w_max[4 - i][num]) fprintf(fff, "!");
6898 else fprintf(fff, " ");
6899 fprintf(fff, "%s", exp_level_str[weapon_exp_level(weapon_exp)]);
6900 if (cheat_xtra) fprintf(fff, " %d", weapon_exp);
6908 /* Close the file */
6911 /* Display the file contents */
6913 show_file(TRUE, file_name, "Éð´ï¤Î·Ð¸³ÃÍ", 0, 0);
6915 show_file(TRUE, file_name, "Weapon Proficiency", 0, 0);
6919 /* Remove the file */
6927 static void do_cmd_knowledge_spell_exp(void)
6929 int i = 0, spell_exp, exp_level;
6934 char file_name[1024];
6936 /* Open a new file */
6937 fff = my_fopen_temp(file_name, 1024);
6940 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6942 msg_format("Failed to create temporary file %s.", file_name);
6948 if (p_ptr->realm1 != REALM_NONE)
6951 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm1]);
6953 fprintf(fff, "%s Spellbook\n", realm_names[p_ptr->realm1]);
6955 for (i = 0; i < 32; i++)
6957 if (!is_magic(p_ptr->realm1))
6959 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][i];
6963 s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][i];
6965 if (s_ptr->slevel >= 99) continue;
6966 spell_exp = p_ptr->spell_exp[i];
6967 exp_level = spell_exp_level(spell_exp);
6968 fprintf(fff, "%-25s ", do_spell(p_ptr->realm1, i, SPELL_NAME));
6969 if (p_ptr->realm1 == REALM_HISSATSU)
6970 fprintf(fff, "[--]");
6973 if (exp_level >= EXP_LEVEL_MASTER) fprintf(fff, "!");
6974 else fprintf(fff, " ");
6975 fprintf(fff, "%s", exp_level_str[exp_level]);
6977 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6982 if (p_ptr->realm2 != REALM_NONE)
6985 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm2]);
6987 fprintf(fff, "\n%s Spellbook\n", realm_names[p_ptr->realm2]);
6989 for (i = 0; i < 32; i++)
6991 if (!is_magic(p_ptr->realm1))
6993 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][i];
6997 s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][i];
6999 if (s_ptr->slevel >= 99) continue;
7001 spell_exp = p_ptr->spell_exp[i + 32];
7002 exp_level = spell_exp_level(spell_exp);
7003 fprintf(fff, "%-25s ", do_spell(p_ptr->realm2, i, SPELL_NAME));
7004 if (exp_level >= EXP_LEVEL_EXPERT) fprintf(fff, "!");
7005 else fprintf(fff, " ");
7006 fprintf(fff, "%s", exp_level_str[exp_level]);
7007 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
7012 /* Close the file */
7015 /* Display the file contents */
7017 show_file(TRUE, file_name, "ËâË¡¤Î·Ð¸³ÃÍ", 0, 0);
7019 show_file(TRUE, file_name, "Spell Proficiency", 0, 0);
7023 /* Remove the file */
7031 static void do_cmd_knowledge_skill_exp(void)
7033 int i = 0, skill_exp;
7037 char file_name[1024];
7039 char skill_name[3][17]={"¥Þ¡¼¥·¥ã¥ë¥¢¡¼¥Ä", "ÆóÅáή ", "¾èÇÏ "};
7041 char skill_name[3][20]={"Martial Arts ", "Dual Wielding ", "Riding "};
7044 /* Open a new file */
7045 fff = my_fopen_temp(file_name, 1024);
7048 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7050 msg_format("Failed to create temporary file %s.", file_name);
7056 for (i = 0; i < 3; i++)
7058 skill_exp = p_ptr->skill_exp[i];
7059 fprintf(fff, "%-20s ", skill_name[i]);
7060 if (skill_exp >= s_info[p_ptr->pclass].s_max[i]) fprintf(fff, "!");
7061 else fprintf(fff, " ");
7062 fprintf(fff, "%s", exp_level_str[(i == GINOU_RIDING) ? riding_exp_level(skill_exp) : weapon_exp_level(skill_exp)]);
7063 if (cheat_xtra) fprintf(fff, " %d", skill_exp);
7067 /* Close the file */
7070 /* Display the file contents */
7072 show_file(TRUE, file_name, "µ»Ç½¤Î·Ð¸³ÃÍ", 0, 0);
7074 show_file(TRUE, file_name, "Miscellaneous Proficiency", 0, 0);
7078 /* Remove the file */
7084 * Pluralize a monster name
7086 void plural_aux(char *Name)
7088 int NameLen = strlen(Name);
7090 if (my_strstr(Name, "Disembodied hand"))
7092 strcpy(Name, "Disembodied hands that strangled people");
7094 else if (my_strstr(Name, "Colour out of space"))
7096 strcpy(Name, "Colours out of space");
7098 else if (my_strstr(Name, "stairway to hell"))
7100 strcpy(Name, "stairways to hell");
7102 else if (my_strstr(Name, "Dweller on the threshold"))
7104 strcpy(Name, "Dwellers on the threshold");
7106 else if (my_strstr(Name, " of "))
7108 cptr aider = my_strstr(Name, " of ");
7119 if (dummy[i-1] == 's')
7121 strcpy(&(dummy[i]), "es");
7126 strcpy(&(dummy[i]), "s");
7129 strcpy(&(dummy[i+1]), aider);
7130 strcpy(Name, dummy);
7132 else if (my_strstr(Name, "coins"))
7135 strcpy(dummy, "piles of ");
7136 strcat(dummy, Name);
7137 strcpy(Name, dummy);
7140 else if (my_strstr(Name, "Manes"))
7144 else if (streq(&(Name[NameLen - 2]), "ey"))
7146 strcpy(&(Name[NameLen - 2]), "eys");
7148 else if (Name[NameLen - 1] == 'y')
7150 strcpy(&(Name[NameLen - 1]), "ies");
7152 else if (streq(&(Name[NameLen - 4]), "ouse"))
7154 strcpy(&(Name[NameLen - 4]), "ice");
7156 else if (streq(&(Name[NameLen - 2]), "us"))
7158 strcpy(&(Name[NameLen - 2]), "i");
7160 else if (streq(&(Name[NameLen - 6]), "kelman"))
7162 strcpy(&(Name[NameLen - 6]), "kelmen");
7164 else if (streq(&(Name[NameLen - 8]), "wordsman"))
7166 strcpy(&(Name[NameLen - 8]), "wordsmen");
7168 else if (streq(&(Name[NameLen - 7]), "oodsman"))
7170 strcpy(&(Name[NameLen - 7]), "oodsmen");
7172 else if (streq(&(Name[NameLen - 7]), "eastman"))
7174 strcpy(&(Name[NameLen - 7]), "eastmen");
7176 else if (streq(&(Name[NameLen - 8]), "izardman"))
7178 strcpy(&(Name[NameLen - 8]), "izardmen");
7180 else if (streq(&(Name[NameLen - 5]), "geist"))
7182 strcpy(&(Name[NameLen - 5]), "geister");
7184 else if (streq(&(Name[NameLen - 2]), "ex"))
7186 strcpy(&(Name[NameLen - 2]), "ices");
7188 else if (streq(&(Name[NameLen - 2]), "lf"))
7190 strcpy(&(Name[NameLen - 2]), "lves");
7192 else if (suffix(Name, "ch") ||
7193 suffix(Name, "sh") ||
7194 suffix(Name, "nx") ||
7195 suffix(Name, "s") ||
7198 strcpy(&(Name[NameLen]), "es");
7202 strcpy(&(Name[NameLen]), "s");
7207 * Display current pets
7209 static void do_cmd_knowledge_pets(void)
7213 monster_type *m_ptr;
7216 int show_upkeep = 0;
7217 char file_name[1024];
7220 /* Open a new file */
7221 fff = my_fopen_temp(file_name, 1024);
7224 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7226 msg_format("Failed to create temporary file %s.", file_name);
7232 /* Process the monsters (backwards) */
7233 for (i = m_max - 1; i >= 1; i--)
7235 /* Access the monster */
7238 /* Ignore "dead" monsters */
7239 if (!m_ptr->r_idx) continue;
7241 /* Calculate "upkeep" for pets */
7245 monster_desc(pet_name, m_ptr, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
7246 fprintf(fff, "%s (%s)\n", pet_name, look_mon_desc(m_ptr, 0x00));
7250 show_upkeep = calculate_upkeep();
7252 fprintf(fff, "----------------------------------------------\n");
7254 fprintf(fff, " ¹ç·×: %d ÂΤΥڥåÈ\n", t_friends);
7255 fprintf(fff, " °Ý»ý¥³¥¹¥È: %d%% MP\n", show_upkeep);
7257 fprintf(fff, " Total: %d pet%s.\n",
7258 t_friends, (t_friends == 1 ? "" : "s"));
7259 fprintf(fff, " Upkeep: %d%% mana.\n", show_upkeep);
7264 /* Close the file */
7267 /* Display the file contents */
7269 show_file(TRUE, file_name, "¸½ºß¤Î¥Ú¥Ã¥È", 0, 0);
7271 show_file(TRUE, file_name, "Current Pets", 0, 0);
7275 /* Remove the file */
7283 * Note that the player ghosts are ignored. XXX XXX XXX
7285 static void do_cmd_knowledge_kill_count(void)
7293 char file_name[1024];
7298 /* Open a new file */
7299 fff = my_fopen_temp(file_name, 1024);
7303 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7305 msg_format("Failed to create temporary file %s.", file_name);
7311 /* Allocate the "who" array */
7312 C_MAKE(who, max_r_idx, s16b);
7315 /* Monsters slain */
7318 for (kk = 1; kk < max_r_idx; kk++)
7320 monster_race *r_ptr = &r_info[kk];
7322 if (r_ptr->flags1 & (RF1_UNIQUE))
7324 bool dead = (r_ptr->max_num == 0);
7333 s16b This = r_ptr->r_pkills;
7344 fprintf(fff,"¤¢¤Ê¤¿¤Ï¤Þ¤ÀŨ¤òÅݤ·¤Æ¤¤¤Ê¤¤¡£\n\n");
7346 fprintf(fff,"You have defeated no enemies yet.\n\n");
7350 fprintf(fff,"¤¢¤Ê¤¿¤Ï%ldÂΤÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n", (long int)Total);
7352 fprintf(fff,"You have defeated %ld %s.\n\n", (long int)Total, (Total == 1) ? "enemy" : "enemies");
7358 /* Scan the monsters */
7359 for (i = 1; i < max_r_idx; i++)
7361 monster_race *r_ptr = &r_info[i];
7363 /* Use that monster */
7364 if (r_ptr->name) who[n++] = i;
7367 /* Select the sort method */
7368 ang_sort_comp = ang_sort_comp_hook;
7369 ang_sort_swap = ang_sort_swap_hook;
7371 /* Sort the array by dungeon depth of monsters */
7372 ang_sort(who, &why, n);
7374 /* Scan the monster races */
7375 for (k = 0; k < n; k++)
7377 monster_race *r_ptr = &r_info[who[k]];
7379 if (r_ptr->flags1 & (RF1_UNIQUE))
7381 bool dead = (r_ptr->max_num == 0);
7385 /* Print a message */
7386 fprintf(fff, " %s\n",
7387 (r_name + r_ptr->name));
7393 s16b This = r_ptr->r_pkills;
7398 /* p,t¤Ï¿Í¤È¿ô¤¨¤ë by ita */
7399 if (my_strchr("pt", r_ptr->d_char))
7400 fprintf(fff, " %3d ¿Í¤Î %s\n", This, r_name + r_ptr->name);
7402 fprintf(fff, " %3d ÂΤΠ%s\n", This, r_name + r_ptr->name);
7406 if (my_strstr(r_name + r_ptr->name, "coins"))
7408 fprintf(fff, " 1 pile of %s\n", (r_name + r_ptr->name));
7412 fprintf(fff, " 1 %s\n", (r_name + r_ptr->name));
7418 strcpy(ToPlural, (r_name + r_ptr->name));
7419 plural_aux(ToPlural);
7420 fprintf(fff, " %d %s\n", This, ToPlural);
7430 fprintf(fff,"----------------------------------------------\n");
7432 fprintf(fff," ¹ç·×: %lu ÂΤòÅݤ·¤¿¡£\n", (unsigned long int)Total);
7434 fprintf(fff," Total: %lu creature%s killed.\n",
7435 (unsigned long int)Total, (Total == 1 ? "" : "s"));
7439 /* Free the "who" array */
7440 C_KILL(who, max_r_idx, s16b);
7442 /* Close the file */
7445 /* Display the file contents */
7447 show_file(TRUE, file_name, "Åݤ·¤¿Å¨¤Î¿ô", 0, 0);
7449 show_file(TRUE, file_name, "Kill Count", 0, 0);
7453 /* Remove the file */
7459 * Display the object groups.
7461 static void display_group_list(int col, int row, int wid, int per_page,
7462 int grp_idx[], cptr group_text[], int grp_cur, int grp_top)
7466 /* Display lines until done */
7467 for (i = 0; i < per_page && (grp_idx[i] >= 0); i++)
7469 /* Get the group index */
7470 int grp = grp_idx[grp_top + i];
7472 /* Choose a color */
7473 byte attr = (grp_top + i == grp_cur) ? TERM_L_BLUE : TERM_WHITE;
7475 /* Erase the entire line */
7476 Term_erase(col, row + i, wid);
7478 /* Display the group label */
7479 c_put_str(attr, group_text[grp], row + i, col);
7485 * Move the cursor in a browser window
7487 static void browser_cursor(char ch, int *column, int *grp_cur, int grp_cnt,
7488 int *list_cur, int list_cnt)
7493 int list = *list_cur;
7495 /* Extract direction */
7498 /* Hack -- scroll up full screen */
7503 /* Hack -- scroll down full screen */
7508 d = get_keymap_dir(ch);
7513 /* Diagonals - hack */
7514 if ((ddx[d] > 0) && ddy[d])
7520 Term_get_size(&wid, &hgt);
7522 browser_rows = hgt - 8;
7524 /* Browse group list */
7529 /* Move up or down */
7530 grp += ddy[d] * (browser_rows - 1);
7533 if (grp >= grp_cnt) grp = grp_cnt - 1;
7534 if (grp < 0) grp = 0;
7535 if (grp != old_grp) list = 0;
7538 /* Browse sub-list list */
7541 /* Move up or down */
7542 list += ddy[d] * browser_rows;
7545 if (list >= list_cnt) list = list_cnt - 1;
7546 if (list < 0) list = 0;
7558 if (col < 0) col = 0;
7559 if (col > 1) col = 1;
7566 /* Browse group list */
7571 /* Move up or down */
7575 if (grp >= grp_cnt) grp = grp_cnt - 1;
7576 if (grp < 0) grp = 0;
7577 if (grp != old_grp) list = 0;
7580 /* Browse sub-list list */
7583 /* Move up or down */
7587 if (list >= list_cnt) list = list_cnt - 1;
7588 if (list < 0) list = 0;
7599 static void display_visual_list(int col, int row, int height, int width, byte attr_top, byte char_left)
7603 /* Clear the display lines */
7604 for (i = 0; i < height; i++)
7606 Term_erase(col, row + i, width);
7609 /* Bigtile mode uses double width */
7610 if (use_bigtile) width /= 2;
7612 /* Display lines until done */
7613 for (i = 0; i < height; i++)
7615 /* Display columns until done */
7616 for (j = 0; j < width; j++)
7624 /* Bigtile mode uses double width */
7625 if (use_bigtile) x += j;
7630 /* Ignore illegal characters */
7631 if (ia > 0x7f || ic > 0xff || ic < ' ' ||
7632 (!use_graphics && ic > 0x7f))
7638 /* Force correct code for both ASCII character and tile */
7639 if (c & 0x80) a |= 0x80;
7641 /* Display symbol */
7642 Term_queue_bigchar(x, y, a, c, 0, 0);
7649 * Place the cursor at the collect position for visual mode
7651 static void place_visual_list_cursor(int col, int row, byte a, byte c, byte attr_top, byte char_left)
7653 int i = (a & 0x7f) - attr_top;
7654 int j = c - char_left;
7659 /* Bigtile mode uses double width */
7660 if (use_bigtile) x += j;
7662 /* Place the cursor */
7668 * Clipboard variables for copy&paste in visual mode
7670 static byte attr_idx = 0;
7671 static byte char_idx = 0;
7673 /* Hack -- for feature lighting */
7674 static byte attr_idx_feat[F_LIT_MAX];
7675 static byte char_idx_feat[F_LIT_MAX];
7678 * Do visual mode command -- Change symbols
7680 static bool visual_mode_command(char ch, bool *visual_list_ptr,
7681 int height, int width,
7682 byte *attr_top_ptr, byte *char_left_ptr,
7683 byte *cur_attr_ptr, byte *cur_char_ptr, bool *need_redraw)
7685 static byte attr_old = 0, char_old = 0;
7690 if (*visual_list_ptr)
7693 *cur_attr_ptr = attr_old;
7694 *cur_char_ptr = char_old;
7695 *visual_list_ptr = FALSE;
7703 if (*visual_list_ptr)
7706 *visual_list_ptr = FALSE;
7707 *need_redraw = TRUE;
7715 if (!*visual_list_ptr)
7717 *visual_list_ptr = TRUE;
7719 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7720 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7722 attr_old = *cur_attr_ptr;
7723 char_old = *cur_char_ptr;
7734 /* Set the visual */
7735 attr_idx = *cur_attr_ptr;
7736 char_idx = *cur_char_ptr;
7738 /* Hack -- for feature lighting */
7739 for (i = 0; i < F_LIT_MAX; i++)
7741 attr_idx_feat[i] = 0;
7742 char_idx_feat[i] = 0;
7749 if (attr_idx || (!(char_idx & 0x80) && char_idx)) /* Allow TERM_DARK text */
7752 *cur_attr_ptr = attr_idx;
7753 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7754 if (!*visual_list_ptr) *need_redraw = TRUE;
7760 *cur_char_ptr = char_idx;
7761 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7762 if (!*visual_list_ptr) *need_redraw = TRUE;
7768 if (*visual_list_ptr)
7771 int d = get_keymap_dir(ch);
7772 byte a = (*cur_attr_ptr & 0x7f);
7773 byte c = *cur_char_ptr;
7775 if (use_bigtile) eff_width = width / 2;
7776 else eff_width = width;
7778 /* Restrict direction */
7779 if ((a == 0) && (ddy[d] < 0)) d = 0;
7780 if ((c == 0) && (ddx[d] < 0)) d = 0;
7781 if ((a == 0x7f) && (ddy[d] > 0)) d = 0;
7782 if ((c == 0xff) && (ddx[d] > 0)) d = 0;
7787 /* Force correct code for both ASCII character and tile */
7788 if (c & 0x80) a |= 0x80;
7790 /* Set the visual */
7795 /* Move the frame */
7796 if ((ddx[d] < 0) && *char_left_ptr > MAX(0, (int)c - 10)) (*char_left_ptr)--;
7797 if ((ddx[d] > 0) && *char_left_ptr + eff_width < MIN(0xff, (int)c + 10)) (*char_left_ptr)++;
7798 if ((ddy[d] < 0) && *attr_top_ptr > MAX(0, (int)(a & 0x7f) - 4)) (*attr_top_ptr)--;
7799 if ((ddy[d] > 0) && *attr_top_ptr + height < MIN(0x7f, (a & 0x7f) + 4)) (*attr_top_ptr)++;
7805 /* Visual mode command is not used */
7811 * Display the monsters in a group.
7813 static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
7814 int mon_cur, int mon_top, bool visual_only)
7818 /* Display lines until done */
7819 for (i = 0; i < per_page && (mon_idx[mon_top + i] >= 0); i++)
7823 /* Get the race index */
7824 int r_idx = mon_idx[mon_top + i] ;
7826 /* Access the race */
7827 monster_race *r_ptr = &r_info[r_idx];
7829 /* Choose a color */
7830 attr = ((i + mon_top == mon_cur) ? TERM_L_BLUE : TERM_WHITE);
7832 /* Display the name */
7833 c_prt(attr, (r_name + r_ptr->name), row + i, col);
7835 /* Hack -- visual_list mode */
7838 c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, (p_ptr->wizard || visual_only) ? 56 : 61);
7840 if (p_ptr->wizard || visual_only)
7842 c_prt(attr, format("%d", r_idx), row + i, 62);
7845 /* Erase chars before overwritten by the race letter */
7846 Term_erase(69, row + i, 255);
7848 /* Display symbol */
7849 Term_queue_bigchar(use_bigtile ? 69 : 70, row + i, r_ptr->x_attr, r_ptr->x_char, 0, 0);
7854 if (!(r_ptr->flags1 & RF1_UNIQUE)) put_str(format("%5d", r_ptr->r_pkills), row + i, 73);
7856 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? "»àË´" : "À¸Â¸"), row + i, 74);
7858 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? " dead" : "alive"), row + i, 73);
7863 /* Clear remaining lines */
7864 for (; i < per_page; i++)
7866 Term_erase(col, row + i, 255);
7872 * Display known monsters.
7874 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, int direct_r_idx)
7877 int grp_cur, grp_top, old_grp_cur;
7878 int mon_cur, mon_top;
7879 int grp_cnt, grp_idx[100];
7887 bool visual_list = FALSE;
7888 byte attr_top = 0, char_left = 0;
7896 Term_get_size(&wid, &hgt);
7898 browser_rows = hgt - 8;
7900 /* Allocate the "mon_idx" array */
7901 C_MAKE(mon_idx, max_r_idx, s16b);
7906 if (direct_r_idx < 0)
7908 mode = visual_only ? 0x03 : 0x01;
7910 /* Check every group */
7911 for (i = 0; monster_group_text[i] != NULL; i++)
7913 /* Measure the label */
7914 len = strlen(monster_group_text[i]);
7916 /* Save the maximum length */
7917 if (len > max) max = len;
7919 /* See if any monsters are known */
7920 if ((monster_group_char[i] == ((char *) -1L)) || collect_monsters(i, mon_idx, mode))
7922 /* Build a list of groups with known monsters */
7923 grp_idx[grp_cnt++] = i;
7931 mon_idx[0] = direct_r_idx;
7934 /* Terminate the list */
7937 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
7938 &attr_top, &char_left, &r_info[direct_r_idx].x_attr, &r_info[direct_r_idx].x_char, need_redraw);
7941 /* Terminate the list */
7942 grp_idx[grp_cnt] = -1;
7945 grp_cur = grp_top = 0;
7946 mon_cur = mon_top = 0;
7951 mode = visual_only ? 0x02 : 0x00;
7956 monster_race *r_ptr;
7963 prt(format("%s - ¥â¥ó¥¹¥¿¡¼", !visual_only ? "Ãμ±" : "ɽ¼¨"), 2, 0);
7964 if (direct_r_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
7965 prt("̾Á°", 4, max + 3);
7966 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7968 if (!visual_only) prt("»¦³²¿ô", 4, 72);
7970 prt(format("%s - monsters", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
7971 if (direct_r_idx < 0) prt("Group", 4, 0);
7972 prt("Name", 4, max + 3);
7973 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7975 if (!visual_only) prt("Kills", 4, 73);
7978 for (i = 0; i < 78; i++)
7980 Term_putch(i, 5, TERM_WHITE, '=');
7983 if (direct_r_idx < 0)
7985 for (i = 0; i < browser_rows; i++)
7987 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7994 if (direct_r_idx < 0)
7996 /* Scroll group list */
7997 if (grp_cur < grp_top) grp_top = grp_cur;
7998 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8000 /* Display a list of monster groups */
8001 display_group_list(0, 6, max, browser_rows, grp_idx, monster_group_text, grp_cur, grp_top);
8003 if (old_grp_cur != grp_cur)
8005 old_grp_cur = grp_cur;
8007 /* Get a list of monsters in the current group */
8008 mon_cnt = collect_monsters(grp_idx[grp_cur], mon_idx, mode);
8011 /* Scroll monster list */
8012 while (mon_cur < mon_top)
8013 mon_top = MAX(0, mon_top - browser_rows/2);
8014 while (mon_cur >= mon_top + browser_rows)
8015 mon_top = MIN(mon_cnt - browser_rows, mon_top + browser_rows/2);
8020 /* Display a list of monsters in the current group */
8021 display_monster_list(max + 3, 6, browser_rows, mon_idx, mon_cur, mon_top, visual_only);
8027 /* Display a monster name */
8028 display_monster_list(max + 3, 6, 1, mon_idx, mon_cur, mon_top, visual_only);
8030 /* Display visual list below first monster */
8031 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8036 prt(format("<Êý¸þ>%s%s%s, ESC",
8037 (!visual_list && !visual_only) ? ", 'r'¤Ç»×¤¤½Ð¤ò¸«¤ë" : "",
8038 visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
8039 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
8042 prt(format("<dir>%s%s%s, ESC",
8043 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
8044 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
8045 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
8049 /* Get the current monster */
8050 r_ptr = &r_info[mon_idx[mon_cur]];
8054 /* Mega Hack -- track this monster race */
8055 if (mon_cnt) monster_race_track(mon_idx[mon_cur]);
8057 /* Hack -- handle stuff */
8063 place_visual_list_cursor(max + 3, 7, r_ptr->x_attr, r_ptr->x_char, attr_top, char_left);
8067 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8071 Term_gotoxy(max + 3, 6 + (mon_cur - mon_top));
8076 /* Do visual mode command if needed */
8077 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))
8079 if (direct_r_idx >= 0)
8104 /* Recall on screen */
8105 if (!visual_list && !visual_only && (mon_idx[mon_cur] > 0))
8107 screen_roff(mon_idx[mon_cur], 0);
8118 /* Move the cursor */
8119 browser_cursor(ch, &column, &grp_cur, grp_cnt, &mon_cur, mon_cnt);
8126 /* Free the "mon_idx" array */
8127 C_KILL(mon_idx, max_r_idx, s16b);
8132 * Display the objects in a group.
8134 static void display_object_list(int col, int row, int per_page, int object_idx[],
8135 int object_cur, int object_top, bool visual_only)
8139 /* Display lines until done */
8140 for (i = 0; i < per_page && (object_idx[object_top + i] >= 0); i++)
8144 object_kind *flavor_k_ptr;
8146 /* Get the object index */
8147 int k_idx = object_idx[object_top + i];
8149 /* Access the object */
8150 object_kind *k_ptr = &k_info[k_idx];
8152 /* Choose a color */
8153 byte attr = ((k_ptr->aware || visual_only) ? TERM_WHITE : TERM_SLATE);
8154 byte cursor = ((k_ptr->aware || visual_only) ? TERM_L_BLUE : TERM_BLUE);
8157 if (!visual_only && k_ptr->flavor)
8159 /* Appearance of this object is shuffled */
8160 flavor_k_ptr = &k_info[k_ptr->flavor];
8164 /* Appearance of this object is very normal */
8165 flavor_k_ptr = k_ptr;
8170 attr = ((i + object_top == object_cur) ? cursor : attr);
8172 if (!k_ptr->flavor || (!visual_only && k_ptr->aware))
8175 strip_name(o_name, k_idx);
8180 strcpy(o_name, k_name + flavor_k_ptr->flavor_name);
8183 /* Display the name */
8184 c_prt(attr, o_name, row + i, col);
8186 /* Hack -- visual_list mode */
8189 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);
8191 if (p_ptr->wizard || visual_only)
8193 c_prt(attr, format("%d", k_idx), row + i, 70);
8196 a = flavor_k_ptr->x_attr;
8197 c = flavor_k_ptr->x_char;
8199 /* Display symbol */
8200 Term_queue_bigchar(use_bigtile ? 76 : 77, row + i, a, c, 0, 0);
8203 /* Clear remaining lines */
8204 for (; i < per_page; i++)
8206 Term_erase(col, row + i, 255);
8211 * Describe fake object
8213 static void desc_obj_fake(int k_idx)
8216 object_type object_type_body;
8218 /* Get local object */
8219 o_ptr = &object_type_body;
8221 /* Wipe the object */
8224 /* Create the artifact */
8225 object_prep(o_ptr, k_idx);
8227 /* It's fully know */
8228 o_ptr->ident |= IDENT_KNOWN;
8230 /* Track the object */
8231 /* object_actual_track(o_ptr); */
8233 /* Hack - mark as fake */
8234 /* term_obj_real = FALSE; */
8236 /* Hack -- Handle stuff */
8239 if (!screen_object(o_ptr, SCROBJ_FAKE_OBJECT | SCROBJ_FORCE_DETAIL))
8242 msg_print("ÆäËÊѤï¤Ã¤¿¤È¤³¤í¤Ï¤Ê¤¤¤è¤¦¤À¡£");
8244 msg_print("You see nothing special.");
8253 * Display known objects
8255 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int direct_k_idx)
8258 int grp_cur, grp_top, old_grp_cur;
8259 int object_old, object_cur, object_top;
8260 int grp_cnt, grp_idx[100];
8268 bool visual_list = FALSE;
8269 byte attr_top = 0, char_left = 0;
8277 Term_get_size(&wid, &hgt);
8279 browser_rows = hgt - 8;
8281 /* Allocate the "object_idx" array */
8282 C_MAKE(object_idx, max_k_idx, int);
8287 if (direct_k_idx < 0)
8289 mode = visual_only ? 0x03 : 0x01;
8291 /* Check every group */
8292 for (i = 0; object_group_text[i] != NULL; i++)
8294 /* Measure the label */
8295 len = strlen(object_group_text[i]);
8297 /* Save the maximum length */
8298 if (len > max) max = len;
8300 /* See if any monsters are known */
8301 if (collect_objects(i, object_idx, mode))
8303 /* Build a list of groups with known monsters */
8304 grp_idx[grp_cnt++] = i;
8313 object_kind *k_ptr = &k_info[direct_k_idx];
8314 object_kind *flavor_k_ptr;
8316 if (!visual_only && k_ptr->flavor)
8318 /* Appearance of this object is shuffled */
8319 flavor_k_ptr = &k_info[k_ptr->flavor];
8323 /* Appearance of this object is very normal */
8324 flavor_k_ptr = k_ptr;
8327 object_idx[0] = direct_k_idx;
8328 object_old = direct_k_idx;
8331 /* Terminate the list */
8334 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
8335 &attr_top, &char_left, &flavor_k_ptr->x_attr, &flavor_k_ptr->x_char, need_redraw);
8338 /* Terminate the list */
8339 grp_idx[grp_cnt] = -1;
8342 grp_cur = grp_top = 0;
8343 object_cur = object_top = 0;
8348 mode = visual_only ? 0x02 : 0x00;
8353 object_kind *k_ptr, *flavor_k_ptr;
8360 prt(format("%s - ¥¢¥¤¥Æ¥à", !visual_only ? "Ãμ±" : "ɽ¼¨"), 2, 0);
8361 if (direct_k_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
8362 prt("̾Á°", 4, max + 3);
8363 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
8366 prt(format("%s - objects", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
8367 if (direct_k_idx < 0) prt("Group", 4, 0);
8368 prt("Name", 4, max + 3);
8369 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
8373 for (i = 0; i < 78; i++)
8375 Term_putch(i, 5, TERM_WHITE, '=');
8378 if (direct_k_idx < 0)
8380 for (i = 0; i < browser_rows; i++)
8382 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8389 if (direct_k_idx < 0)
8391 /* Scroll group list */
8392 if (grp_cur < grp_top) grp_top = grp_cur;
8393 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8395 /* Display a list of object groups */
8396 display_group_list(0, 6, max, browser_rows, grp_idx, object_group_text, grp_cur, grp_top);
8398 if (old_grp_cur != grp_cur)
8400 old_grp_cur = grp_cur;
8402 /* Get a list of objects in the current group */
8403 object_cnt = collect_objects(grp_idx[grp_cur], object_idx, mode);
8406 /* Scroll object list */
8407 while (object_cur < object_top)
8408 object_top = MAX(0, object_top - browser_rows/2);
8409 while (object_cur >= object_top + browser_rows)
8410 object_top = MIN(object_cnt - browser_rows, object_top + browser_rows/2);
8415 /* Display a list of objects in the current group */
8416 display_object_list(max + 3, 6, browser_rows, object_idx, object_cur, object_top, visual_only);
8420 object_top = object_cur;
8422 /* Display a list of objects in the current group */
8423 display_object_list(max + 3, 6, 1, object_idx, object_cur, object_top, visual_only);
8425 /* Display visual list below first object */
8426 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8429 /* Get the current object */
8430 k_ptr = &k_info[object_idx[object_cur]];
8432 if (!visual_only && k_ptr->flavor)
8434 /* Appearance of this object is shuffled */
8435 flavor_k_ptr = &k_info[k_ptr->flavor];
8439 /* Appearance of this object is very normal */
8440 flavor_k_ptr = k_ptr;
8445 prt(format("<Êý¸þ>%s%s%s, ESC",
8446 (!visual_list && !visual_only) ? ", 'r'¤Ç¾ÜºÙ¤ò¸«¤ë" : "",
8447 visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
8448 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
8451 prt(format("<dir>%s%s%s, ESC",
8452 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
8453 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
8454 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
8460 /* Mega Hack -- track this object */
8461 if (object_cnt) object_kind_track(object_idx[object_cur]);
8463 /* The "current" object changed */
8464 if (object_old != object_idx[object_cur])
8466 /* Hack -- handle stuff */
8469 /* Remember the "current" object */
8470 object_old = object_idx[object_cur];
8476 place_visual_list_cursor(max + 3, 7, flavor_k_ptr->x_attr, flavor_k_ptr->x_char, attr_top, char_left);
8480 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8484 Term_gotoxy(max + 3, 6 + (object_cur - object_top));
8489 /* Do visual mode command if needed */
8490 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))
8492 if (direct_k_idx >= 0)
8517 /* Recall on screen */
8518 if (!visual_list && !visual_only && (grp_cnt > 0))
8520 desc_obj_fake(object_idx[object_cur]);
8528 /* Move the cursor */
8529 browser_cursor(ch, &column, &grp_cur, grp_cnt, &object_cur, object_cnt);
8535 /* Free the "object_idx" array */
8536 C_KILL(object_idx, max_k_idx, int);
8541 * Display the features in a group.
8543 static void display_feature_list(int col, int row, int per_page, int *feat_idx,
8544 int feat_cur, int feat_top, bool visual_only, int lighting_level)
8546 int lit_col[F_LIT_MAX], i, j;
8547 int f_idx_col = use_bigtile ? 62 : 64;
8549 /* Correct columns 1 and 4 */
8550 lit_col[F_LIT_STANDARD] = use_bigtile ? (71 - F_LIT_MAX) : 71;
8551 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
8552 lit_col[i] = lit_col[F_LIT_STANDARD] + 2 + (i - F_LIT_NS_BEGIN) * 2 + (use_bigtile ? i : 0);
8554 /* Display lines until done */
8555 for (i = 0; i < per_page && (feat_idx[feat_top + i] >= 0); i++)
8560 int f_idx = feat_idx[feat_top + i];
8562 /* Access the index */
8563 feature_type *f_ptr = &f_info[f_idx];
8565 int row_i = row + i;
8567 /* Choose a color */
8568 attr = ((i + feat_top == feat_cur) ? TERM_L_BLUE : TERM_WHITE);
8570 /* Display the name */
8571 c_prt(attr, f_name + f_ptr->name, row_i, col);
8573 /* Hack -- visual_list mode */
8576 /* Display lighting level */
8577 c_prt(attr, format("(%s)", lighting_level_str[lighting_level]), row_i, col + 1 + strlen(f_name + f_ptr->name));
8579 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));
8581 if (p_ptr->wizard || visual_only)
8583 c_prt(attr, format("%d", f_idx), row_i, f_idx_col);
8586 /* Display symbol */
8587 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);
8589 Term_putch(lit_col[F_LIT_NS_BEGIN], row_i, TERM_SLATE, '(');
8590 for (j = F_LIT_NS_BEGIN + 1; j < F_LIT_MAX; j++)
8592 Term_putch(lit_col[j], row_i, TERM_SLATE, '/');
8594 Term_putch(lit_col[F_LIT_MAX - 1] + (use_bigtile ? 3 : 2), row_i, TERM_SLATE, ')');
8596 /* Mega-hack -- Use non-standard colour */
8597 for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
8599 Term_queue_bigchar(lit_col[j] + 1, row_i, f_ptr->x_attr[j], f_ptr->x_char[j], 0, 0);
8603 /* Clear remaining lines */
8604 for (; i < per_page; i++)
8606 Term_erase(col, row + i, 255);
8612 * Interact with feature visuals.
8614 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int direct_f_idx, int *lighting_level)
8617 int grp_cur, grp_top, old_grp_cur;
8618 int feat_cur, feat_top;
8619 int grp_cnt, grp_idx[100];
8627 bool visual_list = FALSE;
8628 byte attr_top = 0, char_left = 0;
8633 byte attr_old[F_LIT_MAX];
8634 byte char_old[F_LIT_MAX];
8635 byte *cur_attr_ptr, *cur_char_ptr;
8637 C_WIPE(attr_old, F_LIT_MAX, byte);
8638 C_WIPE(char_old, F_LIT_MAX, byte);
8641 Term_get_size(&wid, &hgt);
8643 browser_rows = hgt - 8;
8645 /* Allocate the "feat_idx" array */
8646 C_MAKE(feat_idx, max_f_idx, int);
8651 if (direct_f_idx < 0)
8653 /* Check every group */
8654 for (i = 0; feature_group_text[i] != NULL; i++)
8656 /* Measure the label */
8657 len = strlen(feature_group_text[i]);
8659 /* Save the maximum length */
8660 if (len > max) max = len;
8662 /* See if any features are known */
8663 if (collect_features(i, feat_idx, 0x01))
8665 /* Build a list of groups with known features */
8666 grp_idx[grp_cnt++] = i;
8674 feature_type *f_ptr = &f_info[direct_f_idx];
8676 feat_idx[0] = direct_f_idx;
8679 /* Terminate the list */
8682 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
8683 &attr_top, &char_left, &f_ptr->x_attr[*lighting_level], &f_ptr->x_char[*lighting_level], need_redraw);
8685 for (i = 0; i < F_LIT_MAX; i++)
8687 attr_old[i] = f_ptr->x_attr[i];
8688 char_old[i] = f_ptr->x_char[i];
8692 /* Terminate the list */
8693 grp_idx[grp_cnt] = -1;
8696 grp_cur = grp_top = 0;
8697 feat_cur = feat_top = 0;
8705 feature_type *f_ptr;
8712 prt("ɽ¼¨ - ÃÏ·Á", 2, 0);
8713 if (direct_f_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
8714 prt("̾Á°", 4, max + 3);
8717 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
8718 prt("ʸ»ú ( l/ d)", 4, 66);
8722 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
8723 prt("ʸ»ú (l/d)", 4, 68);
8726 prt("Visuals - features", 2, 0);
8727 if (direct_f_idx < 0) prt("Group", 4, 0);
8728 prt("Name", 4, max + 3);
8731 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
8732 prt("Sym ( l/ d)", 4, 67);
8736 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
8737 prt("Sym (l/d)", 4, 69);
8741 for (i = 0; i < 78; i++)
8743 Term_putch(i, 5, TERM_WHITE, '=');
8746 if (direct_f_idx < 0)
8748 for (i = 0; i < browser_rows; i++)
8750 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8757 if (direct_f_idx < 0)
8759 /* Scroll group list */
8760 if (grp_cur < grp_top) grp_top = grp_cur;
8761 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8763 /* Display a list of feature groups */
8764 display_group_list(0, 6, max, browser_rows, grp_idx, feature_group_text, grp_cur, grp_top);
8766 if (old_grp_cur != grp_cur)
8768 old_grp_cur = grp_cur;
8770 /* Get a list of features in the current group */
8771 feat_cnt = collect_features(grp_idx[grp_cur], feat_idx, 0x00);
8774 /* Scroll feature list */
8775 while (feat_cur < feat_top)
8776 feat_top = MAX(0, feat_top - browser_rows/2);
8777 while (feat_cur >= feat_top + browser_rows)
8778 feat_top = MIN(feat_cnt - browser_rows, feat_top + browser_rows/2);
8783 /* Display a list of features in the current group */
8784 display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top, visual_only, F_LIT_STANDARD);
8788 feat_top = feat_cur;
8790 /* Display a list of features in the current group */
8791 display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top, visual_only, *lighting_level);
8793 /* Display visual list below first object */
8794 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8799 prt(format("<Êý¸þ>%s, 'd'¤Çɸ½à¸÷¸»¸ú²Ì%s, ESC",
8800 visual_list ? ", ENTER¤Ç·èÄê, 'a'¤ÇÂоÝÌÀÅÙÊѹ¹" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
8801 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
8804 prt(format("<dir>%s, 'd' for default lighting%s, ESC",
8805 visual_list ? ", ENTER to accept, 'a' for lighting level" : ", 'v' for visuals",
8806 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
8810 /* Get the current feature */
8811 f_ptr = &f_info[feat_idx[feat_cur]];
8812 cur_attr_ptr = &f_ptr->x_attr[*lighting_level];
8813 cur_char_ptr = &f_ptr->x_char[*lighting_level];
8817 place_visual_list_cursor(max + 3, 7, *cur_attr_ptr, *cur_char_ptr, attr_top, char_left);
8821 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8825 Term_gotoxy(max + 3, 6 + (feat_cur - feat_top));
8830 if (visual_list && ((ch == 'A') || (ch == 'a')))
8832 int prev_lighting_level = *lighting_level;
8836 if (*lighting_level <= 0) *lighting_level = F_LIT_MAX - 1;
8837 else (*lighting_level)--;
8841 if (*lighting_level >= F_LIT_MAX - 1) *lighting_level = 0;
8842 else (*lighting_level)++;
8845 if (f_ptr->x_attr[prev_lighting_level] != f_ptr->x_attr[*lighting_level])
8846 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
8848 if (f_ptr->x_char[prev_lighting_level] != f_ptr->x_char[*lighting_level])
8849 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
8854 else if ((ch == 'D') || (ch == 'd'))
8856 byte prev_x_attr = f_ptr->x_attr[*lighting_level];
8857 byte prev_x_char = f_ptr->x_char[*lighting_level];
8859 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
8863 if (prev_x_attr != f_ptr->x_attr[*lighting_level])
8864 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
8866 if (prev_x_char != f_ptr->x_char[*lighting_level])
8867 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
8869 else *need_redraw = TRUE;
8874 /* Do visual mode command if needed */
8875 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))
8879 /* Restore previous visual settings */
8881 for (i = 0; i < F_LIT_MAX; i++)
8883 f_ptr->x_attr[i] = attr_old[i];
8884 f_ptr->x_char[i] = char_old[i];
8891 if (direct_f_idx >= 0) flag = TRUE;
8892 else *lighting_level = F_LIT_STANDARD;
8895 /* Preserve current visual settings */
8898 for (i = 0; i < F_LIT_MAX; i++)
8900 attr_old[i] = f_ptr->x_attr[i];
8901 char_old[i] = f_ptr->x_char[i];
8903 *lighting_level = F_LIT_STANDARD;
8910 for (i = 0; i < F_LIT_MAX; i++)
8912 attr_idx_feat[i] = f_ptr->x_attr[i];
8913 char_idx_feat[i] = f_ptr->x_char[i];
8922 /* Allow TERM_DARK text */
8923 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
8925 if (attr_idx_feat[i] || (!(char_idx_feat[i] & 0x80) && char_idx_feat[i])) f_ptr->x_attr[i] = attr_idx_feat[i];
8926 if (char_idx_feat[i]) f_ptr->x_char[i] = char_idx_feat[i];
8944 /* Move the cursor */
8945 browser_cursor(ch, &column, &grp_cur, grp_cnt, &feat_cur, feat_cnt);
8951 /* Free the "feat_idx" array */
8952 C_KILL(feat_idx, max_f_idx, int);
8957 * List wanted monsters
8959 static void do_cmd_knowledge_kubi(void)
8964 char file_name[1024];
8967 /* Open a new file */
8968 fff = my_fopen_temp(file_name, 1024);
8971 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8973 msg_format("Failed to create temporary file %s.", file_name);
8981 bool listed = FALSE;
8984 fprintf(fff, "º£Æü¤Î¥¿¡¼¥²¥Ã¥È : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "ÉÔÌÀ"));
8986 fprintf(fff, "¾Þ¶â¼ó¥ê¥¹¥È\n");
8988 fprintf(fff, "Today target : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "unknown"));
8990 fprintf(fff, "List of wanted monsters\n");
8992 fprintf(fff, "----------------------------------------------\n");
8994 for (i = 0; i < MAX_KUBI; i++)
8996 if (kubi_r_idx[i] <= 10000)
8998 fprintf(fff,"%s\n", r_name + r_info[kubi_r_idx[i]].name);
9007 fprintf(fff,"\n%s\n", "¾Þ¶â¼ó¤Ï¤â¤¦»Ä¤Ã¤Æ¤¤¤Þ¤»¤ó¡£");
9009 fprintf(fff,"\n%s\n", "There is no more wanted monster.");
9014 /* Close the file */
9017 /* Display the file contents */
9019 show_file(TRUE, file_name, "¾Þ¶â¼ó¤Î°ìÍ÷", 0, 0);
9021 show_file(TRUE, file_name, "Wanted monsters", 0, 0);
9025 /* Remove the file */
9030 * List virtues & status
9032 static void do_cmd_knowledge_virtues(void)
9036 char file_name[1024];
9039 /* Open a new file */
9040 fff = my_fopen_temp(file_name, 1024);
9043 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9045 msg_format("Failed to create temporary file %s.", file_name);
9054 fprintf(fff, "¸½ºß¤Î°À : %s\n\n", your_alignment());
9056 fprintf(fff, "Your alighnment : %s\n\n", your_alignment());
9061 /* Close the file */
9064 /* Display the file contents */
9066 show_file(TRUE, file_name, "Ȭ¤Ä¤ÎÆÁ", 0, 0);
9068 show_file(TRUE, file_name, "Virtues", 0, 0);
9072 /* Remove the file */
9080 static void do_cmd_knowledge_dungeon(void)
9084 char file_name[1024];
9088 /* Open a new file */
9089 fff = my_fopen_temp(file_name, 1024);
9092 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9094 msg_format("Failed to create temporary file %s.", file_name);
9102 for (i = 1; i < max_d_idx; i++)
9106 if (!d_info[i].maxdepth) continue;
9107 if (!max_dlv[i]) continue;
9108 if (d_info[i].final_guardian)
9110 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
9112 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
9114 fprintf(fff,"%c%-12s : %3d ³¬\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
9116 fprintf(fff,"%c%-16s : level %3d\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
9121 /* Close the file */
9124 /* Display the file contents */
9126 show_file(TRUE, file_name, "º£¤Þ¤Ç¤ËÆþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó", 0, 0);
9128 show_file(TRUE, file_name, "Dungeon", 0, 0);
9132 /* Remove the file */
9137 * List virtues & status
9140 static void do_cmd_knowledge_stat(void)
9144 char file_name[1024];
9147 /* Open a new file */
9148 fff = my_fopen_temp(file_name, 1024);
9151 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9153 msg_format("Failed to create temporary file %s.", file_name);
9161 percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
9162 (2 * p_ptr->hitdie +
9163 ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
9166 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : %d/100\n\n", percent);
9167 else fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : ???\n\n");
9168 fprintf(fff, "ǽÎϤκÇÂçÃÍ\n\n");
9170 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "Your current Life Rating is %d/100.\n\n", percent);
9171 else fprintf(fff, "Your current Life Rating is ???.\n\n");
9172 fprintf(fff, "Limits of maximum stats\n\n");
9174 for (v_nr = 0; v_nr < 6; v_nr++)
9176 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);
9177 else fprintf(fff, "%s ???\n", stat_names[v_nr]);
9183 /* Close the file */
9186 /* Display the file contents */
9188 show_file(TRUE, file_name, "¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó", 0, 0);
9190 show_file(TRUE, file_name, "HP-rate & Max stat", 0, 0);
9194 /* Remove the file */
9200 * Print all active quests
9202 static void do_cmd_knowledge_quests_current(FILE *fff)
9205 char rand_tmp_str[120] = "\0";
9207 monster_race *r_ptr;
9209 int rand_level = 100;
9213 fprintf(fff, "¡Ô¿ë¹ÔÃæ¤Î¥¯¥¨¥¹¥È¡Õ\n");
9215 fprintf(fff, "< Current Quest >\n");
9218 for (i = 1; i < max_quests; i++)
9220 if ((quest[i].status == QUEST_STATUS_TAKEN) || (quest[i].status == QUEST_STATUS_COMPLETED))
9222 /* Set the quest number temporary */
9223 int old_quest = p_ptr->inside_quest;
9226 /* Clear the text */
9227 for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
9228 quest_text_line = 0;
9230 p_ptr->inside_quest = i;
9232 /* Get the quest text */
9233 init_flags = INIT_SHOW_TEXT;
9235 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9237 /* Reset the old quest number */
9238 p_ptr->inside_quest = old_quest;
9240 /* No info from "silent" quests */
9241 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
9245 if (quest[i].type != QUEST_TYPE_RANDOM)
9247 char note[80] = "\0";
9249 if (quest[i].status == QUEST_STATUS_TAKEN)
9251 switch (quest[i].type)
9253 case QUEST_TYPE_KILL_LEVEL:
9254 case QUEST_TYPE_KILL_ANY_LEVEL:
9255 r_ptr = &r_info[quest[i].r_idx];
9256 strcpy(name, r_name + r_ptr->name);
9257 if (quest[i].max_num > 1)
9260 sprintf(note," - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
9261 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
9264 sprintf(note," - kill %d %s, have killed %d.",
9265 quest[i].max_num, name, quest[i].cur_num);
9270 sprintf(note," - %s¤òÅݤ¹¡£",name);
9272 sprintf(note," - kill %s.",name);
9276 case QUEST_TYPE_FIND_ARTIFACT:
9277 strcpy(name, a_name + a_info[quest[i].k_idx].name);
9279 sprintf(note," - %s¤ò¸«¤Ä¤±½Ð¤¹¡£", name);
9281 sprintf(note," - Find out %s.", name);
9285 case QUEST_TYPE_FIND_EXIT:
9287 sprintf(note," - õº÷¤¹¤ë¡£");
9289 sprintf(note," - Search.");
9293 case QUEST_TYPE_KILL_NUMBER:
9295 sprintf(note," - %d ÂΤΥâ¥ó¥¹¥¿¡¼¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
9296 quest[i].max_num, quest[i].max_num - quest[i].cur_num);
9298 sprintf(note," - Kill %d monsters, have killed %d.",
9299 quest[i].max_num, quest[i].cur_num);
9303 case QUEST_TYPE_KILL_ALL:
9305 sprintf(note," - Á´¤Æ¤Î¥â¥ó¥¹¥¿¡¼¤òÅݤ¹¡£");
9307 sprintf(note," - Kill all monsters.");
9313 /* Print the quest info */
9315 sprintf(tmp_str, " %s (´í¸±ÅÙ:%d³¬ÁêÅö)%s\n",
9316 quest[i].name, quest[i].level, note);
9318 sprintf(tmp_str, " %s (Danger level: %d)%s\n",
9319 quest[i].name, quest[i].level, note);
9322 fprintf(fff, tmp_str);
9324 if (quest[i].status == QUEST_STATUS_COMPLETED)
9327 sprintf(tmp_str, " ¥¯¥¨¥¹¥ÈãÀ® - ¤Þ¤ÀÊó½·¤ò¼õ¤±¤È¤Ã¤Æ¤Ê¤¤¡£\n");
9329 sprintf(tmp_str, " Quest Completed - Unrewarded\n");
9331 fprintf(fff, tmp_str);
9337 while (quest_text[j][0] && j < 10)
9339 fprintf(fff, " %s\n", quest_text[j]);
9344 else if (quest[i].level < rand_level) /* QUEST_TYPE_RANDOM */
9347 rand_level = quest[i].level;
9349 if (max_dlv[DUNGEON_ANGBAND] >= rand_level)
9351 /* Print the quest info */
9352 r_ptr = &r_info[quest[i].r_idx];
9353 strcpy(name, r_name + r_ptr->name);
9355 if (quest[i].max_num > 1)
9358 sprintf(rand_tmp_str," %s (%d ³¬) - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)\n",
9359 quest[i].name, quest[i].level,
9360 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
9364 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
9365 quest[i].name, quest[i].level,
9366 quest[i].max_num, name, quest[i].cur_num);
9372 sprintf(rand_tmp_str," %s (%d ³¬) - %s¤òÅݤ¹¡£\n",
9373 quest[i].name, quest[i].level, name);
9375 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %s.\n",
9376 quest[i].name, quest[i].level, name);
9384 /* Print the current random quest */
9385 if (rand_tmp_str[0]) fprintf(fff, rand_tmp_str);
9388 if (!total) fprintf(fff, " ¤Ê¤·\n");
9390 if (!total) fprintf(fff, " Nothing.\n");
9396 * Print all finished quests
9398 void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[])
9405 fprintf(fff, "¡ÔãÀ®¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
9407 fprintf(fff, "< Completed Quest >\n");
9409 for (i = 1; i < max_quests; i++)
9411 int q_idx = quest_num[i];
9413 if (quest[q_idx].status == QUEST_STATUS_FINISHED)
9415 if (is_fixed_quest_idx(q_idx))
9417 /* Set the quest number temporary */
9418 int old_quest = p_ptr->inside_quest;
9420 p_ptr->inside_quest = q_idx;
9423 init_flags = INIT_ASSIGN;
9425 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9427 /* Reset the old quest number */
9428 p_ptr->inside_quest = old_quest;
9430 /* No info from "silent" quests */
9431 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
9436 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
9438 /* Print the quest info */
9440 if (quest[q_idx].complev == 0)
9444 " %-40s (%3d³¬) - ÉÔÀᄀ\n",
9446 " %-40s (Dungeon level: %3d) - (Cancelled)\n",
9448 r_name+r_info[quest[q_idx].r_idx].name,
9449 quest[q_idx].level);
9455 " %-40s (%3d³¬) - ¥ì¥Ù¥ë%2d\n",
9457 " %-40s (Dungeon level: %3d) - level %2d\n",
9459 r_name+r_info[quest[q_idx].r_idx].name,
9461 quest[q_idx].complev);
9466 /* Print the quest info */
9468 sprintf(tmp_str, " %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
9469 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9471 sprintf(tmp_str, " %-40s (Danger level: %3d) - level %2d\n",
9472 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9476 fprintf(fff, tmp_str);
9480 if (!total) fprintf(fff, " ¤Ê¤·\n");
9482 if (!total) fprintf(fff, " Nothing.\n");
9488 * Print all failed quests
9490 void do_cmd_knowledge_quests_failed(FILE *fff, int quest_num[])
9497 fprintf(fff, "¡Ô¼ºÇÔ¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
9499 fprintf(fff, "< Failed Quest >\n");
9501 for (i = 1; i < max_quests; i++)
9503 int q_idx = quest_num[i];
9505 if ((quest[q_idx].status == QUEST_STATUS_FAILED_DONE) || (quest[q_idx].status == QUEST_STATUS_FAILED))
9507 if (is_fixed_quest_idx(q_idx))
9509 /* Set the quest number temporary */
9510 int old_quest = p_ptr->inside_quest;
9512 p_ptr->inside_quest = q_idx;
9514 /* Get the quest text */
9515 init_flags = INIT_ASSIGN;
9517 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9519 /* Reset the old quest number */
9520 p_ptr->inside_quest = old_quest;
9522 /* No info from "silent" quests */
9523 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
9528 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
9530 /* Print the quest info */
9532 sprintf(tmp_str, " %-40s (%3d³¬) - ¥ì¥Ù¥ë%2d\n",
9533 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
9535 sprintf(tmp_str, " %-40s (Dungeon level: %3d) - level %2d\n",
9536 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
9541 /* Print the quest info */
9543 sprintf(tmp_str, " %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
9544 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9546 sprintf(tmp_str, " %-40s (Danger level: %3d) - level %2d\n",
9547 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9550 fprintf(fff, tmp_str);
9554 if (!total) fprintf(fff, " ¤Ê¤·\n");
9556 if (!total) fprintf(fff, " Nothing.\n");
9562 * Print all random quests
9564 static void do_cmd_knowledge_quests_wiz_random(FILE *fff)
9571 fprintf(fff, "¡Ô»Ä¤ê¤Î¥é¥ó¥À¥à¥¯¥¨¥¹¥È¡Õ\n");
9573 fprintf(fff, "< Remaining Random Quest >\n");
9575 for (i = 1; i < max_quests; i++)
9577 /* No info from "silent" quests */
9578 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
9580 if ((quest[i].type == QUEST_TYPE_RANDOM) && (quest[i].status == QUEST_STATUS_TAKEN))
9584 /* Print the quest info */
9586 sprintf(tmp_str, " %s (%d³¬, %s)\n",
9587 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
9589 sprintf(tmp_str, " %s (%d, %s)\n",
9590 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
9592 fprintf(fff, tmp_str);
9596 if (!total) fprintf(fff, " ¤Ê¤·\n");
9598 if (!total) fprintf(fff, " Nothing.\n");
9603 bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b)
9605 int *q_num = (int *)u;
9606 quest_type *qa = &quest[q_num[a]];
9607 quest_type *qb = &quest[q_num[b]];
9612 if (qa->complev < qb->complev) return TRUE;
9613 if (qa->complev > qb->complev) return FALSE;
9614 if (qa->level <= qb->level) return TRUE;
9618 void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b)
9620 int *q_num = (int *)u;
9627 q_num[a] = q_num[b];
9633 * Print quest status of all active quests
9635 static void do_cmd_knowledge_quests(void)
9638 char file_name[1024];
9639 int *quest_num, dummy, i;
9641 /* Open a new file */
9642 fff = my_fopen_temp(file_name, 1024);
9646 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9648 msg_format("Failed to create temporary file %s.", file_name);
9654 /* Allocate Memory */
9655 C_MAKE(quest_num, max_quests, int);
9657 /* Sort by compete level */
9658 for (i = 1; i < max_quests; i++) quest_num[i] = i;
9659 ang_sort_comp = ang_sort_comp_quest_num;
9660 ang_sort_swap = ang_sort_swap_quest_num;
9661 ang_sort(quest_num, &dummy, max_quests);
9663 /* Dump Quest Information */
9664 do_cmd_knowledge_quests_current(fff);
9666 do_cmd_knowledge_quests_completed(fff, quest_num);
9668 do_cmd_knowledge_quests_failed(fff, quest_num);
9672 do_cmd_knowledge_quests_wiz_random(fff);
9675 /* Close the file */
9678 /* Display the file contents */
9680 show_file(TRUE, file_name, "¥¯¥¨¥¹¥ÈãÀ®¾õ¶·", 0, 0);
9682 show_file(TRUE, file_name, "Quest status", 0, 0);
9685 /* Remove the file */
9689 C_KILL(quest_num, max_quests, int);
9696 static void do_cmd_knowledge_home(void)
9701 char file_name[1024];
9703 char o_name[MAX_NLEN];
9706 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
9708 /* Open a new file */
9709 fff = my_fopen_temp(file_name, 1024);
9712 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9714 msg_format("Failed to create temporary file %s.", file_name);
9722 /* Print all homes in the different towns */
9723 st_ptr = &town[1].store[STORE_HOME];
9725 /* Home -- if anything there */
9726 if (st_ptr->stock_num)
9731 /* Header with name of the town */
9733 fprintf(fff, " [ ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ]\n");
9735 fprintf(fff, " [Home Inventory]\n");
9738 /* Dump all available items */
9739 for (i = 0; i < st_ptr->stock_num; i++)
9742 if ((i % 12) == 0) fprintf(fff, "\n ( %d ¥Ú¡¼¥¸ )\n", x++);
9743 object_desc(o_name, &st_ptr->stock[i], 0);
9744 if (strlen(o_name) <= 80-3)
9746 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9752 for (n = 0, t = o_name; n < 80-3; n++, t++)
9753 if(iskanji(*t)) {t++; n++;}
9754 if (n == 81-3) n = 79-3; /* ºÇ¸å¤¬´Á»úȾʬ */
9756 fprintf(fff, "%c%s %.*s\n", I2A(i%12), paren, n, o_name);
9757 fprintf(fff, " %.77s\n", o_name+n);
9760 object_desc(o_name, &st_ptr->stock[i], 0);
9761 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9766 /* Add an empty line */
9767 fprintf(fff, "\n\n");
9771 /* Close the file */
9774 /* Display the file contents */
9776 show_file(TRUE, file_name, "²æ¤¬²È¤Î¥¢¥¤¥Æ¥à", 0, 0);
9778 show_file(TRUE, file_name, "Home Inventory", 0, 0);
9782 /* Remove the file */
9788 * Check the status of "autopick"
9790 static void do_cmd_knowledge_autopick(void)
9794 char file_name[1024];
9796 /* Open a new file */
9797 fff = my_fopen_temp(file_name, 1024);
9802 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9804 msg_format("Failed to create temporary file %s.", file_name);
9813 fprintf(fff, "¼«Æ°Ç˲õ/½¦¤¤¤Ë¤Ï²¿¤âÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
9815 fprintf(fff, "No preference for auto picker/destroyer.");
9821 fprintf(fff, " ¼«Æ°½¦¤¤/Ç˲õ¤Ë¤Ï¸½ºß %d¹ÔÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤¹¡£\n\n", max_autopick);
9823 fprintf(fff, " There are %d registered lines for auto picker/destroyer.\n\n", max_autopick);
9827 for (k = 0; k < max_autopick; k++)
9830 byte act = autopick_list[k].action;
9831 if (act & DONT_AUTOPICK)
9839 else if (act & DO_AUTODESTROY)
9847 else if (act & DO_AUTOPICK)
9855 else /* if (act & DO_QUERY_AUTOPICK) */ /* Obvious */
9864 if (act & DO_DISPLAY)
9865 fprintf(fff, "%11s", format("[%s]", tmp));
9867 fprintf(fff, "%11s", format("(%s)", tmp));
9869 tmp = autopick_line_from_entry(&autopick_list[k]);
9870 fprintf(fff, " %s", tmp);
9874 /* Close the file */
9876 /* Display the file contents */
9878 show_file(TRUE, file_name, "¼«Æ°½¦¤¤/Ç˲õ ÀßÄê¥ê¥¹¥È", 0, 0);
9880 show_file(TRUE, file_name, "Auto-picker/Destroyer", 0, 0);
9883 /* Remove the file */
9889 * Interact with "knowledge"
9891 void do_cmd_knowledge(void)
9894 bool need_redraw = FALSE;
9896 /* File type is "TEXT" */
9897 FILE_TYPE(FILE_TYPE_TEXT);
9899 /* Save the screen */
9902 /* Interact until done */
9908 /* Ask for a choice */
9910 prt(format("%d/2 ¥Ú¡¼¥¸", (p+1)), 2, 65);
9911 prt("¸½ºß¤ÎÃ챤ò³Îǧ¤¹¤ë", 3, 0);
9913 prt(format("page %d/2", (p+1)), 2, 65);
9914 prt("Display current knowledge", 3, 0);
9917 /* Give some choices */
9921 prt("(1) ´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 6, 5);
9922 prt("(2) ´ûÃΤΥ¢¥¤¥Æ¥à ¤Î°ìÍ÷", 7, 5);
9923 prt("(3) ´ûÃΤÎÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 8, 5);
9924 prt("(4) ´ûÃΤΥâ¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 9, 5);
9925 prt("(5) Åݤ·¤¿Å¨¤Î¿ô ¤Î°ìÍ÷", 10, 5);
9926 if (!vanilla_town) prt("(6) ¾Þ¶â¼ó ¤Î°ìÍ÷", 11, 5);
9927 prt("(7) ¸½ºß¤Î¥Ú¥Ã¥È ¤Î°ìÍ÷", 12, 5);
9928 prt("(8) ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 13, 5);
9929 prt("(9) *´ÕÄê*ºÑ¤ßÁõÈ÷¤ÎÂÑÀ ¤Î°ìÍ÷", 14, 5);
9930 prt("(0) ÃÏ·Á¤Îɽ¼¨Ê¸»ú/¥¿¥¤¥ë ¤Î°ìÍ÷", 15, 5);
9934 prt("(a) ¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó ¤Î°ìÍ÷", 6, 5);
9935 prt("(b) ÆÍÁ³ÊÑ°Û ¤Î°ìÍ÷", 7, 5);
9936 prt("(c) Éð´ï¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 8, 5);
9937 prt("(d) ËâË¡¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 9, 5);
9938 prt("(e) µ»Ç½¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 10, 5);
9939 prt("(f) ¥×¥ì¥¤¥ä¡¼¤ÎÆÁ ¤Î°ìÍ÷", 11, 5);
9940 prt("(g) Æþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó ¤Î°ìÍ÷", 12, 5);
9941 prt("(h) ¼Â¹ÔÃæ¤Î¥¯¥¨¥¹¥È ¤Î°ìÍ÷", 13, 5);
9942 prt("(i) ¸½ºß¤Î¼«Æ°½¦¤¤/Ç˲õÀßÄê ¤Î°ìÍ÷", 14, 5);
9947 prt("(1) Display known artifacts", 6, 5);
9948 prt("(2) Display known objects", 7, 5);
9949 prt("(3) Display remaining uniques", 8, 5);
9950 prt("(4) Display known monster", 9, 5);
9951 prt("(5) Display kill count", 10, 5);
9952 if (!vanilla_town) prt("(6) Display wanted monsters", 11, 5);
9953 prt("(7) Display current pets", 12, 5);
9954 prt("(8) Display home inventory", 13, 5);
9955 prt("(9) Display *identified* equip.", 14, 5);
9956 prt("(0) Display terrain symbols.", 15, 5);
9960 prt("(a) Display about yourself", 6, 5);
9961 prt("(b) Display mutations", 7, 5);
9962 prt("(c) Display weapon proficiency", 8, 5);
9963 prt("(d) Display spell proficiency", 9, 5);
9964 prt("(e) Display misc. proficiency", 10, 5);
9965 prt("(f) Display virtues", 11, 5);
9966 prt("(g) Display dungeons", 12, 5);
9967 prt("(h) Display current quests", 13, 5);
9968 prt("(i) Display auto pick/destroy", 14, 5);
9973 prt("-³¤¯-", 17, 8);
9974 prt("ESC) È´¤±¤ë", 21, 1);
9975 prt("SPACE) ¼¡¥Ú¡¼¥¸", 21, 30);
9976 /*prt("-) Á°¥Ú¡¼¥¸", 21, 60);*/
9977 prt("¥³¥Þ¥ó¥É:", 20, 0);
9979 prt("-more-", 17, 8);
9980 prt("ESC) Exit menu", 21, 1);
9981 prt("SPACE) Next page", 21, 30);
9982 /*prt("-) Previous page", 21, 60);*/
9983 prt("Command: ", 20, 0);
9990 if (i == ESCAPE) break;
9993 case ' ': /* Page change */
9997 case '1': /* Artifacts */
9998 do_cmd_knowledge_artifacts();
10000 case '2': /* Objects */
10001 do_cmd_knowledge_objects(&need_redraw, FALSE, -1);
10003 case '3': /* Uniques */
10004 do_cmd_knowledge_uniques();
10006 case '4': /* Monsters */
10007 do_cmd_knowledge_monsters(&need_redraw, FALSE, -1);
10009 case '5': /* Kill count */
10010 do_cmd_knowledge_kill_count();
10012 case '6': /* wanted */
10013 if (!vanilla_town) do_cmd_knowledge_kubi();
10015 case '7': /* Pets */
10016 do_cmd_knowledge_pets();
10018 case '8': /* Home */
10019 do_cmd_knowledge_home();
10021 case '9': /* Resist list */
10022 do_cmd_knowledge_inven();
10024 case '0': /* Feature list */
10026 int lighting_level = F_LIT_STANDARD;
10027 do_cmd_knowledge_features(&need_redraw, FALSE, -1, &lighting_level);
10031 case 'a': /* Max stat */
10032 do_cmd_knowledge_stat();
10034 case 'b': /* Mutations */
10035 do_cmd_knowledge_mutations();
10037 case 'c': /* weapon-exp */
10038 do_cmd_knowledge_weapon_exp();
10040 case 'd': /* spell-exp */
10041 do_cmd_knowledge_spell_exp();
10043 case 'e': /* skill-exp */
10044 do_cmd_knowledge_skill_exp();
10046 case 'f': /* Virtues */
10047 do_cmd_knowledge_virtues();
10049 case 'g': /* Dungeon */
10050 do_cmd_knowledge_dungeon();
10052 case 'h': /* Quests */
10053 do_cmd_knowledge_quests();
10055 case 'i': /* Autopick */
10056 do_cmd_knowledge_autopick();
10058 default: /* Unknown option */
10062 /* Flush messages */
10066 /* Restore the screen */
10069 if (need_redraw) do_cmd_redraw();
10074 * Check on the status of an active quest
10076 void do_cmd_checkquest(void)
10078 /* File type is "TEXT" */
10079 FILE_TYPE(FILE_TYPE_TEXT);
10081 /* Save the screen */
10085 do_cmd_knowledge_quests();
10087 /* Restore the screen */
10093 * Display the time and date
10095 void do_cmd_time(void)
10097 int day, hour, min, full, start, end, num;
10105 extract_day_hour_min(&day, &hour, &min);
10107 full = hour * 100 + min;
10115 strcpy(desc, "ÊѤʻþ¹ï¤À¡£");
10117 strcpy(desc, "It is a strange time.");
10121 if (day < MAX_DAYS) sprintf(day_buf, "%d", day);
10122 else strcpy(day_buf, "*****");
10126 msg_format("%sÆüÌÜ, »þ¹ï¤Ï%d:%02d %s¤Ç¤¹¡£",
10127 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
10128 min, (hour < 12) ? "AM" : "PM");
10130 msg_format("This is day %s. The time is %d:%02d %s.",
10131 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
10132 min, (hour < 12) ? "AM" : "PM");
10136 /* Find the path */
10137 if (!randint0(10) || p_ptr->image)
10140 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun_j.txt");
10142 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun.txt");
10149 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm_j.txt");
10151 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm.txt");
10156 /* Open this file */
10157 fff = my_fopen(buf, "rt");
10162 /* Find this time */
10163 while (!my_fgets(fff, buf, sizeof(buf)))
10165 /* Ignore comments */
10166 if (!buf[0] || (buf[0] == '#')) continue;
10168 /* Ignore invalid lines */
10169 if (buf[1] != ':') continue;
10171 /* Process 'Start' */
10174 /* Extract the starting time */
10175 start = atoi(buf + 2);
10177 /* Assume valid for an hour */
10184 /* Process 'End' */
10187 /* Extract the ending time */
10188 end = atoi(buf + 2);
10194 /* Ignore incorrect range */
10195 if ((start > full) || (full > end)) continue;
10197 /* Process 'Description' */
10202 /* Apply the randomizer */
10203 if (!randint0(num)) strcpy(desc, buf + 2);
10213 /* Close the file */