From ef69132d0b3bfc15e3995df061a2b31f92e6e6ee Mon Sep 17 00:00:00 2001 From: 123456789758 <205478182+123456789758@users.noreply.github.com> Date: Wed, 17 Sep 2025 00:26:43 -0400 Subject: [PATCH] d_a_bst - 99% matching (#886) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: ‎ ‎ ‎ <‎ ‎ ‎> --- include/d/actor/d_a_bst.h | 170 +- src/d/actor/d_a_bst.cpp | 3735 +++++++++++++++++++++---------------- 2 files changed, 2183 insertions(+), 1722 deletions(-) diff --git a/include/d/actor/d_a_bst.h b/include/d/actor/d_a_bst.h index 3bc93b5a8..a3dc4b07d 100644 --- a/include/d/actor/d_a_bst.h +++ b/include/d/actor/d_a_bst.h @@ -5,66 +5,86 @@ #include "d/d_cc_d.h" #include "d/d_particle.h" #include "f_op/f_op_actor.h" -#include "m_Do/m_Do_hostIO.h" class mDoExt_McaMorf; class mDoExt_btkAnm; class mDoExt_brkAnm; -class bst_class : public fopAc_ac_c { -public: - /* 0x0290 */ u8 field_0x0290[0x02AC - 0x0290]; +struct bst_class { + enum Part_Type_e { + Type_HEAD_e = 0, + Type_LEFT_HAND_e = 1, + Type_RIGHT_HAND_e = 2, + }; + + enum ActionType { + ACTION_STAY_e = 0, + ACTION_FLY_e = 1, + ACTION_DAMAGE_e = 5, + ACTION_SLEEP_e = 6, + ACTION_HEAD_DAMAGE_e = 7, + ACTION_HEAD_HUKKI_e = 8, + ACTION_DOWN_ATTACK_e = 10, + ACTION_PAA_ATTACK_e = 11, + ACTION_KUMI_ATTACK_e = 12, + ACTION_HARAI_ATTACK_e = 13, + ACTION_BEAM_ATTACK_e = 14, + ACTION_HANA_DEMO_e = 20, + ACTION_END_DEMO_e = 22, + }; + + /* 0x0000 */ fopEn_enemy_c actor; /* 0x02AC */ request_of_phase_process_class mPhs; - /* 0x02B4 */ u8 field_0x02B4; - /* 0x02B5 */ u8 field_0x02B5[0x02B8 - 0x02B5]; - /* 0x02B8 */ mDoExt_McaMorf* field_0x02B8; + /* 0x02B4 */ u8 mBstPartType; + /* 0x02B5 */ u8 m02B5[0x02B8 - 0x02B5]; + /* 0x02B8 */ mDoExt_McaMorf* m02B8; /* 0x02BC */ mDoExt_btkAnm* mpTexMtxAnimator; /* 0x02C0 */ mDoExt_brkAnm* mpTevRegAnimator; - /* 0x02C4 */ s8 field_0x02C4; - /* 0x02C5 */ u8 field_0x02C5[0x02C8 - 0x02C5]; - /* 0x02C8 */ J3DModel* field_0x02C8; + /* 0x02C4 */ s8 m02C4; + /* 0x02C5 */ u8 m02C5[0x02C8 - 0x02C5]; + /* 0x02C8 */ J3DModel* m02C8; /* 0x02CC */ mDoExt_btkAnm* mpBtkAnm; /* 0x02D0 */ mDoExt_brkAnm* mpBrkAnm; - /* 0x02D4 */ s8 field_0x02D4; - /* 0x02D5 */ u8 field_0x02D5[0x02D8 - 0x02D5]; + /* 0x02D4 */ s8 m02D4; + /* 0x02D5 */ u8 m02D5[0x02D8 - 0x02D5]; /* 0x02D8 */ dKy_tevstr_c mEnvLight; - /* 0x0388 */ J3DModel* field_0x0388; + /* 0x0388 */ J3DModel* m0388; /* 0x038C */ u32 mShadowID; - /* 0x0390 */ J3DModel* field_0x0390[10]; - /* 0x03B8 */ cXyz field_0x03B8[10]; - /* 0x0430 */ cXyz field_0x0430[10]; - /* 0x04A8 */ csXyz field_0x04A8[10]; - /* 0x04E4 */ s8 field_0x04E4[10]; - /* 0x04EE */ u8 field_0x04EE[0x04F0 - 0x04EE]; + /* 0x0390 */ J3DModel* m0390[10]; + /* 0x03B8 */ cXyz m03B8[10]; + /* 0x0430 */ cXyz m0430[10]; + /* 0x04A8 */ csXyz m04A8[10]; + /* 0x04E4 */ s8 m04E4[10]; + /* 0x04EE */ u8 m04EE[0x04F0 - 0x04EE]; /* 0x04F0 */ dCcD_Sph mCcD_beams[10]; - /* 0x10A8 */ f32 field_0x10A8[10]; - /* 0x10D0 */ f32 field_0x10D0; - /* 0x10D4 */ s16 field_0x10D4; - /* 0x10D6 */ s16 field_0x10D6; - /* 0x10D8 */ s16 field_0x10D8; + /* 0x10A8 */ f32 m10A8[10]; + /* 0x10D0 */ f32 m10D0; + /* 0x10D4 */ s16 mUpdateLastFacingDirIfMultipleOf32; + /* 0x10D6 */ s16 mActionType; + /* 0x10D8 */ s16 m10D8; /* 0x10DA */ s16 mDamage; /* 0x10DC */ cXyz mTargetPos; - /* 0x10E8 */ s16 field_0x10E8; - /* 0x10EA */ u8 field_0x10EA[0x10EC - 0x10EA]; - /* 0x10EC */ cXyz field_0x10EC; - /* 0x10F8 */ f32 field_0x10F8; - /* 0x10FC */ s16 field_0x10FC[5]; + /* 0x10E8 */ s16 mLastCheckedPlayerFacingDir; + /* 0x10EA */ u8 m10EA[0x10EC - 0x10EA]; + /* 0x10EC */ cXyz m10EC; + /* 0x10F8 */ f32 m10F8; + /* 0x10FC */ s16 m10FC[5]; // 0 = mUpdateTargetPosTimer, 1 = mSleepTimer /* 0x1106 */ s16 mDamageTimer; /* 0x1108 */ s16 mState; /* 0x110A */ s16 mStateTimer; - /* 0x110C */ u8 field_0x110C[0x1110 - 0x110C]; - /* 0x1110 */ f32 field_0x1110; - /* 0x1114 */ f32 field_0x1114; - /* 0x1118 */ f32 field_0x1118; - /* 0x111C */ s16 field_0x111C; - /* 0x111E */ u8 field_0x111E[0x1120 - 0x111E]; + /* 0x110C */ u8 m110C[0x1110 - 0x110C]; + /* 0x1110 */ f32 m1110; + /* 0x1114 */ f32 m1114; + /* 0x1118 */ f32 m1118; + /* 0x111C */ s16 m111C; + /* 0x111E */ u8 m111E[0x1120 - 0x111E]; /* 0x1120 */ f32 mHeadHurtSpeed; /* 0x1124 */ s16 mHurtRecoilAngle1; /* 0x1126 */ s16 mHurtRecoilAngle2; /* 0x1128 */ s16 mHeadHurtAngle; - /* 0x112A */ s16 field_0x112A; - /* 0x112C */ s16 field_0x112C; - /* 0x112E */ u8 field_0x112E[0x1130 - 0x112E]; + /* 0x112A */ s16 m112A; + /* 0x112C */ s16 m112C; + /* 0x112E */ u8 m112E[0x1130 - 0x112E]; /* 0x1130 */ dBgS_AcchCir mBgS_AcchCir; /* 0x1170 */ dBgS_ObjAcch mBgS_Acch; /* 0x1334 */ dCcD_Stts mCcD_Stts; @@ -72,49 +92,51 @@ public: /* 0x14A0 */ dCcD_Cyl mHandHurtCollisionCcD_Cyl; /* 0x15D0 */ dCcD_Sph mCcD_fingers[19]; /* 0x2C14 */ dCcD_Sph mBstEyeCcD_Spheres[2]; - /* 0x2E6C */ u8 field_0x2E6C[0x2E6E - 0x2E6C]; - /* 0x2E6E */ s16 field_0x2E6E; + /* 0x2E6C */ u8 m2E6C[0x2E6E - 0x2E6C]; + /* 0x2E6E */ s16 m2E6E; /* 0x2E70 */ s16 mFacingDir; /* 0x2E72 */ s8 mEyeHealth[2]; - /* 0x2E74 */ s16 field_0x2E74[2]; - /* 0x2E78 */ s16 field_0x2E78[2]; - /* 0x2E7C */ s8 field_0x2E7C; - /* 0x2E7D */ u8 field_0x2E7D[0x2E7E - 0x2E7D]; - /* 0x2E7E */ s16 field_0x2E7E[3]; - /* 0x2E84 */ s16 field_0x2E84; - /* 0x2E86 */ u8 field_0x2E86[0x2E88 - 0x2E86]; + /* 0x2E74 */ s16 m2E74[2]; + /* 0x2E78 */ s16 m2E78[2]; + /* 0x2E7C */ s8 m2E7C; + /* 0x2E7D */ u8 m2E7D[0x2E7E - 0x2E7D]; + /* 0x2E7E */ s16 m2E7E[3]; // 1 = mHeadBeamAttackTimer + /* 0x2E84 */ s16 mBombArrowDropTimer; + /* 0x2E86 */ u8 m2E86[0x2E88 - 0x2E86]; /* 0x2E88 */ fpc_ProcID mBombId; /* 0x2E8C */ fpc_ProcID mCreatedItemId; - /* 0x2E90 */ fpc_ProcID field_0x2E90[2]; - /* 0x2E98 */ s16 field_0x2E98; - /* 0x2E9A */ s8 field_0x2E9A; - /* 0x2E9B */ u8 field_0x2E9B[0x2E9C - 0x2E9B]; + /* 0x2E90 */ fpc_ProcID m2E90[2]; + /* 0x2E98 */ s16 m2E98; + /* 0x2E9A */ s8 m2E9A; + /* 0x2E9B */ u8 m2E9B[0x2E9C - 0x2E9B]; /* 0x2E9C */ s16 msFrameCount; - /* 0x2E9E */ s8 field_0x2E9E; - /* 0x2E9F */ u8 field_0x2E9F[0x2EA0 - 0x2E9F]; - /* 0x2EA0 */ cXyz field_0x2EA0; - /* 0x2EAC */ cXyz field_0x2EAC; - /* 0x2EB8 */ u8 field_0x2EB8[0x2EC4 - 0x2EB8]; - /* 0x2EC4 */ f32 field_0x2EC4; - /* 0x2EC8 */ f32 field_0x2EC8; - /* 0x2ECC */ f32 field_0x2ECC; - /* 0x2ED0 */ f32 field_0x2ED0; + /* 0x2E9E */ s8 m2E9E; + /* 0x2E9F */ u8 m2E9F[0x2EA0 - 0x2E9F]; + /* 0x2EA0 */ cXyz m2EA0; + /* 0x2EAC */ cXyz m2EAC; + /* 0x2EB8 */ u8 m2EB8[0x2EC4 - 0x2EB8]; + /* 0x2EC4 */ f32 m2EC4; + /* 0x2EC8 */ f32 m2EC8; + /* 0x2ECC */ f32 m2ECC; + /* 0x2ED0 */ f32 m2ED0; /* 0x2ED4 */ s8 mRoomState; - /* 0x2ED5 */ u8 field_0x2ED5[0x2ED8 - 0x2ED5]; - /* 0x2ED8 */ JPABaseEmitter* field_0x2ED8[2]; - /* 0x2EE0 */ u8 field_0x2EE0[0x2EF4 - 0x2EE0]; - /* 0x2EF4 */ JPABaseEmitter* field_0x2EF4; - /* 0x2EF8 */ u8 field_0x2EF8[0x2F00 - 0x2EF8]; + /* 0x2ED5 */ u8 m2ED5[0x2ED8 - 0x2ED5]; + /* 0x2ED8 */ JPABaseEmitter* m2ED8[2]; + /* 0x2EE0 */ JPABaseEmitter* m2EE0[2]; + /* 0x2EE8 */ u8 m2EE8[0x2EF4 - 0x2EE8]; + /* 0x2EF4 */ JPABaseEmitter* m2EF4; + /* 0x2EF8 */ JPABaseEmitter* m2EF8; + /* 0x2EF8 */ u8 m2EFC[0x2F00 - 0x2EFC]; /* 0x2F00 */ dPa_smokeEcallBack mPa_smokeEcallBack; - /* 0x2F20 */ dKy_tevstr_c field_0x2F20; - /* 0x2FD0 */ J3DModel* field_0x2FD0; - /* 0x2FD4 */ mDoExt_btkAnm* field_0x2FD4; - /* 0x2FD8 */ mDoExt_brkAnm* field_0x2FD8; - /* 0x2FDC */ J3DModel* field_0x2FDC; - /* 0x2FE0 */ mDoExt_brkAnm* field_0x2FE0; - /* 0x2FE4 */ s8 field_0x2FE4; + /* 0x2F20 */ dKy_tevstr_c m2F20; + /* 0x2FD0 */ J3DModel* m2FD0; + /* 0x2FD4 */ mDoExt_btkAnm* m2FD4; + /* 0x2FD8 */ mDoExt_brkAnm* m2FD8; + /* 0x2FDC */ J3DModel* m2FDC; + /* 0x2FE0 */ mDoExt_brkAnm* m2FE0; + /* 0x2FE4 */ s8 m2FE4; /* 0x2FE5 */ u8 mHioSet; - /* 0x2FE6 */ u8 field_0x2FE6[0x2FE8 - 0x2FE6]; -}; // Size: 0x2FE8 + /* 0x2FE6 */ u8 m2FE6[0x2FE8 - 0x2FE6]; +}; // Size: 0x2FE8 #endif /* D_A_BST_H */ diff --git a/src/d/actor/d_a_bst.cpp b/src/d/actor/d_a_bst.cpp index 140863504..d5f93caa7 100644 --- a/src/d/actor/d_a_bst.cpp +++ b/src/d/actor/d_a_bst.cpp @@ -6,6 +6,7 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep #include "d/actor/d_a_bst.h" #include "d/actor/d_a_bomb.h" +#include "d/actor/d_a_player.h" #include "d/d_bg_s_lin_chk.h" #include "d/d_camera.h" #include "d/d_cc_uty.h" @@ -27,32 +28,27 @@ class daBst_HIO_c : public JORReflexible { public: daBst_HIO_c(); virtual ~daBst_HIO_c() {} - void genMessage(JORMContext* ctx) {} public: - /* 0x4 */ s8 field_0x4; - /* 0x5 */ u8 field_0x5; - /* 0x6 */ u8 field_0x6; + /* 0x4 */ s8 m4; + /* 0x5 */ u8 m5; + /* 0x6 */ u8 m6; }; -static u8 hio_set; -static daBst_HIO_c l_HIO; - /* 000000EC-00000110 .text __ct__11daBst_HIO_cFv */ daBst_HIO_c::daBst_HIO_c() { - field_0x4 = -1; - field_0x5 = 0; - field_0x6 = 0; + m4 = -1; + m5 = 0; + m6 = 0; } static bst_class* boss; static bst_class* hand[2]; - static fpc_ProcID msg; static s8 msg_end; - - +static u8 hio_set; +static daBst_HIO_c l_HIO; static u16 set_bdl_d[3] = {BST_BDL_BST, BST_BDL_LHAND, BST_BDL_RHAND}; static u16 set_za_bdl[3] = {BST_BDL_MUNE, BST_BDL_UDEL, BST_BDL_UDER}; static u16 set_bck_d[3] = {BST_BCK_BST_SLEEP, BST_BCK_LH_SLEEP, BST_BCK_RH_SLEEP}; @@ -62,8 +58,9 @@ static u16 down_bck_d[] = {BST_BCK_BST_FLY, BST_BCK_LH_DOWN, BST_BCK_RH_DOWN}; /* 00000110-00000174 .text message_set__FP9bst_classUl */ static BOOL message_set(bst_class* i_this, unsigned long msg_no) { + fopAc_ac_c* actor = &i_this->actor; if (msg == fpcM_ERROR_PROCESS_ID_e) { - msg = fopMsgM_messageSet(msg_no, i_this); + msg = fopMsgM_messageSet(msg_no, actor); msg_end = 0; return TRUE; } @@ -79,7 +76,6 @@ static void message_cont(bst_class* i_this) { if (msg_obj == NULL) { return; } - if (msg_obj->mStatus == fopMsgStts_MSG_DISPLAYED_e) { if (msg_end != 0) { msg_obj->mStatus = fopMsgStts_MSG_ENDS_e; @@ -92,7 +88,7 @@ static void message_cont(bst_class* i_this) { } /* 000001FC-00000268 .text set_hand_AT__FP9bst_classUc */ -static void set_hand_AT(bst_class* i_this, unsigned char param_2) { +static void set_hand_AT(bst_class* i_this, u8 param_2) { for (int i = 0; i < (s32)ARRAY_SIZE(i_this->mCcD_fingers); i++) { if (param_2 != 0) { i_this->mCcD_fingers[i].OnAtSetBit(); @@ -104,7 +100,7 @@ static void set_hand_AT(bst_class* i_this, unsigned char param_2) { } /* 00000268-000002C0 .text set_hand_CO__FP9bst_classUc */ -static void set_hand_CO(bst_class* i_this, unsigned char param_2) { +static void set_hand_CO(bst_class* i_this, u8 param_2) { for (int i = 0; i < (s32)ARRAY_SIZE(i_this->mCcD_fingers); i++) { if (param_2 != 0) { i_this->mCcD_fingers[i].OnCoSetBit(); @@ -115,14 +111,14 @@ static void set_hand_CO(bst_class* i_this, unsigned char param_2) { } /* 000002C0-000003E8 .text anm_init__FP9bst_classifUcfi */ -static void anm_init(bst_class* i_this, int param_2, float morf, unsigned char loop_mode, float play_speed, int sound_idx) { +static void anm_init(bst_class* i_this, int param_2, float morf, u8 loop_mode, float play_speed, int sound_idx) { if (sound_idx >= 0) { void* sound = dComIfG_getObjectRes("Bst", sound_idx); - J3DAnmTransform* bckAnm = (J3DAnmTransform*) dComIfG_getObjectRes("Bst", param_2); - i_this->field_0x02B8->setAnm(bckAnm, loop_mode, morf, play_speed, 0.0f, -1.0f, sound); + J3DAnmTransform* bckAnm = (J3DAnmTransform*)dComIfG_getObjectRes("Bst", param_2); + i_this->m02B8->setAnm(bckAnm, loop_mode, morf, play_speed, 0.0f, -1.0f, sound); } else { - J3DAnmTransform* bckAnm = (J3DAnmTransform*) dComIfG_getObjectRes("Bst", param_2); - i_this->field_0x02B8->setAnm(bckAnm, loop_mode, morf, play_speed, 0.0f, -1.0f, NULL); + J3DAnmTransform* bckAnm = (J3DAnmTransform*)dComIfG_getObjectRes("Bst", param_2); + i_this->m02B8->setAnm(bckAnm, loop_mode, morf, play_speed, 0.0f, -1.0f, NULL); } } @@ -132,144 +128,112 @@ static BOOL nodeCallBackHead(J3DNode* node, int calcTiming) { J3DJoint* joint = (J3DJoint*)node; s32 jnt_no = joint->getJntNo(); J3DModel* model = j3dSys.getModel(); - bst_class* i_this = (bst_class*)model->getUserArea(); - if (i_this != NULL) { mDoMtx_copy(model->getAnmMtx(jnt_no), *calc_mtx); - if (jnt_no == 9) { - mDoMtx_YrotM(*calc_mtx, -i_this->field_0x2E78[1]); + mDoMtx_YrotM(*calc_mtx, -i_this->m2E78[1]); } else if (jnt_no == 12) { - mDoMtx_YrotM(*calc_mtx, i_this->field_0x2E78[1]); + mDoMtx_YrotM(*calc_mtx, i_this->m2E78[1]); } else if (jnt_no == 10) { - mDoMtx_YrotM(*calc_mtx, -i_this->field_0x2E78[0]); + mDoMtx_YrotM(*calc_mtx, -i_this->m2E78[0]); } else if (jnt_no == 11) { - mDoMtx_YrotM(*calc_mtx, i_this->field_0x2E78[0]); + mDoMtx_YrotM(*calc_mtx, i_this->m2E78[0]); } - model->setAnmMtx(jnt_no, *calc_mtx); mDoMtx_copy(*calc_mtx, J3DSys::mCurrentMtx); } } return TRUE; } - /* 00000550-000005B4 .text beam_draw__FP9bst_class */ static void beam_draw(bst_class* i_this) { - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->field_0x0390); i++) { - if (i_this->field_0x04E4[i]) { - mDoExt_modelUpdateDL(i_this->field_0x0390[i]); + for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m0390); i++) { + if (i_this->m04E4[i]) { + mDoExt_modelUpdateDL(i_this->m0390[i]); } } } /* 000005B4-00000950 .text daBst_Draw__FP9bst_class */ static BOOL daBst_Draw(bst_class* i_this) { - /* Nonmatching */ - cXyz temp; + fopAc_ac_c* actor = &i_this->actor; cXyz shadow_pos; - - if (i_this->field_0x02B4 != 0 && boss->field_0x2E9A > 0 && boss->field_0x2E9A < 10) { + cXyz temp; + J3DModel* model_2C8; + if (i_this->mBstPartType != bst_class::Type_HEAD_e && boss->m2E9A > 0 && boss->m2E9A < 10) { return TRUE; } - J3DModel* model_2B8 = i_this->field_0x02B8->getModel(); - - g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &i_this->current.pos, &i_this->tevStr); - g_env_light.setLightTevColorType(model_2B8, &i_this->tevStr); - + J3DModel* model_2B8 = i_this->m02B8->getModel(); + g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &actor->current.pos, &actor->tevStr); + g_env_light.setLightTevColorType(model_2B8, &actor->tevStr); i_this->mpTexMtxAnimator->entry(model_2B8->getModelData()); i_this->mpTevRegAnimator->entry(model_2B8->getModelData()); - i_this->field_0x02B8->entryDL(); - + i_this->m02B8->entryDL(); i_this->mpTexMtxAnimator->remove(model_2B8->getModelData()); i_this->mpTevRegAnimator->remove(model_2B8->getModelData()); - - J3DModel* model_388 = i_this->field_0x0388; + J3DModel* model_388 = i_this->m0388; for (u16 i = 0; i < model_2B8->getModelData()->getJointNum(); i++) { model_388->setAnmMtx(i, model_2B8->getAnmMtx(i)); } for (u16 i = 0; i < model_2B8->getModelData()->getWEvlpMtxNum(); i++) { model_388->setWeightAnmMtx(i, model_2B8->getWeightAnmMtx(i)); } - mDoMtx_copy(i_this->field_0x02B8->getModel()->getAnmMtx(0), *calc_mtx); - - shadow_pos.setall(0.0f); + mDoMtx_copy(i_this->m02B8->getModel()->getAnmMtx(0), *calc_mtx); + temp.setall(0.0f); MtxPosition(&temp, &shadow_pos); shadow_pos.y += REG0_F(1) * 10.0f; - - i_this->mShadowID = dComIfGd_setRealShadow( - i_this->mShadowID, - TRUE, - model_388, - &shadow_pos, - (REG0_F(2) * 10.0f) + 2000.0f, - 0.0f, - &i_this->tevStr - ); - - J3DModel* model_2C8 = i_this->field_0x02C8; + i_this->mShadowID = dComIfGd_setRealShadow(i_this->mShadowID, TRUE, model_388, &shadow_pos, (REG0_F(2) * 10.0f) + 2000.0f, 0.0f, &actor->tevStr); + model_2C8 = i_this->m02C8; i_this->mpBtkAnm->entry(model_2C8->getModelData()); i_this->mpBrkAnm->entry(model_2C8->getModelData()); - - g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &i_this->home.pos, &i_this->mEnvLight); + g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &actor->home.pos, &i_this->mEnvLight); g_env_light.setLightTevColorType(model_2C8, &i_this->mEnvLight); mDoExt_modelUpdateDL(model_2C8); - if (i_this->field_0x02B4 == 0) { - if (i_this->field_0x2E98 > 1) { - mDoGph_gInf_c::setBlureRate(i_this->field_0x2E98); + if (i_this->mBstPartType == bst_class::Type_HEAD_e) { + if (i_this->m2E98 > 1) { + mDoGph_gInf_c::setBlureRate(i_this->m2E98); mDoGph_gInf_c::onBlure(); - } else if (i_this->field_0x2E98 == 1) { - i_this->field_0x2E98 = 0; + } else if (i_this->m2E98 == 1) { + i_this->m2E98 = 0; mDoGph_gInf_c::offBlure(); } - beam_draw(i_this); // yup, this is a static var. static cXyz center_pos(0.0f, 0.0f, 0.0f); - - g_env_light.settingTevStruct(TEV_TYPE_BG0, ¢er_pos, &i_this->field_0x2F20); - g_env_light.setLightTevColorType(i_this->field_0x2FDC, &i_this->field_0x2F20); - i_this->field_0x2FE0->entry(i_this->field_0x2FDC->getModelData()); - - mDoExt_modelUpdateDL(i_this->field_0x2FDC); - g_env_light.setLightTevColorType(i_this->field_0x2FD0, &i_this->field_0x2F20); - - i_this->field_0x2FD8->entry(i_this->field_0x2FD0->getModelData()); - i_this->field_0x2FD4->entry(i_this->field_0x2FD0->getModelData()); - mDoExt_modelUpdateDL(i_this->field_0x2FD0); + g_env_light.settingTevStruct(TEV_TYPE_BG0, ¢er_pos, &i_this->m2F20); + g_env_light.setLightTevColorType(i_this->m2FDC, &i_this->m2F20); + i_this->m2FE0->entry(i_this->m2FDC->getModelData()); + mDoExt_modelUpdateDL(i_this->m2FDC); + g_env_light.setLightTevColorType(i_this->m2FD0, &i_this->m2F20); + i_this->m2FD8->entry(i_this->m2FD0->getModelData()); + i_this->m2FD4->entry(i_this->m2FD0->getModelData()); + mDoExt_modelUpdateDL(i_this->m2FD0); } - dSnap_RegistFig(DSNAP_TYPE_BST, i_this, 1.0f, 1.0f, 1.0f); - + dSnap_RegistFig(DSNAP_TYPE_BST, actor, 1.0f, 1.0f, 1.0f); return TRUE; } /* 00000950-00000B1C .text pos_move__FP9bst_classUc */ -static void pos_move(bst_class* i_this, unsigned char param_2) { +static void pos_move(bst_class* i_this, u8 param_2) { + fopAc_ac_c* actor = &i_this->actor; cXyz vec; - if (!param_2) { - vec = i_this->mTargetPos - i_this->current.pos; - + vec = i_this->mTargetPos - actor->current.pos; s16 y_angle = cM_atan2s(vec.x, vec.z); f32 dist = std::sqrtf(vec.x * vec.x + vec.z * vec.z); - s16 unk_angle = -cM_atan2s(vec.y, dist); - cLib_addCalcAngleS2(&i_this->current.angle.y, y_angle, REG0_S(3) + 5, - i_this->field_0x10EC.x * i_this->field_0x10EC.y); - cLib_addCalcAngleS2(&i_this->current.angle.x, unk_angle, REG0_S(3) + 5, - i_this->field_0x10EC.x * i_this->field_0x10EC.y); + cLib_addCalcAngleS2(&actor->current.angle.y, y_angle, REG0_S(3) + 5, i_this->m10EC.x * i_this->m10EC.y); + cLib_addCalcAngleS2(&actor->current.angle.x, unk_angle, REG0_S(3) + 5, i_this->m10EC.x * i_this->m10EC.y); } - cLib_addCalc2(&i_this->field_0x10EC.y, 1.0f, 1.0f, 0.05f); - + cLib_addCalc2(&i_this->m10EC.y, 1.0f, 1.0f, 0.05f); vec.x = 0.0f; vec.y = 0.0f; - vec.z = i_this->speedF; - - mDoMtx_YrotS(*calc_mtx, i_this->current.angle.y); - mDoMtx_XrotM(*calc_mtx, i_this->current.angle.x); - MtxPosition(&vec, &i_this->speed); - i_this->current.pos += i_this->speed; + vec.z = actor->speedF; + mDoMtx_YrotS(*calc_mtx, actor->current.angle.y); + mDoMtx_XrotM(*calc_mtx, actor->current.angle.x); + MtxPosition(&vec, &actor->speed); + actor->current.pos += actor->speed; } static u16 start_bck_d[] = {BST_BCK_BST_START, BST_BCK_LH_START, BST_BCK_RH_START}; @@ -278,204 +242,162 @@ static u16 start_smoke_name[] = {dPa_name::ID_SCENE_A1DE, dPa_name::ID_SCENE_A1D /* 00000B1C-00000E58 .text stay__FP9bst_class */ static void stay(bst_class* i_this) { - /* Nonmatching */ - fopAcM_OffStatus(i_this, 0); - - i_this->attention_info.flags = 0; + fopAc_ac_c* actor = &i_this->actor; + fopAcM_OffStatus(actor, 0); + actor->attention_info.flags = 0; i_this->mState = 10; - switch (i_this->mDamage) { - case 0: - anm_init(i_this, set_bck_d[i_this->field_0x02B4], 2.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); - i_this->mDamage++; - break; - case 2: - anm_init(i_this, start_bck_d[i_this->field_0x02B4], 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); - i_this->mDamage++; - break; - case 4: { - cXyz vec; - vec.x = 0.0f; - vec.y = 0.0f; - if (i_this->field_0x02B4 != 0) { - anm_init(i_this, start2_bck_d[i_this->field_0x02B4], 10.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); - vec.z = REG0_F(11) + 400.0f; - } else { - vec.z = 10000.0f; - } - dComIfGp_particle_setToon( - start_smoke_name[i_this->field_0x02B4], - &i_this->current.pos, - &i_this->current.angle, - NULL, - 0xB9, - &i_this->mPa_smokeEcallBack, - fopAcM_GetRoomNo(i_this) - ); - - dComIfGp_getVibration().StartShock(REG0_S(2) + 3, -0x21, cXyz(0.0f, 1.0f, 0.0f)); - boss->field_0x2ECC = REG0_F(10) + 15.0f; - i_this->mDamage++; - mDoMtx_YrotS(*calc_mtx, i_this->current.angle.y); - - cXyz pos_vec; - MtxPosition(&vec, &pos_vec); - i_this->mTargetPos = i_this->current.pos + pos_vec; - i_this->field_0x10FC[3] = 0xF; - - // fall-through. + case 0: + anm_init(i_this, set_bck_d[i_this->mBstPartType], 2.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + i_this->mDamage++; + break; + case 2: + anm_init(i_this, start_bck_d[i_this->mBstPartType], 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->mDamage++; + break; + case 4: { + cXyz vec; + vec.x = 0.0f; + vec.y = 0.0f; + if (i_this->mBstPartType != bst_class::Type_HEAD_e) { + anm_init(i_this, start2_bck_d[i_this->mBstPartType], 10.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + vec.z = REG0_F(11) + 400.0f; + } else { + vec.z = 10000.0f; } - case 5: - if (i_this->field_0x02B4 != 0 && i_this->field_0x10FC[3] != 0) { - for (s32 i = 2; i <= 16; i++) { - mDoMtx_copy(i_this->field_0x02B8->getModel()->getAnmMtx(i), *calc_mtx); - - cXyz pos_vec; - cXyz vec(0.0f, 0.0f, 0.0f); - MtxPosition(&vec, &pos_vec); - - dComIfGp_particle_setSimple(dPa_name::ID_SCENE_81D5, &pos_vec); - } + dComIfGp_particle_setToon( + start_smoke_name[i_this->mBstPartType], &actor->current.pos, &actor->current.angle, NULL, 0xB9, &i_this->mPa_smokeEcallBack, fopAcM_GetRoomNo(actor) + ); + dComIfGp_getVibration().StartShock(REG0_S(2) + 3, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + boss->m2ECC = REG0_F(10) + 15.0f; + i_this->mDamage++; + mDoMtx_YrotS(*calc_mtx, actor->current.angle.y); + cXyz pos_vec; + MtxPosition(&vec, &pos_vec); + i_this->mTargetPos = actor->current.pos + pos_vec; + i_this->m10FC[3] = 0xF; + // fallthrough + } + case 5: + if (i_this->mBstPartType != bst_class::Type_HEAD_e && i_this->m10FC[3] != 0) { + for (s32 i = 2; i <= 16; i++) { + mDoMtx_copy(i_this->m02B8->getModel()->getAnmMtx(i), *calc_mtx); + cXyz pos_vec; + cXyz vec(0.0f, 0.0f, 0.0f); + MtxPosition(&vec, &pos_vec); + dComIfGp_particle_setSimple(dPa_name::ID_SCENE_81D5, &pos_vec); } - cLib_addCalc2(&i_this->current.pos.x, i_this->mTargetPos.x, 0.05f, 10.0f); - cLib_addCalc2(&i_this->current.pos.z, i_this->mTargetPos.z, 0.05f, 10.0f); - break; - case 1: - case 3: - return; + } + cLib_addCalc2(&actor->current.pos.x, i_this->mTargetPos.x, 0.05f, 10.0f); + cLib_addCalc2(&actor->current.pos.z, i_this->mTargetPos.z, 0.05f, 10.0f); + break; + case 1: + case 3: + return; } } static u16 fly_btk_d[] = {BST_BTK_BST, BST_BTK_LHAND, BST_BTK_RHAND}; static u16 fly_brk_d[] = {BST_BRK_BST, BST_BRK_LHAND, BST_BRK_RHAND}; - static u16 damage_btk_d[] = {BST_BTK_BST_DAMAGE, BST_BTK_LH_DAMAGE, BST_BTK_RH_DAMAGE}; static u16 damage_brk_d[] = {BST_BRK_BST_DAMAGE, BST_BRK_LH_DAMAGE, BST_BRK_RH_DAMAGE}; /* 00000E58-000014E8 .text fly__FP9bst_class */ static void fly(bst_class* i_this) { - /* Nonmatching */ + /* Nonmatching - regalloc */ + fopAc_ac_c* actor = &i_this->actor; fopAc_ac_c* player = dComIfGp_getPlayer(0); - - if (i_this->field_0x02B4 != 0 && i_this->field_0x10D8 == 6) { - i_this->health = 4; + if (i_this->mBstPartType != bst_class::Type_HEAD_e && i_this->m10D8 == 6) { + actor->health = 4; } - i_this->field_0x10D8 = 1; + i_this->m10D8 = 1; if (i_this->mState == 0) { set_hand_CO(i_this, 1); } - - if (boss->field_0x2E9A != 0 || (i_this->field_0x10D4 & 0x1F) == 0) { + if (boss->m2E9A != 0 || (i_this->mUpdateLastFacingDirIfMultipleOf32 & 0x1F) == 0) { if (cM_rndF(1.0f) < 0.5f) { - i_this->field_0x10E8 = player->shape_angle.y; + i_this->mLastCheckedPlayerFacingDir = player->shape_angle.y; } } - switch (i_this->mDamage) { - case 0: { - anm_init(i_this, fly_bck_d[i_this->field_0x02B4], 10.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); - - J3DAnmTevRegKey* reg_key = (J3DAnmTevRegKey*) dComIfG_getObjectRes("Bst", damage_brk_d[i_this->field_0x02B4]); - i_this->mpTevRegAnimator->init( - i_this->field_0x02B8->getModel()->getModelData(), - reg_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE - ); - - i_this->mpTevRegAnimator->setFrame(REG0_S(8) + 0x1D); - i_this->field_0x02D4 = 1; - i_this->field_0x02C4 = 1; - i_this->mDamage++; - break; - } - case 1: { - J3DAnmTevRegKey* reg_key = (J3DAnmTevRegKey*) dComIfG_getObjectRes("Bst", fly_brk_d[i_this->field_0x02B4]); - i_this->mpTevRegAnimator->init( - i_this->field_0x02B8->getModel()->getModelData(), - reg_key, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, FALSE - ); - - J3DAnmTextureSRTKey* srt_key = (J3DAnmTextureSRTKey*) dComIfG_getObjectRes("Bst", fly_btk_d[i_this->field_0x02B4]); - i_this->mpTexMtxAnimator->init( - i_this->field_0x02B8->getModel()->getModelData(), - srt_key, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, FALSE - ); - - i_this->mDamage++; - i_this->field_0x10EC.y = 0.0f; - break; - } - case 3: { - mDoMtx_YrotS(*calc_mtx, i_this->field_0x10E8); - - cXyz vec; - vec.z = REG0_F(4) + 800.0f; - vec.y = REG0_F(3) + 200.0f; - if (i_this->field_0x02B4 == 0) { - vec.x = 0.0; - vec.z = REG0_F(4) + 1000.0f; - if (boss->field_0x2E7C == 11) { - vec.y = REG0_F(3) + 350.0f; - } - } else if (i_this->field_0x02B4 == 1) { - vec.x = -(REG0_F(2) + 800.0f); - } else if (i_this->field_0x02B4 == 2) { - vec.x = REG0_F(2) + 800.0f; - } - - cXyz pos_vec; - MtxPosition(&vec, &pos_vec); - i_this->mTargetPos = i_this->current.pos + pos_vec; - - if (i_this->field_0x02B4 == 0) { - f32 dist = i_this->mTargetPos.absXZ(); - if (dist > REG0_F(9) + 1350.0f) { - dist /= REG0_F(9) + 1350.0f; - i_this->mTargetPos.x *= dist; - i_this->mTargetPos.z *= dist; - } - } - - cXyz target_diff = i_this->mTargetPos - i_this->current.pos; - if (target_diff.abs() > REG0_F(12) + 300.0f) { - f32 speed_target; - if (i_this->field_0x02B4 == 0 && boss->field_0x2E7C == 11) { - speed_target = 10.0f; - } else { - speed_target = 30.0f; - } - cLib_addCalc2(&i_this->speedF, speed_target, 1.0f, REG0_F(13) + 2.0f); - } else { - cLib_addCalc0(&i_this->speedF, 1.0f, REG0_F(14) + 1.0f); - } - - i_this->field_0x10EC.x = REG0_F(5) + 1500.0f; - - cLib_addCalcAngleS2( - &i_this->shape_angle.y, - fopAcM_searchActorAngleY(i_this, dComIfGp_getPlayer(0)), - 10, - 0x400 - ); - - s16 target_x; - if (i_this->field_0x02B4 == 0 && boss->field_0x2E7C == 11) { - target_x = 0; - } else { - target_x = 3000; - } - - cLib_addCalcAngleS2(&i_this->shape_angle.x, target_x, 10, 256); - cLib_addCalcAngleS2(&i_this->shape_angle.z, 0, 8, 512); - cLib_addCalc2(&i_this->field_0x10EC.z, REG0_F(11) + 50.0f, 1.0f, 2.0f); - break; - } + case 0: { + anm_init(i_this, fly_bck_d[i_this->mBstPartType], 10.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + J3DAnmTevRegKey* reg_key = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bst", damage_brk_d[i_this->mBstPartType]); + i_this->mpTevRegAnimator->init(i_this->m02B8->getModel()->getModelData(), reg_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE); + i_this->mpTevRegAnimator->setFrame(REG0_S(8) + 0x1D); + i_this->m02D4 = 1; + i_this->m02C4 = 1; + i_this->mDamage++; + break; + } + case 1: { + J3DAnmTevRegKey* reg_key = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bst", fly_brk_d[i_this->mBstPartType]); + i_this->mpTevRegAnimator->init(i_this->m02B8->getModel()->getModelData(), reg_key, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, FALSE); + J3DAnmTextureSRTKey* srt_key = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bst", fly_btk_d[i_this->mBstPartType]); + i_this->mpTexMtxAnimator->init(i_this->m02B8->getModel()->getModelData(), srt_key, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, FALSE); + i_this->mDamage++; + i_this->m10EC.y = 0.0f; + //break; + } + case 2: { + mDoMtx_YrotS(*calc_mtx, i_this->mLastCheckedPlayerFacingDir); + cXyz vec; + vec.z = REG0_F(4) + 800.0f; + vec.y = REG0_F(3) + 200.0f; + if (i_this->mBstPartType == bst_class::Type_HEAD_e) { + vec.x = 0.0f; + vec.z = REG0_F(4) + 1000.0f; + if (boss->m2E7C == 11) { + vec.y = REG0_F(3) + 350.0f; + } + } else if (i_this->mBstPartType == bst_class::Type_LEFT_HAND_e) { + vec.x = -(REG0_F(2) + 800.0f); + } else if (i_this->mBstPartType == bst_class::Type_RIGHT_HAND_e) { + vec.x = REG0_F(2) + 800.0f; + } + cXyz pos_vec; + MtxPosition(&vec, &pos_vec); + i_this->mTargetPos = actor->current.pos + pos_vec; + if (i_this->mBstPartType == bst_class::Type_HEAD_e) { + vec = i_this->mTargetPos; + vec.y = 0.0f; + f32 dist = vec.abs(); + if (dist > REG0_F(9) + 1350.0f) { + dist /= REG0_F(9) + 1350.0f; + i_this->mTargetPos.x *= dist; + i_this->mTargetPos.z *= dist; + } + } + cXyz target_diff = i_this->mTargetPos - actor->current.pos; + if (target_diff.abs() > REG0_F(12) + 300.0f) { + f32 speed_target; + if (i_this->mBstPartType == bst_class::Type_HEAD_e && boss->m2E7C == 11) { + speed_target = 10.0f; + } else { + speed_target = 30.0f; + } + cLib_addCalc2(&actor->speedF, speed_target, 1.0f, REG0_F(13) + 2.0f); + } else { + cLib_addCalc0(&actor->speedF, 1.0f, REG0_F(14) + 1.0f); + } + i_this->m10EC.x = REG0_F(5) + 1500.0f; + cLib_addCalcAngleS2(&actor->shape_angle.y, fopAcM_searchPlayerAngleY(actor), 10, 0x400); + s16 target_x; + if (i_this->mBstPartType == bst_class::Type_HEAD_e && boss->m2E7C == 11) { + target_x = 0; + } else { + target_x = 3000; + } + cLib_addCalcAngleS2(&actor->shape_angle.x, target_x, 10, 256); + cLib_addCalcAngleS2(&actor->shape_angle.z, 0, 8, 512); + cLib_addCalc2(&i_this->m10EC.z, REG0_F(11) + 50.0f, 1.0f, 2.0f); + break; + } } - pos_move(i_this, 0); - if (i_this->field_0x02B4 == 0 && i_this->field_0x2E84 == 0 - && (dComIfGs_getArrowNum() == 0 || dComIfGs_getBombNum() == 0)) { - i_this->field_0x2E84 = 600; - i_this->field_0x10D6 = 20; + if (i_this->mBstPartType == bst_class::Type_HEAD_e && i_this->mBombArrowDropTimer == 0 && (dComIfGs_getArrowNum() == 0 || dComIfGs_getBombNum() == 0)) { + i_this->mBombArrowDropTimer = 600; + i_this->mActionType = bst_class::ACTION_HANA_DEMO_e; i_this->mDamage = 0; } } @@ -484,151 +406,471 @@ static u16 downa_bck_d[] = {BST_BCK_BST_FLY, BST_BCK_LH_GOO, BST_BCK_RH_GOO}; /* 000014E8-00001C14 .text down_attack__FP9bst_class */ static void down_attack(bst_class* i_this) { - /* Nonmatching */ + fopAc_ac_c* actor = &i_this->actor; fopAc_ac_c* player = dComIfGp_getPlayer(0); - s8 bVar2 = true; + bool bVar2 = true; s8 bVar4 = false; - - cLib_addCalcAngleS2(&i_this->shape_angle.x, 0, 10, 0x200); - + cXyz target_diff; + cLib_addCalcAngleS2(&actor->shape_angle.x, 0, 10, 0x200); switch (i_this->mDamage) { - case 0: - i_this->mDamage = 1; - - i_this->field_0x10EC.y = 0.0f; - i_this->mTargetPos = player->current.pos; - i_this->mTargetPos.y += REG0_F(7) + 300.0f; - i_this->field_0x10FC[0] = 100; - break; - case 1: { - cLib_addCalc2(&i_this->speedF, 40.0f, 1.0f, REG0_F(13) + 1.0f); - i_this->field_0x10EC.x = REG0_F(5) + 2000.0f; - - cXyz target_diff = i_this->mTargetPos - i_this->current.pos; - if (target_diff.abs() < REG0_F(12) + 200.0f || i_this->field_0x10FC[0] == 0) { - i_this->mDamage++; - } - cLib_addCalcAngleS2(&i_this->shape_angle.y, i_this->current.angle.y, 4, 0x400); - break; + case 0: + i_this->mDamage += 1; + i_this->m10EC.y = 0.0f; + i_this->mTargetPos = player->current.pos; + i_this->mTargetPos.y += REG0_F(7) + 300.0f; + i_this->m10FC[0] = 100; + // fallthrough + case 1: { + cLib_addCalc2(&actor->speedF, 40.0f, 1.0f, REG0_F(13) + 1.0f); + i_this->m10EC.x = REG0_F(5) + 2000.0f; + target_diff = i_this->mTargetPos - actor->current.pos; + if (target_diff.abs() < REG0_F(12) + 200.0f || i_this->m10FC[0] == 0) { + i_this->mDamage++; } - case 2: { - bVar2 = false; - cLib_addCalc2(&i_this->current.pos.x, i_this->mTargetPos.x, 0.5f, std::abs(i_this->speed.x)); - cLib_addCalc2(&i_this->current.pos.y, i_this->mTargetPos.y, 0.5f, std::abs(i_this->speed.y)); - cLib_addCalc2(&i_this->current.pos.z, i_this->mTargetPos.z, 0.5f, std::abs(i_this->speed.z)); - - cLib_addCalcAngleS2(&i_this->shape_angle.y, i_this->current.angle.y, 4, 0x4000); - - cXyz target_diff = i_this->mTargetPos - i_this->current.pos; - if (target_diff.abs() < REG0_F(13) + 50.0f) { - anm_init(i_this, downa_bck_d[i_this->field_0x02B4], 10.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); - i_this->mDamage++; - i_this->speed.y = 0.0f; - - i_this->field_0x10FC[0] = 30; - if (REG0_S(0) == 1) { - i_this->field_0x2E6E = i_this->shape_angle.y + 0x4000; - } else { - i_this->field_0x2E6E = i_this->shape_angle.y - 0x4000; - } - - if (i_this->field_0x02B4 == 2) { - i_this->mFacingDir = 0x4000; - } else { - i_this->mFacingDir = -0x4000; - } - fopAcM_seStartCurrent(i_this, JA_SE_CM_BST_HAND_GRIP, 0); - } - break; - } - case 3: - bVar2 = false; - cLib_addCalc2(&i_this->field_0x1114, -200.0f, 1.0f, 25.0f); - cLib_addCalc2(&i_this->current.pos.x, i_this->mTargetPos.x, 0.5f, std::abs(i_this->speed.x)); - cLib_addCalc2(&i_this->current.pos.z, i_this->mTargetPos.z, 0.5f, std::abs(i_this->speed.z)); - - cLib_addCalcAngleS2(&i_this->shape_angle.z, i_this->mFacingDir, 4, 0x1000); - cLib_addCalcAngleS2(&i_this->shape_angle.y, i_this->field_0x2E6E, 4, 0x1000); - i_this->current.pos.y += i_this->speed.y; - - if (i_this->field_0x10FC[0] == 0) { - set_hand_AT(i_this, 1); - i_this->speed.y -= REG0_F(3) + 60.0f; - - if (i_this->current.pos.y <= REG0_F(4) + 150.0f) { - i_this->current.pos.y = REG0_F(4) + 150.0f; - i_this->speed.y = 0.0f; - - dComIfGp_getVibration().StartShock( - REG0_S(2) + 5, -0x21, cXyz(0.0f, 1.0f, 0.0f) - ); - i_this->field_0x112A = REG0_S(7) + 10; - - fopAcM_seStartCurrent(i_this, JA_SE_CM_BST_1_HAND_ATTACK, 0); - i_this->mDamage++; - i_this->field_0x10FC[0] = 30; - - cXyz particle_pos; - particle_pos.x = i_this->current.pos.x; - particle_pos.z = i_this->current.pos.z; - particle_pos.y = 1.0f; - - dComIfGp_particle_setProjection(dPa_name::ID_SCENE_C1D6, &particle_pos); - dComIfGp_particle_setToon( - dPa_name::ID_SCENE_A1D8, - &particle_pos, - NULL, - NULL, - 0xB9, - &i_this->mPa_smokeEcallBack, - fopAcM_GetRoomNo(i_this) - ); - } - } else { - i_this->speed.y += REG0_F(14) + 0.5f; - } - break; - case 4: - bVar2 = false; - cLib_addCalc2(&i_this->field_0x1114, -200.0f, 1.0f, 25.0f); - if (i_this->field_0x10FC[0] == 0) { - bVar4 = true; - } - break; + cLib_addCalcAngleS2(&actor->shape_angle.y, actor->current.angle.y, 4, 0x400); + break; + } + case 2: { + bVar2 = false; + cLib_addCalc2(&actor->current.pos.x, i_this->mTargetPos.x, 0.5f, std::abs(actor->speed.x)); + cLib_addCalc2(&actor->current.pos.y, i_this->mTargetPos.y, 0.5f, std::abs(actor->speed.y)); + cLib_addCalc2(&actor->current.pos.z, i_this->mTargetPos.z, 0.5f, std::abs(actor->speed.z)); + cLib_addCalcAngleS2(&actor->shape_angle.y, actor->current.angle.y, 4, 0x4000); + target_diff = i_this->mTargetPos - actor->current.pos; + if (target_diff.abs() < REG0_F(13) + 50.0f) { + anm_init(i_this, downa_bck_d[i_this->mBstPartType], 10.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + i_this->mDamage++; + actor->speed.y = 0.0f; + i_this->m10FC[0] = 30; + if (REG0_S(0) == 1) { + i_this->m2E6E = actor->shape_angle.y + 0x4000; + } else { + i_this->m2E6E = actor->shape_angle.y - 0x4000; + } + if (i_this->mBstPartType == bst_class::Type_RIGHT_HAND_e) { + i_this->mFacingDir = 0x4000; + } else { + i_this->mFacingDir = -0x4000; + } + fopAcM_seStartCurrent(actor, JA_SE_CM_BST_HAND_GRIP, 0); + } + break; + } + case 3: + bVar2 = false; + cLib_addCalc2(&i_this->m1114, -200.0f, 1.0f, 25.0f); + cLib_addCalc2(&actor->current.pos.x, i_this->mTargetPos.x, 0.5f, std::abs(actor->speed.x)); + cLib_addCalc2(&actor->current.pos.z, i_this->mTargetPos.z, 0.5f, std::abs(actor->speed.z)); + cLib_addCalcAngleS2(&actor->shape_angle.z, i_this->mFacingDir, 4, 0x1000); + cLib_addCalcAngleS2(&actor->shape_angle.y, i_this->m2E6E, 4, 0x1000); + actor->current.pos.y += actor->speed.y; + if (i_this->m10FC[0] == 0) { + set_hand_AT(i_this, 1); + actor->speed.y -= REG0_F(3) + 60.0f; + if (actor->current.pos.y <= REG0_F(4) + 150.0f) { + actor->current.pos.y = REG0_F(4) + 150.0f; + actor->speed.y = 0.0f; + dComIfGp_getVibration().StartShock(REG0_S(2) + 5, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + i_this->m112A = REG0_S(7) + 10; + fopAcM_seStartCurrent(actor, JA_SE_CM_BST_1_HAND_ATTACK, 0); + i_this->mDamage++; + i_this->m10FC[0] = 30; + cXyz particle_pos; + particle_pos = actor->current.pos; + particle_pos.y = 1.0f; + dComIfGp_particle_setProjection(dPa_name::ID_SCENE_C1D6, &particle_pos); + dComIfGp_particle_setToon(dPa_name::ID_SCENE_A1D8, &particle_pos, NULL, NULL, 0xB9, &i_this->mPa_smokeEcallBack, fopAcM_GetRoomNo(actor)); + } + } else { + actor->speed.y += REG0_F(14) + 0.5f; + } + break; + case 4: + bVar2 = false; + cLib_addCalc2(&i_this->m1114, -200.0f, 1.0f, 25.0f); + if (i_this->m10FC[0] == 0) { + bVar4 = true; + } + break; } - if (bVar2) { pos_move(i_this, 0); } if (bVar4 || i_this->mBgS_Acch.ChkWallHit()) { - i_this->field_0x10D6 = 1; + i_this->mActionType = bst_class::ACTION_FLY_e; i_this->mDamage = 0; - - fopAcM_seStartCurrent(i_this, JA_SE_CM_BST_HAND_GRIP_OPEN, 0); + fopAcM_seStartCurrent(actor, JA_SE_CM_BST_HAND_GRIP_OPEN, 0); if (!bVar4) { - s32 hand_index = 2 - i_this->field_0x02B4; - if (hand[hand_index]->field_0x10D6 == 10) { - hand[hand_index]->field_0x10D6 = 1; + s32 hand_index = 2 - i_this->mBstPartType; + if (hand[hand_index]->mActionType == bst_class::ACTION_DOWN_ATTACK_e) { + hand[hand_index]->mActionType = bst_class::ACTION_FLY_e; hand[hand_index]->mDamage = 0; - hand[hand_index]->speedF = 0.0f; + hand[hand_index]->actor.speedF = 0.0f; } } } } +static u16 paa_bck_d[] = {0, BST_BCK_LH_PAA, BST_BCK_RH_PAA}; + /* 00001C14-000023C8 .text paa_attack__FP9bst_class */ -static void paa_attack(bst_class*) { - /* Nonmatching */ +static void paa_attack(bst_class* i_this) { + /* Nonmatching - regalloc */ + fopAc_ac_c* actor = &i_this->actor; + s8 bVar3; + bool bVar1; + short sVar6; + cXyz local_38; + cXyz cStack_44; + + fopAc_ac_c* player = dComIfGp_getPlayer(0); + bVar1 = true; + bVar3 = false; + cLib_addCalcAngleS2(&actor->shape_angle.x, 0, 10, 0x200); + cLib_addCalcAngleS2(&actor->shape_angle.z, 0, 10, 0x400); + cLib_addCalc2(&i_this->m1118, -40.0f, 1.0f, 10.0f); + switch (i_this->mDamage) { + case 0: + i_this->mDamage += 1; + i_this->m10EC.y = 0.0f; + i_this->m111C = player->shape_angle.y; + anm_init(i_this, paa_bck_d[i_this->mBstPartType], 10.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + i_this->m10FC[0] = REG0_S(1) + 0x50; + // fallthrough + case 1: + local_38 = i_this->mTargetPos - actor->current.pos; + if (local_38.abs() > REG0_F(0xc) + 200.0f) { + cLib_addCalc2(&actor->speedF, 40.0f, 1.0f, REG0_F(0xd) + 2.0f); + } else { + cLib_addCalc0(&actor->speedF, 1.0f, (REG0_F(0xd) + 2.0f)); + } + i_this->m10EC.x = REG0_F(5) + 8000.0f; + mDoMtx_YrotS(*calc_mtx, (int)i_this->m111C); + if (i_this->mBstPartType == bst_class::Type_LEFT_HAND_e) { + local_38.x = -(REG0_F(2) + 700.0f); + sVar6 = 0x4000; + } else { + local_38.x = REG0_F(2) + 700.0f; + sVar6 = -0x4000; + } + local_38.y = REG0_F(3); + local_38.z = REG0_F(4); + MtxPosition(&local_38, &cStack_44); + i_this->mTargetPos = player->current.pos + cStack_44; + cLib_addCalcAngleS2(&actor->shape_angle.y, i_this->m111C + sVar6, 10, 0x800); + if (i_this->m10FC[0] == 0) { + i_this->mDamage++; + i_this->mTargetPos = player->current.pos; + sVar6 = fopAcM_searchPlayerAngleY(actor); + actor->current.angle.y = sVar6; + } + break; + case 2: + cLib_addCalc2(&actor->speedF, REG0_F(0xe) + 140.0f, 1.0f, REG0_F(0xf) + 10.0f); + i_this->m10EC.x = REG0_F(5) + 10000.0f; + local_38 = i_this->mTargetPos - actor->current.pos; + if (local_38.abs() < REG0_F(0x10) + 200.0f) { + i_this->mDamage++; + i_this->m10FC[0] = REG0_S(7) + 0x1e; + } + break; + case 3: + bVar1 = false; + if (i_this->m10FC[0] >= 0x1C) { + if (i_this->m10FC[0] == 0x1c) { + if (i_this->mBstPartType == bst_class::Type_LEFT_HAND_e) { + fopAcM_seStartCurrent(actor, JA_SE_CM_BST_HAND_CLAP, 0); + csXyz local_70; + local_70.x = actor->shape_angle.x; + local_70.z = actor->shape_angle.z; + local_70.y += 0x4000; + dComIfGp_particle_setProjection(dPa_name::ID_SCENE_C1D7, &i_this->mTargetPos, &local_70); + dComIfGp_particle_setToon( + dPa_name::ID_SCENE_A1DA, &i_this->mTargetPos, &local_70, NULL, 0xB9, &i_this->mPa_smokeEcallBack, fopAcM_GetRoomNo(actor) + ); + } + i_this->m112A = REG0_S(8) + 5; + } + set_hand_AT(i_this, 1); + } + if (i_this->mBstPartType == bst_class::Type_LEFT_HAND_e) { + sVar6 = 0x4000; + } else { + sVar6 = -0x4000; + } + cLib_addCalcAngleS2(&actor->shape_angle.y, i_this->m111C + sVar6, 1, 0x1000); + cLib_addCalc2(&actor->current.pos.x, i_this->mTargetPos.x, 1.0f, std::fabsf(actor->speed.x)); + cLib_addCalc2(&actor->current.pos.z, i_this->mTargetPos.z, 1.0f, std::fabsf(actor->speed.z)); + if (i_this->m10FC[0] == 0) { + i_this->mDamage++; + actor->speedF = 0.0f; + i_this->m10FC[0] = REG0_S(3) + 0x1e; + actor->current.angle.y += 0x8000; + mDoMtx_YrotS(*calc_mtx, (int)i_this->m111C); + if (i_this->mBstPartType == bst_class::Type_LEFT_HAND_e) { + local_38.x = -(REG0_F(2) + 4000.0f); + } else { + local_38.x = REG0_F(2) + 4000.0f; + } + local_38.y = REG0_F(3); + local_38.z = REG0_F(4); + MtxPosition(&local_38, &cStack_44); + i_this->mTargetPos += cStack_44; + } + break; + case 4: + cLib_addCalc2(&actor->speedF, 40.0f, 1.0f, REG0_F(0xd) + 1.0f); + i_this->m10EC.x = REG0_F(5) + 2000.0f; + if (i_this->m10FC[0] == 0) { + bVar3 = true; + } + break; + } + if (bVar1) { + pos_move(i_this, 0); + } + if (actor->current.pos.y <= REG0_F(4) + 30.0f) { + actor->current.pos.y = REG0_F(4) + 30.0f; + } + if ((bVar3) || (i_this->mBgS_Acch.ChkWallHit())) { + i_this->mActionType = bst_class::ACTION_FLY_e; + i_this->mDamage = 0; + i_this->mStateTimer = (s16)(int)(cM_rndF(100.0f) + 100.0f); + if (!bVar3) { + s32 hand_index = 2 - i_this->mBstPartType; + if (hand[hand_index]->mActionType == bst_class::ACTION_PAA_ATTACK_e) { + hand[hand_index]->mActionType = bst_class::ACTION_FLY_e; + hand[hand_index]->mDamage = 0; + hand[hand_index]->mStateTimer = (s16)(int)(cM_rndF(100.0f) + 100.0f); + } + } + } } +static u16 awasu_bck_d[] = {0, BST_BCK_LH_AWASE, BST_BCK_RH_AWASU}; + /* 00002404-00002E08 .text kumi_attack__FP9bst_class */ -static void kumi_attack(bst_class*) { - /* Nonmatching */ +static void kumi_attack(bst_class* i_this) { + /* Nonmatching - regalloc */ + fopAc_ac_c* actor = &i_this->actor; + s8 bVar3; + bool bVar1; + short sVar5; + cXyz local_38; + cXyz cStack_44; + cXyz local_50; + + fopAc_ac_c* player = dComIfGp_getPlayer(0); + bVar1 = true; + bVar3 = false; + cLib_addCalcAngleS2(&actor->shape_angle.x, 0, 10, 0x200); + cLib_addCalc2(&i_this->m1110, 30.0f, 1.0f, 10.0f); + cLib_addCalc2(&i_this->m1118, -80.0f, 1.0f, 10.0f); + cLib_addCalc2(&i_this->m1114, -200.0f, 1.0f, 30.0f); + switch (i_this->mDamage) { + case 0: + i_this->mDamage++; + i_this->m10EC.y = 0.0f; + i_this->m111C = player->shape_angle.y; + anm_init(i_this, awasu_bck_d[i_this->mBstPartType], 10.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + i_this->m10FC[0] = REG0_S(1) + 0x46; + // fallthrough + case 1: + local_38 = i_this->mTargetPos - actor->current.pos; + if (local_38.abs() > REG0_F(0xc) + 200.0f) { + cLib_addCalc2(&actor->speedF, 40.0f, 1.0f, REG0_F(0xd) + 2.0f); + } else { + cLib_addCalc0(&actor->speedF, 1.0f, (REG0_F(0xd) + 2.0f)); + } + i_this->m10EC.x = REG0_F(5) + 8000.0f; + mDoMtx_YrotS(*calc_mtx, (int)i_this->m111C); + if (i_this->mBstPartType == bst_class::Type_LEFT_HAND_e) { + local_38.x = -(REG0_F(2) + 500.0f); + sVar5 = 0x4000; + } else { + local_38.x = REG0_F(2) + 500.0f; + sVar5 = -0x4000; + } + local_38.y = REG0_F(3) + 400.0f; + local_38.z = 0.0f; + MtxPosition(&local_38, &cStack_44); + i_this->mTargetPos = player->current.pos + cStack_44; + cLib_addCalcAngleS2(&actor->shape_angle.y, i_this->m111C + sVar5, 10, 0x800); + if (i_this->m10FC[0] == 0) { + i_this->mDamage++; + i_this->mTargetPos = player->current.pos; + i_this->mTargetPos.y += REG0_F(3) + 500.0f; + sVar5 = fopAcM_searchPlayerAngleY(actor); + actor->current.angle.y = sVar5; + } + break; + case 2: + cLib_addCalc2(&actor->speedF, REG0_F(0xe) + 100.0f, 1.0f, REG0_F(0xf) + 8.0f); + i_this->m10EC.x = REG0_F(5) + 10000.0f; + local_38 = i_this->mTargetPos - actor->current.pos; + if (local_38.abs() < REG0_F(0x10) + 100.0f) { + i_this->mDamage++; + } + break; + case 3: + bVar1 = false; + if (i_this->mBstPartType == bst_class::Type_LEFT_HAND_e) { + sVar5 = 0x4000; + } else { + sVar5 = -0x4000; + } + cLib_addCalcAngleS2(&actor->shape_angle.y, i_this->m111C + sVar5, 1, 0x1000); + cLib_addCalc2(&actor->current.pos.x, i_this->mTargetPos.x, 1.0f, std::fabsf(actor->speed.x)); + cLib_addCalc2(&actor->current.pos.y, i_this->mTargetPos.y, 1.0f, std::fabsf(actor->speed.y) + 10.0f); + cLib_addCalc2(&actor->current.pos.z, i_this->mTargetPos.z, 1.0f, std::fabsf(actor->speed.z)); + local_38 = hand[0]->actor.current.pos - hand[1]->actor.current.pos; + if (local_38.abs() < 1.0f) { + i_this->mDamage++; + i_this->m10FC[0] = REG0_S(3) + 10; + fopAcM_seStartCurrent(actor, JA_SE_CM_BST_HAND_SHAKE, 0); + actor->speed.y = 0.0f; + } + break; + case 4: + bVar1 = false; + actor->current.pos.y = actor->current.pos.y + actor->speed.y; + if (i_this->m10FC[0] <= 1) { + if (i_this->mBstPartType == bst_class::Type_RIGHT_HAND_e) { + i_this->mFacingDir = 0x4000; + } else { + i_this->mFacingDir = -0x4000; + } + cLib_addCalcAngleS2(&actor->shape_angle.z, i_this->mFacingDir, 1, 0x1000); + set_hand_AT(i_this, 1); + actor->speed.y = actor->speed.y - (REG0_F(3) + 60.0f); + if (actor->current.pos.y <= REG0_F(4) + 150.0f) { + actor->current.pos.y = REG0_F(4) + 150.0f; + actor->speed.y = 0.0f; + if (i_this->mBstPartType == bst_class::Type_LEFT_HAND_e) { + local_50 = i_this->mTargetPos; + local_50.y = 1.0f; + dComIfGp_particle_setProjection(dPa_name::ID_SCENE_C1D6, &local_50); + dComIfGp_particle_setToon(dPa_name::ID_SCENE_A1D9, &local_50, NULL, NULL, 0xb9, &i_this->mPa_smokeEcallBack, fopAcM_GetRoomNo(actor)); + dComIfGp_getVibration().StartShock(REG0_S(2) + 5, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + fopAcM_seStartCurrent(actor, JA_SE_CM_BST_2_HAND_ATTACK, 0); + } + i_this->m112A = REG0_S(7) + 10; + i_this->mDamage++; + i_this->m10FC[0] = 0x28; + } + } else { + actor->speed.y += REG0_F(0xe) + 1.0f; + if (i_this->mBstPartType == bst_class::Type_RIGHT_HAND_e) { + i_this->mFacingDir = -0x1000; + } else { + i_this->mFacingDir = 0x1000; + } + cLib_addCalcAngleS2(&actor->shape_angle.z, i_this->mFacingDir, 10, 0x200); + } + break; + case 5: + bVar1 = false; + if (i_this->m10FC[0] == 0) { + bVar3 = true; + } + break; + } + if (bVar1) { + pos_move(i_this, 0); + } + if ((bVar3) || (i_this->mBgS_Acch).ChkWallHit()) { + i_this->mActionType = bst_class::ACTION_FLY_e; + i_this->mDamage = 0; + actor->speedF = 0.0f; + actor->current.angle.y = actor->current.angle.y + 0x8000; + i_this->mStateTimer = (s16)(int)(cM_rndF(100.0f) + 100.0f); + i_this->mState = 0x28; + fopAcM_seStartCurrent(actor, JA_SE_CM_BST_HAND_RELEASE, 0); + if (!bVar3) { + s32 hand_index = 2 - i_this->mBstPartType; + if (hand[hand_index]->mActionType == bst_class::ACTION_KUMI_ATTACK_e) { + hand[hand_index]->mActionType = bst_class::ACTION_FLY_e; + hand[hand_index]->mDamage = 0; + hand[hand_index]->actor.speedF = 0.0f; + hand[hand_index]->actor.current.angle.y += 0x8000; + hand[hand_index]->mStateTimer = (s16)(int)(cM_rndF(100.0f) + 100.0f); + hand[hand_index]->mState = 0x28; + fopAcM_seStartCurrent(&hand[hand_index]->actor, JA_SE_CM_BST_HAND_RELEASE, 0); + } + } + } } /* 00002E08-0000318C .text harai_attack__FP9bst_class */ -static void harai_attack(bst_class*) { - /* Nonmatching */ +static void harai_attack(bst_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + short sVar2; + f32 dVar4; + cXyz local_34; + + u8 cVar3 = 0; + set_hand_CO(i_this, 1); + cLib_addCalcAngleS2(&actor->shape_angle.x, 0, 10, 0x200); + cLib_addCalcAngleS2(&actor->shape_angle.y, actor->current.angle.y, 4, 0x1000); + if (i_this->mBstPartType == bst_class::Type_RIGHT_HAND_e) { + i_this->mFacingDir = 0x4000; + dVar4 = -(REG0_F(0xb) + 50.0f); + } else { + i_this->mFacingDir = -0x4000; + dVar4 = (REG0_F(0xb) + 50.0f); + } + cLib_addCalcAngleS2(&actor->shape_angle.z, i_this->mFacingDir, 8, 0x400); + cLib_addCalc2(&i_this->m1110, dVar4, 1.0f, 10.0f); + switch (i_this->mDamage) { + case 0: + i_this->mDamage++; + i_this->m10EC.y = 0.0f; + actor->speedF = 0.0f; + i_this->m10FC[0] = REG0_S(5) + 0x14; + sVar2 = fopAcM_searchPlayerAngleY(actor); + actor->current.angle.y = sVar2; + anm_init(i_this, fly_bck_d[i_this->mBstPartType], 10.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + // fallthrough + case 1: + cVar3 = 1; + cLib_addCalc2(&actor->speedF, 60.0f, 1.0f, REG0_F(0xd) + 2.0f); + i_this->m10EC.x = REG0_F(5) + 2000.0f; + if (i_this->m10FC[0] == 0) { + i_this->mDamage++; + i_this->m10FC[0] = REG0_S(6) + 0x3c; + } + break; + case 2: + cVar3 = 1; + sVar2 = (REG0_S(4) + 0x15e); + if (i_this->mBstPartType == bst_class::Type_RIGHT_HAND_e) { + actor->current.angle.y = actor->current.angle.y + sVar2; + } else { + actor->current.angle.y = actor->current.angle.y - sVar2; + } + local_34 = actor->current.pos; + local_34.y = 0.0f; + if (i_this->m10FC[0] != 0) { + if (!(local_34.abs() > 1700.0f)) { + break; + } + } + i_this->m10FC[0] = 0x1e; + i_this->mDamage++; + break; + case 3: + cVar3 = 1; + cLib_addCalc0(&actor->speedF, 1.0f, (REG0_F(0xd) + 3.0f)); + if (i_this->m10FC[0] == 0) { + i_this->mActionType = bst_class::ACTION_FLY_e; + i_this->mDamage = 0; + i_this->mStateTimer = (s16)(int)(cM_rndF(60.0f) + 60.0f); + } + break; + } + actor->current.angle.x = 0; + cLib_addCalc2(&actor->current.pos.y, REG0_F(7) + 180.0f, 0.2f, 10.0f); + pos_move(i_this, cVar3); } static u16 sleep_btk_d[] = {BST_BCK_BST_SLEEP, BST_BTK_LH_END, BST_BTK_RH_END}; @@ -636,186 +878,195 @@ static u16 sleep_brk_d[] = {BST_BRK_BST, BST_BRK_LH_END, BST_BRK_RH_END}; /* 0000318C-00003470 .text sleep__FP9bst_class */ static void sleep(bst_class* i_this) { - /* Nonmatching */ - i_this->field_0x10D8 = 6; + fopAc_ac_c* actor = &i_this->actor; + i_this->m10D8 = 6; set_hand_CO(i_this, 1); - i_this->mState = 10; - fopAcM_OffStatus(i_this, 0); - i_this->attention_info.flags = 0; - - cLib_addCalc2(&i_this->field_0x10EC.z, REG0_F(11) + 50.0f, 1.0f, 2.0f); + fopAcM_OffStatus(actor, 0); + actor->attention_info.flags = 0; + cLib_addCalc2(&i_this->m10EC.z, REG0_F(11) + 50.0f, 1.0f, 2.0f); switch (i_this->mDamage) { - default: - return; - case 0: { - anm_init(i_this, down_bck_d[i_this->field_0x02B4], 20.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); - - J3DAnmTevRegKey* reg_key = (J3DAnmTevRegKey*) dComIfG_getObjectRes("Bst", down_bck_d[i_this->field_0x02B4]); - i_this->mpTevRegAnimator->init( - i_this->field_0x02B8->getModel()->getModelData(), - reg_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE - ); - - J3DAnmTextureSRTKey* srt_key = (J3DAnmTextureSRTKey*) dComIfG_getObjectRes("Bst", sleep_btk_d[i_this->field_0x02B4]); - i_this->mpTexMtxAnimator->init( - i_this->field_0x02B8->getModel()->getModelData(), - srt_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE - ); - - i_this->mDamage++; - fopAcM_seStart(i_this, JA_SE_CM_BST_HAND_EYE_CLOSE, 0); - - // fall-through. - } - case 1: - if (i_this->field_0x10FC[0] == 0) { - i_this->mTargetPos.x = cM_rndFX(1500.0f); - i_this->mTargetPos.y = cM_rndF(200.0f) + 600.0f; - if (i_this->field_0x02B4 == 1) { - i_this->mTargetPos.y += 350.0f; - } - i_this->mTargetPos.z = cM_rndFX(1500.0f); - i_this->field_0x10FC[0] = cM_rndF(30.0f); - } - i_this->field_0x10EC.x = REG0_F(5) + 500.0f; - i_this->speedF = REG0_F(6) + 10.0f; - if (i_this->field_0x10FC[1] == 0) { - i_this->field_0x10D6 = 1; - i_this->mDamage = 0; - fopAcM_seStart(i_this, JA_SE_CM_BST_HAND_EYE_OPEN, 0); - } - break; + case 0: { + anm_init(i_this, down_bck_d[i_this->mBstPartType], 20.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + J3DAnmTevRegKey* reg_key = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bst", sleep_brk_d[i_this->mBstPartType]); + i_this->mpTevRegAnimator->init(i_this->m02B8->getModel()->getModelData(), reg_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE); + J3DAnmTextureSRTKey* srt_key = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bst", sleep_btk_d[i_this->mBstPartType]); + i_this->mpTexMtxAnimator->init(i_this->m02B8->getModel()->getModelData(), srt_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE); + i_this->mDamage++; + fopAcM_seStart(actor, JA_SE_CM_BST_HAND_EYE_CLOSE, 0); + // fallthrough + } + case 1: + if (i_this->m10FC[0] == 0) { + i_this->mTargetPos.x = cM_rndFX(1500.0f); + i_this->mTargetPos.y = cM_rndF(200.0f) + 600.0f; + if (i_this->mBstPartType == bst_class::Type_LEFT_HAND_e) { + i_this->mTargetPos.y += 350.0f; + } + i_this->mTargetPos.z = cM_rndFX(1500.0f); + i_this->m10FC[0] = cM_rndF(30.0f); + } + i_this->m10EC.x = REG0_F(5) + 500.0f; + actor->speedF = REG0_F(6) + 10.0f; + if (i_this->m10FC[1] == 0) { + i_this->mActionType = bst_class::ACTION_FLY_e; + i_this->mDamage = 0; + fopAcM_seStart(actor, JA_SE_CM_BST_HAND_EYE_OPEN, 0); + } + default: + return pos_move(i_this, 0); } - - pos_move(i_this, 0); } /* 00003470-000035BC .text beam_set__FP9bst_class */ static void beam_set(bst_class* i_this) { - /* Nonmatching */ + fopAc_ac_c* actor = &i_this->actor; for (s32 i = 0; i < 10; i++) { - if (i_this->field_0x04E4[i]) { + if (i_this->m04E4[i]) { continue; } - i_this->field_0x04E4[i] = 1; - - mDoMtx_copy(i_this->field_0x02B8->getModel()->getAnmMtx(REG0_S(5) + 3), *calc_mtx); + i_this->m04E4[i] = 1; + mDoMtx_copy(i_this->m02B8->getModel()->getAnmMtx(REG0_S(5) + 3), *calc_mtx); cXyz vec(0.0f, 0.0f, 0.0f); - MtxPosition(&vec, &i_this->field_0x03B8[i]); - - i_this->field_0x04A8[i] = i_this->shape_angle; - mDoMtx_YrotS(*calc_mtx, i_this->field_0x04A8[i].y); - mDoMtx_XrotM(*calc_mtx, i_this->field_0x04A8[i].x); - + MtxPosition(&vec, &i_this->m03B8[i]); + i_this->m04A8[i] = actor->shape_angle; + mDoMtx_YrotS(*calc_mtx, i_this->m04A8[i].y); + mDoMtx_XrotM(*calc_mtx, i_this->m04A8[i].x); vec.set(0.0f, 0.0f, REG0_F(12) + 160.0f); - // MtxPosition call here. - MtxPosition(&vec, &i_this->field_0x0430[i]); - - i_this->field_0x10A8[i] = 1.0f; + MtxPosition(&vec, &i_this->m0430[i]); + i_this->m10A8[i] = 1.0f; return; } } +static u16 charge_e_name[] = {dPa_name::ID_SCENE_81C2, dPa_name::ID_SCENE_81C3}; + /* 000035BC-00003B94 .text beam_attack__FP9bst_class */ static void beam_attack(bst_class* i_this) { - /* Nonmatching */ + fopAc_ac_c* actor = &i_this->actor; fopAc_ac_c* player = dComIfGp_getPlayer(0); - - s8 bVar3 = false; - i_this->field_0x2E74[0] = 10; - i_this->field_0x2E74[1] = 10; - if (i_this->field_0x2E84 < 120) { - i_this->field_0x2E84 = 120; + bool bVar3 = false; + i_this->m2E74[0] = 10; + i_this->m2E74[1] = 10; + if (i_this->mBombArrowDropTimer < 120) { + i_this->mBombArrowDropTimer = 120; } - - cXyz actor_vec = player->current.pos - i_this->current.pos; - actor_vec.y += i_this->field_0x10D0; - + cXyz actor_vec = player->current.pos - actor->current.pos; + actor_vec.y += i_this->m10D0; s16 angle = cM_atan2s(actor_vec.x, actor_vec.z); - cLib_addCalcAngleS2(&i_this->shape_angle.y, angle, 4, 0x800); - - f32 dist = fopAcM_searchActorDistance(i_this, dComIfGp_getPlayer(0)); + cLib_addCalcAngleS2(&actor->shape_angle.y, angle, 4, 0x800); + f32 fVar13 = std::sqrtf(actor_vec.x * actor_vec.x + actor_vec.z * actor_vec.z); + cLib_addCalcAngleS2(&actor->shape_angle.x, -cM_atan2s(actor_vec.y, fVar13), 4, 0x800); + cLib_addCalc2(&actor->current.pos.y, REG0_F(0xb) + 400.0f, 0.05f, 30.0f); + switch (i_this->mDamage) { + case 0: + i_this->mDamage++; + anm_init(i_this, 7, 5.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + fopAcM_seStart(actor, JA_SE_CM_BST_MOUTH_OPEN, 0); + break; + case 1: + if (i_this->m02B8->isStop()) { + i_this->mDamage++; + anm_init(i_this, 8, 1.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + i_this->m10FC[0] = 0x2d; + for (s32 i = 0; i < 2; i++) { + i_this->m2ED8[i] = dComIfGp_particle_set(charge_e_name[i], &actor->current.pos); + } + } + break; + case 2: + fopAcM_seStart(actor, JA_SE_CM_BST_BEAM_PREPARE, 0); + i_this->mRoomState = 5; + if (i_this->m10FC[0] == 0) { + for (s32 i = 0; i < 2; i++) { + if (i_this->m2ED8[i] != NULL) { + i_this->m2ED8[i]->becomeInvalidEmitter(); + i_this->m2ED8[i] = NULL; + } + } + i_this->mDamage++; + anm_init(i_this, 6, 1.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + i_this->m10FC[0] = REG0_S(4) + 0x32; + } + break; + case 3: + cLib_addCalc2(&i_this->m10D0, REG0_F(6), 0.1f, REG0_F(5) + 20.0f); + if ((i_this->m10FC[0] & 3U) == 0) { + i_this->mRoomState = 6; + beam_set(i_this); + fopAcM_seStart(actor, JA_SE_CM_BST_BEAM_FIRE, 0); + } + if (i_this->m10FC[0] == 0) { + bVar3 = true; + } + break; + } + f32 dist = fopAcM_searchActorDistance(actor, dComIfGp_getPlayer(0)); if (dist < REG0_F(9) + 500.0f || bVar3) { i_this->mRoomState = 8; - i_this->field_0x10D6 = 1; + i_this->mActionType = bst_class::ACTION_FLY_e; i_this->mDamage = 0; - i_this->speedF = 0.0f; - - fopAcM_seStart(i_this, JA_SE_CM_BST_MOUTH_CLOSE, 0); + actor->speedF = 0.0f; + fopAcM_seStart(actor, JA_SE_CM_BST_MOUTH_CLOSE, 0); s16 sVar6; - if (i_this->health == 0) { + if (actor->health == 0) { sVar6 = cM_rndF(50.0f) + 100.0f; - } else if (i_this->health == 1) { + } else if (actor->health == 1) { sVar6 = cM_rndF(70.0f) + 120.0f; - } else if (i_this->health == 2) { + } else if (actor->health == 2) { sVar6 = cM_rndF(80.0f) + 140.0f; - } else if (i_this->health == 3) { + } else if (actor->health == 3) { sVar6 = cM_rndF(90.0f) + 150.0f; } else { sVar6 = cM_rndF(100.0f) + 150.0f; } - i_this->field_0x2E7E[1] = sVar6; + i_this->m2E7E[1] = sVar6; } - for (s32 i = 0; i < 2; i++) { - JPABaseEmitter* emitter = i_this->field_0x2ED8[i]; + JPABaseEmitter* emitter = i_this->m2ED8[i]; if (emitter != NULL) { - emitter->setGlobalRTMatrix(i_this->field_0x02B8->getModel()->getAnmMtx(0)); + emitter->setGlobalRTMatrix(i_this->m02B8->getModel()->getAnmMtx(0)); } } } /* 00003B94-00003DD8 .text damage__FP9bst_class */ static void damage(bst_class* i_this) { - /* Nonmatching */ + fopAc_ac_c* actor = &i_this->actor; i_this->mState = 10; - switch (i_this->mDamage) { - default: - return; - case 0: { - if (i_this->field_0x02B4 != 0) { - anm_init(i_this, damage_bck_d[i_this->field_0x02B4], 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); - } - - J3DAnmTevRegKey* reg_key = (J3DAnmTevRegKey*) dComIfG_getObjectRes("Bst", damage_brk_d[i_this->field_0x02B4]); - i_this->mpTevRegAnimator->init( - i_this->field_0x02B8->getModel()->getModelData(), - reg_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE - ); - - J3DAnmTextureSRTKey* srt_key = (J3DAnmTextureSRTKey*) dComIfG_getObjectRes("Bst", damage_btk_d[i_this->field_0x02B4]); - i_this->mpTexMtxAnimator->init( - i_this->field_0x02B8->getModel()->getModelData(), - srt_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE - ); - - i_this->mDamage++; - i_this->field_0x10FC[0] = 30; - break; + default: + return; + case 0: { + if (i_this->mBstPartType != bst_class::Type_HEAD_e) { + anm_init(i_this, damage_bck_d[i_this->mBstPartType], 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); } - case 1: - break; + J3DAnmTevRegKey* reg_key = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bst", damage_brk_d[i_this->mBstPartType]); + i_this->mpTevRegAnimator->init(i_this->m02B8->getModel()->getModelData(), reg_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE); + J3DAnmTextureSRTKey* srt_key = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bst", damage_btk_d[i_this->mBstPartType]); + i_this->mpTexMtxAnimator->init(i_this->m02B8->getModel()->getModelData(), srt_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE); + i_this->mDamage++; + i_this->m10FC[0] = 30; + break; } - - if (i_this->field_0x10FC[0] == 0) { - if (i_this->field_0x02B4 != 0 && i_this->health <= 0) { - i_this->field_0x10D6 = 6; - i_this->field_0x10FC[1] = 300; - - if (i_this->field_0x02B4 == 1) { - if (hand[0]->field_0x10D6 != 6) { + case 1: + break; + } + if (i_this->m10FC[0] == 0) { + if (i_this->mBstPartType != bst_class::Type_HEAD_e && actor->health <= 0) { + i_this->mActionType = bst_class::ACTION_SLEEP_e; + i_this->m10FC[1] = 300; + if (i_this->mBstPartType == bst_class::Type_LEFT_HAND_e) { + if (hand[0]->mActionType != bst_class::ACTION_SLEEP_e) { mDoAud_bgmStart(JA_BGM_UNK_120); } - } else if (hand[1]->field_0x10D6 != 6) { + } else if (hand[1]->mActionType != bst_class::ACTION_SLEEP_e) { mDoAud_bgmStart(JA_BGM_UNK_121); } } else { - i_this->field_0x10D6 = 1; - i_this->speedF = 0.0f; + i_this->mActionType = bst_class::ACTION_FLY_e; + actor->speedF = 0.0f; } - i_this->mDamage = 0; } } @@ -826,12 +1077,9 @@ static BOOL bom_eat_check(bst_class* i_this) { cCcD_Obj* hit_obj = i_this->mHandHurtCollisionCcD_Cyl.GetCoHitObj(); if (hit_obj != NULL) { - fopAc_ac_c* actor = (fopAc_ac_c*) hit_obj->GetAc(); - daBomb_c* bomb = (daBomb_c*) actor; - - if (actor != NULL && fopAcM_GetName(actor) == PROC_BOMB && - bomb->getBombCheck_Flag() == 0 && bomb->getBombRestTime() > 1) - { + fopAc_ac_c* actor = (fopAc_ac_c*)hit_obj->GetAc(); + daBomb_c* bomb = (daBomb_c*)actor; + if (actor != NULL && fopAcM_GetName(actor) == PROC_BOMB && bomb->getBombCheck_Flag() == 0 && bomb->getBombRestTime() > 1) { i_this->mBombId = fopAcM_GetID(bomb); bomb->setBombCheck_Flag(); bomb->change_state(daBomb_c::STATE_2); @@ -841,181 +1089,241 @@ static BOOL bom_eat_check(bst_class* i_this) { } } } - return FALSE; } /* 00003EC4-000049A8 .text head_damage__FP9bst_class */ static void head_damage(bst_class* i_this) { - /* Nonmatching */ - cXyz temp; + /* Nonmatching - branching */ + fopAc_ac_c* actor = &i_this->actor; cXyz v; f32 dist; + static u16 bomb_eff_name[] = {dPa_name::ID_SCENE_81E4, dPa_name::ID_SCENE_81E5, dPa_name::ID_SCENE_81E6, dPa_name::ID_SCENE_81E7}; i_this->mState = 10; - i_this->field_0x2E74[0] = 10; - i_this->field_0x2E74[1] = 10; - cLib_addCalcAngleS2(&i_this->shape_angle.x, 0, 8, 512); - cLib_addCalcAngleS2(&i_this->shape_angle.z, 0, 8, 512); - cLib_addCalc0(&i_this->field_0x10EC.z, 1.0f, 5.0f); - + i_this->m2E74[0] = 10; + i_this->m2E74[1] = 10; + cLib_addCalcAngleS2(&actor->shape_angle.x, 0, 8, 512); + cLib_addCalcAngleS2(&actor->shape_angle.z, 0, 8, 512); + cLib_addCalc0(&i_this->m10EC.z, 1.0f, 5.0f); switch (i_this->mDamage) { - case 0: { - i_this->mDamage++; - i_this->field_0x10FC[0] = 40; - i_this->speedF = 0.0f; - i_this->speed.y = 0.0f; - - J3DAnmTevRegKey* key = (J3DAnmTevRegKey*) dComIfG_getObjectRes("Bst", BST_BRK_BST_END); - i_this->mpTevRegAnimator->init( - i_this->field_0x02B8->getModel()->getModelData(), - key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE - ); - - J3DAnmTextureSRTKey* srt_key = (J3DAnmTextureSRTKey*) dComIfG_getObjectRes("Bst", BST_BTK_BST_END); - i_this->mpTexMtxAnimator->init( - i_this->field_0x02B8->getModel()->getModelData(), - srt_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE - ); - - fopAcM_seStart(i_this, JA_SE_CM_BST_HEAD_EYE_CLOSE, 0); - mDoAud_bgmStart(JA_BGM_UNK_123); - // fallthrough + case 0: { + i_this->mDamage++; + i_this->m10FC[0] = 40; + actor->speedF = 0.0f; + actor->speed.y = 0.0f; + J3DAnmTevRegKey* key = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bst", BST_BRK_BST_END); + i_this->mpTevRegAnimator->init(i_this->m02B8->getModel()->getModelData(), key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE); + J3DAnmTextureSRTKey* srt_key = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bst", BST_BTK_BST_END); + i_this->mpTexMtxAnimator->init(i_this->m02B8->getModel()->getModelData(), srt_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE); + fopAcM_seStart(actor, JA_SE_CM_BST_HEAD_EYE_CLOSE, 0); + mDoAud_bgmStart(JA_BGM_UNK_123); + // fallthrough + } + case 1: + v = actor->current.pos; + v.y = 0.0f; + dist = v.abs(); + if (dist > REG0_F(9) + 1350.0f) { + dist = (REG0_F(9) + 1350.0f) / dist; + cLib_addCalc2(&actor->current.pos.x, v.x * dist, 0.2f, 30.0f); + cLib_addCalc2(&actor->current.pos.z, v.z * dist, 0.2f, 30.0f); } - case 1: - v.x = i_this->current.pos.x; - v.z = i_this->current.pos.z; - v.y = 0.0f; - - dist = v.abs(); - if (dist > REG0_F(9) + 1350.0f) { - dist = (REG0_F(9) + 1350.0f) / dist; - cLib_addCalc2(&i_this->current.pos.x, v.x * dist, 0.2f, 30.0f); - cLib_addCalc2(&i_this->current.pos.z, v.z * dist, 0.2f, 30.0f); + if (i_this->m10FC[0] == 0) { + actor->current.pos.y += actor->speed.y; + actor->speed.y -= REG0_F(13) + 5.0f; + if (actor->current.pos.y <= REG0_F(14)) { + actor->current.pos.y = REG0_F(14); + dComIfGp_getVibration().StartShock(REG0_S(2) + 7, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + dComIfGp_particle_setToon(dPa_name::ID_SCENE_A1DB, &actor->current.pos, NULL, NULL, 0xB9, &i_this->mPa_smokeEcallBack, fopAcM_GetRoomNo(actor)); + i_this->m112A = REG0_S(7) + 4; + mDoAud_seStart(JA_SE_CM_BST_HEAD_FALL, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + mDoAud_seStart(JA_SE_CM_BST_MOUTH_OPEN, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + anm_init(i_this, BST_BCK_KUTI_OPEN, 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->mDamage++; + actor->speed.y = 0.0f; } - - if (i_this->field_0x10FC[0] == 0) { - i_this->current.pos.y += i_this->speed.y; - i_this->speed.y -= REG0_F(13) + 5.0f; - - if (i_this->current.pos.y <= REG0_F(14)) { - i_this->current.pos.y = REG0_F(13); - temp.set(0.0f, 1.0f, 0.0f); - - dComIfGp_getVibration().StartShock(REG0_S(2) + 7, -0x21, temp); - dComIfGp_particle_setToon(dPa_name::ID_SCENE_A1DB, &i_this->current.pos); - i_this->field_0x112A = REG0_S(7) + 4; - - fopAcM_seStart(i_this, JA_SE_CM_BST_HEAD_FALL, 0); - fopAcM_seStart(i_this, JA_SE_CM_BST_MOUTH_OPEN, 0); - anm_init(i_this, BST_BCK_KUTI_OPEN, 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); - i_this->mDamage++; - i_this->speed.y = 0.0f; - } + } + break; + case 2: + if (i_this->m02B8->isStop()) { + anm_init(i_this, BST_BCK_KUTI_OPEN_LOOP, 1.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + i_this->m10FC[0] = 300; + i_this->mDamage++; + } + break; + case 3: + if (bom_eat_check(i_this)) { + i_this->mDamage++; + i_this->m10FC[0] = 10; + } else if (i_this->m10FC[0] == 0) { + i_this->mActionType = bst_class::ACTION_HEAD_HUKKI_e; + i_this->mDamage = 0; + mDoAud_bgmStart(JA_BGM_UNK_122); + break; + } + case 4: { + fopAc_ac_c* bomb = fopAcM_SearchByID(i_this->mBombId); + if (bomb != NULL) { + bomb->gravity = 0.0f; + bomb->speedF = 0.0f; + bomb->speed.setall(0.0f); + bomb->current.angle.setall(0); + bomb->shape_angle.setall(0); + cLib_addCalc2(&bomb->current.pos.x, actor->current.pos.x, 1.0f, 30.0f); + cLib_addCalc2(&bomb->current.pos.y, actor->current.pos.y + 90.0f + REG0_F(0xb), 1.0f, 30.0f); + cLib_addCalc2(&bomb->current.pos.z, actor->current.pos.z, 1.0f, 30.0f); + } + if (i_this->m10FC[0] == 0) { + anm_init(i_this, BST_BCK_BOM_NOMI, 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->mDamage++; + i_this->m2EE0[0] = dComIfGp_particle_set(dPa_name::ID_SCENE_81E3, &actor->current.pos); + fopAcM_seStart(actor, JA_SE_CM_BST_MOUTH_CLOSE, 0); + i_this->m10FC[0] = 0x3c; + } + // fallthrough + } + case 5: + if (i_this->m10FC[0] == 0x32) { + fopAcM_seStart(actor, JA_SE_CM_BST_BOMB_EAT, 0); + } + if (i_this->m10FC[0] == 0x1e) { + fopAcM_seStart(actor, JA_SE_CM_BST_BEF_EXPLODE, 0); + } + if (i_this->m02B8->isStop()) { + if (i_this->m2EE0[0] != NULL) { + i_this->m2EE0[0]->becomeInvalidEmitter(); + i_this->m2EE0[0] = NULL; } - break; - case 2: - break; - case 3: - break; - case 4: - break; - case 5: - break; - case 6: - break; - case 7: - break; + fopAc_ac_c* bomb = fopAcM_SearchByID(i_this->mBombId); + if (bomb != NULL) { + fopAcM_delete(bomb); + } + actor->health--; + if ((actor->health <= 0) || (l_HIO.m6 != 0)) { + i_this->m2E9A = 0x32; + i_this->mActionType = bst_class::ACTION_END_DEMO_e; + i_this->mDamage = 0; + anm_init(i_this, BST_BCK_BST_DEAD, 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + hand[0]->mActionType = bst_class::ACTION_END_DEMO_e; + hand[0]->mDamage = 10; + hand[1]->mActionType = bst_class::ACTION_END_DEMO_e; + hand[1]->mDamage = 10; + fopAcM_seStart(actor, JA_SE_LK_LAST_HIT, 0); + mDoAud_bgmStop(30); + mDoAud_bgmStreamPrepare(JA_STRM_BST_CLEAR); + } else { + anm_init(i_this, BST_BCK_BOM_BAKUHATU, 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->mDamage++; + } + fopAcM_seStart(actor, JA_SE_CM_BST_EXPLODE, 0); + for (s32 i = 0; i < 4; i++) { + i_this->m2EE0[i + 1] = dComIfGp_particle_set(bomb_eff_name[i], &actor->current.pos); + } + i_this->m10FC[3] = 0x51; + } + break; + case 6: + if ((int)i_this->m02B8->getFrame() == 8) { + fopAcM_seStart(actor, JA_SE_CM_BST_JUMP_S, 0); + } + if (i_this->m02B8->isStop()) { + i_this->m10FC[0] = 0x1e; + i_this->mDamage++; + mDoAud_bgmStart(JA_BGM_BST_BATTLE); + } + break; + case 7: + if (i_this->m10FC[0] == 0) { + i_this->mActionType = bst_class::ACTION_HEAD_HUKKI_e; + i_this->mDamage = 0; + } + break; + } + for (s32 i = 0; i < 5; i++) { + if (i_this->m2EE0[i] != NULL) { + if ((i >= 1) && (i_this->m10FC[3] == 1)) { + i_this->m2EE0[i]->becomeInvalidEmitter(); + i_this->m2EE0[i] = NULL; + } else { + i_this->m2EE0[i]->setGlobalRTMatrix(i_this->m02B8->getModel()->getAnmMtx(0)); + } + } } } /* 000049A8-00004BCC .text head_hukki__FP9bst_class */ static void head_hukki(bst_class* i_this) { - /* Nonmatching */ + fopAc_ac_c* actor = &i_this->actor; switch (i_this->mDamage) { - case 0: + case 0: + i_this->mDamage++; + i_this->m10FC[0] = REG0_S(0) + 40; + i_this->m10F8 = 0.0f; + i_this->m10EC.y = 0.0f; + // fallthrough + case 1: + cLib_addCalc2(&i_this->m10F8, REG0_F(4) + 4000.0f, 1.0f, REG0_F(5) + 100.0f); + if (i_this->m10FC[0] == 0) { i_this->mDamage++; - i_this->field_0x10FC[0] = REG0_S(0) + 40; - i_this->field_0x10F8 = 0.0f; - i_this->field_0x10EC.y = 0.0f; - // fall-through - case 1: - cLib_addCalc2(&i_this->field_0x10F8, REG0_F(4) + 4000.0f, 1.0f, REG0_F(5) + 100.0f); - if (i_this->field_0x10FC[0] == 0) { - i_this->mDamage++; - i_this->field_0x10FC[0] = REG0_S(1) + 80; - } - break; - case 2: - cLib_addCalc0(&i_this->field_0x10F8, 1.0f, REG0_F(6) + 50.0f); - if (i_this->field_0x10FC[0] == 0) { - i_this->field_0x10D6 = 1; - i_this->mDamage = 0; - i_this->speedF = 0.0f; - i_this->field_0x10EC.y = 0.0f; - i_this->mEyeHealth[1] = 2; - i_this->mEyeHealth[0] = 2; - } - break; + i_this->m10FC[0] = REG0_S(1) + 80; + } + break; + case 2: + cLib_addCalc0(&i_this->m10F8, 1.0f, REG0_F(6) + 50.0f); + if (i_this->m10FC[0] == 0) { + i_this->mActionType = bst_class::ACTION_FLY_e; + i_this->mDamage = 0; + actor->speedF = 0.0f; + i_this->m10EC.y = 0.0f; + i_this->mEyeHealth[1] = 2; + i_this->mEyeHealth[0] = 2; + } + break; } - - i_this->shape_angle.x = i_this->field_0x10F8 * - cM_ssin(i_this->field_0x10D4 * (REG0_S(6) + 700)); - i_this->shape_angle.z = i_this->field_0x10F8 * - cM_ssin(i_this->field_0x10D4 * (REG0_S(6) + 600)); - - cLib_addCalc2(&i_this->current.pos.y, REG0_F(11) + 400.0f, 0.05f, i_this->field_0x10EC.y * 40.0f); - cLib_addCalc2(&i_this->field_0x10EC.z, REG0_F(11) + 50.0f, 1.0f, 2.0f); - cLib_addCalc2(&i_this->field_0x10EC.y, 1.0f, 1.0f, 0.02f); + actor->shape_angle.x = i_this->m10F8 * cM_ssin(i_this->mUpdateLastFacingDirIfMultipleOf32 * (REG0_S(6) + 700)); + actor->shape_angle.z = i_this->m10F8 * cM_ssin(i_this->mUpdateLastFacingDirIfMultipleOf32 * (REG0_S(6) + 600)); + cLib_addCalc2(&actor->current.pos.y, REG0_F(11) + 400.0f, 0.05f, i_this->m10EC.y * 40.0f); + cLib_addCalc2(&i_this->m10EC.z, REG0_F(11) + 50.0f, 1.0f, 2.0f); + cLib_addCalc2(&i_this->m10EC.y, 1.0f, 1.0f, 0.02f); } /* 00004BCC-000051E0 .text col_set__FP9bst_class */ static void col_set(bst_class* i_this) { - /* Nonmatching */ + fopAc_ac_c* actor = &i_this->actor; cXyz vec; cXyz pos_vec; - - if (i_this->field_0x02B4 == 0) { - mDoMtx_copy(i_this->field_0x02B8->getModel()->getAnmMtx(8), *calc_mtx); - + if (i_this->mBstPartType == bst_class::Type_HEAD_e) { + mDoMtx_copy(i_this->m02B8->getModel()->getAnmMtx(8), *calc_mtx); vec.set(REG0_F(0) + (-30.0f), REG0_F(1), REG0_F(2) + (-100.0f)); MtxPosition(&vec, &pos_vec); - i_this->mHeadHurtCollisionCcD_Cyl.SetC(pos_vec); i_this->mHeadHurtCollisionCcD_Cyl.SetH(REG0_F(3) + 600.0f); i_this->mHeadHurtCollisionCcD_Cyl.SetR(REG0_F(4) + 180.0f); dComIfG_Ccsp()->Set(&i_this->mHeadHurtCollisionCcD_Cyl); - i_this->mHeadHurtCollisionCcD_Cyl.OffTgSetBit(); - - + i_this->mHandHurtCollisionCcD_Cyl.OffTgSetBit(); vec.set(REG0_F(5) + 150.0f, REG0_F(6), REG0_F(7) + 70.0f); MtxPosition(&vec, &pos_vec); - i_this->mHandHurtCollisionCcD_Cyl.SetC(pos_vec); i_this->mHandHurtCollisionCcD_Cyl.SetH(REG0_F(8) + 100.0f); i_this->mHandHurtCollisionCcD_Cyl.SetR(REG0_F(9) + 100.0f); dComIfG_Ccsp()->Set(&i_this->mHandHurtCollisionCcD_Cyl); - vec.set(REG0_F(11) + 250.0f, 0.0f, 0.0f); - MtxPosition(&vec, &i_this->eyePos); - + MtxPosition(&vec, &actor->eyePos); vec.setall(0.0f); for (s32 i = 0; i < 2; i++) { - mDoMtx_copy(i_this->field_0x02B8->getModel()->getAnmMtx(i + 4), *calc_mtx); + mDoMtx_copy(i_this->m02B8->getModel()->getAnmMtx(i + 4), *calc_mtx); MtxPosition(&vec, &pos_vec); - - s16 unk = i_this->field_0x2E74[i]; + s16 unk = i_this->m2E74[i]; if (unk != 0 || i_this->mEyeHealth[i] <= 0) { if (unk != 0) { - i_this->field_0x2E74[i]--; + i_this->m2E74[i]--; } - pos_vec.y += 10000.0f; - cLib_addCalcAngleS2(&i_this->field_0x2E78[i], REG0_S(8) + 11000, 1, 0x400); + cLib_addCalcAngleS2(&i_this->m2E78[i], REG0_S(8) + 11000, 1, 0x400); } else { - cLib_addCalcAngleS2(&i_this->field_0x2E78[i], 0, 8, 0x200); + cLib_addCalcAngleS2(&i_this->m2E78[i], 0, 8, 0x200); } - i_this->mBstEyeCcD_Spheres[i].SetC(pos_vec); i_this->mBstEyeCcD_Spheres[i].SetR(REG0_F(14) + 60.0f); dComIfG_Ccsp()->Set(&i_this->mBstEyeCcD_Spheres[i]); @@ -1023,71 +1331,58 @@ static void col_set(bst_class* i_this) { } else { vec.setall(0.0f); f32 radius = 0.0f; - - if (i_this->field_0x10D6 == 13) { + if (i_this->mActionType == bst_class::ACTION_HARAI_ATTACK_e) { radius = REG0_F(16) + 50.0f; } - for (s32 i = 0; i < 15; i++) { - mDoMtx_copy(i_this->field_0x02B8->getModel()->getAnmMtx(i + 2), *calc_mtx); + mDoMtx_copy(i_this->m02B8->getModel()->getAnmMtx(i + 2), *calc_mtx); MtxPosition(&vec, &pos_vec); - i_this->mCcD_fingers[i].SetC(pos_vec); i_this->mCcD_fingers[i].SetR(REG0_F(14) + 50.0f + radius); - dComIfG_Ccsp()->Set(&i_this->mCcD_fingers[i]); } - - mDoMtx_copy(i_this->field_0x02B8->getModel()->getAnmMtx(17), *calc_mtx); - + mDoMtx_copy(i_this->m02B8->getModel()->getAnmMtx(17), *calc_mtx); static f32 te_x[4] = {70.0f, 70.0f, 70.0f, 70.0f}; static f32 te_y[4] = {70.0f, -70.0f, 70.0f, -70.0f}; static f32 te_z[4] = {90.0f, 90.0f, -30.0f, -30.0f}; - for (s32 i = 0; i < 4; i++) { vec.x = te_x[i]; - if (i_this->field_0x02B4 == 2) { - vec.x = vec.x * -1.0f; + if (i_this->mBstPartType == bst_class::Type_RIGHT_HAND_e) { + vec.x *= -1.0f; } vec.y = te_y[i]; vec.z = te_z[i]; - MtxPosition(&vec, &pos_vec); i_this->mCcD_fingers[i + 15].SetC(pos_vec); i_this->mCcD_fingers[i + 15].SetR(REG0_F(15) + 65.0f + radius); dComIfG_Ccsp()->Set(&i_this->mCcD_fingers[i + 15]); } - - if (i_this->field_0x02B4 == 2) { + if (i_this->mBstPartType == bst_class::Type_RIGHT_HAND_e) { vec.set(-(REG0_F(15) + 100.0f), REG0_F(16), -(REG0_F(17) + 40.0f)); MtxPosition(&vec, &pos_vec); - vec.set(-(REG0_F(15) + 100.0f), REG0_F(16), REG0_F(18) + 10.0f); - MtxPosition(&vec, &i_this->eyePos); + MtxPosition(&vec, &actor->eyePos); } else { vec.set(REG0_F(15) + 100.0f, REG0_F(16), REG0_F(17) + 40.0f); MtxPosition(&vec, &pos_vec); - vec.set(REG0_F(15) + 100.0f, REG0_F(16), -(REG0_F(18) + 10.0f)); - MtxPosition(&vec, &i_this->eyePos); + MtxPosition(&vec, &actor->eyePos); } - i_this->mHandHurtCollisionCcD_Cyl.SetC(pos_vec); i_this->mHandHurtCollisionCcD_Cyl.SetH(REG0_F(8) + 140.0f); i_this->mHandHurtCollisionCcD_Cyl.SetR(REG0_F(9) + 150.0f); dComIfG_Ccsp()->Set(&i_this->mHandHurtCollisionCcD_Cyl); } - - i_this->attention_info.position = i_this->eyePos; + actor->attention_info.position = actor->eyePos; } /* 000051E0-00005224 .text player_way_check__FP9bst_class */ static BOOL player_way_check(bst_class* i_this) { - s16 angle_diff = i_this->shape_angle.y - dComIfGp_getPlayer(0)->shape_angle.y; + fopAc_ac_c* actor = &i_this->actor; + s16 angle_diff = actor->shape_angle.y - dComIfGp_getPlayer(0)->shape_angle.y; if (angle_diff < 0) { angle_diff = -angle_diff; } - if ((u16)angle_diff < 0x4000) { return FALSE; } @@ -1096,88 +1391,72 @@ static BOOL player_way_check(bst_class* i_this) { /* 00005224-0000591C .text damage_check__FP9bst_class */ static void damage_check(bst_class* i_this) { - /* Nonmatching */ + /* Nonmatching - regalloc */ + fopAc_ac_c* actor = &i_this->actor; fopAc_ac_c* player = dComIfGp_getPlayer(0); - i_this->mCcD_Stts.Move(); - + CcAtInfo atInfo; + atInfo.pParticlePos = NULL; if (i_this->mDamageTimer == 0) { s8 bVar1 = false; - cCcD_Obj* hit_obj; - - if (i_this->field_0x02B4 == 0 && i_this->mHeadHurtCollisionCcD_Cyl.ChkTgHit()) { - hit_obj = i_this->mHeadHurtCollisionCcD_Cyl.GetTgHitObj(); + if (i_this->mBstPartType == bst_class::Type_HEAD_e && i_this->mHeadHurtCollisionCcD_Cyl.ChkTgHit()) { + atInfo.mpObj = i_this->mHeadHurtCollisionCcD_Cyl.GetTgHitObj(); bVar1 = true; } else { for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->mCcD_fingers); i++) { if (i_this->mCcD_fingers[i].ChkTgHit()) { - hit_obj = i_this->mCcD_fingers[i].GetTgHitObj(); + atInfo.mpObj = i_this->mCcD_fingers[i].GetTgHitObj(); bVar1 = true; } } } - if (bVar1) { - def_se_set(i_this, hit_obj, 0x42); + def_se_set(actor, atInfo.mpObj, 0x42); i_this->mDamageTimer = 7; } } - if (i_this->mState == 0) { - if (i_this->field_0x02B4 == 0) { + if (i_this->mBstPartType == bst_class::Type_HEAD_e) { if (i_this->mBstEyeCcD_Spheres[0].ChkTgHit() || i_this->mBstEyeCcD_Spheres[1].ChkTgHit() != 0) { i_this->mState = 10; if (player_way_check(i_this)) { - cCcD_Obj* hit_obj; u32 eye_index; if (i_this->mBstEyeCcD_Spheres[0].ChkTgHit()) { + atInfo.mpObj = i_this->mBstEyeCcD_Spheres[0].GetTgHitObj(); eye_index = 0; - hit_obj = i_this->mBstEyeCcD_Spheres[0].GetTgHitObj(); } else { + atInfo.mpObj = i_this->mBstEyeCcD_Spheres[1].GetTgHitObj(); eye_index = 1; - hit_obj = i_this->mBstEyeCcD_Spheres[1].GetTgHitObj(); } - if (i_this->mRoomState != 1) { i_this->mRoomState = 8; } - i_this->field_0x10D6 = 5; + i_this->mActionType = bst_class::ACTION_DAMAGE_e; i_this->mDamage = 0; - - fopAcM_seStart(i_this, JA_SE_CM_BST_EYE_HIT, 0); + mDoAud_seStart(JA_SE_CM_BST_EYE_HIT, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); i_this->mEyeHealth[eye_index]--; if (i_this->mEyeHealth[eye_index] <= 0) { // Check the other eye. if (i_this->mEyeHealth[1 - eye_index] <= 0) { - i_this->field_0x10D6 = 7; + i_this->mActionType = bst_class::ACTION_HEAD_DAMAGE_e; i_this->mDamage = 0; } - fopAcM_seStart(i_this, JA_SE_CM_BST_EYE_BREAK, 0); + mDoAud_seStart(JA_SE_CM_BST_EYE_BREAK, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } - i_this->mHeadHurtSpeed = REG0_F(11) + 70.0f; i_this->mHeadHurtAngle = REG0_S(2) + 7; - - cXyz player_vec = i_this->current.pos - player->current.pos; + cXyz player_vec = actor->current.pos - player->current.pos; i_this->mHurtRecoilAngle1 = cM_atan2s(player_vec.x, player_vec.z); - - f32 xz2 = SQUARE(player_vec.x) + SQUARE(player_vec.z); - i_this->mHurtRecoilAngle2 = -cM_atan2s(player_vec.y, std::sqrtf(xz2)); - - i_this->speedF = 0.0f; - - + i_this->mHurtRecoilAngle2 = -cM_atan2s(player_vec.y, std::sqrtf(SQUARE(player_vec.x) + SQUARE(player_vec.z))); + actor->speedF = 0.0f; cXyz* hit_pos = i_this->mBstEyeCcD_Spheres[eye_index].GetTgHitPosP(); dComIfGp_particle_set(dPa_name::ID_COMMON_0010, hit_pos); - cXyz scale; scale.x = scale.y = scale.z = 2.0f; csXyz angle; angle.x = angle.z = 0; - angle.y = fopAcM_searchActorAngleY(i_this, dComIfGp_getPlayer(0)); - + angle.y = fopAcM_searchActorAngleY(actor, dComIfGp_getPlayer(0)); dComIfGp_particle_set(dPa_name::ID_COMMON_NORMAL_HIT, hit_pos, &angle, &scale); - dKy_SordFlush_set(*hit_pos, 1); } } @@ -1186,28 +1465,34 @@ static void damage_check(bst_class* i_this) { i_this->mState = 10; if (player_way_check(i_this)) { + atInfo.mpObj = i_this->mHandHurtCollisionCcD_Cyl.GetTgHitObj(); + atInfo.pParticlePos = i_this->mHandHurtCollisionCcD_Cyl.GetTgHitPosP(); + atInfo.mpActor = cc_at_check(actor, &atInfo); + mDoAud_seStart(JA_SE_CM_BST_EYE_HIT, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + if (actor->health <= 0) { + mDoAud_seStart(JA_SE_CM_BST_EYE_BREAK, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + i_this->mHeadHurtSpeed = REG0_F(0xb) + 70.0f; + i_this->mHeadHurtAngle = REG0_S(2) + 0xf; + cXyz player_vec = actor->current.pos - player->current.pos; + i_this->mHurtRecoilAngle1 = cM_atan2s(player_vec.x, player_vec.z); + i_this->mHurtRecoilAngle2 = -cM_atan2s(player_vec.y, std::sqrtf(SQUARE(player_vec.x) + SQUARE(player_vec.z))); + actor->speedF = 0.0f; cXyz* hit_pos = i_this->mHandHurtCollisionCcD_Cyl.GetTgHitPosP(); - + dComIfGp_particle_set(dPa_name::ID_COMMON_0010, hit_pos); cXyz scale(2.0f, 2.0f, 2.0f); csXyz angle; angle.x = angle.z = 0; - angle.y = fopAcM_searchActorAngleY(i_this, dComIfGp_getPlayer(0)); + angle.y = fopAcM_searchActorAngleY(actor, dComIfGp_getPlayer(0)); dComIfGp_particle_set(dPa_name::ID_COMMON_NORMAL_HIT, hit_pos, &angle, &scale); - - cXyz vec; - vec.x = hit_pos->x; - vec.y = i_this->mHandHurtCollisionCcD_Cyl.GetTgHitPosP()->y; - vec.z = i_this->mHandHurtCollisionCcD_Cyl.GetTgHitPosP()->z; - - dKy_SordFlush_set(vec, 1); - i_this->field_0x10D6 = 5; + dKy_SordFlush_set(*hit_pos, 1); + i_this->mActionType = bst_class::ACTION_DAMAGE_e; i_this->mDamage = 0; - - s32 hand_index = 2 - i_this->field_0x02B4; - if (hand[hand_index]->field_0x10D6 > 9) { - hand[hand_index]->field_0x10D6 = 1; + s32 hand_index = 2 - i_this->mBstPartType; + if (hand[hand_index]->mActionType >= bst_class::ACTION_DOWN_ATTACK_e) { + hand[hand_index]->mActionType = bst_class::ACTION_FLY_e; hand[hand_index]->mDamage = 0; - hand[hand_index]->speedF = 0.0f; + hand[hand_index]->actor.speedF = 0.0f; } } } @@ -1219,95 +1504,65 @@ static u16 item_smoke_name[2] = {dPa_name::ID_SCENE_A1DF, dPa_name::ID_SCENE_A1E /* 0000591C-00005D9C .text hana_demo__FP9bst_class */ static void hana_demo(bst_class* i_this) { - /* Nonmatching */ + fopAc_ac_c* actor = &i_this->actor; i_this->mState = 10; - - s16 angle = cM_atan2s(-i_this->current.pos.x, -i_this->current.pos.z); - cLib_addCalcAngleS2(&i_this->shape_angle.y, angle, 10, 0x400); - cLib_addCalcAngleS2(&i_this->shape_angle.x, 0, 10, 0x400); - cLib_addCalcAngleS2(&i_this->shape_angle.z, 0, 10, 0x400); - cLib_addCalc2(&i_this->current.pos.y, REG0_F(11) + 400.0f, 0.05f, 30.0f); - + s16 angle = cM_atan2s(-actor->current.pos.x, -actor->current.pos.z); + cLib_addCalcAngleS2(&actor->shape_angle.y, angle, 10, 0x400); + cLib_addCalcAngleS2(&actor->shape_angle.x, 0, 10, 0x400); + cLib_addCalcAngleS2(&actor->shape_angle.z, 0, 10, 0x400); + cLib_addCalc2(&actor->current.pos.y, REG0_F(11) + 400.0f, 0.05f, 30.0f); switch (i_this->mDamage) { - case 0: - i_this->mDamage++; - i_this->field_0x10FC[0] = 40; - i_this->speedF = 0.0f; - i_this->speed.y = 0.0f; - - anm_init( - i_this, BST_BCK_HANA_DEMO, 5.0f, - J3DFrameCtrl::EMode_NONE, 1.0f, -1); - i_this->field_0x2E9A = 1; - fopAcM_seStartCurrent(i_this, JA_SE_CM_BST_HAND_STRAIN, 0); - break; - case 1: - break; - default: - return; - } - - cXyz vec(i_this->current.pos.x, 0, i_this->current.pos.z); - f32 dist = vec.abs(); - if (dist > REG0_F(9) + 1350.0f) { - f32 angle = (REG0_F(9) + 1350.0f) / dist; - cLib_addCalc2(&i_this->current.pos.x, vec.x * angle, 0.2f, 30.0f); - cLib_addCalc2(&i_this->current.pos.z, vec.z * angle, 0.2f, 30.0f); - } - - if ((s32)i_this->field_0x02B8->getFrame() > 26) { - fopAc_ac_c* item = fopAcM_SearchByID(i_this->mCreatedItemId); - if (item != NULL) { - fopAcM_OnStatus(item, fopAcStts_UNK4000_e); + case 0: + i_this->mDamage++; + i_this->m10FC[0] = 40; + actor->speedF = 0.0f; + actor->speed.y = 0.0f; + anm_init(i_this, BST_BCK_HANA_DEMO, 5.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->m2E9A = 1; + fopAcM_seStartCurrent(actor, JA_SE_CM_BST_HAND_STRAIN, 0); + // fallthrough + case 1: + cXyz vec = actor->current.pos; + vec.y = 0.0f; + f32 dist = vec.abs(); + if (dist > REG0_F(9) + 1350.0f) { + f32 angle = (REG0_F(9) + 1350.0f) / dist; + cLib_addCalc2(&actor->current.pos.x, vec.x * angle, 0.2f, 30.0f); + cLib_addCalc2(&actor->current.pos.z, vec.z * angle, 0.2f, 30.0f); } - } - - if ((s32)i_this->field_0x02B8->getFrame() == 26) { - int itemNo; - if (dComIfGs_getArrowNum() == 0) { - itemNo = dItem_ARROW_10_e; - cMtx_copy(i_this->field_0x02B8->getModel()->getAnmMtx(6), *calc_mtx); - i_this->field_0x2E9E = 0; - } else { - itemNo = dItem_BOMB_5_e; - cMtx_copy(i_this->field_0x02B8->getModel()->getAnmMtx(7), *calc_mtx); - i_this->field_0x2E9E = 1; + if ((s32)i_this->m02B8->getFrame() > 26) { + fopAc_ac_c* item = fopAcM_SearchByID(i_this->mCreatedItemId); + if (item != NULL) { + fopAcM_OnStatus(item, fopAcStts_UNK4000_e); + } } - - vec.set(REG0_F(2) + 60.0f, REG0_F(3), REG0_F(4)); - - if (itemNo != -35) { - fopAcM_seStart(i_this, JA_SE_OBJ_BOMB_EXPLODE, 0); - - cXyz pos_vec; - MtxPosition(&vec, &pos_vec); - i_this->mCreatedItemId = fopAcM_createItem( - &pos_vec, - itemNo, - -1, - fopAcM_GetRoomNo(i_this), - 0, - NULL, - 0xB, - NULL - ); - - fopAcM_seStart(i_this, JA_SE_CM_BST_ITEM_OUT_NOSE, 0); - mDoMtx_copy(i_this->field_0x02B8->getModel()->getAnmMtx(0), *calc_mtx); - - vec.setall(0.0f); - MtxPosition(&vec, &pos_vec); - - dComIfGp_particle_setToon( - item_smoke_name[i_this->field_0x2E9E], - &pos_vec, - &i_this->shape_angle, - NULL, - 0xB9, - &i_this->mPa_smokeEcallBack, - fopAcM_GetRoomNo(i_this) - ); + if ((s32)i_this->m02B8->getFrame() == 26) { + int itemNo; + if (dComIfGs_getArrowNum() == 0) { + itemNo = dItem_ARROW_10_e; + cMtx_copy(i_this->m02B8->getModel()->getAnmMtx(6), *calc_mtx); + i_this->m2E9E = 0; + } else { + itemNo = dItem_BOMB_5_e; + cMtx_copy(i_this->m02B8->getModel()->getAnmMtx(7), *calc_mtx); + i_this->m2E9E = 1; + } + vec.set(REG0_F(2) + 60.0f, REG0_F(3), REG0_F(4)); + if (itemNo != -35) { + mDoAud_seStart(JA_SE_OBJ_BOMB_EXPLODE, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + cXyz pos_vec; + MtxPosition(&vec, &pos_vec); + i_this->mCreatedItemId = fopAcM_createItem(&pos_vec, itemNo, -1, fopAcM_GetRoomNo(actor), 0, NULL, 0xB, NULL); + mDoAud_seStart(JA_SE_CM_BST_ITEM_OUT_NOSE, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + mDoMtx_copy(i_this->m02B8->getModel()->getAnmMtx(0), *calc_mtx); + vec.setall(0.0f); + MtxPosition(&vec, &pos_vec); + dComIfGp_particle_setToon( + item_smoke_name[i_this->m2E9E], &pos_vec, &actor->shape_angle, NULL, 0xB9, &i_this->mPa_smokeEcallBack, fopAcM_GetRoomNo(actor) + ); + } } + break; } } @@ -1318,161 +1573,163 @@ static u16 set_za_brk_d[3] = {BST_BRK_MUNE_START, BST_BRK_UDEL_START, BST_BRK_UD /* 00005D9C-00006088 .text end_demo__FP9bst_class */ static void end_demo(bst_class* i_this) { - /* Nonmatching */ + /* Nonmatching - cases 3-9 */ + fopAc_ac_c* actor = &i_this->actor; i_this->mState = 10; - fopAcM_OffStatus(i_this, 0); - i_this->attention_info.flags = 0; - + fopAcM_OffStatus(actor, 0); + actor->attention_info.flags = 0; switch (i_this->mDamage) { - case 0: - i_this->mDamage++; - // fall-through - case 1: - if ((s32)i_this->field_0x02B8->getFrame() == 20) { - fopAcM_seStart(i_this, JA_SE_CM_BST_JUMP_L, 0); - } - break; - case 2: - anm_init( - i_this, BST_BCK_BST_HIRAKU, 1.0f, - J3DFrameCtrl::EMode_NONE, 1.0f, -1 - ); - i_this->mDamage++; - - i_this->field_0x2EF4 = dComIfGp_particle_set(dPa_name::ID_SCENE_81E8, &i_this->current.pos); - if (i_this->field_0x2EF4 != NULL) { - i_this->field_0x2EF4->setGlobalRTMatrix(i_this->field_0x02B8->getModel()->getAnmMtx(0)); - } - - break; - case 10: - if (i_this->field_0x02B4 == 0) { - anm_init(i_this, fly_bck_d[0], 2.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); - } else { - anm_init(i_this, set_bck_d[i_this->field_0x02B4], 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); - } - i_this->mDamage++; - // fall-through - case 11: - cLib_addCalc2(&i_this->current.pos.x, i_this->home.pos.x, 0.1f, REG0_F(9) + 5.0f); - cLib_addCalc2(&i_this->current.pos.y, i_this->home.pos.y, 0.1f, REG0_F(9) + 5.0f); - cLib_addCalc2(&i_this->current.pos.z, i_this->home.pos.z, 0.1f, REG0_F(9) + 5.0f); - cLib_addCalcAngleS2(&i_this->shape_angle.y, i_this->home.angle.y, 10, 0x80); - cLib_addCalcAngleS2(&i_this->shape_angle.x, i_this->home.angle.x, 10, 0x80); - cLib_addCalcAngleS2(&i_this->shape_angle.z, i_this->home.angle.z, 10, 0x80); - break; + case 0: + i_this->mDamage++; + // fallthrough + case 1: + if ((s32)i_this->m02B8->getFrame() == 20) { + fopAcM_seStart(actor, JA_SE_CM_BST_JUMP_L, 0); + } + break; + case 2: + anm_init(i_this, BST_BCK_BST_HIRAKU, 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->mDamage++; + i_this->m2EF4 = dComIfGp_particle_set(dPa_name::ID_SCENE_81E8, &actor->current.pos); + if (i_this->m2EF4 != NULL) { + i_this->m2EF4->setGlobalRTMatrix(i_this->m02B8->getModel()->getAnmMtx(0)); + } + break; + case 10: + if (i_this->mBstPartType == bst_class::Type_HEAD_e) { + anm_init(i_this, fly_bck_d[i_this->mBstPartType], 2.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + } else { + anm_init(i_this, set_bck_d[i_this->mBstPartType], 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + } + i_this->mDamage++; + // fallthrough + case 11: + cLib_addCalc2(&actor->current.pos.x, actor->home.pos.x, 0.1f, REG0_F(9) + 5.0f); + cLib_addCalc2(&actor->current.pos.y, actor->home.pos.y, 0.1f, REG0_F(9) + 5.0f); + cLib_addCalc2(&actor->current.pos.z, actor->home.pos.z, 0.1f, REG0_F(9) + 5.0f); + cLib_addCalcAngleS2(&actor->shape_angle.y, actor->home.angle.y, 10, 0x80); + cLib_addCalcAngleS2(&actor->shape_angle.x, actor->home.angle.x, 10, 0x80); + cLib_addCalcAngleS2(&actor->shape_angle.z, actor->home.angle.z, 10, 0x80); + //break; + case 3: + return; + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + break; } - - if (i_this->field_0x02B4 == 0) { + if (i_this->mBstPartType == bst_class::Type_HEAD_e) { for (s32 i = 0; i < 4; i++) { - + if (i_this->m2EE0[i + 1] != NULL) { + if (i_this->m10FC[3] == 1) { + i_this->m2EE0[i + 1]->becomeInvalidEmitter(); + i_this->m2EE0[i + 1] = NULL; + } else { + i_this->m2EE0[i + 1]->setGlobalRTMatrix(i_this->m02B8->getModel()->getAnmMtx(0)); + } + } } } } /* 00006088-00006418 .text move__FP9bst_class */ static void move(bst_class* i_this) { - /* Nonmatching */ + /* Nonmatching - .data */ + fopAc_ac_c* actor = &i_this->actor; s8 bVar1; - - if (i_this->field_0x02B4 != 0 && boss->field_0x2E9A > 0 && boss->field_0x2E9A < 10) { - if (boss->field_0x2E7C == 11) { - i_this->field_0x10D6 = 1; + cXyz vec; + cXyz pos_vec; + cXyz pos_diff; + if (i_this->mBstPartType != bst_class::Type_HEAD_e && boss->m2E9A > 0 && boss->m2E9A < 10) { + if (boss->m2E7C == 11) { + i_this->mActionType = bst_class::ACTION_FLY_e; } else { - i_this->field_0x10D6 = 6; + i_this->mActionType = bst_class::ACTION_SLEEP_e; } i_this->mDamage = 0; - i_this->speedF = 0.0f; + actor->speedF = 0.0f; } else { set_hand_AT(i_this, 0); set_hand_CO(i_this, 0); - i_this->mHeadHurtCollisionCcD_Cyl.OffAtHitBit(); bVar1 = false; - switch (i_this->field_0x10D6) { - case 0: - bVar1 = true; - stay(i_this); - break; - case 1: - bVar1 = true; - fly(i_this); - break; - case 5: - damage(i_this); - break; - case 6: - sleep(i_this); - break; - case 7: - head_damage(i_this); - break; - case 8: - head_hukki(i_this); - break; - case 10: - bVar1 = true; - down_attack(i_this); - break; - case 11: - bVar1 = true; - paa_attack(i_this); - break; - case 12: - bVar1 = true; - kumi_attack(i_this); - break; - case 13: - bVar1 = true; - harai_attack(i_this); - break; - case 14: - beam_attack(i_this); - break; - case 20: - hana_demo(i_this); - break; - case 22: - end_demo(i_this); - break; + switch (i_this->mActionType) { + case bst_class::ACTION_STAY_e: + bVar1 = true; + stay(i_this); + break; + case bst_class::ACTION_FLY_e: + bVar1 = true; + fly(i_this); + break; + case bst_class::ACTION_DAMAGE_e: + damage(i_this); + break; + case bst_class::ACTION_SLEEP_e: + sleep(i_this); + break; + case bst_class::ACTION_HEAD_DAMAGE_e: + head_damage(i_this); + break; + case bst_class::ACTION_HEAD_HUKKI_e: + head_hukki(i_this); + break; + case bst_class::ACTION_DOWN_ATTACK_e: + bVar1 = true; + down_attack(i_this); + break; + case bst_class::ACTION_PAA_ATTACK_e: + bVar1 = true; + paa_attack(i_this); + break; + case bst_class::ACTION_KUMI_ATTACK_e: + bVar1 = true; + kumi_attack(i_this); + break; + case bst_class::ACTION_HARAI_ATTACK_e: + bVar1 = true; + harai_attack(i_this); + break; + case bst_class::ACTION_BEAM_ATTACK_e: + beam_attack(i_this); + break; + case bst_class::ACTION_HANA_DEMO_e: + hana_demo(i_this); + break; + case bst_class::ACTION_END_DEMO_e: + end_demo(i_this); + break; } - if (bVar1) { - cXyz pos_diff = i_this->current.pos - i_this->old.pos; - u32 dist = (u32) (pos_diff.abs() * 3.5f); - + pos_diff = actor->current.pos - actor->old.pos; + u32 dist = (u32)(pos_diff.abs() * 3.5f); if (dist > 100) { dist = 100; } - - if (i_this->field_0x02B4 == 0) { - fopAcM_seStart(i_this, JA_SE_CM_BST_HEAD_WORKING, dist); + if (i_this->mBstPartType == bst_class::Type_HEAD_e) { + fopAcM_seStart(actor, JA_SE_CM_BST_HEAD_WORKING, dist); } else { - fopAcM_seStart(i_this, JA_SE_CM_BST_HAND_WORKING, dist); + fopAcM_seStart(actor, JA_SE_CM_BST_HAND_WORKING, dist); } } - damage_check(i_this); - dCcD_Stts* stts = &i_this->mCcD_Stts; if (stts != NULL) { - i_this->current.pos.x += stts->GetCCMoveP()->x; - i_this->current.pos.y += stts->GetCCMoveP()->y; - i_this->current.pos.z += stts->GetCCMoveP()->z; + actor->current.pos.x += stts->GetCCMoveP()->x; + actor->current.pos.y += stts->GetCCMoveP()->y; + actor->current.pos.z += stts->GetCCMoveP()->z; } - - cXyz vec; if (i_this->mHeadHurtSpeed > 0.01f) { vec.x = 0.0f; vec.y = 0.0f; vec.z = i_this->mHeadHurtSpeed; mDoMtx_YrotS(*calc_mtx, i_this->mHurtRecoilAngle1); mDoMtx_XrotM(*calc_mtx, i_this->mHurtRecoilAngle2); - - cXyz pos_vec; MtxPosition(&vec, &pos_vec); - - i_this->current.pos += pos_vec; + actor->current.pos += pos_vec; cLib_addCalc0(&i_this->mHeadHurtSpeed, 1.0f, 4.0f); } } @@ -1480,201 +1737,166 @@ static void move(bst_class* i_this) { /* 00006418-00006DC0 .text main_cont__FP9bst_class */ static void main_cont(bst_class* i_this) { - /* Nonmatching */ + /* Nonmatching - branching */ + fopAc_ac_c* actor = &i_this->actor; fopAc_ac_c* player = dComIfGp_getPlayer(0); - - if (i_this->field_0x2E9A == 0) { - if (i_this->field_0x2E84 != 0) { - i_this->field_0x2E84--; + if (i_this->m2E9A == 0) { + if (i_this->mBombArrowDropTimer != 0) { + i_this->mBombArrowDropTimer--; } - for (s32 i = 0; i < 3; i++) { - if (i_this->field_0x2E7E[i] != 0) { - i_this->field_0x2E7E[i]--; + if (i_this->m2E7E[i] != 0) { + i_this->m2E7E[i]--; } } - - switch (i_this->field_0x2E7C) { - case 0: - i_this->field_0x2E7C = 1; - break; - case 1: - if (!dComIfGs_isStageBossEnemy() || REG0_S(5) != 0) { - fopAcM_OnStatus(i_this, fopAcStts_SHOWMAP_e); - if (dComIfGs_isStageBossDemo()) { - i_this->field_0x2FE4 = 1; - mDoAud_bgmStart(JA_BGM_BST_BATTLE); - - boss->field_0x10D6 = 1; - hand[0]->field_0x10D6 = 1; - hand[1]->field_0x10D6 = 1; - boss->mDamage = 0; - hand[1]->mDamage = 0; - hand[0]->mDamage = 0; - - i_this->field_0x2E7C = 10; - - J3DAnmTevRegKey* key = (J3DAnmTevRegKey*) dComIfG_getObjectRes("Bst", BST_BRK_UDEL); - hand[0]->mpBrkAnm->init( - hand[0]->field_0x02C8->getModelData(), - key, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, FALSE - ); - - J3DAnmTextureSRTKey* srt_key = (J3DAnmTextureSRTKey*) dComIfG_getObjectRes("Bst", BST_BTK_UDEL); - hand[0]->mpBtkAnm->init( - hand[0]->field_0x02C8->getModelData(), - srt_key, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, FALSE - ); - - key = (J3DAnmTevRegKey*) dComIfG_getObjectRes("Bst", BST_BRK_UDER); - hand[1]->mpBrkAnm->init( - hand[1]->field_0x02C8->getModelData(), - key, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, FALSE - ); - - srt_key = (J3DAnmTextureSRTKey*) dComIfG_getObjectRes("Bst", BST_BTK_UDER); - hand[1]->mpBtkAnm->init( - hand[1]->field_0x02C8->getModelData(), - srt_key, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, FALSE - ); - - key = (J3DAnmTevRegKey*) dComIfG_getObjectRes("Bst", BST_BRK_MUNE); - boss->mpBrkAnm->init( - boss->field_0x02C8->getModelData(), - key, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, FALSE - ); - - srt_key = (J3DAnmTextureSRTKey*) dComIfG_getObjectRes("Bst", BST_BTK_MUNE); - boss->mpBtkAnm->init( - boss->field_0x02C8->getModelData(), - srt_key, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, FALSE - ); - i_this->field_0x2E84 = 400; - i_this->field_0x2FE0->setPlaySpeed(1.0f); - } else { - hand[1]->mState = 10; - hand[0]->mState = 10; - boss->mState = 10; - - if (player->current.pos.abs() > 700.0f) { - i_this->field_0x2E9A = 10; - i_this->field_0x2E7C = 2; - } - } - } - break; - case 10: - i_this->field_0x2E7C = 11; - fopAcM_OffStatus(i_this, fopAcStts_UNK4000_e); - i_this->field_0x2E7E[0] = 100; - break; - case 11: - if (i_this->field_0x2E7E[0] == 0 && boss->field_0x10D6 != 14) { - boss->mBgS_AcchCir.SetWall(200.0f, 300.0f); - hand[0]->mBgS_AcchCir.SetWall(200.0f, 200.0f); - hand[1]->mBgS_AcchCir.SetWall(200.0f, 200.0f); - - if (cM_rndF(1.0f) < 0.2f || REG0_S(1) != 0) { - if (cM_rndF(1.0f) < 0.5f) { - if (hand[0]->field_0x10D6 < 10 && hand[0]->mStateTimer == 0) { - hand[0]->field_0x10D6 = 13; - hand[0]->mDamage = 0; - } else if (hand[1]->field_0x10D6 < 10 && hand[1]->mStateTimer == 0) { - hand[1]->field_0x10D6 = 13; - hand[1]->mDamage = 0; - } - } - } else { - f32 threshold; - if (i_this->health == 0) { - threshold = 1.0f - 0.3f; - } else if (i_this->health == 1) { - threshold = 0.5f; - } else if (i_this->health == 2) { - threshold = 0.3f; - } else if (i_this->health == 3) { - threshold = 0.2f; - } - - if (cM_rndF(1.0f) < threshold || REG0_S(0) != 0) { - if (hand[0]->field_0x10D6 < 5 && hand[1]->field_0x10D6 < 5 - && hand[0]->mStateTimer == 0 && hand[1]->mStateTimer == 0) { - hand[0]->field_0x10D6 = 12; - hand[0]->mDamage = 0; - hand[1]->field_0x10D6 = 12; - hand[1]->mDamage = 0; - } - } else { - if (cM_rndF(1.0f) < 0.5f) { - if (hand[0]->field_0x10D6 < 5 && hand[1]->field_0x10D6 < 5 - && hand[0]->mStateTimer == 0 && hand[1]->mStateTimer == 0) { - hand[0]->field_0x10D6 = 11; - hand[0]->mDamage = 0; - hand[1]->field_0x10D6 = 11; - hand[1]->mDamage = 0; - } else { - if (cM_rndF(1.0f) < 0.5f) { - if (hand[0]->field_0x10D6 < 5 && hand[0]->mStateTimer == 0) { - hand[0]->field_0x10D6 = 10; - hand[0]->mDamage = 0; - } - } else { - if (hand[1]->field_0x10D6 < 5 && hand[1]->mStateTimer == 0) { - hand[1]->field_0x10D6 = 10; - hand[1]->mDamage = 0; - } - } - } - } - } - - s16 unk; - if (i_this->health == 0) { - unk = cM_rndF(30.0f) + 30.0f; - } else if (i_this->health == 1) { - unk = cM_rndF(40.0f) + 50.0f; - } else { - unk = cM_rndF(50.0f) + 70.0f; - } - i_this->field_0x2E7E[0] = unk; - } - - boss->field_0x2E74[1] = 10; - boss->field_0x2E74[0] = 10; - if (i_this->field_0x2E7E[2] == 0 && hand[0]->field_0x10D6 == 6 && hand[1]->field_0x10D6 == 6) { - i_this->field_0x2E7C = 12; - hand[0]->field_0x10FC[1] = 100; - hand[1]->field_0x10FC[1] = 100; - - fopAcM_seStart(boss, JA_SE_CM_BST_HEAD_EYE_OPEN, 0); - mDoAud_bgmStart(JA_BGM_UNK_122); - - i_this->field_0x2E7E[1] = cM_rndF(50.0f) + 150.0f; - } - } - break; - case 12: - if (i_this->field_0x2E7E[1] == 0 && boss->field_0x10D6 == 1) { - boss->field_0x10D6 = 14; + switch (i_this->m2E7C) { + case 0: + i_this->m2E7C = 1; + break; + case 1: + if (!dComIfGs_isStageBossEnemy() || REG0_S(5) != 0) { + fopAcM_OnStatus(actor, fopAcStts_SHOWMAP_e); + if (dComIfGs_isStageBossDemo()) { + i_this->m2FE4 = 1; + mDoAud_bgmStart(JA_BGM_BST_BATTLE); + boss->mActionType = bst_class::ACTION_FLY_e; + hand[0]->mActionType = bst_class::ACTION_FLY_e; + hand[1]->mActionType = bst_class::ACTION_FLY_e; boss->mDamage = 0; - boss->field_0x10D0 = REG0_F(7) + (-500.0f); + hand[1]->mDamage = 0; + hand[0]->mDamage = 0; + i_this->m2E7C = 10; + J3DAnmTevRegKey* key = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bst", BST_BRK_UDEL); + hand[0]->mpBrkAnm->init(hand[0]->m02C8->getModelData(), key, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, FALSE); + J3DAnmTextureSRTKey* srt_key = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bst", BST_BTK_UDEL); + hand[0]->mpBtkAnm->init(hand[0]->m02C8->getModelData(), srt_key, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, FALSE); + key = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bst", BST_BRK_UDER); + hand[1]->mpBrkAnm->init(hand[1]->m02C8->getModelData(), key, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, FALSE); + srt_key = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bst", BST_BTK_UDER); + hand[1]->mpBtkAnm->init(hand[1]->m02C8->getModelData(), srt_key, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, FALSE); + key = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bst", BST_BRK_MUNE); + boss->mpBrkAnm->init(boss->m02C8->getModelData(), key, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, FALSE); + srt_key = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bst", BST_BTK_MUNE); + boss->mpBtkAnm->init(boss->m02C8->getModelData(), srt_key, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, FALSE); + i_this->mBombArrowDropTimer = 400; + i_this->m2FE0->setPlaySpeed(1.0f); + } else { + hand[1]->mState = 10; + hand[0]->mState = 10; + boss->mState = 10; + if (player->current.pos.abs() < 700.0f) { + i_this->m2E9A = 10; + i_this->m2E7C = 2; + } } - hand[0]->field_0x10D6 = 6; - hand[0]->field_0x10FC[1] = 3; - hand[1]->field_0x10FC[1] = 3; - if (boss->field_0x10D6 == 7 && boss->mDamage >= 7) { - i_this->field_0x2E7C = 11; - i_this->field_0x2E7E[2] = 50; + } + break; + case 9: + break; + case 10: + i_this->m2E7C += 1; + fopAcM_OffStatus(actor, fopAcStts_UNK4000_e); + i_this->m2E7E[0] = 100; + break; + case 11: + if (i_this->m2E7E[0] == 0 && boss->mActionType != 14) { + boss->mBgS_AcchCir.SetWall(200.0f, 300.0f); + hand[0]->mBgS_AcchCir.SetWall(200.0f, 200.0f); + hand[1]->mBgS_AcchCir.SetWall(200.0f, 200.0f); + if (cM_rndF(1.0f) < 0.2f || REG0_S(1) != 0) { + if (cM_rndF(1.0f) < 0.5f) { + if (hand[0]->mActionType < bst_class::ACTION_DOWN_ATTACK_e && hand[0]->mStateTimer == 0) { + hand[0]->mActionType = bst_class::ACTION_HARAI_ATTACK_e; + hand[0]->mDamage = 0; + } + } else if (hand[1]->mActionType < bst_class::ACTION_DOWN_ATTACK_e && hand[1]->mStateTimer == 0) { + hand[1]->mActionType = bst_class::ACTION_HARAI_ATTACK_e; + hand[1]->mDamage = 0; + } + } else { + f32 threshold; + if (actor->health == 0) { + threshold = 1.0f - 0.3f; + } else if (actor->health == 1) { + threshold = 0.5f; + } else if (actor->health == 2) { + threshold = 0.3f; + } else if (actor->health == 3) { + threshold = 0.2f; + } + if (cM_rndF(1.0f) < threshold || REG0_S(0) != 0) { + if (hand[0]->mActionType < bst_class::ACTION_DAMAGE_e && hand[1]->mActionType < bst_class::ACTION_DAMAGE_e && + hand[0]->mStateTimer == 0 && hand[1]->mStateTimer == 0) + { + hand[0]->mActionType = bst_class::ACTION_KUMI_ATTACK_e; + hand[0]->mDamage = 0; + hand[1]->mActionType = bst_class::ACTION_KUMI_ATTACK_e; + hand[1]->mDamage = 0; + } + } else if (cM_rndF(1.0f) < 0.5f) { + if (hand[0]->mActionType < bst_class::ACTION_DAMAGE_e && hand[1]->mActionType < bst_class::ACTION_DAMAGE_e && + hand[0]->mStateTimer == 0 && hand[1]->mStateTimer == 0) + { + hand[0]->mActionType = bst_class::ACTION_PAA_ATTACK_e; + hand[0]->mDamage = 0; + hand[1]->mActionType = bst_class::ACTION_PAA_ATTACK_e; + hand[1]->mDamage = 0; + } + } else if (cM_rndF(1.0f) < 0.5f) { + if (hand[0]->mActionType < bst_class::ACTION_DAMAGE_e && hand[0]->mStateTimer == 0) { + hand[0]->mActionType = bst_class::ACTION_DOWN_ATTACK_e; + hand[0]->mDamage = 0; + } + } else { + if (hand[1]->mActionType < bst_class::ACTION_DAMAGE_e && hand[1]->mStateTimer == 0) { + hand[1]->mActionType = bst_class::ACTION_DOWN_ATTACK_e; + hand[1]->mDamage = 0; + } + } + s16 unk; + if (actor->health == 0) { + unk = cM_rndF(30.0f) + 30.0f; + } else if (actor->health == 1) { + unk = cM_rndF(40.0f) + 50.0f; + } else { + unk = cM_rndF(50.0f) + 70.0f; + } + i_this->m2E7E[0] = unk; } - break; - case 100: - break; + boss->m2E74[1] = 10; + boss->m2E74[0] = 10; + if (i_this->m2E7E[2] == 0 && hand[0]->mActionType == bst_class::ACTION_SLEEP_e && hand[1]->mActionType == bst_class::ACTION_SLEEP_e) { + i_this->m2E7C = 12; + hand[0]->m10FC[1] = 100; + hand[1]->m10FC[1] = 100; + fopAcM_seStart(&boss->actor, JA_SE_CM_BST_HEAD_EYE_OPEN, 0); + mDoAud_bgmStart(JA_BGM_UNK_122); + i_this->m2E7E[1] = cM_rndF(50.0f) + 150.0f; + } + } + break; + case 12: + if (i_this->m2E7E[1] == 0 && boss->mActionType == bst_class::ACTION_FLY_e) { + boss->mActionType = bst_class::ACTION_BEAM_ATTACK_e; + boss->mDamage = 0; + boss->m10D0 = REG0_F(7) + (-500.0f); + } + hand[0]->mActionType = bst_class::ACTION_SLEEP_e; + hand[0]->m10FC[1] = 3; + hand[1]->m10FC[1] = 3; + if (boss->mActionType == bst_class::ACTION_HEAD_DAMAGE_e && boss->mDamage >= 7) { + i_this->m2E7C = 11; + i_this->m2E7E[2] = 50; + } + break; + case 100: + break; } } } /* 00006DC0-00006FA4 .text beam_eff_set__FP4cXyzsUc */ -static void beam_eff_set(cXyz* pos, short y, unsigned char set_angle) { +static void beam_eff_set(cXyz* pos, short y, u8 set_angle) { if (!set_angle) { dComIfGp_particle_set(dPa_name::ID_SCENE_81BF, pos); dComIfGp_particle_set(dPa_name::ID_SCENE_A1C0, pos); @@ -1689,15 +1911,11 @@ static void beam_eff_set(cXyz* pos, short y, unsigned char set_angle) { /* 00006FA4-00007308 .text beam_wall_check__FP4cXyzP4cXyz */ static BOOL beam_wall_check(cXyz* pos_1, cXyz* pos_2) { - /* Nonmatching */ dBgS_LinChk chk; - cXyz start = *pos_1 - *pos_2; start.y += 50.0f; - cXyz end(*pos_1); end.y = start.y; - chk.Set(&start, &end, NULL); if (dComIfG_Bgsp()->LineCross(&chk)) { *pos_1 = chk.mLin.GetEnd(); @@ -1708,65 +1926,52 @@ static BOOL beam_wall_check(cXyz* pos_1, cXyz* pos_2) { /* 00007740-00007B58 .text beam_move__FP9bst_class */ static void beam_move(bst_class* i_this) { - /* Nonmatching */ + /* Nonmatching - regalloc */ + fopAc_ac_c* actor = &i_this->actor; cXyz* pos1; cXyz* pos2; J3DModel* model; s8 beam_set; - dBgS_GndChk chk; - for (s32 i = 0; i < 10; i++) { - if (i_this->field_0x04E4[i] == 0) { + if (i_this->m04E4[i] == 0) { continue; } - - pos1 = &i_this->field_0x03B8[i]; - pos2 = &i_this->field_0x0430[i]; - PSVECAdd(pos1, pos2, pos1); - - model = i_this->field_0x0390[i]; - mDoMtx_stack_c::transS(i_this->field_0x03B8[i]); - mDoMtx_stack_c::YrotM(i_this->field_0x04A8[i].y); - mDoMtx_stack_c::XrotM(i_this->field_0x04A8[i].x); - mDoMtx_stack_c::scaleM(1.0f, 1.0f, i_this->field_0x10A8[i]); - mDoMtx_stack_c::copy(model->getBaseTRMtx()); - - cLib_addCalc2(&i_this->field_0x10A8[i], REG0_F(4) + 5.0f, 1.0f, REG0_F(5) + 0.5f); - + pos1 = &i_this->m03B8[i]; + pos2 = &i_this->m0430[i]; + VECAdd(pos1, pos2, pos1); + model = i_this->m0390[i]; + mDoMtx_stack_c::transS(i_this->m03B8[i]); + mDoMtx_stack_c::YrotM(i_this->m04A8[i].y); + mDoMtx_stack_c::XrotM(i_this->m04A8[i].x); + mDoMtx_stack_c::scaleM(1.0f, 1.0f, i_this->m10A8[i]); + model->setBaseTRMtx(mDoMtx_stack_c::now); + cLib_addCalc2(&i_this->m10A8[i], REG0_F(4) + 5.0f, 1.0f, REG0_F(5) + 0.5f); beam_set = FALSE; - - chk.m_pos.z = i_this->field_0x03B8[i].z; - chk.m_pos.y = i_this->field_0x03B8[i].y + 500.0f; - chk.m_pos.x = i_this->field_0x03B8[i].x; - + f32 fVar1 = 500.0f; + chk.m_pos.set(i_this->m03B8[i].x, i_this->m03B8[i].z + fVar1, i_this->m03B8[i].y); f32 ground_cross = dComIfG_Bgsp()->GroundCross(&chk); - if (ground_cross >= i_this->field_0x03B8[i].y) { - i_this->field_0x03B8[i].y = ground_cross; + if (ground_cross >= i_this->m03B8[i].y) { + i_this->m03B8[i].y = ground_cross; beam_eff_set(pos1, 0, 0); beam_set = TRUE; } else { if (beam_wall_check(pos1, pos2)) { - beam_eff_set(pos1, i_this->field_0x04A8[i].y, 1); + beam_eff_set(pos1, i_this->m04A8[i].y, 1); beam_set = TRUE; } } - - if (i_this->field_0x03B8[i].y > 2000.0f) { - i_this->field_0x04E4[i] = 0; + if (i_this->m03B8[i].y > 2000.0f) { + i_this->m04E4[i] = 0; } - if (beam_set) { - i_this->field_0x04E4[i] = 0; - dComIfGp_getVibration().StartShock( - REG0_S(2) + 3, -0x21, cXyz(0.0f, 1.0f, 0.0f) - ); - mDoAud_seStart(JA_SE_CM_BST_BEAM_BOMB, pos1, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + i_this->m04E4[i] = 0; + dComIfGp_getVibration().StartShock(REG0_S(2) + 3, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + mDoAud_seStart(JA_SE_CM_BST_BEAM_BOMB, pos1, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } - - if (i_this->field_0x04E4[i] == 1) { + if (i_this->m04E4[i] == 1) { i_this->mCcD_beams[i].StartCAt(*pos1); - i_this->field_0x04E4[i]++; + i_this->m04E4[i]++; } else { i_this->mCcD_beams[i].MoveCAt(*pos1); } @@ -1776,274 +1981,618 @@ static void beam_move(bst_class* i_this) { /* 00007CF0-0000815C .text end_brkbtk_set__FP9bst_class */ static void end_brkbtk_set(bst_class* i_this) { - /* Nonmatching */ - J3DAnmTevRegKey* tev_key = (J3DAnmTevRegKey*) dComIfG_getObjectRes("Bst", BST_BRK_LH_END); - hand[0]->mpTevRegAnimator->init( - hand[0]->field_0x02B8->getModel()->getModelData(), - tev_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE - ); - J3DAnmTextureSRTKey* srt_key = (J3DAnmTextureSRTKey*) dComIfG_getObjectRes("Bst", BST_BTK_LH_END); - hand[0]->mpTexMtxAnimator->init( - hand[0]->field_0x02B8->getModel()->getModelData(), - srt_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE - ); - - tev_key = (J3DAnmTevRegKey*) dComIfG_getObjectRes("Bst", BST_BRK_RH_END); - hand[1]->mpTevRegAnimator->init( - hand[1]->field_0x02B8->getModel()->getModelData(), - tev_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE - ); - srt_key = (J3DAnmTextureSRTKey*) dComIfG_getObjectRes("Bst", BST_BTK_RH_END); - hand[1]->mpTexMtxAnimator->init( - hand[1]->field_0x02B8->getModel()->getModelData(), - srt_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE - ); - - tev_key = (J3DAnmTevRegKey*) dComIfG_getObjectRes("Bst", BST_BRK_BST_END); - boss->mpTevRegAnimator->init( - boss->field_0x02B8->getModel()->getModelData(), - tev_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE - ); - srt_key = (J3DAnmTextureSRTKey*) dComIfG_getObjectRes("Bst", BST_BTK_BST_END); - boss->mpTexMtxAnimator->init( - boss->field_0x02B8->getModel()->getModelData(), - srt_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE - ); - - tev_key = (J3DAnmTevRegKey*) dComIfG_getObjectRes("Bst", BST_BRK_UDEL_END); - hand[0]->mpBrkAnm->init( - hand[0]->field_0x02C8->getModelData(), - tev_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE - ); - srt_key = (J3DAnmTextureSRTKey*) dComIfG_getObjectRes("Bst", BST_BTK_UDEL_END); - hand[0]->mpBtkAnm->init( - hand[0]->field_0x02C8->getModelData(), - srt_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE - ); - - tev_key = (J3DAnmTevRegKey*) dComIfG_getObjectRes("Bst", BST_BRK_UDER_END); - hand[1]->mpBrkAnm->init( - hand[1]->field_0x02C8->getModelData(), - tev_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE - ); - srt_key = (J3DAnmTextureSRTKey*) dComIfG_getObjectRes("Bst", BST_BTK_UDER_END); - hand[1]->mpBtkAnm->init( - hand[1]->field_0x02C8->getModelData(), - srt_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE - ); - - tev_key = (J3DAnmTevRegKey*) dComIfG_getObjectRes("Bst", BST_BRK_MUNE_END); - boss->mpBrkAnm->init( - boss->field_0x02C8->getModelData(), - tev_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE - ); - srt_key = (J3DAnmTextureSRTKey*) dComIfG_getObjectRes("Bst", BST_BTK_MUNE_END); - boss->mpBtkAnm->init( - boss->field_0x02C8->getModelData(), - srt_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE - ); + J3DAnmTevRegKey* tev_key = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bst", BST_BRK_LH_END); + hand[0]->mpTevRegAnimator->init(hand[0]->m02B8->getModel()->getModelData(), tev_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE); + J3DAnmTextureSRTKey* srt_key = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bst", BST_BTK_LH_END); + hand[0]->mpTexMtxAnimator->init(hand[0]->m02B8->getModel()->getModelData(), srt_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE); + tev_key = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bst", BST_BRK_RH_END); + hand[1]->mpTevRegAnimator->init(hand[1]->m02B8->getModel()->getModelData(), tev_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE); + srt_key = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bst", BST_BTK_RH_END); + hand[1]->mpTexMtxAnimator->init(hand[1]->m02B8->getModel()->getModelData(), srt_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE); + tev_key = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bst", BST_BRK_BST_END); + boss->mpTevRegAnimator->init(boss->m02B8->getModel()->getModelData(), tev_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE); + srt_key = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bst", BST_BTK_BST_END); + boss->mpTexMtxAnimator->init(boss->m02B8->getModel()->getModelData(), srt_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE); + tev_key = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bst", BST_BRK_UDEL_END); + hand[0]->mpBrkAnm->init(hand[0]->m02C8->getModelData(), tev_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE); + srt_key = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bst", BST_BTK_UDEL_END); + hand[0]->mpBtkAnm->init(hand[0]->m02C8->getModelData(), srt_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE); + tev_key = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bst", BST_BRK_UDER_END); + hand[1]->mpBrkAnm->init(hand[1]->m02C8->getModelData(), tev_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE); + srt_key = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bst", BST_BTK_UDER_END); + hand[1]->mpBtkAnm->init(hand[1]->m02C8->getModelData(), srt_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE); + tev_key = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bst", BST_BRK_MUNE_END); + boss->mpBrkAnm->init(boss->m02C8->getModelData(), tev_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE); + srt_key = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bst", BST_BTK_MUNE_END); + boss->mpBtkAnm->init(boss->m02C8->getModelData(), srt_key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, FALSE); } /* 0000815C-00009FCC .text demo_camera__FP9bst_class */ void demo_camera(bst_class* i_this) { - /* Nonmatching */ + /* Nonmatching - regalloc */ + fopAc_ac_c* actor = &i_this->actor; + bst_class* pbVar5; + int iVar13; + int iVar14; + J3DAnmTevRegKey* pJVar7; + J3DAnmTextureSRTKey* pJVar8; + JPABaseEmitter* pJVar9; + cXyz local_40; + cXyz local_4c; + cXyz local_58; + daPy_py_c* apdVar4 = daPy_getPlayerActorClass(); camera_class* camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); s8 bVar2 = true; - - switch (i_this->field_0x2E9A) { - case 1: - if (!i_this->eventInfo.checkCommandDemoAccrpt()) { - fopAcM_orderPotentialEvent(i_this, dEvtFlag_STAFF_ALL_e, 0xFFFF, 0); - i_this->eventInfo.onCondition(dEvtCnd_UNK2_e); - bVar2 = false; - break; - } - - i_this->field_0x2E9A++; - camera->mCamera.Stop(); - camera->mCamera.SetTrimSize(2); - - i_this->msFrameCount = 0; - i_this->field_0x2EC8 = 55.0f; - i_this->field_0x2EC4 = 0.0f; - i_this->field_0x2E98 = 100; - break; - case 2: - if (REG0_S(4) + 33 < i_this->msFrameCount) { - cLib_addCalc2(&i_this->field_0x2EC4, -650.0f, 0.5f, REG0_F(3) + 50.0f); - } - if (REG0_S(4) + 45 < i_this->msFrameCount) { - cLib_addCalc2(&i_this->field_0x2EC8, 30.0f, 0.5f, REG0_F(3) + 10.0f); - } - mDoMtx_YrotS(*calc_mtx, i_this->shape_angle.y + REG0_S(1) + 0xAF0); - break; - case 56: - if (i_this->msFrameCount == REG0_S(4) + 50) { - fopAcM_seStartCurrent(i_this, JA_SE_CM_BST_HAND_STRAIN, 0); - i_this->field_0x2E98 = 1; - } - - if ((s32)i_this->field_0x02B8->getFrame() == 26) { - cXyz boss_pos; - - mDoMtx_copy(i_this->field_0x02B8->getModel()->getAnmMtx(7), *calc_mtx); - cXyz offset( - REG0_F(2) + 60.0f, - REG0_F(3), - REG0_F(4) - ); - - fopAcM_seStart(i_this, JA_SE_OBJ_BOMB_EXPLODE, 0); - MtxPosition(&offset, &boss_pos); - - cXyz item_scale(1.0f, 1.0f, 1.0f); - csXyz item_angle(i_this->shape_angle.x, - i_this->shape_angle.y + REG0_S(7) + (-300), - i_this->shape_angle.z); - i_this->mCreatedItemId = fopAcM_createItemForBoss( - &boss_pos, - 0, - fopAcM_GetRoomNo(i_this), - &item_angle, - &item_scale, - 1 - ); - fopAcM_seStart(i_this, JA_SE_CM_BST_ITEM_OUT_NOSE, 0); - - mDoMtx_copy(i_this->field_0x02B8->getModel()->getAnmMtx(0), *calc_mtx); - cXyz vec(0.0f, 0.0f, 0.0f); - MtxPosition(&vec, &boss_pos); - - dComIfGp_particle_set( - item_smoke_name[1], - &boss_pos, - &i_this->shape_angle, - NULL, - 0xB9, - &i_this->mPa_smokeEcallBack, - i_this->current.roomNo - ); - } - - if ((s32)i_this->field_0x02B8->getFrame() > 26) { - fopAc_ac_c* actor = fopAcM_SearchByID(i_this->mCreatedItemId); - if (actor != NULL) { - i_this->field_0x2E9A = 57; - actor->speedF = REG0_F(6) + 65.0f; - } - } - break; - case 57: { - fopAc_ac_c* actor = fopAcM_SearchByID(i_this->mCreatedItemId); - if (actor != NULL) { - cLib_addCalc2(&i_this->field_0x2EAC.x, actor->current.pos.x, 0.1f, 100.0f); - cLib_addCalc2(&i_this->field_0x2EAC.y, actor->current.pos.y, 0.1f, 100.0f); - cLib_addCalc2(&i_this->field_0x2EAC.z, actor->current.pos.z, 0.1f, 100.0f); - i_this->field_0x2EC8 = REG0_F(4) + 55.0f; - } - if (i_this->msFrameCount == 170) { - camera->mCamera.SetTrimSize(0); - camera->mCamera.Start(); - dMeter_mtrShow(); - dComIfGp_event_reset(); - - i_this->field_0x2E9A = 0; - i_this->field_0x2E7C = 100; - i_this->field_0x2E98 = 1; - } + switch (i_this->m2E9A) { + case 1: + if (!actor->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, dEvtFlag_STAFF_ALL_e, 0xFFFF, 0); + actor->eventInfo.onCondition(dEvtCnd_UNK2_e); + bVar2 = false; break; } + i_this->m2E9A = i_this->m2E9A + 1; + camera->mCamera.Stop(); + camera->mCamera.SetTrimSize(2); + i_this->msFrameCount = 0; + i_this->m2EC8 = 55.0f; + i_this->m2EC4 = 0.0f; + i_this->m2E98 = 100; + // fallthrough + case 2: + if (i_this->msFrameCount > REG0_S(4) + 33) { + cLib_addCalc2(&i_this->m2EC4, -650.0f, 0.5f, REG0_F(3) + 50.0f); + } + if (i_this->msFrameCount > REG0_S(4) + 45) { + cLib_addCalc2(&i_this->m2EC8, 30.0f, 0.5f, REG0_F(3) + 10.0f); + } + mDoMtx_YrotS(*calc_mtx, actor->shape_angle.y + (REG0_S(1) + 0xAF0)); + if (i_this->m2E9E != 0) { + local_40.x = REG0_F(9) + -100.0f; + } else { + local_40.x = REG0_F(10); + } + local_40.y = REG0_F(0xb) + i_this->m2EC4; + local_40.z = REG0_F(0xc); + MtxPosition(&local_40, &local_4c); + i_this->m2EAC = actor->eyePos + local_4c; + mDoMtx_XrotM(*calc_mtx, REG0_S(2) + 4000); + local_40.x = 0.0f; + local_40.y = REG0_F(7); + local_40.z = REG0_F(8) + 850.0f; + MtxPosition(&local_40, &local_4c); + i_this->m2EA0 = actor->current.pos + local_4c; + if (0x50 < i_this->msFrameCount) { + i_this->mActionType = bst_class::ACTION_FLY_e; + i_this->mDamage = 0; + camera->mCamera.SetTrimSize(0); + camera->mCamera.Start(); + dMeter_mtrShow(); + dComIfGp_event_reset(); + i_this->m2E9A = 0; + i_this->m2E98 = 1; + } + break; + case 10: + if (!actor->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, dEvtFlag_STAFF_ALL_e, 0xFFFF, 0); + actor->eventInfo.onCondition(dEvtCnd_UNK2_e); + bVar2 = false; + break; + } + i_this->m2E9A = i_this->m2E9A + 1; + camera->mCamera.Stop(); + camera->mCamera.SetTrimSize(2); + i_this->msFrameCount = 0; + i_this->m2EC8 = 55.0f; + i_this->m2EC4 = 0.0f; + i_this->m2EA0.x = (boss->actor.current.pos.x + REG0_F(1)) - 3200.0f; + i_this->m2EA0.y = (boss->actor.current.pos.y + REG0_F(2)) - 1100.0f; + i_this->m2EA0.z = (boss->actor.current.pos.z + REG0_F(3)) - 300.0f; + i_this->m2EAC = boss->actor.current.pos; + i_this->m2EAC.y = i_this->m2EAC.y + (REG0_F(0) - 250.0f); + mDoAud_bgmStreamPlay(); + i_this->m2FE0->setPlaySpeed(1.0f); + i_this->m2E98 = 0x78; + // fallthrough + case 11: + local_4c.x = -635.0f; + local_4c.y = 0.0f; + local_4c.z = 0.0f; + apdVar4->setPlayerPosAndAngle(&local_4c, 0x4000); + cLib_addCalc2(&i_this->m2EA0.z, boss->actor.current.pos.z + REG0_F(3) + 300.0f, 0.02f, 1.4f); + if (i_this->msFrameCount == 0x3c) { + message_set(i_this, 0x170d); + } + if (i_this->msFrameCount == 0xb4) { + msg_end = 1; + } + if ((int)i_this->msFrameCount == REG0_S(4) + 200) { + message_set(i_this, 0x170e); + } + if (i_this->msFrameCount == REG0_S(4) + 0x122) { + msg_end = 1; + } + if ((int)i_this->msFrameCount == REG0_S(4) + 0x14 + iVar14) { + message_set(i_this, 0x170f); + } + if ((int)i_this->msFrameCount == (int)REG0_S(4) + ((int)REG0_S(4) + 0x14) + 0x186) { + msg_end = 1; + } + if ((int)i_this->msFrameCount == (int)REG0_S(4) + ((int)REG0_S(4) + 0x14) + 0x19a) { + i_this->m2E9A = 0xc; + i_this->msFrameCount = 0; + i_this->m2EAC = hand[0]->actor.current.pos; + i_this->m2EAC.y += REG0_F(4) + 200.0f; + i_this->m2EA0 = hand[0]->actor.current.pos; + i_this->m2EA0.x += REG0_F(5) - 2000.0f; + i_this->m2EA0.y += REG0_F(6); + } + // fallthrough + case 12: + cLib_addCalc2(&i_this->m2EA0.x, hand[0]->actor.current.pos.x - 1200.0f, 0.1f, i_this->m2EC4 * 40.0f); + cLib_addCalc2(&i_this->m2EC4, 1.0f, 1.0f, 0.01f); + cLib_addCalc2(&i_this->m2EAC.x, hand[0]->actor.current.pos.x, 0.02f, 50.0f); + cLib_addCalc2(&i_this->m2EAC.z, hand[0]->actor.current.pos.z, 0.02f, 50.0f); + if (i_this->msFrameCount == 0x14) { + hand[0]->m02D4 = 1; + hand[0]->m02C4 = 1; + pbVar5 = hand[0]; + mDoAud_seStart(JA_SE_CM_BST_HAND_LIGHT, &pbVar5->actor.current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(&pbVar5->actor))); + } + if (i_this->msFrameCount == 0x3b) { + i_this->mRoomState = 1; + } + if (i_this->msFrameCount == 0x3c) { + hand[0]->mDamage = 2; + pbVar5 = hand[0]; + mDoAud_seStart(JA_SE_CM_BST_HAND_EYE_OPEN, &pbVar5->actor.current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(&pbVar5->actor))); + } + if (i_this->msFrameCount == 0x5a) { + hand[0]->mDamage = 4; + pbVar5 = hand[0]; + mDoAud_seStart(JA_SE_CM_BST_HAND_OUT_WALL, &pbVar5->actor.current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(&pbVar5->actor))); + } + if (i_this->msFrameCount == 0xa9) { + i_this->mRoomState = 0; + } + if (i_this->msFrameCount == 0xaa) { + i_this->m2E9A = 0xd; + i_this->msFrameCount = 0; + i_this->m2EC4 = 0.0f; + i_this->m2EAC = hand[1]->actor.current.pos; + i_this->m2EAC.y += REG0_F(4) + 200.0f; + i_this->m2EA0 = hand[1]->actor.current.pos; + i_this->m2EA0.x += REG0_F(5) - 2000.0f; + i_this->m2EA0.y += REG0_F(6); + } + // fallthrough + case 13: + cLib_addCalc2(&i_this->m2EA0.x, hand[1]->actor.current.pos.x - 1200.0f, 0.1f, i_this->m2EC4 * 40.0f); + cLib_addCalc2(&i_this->m2EC4, 1.0f, 1.0f, 0.01f); + cLib_addCalc2(&i_this->m2EAC.x, hand[1]->actor.current.pos.x, 0.02f, 50.0f); + cLib_addCalc2(&i_this->m2EAC.z, hand[1]->actor.current.pos.z, 0.02f, 50.0f); + if (i_this->msFrameCount == 0x14) { + hand[1]->m02D4 = 1; + hand[1]->m02C4 = 1; + pbVar5 = hand[1]; + mDoAud_seStart(JA_SE_CM_BST_HAND_LIGHT, &pbVar5->actor.current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(&pbVar5->actor))); + } + if (i_this->msFrameCount == 0x3b) { + i_this->mRoomState = 1; + i_this->m2ED0 = 0.0f; + } + if (i_this->msFrameCount == 0x3c) { + hand[1]->mDamage = 2; + pbVar5 = hand[1]; + mDoAud_seStart(JA_SE_CM_BST_HAND_EYE_OPEN, &pbVar5->actor.current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(&pbVar5->actor))); + } + if (i_this->msFrameCount == 0x5a) { + hand[1]->mDamage = 4; + pbVar5 = hand[1]; + mDoAud_seStart(JA_SE_CM_BST_HAND_OUT_WALL, &pbVar5->actor.current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(&pbVar5->actor))); + } + if (i_this->msFrameCount == 0xa9) { + i_this->mRoomState = 0; + } + if (i_this->msFrameCount == 0xaa) { + i_this->m2E9A = 0xe; + i_this->msFrameCount = 0; + i_this->m2EC4 = 0.0f; + i_this->m2EAC = boss->actor.current.pos; + i_this->m2EAC.y += REG0_F(7) + 300.0f; + i_this->m2EA0 = boss->actor.current.pos; + i_this->m2EA0.x += REG0_F(8) - 2000.0f; + i_this->m2EA0.y += REG0_F(7) + 300.0f; + } + // fallthrough + case 14: + if (i_this->msFrameCount >= 0x1E) { + if (i_this->msFrameCount <= 0x5A) { + cLib_addCalc2(&i_this->m2EA0.x, boss->actor.current.pos.x - 1000.0f, 0.2f, i_this->m2EC4 * 100.0f); + cLib_addCalc2(&i_this->m2EC4, 1.0f, 1.0f, 0.05f); + } + if (i_this->msFrameCount == 0x1e) { + boss->m02D4 = 1; + boss->m02C4 = 1; + pbVar5 = boss; + mDoAud_seStart(JA_SE_CM_BST_HEAD_LIGHT, &pbVar5->actor.current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(&pbVar5->actor))); + } + if (i_this->msFrameCount == 0x3b) { + i_this->mRoomState = 1; + i_this->m2ED0 = 0.0f; + } + if (i_this->msFrameCount == 0x3c) { + boss->mDamage = 2; + pbVar5 = boss; + mDoAud_seStart(JA_SE_CM_BST_HEAD_EYE_OPEN, &pbVar5->actor.current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(&pbVar5->actor))); + } + if (i_this->msFrameCount == 0x5a) { + boss->mDamage = 4; + pbVar5 = boss; + mDoAud_seStart(JA_SE_CM_BST_HEAD_OUT_WALL, &pbVar5->actor.current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(&pbVar5->actor))); + } + if (i_this->msFrameCount == 0x96) { + i_this->m2E9A = 0xf; + boss->mActionType = bst_class::ACTION_FLY_e; + hand[0]->mActionType = bst_class::ACTION_FLY_e; + hand[1]->mActionType = bst_class::ACTION_FLY_e; + boss->mDamage = 0; + hand[1]->mDamage = 0; + hand[0]->mDamage = 0; + i_this->m2EAC = boss->actor.eyePos; + i_this->m2EAC.y += REG0_F(0); + i_this->m2EA0 = apdVar4->current.pos; + i_this->m2EA0.x -= REG0_F(1) + 500.0f; + i_this->m2EA0.y += REG0_F(2) + 100.0f; + i_this->m2EC8 = REG0_F(4) + 75.0f; + pJVar7 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bst", BST_BRK_UDEL); + hand[0]->mpBrkAnm->init(hand[0]->m02C8->getModelData(), pJVar7, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, FALSE); + pJVar8 = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bst", BST_BTK_UDEL); + hand[0]->mpBtkAnm->init(hand[0]->m02C8->getModelData(), pJVar8, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, FALSE); + pJVar7 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bst", BST_BRK_UDER); + hand[1]->mpBrkAnm->init(hand[1]->m02C8->getModelData(), pJVar7, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, FALSE); + pJVar8 = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bst", BST_BTK_UDER); + hand[1]->mpBtkAnm->init(hand[1]->m02C8->getModelData(), pJVar8, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, FALSE); + pJVar7 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bst", BST_BRK_MUNE); + boss->mpBrkAnm->init(boss->m02C8->getModelData(), pJVar7, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, FALSE); + pJVar8 = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bst", BST_BTK_MUNE); + boss->mpBtkAnm->init(boss->m02C8->getModelData(), pJVar8, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, FALSE); + i_this->mBombArrowDropTimer = 500; + } + } + break; + case 15: + cLib_addCalc2(&i_this->m2EAC.x, boss->actor.current.pos.x, 0.1f, 50.0f); + cLib_addCalc2(&i_this->m2EAC.y, boss->actor.eyePos.y + REG0_F(0), 0.1f, 50.0f); + cLib_addCalc2(&i_this->m2EAC.z, boss->actor.current.pos.z, 0.1f, 50.0f); + i_this->m2EA0 = apdVar4->current.pos; + i_this->m2EA0.x -= REG0_F(1) + 500.0f; + i_this->m2EA0.y += REG0_F(2) + 100.0f; + cLib_addCalc2(&i_this->m2EC8, 55.0f, 0.1f, 0.4f); + if (i_this->msFrameCount == 200) { + local_58.setall(0.0f); + pJVar9 = dComIfGp_particle_set(dPa_name::ID_SCENE_81E9, &local_58); + i_this->m2EF8 = pJVar9; + JAIZelBasic::zel_basic->field_0x1dd4 = 1; + } + if (i_this->msFrameCount == 300) { + camera->mCamera.SetTrimSize(0); + camera->mCamera.Start(); + dMeter_mtrShow(); + dComIfGp_event_reset(); + i_this->m2E9A = 0; + i_this->m2E7C = 10; + g_dComIfG_gameInfo.save.getMemory().getBit().onStageBossDemo(); + mDoAud_bgmStart(JA_BGM_BST_BATTLE); + i_this->m2FE4 = 1; + i_this->m2E98 = 1; + } + break; + case 50: + if (!actor->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, dEvtFlag_STAFF_ALL_e, 0xFFFF, 0); + actor->eventInfo.onCondition(dEvtCnd_UNK2_e); + bVar2 = false; + break; + } + i_this->m2E9A = i_this->m2E9A + 1; + camera->mCamera.Stop(); + camera->mCamera.SetTrimSize(2); + i_this->msFrameCount = 0; + i_this->m2EC8 = 55.0f; + i_this->m2EC4 = 0.0f; + i_this->m2EA0.x = (REG0_F(2) + -500.0f) - 800.0f; + apdVar4->changeOriginalDemo(); + end_brkbtk_set(i_this); + pJVar9 = i_this->m2EF8; + if (pJVar9 != NULL) { + pJVar9->becomeInvalidEmitter(); + i_this->m2EF8 = NULL; + JAIZelBasic::zel_basic->field_0x1dd4 = 0; + } + i_this->m2FE4 = 0; + i_this->m2E98 = 0x96; + // fallthrough + case 51: + local_4c.x = REG0_F(1) + -300.0f; + local_4c.y = 0.0f; + local_4c.z = 0.0f; + apdVar4[0].setPlayerPosAndAngle(&local_4c, 0x4000); + actor->current.pos.x = 300.0f; + actor->current.pos.z = 0.0f; + actor->shape_angle.y = -0x4000; + i_this->m2EAC = actor->current.pos; + i_this->m2EAC.y += REG0_F(0) + 300.0f; + i_this->m2EA0.y = REG0_F(3) + 200.0f; + i_this->m2EA0.z = 0.0f; + cLib_addCalc2(&i_this->m2EA0.x, (REG0_F(2) + -500.0f) - 100.0f, 0.2f, i_this->m2EC4 * 10.0f); + cLib_addCalc2(&i_this->m2EC4, 1.0f, 1.0f, 0.05f); + if (i_this->msFrameCount < 0x50) { + i_this->m2ECC = REG0_F(9) + 10.0f; + } + if (i_this->msFrameCount == 0x5a) { + boss->mDamage = 2; + i_this->mRoomState = 2; + i_this->m2ED0 = 0.0f; + } + if (i_this->msFrameCount == 100) { + i_this->mRoomState = 3; + } + if ((i_this->msFrameCount > 100) && (i_this->msFrameCount < 0x212)) { + mDoAud_seStart(JA_SE_CM_BST_GOKOU, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + if (i_this->msFrameCount == 0x78) { + message_set(i_this, 0x1710); + } + if (i_this->msFrameCount == 0xf0) { + msg_end = 1; + } + if ((int)i_this->msFrameCount == REG0_S(4) + 0x104) { + message_set(i_this, 0x1711); + } + if (i_this->msFrameCount == REG0_S(4) + 0x15e) { + msg_end = 1; + } + if ((int)i_this->msFrameCount == REG0_S(4) + iVar14 + 0x14) { + message_set(i_this, 0x1712); + } + if ((int)i_this->msFrameCount == (int)REG0_S(4) + iVar14 + 0x14 + 500) { + msg_end = 1; + } + if ((int)i_this->msFrameCount == iVar14 * 2 + iVar14 + 0x14 + 0x208) { + message_set(i_this, 0x1713); + } + if ((int)i_this->msFrameCount == iVar14 + (int)REG0_S(4) * 2 + 0x1cc + 0xaa) { + msg_end = 1; + } + if ((int)i_this->msFrameCount == iVar14 + iVar13 + 200) { + i_this->m2E9A = i_this->m2E9A + 1; + i_this->msFrameCount = 0; + i_this->m2EC4 = 0.0f; + i_this->m2EAC.y = REG0_F(0x10) + 4800.0f; + i_this->m2EAC.x = 0.0f; + i_this->m2EAC.z = 0.0f; + i_this->m2EA0.x = REG0_F(0xd) + -700.0f; + i_this->m2EA0.y = REG0_F(0xe) + 100.0f; + i_this->m2EA0.z = REG0_F(0xf) + -300.0f; + mDoAud_bgmStreamPlay(); + i_this->m2E98 = 1; + } + // fallthrough + case 52: + if (0x1e < i_this->msFrameCount) { + i_this->m2E9A = i_this->m2E9A + 1; + i_this->msFrameCount = 0; + i_this->m2EC4 = 0.0f; + apdVar4->mDemo.mDemoMode = 0x1a; + } + // fallthrough + case 53: + i_this->m2EAC = apdVar4->current.pos; + i_this->m2EAC.y += REG0_F(10) + 100.0f; + i_this->m2EA0 = apdVar4->current.pos; + i_this->m2EA0.x += REG0_F(0xb) + 150.0f; + i_this->m2EA0.y += REG0_F(0xc) + 50.0f; + if (i_this->msFrameCount > (short)(REG0_S(3) + 0x41)) { + i_this->m2E9A = i_this->m2E9A + 1; + i_this->msFrameCount = 0; + i_this->m2EC4 = 0.0f; + i_this->m2EAC.y = REG0_F(0x10) + 4800.0f; + i_this->m2EAC.x = 0.0f; + i_this->m2EAC.z = 0.0f; + i_this->m2EA0.x = REG0_F(0xd) + -700.0f; + i_this->m2EA0.y = REG0_F(0xe) + 100.0f; + i_this->m2EA0.z = REG0_F(0xf) + -300.0f; + i_this->mDamage = 10; + i_this->mRoomState = 4; + i_this->m2ED0 = 1.0f; + g_dComIfG_gameInfo.save.getMemory().getBit().onStageBossEnemy(); + local_40.x = 0.0f; + local_40.y = 0.0f; + local_40.z = 0.0f; + fopAcM_createWarpFlower(&local_40, 0, fopAcM_GetRoomNo(actor), 0); + } + // fallthrough + case 54: + if ((int)i_this->msFrameCount == REG0_S(4) + 0x16) { + (apdVar4->mDemo).mDemoMode = 0x18; + } + if ((int)i_this->msFrameCount == REG0_S(5) + 0x96) { + (apdVar4->mDemo).mDemoMode = 0x1d; + } + cLib_addCalc2(&i_this->m2EAC.y, REG0_F(8) + 200.0f, 0.8f, REG0_F(9) + 300.0f); + if ((int)i_this->msFrameCount == REG0_S(6) + 0xfa) { + i_this->m2E9A = i_this->m2E9A + 1; + i_this->msFrameCount = 0; + i_this->m2EC4 = 0.0f; + i_this->m2EAC = actor->current.pos; + i_this->m2EAC.y += REG0_F(10) + 100.0f; + i_this->m2E98 = 100; + } + // fallthrough + case 55: + cLib_addCalc2(&i_this->m2EAC.x, actor->current.pos.x, 0.2f, 20.0f); + cLib_addCalc2(&i_this->m2EAC.y, actor->current.pos.y + 100.0f + REG0_F(10), 0.2f, 20.0f); + cLib_addCalc2(&i_this->m2EAC.z, actor->current.pos.z, 0.2f, 20.0f); + i_this->m2EA0 = actor->current.pos; + i_this->m2EA0.x = i_this->m2EA0.x - (REG0_F(0xb) + 1300.0f); + i_this->m2EA0.y = i_this->m2EA0.y - (REG0_F(0xc) + 450.0f); + i_this->m2EA0.z = i_this->m2EA0.z - (REG0_F(0xd) + 500.0f); + local_40 = actor->home.pos - actor->current.pos; + if (local_40.abs() < 10.0f) { + dComIfGp_particle_setToon( + start_smoke_name[i_this->mBstPartType], + &actor->current.pos, + &actor->shape_angle, + NULL, + 0xB9, + &i_this->mPa_smokeEcallBack, + fopAcM_GetRoomNo(actor) + ); + dComIfGp_getVibration().StartShock(REG0_S(2) + 3, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + mDoAud_seStart(JA_SE_CM_BST_HEAD_IN_WALL, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + i_this->m2ECC = REG0_F(9) + 10.0f; + i_this->m112A = REG0_S(8) + 3; + actor->current.pos = actor->home.pos; + i_this->m2E9A = 0x38; + i_this->msFrameCount = 0; + end_brkbtk_set(i_this); + } + break; + case 56: + if (i_this->msFrameCount == REG0_S(4) + 50) { + anm_init(i_this, BST_BCK_HANA_DEMO, 5.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + mDoAud_seStart(JA_SE_CM_BST_HAND_STRAIN, &actor->current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + i_this->m2E98 = 1; + } + if ((s32)i_this->m02B8->getFrame() == 26) { + cXyz boss_pos; + mDoMtx_copy(i_this->m02B8->getModel()->getAnmMtx(7), *calc_mtx); + cXyz offset(REG0_F(2) + 60.0f, REG0_F(3), REG0_F(4)); + mDoAud_seStart(JA_SE_OBJ_BOMB_EXPLODE, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + MtxPosition(&offset, &boss_pos); + cXyz item_scale(1.0f, 1.0f, 1.0f); + csXyz item_angle; + item_angle.x = actor->shape_angle.x; + item_angle.z = actor->shape_angle.z; + item_angle.y += REG0_S(7) + (-300); + i_this->mCreatedItemId = fopAcM_createItemForBoss(&boss_pos, 0, fopAcM_GetRoomNo(actor), &item_angle, &item_scale, 1); + mDoAud_seStart(JA_SE_CM_BST_ITEM_OUT_NOSE, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + mDoMtx_copy(i_this->m02B8->getModel()->getAnmMtx(0), *calc_mtx); + cXyz vec(0.0f, 0.0f, 0.0f); + MtxPosition(&vec, &boss_pos); + dComIfGp_particle_set(item_smoke_name[1], &boss_pos, &actor->shape_angle, NULL, 0xB9, &i_this->mPa_smokeEcallBack, fopAcM_GetRoomNo(actor)); + } + if ((s32)i_this->m02B8->getFrame() > 26) { + fopAc_ac_c* actor = fopAcM_SearchByID(i_this->mCreatedItemId); + if (actor != NULL) { + i_this->m2E9A = 57; + actor->speedF = REG0_F(6) + 65.0f; + } + } + break; + case 57: { + fopAc_ac_c* actor = fopAcM_SearchByID(i_this->mCreatedItemId); + if (actor != NULL) { + cLib_addCalc2(&i_this->m2EAC.x, actor->current.pos.x, 0.1f, 100.0f); + cLib_addCalc2(&i_this->m2EAC.y, actor->current.pos.y, 0.1f, 100.0f); + cLib_addCalc2(&i_this->m2EAC.z, actor->current.pos.z, 0.1f, 100.0f); + i_this->m2EC8 = REG0_F(4) + 55.0f; + } + if (i_this->msFrameCount == 170) { + camera->mCamera.SetTrimSize(0); + camera->mCamera.Start(); + dMeter_mtrShow(); + dComIfGp_event_reset(); + i_this->m2E9A = 0; + i_this->m2E7C = 100; + i_this->m2E98 = 1; + } + break; } - - if ((i_this->field_0x2E9A != 0) && bVar2) { - f32 x = i_this->field_0x2ECC * cM_ssin(i_this->msFrameCount * 0x3300); - f32 y = i_this->field_0x2ECC * cM_scos(i_this->msFrameCount * 0x3000); - f32 z = i_this->field_0x2ECC * cM_scos(i_this->msFrameCount * 0x3500); - + } + if ((i_this->m2E9A != 0) && bVar2) { + f32 x = i_this->m2ECC * cM_ssin(i_this->msFrameCount * 0x3300); + f32 y = i_this->m2ECC * cM_scos(i_this->msFrameCount * 0x3000); + f32 z = i_this->m2ECC * cM_scos(i_this->msFrameCount * 0x3500); cXyz camera_center; - camera_center.x = i_this->field_0x2EA0.x + x; - camera_center.y = i_this->field_0x2EA0.y + y; - camera_center.z = i_this->field_0x2EA0.z + z; + camera_center.x = i_this->m2EA0.x + x; + camera_center.y = i_this->m2EA0.y + y; + camera_center.z = i_this->m2EA0.z + z; cXyz camera_eye; - camera_eye.x = i_this->field_0x2EAC.x - x; - camera_eye.y = i_this->field_0x2EAC.y - y; - camera_eye.z = i_this->field_0x2EAC.z - z; - - s16 bank = 7.5f * i_this->field_0x2ECC * cM_scos(i_this->field_0x10D4 * 0x1C00); - camera->mCamera.Set( - camera_center, - camera_eye, - bank, - i_this->field_0x2EC8 - ); - cLib_addCalc0(&i_this->field_0x2ECC, 1.0f, 1.0f); - - JUTReport(0x19a, 0x1ae, "K SUB COUNT %d", i_this->msFrameCount); + camera_eye.x = i_this->m2EAC.x - x; + camera_eye.y = i_this->m2EAC.y - y; + camera_eye.z = i_this->m2EAC.z - z; + s16 bank = 7.5f * i_this->m2ECC * cM_scos(i_this->mUpdateLastFacingDirIfMultipleOf32 * 0x1C00); + camera->mCamera.Set(camera_center, camera_eye, bank, i_this->m2EC8); + cLib_addCalc0(&i_this->m2ECC, 1.0f, 1.0f); + JUTReport(410, 430, "K SUB COUNT %d", i_this->msFrameCount); i_this->msFrameCount++; } } /* 00009FCC-0000A1A4 .text bst_kankyo__FP9bst_class */ void bst_kankyo(bst_class* i_this) { - /* Nonmatching */ + /* Nonmatching - .data */ switch (i_this->mRoomState) { - case 0: - dKy_custom_colset(3, 0, 0.0f); - break; - case 1: - dKy_custom_colset(3, 0, i_this->field_0x2ED0); - cLib_addCalc2(&i_this->field_0x2ED0, 1.0f, 1.0f, 0.1f); - break; - case 2: - dKy_custom_colset(0, 4, i_this->field_0x2ED0); - cLib_addCalc2(&i_this->field_0x2ED0, 1.0f, 1.0f, 0.25f); - break; - case 3: - dKy_custom_colset(3, 4, i_this->field_0x2ED0); - cLib_addCalc0(&i_this->field_0x2ED0, 1.0f, 0.019999999552965164f); - break; - case 4: - dKy_custom_colset(5, 3, i_this->field_0x2ED0); - cLib_addCalc0(&i_this->field_0x2ED0, 1.0f, 0.05000000074505806f); - break; - case 5: - dKy_custom_colset(1, 3, i_this->field_0x2ED0); - cLib_addCalc0(&i_this->field_0x2ED0, 1.0f, 0.10000000149011612f); - break; - case 6: - dKy_custom_colset(1, 2, i_this->field_0x2ED0); - cLib_addCalc2(&i_this->field_0x2ED0, 1.0f, 1.0f, 0.5f); - if (i_this->field_0x2ED0 >= 1.0f) { - i_this->mRoomState = 7; - } - break; - case 7: - dKy_custom_colset(1, 2, i_this->field_0x2ED0); - cLib_addCalc0(&i_this->field_0x2ED0, 1.0f, 0.5f); - break; - case 8: - dKy_custom_colset(1, 0, i_this->field_0x2ED0); - cLib_addCalc2(&i_this->field_0x2ED0, 1.0f, 1.0f, 0.1f); - if (i_this->field_0x2ED0 >= 1.0f) { - i_this->mRoomState = 1; - } - break; + case 0: + dKy_custom_colset(3, 0, 0.0f); + break; + case 1: + dKy_custom_colset(3, 0, i_this->m2ED0); + cLib_addCalc2(&i_this->m2ED0, 1.0f, 1.0f, 0.1f); + break; + case 2: + dKy_custom_colset(0, 4, i_this->m2ED0); + cLib_addCalc2(&i_this->m2ED0, 1.0f, 1.0f, 0.25f); + break; + case 3: + dKy_custom_colset(3, 4, i_this->m2ED0); + cLib_addCalc0(&i_this->m2ED0, 1.0f, 0.02f); + break; + case 4: + dKy_custom_colset(5, 3, i_this->m2ED0); + cLib_addCalc0(&i_this->m2ED0, 1.0f, 0.05f); + break; + case 5: + dKy_custom_colset(1, 0, i_this->m2ED0); + cLib_addCalc0(&i_this->m2ED0, 1.0f, 0.1f); + break; + case 6: + dKy_custom_colset(1, 2, i_this->m2ED0); + cLib_addCalc2(&i_this->m2ED0, 1.0f, 1.0f, 0.5f); + if (i_this->m2ED0 >= 1.0f) { + i_this->mRoomState = 7; + } + break; + case 7: + dKy_custom_colset(1, 2, i_this->m2ED0); + cLib_addCalc0(&i_this->m2ED0, 1.0f, 0.5f); + break; + case 8: + dKy_custom_colset(1, 0, i_this->m2ED0); + cLib_addCalc2(&i_this->m2ED0, 1.0f, 1.0f, 0.1f); + if (i_this->m2ED0 >= 1.0f) { + i_this->mRoomState = 1; + } + break; } } /* 0000A1A4-0000A9C8 .text daBst_Execute__FP9bst_class */ static BOOL daBst_Execute(bst_class* i_this) { - /* Nonmatching */ + /* Nonmatching - "unk" variables */ + fopAc_ac_c* actor = &i_this->actor; fopAc_ac_c* player = dComIfGp_getPlayer(0); cXyz vec; - - i_this->field_0x10D4++; - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->field_0x10FC); i++) { - if (i_this->field_0x10FC[i] != 0) { - i_this->field_0x10FC[i]--; + vec.setall(0.0f); + i_this->mUpdateLastFacingDirIfMultipleOf32++; + for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m10FC); i++) { + if (i_this->m10FC[i] != 0) { + i_this->m10FC[i]--; } } - if (i_this->mState != 0) { i_this->mState--; } @@ -2053,144 +2602,115 @@ static BOOL daBst_Execute(bst_class* i_this) { if (i_this->mHeadHurtAngle != 0) { i_this->mHeadHurtAngle--; } - if (i_this->field_0x112A != 0) { - i_this->field_0x112A--; + if (i_this->m112A != 0) { + i_this->m112A--; } - if (i_this->field_0x112C != 0) { - i_this->field_0x112C--; + if (i_this->m112C != 0) { + i_this->m112C--; } if (i_this->mStateTimer != 0) { i_this->mStateTimer--; } - - if (l_HIO.field_0x5 == 0) { - i_this->attention_info.flags = fopAc_Attn_LOCKON_BATTLE_e; - if (i_this->field_0x02B4 == 0) { - if (i_this->field_0x2FE4 != 0) { + if (l_HIO.m5 == 0) { + actor->attention_info.flags = fopAc_Attn_LOCKON_BATTLE_e; + if (i_this->mBstPartType == bst_class::Type_HEAD_e) { + if (i_this->m2FE4 != 0) { dCam_getBody()->SetTypeForce("Test01", NULL); } main_cont(i_this); - if (i_this->field_0x10D6 != 7) { - fopAcM_OffStatus(i_this, 0); - i_this->attention_info.flags = 0; + if (i_this->mActionType != bst_class::ACTION_HEAD_DAMAGE_e) { + fopAcM_OffStatus(actor, 0); + actor->attention_info.flags = 0; } - - if (i_this->field_0x10D6 != 0xE) { - // while loop around 0x2ED8 + if (i_this->mActionType != bst_class::ACTION_BEAM_ATTACK_e) { + for (s32 i = 0; i < 2; i++) { + if (i_this->m2ED8[i] != 0) { + i_this->m2ED8[i]->becomeInvalidEmitter(); + i_this->m2ED8[i] = NULL; + } + } if (i_this->mRoomState == 7) { i_this->mRoomState = 8; } } - - if (player->current.pos.y > -150.0f) { - i_this->field_0x2FD8->setPlayMode(J3DFrameCtrl::EMode_NONE); + if (player->current.pos.y <= -150.0f) { + i_this->m2FD8->setPlaySpeed(1.0f); + i_this->m2FD8->setPlayMode(J3DFrameCtrl::EMode_LOOP); } else { - i_this->field_0x2FD8->setPlaySpeed(1.0f); - i_this->field_0x2FD8->setPlayMode(J3DFrameCtrl::EMode_LOOP); + i_this->m2FD8->setPlayMode(J3DFrameCtrl::EMode_NONE); } - - i_this->field_0x2FE0->play(); - i_this->field_0x2FD8->play(); - i_this->field_0x2FD4->play(); + i_this->m2FE0->play(); + i_this->m2FD8->play(); + i_this->m2FD4->play(); mDoMtx_stack_c::transS(0.0f, 0.0f, 0.0f); - i_this->field_0x2FD0->setBaseTRMtx(mDoMtx_stack_c::now); - i_this->field_0x2FDC->setBaseTRMtx(mDoMtx_stack_c::now); + i_this->m2FD0->setBaseTRMtx(mDoMtx_stack_c::now); + i_this->m2FDC->setBaseTRMtx(mDoMtx_stack_c::now); } - move(i_this); - if (i_this->field_0x10D6 != 0 && i_this->field_0x10D6 != 0x16) { + if (i_this->mActionType != 0 && i_this->mActionType != bst_class::ACTION_END_DEMO_e) { i_this->mBgS_Acch.CrrPos(*dComIfG_Bgsp()); i_this->mBgS_Acch.SetGroundUpY(0.0f); } - i_this->field_0x02B8->play(&i_this->eyePos, 0, 0); - if (i_this->field_0x02C4 != 0) { + i_this->m02B8->play(&actor->eyePos, 0, 0); + if (i_this->m02C4 != 0) { i_this->mpTevRegAnimator->play(); i_this->mpTexMtxAnimator->play(); } - if (i_this->field_0x02D4 != 0) { + if (i_this->m02D4 != 0) { i_this->mpBrkAnm->play(); i_this->mpBtkAnm->play(); } } - - f32 unk1 = i_this->field_0x10EC.z * cM_ssin( - i_this->field_0x10D4 * (REG0_S(6) + 700) - ); - f32 unk2 = i_this->field_0x10EC.z * cM_ssin( - i_this->field_0x10D4 * (REG0_S(6) + 750) - ); - f32 unk3 = i_this->field_0x10EC.z * cM_scos( - i_this->field_0x10D4 * (REG0_S(6) + 720) - ); - cLib_addCalc0(&i_this->field_0x10EC.z, 1.0f, 1.0f); - i_this->field_0x02B8->getModel()->setBaseScale(i_this->scale); - - mDoMtx_stack_c::transS(i_this->current.pos.x + unk1, - i_this->current.pos.y + unk2, - i_this->current.pos.z + unk3); - - f32 unk4 = i_this->mHeadHurtAngle * (REG0_F(14) + 500.0f) * - cM_ssin(i_this->field_0x10D4 * 0x2100); - f32 unk5 = i_this->mHeadHurtAngle * (REG0_F(14) + 500.0f) * - cM_scos(i_this->field_0x10D4 * 0x2300); - - f32 unk6 = i_this->field_0x112A * (REG0_F(14) + 150.0f) * - cM_ssin(boss->field_0x10D4 * 0x3600); - f32 unk7 = i_this->field_0x112A * (REG0_F(14) + 150.0f) * - cM_scos(boss->field_0x10D4 * 0x4300); - f32 unk8 = i_this->field_0x112C * (REG0_F(14) + 100.0f) * - cM_scos(boss->field_0x10D4 * 0x3A00); - - cLib_addCalc0(&i_this->field_0x10F8, 1.0f, REG0_F(3) + 30.0f); - mDoMtx_stack_c::YrotM(i_this->shape_angle.y + (s16)unk4 + (s16)unk6); - mDoMtx_stack_c::XrotM(i_this->shape_angle.x + (s16)unk5 + (s16)unk7 + (s16)unk8); - mDoMtx_stack_c::ZrotM(i_this->shape_angle.z); - mDoMtx_stack_c::transM( - REG0_F(5) + i_this->field_0x1110, - REG0_F(6) + i_this->field_0x1114, - REG0_F(7) + i_this->field_0x1118 - ); - - cLib_addCalc0(&i_this->field_0x1110, 1.0f, 5.0f); - cLib_addCalc0(&i_this->field_0x1114, 1.0f, 10.0f); - cLib_addCalc0(&i_this->field_0x1118, 1.0f, 5.0f); - - i_this->field_0x02B8->getModel()->setBaseTRMtx(mDoMtx_stack_c::now); - i_this->field_0x0388->setBaseTRMtx(mDoMtx_stack_c::now); - - i_this->field_0x02B8->calc(); - - MtxTrans(i_this->home.pos.x, i_this->home.pos.y, i_this->home.pos.z, FALSE); - mDoMtx_YrotM(*calc_mtx, i_this->home.angle.y); - mDoMtx_XrotM(*calc_mtx, i_this->home.angle.x); - mDoMtx_ZrotM(*calc_mtx, i_this->home.angle.z); - i_this->field_0x02C8->setBaseTRMtx(*calc_mtx); - + f32 unk1 = i_this->m10EC.z * cM_ssin(i_this->mUpdateLastFacingDirIfMultipleOf32 * (REG0_S(6) + 700)); + f32 unk2 = i_this->m10EC.z * cM_ssin(i_this->mUpdateLastFacingDirIfMultipleOf32 * (REG0_S(6) + 750)); + f32 unk3 = i_this->m10EC.z * cM_scos(i_this->mUpdateLastFacingDirIfMultipleOf32 * (REG0_S(6) + 720)); + cLib_addCalc0(&i_this->m10EC.z, 1.0f, 1.0f); + i_this->m02B8->getModel()->setBaseScale(actor->scale); + mDoMtx_stack_c::transS(actor->current.pos.x + unk1, actor->current.pos.y + unk2, actor->current.pos.z + unk3); + s16 unk4 = i_this->mHeadHurtAngle * (REG0_F(14) + 500.0f) * cM_ssin(i_this->mUpdateLastFacingDirIfMultipleOf32 * 0x2100); + s16 unk5 = i_this->mHeadHurtAngle * (REG0_F(14) + 500.0f) * cM_scos(i_this->mUpdateLastFacingDirIfMultipleOf32 * 0x2300); + s16 unk6 = i_this->m112A * (REG0_F(14) + 150.0f) * cM_ssin(boss->mUpdateLastFacingDirIfMultipleOf32 * 0x3600); + s16 unk7 = i_this->m112A * (REG0_F(14) + 150.0f) * cM_scos(boss->mUpdateLastFacingDirIfMultipleOf32 * 0x4300); + s16 unk8 = i_this->m112C * (REG0_F(14) + 100.0f) * cM_scos(boss->mUpdateLastFacingDirIfMultipleOf32 * 0x3A00); + cLib_addCalc0(&i_this->m10F8, 1.0f, REG0_F(3) + 30.0f); + mDoMtx_stack_c::YrotM(actor->shape_angle.y + unk4 + unk6); + mDoMtx_stack_c::XrotM(actor->shape_angle.x + unk5 + unk7 + unk8); + mDoMtx_stack_c::ZrotM(actor->shape_angle.z); + mDoMtx_stack_c::transM(REG0_F(5) + i_this->m1110, REG0_F(6) + i_this->m1114, REG0_F(7) + i_this->m1118); + cLib_addCalc0(&i_this->m1110, 1.0f, 5.0f); + cLib_addCalc0(&i_this->m1114, 1.0f, 10.0f); + cLib_addCalc0(&i_this->m1118, 1.0f, 5.0f); + i_this->m02B8->getModel()->setBaseTRMtx(mDoMtx_stack_c::now); + i_this->m0388->setBaseTRMtx(mDoMtx_stack_c::now); + i_this->m02B8->calc(); + MtxTrans(actor->home.pos.x, actor->home.pos.y, actor->home.pos.z, FALSE); + mDoMtx_YrotM(*calc_mtx, actor->home.angle.y); + mDoMtx_XrotM(*calc_mtx, actor->home.angle.x); + mDoMtx_ZrotM(*calc_mtx, actor->home.angle.z); + i_this->m02C8->setBaseTRMtx(*calc_mtx); col_set(i_this); - if (i_this->field_0x02B4 == 0) { + if (i_this->mBstPartType == bst_class::Type_HEAD_e) { beam_move(i_this); demo_camera(i_this); bst_kankyo(i_this); message_cont(i_this); - for (s32 j = 0; j < 2; j++) { - fpc_ProcID proc_id = i_this->field_0x2E90[j]; - fopAc_ac_c* actor = (fopAc_ac_c*) fopAcM_SearchByID(proc_id); + fpc_ProcID proc_id = i_this->m2E90[j]; + fopAc_ac_c* actor = (fopAc_ac_c*)fopAcM_SearchByID(proc_id); if (actor != NULL) { - mDoMtx_copy(i_this->field_0x02B8->getModel()->getAnmMtx(j + 4), *calc_mtx); + mDoMtx_copy(i_this->m02B8->getModel()->getAnmMtx(j + 4), *calc_mtx); MtxPosition(&vec, &actor->current.pos); actor->max_health = 2; actor->health = i_this->mEyeHealth[j]; - - if (i_this->mEyeHealth[j] > 0 && i_this->field_0x10D6 != 7) { + if (i_this->m2E74[j] == 0 && i_this->mEyeHealth[j] > 0 && i_this->mActionType != bst_class::ACTION_HEAD_DAMAGE_e && + i_this->mActionType != bst_class::ACTION_END_DEMO_e) + { actor->attention_info.flags = fopAc_Attn_LOCKON_BATTLE_e; actor->attention_info.distances[fopAc_Attn_TYPE_BATTLE_e] = 4; - - fopAcM_seStart(i_this, JA_SE_CM_BST_HEAD_WORKING, 0); + fopAcM_seStart(actor, JA_SE_CM_BST_HEAD_WORKING, 0); continue; } - - fopAcM_OffStatus(i_this, 0); + fopAcM_OffStatus(actor, 0); actor->attention_info.flags = 0; } } @@ -2207,36 +2727,32 @@ static BOOL daBst_Delete(bst_class* i_this) { dComIfG_resDelete(&i_this->mPhs, "Bst"); if (i_this->mHioSet != 0) { hio_set = 0; - mDoHIO_deleteChild(l_HIO.field_0x4); + mDoHIO_deleteChild(l_HIO.m4); } - - if (i_this->field_0x02B4 == 0) { - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->field_0x2E90); i++) { - fopAc_ac_c* actor = (fopAc_ac_c*) fopAcM_SearchByID(i_this->field_0x2E90[i]); + if (i_this->mBstPartType == bst_class::Type_HEAD_e) { + for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m2E90); i++) { + fopAc_ac_c* actor = (fopAc_ac_c*)fopAcM_SearchByID(i_this->m2E90[i]); if (actor != NULL) { fopAcM_delete(actor); } } } i_this->mPa_smokeEcallBack.remove(); - - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->field_0x03B8); i++) { - mDoAud_seDeleteObject(&i_this->field_0x03B8[i]); + for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m03B8); i++) { + mDoAud_seDeleteObject(&i_this->m03B8[i]); } - return TRUE; } /* 0000AADC-0000B2D0 .text useHeapInit__FP10fopAc_ac_c */ static BOOL useHeapInit(fopAc_ac_c* a_this) { - /* Nonmatching */ - bst_class* i_this = (bst_class*) a_this; - - i_this->field_0x02B8 = new mDoExt_McaMorf( - (J3DModelData*) dComIfG_getObjectRes("Bst", set_bdl_d[i_this->field_0x02B4]), + /* Nonmatching - .data */ + bst_class* i_this = (bst_class*)a_this; + i_this->m02B8 = new mDoExt_McaMorf( + (J3DModelData*)dComIfG_getObjectRes("Bst", set_bdl_d[i_this->mBstPartType]), NULL, NULL, - (J3DAnmTransformKey*) dComIfG_getObjectRes("Bst", set_bck_d[i_this->field_0x02B4]), + (J3DAnmTransformKey*)dComIfG_getObjectRes("Bst", set_bck_d[i_this->mBstPartType]), J3DFrameCtrl::EMode_LOOP, 1.0f, 0, @@ -2246,52 +2762,37 @@ static BOOL useHeapInit(fopAc_ac_c* a_this) { 0, 0x11020203 ); - if (i_this->field_0x02B8 == NULL || i_this->field_0x02B8->getModel() == NULL) { + if (i_this->m02B8 == NULL || i_this->m02B8->getModel() == NULL) { return FALSE; } - - if (i_this->field_0x02B4 == 0) { - for (u16 i = 0; i < i_this->field_0x02B8->getModel()->getModelData()->getJointNum(); i++) { + if (i_this->mBstPartType == bst_class::Type_HEAD_e) { + for (u16 i = 0; i < i_this->m02B8->getModel()->getModelData()->getJointNum(); i++) { if (i >= 9 && i <= 12) { - i_this->field_0x02B8->getModel()->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBackHead); + i_this->m02B8->getModel()->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBackHead); } } - i_this->field_0x02B8->getModel()->setUserArea((u32)i_this); + i_this->m02B8->getModel()->setUserArea((u32)i_this); } - - i_this->field_0x0388 = mDoExt_J3DModel__create( - i_this->field_0x02B8->getModel()->getModelData(), 0, 0x11020203); - if (i_this->field_0x0388 == NULL) { + i_this->m0388 = mDoExt_J3DModel__create(i_this->m02B8->getModel()->getModelData(), 0, 0x11020203); + if (i_this->m0388 == NULL) { return FALSE; } - i_this->mpTexMtxAnimator = new mDoExt_btkAnm(); if (i_this->mpTexMtxAnimator == NULL) { return FALSE; } - J3DAnmTextureSRTKey* key = (J3DAnmTextureSRTKey*) dComIfG_getObjectRes("Bst", set_btk_d[i_this->field_0x02B4]); - s32 res = i_this->mpTexMtxAnimator->init( - i_this->field_0x02B8->getModel()->getModelData(), - key, - TRUE, - J3DFrameCtrl::EMode_NONE, - 1.0f, - 0, - -1, - false, - FALSE - ); + J3DAnmTextureSRTKey* key = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bst", set_btk_d[i_this->mBstPartType]); + s32 res = i_this->mpTexMtxAnimator->init(i_this->m02B8->getModel()->getModelData(), key, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, false, FALSE); if (res == 0) { return FALSE; } - i_this->mpTevRegAnimator = new mDoExt_brkAnm(); if (i_this->mpTevRegAnimator == NULL) { return FALSE; } res = i_this->mpTevRegAnimator->init( - i_this->field_0x02B8->getModel()->getModelData(), - (J3DAnmTevRegKey*) dComIfG_getObjectRes("Bst", set_brk_d[i_this->field_0x02B4]), + i_this->m02B8->getModel()->getModelData(), + (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bst", set_brk_d[i_this->mBstPartType]), TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, @@ -2303,101 +2804,67 @@ static BOOL useHeapInit(fopAc_ac_c* a_this) { if (res == 0) { return FALSE; } - - if (i_this->field_0x02B4 == 0) { - J3DModelData* modelData = (J3DModelData*) dComIfG_getObjectRes("Bst", BST_BDL_TAMA); - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->field_0x0390); i++) { - i_this->field_0x0390[i] = mDoExt_J3DModel__create( - modelData, 0, 0x11020203); - if (i_this->field_0x0390[i] == NULL) { + if (i_this->mBstPartType == bst_class::Type_HEAD_e) { + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Bst", BST_BDL_TAMA); + for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m0390); i++) { + i_this->m0390[i] = mDoExt_J3DModel__create(modelData, 0, 0x11020203); + if (i_this->m0390[i] == NULL) { return FALSE; } } - - modelData = (J3DModelData*) dComIfG_getObjectRes("Bst", BST_BDL_HBSITA1); - i_this->field_0x2FD0 = mDoExt_J3DModel__create(modelData, 0, 0x11020203); - if (i_this->field_0x2FD0 == NULL) { + modelData = (J3DModelData*)dComIfG_getObjectRes("Bst", BST_BDL_HBSITA1); + i_this->m2FD0 = mDoExt_J3DModel__create(modelData, 0, 0x11020203); + if (i_this->m2FD0 == NULL) { return FALSE; } - - i_this->field_0x2FD4 = new mDoExt_btkAnm(); - if (i_this->field_0x2FD4 == NULL) { + i_this->m2FD4 = new mDoExt_btkAnm(); + if (i_this->m2FD4 == NULL) { return FALSE; } - - res = i_this->field_0x2FD4->init( - modelData, - (J3DAnmTextureSRTKey*) dComIfG_getObjectRes("Bst", BST_BTK_HBSITA1), - TRUE, - J3DFrameCtrl::EMode_LOOP, - 1.0f, - 0, - -1, - false, - FALSE + res = i_this->m2FD4->init( + modelData, (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bst", BST_BTK_HBSITA1), TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, false, FALSE ); if (res == 0) { return FALSE; } - - i_this->field_0x2FD8 = new mDoExt_brkAnm(); - if (i_this->field_0x2FD8 == NULL) { + i_this->m2FD8 = new mDoExt_brkAnm(); + if (i_this->m2FD8 == NULL) { return FALSE; } - res = i_this->field_0x2FD8->init( - modelData, - (J3DAnmTevRegKey*) dComIfG_getObjectRes("Bst", BST_BRK_HBSITA1), - TRUE, - J3DFrameCtrl::EMode_NONE, - 0.0f, - 0, - -1, - false, - FALSE + res = i_this->m2FD8->init( + modelData, (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bst", BST_BRK_HBSITA1), TRUE, J3DFrameCtrl::EMode_NONE, 0.0f, 0, -1, false, FALSE ); if (res == 0) { return FALSE; } - - modelData = (J3DModelData*) dComIfG_getObjectRes("Bst", BST_BDL_HBYOKO1); - i_this->field_0x2FDC = mDoExt_J3DModel__create(modelData, 0, 0x11020203); - if (i_this->field_0x2FDC == NULL) { + modelData = (J3DModelData*)dComIfG_getObjectRes("Bst", BST_BDL_HBYOKO1); + i_this->m2FDC = mDoExt_J3DModel__create(modelData, 0, 0x11020203); + if (i_this->m2FDC == NULL) { return FALSE; } - - i_this->field_0x2FE0 = new mDoExt_brkAnm(); - if (i_this->field_0x2FE0 == NULL) { + i_this->m2FE0 = new mDoExt_brkAnm(); + if (i_this->m2FE0 == NULL) { return FALSE; } - res = i_this->field_0x2FE0->init( - modelData, - (J3DAnmTevRegKey*) dComIfG_getObjectRes("Bst", BST_BRK_HBYOKO1), - TRUE, - J3DFrameCtrl::EMode_LOOP, - 1.0f, - 0, - -1, - false, - FALSE + res = i_this->m2FE0->init( + modelData, (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bst", BST_BRK_HBYOKO1), TRUE, J3DFrameCtrl::EMode_LOOP, 0.0f, 0, -1, false, FALSE ); if (res == 0) { return FALSE; } } - - J3DModelData* modelData = (J3DModelData*) dComIfG_getObjectRes("Bst", set_za_bdl[i_this->field_0x02B4]); - i_this->field_0x02C8 = mDoExt_J3DModel__create(modelData, 0, 0x11020203); - if (i_this->field_0x02C8 == NULL) { + J3DModelData* modelData = static_cast(dComIfG_getObjectRes("Bst", set_za_bdl[i_this->mBstPartType])); + i_this->m02C8 = mDoExt_J3DModel__create(modelData, 0, 0x11020203); + if (i_this->m02C8 == NULL) { return FALSE; } - i_this->mpBtkAnm = new mDoExt_btkAnm(); if (i_this->mpBtkAnm == NULL) { return FALSE; } res = i_this->mpBtkAnm->init( modelData, - (J3DAnmTextureSRTKey*) dComIfG_getObjectRes("Bst", set_za_btk_d[i_this->field_0x02B4]), + (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bst", set_za_btk_d[i_this->mBstPartType]), TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, @@ -2409,32 +2876,21 @@ static BOOL useHeapInit(fopAc_ac_c* a_this) { if (res == 0) { return FALSE; } - i_this->mpBrkAnm = new mDoExt_brkAnm(); if (i_this->mpBrkAnm == NULL) { return FALSE; } res = i_this->mpBrkAnm->init( - modelData, - (J3DAnmTevRegKey*) dComIfG_getObjectRes("Bst", set_za_brk_d[i_this->field_0x02B4]), - TRUE, - J3DFrameCtrl::EMode_NONE, - 1.0f, - 0, - -1, - false, - FALSE + modelData, (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bst", set_za_brk_d[i_this->mBstPartType]), TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, false, FALSE ); if (res == 0) { return FALSE; } - return TRUE; } /* 0000B318-0000B860 .text daBst_Create__FP10fopAc_ac_c */ static cPhs_State daBst_Create(fopAc_ac_c* a_this) { - /* Nonmatching */ static dCcD_SrcCyl cc_cyl_src = { // dCcD_SrcGObjInf { @@ -2471,7 +2927,8 @@ static cPhs_State daBst_Create(fopAc_ac_c* a_this) { /* SrcObjAt Type */ 0, /* SrcObjAt Atp */ 0, /* SrcObjAt SPrm */ 0, - /* SrcObjTg Type */ AT_TYPE_ALL & ~AT_TYPE_BOOMERANG & ~AT_TYPE_WATER & ~AT_TYPE_UNK20000 & ~AT_TYPE_WIND & ~AT_TYPE_UNK400000 & ~AT_TYPE_LIGHT & ~AT_TYPE_GRAPPLING_HOOK, + /* SrcObjTg Type */ AT_TYPE_ALL & ~AT_TYPE_BOOMERANG & ~AT_TYPE_WATER & ~AT_TYPE_UNK20000 & ~AT_TYPE_WIND & ~AT_TYPE_UNK400000 & + ~AT_TYPE_LIGHT & ~AT_TYPE_GRAPPLING_HOOK, /* SrcObjTg SPrm */ cCcD_TgSPrm_Set_e | cCcD_TgSPrm_IsEnemy_e, /* SrcObjCo SPrm */ cCcD_CoSPrm_Set_e | cCcD_CoSPrm_IsPlayer_e | cCcD_CoSPrm_VsOther_e, /* SrcGObjAt Se */ 0, @@ -2528,7 +2985,8 @@ static cPhs_State daBst_Create(fopAc_ac_c* a_this) { /* SrcObjAt Type */ 0, /* SrcObjAt Atp */ 0, /* SrcObjAt SPrm */ 0, - /* SrcObjTg Type */ AT_TYPE_ALL & ~AT_TYPE_BOOMERANG & ~AT_TYPE_WATER & ~AT_TYPE_UNK20000 & ~AT_TYPE_WIND & ~AT_TYPE_UNK400000 & ~AT_TYPE_LIGHT & ~AT_TYPE_GRAPPLING_HOOK, + /* SrcObjTg Type */ AT_TYPE_ALL & ~AT_TYPE_BOOMERANG & ~AT_TYPE_WATER & ~AT_TYPE_UNK20000 & ~AT_TYPE_WIND & ~AT_TYPE_UNK400000 & + ~AT_TYPE_LIGHT & ~AT_TYPE_GRAPPLING_HOOK, /* SrcObjTg SPrm */ cCcD_TgSPrm_Set_e | cCcD_TgSPrm_IsEnemy_e, /* SrcObjCo SPrm */ 0, /* SrcGObjAt Se */ 0, @@ -2579,78 +3037,60 @@ static cPhs_State daBst_Create(fopAc_ac_c* a_this) { }; fopAcM_SetupActor(a_this, bst_class); - cPhs_State res; - bst_class* i_this = (bst_class*) a_this; - + bst_class* i_this = (bst_class*)a_this; + fopAc_ac_c* actor = &i_this->actor; res = dComIfG_resLoad(&i_this->mPhs, "Bst"); if (res == cPhs_COMPLEATE_e) { i_this->mPa_smokeEcallBack.setFollowOff(); - i_this->field_0x02B4 = fopAcM_GetParam(i_this) & 0xFF; - - if (!fopAcM_entrySolidHeap(i_this, useHeapInit, 0x96000)) { + i_this->mBstPartType = fopAcM_GetParam(i_this) & 0xFF; + if (!fopAcM_entrySolidHeap(actor, useHeapInit, 0x96000)) { return cPhs_ERROR_e; } - - i_this->attention_info.flags = fopAc_Attn_LOCKON_BATTLE_e; - i_this->attention_info.distances[fopAc_Attn_TYPE_BATTLE_e] = 4; + actor->attention_info.flags = fopAc_Attn_LOCKON_BATTLE_e; + actor->attention_info.distances[fopAc_Attn_TYPE_BATTLE_e] = 4; if (hio_set == 0) { i_this->mHioSet = 1; hio_set = 1; - // Possible bug: why is "Armos Knight" here? - l_HIO.field_0x4 = mDoHIO_createChild("デグアモス", &l_HIO); + l_HIO.m4 = mDoHIO_createChild("デグアモス", &l_HIO); } - - i_this->mBgS_Acch.Set(&i_this->current.pos, &i_this->old.pos, i_this, - 1, &i_this->mBgS_AcchCir, &i_this->speed); + i_this->mBgS_Acch.Set(&actor->current.pos, &actor->old.pos, actor, 1, &i_this->mBgS_AcchCir, &actor->speed); i_this->mBgS_Acch.OffSameActorChk(); - i_this->mBgS_AcchCir.SetWall(200.0f, 10.0f); - - if (i_this->field_0x02B4 == 0) { + if (i_this->mBstPartType == bst_class::Type_HEAD_e) { boss = i_this; msg = fpcM_ERROR_PROCESS_ID_e; } - if (i_this->field_0x02B4 == 1) { + if (i_this->mBstPartType == bst_class::Type_LEFT_HAND_e) { hand[0] = i_this; } - if (i_this->field_0x02B4 == 2) { + if (i_this->mBstPartType == bst_class::Type_RIGHT_HAND_e) { hand[1] = i_this; } - u8 weight; - if (i_this->field_0x02B4 == 0) { + if (i_this->mBstPartType == bst_class::Type_HEAD_e) { weight = 255; } else { weight = 230; } - i_this->mCcD_Stts.Init(weight, 0xFF, i_this); + i_this->mCcD_Stts.Init(weight, 0xFF, actor); i_this->mHandHurtCollisionCcD_Cyl.Set(core_cyl_src); i_this->mHandHurtCollisionCcD_Cyl.SetStts(&i_this->mCcD_Stts); - - if (i_this->field_0x02B4 == 0) { + if (i_this->mBstPartType == bst_class::Type_HEAD_e) { i_this->mHeadHurtCollisionCcD_Cyl.Set(cc_cyl_src); i_this->mHeadHurtCollisionCcD_Cyl.SetStts(&i_this->mCcD_Stts); - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->mBstEyeCcD_Spheres); i++) { i_this->mBstEyeCcD_Spheres[i].Set(eye_sph_src); i_this->mBstEyeCcD_Spheres[i].SetStts(&i_this->mCcD_Stts); } - - i_this->health = 3; - i_this->max_health = 3; + actor->health = 3; + actor->max_health = 3; i_this->mEyeHealth[1] = 2; i_this->mEyeHealth[0] = 2; - - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->field_0x2E90); i++) { - i_this->field_0x2E90[i] = fopAcM_create( - PROC_ATT, - 100, - &i_this->current.pos, - i_this->current.roomNo); + for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m2E90); i++) { + i_this->m2E90[i] = fopAcM_create(PROC_ATT, 100, &actor->current.pos, actor->current.roomNo); } - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->mCcD_beams); i++) { i_this->mCcD_beams[i].Set(beam_sph_src); i_this->mCcD_beams[i].SetStts(&i_this->mCcD_Stts); @@ -2660,15 +3100,14 @@ static cPhs_State daBst_Create(fopAc_ac_c* a_this) { i_this->mCcD_fingers[i].Set(finger_sph_src); i_this->mCcD_fingers[i].SetStts(&i_this->mCcD_Stts); } - i_this->health = 4; - i_this->max_health = 4; + actor->health = 4; + actor->max_health = 4; } } f32 fVar = cM_rndFX(32768.0f); - i_this->field_0x10D4 = fVar; - i_this->mEnvLight = i_this->tevStr; - i_this->field_0x2F20 = i_this->tevStr; - + i_this->mUpdateLastFacingDirIfMultipleOf32 = fVar; + i_this->mEnvLight = actor->tevStr; + i_this->m2F20 = actor->tevStr; return res; }