4 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6 * This software may be copied and distributed for educational, research,
7 * and not for profit purposes provided that this copyright and statement
8 * are included in all such copies. Other copyrights may also apply.
11 /* Purpose: Interface commands */
18 * A set of functions to maintain automatic dumps of various kinds.
21 * remove_auto_dump(orig_file, mark)
22 * Remove the old automatic dump of type "mark".
23 * auto_dump_printf(fmt, ...)
24 * Dump a formatted string using fprintf().
25 * open_auto_dump(buf, mark)
26 * Open a file, remove old dump, and add new header.
27 * close_auto_dump(void)
28 * Add a footer, and close the file.
30 * The dump commands of original Angband simply add new lines to
31 * existing files; these files will become bigger and bigger unless
32 * an user deletes some or all of these files by hand at some
35 * These three functions automatically delete old dumped lines
36 * before adding new ones. Since there are various kinds of automatic
37 * dumps in a single file, we add a header and a footer with a type
38 * name for every automatic dump, and kill old lines only when the
39 * lines have the correct type of header and footer.
41 * We need to be quite paranoid about correctness; the user might
42 * (mistakenly) edit the file by hand, and see all their work come
43 * to nothing on the next auto dump otherwise. The current code only
44 * detects changes by noting inconsistencies between the actual number
45 * of lines and the number written in the footer. Note that this will
46 * not catch single-line edits.
50 * Mark strings for auto dump
52 static char auto_dump_header[] = "# vvvvvvv== %s ==vvvvvvv";
53 static char auto_dump_footer[] = "# ^^^^^^^== %s ==^^^^^^^";
56 * Variables for auto dump
58 static FILE *auto_dump_stream;
59 static cptr auto_dump_mark;
60 static int auto_dump_line_num;
63 * Remove old lines automatically generated before.
65 static void remove_auto_dump(cptr orig_file)
67 FILE *tmp_fff, *orig_fff;
71 bool between_mark = FALSE;
74 long header_location = 0;
75 char header_mark_str[80];
76 char footer_mark_str[80];
79 /* Prepare a header/footer mark string */
80 sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
81 sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
83 mark_len = strlen(footer_mark_str);
85 /* Open an old dump file in read-only mode */
86 orig_fff = my_fopen(orig_file, "r");
88 /* If original file does not exist, nothing to do */
89 if (!orig_fff) return;
91 /* Open a new (temporary) file */
92 tmp_fff = my_fopen_temp(tmp_file, 1024);
97 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", tmp_file);
99 msg_format("Failed to create temporary file %s.", tmp_file);
105 /* Loop for every line */
109 if (my_fgets(orig_fff, buf, sizeof(buf)))
111 /* Read error: Assume End of File */
114 * Was looking for the footer, but not found.
116 * Since automatic dump might be edited by hand,
117 * it's dangerous to kill these lines.
118 * Seek back to the next line of the (pseudo) header,
123 fseek(orig_fff, header_location, SEEK_SET);
124 between_mark = FALSE;
128 /* Success -- End the loop */
135 /* We are looking for the header mark of automatic dump */
138 /* Is this line a header? */
139 if (!strcmp(buf, header_mark_str))
141 /* Memorise seek point of this line */
142 header_location = ftell(orig_fff);
144 /* Initialize counter for number of lines */
147 /* Look for the footer from now */
150 /* There are some changes */
157 /* Copy orginally lines */
158 fprintf(tmp_fff, "%s\n", buf);
162 /* We are looking for the footer mark of automatic dump */
165 /* Is this line a footer? */
166 if (!strncmp(buf, footer_mark_str, mark_len))
171 * Compare the number of lines
173 * If there is an inconsistency between
174 * actual number of lines and the
175 * number here, the automatic dump
176 * might be edited by hand. So it's
177 * dangerous to kill these lines.
178 * Seek back to the next line of the
179 * (pseudo) header, and read again.
181 if (!sscanf(buf + mark_len, " (%d)", &tmp)
184 fseek(orig_fff, header_location, SEEK_SET);
187 /* Look for another header */
188 between_mark = FALSE;
194 /* Ignore old line, and count number of lines */
204 /* If there are some changes, overwrite the original file with new one */
207 /* Copy contents of temporary file */
209 tmp_fff = my_fopen(tmp_file, "r");
210 orig_fff = my_fopen(orig_file, "w");
212 while (!my_fgets(tmp_fff, buf, sizeof(buf)))
213 fprintf(orig_fff, "%s\n", buf);
219 /* Kill the temporary file */
227 * Dump a formatted line, using "vstrnfmt()".
229 static void auto_dump_printf(cptr fmt, ...)
236 /* Begin the Varargs Stuff */
239 /* Format the args, save the length */
240 (void)vstrnfmt(buf, sizeof(buf), fmt, vp);
242 /* End the Varargs Stuff */
245 /* Count number of lines */
246 for (p = buf; *p; p++)
248 if (*p == '\n') auto_dump_line_num++;
252 fprintf(auto_dump_stream, "%s", buf);
257 * Open file to append auto dump.
259 static bool open_auto_dump(cptr buf, cptr mark)
262 char header_mark_str[80];
264 /* Save the mark string */
265 auto_dump_mark = mark;
267 /* Prepare a header mark string */
268 sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
270 /* Remove old macro dumps */
271 remove_auto_dump(buf);
273 /* Append to the file */
274 auto_dump_stream = my_fopen(buf, "a");
277 if (!auto_dump_stream) {
279 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
281 msg_format("Failed to open %s.", buf);
290 fprintf(auto_dump_stream, "%s\n", header_mark_str);
292 /* Initialize counter */
293 auto_dump_line_num = 0;
296 auto_dump_printf("# *·Ù¹ð!!* °Ê¹ß¤Î¹Ô¤Ï¼«Æ°À¸À®¤µ¤ì¤¿¤â¤Î¤Ç¤¹¡£\n");
297 auto_dump_printf("# *·Ù¹ð!!* ¸å¤Ç¼«Æ°Åª¤Ëºï½ü¤µ¤ì¤ë¤Î¤ÇÊÔ½¸¤·¤Ê¤¤¤Ç¤¯¤À¤µ¤¤¡£\n");
299 auto_dump_printf("# *Warning!* The lines below are an automatic dump.\n");
300 auto_dump_printf("# Don't edit them; changes will be deleted and replaced automatically.\n");
308 * Append foot part and close auto dump.
310 static void close_auto_dump(void)
312 char footer_mark_str[80];
314 /* Prepare a footer mark string */
315 sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
318 auto_dump_printf("# *·Ù¹ð!!* °Ê¾å¤Î¹Ô¤Ï¼«Æ°À¸À®¤µ¤ì¤¿¤â¤Î¤Ç¤¹¡£\n");
319 auto_dump_printf("# *·Ù¹ð!!* ¸å¤Ç¼«Æ°Åª¤Ëºï½ü¤µ¤ì¤ë¤Î¤ÇÊÔ½¸¤·¤Ê¤¤¤Ç¤¯¤À¤µ¤¤¡£\n");
321 auto_dump_printf("# *Warning!* The lines above are an automatic dump.\n");
322 auto_dump_printf("# Don't edit them; changes will be deleted and replaced automatically.\n");
326 fprintf(auto_dump_stream, "%s (%d)\n", footer_mark_str, auto_dump_line_num);
329 my_fclose(auto_dump_stream);
337 * Return suffix of ordinal number
339 cptr get_ordinal_number_suffix(int num)
341 num = ABS(num) % 100;
345 return (num == 11) ? "th" : "st";
347 return (num == 12) ? "th" : "nd";
349 return (num == 13) ? "th" : "rd";
358 * Take note to the diary.
360 errr do_cmd_write_nikki(int type, int num, cptr note)
366 cptr note_level = "";
367 bool do_level = TRUE;
368 char note_level_buf[40];
371 static bool disable_nikki = FALSE;
373 extract_day_hour_min(&day, &hour, &min);
375 if (disable_nikki) return(-1);
377 if (type == NIKKI_FIX_QUEST_C ||
378 type == NIKKI_FIX_QUEST_F ||
379 type == NIKKI_RAND_QUEST_C ||
380 type == NIKKI_RAND_QUEST_F ||
381 type == NIKKI_TO_QUEST)
385 old_quest = p_ptr->inside_quest;
386 p_ptr->inside_quest = (quest[num].type == QUEST_TYPE_RANDOM) ? 0 : num;
388 /* Get the quest text */
389 init_flags = INIT_ASSIGN;
391 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
393 /* Reset the old quest number */
394 p_ptr->inside_quest = old_quest;
398 sprintf(file_name,"playrecord-%s.txt",savefile_base);
400 /* different filne name to avoid mixing */
401 sprintf(file_name,"playrec-%s.txt",savefile_base);
404 /* Build the filename */
405 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
407 /* File type is "TEXT" */
408 FILE_TYPE(FILE_TYPE_TEXT);
410 fff = my_fopen(buf, "a");
416 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£¥×¥ì¥¤µÏ¿¤ò°ì»þÄä»ß¤·¤Þ¤¹¡£", buf);
418 msg_format("Failed to open %s. Play-Record is disabled temporally.", buf);
425 q_idx = quest_number(dun_level);
429 if (p_ptr->inside_arena)
431 note_level = "¥¢¥ê¡¼¥Ê:";
433 note_level = "Arane:";
437 note_level = "ÃϾå:";
439 note_level = "Surface:";
441 else if (q_idx && (is_fixed_quest_idx(q_idx)
442 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
444 note_level = "¥¯¥¨¥¹¥È:";
446 note_level = "Quest:";
451 sprintf(note_level_buf, "%d³¬(%s):", dun_level, d_name+d_info[dungeon_type].name);
453 sprintf(note_level_buf, "%s L%d:", d_name+d_info[dungeon_type].name, dun_level);
455 note_level = note_level_buf;
464 if (day < MAX_DAYS) fprintf(fff, "%dÆüÌÜ\n", day);
465 else fputs("*****ÆüÌÜ\n", fff);
467 if (day < MAX_DAYS) fprintf(fff, "Day %d\n", day);
468 else fputs("Day *****\n", fff);
477 fprintf(fff, "%s\n",note);
481 fprintf(fff, " %2d:%02d %20s %s\n",hour, min, note_level, note);
487 fprintf(fff, " %2d:%02d %20s %s¤òȯ¸«¤·¤¿¡£\n", hour, min, note_level, note);
489 fprintf(fff, " %2d:%02d %20s discovered %s.\n", hour, min, note_level, note);
496 fprintf(fff, " %2d:%02d %20s %s¤òÅݤ·¤¿¡£\n", hour, min, note_level, note);
498 fprintf(fff, " %2d:%02d %20s defeated %s.\n", hour, min, note_level, note);
502 case NIKKI_FIX_QUEST_C:
504 if (quest[num].flags & QUEST_FLAG_SILENT) break;
506 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
508 fprintf(fff, " %2d:%02d %20s completed quest '%s'.\n", hour, min, note_level, quest[num].name);
512 case NIKKI_FIX_QUEST_F:
514 if (quest[num].flags & QUEST_FLAG_SILENT) break;
516 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤«¤éÌ¿¤«¤é¤¬¤éƨ¤²µ¢¤Ã¤¿¡£\n", hour, min, note_level, quest[num].name);
518 fprintf(fff, " %2d:%02d %20s run away from quest '%s'.\n", hour, min, note_level, quest[num].name);
522 case NIKKI_RAND_QUEST_C:
525 strcpy(name, r_name+r_info[quest[num].r_idx].name);
527 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, name);
529 fprintf(fff, " %2d:%02d %20s completed random quest '%s'\n", hour, min, note_level, name);
533 case NIKKI_RAND_QUEST_F:
536 strcpy(name, r_name+r_info[quest[num].r_idx].name);
538 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤«¤éƨ¤²½Ð¤·¤¿¡£\n", hour, min, note_level, name);
540 fprintf(fff, " %2d:%02d %20s ran away from quest '%s'.\n", hour, min, note_level, name);
544 case NIKKI_MAXDEAPTH:
547 fprintf(fff, " %2d:%02d %20s %s¤ÎºÇ¿¼³¬%d³¬¤ËÅþ㤷¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, num);
549 fprintf(fff, " %2d:%02d %20s reached level %d of %s for the first time.\n", hour, min, note_level, num, d_name+d_info[dungeon_type].name);
556 fprintf(fff, " %2d:%02d %20s %s%s¤ÎºÇ¿¼³¬¤ò%d³¬¤Ë¥»¥Ã¥È¤·¤¿¡£\n", hour, min, note_level, note, d_name + d_info[num].name, max_dlv[num]);
558 fprintf(fff, " %2d:%02d %20s reset recall level of %s to %d %s.\n", hour, min, note_level, d_name + d_info[num].name, max_dlv[num], note);
565 if (q_idx && (is_fixed_quest_idx(q_idx)
566 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
577 if (!(dun_level+num)) to = "ÃϾå";
578 else to = format("%d³¬", dun_level+num);
580 if (!(dun_level+num)) to = "the surface";
581 else to = format("level %d", dun_level+num);
586 fprintf(fff, " %2d:%02d %20s %s¤Ø%s¡£\n", hour, min, note_level, to, note);
588 fprintf(fff, " %2d:%02d %20s %s %s.\n", hour, min, note_level, note, to);
596 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤Æ%s¤Î%d³¬¤Ø²¼¤ê¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, max_dlv[dungeon_type]);
598 fprintf(fff, " %2d:%02d %20s recalled to dungeon level %d of %s.\n", hour, min, note_level, max_dlv[dungeon_type], d_name+d_info[dungeon_type].name);
602 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤ÆÃϾå¤Ø¤ÈÌá¤Ã¤¿¡£\n", hour, min, note_level);
604 fprintf(fff, " %2d:%02d %20s recalled from dungeon to surface.\n", hour, min, note_level);
610 if (quest[num].flags & QUEST_FLAG_SILENT) break;
612 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤Ø¤ÈÆÍÆþ¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
614 fprintf(fff, " %2d:%02d %20s entered the quest '%s'.\n", hour, min, note_level, quest[num].name);
621 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¡¦¥Æ¥ì¥Ý¡¼¥È¤Çæ½Ð¤·¤¿¡£\n", hour, min, note_level);
623 fprintf(fff, " %2d:%02d %20s Got out using teleport level.\n", hour, min, note_level);
630 fprintf(fff, " %2d:%02d %20s %s¤ò¹ØÆþ¤·¤¿¡£\n", hour, min, note_level, note);
632 fprintf(fff, " %2d:%02d %20s bought %s.\n", hour, min, note_level, note);
639 fprintf(fff, " %2d:%02d %20s %s¤òÇäµÑ¤·¤¿¡£\n", hour, min, note_level, note);
641 fprintf(fff, " %2d:%02d %20s sold %s.\n", hour, min, note_level, note);
650 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï¤Ç¡¢%s¤ÎÁ°¤ËÇÔ¤ìµî¤Ã¤¿¡£\n", hour, min, note_level, -num, note);
653 fprintf(fff, " %2d:%02d %20s beaten by %s in the %d%s fight.\n", hour, min, note_level, note, n, get_ordinal_number_suffix(n));
658 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï(%s)¤Ë¾¡Íø¤·¤¿¡£\n", hour, min, note_level, num, note);
660 fprintf(fff, " %2d:%02d %20s won the %d%s fight (%s).\n", hour, min, note_level, num, get_ordinal_number_suffix(num), note);
662 if (num == MAX_ARENA_MONS)
665 fprintf(fff, " Æ®µ»¾ì¤Î¤¹¤Ù¤Æ¤ÎŨ¤Ë¾¡Íø¤·¡¢¥Á¥ã¥ó¥Ô¥ª¥ó¤È¤Ê¤Ã¤¿¡£\n");
667 fprintf(fff, " won all fight to become a Chanpion.\n");
676 fprintf(fff, " %2d:%02d %20s %s¤ò¼±Ê̤·¤¿¡£\n", hour, min, note_level, note);
678 fprintf(fff, " %2d:%02d %20s identified %s.\n", hour, min, note_level, note);
693 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
695 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
699 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥¦¥£¥¶¡¼¥É¡¦¥Æ¥ì¥Ý¡¼¥È¤Ç°ÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
701 fprintf(fff, " %2d:%02d %20s wizard-teleport to %s.\n", hour, min, note_level, to);
716 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
718 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
722 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥Ñ¥¿¡¼¥ó¤ÎÎϤǰÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
724 fprintf(fff, " %2d:%02d %20s used Pattern to teleport to %s.\n", hour, min, note_level, to);
731 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¤¬%d¤Ë¾å¤¬¤Ã¤¿¡£\n", hour, min, note_level, num);
733 fprintf(fff, " %2d:%02d %20s reached player level %d.\n", hour, min, note_level, num);
737 case NIKKI_GAMESTART:
739 time_t ct = time((time_t*)0);
743 fprintf(fff, "%s %s",note, ctime(&ct));
746 fprintf(fff, " %2d:%02d %20s %s %s",hour, min, note_level, note, ctime(&ct));
749 case NIKKI_NAMED_PET:
751 fprintf(fff, " %2d:%02d %20s ", hour, min, note_level);
754 case RECORD_NAMED_PET_NAME:
756 fprintf(fff, "%s¤òι¤Îͧ¤Ë¤¹¤ë¤³¤È¤Ë·è¤á¤¿¡£\n", note);
758 fprintf(fff, "decided to travel together with %s.\n", note);
761 case RECORD_NAMED_PET_UNNAME:
763 fprintf(fff, "%s¤Î̾Á°¤ò¾Ã¤·¤¿¡£\n", note);
765 fprintf(fff, "unnamed %s.\n", note);
768 case RECORD_NAMED_PET_DISMISS:
770 fprintf(fff, "%s¤ò²òÊü¤·¤¿¡£\n", note);
772 fprintf(fff, "dismissed %s.\n", note);
775 case RECORD_NAMED_PET_DEATH:
777 fprintf(fff, "%s¤¬»à¤ó¤Ç¤·¤Þ¤Ã¤¿¡£\n", note);
779 fprintf(fff, "%s died.\n", note);
782 case RECORD_NAMED_PET_MOVED:
784 fprintf(fff, "%s¤ò¤ª¤¤¤ÆÊ̤ΥޥåפذÜÆ°¤·¤¿¡£\n", note);
786 fprintf(fff, "moved to another map leaving %s behind.\n", note);
789 case RECORD_NAMED_PET_LOST_SIGHT:
791 fprintf(fff, "%s¤È¤Ï¤°¤ì¤Æ¤·¤Þ¤Ã¤¿¡£\n", note);
793 fprintf(fff, "lost sight of %s.\n", note);
796 case RECORD_NAMED_PET_DESTROY:
798 fprintf(fff, "%s¤¬*Ç˲õ*¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
800 fprintf(fff, "%s was made disappeared by *destruction*.\n", note);
803 case RECORD_NAMED_PET_EARTHQUAKE:
805 fprintf(fff, "%s¤¬´äÀФ˲¡¤·ÄÙ¤µ¤ì¤¿¡£\n", note);
807 fprintf(fff, "%s was crushed by falling rocks.\n", note);
810 case RECORD_NAMED_PET_GENOCIDE:
812 fprintf(fff, "%s¤¬Ëõ»¦¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
814 fprintf(fff, "%s was made disappeared by genocide.\n", note);
817 case RECORD_NAMED_PET_WIZ_ZAP:
819 fprintf(fff, "%s¤¬¥Ç¥Ð¥Ã¥°¥³¥Þ¥ó¥É¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
821 fprintf(fff, "%s was removed by debug command.\n", note);
824 case RECORD_NAMED_PET_TELE_LEVEL:
826 fprintf(fff, "%s¤¬¥Æ¥ì¥Ý¡¼¥È¡¦¥ì¥Ù¥ë¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
828 fprintf(fff, "%s was made disappeared by teleport level.\n", note);
831 case RECORD_NAMED_PET_BLAST:
833 fprintf(fff, "%s¤òÇúÇˤ·¤¿¡£\n", note);
835 fprintf(fff, "blasted %s.\n", note);
838 case RECORD_NAMED_PET_HEAL_LEPER:
840 fprintf(fff, "%s¤Îɵ¤¤¬¼£¤ê餫¤é³°¤ì¤¿¡£\n", note);
842 fprintf(fff, "%s was healed and left.\n", note);
845 case RECORD_NAMED_PET_COMPACT:
847 fprintf(fff, "%s¤¬¥â¥ó¥¹¥¿¡¼¾ðÊ󰵽̤ˤè¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
849 fprintf(fff, "%s was made disappeared by compacting monsters.\n", note);
852 case RECORD_NAMED_PET_LOSE_PARENT:
854 fprintf(fff, "%s¤Î¾¤´¼Ô¤¬´û¤Ë¤¤¤Ê¤¤¤¿¤á¾Ã¤¨µî¤Ã¤¿¡£\n", note);
856 fprintf(fff, "%s disappeared because there does not exist summoner.\n", note);
871 if (do_level) write_level = FALSE;
877 #define MAX_SUBTITLE (sizeof(subtitle)/sizeof(subtitle[0]))
879 static void do_cmd_disp_nikki(void)
881 char nikki_title[256];
886 static const char subtitle[][30] = {"ºÇ¶¯¤ÎÆùÂΤòµá¤á¤Æ",
887 "¿ÍÀ¸¤½¤ì¤Ï¤Ï¤«¤Ê¤¤",
898 "Åݤ¹¤Ù¤Å¨¤Ï¥²¡û¥Ä",
899 "¤ó¡Á¡©Ê¹¤³¤¨¤ó¤Ê¤¡",
900 "¥ª¥ì¤Î̾¤ò¸À¤Ã¤Æ¤ß¤í",
901 "Ƭ¤¬ÊѤˤʤäÁ¤ã¤Ã¤¿",
906 "¤³¤ó¤Ê¤â¤ó¤¸¤ã¤Ê¤¤",
915 "ºÇ¹â¤ÎƬǾ¤òµá¤á¤Æ"};
917 static const char subtitle[][51] ={"Quest of The World's Toughest Body",
918 "Attack is the best form of defence.",
920 "An unexpected windfall",
921 "A drowning man will catch at a straw",
922 "Don't count your chickens before they are hatched.",
923 "It is no use crying over spilt milk.",
924 "Seeing is believing.",
925 "Strike the iron while it is hot.",
926 "I don't care what follows.",
927 "To dig a well to put out a house on fire.",
928 "Tomorrow is another day.",
929 "Easy come, easy go.",
930 "The more haste, the less speed.",
931 "Where there is life, there is hope.",
932 "There is no royal road to *WINNER*.",
933 "Danger past, God forgotten.",
934 "The best thing to do now is to run away.",
935 "Life is but an empty dream.",
936 "Dead men tell no tales.",
937 "A book that remains shut is but a block.",
938 "Misfortunes never come singly.",
939 "A little knowledge is a dangerous thing.",
940 "History repeats itself.",
941 "*WINNER* was not built in a day.",
942 "Ignorance is bliss.",
943 "To lose is to win?",
944 "No medicine can cure folly.",
945 "All good things come to an end.",
946 "M$ Empire strikes back.",
947 "To see is to believe",
949 "Quest of The World's Greatest Brain"};
952 sprintf(file_name,"playrecord-%s.txt",savefile_base);
954 sprintf(file_name,"playrec-%s.txt",savefile_base);
957 /* Build the filename */
958 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
960 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_MONK || p_ptr->pclass == CLASS_SAMURAI || p_ptr->pclass == CLASS_BERSERKER)
961 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)]);
962 else if (p_ptr->pclass == CLASS_MAGE || p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
963 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)+1]);
964 else strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-2)+1]);
967 sprintf(nikki_title, "¡Ö%s%s%s¤ÎÅÁÀâ -%s-¡×",
968 ap_ptr->title, ap_ptr->no ? "¤Î" : "", player_name, tmp);
970 sprintf(nikki_title, "Legend of %s %s '%s'",
971 ap_ptr->title, player_name, tmp);
974 /* Display the file contents */
975 show_file(FALSE, buf, nikki_title, -1, 0);
978 static void do_cmd_bunshou(void)
981 char bunshou[80] = "\0";
984 if (get_string("ÆâÍÆ: ", tmp, 79))
986 if (get_string("diary note: ", tmp, 79))
989 strcpy(bunshou, tmp);
991 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, bunshou);
995 static void do_cmd_last_get(void)
1000 if (record_o_name[0] == '\0') return;
1003 sprintf(buf,"%s¤ÎÆþ¼ê¤òµÏ¿¤·¤Þ¤¹¡£",record_o_name);
1005 sprintf(buf,"Do you really want to record getting %s? ",record_o_name);
1007 if (!get_check(buf)) return;
1012 sprintf(buf,"%s¤ò¼ê¤ËÆþ¤ì¤¿¡£", record_o_name);
1014 sprintf(buf,"descover %s.", record_o_name);
1016 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
1020 static void do_cmd_erase_nikki(void)
1027 if (!get_check("ËÜÅö¤ËµÏ¿¤ò¾Ãµî¤·¤Þ¤¹¤«¡©")) return;
1029 if (!get_check("Do you really want to delete all your record? ")) return;
1033 sprintf(file_name,"playrecord-%s.txt",savefile_base);
1035 sprintf(file_name,"playrec-%s.txt",savefile_base);
1038 /* Build the filename */
1039 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
1041 /* Remove the file */
1044 fff = my_fopen(buf, "w");
1048 msg_format("µÏ¿¤ò¾Ãµî¤·¤Þ¤·¤¿¡£");
1050 msg_format("deleted record.");
1054 msg_format("%s ¤Î¾Ãµî¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£", buf);
1056 msg_format("failed to delete %s.", buf);
1063 void do_cmd_nikki(void)
1067 /* File type is "TEXT" */
1068 FILE_TYPE(FILE_TYPE_TEXT);
1070 /* Save the screen */
1073 /* Interact until done */
1079 /* Ask for a choice */
1081 prt("[ µÏ¿¤ÎÀßÄê ]", 2, 0);
1083 prt("[ Play Record ]", 2, 0);
1087 /* Give some choices */
1089 prt("(1) µÏ¿¤ò¸«¤ë", 4, 5);
1090 prt("(2) ʸ¾Ï¤òµÏ¿¤¹¤ë", 5, 5);
1091 prt("(3) ľÁ°¤ËÆþ¼êËô¤Ï´ÕÄꤷ¤¿¤â¤Î¤òµÏ¿¤¹¤ë", 6, 5);
1092 prt("(4) µÏ¿¤ò¾Ãµî¤¹¤ë", 7, 5);
1094 prt("(1) Display your record", 4, 5);
1095 prt("(2) Add record", 5, 5);
1096 prt("(3) Record item you last get/identify", 6, 5);
1097 prt("(4) Delete your record", 7, 5);
1103 prt("¥³¥Þ¥ó¥É:", 18, 0);
1105 prt("Command: ", 18, 0);
1113 if (i == ESCAPE) break;
1118 do_cmd_disp_nikki();
1127 do_cmd_erase_nikki();
1129 default: /* Unknown option */
1133 /* Flush messages */
1137 /* Restore the screen */
1142 * Hack -- redraw the screen
1144 * This command performs various low level updates, clears all the "extra"
1145 * windows, does a total redraw of the main window, and requests all of the
1146 * interesting updates and redraws that I can think of.
1148 * This command is also used to "instantiate" the results of the user
1149 * selecting various things, such as graphics mode, so it must call
1150 * the "TERM_XTRA_REACT" hook before redrawing the windows.
1152 void do_cmd_redraw(void)
1159 /* Hack -- react to changes */
1160 Term_xtra(TERM_XTRA_REACT, 0);
1163 /* Combine and Reorder the pack (later) */
1164 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1168 p_ptr->update |= (PU_TORCH);
1171 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
1173 /* Forget lite/view */
1174 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1176 /* Update lite/view */
1177 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
1179 /* Update monsters */
1180 p_ptr->update |= (PU_MONSTERS);
1182 /* Redraw everything */
1183 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1186 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
1189 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
1193 /* Hack -- update */
1196 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
1199 /* Redraw every window */
1200 for (j = 0; j < 8; j++)
1203 if (!angband_term[j]) continue;
1206 Term_activate(angband_term[j]);
1221 * Hack -- change name
1223 void do_cmd_change_name(void)
1232 /* Save the screen */
1240 /* Display the player */
1241 display_player(mode);
1246 display_player(mode);
1251 Term_putstr(2, 23, -1, TERM_WHITE,
1252 "['c'¤Ç̾Á°Êѹ¹, 'f'¤Ç¥Õ¥¡¥¤¥ë¤Ø½ñ½Ð, 'h'¤Ç¥â¡¼¥ÉÊѹ¹, ESC¤Ç½ªÎ»]");
1254 Term_putstr(2, 23, -1, TERM_WHITE,
1255 "['c' to change name, 'f' to file, 'h' to change mode, or ESC]");
1263 if (c == ESCAPE) break;
1270 /* Process the player name */
1271 process_player_name(FALSE);
1277 sprintf(tmp, "%s.txt", player_base);
1279 if (get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
1281 if (get_string("File name: ", tmp, 80))
1285 if (tmp[0] && (tmp[0] != ' '))
1287 file_character(tmp);
1304 /* Flush messages */
1308 /* Restore the screen */
1311 /* Redraw everything */
1312 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1319 * Recall the most recent message
1321 void do_cmd_message_one(void)
1323 /* Recall one message XXX XXX XXX */
1324 prt(format("> %s", message_str(0)), 0, 0);
1329 * Show previous messages to the user -BEN-
1331 * The screen format uses line 0 and 23 for headers and prompts,
1332 * skips line 1 and 22, and uses line 2 thru 21 for old messages.
1334 * This command shows you which commands you are viewing, and allows
1335 * you to "search" for strings in the recall.
1337 * Note that messages may be longer than 80 characters, but they are
1338 * displayed using "infinite" length, with a special sub-command to
1339 * "slide" the virtual display to the left or right.
1341 * Attempt to only hilite the matching portions of the string.
1343 void do_cmd_messages(int num_now)
1347 char shower_str[81];
1348 char finder_str[81];
1355 Term_get_size(&wid, &hgt);
1357 /* Number of message lines in a screen */
1358 num_lines = hgt - 4;
1361 strcpy(finder_str, "");
1364 strcpy(shower_str, "");
1366 /* Total messages */
1369 /* Start on first message */
1372 /* Save the screen */
1378 /* Process requests until done */
1384 /* Dump up to 20 lines of messages */
1385 for (j = 0; (j < num_lines) && (i + j < n); j++)
1387 cptr msg = message_str(i+j);
1389 /* Dump the messages, bottom to top */
1390 c_prt((i + j < num_now ? TERM_WHITE : TERM_SLATE), msg, num_lines + 1 - j, 0);
1392 /* Hilite "shower" */
1393 if (shower && shower[0])
1397 /* Display matches */
1398 while ((str = my_strstr(str, shower)) != NULL)
1400 int len = strlen(shower);
1402 /* Display the match */
1403 Term_putstr(str-msg, num_lines + 1 - j, len, TERM_YELLOW, shower);
1411 /* Erase remaining lines */
1412 for (; j < num_lines; j++)
1414 Term_erase(0, num_lines + 1 - j, 255);
1417 /* Display header XXX XXX XXX */
1420 prt(format("°ÊÁ°¤Î¥á¥Ã¥»¡¼¥¸ %d-%d Á´Éô¤Ç(%d)",
1421 i, i + j - 1, n), 0, 0);
1423 prt(format("Message Recall (%d-%d of %d)",
1424 i, i + j - 1, n), 0, 0);
1427 /* Display prompt (not very informative) */
1429 prt("[ 'p' ¤Ç¹¹¤Ë¸Å¤¤¤â¤Î, 'n' ¤Ç¹¹¤Ë¿·¤·¤¤¤â¤Î, '/' ¤Ç¸¡º÷, ESC ¤ÇÃæÃÇ ]", hgt - 1, 0);
1431 prt("[Press 'p' for older, 'n' for newer, ..., or ESCAPE]", hgt - 1, 0);
1435 skey = inkey_special(TRUE);
1437 /* Exit on Escape */
1438 if (skey == ESCAPE) break;
1440 /* Hack -- Save the old index */
1445 /* Hack -- handle show */
1449 prt("¶¯Ä´: ", hgt - 1, 0);
1451 prt("Show: ", hgt - 1, 0);
1454 /* Get a "shower" string, or continue */
1455 strcpy(back_str, shower_str);
1456 if (askfor(shower_str, 80))
1459 shower = shower_str[0] ? shower_str : NULL;
1461 else strcpy(shower_str, back_str);
1466 /* Hack -- handle find */
1474 prt("¸¡º÷: ", hgt - 1, 0);
1476 prt("Find: ", hgt - 1, 0);
1479 /* Get a "finder" string, or continue */
1480 strcpy(back_str, finder_str);
1481 if (!askfor(finder_str, 80))
1483 strcpy(finder_str, back_str);
1486 else if (!finder_str[0])
1488 shower = NULL; /* Stop showing */
1493 shower = finder_str;
1496 for (z = i + 1; z < n; z++)
1498 cptr msg = message_str(z);
1501 if (my_strstr(msg, finder_str))
1513 /* Recall 1 older message */
1515 /* Go to the oldest line */
1519 /* Recall 1 newer message */
1521 /* Go to the newest line */
1525 /* Recall 1 older message */
1530 /* Go older if legal */
1531 i = MIN(i + 1, n - num_lines);
1534 /* Recall 10 older messages */
1536 /* Go older if legal */
1537 i = MIN(i + 10, n - num_lines);
1540 /* Recall 20 older messages */
1545 /* Go older if legal */
1546 i = MIN(i + num_lines, n - num_lines);
1549 /* Recall 20 newer messages */
1553 /* Go newer (if able) */
1554 i = MAX(0, i - num_lines);
1557 /* Recall 10 newer messages */
1559 /* Go newer (if able) */
1563 /* Recall 1 newer messages */
1566 /* Go newer (if able) */
1571 /* Hack -- Error of some kind */
1575 /* Restore the screen */
1582 * Number of cheating options
1589 static option_type cheat_info[CHEAT_MAX] =
1591 { &cheat_peek, FALSE, 255, 0x01, 0x00,
1593 "cheat_peek", "¥¢¥¤¥Æ¥à¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1595 "cheat_peek", "Peek into object creation"
1599 { &cheat_hear, FALSE, 255, 0x02, 0x00,
1601 "cheat_hear", "¥â¥ó¥¹¥¿¡¼¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1603 "cheat_hear", "Peek into monster creation"
1607 { &cheat_room, FALSE, 255, 0x04, 0x00,
1609 "cheat_room", "¥À¥ó¥¸¥ç¥ó¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1611 "cheat_room", "Peek into dungeon creation"
1615 { &cheat_xtra, FALSE, 255, 0x08, 0x00,
1617 "cheat_xtra", "¤½¤Î¾¤Î»ö¤ò¤Î¤¾¤¸«¤ë"
1619 "cheat_xtra", "Peek into something else"
1623 { &cheat_know, FALSE, 255, 0x10, 0x00,
1625 "cheat_know", "´°Á´¤Ê¥â¥ó¥¹¥¿¡¼¤Î»×¤¤½Ð¤òÃΤë"
1627 "cheat_know", "Know complete monster info"
1631 { &cheat_live, FALSE, 255, 0x20, 0x00,
1633 "cheat_live", "»à¤ò²óÈò¤¹¤ë¤³¤È¤ò²Äǽ¤Ë¤¹¤ë"
1635 "cheat_live", "Allow player to avoid death"
1639 { &cheat_save, FALSE, 255, 0x40, 0x00,
1641 "cheat_save", "»à¤ó¤À»þ¥»¡¼¥Ö¤¹¤ë¤«³Îǧ¤¹¤ë"
1643 "cheat_save", "Ask for saving death"
1649 * Interact with some options for cheating
1651 static void do_cmd_options_cheat(cptr info)
1655 int i, k = 0, n = CHEAT_MAX;
1663 /* Interact with the player */
1668 /* Prompt XXX XXX XXX */
1670 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, ESC ¤Ç·èÄê )", info);
1672 sprintf(buf, "%s (RET to advance, y/n to set, ESC to accept) ", info);
1678 /* º¾µ½¥ª¥×¥·¥ç¥ó¤ò¤¦¤Ã¤«¤ê¤¤¤¸¤Ã¤Æ¤·¤Þ¤¦¿Í¤¬¤¤¤ë¤è¤¦¤Ê¤Î¤ÇÃí°Õ */
1679 prt(" << Ãí°Õ >>", 11, 0);
1680 prt(" º¾µ½¥ª¥×¥·¥ç¥ó¤ò°ìÅ٤ǤâÀßÄꤹ¤ë¤È¡¢¥¹¥³¥¢µÏ¿¤¬»Ä¤é¤Ê¤¯¤Ê¤ê¤Þ¤¹¡ª", 12, 0);
1681 prt(" ¸å¤Ë²ò½ü¤·¤Æ¤â¥À¥á¤Ç¤¹¤Î¤Ç¡¢¾¡Íø¼Ô¤òÌܻؤ¹Êý¤Ï¤³¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¤¤", 13, 0);
1682 prt(" ¤¸¤é¤Ê¤¤¤è¤¦¤Ë¤·¤Æ²¼¤µ¤¤¡£", 14, 0);
1684 /* Display the options */
1685 for (i = 0; i < n; i++)
1687 byte a = TERM_WHITE;
1689 /* Color current option */
1690 if (i == k) a = TERM_L_BLUE;
1692 /* Display the option text */
1693 sprintf(buf, "%-48s: %s (%s)",
1694 cheat_info[i].o_desc,
1696 (*cheat_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1698 (*cheat_info[i].o_var ? "yes" : "no "),
1701 cheat_info[i].o_text);
1702 c_prt(a, buf, i + 2, 0);
1705 /* Hilite current option */
1706 move_cursor(k + 2, 50);
1712 * HACK - Try to translate the key into a direction
1713 * to allow using the roguelike keys for navigation.
1715 dir = get_keymap_dir(ch);
1716 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1730 k = (n + k - 1) % n;
1749 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "º¾µ½¥ª¥×¥·¥ç¥ó¤òON¤Ë¤·¤Æ¡¢¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
1751 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use cheating options.");
1753 p_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit);
1754 (*cheat_info[k].o_var) = TRUE;
1763 (*cheat_info[k].o_var) = FALSE;
1771 strnfmt(buf, sizeof(buf), "joption.txt#%s", cheat_info[k].o_text);
1773 strnfmt(buf, sizeof(buf), "option.txt#%s", cheat_info[k].o_text);
1775 /* Peruse the help file */
1776 (void)show_file(TRUE, buf, NULL, 0, 0);
1792 static option_type autosave_info[2] =
1794 { &autosave_l, FALSE, 255, 0x01, 0x00,
1796 "autosave_l", "¿·¤·¤¤³¬¤ËÆþ¤ëÅ٤˼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1798 "autosave_l", "Autosave when entering new levels" },
1802 { &autosave_t, FALSE, 255, 0x02, 0x00,
1804 "autosave_t", "°ìÄ꥿¡¼¥óËè¤Ë¼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1806 "autosave_t", "Timed autosave" },
1812 static s16b toggle_frequency(s16b current)
1817 case 50: return 100;
1818 case 100: return 250;
1819 case 250: return 500;
1820 case 500: return 1000;
1821 case 1000: return 2500;
1822 case 2500: return 5000;
1823 case 5000: return 10000;
1824 case 10000: return 25000;
1831 * Interact with some options for cheating
1833 static void do_cmd_options_autosave(cptr info)
1837 int i, k = 0, n = 2;
1845 /* Interact with the player */
1848 /* Prompt XXX XXX XXX */
1850 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, F ¤ÇÉÑÅÙ¤òÆþÎÏ, ESC ¤Ç·èÄê ) ", info);
1852 sprintf(buf, "%s (RET to advance, y/n to set, 'F' for frequency, ESC to accept) ", info);
1857 /* Display the options */
1858 for (i = 0; i < n; i++)
1860 byte a = TERM_WHITE;
1862 /* Color current option */
1863 if (i == k) a = TERM_L_BLUE;
1865 /* Display the option text */
1866 sprintf(buf, "%-48s: %s (%s)",
1867 autosave_info[i].o_desc,
1869 (*autosave_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1871 (*autosave_info[i].o_var ? "yes" : "no "),
1874 autosave_info[i].o_text);
1875 c_prt(a, buf, i + 2, 0);
1879 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè", autosave_freq), 5, 0);
1881 prt(format("Timed autosave frequency: every %d turns", autosave_freq), 5, 0);
1886 /* Hilite current option */
1887 move_cursor(k + 2, 50);
1903 k = (n + k - 1) % n;
1921 (*autosave_info[k].o_var) = TRUE;
1930 (*autosave_info[k].o_var) = FALSE;
1938 autosave_freq = toggle_frequency(autosave_freq);
1940 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè",
1941 autosave_freq), 5, 0);
1943 prt(format("Timed autosave frequency: every %d turns",
1944 autosave_freq), 5, 0);
1952 (void)show_file(TRUE, "joption.txt#Autosave", NULL, 0, 0);
1954 (void)show_file(TRUE, "option.txt#Autosave", NULL, 0, 0);
1973 * Interact with some options
1975 void do_cmd_options_aux(int page, cptr info)
1978 int i, k = 0, n = 0, l;
1981 bool browse_only = (page == OPT_PAGE_BIRTH) && character_generated &&
1982 (!p_ptr->wizard || !allow_debug_opts);
1985 /* Lookup the options */
1986 for (i = 0; i < 24; i++) opt[i] = 0;
1988 /* Scan the options */
1989 for (i = 0; option_info[i].o_desc; i++)
1991 /* Notice options on this "page" */
1992 if (option_info[i].o_page == page) opt[n++] = i;
1999 /* Interact with the player */
2004 /* Prompt XXX XXX XXX */
2006 sprintf(buf, "%s (¥ê¥¿¡¼¥ó:¼¡, %sESC:½ªÎ», ?:¥Ø¥ë¥×) ", info, browse_only ? "" : "y/n:Êѹ¹, ");
2008 sprintf(buf, "%s (RET:next, %s, ?:help) ", info, browse_only ? "ESC:exit" : "y/n:change, ESC:accept");
2014 /* HACK -- description for easy-auto-destroy options */
2016 if (page == OPT_PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "°Ê²¼¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢´Ê°×¼«Æ°Ç˲õ¤ò»ÈÍѤ¹¤ë¤È¤¤Î¤ß͸ú", 6, 6);
2018 if (page == OPT_PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "Following options will protect items from easy auto-destroyer.", 6, 3);
2021 /* Display the options */
2022 for (i = 0; i < n; i++)
2024 byte a = TERM_WHITE;
2026 /* Color current option */
2027 if (i == k) a = TERM_L_BLUE;
2029 /* Display the option text */
2030 sprintf(buf, "%-48s: %s (%.19s)",
2031 option_info[opt[i]].o_desc,
2033 (*option_info[opt[i]].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
2035 (*option_info[opt[i]].o_var ? "yes" : "no "),
2038 option_info[opt[i]].o_text);
2039 if ((page == OPT_PAGE_AUTODESTROY) && i > 2) c_prt(a, buf, i + 5, 0);
2040 else c_prt(a, buf, i + 2, 0);
2043 if ((page == OPT_PAGE_AUTODESTROY) && (k > 2)) l = 3;
2046 /* Hilite current option */
2047 move_cursor(k + 2 + l, 50);
2053 * HACK - Try to translate the key into a direction
2054 * to allow using the roguelike keys for navigation.
2056 dir = get_keymap_dir(ch);
2057 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
2071 k = (n + k - 1) % n;
2088 if (browse_only) break;
2089 (*option_info[opt[k]].o_var) = TRUE;
2098 if (browse_only) break;
2099 (*option_info[opt[k]].o_var) = FALSE;
2107 if (!browse_only) (*option_info[opt[k]].o_var) = !(*option_info[opt[k]].o_var);
2114 strnfmt(buf, sizeof(buf), "joption.txt#%s", option_info[opt[k]].o_text);
2116 strnfmt(buf, sizeof(buf), "option.txt#%s", option_info[opt[k]].o_text);
2118 /* Peruse the help file */
2119 (void)show_file(TRUE, buf, NULL, 0, 0);
2136 * Modify the "window" options
2138 static void do_cmd_options_win(void)
2152 /* Memorize old flags */
2153 for (j = 0; j < 8; j++)
2155 /* Acquire current flags */
2156 old_flag[j] = window_flag[j];
2166 /* Prompt XXX XXX XXX */
2168 prt("¥¦¥£¥ó¥É¥¦¡¦¥Õ¥é¥° (<Êý¸þ>¤Ç°ÜÆ°, t¤Ç¥Á¥§¥ó¥¸, y/n ¤Ç¥»¥Ã¥È, ESC)", 0, 0);
2170 prt("Window Flags (<dir>, t, y, n, ESC) ", 0, 0);
2174 /* Display the windows */
2175 for (j = 0; j < 8; j++)
2177 byte a = TERM_WHITE;
2179 cptr s = angband_term_name[j];
2182 if (j == x) a = TERM_L_BLUE;
2184 /* Window name, staggered, centered */
2185 Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s);
2188 /* Display the options */
2189 for (i = 0; i < 16; i++)
2191 byte a = TERM_WHITE;
2193 cptr str = window_flag_desc[i];
2196 if (i == y) a = TERM_L_BLUE;
2200 if (!str) str = "(̤»ÈÍÑ)";
2202 if (!str) str = "(Unused option)";
2207 Term_putstr(0, i + 5, -1, a, str);
2209 /* Display the windows */
2210 for (j = 0; j < 8; j++)
2212 byte a = TERM_WHITE;
2217 if ((i == y) && (j == x)) a = TERM_L_BLUE;
2220 if (window_flag[j] & (1L << i)) c = 'X';
2223 Term_putch(35 + j * 5, i + 5, a, c);
2228 Term_gotoxy(35 + x * 5, y + 5);
2246 for (j = 0; j < 8; j++)
2248 window_flag[j] &= ~(1L << y);
2252 for (i = 0; i < 16; i++)
2254 window_flag[x] &= ~(1L << i);
2267 window_flag[x] |= (1L << y);
2275 window_flag[x] &= ~(1L << y);
2282 (void)show_file(TRUE, "joption.txt#Window", NULL, 0, 0);
2284 (void)show_file(TRUE, "option.txt#Window", NULL, 0, 0);
2294 d = get_keymap_dir(ch);
2296 x = (x + ddx[d] + 8) % 8;
2297 y = (y + ddy[d] + 16) % 16;
2304 /* Notice changes */
2305 for (j = 0; j < 8; j++)
2310 if (!angband_term[j]) continue;
2312 /* Ignore non-changes */
2313 if (window_flag[j] == old_flag[j]) continue;
2316 Term_activate(angband_term[j]);
2339 option_fields[OPT_NUM] =
2342 { '1', " ¥¡¼ÆþÎÏ ¥ª¥×¥·¥ç¥ó", 3 },
2343 { '2', " ¥Þ¥Ã¥×²èÌÌ ¥ª¥×¥·¥ç¥ó", 4 },
2344 { '3', " ¥Æ¥¥¹¥Èɽ¼¨ ¥ª¥×¥·¥ç¥ó", 5 },
2345 { '4', " ¥²¡¼¥à¥×¥ì¥¤ ¥ª¥×¥·¥ç¥ó", 6 },
2346 { '5', " ¹ÔÆ°Ãæ»ß´Ø·¸ ¥ª¥×¥·¥ç¥ó", 7 },
2347 { '6', " ´Ê°×¼«Æ°Ç˲õ ¥ª¥×¥·¥ç¥ó", 8 },
2348 { 'r', " ¥×¥ì¥¤µÏ¿ ¥ª¥×¥·¥ç¥ó", 9 },
2350 { 'p', "¼«Æ°½¦¤¤¥¨¥Ç¥£¥¿", 11 },
2351 { 'd', " ´ðËÜ¥¦¥§¥¤¥ÈÎÌ ", 12 },
2352 { 'h', "Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È", 13 },
2353 { 'm', " ÄãËâÎÏ¿§ïçÃÍ ", 14 },
2354 { 'a', " ¼«Æ°¥»¡¼¥Ö ¥ª¥×¥·¥ç¥ó", 15 },
2355 { 'w', "¥¦¥¤¥ó¥É¥¦¥Õ¥é¥°", 16 },
2357 { 'b', " ½é´ü ¥ª¥×¥·¥ç¥ó (»²¾È¤Î¤ß)", 18 },
2358 { 'c', " º¾µ½ ¥ª¥×¥·¥ç¥ó", 19 },
2360 { '1', "Input Options", 3 },
2361 { '2', "Map Screen Options", 4 },
2362 { '3', "Text Display Options", 5 },
2363 { '4', "Game-Play Options", 6 },
2364 { '5', "Disturbance Options", 7 },
2365 { '6', "Easy Auto-Destroyer Options", 8 },
2366 { 'r', "Play record Options", 9 },
2368 { 'p', "Auto-picker/destroyer editor", 11 },
2369 { 'd', "Base Delay Factor", 12 },
2370 { 'h', "Hitpoint Warning", 13 },
2371 { 'm', "Mana Color Threshold", 14 },
2372 { 'a', "Autosave Options", 15 },
2373 { 'w', "Window Flags", 16 },
2375 { 'b', "Birth Options (Browse Only)", 18 },
2376 { 'c', "Cheat Options", 19 },
2382 * Set or unset various options.
2384 * The user must use the "Ctrl-R" command to "adapt" to changes
2385 * in any options which control "visual" aspects of the game.
2387 void do_cmd_options(void)
2393 /* Save the screen */
2401 /* Does not list cheat option when cheat option is off */
2402 if (!p_ptr->noscore && !allow_debug_opts) n--;
2407 /* Why are we here */
2409 prt("[ ¥ª¥×¥·¥ç¥ó¤ÎÀßÄê ]", 1, 0);
2411 prt("TinyAngband options", 1, 0);
2416 /* Give some choices */
2417 for (i = 0; i < n; i++)
2419 byte a = TERM_WHITE;
2420 if (i == y) a = TERM_L_BLUE;
2421 Term_putstr(5, option_fields[i].row, -1, a,
2422 format("(%c) %s", toupper(option_fields[i].key), option_fields[i].name));
2426 prt("<Êý¸þ>¤Ç°ÜÆ°, Enter¤Ç·èÄê, ESC¤Ç¥¥ã¥ó¥»¥ë, ?¤Ç¥Ø¥ë¥×: ", 21, 0);
2428 prt("Move to <dir>, Select to Enter, Cancel to ESC, ? to help: ", 21, 0);
2432 skey = inkey_special(TRUE);
2433 if (!(skey & SKEY_MASK)) k = (char)skey;
2437 if (k == ESCAPE) break;
2439 if (my_strchr("\n\r ", k))
2441 k = option_fields[y].key;
2445 for (i = 0; i < n; i++)
2447 if (tolower(k) == option_fields[i].key) break;
2450 /* Command is found */
2453 /* Hack -- browse help */
2454 if (k == '?') break;
2458 if (skey == SKEY_UP) d = 8;
2459 if (skey == SKEY_DOWN) d = 2;
2460 y = (y + ddy[d] + n) % n;
2465 if (k == ESCAPE) break;
2472 /* Process the general options */
2474 do_cmd_options_aux(OPT_PAGE_INPUT, "¥¡¼ÆþÎÏ¥ª¥×¥·¥ç¥ó");
2476 do_cmd_options_aux(OPT_PAGE_INPUT, "Input Options");
2483 /* Process the general options */
2485 do_cmd_options_aux(OPT_PAGE_MAPSCREEN, "¥Þ¥Ã¥×²èÌÌ¥ª¥×¥·¥ç¥ó");
2487 do_cmd_options_aux(OPT_PAGE_MAPSCREEN, "Map Screen Options");
2496 do_cmd_options_aux(OPT_PAGE_TEXT, "¥Æ¥¥¹¥Èɽ¼¨¥ª¥×¥·¥ç¥ó");
2498 do_cmd_options_aux(OPT_PAGE_TEXT, "Text Display Options");
2507 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, "¥²¡¼¥à¥×¥ì¥¤¡¦¥ª¥×¥·¥ç¥ó");
2509 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, "Game-Play Options");
2518 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, "¹ÔÆ°Ãæ»ß´Ø·¸¤Î¥ª¥×¥·¥ç¥ó");
2520 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, "Disturbance Options");
2529 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, "´Ê°×¼«Æ°Ç˲õ¥ª¥×¥·¥ç¥ó");
2531 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, "Easy Auto-Destroyer Options");
2536 /* Play-record Options */
2542 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, "¥×¥ì¥¤µÏ¿¥ª¥×¥·¥ç¥ó");
2544 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, "Play-record Options");
2555 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ? "½é´ü¥ª¥×¥·¥ç¥ó(»²¾È¤Î¤ß)" : "½é´ü¥ª¥×¥·¥ç¥ó((*)¤Ï¥¹¥³¥¢¤Ë±Æ¶Á)");
2557 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ? "Birth Options(browse only)" : "Birth Options((*)s effect score)");
2562 /* Cheating Options */
2565 if (!p_ptr->noscore && !allow_debug_opts)
2567 /* Cheat options are not permitted */
2574 do_cmd_options_cheat("º¾µ½»Õ¤Ï·è¤·¤Æ¾¡Íø¤Ç¤¤Ê¤¤¡ª");
2576 do_cmd_options_cheat("Cheaters never win");
2585 do_cmd_options_autosave("¼«Æ°¥»¡¼¥Ö");
2587 do_cmd_options_autosave("Autosave");
2597 do_cmd_options_win();
2598 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL |
2599 PW_PLAYER | PW_MESSAGE | PW_OVERHEAD |
2600 PW_MONSTER | PW_OBJECT | PW_SNAPSHOT |
2601 PW_BORG_1 | PW_BORG_2 | PW_DUNGEON);
2605 /* Auto-picker/destroyer editor */
2609 do_cmd_edit_autopick();
2613 /* Hack -- Delay Speed */
2620 prt("¥³¥Þ¥ó¥É: ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 19, 0);
2622 prt("Command: Base Delay Factor", 19, 0);
2625 /* Get a new value */
2628 int msec = delay_factor * delay_factor * delay_factor;
2630 prt(format("¸½ºß¤Î¥¦¥§¥¤¥È: %d (%d¥ß¥êÉÃ)",
2631 delay_factor, msec), 22, 0);
2633 prt(format("Current base delay factor: %d (%d msec)",
2634 delay_factor, msec), 22, 0);
2638 prt("¥¦¥§¥¤¥È (0-9) ESC¤Ç·èÄê: ", 20, 0);
2640 prt("Delay Factor (0-9 or ESC to accept): ", 20, 0);
2644 if (k == ESCAPE) break;
2648 (void)show_file(TRUE, "joption.txt#BaseDelay", NULL, 0, 0);
2650 (void)show_file(TRUE, "option.txt#BaseDelay", NULL, 0, 0);
2654 else if (isdigit(k)) delay_factor = D2I(k);
2661 /* Hack -- hitpoint warning factor */
2668 prt("¥³¥Þ¥ó¥É: Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 19, 0);
2670 prt("Command: Hitpoint Warning", 19, 0);
2673 /* Get a new value */
2677 prt(format("¸½ºß¤ÎÄã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð: %d0%%",
2678 hitpoint_warn), 22, 0);
2680 prt(format("Current hitpoint warning: %d0%%",
2681 hitpoint_warn), 22, 0);
2685 prt("Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð (0-9) ESC¤Ç·èÄê: ", 20, 0);
2687 prt("Hitpoint Warning (0-9 or ESC to accept): ", 20, 0);
2691 if (k == ESCAPE) break;
2695 (void)show_file(TRUE, "joption.txt#Hitpoint", NULL, 0, 0);
2697 (void)show_file(TRUE, "option.txt#Hitpoint", NULL, 0, 0);
2701 else if (isdigit(k)) hitpoint_warn = D2I(k);
2708 /* Hack -- mana color factor */
2715 prt("¥³¥Þ¥ó¥É: ÄãËâÎÏ¿§ïçÃÍ", 19, 0);
2717 prt("Command: Mana Color Threshold", 19, 0);
2720 /* Get a new value */
2724 prt(format("¸½ºß¤ÎÄãËâÎÏ¿§ïçÃÍ: %d0%%",
2727 prt(format("Current mana color threshold: %d0%%",
2732 prt("ÄãËâÎÏïçÃÍ (0-9) ESC¤Ç·èÄê: ", 20, 0);
2734 prt("Mana color Threshold (0-9 or ESC to accept): ", 20, 0);
2738 if (k == ESCAPE) break;
2742 (void)show_file(TRUE, "joption.txt#Manapoint", NULL, 0, 0);
2744 (void)show_file(TRUE, "option.txt#Manapoint", NULL, 0, 0);
2748 else if (isdigit(k)) mana_warn = D2I(k);
2757 (void)show_file(TRUE, "joption.txt", NULL, 0, 0);
2759 (void)show_file(TRUE, "option.txt", NULL, 0, 0);
2764 /* Unknown option */
2773 /* Flush messages */
2778 /* Restore the screen */
2781 /* Hack - Redraw equippy chars */
2782 p_ptr->redraw |= (PR_EQUIPPY);
2788 * Ask for a "user pref line" and process it
2790 * XXX XXX XXX Allow absolute file names?
2792 void do_cmd_pref(void)
2799 /* Ask for a "user pref command" */
2801 if (!get_string("ÀßÄêÊѹ¹¥³¥Þ¥ó¥É: ", buf, 80)) return;
2803 if (!get_string("Pref: ", buf, 80)) return;
2807 /* Process that pref command */
2808 (void)process_pref_file_command(buf);
2811 void do_cmd_reload_autopick(void)
2814 if (!get_check("¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹¤«? ")) return;
2816 if (!get_check("Reload auto-pick preference file? ")) return;
2819 /* Load the file with messages */
2820 autopick_load_pref(TRUE);
2826 * Hack -- append all current macros to the given file
2828 static errr macro_dump(cptr fname)
2830 static cptr mark = "Macro Dump";
2836 /* Build the filename */
2837 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2839 /* File type is "TEXT" */
2840 FILE_TYPE(FILE_TYPE_TEXT);
2842 /* Append to the file */
2843 if (!open_auto_dump(buf, mark)) return (-1);
2847 auto_dump_printf("\n# ¼«Æ°¥Þ¥¯¥í¥»¡¼¥Ö\n\n");
2849 auto_dump_printf("\n# Automatic macro dump\n\n");
2853 for (i = 0; i < macro__num; i++)
2855 /* Extract the action */
2856 ascii_to_text(buf, macro__act[i]);
2858 /* Dump the macro */
2859 auto_dump_printf("A:%s\n", buf);
2861 /* Extract the action */
2862 ascii_to_text(buf, macro__pat[i]);
2864 /* Dump normal macros */
2865 auto_dump_printf("P:%s\n", buf);
2868 auto_dump_printf("\n");
2880 * Hack -- ask for a "trigger" (see below)
2882 * Note the complex use of the "inkey()" function from "util.c".
2884 * Note that both "flush()" calls are extremely important.
2886 static void do_cmd_macro_aux(char *buf)
2896 /* Do not process macros */
2902 /* Read the pattern */
2908 /* Do not process macros */
2911 /* Do not wait for keys */
2914 /* Attempt to read a key */
2925 /* Convert the trigger */
2926 ascii_to_text(tmp, buf);
2928 /* Hack -- display the trigger */
2929 Term_addstr(-1, TERM_WHITE, tmp);
2936 * Hack -- ask for a keymap "trigger" (see below)
2938 * Note that both "flush()" calls are extremely important. This may
2939 * no longer be true, since "util.c" is much simpler now. XXX XXX XXX
2941 static void do_cmd_macro_aux_keymap(char *buf)
2955 /* Convert to ascii */
2956 ascii_to_text(tmp, buf);
2958 /* Hack -- display the trigger */
2959 Term_addstr(-1, TERM_WHITE, tmp);
2968 * Hack -- append all keymaps to the given file
2970 static errr keymap_dump(cptr fname)
2972 static cptr mark = "Keymap Dump";
2981 if (rogue_like_commands)
2983 mode = KEYMAP_MODE_ROGUE;
2989 mode = KEYMAP_MODE_ORIG;
2993 /* Build the filename */
2994 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2996 /* File type is "TEXT" */
2997 FILE_TYPE(FILE_TYPE_TEXT);
2999 /* Append to the file */
3000 if (!open_auto_dump(buf, mark)) return -1;
3004 auto_dump_printf("\n# ¼«Æ°¥¡¼ÇÛÃÖ¥»¡¼¥Ö\n\n");
3006 auto_dump_printf("\n# Automatic keymap dump\n\n");
3010 for (i = 0; i < 256; i++)
3014 /* Loop up the keymap */
3015 act = keymap_act[mode][i];
3017 /* Skip empty keymaps */
3020 /* Encode the key */
3023 ascii_to_text(key, buf);
3025 /* Encode the action */
3026 ascii_to_text(buf, act);
3028 /* Dump the macro */
3029 auto_dump_printf("A:%s\n", buf);
3030 auto_dump_printf("C:%d:%s\n", mode, key);
3043 * Interact with "macros"
3045 * Note that the macro "action" must be defined before the trigger.
3047 * Could use some helpful instructions on this page. XXX XXX XXX
3049 void do_cmd_macros(void)
3061 if (rogue_like_commands)
3063 mode = KEYMAP_MODE_ROGUE;
3069 mode = KEYMAP_MODE_ORIG;
3072 /* File type is "TEXT" */
3073 FILE_TYPE(FILE_TYPE_TEXT);
3080 /* Process requests until done */
3088 prt("[ ¥Þ¥¯¥í¤ÎÀßÄê ]", 2, 0);
3090 prt("Interact with Macros", 2, 0);
3095 /* Describe that action */
3097 prt("¥Þ¥¯¥í¹ÔÆ°¤¬(¤â¤·¤¢¤ì¤Ð)²¼¤Ëɽ¼¨¤µ¤ì¤Þ¤¹:", 20, 0);
3099 prt("Current action (if any) shown below:", 20, 0);
3103 /* Analyze the current action */
3104 ascii_to_text(buf, macro__buf);
3106 /* Display the current action */
3112 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
3114 prt("(1) Load a user pref file", 4, 5);
3119 prt("(2) ¥Õ¥¡¥¤¥ë¤Ë¥Þ¥¯¥í¤òÄɲÃ", 5, 5);
3120 prt("(3) ¥Þ¥¯¥í¤Î³Îǧ", 6, 5);
3121 prt("(4) ¥Þ¥¯¥í¤ÎºîÀ®", 7, 5);
3122 prt("(5) ¥Þ¥¯¥í¤Îºï½ü", 8, 5);
3123 prt("(6) ¥Õ¥¡¥¤¥ë¤Ë¥¡¼ÇÛÃÖ¤òÄɲÃ", 9, 5);
3124 prt("(7) ¥¡¼ÇÛÃ֤γÎǧ", 10, 5);
3125 prt("(8) ¥¡¼ÇÛÃ֤κîÀ®", 11, 5);
3126 prt("(9) ¥¡¼ÇÛÃ֤κï½ü", 12, 5);
3127 prt("(0) ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 13, 5);
3129 prt("(2) Append macros to a file", 5, 5);
3130 prt("(3) Query a macro", 6, 5);
3131 prt("(4) Create a macro", 7, 5);
3132 prt("(5) Remove a macro", 8, 5);
3133 prt("(6) Append keymaps to a file", 9, 5);
3134 prt("(7) Query a keymap", 10, 5);
3135 prt("(8) Create a keymap", 11, 5);
3136 prt("(9) Remove a keymap", 12, 5);
3137 prt("(0) Enter a new action", 13, 5);
3140 #endif /* ALLOW_MACROS */
3144 prt("¥³¥Þ¥ó¥É: ", 16, 0);
3146 prt("Command: ", 16, 0);
3154 if (i == ESCAPE) break;
3156 /* Load a 'macro' file */
3163 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 16, 0);
3165 prt("Command: Load a user pref file", 16, 0);
3171 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3173 prt("File: ", 18, 0);
3177 /* Default filename */
3178 sprintf(tmp, "%s.prf", player_base);
3180 /* Ask for a file */
3181 if (!askfor(tmp, 80)) continue;
3183 /* Process the given filename */
3184 err = process_pref_file(tmp);
3188 msg_format("ɸ½à¤ÎÀßÄê¥Õ¥¡¥¤¥ë'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3190 msg_format("Loaded default '%s'.", tmp);
3197 msg_format("'%s'¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡ª", tmp);
3199 msg_format("Failed to load '%s'!");
3205 msg_format("'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3207 msg_format("Loaded '%s'.", tmp);
3219 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3221 prt("Command: Append macros to a file", 16, 0);
3227 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3229 prt("File: ", 18, 0);
3233 /* Default filename */
3234 sprintf(tmp, "%s.prf", player_base);
3236 /* Ask for a file */
3237 if (!askfor(tmp, 80)) continue;
3239 /* Dump the macros */
3240 (void)macro_dump(tmp);
3244 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3246 msg_print("Appended macros.");
3258 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Î³Îǧ", 16, 0);
3260 prt("Command: Query a macro", 16, 0);
3266 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3268 prt("Trigger: ", 18, 0);
3272 /* Get a macro trigger */
3273 do_cmd_macro_aux(buf);
3275 /* Acquire action */
3276 k = macro_find_exact(buf);
3283 msg_print("¤½¤Î¥¡¼¤Ë¤Ï¥Þ¥¯¥í¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3285 msg_print("Found no macro.");
3293 /* Obtain the action */
3294 strcpy(macro__buf, macro__act[k]);
3296 /* Analyze the current action */
3297 ascii_to_text(buf, macro__buf);
3299 /* Display the current action */
3304 msg_print("¥Þ¥¯¥í¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3306 msg_print("Found a macro.");
3312 /* Create a macro */
3317 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ÎºîÀ®", 16, 0);
3319 prt("Command: Create a macro", 16, 0);
3325 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3327 prt("Trigger: ", 18, 0);
3331 /* Get a macro trigger */
3332 do_cmd_macro_aux(buf);
3339 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3341 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3346 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3348 prt("Action: ", 20, 0);
3352 /* Convert to text */
3353 ascii_to_text(tmp, macro__buf);
3355 /* Get an encoded action */
3356 if (askfor(tmp, 80))
3358 /* Convert to ascii */
3359 text_to_ascii(macro__buf, tmp);
3361 /* Link the macro */
3362 macro_add(buf, macro__buf);
3366 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3368 msg_print("Added a macro.");
3374 /* Remove a macro */
3379 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Îºï½ü", 16, 0);
3381 prt("Command: Remove a macro", 16, 0);
3387 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3389 prt("Trigger: ", 18, 0);
3393 /* Get a macro trigger */
3394 do_cmd_macro_aux(buf);
3396 /* Link the macro */
3397 macro_add(buf, buf);
3401 msg_print("¥Þ¥¯¥í¤òºï½ü¤·¤Þ¤·¤¿¡£");
3403 msg_print("Removed a macro.");
3413 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃÖ¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3415 prt("Command: Append keymaps to a file", 16, 0);
3421 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3423 prt("File: ", 18, 0);
3427 /* Default filename */
3428 sprintf(tmp, "%s.prf", player_base);
3430 /* Ask for a file */
3431 if (!askfor(tmp, 80)) continue;
3433 /* Dump the macros */
3434 (void)keymap_dump(tmp);
3438 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3440 msg_print("Appended keymaps.");
3445 /* Query a keymap */
3452 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤γÎǧ", 16, 0);
3454 prt("Command: Query a keymap", 16, 0);
3460 prt("²¡¤¹¥¡¼: ", 18, 0);
3462 prt("Keypress: ", 18, 0);
3466 /* Get a keymap trigger */
3467 do_cmd_macro_aux_keymap(buf);
3469 /* Look up the keymap */
3470 act = keymap_act[mode][(byte)(buf[0])];
3477 msg_print("¥¡¼ÇÛÃÖ¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3479 msg_print("Found no keymap.");
3487 /* Obtain the action */
3488 strcpy(macro__buf, act);
3490 /* Analyze the current action */
3491 ascii_to_text(buf, macro__buf);
3493 /* Display the current action */
3498 msg_print("¥¡¼ÇÛÃÖ¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3500 msg_print("Found a keymap.");
3506 /* Create a keymap */
3511 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κîÀ®", 16, 0);
3513 prt("Command: Create a keymap", 16, 0);
3519 prt("²¡¤¹¥¡¼: ", 18, 0);
3521 prt("Keypress: ", 18, 0);
3525 /* Get a keymap trigger */
3526 do_cmd_macro_aux_keymap(buf);
3533 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3535 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3540 prt("¹ÔÆ°: ", 20, 0);
3542 prt("Action: ", 20, 0);
3546 /* Convert to text */
3547 ascii_to_text(tmp, macro__buf);
3549 /* Get an encoded action */
3550 if (askfor(tmp, 80))
3552 /* Convert to ascii */
3553 text_to_ascii(macro__buf, tmp);
3555 /* Free old keymap */
3556 string_free(keymap_act[mode][(byte)(buf[0])]);
3558 /* Make new keymap */
3559 keymap_act[mode][(byte)(buf[0])] = string_make(macro__buf);
3563 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3565 msg_print("Added a keymap.");
3571 /* Remove a keymap */
3576 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κï½ü", 16, 0);
3578 prt("Command: Remove a keymap", 16, 0);
3584 prt("²¡¤¹¥¡¼: ", 18, 0);
3586 prt("Keypress: ", 18, 0);
3590 /* Get a keymap trigger */
3591 do_cmd_macro_aux_keymap(buf);
3593 /* Free old keymap */
3594 string_free(keymap_act[mode][(byte)(buf[0])]);
3596 /* Make new keymap */
3597 keymap_act[mode][(byte)(buf[0])] = NULL;
3601 msg_print("¥¡¼ÇÛÃÖ¤òºï½ü¤·¤Þ¤·¤¿¡£");
3603 msg_print("Removed a keymap.");
3608 /* Enter a new action */
3613 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 16, 0);
3615 prt("Command: Enter a new action", 16, 0);
3623 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3625 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3630 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3632 prt("Action: ", 20, 0);
3635 /* Hack -- limit the value */
3638 /* Get an encoded action */
3639 if (!askfor(buf, 80)) continue;
3641 /* Extract an action */
3642 text_to_ascii(macro__buf, buf);
3645 #endif /* ALLOW_MACROS */
3654 /* Flush messages */
3663 static cptr lighting_level_str[F_LIT_MAX] =
3677 static bool cmd_visuals_aux(int i, int *num, int max)
3684 sprintf(str, "%d", *num);
3686 if (!get_string(format("Input new number(0-%d): ", max-1), str, 4))
3689 tmp = strtol(str, NULL, 0);
3690 if (tmp >= 0 && tmp < max)
3693 else if (isupper(i))
3694 *num = (*num + max - 1) % max;
3696 *num = (*num + 1) % max;
3701 static void print_visuals_menu(cptr choice_msg)
3704 prt("[ ²èÌÌɽ¼¨¤ÎÀßÄê ]", 1, 0);
3706 prt("Interact with Visuals", 1, 0);
3709 /* Give some choices */
3711 prt("(0) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 3, 5);
3713 prt("(0) Load a user pref file", 3, 5);
3716 #ifdef ALLOW_VISUALS
3718 prt("(1) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 4, 5);
3719 prt("(2) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
3720 prt("(3) ÃÏ·Á¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 6, 5);
3721 prt("(4) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 7, 5);
3722 prt("(5) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 8, 5);
3723 prt("(6) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 9, 5);
3724 prt("(7) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 10, 5);
3725 prt("(8) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 11, 5);
3726 prt("(9) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 12, 5);
3728 prt("(1) Dump monster attr/chars", 4, 5);
3729 prt("(2) Dump object attr/chars", 5, 5);
3730 prt("(3) Dump feature attr/chars", 6, 5);
3731 prt("(4) Change monster attr/chars (numeric operation)", 7, 5);
3732 prt("(5) Change object attr/chars (numeric operation)", 8, 5);
3733 prt("(6) Change feature attr/chars (numeric operation)", 9, 5);
3734 prt("(7) Change monster attr/chars (visual mode)", 10, 5);
3735 prt("(8) Change object attr/chars (visual mode)", 11, 5);
3736 prt("(9) Change feature attr/chars (visual mode)", 12, 5);
3739 #endif /* ALLOW_VISUALS */
3742 prt("(R) ²èÌÌɽ¼¨ÊýË¡¤Î½é´ü²½", 13, 5);
3744 prt("(R) Reset visuals", 13, 5);
3749 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg ? choice_msg : ""), 15, 0);
3751 prt(format("Command: %s", choice_msg ? choice_msg : ""), 15, 0);
3755 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, int direct_r_idx);
3756 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int direct_k_idx);
3757 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int direct_f_idx, int *lighting_level);
3760 * Interact with "visuals"
3762 void do_cmd_visuals(void)
3767 bool need_redraw = FALSE;
3768 const char *empty_symbol = "<< ? >>";
3770 if (use_bigtile) empty_symbol = "<< ?? >>";
3772 /* File type is "TEXT" */
3773 FILE_TYPE(FILE_TYPE_TEXT);
3775 /* Save the screen */
3778 /* Interact until done */
3784 /* Ask for a choice */
3785 print_visuals_menu(NULL);
3791 if (i == ESCAPE) break;
3795 /* Load a 'pref' file */
3799 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 15, 0);
3801 prt("Command: Load a user pref file", 15, 0);
3806 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3808 prt("File: ", 17, 0);
3811 /* Default filename */
3812 sprintf(tmp, "%s.prf", player_base);
3815 if (!askfor(tmp, 70)) continue;
3817 /* Process the given filename */
3818 (void)process_pref_file(tmp);
3823 #ifdef ALLOW_VISUALS
3825 /* Dump monster attr/chars */
3828 static cptr mark = "Monster attr/chars";
3832 prt("¥³¥Þ¥ó¥É: ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3834 prt("Command: Dump monster attr/chars", 15, 0);
3839 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3841 prt("File: ", 17, 0);
3844 /* Default filename */
3845 sprintf(tmp, "%s.prf", player_base);
3847 /* Get a filename */
3848 if (!askfor(tmp, 70)) continue;
3850 /* Build the filename */
3851 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3853 /* Append to the file */
3854 if (!open_auto_dump(buf, mark)) continue;
3858 auto_dump_printf("\n# ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3860 auto_dump_printf("\n# Monster attr/char definitions\n\n");
3864 for (i = 0; i < max_r_idx; i++)
3866 monster_race *r_ptr = &r_info[i];
3868 /* Skip non-entries */
3869 if (!r_ptr->name) continue;
3871 /* Dump a comment */
3872 auto_dump_printf("# %s\n", (r_name + r_ptr->name));
3874 /* Dump the monster attr/char info */
3875 auto_dump_printf("R:%d:0x%02X/0x%02X\n\n", i,
3876 (byte)(r_ptr->x_attr), (byte)(r_ptr->x_char));
3884 msg_print("¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3886 msg_print("Dumped monster attr/chars.");
3892 /* Dump object attr/chars */
3895 static cptr mark = "Object attr/chars";
3899 prt("¥³¥Þ¥ó¥É: ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3901 prt("Command: Dump object attr/chars", 15, 0);
3906 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3908 prt("File: ", 17, 0);
3911 /* Default filename */
3912 sprintf(tmp, "%s.prf", player_base);
3914 /* Get a filename */
3915 if (!askfor(tmp, 70)) continue;
3917 /* Build the filename */
3918 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3920 /* Append to the file */
3921 if (!open_auto_dump(buf, mark)) continue;
3925 auto_dump_printf("\n# ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3927 auto_dump_printf("\n# Object attr/char definitions\n\n");
3931 for (i = 0; i < max_k_idx; i++)
3934 object_kind *k_ptr = &k_info[i];
3936 /* Skip non-entries */
3937 if (!k_ptr->name) continue;
3942 strip_name(o_name, i);
3948 /* Prepare dummy object */
3949 object_prep(&forge, i);
3951 /* Get un-shuffled flavor name */
3952 object_desc(o_name, &forge, OD_FORCE_FLAVOR);
3955 /* Dump a comment */
3956 auto_dump_printf("# %s\n", o_name);
3958 /* Dump the object attr/char info */
3959 auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", i,
3960 (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char));
3968 msg_print("¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3970 msg_print("Dumped object attr/chars.");
3976 /* Dump feature attr/chars */
3979 static cptr mark = "Feature attr/chars";
3983 prt("¥³¥Þ¥ó¥É: ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3985 prt("Command: Dump feature attr/chars", 15, 0);
3990 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3992 prt("File: ", 17, 0);
3995 /* Default filename */
3996 sprintf(tmp, "%s.prf", player_base);
3998 /* Get a filename */
3999 if (!askfor(tmp, 70)) continue;
4001 /* Build the filename */
4002 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
4004 /* Append to the file */
4005 if (!open_auto_dump(buf, mark)) continue;
4009 auto_dump_printf("\n# ÃÏ·Á¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
4011 auto_dump_printf("\n# Feature attr/char definitions\n\n");
4015 for (i = 0; i < max_f_idx; i++)
4017 feature_type *f_ptr = &f_info[i];
4019 /* Skip non-entries */
4020 if (!f_ptr->name) continue;
4022 /* Skip mimiccing features */
4023 if (f_ptr->mimic != i) continue;
4025 /* Dump a comment */
4026 auto_dump_printf("# %s\n", (f_name + f_ptr->name));
4028 /* Dump the feature attr/char info */
4029 auto_dump_printf("F:%d:0x%02X/0x%02X:0x%02X/0x%02X:0x%02X/0x%02X\n\n", i,
4030 (byte)(f_ptr->x_attr[F_LIT_STANDARD]), (byte)(f_ptr->x_char[F_LIT_STANDARD]),
4031 (byte)(f_ptr->x_attr[F_LIT_LITE]), (byte)(f_ptr->x_char[F_LIT_LITE]),
4032 (byte)(f_ptr->x_attr[F_LIT_DARK]), (byte)(f_ptr->x_char[F_LIT_DARK]));
4040 msg_print("ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
4042 msg_print("Dumped feature attr/chars.");
4048 /* Modify monster attr/chars (numeric operation) */
4052 static cptr choice_msg = "¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4054 static cptr choice_msg = "Change monster attr/chars";
4059 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4061 prt(format("Command: %s", choice_msg), 15, 0);
4064 /* Hack -- query until done */
4067 monster_race *r_ptr = &r_info[r];
4071 byte da = r_ptr->d_attr;
4072 byte dc = r_ptr->d_char;
4073 byte ca = r_ptr->x_attr;
4074 byte cc = r_ptr->x_char;
4076 /* Label the object */
4078 Term_putstr(5, 17, -1, TERM_WHITE,
4079 format("¥â¥ó¥¹¥¿¡¼ = %d, ̾Á° = %-40.40s",
4080 r, (r_name + r_ptr->name)));
4082 Term_putstr(5, 17, -1, TERM_WHITE,
4083 format("Monster = %d, Name = %-40.40s",
4084 r, (r_name + r_ptr->name)));
4087 /* Label the Default values */
4089 Term_putstr(10, 19, -1, TERM_WHITE,
4090 format("½é´üÃÍ ¿§ / ʸ»ú = %3u / %3u", da, dc));
4092 Term_putstr(10, 19, -1, TERM_WHITE,
4093 format("Default attr/char = %3u / %3u", da, dc));
4096 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4097 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4099 /* Label the Current values */
4101 Term_putstr(10, 20, -1, TERM_WHITE,
4102 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3u / %3u", ca, cc));
4104 Term_putstr(10, 20, -1, TERM_WHITE,
4105 format("Current attr/char = %3u / %3u", ca, cc));
4108 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4109 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4113 Term_putstr(0, 22, -1, TERM_WHITE,
4114 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4116 Term_putstr(0, 22, -1, TERM_WHITE,
4117 "Command (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4124 if (i == ESCAPE) break;
4126 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4127 else if (isupper(i)) c = 'a' + i - 'A';
4137 if (!cmd_visuals_aux(i, &r, max_r_idx))
4143 while (!r_info[r].name);
4147 t = (int)r_ptr->x_attr;
4148 (void)cmd_visuals_aux(i, &t, 256);
4149 r_ptr->x_attr = (byte)t;
4153 t = (int)r_ptr->x_char;
4154 (void)cmd_visuals_aux(i, &t, 256);
4155 r_ptr->x_char = (byte)t;
4159 do_cmd_knowledge_monsters(&need_redraw, TRUE, r);
4163 print_visuals_menu(choice_msg);
4171 /* Modify object attr/chars (numeric operation) */
4175 static cptr choice_msg = "¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4177 static cptr choice_msg = "Change object attr/chars";
4182 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4184 prt(format("Command: %s", choice_msg), 15, 0);
4187 /* Hack -- query until done */
4190 object_kind *k_ptr = &k_info[k];
4194 byte da = k_ptr->d_attr;
4195 byte dc = k_ptr->d_char;
4196 byte ca = k_ptr->x_attr;
4197 byte cc = k_ptr->x_char;
4199 /* Label the object */
4201 Term_putstr(5, 17, -1, TERM_WHITE,
4202 format("¥¢¥¤¥Æ¥à = %d, ̾Á° = %-40.40s",
4203 k, k_name + (!k_ptr->flavor ? k_ptr->name : k_ptr->flavor_name)));
4205 Term_putstr(5, 17, -1, TERM_WHITE,
4206 format("Object = %d, Name = %-40.40s",
4207 k, k_name + (!k_ptr->flavor ? k_ptr->name : k_ptr->flavor_name)));
4210 /* Label the Default values */
4212 Term_putstr(10, 19, -1, TERM_WHITE,
4213 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4215 Term_putstr(10, 19, -1, TERM_WHITE,
4216 format("Default attr/char = %3d / %3d", da, dc));
4219 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4220 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4222 /* Label the Current values */
4224 Term_putstr(10, 20, -1, TERM_WHITE,
4225 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4227 Term_putstr(10, 20, -1, TERM_WHITE,
4228 format("Current attr/char = %3d / %3d", ca, cc));
4231 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4232 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4236 Term_putstr(0, 22, -1, TERM_WHITE,
4237 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4239 Term_putstr(0, 22, -1, TERM_WHITE,
4240 "Command (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4247 if (i == ESCAPE) break;
4249 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4250 else if (isupper(i)) c = 'a' + i - 'A';
4260 if (!cmd_visuals_aux(i, &k, max_k_idx))
4266 while (!k_info[k].name);
4270 t = (int)k_ptr->x_attr;
4271 (void)cmd_visuals_aux(i, &t, 256);
4272 k_ptr->x_attr = (byte)t;
4276 t = (int)k_ptr->x_char;
4277 (void)cmd_visuals_aux(i, &t, 256);
4278 k_ptr->x_char = (byte)t;
4282 do_cmd_knowledge_objects(&need_redraw, TRUE, k);
4286 print_visuals_menu(choice_msg);
4294 /* Modify feature attr/chars (numeric operation) */
4298 static cptr choice_msg = "ÃÏ·Á¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4300 static cptr choice_msg = "Change feature attr/chars";
4303 static int lighting_level = F_LIT_STANDARD;
4306 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4308 prt(format("Command: %s", choice_msg), 15, 0);
4311 /* Hack -- query until done */
4314 feature_type *f_ptr = &f_info[f];
4318 byte da = f_ptr->d_attr[lighting_level];
4319 byte dc = f_ptr->d_char[lighting_level];
4320 byte ca = f_ptr->x_attr[lighting_level];
4321 byte cc = f_ptr->x_char[lighting_level];
4323 /* Label the object */
4326 Term_putstr(5, 17, -1, TERM_WHITE,
4327 format("ÃÏ·Á = %d, ̾Á° = %s, ÌÀÅÙ = %s",
4328 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
4330 Term_putstr(5, 17, -1, TERM_WHITE,
4331 format("Terrain = %d, Name = %s, Lighting = %s",
4332 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
4335 /* Label the Default values */
4337 Term_putstr(10, 19, -1, TERM_WHITE,
4338 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4340 Term_putstr(10, 19, -1, TERM_WHITE,
4341 format("Default attr/char = %3d / %3d", da, dc));
4344 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4346 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4348 /* Label the Current values */
4350 Term_putstr(10, 20, -1, TERM_WHITE,
4351 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4353 Term_putstr(10, 20, -1, TERM_WHITE,
4354 format("Current attr/char = %3d / %3d", ca, cc));
4357 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4358 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4362 Term_putstr(0, 22, -1, TERM_WHITE,
4363 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
4365 Term_putstr(0, 22, -1, TERM_WHITE,
4366 "Command (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
4373 if (i == ESCAPE) break;
4375 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4376 else if (isupper(i)) c = 'a' + i - 'A';
4386 if (!cmd_visuals_aux(i, &f, max_f_idx))
4392 while (!f_info[f].name || (f_info[f].mimic != f));
4396 t = (int)f_ptr->x_attr[lighting_level];
4397 (void)cmd_visuals_aux(i, &t, 256);
4398 f_ptr->x_attr[lighting_level] = (byte)t;
4402 t = (int)f_ptr->x_char[lighting_level];
4403 (void)cmd_visuals_aux(i, &t, 256);
4404 f_ptr->x_char[lighting_level] = (byte)t;
4408 (void)cmd_visuals_aux(i, &lighting_level, F_LIT_MAX);
4411 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
4415 do_cmd_knowledge_features(&need_redraw, TRUE, f, &lighting_level);
4419 print_visuals_menu(choice_msg);
4427 /* Modify monster attr/chars (visual mode) */
4429 do_cmd_knowledge_monsters(&need_redraw, TRUE, -1);
4432 /* Modify object attr/chars (visual mode) */
4434 do_cmd_knowledge_objects(&need_redraw, TRUE, -1);
4437 /* Modify feature attr/chars (visual mode) */
4440 int lighting_level = F_LIT_STANDARD;
4441 do_cmd_knowledge_features(&need_redraw, TRUE, -1, &lighting_level);
4445 #endif /* ALLOW_VISUALS */
4455 msg_print("²èÌ̾å¤Î[¿§/ʸ»ú]¤ò½é´üÃͤ˥ꥻ¥Ã¥È¤·¤Þ¤·¤¿¡£");
4457 msg_print("Visual attr/char tables reset.");
4463 /* Unknown option */
4469 /* Flush messages */
4473 /* Restore the screen */
4476 if (need_redraw) do_cmd_redraw();
4481 * Interact with "colors"
4483 void do_cmd_colors(void)
4492 /* File type is "TEXT" */
4493 FILE_TYPE(FILE_TYPE_TEXT);
4496 /* Save the screen */
4500 /* Interact until done */
4506 /* Ask for a choice */
4508 prt("[ ¥«¥é¡¼¤ÎÀßÄê ]", 2, 0);
4510 prt("Interact with Colors", 2, 0);
4514 /* Give some choices */
4516 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
4518 prt("(1) Load a user pref file", 4, 5);
4523 prt("(2) ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
4524 prt("(3) ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤¹¤ë", 6, 5);
4526 prt("(2) Dump colors", 5, 5);
4527 prt("(3) Modify colors", 6, 5);
4534 prt("¥³¥Þ¥ó¥É: ", 8, 0);
4536 prt("Command: ", 8, 0);
4544 if (i == ESCAPE) break;
4546 /* Load a 'pref' file */
4551 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹", 8, 0);
4553 prt("Command: Load a user pref file", 8, 0);
4559 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4561 prt("File: ", 10, 0);
4566 sprintf(tmp, "%s.prf", player_base);
4569 if (!askfor(tmp, 70)) continue;
4571 /* Process the given filename */
4572 (void)process_pref_file(tmp);
4574 /* Mega-Hack -- react to changes */
4575 Term_xtra(TERM_XTRA_REACT, 0);
4577 /* Mega-Hack -- redraw */
4586 static cptr mark = "Colors";
4590 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 8, 0);
4592 prt("Command: Dump colors", 8, 0);
4598 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4600 prt("File: ", 10, 0);
4604 /* Default filename */
4605 sprintf(tmp, "%s.prf", player_base);
4607 /* Get a filename */
4608 if (!askfor(tmp, 70)) continue;
4610 /* Build the filename */
4611 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
4613 /* Append to the file */
4614 if (!open_auto_dump(buf, mark)) continue;
4618 auto_dump_printf("\n# ¥«¥é¡¼¤ÎÀßÄê\n\n");
4620 auto_dump_printf("\n# Color redefinitions\n\n");
4624 for (i = 0; i < 256; i++)
4626 int kv = angband_color_table[i][0];
4627 int rv = angband_color_table[i][1];
4628 int gv = angband_color_table[i][2];
4629 int bv = angband_color_table[i][3];
4634 cptr name = "unknown";
4638 /* Skip non-entries */
4639 if (!kv && !rv && !gv && !bv) continue;
4641 /* Extract the color name */
4642 if (i < 16) name = color_names[i];
4644 /* Dump a comment */
4646 auto_dump_printf("# ¥«¥é¡¼ '%s'\n", name);
4648 auto_dump_printf("# Color '%s'\n", name);
4651 /* Dump the monster attr/char info */
4652 auto_dump_printf("V:%d:0x%02X:0x%02X:0x%02X:0x%02X\n\n",
4661 msg_print("¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
4663 msg_print("Dumped color redefinitions.");
4675 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤·¤Þ¤¹", 8, 0);
4677 prt("Command: Modify colors", 8, 0);
4681 /* Hack -- query until done */
4690 /* Exhibit the normal colors */
4691 for (j = 0; j < 16; j++)
4693 /* Exhibit this color */
4694 Term_putstr(j*4, 20, -1, a, "###");
4696 /* Exhibit all colors */
4697 Term_putstr(j*4, 22, -1, j, format("%3d", j));
4700 /* Describe the color */
4702 name = ((a < 16) ? color_names[a] : "̤ÄêµÁ");
4704 name = ((a < 16) ? color_names[a] : "undefined");
4708 /* Describe the color */
4710 Term_putstr(5, 10, -1, TERM_WHITE,
4711 format("¥«¥é¡¼ = %d, ̾Á° = %s", a, name));
4713 Term_putstr(5, 10, -1, TERM_WHITE,
4714 format("Color = %d, Name = %s", a, name));
4718 /* Label the Current values */
4719 Term_putstr(5, 12, -1, TERM_WHITE,
4720 format("K = 0x%02x / R,G,B = 0x%02x,0x%02x,0x%02x",
4721 angband_color_table[a][0],
4722 angband_color_table[a][1],
4723 angband_color_table[a][2],
4724 angband_color_table[a][3]));
4728 Term_putstr(0, 14, -1, TERM_WHITE,
4729 "¥³¥Þ¥ó¥É (n/N/k/K/r/R/g/G/b/B): ");
4731 Term_putstr(0, 14, -1, TERM_WHITE,
4732 "Command (n/N/k/K/r/R/g/G/b/B): ");
4740 if (i == ESCAPE) break;
4743 if (i == 'n') a = (byte)(a + 1);
4744 if (i == 'N') a = (byte)(a - 1);
4745 if (i == 'k') angband_color_table[a][0] = (byte)(angband_color_table[a][0] + 1);
4746 if (i == 'K') angband_color_table[a][0] = (byte)(angband_color_table[a][0] - 1);
4747 if (i == 'r') angband_color_table[a][1] = (byte)(angband_color_table[a][1] + 1);
4748 if (i == 'R') angband_color_table[a][1] = (byte)(angband_color_table[a][1] - 1);
4749 if (i == 'g') angband_color_table[a][2] = (byte)(angband_color_table[a][2] + 1);
4750 if (i == 'G') angband_color_table[a][2] = (byte)(angband_color_table[a][2] - 1);
4751 if (i == 'b') angband_color_table[a][3] = (byte)(angband_color_table[a][3] + 1);
4752 if (i == 'B') angband_color_table[a][3] = (byte)(angband_color_table[a][3] - 1);
4754 /* Hack -- react to changes */
4755 Term_xtra(TERM_XTRA_REACT, 0);
4757 /* Hack -- redraw */
4764 /* Unknown option */
4770 /* Flush messages */
4775 /* Restore the screen */
4781 * Note something in the message recall
4783 void do_cmd_note(void)
4792 if (!get_string("¥á¥â: ", buf, 60)) return;
4794 if (!get_string("Note: ", buf, 60)) return;
4798 /* Ignore empty notes */
4799 if (!buf[0] || (buf[0] == ' ')) return;
4801 /* Add the note to the message recall */
4803 msg_format("¥á¥â: %s", buf);
4805 msg_format("Note: %s", buf);
4812 * Mention the current version
4814 void do_cmd_version(void)
4819 msg_format("ÊѶòÈÚÅÜ(Hengband) %d.%d.%d",
4820 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4822 msg_format("You are playing Hengband %d.%d.%d.",
4823 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4830 * Array of feeling strings
4832 static cptr do_cmd_feeling_text[11] =
4835 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4837 "Looks like any other level.",
4841 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4843 "You feel there is something special about this level.",
4847 "¶²¤í¤·¤¤»à¤Î¸¸¤¬ÌܤËÉ⤫¤Ó¡¢µ¤À䤷¤½¤¦¤Ë¤Ê¤Ã¤¿¡ª",
4849 "You nearly faint as horrible visions of death fill your mind!",
4853 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4855 "This level looks very dangerous.",
4859 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4861 "You have a very bad feeling...",
4865 "°¤¤Í½´¶¤¬¤¹¤ë...",
4867 "You have a bad feeling...",
4873 "You feel nervous.",
4877 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4879 "You feel your luck is turning...",
4883 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4885 "You don't like the look of this place.",
4889 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4891 "This level looks reasonably safe.",
4895 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4897 "What a boring place..."
4902 static cptr do_cmd_feeling_text_combat[11] =
4905 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4907 "Looks like any other level.",
4911 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4913 "You feel there is something special about this level.",
4917 "º£Ìë¤â¤Þ¤¿¡¢Ã¯¤«¤¬Ì¿¤òÍî¤È¤¹...",
4919 "You nearly faint as horrible visions of death fill your mind!",
4923 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4925 "This level looks very dangerous.",
4929 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4931 "You have a very bad feeling...",
4935 "°¤¤Í½´¶¤¬¤¹¤ë...",
4937 "You have a bad feeling...",
4943 "You feel nervous.",
4947 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4949 "You feel your luck is turning...",
4953 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4955 "You don't like the look of this place.",
4959 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4961 "This level looks reasonably safe.",
4965 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4967 "What a boring place..."
4972 static cptr do_cmd_feeling_text_lucky[11] =
4975 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4976 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4977 "¤³¤Î³¬¤Ï¤³¤Î¾å¤Ê¤¯ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë¡£",
4978 "ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë...",
4979 "¤È¤Æ¤âÎɤ¤´¶¤¸¤¬¤¹¤ë...",
4980 "Îɤ¤´¶¤¸¤¬¤¹¤ë...",
4981 "¤Á¤ç¤Ã¤È¹¬±¿¤Ê´¶¤¸¤¬¤¹¤ë...",
4982 "¿¾¯¤Ï±¿¤¬¸þ¤¤¤Æ¤¤¿¤«...",
4983 "¸«¤¿´¶¤¸°¤¯¤Ï¤Ê¤¤...",
4984 "Á´Á³ÂÌÌܤȤ¤¤¦¤³¤È¤Ï¤Ê¤¤¤¬...",
4985 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4987 "Looks like any other level.",
4988 "You feel there is something special about this level.",
4989 "You have a superb feeling about this level.",
4990 "You have an excellent feeling...",
4991 "You have a very good feeling...",
4992 "You have a good feeling...",
4993 "You feel strangely lucky...",
4994 "You feel your luck is turning...",
4995 "You like the look of this place...",
4996 "This level can't be all bad...",
4997 "What a boring place..."
5003 * Note that "feeling" is set to zero unless some time has passed.
5004 * Note that this is done when the level is GENERATED, not entered.
5006 void do_cmd_feeling(void)
5008 /* No useful feeling in quests */
5009 if (p_ptr->inside_quest && !random_quest_number(dun_level))
5012 msg_print("ŵ·¿Åª¤Ê¥¯¥¨¥¹¥È¤Î¥À¥ó¥¸¥ç¥ó¤Î¤è¤¦¤À¡£");
5014 msg_print("Looks like a typical quest level.");
5020 /* No useful feeling in town */
5021 else if (p_ptr->town_num && !dun_level)
5024 if (!strcmp(town[p_ptr->town_num].name, "¹ÓÌî"))
5026 if (!strcmp(town[p_ptr->town_num].name, "wilderness"))
5030 msg_print("²¿¤«¤¢¤ê¤½¤¦¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
5032 msg_print("Looks like a strange wilderness.");
5040 msg_print("ŵ·¿Åª¤ÊÄ®¤Î¤è¤¦¤À¡£");
5042 msg_print("Looks like a typical town.");
5049 /* No useful feeling in the wilderness */
5050 else if (!dun_level)
5053 msg_print("ŵ·¿Åª¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
5055 msg_print("Looks like a typical wilderness.");
5061 /* Display the feeling */
5062 if (p_ptr->muta3 & MUT3_GOOD_LUCK)
5063 msg_print(do_cmd_feeling_text_lucky[p_ptr->feeling]);
5064 else if (p_ptr->pseikaku == SEIKAKU_COMBAT ||
5065 inventory[INVEN_BOW].name1 == ART_CRIMSON)
5066 msg_print(do_cmd_feeling_text_combat[p_ptr->feeling]);
5068 msg_print(do_cmd_feeling_text[p_ptr->feeling]);
5074 * Description of each monster group.
5076 static cptr monster_group_text[] =
5079 "¥æ¥Ë¡¼¥¯", /* "Uniques" */
5080 "¾èÇϲÄǽ¤Ê¥â¥ó¥¹¥¿¡¼", /* "Riding" */
5081 "¾Þ¶â¼ó", /* "Wanted */
5082 "¥¢¥ó¥Ð¡¼¤Î²¦Â²", /* "Ambertite" */
5111 /* "¸ÅÂå¥É¥é¥´¥ó/¥ï¥¤¥¢¡¼¥à", */
5128 /* "¾åµé¥Ç¡¼¥â¥ó", */
5172 /* "Ancient Dragon/Wyrm", */
5181 "Multi-Headed Reptile",
5186 "Reptile/Amphibian",
5187 "Spider/Scorpion/Tick",
5189 /* "Major Demon", */
5206 * Symbols of monsters in each group. Note the "Uniques" group
5207 * is handled differently.
5209 static cptr monster_group_char[] =
5266 "!$&()+./=>?[\\]`{|~",
5276 * hook function to sort monsters by level
5278 static bool ang_sort_comp_monster_level(vptr u, vptr v, int a, int b)
5280 u16b *who = (u16b*)(u);
5285 monster_race *r_ptr1 = &r_info[w1];
5286 monster_race *r_ptr2 = &r_info[w2];
5291 if (r_ptr2->level > r_ptr1->level) return TRUE;
5292 if (r_ptr1->level > r_ptr2->level) return FALSE;
5294 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return TRUE;
5295 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return FALSE;
5300 * Build a list of monster indexes in the given group. Return the number
5301 * of monsters in the group.
5303 * mode & 0x01 : check for non-empty group
5304 * mode & 0x02 : visual operation only
5306 static int collect_monsters(int grp_cur, s16b mon_idx[], byte mode)
5311 /* Get a list of x_char in this group */
5312 cptr group_char = monster_group_char[grp_cur];
5314 /* XXX Hack -- Check if this is the "Uniques" group */
5315 bool grp_unique = (monster_group_char[grp_cur] == (char *) -1L);
5317 /* XXX Hack -- Check if this is the "Riding" group */
5318 bool grp_riding = (monster_group_char[grp_cur] == (char *) -2L);
5320 /* XXX Hack -- Check if this is the "Wanted" group */
5321 bool grp_wanted = (monster_group_char[grp_cur] == (char *) -3L);
5323 /* XXX Hack -- Check if this is the "Amberite" group */
5324 bool grp_amberite = (monster_group_char[grp_cur] == (char *) -4L);
5327 /* Check every race */
5328 for (i = 0; i < max_r_idx; i++)
5330 /* Access the race */
5331 monster_race *r_ptr = &r_info[i];
5333 /* Skip empty race */
5334 if (!r_ptr->name) continue ;
5336 /* Require known monsters */
5337 if (!(mode & 0x02) && !cheat_know && !r_ptr->r_sights) continue;
5341 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
5344 else if (grp_riding)
5346 if (!(r_ptr->flags7 & RF7_RIDING)) continue;
5349 else if (grp_wanted)
5351 bool wanted = FALSE;
5353 for (j = 0; j < MAX_KUBI; j++)
5355 if (kubi_r_idx[j] == i || kubi_r_idx[j] - 10000 == i ||
5356 (p_ptr->today_mon && p_ptr->today_mon == i))
5362 if (!wanted) continue;
5365 else if (grp_amberite)
5367 if (!(r_ptr->flags3 & RF3_AMBERITE)) continue;
5372 /* Check for race in the group */
5373 if (!my_strchr(group_char, r_ptr->d_char)) continue;
5377 mon_idx[mon_cnt++] = i;
5379 /* XXX Hack -- Just checking for non-empty group */
5380 if (mode & 0x01) break;
5383 /* Terminate the list */
5384 mon_idx[mon_cnt] = -1;
5386 /* Select the sort method */
5387 ang_sort_comp = ang_sort_comp_monster_level;
5388 ang_sort_swap = ang_sort_swap_hook;
5390 /* Sort by monster level */
5391 ang_sort(mon_idx, &dummy_why, mon_cnt);
5393 /* Return the number of races */
5399 * Description of each monster group.
5401 static cptr object_group_text[] =
5404 "¥¥Î¥³", /* "Mushrooms" */
5405 "Ìô", /* "Potions" */
5406 "Ìý¤Ä¤Ü", /* "Flasks" */
5407 "´¬Êª", /* "Scrolls" */
5408 "»ØÎØ", /* "Rings" */
5409 "¥¢¥ß¥å¥ì¥Ã¥È", /* "Amulets" */
5410 "ū", /* "Whistle" */
5411 "¸÷¸»", /* "Lanterns" */
5412 "ËâË¡ËÀ", /* "Wands" */
5413 "¾ó", /* "Staffs" */
5414 "¥í¥Ã¥É", /* "Rods" */
5415 "¥«¡¼¥É", /* "Cards" */
5416 "¥¥ã¥×¥Á¥ã¡¼¡¦¥Ü¡¼¥ë",
5426 "Åá·õÎà", /* "Swords" */
5427 "Æß´ï", /* "Blunt Weapons" */
5428 "ĹÊÁÉð´ï", /* "Polearms" */
5429 "ºÎ·¡Æ»¶ñ", /* "Diggers" */
5430 "Èô¤ÓÆ»¶ñ", /* "Bows" */
5434 "·ÚÁõ³»", /* "Soft Armor" */
5435 "½ÅÁõ³»", /* "Hard Armor" */
5436 "¥É¥é¥´¥ó³»", /* "Dragon Armor" */
5437 "½â", /* "Shields" */
5438 "¥¯¥í¡¼¥¯", /* "Cloaks" */
5439 "äƼê", /* "Gloves" */
5440 "¥Ø¥ë¥á¥Ã¥È", /* "Helms" */
5441 "´§", /* "Crowns" */
5442 "¥Ö¡¼¥Ä", /* "Boots" */
5495 * TVALs of items in each group
5497 static byte object_group_tval[] =
5538 TV_LIFE_BOOK, /* Hack -- all spellbooks */
5546 * Build a list of object indexes in the given group. Return the number
5547 * of objects in the group.
5549 * mode & 0x01 : check for non-empty group
5550 * mode & 0x02 : visual operation only
5552 static int collect_objects(int grp_cur, int object_idx[], byte mode)
5554 int i, j, k, object_cnt = 0;
5556 /* Get a list of x_char in this group */
5557 byte group_tval = object_group_tval[grp_cur];
5559 /* Check every object */
5560 for (i = 0; i < max_k_idx; i++)
5562 /* Access the object */
5563 object_kind *k_ptr = &k_info[i];
5565 /* Skip empty objects */
5566 if (!k_ptr->name) continue;
5570 /* Any objects will be displayed */
5576 /* Skip non-flavoured objects */
5577 if (!k_ptr->flavor) continue;
5579 /* Require objects ever seen */
5580 if (!k_ptr->aware) continue;
5583 /* Skip items with no distribution (special artifacts) */
5584 for (j = 0, k = 0; j < 4; j++) k += k_ptr->chance[j];
5588 /* Check for objects in the group */
5589 if (TV_LIFE_BOOK == group_tval)
5591 /* Hack -- All spell books */
5592 if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HISSATSU_BOOK)
5594 /* Add the object */
5595 object_idx[object_cnt++] = i;
5599 else if (k_ptr->tval == group_tval)
5601 /* Add the object */
5602 object_idx[object_cnt++] = i;
5606 /* XXX Hack -- Just checking for non-empty group */
5607 if (mode & 0x01) break;
5610 /* Terminate the list */
5611 object_idx[object_cnt] = -1;
5613 /* Return the number of objects */
5619 * Description of each feature group.
5621 static cptr feature_group_text[] =
5629 * Build a list of feature indexes in the given group. Return the number
5630 * of features in the group.
5632 * mode & 0x01 : check for non-empty group
5634 static int collect_features(int grp_cur, int *feat_idx, byte mode)
5636 int i, feat_cnt = 0;
5638 /* Unused; There is a single group. */
5641 /* Check every feature */
5642 for (i = 0; i < max_f_idx; i++)
5644 /* Access the index */
5645 feature_type *f_ptr = &f_info[i];
5647 /* Skip empty index */
5648 if (!f_ptr->name) continue;
5650 /* Skip mimiccing features */
5651 if (f_ptr->mimic != i) continue;
5654 feat_idx[feat_cnt++] = i;
5656 /* XXX Hack -- Just checking for non-empty group */
5657 if (mode & 0x01) break;
5660 /* Terminate the list */
5661 feat_idx[feat_cnt] = -1;
5663 /* Return the number of races */
5670 * Build a list of monster indexes in the given group. Return the number
5671 * of monsters in the group.
5673 static int collect_artifacts(int grp_cur, int object_idx[])
5675 int i, object_cnt = 0;
5677 /* Get a list of x_char in this group */
5678 byte group_tval = object_group_tval[grp_cur];
5680 /* Check every object */
5681 for (i = 0; i < max_a_idx; i++)
5683 /* Access the artifact */
5684 artifact_type *a_ptr = &a_info[i];
5686 /* Skip empty artifacts */
5687 if (!a_ptr->name) continue;
5689 /* Skip "uncreated" artifacts */
5690 if (!a_ptr->cur_num) continue;
5692 /* Check for race in the group */
5693 if (a_ptr->tval == group_tval)
5696 object_idx[object_cnt++] = i;
5700 /* Terminate the list */
5701 object_idx[object_cnt] = 0;
5703 /* Return the number of races */
5710 * Encode the screen colors
5712 static char hack[17] = "dwsorgbuDWvyRGBU";
5716 * Hack -- load a screen dump from a file
5718 void do_cmd_load_screen(void)
5733 Term_get_size(&wid, &hgt);
5735 /* Build the filename */
5736 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
5738 /* Append to the file */
5739 fff = my_fopen(buf, "r");
5744 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
5746 msg_format("Failed to open %s.", buf);
5753 /* Save the screen */
5756 /* Clear the screen */
5760 /* Load the screen */
5761 for (y = 0; okay; y++)
5763 /* Get a line of data including control code */
5764 if (!fgets(buf, 1024, fff)) okay = FALSE;
5766 /* Get the blank line */
5767 if (buf[0] == '\n' || buf[0] == '\0') break;
5769 /* Ignore too large screen image */
5770 if (y >= hgt) continue;
5773 for (x = 0; x < wid - 1; x++)
5776 if (buf[x] == '\n' || buf[x] == '\0') break;
5778 /* Put the attr/char */
5779 Term_draw(x, y, TERM_WHITE, buf[x]);
5783 /* Dump the screen */
5784 for (y = 0; okay; y++)
5786 /* Get a line of data including control code */
5787 if (!fgets(buf, 1024, fff)) okay = FALSE;
5789 /* Get the blank line */
5790 if (buf[0] == '\n' || buf[0] == '\0') break;
5792 /* Ignore too large screen image */
5793 if (y >= hgt) continue;
5796 for (x = 0; x < wid - 1; x++)
5799 if (buf[x] == '\n' || buf[x] == '\0') break;
5801 /* Get the attr/char */
5802 (void)(Term_what(x, y, &a, &c));
5804 /* Look up the attr */
5805 for (i = 0; i < 16; i++)
5807 /* Use attr matches */
5808 if (hack[i] == buf[x]) a = i;
5811 /* Put the attr/char */
5812 Term_draw(x, y, a, c);
5823 prt("¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤µ¤ì¤¿²èÌÌ(µÇ°»£±Æ)¤ò¥í¡¼¥É¤·¤Þ¤·¤¿¡£", 0, 0);
5825 msg_print("Screen dump loaded.");
5832 /* Restore the screen */
5839 cptr inven_res_label =
5841 " »ÀÅŲÐÎäÆǸ÷°ÇÇ˹ì¹ö°øÆÙÎô ÌÕÉÝÍðáãÆ©Ì¿´¶¾ÃÉüÉâ";
5843 " AcElFiCoPoLiDkShSoNtNxCaDi BlFeCfFaSeHlEpSdRgLv";
5848 #define IM_FLAG_STR "¡ö"
5849 #define HAS_FLAG_STR "¡Ü"
5850 #define NO_FLAG_STR "¡¦"
5852 #define IM_FLAG_STR "* "
5853 #define HAS_FLAG_STR "+ "
5854 #define NO_FLAG_STR ". "
5857 #define print_im_or_res_flag(IM, RES) \
5859 fputs(have_flag(flgs, (IM)) ? IM_FLAG_STR : \
5860 (have_flag(flgs, (RES)) ? HAS_FLAG_STR : NO_FLAG_STR), fff); \
5863 #define print_flag(TR) \
5865 fputs(have_flag(flgs, (TR)) ? HAS_FLAG_STR : NO_FLAG_STR, fff); \
5869 /* XTRA HACK RESLIST */
5870 static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, byte tval, char *where)
5872 char o_name[MAX_NLEN];
5873 u32b flgs[TR_FLAG_SIZE];
5875 if (!o_ptr->k_idx) return;
5876 if (o_ptr->tval != tval) return;
5878 /* Identified items only */
5879 if (!object_is_known(o_ptr)) return;
5882 * HACK:Ring of Lordly protection and Dragon equipment
5883 * have random resistances.
5885 if ((object_is_wearable(o_ptr) && object_is_ego(o_ptr))
5886 || ((tval == TV_AMULET) && (o_ptr->sval == SV_AMULET_RESISTANCE))
5887 || ((tval == TV_RING) && (o_ptr->sval == SV_RING_LORDLY))
5888 || ((tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD))
5889 || ((tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM))
5890 || ((tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES))
5891 || ((tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE))
5892 || object_is_artifact(o_ptr))
5895 object_desc(o_name, o_ptr, OD_NAME_ONLY);
5897 while (o_name[i] && (i < 26))
5900 if (iskanji(o_name[i])) i++;
5909 o_name[i] = ' '; i++;
5914 fprintf(fff, "%s %s", where, o_name);
5916 if (!(o_ptr->ident & (IDENT_MENTAL)))
5919 fputs("-------ÉÔÌÀ--------------- -------ÉÔÌÀ---------\n", fff);
5921 fputs("-------unknown------------ -------unknown------\n", fff);
5926 object_flags_known(o_ptr, flgs);
5928 print_im_or_res_flag(TR_IM_ACID, TR_RES_ACID);
5929 print_im_or_res_flag(TR_IM_ELEC, TR_RES_ELEC);
5930 print_im_or_res_flag(TR_IM_FIRE, TR_RES_FIRE);
5931 print_im_or_res_flag(TR_IM_COLD, TR_RES_COLD);
5932 print_flag(TR_RES_POIS);
5933 print_flag(TR_RES_LITE);
5934 print_flag(TR_RES_DARK);
5935 print_flag(TR_RES_SHARDS);
5936 print_flag(TR_RES_SOUND);
5937 print_flag(TR_RES_NETHER);
5938 print_flag(TR_RES_NEXUS);
5939 print_flag(TR_RES_CHAOS);
5940 print_flag(TR_RES_DISEN);
5944 print_flag(TR_RES_BLIND);
5945 print_flag(TR_RES_FEAR);
5946 print_flag(TR_RES_CONF);
5947 print_flag(TR_FREE_ACT);
5948 print_flag(TR_SEE_INVIS);
5949 print_flag(TR_HOLD_LIFE);
5950 print_flag(TR_TELEPATHY);
5951 print_flag(TR_SLOW_DIGEST);
5952 print_flag(TR_REGEN);
5953 print_flag(TR_LEVITATION);
5961 fprintf(fff, "%s\n", inven_res_label);
5967 * Display *ID* ed weapons/armors's resistances
5969 static void do_cmd_knowledge_inven(void)
5973 char file_name[1024];
5983 /* Open a new file */
5984 fff = my_fopen_temp(file_name, 1024);
5988 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
5990 msg_format("Failed to create temporary file %s.", file_name);
5995 fprintf(fff, "%s\n", inven_res_label);
5997 for (tval = TV_WEARABLE_BEGIN; tval <= TV_WEARABLE_END; tval++)
6001 for (; j < 9; j++) fputc('\n', fff);
6003 fprintf(fff, "%s\n", inven_res_label);
6007 strcpy(where, "Áõ");
6009 strcpy(where, "E ");
6011 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
6013 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
6017 strcpy(where, "»ý");
6019 strcpy(where, "I ");
6021 for (i = 0; i < INVEN_PACK; i++)
6023 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
6026 st_ptr = &town[1].store[STORE_HOME];
6028 strcpy(where, "²È");
6030 strcpy(where, "H ");
6033 for (i = 0; i < st_ptr->stock_num; i++)
6035 do_cmd_knowledge_inven_aux(fff, &st_ptr->stock[i], &j, tval, where);
6039 /* Close the file */
6042 /* Display the file contents */
6044 show_file(TRUE, file_name, "*´ÕÄê*ºÑ¤ßÉð´ï/Ëɶñ¤ÎÂÑÀ¥ê¥¹¥È", 0, 0);
6046 show_file(TRUE, file_name, "Resistances of *identified* equipment", 0, 0);
6049 /* Remove the file */
6054 void do_cmd_save_screen_html_aux(char *filename, int message)
6058 byte a = 0, old_a = 0;
6072 cptr html_head[] = {
6073 "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
6077 cptr html_foot[] = {
6079 "</body>\n</html>\n",
6085 Term_get_size(&wid, &hgt);
6087 /* File type is "TEXT" */
6088 FILE_TYPE(FILE_TYPE_TEXT);
6090 /* Append to the file */
6091 fff = my_fopen(filename, "w");
6097 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", filename);
6099 msg_format("Failed to open file %s.", filename);
6107 /* Save the screen */
6111 /* Build the filename */
6112 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
6113 tmpfff = my_fopen(buf, "r");
6115 for (i = 0; html_head[i]; i++)
6116 fprintf(fff, html_head[i]);
6120 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
6122 if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
6126 if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
6128 fprintf(fff, "%s\n", buf);
6133 /* Dump the screen */
6134 for (y = 0; y < hgt; y++)
6141 for (x = 0; x < wid - 1; x++)
6145 /* Get the attr/char */
6146 (void)(Term_what(x, y, &a, &c));
6150 case '&': cc = "&"; break;
6151 case '<': cc = "<"; break;
6152 case '>': cc = ">"; break;
6154 case 0x1f: c = '.'; break;
6155 case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
6160 if ((y == 0 && x == 0) || a != old_a) {
6161 rv = angband_color_table[a][1];
6162 gv = angband_color_table[a][2];
6163 bv = angband_color_table[a][3];
6164 fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
6165 ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
6169 fprintf(fff, "%s", cc);
6171 fprintf(fff, "%c", c);
6174 fprintf(fff, "</font>");
6177 for (i = 0; html_foot[i]; i++)
6178 fprintf(fff, html_foot[i]);
6183 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
6185 if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
6189 if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
6191 fprintf(fff, "%s\n", buf);
6206 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6208 msg_print("Screen dump saved.");
6213 /* Restore the screen */
6219 * Hack -- save a screen dump to a file
6221 static void do_cmd_save_screen_html(void)
6223 char buf[1024], tmp[256] = "screen.html";
6226 if (!get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
6228 if (!get_string("File name: ", tmp, 80))
6232 /* Build the filename */
6233 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
6237 do_cmd_save_screen_html_aux(buf, 1);
6242 * Redefinable "save_screen" action
6244 void (*screendump_aux)(void) = NULL;
6248 * Hack -- save a screen dump to a file
6250 void do_cmd_save_screen(void)
6252 bool old_use_graphics = use_graphics;
6253 bool html_dump = FALSE;
6258 prt("µÇ°»£±Æ¤·¤Þ¤¹¤«¡© [(y)es/(h)tml/(n)o] ", 0, 0);
6260 prt("Save screen dump? [(y)es/(h)tml/(n)o] ", 0, 0);
6265 if (c == 'Y' || c == 'y')
6267 else if (c == 'H' || c == 'h')
6279 Term_get_size(&wid, &hgt);
6281 if (old_use_graphics)
6283 use_graphics = FALSE;
6286 /* Redraw everything */
6287 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6289 /* Hack -- update */
6295 do_cmd_save_screen_html();
6299 /* Do we use a special screendump function ? */
6300 else if (screendump_aux)
6302 /* Dump the screen to a graphics file */
6303 (*screendump_aux)();
6305 else /* Dump the screen as text */
6316 /* Build the filename */
6317 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
6319 /* File type is "TEXT" */
6320 FILE_TYPE(FILE_TYPE_TEXT);
6322 /* Append to the file */
6323 fff = my_fopen(buf, "w");
6329 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
6331 msg_format("Failed to open file %s.", buf);
6338 /* Save the screen */
6342 /* Dump the screen */
6343 for (y = 0; y < hgt; y++)
6346 for (x = 0; x < wid - 1; x++)
6348 /* Get the attr/char */
6349 (void)(Term_what(x, y, &a, &c));
6359 fprintf(fff, "%s\n", buf);
6366 /* Dump the screen */
6367 for (y = 0; y < hgt; y++)
6370 for (x = 0; x < wid - 1; x++)
6372 /* Get the attr/char */
6373 (void)(Term_what(x, y, &a, &c));
6376 buf[x] = hack[a&0x0F];
6383 fprintf(fff, "%s\n", buf);
6395 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6397 msg_print("Screen dump saved.");
6403 /* Restore the screen */
6407 if (old_use_graphics)
6409 use_graphics = TRUE;
6412 /* Redraw everything */
6413 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6415 /* Hack -- update */
6422 * Sorting hook -- Comp function -- see below
6424 * We use "u" to point to array of monster indexes,
6425 * and "v" to select the type of sorting to perform on "u".
6427 static bool ang_sort_art_comp(vptr u, vptr v, int a, int b)
6429 u16b *who = (u16b*)(u);
6431 u16b *why = (u16b*)(v);
6438 /* Sort by total kills */
6441 /* Extract total kills */
6442 z1 = a_info[w1].tval;
6443 z2 = a_info[w2].tval;
6445 /* Compare total kills */
6446 if (z1 < z2) return (TRUE);
6447 if (z1 > z2) return (FALSE);
6451 /* Sort by monster level */
6454 /* Extract levels */
6455 z1 = a_info[w1].sval;
6456 z2 = a_info[w2].sval;
6458 /* Compare levels */
6459 if (z1 < z2) return (TRUE);
6460 if (z1 > z2) return (FALSE);
6464 /* Sort by monster experience */
6467 /* Extract experience */
6468 z1 = a_info[w1].level;
6469 z2 = a_info[w2].level;
6471 /* Compare experience */
6472 if (z1 < z2) return (TRUE);
6473 if (z1 > z2) return (FALSE);
6477 /* Compare indexes */
6483 * Sorting hook -- Swap function -- see below
6485 * We use "u" to point to array of monster indexes,
6486 * and "v" to select the type of sorting to perform.
6488 static void ang_sort_art_swap(vptr u, vptr v, int a, int b)
6490 u16b *who = (u16b*)(u);
6505 * Check the status of "artifacts"
6507 static void do_cmd_knowledge_artifacts(void)
6509 int i, k, z, x, y, n = 0;
6515 char file_name[1024];
6517 char base_name[MAX_NLEN];
6521 /* Open a new file */
6522 fff = my_fopen_temp(file_name, 1024);
6526 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6528 msg_format("Failed to create temporary file %s.", file_name);
6534 /* Allocate the "who" array */
6535 C_MAKE(who, max_a_idx, s16b);
6537 /* Allocate the "okay" array */
6538 C_MAKE(okay, max_a_idx, bool);
6540 /* Scan the artifacts */
6541 for (k = 0; k < max_a_idx; k++)
6543 artifact_type *a_ptr = &a_info[k];
6548 /* Skip "empty" artifacts */
6549 if (!a_ptr->name) continue;
6551 /* Skip "uncreated" artifacts */
6552 if (!a_ptr->cur_num) continue;
6558 /* Check the dungeon */
6559 for (y = 0; y < cur_hgt; y++)
6561 for (x = 0; x < cur_wid; x++)
6563 cave_type *c_ptr = &cave[y][x];
6565 s16b this_o_idx, next_o_idx = 0;
6567 /* Scan all objects in the grid */
6568 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
6572 /* Acquire object */
6573 o_ptr = &o_list[this_o_idx];
6575 /* Acquire next object */
6576 next_o_idx = o_ptr->next_o_idx;
6578 /* Ignore non-artifacts */
6579 if (!object_is_fixed_artifact(o_ptr)) continue;
6581 /* Ignore known items */
6582 if (object_is_known(o_ptr)) continue;
6584 /* Note the artifact */
6585 okay[o_ptr->name1] = FALSE;
6590 /* Check the inventory and equipment */
6591 for (i = 0; i < INVEN_TOTAL; i++)
6593 object_type *o_ptr = &inventory[i];
6595 /* Ignore non-objects */
6596 if (!o_ptr->k_idx) continue;
6598 /* Ignore non-artifacts */
6599 if (!object_is_fixed_artifact(o_ptr)) continue;
6601 /* Ignore known items */
6602 if (object_is_known(o_ptr)) continue;
6604 /* Note the artifact */
6605 okay[o_ptr->name1] = FALSE;
6608 for (k = 0; k < max_a_idx; k++)
6610 if (okay[k]) who[n++] = k;
6613 /* Select the sort method */
6614 ang_sort_comp = ang_sort_art_comp;
6615 ang_sort_swap = ang_sort_art_swap;
6617 /* Sort the array by dungeon depth of monsters */
6618 ang_sort(who, &why, n);
6620 /* Scan the artifacts */
6621 for (k = 0; k < n; k++)
6623 artifact_type *a_ptr = &a_info[who[k]];
6627 strcpy(base_name, "̤ÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à");
6629 strcpy(base_name, "Unknown Artifact");
6633 /* Obtain the base object type */
6634 z = lookup_kind(a_ptr->tval, a_ptr->sval);
6642 /* Get local object */
6645 /* Create fake object */
6646 object_prep(q_ptr, z);
6648 /* Make it an artifact */
6649 q_ptr->name1 = (byte)who[k];
6651 /* Display as if known */
6652 q_ptr->ident |= IDENT_STORE;
6654 /* Describe the artifact */
6655 object_desc(base_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
6658 /* Hack -- Build the artifact name */
6660 fprintf(fff, " %s\n", base_name);
6662 fprintf(fff, " The %s\n", base_name);
6667 /* Free the "who" array */
6668 C_KILL(who, max_a_idx, s16b);
6670 /* Free the "okay" array */
6671 C_KILL(okay, max_a_idx, bool);
6673 /* Close the file */
6676 /* Display the file contents */
6678 show_file(TRUE, file_name, "´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à", 0, 0);
6680 show_file(TRUE, file_name, "Artifacts Seen", 0, 0);
6684 /* Remove the file */
6690 * Display known uniques
6691 * With "XTRA HACK UNIQHIST" (Originally from XAngband)
6693 static void do_cmd_knowledge_uniques(void)
6701 char file_name[1024];
6704 int n_alive_surface = 0;
6705 int n_alive_over100 = 0;
6706 int n_alive_total = 0;
6709 for (i = 0; i < 10; i++) n_alive[i] = 0;
6711 /* Open a new file */
6712 fff = my_fopen_temp(file_name, 1024);
6717 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6719 msg_format("Failed to create temporary file %s.", file_name);
6725 /* Allocate the "who" array */
6726 C_MAKE(who, max_r_idx, s16b);
6728 /* Scan the monsters */
6729 for (i = 1; i < max_r_idx; i++)
6731 monster_race *r_ptr = &r_info[i];
6734 if (!r_ptr->name) continue;
6736 /* Require unique monsters */
6737 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6739 /* Only display "known" uniques */
6740 if (!cheat_know && !r_ptr->r_sights) continue;
6742 /* Only print rarity <= 100 uniques */
6743 if (!r_ptr->rarity || ((r_ptr->rarity > 100) && !(r_ptr->flags1 & RF1_QUESTOR))) continue;
6745 /* Only "alive" uniques */
6746 if (r_ptr->max_num == 0) continue;
6750 lev = (r_ptr->level - 1) / 10;
6754 if (max_lev < lev) max_lev = lev;
6756 else n_alive_over100++;
6758 else n_alive_surface++;
6760 /* Collect "appropriate" monsters */
6764 /* Select the sort method */
6765 ang_sort_comp = ang_sort_comp_hook;
6766 ang_sort_swap = ang_sort_swap_hook;
6768 /* Sort the array by dungeon depth of monsters */
6769 ang_sort(who, &why, n);
6771 if (n_alive_surface)
6774 fprintf(fff, " ÃϾå À¸Â¸: %3dÂÎ\n", n_alive_surface);
6776 fprintf(fff, " Surface alive: %3d\n", n_alive_surface);
6778 n_alive_total += n_alive_surface;
6780 for (i = 0; i <= max_lev; i++)
6783 fprintf(fff, "%3d-%3d³¬ À¸Â¸: %3dÂÎ\n", 1 + i * 10, 10 + i * 10, n_alive[i]);
6785 fprintf(fff, "Level %3d-%3d alive: %3d\n", 1 + i * 10, 10 + i * 10, n_alive[i]);
6787 n_alive_total += n_alive[i];
6789 if (n_alive_over100)
6792 fprintf(fff, "101- ³¬ À¸Â¸: %3dÂÎ\n", n_alive_over100);
6794 fprintf(fff, "Level 101- alive: %3d\n", n_alive_over100);
6796 n_alive_total += n_alive_over100;
6802 fputs("--------- -----------\n", fff);
6803 fprintf(fff, " ¹ç·× À¸Â¸: %3dÂÎ\n\n", n_alive_total);
6805 fputs("------------- ----------\n", fff);
6806 fprintf(fff, " Total alive: %3d\n\n", n_alive_total);
6812 fputs("¸½ºß¤Ï´ûÃΤÎÀ¸Â¸¥æ¥Ë¡¼¥¯¤Ï¤¤¤Þ¤»¤ó¡£\n", fff);
6814 fputs("No known uniques alive.\n", fff);
6818 /* Scan the monster races */
6819 for (k = 0; k < n; k++)
6821 monster_race *r_ptr = &r_info[who[k]];
6823 /* Print a message */
6825 fprintf(fff, " %s (¥ì¥Ù¥ë%d)\n", r_name + r_ptr->name, r_ptr->level);
6827 fprintf(fff, " %s (level %d)\n", r_name + r_ptr->name, r_ptr->level);
6831 /* Free the "who" array */
6832 C_KILL(who, max_r_idx, s16b);
6834 /* Close the file */
6837 /* Display the file contents */
6839 show_file(TRUE, file_name, "¤Þ¤ÀÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼", 0, 0);
6841 show_file(TRUE, file_name, "Alive Uniques", 0, 0);
6845 /* Remove the file */
6851 * Display weapon-exp
6853 static void do_cmd_knowledge_weapon_exp(void)
6855 int i, j, num, weapon_exp;
6859 char file_name[1024];
6862 /* Open a new file */
6863 fff = my_fopen_temp(file_name, 1024);
6866 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6868 msg_format("Failed to create temporary file %s.", file_name);
6874 for (i = 0; i < 5; i++)
6876 for (num = 0; num < 64; num++)
6878 for (j = 0; j < max_k_idx; j++)
6880 object_kind *k_ptr = &k_info[j];
6882 if ((k_ptr->tval == TV_SWORD - i) && (k_ptr->sval == num))
6884 if ((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON)) continue;
6886 weapon_exp = p_ptr->weapon_exp[4 - i][num];
6888 fprintf(fff, "%-25s ", tmp);
6889 if (weapon_exp >= s_info[p_ptr->pclass].w_max[4 - i][num]) fprintf(fff, "!");
6890 else fprintf(fff, " ");
6891 fprintf(fff, "%s", exp_level_str[weapon_exp_level(weapon_exp)]);
6892 if (cheat_xtra) fprintf(fff, " %d", weapon_exp);
6900 /* Close the file */
6903 /* Display the file contents */
6905 show_file(TRUE, file_name, "Éð´ï¤Î·Ð¸³ÃÍ", 0, 0);
6907 show_file(TRUE, file_name, "Weapon Proficiency", 0, 0);
6911 /* Remove the file */
6919 static void do_cmd_knowledge_spell_exp(void)
6921 int i = 0, spell_exp, exp_level;
6926 char file_name[1024];
6928 /* Open a new file */
6929 fff = my_fopen_temp(file_name, 1024);
6932 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6934 msg_format("Failed to create temporary file %s.", file_name);
6940 if (p_ptr->realm1 != REALM_NONE)
6943 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm1]);
6945 fprintf(fff, "%s Spellbook\n", realm_names[p_ptr->realm1]);
6947 for (i = 0; i < 32; i++)
6949 if (!is_magic(p_ptr->realm1))
6951 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][i];
6955 s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][i];
6957 if (s_ptr->slevel >= 99) continue;
6958 spell_exp = p_ptr->spell_exp[i];
6959 exp_level = spell_exp_level(spell_exp);
6960 fprintf(fff, "%-25s ", do_spell(p_ptr->realm1, i, SPELL_NAME));
6961 if (p_ptr->realm1 == REALM_HISSATSU)
6962 fprintf(fff, "[--]");
6965 if (exp_level >= EXP_LEVEL_MASTER) fprintf(fff, "!");
6966 else fprintf(fff, " ");
6967 fprintf(fff, "%s", exp_level_str[exp_level]);
6969 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6974 if (p_ptr->realm2 != REALM_NONE)
6977 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm2]);
6979 fprintf(fff, "\n%s Spellbook\n", realm_names[p_ptr->realm2]);
6981 for (i = 0; i < 32; i++)
6983 if (!is_magic(p_ptr->realm1))
6985 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][i];
6989 s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][i];
6991 if (s_ptr->slevel >= 99) continue;
6993 spell_exp = p_ptr->spell_exp[i + 32];
6994 exp_level = spell_exp_level(spell_exp);
6995 fprintf(fff, "%-25s ", do_spell(p_ptr->realm2, i, SPELL_NAME));
6996 if (exp_level >= EXP_LEVEL_EXPERT) fprintf(fff, "!");
6997 else fprintf(fff, " ");
6998 fprintf(fff, "%s", exp_level_str[exp_level]);
6999 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
7004 /* Close the file */
7007 /* Display the file contents */
7009 show_file(TRUE, file_name, "ËâË¡¤Î·Ð¸³ÃÍ", 0, 0);
7011 show_file(TRUE, file_name, "Spell Proficiency", 0, 0);
7015 /* Remove the file */
7023 static void do_cmd_knowledge_skill_exp(void)
7025 int i = 0, skill_exp;
7029 char file_name[1024];
7031 char skill_name[3][17]={"¥Þ¡¼¥·¥ã¥ë¥¢¡¼¥Ä", "ÆóÅáή ", "¾èÇÏ "};
7033 char skill_name[3][20]={"Martial Arts ", "Dual Wielding ", "Riding "};
7036 /* Open a new file */
7037 fff = my_fopen_temp(file_name, 1024);
7040 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7042 msg_format("Failed to create temporary file %s.", file_name);
7048 for (i = 0; i < 3; i++)
7050 skill_exp = p_ptr->skill_exp[i];
7051 fprintf(fff, "%-20s ", skill_name[i]);
7052 if (skill_exp >= s_info[p_ptr->pclass].s_max[i]) fprintf(fff, "!");
7053 else fprintf(fff, " ");
7054 fprintf(fff, "%s", exp_level_str[(i == GINOU_RIDING) ? riding_exp_level(skill_exp) : weapon_exp_level(skill_exp)]);
7055 if (cheat_xtra) fprintf(fff, " %d", skill_exp);
7059 /* Close the file */
7062 /* Display the file contents */
7064 show_file(TRUE, file_name, "µ»Ç½¤Î·Ð¸³ÃÍ", 0, 0);
7066 show_file(TRUE, file_name, "Miscellaneous Proficiency", 0, 0);
7070 /* Remove the file */
7076 * Pluralize a monster name
7078 void plural_aux(char *Name)
7080 int NameLen = strlen(Name);
7082 if (my_strstr(Name, "Disembodied hand"))
7084 strcpy(Name, "Disembodied hands that strangled people");
7086 else if (my_strstr(Name, "Colour out of space"))
7088 strcpy(Name, "Colours out of space");
7090 else if (my_strstr(Name, "stairway to hell"))
7092 strcpy(Name, "stairways to hell");
7094 else if (my_strstr(Name, "Dweller on the threshold"))
7096 strcpy(Name, "Dwellers on the threshold");
7098 else if (my_strstr(Name, " of "))
7100 cptr aider = my_strstr(Name, " of ");
7111 if (dummy[i-1] == 's')
7113 strcpy(&(dummy[i]), "es");
7118 strcpy(&(dummy[i]), "s");
7121 strcpy(&(dummy[i+1]), aider);
7122 strcpy(Name, dummy);
7124 else if (my_strstr(Name, "coins"))
7127 strcpy(dummy, "piles of ");
7128 strcat(dummy, Name);
7129 strcpy(Name, dummy);
7132 else if (my_strstr(Name, "Manes"))
7136 else if (streq(&(Name[NameLen - 2]), "ey"))
7138 strcpy(&(Name[NameLen - 2]), "eys");
7140 else if (Name[NameLen - 1] == 'y')
7142 strcpy(&(Name[NameLen - 1]), "ies");
7144 else if (streq(&(Name[NameLen - 4]), "ouse"))
7146 strcpy(&(Name[NameLen - 4]), "ice");
7148 else if (streq(&(Name[NameLen - 2]), "us"))
7150 strcpy(&(Name[NameLen - 2]), "i");
7152 else if (streq(&(Name[NameLen - 6]), "kelman"))
7154 strcpy(&(Name[NameLen - 6]), "kelmen");
7156 else if (streq(&(Name[NameLen - 8]), "wordsman"))
7158 strcpy(&(Name[NameLen - 8]), "wordsmen");
7160 else if (streq(&(Name[NameLen - 7]), "oodsman"))
7162 strcpy(&(Name[NameLen - 7]), "oodsmen");
7164 else if (streq(&(Name[NameLen - 7]), "eastman"))
7166 strcpy(&(Name[NameLen - 7]), "eastmen");
7168 else if (streq(&(Name[NameLen - 8]), "izardman"))
7170 strcpy(&(Name[NameLen - 8]), "izardmen");
7172 else if (streq(&(Name[NameLen - 5]), "geist"))
7174 strcpy(&(Name[NameLen - 5]), "geister");
7176 else if (streq(&(Name[NameLen - 2]), "ex"))
7178 strcpy(&(Name[NameLen - 2]), "ices");
7180 else if (streq(&(Name[NameLen - 2]), "lf"))
7182 strcpy(&(Name[NameLen - 2]), "lves");
7184 else if (suffix(Name, "ch") ||
7185 suffix(Name, "sh") ||
7186 suffix(Name, "nx") ||
7187 suffix(Name, "s") ||
7190 strcpy(&(Name[NameLen]), "es");
7194 strcpy(&(Name[NameLen]), "s");
7199 * Display current pets
7201 static void do_cmd_knowledge_pets(void)
7205 monster_type *m_ptr;
7208 int show_upkeep = 0;
7209 char file_name[1024];
7212 /* Open a new file */
7213 fff = my_fopen_temp(file_name, 1024);
7216 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7218 msg_format("Failed to create temporary file %s.", file_name);
7224 /* Process the monsters (backwards) */
7225 for (i = m_max - 1; i >= 1; i--)
7227 /* Access the monster */
7230 /* Ignore "dead" monsters */
7231 if (!m_ptr->r_idx) continue;
7233 /* Calculate "upkeep" for pets */
7237 monster_desc(pet_name, m_ptr, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
7238 fprintf(fff, "%s (%s)\n", pet_name, look_mon_desc(m_ptr, 0x00));
7242 show_upkeep = calculate_upkeep();
7244 fprintf(fff, "----------------------------------------------\n");
7246 fprintf(fff, " ¹ç·×: %d ÂΤΥڥåÈ\n", t_friends);
7247 fprintf(fff, " °Ý»ý¥³¥¹¥È: %d%% MP\n", show_upkeep);
7249 fprintf(fff, " Total: %d pet%s.\n",
7250 t_friends, (t_friends == 1 ? "" : "s"));
7251 fprintf(fff, " Upkeep: %d%% mana.\n", show_upkeep);
7256 /* Close the file */
7259 /* Display the file contents */
7261 show_file(TRUE, file_name, "¸½ºß¤Î¥Ú¥Ã¥È", 0, 0);
7263 show_file(TRUE, file_name, "Current Pets", 0, 0);
7267 /* Remove the file */
7275 * Note that the player ghosts are ignored. XXX XXX XXX
7277 static void do_cmd_knowledge_kill_count(void)
7285 char file_name[1024];
7290 /* Open a new file */
7291 fff = my_fopen_temp(file_name, 1024);
7295 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7297 msg_format("Failed to create temporary file %s.", file_name);
7303 /* Allocate the "who" array */
7304 C_MAKE(who, max_r_idx, s16b);
7307 /* Monsters slain */
7310 for (kk = 1; kk < max_r_idx; kk++)
7312 monster_race *r_ptr = &r_info[kk];
7314 if (r_ptr->flags1 & (RF1_UNIQUE))
7316 bool dead = (r_ptr->max_num == 0);
7325 s16b This = r_ptr->r_pkills;
7336 fprintf(fff,"¤¢¤Ê¤¿¤Ï¤Þ¤ÀŨ¤òÅݤ·¤Æ¤¤¤Ê¤¤¡£\n\n");
7338 fprintf(fff,"You have defeated no enemies yet.\n\n");
7342 fprintf(fff,"¤¢¤Ê¤¿¤Ï%ldÂΤÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n", Total);
7344 fprintf(fff,"You have defeated %ld %s.\n\n", Total, (Total == 1) ? "enemy" : "enemies");
7350 /* Scan the monsters */
7351 for (i = 1; i < max_r_idx; i++)
7353 monster_race *r_ptr = &r_info[i];
7355 /* Use that monster */
7356 if (r_ptr->name) who[n++] = i;
7359 /* Select the sort method */
7360 ang_sort_comp = ang_sort_comp_hook;
7361 ang_sort_swap = ang_sort_swap_hook;
7363 /* Sort the array by dungeon depth of monsters */
7364 ang_sort(who, &why, n);
7366 /* Scan the monster races */
7367 for (k = 0; k < n; k++)
7369 monster_race *r_ptr = &r_info[who[k]];
7371 if (r_ptr->flags1 & (RF1_UNIQUE))
7373 bool dead = (r_ptr->max_num == 0);
7377 /* Print a message */
7378 fprintf(fff, " %s\n",
7379 (r_name + r_ptr->name));
7385 s16b This = r_ptr->r_pkills;
7390 /* p,t¤Ï¿Í¤È¿ô¤¨¤ë by ita */
7391 if (my_strchr("pt", r_ptr->d_char))
7392 fprintf(fff, " %3d ¿Í¤Î %s\n", This, r_name + r_ptr->name);
7394 fprintf(fff, " %3d ÂΤΠ%s\n", This, r_name + r_ptr->name);
7398 if (my_strstr(r_name + r_ptr->name, "coins"))
7400 fprintf(fff, " 1 pile of %s\n", (r_name + r_ptr->name));
7404 fprintf(fff, " 1 %s\n", (r_name + r_ptr->name));
7410 strcpy(ToPlural, (r_name + r_ptr->name));
7411 plural_aux(ToPlural);
7412 fprintf(fff, " %d %s\n", This, ToPlural);
7422 fprintf(fff,"----------------------------------------------\n");
7424 fprintf(fff," ¹ç·×: %lu ÂΤòÅݤ·¤¿¡£\n", Total);
7426 fprintf(fff," Total: %lu creature%s killed.\n",
7427 Total, (Total == 1 ? "" : "s"));
7431 /* Free the "who" array */
7432 C_KILL(who, max_r_idx, s16b);
7434 /* Close the file */
7437 /* Display the file contents */
7439 show_file(TRUE, file_name, "Åݤ·¤¿Å¨¤Î¿ô", 0, 0);
7441 show_file(TRUE, file_name, "Kill Count", 0, 0);
7445 /* Remove the file */
7451 * Display the object groups.
7453 static void display_group_list(int col, int row, int wid, int per_page,
7454 int grp_idx[], cptr group_text[], int grp_cur, int grp_top)
7458 /* Display lines until done */
7459 for (i = 0; i < per_page && (grp_idx[i] >= 0); i++)
7461 /* Get the group index */
7462 int grp = grp_idx[grp_top + i];
7464 /* Choose a color */
7465 byte attr = (grp_top + i == grp_cur) ? TERM_L_BLUE : TERM_WHITE;
7467 /* Erase the entire line */
7468 Term_erase(col, row + i, wid);
7470 /* Display the group label */
7471 c_put_str(attr, group_text[grp], row + i, col);
7477 * Move the cursor in a browser window
7479 static void browser_cursor(char ch, int *column, int *grp_cur, int grp_cnt,
7480 int *list_cur, int list_cnt)
7485 int list = *list_cur;
7487 /* Extract direction */
7490 /* Hack -- scroll up full screen */
7495 /* Hack -- scroll down full screen */
7500 d = get_keymap_dir(ch);
7505 /* Diagonals - hack */
7506 if ((ddx[d] > 0) && ddy[d])
7512 Term_get_size(&wid, &hgt);
7514 browser_rows = hgt - 8;
7516 /* Browse group list */
7521 /* Move up or down */
7522 grp += ddy[d] * (browser_rows - 1);
7525 if (grp >= grp_cnt) grp = grp_cnt - 1;
7526 if (grp < 0) grp = 0;
7527 if (grp != old_grp) list = 0;
7530 /* Browse sub-list list */
7533 /* Move up or down */
7534 list += ddy[d] * browser_rows;
7537 if (list >= list_cnt) list = list_cnt - 1;
7538 if (list < 0) list = 0;
7550 if (col < 0) col = 0;
7551 if (col > 1) col = 1;
7558 /* Browse group list */
7563 /* Move up or down */
7567 if (grp >= grp_cnt) grp = grp_cnt - 1;
7568 if (grp < 0) grp = 0;
7569 if (grp != old_grp) list = 0;
7572 /* Browse sub-list list */
7575 /* Move up or down */
7579 if (list >= list_cnt) list = list_cnt - 1;
7580 if (list < 0) list = 0;
7591 static void display_visual_list(int col, int row, int height, int width, byte attr_top, byte char_left)
7595 /* Clear the display lines */
7596 for (i = 0; i < height; i++)
7598 Term_erase(col, row + i, width);
7601 /* Bigtile mode uses double width */
7602 if (use_bigtile) width /= 2;
7604 /* Display lines until done */
7605 for (i = 0; i < height; i++)
7607 /* Display columns until done */
7608 for (j = 0; j < width; j++)
7616 /* Bigtile mode uses double width */
7617 if (use_bigtile) x += j;
7622 /* Ignore illegal characters */
7623 if (ia > 0x7f || ic > 0xff || ic < ' ' ||
7624 (!use_graphics && ic > 0x7f))
7630 /* Force correct code for both ASCII character and tile */
7631 if (c & 0x80) a |= 0x80;
7633 /* Display symbol */
7634 Term_queue_bigchar(x, y, a, c, 0, 0);
7641 * Place the cursor at the collect position for visual mode
7643 static void place_visual_list_cursor(int col, int row, byte a, byte c, byte attr_top, byte char_left)
7645 int i = (a & 0x7f) - attr_top;
7646 int j = c - char_left;
7651 /* Bigtile mode uses double width */
7652 if (use_bigtile) x += j;
7654 /* Place the cursor */
7660 * Clipboard variables for copy&paste in visual mode
7662 static byte attr_idx = 0;
7663 static byte char_idx = 0;
7665 /* Hack -- for feature lighting */
7666 static byte attr_idx_feat[F_LIT_MAX];
7667 static byte char_idx_feat[F_LIT_MAX];
7670 * Do visual mode command -- Change symbols
7672 static bool visual_mode_command(char ch, bool *visual_list_ptr,
7673 int height, int width,
7674 byte *attr_top_ptr, byte *char_left_ptr,
7675 byte *cur_attr_ptr, byte *cur_char_ptr, bool *need_redraw)
7677 static byte attr_old = 0, char_old = 0;
7682 if (*visual_list_ptr)
7685 *cur_attr_ptr = attr_old;
7686 *cur_char_ptr = char_old;
7687 *visual_list_ptr = FALSE;
7695 if (*visual_list_ptr)
7698 *visual_list_ptr = FALSE;
7699 *need_redraw = TRUE;
7707 if (!*visual_list_ptr)
7709 *visual_list_ptr = TRUE;
7711 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7712 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7714 attr_old = *cur_attr_ptr;
7715 char_old = *cur_char_ptr;
7726 /* Set the visual */
7727 attr_idx = *cur_attr_ptr;
7728 char_idx = *cur_char_ptr;
7730 /* Hack -- for feature lighting */
7731 for (i = 0; i < F_LIT_MAX; i++)
7733 attr_idx_feat[i] = 0;
7734 char_idx_feat[i] = 0;
7741 if (attr_idx || (!(char_idx & 0x80) && char_idx)) /* Allow TERM_DARK text */
7744 *cur_attr_ptr = attr_idx;
7745 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7746 if (!*visual_list_ptr) *need_redraw = TRUE;
7752 *cur_char_ptr = char_idx;
7753 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7754 if (!*visual_list_ptr) *need_redraw = TRUE;
7760 if (*visual_list_ptr)
7763 int d = get_keymap_dir(ch);
7764 byte a = (*cur_attr_ptr & 0x7f);
7765 byte c = *cur_char_ptr;
7767 if (use_bigtile) eff_width = width / 2;
7768 else eff_width = width;
7770 /* Restrict direction */
7771 if ((a == 0) && (ddy[d] < 0)) d = 0;
7772 if ((c == 0) && (ddx[d] < 0)) d = 0;
7773 if ((a == 0x7f) && (ddy[d] > 0)) d = 0;
7774 if ((c == 0xff) && (ddx[d] > 0)) d = 0;
7779 /* Force correct code for both ASCII character and tile */
7780 if (c & 0x80) a |= 0x80;
7782 /* Set the visual */
7787 /* Move the frame */
7788 if ((ddx[d] < 0) && *char_left_ptr > MAX(0, (int)c - 10)) (*char_left_ptr)--;
7789 if ((ddx[d] > 0) && *char_left_ptr + eff_width < MIN(0xff, (int)c + 10)) (*char_left_ptr)++;
7790 if ((ddy[d] < 0) && *attr_top_ptr > MAX(0, (int)(a & 0x7f) - 4)) (*attr_top_ptr)--;
7791 if ((ddy[d] > 0) && *attr_top_ptr + height < MIN(0x7f, (a & 0x7f) + 4)) (*attr_top_ptr)++;
7797 /* Visual mode command is not used */
7803 * Display the monsters in a group.
7805 static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
7806 int mon_cur, int mon_top, bool visual_only)
7810 /* Display lines until done */
7811 for (i = 0; i < per_page && (mon_idx[mon_top + i] >= 0); i++)
7815 /* Get the race index */
7816 int r_idx = mon_idx[mon_top + i] ;
7818 /* Access the race */
7819 monster_race *r_ptr = &r_info[r_idx];
7821 /* Choose a color */
7822 attr = ((i + mon_top == mon_cur) ? TERM_L_BLUE : TERM_WHITE);
7824 /* Display the name */
7825 c_prt(attr, (r_name + r_ptr->name), row + i, col);
7827 /* Hack -- visual_list mode */
7830 c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, (p_ptr->wizard || visual_only) ? 56 : 61);
7832 if (p_ptr->wizard || visual_only)
7834 c_prt(attr, format("%d", r_idx), row + i, 62);
7837 /* Erase chars before overwritten by the race letter */
7838 Term_erase(69, row + i, 255);
7840 /* Display symbol */
7841 Term_queue_bigchar(use_bigtile ? 69 : 70, row + i, r_ptr->x_attr, r_ptr->x_char, 0, 0);
7846 if (!(r_ptr->flags1 & RF1_UNIQUE)) put_str(format("%5d", r_ptr->r_pkills), row + i, 73);
7848 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? "»àË´" : "À¸Â¸"), row + i, 74);
7850 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? " dead" : "alive"), row + i, 73);
7855 /* Clear remaining lines */
7856 for (; i < per_page; i++)
7858 Term_erase(col, row + i, 255);
7864 * Display known monsters.
7866 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, int direct_r_idx)
7869 int grp_cur, grp_top, old_grp_cur;
7870 int mon_cur, mon_top;
7871 int grp_cnt, grp_idx[100];
7879 bool visual_list = FALSE;
7880 byte attr_top = 0, char_left = 0;
7888 Term_get_size(&wid, &hgt);
7890 browser_rows = hgt - 8;
7892 /* Allocate the "mon_idx" array */
7893 C_MAKE(mon_idx, max_r_idx, s16b);
7898 if (direct_r_idx < 0)
7900 mode = visual_only ? 0x03 : 0x01;
7902 /* Check every group */
7903 for (i = 0; monster_group_text[i] != NULL; i++)
7905 /* Measure the label */
7906 len = strlen(monster_group_text[i]);
7908 /* Save the maximum length */
7909 if (len > max) max = len;
7911 /* See if any monsters are known */
7912 if ((monster_group_char[i] == ((char *) -1L)) || collect_monsters(i, mon_idx, mode))
7914 /* Build a list of groups with known monsters */
7915 grp_idx[grp_cnt++] = i;
7923 mon_idx[0] = direct_r_idx;
7926 /* Terminate the list */
7929 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
7930 &attr_top, &char_left, &r_info[direct_r_idx].x_attr, &r_info[direct_r_idx].x_char, need_redraw);
7933 /* Terminate the list */
7934 grp_idx[grp_cnt] = -1;
7937 grp_cur = grp_top = 0;
7938 mon_cur = mon_top = 0;
7943 mode = visual_only ? 0x02 : 0x00;
7948 monster_race *r_ptr;
7955 prt(format("%s - ¥â¥ó¥¹¥¿¡¼", !visual_only ? "Ãμ±" : "ɽ¼¨"), 2, 0);
7956 if (direct_r_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
7957 prt("̾Á°", 4, max + 3);
7958 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7960 if (!visual_only) prt("»¦³²¿ô", 4, 72);
7962 prt(format("%s - monsters", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
7963 if (direct_r_idx < 0) prt("Group", 4, 0);
7964 prt("Name", 4, max + 3);
7965 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7967 if (!visual_only) prt("Kills", 4, 73);
7970 for (i = 0; i < 78; i++)
7972 Term_putch(i, 5, TERM_WHITE, '=');
7975 if (direct_r_idx < 0)
7977 for (i = 0; i < browser_rows; i++)
7979 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7986 if (direct_r_idx < 0)
7988 /* Scroll group list */
7989 if (grp_cur < grp_top) grp_top = grp_cur;
7990 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7992 /* Display a list of monster groups */
7993 display_group_list(0, 6, max, browser_rows, grp_idx, monster_group_text, grp_cur, grp_top);
7995 if (old_grp_cur != grp_cur)
7997 old_grp_cur = grp_cur;
7999 /* Get a list of monsters in the current group */
8000 mon_cnt = collect_monsters(grp_idx[grp_cur], mon_idx, mode);
8003 /* Scroll monster list */
8004 while (mon_cur < mon_top)
8005 mon_top = MAX(0, mon_top - browser_rows/2);
8006 while (mon_cur >= mon_top + browser_rows)
8007 mon_top = MIN(mon_cnt - browser_rows, mon_top + browser_rows/2);
8012 /* Display a list of monsters in the current group */
8013 display_monster_list(max + 3, 6, browser_rows, mon_idx, mon_cur, mon_top, visual_only);
8019 /* Display a monster name */
8020 display_monster_list(max + 3, 6, 1, mon_idx, mon_cur, mon_top, visual_only);
8022 /* Display visual list below first monster */
8023 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8028 prt(format("<Êý¸þ>%s%s%s, ESC",
8029 (!visual_list && !visual_only) ? ", 'r'¤Ç»×¤¤½Ð¤ò¸«¤ë" : "",
8030 visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
8031 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
8034 prt(format("<dir>%s%s%s, ESC",
8035 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
8036 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
8037 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
8041 /* Get the current monster */
8042 r_ptr = &r_info[mon_idx[mon_cur]];
8046 /* Mega Hack -- track this monster race */
8047 if (mon_cnt) monster_race_track(mon_idx[mon_cur]);
8049 /* Hack -- handle stuff */
8055 place_visual_list_cursor(max + 3, 7, r_ptr->x_attr, r_ptr->x_char, attr_top, char_left);
8059 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8063 Term_gotoxy(max + 3, 6 + (mon_cur - mon_top));
8068 /* Do visual mode command if needed */
8069 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))
8071 if (direct_r_idx >= 0)
8096 /* Recall on screen */
8097 if (!visual_list && !visual_only && (mon_idx[mon_cur] > 0))
8099 screen_roff(mon_idx[mon_cur], 0);
8110 /* Move the cursor */
8111 browser_cursor(ch, &column, &grp_cur, grp_cnt, &mon_cur, mon_cnt);
8118 /* Free the "mon_idx" array */
8119 C_KILL(mon_idx, max_r_idx, s16b);
8124 * Display the objects in a group.
8126 static void display_object_list(int col, int row, int per_page, int object_idx[],
8127 int object_cur, int object_top, bool visual_only)
8131 /* Display lines until done */
8132 for (i = 0; i < per_page && (object_idx[object_top + i] >= 0); i++)
8136 object_kind *flavor_k_ptr;
8138 /* Get the object index */
8139 int k_idx = object_idx[object_top + i];
8141 /* Access the object */
8142 object_kind *k_ptr = &k_info[k_idx];
8144 /* Choose a color */
8145 byte attr = ((k_ptr->aware || visual_only) ? TERM_WHITE : TERM_SLATE);
8146 byte cursor = ((k_ptr->aware || visual_only) ? TERM_L_BLUE : TERM_BLUE);
8149 if (!visual_only && k_ptr->flavor)
8151 /* Appearance of this object is shuffled */
8152 flavor_k_ptr = &k_info[k_ptr->flavor];
8156 /* Appearance of this object is very normal */
8157 flavor_k_ptr = k_ptr;
8162 attr = ((i + object_top == object_cur) ? cursor : attr);
8164 if (!k_ptr->flavor || (!visual_only && k_ptr->aware))
8167 strip_name(o_name, k_idx);
8172 strcpy(o_name, k_name + flavor_k_ptr->flavor_name);
8175 /* Display the name */
8176 c_prt(attr, o_name, row + i, col);
8178 /* Hack -- visual_list mode */
8181 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);
8183 if (p_ptr->wizard || visual_only)
8185 c_prt(attr, format("%d", k_idx), row + i, 70);
8188 a = flavor_k_ptr->x_attr;
8189 c = flavor_k_ptr->x_char;
8191 /* Display symbol */
8192 Term_queue_bigchar(use_bigtile ? 76 : 77, row + i, a, c, 0, 0);
8195 /* Clear remaining lines */
8196 for (; i < per_page; i++)
8198 Term_erase(col, row + i, 255);
8203 * Describe fake object
8205 static void desc_obj_fake(int k_idx)
8208 object_type object_type_body;
8210 /* Get local object */
8211 o_ptr = &object_type_body;
8213 /* Wipe the object */
8216 /* Create the artifact */
8217 object_prep(o_ptr, k_idx);
8219 /* It's fully know */
8220 o_ptr->ident |= IDENT_KNOWN;
8222 /* Track the object */
8223 /* object_actual_track(o_ptr); */
8225 /* Hack - mark as fake */
8226 /* term_obj_real = FALSE; */
8228 /* Hack -- Handle stuff */
8231 if (!screen_object(o_ptr, SCROBJ_FAKE_OBJECT | SCROBJ_FORCE_DETAIL))
8234 msg_print("ÆäËÊѤï¤Ã¤¿¤È¤³¤í¤Ï¤Ê¤¤¤è¤¦¤À¡£");
8236 msg_print("You see nothing special.");
8245 * Display known objects
8247 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int direct_k_idx)
8250 int grp_cur, grp_top, old_grp_cur;
8251 int object_old, object_cur, object_top;
8252 int grp_cnt, grp_idx[100];
8260 bool visual_list = FALSE;
8261 byte attr_top = 0, char_left = 0;
8269 Term_get_size(&wid, &hgt);
8271 browser_rows = hgt - 8;
8273 /* Allocate the "object_idx" array */
8274 C_MAKE(object_idx, max_k_idx, int);
8279 if (direct_k_idx < 0)
8281 mode = visual_only ? 0x03 : 0x01;
8283 /* Check every group */
8284 for (i = 0; object_group_text[i] != NULL; i++)
8286 /* Measure the label */
8287 len = strlen(object_group_text[i]);
8289 /* Save the maximum length */
8290 if (len > max) max = len;
8292 /* See if any monsters are known */
8293 if (collect_objects(i, object_idx, mode))
8295 /* Build a list of groups with known monsters */
8296 grp_idx[grp_cnt++] = i;
8305 object_kind *k_ptr = &k_info[direct_k_idx];
8306 object_kind *flavor_k_ptr;
8308 if (!visual_only && k_ptr->flavor)
8310 /* Appearance of this object is shuffled */
8311 flavor_k_ptr = &k_info[k_ptr->flavor];
8315 /* Appearance of this object is very normal */
8316 flavor_k_ptr = k_ptr;
8319 object_idx[0] = direct_k_idx;
8320 object_old = direct_k_idx;
8323 /* Terminate the list */
8326 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
8327 &attr_top, &char_left, &flavor_k_ptr->x_attr, &flavor_k_ptr->x_char, need_redraw);
8330 /* Terminate the list */
8331 grp_idx[grp_cnt] = -1;
8334 grp_cur = grp_top = 0;
8335 object_cur = object_top = 0;
8340 mode = visual_only ? 0x02 : 0x00;
8345 object_kind *k_ptr, *flavor_k_ptr;
8352 prt(format("%s - ¥¢¥¤¥Æ¥à", !visual_only ? "Ãμ±" : "ɽ¼¨"), 2, 0);
8353 if (direct_k_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
8354 prt("̾Á°", 4, max + 3);
8355 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
8358 prt(format("%s - objects", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
8359 if (direct_k_idx < 0) prt("Group", 4, 0);
8360 prt("Name", 4, max + 3);
8361 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
8365 for (i = 0; i < 78; i++)
8367 Term_putch(i, 5, TERM_WHITE, '=');
8370 if (direct_k_idx < 0)
8372 for (i = 0; i < browser_rows; i++)
8374 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8381 if (direct_k_idx < 0)
8383 /* Scroll group list */
8384 if (grp_cur < grp_top) grp_top = grp_cur;
8385 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8387 /* Display a list of object groups */
8388 display_group_list(0, 6, max, browser_rows, grp_idx, object_group_text, grp_cur, grp_top);
8390 if (old_grp_cur != grp_cur)
8392 old_grp_cur = grp_cur;
8394 /* Get a list of objects in the current group */
8395 object_cnt = collect_objects(grp_idx[grp_cur], object_idx, mode);
8398 /* Scroll object list */
8399 while (object_cur < object_top)
8400 object_top = MAX(0, object_top - browser_rows/2);
8401 while (object_cur >= object_top + browser_rows)
8402 object_top = MIN(object_cnt - browser_rows, object_top + browser_rows/2);
8407 /* Display a list of objects in the current group */
8408 display_object_list(max + 3, 6, browser_rows, object_idx, object_cur, object_top, visual_only);
8412 object_top = object_cur;
8414 /* Display a list of objects in the current group */
8415 display_object_list(max + 3, 6, 1, object_idx, object_cur, object_top, visual_only);
8417 /* Display visual list below first object */
8418 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8421 /* Get the current object */
8422 k_ptr = &k_info[object_idx[object_cur]];
8424 if (!visual_only && k_ptr->flavor)
8426 /* Appearance of this object is shuffled */
8427 flavor_k_ptr = &k_info[k_ptr->flavor];
8431 /* Appearance of this object is very normal */
8432 flavor_k_ptr = k_ptr;
8437 prt(format("<Êý¸þ>%s%s%s, ESC",
8438 (!visual_list && !visual_only) ? ", 'r'¤Ç¾ÜºÙ¤ò¸«¤ë" : "",
8439 visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
8440 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
8443 prt(format("<dir>%s%s%s, ESC",
8444 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
8445 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
8446 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
8452 /* Mega Hack -- track this object */
8453 if (object_cnt) object_kind_track(object_idx[object_cur]);
8455 /* The "current" object changed */
8456 if (object_old != object_idx[object_cur])
8458 /* Hack -- handle stuff */
8461 /* Remember the "current" object */
8462 object_old = object_idx[object_cur];
8468 place_visual_list_cursor(max + 3, 7, flavor_k_ptr->x_attr, flavor_k_ptr->x_char, attr_top, char_left);
8472 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8476 Term_gotoxy(max + 3, 6 + (object_cur - object_top));
8481 /* Do visual mode command if needed */
8482 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))
8484 if (direct_k_idx >= 0)
8509 /* Recall on screen */
8510 if (!visual_list && !visual_only && (grp_cnt > 0))
8512 desc_obj_fake(object_idx[object_cur]);
8520 /* Move the cursor */
8521 browser_cursor(ch, &column, &grp_cur, grp_cnt, &object_cur, object_cnt);
8527 /* Free the "object_idx" array */
8528 C_KILL(object_idx, max_k_idx, int);
8533 * Display the features in a group.
8535 static void display_feature_list(int col, int row, int per_page, int *feat_idx,
8536 int feat_cur, int feat_top, bool visual_only, int lighting_level)
8538 int lit_col[F_LIT_MAX], i, j;
8539 int f_idx_col = use_bigtile ? 62 : 64;
8541 /* Correct columns 1 and 4 */
8542 lit_col[F_LIT_STANDARD] = use_bigtile ? (71 - F_LIT_MAX) : 71;
8543 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
8544 lit_col[i] = lit_col[F_LIT_STANDARD] + 2 + (i - F_LIT_NS_BEGIN) * 2 + (use_bigtile ? i : 0);
8546 /* Display lines until done */
8547 for (i = 0; i < per_page && (feat_idx[feat_top + i] >= 0); i++)
8552 int f_idx = feat_idx[feat_top + i];
8554 /* Access the index */
8555 feature_type *f_ptr = &f_info[f_idx];
8557 int row_i = row + i;
8559 /* Choose a color */
8560 attr = ((i + feat_top == feat_cur) ? TERM_L_BLUE : TERM_WHITE);
8562 /* Display the name */
8563 c_prt(attr, f_name + f_ptr->name, row_i, col);
8565 /* Hack -- visual_list mode */
8568 /* Display lighting level */
8569 c_prt(attr, format("(%s)", lighting_level_str[lighting_level]), row_i, col + 1 + strlen(f_name + f_ptr->name));
8571 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));
8573 if (p_ptr->wizard || visual_only)
8575 c_prt(attr, format("%d", f_idx), row_i, f_idx_col);
8578 /* Display symbol */
8579 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);
8581 Term_putch(lit_col[F_LIT_NS_BEGIN], row_i, TERM_SLATE, '(');
8582 for (j = F_LIT_NS_BEGIN + 1; j < F_LIT_MAX; j++)
8584 Term_putch(lit_col[j], row_i, TERM_SLATE, '/');
8586 Term_putch(lit_col[F_LIT_MAX - 1] + (use_bigtile ? 3 : 2), row_i, TERM_SLATE, ')');
8588 /* Mega-hack -- Use non-standard colour */
8589 for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
8591 Term_queue_bigchar(lit_col[j] + 1, row_i, f_ptr->x_attr[j], f_ptr->x_char[j], 0, 0);
8595 /* Clear remaining lines */
8596 for (; i < per_page; i++)
8598 Term_erase(col, row + i, 255);
8604 * Interact with feature visuals.
8606 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int direct_f_idx, int *lighting_level)
8609 int grp_cur, grp_top, old_grp_cur;
8610 int feat_cur, feat_top;
8611 int grp_cnt, grp_idx[100];
8619 bool visual_list = FALSE;
8620 byte attr_top = 0, char_left = 0;
8625 byte attr_old[F_LIT_MAX];
8626 byte char_old[F_LIT_MAX];
8627 byte *cur_attr_ptr, *cur_char_ptr;
8629 C_WIPE(attr_old, F_LIT_MAX, byte);
8630 C_WIPE(char_old, F_LIT_MAX, byte);
8633 Term_get_size(&wid, &hgt);
8635 browser_rows = hgt - 8;
8637 /* Allocate the "feat_idx" array */
8638 C_MAKE(feat_idx, max_f_idx, int);
8643 if (direct_f_idx < 0)
8645 /* Check every group */
8646 for (i = 0; feature_group_text[i] != NULL; i++)
8648 /* Measure the label */
8649 len = strlen(feature_group_text[i]);
8651 /* Save the maximum length */
8652 if (len > max) max = len;
8654 /* See if any features are known */
8655 if (collect_features(i, feat_idx, 0x01))
8657 /* Build a list of groups with known features */
8658 grp_idx[grp_cnt++] = i;
8666 feature_type *f_ptr = &f_info[direct_f_idx];
8668 feat_idx[0] = direct_f_idx;
8671 /* Terminate the list */
8674 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
8675 &attr_top, &char_left, &f_ptr->x_attr[*lighting_level], &f_ptr->x_char[*lighting_level], need_redraw);
8677 for (i = 0; i < F_LIT_MAX; i++)
8679 attr_old[i] = f_ptr->x_attr[i];
8680 char_old[i] = f_ptr->x_char[i];
8684 /* Terminate the list */
8685 grp_idx[grp_cnt] = -1;
8688 grp_cur = grp_top = 0;
8689 feat_cur = feat_top = 0;
8697 feature_type *f_ptr;
8704 prt("ɽ¼¨ - ÃÏ·Á", 2, 0);
8705 if (direct_f_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
8706 prt("̾Á°", 4, max + 3);
8709 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
8710 prt("ʸ»ú ( l/ d)", 4, 66);
8714 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
8715 prt("ʸ»ú (l/d)", 4, 68);
8718 prt("Visuals - features", 2, 0);
8719 if (direct_f_idx < 0) prt("Group", 4, 0);
8720 prt("Name", 4, max + 3);
8723 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
8724 prt("Sym ( l/ d)", 4, 67);
8728 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
8729 prt("Sym (l/d)", 4, 69);
8733 for (i = 0; i < 78; i++)
8735 Term_putch(i, 5, TERM_WHITE, '=');
8738 if (direct_f_idx < 0)
8740 for (i = 0; i < browser_rows; i++)
8742 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8749 if (direct_f_idx < 0)
8751 /* Scroll group list */
8752 if (grp_cur < grp_top) grp_top = grp_cur;
8753 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8755 /* Display a list of feature groups */
8756 display_group_list(0, 6, max, browser_rows, grp_idx, feature_group_text, grp_cur, grp_top);
8758 if (old_grp_cur != grp_cur)
8760 old_grp_cur = grp_cur;
8762 /* Get a list of features in the current group */
8763 feat_cnt = collect_features(grp_idx[grp_cur], feat_idx, 0x00);
8766 /* Scroll feature list */
8767 while (feat_cur < feat_top)
8768 feat_top = MAX(0, feat_top - browser_rows/2);
8769 while (feat_cur >= feat_top + browser_rows)
8770 feat_top = MIN(feat_cnt - browser_rows, feat_top + browser_rows/2);
8775 /* Display a list of features in the current group */
8776 display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top, visual_only, F_LIT_STANDARD);
8780 feat_top = feat_cur;
8782 /* Display a list of features in the current group */
8783 display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top, visual_only, *lighting_level);
8785 /* Display visual list below first object */
8786 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8791 prt(format("<Êý¸þ>%s, 'd'¤Çɸ½à¸÷¸»¸ú²Ì%s, ESC",
8792 visual_list ? ", ENTER¤Ç·èÄê, 'a'¤ÇÂоÝÌÀÅÙÊѹ¹" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
8793 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
8796 prt(format("<dir>%s, 'd' for default lighting%s, ESC",
8797 visual_list ? ", ENTER to accept, 'a' for lighting level" : ", 'v' for visuals",
8798 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
8802 /* Get the current feature */
8803 f_ptr = &f_info[feat_idx[feat_cur]];
8804 cur_attr_ptr = &f_ptr->x_attr[*lighting_level];
8805 cur_char_ptr = &f_ptr->x_char[*lighting_level];
8809 place_visual_list_cursor(max + 3, 7, *cur_attr_ptr, *cur_char_ptr, attr_top, char_left);
8813 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8817 Term_gotoxy(max + 3, 6 + (feat_cur - feat_top));
8822 if (visual_list && ((ch == 'A') || (ch == 'a')))
8824 int prev_lighting_level = *lighting_level;
8828 if (*lighting_level <= 0) *lighting_level = F_LIT_MAX - 1;
8829 else (*lighting_level)--;
8833 if (*lighting_level >= F_LIT_MAX - 1) *lighting_level = 0;
8834 else (*lighting_level)++;
8837 if (f_ptr->x_attr[prev_lighting_level] != f_ptr->x_attr[*lighting_level])
8838 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
8840 if (f_ptr->x_char[prev_lighting_level] != f_ptr->x_char[*lighting_level])
8841 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
8846 else if ((ch == 'D') || (ch == 'd'))
8848 byte prev_x_attr = f_ptr->x_attr[*lighting_level];
8849 byte prev_x_char = f_ptr->x_char[*lighting_level];
8851 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
8855 if (prev_x_attr != f_ptr->x_attr[*lighting_level])
8856 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
8858 if (prev_x_char != f_ptr->x_char[*lighting_level])
8859 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
8861 else *need_redraw = TRUE;
8866 /* Do visual mode command if needed */
8867 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))
8871 /* Restore previous visual settings */
8873 for (i = 0; i < F_LIT_MAX; i++)
8875 f_ptr->x_attr[i] = attr_old[i];
8876 f_ptr->x_char[i] = char_old[i];
8883 if (direct_f_idx >= 0) flag = TRUE;
8884 else *lighting_level = F_LIT_STANDARD;
8887 /* Preserve current visual settings */
8890 for (i = 0; i < F_LIT_MAX; i++)
8892 attr_old[i] = f_ptr->x_attr[i];
8893 char_old[i] = f_ptr->x_char[i];
8895 *lighting_level = F_LIT_STANDARD;
8902 for (i = 0; i < F_LIT_MAX; i++)
8904 attr_idx_feat[i] = f_ptr->x_attr[i];
8905 char_idx_feat[i] = f_ptr->x_char[i];
8914 /* Allow TERM_DARK text */
8915 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
8917 if (attr_idx_feat[i] || (!(char_idx_feat[i] & 0x80) && char_idx_feat[i])) f_ptr->x_attr[i] = attr_idx_feat[i];
8918 if (char_idx_feat[i]) f_ptr->x_char[i] = char_idx_feat[i];
8936 /* Move the cursor */
8937 browser_cursor(ch, &column, &grp_cur, grp_cnt, &feat_cur, feat_cnt);
8943 /* Free the "feat_idx" array */
8944 C_KILL(feat_idx, max_f_idx, int);
8949 * List wanted monsters
8951 static void do_cmd_knowledge_kubi(void)
8956 char file_name[1024];
8959 /* Open a new file */
8960 fff = my_fopen_temp(file_name, 1024);
8963 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8965 msg_format("Failed to create temporary file %s.", file_name);
8973 bool listed = FALSE;
8976 fprintf(fff, "º£Æü¤Î¥¿¡¼¥²¥Ã¥È : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "ÉÔÌÀ"));
8978 fprintf(fff, "¾Þ¶â¼ó¥ê¥¹¥È\n");
8980 fprintf(fff, "Today target : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "unknown"));
8982 fprintf(fff, "List of wanted monsters\n");
8984 fprintf(fff, "----------------------------------------------\n");
8986 for (i = 0; i < MAX_KUBI; i++)
8988 if (kubi_r_idx[i] <= 10000)
8990 fprintf(fff,"%s\n", r_name + r_info[kubi_r_idx[i]].name);
8999 fprintf(fff,"\n%s\n", "¾Þ¶â¼ó¤Ï¤â¤¦»Ä¤Ã¤Æ¤¤¤Þ¤»¤ó¡£");
9001 fprintf(fff,"\n%s\n", "There is no more wanted monster.");
9006 /* Close the file */
9009 /* Display the file contents */
9011 show_file(TRUE, file_name, "¾Þ¶â¼ó¤Î°ìÍ÷", 0, 0);
9013 show_file(TRUE, file_name, "Wanted monsters", 0, 0);
9017 /* Remove the file */
9022 * List virtues & status
9024 static void do_cmd_knowledge_virtues(void)
9028 char file_name[1024];
9031 /* Open a new file */
9032 fff = my_fopen_temp(file_name, 1024);
9035 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9037 msg_format("Failed to create temporary file %s.", file_name);
9046 fprintf(fff, "¸½ºß¤Î°À : %s\n\n", your_alignment());
9048 fprintf(fff, "Your alighnment : %s\n\n", your_alignment());
9053 /* Close the file */
9056 /* Display the file contents */
9058 show_file(TRUE, file_name, "Ȭ¤Ä¤ÎÆÁ", 0, 0);
9060 show_file(TRUE, file_name, "Virtues", 0, 0);
9064 /* Remove the file */
9072 static void do_cmd_knowledge_dungeon(void)
9076 char file_name[1024];
9080 /* Open a new file */
9081 fff = my_fopen_temp(file_name, 1024);
9084 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9086 msg_format("Failed to create temporary file %s.", file_name);
9094 for (i = 1; i < max_d_idx; i++)
9098 if (!d_info[i].maxdepth) continue;
9099 if (!max_dlv[i]) continue;
9100 if (d_info[i].final_guardian)
9102 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
9104 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
9106 fprintf(fff,"%c%-12s : %3d ³¬\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
9108 fprintf(fff,"%c%-16s : level %3d\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
9113 /* Close the file */
9116 /* Display the file contents */
9118 show_file(TRUE, file_name, "º£¤Þ¤Ç¤ËÆþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó", 0, 0);
9120 show_file(TRUE, file_name, "Dungeon", 0, 0);
9124 /* Remove the file */
9129 * List virtues & status
9132 static void do_cmd_knowledge_stat(void)
9136 char file_name[1024];
9139 /* Open a new file */
9140 fff = my_fopen_temp(file_name, 1024);
9143 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9145 msg_format("Failed to create temporary file %s.", file_name);
9153 percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
9154 (2 * p_ptr->hitdie +
9155 ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
9158 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : %d/100\n\n", percent);
9159 else fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : ???\n\n");
9160 fprintf(fff, "ǽÎϤκÇÂçÃÍ\n\n");
9162 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "Your current Life Rating is %d/100.\n\n", percent);
9163 else fprintf(fff, "Your current Life Rating is ???.\n\n");
9164 fprintf(fff, "Limits of maximum stats\n\n");
9166 for (v_nr = 0; v_nr < 6; v_nr++)
9168 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);
9169 else fprintf(fff, "%s ???\n", stat_names[v_nr]);
9175 /* Close the file */
9178 /* Display the file contents */
9180 show_file(TRUE, file_name, "¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó", 0, 0);
9182 show_file(TRUE, file_name, "HP-rate & Max stat", 0, 0);
9186 /* Remove the file */
9192 * Print all active quests
9194 static void do_cmd_knowledge_quests_current(FILE *fff)
9197 char rand_tmp_str[120] = "\0";
9199 monster_race *r_ptr;
9201 int rand_level = 100;
9205 fprintf(fff, "¡Ô¿ë¹ÔÃæ¤Î¥¯¥¨¥¹¥È¡Õ\n");
9207 fprintf(fff, "< Current Quest >\n");
9210 for (i = 1; i < max_quests; i++)
9212 if ((quest[i].status == QUEST_STATUS_TAKEN) || (quest[i].status == QUEST_STATUS_COMPLETED))
9214 /* Set the quest number temporary */
9215 int old_quest = p_ptr->inside_quest;
9218 /* Clear the text */
9219 for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
9220 quest_text_line = 0;
9222 p_ptr->inside_quest = i;
9224 /* Get the quest text */
9225 init_flags = INIT_SHOW_TEXT;
9227 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9229 /* Reset the old quest number */
9230 p_ptr->inside_quest = old_quest;
9232 /* No info from "silent" quests */
9233 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
9237 if (quest[i].type != QUEST_TYPE_RANDOM)
9239 char note[80] = "\0";
9241 if (quest[i].status == QUEST_STATUS_TAKEN)
9243 switch (quest[i].type)
9245 case QUEST_TYPE_KILL_LEVEL:
9246 case QUEST_TYPE_KILL_ANY_LEVEL:
9247 r_ptr = &r_info[quest[i].r_idx];
9248 strcpy(name, r_name + r_ptr->name);
9249 if (quest[i].max_num > 1)
9252 sprintf(note," - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
9253 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
9256 sprintf(note," - kill %d %s, have killed %d.",
9257 quest[i].max_num, name, quest[i].cur_num);
9262 sprintf(note," - %s¤òÅݤ¹¡£",name);
9264 sprintf(note," - kill %s.",name);
9268 case QUEST_TYPE_FIND_ARTIFACT:
9269 strcpy(name, a_name + a_info[quest[i].k_idx].name);
9271 sprintf(note," - %s¤ò¸«¤Ä¤±½Ð¤¹¡£", name);
9273 sprintf(note," - Find out %s.", name);
9277 case QUEST_TYPE_FIND_EXIT:
9279 sprintf(note," - õº÷¤¹¤ë¡£");
9281 sprintf(note," - Search.");
9285 case QUEST_TYPE_KILL_NUMBER:
9287 sprintf(note," - %d ÂΤΥâ¥ó¥¹¥¿¡¼¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
9288 quest[i].max_num, quest[i].max_num - quest[i].cur_num);
9290 sprintf(note," - Kill %d monsters, have killed %d.",
9291 quest[i].max_num, quest[i].cur_num);
9295 case QUEST_TYPE_KILL_ALL:
9297 sprintf(note," - Á´¤Æ¤Î¥â¥ó¥¹¥¿¡¼¤òÅݤ¹¡£");
9299 sprintf(note," - Kill all monsters.");
9305 /* Print the quest info */
9307 sprintf(tmp_str, " %s (´í¸±ÅÙ:%d³¬ÁêÅö)%s\n",
9308 quest[i].name, quest[i].level, note);
9310 sprintf(tmp_str, " %s (Danger level: %d)%s\n",
9311 quest[i].name, quest[i].level, note);
9314 fprintf(fff, tmp_str);
9316 if (quest[i].status == QUEST_STATUS_COMPLETED)
9319 sprintf(tmp_str, " ¥¯¥¨¥¹¥ÈãÀ® - ¤Þ¤ÀÊó½·¤ò¼õ¤±¤È¤Ã¤Æ¤Ê¤¤¡£\n");
9321 sprintf(tmp_str, " Quest Completed - Unrewarded\n");
9323 fprintf(fff, tmp_str);
9329 while (quest_text[j][0] && j < 10)
9331 fprintf(fff, " %s\n", quest_text[j]);
9336 else if (quest[i].level < rand_level) /* QUEST_TYPE_RANDOM */
9339 rand_level = quest[i].level;
9341 if (max_dlv[DUNGEON_ANGBAND] >= rand_level)
9343 /* Print the quest info */
9344 r_ptr = &r_info[quest[i].r_idx];
9345 strcpy(name, r_name + r_ptr->name);
9347 if (quest[i].max_num > 1)
9350 sprintf(rand_tmp_str," %s (%d ³¬) - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)\n",
9351 quest[i].name, quest[i].level,
9352 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
9356 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
9357 quest[i].name, quest[i].level,
9358 quest[i].max_num, name, quest[i].cur_num);
9364 sprintf(rand_tmp_str," %s (%d ³¬) - %s¤òÅݤ¹¡£\n",
9365 quest[i].name, quest[i].level, name);
9367 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %s.\n",
9368 quest[i].name, quest[i].level, name);
9376 /* Print the current random quest */
9377 if (rand_tmp_str[0]) fprintf(fff, rand_tmp_str);
9380 if (!total) fprintf(fff, " ¤Ê¤·\n");
9382 if (!total) fprintf(fff, " Nothing.\n");
9388 * Print all finished quests
9390 void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[])
9397 fprintf(fff, "¡ÔãÀ®¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
9399 fprintf(fff, "< Completed Quest >\n");
9401 for (i = 1; i < max_quests; i++)
9403 int q_idx = quest_num[i];
9405 if (quest[q_idx].status == QUEST_STATUS_FINISHED)
9407 if (is_fixed_quest_idx(q_idx))
9409 /* Set the quest number temporary */
9410 int old_quest = p_ptr->inside_quest;
9412 p_ptr->inside_quest = q_idx;
9415 init_flags = INIT_ASSIGN;
9417 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9419 /* Reset the old quest number */
9420 p_ptr->inside_quest = old_quest;
9422 /* No info from "silent" quests */
9423 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
9428 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
9430 /* Print the quest info */
9432 if (quest[q_idx].complev == 0)
9436 " %-40s (%3d³¬) - ÉÔÀᄀ\n",
9438 " %-40s (Dungeon level: %3d) - (Cancelled)\n",
9440 r_name+r_info[quest[q_idx].r_idx].name,
9441 quest[q_idx].level);
9447 " %-40s (%3d³¬) - ¥ì¥Ù¥ë%2d\n",
9449 " %-40s (Dungeon level: %3d) - level %2d\n",
9451 r_name+r_info[quest[q_idx].r_idx].name,
9453 quest[q_idx].complev);
9458 /* Print the quest info */
9460 sprintf(tmp_str, " %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
9461 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9463 sprintf(tmp_str, " %-40s (Danger level: %3d) - level %2d\n",
9464 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9468 fprintf(fff, tmp_str);
9472 if (!total) fprintf(fff, " ¤Ê¤·\n");
9474 if (!total) fprintf(fff, " Nothing.\n");
9480 * Print all failed quests
9482 void do_cmd_knowledge_quests_failed(FILE *fff, int quest_num[])
9489 fprintf(fff, "¡Ô¼ºÇÔ¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
9491 fprintf(fff, "< Failed Quest >\n");
9493 for (i = 1; i < max_quests; i++)
9495 int q_idx = quest_num[i];
9497 if ((quest[q_idx].status == QUEST_STATUS_FAILED_DONE) || (quest[q_idx].status == QUEST_STATUS_FAILED))
9499 if (is_fixed_quest_idx(q_idx))
9501 /* Set the quest number temporary */
9502 int old_quest = p_ptr->inside_quest;
9504 p_ptr->inside_quest = q_idx;
9506 /* Get the quest text */
9507 init_flags = INIT_ASSIGN;
9509 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9511 /* Reset the old quest number */
9512 p_ptr->inside_quest = old_quest;
9514 /* No info from "silent" quests */
9515 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
9520 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
9522 /* Print the quest info */
9524 sprintf(tmp_str, " %-40s (%3d³¬) - ¥ì¥Ù¥ë%2d\n",
9525 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
9527 sprintf(tmp_str, " %-40s (Dungeon level: %3d) - level %2d\n",
9528 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
9533 /* Print the quest info */
9535 sprintf(tmp_str, " %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
9536 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9538 sprintf(tmp_str, " %-40s (Danger level: %3d) - level %2d\n",
9539 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9542 fprintf(fff, tmp_str);
9546 if (!total) fprintf(fff, " ¤Ê¤·\n");
9548 if (!total) fprintf(fff, " Nothing.\n");
9554 * Print all random quests
9556 static void do_cmd_knowledge_quests_wiz_random(FILE *fff)
9563 fprintf(fff, "¡Ô»Ä¤ê¤Î¥é¥ó¥À¥à¥¯¥¨¥¹¥È¡Õ\n");
9565 fprintf(fff, "< Remaining Random Quest >\n");
9567 for (i = 1; i < max_quests; i++)
9569 /* No info from "silent" quests */
9570 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
9572 if ((quest[i].type == QUEST_TYPE_RANDOM) && (quest[i].status == QUEST_STATUS_TAKEN))
9576 /* Print the quest info */
9578 sprintf(tmp_str, " %s (%d³¬, %s)\n",
9579 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
9581 sprintf(tmp_str, " %s (%d, %s)\n",
9582 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
9584 fprintf(fff, tmp_str);
9588 if (!total) fprintf(fff, " ¤Ê¤·\n");
9590 if (!total) fprintf(fff, " Nothing.\n");
9595 bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b)
9597 int *q_num = (int *)u;
9598 quest_type *qa = &quest[q_num[a]];
9599 quest_type *qb = &quest[q_num[b]];
9604 if (qa->complev < qb->complev) return TRUE;
9605 if (qa->complev > qb->complev) return FALSE;
9606 if (qa->level <= qb->level) return TRUE;
9610 void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b)
9612 int *q_num = (int *)u;
9619 q_num[a] = q_num[b];
9625 * Print quest status of all active quests
9627 static void do_cmd_knowledge_quests(void)
9630 char file_name[1024];
9631 int *quest_num, dummy, i;
9633 /* Open a new file */
9634 fff = my_fopen_temp(file_name, 1024);
9638 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9640 msg_format("Failed to create temporary file %s.", file_name);
9646 /* Allocate Memory */
9647 C_MAKE(quest_num, max_quests, int);
9649 /* Sort by compete level */
9650 for (i = 1; i < max_quests; i++) quest_num[i] = i;
9651 ang_sort_comp = ang_sort_comp_quest_num;
9652 ang_sort_swap = ang_sort_swap_quest_num;
9653 ang_sort(quest_num, &dummy, max_quests);
9655 /* Dump Quest Information */
9656 do_cmd_knowledge_quests_current(fff);
9658 do_cmd_knowledge_quests_completed(fff, quest_num);
9660 do_cmd_knowledge_quests_failed(fff, quest_num);
9664 do_cmd_knowledge_quests_wiz_random(fff);
9667 /* Close the file */
9670 /* Display the file contents */
9672 show_file(TRUE, file_name, "¥¯¥¨¥¹¥ÈãÀ®¾õ¶·", 0, 0);
9674 show_file(TRUE, file_name, "Quest status", 0, 0);
9677 /* Remove the file */
9681 C_KILL(quest_num, max_quests, int);
9688 static void do_cmd_knowledge_home(void)
9693 char file_name[1024];
9695 char o_name[MAX_NLEN];
9698 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
9700 /* Open a new file */
9701 fff = my_fopen_temp(file_name, 1024);
9704 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9706 msg_format("Failed to create temporary file %s.", file_name);
9714 /* Print all homes in the different towns */
9715 st_ptr = &town[1].store[STORE_HOME];
9717 /* Home -- if anything there */
9718 if (st_ptr->stock_num)
9723 /* Header with name of the town */
9725 fprintf(fff, " [ ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ]\n");
9727 fprintf(fff, " [Home Inventory]\n");
9730 /* Dump all available items */
9731 for (i = 0; i < st_ptr->stock_num; i++)
9734 if ((i % 12) == 0) fprintf(fff, "\n ( %d ¥Ú¡¼¥¸ )\n", x++);
9735 object_desc(o_name, &st_ptr->stock[i], 0);
9736 if (strlen(o_name) <= 80-3)
9738 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9744 for (n = 0, t = o_name; n < 80-3; n++, t++)
9745 if(iskanji(*t)) {t++; n++;}
9746 if (n == 81-3) n = 79-3; /* ºÇ¸å¤¬´Á»úȾʬ */
9748 fprintf(fff, "%c%s %.*s\n", I2A(i%12), paren, n, o_name);
9749 fprintf(fff, " %.77s\n", o_name+n);
9752 object_desc(o_name, &st_ptr->stock[i], 0);
9753 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9758 /* Add an empty line */
9759 fprintf(fff, "\n\n");
9763 /* Close the file */
9766 /* Display the file contents */
9768 show_file(TRUE, file_name, "²æ¤¬²È¤Î¥¢¥¤¥Æ¥à", 0, 0);
9770 show_file(TRUE, file_name, "Home Inventory", 0, 0);
9774 /* Remove the file */
9780 * Check the status of "autopick"
9782 static void do_cmd_knowledge_autopick(void)
9786 char file_name[1024];
9788 /* Open a new file */
9789 fff = my_fopen_temp(file_name, 1024);
9794 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9796 msg_format("Failed to create temporary file %s.", file_name);
9805 fprintf(fff, "¼«Æ°Ç˲õ/½¦¤¤¤Ë¤Ï²¿¤âÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
9807 fprintf(fff, "No preference for auto picker/destroyer.");
9813 fprintf(fff, " ¼«Æ°½¦¤¤/Ç˲õ¤Ë¤Ï¸½ºß %d¹ÔÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤¹¡£\n\n", max_autopick);
9815 fprintf(fff, " There are %d registered lines for auto picker/destroyer.\n\n", max_autopick);
9819 for (k = 0; k < max_autopick; k++)
9822 byte act = autopick_list[k].action;
9823 if (act & DONT_AUTOPICK)
9831 else if (act & DO_AUTODESTROY)
9839 else if (act & DO_AUTOPICK)
9847 else /* if (act & DO_QUERY_AUTOPICK) */ /* Obvious */
9856 if (act & DO_DISPLAY)
9857 fprintf(fff, "%11s", format("[%s]", tmp));
9859 fprintf(fff, "%11s", format("(%s)", tmp));
9861 tmp = autopick_line_from_entry(&autopick_list[k]);
9862 fprintf(fff, " %s", tmp);
9866 /* Close the file */
9868 /* Display the file contents */
9870 show_file(TRUE, file_name, "¼«Æ°½¦¤¤/Ç˲õ ÀßÄê¥ê¥¹¥È", 0, 0);
9872 show_file(TRUE, file_name, "Auto-picker/Destroyer", 0, 0);
9875 /* Remove the file */
9881 * Interact with "knowledge"
9883 void do_cmd_knowledge(void)
9886 bool need_redraw = FALSE;
9888 /* File type is "TEXT" */
9889 FILE_TYPE(FILE_TYPE_TEXT);
9891 /* Save the screen */
9894 /* Interact until done */
9900 /* Ask for a choice */
9902 prt(format("%d/2 ¥Ú¡¼¥¸", (p+1)), 2, 65);
9903 prt("¸½ºß¤ÎÃ챤ò³Îǧ¤¹¤ë", 3, 0);
9905 prt(format("page %d/2", (p+1)), 2, 65);
9906 prt("Display current knowledge", 3, 0);
9909 /* Give some choices */
9913 prt("(1) ´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 6, 5);
9914 prt("(2) ´ûÃΤΥ¢¥¤¥Æ¥à ¤Î°ìÍ÷", 7, 5);
9915 prt("(3) ´ûÃΤÎÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 8, 5);
9916 prt("(4) ´ûÃΤΥâ¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 9, 5);
9917 prt("(5) Åݤ·¤¿Å¨¤Î¿ô ¤Î°ìÍ÷", 10, 5);
9918 if (!vanilla_town) prt("(6) ¾Þ¶â¼ó ¤Î°ìÍ÷", 11, 5);
9919 prt("(7) ¸½ºß¤Î¥Ú¥Ã¥È ¤Î°ìÍ÷", 12, 5);
9920 prt("(8) ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 13, 5);
9921 prt("(9) *´ÕÄê*ºÑ¤ßÁõÈ÷¤ÎÂÑÀ ¤Î°ìÍ÷", 14, 5);
9922 prt("(0) ÃÏ·Á¤Îɽ¼¨Ê¸»ú/¥¿¥¤¥ë ¤Î°ìÍ÷", 15, 5);
9926 prt("(a) ¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó ¤Î°ìÍ÷", 6, 5);
9927 prt("(b) ÆÍÁ³ÊÑ°Û ¤Î°ìÍ÷", 7, 5);
9928 prt("(c) Éð´ï¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 8, 5);
9929 prt("(d) ËâË¡¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 9, 5);
9930 prt("(e) µ»Ç½¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 10, 5);
9931 prt("(f) ¥×¥ì¥¤¥ä¡¼¤ÎÆÁ ¤Î°ìÍ÷", 11, 5);
9932 prt("(g) Æþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó ¤Î°ìÍ÷", 12, 5);
9933 prt("(h) ¼Â¹ÔÃæ¤Î¥¯¥¨¥¹¥È ¤Î°ìÍ÷", 13, 5);
9934 prt("(i) ¸½ºß¤Î¼«Æ°½¦¤¤/Ç˲õÀßÄê ¤Î°ìÍ÷", 14, 5);
9939 prt("(1) Display known artifacts", 6, 5);
9940 prt("(2) Display known objects", 7, 5);
9941 prt("(3) Display remaining uniques", 8, 5);
9942 prt("(4) Display known monster", 9, 5);
9943 prt("(5) Display kill count", 10, 5);
9944 if (!vanilla_town) prt("(6) Display wanted monsters", 11, 5);
9945 prt("(7) Display current pets", 12, 5);
9946 prt("(8) Display home inventory", 13, 5);
9947 prt("(9) Display *identified* equip.", 14, 5);
9948 prt("(0) Display terrain symbols.", 15, 5);
9952 prt("(a) Display about yourself", 6, 5);
9953 prt("(b) Display mutations", 7, 5);
9954 prt("(c) Display weapon proficiency", 8, 5);
9955 prt("(d) Display spell proficiency", 9, 5);
9956 prt("(e) Display misc. proficiency", 10, 5);
9957 prt("(f) Display virtues", 11, 5);
9958 prt("(g) Display dungeons", 12, 5);
9959 prt("(h) Display current quests", 13, 5);
9960 prt("(i) Display auto pick/destroy", 14, 5);
9965 prt("-³¤¯-", 17, 8);
9966 prt("ESC) È´¤±¤ë", 21, 1);
9967 prt("SPACE) ¼¡¥Ú¡¼¥¸", 21, 30);
9968 /*prt("-) Á°¥Ú¡¼¥¸", 21, 60);*/
9969 prt("¥³¥Þ¥ó¥É:", 20, 0);
9971 prt("-more-", 17, 8);
9972 prt("ESC) Exit menu", 21, 1);
9973 prt("SPACE) Next page", 21, 30);
9974 /*prt("-) Previous page", 21, 60);*/
9975 prt("Command: ", 20, 0);
9982 if (i == ESCAPE) break;
9985 case ' ': /* Page change */
9989 case '1': /* Artifacts */
9990 do_cmd_knowledge_artifacts();
9992 case '2': /* Objects */
9993 do_cmd_knowledge_objects(&need_redraw, FALSE, -1);
9995 case '3': /* Uniques */
9996 do_cmd_knowledge_uniques();
9998 case '4': /* Monsters */
9999 do_cmd_knowledge_monsters(&need_redraw, FALSE, -1);
10001 case '5': /* Kill count */
10002 do_cmd_knowledge_kill_count();
10004 case '6': /* wanted */
10005 if (!vanilla_town) do_cmd_knowledge_kubi();
10007 case '7': /* Pets */
10008 do_cmd_knowledge_pets();
10010 case '8': /* Home */
10011 do_cmd_knowledge_home();
10013 case '9': /* Resist list */
10014 do_cmd_knowledge_inven();
10016 case '0': /* Feature list */
10018 int lighting_level = F_LIT_STANDARD;
10019 do_cmd_knowledge_features(&need_redraw, FALSE, -1, &lighting_level);
10023 case 'a': /* Max stat */
10024 do_cmd_knowledge_stat();
10026 case 'b': /* Mutations */
10027 do_cmd_knowledge_mutations();
10029 case 'c': /* weapon-exp */
10030 do_cmd_knowledge_weapon_exp();
10032 case 'd': /* spell-exp */
10033 do_cmd_knowledge_spell_exp();
10035 case 'e': /* skill-exp */
10036 do_cmd_knowledge_skill_exp();
10038 case 'f': /* Virtues */
10039 do_cmd_knowledge_virtues();
10041 case 'g': /* Dungeon */
10042 do_cmd_knowledge_dungeon();
10044 case 'h': /* Quests */
10045 do_cmd_knowledge_quests();
10047 case 'i': /* Autopick */
10048 do_cmd_knowledge_autopick();
10050 default: /* Unknown option */
10054 /* Flush messages */
10058 /* Restore the screen */
10061 if (need_redraw) do_cmd_redraw();
10066 * Check on the status of an active quest
10068 void do_cmd_checkquest(void)
10070 /* File type is "TEXT" */
10071 FILE_TYPE(FILE_TYPE_TEXT);
10073 /* Save the screen */
10077 do_cmd_knowledge_quests();
10079 /* Restore the screen */
10085 * Display the time and date
10087 void do_cmd_time(void)
10089 int day, hour, min, full, start, end, num;
10097 extract_day_hour_min(&day, &hour, &min);
10099 full = hour * 100 + min;
10107 strcpy(desc, "ÊѤʻþ¹ï¤À¡£");
10109 strcpy(desc, "It is a strange time.");
10113 if (day < MAX_DAYS) sprintf(day_buf, "%d", day);
10114 else strcpy(day_buf, "*****");
10118 msg_format("%sÆüÌÜ, »þ¹ï¤Ï%d:%02d %s¤Ç¤¹¡£",
10119 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
10120 min, (hour < 12) ? "AM" : "PM");
10122 msg_format("This is day %s. The time is %d:%02d %s.",
10123 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
10124 min, (hour < 12) ? "AM" : "PM");
10128 /* Find the path */
10129 if (!randint0(10) || p_ptr->image)
10132 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun_j.txt");
10134 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun.txt");
10141 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm_j.txt");
10143 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm.txt");
10148 /* Open this file */
10149 fff = my_fopen(buf, "rt");
10154 /* Find this time */
10155 while (!my_fgets(fff, buf, sizeof(buf)))
10157 /* Ignore comments */
10158 if (!buf[0] || (buf[0] == '#')) continue;
10160 /* Ignore invalid lines */
10161 if (buf[1] != ':') continue;
10163 /* Process 'Start' */
10166 /* Extract the starting time */
10167 start = atoi(buf + 2);
10169 /* Assume valid for an hour */
10176 /* Process 'End' */
10179 /* Extract the ending time */
10180 end = atoi(buf + 2);
10186 /* Ignore incorrect range */
10187 if ((start > full) || (full > end)) continue;
10189 /* Process 'Description' */
10194 /* Apply the randomizer */
10195 if (!randint0(num)) strcpy(desc, buf + 2);
10205 /* Close the file */