From c24eb23c140d6e8839e536fd012ec5c106bcaf54 Mon Sep 17 00:00:00 2001 From: elijah-thomas774 Date: Sun, 16 Mar 2025 15:54:32 -0400 Subject: [PATCH] d_scn_callback matching and better PCAM names --- config/SOUE01/splits.txt | 2 ++ config/SOUE01/symbols.txt | 4 ++-- configure.py | 6 +++++- include/d/d_bzs_types.h | 8 ++++---- src/toBeSorted/d_scn_callback.cpp | 20 ++++++++++---------- 5 files changed, 23 insertions(+), 17 deletions(-) diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index 2f1629ed..b6711ae5 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -36,6 +36,8 @@ toBeSorted/d_d3d.cpp: toBeSorted/d_scn_callback.cpp: .text start:0x80019E80 end:0x8001A590 .data start:0x80500A70 end:0x80500AD8 + .sbss start:0x80575020 end:0x80575028 + .sdata2 start:0x80576A68 end:0x80576A78 toBeSorted/d_unk_proc.cpp: .text start:0x8001A590 end:0x8001BE58 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 2d867b8c..9fb3a09b 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -631,7 +631,7 @@ __dt__Q23d3d7XluProcFv = .text:0x80019DD0; // type:function size:0x5C __sinit_\d_d3d_cpp = .text:0x80019E30; // type:function size:0x44 ExecCallback_CALC_MAT__14dScnCallback_cFQ44nw4r3g3d6ScnObj6TimingPQ34nw4r3g3d6ScnObjUlPv = .text:0x80019E80; // type:function size:0x3A8 attach__14dScnCallback_cFRQ23m3d9scnLeaf_c = .text:0x8001A230; // type:function size:0x50 -setPCAMPos2__FP4PCAM = .text:0x8001A280; // type:function size:0x144 +setPCAMPos2__FPC4PCAM = .text:0x8001A280; // type:function size:0x144 linkMdl__Q23d3d12UnkWithWaterFRQ34nw4r3g3d6ResMdlPQ23d3d12UnkWithWater = .text:0x8001A3D0; // type:function size:0x140 ExecCallback_DRAW_XLU__Q34nw4r3g3d15IScnObjCallbackFQ44nw4r3g3d6ScnObj6TimingPQ34nw4r3g3d6ScnObjUlPv = .text:0x8001A510; // type:function size:0x4 ExecCallback_DRAW_OPA__Q34nw4r3g3d15IScnObjCallbackFQ44nw4r3g3d6ScnObj6TimingPQ34nw4r3g3d6ScnObjUlPv = .text:0x8001A520; // type:function size:0x4 @@ -39873,7 +39873,7 @@ SAVE_FILE_RELATED = .sbss:0x80575000; // type:object size:0x8 data:4byte lbl_80575008 = .sbss:0x80575008; // type:object size:0x8 data:4byte lbl_80575010 = .sbss:0x80575010; // type:object size:0x8 data:4byte lbl_80575018 = .sbss:0x80575018; // type:object size:0x8 data:4byte -lbl_80575020 = .sbss:0x80575020; // type:object size:0x8 data:byte +lbl_80575020 = .sbss:0x80575020; // type:object size:0x1 data:byte lbl_80575028 = .sbss:0x80575028; // type:object size:0x4 data:float lbl_8057502C = .sbss:0x8057502C; // type:object size:0x4 data:float lbl_80575030 = .sbss:0x80575030; // type:object size:0x4 data:float diff --git a/configure.py b/configure.py index 5b0ff80b..d690c126 100644 --- a/configure.py +++ b/configure.py @@ -441,7 +441,11 @@ config.libs = [ Object(NonMatching, "toBeSorted/file_manager.cpp"), Object(NonMatching, "toBeSorted/save_manager.cpp"), Object(NonMatching, "toBeSorted/d_d3d.cpp"), - Object(NonMatching, "toBeSorted/d_scn_callback.cpp"), + Object( + Matching, + "toBeSorted/d_scn_callback.cpp", + extra_cflags=["-opt noloop"], + ), Object(NonMatching, "toBeSorted/d_unk_proc.cpp"), Object(NonMatching, "toBeSorted/blur_and_palette_manager.cpp"), Object(Matching, "DynamicLink.cpp"), diff --git a/include/d/d_bzs_types.h b/include/d/d_bzs_types.h index 23487956..bf0a06f5 100644 --- a/include/d/d_bzs_types.h +++ b/include/d/d_bzs_types.h @@ -112,10 +112,10 @@ struct PATH { // Size 0x24 struct PCAM { - /* 0x00 */ mVec3_c position1; - /* 0x0C */ mVec3_c position2; - /* 0x18 */ f32 field_0x18; - /* 0x1C */ f32 field_0x1C; + /* 0x00 */ mVec3_c position; + /* 0x0C */ mVec3_c target; + /* 0x18 */ f32 twist; + /* 0x1C */ f32 radius; /* 0x20 */ u8 id; /* 0x21 */ u8 _0x21[3]; }; diff --git a/src/toBeSorted/d_scn_callback.cpp b/src/toBeSorted/d_scn_callback.cpp index ce1f2fe7..3b1cc927 100644 --- a/src/toBeSorted/d_scn_callback.cpp +++ b/src/toBeSorted/d_scn_callback.cpp @@ -112,7 +112,7 @@ void dScnCallback_c::attach(m3d::scnLeaf_c &leaf) { leaf.enableCallbackOp(nw4r::g3d::ScnObj::EXECOP_CALC_MAT); } -void setPCAMPos2(PCAM *pcam) { +void setPCAMPos2(const PCAM *pcam) { static nw4r::g3d::Camera::PostureInfo sPosture = { nw4r::g3d::Camera::POSTURE_AIM, nw4r::math::VEC3(0.0f, 0.0f, 0.0f), @@ -122,29 +122,29 @@ void setPCAMPos2(PCAM *pcam) { }; nw4r::g3d::Camera cam = m3d::getCamera(pcam->id); - cam.SetPosition(pcam->position1.x, pcam->position1.y, pcam->position1.z); - // TODO - sPosture.cameraTarget = pcam->position2; + cam.SetPosition(pcam->position.x, pcam->position.y, pcam->position.z); + + sPosture.cameraTarget = pcam->target; + sPosture.cameraTwist = pcam->twist; cam.SetPosture(sPosture); - cam.SetOrtho(pcam->field_0x1C, -pcam->field_0x1C, -pcam->field_0x1C, pcam->field_0x1C, 1.0f, 1000000.0f); + cam.SetOrtho(pcam->radius, -pcam->radius, -pcam->radius, pcam->radius, 1.0f, 1000000.0f); cam.SetTexMtxParam(0.5f, 0.5f, 0.5f, 0.5f); } -// TODO bool d3d::UnkWithWater::linkMdl(nw4r::g3d::ResMdl &mdl, d3d::UnkWithWater *thing) { bool result = false; - - for (u32 i = 0; i < mdl.GetResMatNumEntries(); i++) { + + for (int i = 0; i < mdl.GetResMatNumEntries(); i++) { nw4r::g3d::ResMat mat = mdl.GetResMat(i); nw4r::g3d::ResTexSrt srt = mat.GetResTexSrt(); - for (u32 j = 0; j < mat.GetNumResTexPlttInfo(); j++) { + for (int j = 0; j < mat.GetNumResTexPlttInfo(); j++) { nw4r::g3d::ResTexPlttInfo paletteInfo = mat.GetResTexPlttInfo(j); const char *name = paletteInfo.GetTexName(); if (strequals(name, "DummyWater") || strequals(name, "TimeDoorB_Dummy")) { nw4r::g3d::ResTexObj obj = mat.GetResTexObj(); thing->init(obj, paletteInfo.ptr()->mapID); - + u32 mode; int camRef; int lightRef;