変愚蛮怒のメインリポジトリです
Revision | 29a50abd513066fce6ea4cea55043f904187156f (tree) |
---|---|
Time | 2003-11-26 20:55:53 |
Author | nothere <nothere@0568...> |
Commiter | nothere |
cave_floor_*()の使用に関する変更の途中経過.
* ライト・エリア範囲の処理で壁とみなされる条件はLOSかPROJECTのどちら
* 以下で使われるcave_floor_*()はFF_PROJECTの参照に置き換えた.
* 幽鬼戦隊召喚の場所判定はcave_empty_bold()に置き換えた.
関連して, 以下の変更を含む.
* note_spot()で不要と思える比較を削除すると移動光源で照らされた壁まで
* マクロboundary_floor_bold()は使われなくなったので削除.
* ダンジョンの端の永久岩は必ずWALLとPERMANENTを持っているため, それを
* マクロboundary_floor_grid()内部の評価順序変更.
@@ -2253,7 +2253,7 @@ bool activate_random_artifact(object_type * o_ptr) | ||
2253 | 2253 | m_ptr = &m_list[c_ptr->m_idx]; |
2254 | 2254 | |
2255 | 2255 | /* 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))) | |
2257 | 2257 | py_attack(y, x, 0); |
2258 | 2258 | } |
2259 | 2259 | } |
@@ -1431,6 +1431,20 @@ void note_spot(int y, int x) | ||
1431 | 1431 | c_ptr->info |= (CAVE_MARK); |
1432 | 1432 | } |
1433 | 1433 | |
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 | + | |
1434 | 1448 | /* Memorize certain non-torch-lit wall grids */ |
1435 | 1449 | else if (check_local_illumination(y, x)) |
1436 | 1450 | { |
@@ -1477,7 +1477,7 @@ msg_print(" | ||
1477 | 1477 | m_ptr = &m_list[c_ptr->m_idx]; |
1478 | 1478 | |
1479 | 1479 | /* 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))) | |
1481 | 1481 | py_attack(y, x, 0); |
1482 | 1482 | } |
1483 | 1483 | } |
@@ -4448,18 +4448,20 @@ | ||
4448 | 4448 | #define player_has_los_bold(Y,X) \ |
4449 | 4449 | (((cave[Y][X].info & (CAVE_VIEW)) != 0) || p_ptr->inside_battle) |
4450 | 4450 | |
4451 | + | |
4451 | 4452 | /* |
4452 | - * Determine if a "boundary" grid is "floor mimic" | |
4453 | + * Determine if a "feature" is "permanent wall" | |
4453 | 4454 | */ |
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)) | |
4458 | 4458 | |
4459 | +/* | |
4460 | + * Determine if a "boundary" grid is "floor mimic" | |
4461 | + */ | |
4459 | 4462 | #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])) | |
4463 | 4465 | |
4464 | 4466 | /* |
4465 | 4467 | * Get feature mimic from f_info[] (applying "mimic" field) |
@@ -596,7 +596,7 @@ void build_tunnel(int row1, int col1, int row2, int col2) | ||
596 | 596 | c_ptr = &cave[tmp_row][tmp_col]; |
597 | 597 | f_ptr = &f_info[c_ptr->feat]; |
598 | 598 | |
599 | - if (have_flag(f_ptr->flags, FF_WALL) && have_flag(f_ptr->flags, FF_PERMANENT)) | |
599 | + if (permanent_wall(f_ptr)) | |
600 | 600 | { |
601 | 601 | /* Avoid the edge of vaults */ |
602 | 602 | if (is_inner_grid(c_ptr)) continue; |
@@ -84,8 +84,7 @@ | ||
84 | 84 | feature_type *_f_ptr; \ |
85 | 85 | set_cave_feat(Y,X,fill_type[randint0(100)]); \ |
86 | 86 | _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); \ | |
89 | 88 | cave[Y][X].info &= ~(CAVE_MASK); \ |
90 | 89 | add_cave_info(Y,X,CAVE_EXTRA); \ |
91 | 90 | } |
@@ -149,8 +148,7 @@ | ||
149 | 148 | #define place_outer_noperm_bold(Y, X) \ |
150 | 149 | { \ |
151 | 150 | 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)); \ | |
154 | 152 | else set_cave_feat(Y,X,feat_wall_outer); \ |
155 | 153 | cave[Y][X].info &= ~(CAVE_MASK); \ |
156 | 154 | add_cave_info(Y,X,(CAVE_OUTER | CAVE_VAULT)); \ |
@@ -159,8 +157,7 @@ | ||
159 | 157 | #define place_outer_noperm_grid(C) \ |
160 | 158 | { \ |
161 | 159 | 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); \ | |
164 | 161 | else (C)->feat = feat_wall_outer; \ |
165 | 162 | (C)->info &= ~(CAVE_MASK); \ |
166 | 163 | (C)->info |= (CAVE_OUTER | CAVE_VAULT); \ |
@@ -197,7 +194,7 @@ | ||
197 | 194 | #define place_solid_noperm_bold(Y, X) \ |
198 | 195 | { \ |
199 | 196 | 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)) \ | |
201 | 198 | set_cave_feat(Y, X, feat_state(feat_wall_solid, FF_UNPERM)); \ |
202 | 199 | else set_cave_feat(Y,X,feat_wall_solid); \ |
203 | 200 | cave[Y][X].info &= ~(CAVE_MASK); \ |
@@ -207,7 +204,7 @@ | ||
207 | 204 | #define place_solid_noperm_grid(C) \ |
208 | 205 | { \ |
209 | 206 | 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)) \ | |
211 | 208 | (C)->feat = feat_state(feat_wall_solid, FF_UNPERM); \ |
212 | 209 | else (C)->feat = feat_wall_solid; \ |
213 | 210 | (C)->info &= ~(CAVE_MASK); \ |
@@ -791,7 +791,7 @@ static bool cast_hissatsu_spell(int spell) | ||
791 | 791 | m_ptr = &m_list[c_ptr->m_idx]; |
792 | 792 | |
793 | 793 | /* 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))) | |
795 | 795 | { |
796 | 796 | if (!monster_living(&r_info[m_ptr->r_idx])) |
797 | 797 | { |
@@ -1557,7 +1557,7 @@ static bool cast_berserk_spell(int spell) | ||
1557 | 1557 | m_ptr = &m_list[c_ptr->m_idx]; |
1558 | 1558 | |
1559 | 1559 | /* 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))) | |
1561 | 1561 | py_attack(y, x, 0); |
1562 | 1562 | } |
1563 | 1563 | break; |
@@ -1317,7 +1317,7 @@ bool make_attack_spell(int m_idx) | ||
1317 | 1317 | if (projectable(m_ptr->fy, m_ptr->fx, y, x)) |
1318 | 1318 | { |
1319 | 1319 | /* 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; | |
1321 | 1321 | } |
1322 | 1322 | |
1323 | 1323 | /* Check path to next grid */ |
@@ -1325,7 +1325,7 @@ bool make_attack_spell(int m_idx) | ||
1325 | 1325 | { |
1326 | 1326 | bool success = FALSE; |
1327 | 1327 | |
1328 | - if ((r_ptr->flags4 & RF4_BR_DISI) && | |
1328 | + if ((f4 & RF4_BR_DISI) && | |
1329 | 1329 | (m_ptr->cdis < MAX_RANGE/2) && |
1330 | 1330 | in_disintegration_range(m_ptr->fy, m_ptr->fx, y, x) && |
1331 | 1331 | (one_in_(10) || (projectable(y, x, m_ptr->fy, m_ptr->fx) && one_in_(2)))) |
@@ -4294,17 +4294,17 @@ else msg_format("%^s | ||
4294 | 4294 | |
4295 | 4295 | for (k = 0; k < 30; k++) |
4296 | 4296 | { |
4297 | - if (!summon_possible(cy, cx) || !cave_floor_bold(cy, cx)) | |
4297 | + if (!summon_possible(cy, cx) || !cave_empty_bold(cy, cx)) | |
4298 | 4298 | { |
4299 | 4299 | int j; |
4300 | 4300 | for (j = 100; j > 0; j--) |
4301 | 4301 | { |
4302 | 4302 | scatter(&cy, &cx, y, x, 2, 0); |
4303 | - if (cave_floor_bold(cy, cx)) break; | |
4303 | + if (cave_empty_bold(cy, cx)) break; | |
4304 | 4304 | } |
4305 | 4305 | if (!j) break; |
4306 | 4306 | } |
4307 | - if (!cave_floor_bold(cy, cx)) continue; | |
4307 | + if (!cave_empty_bold(cy, cx)) continue; | |
4308 | 4308 | |
4309 | 4309 | if (summon_named_creature(m_idx, cy, cx, MON_NAZGUL, mode)) |
4310 | 4310 | { |
@@ -5059,7 +5059,7 @@ static void add_outer_wall(int x, int y, int light, int x1, int y1, int x2, int | ||
5059 | 5059 | place_outer_bold(y, x); |
5060 | 5060 | if (light) c_ptr->info |= CAVE_GLOW; |
5061 | 5061 | } |
5062 | - else if (have_flag(f_ptr->flags, FF_WALL) && have_flag(f_ptr->flags, FF_PERMANENT)) | |
5062 | + else if (permanent_wall(f_ptr)) | |
5063 | 5063 | { |
5064 | 5064 | /* Set bounding walls */ |
5065 | 5065 | if (light) c_ptr->info |= CAVE_GLOW; |
@@ -6152,6 +6152,10 @@ static void cave_temp_room_unlite(void) | ||
6152 | 6152 | } |
6153 | 6153 | |
6154 | 6154 | |
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 | + | |
6155 | 6159 | |
6156 | 6160 | /* |
6157 | 6161 | * Determine how much contiguous open space this grid is next to |
@@ -6171,7 +6175,7 @@ static int next_to_open(int cy, int cx) | ||
6171 | 6175 | x = cx + ddx_cdd[i % 8]; |
6172 | 6176 | |
6173 | 6177 | /* Found a wall, break the length */ |
6174 | - if (!cave_floor_bold(y, x)) | |
6178 | + if (!cave_pass_lite_bold(y, x)) | |
6175 | 6179 | { |
6176 | 6180 | /* Track best length */ |
6177 | 6181 | if (len > blen) |
@@ -6204,7 +6208,7 @@ static int next_to_walls_adj(int cy, int cx) | ||
6204 | 6208 | y = cy + ddy_ddd[i]; |
6205 | 6209 | x = cx + ddx_ddd[i]; |
6206 | 6210 | |
6207 | - if (!cave_floor_bold(y, x)) c++; | |
6211 | + if (!cave_pass_lite_bold(y, x)) c++; | |
6208 | 6212 | } |
6209 | 6213 | |
6210 | 6214 | return c; |
@@ -6244,7 +6248,7 @@ static void cave_temp_room_aux(int y, int x, bool only_room) | ||
6244 | 6248 | * properly. |
6245 | 6249 | * This leaves only a check for 6 bounding walls! |
6246 | 6250 | */ |
6247 | - if (in_bounds(y, x) && cave_floor_bold(y, x) && | |
6251 | + if (in_bounds(y, x) && cave_pass_lite_bold(y, x) && | |
6248 | 6252 | (next_to_walls_adj(y, x) == 6) && (next_to_open(y, x) <= 1)) return; |
6249 | 6253 | } |
6250 | 6254 |
@@ -6295,7 +6299,7 @@ void lite_room(int y1, int x1) | ||
6295 | 6299 | x = temp_x[i], y = temp_y[i]; |
6296 | 6300 | |
6297 | 6301 | /* Walls get lit, but stop light */ |
6298 | - if (!cave_floor_bold(y, x)) continue; | |
6302 | + if (!cave_pass_lite_bold(y, x)) continue; | |
6299 | 6303 | |
6300 | 6304 | /* Spread adjacent */ |
6301 | 6305 | cave_temp_lite_room_aux(y + 1, x); |
@@ -6331,7 +6335,7 @@ void unlite_room(int y1, int x1) | ||
6331 | 6335 | x = temp_x[i], y = temp_y[i]; |
6332 | 6336 | |
6333 | 6337 | /* Walls get dark, but stop darkness */ |
6334 | - if (!cave_floor_bold(y, x)) continue; | |
6338 | + if (!cave_pass_lite_bold(y, x)) continue; | |
6335 | 6339 | |
6336 | 6340 | /* Spread adjacent */ |
6337 | 6341 | cave_temp_unlite_room_aux(y + 1, x); |
@@ -1679,18 +1679,21 @@ static bool vanish_dungeon(void) | ||
1679 | 1679 | void call_the_(void) |
1680 | 1680 | { |
1681 | 1681 | int i; |
1682 | - int y, x; | |
1682 | + cave_type *c_ptr; | |
1683 | 1683 | bool do_call = TRUE; |
1684 | 1684 | |
1685 | 1685 | for (i = 0; i < 9; i++) |
1686 | 1686 | { |
1687 | - y = py + ddy_ddd[i]; | |
1688 | - x = px + ddx_ddd[i]; | |
1687 | + c_ptr = &cave[py + ddy_ddd[i]][px + ddx_ddd[i]]; | |
1689 | 1688 | |
1690 | - if (!cave_floor_bold(y, x) && !boundary_floor_bold(y, x)) | |
1689 | + if (!have_flag(f_flags_grid(c_ptr), FF_PROJECT)) | |
1691 | 1690 | { |
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 | + } | |
1694 | 1697 | } |
1695 | 1698 | } |
1696 | 1699 |
@@ -1859,7 +1862,7 @@ msg_print(" | ||
1859 | 1862 | c_ptr = &cave[ty][tx]; |
1860 | 1863 | |
1861 | 1864 | 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; | |
1863 | 1866 | } |
1864 | 1867 | while (!c_ptr->o_idx); |
1865 | 1868 | } |