From 55ceab9b2df86304c4d16021e371fd43fcd2a82e Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Wed, 10 Jun 2026 23:58:09 -0700 Subject: [PATCH] fix los wolfos --- src/d/actor/d_a_e_ww.cpp | 13 +++++++++++-- src/d/d_stage.cpp | 13 +++---------- src/dusk/tphd/LosTable.cpp | 8 ++++++++ src/dusk/tphd/LosTable.hpp | 2 ++ 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/d/actor/d_a_e_ww.cpp b/src/d/actor/d_a_e_ww.cpp index cc82b1e652..1d28609669 100644 --- a/src/d/actor/d_a_e_ww.cpp +++ b/src/d/actor/d_a_e_ww.cpp @@ -13,6 +13,9 @@ #include "Z2AudioLib/Z2Instances.h" #include +#include "dusk/tphd/LosTable.hpp" +#include "dusk/tphd/TphdPack.hpp" + enum E_ww_RES_File_ID { /* BCK */ /* 0x04 */ BCK_WW_APPEAR = 0x4, @@ -466,7 +469,7 @@ f32 daE_WW_c::checkCreateBg(cXyz i_vector) { return -G_CM3D_F_INF; } - if (dComIfG_Bgsp().GetSpecialCode(gnd_chk) == 5 || dComIfG_Bgsp().GetPolyAtt0(gnd_chk) == 0xD) { + if (dComIfG_Bgsp().GetSpecialCode(gnd_chk) == 5 || dComIfG_Bgsp().GetPolyAtt0(gnd_chk) == 0xD IF_DUSK(|| dusk::tphd::is_los_active())) { cXyz temp_r1 = daPy_getPlayerActorClass()->current.pos; temp_r1.y += 100.0f; sp14 = i_vector; @@ -666,8 +669,14 @@ void daE_WW_c::executeMaster() { sp30.set(0.0f, 0.0f, 3000.0f); } +#if TARGET_PC + if (dusk::tphd::is_los_active()) { + sp30.z = 600.0f; + } +#endif + cLib_offsetPos(&sp3C, &sp48, fopCamM_GetAngleY(camera), &sp30); - if (current.pos.abs(sp3C) < field_0x6a8) { + if ((current.pos.abs(sp3C) < field_0x6a8) IF_DUSK(|| (dusk::tphd::is_los_active() && current.pos.y - sp48.y < field_0x6a8))) { f32 temp_f31 = checkCreateBg(sp3C); if (-G_CM3D_F_INF != temp_f31) { sp3C.y = temp_f31; diff --git a/src/d/d_stage.cpp b/src/d/d_stage.cpp index fdd47cf38c..fb66e4226a 100644 --- a/src/d/d_stage.cpp +++ b/src/d/d_stage.cpp @@ -2096,13 +2096,6 @@ static int dStage_doorInfoInit(dStage_dt_c* i_stage, void* i_data, int entryNum, } #if TARGET_PC -// D_SB11 (Cave of Shadows, HD): true when the los table is loaded and we are in D_SB11. -// Mirrors HD's `g_dComIfG_gameInfo.field4_0x1e448 != 0` gate (set once in phase_1 for D_SB11). -static bool isLOSStage() { - return dusk::tphd::los_loaded() && - std::strcmp(dComIfGp_getStartStageName(), "D_SB11") == 0; -} - // Mirrors HD FUN_02ab7e94 (los override): the file RTBL is a linear placeholder chain // (r19 -> [19,18,20]); rewrite each room's m_rooms in place from los.bin floor links. // next gets NO 0x80 (floor not yet unlocked) so it is not bg-loaded at stage-create; @@ -2154,7 +2147,7 @@ static void dStage_LOSRoomReadOverride(roomRead_class* p_node) { // No-op outside los stages. This replaces the earlier per-frame RoomCheck reveal (which churned // room loads). HD reveals the next floor at the moment you open the descent gate, not per-frame. void dStage_showLOSNextFloor(int fromRoom) { - if (!isLOSStage()) { + if (!dusk::tphd::is_los_active()) { return; } @@ -2201,7 +2194,7 @@ static int dStage_roomReadInit(dStage_dt_c* i_stage, void* i_data, int param_2, } #if TARGET_PC - if (dusk::tphd_active() && isLOSStage()) { + if (dusk::tphd_active() && dusk::tphd::is_los_active()) { dStage_LOSRoomReadOverride(p_node); } #endif @@ -2397,7 +2390,7 @@ static int dStage_mecoInfoInit(dStage_dt_c* i_stage, void* i_data, int param_2, #if TARGET_PC // los stages (D_SB11): the file MEC0 (roomNo%3) collides for los-adjacent floors; // HD re-derives the block from the los floor index instead (FUN_02ab8910). - if (dusk::tphd_active() && isLOSStage()) { + if (dusk::tphd_active() && dusk::tphd::is_los_active()) { entry_p->m_blockID = (u8)(dusk::tphd::los_floor_index(entry_p->m_roomNo) % 3); } #endif diff --git a/src/dusk/tphd/LosTable.cpp b/src/dusk/tphd/LosTable.cpp index 2ed6855a31..3205c841cd 100644 --- a/src/dusk/tphd/LosTable.cpp +++ b/src/dusk/tphd/LosTable.cpp @@ -116,4 +116,12 @@ int los_floor_index(int roomNo) { return s32(u32(entries()[roomNo].id3)); } +// D_SB11 (Cave of Shadows, HD): true when the los table is loaded and we are in D_SB11. +// Mirrors HD's `g_dComIfG_gameInfo.field4_0x1e448 != 0` gate (set once in phase_1 for D_SB11). +bool is_los_active() { + return tphd_active() && + los_loaded() && + std::strcmp(dComIfGp_getStartStageName(), "D_SB11") == 0; +} + } // namespace dusk::tphd diff --git a/src/dusk/tphd/LosTable.hpp b/src/dusk/tphd/LosTable.hpp index b269f5e761..bc1b9c8670 100644 --- a/src/dusk/tphd/LosTable.hpp +++ b/src/dusk/tphd/LosTable.hpp @@ -24,6 +24,8 @@ int los_prev_floor(int roomNo); int los_floor_index(int roomNo); +bool is_los_active(); + } #endif