OSDN Git Service

[Refactor] #37353 cmd4.c を cmd-dump.c に改名して関数整理.
[hengband/hengband.git] / src / birth.c
index dddaa2d..194d82b 100644 (file)
  */
 
 #include "angband.h"
+#include "util.h"
+#include "bldg.h"
+
+#include "artifact.h"
+#include "avatar.h"
+#include "cmd-dump.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"
+
+ /*
+  * The last character rolled,
+  * holded for quick start
+  */
+birther previous_char;
 
 /*!
  * オートローラーの内容を描画する間隔 / 
@@ -162,9 +194,9 @@ static concptr race_jouhou[MAX_RACES] =
 
 "Kobolds are a weak goblin race.  They love poisoned weapons, and can learn to throw poisoned darts (of which they carry an unlimited supply).  They are also inherently resistant to poison, although they are not one of the more powerful races.",
 
-"The hated and persecuted race of nocturnal dwarves, these cave-dwellers are not much bothered by darkness.  Their natural inclination to magical items has made them immune to effects which could drain away magical energy.",
+"The hated and persecuted race of nocturnal dwarves, these cavedwellers are not much bothered by darkness.  Their natural inclination to magical items has made them immune to effects which could drain away magical energy.",
 
-"Another dark, cave-dwelling race, likewise unhampered by darkness attacks, the Dark Elves have a long tradition and knowledge of magic.  They have an inherent magic missile attack available to them at a low level.  With their keen sight, they also learn to see invisible things as their relatives High-Elves do, but at a higher level.",
+"Another dark, cavedwelling race, likewise unhampered by darkness attacks, the Dark Elves have a long tradition and knowledge of magic.  They have an inherent magic missile attack available to them at a low level.  With their keen sight, they also learn to see invisible things as their relatives High-Elves do, but at a higher level.",
 
 "A humanoid race with dragon-like attributes.  As they advance levels, they gain new elemental resistances (up to Poison Resistance), and they also have a breath weapon, which becomes more powerful with experience.  The exact type of the breath weapon depends on the Draconian's class and level.  With their wings, they can easily escape any pit trap unharmed.",
 
@@ -1147,8 +1179,6 @@ void get_max_stats(void)
                        p_ptr->stat_cur[i] = max_max;
        }
        p_ptr->knowledge &= ~(KNOW_STAT);
-
-       /* Redisplay the stats later */
        p_ptr->redraw |= (PR_STATS);
 }
 
@@ -1199,7 +1229,7 @@ static void get_extra(bool roll_hitdie)
                p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
 
        /* Roll for hit point unless quick-start */
-       if (roll_hitdie) do_cmd_rerate_aux();
+       if (roll_hitdie) roll_hitdice(p_ptr, SPOP_NO_UPDATE);
 
        /* Initial hitpoints */
        p_ptr->mhp = p_ptr->player_hp[0];
@@ -1668,13 +1698,13 @@ static void player_wipe_without_name(void)
        p_ptr->total_weight = 0;
 
        /* No items */
-       inven_cnt = 0;
-       equip_cnt = 0;
+       p_ptr->inven_cnt = 0;
+       p_ptr->equip_cnt = 0;
 
-       /* Clear the inventory */
+       /* Clear the p_ptr->inventory_list */
        for (i = 0; i < INVEN_TOTAL; i++)
        {
-               object_wipe(&inventory[i]);
+               object_wipe(&p_ptr->inventory_list[i]);
        }
 
 
@@ -1735,7 +1765,7 @@ static void player_wipe_without_name(void)
        p_ptr->knowledge = 0;
 
        /* Clean the mutation count */
-       mutant_regenerate_mod = 100;
+       p_ptr->mutant_regenerate_mod = 100;
 
        /* Clear "cheat" options */
        cheat_peek = FALSE;
@@ -1751,7 +1781,7 @@ static void player_wipe_without_name(void)
        /* Assume no winning game */
        p_ptr->total_winner = FALSE;
 
-       world_player = FALSE;
+       p_ptr->timewalk = FALSE;
 
        /* Assume no panic save */
        p_ptr->panic_save = 0;
@@ -1803,17 +1833,17 @@ static void player_wipe_without_name(void)
        p_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;
 
-       /* Reset virtues*/
+       /* Reset virtues */
        for (i = 0; i < 8; i++) p_ptr->virtues[i]=0;
 
-       dungeon_type = 0;
+       p_ptr->dungeon_idx = 0;
 
        /* Set the recall dungeon accordingly */
        if (vanilla_town || ironman_downward)
@@ -1881,7 +1911,7 @@ static void init_dungeon_quests(void)
 }
 
 /*!
- * @brief ゲームターンを初期化する / Reset turn
+ * @brief ゲームターンを初期化する / Reset current_world_ptr->game_turn
  * @details アンデッド系種族は開始時刻を夜からにする。
  * @return なし
  */
@@ -1893,17 +1923,17 @@ static void init_turn(void)
                (p_ptr->prace == RACE_SPECTRE))
        {
                /* Undead start just after midnight */
-               turn = (TURNS_PER_TICK*3 * TOWN_DAWN) / 4 + 1;
-               turn_limit = TURNS_PER_TICK * TOWN_DAWN * MAX_DAYS + TURNS_PER_TICK * TOWN_DAWN * 3 / 4;
+               current_world_ptr->game_turn = (TURNS_PER_TICK*3 * TOWN_DAWN) / 4 + 1;
+               current_world_ptr->game_turn_limit = TURNS_PER_TICK * TOWN_DAWN * MAX_DAYS + TURNS_PER_TICK * TOWN_DAWN * 3 / 4;
        }
        else
        {
-               turn = 1;
-               turn_limit = TURNS_PER_TICK * TOWN_DAWN * (MAX_DAYS - 1) + TURNS_PER_TICK * TOWN_DAWN * 3 / 4;
+               current_world_ptr->game_turn = 1;
+               current_world_ptr->game_turn_limit = TURNS_PER_TICK * TOWN_DAWN * (MAX_DAYS - 1) + TURNS_PER_TICK * TOWN_DAWN * 3 / 4;
        }
 
-       dungeon_turn = 1;
-       dungeon_turn_limit = TURNS_PER_TICK * TOWN_DAWN * (MAX_DAYS - 1) + TURNS_PER_TICK * TOWN_DAWN * 3 / 4;
+       current_world_ptr->dungeon_turn = 1;
+       current_world_ptr->dungeon_turn_limit = TURNS_PER_TICK * TOWN_DAWN * (MAX_DAYS - 1) + TURNS_PER_TICK * TOWN_DAWN * 3 / 4;
 }
 
 
@@ -1924,7 +1954,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 = &p_ptr->inventory_list[item]; 
  
                /* Skip non-objects */ 
                if (!o_ptr->k_idx) continue; 
@@ -1933,7 +1963,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 (p_ptr->inventory_list[slot].k_idx) continue; 
  
                i_ptr = &object_type_body; 
                object_copy(i_ptr, o_ptr); 
@@ -1953,12 +1983,12 @@ static void wield_all(void)
                        floor_item_optimize(0 - item); 
                } 
  
-               o_ptr = &inventory[slot]; 
+               o_ptr = &p_ptr->inventory_list[slot]; 
                object_copy(o_ptr, i_ptr); 
                p_ptr->total_weight += i_ptr->weight; 
  
                /* Increment the equip counter by hand */ 
-               equip_cnt++;
+               p_ptr->equip_cnt++;
 
        } 
        return; 
@@ -4116,7 +4146,7 @@ static bool player_birth_aux(void)
        /* Clear */
        clear_from(10);
 
-       /* Reset turn; before auto-roll and after choosing race */
+       /* Reset current_world_ptr->game_turn; before auto-roll and after choosing race */
        init_turn();
 
        /*** Generate ***/
@@ -4541,11 +4571,11 @@ void player_birth(void)
        int i, j;
        char buf[80];
 
-       playtime = 0;
+       current_world_ptr->play_time = 0;
 
        /* 
         * Wipe monsters in old dungeon
-        * This wipe destroys value of m_list[].cur_num .
+        * This wipe destroys value of current_floor_ptr->m_list[].cur_num .
         */
        wipe_m_list();
 
@@ -4611,8 +4641,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 (p_ptr->prace == RACE_BEASTMAN) p_ptr->hack_mutation = TRUE;
+       else p_ptr->hack_mutation = FALSE;
 
        /* Set the message window flag as default */
        if (!window_flag[1])