OSDN Git Service

Merge pull request #1136 from dis-/feature/Add-Sound
authordis- <dis.rogue@gmail.com>
Sat, 22 May 2021 14:18:31 +0000 (23:18 +0900)
committerGitHub <noreply@github.com>
Sat, 22 May 2021 14:18:31 +0000 (23:18 +0900)
[Feature] 効果音の追加。空腹時、会心の一撃、切れ味

lib/xtra/sound/sound.cfg
src/combat/attack-criticality.cpp
src/combat/attack-criticality.h
src/main/sound-definitions-table.cpp
src/main/sound-definitions-table.h
src/object-enchant/vorpal-weapon.cpp
src/player/digestion-processor.cpp

index 969bc96..68cf95d 100644 (file)
@@ -117,3 +117,20 @@ show =
 explode =
 glass =
 reflect = sword-clash1-r.wav
+hungry = 
+weak = 
+faint = 
+good_hit = 
+great_hit = 
+superb_hit = 
+star_great_hit =
+star_superb_hit =
+gouge_hit =
+maim_hit =
+carve_hit =
+cleave_hit =
+smite_hit =
+eviscerate_hit =
+shred_hit =
+
+
index c5f5c8e..e19e26f 100644 (file)
@@ -1,6 +1,7 @@
 #include "combat/attack-criticality.h"
 #include "combat/combat-options-type.h"
 #include "inventory/inventory-slot-types.h"
+#include "main/sound-of-music.h"
 #include "monster-race/monster-race.h"
 #include "monster-race/race-flags1.h"
 #include "monster-race/race-flags7.h"
  *
  * @param k クリティカルの強度を決定する値
  * @param base_dam クリティカル適用前のダメージ
- * @return クリティカルを適用したダメージと、クリティカル発生時に表示するメッセージのタプルを返す
+ * @return ã\82¯ã\83ªã\83\86ã\82£ã\82«ã\83«ã\82\92é\81©ç\94¨ã\81\97ã\81\9fã\83\80ã\83¡ã\83¼ã\82¸ã\81¨ã\80\81ã\82¯ã\83ªã\83\86ã\82£ã\82«ã\83«ç\99ºç\94\9fæ\99\82ã\81«è¡¨ç¤ºã\81\99ã\82\8bã\83¡ã\83\83ã\82»ã\83¼ã\82¸ã\81¨ã\80\81ã\82¯ã\83ªã\83\86ã\82£ã\82«ã\83«å\8a¹æ\9e\9cé\9f³ã\81®ã\82¿ã\83\97ã\83«ã\82\92è¿\94ã\81\99
  */
-std::tuple<HIT_POINT, concptr> apply_critical_norm_damage(int k, HIT_POINT base_dam)
+std::tuple<HIT_POINT, concptr, sound_type> apply_critical_norm_damage(int k, HIT_POINT base_dam)
 {
     if (k < 400) {
-        return { 2 * base_dam + 5, _("手ごたえがあった!", "It was a good hit!") };
+        return { 2 * base_dam + 5, _("手ごたえがあった!", "It was a good hit!"), SOUND_GOOD_HIT };
     }
     if (k < 700) {
-        return { 2 * base_dam + 10, _("かなりの手ごたえがあった!", "It was a great hit!") };
+        return { 2 * base_dam + 10, _("かなりの手ごたえがあった!", "It was a great hit!"), SOUND_GREAT_HIT };
     }
     if (k < 900) {
-        return { 3 * base_dam + 15, _("会心の一撃だ!", "It was a superb hit!") };
+        return { 3 * base_dam + 15, _("会心の一撃だ!", "It was a superb hit!"), SOUND_SUPERB_HIT };
     }
     if (k < 1300) {
-        return { 3 * base_dam + 20, _("最高の会心の一撃だ!", "It was a *GREAT* hit!") };
+        return { 3 * base_dam + 20, _("最高の会心の一撃だ!", "It was a *GREAT* hit!"), SOUND_STAR_GREAT_HIT };
     }
-    return { ((7 * base_dam) / 2) + 25, _("比類なき最高の会心の一撃だ!", "It was a *SUPERB* hit!") };
+    return { ((7 * base_dam) / 2) + 25, _("比類なき最高の会心の一撃だ!", "It was a *SUPERB* hit!"), SOUND_STAR_SUPERB_HIT };
 }
 
 /*!
@@ -67,7 +68,8 @@ HIT_POINT critical_norm(player_type *attacker_ptr, WEIGHT weight, int plus, HIT_
     if (impact || (mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN))
         k += randint1(650);
 
-    auto [critical_dam, msg] = apply_critical_norm_damage(k, dam);
+    auto [critical_dam, msg, battle_sound] = apply_critical_norm_damage(k, dam);
+    sound(battle_sound);
     msg_print(msg);
     return critical_dam;
 }
index a0d5f3e..f4b54a0 100644 (file)
@@ -1,13 +1,14 @@
 #pragma once
 
 #include "combat/combat-options-type.h"
+#include "main/sound-definitions-table.h"
 #include "system/angband.h"
 
 #include <tuple>
 
 typedef struct player_attack_type player_attack_type;
 typedef struct player_type player_type;
-std::tuple<HIT_POINT, concptr> apply_critical_norm_damage(int k, HIT_POINT base_dam);
+std::tuple<HIT_POINT, concptr, sound_type> apply_critical_norm_damage(int k, HIT_POINT base_dam);
 HIT_POINT critical_norm(player_type *attacker_ptr, WEIGHT weight, int plus, HIT_POINT dam, s16b meichuu, combat_options mode, bool impact = false);
 int calc_monster_critical(DICE_NUMBER dice, DICE_SID sides, HIT_POINT dam);
 void critical_attack(player_type *attacker_ptr, player_attack_type *pa_ptr);
index c7378ff..6db77e0 100644 (file)
@@ -5,73 +5,87 @@
 
 #include "main/sound-definitions-table.h"
 
-const concptr angband_sound_name[SOUND_MAX] =
-{
-       "dummy",
-       "hit",
-       "miss",
-       "flee",
-       "drop",
-       "kill",
-       "level",
-       "death",
-       "study",
-       "teleport",
-       "shoot",
-       "quaff",
-       "zap",
-       "walk",
-       "tpother",
-       "hitwall",
-       "eat",
-       "store1",
-       "store2",
-       "store3",
-       "store4",
-       "dig",
-       "opendoor",
-       "shutdoor",
-       "tplevel",
-       "scroll",
-       "buy",
-       "sell",
-       "warn",
-       "rocket",
-       "n_kill",
-       "u_kill",
-       "quest",
-       "heal",
-       "x_heal",
-       "bite",
-       "claw",
-       "m_spell",
-       "summon",
-       "breath",
-       "ball",
-       "m_heal",
-       "atkspell",
-       "evil",
-       "touch",
-       "sting",
-       "crush",
-       "slime",
-       "wail",
-       "winner",
-       "fire",
-       "acid",
-       "elec",
-       "cold",
-       "illegal",
-       "fail",
-       "wakeup",
-       "invuln",
-       "fall",
-       "pain",
-       "destitem",
-       "moan",
-       "show",
-       "unused",
-       "explode",
-       "glass",
-       "reflect",
+const concptr angband_sound_name[SOUND_MAX] = {
+    "dummy",
+    "hit",
+    "miss",
+    "flee",
+    "drop",
+    "kill",
+    "level",
+    "death",
+    "study",
+    "teleport",
+    "shoot",
+    "quaff",
+    "zap",
+    "walk",
+    "tpother",
+    "hitwall",
+    "eat",
+    "store1",
+    "store2",
+    "store3",
+    "store4",
+    "dig",
+    "opendoor",
+    "shutdoor",
+    "tplevel",
+    "scroll",
+    "buy",
+    "sell",
+    "warn",
+    "rocket",
+    "n_kill",
+    "u_kill",
+    "quest",
+    "heal",
+    "x_heal",
+    "bite",
+    "claw",
+    "m_spell",
+    "summon",
+    "breath",
+    "ball",
+    "m_heal",
+    "atkspell",
+    "evil",
+    "touch",
+    "sting",
+    "crush",
+    "slime",
+    "wail",
+    "winner",
+    "fire",
+    "acid",
+    "elec",
+    "cold",
+    "illegal",
+    "fail",
+    "wakeup",
+    "invuln",
+    "fall",
+    "pain",
+    "destitem",
+    "moan",
+    "show",
+    "unused",
+    "explode",
+    "glass",
+    "reflect",
+    "hungry",
+    "weak",
+    "faint",
+    "good_hit",
+    "great_hit",
+    "superb_hit",
+    "star_great_hit",
+    "star_superb_hit",
+    "gouge_hit",
+    "maim_hit",
+    "carve_hit",
+    "cleave_hit",
+    "smite_hit",
+    "eviscerate_hit",
+    "shred_hit ",
 };
index 1cf4f60..16b6038 100644 (file)
@@ -73,7 +73,22 @@ enum sound_type {
     SOUND_EXPLODE = 64, /*!< Something (or somebody) explodes */
     SOUND_GLASS = 65, /*!< A glass feature was crashed */
     SOUND_REFLECT = 66, /*!< A bolt was reflected */
-    SOUND_MAX = 67, /*!< 効果音定義の最大数 / Maximum numbers of sound effect */
+    SOUND_HUNGRY = 67, /*!< getting hungry */
+    SOUND_WEAK = 68, /*!< getting weak from hunger */
+    SOUND_FAINT = 69, /*!< getting faint from hunger */
+    SOUND_GOOD_HIT = 70, /*!< critical hit - good */
+    SOUND_GREAT_HIT = 71, /*!< critical hit - great */
+    SOUND_SUPERB_HIT = 72, /*!< critical hit - superb */
+    SOUND_STAR_GREAT_HIT = 73, /*!< critical hit - *great* */
+    SOUND_STAR_SUPERB_HIT = 74, /*!< critical hit - *superb* */
+    SOUND_GOUGE_HIT = 75, /*!< vorpal hit - gouge */
+    SOUND_MAIM_HIT = 76, /*!< vorpal hit - maim */
+    SOUND_CARVE_HIT = 77, /*!< vorpal hit - carve */
+    SOUND_CLEAVE_HIT = 78, /*!< vorpal hit - cleave */
+    SOUND_SMITE_HIT = 79, /*!< vorpal hit - smite */
+    SOUND_EVISCERATE_HIT = 80, /*!< vorpal hit - eviscerate */
+    SOUND_SHRED_HIT = 81, /*!< vorpal hit - shred */
+    SOUND_MAX = 82, /*!< 効果音定義の最大数 / Maximum numbers of sound effect */
 };
 
 extern const concptr angband_sound_name[SOUND_MAX];
index 76a496e..f5d65aa 100644 (file)
@@ -2,6 +2,8 @@
 #include "artifact/fixed-art-types.h"
 #include "inventory/inventory-slot-types.h"
 #include "io/files-util.h"
+#include "main/sound-definitions-table.h"
+#include "main/sound-of-music.h"
 #include "monster-race/monster-race.h"
 #include "monster-race/race-flags-resistance.h"
 #include "player-attack/player-attack-util.h"
@@ -21,24 +23,31 @@ static void print_vorpal_message(player_attack_type *pa_ptr, const int magnifica
     switch (magnification) {
     case 2:
         msg_format(_("%sを斬った!", "You gouge %s!"), pa_ptr->m_name);
+        sound(SOUND_GOUGE_HIT);
         break;
     case 3:
         msg_format(_("%sをぶった斬った!", "You maim %s!"), pa_ptr->m_name);
+        sound(SOUND_MAIM_HIT);
         break;
     case 4:
         msg_format(_("%sをメッタ斬りにした!", "You carve %s!"), pa_ptr->m_name);
+        sound(SOUND_CARVE_HIT);
         break;
     case 5:
         msg_format(_("%sをメッタメタに斬った!", "You cleave %s!"), pa_ptr->m_name);
+        sound(SOUND_CLEAVE_HIT);
         break;
     case 6:
         msg_format(_("%sを刺身にした!", "You smite %s!"), pa_ptr->m_name);
+        sound(SOUND_SMITE_HIT);
         break;
     case 7:
         msg_format(_("%sを斬って斬って斬りまくった!", "You eviscerate %s!"), pa_ptr->m_name);
+        sound(SOUND_EVISCERATE_HIT);
         break;
     default:
         msg_format(_("%sを細切れにした!", "You shred %s!"), pa_ptr->m_name);
+        sound(SOUND_SHRED_HIT);
         break;
     }
 }
index 622eeb2..8777e83 100644 (file)
@@ -6,6 +6,8 @@
 #include "core/stuff-handler.h"
 #include "floor/wild.h"
 #include "game-option/disturbance-options.h"
+#include "main/sound-definitions-table.h"
+#include "main/sound-of-music.h"
 #include "object-enchant/trc-types.h"
 #include "player-info/avatar.h"
 #include "player/player-damage.h"
@@ -159,12 +161,15 @@ bool set_food(player_type *creature_ptr, TIME_EFFECT v)
     } else if (new_aux < old_aux) {
         switch (new_aux) {
         case 0:
+            sound(SOUND_FAINT);
             msg_print(_("あまりにも空腹で気を失ってしまった!", "You are getting faint from hunger!"));
             break;
         case 1:
+            sound(SOUND_WEAK);
             msg_print(_("お腹が空いて倒れそうだ。", "You are getting weak from hunger!"));
             break;
         case 2:
+            sound(SOUND_HUNGRY);
             msg_print(_("お腹が空いてきた。", "You are getting hungry."));
             break;
         case 3: