変愚蛮怒のメインリポジトリです
Revisión | 74b5f0fd54b0eb80e0afad5625ad9c22c96dd3e7 (tree) |
---|---|
Tiempo | 2020-02-29 00:22:00 |
Autor | Hourier <hourier@user...> |
Commiter | Hourier |
[Refacotr] #39962 display_player() からdecide_current_floor() を分離 / Separated decide_current_floor() from display_player()
@@ -152,6 +152,85 @@ static void display_player_stats(player_type *creature_ptr) | ||
152 | 152 | |
153 | 153 | |
154 | 154 | /*! |
155 | + * @brief 現在いるフロアを、または死んでいたらどこでどう死んだかをバッファに詰める | |
156 | + * @param creature_ptr プレーヤーへの参照ポインタ | |
157 | + * @param statmsg メッセージバッファ | |
158 | + * @param map_name マップ名へのコールバック | |
159 | + * @return なし | |
160 | + */ | |
161 | +static void decide_current_floor(player_type *creature_ptr, char *statmsg, map_name_pf map_name) | |
162 | +{ | |
163 | + floor_type *floor_ptr = creature_ptr->current_floor_ptr; | |
164 | + if (creature_ptr->is_dead) | |
165 | + { | |
166 | + if (current_world_ptr->total_winner) | |
167 | + { | |
168 | + sprintf(statmsg, _("…あなたは勝利の後%sした。", "...You %s after winning."), | |
169 | + streq(creature_ptr->died_from, "Seppuku") ? _("切腹", "committed seppuku") : _("引退", "retired from the adventure")); | |
170 | + } | |
171 | + else if (!floor_ptr->dun_level) | |
172 | + { | |
173 | +#ifdef JP | |
174 | + sprintf(statmsg, "…あなたは%sで%sに殺された。", (*map_name)(creature_ptr), creature_ptr->died_from); | |
175 | +#else | |
176 | + sprintf(statmsg, "...You were killed by %s in %s.", creature_ptr->died_from, map_name(creature_ptr)); | |
177 | +#endif | |
178 | + } | |
179 | + else if (floor_ptr->inside_quest && is_fixed_quest_idx(floor_ptr->inside_quest)) | |
180 | + { | |
181 | + /* Get the quest text */ | |
182 | + /* Bewere that INIT_ASSIGN resets the cur_num. */ | |
183 | + init_flags = INIT_NAME_ONLY; | |
184 | + process_dungeon_file(creature_ptr, "q_info.txt", 0, 0, 0, 0); | |
185 | +#ifdef JP | |
186 | + sprintf(statmsg, "…あなたは、クエスト「%s」で%sに殺された。", quest[floor_ptr->inside_quest].name, creature_ptr->died_from); | |
187 | +#else | |
188 | + sprintf(statmsg, "...You were killed by %s in the quest '%s'.", creature_ptr->died_from, quest[floor_ptr->inside_quest].name); | |
189 | +#endif | |
190 | + } | |
191 | + else | |
192 | + { | |
193 | +#ifdef JP | |
194 | + sprintf(statmsg, "…あなたは、%sの%d階で%sに殺された。", (*map_name)(creature_ptr), (int)floor_ptr->dun_level, creature_ptr->died_from); | |
195 | +#else | |
196 | + sprintf(statmsg, "...You were killed by %s on level %d of %s.", creature_ptr->died_from, floor_ptr->dun_level, map_name(creature_ptr)); | |
197 | +#endif | |
198 | + } | |
199 | + | |
200 | + return; | |
201 | + } | |
202 | + | |
203 | + if (!current_world_ptr->character_dungeon) return; | |
204 | + | |
205 | + if (!floor_ptr->dun_level) | |
206 | + { | |
207 | + sprintf(statmsg, _("…あなたは現在、 %s にいる。", "...Now, you are in %s."), map_name(creature_ptr)); | |
208 | + return; | |
209 | + } | |
210 | + | |
211 | + if (floor_ptr->inside_quest && is_fixed_quest_idx(floor_ptr->inside_quest)) | |
212 | + { | |
213 | + /* Clear the text */ | |
214 | + /* Must be done before doing INIT_SHOW_TEXT */ | |
215 | + for (int i = 0; i < 10; i++) | |
216 | + quest_text[i][0] = '\0'; | |
217 | + | |
218 | + quest_text_line = 0; | |
219 | + init_flags = INIT_NAME_ONLY; | |
220 | + process_dungeon_file(creature_ptr, "q_info.txt", 0, 0, 0, 0); | |
221 | + sprintf(statmsg, _("…あなたは現在、 クエスト「%s」を遂行中だ。", "...Now, you are in the quest '%s'."), quest[floor_ptr->inside_quest].name); | |
222 | + return; | |
223 | + } | |
224 | + | |
225 | +#ifdef JP | |
226 | + sprintf(statmsg, "…あなたは現在、 %s の %d 階で探索している。", map_name(creature_ptr), (int)floor_ptr->dun_level); | |
227 | +#else | |
228 | + sprintf(statmsg, "...Now, you are exploring level %d of %s.", (int)floor_ptr->dun_level, map_name(creature_ptr)); | |
229 | +#endif | |
230 | +} | |
231 | + | |
232 | + | |
233 | +/*! | |
155 | 234 | * @brief プレイヤーのステータス表示メイン処理 |
156 | 235 | * Display the character on the screen (various modes) |
157 | 236 | * @param creature_ptr プレーヤーへの参照ポインタ |
@@ -196,85 +275,11 @@ void display_player(player_type *creature_ptr, int mode, map_name_pf map_name) | ||
196 | 275 | |
197 | 276 | char statmsg[1000]; |
198 | 277 | put_str(_("(キャラクターの生い立ち)", "(Character Background)"), 11, 25); |
199 | - | |
200 | 278 | for (int i = 0; i < 4; i++) |
201 | - { | |
202 | 279 | put_str(creature_ptr->history[i], i + 12, 10); |
203 | - } | |
204 | 280 | |
205 | 281 | *statmsg = '\0'; |
206 | - | |
207 | - if (creature_ptr->is_dead) | |
208 | - { | |
209 | - if (current_world_ptr->total_winner) | |
210 | - { | |
211 | -#ifdef JP | |
212 | - sprintf(statmsg, "…あなたは勝利の後%sした。", streq(creature_ptr->died_from, "Seppuku") ? "切腹" : "引退"); | |
213 | -#else | |
214 | - sprintf(statmsg, "...You %s after winning.", streq(creature_ptr->died_from, "Seppuku") ? "committed seppuku" : "retired from the adventure"); | |
215 | -#endif | |
216 | - } | |
217 | - else if (!floor_ptr->dun_level) | |
218 | - { | |
219 | -#ifdef JP | |
220 | - sprintf(statmsg, "…あなたは%sで%sに殺された。", (*map_name)(creature_ptr), creature_ptr->died_from); | |
221 | -#else | |
222 | - sprintf(statmsg, "...You were killed by %s in %s.", creature_ptr->died_from, map_name(creature_ptr)); | |
223 | -#endif | |
224 | - } | |
225 | - else if (floor_ptr->inside_quest && is_fixed_quest_idx(floor_ptr->inside_quest)) | |
226 | - { | |
227 | - /* Get the quest text */ | |
228 | - /* Bewere that INIT_ASSIGN resets the cur_num. */ | |
229 | - init_flags = INIT_NAME_ONLY; | |
230 | - | |
231 | - process_dungeon_file(creature_ptr, "q_info.txt", 0, 0, 0, 0); | |
232 | - | |
233 | -#ifdef JP | |
234 | - sprintf(statmsg, "…あなたは、クエスト「%s」で%sに殺された。", quest[floor_ptr->inside_quest].name, creature_ptr->died_from); | |
235 | -#else | |
236 | - sprintf(statmsg, "...You were killed by %s in the quest '%s'.", creature_ptr->died_from, quest[floor_ptr->inside_quest].name); | |
237 | -#endif | |
238 | - } | |
239 | - else | |
240 | - { | |
241 | -#ifdef JP | |
242 | - sprintf(statmsg, "…あなたは、%sの%d階で%sに殺された。", (*map_name)(creature_ptr), (int)floor_ptr->dun_level, creature_ptr->died_from); | |
243 | -#else | |
244 | - sprintf(statmsg, "...You were killed by %s on level %d of %s.", creature_ptr->died_from, floor_ptr->dun_level, map_name(creature_ptr)); | |
245 | -#endif | |
246 | - } | |
247 | - } | |
248 | - else if (current_world_ptr->character_dungeon) | |
249 | - { | |
250 | - if (!floor_ptr->dun_level) | |
251 | - { | |
252 | - sprintf(statmsg, _("…あなたは現在、 %s にいる。", "...Now, you are in %s."), map_name(creature_ptr)); | |
253 | - } | |
254 | - else if (floor_ptr->inside_quest && is_fixed_quest_idx(floor_ptr->inside_quest)) | |
255 | - { | |
256 | - /* Clear the text */ | |
257 | - /* Must be done before doing INIT_SHOW_TEXT */ | |
258 | - for (int i = 0; i < 10; i++) | |
259 | - { | |
260 | - quest_text[i][0] = '\0'; | |
261 | - } | |
262 | - | |
263 | - quest_text_line = 0; | |
264 | - init_flags = INIT_NAME_ONLY; | |
265 | - process_dungeon_file(creature_ptr, "q_info.txt", 0, 0, 0, 0); | |
266 | - sprintf(statmsg, _("…あなたは現在、 クエスト「%s」を遂行中だ。", "...Now, you are in the quest '%s'."), quest[floor_ptr->inside_quest].name); | |
267 | - } | |
268 | - else | |
269 | - { | |
270 | -#ifdef JP | |
271 | - sprintf(statmsg, "…あなたは現在、 %s の %d 階で探索している。", map_name(creature_ptr), (int)floor_ptr->dun_level); | |
272 | -#else | |
273 | - sprintf(statmsg, "...Now, you are exploring level %d of %s.", floor_ptr->dun_level, map_name(creature_ptr)); | |
274 | -#endif | |
275 | - } | |
276 | - } | |
277 | - | |
282 | + decide_current_floor(creature_ptr, statmsg, map_name); | |
278 | 283 | if (!*statmsg) return; |
279 | 284 | |
280 | 285 | char temp[64 * 2]; |