diff --git a/include/d/actor/d_a_bmd.h b/include/d/actor/d_a_bmd.h index 06f935921..3ce1adb9a 100644 --- a/include/d/actor/d_a_bmd.h +++ b/include/d/actor/d_a_bmd.h @@ -41,8 +41,8 @@ public: /* 0x328 */ f32 m328; /* 0x32C */ u8 m32C[0x330 - 0x32C]; /* 0x330 */ u8 m330; - /* 0x331 */ u8 m331; - /* 0x332 */ u8 m332; + /* 0x331 */ s8 m331; + /* 0x332 */ s8 m332; /* 0x333 */ u8 m333[0x334 - 0x333]; /* 0x334 */ s16 m334; /* 0x336 */ s16 m336; diff --git a/include/d/actor/d_a_bmdfoot.h b/include/d/actor/d_a_bmdfoot.h index 591d5534c..264b07b6f 100644 --- a/include/d/actor/d_a_bmdfoot.h +++ b/include/d/actor/d_a_bmdfoot.h @@ -1,19 +1,51 @@ #ifndef D_A_BMDFOOT_H #define D_A_BMDFOOT_H +#include "d/d_cc_d.h" +#include "d/d_particle.h" #include "f_op/f_op_actor.h" class bmdfoot_class : public fopAc_ac_c { public: - /* Place member variables here */ -}; - -class daBmdfoot_HIO_c { -public: - daBmdfoot_HIO_c(); - -public: - /* Place member variables here */ -}; + /* 0x290 */ u8 m290[0x2AC - 0x290]; + /* 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[2]; + /* 0x2CC */ cXyz m2CC[18]; + /* 0x3A4 */ f32 m3A4[16]; + /* 0x3E0 */ u8 m3E0[0x3EC - 0x3E4]; + /* 0x3EC */ s16 m3EC; + /* 0x3EE */ u8 m3EE[0x3F4 - 0x3EE]; + /* 0x3F4 */ u8 m3F4; + /* 0x3F5 */ u8 m3F5[0x3F8 - 0x3F5]; + /* 0x3F8 */ cXyz m3F8[3]; + /* 0x41C */ dPa_followEcallBack m41C[3]; + /* 0x458 */ dPa_smokeEcallBack m458[2]; + /* 0x498 */ cXyz m498[2]; + /* 0x4B0 */ dPa_smokeEcallBack m4B0; + /* 0x4D0 */ dCcD_Stts m4D0; + /* 0x50C */ dCcD_Sph m50C[5]; + /* 0xAE8 */ cXyz mAE8; + /* 0xAF4 */ mDoExt_McaMorf* mAF4; + /* 0xAF8 */ dKy_tevstr_c mAF8; + /* 0xBA8 */ u8 mBA8; + /* 0xBA9 */ u8 mBA9[0xBAC - 0xBA9]; + /* 0xBAC */ cXyz mBAC; + /* 0xBB8 */ csXyz mBB8; + /* 0xBBC */ u8 mBBC[0xBC0 - 0xBBE]; + /* 0xBC0 */ f32 mBC0; + /* 0xBC4 */ f32 mBC4; + /* 0xBC8 */ u8 mBC8; + /* 0xBC9 */ u8 mBC9[0xBCC - 0xBC9]; + /* 0xAF4 */ mDoExt_btkAnm* btk; + /* 0xBD0 */ s16 mBD0; + /* 0xBD2 */ u8 mBD2; + /* 0xBD3 */ u8 mBD3[0xBD4 - 0xBD3]; +}; // Size: 0xBD4 #endif /* D_A_BMDFOOT_H */ diff --git a/src/d/actor/d_a_bmdfoot.cpp b/src/d/actor/d_a_bmdfoot.cpp index b1f8a074b..996e07b30 100644 --- a/src/d/actor/d_a_bmdfoot.cpp +++ b/src/d/actor/d_a_bmdfoot.cpp @@ -1,88 +1,655 @@ /** * d_a_bmdfoot.cpp - * Boss - Kalle Demos (floor tentacles) + * Boss - Kalle Demos (floor tentacles) / 森ボス足 (Forest boss feet) */ #include "d/dolzel_rel.h" // IWYU pragma: keep #include "d/actor/d_a_bmdfoot.h" +#include "d/actor/d_a_player.h" +#include "d/res/res_bmdfoot.h" +#include "d/actor/d_a_bmd.h" +#include "d/d_s_play.h" #include "m_Do/m_Do_ext.h" #include "d/d_procname.h" #include "d/d_priority.h" #include "d/d_cc_d.h" +class daBmdfoot_HIO_c : public JORReflexible { +public: + daBmdfoot_HIO_c(); + virtual ~daBmdfoot_HIO_c() {}; + +public: + /* 0x04 */ s8 mNo; + /* 0x05 */ s8 m05; + /* 0x06 */ s16 m06; + /* 0x08 */ s16 m08; +}; + /* 000000EC-00000114 .text __ct__15daBmdfoot_HIO_cFv */ daBmdfoot_HIO_c::daBmdfoot_HIO_c() { - /* Nonmatching */ + mNo = 0xFF; + m08 = 1000; + m06 = 3500; } +static bmd_class* boss; +static bool hio_set; +static daBmdfoot_HIO_c l_HIO; + /* 00000114-000001D8 .text nodeCallBack__FP7J3DNodei */ -static BOOL nodeCallBack(J3DNode*, int) { - /* Nonmatching */ +static BOOL nodeCallBack(J3DNode* node, int calcTiming) { + if (calcTiming == J3DNodeCBCalcTiming_In) { + J3DJoint* joint = (J3DJoint*)node; + s32 jntNo = joint->getJntNo(); + J3DModel* model = j3dSys.getModel(); + bmdfoot_class* i_this = (bmdfoot_class*)model->getUserArea(); + if (i_this != NULL) { + MTXCopy(model->getAnmMtx(jntNo), *calc_mtx); + MtxRotX(i_this->m2CC[jntNo].x, 1); + MtxRotZ(i_this->m2CC[jntNo].z, 1); + MTXCopy(*calc_mtx, model->getAnmMtx(jntNo)); + MTXCopy(*calc_mtx, J3DSys::mCurrentMtx); + } + } + return TRUE; } /* 000001D8-000002B0 .text daBmdfoot_Draw__FP13bmdfoot_class */ -static BOOL daBmdfoot_Draw(bmdfoot_class*) { - /* Nonmatching */ +static BOOL daBmdfoot_Draw(bmdfoot_class* i_this) { + J3DModel* pJVar1; + + if (i_this->mBC8 != 0) { + pJVar1 = i_this->m2B4->getModel(); + g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &i_this->current.pos, &i_this->tevStr); + g_env_light.setLightTevColorType(pJVar1, &i_this->tevStr); + i_this->btk->entry(pJVar1->getModelData()); + i_this->m2B4->entryDL(); + if (i_this->mBA8 >= 10) { + pJVar1 = i_this->mAF4->getModel(); + g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &i_this->mBAC, &i_this->mAF8); + g_env_light.setLightTevColorType(pJVar1, &i_this->mAF8); + i_this->mAF4->entryDL(); + } + } + return TRUE; } /* 000002B0-000003D8 .text anm_init__FP13bmdfoot_classifUcfi */ -void anm_init(bmdfoot_class*, int, float, unsigned char, float, int) { - /* Nonmatching */ +void anm_init(bmdfoot_class* i_this, int bckFileIdx, float morf, unsigned char loopMode, float speed, int soundFileIdx) { + void* pSoundAnimRes; + + if (soundFileIdx >= 0) { + pSoundAnimRes = dComIfG_getObjectRes("Bmdfoot", soundFileIdx); + i_this->m2B4->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bmdfoot", bckFileIdx), loopMode, morf, speed, 0.0f, -1.0f, pSoundAnimRes); + } else { + i_this->m2B4->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bmdfoot", bckFileIdx), loopMode, morf, speed, 0.0f, -1.0f, NULL); + } } /* 000003D8-00000440 .text housi_off__FP13bmdfoot_class */ -void housi_off(bmdfoot_class*) { - /* Nonmatching */ +void housi_off(bmdfoot_class* i_this) { + for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m41C); i++) { + if (i_this->m41C[i].getEmitter() != NULL) { + i_this->m41C[i].getEmitter()->stopCreateParticle(); + } + } + if (i_this->m4B0.getEmitter() != NULL) { + i_this->m4B0.end(); + } } /* 00000440-00000840 .text wait__FP13bmdfoot_class */ -void wait(bmdfoot_class*) { - /* Nonmatching */ +void wait(bmdfoot_class* i_this) { + /* Nonmatching - regalloc */ + short sVar2; + int iVar3; + cXyz local_98; + static s32 eff_id[] = {0x0A, 0x0C, 0x11}; + + iVar3 = i_this->m2B4->getFrame(); + local_98.setall(0.0f); + for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m3F8); i++) { + MTXCopy(i_this->m2B4->getModel()->getAnmMtx(eff_id[i]), *calc_mtx); + MtxPosition(&local_98, &i_this->m3F8[i]); + if (i_this->m3F4 == 0) { + dComIfGp_particle_set(dPa_name::ID_SCENE_80ED, &i_this->m3F8[i], NULL, NULL, 0xFF, &i_this->m41C[i]); + } + if (i_this->m41C[i].getEmitter() != NULL) { + if (iVar3 == 0) { + i_this->m41C[i].getEmitter()->playCreateParticle(); + } else if (iVar3 == 20) { + i_this->m41C[i].getEmitter()->stopCreateParticle(); + } + } + } + i_this->m3F4 = 1; + switch (i_this->m2BC) { + case -1: + for (s32 i = 2; i <= (s32)ARRAY_SIZE(i_this->m3A4); i++) { + cLib_addCalc2(&i_this->m2CC[i].x, (s32)(0x10U - i) * (0.003f + REG12_F(3)), 0.1f, (0.008f + REG12_F(4))); + i_this->m3A4[i] = 0.0f; + } + if (i_this->m2C0[2] == 0) { + housi_off(i_this); + i_this->m2BA = 1; + i_this->m2BC = 0; + } + break; + case 0: + i_this->m2BC++; + anm_init(i_this, BMDFOOT_BCK_ASI_WAIT, 50.0f, J3DFrameCtrl::EMode_LOOP, (cM_rndF(0.2f) + 0.9f), -1); + i_this->m2C0[0] = (s16)(int)(cM_rndF(150.0f) + 100.0f); + i_this->m3EC = (s16)(int)cM_rndFX(32768.0f); + for (s32 i = 2; i <= (s32)ARRAY_SIZE(i_this->m3A4); i++) { + i_this->m3A4[i] = REG14_F(13) + (0.2f + cM_rndFX(0.1f)); + } + break; + case 1: + i_this->m3EC = (i_this->m3EC + REG14_S(4) + 0x200); + if (boss->m332 == 1) { + sVar2 = i_this->current.angle.y - fopAcM_searchPlayerAngleY(i_this); + if (sVar2 < 0) { + sVar2 = -sVar2; + } + if (sVar2 < l_HIO.m06) { + housi_off(i_this); + i_this->m2BA = 1; + i_this->m2BC = 0; + } else { + i_this->m2C0[0] = (s16)(int)(cM_rndF(50.0f) + 50.0f); + } + } else { + if (boss->m332 == 2) { + housi_off(i_this); + i_this->m2BA = 2; + i_this->m2BC = 0; + } + } + break; + } } /* 0000087C-00000D8C .text attack_1__FP13bmdfoot_class */ -void attack_1(bmdfoot_class*) { - /* Nonmatching */ +void attack_1(bmdfoot_class* i_this) { + /* Nonmatching - regalloc */ + bool bVar2; + short sVar3; + short sVar5; + J3DModel* pJVar9; + cXyz local_5c; + cXyz cStack_68; + static s32 jno[] = {0x0A, 0x0C, 0x11}; + static s32 col_joint[] = {0x01, 0x03, 0x05, 0x07, 0x09}; + + bVar2 = false; + local_5c.setall(0.0f); + switch (i_this->m2BC) { + case 0: + i_this->m2C0[0] = (s16)(int)cM_rndF(20.0f); + i_this->m2BC++; + case 1: + i_this->mBC4 = 0.0f; + if (i_this->m2C0[0] == 0) { + anm_init(i_this, BMDFOOT_BCK_ASI_ATTACK1, 10.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->m2BC++; + i_this->mBD0 = 0x1e; + } + break; + case 2: + if (i_this->mBD0 == 0) { + i_this->mBD0 = 0x1e; + } + if (i_this->m2B4->isStop()) { + anm_init(i_this, BMDFOOT_BCK_ASI_ATTACK_LOOP, 5.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + i_this->m2C0[0] = 0x3c; + i_this->m2BC++; + } + break; + case 3: + if (i_this->mBD0 == 0) { + i_this->mBD0 = 0x1e; + } + for (s32 i = 2; i <= (s32)ARRAY_SIZE(i_this->m3A4); i++) { + i_this->m3A4[i] = 0.0f; + cLib_addCalc0(&i_this->m2CC[i].z, 0.1f, 0.05f); + } + if (i_this->m2C0[0] == 0) { + anm_init(i_this, BMDFOOT_BCK_ASI_ATTACK2, 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->m2BC++; + i_this->m2C0[0] = REG14_S(2) + 0x1c; + mDoAud_seStart(JA_SE_CM_BKM_ATKVINE_PREP, &i_this->mAE8, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + } + break; + case 4: + bVar2 = true; + if (i_this->m2C0[0] == 1) { + mDoAud_seStart(JA_SE_CM_BKM_ATKVINE_ATTACK, &i_this->mAE8, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + for (s32 i = 0; i < (s32)ARRAY_SIZE(jno); i++) { + MTXCopy(i_this->m2B4->getModel()->getAnmMtx(jno[i]), *calc_mtx); + MtxPosition(&local_5c, &cStack_68); + dComIfGp_particle_setSimple(dPa_name::ID_SCENE_8065, &cStack_68, 0xFF, g_whiteColor, g_whiteColor, 0); + } + dComIfGp_particle_setSimple(dPa_name::ID_SCENE_8066, &i_this->mAE8, 0xFF, g_whiteColor, g_whiteColor, 0); + dComIfGp_particle_setSimple(dPa_name::ID_SCENE_A06A, &i_this->mAE8, 0xB9, g_whiteColor, g_whiteColor, 0); + } + if (i_this->m2B4->isStop()) { + i_this->m2BA = 0; + i_this->m2BC = 0; + } + break; + } + sVar3 = fopAcM_searchPlayerAngleY(i_this) - i_this->current.angle.y; + if (sVar3 > l_HIO.m06) { + sVar5 = sVar3; + } else if (sVar3 < -l_HIO.m06) { + sVar5 = -l_HIO.m06; + } else { + sVar5 = l_HIO.m06; + } + cLib_addCalcAngleS2(&i_this->m2BE, sVar5, 4, i_this->mBC4 + 128.0f); + cLib_addCalc2(&i_this->mBC4, 10000.0f, 1.0f, REG0_F(7) + 20.0f); + if (bVar2) { + pJVar9 = i_this->m2B4->getModel(); + for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m50C); i++) { + MTXCopy(pJVar9->getAnmMtx(((int)i_this->m2B8 & 7U) + col_joint[i]), *calc_mtx); + MtxPosition(&local_5c, &cStack_68); + i_this->m50C[i].SetC(cStack_68); + i_this->m50C[i].SetR(40.0f); + i_this->m50C[i].OnAtSetBit(); + i_this->m50C[i].ClrCoSet(); + dComIfG_Ccsp()->Set(&i_this->m50C[i]); + } + } } /* 00000D8C-00001180 .text ug_move__FP13bmdfoot_class */ -void ug_move(bmdfoot_class*) { - /* Nonmatching */ +s32 ug_move(bmdfoot_class* i_this) { + u32 uVar4; + f32 dVar5; + f32 dVar6; + float fVar7; + cXyz local_4c; + cXyz cStack_58; + cXyz local_64; + + daPy_py_c* apdVar3 = daPy_getPlayerActorClass(); + uVar4 = 0; + switch (i_this->mBA8) { + case 0: + break; + case 1: + i_this->mBAC = i_this->current.pos; + i_this->mBAC.y = boss->m328; + i_this->mBB8.y = i_this->current.angle.y; + i_this->mBC0 = 0.0f; + i_this->mBA8 = 2; + fVar7 = cM_rndF(10000.0f); + i_this->m2B8 = (s16)(int)fVar7; + dComIfGp_particle_setToon(dPa_name::ID_SCENE_A0FC, &i_this->mBAC, &i_this->mBB8, NULL, 0xB9, &i_this->m4B0, (u8)i_this->current.roomNo); + break; + case 0xa: + break; + case 2: + local_64 = apdVar3->current.pos - i_this->mBAC; + fVar7 = local_64.abs(); + dVar5 = (fVar7 * 10.0f); + if (dVar5 > (REG14_F(14) + 10000.0f)) { + dVar5 = (REG14_F(14) + 10000.0f); + } + dVar6 = cM_ssin(i_this->m2B8 * (REG14_S(3) + 2000)); + cLib_addCalcAngleS2(&i_this->mBB8.y, (s16)(dVar5 * dVar6) + cM_atan2s(local_64.x, local_64.z), 0x10, 0x2000); + local_4c.y = 0.0f; + local_4c.x = 0.0f; + local_4c.z = REG14_F(16) + 20.0f; + mDoMtx_YrotS(*calc_mtx, (int)i_this->mBB8.y); + MtxPosition(&local_4c, &cStack_58); + i_this->mBAC += cStack_58; + i_this->mBC0 = i_this->mBC0 + local_4c.z; + fVar7 = local_64.abs(); + if ((fVar7 < 300.0f) || (i_this->mBC0 > REG14_F(15) + 3000.0f)) { + i_this->mBA8 = 10; + if (i_this->m4B0.getEmitter() != NULL) { + i_this->m4B0.end(); + } + uVar4 = 1; + } + break; + } + MtxTrans(i_this->mBAC.x, i_this->mBAC.y, i_this->mBAC.z, false); + mDoMtx_YrotM(*calc_mtx, i_this->mBB8.y); + i_this->mAF4->getModel()->setBaseTRMtx(*calc_mtx); + i_this->mAF4->play(NULL, 0, 0); + i_this->mAF4->calc(); + return uVar4; } /* 00001180-00001B00 .text attack_2__FP13bmdfoot_class */ -void attack_2(bmdfoot_class*) { - /* Nonmatching */ +void attack_2(bmdfoot_class* i_this) { + /* Nonmatching - .data */ + bool bVar1; + J3DAnmTransform* pJVar2; + cXyz local_3c; + cXyz local_48; + static s32 col_joint[] = {0x11, 0x0F, 0x0C, 0x09}; + + local_3c.z = 0.0f; + local_3c.y = 0.0f; + local_3c.x = 0.0f; + boss->m334 = 10; + switch (i_this->m2BC) { + case 0: + i_this->m2C0[0] = (s16)(int)cM_rndF(20.0f); + i_this->m2BC++; + case 1: + i_this->mBC4 = 0.0f; + if (i_this->m2C0[0] == 0) { + anm_init(i_this, BMDFOOT_BCK_ASI_UMARU, 10.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->m2BC++; + i_this->m2C0[0] = 5; + i_this->mBD0 = 0x1e; + } + break; + case 2: + if ((s32)i_this->m2B4->getFrame() == 49) { + MTXCopy(i_this->m2B4->getModel()->getAnmMtx(0x11), *calc_mtx); + MtxPosition(&local_3c, &local_48); + dComIfGp_particle_setSimple(dPa_name::ID_SCENE_8065, &local_48, 0xFF, g_whiteColor, g_whiteColor, 0); + dComIfGp_particle_setSimple(dPa_name::ID_SCENE_8066, &local_48, 0xFF, g_whiteColor, g_whiteColor, 0); + dComIfGp_particle_setSimple(dPa_name::ID_SCENE_A06A, &local_48, 0xB9, g_whiteColor, g_whiteColor, 0); + mDoAud_seStart(JA_SE_CM_BKM_ATKVINE_IN_G, &i_this->mAE8, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + } + if (i_this->m2B4->isStop()) { + anm_init(i_this, BMDFOOT_BCK_ASI_UMARU_WAIT, 10.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + i_this->m2BC++; + i_this->mBA8 = 1; + } + break; + case 3: + mDoAud_seStart(JA_SE_CM_BKM_ATKVINE_DIG, &i_this->mBAC, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + if (ug_move(i_this)) { + pJVar2 = (J3DAnmTransform*)dComIfG_getObjectRes("Bmdfoot", BMDFOOT_BCK_ASI_DATTACK1); + i_this->mAF4->setAnm(pJVar2, J3DFrameCtrl::EMode_NONE, 1.0f, 1.0f, 0.0f, -1.0f, NULL); + i_this->m2BC++; + } + break; + case 4: + if ((s32)i_this->mAF4->getFrame() == 2) { + local_48 = i_this->mBAC; + dComIfGp_particle_setSimple(dPa_name::ID_SCENE_8065, &local_48, 0xFF, g_whiteColor, g_whiteColor, 0); + dComIfGp_particle_setSimple(dPa_name::ID_SCENE_8066, &local_48, 0xFF, g_whiteColor, g_whiteColor, 0); + dComIfGp_particle_setSimple(dPa_name::ID_SCENE_A06A, &local_48, 0xB9, g_whiteColor, g_whiteColor, 0); + mDoAud_seStart(JA_SE_CM_BKM_ATKVINE_OUT_G, &i_this->mBAC, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + } + ug_move(i_this); + bVar1 = true; + if (i_this->mAF4->isStop()) { + pJVar2 = (J3DAnmTransform*)dComIfG_getObjectRes("Bmdfoot", BMDFOOT_BCK_ASI_DATTACK2); + i_this->mAF4->setAnm(pJVar2, J3DFrameCtrl::EMode_LOOP, 1.0f, 1.0f, 0.0f, -1.0f, NULL); + i_this->m2C0[0] = 0xb4; + i_this->m2BC++; + } + break; + case 5: + ug_move(i_this); + mDoAud_seStart(JA_SE_CM_BKM_ATKVINE_L_ATK, &i_this->mBAC, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + for (s32 i = 0; i < (s32)ARRAY_SIZE(col_joint); i++) { + MTXCopy(i_this->mAF4->getModel()->getAnmMtx(col_joint[i]), *calc_mtx); + MtxPosition(&local_3c, &local_48); + i_this->m50C[i].SetC(local_48); + i_this->m50C[i].SetR(40.0f); + dComIfG_Ccsp()->Set(&i_this->m50C[i]); + } + if (i_this->m2C0[0] == 0) { + pJVar2 = (J3DAnmTransform*)dComIfG_getObjectRes("Bmdfoot", BMDFOOT_BCK_ASI_DATTACK3); + i_this->mAF4->setAnm(pJVar2, J3DFrameCtrl::EMode_NONE, 1.0f, 1.0f, 0.0f, -1.0f, NULL); + i_this->m2BC++; + } + break; + case 6: + ug_move(i_this); + if ((s32)i_this->mAF4->getFrame() == 12) { + dComIfGp_particle_set(dPa_name::ID_SCENE_80F9, &i_this->mBAC); + dComIfGp_particle_set(dPa_name::ID_SCENE_80FA, &i_this->mBAC); + i_this->m498[0].x = i_this->mBAC.x; + i_this->m498[0].y = i_this->mBAC.y; + i_this->m498[0].z = i_this->mBAC.z; + dComIfGp_particle_setToon(dPa_name::ID_SCENE_A0FB, &i_this->m498[0], NULL, NULL, 0xB9, &i_this->m458[0], (u8)i_this->current.roomNo); + mDoAud_seStart(JA_SE_CM_BKM_ATKVINE_IN_G2, &i_this->mBAC, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + } + if (i_this->mAF4->isStop()) { + anm_init(i_this, BMDFOOT_BCK_ASI_NUKU, 5.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->m2BC++; + i_this->mBA8 = 0; + mDoAud_seStart(JA_SE_CM_BKM_ATKVINE_OUT_G2, &i_this->mAE8, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + } + break; + case 7: + if ((s32)i_this->m2B4->getFrame() == 13) { + local_48 = i_this->current.pos; + local_48.y = i_this->mBAC.y; + dComIfGp_particle_set(dPa_name::ID_SCENE_80F9, &local_48); + dComIfGp_particle_set(dPa_name::ID_SCENE_80FA, &local_48); + i_this->m498[1].x = local_48.x; + i_this->m498[1].y = local_48.y; + i_this->m498[1].z = local_48.z; + dComIfGp_particle_setToon(dPa_name::ID_SCENE_A0FB, &i_this->m498[1], NULL, NULL, 0xB9, &i_this->m458[1], (u8)i_this->current.roomNo); + } + if (i_this->m2B4->isStop()) { + i_this->m2BA = 0; + i_this->m2BC = 0; + } + } + MTXCopy(i_this->m2B4->getModel()->getAnmMtx(4), *calc_mtx); + MtxPosition(&local_3c, &local_48); + i_this->m50C[4].SetC(local_48); + i_this->m50C[4].SetR(50.0f); + i_this->m50C[4].OffAtSetBit(); + i_this->m50C[4].OnCoSetBit(); + dComIfG_Ccsp()->Set(&i_this->m50C[4]); } /* 00001B00-00001CDC .text damage__FP13bmdfoot_class */ -void damage(bmdfoot_class*) { - /* Nonmatching */ +void damage(bmdfoot_class* i_this) { + f32 dVar5; + float fVar9; + + switch (i_this->m2BC) { + case 0: + anm_init(i_this, BMDFOOT_BCK_ASI_NOBIKIRU, 40.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->m2BC++; + i_this->m2C0[0] = 0x1e; + fVar9 = cM_rndFX(32768.0f); + i_this->m3EC = (s16)(int)fVar9; + for (s32 i = 2; i <= (s32)ARRAY_SIZE(i_this->m3A4); i++) { + i_this->m3A4[i] = (0.3f + cM_rndFX(0.2f)); + } + case 1: + if (i_this->m2C0[0] != 0) { + dVar5 = ((i_this->base.mParameters & 0xf) * 0.01f); + for (s32 i = 2; i <= (s32)ARRAY_SIZE(i_this->m3A4); i++) { + cLib_addCalc2(&i_this->m2CC[i].x, -(dVar5 + (0.05f + ((i) * (0.03f + REG14_F(3))))), 0.1f, REG14_F(4) + 0.1f); + } + } + if (boss->m331 > 0) { + i_this->m2BA = 0; + i_this->m2BC = -1; + i_this->m2C0[2] = 0x14; + } + break; + } } /* 00001CDC-00001ED8 .text start__FP13bmdfoot_class */ -void start(bmdfoot_class*) { - /* Nonmatching */ +void start(bmdfoot_class* i_this) { + for (s32 i = 2; i <= (s32)ARRAY_SIZE(i_this->m3A4); i++) { + i_this->m2CC[i].z = 0; + i_this->m3A4[i] = 0; + } + switch (i_this->m2BC) { + case 0: + if (boss->m332 == 6) { + i_this->m2BC = 1; + i_this->m2C0[0] = (s16)(int)cM_rndF(10.0f); + } + break; + case 1: + if (i_this->m2C0[0] == 0) { + i_this->mBC8 = 1; + anm_init(i_this, BMDFOOT_BCK_ASI_START1, 1.0f, J3DFrameCtrl::EMode_NONE, (cM_rndF(0.2f) + 0.9f), -1); + i_this->m2BC = 2; + } + break; + case 2: + if (i_this->m2B4->isStop()) { + anm_init(i_this, BMDFOOT_BCK_ASI_START2, 30.0f, J3DFrameCtrl::EMode_LOOP, (cM_rndF(0.2f) + 0.9f), -1); + i_this->m2BC = 3; + } + break; + case 3: + if ((s32)i_this->m2B4->getFrame() == 2) { + mDoAud_seStart(JA_SE_CM_BKM_ATKVINE_MOVE_1, &i_this->mAE8, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + } + if (boss->m332 == 7) { + i_this->m2BA = 0; + i_this->m2BC = 0; + } + break; + } } /* 00001ED8-00001FB8 .text end__FP13bmdfoot_class */ -void end(bmdfoot_class*) { - /* Nonmatching */ +void end(bmdfoot_class* i_this) { + for (s32 i = 2; i <= (s32)ARRAY_SIZE(i_this->m3A4); i++) { + i_this->m2CC[i].z = 0; + i_this->m3A4[i] = 0; + } + if (boss->mB76 == 2) { + anm_init(i_this, BMDFOOT_BCK_ASI_DEAD_LOOP, 30.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + } + if (boss->mB76 == REG8_S(8) + 0x17c) { + anm_init(i_this, BMDFOOT_BCK_ASI_DEAD, 30.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + } } /* 00001FB8-000021B8 .text move__FP13bmdfoot_class */ -void move(bmdfoot_class*) { - /* Nonmatching */ +void move(bmdfoot_class* i_this) { + /* Nonmatching - .data */ + s16 sVar1; + cXyz local_20; + cXyz cStack_2c; + + if (boss != NULL) { + sVar1 = (u16)(i_this->base.mParameters & 0xF) << 13; + mDoMtx_YrotS(*calc_mtx, boss->shape_angle.y); + mDoMtx_XrotM(*calc_mtx, boss->shape_angle.x); + mDoMtx_ZrotM(*calc_mtx, boss->shape_angle.z); + mDoMtx_YrotM(*calc_mtx, sVar1); + i_this->current.angle.y = sVar1 + boss->shape_angle.y; + local_20.x = 0.0f; + local_20.y = REG14_F(3); + local_20.z = REG14_F(4) + 180.0f; + MtxPosition(&local_20, &cStack_2c); + i_this->current.pos = boss->current.pos + cStack_2c; + switch (i_this->m2BA) { + case 0: + wait(i_this); + break; + case 1: + attack_1(i_this); + break; + case 2: + attack_2(i_this); + break; + case 3: + damage(i_this); + if (boss->m332 == 8) { + i_this->m2BA = 0xb; + i_this->m2BC = 0; + } + break; + case 10: + start(i_this); + break; + case 0xb: + end(i_this); + } + if (boss->m332 == 3) { + housi_off(i_this); + i_this->m2BA = 3; + i_this->m2BC = 0; + i_this->mBA8 = 0; + } + } } /* 000021B8-00002204 .text s_a_d_sub__FPvPv */ -void s_a_d_sub(void*, void*) { - /* Nonmatching */ +void* s_a_d_sub(void* i_this, void* param_2) { + if ((fopAc_IsActor(i_this)) && (fopAcM_GetName(i_this) == PROC_BMD)) { + return i_this; + } else { + return NULL; + } } /* 00002204-00002594 .text daBmdfoot_Execute__FP13bmdfoot_class */ -static BOOL daBmdfoot_Execute(bmdfoot_class*) { - /* Nonmatching */ +static BOOL daBmdfoot_Execute(bmdfoot_class* i_this) { + short sVar1; + J3DModel* pJVar5; + cXyz local_68; + + 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] != 0) { + i_this->m2C8[0]--; + } + move(i_this); + MtxTrans(i_this->current.pos.x, i_this->current.pos.y, i_this->current.pos.z, false); + mDoMtx_YrotM(*calc_mtx, i_this->current.angle.y + i_this->m2BE); + mDoMtx_XrotM(*calc_mtx, i_this->current.angle.x); + mDoMtx_ZrotM(*calc_mtx, i_this->current.angle.z + ((int)i_this->m2BE << 1)); + pJVar5 = i_this->m2B4->getModel(); + MTXCopy(*calc_mtx, pJVar5->getBaseTRMtx()); + i_this->m2B4->play(NULL, 0, 0); + i_this->m2B4->calc(); + if (i_this->mBD0 != 0) { + if (i_this->mBD0 == 0x1e) { + mDoAud_seStart(JA_SE_CM_BKM_ATKVINE_MOVE_2, &i_this->mAE8, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + } + i_this->mBD0 = i_this->mBD0 + -1; + } + sVar1 = 0x1d - i_this->mBD0; + if (sVar1 >= 0x1E) { + sVar1 = sVar1 % 0x1e; + } + i_this->btk->setFrame(sVar1); + MTXCopy(pJVar5->getAnmMtx(REG14_S(6) + 0x10), *calc_mtx); + local_68.z = 0.0f; + local_68.y = 0.0f; + local_68.x = 0.0f; + MtxPosition(&local_68, &i_this->mAE8); + if ((boss != NULL) && (i_this->mAE8.y < boss->m328)) { + i_this->mAE8.y = boss->m328; + } + cLib_addCalcAngleS2(&i_this->m2BE, 0, 0x10, 0x80); + if (i_this->m2BA < 3) { + sVar1 = l_HIO.m08; + } else { + sVar1 = REG0_S(4); + } + cLib_addCalcAngleS2(&i_this->current.angle.x, sVar1, 0x10, 0x80); + for (s32 i = 2; i <= (s32)ARRAY_SIZE(i_this->m3A4); i++) { + cLib_addCalc2(&i_this->m2CC[i].z, i_this->m3A4[i] * cM_ssin(i_this->m3EC + i * (REG0_S(6) + 9000)), 0.05f, 0.01f + REG14_F(5)); + cLib_addCalc0(&i_this->m2CC[i].x, 0.05f, 0.005f + REG14_F(5)); + } + return TRUE; } /* 00002594-0000259C .text daBmdfoot_IsDelete__FP13bmdfoot_class */ @@ -91,23 +658,98 @@ static BOOL daBmdfoot_IsDelete(bmdfoot_class*) { } /* 0000259C-000026B0 .text daBmdfoot_Delete__FP13bmdfoot_class */ -static BOOL daBmdfoot_Delete(bmdfoot_class*) { - /* Nonmatching */ +static BOOL daBmdfoot_Delete(bmdfoot_class* i_this) { + dComIfG_resDelete(&i_this->m2AC, "Bmdfoot"); + if (i_this->mBD2 != 0) { + hio_set = 0; + mDoHIO_deleteChild(l_HIO.mNo); + } + mDoAud_seDeleteObject(&i_this->mAE8); + mDoAud_seDeleteObject(&i_this->mBAC); + for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m41C); i++) { + i_this->m41C[i].end(); + } + i_this->m458[0].end(); + i_this->m458[1].end(); + i_this->m4B0.end(); + boss = NULL; + return TRUE; } /* 000026B0-000029B4 .text useHeapInit__FP13bmdfoot_class */ -void useHeapInit(bmdfoot_class*) { - /* Nonmatching */ +s32 useHeapInit(bmdfoot_class* i_this) { + mDoExt_McaMorf* pmVar1; + mDoExt_btkAnm* pmVar5; + J3DAnmTextureSRTKey* pAnm; + int iVar7; + J3DModel* pJVar9; + + pmVar1 = new mDoExt_McaMorf( + (J3DModelData*)dComIfG_getObjectRes("Bmdfoot", BMDFOOT_BMD_ASI), + NULL, + NULL, + (J3DAnmTransformKey*)dComIfG_getObjectRes("Bmdfoot", BMDFOOT_BCK_ASI_WAIT), + J3DFrameCtrl::EMode_LOOP, + cM_rndF(0.2f) + 0.9f, + 0, + -1, + 1, + NULL, + 0, + 0x11020203 + ); + i_this->m2B4 = pmVar1; + pJVar9 = i_this->m2B4->getModel(); + if (pJVar9 == NULL) { + return FALSE; + } else if (i_this->m2B4 == NULL) { + return FALSE; + } else { + pJVar9->setUserArea((u32)i_this); + for (u16 uVar16 = 0; uVar16 < pJVar9->getModelData()->getJointNum(); uVar16++) { + pJVar9->getModelData()->getJointNodePointer(uVar16)->setCallBack(nodeCallBack); + } + pmVar5 = new mDoExt_btkAnm(); + i_this->btk = pmVar5; + JUT_ASSERT(0x592, i_this->btk); + pAnm = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bmdfoot", BMDFOOT_BTK_ASI); + iVar7 = i_this->btk->init(pJVar9->getModelData(), pAnm, true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, false, 0); + if (iVar7 == 0) { + return FALSE; + } else { + pmVar1 = new mDoExt_McaMorf( + (J3DModelData*)dComIfG_getObjectRes("Bmdfoot", BMDFOOT_BMD_ASI), + NULL, + NULL, + (J3DAnmTransformKey*)dComIfG_getObjectRes("Bmdfoot", BMDFOOT_BCK_ASI_WAIT), + J3DFrameCtrl::EMode_LOOP, + cM_rndF(0.2f) + 0.9f, + 0, + -1, + 1, + NULL, + 0, + 0x11020203 + ); + i_this->mAF4 = pmVar1; + if (i_this->mAF4->getModel() == NULL) { + return FALSE; + } else { + return TRUE; + } + } + } } /* 000029FC-00002A1C .text solidHeapCB__FP10fopAc_ac_c */ -static BOOL solidHeapCB(fopAc_ac_c*) { - /* Nonmatching */ +static BOOL solidHeapCB(fopAc_ac_c* a_this) { + bmdfoot_class* i_this = (bmdfoot_class*)a_this; + useHeapInit(i_this); } /* 00002A1C-00002E88 .text daBmdfoot_Create__FP10fopAc_ac_c */ -static cPhs_State daBmdfoot_Create(fopAc_ac_c*) { - /* Nonmatching */ +static cPhs_State daBmdfoot_Create(fopAc_ac_c* a_this) { + /* Nonmatching - .data */ static dCcD_SrcSph cc_sph_src = { // dCcD_SrcGObjInf { @@ -136,6 +778,43 @@ static cPhs_State daBmdfoot_Create(fopAc_ac_c*) { /* Radius */ 40.0f, }}, }; + cPhs_State res; + + fopAcM_SetupActor(a_this, bmdfoot_class); + bmdfoot_class* i_this = (bmdfoot_class*)a_this; + res = dComIfG_resLoad(&i_this->m2AC, "Bmdfoot"); + if (res == cPhs_ERROR_e) { + return cPhs_ERROR_e; + } else if (res != cPhs_COMPLEATE_e) { + return res; + } + i_this->m458[0].setFollowOff(); + i_this->m458[1].setFollowOff(); + if (!fopAcM_entrySolidHeap(i_this, solidHeapCB, 0x5040)) { + return cPhs_ERROR_e; + } + if (hio_set == 0) { + hio_set = 1; + i_this->mBD2 = 1; + l_HIO.mNo = mDoHIO_createChild("森ボス足", &l_HIO); // Forest boss feet + } + i_this->health = 2; + i_this->m2B8 = (s16)(int)cM_rndF(10000.0f); + boss = NULL; + i_this->m4D0.Init(0xFF, 0, i_this); + for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m50C); i++) { + i_this->m50C[i].SetStts(&i_this->m4D0); + i_this->m50C[i].Set(cc_sph_src); + } + i_this->attention_info.position.y = -20000.0f; + i_this->eyePos.y = -20000.0f; + if (!(g_dComIfG_gameInfo.save.getMemory().getBit().isStageBossDemo()) && (dComIfGp_getStartStageName()[0] != 'X')) { + i_this->m2BA = 10; + } else { + i_this->mBC8 = 1; + } + i_this->mAF8 = i_this->tevStr; + return cPhs_COMPLEATE_e; } static actor_method_class l_daBmdfoot_Method = {