• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

変愚蛮怒のメインリポジトリです


Commit MetaInfo

修訂3d9bb32afea4bc24f2aedf97dd11065f5ee0aa84 (tree)
時間2020-03-08 14:00:52
作者Hourier <hourier@user...>
CommiterHourier

Log Message

[Refactor] #40030 Moved process_speak_sound() from monster-process.c to monster-move.c/h

Change Summary

差異

--- a/src/monster-process.c
+++ b/src/monster-process.c
@@ -35,7 +35,6 @@
3535 #include "monster-status.h"
3636 #include "monster-spell.h"
3737 #include "monster-process.h"
38-#include "files.h"
3938
4039 void decide_drop_from_monster(player_type *target_ptr, MONSTER_IDX m_idx, bool is_riding_mon);
4140 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);
4544 bool explode_grenade(player_type *target_ptr, MONSTER_IDX m_idx);
4645 bool decide_monster_multiplication(player_type *target_ptr, MONSTER_IDX m_idx, POSITION oy, POSITION ox);
4746 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);
4947 bool cast_spell(player_type *target_ptr, MONSTER_IDX m_idx, bool aware);
5048
5149 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)
347345
348346
349347 /*!
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-/*!
404348 * @brief モンスターを分裂させるかどうかを決定する (分裂もさせる)
405349 * @param target_ptr プレーヤーへの参照ポインタ
406350 * @param m_idx モンスターID
--- a/src/monster/monster-move.c
+++ b/src/monster/monster-move.c
@@ -10,6 +10,7 @@
1010 #include "monster/monster-update.h"
1111 #include "cmd/cmd-pet.h"
1212 #include "creature.h"
13+#include "files.h"
1314 #include "monster-status.h"
1415 #include "player-move.h"
1516
@@ -441,3 +442,57 @@ bool process_monster_movement(player_type *target_ptr, turn_flags *turn_flags_pt
441442
442443 return TRUE;
443444 }
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+}
--- a/src/monster/monster-move.h
+++ b/src/monster/monster-move.h
@@ -4,3 +4,4 @@
44 #include "monster/monster-util.h"
55
66 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);