From 851452bca66893038e40357e8c9be0b0860f1af3 Mon Sep 17 00:00:00 2001 From: CraftyBoss Date: Tue, 17 Mar 2026 02:16:09 -0700 Subject: [PATCH] npc actor in screen check fix, fix dBgWKCol::RoofChk using wrong var for prism idx calc --- src/d/actor/d_a_npc.cpp | 6 ++++++ src/d/d_bg_w_kcol.cpp | 7 +++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/d/actor/d_a_npc.cpp b/src/d/actor/d_a_npc.cpp index 123bf66800..b903ce8c8f 100644 --- a/src/d/actor/d_a_npc.cpp +++ b/src/d/actor/d_a_npc.cpp @@ -2695,9 +2695,15 @@ BOOL daNpcT_chkActorInScreen(fopAc_ac_c* i_ActorP, f32 param_1, f32 param_2, f32 for (int i = 0; i < 8; i++) { mDoLib_project(&pos_array[i], &proj); +#if TARGET_PC + if (0.0f < proj.x && proj.x < mDoGph_gInf_c::getWidth() && 0.0f < proj.y && proj.y < mDoGph_gInf_c::getHeight()) { + continue; + } +#else if (0.0f < proj.x && proj.x < FB_WIDTH && 0.0f < proj.y && proj.y < FB_HEIGHT) { continue; } +#endif return false; } diff --git a/src/d/d_bg_w_kcol.cpp b/src/d/d_bg_w_kcol.cpp index 17ec0298c1..65a10c6873 100644 --- a/src/d/d_bg_w_kcol.cpp +++ b/src/d/d_bg_w_kcol.cpp @@ -1909,17 +1909,16 @@ bool dBgWKCol::RoofChk(dBgS_RoofChk* param_0) { bool sp0A = false; u32 sp30 = ~m_pkc_head->m_area_y_width_mask; do { - uintptr_t block = (uintptr_t)(BE(u32)*)m_pkc_head->m_block_data; + uintptr_t block = (uintptr_t)(BE(s32)*)m_pkc_head->m_block_data; u32 shift = m_pkc_head->m_block_width_shift; int idx = 4 * (((u32)z >> shift) << m_pkc_head->m_area_xy_blocks_shift | ((u32)y >> shift) << m_pkc_head->m_area_x_blocks_shift | (u32)x >> shift); - - while ((idx = (*(BE(u32)*)(block + (idx & 0x7fffffff)))) >= 0) { + while ((idx = (*(BE(s32)*)(block + (idx & 0x7fffffff)))) >= 0) { block += idx; shift--; idx = (((u32)z >> shift & 1) << 2 | ((u32)y >> shift & 1) << 1 | - ((u32)z >> shift & 1) << 0) + ((u32)x >> shift & 1) << 0) << 2; }