OSDN Git Service

[Refactor] #37353 inside_quest を player_type から floor_type へ移動. / Move inside_quest...
[hengband/hengband.git] / src / birth.c
index 12cb026..0e13817 100644 (file)
  */
 
 #include "angband.h"
+#include "util.h"
+#include "bldg.h"
+#include "core.h"
+#include "term.h"
+
+#include "object-ego.h"
+#include "artifact.h"
 #include "avatar.h"
+#include "cmd-dump.h"
+#include "dungeon.h"
 #include "history.h"
 #include "monsterrace-hook.h"
 #include "store.h"
+#include "patron.h"
 #include "quest.h"
+#include "player-class.h"
 #include "player-status.h"
+#include "player-personality.h"
+#include "player-sex.h"
 #include "spells.h"
 #include "spells-status.h"
 #include "wild.h"
+#include "floor.h"
+#include "cmd-pet.h"
+#include "dungeon-file.h"
+#include "floor-town.h"
+#include "files.h"
+#include "birth.h"
+#include "player-race.h"
+#include "player-skill.h"
+#include "world.h"
+#include "objectkind.h"
+#include "monsterrace.h"
+#include "autopick.h"
+#include "save.h"
+#include "realm.h"
+#include "japanese.h"
+#include "view-mainwindow.h"
+
+ /*
+  * The last character rolled,
+  * holded for quick start
+  */
+birther previous_char;
 
 /*!
  * オートローラーの内容を描画する間隔 / 
@@ -203,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.",
 
@@ -387,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
 };
@@ -532,7 +567,7 @@ static void show_help(concptr helpfile)
  * @param count 選択可能な魔法領域を返すポインタ群。
  * @return 選択した魔法領域のID
  */
-static byte choose_realm(s32b choices, int *count)
+static byte choose_realm(player_type *creature_ptr, s32b choices, int *count)
 {
        int picks[VALID_REALM] = {0};
        int k, i, cs, os;
@@ -616,11 +651,11 @@ static byte choose_realm(s32b choices, int *count)
        if ((*count) < 2) return auto_select;
 
        /* Constraint to the 1st realm */
-       if (p_ptr->realm2 != 255)
+       if (creature_ptr->realm2 != 255)
        {
-               if (p_ptr->pclass == CLASS_PRIEST)
+               if (creature_ptr->pclass == CLASS_PRIEST)
                {
-                       if (is_good_realm(p_ptr->realm1))
+                       if (is_good_realm(creature_ptr->realm1))
                        {
                                choices &= ~(CH_DEATH | CH_DAEMON);
                        }
@@ -640,14 +675,14 @@ static byte choose_realm(s32b choices, int *count)
                /* Analize realms */
                if (choices & (1L << i))
                {
-                       if (p_ptr->realm1 == i+1)
+                       if (creature_ptr->realm1 == i+1)
                        {
-                               if (p_ptr->realm2 == 255)
+                               if (creature_ptr->realm2 == 255)
                                        cs = n;
                                else
                                        continue;
                        }
-                       if (p_ptr->realm2 == i+1)
+                       if (creature_ptr->realm2 == i+1)
                                cs = n;
 
                        sym[n] = I2A(n);
@@ -771,7 +806,7 @@ static byte choose_realm(s32b choices, int *count)
  * @brief 選択した魔法領域の解説を表示する / Choose the magical realms
  * @return ユーザが魔法領域の確定を選んだらTRUEを返す。
  */
-static bool get_player_realms(void)
+static bool get_player_realms(player_type *creature_ptr)
 {
        int i, count;
 
@@ -781,17 +816,17 @@ static bool get_player_realms(void)
        put_str("                                   ", 5, 40);
 
        /* Select the first realm */
-       p_ptr->realm1 = REALM_NONE;
-       p_ptr->realm2 = 255;
+       creature_ptr->realm1 = REALM_NONE;
+       creature_ptr->realm2 = 255;
        while (1)
        {
                char temp[80*10];
                concptr t;
                count = 0;
-               p_ptr->realm1 = choose_realm(realm_choices1[p_ptr->pclass], &count);
+               creature_ptr->realm1 = choose_realm(creature_ptr, realm_choices1[creature_ptr->pclass], &count);
 
-               if (255 == p_ptr->realm1) return FALSE;
-               if (!p_ptr->realm1) break;
+               if (255 == creature_ptr->realm1) return FALSE;
+               if (!creature_ptr->realm1) break;
 
                /* Clean up*/
                clear_from(10);
@@ -799,7 +834,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, sizeof(temp));
+               roff_to_buf(realm_jouhou[technic2magic(creature_ptr->realm1)-1], 74, temp, sizeof(temp));
                t = temp;
                for (i = 0; i < 10; i++)
                {
@@ -823,12 +858,12 @@ static bool get_player_realms(void)
        }
 
        /* Select the second realm */
-       p_ptr->realm2 = REALM_NONE;
-       if (p_ptr->realm1)
+       creature_ptr->realm2 = REALM_NONE;
+       if (creature_ptr->realm1)
        {
                /* Print the realm */
                put_str(_("魔法        :", "Magic       :"), 6, 1);
-               c_put_str(TERM_L_BLUE, realm_names[p_ptr->realm1], 6, 15);
+               c_put_str(TERM_L_BLUE, realm_names[creature_ptr->realm1], 6, 15);
 
                /* Select the second realm */
                while (1)
@@ -837,10 +872,10 @@ static bool get_player_realms(void)
                        concptr t;
 
                        count = 0;
-                       p_ptr->realm2 = choose_realm(realm_choices2[p_ptr->pclass], &count);
+                       creature_ptr->realm2 = choose_realm(creature_ptr, realm_choices2[creature_ptr->pclass], &count);
 
-                       if (255 == p_ptr->realm2) return FALSE;
-                       if (!p_ptr->realm2) break;
+                       if (255 == creature_ptr->realm2) return FALSE;
+                       if (!creature_ptr->realm2) break;
 
                        /* Clean up*/
                        clear_from(10);
@@ -848,7 +883,7 @@ static bool get_player_realms(void)
                        put_str("                                   ", 4, 40);
                        put_str("                                   ", 5, 40);
 
-                       roff_to_buf(realm_jouhou[technic2magic(p_ptr->realm2)-1], 74, temp, sizeof(temp));
+                       roff_to_buf(realm_jouhou[technic2magic(creature_ptr->realm2)-1], 74, temp, sizeof(temp));
                        t = temp;
                        for (i = 0; i < A_MAX; i++)
                        {
@@ -870,10 +905,10 @@ static bool get_player_realms(void)
                        }
                        else if (get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_DEFAULT_Y)) break;
                }
-               if (p_ptr->realm2)
+               if (creature_ptr->realm2)
                {
                        /* Print the realm */
-                       c_put_str(TERM_L_BLUE, format("%s, %s", realm_names[p_ptr->realm1], realm_names[p_ptr->realm2]), 6, 15);
+                       c_put_str(TERM_L_BLUE, format("%s, %s", realm_names[creature_ptr->realm1], realm_names[creature_ptr->realm2]), 6, 15);
                }
        }
 
@@ -886,48 +921,48 @@ static bool get_player_realms(void)
  * @param birther_ptr クイックスタート構造体の参照ポインタ
  * @return なし。
  */
-static void save_prev_data(birther *birther_ptr)
+static void save_prev_data(player_type *creature_ptr, birther *birther_ptr)
 {
        int i;
 
        /* Save the data */
-       birther_ptr->psex = p_ptr->psex;
-       birther_ptr->prace = p_ptr->prace;
-       birther_ptr->pclass = p_ptr->pclass;
-       birther_ptr->pseikaku = p_ptr->pseikaku;
-       birther_ptr->realm1 = p_ptr->realm1;
-       birther_ptr->realm2 = p_ptr->realm2;
-       birther_ptr->age = p_ptr->age;
-       birther_ptr->ht = p_ptr->ht;
-       birther_ptr->wt = p_ptr->wt;
-       birther_ptr->sc = p_ptr->sc;
-       birther_ptr->au = p_ptr->au;
+       birther_ptr->psex = creature_ptr->psex;
+       birther_ptr->prace = creature_ptr->prace;
+       birther_ptr->pclass = creature_ptr->pclass;
+       birther_ptr->pseikaku = creature_ptr->pseikaku;
+       birther_ptr->realm1 = creature_ptr->realm1;
+       birther_ptr->realm2 = creature_ptr->realm2;
+       birther_ptr->age = creature_ptr->age;
+       birther_ptr->ht = creature_ptr->ht;
+       birther_ptr->wt = creature_ptr->wt;
+       birther_ptr->sc = creature_ptr->sc;
+       birther_ptr->au = creature_ptr->au;
 
        /* Save the stats */
        for (i = 0; i < A_MAX; i++)
        {
-               birther_ptr->stat_max[i] = p_ptr->stat_max[i];
-               birther_ptr->stat_max_max[i] = p_ptr->stat_max_max[i];
+               birther_ptr->stat_max[i] = creature_ptr->stat_max[i];
+               birther_ptr->stat_max_max[i] = creature_ptr->stat_max_max[i];
        }
 
        /* Save the hp */
        for (i = 0; i < PY_MAX_LEVEL; i++)
        {
-               birther_ptr->player_hp[i] = p_ptr->player_hp[i];
+               birther_ptr->player_hp[i] = creature_ptr->player_hp[i];
        }
 
-       birther_ptr->chaos_patron = p_ptr->chaos_patron;
+       birther_ptr->chaos_patron = creature_ptr->chaos_patron;
 
        /* Save the virtues */
        for (i = 0; i < 8; i++)
        {
-               birther_ptr->vir_types[i] = p_ptr->vir_types[i];
+               birther_ptr->vir_types[i] = creature_ptr->vir_types[i];
        }
 
        /* Save the history */
        for (i = 0; i < 4; i++)
        {
-               strcpy(birther_ptr->history[i], p_ptr->history[i]);
+               strcpy(birther_ptr->history[i], creature_ptr->history[i]);
        }
 }
 
@@ -937,57 +972,57 @@ static void save_prev_data(birther *birther_ptr)
  * @param swap TRUEならば現在のプレイヤー構造体上との内容をスワップする形で読み込む。
  * @return なし。
  */
-static void load_prev_data(bool swap)
+static void load_prev_data(player_type *creature_ptr, bool swap)
 {
        int i;
 
        birther temp;
 
        /*** Save the current data ***/
-       if (swap) save_prev_data(&temp);
+       if (swap) save_prev_data(creature_ptr, &temp);
 
 
        /*** Load the previous data ***/
 
        /* Load the data */
-       p_ptr->psex = previous_char.psex;
-       p_ptr->prace = previous_char.prace;
-       p_ptr->pclass = previous_char.pclass;
-       p_ptr->pseikaku = previous_char.pseikaku;
-       p_ptr->realm1 = previous_char.realm1;
-       p_ptr->realm2 = previous_char.realm2;
-       p_ptr->age = previous_char.age;
-       p_ptr->ht = previous_char.ht;
-       p_ptr->wt = previous_char.wt;
-       p_ptr->sc = previous_char.sc;
-       p_ptr->au = previous_char.au;
+       creature_ptr->psex = previous_char.psex;
+       creature_ptr->prace = previous_char.prace;
+       creature_ptr->pclass = previous_char.pclass;
+       creature_ptr->pseikaku = previous_char.pseikaku;
+       creature_ptr->realm1 = previous_char.realm1;
+       creature_ptr->realm2 = previous_char.realm2;
+       creature_ptr->age = previous_char.age;
+       creature_ptr->ht = previous_char.ht;
+       creature_ptr->wt = previous_char.wt;
+       creature_ptr->sc = previous_char.sc;
+       creature_ptr->au = previous_char.au;
 
        /* Load the stats */
        for (i = 0; i < A_MAX; i++)
        {
-               p_ptr->stat_cur[i] = p_ptr->stat_max[i] = previous_char.stat_max[i];
-               p_ptr->stat_max_max[i] = previous_char.stat_max_max[i];
+               creature_ptr->stat_cur[i] = creature_ptr->stat_max[i] = previous_char.stat_max[i];
+               creature_ptr->stat_max_max[i] = previous_char.stat_max_max[i];
        }
 
        /* Load the hp */
        for (i = 0; i < PY_MAX_LEVEL; i++)
        {
-               p_ptr->player_hp[i] = previous_char.player_hp[i];
+               creature_ptr->player_hp[i] = previous_char.player_hp[i];
        }
-       p_ptr->mhp = p_ptr->player_hp[0];
-       p_ptr->chp = p_ptr->player_hp[0];
+       creature_ptr->mhp = creature_ptr->player_hp[0];
+       creature_ptr->chp = creature_ptr->player_hp[0];
 
-       p_ptr->chaos_patron = previous_char.chaos_patron;
+       creature_ptr->chaos_patron = previous_char.chaos_patron;
 
        for (i = 0; i < 8; i++)
        {
-               p_ptr->vir_types[i] = previous_char.vir_types[i];
+               creature_ptr->vir_types[i] = previous_char.vir_types[i];
        }
 
        /* Load the history */
        for (i = 0; i < 4; i++)
        {
-               strcpy(p_ptr->history[i], previous_char.history[i]);
+               strcpy(creature_ptr->history[i], previous_char.history[i]);
        }
 
        /*** Save the previous data ***/
@@ -1062,7 +1097,7 @@ static int adjust_stat(int value, int amount)
  * For efficiency, we include a chunk of "calc_bonuses()".\n
  * @return なし
  */
-static void get_stats(void)
+static void get_stats(player_type *creature_ptr)
 {
        /* Roll and verify some stats */
        while (TRUE)
@@ -1084,7 +1119,7 @@ static void get_stats(void)
 
                        /* Save that value */
                        sum += val;
-                       p_ptr->stat_cur[3*i] = p_ptr->stat_max[3*i] = val;
+                       creature_ptr->stat_cur[3*i] = creature_ptr->stat_max[3*i] = val;
 
                        /* Extract 5 + 1d3 + 1d4 + 1d5 */
                        val = 5 + 3;
@@ -1094,7 +1129,7 @@ static void get_stats(void)
 
                        /* Save that value */
                        sum += val;
-                       p_ptr->stat_cur[3*i+1] = p_ptr->stat_max[3*i+1] = val;
+                       creature_ptr->stat_cur[3*i+1] = creature_ptr->stat_max[3*i+1] = val;
 
                        /* Extract 5 + 1d3 + 1d4 + 1d5 */
                        val = 5 + 3;
@@ -1104,7 +1139,7 @@ static void get_stats(void)
 
                        /* Save that value */
                        sum += val;
-                       p_ptr->stat_cur[3*i+2] = p_ptr->stat_max[3*i+2] = val;
+                       creature_ptr->stat_cur[3*i+2] = creature_ptr->stat_max[3*i+2] = val;
                }
 
                /* Verify totals */
@@ -1117,7 +1152,7 @@ static void get_stats(void)
  * @brief プレイヤーの限界ステータスを決める。
  * @return なし
  */
-void get_max_stats(void)
+void get_max_stats(player_type *creature_ptr)
 {
        int i, j;
        int dice[6];
@@ -1145,14 +1180,14 @@ void get_max_stats(void)
                BASE_STATUS max_max = 18 + 60 + dice[i]*10;
 
                /* Save that value */
-               p_ptr->stat_max_max[i] = max_max;
-               if (p_ptr->stat_max[i] > max_max)
-                       p_ptr->stat_max[i] = max_max;
-               if (p_ptr->stat_cur[i] > max_max)
-                       p_ptr->stat_cur[i] = max_max;
+               creature_ptr->stat_max_max[i] = max_max;
+               if (creature_ptr->stat_max[i] > max_max)
+                       creature_ptr->stat_max[i] = max_max;
+               if (creature_ptr->stat_cur[i] > max_max)
+                       creature_ptr->stat_cur[i] = max_max;
        }
-       p_ptr->knowledge &= ~(KNOW_STAT);
-       p_ptr->redraw |= (PR_STATS);
+       creature_ptr->knowledge &= ~(KNOW_STAT);
+       creature_ptr->redraw |= (PR_STATS);
 }
 
 
@@ -1160,52 +1195,52 @@ void get_max_stats(void)
  * @brief その他「オートローラ中は算出の対象にしない」副次ステータスを処理する / Roll for some info that the auto-roller ignores
  * @return なし
  */
-static void get_extra(bool roll_hitdie)
+static void get_extra(player_type *creature_ptr, bool roll_hitdie)
 {
        int i, j;
 
        /* Experience factor */
-       if (p_ptr->prace == RACE_ANDROID) p_ptr->expfact = rp_ptr->r_exp;
-       else p_ptr->expfact = rp_ptr->r_exp + cp_ptr->c_exp;
+       if (creature_ptr->prace == RACE_ANDROID) creature_ptr->expfact = rp_ptr->r_exp;
+       else creature_ptr->expfact = rp_ptr->r_exp + cp_ptr->c_exp;
 
-       if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_NINJA)) && ((p_ptr->prace == RACE_KLACKON) || (p_ptr->prace == RACE_SPRITE)))
-               p_ptr->expfact -= 15;
+       if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) || (creature_ptr->pclass == CLASS_NINJA)) && ((creature_ptr->prace == RACE_KLACKON) || (creature_ptr->prace == RACE_SPRITE)))
+               creature_ptr->expfact -= 15;
 
        /* Reset record of race/realm changes */
-       p_ptr->start_race = p_ptr->prace;
-       p_ptr->old_race1 = 0L;
-       p_ptr->old_race2 = 0L;
-       p_ptr->old_realm = 0;
+       creature_ptr->start_race = creature_ptr->prace;
+       creature_ptr->old_race1 = 0L;
+       creature_ptr->old_race2 = 0L;
+       creature_ptr->old_realm = 0;
 
        for (i = 0; i < 64; i++)
        {
-               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;
+               if (creature_ptr->pclass == CLASS_SORCERER) creature_ptr->spell_exp[i] = SPELL_EXP_MASTER;
+               else if (creature_ptr->pclass == CLASS_RED_MAGE) creature_ptr->spell_exp[i] = SPELL_EXP_SKILLED;
+               else creature_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) && (p_ptr->weapon_exp[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] < WEAPON_EXP_BEGINNER))
+                       creature_ptr->weapon_exp[i][j] = s_info[creature_ptr->pclass].w_start[i][j];
+       if ((creature_ptr->pseikaku == SEIKAKU_SEXY) && (creature_ptr->weapon_exp[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] < WEAPON_EXP_BEGINNER))
        {
-               p_ptr->weapon_exp[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_BEGINNER;
+               creature_ptr->weapon_exp[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_BEGINNER;
        }
 
        for (i = 0; i < GINOU_MAX; i++)
-               p_ptr->skill_exp[i] = s_info[p_ptr->pclass].s_start[i];
+               creature_ptr->skill_exp[i] = s_info[creature_ptr->pclass].s_start[i];
 
        /* Hitdice */
-       if (p_ptr->pclass == CLASS_SORCERER)
-               p_ptr->hitdie = rp_ptr->r_mhp/2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
+       if (creature_ptr->pclass == CLASS_SORCERER)
+               creature_ptr->hitdie = rp_ptr->r_mhp/2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
        else
-               p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
+               creature_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
 
        /* Roll for hit point unless quick-start */
-       if (roll_hitdie) roll_hitdice(p_ptr, SPOP_NO_UPDATE);
+       if (roll_hitdie) roll_hitdice(creature_ptr, SPOP_NO_UPDATE);
 
        /* Initial hitpoints */
-       p_ptr->mhp = p_ptr->player_hp[0];
+       creature_ptr->mhp = creature_ptr->player_hp[0];
 }
 
 
@@ -1213,7 +1248,7 @@ static void get_extra(bool roll_hitdie)
  * @brief プレイヤーの生い立ちの自動生成を行う。 / Get the racial history, and social class, using the "history charts".
  * @return なし
  */
-static void get_history(void)
+static void get_history(player_type *creature_ptr)
 {
        int i, n, chart, roll, social_class;
 
@@ -1222,7 +1257,7 @@ static void get_history(void)
        char buf[240];
 
        /* 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';
 
        /* Clear the history text */
        buf[0] = '\0';
@@ -1231,7 +1266,7 @@ static void get_history(void)
        social_class = randint1(4);
 
        /* Starting place */
-       switch (p_ptr->prace)
+       switch (creature_ptr->prace)
        {
                case RACE_AMBERITE:
                {
@@ -1444,7 +1479,7 @@ static void get_history(void)
        else if (social_class < 1) social_class = 1;
 
        /* Save the social class */
-       p_ptr->sc = (s16b)social_class;
+       creature_ptr->sc = (s16b)social_class;
 
 
        /* Skip leading spaces */
@@ -1463,7 +1498,7 @@ static void get_history(void)
        t = temp;
        for(i=0 ; i<4 ; i++){
             if(t[0]==0)break; 
-            else {strcpy(p_ptr->history[i], t);t += strlen(t)+1;}
+            else {strcpy(creature_ptr->history[i], t);t += strlen(t)+1;}
             }
        }
 }
@@ -1472,25 +1507,25 @@ static void get_history(void)
  * @brief プレイヤーの身長体重を決める / Get character's height and weight
  * @return なし
  */
-void get_height_weight(void)
+void get_height_weight(player_type *creature_ptr)
 {
        int h_percent; /* 身長が平均にくらべてどのくらい違うか. */
 
        /* Calculate the height/weight for males */
-       if (p_ptr->psex == SEX_MALE)
+       if (creature_ptr->psex == SEX_MALE)
        {
-               p_ptr->ht = randnor(rp_ptr->m_b_ht, rp_ptr->m_m_ht);
-               h_percent = (int)(p_ptr->ht) * 100 / (int)(rp_ptr->m_b_ht);
-               p_ptr->wt = randnor((int)(rp_ptr->m_b_wt) * h_percent /100
+               creature_ptr->ht = randnor(rp_ptr->m_b_ht, rp_ptr->m_m_ht);
+               h_percent = (int)(creature_ptr->ht) * 100 / (int)(rp_ptr->m_b_ht);
+               creature_ptr->wt = randnor((int)(rp_ptr->m_b_wt) * h_percent /100
                                    , (int)(rp_ptr->m_m_wt) * h_percent / 300 );
        }
   
        /* Calculate the height/weight for females */
-       else if (p_ptr->psex == SEX_FEMALE)
+       else if (creature_ptr->psex == SEX_FEMALE)
        {
-               p_ptr->ht = randnor(rp_ptr->f_b_ht, rp_ptr->f_m_ht);
-               h_percent = (int)(p_ptr->ht) * 100 / (int)(rp_ptr->f_b_ht);
-               p_ptr->wt = randnor((int)(rp_ptr->f_b_wt) * h_percent /100
+               creature_ptr->ht = randnor(rp_ptr->f_b_ht, rp_ptr->f_m_ht);
+               h_percent = (int)(creature_ptr->ht) * 100 / (int)(rp_ptr->f_b_ht);
+               creature_ptr->wt = randnor((int)(rp_ptr->f_b_wt) * h_percent /100
                                    , (int)(rp_ptr->f_m_wt) * h_percent / 300 );
        }
 }
@@ -1501,59 +1536,59 @@ void get_height_weight(void)
  * @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();
+       get_height_weight(creature_ptr);
 }
 
 /*!
  * @brief プレイヤーの初期所持金を決める。 / Get the player's starting money
  * @return なし
  */
-static void get_money(void)
+static void get_money(player_type *creature_ptr)
 {
        int i, gold;
 
        /* Social Class determines starting gold */
-       gold = (p_ptr->sc * 6) + randint1(100) + 300;
-       if (p_ptr->pclass == CLASS_TOURIST)
+       gold = (creature_ptr->sc * 6) + randint1(100) + 300;
+       if (creature_ptr->pclass == CLASS_TOURIST)
          gold += 2000;
 
        /* Process the stats */
        for (i = 0; i < A_MAX; i++)
        {
                /* Mega-Hack -- reduce gold for high stats */
-               if (p_ptr->stat_max[i] >= 18 + 50) gold -= 300;
-               else if (p_ptr->stat_max[i] >= 18 + 20) gold -= 200;
-               else if (p_ptr->stat_max[i] > 18) gold -= 150;
-               else gold -= (p_ptr->stat_max[i] - 8) * 10;
+               if (creature_ptr->stat_max[i] >= 18 + 50) gold -= 300;
+               else if (creature_ptr->stat_max[i] >= 18 + 20) gold -= 200;
+               else if (creature_ptr->stat_max[i] > 18) gold -= 150;
+               else gold -= (creature_ptr->stat_max[i] - 8) * 10;
        }
 
        /* Minimum 100 gold */
        if (gold < 100) gold = 100;
 
-       if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
+       if (creature_ptr->pseikaku == SEIKAKU_NAMAKE)
                gold /= 2;
-       else if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
+       else if (creature_ptr->pseikaku == SEIKAKU_MUNCHKIN)
                gold = 10000000;
-       if (p_ptr->prace == RACE_ANDROID) gold /= 5;
+       if (creature_ptr->prace == RACE_ANDROID) gold /= 5;
 
        /* Save the gold */
-       p_ptr->au = gold;
+       creature_ptr->au = gold;
 }
 
 
 
 /*!
  * @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;
@@ -1571,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);
@@ -1631,24 +1666,31 @@ static void k_info_reset(void)
  * @brief プレイヤー構造体の内容を初期値で消去する(名前を除く) / Clear all the global "character" data (without name)
  * @return なし
  */
-static void player_wipe_without_name(void)
+static void player_wipe_without_name(player_type *creature_ptr)
 {
        int i;
        player_type tmp;
 
        /* Temporary copy for migration - written back later */
-       COPY(&tmp, p_ptr, player_type);
+       COPY(&tmp, creature_ptr, player_type);
 
        /* Hack -- free the "last message" string */
-       if (p_ptr->last_message) string_free(p_ptr->last_message);
+       if (creature_ptr->last_message) string_free(creature_ptr->last_message);
+
+       if (creature_ptr->inventory_list != NULL) C_WIPE(creature_ptr->inventory_list, INVEN_TOTAL, object_type);
 
        /* Hack -- zero the struct */
-       (void)WIPE(p_ptr, player_type);
+       (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 */
        for (i = 0; i < 4; i++)
        {
-               strcpy(p_ptr->history[i], "");
+               strcpy(creature_ptr->history[i], "");
        }
 
        /* Wipe the quests */
@@ -1668,19 +1710,18 @@ static void player_wipe_without_name(void)
        }
 
        /* No weight */
-       p_ptr->total_weight = 0;
+       creature_ptr->total_weight = 0;
 
        /* No items */
-       inven_cnt = 0;
-       equip_cnt = 0;
+       creature_ptr->inven_cnt = 0;
+       creature_ptr->equip_cnt = 0;
 
        /* Clear the inventory */
        for (i = 0; i < INVEN_TOTAL; i++)
        {
-               object_wipe(&inventory[i]);
+               object_wipe(&creature_ptr->inventory_list[i]);
        }
 
-
        /* Start with no artifacts made yet */
        for (i = 0; i < max_a_idx; i++)
        {
@@ -1717,28 +1758,28 @@ static void player_wipe_without_name(void)
 
 
        /* Hack -- Well fed player */
-       p_ptr->food = PY_FOOD_FULL - 1;
+       creature_ptr->food = PY_FOOD_FULL - 1;
 
 
        /* Wipe the spells */
-       if (p_ptr->pclass == CLASS_SORCERER)
+       if (creature_ptr->pclass == CLASS_SORCERER)
        {
-               p_ptr->spell_learned1 = p_ptr->spell_learned2 = 0xffffffffL;
-               p_ptr->spell_worked1 = p_ptr->spell_worked2 = 0xffffffffL;
+               creature_ptr->spell_learned1 = creature_ptr->spell_learned2 = 0xffffffffL;
+               creature_ptr->spell_worked1 = creature_ptr->spell_worked2 = 0xffffffffL;
        }
        else
        {
-               p_ptr->spell_learned1 = p_ptr->spell_learned2 = 0L;
-               p_ptr->spell_worked1 = p_ptr->spell_worked2 = 0L;
+               creature_ptr->spell_learned1 = creature_ptr->spell_learned2 = 0L;
+               creature_ptr->spell_worked1 = creature_ptr->spell_worked2 = 0L;
        }
-       p_ptr->spell_forgotten1 = p_ptr->spell_forgotten2 = 0L;
-       for (i = 0; i < 64; i++) p_ptr->spell_order[i] = 99;
-       p_ptr->learned_spells = 0;
-       p_ptr->add_spells = 0;
-       p_ptr->knowledge = 0;
+       creature_ptr->spell_forgotten1 = creature_ptr->spell_forgotten2 = 0L;
+       for (i = 0; i < 64; i++) creature_ptr->spell_order[i] = 99;
+       creature_ptr->learned_spells = 0;
+       creature_ptr->add_spells = 0;
+       creature_ptr->knowledge = 0;
 
        /* Clean the mutation count */
-       mutant_regenerate_mod = 100;
+       creature_ptr->mutant_regenerate_mod = 100;
 
        /* Clear "cheat" options */
        cheat_peek = FALSE;
@@ -1752,84 +1793,84 @@ static void player_wipe_without_name(void)
        cheat_turn = FALSE;
 
        /* Assume no winning game */
-       p_ptr->total_winner = FALSE;
+       creature_ptr->total_winner = FALSE;
 
-       p_ptr->timewalk = FALSE;
+       creature_ptr->timewalk = FALSE;
 
        /* Assume no panic save */
-       p_ptr->panic_save = 0;
+       creature_ptr->panic_save = 0;
 
        /* Assume no cheating */
-       p_ptr->noscore = 0;
-       p_ptr->wizard = FALSE;
+       creature_ptr->noscore = 0;
+       current_world_ptr->wizard = FALSE;
 
        /* Not waiting to report score */
-       p_ptr->wait_report_score = FALSE;
+       creature_ptr->wait_report_score = FALSE;
 
        /* Default pet command settings */
-       p_ptr->pet_follow_distance = PET_FOLLOW_DIST;
-       p_ptr->pet_extra_flags = (PF_TELEPORT | PF_ATTACK_SPELL | PF_SUMMON_SPELL);
+       creature_ptr->pet_follow_distance = PET_FOLLOW_DIST;
+       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;
        }
 
-       p_ptr->visit = 1;
+       creature_ptr->visit = 1;
 
        /* Reset wild_mode to FALSE */
-       p_ptr->wild_mode = FALSE;
+       creature_ptr->wild_mode = FALSE;
 
        for (i = 0; i < 108; i++)
        {
-               p_ptr->magic_num1[i] = 0;
-               p_ptr->magic_num2[i] = 0;
+               creature_ptr->magic_num1[i] = 0;
+               creature_ptr->magic_num2[i] = 0;
        }
 
        /* Level one */
-       p_ptr->max_plv = p_ptr->lev = 1;
+       creature_ptr->max_plv = creature_ptr->lev = 1;
 
        /* Initialize arena and rewards information -KMW- */
-       p_ptr->arena_number = 0;
-       p_ptr->inside_arena = FALSE;
-       p_ptr->inside_quest = 0;
+       creature_ptr->arena_number = 0;
+       creature_ptr->inside_arena = FALSE;
+       creature_ptr->current_floor_ptr->inside_quest = 0;
        for (i = 0; i < MAX_MANE; i++)
        {
-               p_ptr->mane_spell[i] = -1;
-               p_ptr->mane_dam[i] = 0;
+               creature_ptr->mane_spell[i] = -1;
+               creature_ptr->mane_dam[i] = 0;
        }
-       p_ptr->mane_num = 0;
-       p_ptr->exit_bldg = TRUE; /* only used for arena now -KMW- */
+       creature_ptr->mane_num = 0;
+       creature_ptr->exit_bldg = TRUE; /* only used for arena now -KMW- */
 
        /* Bounty */
-       p_ptr->today_mon = 0;
+       creature_ptr->today_mon = 0;
 
        /* Reset monster arena */
-       battle_monsters();
+       update_gambling_monsters();
 
        /* Reset mutations */
-       p_ptr->muta1 = 0;
-       p_ptr->muta2 = 0;
-       p_ptr->muta3 = 0;
+       creature_ptr->muta1 = 0;
+       creature_ptr->muta2 = 0;
+       creature_ptr->muta3 = 0;
 
        /* Reset virtues */
-       for (i = 0; i < 8; i++) p_ptr->virtues[i]=0;
+       for (i = 0; i < 8; i++) creature_ptr->virtues[i]=0;
 
-       p_ptr->dungeon_idx = 0;
+       creature_ptr->dungeon_idx = 0;
 
        /* Set the recall dungeon accordingly */
        if (vanilla_town || ironman_downward)
        {
-               p_ptr->recall_dungeon = DUNGEON_ANGBAND;
+               creature_ptr->recall_dungeon = DUNGEON_ANGBAND;
        }
        else
        {
-               p_ptr->recall_dungeon = DUNGEON_GALGALS;
+               creature_ptr->recall_dungeon = DUNGEON_GALGALS;
        }
 
        /* Data migration */
-       memcpy(p_ptr->name, tmp.name, sizeof(tmp.name));
+       memcpy(creature_ptr->name, tmp.name, sizeof(tmp.name));
 }
 
 
@@ -1838,18 +1879,18 @@ static void player_wipe_without_name(void)
  * @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--)
@@ -1869,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;
@@ -1912,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; 
@@ -1927,7 +1967,7 @@ static void wield_all(void)
        /* Scan through the slots backwards */ 
        for (item = INVEN_PACK - 1; item >= 0; item--) 
        { 
-               o_ptr = &inventory[item]; 
+               o_ptr = &creature_ptr->inventory_list[item]; 
  
                /* Skip non-objects */ 
                if (!o_ptr->k_idx) continue; 
@@ -1936,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 (inventory[slot].k_idx) continue; 
+               if (creature_ptr->inventory_list[slot].k_idx) continue; 
  
                i_ptr = &object_type_body; 
                object_copy(i_ptr, o_ptr); 
@@ -1956,12 +1996,12 @@ static void wield_all(void)
                        floor_item_optimize(0 - item); 
                } 
  
-               o_ptr = &inventory[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 */ 
-               equip_cnt++;
+               creature_ptr->equip_cnt++;
 
        } 
        return; 
@@ -2175,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;
 
@@ -2187,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); 
 }
 
 
@@ -2196,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;
@@ -2208,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! */
@@ -2226,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;
@@ -2239,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;
 
@@ -2258,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;
 
@@ -2267,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++)
@@ -2339,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;
@@ -2429,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 */
@@ -2446,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;
@@ -2481,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)
        {
@@ -2589,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);
@@ -2605,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;
@@ -2649,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)
        {
@@ -2761,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);
@@ -2776,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;
@@ -2794,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];
@@ -2813,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)
        {
@@ -2861,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;
                        }
@@ -2877,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;
@@ -2895,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--;
@@ -2906,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++;
@@ -2917,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;
@@ -2928,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;
@@ -2937,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;
@@ -2962,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)
@@ -2972,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);
 
@@ -3210,7 +3250,7 @@ static bool get_stat_limits(void)
  * @brief オートローラで得たい年齢、身長、体重、社会的地位の基準を決める。
  * @return なし
  */
-static bool get_chara_limits(void)
+static bool get_chara_limits(player_type *creature_ptr)
 {
 #define MAXITEMS 8
 
@@ -3232,7 +3272,7 @@ static bool get_chara_limits(void)
        put_str(_("2/4/6/8で項目選択、+/-で値の増減、Enterで次へ", "2/4/6/8 for Select, +/- for Change value, Enter for Goto next"), 11, 10);
        put_str(_("注意:身長と体重の最大値/最小値ぎりぎりの値は非常に出現確率が低くなります。", "Caution: Values near minimum or maximum is extremery rare."), 23, 2);
        
-       if (p_ptr->psex == SEX_MALE)
+       if (creature_ptr->psex == SEX_MALE)
        {
                max_percent = (int)(rp_ptr->m_b_ht+rp_ptr->m_m_ht*4-1) * 100 / (int)(rp_ptr->m_b_ht);
                min_percent = (int)(rp_ptr->m_b_ht-rp_ptr->m_m_ht*4+1) * 100 / (int)(rp_ptr->m_b_ht);
@@ -3260,19 +3300,19 @@ static bool get_chara_limits(void)
                        break;
 
                case 2: /* Minimum height */
-                       if (p_ptr->psex == SEX_MALE) m = rp_ptr->m_b_ht-rp_ptr->m_m_ht*4+1;
+                       if (creature_ptr->psex == SEX_MALE) m = rp_ptr->m_b_ht-rp_ptr->m_m_ht*4+1;
                        else m = rp_ptr->f_b_ht-rp_ptr->f_m_ht*4+1;
                        break;
                case 3: /* Maximum height */
-                       if (p_ptr->psex == SEX_MALE) m = rp_ptr->m_b_ht+rp_ptr->m_m_ht*4-1;
+                       if (creature_ptr->psex == SEX_MALE) m = rp_ptr->m_b_ht+rp_ptr->m_m_ht*4-1;
                        else m = rp_ptr->f_b_ht+rp_ptr->f_m_ht*4-1;
                        break;
                case 4: /* Minimum weight */
-                       if (p_ptr->psex == SEX_MALE) m = (rp_ptr->m_b_wt * min_percent / 100) - (rp_ptr->m_m_wt * min_percent / 75) +1;
+                       if (creature_ptr->psex == SEX_MALE) m = (rp_ptr->m_b_wt * min_percent / 100) - (rp_ptr->m_m_wt * min_percent / 75) +1;
                        else m = (rp_ptr->f_b_wt * min_percent / 100) - (rp_ptr->f_m_wt * min_percent / 75) +1;
                        break;
                case 5: /* Maximum weight */
-                       if (p_ptr->psex == SEX_MALE) m = (rp_ptr->m_b_wt * max_percent / 100) + (rp_ptr->m_m_wt * max_percent / 75) -1;
+                       if (creature_ptr->psex == SEX_MALE) m = (rp_ptr->m_b_wt * max_percent / 100) + (rp_ptr->m_m_wt * max_percent / 75) -1;
                        else m = (rp_ptr->f_b_wt * max_percent / 100) + (rp_ptr->f_m_wt * max_percent / 75) -1;
                        break;
                case 6: /* Minimum social class */
@@ -3509,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;
@@ -3525,9 +3565,9 @@ static bool do_cmd_histpref(void)
        histpref_buf = histbuf;
 
 #ifdef JP
-       sprintf(buf, "histedit-%s.prf", player_base);
+       sprintf(buf, "histedit-%s.prf", creature_ptr->base_name);
 #else
-       sprintf(buf, "histpref-%s.prf", player_base);
+       sprintf(buf, "histpref-%s.prf", creature_ptr->base_name);
 #endif
        err = process_histpref_file(buf);
 
@@ -3564,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 */;
@@ -3582,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;
                }
        }
@@ -3590,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 */
@@ -3606,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;
@@ -3615,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);
@@ -3641,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);
@@ -3665,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'))
@@ -3673,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)
@@ -3702,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')
@@ -3727,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
                        }
                }
@@ -3754,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
                }
@@ -3770,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))
@@ -3784,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;
@@ -3815,7 +3855,7 @@ static void edit_history(void)
  * expensive CPU wise.  And it cuts down on player stupidity.
  * @return なし
  */
-static bool player_birth_aux(void)
+static bool player_birth_aux(player_type *creature_ptr)
 {
        int i, k, n, cs, os;
 
@@ -3849,7 +3889,7 @@ static bool player_birth_aux(void)
        put_str(_("職業        :", "Class       :"), 5, 1);
 
        /* Dump the default name */
-       c_put_str(TERM_L_BLUE, p_ptr->name, 1, 34);
+       c_put_str(TERM_L_BLUE, creature_ptr->name, 1, 34);
 
        /*** Instructions ***/
 
@@ -3967,8 +4007,8 @@ static bool player_birth_aux(void)
        }
 
        /* Set sex */
-       p_ptr->psex = (byte_hack)k;
-       sp_ptr = &sex_info[p_ptr->psex];
+       creature_ptr->psex = (byte_hack)k;
+       sp_ptr = &sex_info[creature_ptr->psex];
 
        /* Display */
        c_put_str(TERM_L_BLUE, sp_ptr->title, 3, 15);
@@ -3977,17 +4017,17 @@ static bool player_birth_aux(void)
        clear_from(10);
 
        /* Choose the players race */
-       p_ptr->prace = 0;
+       creature_ptr->prace = 0;
        while(1)
        {
                char temp[80*10];
                concptr t;
 
-               if (!get_player_race()) return FALSE;
+               if (!get_player_race(creature_ptr)) return FALSE;
 
                clear_from(10);
 
-               roff_to_buf(race_jouhou[p_ptr->prace], 74, temp, sizeof(temp));
+               roff_to_buf(race_jouhou[creature_ptr->prace], 74, temp, sizeof(temp));
                t = temp;
 
                for (i = 0; i< 10; i++)
@@ -4013,16 +4053,16 @@ static bool player_birth_aux(void)
        clear_from(10);
 
        /* Choose the players class */
-       p_ptr->pclass = 0;
+       creature_ptr->pclass = 0;
        while(1)
        {
                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[p_ptr->pclass], 74, temp, sizeof(temp));
+               roff_to_buf(class_jouhou[creature_ptr->pclass], 74, temp, sizeof(temp));
                t = temp;
 
                for (i = 0; i< 9; i++)
@@ -4045,19 +4085,19 @@ static bool player_birth_aux(void)
        }
 
        /* Choose the magic realms */
-       if (!get_player_realms()) return FALSE;
+       if (!get_player_realms(creature_ptr)) return FALSE;
 
        /* Choose the players seikaku */
-       p_ptr->pseikaku = 0;
+       creature_ptr->pseikaku = 0;
        while(1)
        {
                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[p_ptr->pseikaku], 74, temp, sizeof(temp));
+               roff_to_buf(seikaku_jouhou[creature_ptr->pseikaku], 74, temp, sizeof(temp));
                t = temp;
 
                for (i = 0; i< A_MAX; i++)
@@ -4075,8 +4115,8 @@ static bool player_birth_aux(void)
 #else
                if (get_check_strict("Are you sure? ", CHECK_DEFAULT_Y)) break;
 #endif
-               c_put_str(TERM_L_BLUE, p_ptr->name, 1, 34);
-               prt("", 1, 34+strlen(p_ptr->name));
+               c_put_str(TERM_L_BLUE, creature_ptr->name, 1, 34);
+               prt("", 1, 34+strlen(creature_ptr->name));
        }
 
        /* Clean up */
@@ -4111,16 +4151,14 @@ static bool player_birth_aux(void)
 
        if (autochara)
        {
-               if (!get_chara_limits()) 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 ***/
 
@@ -4154,14 +4192,9 @@ static bool player_birth_aux(void)
                /* Otherwise just get a character */
                else
                {
-                       /* Get a new character */
-                       get_stats();
-
-                       /* Roll for age/height/weight */
-                       get_ahw();
-
-                       /* Roll for social class */
-                       get_history();
+                       get_stats(creature_ptr);
+                       get_ahw(creature_ptr);
+                       get_history(creature_ptr);
                }
 
                /* Feedback */
@@ -4217,7 +4250,7 @@ static bool player_birth_aux(void)
                        bool accept = TRUE;
 
                        /* Get a new character */
-                       get_stats();
+                       get_stats(creature_ptr);
 
                        /* Advance the round */
                        auto_round++;
@@ -4242,7 +4275,7 @@ static bool player_birth_aux(void)
                                for (i = 0; i < A_MAX; i++)
                                {
                                        /* This stat is okay */
-                                       if (p_ptr->stat_max[i] >= stat_limit[i])
+                                       if (creature_ptr->stat_max[i] >= stat_limit[i])
                                        {
                                                stat_match[i]++;
                                        }
@@ -4258,18 +4291,15 @@ static bool player_birth_aux(void)
                        /* Break if "happy" */
                        if (accept)
                        {
-                               /* Roll for age/height/weight */
-                               get_ahw();
-
-                               /* Roll for social class */
-                               get_history();
+                               get_ahw(creature_ptr);
+                               get_history(creature_ptr);
 
                                if (autochara)
                                {
-                                       if ((p_ptr->age < chara_limit.agemin) || (p_ptr->age > chara_limit.agemax)) accept = FALSE;
-                                       if ((p_ptr->ht < chara_limit.htmin) || (p_ptr->ht > chara_limit.htmax)) accept = FALSE;
-                                       if ((p_ptr->wt < chara_limit.wtmin) || (p_ptr->wt > chara_limit.wtmax)) accept = FALSE;
-                                       if ((p_ptr->sc < chara_limit.scmin) || (p_ptr->sc > chara_limit.scmax)) accept = FALSE;
+                                       if ((creature_ptr->age < chara_limit.agemin) || (creature_ptr->age > chara_limit.agemax)) accept = FALSE;
+                                       if ((creature_ptr->ht < chara_limit.htmin) || (creature_ptr->ht > chara_limit.htmax)) accept = FALSE;
+                                       if ((creature_ptr->wt < chara_limit.wtmin) || (creature_ptr->wt > chara_limit.wtmax)) accept = FALSE;
+                                       if ((creature_ptr->sc < chara_limit.scmin) || (creature_ptr->sc > chara_limit.scmax)) accept = FALSE;
                                }
                                if (accept) break;
                        }
@@ -4281,7 +4311,7 @@ static bool player_birth_aux(void)
                        if (flag)
                        {
                                /* Dump data */
-                               birth_put_stats();
+                               birth_put_stats(creature_ptr);
 
                                /* Dump round */
                                put_str(format("%10ld", auto_round), 10, col+20);
@@ -4300,12 +4330,8 @@ static bool player_birth_aux(void)
                                /* Check for a keypress */
                                if (inkey())
                                {
-                                       /* Roll for age/height/weight */
-                                       get_ahw();
-
-                                       /* Roll for social class */
-                                       get_history();
-
+                                       get_ahw(creature_ptr);
+                                       get_history(creature_ptr);
                                        break;
                                }
                        }
@@ -4313,35 +4339,32 @@ static bool player_birth_aux(void)
 
                if (autoroller || autochara) sound(SOUND_LEVEL);
 
-               /* Flush input */
                flush();
 
                /*** Display ***/
 
-               /* Mode */
                mode = 0;
 
                /* Roll for base hitpoints */
-               get_extra(TRUE);
+               get_extra(creature_ptr, TRUE);
 
                /* Roll for gold */
-               get_money();
+               get_money(creature_ptr);
 
                /* Hack -- get a chaos patron even if you are not a chaos warrior */
-               p_ptr->chaos_patron = (s16b)randint0(MAX_PATRON);
+               creature_ptr->chaos_patron = (s16b)randint0(MAX_PATRON);
 
                /* Input loop */
                while (TRUE)
                {
                        /* Calculate the bonuses and hitpoints */
-                       p_ptr->update |= (PU_BONUS | PU_HP);
-                       update_creature(p_ptr);
+                       creature_ptr->update |= (PU_BONUS | PU_HP);
+                       update_creature(creature_ptr);
 
-                       p_ptr->chp = p_ptr->mhp;
-                       p_ptr->csp = p_ptr->msp;
+                       creature_ptr->chp = creature_ptr->mhp;
+                       creature_ptr->csp = creature_ptr->msp;
 
-                       /* Display the player */
-                       display_player(mode);
+                       display_player(p_ptr, mode);
 
                        /* Prepare a prompt (must squeeze everything in) */
                        Term_gotoxy(2, 23);
@@ -4354,7 +4377,6 @@ static bool player_birth_aux(void)
                        Term_addstr(-1, TERM_WHITE, _(", Enter この数値に決定", ", or Enter to accept"));
                        Term_addch(TERM_WHITE, b2);
 
-                       /* Prompt and get a command */
                        c = inkey();
 
                        /* Quit */
@@ -4372,11 +4394,10 @@ static bool player_birth_aux(void)
                        /* Previous character */
                        if (prev && (c == 'p'))
                        {
-                               load_prev_data(TRUE);
+                               load_prev_data(creature_ptr, TRUE);
                                continue;
                        }
 
-                       /* Toggle the display */
                        if ((c == 'H') || (c == 'h'))
                        {
                                mode = ((mode != 0) ? 0 : 1);
@@ -4409,7 +4430,7 @@ static bool player_birth_aux(void)
                if (c == '\r' || c == '\n' || c == ESCAPE) break;
 
                /* Save this for the "previous" character */
-               save_prev_data(&previous_char);
+               save_prev_data(creature_ptr, &previous_char);
                previous_char.quick_ok = FALSE;
 
                /* Note that a previous roll exists */
@@ -4423,16 +4444,16 @@ static bool player_birth_aux(void)
        get_name();
 
        /* Process the player name */
-       process_player_name(creating_savefile);
+       process_player_name(current_world_ptr->creating_savefile);
 
        /*** Edit character background ***/
-       edit_history();
+       edit_history(creature_ptr);
 
        /*** Finish up ***/
 
-       get_max_stats();
+       get_max_stats(creature_ptr);
 
-       get_virtues();
+       get_virtues(creature_ptr);
 
        /* Prompt for it */
 #ifdef JP
@@ -4453,10 +4474,10 @@ static bool player_birth_aux(void)
 
 
        /* Initialize random quests */
-       init_dungeon_quests();
+       init_dungeon_quests(creature_ptr);
 
        /* Save character data for quick start */
-       save_prev_data(&previous_char);
+       save_prev_data(creature_ptr, &previous_char);
        previous_char.quick_ok = TRUE;
 
        /* Accept */
@@ -4467,7 +4488,7 @@ static bool player_birth_aux(void)
  * @brief クイックスタート処理の問い合わせと実行を行う。/Ask whether the player use Quick Start or not.
  * @return なし
  */
-static bool ask_quick_start(void)
+static bool ask_quick_start(player_type *creature_ptr)
 {
        /* Doesn't have previous data */
        if (!previous_char.quick_ok) return FALSE;
@@ -4507,23 +4528,23 @@ static bool ask_quick_start(void)
                }
        }
 
-       load_prev_data(FALSE);
-       init_turn();
-       init_dungeon_quests();
+       load_prev_data(creature_ptr, FALSE);
+       init_turn(creature_ptr);
+       init_dungeon_quests(creature_ptr);
 
-       sp_ptr = &sex_info[p_ptr->psex];
-       rp_ptr = &race_info[p_ptr->prace];
-       cp_ptr = &class_info[p_ptr->pclass];
-       mp_ptr = &m_info[p_ptr->pclass];
-       ap_ptr = &seikaku_info[p_ptr->pseikaku];
+       sp_ptr = &sex_info[creature_ptr->psex];
+       rp_ptr = &race_info[creature_ptr->prace];
+       cp_ptr = &class_info[creature_ptr->pclass];
+       mp_ptr = &m_info[creature_ptr->pclass];
+       ap_ptr = &seikaku_info[creature_ptr->pseikaku];
 
        /* Calc hitdie, but don't roll */
-       get_extra(FALSE);
+       get_extra(creature_ptr, FALSE);
 
-       p_ptr->update |= (PU_BONUS | PU_HP);
-       update_creature(p_ptr);
-       p_ptr->chp = p_ptr->mhp;
-       p_ptr->csp = p_ptr->msp;
+       creature_ptr->update |= (PU_BONUS | PU_HP);
+       update_creature(creature_ptr);
+       creature_ptr->chp = creature_ptr->mhp;
+       creature_ptr->csp = creature_ptr->msp;
 
        /* Process the player name */
        process_player_name(FALSE);
@@ -4539,26 +4560,26 @@ static bool ask_quick_start(void)
  * fields, so we must be sure to clear them first.
  * @return なし
  */
-void player_birth(void)
+void player_birth(player_type *creature_ptr)
 {
        int i, j;
        char buf[80];
 
-       playtime = 0;
+       current_world_ptr->play_time = 0;
 
        /* 
         * 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();
+       player_wipe_without_name(creature_ptr);
 
        /* Create a new character */
 
        /* Quick start? */
-       if (!ask_quick_start())
+       if (!ask_quick_start(creature_ptr))
        {
                play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DEFAULT);
 
@@ -4566,10 +4587,10 @@ void player_birth(void)
                while (1)
                {
                        /* Roll up a new character */
-                       if (player_birth_aux()) break;
+                       if (player_birth_aux(creature_ptr)) break;
 
                        /* Wipe the player */
-                       player_wipe_without_name();
+                       player_wipe_without_name(creature_ptr);
                }
        }
 
@@ -4580,26 +4601,26 @@ void player_birth(void)
        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[p_ptr->psex].title);
-       do_cmd_write_nikki(NIKKI_BUNSHOU, 1, buf);
+       sprintf(buf,_("                            性別に%sを選択した。", "                            choose %s personality."), sex_info[creature_ptr->psex].title);
+       exe_write_diary(p_ptr, NIKKI_BUNSHOU, 1, buf);
 
-       sprintf(buf,_("                            種族に%sを選択した。", "                            choose %s race."), race_info[p_ptr->prace].title);
-       do_cmd_write_nikki(NIKKI_BUNSHOU, 1, buf);
+       sprintf(buf,_("                            種族に%sを選択した。", "                            choose %s race."), race_info[creature_ptr->prace].title);
+       exe_write_diary(p_ptr, NIKKI_BUNSHOU, 1, buf);
 
-       sprintf(buf,_("                            職業に%sを選択した。", "                            choose %s class."), class_info[p_ptr->pclass].title);
-       do_cmd_write_nikki(NIKKI_BUNSHOU, 1, buf);
+       sprintf(buf,_("                            職業に%sを選択した。", "                            choose %s class."), class_info[creature_ptr->pclass].title);
+       exe_write_diary(p_ptr, NIKKI_BUNSHOU, 1, buf);
 
-       if (p_ptr->realm1)
+       if (creature_ptr->realm1)
        {
-               sprintf(buf,_("                            魔法の領域に%s%sを選択した。", "                            choose %s%s realm."),realm_names[p_ptr->realm1], p_ptr->realm2 ? format("と%s",realm_names[p_ptr->realm2]) : "");
-               do_cmd_write_nikki(NIKKI_BUNSHOU, 1, buf);
+               sprintf(buf,_("                            魔法の領域に%s%sを選択した。", "                            choose %s%s realm."),realm_names[creature_ptr->realm1], creature_ptr->realm2 ? format("と%s",realm_names[creature_ptr->realm2]) : "");
+               exe_write_diary(p_ptr, NIKKI_BUNSHOU, 1, buf);
        }
 
-       sprintf(buf,_("                            性格に%sを選択した。", "                            choose %s."), seikaku_info[p_ptr->pseikaku].title);
-       do_cmd_write_nikki(NIKKI_BUNSHOU, 1, buf);
+       sprintf(buf,_("                            性格に%sを選択した。", "                            choose %s."), seikaku_info[creature_ptr->pseikaku].title);
+       exe_write_diary(p_ptr, NIKKI_BUNSHOU, 1, buf);
 
        /* Init the shops */
        for (i = 1; i < max_towns; i++)
@@ -4614,8 +4635,8 @@ void player_birth(void)
        seed_wilderness();
 
        /* Give beastman a mutation at character birth */
-       if (p_ptr->prace == RACE_BEASTMAN) hack_mutation = TRUE;
-       else hack_mutation = FALSE;
+       if (creature_ptr->prace == RACE_BEASTMAN) creature_ptr->hack_mutation = TRUE;
+       else creature_ptr->hack_mutation = FALSE;
 
        /* Set the message window flag as default */
        if (!window_flag[1])
@@ -4631,7 +4652,7 @@ void player_birth(void)
  * @param fff ファイルポインタ
  * @return なし
  */
-void dump_yourself(FILE *fff)
+void dump_yourself(player_type *creature_ptr, FILE *fff)
 {
        char temp[80*10];
        int i;
@@ -4639,9 +4660,9 @@ void dump_yourself(FILE *fff)
 
        if (!fff) return;
 
-       roff_to_buf(race_jouhou[p_ptr->prace], 78, temp, sizeof(temp));
+       roff_to_buf(race_jouhou[creature_ptr->prace], 78, temp, sizeof(temp));
        fprintf(fff, "\n\n");
-       fprintf(fff, _("種族: %s\n", "Race: %s\n"), race_info[p_ptr->prace].title);
+       fprintf(fff, _("種族: %s\n", "Race: %s\n"), race_info[creature_ptr->prace].title);
 
        t = temp;
        for (i = 0; i < 10; i++)
@@ -4651,9 +4672,9 @@ void dump_yourself(FILE *fff)
                fprintf(fff, "%s\n",t);
                t += strlen(t) + 1;
        }
-       roff_to_buf(class_jouhou[p_ptr->pclass], 78, temp, sizeof(temp));
+       roff_to_buf(class_jouhou[creature_ptr->pclass], 78, temp, sizeof(temp));
        fprintf(fff, "\n");
-       fprintf(fff, _("職業: %s\n", "Class: %s\n"), class_info[p_ptr->pclass].title);
+       fprintf(fff, _("職業: %s\n", "Class: %s\n"), class_info[creature_ptr->pclass].title);
 
        t = temp;
        for (i = 0; i < 10; i++)
@@ -4663,9 +4684,9 @@ void dump_yourself(FILE *fff)
                fprintf(fff, "%s\n",t);
                t += strlen(t) + 1;
        }
-       roff_to_buf(seikaku_jouhou[p_ptr->pseikaku], 78, temp, sizeof(temp));
+       roff_to_buf(seikaku_jouhou[creature_ptr->pseikaku], 78, temp, sizeof(temp));
        fprintf(fff, "\n");
-       fprintf(fff, _("性格: %s\n", "Pesonality: %s\n"), seikaku_info[p_ptr->pseikaku].title);
+       fprintf(fff, _("性格: %s\n", "Pesonality: %s\n"), seikaku_info[creature_ptr->pseikaku].title);
 
        t = temp;
        for (i = 0; i < A_MAX; i++)
@@ -4676,10 +4697,10 @@ void dump_yourself(FILE *fff)
                t += strlen(t) + 1;
        }
        fprintf(fff, "\n");
-       if (p_ptr->realm1)
+       if (creature_ptr->realm1)
        {
-               roff_to_buf(realm_jouhou[technic2magic(p_ptr->realm1)-1], 78, temp, sizeof(temp));
-               fprintf(fff, _("魔法: %s\n", "Realm: %s\n"), realm_names[p_ptr->realm1]);
+               roff_to_buf(realm_jouhou[technic2magic(creature_ptr->realm1)-1], 78, temp, sizeof(temp));
+               fprintf(fff, _("魔法: %s\n", "Realm: %s\n"), realm_names[creature_ptr->realm1]);
 
                t = temp;
                for (i = 0; i < A_MAX; i++)
@@ -4691,10 +4712,10 @@ void dump_yourself(FILE *fff)
                }
        }
        fprintf(fff, "\n");
-       if (p_ptr->realm2)
+       if (creature_ptr->realm2)
        {
-               roff_to_buf(realm_jouhou[technic2magic(p_ptr->realm2)-1], 78, temp, sizeof(temp));
-               fprintf(fff, _("魔法: %s\n", "Realm: %s\n"), realm_names[p_ptr->realm2]);
+               roff_to_buf(realm_jouhou[technic2magic(creature_ptr->realm2)-1], 78, temp, sizeof(temp));
+               fprintf(fff, _("魔法: %s\n", "Realm: %s\n"), realm_names[creature_ptr->realm2]);
 
                t = temp;
                for (i = 0; i < A_MAX; i++)