From 10426ab07e5e389bcb1fb42413e78728d82cfc49 Mon Sep 17 00:00:00 2001 From: nothere Date: Sun, 14 Dec 2003 16:28:46 +0000 Subject: [PATCH] =?utf8?q?=E3=83=A2=E3=83=B3=E3=82=B9=E3=82=BF=E3=83=BC?= =?utf8?q?=E5=85=89=E6=BA=90=E3=81=AB=E9=96=A2=E3=81=99=E3=82=8B=E5=A4=89?= =?utf8?q?=E6=9B=B4.=20*=20=E3=81=93=E3=81=AE=E3=82=88=E3=81=86=E3=81=AA?= =?utf8?q?=E4=BD=8D=E7=BD=AE=E9=96=A2=E4=BF=82=E3=82=92=E8=80=83=E3=81=88?= =?utf8?q?=E3=82=8B.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ##### #...@ #.### #*# この場合, '*'は直接'@'からは見えないため, 床は照らされてもmon_invis の効果で'@'の視線上の壁は照らされなかった. こういった位置の壁にモン スター光源が当たるように変更. モンスターとプレイヤーに挟まれた壁は モンスターが視界に入らないと明るくならない場合があるが, これは光源 漏れを防ぐための仕様として残す. このコードでは'%'のように照らすこと ができる. %%%## %...@ %.### #*# * 暗黒光源の範囲判定はLOSではなくPROJECTで行うようにした. * 時が止まったかどうかのループ内比較は無駄なので, ループ外に出した. --- src/cave.c | 287 ++++++++++++++++++++++++++++++++----------------------------- 1 file changed, 150 insertions(+), 137 deletions(-) diff --git a/src/cave.c b/src/cave.c index 7c42482c9..65f423e0a 100644 --- a/src/cave.c +++ b/src/cave.c @@ -2799,9 +2799,6 @@ static void mon_lite_hack(int y, int x) if (!cave_los_grid(c_ptr)) { - /* Hack XXX XXX - Is it a wall and monster not in LOS? */ - if (mon_invis) return; - /* Hack -- Prevent monster lite leakage in walls */ /* Horizontal walls between player and a monster */ @@ -2820,6 +2817,9 @@ static void mon_lite_hack(int y, int x) { if (!cave_los_bold(y, x - 1)) return; } + + /* Hack XXX XXX - Is it a wall and monster not in LOS? */ + else if (mon_invis) return; } /* Vertical walls between player and a monster */ @@ -2838,6 +2838,9 @@ static void mon_lite_hack(int y, int x) { if (!cave_los_bold(y - 1, x)) return; } + + /* Hack XXX XXX - Is it a wall and monster not in LOS? */ + else if (mon_invis) return; } } @@ -2880,11 +2883,8 @@ static void mon_dark_hack(int y, int x) /* Want a unlit and undarkened square in view of the player */ if ((c_ptr->info & (CAVE_LITE | CAVE_MNLT | CAVE_MNDK | CAVE_VIEW)) != CAVE_VIEW) return; - if (!cave_los_grid(c_ptr)) + if (!cave_los_grid(c_ptr) && !cave_have_flag_grid(c_ptr, FF_PROJECT)) { - /* Hack XXX XXX - Is it a wall and monster not in LOS? */ - if (mon_invis) return; - /* Hack -- Prevent monster dark lite leakage in walls */ /* Horizontal walls between player and a monster */ @@ -2897,12 +2897,15 @@ static void mon_dark_hack(int y, int x) /* Only first wall viewed from mid-x is lit */ if (x < midpoint) { - if (!cave_los_bold(y, x + 1)) return; + if (!cave_los_bold(y, x + 1) && !cave_have_flag_bold(y, x + 1, FF_PROJECT)) return; } else if (x > midpoint) { - if (!cave_los_bold(y, x - 1)) return; + if (!cave_los_bold(y, x - 1) && !cave_have_flag_bold(y, x - 1, FF_PROJECT)) return; } + + /* Hack XXX XXX - Is it a wall and monster not in LOS? */ + else if (mon_invis) return; } /* Vertical walls between player and a monster */ @@ -2915,12 +2918,15 @@ static void mon_dark_hack(int y, int x) /* Only first wall viewed from mid-y is lit */ if (y < midpoint) { - if (!cave_los_bold(y + 1, x)) return; + if (!cave_los_bold(y + 1, x) && !cave_have_flag_bold(y + 1, x, FF_PROJECT)) return; } else if (y > midpoint) { - if (!cave_los_bold(y - 1, x)) return; + if (!cave_los_bold(y - 1, x) && !cave_have_flag_bold(y - 1, x, FF_PROJECT)) return; } + + /* Hack XXX XXX - Is it a wall and monster not in LOS? */ + else if (mon_invis) return; } } @@ -2953,6 +2959,7 @@ void update_mon_lite(void) s16b fx, fy; void (*add_mon_lite)(int, int); + int f_flag; s16b end_temp; @@ -2976,166 +2983,172 @@ void update_mon_lite(void) /* Empty temp list of new squares to lite up */ temp_n = 0; - /* Loop through monsters, adding newly lit squares to changes list */ - for (i = 1; i < m_max; i++) + /* If a monster stops time, don't process */ + if (!world_monster) { - monster_type *m_ptr = &m_list[i]; - monster_race *r_ptr = &r_info[m_ptr->r_idx]; + monster_type *m_ptr; + monster_race *r_ptr; - /* Skip dead monsters */ - if (!m_ptr->r_idx) continue; + /* Loop through monsters, adding newly lit squares to changes list */ + for (i = 1; i < m_max; i++) + { + m_ptr = &m_list[i]; + r_ptr = &r_info[m_ptr->r_idx]; - /* Is it too far away? */ - if (m_ptr->cdis > dis_lim) continue; + /* Skip dead monsters */ + if (!m_ptr->r_idx) continue; - /* If a monster stops time, break */ - if (world_monster) break; + /* Is it too far away? */ + if (m_ptr->cdis > dis_lim) continue; - /* Get lite radius */ - rad = 0; + /* Get lite radius */ + rad = 0; - /* Note the radii are cumulative */ - if (r_ptr->flags7 & (RF7_HAS_LITE_1 | RF7_SELF_LITE_1)) rad++; - if (r_ptr->flags7 & (RF7_HAS_LITE_2 | RF7_SELF_LITE_2)) rad += 2; - if (r_ptr->flags7 & (RF7_HAS_DARK_1 | RF7_SELF_DARK_1)) rad--; - if (r_ptr->flags7 & (RF7_HAS_DARK_2 | RF7_SELF_DARK_2)) rad -= 2; + /* Note the radii are cumulative */ + if (r_ptr->flags7 & (RF7_HAS_LITE_1 | RF7_SELF_LITE_1)) rad++; + if (r_ptr->flags7 & (RF7_HAS_LITE_2 | RF7_SELF_LITE_2)) rad += 2; + if (r_ptr->flags7 & (RF7_HAS_DARK_1 | RF7_SELF_DARK_1)) rad--; + if (r_ptr->flags7 & (RF7_HAS_DARK_2 | RF7_SELF_DARK_2)) rad -= 2; - /* Exit if has no light */ - if (!rad) continue; - else if (rad > 0) - { - if (!(r_ptr->flags7 & (RF7_SELF_LITE_1 | RF7_SELF_LITE_2)) && (m_ptr->csleep || (!dun_level && is_daytime()) || p_ptr->inside_battle)) continue; - if (d_info[dungeon_type].flags1 & DF1_DARKNESS) rad = 1; - add_mon_lite = mon_lite_hack; - } - else - { - if (!(r_ptr->flags7 & (RF7_SELF_DARK_1 | RF7_SELF_DARK_2)) && (m_ptr->csleep || (!dun_level && !is_daytime()))) continue; - add_mon_lite = mon_dark_hack; - rad = -rad; /* Use absolute value */ - } + /* Exit if has no light */ + if (!rad) continue; + else if (rad > 0) + { + if (!(r_ptr->flags7 & (RF7_SELF_LITE_1 | RF7_SELF_LITE_2)) && (m_ptr->csleep || (!dun_level && is_daytime()) || p_ptr->inside_battle)) continue; + if (d_info[dungeon_type].flags1 & DF1_DARKNESS) rad = 1; + add_mon_lite = mon_lite_hack; + f_flag = FF_LOS; + } + else + { + if (!(r_ptr->flags7 & (RF7_SELF_DARK_1 | RF7_SELF_DARK_2)) && (m_ptr->csleep || (!dun_level && !is_daytime()))) continue; + add_mon_lite = mon_dark_hack; + f_flag = FF_PROJECT; + rad = -rad; /* Use absolute value */ + } - /* Access the location */ - mon_fx = m_ptr->fx; - mon_fy = m_ptr->fy; + /* Access the location */ + mon_fx = m_ptr->fx; + mon_fy = m_ptr->fy; - /* Is the monster visible? */ - mon_invis = !(cave[mon_fy][mon_fx].info & CAVE_VIEW); + /* Is the monster visible? */ + mon_invis = !(cave[mon_fy][mon_fx].info & CAVE_VIEW); - /* The square it is on */ - add_mon_lite(mon_fy, mon_fx); + /* The square it is on */ + add_mon_lite(mon_fy, mon_fx); - /* Adjacent squares */ - add_mon_lite(mon_fy + 1, mon_fx); - add_mon_lite(mon_fy - 1, mon_fx); - add_mon_lite(mon_fy, mon_fx + 1); - add_mon_lite(mon_fy, mon_fx - 1); - add_mon_lite(mon_fy + 1, mon_fx + 1); - add_mon_lite(mon_fy + 1, mon_fx - 1); - add_mon_lite(mon_fy - 1, mon_fx + 1); - add_mon_lite(mon_fy - 1, mon_fx - 1); + /* Adjacent squares */ + add_mon_lite(mon_fy + 1, mon_fx); + add_mon_lite(mon_fy - 1, mon_fx); + add_mon_lite(mon_fy, mon_fx + 1); + add_mon_lite(mon_fy, mon_fx - 1); + add_mon_lite(mon_fy + 1, mon_fx + 1); + add_mon_lite(mon_fy + 1, mon_fx - 1); + add_mon_lite(mon_fy - 1, mon_fx + 1); + add_mon_lite(mon_fy - 1, mon_fx - 1); - /* Radius 2 */ - if (rad >= 2) - { - /* South of the monster */ - if (cave_los_bold(mon_fy + 1, mon_fx)) + /* Radius 2 */ + if (rad >= 2) { - add_mon_lite(mon_fy + 2, mon_fx + 1); - add_mon_lite(mon_fy + 2, mon_fx); - add_mon_lite(mon_fy + 2, mon_fx - 1); + /* South of the monster */ + if (cave_have_flag_bold(mon_fy + 1, mon_fx, f_flag)) + { + add_mon_lite(mon_fy + 2, mon_fx + 1); + add_mon_lite(mon_fy + 2, mon_fx); + add_mon_lite(mon_fy + 2, mon_fx - 1); - c_ptr = &cave[mon_fy + 2][mon_fx]; + c_ptr = &cave[mon_fy + 2][mon_fx]; - /* Radius 3 */ - if ((rad == 3) && cave_los_grid(c_ptr)) - { - add_mon_lite(mon_fy + 3, mon_fx + 1); - add_mon_lite(mon_fy + 3, mon_fx); - add_mon_lite(mon_fy + 3, mon_fx - 1); + /* Radius 3 */ + if ((rad == 3) && cave_have_flag_grid(c_ptr, f_flag)) + { + add_mon_lite(mon_fy + 3, mon_fx + 1); + add_mon_lite(mon_fy + 3, mon_fx); + add_mon_lite(mon_fy + 3, mon_fx - 1); + } } - } - /* North of the monster */ - if (cave_los_bold(mon_fy - 1, mon_fx)) - { - add_mon_lite(mon_fy - 2, mon_fx + 1); - add_mon_lite(mon_fy - 2, mon_fx); - add_mon_lite(mon_fy - 2, mon_fx - 1); + /* North of the monster */ + if (cave_have_flag_bold(mon_fy - 1, mon_fx, f_flag)) + { + add_mon_lite(mon_fy - 2, mon_fx + 1); + add_mon_lite(mon_fy - 2, mon_fx); + add_mon_lite(mon_fy - 2, mon_fx - 1); - c_ptr = &cave[mon_fy - 2][mon_fx]; + c_ptr = &cave[mon_fy - 2][mon_fx]; - /* Radius 3 */ - if ((rad == 3) && cave_los_grid(c_ptr)) - { - add_mon_lite(mon_fy - 3, mon_fx + 1); - add_mon_lite(mon_fy - 3, mon_fx); - add_mon_lite(mon_fy - 3, mon_fx - 1); + /* Radius 3 */ + if ((rad == 3) && cave_have_flag_grid(c_ptr, f_flag)) + { + add_mon_lite(mon_fy - 3, mon_fx + 1); + add_mon_lite(mon_fy - 3, mon_fx); + add_mon_lite(mon_fy - 3, mon_fx - 1); + } } - } - /* East of the monster */ - if (cave_los_bold(mon_fy, mon_fx + 1)) - { - add_mon_lite(mon_fy + 1, mon_fx + 2); - add_mon_lite(mon_fy, mon_fx + 2); - add_mon_lite(mon_fy - 1, mon_fx + 2); + /* East of the monster */ + if (cave_have_flag_bold(mon_fy, mon_fx + 1, f_flag)) + { + add_mon_lite(mon_fy + 1, mon_fx + 2); + add_mon_lite(mon_fy, mon_fx + 2); + add_mon_lite(mon_fy - 1, mon_fx + 2); - c_ptr = &cave[mon_fy][mon_fx + 2]; + c_ptr = &cave[mon_fy][mon_fx + 2]; - /* Radius 3 */ - if ((rad == 3) && cave_los_grid(c_ptr)) - { - add_mon_lite(mon_fy + 1, mon_fx + 3); - add_mon_lite(mon_fy, mon_fx + 3); - add_mon_lite(mon_fy - 1, mon_fx + 3); + /* Radius 3 */ + if ((rad == 3) && cave_have_flag_grid(c_ptr, f_flag)) + { + add_mon_lite(mon_fy + 1, mon_fx + 3); + add_mon_lite(mon_fy, mon_fx + 3); + add_mon_lite(mon_fy - 1, mon_fx + 3); + } } - } - /* West of the monster */ - if (cave_los_bold(mon_fy, mon_fx - 1)) - { - add_mon_lite(mon_fy + 1, mon_fx - 2); - add_mon_lite(mon_fy, mon_fx - 2); - add_mon_lite(mon_fy - 1, mon_fx - 2); + /* West of the monster */ + if (cave_have_flag_bold(mon_fy, mon_fx - 1, f_flag)) + { + add_mon_lite(mon_fy + 1, mon_fx - 2); + add_mon_lite(mon_fy, mon_fx - 2); + add_mon_lite(mon_fy - 1, mon_fx - 2); - c_ptr = &cave[mon_fy][mon_fx - 2]; + c_ptr = &cave[mon_fy][mon_fx - 2]; - /* Radius 3 */ - if ((rad == 3) && cave_los_grid(c_ptr)) - { - add_mon_lite(mon_fy + 1, mon_fx - 3); - add_mon_lite(mon_fy, mon_fx - 3); - add_mon_lite(mon_fy - 1, mon_fx - 3); + /* Radius 3 */ + if ((rad == 3) && cave_have_flag_grid(c_ptr, f_flag)) + { + add_mon_lite(mon_fy + 1, mon_fx - 3); + add_mon_lite(mon_fy, mon_fx - 3); + add_mon_lite(mon_fy - 1, mon_fx - 3); + } } } - } - /* Radius 3 */ - if (rad == 3) - { - /* South-East of the monster */ - if (cave_los_bold(mon_fy + 1, mon_fx + 1)) + /* Radius 3 */ + if (rad == 3) { - add_mon_lite(mon_fy + 2, mon_fx + 2); - } + /* South-East of the monster */ + if (cave_have_flag_bold(mon_fy + 1, mon_fx + 1, f_flag)) + { + add_mon_lite(mon_fy + 2, mon_fx + 2); + } - /* South-West of the monster */ - if (cave_los_bold(mon_fy + 1, mon_fx - 1)) - { - add_mon_lite(mon_fy + 2, mon_fx - 2); - } + /* South-West of the monster */ + if (cave_have_flag_bold(mon_fy + 1, mon_fx - 1, f_flag)) + { + add_mon_lite(mon_fy + 2, mon_fx - 2); + } - /* North-East of the monster */ - if (cave_los_bold(mon_fy - 1, mon_fx + 1)) - { - add_mon_lite(mon_fy - 2, mon_fx + 2); - } + /* North-East of the monster */ + if (cave_have_flag_bold(mon_fy - 1, mon_fx + 1, f_flag)) + { + add_mon_lite(mon_fy - 2, mon_fx + 2); + } - /* North-West of the monster */ - if (cave_los_bold(mon_fy - 1, mon_fx - 1)) - { - add_mon_lite(mon_fy - 2, mon_fx - 2); + /* North-West of the monster */ + if (cave_have_flag_bold(mon_fy - 1, mon_fx - 1, f_flag)) + { + add_mon_lite(mon_fy - 2, mon_fx - 2); + } } } } -- 2.11.0