OSDN Git Service

Merge remote-tracking branch 'remotes/origin/feature/Fix-saved-floor-exceed' into...
[hengband/hengband.git] / src / birth / character-builder.c
1 /*!
2  * @file birth.c
3  * @brief プレイヤーの作成を行う / Create a player character
4  * @date 2013/12/28
5  * @author
6  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
7  *\n
8  * This software may be copied and distributed for educational, research,\n
9  * and not for profit purposes provided that this copyright and statement\n
10  * are included in all such copies.  Other copyrights may also apply.\n
11  * 2013 Deskull Doxygen向けのコメント整理\n
12  */
13
14 #include "birth/character-builder.h"
15 #include "birth/birth-explanations-table.h"
16 #include "birth/birth-wizard.h"
17 #include "birth/game-play-initializer.h"
18 #include "birth/quick-start.h"
19 #include "core/window-redrawer.h"
20 #include "floor/floor-town.h"
21 #include "floor/wild.h"
22 #include "game-option/option-flags.h"
23 #include "io/write-diary.h"
24 #include "main/music-definitions-table.h"
25 #include "main/sound-of-music.h"
26 #include "monster-floor/monster-remover.h"
27 #include "player/player-class.h"
28 #include "player/player-race-types.h"
29 #include "player/player-sex.h"
30 #include "player/race-info-table.h"
31 #include "store/store.h"
32 #include "view/display-messages.h"
33 #include "world/world.h"
34
35 /*!
36  * @brief プレーヤーキャラの作成結果を日記に書く
37  * @param creature_ptr プレーヤーへの参照ポインタ
38  * @return なし
39  */
40 static void write_birth_diary(player_type *creature_ptr)
41 {
42     message_add(" ");
43     message_add("  ");
44     message_add("====================");
45     message_add(" ");
46     message_add("  ");
47
48     exe_write_diary(creature_ptr, DIARY_GAMESTART, 1, _("-------- 新規ゲーム開始 --------", "------- Started New Game -------"));
49     exe_write_diary(creature_ptr, DIARY_DIALY, 0, NULL);
50     char buf[80];
51     sprintf(buf, _("                            性別に%sを選択した。", "                            chose %s gender."), sex_info[creature_ptr->psex].title);
52     exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1, buf);
53     sprintf(buf, _("                            種族に%sを選択した。", "                            chose %s race."), race_info[creature_ptr->prace].title);
54     exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1, buf);
55     sprintf(buf, _("                            職業に%sを選択した。", "                            chose %s class."), class_info[creature_ptr->pclass].title);
56     exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1, buf);
57     if (creature_ptr->realm1) {
58         sprintf(buf, _("                            魔法の領域に%s%sを選択した。", "                            chose %s%s."),
59             realm_names[creature_ptr->realm1], creature_ptr->realm2 ? format(_("と%s", " and %s realms"), realm_names[creature_ptr->realm2]) : _("", " realm"));
60         exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1, buf);
61     }
62
63     sprintf(buf, _("                            性格に%sを選択した。", "                            chose %s personality."),
64         personality_info[creature_ptr->pseikaku].title);
65     exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1, buf);
66 }
67
68 /*!
69  * @brief プレイヤー作成処理のメインルーチン/ Create a new character.
70  * @details
71  * Note that we may be called with "junk" leftover in the various
72  * fields, so we must be sure to clear them first.
73  * @return なし
74  */
75 void player_birth(player_type *creature_ptr, void (*process_autopick_file_command)(char *))
76 {
77     current_world_ptr->play_time = 0;
78     wipe_monsters_list(creature_ptr);
79     player_wipe_without_name(creature_ptr);
80     if (!ask_quick_start(creature_ptr)) {
81         play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DEFAULT);
82         while (TRUE) {
83             if (player_birth_wizard(creature_ptr, process_autopick_file_command))
84                 break;
85
86             player_wipe_without_name(creature_ptr);
87         }
88     }
89
90     write_birth_diary(creature_ptr);
91     for (int i = 1; i < max_towns; i++) {
92         for (int j = 0; j < MAX_STORES; j++) {
93             store_init(i, j);
94         }
95     }
96
97     seed_wilderness();
98     if (creature_ptr->prace == RACE_BEASTMAN)
99         creature_ptr->hack_mutation = TRUE;
100     else
101         creature_ptr->hack_mutation = FALSE;
102
103     if (!window_flag[1])
104         window_flag[1] |= PW_MESSAGE;
105
106     if (!window_flag[2])
107         window_flag[2] |= PW_INVEN;
108 }