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 dialy.
339 errr do_cmd_write_nikki(int type, int num, cptr note)
345 cptr note_level = "";
346 bool do_level = TRUE;
347 char note_level_buf[40];
349 static bool disable_nikki = FALSE;
351 extract_day_hour_min(&day, &hour, &min);
353 if (disable_nikki) return(-1);
355 if (type == NIKKI_FIX_QUEST_C ||
356 type == NIKKI_FIX_QUEST_F ||
357 type == NIKKI_RAND_QUEST_C ||
358 type == NIKKI_RAND_QUEST_F ||
359 type == NIKKI_TO_QUEST)
363 old_quest = p_ptr->inside_quest;
364 p_ptr->inside_quest = (quest[num].type == QUEST_TYPE_RANDOM) ? 0 : num;
366 /* Get the quest text */
367 init_flags = INIT_ASSIGN;
369 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
371 /* Reset the old quest number */
372 p_ptr->inside_quest = old_quest;
376 sprintf(file_name,"playrecord-%s.txt",savefile_base);
378 /* different filne name to avoid mixing */
379 sprintf(file_name,"playrec-%s.txt",savefile_base);
382 /* Build the filename */
383 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
385 /* File type is "TEXT" */
386 FILE_TYPE(FILE_TYPE_TEXT);
388 fff = my_fopen(buf, "a");
394 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£¥×¥ì¥¤µÏ¿¤ò°ì»þÄä»ß¤·¤Þ¤¹¡£", buf);
396 msg_format("Failed to open %s. Play-Record is disabled temporally.", buf);
405 if (p_ptr->inside_arena)
407 note_level = "¥¢¥ê¡¼¥Ê:";
409 note_level = "Arane:";
413 note_level = "ÃϾå:";
415 note_level = "Surface:";
417 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)))
419 note_level = "¥¯¥¨¥¹¥È:";
421 note_level = "Quest:";
426 sprintf(note_level_buf, "%d³¬(%s):", dun_level, d_name+d_info[dungeon_type].name);
428 sprintf(note_level_buf, "%s L%d:", d_name+d_info[dungeon_type].name, dun_level);
430 note_level = note_level_buf;
439 fprintf(fff, "%dÆüÌÜ\n",day);
441 fprintf(fff, "Day %d\n",day);
450 fprintf(fff, "%s\n",note);
454 fprintf(fff, " %2d:%02d %20s %s\n",hour, min, note_level, note);
460 fprintf(fff, " %2d:%02d %20s %s¤òȯ¸«¤·¤¿¡£\n", hour, min, note_level, note);
462 fprintf(fff, " %2d:%02d %20s discover %s.\n", hour, min, note_level, note);
469 fprintf(fff, " %2d:%02d %20s %s¤òÅݤ·¤¿¡£\n", hour, min, note_level, note);
471 fprintf(fff, " %2d:%02d %20s defeated %s.\n", hour, min, note_level, note);
475 case NIKKI_FIX_QUEST_C:
477 if (quest[num].flags & QUEST_FLAG_SILENT) break;
479 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
481 fprintf(fff, " %2d:%02d %20s completed quest '%s'.\n", hour, min, note_level, quest[num].name);
485 case NIKKI_FIX_QUEST_F:
487 if (quest[num].flags & QUEST_FLAG_SILENT) break;
489 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤«¤éÌ¿¤«¤é¤¬¤éƨ¤²µ¢¤Ã¤¿¡£\n", hour, min, note_level, quest[num].name);
491 fprintf(fff, " %2d:%02d %20s run away from quest '%s'.\n", hour, min, note_level, quest[num].name);
495 case NIKKI_RAND_QUEST_C:
498 strcpy(name, r_name+r_info[quest[num].r_idx].name);
500 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, name);
502 fprintf(fff, " %2d:%02d %20s completed randome quest '%s'\n", hour, min, note_level, name);
506 case NIKKI_RAND_QUEST_F:
509 strcpy(name, r_name+r_info[quest[num].r_idx].name);
511 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤«¤éƨ¤²½Ð¤·¤¿¡£\n", hour, min, note_level, name);
513 fprintf(fff, " %2d:%02d %20s ran away from quest '%s'.\n", hour, min, note_level, name);
517 case NIKKI_MAXDEAPTH:
520 fprintf(fff, " %2d:%02d %20s %s¤ÎºÇ¿¼³¬%d³¬¤ËÅþ㤷¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, num);
522 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);
529 fprintf(fff, " %2d:%02d %20s %s%s¤ÎºÇ¿¼³¬¤ò%d³¬¤Ë¥»¥Ã¥È¤·¤¿¡£\n", hour, min, note_level, note, d_name + d_info[num].name, max_dlv[num]);
531 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);
538 if (quest_number(dun_level) && ((quest_number(dun_level) < MIN_RANDOM_QUEST) && !(quest_number(dun_level) == QUEST_OBERON || quest_number(dun_level) == QUEST_SERPENT)))
549 if (!(dun_level+num)) to = "ÃϾå";
550 else to = format("%d³¬", dun_level+num);
552 if (!(dun_level+num)) to = "the surface";
553 else to = format("level %d", dun_level+num);
558 fprintf(fff, " %2d:%02d %20s %s¤Ø%s¡£\n", hour, min, note_level, to, note);
560 fprintf(fff, " %2d:%02d %20s %s %s.\n", hour, min, note_level, note, to);
568 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤Æ%s¤Î%d³¬¤Ø²¼¤ê¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, max_dlv[dungeon_type]);
570 fprintf(fff, " %2d:%02d %20s recall to dungeon level %d of %s.\n", hour, min, note_level, max_dlv[dungeon_type], d_name+d_info[dungeon_type].name);
574 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤ÆÃϾå¤Ø¤ÈÌá¤Ã¤¿¡£\n", hour, min, note_level);
576 fprintf(fff, " %2d:%02d %20s recall from dungeon to surface.\n", hour, min, note_level);
582 if (quest[num].flags & QUEST_FLAG_SILENT) break;
584 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤Ø¤ÈÆÍÆþ¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
586 fprintf(fff, " %2d:%02d %20s enter quest '%s'.\n", hour, min, note_level, quest[num].name);
593 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¡¦¥Æ¥ì¥Ý¡¼¥È¤Çæ½Ð¤·¤¿¡£\n", hour, min, note_level);
595 fprintf(fff, " %2d:%02d %20s Get out using teleport level.\n", hour, min, note_level);
602 fprintf(fff, " %2d:%02d %20s %s¤ò¹ØÆþ¤·¤¿¡£\n", hour, min, note_level, note);
604 fprintf(fff, " %2d:%02d %20s buy %s.\n", hour, min, note_level, note);
611 fprintf(fff, " %2d:%02d %20s %s¤òÇäµÑ¤·¤¿¡£\n", hour, min, note_level, note);
613 fprintf(fff, " %2d:%02d %20s sell %s.\n", hour, min, note_level, note);
623 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï¤Ç¡¢%s¤ÎÁ°¤ËÇÔ¤ìµî¤Ã¤¿¡£\n", hour, min, note_level, p_ptr->arena_number + 1, note);
625 int n = p_ptr->arena_number + 1;
626 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"));
631 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï(%s)¤Ë¾¡Íø¤·¤¿¡£\n", hour, min, note_level, num, note);
633 fprintf(fff, " %2d:%02d %20s win 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);
635 if (num == MAX_ARENA_MONS)
638 fprintf(fff, " Æ®µ»¾ì¤Î¤¹¤Ù¤Æ¤ÎŨ¤Ë¾¡Íø¤·¡¢¥Á¥ã¥ó¥Ô¥ª¥ó¤È¤Ê¤Ã¤¿¡£\n");
640 fprintf(fff, " win all fight to become a Chanpion.\n");
649 fprintf(fff, " %2d:%02d %20s %s¤ò¼±Ê̤·¤¿¡£\n", hour, min, note_level, note);
651 fprintf(fff, " %2d:%02d %20s identify %s.\n", hour, min, note_level, note);
666 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
668 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
672 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥¦¥£¥¶¡¼¥É¡¦¥Æ¥ì¥Ý¡¼¥È¤Ç°ÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
674 fprintf(fff, " %2d:%02d %20s wizard-teleport to %s.\n", hour, min, note_level, to);
689 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
691 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
695 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥Ñ¥¿¡¼¥ó¤ÎÎϤǰÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
697 fprintf(fff, " %2d:%02d %20s use Pattern to teleport to %s.\n", hour, min, note_level, to);
704 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¤¬%d¤Ë¾å¤¬¤Ã¤¿¡£\n", hour, min, note_level, num);
706 fprintf(fff, " %2d:%02d %20s reach player level %d.\n", hour, min, note_level, num);
710 case NIKKI_GAMESTART:
712 time_t ct = time((time_t*)0);
716 fprintf(fff, "%s %s",note, ctime(&ct));
719 fprintf(fff, " %2d:%02d %20s %s %s",hour, min, note_level, note, ctime(&ct));
722 case NIKKI_NAMED_PET:
724 fprintf(fff, " %2d:%02d %20s ", hour, min, note_level);
729 fprintf(fff, "%s¤òι¤Îͧ¤Ë¤¹¤ë¤³¤È¤Ë·è¤á¤¿¡£\n", note);
731 fprintf(fff, "decide to travel together with %s.\n", note);
736 fprintf(fff, "%s¤Î̾Á°¤ò¾Ã¤·¤¿¡£\n", note);
738 fprintf(fff, "unname %s.\n", note);
743 fprintf(fff, "%s¤ò²òÊü¤·¤¿¡£\n", note);
745 fprintf(fff, "dismiss %s.\n", note);
750 fprintf(fff, "%s¤¬»à¤ó¤Ç¤·¤Þ¤Ã¤¿¡£\n", note);
752 fprintf(fff, "%s die.\n", note);
757 fprintf(fff, "%s¤ò¤ª¤¤¤ÆÊ̤ΥޥåפذÜÆ°¤·¤¿¡£\n", note);
759 fprintf(fff, "move to other map leaving %s behind.\n", note);
764 fprintf(fff, "%s¤È¤Ï¤°¤ì¤Æ¤·¤Þ¤Ã¤¿¡£\n", note);
766 fprintf(fff, "lose sight of %s.\n", note);
771 fprintf(fff, "%s¤¬*Ç˲õ*¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
773 fprintf(fff, "%s is made disappeared by *destruction*.\n", note);
778 fprintf(fff, "%s¤¬´äÀФ˲¡¤·ÄÙ¤µ¤ì¤¿¡£\n", note);
780 fprintf(fff, "%s is crushed by falling rocks.\n", note);
795 if (do_level) write_level = FALSE;
801 #define MAX_SUBTITLE (sizeof(subtitle)/sizeof(subtitle[0]))
803 static void do_cmd_disp_nikki(void)
805 char nikki_title[256];
810 static const char subtitle[][30] = {"ºÇ¶¯¤ÎÆùÂΤòµá¤á¤Æ",
811 "¿ÍÀ¸¤½¤ì¤Ï¤Ï¤«¤Ê¤¤",
822 "Åݤ¹¤Ù¤Å¨¤Ï¥²¡û¥Ä",
823 "¤ó¡Á¡©Ê¹¤³¤¨¤ó¤Ê¤¡",
824 "¥ª¥ì¤Î̾¤ò¸À¤Ã¤Æ¤ß¤í",
825 "Ƭ¤¬ÊѤˤʤäÁ¤ã¤Ã¤¿",
830 "¤³¤ó¤Ê¤â¤ó¤¸¤ã¤Ê¤¤",
839 "ºÇ¹â¤ÎƬǾ¤òµá¤á¤Æ"};
841 static const char subtitle[][51] ={"Quest of The World's Toughest Body",
842 "Attack is the best form of defence.",
844 "An unexpected windfall",
845 "A drowning man will catch at a straw",
846 "Don't count your chickens before they are hatched.",
847 "It is no use crying over spilt milk.",
848 "Seeing is believing.",
849 "Strike the iron while it is hot.",
850 "I don't care what follows.",
851 "To dig a well to put out a house on fire.",
852 "Tomorrow is another day.",
853 "Easy come, easy go.",
854 "The more haste, the less speed.",
855 "Where there is life, there is hope.",
856 "There is no royal road to *WINNER*.",
857 "Danger past, God forgotten.",
858 "The best thing to do now is to run away.",
859 "Life is but an empty dream.",
860 "Dead men tell no tales.",
861 "A book that remains shut is but a block.",
862 "Misfortunes never come singly.",
863 "A little knowledge is a dangerous thing.",
864 "History repeats itself.",
865 "*WINNER* was not built in a day.",
866 "Ignorance is bliss.",
867 "To lose is to win?",
868 "No medicine can cure folly.",
869 "All good things come to an end.",
870 "M$ Empire strikes back.",
871 "To see is to believe",
873 "Quest of The World's Greatest Brain"};
876 sprintf(file_name,"playrecord-%s.txt",savefile_base);
878 sprintf(file_name,"playrec-%s.txt",savefile_base);
881 /* Build the filename */
882 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
884 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_MONK || p_ptr->pclass == CLASS_SAMURAI || p_ptr->pclass == CLASS_BERSERKER)
885 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)]);
886 else if (p_ptr->pclass == CLASS_MAGE || p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
887 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)+1]);
888 else strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-2)+1]);
891 sprintf(nikki_title, "¡Ö%s%s%s¤ÎÅÁÀâ -%s-¡×",
892 ap_ptr->title, ap_ptr->no ? "¤Î" : "", player_name, tmp);
894 sprintf(nikki_title, "Legend of %s %s '%s'",
895 ap_ptr->title, player_name, tmp);
898 /* Display the file contents */
899 show_file(FALSE, buf, nikki_title, -1, 0);
902 static void do_cmd_bunshou(void)
905 char bunshou[80] = "\0";
908 if (get_string("ÆâÍÆ: ", tmp, 79))
910 if (get_string("diary note: ", tmp, 79))
913 strcpy(bunshou, tmp);
915 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, bunshou);
919 static void do_cmd_last_get(void)
924 if (record_o_name[0] == '\0') return;
927 sprintf(buf,"%s¤ÎÆþ¼ê¤òµÏ¿¤·¤Þ¤¹¡£",record_o_name);
929 sprintf(buf,"Do you really want to record getting %s? ",record_o_name);
931 if (!get_check(buf)) return;
936 sprintf(buf,"%s¤ò¼ê¤ËÆþ¤ì¤¿¡£", record_o_name);
938 sprintf(buf,"descover %s.", record_o_name);
940 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
944 static void do_cmd_erase_nikki(void)
951 if (!get_check("ËÜÅö¤ËµÏ¿¤ò¾Ãµî¤·¤Þ¤¹¤«¡©")) return;
953 if (!get_check("Do you really want to delete all your record? ")) return;
957 sprintf(file_name,"playrecord-%s.txt",savefile_base);
959 sprintf(file_name,"playrec-%s.txt",savefile_base);
962 /* Build the filename */
963 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
965 /* Remove the file */
968 fff = my_fopen(buf, "w");
972 msg_format("µÏ¿¤ò¾Ãµî¤·¤Þ¤·¤¿¡£");
974 msg_format("deleted record.");
978 msg_format("%s ¤Î¾Ãµî¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£", buf);
980 msg_format("failed to delete %s.", buf);
987 void do_cmd_nikki(void)
991 /* File type is "TEXT" */
992 FILE_TYPE(FILE_TYPE_TEXT);
994 /* Save the screen */
997 /* Interact until done */
1003 /* Ask for a choice */
1005 prt("[ µÏ¿¤ÎÀßÄê ]", 2, 0);
1007 prt("[ Play Record ]", 2, 0);
1011 /* Give some choices */
1013 prt("(1) µÏ¿¤ò¸«¤ë", 4, 5);
1014 prt("(2) ʸ¾Ï¤òµÏ¿¤¹¤ë", 5, 5);
1015 prt("(3) ľÁ°¤ËÆþ¼êËô¤Ï´ÕÄꤷ¤¿¤â¤Î¤òµÏ¿¤¹¤ë", 6, 5);
1016 prt("(4) µÏ¿¤ò¾Ãµî¤¹¤ë", 7, 5);
1018 prt("(1) Display your record", 4, 5);
1019 prt("(2) Add record", 5, 5);
1020 prt("(3) Record item you last get/identify", 6, 5);
1021 prt("(4) Delete your record", 7, 5);
1027 prt("¥³¥Þ¥ó¥É:", 18, 0);
1029 prt("Command: ", 18, 0);
1037 if (i == ESCAPE) break;
1042 do_cmd_disp_nikki();
1051 do_cmd_erase_nikki();
1053 default: /* Unknown option */
1057 /* Flush messages */
1061 /* Restore the screen */
1066 * Hack -- redraw the screen
1068 * This command performs various low level updates, clears all the "extra"
1069 * windows, does a total redraw of the main window, and requests all of the
1070 * interesting updates and redraws that I can think of.
1072 * This command is also used to "instantiate" the results of the user
1073 * selecting various things, such as graphics mode, so it must call
1074 * the "TERM_XTRA_REACT" hook before redrawing the windows.
1076 void do_cmd_redraw(void)
1083 /* Hack -- react to changes */
1084 Term_xtra(TERM_XTRA_REACT, 0);
1087 /* Combine and Reorder the pack (later) */
1088 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1092 p_ptr->update |= (PU_TORCH);
1095 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
1097 /* Forget lite/view */
1098 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1100 /* Update lite/view */
1101 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
1103 /* Update monsters */
1104 p_ptr->update |= (PU_MONSTERS);
1106 /* Redraw everything */
1107 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1110 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
1113 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
1117 /* Hack -- update */
1120 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
1123 /* Redraw every window */
1124 for (j = 0; j < 8; j++)
1127 if (!angband_term[j]) continue;
1130 Term_activate(angband_term[j]);
1145 * Hack -- change name
1147 void do_cmd_change_name(void)
1156 /* Save the screen */
1164 /* Display the player */
1165 display_player(mode);
1170 display_player(mode);
1175 Term_putstr(2, 23, -1, TERM_WHITE,
1176 "['c'¤Ç̾Á°Êѹ¹, 'f'¤Ç¥Õ¥¡¥¤¥ë¤Ø½ñ½Ð, 'h'¤Ç¥â¡¼¥ÉÊѹ¹, ESC¤Ç½ªÎ»]");
1178 Term_putstr(2, 23, -1, TERM_WHITE,
1179 "['c' to change name, 'f' to file, 'h' to change mode, or ESC]");
1187 if (c == ESCAPE) break;
1194 /* Process the player name */
1195 process_player_name(FALSE);
1201 sprintf(tmp, "%s.txt", player_base);
1203 if (get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
1205 if (get_string("File name: ", tmp, 80))
1209 if (tmp[0] && (tmp[0] != ' '))
1211 file_character(tmp);
1228 /* Flush messages */
1232 /* Restore the screen */
1235 /* Redraw everything */
1236 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1243 * Recall the most recent message
1245 void do_cmd_message_one(void)
1247 /* Recall one message XXX XXX XXX */
1248 prt(format("> %s", message_str(0)), 0, 0);
1253 * Show previous messages to the user -BEN-
1255 * The screen format uses line 0 and 23 for headers and prompts,
1256 * skips line 1 and 22, and uses line 2 thru 21 for old messages.
1258 * This command shows you which commands you are viewing, and allows
1259 * you to "search" for strings in the recall.
1261 * Note that messages may be longer than 80 characters, but they are
1262 * displayed using "infinite" length, with a special sub-command to
1263 * "slide" the virtual display to the left or right.
1265 * Attempt to only hilite the matching portions of the string.
1267 void do_cmd_messages(int num_now)
1278 Term_get_size(&wid, &hgt);
1287 /* Total messages */
1290 /* Start on first message */
1293 /* Start at leftmost edge */
1296 /* Save the screen */
1299 /* Process requests until done */
1305 /* Dump up to 20 lines of messages */
1306 for (j = 0; (j < hgt - 4) && (i + j < n); j++)
1308 cptr msg = message_str(i+j);
1310 /* Apply horizontal scroll */
1311 msg = (strlen(msg) >= q) ? (msg + q) : "";
1313 /* Dump the messages, bottom to top */
1314 Term_putstr(0, hgt-j-3, -1, (bool)(i+j < num_now ? TERM_WHITE : TERM_SLATE), msg);
1316 /* Hilite "shower" */
1321 /* Display matches */
1322 while ((str = strstr(str, shower)) != NULL)
1324 int len = strlen(shower);
1326 /* Display the match */
1327 Term_putstr(str-msg, hgt-j-3, len, TERM_YELLOW, shower);
1335 /* Display header XXX XXX XXX */
1338 prt(format("°ÊÁ°¤Î¥á¥Ã¥»¡¼¥¸ %d-%d Á´Éô¤Ç(%d) ¥ª¥Õ¥»¥Ã¥È(%d)",
1339 i, i+j-1, n, q), 0, 0);
1341 prt(format("Message Recall (%d-%d of %d), Offset %d",
1342 i, i+j-1, n, q), 0, 0);
1346 /* Display prompt (not very informative) */
1348 prt("[ 'p' ¤Ç¹¹¤Ë¸Å¤¤¤â¤Î, 'n' ¤Ç¹¹¤Ë¿·¤·¤¤¤â¤Î, '/' ¤Ç¸¡º÷, ESC ¤ÇÃæÃÇ ]", hgt - 1, 0);
1350 prt("[Press 'p' for older, 'n' for newer, ..., or ESCAPE]", hgt - 1, 0);
1357 /* Exit on Escape */
1358 if (k == ESCAPE) break;
1360 /* Hack -- Save the old index */
1363 /* Horizontal scroll */
1367 q = (q >= 40) ? (q - 40) : 0;
1373 /* Horizontal scroll */
1383 /* Hack -- handle show */
1388 prt("¶¯Ä´: ", hgt - 1, 0);
1390 prt("Show: ", hgt - 1, 0);
1394 /* Get a "shower" string, or continue */
1395 if (!askfor_aux(shower, 80)) continue;
1401 /* Hack -- handle find */
1408 prt("¸¡º÷: ", hgt - 1, 0);
1410 prt("Find: ", hgt - 1, 0);
1414 /* Get a "finder" string, or continue */
1415 if (!askfor_aux(finder, 80)) continue;
1418 strcpy(shower, finder);
1421 for (z = i + 1; z < n; z++)
1423 cptr msg = message_str(z);
1426 if (strstr(msg, finder))
1437 /* Recall 1 older message */
1438 if ((k == '8') || (k == '\n') || (k == '\r'))
1440 /* Go newer if legal */
1441 if (i + 1 < n) i += 1;
1444 /* Recall 10 older messages */
1447 /* Go older if legal */
1448 if (i + 10 < n) i += 10;
1451 /* Recall 20 older messages */
1452 if ((k == 'p') || (k == KTRL('P')) || (k == ' '))
1454 /* Go older if legal */
1455 if (i + 20 < n) i += 20;
1458 /* Recall 20 newer messages */
1459 if ((k == 'n') || (k == KTRL('N')))
1461 /* Go newer (if able) */
1462 i = (i >= 20) ? (i - 20) : 0;
1465 /* Recall 10 newer messages */
1468 /* Go newer (if able) */
1469 i = (i >= 20) ? (i - 20) : 0;
1472 /* Recall 1 newer messages */
1475 /* Go newer (if able) */
1476 i = (i >= 1) ? (i - 1) : 0;
1479 /* Hack -- Error of some kind */
1483 /* Restore the screen */
1490 * Number of cheating options
1497 static option_type cheat_info[CHEAT_MAX] =
1499 { &cheat_peek, FALSE, 255, 0x01, 0x00,
1501 "cheat_peek", "¥¢¥¤¥Æ¥à¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1503 "cheat_peek", "Peek into object creation"
1507 { &cheat_hear, FALSE, 255, 0x02, 0x00,
1509 "cheat_hear", "¥â¥ó¥¹¥¿¡¼¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1511 "cheat_hear", "Peek into monster creation"
1515 { &cheat_room, FALSE, 255, 0x04, 0x00,
1517 "cheat_room", "¥À¥ó¥¸¥ç¥ó¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1519 "cheat_room", "Peek into dungeon creation"
1523 { &cheat_xtra, FALSE, 255, 0x08, 0x00,
1525 "cheat_xtra", "¤½¤Î¾¤Î»ö¤ò¤Î¤¾¤¸«¤ë"
1527 "cheat_xtra", "Peek into something else"
1531 { &cheat_know, FALSE, 255, 0x10, 0x00,
1533 "cheat_know", "´°Á´¤Ê¥â¥ó¥¹¥¿¡¼¤Î»×¤¤½Ð¤òÃΤë"
1535 "cheat_know", "Know complete monster info"
1539 { &cheat_live, FALSE, 255, 0x20, 0x00,
1541 "cheat_live", "»à¤ò²óÈò¤¹¤ë¤³¤È¤ò²Äǽ¤Ë¤¹¤ë"
1543 "cheat_live", "Allow player to avoid death"
1547 { &cheat_save, FALSE, 255, 0x40, 0x00,
1549 "cheat_save", "»à¤ó¤À»þ¥»¡¼¥Ö¤¹¤ë¤«³Îǧ¤¹¤ë"
1551 "cheat_save", "Ask for saving death"
1557 * Interact with some options for cheating
1559 static void do_cmd_options_cheat(cptr info)
1563 int i, k = 0, n = CHEAT_MAX;
1571 /* Interact with the player */
1576 /* Prompt XXX XXX XXX */
1578 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, ESC ¤Ç·èÄê )", info);
1580 sprintf(buf, "%s (RET to advance, y/n to set, ESC to accept) ", info);
1586 /* º¾µ½¥ª¥×¥·¥ç¥ó¤ò¤¦¤Ã¤«¤ê¤¤¤¸¤Ã¤Æ¤·¤Þ¤¦¿Í¤¬¤¤¤ë¤è¤¦¤Ê¤Î¤ÇÃí°Õ */
1587 prt(" << Ãí°Õ >>", 11, 0);
1588 prt(" º¾µ½¥ª¥×¥·¥ç¥ó¤ò°ìÅ٤ǤâÀßÄꤹ¤ë¤È¡¢¥¹¥³¥¢µÏ¿¤¬»Ä¤é¤Ê¤¯¤Ê¤ê¤Þ¤¹¡ª", 12, 0);
1589 prt(" ¸å¤Ë²ò½ü¤·¤Æ¤â¥À¥á¤Ç¤¹¤Î¤Ç¡¢¾¡Íø¼Ô¤òÌܻؤ¹Êý¤Ï¤³¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¤¤", 13, 0);
1590 prt(" ¤¸¤é¤Ê¤¤¤è¤¦¤Ë¤·¤Æ²¼¤µ¤¤¡£", 14, 0);
1592 /* Display the options */
1593 for (i = 0; i < n; i++)
1595 byte a = TERM_WHITE;
1597 /* Color current option */
1598 if (i == k) a = TERM_L_BLUE;
1600 /* Display the option text */
1601 sprintf(buf, "%-48s: %s (%s)",
1602 cheat_info[i].o_desc,
1604 (*cheat_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1606 (*cheat_info[i].o_var ? "yes" : "no "),
1609 cheat_info[i].o_text);
1610 c_prt(a, buf, i + 2, 0);
1613 /* Hilite current option */
1614 move_cursor(k + 2, 50);
1620 * HACK - Try to translate the key into a direction
1621 * to allow using the roguelike keys for navigation.
1623 dir = get_keymap_dir(ch);
1624 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1638 k = (n + k - 1) % n;
1657 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "º¾µ½¥ª¥×¥·¥ç¥ó¤òON¤Ë¤·¤Æ¡¢¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
1659 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use cheating options.");
1661 p_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit);
1662 (*cheat_info[k].o_var) = TRUE;
1671 (*cheat_info[k].o_var) = FALSE;
1679 strnfmt(buf, sizeof(buf), "joption.txt#%s", cheat_info[k].o_text);
1681 strnfmt(buf, sizeof(buf), "option.txt#%s", cheat_info[k].o_text);
1683 /* Peruse the help file */
1684 (void)show_file(TRUE, buf, NULL, 0, 0);
1700 static option_type autosave_info[2] =
1702 { &autosave_l, FALSE, 255, 0x01, 0x00,
1704 "autosave_l", "¿·¤·¤¤³¬¤ËÆþ¤ëÅ٤˼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1706 "autosave_l", "Autosave when entering new levels" },
1710 { &autosave_t, FALSE, 255, 0x02, 0x00,
1712 "autosave_t", "°ìÄ꥿¡¼¥óËè¤Ë¼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1714 "autosave_t", "Timed autosave" },
1720 static s16b toggle_frequency(s16b current)
1725 case 50: return 100;
1726 case 100: return 250;
1727 case 250: return 500;
1728 case 500: return 1000;
1729 case 1000: return 2500;
1730 case 2500: return 5000;
1731 case 5000: return 10000;
1732 case 10000: return 25000;
1736 return 0; /* Paranoia */
1741 * Interact with some options for cheating
1743 static void do_cmd_options_autosave(cptr info)
1747 int i, k = 0, n = 2;
1755 /* Interact with the player */
1758 /* Prompt XXX XXX XXX */
1760 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, F ¤ÇÉÑÅÙ¤òÆþÎÏ, ESC ¤Ç·èÄê ) ", info);
1762 sprintf(buf, "%s (RET to advance, y/n to set, 'F' for frequency, ESC to accept) ", info);
1767 /* Display the options */
1768 for (i = 0; i < n; i++)
1770 byte a = TERM_WHITE;
1772 /* Color current option */
1773 if (i == k) a = TERM_L_BLUE;
1775 /* Display the option text */
1776 sprintf(buf, "%-48s: %s (%s)",
1777 autosave_info[i].o_desc,
1779 (*autosave_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1781 (*autosave_info[i].o_var ? "yes" : "no "),
1784 autosave_info[i].o_text);
1785 c_prt(a, buf, i + 2, 0);
1789 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè", autosave_freq), 5, 0);
1791 prt(format("Timed autosave frequency: every %d turns", autosave_freq), 5, 0);
1796 /* Hilite current option */
1797 move_cursor(k + 2, 50);
1813 k = (n + k - 1) % n;
1831 (*autosave_info[k].o_var) = TRUE;
1840 (*autosave_info[k].o_var) = FALSE;
1848 autosave_freq = toggle_frequency(autosave_freq);
1850 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè",
1851 autosave_freq), 5, 0);
1853 prt(format("Timed autosave frequency: every %d turns",
1854 autosave_freq), 5, 0);
1862 (void)show_file(TRUE, "joption.txt#Autosave", NULL, 0, 0);
1864 (void)show_file(TRUE, "option.txt#Autosave", NULL, 0, 0);
1882 #define PAGE_AUTODESTROY 7
1885 * Interact with some options
1887 void do_cmd_options_aux(int page, cptr info)
1890 int i, k = 0, n = 0, l;
1895 /* Lookup the options */
1896 for (i = 0; i < 24; i++) opt[i] = 0;
1898 /* Scan the options */
1899 for (i = 0; option_info[i].o_desc; i++)
1901 /* Notice options on this "page" */
1902 if (option_info[i].o_page == page) opt[n++] = i;
1909 /* Interact with the player */
1914 /* Prompt XXX XXX XXX */
1916 sprintf(buf, "%s (¥ê¥¿¡¼¥ó:¼¡, y/n:Êѹ¹, ESC:½ªÎ», ?:¥Ø¥ë¥×) ", info);
1918 sprintf(buf, "%s (RET:next, y/n:change, ESC:accept, ?:help) ", info);
1924 /* HACK -- description for easy-auto-destroy options */
1926 if (page == PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "°Ê²¼¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢´Ê°×¼«Æ°Ç˲õ¤ò»ÈÍѤ¹¤ë¤È¤¤Î¤ß͸ú", 6, 6);
1928 if (page == PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "Following options will protect items from easy auto-destroyer.", 6, 3);
1931 /* Display the options */
1932 for (i = 0; i < n; i++)
1934 byte a = TERM_WHITE;
1936 /* Color current option */
1937 if (i == k) a = TERM_L_BLUE;
1939 /* Display the option text */
1940 sprintf(buf, "%-48s: %s (%.19s)",
1941 option_info[opt[i]].o_desc,
1943 (*option_info[opt[i]].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1945 (*option_info[opt[i]].o_var ? "yes" : "no "),
1948 option_info[opt[i]].o_text);
1949 if ((page == PAGE_AUTODESTROY) && i > 2) c_prt(a, buf, i + 5, 0);
1950 else c_prt(a, buf, i + 2, 0);
1953 if ((page == PAGE_AUTODESTROY) && (k > 2)) l = 3;
1956 /* Hilite current option */
1957 move_cursor(k + 2 + l, 50);
1963 * HACK - Try to translate the key into a direction
1964 * to allow using the roguelike keys for navigation.
1966 dir = get_keymap_dir(ch);
1967 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1981 k = (n + k - 1) % n;
1998 (*option_info[opt[k]].o_var) = TRUE;
2007 (*option_info[opt[k]].o_var) = FALSE;
2015 (*option_info[opt[k]].o_var) = !(*option_info[opt[k]].o_var);
2022 strnfmt(buf, sizeof(buf), "joption.txt#%s", option_info[opt[k]].o_text);
2024 strnfmt(buf, sizeof(buf), "option.txt#%s", option_info[opt[k]].o_text);
2026 /* Peruse the help file */
2027 (void)show_file(TRUE, buf, NULL, 0, 0);
2044 * Modify the "window" options
2046 static void do_cmd_options_win(void)
2060 /* Memorize old flags */
2061 for (j = 0; j < 8; j++)
2063 /* Acquire current flags */
2064 old_flag[j] = window_flag[j];
2074 /* Prompt XXX XXX XXX */
2076 prt("¥¦¥£¥ó¥É¥¦¡¦¥Õ¥é¥° (<Êý¸þ>¤Ç°ÜÆ°, t¤Ç¥Á¥§¥ó¥¸, y/n ¤Ç¥»¥Ã¥È, ESC)", 0, 0);
2078 prt("Window Flags (<dir>, t, y, n, ESC) ", 0, 0);
2082 /* Display the windows */
2083 for (j = 0; j < 8; j++)
2085 byte a = TERM_WHITE;
2087 cptr s = angband_term_name[j];
2090 if (j == x) a = TERM_L_BLUE;
2092 /* Window name, staggered, centered */
2093 Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s);
2096 /* Display the options */
2097 for (i = 0; i < 16; i++)
2099 byte a = TERM_WHITE;
2101 cptr str = window_flag_desc[i];
2104 if (i == y) a = TERM_L_BLUE;
2108 if (!str) str = "(̤»ÈÍÑ)";
2110 if (!str) str = "(Unused option)";
2115 Term_putstr(0, i + 5, -1, a, str);
2117 /* Display the windows */
2118 for (j = 0; j < 8; j++)
2120 byte a = TERM_WHITE;
2125 if ((i == y) && (j == x)) a = TERM_L_BLUE;
2128 if (window_flag[j] & (1L << i)) c = 'X';
2131 Term_putch(35 + j * 5, i + 5, a, c);
2136 Term_gotoxy(35 + x * 5, y + 5);
2154 for (j = 0; j < 8; j++)
2156 window_flag[j] &= ~(1L << y);
2160 for (i = 0; i < 16; i++)
2162 window_flag[x] &= ~(1L << i);
2175 window_flag[x] |= (1L << y);
2183 window_flag[x] &= ~(1L << y);
2190 (void)show_file(TRUE, "joption.txt#Window", NULL, 0, 0);
2192 (void)show_file(TRUE, "option.txt#Window", NULL, 0, 0);
2202 d = get_keymap_dir(ch);
2204 x = (x + ddx[d] + 8) % 8;
2205 y = (y + ddy[d] + 16) % 16;
2212 /* Notice changes */
2213 for (j = 0; j < 8; j++)
2218 if (!angband_term[j]) continue;
2220 /* Ignore non-changes */
2221 if (window_flag[j] == old_flag[j]) continue;
2224 Term_activate(angband_term[j]);
2241 * Set or unset various options.
2243 * The user must use the "Ctrl-R" command to "adapt" to changes
2244 * in any options which control "visual" aspects of the game.
2246 void do_cmd_options(void)
2251 /* Save the screen */
2260 /* Why are we here */
2262 prt("[ ¥ª¥×¥·¥ç¥ó¤ÎÀßÄê ]", 2, 0);
2264 prt("Options", 2, 0);
2268 /* Give some choices */
2270 prt("(1) ¥¡¼ÆþÎÏ ¥ª¥×¥·¥ç¥ó", 4, 5);
2271 prt("(2) ²èÌ̽ÐÎÏ ¥ª¥×¥·¥ç¥ó", 5, 5);
2272 prt("(3) ¥²¡¼¥à¥×¥ì¥¤ ¥ª¥×¥·¥ç¥ó", 6, 5);
2273 prt("(4) ¹ÔÆ°Ãæ»ß´Ø·¸ ¥ª¥×¥·¥ç¥ó", 7, 5);
2274 prt("(5) ¸úΨ²½ ¥ª¥×¥·¥ç¥ó", 8, 5);
2275 prt("(6) ´Ê°×¥¢¥¤¥Æ¥à¼«Æ°Ç˲õ ¥ª¥×¥·¥ç¥ó", 9, 5);
2276 prt("(R) ¥×¥ì¥¤µÏ¿ ¥ª¥×¥·¥ç¥ó", 10, 5);
2277 /* Special choices */
2278 prt("(D) ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 12, 5);
2279 prt("(H) Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 13, 5);
2280 prt("(A) ¼«Æ°¥»¡¼¥Ö ¥ª¥×¥·¥ç¥ó", 14, 5);
2282 prt("(W) ¥¦¥¤¥ó¥É¥¦¥Õ¥é¥°", 15, 5);
2284 prt("(1) Input Options", 4, 5);
2285 prt("(2) Output Options", 5, 5);
2286 prt("(3) Game-Play Options", 6, 5);
2287 prt("(4) Disturbance Options", 7, 5);
2288 prt("(5) Efficiency Options", 8, 5);
2289 prt("(6) Easy Auto-Destroyer Options", 9, 5);
2290 prt("(R) Play-record Options", 10, 5);
2292 /* Special choices */
2293 prt("(D) Base Delay Factor", 12, 5);
2294 prt("(H) Hitpoint Warning", 13, 5);
2295 prt("(A) Autosave Options", 14, 5);
2299 prt("(W) Window Flags", 15, 5);
2302 if (p_ptr->noscore || allow_debug_opts)
2306 prt("(C) º¾µ½ ¥ª¥×¥·¥ç¥ó", 16, 5);
2308 prt("(C) Cheating Options", 16, 5);
2315 prt("¥³¥Þ¥ó¥É:", 18, 0);
2317 prt("Command: ", 18, 0);
2325 if (k == ESCAPE) break;
2330 /* General Options */
2333 /* Process the general options */
2335 do_cmd_options_aux(1, "¥¡¼ÆþÎÏ¥ª¥×¥·¥ç¥ó");
2337 do_cmd_options_aux(1, "Input Options");
2343 /* General Options */
2346 /* Process the general options */
2348 do_cmd_options_aux(2, "²èÌ̽ÐÎÏ¥ª¥×¥·¥ç¥ó");
2350 do_cmd_options_aux(2, "Output Options");
2356 /* Inventory Options */
2361 do_cmd_options_aux(3, "¥²¡¼¥à¥×¥ì¥¤¡¦¥ª¥×¥·¥ç¥ó");
2363 do_cmd_options_aux(3, "Game-Play Options");
2369 /* Disturbance Options */
2374 do_cmd_options_aux(4, "¹ÔÆ°Ãæ»ß´Ø·¸¤Î¥ª¥×¥·¥ç¥ó");
2376 do_cmd_options_aux(4, "Disturbance Options");
2382 /* Efficiency Options */
2387 do_cmd_options_aux(5, "¸úΨ²½¥ª¥×¥·¥ç¥ó");
2389 do_cmd_options_aux(5, "Efficiency Options");
2395 /* Object auto-destruction Options */
2400 do_cmd_options_aux(7, "´Ê°×¥¢¥¤¥Æ¥à¼«Æ°Ç˲õ¥ª¥×¥·¥ç¥ó");
2402 do_cmd_options_aux(7, "Easy Auto-Destroyer Options");
2407 /* Play-record Options */
2413 do_cmd_options_aux(10, "¥×¥ì¥¤µÏ¿¥ª¥×¥·¥ç¥ó");
2415 do_cmd_options_aux(10, "Play-record Option");
2420 /* Cheating Options */
2423 if (!p_ptr->noscore && !allow_debug_opts)
2425 /* Cheat options are not permitted */
2432 do_cmd_options_cheat("º¾µ½»Õ¤Ï·è¤·¤Æ¾¡Íø¤Ç¤¤Ê¤¤¡ª");
2434 do_cmd_options_cheat("Cheaters never win");
2444 do_cmd_options_autosave("¼«Æ°¥»¡¼¥Ö");
2446 do_cmd_options_autosave("Autosave");
2457 do_cmd_options_win();
2458 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL |
2459 PW_PLAYER | PW_MESSAGE | PW_OVERHEAD |
2460 PW_MONSTER | PW_OBJECT | PW_SNAPSHOT |
2461 PW_BORG_1 | PW_BORG_2 | PW_DUNGEON);
2465 /* Hack -- Delay Speed */
2471 prt("¥³¥Þ¥ó¥É: ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 18, 0);
2473 prt("Command: Base Delay Factor", 18, 0);
2477 /* Get a new value */
2480 int msec = delay_factor * delay_factor * delay_factor;
2482 prt(format("¸½ºß¤Î¥¦¥§¥¤¥È: %d (%d¥ß¥êÉÃ)",
2483 delay_factor, msec), 22, 0);
2485 prt(format("Current base delay factor: %d (%d msec)",
2486 delay_factor, msec), 22, 0);
2490 prt("¥¦¥§¥¤¥È (0-9) ESC¤Ç·èÄê: ", 20, 0);
2492 prt("Delay Factor (0-9 or ESC to accept): ", 20, 0);
2496 if (k == ESCAPE) break;
2500 (void)show_file(TRUE, "joption.txt#BaseDelay", NULL, 0, 0);
2502 (void)show_file(TRUE, "option.txt#BaseDelay", NULL, 0, 0);
2506 else if (isdigit(k)) delay_factor = D2I(k);
2513 /* Hack -- hitpoint warning factor */
2519 prt("¥³¥Þ¥ó¥É: Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 18, 0);
2521 prt("Command: Hitpoint Warning", 18, 0);
2525 /* Get a new value */
2529 prt(format("¸½ºß¤ÎÄã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð: %d0%%",
2530 hitpoint_warn), 22, 0);
2532 prt(format("Current hitpoint warning: %d0%%",
2533 hitpoint_warn), 22, 0);
2537 prt("Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð (0-9) ESC¤Ç·èÄê: ", 20, 0);
2539 prt("Hitpoint Warning (0-9 or ESC to accept): ", 20, 0);
2543 if (k == ESCAPE) break;
2547 (void)show_file(TRUE, "joption.txt#Hitpoint", NULL, 0, 0);
2549 (void)show_file(TRUE, "option.txt#Hitpoint", NULL, 0, 0);
2553 else if (isdigit(k)) hitpoint_warn = D2I(k);
2562 (void)show_file(TRUE, "joption.txt", NULL, 0, 0);
2564 (void)show_file(TRUE, "option.txt", NULL, 0, 0);
2569 /* Unknown option */
2578 /* Flush messages */
2583 /* Restore the screen */
2586 /* Hack - Redraw equippy chars */
2587 p_ptr->redraw |= (PR_EQUIPPY);
2593 * Ask for a "user pref line" and process it
2595 * XXX XXX XXX Allow absolute file names?
2597 void do_cmd_pref(void)
2604 /* Ask for a "user pref command" */
2606 if (!get_string("ÀßÄêÊѹ¹¥³¥Þ¥ó¥É: ", buf, 80)) return;
2608 if (!get_string("Pref: ", buf, 80)) return;
2612 /* Process that pref command */
2613 (void)process_pref_file_command(buf);
2616 void do_cmd_pickpref(void)
2622 if(!get_check("¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹¤«? ")) return;
2624 if(!get_check("Reload auto-pick preference file? ")) return;
2627 /* Free old entries */
2630 /* ¥¥ã¥éËè¤ÎÀßÄê¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß */
2632 sprintf(buf, "picktype-%s.prf", player_name);
2634 sprintf(buf, "pickpref-%s.prf", player_name);
2636 err = process_pickpref_file(buf);
2641 msg_format("%s¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", buf);
2643 msg_format("loaded '%s'.", buf);
2647 /* ¶¦Ä̤ÎÀßÄê¥Õ¥¡¥¤¥ëÆɤ߹þ¤ß */
2649 /* Process 'pick????.prf' if 'pick????-<name>.prf' doesn't exist */
2653 err = process_pickpref_file("picktype.prf");
2655 err = process_pickpref_file("pickpref.prf");
2661 msg_print("picktype.prf¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£");
2663 msg_print("loaded 'pickpref.prf'.");
2670 if(err) msg_print("¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
2672 if(err) msg_print("Failed to reload autopick preference.");
2679 * Hack -- append all current macros to the given file
2681 static errr macro_dump(cptr fname)
2683 static cptr mark = "Macro Dump";
2689 /* Build the filename */
2690 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2692 /* File type is "TEXT" */
2693 FILE_TYPE(FILE_TYPE_TEXT);
2695 /* Append to the file */
2696 if (!open_auto_dump(buf, mark)) return (-1);
2700 auto_dump_printf("\n# ¼«Æ°¥Þ¥¯¥í¥»¡¼¥Ö\n\n");
2702 auto_dump_printf("\n# Automatic macro dump\n\n");
2706 for (i = 0; i < macro__num; i++)
2708 /* Extract the action */
2709 ascii_to_text(buf, macro__act[i]);
2711 /* Dump the macro */
2712 auto_dump_printf("A:%s\n", buf);
2714 /* Extract the action */
2715 ascii_to_text(buf, macro__pat[i]);
2717 /* Dump normal macros */
2718 auto_dump_printf("P:%s\n", buf);
2721 auto_dump_printf("\n");
2733 * Hack -- ask for a "trigger" (see below)
2735 * Note the complex use of the "inkey()" function from "util.c".
2737 * Note that both "flush()" calls are extremely important.
2739 static void do_cmd_macro_aux(char *buf)
2749 /* Do not process macros */
2755 /* Read the pattern */
2761 /* Do not process macros */
2764 /* Do not wait for keys */
2767 /* Attempt to read a key */
2778 /* Convert the trigger */
2779 ascii_to_text(tmp, buf);
2781 /* Hack -- display the trigger */
2782 Term_addstr(-1, TERM_WHITE, tmp);
2789 * Hack -- ask for a keymap "trigger" (see below)
2791 * Note that both "flush()" calls are extremely important. This may
2792 * no longer be true, since "util.c" is much simpler now. XXX XXX XXX
2794 static void do_cmd_macro_aux_keymap(char *buf)
2808 /* Convert to ascii */
2809 ascii_to_text(tmp, buf);
2811 /* Hack -- display the trigger */
2812 Term_addstr(-1, TERM_WHITE, tmp);
2821 * Hack -- append all keymaps to the given file
2823 static errr keymap_dump(cptr fname)
2825 static cptr mark = "Keymap Dump";
2834 if (rogue_like_commands)
2836 mode = KEYMAP_MODE_ROGUE;
2842 mode = KEYMAP_MODE_ORIG;
2846 /* Build the filename */
2847 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2849 /* File type is "TEXT" */
2850 FILE_TYPE(FILE_TYPE_TEXT);
2852 /* Append to the file */
2853 if (!open_auto_dump(buf, mark)) return -1;
2857 auto_dump_printf("\n# ¼«Æ°¥¡¼ÇÛÃÖ¥»¡¼¥Ö\n\n");
2859 auto_dump_printf("\n# Automatic keymap dump\n\n");
2863 for (i = 0; i < 256; i++)
2867 /* Loop up the keymap */
2868 act = keymap_act[mode][i];
2870 /* Skip empty keymaps */
2873 /* Encode the key */
2876 ascii_to_text(key, buf);
2878 /* Encode the action */
2879 ascii_to_text(buf, act);
2881 /* Dump the macro */
2882 auto_dump_printf("A:%s\n", buf);
2883 auto_dump_printf("C:%d:%s\n", mode, key);
2896 * Interact with "macros"
2898 * Note that the macro "action" must be defined before the trigger.
2900 * Could use some helpful instructions on this page. XXX XXX XXX
2902 void do_cmd_macros(void)
2914 if (rogue_like_commands)
2916 mode = KEYMAP_MODE_ROGUE;
2922 mode = KEYMAP_MODE_ORIG;
2925 /* File type is "TEXT" */
2926 FILE_TYPE(FILE_TYPE_TEXT);
2933 /* Process requests until done */
2941 prt("[ ¥Þ¥¯¥í¤ÎÀßÄê ]", 2, 0);
2943 prt("Interact with Macros", 2, 0);
2948 /* Describe that action */
2950 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
2952 prt("Current action (if any) shown below:", 20, 0);
2956 /* Analyze the current action */
2957 ascii_to_text(buf, macro__buf);
2959 /* Display the current action */
2965 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
2967 prt("(1) Load a user pref file", 4, 5);
2972 prt("(2) ¥Õ¥¡¥¤¥ë¤Ë¥Þ¥¯¥í¤òÄɲÃ", 5, 5);
2973 prt("(3) ¥Þ¥¯¥í¤Î³Îǧ", 6, 5);
2974 prt("(4) ¥Þ¥¯¥í¤ÎºîÀ®", 7, 5);
2975 prt("(5) ¥Þ¥¯¥í¤Îºï½ü", 8, 5);
2976 prt("(6) ¥Õ¥¡¥¤¥ë¤Ë¥¡¼ÇÛÃÖ¤òÄɲÃ", 9, 5);
2977 prt("(7) ¥¡¼ÇÛÃ֤γÎǧ", 10, 5);
2978 prt("(8) ¥¡¼ÇÛÃ֤κîÀ®", 11, 5);
2979 prt("(9) ¥¡¼ÇÛÃ֤κï½ü", 12, 5);
2980 prt("(0) ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 13, 5);
2982 prt("(2) Append macros to a file", 5, 5);
2983 prt("(3) Query a macro", 6, 5);
2984 prt("(4) Create a macro", 7, 5);
2985 prt("(5) Remove a macro", 8, 5);
2986 prt("(6) Append keymaps to a file", 9, 5);
2987 prt("(7) Query a keymap", 10, 5);
2988 prt("(8) Create a keymap", 11, 5);
2989 prt("(9) Remove a keymap", 12, 5);
2990 prt("(0) Enter a new action", 13, 5);
2993 #endif /* ALLOW_MACROS */
2997 prt("¥³¥Þ¥ó¥É: ", 16, 0);
2999 prt("Command: ", 16, 0);
3007 if (i == ESCAPE) break;
3009 /* Load a 'macro' file */
3016 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 16, 0);
3018 prt("Command: Load a user pref file", 16, 0);
3024 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3026 prt("File: ", 18, 0);
3030 /* Default filename */
3031 sprintf(tmp, "%s.prf", player_name);
3033 /* Ask for a file */
3034 if (!askfor_aux(tmp, 80)) continue;
3036 /* Process the given filename */
3037 err = process_pref_file(tmp);
3041 msg_format("ɸ½à¤ÎÀßÄê¥Õ¥¡¥¤¥ë'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3043 msg_format("Loaded default '%s'.", tmp);
3050 msg_format("'%s'¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡ª", tmp);
3052 msg_format("Failed to load '%s'!");
3058 msg_format("'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3060 msg_format("Loaded '%s'.", tmp);
3072 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3074 prt("Command: Append macros to a file", 16, 0);
3080 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3082 prt("File: ", 18, 0);
3086 /* Default filename */
3087 sprintf(tmp, "%s.prf", player_name);
3089 /* Ask for a file */
3090 if (!askfor_aux(tmp, 80)) continue;
3092 /* Dump the macros */
3093 (void)macro_dump(tmp);
3097 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3099 msg_print("Appended macros.");
3111 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Î³Îǧ", 16, 0);
3113 prt("Command: Query a macro", 16, 0);
3119 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3121 prt("Trigger: ", 18, 0);
3125 /* Get a macro trigger */
3126 do_cmd_macro_aux(buf);
3128 /* Acquire action */
3129 k = macro_find_exact(buf);
3136 msg_print("¤½¤Î¥¡¼¤Ë¤Ï¥Þ¥¯¥í¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3138 msg_print("Found no macro.");
3146 /* Obtain the action */
3147 strcpy(macro__buf, macro__act[k]);
3149 /* Analyze the current action */
3150 ascii_to_text(buf, macro__buf);
3152 /* Display the current action */
3157 msg_print("¥Þ¥¯¥í¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3159 msg_print("Found a macro.");
3165 /* Create a macro */
3170 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ÎºîÀ®", 16, 0);
3172 prt("Command: Create a macro", 16, 0);
3178 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3180 prt("Trigger: ", 18, 0);
3184 /* Get a macro trigger */
3185 do_cmd_macro_aux(buf);
3192 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3194 prt("Action: ", 20, 0);
3198 /* Convert to text */
3199 ascii_to_text(tmp, macro__buf);
3201 /* Get an encoded action */
3202 if (askfor_aux(tmp, 80))
3204 /* Convert to ascii */
3205 text_to_ascii(macro__buf, tmp);
3207 /* Link the macro */
3208 macro_add(buf, macro__buf);
3212 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3214 msg_print("Added a macro.");
3220 /* Remove a macro */
3225 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Îºï½ü", 16, 0);
3227 prt("Command: Remove a macro", 16, 0);
3233 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3235 prt("Trigger: ", 18, 0);
3239 /* Get a macro trigger */
3240 do_cmd_macro_aux(buf);
3242 /* Link the macro */
3243 macro_add(buf, buf);
3247 msg_print("¥Þ¥¯¥í¤òºï½ü¤·¤Þ¤·¤¿¡£");
3249 msg_print("Removed a macro.");
3259 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃÖ¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3261 prt("Command: Append keymaps to a file", 16, 0);
3267 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3269 prt("File: ", 18, 0);
3273 /* Default filename */
3274 sprintf(tmp, "%s.prf", player_name);
3276 /* Ask for a file */
3277 if (!askfor_aux(tmp, 80)) continue;
3279 /* Dump the macros */
3280 (void)keymap_dump(tmp);
3284 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3286 msg_print("Appended keymaps.");
3291 /* Query a keymap */
3298 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤γÎǧ", 16, 0);
3300 prt("Command: Query a keymap", 16, 0);
3306 prt("²¡¤¹¥¡¼: ", 18, 0);
3308 prt("Keypress: ", 18, 0);
3312 /* Get a keymap trigger */
3313 do_cmd_macro_aux_keymap(buf);
3315 /* Look up the keymap */
3316 act = keymap_act[mode][(byte)(buf[0])];
3323 msg_print("¥¡¼ÇÛÃÖ¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3325 msg_print("Found no keymap.");
3333 /* Obtain the action */
3334 strcpy(macro__buf, act);
3336 /* Analyze the current action */
3337 ascii_to_text(buf, macro__buf);
3339 /* Display the current action */
3344 msg_print("¥¡¼ÇÛÃÖ¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3346 msg_print("Found a keymap.");
3352 /* Create a keymap */
3357 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κîÀ®", 16, 0);
3359 prt("Command: Create a keymap", 16, 0);
3365 prt("²¡¤¹¥¡¼: ", 18, 0);
3367 prt("Keypress: ", 18, 0);
3371 /* Get a keymap trigger */
3372 do_cmd_macro_aux_keymap(buf);
3379 prt("¹ÔÆ°: ", 20, 0);
3381 prt("Action: ", 20, 0);
3385 /* Convert to text */
3386 ascii_to_text(tmp, macro__buf);
3388 /* Get an encoded action */
3389 if (askfor_aux(tmp, 80))
3391 /* Convert to ascii */
3392 text_to_ascii(macro__buf, tmp);
3394 /* Free old keymap */
3395 string_free(keymap_act[mode][(byte)(buf[0])]);
3397 /* Make new keymap */
3398 keymap_act[mode][(byte)(buf[0])] = string_make(macro__buf);
3402 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3404 msg_print("Added a keymap.");
3410 /* Remove a keymap */
3415 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κï½ü", 16, 0);
3417 prt("Command: Remove a keymap", 16, 0);
3423 prt("²¡¤¹¥¡¼: ", 18, 0);
3425 prt("Keypress: ", 18, 0);
3429 /* Get a keymap trigger */
3430 do_cmd_macro_aux_keymap(buf);
3432 /* Free old keymap */
3433 string_free(keymap_act[mode][(byte)(buf[0])]);
3435 /* Make new keymap */
3436 keymap_act[mode][(byte)(buf[0])] = NULL;
3440 msg_print("¥¡¼ÇÛÃÖ¤òºï½ü¤·¤Þ¤·¤¿¡£");
3442 msg_print("Removed a keymap.");
3447 /* Enter a new action */
3452 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 16, 0);
3454 prt("Command: Enter a new action", 16, 0);
3458 /* Go to the correct location */
3461 /* Hack -- limit the value */
3464 /* Get an encoded action */
3465 if (!askfor_aux(buf, 80)) continue;
3467 /* Extract an action */
3468 text_to_ascii(macro__buf, buf);
3471 #endif /* ALLOW_MACROS */
3480 /* Flush messages */
3489 static void cmd_visuals_aux(int i, int *num, int max)
3496 sprintf(str, "%d", *num);
3498 if (!get_string(format("Input new number(0-%d): ", max-1), str, 4))
3501 tmp = strtol(str, NULL, 0);
3502 if (tmp >= 0 && tmp < max)
3506 else if (isupper(i))
3507 *num = (*num + max - 1) % max;
3509 *num = (*num + 1) % max;
3515 * Interact with "visuals"
3517 void do_cmd_visuals(void)
3525 const char *empty_symbol = "<< ? >>";
3527 if (use_bigtile) empty_symbol = "<< ?? >>";
3529 /* File type is "TEXT" */
3530 FILE_TYPE(FILE_TYPE_TEXT);
3533 /* Save the screen */
3537 /* Interact until done */
3543 /* Ask for a choice */
3545 prt("²èÌÌɽ¼¨¤ÎÀßÄê", 2, 0);
3547 prt("Interact with Visuals", 2, 0);
3551 /* Give some choices */
3553 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
3555 prt("(1) Load a user pref file", 4, 5);
3558 #ifdef ALLOW_VISUALS
3560 prt("(2) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
3561 prt("(3) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 6, 5);
3562 prt("(4) ÃÏ·Á¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 7, 5);
3563 prt("(5) (̤»ÈÍÑ)", 8, 5);
3564 prt("(6) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë", 9, 5);
3565 prt("(7) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë", 10, 5);
3566 prt("(8) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë", 11, 5);
3567 prt("(9) (̤»ÈÍÑ)", 12, 5);
3569 prt("(2) Dump monster attr/chars", 5, 5);
3570 prt("(3) Dump object attr/chars", 6, 5);
3571 prt("(4) Dump feature attr/chars", 7, 5);
3572 prt("(5) (unused)", 8, 5);
3573 prt("(6) Change monster attr/chars", 9, 5);
3574 prt("(7) Change object attr/chars", 10, 5);
3575 prt("(8) Change feature attr/chars", 11, 5);
3576 prt("(9) (unused)", 12, 5);
3581 prt("(0) ²èÌÌɽ¼¨ÊýË¡¤Î½é´ü²½", 13, 5);
3583 prt("(0) Reset visuals", 13, 5);
3589 prt("¥³¥Þ¥ó¥É:", 18, 0);
3591 prt("Command: ", 15, 0);
3599 if (i == ESCAPE) break;
3601 /* Load a 'pref' file */
3606 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 15, 0);
3608 prt("Command: Load a user pref file", 15, 0);
3614 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3616 prt("File: ", 17, 0);
3620 /* Default filename */
3621 sprintf(tmp, "%s.prf", player_name);
3624 if (!askfor_aux(tmp, 70)) continue;
3626 /* Process the given filename */
3627 (void)process_pref_file(tmp);
3630 #ifdef ALLOW_VISUALS
3632 /* Dump monster attr/chars */
3635 static cptr mark = "Monster attr/chars";
3639 prt("¥³¥Þ¥ó¥É: ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3641 prt("Command: Dump monster attr/chars", 15, 0);
3647 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3649 prt("File: ", 17, 0);
3653 /* Default filename */
3654 sprintf(tmp, "%s.prf", player_name);
3656 /* Get a filename */
3657 if (!askfor_aux(tmp, 70)) continue;
3659 /* Build the filename */
3660 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3662 /* Append to the file */
3663 if (!open_auto_dump(buf, mark)) continue;
3667 auto_dump_printf("\n# ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3669 auto_dump_printf("\n# Monster attr/char definitions\n\n");
3673 for (i = 1; i < max_r_idx; i++)
3675 monster_race *r_ptr = &r_info[i];
3677 /* Skip non-entries */
3678 if (!r_ptr->name) continue;
3680 /* Dump a comment */
3681 auto_dump_printf("# %s\n", (r_name + r_ptr->name));
3683 /* Dump the monster attr/char info */
3684 auto_dump_printf("R:%d:0x%02X/0x%02X\n\n", i,
3685 (byte)(r_ptr->x_attr), (byte)(r_ptr->x_char));
3693 msg_print("¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3695 msg_print("Dumped monster attr/chars.");
3700 /* Dump object attr/chars */
3703 static cptr mark = "Object attr/chars";
3707 prt("¥³¥Þ¥ó¥É: ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3709 prt("Command: Dump object attr/chars", 15, 0);
3715 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3717 prt("File: ", 17, 0);
3721 /* Default filename */
3722 sprintf(tmp, "%s.prf", player_name);
3724 /* Get a filename */
3725 if (!askfor_aux(tmp, 70)) continue;
3727 /* Build the filename */
3728 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3730 /* Append to the file */
3731 if (!open_auto_dump(buf, mark)) continue;
3735 auto_dump_printf("\n# ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3737 auto_dump_printf("\n# Object attr/char definitions\n\n");
3741 for (i = 1; i < max_k_idx; i++)
3744 object_kind *k_ptr = &k_info[i];
3746 /* Skip non-entries */
3747 if (!k_ptr->name) continue;
3749 /* Skip entries with flavor */
3750 if (k_ptr->flavor) continue;
3753 strip_name(o_name, i);
3755 /* Dump a comment */
3756 auto_dump_printf("# %s\n", o_name);
3758 /* Dump the object attr/char info */
3759 auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", i,
3760 (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char));
3768 msg_print("¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3770 msg_print("Dumped object attr/chars.");
3775 /* Dump feature attr/chars */
3778 static cptr mark = "Feature attr/chars";
3782 prt("¥³¥Þ¥ó¥É: ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3784 prt("Command: Dump feature attr/chars", 15, 0);
3790 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3792 prt("File: ", 17, 0);
3796 /* Default filename */
3797 sprintf(tmp, "%s.prf", player_name);
3799 /* Get a filename */
3800 if (!askfor_aux(tmp, 70)) continue;
3802 /* Build the filename */
3803 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3805 /* Append to the file */
3806 if (!open_auto_dump(buf, mark)) continue;
3810 auto_dump_printf("\n# ÃÏ·Á¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3812 auto_dump_printf("\n# Feature attr/char definitions\n\n");
3816 for (i = 1; i < max_f_idx; i++)
3818 feature_type *f_ptr = &f_info[i];
3820 /* Skip non-entries */
3821 if (!f_ptr->name) continue;
3823 /* Skip mimiccing features */
3824 if (f_ptr->mimic != i) continue;
3826 /* Dump a comment */
3827 auto_dump_printf("# %s\n", (f_name + f_ptr->name));
3829 /* Dump the feature attr/char info */
3830 auto_dump_printf("F:%d:0x%02X/0x%02X\n\n", i,
3831 (byte)(f_ptr->x_attr), (byte)(f_ptr->x_char));
3839 msg_print("ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3841 msg_print("Dumped feature attr/chars.");
3846 /* Modify monster attr/chars */
3853 prt("¥³¥Þ¥ó¥É: ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹", 15, 0);
3855 prt("Command: Change monster attr/chars", 15, 0);
3859 /* Hack -- query until done */
3862 monster_race *r_ptr = &r_info[r];
3867 byte da = (r_ptr->d_attr);
3868 byte dc = (r_ptr->d_char);
3869 byte ca = (r_ptr->x_attr);
3870 byte cc = (r_ptr->x_char);
3872 /* Label the object */
3874 Term_putstr(5, 17, -1, TERM_WHITE,
3875 format("¥â¥ó¥¹¥¿¡¼ = %d, ̾Á° = %-40.40s",
3876 r, (r_name + r_ptr->name)));
3878 Term_putstr(5, 17, -1, TERM_WHITE,
3879 format("Monster = %d, Name = %-40.40s",
3880 r, (r_name + r_ptr->name)));
3884 /* Label the Default values */
3886 Term_putstr(10, 19, -1, TERM_WHITE,
3887 format("½é´üÃÍ ¿§ / ʸ»ú = %3u / %3u", da, dc));
3889 Term_putstr(10, 19, -1, TERM_WHITE,
3890 format("Default attr/char = %3u / %3u", da, dc));
3893 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
3897 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
3899 Term_putch(43, 19, a, c);
3900 if (use_bigtile) Term_putch(43 + 1, 19, a2, c2);
3902 /* Label the Current values */
3904 Term_putstr(10, 20, -1, TERM_WHITE,
3905 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3u / %3u", ca, cc));
3907 Term_putstr(10, 20, -1, TERM_WHITE,
3908 format("Current attr/char = %3u / %3u", ca, cc));
3911 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
3915 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
3917 Term_putch(43, 20, a, c);
3918 if (use_bigtile) Term_putch(43 + 1, 20, a2, c2);
3923 Term_putstr(0, 22, -1, TERM_WHITE,
3924 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C): ");
3926 Term_putstr(0, 22, -1, TERM_WHITE,
3927 "Command (n/N/^N/a/A/^A/c/C/^C): ");
3934 if (i == ESCAPE) break;
3936 if (iscntrl(i)) c = 'a' + i - KTRL('A');
3937 else if (isupper(i)) c = 'a' + i - 'A';
3943 cmd_visuals_aux(i, &r, max_r_idx);
3946 t = (int)r_ptr->x_attr;
3947 cmd_visuals_aux(i, &t, 256);
3948 r_ptr->x_attr = (byte)t;
3951 t = (int)r_ptr->x_char;
3952 cmd_visuals_aux(i, &t, 256);
3953 r_ptr->x_char = (byte)t;
3959 /* Modify object attr/chars */
3966 prt("¥³¥Þ¥ó¥É: ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹", 15, 0);
3968 prt("Command: Change object attr/chars", 15, 0);
3972 /* Hack -- query until done */
3975 object_kind *k_ptr = &k_info[k];
3980 byte da = (byte)k_ptr->d_attr;
3981 byte dc = (byte)k_ptr->d_char;
3982 byte ca = (byte)k_ptr->x_attr;
3983 byte cc = (byte)k_ptr->x_char;
3985 /* Label the object */
3987 Term_putstr(5, 17, -1, TERM_WHITE,
3988 format("¥¢¥¤¥Æ¥à = %d, ̾Á° = %-40.40s",
3989 k, (k_name + k_ptr->name)));
3991 Term_putstr(5, 17, -1, TERM_WHITE,
3992 format("Object = %d, Name = %-40.40s",
3993 k, (k_name + k_ptr->name)));
3997 /* Label the Default values */
3999 Term_putstr(10, 19, -1, TERM_WHITE,
4000 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4002 Term_putstr(10, 19, -1, TERM_WHITE,
4003 format("Default attr/char = %3d / %3d", da, dc));
4006 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4009 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
4011 Term_putch(43, 19, a, c);
4012 if (use_bigtile) Term_putch(43 + 1, 19, a2, c2);
4015 /* Label the Current values */
4017 Term_putstr(10, 20, -1, TERM_WHITE,
4018 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4020 Term_putstr(10, 20, -1, TERM_WHITE,
4021 format("Current attr/char = %3d / %3d", ca, cc));
4024 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4027 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
4029 Term_putch(43, 20, a, c);
4030 if (use_bigtile) Term_putch(43 + 1, 20, a2, c2);
4035 Term_putstr(0, 22, -1, TERM_WHITE,
4036 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C): ");
4038 Term_putstr(0, 22, -1, TERM_WHITE,
4039 "Command (n/N/^N/a/A/^A/c/C/^C): ");
4046 if (i == ESCAPE) break;
4048 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4049 else if (isupper(i)) c = 'a' + i - 'A';
4055 cmd_visuals_aux(i, &k, max_k_idx);
4058 t = (int)k_info[k].x_attr;
4059 cmd_visuals_aux(i, &t, 256);
4060 k_info[k].x_attr = (byte)t;
4063 t = (int)k_info[k].x_char;
4064 cmd_visuals_aux(i, &t, 256);
4065 k_info[k].x_char = (byte)t;
4071 /* Modify feature attr/chars */
4078 prt("¥³¥Þ¥ó¥É: ÃÏ·Á¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹", 15, 0);
4080 prt("Command: Change feature attr/chars", 15, 0);
4084 /* Hack -- query until done */
4087 feature_type *f_ptr = &f_info[f];
4092 byte da = (byte)f_ptr->d_attr;
4093 byte dc = (byte)f_ptr->d_char;
4094 byte ca = (byte)f_ptr->x_attr;
4095 byte cc = (byte)f_ptr->x_char;
4097 /* Label the object */
4099 Term_putstr(5, 17, -1, TERM_WHITE,
4100 format("ÃÏ·Á = %d, ̾Á° = %-40.40s",
4101 f, (f_name + f_ptr->name)));
4103 Term_putstr(5, 17, -1, TERM_WHITE,
4104 format("Terrain = %d, Name = %-40.40s",
4105 f, (f_name + f_ptr->name)));
4109 /* Label the Default values */
4111 Term_putstr(10, 19, -1, TERM_WHITE,
4112 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4114 Term_putstr(10, 19, -1, TERM_WHITE,
4115 format("Default attr/char = %3d / %3d", da, dc));
4118 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4121 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
4123 Term_putch(43, 19, a, c);
4124 if (use_bigtile) Term_putch(43 + 1, 19, a2, c2);
4127 /* Label the Current values */
4129 Term_putstr(10, 20, -1, TERM_WHITE,
4130 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4132 Term_putstr(10, 20, -1, TERM_WHITE,
4133 format("Current attr/char = %3d / %3d", ca, cc));
4136 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4139 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
4141 Term_putch(43, 20, a, c);
4142 if (use_bigtile) Term_putch(43 + 1, 20, a2, c2);
4147 Term_putstr(0, 22, -1, TERM_WHITE,
4148 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C): ");
4150 Term_putstr(0, 22, -1, TERM_WHITE,
4151 "Command (n/N/^N/a/A/^A/c/C/^C): ");
4158 if (i == ESCAPE) break;
4160 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4161 else if (isupper(i)) c = 'a' + i - 'A';
4167 cmd_visuals_aux(i, &f, max_f_idx);
4170 t = (int)f_info[f].x_attr;
4171 cmd_visuals_aux(i, &t, 256);
4172 f_info[f].x_attr = (byte)t;
4175 t = (int)f_info[f].x_char;
4176 cmd_visuals_aux(i, &t, 256);
4177 f_info[f].x_char = (byte)t;
4193 msg_print("²èÌ̾å¤Î[¿§/ʸ»ú]¤ò½é´üÃͤ˥ꥻ¥Ã¥È¤·¤Þ¤·¤¿¡£");
4195 msg_print("Visual attr/char tables reset.");
4200 /* Unknown option */
4206 /* Flush messages */
4211 /* Restore the screen */
4217 * Interact with "colors"
4219 void do_cmd_colors(void)
4228 /* File type is "TEXT" */
4229 FILE_TYPE(FILE_TYPE_TEXT);
4232 /* Save the screen */
4236 /* Interact until done */
4242 /* Ask for a choice */
4244 prt("[ ¥«¥é¡¼¤ÎÀßÄê ]", 2, 0);
4246 prt("Interact with Colors", 2, 0);
4250 /* Give some choices */
4252 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
4254 prt("(1) Load a user pref file", 4, 5);
4259 prt("(2) ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
4260 prt("(3) ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤¹¤ë", 6, 5);
4262 prt("(2) Dump colors", 5, 5);
4263 prt("(3) Modify colors", 6, 5);
4270 prt("¥³¥Þ¥ó¥É: ", 8, 0);
4272 prt("Command: ", 8, 0);
4280 if (i == ESCAPE) break;
4282 /* Load a 'pref' file */
4287 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹", 8, 0);
4289 prt("Command: Load a user pref file", 8, 0);
4295 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4297 prt("File: ", 10, 0);
4302 sprintf(tmp, "%s.prf", player_name);
4305 if (!askfor_aux(tmp, 70)) continue;
4307 /* Process the given filename */
4308 (void)process_pref_file(tmp);
4310 /* Mega-Hack -- react to changes */
4311 Term_xtra(TERM_XTRA_REACT, 0);
4313 /* Mega-Hack -- redraw */
4322 static cptr mark = "Colors";
4326 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 8, 0);
4328 prt("Command: Dump colors", 8, 0);
4334 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4336 prt("File: ", 10, 0);
4340 /* Default filename */
4341 sprintf(tmp, "%s.prf", player_name);
4343 /* Get a filename */
4344 if (!askfor_aux(tmp, 70)) continue;
4346 /* Build the filename */
4347 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
4349 /* Append to the file */
4350 if (!open_auto_dump(buf, mark)) continue;
4354 auto_dump_printf("\n# ¥«¥é¡¼¤ÎÀßÄê\n\n");
4356 auto_dump_printf("\n# Color redefinitions\n\n");
4360 for (i = 0; i < 256; i++)
4362 int kv = angband_color_table[i][0];
4363 int rv = angband_color_table[i][1];
4364 int gv = angband_color_table[i][2];
4365 int bv = angband_color_table[i][3];
4370 cptr name = "unknown";
4374 /* Skip non-entries */
4375 if (!kv && !rv && !gv && !bv) continue;
4377 /* Extract the color name */
4378 if (i < 16) name = color_names[i];
4380 /* Dump a comment */
4382 auto_dump_printf("# ¥«¥é¡¼ '%s'\n", name);
4384 auto_dump_printf("# Color '%s'\n", name);
4387 /* Dump the monster attr/char info */
4388 auto_dump_printf("V:%d:0x%02X:0x%02X:0x%02X:0x%02X\n\n",
4397 msg_print("¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
4399 msg_print("Dumped color redefinitions.");
4411 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤·¤Þ¤¹", 8, 0);
4413 prt("Command: Modify colors", 8, 0);
4417 /* Hack -- query until done */
4426 /* Exhibit the normal colors */
4427 for (j = 0; j < 16; j++)
4429 /* Exhibit this color */
4430 Term_putstr(j*4, 20, -1, a, "###");
4432 /* Exhibit all colors */
4433 Term_putstr(j*4, 22, -1, j, format("%3d", j));
4436 /* Describe the color */
4438 name = ((a < 16) ? color_names[a] : "̤ÄêµÁ");
4440 name = ((a < 16) ? color_names[a] : "undefined");
4444 /* Describe the color */
4446 Term_putstr(5, 10, -1, TERM_WHITE,
4447 format("¥«¥é¡¼ = %d, ̾Á° = %s", a, name));
4449 Term_putstr(5, 10, -1, TERM_WHITE,
4450 format("Color = %d, Name = %s", a, name));
4454 /* Label the Current values */
4455 Term_putstr(5, 12, -1, TERM_WHITE,
4456 format("K = 0x%02x / R,G,B = 0x%02x,0x%02x,0x%02x",
4457 angband_color_table[a][0],
4458 angband_color_table[a][1],
4459 angband_color_table[a][2],
4460 angband_color_table[a][3]));
4464 Term_putstr(0, 14, -1, TERM_WHITE,
4465 "¥³¥Þ¥ó¥É (n/N/k/K/r/R/g/G/b/B): ");
4467 Term_putstr(0, 14, -1, TERM_WHITE,
4468 "Command (n/N/k/K/r/R/g/G/b/B): ");
4476 if (i == ESCAPE) break;
4479 if (i == 'n') a = (byte)(a + 1);
4480 if (i == 'N') a = (byte)(a - 1);
4481 if (i == 'k') angband_color_table[a][0] = (byte)(angband_color_table[a][0] + 1);
4482 if (i == 'K') angband_color_table[a][0] = (byte)(angband_color_table[a][0] - 1);
4483 if (i == 'r') angband_color_table[a][1] = (byte)(angband_color_table[a][1] + 1);
4484 if (i == 'R') angband_color_table[a][1] = (byte)(angband_color_table[a][1] - 1);
4485 if (i == 'g') angband_color_table[a][2] = (byte)(angband_color_table[a][2] + 1);
4486 if (i == 'G') angband_color_table[a][2] = (byte)(angband_color_table[a][2] - 1);
4487 if (i == 'b') angband_color_table[a][3] = (byte)(angband_color_table[a][3] + 1);
4488 if (i == 'B') angband_color_table[a][3] = (byte)(angband_color_table[a][3] - 1);
4490 /* Hack -- react to changes */
4491 Term_xtra(TERM_XTRA_REACT, 0);
4493 /* Hack -- redraw */
4500 /* Unknown option */
4506 /* Flush messages */
4511 /* Restore the screen */
4517 * Note something in the message recall
4519 void do_cmd_note(void)
4528 if (!get_string("¥á¥â: ", buf, 60)) return;
4530 if (!get_string("Note: ", buf, 60)) return;
4534 /* Ignore empty notes */
4535 if (!buf[0] || (buf[0] == ' ')) return;
4537 /* Add the note to the message recall */
4539 msg_format("¥á¥â: %s", buf);
4541 msg_format("Note: %s", buf);
4548 * Mention the current version
4550 void do_cmd_version(void)
4555 msg_format("ÊѶòÈÚÅÜ(Hengband) %d.%d.%d",
4556 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4558 msg_format("You are playing Hengband %d.%d.%d.",
4559 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4566 * Array of feeling strings
4568 static cptr do_cmd_feeling_text[11] =
4571 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4573 "Looks like any other level.",
4577 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4579 "You feel there is something special about this level.",
4583 "¶²¤í¤·¤¤»à¤Î¸¸¤¬ÌܤËÉ⤫¤Ó¡¢µ¤À䤷¤½¤¦¤Ë¤Ê¤Ã¤¿¡ª",
4585 "You nearly faint as horrible visions of death fill your mind!",
4589 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4591 "This level looks very dangerous.",
4595 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4597 "You have a very bad feeling...",
4601 "°¤¤Í½´¶¤¬¤¹¤ë...",
4603 "You have a bad feeling...",
4609 "You feel nervous.",
4613 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4615 "You feel your luck is turning...",
4619 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4621 "You don't like the look of this place.",
4625 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4627 "This level looks reasonably safe.",
4631 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4633 "What a boring place..."
4638 static cptr do_cmd_feeling_text_combat[11] =
4641 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4643 "Looks like any other level.",
4647 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4649 "You feel there is something special about this level.",
4653 "º£Ìë¤â¤Þ¤¿¡¢Ã¯¤«¤¬Ì¿¤òÍî¤È¤¹...",
4655 "You nearly faint as horrible visions of death fill your mind!",
4659 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4661 "This level looks very dangerous.",
4665 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4667 "You have a very bad feeling...",
4671 "°¤¤Í½´¶¤¬¤¹¤ë...",
4673 "You have a bad feeling...",
4679 "You feel nervous.",
4683 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4685 "You feel your luck is turning...",
4689 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4691 "You don't like the look of this place.",
4695 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4697 "This level looks reasonably safe.",
4701 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4703 "What a boring place..."
4708 static cptr do_cmd_feeling_text_lucky[11] =
4711 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4712 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4713 "¤³¤Î³¬¤Ï¤³¤Î¾å¤Ê¤¯ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë¡£",
4714 "ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë...",
4715 "¤È¤Æ¤âÎɤ¤´¶¤¸¤¬¤¹¤ë...",
4716 "Îɤ¤´¶¤¸¤¬¤¹¤ë...",
4717 "¤Á¤ç¤Ã¤È¹¬±¿¤Ê´¶¤¸¤¬¤¹¤ë...",
4718 "¿¾¯¤Ï±¿¤¬¸þ¤¤¤Æ¤¤¿¤«...",
4719 "¸«¤¿´¶¤¸°¤¯¤Ï¤Ê¤¤...",
4720 "Á´Á³ÂÌÌܤȤ¤¤¦¤³¤È¤Ï¤Ê¤¤¤¬...",
4721 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4723 "Looks like any other level.",
4724 "You feel there is something special about this level.",
4725 "You have a superb feeling about this level.",
4726 "You have an excellent feeling...",
4727 "You have a very good feeling...",
4728 "You have a good feeling...",
4729 "You feel strangely lucky...",
4730 "You feel your luck is turning...",
4731 "You like the look of this place...",
4732 "This level can't be all bad...",
4733 "What a boring place..."
4739 * Note that "feeling" is set to zero unless some time has passed.
4740 * Note that this is done when the level is GENERATED, not entered.
4742 void do_cmd_feeling(void)
4744 /* Verify the feeling */
4745 if (feeling > 10) feeling = 10;
4747 /* No useful feeling in quests */
4748 if (p_ptr->inside_quest && !random_quest_number(dun_level))
4751 msg_print("ŵ·¿Åª¤Ê¥¯¥¨¥¹¥È¤Î¥À¥ó¥¸¥ç¥ó¤Î¤è¤¦¤À¡£");
4753 msg_print("Looks like a typical quest level.");
4759 /* No useful feeling in town */
4760 else if (p_ptr->town_num && !dun_level)
4763 if (!strcmp(town[p_ptr->town_num].name, "¹ÓÌî"))
4765 if (!strcmp(town[p_ptr->town_num].name, "wilderness"))
4769 msg_print("²¿¤«¤¢¤ê¤½¤¦¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
4771 msg_print("Looks like a strange wilderness.");
4779 msg_print("ŵ·¿Åª¤ÊÄ®¤Î¤è¤¦¤À¡£");
4781 msg_print("Looks like a typical town.");
4788 /* No useful feeling in the wilderness */
4789 else if (!dun_level)
4792 msg_print("ŵ·¿Åª¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
4794 msg_print("Looks like a typical wilderness.");
4800 /* Display the feeling */
4801 if (turn - old_turn >= (150 - dun_level)*TURNS_PER_TICK || cheat_xtra)
4803 if (p_ptr->muta3 & MUT3_GOOD_LUCK) msg_print(do_cmd_feeling_text_lucky[feeling]);
4805 if((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON)){
4806 msg_print(do_cmd_feeling_text_combat[feeling]);
4808 msg_print(do_cmd_feeling_text[feeling]);
4813 msg_print(do_cmd_feeling_text[0]);
4820 * Description of each monster group.
4822 static cptr monster_group_text[] =
4825 "¥æ¥Ë¡¼¥¯", /* "Uniques" */
4854 /* "¸ÅÂå¥É¥é¥´¥ó/¥ï¥¤¥¢¡¼¥à", */
4871 /* "¾åµé¥Ç¡¼¥â¥ó", */
4911 /* "Ancient Dragon/Wyrm", */
4920 "Multi-Headed Reptile",
4925 "Reptile/Amphibian",
4926 "Spider/Scorpion/Tick",
4928 /* "Major Demon", */
4944 * Symbols of monsters in each group. Note the "Uniques" group
4945 * is handled differently.
4947 static cptr monster_group_char[] =
5001 "$!?=&`.|/\\~[]()>",
5010 * hook function to sort monsters by level
5012 static bool ang_sort_comp_monster_level(vptr u, vptr v, int a, int b)
5014 u16b *who = (u16b*)(u);
5019 monster_race *r_ptr1 = &r_info[w1];
5020 monster_race *r_ptr2 = &r_info[w2];
5025 if (r_ptr2->level > r_ptr1->level) return TRUE;
5026 if (r_ptr1->level > r_ptr2->level) return FALSE;
5028 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return TRUE;
5029 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return FALSE;
5034 * Build a list of monster indexes in the given group. Return the number
5035 * of monsters in the group.
5037 * mode & 0x01 : check for non-empty group
5038 * mode & 0x02 : cheat?
5040 static int collect_monsters(int grp_cur, s16b mon_idx[], byte mode)
5045 /* Get a list of x_char in this group */
5046 cptr group_char = monster_group_char[grp_cur];
5048 /* XXX Hack -- Check if this is the "Uniques" group */
5049 bool grp_unique = (monster_group_char[grp_cur] == (char *) -1L);
5051 /* Check every race */
5052 for (i = 0; i < max_r_idx; i++)
5054 /* Access the race */
5055 monster_race *r_ptr = &r_info[i];
5057 /* Skip empty race */
5058 if (!r_ptr->name) continue ;
5060 /* Require known monsters */
5061 if (!(mode & 0x02) && !cheat_know && !r_ptr->r_sights ) continue;
5063 if (grp_unique && !(r_ptr->flags1 & RF1_UNIQUE)) continue;
5065 /* Check for race in the group */
5066 if (grp_unique || strchr(group_char, r_ptr->d_char))
5069 mon_idx[mon_cnt++] = i;
5071 /* XXX Hack -- Just checking for non-empty group */
5072 if (mode & 0x01) break;
5076 /* Terminate the list */
5077 mon_idx[mon_cnt] = 0;
5079 /* Select the sort method */
5080 ang_sort_comp = ang_sort_comp_monster_level;
5081 ang_sort_swap = ang_sort_swap_hook;
5083 /* Sort by monster level */
5084 ang_sort(mon_idx, &dummy_why, mon_cnt);
5086 /* Return the number of races */
5092 * Description of each monster group.
5094 static cptr object_group_text[] =
5097 "¥¥Î¥³", /* "Mushrooms" */
5098 "Ìô", /* "Potions" */
5099 "Ìý¤Ä¤Ü", /* "Flasks" */
5100 "´¬Êª", /* "Scrolls" */
5101 "»ØÎØ", /* "Rings" */
5102 "¥¢¥ß¥å¥ì¥Ã¥È", /* "Amulets" */
5103 "ū", /* "Whistle" */
5104 "¸÷¸»", /* "Lanterns" */
5105 "ËâË¡ËÀ", /* "Wands" */
5106 "¾ó", /* "Staffs" */
5107 "¥í¥Ã¥É", /* "Rods" */
5108 "¥«¡¼¥É", /* "Cards" */
5109 "¥¥ã¥×¥Á¥ã¡¼¡¦¥Ü¡¼¥ë",
5118 "Åá·õÎà", /* "Swords" */
5119 "Æß´ï", /* "Blunt Weapons" */
5120 "ĹÊÁÉð´ï", /* "Polearms" */
5121 "ºÎ·¡Æ»¶ñ", /* "Diggers" */
5122 "Èô¤ÓÆ»¶ñ", /* "Bows" */
5126 "·ÚÁõ³»", /* "Soft Armor" */
5127 "½ÅÁõ³»", /* "Hard Armor" */
5128 "¥É¥é¥´¥ó³»", /* "Dragon Armor" */
5129 "½â", /* "Shields" */
5130 "¥¯¥í¡¼¥¯", /* "Cloaks" */
5131 "äƼê", /* "Gloves" */
5132 "¥Ø¥ë¥á¥Ã¥È", /* "Helms" */
5133 "´§", /* "Crowns" */
5134 "¥Ö¡¼¥Ä", /* "Boots" */
5182 * TVALs of items in each group
5184 static byte object_group_tval[] =
5224 TV_LIFE_BOOK, /* Hack -- all spellbooks */
5230 * Build a list of monster indexes in the given group. Return the number
5231 * of monsters in the group.
5233 static int collect_objects(int grp_cur, int object_idx[])
5235 int i, j, k, object_cnt = 0;
5237 /* Get a list of x_char in this group */
5238 byte group_tval = object_group_tval[grp_cur];
5240 /* Check every object */
5241 for (i = 0; i < max_k_idx; i++)
5243 /* Access the race */
5244 object_kind *k_ptr = &k_info[i];
5246 /* Skip empty objects */
5247 if (!k_ptr->name) continue;
5249 /* Skip non-flavoured objects */
5250 if (!k_ptr->flavor && !p_ptr->wizard) continue;
5252 /* Skip items with no distribution (special artifacts) */
5253 for (j = 0, k = 0; j < 4; j++) k += k_ptr->chance[j];
5256 /* Require objects ever seen*/
5257 if (!k_ptr->aware && !p_ptr->wizard) continue;
5259 /* Check for race in the group */
5260 if (TV_LIFE_BOOK == group_tval)
5262 /* Hack -- All spell books */
5263 if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HISSATSU_BOOK)
5266 object_idx[object_cnt++] = i;
5269 else if (k_ptr->tval == group_tval)
5272 object_idx[object_cnt++] = i;
5276 /* Terminate the list */
5277 object_idx[object_cnt] = 0;
5279 /* Return the number of races */
5285 * Description of each feature group.
5287 static cptr feature_group_text[] =
5295 * Build a list of feature indexes in the given group. Return the number
5296 * of features in the group.
5298 static int collect_features(int grp_cur, int *feat_idx)
5300 int i, feat_cnt = 0;
5302 /* Unused; There is a single group. */
5305 /* Check every feature */
5306 for (i = 1; i < max_f_idx; i++)
5308 /* Access the index */
5309 feature_type *f_ptr = &f_info[i];
5311 /* Skip empty index */
5312 if (!f_ptr->name) continue;
5314 /* Skip mimiccing features */
5315 if (f_ptr->mimic != i) continue;
5318 feat_idx[feat_cnt++] = i;
5321 /* Terminate the list */
5322 feat_idx[feat_cnt] = 0;
5324 /* Return the number of races */
5331 * Build a list of monster indexes in the given group. Return the number
5332 * of monsters in the group.
5334 static int collect_artifacts(int grp_cur, int object_idx[])
5336 int i, object_cnt = 0;
5338 /* Get a list of x_char in this group */
5339 byte group_tval = object_group_tval[grp_cur];
5341 /* Check every object */
5342 for (i = 0; i < max_a_idx; i++)
5344 /* Access the artifact */
5345 artifact_type *a_ptr = &a_info[i];
5347 /* Skip empty artifacts */
5348 if (!a_ptr->name) continue;
5350 /* Skip "uncreated" artifacts */
5351 if (!a_ptr->cur_num) continue;
5353 /* Check for race in the group */
5354 if (a_ptr->tval == group_tval)
5357 object_idx[object_cnt++] = i;
5361 /* Terminate the list */
5362 object_idx[object_cnt] = 0;
5364 /* Return the number of races */
5371 * Encode the screen colors
5373 static char hack[17] = "dwsorgbuDWvyRGBU";
5376 static errr photo_fgets(FILE *fff, char *buf, huge n)
5385 if (fgets(tmp, 1024, fff))
5387 /* Convert weirdness */
5388 for (s = tmp; *s; s++)
5390 /* Handle newline */
5401 else if (*s == '\t')
5403 /* Hack -- require room */
5404 if (i + 8 >= n) break;
5406 /* Append a space */
5409 /* Append some more spaces */
5410 while (!(i % 8)) buf[i++] = ' ';
5414 else if (iskanji(*s))
5421 /* Ⱦ³Ñ¤«¤Ê¤ËÂбþ */
5422 else if ((((int)*s & 0xff) > 0xa1) && (((int)*s & 0xff ) < 0xdf))
5429 /* Handle printables */
5450 * Hack -- load a screen dump from a file
5452 void do_cmd_load_screen(void)
5467 Term_get_size(&wid, &hgt);
5469 /* Build the filename */
5470 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
5472 /* Append to the file */
5473 fff = my_fopen(buf, "r");
5478 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
5480 msg_format("Failed to open %s.", buf);
5487 /* Save the screen */
5490 /* Clear the screen */
5494 /* Load the screen */
5495 for (y = 0; okay && (y < hgt); y++)
5497 /* Get a line of data */
5498 if (photo_fgets(fff, buf, 1024)) okay = FALSE;
5501 for (x = 0; x < wid - 1; x++)
5503 /* Put the attr/char */
5504 Term_draw(x, y, TERM_WHITE, buf[x]);
5508 /* Get the blank line */
5509 if (my_fgets(fff, buf, sizeof(buf))) okay = FALSE;
5512 /* Dump the screen */
5513 for (y = 0; okay && (y < hgt); y++)
5515 /* Get a line of data */
5516 if (photo_fgets(fff, buf, 1024)) okay = FALSE;
5519 for (x = 0; x < wid - 1; x++)
5521 /* Get the attr/char */
5522 (void)(Term_what(x, y, &a, &c));
5524 /* Look up the attr */
5525 for (i = 0; i < 16; i++)
5527 /* Use attr matches */
5528 if (hack[i] == buf[x]) a = i;
5531 /* Put the attr/char */
5532 Term_draw(x, y, a, c);
5537 /* Get the blank line */
5538 if (my_fgets(fff, buf, sizeof(buf))) okay = FALSE;
5547 prt("¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤µ¤ì¤¿²èÌÌ(µÇ°»£±Æ)¤ò¥í¡¼¥É¤·¤Þ¤·¤¿¡£", 0, 0);
5549 msg_print("Screen dump loaded.");
5556 /* Restore the screen */
5563 cptr inven_res_label =
5565 " »ÀÅŲÐÎäÆǸ÷°ÇÇ˹ì¹ö°øÆÙÎô ÌÕÉÝÍðáãÆ©Ì¿´¶¾ÃÉüÉâ";
5567 " AcElFiCoPoLiDkShSoNtNxCaDi BlFeCfFaSeHlEpSdRgLv";
5570 /* XTRA HACK RESLIST */
5571 static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr,
5572 int *j, byte tval, char *where)
5574 char o_name[MAX_NLEN];
5575 u32b flgs[TR_FLAG_SIZE];
5577 if (!o_ptr->k_idx)return;
5578 if (o_ptr->tval != tval)return;
5581 * HACK:Ring of Lordly protection and Dragon shield/helm
5582 * have random resistances.
5584 if ( ((o_ptr->tval >= TV_BOW && o_ptr->tval<= TV_DRAG_ARMOR && o_ptr->name2)
5585 || (o_ptr->tval == TV_RING && o_ptr->sval == SV_RING_LORDLY)
5586 || (o_ptr->tval == TV_SHIELD && o_ptr->sval == SV_DRAGON_SHIELD)
5587 || (o_ptr->tval == TV_HELM && o_ptr->sval == SV_DRAGON_HELM)
5588 || (o_ptr->tval == TV_GLOVES && o_ptr->sval == SV_SET_OF_DRAGON_GLOVES)
5589 || (o_ptr->tval == TV_BOOTS && o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE)
5590 || o_ptr->art_name || o_ptr->name1) && object_known_p(o_ptr))
5593 object_desc(o_name, o_ptr, TRUE, 0);
5595 while ( o_name[i] && i < 26 ){
5597 if (iskanji(o_name[i])) i++;
5601 if(i<28) while(i<28){o_name[i]=' ';i++;}
5604 fprintf(fff,"%s %s", where, o_name);
5606 if (!(o_ptr->ident & (IDENT_MENTAL)))
5609 fprintf(fff, "-------ÉÔÌÀ--------------- -------ÉÔÌÀ---------\n");
5611 fprintf(fff, "-------unknown------------ -------unknown------\n");
5615 object_flags_known(o_ptr, flgs);
5618 if (have_flag(flgs, TR_IM_ACID)) fprintf(fff,"¡ö");
5619 else if (have_flag(flgs, TR_RES_ACID)) fprintf(fff,"¡Ü");
5620 else fprintf(fff,"¡¦");
5622 if (have_flag(flgs, TR_IM_ELEC)) fprintf(fff,"¡ö");
5623 else if (have_flag(flgs, TR_RES_ELEC)) fprintf(fff,"¡Ü");
5624 else fprintf(fff,"¡¦");
5626 if (have_flag(flgs, TR_IM_FIRE)) fprintf(fff,"¡ö");
5627 else if (have_flag(flgs, TR_RES_FIRE)) fprintf(fff,"¡Ü");
5628 else fprintf(fff,"¡¦");
5630 if (have_flag(flgs, TR_IM_COLD)) fprintf(fff,"¡ö");
5631 else if (have_flag(flgs, TR_RES_COLD)) fprintf(fff,"¡Ü");
5632 else fprintf(fff,"¡¦");
5634 if (have_flag(flgs, TR_RES_POIS)) fprintf(fff,"¡Ü");
5635 else fprintf(fff,"¡¦");
5637 if (have_flag(flgs, TR_RES_LITE)) fprintf(fff,"¡Ü");
5638 else fprintf(fff,"¡¦");
5640 if (have_flag(flgs, TR_RES_DARK)) fprintf(fff,"¡Ü");
5641 else fprintf(fff,"¡¦");
5643 if (have_flag(flgs, TR_RES_SHARDS)) fprintf(fff,"¡Ü");
5644 else fprintf(fff,"¡¦");
5646 if (have_flag(flgs, TR_RES_SOUND)) fprintf(fff,"¡Ü");
5647 else fprintf(fff,"¡¦");
5649 if (have_flag(flgs, TR_RES_NETHER)) fprintf(fff,"¡Ü");
5650 else fprintf(fff,"¡¦");
5652 if (have_flag(flgs, TR_RES_NEXUS)) fprintf(fff,"¡Ü");
5653 else fprintf(fff,"¡¦");
5655 if (have_flag(flgs, TR_RES_CHAOS)) fprintf(fff,"¡Ü");
5656 else fprintf(fff,"¡¦");
5658 if (have_flag(flgs, TR_RES_DISEN)) fprintf(fff,"¡Ü");
5659 else fprintf(fff,"¡¦");
5663 if (have_flag(flgs, TR_RES_BLIND)) fprintf(fff,"¡Ü");
5664 else fprintf(fff,"¡¦");
5666 if (have_flag(flgs, TR_RES_FEAR)) fprintf(fff,"¡Ü");
5667 else fprintf(fff,"¡¦");
5669 if (have_flag(flgs, TR_RES_CONF)) fprintf(fff,"¡Ü");
5670 else fprintf(fff,"¡¦");
5672 if (have_flag(flgs, TR_FREE_ACT)) fprintf(fff,"¡Ü");
5673 else fprintf(fff,"¡¦");
5675 if (have_flag(flgs, TR_SEE_INVIS)) fprintf(fff,"¡Ü");
5676 else fprintf(fff,"¡¦");
5678 if (have_flag(flgs, TR_HOLD_LIFE)) fprintf(fff,"¡Ü");
5679 else fprintf(fff,"¡¦");
5681 if (have_flag(flgs, TR_TELEPATHY)) fprintf(fff,"¡Ü");
5682 else fprintf(fff,"¡¦");
5684 if (have_flag(flgs, TR_SLOW_DIGEST)) fprintf(fff,"¡Ü");
5685 else fprintf(fff,"¡¦");
5688 if (have_flag(flgs, TR_REGEN)) fprintf(fff,"¡Ü");
5689 else fprintf(fff,"¡¦");
5691 if (have_flag(flgs, TR_FEATHER)) fprintf(fff,"¡Ü");
5692 else fprintf(fff,"¡¦");
5694 if (have_flag(flgs, TR_IM_ACID)) fprintf(fff,"* ");
5695 else if (have_flag(flgs, TR_RES_ACID)) fprintf(fff,"+ ");
5696 else fprintf(fff,". ");
5698 if (have_flag(flgs, TR_IM_ELEC)) fprintf(fff,"* ");
5699 else if (have_flag(flgs, TR_RES_ELEC)) fprintf(fff,"+ ");
5700 else fprintf(fff,". ");
5702 if (have_flag(flgs, TR_IM_FIRE)) fprintf(fff,"* ");
5703 else if (have_flag(flgs, TR_RES_FIRE)) fprintf(fff,"+ ");
5704 else fprintf(fff,". ");
5706 if (have_flag(flgs, TR_IM_COLD)) fprintf(fff,"* ");
5707 else if (have_flag(flgs, TR_RES_COLD)) fprintf(fff,"+ ");
5708 else fprintf(fff,". ");
5710 if (have_flag(flgs, TR_RES_POIS)) fprintf(fff,"+ ");
5711 else fprintf(fff,". ");
5713 if (have_flag(flgs, TR_RES_LITE)) fprintf(fff,"+ ");
5714 else fprintf(fff,". ");
5716 if (have_flag(flgs, TR_RES_DARK)) fprintf(fff,"+ ");
5717 else fprintf(fff,". ");
5719 if (have_flag(flgs, TR_RES_SHARDS)) fprintf(fff,"+ ");
5720 else fprintf(fff,". ");
5722 if (have_flag(flgs, TR_RES_SOUND)) fprintf(fff,"+ ");
5723 else fprintf(fff,". ");
5725 if (have_flag(flgs, TR_RES_NETHER)) fprintf(fff,"+ ");
5726 else fprintf(fff,". ");
5728 if (have_flag(flgs, TR_RES_NEXUS)) fprintf(fff,"+ ");
5729 else fprintf(fff,". ");
5731 if (have_flag(flgs, TR_RES_CHAOS)) fprintf(fff,"+ ");
5732 else fprintf(fff,". ");
5734 if (have_flag(flgs, TR_RES_DISEN)) fprintf(fff,"+ ");
5735 else fprintf(fff,". ");
5739 if (have_flag(flgs, TR_RES_BLIND)) fprintf(fff,"+ ");
5740 else fprintf(fff,". ");
5742 if (have_flag(flgs, TR_RES_FEAR)) fprintf(fff,"+ ");
5743 else fprintf(fff,". ");
5745 if (have_flag(flgs, TR_RES_CONF)) fprintf(fff,"+ ");
5746 else fprintf(fff,". ");
5748 if (have_flag(flgs, TR_FREE_ACT)) fprintf(fff,"+ ");
5749 else fprintf(fff,". ");
5751 if (have_flag(flgs, TR_SEE_INVIS)) fprintf(fff,"+ ");
5752 else fprintf(fff,". ");
5754 if (have_flag(flgs, TR_HOLD_LIFE)) fprintf(fff,"+ ");
5755 else fprintf(fff,". ");
5757 if (have_flag(flgs, TR_TELEPATHY)) fprintf(fff,"+ ");
5758 else fprintf(fff,". ");
5760 if (have_flag(flgs, TR_SLOW_DIGEST)) fprintf(fff,"+ ");
5761 else fprintf(fff,". ");
5764 if (have_flag(flgs, TR_REGEN)) fprintf(fff,"+ ");
5765 else fprintf(fff,". ");
5767 if (have_flag(flgs, TR_FEATHER)) fprintf(fff,"+ ");
5768 else fprintf(fff,". ");
5776 fprintf(fff,"%s\n", inven_res_label);
5782 * Display *ID* ed weapons/armors's resistances
5784 static void do_cmd_knowledge_inven(void)
5789 char file_name[1024];
5800 /* Open a new file */
5801 fff = my_fopen_temp(file_name, 1024);
5804 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
5806 msg_format("Failed to create temporary file %s.", file_name);
5811 fprintf(fff,"%s\n",inven_res_label);
5813 for (tval=TV_BOW; tval <= TV_RING; tval++){
5816 for (;j<9;j++) fprintf(fff, "\n");
5818 fprintf(fff,"%s\n",inven_res_label);
5822 strcpy(where, "Áõ");
5824 strcpy(where, "E ");
5826 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
5828 o_ptr = &inventory[i];
5829 do_cmd_knowledge_inven_aux(fff, o_ptr, &j, tval, where);
5833 strcpy(where, "»ý");
5835 strcpy(where, "I ");
5837 for (i = 0; i < INVEN_PACK; i++)
5839 o_ptr = &inventory[i];
5840 do_cmd_knowledge_inven_aux(fff, o_ptr, &j, tval, where);
5844 /* Print all homes in the different towns */
5845 st_ptr = &town[1].store[STORE_HOME];
5847 strcpy(where, "²È");
5849 strcpy(where, "H ");
5852 /* Dump all available items */
5853 for (i = 0; i < st_ptr->stock_num; i++)
5855 o_ptr = &st_ptr->stock[i];
5856 do_cmd_knowledge_inven_aux(fff, o_ptr, &j, tval, where);
5860 /* Close the file */
5863 /* Display the file contents */
5865 show_file(TRUE, file_name, "*´ÕÄê*ºÑ¤ßÉð´ï/Ëɶñ¤ÎÂÑÀ¥ê¥¹¥È", 0, 0);
5867 show_file(TRUE, file_name, "Resistances of *identified* equipment", 0, 0);
5870 /* Remove the file */
5875 void do_cmd_save_screen_html_aux(char *filename, int message)
5879 byte a = 0, old_a = 0;
5893 cptr html_head[] = {
5894 "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
5898 cptr html_foot[] = {
5900 "</body>\n</html>\n",
5906 Term_get_size(&wid, &hgt);
5908 /* File type is "TEXT" */
5909 FILE_TYPE(FILE_TYPE_TEXT);
5911 /* Append to the file */
5912 fff = my_fopen(filename, "w");
5918 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", filename);
5920 msg_format("Failed to open file %s.", filename);
5928 /* Save the screen */
5932 /* Build the filename */
5933 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
5934 tmpfff = my_fopen(buf, "r");
5936 for (i = 0; html_head[i]; i++)
5937 fprintf(fff, html_head[i]);
5941 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
5943 if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
5947 if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
5949 fprintf(fff, "%s\n", buf);
5954 /* Dump the screen */
5955 for (y = 0; y < hgt; y++)
5962 for (x = 0; x < wid - 1; x++)
5966 /* Get the attr/char */
5967 (void)(Term_what(x, y, &a, &c));
5971 case '&': cc = "&"; break;
5972 case '<': cc = "<"; break;
5973 case '>': cc = ">"; break;
5975 case 0x1f: c = '.'; break;
5976 case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
5981 if ((y == 0 && x == 0) || a != old_a) {
5982 rv = angband_color_table[a][1];
5983 gv = angband_color_table[a][2];
5984 bv = angband_color_table[a][3];
5985 fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
5986 ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
5990 fprintf(fff, "%s", cc);
5992 fprintf(fff, "%c", c);
5995 fprintf(fff, "</font>");
5998 for (i = 0; html_foot[i]; i++)
5999 fprintf(fff, html_foot[i]);
6004 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
6006 if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
6010 if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
6012 fprintf(fff, "%s\n", buf);
6027 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6029 msg_print("Screen dump saved.");
6034 /* Restore the screen */
6040 * Hack -- save a screen dump to a file
6042 static void do_cmd_save_screen_html(void)
6044 char buf[1024], tmp[256] = "screen.html";
6047 if (!get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
6049 if (!get_string("File name: ", tmp, 80))
6053 /* Build the filename */
6054 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
6058 do_cmd_save_screen_html_aux(buf, 1);
6063 * Redefinable "save_screen" action
6065 void (*screendump_aux)(void) = NULL;
6069 * Hack -- save a screen dump to a file
6071 void do_cmd_save_screen(void)
6073 bool old_use_graphics = use_graphics;
6074 bool html_dump = FALSE;
6079 prt("µÇ°»£±Æ¤·¤Þ¤¹¤«¡© [(y)es/(h)tml/(n)o] ", 0, 0);
6081 prt("Save screen dump? [(y)es/(h)tml/(n)o] ", 0, 0);
6086 if (c == 'Y' || c == 'y')
6088 else if (c == 'H' || c == 'h')
6100 Term_get_size(&wid, &hgt);
6102 if (old_use_graphics)
6104 use_graphics = FALSE;
6107 /* Redraw everything */
6108 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6110 /* Hack -- update */
6116 do_cmd_save_screen_html();
6120 /* Do we use a special screendump function ? */
6121 else if (screendump_aux)
6123 /* Dump the screen to a graphics file */
6124 (*screendump_aux)();
6126 else /* Dump the screen as text */
6137 /* Build the filename */
6138 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
6140 /* File type is "TEXT" */
6141 FILE_TYPE(FILE_TYPE_TEXT);
6143 /* Append to the file */
6144 fff = my_fopen(buf, "w");
6150 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
6152 msg_format("Failed to open file %s.", buf);
6159 /* Save the screen */
6163 /* Dump the screen */
6164 for (y = 0; y < hgt; y++)
6167 for (x = 0; x < wid - 1; x++)
6169 /* Get the attr/char */
6170 (void)(Term_what(x, y, &a, &c));
6180 fprintf(fff, "%s\n", buf);
6187 /* Dump the screen */
6188 for (y = 0; y < hgt; y++)
6191 for (x = 0; x < wid - 1; x++)
6193 /* Get the attr/char */
6194 (void)(Term_what(x, y, &a, &c));
6197 buf[x] = hack[a&0x0F];
6204 fprintf(fff, "%s\n", buf);
6216 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6218 msg_print("Screen dump saved.");
6224 /* Restore the screen */
6228 if (old_use_graphics)
6230 use_graphics = TRUE;
6233 /* Redraw everything */
6234 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6236 /* Hack -- update */
6243 * Sorting hook -- Comp function -- see below
6245 * We use "u" to point to array of monster indexes,
6246 * and "v" to select the type of sorting to perform on "u".
6248 static bool ang_sort_art_comp(vptr u, vptr v, int a, int b)
6250 u16b *who = (u16b*)(u);
6252 u16b *why = (u16b*)(v);
6259 /* Sort by total kills */
6262 /* Extract total kills */
6263 z1 = a_info[w1].tval;
6264 z2 = a_info[w2].tval;
6266 /* Compare total kills */
6267 if (z1 < z2) return (TRUE);
6268 if (z1 > z2) return (FALSE);
6272 /* Sort by monster level */
6275 /* Extract levels */
6276 z1 = a_info[w1].sval;
6277 z2 = a_info[w2].sval;
6279 /* Compare levels */
6280 if (z1 < z2) return (TRUE);
6281 if (z1 > z2) return (FALSE);
6285 /* Sort by monster experience */
6288 /* Extract experience */
6289 z1 = a_info[w1].level;
6290 z2 = a_info[w2].level;
6292 /* Compare experience */
6293 if (z1 < z2) return (TRUE);
6294 if (z1 > z2) return (FALSE);
6298 /* Compare indexes */
6304 * Sorting hook -- Swap function -- see below
6306 * We use "u" to point to array of monster indexes,
6307 * and "v" to select the type of sorting to perform.
6309 static void ang_sort_art_swap(vptr u, vptr v, int a, int b)
6311 u16b *who = (u16b*)(u);
6326 * Check the status of "artifacts"
6328 static void do_cmd_knowledge_artifacts(void)
6330 int i, k, z, x, y, n = 0;
6336 char file_name[1024];
6338 char base_name[MAX_NLEN];
6342 /* Open a new file */
6343 fff = my_fopen_temp(file_name, 1024);
6347 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6349 msg_format("Failed to create temporary file %s.", file_name);
6355 /* Allocate the "who" array */
6356 C_MAKE(who, max_a_idx, s16b);
6358 /* Allocate the "okay" array */
6359 C_MAKE(okay, max_a_idx, bool);
6361 /* Scan the artifacts */
6362 for (k = 0; k < max_a_idx; k++)
6364 artifact_type *a_ptr = &a_info[k];
6369 /* Skip "empty" artifacts */
6370 if (!a_ptr->name) continue;
6372 /* Skip "uncreated" artifacts */
6373 if (!a_ptr->cur_num) continue;
6379 /* Check the dungeon */
6380 for (y = 0; y < cur_hgt; y++)
6382 for (x = 0; x < cur_wid; x++)
6384 cave_type *c_ptr = &cave[y][x];
6386 s16b this_o_idx, next_o_idx = 0;
6388 /* Scan all objects in the grid */
6389 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
6393 /* Acquire object */
6394 o_ptr = &o_list[this_o_idx];
6396 /* Acquire next object */
6397 next_o_idx = o_ptr->next_o_idx;
6399 /* Ignore non-artifacts */
6400 if (!artifact_p(o_ptr)) continue;
6402 /* Ignore known items */
6403 if (object_known_p(o_ptr)) continue;
6405 /* Note the artifact */
6406 okay[o_ptr->name1] = FALSE;
6411 /* Check the inventory and equipment */
6412 for (i = 0; i < INVEN_TOTAL; i++)
6414 object_type *o_ptr = &inventory[i];
6416 /* Ignore non-objects */
6417 if (!o_ptr->k_idx) continue;
6419 /* Ignore non-artifacts */
6420 if (!artifact_p(o_ptr)) continue;
6422 /* Ignore known items */
6423 if (object_known_p(o_ptr)) continue;
6425 /* Note the artifact */
6426 okay[o_ptr->name1] = FALSE;
6429 for (k = 0; k < max_a_idx; k++)
6431 if (okay[k]) who[n++] = k;
6434 /* Select the sort method */
6435 ang_sort_comp = ang_sort_art_comp;
6436 ang_sort_swap = ang_sort_art_swap;
6438 /* Sort the array by dungeon depth of monsters */
6439 ang_sort(who, &why, n);
6441 /* Scan the artifacts */
6442 for (k = 0; k < n; k++)
6444 artifact_type *a_ptr = &a_info[who[k]];
6448 strcpy(base_name, "̤ÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à");
6450 strcpy(base_name, "Unknown Artifact");
6454 /* Obtain the base object type */
6455 z = lookup_kind(a_ptr->tval, a_ptr->sval);
6463 /* Get local object */
6466 /* Create fake object */
6467 object_prep(q_ptr, z);
6469 /* Make it an artifact */
6470 q_ptr->name1 = (byte)who[k];
6472 /* Describe the artifact */
6473 object_desc_store(base_name, q_ptr, FALSE, 0);
6476 /* Hack -- Build the artifact name */
6478 fprintf(fff, " %s\n", base_name);
6480 fprintf(fff, " The %s\n", base_name);
6485 /* Free the "who" array */
6486 C_KILL(who, max_a_idx, s16b);
6488 /* Free the "okay" array */
6489 C_KILL(okay, max_a_idx, bool);
6491 /* Close the file */
6494 /* Display the file contents */
6496 show_file(TRUE, file_name, "´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à", 0, 0);
6498 show_file(TRUE, file_name, "Artifacts Seen", 0, 0);
6502 /* Remove the file */
6508 * Display known uniques
6510 static void do_cmd_knowledge_uniques(void)
6518 char file_name[1024];
6520 /* Open a new file */
6521 fff = my_fopen_temp(file_name, 1024);
6525 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6527 msg_format("Failed to create temporary file %s.", file_name);
6533 /* Allocate the "who" array */
6534 C_MAKE(who, max_r_idx, s16b);
6536 /* Scan the monsters */
6537 for (i = 1; i < max_r_idx; i++)
6539 monster_race *r_ptr = &r_info[i];
6541 /* Use that monster */
6542 if (r_ptr->name) who[n++] = i;
6545 /* Select the sort method */
6546 ang_sort_comp = ang_sort_comp_hook;
6547 ang_sort_swap = ang_sort_swap_hook;
6549 /* Sort the array by dungeon depth of monsters */
6550 ang_sort(who, &why, n);
6552 /* Scan the monster races */
6553 for (k = 0; k < n; k++)
6555 monster_race *r_ptr = &r_info[who[k]];
6557 /* Only print Uniques */
6558 if (r_ptr->flags1 & (RF1_UNIQUE))
6560 bool dead = (r_ptr->max_num == 0);
6564 /* Only display "known" uniques */
6565 if (dead || cheat_know || r_ptr->r_sights)
6567 /* Print a message */
6569 fprintf(fff, " %s¤Ï¤Þ¤ÀÀ¸¤¤Æ¤¤¤ë¡£\n",
6570 (r_name + r_ptr->name));
6572 fprintf(fff, " %s is alive\n",
6573 (r_name + r_ptr->name));
6580 /* Free the "who" array */
6581 C_KILL(who, max_r_idx, s16b);
6583 /* Close the file */
6586 /* Display the file contents */
6588 show_file(TRUE, file_name, "¤Þ¤ÀÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼", 0, 0);
6590 show_file(TRUE, file_name, "Alive Uniques", 0, 0);
6594 /* Remove the file */
6600 * Display weapon-exp
6602 static void do_cmd_knowledge_weapon_exp(void)
6604 int i, j, num, weapon_exp;
6608 char file_name[1024];
6611 /* Open a new file */
6612 fff = my_fopen_temp(file_name, 1024);
6615 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6617 msg_format("Failed to create temporary file %s.", file_name);
6623 for (i = 0; i < 5; i++)
6625 for (num = 0; num < 64; num++)
6627 for (j = 0; j < max_k_idx; j++)
6629 object_kind *k_ptr = &k_info[j];
6631 if ((k_ptr->tval == TV_SWORD - i) && (k_ptr->sval == num))
6633 if ((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON)) continue;
6635 weapon_exp = p_ptr->weapon_exp[4 - i][num];
6637 fprintf(fff, "%-25s ", tmp);
6638 if (weapon_exp >= s_info[p_ptr->pclass].w_max[4 - i][num]) fprintf(fff, "!");
6639 else fprintf(fff, " ");
6640 fprintf(fff, "%s", exp_level_str[weapon_exp_level(weapon_exp)]);
6641 if (cheat_xtra) fprintf(fff, " %d", weapon_exp);
6649 /* Close the file */
6652 /* Display the file contents */
6654 show_file(TRUE, file_name, "Éð´ï¤Î·Ð¸³ÃÍ", 0, 0);
6656 show_file(TRUE, file_name, "Weapon Proficiency", 0, 0);
6660 /* Remove the file */
6668 static void do_cmd_knowledge_spell_exp(void)
6670 int i = 0, spell_exp, exp_level;
6675 char file_name[1024];
6677 /* Open a new file */
6678 fff = my_fopen_temp(file_name, 1024);
6681 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6683 msg_format("Failed to create temporary file %s.", file_name);
6689 if (p_ptr->realm1 != REALM_NONE)
6692 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm1]);
6694 fprintf(fff, "%s Spellbook\n", realm_names[p_ptr->realm1]);
6696 for (i = 0; i < 32; i++)
6698 if (!is_magic(p_ptr->realm1))
6700 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][i];
6704 s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][i];
6706 if (s_ptr->slevel >= 99) continue;
6707 spell_exp = p_ptr->spell_exp[i];
6708 exp_level = spell_exp_level(spell_exp);
6709 fprintf(fff, "%-25s ", spell_names[technic2magic(p_ptr->realm1) - 1][i]);
6710 if (p_ptr->realm1 == REALM_HISSATSU)
6711 fprintf(fff, "[--]");
6714 if (exp_level >= EXP_LEVEL_MASTER) fprintf(fff, "!");
6715 else fprintf(fff, " ");
6716 fprintf(fff, "%s", exp_level_str[exp_level]);
6718 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6723 if (p_ptr->realm2 != REALM_NONE)
6726 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm2]);
6728 fprintf(fff, "\n%s Spellbook\n", realm_names[p_ptr->realm2]);
6730 for (i = 0; i < 32; i++)
6732 if (!is_magic(p_ptr->realm1))
6734 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][i];
6738 s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][i];
6740 if (s_ptr->slevel >= 99) continue;
6742 spell_exp = p_ptr->spell_exp[i + 32];
6743 exp_level = spell_exp_level(spell_exp);
6744 fprintf(fff, "%-25s ", spell_names[technic2magic(p_ptr->realm2) - 1][i]);
6745 if (exp_level >= EXP_LEVEL_EXPERT) fprintf(fff, "!");
6746 else fprintf(fff, " ");
6747 fprintf(fff, "%s", exp_level_str[exp_level]);
6748 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6753 /* Close the file */
6756 /* Display the file contents */
6758 show_file(TRUE, file_name, "ËâË¡¤Î·Ð¸³ÃÍ", 0, 0);
6760 show_file(TRUE, file_name, "Spell Proficiency", 0, 0);
6764 /* Remove the file */
6772 static void do_cmd_knowledge_skill_exp(void)
6774 int i = 0, skill_exp;
6778 char file_name[1024];
6780 char skill_name[3][17]={"¥Þ¡¼¥·¥ã¥ë¥¢¡¼¥Ä", "ÆóÅáή ", "¾èÇÏ "};
6782 char skill_name[3][20]={"Martial Arts ", "Dual Wielding ", "Riding "};
6785 /* Open a new file */
6786 fff = my_fopen_temp(file_name, 1024);
6789 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6791 msg_format("Failed to create temporary file %s.", file_name);
6797 for (i = 0; i < 3; i++)
6799 skill_exp = p_ptr->skill_exp[i];
6800 fprintf(fff, "%-20s ", skill_name[i]);
6801 if (skill_exp >= s_info[p_ptr->pclass].s_max[i]) fprintf(fff, "!");
6802 else fprintf(fff, " ");
6803 fprintf(fff, "%s", exp_level_str[(i == GINOU_RIDING) ? riding_exp_level(skill_exp) : weapon_exp_level(skill_exp)]);
6804 if (cheat_xtra) fprintf(fff, " %d", skill_exp);
6808 /* Close the file */
6811 /* Display the file contents */
6813 show_file(TRUE, file_name, "µ»Ç½¤Î·Ð¸³ÃÍ", 0, 0);
6815 show_file(TRUE, file_name, "Miscellaneous Proficiency", 0, 0);
6819 /* Remove the file */
6825 * Pluralize a monster name
6827 void plural_aux(char *Name)
6829 int NameLen = strlen(Name);
6831 if (strstr(Name, "Disembodied hand"))
6833 strcpy(Name, "Disembodied hands that strangled people");
6835 else if (strstr(Name, "Colour out of space"))
6837 strcpy(Name, "Colours out of space");
6839 else if (strstr(Name, "stairway to hell"))
6841 strcpy(Name, "stairways to hell");
6843 else if (strstr(Name, "Dweller on the threshold"))
6845 strcpy(Name, "Dwellers on the threshold");
6847 else if (strstr(Name, " of "))
6849 cptr aider = strstr(Name, " of ");
6860 if (dummy[i-1] == 's')
6862 strcpy(&(dummy[i]), "es");
6867 strcpy(&(dummy[i]), "s");
6870 strcpy(&(dummy[i+1]), aider);
6871 strcpy(Name, dummy);
6873 else if (strstr(Name, "coins"))
6876 strcpy(dummy, "piles of ");
6877 strcat(dummy, Name);
6878 strcpy(Name, dummy);
6881 else if (strstr(Name, "Manes"))
6885 else if (streq(&(Name[NameLen - 2]), "ey"))
6887 strcpy(&(Name[NameLen - 2]), "eys");
6889 else if (Name[NameLen - 1] == 'y')
6891 strcpy(&(Name[NameLen - 1]), "ies");
6893 else if (streq(&(Name[NameLen - 4]), "ouse"))
6895 strcpy(&(Name[NameLen - 4]), "ice");
6897 else if (streq(&(Name[NameLen - 2]), "us"))
6899 strcpy(&(Name[NameLen - 2]), "i");
6901 else if (streq(&(Name[NameLen - 6]), "kelman"))
6903 strcpy(&(Name[NameLen - 6]), "kelmen");
6905 else if (streq(&(Name[NameLen - 8]), "wordsman"))
6907 strcpy(&(Name[NameLen - 8]), "wordsmen");
6909 else if (streq(&(Name[NameLen - 7]), "oodsman"))
6911 strcpy(&(Name[NameLen - 7]), "oodsmen");
6913 else if (streq(&(Name[NameLen - 7]), "eastman"))
6915 strcpy(&(Name[NameLen - 7]), "eastmen");
6917 else if (streq(&(Name[NameLen - 8]), "izardman"))
6919 strcpy(&(Name[NameLen - 8]), "izardmen");
6921 else if (streq(&(Name[NameLen - 5]), "geist"))
6923 strcpy(&(Name[NameLen - 5]), "geister");
6925 else if (streq(&(Name[NameLen - 2]), "ex"))
6927 strcpy(&(Name[NameLen - 2]), "ices");
6929 else if (streq(&(Name[NameLen - 2]), "lf"))
6931 strcpy(&(Name[NameLen - 2]), "lves");
6933 else if (suffix(Name, "ch") ||
6934 suffix(Name, "sh") ||
6935 suffix(Name, "nx") ||
6936 suffix(Name, "s") ||
6939 strcpy(&(Name[NameLen]), "es");
6943 strcpy(&(Name[NameLen]), "s");
6948 * Display current pets
6950 static void do_cmd_knowledge_pets(void)
6954 monster_type *m_ptr;
6956 int show_upkeep = 0;
6957 char file_name[1024];
6960 /* Open a new file */
6961 fff = my_fopen_temp(file_name, 1024);
6964 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6966 msg_format("Failed to create temporary file %s.", file_name);
6972 /* Process the monsters (backwards) */
6973 for (i = m_max - 1; i >= 1; i--)
6975 monster_race *r_ptr;
6976 /* Access the monster */
6979 /* Ignore "dead" monsters */
6980 if (!m_ptr->r_idx) continue;
6981 r_ptr = &r_info[m_ptr->r_idx];
6983 /* Calculate "upkeep" for pets */
6988 monster_desc(pet_name, m_ptr, 0x88);
6989 fprintf(fff, "%s (%s)", pet_name, look_mon_desc(i, 0x00));
6990 if (p_ptr->riding == i)
6992 fprintf(fff, " ¾èÇÏÃæ");
6994 fprintf(fff, " Riding");
7000 show_upkeep = calculate_upkeep();
7002 fprintf(fff, "----------------------------------------------\n");
7004 fprintf(fff, " ¹ç·×: %d ɤ¤Î¥Ú¥Ã¥È\n", t_friends);
7005 fprintf(fff, " °Ý»ý¥³¥¹¥È: %d%% MP\n", show_upkeep);
7007 fprintf(fff, " Total: %d pet%s.\n",
7008 t_friends, (t_friends == 1 ? "" : "s"));
7009 fprintf(fff, " Upkeep: %d%% mana.\n", show_upkeep);
7014 /* Close the file */
7017 /* Display the file contents */
7019 show_file(TRUE, file_name, "¸½ºß¤Î¥Ú¥Ã¥È", 0, 0);
7021 show_file(TRUE, file_name, "Current Pets", 0, 0);
7025 /* Remove the file */
7033 * Note that the player ghosts are ignored. XXX XXX XXX
7035 static void do_cmd_knowledge_kill_count(void)
7043 char file_name[1024];
7048 /* Open a new file */
7049 fff = my_fopen_temp(file_name, 1024);
7053 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7055 msg_format("Failed to create temporary file %s.", file_name);
7061 /* Allocate the "who" array */
7062 C_MAKE(who, max_r_idx, s16b);
7065 /* Monsters slain */
7068 for (kk = 1; kk < max_r_idx; kk++)
7070 monster_race *r_ptr = &r_info[kk];
7072 if (r_ptr->flags1 & (RF1_UNIQUE))
7074 bool dead = (r_ptr->max_num == 0);
7083 s16b This = r_ptr->r_pkills;
7094 fprintf(fff,"¤¢¤Ê¤¿¤Ï¤Þ¤ÀŨ¤òÅݤ·¤Æ¤¤¤Ê¤¤¡£\n\n");
7096 fprintf(fff,"You have defeated no enemies yet.\n\n");
7099 else if (Total == 1)
7101 fprintf(fff,"¤¢¤Ê¤¿¤Ï°ìɤ¤ÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n");
7103 fprintf(fff,"You have defeated one enemy.\n\n");
7108 fprintf(fff,"¤¢¤Ê¤¿¤Ï %lu ɤ¤ÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n", Total);
7110 fprintf(fff,"You have defeated %lu enemies.\n\n", Total);
7117 /* Scan the monsters */
7118 for (i = 1; i < max_r_idx; i++)
7120 monster_race *r_ptr = &r_info[i];
7122 /* Use that monster */
7123 if (r_ptr->name) who[n++] = i;
7126 /* Select the sort method */
7127 ang_sort_comp = ang_sort_comp_hook;
7128 ang_sort_swap = ang_sort_swap_hook;
7130 /* Sort the array by dungeon depth of monsters */
7131 ang_sort(who, &why, n);
7133 /* Scan the monster races */
7134 for (k = 0; k < n; k++)
7136 monster_race *r_ptr = &r_info[who[k]];
7138 if (r_ptr->flags1 & (RF1_UNIQUE))
7140 bool dead = (r_ptr->max_num == 0);
7144 /* Print a message */
7145 fprintf(fff, " %s\n",
7146 (r_name + r_ptr->name));
7152 s16b This = r_ptr->r_pkills;
7157 /* p,t¤Ï¿Í¤È¿ô¤¨¤ë by ita*/
7158 if(strchr("pt",r_ptr->d_char))
7159 fprintf(fff, " %3d ¿Í¤Î %s\n", This, r_name + r_ptr->name);
7161 fprintf(fff, " %3d ɤ¤Î %s\n", This, r_name + r_ptr->name);
7165 if (strstr(r_name + r_ptr->name, "coins"))
7167 fprintf(fff, " 1 pile of %s\n", (r_name + r_ptr->name));
7171 fprintf(fff, " 1 %s\n", (r_name + r_ptr->name));
7177 strcpy(ToPlural, (r_name + r_ptr->name));
7178 plural_aux(ToPlural);
7179 fprintf(fff, " %d %s\n", This, ToPlural);
7189 fprintf(fff,"----------------------------------------------\n");
7191 fprintf(fff," ¹ç·×: %lu ɤ¤òÅݤ·¤¿¡£\n", Total);
7193 fprintf(fff," Total: %lu creature%s killed.\n",
7194 Total, (Total == 1 ? "" : "s"));
7198 /* Free the "who" array */
7199 C_KILL(who, max_r_idx, s16b);
7201 /* Close the file */
7204 /* Display the file contents */
7206 show_file(TRUE, file_name, "Åݤ·¤¿Å¨¤Î¿ô", 0, 0);
7208 show_file(TRUE, file_name, "Kill Count", 0, 0);
7212 /* Remove the file */
7218 * Display the object groups.
7220 static void display_group_list(int col, int row, int wid, int per_page,
7221 int grp_idx[], cptr group_text[], int grp_cur, int grp_top)
7225 /* Display lines until done */
7226 for (i = 0; i < per_page && (grp_idx[i] >= 0); i++)
7228 /* Get the group index */
7229 int grp = grp_idx[grp_top + i];
7231 /* Choose a color */
7232 byte attr = (grp_top + i == grp_cur) ? TERM_L_BLUE : TERM_WHITE;
7234 /* Erase the entire line */
7235 Term_erase(col, row + i, wid);
7237 /* Display the group label */
7238 c_put_str(attr, group_text[grp], row + i, col);
7244 * Move the cursor in a browser window
7246 static void browser_cursor(char ch, int *column, int *grp_cur, int grp_cnt,
7247 int *list_cur, int list_cnt)
7252 int list = *list_cur;
7254 /* Extract direction */
7257 /* Hack -- scroll up full screen */
7262 /* Hack -- scroll down full screen */
7267 d = get_keymap_dir(ch);
7272 /* Diagonals - hack */
7273 if ((ddx[d] > 0) && ddy[d])
7279 Term_get_size(&wid, &hgt);
7281 browser_rows = hgt - 8;
7283 /* Browse group list */
7288 /* Move up or down */
7289 grp += ddy[d] * (browser_rows - 1);
7292 if (grp >= grp_cnt) grp = grp_cnt - 1;
7293 if (grp < 0) grp = 0;
7294 if (grp != old_grp) list = 0;
7297 /* Browse sub-list list */
7300 /* Move up or down */
7301 list += ddy[d] * browser_rows;
7304 if (list >= list_cnt) list = list_cnt - 1;
7305 if (list < 0) list = 0;
7317 if (col < 0) col = 0;
7318 if (col > 1) col = 1;
7325 /* Browse group list */
7330 /* Move up or down */
7334 if (grp >= grp_cnt) grp = grp_cnt - 1;
7335 if (grp < 0) grp = 0;
7336 if (grp != old_grp) list = 0;
7339 /* Browse sub-list list */
7342 /* Move up or down */
7346 if (list >= list_cnt) list = list_cnt - 1;
7347 if (list < 0) list = 0;
7358 static void display_visual_list(int col, int row, int height, int width, byte attr_top, byte char_left)
7362 /* Clear the display lines */
7363 for (i = 0; i < height; i++)
7365 Term_erase(col, row + i, width);
7368 /* Bigtile mode uses double width */
7369 if (use_bigtile) width /= 2;
7371 /* Display lines until done */
7372 for (i = 0; i < height; i++)
7374 /* Display columns until done */
7375 for (j = 0; j < width; j++)
7383 /* Bigtile mode uses double width */
7384 if (use_bigtile) x += j;
7389 /* Ignore illegal characters */
7390 if (ia > 0x7f || ic > 0xff || ic < ' ' ||
7391 (!use_graphics && ic > 0x7f))
7397 /* Force correct code for both ASCII character and tile */
7398 if (c & 0x80) a |= 0x80;
7400 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
7402 /* Display symbol */
7403 Term_putch(x, y, a, c);
7406 if (use_bigtile) Term_putch(x + 1, y, a2, c2);
7413 * Place the cursor at the collect position for visual mode
7415 static void place_visual_list_cursor(int col, int row, byte a, byte c, byte attr_top, byte char_left)
7417 int i = (a & 0x7f) - attr_top;
7418 int j = c - char_left;
7423 /* Bigtile mode uses double width */
7424 if (use_bigtile) x += j;
7426 /* Place the cursor */
7432 * Clipboard variables for copy&paste in visual mode
7434 static byte attr_idx = 0;
7435 static byte char_idx = 0;
7438 * Do visual mode command -- Change symbols
7440 static bool visual_mode_command(char ch, bool *visual_list_ptr,
7441 int height, int width,
7442 byte *attr_top_ptr, byte *char_left_ptr,
7443 byte *cur_attr_ptr, byte *cur_char_ptr)
7445 static byte attr_old = 0, char_old = 0;
7450 if (*visual_list_ptr)
7453 *cur_attr_ptr = attr_old;
7454 *cur_char_ptr = char_old;
7455 *visual_list_ptr = FALSE;
7464 if (*visual_list_ptr)
7467 *visual_list_ptr = FALSE;
7475 if (!*visual_list_ptr)
7477 *visual_list_ptr = TRUE;
7479 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7480 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7482 attr_old = *cur_attr_ptr;
7483 char_old = *cur_char_ptr;
7491 /* Set the visual */
7492 attr_idx = *cur_attr_ptr;
7493 char_idx = *cur_char_ptr;
7502 *cur_attr_ptr = attr_idx;
7503 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7509 *cur_char_ptr = char_idx;
7510 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7516 if (*visual_list_ptr)
7519 int d = get_keymap_dir(ch);
7520 byte a = (*cur_attr_ptr & 0x7f);
7521 byte c = *cur_char_ptr;
7523 if (use_bigtile) eff_width = width / 2;
7524 else eff_width = width;
7526 /* Restrict direction */
7527 if ((a == 0) && (ddy[d] < 0)) d = 0;
7528 if ((c == 0) && (ddx[d] < 0)) d = 0;
7529 if ((a == 0x7f) && (ddy[d] > 0)) d = 0;
7530 if ((c == 0xff) && (ddx[d] > 0)) d = 0;
7535 /* Force correct code for both ASCII character and tile */
7536 if (c & 0x80) a |= 0x80;
7538 /* Set the visual */
7543 /* Move the frame */
7544 if ((ddx[d] < 0) && *char_left_ptr > MAX(0, (int)c - 10)) (*char_left_ptr)--;
7545 if ((ddx[d] > 0) && *char_left_ptr + eff_width < MIN(0xff, (int)c + 10)) (*char_left_ptr)++;
7546 if ((ddy[d] < 0) && *attr_top_ptr > MAX(0, (int)(a & 0x7f) - 4)) (*attr_top_ptr)--;
7547 if ((ddy[d] > 0) && *attr_top_ptr + height < MIN(0x7f, (a & 0x7f) + 4)) (*attr_top_ptr)++;
7554 /* Visual mode command is not used */
7560 * Display the monsters in a group.
7562 static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
7563 int mon_cur, int mon_top)
7567 /* Display lines until done */
7568 for (i = 0; i < per_page && mon_idx[mon_top + i]; i++)
7574 /* Get the race index */
7575 int r_idx = mon_idx[mon_top + i] ;
7577 /* Access the race */
7578 monster_race *r_ptr = &r_info[r_idx];
7581 /* Choose a color */
7582 attr = ((i + mon_top == mon_cur) ? TERM_L_BLUE : TERM_WHITE);
7584 /* Display the name */
7585 c_prt(attr, (r_name + r_ptr->name), row + i, col);
7587 /* Hack -- visual_list mode */
7590 c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, 60);
7592 else if (p_ptr->wizard)
7594 c_prt(attr, format("%d", r_idx), row + i, 60);
7599 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
7601 /* Display symbol */
7602 Term_putch(70, row + i, a, c);
7605 if (use_bigtile) Term_putch(70 + 1, row + i, a2, c2);
7608 if (!(r_ptr->flags1 & RF1_UNIQUE)) put_str(format("%5d", r_ptr->r_pkills), row + i, 73);
7610 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? "»àË´" : "À¸Â¸"), row + i, 73);
7612 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? "dead" : "alive"), row + i, 73);
7617 /* Clear remaining lines */
7618 for (; i < per_page; i++)
7620 Term_erase(col, row + i, 255);
7626 * Display known monsters.
7628 static void do_cmd_knowledge_monsters(void)
7631 int grp_cur, grp_top, old_grp_cur;
7632 int mon_cur, mon_top;
7633 int grp_cnt, grp_idx[100];
7641 bool visual_list = FALSE;
7642 byte attr_top = 0, char_left = 0;
7648 Term_get_size(&wid, &hgt);
7650 browser_rows = hgt - 8;
7652 /* Allocate the "mon_idx" array */
7653 C_MAKE(mon_idx, max_r_idx, s16b);
7658 /* Check every group */
7659 for (i = 0; monster_group_text[i] != NULL; i++)
7661 /* Measure the label */
7662 len = strlen(monster_group_text[i]);
7664 /* Save the maximum length */
7665 if (len > max) max = len;
7667 /* See if any monsters are known */
7668 if ((monster_group_char[i] == ((char *) -1L)) || collect_monsters(i, mon_idx, 0x01))
7670 /* Build a list of groups with known monsters */
7671 grp_idx[grp_cnt++] = i;
7675 /* Terminate the list */
7676 grp_idx[grp_cnt] = -1;
7679 grp_cur = grp_top = 0;
7680 mon_cur = mon_top = 0;
7689 monster_race *r_ptr;
7696 prt("Ãμ± - ¥â¥ó¥¹¥¿¡¼", 2, 0);
7697 prt("¥°¥ë¡¼¥×", 4, 0);
7698 prt("̾Á°", 4, max + 3);
7699 if (p_ptr->wizard) prt("Idx", 4, 60);
7700 prt("ʸ»ú »¦³²¿ô", 4, 67);
7702 prt("Knowledge - Monsters", 2, 0);
7704 prt("Name", 4, max + 3);
7705 if (p_ptr->wizard) prt("Idx", 4, 60);
7706 prt("Sym Kills", 4, 67);
7709 for (i = 0; i < 78; i++)
7711 Term_putch(i, 5, TERM_WHITE, '=');
7714 for (i = 0; i < browser_rows; i++)
7716 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7722 /* Scroll group list */
7723 if (grp_cur < grp_top) grp_top = grp_cur;
7724 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7726 /* Display a list of monster groups */
7727 display_group_list(0, 6, max, browser_rows, grp_idx, monster_group_text, grp_cur, grp_top);
7729 if (old_grp_cur != grp_cur)
7731 old_grp_cur = grp_cur;
7733 /* Get a list of monsters in the current group */
7734 mon_cnt = collect_monsters(grp_idx[grp_cur], mon_idx, 0x00);
7737 /* Scroll monster list */
7738 while (mon_cur < mon_top)
7739 mon_top = MAX(0, mon_top - browser_rows/2);
7740 while (mon_cur >= mon_top + browser_rows)
7741 mon_top = MIN(mon_cnt - browser_rows, mon_top + browser_rows/2);
7745 /* Display a list of monsters in the current group */
7746 display_monster_list(max + 3, 6, browser_rows, mon_idx, mon_cur, mon_top);
7752 /* Display a monster name */
7753 display_monster_list(max + 3, 6, 1, mon_idx, mon_cur, mon_top);
7755 /* Display visual list below first monster */
7756 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7761 prt(format("<Êý¸þ>, 'r'¤Ç»×¤¤½Ð¤ò¸«¤ë%s%s, ESC", visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹", (attr_idx||char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"), hgt - 1, 0);
7763 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);
7766 /* Get the current monster */
7767 r_ptr = &r_info[mon_idx[mon_cur]];
7769 /* Mega Hack -- track this monster race */
7770 if (mon_cnt) monster_race_track(mon_idx[mon_cur]);
7772 /* Hack -- handle stuff */
7777 place_visual_list_cursor(max + 3, 7, r_ptr->x_attr, r_ptr->x_char, attr_top, char_left);
7781 Term_gotoxy(0, 6 + (grp_cur - grp_top));
7785 Term_gotoxy(max + 3, 6 + (mon_cur - mon_top));
7790 /* Do visual mode command if needed */
7791 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;
7804 /* Recall on screen */
7805 if (mon_idx[mon_cur])
7807 screen_roff(mon_idx[mon_cur], 0);
7818 /* Move the cursor */
7819 browser_cursor(ch, &column, &grp_cur, grp_cnt, &mon_cur, mon_cnt);
7826 /* Free the "mon_idx" array */
7827 C_KILL(mon_idx, max_r_idx, s16b);
7832 * Display the objects in a group.
7834 static void display_object_list(int col, int row, int per_page, int object_idx[],
7835 int object_cur, int object_top)
7839 /* Display lines until done */
7840 for (i = 0; i < per_page && object_idx[object_top + i]; i++)
7846 /* Get the object index */
7847 int k_idx = object_idx[object_top + i];
7849 /* Access the object */
7850 object_kind *k_ptr = &k_info[k_idx];
7852 /* Choose a color */
7853 byte attr = (k_ptr->aware ? TERM_WHITE : TERM_SLATE);
7854 byte cursor = (k_ptr->aware ? TERM_L_BLUE : TERM_BLUE);
7856 attr = ((i + object_top == object_cur) ? cursor : attr);
7859 strip_name(o_name, k_idx);
7861 /* Display the name */
7862 c_prt(attr, o_name, row + i, col);
7864 /* Hack -- visual_list mode */
7867 c_prt(attr, format("%02x/%02x", k_ptr->x_attr, k_ptr->x_char), row + i, 60);
7869 else if (p_ptr->wizard)
7871 c_prt(attr, format ("%d", k_idx), row + i, 70);
7874 a = k_ptr->flavor ? misc_to_attr[k_ptr->flavor] : k_ptr->x_attr;
7875 c = k_ptr->flavor ? misc_to_char[k_ptr->flavor] : k_ptr->x_char;
7877 /* Symbol is unknown */
7878 if (!k_ptr->aware && !p_ptr->wizard)
7884 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
7886 /* Display symbol */
7887 Term_putch(76, row + i, a, c);
7890 if (use_bigtile) Term_putch(76 + 1, row + i, a2, c2);
7893 /* Clear remaining lines */
7894 for (; i < per_page; i++)
7896 Term_erase(col, row + i, 255);
7901 * Describe fake object
7903 static void desc_obj_fake(int k_idx)
7906 object_type object_type_body;
7908 /* Get local object */
7909 o_ptr = &object_type_body;
7911 /* Wipe the object */
7914 /* Create the artifact */
7915 object_prep(o_ptr, k_idx);
7917 /* It's fully know */
7918 o_ptr->ident |= IDENT_KNOWN;
7920 /* Track the object */
7921 /* object_actual_track(o_ptr); */
7923 /* Hack - mark as fake */
7924 /* term_obj_real = FALSE; */
7926 /* Hack -- Handle stuff */
7929 if (!screen_object(o_ptr, FALSE))
7932 msg_print("ÆäËÊѤï¤Ã¤¿¤È¤³¤í¤Ï¤Ê¤¤¤è¤¦¤À¡£");
7934 msg_print("You see nothing special.");
7943 * Display known objects
7945 static void do_cmd_knowledge_objects(void)
7948 int grp_cur, grp_top, old_grp_cur;
7949 int object_old, object_cur, object_top;
7950 int grp_cnt, grp_idx[100];
7958 bool visual_list = FALSE;
7959 byte attr_top = 0, char_left = 0;
7965 Term_get_size(&wid, &hgt);
7967 browser_rows = hgt - 8;
7969 /* Allocate the "object_idx" array */
7970 C_MAKE(object_idx, max_k_idx, int);
7975 /* Check every group */
7976 for (i = 0; object_group_text[i] != NULL; i++)
7978 /* Measure the label */
7979 len = strlen(object_group_text[i]);
7981 /* Save the maximum length */
7982 if (len > max) max = len;
7984 /* See if any monsters are known */
7985 if (collect_objects(i, object_idx))
7987 /* Build a list of groups with known monsters */
7988 grp_idx[grp_cnt++] = i;
7992 /* Terminate the list */
7993 grp_idx[grp_cnt] = -1;
7996 grp_cur = grp_top = 0;
7997 object_cur = object_top = 0;
8014 prt("Ãμ± - ¥¢¥¤¥Æ¥à", 2, 0);
8015 prt("¥°¥ë¡¼¥×", 4, 0);
8016 prt("̾Á°", 4, max + 3);
8017 if (p_ptr->wizard) prt("Idx", 4, 70);
8020 prt("Knowledge - objects", 2, 0);
8022 prt("Name", 4, max + 3);
8023 if (p_ptr->wizard) prt("Idx", 4, 70);
8027 for (i = 0; i < 78; i++)
8029 Term_putch(i, 5, TERM_WHITE, '=');
8032 for (i = 0; i < browser_rows; i++)
8034 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8040 /* Scroll group list */
8041 if (grp_cur < grp_top) grp_top = grp_cur;
8042 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8044 /* Display a list of object groups */
8045 display_group_list(0, 6, max, browser_rows, grp_idx, object_group_text, grp_cur, grp_top);
8047 if (old_grp_cur != grp_cur)
8049 old_grp_cur = grp_cur;
8051 /* Get a list of objects in the current group */
8052 object_cnt = collect_objects(grp_idx[grp_cur], object_idx);
8055 /* Scroll object list */
8056 while (object_cur < object_top)
8057 object_top = MAX(0, object_top - browser_rows/2);
8058 while (object_cur >= object_top + browser_rows)
8059 object_top = MIN(object_cnt - browser_rows, object_top + browser_rows/2);
8063 /* Display a list of objects in the current group */
8064 display_object_list(max + 3, 6, browser_rows, object_idx, object_cur, object_top);
8068 object_top = object_cur;
8070 /* Display a list of objects in the current group */
8071 display_object_list(max + 3, 6, 1, object_idx, object_cur, object_top);
8073 /* Display visual list below first object */
8074 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8077 /* Get the current object */
8078 k_ptr = &k_info[object_idx[object_cur]];
8080 /* Mega Hack -- track this object */
8081 if (object_cnt) object_kind_track(object_idx[object_cur]);
8085 prt(format("<Êý¸þ>, 'r'¤Ç»×¤¤½Ð¤ò¸«¤ë%s%s, ESC", k_ptr->flavor ? "" : visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹", (attr_idx||char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"), hgt - 1, 0);
8087 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);
8090 /* The "current" object changed */
8091 if (object_old != object_idx[object_cur])
8093 /* Hack -- handle stuff */
8096 /* Remember the "current" object */
8097 object_old = object_idx[object_cur];
8102 place_visual_list_cursor(max + 3, 7, k_ptr->x_attr, k_ptr->x_char, attr_top, char_left);
8106 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8110 Term_gotoxy(max + 3, 6 + (object_cur - object_top));
8115 /* Do visual mode command if needed */
8116 /* Symbol of objects with flavor cannot be changed */
8117 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;
8130 /* Recall on screen */
8132 desc_obj_fake(object_idx[object_cur]);
8140 /* Move the cursor */
8141 browser_cursor(ch, &column, &grp_cur, grp_cnt, &object_cur, object_cnt);
8147 /* Free the "object_idx" array */
8148 C_KILL(object_idx, max_k_idx, int);
8154 * Display the features in a group.
8156 static void display_feature_list(int col, int row, int per_page, int *feat_idx,
8157 int feat_cur, int feat_top)
8161 /* Display lines until done */
8162 for (i = 0; i < per_page && feat_idx[feat_top + i]; i++)
8169 int f_idx = feat_idx[feat_top + i];
8171 /* Access the index */
8172 feature_type *f_ptr = &f_info[f_idx];
8174 /* Choose a color */
8175 attr = ((i + feat_top == feat_cur) ? TERM_L_BLUE : TERM_WHITE);
8177 /* Display the name */
8178 c_prt(attr, f_name + f_ptr->name, row + i, col);
8180 /* Hack -- visual_list mode */
8183 c_prt(attr, format("%02x/%02x", f_ptr->x_attr, f_ptr->x_char), row + i, 60);
8189 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
8191 /* Display symbol */
8192 Term_putch(68, row + i, a, c);
8195 if (use_bigtile) Term_putch(68 + 1, row + i, a2, c2);
8198 /* Clear remaining lines */
8199 for (; i < per_page; i++)
8201 Term_erase(col, row + i, 255);
8207 * Interact with feature visuals.
8209 static void do_cmd_knowledge_features(void)
8212 int grp_cur, grp_top, old_grp_cur;
8213 int feat_cur, feat_top;
8214 int grp_cnt, grp_idx[100];
8222 bool visual_list = FALSE;
8223 byte attr_top = 0, char_left = 0;
8229 Term_get_size(&wid, &hgt);
8231 browser_rows = hgt - 8;
8233 /* Allocate the "feat_idx" array */
8234 C_MAKE(feat_idx, max_f_idx, int);
8239 /* Check every group */
8240 for (i = 0; feature_group_text[i] != NULL; i++)
8242 /* Measure the label */
8243 len = strlen(feature_group_text[i]);
8245 /* Save the maximum length */
8246 if (len > max) max = len;
8248 /* See if any features are known */
8249 if (collect_features(i, feat_idx))
8251 /* Build a list of groups with known features */
8252 grp_idx[grp_cnt++] = i;
8256 /* Terminate the list */
8257 grp_idx[grp_cnt] = -1;
8260 grp_cur = grp_top = 0;
8261 feat_cur = feat_top = 0;
8267 while ((!flag) && (grp_cnt))
8270 feature_type *f_ptr;
8276 prt("Visuals - features", 2, 0);
8278 prt("Name", 4, max + 3);
8281 for (i = 0; i < 78; i++)
8283 Term_putch(i, 5, TERM_WHITE, '=');
8286 for (i = 0; i < browser_rows; i++)
8288 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8294 /* Scroll group list */
8295 if (grp_cur < grp_top) grp_top = grp_cur;
8296 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8298 /* Display a list of feature groups */
8299 display_group_list(0, 6, max, browser_rows, grp_idx, feature_group_text, grp_cur, grp_top);
8301 if (old_grp_cur != grp_cur)
8303 old_grp_cur = grp_cur;
8305 /* Get a list of features in the current group */
8306 feat_cnt = collect_features(grp_idx[grp_cur], feat_idx);
8309 /* Scroll feature list */
8310 while (feat_cur < feat_top)
8311 feat_top = MAX(0, feat_top - browser_rows/2);
8312 while (feat_cur >= feat_top + browser_rows)
8313 feat_top = MIN(feat_cnt - browser_rows, feat_top + browser_rows/2);
8317 /* Display a list of features in the current group */
8318 display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top);
8322 feat_top = feat_cur;
8324 /* Display a list of features in the current group */
8325 display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top);
8327 /* Display visual list below first object */
8328 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8333 prt(format("<Êý¸þ>%s%s, ESC", visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹", (attr_idx||char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"), hgt - 1, 0);
8335 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);
8338 /* Get the current feature */
8339 f_ptr = &f_info[feat_idx[feat_cur]];
8343 place_visual_list_cursor(max + 3, 7, f_ptr->x_attr, f_ptr->x_char, attr_top, char_left);
8347 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8351 Term_gotoxy(max + 3, 6 + (feat_cur - feat_top));
8356 /* Do visual mode command if needed */
8357 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;
8369 /* Move the cursor */
8370 browser_cursor(ch, &column, &grp_cur, grp_cnt, &feat_cur, feat_cnt);
8377 if (!grp_cnt) msg_print("No features known.");
8379 /* Free the "feat_idx" array */
8380 C_KILL(feat_idx, max_f_idx, int);
8385 * List wanted monsters
8387 static void do_cmd_knowledge_kubi(void)
8392 char file_name[1024];
8395 /* Open a new file */
8396 fff = my_fopen_temp(file_name, 1024);
8399 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8401 msg_format("Failed to create temporary file %s.", file_name);
8410 fprintf(fff, "º£Æü¤Î¥¿¡¼¥²¥Ã¥È : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "ÉÔÌÀ"));
8412 fprintf(fff, "¾Þ¶â¼ó¥ê¥¹¥È\n");
8414 fprintf(fff, "Today target : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "unknown"));
8416 fprintf(fff, "List of wanted monsters\n");
8418 for (i = 0; i < MAX_KUBI; i++)
8420 fprintf(fff,"%-40s ---- ",r_name + r_info[(kubi_r_idx[i] > 10000 ? kubi_r_idx[i] - 10000 : kubi_r_idx[i])].name);
8421 if (kubi_r_idx[i] > 10000)
8423 fprintf(fff, "ºÑ\n");
8425 fprintf(fff, "done\n");
8428 fprintf(fff, "$%d\n", 300 * (r_info[kubi_r_idx[i]].level + 1));
8432 /* Close the file */
8435 /* Display the file contents */
8437 show_file(TRUE, file_name, "¾Þ¶â¼ó¤Î°ìÍ÷", 0, 0);
8439 show_file(TRUE, file_name, "Wanted monsters", 0, 0);
8443 /* Remove the file */
8448 * List virtues & status
8450 static void do_cmd_knowledge_virtues(void)
8454 char file_name[1024];
8457 /* Open a new file */
8458 fff = my_fopen_temp(file_name, 1024);
8461 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8463 msg_format("Failed to create temporary file %s.", file_name);
8472 fprintf(fff, "¸½ºß¤Î°À : %s\n\n", your_alignment());
8474 fprintf(fff, "Your alighnment : %s\n\n", your_alignment());
8479 /* Close the file */
8482 /* Display the file contents */
8484 show_file(TRUE, file_name, "Ȭ¤Ä¤ÎÆÁ", 0, 0);
8486 show_file(TRUE, file_name, "Virtues", 0, 0);
8490 /* Remove the file */
8498 static void do_cmd_knowledge_dungeon(void)
8502 char file_name[1024];
8506 /* Open a new file */
8507 fff = my_fopen_temp(file_name, 1024);
8510 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8512 msg_format("Failed to create temporary file %s.", file_name);
8520 for (i = 1; i < max_d_idx; i++)
8524 if (!d_info[i].maxdepth) continue;
8525 if (!max_dlv[i]) continue;
8526 if (d_info[i].final_guardian)
8528 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
8530 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
8532 fprintf(fff,"%c%-12s : %3d ³¬\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
8534 fprintf(fff,"%c%-16s : level %3d\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
8539 /* Close the file */
8542 /* Display the file contents */
8544 show_file(TRUE, file_name, "º£¤Þ¤Ç¤ËÆþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó", 0, 0);
8546 show_file(TRUE, file_name, "Dungeon", 0, 0);
8550 /* Remove the file */
8555 * List virtues & status
8558 static void do_cmd_knowledge_stat(void)
8562 char file_name[1024];
8565 /* Open a new file */
8566 fff = my_fopen_temp(file_name, 1024);
8569 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8571 msg_format("Failed to create temporary file %s.", file_name);
8579 percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
8580 (2 * p_ptr->hitdie +
8581 ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
8584 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : %d/100\n\n", percent);
8585 else fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : ???\n\n");
8586 fprintf(fff, "ǽÎϤκÇÂçÃÍ\n\n");
8588 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "Your current Life Rating is %d/100.\n\n", percent);
8589 else fprintf(fff, "Your current Life Rating is ???.\n\n");
8590 fprintf(fff, "Limits of maximum stats\n\n");
8592 for (v_nr = 0; v_nr < 6; v_nr++)
8594 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);
8595 else fprintf(fff, "%s ???\n", stat_names[v_nr]);
8601 /* Close the file */
8604 /* Display the file contents */
8606 show_file(TRUE, file_name, "¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó", 0, 0);
8608 show_file(TRUE, file_name, "HP-rate & Max stat", 0, 0);
8612 /* Remove the file */
8618 * Print quest status of all active quests
8620 static void do_cmd_knowledge_quests(void)
8623 char file_name[1024];
8625 char rand_tmp_str[120] = "\0";
8627 monster_race *r_ptr;
8629 int rand_level = 100;
8632 /* Open a new file */
8633 fff = my_fopen_temp(file_name, 1024);
8636 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8638 msg_format("Failed to create temporary file %s.", file_name);
8645 fprintf(fff, "¡Ô¿ë¹ÔÃæ¤Î¥¯¥¨¥¹¥È¡Õ\n");
8647 fprintf(fff, "< Current Quest >\n");
8650 for (i = 1; i < max_quests; i++)
8652 if (quest[i].status == QUEST_STATUS_TAKEN || quest[i].status == QUEST_STATUS_COMPLETED)
8657 /* Clear the text */
8658 for (j = 0; j < 10; j++)
8660 quest_text[j][0] = '\0';
8663 quest_text_line = 0;
8665 /* Set the quest number temporary */
8666 old_quest = p_ptr->inside_quest;
8667 p_ptr->inside_quest = i;
8669 /* Get the quest text */
8670 init_flags = INIT_SHOW_TEXT;
8672 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8674 /* Reset the old quest number */
8675 p_ptr->inside_quest = old_quest;
8677 /* No info from "silent" quests */
8678 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8682 if (quest[i].type != QUEST_TYPE_RANDOM)
8684 char note[80] = "\0";
8686 if (quest[i].status == QUEST_STATUS_TAKEN)
8688 if (quest[i].type == QUEST_TYPE_KILL_LEVEL || quest[i].type == QUEST_TYPE_KILL_ANY_LEVEL)
8690 r_ptr = &r_info[quest[i].r_idx];
8691 strcpy(name, r_name + r_ptr->name);
8692 if (quest[i].max_num > 1)
8695 sprintf(note," - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",quest[i].max_num, name, quest[i].max_num-quest[i].cur_num);
8698 sprintf(note," - kill %d %s, have killed %d.",quest[i].max_num, name, quest[i].cur_num);
8703 sprintf(note," - %s¤òÅݤ¹¡£",name);
8705 sprintf(note," - kill %s.",name);
8708 else if (quest[i].type == QUEST_TYPE_KILL_NUMBER)
8711 sprintf(note," - %d ÂΤΥâ¥ó¥¹¥¿¡¼¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",quest[i].max_num, quest[i].max_num-quest[i].cur_num);
8713 sprintf(note," - Kill %d monsters, have killed %d.",quest[i].max_num, quest[i].cur_num);
8716 else if (quest[i].type == QUEST_TYPE_FIND_ARTIFACT)
8718 strcpy(name, a_name + a_info[quest[i].k_idx].name);
8720 sprintf(note," - %s¤ò¸«¤Ä¤±½Ð¤¹¡£", name);
8722 sprintf(note," - Find out %s.", name);
8725 else if (quest[i].type == QUEST_TYPE_FIND_EXIT)
8727 sprintf(note," - õº÷¤¹¤ë¡£");
8729 sprintf(note," - Search.");
8731 else if (quest[i].type == QUEST_TYPE_KILL_ALL)
8733 sprintf(note," - Á´¤Æ¤Î¥â¥ó¥¹¥¿¡¼¤òÅݤ¹¡£");
8735 sprintf(note," - Kill all monsters.");
8739 /* Print the quest info */
8741 sprintf(tmp_str, "%s (´í¸±ÅÙ:%d³¬ÁêÅö)%s\n",
8742 quest[i].name, quest[i].level, note);
8744 sprintf(tmp_str, "%s (Danger level: %d)%s\n",
8745 quest[i].name, quest[i].level, note);
8748 fprintf(fff, tmp_str);
8750 if (quest[i].status == QUEST_STATUS_COMPLETED)
8753 sprintf(tmp_str, " ¥¯¥¨¥¹¥ÈãÀ® - ¤Þ¤ÀÊó½·¤ò¼õ¤±¤È¤Ã¤Æ¤Ê¤¤¡£\n");
8755 sprintf(tmp_str, " Quest Completed - Unrewarded\n");
8758 fprintf(fff, tmp_str);
8764 while (quest_text[j][0] && j < 10)
8766 fprintf(fff, " %s\n", quest_text[j]);
8771 else if ((quest[i].type == QUEST_TYPE_RANDOM) &&
8772 (quest[i].level < rand_level))
8775 rand_level = quest[i].level;
8777 if (max_dlv[DUNGEON_ANGBAND] >= rand_level)
8779 /* Print the quest info */
8780 r_ptr = &r_info[quest[i].r_idx];
8781 strcpy(name, r_name + r_ptr->name);
8783 if (quest[i].max_num > 1)
8786 sprintf(rand_tmp_str,"%s (%d ³¬) - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)\n",
8787 quest[i].name, quest[i].level,
8788 quest[i].max_num, name, quest[i].max_num-quest[i].cur_num);
8792 sprintf(rand_tmp_str,"%s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
8793 quest[i].name, quest[i].level,
8794 quest[i].max_num, name, quest[i].cur_num);
8800 sprintf(rand_tmp_str,"%s (%d ³¬) - %s¤òÅݤ¹¡£\n",
8801 quest[i].name, quest[i].level, name);
8803 sprintf(rand_tmp_str,"%s (Dungeon level: %d)\n Kill %s.\n",
8804 quest[i].name, quest[i].level, name);
8812 /* Print the current random quest */
8813 if (rand_tmp_str[0]) fprintf(fff, rand_tmp_str);
8816 if (!total) fprintf(fff, "¤Ê¤·\n");
8818 if (!total) fprintf(fff, "Nothing.\n");
8822 fprintf(fff, "\n¡ÔãÀ®¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
8824 fprintf(fff, "\n< Completed Quest >\n");
8827 for (i = 1; i < max_quests; i++)
8829 if (quest[i].status == QUEST_STATUS_FINISHED)
8831 if (i < MIN_RANDOM_QUEST)
8835 /* Set the quest number temporary */
8836 old_quest = p_ptr->inside_quest;
8837 p_ptr->inside_quest = i;
8840 init_flags = INIT_ASSIGN;
8842 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8844 /* Reset the old quest number */
8845 p_ptr->inside_quest = old_quest;
8847 /* No info from "silent" quests */
8848 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8853 if ((i >= MIN_RANDOM_QUEST) && quest[i].r_idx)
8855 /* Print the quest info */
8857 if (quest[i].complev == 0)
8861 "%s (%d³¬) - ÉÔÀᄀ\n",
8863 "%s (Dungeon level: %d) - (Cancelled)\n",
8865 r_name+r_info[quest[i].r_idx].name,
8872 "%s (%d³¬) - ¥ì¥Ù¥ë%d\n",
8874 "%s (Dungeon level: %d) - level %d\n",
8876 r_name+r_info[quest[i].r_idx].name,
8883 /* Print the quest info */
8885 sprintf(tmp_str, "%s (´í¸±ÅÙ:%d³¬ÁêÅö) - ¥ì¥Ù¥ë%d\n",
8886 quest[i].name, quest[i].level, quest[i].complev);
8888 sprintf(tmp_str, "%s (Danger level: %d) - level %d\n",
8889 quest[i].name, quest[i].level, quest[i].complev);
8893 fprintf(fff, tmp_str);
8897 if (!total) fprintf(fff, "¤Ê¤·\n");
8899 if (!total) fprintf(fff, "Nothing.\n");
8903 fprintf(fff, "\n¡Ô¼ºÇÔ¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
8905 fprintf(fff, "\n< Failed Quest >\n");
8908 for (i = 1; i < max_quests; i++)
8910 if ((quest[i].status == QUEST_STATUS_FAILED_DONE) || (quest[i].status == QUEST_STATUS_FAILED))
8912 if (i < MIN_RANDOM_QUEST)
8916 /* Set the quest number temporary */
8917 old_quest = p_ptr->inside_quest;
8918 p_ptr->inside_quest = i;
8920 /* Get the quest text */
8921 init_flags = INIT_ASSIGN;
8923 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8925 /* Reset the old quest number */
8926 p_ptr->inside_quest = old_quest;
8928 /* No info from "silent" quests */
8929 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8934 if ((i >= MIN_RANDOM_QUEST) && quest[i].r_idx)
8936 /* Print the quest info */
8938 sprintf(tmp_str, "%s (%d³¬) - ¥ì¥Ù¥ë%d\n",
8939 r_name+r_info[quest[i].r_idx].name, quest[i].level, quest[i].complev);
8941 sprintf(tmp_str, "%s (Dungeon level: %d) - level %d\n",
8942 r_name+r_info[quest[i].r_idx].name, quest[i].level, quest[i].complev);
8947 /* Print the quest info */
8949 sprintf(tmp_str, "%s (´í¸±ÅÙ:%d³¬ÁêÅö) - ¥ì¥Ù¥ë%d\n",
8950 quest[i].name, quest[i].level, quest[i].complev);
8952 sprintf(tmp_str, "%s (Danger level: %d) - level %d\n",
8953 quest[i].name, quest[i].level, quest[i].complev);
8956 fprintf(fff, tmp_str);
8960 if (!total) fprintf(fff, "¤Ê¤·\n");
8962 if (!total) fprintf(fff, "Nothing.\n");
8965 if (p_ptr->wizard) {
8967 fprintf(fff, "\n¡Ô»Ä¤ê¤Î¥é¥ó¥À¥à¥¯¥¨¥¹¥È¡Õ\n");
8969 fprintf(fff, "\n< Remaining Random Quest >\n");
8972 for (i = 1; i < max_quests; i++)
8974 /* No info from "silent" quests */
8975 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8977 if ((quest[i].type == QUEST_TYPE_RANDOM) && (quest[i].status == QUEST_STATUS_TAKEN))
8981 /* Print the quest info */
8983 sprintf(tmp_str, "%s (%d³¬, %s)\n",
8984 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
8986 sprintf(tmp_str, "%s (%d, %s)\n",
8987 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
8989 fprintf(fff, tmp_str);
8993 if (!total) fprintf(fff, "¤Ê¤·\n");
8995 if (!total) fprintf(fff, "Nothing.\n");
8999 /* Close the file */
9002 /* Display the file contents */
9004 show_file(TRUE, file_name, "¥¯¥¨¥¹¥ÈãÀ®¾õ¶·", 0, 0);
9006 show_file(TRUE, file_name, "Quest status", 0, 0);
9010 /* Remove the file */
9019 static void do_cmd_knowledge_home(void)
9024 char file_name[1024];
9026 char o_name[MAX_NLEN];
9029 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
9031 /* Open a new file */
9032 fff = my_fopen_temp(file_name, 1024);
9035 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9037 msg_format("Failed to create temporary file %s.", file_name);
9045 /* Print all homes in the different towns */
9046 st_ptr = &town[1].store[STORE_HOME];
9048 /* Home -- if anything there */
9049 if (st_ptr->stock_num)
9051 /* Header with name of the town */
9053 fprintf(fff, " [ ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ]\n");
9055 fprintf(fff, " [Home Inventory]\n");
9059 /* Dump all available items */
9060 for (i = 0; i < st_ptr->stock_num; i++)
9063 if ((i % 12) == 0) fprintf(fff, "\n ( %d ¥Ú¡¼¥¸ )\n", x++);
9064 object_desc(o_name, &st_ptr->stock[i], TRUE, 3);
9065 if (strlen(o_name) <= 80-3)
9067 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9073 for (n = 0, t = o_name; n < 80-3; n++, t++)
9074 if(iskanji(*t)) {t++; n++;}
9075 if (n == 81-3) n = 79-3; /* ºÇ¸å¤¬´Á»úȾʬ */
9077 fprintf(fff, "%c%s %.*s\n", I2A(i%12), paren, n, o_name);
9078 fprintf(fff, " %.77s\n", o_name+n);
9081 object_desc(o_name, &st_ptr->stock[i], TRUE, 3);
9082 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9087 /* Add an empty line */
9088 fprintf(fff, "\n\n");
9092 /* Close the file */
9095 /* Display the file contents */
9097 show_file(TRUE, file_name, "²æ¤¬²È¤Î¥¢¥¤¥Æ¥à", 0, 0);
9099 show_file(TRUE, file_name, "Home Inventory", 0, 0);
9103 /* Remove the file */
9109 * Check the status of "autopick"
9111 static void do_cmd_knowledge_autopick(void)
9115 char file_name[1024];
9117 /* Open a new file */
9118 fff = my_fopen_temp(file_name, 1024);
9123 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9125 msg_format("Failed to create temporary file %s.", file_name);
9134 fprintf(fff, "¼«Æ°Ç˲õ/½¦¤¤¤Ë¤Ï²¿¤âÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
9136 fprintf(fff, "No preference for auto picker/destroyer.");
9142 fprintf(fff, " ¼«Æ°½¦¤¤/Ç˲õ¤Ë¤Ï¸½ºß %d¹ÔÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤¹¡£\n\n", max_autopick);
9144 fprintf(fff, " There are %d registered lines for auto picker/destroyer.\n\n", max_autopick);
9148 for (k = 0; k < max_autopick; k++)
9151 byte act = autopick_list[k].action;
9152 if (act & DONT_AUTOPICK)
9160 else if (act & DO_AUTODESTROY)
9168 else if (act & DO_AUTOPICK)
9176 else /* if (act & DO_QUERY_AUTOPICK) */ /* Obvious */
9185 if (act & DO_DISPLAY)
9186 fprintf(fff, "%11s", format("[%s]", tmp));
9188 fprintf(fff, "%11s", format("(%s)", tmp));
9190 tmp = autopick_line_from_entry(&autopick_list[k]);
9191 fprintf(fff, " %s", tmp);
9195 /* Close the file */
9197 /* Display the file contents */
9199 show_file(TRUE, file_name, "¼«Æ°½¦¤¤/Ç˲õ ÀßÄê¥ê¥¹¥È", 0, 0);
9201 show_file(TRUE, file_name, "Auto-picker/Destroyer", 0, 0);
9204 /* Remove the file */
9210 * Interact with "knowledge"
9212 void do_cmd_knowledge(void)
9215 /* File type is "TEXT" */
9216 FILE_TYPE(FILE_TYPE_TEXT);
9217 /* Save the screen */
9219 /* Interact until done */
9224 /* Ask for a choice */
9226 prt(format("%d/2 ¥Ú¡¼¥¸", (p+1)), 2, 65);
9227 prt("¸½ºß¤ÎÃ챤ò³Îǧ¤¹¤ë", 3, 0);
9229 prt(format("page %d/2", (p+1)), 2, 65);
9230 prt("Display current knowledge", 3, 0);
9233 /* Give some choices */
9236 prt("(1) ´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 6, 5);
9237 prt("(2) ´ûÃΤΥ¢¥¤¥Æ¥à ¤Î°ìÍ÷", 7, 5);
9238 prt("(3) ´ûÃΤÎÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 8, 5);
9239 prt("(4) ´ûÃΤΥâ¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 9, 5);
9240 prt("(5) Åݤ·¤¿Å¨¤Î¿ô ¤Î°ìÍ÷", 10, 5);
9241 prt("(6) ¾Þ¶â¼ó ¤Î°ìÍ÷", 11, 5);
9242 prt("(7) ¸½ºß¤Î¥Ú¥Ã¥È ¤Î°ìÍ÷", 12, 5);
9243 prt("(8) ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 13, 5);
9244 prt("(9) *´ÕÄê*ºÑ¤ßÁõÈ÷¤ÎÂÑÀ ¤Î°ìÍ÷", 14, 5);
9245 prt("(0) ÃÏ·Á¤Îɽ¼¨Ê¸»ú/¥¿¥¤¥ë ¤Î°ìÍ÷", 15, 5);
9247 prt("(a) ¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó ¤Î°ìÍ÷", 6, 5);
9248 prt("(b) ÆÍÁ³ÊÑ°Û ¤Î°ìÍ÷", 7, 5);
9249 prt("(c) Éð´ï¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 8, 5);
9250 prt("(d) ËâË¡¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 9, 5);
9251 prt("(e) µ»Ç½¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 10, 5);
9252 prt("(f) ¥×¥ì¥¤¥ä¡¼¤ÎÆÁ ¤Î°ìÍ÷", 11, 5);
9253 prt("(g) Æþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó ¤Î°ìÍ÷", 12, 5);
9254 prt("(h) ¼Â¹ÔÃæ¤Î¥¯¥¨¥¹¥È ¤Î°ìÍ÷", 13, 5);
9255 prt("(i) ¸½ºß¤Î¼«Æ°½¦¤¤/Ç˲õÀßÄê ¤Î°ìÍ÷", 14, 5);
9259 prt("(1) Display known artifacts", 6, 5);
9260 prt("(2) Display known objects", 7, 5);
9261 prt("(3) Display remaining uniques", 8, 5);
9262 prt("(4) Display known monster", 9, 5);
9263 prt("(5) Display kill count", 10, 5);
9264 prt("(6) Display wanted monsters", 11, 5);
9265 prt("(7) Display current pets", 12, 5);
9266 prt("(8) Display home inventory", 13, 5);
9267 prt("(9) Display *identified* equip.", 14, 5);
9268 prt("(0) Display terrain symbols.", 15, 5);
9270 prt("(a) Display about yourself", 6, 5);
9271 prt("(b) Display mutations", 7, 5);
9272 prt("(c) Display weapon proficiency", 8, 5);
9273 prt("(d) Display spell proficiency", 9, 5);
9274 prt("(e) Display misc. proficiency", 10, 5);
9275 prt("(f) Display virtues", 11, 5);
9276 prt("(g) Display dungeons", 12, 5);
9277 prt("(h) Display current quests", 13, 5);
9278 prt("(i) Display auto pick/destroy", 14, 5);
9283 prt("-³¤¯-", 17, 8);
9284 prt("ESC) È´¤±¤ë", 21, 1);
9285 prt("SPACE) ¼¡¥Ú¡¼¥¸", 21, 30);
9286 /*prt("-) Á°¥Ú¡¼¥¸", 21, 60);*/
9287 prt("¥³¥Þ¥ó¥É:", 20, 0);
9289 prt("-more-", 17, 8);
9290 prt("ESC) Exit menu", 21, 1);
9291 prt("SPACE) Next page", 21, 30);
9292 /*prt("-) Previous page", 21, 60);*/
9293 prt("Command: ", 20, 0);
9299 if (i == ESCAPE) break;
9302 case ' ': /* Page change */
9306 case '1': /* Artifacts */
9307 do_cmd_knowledge_artifacts();
9309 case '2': /* Objects */
9310 do_cmd_knowledge_objects();
9312 case '3': /* Uniques */
9313 do_cmd_knowledge_uniques();
9315 case '4': /* Monsters */
9316 do_cmd_knowledge_monsters();
9318 case '5': /* Kill count */
9319 do_cmd_knowledge_kill_count();
9321 case '6': /* wanted */
9322 do_cmd_knowledge_kubi();
9324 case '7': /* Pets */
9325 do_cmd_knowledge_pets();
9327 case '8': /* Home */
9328 do_cmd_knowledge_home();
9330 case '9': /* Resist list */
9331 do_cmd_knowledge_inven();
9333 case '0': /* Feature list */
9334 do_cmd_knowledge_features();
9337 case 'a': /* Max stat */
9338 do_cmd_knowledge_stat();
9340 case 'b': /* Mutations */
9341 do_cmd_knowledge_mutations();
9343 case 'c': /* weapon-exp */
9344 do_cmd_knowledge_weapon_exp();
9346 case 'd': /* spell-exp */
9347 do_cmd_knowledge_spell_exp();
9349 case 'e': /* skill-exp */
9350 do_cmd_knowledge_skill_exp();
9352 case 'f': /* Virtues */
9353 do_cmd_knowledge_virtues();
9355 case 'g': /* Dungeon */
9356 do_cmd_knowledge_dungeon();
9358 case 'h': /* Quests */
9359 do_cmd_knowledge_quests();
9361 case 'i': /* Autopick */
9362 do_cmd_knowledge_autopick();
9364 default: /* Unknown option */
9367 /* Flush messages */
9370 /* Restore the screen */
9376 * Check on the status of an active quest
9378 void do_cmd_checkquest(void)
9380 /* File type is "TEXT" */
9381 FILE_TYPE(FILE_TYPE_TEXT);
9383 /* Save the screen */
9387 do_cmd_knowledge_quests();
9389 /* Restore the screen */
9395 * Display the time and date
9397 void do_cmd_time(void)
9399 int day, hour, min, full, start, end, num;
9406 extract_day_hour_min(&day, &hour, &min);
9408 full = hour * 100 + min;
9416 strcpy(desc, "ÊѤʻþ¹ï¤À¡£");
9418 strcpy(desc, "It is a strange time.");
9424 msg_format("%d ÆüÌÜ,»þ¹ï¤Ï%d:%02d %s¤Ç¤¹¡£",
9425 day, (hour % 12 == 0) ? 12 : (hour % 12),
9426 min, (hour < 12) ? "AM" : "PM");
9428 msg_format("This is day %d. The time is %d:%02d %s.",
9429 day, (hour % 12 == 0) ? 12 : (hour % 12),
9430 min, (hour < 12) ? "AM" : "PM");
9435 if (!randint0(10) || p_ptr->image)
9438 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun_j.txt");
9440 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun.txt");
9447 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm_j.txt");
9449 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm.txt");
9454 /* Open this file */
9455 fff = my_fopen(buf, "rt");
9460 /* Find this time */
9461 while (!my_fgets(fff, buf, sizeof(buf)))
9463 /* Ignore comments */
9464 if (!buf[0] || (buf[0] == '#')) continue;
9466 /* Ignore invalid lines */
9467 if (buf[1] != ':') continue;
9469 /* Process 'Start' */
9472 /* Extract the starting time */
9473 start = atoi(buf + 2);
9475 /* Assume valid for an hour */
9485 /* Extract the ending time */
9486 end = atoi(buf + 2);
9492 /* Ignore incorrect range */
9493 if ((start > full) || (full > end)) continue;
9495 /* Process 'Description' */
9500 /* Apply the randomizer */
9501 if (!randint0(num)) strcpy(desc, buf + 2);
9511 /* Close the file */