d_a_bmdhand - 99% matching (#885)

Co-authored-by: ‎ ‎ ‎ <‎ ‎ ‎>
This commit is contained in:
123456789758
2025-09-09 12:26:53 -04:00
committed by GitHub
parent c3fdf89c3a
commit bac5c4a4f8
4 changed files with 848 additions and 192 deletions
+42 -11
View File
@@ -1,19 +1,50 @@
#ifndef D_A_BMDHAND_H
#define D_A_BMDHAND_H
#include "d/d_cc_d.h"
#include "f_op/f_op_actor.h"
#include "m_Do/m_Do_ext.h"
class bmdhand_class : public fopAc_ac_c {
public:
/* Place member variables here */
};
struct hand_s {
/* 0x00 */ cXyz m00;
/* 0x0C */ u8 m0C[0x18 - 0x0C];
/* 0x18 */ f32 m18;
}; // Size: 0x1C
class daBmdhand_HIO_c {
public:
daBmdhand_HIO_c();
public:
/* Place member variables here */
};
struct bmdhand_class {
/* 0x000 */ fopEn_enemy_c actor;
/* 0x2AC */ request_of_phase_process_class m2AC;
/* 0x2B4 */ mDoExt_McaMorf* m2B4;
/* 0x2B8 */ s16 m2B8;
/* 0x2BA */ s16 m2BA;
/* 0x2BC */ s16 m2BC;
/* 0x2BE */ s16 m2BE;
/* 0x2C0 */ s16 m2C0[4];
/* 0x2C8 */ s16 m2C8;
/* 0x2CA */ s16 m2CA;
/* 0x2CC */ cXyz m2CC;
/* 0x2D8 */ cXyz m2D8;
/* 0x2E4 */ cXyz m2E4;
/* 0x2F0 */ cXyz m2F0;
/* 0x2FC */ f32 m2FC;
/* 0x300 */ s16 m300;
/* 0x302 */ s16 m302;
/* 0x304 */ s8 m304;
/* 0x305 */ u8 m305[0x308 - 0x305];
/* 0x30C */ f32 m308;
/* 0x30C */ f32 m30C;
/* 0x310 */ f32 m310;
/* 0x314 */ f32 m314;
/* 0x318 */ f32 m318;
/* 0x31C */ f32 m31C;
/* 0x320 */ f32 m320;
/* 0x324 */ hand_s m324[20];
/* 0x554 */ mDoExt_3DlineMat1_c m554;
/* 0x590 */ dCcD_Stts m590;
/* 0x5CC */ dCcD_Sph m5CC;
/* 0x6F8 */ dCcD_Sph m6F8;
/* 0x824 */ u8 m824;
/* 0x825 */ u8 m825[0x828 - 0x825];
}; // Size: 0x828
#endif /* D_A_BMDHAND_H */
+1 -1
View File
@@ -554,7 +554,7 @@ public:
BOOL checkBowMiniGame() const { return mDemo.getDemoMode() == daPy_demo_c::DEMO_BOW_MINIGAME_e; }
void checkSoupPowerUp() const {}
void checkSubjectAccept() const {}
BOOL getRopeJumpLand() const { return checkResetFlg0(daPyRFlg0_UNK200); }
u32 getRopeJumpLand() const { return checkResetFlg0(daPyRFlg0_UNK200); }
BOOL checkRopeForceEnd() const { return checkResetFlg0(daPyRFlg0_UNK40000000); }
virtual MtxP getLeftHandMatrix() = 0;
+693 -44
View File
@@ -1,102 +1,682 @@
/**
* d_a_bmdhand.cpp
* Boss - Kalle Demos (ceiling tentacles)
* Boss - Kalle Demos (ceiling tentacles) / 森ボス触手 (Forest boss tentacle)
*/
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_bmdhand.h"
#include "d/d_s_play.h"
#include "d/res/res_bmdhand.h"
#include "d/actor/d_a_bmd.h"
#include "d/d_procname.h"
#include "d/d_priority.h"
#include "d/d_cc_d.h"
class daBmdhand_HIO_c : public JORReflexible {
public:
daBmdhand_HIO_c();
virtual ~daBmdhand_HIO_c() {};
public:
/* 0x04 */ s8 mNo;
/* 0x05 */ u8 m05[0x08 - 0x05];
/* 0x06 */ f32 m08;
/* 0x0C */ s16 m0C;
};
/* 000000EC-00000118 .text __ct__15daBmdhand_HIO_cFv */
daBmdhand_HIO_c::daBmdhand_HIO_c() {
/* Nonmatching */
mNo = 0xFF;
m08 = -20.0f;
m0C = 1000;
}
static bmd_class* boss;
static bool hio_set;
static daBmdhand_HIO_c l_HIO;
static s32 boss_joint_d[] = {0x1C, 0x1C, 0x1C, 0x1C, 0x25, 0x25, 0x25, 0x25, 0x2E, 0x2E, 0x2E, 0x2E, 0x40, 0x40, 0x40, 0x40, 0x37, 0x37, 0x37, 0x37};
static f32 boss_joint_xad[] = {60.0f, 20.0f, -20.0f, -60.0f};
/* 00000118-000001CC .text hand_draw__FP13bmdhand_class */
void hand_draw(bmdhand_class*) {
/* Nonmatching */
void hand_draw(bmdhand_class* i_this) {
fopAc_ac_c* actor = &i_this->actor;
if (i_this->m320 > 0.01f) {
g_env_light.setLightTevColorType(i_this->m2B4->getModel(), &actor->tevStr);
i_this->m2B4->updateDL();
}
GXColor local_18 = {0xFF, 0xFF, 0xFF, 0xFF};
i_this->m554.update(0x14, local_18, &actor->tevStr);
dComIfGd_set3DlineMat(&i_this->m554);
}
/* 000001CC-0000022C .text daBmdhand_Draw__FP13bmdhand_class */
static BOOL daBmdhand_Draw(bmdhand_class*) {
/* Nonmatching */
static BOOL daBmdhand_Draw(bmdhand_class* i_this) {
fopAc_ac_c* actor = &i_this->actor;
if (i_this->m310 > 0.1f) {
g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &actor->eyePos, &actor->tevStr);
hand_draw(i_this);
}
return TRUE;
}
/* 0000022C-00000310 .text hand_mtx_set__FP13bmdhand_class */
void hand_mtx_set(bmdhand_class*) {
/* Nonmatching */
void hand_mtx_set(bmdhand_class* i_this) {
f32 x;
MtxTrans(i_this->m2F0.x, i_this->m2F0.y, i_this->m2F0.z, false);
mDoMtx_XrotM(*calc_mtx, i_this->m300);
mDoMtx_YrotM(*calc_mtx, i_this->m302);
mDoMtx_XrotM(*calc_mtx, REG12_S(1) + -0x4000);
x = i_this->m320;
MtxScale(x, x, x, true);
MtxTrans(0.0f, REG12_F(3) + -130.0f, 0.0f, true);
i_this->m2B4->getModel()->setBaseTRMtx(*calc_mtx);
}
/* 00000310-00000388 .text control3__FP13bmdhand_class */
void control3(bmdhand_class*) {
/* Nonmatching */
void control3(bmdhand_class* i_this) {
hand_s* phVar1 = &i_this->m324[0];
for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m324); i++, phVar1++) {
if (i < 10) {
phVar1->m18 = 10.5f;
} else {
phVar1->m18 = (15.0f - (s32)(i - 10U)) * 0.7f;
}
}
}
/* 00000388-000006E4 .text control1__FP13bmdhand_class */
void control1(bmdhand_class*) {
/* Nonmatching */
void control1(bmdhand_class* i_this) {
fopAc_ac_c* actor = &i_this->actor;
f32 dVar8;
f32 dVar10;
f32 dVar7;
i_this->m324[0].m00 = actor->current.pos;
s32 i = 1;
hand_s* phVar5 = &i_this->m324[1];
mDoMtx_YrotS(*calc_mtx, actor->current.angle.y);
cXyz local_94;
cXyz cStack_a0;
cXyz local_ac;
local_94.x = 0.0f;
local_94.y = i_this->m314;
local_94.z = i_this->m318;
MtxPosition(&local_94, &local_ac);
cLib_addCalc2(&i_this->m314, REG0_F(7) + -10.0f, 1.0f, 0.1f);
cLib_addCalc2(&i_this->m318, REG0_F(8) + 50.0f, 1.0f, 1.0f);
local_94.z = i_this->m310;
f32 dVar9 = i_this->m31C;
cXyz local_c4;
for (i = 1; i < 0x13; i++, ++phVar5) {
local_c4.x = (dVar9 * cM_ssin(i_this->m2B8 * (REG0_S(5) + 0x44c) + i * (REG0_S(6) + 4000)));
local_c4.z = (dVar9 * cM_scos(i_this->m2B8 * (REG0_S(7) + 800) + i * (REG0_S(8) + 4000)));
f32 fVar1 = (i < 15) ? 1.0f : 1.0f - (i - 15) * 0.2f;
dVar8 = phVar5->m00.x - phVar5[-1].m00.x + (local_ac.x * fVar1) + (local_c4.x * fVar1);
dVar10 = phVar5->m00.y - phVar5[-1].m00.y + local_ac.y;
dVar7 = phVar5->m00.z - phVar5[-1].m00.z + (local_ac.z * fVar1) + (local_c4.z * fVar1);
s16 iVar4;
int iVar3 = cM_atan2s(dVar8, dVar7);
iVar4 = -cM_atan2s(dVar10, std::sqrtf((dVar8 * dVar8) + (dVar7 * dVar7)));
mDoMtx_YrotS(*calc_mtx, iVar3);
mDoMtx_XrotM(*calc_mtx, iVar4);
MtxPosition(&local_94, &cStack_a0);
phVar5->m00 = phVar5[-1].m00 + cStack_a0;
}
}
/* 000006E4-00000A1C .text control2__FP13bmdhand_class */
void control2(bmdhand_class*) {
/* Nonmatching */
void control2(bmdhand_class* i_this) {
cXyz local_7c;
cXyz cStack_88;
local_7c.x = 0.0f;
local_7c.y = 0.0f;
local_7c.z = i_this->m310;
cLib_addCalc2(&i_this->m324[0x13].m00.x, (i_this->m2D8).x, 1.0f, i_this->m30C * 50.0f);
cLib_addCalc2(&i_this->m324[0x13].m00.y, (i_this->m2D8).y, 1.0f, i_this->m30C * 50.0f);
cLib_addCalc2(&i_this->m324[0x13].m00.z, (i_this->m2D8).z, 1.0f, i_this->m30C * 50.0f);
cLib_addCalc2(&i_this->m30C, 1.0f, 1.0f, 0.01f);
s32 i = 0x12;
s16 iVar4;
int iVar3;
hand_s* phVar5 = &i_this->m324[0x12];
for (i = 0x12; i >= 1; i--, phVar5--) {
f32 fVar1 = phVar5->m00.x - phVar5[1].m00.x;
f32 dVar9 = ((phVar5->m00.y - phVar5[1].m00.y) - 10.0f);
f32 fVar2 = phVar5->m00.z - phVar5[1].m00.z;
iVar3 = cM_atan2s(fVar1, fVar2);
iVar4 = -cM_atan2s(dVar9, std::sqrtf((fVar1 * fVar1) + (fVar2 * fVar2)));
mDoMtx_YrotS(*calc_mtx, iVar3);
mDoMtx_XrotM(*calc_mtx, iVar4);
if (i == 0x12) {
local_7c.z = i_this->m310 + 70.0f + REG12_F(6);
} else {
local_7c.z = i_this->m310;
}
MtxPosition(&local_7c, &cStack_88);
phVar5->m00 = phVar5[1].m00 + cStack_88;
}
i_this->m2F0 = i_this->m324[0x13].m00;
local_7c = i_this->m324[0x12].m00 - i_this->m324[0x13].m00;
i_this->m300 = -cM_atan2s(local_7c.y, local_7c.z);
i_this->m302 = cM_atan2s(local_7c.x, std::sqrtf(local_7c.y * local_7c.y + local_7c.z * local_7c.z));
hand_mtx_set(i_this);
}
/* 00000A1C-00000EFC .text cut_control__FP13bmdhand_class */
void cut_control(bmdhand_class*) {
/* Nonmatching */
void cut_control(bmdhand_class* i_this) {
/* Nonmatching - regalloc */
fopAc_ac_c* actor = &i_this->actor;
f32 fVar1;
f32 fVar2;
f32 fVar3;
f32 dVar8;
f32 dVar9;
f32 dVar10;
f32 dVar11;
cXyz local_e8;
cXyz cStack_f4;
cXyz local_100;
cXyz local_110;
cXyz local_124;
i_this->m324[0].m00 = actor->current.pos;
hand_s* pcVar6 = &i_this->m324[1];
mDoMtx_YrotS(*calc_mtx, actor->current.angle.y);
local_e8.x = 0.0f;
local_e8.y = i_this->m314;
local_e8.z = i_this->m318;
MtxPosition(&local_e8, &local_100);
cLib_addCalc2(&i_this->m314, REG14_F(7) + -3.0f, 1.0f, REG12_F(4) + 0.1f);
cLib_addCalc2(&i_this->m318, REG14_F(8) + 20.0f + 10.0f, 1.0f, REG12_F(5) + 0.2f);
cLib_addCalc0(&i_this->m31C, (REG12_F(6) + 1.0f), 1.0f);
local_e8.z = i_this->m310;
dVar9 = (REG7_F(10) + 0.5f);
for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m324); i++, pcVar6++) {
local_124.x = i_this->m31C * cM_ssin(i_this->m2B8 * (REG0_S(4) + 0xdac) + i * (REG0_S(5) + 4000));
local_124.y = i_this->m31C * cM_scos(i_this->m2B8 * (REG0_S(6) + 4000) + i * (REG0_S(7) + 4000));
local_124.z = i_this->m31C * cM_scos(i_this->m2B8 * (REG0_S(8) + 0xed8) + i * (REG0_S(9) + 4000));
f32 factor = 1.0f - i * (REG0_F(9) + 0.03763158f);
local_110.x = local_100.x * factor;
local_110.z = local_100.z * factor;
fVar2 = pcVar6[1].m00.x + local_124.x + (local_110.x + (pcVar6->m00.x - pcVar6[-1].m00.z));
dVar11 = fVar2;
fVar3 = pcVar6[1].m00.y + (local_124.y + pcVar6->m00.y + local_100.y);
fVar1 = (5.0f + boss->m328);
if (fVar3 < fVar1) {
fVar3 = fVar1;
}
dVar10 = (fVar3 - pcVar6[-1].m00.x);
fVar1 = pcVar6[1].m00.z + local_124.z + (local_110.z + (pcVar6->m00.z - pcVar6[-1].m00.y));
dVar8 = fVar1;
int iVar4 = cM_atan2s(fVar2, fVar1);
s16 iVar5 = -cM_atan2s(dVar10, std::sqrtf((dVar11 * dVar11) + (dVar8 * dVar8)));
mDoMtx_YrotS(*calc_mtx, iVar4);
mDoMtx_XrotM(*calc_mtx, iVar5);
MtxPosition(&local_e8, &cStack_f4);
pcVar6[1].m00 = pcVar6->m00;
pcVar6[0].m00 = pcVar6[-1].m00 + cStack_f4;
pcVar6[1].m00.x = (dVar9 * (pcVar6->m00.x - pcVar6[1].m00.x));
pcVar6[1].m00.y = (dVar9 * (pcVar6->m00.y - pcVar6[1].m00.y));
pcVar6[1].m00.z = (dVar9 * (pcVar6->m00.z - pcVar6[1].m00.z));
if ((i == 0x13) && (i_this->m2CA != 0)) {
dComIfGp_particle_setSimple(dPa_name::ID_SCENE_8067, &pcVar6->m00, 0xFF, g_whiteColor, g_whiteColor, 0);
}
}
}
/* 00000EFC-00000FAC .text cut_control3__FP13bmdhand_class */
void cut_control3(bmdhand_class*) {
/* Nonmatching */
void cut_control3(bmdhand_class* i_this) {
hand_s* phVar1 = &i_this->m324[0];
for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m324); i++, phVar1++) {
if (i < 10) {
phVar1->m18 = 10.5f;
} else {
phVar1->m18 = (15.0f - (s32)(i - 10U)) * 0.7f;
}
}
cLib_addCalc2(&i_this->m2F0.y, i_this->m2CC.y, 1.0f, 10.0f);
hand_mtx_set(i_this);
}
/* 00000FAC-000012DC .text start_control1__FP13bmdhand_class */
void start_control1(bmdhand_class*) {
/* Nonmatching */
void start_control1(bmdhand_class* i_this) {
fopAc_ac_c* actor = &i_this->actor;
f32 fVar1;
f32 fVar2;
f32 dVar10;
cXyz local_94;
cXyz cStack_a0;
cXyz local_ac;
cXyz local_c4;
i_this->m324[0].m00 = actor->current.pos;
s32 i = 1;
hand_s* phVar5 = &i_this->m324[i];
mDoMtx_YrotS(*calc_mtx, actor->current.angle.y);
local_94.x = 0.0f;
local_94.y = i_this->m314;
local_94.z = i_this->m318;
MtxPosition(&local_94, &local_ac);
cLib_addCalc2(&i_this->m314, REG0_F(7), 1.0f, 0.1f);
cLib_addCalc2(&i_this->m318, REG0_F(8) + 5.0f, 1.0f, 1.0f);
local_94.z = i_this->m310;
f32 dVar9 = i_this->m31C;
for (i = 1; i < 0x13; i++, phVar5++) {
local_c4.x = (dVar9 * cM_ssin(i_this->m2B8 * (REG0_S(5) + 0x640) + i * (REG0_S(6) + 3000)));
local_c4.y = (dVar9 * cM_ssin(i_this->m2B8 * (REG0_S(5) + 0x6a4) + i * (REG0_S(6) + 4000)));
local_c4.z = (dVar9 * cM_scos(i_this->m2B8 * (REG0_S(7) + 0x578) + i * (REG0_S(8) + 0xdac)));
fVar1 = local_c4.x + (local_ac.x + (phVar5->m00.x - phVar5[-1].m00.x));
dVar10 = local_c4.y + (local_ac.y + (phVar5->m00.y - phVar5[-1].m00.y));
fVar2 = local_c4.z + (local_ac.z + (phVar5->m00.z - phVar5[-1].m00.z));
s16 iVar4;
int iVar3 = cM_atan2s(fVar1, fVar2);
iVar4 = -cM_atan2s(dVar10, std::sqrtf((fVar1 * fVar1) + (fVar2 * fVar2)));
mDoMtx_YrotS(*calc_mtx, iVar3);
mDoMtx_XrotM(*calc_mtx, iVar4);
MtxPosition(&local_94, &cStack_a0);
phVar5->m00 = phVar5[-1].m00 + cStack_a0;
}
}
/* 000012DC-0000158C .text start_control2__FP13bmdhand_class */
void start_control2(bmdhand_class*) {
/* Nonmatching */
void start_control2(bmdhand_class* i_this) {
cXyz local_7c;
cXyz cStack_88;
local_7c.x = 0.0f;
local_7c.y = 0.0f;
local_7c.z = i_this->m310;
i_this->m324[0x13].m00 = (i_this->m2D8);
s32 i = 0x12;
s16 iVar4;
int iVar3;
hand_s* phVar5 = &i_this->m324[i];
for (i = 0x12; i >= 1; i--, phVar5--) {
f32 fVar1 = phVar5->m00.x - phVar5[1].m00.x;
f32 dVar9 = ((phVar5->m00.y - phVar5[1].m00.y) - 5.0f);
f32 fVar2 = phVar5->m00.z - phVar5[1].m00.z;
iVar3 = cM_atan2s(fVar1, fVar2);
iVar4 = -cM_atan2s(dVar9, std::sqrtf((fVar1 * fVar1) + (fVar2 * fVar2)));
mDoMtx_YrotS(*calc_mtx, iVar3);
mDoMtx_XrotM(*calc_mtx, iVar4);
MtxPosition(&local_7c, &cStack_88);
phVar5->m00 = phVar5[1].m00 + cStack_88;
}
i_this->m2F0 = i_this->m324[0x13].m00;
local_7c = i_this->m324[0x12].m00 - i_this->m324[0x13].m00;
i_this->m300 = -cM_atan2s(local_7c.y, local_7c.z);
i_this->m302 = cM_atan2s(local_7c.x, std::sqrtf(local_7c.y * local_7c.y + local_7c.z * local_7c.z));
hand_mtx_set(i_this);
}
/* 0000158C-0000161C .text hand_close__FP13bmdhand_class */
void hand_close(bmdhand_class*) {
/* Nonmatching */
void hand_close(bmdhand_class* i_this) {
J3DAnmTransform* pAnimRes;
pAnimRes = (J3DAnmTransform*)dComIfG_getObjectRes("Bmdhand", BMDHAND_BCK_FOOK_TOJIRU);
i_this->m2B4->setAnm(pAnimRes, 0, REG0_F(6) + 5.0f, 1.0f, 0.0f, -1.0f, NULL);
}
/* 0000161C-000016AC .text hand_open__FP13bmdhand_class */
void hand_open(bmdhand_class*) {
/* Nonmatching */
void hand_open(bmdhand_class* i_this) {
J3DAnmTransform* pAnimRes;
pAnimRes = (J3DAnmTransform*)dComIfG_getObjectRes("Bmdhand", BMDHAND_BCK_FOOK_HIRAKU);
i_this->m2B4->setAnm(pAnimRes, 0, REG0_F(6) + 5.0f, 1.0f, 0.0f, -1.0f, NULL);
}
/* 000016AC-00001D30 .text hand_calc__FP13bmdhand_class */
void hand_calc(bmdhand_class*) {
/* Nonmatching */
void hand_calc(bmdhand_class* i_this) {
/* Nonmatching - swapped fadds instruction */
fopAc_ac_c* actor = &i_this->actor;
f32 dVar6;
f32 fVar7;
cXyz local_b8;
cXyz local_c4;
local_b8.y = 0.0f;
local_b8.x = 0.0f;
if ((i_this->m2B8 & 0xfU) == 0) {
dBgS_LinChk local_ac;
cXyz local_d0(i_this->m2D8);
cXyz local_dc(local_d0);
local_dc.y = local_d0.y + 2500.0f;
local_ac.Set(&local_d0, &local_dc, actor);
if (dComIfG_Bgsp()->LineCross(&local_ac)) {
i_this->m2CC = local_ac.GetCross();
i_this->m2CC.y += l_HIO.m08;
}
}
switch (i_this->m2BC) {
case 0:
mDoMtx_YrotS(*calc_mtx, actor->current.angle.y);
if ((actor->base.mParameters & 1U) == 0) {
local_b8.z = REG0_F(9) + 250.0f;
} else {
local_b8.z = REG0_F(10) + 350.0f;
}
MtxPosition(&local_b8, &local_c4);
i_this->m2D8 = actor->current.pos + local_c4;
i_this->m2D8.y = i_this->m2CC.y;
i_this->m2E4 = i_this->m2D8;
if (i_this->m30C > 0.9f) {
if (boss->m331 < 0x14) {
boss->m331++;
}
i_this->m2BC = 1;
i_this->m2C0[0] = (s16)(cM_rndF(30.0f) + 10.0f);
mDoAud_seStart(JA_SE_CM_BKM_VINE_SET, &i_this->m2D8, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor)));
}
break;
case 1:
mDoMtx_YrotS(*calc_mtx, actor->current.angle.y);
if ((actor->base.mParameters & 1U) == 0) {
local_b8.z = REG0_F(9) + 250.0f;
} else {
local_b8.z = REG0_F(10) + 350.0f;
}
MtxPosition(&local_b8, &local_c4);
i_this->m2E4.x = actor->current.pos.x + local_c4.x;
i_this->m2E4.z = actor->current.pos.z + local_c4.z;
local_c4 = i_this->m2E4 - i_this->m2D8;
fVar7 = std::sqrtf(local_c4.x * local_c4.x + local_c4.z * local_c4.z);
if (fVar7 > REG14_F(0) + 100.0f) {
if (i_this->m2C0[0] == 0) {
i_this->m2BC = 2;
i_this->m2C0[0] = 0x28;
i_this->m308 = 0.0f;
}
} else {
i_this->m2C0[0] = (s16)cM_rndF(30.0f);
}
break;
case 2:
if (i_this->m2C0[0] <= 0x14) {
if (i_this->m2C0[0] == 0x14) {
i_this->m308 = 0.0f;
}
i_this->m2E4.y = i_this->m2CC.y;
fVar7 = 1.0f;
} else {
i_this->m2E4.y = (i_this->m2CC.y - 150.0f) + REG0_F(0xe);
fVar7 = 0.1f;
}
dVar6 = fVar7;
cLib_addCalc2(&i_this->m2D8.x, i_this->m2E4.x, fVar7, i_this->m308 * 30.0f);
cLib_addCalc2(&i_this->m2D8.z, i_this->m2E4.z, dVar6, i_this->m308 * 30.0f);
cLib_addCalc2(&i_this->m2D8.y, i_this->m2E4.y, dVar6, i_this->m308 * 30.0f);
cLib_addCalc2(&i_this->m308, 1.0f, 1.0f, 0.1f);
if (i_this->m2C0[0] == 0) {
i_this->m2BC = 1;
i_this->m2C0[0] = (s16)cM_rndF(30.0f);
}
break;
}
}
/* 00002168-000025D4 .text start_hand_calc__FP13bmdhand_class */
void start_hand_calc(bmdhand_class*) {
/* Nonmatching */
void start_hand_calc(bmdhand_class* i_this) {
/* Nonmatching - swapped fadds instruction, math */
fopAc_ac_c* actor = &i_this->actor;
cXyz local_a8;
cXyz cStack_b4;
local_a8.y = 0.0f;
local_a8.x = 0.0f;
dBgS_LinChk local_9c;
cXyz local_c0(i_this->m2D8);
cXyz local_cc(local_c0);
local_cc.y = local_c0.y + 2500.0f;
local_9c.Set(&local_c0, &local_cc, actor);
if (dComIfG_Bgsp()->LineCross(&local_9c)) {
i_this->m2CC = local_9c.GetCross();
i_this->m2CC.y += l_HIO.m08;
}
if (i_this->m2BC == 0) {
mDoMtx_YrotS(*calc_mtx, actor->current.angle.y);
f32 fVar1 = (i_this->m2E4.y - i_this->m2D8.y) * ((REG13_F(4) + 0.1f) * (REG13_F(5) + 2.0f));
local_a8.x = fVar1 * cM_ssin(i_this->m2B8 * (REG13_S(5) + 0x5dc));
local_a8.y = fVar1 * cM_scos(i_this->m2B8 * (REG13_S(7) + 500));
if ((actor->base.mParameters & 1U) == 0) {
local_a8.z = REG0_F(9) + 250.0f;
} else {
local_a8.z = REG0_F(10) + 350.0f;
}
MtxPosition(&local_a8, &cStack_b4);
i_this->m2E4 = actor->current.pos + cStack_b4;
i_this->m2E4.y = i_this->m2CC.y;
cLib_addCalc2(&i_this->m2D8.x, i_this->m2E4.x, 1.0f, i_this->m308 * 50.0f);
cLib_addCalc2(&i_this->m2D8.z, i_this->m2E4.z, 1.0f, i_this->m308 * 50.0f);
cLib_addCalc2(&i_this->m2D8.y, i_this->m2E4.y, 1.0f, i_this->m308 * 10.0f);
cLib_addCalc2(&i_this->m308, REG13_F(6) + 1.0f, 1.0f, REG13_F(7) + 0.01f);
}
}
/* 000025D4-00002E74 .text hand_move__FP13bmdhand_class */
void hand_move(bmdhand_class*) {
/* Nonmatching */
void hand_move(bmdhand_class* i_this) {
/* Nonmatching - regalloc, math */
fopAc_ac_c* actor = &i_this->actor;
f32 fVar10;
cXyz local_40;
cXyz local_4c;
cXyz local_58;
hand_s* pcVar9 = i_this->m324;
if (boss != NULL) {
actor->current.angle.y = ((u16)actor->base.mParameters & 0x1f) * -0xccc + REG8_S(4) + -13000 + boss->shape_angle.y;
MTXCopy(boss->mpMorf->mpModel->getAnmMtx(boss_joint_d[(actor->base.mParameters & 0x1fU)]), *calc_mtx);
local_40.x = REG14_F(6);
local_40.y = REG14_F(7);
local_40.z = boss_joint_xad[(actor->base.mParameters & 3U)];
MtxPosition(&local_40, &actor->current.pos);
if ((i_this->m2BA != 2) && (boss->m332 == 3)) {
i_this->m2BA = 2;
i_this->m314 = 3.0f;
i_this->m318 = 40.0f;
fVar10 = cM_rndF(20.0f);
i_this->m31C = fVar10 + 30.0f;
fVar10 = cM_rndF(30.0f);
i_this->m2C0[1] = (s16)(fVar10 + 50.0f);
}
switch (i_this->m2BA) {
case 0:
cLib_addCalc2(&i_this->m310, REG14_F(0xb) + 30.0f, 0.1f, 1.0f);
cLib_addCalc2(&i_this->m31C, REG14_F(0x11) + 50.0f + 20.0f, 0.1f, 0.5);
cLib_addCalc2(&i_this->m320, 1.0f, 1.0f, 0.01f);
hand_calc(i_this);
control1(i_this);
control2(i_this);
control3(i_this);
actor->attention_info.flags = fopAc_Attn_LOCKON_BATTLE_e;
if ((i_this->m2BC > 0) && (i_this->m5CC.ChkTgHit() || (i_this->m6F8.ChkTgHit()))) {
i_this->m2BA = 1;
fopAcM_monsSeStart(actor, JA_SE_CV_BKM_CUT_VINE_1, 0);
mDoAud_seStart(JA_SE_CM_BKM_CUT_VINE, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor)));
local_58.setall(0.5f);
dComIfGp_particle_set(dPa_name::ID_COMMON_0013, &actor->eyePos, NULL, &local_58, 0xFF);
dComIfGp_particle_set(dPa_name::ID_COMMON_0016, &actor->eyePos, NULL, &local_58, 0xFF);
if (boss->m331 > 0) {
boss->m331--;
boss->m312 = 3;
}
i_this->m2C0[0] = l_HIO.m0C;
i_this->m314 = 3.0f;
i_this->m318 = 40.0f;
fVar10 = cM_rndF(20.0f);
i_this->m31C = fVar10 + 30.0f;
i_this->m2C8 = 0x14;
}
break;
case 1:
i_this->m2C8 = 0x14;
i_this->m2CA = 2;
cLib_addCalc2(&i_this->m310, REG14_F(0xc) + 20.0f, 0.1f, 0.5f);
cut_control(i_this);
cut_control3(i_this);
if (i_this->m2C0[0] < 100) {
cLib_addCalc2(&i_this->m320, 0.0f, 1.0f, 0.01f);
}
if (i_this->m2C0[0] == 0) {
i_this->m2BA = 0;
i_this->m2BC = 0;
i_this->m30C = 0.0f;
i_this->m31C = 0.0f;
}
break;
case 2:
i_this->m2C8 = 0x14;
if (i_this->m2C0[1] == 0) {
cLib_addCalc2(&i_this->m310, REG14_F(0xc) + 20.0f, 0.1f, 0.5f);
}
if ((boss->m302 == 2) && (boss->m308[0] < 100)) {
cLib_addCalc0(&i_this->m320, 1.0f, 0.01f);
}
cut_control(i_this);
cut_control3(i_this);
if (boss->m332 == 4) {
fVar10 = cM_rndF(50.0f);
i_this->m2C0[0] = (s16)fVar10;
i_this->m2BA = 5;
i_this->m2BC = 0;
} else if (boss->m332 == 9) {
i_this->m2BA = 4;
}
break;
case 3:
switch (i_this->m2BE) {
case 0:
if (boss->m332 == 5) {
i_this->m2BE = 1;
i_this->m2E4.y = 10000.0f;
i_this->m2D8 = actor->current.pos;
i_this->m30C = 1.0f;
fVar10 = cM_rndF(50.0f);
i_this->m2C0[0] = (s16)fVar10;
}
break;
case 1:
if (i_this->m2C0[0] == 0) {
i_this->m2BE = 2;
}
break;
case 2:
if (i_this->m2E4.y - i_this->m2D8.y < 10.0f) {
boss->m331 = boss->m331 + 1;
i_this->m2BE = 3;
}
// fallthrough
case 3:
cLib_addCalc2(&i_this->m310, REG13_F(1) + 30.0f, 0.1f, REG13_F(2) + 0.5f);
cLib_addCalc2(&i_this->m31C, REG13_F(3) + 200.0f, 0.1f, 10.0f);
if (i_this->m2E4.y - i_this->m2D8.y < 800.0f) {
cLib_addCalc2(&i_this->m320, 1.0f, 1.0f, 0.02f);
}
start_hand_calc(i_this);
start_control1(i_this);
start_control2(i_this);
control3(i_this);
break;
}
if (boss->m332 == 7) {
i_this->m2BA = 0;
i_this->m2BC = 0;
}
break;
case 4:
i_this->m2C8 = 0x14;
cLib_addCalc0(&i_this->m310, 0.1f, 0.2f);
cLib_addCalc0(&i_this->m320, 1.0f, 0.01f);
cut_control(i_this);
cut_control3(i_this);
break;
case 5:
i_this->m2C8 = REG8_S(2) + 0x46;
if (i_this->m2C0[0] == 0) {
i_this->m2BA = 0;
i_this->m2BC = 0;
fVar10 = cM_rndF(0.2f);
i_this->m30C = fVar10;
i_this->m31C = 0.0f;
}
break;
}
}
cXyz* line_data = i_this->m554.getPos(0);
u8* line_size = i_this->m554.getSize(0);
for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m324); i++, pcVar9++, line_data++, line_size++) {
*line_data = pcVar9->m00;
*line_size = pcVar9->m18;
if (i == 10) {
actor->eyePos = pcVar9->m00;
actor->attention_info.position = actor->eyePos;
i_this->m5CC.SetC(actor->eyePos);
dComIfG_Ccsp()->Set(&i_this->m5CC);
} else if (i == (s32)((i_this->m2B8 & 3U) * 4 + 3)) {
i_this->m6F8.SetC(pcVar9->m00);
dComIfG_Ccsp()->Set(&i_this->m6F8);
}
}
if (i_this->m2C8 != 0) {
local_4c.x = 0.0f;
local_4c.y = -20000.0f;
local_4c.z = 0.0f;
i_this->m5CC.SetC(local_4c);
dComIfG_Ccsp()->Set(&i_this->m5CC);
i_this->m6F8.SetC(local_4c);
dComIfG_Ccsp()->Set(&i_this->m6F8);
fopAcM_OffStatus(actor, 0);
actor->attention_info.flags = 0;
}
}
/* 00002E74-00002EC0 .text s_a_d_sub__FPvPv */
void s_a_d_sub(void*, void*) {
/* Nonmatching */
void* s_a_d_sub(void* param_1, void* param_2) {
if ((fopAc_IsActor(param_1)) && (fopAcM_GetName(param_1) == PROC_BMD)) {
return param_1;
} else {
return NULL;
}
}
/* 00002EC0-00003028 .text daBmdhand_Execute__FP13bmdhand_class */
static BOOL daBmdhand_Execute(bmdhand_class*) {
/* Nonmatching */
static BOOL daBmdhand_Execute(bmdhand_class* i_this) {
if (boss == NULL) {
boss = (bmd_class*)fpcM_Search(s_a_d_sub, i_this);
}
i_this->m2B8++;
for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m2C0); i++) {
if (i_this->m2C0[i] != 0) {
i_this->m2C0[i]--;
}
}
if (i_this->m2C8 != 0) {
i_this->m2C8--;
}
if (i_this->m2CA != 0) {
i_this->m2CA--;
}
i_this->m2FC = i_this->m2F0.y;
hand_move(i_this);
f32 dVar4 = (i_this->m2CC.y - 1.0f);
if ((i_this->m2F0.y < dVar4) && (i_this->m2FC >= dVar4)) {
hand_open(i_this);
}
if ((i_this->m2F0.y > dVar4) && (i_this->m2FC <= dVar4)) {
i_this->m304 = 3;
}
if (i_this->m304 != 0) {
i_this->m304--;
if (i_this->m304 == 0) {
hand_close(i_this);
}
}
i_this->m2B4->play(NULL, 0, 0);
return TRUE;
}
/* 00003028-00003030 .text daBmdhand_IsDelete__FP13bmdhand_class */
@@ -105,23 +685,59 @@ static BOOL daBmdhand_IsDelete(bmdhand_class*) {
}
/* 00003030-000030C4 .text daBmdhand_Delete__FP13bmdhand_class */
static BOOL daBmdhand_Delete(bmdhand_class*) {
/* Nonmatching */
static BOOL daBmdhand_Delete(bmdhand_class* i_this) {
dComIfG_resDelete(&i_this->m2AC, "Bmdhand");
if (i_this->m824 != 0) {
hio_set = 0;
mDoHIO_deleteChild(l_HIO.mNo);
}
boss = NULL;
mDoAud_seDeleteObject(&i_this->m2D8);
return TRUE;
}
/* 000030C4-00003210 .text useHeapInit__FP13bmdhand_class */
void useHeapInit(bmdhand_class*) {
/* Nonmatching */
s32 useHeapInit(bmdhand_class* i_this) {
mDoExt_McaMorf* morf;
ResTIMG* pImg;
morf = new mDoExt_McaMorf(
(J3DModelData*)dComIfG_getObjectRes("Bmdhand", BMDHAND_BMD_BKM_FOOK),
NULL,
NULL,
(J3DAnmTransformKey*)dComIfG_getObjectRes("Bmdhand", BMDHAND_BCK_FOOK_HIRAKU),
J3DFrameCtrl::EMode_NONE,
1.0f,
0,
-1,
1,
NULL,
0,
0x11020203
);
i_this->m2B4 = morf;
if (i_this->m2B4->getModel() == NULL) {
return FALSE;
}
if (i_this->m2B4 == NULL) {
return FALSE;
}
pImg = (ResTIMG*)dComIfG_getObjectRes("Bmdhand", BMDHAND_BTI_SYOKUSYU_UE);
if (!i_this->m554.init(1, 0x14, pImg, 1)) {
return FALSE;
}
return TRUE;
}
/* 00003210-00003230 .text solidHeapCB__FP10fopAc_ac_c */
static BOOL solidHeapCB(fopAc_ac_c*) {
/* Nonmatching */
static BOOL solidHeapCB(fopAc_ac_c* a_this) {
bmdhand_class* i_this = (bmdhand_class*)a_this;
useHeapInit(i_this);
}
/* 00003230-000034FC .text daBmdhand_Create__FP10fopAc_ac_c */
static cPhs_State daBmdhand_Create(fopAc_ac_c*) {
/* Nonmatching */
static cPhs_State daBmdhand_Create(fopAc_ac_c* a_this) {
/* Nonmatching - .data */
static dCcD_SrcSph cc_sph_src = {
// dCcD_SrcGObjInf
{
@@ -150,6 +766,39 @@ static cPhs_State daBmdhand_Create(fopAc_ac_c*) {
/* Radius */ 100.0f,
}},
};
cPhs_State res;
fopAc_ac_c* actor = a_this;
fopAcM_SetupActor(actor, bmdhand_class);
bmdhand_class* i_this = (bmdhand_class*)a_this;
res = dComIfG_resLoad(&i_this->m2AC, "Bmdhand");
if (res == cPhs_ERROR_e) {
return cPhs_ERROR_e;
} else if (res != cPhs_COMPLEATE_e) {
return res;
}
if (!fopAcM_entrySolidHeap(actor, solidHeapCB, 0x3040)) {
return cPhs_ERROR_e;
}
if (hio_set == 0) {
hio_set = 1;
i_this->m824 = 1;
l_HIO.mNo = mDoHIO_createChild("森ボス触手", &l_HIO); // Forest boss tentacle
}
actor->health = 2;
i_this->m2B8 = (s16)cM_rndF(10000.0f);
boss = NULL;
i_this->m590.Init(0xFF, 0xFF, actor);
i_this->m5CC.Set(cc_sph_src);
i_this->m5CC.SetStts(&i_this->m590);
i_this->m5CC.SetR(110.0f);
i_this->m6F8.Set(cc_sph_src);
i_this->m6F8.SetStts(&i_this->m590);
i_this->m5CC.SetR(90.0f);
if (!(g_dComIfG_gameInfo.save.getMemory().getBit().isStageBossDemo()) && (dComIfGp_getStartStageName()[0] != 'X')) {
i_this->m2BA = 3;
}
return cPhs_COMPLEATE_e;
}
static actor_method_class l_daBmdhand_Method = {
+112 -136
View File
@@ -63,12 +63,13 @@ void spin_draw(himo2_class* param_1) {
s16 sVar2;
s16 sVar3;
s16 sVar4;
f32 fVar5;
int iVar6;
cXyz* pcVar7;
s16 sVar8;
s16 sVar9;
f32 fVar10;
int iVar11;
f32 dVar12;
cXyz local_504;
cXyz local_510;
cXyz local_51c;
@@ -76,15 +77,15 @@ void spin_draw(himo2_class* param_1) {
sVar4 = 0;
sVar2 = param_1->m2510;
local_504.y = (param_1->m217C->scale.y - 1.0f) * 8.0f;
local_504.z *= -7.0f;
fVar5 = (param_1->m217C->scale.y - 1.0f) * 8.0f;
fVar10 *= -7.0f;
fVar1 = param_1->m217C->scale.y;
if ((fopAcM_GetParam(param_1->m217C) & 0x0F) == 3) {
local_504.y += REG8_F(8) + -3.0f;
local_504.z += REG8_F(9) + 1.5f;
fVar5 += REG8_F(8) + -3.0f;
fVar10 += REG8_F(9) + 1.5f;
}
if (fVar1 < 0.7f) {
local_504.y += 3.0f;
fVar5 += 3.0f;
}
if (param_1->m251C != 0) {
sVar9 = 700;
@@ -94,8 +95,8 @@ void spin_draw(himo2_class* param_1) {
local_504.x = REG0_F(0) * 10.0f + 15.0f;
}
local_504.x = local_504.x + param_1->m24B8;
local_504.y = local_504.y + -152.5f;
local_504.z = param_1->m24B4 + 26.0f + local_504.z;
local_504.y = fVar5 + -152.5f;
local_504.z = param_1->m24B4 + 26.0f + fVar10;
mDoMtx_YrotS(*calc_mtx, sVar2);
MtxPosition(&local_504, &local_510);
local_51c.x = param_1->m217C->current.pos.x + local_510.x;
@@ -106,17 +107,14 @@ void spin_draw(himo2_class* param_1) {
local_504.z = 3.90625f;
sVar8 = -0x30d4;
pcVar7 = param_1->m1F30.mpLines->mpSegments + param_1->m1F6C;
iVar11 = 0;
iVar6 = 0;
dVar12 = -200000.0f;
cXyz local_4f8[100];
for (; iVar11 < 100; iVar11++, iVar6 += 12) {
local_4f8[iVar6].y = dVar12;
for (iVar11 = 0, iVar6 = 0; iVar11 < 100; iVar11++, iVar6 += 12) {
local_4f8[iVar6].y = -200000.0f;
if (iVar11 < 50) {
sVar3 = sVar8 + REG0_S(2) + 100;
} else if ((iVar11 >= 50) && (param_1->m24BC + 49 <= iVar11)) {
sVar3 = sVar8 + param_1->m24C8;
if (100 - (REG0_S(4) + 5) >= iVar11) {
if (iVar11 >= 100 - (REG0_S(4) + 5)) {
sVar3 = REG0_S(5) + sVar3 + -1000;
}
if ((param_1->m217C != NULL) && (fopAcM_GetParam(param_1->m217C) != 0)) {
@@ -165,7 +163,7 @@ void spin_draw(himo2_class* param_1) {
sVar8 = sVar3;
}
iVar6 = 99;
for (iVar11 = 0; iVar11 < 100; iVar11++, iVar6++) {
for (iVar11 = 0; iVar11 < 100; iVar11++, iVar6--) {
if (local_4f8[iVar6].y > -100000.0f) {
pcVar7->x = local_4f8[iVar6].x;
pcVar7->y = local_4f8[iVar6].y;
@@ -178,19 +176,12 @@ void spin_draw(himo2_class* param_1) {
/* 800EBABC-800EBCD0 .text himo2_control__FP11himo2_classP7himo2_s */
void himo2_control(himo2_class* param_1, himo2_s* param_2) {
/* Nonmatching - for loop, regalloc */
/* Nonmatching - regalloc */
f32 fVar1;
f32 fVar2;
int i;
int iVar4;
int iVar5;
himo2_s* puVar5;
f32 dVar6;
f32 dVar7;
f32 dVar8;
f32 dVar9;
cXyz local_74;
cXyz local_68;
cXyz local_74;
local_68.x = 0.0f;
local_68.y = 0.0f;
@@ -199,33 +190,28 @@ void himo2_control(himo2_class* param_1, himo2_s* param_2) {
} else {
local_68.z = param_1->m2188 * 15.625f * (REG0_F(1) + 0.0007f);
}
i = param_1->m02CC + 1;
puVar5 = param_2 + i;
dVar9 = 0.0f;
for (; i < 100; i++) {
s32 i = param_1->m02CC + 1;
himo2_s* puVar5 = param_2 + i;
for (; i < 100; i++, puVar5++) {
dVar8 = ((puVar5->m10.y + param_1->m02E4) - puVar5[-1].m10.y);
fVar1 = puVar5->m10.x - puVar5[-1].m10.x;
dVar7 = fVar1;
fVar2 = puVar5->m10.z - puVar5[-1].m10.z;
dVar6 = fVar2;
iVar4 = cM_atan2s(fVar1, fVar2);
dVar6 = std::sqrtf((dVar7 * dVar7) + (dVar6 * dVar6));
iVar5 = cM_atan2s(dVar8, dVar6);
int iVar4 = cM_atan2s(fVar1, fVar2);
s16 iVar5 = -cM_atan2s(dVar8, std::sqrtf((fVar1 * fVar1) + (fVar2 * fVar2)));
mDoMtx_YrotS(*calc_mtx, iVar4);
mDoMtx_XrotM(*calc_mtx, -iVar5);
mDoMtx_XrotM(*calc_mtx, iVar5);
MtxPosition(&local_68, &local_74);
puVar5->m10.x = puVar5[-1].m10.x + local_74.x;
puVar5->m10.y = puVar5[-1].m10.y + local_74.y;
puVar5->m10.z = puVar5[-1].m10.z + local_74.z;
puVar5++;
}
}
/* 800EBCD0-800EBFEC .text himo2_control2__FP11himo2_classP7himo2_s */
void himo2_control2(himo2_class* param_1, himo2_s* param_2) {
/* Nonmatching - for loop, regalloc */
cXyz local_b4;
cXyz local_a8;
cXyz local_b4;
local_a8.x = 0.0f;
local_a8.y = 0.0f;
@@ -239,16 +225,15 @@ void himo2_control2(himo2_class* param_1, himo2_s* param_2) {
f32 dVar8 = (REG8_F(17) + 10.0f);
int iVar4 = param_1->m02CC;
f32 dVar10 = dVar9;
for (; ++iVar4 < 100;) {
for (; iVar4 < 100; iVar4++, puVar6--) {
f32 dVar11 = (puVar6->m10.y - puVar6[1].m10.y);
int iVar3 = param_1->m02DC;
if ((iVar3 >= 0) && (iVar3 < 4)) {
if ((iVar3 >= 0) && (iVar3 <= 3)) {
if (iVar3 != 0) {
int uStack_94 = 99 - iVar4 ^ 0x80000000;
dVar8 = (param_1->m2530 * uStack_94) * 0.01f;
dVar8 = (param_1->m2530 * (s32)(99 - iVar4)) * 0.01f;
}
dVar10 = dVar8 * cM_ssin((param_1->m02D8 * (REG0_S(5) + 700) + iVar4 * (REG0_S(6) + 2000)) & 0xFFFF);
dVar9 = dVar8 * cM_scos((param_1->m02D8 * (REG0_S(7) + 500) + iVar4 * (REG0_S(8) + 2000)) & 0xFFFF);
dVar10 = dVar8 * cM_ssin(param_1->m02D8 * (REG0_S(5) + 700) + iVar4 * (REG0_S(6) + 2000));
dVar9 = dVar8 * cM_scos(param_1->m02D8 * (REG0_S(7) + 500) + iVar4 * (REG0_S(8) + 2000));
}
f32 fVar1 = dVar10 + (puVar6->m10.x - puVar6[1].m10.x);
f32 dVar7 = fVar1;
@@ -256,16 +241,15 @@ void himo2_control2(himo2_class* param_1, himo2_s* param_2) {
f32 dVar6 = fVar2;
iVar3 = cM_atan2s(fVar1, fVar2);
dVar6 = std::sqrtf((dVar7 * dVar7) + (dVar6 * dVar6));
int iVar5 = cM_atan2s(dVar11, dVar6);
s16 iVar5 = -cM_atan2s(dVar11, dVar6);
puVar6[1].m1E = iVar3;
puVar6[1].m1C = -iVar5;
puVar6[1].m1C = iVar5;
mDoMtx_YrotS(*calc_mtx, iVar3);
mDoMtx_XrotM(*calc_mtx, -iVar5);
mDoMtx_XrotM(*calc_mtx, iVar5);
MtxPosition(&local_a8, &local_b4);
puVar6->m10.x = puVar6[1].m10.x + local_b4.x;
puVar6->m10.y = puVar6[1].m10.y + local_b4.y;
puVar6->m10.z = puVar6[1].m10.z + local_b4.z;
puVar6++;
}
}
@@ -317,13 +301,16 @@ void himo2_draw(himo2_class* param_1, himo2_s* param_2) {
/* 800EC1E4-800EC300 .text himo_hang_draw__FP11himo2_class */
void himo_hang_draw(himo2_class* param_1) {
/* Nonmatching - for loop */
cXyz* pcVar3 = param_1->m1F30.mpLines->mpSegments + param_1->m1F6C;
/* Nonmatching - regalloc */
cXyz* pcVar3 = param_1->m1F30.getPos(0) + param_1->m1F6C;
cXyz local_38 = param_1->m02EC[0] - param_1->m2504;
local_38.x *= 0.25f;
local_38.y *= 0.25f;
local_38.z *= 0.25f;
for (int uVar2 = 0; uVar2 < 5; uVar2++, pcVar3++, param_1->m1F6C++) {
pcVar3->x = param_1->m2504.x + local_38.x * 0.25f * uVar2;
pcVar3->y = param_1->m2504.y + local_38.y * 0.25f * uVar2;
pcVar3->z = param_1->m2504.z + local_38.z * 0.25f * uVar2;
pcVar3->x = param_1->m2504.x + local_38.x * uVar2;
pcVar3->y = param_1->m2504.y + local_38.y * uVar2;
pcVar3->z = param_1->m2504.z + local_38.z * uVar2;
}
}
@@ -479,7 +466,7 @@ static BOOL daHimo2_Draw(himo2_class* param_1) {
int uVar6 = 0;
int uVar4 = 0;
for (int i = 0; i < 16; i++) {
f32 fVar1 = cM_ssin(uVar4 & 0xFFFF);
f32 fVar1 = cM_ssin(uVar4);
pcVar7->x = param_1->m02EC[0].x + local_a34.x * uVar6 + local_a28.x * fVar1;
pcVar7->y = param_1->m02EC[0].y + local_a34.y * uVar6 + local_a28.y * fVar1;
pcVar7->z = param_1->m02EC[0].z + local_a34.z * uVar6 + local_a28.z * fVar1;
@@ -1203,33 +1190,37 @@ void new_himo2_move(himo2_class* param_1) {
param_1->m24FC = REG0_F(16) + 3.5f;
} else {
param_1->m24B8 = 0.0f;
if (l_himo2HIO.m06 == 2) {
switch (l_himo2HIO.m06) {
case 0:
fVar26 = cM_rndF(1.0f);
if (fVar26 < 0.5f) {
param_1->m2514 = 1.0f;
} else {
param_1->m2514 = -1.0f;
}
fVar26 = cM_rndF(1.0f);
if (fVar26 < 0.5f) {
param_1->m2518 = 1.0f;
} else {
param_1->m2518 = -1.0f;
}
break;
case 1:
param_1->m2514 = 1.0f;
param_1->m2518 = 1.0f;
break;
case 2:
param_1->m2514 = 1.0f;
param_1->m2518 = -1.0f;
} else if (l_himo2HIO.m06 < 2) {
if (l_himo2HIO.m06 == 0) {
fVar26 = cM_rndF(1.0f);
if (fVar26 < 0.5f) {
param_1->m2514 = 1.0f;
} else {
param_1->m2514 = -1.0f;
}
fVar26 = cM_rndF(1.0f);
if (fVar26 < 0.5f) {
param_1->m2518 = 1.0f;
} else {
param_1->m2518 = -1.0f;
}
} else if (l_himo2HIO.m06 < -1) {
param_1->m2514 = 1.0f;
param_1->m2518 = 1.0f;
}
} else if (l_himo2HIO.m06 == 4) {
param_1->m2514 = -1.0f;
param_1->m2518 = -1.0f;
} else if (l_himo2HIO.m06 < 4) {
break;
case 3:
param_1->m2514 = -1.0f;
param_1->m2518 = 1.0f;
break;
case 4:
param_1->m2514 = -1.0f;
param_1->m2518 = -1.0f;
break;
}
if (param_1->m2518 < 0.0f) {
param_1->m24FC = REG0_F(6) + 3.0f;
@@ -1244,34 +1235,32 @@ void new_himo2_move(himo2_class* param_1) {
cLib_addCalc2(&param_1->m24B4, -144.0f, 1.0f, 10.0f);
if (param_1->m24B4 > -145.0f) {
if (param_1->m24BC < 400) {
fVar26 = 20.0f - ((param_1->m217C->scale).y - 1.0f) * 17.0f;
fVar26 = 20.0f - (param_1->m217C->scale.y - 1.0f) * 17.0f;
if (fVar26 < 0.5f) {
fVar26 = 0.5f;
}
iVar8 = (param_1->m24C4 / fVar26);
param_1->m24C0 = param_1->m24BC;
param_1->m24C0 = iVar8 + 1;
param_1->m24BC += iVar8;
param_1->m24C4 += 1.0f;
iVar9 = param_1->m24C0;
if (iVar9 == 0) {
if (param_1->m24C0 == 0) {
fopAcM_seStart(param_1, JA_SE_LK_ROPE_COIL_1, 0);
} else if ((iVar9 >= 13) && (param_1->m24BC <= iVar8 + 13)) {
} else if ((param_1->m24C0 >= 13) && (param_1->m24BC <= iVar8 + 13)) {
fopAcM_seStart(param_1, JA_SE_LK_ROPE_COIL_2, 0);
} else if ((iVar9 >= 26) && (param_1->m24BC <= iVar8 + 26)) {
} else if ((param_1->m24C0 >= 26) && (param_1->m24BC <= iVar8 + 26)) {
fopAcM_seStart(param_1, JA_SE_LK_ROPE_COIL_3, 0);
} else if ((iVar9 >= 39) && (param_1->m24BC <= iVar8 + 39)) {
} else if ((param_1->m24C0 >= 39) && (param_1->m24BC <= iVar8 + 39)) {
fopAcM_seStart(param_1, JA_SE_LK_ROPE_COIL_3, 0);
}
}
if ((fopAcM_GetParam(param_1->m217C) & 0x0F) == 3) {
fVar26 = ((param_1->m217C->scale).y - 0.14f) + REG8_F(7);
fVar26 = (param_1->m217C->scale.y - 0.14f) + REG8_F(7);
} else {
fVar26 = (param_1->m217C->scale).y;
fVar26 = param_1->m217C->scale.y;
}
uVar6 = (uint)(4000.0f - (fVar26 - 1.0f) * 2000.0f);
sVar15 = uVar6;
cLib_addCalcAngleS2(&param_1->m24C8, sVar15, 1, (sVar15 >> 3) + (u16)(sVar15 < 0 && (uVar6 & 7) != 0));
if (param_1->m24BC < 49) {
sVar15 = (4000.0f - (fVar26 - 1.0f) * 2000.0f);
cLib_addCalcAngleS2(&param_1->m24C8, sVar15, 1, (sVar15 / 8));
if (param_1->m24BC > 49) {
if (param_1->m24CA == 9000) {
param_1->m24CA = 0x238c;
} else if (param_1->m24CA < 9000) {
@@ -1301,6 +1290,7 @@ void new_himo2_move(himo2_class* param_1) {
} else {
cLib_addCalc2(&param_1->m24FC, 1.0f, REG0_F(4) + 0.2f, REG0_F(5) + 0.1f);
}
break;
}
case 3: {
param_1->m217C->health = 2;
@@ -1402,15 +1392,12 @@ void new_himo2_move(himo2_class* param_1) {
dVar21 = g_mDoCPd_cpadInfo[0].mCStickPosY;
}
case 6: {
iVar8 = g_mDoCPd_cpadInfo[0].mCStickPosX * (REG0_F(6) + 1000.0f);
param_1->m2512 += iVar8;
param_1->m2512 += (s16)(g_mDoCPd_cpadInfo[0].mCStickPosX * (REG0_F(6) + 1000.0f));
cLib_addCalcAngleS2(&param_1->m2510, param_1->m2512, 4, 0x1000);
if (dVar21 <= -0.1f) {
fVar26 = std::fabsf(dVar21);
cLib_addCalc2(&param_1->m24F8, REG0_F(7) + 70.0f, 1.0f, fVar26 * 3.0f);
cLib_addCalc2(&param_1->m24F8, REG0_F(7) + 70.0f, 1.0f, std::fabsf(dVar21) * 3.0f);
} else if (dVar21 >= 0.1f) {
fVar26 = ::std::fabsf(dVar21);
cLib_addCalc2(&param_1->m24F8, REG0_F(8) + 20.0f, 1.0f, fVar26 * 3.0f);
cLib_addCalc2(&param_1->m24F8, REG0_F(8) + 20.0f, 1.0f, std::fabsf(dVar21) * 3.0f);
}
cLib_addCalc2(&param_1->m24F4, param_1->m24F8, 0.1f, 10.0f);
mDoMtx_YrotS(*calc_mtx, param_1->m2510);
@@ -1435,7 +1422,7 @@ void new_himo2_move(himo2_class* param_1) {
break;
}
case 7: {
if (player->getRopeJumpLand() || (param_1->m029C == 0)) {
if (!player->getRopeJumpLand() && (param_1->m029C != 0)) {
if (!param_1->eventInfo.checkCommandDemoAccrpt()) {
fopAcM_orderPotentialEvent(param_1, dEvtFlag_STAFF_ALL_e, 0xFFFF, 0);
param_1->eventInfo.onCondition(dEvtCnd_UNK2_e);
@@ -1449,9 +1436,9 @@ void new_himo2_move(himo2_class* param_1) {
if (param_1->m029C != 0) {
break;
}
if (dr->unk_4BA < 9) {
if (dr->unk_4BA >= 10) {
param_1->m24D9 = 0;
camera->mCamera.Reset(param_1->m24DC, param_1->m24E8);
camera->mCamera.Reset(param_1->m24E8, param_1->m24DC);
camera->mCamera.Start();
camera->mCamera.SetTrimSize(0);
dComIfGp_event_reset();
@@ -1497,7 +1484,7 @@ void new_himo2_move(himo2_class* param_1) {
param_1->m2520 = REG0_F(11) + 50.0f;
btd->m6E15 = 0xB4;
}
if (param_1->m029C < 81) {
if (param_1->m029C <= 80) {
cLib_addCalc2(&param_1->m24F4, REG0_F(14) + 40.0f, 0.5f, 2.0f);
}
}
@@ -1568,33 +1555,35 @@ void new_himo2_move(himo2_class* param_1) {
local_188.y = param_1->m24E8.y + local_188.y;
local_188.z = param_1->m24E8.z;
dVar21 = cM_scos(param_1->m02D8 * 0x1C00);
iVar8 = ((param_1->m2520 * dVar21) * 7.5f);
iVar8 = (param_1->m2520 * (dVar21 * 7.5f));
camera->mCamera.Set(local_188, local_17c, iVar8, param_1->m24F4);
cLib_addCalc0(&param_1->m2520, (REG0_F(16) + 2.0f), dVar19);
sVar15 = 0;
if ((param_1->m217C != NULL) && ((fopAcM_GetParam(param_1->m217C) & 0xF0) != 0)) {
sVar15 = -50;
}
if (((sVar15 + 0x82) < param_1->m24BC) && (REG0_S(8) == 0)) {
if ((param_1->m24BC > sVar15 + 0x82) && (REG0_S(8) == 0)) {
if ((fopAcM_GetParam(param_1->m217C) & 0xF0) == 0) {
if (dr->unk_4BA < 10) {
param_1->m24D9 = 4;
param_1->m24D8 = 2;
param_1->m029C = 0;
if (btd != 0) {
fopAcM_OnStatus(btd, 0x4000);
if (param_1->m24D9 == 2) {
if (dr->unk_4BA < 10) {
param_1->m24D9 = 4;
param_1->m24D8 = 2;
param_1->m029C = 0;
if (btd != 0) {
fopAcM_OnStatus(btd, 0x4000);
}
} else {
param_1->m24D9 = 3;
param_1->m029C = REG0_S(2) + 65;
}
param_1->m24D8 = 2;
} else {
param_1->m24D9 = 3;
param_1->m029C = REG0_S(2) + 65;
camera->mCamera.Start();
param_1->m24D9 = 0;
param_1->m24D8 = 2;
fopAcM_SetParam(param_1, 2);
dComIfGp_event_reset();
}
param_1->m24D8 = 2;
} else if (param_1->m24D9 == 2) {
camera->mCamera.Start();
param_1->m24D9 = 0;
param_1->m24D8 = 2;
fopAcM_SetParam(param_1, 2);
dComIfGp_event_reset();
}
}
}
@@ -1606,17 +1595,11 @@ void new_himo2_move(himo2_class* param_1) {
/* 800F01BC-800F062C .text daHimo2_Execute__FP11himo2_class */
static BOOL daHimo2_Execute(himo2_class* param_1) {
/* Nonmatching - last for loop, regalloc */
daPy_py_c* apdVar1;
himo2_s* phVar3;
int iVar4;
int iVar5;
f32 dVar7;
f32 dVar8;
f32 dVar9;
f32 fVar10;
cXyz local_c8;
apdVar1 = daPy_getPlayerActorClass();
daPy_py_c* apdVar1 = daPy_getPlayerActorClass();
if (btd == NULL) {
btd = (btd_class*)fpcEx_Search(b_a_sub, param_1);
}
@@ -1645,21 +1628,14 @@ static BOOL daHimo2_Execute(himo2_class* param_1) {
iVar5 = 3;
}
dBgS_GndChk local_bc;
phVar3 = &param_1->m1120[0];
dVar7 = 60.0f;
dVar8 = 5.0f;
dVar9 = -100000.0f;
for (iVar4 = 0; iVar4 < iVar5; iVar4++) {
himo2_s* phVar3 = &param_1->m1120[0];
for (iVar4 = 0; iVar4 < iVar5; iVar4++, phVar3++) {
if (param_1->m02DC != 2) {
local_bc.m_pos.x = phVar3->m10.x;
local_bc.m_pos.y = phVar3->m10.y + dVar7;
local_bc.m_pos.z = phVar3->m10.z;
fVar10 = dComIfG_Bgsp()->GroundCross(&local_bc);
phVar3->m0C = (dVar8 + fVar10);
local_bc.GetPointP()->set(phVar3->m10.x, phVar3->m10.y + 60.0f, phVar3->m10.z);
phVar3->m0C = (5.0f + dComIfG_Bgsp()->GroundCross(&local_bc));
} else {
phVar3->m0C = dVar9;
phVar3->m0C = -100000.0f;
}
phVar3++;
}
new_himo2_move(param_1);
phVar3 = &param_1->m0310[0];
@@ -1721,10 +1697,10 @@ static int CallbackCreateHeap(fopAc_ac_c* i_this) {
/* 800F07F4-800F0B08 .text daHimo2_Create__FP10fopAc_ac_c */
static cPhs_State daHimo2_Create(fopAc_ac_c* i_this) {
/* Nonmatching - regalloc */
/* Nonmatching - .data */
cPhs_State phase_state;
daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0);
himo2_class* a_this = (himo2_class*)i_this;
daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0);
fopAcM_SetupActor(i_this, himo2_class);
if (!fopAcM_entrySolidHeap(a_this, CallbackCreateHeap, REG0_S(9) + 0x9050)) {