From 2c37c585b3c8149e46c3a50e67bbfb98d608c48a Mon Sep 17 00:00:00 2001 From: Hourier Date: Sun, 7 Jun 2020 20:28:02 +0900 Subject: [PATCH] [Refactor] #40457 Separated snipe-types.h --- Hengband/Hengband/Hengband.vcxproj | 1 + Hengband/Hengband/Hengband.vcxproj.filters | 3 + src/Makefile.am | 1 + src/cmd-item/cmd-item.c | 2 +- src/cmd/cmd-basic.c | 2 +- src/combat/shoot.c | 1 + src/io/input-key-processor.c | 94 ++++++++++++++++-------------- src/io/input-key-processor.h | 2 + src/mind/mind-sniper.c | 1 + src/mind/mind-sniper.h | 18 ------ src/mind/snipe-types.h | 20 +++++++ src/object/object-broken.c | 6 +- 12 files changed, 83 insertions(+), 68 deletions(-) create mode 100644 src/mind/snipe-types.h diff --git a/Hengband/Hengband/Hengband.vcxproj b/Hengband/Hengband/Hengband.vcxproj index ef6b249dc..9de7486e5 100644 --- a/Hengband/Hengband/Hengband.vcxproj +++ b/Hengband/Hengband/Hengband.vcxproj @@ -528,6 +528,7 @@ + diff --git a/Hengband/Hengband/Hengband.vcxproj.filters b/Hengband/Hengband/Hengband.vcxproj.filters index 52f767a14..2c940a765 100644 --- a/Hengband/Hengband/Hengband.vcxproj.filters +++ b/Hengband/Hengband/Hengband.vcxproj.filters @@ -2689,6 +2689,9 @@ mind + + mind + diff --git a/src/Makefile.am b/src/Makefile.am index f98204f6b..9a121ab60 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -269,6 +269,7 @@ hengband_SOURCES = \ mind/mind-warrior.c mind/mind-warrior.h \ mind/mind-warrior-mage.c mind/mind-warrior-mage.h \ mind/monk-attack.c mind/monk-attack.h \ + mind/snipe-types.h \ mind/racial.c mind/racial.h \ mind/racial-android.c mind/racial-android.h \ mind/racial-balrog.c mind/racial-balrog.h \ diff --git a/src/cmd-item/cmd-item.c b/src/cmd-item/cmd-item.c index 9f4303e5a..a85ddef30 100644 --- a/src/cmd-item/cmd-item.c +++ b/src/cmd-item/cmd-item.c @@ -22,7 +22,6 @@ #include "cmd-item/cmd-zaprod.h" #include "cmd-item/cmd-zapwand.h" #include "cmd/cmd-basic.h" -#include "mind/mind-sniper.h" #include "core/sort.h" #include "core/stuff-handler.h" #include "dungeon/quest.h" @@ -31,6 +30,7 @@ #include "inventory/player-inventory.h" #include "io/targeting.h" #include "main/sound-definitions-table.h" +#include "mind/snipe-types.h" #include "monster/monster.h" #include "object-enchant/item-feeling.h" #include "object-enchant/object-ego.h" diff --git a/src/cmd/cmd-basic.c b/src/cmd/cmd-basic.c index f1402e4e1..fc55c35dd 100644 --- a/src/cmd/cmd-basic.c +++ b/src/cmd/cmd-basic.c @@ -18,7 +18,6 @@ #include "combat/attack-power-table.h" #include "combat/shoot.h" #include "combat/slaying.h" -#include "mind/mind-sniper.h" #include "core/output-updater.h" #include "core/stuff-handler.h" #include "dungeon/dungeon.h" @@ -37,6 +36,7 @@ #include "io/write-diary.h" #include "main/music-definitions-table.h" #include "main/sound-definitions-table.h" +#include "mind/snipe-types.h" #include "monster/monster-status.h" #include "object-enchant/special-object-flags.h" #include "object-enchant/tr-types.h" diff --git a/src/combat/shoot.c b/src/combat/shoot.c index aa07196c4..0e15f4bce 100644 --- a/src/combat/shoot.c +++ b/src/combat/shoot.c @@ -9,6 +9,7 @@ #include "inventory/inventory-object.h" #include "io/targeting.h" #include "main/sound-definitions-table.h" +#include "mind/snipe-types.h" #include "monster-race/race-indice-types.h" #include "monster/monster-status.h" #include "monster/monster.h" diff --git a/src/io/input-key-processor.c b/src/io/input-key-processor.c index c27e54695..049e2f402 100644 --- a/src/io/input-key-processor.c +++ b/src/io/input-key-processor.c @@ -5,60 +5,59 @@ * @author Hourier */ -#include "system/angband.h" #include "io/input-key-processor.h" -#include "world/world.h" -#include "core/special-internal-keys.h" -#include "dungeon/dungeon.h" -#include "mind/mind-sniper.h" #include "autopick/autopick-pref-processor.h" -#include "store/store-util.h" -#include "main/sound-definitions-table.h" -#include "io/write-diary.h" -#include "inventory/player-inventory.h" -#include "player/player-effects.h" -#include "store/store.h" // do_cmd_store() がある。後で移設する. -#include "dungeon/quest.h" // do_cmd_quest() がある。後で移設する. -#include "floor/wild.h" -#include "spell/spells-object.h" -#include "mind/mind.h" // do_cmd_mind_browse() がある。後で移設する. -#include "mspell/monster-spell.h" // do_cmd_cast_learned() がある。後で移設する. -#include "mind/racial.h" // do_cmd_racial_power() がある。ファイル名変更?. -#include "view/display-main-window.h" -#include "knowledge/knowledge-autopick.h" -#include "knowledge/knowledge-quests.h" -#include "io/chuukei.h" -#include "player/player-move.h" // do_cmd_travel() がある。後で移設する. -#include "io/files-util.h" - -#include "cmd-item/cmd-activate.h" -#include "cmd-io/cmd-autopick.h" +#include "cmd-action/cmd-hissatsu.h" +#include "cmd-action/cmd-mane.h" +#include "cmd-action/cmd-pet.h" +#include "cmd-action/cmd-spell.h" #include "cmd-building/cmd-building.h" +#include "cmd-io/cmd-autopick.h" #include "cmd-io/cmd-diary.h" -#include "cmd/cmd-draw.h" #include "cmd-io/cmd-dump.h" +#include "cmd-io/cmd-help.h" +#include "cmd-io/cmd-knowledge.h" +#include "cmd-io/cmd-macro.h" #include "cmd-io/cmd-process-screen.h" +#include "cmd-io/cmd-save.h" +#include "cmd-item/cmd-activate.h" #include "cmd-item/cmd-eat.h" -#include "cmd-io/cmd-help.h" -#include "cmd-action/cmd-hissatsu.h" #include "cmd-item/cmd-item.h" -#include "cmd-io/cmd-knowledge.h" #include "cmd-item/cmd-magiceat.h" -#include "cmd-action/cmd-mane.h" -#include "cmd-io/cmd-macro.h" #include "cmd-item/cmd-quaff.h" #include "cmd-item/cmd-read.h" -#include "cmd-io/cmd-save.h" #include "cmd-item/cmd-smith.h" -#include "cmd-action/cmd-spell.h" #include "cmd-item/cmd-usestaff.h" #include "cmd-item/cmd-zaprod.h" #include "cmd-item/cmd-zapwand.h" -#include "cmd-action/cmd-pet.h" #include "cmd/cmd-basic.h" +#include "cmd/cmd-draw.h" #include "cmd/cmd-visuals.h" -#include "wizard/wizard-spoiler.h" +#include "core/special-internal-keys.h" +#include "dungeon/dungeon.h" +#include "dungeon/quest.h" // do_cmd_quest() がある。後で移設する. +#include "floor/wild.h" +#include "inventory/player-inventory.h" +#include "io/chuukei.h" +#include "io/files-util.h" +#include "io/write-diary.h" +#include "knowledge/knowledge-autopick.h" +#include "knowledge/knowledge-quests.h" +#include "main/sound-definitions-table.h" +#include "mind/mind-sniper.h" +#include "mind/mind.h" // do_cmd_mind_browse() がある。後で移設する. +#include "mind/racial.h" // do_cmd_racial_power() がある。ファイル名変更?. +#include "mind/snipe-types.h" +#include "mspell/monster-spell.h" // do_cmd_cast_learned() がある。後で移設する. +#include "player/player-effects.h" +#include "player/player-move.h" // do_cmd_travel() がある。後で移設する. +#include "spell/spells-object.h" +#include "store/store-util.h" +#include "store/store.h" // do_cmd_store() がある。後で移設する. +#include "view/display-main-window.h" #include "wizard/wizard-special-process.h" +#include "wizard/wizard-spoiler.h" +#include "world/world.h" // todo command-processor.h と util.h が相互依存している。後で別な場所に移す. COMMAND_CODE now_message; @@ -69,7 +68,7 @@ COMMAND_CODE now_message; * @param player_ptr プレーヤーへの参照ポインタ * @return 実際にウィザードモードへ移行したらTRUEを返す。 */ -bool enter_wizard_mode(player_type* player_ptr) +bool enter_wizard_mode(player_type *player_ptr) { if (!current_world_ptr->noscore) { if (!allow_debug_opts || arg_wizard) { @@ -84,7 +83,8 @@ bool enter_wizard_mode(player_type* player_ptr) return FALSE; } - exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "gave up recording score to enter wizard mode.")); + exe_write_diary( + player_ptr, DIARY_DESCRIPTION, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "gave up recording score to enter wizard mode.")); current_world_ptr->noscore |= 0x0002; } @@ -97,7 +97,7 @@ bool enter_wizard_mode(player_type* player_ptr) * @param player_ptr プレーヤーへの参照ポインタ * @return 実際にデバッグコマンドへ移行したらTRUEを返す。 */ -static bool enter_debug_mode(player_type* player_ptr) +static bool enter_debug_mode(player_type *player_ptr) { if (!current_world_ptr->noscore) { if (!allow_debug_opts) { @@ -112,7 +112,8 @@ static bool enter_debug_mode(player_type* player_ptr) return FALSE; } - exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, _("デバッグモードに突入してスコアを残せなくなった。", "gave up sending score to use debug commands.")); + exe_write_diary( + player_ptr, DIARY_DESCRIPTION, 0, _("デバッグモードに突入してスコアを残せなくなった。", "gave up sending score to use debug commands.")); current_world_ptr->noscore |= 0x0008; } @@ -125,7 +126,7 @@ static bool enter_debug_mode(player_type* player_ptr) * @todo Make some "blocks" * @return なし */ -void process_command(player_type* creature_ptr) +void process_command(player_type *creature_ptr) { COMMAND_CODE old_now_message = now_message; repeat_check(); @@ -133,7 +134,7 @@ void process_command(player_type* creature_ptr) if ((creature_ptr->pclass == CLASS_SNIPER) && (creature_ptr->concent)) creature_ptr->reset_concent = TRUE; - floor_type* floor_ptr = creature_ptr->current_floor_ptr; + floor_type *floor_ptr = creature_ptr->current_floor_ptr; switch (command_cmd) { case ESCAPE: case ' ': @@ -325,7 +326,8 @@ void process_command(player_type* creature_ptr) break; } case 'b': { - if ((creature_ptr->pclass == CLASS_MINDCRAFTER) || (creature_ptr->pclass == CLASS_BERSERKER) || (creature_ptr->pclass == CLASS_NINJA) || (creature_ptr->pclass == CLASS_MIRROR_MASTER)) + if ((creature_ptr->pclass == CLASS_MINDCRAFTER) || (creature_ptr->pclass == CLASS_BERSERKER) || (creature_ptr->pclass == CLASS_NINJA) + || (creature_ptr->pclass == CLASS_MIRROR_MASTER)) do_cmd_mind_browse(creature_ptr); else if (creature_ptr->pclass == CLASS_SMITH) do_cmd_kaji(creature_ptr, TRUE); @@ -342,7 +344,8 @@ void process_command(player_type* creature_ptr) if (!creature_ptr->wild_mode) { if ((creature_ptr->pclass == CLASS_WARRIOR) || (creature_ptr->pclass == CLASS_ARCHER) || (creature_ptr->pclass == CLASS_CAVALRY)) { msg_print(_("呪文を唱えられない!", "You cannot cast spells!")); - } else if (floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && (creature_ptr->pclass != CLASS_BERSERKER) && (creature_ptr->pclass != CLASS_SMITH)) { + } else if (floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && (creature_ptr->pclass != CLASS_BERSERKER) + && (creature_ptr->pclass != CLASS_SMITH)) { msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!")); msg_print(NULL); } else if (creature_ptr->anti_magic && (creature_ptr->pclass != CLASS_BERSERKER) && (creature_ptr->pclass != CLASS_SMITH)) { @@ -366,7 +369,8 @@ void process_command(player_type* creature_ptr) msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!")); free_turn(creature_ptr); } else { - if ((creature_ptr->pclass == CLASS_MINDCRAFTER) || (creature_ptr->pclass == CLASS_BERSERKER) || (creature_ptr->pclass == CLASS_NINJA) || (creature_ptr->pclass == CLASS_MIRROR_MASTER)) + if ((creature_ptr->pclass == CLASS_MINDCRAFTER) || (creature_ptr->pclass == CLASS_BERSERKER) || (creature_ptr->pclass == CLASS_NINJA) + || (creature_ptr->pclass == CLASS_MIRROR_MASTER)) do_cmd_mind(creature_ptr); else if (creature_ptr->pclass == CLASS_IMITATOR) do_cmd_mane(creature_ptr, FALSE); diff --git a/src/io/input-key-processor.h b/src/io/input-key-processor.h index bcb783de7..37f789618 100644 --- a/src/io/input-key-processor.h +++ b/src/io/input-key-processor.h @@ -1,5 +1,7 @@ #pragma once +#include "system/angband.h" + extern COMMAND_CODE now_message; bool enter_wizard_mode(player_type* player_ptr); diff --git a/src/mind/mind-sniper.c b/src/mind/mind-sniper.c index eb56e8f22..edb633287 100644 --- a/src/mind/mind-sniper.c +++ b/src/mind/mind-sniper.c @@ -11,6 +11,7 @@ #include "core/stuff-handler.h" #include "floor/floor.h" #include "main/sound-definitions-table.h" +#include "mind/snipe-types.h" #include "monster-race/monster-race.h" #include "player/player-status.h" #include "term/term-color-types.h" diff --git a/src/mind/mind-sniper.h b/src/mind/mind-sniper.h index d194f42ee..0f36acbff 100644 --- a/src/mind/mind-sniper.h +++ b/src/mind/mind-sniper.h @@ -2,24 +2,6 @@ #include "system/angband.h" -/* Sniper */ -#define SP_NONE 0 -#define SP_LITE 1 -#define SP_AWAY 2 -#define SP_FIRE 3 -#define SP_KILL_WALL 4 -#define SP_COLD 5 -#define SP_KILL_TRAP 6 -#define SP_ELEC 7 -#define SP_PIERCE 8 -#define SP_RUSH 9 -#define SP_DOUBLE 10 -#define SP_EXPLODE 11 -#define SP_EVILNESS 12 -#define SP_HOLYNESS 13 -#define SP_FINAL 14 -#define SP_NEEDLE 15 - void reset_concentration(player_type *creature_ptr, bool msg); void display_snipe_list(player_type *sniper_ptr); MULTIPLY calc_snipe_damage_with_slay(player_type *sniper_ptr, MULTIPLY mult, monster_type *m_ptr, SPELL_IDX snipe_type); diff --git a/src/mind/snipe-types.h b/src/mind/snipe-types.h new file mode 100644 index 000000000..4037e81d3 --- /dev/null +++ b/src/mind/snipe-types.h @@ -0,0 +1,20 @@ +#pragma once + +typedef enum snipe_type { + SP_NONE = 0, + SP_LITE = 1, + SP_AWAY = 2, + SP_FIRE = 3, + SP_KILL_WALL = 4, + SP_COLD = 5, + SP_KILL_TRAP = 6, + SP_ELEC = 7, + SP_PIERCE = 8, + SP_RUSH = 9, + SP_DOUBLE = 10, + SP_EXPLODE = 11, + SP_EVILNESS = 12, + SP_HOLYNESS = 13, + SP_FINAL = 14, + SP_NEEDLE = 15, +} snipe_type; \ No newline at end of file diff --git a/src/object/object-broken.c b/src/object/object-broken.c index 108f07011..5644004de 100644 --- a/src/object/object-broken.c +++ b/src/object/object-broken.c @@ -4,14 +4,14 @@ * @author deskull */ #include "object/object-broken.h" -#include "mind/mind-sniper.h" #include "effect/effect-characteristics.h" +#include "mind/snipe-types.h" +#include "object-enchant/tr-types.h" #include "object/object-flags.h" #include "object/object-kind.h" -#include "sv-definition/sv-potion-types.h" -#include "object-enchant/tr-types.h" #include "spell/process-effect.h" #include "spell/spells-type.h" +#include "sv-definition/sv-potion-types.h" /*! * @brief アイテムが酸で破損するかどうかを判定する -- 2.11.0