From 330d5e53483b14626c869b40bb7945ec0dcf1ea8 Mon Sep 17 00:00:00 2001 From: Niklas Bauer Date: Tue, 2 Dec 2025 19:34:19 +0100 Subject: [PATCH] Consistent cull_box struct usage (#2905) * consistent cullbox usage * d_a_obj_waterPillar debug work so its not a regression --- include/d/actor/d_a_obj_pdtile.h | 2 +- include/d/actor/d_a_obj_waterPillar.h | 2 +- src/d/actor/d_a_door_push.cpp | 6 ++--- src/d/actor/d_a_obj_avalanche.cpp | 10 +++---- src/d/actor/d_a_obj_bemos.cpp | 6 ++--- src/d/actor/d_a_obj_bmshutter.cpp | 2 +- src/d/actor/d_a_obj_cblock.cpp | 6 ++--- src/d/actor/d_a_obj_cboard.cpp | 8 +++--- src/d/actor/d_a_obj_cwall.cpp | 6 ++--- src/d/actor/d_a_obj_fallobj.cpp | 6 ++--- src/d/actor/d_a_obj_firepillar.cpp | 16 +++++------ src/d/actor/d_a_obj_firepillar2.cpp | 6 ++--- src/d/actor/d_a_obj_kgate.cpp | 6 ++--- src/d/actor/d_a_obj_kjgjs.cpp | 18 ++++++------- src/d/actor/d_a_obj_kshutter.cpp | 6 ++--- src/d/actor/d_a_obj_kwheel00.cpp | 2 +- src/d/actor/d_a_obj_kwheel01.cpp | 4 +-- src/d/actor/d_a_obj_lv4prwall.cpp | 2 +- src/d/actor/d_a_obj_lv6bemos.cpp | 8 +++--- src/d/actor/d_a_obj_lv6bemos2.cpp | 8 +++--- src/d/actor/d_a_obj_magne_arm.cpp | 12 ++++----- src/d/actor/d_a_obj_pdoor.cpp | 10 +++---- src/d/actor/d_a_obj_pdtile.cpp | 18 ++++++------- src/d/actor/d_a_obj_rgate.cpp | 6 ++--- src/d/actor/d_a_obj_smgdoor.cpp | 6 ++--- src/d/actor/d_a_obj_swLight.cpp | 6 ++--- src/d/actor/d_a_obj_sword.cpp | 6 ++--- src/d/actor/d_a_obj_szbridge.cpp | 6 ++--- src/d/actor/d_a_obj_waterPillar.cpp | 39 ++++++++++++++++++--------- src/d/actor/d_a_tag_statue_evt.cpp | 4 +-- 30 files changed, 128 insertions(+), 115 deletions(-) diff --git a/include/d/actor/d_a_obj_pdtile.h b/include/d/actor/d_a_obj_pdtile.h index 7c30fb1e00..36293fd0b8 100644 --- a/include/d/actor/d_a_obj_pdtile.h +++ b/include/d/actor/d_a_obj_pdtile.h @@ -58,7 +58,7 @@ private: /* 0x7BC */ char* mArcName; /* 0x7C0 */ u32 mDzbId; /* 0x7C4 */ u32 mBmdId; - /* 0x7C8 */ Vec* mCullBox; + /* 0x7C8 */ cull_box* mCullBox; /* 0x7CC */ f32 field_0x7cc; /* 0x7D0 */ u8 field_0x7d0; /* 0x7D4 */ int field_0x7d4; diff --git a/include/d/actor/d_a_obj_waterPillar.h b/include/d/actor/d_a_obj_waterPillar.h index bee3c33300..a2eca0ec65 100644 --- a/include/d/actor/d_a_obj_waterPillar.h +++ b/include/d/actor/d_a_obj_waterPillar.h @@ -119,7 +119,7 @@ private: return shape_angle.x & 0xFF; } - s32 getParam(u8 shift, u8 bit) { + s32 getParam(int shift, int bit) { return fopAcM_GetParamBit(this, shift, bit); } diff --git a/src/d/actor/d_a_door_push.cpp b/src/d/actor/d_a_door_push.cpp index 58ffaabb09..6c9868596f 100644 --- a/src/d/actor/d_a_door_push.cpp +++ b/src/d/actor/d_a_door_push.cpp @@ -72,7 +72,7 @@ void daDoorPush_c::setBaseMtx() { static char* l_arcName = "V_OsuDoor"; -static Vec l_cull_box[2] = { +static cull_box l_cull_box = { {-600.0f, 0.0f, -600.0f}, {600.0f, 1000.0f, 600.0f}, }; @@ -88,8 +88,8 @@ int daDoorPush_c::Create() { mIndex = 2; initBaseMtx(); fopAcM_SetMtx(this, mActorMtx); - fopAcM_setCullSizeBox(this, l_cull_box[0].x, l_cull_box[0].y, l_cull_box[0].z, l_cull_box[1].x, - l_cull_box[1].y, l_cull_box[1].z); + fopAcM_setCullSizeBox(this, l_cull_box.min.x, l_cull_box.min.y, l_cull_box.min.z, l_cull_box.max.x, + l_cull_box.max.y, l_cull_box.max.z); mpBgW->SetPushPullCallback((dBgW_Base::PushPull_CallBack)PPCallBack); mpDoorBgW->SetPushPullCallback((dBgW_Base::PushPull_CallBack)PPCallBack2); eventInfo.setArchiveName(l_arcName); diff --git a/src/d/actor/d_a_obj_avalanche.cpp b/src/d/actor/d_a_obj_avalanche.cpp index bbf615e0dc..a1c6488f5f 100644 --- a/src/d/actor/d_a_obj_avalanche.cpp +++ b/src/d/actor/d_a_obj_avalanche.cpp @@ -41,9 +41,9 @@ static char* l_evName = "SNOW_COLLAPSE"; static char* l_staffName = "Obj_ava"; -static f32 l_cull_box[6] = { - -500.0f, -500.0f, -700.0f, - 500.0f, 1000.0f, 700.0f, +static cull_box l_cull_box = { + {-500.0f, -500.0f, -700.0f}, + {500.0f, 1000.0f, 700.0f}, }; int daObjAvalanche_c::Create() { @@ -67,8 +67,8 @@ int daObjAvalanche_c::Create() { } initBaseMtx(); fopAcM_SetMtx(this, mModel->getBaseTRMtx()); - fopAcM_setCullSizeBox(this, l_cull_box[0], l_cull_box[1], l_cull_box[2], l_cull_box[3], - l_cull_box[4], l_cull_box[5]); + fopAcM_setCullSizeBox(this, l_cull_box.min.x, l_cull_box.min.y, l_cull_box.min.z, l_cull_box.max.x, + l_cull_box.max.y, l_cull_box.max.z); if (mpBgW2 != 0) { mpBgW2->Move(); } diff --git a/src/d/actor/d_a_obj_bemos.cpp b/src/d/actor/d_a_obj_bemos.cpp index 8a391b6739..aa68a2a6a5 100644 --- a/src/d/actor/d_a_obj_bemos.cpp +++ b/src/d/actor/d_a_obj_bemos.cpp @@ -231,7 +231,7 @@ static char* l_joint_table[5] = { l_head_joint, l_bigGear_joint, l_smallGear0_joint, l_smallGear1_joint, l_smallGear2_joint, }; -static Vec l_cull_box[2] = { +static cull_box l_cull_box = { {-1200.0f, -100.0f, -1200.0f}, {1200.0f, 400.0f, 1200.0f}, }; @@ -287,8 +287,8 @@ int daObjBm_c::Create() { mCyl[i].SetStts(&mStts); } - fopAcM_setCullSizeBox(this, l_cull_box[0].x, l_cull_box[0].y, l_cull_box[0].z, l_cull_box[1].x, - l_cull_box[1].y, l_cull_box[1].z); + fopAcM_setCullSizeBox(this, l_cull_box.min.x, l_cull_box.min.y, l_cull_box.min.z, l_cull_box.max.x, + l_cull_box.max.y, l_cull_box.max.z); JUTNameTab* joint_name = mpModel->getModelData()->getJointTree().getJointName(); for (int i = 0; i < 5; i++) { for (u16 j = 0; j < mpModel->getModelData()->getJointNum(); j++) { diff --git a/src/d/actor/d_a_obj_bmshutter.cpp b/src/d/actor/d_a_obj_bmshutter.cpp index fcd126dc53..2de8fa71be 100644 --- a/src/d/actor/d_a_obj_bmshutter.cpp +++ b/src/d/actor/d_a_obj_bmshutter.cpp @@ -12,7 +12,7 @@ static const char* l_arcName = "K_saku00"; -static const f32 l_cull_box[6] = {-200.f, -100.f, -200.f, 200.f, 100.f, 200.f}; +static const cull_box l_cull_box = {{-200.f, -100.f, -200.f}, {200.f, 100.f, 200.f}}; static const Vec l_check_area[4] = { -250.0, 0.0, -100.0, // min 200.0, 0.0, -100.0, // unknown diff --git a/src/d/actor/d_a_obj_cblock.cpp b/src/d/actor/d_a_obj_cblock.cpp index 1a3c82d922..a27a36bb3c 100644 --- a/src/d/actor/d_a_obj_cblock.cpp +++ b/src/d/actor/d_a_obj_cblock.cpp @@ -48,7 +48,7 @@ static cXyz l_smokeSetOffset(0.0f, 0.0f, -200.0f); static s32 unused_bss_70 = 0; #endif -static Vec const l_cull_box[2] = { +static cull_box const l_cull_box = { {-250.0f, 0.0f, -450.0f}, {250.0f, 250.0f, 400.0f}, }; @@ -139,8 +139,8 @@ int daObjCBlk_c::Create() { cyls[i].Set(l_cyl_src); cyls[i].SetStts(&stts); } - fopAcM_setCullSizeBox(this, l_cull_box[0].x, l_cull_box[0].y, l_cull_box[0].z, l_cull_box[1].x, - l_cull_box[1].y, l_cull_box[1].z); + fopAcM_setCullSizeBox(this, l_cull_box.min.x, l_cull_box.min.y, l_cull_box.min.z, l_cull_box.max.x, + l_cull_box.max.y, l_cull_box.max.z); cXyz acStack_40(0.0f, 0.0f, 50.0f); mDoMtx_stack_c::YrotS(current.angle.y); mDoMtx_stack_c::multVec(&acStack_40, &acStack_40); diff --git a/src/d/actor/d_a_obj_cboard.cpp b/src/d/actor/d_a_obj_cboard.cpp index 3f1f2d3d91..0bf662fb78 100644 --- a/src/d/actor/d_a_obj_cboard.cpp +++ b/src/d/actor/d_a_obj_cboard.cpp @@ -26,7 +26,7 @@ static char* l_dzbName[5] = { "ClearB00.dzb", "ClearB01.dzb", "ClearB02.dzb", "ClearB03.dzb", "ClearB04.dzb", }; -static Vec l_cull_box[2] = { +static cull_box l_cull_box = { {-100.0f, -10.0f, -100.0f}, {100.0f, 10.0f, 100.0f}, }; @@ -39,9 +39,9 @@ int daObjBoard_c::Create() { initBaseMtx(); fopAcM_SetMtx(this, field_0x5a8); - fopAcM_setCullSizeBox(this, l_cull_box[0].x * scale.x, l_cull_box[0].y, - l_cull_box[0].z * scale.z, l_cull_box[1].x * scale.x, l_cull_box[1].y, - l_cull_box[1].z * scale.z); + fopAcM_setCullSizeBox(this, l_cull_box.min.x * scale.x, l_cull_box.min.y, + l_cull_box.min.z * scale.z, l_cull_box.max.x * scale.x, l_cull_box.max.y, + l_cull_box.max.z * scale.z); return 1; } diff --git a/src/d/actor/d_a_obj_cwall.cpp b/src/d/actor/d_a_obj_cwall.cpp index 69cffc731b..06d96b3b45 100644 --- a/src/d/actor/d_a_obj_cwall.cpp +++ b/src/d/actor/d_a_obj_cwall.cpp @@ -71,7 +71,7 @@ static char* l_arcName[2] = { "P_L4Cwall", }; -static Vec l_cull_box[2] = { +static cull_box l_cull_box = { {-300.0f, -100.0f, -650.0f}, {300.0f, 500.0f, 300.0f}, }; @@ -139,8 +139,8 @@ int daObjCwall_c::Create() { mCyl2.SetStts(&mStts); mSph.Set(l_sph_src); mSph.SetStts(&mStts); - fopAcM_setCullSizeBox(this, l_cull_box[0].x, l_cull_box[0].y, l_cull_box[0].z, l_cull_box[1].x, - l_cull_box[1].y, l_cull_box[1].z); + fopAcM_setCullSizeBox(this, l_cull_box.min.x, l_cull_box.min.y, l_cull_box.min.z, l_cull_box.max.x, + l_cull_box.max.y, l_cull_box.max.z); cXyz cStack_30(0.0f, 0.0f, 50.0f); mDoMtx_stack_c::YrotS(current.angle.y); mDoMtx_stack_c::multVec(&cStack_30, &cStack_30); diff --git a/src/d/actor/d_a_obj_fallobj.cpp b/src/d/actor/d_a_obj_fallobj.cpp index 706dd2b6f0..0c92f80583 100644 --- a/src/d/actor/d_a_obj_fallobj.cpp +++ b/src/d/actor/d_a_obj_fallobj.cpp @@ -54,7 +54,7 @@ void daObjFallObj_c::setBaseMtx() { static char* l_arcName = "K_drock00"; -static Vec l_cull_box[2] = { +static cull_box l_cull_box = { {-200.0f, -10000.0f, -200.0f}, {200.0f, 600.0f, 200.0f}, }; @@ -74,8 +74,8 @@ int daObjFallObj_c::Create() { mFallTime = getFallTime(); initBaseMtx(); fopAcM_SetMtx(this, mMtx); - fopAcM_setCullSizeBox(this, l_cull_box[0].x, l_cull_box[0].y, l_cull_box[0].z, l_cull_box[1].x, - l_cull_box[1].y, l_cull_box[1].z); + fopAcM_setCullSizeBox(this, l_cull_box.min.x, l_cull_box.min.y, l_cull_box.min.z, l_cull_box.max.x, + l_cull_box.max.y, l_cull_box.max.z); fopAcM_SetGravity(this, -6.0f); mSoundObj.init(¤t.pos, 1); return 1; diff --git a/src/d/actor/d_a_obj_firepillar.cpp b/src/d/actor/d_a_obj_firepillar.cpp index 42a0934c9e..6c32453b01 100644 --- a/src/d/actor/d_a_obj_firepillar.cpp +++ b/src/d/actor/d_a_obj_firepillar.cpp @@ -20,9 +20,9 @@ void daObjFPillar_c::setBaseMtx() { mDoMtx_stack_c::ZXYrotM(shape_angle.x, shape_angle.y, shape_angle.z); } -static f32 l_cull_box[6] = { - -30.0f, -10.0f, -30.0f, - 30.0f, 60.0f, 30.0f, +static cull_box l_cull_box = { + {-30.0f, -10.0f, -30.0f}, + {30.0f, 60.0f, 30.0f}, }; static dCcD_SrcCps l_cps_src = { @@ -42,12 +42,12 @@ int daObjFPillar_c::Create() { mStts.Init(0, 0xff, this); mCps.Set(l_cps_src); mCps.SetStts(&mStts); - f32 maxy = l_cull_box[4] * scale.y; + f32 maxy = l_cull_box.max.y * scale.y; fopAcM_setCullSizeBox(this, - (l_cull_box[0] * scale.x), - (l_cull_box[1] * scale.y), - (l_cull_box[2] * scale.x), - (l_cull_box[3] * scale.x), + (l_cull_box.min.x * scale.x), + (l_cull_box.min.y * scale.y), + (l_cull_box.min.z * scale.x), + (l_cull_box.max.x * scale.x), maxy, maxy); return 1; diff --git a/src/d/actor/d_a_obj_firepillar2.cpp b/src/d/actor/d_a_obj_firepillar2.cpp index 430fc5d391..cd699e8f3d 100644 --- a/src/d/actor/d_a_obj_firepillar2.cpp +++ b/src/d/actor/d_a_obj_firepillar2.cpp @@ -40,7 +40,7 @@ void daObjFPillar2_c::setBaseMtx() { static char* l_arcName = "Obj_yogan"; -static Vec l_cull_box[2] = { +static cull_box l_cull_box = { {-150.0f, -10.0f, -150.0f}, {150.0f, 1200.0f, 150.0f}, }; @@ -92,8 +92,8 @@ int daObjFPillar2_c::Create() { if (getKind() == KIND_MAGMA_POLE) { mCps.SetAtSpl(dCcG_At_Spl_UNK_0); } - fopAcM_setCullSizeBox(this, l_cull_box[0].x, l_cull_box[0].y, l_cull_box[0].z, l_cull_box[1].x, l_cull_box[1].y, - l_cull_box[1].z); + fopAcM_setCullSizeBox(this, l_cull_box.min.x, l_cull_box.min.y, l_cull_box.min.z, l_cull_box.max.x, l_cull_box.max.y, + l_cull_box.max.z); fopAcM_SetMtx(this, mMtx); mSoundObj.init(&mSoundPos, 1); if (getKind() == KIND_PIPE_FIRE) { diff --git a/src/d/actor/d_a_obj_kgate.cpp b/src/d/actor/d_a_obj_kgate.cpp index c377aba360..6f74edc5d3 100644 --- a/src/d/actor/d_a_obj_kgate.cpp +++ b/src/d/actor/d_a_obj_kgate.cpp @@ -52,7 +52,7 @@ static u32 const l_gate_heap[] = {0x1940, 0x1940, 0x1940}; static u32 const l_key_heap[] = {0x1000, 0x1000, 0x1000}; -static Vec const l_cull_box[] = { +static cull_box const l_cull_box = { {-300.0f, 0.0f, -350.0f}, {300.0f, 450.0f, 350.0f}, }; @@ -255,8 +255,8 @@ int daObjKGate_c::Create() { } } - fopAcM_setCullSizeBox(this, l_cull_box[0].x, l_cull_box[0].y, l_cull_box[0].z, l_cull_box[1].x, - l_cull_box[1].y, l_cull_box[1].z); + fopAcM_setCullSizeBox(this, l_cull_box.min.x, l_cull_box.min.y, l_cull_box.min.z, l_cull_box.max.x, + l_cull_box.max.y, l_cull_box.max.z); if (dComIfG_Bgsp().Regist(mpBgW, this)) { #ifdef DEBUG diff --git a/src/d/actor/d_a_obj_kjgjs.cpp b/src/d/actor/d_a_obj_kjgjs.cpp index cf3e76aa82..7c2b458306 100644 --- a/src/d/actor/d_a_obj_kjgjs.cpp +++ b/src/d/actor/d_a_obj_kjgjs.cpp @@ -47,11 +47,11 @@ int daObjKJgjs_c::CreateHeap() { return mpModel != NULL ? 1 : 0; } -static const Vec l_cull_box[4] = { - {-1260.0f, -3050.0f, -1260.0f}, - {1260.0f, 2800.0f, 1260.0f}, - {-76.37f, -10.83f, -78.51}, - {75.52f, 10.95f, 78.06f}, +static const cull_box l_cull_box[2] = { + {{-1260.0f, -3050.0f, -1260.0f}, + {1260.0f, 2800.0f, 1260.0f}}, + {{-76.37f, -10.83f, -78.51}, + {75.52f, 10.95f, 78.06f}}, }; int daObjKJgjs_c::Create() { @@ -59,11 +59,11 @@ int daObjKJgjs_c::Create() { MTXCopy(mMtx[1], mpModel->mBaseTransformMtx); mpBgW->OffRoofRegist(); if (!field_0x60c) { - fopAcM_setCullSizeBox(this, l_cull_box[0].x, l_cull_box[0].y, l_cull_box[0].z, - l_cull_box[1].x, l_cull_box[1].y, l_cull_box[1].z); + fopAcM_setCullSizeBox(this, l_cull_box[0].min.x, l_cull_box[0].min.y, l_cull_box[0].min.z, + l_cull_box[0].max.x, l_cull_box[0].max.y, l_cull_box[0].max.z); } else { - fopAcM_setCullSizeBox(this, l_cull_box[2].x, l_cull_box[2].y, l_cull_box[2].z, - l_cull_box[3].x, l_cull_box[3].y, l_cull_box[3].z); + fopAcM_setCullSizeBox(this, l_cull_box[1].min.x, l_cull_box[1].min.y, l_cull_box[1].min.z, + l_cull_box[1].max.x, l_cull_box[1].max.y, l_cull_box[1].max.z); } return 1; } diff --git a/src/d/actor/d_a_obj_kshutter.cpp b/src/d/actor/d_a_obj_kshutter.cpp index 57e3ecf582..7d2230c1ea 100644 --- a/src/d/actor/d_a_obj_kshutter.cpp +++ b/src/d/actor/d_a_obj_kshutter.cpp @@ -129,8 +129,8 @@ static u32 const l_heap_size[5] = { 0x1300, 0x1300, 0x1300, 0x1300, 0x20D0, }; -static f32 const l_cull_box[6] = { - -450.0f, 0.0f, -50.0f, 450.0f, 700.0f, 150.0f, +static cull_box const l_cull_box = { + {-450.0f, 0.0f, -50.0f}, {450.0f, 700.0f, 150.0f}, }; static char* l_arcName[5] = { @@ -209,7 +209,7 @@ int daObjKshtr_c::Create() { initBaseMtx(); fopAcM_SetMtx(this, mMtx); - fopAcM_setCullSizeBox(this, l_cull_box[0], l_cull_box[1], l_cull_box[2], l_cull_box[3], l_cull_box[4], l_cull_box[5]); + fopAcM_setCullSizeBox(this, l_cull_box.min.x, l_cull_box.min.y, l_cull_box.min.z, l_cull_box.max.x, l_cull_box.max.y, l_cull_box.max.z); if (checkKey() == 1) { eventInfo.setArchiveName(l_arcName[mType]); diff --git a/src/d/actor/d_a_obj_kwheel00.cpp b/src/d/actor/d_a_obj_kwheel00.cpp index 728bbe784b..a0eed328d5 100644 --- a/src/d/actor/d_a_obj_kwheel00.cpp +++ b/src/d/actor/d_a_obj_kwheel00.cpp @@ -82,7 +82,7 @@ static void* searchLv3Water(void* param_0, void* i_this) { static const int l_bmdidx[2] = {4, 4}; -const Vec l_cull_box[4] = { +const Vec l_cull_box[4] = { // cull_box struct not used due to mult later {-830.0f, -830.0f, -2500.0f}, {830.0f, 830.0f, 200.0f}, // Type 0 {-560.0f, -560.0f, -350.0f}, {560.0f, 560.0f, 350.0f} // Type 1 }; diff --git a/src/d/actor/d_a_obj_kwheel01.cpp b/src/d/actor/d_a_obj_kwheel01.cpp index 5d49c98003..da0700171a 100644 --- a/src/d/actor/d_a_obj_kwheel01.cpp +++ b/src/d/actor/d_a_obj_kwheel01.cpp @@ -102,7 +102,7 @@ cPhs__Step daObjKWheel01_c::create1st() { return phase; } -static const Vec l_cull_box[2] = { +static const cull_box l_cull_box = { {-1260.0f, -3050.0f, -1260.0f}, {1260.0f, 2800.0f, 1260.0f} }; @@ -177,7 +177,7 @@ int daObjKWheel01_c::Create() { #endif } - fopAcM_setCullSizeBox(this, l_cull_box[0].x, l_cull_box[0].y, l_cull_box[0].z, l_cull_box[1].x, l_cull_box[1].y, l_cull_box[1].z); + fopAcM_setCullSizeBox(this, l_cull_box.min.x, l_cull_box.min.y, l_cull_box.min.z, l_cull_box.max.x, l_cull_box.max.y, l_cull_box.max.z); return 1; } diff --git a/src/d/actor/d_a_obj_lv4prwall.cpp b/src/d/actor/d_a_obj_lv4prwall.cpp index de524ae7f4..44a554808e 100644 --- a/src/d/actor/d_a_obj_lv4prwall.cpp +++ b/src/d/actor/d_a_obj_lv4prwall.cpp @@ -51,7 +51,7 @@ int daObjLv4PRwall_c::create1st() { return phase_state; } -static const Vec l_cull_box[] = { +static const Vec l_cull_box[] = { // cull_box struct not used due to mult later {-1600.0f, -100.0f, -1600.0f}, {1600.0f, 1437.7f, 1600.0f}, {-1100.04, -60.0f, -1100.5f}, diff --git a/src/d/actor/d_a_obj_lv6bemos.cpp b/src/d/actor/d_a_obj_lv6bemos.cpp index e2e60af6bb..7f600e3300 100644 --- a/src/d/actor/d_a_obj_lv6bemos.cpp +++ b/src/d/actor/d_a_obj_lv6bemos.cpp @@ -110,9 +110,9 @@ void daObjL6Bm_c::setBaseMtx() { static char* l_arcName = "Obj_lv6bm"; -static f32 l_cull_box[6] = { - -200.0f, -100.0f, -200.0f, - 200.0f, 100.0f, 200.0f, +static cull_box l_cull_box = { + {-200.0f, -100.0f, -200.0f}, + {200.0f, 100.0f, 200.0f}, }; static dCcD_SrcCps l_cps_src = { @@ -136,7 +136,7 @@ int daObjL6Bm_c::Create() { field_0x748.Set(l_sph_src); field_0x748.SetStts(&mStts); - fopAcM_setCullSizeBox(this, l_cull_box[0], l_cull_box[1], l_cull_box[2], l_cull_box[3], l_cull_box[4], l_cull_box[5]); + fopAcM_setCullSizeBox(this, l_cull_box.min.x, l_cull_box.min.y, l_cull_box.min.z, l_cull_box.max.x, l_cull_box.max.y, l_cull_box.max.z); J3DJoint* neckJnt = mBeamosModel->getModelData()->getJointNodePointer(1); if (neckJnt != NULL) { diff --git a/src/d/actor/d_a_obj_lv6bemos2.cpp b/src/d/actor/d_a_obj_lv6bemos2.cpp index 38558229f4..05763a1495 100644 --- a/src/d/actor/d_a_obj_lv6bemos2.cpp +++ b/src/d/actor/d_a_obj_lv6bemos2.cpp @@ -128,9 +128,9 @@ static char* l_joint_table[5] = { l_smallGear2_joint, }; -static f32 l_cull_box[6] = { - -1200.0f, -100.0f, -1200.0f, - 1200.0f, 400.0f, 1200.0f, +static cull_box l_cull_box = { + {-1200.0f, -100.0f, -1200.0f}, + {1200.0f, 400.0f, 1200.0f}, }; static dCcD_SrcSph l_sph_src = { @@ -181,7 +181,7 @@ int daObjLv6Bm_c::Create() { field_0x87c.Set(l_cyl_src); field_0x87c.SetStts(&mStts); - fopAcM_setCullSizeBox(this, l_cull_box[0], l_cull_box[1], l_cull_box[2], l_cull_box[3], l_cull_box[4], l_cull_box[5]); + fopAcM_setCullSizeBox(this, l_cull_box.min.x, l_cull_box.min.y, l_cull_box.min.z, l_cull_box.max.x, l_cull_box.max.y, l_cull_box.max.z); JUTNameTab* name = mBeamosModel->getModelData()->getJointTree().getJointName(); for (int i = 0; i < 5; i++) { diff --git a/src/d/actor/d_a_obj_magne_arm.cpp b/src/d/actor/d_a_obj_magne_arm.cpp index 8037b46713..43d55c53a8 100644 --- a/src/d/actor/d_a_obj_magne_arm.cpp +++ b/src/d/actor/d_a_obj_magne_arm.cpp @@ -147,9 +147,9 @@ static void dummyStrings() { DEAD_STRING("D_MN54"); } -static Vec l_cull_box[2] = {{-500.0f, -3000.0f, -500.0f}, {500.0f, 3000.0f, 2500.0f}}; +static cull_box l_cull_box = {{-500.0f, -3000.0f, -500.0f}, {500.0f, 3000.0f, 2500.0f}}; -static Vec l_cull_box2[2] = {{-500.0f, -4000.0f, -500.0f}, {500.0f, 3000.0f, 2500.0f}}; +static cull_box l_cull_box2 = {{-500.0f, -4000.0f, -500.0f}, {500.0f, 3000.0f, 2500.0f}}; static Vec const l_offsetB = {-150.0f, 1200.0f, 0.0f}; // unused @@ -200,11 +200,11 @@ int daObjMarm_c::Create() { fopAcM_GetSpeed_p(this), 0, 0); if (mMoveType == MOVETYPE_D_e) { - fopAcM_setCullSizeBox(this, l_cull_box2[0].x, l_cull_box2[0].y, l_cull_box2[0].z, - l_cull_box2[1].x, l_cull_box2[1].y, l_cull_box2[1].z); + fopAcM_setCullSizeBox(this, l_cull_box2.min.x, l_cull_box2.min.y, l_cull_box2.min.z, + l_cull_box2.max.x, l_cull_box2.max.y, l_cull_box2.max.z); } else { - fopAcM_setCullSizeBox(this, l_cull_box[0].x, l_cull_box[0].y, l_cull_box[0].z, - l_cull_box[1].x, l_cull_box[1].y, l_cull_box[1].z); + fopAcM_setCullSizeBox(this, l_cull_box.min.x, l_cull_box.min.y, l_cull_box.min.z, + l_cull_box.max.x, l_cull_box.max.y, l_cull_box.max.z); } fopAcM_setCullSizeFar(this, 10.0f); diff --git a/src/d/actor/d_a_obj_pdoor.cpp b/src/d/actor/d_a_obj_pdoor.cpp index cbfd26c8c8..2938cbf4b7 100644 --- a/src/d/actor/d_a_obj_pdoor.cpp +++ b/src/d/actor/d_a_obj_pdoor.cpp @@ -53,9 +53,9 @@ void daObjPDoor_c::setBaseMtx() { static char* l_arcName = "V_OsuDoor"; -static f32 l_cull_box[6] = { - 0.0f, 0.0f, -600.0f, - 600.0f, 1000.0f, 600.0f, +static cull_box l_cull_box = { + {0.0f, 0.0f, -600.0f}, + {600.0f, 1000.0f, 600.0f}, }; int daObjPDoor_c::Create() { @@ -76,8 +76,8 @@ int daObjPDoor_c::Create() { initBaseMtx(); fopAcM_SetMtx(this, mModel->getBaseTRMtx()); mpBgW->SetPushPullCallback(PPCallBack); - fopAcM_setCullSizeBox(this, l_cull_box[0], l_cull_box[1], l_cull_box[2], l_cull_box[3], - l_cull_box[4], l_cull_box[5]); + fopAcM_setCullSizeBox(this, l_cull_box.min.x, l_cull_box.min.y, l_cull_box.min.z, l_cull_box.max.x, + l_cull_box.max.y, l_cull_box.max.z); return 1; } diff --git a/src/d/actor/d_a_obj_pdtile.cpp b/src/d/actor/d_a_obj_pdtile.cpp index a978454723..4bef0fb00e 100644 --- a/src/d/actor/d_a_obj_pdtile.cpp +++ b/src/d/actor/d_a_obj_pdtile.cpp @@ -26,7 +26,7 @@ static u32 l_bmdidx4[2] = { 5, 4, }; -static Vec l_cull_box4[2][2] = { +static cull_box l_cull_box4[2] = { {{-50.0f, -100.0f, -50.0f}, {50.0f, 20.49f, 50.0f}}, {{-160.0f, -460.0f, -160.0f}, {160.0f, 20.0f, 160.0f}}, }; @@ -37,7 +37,7 @@ static u32 l_dzbidx7 = 7; static u32 l_bmdidx7 = 4; -static Vec l_cull_box7[2] = { +static cull_box l_cull_box7 = { {-200.0f, -700.0f, -200.0f}, {200.0f, 50.0f, 200.0f}, }; @@ -48,7 +48,7 @@ static u32 l_dzbidx9 = 7; static u32 l_bmdidx9 = 4; -static Vec l_cull_box9[2] = { +static cull_box l_cull_box9 = { {-200.0f, -650.0f, -200.0f}, {200.0f, 50.0f, 200.0f}, }; @@ -59,25 +59,25 @@ int daObjPDtile_c::create1st() { mArcName = l_arcName9; mDzbId = l_dzbidx9; mBmdId = l_bmdidx9; - mCullBox = l_cull_box9; + mCullBox = &l_cull_box9; field_0x7cc = 1500.0f; } else if (mType == TYPE_2) { mArcName = l_arcName7; mDzbId = l_dzbidx7; mBmdId = l_bmdidx7; - mCullBox = l_cull_box7; + mCullBox = &l_cull_box7; field_0x7cc = 600.0f; } else if (mType == TYPE_0) { mArcName = l_arcName4; mDzbId = l_dzbidx4[0]; mBmdId = l_bmdidx4[0]; - mCullBox = l_cull_box4[0]; + mCullBox = &l_cull_box4[0]; field_0x7cc = 450.0f; } else { mArcName = l_arcName4; mDzbId = l_dzbidx4[1]; mBmdId = l_bmdidx4[1]; - mCullBox = l_cull_box4[1]; + mCullBox = &l_cull_box4[1]; field_0x7cc = 450.0f; } int rv = dComIfG_resLoad(this, mArcName); @@ -203,8 +203,8 @@ int daObjPDtile_c::Create() { mModel->setBaseTRMtx(field_0x5d8); fopAcM_SetMtx(this, field_0x5d8); fopAcM_setCullSizeBox(this, - mCullBox[0].x, mCullBox[0].y, mCullBox[0].z, - mCullBox[1].x, mCullBox[1].y, mCullBox[1].z); + mCullBox->min.x, mCullBox->min.y, mCullBox->min.z, + mCullBox->max.x, mCullBox->max.y, mCullBox->max.z); mpBgW->SetRideCallback(rideCallBack); field_0x610 = 0; field_0x614 = 0; diff --git a/src/d/actor/d_a_obj_rgate.cpp b/src/d/actor/d_a_obj_rgate.cpp index 58b762528e..232ff2e225 100644 --- a/src/d/actor/d_a_obj_rgate.cpp +++ b/src/d/actor/d_a_obj_rgate.cpp @@ -67,7 +67,7 @@ static int nodeCallBack(J3DJoint* i_joint, int param_1) { return 1; } -static const Vec l_cull_box[2] = { +static const cull_box l_cull_box = { {-400.0f, 0.0f, -400.0f}, {400.0f, 450.0f, 400.0f}, }; @@ -235,8 +235,8 @@ int daObjRgate_c::Create() { initBaseMtx(); fopAcM_SetMtx(this, field_0xb14); - fopAcM_setCullSizeBox(this, l_cull_box[0].x, l_cull_box[0].y, l_cull_box[0].z, l_cull_box[1].x, - l_cull_box[1].y, l_cull_box[1].z); + fopAcM_setCullSizeBox(this, l_cull_box.min.x, l_cull_box.min.y, l_cull_box.min.z, l_cull_box.max.x, + l_cull_box.max.y, l_cull_box.max.z); if (dComIfG_Bgsp().Regist(mpBgW, this)) { #ifdef DEBUG diff --git a/src/d/actor/d_a_obj_smgdoor.cpp b/src/d/actor/d_a_obj_smgdoor.cpp index 9ed31d198c..967ffaeba7 100644 --- a/src/d/actor/d_a_obj_smgdoor.cpp +++ b/src/d/actor/d_a_obj_smgdoor.cpp @@ -87,13 +87,13 @@ static char* l_eventName[2] = { "OLD_DOOR_IN", }; -static Vec l_cull_box[2] = {{-200.0f, 0.0f, -50.0f}, {200.0f, 400.0f, 50.0f}}; +static cull_box l_cull_box = {{-200.0f, 0.0f, -50.0f}, {200.0f, 400.0f, 50.0f}}; int daObjSmgDoor_c::Create() { initBaseMtx(); fopAcM_SetMtx(this, field_0x5b8); - fopAcM_setCullSizeBox(this, l_cull_box[0].x, l_cull_box[0].y, l_cull_box[0].z, l_cull_box[1].x, - l_cull_box[1].y, l_cull_box[1].z); + fopAcM_setCullSizeBox(this, l_cull_box.min.x, l_cull_box.min.y, l_cull_box.min.z, l_cull_box.max.x, + l_cull_box.max.y, l_cull_box.max.z); attention_info.position.y += 150.0f; eyePos.y += 150.0f; attention_info.flags = fopAc_AttnFlag_DOOR_e; diff --git a/src/d/actor/d_a_obj_swLight.cpp b/src/d/actor/d_a_obj_swLight.cpp index ea77efa68e..445b577131 100644 --- a/src/d/actor/d_a_obj_swLight.cpp +++ b/src/d/actor/d_a_obj_swLight.cpp @@ -80,7 +80,7 @@ const static dCcD_SrcSph l_sph_src_tg = { static char* l_arcName = "Obj_l8sw0"; -static Vec l_cull_box[2] = {{ +static cull_box l_cull_box = {{ -500.0f, 0.0f, -500.0f, @@ -132,8 +132,8 @@ int daObjSwLight_c::Create() { mTgSph[1].SetTgType(0x200); mCyl.Set(l_cyl_src); mCyl.SetStts(&mStts); - fopAcM_setCullSizeBox(this, l_cull_box[0].x, l_cull_box[0].y, l_cull_box[0].z, l_cull_box[1].x, - l_cull_box[1].y, l_cull_box[1].z); + fopAcM_setCullSizeBox(this, l_cull_box.min.x, l_cull_box.min.y, l_cull_box.min.z, l_cull_box.max.x, + l_cull_box.max.y, l_cull_box.max.z); field_0xae8 = 0xffff; JUTNameTab* name = mpModel->getModelData()->getMaterialTable().getMaterialName(); diff --git a/src/d/actor/d_a_obj_sword.cpp b/src/d/actor/d_a_obj_sword.cpp index 7a619b7c57..343c00ebcc 100644 --- a/src/d/actor/d_a_obj_sword.cpp +++ b/src/d/actor/d_a_obj_sword.cpp @@ -10,7 +10,7 @@ #include "d/d_com_inf_game.h" #include "d/d_item_data.h" -static Vec l_cull_box[2] = {{-200.0f, 0.0f, -200.0f}, {200.0f, 100.0f, 200.0f}}; +static cull_box l_cull_box = {{-200.0f, 0.0f, -200.0f}, {200.0f, 100.0f, 200.0f}}; void daObjSword_c::initBaseMtx() { mpModel->setBaseScale(scale); @@ -26,8 +26,8 @@ void daObjSword_c::setBaseMtx() { int daObjSword_c::Create() { initBaseMtx(); fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); - fopAcM_setCullSizeBox(this, l_cull_box[0].x, l_cull_box[0].y, l_cull_box[0].z, l_cull_box[1].x, - l_cull_box[1].y, l_cull_box[1].z); + fopAcM_setCullSizeBox(this, l_cull_box.min.x, l_cull_box.min.y, l_cull_box.min.z, l_cull_box.max.x, + l_cull_box.max.y, l_cull_box.max.z); fopAcM_OnCarryType(this, fopAcM_CARRY_UNK_30); show(); execute(); diff --git a/src/d/actor/d_a_obj_szbridge.cpp b/src/d/actor/d_a_obj_szbridge.cpp index d185b9ac2f..cf3e70897e 100644 --- a/src/d/actor/d_a_obj_szbridge.cpp +++ b/src/d/actor/d_a_obj_szbridge.cpp @@ -11,7 +11,7 @@ static void rideCallback(dBgW* param_0, fopAc_ac_c* param_1, fopAc_ac_c* param_2 static_cast(param_1)->rideActor(param_2); } -static const Vec l_cull_box[2] = { +static const cull_box l_cull_box = { {-310.0f, -30.0f, -760.0f}, {310.0f, 360.0f, 760.0f}, }; @@ -104,8 +104,8 @@ int daObjSZbridge_c::Create() { mpModel->setBaseTRMtx(field_0x5d8); fopAcM_SetMtx(this, field_0x5d8); - fopAcM_setCullSizeBox(this, l_cull_box[0].x, l_cull_box[0].y, l_cull_box[0].z, l_cull_box[1].x, - l_cull_box[1].y, l_cull_box[1].z); + fopAcM_setCullSizeBox(this, l_cull_box.min.x, l_cull_box.min.y, l_cull_box.min.z, l_cull_box.max.x, + l_cull_box.max.y, l_cull_box.max.z); for (int i = 0; i < 2; i++) { field_0x618[i] = -1; diff --git a/src/d/actor/d_a_obj_waterPillar.cpp b/src/d/actor/d_a_obj_waterPillar.cpp index 66348849db..719a04db84 100644 --- a/src/d/actor/d_a_obj_waterPillar.cpp +++ b/src/d/actor/d_a_obj_waterPillar.cpp @@ -92,7 +92,7 @@ int daWtPillar_c::CreateHeap() { return 1; } -Vec l_cull_box[2] = { +cull_box l_cull_box = { {-30.0f, -10.0f, -30.0f}, {30.0f, 60.0f, 30.0f} }; @@ -134,25 +134,27 @@ cPhs__Step daWtPillar_c::create() { mCapsuleCollider.SetStts(&mStts); //! @bug maxY is used as maxZ for setting cull size box, making it larger than intended - const f32 minX = l_cull_box[0].x * scale.x; - const f32 minY = l_cull_box[0].y * scale.y; - const f32 minZ = l_cull_box[0].z * scale.x; - const f32 maxX = l_cull_box[1].x * scale.x; - const f32 maxY = l_cull_box[1].y * scale.y; + const f32 minX = l_cull_box.min.x * scale.x; + const f32 minY = l_cull_box.min.y * scale.y; + const f32 minZ = l_cull_box.min.z * scale.x; + const f32 maxX = l_cull_box.max.x * scale.x; + const f32 maxY = l_cull_box.max.y * scale.y; + const f32 maxZ = l_cull_box.max.z * scale.x; fopAcM_setCullSizeBox(this, minX, minY, minZ, maxX, maxY, maxY); mAcchCir.SetWall(150.0f, 5.0f); - mAcch.Set(¤t.pos, &old.pos, this, 1, &mAcchCir, &speed, 0, 0); + mAcch.Set(fopAcM_GetPosition_p(this), fopAcM_GetOldPosition_p(this), this, 1, &mAcchCir, fopAcM_GetSpeed_p(this), 0, 0); mAcch.ClrWaterNone(); mAcch.SetWaterCheckOffset(10000.0f); mAcch.OnLineCheckNone(); - mStalactiteShouldStartShaking = mIsCarryingStalactite = false; + mIsCarryingStalactite = false; + mStalactiteShouldStartShaking = 0; mSwitchNo = getParam(0, 8); mType = getParam(8, 4); - mMaxHeight = getParam(27, 6) * 100.0f; + mMaxHeight = getParam(27, 5) * 100.0f; // "== Maximum height %f ==\n" OS_REPORT("== 最大の高さ %f ==\n", mMaxHeight); @@ -180,16 +182,27 @@ cPhs__Step daWtPillar_c::create() { OS_REPORT("== 水中にある (%f) (%f) type:%d ==\n", mMaxHeight, mRelativeWaterHeight, mType); } - mEffectOscillationAngleStep = mPillarIsPreparingToRise = mStartedRisingOrDoesNotRiseAndFall = field_0xB44 = 0; - mEffectOscillationVerticalOffset.set(0.0f, 0.0f, 0.0f); - mCurrentHeight = mEffectOscillationMinDecay = mEffectOscillationMaxDecay = mEffectOscillationDampingScale = mEffectOscillationAngle = mEffectOscillationAmplitude = 0.0f; + field_0xB44 = 0; + mStartedRisingOrDoesNotRiseAndFall = 0; + mPillarIsPreparingToRise = 0; + mEffectOscillationAngleStep = 0; + mEffectOscillationVerticalOffset.x = 0.0f; + mEffectOscillationVerticalOffset.y = 0.0f; + mEffectOscillationVerticalOffset.z = 0.0f; + mEffectOscillationAmplitude = 0.0f; + mEffectOscillationAngle = 0.0f; + mEffectOscillationDampingScale = 0.0f; + mEffectOscillationMaxDecay = 0.0f; + mEffectOscillationMinDecay = 0.0f; + mCurrentHeight = 0.0f; if(mSwitchNo != 0xFF) { actionSwWaitInit(); } else if(mType == STATIC) { mCurrentHeight = mMaxHeight; - mStartedRisingOrDoesNotRiseAndFall = field_0xB44 = true; + field_0xB44 = true; + mStartedRisingOrDoesNotRiseAndFall = true; actionRockWaitInit(); } else { diff --git a/src/d/actor/d_a_tag_statue_evt.cpp b/src/d/actor/d_a_tag_statue_evt.cpp index cf561f103c..00aacbd199 100644 --- a/src/d/actor/d_a_tag_statue_evt.cpp +++ b/src/d/actor/d_a_tag_statue_evt.cpp @@ -69,7 +69,7 @@ static char* l_evArcName[6] = { "cs_ev_05" // Ruined Theatre }; -static Vec l_cull_box[2] = { +static cull_box l_cull_box = { {-300.0f, -100.0f, -300.0f}, // Min {300.0f, 400.0f, 300.0f} // Max }; @@ -98,7 +98,7 @@ cPhs__Step daTagStatue_c::Create() { initBaseMtx(); fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); - fopAcM_setCullSizeBox(this, l_cull_box[0].x, l_cull_box[0].y, l_cull_box[0].z, l_cull_box[1].x, l_cull_box[1].y, l_cull_box[1].z); + fopAcM_setCullSizeBox(this, l_cull_box.min.x, l_cull_box.min.y, l_cull_box.min.z, l_cull_box.max.x, l_cull_box.max.y, l_cull_box.max.z); char* ev_arc_name = l_evArcName[mSkyCharacterEventBitIdIndex];