OSDN Git Service

アイテム生成に関わる関数群の変更.
[hengband/hengband.git] / src / birth.c
index 0362e52..1f61609 100644 (file)
@@ -1,11 +1,11 @@
 /* Purpose: create a player character */
 
 /*
- * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
+ * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
  *
- * This software may be copied and distributed for educational, research, and
- * not for profit purposes provided that this copyright and statement are
- * included in all such copies.
+ * This software may be copied and distributed for educational, research,
+ * and not for profit purposes provided that this copyright and statement
+ * are included in all such copies.  Other copyrights may also apply.
  */
 
 #include "angband.h"
@@ -1815,7 +1815,7 @@ static cptr class_jouhou[MAX_CLASS] =
   
 "µ³Ê¼¤ÏÇϤ˾è¤êÀï¾ì¤ò¶î¤±È´¤±¤ë¥¨¥ê¡¼¥ÈÀï»Î¤Ç¤¹¡£ËâË¡¤Ï»È¤¨¤Þ¤»¤ó¤¬¡¢ÇϾ夫¤é¤Î°µÅÝŪ¤Ê¹¶·âÎϤò¸Ø¤ë¾å¤Ë¡¢¹â¤¤µ¡Æ°ÎϤòÀ¸¤«¤·¤¿¼Í·â¤ò¤âÆÀ°Õ¤È¤·¤Æ¤¤¤Þ¤¹¡£¥ì¥Ù¥ë¤¬¾å¤¬¤ì¤Ð¡¢ÌîÀ¸¤Î¥â¥ó¥¹¥¿¡¼¤Ë¤Þ¤¿¤¬¤ê̵ÍýÌðÍý¼ê¤Ê¤º¤±¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£Èà¤é¤Ï¸Ê¤ÎÆùÂΤÈÀº¿À¤Ë¸Ø¤ê¤ò»ý¤Á¡¢ËâË¡Æ»¶ñ¤Ë¤Ï¤¢¤Þ¤êÍê¤í¤¦¤È¤Ï¤·¤Þ¤»¤ó¡£",
   
-"¶¸Àï»Î¤ÏÅܤ궸¤Ã¤ÆÉð´ï¤ò¿¶¤ë¤¦¶²¤ë¤Ù¤­Àï»Î¤Ç¤¹¡£Á´¿¦¶ÈÃæºÇ¹â¤ÎÆùÂÎǽÎϤò¸Ø¤ê¡¢¶²ÉݤÈËãáã¤ËÂФ¹¤ëÂÑÀ­¤ò»ý¤Á¡¢¥ì¥Ù¥ë¤¬¾å¤¬¤ì¤Ð¤½¤Î¶¯¿Ù¤ÊÆùÂΤÇÌð¤Î¼öʸ¤òÄ·¤ÍÊÖ¤¹¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤µ¤é¤ËÉð´ï¤Ê¤·¤ÇÀ臘¤³¤È¤ä¡¢¼ö¤¤¤Î¤«¤±¤é¤ì¤¿ÁõÈ÷¤òÎϤŤ¯¤ÇÇí¤¬¤¹¤³¤È¤¬¤Ç¤­¡¢¤¤¤¯¤Ä¤«¤Îµ»¤ò(È¿ËâË¡¾õÂ֤Ǥâ)»È¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤·¤«¤·¡¢´¬Êª¤äËâË¡Æ»¶ñ¤ÏÁ´¤¯»È¤¦¤³¤È¤¬¤Ç¤­¤º¡¢æ«¤Î²ò½ü¤ä±£Ì©¹ÔÆ°¡¢Ãµº÷¡¢ËâË¡Ëɸ桢Èô¤ÓÆ»¶ñ¤Îµ»Ç½¤Ë´Ø¤·¤Æ¤ÏÀä˾Ū¤Ç¤¹¡£¤Ò¤¿¤¹¤é²¥¤Ã¤ÆÆ»¤ò³«¤¯¤·¤«¤¢¤ê¤Þ¤»¤ó¡£¥¢¥ó¥Ð¥é¥¤¥È¤ÈÍ©Îî¤ÏÈó¾ï¤Ë¾¡Íø¤·¤ä¤¹¤¤¤Ç¤¹¤¬¥¹¥³¥¢¤¬¤«¤Ê¤êÄ㤯½¤Àµ¤µ¤ì¤Þ¤¹¡£",
+"¶¸Àï»Î¤ÏÅܤ궸¤Ã¤ÆÉð´ï¤ò¿¶¤ë¤¦¶²¤ë¤Ù¤­Àï»Î¤Ç¤¹¡£Á´¿¦¶ÈÃæºÇ¹â¤ÎÆùÂÎǽÎϤò¸Ø¤ê¡¢¶²ÉݤÈËãáã¤ËÂФ¹¤ëÂÑÀ­¤ò»ý¤Á¡¢¥ì¥Ù¥ë¤¬¾å¤¬¤ì¤Ð¤½¤Î¶¯¿Ù¤ÊÆùÂΤÇÌð¤Î¼öʸ¤òÄ·¤ÍÊÖ¤¹¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤µ¤é¤ËÉð´ï¤Ê¤·¤ÇÀ臘¤³¤È¤ä¡¢¼ö¤¤¤Î¤«¤±¤é¤ì¤¿ÁõÈ÷¤òÎϤŤ¯¤ÇÇí¤¬¤¹¤³¤È¤¬¤Ç¤­¡¢¤¤¤¯¤Ä¤«¤Îµ»¤ò(È¿ËâË¡¾õÂ֤Ǥâ)»È¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤·¤«¤·¡¢´¬Êª¤äËâË¡Æ»¶ñ¤ÏÁ´¤¯»È¤¦¤³¤È¤¬¤Ç¤­¤º¡¢æ«¤Î²ò½ü¤ä±£Ì©¹ÔÆ°¡¢Ãµº÷¡¢ËâË¡Ëɸ桢Èô¤ÓÆ»¶ñ¤Îµ»Ç½¤Ë´Ø¤·¤Æ¤ÏÀä˾Ū¤Ç¤¹¡£¤Ò¤¿¤¹¤é²¥¤Ã¤ÆÆ»¤ò³«¤¯¤·¤«¤¢¤ê¤Þ¤»¤ó¡£Í©Îî¤ÏÈó¾ï¤Ë¾¡Íø¤·¤ä¤¹¤¤¤Ç¤¹¤¬¥¹¥³¥¢¤¬¤«¤Ê¤êÄ㤯½¤Àµ¤µ¤ì¤Þ¤¹¡£",
 
 "ÃÃÌê»Õ¤ÏÉð´ï¤äËɶñ¤ò¼«Ê¬¤Ç¶¯²½¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£Æüì¸ú²Ì¤ò»ý¤ÄÉð´ï¤äËɶñ¤«¤éÆüì¸ú²Ì¤Î¸µ¤È¤Ê¤ë¥¨¥Ã¥»¥ó¥¹¤ò¼è¤ê½Ð¤·¡¢Ê̤ÎÉð´ï¤äËɶñ¤Ë¥¨¥Ã¥»¥ó¥¹¤òÉղ乤뤳¤È¤Ë¤è¤Ã¤Æ¤½¤ÎÆüì¸ú²Ì¤òÉղäǤ­¤Þ¤¹¡£¤¢¤ëÄøÅÙ¤ÎÀïƮǽÎϤâ»ý¤Á¤Þ¤¹¤¬¡¢ËâË¡¤Ï°ìÀÚ»ÈÍѤǤ­¤º¡¢±£Ì©¤äËâË¡Ëɸæ¤Îµ»Ç½¤âÄ㤯¤Ê¤ê¤Þ¤¹¡£",
 
@@ -1843,7 +1843,7 @@ static cptr class_jouhou[MAX_CLASS] =
 
 "The Monk character class is very different from all other classes.  Their training in martial arts makes them much more powerful with no armor or weapons.  To gain the resistances necessary for survival a monk may need to wear some kind of armor, but if the armor he wears is too heavy, it will severely disturb his martial arts maneuvers.  As the monk advances levels, new, powerful forms of attack become available.  Their defensive capabilities increase likewise, but if armour is being worn, this effect decreases.  Wisdom determines a Monk's spell casting ability.",
 
-"The Mindcrafter is a unique class that uses the powers of the mind instead of magic.  These powers are unique to Mindcrafters, and vary from simple extrasensory powers to mental domination of others.  Since these powers are developed by the practice of certain disciplines, a Mindcrafter requires no spellbooks to use them.  The available powers are simply determined by the character's level.  Wisdom determines a Mindcrafter's ability to use mind powers,",
+"The Mindcrafter is a unique class that uses the powers of the mind instead of magic.  These powers are unique to Mindcrafters, and vary from simple extrasensory powers to mental domination of others.  Since these powers are developed by the practice of certain disciplines, a Mindcrafter requires no spellbooks to use them.  The available powers are simply determined by the character's level.  Wisdom determines a Mindcrafter's ability to use mind powers.",
 
 "High-mages are mages who specialize in one particular field of magic and learn it very well - much better than the ordinary mage.  For the price of giving up a second realm of magic, they gain substantial benefits in the mana costs, minimum levels, and failure rates in the spells of the realm of their specialty.  A high mage's prime statistic is intelligence as this determines his spell casting ability. ",
 
@@ -1871,7 +1871,7 @@ static cptr class_jouhou[MAX_CLASS] =
 
 "Cavalry ride on horses into battle.  Although they cannot cast spells, they are proud of their overwhelming offensive strength on horseback.  They are good at shooting.  At high levels, they learn to forcibly saddle and tame wild monsters.  Since they take pride in the body and the soul, they don't use magical devices well.",
 
-"A Berserker is a fearful fighter indeed, immune to fear and paralysis.  At high levels, Berserkers can reflect bolt spells with their tough flesh.  Furthermore, they can fight without weapons, can remove cursed equipment by force, and can even use their special combat techniques when surrounded by an anti-magic barrier.  Berserkers, however, cannot use any magical devices or read any scrolls, and are hopeless at all non-combat skills.  Since Berserker Amberite or Spectres are quite easy to *win* with, their scores are lowered.",
+"A Berserker is a fearful fighter indeed, immune to fear and paralysis.  At high levels, Berserkers can reflect bolt spells with their tough flesh.  Furthermore, they can fight without weapons, can remove cursed equipment by force, and can even use their special combat techniques when surrounded by an anti-magic barrier.  Berserkers, however, cannot use any magical devices or read any scrolls, and are hopeless at all non-combat skills.  Since Berserker Spectres are quite easy to *win* with, their scores are lowered.",
 
 "A Weaponsmith can improve weapons and armors for him or herself.  They can extract the essences of special effects from weapons or armors which have various special abilities, and can add these essences to another weapon or armor.  They are good at fighting, but cannot cast spells, and are poor at skills such as stealth or magic defense.",
 
@@ -2355,7 +2355,7 @@ static bool get_player_realms(void)
                put_str("                                   ", 4, 40);
                put_str("                                   ", 5, 40);
 
-               roff_to_buf(realm_jouhou[technic2magic(p_ptr->realm1)-1], 74, temp);
+               roff_to_buf(realm_jouhou[technic2magic(p_ptr->realm1)-1], 74, temp, sizeof(temp));
                t = temp;
                for (i = 0; i< 6; i++)
                {
@@ -2381,9 +2381,9 @@ static bool get_player_realms(void)
                }
 else
 #ifdef JP
-               if (get_check("¤è¤í¤·¤¤¤Ç¤¹¤«¡©")) break;
+               if (get_check_strict("¤è¤í¤·¤¤¤Ç¤¹¤«¡©", CHECK_DEFAULT_Y)) break;
 #else
-               if (get_check("Are you sure? ")) break;
+               if (get_check_strict("Are you sure? ", CHECK_DEFAULT_Y)) break;
 #endif
        }
 
@@ -2418,7 +2418,7 @@ else
                        put_str("                                   ", 4, 40);
                        put_str("                                   ", 5, 40);
 
-                       roff_to_buf(realm_jouhou[technic2magic(p_ptr->realm2)-1], 74, temp);
+                       roff_to_buf(realm_jouhou[technic2magic(p_ptr->realm2)-1], 74, temp, sizeof(temp));
                        t = temp;
                        for (i = 0; i< 6; i++)
                        {
@@ -2443,9 +2443,9 @@ else
                                break;
                        }
 #ifdef JP
-                       else if (get_check("¤è¤í¤·¤¤¤Ç¤¹¤«¡©")) break;
+                       else if (get_check_strict("¤è¤í¤·¤¤¤Ç¤¹¤«¡©", CHECK_DEFAULT_Y)) break;
 #else
-                       else if (get_check("Are you sure? ")) break;
+                       else if (get_check_strict("Are you sure? ", CHECK_DEFAULT_Y)) break;
 #endif
                }
                if (p_ptr->realm2)
@@ -2576,11 +2576,8 @@ static void load_prev_data(bool swap)
 
 /*
  * Returns adjusted stat -JK-  Algorithm by -JWT-
- *
- * auto_roll is boolean and states maximum changes should be used rather
- * than random ones to allow specification of higher values to wait for
  */
-static int adjust_stat(int value, int amount, int auto_roll)
+static int adjust_stat(int value, int amount)
 {
        int i;
 
@@ -2729,7 +2726,7 @@ void get_max_stats(void)
  */
 static void get_extra(bool roll_hitdie)
 {
-       int             i, j, min_value, max_value;
+       int i, j;
 
        /* Experience factor */
        if (p_ptr->prace == RACE_ANDROID) p_ptr->expfact = rp_ptr->r_exp;
@@ -2746,17 +2743,17 @@ static void get_extra(bool roll_hitdie)
 
        for (i = 0; i < 64; i++)
        {
-               if (p_ptr->pclass == CLASS_SORCERER) p_ptr->spell_exp[i] = 1600;
-               else if (p_ptr->pclass == CLASS_RED_MAGE) p_ptr->spell_exp[i] = 1200;
-               else p_ptr->spell_exp[i] = 0;
+               if (p_ptr->pclass == CLASS_SORCERER) p_ptr->spell_exp[i] = SPELL_EXP_MASTER;
+               else if (p_ptr->pclass == CLASS_RED_MAGE) p_ptr->spell_exp[i] = SPELL_EXP_SKILLED;
+               else p_ptr->spell_exp[i] = SPELL_EXP_UNSKILLED;
        }
 
        for (i = 0; i < 5; i++)
                for (j = 0; j < 64; j++)
                        p_ptr->weapon_exp[i][j] = s_info[p_ptr->pclass].w_start[i][j];
-       if(p_ptr->pseikaku == SEIKAKU_SEXY)
+       if ((p_ptr->pseikaku == SEIKAKU_SEXY) && (p_ptr->weapon_exp[TV_HAFTED-TV_BOW][SV_WHIP] < WEAPON_EXP_BEGINNER))
        {
-               p_ptr->weapon_exp[TV_HAFTED-TV_BOW][SV_WHIP] = 4000;
+               p_ptr->weapon_exp[TV_HAFTED-TV_BOW][SV_WHIP] = WEAPON_EXP_BEGINNER;
        }
 
        for (i = 0; i < 10; i++)
@@ -2769,45 +2766,7 @@ static void get_extra(bool roll_hitdie)
                p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
 
        /* Roll for hit point unless quick-start */
-       if (roll_hitdie)
-       {
-               /* Minimum hitpoints at highest level */
-               min_value = ((PY_MAX_LEVEL+2) * (p_ptr->hitdie + 1)) * 3 / 8;
-               min_value += p_ptr->hitdie;
-
-               /* Maximum hitpoints at highest level */
-               max_value = ((PY_MAX_LEVEL+2) * (p_ptr->hitdie + 1)) * 5 / 8;
-               max_value += p_ptr->hitdie;
-
-               /* Roll out the hitpoints */
-               while (TRUE)
-               {
-                       /* Pre-calculate level 1 hitdice */
-                       p_ptr->player_hp[0] = p_ptr->hitdie;
-
-                       for (i = 1; i < 4; i++)
-                       {
-                               j = randint1(p_ptr->hitdie);
-                               p_ptr->player_hp[0] += j;
-                       }
-
-                       /* Roll the hitpoint values */
-                       for (i = 1; i < PY_MAX_LEVEL; i++)
-                       {
-                               j = randint1(p_ptr->hitdie);
-                               p_ptr->player_hp[i] = p_ptr->player_hp[i - 1] + j;
-                       }
-
-                       /* XXX Could also require acceptable "mid-level" hitpoints */
-
-                       /* Require "valid" hitpoints at highest level */
-                       if (p_ptr->player_hp[PY_MAX_LEVEL - 1] < min_value) continue;
-                       if (p_ptr->player_hp[PY_MAX_LEVEL - 1] > max_value) continue;
-
-                       /* Acceptable */
-                       break;
-               }
-       }
+       if (roll_hitdie) do_cmd_rerate_aux();
 
        /* Initial hitpoints */
        p_ptr->mhp = p_ptr->player_hp[0];
@@ -3062,7 +3021,7 @@ static void get_history(void)
 
        {
        char temp[64*4];
-       roff_to_buf(s, 60, temp);
+       roff_to_buf(s, 60, temp, sizeof(temp));
        t = temp;
        for(i=0 ; i<4 ; i++){
             if(t[0]==0)break; 
@@ -3163,7 +3122,7 @@ static void birth_put_stats(void)
                        j = rp_ptr->r_adj[i] + cp_ptr->c_adj[i] + ap_ptr->a_adj[i];
 
                        /* Obtain the current stat */
-                       m = adjust_stat(p_ptr->stat_max[i], j, TRUE);
+                       m = adjust_stat(p_ptr->stat_max[i], j);
 
                        /* Put the stat */
                        cnv_stat(m, buf);
@@ -3406,7 +3365,7 @@ static void init_dungeon_quests(int number_of_quests)
        init_flags = INIT_ASSIGN;
        p_ptr->inside_quest = MIN_RANDOM_QUEST;
 
-       process_dungeon_file("q_info_j.txt", 0, 0, 0, 0);
+       process_dungeon_file("q_info.txt", 0, 0, 0, 0);
 
        p_ptr->inside_quest = 0;
 
@@ -3470,13 +3429,13 @@ static void init_dungeon_quests(int number_of_quests)
        init_flags = INIT_ASSIGN;
        p_ptr->inside_quest = QUEST_OBERON;
 
-       process_dungeon_file("q_info_j.txt", 0, 0, 0, 0);
+       process_dungeon_file("q_info.txt", 0, 0, 0, 0);
 
        quest[QUEST_OBERON].status = QUEST_STATUS_TAKEN;
 
        p_ptr->inside_quest = QUEST_SERPENT;
 
-       process_dungeon_file("q_info_j.txt", 0, 0, 0, 0);
+       process_dungeon_file("q_info.txt", 0, 0, 0, 0);
 
        quest[QUEST_SERPENT].status = QUEST_STATUS_TAKEN;
        p_ptr->inside_quest = 0;
@@ -3699,6 +3658,21 @@ static byte player_init[MAX_CLASS][3][2] =
 
 
 /*
+ * Hook function for human corpses
+ */
+static bool monster_hook_human(int r_idx)
+{
+       monster_race *r_ptr = &r_info[r_idx];
+
+       if (r_ptr->flags1 & (RF1_UNIQUE)) return FALSE;
+
+       if (strchr("pht", r_ptr->d_char)) return TRUE;
+
+       return FALSE;
+}
+
+
+/*
  * Init players with some belongings
  *
  * Having an item makes the player "aware" of its purpose.
@@ -3718,10 +3692,23 @@ void player_outfit(void)
        switch (p_ptr->prace)
        {
        case RACE_VAMPIRE:
-       case RACE_DEMON:
                /* Nothing! */
                /* Vampires can drain blood of creatures */
+               break;
+
+       case RACE_DEMON:
                /* Demon can drain vitality from humanoid corpse */
+
+               /* Prepare allocation table */
+               get_mon_num_prep(monster_hook_human, NULL);
+
+               for (i = rand_range(3,4); i > 0; i--)
+               {
+                       object_prep(q_ptr, lookup_kind(TV_CORPSE, SV_CORPSE));
+                       q_ptr->pval = get_mon_num(2);
+                       q_ptr->number = 1;
+                       (void)inven_carry(q_ptr);
+               }
                break;
 
 #if 0
@@ -3760,6 +3747,10 @@ void player_outfit(void)
        case RACE_ANDROID:
                /* Flasks of oil */
                object_prep(q_ptr, lookup_kind(TV_FLASK, SV_ANY));
+
+               /* Fuel with oil (move pval to xtra4) */
+               apply_magic(q_ptr, 1, 0L);
+
                q_ptr->number = (byte)rand_range(7, 12);
                object_aware(q_ptr);
                object_known(q_ptr);
@@ -3979,6 +3970,9 @@ void player_outfit(void)
 
                (void)inven_carry(q_ptr);
        }
+
+       /* Hack -- make aware of the water */
+       k_info[lookup_kind(TV_POTION, SV_POTION_WATER)].aware = TRUE;
 }
 
 
@@ -4673,7 +4667,7 @@ static bool get_stat_limits(void)
                j = rp_ptr->r_adj[i] + cp_ptr->c_adj[i] + ap_ptr->a_adj[i];
 
                /* Obtain the "maximal" stat */
-               m = adjust_stat(17, j, TRUE);
+               m = adjust_stat(17, j);
 
                /* Save the maximum */
                mval[i] = m;
@@ -4699,7 +4693,7 @@ static bool get_stat_limits(void)
                }
 
                /* Obtain the current stat */
-               m = adjust_stat(cval[i], j, TRUE);
+               m = adjust_stat(cval[i], j);
 
                /* Above 18 */
                if (m > 18)
@@ -4763,7 +4757,7 @@ static bool get_stat_limits(void)
                                j = rp_ptr->r_adj[cs] + cp_ptr->c_adj[cs] + ap_ptr->a_adj[cs];
 
                                /* Obtain the current stat */
-                               m = adjust_stat(cval[cs], j, TRUE);
+                               m = adjust_stat(cval[cs], j);
                                
                                /* Above 18 */
                                if (m > 18)
@@ -4799,10 +4793,8 @@ static bool get_stat_limits(void)
                switch ( c ){
                case 'Q':
                        birth_quit();
-                       break;
                case 'S':
-                       return (FALSE); 
-                       break;
+                       return FALSE;
                case ESCAPE:
                        break;
                case ' ':
@@ -5049,7 +5041,6 @@ static bool get_chara_limits(void)
                switch (c){
                case 'Q':
                        birth_quit();
-                       break;
                case 'S':
                        return (FALSE);
                case ESCAPE:
@@ -5198,6 +5189,127 @@ static bool get_chara_limits(void)
 }
 #endif
 
+static char histpref_buf[240];
+
+void add_history_from_pref_line(cptr t)
+{
+       int  limit = (sizeof histpref_buf) - 1;
+       int  i;
+
+       for (i = strlen(histpref_buf); *t && (i < limit); t++)
+       {
+#ifdef JP
+               if (iskanji(*t) || isprint(*t))
+#else
+               if (isprint(*t))
+#endif
+               {
+#ifdef JP
+                       if (iskanji(*t))
+                       {
+                               if (i + 1 >= limit) break;
+                               histpref_buf[i++] = *(t++);
+                       }
+#endif
+                       histpref_buf[i++] = *t;
+               }
+       }
+
+       /* Terminate */
+       histpref_buf[(i < limit) ? i : limit] = '\0';
+}
+
+
+static bool do_cmd_histpref(void)
+{
+       char buf[80];
+       errr err;
+       int i, j, n;
+       char *s, *t;
+       char temp[64 * 4];
+
+#ifdef JP
+       if (!get_check("À¸¤¤Î©¤ÁÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹¤«? ")) return FALSE;
+#else
+       if (!get_check("Load background history preference file? ")) return FALSE;
+#endif
+
+       /* Init buffer */
+       histpref_buf[0] = '\0';
+
+#ifdef JP
+       sprintf(buf, "histedit-%s.prf", player_name);
+#else
+       sprintf(buf, "histpref-%s.prf", player_name);
+#endif
+       err = process_histpref_file(buf);
+
+       /* Process 'hist????.prf' if 'hist????-<name>.prf' doesn't exist */
+       if (0 > err)
+       {
+#ifdef JP
+               strcpy(buf, "histedit.prf");
+#else
+               strcpy(buf, "histpref.prf");
+#endif
+               err = process_histpref_file(buf);
+       }
+
+       if (err)
+       {
+#ifdef JP
+               msg_print("À¸¤¤Î©¤ÁÀßÄê¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
+               msg_print("histedit.prf¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¡£");
+#else
+               msg_print("Failed to load background history preference.");
+               msg_print("Can't find histpref.prf");
+#endif
+               msg_print(NULL);
+
+               /* Terminate buffer */
+               histpref_buf[0] = '\0';
+               return FALSE;
+       }
+
+       /* Clear the previous history strings */
+       for (i = 0; i < 4; i++) p_ptr->history[i][0] = '\0';
+
+       /* Skip leading spaces */
+       for (s = histpref_buf; *s == ' '; s++) /* loop */;
+
+       /* Get apparent length */
+       n = strlen(s);
+
+       /* Kill trailing spaces */
+       while ((n > 0) && (s[n - 1] == ' ')) s[--n] = '\0';
+
+       roff_to_buf(s, 60, temp, sizeof(temp));
+       t = temp;
+       for (i = 0; i < 4; i++)
+       {
+               if (t[0] == 0) break;
+               else
+               {
+                       strcpy(p_ptr->history[i], t);
+                       t += strlen(t) + 1;
+               }
+       }
+
+       /* Turn 0 to space */
+       for (i = 0; i < 4; i++)
+       {
+               for (j = 0; p_ptr->history[i][j]; j++) /* loop */;
+
+               for (; j < 59; j++) p_ptr->history[i][j] = ' ';
+               p_ptr->history[i][59] = '\0';
+       }
+
+       /* Terminate buffer */
+       histpref_buf[0] = '\0';
+
+       return TRUE;
+}
+
 /*
  *  Character background edit-mode
  */
@@ -5224,8 +5336,10 @@ static void edit_history(void)
        display_player(1);
 #ifdef JP
        c_put_str(TERM_L_GREEN, "(¥­¥ã¥é¥¯¥¿¡¼¤ÎÀ¸¤¤Î©¤Á - ÊÔ½¸¥â¡¼¥É)", 11, 20);
+       put_str("[ 2/4/6/8¤Ç°ÜÆ°¡¢Enter¤Ç½ªÎ»¡¢Ctrl-F¤Ç¥Õ¥¡¥¤¥ëÆɤ߹þ¤ß ]", 17, 10);
 #else
        c_put_str(TERM_L_GREEN, "(Character Background - Edit Mode)", 11, 20);
+       put_str("[ 2/4/6/8 for Move, Enter for End, Ctrl-F for Read pref ]", 17, 10);
 #endif
 
        while (TRUE)
@@ -5293,10 +5407,24 @@ static void edit_history(void)
                }
                else if (c == '\r')
                {
+                       Term_erase(0, 11, 255);
+                       Term_erase(0, 17, 255);
+#ifdef JP
+                       put_str("(¥­¥ã¥é¥¯¥¿¡¼¤ÎÀ¸¤¤Î©¤Á - ÊÔ½¸ºÑ¤ß)", 11, 20);
+#else
+                       put_str("(Character Background - Edited)", 11, 20);
+#endif
                        break;
                }
                else if (c == ESCAPE)
                {
+                       clear_from(11);
+#ifdef JP
+                       put_str("(¥­¥ã¥é¥¯¥¿¡¼¤ÎÀ¸¤¤Î©¤Á)", 11, 25);
+#else
+                       put_str("(Character Background)", 11, 25);
+#endif
+
                        for (i = 0; i < 4; i++)
                        {
                                sprintf(p_ptr->history[i], "%s", old_history[i]);
@@ -5304,6 +5432,15 @@ static void edit_history(void)
                        }
                        break;
                }
+               else if (c == KTRL('F'))
+               {
+                       if (do_cmd_histpref())
+                       {
+#ifdef JP
+                               if ((x > 0) && (iskanji2(p_ptr->history[y], x - 1))) x--;
+#endif
+                       }
+               }
                else if (c == '\010')
                {
                        x--;
@@ -5581,17 +5718,17 @@ static bool player_birth_aux(void)
        p_ptr->prace = 0;
        while(1)
        {
-               char temp[80*9];
+               char temp[80*10];
                cptr t;
 
                if (!get_player_race()) return FALSE;
 
                clear_from(10);
 
-               roff_to_buf(race_jouhou[p_ptr->prace], 74, temp);
+               roff_to_buf(race_jouhou[p_ptr->prace], 74, temp, sizeof(temp));
                t = temp;
 
-               for (i = 0; i< 9; i++)
+               for (i = 0; i< 10; i++)
                {
                        if(t[0] == 0)
                                break; 
@@ -5602,9 +5739,9 @@ static bool player_birth_aux(void)
                        }
                }
 #ifdef JP
-               if (get_check("¤è¤í¤·¤¤¤Ç¤¹¤«¡©")) break;
+               if (get_check_strict("¤è¤í¤·¤¤¤Ç¤¹¤«¡©", CHECK_DEFAULT_Y)) break;
 #else
-               if (get_check("Are you sure? ")) break;
+               if (get_check_strict("Are you sure? ", CHECK_DEFAULT_Y)) break;
 #endif
                clear_from(10);
                c_put_str(TERM_WHITE, "              ", 4, 15);
@@ -5623,7 +5760,7 @@ static bool player_birth_aux(void)
                if (!get_player_class()) return FALSE;
 
                clear_from(10);
-               roff_to_buf(class_jouhou[p_ptr->pclass], 74, temp);
+               roff_to_buf(class_jouhou[p_ptr->pclass], 74, temp, sizeof(temp));
                t = temp;
 
                for (i = 0; i< 9; i++)
@@ -5638,9 +5775,9 @@ static bool player_birth_aux(void)
                }
 
 #ifdef JP
-               if (get_check("¤è¤í¤·¤¤¤Ç¤¹¤«¡©")) break;
+               if (get_check_strict("¤è¤í¤·¤¤¤Ç¤¹¤«¡©", CHECK_DEFAULT_Y)) break;
 #else
-               if (get_check("Are you sure? ")) break;
+               if (get_check_strict("Are you sure? ", CHECK_DEFAULT_Y)) break;
 #endif
                c_put_str(TERM_WHITE, "              ", 5, 15);
        }
@@ -5658,7 +5795,7 @@ static bool player_birth_aux(void)
                if (!get_player_seikaku()) return FALSE;
 
                clear_from(10);
-               roff_to_buf(seikaku_jouhou[p_ptr->pseikaku], 74, temp);
+               roff_to_buf(seikaku_jouhou[p_ptr->pseikaku], 74, temp, sizeof(temp));
                t = temp;
 
                for (i = 0; i< 6; i++)
@@ -5672,9 +5809,9 @@ static bool player_birth_aux(void)
                        }
                }
 #ifdef JP
-               if (get_check("¤è¤í¤·¤¤¤Ç¤¹¤«¡©")) break;
+               if (get_check_strict("¤è¤í¤·¤¤¤Ç¤¹¤«¡©", CHECK_DEFAULT_Y)) break;
 #else
-               if (get_check("Are you sure? ")) break;
+               if (get_check_strict("Are you sure? ", CHECK_DEFAULT_Y)) break;
 #endif
                c_put_str(TERM_L_BLUE, player_name, 1, 34);
                prt("", 1, 34+strlen(player_name));
@@ -5795,8 +5932,6 @@ static bool player_birth_aux(void)
        /* Clear */
        clear_from(10);
 
-       init_dungeon_quests(number_of_quests);
-
        /* Reset turn; before auto-roll and after choosing race */
        init_turn();
 
@@ -5881,7 +6016,7 @@ static bool player_birth_aux(void)
                                j = rp_ptr->r_adj[i] + cp_ptr->c_adj[i] + ap_ptr->a_adj[i];
 
                                /* Obtain the current stat */
-                               m = adjust_stat(stat_limit[i], j, TRUE);
+                               m = adjust_stat(stat_limit[i], j);
 
                                /* Put the stat */
                                cnv_stat(m, buf);
@@ -6166,6 +6301,8 @@ static bool player_birth_aux(void)
        /* Start over */
        if (c == 'S') return (FALSE);
 
+       init_dungeon_quests(number_of_quests);
+
        /* Save character data for quick start */
        save_prev_data(&previous_char);
        previous_char.quests = number_of_quests;
@@ -6204,9 +6341,9 @@ static bool ask_quick_start(void)
                char c;
 
 #ifdef JP
-               put_str("¥¯¥¤¥Ã¥¯¡¦¥¹¥¿¡¼¥È¤ò»È¤¤¤Þ¤¹¤«¡©[y/n]", 14, 10);
+               put_str("¥¯¥¤¥Ã¥¯¡¦¥¹¥¿¡¼¥È¤ò»È¤¤¤Þ¤¹¤«¡©[y/N]", 14, 10);
 #else
-               put_str("Use quick start? [y/n]", 14, 10);
+               put_str("Use quick start? [y/N]", 14, 10);
 #endif
                c = inkey();
 
@@ -6277,6 +6414,12 @@ void player_birth(void)
 
        playtime = 0;
 
+       /*
+        * Paranoia - wipe the pets
+        * For accuracy of precalc_cur_num_of_pet() called from wipe_m_list()
+        */
+       C_WIPE(party_mon, MAX_PARTY_MON, monster_type);
+
        /* 
         * Wipe monsters in old dungeon
         * This wipe destroys value of m_list[].cur_num .
@@ -6383,13 +6526,13 @@ void player_birth(void)
 
 void dump_yourself(FILE *fff)
 {
-       char temp[80*8];
+       char temp[80*10];
        int i;
        cptr t;
 
        if (!fff) return;
 
-       roff_to_buf(race_jouhou[p_ptr->prace], 78, temp);
+       roff_to_buf(race_jouhou[p_ptr->prace], 78, temp, sizeof(temp));
        fprintf(fff, "\n\n");
 #ifdef JP
        fprintf(fff, "¼ï²: %s\n", race_info[p_ptr->prace].title);
@@ -6397,14 +6540,14 @@ void dump_yourself(FILE *fff)
        fprintf(fff, "Race: %s\n", race_info[p_ptr->prace].title);
 #endif
        t = temp;
-       for (i = 0; i < 8; i++)
+       for (i = 0; i < 10; i++)
        {
                if(t[0] == 0)
                        break; 
                fprintf(fff, "%s\n",t);
                t += strlen(t) + 1;
        }
-       roff_to_buf(class_jouhou[p_ptr->pclass], 78, temp);
+       roff_to_buf(class_jouhou[p_ptr->pclass], 78, temp, sizeof(temp));
        fprintf(fff, "\n");
 #ifdef JP
        fprintf(fff, "¿¦¶È: %s\n", class_info[p_ptr->pclass].title);
@@ -6412,14 +6555,14 @@ void dump_yourself(FILE *fff)
        fprintf(fff, "Class: %s\n", class_info[p_ptr->pclass].title);
 #endif
        t = temp;
-       for (i = 0; i < 8; i++)
+       for (i = 0; i < 10; i++)
        {
                if(t[0] == 0)
                        break; 
                fprintf(fff, "%s\n",t);
                t += strlen(t) + 1;
        }
-       roff_to_buf(seikaku_jouhou[p_ptr->pseikaku], 78, temp);
+       roff_to_buf(seikaku_jouhou[p_ptr->pseikaku], 78, temp, sizeof(temp));
        fprintf(fff, "\n");
 #ifdef JP
        fprintf(fff, "À­³Ê: %s\n", seikaku_info[p_ptr->pseikaku].title);
@@ -6437,7 +6580,7 @@ void dump_yourself(FILE *fff)
        fprintf(fff, "\n");
        if (p_ptr->realm1)
        {
-               roff_to_buf(realm_jouhou[technic2magic(p_ptr->realm1)-1], 78, temp);
+               roff_to_buf(realm_jouhou[technic2magic(p_ptr->realm1)-1], 78, temp, sizeof(temp));
 #ifdef JP
                fprintf(fff, "ËâË¡: %s\n", realm_names[p_ptr->realm1]);
 #else
@@ -6455,7 +6598,7 @@ void dump_yourself(FILE *fff)
        fprintf(fff, "\n");
        if (p_ptr->realm2)
        {
-               roff_to_buf(realm_jouhou[technic2magic(p_ptr->realm2)-1], 78, temp);
+               roff_to_buf(realm_jouhou[technic2magic(p_ptr->realm2)-1], 78, temp, sizeof(temp));
 #ifdef JP
                fprintf(fff, "ËâË¡: %s\n", realm_names[p_ptr->realm2]);
 #else