OSDN Git Service

[Refactor] #37353 inside_quest を player_type から floor_type へ移動. / Move inside_quest...
[hengband/hengband.git] / src / birth.c
index f479f60..0e13817 100644 (file)
@@ -238,7 +238,7 @@ static concptr race_jouhou[MAX_RACES] =
 
 "A Kutar is an expressionless animal-like living creature.  The word 'kuta' means 'absentmindedly' or 'vacantly'.  Their absentmindedness hurts their searching and perception skills, but renders them incapable of being confused.  Their unearthly calmness and serenity make them among the most stealthy of any race.  Kutars, although expressionless, are beautiful and so have a high charisma.  Members of this race can learn to expand their body horizontally.  This increases armour class, but renders them vulnerable to magical attacks.",
 
-"An android is a artificial creation with a body of machinery.  They are poor at spell casting, but they make excellent warriors.  They don't acquire experience like other races, but rather gain in power as they attach new equipment to their frame.  Rings, amulets, and lights do not influence growth.  Androids are resistant to poison, can move freely, and are immune to exp-draining attacks.  Moreover, because of their hard metallic bodies, they get a bonus to AC.  Androids have electronic circuits throughout their body and must beware of electric shocks.  They gain very little nutrition from the food of mortals, but they can use flasks of oil as their energy source."
+"An android is a artificial creation with a body of machinery.  They are poor at spell casting, but they make excellent warriors.  They don't acquire experience like other races, but rather gain in power as they attach new equipment to their frame.  Rings, amulets, and lights do not influence growth.  Androids are resistant to poison, can move freely, and are immune to exp-draining attacks.  Moreover, because of their hard metallic bodies, they get a bonus to AC.  Androids have electronic circuits throughout their body and must beware of electric shocks.  They gain very little nutrition from the food of mortals, but they can use flasks of oil as their energy source.",
 
 "Merfolk implementing.",
 
@@ -422,7 +422,7 @@ static concptr seikaku_jouhou[MAX_SEIKAKU] =
 
 "\"munchkin\" is a personality for beginners.  It raises all your stats and skills.  With this personality, you can win the game easily, but gain little honor in doing so.",
 
-"\ChargeMan\" is crazy killer. It render you powerfull strength and constitution, but poor intelligence.you are not confused and seen the illusion because this you go mad from the beginning.",
+"\"ChargeMan\" is crazy killer. It render you powerfull strength and constitution, but poor intelligence.you are not confused and seen the illusion because this you go mad from the beginning.",
 
 #endif
 };
@@ -1536,13 +1536,13 @@ void get_height_weight(player_type *creature_ptr)
  * @details 内部でget_height_weight()も呼び出している。
  * @return なし
  */
-static void get_ahw(void)
+static void get_ahw(player_type *creature_ptr)
 {
        /* Get character's age */
-       p_ptr->age = rp_ptr->b_age + randint1(rp_ptr->m_age);
+       creature_ptr->age = rp_ptr->b_age + randint1(rp_ptr->m_age);
 
        /* Get character's height and weight */
-       get_height_weight(p_ptr);
+       get_height_weight(creature_ptr);
 }
 
 /*!
@@ -1585,10 +1585,10 @@ static void get_money(player_type *creature_ptr)
 
 /*!
  * @brief put_stats()のサブルーチンとして、オートロール中のステータスを表示する / Display stat values, subset of "put_stats()"
- * @details See 'display_player()' for screen layout constraints.
+ * @details See 'display_player(p_ptr, )' for screen layout constraints.
  * @return なし
  */
-static void birth_put_stats(void)
+static void birth_put_stats(player_type *creature_ptr)
 {
        int i, j, m, p;
        int col;
@@ -1606,7 +1606,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);
+                       m = adjust_stat(creature_ptr->stat_max[i], j);
 
                        /* Put the stat */
                        cnv_stat(m, buf);
@@ -1682,6 +1682,9 @@ static void player_wipe_without_name(player_type *creature_ptr)
        /* Hack -- zero the struct */
        (void)WIPE(creature_ptr, player_type);
 
+       //TODO: キャラ作成からゲーム開始までに  current_floor_ptr を参照しなければならない処理は今後整理して外す。
+       creature_ptr->current_floor_ptr = &floor_info;
+
        C_MAKE(creature_ptr->inventory_list, INVEN_TOTAL, object_type);
 
        /* Wipe the history */
@@ -1799,7 +1802,7 @@ static void player_wipe_without_name(player_type *creature_ptr)
 
        /* Assume no cheating */
        creature_ptr->noscore = 0;
-       creature_ptr->wizard = FALSE;
+       current_world_ptr->wizard = FALSE;
 
        /* Not waiting to report score */
        creature_ptr->wait_report_score = FALSE;
@@ -1809,7 +1812,7 @@ static void player_wipe_without_name(player_type *creature_ptr)
        creature_ptr->pet_extra_flags = (PF_TELEPORT | PF_ATTACK_SPELL | PF_SUMMON_SPELL);
 
        /* Wipe the recall depths */
-       for (i = 0; i < max_d_idx; i++)
+       for (i = 0; i < current_world_ptr->max_d_idx; i++)
        {
                max_dlv[i] = 0;
        }
@@ -1831,7 +1834,7 @@ static void player_wipe_without_name(player_type *creature_ptr)
        /* Initialize arena and rewards information -KMW- */
        creature_ptr->arena_number = 0;
        creature_ptr->inside_arena = FALSE;
-       creature_ptr->inside_quest = 0;
+       creature_ptr->current_floor_ptr->inside_quest = 0;
        for (i = 0; i < MAX_MANE; i++)
        {
                creature_ptr->mane_spell[i] = -1;
@@ -1876,18 +1879,18 @@ static void player_wipe_without_name(player_type *creature_ptr)
  * @brief ダンジョン内部のクエストを初期化する / Initialize random quests and final quests
  * @return なし
  */
-static void init_dungeon_quests(void)
+static void init_dungeon_quests(player_type *creature_ptr)
 {
        int number_of_quests = MAX_RANDOM_QUEST - MIN_RANDOM_QUEST + 1;
        int i;
 
        /* Init the random quests */
        init_flags = INIT_ASSIGN;
-       p_ptr->inside_quest = MIN_RANDOM_QUEST;
+       creature_ptr->current_floor_ptr->inside_quest = MIN_RANDOM_QUEST;
 
        process_dungeon_file("q_info.txt", 0, 0, 0, 0);
 
-       p_ptr->inside_quest = 0;
+       creature_ptr->current_floor_ptr->inside_quest = 0;
 
        /* Generate quests */
        for (i = MIN_RANDOM_QUEST + number_of_quests - 1; i >= MIN_RANDOM_QUEST; i--)
@@ -1907,31 +1910,31 @@ static void init_dungeon_quests(void)
 
        /* Init the two main quests (Oberon + Serpent) */
        init_flags = INIT_ASSIGN;
-       p_ptr->inside_quest = QUEST_OBERON;
+       creature_ptr->current_floor_ptr->inside_quest = QUEST_OBERON;
 
        process_dungeon_file("q_info.txt", 0, 0, 0, 0);
 
        quest[QUEST_OBERON].status = QUEST_STATUS_TAKEN;
 
-       p_ptr->inside_quest = QUEST_SERPENT;
+       creature_ptr->current_floor_ptr->inside_quest = QUEST_SERPENT;
 
        process_dungeon_file("q_info.txt", 0, 0, 0, 0);
 
        quest[QUEST_SERPENT].status = QUEST_STATUS_TAKEN;
-       p_ptr->inside_quest = 0;
+       creature_ptr->current_floor_ptr->inside_quest = 0;
 }
 
 /*!
- * @brief ゲームターンを初期化する / Reset current_world_ptr->game_turn
+ * @brief ゲームターンを初期化する / Reset turn
  * @details アンデッド系種族は開始時刻を夜からにする。
  * @return なし
  */
-static void init_turn(void)
+static void init_turn(player_type *creature_ptr)
 {
-       if ((p_ptr->prace == RACE_VAMPIRE) ||
-               (p_ptr->prace == RACE_SKELETON) ||
-               (p_ptr->prace == RACE_ZOMBIE) ||
-               (p_ptr->prace == RACE_SPECTRE))
+       if ((creature_ptr->prace == RACE_VAMPIRE) ||
+               (creature_ptr->prace == RACE_SKELETON) ||
+               (creature_ptr->prace == RACE_ZOMBIE) ||
+               (creature_ptr->prace == RACE_SPECTRE))
        {
                /* Undead start just after midnight */
                current_world_ptr->game_turn = (TURNS_PER_TICK*3 * TOWN_DAWN) / 4 + 1;
@@ -1950,10 +1953,9 @@ static void init_turn(void)
 
 /*!
  * @brief 所持状態にあるアイテムの中から一部枠の装備可能なものを装備させる。
- * @details アンデッド系種族は開始時刻を夜からにする。
  * @return なし
  */
-static void wield_all(void
+static void wield_all(player_type *creature_ptr
 { 
        object_type *o_ptr; 
        object_type *i_ptr; 
@@ -1965,7 +1967,7 @@ static void wield_all(void)
        /* Scan through the slots backwards */ 
        for (item = INVEN_PACK - 1; item >= 0; item--) 
        { 
-               o_ptr = &p_ptr->inventory_list[item]; 
+               o_ptr = &creature_ptr->inventory_list[item]; 
  
                /* Skip non-objects */ 
                if (!o_ptr->k_idx) continue; 
@@ -1974,7 +1976,7 @@ static void wield_all(void)
                slot = wield_slot(o_ptr); 
                if (slot < INVEN_RARM) continue; 
                if (slot == INVEN_LITE) continue; /* Does not wield toaches because buys a lantern soon */
-               if (p_ptr->inventory_list[slot].k_idx) continue; 
+               if (creature_ptr->inventory_list[slot].k_idx) continue; 
  
                i_ptr = &object_type_body; 
                object_copy(i_ptr, o_ptr); 
@@ -1994,12 +1996,12 @@ static void wield_all(void)
                        floor_item_optimize(0 - item); 
                } 
  
-               o_ptr = &p_ptr->inventory_list[slot]; 
+               o_ptr = &creature_ptr->inventory_list[slot]; 
                object_copy(o_ptr, i_ptr); 
-               p_ptr->total_weight += i_ptr->weight; 
+               creature_ptr->total_weight += i_ptr->weight; 
  
                /* Increment the equip counter by hand */ 
-               p_ptr->equip_cnt++;
+               creature_ptr->equip_cnt++;
 
        } 
        return; 
@@ -2213,7 +2215,7 @@ static byte player_init[MAX_CLASS][3][2] =
  * @param o_ptr 処理したいオブジェクト構造体の参照ポインタ
  * @return なし
  */
-static void add_outfit(object_type *o_ptr)
+static void add_outfit(player_type *creature_ptr, object_type *o_ptr)
 {
        s16b slot;
 
@@ -2225,7 +2227,7 @@ static void add_outfit(object_type *o_ptr)
        autopick_alter_item(slot, FALSE);
 
        /* Now try wielding everything */ 
-       wield_all(); 
+       wield_all(creature_ptr); 
 }
 
 
@@ -2234,7 +2236,7 @@ static void add_outfit(object_type *o_ptr)
  * @details Having an item makes the player "aware" of its purpose.
  * @return なし
  */
-void player_outfit(void)
+void player_outfit(player_type *creature_ptr)
 {
        int i;
        OBJECT_TYPE_VALUE tv;
@@ -2246,7 +2248,7 @@ void player_outfit(void)
        q_ptr = &forge;
 
        /* Give the player some food */
-       switch (p_ptr->prace)
+       switch (creature_ptr->prace)
        {
        case RACE_VAMPIRE:
                /* Nothing! */
@@ -2264,7 +2266,7 @@ void player_outfit(void)
                        if(q_ptr->pval)
                        {
                                q_ptr->number = 1;
-                               add_outfit(q_ptr);
+                               add_outfit(creature_ptr, q_ptr);
                        }
                }
                break;
@@ -2277,14 +2279,14 @@ void player_outfit(void)
                object_prep(q_ptr, lookup_kind(TV_STAFF, SV_STAFF_NOTHING));
                q_ptr->number = 1;
 
-               add_outfit(q_ptr);
+               add_outfit(creature_ptr, q_ptr);
                break;
 
        case RACE_ENT:
                /* Potions of Water */
                object_prep(q_ptr, lookup_kind(TV_POTION, SV_POTION_WATER));
                q_ptr->number = (ITEM_NUMBER)rand_range(15, 23);
-               add_outfit(q_ptr);
+               add_outfit(creature_ptr, q_ptr);
 
                break;
 
@@ -2296,7 +2298,7 @@ void player_outfit(void)
                apply_magic(q_ptr, 1, AM_NO_FIXED_ART);
 
                q_ptr->number = (ITEM_NUMBER)rand_range(7, 12);
-               add_outfit(q_ptr);
+               add_outfit(creature_ptr, q_ptr);
 
                break;
 
@@ -2305,70 +2307,70 @@ void player_outfit(void)
                object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));
                q_ptr->number = (ITEM_NUMBER)rand_range(3, 7);
 
-               add_outfit(q_ptr);
+               add_outfit(creature_ptr, q_ptr);
        }
        q_ptr = &forge;
 
-       if ((p_ptr->prace == RACE_VAMPIRE) && (p_ptr->pclass != CLASS_NINJA))
+       if ((creature_ptr->prace == RACE_VAMPIRE) && (creature_ptr->pclass != CLASS_NINJA))
        {
                /* Hack -- Give the player scrolls of DARKNESS! */
                object_prep(q_ptr, lookup_kind(TV_SCROLL, SV_SCROLL_DARKNESS));
 
                q_ptr->number = (ITEM_NUMBER)rand_range(2, 5);
 
-               add_outfit(q_ptr);
+               add_outfit(creature_ptr, q_ptr);
        }
-       else if (p_ptr->pclass != CLASS_NINJA)
+       else if (creature_ptr->pclass != CLASS_NINJA)
        {
                /* Hack -- Give the player some torches */
                object_prep(q_ptr, lookup_kind(TV_LITE, SV_LITE_TORCH));
                q_ptr->number = (ITEM_NUMBER)rand_range(3, 7);
                q_ptr->xtra4 = rand_range(3, 7) * 500;
 
-               add_outfit(q_ptr);
+               add_outfit(creature_ptr, q_ptr);
        }
        q_ptr = &forge;
 
-       if (p_ptr->prace == RACE_MERFOLK)
+       if (creature_ptr->prace == RACE_MERFOLK)
        {
                object_prep(q_ptr, lookup_kind(TV_RING, SV_RING_LEVITATION_FALL));
                q_ptr->number = 1;
-               add_outfit(q_ptr);
+               add_outfit(creature_ptr, q_ptr);
        }
 
-       if ((p_ptr->pclass == CLASS_RANGER) || (p_ptr->pclass == CLASS_CAVALRY))
+       if ((creature_ptr->pclass == CLASS_RANGER) || (creature_ptr->pclass == CLASS_CAVALRY))
        {
                /* Hack -- Give the player some arrows */
                object_prep(q_ptr, lookup_kind(TV_ARROW, SV_AMMO_NORMAL));
                q_ptr->number = (byte)rand_range(15, 20);
 
-               add_outfit(q_ptr);
+               add_outfit(creature_ptr, q_ptr);
        }
-       if (p_ptr->pclass == CLASS_RANGER)
+       if (creature_ptr->pclass == CLASS_RANGER)
        {
                /* Hack -- Give the player some arrows */
                object_prep(q_ptr, lookup_kind(TV_BOW, SV_SHORT_BOW));
 
-               add_outfit(q_ptr);
+               add_outfit(creature_ptr, q_ptr);
        }
-       else if (p_ptr->pclass == CLASS_ARCHER)
+       else if (creature_ptr->pclass == CLASS_ARCHER)
        {
                /* Hack -- Give the player some arrows */
                object_prep(q_ptr, lookup_kind(TV_ARROW, SV_AMMO_NORMAL));
                q_ptr->number = (ITEM_NUMBER)rand_range(15, 20);
 
-               add_outfit(q_ptr);
+               add_outfit(creature_ptr, q_ptr);
        }
-       else if (p_ptr->pclass == CLASS_HIGH_MAGE)
+       else if (creature_ptr->pclass == CLASS_HIGH_MAGE)
        {
                /* Hack -- Give the player some arrows */
                object_prep(q_ptr, lookup_kind(TV_WAND, SV_WAND_MAGIC_MISSILE));
                q_ptr->number = 1;
                q_ptr->pval = (PARAMETER_VALUE)rand_range(25, 30);
 
-               add_outfit(q_ptr);
+               add_outfit(creature_ptr, q_ptr);
        }
-       else if (p_ptr->pclass == CLASS_SORCERER)
+       else if (creature_ptr->pclass == CLASS_SORCERER)
        {
                OBJECT_TYPE_VALUE book_tval;
                for (book_tval = TV_LIFE_BOOK; book_tval <= TV_LIFE_BOOK+MAX_MAGIC-1; book_tval++)
@@ -2377,86 +2379,86 @@ void player_outfit(void)
                        object_prep(q_ptr, lookup_kind(book_tval, 0));
                        q_ptr->number = 1;
 
-                       add_outfit(q_ptr);
+                       add_outfit(creature_ptr, q_ptr);
                }
        }
-       else if (p_ptr->pclass == CLASS_TOURIST)
+       else if (creature_ptr->pclass == CLASS_TOURIST)
        {
-               if (p_ptr->pseikaku != SEIKAKU_SEXY)
+               if (creature_ptr->pseikaku != SEIKAKU_SEXY)
                {
                        /* Hack -- Give the player some arrows */
                        object_prep(q_ptr, lookup_kind(TV_SHOT, SV_AMMO_LIGHT));
                        q_ptr->number = rand_range(15, 20);
 
-                       add_outfit(q_ptr);
+                       add_outfit(creature_ptr, q_ptr);
                }
 
                object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_BISCUIT));
                q_ptr->number = rand_range(2, 4);
 
-               add_outfit(q_ptr);
+               add_outfit(creature_ptr, q_ptr);
 
                object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_WAYBREAD));
                q_ptr->number = rand_range(2, 4);
 
-               add_outfit(q_ptr);
+               add_outfit(creature_ptr, q_ptr);
 
                object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_JERKY));
                q_ptr->number = rand_range(1, 3);
 
-               add_outfit(q_ptr);
+               add_outfit(creature_ptr, q_ptr);
 
                object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_PINT_OF_ALE));
                q_ptr->number = rand_range(2, 4);
 
-               add_outfit(q_ptr);
+               add_outfit(creature_ptr, q_ptr);
 
                object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_PINT_OF_WINE));
                q_ptr->number = rand_range(2, 4);
 
-               add_outfit(q_ptr);
+               add_outfit(creature_ptr, q_ptr);
        }
-       else if (p_ptr->pclass == CLASS_NINJA)
+       else if (creature_ptr->pclass == CLASS_NINJA)
        {
                /* Hack -- Give the player some arrows */
                object_prep(q_ptr, lookup_kind(TV_SPIKE, 0));
                q_ptr->number = rand_range(15, 20);
 
-               add_outfit(q_ptr);
+               add_outfit(creature_ptr, q_ptr);
        }
-       else if (p_ptr->pclass == CLASS_SNIPER)
+       else if (creature_ptr->pclass == CLASS_SNIPER)
        {
                /* Hack -- Give the player some bolts */
                object_prep(q_ptr, lookup_kind(TV_BOLT, SV_AMMO_NORMAL));
                q_ptr->number = rand_range(15, 20);
 
-               add_outfit(q_ptr);
+               add_outfit(creature_ptr, q_ptr);
        }
 
-       if(p_ptr->pseikaku == SEIKAKU_SEXY)
+       if(creature_ptr->pseikaku == SEIKAKU_SEXY)
        {
-               player_init[p_ptr->pclass][2][0] = TV_HAFTED;
-               player_init[p_ptr->pclass][2][1] = SV_WHIP;
+               player_init[creature_ptr->pclass][2][0] = TV_HAFTED;
+               player_init[creature_ptr->pclass][2][1] = SV_WHIP;
        }
 
        /* Hack -- Give the player three useful objects */
        for (i = 0; i < 3; i++)
        {
                /* Look up standard equipment */
-               tv = player_init[p_ptr->pclass][i][0];
-               sv = player_init[p_ptr->pclass][i][1];
+               tv = player_init[creature_ptr->pclass][i][0];
+               sv = player_init[creature_ptr->pclass][i][1];
 
-               if ((p_ptr->prace == RACE_ANDROID) && ((tv == TV_SOFT_ARMOR) || (tv == TV_HARD_ARMOR))) continue;
+               if ((creature_ptr->prace == RACE_ANDROID) && ((tv == TV_SOFT_ARMOR) || (tv == TV_HARD_ARMOR))) continue;
                /* Hack to initialize spellbooks */
-               if (tv == TV_SORCERY_BOOK) tv = TV_LIFE_BOOK + p_ptr->realm1 - 1;
-               else if (tv == TV_DEATH_BOOK) tv = TV_LIFE_BOOK + p_ptr->realm2 - 1;
+               if (tv == TV_SORCERY_BOOK) tv = TV_LIFE_BOOK + creature_ptr->realm1 - 1;
+               else if (tv == TV_DEATH_BOOK) tv = TV_LIFE_BOOK + creature_ptr->realm2 - 1;
 
                else if (tv == TV_RING && sv == SV_RING_RES_FEAR &&
-                   p_ptr->prace == RACE_BARBARIAN)
+                   creature_ptr->prace == RACE_BARBARIAN)
                        /* Barbarians do not need a ring of resist fear */
                        sv = SV_RING_SUSTAIN_STR;
 
-               else if (tv == TV_RING && sv == SV_RING_SUSTAIN_INT && p_ptr->prace == RACE_MIND_FLAYER)
+               else if (tv == TV_RING && sv == SV_RING_SUSTAIN_INT && creature_ptr->prace == RACE_MIND_FLAYER)
                {
                        tv = TV_POTION;
                        sv = SV_POTION_RESTORE_MANA;
@@ -2467,13 +2469,13 @@ void player_outfit(void)
                object_prep(q_ptr, lookup_kind(tv, sv));
 
                /* Assassins begin the game with a poisoned dagger */
-               if ((tv == TV_SWORD || tv == TV_HAFTED) && (p_ptr->pclass == CLASS_ROGUE &&
-                       p_ptr->realm1 == REALM_DEATH)) /* Only assassins get a poisoned weapon */
+               if ((tv == TV_SWORD || tv == TV_HAFTED) && (creature_ptr->pclass == CLASS_ROGUE &&
+                       creature_ptr->realm1 == REALM_DEATH)) /* Only assassins get a poisoned weapon */
                {
                        q_ptr->name2 = EGO_BRAND_POIS;
                }
 
-               add_outfit(q_ptr);
+               add_outfit(creature_ptr, q_ptr);
        }
 
        /* Hack -- make aware of the water */
@@ -2484,7 +2486,7 @@ void player_outfit(void)
  * @brief プレイヤーの種族選択を行う / Player race
  * @return なし
  */
-static bool get_player_race(void)
+static bool get_player_race(player_type *creature_ptr)
 {
        int     k, n, cs, os;
        concptr    str;
@@ -2519,7 +2521,7 @@ static bool get_player_race(void)
 
        /* Choose */
        k = -1;
-       cs = p_ptr->prace;
+       cs = creature_ptr->prace;
        os = MAX_RACES;
        while (1)
        {
@@ -2627,9 +2629,9 @@ static bool get_player_race(void)
        }
 
        /* Set race */
-       p_ptr->prace = (byte_hack)k;
+       creature_ptr->prace = (byte_hack)k;
 
-       rp_ptr = &race_info[p_ptr->prace];
+       rp_ptr = &race_info[creature_ptr->prace];
 
        /* Display */
        c_put_str(TERM_L_BLUE, rp_ptr->title, 4, 15);
@@ -2643,7 +2645,7 @@ static bool get_player_race(void)
  * @brief プレイヤーの職業選択を行う / Player class
  * @return なし
  */
-static bool get_player_class(void)
+static bool get_player_class(player_type *creature_ptr)
 {
        int     k, n, cs, os;
        char    c;
@@ -2687,7 +2689,7 @@ static bool get_player_class(void)
 
        /* Get a class */
        k = -1;
-       cs = p_ptr->pclass;
+       cs = creature_ptr->pclass;
        os = MAX_CLASS_CHOICE;
        while (1)
        {
@@ -2799,9 +2801,9 @@ static bool get_player_class(void)
        }
 
        /* Set class */
-       p_ptr->pclass = (byte_hack)k;
-       cp_ptr = &class_info[p_ptr->pclass];
-       mp_ptr = &m_info[p_ptr->pclass];
+       creature_ptr->pclass = (byte_hack)k;
+       cp_ptr = &class_info[creature_ptr->pclass];
+       mp_ptr = &m_info[creature_ptr->pclass];
 
        /* Display */
        c_put_str(TERM_L_BLUE, cp_ptr->title, 5, 15);
@@ -2814,7 +2816,7 @@ static bool get_player_class(void)
  * @brief プレイヤーの性格選択を行う / Player Player seikaku
  * @return なし
  */
-static bool get_player_seikaku(void)
+static bool get_player_seikaku(player_type *creature_ptr)
 {
        int k;
        int n, os, cs;
@@ -2832,7 +2834,7 @@ static bool get_player_seikaku(void)
        /* Dump seikakus */
        for (n = 0; n < MAX_SEIKAKU; n++)
        {
-               if(seikaku_info[n].sex && (seikaku_info[n].sex != (p_ptr->psex+1))) continue;
+               if(seikaku_info[n].sex && (seikaku_info[n].sex != (creature_ptr->psex+1))) continue;
 
                /* Analyze */
                ap_ptr = &seikaku_info[n];
@@ -2851,7 +2853,7 @@ static bool get_player_seikaku(void)
 
        /* Get a seikaku */
        k = -1;
-       cs = p_ptr->pseikaku;
+       cs = creature_ptr->pseikaku;
        os = MAX_SEIKAKU;
        while (1)
        {
@@ -2899,7 +2901,7 @@ static bool get_player_seikaku(void)
                                {
                                        k = randint0(MAX_SEIKAKU);
                                }
-                               while(seikaku_info[k].sex && (seikaku_info[k].sex != (p_ptr->psex+1)));
+                               while(seikaku_info[k].sex && (seikaku_info[k].sex != (creature_ptr->psex+1)));
                                cs = k;
                                continue;
                        }
@@ -2915,14 +2917,14 @@ static bool get_player_seikaku(void)
                        {
                                k = randint0(n);
                        }
-                       while(seikaku_info[k].sex && (seikaku_info[k].sex != (p_ptr->psex+1)));
+                       while(seikaku_info[k].sex && (seikaku_info[k].sex != (creature_ptr->psex+1)));
                        cs = k;
                        continue;
                }
                if (c == '8')
                {
                        if (cs >= 4) cs -= 4;
-                       if (cs != MAX_SEIKAKU && seikaku_info[cs].sex && (seikaku_info[cs].sex != (p_ptr->psex+1)))
+                       if (cs != MAX_SEIKAKU && seikaku_info[cs].sex && (seikaku_info[cs].sex != (creature_ptr->psex+1)))
                        {
                                if((cs - 4) > 0)
                                        cs -= 4;
@@ -2933,7 +2935,7 @@ static bool get_player_seikaku(void)
                if (c == '4')
                {
                        if (cs > 0) cs--;
-                       if (cs != MAX_SEIKAKU && seikaku_info[cs].sex && (seikaku_info[cs].sex != (p_ptr->psex+1)))
+                       if (cs != MAX_SEIKAKU && seikaku_info[cs].sex && (seikaku_info[cs].sex != (creature_ptr->psex+1)))
                        {
                                if((cs - 1) > 0)
                                        cs--;
@@ -2944,7 +2946,7 @@ static bool get_player_seikaku(void)
                if (c == '6')
                {
                        if (cs < MAX_SEIKAKU) cs++;
-                       if (cs != MAX_SEIKAKU && seikaku_info[cs].sex && (seikaku_info[cs].sex != (p_ptr->psex+1)))
+                       if (cs != MAX_SEIKAKU && seikaku_info[cs].sex && (seikaku_info[cs].sex != (creature_ptr->psex+1)))
                        {
                                if((cs + 1) <= MAX_SEIKAKU)
                                        cs++;
@@ -2955,7 +2957,7 @@ static bool get_player_seikaku(void)
                if (c == '2')
                {
                        if ((cs + 4) <= MAX_SEIKAKU) cs += 4;
-                       if (cs != MAX_SEIKAKU && seikaku_info[cs].sex && (seikaku_info[cs].sex != (p_ptr->psex+1)))
+                       if (cs != MAX_SEIKAKU && seikaku_info[cs].sex && (seikaku_info[cs].sex != (creature_ptr->psex+1)))
                        {
                                if((cs + 4) <= MAX_SEIKAKU)
                                        cs += 4;
@@ -2966,7 +2968,7 @@ static bool get_player_seikaku(void)
                k = (islower(c) ? A2I(c) : -1);
                if ((k >= 0) && (k < MAX_SEIKAKU))
                {
-                       if((seikaku_info[k].sex == 0) || (seikaku_info[k].sex == (p_ptr->psex+1)))
+                       if((seikaku_info[k].sex == 0) || (seikaku_info[k].sex == (creature_ptr->psex+1)))
                        {
                                cs = k;
                                continue;
@@ -2975,7 +2977,7 @@ static bool get_player_seikaku(void)
                k = (isupper(c) ? (26 + c - 'A') : -1);
                if ((k >= 26) && (k < MAX_SEIKAKU))
                {
-                       if((seikaku_info[k].sex == 0) || (seikaku_info[k].sex == (p_ptr->psex+1)))
+                       if((seikaku_info[k].sex == 0) || (seikaku_info[k].sex == (creature_ptr->psex+1)))
                        {
                                cs = k;
                                continue;
@@ -3000,8 +3002,8 @@ static bool get_player_seikaku(void)
        }
 
        /* Set seikaku */
-       p_ptr->pseikaku = (CHARACTER_IDX)k;
-       ap_ptr = &seikaku_info[p_ptr->pseikaku];
+       creature_ptr->pseikaku = (CHARACTER_IDX)k;
+       ap_ptr = &seikaku_info[creature_ptr->pseikaku];
 #ifdef JP
        strcpy(tmp, ap_ptr->title);
        if(ap_ptr->no == 1)
@@ -3010,7 +3012,7 @@ static bool get_player_seikaku(void)
        strcpy(tmp, ap_ptr->title);
        strcat(tmp," ");
 #endif
-       strcat(tmp,p_ptr->name);
+       strcat(tmp,creature_ptr->name);
 
        c_put_str(TERM_L_BLUE, tmp, 1, 34);
 
@@ -3547,7 +3549,7 @@ void add_history_from_pref_line(concptr t)
  * @brief 生い立ちメッセージをファイルからロードする。
  * @return なし
  */
-static bool do_cmd_histpref(void)
+static bool do_cmd_histpref(player_type *creature_ptr)
 {
        char buf[80];
        errr err;
@@ -3563,9 +3565,9 @@ static bool do_cmd_histpref(void)
        histpref_buf = histbuf;
 
 #ifdef JP
-       sprintf(buf, "histedit-%s.prf", p_ptr->base_name);
+       sprintf(buf, "histedit-%s.prf", creature_ptr->base_name);
 #else
-       sprintf(buf, "histpref-%s.prf", p_ptr->base_name);
+       sprintf(buf, "histpref-%s.prf", creature_ptr->base_name);
 #endif
        err = process_histpref_file(buf);
 
@@ -3602,7 +3604,7 @@ static bool do_cmd_histpref(void)
        }
 
        /* Clear the previous history strings */
-       for (i = 0; i < 4; i++) p_ptr->history[i][0] = '\0';
+       for (i = 0; i < 4; i++) creature_ptr->history[i][0] = '\0';
 
        /* Skip leading spaces */
        for (s = histpref_buf; *s == ' '; s++) /* loop */;
@@ -3620,7 +3622,7 @@ static bool do_cmd_histpref(void)
                if (t[0] == 0) break;
                else
                {
-                       strcpy(p_ptr->history[i], t);
+                       strcpy(creature_ptr->history[i], t);
                        t += strlen(t) + 1;
                }
        }
@@ -3628,10 +3630,10 @@ static bool do_cmd_histpref(void)
        /* Fill the remaining spaces */
        for (i = 0; i < 4; i++)
        {
-               for (j = 0; p_ptr->history[i][j]; j++) /* loop */;
+               for (j = 0; creature_ptr->history[i][j]; j++) /* loop */;
 
-               for (; j < 59; j++) p_ptr->history[i][j] = ' ';
-               p_ptr->history[i][59] = '\0';
+               for (; j < 59; j++) creature_ptr->history[i][j] = ' ';
+               creature_ptr->history[i][59] = '\0';
        }
 
        /* Kill the buffer */
@@ -3644,7 +3646,7 @@ static bool do_cmd_histpref(void)
  * @brief 生い立ちメッセージを編集する。/Character background edit-mode
  * @return なし
  */
-static void edit_history(void)
+static void edit_history(player_type *creature_ptr)
 {
        char old_history[4][60];
        TERM_LEN y = 0, x = 0;
@@ -3653,17 +3655,17 @@ static void edit_history(void)
        /* Edit character background */
        for (i = 0; i < 4; i++)
        {
-               sprintf(old_history[i], "%s", p_ptr->history[i]);
+               sprintf(old_history[i], "%s", creature_ptr->history[i]);
        }
        /* Turn 0 to space */
        for (i = 0; i < 4; i++)
        {
-               for (j = 0; p_ptr->history[i][j]; j++) /* loop */;
+               for (j = 0; creature_ptr->history[i][j]; j++) /* loop */;
 
-               for (; j < 59; j++) p_ptr->history[i][j] = ' ';
-               p_ptr->history[i][59] = '\0';
+               for (; j < 59; j++) creature_ptr->history[i][j] = ' ';
+               creature_ptr->history[i][59] = '\0';
        }
-       display_player(1);
+       display_player(p_ptr, 1);
 #ifdef JP
        c_put_str(TERM_L_GREEN, "(キャラクターの生い立ち - 編集モード)", 11, 20);
        put_str("[ カーソルキーで移動、Enterで終了、Ctrl-Aでファイル読み込み ]", 17, 10);
@@ -3679,14 +3681,14 @@ static void edit_history(void)
 
                for (i = 0; i < 4; i++)
                {
-                       put_str(p_ptr->history[i], i + 12, 10);
+                       put_str(creature_ptr->history[i], i + 12, 10);
                }
 #ifdef JP
-               if (iskanji2(p_ptr->history[y], x))
-                       c_put_str(TERM_L_BLUE, format("%c%c", p_ptr->history[y][x],p_ptr->history[y][x+1]), y + 12, x + 10);
+               if (iskanji2(creature_ptr->history[y], x))
+                       c_put_str(TERM_L_BLUE, format("%c%c", creature_ptr->history[y][x],creature_ptr->history[y][x+1]), y + 12, x + 10);
                else
 #endif
-               c_put_str(TERM_L_BLUE, format("%c", p_ptr->history[y][x]), y + 12, x + 10);
+               c_put_str(TERM_L_BLUE, format("%c", creature_ptr->history[y][x]), y + 12, x + 10);
 
                /* Place cursor just after cost of current stat */
                Term_gotoxy(x + 10, y + 12);
@@ -3703,7 +3705,7 @@ static void edit_history(void)
                        y--;
                        if (y < 0) y = 3;
 #ifdef JP
-                       if ((x > 0) && (iskanji2(p_ptr->history[y], x-1))) x--;
+                       if ((x > 0) && (iskanji2(creature_ptr->history[y], x-1))) x--;
 #endif
                }
                else if (skey == SKEY_DOWN || c == KTRL('n'))
@@ -3711,13 +3713,13 @@ static void edit_history(void)
                        y++;
                        if (y > 3) y = 0;
 #ifdef JP
-                       if ((x > 0) && (iskanji2(p_ptr->history[y], x-1))) x--;
+                       if ((x > 0) && (iskanji2(creature_ptr->history[y], x-1))) x--;
 #endif
                }
                else if (skey == SKEY_RIGHT || c == KTRL('f'))
                {
 #ifdef JP
-                       if (iskanji2(p_ptr->history[y], x)) x++;
+                       if (iskanji2(creature_ptr->history[y], x)) x++;
 #endif
                        x++;
                        if (x > 58)
@@ -3740,7 +3742,7 @@ static void edit_history(void)
                        }
 
 #ifdef JP
-                       if ((x > 0) && (iskanji2(p_ptr->history[y], x-1))) x--;
+                       if ((x > 0) && (iskanji2(creature_ptr->history[y], x-1))) x--;
 #endif
                }
                else if (c == '\r' || c == '\n')
@@ -3765,17 +3767,17 @@ static void edit_history(void)
 
                        for (i = 0; i < 4; i++)
                        {
-                               sprintf(p_ptr->history[i], "%s", old_history[i]);
-                               put_str(p_ptr->history[i], i + 12, 10);
+                               sprintf(creature_ptr->history[i], "%s", old_history[i]);
+                               put_str(creature_ptr->history[i], i + 12, 10);
                        }
                        break;
                }
                else if (c == KTRL('A'))
                {
-                       if (do_cmd_histpref())
+                       if (do_cmd_histpref(creature_ptr))
                        {
 #ifdef JP
-                               if ((x > 0) && (iskanji2(p_ptr->history[y], x - 1))) x--;
+                               if ((x > 0) && (iskanji2(creature_ptr->history[y], x - 1))) x--;
 #endif
                        }
                }
@@ -3792,12 +3794,12 @@ static void edit_history(void)
                                else x = 0;
                        }
 
-                       p_ptr->history[y][x] = ' ';
+                       creature_ptr->history[y][x] = ' ';
 #ifdef JP
-                       if ((x > 0) && (iskanji2(p_ptr->history[y], x - 1)))
+                       if ((x > 0) && (iskanji2(creature_ptr->history[y], x - 1)))
                        {
                                x--;
-                               p_ptr->history[y][x] = ' ';
+                               creature_ptr->history[y][x] = ' ';
                        }
 #endif
                }
@@ -3808,9 +3810,9 @@ static void edit_history(void)
 #endif
                {
 #ifdef JP
-                       if (iskanji2(p_ptr->history[y], x))
+                       if (iskanji2(creature_ptr->history[y], x))
                        {
-                               p_ptr->history[y][x+1] = ' ';
+                               creature_ptr->history[y][x+1] = ' ';
                        }
 
                        if (iskanji(c))
@@ -3822,17 +3824,17 @@ static void edit_history(void)
                                        if (y > 3) y = 0;
                                }
 
-                               if (iskanji2(p_ptr->history[y], x+1))
+                               if (iskanji2(creature_ptr->history[y], x+1))
                                {
-                                       p_ptr->history[y][x+2] = ' ';
+                                       creature_ptr->history[y][x+2] = ' ';
                                }
 
-                               p_ptr->history[y][x++] = c;
+                               creature_ptr->history[y][x++] = c;
 
                                c = inkey();
                        }
 #endif
-                       p_ptr->history[y][x++] = c;
+                       creature_ptr->history[y][x++] = c;
                        if (x > 58)
                        {
                                x = 0;
@@ -4021,7 +4023,7 @@ static bool player_birth_aux(player_type *creature_ptr)
                char temp[80*10];
                concptr t;
 
-               if (!get_player_race()) return FALSE;
+               if (!get_player_race(creature_ptr)) return FALSE;
 
                clear_from(10);
 
@@ -4057,7 +4059,7 @@ static bool player_birth_aux(player_type *creature_ptr)
                char temp[80*9];
                concptr t;
 
-               if (!get_player_class()) return FALSE;
+               if (!get_player_class(creature_ptr)) return FALSE;
 
                clear_from(10);
                roff_to_buf(class_jouhou[creature_ptr->pclass], 74, temp, sizeof(temp));
@@ -4092,7 +4094,7 @@ static bool player_birth_aux(player_type *creature_ptr)
                char temp[80*8];
                concptr t;
 
-               if (!get_player_seikaku()) return FALSE;
+               if (!get_player_seikaku(creature_ptr)) return FALSE;
 
                clear_from(10);
                roff_to_buf(seikaku_jouhou[creature_ptr->pseikaku], 74, temp, sizeof(temp));
@@ -4149,16 +4151,14 @@ static bool player_birth_aux(player_type *creature_ptr)
 
        if (autochara)
        {
-               if (!get_chara_limits(p_ptr)) return FALSE;
+               if (!get_chara_limits(creature_ptr)) return FALSE;
        }
 
 #endif /* ALLOW_AUTOROLLER */
-
-       /* Clear */
        clear_from(10);
 
-       /* Reset current_world_ptr->game_turn; before auto-roll and after choosing race */
-       init_turn();
+       /* Reset turn; before auto-roll and after choosing race */
+       init_turn(creature_ptr);
 
        /*** Generate ***/
 
@@ -4192,13 +4192,8 @@ static bool player_birth_aux(player_type *creature_ptr)
                /* Otherwise just get a character */
                else
                {
-                       /* Get a new character */
                        get_stats(creature_ptr);
-
-                       /* Roll for age/height/weight */
-                       get_ahw();
-
-                       /* Roll for social class */
+                       get_ahw(creature_ptr);
                        get_history(creature_ptr);
                }
 
@@ -4296,10 +4291,7 @@ static bool player_birth_aux(player_type *creature_ptr)
                        /* Break if "happy" */
                        if (accept)
                        {
-                               /* Roll for age/height/weight */
-                               get_ahw();
-
-                               /* Roll for social class */
+                               get_ahw(creature_ptr);
                                get_history(creature_ptr);
 
                                if (autochara)
@@ -4319,7 +4311,7 @@ static bool player_birth_aux(player_type *creature_ptr)
                        if (flag)
                        {
                                /* Dump data */
-                               birth_put_stats();
+                               birth_put_stats(creature_ptr);
 
                                /* Dump round */
                                put_str(format("%10ld", auto_round), 10, col+20);
@@ -4338,12 +4330,8 @@ static bool player_birth_aux(player_type *creature_ptr)
                                /* Check for a keypress */
                                if (inkey())
                                {
-                                       /* Roll for age/height/weight */
-                                       get_ahw();
-
-                                       /* Roll for social class */
+                                       get_ahw(creature_ptr);
                                        get_history(creature_ptr);
-
                                        break;
                                }
                        }
@@ -4376,7 +4364,7 @@ static bool player_birth_aux(player_type *creature_ptr)
                        creature_ptr->chp = creature_ptr->mhp;
                        creature_ptr->csp = creature_ptr->msp;
 
-                       display_player(mode);
+                       display_player(p_ptr, mode);
 
                        /* Prepare a prompt (must squeeze everything in) */
                        Term_gotoxy(2, 23);
@@ -4410,7 +4398,6 @@ static bool player_birth_aux(player_type *creature_ptr)
                                continue;
                        }
 
-                       /* Toggle the display */
                        if ((c == 'H') || (c == 'h'))
                        {
                                mode = ((mode != 0) ? 0 : 1);
@@ -4460,7 +4447,7 @@ static bool player_birth_aux(player_type *creature_ptr)
        process_player_name(current_world_ptr->creating_savefile);
 
        /*** Edit character background ***/
-       edit_history();
+       edit_history(creature_ptr);
 
        /*** Finish up ***/
 
@@ -4487,7 +4474,7 @@ static bool player_birth_aux(player_type *creature_ptr)
 
 
        /* Initialize random quests */
-       init_dungeon_quests();
+       init_dungeon_quests(creature_ptr);
 
        /* Save character data for quick start */
        save_prev_data(creature_ptr, &previous_char);
@@ -4542,8 +4529,8 @@ static bool ask_quick_start(player_type *creature_ptr)
        }
 
        load_prev_data(creature_ptr, FALSE);
-       init_turn();
-       init_dungeon_quests();
+       init_turn(creature_ptr);
+       init_dungeon_quests(creature_ptr);
 
        sp_ptr = &sex_info[creature_ptr->psex];
        rp_ptr = &race_info[creature_ptr->prace];
@@ -4582,17 +4569,17 @@ void player_birth(player_type *creature_ptr)
 
        /* 
         * Wipe monsters in old dungeon
-        * This wipe destroys value of current_floor_ptr->m_list[].cur_num .
+        * This wipe destroys value of p_ptr->current_floor_ptr->m_list[].cur_num .
         */
        wipe_m_list();
 
        /* Wipe the player */
-       player_wipe_without_name(p_ptr);
+       player_wipe_without_name(creature_ptr);
 
        /* Create a new character */
 
        /* Quick start? */
-       if (!ask_quick_start(p_ptr))
+       if (!ask_quick_start(creature_ptr))
        {
                play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DEFAULT);
 
@@ -4600,10 +4587,10 @@ void player_birth(player_type *creature_ptr)
                while (1)
                {
                        /* Roll up a new character */
-                       if (player_birth_aux(p_ptr)) break;
+                       if (player_birth_aux(creature_ptr)) break;
 
                        /* Wipe the player */
-                       player_wipe_without_name(p_ptr);
+                       player_wipe_without_name(creature_ptr);
                }
        }
 
@@ -4614,26 +4601,26 @@ void player_birth(player_type *creature_ptr)
        message_add(" ");
        message_add("  ");
 
-       do_cmd_write_nikki(NIKKI_GAMESTART, 1, _("-------- 新規ゲーム開始 --------", "-------- Start New Game --------"));
-       do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
+       exe_write_diary(p_ptr, NIKKI_GAMESTART, 1, _("-------- 新規ゲーム開始 --------", "-------- Start New Game --------"));
+       exe_write_diary(p_ptr, NIKKI_HIGAWARI, 0, NULL);
 
        sprintf(buf,_("                            性別に%sを選択した。", "                            choose %s personality."), sex_info[creature_ptr->psex].title);
-       do_cmd_write_nikki(NIKKI_BUNSHOU, 1, buf);
+       exe_write_diary(p_ptr, NIKKI_BUNSHOU, 1, buf);
 
        sprintf(buf,_("                            種族に%sを選択した。", "                            choose %s race."), race_info[creature_ptr->prace].title);
-       do_cmd_write_nikki(NIKKI_BUNSHOU, 1, buf);
+       exe_write_diary(p_ptr, NIKKI_BUNSHOU, 1, buf);
 
        sprintf(buf,_("                            職業に%sを選択した。", "                            choose %s class."), class_info[creature_ptr->pclass].title);
-       do_cmd_write_nikki(NIKKI_BUNSHOU, 1, buf);
+       exe_write_diary(p_ptr, NIKKI_BUNSHOU, 1, buf);
 
        if (creature_ptr->realm1)
        {
                sprintf(buf,_("                            魔法の領域に%s%sを選択した。", "                            choose %s%s realm."),realm_names[creature_ptr->realm1], creature_ptr->realm2 ? format("と%s",realm_names[creature_ptr->realm2]) : "");
-               do_cmd_write_nikki(NIKKI_BUNSHOU, 1, buf);
+               exe_write_diary(p_ptr, NIKKI_BUNSHOU, 1, buf);
        }
 
        sprintf(buf,_("                            性格に%sを選択した。", "                            choose %s."), seikaku_info[creature_ptr->pseikaku].title);
-       do_cmd_write_nikki(NIKKI_BUNSHOU, 1, buf);
+       exe_write_diary(p_ptr, NIKKI_BUNSHOU, 1, buf);
 
        /* Init the shops */
        for (i = 1; i < max_towns; i++)