From 445abf5629db2a3a7fef0cfea70461f6ce3d622d Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Tue, 25 Aug 2026 14:38:49 -0400 Subject: [PATCH] himo3 OK --- configure.py | 2 +- include/d/actor/d_a_himo3.h | 7 +--- include/d/d_path.h | 2 +- src/d/actor/d_a_himo3.cpp | 81 +++++++++++++++++++------------------ src/d/actor/d_a_ship.cpp | 6 +-- 5 files changed, 49 insertions(+), 49 deletions(-) diff --git a/configure.py b/configure.py index 22427f24f..e1006c300 100755 --- a/configure.py +++ b/configure.py @@ -1556,7 +1556,7 @@ config.libs = [ ActorRel(Matching, "d_a_fallrock"), ActorRel(Matching, "d_a_ff"), ActorRel(Matching, "d_a_gy_ctrl"), - ActorRel(Equivalent, "d_a_himo3"), + ActorRel(Matching, "d_a_himo3"), ActorRel(Matching, "d_a_hmlif"), ActorRel(Matching, "d_a_hys"), ActorRel(Equivalent, "d_a_kamome"), # fpr regalloc diff --git a/include/d/actor/d_a_himo3.h b/include/d/actor/d_a_himo3.h index ac4ed1b06..ba22885e8 100644 --- a/include/d/actor/d_a_himo3.h +++ b/include/d/actor/d_a_himo3.h @@ -17,9 +17,7 @@ struct h3_ga_s { /* 0x00 */ J3DModel* mpModel; /* 0x04 */ cXyz mPos; /* 0x04 */ cXyz m10; - /* 0x1C */ s16 m1C; - /* 0x1E */ s16 m1E; - /* 0x20 */ u8 m20[0x24 - 0x20]; + /* 0x1C */ csXyz m1C; /* 0x24 */ f32 m24; /* 0x28 */ f32 m28; /* 0x2C */ s16 m2C; @@ -91,8 +89,7 @@ public: /* 0x2110 */ u8 m2110; /* 0x2111 */ u8 m2111; /* 0x2114 */ h3_ga_s m2114[1]; - /* 0x2144 */ J3DLightObj m2144; - /* 0x21B8 */ u8 m2178[0x21F4 - 0x21B8]; + /* 0x2144 */ dKy_tevstr_c m2144; /* 0x21F4 */ cXyz m21F4; /* 0x2200 */ s16 m2200; }; // size = 0x2204 diff --git a/include/d/d_path.h b/include/d/d_path.h index 9c83e611d..782bc3fc3 100644 --- a/include/d/d_path.h +++ b/include/d/d_path.h @@ -9,7 +9,7 @@ struct dPnt { /* 0x01 */ u8 mArg1; /* 0x02 */ u8 mArg2; /* 0x03 */ u8 mArg3; - /* 0x04 */ cXyz m_position; + /* 0x04 */ Vec m_position; }; struct dPath { diff --git a/src/d/actor/d_a_himo3.cpp b/src/d/actor/d_a_himo3.cpp index 210d174b9..5d9f1d3ee 100644 --- a/src/d/actor/d_a_himo3.cpp +++ b/src/d/actor/d_a_himo3.cpp @@ -48,20 +48,21 @@ static bool hio_set; static himo3HIO_c l_HIO; /* 000000EC-00000C58 .text himo3_control__FP11himo3_classP7himo3_s */ -void himo3_control(himo3_class* i_this, himo3_s* r31) { - /* Nonmatching - regalloc */ +static void himo3_control(himo3_class* i_this, himo3_s* r31) { fopAc_ac_c* actor = &i_this->actor; daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); - int i = 1; + int i; + cXyz spAC; cXyz spA0; cXyz sp94; - f32 tmp200; - f32 tmpReg; f32 f28; + f32 tmpReg; + f32 tmp200; f32 f27; - r31 += 1; + i = 1; + r31++; if (i_this->m02BE != 0) { s16 target; @@ -83,15 +84,15 @@ void himo3_control(himo3_class* i_this, himo3_s* r31) { cXyz sp88 = spAC - actor->current.pos; f32 sqrt = sp88.abs(); - int iVar8 = sqrt / HIMO3_SCALE; - f28 = sqrt / HIMO3_SCALE - iVar8; - if (iVar8 >= i_this->m15C0 - 1) { - iVar8 = i_this->m15C0 - 1; + int iVar8_2 = sqrt / HIMO3_SCALE; + f28 = sqrt / HIMO3_SCALE - iVar8_2; + if (iVar8_2 >= i_this->m15C0 - 1) { + iVar8_2 = i_this->m15C0 - 1; } - if (iVar8 > 1) { - for (i = 1; i < iVar8; i++, r31++) { - f32 fVar12 = (f32)i / (iVar8 - 1); + if (iVar8_2 > 1) { + for (i = 1; i < iVar8_2; i++, r31++) { + f32 fVar12 = (f32)i / (iVar8_2 - 1); r31->m00.x = actor->current.pos.x + sp88.x * fVar12; r31->m00.y = actor->current.pos.y + sp88.y * fVar12; r31->m00.z = actor->current.pos.z + sp88.z * fVar12; @@ -120,7 +121,7 @@ void himo3_control(himo3_class* i_this, himo3_s* r31) { cLib_addCalc2(&i_this->m15E4, 0.1f, 1.0f, 0.05f); } - if (fopAcM_GetParam(i_this) == 3) { + if (fopAcM_GetParam(actor) == 3) { i_this->m02BE = 0; i_this->m02BC = 0x1e; i_this->m15E0 = 0.0f; @@ -136,7 +137,7 @@ void himo3_control(himo3_class* i_this, himo3_s* r31) { i_this->m15DC += tmp; cLib_addCalc0(&i_this->m15D8, 0.05f, DEMO_SELECT(REG0_F(9) + 1.0f, 1.0f)); - if (fopAcM_GetParam(i_this) == 1) { + if (fopAcM_GetParam(actor) == 1) { i_this->m02BE = 1; i_this->m15E0 = 1.0f; if (strcmp(dComIfGp_getStartStageName(), "majroom") == 0 || strcmp(dComIfGp_getStartStageName(), "Majroom") == 0 || @@ -144,7 +145,7 @@ void himo3_control(himo3_class* i_this, himo3_s* r31) { { dComIfGs_onEventBit(dSv_event_flag_c::UNK_0402); } - } else if (fopAcM_GetParam(i_this) == 2) { + } else if (fopAcM_GetParam(actor) == 2) { i_this->m02BE = 2; i_this->m15E0 = 1.0f; } @@ -193,7 +194,10 @@ void himo3_control(himo3_class* i_this, himo3_s* r31) { spA0.y = 0.0f; tmp200 = DEMO_SELECT(REG0_F(8) + -200.0f, -200.0f); - int j = 0; + s16 unaff_r24; + s16 unaff_r23; + int j; + j = 0; if ((i_this->m02BE == 0) && (i_this->m02BC == 0)) { f27 = DEMO_SELECT(REG0_F(2) + 30.0f + 20.0f - 20.0f, 30.0f); @@ -201,8 +205,6 @@ void himo3_control(himo3_class* i_this, himo3_s* r31) { f27 = -200.0f; } - s16 unaff_r24; - s16 unaff_r23; u8 bVar4 = 0; for (; i < i_this->m15C0; i++, r31++) { @@ -216,7 +218,7 @@ void himo3_control(himo3_class* i_this, himo3_s* r31) { f29_f26_f25.y = r31->m00.y - r31[-1].m00.y + tmp200 + r31->m0C.y + sp60.y; f29_f26_f25.z = r31->m00.z - r31[-1].m00.z + r31->m0C.z + sp7C.z + sp64.z + sp60.z; - unaff_r24 = -cM_atan2s(f29_f26_f25.y, f29_f26_f25.z); + unaff_r24 = (s16)-cM_atan2s(f29_f26_f25.y, f29_f26_f25.z); unaff_r23 = (s16)cM_atan2s(f29_f26_f25.x + 0.0f, std::sqrtf(SQUARE(f29_f26_f25.y) + SQUARE(f29_f26_f25.z))); cMtx_XrotS(*calc_mtx, unaff_r24); cMtx_YrotM(*calc_mtx, unaff_r23); @@ -233,7 +235,7 @@ void himo3_control(himo3_class* i_this, himo3_s* r31) { r31->m0C.y = (r31->m00.y - r31->m0C.y) * tmpReg; r31->m0C.z = (r31->m00.z - r31->m0C.z) * tmpReg; - if ((i_this->m0298 == 0xf) && (i == i_this->m15C0 - 1)) { + if (i_this->m0298 == 0xf && i == i_this->m15C0 - 1) { if (i_this->m02BE == 0) { i_this->mCyl.SetC(r31->m00); } else { @@ -241,7 +243,7 @@ void himo3_control(himo3_class* i_this, himo3_s* r31) { i_this->mCyl.SetC(sp4C); } dComIfG_Ccsp()->Set(&i_this->mCyl); - } else if (((i + i_this->m02BA * 3 & 0xf) == 0) && (j < 5)) { + } else if ((i + (i_this->m02BA * 3) & 0xf) == 0 && j < 5) { i_this->mSphs[j].SetR(f27); i_this->mSphs[j].SetC(r31->m00); dComIfG_Ccsp()->Set(&i_this->mSphs[j]); @@ -249,15 +251,16 @@ void himo3_control(himo3_class* i_this, himo3_s* r31) { } } - cXyz* pcVar10 = i_this->mLineMat.getPos(0); - himo3_s* phVar11 = i_this->m02C0; - for (int i = 0; i < i_this->m15C0; i++, phVar11++, pcVar10++) { + cXyz* pcVar10; + pcVar10 = i_this->mLineMat.getPos(0); + r31 = i_this->m02C0; + for (i = 0; i < i_this->m15C0; i++, r31++, pcVar10++) { if (i_this->m15E0 >= 0.999f) { - *pcVar10 = phVar11->m00; + *pcVar10 = r31->m00; } else { - cLib_addCalc2(&pcVar10->x, phVar11->m00.x, 1.0f, i_this->m15E0 * 100.0f); - cLib_addCalc2(&pcVar10->y, phVar11->m00.y, 1.0f, i_this->m15E0 * 100.0f); - cLib_addCalc2(&pcVar10->z, phVar11->m00.z, 1.0f, i_this->m15E0 * 100.0f); + cLib_addCalc2(&pcVar10->x, r31->m00.x, 1.0f, i_this->m15E0 * 100.0f); + cLib_addCalc2(&pcVar10->y, r31->m00.y, 1.0f, i_this->m15E0 * 100.0f); + cLib_addCalc2(&pcVar10->z, r31->m00.z, 1.0f, i_this->m15E0 * 100.0f); } if ((i_this->m0298 != 0xf) && (i == i_this->m15C0 - 1)) { @@ -278,14 +281,14 @@ void himo3_control(himo3_class* i_this, himo3_s* r31) { } /* 00000C58-00000D1C .text ga_draw__FP11himo3_class */ -void ga_draw(himo3_class* i_this) { +static void ga_draw(himo3_class* i_this) { h3_ga_s* ga = &i_this->m2114[0]; for (int i = 0; i < ARRAY_SSIZE(i_this->m2114); i++, ga++) { if (ga->m2E == 1) { MtxTrans(ga->mPos.x, ga->mPos.y, ga->mPos.z, 0); - cMtx_YrotM(*calc_mtx, ga->m1E); - cMtx_XrotM(*calc_mtx, ga->m1C); + cMtx_YrotM(*calc_mtx, ga->m1C.y); + cMtx_XrotM(*calc_mtx, ga->m1C.x); MtxScale(ga->m24, ga->m24 * ga->m28, ga->m24, true); MtxTrans(0.0f, -18.0f, 0.0f, 1); ga->mpModel->setBaseTRMtx(*calc_mtx); @@ -338,7 +341,7 @@ static BOOL daHimo3_Draw(himo3_class* i_this) { } /* 00000EF8-00001108 .text ga_move__FP11himo3_class */ -void ga_move(himo3_class* i_this) { +static void ga_move(himo3_class* i_this) { cXyz sp30(0.0f, 0.0f, 10.0f); cXyz sp24; @@ -353,10 +356,10 @@ void ga_move(himo3_class* i_this) { } cXyz sp0C = i_this->m2114[0].m10 - i_this->m2114[0].mPos; - cLib_addCalcAngleS2(&i_this->m2114[0].m1E, cM_atan2s(sp0C.x, sp0C.z), 2, 0x1000); - cLib_addCalcAngleS2(&i_this->m2114[0].m1C, -cM_atan2s(sp0C.y, std::sqrtf(SQUARE(sp0C.x) + SQUARE(sp0C.z))), 2, 0x1000); - cMtx_YrotS(*calc_mtx, i_this->m2114[0].m1E); - cMtx_XrotM(*calc_mtx, i_this->m2114[0].m1C); + cLib_addCalcAngleS2(&i_this->m2114[0].m1C.y, cM_atan2s(sp0C.x, sp0C.z), 2, 0x1000); + cLib_addCalcAngleS2(&i_this->m2114[0].m1C.x, -cM_atan2s(sp0C.y, std::sqrtf(SQUARE(sp0C.x) + SQUARE(sp0C.z))), 2, 0x1000); + cMtx_YrotS(*calc_mtx, i_this->m2114[0].m1C.y); + cMtx_XrotM(*calc_mtx, i_this->m2114[0].m1C.x); MtxPosition(&sp30, &sp24); i_this->m2114[0].mPos += sp24; i_this->m2114[0].m28 = cM_ssin(i_this->m2114[0].m2C); @@ -371,7 +374,7 @@ void himo3_class::setActorHang(cXyz arg1, short arg2) { } /* 00001128-000014F8 .text path_move__FP11himo3_class */ -void path_move(himo3_class* i_this) { +static void path_move(himo3_class* i_this) { fopAc_ac_c* actor = &i_this->actor; cXyz sp28; cXyz sp10; @@ -607,7 +610,7 @@ static BOOL daHimo3_Delete(himo3_class* i_this) { } /* 00001AE0-00001DD4 .text useHeapInit__FP11himo3_class */ -cPhs_State useHeapInit(himo3_class* i_this) { +static cPhs_State useHeapInit(himo3_class* i_this) { fopAc_ac_c* actor = &i_this->actor; static int hook_bmd[] = {dRes_INDEX_HIMO3_BMD_SLAMP_00_e, dRes_INDEX_LINK_BDL_ROPEEND_e, dRes_INDEX_HIMO3_BMD_SLAMP_00_e, dRes_INDEX_HIMO3_BMD_SLAMP_00_e, dRes_INDEX_HIMO3_BMD_SLAMP_00_e}; diff --git a/src/d/actor/d_a_ship.cpp b/src/d/actor/d_a_ship.cpp index f3384bb1e..723dcbe8b 100644 --- a/src/d/actor/d_a_ship.cpp +++ b/src/d/actor/d_a_ship.cpp @@ -991,9 +991,9 @@ void daShip_c::setYPos() { BOOL daShip_c::checkOutRange() { dPnt* pnt; dPath* path; - cXyz* closestPoint; - cXyz* nextPoint; - cXyz* prevPoint; + Vec* closestPoint; + Vec* nextPoint; + Vec* prevPoint; int lastIndex; int closestIndex; int pathIndex;