1 #include "birth/birth-select-race.h"
2 #include "birth/birth-util.h"
3 #include "io/input-key-acceptor.h"
4 #include "player/player-race.h"
5 #include "player/race-info-table.h"
6 #include "term/screen-processor.h"
7 #include "term/term-color-types.h"
8 #include "util/int-char-converter.h"
10 static const char p2 = ')';
12 static void enumerate_race_list(char *sym)
15 for (int n = 0; n < MAX_RACES; n++) {
16 rp_ptr = &race_info[n];
17 concptr str = rp_ptr->title;
21 sym[n] = ('A' + n - 26);
23 sprintf(buf, "%c%c%s", sym[n], p2, str);
24 put_str(buf, 12 + (n / 5), 1 + 16 * (n % 5));
28 static void display_race_stat(int cs, int *os, char *cur, char *sym)
34 c_put_str(TERM_WHITE, cur, 12 + (*os / 5), 1 + 16 * (*os % 5));
36 if (cs == MAX_RACES) {
37 sprintf(cur, "%c%c%s", '*', p2, _("ランダム", "Random"));
41 rp_ptr = &race_info[cs];
42 concptr str = rp_ptr->title;
43 sprintf(cur, "%c%c%s", sym[cs], p2, str);
44 c_put_str(TERM_L_BLUE, rp_ptr->title, 3, 40);
45 put_str(_("腕力 知能 賢さ 器用 耐久 魅力 経験 ", "Str Int Wis Dex Con Chr EXP "), 4, 40);
46 put_str(_("の種族修正", ": Race modification"), 3, 40 + strlen(rp_ptr->title));
48 sprintf(buf, "%+3d %+3d %+3d %+3d %+3d %+3d %+4d%% ", rp_ptr->r_adj[0], rp_ptr->r_adj[1], rp_ptr->r_adj[2], rp_ptr->r_adj[3], rp_ptr->r_adj[4],
49 rp_ptr->r_adj[5], (rp_ptr->r_exp - 100));
50 c_put_str(TERM_L_BLUE, buf, 5, 40);
53 c_put_str(TERM_YELLOW, cur, 12 + (cs / 5), 1 + 16 * (cs % 5));
57 static void interpret_race_select_key_move(char c, int *cs)
75 if ((*cs + 5) <= MAX_RACES)
80 static bool select_race(player_type *creature_ptr, char *sym, int *k)
83 sprintf(cur, "%c%c%s", '*', p2, _("ランダム", "Random"));
84 int cs = creature_ptr->prace;
87 display_race_stat(cs, &os, cur, sym);
92 sprintf(buf, _("種族を選んで下さい (%c-%c) ('='初期オプション設定): ", "Choose a race (%c-%c) ('=' for options): "), sym[0], sym[MAX_RACES - 1]);
101 if (c == ' ' || c == '\r' || c == '\n') {
102 if (cs == MAX_RACES) {
103 *k = randint0(MAX_RACES);
113 *k = randint0(MAX_RACES);
118 interpret_race_select_key_move(c, &cs);
119 *k = (islower(c) ? A2I(c) : -1);
120 if ((*k >= 0) && (*k < MAX_RACES)) {
125 *k = (isupper(c) ? (26 + c - 'A') : -1);
126 if ((*k >= 26) && (*k < MAX_RACES)) {
132 birth_help_option(creature_ptr, c, BK_RACE);
139 * @brief プレイヤーの種族選択を行う / Player race
142 bool get_player_race(player_type *creature_ptr)
146 _("注意:《種族》によってキャラクターの先天的な資質やボーナスが変化します。", "Note: Your 'race' determines various intrinsic factors and bonuses."),
150 enumerate_race_list(sym);
152 if (!select_race(creature_ptr, sym, &k))
155 creature_ptr->prace = (byte)k;
156 rp_ptr = &race_info[creature_ptr->prace];
157 c_put_str(TERM_L_BLUE, rp_ptr->title, 4, 15);