• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision601a30554a21693abc9595012dfde78b57fa3fe1 (tree)
Time2019-02-21 13:50:09
AuthorDeskull <deskull@user...>
CommiterDeskull

Log Message

[Refactor] #37353 spells-floor.c/h 追加。 / Add spells-floor.c/h.

Change Summary

Incremental Difference

--- a/Hengband_vcs2017/Hengband/Hengband.vcxproj
+++ b/Hengband_vcs2017/Hengband/Hengband.vcxproj
@@ -240,6 +240,7 @@
240240 <ClCompile Include="..\..\src\snipe.c" />
241241 <ClCompile Include="..\..\src\sort.c" />
242242 <ClCompile Include="..\..\src\spells-diceroll.c" />
243+ <ClCompile Include="..\..\src\spells-floor.c" />
243244 <ClCompile Include="..\..\src\spells-object.c" />
244245 <ClCompile Include="..\..\src\spells-status.c" />
245246 <ClCompile Include="..\..\src\spells-summon.c" />
@@ -330,6 +331,7 @@
330331 <ClInclude Include="..\..\src\shoot.h" />
331332 <ClInclude Include="..\..\src\sort.h" />
332333 <ClInclude Include="..\..\src\spells-diceroll.h" />
334+ <ClInclude Include="..\..\src\spells-floor.h" />
333335 <ClInclude Include="..\..\src\spells-object.h" />
334336 <ClInclude Include="..\..\src\spells-status.h" />
335337 <ClInclude Include="..\..\src\spells-summon.h" />
--- a/src/cave.c
+++ b/src/cave.c
@@ -4311,172 +4311,6 @@ void map_area(POSITION range)
43114311 }
43124312
43134313
4314-
4315-/*
4316- * Light up the dungeon using "clairvoyance"
4317- *
4318- * This function "illuminates" every grid in the dungeon, memorizes all
4319- * "objects", memorizes all grids as with magic mapping, and, under the
4320- * standard option settings (view_perma_grids but not view_torch_grids)
4321- * memorizes all floor grids too.
4322- *
4323- * Note that if "view_perma_grids" is not set, we do not memorize floor
4324- * grids, since this would defeat the purpose of "view_perma_grids", not
4325- * that anyone seems to play without this option.
4326- *
4327- * Note that if "view_torch_grids" is set, we do not memorize floor grids,
4328- * since this would prevent the use of "view_torch_grids" as a method to
4329- * keep track of what grids have been observed directly.
4330- */
4331-void wiz_lite(bool ninja)
4332-{
4333- OBJECT_IDX i;
4334- POSITION y, x;
4335- FEAT_IDX feat;
4336- feature_type *f_ptr;
4337-
4338- /* Memorize objects */
4339- for (i = 1; i < o_max; i++)
4340- {
4341- object_type *o_ptr = &o_list[i];
4342-
4343- /* Skip dead objects */
4344- if (!o_ptr->k_idx) continue;
4345-
4346- /* Skip held objects */
4347- if (o_ptr->held_m_idx) continue;
4348-
4349- /* Memorize */
4350- o_ptr->marked |= OM_FOUND;
4351- }
4352-
4353- /* Scan all normal grids */
4354- for (y = 1; y < cur_hgt - 1; y++)
4355- {
4356- /* Scan all normal grids */
4357- for (x = 1; x < cur_wid - 1; x++)
4358- {
4359- grid_type *g_ptr = &grid_array[y][x];
4360-
4361- /* Memorize terrain of the grid */
4362- g_ptr->info |= (CAVE_KNOWN);
4363-
4364- /* Feature code (applying "mimic" field) */
4365- feat = get_feat_mimic(g_ptr);
4366- f_ptr = &f_info[feat];
4367-
4368- /* Process all non-walls */
4369- if (!have_flag(f_ptr->flags, FF_WALL))
4370- {
4371- /* Scan all neighbors */
4372- for (i = 0; i < 9; i++)
4373- {
4374- POSITION yy = y + ddy_ddd[i];
4375- POSITION xx = x + ddx_ddd[i];
4376- g_ptr = &grid_array[yy][xx];
4377-
4378- /* Feature code (applying "mimic" field) */
4379- f_ptr = &f_info[get_feat_mimic(g_ptr)];
4380-
4381- /* Perma-lite the grid */
4382- if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) && !ninja)
4383- {
4384- g_ptr->info |= (CAVE_GLOW);
4385- }
4386-
4387- /* Memorize normal features */
4388- if (have_flag(f_ptr->flags, FF_REMEMBER))
4389- {
4390- /* Memorize the grid */
4391- g_ptr->info |= (CAVE_MARK);
4392- }
4393-
4394- /* Perma-lit grids (newly and previously) */
4395- else if (g_ptr->info & CAVE_GLOW)
4396- {
4397- /* Normally, memorize floors (see above) */
4398- if (view_perma_grids && !view_torch_grids)
4399- {
4400- /* Memorize the grid */
4401- g_ptr->info |= (CAVE_MARK);
4402- }
4403- }
4404- }
4405- }
4406- }
4407- }
4408-
4409- p_ptr->update |= (PU_MONSTERS);
4410- p_ptr->redraw |= (PR_MAP);
4411- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4412-
4413- if (p_ptr->special_defense & NINJA_S_STEALTH)
4414- {
4415- if (grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
4416- }
4417-}
4418-
4419-
4420-/*
4421- * Forget the dungeon map (ala "Thinking of Maud...").
4422- */
4423-void wiz_dark(void)
4424-{
4425- OBJECT_IDX i;
4426- POSITION y, x;
4427-
4428- /* Forget every grid */
4429- for (y = 1; y < cur_hgt - 1; y++)
4430- {
4431- for (x = 1; x < cur_wid - 1; x++)
4432- {
4433- grid_type *g_ptr = &grid_array[y][x];
4434-
4435- /* Process the grid */
4436- g_ptr->info &= ~(CAVE_MARK | CAVE_IN_DETECT | CAVE_KNOWN);
4437- g_ptr->info |= (CAVE_UNSAFE);
4438- }
4439- }
4440-
4441- /* Forget every grid on horizontal edge */
4442- for (x = 0; x < cur_wid; x++)
4443- {
4444- grid_array[0][x].info &= ~(CAVE_MARK);
4445- grid_array[cur_hgt - 1][x].info &= ~(CAVE_MARK);
4446- }
4447-
4448- /* Forget every grid on vertical edge */
4449- for (y = 1; y < (cur_hgt - 1); y++)
4450- {
4451- grid_array[y][0].info &= ~(CAVE_MARK);
4452- grid_array[y][cur_wid - 1].info &= ~(CAVE_MARK);
4453- }
4454-
4455- /* Forget all objects */
4456- for (i = 1; i < o_max; i++)
4457- {
4458- object_type *o_ptr = &o_list[i];
4459-
4460- /* Skip dead objects */
4461- if (!o_ptr->k_idx) continue;
4462-
4463- /* Skip held objects */
4464- if (o_ptr->held_m_idx) continue;
4465-
4466- /* Forget the object */
4467- o_ptr->marked &= OM_TOUCHED;
4468- }
4469-
4470- /* Forget travel route when we have forgotten map */
4471- forget_travel_flow();
4472-
4473- p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
4474- p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
4475- p_ptr->update |= (PU_MONSTERS);
4476- p_ptr->redraw |= (PR_MAP);
4477- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4478-}
4479-
44804314 /*
44814315 * Change the "feat" flag for a grid, and notice/redraw the grid
44824316 */
--- a/src/cmd-activate.c
+++ b/src/cmd-activate.c
@@ -16,6 +16,7 @@
1616 #include "avatar.h"
1717 #include "spells-status.h"
1818 #include "spells-object.h"
19+#include "spells-floor.h"
1920 #include "realm-hex.h"
2021 #include "player-status.h"
2122
--- a/src/cmd-quaff.c
+++ b/src/cmd-quaff.c
@@ -13,6 +13,7 @@
1313 #include "avatar.h"
1414 #include "spells-status.h"
1515 #include "realm-hex.h"
16+#include "spells-floor.h"
1617
1718 /*!
1819 * @brief 薬を飲むコマンドのサブルーチン /
--- a/src/dungeon.c
+++ b/src/dungeon.c
@@ -28,6 +28,7 @@
2828 #include "spells-summon.h"
2929 #include "spells-object.h"
3030 #include "spells-status.h"
31+#include "spells-floor.h"
3132 #include "monsterrace-hook.h"
3233 #include "world.h"
3334 #include "mutation.h"
--- a/src/effects.c
+++ b/src/effects.c
@@ -21,6 +21,7 @@
2121 #include "realm-hex.h"
2222 #include "object-hook.h"
2323 #include "wild.h"
24+#include "spells-floor.h"
2425
2526 /*!
2627 * @brief プレイヤーの継続行動を設定する。
--- a/src/externs.h
+++ b/src/externs.h
@@ -497,8 +497,6 @@ extern void forget_flow(void);
497497 extern void update_flow(void);
498498 extern void update_smell(void);
499499 extern void map_area(POSITION range);
500-extern void wiz_lite(bool ninja);
501-extern void wiz_dark(void);
502500 extern void cave_set_feat(POSITION y, POSITION x, FEAT_IDX feat);
503501 extern FEAT_IDX conv_dungeon_feat(FEAT_IDX newfeat);
504502 extern FEAT_IDX feat_state(FEAT_IDX feat, int action);
--- a/src/floor-events.c
+++ b/src/floor-events.c
@@ -111,3 +111,4 @@ MONSTER_NUMBER count_all_hostile_monsters(void)
111111
112112 return number_mon;
113113 }
114+
--- a/src/floor-events.h
+++ b/src/floor-events.h
@@ -1,3 +1,4 @@
1-void day_break(void);
1+
2+void day_break(void);
23 void night_falls(void);
34 MONSTER_NUMBER count_all_hostile_monsters(void);
--- a/src/floor-save.c
+++ b/src/floor-save.c
@@ -17,6 +17,7 @@
1717 #include "monster.h"
1818 #include "quest.h"
1919 #include "wild.h"
20+#include "spells-floor.h"
2021
2122
2223 static FLOOR_IDX new_floor_id; /*!<次のフロアのID / floor_id of the destination */
--- a/src/mind.c
+++ b/src/mind.c
@@ -22,6 +22,7 @@
2222 #include "player-status.h"
2323 #include "spells-status.h"
2424 #include "cmd-spell.h"
25+#include "spells-floor.h"
2526
2627 /*! 特殊技能の一覧テーブル */
2728 mind_power const mind_powers[5] =
--- a/src/player-move.c
+++ b/src/player-move.c
@@ -146,6 +146,7 @@
146146 #include "quest.h"
147147 #include "artifact.h"
148148 #include "player-status.h"
149+#include "spells-floor.h"
149150
150151
151152
--- a/src/realm-arcane.c
+++ b/src/realm-arcane.c
@@ -4,6 +4,7 @@
44 #include "spells-status.h"
55 #include "projection.h"
66 #include "avatar.h"
7+#include "spells-floor.h"
78
89 /*!
910 * @brief 秘術領域魔法の各処理を行う
--- a/src/realm-life.c
+++ b/src/realm-life.c
@@ -2,6 +2,7 @@
22 #include "cmd-spell.h"
33 #include "projection.h"
44 #include "spells-status.h"
5+#include "spells-floor.h"
56
67 /*!
78 * @brief 生命領域魔法の各処理を行う
--- a/src/realm-nature.c
+++ b/src/realm-nature.c
@@ -5,6 +5,7 @@
55 #include "spells-status.h"
66 #include "spells-object.h"
77 #include "avatar.h"
8+#include "spells-floor.h"
89
910
1011 /*!
--- a/src/realm-song.c
+++ b/src/realm-song.c
@@ -2,6 +2,7 @@
22 #include "cmd-spell.h"
33 #include "spells-status.h"
44 #include "projection.h"
5+#include "spells-floor.h"
56
67 /*!
78 * @brief 歌の開始を処理する / Start singing if the player is a Bard
--- a/src/realm-sorcery.c
+++ b/src/realm-sorcery.c
@@ -4,6 +4,7 @@
44 #include "projection.h"
55 #include "avatar.h"
66 #include "spells-status.h"
7+#include "spells-floor.h"
78
89 /*!
910 * @brief 仙術領域魔法の各処理を行う
--- /dev/null
+++ b/src/spells-floor.c
@@ -0,0 +1,167 @@
1+#include "angband.h"
2+#include "spells-floor.h"
3+
4+/*
5+ * Light up the dungeon using "clairvoyance"
6+ *
7+ * This function "illuminates" every grid in the dungeon, memorizes all
8+ * "objects", memorizes all grids as with magic mapping, and, under the
9+ * standard option settings (view_perma_grids but not view_torch_grids)
10+ * memorizes all floor grids too.
11+ *
12+ * Note that if "view_perma_grids" is not set, we do not memorize floor
13+ * grids, since this would defeat the purpose of "view_perma_grids", not
14+ * that anyone seems to play without this option.
15+ *
16+ * Note that if "view_torch_grids" is set, we do not memorize floor grids,
17+ * since this would prevent the use of "view_torch_grids" as a method to
18+ * keep track of what grids have been observed directly.
19+ */
20+void wiz_lite(bool ninja)
21+{
22+ OBJECT_IDX i;
23+ POSITION y, x;
24+ FEAT_IDX feat;
25+ feature_type *f_ptr;
26+
27+ /* Memorize objects */
28+ for (i = 1; i < o_max; i++)
29+ {
30+ object_type *o_ptr = &o_list[i];
31+
32+ /* Skip dead objects */
33+ if (!o_ptr->k_idx) continue;
34+
35+ /* Skip held objects */
36+ if (o_ptr->held_m_idx) continue;
37+
38+ /* Memorize */
39+ o_ptr->marked |= OM_FOUND;
40+ }
41+
42+ /* Scan all normal grids */
43+ for (y = 1; y < cur_hgt - 1; y++)
44+ {
45+ /* Scan all normal grids */
46+ for (x = 1; x < cur_wid - 1; x++)
47+ {
48+ grid_type *g_ptr = &grid_array[y][x];
49+
50+ /* Memorize terrain of the grid */
51+ g_ptr->info |= (CAVE_KNOWN);
52+
53+ /* Feature code (applying "mimic" field) */
54+ feat = get_feat_mimic(g_ptr);
55+ f_ptr = &f_info[feat];
56+
57+ /* Process all non-walls */
58+ if (!have_flag(f_ptr->flags, FF_WALL))
59+ {
60+ /* Scan all neighbors */
61+ for (i = 0; i < 9; i++)
62+ {
63+ POSITION yy = y + ddy_ddd[i];
64+ POSITION xx = x + ddx_ddd[i];
65+ g_ptr = &grid_array[yy][xx];
66+
67+ /* Feature code (applying "mimic" field) */
68+ f_ptr = &f_info[get_feat_mimic(g_ptr)];
69+
70+ /* Perma-lite the grid */
71+ if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) && !ninja)
72+ {
73+ g_ptr->info |= (CAVE_GLOW);
74+ }
75+
76+ /* Memorize normal features */
77+ if (have_flag(f_ptr->flags, FF_REMEMBER))
78+ {
79+ /* Memorize the grid */
80+ g_ptr->info |= (CAVE_MARK);
81+ }
82+
83+ /* Perma-lit grids (newly and previously) */
84+ else if (g_ptr->info & CAVE_GLOW)
85+ {
86+ /* Normally, memorize floors (see above) */
87+ if (view_perma_grids && !view_torch_grids)
88+ {
89+ /* Memorize the grid */
90+ g_ptr->info |= (CAVE_MARK);
91+ }
92+ }
93+ }
94+ }
95+ }
96+ }
97+
98+ p_ptr->update |= (PU_MONSTERS);
99+ p_ptr->redraw |= (PR_MAP);
100+ p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
101+
102+ if (p_ptr->special_defense & NINJA_S_STEALTH)
103+ {
104+ if (grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
105+ }
106+}
107+
108+
109+/*
110+ * Forget the dungeon map (ala "Thinking of Maud...").
111+ */
112+void wiz_dark(void)
113+{
114+ OBJECT_IDX i;
115+ POSITION y, x;
116+
117+ /* Forget every grid */
118+ for (y = 1; y < cur_hgt - 1; y++)
119+ {
120+ for (x = 1; x < cur_wid - 1; x++)
121+ {
122+ grid_type *g_ptr = &grid_array[y][x];
123+
124+ /* Process the grid */
125+ g_ptr->info &= ~(CAVE_MARK | CAVE_IN_DETECT | CAVE_KNOWN);
126+ g_ptr->info |= (CAVE_UNSAFE);
127+ }
128+ }
129+
130+ /* Forget every grid on horizontal edge */
131+ for (x = 0; x < cur_wid; x++)
132+ {
133+ grid_array[0][x].info &= ~(CAVE_MARK);
134+ grid_array[cur_hgt - 1][x].info &= ~(CAVE_MARK);
135+ }
136+
137+ /* Forget every grid on vertical edge */
138+ for (y = 1; y < (cur_hgt - 1); y++)
139+ {
140+ grid_array[y][0].info &= ~(CAVE_MARK);
141+ grid_array[y][cur_wid - 1].info &= ~(CAVE_MARK);
142+ }
143+
144+ /* Forget all objects */
145+ for (i = 1; i < o_max; i++)
146+ {
147+ object_type *o_ptr = &o_list[i];
148+
149+ /* Skip dead objects */
150+ if (!o_ptr->k_idx) continue;
151+
152+ /* Skip held objects */
153+ if (o_ptr->held_m_idx) continue;
154+
155+ /* Forget the object */
156+ o_ptr->marked &= OM_TOUCHED;
157+ }
158+
159+ /* Forget travel route when we have forgotten map */
160+ forget_travel_flow();
161+
162+ p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
163+ p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
164+ p_ptr->update |= (PU_MONSTERS);
165+ p_ptr->redraw |= (PR_MAP);
166+ p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
167+}
--- /dev/null
+++ b/src/spells-floor.h
@@ -0,0 +1,4 @@
1+#pragma once
2+
3+extern void wiz_lite(bool ninja);
4+extern void wiz_dark(void);
--- a/src/spells2.c
+++ b/src/spells2.c
@@ -25,6 +25,7 @@
2525 #include "avatar.h"
2626
2727 #include "spells-status.h"
28+#include "spells-floor.h"
2829 #include "realm-hex.h"
2930 #include "object-hook.h"
3031
--- a/src/spells3.c
+++ b/src/spells3.c
@@ -21,6 +21,7 @@
2121 #include "quest.h"
2222 #include "artifact.h"
2323 #include "avatar.h"
24+#include "spells-floor.h"
2425
2526
2627 /*! テレポート先探索の試行数 / Maximum number of tries for teleporting */
--- a/src/wizard2.c
+++ b/src/wizard2.c
@@ -24,6 +24,8 @@
2424 #include "spells-summon.h"
2525 #include "spells-status.h"
2626 #include "spells-world.h"
27+#include "spells-floor.h"
28+
2729 #include "object-hook.h"
2830
2931 #ifdef ALLOW_WIZARD
Show on old repository browser