From 6f011919b5fe9b8a8ca1d65618e0196b33c5a842 Mon Sep 17 00:00:00 2001 From: Hourier Date: Wed, 22 Apr 2020 17:11:44 +0900 Subject: [PATCH] [Refactor] #40274 Unified angband_sound_name[] into main/sound-definitions-table.c/h --- Hengband_vcs2017/Hengband/Hengband.vcxproj | 2 + Hengband_vcs2017/Hengband/Hengband.vcxproj.filters | 9 +++ src/Makefile.am | 1 + src/main-gcu.c | 75 +--------------------- src/main-win.c | 75 +--------------------- src/main-x11.c | 75 +--------------------- src/main/sound-definitions-table.c | 73 +++++++++++++++++++++ src/main/sound-definitions-table.h | 5 ++ src/util.h | 5 -- 9 files changed, 93 insertions(+), 227 deletions(-) create mode 100644 src/main/sound-definitions-table.c create mode 100644 src/main/sound-definitions-table.h diff --git a/Hengband_vcs2017/Hengband/Hengband.vcxproj b/Hengband_vcs2017/Hengband/Hengband.vcxproj index c93aff8be..c56586cc0 100644 --- a/Hengband_vcs2017/Hengband/Hengband.vcxproj +++ b/Hengband_vcs2017/Hengband/Hengband.vcxproj @@ -152,6 +152,7 @@ + @@ -274,6 +275,7 @@ + diff --git a/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters b/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters index 26c4913d6..20d7dc62f 100644 --- a/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters +++ b/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters @@ -586,6 +586,9 @@ market + + main + @@ -1154,6 +1157,9 @@ market + + main + @@ -1199,6 +1205,9 @@ {95a48e4b-b55a-4e99-a3c6-e8badbd1b2cf} + + {e8e836da-e12b-42cc-9c09-17432cb83432} + diff --git a/src/Makefile.am b/src/Makefile.am index 3fddadfdf..5e3288f64 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,6 +11,7 @@ hengband_SOURCES = \ \ avatar.h avatar.c birth.c birth.h \ \ + main/sound-definitions-table.c main/sound-definitions-table.h \ market/arena-info-table.c market/arena-info-table.h \ market/building.c market/building.h \ market/building-util.c market/building-util.h \ diff --git a/src/main-gcu.c b/src/main-gcu.c index 6af86a4d8..18368aa43 100644 --- a/src/main-gcu.c +++ b/src/main-gcu.c @@ -157,6 +157,7 @@ */ #include "angband.h" +#include "main/sound-definitions-table.h" #include "io/exit-panic.h" #include "files.h" #include "gameterm.h" @@ -261,80 +262,6 @@ static term_data data[MAX_TERM_DATA]; /* #define nonl() */ /* #define nl() */ - /* - * Standard sound names - */ -static 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", -}; - static concptr ANGBAND_DIR_XTRA_SOUND; /* diff --git a/src/main-win.c b/src/main-win.c index 5aaeee829..93cb74963 100644 --- a/src/main-win.c +++ b/src/main-win.c @@ -91,6 +91,7 @@ #include "angband.h" #include "signal-handlers.h" +#include "main/sound-definitions-table.h" #include "util.h" #include "inet.h" #include "chuukei.h" @@ -253,80 +254,6 @@ #define MOUSE_SENS 40 /* - * Standard sound names - */ -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", -}; - -/* * Standard music names */ const concptr angband_music_basic_name[MUSIC_BASIC_MAX] = diff --git a/src/main-x11.c b/src/main-x11.c index 4b2f38600..771ee42a8 100644 --- a/src/main-x11.c +++ b/src/main-x11.c @@ -94,6 +94,7 @@ #include "angband.h" +#include "main/sound-definitions-table.h" #include "core.h" #include "files.h" #include "gameterm.h" @@ -2264,80 +2265,6 @@ static errr CheckEvent(bool wait) } - /* - * Standard sound names - */ -static 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", -}; - /* * An array of sound file names */ diff --git a/src/main/sound-definitions-table.c b/src/main/sound-definitions-table.c new file mode 100644 index 000000000..99ac852c5 --- /dev/null +++ b/src/main/sound-definitions-table.c @@ -0,0 +1,73 @@ +#include "angband.h" +#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", +}; diff --git a/src/main/sound-definitions-table.h b/src/main/sound-definitions-table.h new file mode 100644 index 000000000..2e979ffe4 --- /dev/null +++ b/src/main/sound-definitions-table.h @@ -0,0 +1,5 @@ +#pragma once + +#define SOUND_MAX 67 /*!< 効果音定義の最大数 / Maximum numbers of sound effect */ + +extern const concptr angband_sound_name[SOUND_MAX]; diff --git a/src/util.h b/src/util.h index 0bd0a50df..b27d7cb68 100644 --- a/src/util.h +++ b/src/util.h @@ -265,11 +265,6 @@ extern concptr keymap_act[KEYMAP_MODES][256]; #define SOUND_GLASS 65 /*!< A glass feature was crashed */ #define SOUND_REFLECT 66 /*!< A bolt was reflected */ - /* - * Mega-Hack -- maximum known sounds - */ -#define SOUND_MAX 67 /*!< 効果音定義の最大数 */ - /*! * @brief 銘情報の最大数 / Maximum number of "quarks" (see "io.c") * @note -- 2.11.0