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);
336 * Take note to the diary.
338 errr do_cmd_write_nikki(int type, int num, cptr note)
344 cptr note_level = "";
345 bool do_level = TRUE;
346 char note_level_buf[40];
348 static bool disable_nikki = FALSE;
350 extract_day_hour_min(&day, &hour, &min);
352 if (disable_nikki) return(-1);
354 if (type == NIKKI_FIX_QUEST_C ||
355 type == NIKKI_FIX_QUEST_F ||
356 type == NIKKI_RAND_QUEST_C ||
357 type == NIKKI_RAND_QUEST_F ||
358 type == NIKKI_TO_QUEST)
362 old_quest = p_ptr->inside_quest;
363 p_ptr->inside_quest = (quest[num].type == QUEST_TYPE_RANDOM) ? 0 : num;
365 /* Get the quest text */
366 init_flags = INIT_ASSIGN;
368 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
370 /* Reset the old quest number */
371 p_ptr->inside_quest = old_quest;
375 sprintf(file_name,"playrecord-%s.txt",savefile_base);
377 /* different filne name to avoid mixing */
378 sprintf(file_name,"playrec-%s.txt",savefile_base);
381 /* Build the filename */
382 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
384 /* File type is "TEXT" */
385 FILE_TYPE(FILE_TYPE_TEXT);
387 fff = my_fopen(buf, "a");
393 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£¥×¥ì¥¤µÏ¿¤ò°ì»þÄä»ß¤·¤Þ¤¹¡£", buf);
395 msg_format("Failed to open %s. Play-Record is disabled temporally.", buf);
404 if (p_ptr->inside_arena)
406 note_level = "¥¢¥ê¡¼¥Ê:";
408 note_level = "Arane:";
412 note_level = "ÃϾå:";
414 note_level = "Surface:";
416 else if (quest_number(dun_level) && ((quest_number(dun_level) < MIN_RANDOM_QUEST) && !(quest_number(dun_level) == QUEST_OBERON || quest_number(dun_level) == QUEST_SERPENT)))
418 note_level = "¥¯¥¨¥¹¥È:";
420 note_level = "Quest:";
425 sprintf(note_level_buf, "%d³¬(%s):", dun_level, d_name+d_info[dungeon_type].name);
427 sprintf(note_level_buf, "%s L%d:", d_name+d_info[dungeon_type].name, dun_level);
429 note_level = note_level_buf;
438 fprintf(fff, "%dÆüÌÜ\n",day);
440 fprintf(fff, "Day %d\n",day);
449 fprintf(fff, "%s\n",note);
453 fprintf(fff, " %2d:%02d %20s %s\n",hour, min, note_level, note);
459 fprintf(fff, " %2d:%02d %20s %s¤òȯ¸«¤·¤¿¡£\n", hour, min, note_level, note);
461 fprintf(fff, " %2d:%02d %20s discovered %s.\n", hour, min, note_level, note);
468 fprintf(fff, " %2d:%02d %20s %s¤òÅݤ·¤¿¡£\n", hour, min, note_level, note);
470 fprintf(fff, " %2d:%02d %20s defeated %s.\n", hour, min, note_level, note);
474 case NIKKI_FIX_QUEST_C:
476 if (quest[num].flags & QUEST_FLAG_SILENT) break;
478 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
480 fprintf(fff, " %2d:%02d %20s completed quest '%s'.\n", hour, min, note_level, quest[num].name);
484 case NIKKI_FIX_QUEST_F:
486 if (quest[num].flags & QUEST_FLAG_SILENT) break;
488 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤«¤éÌ¿¤«¤é¤¬¤éƨ¤²µ¢¤Ã¤¿¡£\n", hour, min, note_level, quest[num].name);
490 fprintf(fff, " %2d:%02d %20s run away from quest '%s'.\n", hour, min, note_level, quest[num].name);
494 case NIKKI_RAND_QUEST_C:
497 strcpy(name, r_name+r_info[quest[num].r_idx].name);
499 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, name);
501 fprintf(fff, " %2d:%02d %20s completed randome quest '%s'\n", hour, min, note_level, name);
505 case NIKKI_RAND_QUEST_F:
508 strcpy(name, r_name+r_info[quest[num].r_idx].name);
510 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤«¤éƨ¤²½Ð¤·¤¿¡£\n", hour, min, note_level, name);
512 fprintf(fff, " %2d:%02d %20s ran away from quest '%s'.\n", hour, min, note_level, name);
516 case NIKKI_MAXDEAPTH:
519 fprintf(fff, " %2d:%02d %20s %s¤ÎºÇ¿¼³¬%d³¬¤ËÅþ㤷¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, num);
521 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);
528 fprintf(fff, " %2d:%02d %20s %s%s¤ÎºÇ¿¼³¬¤ò%d³¬¤Ë¥»¥Ã¥È¤·¤¿¡£\n", hour, min, note_level, note, d_name + d_info[num].name, max_dlv[num]);
530 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);
537 if (quest_number(dun_level) && ((quest_number(dun_level) < MIN_RANDOM_QUEST) && !(quest_number(dun_level) == QUEST_OBERON || quest_number(dun_level) == QUEST_SERPENT)))
548 if (!(dun_level+num)) to = "ÃϾå";
549 else to = format("%d³¬", dun_level+num);
551 if (!(dun_level+num)) to = "the surface";
552 else to = format("level %d", dun_level+num);
557 fprintf(fff, " %2d:%02d %20s %s¤Ø%s¡£\n", hour, min, note_level, to, note);
559 fprintf(fff, " %2d:%02d %20s %s %s.\n", hour, min, note_level, note, to);
567 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤Æ%s¤Î%d³¬¤Ø²¼¤ê¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, max_dlv[dungeon_type]);
569 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);
573 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤ÆÃϾå¤Ø¤ÈÌá¤Ã¤¿¡£\n", hour, min, note_level);
575 fprintf(fff, " %2d:%02d %20s recalled from dungeon to surface.\n", hour, min, note_level);
581 if (quest[num].flags & QUEST_FLAG_SILENT) break;
583 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤Ø¤ÈÆÍÆþ¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
585 fprintf(fff, " %2d:%02d %20s entered the quest '%s'.\n", hour, min, note_level, quest[num].name);
592 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¡¦¥Æ¥ì¥Ý¡¼¥È¤Çæ½Ð¤·¤¿¡£\n", hour, min, note_level);
594 fprintf(fff, " %2d:%02d %20s Got out using teleport level.\n", hour, min, note_level);
601 fprintf(fff, " %2d:%02d %20s %s¤ò¹ØÆþ¤·¤¿¡£\n", hour, min, note_level, note);
603 fprintf(fff, " %2d:%02d %20s bought %s.\n", hour, min, note_level, note);
610 fprintf(fff, " %2d:%02d %20s %s¤òÇäµÑ¤·¤¿¡£\n", hour, min, note_level, note);
612 fprintf(fff, " %2d:%02d %20s sold %s.\n", hour, min, note_level, note);
622 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï¤Ç¡¢%s¤ÎÁ°¤ËÇÔ¤ìµî¤Ã¤¿¡£\n", hour, min, note_level, p_ptr->arena_number + 1, note);
624 int n = p_ptr->arena_number + 1;
625 fprintf(fff, " %2d:%02d %20s beaten by %s in the %d%s fight.\n", hour, min, note_level, note, n, (n%10==1?"st":n%10==2?"nd":n%10==3?"rd":"th"));
630 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï(%s)¤Ë¾¡Íø¤·¤¿¡£\n", hour, min, note_level, num, note);
632 fprintf(fff, " %2d:%02d %20s won the %d%s fight (%s).\n", hour, min, note_level, num, (num%10==1?"st":num%10==2?"nd":num%10==3?"rd":"th"), note);
634 if (num == MAX_ARENA_MONS)
637 fprintf(fff, " Æ®µ»¾ì¤Î¤¹¤Ù¤Æ¤ÎŨ¤Ë¾¡Íø¤·¡¢¥Á¥ã¥ó¥Ô¥ª¥ó¤È¤Ê¤Ã¤¿¡£\n");
639 fprintf(fff, " won all fight to become a Chanpion.\n");
648 fprintf(fff, " %2d:%02d %20s %s¤ò¼±Ê̤·¤¿¡£\n", hour, min, note_level, note);
650 fprintf(fff, " %2d:%02d %20s identified %s.\n", hour, min, note_level, note);
665 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
667 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
671 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥¦¥£¥¶¡¼¥É¡¦¥Æ¥ì¥Ý¡¼¥È¤Ç°ÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
673 fprintf(fff, " %2d:%02d %20s wizard-teleport to %s.\n", hour, min, note_level, to);
688 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
690 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
694 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥Ñ¥¿¡¼¥ó¤ÎÎϤǰÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
696 fprintf(fff, " %2d:%02d %20s used Pattern to teleport to %s.\n", hour, min, note_level, to);
703 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¤¬%d¤Ë¾å¤¬¤Ã¤¿¡£\n", hour, min, note_level, num);
705 fprintf(fff, " %2d:%02d %20s reached player level %d.\n", hour, min, note_level, num);
709 case NIKKI_GAMESTART:
711 time_t ct = time((time_t*)0);
715 fprintf(fff, "%s %s",note, ctime(&ct));
718 fprintf(fff, " %2d:%02d %20s %s %s",hour, min, note_level, note, ctime(&ct));
721 case NIKKI_NAMED_PET:
723 fprintf(fff, " %2d:%02d %20s ", hour, min, note_level);
728 fprintf(fff, "%s¤òι¤Îͧ¤Ë¤¹¤ë¤³¤È¤Ë·è¤á¤¿¡£\n", note);
730 fprintf(fff, "decided to travel together with %s.\n", note);
735 fprintf(fff, "%s¤Î̾Á°¤ò¾Ã¤·¤¿¡£\n", note);
737 fprintf(fff, "unnamed %s.\n", note);
742 fprintf(fff, "%s¤ò²òÊü¤·¤¿¡£\n", note);
744 fprintf(fff, "dismissed %s.\n", note);
749 fprintf(fff, "%s¤¬»à¤ó¤Ç¤·¤Þ¤Ã¤¿¡£\n", note);
751 fprintf(fff, "%s died.\n", note);
756 fprintf(fff, "%s¤ò¤ª¤¤¤ÆÊ̤ΥޥåפذÜÆ°¤·¤¿¡£\n", note);
758 fprintf(fff, "moved to another map leaving %s behind.\n", note);
763 fprintf(fff, "%s¤È¤Ï¤°¤ì¤Æ¤·¤Þ¤Ã¤¿¡£\n", note);
765 fprintf(fff, "lost sight of %s.\n", note);
770 fprintf(fff, "%s¤¬*Ç˲õ*¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
772 fprintf(fff, "%s was made disappeared by *destruction*.\n", note);
777 fprintf(fff, "%s¤¬´äÀФ˲¡¤·ÄÙ¤µ¤ì¤¿¡£\n", note);
779 fprintf(fff, "%s was crushed by falling rocks.\n", note);
794 if (do_level) write_level = FALSE;
800 #define MAX_SUBTITLE (sizeof(subtitle)/sizeof(subtitle[0]))
802 static void do_cmd_disp_nikki(void)
804 char nikki_title[256];
809 static const char subtitle[][30] = {"ºÇ¶¯¤ÎÆùÂΤòµá¤á¤Æ",
810 "¿ÍÀ¸¤½¤ì¤Ï¤Ï¤«¤Ê¤¤",
821 "Åݤ¹¤Ù¤Å¨¤Ï¥²¡û¥Ä",
822 "¤ó¡Á¡©Ê¹¤³¤¨¤ó¤Ê¤¡",
823 "¥ª¥ì¤Î̾¤ò¸À¤Ã¤Æ¤ß¤í",
824 "Ƭ¤¬ÊѤˤʤäÁ¤ã¤Ã¤¿",
829 "¤³¤ó¤Ê¤â¤ó¤¸¤ã¤Ê¤¤",
838 "ºÇ¹â¤ÎƬǾ¤òµá¤á¤Æ"};
840 static const char subtitle[][51] ={"Quest of The World's Toughest Body",
841 "Attack is the best form of defence.",
843 "An unexpected windfall",
844 "A drowning man will catch at a straw",
845 "Don't count your chickens before they are hatched.",
846 "It is no use crying over spilt milk.",
847 "Seeing is believing.",
848 "Strike the iron while it is hot.",
849 "I don't care what follows.",
850 "To dig a well to put out a house on fire.",
851 "Tomorrow is another day.",
852 "Easy come, easy go.",
853 "The more haste, the less speed.",
854 "Where there is life, there is hope.",
855 "There is no royal road to *WINNER*.",
856 "Danger past, God forgotten.",
857 "The best thing to do now is to run away.",
858 "Life is but an empty dream.",
859 "Dead men tell no tales.",
860 "A book that remains shut is but a block.",
861 "Misfortunes never come singly.",
862 "A little knowledge is a dangerous thing.",
863 "History repeats itself.",
864 "*WINNER* was not built in a day.",
865 "Ignorance is bliss.",
866 "To lose is to win?",
867 "No medicine can cure folly.",
868 "All good things come to an end.",
869 "M$ Empire strikes back.",
870 "To see is to believe",
872 "Quest of The World's Greatest Brain"};
875 sprintf(file_name,"playrecord-%s.txt",savefile_base);
877 sprintf(file_name,"playrec-%s.txt",savefile_base);
880 /* Build the filename */
881 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
883 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_MONK || p_ptr->pclass == CLASS_SAMURAI || p_ptr->pclass == CLASS_BERSERKER)
884 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)]);
885 else if (p_ptr->pclass == CLASS_MAGE || p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
886 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)+1]);
887 else strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-2)+1]);
890 sprintf(nikki_title, "¡Ö%s%s%s¤ÎÅÁÀâ -%s-¡×",
891 ap_ptr->title, ap_ptr->no ? "¤Î" : "", player_name, tmp);
893 sprintf(nikki_title, "Legend of %s %s '%s'",
894 ap_ptr->title, player_name, tmp);
897 /* Display the file contents */
898 show_file(FALSE, buf, nikki_title, -1, 0);
901 static void do_cmd_bunshou(void)
904 char bunshou[80] = "\0";
907 if (get_string("ÆâÍÆ: ", tmp, 79))
909 if (get_string("diary note: ", tmp, 79))
912 strcpy(bunshou, tmp);
914 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, bunshou);
918 static void do_cmd_last_get(void)
923 if (record_o_name[0] == '\0') return;
926 sprintf(buf,"%s¤ÎÆþ¼ê¤òµÏ¿¤·¤Þ¤¹¡£",record_o_name);
928 sprintf(buf,"Do you really want to record getting %s? ",record_o_name);
930 if (!get_check(buf)) return;
935 sprintf(buf,"%s¤ò¼ê¤ËÆþ¤ì¤¿¡£", record_o_name);
937 sprintf(buf,"descover %s.", record_o_name);
939 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
943 static void do_cmd_erase_nikki(void)
950 if (!get_check("ËÜÅö¤ËµÏ¿¤ò¾Ãµî¤·¤Þ¤¹¤«¡©")) return;
952 if (!get_check("Do you really want to delete all your record? ")) return;
956 sprintf(file_name,"playrecord-%s.txt",savefile_base);
958 sprintf(file_name,"playrec-%s.txt",savefile_base);
961 /* Build the filename */
962 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
964 /* Remove the file */
967 fff = my_fopen(buf, "w");
971 msg_format("µÏ¿¤ò¾Ãµî¤·¤Þ¤·¤¿¡£");
973 msg_format("deleted record.");
977 msg_format("%s ¤Î¾Ãµî¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£", buf);
979 msg_format("failed to delete %s.", buf);
986 void do_cmd_nikki(void)
990 /* File type is "TEXT" */
991 FILE_TYPE(FILE_TYPE_TEXT);
993 /* Save the screen */
996 /* Interact until done */
1002 /* Ask for a choice */
1004 prt("[ µÏ¿¤ÎÀßÄê ]", 2, 0);
1006 prt("[ Play Record ]", 2, 0);
1010 /* Give some choices */
1012 prt("(1) µÏ¿¤ò¸«¤ë", 4, 5);
1013 prt("(2) ʸ¾Ï¤òµÏ¿¤¹¤ë", 5, 5);
1014 prt("(3) ľÁ°¤ËÆþ¼êËô¤Ï´ÕÄꤷ¤¿¤â¤Î¤òµÏ¿¤¹¤ë", 6, 5);
1015 prt("(4) µÏ¿¤ò¾Ãµî¤¹¤ë", 7, 5);
1017 prt("(1) Display your record", 4, 5);
1018 prt("(2) Add record", 5, 5);
1019 prt("(3) Record item you last get/identify", 6, 5);
1020 prt("(4) Delete your record", 7, 5);
1026 prt("¥³¥Þ¥ó¥É:", 18, 0);
1028 prt("Command: ", 18, 0);
1036 if (i == ESCAPE) break;
1041 do_cmd_disp_nikki();
1050 do_cmd_erase_nikki();
1052 default: /* Unknown option */
1056 /* Flush messages */
1060 /* Restore the screen */
1065 * Hack -- redraw the screen
1067 * This command performs various low level updates, clears all the "extra"
1068 * windows, does a total redraw of the main window, and requests all of the
1069 * interesting updates and redraws that I can think of.
1071 * This command is also used to "instantiate" the results of the user
1072 * selecting various things, such as graphics mode, so it must call
1073 * the "TERM_XTRA_REACT" hook before redrawing the windows.
1075 void do_cmd_redraw(void)
1082 /* Hack -- react to changes */
1083 Term_xtra(TERM_XTRA_REACT, 0);
1086 /* Combine and Reorder the pack (later) */
1087 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1091 p_ptr->update |= (PU_TORCH);
1094 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
1096 /* Forget lite/view */
1097 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1099 /* Update lite/view */
1100 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
1102 /* Update monsters */
1103 p_ptr->update |= (PU_MONSTERS);
1105 /* Redraw everything */
1106 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1109 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
1112 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
1116 /* Hack -- update */
1119 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
1122 /* Redraw every window */
1123 for (j = 0; j < 8; j++)
1126 if (!angband_term[j]) continue;
1129 Term_activate(angband_term[j]);
1144 * Hack -- change name
1146 void do_cmd_change_name(void)
1155 /* Save the screen */
1163 /* Display the player */
1164 display_player(mode);
1169 display_player(mode);
1174 Term_putstr(2, 23, -1, TERM_WHITE,
1175 "['c'¤Ç̾Á°Êѹ¹, 'f'¤Ç¥Õ¥¡¥¤¥ë¤Ø½ñ½Ð, 'h'¤Ç¥â¡¼¥ÉÊѹ¹, ESC¤Ç½ªÎ»]");
1177 Term_putstr(2, 23, -1, TERM_WHITE,
1178 "['c' to change name, 'f' to file, 'h' to change mode, or ESC]");
1186 if (c == ESCAPE) break;
1193 /* Process the player name */
1194 process_player_name(FALSE);
1200 sprintf(tmp, "%s.txt", player_base);
1202 if (get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
1204 if (get_string("File name: ", tmp, 80))
1208 if (tmp[0] && (tmp[0] != ' '))
1210 file_character(tmp);
1227 /* Flush messages */
1231 /* Restore the screen */
1234 /* Redraw everything */
1235 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1242 * Recall the most recent message
1244 void do_cmd_message_one(void)
1246 /* Recall one message XXX XXX XXX */
1247 prt(format("> %s", message_str(0)), 0, 0);
1252 * Show previous messages to the user -BEN-
1254 * The screen format uses line 0 and 23 for headers and prompts,
1255 * skips line 1 and 22, and uses line 2 thru 21 for old messages.
1257 * This command shows you which commands you are viewing, and allows
1258 * you to "search" for strings in the recall.
1260 * Note that messages may be longer than 80 characters, but they are
1261 * displayed using "infinite" length, with a special sub-command to
1262 * "slide" the virtual display to the left or right.
1264 * Attempt to only hilite the matching portions of the string.
1266 void do_cmd_messages(int num_now)
1277 Term_get_size(&wid, &hgt);
1286 /* Total messages */
1289 /* Start on first message */
1292 /* Start at leftmost edge */
1295 /* Save the screen */
1298 /* Process requests until done */
1304 /* Dump up to 20 lines of messages */
1305 for (j = 0; (j < hgt - 4) && (i + j < n); j++)
1307 cptr msg = message_str(i+j);
1309 /* Apply horizontal scroll */
1310 msg = (strlen(msg) >= q) ? (msg + q) : "";
1312 /* Dump the messages, bottom to top */
1313 Term_putstr(0, hgt-j-3, -1, (bool)(i+j < num_now ? TERM_WHITE : TERM_SLATE), msg);
1315 /* Hilite "shower" */
1320 /* Display matches */
1321 while ((str = strstr(str, shower)) != NULL)
1323 int len = strlen(shower);
1325 /* Display the match */
1326 Term_putstr(str-msg, hgt-j-3, len, TERM_YELLOW, shower);
1334 /* Display header XXX XXX XXX */
1337 prt(format("°ÊÁ°¤Î¥á¥Ã¥»¡¼¥¸ %d-%d Á´Éô¤Ç(%d) ¥ª¥Õ¥»¥Ã¥È(%d)",
1338 i, i+j-1, n, q), 0, 0);
1340 prt(format("Message Recall (%d-%d of %d), Offset %d",
1341 i, i+j-1, n, q), 0, 0);
1345 /* Display prompt (not very informative) */
1347 prt("[ 'p' ¤Ç¹¹¤Ë¸Å¤¤¤â¤Î, 'n' ¤Ç¹¹¤Ë¿·¤·¤¤¤â¤Î, '/' ¤Ç¸¡º÷, ESC ¤ÇÃæÃÇ ]", hgt - 1, 0);
1349 prt("[Press 'p' for older, 'n' for newer, ..., or ESCAPE]", hgt - 1, 0);
1356 /* Exit on Escape */
1357 if (k == ESCAPE) break;
1359 /* Hack -- Save the old index */
1362 /* Horizontal scroll */
1366 q = (q >= 40) ? (q - 40) : 0;
1372 /* Horizontal scroll */
1382 /* Hack -- handle show */
1387 prt("¶¯Ä´: ", hgt - 1, 0);
1389 prt("Show: ", hgt - 1, 0);
1393 /* Get a "shower" string, or continue */
1394 if (!askfor_aux(shower, 80)) continue;
1400 /* Hack -- handle find */
1407 prt("¸¡º÷: ", hgt - 1, 0);
1409 prt("Find: ", hgt - 1, 0);
1413 /* Get a "finder" string, or continue */
1414 if (!askfor_aux(finder, 80)) continue;
1417 strcpy(shower, finder);
1420 for (z = i + 1; z < n; z++)
1422 cptr msg = message_str(z);
1425 if (strstr(msg, finder))
1436 /* Recall 1 older message */
1437 if ((k == '8') || (k == '\n') || (k == '\r'))
1439 /* Go newer if legal */
1440 if (i + 1 < n) i += 1;
1443 /* Recall 10 older messages */
1446 /* Go older if legal */
1447 if (i + 10 < n) i += 10;
1450 /* Recall 20 older messages */
1451 if ((k == 'p') || (k == KTRL('P')) || (k == ' '))
1453 /* Go older if legal */
1454 if (i + 20 < n) i += 20;
1457 /* Recall 20 newer messages */
1458 if ((k == 'n') || (k == KTRL('N')))
1460 /* Go newer (if able) */
1461 i = (i >= 20) ? (i - 20) : 0;
1464 /* Recall 10 newer messages */
1467 /* Go newer (if able) */
1468 i = (i >= 20) ? (i - 20) : 0;
1471 /* Recall 1 newer messages */
1474 /* Go newer (if able) */
1475 i = (i >= 1) ? (i - 1) : 0;
1478 /* Hack -- Error of some kind */
1482 /* Restore the screen */
1489 * Number of cheating options
1496 static option_type cheat_info[CHEAT_MAX] =
1498 { &cheat_peek, FALSE, 255, 0x01, 0x00,
1500 "cheat_peek", "¥¢¥¤¥Æ¥à¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1502 "cheat_peek", "Peek into object creation"
1506 { &cheat_hear, FALSE, 255, 0x02, 0x00,
1508 "cheat_hear", "¥â¥ó¥¹¥¿¡¼¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1510 "cheat_hear", "Peek into monster creation"
1514 { &cheat_room, FALSE, 255, 0x04, 0x00,
1516 "cheat_room", "¥À¥ó¥¸¥ç¥ó¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1518 "cheat_room", "Peek into dungeon creation"
1522 { &cheat_xtra, FALSE, 255, 0x08, 0x00,
1524 "cheat_xtra", "¤½¤Î¾¤Î»ö¤ò¤Î¤¾¤¸«¤ë"
1526 "cheat_xtra", "Peek into something else"
1530 { &cheat_know, FALSE, 255, 0x10, 0x00,
1532 "cheat_know", "´°Á´¤Ê¥â¥ó¥¹¥¿¡¼¤Î»×¤¤½Ð¤òÃΤë"
1534 "cheat_know", "Know complete monster info"
1538 { &cheat_live, FALSE, 255, 0x20, 0x00,
1540 "cheat_live", "»à¤ò²óÈò¤¹¤ë¤³¤È¤ò²Äǽ¤Ë¤¹¤ë"
1542 "cheat_live", "Allow player to avoid death"
1546 { &cheat_save, FALSE, 255, 0x40, 0x00,
1548 "cheat_save", "»à¤ó¤À»þ¥»¡¼¥Ö¤¹¤ë¤«³Îǧ¤¹¤ë"
1550 "cheat_save", "Ask for saving death"
1556 * Interact with some options for cheating
1558 static void do_cmd_options_cheat(cptr info)
1562 int i, k = 0, n = CHEAT_MAX;
1570 /* Interact with the player */
1575 /* Prompt XXX XXX XXX */
1577 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, ESC ¤Ç·èÄê )", info);
1579 sprintf(buf, "%s (RET to advance, y/n to set, ESC to accept) ", info);
1585 /* º¾µ½¥ª¥×¥·¥ç¥ó¤ò¤¦¤Ã¤«¤ê¤¤¤¸¤Ã¤Æ¤·¤Þ¤¦¿Í¤¬¤¤¤ë¤è¤¦¤Ê¤Î¤ÇÃí°Õ */
1586 prt(" << Ãí°Õ >>", 11, 0);
1587 prt(" º¾µ½¥ª¥×¥·¥ç¥ó¤ò°ìÅ٤ǤâÀßÄꤹ¤ë¤È¡¢¥¹¥³¥¢µÏ¿¤¬»Ä¤é¤Ê¤¯¤Ê¤ê¤Þ¤¹¡ª", 12, 0);
1588 prt(" ¸å¤Ë²ò½ü¤·¤Æ¤â¥À¥á¤Ç¤¹¤Î¤Ç¡¢¾¡Íø¼Ô¤òÌܻؤ¹Êý¤Ï¤³¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¤¤", 13, 0);
1589 prt(" ¤¸¤é¤Ê¤¤¤è¤¦¤Ë¤·¤Æ²¼¤µ¤¤¡£", 14, 0);
1591 /* Display the options */
1592 for (i = 0; i < n; i++)
1594 byte a = TERM_WHITE;
1596 /* Color current option */
1597 if (i == k) a = TERM_L_BLUE;
1599 /* Display the option text */
1600 sprintf(buf, "%-48s: %s (%s)",
1601 cheat_info[i].o_desc,
1603 (*cheat_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1605 (*cheat_info[i].o_var ? "yes" : "no "),
1608 cheat_info[i].o_text);
1609 c_prt(a, buf, i + 2, 0);
1612 /* Hilite current option */
1613 move_cursor(k + 2, 50);
1619 * HACK - Try to translate the key into a direction
1620 * to allow using the roguelike keys for navigation.
1622 dir = get_keymap_dir(ch);
1623 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1637 k = (n + k - 1) % n;
1656 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "º¾µ½¥ª¥×¥·¥ç¥ó¤òON¤Ë¤·¤Æ¡¢¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
1658 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use cheating options.");
1660 p_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit);
1661 (*cheat_info[k].o_var) = TRUE;
1670 (*cheat_info[k].o_var) = FALSE;
1678 strnfmt(buf, sizeof(buf), "joption.txt#%s", cheat_info[k].o_text);
1680 strnfmt(buf, sizeof(buf), "option.txt#%s", cheat_info[k].o_text);
1682 /* Peruse the help file */
1683 (void)show_file(TRUE, buf, NULL, 0, 0);
1699 static option_type autosave_info[2] =
1701 { &autosave_l, FALSE, 255, 0x01, 0x00,
1703 "autosave_l", "¿·¤·¤¤³¬¤ËÆþ¤ëÅ٤˼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1705 "autosave_l", "Autosave when entering new levels" },
1709 { &autosave_t, FALSE, 255, 0x02, 0x00,
1711 "autosave_t", "°ìÄ꥿¡¼¥óËè¤Ë¼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1713 "autosave_t", "Timed autosave" },
1719 static s16b toggle_frequency(s16b current)
1724 case 50: return 100;
1725 case 100: return 250;
1726 case 250: return 500;
1727 case 500: return 1000;
1728 case 1000: return 2500;
1729 case 2500: return 5000;
1730 case 5000: return 10000;
1731 case 10000: return 25000;
1738 * Interact with some options for cheating
1740 static void do_cmd_options_autosave(cptr info)
1744 int i, k = 0, n = 2;
1752 /* Interact with the player */
1755 /* Prompt XXX XXX XXX */
1757 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, F ¤ÇÉÑÅÙ¤òÆþÎÏ, ESC ¤Ç·èÄê ) ", info);
1759 sprintf(buf, "%s (RET to advance, y/n to set, 'F' for frequency, ESC to accept) ", info);
1764 /* Display the options */
1765 for (i = 0; i < n; i++)
1767 byte a = TERM_WHITE;
1769 /* Color current option */
1770 if (i == k) a = TERM_L_BLUE;
1772 /* Display the option text */
1773 sprintf(buf, "%-48s: %s (%s)",
1774 autosave_info[i].o_desc,
1776 (*autosave_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1778 (*autosave_info[i].o_var ? "yes" : "no "),
1781 autosave_info[i].o_text);
1782 c_prt(a, buf, i + 2, 0);
1786 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè", autosave_freq), 5, 0);
1788 prt(format("Timed autosave frequency: every %d turns", autosave_freq), 5, 0);
1793 /* Hilite current option */
1794 move_cursor(k + 2, 50);
1810 k = (n + k - 1) % n;
1828 (*autosave_info[k].o_var) = TRUE;
1837 (*autosave_info[k].o_var) = FALSE;
1845 autosave_freq = toggle_frequency(autosave_freq);
1847 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè",
1848 autosave_freq), 5, 0);
1850 prt(format("Timed autosave frequency: every %d turns",
1851 autosave_freq), 5, 0);
1859 (void)show_file(TRUE, "joption.txt#Autosave", NULL, 0, 0);
1861 (void)show_file(TRUE, "option.txt#Autosave", NULL, 0, 0);
1879 #define PAGE_AUTODESTROY 7
1882 * Interact with some options
1884 void do_cmd_options_aux(int page, cptr info)
1887 int i, k = 0, n = 0, l;
1892 /* Lookup the options */
1893 for (i = 0; i < 24; i++) opt[i] = 0;
1895 /* Scan the options */
1896 for (i = 0; option_info[i].o_desc; i++)
1898 /* Notice options on this "page" */
1899 if (option_info[i].o_page == page) opt[n++] = i;
1906 /* Interact with the player */
1911 /* Prompt XXX XXX XXX */
1913 sprintf(buf, "%s (¥ê¥¿¡¼¥ó:¼¡, y/n:Êѹ¹, ESC:½ªÎ», ?:¥Ø¥ë¥×) ", info);
1915 sprintf(buf, "%s (RET:next, y/n:change, ESC:accept, ?:help) ", info);
1921 /* HACK -- description for easy-auto-destroy options */
1923 if (page == PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "°Ê²¼¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢´Ê°×¼«Æ°Ç˲õ¤ò»ÈÍѤ¹¤ë¤È¤¤Î¤ß͸ú", 6, 6);
1925 if (page == PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "Following options will protect items from easy auto-destroyer.", 6, 3);
1928 /* Display the options */
1929 for (i = 0; i < n; i++)
1931 byte a = TERM_WHITE;
1933 /* Color current option */
1934 if (i == k) a = TERM_L_BLUE;
1936 /* Display the option text */
1937 sprintf(buf, "%-48s: %s (%.19s)",
1938 option_info[opt[i]].o_desc,
1940 (*option_info[opt[i]].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1942 (*option_info[opt[i]].o_var ? "yes" : "no "),
1945 option_info[opt[i]].o_text);
1946 if ((page == PAGE_AUTODESTROY) && i > 2) c_prt(a, buf, i + 5, 0);
1947 else c_prt(a, buf, i + 2, 0);
1950 if ((page == PAGE_AUTODESTROY) && (k > 2)) l = 3;
1953 /* Hilite current option */
1954 move_cursor(k + 2 + l, 50);
1960 * HACK - Try to translate the key into a direction
1961 * to allow using the roguelike keys for navigation.
1963 dir = get_keymap_dir(ch);
1964 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1978 k = (n + k - 1) % n;
1995 (*option_info[opt[k]].o_var) = TRUE;
2004 (*option_info[opt[k]].o_var) = FALSE;
2012 (*option_info[opt[k]].o_var) = !(*option_info[opt[k]].o_var);
2019 strnfmt(buf, sizeof(buf), "joption.txt#%s", option_info[opt[k]].o_text);
2021 strnfmt(buf, sizeof(buf), "option.txt#%s", option_info[opt[k]].o_text);
2023 /* Peruse the help file */
2024 (void)show_file(TRUE, buf, NULL, 0, 0);
2041 * Modify the "window" options
2043 static void do_cmd_options_win(void)
2057 /* Memorize old flags */
2058 for (j = 0; j < 8; j++)
2060 /* Acquire current flags */
2061 old_flag[j] = window_flag[j];
2071 /* Prompt XXX XXX XXX */
2073 prt("¥¦¥£¥ó¥É¥¦¡¦¥Õ¥é¥° (<Êý¸þ>¤Ç°ÜÆ°, t¤Ç¥Á¥§¥ó¥¸, y/n ¤Ç¥»¥Ã¥È, ESC)", 0, 0);
2075 prt("Window Flags (<dir>, t, y, n, ESC) ", 0, 0);
2079 /* Display the windows */
2080 for (j = 0; j < 8; j++)
2082 byte a = TERM_WHITE;
2084 cptr s = angband_term_name[j];
2087 if (j == x) a = TERM_L_BLUE;
2089 /* Window name, staggered, centered */
2090 Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s);
2093 /* Display the options */
2094 for (i = 0; i < 16; i++)
2096 byte a = TERM_WHITE;
2098 cptr str = window_flag_desc[i];
2101 if (i == y) a = TERM_L_BLUE;
2105 if (!str) str = "(̤»ÈÍÑ)";
2107 if (!str) str = "(Unused option)";
2112 Term_putstr(0, i + 5, -1, a, str);
2114 /* Display the windows */
2115 for (j = 0; j < 8; j++)
2117 byte a = TERM_WHITE;
2122 if ((i == y) && (j == x)) a = TERM_L_BLUE;
2125 if (window_flag[j] & (1L << i)) c = 'X';
2128 Term_putch(35 + j * 5, i + 5, a, c);
2133 Term_gotoxy(35 + x * 5, y + 5);
2151 for (j = 0; j < 8; j++)
2153 window_flag[j] &= ~(1L << y);
2157 for (i = 0; i < 16; i++)
2159 window_flag[x] &= ~(1L << i);
2172 window_flag[x] |= (1L << y);
2180 window_flag[x] &= ~(1L << y);
2187 (void)show_file(TRUE, "joption.txt#Window", NULL, 0, 0);
2189 (void)show_file(TRUE, "option.txt#Window", NULL, 0, 0);
2199 d = get_keymap_dir(ch);
2201 x = (x + ddx[d] + 8) % 8;
2202 y = (y + ddy[d] + 16) % 16;
2209 /* Notice changes */
2210 for (j = 0; j < 8; j++)
2215 if (!angband_term[j]) continue;
2217 /* Ignore non-changes */
2218 if (window_flag[j] == old_flag[j]) continue;
2221 Term_activate(angband_term[j]);
2238 * Set or unset various options.
2240 * The user must use the "Ctrl-R" command to "adapt" to changes
2241 * in any options which control "visual" aspects of the game.
2243 void do_cmd_options(void)
2248 /* Save the screen */
2257 /* Why are we here */
2259 prt("[ ¥ª¥×¥·¥ç¥ó¤ÎÀßÄê ]", 2, 0);
2261 prt("Options", 2, 0);
2265 /* Give some choices */
2267 prt("(1) ¥¡¼ÆþÎÏ ¥ª¥×¥·¥ç¥ó", 4, 5);
2268 prt("(2) ²èÌ̽ÐÎÏ ¥ª¥×¥·¥ç¥ó", 5, 5);
2269 prt("(3) ¥²¡¼¥à¥×¥ì¥¤ ¥ª¥×¥·¥ç¥ó", 6, 5);
2270 prt("(4) ¹ÔÆ°Ãæ»ß´Ø·¸ ¥ª¥×¥·¥ç¥ó", 7, 5);
2271 prt("(5) ¸úΨ²½ ¥ª¥×¥·¥ç¥ó", 8, 5);
2272 prt("(6) ´Ê°×¥¢¥¤¥Æ¥à¼«Æ°Ç˲õ ¥ª¥×¥·¥ç¥ó", 9, 5);
2273 prt("(R) ¥×¥ì¥¤µÏ¿ ¥ª¥×¥·¥ç¥ó", 10, 5);
2274 /* Special choices */
2275 prt("(D) ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 12, 5);
2276 prt("(H) Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 13, 5);
2277 prt("(A) ¼«Æ°¥»¡¼¥Ö ¥ª¥×¥·¥ç¥ó", 14, 5);
2279 prt("(W) ¥¦¥¤¥ó¥É¥¦¥Õ¥é¥°", 15, 5);
2281 prt("(1) Input Options", 4, 5);
2282 prt("(2) Output Options", 5, 5);
2283 prt("(3) Game-Play Options", 6, 5);
2284 prt("(4) Disturbance Options", 7, 5);
2285 prt("(5) Efficiency Options", 8, 5);
2286 prt("(6) Easy Auto-Destroyer Options", 9, 5);
2287 prt("(R) Play-record Options", 10, 5);
2289 /* Special choices */
2290 prt("(D) Base Delay Factor", 12, 5);
2291 prt("(H) Hitpoint Warning", 13, 5);
2292 prt("(A) Autosave Options", 14, 5);
2296 prt("(W) Window Flags", 15, 5);
2299 if (p_ptr->noscore || allow_debug_opts)
2303 prt("(C) º¾µ½ ¥ª¥×¥·¥ç¥ó", 16, 5);
2305 prt("(C) Cheating Options", 16, 5);
2312 prt("¥³¥Þ¥ó¥É:", 18, 0);
2314 prt("Command: ", 18, 0);
2322 if (k == ESCAPE) break;
2327 /* General Options */
2330 /* Process the general options */
2332 do_cmd_options_aux(1, "¥¡¼ÆþÎÏ¥ª¥×¥·¥ç¥ó");
2334 do_cmd_options_aux(1, "Input Options");
2340 /* General Options */
2343 /* Process the general options */
2345 do_cmd_options_aux(2, "²èÌ̽ÐÎÏ¥ª¥×¥·¥ç¥ó");
2347 do_cmd_options_aux(2, "Output Options");
2353 /* Inventory Options */
2358 do_cmd_options_aux(3, "¥²¡¼¥à¥×¥ì¥¤¡¦¥ª¥×¥·¥ç¥ó");
2360 do_cmd_options_aux(3, "Game-Play Options");
2366 /* Disturbance Options */
2371 do_cmd_options_aux(4, "¹ÔÆ°Ãæ»ß´Ø·¸¤Î¥ª¥×¥·¥ç¥ó");
2373 do_cmd_options_aux(4, "Disturbance Options");
2379 /* Efficiency Options */
2384 do_cmd_options_aux(5, "¸úΨ²½¥ª¥×¥·¥ç¥ó");
2386 do_cmd_options_aux(5, "Efficiency Options");
2392 /* Object auto-destruction Options */
2397 do_cmd_options_aux(7, "´Ê°×¥¢¥¤¥Æ¥à¼«Æ°Ç˲õ¥ª¥×¥·¥ç¥ó");
2399 do_cmd_options_aux(7, "Easy Auto-Destroyer Options");
2404 /* Play-record Options */
2410 do_cmd_options_aux(10, "¥×¥ì¥¤µÏ¿¥ª¥×¥·¥ç¥ó");
2412 do_cmd_options_aux(10, "Play-record Option");
2417 /* Cheating Options */
2420 if (!p_ptr->noscore && !allow_debug_opts)
2422 /* Cheat options are not permitted */
2429 do_cmd_options_cheat("º¾µ½»Õ¤Ï·è¤·¤Æ¾¡Íø¤Ç¤¤Ê¤¤¡ª");
2431 do_cmd_options_cheat("Cheaters never win");
2441 do_cmd_options_autosave("¼«Æ°¥»¡¼¥Ö");
2443 do_cmd_options_autosave("Autosave");
2454 do_cmd_options_win();
2455 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL |
2456 PW_PLAYER | PW_MESSAGE | PW_OVERHEAD |
2457 PW_MONSTER | PW_OBJECT | PW_SNAPSHOT |
2458 PW_BORG_1 | PW_BORG_2 | PW_DUNGEON);
2462 /* Hack -- Delay Speed */
2468 prt("¥³¥Þ¥ó¥É: ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 18, 0);
2470 prt("Command: Base Delay Factor", 18, 0);
2474 /* Get a new value */
2477 int msec = delay_factor * delay_factor * delay_factor;
2479 prt(format("¸½ºß¤Î¥¦¥§¥¤¥È: %d (%d¥ß¥êÉÃ)",
2480 delay_factor, msec), 22, 0);
2482 prt(format("Current base delay factor: %d (%d msec)",
2483 delay_factor, msec), 22, 0);
2487 prt("¥¦¥§¥¤¥È (0-9) ESC¤Ç·èÄê: ", 20, 0);
2489 prt("Delay Factor (0-9 or ESC to accept): ", 20, 0);
2493 if (k == ESCAPE) break;
2497 (void)show_file(TRUE, "joption.txt#BaseDelay", NULL, 0, 0);
2499 (void)show_file(TRUE, "option.txt#BaseDelay", NULL, 0, 0);
2503 else if (isdigit(k)) delay_factor = D2I(k);
2510 /* Hack -- hitpoint warning factor */
2516 prt("¥³¥Þ¥ó¥É: Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 18, 0);
2518 prt("Command: Hitpoint Warning", 18, 0);
2522 /* Get a new value */
2526 prt(format("¸½ºß¤ÎÄã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð: %d0%%",
2527 hitpoint_warn), 22, 0);
2529 prt(format("Current hitpoint warning: %d0%%",
2530 hitpoint_warn), 22, 0);
2534 prt("Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð (0-9) ESC¤Ç·èÄê: ", 20, 0);
2536 prt("Hitpoint Warning (0-9 or ESC to accept): ", 20, 0);
2540 if (k == ESCAPE) break;
2544 (void)show_file(TRUE, "joption.txt#Hitpoint", NULL, 0, 0);
2546 (void)show_file(TRUE, "option.txt#Hitpoint", NULL, 0, 0);
2550 else if (isdigit(k)) hitpoint_warn = D2I(k);
2559 (void)show_file(TRUE, "joption.txt", NULL, 0, 0);
2561 (void)show_file(TRUE, "option.txt", NULL, 0, 0);
2566 /* Unknown option */
2575 /* Flush messages */
2580 /* Restore the screen */
2583 /* Hack - Redraw equippy chars */
2584 p_ptr->redraw |= (PR_EQUIPPY);
2590 * Ask for a "user pref line" and process it
2592 * XXX XXX XXX Allow absolute file names?
2594 void do_cmd_pref(void)
2601 /* Ask for a "user pref command" */
2603 if (!get_string("ÀßÄêÊѹ¹¥³¥Þ¥ó¥É: ", buf, 80)) return;
2605 if (!get_string("Pref: ", buf, 80)) return;
2609 /* Process that pref command */
2610 (void)process_pref_file_command(buf);
2613 void do_cmd_pickpref(void)
2619 if(!get_check("¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹¤«? ")) return;
2621 if(!get_check("Reload auto-pick preference file? ")) return;
2624 /* Free old entries */
2627 /* ¥¥ã¥éËè¤ÎÀßÄê¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß */
2629 sprintf(buf, "picktype-%s.prf", player_name);
2631 sprintf(buf, "pickpref-%s.prf", player_name);
2633 err = process_pickpref_file(buf);
2638 msg_format("%s¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", buf);
2640 msg_format("loaded '%s'.", buf);
2644 /* ¶¦Ä̤ÎÀßÄê¥Õ¥¡¥¤¥ëÆɤ߹þ¤ß */
2646 /* Process 'pick????.prf' if 'pick????-<name>.prf' doesn't exist */
2650 err = process_pickpref_file("picktype.prf");
2652 err = process_pickpref_file("pickpref.prf");
2658 msg_print("picktype.prf¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£");
2660 msg_print("loaded 'pickpref.prf'.");
2667 if(err) msg_print("¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
2669 if(err) msg_print("Failed to reload autopick preference.");
2676 * Hack -- append all current macros to the given file
2678 static errr macro_dump(cptr fname)
2680 static cptr mark = "Macro Dump";
2686 /* Build the filename */
2687 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2689 /* File type is "TEXT" */
2690 FILE_TYPE(FILE_TYPE_TEXT);
2692 /* Append to the file */
2693 if (!open_auto_dump(buf, mark)) return (-1);
2697 auto_dump_printf("\n# ¼«Æ°¥Þ¥¯¥í¥»¡¼¥Ö\n\n");
2699 auto_dump_printf("\n# Automatic macro dump\n\n");
2703 for (i = 0; i < macro__num; i++)
2705 /* Extract the action */
2706 ascii_to_text(buf, macro__act[i]);
2708 /* Dump the macro */
2709 auto_dump_printf("A:%s\n", buf);
2711 /* Extract the action */
2712 ascii_to_text(buf, macro__pat[i]);
2714 /* Dump normal macros */
2715 auto_dump_printf("P:%s\n", buf);
2718 auto_dump_printf("\n");
2730 * Hack -- ask for a "trigger" (see below)
2732 * Note the complex use of the "inkey()" function from "util.c".
2734 * Note that both "flush()" calls are extremely important.
2736 static void do_cmd_macro_aux(char *buf)
2746 /* Do not process macros */
2752 /* Read the pattern */
2758 /* Do not process macros */
2761 /* Do not wait for keys */
2764 /* Attempt to read a key */
2775 /* Convert the trigger */
2776 ascii_to_text(tmp, buf);
2778 /* Hack -- display the trigger */
2779 Term_addstr(-1, TERM_WHITE, tmp);
2786 * Hack -- ask for a keymap "trigger" (see below)
2788 * Note that both "flush()" calls are extremely important. This may
2789 * no longer be true, since "util.c" is much simpler now. XXX XXX XXX
2791 static void do_cmd_macro_aux_keymap(char *buf)
2805 /* Convert to ascii */
2806 ascii_to_text(tmp, buf);
2808 /* Hack -- display the trigger */
2809 Term_addstr(-1, TERM_WHITE, tmp);
2818 * Hack -- append all keymaps to the given file
2820 static errr keymap_dump(cptr fname)
2822 static cptr mark = "Keymap Dump";
2831 if (rogue_like_commands)
2833 mode = KEYMAP_MODE_ROGUE;
2839 mode = KEYMAP_MODE_ORIG;
2843 /* Build the filename */
2844 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2846 /* File type is "TEXT" */
2847 FILE_TYPE(FILE_TYPE_TEXT);
2849 /* Append to the file */
2850 if (!open_auto_dump(buf, mark)) return -1;
2854 auto_dump_printf("\n# ¼«Æ°¥¡¼ÇÛÃÖ¥»¡¼¥Ö\n\n");
2856 auto_dump_printf("\n# Automatic keymap dump\n\n");
2860 for (i = 0; i < 256; i++)
2864 /* Loop up the keymap */
2865 act = keymap_act[mode][i];
2867 /* Skip empty keymaps */
2870 /* Encode the key */
2873 ascii_to_text(key, buf);
2875 /* Encode the action */
2876 ascii_to_text(buf, act);
2878 /* Dump the macro */
2879 auto_dump_printf("A:%s\n", buf);
2880 auto_dump_printf("C:%d:%s\n", mode, key);
2893 * Interact with "macros"
2895 * Note that the macro "action" must be defined before the trigger.
2897 * Could use some helpful instructions on this page. XXX XXX XXX
2899 void do_cmd_macros(void)
2911 if (rogue_like_commands)
2913 mode = KEYMAP_MODE_ROGUE;
2919 mode = KEYMAP_MODE_ORIG;
2922 /* File type is "TEXT" */
2923 FILE_TYPE(FILE_TYPE_TEXT);
2930 /* Process requests until done */
2938 prt("[ ¥Þ¥¯¥í¤ÎÀßÄê ]", 2, 0);
2940 prt("Interact with Macros", 2, 0);
2945 /* Describe that action */
2947 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
2949 prt("Current action (if any) shown below:", 20, 0);
2953 /* Analyze the current action */
2954 ascii_to_text(buf, macro__buf);
2956 /* Display the current action */
2962 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
2964 prt("(1) Load a user pref file", 4, 5);
2969 prt("(2) ¥Õ¥¡¥¤¥ë¤Ë¥Þ¥¯¥í¤òÄɲÃ", 5, 5);
2970 prt("(3) ¥Þ¥¯¥í¤Î³Îǧ", 6, 5);
2971 prt("(4) ¥Þ¥¯¥í¤ÎºîÀ®", 7, 5);
2972 prt("(5) ¥Þ¥¯¥í¤Îºï½ü", 8, 5);
2973 prt("(6) ¥Õ¥¡¥¤¥ë¤Ë¥¡¼ÇÛÃÖ¤òÄɲÃ", 9, 5);
2974 prt("(7) ¥¡¼ÇÛÃ֤γÎǧ", 10, 5);
2975 prt("(8) ¥¡¼ÇÛÃ֤κîÀ®", 11, 5);
2976 prt("(9) ¥¡¼ÇÛÃ֤κï½ü", 12, 5);
2977 prt("(0) ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 13, 5);
2979 prt("(2) Append macros to a file", 5, 5);
2980 prt("(3) Query a macro", 6, 5);
2981 prt("(4) Create a macro", 7, 5);
2982 prt("(5) Remove a macro", 8, 5);
2983 prt("(6) Append keymaps to a file", 9, 5);
2984 prt("(7) Query a keymap", 10, 5);
2985 prt("(8) Create a keymap", 11, 5);
2986 prt("(9) Remove a keymap", 12, 5);
2987 prt("(0) Enter a new action", 13, 5);
2990 #endif /* ALLOW_MACROS */
2994 prt("¥³¥Þ¥ó¥É: ", 16, 0);
2996 prt("Command: ", 16, 0);
3004 if (i == ESCAPE) break;
3006 /* Load a 'macro' file */
3013 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 16, 0);
3015 prt("Command: Load a user pref file", 16, 0);
3021 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3023 prt("File: ", 18, 0);
3027 /* Default filename */
3028 sprintf(tmp, "%s.prf", player_name);
3030 /* Ask for a file */
3031 if (!askfor_aux(tmp, 80)) continue;
3033 /* Process the given filename */
3034 err = process_pref_file(tmp);
3038 msg_format("ɸ½à¤ÎÀßÄê¥Õ¥¡¥¤¥ë'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3040 msg_format("Loaded default '%s'.", tmp);
3047 msg_format("'%s'¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡ª", tmp);
3049 msg_format("Failed to load '%s'!");
3055 msg_format("'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3057 msg_format("Loaded '%s'.", tmp);
3069 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3071 prt("Command: Append macros to a file", 16, 0);
3077 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3079 prt("File: ", 18, 0);
3083 /* Default filename */
3084 sprintf(tmp, "%s.prf", player_name);
3086 /* Ask for a file */
3087 if (!askfor_aux(tmp, 80)) continue;
3089 /* Dump the macros */
3090 (void)macro_dump(tmp);
3094 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3096 msg_print("Appended macros.");
3108 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Î³Îǧ", 16, 0);
3110 prt("Command: Query a macro", 16, 0);
3116 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3118 prt("Trigger: ", 18, 0);
3122 /* Get a macro trigger */
3123 do_cmd_macro_aux(buf);
3125 /* Acquire action */
3126 k = macro_find_exact(buf);
3133 msg_print("¤½¤Î¥¡¼¤Ë¤Ï¥Þ¥¯¥í¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3135 msg_print("Found no macro.");
3143 /* Obtain the action */
3144 strcpy(macro__buf, macro__act[k]);
3146 /* Analyze the current action */
3147 ascii_to_text(buf, macro__buf);
3149 /* Display the current action */
3154 msg_print("¥Þ¥¯¥í¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3156 msg_print("Found a macro.");
3162 /* Create a macro */
3167 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ÎºîÀ®", 16, 0);
3169 prt("Command: Create a macro", 16, 0);
3175 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3177 prt("Trigger: ", 18, 0);
3181 /* Get a macro trigger */
3182 do_cmd_macro_aux(buf);
3189 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3191 prt("Action: ", 20, 0);
3195 /* Convert to text */
3196 ascii_to_text(tmp, macro__buf);
3198 /* Get an encoded action */
3199 if (askfor_aux(tmp, 80))
3201 /* Convert to ascii */
3202 text_to_ascii(macro__buf, tmp);
3204 /* Link the macro */
3205 macro_add(buf, macro__buf);
3209 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3211 msg_print("Added a macro.");
3217 /* Remove a macro */
3222 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Îºï½ü", 16, 0);
3224 prt("Command: Remove a macro", 16, 0);
3230 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3232 prt("Trigger: ", 18, 0);
3236 /* Get a macro trigger */
3237 do_cmd_macro_aux(buf);
3239 /* Link the macro */
3240 macro_add(buf, buf);
3244 msg_print("¥Þ¥¯¥í¤òºï½ü¤·¤Þ¤·¤¿¡£");
3246 msg_print("Removed a macro.");
3256 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃÖ¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3258 prt("Command: Append keymaps to a file", 16, 0);
3264 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3266 prt("File: ", 18, 0);
3270 /* Default filename */
3271 sprintf(tmp, "%s.prf", player_name);
3273 /* Ask for a file */
3274 if (!askfor_aux(tmp, 80)) continue;
3276 /* Dump the macros */
3277 (void)keymap_dump(tmp);
3281 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3283 msg_print("Appended keymaps.");
3288 /* Query a keymap */
3295 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤γÎǧ", 16, 0);
3297 prt("Command: Query a keymap", 16, 0);
3303 prt("²¡¤¹¥¡¼: ", 18, 0);
3305 prt("Keypress: ", 18, 0);
3309 /* Get a keymap trigger */
3310 do_cmd_macro_aux_keymap(buf);
3312 /* Look up the keymap */
3313 act = keymap_act[mode][(byte)(buf[0])];
3320 msg_print("¥¡¼ÇÛÃÖ¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3322 msg_print("Found no keymap.");
3330 /* Obtain the action */
3331 strcpy(macro__buf, act);
3333 /* Analyze the current action */
3334 ascii_to_text(buf, macro__buf);
3336 /* Display the current action */
3341 msg_print("¥¡¼ÇÛÃÖ¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3343 msg_print("Found a keymap.");
3349 /* Create a keymap */
3354 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κîÀ®", 16, 0);
3356 prt("Command: Create a keymap", 16, 0);
3362 prt("²¡¤¹¥¡¼: ", 18, 0);
3364 prt("Keypress: ", 18, 0);
3368 /* Get a keymap trigger */
3369 do_cmd_macro_aux_keymap(buf);
3376 prt("¹ÔÆ°: ", 20, 0);
3378 prt("Action: ", 20, 0);
3382 /* Convert to text */
3383 ascii_to_text(tmp, macro__buf);
3385 /* Get an encoded action */
3386 if (askfor_aux(tmp, 80))
3388 /* Convert to ascii */
3389 text_to_ascii(macro__buf, tmp);
3391 /* Free old keymap */
3392 string_free(keymap_act[mode][(byte)(buf[0])]);
3394 /* Make new keymap */
3395 keymap_act[mode][(byte)(buf[0])] = string_make(macro__buf);
3399 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3401 msg_print("Added a keymap.");
3407 /* Remove a keymap */
3412 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κï½ü", 16, 0);
3414 prt("Command: Remove a keymap", 16, 0);
3420 prt("²¡¤¹¥¡¼: ", 18, 0);
3422 prt("Keypress: ", 18, 0);
3426 /* Get a keymap trigger */
3427 do_cmd_macro_aux_keymap(buf);
3429 /* Free old keymap */
3430 string_free(keymap_act[mode][(byte)(buf[0])]);
3432 /* Make new keymap */
3433 keymap_act[mode][(byte)(buf[0])] = NULL;
3437 msg_print("¥¡¼ÇÛÃÖ¤òºï½ü¤·¤Þ¤·¤¿¡£");
3439 msg_print("Removed a keymap.");
3444 /* Enter a new action */
3449 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 16, 0);
3451 prt("Command: Enter a new action", 16, 0);
3455 /* Go to the correct location */
3458 /* Hack -- limit the value */
3461 /* Get an encoded action */
3462 if (!askfor_aux(buf, 80)) continue;
3464 /* Extract an action */
3465 text_to_ascii(macro__buf, buf);
3468 #endif /* ALLOW_MACROS */
3477 /* Flush messages */
3486 static void cmd_visuals_aux(int i, int *num, int max)
3493 sprintf(str, "%d", *num);
3495 if (!get_string(format("Input new number(0-%d): ", max-1), str, 4))
3498 tmp = strtol(str, NULL, 0);
3499 if (tmp >= 0 && tmp < max)
3503 else if (isupper(i))
3504 *num = (*num + max - 1) % max;
3506 *num = (*num + 1) % max;
3512 * Interact with "visuals"
3514 void do_cmd_visuals(void)
3522 const char *empty_symbol = "<< ? >>";
3524 if (use_bigtile) empty_symbol = "<< ?? >>";
3526 /* File type is "TEXT" */
3527 FILE_TYPE(FILE_TYPE_TEXT);
3530 /* Save the screen */
3534 /* Interact until done */
3540 /* Ask for a choice */
3542 prt("²èÌÌɽ¼¨¤ÎÀßÄê", 2, 0);
3544 prt("Interact with Visuals", 2, 0);
3548 /* Give some choices */
3550 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
3552 prt("(1) Load a user pref file", 4, 5);
3555 #ifdef ALLOW_VISUALS
3557 prt("(2) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
3558 prt("(3) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 6, 5);
3559 prt("(4) ÃÏ·Á¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 7, 5);
3560 prt("(5) (̤»ÈÍÑ)", 8, 5);
3561 prt("(6) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë", 9, 5);
3562 prt("(7) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë", 10, 5);
3563 prt("(8) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë", 11, 5);
3564 prt("(9) (̤»ÈÍÑ)", 12, 5);
3566 prt("(2) Dump monster attr/chars", 5, 5);
3567 prt("(3) Dump object attr/chars", 6, 5);
3568 prt("(4) Dump feature attr/chars", 7, 5);
3569 prt("(5) (unused)", 8, 5);
3570 prt("(6) Change monster attr/chars", 9, 5);
3571 prt("(7) Change object attr/chars", 10, 5);
3572 prt("(8) Change feature attr/chars", 11, 5);
3573 prt("(9) (unused)", 12, 5);
3578 prt("(0) ²èÌÌɽ¼¨ÊýË¡¤Î½é´ü²½", 13, 5);
3580 prt("(0) Reset visuals", 13, 5);
3586 prt("¥³¥Þ¥ó¥É:", 18, 0);
3588 prt("Command: ", 15, 0);
3596 if (i == ESCAPE) break;
3598 /* Load a 'pref' file */
3603 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 15, 0);
3605 prt("Command: Load a user pref file", 15, 0);
3611 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3613 prt("File: ", 17, 0);
3617 /* Default filename */
3618 sprintf(tmp, "%s.prf", player_name);
3621 if (!askfor_aux(tmp, 70)) continue;
3623 /* Process the given filename */
3624 (void)process_pref_file(tmp);
3627 #ifdef ALLOW_VISUALS
3629 /* Dump monster attr/chars */
3632 static cptr mark = "Monster attr/chars";
3636 prt("¥³¥Þ¥ó¥É: ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3638 prt("Command: Dump monster attr/chars", 15, 0);
3644 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3646 prt("File: ", 17, 0);
3650 /* Default filename */
3651 sprintf(tmp, "%s.prf", player_name);
3653 /* Get a filename */
3654 if (!askfor_aux(tmp, 70)) continue;
3656 /* Build the filename */
3657 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3659 /* Append to the file */
3660 if (!open_auto_dump(buf, mark)) continue;
3664 auto_dump_printf("\n# ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3666 auto_dump_printf("\n# Monster attr/char definitions\n\n");
3670 for (i = 1; i < max_r_idx; i++)
3672 monster_race *r_ptr = &r_info[i];
3674 /* Skip non-entries */
3675 if (!r_ptr->name) continue;
3677 /* Dump a comment */
3678 auto_dump_printf("# %s\n", (r_name + r_ptr->name));
3680 /* Dump the monster attr/char info */
3681 auto_dump_printf("R:%d:0x%02X/0x%02X\n\n", i,
3682 (byte)(r_ptr->x_attr), (byte)(r_ptr->x_char));
3690 msg_print("¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3692 msg_print("Dumped monster attr/chars.");
3697 /* Dump object attr/chars */
3700 static cptr mark = "Object attr/chars";
3704 prt("¥³¥Þ¥ó¥É: ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3706 prt("Command: Dump object attr/chars", 15, 0);
3712 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3714 prt("File: ", 17, 0);
3718 /* Default filename */
3719 sprintf(tmp, "%s.prf", player_name);
3721 /* Get a filename */
3722 if (!askfor_aux(tmp, 70)) continue;
3724 /* Build the filename */
3725 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3727 /* Append to the file */
3728 if (!open_auto_dump(buf, mark)) continue;
3732 auto_dump_printf("\n# ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3734 auto_dump_printf("\n# Object attr/char definitions\n\n");
3738 for (i = 1; i < max_k_idx; i++)
3741 object_kind *k_ptr = &k_info[i];
3743 /* Skip non-entries */
3744 if (!k_ptr->name) continue;
3746 /* Skip entries with flavor */
3747 if (k_ptr->flavor) continue;
3750 strip_name(o_name, i);
3752 /* Dump a comment */
3753 auto_dump_printf("# %s\n", o_name);
3755 /* Dump the object attr/char info */
3756 auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", i,
3757 (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char));
3765 msg_print("¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3767 msg_print("Dumped object attr/chars.");
3772 /* Dump feature attr/chars */
3775 static cptr mark = "Feature attr/chars";
3779 prt("¥³¥Þ¥ó¥É: ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3781 prt("Command: Dump feature attr/chars", 15, 0);
3787 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3789 prt("File: ", 17, 0);
3793 /* Default filename */
3794 sprintf(tmp, "%s.prf", player_name);
3796 /* Get a filename */
3797 if (!askfor_aux(tmp, 70)) continue;
3799 /* Build the filename */
3800 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3802 /* Append to the file */
3803 if (!open_auto_dump(buf, mark)) continue;
3807 auto_dump_printf("\n# ÃÏ·Á¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3809 auto_dump_printf("\n# Feature attr/char definitions\n\n");
3813 for (i = 1; i < max_f_idx; i++)
3815 feature_type *f_ptr = &f_info[i];
3817 /* Skip non-entries */
3818 if (!f_ptr->name) continue;
3820 /* Skip mimiccing features */
3821 if (f_ptr->mimic != i) continue;
3823 /* Dump a comment */
3824 auto_dump_printf("# %s\n", (f_name + f_ptr->name));
3826 /* Dump the feature attr/char info */
3827 auto_dump_printf("F:%d:0x%02X/0x%02X\n\n", i,
3828 (byte)(f_ptr->x_attr), (byte)(f_ptr->x_char));
3836 msg_print("ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3838 msg_print("Dumped feature attr/chars.");
3843 /* Modify monster attr/chars */
3850 prt("¥³¥Þ¥ó¥É: ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹", 15, 0);
3852 prt("Command: Change monster attr/chars", 15, 0);
3856 /* Hack -- query until done */
3859 monster_race *r_ptr = &r_info[r];
3864 byte da = (r_ptr->d_attr);
3865 byte dc = (r_ptr->d_char);
3866 byte ca = (r_ptr->x_attr);
3867 byte cc = (r_ptr->x_char);
3869 /* Label the object */
3871 Term_putstr(5, 17, -1, TERM_WHITE,
3872 format("¥â¥ó¥¹¥¿¡¼ = %d, ̾Á° = %-40.40s",
3873 r, (r_name + r_ptr->name)));
3875 Term_putstr(5, 17, -1, TERM_WHITE,
3876 format("Monster = %d, Name = %-40.40s",
3877 r, (r_name + r_ptr->name)));
3881 /* Label the Default values */
3883 Term_putstr(10, 19, -1, TERM_WHITE,
3884 format("½é´üÃÍ ¿§ / ʸ»ú = %3u / %3u", da, dc));
3886 Term_putstr(10, 19, -1, TERM_WHITE,
3887 format("Default attr/char = %3u / %3u", da, dc));
3890 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
3894 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
3896 Term_putch(43, 19, a, c);
3897 if (use_bigtile) Term_putch(43 + 1, 19, a2, c2);
3899 /* Label the Current values */
3901 Term_putstr(10, 20, -1, TERM_WHITE,
3902 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3u / %3u", ca, cc));
3904 Term_putstr(10, 20, -1, TERM_WHITE,
3905 format("Current attr/char = %3u / %3u", ca, cc));
3908 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
3912 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
3914 Term_putch(43, 20, a, c);
3915 if (use_bigtile) Term_putch(43 + 1, 20, a2, c2);
3920 Term_putstr(0, 22, -1, TERM_WHITE,
3921 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C): ");
3923 Term_putstr(0, 22, -1, TERM_WHITE,
3924 "Command (n/N/^N/a/A/^A/c/C/^C): ");
3931 if (i == ESCAPE) break;
3933 if (iscntrl(i)) c = 'a' + i - KTRL('A');
3934 else if (isupper(i)) c = 'a' + i - 'A';
3940 cmd_visuals_aux(i, &r, max_r_idx);
3943 t = (int)r_ptr->x_attr;
3944 cmd_visuals_aux(i, &t, 256);
3945 r_ptr->x_attr = (byte)t;
3948 t = (int)r_ptr->x_char;
3949 cmd_visuals_aux(i, &t, 256);
3950 r_ptr->x_char = (byte)t;
3956 /* Modify object attr/chars */
3963 prt("¥³¥Þ¥ó¥É: ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹", 15, 0);
3965 prt("Command: Change object attr/chars", 15, 0);
3969 /* Hack -- query until done */
3972 object_kind *k_ptr = &k_info[k];
3977 byte da = (byte)k_ptr->d_attr;
3978 byte dc = (byte)k_ptr->d_char;
3979 byte ca = (byte)k_ptr->x_attr;
3980 byte cc = (byte)k_ptr->x_char;
3982 /* Label the object */
3984 Term_putstr(5, 17, -1, TERM_WHITE,
3985 format("¥¢¥¤¥Æ¥à = %d, ̾Á° = %-40.40s",
3986 k, (k_name + k_ptr->name)));
3988 Term_putstr(5, 17, -1, TERM_WHITE,
3989 format("Object = %d, Name = %-40.40s",
3990 k, (k_name + k_ptr->name)));
3994 /* Label the Default values */
3996 Term_putstr(10, 19, -1, TERM_WHITE,
3997 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
3999 Term_putstr(10, 19, -1, TERM_WHITE,
4000 format("Default attr/char = %3d / %3d", da, dc));
4003 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4006 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
4008 Term_putch(43, 19, a, c);
4009 if (use_bigtile) Term_putch(43 + 1, 19, a2, c2);
4012 /* Label the Current values */
4014 Term_putstr(10, 20, -1, TERM_WHITE,
4015 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4017 Term_putstr(10, 20, -1, TERM_WHITE,
4018 format("Current attr/char = %3d / %3d", ca, cc));
4021 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4024 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
4026 Term_putch(43, 20, a, c);
4027 if (use_bigtile) Term_putch(43 + 1, 20, a2, c2);
4032 Term_putstr(0, 22, -1, TERM_WHITE,
4033 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C): ");
4035 Term_putstr(0, 22, -1, TERM_WHITE,
4036 "Command (n/N/^N/a/A/^A/c/C/^C): ");
4043 if (i == ESCAPE) break;
4045 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4046 else if (isupper(i)) c = 'a' + i - 'A';
4052 cmd_visuals_aux(i, &k, max_k_idx);
4055 t = (int)k_info[k].x_attr;
4056 cmd_visuals_aux(i, &t, 256);
4057 k_info[k].x_attr = (byte)t;
4060 t = (int)k_info[k].x_char;
4061 cmd_visuals_aux(i, &t, 256);
4062 k_info[k].x_char = (byte)t;
4068 /* Modify feature attr/chars */
4075 prt("¥³¥Þ¥ó¥É: ÃÏ·Á¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹", 15, 0);
4077 prt("Command: Change feature attr/chars", 15, 0);
4081 /* Hack -- query until done */
4084 feature_type *f_ptr = &f_info[f];
4089 byte da = (byte)f_ptr->d_attr;
4090 byte dc = (byte)f_ptr->d_char;
4091 byte ca = (byte)f_ptr->x_attr;
4092 byte cc = (byte)f_ptr->x_char;
4094 /* Label the object */
4096 Term_putstr(5, 17, -1, TERM_WHITE,
4097 format("ÃÏ·Á = %d, ̾Á° = %-40.40s",
4098 f, (f_name + f_ptr->name)));
4100 Term_putstr(5, 17, -1, TERM_WHITE,
4101 format("Terrain = %d, Name = %-40.40s",
4102 f, (f_name + f_ptr->name)));
4106 /* Label the Default values */
4108 Term_putstr(10, 19, -1, TERM_WHITE,
4109 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4111 Term_putstr(10, 19, -1, TERM_WHITE,
4112 format("Default attr/char = %3d / %3d", da, dc));
4115 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4118 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
4120 Term_putch(43, 19, a, c);
4121 if (use_bigtile) Term_putch(43 + 1, 19, a2, c2);
4124 /* Label the Current values */
4126 Term_putstr(10, 20, -1, TERM_WHITE,
4127 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4129 Term_putstr(10, 20, -1, TERM_WHITE,
4130 format("Current attr/char = %3d / %3d", ca, cc));
4133 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4136 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
4138 Term_putch(43, 20, a, c);
4139 if (use_bigtile) Term_putch(43 + 1, 20, a2, c2);
4144 Term_putstr(0, 22, -1, TERM_WHITE,
4145 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C): ");
4147 Term_putstr(0, 22, -1, TERM_WHITE,
4148 "Command (n/N/^N/a/A/^A/c/C/^C): ");
4155 if (i == ESCAPE) break;
4157 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4158 else if (isupper(i)) c = 'a' + i - 'A';
4164 cmd_visuals_aux(i, &f, max_f_idx);
4167 t = (int)f_info[f].x_attr;
4168 cmd_visuals_aux(i, &t, 256);
4169 f_info[f].x_attr = (byte)t;
4172 t = (int)f_info[f].x_char;
4173 cmd_visuals_aux(i, &t, 256);
4174 f_info[f].x_char = (byte)t;
4190 msg_print("²èÌ̾å¤Î[¿§/ʸ»ú]¤ò½é´üÃͤ˥ꥻ¥Ã¥È¤·¤Þ¤·¤¿¡£");
4192 msg_print("Visual attr/char tables reset.");
4197 /* Unknown option */
4203 /* Flush messages */
4208 /* Restore the screen */
4214 * Interact with "colors"
4216 void do_cmd_colors(void)
4225 /* File type is "TEXT" */
4226 FILE_TYPE(FILE_TYPE_TEXT);
4229 /* Save the screen */
4233 /* Interact until done */
4239 /* Ask for a choice */
4241 prt("[ ¥«¥é¡¼¤ÎÀßÄê ]", 2, 0);
4243 prt("Interact with Colors", 2, 0);
4247 /* Give some choices */
4249 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
4251 prt("(1) Load a user pref file", 4, 5);
4256 prt("(2) ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
4257 prt("(3) ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤¹¤ë", 6, 5);
4259 prt("(2) Dump colors", 5, 5);
4260 prt("(3) Modify colors", 6, 5);
4267 prt("¥³¥Þ¥ó¥É: ", 8, 0);
4269 prt("Command: ", 8, 0);
4277 if (i == ESCAPE) break;
4279 /* Load a 'pref' file */
4284 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹", 8, 0);
4286 prt("Command: Load a user pref file", 8, 0);
4292 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4294 prt("File: ", 10, 0);
4299 sprintf(tmp, "%s.prf", player_name);
4302 if (!askfor_aux(tmp, 70)) continue;
4304 /* Process the given filename */
4305 (void)process_pref_file(tmp);
4307 /* Mega-Hack -- react to changes */
4308 Term_xtra(TERM_XTRA_REACT, 0);
4310 /* Mega-Hack -- redraw */
4319 static cptr mark = "Colors";
4323 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 8, 0);
4325 prt("Command: Dump colors", 8, 0);
4331 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4333 prt("File: ", 10, 0);
4337 /* Default filename */
4338 sprintf(tmp, "%s.prf", player_name);
4340 /* Get a filename */
4341 if (!askfor_aux(tmp, 70)) continue;
4343 /* Build the filename */
4344 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
4346 /* Append to the file */
4347 if (!open_auto_dump(buf, mark)) continue;
4351 auto_dump_printf("\n# ¥«¥é¡¼¤ÎÀßÄê\n\n");
4353 auto_dump_printf("\n# Color redefinitions\n\n");
4357 for (i = 0; i < 256; i++)
4359 int kv = angband_color_table[i][0];
4360 int rv = angband_color_table[i][1];
4361 int gv = angband_color_table[i][2];
4362 int bv = angband_color_table[i][3];
4367 cptr name = "unknown";
4371 /* Skip non-entries */
4372 if (!kv && !rv && !gv && !bv) continue;
4374 /* Extract the color name */
4375 if (i < 16) name = color_names[i];
4377 /* Dump a comment */
4379 auto_dump_printf("# ¥«¥é¡¼ '%s'\n", name);
4381 auto_dump_printf("# Color '%s'\n", name);
4384 /* Dump the monster attr/char info */
4385 auto_dump_printf("V:%d:0x%02X:0x%02X:0x%02X:0x%02X\n\n",
4394 msg_print("¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
4396 msg_print("Dumped color redefinitions.");
4408 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤·¤Þ¤¹", 8, 0);
4410 prt("Command: Modify colors", 8, 0);
4414 /* Hack -- query until done */
4423 /* Exhibit the normal colors */
4424 for (j = 0; j < 16; j++)
4426 /* Exhibit this color */
4427 Term_putstr(j*4, 20, -1, a, "###");
4429 /* Exhibit all colors */
4430 Term_putstr(j*4, 22, -1, j, format("%3d", j));
4433 /* Describe the color */
4435 name = ((a < 16) ? color_names[a] : "̤ÄêµÁ");
4437 name = ((a < 16) ? color_names[a] : "undefined");
4441 /* Describe the color */
4443 Term_putstr(5, 10, -1, TERM_WHITE,
4444 format("¥«¥é¡¼ = %d, ̾Á° = %s", a, name));
4446 Term_putstr(5, 10, -1, TERM_WHITE,
4447 format("Color = %d, Name = %s", a, name));
4451 /* Label the Current values */
4452 Term_putstr(5, 12, -1, TERM_WHITE,
4453 format("K = 0x%02x / R,G,B = 0x%02x,0x%02x,0x%02x",
4454 angband_color_table[a][0],
4455 angband_color_table[a][1],
4456 angband_color_table[a][2],
4457 angband_color_table[a][3]));
4461 Term_putstr(0, 14, -1, TERM_WHITE,
4462 "¥³¥Þ¥ó¥É (n/N/k/K/r/R/g/G/b/B): ");
4464 Term_putstr(0, 14, -1, TERM_WHITE,
4465 "Command (n/N/k/K/r/R/g/G/b/B): ");
4473 if (i == ESCAPE) break;
4476 if (i == 'n') a = (byte)(a + 1);
4477 if (i == 'N') a = (byte)(a - 1);
4478 if (i == 'k') angband_color_table[a][0] = (byte)(angband_color_table[a][0] + 1);
4479 if (i == 'K') angband_color_table[a][0] = (byte)(angband_color_table[a][0] - 1);
4480 if (i == 'r') angband_color_table[a][1] = (byte)(angband_color_table[a][1] + 1);
4481 if (i == 'R') angband_color_table[a][1] = (byte)(angband_color_table[a][1] - 1);
4482 if (i == 'g') angband_color_table[a][2] = (byte)(angband_color_table[a][2] + 1);
4483 if (i == 'G') angband_color_table[a][2] = (byte)(angband_color_table[a][2] - 1);
4484 if (i == 'b') angband_color_table[a][3] = (byte)(angband_color_table[a][3] + 1);
4485 if (i == 'B') angband_color_table[a][3] = (byte)(angband_color_table[a][3] - 1);
4487 /* Hack -- react to changes */
4488 Term_xtra(TERM_XTRA_REACT, 0);
4490 /* Hack -- redraw */
4497 /* Unknown option */
4503 /* Flush messages */
4508 /* Restore the screen */
4514 * Note something in the message recall
4516 void do_cmd_note(void)
4525 if (!get_string("¥á¥â: ", buf, 60)) return;
4527 if (!get_string("Note: ", buf, 60)) return;
4531 /* Ignore empty notes */
4532 if (!buf[0] || (buf[0] == ' ')) return;
4534 /* Add the note to the message recall */
4536 msg_format("¥á¥â: %s", buf);
4538 msg_format("Note: %s", buf);
4545 * Mention the current version
4547 void do_cmd_version(void)
4552 msg_format("ÊѶòÈÚÅÜ(Hengband) %d.%d.%d",
4553 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4555 msg_format("You are playing Hengband %d.%d.%d.",
4556 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4563 * Array of feeling strings
4565 static cptr do_cmd_feeling_text[11] =
4568 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4570 "Looks like any other level.",
4574 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4576 "You feel there is something special about this level.",
4580 "¶²¤í¤·¤¤»à¤Î¸¸¤¬ÌܤËÉ⤫¤Ó¡¢µ¤À䤷¤½¤¦¤Ë¤Ê¤Ã¤¿¡ª",
4582 "You nearly faint as horrible visions of death fill your mind!",
4586 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4588 "This level looks very dangerous.",
4592 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4594 "You have a very bad feeling...",
4598 "°¤¤Í½´¶¤¬¤¹¤ë...",
4600 "You have a bad feeling...",
4606 "You feel nervous.",
4610 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4612 "You feel your luck is turning...",
4616 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4618 "You don't like the look of this place.",
4622 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4624 "This level looks reasonably safe.",
4628 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4630 "What a boring place..."
4635 static cptr do_cmd_feeling_text_combat[11] =
4638 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4640 "Looks like any other level.",
4644 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4646 "You feel there is something special about this level.",
4650 "º£Ìë¤â¤Þ¤¿¡¢Ã¯¤«¤¬Ì¿¤òÍî¤È¤¹...",
4652 "You nearly faint as horrible visions of death fill your mind!",
4656 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4658 "This level looks very dangerous.",
4662 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4664 "You have a very bad feeling...",
4668 "°¤¤Í½´¶¤¬¤¹¤ë...",
4670 "You have a bad feeling...",
4676 "You feel nervous.",
4680 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4682 "You feel your luck is turning...",
4686 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4688 "You don't like the look of this place.",
4692 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4694 "This level looks reasonably safe.",
4698 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4700 "What a boring place..."
4705 static cptr do_cmd_feeling_text_lucky[11] =
4708 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4709 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4710 "¤³¤Î³¬¤Ï¤³¤Î¾å¤Ê¤¯ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë¡£",
4711 "ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë...",
4712 "¤È¤Æ¤âÎɤ¤´¶¤¸¤¬¤¹¤ë...",
4713 "Îɤ¤´¶¤¸¤¬¤¹¤ë...",
4714 "¤Á¤ç¤Ã¤È¹¬±¿¤Ê´¶¤¸¤¬¤¹¤ë...",
4715 "¿¾¯¤Ï±¿¤¬¸þ¤¤¤Æ¤¤¿¤«...",
4716 "¸«¤¿´¶¤¸°¤¯¤Ï¤Ê¤¤...",
4717 "Á´Á³ÂÌÌܤȤ¤¤¦¤³¤È¤Ï¤Ê¤¤¤¬...",
4718 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4720 "Looks like any other level.",
4721 "You feel there is something special about this level.",
4722 "You have a superb feeling about this level.",
4723 "You have an excellent feeling...",
4724 "You have a very good feeling...",
4725 "You have a good feeling...",
4726 "You feel strangely lucky...",
4727 "You feel your luck is turning...",
4728 "You like the look of this place...",
4729 "This level can't be all bad...",
4730 "What a boring place..."
4736 * Note that "feeling" is set to zero unless some time has passed.
4737 * Note that this is done when the level is GENERATED, not entered.
4739 void do_cmd_feeling(void)
4741 /* Verify the feeling */
4742 if (feeling > 10) feeling = 10;
4744 /* No useful feeling in quests */
4745 if (p_ptr->inside_quest && !random_quest_number(dun_level))
4748 msg_print("ŵ·¿Åª¤Ê¥¯¥¨¥¹¥È¤Î¥À¥ó¥¸¥ç¥ó¤Î¤è¤¦¤À¡£");
4750 msg_print("Looks like a typical quest level.");
4756 /* No useful feeling in town */
4757 else if (p_ptr->town_num && !dun_level)
4760 if (!strcmp(town[p_ptr->town_num].name, "¹ÓÌî"))
4762 if (!strcmp(town[p_ptr->town_num].name, "wilderness"))
4766 msg_print("²¿¤«¤¢¤ê¤½¤¦¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
4768 msg_print("Looks like a strange wilderness.");
4776 msg_print("ŵ·¿Åª¤ÊÄ®¤Î¤è¤¦¤À¡£");
4778 msg_print("Looks like a typical town.");
4785 /* No useful feeling in the wilderness */
4786 else if (!dun_level)
4789 msg_print("ŵ·¿Åª¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
4791 msg_print("Looks like a typical wilderness.");
4797 /* Display the feeling */
4798 if (turn - old_turn >= (150 - dun_level)*TURNS_PER_TICK || cheat_xtra)
4800 if (p_ptr->muta3 & MUT3_GOOD_LUCK) msg_print(do_cmd_feeling_text_lucky[feeling]);
4802 if((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON)){
4803 msg_print(do_cmd_feeling_text_combat[feeling]);
4805 msg_print(do_cmd_feeling_text[feeling]);
4810 msg_print(do_cmd_feeling_text[0]);
4817 * Description of each monster group.
4819 static cptr monster_group_text[] =
4822 "¥æ¥Ë¡¼¥¯", /* "Uniques" */
4851 /* "¸ÅÂå¥É¥é¥´¥ó/¥ï¥¤¥¢¡¼¥à", */
4868 /* "¾åµé¥Ç¡¼¥â¥ó", */
4908 /* "Ancient Dragon/Wyrm", */
4917 "Multi-Headed Reptile",
4922 "Reptile/Amphibian",
4923 "Spider/Scorpion/Tick",
4925 /* "Major Demon", */
4941 * Symbols of monsters in each group. Note the "Uniques" group
4942 * is handled differently.
4944 static cptr monster_group_char[] =
4998 "$!?=&`.|/\\~[]()>",
5007 * hook function to sort monsters by level
5009 static bool ang_sort_comp_monster_level(vptr u, vptr v, int a, int b)
5011 u16b *who = (u16b*)(u);
5016 monster_race *r_ptr1 = &r_info[w1];
5017 monster_race *r_ptr2 = &r_info[w2];
5022 if (r_ptr2->level > r_ptr1->level) return TRUE;
5023 if (r_ptr1->level > r_ptr2->level) return FALSE;
5025 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return TRUE;
5026 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return FALSE;
5031 * Build a list of monster indexes in the given group. Return the number
5032 * of monsters in the group.
5034 * mode & 0x01 : check for non-empty group
5035 * mode & 0x02 : cheat?
5037 static int collect_monsters(int grp_cur, s16b mon_idx[], byte mode)
5042 /* Get a list of x_char in this group */
5043 cptr group_char = monster_group_char[grp_cur];
5045 /* XXX Hack -- Check if this is the "Uniques" group */
5046 bool grp_unique = (monster_group_char[grp_cur] == (char *) -1L);
5048 /* Check every race */
5049 for (i = 0; i < max_r_idx; i++)
5051 /* Access the race */
5052 monster_race *r_ptr = &r_info[i];
5054 /* Skip empty race */
5055 if (!r_ptr->name) continue ;
5057 /* Require known monsters */
5058 if (!(mode & 0x02) && !cheat_know && !r_ptr->r_sights ) continue;
5060 if (grp_unique && !(r_ptr->flags1 & RF1_UNIQUE)) continue;
5062 /* Check for race in the group */
5063 if (grp_unique || strchr(group_char, r_ptr->d_char))
5066 mon_idx[mon_cnt++] = i;
5068 /* XXX Hack -- Just checking for non-empty group */
5069 if (mode & 0x01) break;
5073 /* Terminate the list */
5074 mon_idx[mon_cnt] = 0;
5076 /* Select the sort method */
5077 ang_sort_comp = ang_sort_comp_monster_level;
5078 ang_sort_swap = ang_sort_swap_hook;
5080 /* Sort by monster level */
5081 ang_sort(mon_idx, &dummy_why, mon_cnt);
5083 /* Return the number of races */
5089 * Description of each monster group.
5091 static cptr object_group_text[] =
5094 "¥¥Î¥³", /* "Mushrooms" */
5095 "Ìô", /* "Potions" */
5096 "Ìý¤Ä¤Ü", /* "Flasks" */
5097 "´¬Êª", /* "Scrolls" */
5098 "»ØÎØ", /* "Rings" */
5099 "¥¢¥ß¥å¥ì¥Ã¥È", /* "Amulets" */
5100 "ū", /* "Whistle" */
5101 "¸÷¸»", /* "Lanterns" */
5102 "ËâË¡ËÀ", /* "Wands" */
5103 "¾ó", /* "Staffs" */
5104 "¥í¥Ã¥É", /* "Rods" */
5105 "¥«¡¼¥É", /* "Cards" */
5106 "¥¥ã¥×¥Á¥ã¡¼¡¦¥Ü¡¼¥ë",
5115 "Åá·õÎà", /* "Swords" */
5116 "Æß´ï", /* "Blunt Weapons" */
5117 "ĹÊÁÉð´ï", /* "Polearms" */
5118 "ºÎ·¡Æ»¶ñ", /* "Diggers" */
5119 "Èô¤ÓÆ»¶ñ", /* "Bows" */
5123 "·ÚÁõ³»", /* "Soft Armor" */
5124 "½ÅÁõ³»", /* "Hard Armor" */
5125 "¥É¥é¥´¥ó³»", /* "Dragon Armor" */
5126 "½â", /* "Shields" */
5127 "¥¯¥í¡¼¥¯", /* "Cloaks" */
5128 "äƼê", /* "Gloves" */
5129 "¥Ø¥ë¥á¥Ã¥È", /* "Helms" */
5130 "´§", /* "Crowns" */
5131 "¥Ö¡¼¥Ä", /* "Boots" */
5179 * TVALs of items in each group
5181 static byte object_group_tval[] =
5221 TV_LIFE_BOOK, /* Hack -- all spellbooks */
5227 * Build a list of monster indexes in the given group. Return the number
5228 * of monsters in the group.
5230 static int collect_objects(int grp_cur, int object_idx[])
5232 int i, j, k, object_cnt = 0;
5234 /* Get a list of x_char in this group */
5235 byte group_tval = object_group_tval[grp_cur];
5237 /* Check every object */
5238 for (i = 0; i < max_k_idx; i++)
5240 /* Access the race */
5241 object_kind *k_ptr = &k_info[i];
5243 /* Skip empty objects */
5244 if (!k_ptr->name) continue;
5246 /* Skip non-flavoured objects */
5247 if (!k_ptr->flavor && !p_ptr->wizard) continue;
5249 /* Skip items with no distribution (special artifacts) */
5250 for (j = 0, k = 0; j < 4; j++) k += k_ptr->chance[j];
5253 /* Require objects ever seen*/
5254 if (!k_ptr->aware && !p_ptr->wizard) continue;
5256 /* Check for race in the group */
5257 if (TV_LIFE_BOOK == group_tval)
5259 /* Hack -- All spell books */
5260 if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HISSATSU_BOOK)
5263 object_idx[object_cnt++] = i;
5266 else if (k_ptr->tval == group_tval)
5269 object_idx[object_cnt++] = i;
5273 /* Terminate the list */
5274 object_idx[object_cnt] = 0;
5276 /* Return the number of races */
5282 * Description of each feature group.
5284 static cptr feature_group_text[] =
5292 * Build a list of feature indexes in the given group. Return the number
5293 * of features in the group.
5295 static int collect_features(int grp_cur, int *feat_idx)
5297 int i, feat_cnt = 0;
5299 /* Unused; There is a single group. */
5302 /* Check every feature */
5303 for (i = 1; i < max_f_idx; i++)
5305 /* Access the index */
5306 feature_type *f_ptr = &f_info[i];
5308 /* Skip empty index */
5309 if (!f_ptr->name) continue;
5311 /* Skip mimiccing features */
5312 if (f_ptr->mimic != i) continue;
5315 feat_idx[feat_cnt++] = i;
5318 /* Terminate the list */
5319 feat_idx[feat_cnt] = 0;
5321 /* Return the number of races */
5328 * Build a list of monster indexes in the given group. Return the number
5329 * of monsters in the group.
5331 static int collect_artifacts(int grp_cur, int object_idx[])
5333 int i, object_cnt = 0;
5335 /* Get a list of x_char in this group */
5336 byte group_tval = object_group_tval[grp_cur];
5338 /* Check every object */
5339 for (i = 0; i < max_a_idx; i++)
5341 /* Access the artifact */
5342 artifact_type *a_ptr = &a_info[i];
5344 /* Skip empty artifacts */
5345 if (!a_ptr->name) continue;
5347 /* Skip "uncreated" artifacts */
5348 if (!a_ptr->cur_num) continue;
5350 /* Check for race in the group */
5351 if (a_ptr->tval == group_tval)
5354 object_idx[object_cnt++] = i;
5358 /* Terminate the list */
5359 object_idx[object_cnt] = 0;
5361 /* Return the number of races */
5368 * Encode the screen colors
5370 static char hack[17] = "dwsorgbuDWvyRGBU";
5373 static errr photo_fgets(FILE *fff, char *buf, huge n)
5382 if (fgets(tmp, 1024, fff))
5384 /* Convert weirdness */
5385 for (s = tmp; *s; s++)
5387 /* Handle newline */
5398 else if (*s == '\t')
5400 /* Hack -- require room */
5401 if (i + 8 >= n) break;
5403 /* Append a space */
5406 /* Append some more spaces */
5407 while (!(i % 8)) buf[i++] = ' ';
5411 else if (iskanji(*s))
5418 /* Ⱦ³Ñ¤«¤Ê¤ËÂбþ */
5419 else if ((((int)*s & 0xff) > 0xa1) && (((int)*s & 0xff ) < 0xdf))
5426 /* Handle printables */
5447 * Hack -- load a screen dump from a file
5449 void do_cmd_load_screen(void)
5464 Term_get_size(&wid, &hgt);
5466 /* Build the filename */
5467 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
5469 /* Append to the file */
5470 fff = my_fopen(buf, "r");
5475 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
5477 msg_format("Failed to open %s.", buf);
5484 /* Save the screen */
5487 /* Clear the screen */
5491 /* Load the screen */
5492 for (y = 0; okay && (y < hgt); y++)
5494 /* Get a line of data */
5495 if (photo_fgets(fff, buf, 1024)) okay = FALSE;
5498 for (x = 0; x < wid - 1; x++)
5500 /* Put the attr/char */
5501 Term_draw(x, y, TERM_WHITE, buf[x]);
5505 /* Get the blank line */
5506 if (my_fgets(fff, buf, sizeof(buf))) okay = FALSE;
5509 /* Dump the screen */
5510 for (y = 0; okay && (y < hgt); y++)
5512 /* Get a line of data */
5513 if (photo_fgets(fff, buf, 1024)) okay = FALSE;
5516 for (x = 0; x < wid - 1; x++)
5518 /* Get the attr/char */
5519 (void)(Term_what(x, y, &a, &c));
5521 /* Look up the attr */
5522 for (i = 0; i < 16; i++)
5524 /* Use attr matches */
5525 if (hack[i] == buf[x]) a = i;
5528 /* Put the attr/char */
5529 Term_draw(x, y, a, c);
5534 /* Get the blank line */
5535 if (my_fgets(fff, buf, sizeof(buf))) okay = FALSE;
5544 prt("¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤µ¤ì¤¿²èÌÌ(µÇ°»£±Æ)¤ò¥í¡¼¥É¤·¤Þ¤·¤¿¡£", 0, 0);
5546 msg_print("Screen dump loaded.");
5553 /* Restore the screen */
5560 cptr inven_res_label =
5562 " »ÀÅŲÐÎäÆǸ÷°ÇÇ˹ì¹ö°øÆÙÎô ÌÕÉÝÍðáãÆ©Ì¿´¶¾ÃÉüÉâ";
5564 " AcElFiCoPoLiDkShSoNtNxCaDi BlFeCfFaSeHlEpSdRgLv";
5567 /* XTRA HACK RESLIST */
5568 static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr,
5569 int *j, byte tval, char *where)
5571 char o_name[MAX_NLEN];
5572 u32b flgs[TR_FLAG_SIZE];
5574 if (!o_ptr->k_idx)return;
5575 if (o_ptr->tval != tval)return;
5578 * HACK:Ring of Lordly protection and Dragon shield/helm
5579 * have random resistances.
5581 if ( ((o_ptr->tval >= TV_BOW && o_ptr->tval<= TV_DRAG_ARMOR && o_ptr->name2)
5582 || (o_ptr->tval == TV_RING && o_ptr->sval == SV_RING_LORDLY)
5583 || (o_ptr->tval == TV_SHIELD && o_ptr->sval == SV_DRAGON_SHIELD)
5584 || (o_ptr->tval == TV_HELM && o_ptr->sval == SV_DRAGON_HELM)
5585 || (o_ptr->tval == TV_GLOVES && o_ptr->sval == SV_SET_OF_DRAGON_GLOVES)
5586 || (o_ptr->tval == TV_BOOTS && o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE)
5587 || o_ptr->art_name || o_ptr->name1) && object_known_p(o_ptr))
5590 object_desc(o_name, o_ptr, TRUE, 0);
5592 while ( o_name[i] && i < 26 ){
5594 if (iskanji(o_name[i])) i++;
5598 if(i<28) while(i<28){o_name[i]=' ';i++;}
5601 fprintf(fff,"%s %s", where, o_name);
5603 if (!(o_ptr->ident & (IDENT_MENTAL)))
5606 fprintf(fff, "-------ÉÔÌÀ--------------- -------ÉÔÌÀ---------\n");
5608 fprintf(fff, "-------unknown------------ -------unknown------\n");
5612 object_flags_known(o_ptr, flgs);
5615 if (have_flag(flgs, TR_IM_ACID)) fprintf(fff,"¡ö");
5616 else if (have_flag(flgs, TR_RES_ACID)) fprintf(fff,"¡Ü");
5617 else fprintf(fff,"¡¦");
5619 if (have_flag(flgs, TR_IM_ELEC)) fprintf(fff,"¡ö");
5620 else if (have_flag(flgs, TR_RES_ELEC)) fprintf(fff,"¡Ü");
5621 else fprintf(fff,"¡¦");
5623 if (have_flag(flgs, TR_IM_FIRE)) fprintf(fff,"¡ö");
5624 else if (have_flag(flgs, TR_RES_FIRE)) fprintf(fff,"¡Ü");
5625 else fprintf(fff,"¡¦");
5627 if (have_flag(flgs, TR_IM_COLD)) fprintf(fff,"¡ö");
5628 else if (have_flag(flgs, TR_RES_COLD)) fprintf(fff,"¡Ü");
5629 else fprintf(fff,"¡¦");
5631 if (have_flag(flgs, TR_RES_POIS)) fprintf(fff,"¡Ü");
5632 else fprintf(fff,"¡¦");
5634 if (have_flag(flgs, TR_RES_LITE)) fprintf(fff,"¡Ü");
5635 else fprintf(fff,"¡¦");
5637 if (have_flag(flgs, TR_RES_DARK)) fprintf(fff,"¡Ü");
5638 else fprintf(fff,"¡¦");
5640 if (have_flag(flgs, TR_RES_SHARDS)) fprintf(fff,"¡Ü");
5641 else fprintf(fff,"¡¦");
5643 if (have_flag(flgs, TR_RES_SOUND)) fprintf(fff,"¡Ü");
5644 else fprintf(fff,"¡¦");
5646 if (have_flag(flgs, TR_RES_NETHER)) fprintf(fff,"¡Ü");
5647 else fprintf(fff,"¡¦");
5649 if (have_flag(flgs, TR_RES_NEXUS)) fprintf(fff,"¡Ü");
5650 else fprintf(fff,"¡¦");
5652 if (have_flag(flgs, TR_RES_CHAOS)) fprintf(fff,"¡Ü");
5653 else fprintf(fff,"¡¦");
5655 if (have_flag(flgs, TR_RES_DISEN)) fprintf(fff,"¡Ü");
5656 else fprintf(fff,"¡¦");
5660 if (have_flag(flgs, TR_RES_BLIND)) fprintf(fff,"¡Ü");
5661 else fprintf(fff,"¡¦");
5663 if (have_flag(flgs, TR_RES_FEAR)) fprintf(fff,"¡Ü");
5664 else fprintf(fff,"¡¦");
5666 if (have_flag(flgs, TR_RES_CONF)) fprintf(fff,"¡Ü");
5667 else fprintf(fff,"¡¦");
5669 if (have_flag(flgs, TR_FREE_ACT)) fprintf(fff,"¡Ü");
5670 else fprintf(fff,"¡¦");
5672 if (have_flag(flgs, TR_SEE_INVIS)) fprintf(fff,"¡Ü");
5673 else fprintf(fff,"¡¦");
5675 if (have_flag(flgs, TR_HOLD_LIFE)) fprintf(fff,"¡Ü");
5676 else fprintf(fff,"¡¦");
5678 if (have_flag(flgs, TR_TELEPATHY)) fprintf(fff,"¡Ü");
5679 else fprintf(fff,"¡¦");
5681 if (have_flag(flgs, TR_SLOW_DIGEST)) fprintf(fff,"¡Ü");
5682 else fprintf(fff,"¡¦");
5685 if (have_flag(flgs, TR_REGEN)) fprintf(fff,"¡Ü");
5686 else fprintf(fff,"¡¦");
5688 if (have_flag(flgs, TR_FEATHER)) fprintf(fff,"¡Ü");
5689 else fprintf(fff,"¡¦");
5691 if (have_flag(flgs, TR_IM_ACID)) fprintf(fff,"* ");
5692 else if (have_flag(flgs, TR_RES_ACID)) fprintf(fff,"+ ");
5693 else fprintf(fff,". ");
5695 if (have_flag(flgs, TR_IM_ELEC)) fprintf(fff,"* ");
5696 else if (have_flag(flgs, TR_RES_ELEC)) fprintf(fff,"+ ");
5697 else fprintf(fff,". ");
5699 if (have_flag(flgs, TR_IM_FIRE)) fprintf(fff,"* ");
5700 else if (have_flag(flgs, TR_RES_FIRE)) fprintf(fff,"+ ");
5701 else fprintf(fff,". ");
5703 if (have_flag(flgs, TR_IM_COLD)) fprintf(fff,"* ");
5704 else if (have_flag(flgs, TR_RES_COLD)) fprintf(fff,"+ ");
5705 else fprintf(fff,". ");
5707 if (have_flag(flgs, TR_RES_POIS)) fprintf(fff,"+ ");
5708 else fprintf(fff,". ");
5710 if (have_flag(flgs, TR_RES_LITE)) fprintf(fff,"+ ");
5711 else fprintf(fff,". ");
5713 if (have_flag(flgs, TR_RES_DARK)) fprintf(fff,"+ ");
5714 else fprintf(fff,". ");
5716 if (have_flag(flgs, TR_RES_SHARDS)) fprintf(fff,"+ ");
5717 else fprintf(fff,". ");
5719 if (have_flag(flgs, TR_RES_SOUND)) fprintf(fff,"+ ");
5720 else fprintf(fff,". ");
5722 if (have_flag(flgs, TR_RES_NETHER)) fprintf(fff,"+ ");
5723 else fprintf(fff,". ");
5725 if (have_flag(flgs, TR_RES_NEXUS)) fprintf(fff,"+ ");
5726 else fprintf(fff,". ");
5728 if (have_flag(flgs, TR_RES_CHAOS)) fprintf(fff,"+ ");
5729 else fprintf(fff,". ");
5731 if (have_flag(flgs, TR_RES_DISEN)) fprintf(fff,"+ ");
5732 else fprintf(fff,". ");
5736 if (have_flag(flgs, TR_RES_BLIND)) fprintf(fff,"+ ");
5737 else fprintf(fff,". ");
5739 if (have_flag(flgs, TR_RES_FEAR)) fprintf(fff,"+ ");
5740 else fprintf(fff,". ");
5742 if (have_flag(flgs, TR_RES_CONF)) fprintf(fff,"+ ");
5743 else fprintf(fff,". ");
5745 if (have_flag(flgs, TR_FREE_ACT)) fprintf(fff,"+ ");
5746 else fprintf(fff,". ");
5748 if (have_flag(flgs, TR_SEE_INVIS)) fprintf(fff,"+ ");
5749 else fprintf(fff,". ");
5751 if (have_flag(flgs, TR_HOLD_LIFE)) fprintf(fff,"+ ");
5752 else fprintf(fff,". ");
5754 if (have_flag(flgs, TR_TELEPATHY)) fprintf(fff,"+ ");
5755 else fprintf(fff,". ");
5757 if (have_flag(flgs, TR_SLOW_DIGEST)) fprintf(fff,"+ ");
5758 else fprintf(fff,". ");
5761 if (have_flag(flgs, TR_REGEN)) fprintf(fff,"+ ");
5762 else fprintf(fff,". ");
5764 if (have_flag(flgs, TR_FEATHER)) fprintf(fff,"+ ");
5765 else fprintf(fff,". ");
5773 fprintf(fff,"%s\n", inven_res_label);
5779 * Display *ID* ed weapons/armors's resistances
5781 static void do_cmd_knowledge_inven(void)
5786 char file_name[1024];
5797 /* Open a new file */
5798 fff = my_fopen_temp(file_name, 1024);
5801 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
5803 msg_format("Failed to create temporary file %s.", file_name);
5808 fprintf(fff,"%s\n",inven_res_label);
5810 for (tval=TV_BOW; tval <= TV_RING; tval++){
5813 for (;j<9;j++) fprintf(fff, "\n");
5815 fprintf(fff,"%s\n",inven_res_label);
5819 strcpy(where, "Áõ");
5821 strcpy(where, "E ");
5823 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
5825 o_ptr = &inventory[i];
5826 do_cmd_knowledge_inven_aux(fff, o_ptr, &j, tval, where);
5830 strcpy(where, "»ý");
5832 strcpy(where, "I ");
5834 for (i = 0; i < INVEN_PACK; i++)
5836 o_ptr = &inventory[i];
5837 do_cmd_knowledge_inven_aux(fff, o_ptr, &j, tval, where);
5841 /* Print all homes in the different towns */
5842 st_ptr = &town[1].store[STORE_HOME];
5844 strcpy(where, "²È");
5846 strcpy(where, "H ");
5849 /* Dump all available items */
5850 for (i = 0; i < st_ptr->stock_num; i++)
5852 o_ptr = &st_ptr->stock[i];
5853 do_cmd_knowledge_inven_aux(fff, o_ptr, &j, tval, where);
5857 /* Close the file */
5860 /* Display the file contents */
5862 show_file(TRUE, file_name, "*´ÕÄê*ºÑ¤ßÉð´ï/Ëɶñ¤ÎÂÑÀ¥ê¥¹¥È", 0, 0);
5864 show_file(TRUE, file_name, "Resistances of *identified* equipment", 0, 0);
5867 /* Remove the file */
5872 void do_cmd_save_screen_html_aux(char *filename, int message)
5876 byte a = 0, old_a = 0;
5890 cptr html_head[] = {
5891 "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
5895 cptr html_foot[] = {
5897 "</body>\n</html>\n",
5903 Term_get_size(&wid, &hgt);
5905 /* File type is "TEXT" */
5906 FILE_TYPE(FILE_TYPE_TEXT);
5908 /* Append to the file */
5909 fff = my_fopen(filename, "w");
5915 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", filename);
5917 msg_format("Failed to open file %s.", filename);
5925 /* Save the screen */
5929 /* Build the filename */
5930 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
5931 tmpfff = my_fopen(buf, "r");
5933 for (i = 0; html_head[i]; i++)
5934 fprintf(fff, html_head[i]);
5938 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
5940 if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
5944 if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
5946 fprintf(fff, "%s\n", buf);
5951 /* Dump the screen */
5952 for (y = 0; y < hgt; y++)
5959 for (x = 0; x < wid - 1; x++)
5963 /* Get the attr/char */
5964 (void)(Term_what(x, y, &a, &c));
5968 case '&': cc = "&"; break;
5969 case '<': cc = "<"; break;
5970 case '>': cc = ">"; break;
5972 case 0x1f: c = '.'; break;
5973 case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
5978 if ((y == 0 && x == 0) || a != old_a) {
5979 rv = angband_color_table[a][1];
5980 gv = angband_color_table[a][2];
5981 bv = angband_color_table[a][3];
5982 fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
5983 ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
5987 fprintf(fff, "%s", cc);
5989 fprintf(fff, "%c", c);
5992 fprintf(fff, "</font>");
5995 for (i = 0; html_foot[i]; i++)
5996 fprintf(fff, html_foot[i]);
6001 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
6003 if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
6007 if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
6009 fprintf(fff, "%s\n", buf);
6024 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6026 msg_print("Screen dump saved.");
6031 /* Restore the screen */
6037 * Hack -- save a screen dump to a file
6039 static void do_cmd_save_screen_html(void)
6041 char buf[1024], tmp[256] = "screen.html";
6044 if (!get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
6046 if (!get_string("File name: ", tmp, 80))
6050 /* Build the filename */
6051 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
6055 do_cmd_save_screen_html_aux(buf, 1);
6060 * Redefinable "save_screen" action
6062 void (*screendump_aux)(void) = NULL;
6066 * Hack -- save a screen dump to a file
6068 void do_cmd_save_screen(void)
6070 bool old_use_graphics = use_graphics;
6071 bool html_dump = FALSE;
6076 prt("µÇ°»£±Æ¤·¤Þ¤¹¤«¡© [(y)es/(h)tml/(n)o] ", 0, 0);
6078 prt("Save screen dump? [(y)es/(h)tml/(n)o] ", 0, 0);
6083 if (c == 'Y' || c == 'y')
6085 else if (c == 'H' || c == 'h')
6097 Term_get_size(&wid, &hgt);
6099 if (old_use_graphics)
6101 use_graphics = FALSE;
6104 /* Redraw everything */
6105 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6107 /* Hack -- update */
6113 do_cmd_save_screen_html();
6117 /* Do we use a special screendump function ? */
6118 else if (screendump_aux)
6120 /* Dump the screen to a graphics file */
6121 (*screendump_aux)();
6123 else /* Dump the screen as text */
6134 /* Build the filename */
6135 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
6137 /* File type is "TEXT" */
6138 FILE_TYPE(FILE_TYPE_TEXT);
6140 /* Append to the file */
6141 fff = my_fopen(buf, "w");
6147 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
6149 msg_format("Failed to open file %s.", buf);
6156 /* Save the screen */
6160 /* Dump the screen */
6161 for (y = 0; y < hgt; y++)
6164 for (x = 0; x < wid - 1; x++)
6166 /* Get the attr/char */
6167 (void)(Term_what(x, y, &a, &c));
6177 fprintf(fff, "%s\n", buf);
6184 /* Dump the screen */
6185 for (y = 0; y < hgt; y++)
6188 for (x = 0; x < wid - 1; x++)
6190 /* Get the attr/char */
6191 (void)(Term_what(x, y, &a, &c));
6194 buf[x] = hack[a&0x0F];
6201 fprintf(fff, "%s\n", buf);
6213 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6215 msg_print("Screen dump saved.");
6221 /* Restore the screen */
6225 if (old_use_graphics)
6227 use_graphics = TRUE;
6230 /* Redraw everything */
6231 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6233 /* Hack -- update */
6240 * Sorting hook -- Comp function -- see below
6242 * We use "u" to point to array of monster indexes,
6243 * and "v" to select the type of sorting to perform on "u".
6245 static bool ang_sort_art_comp(vptr u, vptr v, int a, int b)
6247 u16b *who = (u16b*)(u);
6249 u16b *why = (u16b*)(v);
6256 /* Sort by total kills */
6259 /* Extract total kills */
6260 z1 = a_info[w1].tval;
6261 z2 = a_info[w2].tval;
6263 /* Compare total kills */
6264 if (z1 < z2) return (TRUE);
6265 if (z1 > z2) return (FALSE);
6269 /* Sort by monster level */
6272 /* Extract levels */
6273 z1 = a_info[w1].sval;
6274 z2 = a_info[w2].sval;
6276 /* Compare levels */
6277 if (z1 < z2) return (TRUE);
6278 if (z1 > z2) return (FALSE);
6282 /* Sort by monster experience */
6285 /* Extract experience */
6286 z1 = a_info[w1].level;
6287 z2 = a_info[w2].level;
6289 /* Compare experience */
6290 if (z1 < z2) return (TRUE);
6291 if (z1 > z2) return (FALSE);
6295 /* Compare indexes */
6301 * Sorting hook -- Swap function -- see below
6303 * We use "u" to point to array of monster indexes,
6304 * and "v" to select the type of sorting to perform.
6306 static void ang_sort_art_swap(vptr u, vptr v, int a, int b)
6308 u16b *who = (u16b*)(u);
6323 * Check the status of "artifacts"
6325 static void do_cmd_knowledge_artifacts(void)
6327 int i, k, z, x, y, n = 0;
6333 char file_name[1024];
6335 char base_name[MAX_NLEN];
6339 /* Open a new file */
6340 fff = my_fopen_temp(file_name, 1024);
6344 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6346 msg_format("Failed to create temporary file %s.", file_name);
6352 /* Allocate the "who" array */
6353 C_MAKE(who, max_a_idx, s16b);
6355 /* Allocate the "okay" array */
6356 C_MAKE(okay, max_a_idx, bool);
6358 /* Scan the artifacts */
6359 for (k = 0; k < max_a_idx; k++)
6361 artifact_type *a_ptr = &a_info[k];
6366 /* Skip "empty" artifacts */
6367 if (!a_ptr->name) continue;
6369 /* Skip "uncreated" artifacts */
6370 if (!a_ptr->cur_num) continue;
6376 /* Check the dungeon */
6377 for (y = 0; y < cur_hgt; y++)
6379 for (x = 0; x < cur_wid; x++)
6381 cave_type *c_ptr = &cave[y][x];
6383 s16b this_o_idx, next_o_idx = 0;
6385 /* Scan all objects in the grid */
6386 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
6390 /* Acquire object */
6391 o_ptr = &o_list[this_o_idx];
6393 /* Acquire next object */
6394 next_o_idx = o_ptr->next_o_idx;
6396 /* Ignore non-artifacts */
6397 if (!artifact_p(o_ptr)) continue;
6399 /* Ignore known items */
6400 if (object_known_p(o_ptr)) continue;
6402 /* Note the artifact */
6403 okay[o_ptr->name1] = FALSE;
6408 /* Check the inventory and equipment */
6409 for (i = 0; i < INVEN_TOTAL; i++)
6411 object_type *o_ptr = &inventory[i];
6413 /* Ignore non-objects */
6414 if (!o_ptr->k_idx) continue;
6416 /* Ignore non-artifacts */
6417 if (!artifact_p(o_ptr)) continue;
6419 /* Ignore known items */
6420 if (object_known_p(o_ptr)) continue;
6422 /* Note the artifact */
6423 okay[o_ptr->name1] = FALSE;
6426 for (k = 0; k < max_a_idx; k++)
6428 if (okay[k]) who[n++] = k;
6431 /* Select the sort method */
6432 ang_sort_comp = ang_sort_art_comp;
6433 ang_sort_swap = ang_sort_art_swap;
6435 /* Sort the array by dungeon depth of monsters */
6436 ang_sort(who, &why, n);
6438 /* Scan the artifacts */
6439 for (k = 0; k < n; k++)
6441 artifact_type *a_ptr = &a_info[who[k]];
6445 strcpy(base_name, "̤ÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à");
6447 strcpy(base_name, "Unknown Artifact");
6451 /* Obtain the base object type */
6452 z = lookup_kind(a_ptr->tval, a_ptr->sval);
6460 /* Get local object */
6463 /* Create fake object */
6464 object_prep(q_ptr, z);
6466 /* Make it an artifact */
6467 q_ptr->name1 = (byte)who[k];
6469 /* Describe the artifact */
6470 object_desc_store(base_name, q_ptr, FALSE, 0);
6473 /* Hack -- Build the artifact name */
6475 fprintf(fff, " %s\n", base_name);
6477 fprintf(fff, " The %s\n", base_name);
6482 /* Free the "who" array */
6483 C_KILL(who, max_a_idx, s16b);
6485 /* Free the "okay" array */
6486 C_KILL(okay, max_a_idx, bool);
6488 /* Close the file */
6491 /* Display the file contents */
6493 show_file(TRUE, file_name, "´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à", 0, 0);
6495 show_file(TRUE, file_name, "Artifacts Seen", 0, 0);
6499 /* Remove the file */
6505 * Display known uniques
6507 static void do_cmd_knowledge_uniques(void)
6515 char file_name[1024];
6517 /* Open a new file */
6518 fff = my_fopen_temp(file_name, 1024);
6522 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6524 msg_format("Failed to create temporary file %s.", file_name);
6530 /* Allocate the "who" array */
6531 C_MAKE(who, max_r_idx, s16b);
6533 /* Scan the monsters */
6534 for (i = 1; i < max_r_idx; i++)
6536 monster_race *r_ptr = &r_info[i];
6538 /* Use that monster */
6539 if (r_ptr->name) who[n++] = i;
6542 /* Select the sort method */
6543 ang_sort_comp = ang_sort_comp_hook;
6544 ang_sort_swap = ang_sort_swap_hook;
6546 /* Sort the array by dungeon depth of monsters */
6547 ang_sort(who, &why, n);
6549 /* Scan the monster races */
6550 for (k = 0; k < n; k++)
6552 monster_race *r_ptr = &r_info[who[k]];
6554 /* Only print Uniques */
6555 if (r_ptr->flags1 & (RF1_UNIQUE))
6557 bool dead = (r_ptr->max_num == 0);
6561 /* Only display "known" uniques */
6562 if (dead || cheat_know || r_ptr->r_sights)
6564 /* Print a message */
6566 fprintf(fff, " %s¤Ï¤Þ¤ÀÀ¸¤¤Æ¤¤¤ë¡£\n",
6567 (r_name + r_ptr->name));
6569 fprintf(fff, " %s is alive\n",
6570 (r_name + r_ptr->name));
6577 /* Free the "who" array */
6578 C_KILL(who, max_r_idx, s16b);
6580 /* Close the file */
6583 /* Display the file contents */
6585 show_file(TRUE, file_name, "¤Þ¤ÀÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼", 0, 0);
6587 show_file(TRUE, file_name, "Alive Uniques", 0, 0);
6591 /* Remove the file */
6597 * Display weapon-exp
6599 static void do_cmd_knowledge_weapon_exp(void)
6601 int i, j, num, weapon_exp;
6605 char file_name[1024];
6608 /* Open a new file */
6609 fff = my_fopen_temp(file_name, 1024);
6612 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6614 msg_format("Failed to create temporary file %s.", file_name);
6620 for (i = 0; i < 5; i++)
6622 for (num = 0; num < 64; num++)
6624 for (j = 0; j < max_k_idx; j++)
6626 object_kind *k_ptr = &k_info[j];
6628 if ((k_ptr->tval == TV_SWORD - i) && (k_ptr->sval == num))
6630 if ((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON)) continue;
6632 weapon_exp = p_ptr->weapon_exp[4 - i][num];
6634 fprintf(fff, "%-25s ", tmp);
6635 if (weapon_exp >= s_info[p_ptr->pclass].w_max[4 - i][num]) fprintf(fff, "!");
6636 else fprintf(fff, " ");
6637 fprintf(fff, "%s", exp_level_str[weapon_exp_level(weapon_exp)]);
6638 if (cheat_xtra) fprintf(fff, " %d", weapon_exp);
6646 /* Close the file */
6649 /* Display the file contents */
6651 show_file(TRUE, file_name, "Éð´ï¤Î·Ð¸³ÃÍ", 0, 0);
6653 show_file(TRUE, file_name, "Weapon Proficiency", 0, 0);
6657 /* Remove the file */
6665 static void do_cmd_knowledge_spell_exp(void)
6667 int i = 0, spell_exp, exp_level;
6672 char file_name[1024];
6674 /* Open a new file */
6675 fff = my_fopen_temp(file_name, 1024);
6678 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6680 msg_format("Failed to create temporary file %s.", file_name);
6686 if (p_ptr->realm1 != REALM_NONE)
6689 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm1]);
6691 fprintf(fff, "%s Spellbook\n", realm_names[p_ptr->realm1]);
6693 for (i = 0; i < 32; i++)
6695 if (!is_magic(p_ptr->realm1))
6697 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][i];
6701 s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][i];
6703 if (s_ptr->slevel >= 99) continue;
6704 spell_exp = p_ptr->spell_exp[i];
6705 exp_level = spell_exp_level(spell_exp);
6706 fprintf(fff, "%-25s ", spell_names[technic2magic(p_ptr->realm1) - 1][i]);
6707 if (p_ptr->realm1 == REALM_HISSATSU)
6708 fprintf(fff, "[--]");
6711 if (exp_level >= EXP_LEVEL_MASTER) fprintf(fff, "!");
6712 else fprintf(fff, " ");
6713 fprintf(fff, "%s", exp_level_str[exp_level]);
6715 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6720 if (p_ptr->realm2 != REALM_NONE)
6723 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm2]);
6725 fprintf(fff, "\n%s Spellbook\n", realm_names[p_ptr->realm2]);
6727 for (i = 0; i < 32; i++)
6729 if (!is_magic(p_ptr->realm1))
6731 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][i];
6735 s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][i];
6737 if (s_ptr->slevel >= 99) continue;
6739 spell_exp = p_ptr->spell_exp[i + 32];
6740 exp_level = spell_exp_level(spell_exp);
6741 fprintf(fff, "%-25s ", spell_names[technic2magic(p_ptr->realm2) - 1][i]);
6742 if (exp_level >= EXP_LEVEL_EXPERT) fprintf(fff, "!");
6743 else fprintf(fff, " ");
6744 fprintf(fff, "%s", exp_level_str[exp_level]);
6745 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6750 /* Close the file */
6753 /* Display the file contents */
6755 show_file(TRUE, file_name, "ËâË¡¤Î·Ð¸³ÃÍ", 0, 0);
6757 show_file(TRUE, file_name, "Spell Proficiency", 0, 0);
6761 /* Remove the file */
6769 static void do_cmd_knowledge_skill_exp(void)
6771 int i = 0, skill_exp;
6775 char file_name[1024];
6777 char skill_name[3][17]={"¥Þ¡¼¥·¥ã¥ë¥¢¡¼¥Ä", "ÆóÅáή ", "¾èÇÏ "};
6779 char skill_name[3][20]={"Martial Arts ", "Dual Wielding ", "Riding "};
6782 /* Open a new file */
6783 fff = my_fopen_temp(file_name, 1024);
6786 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6788 msg_format("Failed to create temporary file %s.", file_name);
6794 for (i = 0; i < 3; i++)
6796 skill_exp = p_ptr->skill_exp[i];
6797 fprintf(fff, "%-20s ", skill_name[i]);
6798 if (skill_exp >= s_info[p_ptr->pclass].s_max[i]) fprintf(fff, "!");
6799 else fprintf(fff, " ");
6800 fprintf(fff, "%s", exp_level_str[(i == GINOU_RIDING) ? riding_exp_level(skill_exp) : weapon_exp_level(skill_exp)]);
6801 if (cheat_xtra) fprintf(fff, " %d", skill_exp);
6805 /* Close the file */
6808 /* Display the file contents */
6810 show_file(TRUE, file_name, "µ»Ç½¤Î·Ð¸³ÃÍ", 0, 0);
6812 show_file(TRUE, file_name, "Miscellaneous Proficiency", 0, 0);
6816 /* Remove the file */
6822 * Pluralize a monster name
6824 void plural_aux(char *Name)
6826 int NameLen = strlen(Name);
6828 if (strstr(Name, "Disembodied hand"))
6830 strcpy(Name, "Disembodied hands that strangled people");
6832 else if (strstr(Name, "Colour out of space"))
6834 strcpy(Name, "Colours out of space");
6836 else if (strstr(Name, "stairway to hell"))
6838 strcpy(Name, "stairways to hell");
6840 else if (strstr(Name, "Dweller on the threshold"))
6842 strcpy(Name, "Dwellers on the threshold");
6844 else if (strstr(Name, " of "))
6846 cptr aider = strstr(Name, " of ");
6857 if (dummy[i-1] == 's')
6859 strcpy(&(dummy[i]), "es");
6864 strcpy(&(dummy[i]), "s");
6867 strcpy(&(dummy[i+1]), aider);
6868 strcpy(Name, dummy);
6870 else if (strstr(Name, "coins"))
6873 strcpy(dummy, "piles of ");
6874 strcat(dummy, Name);
6875 strcpy(Name, dummy);
6878 else if (strstr(Name, "Manes"))
6882 else if (streq(&(Name[NameLen - 2]), "ey"))
6884 strcpy(&(Name[NameLen - 2]), "eys");
6886 else if (Name[NameLen - 1] == 'y')
6888 strcpy(&(Name[NameLen - 1]), "ies");
6890 else if (streq(&(Name[NameLen - 4]), "ouse"))
6892 strcpy(&(Name[NameLen - 4]), "ice");
6894 else if (streq(&(Name[NameLen - 2]), "us"))
6896 strcpy(&(Name[NameLen - 2]), "i");
6898 else if (streq(&(Name[NameLen - 6]), "kelman"))
6900 strcpy(&(Name[NameLen - 6]), "kelmen");
6902 else if (streq(&(Name[NameLen - 8]), "wordsman"))
6904 strcpy(&(Name[NameLen - 8]), "wordsmen");
6906 else if (streq(&(Name[NameLen - 7]), "oodsman"))
6908 strcpy(&(Name[NameLen - 7]), "oodsmen");
6910 else if (streq(&(Name[NameLen - 7]), "eastman"))
6912 strcpy(&(Name[NameLen - 7]), "eastmen");
6914 else if (streq(&(Name[NameLen - 8]), "izardman"))
6916 strcpy(&(Name[NameLen - 8]), "izardmen");
6918 else if (streq(&(Name[NameLen - 5]), "geist"))
6920 strcpy(&(Name[NameLen - 5]), "geister");
6922 else if (streq(&(Name[NameLen - 2]), "ex"))
6924 strcpy(&(Name[NameLen - 2]), "ices");
6926 else if (streq(&(Name[NameLen - 2]), "lf"))
6928 strcpy(&(Name[NameLen - 2]), "lves");
6930 else if (suffix(Name, "ch") ||
6931 suffix(Name, "sh") ||
6932 suffix(Name, "nx") ||
6933 suffix(Name, "s") ||
6936 strcpy(&(Name[NameLen]), "es");
6940 strcpy(&(Name[NameLen]), "s");
6945 * Display current pets
6947 static void do_cmd_knowledge_pets(void)
6951 monster_type *m_ptr;
6953 int show_upkeep = 0;
6954 char file_name[1024];
6957 /* Open a new file */
6958 fff = my_fopen_temp(file_name, 1024);
6961 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6963 msg_format("Failed to create temporary file %s.", file_name);
6969 /* Process the monsters (backwards) */
6970 for (i = m_max - 1; i >= 1; i--)
6972 /* Access the monster */
6975 /* Ignore "dead" monsters */
6976 if (!m_ptr->r_idx) continue;
6978 /* Calculate "upkeep" for pets */
6983 monster_desc(pet_name, m_ptr, 0x88);
6984 fprintf(fff, "%s (%s)", pet_name, look_mon_desc(i, 0x00));
6985 if (p_ptr->riding == i)
6987 fprintf(fff, " ¾èÇÏÃæ");
6989 fprintf(fff, " Riding");
6995 show_upkeep = calculate_upkeep();
6997 fprintf(fff, "----------------------------------------------\n");
6999 fprintf(fff, " ¹ç·×: %d ɤ¤Î¥Ú¥Ã¥È\n", t_friends);
7000 fprintf(fff, " °Ý»ý¥³¥¹¥È: %d%% MP\n", show_upkeep);
7002 fprintf(fff, " Total: %d pet%s.\n",
7003 t_friends, (t_friends == 1 ? "" : "s"));
7004 fprintf(fff, " Upkeep: %d%% mana.\n", show_upkeep);
7009 /* Close the file */
7012 /* Display the file contents */
7014 show_file(TRUE, file_name, "¸½ºß¤Î¥Ú¥Ã¥È", 0, 0);
7016 show_file(TRUE, file_name, "Current Pets", 0, 0);
7020 /* Remove the file */
7028 * Note that the player ghosts are ignored. XXX XXX XXX
7030 static void do_cmd_knowledge_kill_count(void)
7038 char file_name[1024];
7043 /* Open a new file */
7044 fff = my_fopen_temp(file_name, 1024);
7048 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7050 msg_format("Failed to create temporary file %s.", file_name);
7056 /* Allocate the "who" array */
7057 C_MAKE(who, max_r_idx, s16b);
7060 /* Monsters slain */
7063 for (kk = 1; kk < max_r_idx; kk++)
7065 monster_race *r_ptr = &r_info[kk];
7067 if (r_ptr->flags1 & (RF1_UNIQUE))
7069 bool dead = (r_ptr->max_num == 0);
7078 s16b This = r_ptr->r_pkills;
7089 fprintf(fff,"¤¢¤Ê¤¿¤Ï¤Þ¤ÀŨ¤òÅݤ·¤Æ¤¤¤Ê¤¤¡£\n\n");
7091 fprintf(fff,"You have defeated no enemies yet.\n\n");
7094 else if (Total == 1)
7096 fprintf(fff,"¤¢¤Ê¤¿¤Ï°ìɤ¤ÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n");
7098 fprintf(fff,"You have defeated one enemy.\n\n");
7103 fprintf(fff,"¤¢¤Ê¤¿¤Ï %lu ɤ¤ÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n", Total);
7105 fprintf(fff,"You have defeated %lu enemies.\n\n", Total);
7112 /* Scan the monsters */
7113 for (i = 1; i < max_r_idx; i++)
7115 monster_race *r_ptr = &r_info[i];
7117 /* Use that monster */
7118 if (r_ptr->name) who[n++] = i;
7121 /* Select the sort method */
7122 ang_sort_comp = ang_sort_comp_hook;
7123 ang_sort_swap = ang_sort_swap_hook;
7125 /* Sort the array by dungeon depth of monsters */
7126 ang_sort(who, &why, n);
7128 /* Scan the monster races */
7129 for (k = 0; k < n; k++)
7131 monster_race *r_ptr = &r_info[who[k]];
7133 if (r_ptr->flags1 & (RF1_UNIQUE))
7135 bool dead = (r_ptr->max_num == 0);
7139 /* Print a message */
7140 fprintf(fff, " %s\n",
7141 (r_name + r_ptr->name));
7147 s16b This = r_ptr->r_pkills;
7152 /* p,t¤Ï¿Í¤È¿ô¤¨¤ë by ita*/
7153 if(strchr("pt",r_ptr->d_char))
7154 fprintf(fff, " %3d ¿Í¤Î %s\n", This, r_name + r_ptr->name);
7156 fprintf(fff, " %3d ɤ¤Î %s\n", This, r_name + r_ptr->name);
7160 if (strstr(r_name + r_ptr->name, "coins"))
7162 fprintf(fff, " 1 pile of %s\n", (r_name + r_ptr->name));
7166 fprintf(fff, " 1 %s\n", (r_name + r_ptr->name));
7172 strcpy(ToPlural, (r_name + r_ptr->name));
7173 plural_aux(ToPlural);
7174 fprintf(fff, " %d %s\n", This, ToPlural);
7184 fprintf(fff,"----------------------------------------------\n");
7186 fprintf(fff," ¹ç·×: %lu ɤ¤òÅݤ·¤¿¡£\n", Total);
7188 fprintf(fff," Total: %lu creature%s killed.\n",
7189 Total, (Total == 1 ? "" : "s"));
7193 /* Free the "who" array */
7194 C_KILL(who, max_r_idx, s16b);
7196 /* Close the file */
7199 /* Display the file contents */
7201 show_file(TRUE, file_name, "Åݤ·¤¿Å¨¤Î¿ô", 0, 0);
7203 show_file(TRUE, file_name, "Kill Count", 0, 0);
7207 /* Remove the file */
7213 * Display the object groups.
7215 static void display_group_list(int col, int row, int wid, int per_page,
7216 int grp_idx[], cptr group_text[], int grp_cur, int grp_top)
7220 /* Display lines until done */
7221 for (i = 0; i < per_page && (grp_idx[i] >= 0); i++)
7223 /* Get the group index */
7224 int grp = grp_idx[grp_top + i];
7226 /* Choose a color */
7227 byte attr = (grp_top + i == grp_cur) ? TERM_L_BLUE : TERM_WHITE;
7229 /* Erase the entire line */
7230 Term_erase(col, row + i, wid);
7232 /* Display the group label */
7233 c_put_str(attr, group_text[grp], row + i, col);
7239 * Move the cursor in a browser window
7241 static void browser_cursor(char ch, int *column, int *grp_cur, int grp_cnt,
7242 int *list_cur, int list_cnt)
7247 int list = *list_cur;
7249 /* Extract direction */
7252 /* Hack -- scroll up full screen */
7257 /* Hack -- scroll down full screen */
7262 d = get_keymap_dir(ch);
7267 /* Diagonals - hack */
7268 if ((ddx[d] > 0) && ddy[d])
7274 Term_get_size(&wid, &hgt);
7276 browser_rows = hgt - 8;
7278 /* Browse group list */
7283 /* Move up or down */
7284 grp += ddy[d] * (browser_rows - 1);
7287 if (grp >= grp_cnt) grp = grp_cnt - 1;
7288 if (grp < 0) grp = 0;
7289 if (grp != old_grp) list = 0;
7292 /* Browse sub-list list */
7295 /* Move up or down */
7296 list += ddy[d] * browser_rows;
7299 if (list >= list_cnt) list = list_cnt - 1;
7300 if (list < 0) list = 0;
7312 if (col < 0) col = 0;
7313 if (col > 1) col = 1;
7320 /* Browse group list */
7325 /* Move up or down */
7329 if (grp >= grp_cnt) grp = grp_cnt - 1;
7330 if (grp < 0) grp = 0;
7331 if (grp != old_grp) list = 0;
7334 /* Browse sub-list list */
7337 /* Move up or down */
7341 if (list >= list_cnt) list = list_cnt - 1;
7342 if (list < 0) list = 0;
7353 static void display_visual_list(int col, int row, int height, int width, byte attr_top, byte char_left)
7357 /* Clear the display lines */
7358 for (i = 0; i < height; i++)
7360 Term_erase(col, row + i, width);
7363 /* Bigtile mode uses double width */
7364 if (use_bigtile) width /= 2;
7366 /* Display lines until done */
7367 for (i = 0; i < height; i++)
7369 /* Display columns until done */
7370 for (j = 0; j < width; j++)
7378 /* Bigtile mode uses double width */
7379 if (use_bigtile) x += j;
7384 /* Ignore illegal characters */
7385 if (ia > 0x7f || ic > 0xff || ic < ' ' ||
7386 (!use_graphics && ic > 0x7f))
7392 /* Force correct code for both ASCII character and tile */
7393 if (c & 0x80) a |= 0x80;
7395 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
7397 /* Display symbol */
7398 Term_putch(x, y, a, c);
7401 if (use_bigtile) Term_putch(x + 1, y, a2, c2);
7408 * Place the cursor at the collect position for visual mode
7410 static void place_visual_list_cursor(int col, int row, byte a, byte c, byte attr_top, byte char_left)
7412 int i = (a & 0x7f) - attr_top;
7413 int j = c - char_left;
7418 /* Bigtile mode uses double width */
7419 if (use_bigtile) x += j;
7421 /* Place the cursor */
7427 * Clipboard variables for copy&paste in visual mode
7429 static byte attr_idx = 0;
7430 static byte char_idx = 0;
7433 * Do visual mode command -- Change symbols
7435 static bool visual_mode_command(char ch, bool *visual_list_ptr,
7436 int height, int width,
7437 byte *attr_top_ptr, byte *char_left_ptr,
7438 byte *cur_attr_ptr, byte *cur_char_ptr)
7440 static byte attr_old = 0, char_old = 0;
7445 if (*visual_list_ptr)
7448 *cur_attr_ptr = attr_old;
7449 *cur_char_ptr = char_old;
7450 *visual_list_ptr = FALSE;
7459 if (*visual_list_ptr)
7462 *visual_list_ptr = FALSE;
7470 if (!*visual_list_ptr)
7472 *visual_list_ptr = TRUE;
7474 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7475 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7477 attr_old = *cur_attr_ptr;
7478 char_old = *cur_char_ptr;
7486 /* Set the visual */
7487 attr_idx = *cur_attr_ptr;
7488 char_idx = *cur_char_ptr;
7497 *cur_attr_ptr = attr_idx;
7498 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7504 *cur_char_ptr = char_idx;
7505 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7511 if (*visual_list_ptr)
7514 int d = get_keymap_dir(ch);
7515 byte a = (*cur_attr_ptr & 0x7f);
7516 byte c = *cur_char_ptr;
7518 if (use_bigtile) eff_width = width / 2;
7519 else eff_width = width;
7521 /* Restrict direction */
7522 if ((a == 0) && (ddy[d] < 0)) d = 0;
7523 if ((c == 0) && (ddx[d] < 0)) d = 0;
7524 if ((a == 0x7f) && (ddy[d] > 0)) d = 0;
7525 if ((c == 0xff) && (ddx[d] > 0)) d = 0;
7530 /* Force correct code for both ASCII character and tile */
7531 if (c & 0x80) a |= 0x80;
7533 /* Set the visual */
7538 /* Move the frame */
7539 if ((ddx[d] < 0) && *char_left_ptr > MAX(0, (int)c - 10)) (*char_left_ptr)--;
7540 if ((ddx[d] > 0) && *char_left_ptr + eff_width < MIN(0xff, (int)c + 10)) (*char_left_ptr)++;
7541 if ((ddy[d] < 0) && *attr_top_ptr > MAX(0, (int)(a & 0x7f) - 4)) (*attr_top_ptr)--;
7542 if ((ddy[d] > 0) && *attr_top_ptr + height < MIN(0x7f, (a & 0x7f) + 4)) (*attr_top_ptr)++;
7549 /* Visual mode command is not used */
7555 * Display the monsters in a group.
7557 static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
7558 int mon_cur, int mon_top)
7562 /* Display lines until done */
7563 for (i = 0; i < per_page && mon_idx[mon_top + i]; i++)
7569 /* Get the race index */
7570 int r_idx = mon_idx[mon_top + i] ;
7572 /* Access the race */
7573 monster_race *r_ptr = &r_info[r_idx];
7576 /* Choose a color */
7577 attr = ((i + mon_top == mon_cur) ? TERM_L_BLUE : TERM_WHITE);
7579 /* Display the name */
7580 c_prt(attr, (r_name + r_ptr->name), row + i, col);
7582 /* Hack -- visual_list mode */
7585 c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, 60);
7587 else if (p_ptr->wizard)
7589 c_prt(attr, format("%d", r_idx), row + i, 60);
7594 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
7596 /* Display symbol */
7597 Term_putch(70, row + i, a, c);
7600 if (use_bigtile) Term_putch(70 + 1, row + i, a2, c2);
7603 if (!(r_ptr->flags1 & RF1_UNIQUE)) put_str(format("%5d", r_ptr->r_pkills), row + i, 73);
7605 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? "»àË´" : "À¸Â¸"), row + i, 73);
7607 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? "dead" : "alive"), row + i, 73);
7612 /* Clear remaining lines */
7613 for (; i < per_page; i++)
7615 Term_erase(col, row + i, 255);
7621 * Display known monsters.
7623 static void do_cmd_knowledge_monsters(void)
7626 int grp_cur, grp_top, old_grp_cur;
7627 int mon_cur, mon_top;
7628 int grp_cnt, grp_idx[100];
7636 bool visual_list = FALSE;
7637 byte attr_top = 0, char_left = 0;
7643 Term_get_size(&wid, &hgt);
7645 browser_rows = hgt - 8;
7647 /* Allocate the "mon_idx" array */
7648 C_MAKE(mon_idx, max_r_idx, s16b);
7653 /* Check every group */
7654 for (i = 0; monster_group_text[i] != NULL; i++)
7656 /* Measure the label */
7657 len = strlen(monster_group_text[i]);
7659 /* Save the maximum length */
7660 if (len > max) max = len;
7662 /* See if any monsters are known */
7663 if ((monster_group_char[i] == ((char *) -1L)) || collect_monsters(i, mon_idx, 0x01))
7665 /* Build a list of groups with known monsters */
7666 grp_idx[grp_cnt++] = i;
7670 /* Terminate the list */
7671 grp_idx[grp_cnt] = -1;
7674 grp_cur = grp_top = 0;
7675 mon_cur = mon_top = 0;
7684 monster_race *r_ptr;
7691 prt("Ãμ± - ¥â¥ó¥¹¥¿¡¼", 2, 0);
7692 prt("¥°¥ë¡¼¥×", 4, 0);
7693 prt("̾Á°", 4, max + 3);
7694 if (p_ptr->wizard) prt("Idx", 4, 60);
7695 prt("ʸ»ú »¦³²¿ô", 4, 67);
7697 prt("Knowledge - Monsters", 2, 0);
7699 prt("Name", 4, max + 3);
7700 if (p_ptr->wizard) prt("Idx", 4, 60);
7701 prt("Sym Kills", 4, 67);
7704 for (i = 0; i < 78; i++)
7706 Term_putch(i, 5, TERM_WHITE, '=');
7709 for (i = 0; i < browser_rows; i++)
7711 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7717 /* Scroll group list */
7718 if (grp_cur < grp_top) grp_top = grp_cur;
7719 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7721 /* Display a list of monster groups */
7722 display_group_list(0, 6, max, browser_rows, grp_idx, monster_group_text, grp_cur, grp_top);
7724 if (old_grp_cur != grp_cur)
7726 old_grp_cur = grp_cur;
7728 /* Get a list of monsters in the current group */
7729 mon_cnt = collect_monsters(grp_idx[grp_cur], mon_idx, 0x00);
7732 /* Scroll monster list */
7733 while (mon_cur < mon_top)
7734 mon_top = MAX(0, mon_top - browser_rows/2);
7735 while (mon_cur >= mon_top + browser_rows)
7736 mon_top = MIN(mon_cnt - browser_rows, mon_top + browser_rows/2);
7740 /* Display a list of monsters in the current group */
7741 display_monster_list(max + 3, 6, browser_rows, mon_idx, mon_cur, mon_top);
7747 /* Display a monster name */
7748 display_monster_list(max + 3, 6, 1, mon_idx, mon_cur, mon_top);
7750 /* Display visual list below first monster */
7751 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7756 prt(format("<Êý¸þ>, 'r'¤Ç»×¤¤½Ð¤ò¸«¤ë%s%s, ESC", visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹", (attr_idx||char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"), hgt - 1, 0);
7758 prt(format("<dir>, 'r' to recall%s%s, ESC", visual_list ? ", ENTER to accept" : ", 'v' for visuals", (attr_idx||char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"), hgt - 1, 0);
7761 /* Get the current monster */
7762 r_ptr = &r_info[mon_idx[mon_cur]];
7764 /* Mega Hack -- track this monster race */
7765 if (mon_cnt) monster_race_track(mon_idx[mon_cur]);
7767 /* Hack -- handle stuff */
7772 place_visual_list_cursor(max + 3, 7, r_ptr->x_attr, r_ptr->x_char, attr_top, char_left);
7776 Term_gotoxy(0, 6 + (grp_cur - grp_top));
7780 Term_gotoxy(max + 3, 6 + (mon_cur - mon_top));
7785 /* Do visual mode command if needed */
7786 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)) continue;
7799 /* Recall on screen */
7800 if (mon_idx[mon_cur])
7802 screen_roff(mon_idx[mon_cur], 0);
7813 /* Move the cursor */
7814 browser_cursor(ch, &column, &grp_cur, grp_cnt, &mon_cur, mon_cnt);
7821 /* Free the "mon_idx" array */
7822 C_KILL(mon_idx, max_r_idx, s16b);
7827 * Display the objects in a group.
7829 static void display_object_list(int col, int row, int per_page, int object_idx[],
7830 int object_cur, int object_top)
7834 /* Display lines until done */
7835 for (i = 0; i < per_page && object_idx[object_top + i]; i++)
7841 /* Get the object index */
7842 int k_idx = object_idx[object_top + i];
7844 /* Access the object */
7845 object_kind *k_ptr = &k_info[k_idx];
7847 /* Choose a color */
7848 byte attr = (k_ptr->aware ? TERM_WHITE : TERM_SLATE);
7849 byte cursor = (k_ptr->aware ? TERM_L_BLUE : TERM_BLUE);
7851 attr = ((i + object_top == object_cur) ? cursor : attr);
7854 strip_name(o_name, k_idx);
7856 /* Display the name */
7857 c_prt(attr, o_name, row + i, col);
7859 /* Hack -- visual_list mode */
7862 c_prt(attr, format("%02x/%02x", k_ptr->x_attr, k_ptr->x_char), row + i, 60);
7864 else if (p_ptr->wizard)
7866 c_prt(attr, format ("%d", k_idx), row + i, 70);
7869 a = k_ptr->flavor ? misc_to_attr[k_ptr->flavor] : k_ptr->x_attr;
7870 c = k_ptr->flavor ? misc_to_char[k_ptr->flavor] : k_ptr->x_char;
7872 /* Symbol is unknown */
7873 if (!k_ptr->aware && !p_ptr->wizard)
7879 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
7881 /* Display symbol */
7882 Term_putch(76, row + i, a, c);
7885 if (use_bigtile) Term_putch(76 + 1, row + i, a2, c2);
7888 /* Clear remaining lines */
7889 for (; i < per_page; i++)
7891 Term_erase(col, row + i, 255);
7896 * Describe fake object
7898 static void desc_obj_fake(int k_idx)
7901 object_type object_type_body;
7903 /* Get local object */
7904 o_ptr = &object_type_body;
7906 /* Wipe the object */
7909 /* Create the artifact */
7910 object_prep(o_ptr, k_idx);
7912 /* It's fully know */
7913 o_ptr->ident |= IDENT_KNOWN;
7915 /* Track the object */
7916 /* object_actual_track(o_ptr); */
7918 /* Hack - mark as fake */
7919 /* term_obj_real = FALSE; */
7921 /* Hack -- Handle stuff */
7924 if (!screen_object(o_ptr, FALSE))
7927 msg_print("ÆäËÊѤï¤Ã¤¿¤È¤³¤í¤Ï¤Ê¤¤¤è¤¦¤À¡£");
7929 msg_print("You see nothing special.");
7938 * Display known objects
7940 static void do_cmd_knowledge_objects(void)
7943 int grp_cur, grp_top, old_grp_cur;
7944 int object_old, object_cur, object_top;
7945 int grp_cnt, grp_idx[100];
7953 bool visual_list = FALSE;
7954 byte attr_top = 0, char_left = 0;
7960 Term_get_size(&wid, &hgt);
7962 browser_rows = hgt - 8;
7964 /* Allocate the "object_idx" array */
7965 C_MAKE(object_idx, max_k_idx, int);
7970 /* Check every group */
7971 for (i = 0; object_group_text[i] != NULL; i++)
7973 /* Measure the label */
7974 len = strlen(object_group_text[i]);
7976 /* Save the maximum length */
7977 if (len > max) max = len;
7979 /* See if any monsters are known */
7980 if (collect_objects(i, object_idx))
7982 /* Build a list of groups with known monsters */
7983 grp_idx[grp_cnt++] = i;
7987 /* Terminate the list */
7988 grp_idx[grp_cnt] = -1;
7991 grp_cur = grp_top = 0;
7992 object_cur = object_top = 0;
8009 prt("Ãμ± - ¥¢¥¤¥Æ¥à", 2, 0);
8010 prt("¥°¥ë¡¼¥×", 4, 0);
8011 prt("̾Á°", 4, max + 3);
8012 if (p_ptr->wizard) prt("Idx", 4, 70);
8015 prt("Knowledge - objects", 2, 0);
8017 prt("Name", 4, max + 3);
8018 if (p_ptr->wizard) prt("Idx", 4, 70);
8022 for (i = 0; i < 78; i++)
8024 Term_putch(i, 5, TERM_WHITE, '=');
8027 for (i = 0; i < browser_rows; i++)
8029 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8035 /* Scroll group list */
8036 if (grp_cur < grp_top) grp_top = grp_cur;
8037 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8039 /* Display a list of object groups */
8040 display_group_list(0, 6, max, browser_rows, grp_idx, object_group_text, grp_cur, grp_top);
8042 if (old_grp_cur != grp_cur)
8044 old_grp_cur = grp_cur;
8046 /* Get a list of objects in the current group */
8047 object_cnt = collect_objects(grp_idx[grp_cur], object_idx);
8050 /* Scroll object list */
8051 while (object_cur < object_top)
8052 object_top = MAX(0, object_top - browser_rows/2);
8053 while (object_cur >= object_top + browser_rows)
8054 object_top = MIN(object_cnt - browser_rows, object_top + browser_rows/2);
8058 /* Display a list of objects in the current group */
8059 display_object_list(max + 3, 6, browser_rows, object_idx, object_cur, object_top);
8063 object_top = object_cur;
8065 /* Display a list of objects in the current group */
8066 display_object_list(max + 3, 6, 1, object_idx, object_cur, object_top);
8068 /* Display visual list below first object */
8069 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8072 /* Get the current object */
8073 k_ptr = &k_info[object_idx[object_cur]];
8075 /* Mega Hack -- track this object */
8076 if (object_cnt) object_kind_track(object_idx[object_cur]);
8080 prt(format("<Êý¸þ>, 'r'¤Ç»×¤¤½Ð¤ò¸«¤ë%s%s, ESC", k_ptr->flavor ? "" : visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹", (attr_idx||char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"), hgt - 1, 0);
8082 prt(format("<dir>, 'r' to recall%s%s, ESC", k_ptr->flavor ? "" : visual_list ? ", ENTER to accept" : ", 'v' for visuals", (attr_idx||char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"), hgt - 1, 0);
8085 /* The "current" object changed */
8086 if (object_old != object_idx[object_cur])
8088 /* Hack -- handle stuff */
8091 /* Remember the "current" object */
8092 object_old = object_idx[object_cur];
8097 place_visual_list_cursor(max + 3, 7, k_ptr->x_attr, k_ptr->x_char, attr_top, char_left);
8101 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8105 Term_gotoxy(max + 3, 6 + (object_cur - object_top));
8110 /* Do visual mode command if needed */
8111 /* Symbol of objects with flavor cannot be changed */
8112 if (!k_ptr->flavor && visual_mode_command(ch, &visual_list, browser_rows-1, wid - (max + 3), &attr_top, &char_left, &k_ptr->x_attr, &k_ptr->x_char)) continue;
8125 /* Recall on screen */
8127 desc_obj_fake(object_idx[object_cur]);
8135 /* Move the cursor */
8136 browser_cursor(ch, &column, &grp_cur, grp_cnt, &object_cur, object_cnt);
8142 /* Free the "object_idx" array */
8143 C_KILL(object_idx, max_k_idx, int);
8149 * Display the features in a group.
8151 static void display_feature_list(int col, int row, int per_page, int *feat_idx,
8152 int feat_cur, int feat_top)
8156 /* Display lines until done */
8157 for (i = 0; i < per_page && feat_idx[feat_top + i]; i++)
8164 int f_idx = feat_idx[feat_top + i];
8166 /* Access the index */
8167 feature_type *f_ptr = &f_info[f_idx];
8169 /* Choose a color */
8170 attr = ((i + feat_top == feat_cur) ? TERM_L_BLUE : TERM_WHITE);
8172 /* Display the name */
8173 c_prt(attr, f_name + f_ptr->name, row + i, col);
8175 /* Hack -- visual_list mode */
8178 c_prt(attr, format("%02x/%02x", f_ptr->x_attr, f_ptr->x_char), row + i, 60);
8184 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
8186 /* Display symbol */
8187 Term_putch(68, row + i, a, c);
8190 if (use_bigtile) Term_putch(68 + 1, row + i, a2, c2);
8193 /* Clear remaining lines */
8194 for (; i < per_page; i++)
8196 Term_erase(col, row + i, 255);
8202 * Interact with feature visuals.
8204 static void do_cmd_knowledge_features(void)
8207 int grp_cur, grp_top, old_grp_cur;
8208 int feat_cur, feat_top;
8209 int grp_cnt, grp_idx[100];
8217 bool visual_list = FALSE;
8218 byte attr_top = 0, char_left = 0;
8224 Term_get_size(&wid, &hgt);
8226 browser_rows = hgt - 8;
8228 /* Allocate the "feat_idx" array */
8229 C_MAKE(feat_idx, max_f_idx, int);
8234 /* Check every group */
8235 for (i = 0; feature_group_text[i] != NULL; i++)
8237 /* Measure the label */
8238 len = strlen(feature_group_text[i]);
8240 /* Save the maximum length */
8241 if (len > max) max = len;
8243 /* See if any features are known */
8244 if (collect_features(i, feat_idx))
8246 /* Build a list of groups with known features */
8247 grp_idx[grp_cnt++] = i;
8251 /* Terminate the list */
8252 grp_idx[grp_cnt] = -1;
8255 grp_cur = grp_top = 0;
8256 feat_cur = feat_top = 0;
8262 while ((!flag) && (grp_cnt))
8265 feature_type *f_ptr;
8271 prt("Visuals - features", 2, 0);
8273 prt("Name", 4, max + 3);
8276 for (i = 0; i < 78; i++)
8278 Term_putch(i, 5, TERM_WHITE, '=');
8281 for (i = 0; i < browser_rows; i++)
8283 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8289 /* Scroll group list */
8290 if (grp_cur < grp_top) grp_top = grp_cur;
8291 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8293 /* Display a list of feature groups */
8294 display_group_list(0, 6, max, browser_rows, grp_idx, feature_group_text, grp_cur, grp_top);
8296 if (old_grp_cur != grp_cur)
8298 old_grp_cur = grp_cur;
8300 /* Get a list of features in the current group */
8301 feat_cnt = collect_features(grp_idx[grp_cur], feat_idx);
8304 /* Scroll feature list */
8305 while (feat_cur < feat_top)
8306 feat_top = MAX(0, feat_top - browser_rows/2);
8307 while (feat_cur >= feat_top + browser_rows)
8308 feat_top = MIN(feat_cnt - browser_rows, feat_top + browser_rows/2);
8312 /* Display a list of features in the current group */
8313 display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top);
8317 feat_top = feat_cur;
8319 /* Display a list of features in the current group */
8320 display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top);
8322 /* Display visual list below first object */
8323 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8328 prt(format("<Êý¸þ>%s%s, ESC", visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹", (attr_idx||char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"), hgt - 1, 0);
8330 prt(format("<dir>%s%s, ESC", visual_list ? ", ENTER to accept" : ", 'v' for visuals", (attr_idx||char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"), hgt - 1, 0);
8333 /* Get the current feature */
8334 f_ptr = &f_info[feat_idx[feat_cur]];
8338 place_visual_list_cursor(max + 3, 7, f_ptr->x_attr, f_ptr->x_char, attr_top, char_left);
8342 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8346 Term_gotoxy(max + 3, 6 + (feat_cur - feat_top));
8351 /* Do visual mode command if needed */
8352 if (visual_mode_command(ch, &visual_list, browser_rows-1, wid - (max + 3), &attr_top, &char_left, &f_ptr->x_attr, &f_ptr->x_char)) continue;
8364 /* Move the cursor */
8365 browser_cursor(ch, &column, &grp_cur, grp_cnt, &feat_cur, feat_cnt);
8372 if (!grp_cnt) msg_print("No features known.");
8374 /* Free the "feat_idx" array */
8375 C_KILL(feat_idx, max_f_idx, int);
8380 * List wanted monsters
8382 static void do_cmd_knowledge_kubi(void)
8387 char file_name[1024];
8390 /* Open a new file */
8391 fff = my_fopen_temp(file_name, 1024);
8394 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8396 msg_format("Failed to create temporary file %s.", file_name);
8405 fprintf(fff, "º£Æü¤Î¥¿¡¼¥²¥Ã¥È : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "ÉÔÌÀ"));
8407 fprintf(fff, "¾Þ¶â¼ó¥ê¥¹¥È\n");
8409 fprintf(fff, "Today target : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "unknown"));
8411 fprintf(fff, "List of wanted monsters\n");
8413 for (i = 0; i < MAX_KUBI; i++)
8415 fprintf(fff,"%-40s ---- ",r_name + r_info[(kubi_r_idx[i] > 10000 ? kubi_r_idx[i] - 10000 : kubi_r_idx[i])].name);
8416 if (kubi_r_idx[i] > 10000)
8418 fprintf(fff, "ºÑ\n");
8420 fprintf(fff, "done\n");
8423 fprintf(fff, "$%d\n", 300 * (r_info[kubi_r_idx[i]].level + 1));
8427 /* Close the file */
8430 /* Display the file contents */
8432 show_file(TRUE, file_name, "¾Þ¶â¼ó¤Î°ìÍ÷", 0, 0);
8434 show_file(TRUE, file_name, "Wanted monsters", 0, 0);
8438 /* Remove the file */
8443 * List virtues & status
8445 static void do_cmd_knowledge_virtues(void)
8449 char file_name[1024];
8452 /* Open a new file */
8453 fff = my_fopen_temp(file_name, 1024);
8456 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8458 msg_format("Failed to create temporary file %s.", file_name);
8467 fprintf(fff, "¸½ºß¤Î°À : %s\n\n", your_alignment());
8469 fprintf(fff, "Your alighnment : %s\n\n", your_alignment());
8474 /* Close the file */
8477 /* Display the file contents */
8479 show_file(TRUE, file_name, "Ȭ¤Ä¤ÎÆÁ", 0, 0);
8481 show_file(TRUE, file_name, "Virtues", 0, 0);
8485 /* Remove the file */
8493 static void do_cmd_knowledge_dungeon(void)
8497 char file_name[1024];
8501 /* Open a new file */
8502 fff = my_fopen_temp(file_name, 1024);
8505 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8507 msg_format("Failed to create temporary file %s.", file_name);
8515 for (i = 1; i < max_d_idx; i++)
8519 if (!d_info[i].maxdepth) continue;
8520 if (!max_dlv[i]) continue;
8521 if (d_info[i].final_guardian)
8523 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
8525 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
8527 fprintf(fff,"%c%-12s : %3d ³¬\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
8529 fprintf(fff,"%c%-16s : level %3d\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
8534 /* Close the file */
8537 /* Display the file contents */
8539 show_file(TRUE, file_name, "º£¤Þ¤Ç¤ËÆþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó", 0, 0);
8541 show_file(TRUE, file_name, "Dungeon", 0, 0);
8545 /* Remove the file */
8550 * List virtues & status
8553 static void do_cmd_knowledge_stat(void)
8557 char file_name[1024];
8560 /* Open a new file */
8561 fff = my_fopen_temp(file_name, 1024);
8564 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8566 msg_format("Failed to create temporary file %s.", file_name);
8574 percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
8575 (2 * p_ptr->hitdie +
8576 ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
8579 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : %d/100\n\n", percent);
8580 else fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : ???\n\n");
8581 fprintf(fff, "ǽÎϤκÇÂçÃÍ\n\n");
8583 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "Your current Life Rating is %d/100.\n\n", percent);
8584 else fprintf(fff, "Your current Life Rating is ???.\n\n");
8585 fprintf(fff, "Limits of maximum stats\n\n");
8587 for (v_nr = 0; v_nr < 6; v_nr++)
8589 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);
8590 else fprintf(fff, "%s ???\n", stat_names[v_nr]);
8596 /* Close the file */
8599 /* Display the file contents */
8601 show_file(TRUE, file_name, "¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó", 0, 0);
8603 show_file(TRUE, file_name, "HP-rate & Max stat", 0, 0);
8607 /* Remove the file */
8613 * Print quest status of all active quests
8615 static void do_cmd_knowledge_quests(void)
8618 char file_name[1024];
8620 char rand_tmp_str[120] = "\0";
8622 monster_race *r_ptr;
8624 int rand_level = 100;
8627 /* Open a new file */
8628 fff = my_fopen_temp(file_name, 1024);
8631 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8633 msg_format("Failed to create temporary file %s.", file_name);
8640 fprintf(fff, "¡Ô¿ë¹ÔÃæ¤Î¥¯¥¨¥¹¥È¡Õ\n");
8642 fprintf(fff, "< Current Quest >\n");
8645 for (i = 1; i < max_quests; i++)
8647 if (quest[i].status == QUEST_STATUS_TAKEN || quest[i].status == QUEST_STATUS_COMPLETED)
8652 /* Clear the text */
8653 for (j = 0; j < 10; j++)
8655 quest_text[j][0] = '\0';
8658 quest_text_line = 0;
8660 /* Set the quest number temporary */
8661 old_quest = p_ptr->inside_quest;
8662 p_ptr->inside_quest = i;
8664 /* Get the quest text */
8665 init_flags = INIT_SHOW_TEXT;
8667 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8669 /* Reset the old quest number */
8670 p_ptr->inside_quest = old_quest;
8672 /* No info from "silent" quests */
8673 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8677 if (quest[i].type != QUEST_TYPE_RANDOM)
8679 char note[80] = "\0";
8681 if (quest[i].status == QUEST_STATUS_TAKEN)
8683 if (quest[i].type == QUEST_TYPE_KILL_LEVEL || quest[i].type == QUEST_TYPE_KILL_ANY_LEVEL)
8685 r_ptr = &r_info[quest[i].r_idx];
8686 strcpy(name, r_name + r_ptr->name);
8687 if (quest[i].max_num > 1)
8690 sprintf(note," - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",quest[i].max_num, name, quest[i].max_num-quest[i].cur_num);
8693 sprintf(note," - kill %d %s, have killed %d.",quest[i].max_num, name, quest[i].cur_num);
8698 sprintf(note," - %s¤òÅݤ¹¡£",name);
8700 sprintf(note," - kill %s.",name);
8703 else if (quest[i].type == QUEST_TYPE_KILL_NUMBER)
8706 sprintf(note," - %d ÂΤΥâ¥ó¥¹¥¿¡¼¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",quest[i].max_num, quest[i].max_num-quest[i].cur_num);
8708 sprintf(note," - Kill %d monsters, have killed %d.",quest[i].max_num, quest[i].cur_num);
8711 else if (quest[i].type == QUEST_TYPE_FIND_ARTIFACT)
8713 strcpy(name, a_name + a_info[quest[i].k_idx].name);
8715 sprintf(note," - %s¤ò¸«¤Ä¤±½Ð¤¹¡£", name);
8717 sprintf(note," - Find out %s.", name);
8720 else if (quest[i].type == QUEST_TYPE_FIND_EXIT)
8722 sprintf(note," - õº÷¤¹¤ë¡£");
8724 sprintf(note," - Search.");
8726 else if (quest[i].type == QUEST_TYPE_KILL_ALL)
8728 sprintf(note," - Á´¤Æ¤Î¥â¥ó¥¹¥¿¡¼¤òÅݤ¹¡£");
8730 sprintf(note," - Kill all monsters.");
8734 /* Print the quest info */
8736 sprintf(tmp_str, "%s (´í¸±ÅÙ:%d³¬ÁêÅö)%s\n",
8737 quest[i].name, quest[i].level, note);
8739 sprintf(tmp_str, "%s (Danger level: %d)%s\n",
8740 quest[i].name, quest[i].level, note);
8743 fprintf(fff, tmp_str);
8745 if (quest[i].status == QUEST_STATUS_COMPLETED)
8748 sprintf(tmp_str, " ¥¯¥¨¥¹¥ÈãÀ® - ¤Þ¤ÀÊó½·¤ò¼õ¤±¤È¤Ã¤Æ¤Ê¤¤¡£\n");
8750 sprintf(tmp_str, " Quest Completed - Unrewarded\n");
8753 fprintf(fff, tmp_str);
8759 while (quest_text[j][0] && j < 10)
8761 fprintf(fff, " %s\n", quest_text[j]);
8766 else if ((quest[i].type == QUEST_TYPE_RANDOM) &&
8767 (quest[i].level < rand_level))
8770 rand_level = quest[i].level;
8772 if (max_dlv[DUNGEON_ANGBAND] >= rand_level)
8774 /* Print the quest info */
8775 r_ptr = &r_info[quest[i].r_idx];
8776 strcpy(name, r_name + r_ptr->name);
8778 if (quest[i].max_num > 1)
8781 sprintf(rand_tmp_str,"%s (%d ³¬) - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)\n",
8782 quest[i].name, quest[i].level,
8783 quest[i].max_num, name, quest[i].max_num-quest[i].cur_num);
8787 sprintf(rand_tmp_str,"%s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
8788 quest[i].name, quest[i].level,
8789 quest[i].max_num, name, quest[i].cur_num);
8795 sprintf(rand_tmp_str,"%s (%d ³¬) - %s¤òÅݤ¹¡£\n",
8796 quest[i].name, quest[i].level, name);
8798 sprintf(rand_tmp_str,"%s (Dungeon level: %d)\n Kill %s.\n",
8799 quest[i].name, quest[i].level, name);
8807 /* Print the current random quest */
8808 if (rand_tmp_str[0]) fprintf(fff, rand_tmp_str);
8811 if (!total) fprintf(fff, "¤Ê¤·\n");
8813 if (!total) fprintf(fff, "Nothing.\n");
8817 fprintf(fff, "\n¡ÔãÀ®¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
8819 fprintf(fff, "\n< Completed Quest >\n");
8822 for (i = 1; i < max_quests; i++)
8824 if (quest[i].status == QUEST_STATUS_FINISHED)
8826 if (i < MIN_RANDOM_QUEST)
8830 /* Set the quest number temporary */
8831 old_quest = p_ptr->inside_quest;
8832 p_ptr->inside_quest = i;
8835 init_flags = INIT_ASSIGN;
8837 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8839 /* Reset the old quest number */
8840 p_ptr->inside_quest = old_quest;
8842 /* No info from "silent" quests */
8843 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8848 if ((i >= MIN_RANDOM_QUEST) && quest[i].r_idx)
8850 /* Print the quest info */
8852 if (quest[i].complev == 0)
8856 "%s (%d³¬) - ÉÔÀᄀ\n",
8858 "%s (Dungeon level: %d) - (Cancelled)\n",
8860 r_name+r_info[quest[i].r_idx].name,
8867 "%s (%d³¬) - ¥ì¥Ù¥ë%d\n",
8869 "%s (Dungeon level: %d) - level %d\n",
8871 r_name+r_info[quest[i].r_idx].name,
8878 /* Print the quest info */
8880 sprintf(tmp_str, "%s (´í¸±ÅÙ:%d³¬ÁêÅö) - ¥ì¥Ù¥ë%d\n",
8881 quest[i].name, quest[i].level, quest[i].complev);
8883 sprintf(tmp_str, "%s (Danger level: %d) - level %d\n",
8884 quest[i].name, quest[i].level, quest[i].complev);
8888 fprintf(fff, tmp_str);
8892 if (!total) fprintf(fff, "¤Ê¤·\n");
8894 if (!total) fprintf(fff, "Nothing.\n");
8898 fprintf(fff, "\n¡Ô¼ºÇÔ¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
8900 fprintf(fff, "\n< Failed Quest >\n");
8903 for (i = 1; i < max_quests; i++)
8905 if ((quest[i].status == QUEST_STATUS_FAILED_DONE) || (quest[i].status == QUEST_STATUS_FAILED))
8907 if (i < MIN_RANDOM_QUEST)
8911 /* Set the quest number temporary */
8912 old_quest = p_ptr->inside_quest;
8913 p_ptr->inside_quest = i;
8915 /* Get the quest text */
8916 init_flags = INIT_ASSIGN;
8918 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8920 /* Reset the old quest number */
8921 p_ptr->inside_quest = old_quest;
8923 /* No info from "silent" quests */
8924 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8929 if ((i >= MIN_RANDOM_QUEST) && quest[i].r_idx)
8931 /* Print the quest info */
8933 sprintf(tmp_str, "%s (%d³¬) - ¥ì¥Ù¥ë%d\n",
8934 r_name+r_info[quest[i].r_idx].name, quest[i].level, quest[i].complev);
8936 sprintf(tmp_str, "%s (Dungeon level: %d) - level %d\n",
8937 r_name+r_info[quest[i].r_idx].name, quest[i].level, quest[i].complev);
8942 /* Print the quest info */
8944 sprintf(tmp_str, "%s (´í¸±ÅÙ:%d³¬ÁêÅö) - ¥ì¥Ù¥ë%d\n",
8945 quest[i].name, quest[i].level, quest[i].complev);
8947 sprintf(tmp_str, "%s (Danger level: %d) - level %d\n",
8948 quest[i].name, quest[i].level, quest[i].complev);
8951 fprintf(fff, tmp_str);
8955 if (!total) fprintf(fff, "¤Ê¤·\n");
8957 if (!total) fprintf(fff, "Nothing.\n");
8960 if (p_ptr->wizard) {
8962 fprintf(fff, "\n¡Ô»Ä¤ê¤Î¥é¥ó¥À¥à¥¯¥¨¥¹¥È¡Õ\n");
8964 fprintf(fff, "\n< Remaining Random Quest >\n");
8967 for (i = 1; i < max_quests; i++)
8969 /* No info from "silent" quests */
8970 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8972 if ((quest[i].type == QUEST_TYPE_RANDOM) && (quest[i].status == QUEST_STATUS_TAKEN))
8976 /* Print the quest info */
8978 sprintf(tmp_str, "%s (%d³¬, %s)\n",
8979 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
8981 sprintf(tmp_str, "%s (%d, %s)\n",
8982 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
8984 fprintf(fff, tmp_str);
8988 if (!total) fprintf(fff, "¤Ê¤·\n");
8990 if (!total) fprintf(fff, "Nothing.\n");
8994 /* Close the file */
8997 /* Display the file contents */
8999 show_file(TRUE, file_name, "¥¯¥¨¥¹¥ÈãÀ®¾õ¶·", 0, 0);
9001 show_file(TRUE, file_name, "Quest status", 0, 0);
9005 /* Remove the file */
9014 static void do_cmd_knowledge_home(void)
9019 char file_name[1024];
9021 char o_name[MAX_NLEN];
9024 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
9026 /* Open a new file */
9027 fff = my_fopen_temp(file_name, 1024);
9030 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9032 msg_format("Failed to create temporary file %s.", file_name);
9040 /* Print all homes in the different towns */
9041 st_ptr = &town[1].store[STORE_HOME];
9043 /* Home -- if anything there */
9044 if (st_ptr->stock_num)
9049 /* Header with name of the town */
9051 fprintf(fff, " [ ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ]\n");
9053 fprintf(fff, " [Home Inventory]\n");
9056 /* Dump all available items */
9057 for (i = 0; i < st_ptr->stock_num; i++)
9060 if ((i % 12) == 0) fprintf(fff, "\n ( %d ¥Ú¡¼¥¸ )\n", x++);
9061 object_desc(o_name, &st_ptr->stock[i], TRUE, 3);
9062 if (strlen(o_name) <= 80-3)
9064 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9070 for (n = 0, t = o_name; n < 80-3; n++, t++)
9071 if(iskanji(*t)) {t++; n++;}
9072 if (n == 81-3) n = 79-3; /* ºÇ¸å¤¬´Á»úȾʬ */
9074 fprintf(fff, "%c%s %.*s\n", I2A(i%12), paren, n, o_name);
9075 fprintf(fff, " %.77s\n", o_name+n);
9078 object_desc(o_name, &st_ptr->stock[i], TRUE, 3);
9079 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9084 /* Add an empty line */
9085 fprintf(fff, "\n\n");
9089 /* Close the file */
9092 /* Display the file contents */
9094 show_file(TRUE, file_name, "²æ¤¬²È¤Î¥¢¥¤¥Æ¥à", 0, 0);
9096 show_file(TRUE, file_name, "Home Inventory", 0, 0);
9100 /* Remove the file */
9106 * Check the status of "autopick"
9108 static void do_cmd_knowledge_autopick(void)
9112 char file_name[1024];
9114 /* Open a new file */
9115 fff = my_fopen_temp(file_name, 1024);
9120 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9122 msg_format("Failed to create temporary file %s.", file_name);
9131 fprintf(fff, "¼«Æ°Ç˲õ/½¦¤¤¤Ë¤Ï²¿¤âÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
9133 fprintf(fff, "No preference for auto picker/destroyer.");
9139 fprintf(fff, " ¼«Æ°½¦¤¤/Ç˲õ¤Ë¤Ï¸½ºß %d¹ÔÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤¹¡£\n\n", max_autopick);
9141 fprintf(fff, " There are %d registered lines for auto picker/destroyer.\n\n", max_autopick);
9145 for (k = 0; k < max_autopick; k++)
9148 byte act = autopick_list[k].action;
9149 if (act & DONT_AUTOPICK)
9157 else if (act & DO_AUTODESTROY)
9165 else if (act & DO_AUTOPICK)
9173 else /* if (act & DO_QUERY_AUTOPICK) */ /* Obvious */
9182 if (act & DO_DISPLAY)
9183 fprintf(fff, "%11s", format("[%s]", tmp));
9185 fprintf(fff, "%11s", format("(%s)", tmp));
9187 tmp = autopick_line_from_entry(&autopick_list[k]);
9188 fprintf(fff, " %s", tmp);
9192 /* Close the file */
9194 /* Display the file contents */
9196 show_file(TRUE, file_name, "¼«Æ°½¦¤¤/Ç˲õ ÀßÄê¥ê¥¹¥È", 0, 0);
9198 show_file(TRUE, file_name, "Auto-picker/Destroyer", 0, 0);
9201 /* Remove the file */
9207 * Interact with "knowledge"
9209 void do_cmd_knowledge(void)
9212 /* File type is "TEXT" */
9213 FILE_TYPE(FILE_TYPE_TEXT);
9214 /* Save the screen */
9216 /* Interact until done */
9221 /* Ask for a choice */
9223 prt(format("%d/2 ¥Ú¡¼¥¸", (p+1)), 2, 65);
9224 prt("¸½ºß¤ÎÃ챤ò³Îǧ¤¹¤ë", 3, 0);
9226 prt(format("page %d/2", (p+1)), 2, 65);
9227 prt("Display current knowledge", 3, 0);
9230 /* Give some choices */
9233 prt("(1) ´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 6, 5);
9234 prt("(2) ´ûÃΤΥ¢¥¤¥Æ¥à ¤Î°ìÍ÷", 7, 5);
9235 prt("(3) ´ûÃΤÎÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 8, 5);
9236 prt("(4) ´ûÃΤΥâ¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 9, 5);
9237 prt("(5) Åݤ·¤¿Å¨¤Î¿ô ¤Î°ìÍ÷", 10, 5);
9238 prt("(6) ¾Þ¶â¼ó ¤Î°ìÍ÷", 11, 5);
9239 prt("(7) ¸½ºß¤Î¥Ú¥Ã¥È ¤Î°ìÍ÷", 12, 5);
9240 prt("(8) ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 13, 5);
9241 prt("(9) *´ÕÄê*ºÑ¤ßÁõÈ÷¤ÎÂÑÀ ¤Î°ìÍ÷", 14, 5);
9242 prt("(0) ÃÏ·Á¤Îɽ¼¨Ê¸»ú/¥¿¥¤¥ë ¤Î°ìÍ÷", 15, 5);
9244 prt("(a) ¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó ¤Î°ìÍ÷", 6, 5);
9245 prt("(b) ÆÍÁ³ÊÑ°Û ¤Î°ìÍ÷", 7, 5);
9246 prt("(c) Éð´ï¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 8, 5);
9247 prt("(d) ËâË¡¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 9, 5);
9248 prt("(e) µ»Ç½¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 10, 5);
9249 prt("(f) ¥×¥ì¥¤¥ä¡¼¤ÎÆÁ ¤Î°ìÍ÷", 11, 5);
9250 prt("(g) Æþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó ¤Î°ìÍ÷", 12, 5);
9251 prt("(h) ¼Â¹ÔÃæ¤Î¥¯¥¨¥¹¥È ¤Î°ìÍ÷", 13, 5);
9252 prt("(i) ¸½ºß¤Î¼«Æ°½¦¤¤/Ç˲õÀßÄê ¤Î°ìÍ÷", 14, 5);
9256 prt("(1) Display known artifacts", 6, 5);
9257 prt("(2) Display known objects", 7, 5);
9258 prt("(3) Display remaining uniques", 8, 5);
9259 prt("(4) Display known monster", 9, 5);
9260 prt("(5) Display kill count", 10, 5);
9261 prt("(6) Display wanted monsters", 11, 5);
9262 prt("(7) Display current pets", 12, 5);
9263 prt("(8) Display home inventory", 13, 5);
9264 prt("(9) Display *identified* equip.", 14, 5);
9265 prt("(0) Display terrain symbols.", 15, 5);
9267 prt("(a) Display about yourself", 6, 5);
9268 prt("(b) Display mutations", 7, 5);
9269 prt("(c) Display weapon proficiency", 8, 5);
9270 prt("(d) Display spell proficiency", 9, 5);
9271 prt("(e) Display misc. proficiency", 10, 5);
9272 prt("(f) Display virtues", 11, 5);
9273 prt("(g) Display dungeons", 12, 5);
9274 prt("(h) Display current quests", 13, 5);
9275 prt("(i) Display auto pick/destroy", 14, 5);
9280 prt("-³¤¯-", 17, 8);
9281 prt("ESC) È´¤±¤ë", 21, 1);
9282 prt("SPACE) ¼¡¥Ú¡¼¥¸", 21, 30);
9283 /*prt("-) Á°¥Ú¡¼¥¸", 21, 60);*/
9284 prt("¥³¥Þ¥ó¥É:", 20, 0);
9286 prt("-more-", 17, 8);
9287 prt("ESC) Exit menu", 21, 1);
9288 prt("SPACE) Next page", 21, 30);
9289 /*prt("-) Previous page", 21, 60);*/
9290 prt("Command: ", 20, 0);
9296 if (i == ESCAPE) break;
9299 case ' ': /* Page change */
9303 case '1': /* Artifacts */
9304 do_cmd_knowledge_artifacts();
9306 case '2': /* Objects */
9307 do_cmd_knowledge_objects();
9309 case '3': /* Uniques */
9310 do_cmd_knowledge_uniques();
9312 case '4': /* Monsters */
9313 do_cmd_knowledge_monsters();
9315 case '5': /* Kill count */
9316 do_cmd_knowledge_kill_count();
9318 case '6': /* wanted */
9319 do_cmd_knowledge_kubi();
9321 case '7': /* Pets */
9322 do_cmd_knowledge_pets();
9324 case '8': /* Home */
9325 do_cmd_knowledge_home();
9327 case '9': /* Resist list */
9328 do_cmd_knowledge_inven();
9330 case '0': /* Feature list */
9331 do_cmd_knowledge_features();
9334 case 'a': /* Max stat */
9335 do_cmd_knowledge_stat();
9337 case 'b': /* Mutations */
9338 do_cmd_knowledge_mutations();
9340 case 'c': /* weapon-exp */
9341 do_cmd_knowledge_weapon_exp();
9343 case 'd': /* spell-exp */
9344 do_cmd_knowledge_spell_exp();
9346 case 'e': /* skill-exp */
9347 do_cmd_knowledge_skill_exp();
9349 case 'f': /* Virtues */
9350 do_cmd_knowledge_virtues();
9352 case 'g': /* Dungeon */
9353 do_cmd_knowledge_dungeon();
9355 case 'h': /* Quests */
9356 do_cmd_knowledge_quests();
9358 case 'i': /* Autopick */
9359 do_cmd_knowledge_autopick();
9361 default: /* Unknown option */
9364 /* Flush messages */
9367 /* Restore the screen */
9373 * Check on the status of an active quest
9375 void do_cmd_checkquest(void)
9377 /* File type is "TEXT" */
9378 FILE_TYPE(FILE_TYPE_TEXT);
9380 /* Save the screen */
9384 do_cmd_knowledge_quests();
9386 /* Restore the screen */
9392 * Display the time and date
9394 void do_cmd_time(void)
9396 int day, hour, min, full, start, end, num;
9403 extract_day_hour_min(&day, &hour, &min);
9405 full = hour * 100 + min;
9413 strcpy(desc, "ÊѤʻþ¹ï¤À¡£");
9415 strcpy(desc, "It is a strange time.");
9421 msg_format("%d ÆüÌÜ,»þ¹ï¤Ï%d:%02d %s¤Ç¤¹¡£",
9422 day, (hour % 12 == 0) ? 12 : (hour % 12),
9423 min, (hour < 12) ? "AM" : "PM");
9425 msg_format("This is day %d. The time is %d:%02d %s.",
9426 day, (hour % 12 == 0) ? 12 : (hour % 12),
9427 min, (hour < 12) ? "AM" : "PM");
9432 if (!randint0(10) || p_ptr->image)
9435 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun_j.txt");
9437 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun.txt");
9444 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm_j.txt");
9446 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm.txt");
9451 /* Open this file */
9452 fff = my_fopen(buf, "rt");
9457 /* Find this time */
9458 while (!my_fgets(fff, buf, sizeof(buf)))
9460 /* Ignore comments */
9461 if (!buf[0] || (buf[0] == '#')) continue;
9463 /* Ignore invalid lines */
9464 if (buf[1] != ':') continue;
9466 /* Process 'Start' */
9469 /* Extract the starting time */
9470 start = atoi(buf + 2);
9472 /* Assume valid for an hour */
9482 /* Extract the ending time */
9483 end = atoi(buf + 2);
9489 /* Ignore incorrect range */
9490 if ((start > full) || (full > end)) continue;
9492 /* Process 'Description' */
9497 /* Apply the randomizer */
9498 if (!randint0(num)) strcpy(desc, buf + 2);
9508 /* Close the file */