From 5fdcda6661c4d3528076747a9b9c72f68fb6a390 Mon Sep 17 00:00:00 2001 From: 123456789758 <205478182+123456789758@users.noreply.github.com> Date: Sun, 14 Sep 2025 13:17:50 -0400 Subject: [PATCH] d_a_bwd - 98% matching (#892) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: ‎ ‎ ‎ <‎ ‎ ‎> --- include/SSystem/SComponent/c_lib.h | 1 + include/d/actor/d_a_bwd.h | 161 +- include/d/actor/d_a_bwds.h | 3 + include/d/d_snap.h | 2 +- src/d/actor/d_a_bwd.cpp | 2541 +++++++++++++++++++++++++++- 5 files changed, 2636 insertions(+), 72 deletions(-) diff --git a/include/SSystem/SComponent/c_lib.h b/include/SSystem/SComponent/c_lib.h index a82395541..1cc7fe421 100644 --- a/include/SSystem/SComponent/c_lib.h +++ b/include/SSystem/SComponent/c_lib.h @@ -102,6 +102,7 @@ void MtxRotX(f32 rot, u8 concat); void MtxRotY(f32 rot, u8 concat); void MtxRotZ(f32 rot, u8 concat); +extern Mtx mtx[10]; extern Mtx* calc_mtx; #endif diff --git a/include/d/actor/d_a_bwd.h b/include/d/actor/d_a_bwd.h index 382a1ef30..79754d89c 100644 --- a/include/d/actor/d_a_bwd.h +++ b/include/d/actor/d_a_bwd.h @@ -1,25 +1,160 @@ #ifndef D_A_BWD_H #define D_A_BWD_H +#include "JSystem/JParticle/JPAEmitter.h" +#include "d/d_bg_w.h" +#include "d/d_cc_d.h" +#include "d/d_particle.h" #include "f_op/f_op_actor.h" +#include "m_Do/m_Do_ext.h" -class bwd_class : public fopAc_ac_c { -public: - /* Place member variables here */ - /* 0x0290 */ u8 m0290[0x17C8 - 0x0290]; +struct sita_s { + /* 0x00 */ J3DModel* m00; + /* 0x04 */ cXyz m04; + /* 0x20 */ u8 m1C[0x14 - 0x10]; +}; // Size: 0x14 + +struct bwd_class { + /* 0x0000 */ fopEn_enemy_c actor; + /* 0x02AC */ request_of_phase_process_class mPhaseBwd; + /* 0x02B4 */ request_of_phase_process_class mPhaseBwds; + /* 0x02BC */ u8 m02BC; + /* 0x02BD */ u8 m02BD[0x02BF - 0x02BD]; + /* 0x02C0 */ mDoExt_McaMorf* m02C0; + /* 0x02C4 */ mDoExt_brkAnm* m02C4; + /* 0x02C8 */ f32 m02C8; + /* 0x02CC */ J3DModel* m02CC; + /* 0x02D0 */ u8 m02D0[0x02D4 - 0x02D0]; + /* 0x02D4 */ J3DModel* m02D4[20]; + /* 0x0324 */ J3DModel* m0324[20]; + /* 0x0374 */ mDoExt_brkAnm* m0374[20]; + /* 0x0374 */ f32 m03C4[20]; + /* 0x0414 */ s32 m0414; + /* 0x0418 */ cXyz m0418[20]; + /* 0x0508 */ cXyz m0508[256]; + /* 0x1108 */ csXyz m1108[256]; + /* 0x1708 */ s32 m1708; + /* 0x170C */ s32 m170C; + /* 0x1710 */ s8 m1710; + /* 0x1711 */ u8 m1711[0x1714 - 0x1711]; + /* 0x1714 */ dKy_tevstr_c m1714; + /* 0x17C4 */ u8 m17C4; + /* 0x17C5 */ u8 m17C5[0x17C8 - 0x17C5]; /* 0x17C8 */ cXyz m17C8; /* 0x17D4 */ f32 m17D4; /* 0x17D8 */ s16 m17D8; + /* 0x17DA */ u8 m17DA[0x17DC - 0x17DA]; /* 0x17DC */ f32 m17DC; /* 0x17E0 */ f32 m17E0; -}; - -class daBwd_HIO_c { -public: - daBwd_HIO_c(); - -public: - /* Place member variables here */ -}; + /* 0x17E4 */ s8 m17E4[2]; + /* 0x17E6 */ s16 m17E6[2]; + /* 0x17EA */ u8 m17EA[0x17EC - 0x17EA]; + /* 0x17EC */ J3DModel* m17EC[2]; + /* 0x17F4 */ mDoExt_btkAnm* m17F4[2]; + /* 0x17FC */ Mtx m17FC[2]; + /* 0x185C */ dBgW* m185C[2]; + /* 0x1864 */ s8 m1864; + /* 0x1865 */ s8 m1865; + /* 0x1866 */ u8 m1866[0x1868 - 0x1866]; + /* 0x1868 */ J3DModel* m1868; + /* 0x186C */ Mtx m186C; + /* 0x189C */ dBgW* m189C; + /* 0x18A0 */ cXyz m18A0; + /* 0x18AC */ s16 m18AC; + /* 0x18AE */ s16 m18AE; + /* 0x18B0 */ s16 m18B0; + /* 0x18B2 */ u8 m18B2[0x18B4 - 0x18B2]; + /* 0x18B4 */ cXyz m18B4; + /* 0x18C0 */ u8 m18C0[0x18C4 - 0x18C0]; + /* 0x18C4 */ f32 m18C4; + /* 0x18C8 */ f32 m18C8; + /* 0x18CC */ s16 m18CC[2]; + /* 0x18D0 */ s16 m18D0; + /* 0x18D2 */ u8 m18D2[0x18D6 - 0x18D2]; + /* 0x18D6 */ s16 m18D6; + /* 0x18D8 */ u8 m18D8; + /* 0x18D9 */ u8 m18D9[0x18DC - 0x18D9]; + /* 0x18DC */ f32 m18DC; + /* 0x18E0 */ fpc_ProcID m18E0; + /* 0x18E4 */ cXyz m18E4; + /* 0x18F0 */ cXyz m18F0; + /* 0x18FC */ s16 m18FC; + /* 0x18FE */ s16 m18FE; + /* 0x1900 */ s16 m1900; + /* 0x1902 */ s16 m1902; + /* 0x1904 */ s32 m1904; + /* 0x1908 */ sita_s m1908[32]; + /* 0x1B88 */ cXyz m1B88; + /* 0x1B94 */ cXyz m1B94; + /* 0x1BA0 */ f32 m1BA0; + /* 0x1BA4 */ f32 m1BA4; + /* 0x1BA8 */ f32 m1BA8; + /* 0x1BAC */ f32 m1BAC; + /* 0x1BB0 */ s8 m1BB0; + /* 0x1BB1 */ s8 m1BB1; + /* 0x1BB2 */ s8 m1BB2; + /* 0x1BB3 */ s8 m1BB3; + /* 0x1BB4 */ s8 m1BB4; + /* 0x1BB5 */ s8 m1BB5; + /* 0x1BB6 */ s8 m1BB6; + /* 0x1BB7 */ u8 m1BB7[0x1BB8 - 0x1BB7]; + /* 0x1BB8 */ f32 m1BB8; + /* 0x1BBC */ fpc_ProcID m1BBC; +#if VERSION == VERSION_USA + /* 0x1BC0 */ fpc_ProcID m1BC0; +#endif + /* 0x1BC4 */ dCcD_Stts mCcD_Stts; + /* 0x1C00 */ dCcD_Sph mDamageSpheres[19]; + /* 0x3244 */ dCcD_Sph mCcD_Sph; + /* 0x3370 */ dCcD_Sph mCcD_Sph_Array5[5]; + /* 0x394C */ s8 m394C; + /* 0x394D */ u8 m394D[0x3954 - 0x394D]; + /* 0x3954 */ cXyz m3954; + /* 0x3960 */ s8 m3960; + /* 0x3961 */ u8 m3961[0x3964 - 0x3961]; + /* 0x3964 */ JPABaseEmitter* m3964; + /* 0x3968 */ JPABaseEmitter* m3968; + /* 0x396C */ u8 m396C[0x3978 - 0x396C]; + /* 0x3978 */ dPa_smokeEcallBack m3978[10]; + /* 0x3AB8 */ dPa_followEcallBack m3AB8[2]; + /* 0x3AE0 */ s16 m3AE0[2]; + /* 0x3AE4 */ s16 m3AE4; + /* 0x3AE6 */ s16 m3AE6; + /* 0x3AE8 */ s16 m3AE8; + /* 0x3AEA */ s16 m3AEA; + /* 0x3AEC */ s16 m3AEC; + /* 0x3AEE */ u8 m3AEE[0x3AF4 - 0x3AEE]; + /* 0x3AF4 */ dPa_followEcallBack m3AF4; + /* 0x3B08 */ s8 m3B08[2]; + /* 0x3B0A */ u8 m3B0A[0x3B0C - 0x3B0A]; + /* 0x3B0C */ cXyz m3B0C[2]; + /* 0x3B24 */ mDoExt_McaMorf* m3B24[2]; + /* 0x3B34 */ mDoExt_btkAnm* m3B2C[2]; + /* 0x3B34 */ mDoExt_brkAnm* m3B34[2]; + /* 0x3B3C */ f32 m3B3C; + /* 0x3B40 */ f32 m3B40; + /* 0x3B44 */ f32 m3B44; + /* 0x3B48 */ csXyz m3B48[2]; + /* 0x3B54 */ dPa_smokeEcallBack m3B54[6]; + /* 0x3C14 */ s8 m3C14; + /* 0x3C15 */ s8 m3C15; + /* 0x3C16 */ u8 m3C16[0x3C18 - 0x3C16]; + /* 0x3C18 */ f32 m3C18; + /* 0x3C1C */ s16 m3C1C; + /* 0x3C1E */ s16 m3C1E; + /* 0x3C20 */ s16 m3C20; + /* 0x3C22 */ s16 m3C22; + /* 0x3C24 */ s8 m3C24; + /* 0x3C25 */ u8 m3C25[0x3C28 - 0x3C25]; + /* 0x3C28 */ cXyz m3C28; + /* 0x3C34 */ cXyz m3C34; + /* 0x3C40 */ u8 m3C40[0x3C44 - 0x3C40]; + /* 0x3C44 */ f32 m3C44; + /* 0x3C48 */ f32 m3C48; + /* 0x3C4C */ f32 m3C4C; + /* 0x3C50 */ s8 m3C50; + /* 0x3C51 */ u8 m3C51; + /* 0x3C52 */ u8 m3C52[0x3C54 - 0x3C52]; +}; // Size: 0x3C54 #endif /* D_A_BWD_H */ diff --git a/include/d/actor/d_a_bwds.h b/include/d/actor/d_a_bwds.h index 3aed3a37e..a77d17e9f 100644 --- a/include/d/actor/d_a_bwds.h +++ b/include/d/actor/d_a_bwds.h @@ -6,6 +6,9 @@ class bwds_class : public fopAc_ac_c { public: /* Place member variables here */ + /* 0x0290 */ u8 m0290[0x04F4 - 0x0290]; + /* 0x04F4 */ u8 m04F4; + /* 0x04F5 */ u8 m04F5[0x18CC - 0x04F5]; }; class daBwds_HIO_c { diff --git a/include/d/d_snap.h b/include/d/d_snap.h index cd4de9265..7563c7497 100644 --- a/include/d/d_snap.h +++ b/include/d/d_snap.h @@ -209,7 +209,7 @@ enum { /* 0xC9 */ DSNAP_TYPE_BST, /* 0xCA */ DSNAP_TYPE_UNKCA, /* 0xCB */ DSNAP_TYPE_UNKCB, - /* 0xCC */ DSNAP_TYPE_UNKCC, + /* 0xCC */ DSNAP_TYPE_BWD, /* 0xCD */ DSNAP_TYPE_UNKCD, /* 0xCE */ DSNAP_TYPE_UNKCE, /* 0xCF */ DSNAP_TYPE_UNKCF, diff --git a/src/d/actor/d_a_bwd.cpp b/src/d/actor/d_a_bwd.cpp index 5cabdc7b2..fd879ca70 100644 --- a/src/d/actor/d_a_bwd.cpp +++ b/src/d/actor/d_a_bwd.cpp @@ -1,142 +1,2280 @@ /** * d_a_bwd.cpp - * Boss - Molgera + * Boss - Molgera / 風ボス (Wind boss) */ #include "d/dolzel_rel.h" // IWYU pragma: keep #include "d/actor/d_a_bwd.h" +#include "d/actor/d_a_bwds.h" +#include "d/actor/d_a_player.h" +#include "d/actor/d_a_player_main.h" +#include "d/d_lib.h" #include "d/d_procname.h" #include "d/d_priority.h" #include "d/d_cc_d.h" +#include "d/d_s_play.h" +#include "d/d_bg_s_movebg_actor.h" +#include "d/d_snap.h" +#include "d/res/res_bwd.h" +#include "f_op/f_op_camera.h" +#include "m_Do/m_Do_graphic.h" +#include "JSystem/JUtility/JUTReport.h" + +class daBwd_HIO_c : public JORReflexible { +public: + daBwd_HIO_c(); + virtual ~daBwd_HIO_c() {}; + void genMessage(JORMContext*) {} + +public: + /* 0x04 */ s8 mNo; + /* 0x05 */ u8 m05; + /* 0x06 */ u8 m06; + /* 0x07 */ u8 m07; + /* 0x08 */ u8 m08; + /* 0x09 */ u8 m09[0x0C - 0x09]; + /* 0x0C */ f32 m0C; + /* 0x10 */ f32 m10; + /* 0x14 */ s16 m14; + /* 0x16 */ u8 m16[0x18 - 0x16]; + /* 0x18 */ f32 m18; + /* 0x1C */ f32 m1C; + /* 0x20 */ f32 m20; + /* 0x24 */ s16 m24; + /* 0x26 */ s16 m26; + /* 0x28 */ f32 m28; + /* 0x2C */ f32 m2C; + /* 0x30 */ f32 m30; + /* 0x34 */ f32 m34; + /* 0x38 */ s16 m38; + /* 0x3A */ s16 m3A; + /* 0x3C */ s16 m3C; + /* 0x3E */ s16 m3E; +}; /* 000000EC-0000019C .text __ct__11daBwd_HIO_cFv */ daBwd_HIO_c::daBwd_HIO_c() { - /* Nonmatching */ + mNo = 0xFF; + m05 = 0; + m06 = 0; + m07 = 0; + m08 = 0; + m0C = -400.0f; + m10 = 6.0f; + m14 = 0x78; + m18 = 700.0f; + m1C = 3000.0f; + m20 = 1.3f; + m24 = 3; + m26 = 5; + m28 = 800.0f; + m2C = -500.0f; + m30 = 3.5f; + m34 = 2.0f; + m38 = 0x8c; + m3A = 0x78; + m3C = 0x50; + m3E = 0x96; } +static GXColor eff_col; +static bool hio_set; +static daBwd_HIO_c l_HIO; +static cXyz suna_gr_pos[6] = { + cXyz(-3791.0f, 0.0f, -467.0f), + cXyz(2138.0f, 0.0f, -3176.0f), + cXyz(1655.0f, 0.0f, 3434.0f), + cXyz(-2405.0f, 0.0f, 2935.0f), + cXyz(3747.0f, 0.0f, 753.0f), + cXyz(-1393.0f, 0.0f, -3546.0f) +}; +static csXyz suna_gr_ang[6]; +static cXyz center_pos(0.0f, 0.0f, 0.0f); +static s32 ko_count; +static fopAc_ac_c* ko_ac[22]; +static cXyz set_pos; + /* 0000019C-000001B4 .text g_eff_on__FP9bwd_class */ -void g_eff_on(bwd_class*) { - /* Nonmatching */ +void g_eff_on(bwd_class* i_this) { + if (i_this->m3960 != 0) { + return; + } + i_this->m3960 = 1; } /* 000001B4-000001CC .text g_eff_off__FP9bwd_class */ -void g_eff_off(bwd_class*) { - /* Nonmatching */ +void g_eff_off(bwd_class* i_this) { + if (i_this->m3960 == 0) { + return; + } + i_this->m3960 = -1; } /* 000001CC-00000250 .text ko_s_sub__FPvPv */ -void ko_s_sub(void*, void*) { - /* Nonmatching */ +void* ko_s_sub(void* param_1, void* param_2) { + fopAc_ac_c* actor = (fopAc_ac_c*)param_1; + + if ((fopAc_IsActor(actor)) && (fopAcM_GetName(actor) == PROC_BWDS)) { + if (ko_count < l_HIO.m26) { + ko_ac[ko_count] = actor; + ko_count++; + } + return FALSE; + } + return FALSE; } /* 00000250-0000029C .text ko_delete_sub__FPvPv */ -void ko_delete_sub(void*, void*) { - /* Nonmatching */ +void* ko_delete_sub(void* param_1, void* param_2) { + bwds_class* actor = (bwds_class*)param_1; + + if ((fopAc_IsActor(actor)) && (fopAcM_GetName(actor) == PROC_BWDS)) { + actor->m04F4 = 1; + } + return FALSE; } /* 0000029C-000003C4 .text anm_init__FP9bwd_classifUcfi */ -void anm_init(bwd_class*, int, float, unsigned char, float, int) { - /* Nonmatching */ +void anm_init(bwd_class* i_this, int bckFileIdx, f32 morf, u8 loopMode, f32 speed, int soundFileIdx) { + void* pSoundAnimRes; + J3DAnmTransform* pJVar1; + + if (soundFileIdx >= 0) { + pSoundAnimRes = dComIfG_getObjectRes("Bwd", soundFileIdx); + pJVar1 = (J3DAnmTransform*)dComIfG_getObjectRes("Bwd", bckFileIdx); + i_this->m02C0->setAnm(pJVar1, loopMode, morf, speed, 0.0f, -1.0f, pSoundAnimRes); + } else { + pJVar1 = (J3DAnmTransform*)dComIfG_getObjectRes("Bwd", bckFileIdx); + i_this->m02C0->setAnm(pJVar1, loopMode, morf, speed, 0.0f, -1.0f, NULL); + } } /* 000003C4-00000480 .text gr_draw__FP9bwd_class */ -void gr_draw(bwd_class*) { - /* Nonmatching */ +void gr_draw(bwd_class* i_this) { + cXyz local_18; + + local_18.setall(0.0f); + g_env_light.settingTevStruct(TEV_TYPE_BG0, &local_18, &i_this->m1714); + if (i_this->m1865 == 0) { + dComIfGd_setListBG(); + g_env_light.setLightTevColorType(i_this->m1868, &i_this->m1714); + mDoExt_modelUpdateDL(i_this->m1868); + dComIfGd_setList(); + } } /* 000004BC-00000564 .text suna_draw__FP9bwd_class */ -void suna_draw(bwd_class*) { - /* Nonmatching */ +void suna_draw(bwd_class* i_this) { + for (s32 i = 0; i < 2; i++) { + if (i_this->m17E4[i] != 0) { + g_env_light.setLightTevColorType(i_this->m17EC[i], &i_this->m1714); + i_this->m17F4[i]->entry(i_this->m17EC[i]->getModelData()); + mDoExt_modelUpdateDL(i_this->m17EC[i]); + i_this->m17F4[i]->remove(i_this->m17EC[i]->getModelData()); + } + } } /* 00000564-00000760 .text daBwd_Draw__FP9bwd_class */ -static BOOL daBwd_Draw(bwd_class*) { - /* Nonmatching */ +static BOOL daBwd_Draw(bwd_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + J3DModel* pJVar5; + + if (i_this->m3C1C > 1) { + mDoGph_gInf_c::setBlureRate(i_this->m3C1C); + mDoGph_gInf_c::onBlure(); + } else if (i_this->m3C1C == 1) { + i_this->m3C1C = 0; + mDoGph_gInf_c::offBlure(); + } + pJVar5 = i_this->m02C0->getModel(); + g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &actor->current.pos, &actor->tevStr); + g_env_light.setLightTevColorType(pJVar5, &actor->tevStr); + i_this->m02C4->entry(pJVar5->getModelData()); + i_this->m02C0->entryDL(); + if (i_this->m1BB6 < 2) { + sita_s* psVar3; + s32 i = 0; + for (psVar3 = i_this->m1908, i = 0; i < 0x1E; i++, psVar3++) { + g_env_light.setLightTevColorType(psVar3->m00, &actor->tevStr); + mDoExt_modelUpdateDL(psVar3->m00); + } + } + if (i_this->m170C != 0) { + for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m02D4); i++) { + if (i_this->m02D4[i] != NULL) { + pJVar5 = i_this->m02D4[i]; + g_env_light.setLightTevColorType(pJVar5, &actor->tevStr); + i_this->m0374[i]->entry(pJVar5->getModelData()); + mDoExt_modelUpdateDL(pJVar5); + } + } + } + dSnap_RegistFig(DSNAP_TYPE_BWD, actor, 1.0f, 1.0f, 1.0f); + gr_draw(i_this); + suna_draw(i_this); + for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m3B08); i++) { + if (i_this->m3B08[i] != 0) { + i_this->m3B34[i]->entry(i_this->m3B24[i]->getModel()->getModelData()); + i_this->m3B2C[i]->entry(i_this->m3B24[i]->getModel()->getModelData()); + i_this->m3B24[i]->updateDL(); + } + } + return TRUE; } /* 00000760-00000FBC .text fly_pos_move__FP9bwd_classss */ -void fly_pos_move(bwd_class*, short, short) { - /* Nonmatching */ +void fly_pos_move(bwd_class* i_this, s16 param_2, s16 param_3) { + /* Nonmatching - sVar1, target */ + fopAc_ac_c* actor = &i_this->actor; + s16 sVar1; + f32 fVar2; + f32 fVar3; + s16 target; + int iVar4; + int iVar5; + s8 cVar6; + f32 dVar12; + cXyz local_ec; + cXyz cStack_f8; + + fVar2 = i_this->m18B4.x - actor->current.pos.x; + dVar12 = (i_this->m18B4.y - actor->current.pos.y); + fVar3 = i_this->m18B4.z - actor->current.pos.z; + iVar4 = cM_atan2s(fVar2, fVar3); + fVar2 = std::sqrtf((fVar2 * fVar2) + (fVar3 * fVar3)); + iVar5 = cM_atan2s(dVar12, fVar2); + sVar1 = actor->current.angle.y; + cLib_addCalcAngleS2(&actor->current.angle.y, param_3 + iVar4, REG0_S(3) + 10, (i_this->m18C4 * i_this->m18C8)); + sVar1 = (sVar1 - actor->current.angle.y) * 0x20; + target = REG0_S(1) + 0x157c; + if (sVar1 > target) { + iVar4 = -target; + target = sVar1; + } else if (sVar1 < iVar4) { + target = iVar4; + } + cLib_addCalcAngleS2(&actor->current.angle.z, target, REG0_S(3) + 10, (i_this->m18C4 * i_this->m18C8 * 0.5f)); + cLib_addCalcAngleS2(&actor->current.angle.x, param_2 - iVar5, REG0_S(3) + 10, (i_this->m18C4 * i_this->m18C8)); + cLib_addCalc2(&i_this->m18C8, 1.0f, 1.0f, 0.04); + local_ec.x = 0.0f; + local_ec.y = 0.0f; + local_ec.z = actor->speedF; + mDoMtx_YrotS(*calc_mtx, actor->current.angle.y); + mDoMtx_XrotM(*calc_mtx, actor->current.angle.x); + MtxPosition(&local_ec, &actor->speed); + actor->current.pos.x = actor->current.pos.x + actor->speed.x; + actor->current.pos.y = actor->current.pos.y + actor->speed.y; + actor->current.pos.z = actor->current.pos.z + actor->speed.z; + if (i_this->m18FC == 0) { + dBgS_LinChk local_e0; + local_ec.x = 0.0f; + local_ec.y = 0.0f; + local_ec.z = REG0_F(7) + 700.0f; + MtxPosition(&local_ec, &cStack_f8); + cStack_f8 += actor->current.pos; + local_e0.Set(&actor->current.pos, &cStack_f8, NULL); + cVar6 = dComIfG_Bgsp()->LineCross(&local_e0); + local_e0.Set(&cStack_f8, &actor->current.pos, NULL); + if (dComIfG_Bgsp()->LineCross(&local_e0)) { + cVar6 = 2; + } + if (cVar6 != 0) { + i_this->m18FC = 0x1e; + dComIfGp_getVibration().StartShock(REG0_S(2) + 7, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + if (i_this->m3C1E != 0) { + i_this->m3C1C = 0xb4; + } + i_this->m3C4C = REG0_F(0x13) + 50.0f; + if ((cVar6 == 1) && (i_this->m3AE0[0] == 0)) { + i_this->m3954.x = actor->current.pos.x; + i_this->m3954.z = actor->current.pos.z; + i_this->m3C15 = 2; + i_this->m3C14 = 0x5a; + i_this->m17C8 = i_this->m3954; + i_this->m17C4 = 199; + i_this->m3B08[1] = 1; + i_this->m3B0C[1] = i_this->m3954; + dComIfGp_particle_setToon(dPa_name::ID_SCENE_A25A, &i_this->m3954, NULL, NULL, eff_col.a, &i_this->m3978[0], (s8)actor->current.roomNo); + i_this->m3978[0].setColor(eff_col); + dComIfGp_particle_set(dPa_name::ID_SCENE_8259, &i_this->m3954, NULL, NULL, eff_col.a, &i_this->m3AB8[0], (s8)actor->current.roomNo); + mDoAud_seStart(JA_SE_CM_BWD_IN_SAND_1, &i_this->m3954, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + i_this->m3AE0[0] = 0x6e; + } else if (i_this->m3AE0[1] == 0) { + i_this->m3954.x = actor->current.pos.x; + i_this->m3954.z = actor->current.pos.z; + i_this->m3B08[0] = 1; + i_this->m3B0C[0] = i_this->m3954; + ; + i_this->m3C15 = 2; + i_this->m3C14 = 0x5a; + dComIfGp_particle_setToon(dPa_name::ID_SCENE_A258, &i_this->m3954, NULL, NULL, eff_col.a, &i_this->m3978[1], (s8)actor->current.roomNo); + i_this->m3978[1].setColor(eff_col); + dComIfGp_particle_set(dPa_name::ID_SCENE_8257, &i_this->m3954, NULL, NULL, eff_col.a, &i_this->m3AB8[1], (s8)actor->current.roomNo); + mDoAud_seStart(JA_SE_CM_BWD_OUT_SAND_1, &i_this->m3954, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + i_this->m3AE0[1] = 0x6e; + } + } + } } /* 000013F4-00001640 .text damage_check__FP9bwd_class */ -void damage_check(bwd_class*) { - /* Nonmatching */ +void damage_check(bwd_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + s8 sVar6; + cCcD_Obj* pcVar5; + CcAtInfo local_34; + + if (i_this->m18D6 == 0) { + local_34.pParticlePos = NULL; +#if VERSION == VERSION_USA + fopAc_ac_c* pfVar2 = fopAcM_SearchByID(i_this->m1BC0); + if (pfVar2 != NULL) { + pfVar2->current.pos = actor->eyePos; + } +#endif + if (i_this->m1BB1 != 0) { + i_this->mCcD_Sph.SetTgType(~(AT_TYPE_WATER | AT_TYPE_UNK20000 | AT_TYPE_WIND | AT_TYPE_UNK400000 | AT_TYPE_LIGHT)); + } else { + i_this->mCcD_Sph.SetTgType(AT_TYPE_HOOKSHOT); + } + if (i_this->mCcD_Sph.ChkTgHit()) { + i_this->m18D6 = 6; + local_34.mpObj = i_this->mCcD_Sph.GetTgHitObj(); + if (local_34.mpObj != NULL) { + local_34.pParticlePos = i_this->mCcD_Sph.GetTgHitPosP(); + if (local_34.mpObj->ChkAtType(AT_TYPE_HOOKSHOT)) { + i_this->m1BB0 = 1; + local_34.mpActor = local_34.mpObj->GetAc(); + i_this->m1BBC = fopAcM_GetID(local_34.mpActor); + i_this->m18AE = 3; + i_this->m18B0 = 0; + mDoAud_seStart(JA_SE_LK_HS_SPIKE, &actor->eyePos, 0x20, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } else { + if (i_this->m1BB1 != 0) { + sVar6 = actor->health; + actor->health = 0x14; + cc_at_check(actor, &local_34); + actor->health = sVar6 + -1; + fopAcM_monsSeStart(actor, JA_SE_CV_BWD_DAMAGE, 0); + i_this->m1BB4++; + i_this->m1BB3 = 0x14; + } + } + } + } + for (s32 i = 0; i < 9; i++) { + if (i_this->mDamageSpheres[i].ChkTgHit()) { + pcVar5 = i_this->mDamageSpheres[i].GetTgHitObj(); + def_se_set(actor, pcVar5, 0x40); + return; + } + } + } } /* 0000167C-000018E8 .text start__FP9bwd_class */ -void start(bwd_class*) { - /* Nonmatching */ +void start(bwd_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + f32 fVar7; + + daPy_py_c* player = daPy_getPlayerActorClass(); + switch (i_this->m18B0) { + case 0: + i_this->m17C4 = 0xC9; + fVar7 = player->current.pos.abs(); + if (fVar7 < 3200.0f) { + i_this->m18B0 = 1; + i_this->m18AC = 0; + i_this->m3C1E = 0x32; + } + break; + case 1: + if (i_this->m18AC == 0x3C) { + i_this->m17E4[0] = 1; + for (s32 i = 0; i < 3; i++) { + mDoAud_seStart(JA_SE_OBJ_BWD_SANDFALL_S, &suna_gr_pos[i], 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + } + if (i_this->m18AC == 200) { + i_this->m17D8 = REG0_S(4) + 500; + } + if (i_this->m18AC >= 0xDC) { + cLib_addCalc2(&i_this->m17E0, 900.0f, 0.1f, REG0_F(0xd) + 0.9f); + } + if (i_this->m18AC == 0x28f) { + i_this->m1865 = 1; + } + if ((i_this->m18AC >= 600) && (i_this->m394C = 1, i_this->m18AC == 0x294)) { + i_this->m18AE = 0xB; + i_this->m18B0 = 0; + actor->current.pos.x = 0.0f; + actor->current.pos.y = ((l_HIO.m28 + -2000.0f) - 200.0f) + REG0_F(0xb); + actor->current.pos.z = 0.0f; + i_this->m18CC[1] = 0x28; + g_eff_on(i_this); + dComIfGp_getVibration().StopQuake(-1); + } + break; + } + i_this->m1BB6 = 1; } /* 000018E8-00001AEC .text wait__FP9bwd_class */ -void wait(bwd_class*) { - /* Nonmatching */ +void wait(bwd_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + daPy_py_c* player = daPy_getPlayerActorClass(); + i_this->m394C = 1; + i_this->m17C8 = actor->current.pos; + i_this->m17C4 = 1; + actor->current.angle.z = 0; + actor->current.angle.x = 0; + if (i_this->m1BB8 > 80.0f) { + cLib_addCalcAngleS2(&actor->current.angle.y, fopAcM_searchPlayerAngleY(actor), 10, 0x800); + } + switch (i_this->m18B0) { + case -10: + if (!(player->current.pos.y < 900.0f)) { + break; + } + i_this->m18CC[0] = 0x7a; + i_this->m18D0 = 0xde; + i_this->m18B0 = 1; + break; + case 0: + i_this->m18B0++; + case 1: + if (i_this->m18CC[0] == 0) { + anm_init(i_this, BWD_BCK_BWD_WAIT, 10.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + i_this->m18B0++; + mDoAud_seStart(JA_SE_CM_BWD_OUT_SAND_2, &i_this->m3954, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } else { + if (i_this->m18CC[0] == 0x78) { + g_eff_on(i_this); + } + break; + } + case 2: + cLib_addCalc2(&actor->current.pos.y, l_HIO.m0C + l_HIO.m28, 0.1f, 20.0f); + if (i_this->m18D0 == 0) { + if (i_this->m1BB8 < l_HIO.m18) { + i_this->m18AE = 5; + i_this->m18B0 = 0; + } else { + if (i_this->m1BB8 > l_HIO.m1C) { + i_this->m18AE = 2; + i_this->m18B0 = 0; + } + } + } + break; + } } /* 00001AEC-00001CBC .text reset__FP9bwd_class */ -void reset(bwd_class*) { - /* Nonmatching */ +void reset(bwd_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + f32 fVar4; + + daPy_py_c* player = daPy_getPlayerActorClass(); + switch (i_this->m18B0) { + case 0: + i_this->m18B0++; + i_this->m18CC[0] = 0x96; + // fallthrough + case 1: + cLib_addCalc2(&actor->current.pos.y, REG0_F(0x11) + -1500.0f + l_HIO.m28, 1.0f, 10.0f); + if (i_this->m18CC[0] == 100) { + g_eff_off(i_this); + } + if (i_this->m18CC[0] == 0) { + i_this->m18AE = 1; + i_this->m18B0 = 0; + i_this->m18D0 = 0xde; + i_this->m18CC[0] = 0x7a; + actor->current.pos.x = player->current.pos.x + cM_rndFX(300.0f); + actor->current.pos.y = l_HIO.m28 + -1500.0f; + actor->current.pos.z = player->current.pos.z + cM_rndFX(300.0f); + while (true) { + fVar4 = std::sqrtf(actor->current.pos.x * actor->current.pos.x + actor->current.pos.z * actor->current.pos.z); + if (fVar4 < REG0_F(0x12) + 3000.0f) { + break; + } + actor->current.pos.x *= 0.9f; + actor->current.pos.z *= 0.9f; + } + } + break; + } } /* 00001CBC-000026A4 .text sita_hit__FP9bwd_class */ -void sita_hit(bwd_class*) { - /* Nonmatching */ +void sita_hit(bwd_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + JPABaseEmitter* pJVar5; + int iVar6; + mDoExt_McaMorf* pmVar9; + int iVar11; + f32 fVar12; + csXyz local_40; + cXyz local_2c; + cXyz local_38; + + daPy_py_c* player = daPy_getPlayerActorClass(); + iVar6 = (int)i_this->m02C0->getFrame(); + i_this->m17C4 = 200; + switch (i_this->m18B0) { + case 0: + anm_init(i_this, BWD_BCK_BWD_NUKARERU, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->m18B0++; + i_this->m1BAC = 1.0f; + // fallthrough + case 1: + if (!i_this->m02C0->isStop()) { + break; + } + anm_init(i_this, BWD_BCK_BWD_NUKARERU_LOOP, 1.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + i_this->m18B0++; + break; + case 2: + if (i_this->m1BB1 == 0) { + i_this->m18AE = 1; + i_this->m18B0 = 0; + i_this->m18CC[0] = 0; + break; + } + if (i_this->m1BB4 < 3) { + break; + } + i_this->m1BB5++; + dComIfGp_particle_set(dPa_name::ID_COMMON_0010, &i_this->m1908[29].m04); + local_38.z = 2.0f; + local_38.y = 2.0f; + local_38.x = 2.0f; + local_40.z = 0; + local_40.x = 0; + local_40.y = fopAcM_searchPlayerAngleY(actor); + dComIfGp_particle_set(dPa_name::ID_COMMON_NORMAL_HIT, &i_this->m1908[29].m04, &local_40, &local_38); + if ((i_this->m1BB5 >= 4) || (l_HIO.m06 != 0)) { + fopAcM_monsSeStart(actor, JA_SE_CV_BWD_LAST_HIT, 0); + i_this->m18AE = 0xc; + i_this->m18B0 = 0; + i_this->m1BB2 = 0x32; + dScnPly_ply_c::nextPauseTimer = 8; + mDoAud_bgmStop(30); + i_this->m1710 = 0; + break; + } + dScnPly_ply_c::nextPauseTimer = 4; + anm_init(i_this, BWD_BCK_BWD_DAMAGE1, 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->m18B0++; + i_this->m1BB1 = 0; + i_this->m1BB4 = 0; + i_this->m1BB2 = 0x32; + fopAcM_monsSeStart(actor, JA_SE_CV_BWD_DAMAGE_L, 0); + break; + case 3: + if (!i_this->m02C0->isStop()) { + break; + } + anm_init(i_this, BWD_BCK_BWD_DAMAGE2, 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->m18B0++; + i_this->m18CC[0] = 300; + i_this->m3954.x = actor->current.pos.x; + i_this->m3954.z = actor->current.pos.z; + dComIfGp_particle_set(dPa_name::ID_SCENE_8253, &i_this->m3954, &actor->shape_angle); + pJVar5 = dComIfGp_particle_set(dPa_name::ID_SCENE_8252, &i_this->m3954); + i_this->m3964 = pJVar5; + dComIfGp_particle_set(dPa_name::ID_SCENE_8254, &i_this->m3954, &actor->shape_angle); + dComIfGp_particle_set(dPa_name::ID_SCENE_8255, &i_this->m3954, &actor->shape_angle); + if (i_this->m3AE4 == 0) { + i_this->m3AE4 = 0x4d; + i_this->m3954.x = actor->current.pos.x; + i_this->m3954.z = actor->current.pos.z; + dComIfGp_particle_setToon( + dPa_name::ID_SCENE_A256, &i_this->m3954, &actor->shape_angle, NULL, eff_col.a, &i_this->m3978[2], (s8)actor->current.roomNo + ); + i_this->m3978[2].setColor(eff_col); + } + // fallthrough + case 4: + pJVar5 = i_this->m3964; + if (pJVar5 != NULL) { + pmVar9 = i_this->m02C0; + if (pmVar9->isStop()) { + pJVar5->becomeInvalidEmitter(); + i_this->m3964 = NULL; + } else { + pJVar5->setGlobalRTMatrix(pmVar9->getModel()->getAnmMtx(0xe)); + } + } + i_this->m1BB6 = 1; + iVar11 = (int)i_this->m02C0->getFrame(); + if (iVar11 == 0x32) { + g_eff_off(i_this); + } + if (iVar6 == 0x30) { + mDoAud_seStart(JA_SE_CM_BWD_IN_SAND_3, &i_this->m3954, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + if (((((iVar6 == 0x30) && (l_HIO.m24 >= 1)) || ((iVar6 == 0x31) && (l_HIO.m24 >= 2)) || (iVar6 == 0x32 && (l_HIO.m24 >= 3))) || + (iVar6 == 0x33 && (l_HIO.m24 >= 4))) && + (ko_count < l_HIO.m26)) + { + local_2c = i_this->m1908[0].m04; + local_2c.y = REG0_F(9) + -600.0f + l_HIO.m28; + fopAcM_create(PROC_BWDS, 0x23, &local_2c, fopAcM_GetRoomNo(actor)); + if (i_this->m1710 == 0) { + if (dComIfGp_getStartStageName()[0] == 'X') { + mDoAud_bgmStart(JA_BGM_UNK_152); + } else { + mDoAud_bgmStart(JA_BGM_UNK_124); + } + i_this->m1710 = 10; + } + } + if (i_this->m18CC[0] == 0) { + if ((i_this->m1BB5 >= 2) || (l_HIO.m07 != 0)) { + i_this->m18AE = 10; + i_this->m18B0 = 0; + fVar12 = cM_rndFX(300.0f); + actor->current.pos.x = player->current.pos.x + fVar12; + actor->current.pos.y = l_HIO.m28 + -2000.0f; + fVar12 = cM_rndFX(300.0f); + actor->current.pos.z = player->current.pos.z + fVar12; + while (true) { + fVar12 = std::sqrtf(actor->current.pos.x * actor->current.pos.x + actor->current.pos.z * actor->current.pos.z); + if (fVar12 < REG0_F(0x12) + 3000.0f) { + break; + } + actor->current.pos.x *= 0.9f; + actor->current.pos.z *= 0.9f; + } + i_this->m18CC[1] = 0x28; + for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m0508); i++) { + i_this->m0508[i] = actor->current.pos; + } + g_eff_on(i_this); + } else { + i_this->m18AE = 1; + i_this->m18B0 = 0; + i_this->m18D0 = 0xde; + i_this->m18CC[0] = 0x7a; + fVar12 = cM_rndFX(300.0f); + actor->current.pos.x = player->current.pos.x + fVar12; + actor->current.pos.y = l_HIO.m28 + -1500.0f; + fVar12 = cM_rndFX(300.0f); + actor->current.pos.z = player->current.pos.z + fVar12; + while (true) { + fVar12 = std::sqrtf(actor->current.pos.x * actor->current.pos.x + actor->current.pos.z * actor->current.pos.z); + if (fVar12 < REG0_F(0x12) + 3000.0f) { + break; + } + actor->current.pos.x *= 0.9f; + actor->current.pos.z *= 0.9f; + } + } + } + break; + } } /* 000026A4-00002F30 .text eat_attack__FP9bwd_class */ -void eat_attack(bwd_class*) { - /* Nonmatching */ +void eat_attack(bwd_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + f32 fVar1; + s8 bVar2; + bool bVar3; + s16 sVar6; + int iVar8; + s8 cVar10; + cXyz local_38; + + daPy_py_c* player = daPy_getPlayerActorClass(); + cVar10 = 0; + i_this->m17C8 = actor->current.pos; + i_this->m17C4 = 1; + if ((i_this->m3C1E == 0) && (i_this->m1BB8 > 80.0f)) { + sVar6 = fopAcM_searchPlayerAngleY(actor); + cLib_addCalcAngleS2(&actor->current.angle.y, sVar6, 10, 0x800); + } + i_this->m18D6 = 5; + bVar3 = true; + i_this->m1BB6 = 1; + bVar2 = false; + switch (i_this->m18B0) { + case 0: + anm_init(i_this, BWD_BCK_BWD_ATTACK, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->m18B0++; + i_this->m3954.x = actor->current.pos.x; + i_this->m3954.z = actor->current.pos.z; + dComIfGp_particle_set(dPa_name::ID_SCENE_824E, &i_this->m3954, &actor->shape_angle); + mDoAud_seStart(JA_SE_CV_BWD_ATTACK, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + break; + case 1: + fVar1 = i_this->m02C0->getFrame(); + if (fVar1 >= 27.0f) { + if (((int)fVar1 == 0x1b) && (i_this->m3AE6 == 0)) { + i_this->m3AE6 = REG0_S(4) + 10; + i_this->m3978[3].end(); + i_this->m3954.x = actor->current.pos.x; + i_this->m3954.z = actor->current.pos.z; + dComIfGp_particle_setToon( + dPa_name::ID_SCENE_A24F, &i_this->m3954, &actor->shape_angle, NULL, eff_col.a, &i_this->m3978[3], (s8)actor->current.roomNo + ); + i_this->m3978[3].setColor(eff_col); + } + for (s32 i = 0; i < 9; i++) { + if (i_this->mDamageSpheres[i].ChkAtHit()) { + bVar2 = true; + break; + } + } + if (i_this->m1BB8 < REG0_F(2) + 150.0f) { + bVar2 = true; + } + } + if (bVar2) { + anm_init(i_this, BWD_BCK_BWD_ATTACK_EAT, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->m18B0 = 5; + i_this->m18CC[0] = 0x96; + i_this->m3C1E++; + i_this->m3954.x = actor->current.pos.x; + i_this->m3954.z = actor->current.pos.z; + dComIfGp_particle_set(dPa_name::ID_SCENE_8250, &i_this->m3954, &actor->shape_angle); + if (i_this->m3AE8 == 0) { + i_this->m3AE8 = 0x3c; + i_this->m3978[4].end(); + i_this->m3954.x = actor->current.pos.x; + i_this->m3954.z = actor->current.pos.z; + dComIfGp_particle_setToon( + dPa_name::ID_SCENE_A251, &i_this->m3954, &actor->shape_angle, NULL, eff_col.a, &i_this->m3978[4], (s8)actor->current.roomNo + ); + i_this->m3978[4].setColor(eff_col); + } + mDoAud_seStart(JA_SE_CM_BWD_MOUTH_CLOSE_2, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } else { + if (i_this->m02C0->isStop()) { + anm_init(i_this, BWD_BCK_BWD_ATTACK_SHIPPAI, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + mDoAud_seStart(JA_SE_CM_BWD_MOUTH_CLOSE_2, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + i_this->m18B0++; + } + } + break; + case 2: + if (i_this->m02C0->isStop()) { + cVar10 = 1; + } + break; + case 3: + break; + case 4: + break; + case 5: + if ((int)i_this->m02C0->getFrame() == 10) { + mDoAud_seStart(JA_SE_CM_BWD_HEAD_BACK_1, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + if ((int)i_this->m02C0->getFrame() == 30) { + mDoAud_seStart(JA_SE_CM_BWD_IN_SAND_2, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + if ((int)i_this->m02C0->getFrame() == 50) { + g_eff_off(i_this); + } + if (i_this->m18CC[0] == 0x3c) { + local_38 = i_this->m1908[0].m04; + local_38.y = i_this->m3954.y + REG0_F(9); + iVar8 = player->setThrowDamage(&local_38, actor->shape_angle.y, (REG0_F(7) + 60.0f), (REG0_F(8) + 130.0f), 0); + if (iVar8 == 1) { + i_this->m3C1E++; + i_this->m3C20 = 0; + if (i_this->m3AEA == 0) { + i_this->m3AEA = 0x14; + i_this->m3978[5].end(); + i_this->m3954.x = actor->current.pos.x; + i_this->m3954.z = actor->current.pos.z; + dComIfGp_particle_setToon(dPa_name::ID_SCENE_A24A, &i_this->m3954, NULL, NULL, eff_col.a, &i_this->m3978[5], (s8)actor->current.roomNo); + i_this->m3978[5].setColor(eff_col); + } + dComIfGp_particle_set(dPa_name::ID_SCENE_8249, &player->current.pos); + mDoAud_seStart(JA_SE_CM_BWD_SPIT_OUT, &i_this->m3954, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } else { + local_38 = i_this->m1908[0].m04; + local_38.y = REG0_F(9) + -450.0f + l_HIO.m28; + player->setPlayerPosAndAngle(&local_38, player->shape_angle.y); + i_this->m3C1E = 0x96; + } + } + if (i_this->m18CC[0] == 0) { + cVar10 = 2; + } + break; + } + if (cVar10 != 0) { + i_this->m18AE = 1; + i_this->m18B0 = 0; + if (cVar10 == 1) { + i_this->m18D0 = 100; + } else { + i_this->m18CC[0] = 0x7a; + i_this->m18D0 = 0xde; + } + } } /* 00002F30-00003694 .text fly__FP9bwd_class */ -void fly(bwd_class*) { - /* Nonmatching */ +void fly(bwd_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + f32 dVar7; + f32 dVar8; + f32 fVar9; + cXyz local_48; + + daPy_py_c* player = daPy_getPlayerActorClass(); + if (actor->current.pos.y > 1000.0f) { + i_this->m3C50 = 2; + } + switch (i_this->m18B0) { + case 0: + if (i_this->m18CC[1] == 0) { + anm_init(i_this, BWD_BCK_BWD_FLY, 10.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + i_this->m18B0 = 1; + i_this->m18B4.x = actor->current.pos.x; + i_this->m18B4.y = l_HIO.m28 + (cM_rndFX(800.0f) + 2000.0f); + i_this->m18B4.z = actor->current.pos.z; + actor->current.angle.x = -0x4000; + i_this->m18CC[1] = REG0_F(0x12) + (cM_rndF(50.0f) + 200.0f); + i_this->m1904 = REG0_S(0) + 5; + i_this->m18D0 = REG0_S(4) + 0xb4; + } else { + i_this->m17C8 = i_this->m3954; + i_this->m17C4 = 0xff; + break; + } + case 1: + mDoAud_seStart(JA_SE_CM_BWD_FLYING, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + if ((int)i_this->m02C0->getFrame() == 2) { + mDoAud_seStart(JA_SE_CM_BWD_MOUTH_CLOSE_1, &actor->current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + if ((int)i_this->m02C0->getFrame() == 0x14) { + mDoAud_seStart(JA_SE_CV_BWD_FLYING, &actor->current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + if (i_this->m18D0 == 0x50) { + g_eff_off(i_this); + } + if (actor->current.pos.y < i_this->m3954.y) { + i_this->m17C8 = i_this->m3954; + i_this->m17C4 = 0xff; + } else { + if (i_this->m18D0 == 0) { + i_this->m17C4 = 200; + } + } + local_48 = i_this->m18B4 - actor->current.pos; + if ((local_48.abs() < REG0_F(0xe) + 500.0f) || (i_this->m18CC[0] == 0)) { + i_this->m18CC[0] = 100; + i_this->m18B4.x = cM_rndFX(REG0_F(0x10) + 1500.0f); + i_this->m18B4.y = l_HIO.m28 + (REG0_F(0xf) + 2000.0f + cM_rndFX(800.0f)); + i_this->m18B4.z = cM_rndFX(REG0_F(0x10) + 1500.0f); + i_this->m18C8 = 0.0f; + } + i_this->m18C4 = REG0_F(0x12) + 500.0f; + actor->speedF = REG0_F(0x11) + 40.0f; + if (i_this->m18CC[1] == 0) { + i_this->m18B0 = 2; + i_this->m18CC[0] = 0x96; + anm_init(i_this, BWD_BCK_BWD_JATTACK1, 5.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + mDoAud_seStart(JA_SE_CV_BWD_GO_UNDER_G, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + break; + case 2: + mDoAud_seStart(JA_SE_CM_BWD_FLYING, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + if (i_this->m02C0->isStop()) { + anm_init(i_this, BWD_BCK_BWD_JATTACK2, 2.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + } + i_this->m18B4 = player->eyePos; + local_48 = i_this->m18B4 - actor->current.pos; + if ((local_48.abs() < REG0_F(0xe) + 1000.0f) || (i_this->m18CC[0] == 0)) { + i_this->m18B0 = 3; + i_this->m18B4.y -= 10000.0f; + i_this->m18CC[0] = 200; + anm_init(i_this, BWD_BCK_BWD_JATTACK3, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + } + cLib_addCalc2(&i_this->m18C4, REG0_F(0xf) + 800.0f, 1.0f, 10.0f); + break; + case 3: + mDoAud_seStart(JA_SE_CM_BWD_FLYING, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + cLib_addCalc2(&i_this->m18C4, REG0_F(0xc) + 1200.0f, 1.0f, 20.0f); + if (i_this->m18CC[0] == 0) { + i_this->m18AE = 1; + i_this->m18B0 = 0; + i_this->m18CC[0] = 0x7a; + i_this->m18D0 = 0xde; + dVar7 = cM_rndFX(1500.0f); + dVar8 = (REG0_F(0x11) + -1500.0f + l_HIO.m28); + fVar9 = cM_rndFX(1500.0f); + actor->current.pos.x = fVar9; + actor->current.pos.y = dVar8; + actor->current.pos.z = dVar7; + } + break; + } + fly_pos_move(i_this, 0, 0); + i_this->m170C = 1; + i_this->m1BB6 = 2; } /* 00003694-00003D3C .text s_fly__FP9bwd_class */ -void s_fly(bwd_class*) { - /* Nonmatching */ +void s_fly(bwd_class* i_this) { + static f32 target_x[] = {-1500.0f, 1500.0f, 0.0f}; + static f32 target_y[] = {3500.0f, 3000.0f, 4000.0f}; + static f32 target_z[] = {-1500.0f, 1500.0f, 0.0f}; + fopAc_ac_c* actor = &i_this->actor; + f32 fVar6; + cXyz local_28; + + switch (i_this->m18B0) { + case 0: + if (i_this->m18CC[1] == 0) { + anm_init(i_this, BWD_BCK_BWD_FLY, 10.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + i_this->m18B0 = 1; + i_this->m18B4.x = 0.0f; + i_this->m18B4.y = l_HIO.m28 + 3000.0f; + i_this->m18B4.z = 0.0f; + actor->current.angle.x = -0x4000; + i_this->m18D0 = REG0_S(4) + 0xb4; + i_this->m1904 = REG0_S(0) + 5; + } else { + i_this->m17C8 = i_this->m3954; + i_this->m17C4 = 0xff; + break; + } + case 1: + mDoAud_seStart(JA_SE_CM_BWD_FLYING, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + if ((int)i_this->m02C0->getFrame() == 2) { + mDoAud_seStart(JA_SE_CM_BWD_MOUTH_CLOSE_1, &actor->current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + if ((int)i_this->m02C0->getFrame() == 20) { + mDoAud_seStart(JA_SE_CV_BWD_FLYING, &actor->current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + if (i_this->m18D0 == 0x50) { + g_eff_off(i_this); + } + if (actor->current.pos.y < i_this->m3954.y) { + i_this->m17C8 = i_this->m3954; + i_this->m17C4 = 0xff; + } else { + if (i_this->m18D0 == 0) { + i_this->m17C4 = 200; + } + } + local_28 = i_this->m18B4 - actor->current.pos; + if (local_28.abs() < REG0_F(0xe) + 500.0f) { + if (i_this->m3C24 == 3) { + i_this->m18B0 = 2; + i_this->m18CC[0] = 0x96; + anm_init(i_this, BWD_BCK_BWD_JATTACK1, 5.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + mDoAud_seStart(JA_SE_CV_BWD_GO_UNDER_G, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } else { + i_this->m18B4.x = target_x[i_this->m3C24]; + i_this->m18B4.y = target_y[i_this->m3C24]; + i_this->m18B4.z = target_z[i_this->m3C24]; + i_this->m18C8 = 0.0f; + i_this->m3C24++; + } + } + i_this->m18C4 = REG0_F(0x12) + 500.0f; + actor->speedF = REG0_F(0x11) + 40.0f; + break; + case 2: + mDoAud_seStart(JA_SE_CM_BWD_FLYING, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + if (i_this->m02C0->isStop()) { + anm_init(i_this, BWD_BCK_BWD_JATTACK2, 2.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + } + i_this->m18B4.x = 0.0f; + i_this->m18B4.y = 800.0f; + i_this->m18B4.z = 0.0f; + local_28 = i_this->m18B4 - actor->current.pos; + if (local_28.abs() < REG0_F(0xe) + 1000.0f) { + i_this->m18B0 = 3; + i_this->m18B4.y -= 10000.0f; + i_this->m18CC[0] = 200; + anm_init(i_this, BWD_BCK_BWD_JATTACK3, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + } + cLib_addCalc2(&i_this->m18C4, REG0_F(0xf) + 800.0f, 1.0f, 10.0f); + break; + case 3: + mDoAud_seStart(JA_SE_CM_BWD_FLYING, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + cLib_addCalc2(&i_this->m18C4, REG0_F(0xc) + 1200.0f, 1.0f, 20.0f); + if (i_this->m18CC[0] == 0) { + i_this->m18AE = 1; + i_this->m18B0 = 0; + i_this->m18CC[0] = 0xac; + i_this->m18D0 = 0x12e; + fVar6 = REG0_F(0x11) + -1500.0f + l_HIO.m28; + actor->current.pos.x = 0.0f; + actor->current.pos.y = fVar6; + actor->current.pos.z = 0.0f; + } + break; + } + fly_pos_move(i_this, 0, 0); + i_this->m170C = 1; + i_this->m1BB6 = 2; } /* 00003D3C-00004ABC .text end__FP9bwd_class */ -void end(bwd_class*) { - /* Nonmatching */ +void end(bwd_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + bool bVar2; + bool bVar3; + mDoExt_McaMorf* pmVar7; + JPABaseEmitter* pJVar8; + s16 uVar9; + s16 uVar10; + f32 fVar13; + cXyz local_b4; + cXyz local_c0; + + bVar2 = true; + dBgS_GndChk local_a8; + Vec pos; + pos = actor->current.pos; + pos.y += REG0_F(0xd) + 1000.0f; + local_a8.SetPos(&pos); + fVar13 = dComIfG_Bgsp()->GroundCross(&local_a8); + if (fVar13 != -G_CM3D_F_INF) { + i_this->m18DC = fVar13; + } + uVar9 = 0; + uVar10 = 0; + switch (i_this->m18B0) { + case 0: + if (dComIfGp_getStartStageName()[0] == 'X') { + dLib_setNextStageBySclsNum(0, actor->current.roomNo); + mDoAud_seStart(JA_SE_LK_B_BOSS_WARP, NULL, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + dComIfGs_onEventBit(0x3208); + dComIfGs_onTmpBit(0x480); + return; + } +#if VERSION != VERSION_USA + mDoAud_bgmStreamPrepare(JA_STRM_BWD_CLEAR); +#endif + anm_init(i_this, BWD_BCK_BWD_DEAD1, 3.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->m18B0 = 1; + i_this->m3C1E = 100; + actor->current.angle.y = 0; + fpcM_Search(ko_delete_sub, i_this); + if (i_this->m3AEC == 0) { + i_this->m3AEC = 0x28; + i_this->m3978[6].end(); + i_this->m3954.x = actor->current.pos.x; + i_this->m3954.z = actor->current.pos.z; + dComIfGp_particle_setToon( + dPa_name::ID_SCENE_A267, &i_this->m3954, &actor->shape_angle, NULL, eff_col.a, &i_this->m3978[6], (s8)actor->current.roomNo + ); + i_this->m3978[6].setColor(eff_col); + } + dComIfGp_particle_set(dPa_name::ID_SCENE_8265, &i_this->m3954, &actor->shape_angle); + pJVar8 = dComIfGp_particle_set(dPa_name::ID_SCENE_8266, &i_this->m3954); + i_this->m3968 = pJVar8; + i_this->m3C24 = 0; + mDoAud_seStart(JA_SE_CM_BWD_LAST_HEAD_BACK, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + case 1: + pJVar8 = i_this->m3968; + if (pJVar8 != NULL) { + pmVar7 = i_this->m02C0; + if (i_this->m02C0->isStop()) { + pJVar8->becomeInvalidEmitter(); + i_this->m3968 = NULL; + } else { + pJVar8->setGlobalRTMatrix(pmVar7->getModel()->getAnmMtx(0xe)); + } + } + if ((int)i_this->m02C0->getFrame() == 30) { + mDoAud_seStart(JA_SE_CM_BWD_LAST_IN_SAND, &i_this->m3954, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + if ((int)i_this->m02C0->getFrame() == 50) { + g_eff_off(i_this); + } + bVar2 = false; + bVar3 = true; + i_this->m1BB6 = 1; + if (i_this->m02C0->isStop()) { +#if VERSION == VERSION_USA + mDoAud_bgmStreamPrepare(JA_STRM_BWD_CLEAR); +#endif + anm_init(i_this, BWD_BCK_BWD_DEAD2, 3.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + actor->current.pos.y = -2000.0f; + for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m0508); i++) { + i_this->m0508[i] = actor->current.pos; + } + i_this->m18B0 = 2; + i_this->m18B4.x = 0.0f; + i_this->m18B4.y = l_HIO.m28 + 1500.0f; + i_this->m18B4.z = 0.0f; + actor->current.angle.x = -0x4000; + i_this->m18CC[1] = REG0_S(9) + 0xb4; + i_this->m1904 = REG0_S(1) + 3; + } + break; + case 2: + i_this->m1BB6 = 2; + local_b4 = i_this->m18B4 - actor->current.pos; + fVar13 = local_b4.abs(); + if ((fVar13 < REG0_F(0xe) + 500.0f) || (i_this->m18CC[0] == 0)) { + i_this->m18CC[0] = (s16)(int)cM_rndF(20.0f); + i_this->m18B4.x = cM_rndFX(REG0_F(0x10) + 1600.0f); + i_this->m18B4.y = l_HIO.m28 + (REG0_F(0xf) + 2000.0f + cM_rndFX(500.0f)); + i_this->m18B4.z = cM_rndFX(REG0_F(0x10) + 1600.0f); + } + i_this->m18C4 = REG0_F(0x12) + 1000.0f; + actor->speedF = REG0_F(0x11) + 65.0f; + if (i_this->m3C20 == 0x96) { + mDoAud_seStart(JA_SE_CV_BWD_DIE, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + if (i_this->m3C20 > 0x96) { + mDoAud_seStart(JA_SE_CM_BWD_FLYING, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + if (i_this->m18CC[1] == 0) { + i_this->m18B0 = 0x17; + i_this->m18CC[0] = 0x3c; + i_this->m18CC[1] = 0x5a; + i_this->m3C1E = 0x66; + i_this->m3C20 = 0; + i_this->m3C44 = 0.0f; + actor->speedF = 0.0f; + i_this->m18C4 = 0.0f; + mDoAud_seStart(JA_SE_CM_BWD_HARDEN, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + mDoAud_bgmStreamPlay(); + } + i_this->m18FE += REG0_S(5) + 0xc1c; + i_this->m1900 += REG0_S(5) + 0xdac; + uVar9 = ((REG0_F(0xd) + 7000.0f) * cM_ssin(i_this->m18FE)); + uVar10 = ((REG0_F(0xd) + 7000.0f) * cM_scos(i_this->m1900)); + break; + case 3: + i_this->m1BB6 = 2; + if (i_this->m18CC[0] == 0x14) { + anm_init(i_this, BWD_BCK_BWD_DEAD3, 3.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->m02C8 = 1.0f; + } + if (((i_this->m18CC[0] == 0) && ((i_this->m18AC & 3U) == 0)) && (i_this->m0414 < 0x14)) { + i_this->m03C4[i_this->m0414] = 1.0f; + i_this->m0414++; + } + if (((i_this->m18CC[1] == 0) && ((i_this->m18AC & 3U) == 0)) && (i_this->m3C24 < 0x14)) { + if (i_this->m3C24 == 0x13) { + i_this->m18B0 = 3; + i_this->m18CC[0] = 0; + mDoAud_seStart(JA_SE_CM_BWD_LAST_EXPLODE, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } else { + i_this->m3C24++; + } + } + break; + case 4: + i_this->m1BB6 = 2; + if (i_this->m18CC[0] == 0) { + i_this->m18CC[0] = 2; + local_c0.x = 2.0f; + local_c0.y = 2.0f; + local_c0.z = 2.0f; + csXyz local_d4(0, 0, 0); + local_d4.x = (s16)(int)cM_rndF(65536.0f); + local_d4.y = (s16)(int)cM_rndF(65536.0f); + dComIfGp_particle_set(dPa_name::ID_SCENE_825D, i_this->m0418 + i_this->m3C24, &local_d4, &local_c0); + dComIfGp_particle_set(dPa_name::ID_SCENE_825E, i_this->m0418 + i_this->m3C24, &local_d4, &local_c0); + mDoAud_seStart(JA_SE_CM_MONS_EXPLODE, i_this->m0418 + i_this->m3C24, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + i_this->m02D4[i_this->m3C24] = NULL; + if (i_this->m3C24 == 0) { + i_this->m18B0 = 4; + i_this->m18CC[0] = 10; + } else { + i_this->m3C24--; + } + } + break; + case 5: + bVar2 = false; + i_this->m1BB6 = 2; + if (i_this->m18CC[0] == 0) { + fopAcM_createDisappear(actor, &actor->current.pos, 0x32, daDisItem_NONE1_e, 0xff); + i_this->m18E4 = actor->current.pos; + actor->current.pos.y = -20000.0f; + i_this->m1B88.y = -20000.0f; + i_this->m3C1E = 0x68; + i_this->m3C20 = 0; + i_this->m18B0 = 5; + } + break; + case 0x17: + bVar2 = false; + i_this->m1BB6 = 2; + break; + } + if (bVar2) { + fly_pos_move(i_this, uVar9, uVar10); + i_this->m170C = 1; + } } /* 00004C54-0000527C .text control1__FP9bwd_class */ -void control1(bwd_class*) { - /* Nonmatching */ +void control1(bwd_class* i_this) { + /* Nonmatching - math */ + fopAc_ac_c* actor = &i_this->actor; + f32 fVar1; + f32 dVar8; + f32 dVar9; + f32 dVar10; + f32 dVar11; + f32 dVar12; + f32 fVar13; + cXyz local_104; + cXyz local_110; + cXyz local_11c; + cXyz local_128; + + MTXCopy(i_this->m02C0->getModel()->getAnmMtx(0x1d), *calc_mtx); + local_104.x = REG0_F(2) + -50.0f; + local_104.y = REG0_F(3); + local_104.z = REG0_F(4); + MtxPosition(&local_104, &i_this->m1908[0].m04); + s32 i = 1; + sita_s* psVar5 = &i_this->m1908[i]; + mDoMtx_YrotS(*calc_mtx, (int)actor->current.angle.y); + mDoMtx_XrotM(*calc_mtx, actor->current.angle.x); + local_104.x = 0.0f; + local_104.y = 0.0f; + local_104.z = i_this->m1BA4; + MtxPosition(&local_104, &local_11c); + local_104.z = i_this->m1BA0; + dVar9 = i_this->m1BA8; + local_128.setall(0.0f); + dBgS_GndChk local_f8; + dVar12 = 0.0f; + for (i = 1; i < 0x1d; i++, ++psVar5) { + psVar5++; + if (i_this->m1BB0 == 0) { + if (i_this->m1BB3 != 0) { + dVar9 = i_this->m1BB3 * (REG0_F(3) + 4.5f); + dVar10 = dVar9 * cM_ssin(i_this->m18AC * (REG0_S(5) + 0x1fa4) + i * (REG0_S(6) + 0xa28)); + local_110.y = (dVar9 * cM_scos(i_this->m18AC * (REG0_S(5) + 0x2198) + i * (REG0_S(6) + 0x898))); + dVar8 = dVar9 * cM_scos(i_this->m18AC * (REG0_S(5) + 0x206c) + i * (REG0_S(6) + 0x960)); + } else { + dVar10 = dVar9 * cM_ssin(i_this->m18AC * (REG0_S(5) + 0x44c) + i * (REG0_S(6) + 2000)); + if (i_this->m1BB1 != 0) { + local_110.y = -5.0f; + } else { + local_110.y = REG0_F(5) + 5.0f; + } + dVar8 = dVar9 * cM_scos(i_this->m18AC * (REG0_S(7) + 900) + i * (REG0_S(8) + 2000)); + } + local_110.z = dVar8; + local_110.x = dVar10; + MtxPosition(&local_110, &local_128); + } + fVar13 = psVar5->m04.y; + dVar10 = (local_128.y + fVar13 + local_11c.y); + if (local_110.y < dVar12) { + local_f8.m_pos.z = psVar5->m04.z; + local_f8.m_pos.y = fVar13 + 200.0f; + local_f8.m_pos.x = psVar5->m04.x; + fVar13 = dComIfG_Bgsp()->GroundCross(&local_f8); + dVar8 = (REG0_F(0x10) + fVar13 + 30.0f); + if (dVar10 <= dVar8) { + dVar10 = dVar8; + } + } + dVar8 = local_128.x + local_11c.x + (psVar5->m04.x - psVar5[-1].m04.x); + dVar11 = (dVar10 - psVar5[-1].m04.y); + fVar1 = local_128.z + local_11c.z + (psVar5->m04.z - psVar5[-1].m04.z); + dVar10 = fVar1; + s16 iVar3; + int iVar2 = cM_atan2s(dVar8, fVar1); + iVar3 = -cM_atan2s(dVar11, std::sqrtf((dVar8 * dVar8) + (dVar10 * dVar10))); + MtxPush(); + mDoMtx_YrotS(*calc_mtx, iVar2); + mDoMtx_XrotM(*calc_mtx, -iVar3); + MtxPosition(&local_104, &local_110); + MtxPull(); + psVar5->m04 = psVar5[-1].m04 + local_110; + } } /* 0000527C-00005438 .text control2__FP9bwd_class */ -void control2(bwd_class*) { - /* Nonmatching */ +void control2(bwd_class* i_this) { + cXyz rel_offset, abs_offset; + rel_offset.x = 0; + rel_offset.y = 0; + rel_offset.z = i_this->m1BA0; + i_this->m1908[29].m04 = i_this->m1B88; + + int i = 28; + s16 Yangle; + int XZangle; + sita_s* sita_i = &i_this->m1908[i]; + for (i = 28; i >= 1; i--, sita_i--) { + f32 delta_pos_x = sita_i->m04.x - sita_i[1].m04.x; + f32 delta_pos_y = sita_i->m04.y - sita_i[1].m04.y; + f32 delta_pos_z = sita_i->m04.z - sita_i[1].m04.z; + XZangle = cM_atan2s(delta_pos_x, delta_pos_z); + Yangle = -cM_atan2s(delta_pos_y, std::sqrtf(delta_pos_x * delta_pos_x + delta_pos_z * delta_pos_z)); + mDoMtx_YrotS(*calc_mtx, XZangle); + mDoMtx_XrotM(*calc_mtx, Yangle); + MtxPosition(&rel_offset, &abs_offset); + sita_i->m04 = sita_i[1].m04 + abs_offset; + } } /* 00005438-00005D78 .text sita_move__FP9bwd_class */ -void sita_move(bwd_class*) { - /* Nonmatching */ +void sita_move(bwd_class* i_this) { + /* Nonmatching - "dVar9 = dVar8;" */ + fopAc_ac_c* actor = &i_this->actor; + fopAc_ac_c* pfVar2; + f32 dVar7; + f32 dVar8; + f32 dVar9; + f32 fVar10; + cXyz local_c8; + cXyz local_d4; + cXyz local_f8; + + if (i_this->m1BB3 != 0) { + i_this->m1BB3--; + } + local_c8.x = (REG0_F(0xd) + 100.0f) * cM_ssin(i_this->m18AC * (REG0_S(5) + 0x44c)); + local_c8.y = REG0_F(0) + 600.0f + (REG0_F(0xe) + 50.0f) * cM_ssin(i_this->m18AC * (REG0_S(4) + 700)); + local_c8.z = (REG0_F(0xd) + 100.0f) * cM_ssin(i_this->m18AC * (REG0_S(7) + 900)); + local_f8 = i_this->m1908[0].m04 + local_c8; + if (i_this->m1B88.y < i_this->m3954.y) { + fopAcM_OffStatus(actor, 0); + actor->attention_info.flags = 0; + } + dVar8 = 0.1f; + dVar9 = ((REG0_F(7) + 100.0f) * i_this->m1BAC); + if (i_this->m1BB0 != 0) { + pfVar2 = fopAcM_SearchByID(i_this->m1BBC); + if ((pfVar2 == NULL) || (!daPy_getPlayerLinkActorClass()->checkHookshotReturn())) { + i_this->m1BB0 = 0; + } else { + i_this->m18D6 = 5; + local_f8 = pfVar2->current.pos; + dVar8 = 1.0f; + dVar9 = 200.0f; + if (i_this->m1BA0 > REG0_F(2) + 50.0f) { + i_this->m1BB0 = 0; + } + } + i_this->m1BAC = 0.0f; + i_this->m1BB1 = (s8)l_HIO.m14; + i_this->m1B94 = i_this->m1B88; + } else { + if (i_this->m1BB1 != 0) { + i_this->m1BB1--; + dBgS_GndChk local_bc; + Vec pos; + pos = i_this->m1B88; + pos.y += 200.0f; + local_bc.SetPos(&pos); + fVar10 = REG0_F(0x10) + dComIfG_Bgsp()->GroundCross(&local_bc) + 30.0f; + if (fVar10 != -G_CM3D_F_INF) { + cLib_addCalc2(&i_this->m1B88.y, fVar10, 0.1f, REG0_F(0xb) + 2.0f); + } + if (i_this->m1BB3 != 0) { + dVar8 = i_this->m1BB3 * (REG0_F(3) + 3.0f); + local_d4.x = (dVar8 * cM_ssin(i_this->m18AC * (REG0_S(5) + 0x1fa4))); + local_d4.y = (dVar8 * cM_ssin(i_this->m18AC * (REG0_S(5) + 0x2260))); + local_d4.z = (dVar8 * cM_ssin(i_this->m18AC * (REG0_S(5) + 0x206c))); + dVar8 = 1.0f; + dVar9 = dVar8; + local_f8 = i_this->m1B94 + local_d4; + } else { + local_f8 = i_this->m1B94; + } + } else { + cLib_addCalc2(&i_this->m1BAC, 1.0f, 1.0f, 0.01f); + } + if (i_this->m1BB2 != 0) { + i_this->m1BB2--; + local_c8.x = (REG0_F(0x11) + 400.0f) * cM_ssin((int)i_this->m18AC * (REG0_S(5) + 0xc1c)); + local_c8.y = 400.0f; + local_c8.z = (REG0_F(0x11) + 400.0f) * cM_ssin((int)i_this->m18AC * (REG0_S(7) + 0x1324)); + local_f8 = i_this->m1908[0].m04 + local_c8; + dVar8 = 1.0f; + dVar9 = 200.0f; + } + } + local_c8 = i_this->m1B88 - i_this->m1908[0].m04; + fVar10 = local_c8.abs(); + dVar7 = ((REG0_F(2) + 0.035f) * fVar10); + if (i_this->m1BB6 != 0) { + local_f8 = i_this->m1908[0].m04; + dVar8 = 1.0f; + dVar9 = 50.0f; + if (i_this->m1BB6 != 2) { + fopAcM_OffStatus(actor, 0); + actor->attention_info.flags = 0; + } + if (dVar7 < (REG0_F(1) + 20.0f)) { + dVar7 = (REG0_F(1) + 20.0f); + } + } + cLib_addCalc2(&i_this->m1B88.x, local_f8.x, dVar8, dVar9); + cLib_addCalc2(&i_this->m1B88.y, local_f8.y, dVar8, dVar9); + cLib_addCalc2(&i_this->m1B88.z, local_f8.z, dVar8, dVar9); + cLib_addCalc2(&i_this->m1BA0, dVar7, 1.0f, 2.0f); + i_this->m1BA8 = REG0_F(3) + 10.0f; + control1(i_this); + control2(i_this); + sita_s* psVar5 = i_this->m1908; + for (s32 i = 0; i < 30; i++, ++psVar5) { + MtxTrans(psVar5->m04.x, psVar5->m04.y, psVar5->m04.z, false); + fVar10 = (1.0f + REG0_F(9)) + (0.2f + REG0_F(9)) * cM_scos((int)i_this->m18AC * (REG0_S(7) + 1000) + i * (REG0_S(8) + 2000)); + MtxScale(fVar10, fVar10, fVar10, true); + psVar5->m00->setBaseTRMtx(*calc_mtx); + if (i == 29) { + actor->eyePos = psVar5->m04; + actor->attention_info.position = actor->eyePos; + actor->attention_info.position.y += 20.0f; + i_this->mCcD_Sph.SetC(psVar5->m04); + dComIfG_Ccsp()->Set(&i_this->mCcD_Sph); + } else if ((((i == 0) || (i == 6)) || (i == 12)) || (i == 18 || (i == 24))) { + i_this->mCcD_Sph_Array5[i / 6].SetC(psVar5->m04); + dComIfG_Ccsp()->Set(&i_this->mCcD_Sph_Array5[i / 6]); + } + } } /* 00005D78-00005DFC .text move__FP9bwd_class */ -void move(bwd_class*) { - /* Nonmatching */ +void move(bwd_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + actor->attention_info.flags = fopAc_Attn_LOCKON_BATTLE_e; + switch (i_this->m18AE) { + case 0: + start(i_this); + break; + case 1: + wait(i_this); + break; + case 2: + reset(i_this); + break; + case 3: + sita_hit(i_this); + break; + case 5: + eat_attack(i_this); + break; + case 10: + fly(i_this); + break; + case 11: + s_fly(i_this); + break; + case 12: + end(i_this); + case 13: + break; + } } /* 00005DFC-00007320 .text demo_camera__FP9bwd_class */ -void demo_camera(bwd_class*) { - /* Nonmatching */ +void demo_camera(bwd_class* i_this) { + /* Nonmatching - regalloc */ + fopAc_ac_c* actor = &i_this->actor; + f32 fVar1; + f32 fVar2; + s16 sVar3; + camera_class* pcVar4; + fopAc_ac_c* pfVar7; + camera_class* pcVar11; + f32 dVar13; + cXyz local_98; + cXyz local_a4; + cXyz local_b0; + + daPy_py_c* player = daPy_getPlayerActorClass(); + pcVar11 = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); + switch (i_this->m3C1E) { + case 0: + case 1: + if (!actor->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, dEvtFlag_STAFF_ALL_e, 0xFFFF, 0); + actor->eventInfo.onCondition(dEvtCnd_UNK2_e); + return; + } + i_this->m3C1E++; + pcVar4 = dComIfGp_getCamera(0); + i_this->m3C28 = pcVar4->mLookat.mEye; + i_this->m3C34 = pcVar4->mLookat.mCenter; + pcVar11->mCamera.Stop(); + pcVar11->mCamera.SetTrimSize(2); + i_this->m3C20 = 0; + i_this->m3C22 = 0; + i_this->m3C48 = 55.0f; + i_this->m3C44 = 0.0f; + i_this->m3C1C = 0x96; + local_98.x = 0.0f; + local_98.y = 5000.0f; + local_98.z = 0.0f; + player->setPlayerPosAndAngle(&local_98, (int)player->shape_angle.y); + mDoMtx_YrotS(*calc_mtx, (int)actor->shape_angle.y); + local_98.x = 0.0f; + local_98.y = REG0_F(6) + 500.0f; + local_98.z = REG0_F(7) + 1500.0f; + MtxPosition(&local_98, &local_a4); + local_a4 += actor->current.pos; + cLib_addCalc2(&i_this->m3C28.x, local_a4.x, 0.1f, 50.0f); + cLib_addCalc2(&i_this->m3C28.y, local_a4.y, 0.1f, 50.0f); + cLib_addCalc2(&i_this->m3C28.z, local_a4.z, 0.1f, 50.0f); + local_98.x = 0.0f; + local_98.y = REG0_F(8) + 400.0f; + local_98.z = REG0_F(9); + MtxPosition(&local_98, &local_a4); + local_a4 += actor->current.pos; + cLib_addCalc2(&i_this->m3C34.x, local_a4.x, 0.1f, 50.0f); + cLib_addCalc2(&i_this->m3C34.y, local_a4.y, 0.1f, 50.0f); + cLib_addCalc2(&i_this->m3C34.z, local_a4.z, 0.1f, 50.0f); + break; + case 2: + local_a4 = player->current.pos; + local_a4.y += 100.0f; + cLib_addCalc2(&i_this->m3C34.x, local_a4.x, 0.1f, 100.0f); + cLib_addCalc2(&i_this->m3C34.y, local_a4.y, 0.1f, 100.0f); + cLib_addCalc2(&i_this->m3C34.z, local_a4.z, 0.1f, 100.0f); + if (0x3c < i_this->m3C20) { + i_this->m3C1E = 0x96; + } + break; + case 3: + case 4: + if (!actor->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, dEvtFlag_STAFF_ALL_e, 0xFFFF, 0); + actor->eventInfo.onCondition(dEvtCnd_UNK2_e); + return; + } + pcVar11->mCamera.Stop(); + pcVar11->mCamera.SetTrimSize(2); + i_this->m3C1E = 0x33; + i_this->m3C20 = 0; + i_this->m3C22 = 0; + i_this->m3C48 = 55.0f; + i_this->m3C44 = 0.0f; + player->changeOriginalDemo(); + mDoAud_bgmStreamPlay(); + i_this->m3C1C = 100; + fVar2 = REG0_F(0) + 500.0f; + i_this->m3C34.x = 0.0f; + i_this->m3C34.y = fVar2; + i_this->m3C34.z = 0.0f; + fVar2 = REG0_F(3) + 3575.0f; + fVar1 = REG0_F(2) + 388.0f; + i_this->m3C28.x = REG0_F(1) + 200.0f; + i_this->m3C28.y = fVar1; + i_this->m3C28.z = fVar2; + local_98.y = player->current.pos.y; + local_98.x = 0.0f; + local_98.z = REG0_F(4) + 3000.0f; + player->setPlayerPosAndAngle(&local_98, -0x8000); + if (i_this->m3C20 >= 0x1E) { + if (i_this->m3C20 == 0x1E) { + dComIfGp_getVibration().StartQuake(REG0_S(5) + 3, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + } + i_this->m3C4C = REG0_F(5) + 3.0f; + if (i_this->m3C20 == 0x32) { + player->changeDemoMode(daPy_demo_c::DEMO_UNK_028_e); + } + } + if ((int)i_this->m3C22 != REG0_S(3) + 0xaa) { + break; + } + i_this->m3C1E = 0x34; + i_this->m3C20 = 0; + i_this->m3C15 = 1; + i_this->m3C4C = REG0_F(5) + 3.5f; + i_this->m1864 = 10; + sVar3 = i_this->m3C20; + if (sVar3 >= 0x96) { + if (sVar3 == 0x96) { + fVar2 = REG0_F(8) + 597.0f; + i_this->m3C34.x = 25.0f; + i_this->m3C34.y = fVar2; + i_this->m3C34.z = 1578.0f; + } + i_this->m3C34.x = i_this->m3C34.x - (REG0_F(4) + 0.5f); + i_this->m3C28.x = -156.0f; + i_this->m3C28.y = 767.0f; + i_this->m3C28.z = 2148.0f; + } else { + if (sVar3 == 0x14) { + i_this->m17E4[1] = 1; + for (s32 i = 0; i < (s32)ARRAY_SIZE(suna_gr_pos); i++) { + mDoAud_seStart(JA_SE_OBJ_BWD_SANDFALL_S, &suna_gr_pos[i], 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + } + i_this->m3C34.x = -1110.0f; + i_this->m3C34.y = 1598.0f; + i_this->m3C34.z = -45.0f; + i_this->m3C28.x = -4426.0f; + i_this->m3C28.y = 2574.0f; + i_this->m3C28.z = 888.0f; + // fallthrough + } + case 0xA: + if ((int)i_this->m3C22 != REG0_S(5) + 0x280) { + break; + } + i_this->m3C1E = 0x35; + i_this->m3C20 = 0; + i_this->m3C48 = 45.0f; + i_this->m17E0 = 900.0f; + local_98.set(player->current.pos.x, player->current.pos.y + 400.0f, player->current.pos.z); + player->setPlayerPosAndAngle(&local_98, -0x8000); + // fallthrough + case 0x32: + sVar3 = i_this->m3C20; + if ((sVar3 < 0x46) || (sVar3 < (s16)(REG0_S(8) + 0x5a))) { + if (sVar3 == 0x55) { + player->changeDemoMode(daPy_demo_c::DEMO_S_SURP_e); + } + i_this->m3C34.set(player->current.pos.x, (player->eyePos.y + REG0_F(6)) - 30.0f, player->current.pos.z); + i_this->m3C28.set(player->current.pos.x + REG0_F(7), (player->eyePos.y + REG0_F(8)) - 30.0f, (player->current.pos.z - 200.0f) + REG0_F(9)); + } else { + i_this->m3C34.x = 6.0f; + i_this->m3C34.y = 1166.0f; + i_this->m3C34.z = -319.0f; + i_this->m3C28.x = 180.0f; + i_this->m3C28.y = 1362.0f; + i_this->m3C28.z = 3253.0f; + cLib_addCalc2(&i_this->m3C48, 55.0f, 0.1f, 0.1f); + } + // fallthrough + case 0x34: + if (i_this->m3C22 < 0x2ee) { + i_this->m3C4C = REG0_F(5) + 3.0f; + } + if ((int)i_this->m3C22 != REG0_S(3) + 0x2f8) { + break; + } + i_this->m3C1E = 0x3c; + i_this->m3C20 = 0; + dComIfGp_getVibration().StopQuake(-1); + i_this->m3C1C = 200; + // fallthrough + case 0x35: + if (2 < i_this->m3C1C) { + cLib_addCalcAngleS2(&i_this->m3C1C, 1, 1, 1); + } + cLib_addCalc2(&i_this->m3C34.x, actor->current.pos.x, 0.1f, 100.0f); + local_98.y = i_this->m1908[0].m04.y + REG0_F(10) + 200.0f; + fVar2 = REG0_F(0xc) + -200.0f + 300.0f + l_HIO.m28; + if (local_98.y < fVar2) { + local_98.y = fVar2; + } + cLib_addCalc2(&i_this->m3C34.y, local_98.y, 0.1f, 100.0f); + cLib_addCalc2(&i_this->m3C34.z, actor->current.pos.z, 0.1f, 100.0f); + cLib_addCalc2(&i_this->m3C28.x, actor->current.pos.x * 0.5f, 0.05f, 50.0f); + cLib_addCalc2(&i_this->m3C28.y, l_HIO.m28 + 100.0f + REG0_F(0xf) + 300.0f, 0.1f, 50.0f); + cLib_addCalc2(&i_this->m3C28.z, ((actor->current.pos.z + 1700.0f + 500.0f) - 200.0f) + REG0_F(9), 0.05f, 50.0f); + if ((int)i_this->m3C22 == REG0_S(4) + 0x5b4) { + i_this->m3C1E = 0x96; + if (dComIfGp_getStartStageName()[0] == 'X') { + mDoAud_bgmStart(JA_BGM_PAST_RANE); + } else { + mDoAud_bgmStart(JA_BGM_RANE_BATTLE); + } + i_this->m3C50 = 1; + g_dComIfG_gameInfo.save.getMemory().getBit().onStageBossEnemy(); + } + break; + case 0x3C: + if (!actor->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, dEvtFlag_STAFF_ALL_e, 0xFFFF, 0); + actor->eventInfo.onCondition(dEvtCnd_UNK2_e); + return; + } + pcVar11->mCamera.Stop(); + pcVar11->mCamera.SetTrimSize(2); + i_this->m3C1E = 0x65; + i_this->m3C20 = 0; + i_this->m3C22 = 0; + i_this->m3C48 = 55.0f; + pcVar4 = dComIfGp_getCamera(0); + i_this->m3C28 = pcVar4->mLookat.mEye; + i_this->m3C34 = pcVar4->mLookat.mCenter; + i_this->m3C44 = 0.0f; + player->changeOriginalDemo(); + set_pos.x = actor->current.pos.x - 100.0f; + set_pos.y = player->current.pos.y; + set_pos.z = actor->current.pos.z + 777.0f; + i_this->m3C1C = 0x96; + // fallthrough + case 0x64: { + dBgS_GndChk local_8c; + Vec pos; + pos = set_pos; + pos.y += 1000.0f; + local_8c.SetPos(&pos); + fVar1 = dComIfG_Bgsp()->GroundCross(&local_8c); + if (fVar1 != -G_CM3D_F_INF) { + set_pos.y = pos.y; + } else { + set_pos.y = 3000.0f; + } + player->setPlayerPosAndAngle(&set_pos, -0x8000); + } // fallthrough + case 0x65: + cLib_addCalc2(&i_this->m3C34.x, actor->current.pos.x, 0.1f, 100.0f); + local_98.y = i_this->m1908[0].m04.y + REG0_F(10) + 200.0f; + fVar2 = REG0_F(0xc) + -200.0f + 300.0f + l_HIO.m28; + if (local_98.y < fVar2) { + local_98.y = fVar2; + } + cLib_addCalc2(&i_this->m3C34.y, local_98.y, 0.1f, 100.0f); + cLib_addCalc2(&i_this->m3C34.z, actor->current.pos.z, 0.1f, 100.0f); + cLib_addCalc2(&i_this->m3C28.x, actor->current.pos.x, 0.05f, 50.0f); + cLib_addCalc2(&i_this->m3C28.y, l_HIO.m28 + 100.0f + REG0_F(0xf) + 300.0f, 0.1f, 50.0f); + cLib_addCalc2(&i_this->m3C28.z, actor->current.pos.z + 1700.0f + 500.0f + REG0_F(9), 0.05f, 50.0f); + cLib_addCalcAngleS2(&i_this->m3C1C, 1, 1, 1); + break; + case 0x67: + cLib_addCalc2(&i_this->m3C34.x, i_this->m0418[i_this->m3C24].x, 0.1f, i_this->m3C44 * 200.0f); + cLib_addCalc2(&i_this->m3C34.y, i_this->m0418[i_this->m3C24].y, 0.1f, i_this->m3C44 * 200.0f); + cLib_addCalc2(&i_this->m3C34.z, i_this->m0418[i_this->m3C24].z, 0.1f, i_this->m3C44 * 200.0f); + cLib_addCalc2(&i_this->m3C44, 1.0f, 1.0f, 0.02f); + if (i_this->m3C20 == 0x32) { + player->changeDemoMode(daPy_demo_c::DEMO_LOOKUP_e); + } + break; + case 0x68: + i_this->m3C48 = REG0_F(6) + 55.0f; + if (i_this->m3C20 == 0x14) { + local_b0.x = 1.0f; + local_b0.y = 1.0f; + local_b0.z = 1.0f; + i_this->m18E0 = fopAcM_createItemForBoss(&i_this->m18E4, 0, fopAcM_GetRoomNo(actor), NULL, &local_b0, 1); + } + if (i_this->m3C20 >= 0x2C) { + i_this->m3C1E = 0x69; + i_this->m3C20 = 0; + } + break; + case 0x6A: + i_this->m3C28.x = (player->current.pos.x - 300.0f) + REG0_F(8); + i_this->m3C28.y = (player->current.pos.y - 50.0f) + REG0_F(9) + 100.0f + 100.0f; + i_this->m3C28.z = (player->current.pos.z - 600.0f) + REG0_F(10); + i_this->m3C34.x = player->current.pos.x + REG0_F(0xb); + i_this->m3C34.y = player->current.pos.y + REG0_F(0xc); + i_this->m3C34.z = (player->current.pos.z - 350.0f) + REG0_F(0xd); + pfVar7 = fopAcM_SearchByID(i_this->m18E0); + if ((i_this->m3C20 < 10) && (pfVar7 != NULL)) { + pfVar7->current.pos.set(player->current.pos.x, player->current.pos.y + 300.0f, player->current.pos.z - 350.0f); + pfVar7->speed.setall(0.0f); + } + if (i_this->m3C20 == 0x14) { + player->changeDemoMode(daPy_demo_c::DEMO_SURPRISED_e); + } + if (i_this->m3C20 == 0x3a) { + player->changeDemoMode(daPy_demo_c::DEMO_UNK_029_e); + } + if ((i_this->m3C20 >= 0x78) && (REG0_S(3) == 0)) { + i_this->m3C1E = 0x6a; + i_this->m3C20 = 0; + actor->current.angle.y = 0; + i_this->m17C8.x = 0.0f; + i_this->m17C8.z = 0.0f; + i_this->m17C4 = 0xca; + i_this->m1865 = 0; + i_this->m3C15 = 5; + i_this->m3C1C = 100; + } + break; + case 0x96: + if (i_this->m3C20 == 0x32) { + i_this->m17E4[0]++; + } + if (i_this->m3C20 == 0x6e) { + i_this->m17E4[1]++; + } + cLib_addCalc2(&i_this->m17E0, REG0_F(7) + 400.0f, 0.1f, 1.0f); + i_this->m3C34.x = 0.0f; + i_this->m3C34.z = 0.0f; + i_this->m3C34.y = REG0_F(0xc) + 200.0f; + actor->current.angle.y = actor->current.angle.y + (int)i_this->m3C44; + if ((int)i_this->m3C20 < REG0_S(6) + 400) { + cLib_addCalc2(&i_this->m3C44, 40.0f, 1.0f, 0.5f); + } + if ((int)i_this->m3C20 > REG0_S(6) + 600) { + cLib_addCalc2(&i_this->m3C44, 0.0f, 1.0f, 0.5f); + } + mDoMtx_YrotS(*calc_mtx, (int)actor->current.angle.y); + local_98.x = 0.0f; + local_98.y = REG0_F(0xd) + 1200.0f; + local_98.z = REG0_F(0xe) + 2600.0f; + MtxPosition(&local_98, &i_this->m3C28); + if ((int)i_this->m3C20 == REG0_S(6) + 0x208) { + i_this->m17C4 = 200; + g_dComIfG_gameInfo.save.getMemory().getBit().onStageBossEnemy(); + local_98.x = 0.0f; + local_98.y = 300.0f; + local_98.z = 0.0f; + fopAcM_createWarpFlower(&local_98, 0, fopAcM_GetRoomNo(actor), 0); + i_this->m3C50 = 0; + } + if ((int)i_this->m3C20 != REG0_S(6) + 0x2a8) { + break; + } + i_this->m3C1E = 0x96; + dComIfGp_event_onEventFlag(8); + i_this->m3C1E = 0; + pcVar11->mCamera.Reset(i_this->m3C34, i_this->m3C28); + pcVar11->mCamera.Start(); + pcVar11->mCamera.SetTrimSize(0); + i_this->m3C1C = 1; + break; + } + if (i_this->m3C1E != 0) { + local_a4.x = i_this->m3C28.x + i_this->m3C4C * cM_ssin(i_this->m3C20 * 0x3300); + local_a4.y = i_this->m3C28.y + i_this->m3C4C * cM_scos(i_this->m3C20 * 0x3000); + local_a4.z = i_this->m3C28.z; + local_b0.x = i_this->m3C34.x + i_this->m3C4C * cM_ssin(i_this->m3C20 * 0x3300); + dVar13 = local_b0.x; + local_b0.y = i_this->m3C34.y + i_this->m3C4C * cM_scos(i_this->m3C20 * 0x3000); + local_b0.z = i_this->m3C34.z; + sVar3 = (i_this->m3C4C * cM_scos(i_this->m18AC * 0x1c00) * 7.5f); + pcVar11->mCamera.Set(local_a4, local_b0, sVar3, i_this->m3C48); + cLib_addCalc0(&i_this->m3C4C, 1.0f, (REG0_F(0x10) + 2.0f)); + JUTReport(410, 410, "K MAIN COUNT %d", i_this->m3C22); + JUTReport(410, 430, "K SUB COUNT %d", i_this->m3C20); + i_this->m3C20++; + i_this->m3C22++; + } + if ((i_this->m3C1E >= 0x32) && (i_this->m3C1E < 100)) { + if ((i_this->m3C22 > 0x28) && (i_this->m3C22 < 0x2da)) { + mDoAud_seStart(JA_SE_ATM_JINARI, NULL, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + if ((i_this->m3C22 > 0x154) && (i_this->m3C22 < 700)) { + mDoAud_seStart(JA_SE_ATM_BWD_SAND_FLOW, ¢er_pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + } + if (((i_this->m3C1E >= 100) && (i_this->m3C22 >= 700)) && (i_this->m3C22 <= 0x4b0)) { + mDoAud_seStart(JA_SE_ATM_BWD_SAND_EBB, ¢er_pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } } /* 00007320-000074A4 .text bwd_kankyo__FP9bwd_class */ -void bwd_kankyo(bwd_class*) { - /* Nonmatching */ +void bwd_kankyo(bwd_class* i_this) { + if (i_this->m3C14 != 0) { + i_this->m3C14--; + } + switch (i_this->m3C15) { + case 0: + dKy_custom_colset(0, 1, 0.0f); + break; + case 1: + dKy_custom_colset(0, 1, i_this->m3C18); + cLib_addCalc2(&i_this->m3C18, 1.0f, 1.0f, 0.01f); + break; + case 2: + dKy_custom_colset(1, 2, i_this->m3C18); + cLib_addCalc2(&i_this->m3C18, 1.0f, 1.0f, 0.05f); + if (i_this->m3C14 == 0) { + if (i_this->m18AE == 0xc) { + i_this->m3C15 = 4; + } else { + i_this->m3C15 = 3; + } + } + break; + case 3: + dKy_custom_colset(1, 2, i_this->m3C18); + cLib_addCalc0(&i_this->m3C18, 1.0f, 0.02f); + break; + case 4: + dKy_custom_colset(3, 2, i_this->m3C18); + cLib_addCalc0(&i_this->m3C18, 1.0f, 0.02f); + break; + case 5: + dKy_custom_colset(3, 4, i_this->m3C18); + cLib_addCalc2(&i_this->m3C18, 1.0f, 1.0f, 0.02f); + break; + } } /* 000074A4-00008C24 .text daBwd_Execute__FP9bwd_class */ -static BOOL daBwd_Execute(bwd_class*) { - /* Nonmatching */ +static BOOL daBwd_Execute(bwd_class* i_this) { + /* Nonmatching - regalloc */ + static s32 jno[] = {0x10, 0x12, 0x13, 0x17, 0x19, 0x1A, 0x04, 0x07, 0x0B}; + static f32 jsize[] = {180.0f, 120.0f, 90.0f, 180.0f, 120.0f, 90.0f, 230.0f, 150.0f, 150.0f}; + static s16 demo_ang[] = {0x3E80, 0xBB80}; + fopAc_ac_c* actor = &i_this->actor; + u8 uVar1; + s8 sVar2; + f32 fVar4; + uint uVar5; + int iVar8; + int iVar10; + J3DAnmTextureSRTKey* pJVar11; + int iVar13; + J3DModel* pJVar14; + int iVar15; + int iVar16; + uint uVar18; + int iVar19; + int iVar20; + cM3dGSph* sph; + int iVar21; + int iVar22; + f32 dVar24; + f32 fVar26; + cXyz local_110; + cXyz cStack_11c; + cXyz local_128; + + daPy_py_c* player = daPy_getPlayerActorClass(); + if (dComIfGp_getStartStageName()[0] == 'X') { + i_this->m3C1C = 0x32; + } + calc_mtx = mtx; + if (i_this->m3C50 != 0) { + if (i_this->m3C50 == 2) { + dCam_getBody()->SetTypeForce("Boss03", NULL); + i_this->m3C50 = 1; + } else { + dCam_getBody()->SetTypeForce("WindBoss", NULL); + } + } + dBgS_GndChk local_104; + Vec pos; + pos = actor->current.pos; + pos.x += REG0_F(0xd) + 5500.0f; + local_104.SetPos(&pos); + fVar26 = dComIfG_Bgsp()->GroundCross(&local_104); + if ((fVar26 < 850.0f) && (fVar26 != -G_CM3D_F_INF)) { + i_this->m3954.y = fVar26; + } + i_this->m1BB6 = 0; + ko_count = 0; + for (s32 i = 0; i < 22; i++) { + if (l_HIO.m26 > 0) { + ko_ac[i] = NULL; + } + } + fpcM_Search(ko_s_sub, i_this); + if (i_this->m1710 > 1) { + i_this->m1710--; + } + if ((ko_count == 0) && (i_this->m1710 == 1)) { + if (dComIfGp_getStartStageName()[0] == 'X') { + mDoAud_bgmStart(JA_BGM_PAST_RANE); + } else { + mDoAud_bgmStart(JA_BGM_RANE_BATTLE); + } + i_this->m1710 = 0; + } + local_110 = player->current.pos - actor->current.pos; + fVar26 = local_110.abs(); + i_this->m1BB8 = fVar26; + i_this->m170C = 0; + i_this->m18AC++; + for (s32 i = 0; i < 5; i++) { + if (i_this->m18CC[i] != 0) { + i_this->m18CC[i]--; + } + } + if (i_this->m18D6 != 0) { + i_this->m18D6--; + } + if (i_this->m18FC != 0) { + i_this->m18FC--; + } + if (l_HIO.m05 == 0) { + move(i_this); + i_this->m02C0->play(&actor->eyePos, 0, 0); + local_110.x = 0.0f; + local_110.y = 0.0f; + local_110.z = REG0_F(0) + -200.0f; + mDoMtx_YrotS(*calc_mtx, (int)actor->current.angle.y); + mDoMtx_XrotM(*calc_mtx, actor->current.angle.x); + MtxPosition(&local_110, &cStack_11c); + local_110 = (actor->current.pos + cStack_11c) - i_this->m18F0; + iVar8 = cM_atan2s(local_110.x, local_110.z); + i_this->m1108[i_this->m1708].y = (s16)iVar8; + fVar26 = std::sqrtf(local_110.x * local_110.x + local_110.z * local_110.z); + i_this->m1108[i_this->m1708].x = -cM_atan2s(local_110.y, fVar26); + fVar26 = cM_ssin(i_this->m1902); + fVar4 = REG0_F(0xf) + 5000.0f; + iVar8 = fVar4 * fVar26; + i_this->m1902 += REG0_S(7) + 1000; + i_this->m1108[i_this->m1708].z = actor->current.angle.z + iVar8; + i_this->m0508[i_this->m1708] = actor->current.pos + cStack_11c; + (i_this->m18F0) = actor->current.pos + cStack_11c; + if (i_this->m170C != 0) { + for (s32 i = 0; i < 20; i++) { + if (i_this->m02D4[i] != 0) { + uVar18 = i_this->m1708 - (i + 1) * i_this->m1904; + uVar5 = uVar18 & 0xff; + mDoMtx_stack_c::transS(i_this->m0508[uVar5].x, i_this->m0508[uVar5].y, i_this->m0508[uVar5].z); + uVar18 = uVar18 & 0xff; + mDoMtx_stack_c::YrotM(i_this->m1108[uVar18].y); + mDoMtx_stack_c::XrotM(i_this->m1108[uVar18].x); + mDoMtx_stack_c::ZrotM(i_this->m1108[uVar18].z); + fVar26 = (REG0_F(2) + 1.1f) - (s32)i * 0.02f; + mDoMtx_stack_c::scaleM(fVar26, fVar26, 1.0f); + i_this->m02D4[i]->setBaseTRMtx(mDoMtx_stack_c::get()); + MTXCopy(mDoMtx_stack_c::get(), *calc_mtx); + local_110.x = REG0_F(0xd); + local_110.y = REG0_F(0xe); + local_110.z = REG0_F(0xf); + MtxPosition(&local_110, &i_this->m0418[i]); + if (((i & 1) == 0) && (i_this->m03C4[i] < 0.1f)) { + dComIfGp_particle_setSimple(dPa_name::ID_SCENE_8241, &i_this->m0418[i], 0xff, g_whiteColor, g_whiteColor, 0); + } + i_this->m0374[i]->setPlaySpeed(i_this->m03C4[i]); + i_this->m0374[i]->play(); + } + } + } + if (actor->speedF > 1.0f) { + i_this->m1708++; + i_this->m1708 = i_this->m1708 & 0xff; + } + } + actor->shape_angle = actor->current.angle; + pJVar14 = i_this->m02C0->getModel(); + mDoMtx_stack_c::transS(actor->current.pos.x, actor->current.pos.y, actor->current.pos.z); + mDoMtx_stack_c::YrotM(actor->shape_angle.y); + mDoMtx_stack_c::XrotM(actor->shape_angle.x); + mDoMtx_stack_c::ZrotM(actor->shape_angle.z); + if (((i_this->m18AE == 10) || (i_this->m18AE == 0xb)) || ((i_this->m18AE == 0xc) && (i_this->m18B0 >= 2))) { + fVar26 = 1.0f; + } else { + fVar26 = l_HIO.m20; + } + mDoMtx_stack_c::scaleM(fVar26, fVar26, fVar26); + pJVar14->setBaseTRMtx(mDoMtx_stack_c::get()); + i_this->m02C0->calc(); + sita_move(i_this); + damage_check(i_this); + static cXyz joffset[] = { + cXyz(100.0f, 0.0f, 0.0f), + cXyz(100.0f, 0.0f, 0.0f), + cXyz(100.0f, 0.0f, 0.0f), + cXyz(100.0f, 0.0f, -100.0f), + cXyz(100.0f, 0.0f, -100.0f), + cXyz(100.0f, 0.0f, -100.0f), + cXyz(0.0f, 0.0f, 0.0f), + cXyz(0.0f, 0.0f, 0.0f), + cXyz(0.0f, 0.0f, 0.0f), + }; + for (s32 i = 0; i < (s32)ARRAY_SIZE(joffset); i++) { + MTXCopy(i_this->m02C0->getModel()->getAnmMtx(jno[i]), *calc_mtx); + local_128 = joffset[i]; + MtxPosition(&local_128, &cStack_11c); + sph = &i_this->mDamageSpheres[i]; + sph->SetC(cStack_11c); + if (i_this->m18AE == 10) { + sph->SetR(jsize[i]); + } else { + sph->SetR(l_HIO.m20 * jsize[i]); + } + dComIfG_Ccsp()->Set(&i_this->mDamageSpheres[i]); + } + demo_camera(i_this); + if ((i_this->m394C != 0) && (player->current.pos.y < 900.0f)) { + local_110 = i_this->m17C8 - player->current.pos; + fVar26 = local_110.abs(); + dVar24 = (1.0f - (REG0_F(4) + 0.00025f) * fVar26); + if (dVar24 < 0.0f) { + dVar24 = 0.0f; + } + iVar8 = cM_atan2s(local_110.x, local_110.z); + player->setOutPower((f32)(l_HIO.m10 * dVar24), (int)(s16)iVar8, 0); + i_this->m394C = 0; + } + i_this->m02C4->setPlaySpeed(i_this->m02C8); + i_this->m02C4->play(); + pJVar14 = i_this->m1868; + if (i_this->m1864 != 0) { + i_this->m1864--; + fVar26 = cM_rndFX(REG0_F(0x12) + 4.0f); + i_this->m18A0.x = fVar26; + fVar26 = cM_rndFX(REG0_F(0x12) + 4.0f); + i_this->m18A0.x = fVar26; + } + mDoMtx_stack_c::transS(i_this->m18A0.x, l_HIO.m28 + (i_this->m18A0.y + l_HIO.m2C), i_this->m18A0.z); + if (i_this->m1865 != 0) { + mDoMtx_stack_c::transM(0.0f, -20000.0f, 0.0f); + } + pJVar14->setBaseTRMtx(mDoMtx_stack_c::get()); + MTXCopy(mDoMtx_stack_c::get(), i_this->m186C); + i_this->m189C->Move(); + iVar8 = 0; + iVar22 = 0; + iVar21 = 0; + iVar20 = 0; + iVar19 = 0; + iVar13 = 0; + do { + if (i_this->m17E4[iVar8] != 0) { + i_this->m185C[iVar13]->Move(); + fVar26 = i_this->m17E0 + 50.0f + REG0_F(8); + i_this->m3B3C = 0.0f; + i_this->m3B40 = fVar26; + i_this->m3B44 = 0.0f; + i_this->m3B48[iVar20].y = REG0_S(iVar19) + 0xc + demo_ang[iVar19]; + switch (i_this->m17E4[iVar8]) { + case 0: + break; + case 1: + i_this->m17E6[iVar19] = 0; + i_this->m17E4[iVar8] = 2; + // fallthrough + case 3: + if (i_this->m17E6[iVar19] == 0x32) { + for (s32 j = 0; j < 3; j++) { + iVar15 = j + iVar21; + suna_gr_ang[iVar15].z = 0; + suna_gr_ang[iVar15].x = 0; + iVar10 = cM_atan2s(-suna_gr_pos[iVar15].x, -suna_gr_pos[iVar15].z); + suna_gr_ang[iVar15].y = (s16)iVar10; + dComIfGp_particle_setToon( + dPa_name::ID_SCENE_A260, + &suna_gr_pos[iVar15], + &suna_gr_ang[iVar15], + NULL, + eff_col.a, + &i_this->m3B54[iVar15], + (s8)actor->current.roomNo + ); + i_this->m3B54[iVar15].setColor(eff_col); + } + } + if (i_this->m17E6[iVar19] == 0xb4) { + pJVar11 = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bwd", BWD_BTK_TAKI_WAIT); + i_this->m17F4[iVar13]->init(i_this->m17EC[iVar13]->getModelData(), pJVar11, true, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, 0); + i_this->m17E4[iVar8] = 3; + } + break; + case 4: + pJVar11 = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bwd", BWD_BTK_TAKI_END); + iVar16 = i_this->m17F4[iVar13]->init(i_this->m17EC[iVar13]->getModelData(), pJVar11, true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, 0); + if (iVar16 == 1) { + i_this->m17E4[iVar8] = 5; + i_this->m17E6[iVar19] = 0; + } + break; + case 5: + if (i_this->m17E6[iVar19] >= 0x3b) { + i_this->m17E4[iVar8] = 0; + for (s32 j = 0; j < 3; j++) { + i_this->m3B54[j + iVar21].end(); + } + } + break; + } + i_this->m17E6[iVar19]++; + i_this->m17F4[iVar13]->play(); + pJVar14 = i_this->m17EC[iVar13]; + mDoMtx_stack_c::transS(0.0f, REG0_F(3) + -500.0f + l_HIO.m28, 0.0f); + mDoMtx_stack_c::YrotM(i_this->m3B48[iVar20].y); + pJVar14->setBaseTRMtx(mDoMtx_stack_c::get()); + MTXCopy(mDoMtx_stack_c::get(), (i_this->m17FC[iVar22])); + if (((i_this->m17E4[iVar8] == 2) && (i_this->m17E6[iVar19] >= 0x32)) || (i_this->m17E4[iVar8] == 3)) { + pJVar14 = 0; + for (s32 j = 0; j < 3; j++) { + mDoAud_seStart(JA_SE_OBJ_BWD_SANDFALL_L, &suna_gr_pos[j + iVar21], 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + } + } + iVar8 = iVar8 + 1; + iVar22 = iVar22 + 0x30; + iVar21 = iVar21 + 3; + iVar20 = iVar20 + 6; + iVar19 = iVar19 + 2; + iVar13 = iVar13 + 4; + if (iVar8 >= 1) { + for (s32 j = 0; j < (s32)ARRAY_SIZE(suna_gr_pos); j++) { + Vec pos; + pos = suna_gr_pos[j]; + pos.y += (f32)(1000.0f + REG0_F(0xd)); + local_104.SetPos(&pos); + fVar26 = dComIfG_Bgsp()->GroundCross(&local_104); + if (fVar26 != -G_CM3D_F_INF) { + suna_gr_pos[j].y = fVar26; + } + } + sVar2 = i_this->m3960; + if (sVar2 != 0) { + if (sVar2 == 1) { + i_this->m3960++; + i_this->m3AF4.end(); + dComIfGp_particle_set(dPa_name::ID_SCENE_824D, &i_this->m3954, &actor->shape_angle, NULL, 0xff, &i_this->m3AF4, (s8)actor->current.roomNo); + } else if (sVar2 < 0) { + i_this->m3960 = 0; + i_this->m3AF4.end(); + } else { + mDoAud_seStart(JA_SE_CM_BWD_SAND_MOVE, &i_this->m3954, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + } + for (s32 j = 0; j < (s32)ARRAY_SIZE(i_this->m3978); j++) { + if (i_this->m3AE0[j] != 0) { + i_this->m3AE0[j]--; + if (i_this->m3AE0[j] == 0) { + i_this->m3978[j].end(); + if (j < 2) { + i_this->m3AB8[j].end(); + } + } + } + } + for (s32 j = 0; j < 2; j++) { + if (i_this->m3B08[j] != 0) { + fVar26 = i_this->m3B08[j] - 1.0f; + i_this->m3B24[j]->setPlaySpeed((s16)fVar26); + i_this->m3B2C[j]->setFrame(fVar26); + i_this->m3B34[j]->setFrame(fVar26); + mDoMtx_stack_c::transS(i_this->m3B0C[j].x, i_this->m3B0C[j].y, i_this->m3B0C[j].z); + mDoMtx_stack_c::scaleM(l_HIO.m30, l_HIO.m34, l_HIO.m30); + i_this->m3B24[j]->getModel()->setBaseTRMtx(mDoMtx_stack_c::get()); + i_this->m3B08[j]++; + if (i_this->m3B08[j] > 0x3c) { + i_this->m3B08[j] = 0; + } + } + } + if (i_this->m18D8 == 0) { + i_this->m18D8 = 1; + fopAcM_create(PROC_BWDG, 0, &actor->home.pos, fopAcM_GetRoomNo(actor), NULL, NULL, 0xff, NULL); + } + uVar1 = i_this->m17C4; + if (uVar1 != 0) { + if (uVar1 == 0xff) { + cLib_addCalc2(&i_this->m17D4, REG0_F(5) + 0.35f, 0.2f, REG0_F(6) + 0.1f); + cLib_addCalcAngleS2(&i_this->m17D8, REG0_S(9) + -0x5dc, 1, 0x1e); + cLib_addCalc2(&i_this->m17DC, 1.0f, 1.0f, 0.1f); + } else if (uVar1 == 200) { + cLib_addCalcAngleS2(&i_this->m17D8, 0, 1, 0x1e); + } else if (uVar1 == 0xc9) { + i_this->m17D4 = REG0_F(9) + -0.3f; + } else if (uVar1 == 0xca) { + cLib_addCalc2(&i_this->m17D4, REG0_F(4) + -0.7f, 0.1f, 0.005f); + cLib_addCalcAngleS2(&i_this->m17D8, REG0_S(9) + -500, 1, 0x1e); + cLib_addCalc2(&i_this->m17DC, 1.0f, 1.0f, 0.005f); + } else { + cLib_addCalc2(&i_this->m17D4, -0.75f, 0.1f, 0.01f); + cLib_addCalcAngleS2(&i_this->m17D8, REG0_S(7) + 1000, 1, 0x1e); + cLib_addCalc2(&i_this->m17DC, 1.0f, 1.0f, 0.01f); + i_this->m17C4 = i_this->m17C4 - 1; + } + } else { + cLib_addCalc0(&i_this->m17D4, 0.1f, 0.01f); + cLib_addCalcAngleS2(&i_this->m17D8, 0, 1, 0x14); + cLib_addCalc0(&i_this->m17DC, 1.0f, 0.01f); + } + bwd_kankyo(i_this); + return TRUE; + } + } while (true); } /* 00008C24-00008C2C .text daBwd_IsDelete__FP9bwd_class */ @@ -145,18 +2283,205 @@ static BOOL daBwd_IsDelete(bwd_class*) { } /* 00008C2C-00008E0C .text daBwd_Delete__FP9bwd_class */ -static BOOL daBwd_Delete(bwd_class*) { - /* Nonmatching */ +static BOOL daBwd_Delete(bwd_class* i_this) { + dComIfG_resDeleteDemo(&i_this->mPhaseBwd, "Bwd"); + dComIfG_resDeleteDemo(&i_this->mPhaseBwds, "Bwds"); + if (i_this->m3C51 != 0) { + hio_set = 0; + mDoHIO_deleteChild(l_HIO.mNo); + } + dComIfG_Bgsp()->Release(i_this->m189C); + dComIfG_Bgsp()->Release(i_this->m185C[0]); + dComIfG_Bgsp()->Release(i_this->m185C[1]); + for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m0418); i++) { + mDoAud_seDeleteObject(&i_this->m0418[i]); + } + for (s32 i = 0; i < (s32)ARRAY_SIZE(suna_gr_pos); i++) { + mDoAud_seDeleteObject(&suna_gr_pos[i]); + } + mDoAud_seDeleteObject(¢er_pos); + mDoAud_seDeleteObject(&i_this->m3954); + for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m3978); i++) { + i_this->m3978[i].end(); + if (i < 2) { + i_this->m3AB8[i].end(); + } + } + i_this->m3AF4.end(); + for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m3B54); i++) { + i_this->m3B54[i].end(); + } + return TRUE; } /* 00008E0C-000096D8 .text useHeapInit__FP10fopAc_ac_c */ -static BOOL useHeapInit(fopAc_ac_c*) { - /* Nonmatching */ +static BOOL useHeapInit(fopAc_ac_c* a_this) { + /* Nonmatching - regalloc */ + static s32 taki_bdl[] = {BWD_BDL_HTAKI1, BWD_BDL_HTAKI2}; + static s32 s_bdl[] = {BWD_BDL_GSP00, BWD_BDL_GSP01}; + static s32 s_btk[] = {BWD_BTK_GSP00, BWD_BTK_GSP01}; + static s32 s_brk[] = {BWD_BRK_GSP00, BWD_BRK_GSP01}; + static s32 s_bck[] = {BWD_BCK_GSP00, BWD_BCK_GSP01}; + bwd_class* i_this = (bwd_class*)a_this; + mDoExt_McaMorf* pmVar1; + J3DModelData* modelData; + J3DModel* pJVar4; + J3DAnmTevRegKey* pJVar7; + int iVar8; + int iVar10; + cBgD_t* pcVar13; + uint uVar14; + J3DAnmTextureSRTKey* pJVar15; + int iVar16; + u8 fileIndex; + + pmVar1 = new mDoExt_McaMorf( + (J3DModelData*)dComIfG_getObjectRes("Bwd", BWD_BDL_BWD), + NULL, + NULL, + (J3DAnmTransformKey*)dComIfG_getObjectRes("Bwd", BWD_BCK_BWD_WAIT), + J3DFrameCtrl::EMode_LOOP, + 1.0f, + 0, + -1, + 1, + NULL, + 0, + 0x11020203 + ); + i_this->m02C0 = pmVar1; + if ((i_this->m02C0 == NULL) || (pJVar4 = i_this->m02C0->getModel(), pJVar4 == NULL)) { + return FALSE; + } + pJVar4 = mDoExt_J3DModel__create(pJVar4->getModelData(), 0, 0x11020203); + i_this->m02CC = pJVar4; + if (i_this->m02CC == NULL) { + return FALSE; + } + i_this->m02C4 = new mDoExt_brkAnm(); + pJVar7 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bwd", BWD_BRK_BWD); + iVar8 = i_this->m02C4->init(i_this->m02C0->getModel()->getModelData(), pJVar7, true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, false, 0); + if (iVar8 == 0) { + return FALSE; + } + modelData = (J3DModelData*)dComIfG_getObjectRes("Bwd", BWD_BDL_BERO); + for (s32 i = 0; i < 30; i++) { + if (i == 29) { + modelData = (J3DModelData*)dComIfG_getObjectRes("Bwd", BWD_BDL_BERO_SAKI); + } + pJVar4 = mDoExt_J3DModel__create(modelData, 0, 0x11020203); + i_this->m1908[i].m00 = pJVar4; + if (i_this->m1908[i].m00 == 0) { + return FALSE; + } + } + modelData = (J3DModelData*)dComIfG_getObjectRes("Bwd", BWD_BDL_BWD_SHIPPOA); + fileIndex = BWD_BRK_BWD_SHIPPOA; + for (s32 i = 0; i < 20; i++) { + if (i == 0x13) { + modelData = (J3DModelData*)dComIfG_getObjectRes("Bwd", BWD_BDL_BWD_SHIPPOB); + fileIndex = BWD_BRK_BWD_SHIPPOB; + } + i_this->m02D4[i] = mDoExt_J3DModel__create(modelData, 0, 0x11020203); + if (i_this->m02D4[i] == 0) { + return FALSE; + } + i_this->m0324[i] = mDoExt_J3DModel__create(modelData, 0, 0x11020203); + if (i_this->m0324[i] == 0) { + return FALSE; + } + i_this->m0374[i] = new mDoExt_brkAnm(); + pJVar7 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bwd", fileIndex); + iVar10 = i_this->m0374[i]->init(modelData, pJVar7, true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, false, 0); + if (iVar10 == 0) { + return FALSE; + } + } + modelData = (J3DModelData*)dComIfG_getObjectRes("Bwd", BWD_BDL_HTRYF1); + JUT_ASSERT(0x11c4, modelData != NULL); + i_this->m1868 = mDoExt_J3DModel__create(modelData, 0, 0x11020203); + if (i_this->m1868 == NULL) { + return FALSE; + } + i_this->m189C = new dBgW(); + if (i_this->m189C == NULL) { + return FALSE; + } + pcVar13 = (cBgD_t*)dComIfG_getObjectRes("Bwd", BWD_DZB_HTRYF1); + uVar14 = i_this->m189C->Set(pcVar13, dBgW::MOVE_BG_e, &i_this->m186C); + if ((uVar14 & 0xff) == 1) { + return FALSE; + } + i_this->m189C->SetCrrFunc(dBgS_MoveBGProc_Typical); + for (s32 i = 0; i < 2; i++) { + i_this->m185C[i] = new dBgW(); + if (i_this->m185C[i] == 0) { + return FALSE; + } + pcVar13 = (cBgD_t*)dComIfG_getObjectRes("Bwd", BWD_DZB_HTAKI1); + uVar14 = i_this->m185C[i]->Set(pcVar13, dBgW::MOVE_BG_e, &i_this->m17FC[i]); + if ((uVar14 & 0xff) == 1) { + return FALSE; + } + i_this->m185C[i]->SetCrrFunc(dBgS_MoveBGProc_Typical); + modelData = (J3DModelData*)dComIfG_getObjectRes("Bwd", taki_bdl[i]); + JUT_ASSERT(0x11ed, modelData != NULL); + i_this->m17EC[i] = mDoExt_J3DModel__create(modelData, 0, 0x11020203); + if (i_this->m17EC[i] == 0) { + return FALSE; + } + i_this->m17F4[i] = new mDoExt_btkAnm(); + if (i_this->m17F4[i] == 0) { + return FALSE; + } + pJVar15 = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bwd", BWD_BTK_TAKI_START); + iVar16 = i_this->m17F4[i]->init(modelData, pJVar15, true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, false, 0); + if (iVar16 == 0) { + return FALSE; + } + } + for (s32 i = 0; i < 2; i++) { + pmVar1 = new mDoExt_McaMorf( + (J3DModelData*)dComIfG_getObjectRes("Bwd", s_bdl[i]), + NULL, + NULL, + (J3DAnmTransformKey*)dComIfG_getObjectRes("Bwd", s_bck[i]), + J3DFrameCtrl::EMode_NONE, + 1.0f, + 0, + -1, + 0, + NULL, + 0, + 0x11020203 + ); + i_this->m3B24[i] = pmVar1; + pmVar1 = i_this->m3B24[i]; + if ((pmVar1 == NULL) || (pmVar1->getModel() == NULL)) { + return FALSE; + } + modelData = pmVar1->getModel()->getModelData(); + i_this->m3B2C[i] = new mDoExt_btkAnm(); + if (i_this->m3B2C[i] == 0) { + return FALSE; + } + pJVar15 = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bwd", s_btk[i]); + iVar10 = i_this->m3B2C[i]->init(modelData, pJVar15, true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, false, 0); + if (iVar10 == 0) { + return FALSE; + } + i_this->m3B34[i] = new mDoExt_brkAnm(); + pJVar7 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bwd", s_brk[i]); + iVar10 = i_this->m3B34[i]->init(modelData, pJVar7, true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, false, 0); + if (iVar10 == 0) { + return FALSE; + } + } + return TRUE; } /* 00009720-00009C7C .text daBwd_Create__FP10fopAc_ac_c */ -static cPhs_State daBwd_Create(fopAc_ac_c*) { - /* Nonmatching */ +static cPhs_State daBwd_Create(fopAc_ac_c* a_this) { static dCcD_SrcSph body_sph_src = { // dCcD_SrcGObjInf { @@ -241,6 +2566,106 @@ static cPhs_State daBwd_Create(fopAc_ac_c*) { /* Radius */ 70.0f, }}, }; + f32 fVar1; + cPhs_State res; + + fopAcM_SetupActor(a_this, bwd_class); + bwd_class* i_this = (bwd_class*)a_this; + fopAc_ac_c* actor = &i_this->actor; + res = dComIfG_resLoad(&i_this->mPhaseBwd, "Bwd"); + if (res != cPhs_COMPLEATE_e) { + return res; + } + res = dComIfG_resLoad(&i_this->mPhaseBwds, "Bwds"); + if (res != cPhs_COMPLEATE_e) { + return res; + } + i_this->m02BC = (u8)actor->base.mParameters; + if (!fopAcM_entrySolidHeap(actor, useHeapInit, 0x96000)) { + return cPhs_ERROR_e; + } + if (dComIfG_Bgsp()->Regist(i_this->m189C, actor)) { + return cPhs_ERROR_e; + } + for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m185C); i++) { + if (dComIfG_Bgsp()->Regist(i_this->m185C[i], actor)) { + return cPhs_ERROR_e; + } + } + actor->attention_info.flags = fopAc_Attn_LOCKON_BATTLE_e; + actor->attention_info.distances[2] = 0x22; + if (hio_set == 0) { + i_this->m3C51 = 1; + hio_set = 1; + l_HIO.mNo = mDoHIO_createChild("風ボス", &l_HIO); // Wind boss + } + actor->health = 0xc; + actor->max_health = 0xc; + i_this->mCcD_Stts.Init(0xfa, 0, actor); + for (s32 i = 0; i < 17; i++) { + i_this->mDamageSpheres[i].SetStts(&i_this->mCcD_Stts); + i_this->mDamageSpheres[i].Set(body_sph_src); + } + i_this->mCcD_Sph.SetStts(&i_this->mCcD_Stts); + i_this->mCcD_Sph.Set(bero_sph_src); + for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->mCcD_Sph_Array5); i++) { + i_this->mCcD_Sph_Array5[i].SetStts(&i_this->mCcD_Stts); + i_this->mCcD_Sph_Array5[i].Set(bero_co_sph_src); + } + if (!(g_dComIfG_gameInfo.save.getMemory().getBit().isStageBossDemo()) && (dComIfGp_getStartStageName()[0] != 'X')) { + actor->current.pos.x = 0.0f; + actor->current.pos.y = -20000.0f; + actor->current.pos.z = 0.0f; + i_this->m18AE = 0; + i_this->m17DC = 1.0f; + i_this->m17E0 = 200.0f; + fopAcM_OnStatus(actor, fopAcStts_SHOWMAP_e); + i_this->m3C50 = 1; + } else { + if ((g_dComIfG_gameInfo.save.getMemory().getBit().isStageBossEnemy()) && (dComIfGp_getStartStageName()[0] != 'X')) { + i_this->m18AE = 0xd; + actor->current.pos.x = 0.0f; + actor->current.pos.y = -20000.0f; + actor->current.pos.z = 0.0f; + i_this->m17E0 = REG0_F(0xb) + 400.0f; + i_this->m3C15 = 5; + } else { + dComIfGs_offTmpBit(0x480); + fopAcM_OnStatus(actor, fopAcStts_SHOWMAP_e); + i_this->m18AE = 1; + i_this->m18B0 = -10; + fVar1 = REG0_F(0x11) + -1500.0f; + actor->current.pos.x = 0.0f; + actor->current.pos.y = fVar1; + actor->current.pos.z = 0.0f; + i_this->m17E0 = 900.0f; + i_this->m1865 = 1; + i_this->m17E4[0] = 1; + i_this->m17E4[1] = 1; + i_this->m3C15 = 1; + if (dComIfGp_getStartStageName()[0] == 'X') { + mDoAud_bgmStart(JA_BGM_PAST_RANE); + } else { + mDoAud_bgmStart(JA_BGM_RANE_BATTLE); + } + } + } + i_this->m1B88.y = actor->current.pos.y; + for (s32 i = 0; i < 30; i++) { + fVar1 = actor->current.pos.y; + i_this->m1908[i].m04.x = 0; + i_this->m1908[i].m04.y = fVar1; + i_this->m1908[i].m04.z = 0; + } + eff_col.r = 0xa0; + eff_col.g = 0xa0; + eff_col.b = 0x80; + eff_col.a = 0x96; + i_this->m1714 = actor->tevStr; +#if VERSION == VERSION_USA + i_this->m1BC0 = fopAcM_create(PROC_ATT, 0x65, &actor->current.pos, fopAcM_GetRoomNo(actor)); +#endif + return cPhs_COMPLEATE_e; } static actor_method_class l_daBwd_Method = {