• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision29a50abd513066fce6ea4cea55043f904187156f (tree)
Time2003-11-26 20:55:53
Authornothere <nothere@0568...>
Commiternothere

Log Message

cave_floor_*()の使用に関する変更の途中経過.
* ライト・エリア範囲の処理で壁とみなされる条件はLOSかPROJECTのどちら

かが欠けている場合とした.

* 以下で使われるcave_floor_*()はFF_PROJECTの参照に置き換えた.

- 全方向打撃で, 見えないモンスターにも攻撃できる地形判定.
- カオス魔法 "虚無召来" での壁判定.
- 分解のブレスを持つモンスターの視界内にいる時に分解のブレスを吐き
易くする判定.
- fetch()でアイテムを取り寄せる際に, 方向で指定した時の壁判定.

* 幽鬼戦隊召喚の場所判定はcave_empty_bold()に置き換えた.

関連して, 以下の変更を含む.
* note_spot()で不要と思える比較を削除すると移動光源で照らされた壁まで

暗い扱いになっていてCAVE_MARKが立たない場合があり, 変更取り消し.

* マクロboundary_floor_bold()は使われなくなったので削除.
* ダンジョンの端の永久岩は必ずWALLとPERMANENTを持っているため, それを

評価するマクロpermanent_wall()を作った. 主にダンジョンの端のmimicの
処理に用いる.

* マクロboundary_floor_grid()内部の評価順序変更.

Change Summary

Incremental Difference

--- a/src/artifact.c
+++ b/src/artifact.c
@@ -2253,7 +2253,7 @@ bool activate_random_artifact(object_type * o_ptr)
22532253 m_ptr = &m_list[c_ptr->m_idx];
22542254
22552255 /* Hack -- attack monsters */
2256- if (c_ptr->m_idx && (m_ptr->ml || cave_floor_bold(y, x)))
2256+ if (c_ptr->m_idx && (m_ptr->ml || have_flag(f_flags_bold(y, x), FF_PROJECT)))
22572257 py_attack(y, x, 0);
22582258 }
22592259 }
--- a/src/cave.c
+++ b/src/cave.c
@@ -1431,6 +1431,20 @@ void note_spot(int y, int x)
14311431 c_ptr->info |= (CAVE_MARK);
14321432 }
14331433
1434+ /* Memorize torch-lit walls */
1435+ else if (c_ptr->info & (CAVE_LITE | CAVE_MNLT))
1436+ {
1437+ /* Memorize */
1438+ c_ptr->info |= (CAVE_MARK);
1439+ }
1440+
1441+ /* Memorize walls seen by noctovision of Ninja */
1442+ else if (p_ptr->see_nocto)
1443+ {
1444+ /* Memorize */
1445+ c_ptr->info |= (CAVE_MARK);
1446+ }
1447+
14341448 /* Memorize certain non-torch-lit wall grids */
14351449 else if (check_local_illumination(y, x))
14361450 {
--- a/src/cmd5.c
+++ b/src/cmd5.c
@@ -1477,7 +1477,7 @@ msg_print("
14771477 m_ptr = &m_list[c_ptr->m_idx];
14781478
14791479 /* Hack -- attack monsters */
1480- if (c_ptr->m_idx && (m_ptr->ml || cave_floor_bold(y, x)))
1480+ if (c_ptr->m_idx && (m_ptr->ml || have_flag(f_flags_bold(y, x), FF_PROJECT)))
14811481 py_attack(y, x, 0);
14821482 }
14831483 }
--- a/src/defines.h
+++ b/src/defines.h
@@ -4448,18 +4448,20 @@
44484448 #define player_has_los_bold(Y,X) \
44494449 (((cave[Y][X].info & (CAVE_VIEW)) != 0) || p_ptr->inside_battle)
44504450
4451+
44514452 /*
4452- * Determine if a "boundary" grid is "floor mimic"
4453+ * Determine if a "feature" is "permanent wall"
44534454 */
4454-#define boundary_floor_bold(Y,X) \
4455- (have_flag(f_flags_bold((Y), (X)), FF_WALL) && \
4456- have_flag(f_flags_bold((Y), (X)), FF_PERMANENT) && \
4457- cave[(Y)][(X)].mimic && feat_supports_los(cave[(Y)][(X)].mimic))
4455+#define permanent_wall(F) \
4456+ (have_flag((F)->flags, FF_WALL) && \
4457+ have_flag((F)->flags, FF_PERMANENT))
44584458
4459+/*
4460+ * Determine if a "boundary" grid is "floor mimic"
4461+ */
44594462 #define boundary_floor_grid(C) \
4460- (have_flag(f_flags_grid(C), FF_WALL) && \
4461- have_flag(f_flags_grid(C), FF_PERMANENT) && \
4462- (C)->mimic && feat_supports_los((C)->mimic))
4463+ ((C)->mimic && feat_supports_los((C)->mimic) && \
4464+ permanent_wall(&f_info[(C)->feat]))
44634465
44644466 /*
44654467 * Get feature mimic from f_info[] (applying "mimic" field)
--- a/src/grid.c
+++ b/src/grid.c
@@ -596,7 +596,7 @@ void build_tunnel(int row1, int col1, int row2, int col2)
596596 c_ptr = &cave[tmp_row][tmp_col];
597597 f_ptr = &f_info[c_ptr->feat];
598598
599- if (have_flag(f_ptr->flags, FF_WALL) && have_flag(f_ptr->flags, FF_PERMANENT))
599+ if (permanent_wall(f_ptr))
600600 {
601601 /* Avoid the edge of vaults */
602602 if (is_inner_grid(c_ptr)) continue;
--- a/src/grid.h
+++ b/src/grid.h
@@ -84,8 +84,7 @@
8484 feature_type *_f_ptr; \
8585 set_cave_feat(Y,X,fill_type[randint0(100)]); \
8686 _f_ptr = &f_info[cave[Y][X].feat]; \
87- if (have_flag(_f_ptr->flags, FF_WALL) && have_flag(_f_ptr->flags, FF_PERMANENT)) \
88- cave[Y][X].feat = feat_state(cave[Y][X].feat, FF_UNPERM); \
87+ if (permanent_wall(_f_ptr)) cave[Y][X].feat = feat_state(cave[Y][X].feat, FF_UNPERM); \
8988 cave[Y][X].info &= ~(CAVE_MASK); \
9089 add_cave_info(Y,X,CAVE_EXTRA); \
9190 }
@@ -149,8 +148,7 @@
149148 #define place_outer_noperm_bold(Y, X) \
150149 { \
151150 feature_type *_f_ptr = &f_info[feat_wall_outer]; \
152- if (have_flag(_f_ptr->flags, FF_WALL) && have_flag(_f_ptr->flags, FF_PERMANENT)) \
153- set_cave_feat(Y, X, feat_state(feat_wall_outer, FF_UNPERM)); \
151+ if (permanent_wall(_f_ptr)) set_cave_feat(Y, X, feat_state(feat_wall_outer, FF_UNPERM)); \
154152 else set_cave_feat(Y,X,feat_wall_outer); \
155153 cave[Y][X].info &= ~(CAVE_MASK); \
156154 add_cave_info(Y,X,(CAVE_OUTER | CAVE_VAULT)); \
@@ -159,8 +157,7 @@
159157 #define place_outer_noperm_grid(C) \
160158 { \
161159 feature_type *_f_ptr = &f_info[feat_wall_outer]; \
162- if (have_flag(_f_ptr->flags, FF_WALL) && have_flag(_f_ptr->flags, FF_PERMANENT)) \
163- (C)->feat = feat_state(feat_wall_outer, FF_UNPERM); \
160+ if (permanent_wall(_f_ptr)) (C)->feat = feat_state(feat_wall_outer, FF_UNPERM); \
164161 else (C)->feat = feat_wall_outer; \
165162 (C)->info &= ~(CAVE_MASK); \
166163 (C)->info |= (CAVE_OUTER | CAVE_VAULT); \
@@ -197,7 +194,7 @@
197194 #define place_solid_noperm_bold(Y, X) \
198195 { \
199196 feature_type *_f_ptr = &f_info[feat_wall_solid]; \
200- if ((cave[Y][X].info & CAVE_VAULT) && have_flag(_f_ptr->flags, FF_WALL) && have_flag(_f_ptr->flags, FF_PERMANENT)) \
197+ if ((cave[Y][X].info & CAVE_VAULT) && permanent_wall(_f_ptr)) \
201198 set_cave_feat(Y, X, feat_state(feat_wall_solid, FF_UNPERM)); \
202199 else set_cave_feat(Y,X,feat_wall_solid); \
203200 cave[Y][X].info &= ~(CAVE_MASK); \
@@ -207,7 +204,7 @@
207204 #define place_solid_noperm_grid(C) \
208205 { \
209206 feature_type *_f_ptr = &f_info[feat_wall_solid]; \
210- if (((C)->info & CAVE_VAULT) && have_flag(_f_ptr->flags, FF_WALL) && have_flag(_f_ptr->flags, FF_PERMANENT)) \
207+ if (((C)->info & CAVE_VAULT) && permanent_wall(_f_ptr)) \
211208 (C)->feat = feat_state(feat_wall_solid, FF_UNPERM); \
212209 else (C)->feat = feat_wall_solid; \
213210 (C)->info &= ~(CAVE_MASK); \
--- a/src/hissatsu.c
+++ b/src/hissatsu.c
@@ -791,7 +791,7 @@ static bool cast_hissatsu_spell(int spell)
791791 m_ptr = &m_list[c_ptr->m_idx];
792792
793793 /* Hack -- attack monsters */
794- if (c_ptr->m_idx && (m_ptr->ml || cave_floor_bold(y, x)))
794+ if (c_ptr->m_idx && (m_ptr->ml || have_flag(f_flags_bold(y, x), FF_PROJECT)))
795795 {
796796 if (!monster_living(&r_info[m_ptr->r_idx]))
797797 {
--- a/src/mind.c
+++ b/src/mind.c
@@ -1557,7 +1557,7 @@ static bool cast_berserk_spell(int spell)
15571557 m_ptr = &m_list[c_ptr->m_idx];
15581558
15591559 /* Hack -- attack monsters */
1560- if (c_ptr->m_idx && (m_ptr->ml || cave_floor_bold(y, x)))
1560+ if (c_ptr->m_idx && (m_ptr->ml || have_flag(f_flags_bold(y, x), FF_PROJECT)))
15611561 py_attack(y, x, 0);
15621562 }
15631563 break;
--- a/src/mspells1.c
+++ b/src/mspells1.c
@@ -1317,7 +1317,7 @@ bool make_attack_spell(int m_idx)
13171317 if (projectable(m_ptr->fy, m_ptr->fx, y, x))
13181318 {
13191319 /* Breath disintegration to the glyph if possible */
1320- if ((!cave_floor_bold(y,x)) && (r_ptr->flags4 & RF4_BR_DISI) && one_in_(2)) do_disi = TRUE;
1320+ if (!have_flag(f_flags_bold(y, x), FF_PROJECT) && (f4 & RF4_BR_DISI) && one_in_(2)) do_disi = TRUE;
13211321 }
13221322
13231323 /* Check path to next grid */
@@ -1325,7 +1325,7 @@ bool make_attack_spell(int m_idx)
13251325 {
13261326 bool success = FALSE;
13271327
1328- if ((r_ptr->flags4 & RF4_BR_DISI) &&
1328+ if ((f4 & RF4_BR_DISI) &&
13291329 (m_ptr->cdis < MAX_RANGE/2) &&
13301330 in_disintegration_range(m_ptr->fy, m_ptr->fx, y, x) &&
13311331 (one_in_(10) || (projectable(y, x, m_ptr->fy, m_ptr->fx) && one_in_(2))))
@@ -4294,17 +4294,17 @@ else msg_format("%^s
42944294
42954295 for (k = 0; k < 30; k++)
42964296 {
4297- if (!summon_possible(cy, cx) || !cave_floor_bold(cy, cx))
4297+ if (!summon_possible(cy, cx) || !cave_empty_bold(cy, cx))
42984298 {
42994299 int j;
43004300 for (j = 100; j > 0; j--)
43014301 {
43024302 scatter(&cy, &cx, y, x, 2, 0);
4303- if (cave_floor_bold(cy, cx)) break;
4303+ if (cave_empty_bold(cy, cx)) break;
43044304 }
43054305 if (!j) break;
43064306 }
4307- if (!cave_floor_bold(cy, cx)) continue;
4307+ if (!cave_empty_bold(cy, cx)) continue;
43084308
43094309 if (summon_named_creature(m_idx, cy, cx, MON_NAZGUL, mode))
43104310 {
--- a/src/rooms.c
+++ b/src/rooms.c
@@ -5059,7 +5059,7 @@ static void add_outer_wall(int x, int y, int light, int x1, int y1, int x2, int
50595059 place_outer_bold(y, x);
50605060 if (light) c_ptr->info |= CAVE_GLOW;
50615061 }
5062- else if (have_flag(f_ptr->flags, FF_WALL) && have_flag(f_ptr->flags, FF_PERMANENT))
5062+ else if (permanent_wall(f_ptr))
50635063 {
50645064 /* Set bounding walls */
50655065 if (light) c_ptr->info |= CAVE_GLOW;
--- a/src/spells2.c
+++ b/src/spells2.c
@@ -6152,6 +6152,10 @@ static void cave_temp_room_unlite(void)
61526152 }
61536153
61546154
6155+#define cave_pass_lite_bold(Y,X) \
6156+ (cave_los_bold((Y), (X)) && \
6157+ have_flag(f_flags_bold((Y), (X)), FF_PROJECT))
6158+
61556159
61566160 /*
61576161 * Determine how much contiguous open space this grid is next to
@@ -6171,7 +6175,7 @@ static int next_to_open(int cy, int cx)
61716175 x = cx + ddx_cdd[i % 8];
61726176
61736177 /* Found a wall, break the length */
6174- if (!cave_floor_bold(y, x))
6178+ if (!cave_pass_lite_bold(y, x))
61756179 {
61766180 /* Track best length */
61776181 if (len > blen)
@@ -6204,7 +6208,7 @@ static int next_to_walls_adj(int cy, int cx)
62046208 y = cy + ddy_ddd[i];
62056209 x = cx + ddx_ddd[i];
62066210
6207- if (!cave_floor_bold(y, x)) c++;
6211+ if (!cave_pass_lite_bold(y, x)) c++;
62086212 }
62096213
62106214 return c;
@@ -6244,7 +6248,7 @@ static void cave_temp_room_aux(int y, int x, bool only_room)
62446248 * properly.
62456249 * This leaves only a check for 6 bounding walls!
62466250 */
6247- if (in_bounds(y, x) && cave_floor_bold(y, x) &&
6251+ if (in_bounds(y, x) && cave_pass_lite_bold(y, x) &&
62486252 (next_to_walls_adj(y, x) == 6) && (next_to_open(y, x) <= 1)) return;
62496253 }
62506254
@@ -6295,7 +6299,7 @@ void lite_room(int y1, int x1)
62956299 x = temp_x[i], y = temp_y[i];
62966300
62976301 /* Walls get lit, but stop light */
6298- if (!cave_floor_bold(y, x)) continue;
6302+ if (!cave_pass_lite_bold(y, x)) continue;
62996303
63006304 /* Spread adjacent */
63016305 cave_temp_lite_room_aux(y + 1, x);
@@ -6331,7 +6335,7 @@ void unlite_room(int y1, int x1)
63316335 x = temp_x[i], y = temp_y[i];
63326336
63336337 /* Walls get dark, but stop darkness */
6334- if (!cave_floor_bold(y, x)) continue;
6338+ if (!cave_pass_lite_bold(y, x)) continue;
63356339
63366340 /* Spread adjacent */
63376341 cave_temp_unlite_room_aux(y + 1, x);
--- a/src/spells3.c
+++ b/src/spells3.c
@@ -1679,18 +1679,21 @@ static bool vanish_dungeon(void)
16791679 void call_the_(void)
16801680 {
16811681 int i;
1682- int y, x;
1682+ cave_type *c_ptr;
16831683 bool do_call = TRUE;
16841684
16851685 for (i = 0; i < 9; i++)
16861686 {
1687- y = py + ddy_ddd[i];
1688- x = px + ddx_ddd[i];
1687+ c_ptr = &cave[py + ddy_ddd[i]][px + ddx_ddd[i]];
16891688
1690- if (!cave_floor_bold(y, x) && !boundary_floor_bold(y, x))
1689+ if (!have_flag(f_flags_grid(c_ptr), FF_PROJECT))
16911690 {
1692- do_call = FALSE;
1693- break;
1691+ if (!c_ptr->mimic || !have_flag(f_info[c_ptr->mimic].flags, FF_PROJECT) ||
1692+ !permanent_wall(&f_info[c_ptr->feat]))
1693+ {
1694+ do_call = FALSE;
1695+ break;
1696+ }
16941697 }
16951698 }
16961699
@@ -1859,7 +1862,7 @@ msg_print("
18591862 c_ptr = &cave[ty][tx];
18601863
18611864 if ((distance(py, px, ty, tx) > MAX_RANGE) ||
1862- !cave_floor_bold(ty, tx)) return;
1865+ !have_flag(f_flags_bold(ty, tx), FF_PROJECT)) return;
18631866 }
18641867 while (!c_ptr->o_idx);
18651868 }
Show on old repository browser