変愚蛮怒のメインリポジトリです
Revision | 3d9bb32afea4bc24f2aedf97dd11065f5ee0aa84 (tree) |
---|---|
Zeit | 2020-03-08 14:00:52 |
Autor | Hourier <hourier@user...> |
Commiter | Hourier |
[Refactor] #40030 Moved process_speak_sound() from monster-process.c to monster-move.c/h
@@ -35,7 +35,6 @@ | ||
35 | 35 | #include "monster-status.h" |
36 | 36 | #include "monster-spell.h" |
37 | 37 | #include "monster-process.h" |
38 | -#include "files.h" | |
39 | 38 | |
40 | 39 | void decide_drop_from_monster(player_type *target_ptr, MONSTER_IDX m_idx, bool is_riding_mon); |
41 | 40 | bool process_stealth(player_type *target_ptr, MONSTER_IDX m_idx); |
@@ -45,7 +44,6 @@ void process_angar(player_type *target_ptr, MONSTER_IDX m_idx, bool see_m); | ||
45 | 44 | bool explode_grenade(player_type *target_ptr, MONSTER_IDX m_idx); |
46 | 45 | bool decide_monster_multiplication(player_type *target_ptr, MONSTER_IDX m_idx, POSITION oy, POSITION ox); |
47 | 46 | void process_special(player_type *target_ptr, MONSTER_IDX m_idx); |
48 | -void process_speak_sound(player_type *target_ptr, MONSTER_IDX m_idx, POSITION oy, POSITION ox, bool aware); | |
49 | 47 | bool cast_spell(player_type *target_ptr, MONSTER_IDX m_idx, bool aware); |
50 | 48 | |
51 | 49 | bool process_monster_fear(player_type *target_ptr, turn_flags *turn_flags_ptr, MONSTER_IDX m_idx); |
@@ -347,60 +345,6 @@ void process_special(player_type *target_ptr, MONSTER_IDX m_idx) | ||
347 | 345 | |
348 | 346 | |
349 | 347 | /*! |
350 | - * @brief モンスターを喋らせたり足音を立てたりする | |
351 | - * @param target_ptr プレーヤーへの参照ポインタ | |
352 | - * @param m_idx モンスターID | |
353 | - * @param oy モンスターが元々いたY座標 | |
354 | - * @param ox モンスターが元々いたX座標 | |
355 | - * @param aware モンスターがプレーヤーに気付いているならばTRUE、超隠密状態ならばFALSE | |
356 | - * @return なし | |
357 | - */ | |
358 | -void process_speak_sound(player_type *target_ptr, MONSTER_IDX m_idx, POSITION oy, POSITION ox, bool aware) | |
359 | -{ | |
360 | - if (target_ptr->phase_out) return; | |
361 | - | |
362 | - monster_type *m_ptr = &target_ptr->current_floor_ptr->m_list[m_idx]; | |
363 | - monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx]; | |
364 | - if (m_ptr->ap_r_idx == MON_CYBER && | |
365 | - one_in_(CYBERNOISE) && | |
366 | - !m_ptr->ml && (m_ptr->cdis <= MAX_SIGHT)) | |
367 | - { | |
368 | - if (disturb_minor) disturb(target_ptr, FALSE, FALSE); | |
369 | - msg_print(_("重厚な足音が聞こえた。", "You hear heavy steps.")); | |
370 | - } | |
371 | - | |
372 | - if (((ap_r_ptr->flags2 & RF2_CAN_SPEAK) == 0) || !aware || | |
373 | - !one_in_(SPEAK_CHANCE) || | |
374 | - !player_has_los_bold(target_ptr, oy, ox) || | |
375 | - !projectable(target_ptr, oy, ox, target_ptr->y, target_ptr->x)) | |
376 | - return; | |
377 | - | |
378 | - GAME_TEXT m_name[MAX_NLEN]; | |
379 | - char monmessage[1024]; | |
380 | - concptr filename; | |
381 | - | |
382 | - if (m_ptr->ml) | |
383 | - monster_desc(target_ptr, m_name, m_ptr, 0); | |
384 | - else | |
385 | - strcpy(m_name, _("それ", "It")); | |
386 | - | |
387 | - if (MON_MONFEAR(m_ptr)) | |
388 | - filename = _("monfear_j.txt", "monfear.txt"); | |
389 | - else if (is_pet(m_ptr)) | |
390 | - filename = _("monpet_j.txt", "monpet.txt"); | |
391 | - else if (is_friendly(m_ptr)) | |
392 | - filename = _("monfrien_j.txt", "monfrien.txt"); | |
393 | - else | |
394 | - filename = _("monspeak_j.txt", "monspeak.txt"); | |
395 | - | |
396 | - if (get_rnd_line(filename, m_ptr->ap_r_idx, monmessage) == 0) | |
397 | - { | |
398 | - msg_format(_("%^s%s", "%^s %s"), m_name, monmessage); | |
399 | - } | |
400 | -} | |
401 | - | |
402 | - | |
403 | -/*! | |
404 | 348 | * @brief モンスターを分裂させるかどうかを決定する (分裂もさせる) |
405 | 349 | * @param target_ptr プレーヤーへの参照ポインタ |
406 | 350 | * @param m_idx モンスターID |
@@ -10,6 +10,7 @@ | ||
10 | 10 | #include "monster/monster-update.h" |
11 | 11 | #include "cmd/cmd-pet.h" |
12 | 12 | #include "creature.h" |
13 | +#include "files.h" | |
13 | 14 | #include "monster-status.h" |
14 | 15 | #include "player-move.h" |
15 | 16 |
@@ -441,3 +442,57 @@ bool process_monster_movement(player_type *target_ptr, turn_flags *turn_flags_pt | ||
441 | 442 | |
442 | 443 | return TRUE; |
443 | 444 | } |
445 | + | |
446 | + | |
447 | +/*! | |
448 | + * @brief モンスターを喋らせたり足音を立てたりする | |
449 | + * @param target_ptr プレーヤーへの参照ポインタ | |
450 | + * @param m_idx モンスターID | |
451 | + * @param oy モンスターが元々いたY座標 | |
452 | + * @param ox モンスターが元々いたX座標 | |
453 | + * @param aware モンスターがプレーヤーに気付いているならばTRUE、超隠密状態ならばFALSE | |
454 | + * @return なし | |
455 | + */ | |
456 | +void process_speak_sound(player_type *target_ptr, MONSTER_IDX m_idx, POSITION oy, POSITION ox, bool aware) | |
457 | +{ | |
458 | + if (target_ptr->phase_out) return; | |
459 | + | |
460 | + monster_type *m_ptr = &target_ptr->current_floor_ptr->m_list[m_idx]; | |
461 | + monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx]; | |
462 | + if (m_ptr->ap_r_idx == MON_CYBER && | |
463 | + one_in_(CYBERNOISE) && | |
464 | + !m_ptr->ml && (m_ptr->cdis <= MAX_SIGHT)) | |
465 | + { | |
466 | + if (disturb_minor) disturb(target_ptr, FALSE, FALSE); | |
467 | + msg_print(_("重厚な足音が聞こえた。", "You hear heavy steps.")); | |
468 | + } | |
469 | + | |
470 | + if (((ap_r_ptr->flags2 & RF2_CAN_SPEAK) == 0) || !aware || | |
471 | + !one_in_(SPEAK_CHANCE) || | |
472 | + !player_has_los_bold(target_ptr, oy, ox) || | |
473 | + !projectable(target_ptr, oy, ox, target_ptr->y, target_ptr->x)) | |
474 | + return; | |
475 | + | |
476 | + GAME_TEXT m_name[MAX_NLEN]; | |
477 | + char monmessage[1024]; | |
478 | + concptr filename; | |
479 | + | |
480 | + if (m_ptr->ml) | |
481 | + monster_desc(target_ptr, m_name, m_ptr, 0); | |
482 | + else | |
483 | + strcpy(m_name, _("それ", "It")); | |
484 | + | |
485 | + if (MON_MONFEAR(m_ptr)) | |
486 | + filename = _("monfear_j.txt", "monfear.txt"); | |
487 | + else if (is_pet(m_ptr)) | |
488 | + filename = _("monpet_j.txt", "monpet.txt"); | |
489 | + else if (is_friendly(m_ptr)) | |
490 | + filename = _("monfrien_j.txt", "monfrien.txt"); | |
491 | + else | |
492 | + filename = _("monspeak_j.txt", "monspeak.txt"); | |
493 | + | |
494 | + if (get_rnd_line(filename, m_ptr->ap_r_idx, monmessage) == 0) | |
495 | + { | |
496 | + msg_format(_("%^s%s", "%^s %s"), m_name, monmessage); | |
497 | + } | |
498 | +} |
@@ -4,3 +4,4 @@ | ||
4 | 4 | #include "monster/monster-util.h" |
5 | 5 | |
6 | 6 | bool process_monster_movement(player_type *target_ptr, turn_flags *turn_flags_ptr, MONSTER_IDX m_idx, DIRECTION *mm, POSITION oy, POSITION ox, int *count); |
7 | +void process_speak_sound(player_type *target_ptr, MONSTER_IDX m_idx, POSITION oy, POSITION ox, bool aware); |