diff --git a/configure.py b/configure.py index 89a377481..9956055dc 100755 --- a/configure.py +++ b/configure.py @@ -1570,8 +1570,8 @@ config.libs = [ ActorRel(Matching, "d_a_bdk"), ActorRel(Matching, "d_a_bdkobj"), ActorRel(NonMatching, "d_a_bgn"), - ActorRel(NonMatching, "d_a_bgn2"), - ActorRel(NonMatching, "d_a_bgn3"), + ActorRel(MatchingFor("D44J01"), "d_a_bgn2"), + ActorRel(Matching, "d_a_bgn3"), ActorRel(NonMatching, "d_a_bigelf"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_bk"), ActorRel(NonMatching, "d_a_bl"), diff --git a/include/d/actor/d_a_bgn.h b/include/d/actor/d_a_bgn.h index db61e731b..96a060e41 100644 --- a/include/d/actor/d_a_bgn.h +++ b/include/d/actor/d_a_bgn.h @@ -7,78 +7,178 @@ #include "d/d_particle.h" struct part_s { - /* 0x000 */ u8 m000[0x004 - 0x000]; + /* 0x000 */ J3DModel* mpPartModel; /* 0x004 */ mDoExt_J3DModelPacketS m004; - /* 0x014 */ u8 m014[0x018 - 0x014]; - /* 0x018 */ J3DLightObj m018; - /* 0x08C */ u8 m08C[0x0F8 - 0x08C]; - /* 0x0F8 */ dCcD_Sph m0F8; - /* 0x224 */ u8 m224[0x23C - 0x224]; -}; // Size: 0x23C + /* 0x018 */ dKy_tevstr_c mPartTevStr; + /* 0x0C8 */ s16 m0C8; + /* 0x0C8 */ u8 m0CA[0x0CC - 0x0CA]; + /* 0x0CC */ f32 m0CC; + /* 0x0D0 */ s16 mPartArrowHitFlashTimer; + /* 0x0D2 */ s8 m0D2; + /* 0x0D3 */ u8 m0D3[0x0D4 - 0x0D3]; + /* 0x0D4 */ cXyz m0D4; + /* 0x0E0 */ csXyz m0E0; + /* 0x0E6 */ u8 m0E6[0x0F4 - 0x0E6]; + /* 0x0F4 */ f32 m0F4; + /* 0x0F8 */ dCcD_Sph mPartSph; + /* 0x224 */ cXyz m224; +#if VERSION > VERSION_DEMO + /* 0x230 */ JPABaseEmitter* mpPartArrowHitEmitter1; + /* 0x234 */ JPABaseEmitter* mpPartArrowHitEmitter2; + /* 0x238 */ s16 mPartArrowHitEffectTimer; + /* 0x23A */ u8 m23A[0x23C - 0x23A]; +#endif +}; // Size: 0x23C struct move_s { - /* 0x000 */ cXyz m000[60]; + struct bgn_himo_s { + /* 0x000 */ cXyz m000[60]; + }; + bgn_himo_s mHimo; /* 0x2D0 */ u8 m2D0; - /* 0x2D1 */ u8 m2D1[0x2EC - 0x2D1]; + /* 0x2D1 */ u8 m2D1[0x2D4 - 0x2D1]; + /* 0x2D4 */ cXyz m2D4; + /* 0x2E0 */ csXyz m2E0; + /* 0x2E6 */ u8 m2E6[0x2E8 - 0x2E6]; + /* 0x2E8 */ f32 m2E8; /* 0x2EC */ f32 m2EC; - /* 0x2F0 */ u8 m2F0[0x300 - 0x2F0]; + /* 0x2F0 */ u8 m2F0[0x2F4 - 0x2F0]; + /* 0x2F4 */ f32 m2F4; + /* 0x2F8 */ s16 m2F8; + /* 0x2FA */ s16 m2FA; + /* 0x2FC */ s16 m2FC; + /* 0x2FE */ s16 m2FE; /* 0x300 */ s16 m300; /* 0x302 */ u8 m302[0x304 - 0x302]; /* 0x304 */ f32 m304; /* 0x308 */ s8 m308; /* 0x309 */ u8 m309[0x30C - 0x309]; -}; // Size: 0x30C +}; // Size: 0x30C -class bgn_class : public fopAc_ac_c { -public: - /* 0x0290 */ u8 m0290[0x02B5 - 0x0290]; +struct bgn_class { + /* 0x0000 */ fopEn_enemy_c actor; + /* 0x02AC */ request_of_phase_process_class mPhase; + /* 0x02B4 */ u8 m02B4; /* 0x02B5 */ s8 m02B5; - /* 0x02B6 */ u8 m02B6[0x02C0 - 0x02B6]; + /* 0x02B6 */ u8 m02B6[0x02B8 - 0x02B6]; + /* 0x02B8 */ mDoExt_McaMorf* mpMorf; + /* 0x02BC */ J3DModel* mpChestModel; /* 0x02C0 */ mDoExt_J3DModelPacketS m02C0; - /* 0x02D0 */ u8 m02D0[0x0314 - 0x02D0]; - /* 0x0314 */ part_s m0314[2]; - /* 0x078C */ part_s m078C[2]; - /* 0x0C04 */ part_s m0C04[21]; - /* 0x3AF0 */ part_s m3AF0[21]; - /* 0x69DC */ part_s m69DC[4]; - /* 0x72CC */ part_s m72CC[4]; - /* 0x7BBC */ part_s m7BBC[21]; +#if VERSION > VERSION_DEMO + /* 0x02D4 */ JPABaseEmitter* mpArrowHitEmitter1; + /* 0x02D8 */ JPABaseEmitter* mpArrowHitEmitter2; + /* 0x02DC */ s16 mArrowHitEffectTimer; + /* 0x02DE */ u8 m02DE[0x02E0 - 0x02DE]; +#endif + /* 0x02E0 */ J3DModel* mpJyakutenCModel; // Weak point (1 hit left) + /* 0x02E4 */ J3DModel* mpJyakutenBModel; // Weak point (2 hits left) + /* 0x02E8 */ J3DModel* mpJyakutenAModel; // Weak point (3 hits left) + /* 0x02EC */ mDoExt_brkAnm* mJyakutenCBrkAnm; + /* 0x02F0 */ mDoExt_brkAnm* mJyakutenBBrkAnm; + /* 0x02F4 */ u8 m02F4[0x02F8 - 0x02F4]; + /* 0x02F8 */ s16 m02F8; + /* 0x02FA */ u8 m02FA[0x02FC - 0x02FA]; + /* 0x02FC */ f32 m02FC; + /* 0x0300 */ s16 mArrowHitFlashTimer; + /* 0x0302 */ s16 m0302; + /* 0x0304 */ s16 m0304; + /* 0x0306 */ u8 m0306[0x0308 - 0x0306]; + /* 0x0308 */ cXyz m0308; + /* 0x0314 */ part_s mHeadParts[2]; + /* 0x078C */ part_s mPelvisParts[2]; + /* 0x0C04 */ part_s mLeftArmParts[21]; + /* 0x3AF0 */ part_s mRightArmParts[21]; + /* 0x69DC */ part_s mLeftLegParts[4]; + /* 0x72CC */ part_s mRightLegParts[4]; + /* 0x7BBC */ part_s mTailParts[21]; /* 0xAAA8 */ move_s mAAA8[8]; - /* 0xC308 */ u8 mC308[0xC33C - 0xC308]; + /* 0xC308 */ cXyz mC308; + /* 0xC314 */ csXyz mC314; + /* 0xC31A */ s16 mC31A; + /* 0xC31C */ u8 mC31C[0xC324 - 0xC31C]; + /* 0xC324 */ f32 mC324[2]; + /* 0xC32C */ f32 mC32C[2]; + /* 0xC334 */ f32 mC334; + /* 0xC338 */ f32 mC338; /* 0xC33C */ cXyz mC33C[8]; - /* 0xC39C */ mDoExt_3DlineMat1_c mC39C; - /* 0xC3D8 */ mDoExt_3DlineMat1_c mC3D8; - /* 0xC414 */ mDoExt_3DlineMat1_c mC414; + /* 0xC39C */ mDoExt_3DlineMat1_c mBlueRopeMat; + /* 0xC3D8 */ mDoExt_3DlineMat1_c mRedRopeMat; +#if VERSION > VERSION_DEMO + /* 0xC414 */ mDoExt_3DlineMat1_c mDefeatCSRopeMat; // Only used when Puppet Ganon disappears /* 0xC450 */ cXyz mC450[60]; - /* 0xC720 */ u8 mC720[0xC748 - 0xC720]; + /* 0xC720 */ s8 mC720; + /* 0xC721 */ u8 mC721[0xC724 - 0xC721]; + /* 0xC724 */ f32 mC724; +#endif + /* 0xC728 */ cXyz mC728; + /* 0xC734 */ cXyz mC734; + /* 0xC740 */ u8 mC740[0xC744 - 0xC740]; + /* 0xC744 */ s16 mC744; + /* 0xC746 */ s16 mC746; /* 0xC748 */ s16 mC748; - /* 0xC74A */ u8 mC74A[0xC74C - 0xC74A]; + /* 0xC74A */ s16 mC74A; /* 0xC74C */ s16 mC74C; - /* 0xC74E */ u8 mC74E[0xC7B0 - 0xC74E]; - /* 0xC7B0 */ u16 mC7B0; - /* 0xC7B2 */ u8 mC7B2[0xC7C0 - 0xC7B2]; - /* 0xC7C0 */ dCcD_Stts mC7C0; + /* 0xC74E */ s16 mC74E; + /* 0xC750 */ s16 mC750; + /* 0xC752 */ s16 mC752; + /* 0xC754 */ s16 mC754; + /* 0xC756 */ u8 mC756[0xC758 - 0xC756]; + /* 0xC758 */ cXyz mC758; + /* 0xC764 */ s16 mC764; + /* 0xC766 */ u8 mC766[0xC76C - 0xC766]; + /* 0xC76C */ f32 mC76C; + /* 0xC770 */ s16 mC770; + /* 0xC772 */ u8 mC772[0xC774 - 0xC772]; + /* 0xC774 */ f32 mC774; + /* 0xC778 */ s8 mC778; + /* 0xC779 */ s8 mC779; + /* 0xC772 */ u8 mC77A[0xC77C - 0xC77A]; + /* 0xC77C */ cXyz mC77C; + /* 0xC788 */ cXyz mC788; + /* 0xC794 */ cXyz mC794; + /* 0xC7A0 */ cXyz mC7A0; + /* 0xC7AC */ s16 mC7AC[5]; + /* 0xC7B6 */ s16 mC7B6; + /* 0xC7B8 */ s16 mC7B8; + /* 0xC7BA */ u8 mC7BA[0xC7BC - 0xC7BA]; + /* 0xC7BC */ f32 mC7BC; + /* 0xC7C0 */ dCcD_Stts mStts; /* 0xC7FC */ dCcD_Sph mC7FC; - /* 0xC928 */ dCcD_Sph mC928; - /* 0xCA54 */ u8 mCA54[0xCAAC - 0xCA54]; - /* 0xCAAC */ J3DLightObj mCAAC; - /* 0xCB20 */ u8 mCB20[0xCB60 - 0xCB20]; + /* 0xC928 */ dCcD_Sph mCoreSph; + /* 0xCA54 */ cXyz mCA54; +#if VERSION > VERSION_DEMO + /* 0xCA60 */ s16 mCA60; +#endif + /* 0xCA62 */ s8 mCSMode; + /* 0xCA63 */ u8 mCA63[0xCA64 - 0xCA63]; + /* 0xCA64 */ s16 mKSubCount; + /* 0xCA66 */ u8 mCA66[0xCA68 - 0xCA66]; + /* 0xCA68 */ cXyz mCSCamEye; + /* 0xCA74 */ cXyz mCA74; + /* 0xCA80 */ cXyz mCSCamCenter; + /* 0xCA8C */ u8 mCA8C[0xCA98 - 0xCA8C]; + /* 0xCA98 */ f32 mCA98; + /* 0xCA9C */ f32 mCA9C; + /* 0xCAA0 */ f32 mCSFovY; + /* 0xCAA4 */ J3DModel* mpWater0Model; + /* 0xCAA8 */ J3DModel* mpWater1Model; + /* 0xCAAC */ dKy_tevstr_c mWaterTevStr; + /* 0xCB5C */ J3DModel* mpRoomReflectionModel; /* 0xCB60 */ mDoExt_J3DModelPacketS mCB60; - /* 0xCB70 */ u8 mCB70[0xCB74 - 0xCB70]; - /* 0xCB74 */ J3DLightObj mCB74; - /* 0xCBE8 */ u8 mCBE8[0xCC24 - 0xCBE8]; + /* 0xCB74 */ dKy_tevstr_c mRoomTevStr; /* 0xCC24 */ mDoExt_J3DModelPacketS mCC24; - /* 0xCC34 */ u8 mCC34[0xCC3C - 0xCC34]; - /* 0xCC3C */ dPa_smokeEcallBack mCC3C[2]; - /* 0xCC7C */ u8 mCC7C[0xCC94 - 0xCC7C]; -}; // Size: 0xCC94 - -class daBgn_HIO_c { -public: - daBgn_HIO_c(); - -public: - /* Place member variables here */ -}; + /* 0xCC38 */ s8 mCC38; + /* 0xCC39 */ u8 mCC39[0xCC3C - 0xCC39]; + /* 0xCC3C */ dPa_smokeEcallBack mPunchSmokeCb[2]; + /* 0xCC7C */ s8 mKeeseSpawnNum; + /* 0xCC7D */ u8 mCC7D[0xCC80 - 0xCC7D]; + /* 0xCC80 */ f32 mCC80; + /* 0xCC84 */ f32 mCC84; + /* 0xCC88 */ f32 mCC88; + /* 0xCC8C */ JPABaseEmitter* mCC8C; + /* 0xCC90 */ s8 mCC90; + /* 0xCC91 */ u8 mCC91; + /* 0xCC92 */ u8 mCC92[0xCC94 - 0xCC92]; +}; // Size: 0xCC94 #endif /* D_A_BGN_H */ diff --git a/include/d/actor/d_a_bgn2.h b/include/d/actor/d_a_bgn2.h index def74a24c..c7a7adef5 100644 --- a/include/d/actor/d_a_bgn2.h +++ b/include/d/actor/d_a_bgn2.h @@ -1,19 +1,75 @@ #ifndef D_A_BGN2_H #define D_A_BGN2_H +#include "JSystem/JParticle/JPAEmitter.h" +#include "d/d_bg_s_acch.h" +#include "d/d_cc_d.h" #include "f_op/f_op_actor.h" +#include "m_Do/m_Do_ext.h" -class bgn2_class : public fopAc_ac_c { -public: - /* Place member variables here */ -}; - -class daBgn2_HIO_c { -public: - daBgn2_HIO_c(); - -public: - /* Place member variables here */ -}; +struct bgn2_class { + /* 0x0000 */ fopEn_enemy_c actor; + /* 0x02AC */ request_of_phase_process_class mPhase; + /* 0x02B4 */ mDoExt_McaMorf* mpHeadMorf; + /* 0x02B8 */ mDoExt_J3DModelPacketS m02B8; + /* 0x02CC */ mDoExt_McaMorf* mpBodyMorf; + /* 0x02D0 */ mDoExt_J3DModelPacketS m02D0; + /* 0x02E4 */ mDoExt_J3DModelPacketS m02E4; + /* 0x02F8 */ J3DModel* mpJyakutenModel[3]; + /* 0x0304 */ mDoExt_brkAnm* mJyakutenCBrkAnm; + /* 0x0308 */ mDoExt_brkAnm* mJyakutenBBrkAnm; + /* 0x030C */ u8 m030C[0x0310 - 0x030C]; + /* 0x0310 */ s16 m0310; + /* 0x0312 */ s16 m0312; + /* 0x0314 */ s16 m0314; + /* 0x0316 */ u8 m0316[0x0318 - 0x0316]; + /* 0x0318 */ cXyz m0318; + /* 0x0324 */ u8 m0324[0x0330 - 0x0324]; + /* 0x0330 */ s16 m0330[5]; + /* 0x033A */ s16 m033A; + /* 0x033C */ s16 m033C; + /* 0x0334 */ u8 m033E[0x0340 - 0x033E]; + /* 0x0340 */ cXyz m0340; + /* 0x034C */ cXyz m034C; + /* 0x0358 */ s16 m0358; + /* 0x035A */ u8 m035A[0x0360 - 0x035A]; + /* 0x037C */ dCcD_Stts mStts; + /* 0x039C */ dCcD_Sph m039C; + /* 0x04C8 */ dCcD_Sph m04C8[2]; + /* 0x0720 */ dCcD_Sph m0720[30]; + /* 0x2A48 */ dCcD_Sph m2A48; + /* 0x2B74 */ cXyz m2B74; + /* 0x2B80 */ cXyz m2B80[2]; + /* 0x2B98 */ cXyz m2B98[30]; +#if VERSION > VERSION_DEMO + /* 0x2D00 */ s16 mArrowHitEffectTimer[32]; + /* 0x2D40 */ u8 m2D40[0x2D60 - 0x2D40]; + /* 0x2D60 */ s16 m2D60; + /* 0x2D62 */ u8 m2D62[0x2D64 - 0x2D62]; + /* 0x2D64 */ f32 m2D64; + /* 0x2D68 */ s16 mArrowHitFlashTimer; + /* 0x2D6A */ s16 m2D6A; + /* 0x2D6C */ JPABaseEmitter* mpArrowHitEmitter1[32]; + /* 0x2DEC */ JPABaseEmitter* mpArrowHitEmitter2[32]; +#endif + /* 0x2E6C */ cXyz m2E6C; + /* 0x2E78 */ s8 m2E78; + /* 0x2E79 */ s8 m2E79; + /* 0x2E7A */ u8 m2E7A[0x2E7C - 0x2E7A]; + /* 0x2E7C */ f32 m2E7C; + /* 0x2E80 */ s16 m2E80; + /* 0x2E82 */ s16 m2E82; + /* 0x2E84 */ u8 m2E84[0x2E88 - 0x2E84]; + /* 0x2E88 */ mDoExt_3DlineMat1_c mRedRopeMat; + /* 0x2EC4 */ f32 m2EC4; + /* 0x2EC8 */ JPABaseEmitter* m2EC8[2]; + /* 0x2ED0 */ s8 m2ED0; + /* 0x2ED1 */ u8 m2ED1[0x2ED2 - 0x2ED1]; + /* 0x2ED2 */ s16 m2ED2; + /* 0x2ED4 */ dBgS_AcchCir mAcchCir; + /* 0x2F14 */ dBgS_ObjAcch mAcch; + /* 0x30D8 */ u8 m30D8; + /* 0x30D9 */ u8 m30D9[0x30DC - 0x30D9]; +}; // Size: 0x30DC #endif /* D_A_BGN2_H */ diff --git a/include/d/actor/d_a_bgn3.h b/include/d/actor/d_a_bgn3.h index 6b42fab26..fd5f4571c 100644 --- a/include/d/actor/d_a_bgn3.h +++ b/include/d/actor/d_a_bgn3.h @@ -8,38 +8,91 @@ struct bgn3_ke_s { /* 0x00 */ cXyz m00[5]; /* 0x3C */ cXyz m3C[5]; - /* 0x78 */ u8 m78[0x84 - 0x78]; + /* 0x78 */ cXyz m78; }; struct part_s3 { - /* 0x0000 */ u8 m0000[0x00F8 - 0x0000]; - /* 0x00F8 */ dCcD_GObjInf m00F8; - /* 0x01F0 */ u8 m01F0[0x023C - 0x01F0]; - /* 0x023C */ bgn3_ke_s mHairs[40]; - /* 0x16DC */ mDoExt_3DlineMat0_c mLineMat; + /* 0x0000 */ J3DModel* mpPart3Model; + /* 0x0004 */ mDoExt_J3DModelPacketS m0004; + /* 0x0018 */ dKy_tevstr_c mPart3TevStr; + /* 0x00C8 */ s16 m00C8; + /* 0x00CA */ u8 m00CA[0x00CC - 0x00CA]; + /* 0x00CC */ f32 m00CC; + /* 0x00D0 */ s16 mPart3ArrowHitFlashTimer; + /* 0x00D2 */ u8 m00D2[0x00D4 - 0x00D2]; + /* 0x00D4 */ cXyz m00D4; + /* 0x00E0 */ s16 m00E0; + /* 0x00E2 */ s16 m00E2; + /* 0x00E4 */ u8 m00E4[0x00E8 - 0x00E4]; + /* 0x00E8 */ cXyz m00E8; + /* 0x00F4 */ f32 m00F4; + /* 0x00F8 */ dCcD_Sph mPart3Sph; + /* 0x0224 */ u8 m0224[0x0230 - 0x0224]; +#if VERSION > VERSION_DEMO + /* 0x0230 */ JPABaseEmitter* mpPart3ArrowHitEmitter1; + /* 0x0234 */ JPABaseEmitter* mpPart3ArrowHitEmitter2; + /* 0x0238 */ s16 mPart3ArrowHitEffectTimer; + /* 0x023A */ u8 m023A[0x023C - 0x023A]; +#endif + /* 0x023C */ bgn3_ke_s mPart3Hairs[40]; + /* 0x16DC */ mDoExt_3DlineMat0_c mPart3LineMat; }; -class bgn3_class : public fopAc_ac_c { -public: - /* 0x00290 */ u8 m00290[0x002E4 - 0x00290]; +struct bgn3_class { + /* 0x00000 */ fopEn_enemy_c actor; + /* 0x002AC */ request_of_phase_process_class mPhase; + /* 0x002B4 */ mDoExt_McaMorf* mpMorf; + /* 0x002B8 */ mDoExt_J3DModelPacketS m002B8; + /* 0x002CC */ J3DModel* m002CC; + /* 0x002D0 */ mDoExt_J3DModelPacketS m002D0; /* 0x002E4 */ bgn3_ke_s mHairs[40]; /* 0x01784 */ mDoExt_3DlineMat0_c mLineMat; - /* 0x017A0 */ u8 m017A0[0x017CC - 0x017A0]; + /* 0x017A0 */ mDoExt_J3DModelPacketS m017A0; + /* 0x017B4 */ J3DModel* mpJyakutenCModel; // Weak point (1 hit left) + /* 0x017B8 */ J3DModel* mpJyakutenBModel; // Weak point (2 hits left) + /* 0x017BC */ J3DModel* mpJyakutenAModel; // Weak point (3 hits left) + /* 0x017C0 */ mDoExt_brkAnm* mJyakutenCBrkAnm; + /* 0x017C4 */ mDoExt_brkAnm* mJyakutenBBrkAnm; + /* 0x017C8 */ u8 m017C8[0x017CC - 0x017C8]; /* 0x017CC */ part_s3 mParts[10]; - /* 0x0FD7C */ u8 m0FD7C[0x0FDDC - 0x0FD7C]; - /* 0x0FDDC */ dCcD_GStts m0FDDC; - /* 0x0FDFC */ dCcD_GObjInf m0FDFC; - /* 0x0FEF4 */ u8 m0FEF4[0x0FF28 - 0x0FEF4]; - /* 0x0FF28 */ dCcD_GObjInf m0FF28; - /* 0x10020 */ u8 m10020[0x100B4 - 0x10020]; -}; - -class daBgn3_HIO_c { -public: - daBgn3_HIO_c(); - -public: - /* Place member variables here */ -}; + /* 0x0FD7C */ cXyz m0FD7C; + /* 0x0FD88 */ s16 m0FD88; + /* 0x0FD8A */ s16 m0FD8A; + /* 0x0FD8C */ s16 m0FD8C; + /* 0x0FD8E */ s16 m0FD8E; + /* 0x0FD90 */ s16 m0FD90; + /* 0x0FD92 */ s16 m0FD92; + /* 0x0FD94 */ s16 m0FD94; +#if VERSION > VERSION_DEMO + /* 0x0FD96 */ s16 m0FD96; + /* 0x0FD98 */ f32 m0FD98; + /* 0x0FD9C */ s16 mArrowHitFlashTimer; + /* 0x0FD9E */ s16 m0FD9E; + /* 0x0FDA0 */ JPABaseEmitter* mpArrowHitEmitter1; + /* 0x0FDA4 */ JPABaseEmitter* mpArrowHitEmitter2; + /* 0x0FDA8 */ s16 mArrowHitEffectTimer; +#endif + /* 0x0FDAA */ s16 m0FDAA[2]; + /* 0x0FDAE */ s16 m0FDAE; + /* 0x0FDB0 */ s16 m0FDB0; + /* 0x0FDB2 */ u8 m0FDB2[0x0FDB4 - 0x0FDB2]; + /* 0x0FDB4 */ s16 m0FDB4; + /* 0x0FDB6 */ s16 m0FDB6; + /* 0x0FDB8 */ f32 m0FDB8; + /* 0x0FDBC */ f32 m0FDBC; + /* 0x0FDC0 */ dCcD_Stts mStts; + /* 0x0FDFC */ dCcD_Sph m0FDFC; + /* 0x0FF28 */ dCcD_Sph m0FF28; + /* 0x10054 */ cXyz m10054; + /* 0x10060 */ f32 m10060; + /* 0x10064 */ mDoExt_3DlineMat1_c mRedRopeMat; + /* 0x100A0 */ f32 m100A0; + /* 0x100A4 */ u8 m100A4[0x100A8 - 0x100A4]; + /* 0x100A8 */ s16 m100A8; + /* 0x100AA */ u8 m100AA[0x100AC - 0x100AA]; + /* 0x100AC */ s32 m100AC; + /* 0x100B0 */ u8 m100B0; + /* 0x100B1 */ u8 m100B1[0x100B4 - 0x100B1]; +}; // Size: 0x100B4 #endif /* D_A_BGN3_H */ diff --git a/include/d/actor/d_a_cc.h b/include/d/actor/d_a_cc.h index 7673aafca..1586488a6 100644 --- a/include/d/actor/d_a_cc.h +++ b/include/d/actor/d_a_cc.h @@ -24,7 +24,6 @@ struct cc_class { /* 0x2D4 */ mDoExt_btkAnm* m2D4; /* 0x2D8 */ mDoExt_McaMorf* m2D8; /* 0x2DC */ mDoExt_J3DModelPacketS m2DC; - /* 0x2EC */ u8 m2EC[0x2F0 - 0x2EC]; /* 0x2F0 */ u8 mBehaviorType; /* 0x2F1 */ u8 mColorType; /* 0x2F2 */ u8 mNoticeRangeByte; diff --git a/include/d/actor/d_a_ki.h b/include/d/actor/d_a_ki.h index 04bc1bf03..68e97d456 100644 --- a/include/d/actor/d_a_ki.h +++ b/include/d/actor/d_a_ki.h @@ -25,7 +25,6 @@ struct ki_class { /* 0x2AC */ request_of_phase_process_class mPhase; /* 0x2B4 */ mDoExt_McaMorf* mpMorf; /* 0x2B8 */ mDoExt_J3DModelPacketS m2B8; - /* 0x2C8 */ u8 m2C8[0x2CC - 0x2C8]; /* 0x2CC */ u8 mParameters; /* 0x2CD */ u8 m2CD; /* 0x2CE */ u8 mKiPathIndex; diff --git a/include/d/d_snap.h b/include/d/d_snap.h index b331ff6ec..605855ec0 100644 --- a/include/d/d_snap.h +++ b/include/d/d_snap.h @@ -210,7 +210,7 @@ enum { /* 0xCA */ DSNAP_TYPE_BDK, /* 0xCB */ DSNAP_TYPE_UNKCB, /* 0xCC */ DSNAP_TYPE_BWD, - /* 0xCD */ DSNAP_TYPE_UNKCD, + /* 0xCD */ DSNAP_TYPE_BGN, /* 0xCE */ DSNAP_TYPE_UNKCE, /* 0xCF */ DSNAP_TYPE_UNKCF, /* 0xD0 */ DSNAP_TYPE_LAST_INDEX, diff --git a/include/m_Do/m_Do_ext.h b/include/m_Do/m_Do_ext.h index 3ca8010a7..14a7dee1f 100644 --- a/include/m_Do/m_Do_ext.h +++ b/include/m_Do/m_Do_ext.h @@ -562,17 +562,22 @@ public: void entryOpa() { j3dSys.getDrawBuffer(0)->entryImm(this, 0); } }; +extern J3DDrawBuffer* dComIfGd_getOpaListSky(); + class mDoExt_J3DModelPacketS : public J3DPacket { public: mDoExt_J3DModelPacketS() {} ~mDoExt_J3DModelPacketS() {} - void setModel(J3DModel*) {} - void update() {} + void setModel(J3DModel* model) { mpModel = model; } + void update() { dComIfGd_getOpaListSky()->entryImm(this, 0); } void draw(); void setMaterial(); -}; // Size: 0x10 + +public: + /* 0x10 */ J3DModel* mpModel; +}; // Size: 0x14 class mDoExt_3Dline_c { public: diff --git a/src/d/actor/d_a_att.cpp b/src/d/actor/d_a_att.cpp index 57b91a4b8..572803cb1 100644 --- a/src/d/actor/d_a_att.cpp +++ b/src/d/actor/d_a_att.cpp @@ -60,7 +60,7 @@ static BOOL daAtt_Execute(att_class* i_this) { mDoAud_seStart(JA_SE_LK_W_WEP_HIT, NULL, 0x21, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); if (r30 <= 1) { if (boss->mAAA8[1-r30].m2D0 != 0) { - boss->mC7B0 = 600; + boss->mC7AC[2] = 600; } } } else { diff --git a/src/d/actor/d_a_bgn.cpp b/src/d/actor/d_a_bgn.cpp index ad84068a7..738302e4e 100644 --- a/src/d/actor/d_a_bgn.cpp +++ b/src/d/actor/d_a_bgn.cpp @@ -1,255 +1,3389 @@ /** * d_a_bgn.cpp - * Boss - Puppet Ganon (Phase 1) + * Boss - Puppet Ganon (Phase 1) / G(クグツ)(G (Puppet)) */ #include "d/dolzel_rel.h" // IWYU pragma: keep #include "d/actor/d_a_bgn.h" #include "d/actor/d_a_bgn2.h" #include "d/actor/d_a_bgn3.h" +#include "d/actor/d_a_bomb.h" +#include "d/actor/d_a_ki.h" +#if VERSION > VERSION_DEMO +#include "d/actor/d_a_ks.h" +#endif +#include "d/actor/d_a_player.h" +#include "d/d_meter.h" #include "d/d_procname.h" #include "d/d_priority.h" +#include "d/d_s_play.h" +#include "d/d_snap.h" +#include "d/res/res_bgn.h" +#include "dolphin/gf/GFGeometry.h" #include "f_op/f_op_actor_mng.h" #include "d/d_cc_d.h" +#include "f_op/f_op_camera.h" +#include "m_Do/m_Do_graphic.h" +#include "JSystem/JUtility/JUTReport.h" + +class daBgn_HIO_c : public JORReflexible { +public: + daBgn_HIO_c(); + virtual ~daBgn_HIO_c() {}; + void genMessage(JORMContext*) {} + +public: + /* 0x004 */ s16 m004; + /* 0x006 */ s8 mNo; + /* 0x007 */ u8 m007[0x008 - 0x007]; + /* 0x008 */ f32 m008; + /* 0x00C */ u8 m00C; + /* 0x00D */ u8 m00D; + /* 0x00E */ u8 m00E[0x010 - 0x00E]; + /* 0x010 */ f32 m010; + /* 0x014 */ s16 m014; + /* 0x016 */ s16 m016; + /* 0x018 */ s16 m018; + /* 0x01A */ u8 m01A[0x01C - 0x01A]; + /* 0x01C */ f32 m01C; + /* 0x020 */ f32 m020; + /* 0x024 */ u8 m024; + /* 0x025 */ u8 m025; + /* 0x026 */ u8 m026; + /* 0x027 */ u8 m027; + /* 0x028 */ u8 m028; + /* 0x029 */ u8 m029; + /* 0x02A */ u8 m02A; + /* 0x02B */ u8 m02B; + /* 0x02C */ u8 m02C; + /* 0x02D */ u8 m02D; + /* 0x02E */ u8 m02E; + /* 0x02F */ u8 m02F; + /* 0x030 */ u8 m030; + /* 0x031 */ u8 m031[0x034 - 0x031]; + /* 0x034 */ f32 m034; + /* 0x038 */ f32 m038; + /* 0x03C */ s16 m03C; + /* 0x03E */ s16 m03E; + /* 0x040 */ s16 m040; + /* 0x042 */ s16 m042; + /* 0x044 */ s16 m044; + /* 0x046 */ u8 m046[0x048 - 0x046]; + /* 0x048 */ f32 m048; + /* 0x04C */ f32 m04C; + /* 0x050 */ f32 m050; + /* 0x054 */ f32 m054; + /* 0x058 */ f32 m058; + /* 0x05C */ f32 m05C; + /* 0x060 */ f32 m060; + /* 0x064 */ f32 m064; + /* 0x068 */ f32 m068; + /* 0x06C */ f32 m06C; + /* 0x070 */ f32 m070; + /* 0x074 */ f32 m074; + /* 0x078 */ f32 m078; + /* 0x07C */ f32 m07C; + /* 0x080 */ f32 m080; + /* 0x084 */ f32 m084; + /* 0x088 */ f32 m088; + /* 0x08C */ f32 m08C; + /* 0x090 */ f32 m090; + /* 0x094 */ f32 m094; + /* 0x098 */ f32 m098; + /* 0x09C */ f32 m09C; + /* 0x0A0 */ f32 m0A0; + /* 0x0A4 */ f32 m0A4; + /* 0x0A8 */ s16 m0A8; + /* 0x0AA */ s16 m0AA; + /* 0x0AC */ s16 m0AC; + /* 0x0AE */ s16 m0AE; + /* 0x0B0 */ s16 m0B0; + /* 0x0B2 */ s16 m0B2; + /* 0x0B4 */ s16 m0B4; + /* 0x0B6 */ s16 m0B6; + /* 0x0B8 */ s16 m0B8; + /* 0x0BA */ s16 m0BA; + /* 0x0BC */ s16 m0BC; + /* 0x0BE */ s16 m0BE; + /* 0x0C0 */ s16 m0C0; + /* 0x0C2 */ s16 m0C2; + /* 0x0C4 */ s16 m0C4; + /* 0x0C6 */ s16 m0C6; + /* 0x0C8 */ s16 m0C8; + /* 0x0CA */ s16 m0CA; + /* 0x0CC */ s16 m0CC; + /* 0x0CE */ s16 m0CE; + /* 0x0D0 */ s16 m0D0; + /* 0x0D2 */ s16 m0D2; + /* 0x0D4 */ f32 m0D4; + /* 0x0D8 */ s16 m0D8; + /* 0x0DA */ s16 m0DA; + /* 0x0DC */ s16 m0DC; + /* 0x0DE */ s16 m0DE; + /* 0x0E0 */ s16 m0E0; + /* 0x0E2 */ s16 m0E2; + /* 0x0E4 */ s16 m0E4; + /* 0x0E6 */ s16 m0E6; + /* 0x0E8 */ s16 m0E8; + /* 0x0EA */ s16 m0EA; + /* 0x0EC */ s16 m0EC; + /* 0x0EE */ s16 m0EE; + /* 0x0F0 */ s16 m0F0; + /* 0x0F2 */ s16 m0F2; + /* 0x0F4 */ f32 m0F4; + /* 0x0F8 */ f32 m0F8; + /* 0x0FC */ f32 m0FC; + /* 0x100 */ f32 m100; + /* 0x104 */ f32 m104; + /* 0x108 */ f32 m108; + /* 0x10C */ f32 m10C; + /* 0x110 */ f32 m110; + /* 0x114 */ f32 m114; + /* 0x118 */ f32 m118; + /* 0x11C */ f32 m11C; + /* 0x120 */ f32 m120; + /* 0x124 */ f32 m124; + /* 0x128 */ f32 m128; + /* 0x12C */ f32 m12C; + /* 0x130 */ f32 m130; + /* 0x134 */ f32 m134; + /* 0x138 */ f32 m138; + /* 0x13C */ f32 m13C; + /* 0x140 */ f32 m140; + /* 0x144 */ f32 m144; + /* 0x148 */ f32 m148; + /* 0x14C */ f32 m14C; + /* 0x150 */ f32 m150; + /* 0x154 */ f32 m154; + /* 0x158 */ f32 m158; + /* 0x15C */ f32 m15C; + /* 0x160 */ f32 m160; + /* 0x164 */ f32 m164; + /* 0x168 */ f32 m168; + /* 0x16C */ f32 m16C; + /* 0x170 */ f32 m170; + /* 0x174 */ s16 mKeeseNum3HP; + /* 0x176 */ s16 mKeeseNum2HP; + /* 0x178 */ s16 mKeeseNum1HP; + /* 0x17A */ s16 mKeeseNumMax; +}; // Size: 0x17C /* 000000EC-000003F0 .text __ct__11daBgn_HIO_cFv */ daBgn_HIO_c::daBgn_HIO_c() { - /* Nonmatching */ + mNo = 0xFF; + m00C = 1; + m00D = 1; + m010 = 50.0f; + m014 = 10; + m016 = 10; + m018 = 80; + m01C = 1000.0f; + m020 = 10000.0f; + m025 = 0; + m026 = 0; + m027 = 0; + m024 = 0; + m028 = 1; + m008 = 200.0f; + m004 = 0; + m029 = 0; + m02A = 0; + m02B = 0; + m02C = 0; + m02D = 0; + m02E = 0; + m02F = 0; + m030 = 0; + m034 = -20.0f; + m038 = -30.0f; + m03C = 0; + m03E = 22000; + m040 = 0; + m042 = 0; + m044 = 0; + m048 = 0.0f; + m04C = 950.0f; + m050 = 0.0f; + m054 = 0.0f; + m058 = 2000.0f; + m05C = 800.0f; + m060 = 0.0f; + m064 = -800.0f; + m068 = -800.0f; + m06C = 700.0f; + m070 = -900.0f; + m074 = 300.0f; + m078 = -700.0f; + m07C = -900.0f; + m080 = 300.0f; + m084 = 500.0f; + m088 = -1300.0f; + m08C = -100.0f; + m090 = -500.0f; + m094 = -1300.0f; + m098 = -100.0f; + m09C = 0.0f; + m0A0 = -700.0f; + m0A4 = -1200.0f; + m0A8 = 0; + m0AA = 0; + m0AC = 0; + m0AE = 0; + m0B0 = 0; + m0B2 = 0; + m0B4 = 0; + m0B6 = 0; + m0B8 = 0; + m0BA = 0; + m0BC = 0; + m0BE = 0; + m0C0 = 0; + m0C2 = 0; + m0C4 = 0; + m0C6 = 0; + m0C8 = 0; + m0CA = 0; + m0CC = 0; + m0CE = 0; + m0D0 = 0; + m0D2 = 0; + m0D8 = 120; + m0DA = 20; + m0DC = 1200; + m0DE = 1500; + m0E0 = 2000; + m0E2 = DEMO_SELECT(150, 300); + m0E4 = DEMO_SELECT(100, 200); + m0E6 = DEMO_SELECT(80, 150); + m0E8 = DEMO_SELECT(20, 15); + m0EA = 15; + m0EC = DEMO_SELECT(10, 15); + m0EE = 500; + m0D4 = 40.0f; + m0F0 = 5; + m0F2 = 10; + m0F4 = 1.3f; + m0FC = 3.25f; + m0F8 = 1.6f; + m100 = 1.8f; + m104 = 1.2f; + m108 = 0.3f; + m10C = 1.2f; + m110 = 0.4f; + m114 = 1.2f; + m118 = 0.1f; + m11C = 185.0f; + m124 = 185.0f; + m120 = 185.0f; + m128 = 185.0f; + m168 = 100.0f; + m12C = 0.0f; + m130 = -10.0f; + m134 = 120.0f; + m138 = 100.0f; + m13C = 25.0f; + m140 = 20.0f; + m144 = 0.0f; + m148 = -115.0f; + m14C = 0.0f; + m150 = 80.0f; + m154 = -20.0f; + m158 = 100.0f; + m15C = 0.0f; + m160 = -60.0f; + m164 = 150.0f; + m16C = -50.0f; + m170 = -100.0f; + mKeeseNum3HP = 3; + mKeeseNum2HP = DEMO_SELECT(5, 4); + mKeeseNum1HP = DEMO_SELECT(8, 5); + mKeeseNumMax = DEMO_SELECT(8, 5); } +static bgn_class* bgn; +static bgn2_class* bgn2; +static bgn3_class* bgn3; +static cXyz zero(0.0f, 0.0f, 0.0f); +static s32 BGN_HAND_MAX; +static s32 BGN_TAIL_MAX; +static bool hio_set; +static daBgn_HIO_c l_HIO; +static GXColor ke_color; // Unused +static dKy_tevstr_c bg_tevstr; +static cXyz w_pos(0.0f, 0.0f, 0.0f); +static s32 ki_all_count; +static csXyz dance_pause_1[] = { + csXyz(0, 0, -0x4b0), + csXyz(0, 0, 0), + csXyz(0, 0, 0), + csXyz(0x1f4, 0x3e8, 0x5dc), + csXyz(-0x1f4, 0x3e8, 0x5dc), + csXyz(0x4b, 0x384, -0x2bc), + csXyz(0x1f4, -0x514, -0x64), + csXyz(-0xc8, 0x258, -0x190), +}; + +static csXyz dance_pause_2[] = { + csXyz(0, 0, -0x4b0), + csXyz(0, 0, 0), + csXyz(0, 0x12c, 0), + csXyz(0x1f4, -0x1f4, 0x5dc), + csXyz(-0x1f4, -0x1f4, 0x5dc), + csXyz(0x4b, 0x190, -0x2bc), + csXyz(0x1f4, -0x44c, -0x320), + csXyz(-0xc8, 0xc8, -0x1f4), +}; + +static csXyz dance_pause_3[] = { + csXyz(0, 0, -0x3e8), + csXyz(0, 0, 0), + csXyz(0x1f4, 0, -0xc8), + csXyz(-0xc8, 0x3e8, 0x15e), + csXyz(0xc8, 0x578, 0x15e), + csXyz(-0x190, 0x1f4, 0x1f4), + csXyz(0x190, -0xc8, -0x12c), + csXyz(0x320, 0x190, -0xc8), +}; + +static csXyz dance_pause_4[] = { + csXyz(0, 0, -0x3e8), + csXyz(0, 0, 0), + csXyz(-0x1f4, 0, -0xc8), + csXyz(-0xc8, 0x578, 0x15e), + csXyz(0xc8, 0x3e8, 0x15e), + csXyz(-0x190, -0xc8, -0x12c), + csXyz(0x190, 0x1f4, 0x1f4), + csXyz(-0x320, 0x190, -0xc8), +}; + +static csXyz punch_lr1_d[] = { + csXyz(0, 0, -0x6a4), + csXyz(0, 0, 0), + csXyz(-0x96, 0, 0x28a), + csXyz(0x64, 0x578, -0x1f4), + csXyz(-0x64, 0x4b0, 0x1f4), + csXyz(0xc8, 0x12c, 0x384), + csXyz(-0x64, 0x1f4, 0x384), + csXyz(-0x258, 0x1f4, 0x12c), +}; + +static csXyz punch_lr12_d[] = { + csXyz(0, 0, -0x6a4), + csXyz(0, 0, 0), + csXyz(0x96, 0, 0x28a), + csXyz(0x64, 0x4b0, -0x1f4), + csXyz(-0x64, 0x578, 0x1f4), + csXyz(0xc8, 0x1f4, 0x384), + csXyz(-0x64, 0x12c, 0x384), + csXyz(0x258, 0x1f4, 0x12c), +}; + +static csXyz punch_lr2_d[] = { + csXyz(0, 0, 0), + csXyz(0, 0, 0), + csXyz(0, 0, 0x1f4), + csXyz(-0x1f4, 0x96, 0x3e8), + csXyz(0x1f4, 0x96, 0x3e8), + csXyz(0x96, 0x258, 0x3e8), + csXyz(-0x96, 0x258, 0x384), + csXyz(0, 0x3b6, 0x64), +}; + +static csXyz punch_r1_d[] = { + csXyz(-0x96, 0, 0), + csXyz(0, 0, 0), + csXyz(-0xc8, 0, 0x190), + csXyz(0, 0x190, 0x258), + csXyz(-0x96, 0x640, -0x190), + csXyz(-0x258, 0x12c, 0x28a), + csXyz(-0x4b0, 0, 0xc8), + csXyz(0x2bc, 0x2bc, 0xc8), +}; + +static csXyz punch_r2_d[] = { + csXyz(0x96, 0, -0x1f4), + csXyz(0, 0, 0), + csXyz(0x258, 0, 0), + csXyz(0x28a, 0x3e8, -0x1f4), + csXyz(-0x258, 0, 0x4b0), + csXyz(0x3e8, 0xfa, 0x7d0), + csXyz(0x384, 0xc8, -0x12c), + csXyz(0, 0x320, -0x15e), +}; + +static csXyz punch_l1_d[] = { + csXyz(0x96, 0, 0), + csXyz(0, 0, 0), + csXyz(0xc8, 0, 0x190), + csXyz(0x96, 0x640, -0x190), + csXyz(0, 0x190, 0x258), + csXyz(0x4b0, 0, 0x7d0), + csXyz(0x258, 0x12c, 0x28a), + csXyz(-0x2bc, 0x2bc, 0xc8), +}; + +static csXyz punch_l2_d[] = { + csXyz(-0x96, 0, -0x1f4), + csXyz(0, 0, 0), + csXyz(-0x258, 0, 0), + csXyz(0x258, 0, 0x4b0), + csXyz(-0x28a, 0x3e8, -0x1f4), + csXyz(-0x384, 0xc8, -0x12c), + csXyz(-0x3e8, 0xfa, 0x7d0), + csXyz(0, 0x320, -0x15e), +}; + +static csXyz start_pause[] = { + csXyz(0, 0, 0), + csXyz(0, 0, 0), + csXyz(0, 0, 0), + csXyz(-0x64, 0xfa, 0), + csXyz(0x190, 0xfa, 0), + csXyz(-0xc8, 0, 0), + csXyz(0xc8, 0, 0), + csXyz(0, 0, 0), +}; + +static cXyz center_pos(0.0f, 0.0f, 0.0f); + +void mDoExt_J3DModelPacketS::draw() { + J3DShapePacket* shapePacket; + J3DMatPacket* matPacket; + J3DModelData* modelData; + u16 i; + Mtx m; + J3DMaterial* mesh; + + cMtx_copy(j3dSys.getViewMtx(), m); + mDoMtx_stack_c::transS(REG0_F(14), REG0_F(15) + -30.0f, REG0_F(16)); + mDoMtx_stack_c::scaleM(1.0f, -1.0f, 1.0f); + mDoMtx_stack_c::revConcat(j3dSys.mViewMtx); + j3dSys.setViewMtx(mDoMtx_stack_c::get()); + modelData = mpModel->getModelData(); + for (i = 0; i < modelData->getJointNum(); i++) { + mesh = modelData->getJointNodePointer(i)->getMesh(); + while (mesh != NULL) { + if (!mesh->getShape()->checkFlag(J3DShpFlag_Hide)) { + matPacket = mpModel->getMatPacket(mesh->getIndex()); + j3dSys.setTexture(matPacket->mpTexture); + j3dSys.setMatPacket(matPacket); + mesh->load(); + setMaterial(); + shapePacket = matPacket->getShapePacket(); + shapePacket->getShape()->loadPreDrawSetting(); + for (; shapePacket != NULL; shapePacket = (J3DShapePacket*)shapePacket->getNextPacket()) { + if (shapePacket->getDisplayListObj() != NULL) { + shapePacket->getDisplayListObj()->callDL(); + } + shapePacket->drawFast(); + } + J3DShape::resetVcdVatCache(); + } + mesh = mesh->getNext(); + } + } + j3dSys.setViewMtx(m); +}; + +void mDoExt_J3DModelPacketS::setMaterial() { + static unsigned char l_DL[] = {0x61, 0x41, 0x00, 0x04, 0xAD, 0x61, 0xF3, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + GFSetCullMode(GX_CULL_FRONT); + GXCallDisplayList(l_DL, 0x20); +}; + /* 000005BC-000008BC .text part_draw__FP9bgn_classP6part_s */ -void part_draw(bgn_class*, part_s*) { - /* Nonmatching */ +static void part_draw(bgn_class* i_this, part_s* param_2) { + fopAc_ac_c* actor = &i_this->actor; + J3DModel* model; + cXyz local_38; + + model = param_2->mpPartModel; + if (model != NULL) { + g_env_light.settingTevStruct(TEV_TYPE_ACTOR, ¶m_2->m0D4, ¶m_2->mPartTevStr); + if (i_this->mCC88 > 0.0f) { + param_2->mPartTevStr.mFogColor.b = 0; + param_2->mPartTevStr.mFogColor.g = 0; + param_2->mPartTevStr.mFogColor.r = 0; + param_2->mPartTevStr.mFogStartZ = param_2->mPartTevStr.mFogStartZ + i_this->mCC88 * -50000.0f; + } + if (param_2->mPartArrowHitFlashTimer != 0) { + s16 uVar4 = param_2->mPartTevStr.mFogColor.r + param_2->m0C8; + if (uVar4 > 0xFF) { + uVar4 = 0xFF; + } + s16 uVar5 = param_2->mPartTevStr.mFogColor.g + param_2->m0C8; + if (uVar5 > 0xFF) { + uVar5 = 0xFF; + } + s16 uVar6 = param_2->mPartTevStr.mFogColor.g + (param_2->m0C8 / 2); + if (uVar6 > 0xFF) { + uVar6 = 0xFF; + } + if (param_2->mPartArrowHitFlashTimer > 40) { + cLib_addCalcAngleS2(¶m_2->m0C8, 0x118, 1, 30); + cLib_addCalc2(¶m_2->m0CC, -50000.0f, 1.0f, 5000.0f); + } else { + cLib_addCalcAngleS2(¶m_2->m0C8, 0, 1, 7); + cLib_addCalc0(¶m_2->m0CC, 1.0f, 1250.0f); + } + param_2->mPartTevStr.mFogColor.r = uVar4 & 0xFF; + param_2->mPartTevStr.mFogColor.g = uVar5 & 0xFF; + param_2->mPartTevStr.mFogColor.b = uVar6 & 0xFF; + param_2->mPartTevStr.mFogStartZ = param_2->mPartTevStr.mFogStartZ + param_2->m0CC; + } + camera_class* camera = (camera_class*)dComIfGp_getCamera(0); + local_38 = param_2->m224 - camera->mLookat.mEye; + if (local_38.abs() > l_HIO.m008 * param_2->m0F4) { + g_env_light.setLightTevColorType(model, ¶m_2->mPartTevStr); + if ((actor->health <= 2) && (param_2 == &i_this->mTailParts[BGN_TAIL_MAX - 1])) { + if (actor->health == 1) { + i_this->mJyakutenCBrkAnm->entry(model->getModelData()); + } else { + i_this->mJyakutenBBrkAnm->entry(model->getModelData()); + } + } + if (param_2 == &i_this->mHeadParts[0]) { + i_this->mpMorf->entryDL(); + } else { + mDoExt_modelUpdateDL(model); + } + } + if (l_HIO.m00C != 0) { + param_2->m004.setModel(model); + param_2->m004.update(); + } + } } /* 000008F8-00000B70 .text water0_disp__FP9bgn_class */ -void water0_disp(bgn_class*) { - /* Nonmatching */ +static void water0_disp(bgn_class* i_this) { + g_env_light.settingTevStruct(TEV_TYPE_BG1, &w_pos, &i_this->mWaterTevStr); + MtxTrans(0.0f, REG0_F(11), 0.0f, false); + i_this->mpWater0Model->setBaseTRMtx(*calc_mtx); + g_env_light.setLightTevColorType(i_this->mpWater0Model, &i_this->mWaterTevStr); + dComIfGd_setListSky(); + J3DMaterial* mat = i_this->mpWater0Model->getModelData()->getMaterialNodePointer(0); + J3DBlend* blend = mat->getBlend(); + blend->getType(); + J3DZMode* zMode = mat->getZMode(); + zMode->getFunc(); + J3DGXColorS10* tev_col = (J3DGXColorS10*)&mat->getTevColor(0)->mColor; + J3DGXColor* tev_kcol = (J3DGXColor*)&mat->getTevKColor(0)->mColor; + J3DGXColor* tev_kcol2 = (J3DGXColor*)&mat->getTevKColor(3)->mColor; + blend->setType(GX_BM_BLEND); + blend->setSrcFactor(GX_BL_SRC_ALPHA); + blend->setDstFactor(GX_BL_INV_SRC_ALPHA); + zMode->setUpdateEnable(1); + tev_col->mColor.b = 0; + tev_col->mColor.g = 0; + tev_col->mColor.r = 0; + tev_kcol->mColor.b = 0xFF; + tev_kcol->mColor.g = 0xFF; + tev_kcol->mColor.r = 0xFF; + f32 fVar1 = l_HIO.m010; + if ((i_this->m02B5 == 1) && (l_HIO.m00D == 0)) { + fVar1 = (REG0_F(5) + 0.01f) * (REG0_F(4) + 4000.0f + bgn2->actor.current.pos.y); + if (fVar1 > 90.0f) { + fVar1 = 90.0f; + } else if (fVar1 < 50.0f) { + fVar1 = 50.0f; + } + } + tev_kcol2->mColor.a = (s8)(fVar1 * 2.559f); + mDoExt_modelUpdateDL(i_this->mpWater0Model); + dComIfGd_setList(); } /* 00000B70-00000CAC .text water1_disp__FP9bgn_class */ -void water1_disp(bgn_class*) { - /* Nonmatching */ +static void water1_disp(bgn_class* i_this) { + MtxTrans(0.0f, REG0_F(11), 0.0f, false); + i_this->mpWater1Model->setBaseTRMtx(*calc_mtx); + g_env_light.setLightTevColorType(i_this->mpWater1Model, &i_this->mWaterTevStr); + dComIfGd_setListSky(); + J3DMaterial* mat = i_this->mpWater1Model->getModelData()->getMaterialNodePointer(0); + J3DBlend* blend = mat->getBlend(); + blend->getType(); + J3DZMode* zMode = mat->getZMode(); + blend->setType(GX_BM_NONE); + zMode->setUpdateEnable(0); + mDoExt_modelUpdateDL(i_this->mpWater1Model); + dComIfGd_setList(); } /* 00000CAC-00000FCC .text daBgn_DrawS__FP9bgn_class */ -void daBgn_DrawS(bgn_class*) { - /* Nonmatching */ +static void daBgn_DrawS(bgn_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + +#if VERSION == VERSION_DEMO + g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &actor->current.pos, &actor->tevStr); +#endif + if (i_this->mCC88 > 0.0f) { + actor->tevStr.mFogColor.b = 0; + actor->tevStr.mFogColor.g = 0; + actor->tevStr.mFogColor.r = 0; + actor->tevStr.mFogStartZ += i_this->mCC88 * -50000.0f; + } + if (i_this->mArrowHitFlashTimer != 0) { + s16 uVar2 = actor->tevStr.mFogColor.r + i_this->m02F8; + if (uVar2 > 0xFF) { + uVar2 = 0xFF; + } + s16 uVar3 = actor->tevStr.mFogColor.g + i_this->m02F8; + if (uVar3 > 0xFF) { + uVar3 = 0xFF; + } + s16 uVar4 = actor->tevStr.mFogColor.g + (i_this->m02F8 / 2); + if (uVar4 > 0xFF) { + uVar4 = 0xFF; + } + if (i_this->mArrowHitFlashTimer > 40) { + cLib_addCalcAngleS2(&i_this->m02F8, 0x118, 1, 30); + cLib_addCalc2(&i_this->m02FC, -50000.0f, 1.0f, 5000.0f); + } else { + cLib_addCalcAngleS2(&i_this->m02F8, 0, 1, 7); + cLib_addCalc0(&i_this->m02FC, 1.0f, 1250.0f); + } + actor->tevStr.mFogColor.r = uVar2 & 0xFF; + actor->tevStr.mFogColor.g = uVar3 & 0xFF; + actor->tevStr.mFogColor.b = uVar4 & 0xFF; + actor->tevStr.mFogStartZ = actor->tevStr.mFogStartZ + i_this->m02FC; + } + g_env_light.setLightTevColorType(i_this->mpChestModel, &actor->tevStr); + mDoExt_modelUpdateDL(i_this->mpChestModel); + dSnap_RegistFig(DSNAP_TYPE_BGN, actor, 1.0f, 1.0f, 1.0f); + if (l_HIO.m00C != 0) { + i_this->m02C0.setModel(i_this->mpChestModel); + i_this->m02C0.update(); + } + part_draw(i_this, &i_this->mHeadParts[0]); + part_draw(i_this, &i_this->mPelvisParts[0]); + for (s32 i = 0; i < BGN_HAND_MAX; i++) { + part_draw(i_this, &i_this->mLeftArmParts[i]); + part_draw(i_this, &i_this->mRightArmParts[i]); + } + for (s32 i = 0; i < 3; i++) { + part_draw(i_this, &i_this->mLeftLegParts[i]); + part_draw(i_this, &i_this->mRightLegParts[i]); + } + for (s32 i = 0; i < BGN_TAIL_MAX; i++) { + part_draw(i_this, &i_this->mTailParts[i]); + } +#ifdef __MWERKS__ + i_this->mBlueRopeMat.update(60, (GXColor){DEMO_SELECT(0, 0xFF), 0xFF, 0xFF, 0}, &actor->tevStr); +#else + GXColor local_24 = (GXColor){DEMO_SELECT(0, 0xFF), 0xFF, 0xFF, 0}; + i_this->mBlueRopeMat.update(60, local_24, &actor->tevStr); +#endif + dComIfGd_set3DlineMat(&i_this->mBlueRopeMat); +#ifdef __MWERKS__ + i_this->mRedRopeMat.update(60, (GXColor){DEMO_SELECT(0xD2, 0xFF), DEMO_SELECT(0x32, 0xFF), DEMO_SELECT(0x5A, 0xFF), 0}, &actor->tevStr); +#else + GXColor local_28 = (GXColor){DEMO_SELECT(0xD2, 0xFF), DEMO_SELECT(0x32, 0xFF), DEMO_SELECT(0x5A, 0xFF), 0}; + i_this->mRedRopeMat.update(60, local_28, &actor->tevStr); +#endif + dComIfGd_set3DlineMat(&i_this->mRedRopeMat); } /* 00000FCC-000012D0 .text daBgn2_Draw__FP10bgn2_class */ -static BOOL daBgn2_Draw(bgn2_class*) { - /* Nonmatching */ +static BOOL daBgn2_Draw(bgn2_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + + g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &actor->current.pos, &actor->tevStr); + if (i_this->m2E7C > 0.0f) { + actor->tevStr.mFogColor.b = 0; + actor->tevStr.mFogColor.g = 0; + actor->tevStr.mFogColor.r = 0; + actor->tevStr.mFogStartZ += i_this->m2E7C * -50000.0f; + } +#if VERSION > VERSION_DEMO + if (i_this->mArrowHitFlashTimer != 0) { + s16 uVar3 = actor->tevStr.mFogColor.r + i_this->m2D60; + if (uVar3 > 0xFF) { + uVar3 = 0xFF; + } + s16 uVar4 = actor->tevStr.mFogColor.g + i_this->m2D60; + if (uVar4 > 0xFF) { + uVar4 = 0xFF; + } + s16 uVar5 = actor->tevStr.mFogColor.g + (i_this->m2D60 / 2); + if (uVar5 > 0xFF) { + uVar5 = 0xFF; + } + if (i_this->mArrowHitFlashTimer > 20) { + cLib_addCalcAngleS2(&i_this->m2D60, 0x118, 1, 0x1e); + cLib_addCalc2(&i_this->m2D64, -50000.0f, 1.0f, 5000.0f); + } else { + cLib_addCalcAngleS2(&i_this->m2D60, 0, 1, 0xe); + cLib_addCalc0(&i_this->m2D64, 1.0f, 2500.0f); + } + actor->tevStr.mFogColor.r = uVar3 & 0xFF; + actor->tevStr.mFogColor.g = uVar4 & 0xFF; + actor->tevStr.mFogColor.b = uVar5 & 0xFF; + actor->tevStr.mFogStartZ = actor->tevStr.mFogStartZ + i_this->m2D64; + } +#endif + g_env_light.setLightTevColorType(i_this->mpHeadMorf->getModel(), &actor->tevStr); + g_env_light.setLightTevColorType(i_this->mpBodyMorf->getModel(), &actor->tevStr); + i_this->mpHeadMorf->entryDL(); + if (l_HIO.m00C != 0) { + i_this->m02B8.setModel(i_this->mpHeadMorf->getModel()); + i_this->m02B8.update(); + } + i_this->mpBodyMorf->entryDL(); + if (l_HIO.m00C != 0) { + i_this->m02D0.setModel(i_this->mpBodyMorf->getModel()); + i_this->m02D0.update(); + } + J3DModel* model; + if (actor->health != 0) { + if (actor->health == 3) { + model = i_this->mpJyakutenModel[2]; + } else if (actor->health == 1) { + model = i_this->mpJyakutenModel[0]; + i_this->mJyakutenCBrkAnm->entry(model->getModelData()); + } else { + model = i_this->mpJyakutenModel[1]; + i_this->mJyakutenBBrkAnm->entry(model->getModelData()); + } + g_env_light.setLightTevColorType(model, &actor->tevStr); + mDoExt_modelUpdateDL(model); + if (l_HIO.m00C != 0) { + i_this->m02E4.setModel(model); + i_this->m02E4.update(); + } + } +#ifdef __MWERKS__ + i_this->mRedRopeMat.update(60, (GXColor){0xD2, 0x32, 0x5A, 0}, &actor->tevStr); +#else + GXColor local_28 = (GXColor){0xD2, 0x32, 0x5A, 0}; + i_this->mRedRopeMat.update(60, local_28, &actor->tevStr); +#endif + dComIfGd_set3DlineMat(&i_this->mRedRopeMat); + return TRUE; } /* 000012D0-00001754 .text daBgn3_Draw__FP10bgn3_class */ -static BOOL daBgn3_Draw(bgn3_class*) { - /* Nonmatching */ +static BOOL daBgn3_Draw(bgn3_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + + g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &actor->current.pos, &actor->tevStr); + if (i_this->m10060 > 0.0f) { + actor->tevStr.mFogColor.b = 0; + actor->tevStr.mFogColor.g = 0; + actor->tevStr.mFogColor.r = 0; + actor->tevStr.mFogStartZ = actor->tevStr.mFogStartZ + i_this->m10060 * -50000.0f; + } +#if VERSION > VERSION_DEMO + if (i_this->mArrowHitFlashTimer != 0) { + s16 uVar3 = actor->tevStr.mFogColor.r + i_this->m0FD96; + if (uVar3 > 0xFF) { + uVar3 = 0xFF; + } + s16 uVar4 = actor->tevStr.mFogColor.g + i_this->m0FD96; + if (uVar4 > 0xFF) { + uVar4 = 0xFF; + } + s16 uVar5 = actor->tevStr.mFogColor.g + (i_this->m0FD96 / 2); + if (uVar5 > 0xFF) { + uVar5 = 0xFF; + } + if (i_this->mArrowHitFlashTimer > 40) { + cLib_addCalcAngleS2(&i_this->m0FD96, 0x118, 1, 0x1e); + cLib_addCalc2(&i_this->m0FD98, -50000.0f, 1.0f, 5000.0f); + } else { + cLib_addCalcAngleS2(&i_this->m0FD96, 0, 1, 7); + cLib_addCalc0(&i_this->m0FD98, 1.0f, 1250.0f); + } + actor->tevStr.mFogColor.r = uVar3 & 0xFF; + actor->tevStr.mFogColor.g = uVar4 & 0xFF; + actor->tevStr.mFogColor.b = uVar5 & 0xFF; + actor->tevStr.mFogStartZ = actor->tevStr.mFogStartZ + i_this->m0FD98; + } +#endif + J3DModel* model = i_this->m002CC; + g_env_light.setLightTevColorType(model, &actor->tevStr); + mDoExt_modelUpdateDL(model); +#if VERSION == VERSION_DEMO + i_this->m002D0.setModel(model); + i_this->m002D0.update(); +#else + if (l_HIO.m00C != 0) { + i_this->m002D0.setModel(model); + i_this->m002D0.update(); + } +#endif + g_env_light.setLightTevColorType(i_this->mpMorf->getModel(), &actor->tevStr); + i_this->mpMorf->entryDL(); +#if VERSION == VERSION_DEMO + i_this->m002B8.setModel(i_this->mpMorf->getModel()); + i_this->m002B8.update(); +#else + if (l_HIO.m00C != 0) { + i_this->m002B8.setModel(i_this->mpMorf->getModel()); + i_this->m002B8.update(); + } +#endif + part_s3* ppVar8 = i_this->mParts; + for (s32 i = 0; i < 9; i++, ppVar8++) { +#if VERSION > VERSION_DEMO + g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &ppVar8->m00D4, &ppVar8->mPart3TevStr); + if (i_this->m10060 > 0.0f) { + ppVar8->mPart3TevStr.mFogColor.b = 0; + ppVar8->mPart3TevStr.mFogColor.g = 0; + ppVar8->mPart3TevStr.mFogColor.r = 0; + ppVar8->mPart3TevStr.mFogStartZ = ppVar8->mPart3TevStr.mFogStartZ + i_this->m10060 * -50000.0f; + } + if (ppVar8->mPart3ArrowHitFlashTimer != 0) { + s16 var_r25 = ppVar8->mPart3TevStr.mFogColor.r + ppVar8->m00C8; + if (var_r25 > 0xFF) { + var_r25 = 0xFF; + } + s16 var_r21_2 = ppVar8->mPart3TevStr.mFogColor.g + ppVar8->m00C8; + if (var_r21_2 > 0xFF) { + var_r21_2 = 0xFF; + } + s16 var_r20 = ppVar8->mPart3TevStr.mFogColor.g + (ppVar8->m00C8 / 2); + if (var_r20 > 0xFF) { + var_r20 = 0xFF; + } + if (ppVar8->mPart3ArrowHitFlashTimer > 40) { + cLib_addCalcAngleS2(&ppVar8->m00C8, 0x118, 1, 0x1e); + cLib_addCalc2(&ppVar8->m00CC, -50000.0f, 1.0f, 5000.0f); + } else { + cLib_addCalcAngleS2(&ppVar8->m00C8, 0, 1, 7); + cLib_addCalc0(&ppVar8->m00CC, 1.0f, 1250.0f); + } + ppVar8->mPart3TevStr.mFogColor.r = var_r25 & 0xFF; + ppVar8->mPart3TevStr.mFogColor.g = var_r21_2 & 0xFF; + ppVar8->mPart3TevStr.mFogColor.b = var_r20 & 0xFF; + ppVar8->mPart3TevStr.mFogStartZ = ppVar8->mPart3TevStr.mFogStartZ + ppVar8->m00CC; + } +#endif + if (i_this->mParts[i].mpPart3Model != NULL) { + g_env_light.setLightTevColorType(i_this->mParts[i].mpPart3Model, DEMO_SELECT(&actor->tevStr, &ppVar8->mPart3TevStr)); + if (i == 8) { + if (actor->health == 1) { + i_this->mJyakutenCBrkAnm->entry(i_this->mParts[i].mpPart3Model->getModelData()); + } else if (actor->health == 2) { + i_this->mJyakutenBBrkAnm->entry(i_this->mParts[i].mpPart3Model->getModelData()); + } + } + mDoExt_modelUpdateDL(i_this->mParts[i].mpPart3Model); +#if VERSION == VERSION_DEMO + i_this->mParts[i].m0004.setModel(i_this->mParts[i].mpPart3Model); + i_this->mParts[i].m0004.update(); +#else + if (l_HIO.m00C != 0) { + i_this->mParts[i].m0004.setModel(i_this->mParts[i].mpPart3Model); + i_this->mParts[i].m0004.update(); + } +#endif + } + } +#ifdef __MWERKS__ + i_this->mRedRopeMat.update(60, (GXColor){0xD2, 0x32, 0x5A, 0}, &actor->tevStr); +#else + GXColor local_48 = (GXColor){0xD2, 0x32, 0x5A, 0}; + i_this->mRedRopeMat.update(60, local_48, &actor->tevStr); +#endif + dComIfGd_set3DlineMat(&i_this->mRedRopeMat); + return TRUE; } /* 00001754-00001898 .text room_disp__FP9bgn_class */ -void room_disp(bgn_class*) { - /* Nonmatching */ +static void room_disp(bgn_class* i_this) { + f32 x; + + g_env_light.settingTevStruct(TEV_TYPE_BG1, &w_pos, &i_this->mRoomTevStr); + MtxTrans(0.0f, REG0_F(12), 0.0f, false); + x = REG0_F(13) * 0.01f + 1.0f; + MtxScale(x, x, x, true); + i_this->mpRoomReflectionModel->setBaseTRMtx(*calc_mtx); + g_env_light.setLightTevColorType(i_this->mpRoomReflectionModel, &i_this->mRoomTevStr); + if (i_this->mCC38 == 0) { + mDoExt_modelUpdateDL(i_this->mpRoomReflectionModel); + i_this->mCC38++; + } else { + i_this->mpRoomReflectionModel->calcMaterial(); + i_this->mpRoomReflectionModel->diff(); + } + i_this->mCB60.setModel(i_this->mpRoomReflectionModel); + i_this->mCB60.update(); } /* 00001898-0000192C .text ten_a_d_sub__FPvPv */ -void ten_a_d_sub(void*, void*) { - /* Nonmatching */ +static void* ten_a_d_sub(void* param_1, void*) { + fopAc_ac_c* actor = (fopAc_ac_c*)param_1; + if ((fopAc_IsActor(param_1)) && (fopAcM_GetName(param_1) == PROC_Obj_Vteng)) { + if ((actor->model != NULL) && (bgn != NULL)) { + bgn->mCC24.setModel(actor->model); + bgn->mCC24.update(); + } + return param_1; + } else { + return NULL; + } } /* 0000192C-00001998 .text ki_a_d_sub__FPvPv */ -void ki_a_d_sub(void*, void*) { - /* Nonmatching */ +static void* ki_a_d_sub(void* param_1, void*) { + ki_class* keese = (ki_class*)param_1; + if ((fopAc_IsActor(param_1)) && (fopAcM_GetName(param_1) == PROC_KI)) { + if (keese->actor.model != NULL) { + keese->m2B8.setModel(keese->actor.model); + keese->m2B8.update(); + } + } + return NULL; } /* 00001998-000019F4 .text obj_disp__FP9bgn_class */ -void obj_disp(bgn_class*) { - /* Nonmatching */ +static void obj_disp(bgn_class* i_this) { + if (REG0_S(8) == 0) { + fpcM_Search(ten_a_d_sub, i_this); + } + fpcM_Search(ki_a_d_sub, i_this); } +#if VERSION > VERSION_DEMO /* 000019F4-00001A40 .text bgn2_s_sub__FPvPv */ -void bgn2_s_sub(void*, void*) { - /* Nonmatching */ +static void* bgn2_s_sub(void* param_1, void*) { + if ((fopAc_IsActor(param_1)) && (fopAcM_GetName(param_1) == PROC_BGN2)) { + return param_1; + } else { + return NULL; + } } /* 00001A40-00001A8C .text bgn3_s_sub__FPvPv */ -void bgn3_s_sub(void*, void*) { - /* Nonmatching */ +static void* bgn3_s_sub(void* param_1, void*) { + if ((fopAc_IsActor(param_1)) && (fopAcM_GetName(param_1) == PROC_BGN3)) { + return param_1; + } else { + return NULL; + } } +#endif /* 00001A8C-00001C40 .text daBgn_Draw__FP9bgn_class */ -static BOOL daBgn_Draw(bgn_class*) { - /* Nonmatching */ +static BOOL daBgn_Draw(bgn_class* i_this) { +#if VERSION > VERSION_DEMO + fopAc_ac_c* actor = &i_this->actor; + if (i_this->mCA60 > 1) { + mDoGph_gInf_c::setBlureRate(i_this->mCA60); + mDoGph_gInf_c::onBlure(); + } else if (i_this->mCA60 == 1) { + i_this->mCA60 = 0; + mDoGph_gInf_c::offBlure(); + } +#endif + water0_disp(i_this); + if (l_HIO.m00D != 0) { + room_disp(i_this); + } + if (l_HIO.m00C != 0) { + obj_disp(i_this); + } + if (i_this->m02B4 != 0xFF) { +#if VERSION > VERSION_DEMO + g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &actor->current.pos, &actor->tevStr); + bgn2 = (bgn2_class*)fpcM_Search(bgn2_s_sub, i_this); + bgn3 = (bgn3_class*)fpcM_Search(bgn3_s_sub, i_this); +#endif + if (i_this->m02B5 == 0) { + daBgn_DrawS(i_this); + } else if (i_this->m02B5 == 1) { +#if VERSION == VERSION_DEMO + daBgn2_Draw(bgn2); +#else + if (bgn2 != NULL) { + daBgn2_Draw(bgn2); + } +#endif + } else if (i_this->m02B5 == 2) { +#if VERSION == VERSION_DEMO + daBgn3_Draw(bgn3); +#else + if (bgn3 != NULL) { + daBgn3_Draw(bgn3); + } +#endif + } +#if VERSION > VERSION_DEMO + if (i_this->mC720 != 0) { +#ifdef __MWERKS__ + i_this->mDefeatCSRopeMat.update(60, (GXColor){0xFF, 0xFF, 0xFF, 0}, &actor->tevStr); +#else + GXColor local_18 = (GXColor){0xFF, 0xFF, 0xFF, 0}; + i_this->mDefeatCSRopeMat.update(60, local_18, &actor->tevStr); +#endif + dComIfGd_set3DlineMat(&i_this->mDefeatCSRopeMat); + } +#endif + } + water1_disp(i_this); + return TRUE; } /* 00001C40-00001C8C .text ki_del_sub__FPvPv */ -void ki_del_sub(void*, void*) { - /* Nonmatching */ +static void* ki_del_sub(void* param_1, void*) { + ki_class* keese = (ki_class*)param_1; + if ((fopAc_IsActor(param_1)) && (fopAcM_GetName(param_1) == PROC_KI)) { + fopAcM_delete(&keese->actor); + } + return NULL; } +#if VERSION > VERSION_DEMO /* 00001C8C-00001CD8 .text ks_del_sub__FPvPv */ -void ks_del_sub(void*, void*) { - /* Nonmatching */ +static void* ks_del_sub(void* param_1, void*) { + ks_class* morth = (ks_class*)param_1; + if ((fopAc_IsActor(param_1)) && (fopAcM_GetName(param_1) == PROC_KS)) { + fopAcM_delete(&morth->actor); + } + return NULL; } +#endif /* 00001CD8-00001D30 .text ki_c_sub__FPvPv */ -void ki_c_sub(void*, void*) { - /* Nonmatching */ +static void* ki_c_sub(void* param_1, void*) { + if ((fopAc_IsActor(param_1)) && (fopAcM_GetName(param_1) == PROC_KI)) { + ki_all_count++; + } + return NULL; } /* 00001D30-00001D74 .text ki_check__FP9bgn_class */ -void ki_check(bgn_class*) { - /* Nonmatching */ +static s32 ki_check(bgn_class* i_this) { + ki_all_count = 0; + fpcM_Search(ki_c_sub, i_this); + return ki_all_count; } /* 00001D74-00001FA0 .text move_se_set__FP9bgn_class */ -void move_se_set(bgn_class*) { - /* Nonmatching */ +static void move_se_set(bgn_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + u32 uVar2; + cXyz local_28; + + local_28 = actor->current.pos - actor->old.pos; + local_28.y = 0.0f; + uVar2 = local_28.abs() * 3.5f; + if (uVar2 > 100) { + uVar2 = 100; + } + fopAcM_seStart(actor, JA_SE_CM_BGN_MECHA_ROTATE, uVar2); + local_28 = i_this->mC728 - i_this->mC734; + local_28.z = 0.0f; + local_28.x = 0.0f; + uVar2 = local_28.abs(); + if (uVar2 > 100) { + uVar2 = 100; + } + fopAcM_seStart(actor, JA_SE_CM_BGN_MECHA_ROPE, uVar2); } /* 00001FA0-00002330 .text gr_check__FP9bgn_classP4cXyz */ -void gr_check(bgn_class*, cXyz*) { - /* Nonmatching */ +static s32 gr_check(bgn_class* i_this, cXyz* param_2) { + fopAc_ac_c* actor = &i_this->actor; + dBgS_LinChk linChk; + + cXyz local_ac = *param_2; + local_ac.y += 200.0f; + cXyz local_b8 = *param_2; + local_b8.y -= 1000.0f; + linChk.Set(&local_ac, &local_b8, actor); + if (dComIfG_Bgsp()->LineCross(&linChk)) { + *param_2 = linChk.GetCross(); + param_2->y = REG0_F(8) + -2.0f; + if (dComIfG_Bgsp()->GetAttributeCode(linChk) == dBgS_Attr_WATER_e) { + return FALSE; + } + } + return TRUE; } /* 00002768-0000290C .text s_b_sub__FPvPv */ -void s_b_sub(void*, void*) { - /* Nonmatching */ +static void* s_b_sub(void* param_1, void* param_2) { + bgn_class* bgn = (bgn_class*)param_2; + daBomb_c* bomb = (daBomb_c*)param_1; + if ((fopAc_IsActor(param_1)) && (fopAcM_GetName(param_1) == PROC_BOMB) && bomb->get_explode_instant()) { + cXyz local_18 = bomb->current.pos; + if (!gr_check(bgn, &local_18)) { + dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTT1PUNCHSPLASH00, &local_18); + dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTT1PUNCHSPLASH01, &local_18); + dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTT1PUNCHHAMON00, &local_18); + dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_KGTCOMMONSPLASH01, &local_18, 0xFF, g_whiteColor, g_whiteColor, 0); + dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_KGTCOMMONHAMON01, &local_18, 0xFF, g_whiteColor, g_whiteColor, 0); + } + } + return NULL; } /* 0000290C-00002938 .text bomb_splash_check__FP9bgn_class */ -void bomb_splash_check(bgn_class*) { - /* Nonmatching */ +static void bomb_splash_check(bgn_class* i_this) { + fpcM_Search(s_b_sub, i_this); } /* 00002938-00002CD4 .text attack_eff_set__FP9bgn_class4cXyzi */ -void attack_eff_set(bgn_class*, cXyz, int) { - /* Nonmatching */ +static void attack_eff_set(bgn_class* i_this, cXyz param_2, int param_3) { + fopAc_ac_c* actor = &i_this->actor; + JPABaseEmitter* emitter; + + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); + if (!gr_check(i_this, ¶m_2)) { + dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTT1PUNCHSPLASH00, ¶m_2); + dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTT1PUNCHSPLASH01, ¶m_2); + dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTT1PUNCHHAMON00, ¶m_2); + dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_KGTCOMMONSPLASH01, ¶m_2, 0xFF, g_whiteColor, g_whiteColor, 0); + dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_KGTCOMMONHAMON01, ¶m_2, 0xFF, g_whiteColor, g_whiteColor, 0); + if (param_3 <= 1) { + fopAcM_seStart(player, JA_SE_CM_BGN_D_HIT_PUNCH_W, 0); + } else { + fopAcM_seStart(player, JA_SE_CM_BGN_D_FALL_WATER, 0); + } + } else { + if (param_3 <= 1) { + fopAcM_seStart(player, JA_SE_CM_BGN_D_HIT_PUNCH, 0); + } else { + fopAcM_seStart(player, JA_SE_CM_BGN_D_FALL, 0); + } + if (param_3 > 1) { + param_3 = 1; + } + i_this->mPunchSmokeCb[param_3].remove(); + emitter = dComIfGp_particle_setToon( + dPa_name::ID_AK_ST_KGTT1PUNCHSMOKE00, ¶m_2, NULL, NULL, 0xa0, &i_this->mPunchSmokeCb[param_3], fopAcM_GetRoomNo(actor) + ); + if (emitter != NULL) { + emitter->setGlobalPrmColor(bg_tevstr.mColorC0.r, bg_tevstr.mColorC0.g, bg_tevstr.mColorC0.b); + emitter->setGlobalEnvColor(bg_tevstr.mColorK0.r, bg_tevstr.mColorK0.g, bg_tevstr.mColorK0.b); + } + dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTT1PUNCHHAHEN00, ¶m_2); + } } /* 00002CD4-00003144 .text part_control_0__FP9bgn_classiP6part_sP6move_sf */ -void part_control_0(bgn_class*, int, part_s*, move_s*, float) { - /* Nonmatching */ +static void part_control_0(bgn_class* i_this, int param_2, part_s* param_3, move_s* param_4, f32 param_5) { + cXyz local_d0; + cXyz cStack_dc; + cXyz local_e8; + + local_e8.setall(0.0f); + if ((param_3 == &i_this->mHeadParts[0]) && (i_this->mAAA8[0].m2D0 != 0 || (i_this->mAAA8[1].m2D0 != 0))) { + cMtx_YrotS(*calc_mtx, i_this->mC314.y); + local_d0.x = 0.0f; + local_d0.y = 0.0f; + local_d0.z = REG0_F(6) + 200.0f; + MtxPosition(&local_d0, &local_e8); + } else if ((param_3 == &i_this->mLeftArmParts[0]) && (i_this->mAAA8[3].m2D0 != 0)) { + cMtx_YrotS(*calc_mtx, i_this->mC314.y); + local_d0.x = REG0_F(8) + 20.0f; + local_d0.y = 0.0f; + local_d0.z = 0.0f; + MtxPosition(&local_d0, &local_e8); + } else if ((param_3 == &i_this->mRightArmParts[0]) && (i_this->mAAA8[4].m2D0 != 0)) { + cMtx_YrotS(*calc_mtx, i_this->mC314.y); + local_d0.x = -(REG0_F(8) + 20.0f); + local_d0.y = 0.0f; + local_d0.z = 0.0f; + MtxPosition(&local_d0, &local_e8); + } + f32 temp_f26; + f32 temp_f30; + f32 temp_f25; + f32 dVar11 = ((i_this->mC7BC - 50.0f) + REG0_F(6)); + f32 dVar10; + param_3++; + if (param_4->m2D0 == 0) { + dVar10 = l_HIO.m16C; + } else if (i_this->mCSMode != 0) { + dVar10 = -40.0f; + } else { + dVar10 = l_HIO.m170; + } + for (s32 i = 1; i < param_2 + 1; i++, param_3++) { + f32 y2 = param_3->m0D4.y + dVar10; + f32 fVar3 = dVar11 * param_3[-1].m0F4; + if (y2 <= fVar3) { + y2 = fVar3; + } + temp_f30 = local_e8.x + (param_3->m0D4.x - param_3[-1].m0D4.x); + temp_f26 = y2 - param_3[-1].m0D4.y; + temp_f25 = local_e8.z + (param_3->m0D4.z - param_3[-1].m0D4.z); + int iVar5 = param_4->m2F4 * cM_ssin(param_4->m2FA + i * (REG0_S(3) + 8000)); + int iVar2 = param_4->m2F4 * cM_scos(param_4->m2FC + i * (REG0_S(4) + 9000)); + param_3[-1].m0E0.x = (s16)(iVar5 - cM_atan2s(temp_f26, temp_f25)); + param_3[-1].m0E0.y = (s16)(iVar2 + cM_atan2s(temp_f30, std::sqrtf(SQUARE(temp_f26) + SQUARE(temp_f25)))); + cMtx_XrotS(*calc_mtx, param_3[-1].m0E0.x); + cMtx_YrotM(*calc_mtx, param_3[-1].m0E0.y); + local_d0.set(0.0f, 0.0f, i_this->mCC80 * (param_5 * param_3[-1].m0F4)); + MtxPosition(&local_d0, &cStack_dc); + param_3->m0D4 = param_3[-1].m0D4 + cStack_dc; + } } /* 00003144-00003624 .text part_control_0Z__FP9bgn_classiP6part_sP6move_sf */ -void part_control_0Z(bgn_class*, int, part_s*, move_s*, float) { - /* Nonmatching */ +static void part_control_0Z(bgn_class* i_this, int param_2, part_s* param_3, move_s* param_4, f32 param_5) { + fopAc_ac_c* actor = &i_this->actor; + f32 x; + f32 y; + f32 z; + f32 dVar10; + f32 dVar9; + cXyz local_f8; + cXyz cStack_104; + cXyz local_11c; + cXyz local_128; + cXyz local_134; + + cMtx_YrotS(*calc_mtx, i_this->mC314.y); + if (param_3 == &i_this->mLeftArmParts[0]) { + local_f8.x = REG0_F(8) + 20.0f; + local_f8.y = 0.0f; + local_f8.z = 0.0f; + MtxPosition(&local_f8, &local_128); + } else if (param_3 == &i_this->mRightArmParts[0]) { + local_f8.x = -(REG0_F(8) + 20.0f); + local_f8.y = 0.0f; + local_f8.z = 0.0f; + MtxPosition(&local_f8, &local_128); + } else if (param_3 == &i_this->mTailParts[0]) { + local_f8.x = 0.0f; + local_f8.y = 0.0f; + local_f8.z = REG0_F(6) + -5.0f; + MtxPosition(&local_f8, &local_128); + } + dVar10 = i_this->mC7BC; + dVar9 = l_HIO.m170; + param_3++; + for (s32 i = 1; i < param_2 + 1; i++, param_3++) { + f32 dVar11 = param_3->m0D4.y + dVar9; + if (dVar11 <= dVar10) { + dVar11 = dVar10; + if ((i == param_2) && ((i_this->mC746 & 7) == 0)) { + local_134 = param_3->m0D4; + if (!(gr_check(i_this, &local_134))) { + dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_KGTCOMMONHAMON03, &local_134, 0xff, g_whiteColor, g_whiteColor, 0); + if (i_this->m0304 == 0) { + i_this->m0304 = cM_rndF(20.0f) + 20.0f; + i_this->m0308 = local_134; + mDoAud_seStart(JA_SE_CM_BGN_BODY_RIPPLE, &i_this->m0308, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + } + } + } + f32 f1 = (param_2 - i); + local_11c.x = local_128.x * f1; + local_11c.z = local_128.z * f1; + x = local_11c.x + (param_3->m0D4.x - param_3[-1].m0D4.x); + y = (dVar11 - param_3[-1].m0D4.y); + z = local_11c.z + (param_3->m0D4.z - param_3[-1].m0D4.z); + int iVar2 = param_4->m2F4 * cM_ssin(param_4->m2FA + i * (REG0_S(3) + 8000)); + int iVar4 = param_4->m2F4 * cM_scos(param_4->m2FC + i * (REG0_S(4) + 9000)); + param_3[-1].m0E0.y = (s16)(iVar4 + cM_atan2s(x, z)); + param_3[-1].m0E0.x = (s16)(iVar2 - cM_atan2s(y, std::sqrtf(SQUARE(x) + SQUARE(z)))); + cMtx_YrotS(*calc_mtx, param_3[-1].m0E0.y); + cMtx_XrotM(*calc_mtx, param_3[-1].m0E0.x); + local_f8.set(0.0f, 0.0f, i_this->mCC80 * (param_5 * param_3[-1].m0F4)); + MtxPosition(&local_f8, &cStack_104); + param_3->m0D4 = param_3[-1].m0D4 + cStack_104; + } } /* 00003624-0000385C .text part_control_2__FP9bgn_classiP6part_sf */ -void part_control_2(bgn_class*, int, part_s*, float) { - /* Nonmatching */ +static void part_control_2(bgn_class*, int param_2, part_s* param_3, f32 param_4) { + cXyz local_84; + cXyz cStack_90; + cXyz local_9c; + + local_9c = param_3->m0D4; + s32 i; + s16 iVar4; + int iVar5; + part_s* ppVar6 = ¶m_3[param_2 - 1]; + for (i = param_2 - 1; i >= 0; i--, ppVar6--) { + f32 x = ppVar6[0].m0D4.x - ppVar6[1].m0D4.x; + f32 y = ppVar6[0].m0D4.y - ppVar6[1].m0D4.y; + f32 z = ppVar6[0].m0D4.z - ppVar6[1].m0D4.z; + iVar4 = -cM_atan2s(y, z); + iVar5 = cM_atan2s(x, std::sqrtf(SQUARE(y) + SQUARE(z))); + cMtx_XrotS(*calc_mtx, iVar4); + cMtx_YrotM(*calc_mtx, iVar5); + local_84.set(0.0f, 0.0f, param_4 * ppVar6[0].m0F4); + MtxPosition(&local_84, &cStack_90); + ppVar6[0].m0D4 = ppVar6[1].m0D4 + cStack_90; + } + ppVar6++; + local_84 = ppVar6[0].m0D4 - local_9c; + for (i = 0; i < param_2; i++, ppVar6++) { + ppVar6[0].m0D4 -= local_84; + } } /* 0000385C-00003FD0 .text part_mtx_set__FP9bgn_classiP6part_sii */ -void part_mtx_set(bgn_class*, int, part_s*, int, int) { - /* Nonmatching */ +static void part_mtx_set(bgn_class* i_this, int param_2, part_s* param_3, int param_4, int param_5) { + fopAc_ac_c* actor = &i_this->actor; + int iVar1; + f32 fVar4; + f32 fVar5; + s32 uVar7; + s16 sVar8; + f32 dVar10; + cXyz local_8c; + cXyz local_98; + + local_8c.z = 0.0f; + local_8c.y = 0.0f; + local_8c.x = 0.0f; + for (s32 i = 0; i < param_2; i++, param_3++) { + if (i_this->m0302 == param_3->m0D2) { + param_3->mPartArrowHitFlashTimer = 50; +#if VERSION > VERSION_DEMO + param_3->mPartArrowHitEffectTimer = 100; +#endif + } + if (param_3->mPartArrowHitFlashTimer != 0) { + param_3->mPartArrowHitFlashTimer--; + } + cLib_addCalcAngleS2(¶m_3->m0E0.z, i_this->mC314.y, 4, 0x2000); + if (param_3->m0D4.y <= i_this->mC7BC) { + param_3->m0D4.y = i_this->mC7BC; + } + MtxTrans(param_3->m0D4.x, param_3->m0D4.y, param_3->m0D4.z, false); + if ((param_4 == 7) && (i_this->mAAA8[7].m2D0 != 0)) { + cMtx_YrotM(*calc_mtx, param_3->m0E0.y); + cMtx_XrotM(*calc_mtx, param_3->m0E0.x); + cMtx_ZrotM(*calc_mtx, -param_3->m0E0.z); + } else { + cMtx_XrotM(*calc_mtx, param_3->m0E0.x); + cMtx_YrotM(*calc_mtx, param_3->m0E0.y); + if (param_3->m0E0.x < 0) { + cMtx_ZrotM(*calc_mtx, param_3->m0E0.z); + } else { + cMtx_ZrotM(*calc_mtx, -param_3->m0E0.z); + } + } + fVar4 = param_3->m0F4 * l_HIO.m0F4; + dVar10 = fVar4; + if ((i != param_2 + -1) && (param_4 == 3 || (param_4 == 4))) { + fVar5 = (REG0_F(0) + 0.005f) * (i_this->mC324[param_4 + -3] - l_HIO.m124) + 1.0f; + } else { + fVar5 = 1.0f; + } + MtxScale(fVar4, fVar4, dVar10 * fVar5, true); + if (param_4 == 0) { + uVar7 = (s16)(i_this->mAAA8[0].m300 + i_this->mAAA8[1].m300); + fVar4 = (s32)(uVar7) * (REG0_F(14) + 170.0f); + sVar8 = fVar4 * cM_ssin(uVar7 * 0x2100); + iVar1 = (int)(fVar4 * cM_ssin(sVar8 * 0x2300)); + cMtx_YrotM(*calc_mtx, i_this->mC744 + l_HIO.m03C + iVar1); + cMtx_ZrotM(*calc_mtx, l_HIO.m040 + sVar8); + } + MtxTrans(0.0f, 0.0f, l_HIO.m168, true); + if (param_4 == 0) { + MtxTrans(0.0f, l_HIO.m034, l_HIO.m038, true); + cMtx_XrotM(*calc_mtx, l_HIO.m03E); + } + if ((param_4 == 7) && (i == param_2 + -1)) { + if (actor->health == 3) { + param_3->mpPartModel = i_this->mpJyakutenAModel; + } else if (actor->health == 2) { + param_3->mpPartModel = i_this->mpJyakutenBModel; + } else if (actor->health == 1) { + param_3->mpPartModel = i_this->mpJyakutenCModel; + } else { + param_3->mpPartModel = NULL; + } + } + if (param_3->mpPartModel != NULL) { + param_3->mpPartModel->setBaseTRMtx(*calc_mtx); + } + if (param_4 == 0) { + if (((i_this->mAAA8[0].m2D0 == 0) || (i_this->mAAA8[1].m2D0 == 0)) || ((int)i_this->mpMorf->getFrame() != 0x18)) { + i_this->mpMorf->play(NULL, 0, 0); + } + i_this->mpMorf->calc(); + } + MtxPosition(&zero, &local_98); + param_3->m224 = local_98; + if ((param_4 == 7) && (i == param_2 + -1)) { + i_this->mCoreSph.SetR(REG0_F(4) + 150.0f); + i_this->mCoreSph.SetC(local_98); + i_this->mCA54 = local_98; + dComIfG_Ccsp()->Set(&i_this->mCoreSph); + } + param_3->mPartSph.SetR(dVar10 * (120.0f + REG0_F(0))); + param_3->mPartSph.SetC(local_98); + dComIfG_Ccsp()->Set(¶m_3->mPartSph); + if (i == param_5) { + if (param_4 == 0) { + local_8c.set(90.0f, 180.0f, -40.0f); + MtxPosition(&local_8c, &i_this->mC33C[0]); + local_8c.x *= -1.0f; + MtxPosition(&local_8c, &i_this->mC33C[1]); + } else { + local_8c.y = 0.0f; + local_8c.x = 0.0f; + local_8c.z = l_HIO.m168; + MtxPosition(&local_8c, &i_this->mC33C[param_4]); + } + local_8c.z = 0.0f; + local_8c.x = 0.0f; + } +#if VERSION > VERSION_DEMO + if (param_3->mPartArrowHitEffectTimer != 0) { + param_3->mPartArrowHitEffectTimer--; + fVar4 = (REG8_F(0) + 0.04f) * (param_3->m0F4 * param_3->mPartArrowHitEffectTimer); + if (param_3->mpPartArrowHitEmitter1 == NULL) { + param_3->mpPartArrowHitEmitter1 = dComIfGp_particle_set(dPa_name::ID_AK_JN_CCTHUNDER00, ¶m_3->m0D4); + } else { + param_3->mpPartArrowHitEmitter1->setGlobalTranslation(param_3->m0D4.x, param_3->m0D4.y, param_3->m0D4.z); + JGeometry::TVec3 scale(fVar4, fVar4, fVar4); + param_3->mpPartArrowHitEmitter1->setGlobalScale(scale); + } + if (param_3->mpPartArrowHitEmitter2 == NULL) { + local_8c.setall(fVar4); + param_3->mpPartArrowHitEmitter2 = dComIfGp_particle_set(dPa_name::ID_AK_JN_CCTHUNDER01, ¶m_3->m0D4); + } else { + param_3->mpPartArrowHitEmitter2->setGlobalTranslation(param_3->m0D4.x, param_3->m0D4.y, param_3->m0D4.z); + JGeometry::TVec3 scale(fVar4, fVar4, fVar4); + param_3->mpPartArrowHitEmitter2->setGlobalScale(scale); + } + } else { + if (param_3->mpPartArrowHitEmitter1 != NULL) { + param_3->mpPartArrowHitEmitter1->becomeInvalidEmitter(); + param_3->mpPartArrowHitEmitter1 = NULL; + } + if (param_3->mpPartArrowHitEmitter2 != NULL) { + param_3->mpPartArrowHitEmitter2->becomeInvalidEmitter(); + param_3->mpPartArrowHitEmitter2 = NULL; + } + } +#endif + } } /* 00003FD0-000044DC .text damage_check__FP9bgn_class */ -void damage_check(bgn_class*) { - /* Nonmatching */ +static void damage_check(bgn_class* i_this) { + /* Nonmatching - retail-only regalloc */ + fopAc_ac_c* actor = &i_this->actor; + JPABaseEmitter* emitter; + char cVar5; + f32 dVar8; + CcAtInfo atInfo; + + if (i_this->mC7B6 == 0) { + atInfo.pParticlePos = NULL; + if (i_this->mCoreSph.ChkTgHit()) { + atInfo.mpObj = i_this->mCoreSph.GetTgHitObj(); + i_this->m0302 = 1; + i_this->mC7B6 = 100; + i_this->mC748 = 5; + i_this->mC74A = 0; + i_this->mC779 = 0; + i_this->mC778 = 0; + if (actor->health != 0) { + actor->health--; +#if VERSION == VERSION_DEMO + fopAcM_seStart(actor, JA_SE_LK_ARROW_HIT, 0x35); +#else + mDoAud_seStart(JA_SE_LK_ARROW_HIT, NULL, 0x35, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); +#endif + dVar8 = (REG0_F(5) + 2.0f); + if (actor->health == 0) { + mDoAud_bgmStop(30); + i_this->mC748 = 6; + i_this->mC74A = 0; + emitter = dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTBREAKWEAKPOINT00, &i_this->mCA54); + if (emitter != NULL) { + JGeometry::TVec3 scale(dVar8, dVar8, dVar8); + emitter->setGlobalScale(scale); + } + emitter = dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTBREAKWEAKPOINT01, &i_this->mCA54); + if (emitter != NULL) { + JGeometry::TVec3 scale(dVar8, dVar8, dVar8); + emitter->setGlobalScale(scale); + } +#if VERSION == VERSION_DEMO + fopAcM_monsSeStart(actor, JA_SE_CV_BGN_HIT_2, 0); + fopAcM_seStart(actor, JA_SE_LK_LAST_HIT, 0); + fopAcM_seStart(actor, JA_SE_CM_BGN_M_BRK_ORB, 0); +#else + mDoAud_monsSeStart(JA_SE_CV_BGN_HIT_2, NULL, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + mDoAud_seStart(JA_SE_LK_LAST_HIT, NULL, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + mDoAud_seStart(JA_SE_CM_BGN_M_BRK_ORB, NULL, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); +#endif + } else { + emitter = dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTHITWEAKPOINT00, &i_this->mCA54); + if (emitter != NULL) { + JGeometry::TVec3 scale(dVar8, dVar8, dVar8); + emitter->setGlobalScale(scale); + } +#if VERSION == VERSION_DEMO + fopAcM_monsSeStart(actor, JA_SE_CV_BGN_HIT_1, 0); +#else + mDoAud_monsSeStart(JA_SE_CV_BGN_HIT_1, NULL, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); +#endif + } + } + } + cVar5 = 0; + if (i_this->mC7FC.ChkTgHit()) { + atInfo.mpObj = i_this->mC7FC.GetTgHitObj(); + cVar5 = 1; + } + if (i_this->mHeadParts[0].mPartSph.ChkTgHit()) { + atInfo.mpObj = i_this->mHeadParts[0].mPartSph.GetTgHitObj(); + cVar5 = 2; + } + if (i_this->mPelvisParts[0].mPartSph.ChkTgHit()) { + atInfo.mpObj = i_this->mPelvisParts[0].mPartSph.GetTgHitObj(); + cVar5 = 3; + } + for (s32 i = 0; i < 20; i++) { + if (i_this->mLeftArmParts[i].mPartSph.ChkTgHit()) { + atInfo.mpObj = i_this->mLeftArmParts[i].mPartSph.GetTgHitObj(); + cVar5 = 4; + } + if (i_this->mRightArmParts[i].mPartSph.ChkTgHit()) { + atInfo.mpObj = i_this->mRightArmParts[i].mPartSph.GetTgHitObj(); + cVar5 = 5; + } + } + for (s32 i = 0; i < 3; i++) { + if (i_this->mLeftLegParts[i].mPartSph.ChkTgHit()) { + atInfo.mpObj = i_this->mLeftLegParts[i].mPartSph.GetTgHitObj(); + cVar5 = 6; + } + if (i_this->mRightLegParts[i].mPartSph.ChkTgHit()) { + atInfo.mpObj = i_this->mRightLegParts[i].mPartSph.GetTgHitObj(); + cVar5 = 7; + } + } + for (s32 i = 0; i < 20; i++) { + if (i_this->mTailParts[i].mPartSph.ChkTgHit()) { + atInfo.mpObj = i_this->mTailParts[i].mPartSph.GetTgHitObj(); + cVar5 = 8; + } + } + if ((cVar5 != 0) && (i_this->mC7B8 == 0)) { + i_this->mC7B8 = 10; + def_se_set(actor, atInfo.mpObj, 0x44); + } + } } /* 00004518-000047D0 .text size_set__FP9bgn_class */ -void size_set(bgn_class*) { - /* Nonmatching */ +static void size_set(bgn_class* i_this) { + i_this->mHeadParts[0].m0F4 = l_HIO.m0F8; + i_this->mPelvisParts[0].m0F4 = l_HIO.m100; + i_this->mPelvisParts[1].m0F4 = l_HIO.m100; + f32 fVar2 = (1.0f / (BGN_HAND_MAX - 2)) * (l_HIO.m104 - l_HIO.m108); + i_this->mLeftArmParts[0].m0F4 = l_HIO.m104 - fVar2; + i_this->mRightArmParts[0].m0F4 = l_HIO.m104 - fVar2; + for (s32 i = 1; i < BGN_HAND_MAX; i++) { + i_this->mLeftArmParts[i].m0F4 = l_HIO.m104 - fVar2 * (i - 1); + i_this->mRightArmParts[i].m0F4 = l_HIO.m104 - fVar2 * (i - 1); + } + i_this->mLeftArmParts[BGN_HAND_MAX].m0F4 = l_HIO.m108; + i_this->mRightArmParts[BGN_HAND_MAX].m0F4 = l_HIO.m108; + fVar2 = 0.5f * (l_HIO.m104 - l_HIO.m108); + fVar2 += l_HIO.m108; + for (s32 i = 0; i < BGN_HAND_MAX; i++) { + i_this->mLeftArmParts[i].m0F4 += 2.0f * (i_this->mC32C[0] * (fVar2 - i_this->mLeftArmParts[i].m0F4)); + i_this->mRightArmParts[i].m0F4 += 2.0f * (i_this->mC32C[1] * (fVar2 - i_this->mRightArmParts[i].m0F4)); + } + fVar2 = 0.5f * (l_HIO.m10C - l_HIO.m110); + for (s32 i = 0; i < 3; i++) { + i_this->mLeftLegParts[i].m0F4 = l_HIO.m10C - fVar2 * i; + i_this->mRightLegParts[i].m0F4 = l_HIO.m10C - fVar2 * i; + } + i_this->mLeftLegParts[3].m0F4 = l_HIO.m110; + i_this->mRightLegParts[3].m0F4 = l_HIO.m110; + fVar2 = (1.0f / (BGN_TAIL_MAX - 1)) * (l_HIO.m114 - l_HIO.m118); + for (s32 i = 0; i < BGN_TAIL_MAX; i++) { + i_this->mTailParts[i].m0F4 = l_HIO.m114 - (fVar2 * i); + } + i_this->mRightLegParts[BGN_TAIL_MAX + 3].m0F4 = l_HIO.m114 * 0.7f; + i_this->mTailParts[BGN_TAIL_MAX].m0F4 = l_HIO.m114 * 0.7f; } /* 000047D0-000056DC .text shape_calc__FP9bgn_class */ -void shape_calc(bgn_class*) { - /* Nonmatching */ +static void shape_calc(bgn_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + f32 fVar3; + s16 sVar8; + s16 sVar5; + f32 dVar11; + f32 dVar10; + f32 dVar9; + f32 dVar13; + f32 dVar12; + cXyz local_8c; + cXyz cStack_98; + cXyz local_b0; + + local_b0 = i_this->mC308; + local_b0.y = i_this->mC308.y + (l_HIO.m0A8); + fVar3 = i_this->mC7BC + 100.0f + REG0_F(0); + if (local_b0.y <= fVar3) { + local_b0.y = fVar3; + } + if (i_this->m0302 == 0xd) { + i_this->mArrowHitFlashTimer = 50; +#if VERSION > VERSION_DEMO + i_this->mArrowHitEffectTimer = 100; +#endif + } + MtxTrans(local_b0.x, local_b0.y, local_b0.z, false); + sVar8 = 0; + sVar5 = 0; + if (i_this->mC770 != 0) { + i_this->mC770--; + fVar3 = (i_this->mC770) * (REG0_F(14) + 300.0f); + sVar8 = (fVar3 * cM_ssin(i_this->mC746 * 0x1c00)); + sVar5 = (fVar3 * cM_scos(i_this->mC746 * 0x1900)); + } + cMtx_YrotM(*calc_mtx, i_this->mC314.y); + cMtx_XrotM(*calc_mtx, i_this->mC314.x + sVar8); + cMtx_ZrotM(*calc_mtx, i_this->mC314.z + sVar5); + fVar3 = l_HIO.m0FC * l_HIO.m0F4; + dVar12 = fVar3; + MtxScale(fVar3, fVar3, fVar3, true); + MtxPush(); + cMtx_XrotM(*calc_mtx, l_HIO.m004); + if (i_this->mCC84 > 0.0f) { + sVar5 = i_this->mC746 * (REG0_S(4) + 0x900); + cMtx_ZrotM(*calc_mtx, sVar5); + MtxScale(i_this->mCC84 + 1.0f, 1.0f - i_this->mCC84, i_this->mCC84 + 1.0f, true); + cMtx_ZrotM(*calc_mtx, -sVar5); + } + i_this->mpChestModel->setBaseTRMtx(*calc_mtx); + i_this->mC7FC.SetR(dVar12 * (REG0_F(1) + 120.0f)); + i_this->mC7FC.SetC(i_this->mC308); + dComIfG_Ccsp()->Set(&i_this->mC7FC); +#if VERSION > VERSION_DEMO + if (i_this->mArrowHitEffectTimer != 0) { + i_this->mArrowHitEffectTimer--; + fVar3 = (REG8_F(1) + 0.03f) * (dVar12 * (i_this->mArrowHitEffectTimer)); + if (i_this->mpArrowHitEmitter1 == NULL) { + i_this->mpArrowHitEmitter1 = dComIfGp_particle_set(dPa_name::ID_AK_JN_CCTHUNDER00, &i_this->mC308); + } else { + i_this->mpArrowHitEmitter1->setGlobalTranslation(i_this->mC308.x, i_this->mC308.y, i_this->mC308.z); + JGeometry::TVec3 scale(fVar3, fVar3, fVar3); + i_this->mpArrowHitEmitter1->setGlobalScale(scale); + } + if (i_this->mpArrowHitEmitter2 == NULL) { + local_8c.setall(dVar12); + i_this->mpArrowHitEmitter2 = dComIfGp_particle_set(dPa_name::ID_AK_JN_CCTHUNDER01, &i_this->mC308); + } else { + i_this->mpArrowHitEmitter2->setGlobalTranslation(i_this->mC308.x, i_this->mC308.y, i_this->mC308.z); + JGeometry::TVec3 scale(fVar3, fVar3, fVar3); + i_this->mpArrowHitEmitter2->setGlobalScale(scale); + } + } else { + if (i_this->mpArrowHitEmitter1 != NULL) { + i_this->mpArrowHitEmitter1->becomeInvalidEmitter(); + i_this->mpArrowHitEmitter1 = NULL; + } + if (i_this->mpArrowHitEmitter2 != NULL) { + i_this->mpArrowHitEmitter2->becomeInvalidEmitter(); + i_this->mpArrowHitEmitter2 = NULL; + } + } +#endif + MtxPull(); + dVar12 = (l_HIO.m11C * l_HIO.m0F4); + dVar11 = (l_HIO.m120 * l_HIO.m0F4); + dVar10 = (i_this->mC324[0] * l_HIO.m0F4); + dVar9 = (i_this->mC324[1] * l_HIO.m0F4); + dVar13 = (l_HIO.m128 * l_HIO.m0F4); + MtxPush(); + local_8c.x = l_HIO.m12C; + local_8c.y = l_HIO.m130; + local_8c.z = l_HIO.m134; + MtxPosition(&local_8c, &i_this->mHeadParts[0].m0D4); + part_control_0(i_this, 1, &i_this->mHeadParts[0], &i_this->mAAA8[0], dVar12); + if ((i_this->mAAA8[0].m2D0 == 0) || (i_this->mAAA8[1].m2D0 == 0)) { + cMtx_YrotS(*calc_mtx, i_this->mC314.y); + local_8c.x = l_HIO.m054; + local_8c.y = l_HIO.m058; + local_8c.z = l_HIO.m05C; + local_8c += i_this->mAAA8[0].m2D4; + MtxPosition(&local_8c, &i_this->mHeadParts[1].m0D4); + i_this->mHeadParts[1].m0D4 += i_this->mC308; + part_control_2(i_this, 1, &i_this->mHeadParts[0], dVar12); + } + part_mtx_set(i_this, 1, &i_this->mHeadParts[0], 0, 0); + actor->eyePos = i_this->mHeadParts[0].m0D4; + actor->attention_info.position = actor->eyePos; + actor->attention_info.position.y += 50.0f; + MtxPull(); + MtxPush(); + local_8c.x = l_HIO.m144; + local_8c.y = l_HIO.m148 + 20.0f; + local_8c.z = l_HIO.m14C; + local_8c.x *= i_this->mCC80; + local_8c.y *= i_this->mCC80; + local_8c.z *= i_this->mCC80; + MtxPosition(&local_8c, &i_this->mPelvisParts[0].m0D4); + part_control_0(i_this, 1, &i_this->mPelvisParts[0], &i_this->mAAA8[2], dVar12); + if (i_this->mAAA8[2].m2D0 == 0) { + cMtx_YrotS(*calc_mtx, i_this->mC314.y); + local_8c.x = l_HIO.m060; + local_8c.y = l_HIO.m064; + local_8c.z = l_HIO.m068; + local_8c += i_this->mAAA8[2].m2D4; + MtxPosition(&local_8c, &i_this->mPelvisParts[1].m0D4); + i_this->mPelvisParts[1].m0D4 += i_this->mC308; + part_control_2(i_this, 1, &i_this->mPelvisParts[0], dVar12); + } + part_mtx_set(i_this, 1, &i_this->mPelvisParts[0], 2, 0); + MtxPull(); + MtxPush(); + local_8c.x = l_HIO.m138; + local_8c.y = l_HIO.m13C; + local_8c.z = l_HIO.m140; + local_8c.x *= i_this->mCC80; + local_8c.y *= i_this->mCC80; + local_8c.z *= i_this->mCC80; + MtxPosition(&local_8c, &i_this->mLeftArmParts[0].m0D4); + if (i_this->mAAA8[3].m2D0 == 0) { + part_control_0(i_this, BGN_HAND_MAX, &i_this->mLeftArmParts[0], &i_this->mAAA8[3], dVar10); + if (i_this->mC778 != 0) { + i_this->mLeftArmParts[BGN_HAND_MAX].m0D4 = i_this->mC77C; + } else { + cMtx_YrotS(*calc_mtx, i_this->mC314.y); + local_8c.x = l_HIO.m06C; + local_8c.y = l_HIO.m070; + local_8c.z = l_HIO.m074; + local_8c += i_this->mAAA8[3].m2D4; + MtxPosition(&local_8c, &i_this->mLeftArmParts[BGN_HAND_MAX].m0D4); + i_this->mLeftArmParts[BGN_HAND_MAX].m0D4 += i_this->mC308; + } + part_control_2(i_this, BGN_HAND_MAX, &i_this->mLeftArmParts[0], dVar10); + } else { + part_control_0(i_this, BGN_HAND_MAX, &i_this->mLeftArmParts[0], &i_this->mAAA8[3], dVar10); + } + part_mtx_set(i_this, BGN_HAND_MAX, &i_this->mLeftArmParts[0], 3, BGN_HAND_MAX + -1); + MtxPull(); + local_8c.x = -l_HIO.m138; + local_8c.y = l_HIO.m13C; + local_8c.z = l_HIO.m140; + local_8c.x *= i_this->mCC80; + local_8c.y *= i_this->mCC80; + local_8c.z *= i_this->mCC80; + MtxPosition(&local_8c, &i_this->mRightArmParts[0].m0D4); + if (i_this->mAAA8[4].m2D0 == 0) { + part_control_0(i_this, BGN_HAND_MAX, &i_this->mRightArmParts[0], &i_this->mAAA8[4], dVar9); + if (i_this->mC779 != 0) { + i_this->mRightArmParts[BGN_HAND_MAX].m0D4 = i_this->mC788; + } else { + cMtx_YrotS(*calc_mtx, i_this->mC314.y); + local_8c.x = l_HIO.m078; + local_8c.y = l_HIO.m07C; + local_8c.z = l_HIO.m080; + local_8c += i_this->mAAA8[4].m2D4; + MtxPosition(&local_8c, &i_this->mRightArmParts[BGN_HAND_MAX].m0D4); + i_this->mRightArmParts[BGN_HAND_MAX].m0D4 += i_this->mC308; + } + part_control_2(i_this, BGN_HAND_MAX, &i_this->mRightArmParts[0], dVar9); + } else { + part_control_0(i_this, BGN_HAND_MAX, &i_this->mRightArmParts[0], &i_this->mAAA8[4], dVar9); + } + part_mtx_set(i_this, BGN_HAND_MAX, &i_this->mRightArmParts[0], 4, BGN_HAND_MAX + -1); + cMtx_XrotS(*calc_mtx, i_this->mPelvisParts[0].m0E0.x); + cMtx_YrotM(*calc_mtx, i_this->mPelvisParts[0].m0E0.y); + cMtx_ZrotM(*calc_mtx, -i_this->mPelvisParts[0].m0E0.z); + fVar3 = l_HIO.m100 * l_HIO.m0F4; + MtxScale(fVar3, fVar3, fVar3, true); + MtxPush(); + local_8c.x = l_HIO.m150; + local_8c.y = l_HIO.m154; + local_8c.z = l_HIO.m158; + local_8c.x *= i_this->mCC80; + local_8c.y *= i_this->mCC80; + local_8c.z *= i_this->mCC80; + MtxPosition(&local_8c, &cStack_98); + i_this->mLeftLegParts[0].m0D4 = i_this->mPelvisParts[0].m0D4 + cStack_98; + part_control_0(i_this, 3, &i_this->mLeftLegParts[0], &i_this->mAAA8[5], dVar11); + if (i_this->mAAA8[5].m2D0 == 0) { + cMtx_YrotS(*calc_mtx, i_this->mC314.y); + local_8c.x = l_HIO.m084; + local_8c.y = l_HIO.m088; + local_8c.z = l_HIO.m08C; + local_8c += i_this->mAAA8[5].m2D4; + MtxPosition(&local_8c, &i_this->mLeftLegParts[3].m0D4); + i_this->mLeftLegParts[3].m0D4 += i_this->mC308; + part_control_2(i_this, 3, &i_this->mLeftLegParts[0], dVar11); + } + part_mtx_set(i_this, 3, &i_this->mLeftLegParts[0], 5, 2); + MtxPull(); + MtxPush(); + local_8c.x = -l_HIO.m150; + local_8c.y = l_HIO.m154; + local_8c.z = l_HIO.m158; + local_8c.x *= i_this->mCC80; + local_8c.y *= i_this->mCC80; + local_8c.z *= i_this->mCC80; + MtxPosition(&local_8c, &cStack_98); + i_this->mRightLegParts[0].m0D4 = i_this->mPelvisParts[0].m0D4 + cStack_98; + part_control_0(i_this, 3, &i_this->mRightLegParts[0], &i_this->mAAA8[6], dVar11); + if (i_this->mAAA8[6].m2D0 == 0) { + cMtx_YrotS(*calc_mtx, i_this->mC314.y); + local_8c.x = l_HIO.m090; + local_8c.y = l_HIO.m094; + local_8c.z = l_HIO.m098; + local_8c += i_this->mAAA8[6].m2D4; + MtxPosition(&local_8c, &i_this->mRightLegParts[3].m0D4); + i_this->mRightLegParts[3].m0D4 += i_this->mC308; + part_control_2(i_this, 3, &i_this->mRightLegParts[0], dVar11); + } + part_mtx_set(i_this, 3, &i_this->mRightLegParts[0], 6, 2); + MtxPull(); + local_8c.x = l_HIO.m15C; + local_8c.y = l_HIO.m160; + local_8c.z = l_HIO.m164; + local_8c.x *= i_this->mCC80; + local_8c.y *= i_this->mCC80; + local_8c.z *= i_this->mCC80; + MtxPosition(&local_8c, &cStack_98); + i_this->mTailParts[0].m0D4 = i_this->mPelvisParts[0].m0D4 + cStack_98; + if (i_this->mAAA8[7].m2D0 == 0) { + part_control_0(i_this, BGN_TAIL_MAX, &i_this->mTailParts[0], &i_this->mAAA8[7], dVar13); + cMtx_YrotS(*calc_mtx, i_this->mC314.y); + local_8c.x = l_HIO.m09C; + local_8c.y = l_HIO.m0A0; + local_8c.z = l_HIO.m0A4; + local_8c += i_this->mAAA8[7].m2D4; + MtxPosition(&local_8c, &i_this->mTailParts[BGN_TAIL_MAX].m0D4); + i_this->mTailParts[BGN_TAIL_MAX].m0D4 += i_this->mC308; + if (i_this->mTailParts[BGN_TAIL_MAX].m0D4.y <= i_this->mC7BC) { + i_this->mTailParts[BGN_TAIL_MAX].m0D4.y = i_this->mC7BC; + } + part_control_2(i_this, BGN_TAIL_MAX, &i_this->mTailParts[0], dVar13); + } else { + part_control_0Z(i_this, BGN_TAIL_MAX, &i_this->mTailParts[0], &i_this->mAAA8[7], dVar13); + } + part_mtx_set(i_this, BGN_TAIL_MAX, &i_this->mTailParts[0], 7, BGN_TAIL_MAX + -1); } /* 000056DC-000058F4 .text dance_A__FP9bgn_class */ -void dance_A(bgn_class*) { - /* Nonmatching */ +static void dance_A(bgn_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + s16 uVar2; + s16 target; + + for (s32 i = 0; i < 8; i++) { + move_s* tmp = &i_this->mAAA8[i]; + switch (i_this->mC74E) { + case 0: + i_this->mC74E++; + i_this->mC752 = 0; + // fallthrough + case 1: + tmp->m2E0 = dance_pause_1[i]; + if (i_this->mC7AC[3] == 0) { + i_this->mC74E++; + i_this->mC7AC[3] = l_HIO.m0DA; + } + break; + case 2: + tmp->m2E0 = dance_pause_2[i]; + if (i_this->mC7AC[3] == 0) { + i_this->mC74E = 1; + i_this->mC7AC[3] = l_HIO.m0DA; + } + break; + } + } + uVar2 = i_this->mC750; + i_this->mC750 = uVar2 + i_this->mC752; + if (((0 < uVar2) && (i_this->mC750 <= i_this->mC752)) || (0x8000 < (u16)uVar2 && ((u16)i_this->mC750 <= (u16)(i_this->mC752 + 0x8000)))) { + mDoAud_seStart(JA_SE_CM_BGN_D_KAZEKIRI, &i_this->mCA54, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + if (actor->health == 3) { + target = l_HIO.m0DC; + } else if (actor->health == 2) { + target = l_HIO.m0DE; + } else { + target = l_HIO.m0E0; + } + cLib_addCalcAngleS2(&i_this->mC752, target, 1, 0x10); } /* 000058F4-00005ACC .text dance_B__FP9bgn_class */ -void dance_B(bgn_class*) { - /* Nonmatching */ +static void dance_B(bgn_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + s16 sVar4; + + fopAcM_seStart(actor, JA_SE_CM_BGN_D_DANCE, 0); + for (s32 i = 0; i < 8; i++) { + move_s* tmp = &i_this->mAAA8[i]; + switch (i_this->mC74E) { + case 0: + tmp->m2E0 = dance_pause_3[i]; + if (i_this->mC7AC[3] == 0) { + i_this->mC74E++; + if (actor->health == 3) { + i_this->mC7AC[3] = l_HIO.m0E8; + } else if (actor->health == 2) { + i_this->mC7AC[3] = l_HIO.m0EA; + } else { + i_this->mC7AC[3] = l_HIO.m0EC; + } + } + break; + case 1: + tmp->m2E0 = dance_pause_4[i]; + if (i_this->mC7AC[3] == 0) { + i_this->mC74E = 0; + if (actor->health == 3) { + i_this->mC7AC[3] = l_HIO.m0E8; + } else if (actor->health == 2) { + i_this->mC7AC[3] = l_HIO.m0EA; + } else { + i_this->mC7AC[3] = l_HIO.m0EC; + } + } + break; + } + } + if (i_this->mC74E == 1) { + sVar4 = 0x1555; + } else { + sVar4 = -0x1555; + } + cLib_addCalcAngleS2(&i_this->mC750, sVar4, 8, l_HIO.m0EE); } /* 00005ACC-00005B2C .text ki_set__FP9bgn_class */ -void ki_set(bgn_class*) { - /* Nonmatching */ +static void ki_set(bgn_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + if (actor->health == 3) { + i_this->mKeeseSpawnNum = l_HIO.mKeeseNum3HP; + } else if (actor->health == 2) { + i_this->mKeeseSpawnNum = l_HIO.mKeeseNum2HP; + } else { + i_this->mKeeseSpawnNum = l_HIO.mKeeseNum1HP; + } } /* 00005B2C-0000616C .text dance_0__FP9bgn_class */ -void dance_0(bgn_class*) { - /* Nonmatching */ +static void dance_0(bgn_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + u8 uVar2; + + if (i_this->mC7AC[1] == 0) { + i_this->mC7AC[1] = cM_rndF(150.0f) + 50.0f; + i_this->mC758.x = cM_rndFX(1500.0f); + i_this->mC758.z = cM_rndFX(1500.0f); + i_this->mC76C = 0.0f; + } + cLib_addCalc2(&actor->current.pos.x, i_this->mC758.x, 0.05f, i_this->mC76C); + cLib_addCalc2(&actor->current.pos.z, i_this->mC758.z, 0.05f, i_this->mC76C); + cLib_addCalc2(&i_this->mC76C, REG0_F(19) + 20.0f, 1.0f, 0.5f); + cLib_addCalc2(&i_this->mC728.y, (REG0_F(9) + 50.0f) * cM_ssin(i_this->mC746 * (REG0_S(9) + 500)), 0.5f, REG0_F(8) + 20.0f); + if ((i_this->mAAA8[0].m2D0 == 0) || (i_this->mAAA8[1].m2D0 == 0)) { + cLib_addCalcAngleS2(&actor->shape_angle.y, fopAcM_searchPlayerAngleY(actor), 10, 0x400); + } + switch (i_this->mC74A) { + case 0: + if (i_this->mC754 == 0) { + i_this->mC74C = 0; + i_this->mC7AC[0] = l_HIO.m0D8; + ki_set(i_this); + } else { + i_this->mC74C = 1; + if (actor->health == 3) { + i_this->mC7AC[0] = l_HIO.m0E2; + } else if (actor->health == 2) { + i_this->mC7AC[0] = l_HIO.m0E4; + } else { + i_this->mC7AC[0] = l_HIO.m0E6; + } + } + i_this->mC74E = 0; + i_this->mC74A++; + goto block_51; + case 1: + if (((i_this->mC7AC[0] == 0) && (!ki_check(i_this))) && (l_HIO.m028 != 0)) { + if (((i_this->mC754 == 1) || (i_this->mC754 == 2)) || (i_this->mC754 == 3)) { + if (((i_this->mAAA8[0].m2D0 != 0) && (i_this->mAAA8[1].m2D0 != 0)) && (i_this->mC7AC[2] == 0)) { + i_this->mC748 = 4; + i_this->mC74A = 0; + i_this->mCA98 = 0.0f; + return; + } + i_this->mC748 = 1; + i_this->mC7AC[0] = REG0_S(0) + 0x32; + uVar2 = i_this->mAAA8[3].m2D0; + if ((uVar2 == 0) && (i_this->mAAA8[4].m2D0 == 0)) { + i_this->mC74A = 5; + i_this->mC7AC[0] = REG0_S(6) + 0x40; + fopAcM_monsSeStart(actor, JA_SE_CV_BGN_D_ATTACK, 0); + } else if (uVar2 == 0) { + i_this->mC74A = 3; + fopAcM_monsSeStart(actor, JA_SE_CV_BGN_D_ATTACK, 0); + } else if (i_this->mAAA8[4].m2D0 == 0) { + i_this->mC74A = 1; + fopAcM_monsSeStart(actor, JA_SE_CV_BGN_D_ATTACK, 0); + } else if (i_this->mAAA8[7].m2D0 == 0) { + i_this->mC748 = 3; + i_this->mC74A = 0; + } else { + i_this->mC748 = 2; + i_this->mC74A = 0; + } + } else if ((i_this->mC754 == 0) || (i_this->mC754 == 5)) { + i_this->mC74A = 0; + } + i_this->mC754++; + if (i_this->mC754 > 5) { + i_this->mC754 = 0; + } + // fallthrough + } + default: + block_51: + switch (i_this->mC74C) { + case 0: + dance_A(i_this); + break; + case 1: + dance_B(i_this); + break; + } + } + move_s* pmVar8 = i_this->mAAA8; + for (s32 i = 0; i < 8; i++, pmVar8++) { + if (pmVar8->m2D0 == 0) { + cXyz local_34; + local_34.x = pmVar8->m2E0.x - pmVar8->m2D4.x; + local_34.y = pmVar8->m2E0.y - pmVar8->m2D4.y; + local_34.z = pmVar8->m2E0.z - pmVar8->m2D4.z; + f32 fVar9 = local_34.abs(); + f32 temp_f0_4 = REG0_F(0) + 100.0f; + if (fVar9 > temp_f0_4) { + f32 f4 = (fVar9 - temp_f0_4); + if ((s16)(int)(REG0_F(2) + (50.0f + (f4 * (REG0_F(1) + 0.06f)))) > pmVar8->m2F8) { + pmVar8->m2F8 = (s16)(int)(REG0_F(2) + (50.0f + (f4 * (REG0_F(1) + 0.06f)))); + } + } + } + } } /* 0000616C-00007108 .text punch_LR__FP9bgn_class */ -void punch_LR(bgn_class*) { - /* Nonmatching */ +static void punch_LR(bgn_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + s8 bVar2; + s8 bVar3; + s16 sVar7; + s32 uVar11; + cXyz local_6c; + cXyz local_84; + cXyz local_90; + + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); + bVar2 = false; + cLib_addCalc0(&i_this->mC728.y, 0.5f, 20.0f); + bVar3 = false; + uVar11 = 0; + local_90 = player->current.pos; + if ((i_this->mAAA8[0].m2D0 != 0) && (i_this->mAAA8[1].m2D0 != 0)) { + cMtx_YrotS(*calc_mtx, actor->shape_angle.y); + local_6c.x = cM_rndFX(1000.0f); + local_6c.y = 0.0f; + local_6c.z = cM_rndF(1000.0f) + 1000.0f; + MtxPosition(&local_6c, &local_90); + local_90 += actor->current.pos; + local_90.y = 0.0f; + } + switch (i_this->mC74A) { + case 1: + bVar3 = true; + uVar11 = 2; + i_this->mC338 = 130.0f; + if (i_this->mC7AC[0] == 0x14) { + i_this->mC788 = i_this->mRightArmParts[BGN_HAND_MAX].m0D4; + local_84 = local_90 - i_this->mC788; + cMtx_YrotS(*calc_mtx, cM_atan2s(local_84.x, local_84.z)); + cMtx_XrotM(*calc_mtx, -cM_atan2s(local_84.y, std::sqrtf(SQUARE(local_84.x) + SQUARE(local_84.z)))); + local_6c.x = 0.0f; + local_6c.y = 0.0f; + local_6c.z = REG0_F(7) + 200.0f; + MtxPosition(&local_6c, &i_this->mC7A0); + } + if (i_this->mC7AC[0] != 0) { + break; + } + i_this->mC779 = 1; + i_this->mC74A++; + i_this->mC7AC[0] = REG0_S(1) + 0x32; + fopAcM_seStart(actor, JA_SE_CM_BGN_D_PUNCH_FIRE, 0); + // fallthrough + case 2: + uVar11 = 2; + i_this->mC338 = 200.0f; + i_this->mC334 = 200.0f; + i_this->mRightArmParts[BGN_HAND_MAX - 1].mPartSph.OnAtSetBit(); + i_this->mC788 += i_this->mC7A0; + i_this->mAAA8[4].m2E8 = 100.0f; + if ((i_this->mC7AC[0] == 0) || (i_this->mLeftArmParts[BGN_HAND_MAX + 0x14].m0D4.y < i_this->mC7BC + 30.0f)) { + dComIfGp_getVibration().StartShock(REG0_S(2) + 5, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + i_this->mC779 = 0; + i_this->mAAA8[4].m2F4 = REG0_F(15) + 5000.0f; + bVar2 = true; + i_this->mAAA8[4].m2E0.x = i_this->mLeftArmParts[BGN_HAND_MAX + 0x14].m0D4.x; + i_this->mAAA8[4].m2E0.y = i_this->mLeftArmParts[BGN_HAND_MAX + 0x14].m0D4.y; + i_this->mAAA8[4].m2E0.z = i_this->mLeftArmParts[BGN_HAND_MAX + 0x14].m0D4.z; + attack_eff_set(i_this, i_this->mRightArmParts[BGN_HAND_MAX - 1].m0D4, 1); + } + break; + case 3: + bVar3 = true; + uVar11 = 1; + i_this->mC338 = 200.0f; + i_this->mC334 = 200.0f; + if (i_this->mC7AC[0] == 0x14) { + i_this->mC77C = i_this->mLeftArmParts[BGN_HAND_MAX - 1].m0D4; + local_84 = local_90 - i_this->mC77C; + cMtx_YrotS(*calc_mtx, cM_atan2s(local_84.x, local_84.z)); + cMtx_XrotM(*calc_mtx, -cM_atan2s(local_84.y, std::sqrtf(SQUARE(local_84.x) + SQUARE(local_84.z)))); + local_6c.x = 0.0f; + local_6c.y = 0.0f; + local_6c.z = REG0_F(7) + 200.0f; + MtxPosition(&local_6c, &i_this->mC794); + } + if (i_this->mC7AC[0] != 0) { + break; + } + i_this->mC74A++; + i_this->mC7AC[0] = REG0_S(1) + 0x32; + i_this->mC778 = 1; + fopAcM_seStart(actor, JA_SE_CM_BGN_D_PUNCH_FIRE, 0); + // fallthrough + case 4: + uVar11 = 1; + i_this->mLeftArmParts[BGN_HAND_MAX - 1].mPartSph.OnAtSetBit(); + i_this->mC77C += i_this->mC794; + i_this->mC338 = 200.0f; + if ((i_this->mC7AC[0] == 0) || (i_this->mPelvisParts[BGN_HAND_MAX + 1].m0D4.y < i_this->mC7BC + 30.0f)) { + dComIfGp_getVibration().StartShock(REG0_S(2) + 5, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + i_this->mAAA8[3].m2F4 = REG0_F(15) + 5000.0f; + i_this->mC778 = 0; + bVar2 = true; + i_this->mAAA8[3].m2E0.x = i_this->mPelvisParts[BGN_HAND_MAX + 1].m0D4.x; + i_this->mAAA8[3].m2E0.y = i_this->mPelvisParts[BGN_HAND_MAX + 1].m0D4.y; + i_this->mAAA8[3].m2E0.z = i_this->mPelvisParts[BGN_HAND_MAX + 1].m0D4.z; + attack_eff_set(i_this, i_this->mLeftArmParts[BGN_HAND_MAX - 1].m0D4, 0); + } + break; + case 5: + bVar3 = true; + uVar11 = 3; + i_this->mC338 = 50.0f; + if (i_this->mC7AC[0] == 0x14) { + i_this->mC77C = i_this->mLeftArmParts[BGN_HAND_MAX - 1].m0D4; + i_this->mC788 = i_this->mRightArmParts[BGN_HAND_MAX - 1].m0D4; + local_84 = local_90 - i_this->mC77C; + cMtx_YrotS(*calc_mtx, cM_atan2s(local_84.x, local_84.z)); + cMtx_XrotM(*calc_mtx, -cM_atan2s(local_84.y, std::sqrtf(SQUARE(local_84.x) + SQUARE(local_84.z)))); + local_6c.x = 0.0f; + local_6c.y = 0.0f; + local_6c.z = REG0_F(7) + 200.0f; + MtxPosition(&local_6c, &i_this->mC794); + local_84 = local_90 - i_this->mC788; + cMtx_YrotS(*calc_mtx, cM_atan2s(local_84.x, local_84.z)); + cMtx_XrotM(*calc_mtx, -cM_atan2s(local_84.y, std::sqrtf(SQUARE(local_84.x) + SQUARE(local_84.z)))); + local_6c.x = 0.0f; + local_6c.y = 0.0f; + local_6c.z = REG0_F(7) + 200.0f; + MtxPosition(&local_6c, &i_this->mC7A0); + } + if (i_this->mC7AC[0] != 0) { + break; + } + i_this->mC778 = 1; + i_this->mC779 = 1; + i_this->mC74A++; + i_this->mC7AC[0] = REG0_S(1) + 0x32; + fopAcM_seStart(actor, JA_SE_CM_BGN_D_PUNCH_FIRE, 0); + // fallthrough + case 6: + uVar11 = 3; + i_this->mRightArmParts[BGN_HAND_MAX - 1].mPartSph.OnAtSetBit(); + i_this->mLeftArmParts[BGN_HAND_MAX - 1].mPartSph.OnAtSetBit(); + i_this->mC77C += i_this->mC794; + i_this->mC788 += i_this->mC7A0; + i_this->mC338 = 200.0f; + i_this->mC334 = 200.0f; + if ((i_this->mC7AC[0] == 0) || (i_this->mPelvisParts[BGN_HAND_MAX + 1].m0D4.y < i_this->mC7BC + 30.0f)) { + dComIfGp_getVibration().StartShock(REG0_S(2) + 8, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + i_this->mAAA8[3].m2F4 = REG0_F(15) + 5000.0f; + i_this->mAAA8[4].m2F4 = REG0_F(15) + 5000.0f; + i_this->mC778 = 0; + i_this->mC779 = 0; + i_this->mAAA8[3].m2E0.x = i_this->mPelvisParts[BGN_HAND_MAX + 1].m0D4.x; + i_this->mAAA8[3].m2E0.y = i_this->mPelvisParts[BGN_HAND_MAX + 1].m0D4.y; + i_this->mAAA8[3].m2E0.z = i_this->mPelvisParts[BGN_HAND_MAX + 1].m0D4.z; + i_this->mAAA8[4].m2E0.x = i_this->mLeftArmParts[BGN_HAND_MAX + 0x14].m0D4.x; + i_this->mAAA8[4].m2E0.y = i_this->mLeftArmParts[BGN_HAND_MAX + 0x14].m0D4.y; + i_this->mAAA8[4].m2E0.z = i_this->mLeftArmParts[BGN_HAND_MAX + 0x14].m0D4.z; + attack_eff_set(i_this, i_this->mRightArmParts[BGN_HAND_MAX - 1].m0D4, 1); + attack_eff_set(i_this, i_this->mLeftArmParts[BGN_HAND_MAX - 1].m0D4, 0); + bVar2 = true; + } + break; + } + if (bVar2) { + i_this->mC748 = 0; + i_this->mC74A = 0; + } + if (uVar11 != 0) { + if (uVar11 <= 2) { + cLib_addCalc2(&i_this->mC32C[uVar11 - 1], REG0_F(14) + 1.0f, 0.2f, 0.05f); + } else { + for (s32 i = 0; i < 2; i++) { + cLib_addCalc2(&i_this->mC32C[i], 1.0f + REG0_F(14), 0.2f, 0.05f); + } + } + } + if ((bVar3) && (i_this->mAAA8[0].m2D0 == 0 || (i_this->mAAA8[1].m2D0 == 0))) { + sVar7 = fopAcM_searchPlayerAngleY(actor); + cLib_addCalcAngleS2(&actor->shape_angle.y, sVar7, 10, 0x400); + } + for (s32 i = 0; i < 8; i++) { + move_s* tmp = &i_this->mAAA8[i]; + switch (i_this->mC74A) { + case 1: + tmp->m2E0 = punch_r1_d[i]; + break; + case 2: + tmp->m2E0 = punch_r2_d[i]; + break; + case 3: + tmp->m2E0 = punch_l1_d[i]; + break; + case 4: + tmp->m2E0 = punch_l2_d[i]; + break; + case 5: + if ((i_this->mC7AC[0] & 0x10) != 0) { + tmp->m2E0 = punch_lr1_d[i]; + } else { + tmp->m2E0 = punch_lr12_d[i]; + } + break; + case 6: + tmp->m2E0 = punch_lr2_d[i]; + break; + } + } } /* 00007108-000071C0 .text start__FP9bgn_class */ -void start(bgn_class*) { - /* Nonmatching */ +static void start(bgn_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + s16 target; + + target = fopAcM_searchPlayerAngleY(actor); + cLib_addCalcAngleS2(&actor->shape_angle.y, target, 10, 0x400); + for (s32 i = 0; i < 8; i++) { + i_this->mAAA8[i].m2E0 = start_pause[i]; + } + if (i_this->mC7AC[0] == 0) { + i_this->mC74C = 0; + i_this->mC754 = 1; + i_this->mC748 = 0; + } } /* 000071C0-000076F4 .text body_attack__FP9bgn_class */ -void body_attack(bgn_class*) { - /* Nonmatching */ +static void body_attack(bgn_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + s8 bVar2; + s16 sVar6; + f32 fVar10; + cXyz local_50; + + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); + bVar2 = false; + local_50 = i_this->mC758 - actor->current.pos; + local_50.y = 0.0f; + fVar10 = local_50.abs(); + switch (i_this->mC74A) { + case 0: + i_this->mC76C = 0.0f; + i_this->mC758 = player->current.pos; + i_this->mC758.y = 0.0f; + if ((i_this->mAAA8[0].m2D0 == 0) || (i_this->mAAA8[1].m2D0 == 0)) { + sVar6 = fopAcM_searchPlayerAngleY(actor); + i_this->mC764 = sVar6; + } + i_this->mC74A = 1; + break; + case 1: + bVar2 = true; + if (fVar10 < 200.0f) { + i_this->mC74A = 2; + i_this->mC7AC[0] = 0x1e; + } + break; + case 2: + bVar2 = true; + i_this->mC758.y = 500.0f; + if (i_this->mC7AC[0] == 0) { + i_this->mC74A = 3; + actor->speed.y = 0.0f; + i_this->mC770 = REG0_S(0) + 0x14; + for (s32 i = 0; i < 8; i++) { + i_this->mAAA8[i].m2F8 = REG0_S(7) + 0x1e; + i_this->mAAA8[i].m2F4 = REG0_F(15) + 5000.0f; + } + } + break; + case 3: + i_this->mC728.y += actor->speed.y; + actor->speed.y -= (REG0_F(4) + 10.0f); + i_this->mC7FC.OnAtSetBit(); + i_this->mPelvisParts[0].mPartSph.OnAtSetBit(); + if (i_this->mC728.y <= -1000.0f) { + i_this->mC728.y = -1000.0f; + actor->speed.y *= -(REG0_F(19) + 0.4f); + for (s32 i = 0; i < 8; i++) { + i_this->mAAA8[i].m2F8 = REG0_S(7) + 0x28; + i_this->mAAA8[i].m2F4 = REG0_F(15) + 5000.0f; + } + i_this->mC770 = REG0_S(0) + 0x14; + i_this->mC7AC[0] = 0x46; + i_this->mC74A = 4; + dComIfGp_getVibration().StartShock(REG0_S(2) + 9, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + attack_eff_set(i_this, i_this->mC308, 2); + } + break; + case 4: + i_this->mC728.y += actor->speed.y; + actor->speed.y -= (REG0_F(4) + 10.0f); + if (i_this->mC728.y <= -1000.0f) { + i_this->mC728.y = -1000.0f; + actor->speed.y = 0.0f; + } + if (i_this->mC7AC[0] > 10) { + cLib_addCalc2(&i_this->mC774, REG0_F(9) + 250.0f, 1.0f, REG0_F(10) + 50.0f); + for (s32 i = 0; i < 8; i++) { + cLib_addCalc2(&i_this->mAAA8[i].m2EC, 250.0f + REG0_F(9), 1.0f, 50.0f + REG0_F(10)); + } + } + if (i_this->mC7AC[0] == 0) { + i_this->mC748 = 0; + i_this->mC74A = 0; + for (s32 i = 0; i < 8; i++) { + i_this->mAAA8[i].m2F8 = REG0_S(7) + 0x32; + i_this->mAAA8[i].m2F4 = REG0_F(15) + 5000.0f; + } + } + break; + } + if (bVar2) { + cLib_addCalc2(&actor->current.pos.x, i_this->mC758.x, 0.1f, i_this->mC76C); + cLib_addCalc2(&actor->current.pos.z, i_this->mC758.z, 0.1f, i_this->mC76C); + cLib_addCalc2(&i_this->mC76C, REG0_F(19) + 30.0f, 1.0f, 0.5f); + cLib_addCalc2(&i_this->mC728.y, i_this->mC758.y, 0.1f, 50.0f); + cLib_addCalcAngleS2(&actor->shape_angle.y, i_this->mC764, 10, 0x400); + } } /* 000076F4-000078D0 .text tail_attack__FP9bgn_class */ -void tail_attack(bgn_class*) { - /* Nonmatching */ +static void tail_attack(bgn_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); + switch (i_this->mC74A) { + case 0: + i_this->mC7AC[0] = 100; + i_this->mC74A = 1; + i_this->mC764 = 0; + i_this->mC76C = 0.0f; + break; + case 1: + actor->shape_angle.y += i_this->mC764; + if (i_this->mC7AC[0] > 0x28) { + cLib_addCalcAngleS2(&i_this->mC764, 0x800, 1, 0x80); + cLib_addCalc2(&actor->current.pos.x, player->current.pos.x, 0.1f, i_this->mC76C); + cLib_addCalc2(&actor->current.pos.z, player->current.pos.z, 0.1f, i_this->mC76C); + cLib_addCalc2(&i_this->mC76C, REG0_F(19) + 15.0f, 1.0f, 0.2f); + for (s32 i = 0; i < BGN_TAIL_MAX; i++) { + i_this->mTailParts[i].mPartSph.OnAtSetBit(); + } + i_this->mAAA8[7].m2E0.z = (int)(REG0_F(3) + -600.0f); + cLib_addCalc2(&i_this->mC728.y, -550.0f, 0.1f, 20.0f); + } else { + cLib_addCalcAngleS2(&i_this->mC764, 0, 1, 0x20); + cLib_addCalc2(&i_this->mC728.y, 0.0f, 0.1f, 5.0f); + i_this->mAAA8[7].m2E0.z = 0; + } + if (i_this->mC7AC[0] == 0) { + i_this->mC748 = 0; + i_this->mC74A = 0; + } + break; + } } /* 000078D0-00007B38 .text damage__FP9bgn_class */ -void damage(bgn_class*) { - /* Nonmatching */ +static void damage(bgn_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + i_this->mpMorf->play(NULL, 0, 0); + i_this->mpMorf->play(NULL, 0, 0); + switch (i_this->mC74A) { + case 0: + i_this->mC7AC[0] = 0; + i_this->mC74A = 1; + actor->speed.y = REG0_F(8) + 100.0f; + i_this->mC770 = REG0_S(0) + 0x32; + for (s32 i = 0; i < 8; i++) { + i_this->mAAA8[i].m2F8 = REG0_S(7) + 0x46; + i_this->mAAA8[i].m2F4 = REG0_F(15) + 8000.0f; + } + break; + case 1: + if (i_this->mC728.y <= 0.0f) { + actor->speed.y = REG0_F(9) + 30.0f; + i_this->mC7AC[0] = REG0_S(5) + 0x28; + i_this->mC74A = 2; + } + break; + case 2: + if (i_this->mC7AC[0] == 0) { + if (i_this->mAAA8[7].m2D0 != 0) { + i_this->mC748 = 4; + } else { + i_this->mC748 = 0; + } + i_this->mC74A = 0; + } + break; + } + i_this->mC728.y += actor->speed.y; + actor->speed.y -= (REG0_F(4) + 10.0f); + if (i_this->mC728.y <= 0.0f) { + i_this->mC728.y = 0.0f; + actor->speed.y = 0.0f; + } + if (i_this->mC728.y > 100.0f) { + cLib_addCalc2(&i_this->mC774, REG0_F(9) + 250.0f, 1.0f, REG0_F(10) + 50.0f); + for (s32 i = 0; i < 8; i++) { + cLib_addCalc2(&i_this->mAAA8[i].m2EC, 250.0f + REG0_F(9), 1.0f, 50.0f + REG0_F(10)); + } + } } /* 00007B38-00007CF0 .text head_recover__FP9bgn_class */ -void head_recover(bgn_class*) { - /* Nonmatching */ +static void head_recover(bgn_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); + switch (i_this->mC74A) { + case 0: + cLib_addCalc2(&i_this->mC728.y, 4000.0f, 0.2f, (REG0_F(10) + 100.0f) * i_this->mCA98); + cLib_addCalc2(&i_this->mCA98, 1.0f, 1.0f, 0.02f); + actor->shape_angle.y = actor->shape_angle.y + 0x200; + if (i_this->mC728.y >= 3990.0f) { + i_this->mC74A = 1; + i_this->mC7AC[0] = REG0_S(5) + 0x28; + i_this->mAAA8[1].m2D0 = 0; + i_this->mAAA8[0].m2D0 = 0; + i_this->mAAA8[1].m308 = 2; + i_this->mAAA8[0].m308 = 2; + i_this->mAAA8[4].m2D0 = 0; + i_this->mAAA8[3].m2D0 = 0; + i_this->mAAA8[4].m308 = 2; + i_this->mAAA8[3].m308 = 2; + i_this->mAAA8[7].m2D0 = 0; + i_this->mAAA8[7].m308 = DEMO_SELECT(1, 2); + fopAcM_seStart(player, JA_SE_CM_BGN_D_ROPE_RESET, 0); + } + break; + case 1: + if (i_this->mC7AC[0] == 0) { + actor->shape_angle.y = actor->shape_angle.y + -0x400; + cLib_addCalc2(&i_this->mC728.y, 0.0f, 0.05f, REG0_F(10) + 200.0f); + if (i_this->mC728.y < 5.0f) { + i_this->mC748 = 0; + i_this->mC74A = 0; + } + } + break; + } } /* 00007CF0-000084B4 .text hensin__FP9bgn_class */ -void hensin(bgn_class*) { - /* Nonmatching */ +static void hensin(bgn_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + cXyz local_20; + + cLib_addCalc2(&actor->current.pos.x, 0.0f, 0.05f, 50.0f); + cLib_addCalc2(&actor->current.pos.z, 0.0f, 0.05f, 50.0f); + switch (i_this->mC74A) { + case 0: + i_this->mC74A = 1; + for (s32 i = 0; i < 8; i++) { + i_this->mAAA8[i].m2D0 = 1; + } + i_this->mCSMode = 1; + // fallthrough + case 1: + case 2: + case 3: + case 4: + i_this->mC728.y = i_this->mC728.y + actor->speed.y; + actor->speed.y = actor->speed.y - (REG0_F(4) + 10.0f); + if (i_this->mC728.y <= REG0_F(2) + -1000.0f) { + i_this->mC728.y = REG0_F(2) + -1000.0f; + i_this->mC770 = REG0_S(0) + 0x14; + for (s32 i = 0; i < 8; i++) { + i_this->mAAA8[i].m2F8 = REG0_S(7) + 0x3c; + i_this->mAAA8[i].m2F4 = REG0_F(15) + 6000.0f; + } + if (i_this->mC74A == 1) { + actor->speed.y = REG0_F(3) + 220.0f; + dComIfGp_getVibration().StartShock(REG0_S(2) + 6, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + i_this->mCA9C = REG0_F(18) + 20.0f; + attack_eff_set(i_this, i_this->mHeadParts[0].m0D4, 0); + } else if (i_this->mC74A == 2) { + actor->speed.y = REG0_F(3) + 190.0f; + dComIfGp_getVibration().StartShock(REG0_S(2) + 4, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + i_this->mCA9C = REG0_F(18) + 15.0f; + attack_eff_set(i_this, i_this->mHeadParts[0].m0D4, 1); + } else if (i_this->mC74A == 3) { + actor->speed.y = REG0_F(3) + 130.0f; + dComIfGp_getVibration().StartShock(REG0_S(2) + 3, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + i_this->mCA9C = REG0_F(18) + 10.0f; + } else { + actor->speed.y = 0.0f; + mDoAud_bgmStart(JA_BGM_BGN_TARABA_IN); + } + i_this->mC74A++; + } + break; + case 5: + if (i_this->mKSubCount >= (s16)(REG0_S(3) + 150)) { + cLib_addCalc2(&i_this->mCC88, 1.0f, 1.0f, REG0_F(15) + 0.005f); + } + cLib_addCalc2(&i_this->mC774, REG0_F(9) + 250.0f, 1.0f, REG0_F(10) + 50.0f); + if (i_this->mKSubCount == 280) { + i_this->mC74A = 10; + i_this->mC7AC[0] = REG0_S(6) + 300; + i_this->mC7AC[1] = REG0_S(7) + 0x96; + i_this->mCC8C = dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTT2CHESTPOTA00, &actor->current.pos); + } + break; + case 10: + cLib_addCalc2(&i_this->mCC88, 1.0f, 1.0f, REG0_F(15) + 0.005f); + if (i_this->mCC8C != NULL) { + if (i_this->mC7AC[1] != 0) { + i_this->mCC8C->setGlobalRTMatrix(i_this->mpMorf->getModel()->getAnmMtx(2)); + } else { + i_this->mCC8C->becomeInvalidEmitter(); + i_this->mCC8C = NULL; + } + } + cLib_addCalc2(&i_this->mC728.y, REG0_F(9) + 1000.0f, 0.05f, actor->speed.y); + cLib_addCalc2(&actor->speed.y, 50.0f, 1.0f, 0.2f); + if (i_this->mC7AC[0] <= 0x64) { + cLib_addCalc0(&i_this->mCC80, 1.0f, 0.02f); + if (i_this->mC7AC[0] == 100) { + mDoAud_seStart(JA_SE_CM_BGN_D_TO_T_1, NULL, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } +#if VERSION == VERSION_DEMO + if (i_this->mC7AC[0] == 1) { + mDoGph_gInf_c::setBlureRate(REG0_S(4) + 0xB4); + // Required to match. + mDoGph_gInf_c::mBlureFlag = true; + mDoMtx_copy(cMtx_getIdentity(), mDoGph_gInf_c::mBlureMtx); + } +#endif + if (i_this->mC7AC[0] <= 1) { + cLib_addCalc2(&i_this->mCC84, 0.22f, 0.1f, 0.0055f); + if (i_this->mC7AC[0] == 1) { + mDoAud_seStart(JA_SE_CM_BGN_D_TO_T_2, NULL, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + if (i_this->mCC84 > 0.21f) { +#if VERSION == VERSION_DEMO + mDoGph_gInf_c::offBlure(); +#endif + l_HIO.m024++; + bgn2->actor.current.angle = i_this->mC314; + bgn2->actor.shape_angle = i_this->mC314; + bgn2->actor.current.pos = i_this->mC308; + bgn2->m2E7C = 1.0f; + i_this->mCSMode++; + i_this->mKSubCount = 0; + local_20.setall(REG0_F(4) + 10.0f); + dComIfGp_particle_set(dPa_name::ID_AK_JN_SIBOUBAKUEN, &bgn2->actor.current.pos, NULL, &local_20); + dComIfGp_particle_set(dPa_name::ID_AK_JN_SIBOUFLASH, &bgn2->actor.current.pos, NULL, &local_20); + mDoAud_seStart(JA_SE_CM_BGN_METAM_EXPLODE, NULL, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + dComIfGp_getVibration().StartShock(REG0_S(2) + 8, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + } +#if VERSION > VERSION_DEMO + else { + cLib_addCalcAngleS2(&i_this->mCA60, 0xb4, 1, 4); + } +#endif + } + } + break; + } } /* 000084B4-00008888 .text himo_control__FP9bgn_classP6move_sP4cXyz */ -void himo_control(bgn_class*, move_s*, cXyz*) { - /* Nonmatching */ +static void himo_control(bgn_class* i_this, move_s* param_2, cXyz* param_3) { + fopAc_ac_c* actor = &i_this->actor; + s32 i; + cXyz* pcVar5; + s16 j; + s16 k; + s8 bVar9; + f32 dVar10; + cXyz local_ac; + cXyz local_b8; + cXyz local_c4; + + pcVar5 = ¶m_2->mHimo.m000[1]; + local_ac.x = 0.0f; + local_ac.y = 0.0f; + local_ac.z = (REG0_F(12) + 15.0f) * i_this->mCC80; + j = 0; + k = 0; + i = 1; + param_3++; + for (; i < 60; i++, pcVar5++, param_3++) { + f32 x = (pcVar5[0].x - pcVar5[-1].x); + f32 z = pcVar5[0].z - pcVar5[-1].z; + f32 y2 = ((pcVar5[0].y - 40.0f) + REG0_F(13)); + if (y2 < 0.0f) { + y2 = 0.0f; + bVar9 = true; + } else { + bVar9 = false; + } + f32 y = (y2 - pcVar5[-1].y); + dVar10 = param_2->m304; + if (dVar10 > 0.01f) { + j = (dVar10 * cM_ssin(param_2->m2FA + i * (REG0_S(3) + 2000))); + k = (dVar10 * cM_scos(param_2->m2FC + i * (REG0_S(4) + 0x9c4))); + } + cMtx_XrotS(*calc_mtx, j - cM_atan2s(y, z)); + cMtx_YrotM(*calc_mtx, k + cM_atan2s(x, std::sqrtf(SQUARE(y) + SQUARE(z)))); + MtxPosition(&local_ac, &local_b8); + pcVar5[0].x = pcVar5[-1].x + local_b8.x; + pcVar5[0].y = pcVar5[-1].y + local_b8.y; + pcVar5[0].z = pcVar5[-1].z + local_b8.z; + *param_3 = pcVar5[0]; + if (((bVar9) && (((int)i_this->mC746 & 7) == 0)) && (((int)i_this->mC746 >> 3 & 0xf) == (i & 0xf))) { + local_c4 = pcVar5[0]; + if (!gr_check(i_this, &local_c4)) { + dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_KGTCOMMONHAMON00, &local_c4, 0xff, g_whiteColor, g_whiteColor, 0); + if (i_this->m0304 == 0) { + i_this->m0304 = cM_rndF(20.0f) + 20.0f; + i_this->m0308 = local_c4; + mDoAud_seStart(JA_SE_CM_BGN_STRING_RIPPLE, &i_this->m0308, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + } + } + } } +#if VERSION > VERSION_DEMO /* 00008888-00008C20 .text last_himo_control__FP9bgn_class */ -void last_himo_control(bgn_class*) { - /* Nonmatching */ +static void last_himo_control(bgn_class* i_this) { + cXyz* pcVar5; + cXyz local_a8; + cXyz local_b4; + + i_this->mC450[0].set(-15.0f, REG8_F(4) + 4441.46f, REG8_F(3) + 375.17f); + cXyz* pcVar8 = i_this->mDefeatCSRopeMat.getPos(0); + u8* puVar8 = i_this->mDefeatCSRopeMat.getSize(0); + *puVar8 = 10; + *pcVar8 = i_this->mC450[0]; + if (i_this->mC720 == 1) { + i_this->mC720++; + pcVar5 = &i_this->mC450[1]; + for (s32 i = 0; i < 59; i++, pcVar5++) { + *pcVar5 = i_this->mC450[0]; + } + i_this->mC724 = REG0_F(19) + 5000.0f; + } else { + cLib_addCalc0(&i_this->mC724, 1.0f, REG0_F(18) + 50.0f); + } + pcVar5 = &i_this->mC450[1]; + local_a8.x = 0.0f; + local_a8.y = 0.0f; + local_a8.z = REG0_F(12) + 45.0f; + s32 i; + cXyz* var_r25; + s16 k; + s16 j; + k = 0; + j = 0; + i = 1; + var_r25 = &pcVar8[1]; + u8* var_r28 = &puVar8[1]; + for (; i < 60; i++, pcVar5++, var_r25++, var_r28++) { + f32 x = (pcVar5->x - pcVar5[-1].x); + f32 y = REG0_F(13) + ((pcVar5->y - pcVar5[-1].y) - 35.0f); + f32 z = pcVar5->z - pcVar5[-1].z; + if (i_this->mC724 > 0.01f) { + k = i_this->mC724 * cM_ssin(i_this->mC746 * 2000 + i * (REG0_S(3) + 2000)); + j = i_this->mC724 * cM_scos(i_this->mC746 * 0x8fc + i * (REG0_S(4) + 0x9c4)); + } + cMtx_XrotS(*calc_mtx, (int)k - cM_atan2s(y, z)); + cMtx_YrotM(*calc_mtx, (int)j + cM_atan2s(x, std::sqrtf(SQUARE(y) + SQUARE(z)))); + MtxPosition(&local_a8, &local_b4); + pcVar5->x = pcVar5[-1].x + local_b4.x; + pcVar5->y = pcVar5[-1].y + local_b4.y; + pcVar5->z = pcVar5[-1].z + local_b4.z; + *var_r25 = *pcVar5; + *var_r28 = 10; + } } +#endif /* 00008C20-000092B8 .text action_s__FP9bgn_classP6move_si */ -void action_s(bgn_class*, move_s*, int) { - /* Nonmatching */ +static void action_s(bgn_class* i_this, move_s* param_2, int param_3) { + f32 target; + f32 fVar3; + cXyz* pcVar4; + u8* pcVar7; + cXyz local_64; + cXyz local_70; + cXyz cStack_7c; + + if (param_2->m2F8 != 0) { + param_2->m2F8--; + } + target = 0.0f; + if ((l_HIO.m025 == 0) && (i_this->mC728.y > REG0_F(12) + -900.0f)) { + target = (REG0_F(13) + ((param_2->m2F8) * (REG0_F(2) + 20.0f) + 300.0f)); + } + cLib_addCalc2(¶m_2->m2F4, target, 0.5f, REG0_F(8) + 200.0f); + param_2->m2FA += (s16)(((param_3 * 3) + 0xa28) + REG0_S(5)); + param_2->m2FC += (s16)(((param_3 * 3) + 0x8fc) + REG0_S(6)); + if (param_2->m2FE != 0) { + param_2->m2FE--; + } + if (l_HIO.m025 != 0) { + param_2->m2D0 = 0; + switch (param_3) { + case 0: + param_2->m2E0.x = l_HIO.m0AA; + param_2->m2E0.y = l_HIO.m0AC; + param_2->m2E0.z = l_HIO.m0AE; + break; + case 2: + param_2->m2E0.x = l_HIO.m0B0; + param_2->m2E0.y = l_HIO.m0B2; + param_2->m2E0.z = l_HIO.m0B4; + break; + case 3: + param_2->m2E0.x = l_HIO.m0B6; + param_2->m2E0.y = l_HIO.m0B8; + param_2->m2E0.z = l_HIO.m0BA; + break; + case 4: + param_2->m2E0.x = l_HIO.m0BC; + param_2->m2E0.y = l_HIO.m0BE; + param_2->m2E0.z = l_HIO.m0C0; + break; + case 5: + param_2->m2E0.x = l_HIO.m0C2; + param_2->m2E0.y = l_HIO.m0C4; + param_2->m2E0.z = l_HIO.m0C6; + break; + case 6: + param_2->m2E0.x = l_HIO.m0C8; + param_2->m2E0.y = l_HIO.m0CA; + param_2->m2E0.z = l_HIO.m0CC; + break; + case 7: + param_2->m2E0.x = l_HIO.m0CE; + param_2->m2E0.y = l_HIO.m0D0; + param_2->m2E0.z = l_HIO.m0D2; + } + } + if (param_2->m2D0 == 0) { + cLib_addCalc2(¶m_2->m2D4.x, param_2->m2E0.x, 0.5f, i_this->mC334); + cLib_addCalc2(¶m_2->m2D4.y, param_2->m2E0.y, 0.5f, i_this->mC334); + cLib_addCalc2(¶m_2->m2D4.z, param_2->m2E0.z, 0.5f, i_this->mC334); + } + pcVar4 = i_this->mBlueRopeMat.getPos(param_3); + pcVar7 = i_this->mBlueRopeMat.getSize(param_3); + local_64 = i_this->mC33C[param_3]; + if (param_2->m2D0 != 0) { + param_2->mHimo.m000[0] = local_64; + *pcVar4 = local_64; + himo_control(i_this, param_2, pcVar4); + cLib_addCalc0(¶m_2->m304, 1.0f, REG0_F(5) + 100.0f); + } else { + local_70.y = 0.0f; + cLib_addCalc0(¶m_2->m2EC, 1.0f, 25.0f); + if (param_2->m300 != 0) { + param_2->m300--; + } + cMtx_YrotS(*calc_mtx, (int)(param_3 * (REG0_S(2) + 13000))); + for (s32 i = 0; i < 60; i++, pcVar4++, pcVar7++) { + if (param_2->m300 != 0) { + fVar3 = (REG0_F(12) + 10.0f) * (param_2->m300 * cM_ssin(cM_rad2s((s32)(i) * 0.053247336f))); + local_70.x = fVar3 * cM_scos(i_this->mC746 * (REG0_S(3) + 0x5800)); + local_70.z = fVar3 * cM_scos(i_this->mC746 * (REG0_S(5) + 0x5200)); + } else { + fVar3 = param_2->m2EC * cM_ssin(cM_rad2s(0.053247336f * (f32)(i))); + fVar3 *= (0.01666667f * (f32)(0x3B - i)); + local_70.x = fVar3 * cM_scos(i_this->mC746 * (REG0_S(3) + 200) + i * (REG0_S(4) + 2000)); + local_70.z = fVar3 * cM_scos(i_this->mC746 * (REG0_S(5) + 0xfa) + i * (REG0_S(6) + 2000)); + } + MtxPosition(&local_70, &cStack_7c); + param_2->mHimo.m000[i] = local_64; + *pcVar4 = local_64 + cStack_7c; + *pcVar7 = REG0_S(2) + 6; + local_64.y += 50.0f; + } + } } /* 000092B8-0000960C .text action_main__FP9bgn_class */ -void action_main(bgn_class*) { - /* Nonmatching */ +static void action_main(bgn_class* i_this) { + cXyz* pcVar7; + u8* pcVar5; + f32 dVar9; + cXyz local_90; + cXyz local_9c; + + local_9c = i_this->mC308; + cLib_addCalc0(&i_this->mC774, 1.0f, 25.0f); + pcVar7 = i_this->mRedRopeMat.getPos(0); + pcVar5 = i_this->mRedRopeMat.getSize(0); + for (s32 i = 0; i < 60; i++, pcVar7++, pcVar5++) { + dVar9 = i_this->mC774 * cM_ssin(cM_rad2s(0.053247336f * (f32)(i))); + dVar9 *= (0.01666667f * (f32)(0x3B - i)); + local_90.x = dVar9 * cM_ssin(i_this->mC746 * (REG0_S(3) + 300) + i * (REG0_S(4) + 2000)); + local_90.z = dVar9 * cM_ssin(i_this->mC746 * (REG0_S(5) + 0xfa) + i * (REG0_S(6) + 2000)); + *pcVar7 = local_9c + local_90; + *pcVar5 = REG0_S(3) + 10; + local_9c.y += 50.0f; + } + if (l_HIO.m025 == 0) { + switch (i_this->mC748) { + case 0: + dance_0(i_this); + move_se_set(i_this); + break; + case 1: + punch_LR(i_this); + move_se_set(i_this); + break; + case 2: + body_attack(i_this); + move_se_set(i_this); + break; + case 3: + tail_attack(i_this); + move_se_set(i_this); + break; + case 4: + head_recover(i_this); + move_se_set(i_this); + break; + case 5: + damage(i_this); + break; + case 6: + hensin(i_this); + break; + case 7: + start(i_this); + break; + case 10: + i_this->mC754 = 1; + i_this->mCC80 = 1.0f; + } + if (i_this->mC748 > 0) { + cLib_addCalcAngleS2(&i_this->mC750, 0, 10, 0x200); + } + } + for (s32 i = 0; i < 8; i++) { + action_s(i_this, &i_this->mAAA8[i], i); + } + cLib_addCalc2(&i_this->mC334, i_this->mC338, 1.0f, 10.0f); + i_this->mC338 = l_HIO.m0D4; } /* 0000960C-00009F6C .text move__FP9bgn_class */ -void move(bgn_class*) { - /* Nonmatching */ +static void move(bgn_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + s16 sVar1; + int iVar3; + f32 fVar9; + csXyz local_110; + cXyz local_e4; + + i_this->mC734 = i_this->mC728; + i_this->mJyakutenCBrkAnm->play(); + i_this->mJyakutenBBrkAnm->play(); + if (i_this->m02B5 != 0) { + i_this->mC748 = 10; + actor->current.pos.set(0.0f, 30000.0f, 0.0f); + fopAcM_OffStatus(actor, 0); + actor->attention_info.flags = 0; + i_this->mCC80 = REG0_F(25) + 1.0f; + i_this->mCC84 = REG0_F(20); + i_this->mCC88 = REG0_F(21); + } else { + if (i_this->mC748 == 10) { + actor->current.pos = actor->home.pos; + i_this->mC748 = 0; + i_this->mC74A = 0; + actor->health = 3; + } + actor->attention_info.flags = fopAc_Attn_LOCKON_BATTLE_e; + actor->attention_info.distances[fopAc_Attn_TYPE_BATTLE_e] = 0x22; + i_this->mC308 = actor->current.pos + i_this->mC728; + i_this->mC308.y += l_HIO.m04C; + if (i_this->mC308.y <= (i_this->mC7BC + 100.0f + REG0_F(0))) { + i_this->mC308.y = (i_this->mC7BC + 100.0f + REG0_F(0)); + } + local_110 = actor->shape_angle; + if (l_HIO.m025 != 0) { + local_110.y = l_HIO.m042; + } + BGN_HAND_MAX = l_HIO.m0F0; + BGN_TAIL_MAX = l_HIO.m0F2; + dBgS_GndChk gndChk; + Vec pos; + pos = actor->current.pos; + pos.y += 500.0f; + gndChk.SetPos(&pos); + i_this->mC7BC = (((REG0_F(16) + -40.0f) + 30.0f) + 100.0f); + sVar1 = 0; + if (i_this->mAAA8[0].m2D0 != 0) { + sVar1 = 8000; + } + if (i_this->mAAA8[1].m2D0 != 0) { + sVar1 -= 8000; + } + cLib_addCalcAngleS2(&i_this->mC744, sVar1, 8, 0x400); + if (i_this->mAAA8[2].m2D0 == 0) { + local_110.x += (int)(i_this->mAAA8[2].m2D4.y * (REG0_F(11) + 8.0f)); + } + if (i_this->mAAA8[3].m2D0 != 0) { + local_110.z -= (s16)(REG0_S(0) + 3000); + } else { + local_110.z += (int)(i_this->mAAA8[3].m2D4.y * (REG0_F(12) + 5.0f)); + local_110.y += (int)(i_this->mAAA8[3].m2D4.z * -(REG0_F(13) + 5.0f)); + } + if (i_this->mAAA8[4].m2D0 != 0) { + local_110.z += (s16)(REG0_S(0) + 3000); + } else { + local_110.z += (int)(i_this->mAAA8[4].m2D4.y * -(REG0_F(12) + 5.0f)); + local_110.y += (int)(i_this->mAAA8[4].m2D4.z * (REG0_F(13) + 5.0f)); + } + cLib_addCalcAngleS2(&i_this->mC314.x, local_110.x, 4, 0x200); + cLib_addCalcAngleS2(&i_this->mC31A, local_110.y, 4, 0x1000); + cLib_addCalcAngleS2(&i_this->mC314.z, local_110.z, 4, 0x200); + i_this->mC314.y = i_this->mC31A + i_this->mC750; + if (l_HIO.m029 != 0) { + i_this->mAAA8[0].m2D0 = 1; + } + if (l_HIO.m02A != 0) { + i_this->mAAA8[1].m2D0 = 1; + } + if (l_HIO.m02B != 0) { + i_this->mAAA8[2].m2D0 = 1; + } + if (l_HIO.m02C != 0) { + i_this->mAAA8[3].m2D0 = 1; + } + if (l_HIO.m02D != 0) { + i_this->mAAA8[4].m2D0 = 1; + } + if (l_HIO.m02E != 0) { + i_this->mAAA8[5].m2D0 = 1; + } + if (l_HIO.m02F != 0) { + i_this->mAAA8[6].m2D0 = 1; + } + if (l_HIO.m030 != 0) { + i_this->mAAA8[7].m2D0 = 1; + } + fVar9 = 0.0f; + for (s32 i = 0; i < 2; i++) { + if ((i == 0) && (i_this->mC778 != 0)) { + local_e4 = i_this->mLeftArmParts[BGN_HAND_MAX].m0D4 - i_this->mLeftArmParts[BGN_HAND_MAX - 1].m0D4; + fVar9 = local_e4.abs(); + } else if ((i == 1) && (i_this->mC779 != 0)) { + local_e4 = i_this->mRightArmParts[BGN_HAND_MAX].m0D4 - i_this->mRightArmParts[BGN_HAND_MAX - 1].m0D4; + fVar9 = local_e4.abs(); + } + f32 temp_f0_8 = (200.0f + REG0_F(5)); + if (fVar9 > temp_f0_8) { + fVar9 -= temp_f0_8; + fVar9 *= (REG0_F(6) + 0.2f); + } else { + fVar9 = 0.0f; + } + cLib_addCalc2(&i_this->mC324[i], l_HIO.m124 + fVar9, 1.0f, 20.0f + REG0_F(4)); + cLib_addCalc0(&i_this->mC32C[i], 0.05f, 0.02f); + } + size_set(i_this); + i_this->mC7FC.OffAtSetBit(); + i_this->mPelvisParts[0].mPartSph.OffAtSetBit(); + i_this->mLeftArmParts[BGN_HAND_MAX - 1].mPartSph.OffAtSetBit(); + i_this->mRightArmParts[BGN_HAND_MAX - 1].mPartSph.OffAtSetBit(); + for (iVar3 = 0; iVar3 < BGN_TAIL_MAX; iVar3++) { + i_this->mTailParts[iVar3].mPartSph.OffAtSetBit(); + } + action_main(i_this); +#if VERSION == VERSION_DEMO + shape_calc(i_this); + damage_check(i_this); +#else + damage_check(i_this); + shape_calc(i_this); +#endif + } } /* 0000A104-0000AE8C .text demo_camera__FP9bgn_class */ -void demo_camera(bgn_class*) { - /* Nonmatching */ +static void demo_camera(bgn_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + f32 fVar2; + f32 dVar11; + cXyz local_44; + cXyz local_50; + cXyz local_5c; + cXyz camera_eye; + cXyz camera_center; + + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); + camera_class* camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); + switch (i_this->mCSMode) { + case 0: + break; + case 1: + if (!actor->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, dEvtFlag_STAFF_ALL_e, 0xFFFF, 0); + actor->eventInfo.onCondition(dEvtCnd_UNK2_e); + return; + } + i_this->mCSMode++; + camera->mCamera.Stop(); + camera->mCamera.SetTrimSize(2); + i_this->mKSubCount = 0; + i_this->mCSFovY = 55.0f; + i_this->mCA98 = 0.0f; + i_this->mCSCamCenter = i_this->mC308; + player->changeOriginalDemo(); + fpcM_Search(ki_del_sub, i_this); + i_this->mKeeseSpawnNum = 0; + // fallthrough + case 2: + cMtx_YrotS(*calc_mtx, i_this->mC314.y); + local_44.x = REG0_F(0) + 200.0f; + local_44.y = REG0_F(1) + 100.0f; + local_44.z = REG0_F(2) + 2000.0f; + MtxPosition(&local_44, &local_50); + i_this->mCSCamEye = local_50; + if (i_this->mKSubCount > 300) { + fVar2 = 0.1f; + } else { + fVar2 = 0.5f; + } + dVar11 = fVar2; + cLib_addCalc2(&i_this->mCSCamCenter.x, i_this->mC308.x, 0.1f, 300.0f); + cLib_addCalc2(&i_this->mCSCamCenter.y, i_this->mC308.y + 100.0f + REG0_F(3), dVar11, 400.0f); + cLib_addCalc2(&i_this->mCSCamCenter.z, i_this->mC308.z, 0.1f, 300.0f); + local_44.x = REG0_F(4); + local_44.y = player->current.pos.y; + local_44.z = REG0_F(5) + 1500.0f; + MtxPosition(&local_44, &local_50); + player->setPlayerPosAndAngle(&local_50, (int)(s16)(i_this->mC314.y + 0x8000)); + if (i_this->mKSubCount == (s16)(REG0_S(5) + 220)) { + player->changeDemoMode(daPy_demo_c::DEMO_UNK_029_e); + } + if (i_this->mKSubCount == (s16)(REG0_S(6) + 320)) { + player->changeDemoMode(daPy_demo_c::DEMO_LOOKUP_e); + } + break; + case 3: + cLib_addCalc2(&i_this->mCSCamCenter.x, bgn2->actor.current.pos.x, 0.1f, 100.0f); + cLib_addCalc2(&i_this->mCSCamCenter.y, bgn2->actor.current.pos.y + REG0_F(13), 0.1f, 200.0f); + cLib_addCalc2(&i_this->mCSCamCenter.z, bgn2->actor.current.pos.z, 0.1f, 100.0f); + if (i_this->mKSubCount == (s16)(REG0_S(7) + 90)) { + i_this->mCA9C = REG0_F(18) + 30.0f; + } + if (i_this->mKSubCount == (s16)(REG0_S(7) + 100)) { + player->changeDemoMode(daPy_demo_c::DEMO_SURPRISED_e); + player->voiceStart(29); + } + if (i_this->mKSubCount > (s16)(REG0_S(8) + 110)) { + cLib_addCalc2(&i_this->mCSFovY, REG0_F(11) + 35.0f, 0.1f, REG0_F(12) + 0.5f); + if ((i_this->mKSubCount == 130) || (i_this->mKSubCount == 180)) { + mDoAud_seStart(JA_SE_CM_BGN_T_MOUSE_OPEN, NULL, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + if (i_this->mKSubCount == 152) { + mDoAud_seStart(JA_SE_CM_BGN_T_MOUSE_CLOSE, NULL, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + } +#if VERSION > VERSION_DEMO + cLib_addCalcAngleS2(&i_this->mCA60, 1, 1, 1); +#endif + if (i_this->mKSubCount <= (s16)(REG0_S(8) + 200)) { + break; + } + mDoAud_bgmStart(JA_BGM_BGN_TARABA); + goto block_57; + case 10: + if (!actor->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, dEvtFlag_STAFF_ALL_e, 0xFFFF, 0); + actor->eventInfo.onCondition(dEvtCnd_UNK2_e); + return; + } + i_this->mCSMode++; + camera->mCamera.Stop(); + camera->mCamera.SetTrimSize(2); + i_this->mKSubCount = 0; + i_this->mCSFovY = 55.0f; + i_this->mCA98 = 0.0f; + i_this->mCSCamCenter = bgn2->actor.current.pos; + player->changeOriginalDemo(); +#if VERSION > VERSION_DEMO + fpcM_Search(ki_del_sub, i_this); +#endif + bgn2->m2ED0 = 0; + i_this->mCA74.set(200.0f, 2100.0f, 2500.0f); + case 11: + case 12: + cLib_addCalc2(&i_this->mCA74.x, -1800.0f, 0.05f, i_this->mCA98 * 2000.0f); + cLib_addCalc2(&i_this->mCA74.y, 1100.0f, 0.05f, i_this->mCA98 * 1000.0f); + cLib_addCalc2(&i_this->mCA74.z, 1000.0f, 0.05f, i_this->mCA98 * 1500.0f); + cLib_addCalc2(&i_this->mCA98, 0.01f, 1.0f, 0.0001f); + cMtx_YrotS(*calc_mtx, bgn2->actor.shape_angle.y); + MtxPosition(&i_this->mCA74, &local_50); + i_this->mCSCamEye = local_50; + if (i_this->mCSMode == 11) { + cLib_addCalc2(&i_this->mCSCamCenter.x, bgn2->actor.current.pos.x, 0.1f, 300.0f); + cLib_addCalc2(&i_this->mCSCamCenter.y, bgn2->actor.current.pos.y + REG0_F(13), 0.1f, 300.0f); + cLib_addCalc2(&i_this->mCSCamCenter.z, bgn2->actor.current.pos.z, 0.1f, 300.0f); + local_44.x = REG0_F(4); + local_44.y = player->current.pos.y; + local_44.z = REG0_F(5) + -2000.0f; + MtxPosition(&local_44, &local_50); + player->setPlayerPosAndAngle(&local_50, bgn2->actor.shape_angle.y); + } else { + cLib_addCalc2(&i_this->mCSCamCenter.x, bgn3->actor.current.pos.x, 0.1f, 300.0f); + cLib_addCalc2( + &i_this->mCSCamCenter.y, + DEMO_SELECT(bgn3->actor.current.pos.y + 200.0f + REG0_F(16), bgn3->actor.current.pos.y + 50.0f + REG8_F(16)), + 0.1f, + 300.0f + ); + cLib_addCalc2(&i_this->mCSCamCenter.z, bgn3->actor.current.pos.z, 0.1f, 300.0f); + cLib_addCalc2(&i_this->mCSFovY, REG0_F(17) + 30.0f, REG0_F(18) + 0.05f, REG0_F(19) + 0.2f); +#if VERSION > VERSION_DEMO + cLib_addCalcAngleS2(&i_this->mCA60, 1, 1, 2); +#endif + } + if (i_this->mKSubCount > (s16)(REG0_S(9) + DEMO_SELECT(310, 370))) { + goto block_57; + } + break; + case 20: + if (!actor->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, dEvtFlag_STAFF_ALL_e, 0xFFFF, 0); + actor->eventInfo.onCondition(dEvtCnd_UNK2_e); + return; + } + i_this->mCSMode++; + camera->mCamera.Stop(); + camera->mCamera.SetTrimSize(2); + i_this->mKSubCount = 0; + i_this->mCSFovY = 55.0f; + i_this->mCA98 = 0.0f; + i_this->mCSCamCenter = bgn3->actor.current.pos; + player->changeOriginalDemo(); +#if VERSION > VERSION_DEMO + i_this->mCA60 = 0xb4; + fpcM_Search(ki_del_sub, i_this); + fpcM_Search(ks_del_sub, i_this); +#endif + case 21: +#if VERSION > VERSION_DEMO + cLib_addCalcAngleS2(&i_this->mCA60, 1, 1, 1); +#endif + i_this->mCSCamEye.set(500.0f, REG0_F(3) + 500.0f, REG0_F(4) + 2000.0f); + cLib_addCalc2(&i_this->mCSCamCenter.x, bgn3->actor.current.pos.x, 0.1f, 300.0f); + cLib_addCalc2(&i_this->mCSCamCenter.y, bgn3->actor.current.pos.y + REG0_F(13), 0.1f, 300.0f); + cLib_addCalc2(&i_this->mCSCamCenter.z, bgn3->actor.current.pos.z, 0.1f, 300.0f); + local_44.x = REG0_F(4); + local_44.y = player->current.pos.y; + local_44.z = REG0_F(5) + -1000.0f; + player->setPlayerPosAndAngle(&local_44, bgn2->actor.shape_angle.y); + if (i_this->mKSubCount == 260) { + mDoAud_monsSeStart(JA_SE_CV_BGN_DIE, NULL, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + if (i_this->mKSubCount >= 370) { + local_5c.setall(REG0_F(4) + 10.0f); + dComIfGp_particle_set(dPa_name::ID_AK_JN_SIBOUBAKUEN, &bgn3->actor.current.pos, NULL, &local_5c); + dComIfGp_particle_set(dPa_name::ID_AK_JN_SIBOUFLASH, &bgn3->actor.current.pos, NULL, &local_5c); + mDoAud_seStart(JA_SE_CM_BGN_LAST_EXPLODE, NULL, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + dComIfGp_getVibration().StartShock(REG0_S(2) + 8, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + i_this->m02B5 = 3; + l_HIO.m024 = 3; + i_this->mCSMode++; +#if VERSION > VERSION_DEMO + i_this->mC720 = 1; + i_this->mCA60 = 0xb4; +#endif + } + break; + case 22: +#if VERSION > VERSION_DEMO + if (i_this->mKSubCount >= 390) { + last_himo_control(i_this); + } +#endif + if (i_this->mKSubCount >= DEMO_SELECT(430, (s16)(REG8_S(7) + 500))) { + i_this->mCC90 = 2; + } + break; + case 150: + block_57: + camera->mCamera.SetTrimSize(0); + camera->mCamera.Start(); + dMeter_mtrShow(); + dComIfGp_event_reset(); + i_this->mCSMode = 0; +#if VERSION > VERSION_DEMO + i_this->mCA60 = 1; +#endif + break; + default: + break; + } + if (i_this->mCSMode != 0) { + f32 fx = i_this->mCA9C * cM_ssin(i_this->mKSubCount * 0x3300); + f32 fy = i_this->mCA9C * cM_scos(i_this->mKSubCount * 0x3000); + camera_eye.x = i_this->mCSCamEye.x + fx; + camera_eye.y = i_this->mCSCamEye.y + fy; + camera_eye.z = i_this->mCSCamEye.z; + camera_center.x = i_this->mCSCamCenter.x + fx; + camera_center.y = i_this->mCSCamCenter.y + fy; + camera_center.z = i_this->mCSCamCenter.z; + s16 bank = (i_this->mCA9C * cM_scos(i_this->mC746 * 0x1c00) * 7.5f); + camera->mCamera.Set(camera_center, camera_eye, bank, i_this->mCSFovY); + cLib_addCalc0(&i_this->mCA9C, 1.0f, REG0_F(16) + 1.0f); + JUTReport(410, 430, "K SUB COUNT %d", i_this->mKSubCount); + i_this->mKSubCount++; + } } +#if VERSION == VERSION_DEMO +/* 000019F4-00001A40 .text bgn2_s_sub__FPvPv */ +static void* bgn2_s_sub(void* param_1, void*) { + if ((fopAc_IsActor(param_1)) && (fopAcM_GetName(param_1) == PROC_BGN2)) { + return param_1; + } else { + return NULL; + } +} + +/* 00001A40-00001A8C .text bgn3_s_sub__FPvPv */ +static void* bgn3_s_sub(void* param_1, void*) { + if ((fopAc_IsActor(param_1)) && (fopAcM_GetName(param_1) == PROC_BGN3)) { + return param_1; + } else { + return NULL; + } +} +#endif + /* 0000AE8C-0000B134 .text daBgn_Execute__FP9bgn_class */ -static BOOL daBgn_Execute(bgn_class*) { - /* Nonmatching */ +static BOOL daBgn_Execute(bgn_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + cXyz local_1c; + cXyz local_28; + + if (i_this->m02B4 == 0xFF) { + return TRUE; + } + local_1c.setall(0.0f); + g_env_light.settingTevStruct(TEV_TYPE_BG2, ¢er_pos, &bg_tevstr); + bomb_splash_check(i_this); +#if VERSION == VERSION_DEMO + bgn = i_this; + if (bgn2 == NULL) { + bgn2 = (bgn2_class*)fpcM_Search(bgn2_s_sub, i_this); + } + if (bgn3 == NULL) { + bgn3 = (bgn3_class*)fpcM_Search(bgn3_s_sub, i_this); + } +#else + bgn2 = (bgn2_class*)fpcM_Search(bgn2_s_sub, i_this); + bgn3 = (bgn3_class*)fpcM_Search(bgn3_s_sub, i_this); +#endif + if (l_HIO.m027 != 0) { + actor->health = l_HIO.m027; + } + if (i_this->mCC90 == 1) { + i_this->mCC90 = 0; + i_this->m02B5 = 2; + l_HIO.m024 = 2; + } + i_this->mC746++; + for (s32 i = 0; i < 5; i++) { + if (i_this->mC7AC[i] != 0) { + i_this->mC7AC[i]--; + } + } + if (i_this->mC7B6 != 0) { + i_this->mC7B6--; + } + if (i_this->mC7B8 != 0) { + i_this->mC7B8--; + } + if (i_this->mArrowHitFlashTimer != 0) { + i_this->mArrowHitFlashTimer--; + } + if (i_this->m0304 != 0) { + i_this->m0304--; + } + if (i_this->m0302 != 0) { + i_this->m0302++; + if (i_this->m0302 > 100) { + i_this->m0302 = 0; + } + } + move(i_this); + demo_camera(i_this); + if (i_this->mKeeseSpawnNum != 0) { + i_this->mKeeseSpawnNum--; + if (ki_check(i_this) < l_HIO.mKeeseNumMax) { + local_28.x = cM_rndFX(2500.0f); + local_28.y = cM_rndF(500.0f) + 3500.0f; + local_28.x = cM_rndFX(2500.0f); + fopAcM_create(PROC_KI, 0xFFFF0003, &local_28, fopAcM_GetRoomNo(actor)); + } + } + i_this->m02B5 = l_HIO.m024; + if (i_this->mCC90 == 2) { + i_this->mCC90 = 0; + dComIfGp_setNextStage("GanonK", 4, 0, 9); + dComIfGs_onEventBit(dSv_event_flag_c::UNK_3F10); + } + return TRUE; } /* 0000B134-0000B13C .text daBgn_IsDelete__FP9bgn_class */ @@ -258,22 +3392,166 @@ static BOOL daBgn_IsDelete(bgn_class*) { } /* 0000B13C-0000B238 .text daBgn_Delete__FP9bgn_class */ -static BOOL daBgn_Delete(bgn_class*) { - /* Nonmatching */ +static BOOL daBgn_Delete(bgn_class* i_this) { + dComIfG_resDeleteDemo(&i_this->mPhase, "Bgn"); +#if VERSION > VERSION_DEMO + i_this->mPunchSmokeCb[0].remove(); + i_this->mPunchSmokeCb[1].remove(); +#endif + if (i_this->mCC91 != 0) { + hio_set = false; + mDoHIO_deleteChild(l_HIO.mNo); + } + mDoAud_seDeleteObject(&i_this->mC77C); + mDoAud_seDeleteObject(&i_this->mC788); + mDoAud_seDeleteObject(&i_this->mCA54); + mDoAud_seDeleteObject(&i_this->m0308); + return TRUE; } /* 0000B238-0000B284 .text part_init__FP6part_sP12J3DModelData */ -void part_init(part_s*, J3DModelData*) { - /* Nonmatching */ +static s32 part_init(part_s* param_1, J3DModelData* param_2) { + param_1->mpPartModel = mDoExt_J3DModel__create(param_2, DEMO_SELECT(0x80000, 0), DEMO_SELECT(0x11000022, 0x11020203)); + if (!param_1->mpPartModel) { + return FALSE; + } + return TRUE; } /* 0000B284-0000B994 .text useHeapInit__FP10fopAc_ac_c */ -static BOOL useHeapInit(fopAc_ac_c*) { - /* Nonmatching */ +static BOOL useHeapInit(fopAc_ac_c* a_this) { + J3DModelData* modelData; + J3DModelData* bodyModelData; + J3DAnmTevRegKey* pBrk; + ResTIMG* pBti; + bgn_class* i_this = (bgn_class*)a_this; + + i_this->mpMorf = new mDoExt_McaMorf( + (J3DModelData*)dComIfG_getObjectRes("Bgn", BGN_BDL_BGN_HEAD1), + NULL, + NULL, + (J3DAnmTransformKey*)dComIfG_getObjectRes("Bgn", BGN_BCK_BGN_HEAD1), + J3DFrameCtrl::EMode_LOOP, + 1.0f, + 0, + -1, + 1, + NULL, + 0, + 0x11020203 + ); + if ((i_this->mpMorf == NULL) || (i_this->mpMorf->getModel() == NULL)) { + return FALSE; + } + i_this->mHeadParts[0].mpPartModel = i_this->mpMorf->getModel(); + i_this->mHeadParts[0].m0D2 = 16; + modelData = (J3DModelData*)dComIfG_getObjectRes("Bgn", BGN_BDL_BGN_MAIN1); + i_this->mpChestModel = mDoExt_J3DModel__create(modelData, 0, 0x11020203); + if (i_this->mpChestModel == NULL) { + return FALSE; + } + bodyModelData = (J3DModelData*)dComIfG_getObjectRes("Bgn", BGN_BDL_BGN_BODY1); + if (!part_init(&i_this->mPelvisParts[0], bodyModelData)) { + return FALSE; + } + i_this->mPelvisParts[0].m0D2 = 10; + for (s32 i = 0; i < 20; i++) { + if (!part_init(&i_this->mLeftArmParts[i], bodyModelData)) { + return FALSE; + } + if (!part_init(&i_this->mRightArmParts[i], bodyModelData)) { + return FALSE; + } + i_this->mRightArmParts[i].m0D2 = i * 3 + 13; + i_this->mLeftArmParts[i].m0D2 = i * 3 + 13; + } + for (s32 i = 0; i < 3; i++) { + if (!part_init(&i_this->mLeftLegParts[i], bodyModelData)) { + return FALSE; + } + if (!part_init(&i_this->mRightLegParts[i], bodyModelData)) { + return FALSE; + } + i_this->mRightLegParts[i].m0D2 = i * 3 + 10; + i_this->mLeftLegParts[i].m0D2 = i * 3 + 10; + } + for (s32 i = 0; i < 20; i++) { + if (!part_init(&i_this->mTailParts[i], bodyModelData)) { + return FALSE; + } + i_this->mTailParts[i].m0D2 = 11 - i; + } + modelData = (J3DModelData*)dComIfG_getObjectRes("Bgn", BGN_BDL_BGN_JYAKUTENA); + i_this->mpJyakutenAModel = mDoExt_J3DModel__create(modelData, DEMO_SELECT(0x80000, 0), DEMO_SELECT(0x11000022, 0x11020203)); + if (i_this->mpJyakutenAModel == NULL) { + return FALSE; + } + modelData = (J3DModelData*)dComIfG_getObjectRes("Bgn", BGN_BDL_BGN_JYAKUTENB); + i_this->mpJyakutenBModel = mDoExt_J3DModel__create(modelData, DEMO_SELECT(0x80000, 0), DEMO_SELECT(0x11000022, 0x11020203)); + if (i_this->mpJyakutenBModel == NULL) { + return FALSE; + } + i_this->mJyakutenBBrkAnm = new mDoExt_brkAnm(); +#if VERSION > VERSION_DEMO + if (i_this->mJyakutenBBrkAnm == NULL) { + return FALSE; + } +#endif + pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bgn", DEMO_SELECT(BGN_BRK_BGN_JYAKUTENBC, BGN_BRK_BGN_JYAKUTENB)); + if (!i_this->mJyakutenBBrkAnm->init(modelData, pBrk, true, J3DFrameCtrl::EMode_LOOP)) { + return FALSE; + } + modelData = (J3DModelData*)dComIfG_getObjectRes("Bgn", BGN_BDL_BGN_JYAKUTENC); + i_this->mpJyakutenCModel = mDoExt_J3DModel__create(modelData, DEMO_SELECT(0x80000, 0), DEMO_SELECT(0x11000022, 0x11020203)); + if (i_this->mpJyakutenCModel == NULL) { + return FALSE; + } + i_this->mJyakutenCBrkAnm = new mDoExt_brkAnm(); +#if VERSION > VERSION_DEMO + if (i_this->mJyakutenCBrkAnm == NULL) { + return FALSE; + } +#endif + pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bgn", DEMO_SELECT(BGN_BRK_BGN_JYAKUTENBC, BGN_BRK_BGN_JYAKUTENC)); + if (!i_this->mJyakutenCBrkAnm->init(modelData, pBrk, true, J3DFrameCtrl::EMode_LOOP)) { + return FALSE; + } + pBti = (ResTIMG*)dComIfG_getObjectRes("Bgn", BGN_BTI_NOT_CUT1); + if (!i_this->mRedRopeMat.init(1, 0x3C, pBti, 1)) { + return FALSE; + } + pBti = (ResTIMG*)dComIfG_getObjectRes("Bgn", BGN_BTI_HIMO); + if (!i_this->mBlueRopeMat.init(8, 0x3C, pBti, 1)) { + return FALSE; + } +#if VERSION > VERSION_DEMO + pBti = (ResTIMG*)dComIfG_getObjectRes("Bgn", BGN_BTI_NOT_CUT1); + if (!i_this->mDefeatCSRopeMat.init(1, 0x3C, pBti, 1)) { + return FALSE; + } +#endif + modelData = (J3DModelData*)dComIfG_getObjectRes("Bgn", BGN_BDL_R0E_A); + JUT_ASSERT(DEMO_SELECT(6628, 7026), modelData != NULL); + i_this->mpWater0Model = mDoExt_J3DModel__create(modelData, 0x80000, 0x31000000); + if (i_this->mpWater0Model == NULL) { + return FALSE; + } + i_this->mpWater1Model = mDoExt_J3DModel__create(modelData, 0x80000, 0x30000000); + if (i_this->mpWater1Model == NULL) { + return FALSE; + } + modelData = (J3DModelData*)dComIfG_getObjectRes("Bgn", BGN_BDL_R00); + i_this->mpRoomReflectionModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000022); + JUT_ASSERT(DEMO_SELECT(6654, 7052), modelData != NULL); + if (i_this->mpRoomReflectionModel == NULL) { + return FALSE; + } else { + return TRUE; + } } /* 0000B9DC-0000CA80 .text daBgn_Create__FP10fopAc_ac_c */ -static cPhs_State daBgn_Create(fopAc_ac_c* i_this) { +static cPhs_State daBgn_Create(fopAc_ac_c* a_this) { /* Nonmatching */ static dCcD_SrcSph cc_sph_src = { // dCcD_SrcGObjInf @@ -331,7 +3609,118 @@ static cPhs_State daBgn_Create(fopAc_ac_c* i_this) { /* Radius */ 70.0f, }}, }; - fopAcM_ct(i_this, bgn_class); + cXyz local_50; + + bgn_class* i_this = (bgn_class*)a_this; + cPhs_State res; + fopAcM_ct(a_this, bgn_class); + res = dComIfG_resLoad(&i_this->mPhase, "Bgn"); + if (res == cPhs_COMPLEATE_e) { + i_this->mPunchSmokeCb[0].setFollowOff(); + i_this->mPunchSmokeCb[1].setFollowOff(); +#if VERSION > VERSION_DEMO + bgn = i_this; +#endif + bgn2 = NULL; + bgn3 = NULL; + i_this->m02B4 = (u8)fopAcM_GetParam(a_this); + if (!fopAcM_entrySolidHeap(a_this, useHeapInit, 0x96000)) { + return cPhs_ERROR_e; + } + if (i_this->m02B4 != 0xFF) { + if (hio_set == false) { + i_this->mCC91 = 1; + hio_set = true; + l_HIO.mNo = mDoHIO_createChild("G(クグツ)", &l_HIO); // G (Puppet) + BGN_HAND_MAX = l_HIO.m0F0; + BGN_TAIL_MAX = l_HIO.m0F2; + } + i_this->mStts.Init(0xFF, 0xFF, a_this); + i_this->mC7FC.Set(cc_sph_src); + i_this->mC7FC.SetStts(&i_this->mStts); + i_this->mC7FC.OffAtSetBit(); + i_this->mCoreSph.Set(core_sph_src); + i_this->mCoreSph.SetStts(&i_this->mStts); + i_this->mHeadParts[0].mPartSph.Set(cc_sph_src); + i_this->mHeadParts[0].mPartSph.SetStts(&i_this->mStts); + i_this->mHeadParts[0].mPartSph.OffAtSetBit(); +#if VERSION > VERSION_DEMO + i_this->mHeadParts[0].mPartTevStr = a_this->tevStr; +#endif + for (s32 i = 0; i < 1; i++) { + i_this->mPelvisParts[i].mPartSph.Set(cc_sph_src); + i_this->mPelvisParts[i].mPartSph.SetStts(&i_this->mStts); + i_this->mPelvisParts[i].mPartSph.OffAtSetBit(); +#if VERSION > VERSION_DEMO + i_this->mPelvisParts[i].mPartTevStr = a_this->tevStr; +#endif + } + for (s32 i = 0; i < 20; i++) { + i_this->mLeftArmParts[i].mPartSph.Set(cc_sph_src); + i_this->mLeftArmParts[i].mPartSph.SetStts(&i_this->mStts); + i_this->mLeftArmParts[i].mPartSph.OffAtSetBit(); + i_this->mRightArmParts[i].mPartSph.Set(cc_sph_src); + i_this->mRightArmParts[i].mPartSph.SetStts(&i_this->mStts); + i_this->mRightArmParts[i].mPartSph.OffAtSetBit(); +#if VERSION > VERSION_DEMO + i_this->mLeftArmParts[i].mPartTevStr = a_this->tevStr; + i_this->mRightArmParts[i].mPartTevStr = a_this->tevStr; +#endif + } + for (s32 i = 0; i < 3; i++) { + i_this->mLeftLegParts[i].mPartSph.Set(cc_sph_src); + i_this->mLeftLegParts[i].mPartSph.SetStts(&i_this->mStts); + i_this->mLeftLegParts[i].mPartSph.OffAtSetBit(); + i_this->mRightLegParts[i].mPartSph.Set(cc_sph_src); + i_this->mRightLegParts[i].mPartSph.SetStts(&i_this->mStts); + i_this->mRightLegParts[i].mPartSph.OffAtSetBit(); +#if VERSION > VERSION_DEMO + i_this->mLeftLegParts[i].mPartTevStr = a_this->tevStr; + i_this->mRightLegParts[i].mPartTevStr = a_this->tevStr; +#endif + } + for (s32 i = 0; i < 20; i++) { + i_this->mTailParts[i].mPartSph.Set(cc_sph_src); + i_this->mTailParts[i].mPartSph.SetStts(&i_this->mStts); + i_this->mTailParts[i].mPartSph.OffAtSetBit(); +#if VERSION > VERSION_DEMO + i_this->mTailParts[i].mPartTevStr = a_this->tevStr; +#endif + } + for (s32 i = 0; i < 8; i++) { + i_this->mAAA8[i].m2FA = cM_rndF(32768.0f); + i_this->mAAA8[i].m2FC = cM_rndF(32768.0f); + } + if (dComIfGs_isEventBit(dSv_event_flag_c::UNK_3F10)) { + i_this->m02B4 = 0xFF; + local_50.set(375.17f, REG8_F(4) + 4441.46f, REG8_F(3) + -15.0f); + fopAcM_create(PROC_HIMO3, 0xf, &local_50, fopAcM_GetRoomNo(a_this)); + local_50.set(375.17f, REG8_F(4) + 4453.96f, 0.0f); + csXyz cStack_58(0, 0x4000, 0); + fopAcM_create(PROC_KUI, 0xffff0400, &local_50, fopAcM_GetRoomNo(a_this), &cStack_58, NULL, 0xFF, NULL); + } else { + for (s32 parameters = 0, i = 0; parameters < 8; i++, parameters++) { + fopAcM_create(PROC_ATT, parameters, &a_this->current.pos, fopAcM_GetRoomNo(a_this)); + i_this->mAAA8[i].m308 = 3; + } + fopAcM_create(PROC_BGN2, 0, &a_this->current.pos, fopAcM_GetRoomNo(a_this)); + fopAcM_create(PROC_BGN3, 0, &a_this->current.pos, fopAcM_GetRoomNo(a_this)); + mDoAud_bgmStart(JA_BGM_BGN_KUGUTSU); + a_this->health = 3; + a_this->max_health = 3; + } + i_this->mCC80 = 1.0f; + i_this->mC748 = 7; + i_this->mC7AC[0] = 0x3c; +#if VERSION > VERSION_DEMO + bg_tevstr = a_this->tevStr; + i_this->mWaterTevStr = a_this->tevStr; + i_this->mRoomTevStr = a_this->tevStr; +#endif + daBgn_Execute(i_this); + } + } + return res; } static actor_method_class l_daBgn_Method = { @@ -354,7 +3743,7 @@ actor_process_profile_definition g_profile_BGN = { /* Leaf SubMtd */ &g_fopAc_Method.base, /* Priority */ PRIO_BGN, /* Actor SubMtd */ &l_daBgn_Method, - /* Status */ fopAcStts_UNK4000_e | fopAcStts_UNK40000_e | fopAcStts_BOSS_e, + /* Status */ DEMO_SELECT(fopAcStts_UNK4000_e | fopAcStts_UNK40000_e, fopAcStts_UNK4000_e | fopAcStts_UNK40000_e | fopAcStts_BOSS_e), /* Group */ fopAc_ENEMY_e, /* CullType */ fopAc_CULLBOX_0_e, }; diff --git a/src/d/actor/d_a_bgn2.cpp b/src/d/actor/d_a_bgn2.cpp index 5687a2ea0..7b69f52c7 100644 --- a/src/d/actor/d_a_bgn2.cpp +++ b/src/d/actor/d_a_bgn2.cpp @@ -1,32 +1,108 @@ /** * d_a_bgn2.cpp - * Boss - Puppet Ganon (Phase 2) + * Boss - Puppet Ganon (Phase 2) / G(タラバ) (G (King crab)) */ #include "d/dolzel_rel.h" // IWYU pragma: keep #include "d/actor/d_a_bgn2.h" +#include "d/actor/d_a_bgn.h" +#include "d/actor/d_a_bgn3.h" +#include "d/actor/d_a_player.h" #include "d/d_procname.h" #include "d/d_priority.h" #include "d/d_cc_d.h" +#include "d/d_s_play.h" +#include "d/res/res_bgn.h" + +class daBgn2_HIO_c : public JORReflexible { +public: + daBgn2_HIO_c(); + virtual ~daBgn2_HIO_c() {}; + void genMessage(JORMContext*) {} + +public: + /* 0x04 */ s8 mNo; + /* 0x05 */ u8 m05; + /* 0x06 */ u8 m06; + /* 0x07 */ u8 m07[0x08 - 0x07]; + /* 0x08 */ f32 m08; + /* 0x0C */ f32 m0C; + /* 0x10 */ f32 m10; + /* 0x14 */ f32 m14; + /* 0x18 */ s16 m18; + /* 0x1A */ s16 m1A; + /* 0x1C */ s16 m1C; + /* 0x1E */ s16 m1E; + /* 0x20 */ s16 m20; + /* 0x22 */ s16 m22; + /* 0x24 */ s16 m24; + /* 0x26 */ s16 m26; + /* 0x28 */ s16 m28; + /* 0x2A */ s16 m2A; + /* 0x2C */ s16 m2C; + /* 0x2E */ s16 m2E; + /* 0x30 */ s16 m30; +}; /* 000000EC-00000194 .text __ct__12daBgn2_HIO_cFv */ daBgn2_HIO_c::daBgn2_HIO_c() { - /* Nonmatching */ + mNo = -1; + m05 = 0; + m06 = 0; + m08 = 280.0f; + m0C = 3000.0f; + m10 = 15.0f; + m14 = -2.0f; + m18 = 0x5dc; + m1A = 0xa28; + m1C = 0xed8; + m1E = 0x3c; + m20 = 0x32; + m22 = 0x28; + m24 = 100; + m26 = DEMO_SELECT(80, 100); + m28 = DEMO_SELECT(50, 100); + m2A = DEMO_SELECT(200, 600); + m2C = 100; + m2E = 3; + m30 = 10; } +static bgn_class* bgn; +static bgn3_class* bgn3; +static cXyz zero(0.0f, 0.0f, 0.0f); +static bool hio_set; +static daBgn2_HIO_c l_HIO; +static dKy_tevstr_c bg_tevstr; +static s32 ki_all_count; + /* 00000194-000002BC .text anm_init__FP10bgn2_classifUcfi */ -void anm_init(bgn2_class*, int, float, unsigned char, float, int) { - /* Nonmatching */ +static void anm_init(bgn2_class* i_this, int bckFileIdx, f32 morf, u8 loopMode, f32 speed, int soundFileIdx) { + if (soundFileIdx >= 0) { + i_this->mpBodyMorf->setAnm( + (J3DAnmTransform*)dComIfG_getObjectRes("Bgn", bckFileIdx), loopMode, morf, speed, 0.0f, -1.0f, dComIfG_getObjectRes("Bgn", soundFileIdx) + ); + } else { + i_this->mpBodyMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bgn", bckFileIdx), loopMode, morf, speed, 0.0f, -1.0f, NULL); + } } /* 000002BC-00000308 .text bgn_s_sub__FPvPv */ -void bgn_s_sub(void*, void*) { - /* Nonmatching */ +static void* bgn_s_sub(void* param_1, void*) { + if ((fopAc_IsActor(param_1)) && (fopAcM_GetName(param_1) == PROC_BGN)) { + return param_1; + } else { + return NULL; + } } /* 00000308-00000354 .text bgn3_s_sub__FPvPv */ -void bgn3_s_sub(void*, void*) { - /* Nonmatching */ +static void* bgn3_s_sub(void* param_1, void*) { + if ((fopAc_IsActor(param_1)) && (fopAcM_GetName(param_1) == PROC_BGN3)) { + return param_1; + } else { + return NULL; + } } /* 00000354-0000035C .text daBgn2_Draw__FP10bgn2_class */ @@ -35,98 +111,951 @@ static BOOL daBgn2_Draw(bgn2_class*) { } /* 0000035C-000006EC .text gr_check__FP10bgn2_classP4cXyz */ -void gr_check(bgn2_class*, cXyz*) { - /* Nonmatching */ +static s32 gr_check(bgn2_class* i_this, cXyz* param_2) { + fopAc_ac_c* actor = &i_this->actor; + dBgS_LinChk linChk; + + cXyz local_ac = *param_2; + local_ac.y += 200.0f; + cXyz local_b8 = *param_2; + local_b8.y -= 1000.0f; + linChk.Set(&local_ac, &local_b8, actor); + if (dComIfG_Bgsp()->LineCross(&linChk)) { + *param_2 = linChk.GetCross(); + param_2->y = REG0_F(8) + -2.0f; + if (dComIfG_Bgsp()->GetAttributeCode(linChk) == dBgS_Attr_WATER_e) { + return FALSE; + } + } + return TRUE; } /* 00000B60-00000CA0 .text asi_eff_set__FP10bgn2_class */ -void asi_eff_set(bgn2_class*) { - /* Nonmatching */ +static void asi_eff_set(bgn2_class* i_this) { + cXyz local_1c; + cXyz local_28; + + local_28.setall(0.0f); + g_env_light.settingTevStruct(TEV_TYPE_BG2, &local_28, &bg_tevstr); + for (s32 i = 0; i < 6; i++) { + s32 j = i * 5 + 8; + local_1c = i_this->m2B98[j]; + if (!gr_check(i_this, &local_1c)) { + dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_KGTT2JUMPHANDSPLASH00, &local_1c, 0xFF, g_whiteColor, g_whiteColor, 0); + } else { +#if VERSION == VERSION_DEMO + GXColor c1; + c1.r = bg_tevstr.mColorC0.r; + c1.g = bg_tevstr.mColorC0.g; + c1.b = bg_tevstr.mColorC0.b; + c1.a = 0xA0; + GXColor c2; + c2.r = bg_tevstr.mColorK0.r; + c2.g = bg_tevstr.mColorK0.g; + c2.b = bg_tevstr.mColorK0.b; + c2.a = 0xA0; + dComIfGp_particle_setSimple(dPa_name::ID_AK_ST_O_KGTT2JUMPHANDSMOKE00, &local_1c, 0xA0, c1, c2, 0); +#else + dComIfGp_particle_setSimple(dPa_name::ID_AK_ST_O_KGTT2JUMPHANDSMOKE00, &local_1c, 0xFF, g_whiteColor, g_whiteColor, 0); +#endif + if (!(i_this->m0310 & 1)) { + dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_KGTCOMMONHAMON00, &local_1c, 0xFF, g_whiteColor, g_whiteColor, 0); + } + } + } } /* 00000CA0-00000D88 .text asi_hamon_set__FP10bgn2_class */ -void asi_hamon_set(bgn2_class*) { - /* Nonmatching */ +static void asi_hamon_set(bgn2_class* i_this) { + cXyz local_1c; + cXyz local_28; + + local_28.setall(0.0f); + g_env_light.settingTevStruct(TEV_TYPE_BG2, &local_28, &bg_tevstr); + for (s32 i = 0; i < 30; i++) { + s32 j = i + 4; + local_1c = i_this->m2B98[j]; + if ((!gr_check(i_this, &local_1c)) && (!(i_this->m0310 + i & 7))) { + dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_KGTCOMMONHAMON00, &local_1c, 0xFF, g_whiteColor, g_whiteColor, 0); + } + } } /* 00000D88-00000FA8 .text attack_eff_set__FP10bgn2_class4cXyz */ -void attack_eff_set(bgn2_class*, cXyz) { +static void attack_eff_set(bgn2_class* i_this, cXyz param_2) { /* Nonmatching */ +#if VERSION == VERSION_DEMO + fopAc_ac_c* actor = &i_this->actor; +#endif + JPABaseEmitter* emitter; + J3DModel* model; + cXyz local_28; + + daPy_py_c* player = daPy_getPlayerActorClass(); + if (!gr_check(i_this, ¶m_2)) { + model = i_this->mpBodyMorf->getModel(); + emitter = dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTT2CHESTSPLASH00, ¶m_2); + if (emitter != NULL) { + emitter->setGlobalRTMatrix(model->getAnmMtx(2)); + } + emitter = dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTT2STOMACHSPLASH00, ¶m_2); + if (emitter != NULL) { + emitter->setGlobalRTMatrix(model->getAnmMtx(0x22)); + } + fopAcM_seStart(player, JA_SE_CM_BGN_T_FALL_WATER, 0); + } else { + fopAcM_seStart(player, JA_SE_CM_BGN_T_FALL, 0); +#if VERSION == VERSION_DEMO + local_28.setall(0.0f); + g_env_light.settingTevStruct(TEV_TYPE_BG2, &local_28, &bg_tevstr); + emitter = dComIfGp_particle_setToon(dPa_name::ID_AK_ST_KGTCOMMONSMOKE00, ¶m_2, NULL, NULL, 0xA0, NULL, fopAcM_GetRoomNo(actor)); + if (emitter != NULL) { + emitter->setGlobalPrmColor(bg_tevstr.mColorC0.r, bg_tevstr.mColorC0.g, bg_tevstr.mColorC0.b); + emitter->setGlobalEnvColor(bg_tevstr.mColorK0.r, bg_tevstr.mColorK0.g, bg_tevstr.mColorK0.b); + } +#else + for (s32 i = 0; i < 16; i++) { + local_28.x = param_2.x + cM_rndFX(500.0f); + local_28.y = param_2.y + cM_rndF(100.0f); + local_28.z = param_2.z + cM_rndFX(500.0f); + dComIfGp_particle_setSimple(dPa_name::ID_AK_ST_O_KGTT2JUMPHANDSMOKE00, &local_28, 0xFF, g_whiteColor, g_whiteColor, 0); + } +#endif + } } /* 00000FA8-00000FE4 .text checkGround__FP10bgn2_class */ -void checkGround(bgn2_class*) { - /* Nonmatching */ +static s32 checkGround(bgn2_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + if (actor->current.pos.y <= l_HIO.m08) { + actor->current.pos.y = l_HIO.m08; + actor->speed.y = 0.0f; + return TRUE; + } + return FALSE; } /* 00000FE4-00001210 .text move_se_set__FP10bgn2_class */ -void move_se_set(bgn2_class*) { - /* Nonmatching */ +static void move_se_set(bgn2_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + u32 uVar2; + cXyz local_28; + + local_28 = actor->current.pos - actor->old.pos; + local_28.y = 0.0f; + uVar2 = local_28.abs() * 3.5f; + if (uVar2 > 100) { + uVar2 = 100; + } + fopAcM_seStart(actor, JA_SE_CM_BGN_MECHA_ROTATE, uVar2); + local_28 = actor->current.pos - actor->old.pos; + local_28.z = 0.0f; + local_28.x = 0.0f; + uVar2 = local_28.abs() * 2.0f; + if (uVar2 > 100) { + uVar2 = 100; + } + fopAcM_seStart(actor, JA_SE_CM_BGN_MECHA_ROPE, uVar2); } /* 00001210-0000137C .text pos_move__FP10bgn2_class */ -void pos_move(bgn2_class*) { - /* Nonmatching */ +static s32 pos_move(bgn2_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + f32 fVar1; + cXyz local_18; + cXyz local_24; + + local_18.x = 0.0f; + local_18.y = 0.0f; + local_18.z = actor->speedF; + cMtx_YrotS(*calc_mtx, actor->current.angle.y); + MtxPosition(&local_18, &local_24); + actor->speed.x = local_24.x; + actor->speed.z = local_24.z; + i_this->m034C = i_this->m0340; + i_this->m0340.x += actor->speed.x; + i_this->m0340.z += actor->speed.z; + fVar1 = std::sqrtf(SQUARE(i_this->m0340.x) + SQUARE(i_this->m0340.z)); + if (fVar1 > REG0_F(3) + 1500.0f) { + i_this->m0340.x = i_this->m034C.x; + i_this->m0340.z = i_this->m034C.z; + actor->speedF = 0.0f; + return TRUE; + } + return FALSE; } /* 0000137C-0000144C .text start__FP10bgn2_class */ -void start(bgn2_class*) { - /* Nonmatching */ +static void start(bgn2_class* i_this) { + switch (i_this->m0314) { + case 0: + anm_init(i_this, BGN_BCK_DERU1, 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->m0314 = 1; + // fallthrough + case 1: + if (i_this->mpBodyMorf->isStop()) { + i_this->m0312 = 1; + anm_init(i_this, BGN_BCK_RAKKA1, 10.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->m0314 = 1; + } + break; + } } /* 0000144C-00001474 .text ki_set__FP10bgn2_class */ -void ki_set(bgn2_class*) { - /* Nonmatching */ +static void ki_set(bgn2_class* i_this) { + if (i_this->m2ED2 != 0) { + return; + } + i_this->m2ED0 = l_HIO.m2E; + i_this->m2ED2 = l_HIO.m2C; } /* 00001474-00001860 .text plesattack__FP10bgn2_class */ -void plesattack(bgn2_class*) { - /* Nonmatching */ +static void plesattack(bgn2_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + s8 sVar6; + + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); + s8 bVar1 = false; + switch (i_this->m0314) { + case 0: + if (actor->current.pos.y > l_HIO.m0C + 2.0f) { + cLib_addCalc2(&actor->current.pos.y, l_HIO.m0C, 0.1f, l_HIO.m10); + actor->speed.y = 0.0f; + actor->speedF = REG0_F(9) + 30.0f; + break; + } + i_this->m2E82 = 0; + anm_init(i_this, BGN_BCK_RAKKA1, 10.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->m0314 = 1; + if (actor->health == 3) { + i_this->m0330[0] = l_HIO.m1E; + } else if (actor->health == 2) { + i_this->m0330[0] = l_HIO.m20; + } else { + i_this->m0330[0] = l_HIO.m22; + // fallthrough + } + case 1: + if (i_this->mpBodyMorf->isStop()) { + anm_init(i_this, BGN_BCK_RAKKA2, 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->m0314 = 2; + } + // fallthrough + case 2: + if ((i_this->m0330[0] != 0) && (actor->speed.y = actor->speed.y - l_HIO.m14, i_this->m0330[0] == 1)) { + fopAcM_seStart(actor, JA_SE_CM_BGN_T_FALL_WIND, 0); + } + i_this->m2E78 = 1; + i_this->m2E79 = 1; + if (checkGround(i_this)) { + ki_set(i_this); + anm_init(i_this, BGN_BCK_SETTI1, 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->m0314 = 3; + dComIfGp_getVibration().StartShock(REG0_S(2) + 5, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + sVar6 = actor->health; + if (sVar6 == 3) { + i_this->m0330[0] = l_HIO.m24; + } else if (sVar6 == 2) { + i_this->m0330[0] = l_HIO.m26; + } else { + i_this->m0330[0] = l_HIO.m28; + } + attack_eff_set(i_this, actor->current.pos); + } + break; + case 3: + asi_hamon_set(i_this); + if (i_this->m0330[0] > 10) { + bVar1 = true; + } + if (i_this->m0330[0] == 0) { + i_this->m0312 = 2; + i_this->m0314 = 0; + actor->speed.y = 0.0f; + return; + } + } + i_this->m0318 = player->current.pos; + actor->current.angle.y = cM_atan2s(i_this->m0318.x - actor->current.pos.x, i_this->m0318.z - actor->current.pos.z); + pos_move(i_this); + cLib_addCalc0(&actor->speedF, 1.0f, 2.0f); + actor->current.pos.y = actor->current.pos.y + actor->speed.y; + actor->speed.y = actor->speed.y + l_HIO.m14; + checkGround(i_this); + if (bVar1) { + cLib_addCalc2(&i_this->m2EC4, REG0_F(9) + 250.0f, 1.0f, REG0_F(10) + 50.0f); + } } /* 00001860-00001C5C .text jumpattack__FP10bgn2_class */ -void jumpattack(bgn2_class*) { - /* Nonmatching */ +static void jumpattack(bgn2_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + J3DModel* pBrk; + cXyz local_34; + +#if VERSION == VERSION_DEMO + s8 r29 = 0; +#endif + int frame = (int)i_this->mpBodyMorf->getFrame(); + i_this->m2E82 = 0; + pBrk = i_this->mpBodyMorf->getModel(); + switch (i_this->m0314) { + case 0: + anm_init(i_this, BGN_BCK_JUMP1, 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->m0314 = 1; + // fallthrough + case 1: + actor->speedF = 0.0f; + if (frame == 6) { + i_this->m2EC8[0] = dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTT2CHESTPOTA00, &actor->current.pos); + i_this->m2EC8[1] = dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTT2STOMACHPOTA00, &actor->current.pos); + } + if ((frame >= 5) && (frame <= 20)) { + asi_eff_set(i_this); + } + if (frame == REG0_S(0) + 0x14) { + actor->speed.y = REG0_F(8) + 250.0f; + i_this->m0314 = 2; + fopAcM_seStart(actor, JA_SE_CM_BGN_T_JUMP_UP, 0); + case 2: + actor->speedF = REG0_F(9) + 50.0f; + break; + } + } + if (i_this->m2EC8[0] != NULL) { + i_this->m2EC8[0]->setGlobalRTMatrix(pBrk->getAnmMtx(2)); + } + if (i_this->m2EC8[1] != NULL) { + i_this->m2EC8[1]->setGlobalRTMatrix(pBrk->getAnmMtx(0x22)); + } + actor->current.angle.y = cM_atan2s(-actor->current.pos.x, -actor->current.pos.z); + local_34 = actor->current.pos; + local_34.y = 0.0f; + actor->current.pos.y += actor->speed.y; + actor->speed.y -= (REG0_F(10) + 8.0f); + if ((actor->speed.y <= 0.0f) && (actor->speed.y = 0.0f, i_this->m0314 >= 2)) { + for (s32 i = 0; i < 2; i++) { + if (i_this->m2EC8[i] != NULL) { + i_this->m2EC8[i]->becomeInvalidEmitter(); + i_this->m2EC8[i] = NULL; + } + } + if (pos_move(i_this) || (local_34.abs() < 500.0f)) { + i_this->m0312 = 1; + i_this->m0314 = 0; + if (actor->health == 3) { + i_this->m2E82 = l_HIO.m18; + } else if (actor->health == 2) { + i_this->m2E82 = l_HIO.m1A; + } else { + i_this->m2E82 = l_HIO.m1C; + } + if (cM_rndF(1.0f) < 0.5f) { + i_this->m2E82 *= -1; + } + } + } +#if VERSION == VERSION_DEMO + checkGround(i_this); + if (r29) { + cLib_addCalc2(&i_this->m2EC4, REG0_F(9) + 250.0f, 1.0f, REG0_F(10) + 50.0f); + } +#else + checkGround(i_this); +#endif } /* 00001C5C-00001D4C .text mahi__FP10bgn2_class */ -void mahi(bgn2_class*) { - /* Nonmatching */ +static void mahi(bgn2_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + switch (i_this->m0314) { + case 0: + fopAcM_monsSeStart(actor, JA_SE_CV_BGN_HIT_2, 0); + i_this->m0330[0] = l_HIO.m2A; + i_this->m0314 = 1; + // fallthrough + case 1: + i_this->mpHeadMorf->play(&actor->current.pos, 0, 0); + if (i_this->m0330[0] == 0) { + i_this->m0312 = 2; + i_this->m0314 = 0; + actor->speed.y = 0.0f; + actor->current.angle.y = actor->shape_angle.y; + } + break; + } + asi_hamon_set(i_this); + checkGround(i_this); } /* 00001D4C-00001EB4 .text damage__FP10bgn2_class */ -void damage(bgn2_class*) { - /* Nonmatching */ +static void damage(bgn2_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + i_this->mpHeadMorf->play(&actor->current.pos, 0, 0); + switch (i_this->m0314) { + case 0: + anm_init(i_this, BGN_BCK_DAMAGE1, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->m0314 = 1; + // fallthrough + case 1: + if (i_this->mpBodyMorf->isStop()) { + i_this->m0314 = 2; + } + // fallthrough + case 2: + if ((actor->current.pos.y > 1490.0f) && (i_this->m0314 == 2)) { + i_this->m0312 = 2; + actor->speed.y = REG0_F(8) + 250.0f; + i_this->m0314 = 2; + actor->current.angle.y = actor->shape_angle.y; + } else { + cLib_addCalc2(&i_this->m2EC4, REG0_F(0xb) + 250.0f, 1.0f, REG0_F(0xc) + 100.0f); + } + break; + } + cLib_addCalc2(&actor->current.pos.y, 1500.0f, 0.2f, 200.0f); + i_this->m2E82 = 0x800; + i_this->m2E80 = 0x800; } /* 00001EB4-00002320 .text hensin__FP10bgn2_class */ -void hensin(bgn2_class*) { - /* Nonmatching */ +static void hensin(bgn2_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + cXyz local_2c; + + cLib_addCalc2(&i_this->m0340.x, 0.0f, 0.05f, 50.0f); + cLib_addCalc2(&i_this->m0340.z, 0.0f, 0.05f, 50.0f); + i_this->m2E82 = 0; + i_this->m2E80 = 0; + switch (i_this->m0314) { +#if VERSION == VERSION_DEMO + case 0: + anm_init(i_this, BGN_BCK_WAIT2, 10.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + i_this->m0314 = 1; + i_this->m0330[0] = 0x96; + bgn->mCSMode = 10; + actor->speed.y = 0.0f; + case 1: +#else + case 0: + anm_init(i_this, BGN_BCK_SETTI1, 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->m0314 = 1; + bgn->mCSMode = 10; + actor->speed.y = REG8_F(0xc) + 50.0f; + i_this->m0330[0] = 0x30; + break; + case 1: + if (i_this->m0330[0] == 0) { + i_this->m0314 = 2; + anm_init(i_this, BGN_BCK_WAIT2, 10.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + i_this->m0330[0] = REG8_S(5) + 0x5a; + actor->speed.y = 0.0f; + } + break; + case 2: +#endif + if ((int)i_this->mpBodyMorf->getFrame() == 3) { + fopAcM_seStart(actor, JA_SE_CM_BGN_T_SLIDE, 0); + } + if (i_this->m0330[0] == 0) { + i_this->m0314 = 5; + i_this->m0330[0] = 0x46; + anm_init(i_this, BGN_BCK_MODORU1, 10.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + fopAcM_seStart(actor, JA_SE_CM_BGN_T_TO_M_1, 0); + } + break; +#if VERSION == VERSION_DEMO + case 2: + break; +#endif + case 3: + break; + case 4: + break; + case 5: +#if VERSION > VERSION_DEMO + if (i_this->m0330[0] == 0x32) { + bgn->mCA60 = 0x96; + } +#endif + if (i_this->m0330[0] <= 0x32) { + cLib_addCalc2(&i_this->m2E7C, 1.0f, 1.0f, 0.04f); + if (i_this->m2E7C > 0.99f) { + bgn->mCC90 = 1; + bgn->mCSMode++; + bgn3->actor.current.angle = actor->shape_angle; + bgn3->actor.shape_angle = actor->shape_angle; + bgn3->actor.current.pos = actor->current.pos; + bgn3->m10060 = 1.0f; + local_2c.setall(REG0_F(4) + 10.0f); + dComIfGp_particle_set(dPa_name::ID_AK_JN_SIBOUBAKUEN, &bgn3->actor.current.pos, NULL, &local_2c); + dComIfGp_particle_set(dPa_name::ID_AK_JN_SIBOUFLASH, &bgn3->actor.current.pos, NULL, &local_2c); + mDoAud_seStart(JA_SE_CM_BGN_METAM_EXPLODE, NULL, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + dComIfGp_getVibration().StartShock(REG0_S(2) + 8, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + mDoAud_bgmStart(JA_BGM_BGN_HAYAMUSHI); + } + } + break; + } + actor->current.pos.y += actor->speed.y; + actor->speed.y += l_HIO.m14; + asi_hamon_set(i_this); + checkGround(i_this); } /* 00002320-000026A4 .text move__FP10bgn2_class */ -void move(bgn2_class*) { - /* Nonmatching */ +static void move(bgn2_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + f32 fVar1; + cXyz* pcVar8; + u8* pcVar7; + f32 dVar9; + cXyz local_a0; + cXyz cStack_ac; + + switch (i_this->m0312) { + case 0: + start(i_this); + break; + case 1: + plesattack(i_this); + move_se_set(i_this); + break; + case 2: + jumpattack(i_this); + move_se_set(i_this); + break; + case 4: + mahi(i_this); + break; + case 5: + damage(i_this); + break; + case 6: + hensin(i_this); + move_se_set(i_this); + case 10: + break; + } + cLib_addCalc2(&actor->current.pos.x, i_this->m0340.x, 0.05f, 1000.0f); + cLib_addCalc2(&actor->current.pos.z, i_this->m0340.z, 0.05f, 1000.0f); + actor->shape_angle.y = actor->shape_angle.y + i_this->m2E80; + fVar1 = i_this->m2E80; + if (fVar1 < 0.0f) { + fVar1 *= -1.0f; + } + fVar1 *= 0.02631579f; + if (fVar1 > 100.0f) { + fVar1 = 100.0f; + } + fopAcM_seStart(actor, JA_SE_CM_BGN_T_ROUND, fVar1); + cLib_addCalcAngleS2(&i_this->m2E80, i_this->m2E82, 1, 100); + MTXCopy(i_this->mpBodyMorf->getModel()->getAnmMtx(2), *calc_mtx); + local_a0.setall(0.0f); + MtxPosition(&local_a0, &cStack_ac); + cLib_addCalc0(&i_this->m2EC4, 1.0f, 25.0f); + pcVar8 = i_this->mRedRopeMat.getPos(0); + pcVar7 = i_this->mRedRopeMat.getSize(0); + for (s32 i = 0; i < 60; i++) { + dVar9 = i_this->m2EC4 * cM_ssin(cM_rad2s(0.053247336f * (f32)(i))); + dVar9 *= (0.01666667f * (f32)(0x3B - i)); + local_a0.x = dVar9 * cM_ssin(i_this->m0310 * (REG0_S(3) + 300) + i * (REG0_S(4) + 2000)); + local_a0.y = 0.0f; + local_a0.z = dVar9 * cM_ssin(i_this->m0310 * (REG0_S(5) + 0xfa) + i * (REG0_S(6) + 2000)); + *pcVar8 = cStack_ac + local_a0; + *pcVar7 = REG0_S(3) + 10; + cStack_ac.y += 50.0f; + pcVar8++; + pcVar7++; + } } /* 000026A4-00002C88 .text damage_check__FP10bgn2_class */ -void damage_check(bgn2_class*) { - /* Nonmatching */ +static void damage_check(bgn2_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + char cVar5; + JPABaseEmitter* emitter; + f32 dVar8; + csXyz local_78; + cXyz local_58; + CcAtInfo atInfo; +#if VERSION == VERSION_DEMO + daPy_py_c* player = daPy_getPlayerActorClass(); +#endif + + if (i_this->m033A == 0) { + atInfo.pParticlePos = NULL; + if (i_this->m039C.ChkTgHit()) { + atInfo.mpObj = i_this->m039C.GetTgHitObj(); + at_power_check(&atInfo); + if ((atInfo.mResultingAttackType == 9) || (atInfo.mResultingAttackType == 2)) { + i_this->m0312 = 4; + i_this->m0314 = 0; + i_this->m033A = 0x14; + i_this->m0358 = REG0_S(5) + 0x14; + dScnPly_ply_c::nextPauseTimer = 4; +#if VERSION == VERSION_DEMO + local_58.z = 2.0f; + local_58.y = 2.0f; + local_58.x = 2.0f; + local_78.z = 0; + local_78.x = 0; + local_78.y = player->shape_angle.y + 0x8000; + dComIfGp_particle_set(dPa_name::ID_AK_JN_OK, i_this->m039C.GetTgHitPosP(), &local_78, &local_58); +#else + dComIfGp_particle_set(dPa_name::ID_AK_JN_CRITICALHITFLASH, i_this->m039C.GetTgHitPosP()); + local_58.z = 2.0f; + local_58.y = 2.0f; + local_58.x = 2.0f; + local_78.z = 0; + local_78.x = 0; + local_78.y = fopAcM_searchPlayerAngleY(actor); +#endif + dComIfGp_particle_set( + DEMO_SELECT(dPa_name::ID_IT_SN_DK_KAMEN_HAHEN00, dPa_name::ID_AK_JN_OK), + i_this->m039C.GetTgHitPosP(), + DEMO_SELECT(&actor->shape_angle, &local_78), + DEMO_SELECT(NULL, &local_58) + ); + dKy_SordFlush_set(DEMO_SELECT(actor->current.pos, *i_this->m039C.GetTgHitPosP()), 1); + dComIfGp_getVibration().StartShock(REG0_S(2) + 3, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + def_se_set(actor, atInfo.mpObj, 0x40); + return; + } + } + if (i_this->m2A48.ChkTgHit()) { + i_this->m033A = 0x14; +#if VERSION > VERSION_DEMO + i_this->m2D6A = 1; + i_this->mArrowHitFlashTimer = 30; +#endif + i_this->m0312 = 5; + i_this->m0314 = 0; + if (actor->health != 0) { + actor->health--; +#if VERSION > VERSION_DEMO + mDoAud_seStart(JA_SE_LK_ARROW_HIT, NULL, 0x35, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); +#endif + dVar8 = (REG0_F(5) + 2.0f); + if (actor->health == 0) { + mDoAud_bgmStop(30); +#if VERSION == VERSION_DEMO + fopAcM_monsSeStart(actor, JA_SE_CV_BGN_HIT_2, 0); + fopAcM_seStart(actor, JA_SE_LK_LAST_HIT, 0); + fopAcM_seStart(actor, JA_SE_CM_BGN_M_BRK_ORB, 0); +#else + mDoAud_monsSeStart(JA_SE_CV_BGN_HIT_2, NULL, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + mDoAud_seStart(JA_SE_LK_LAST_HIT, NULL, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + mDoAud_seStart(JA_SE_CM_BGN_M_BRK_ORB, NULL, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); +#endif + i_this->m0312 = 6; + i_this->m0314 = 0; + emitter = dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTBREAKWEAKPOINT00, &i_this->m2E6C); + if (emitter != NULL) { + JGeometry::TVec3 scale(dVar8, dVar8, dVar8); + emitter->setGlobalScale(scale); + } + emitter = dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTBREAKWEAKPOINT01, &i_this->m2E6C); + if (emitter != NULL) { + JGeometry::TVec3 scale(dVar8, dVar8, dVar8); + emitter->setGlobalScale(scale); + } +#if VERSION > VERSION_DEMO + for (s32 i = 0; i < 2; i++) { + if (i_this->m2EC8[i] != NULL) { + i_this->m2EC8[i]->becomeInvalidEmitter(); + i_this->m2EC8[i] = NULL; + } + } +#endif + } else { +#if VERSION == VERSION_DEMO + fopAcM_monsSeStart(actor, JA_SE_CV_BGN_HIT_1, 0); +#else + mDoAud_monsSeStart(JA_SE_CV_BGN_HIT_1, NULL, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); +#endif + emitter = dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTHITWEAKPOINT00, &i_this->m2E6C); + if (emitter != NULL) { + JGeometry::TVec3 scale(dVar8, dVar8, dVar8); + emitter->setGlobalScale(scale); + } + } + } + } + cVar5 = 0; + if (i_this->m039C.ChkTgHit()) { + atInfo.mpObj = i_this->m039C.GetTgHitObj(); + cVar5 = 1; + } + for (s32 i = 0; i < 2; i++) { + if (i_this->m04C8[i].ChkTgHit()) { + atInfo.mpObj = i_this->m04C8[i].GetTgHitObj(); + cVar5 = 2; + } + } + for (s32 i = 0; i < 30; i++) { + if (i_this->m0720[i].ChkTgHit()) { + atInfo.mpObj = i_this->m0720[i].GetTgHitObj(); + cVar5 = 3; + } + } + if ((cVar5 != 0) && (i_this->m033C == 0)) { + i_this->m033C = 10; + def_se_set(actor, atInfo.mpObj, 0x44); + } + } } /* 00002C88-00002CE0 .text ki_c_sub__FPvPv */ -void ki_c_sub(void*, void*) { - /* Nonmatching */ +static void* ki_c_sub(void* param_1, void*) { + if ((fopAc_IsActor(param_1)) && (fopAcM_GetName(param_1) == PROC_KI)) { + ki_all_count++; + } + return NULL; } /* 00002CE0-00002D24 .text ki_check__FP10bgn2_class */ -void ki_check(bgn2_class*) { - /* Nonmatching */ +static s32 ki_check(bgn2_class* i_this) { + ki_all_count = 0; + fpcM_Search(ki_c_sub, i_this); + return ki_all_count; } /* 00002D24-000037B0 .text daBgn2_Execute__FP10bgn2_class */ -static BOOL daBgn2_Execute(bgn2_class*) { - /* Nonmatching */ +static BOOL daBgn2_Execute(bgn2_class* i_this) { + /* Nonmatching - retail-only regalloc */ + static s32 body_d[] = { + 0x00000001, + 0x00000022, + }; + + static f32 body_scale[] = { + 550.0f, + 400.0f, + }; + + static f32 asi_scale[] = { + 100.0f, + 130.0f, + 100.0f, + 80.0f, + 50.0f, + }; + +#if VERSION > VERSION_DEMO + static s16 fl_check_d[] = { + 0x0015, 0x001A, 0x001F, 0x0024, 0x0029, 0x0015, 0x001A, 0x001F, 0x0024, 0x0029, 0x0015, 0x001A, 0x001F, 0x0024, 0x0029, 0x0015, + 0x001A, 0x001F, 0x0024, 0x0029, 0x0015, 0x001A, 0x001F, 0x0024, 0x0029, 0x0015, 0x001A, 0x001F, 0x0024, 0x0029, 0x0002, 0x000A, + }; +#endif + + fopAc_ac_c* actor = &i_this->actor; + f32 fVar2; + f32 dVar18; + cXyz local_a0; +#if VERSION > VERSION_DEMO + cXyz local_ac; +#endif + cXyz local_b8; + + bgn = (bgn_class*)fpcM_Search(bgn_s_sub, i_this); + if (bgn == NULL) { + return TRUE; + } + bgn3 = (bgn3_class*)fpcM_Search(bgn3_s_sub, i_this); +#if VERSION > VERSION_DEMO + if (bgn3 == NULL) { + return TRUE; + } +#endif + if (l_HIO.m06 != 0) { + actor->health = l_HIO.m06; + } + if (bgn->m02B5 != 1) { + i_this->m0312 = 10; + actor->current.pos.set(0.0f, 2000.0f, 0.0f); + fopAcM_OffStatus(actor, 0); + actor->attention_info.flags = 0; + i_this->m2ED2 = l_HIO.m2C; + return TRUE; + } + if (i_this->m0312 == 10) { + i_this->m0312 = 0; + i_this->m0314 = 0; + actor->health = 3; + } + actor->attention_info.flags = fopAc_Attn_LOCKON_BATTLE_e; + cLib_addCalc2(&i_this->m2E7C, 0.0f, 1.0f, 0.01f); + i_this->m0310++; + actor->attention_info.distances[fopAc_Attn_TYPE_BATTLE_e] = 4; + for (s32 i = 0; i < 5; i++) { + if (i_this->m0330[i] != 0) { + i_this->m0330[i]--; + } + } + if (i_this->m033A != 0) { + i_this->m033A--; + } + if (i_this->m033C != 0) { + i_this->m033C--; + } + if (i_this->m2ED2 != 0) { + i_this->m2ED2--; + } + if (l_HIO.m05 == 0) { + move(i_this); + } + i_this->mpHeadMorf->play(&actor->current.pos, 0, 0); + i_this->mpBodyMorf->play(&actor->current.pos, 0, 0); + i_this->mJyakutenCBrkAnm->play(); + i_this->mJyakutenBBrkAnm->play(); + mDoMtx_stack_c::transS(actor->current.pos.x, actor->current.pos.y, actor->current.pos.z); + mDoMtx_stack_c::YrotM(actor->shape_angle.y); + mDoMtx_stack_c::XrotM(actor->shape_angle.x); + mDoMtx_stack_c::ZrotM(actor->shape_angle.z); + J3DModel* bodyModel = i_this->mpBodyMorf->getModel(); + MtxP mtx = mDoMtx_stack_c::get(); + bodyModel->setBaseTRMtx(mtx); + local_a0.setall(0.0f); + i_this->mpBodyMorf->calc(); + mtx = bodyModel->getAnmMtx(3); + cMtx_copy(mtx, *calc_mtx); + MtxTrans(REG0_F(0), REG0_F(1), REG0_F(2) + 100.0f, true); + if (i_this->m0358 != 0) { + i_this->m0358--; + } + dVar18 = (i_this->m0358 * (REG0_F(14) + 500.0f)); + s16 y = dVar18 * cM_ssin(i_this->m0310 * 0x2100); + s16 x = dVar18 * cM_scos(i_this->m0310 * 0x2300); + cMtx_YrotM(*calc_mtx, y); + cMtx_XrotM(*calc_mtx, x); + MtxScale(REG0_F(7) + 2.0f, REG0_F(7) + 2.0f, REG0_F(7) + 2.0f, true); + J3DModel* headModel = i_this->mpHeadMorf->getModel(); + mtx = *calc_mtx; + headModel->setBaseTRMtx(mtx); + MtxPosition(&local_a0, &i_this->m2B74); + i_this->mpHeadMorf->calc(); + MTXCopy(bodyModel->getAnmMtx(0x23), *calc_mtx); + MtxTrans(REG0_F(3) + 150.0f, REG0_F(4) + 150.0f, REG0_F(5), true); + cMtx_YrotM(*calc_mtx, 0x4000); + MtxScale(REG0_F(6) + 2.0f, REG0_F(6) + 2.0f, REG0_F(6) + 2.0f, true); + for (s32 i = 0; i < 3; i++) { + J3DModel* model = i_this->mpJyakutenModel[i]; + model->setBaseTRMtx(*calc_mtx); + } + MtxPosition(&local_a0, &i_this->m2E6C); + i_this->m039C.SetC(i_this->m2B74); + i_this->m039C.SetR(REG0_F(0) + 150.0f); + dComIfG_Ccsp()->Set(&i_this->m039C); + actor->eyePos = i_this->m2B74; + actor->attention_info.position = actor->eyePos; + actor->attention_info.position.y += 100.0f; + for (s32 i = 0; i < 2; i++) { + MTXCopy(bodyModel->getAnmMtx(body_d[i]), *calc_mtx); + if (i == 1) { + local_a0.x = 400.0f; + } + MtxPosition(&local_a0, &i_this->m2B80[i]); + i_this->m04C8[i].SetC(i_this->m2B80[i]); + i_this->m04C8[i].SetR(REG0_F(i + 1) + body_scale[i]); + if (i_this->m2E78 != 0) { + i_this->m04C8[i].OnAtSetBit(); + } else { + i_this->m04C8[i].OffAtSetBit(); + } + dComIfG_Ccsp()->Set(&i_this->m04C8[i]); + } + i_this->m2E78 = 0; + local_a0.x = 0.0f; +#if VERSION > VERSION_DEMO + if (i_this->m2D6A != 0) { + i_this->m2D6A++; + if (i_this->m2D6A > 100) { + i_this->m2D6A = 0; + } + } + if (i_this->mArrowHitFlashTimer != 0) { + i_this->mArrowHitFlashTimer--; + } +#endif + for (s32 i = 0; i < DEMO_SELECT(30, 32); i++) { +#if VERSION > VERSION_DEMO + if (i < 30) { +#endif + MTXCopy(bodyModel->getAnmMtx(i + 4), *calc_mtx); + MtxPosition(&local_a0, &i_this->m2B98[i]); + i_this->m0720[i].SetC(i_this->m2B98[i]); + fVar2 = (REG0_F(2) + 1.6f) * asi_scale[i % 5]; + i_this->m0720[i].SetR(fVar2); + if (i_this->m2E79 != 0) { + i_this->m0720[i].OnAtSetBit(); + } else { + i_this->m0720[i].OffAtSetBit(); + } + dComIfG_Ccsp()->Set(&i_this->m0720[i]); +#if VERSION > VERSION_DEMO + } +#endif +#if VERSION > VERSION_DEMO + if (i_this->m2D6A == fl_check_d[i]) { + i_this->mArrowHitEffectTimer[i] = 100; + } + if (i_this->mArrowHitEffectTimer[i] != 0) { + i_this->mArrowHitEffectTimer[i]--; + if (i < 30) { + local_ac = i_this->m2B98[i]; + } else if (i == 30) { + local_ac = i_this->m2B80[0]; + fVar2 = (REG8_F(3) + 400.0f); + } else if (i == 31) { + local_ac = i_this->m2B80[1]; + fVar2 = (REG8_F(4) + 400.0f); + } + f32 f29 = (REG8_F(0) + 0.0003f) * (fVar2 * i_this->mArrowHitEffectTimer[i]); + if (i_this->mpArrowHitEmitter1[i] == NULL) { + i_this->mpArrowHitEmitter1[i] = dComIfGp_particle_set(dPa_name::ID_AK_JN_CCTHUNDER00, &local_ac); + } else { + i_this->mpArrowHitEmitter1[i]->setGlobalTranslation(local_ac.x, local_ac.y, local_ac.z); + JGeometry::TVec3 scale(f29, f29, f29); + i_this->mpArrowHitEmitter1[i]->setGlobalScale(scale); + } + if (i_this->mpArrowHitEmitter2[i] == NULL) { + i_this->mpArrowHitEmitter2[i] = dComIfGp_particle_set(dPa_name::ID_AK_JN_CCTHUNDER01, &local_ac); + } else { + i_this->mpArrowHitEmitter2[i]->setGlobalTranslation(local_ac.x, local_ac.y, local_ac.z); + JGeometry::TVec3 scale(f29, f29, f29); + i_this->mpArrowHitEmitter2[i]->setGlobalScale(scale); + } + } else { + if (i_this->mpArrowHitEmitter1[i] != NULL) { + i_this->mpArrowHitEmitter1[i]->becomeInvalidEmitter(); + i_this->mpArrowHitEmitter1[i] = NULL; + } + if (i_this->mpArrowHitEmitter2[i] != NULL) { + i_this->mpArrowHitEmitter2[i]->becomeInvalidEmitter(); + i_this->mpArrowHitEmitter2[i] = NULL; + } + } +#endif + } + i_this->m2E79 = 0; + i_this->m2A48.SetC(i_this->m2E6C); + i_this->m2A48.SetR(REG0_F(9) + 210.0f); + dComIfG_Ccsp()->Set(&i_this->m2A48); + damage_check(i_this); + if (i_this->m2ED0 != 0) { + i_this->m2ED0--; + if (ki_check(i_this) < l_HIO.m30) { + local_b8.x = cM_rndFX(2500.0f); + local_b8.y = cM_rndF(500.0f) + 3500.0f; + local_b8.z = cM_rndFX(2500.0f); + fopAcM_create(PROC_KI, 0xFFFF0003, &local_b8, fopAcM_GetRoomNo(actor)); + } + } + i_this->mAcch.CrrPos(*dComIfG_Bgsp()); + return TRUE; } /* 000037B0-000037B8 .text daBgn2_IsDelete__FP10bgn2_class */ @@ -135,18 +1064,100 @@ static BOOL daBgn2_IsDelete(bgn2_class*) { } /* 000037B8-00003828 .text daBgn2_Delete__FP10bgn2_class */ -static BOOL daBgn2_Delete(bgn2_class*) { - /* Nonmatching */ +static BOOL daBgn2_Delete(bgn2_class* i_this) { + dComIfG_resDeleteDemo(&i_this->mPhase, "Bgn"); + if (i_this->m30D8 != 0) { + hio_set = false; + mDoHIO_deleteChild(l_HIO.mNo); + } + return TRUE; } /* 00003828-00003C60 .text useHeapInit__FP10fopAc_ac_c */ -static BOOL useHeapInit(fopAc_ac_c*) { - /* Nonmatching */ +static BOOL useHeapInit(fopAc_ac_c* a_this) { + J3DModelData* modelData; + J3DAnmTevRegKey* pBrk; + ResTIMG* pBti; + bgn2_class* i_this = (bgn2_class*)a_this; + + i_this->mpHeadMorf = new mDoExt_McaMorf( + (J3DModelData*)dComIfG_getObjectRes("Bgn", BGN_BDL_BGN_HEAD1), + NULL, + NULL, + (J3DAnmTransformKey*)dComIfG_getObjectRes("Bgn", BGN_BCK_BGN_HEAD1), + J3DFrameCtrl::EMode_LOOP, + 1.0f, + 0, + -1, + 1, + NULL, + 0, + 0x11020203 + ); + if ((i_this->mpHeadMorf == NULL) || (i_this->mpHeadMorf->getModel() == NULL)) { + return FALSE; + } + i_this->mpBodyMorf = new mDoExt_McaMorf( + (J3DModelData*)dComIfG_getObjectRes("Bgn", BGN_BDL_BGN_KUMO1), + NULL, + NULL, + (J3DAnmTransformKey*)dComIfG_getObjectRes("Bgn", BGN_BCK_WAIT1), + J3DFrameCtrl::EMode_LOOP, + 1.0f, + 0, + -1, + 1, + NULL, + 0, + 0x11020203 + ); + if ((i_this->mpBodyMorf == NULL) || (i_this->mpBodyMorf->getModel() == NULL)) { + return FALSE; + } + modelData = (J3DModelData*)dComIfG_getObjectRes("Bgn", DEMO_SELECT(BGN_BDL_BGN_JYAKUTENA, BGN_BDL_BGN_JYAKUTENA2)); + i_this->mpJyakutenModel[2] = mDoExt_J3DModel__create(modelData, DEMO_SELECT(0x80000, 0), DEMO_SELECT(0x11000022, 0x11020203)); + if (i_this->mpJyakutenModel[2] == NULL) { + return FALSE; + } + modelData = (J3DModelData*)dComIfG_getObjectRes("Bgn", DEMO_SELECT(BGN_BDL_BGN_JYAKUTENB, BGN_BDL_BGN_JYAKUTENB2)); + i_this->mpJyakutenModel[1] = mDoExt_J3DModel__create(modelData, DEMO_SELECT(0x80000, 0), DEMO_SELECT(0x11000022, 0x11020203)); + if (i_this->mpJyakutenModel[1] == NULL) { + return FALSE; + } + i_this->mJyakutenBBrkAnm = new mDoExt_brkAnm(); +#if VERSION > VERSION_DEMO + if (i_this->mJyakutenBBrkAnm == NULL) { + return FALSE; + } +#endif + pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bgn", DEMO_SELECT(BGN_BRK_BGN_JYAKUTENBC, BGN_BRK_BGN_JYAKUTENB2)); + if (!i_this->mJyakutenBBrkAnm->init(modelData, pBrk, true, J3DFrameCtrl::EMode_LOOP)) { + return FALSE; + } + modelData = (J3DModelData*)dComIfG_getObjectRes("Bgn", DEMO_SELECT(BGN_BDL_BGN_JYAKUTENC, BGN_BDL_BGN_JYAKUTENC2)); + i_this->mpJyakutenModel[0] = mDoExt_J3DModel__create(modelData, DEMO_SELECT(0x80000, 0), DEMO_SELECT(0x11000022, 0x11020203)); + if (i_this->mpJyakutenModel[0] == NULL) { + return FALSE; + } + i_this->mJyakutenCBrkAnm = new mDoExt_brkAnm(); +#if VERSION > VERSION_DEMO + if (i_this->mJyakutenCBrkAnm == NULL) { + return FALSE; + } +#endif + pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bgn", DEMO_SELECT(BGN_BRK_BGN_JYAKUTENBC, BGN_BRK_BGN_JYAKUTENC2)); + if (!i_this->mJyakutenCBrkAnm->init(modelData, pBrk, true, J3DFrameCtrl::EMode_LOOP)) { + return FALSE; + } + pBti = (ResTIMG*)dComIfG_getObjectRes("Bgn", BGN_BTI_NOT_CUT1); + if (!i_this->mRedRopeMat.init(1, 0x3C, pBti, 1)) { + return FALSE; + } + return TRUE; } /* 00003CA8-00003FF4 .text daBgn2_Create__FP10fopAc_ac_c */ -static cPhs_State daBgn2_Create(fopAc_ac_c*) { - /* Nonmatching */ +static cPhs_State daBgn2_Create(fopAc_ac_c* a_this) { static dCcD_SrcSph cc_sph_src = { // dCcD_SrcGObjInf { @@ -203,6 +1214,51 @@ static cPhs_State daBgn2_Create(fopAc_ac_c*) { /* Radius */ 70.0f, }}, }; +#if VERSION > VERSION_DEMO + fopAcM_SetupActor(a_this, bgn2_class); +#endif + bgn2_class* i_this = (bgn2_class*)a_this; + cPhs_State res = dComIfG_resLoad(&i_this->mPhase, "Bgn"); + + if (res == cPhs_COMPLEATE_e) { +#if VERSION == VERSION_DEMO + fopAcM_SetupActor(a_this, bgn2_class); +#endif + bgn = NULL; + if (!fopAcM_entrySolidHeap(a_this, useHeapInit, 0x96000)) { + return cPhs_ERROR_e; + } + if (hio_set == false) { + i_this->m30D8 = 1; + hio_set = true; + l_HIO.mNo = mDoHIO_createChild("G(タラバ)", &l_HIO); // G (King crab) + } + i_this->mStts.Init(0xFF, 0xFF, a_this); + i_this->m039C.Set(cc_sph_src); + i_this->m039C.SetStts(&i_this->mStts); + i_this->m039C.OffAtSetBit(); + for (s32 i = 0; i < 2; i++) { + i_this->m04C8[i].Set(cc_sph_src); + i_this->m04C8[i].SetStts(&i_this->mStts); + i_this->m04C8[i].OffAtSetBit(); + } + for (s32 i = 0; i < 30; i++) { + i_this->m0720[i].Set(cc_sph_src); + i_this->m0720[i].SetStts(&i_this->mStts); + } + i_this->m2A48.Set(core_sph_src); + i_this->m2A48.SetStts(&i_this->mStts); + i_this->m0340 = a_this->current.pos; + a_this->health = 3; + a_this->max_health = 3; + i_this->mAcch.Set(fopAcM_GetPosition_p(a_this), fopAcM_GetOldPosition_p(a_this), a_this, 1, &i_this->mAcchCir, fopAcM_GetSpeed_p(a_this)); + i_this->mAcchCir.SetWall(50.0f, 50.0f); +#if VERSION > VERSION_DEMO + bg_tevstr = a_this->tevStr; +#endif + daBgn2_Execute(i_this); + } + return res; } static actor_method_class l_daBgn2_Method = { diff --git a/src/d/actor/d_a_bgn3.cpp b/src/d/actor/d_a_bgn3.cpp index 30c162e13..3697f8a11 100644 --- a/src/d/actor/d_a_bgn3.cpp +++ b/src/d/actor/d_a_bgn3.cpp @@ -1,132 +1,1135 @@ /** * d_a_bgn3.cpp - * Boss - Puppet Ganon (Phase 3) + * Boss - Puppet Ganon (Phase 3) / G(ハヤムシ)(G (Fast worm)) */ -#include "d/dolzel_rel.h" // IWYU pragma: keep +#include "d/dolzel_rel.h" // IWY pragma: keep #include "d/actor/d_a_bgn3.h" +#include "d/actor/d_a_bgn.h" +#include "d/actor/d_a_esa.h" +#include "d/actor/d_a_player.h" #include "d/d_procname.h" #include "d/d_priority.h" #include "d/d_cc_d.h" +#include "d/d_s_play.h" +#include "d/res/res_bgn.h" + +class daBgn3_HIO_c : public JORReflexible { +public: + daBgn3_HIO_c(); + virtual ~daBgn3_HIO_c() {}; + void genMessage(JORMContext*) {} + +public: + /* 0x04 */ s8 mNo; + /* 0x05 */ u8 m05; + /* 0x06 */ u8 m06; + /* 0x07 */ u8 m07[0x08 - 0x07]; + /* 0x08 */ f32 m08; + /* 0x0C */ s16 m0C; + /* 0x0E */ s16 m0E; + /* 0x10 */ f32 m10; + /* 0x14 */ s16 m14; + /* 0x16 */ s16 m16; + /* 0x18 */ f32 m18; + /* 0x1C */ s16 m1C; + /* 0x1E */ s16 m1E; + /* 0x20 */ s16 m20; + /* 0x22 */ s16 m22; + /* 0x24 */ s16 m24; + /* 0x26 */ s16 m26; + /* 0x28 */ s16 m28; + /* 0x2A */ s16 m2A; + /* 0x2C */ s16 m2C; + /* 0x2E */ s16 m2E; + /* 0x30 */ s16 m30; + /* 0x32 */ u8 m32[0x34 - 0x32]; + /* 0x34 */ f32 m34; + /* 0x38 */ f32 m38; + /* 0x3C */ s16 m3C; + /* 0x3E */ u8 m3E; + /* 0x3F */ u8 m3F[0x40 - 0x3F]; + /* 0x40 */ f32 m40; + /* 0x44 */ f32 m44; + /* 0x48 */ f32 m48; + /* 0x4C */ f32 m4C; + /* 0x50 */ s16 m50; + /* 0x52 */ s16 m52; + /* 0x54 */ s16 m54; +}; + +static bgn_class* bgn; +static esa_class* esa; +static cXyz zero(0.0f, 0.0f, 0.0f); +static bool hio_set; +static daBgn3_HIO_c l_HIO; +static GXColor ke_color; +static s32 ki_all_count; + +static u16 ke_max[] = {0x0028, 0x0023, 0x001E, 0x0019, 0x0014, 0x000F, 0x000F}; + +static f32 size_d[] = {1.0f, 0.9f, 0.8f, 0.7f, 0.6f, 0.5f, 0.4f, 0.3f, 0.6f}; /* 000000EC-000001F4 .text __ct__12daBgn3_HIO_cFv */ daBgn3_HIO_c::daBgn3_HIO_c() { - /* Nonmatching */ + mNo = -1; + m05 = 0; + m06 = 0; + m08 = 50.0f; + m0C = 800; + m0E = 3; + m20 = 0x3c; + m10 = 60.0f; + m14 = 1000; + m16 = 3; + m22 = 0x28; + m18 = 80.0f; + m1C = 0x4b0; + m1E = 3; + m24 = 0x1e; + m26 = 10; + m28 = 0x14; + m2A = 0x2d; + m2C = 0x78; + m2E = 200; + m30 = 0xfa; + m34 = 5.0f; + m38 = 0.5f; + m3C = 3; + m3E = 1; + m40 = 150.0f; + m44 = 45.0f; + m48 = 8.0f; + m4C = -8.0f; + m50 = 0xbc; + m52 = 0x98; + m54 = 0x42; } +#if VERSION > VERSION_DEMO /* 000001F4-00000240 .text bgn_s_sub__FPvPv */ -void bgn_s_sub(void*, void*) { - /* Nonmatching */ +static void* bgn_s_sub(void* param_1, void*) { + if ((fopAc_IsActor(param_1)) && (fopAcM_GetName(param_1) == PROC_BGN)) { + return param_1; + } else { + return NULL; + } } +#endif /* 00000240-00000368 .text daBgn3_Draw__FP10bgn3_class */ -static BOOL daBgn3_Draw(bgn3_class*) { - /* Nonmatching */ +static BOOL daBgn3_Draw(bgn3_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; +#if VERSION > VERSION_DEMO + bgn = (bgn_class*)fpcM_Search(bgn_s_sub, i_this); +#endif + if (((bgn != NULL) && (bgn->m02B5 == 2)) && (l_HIO.m3E != 0)) { + i_this->mLineMat.update(5, l_HIO.m48, ke_color, 3, &actor->tevStr); + dComIfGd_set3DlineMat(&i_this->mLineMat); + part_s3* part = i_this->mParts; + for (s32 i = 0; i < 8; i++, part++) { + part->mPart3LineMat.update(5, l_HIO.m48, ke_color, 3, &actor->tevStr); + dComIfGd_set3DlineMat(&part->mPart3LineMat); + } + } + return TRUE; } /* 00000368-000006F8 .text gr_check__FP10bgn3_classP4cXyz */ -void gr_check(bgn3_class*, cXyz*) { - /* Nonmatching */ +static s32 gr_check(bgn3_class* i_this, cXyz* param_2) { + fopAc_ac_c* actor = &i_this->actor; + dBgS_LinChk linChk; + + cXyz local_ac = *param_2; + local_ac.y += 200.0f; + cXyz local_b8 = *param_2; + local_b8.y -= 1000.0f; + linChk.Set(&local_ac, &local_b8, actor); + if (dComIfG_Bgsp()->LineCross(&linChk)) { + *param_2 = linChk.GetCross(); + param_2->y = REG0_F(8) + -2.0f; + if (dComIfG_Bgsp()->GetAttributeCode(linChk) == dBgS_Attr_WATER_e) { + return FALSE; + } + } + return TRUE; } /* 00000B6C-00000D90 .text tail_eff_set__FP10bgn3_class */ -void tail_eff_set(bgn3_class*) { - /* Nonmatching */ +static void tail_eff_set(bgn3_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + cXyz local_38; + + if ((i_this->m0FD88 + 2 & 3) == 0) { + local_38 = actor->current.pos; + if (!gr_check(i_this, &local_38)) { + dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_KGTCOMMONHAMON03, &local_38, 0xFF, g_whiteColor, g_whiteColor, 0); + if (i_this->m0FD94 == 0) { + i_this->m0FD94 = cM_rndF(20.0f) + 20.0f; + fopAcM_seStart(actor, JA_SE_CM_BGN_M_HEAD_RIPPLE, 0); + } + } + } + for (s32 i = 0; i < 9; i++) { + if ((i_this->m0FD88 + i & 3) == 0) { + local_38 = i_this->mParts[i].m00D4; + if (!gr_check(i_this, &local_38)) { + dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_KGTCOMMONHAMON00, &local_38, 0xFF, g_whiteColor, g_whiteColor, 0); + if ((i == 8) && (i_this->m0FD94 == 0)) { + i_this->m0FD94 = cM_rndF(20.0f) + 20.0f; + mDoAud_seStart(JA_SE_CM_BGN_M_TAIL_RIPPL, &i_this->m10054, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + } + } + } + } } /* 00000D90-00000EB8 .text move_splash_set__FP10bgn3_class */ -void move_splash_set(bgn3_class*) { - /* Nonmatching */ +static void move_splash_set(bgn3_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + cXyz local_28; + + if ((i_this->m0FD88 + 2 & 3) == 0) { + local_28 = actor->current.pos; + if (!gr_check(i_this, &local_28)) { + dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_KGTCOMMONSPLASH01, &local_28, 0xFF, g_whiteColor, g_whiteColor, 0); + } + } + for (s32 i = 0; i < 9; i++) { + if ((i_this->m0FD88 + i & 7) == 0) { + local_28 = i_this->mParts[i].m00D4; + if (!gr_check(i_this, &local_28)) { + dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_KGTCOMMONSPLASH00, &local_28, 0xFF, g_whiteColor, g_whiteColor, 0); + } + } + } } /* 00000EB8-0000101C .text drop_eff_set__FP10bgn3_class */ -void drop_eff_set(bgn3_class*) { - /* Nonmatching */ +static void drop_eff_set(bgn3_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + cXyz local_18; + + local_18 = actor->current.pos; + if (!gr_check(i_this, &local_18)) { + dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTT1PUNCHSPLASH00, &local_18); + dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTT1PUNCHSPLASH01, &local_18); + dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTT1PUNCHHAMON00, &local_18); + dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_KGTCOMMONSPLASH01, &local_18, 0xFF, g_whiteColor, g_whiteColor, 0); + dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_KGTCOMMONHAMON01, &local_18, 0xFF, g_whiteColor, g_whiteColor, 0); + } } /* 0000101C-00001068 .text esa_s_sub__FPvPv */ -void esa_s_sub(void*, void*) { - /* Nonmatching */ +static void* esa_s_sub(void* param_1, void*) { + if ((fopAc_IsActor(param_1)) && (fopAcM_GetName(param_1) == PROC_ESA)) { + return param_1; + } else { + return NULL; + } } /* 00001068-000013D0 .text part_control__FP10bgn3_class */ -void part_control(bgn3_class*) { - /* Nonmatching */ +static void part_control(bgn3_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + f32 fVar1; + f32 fVar2; + f32 dVar11; + f32 dVar10; + f32 dVar9; + f32 dVar8; + cXyz local_b0; + cXyz cStack_bc; + cXyz local_c8; + + dVar9 = i_this->m0FDB8; + dVar8 = (REG0_F(8) + 150.0f); + dVar10 = (REG0_F(6) + -5.0f); + i_this->mParts[0].m00D4 = i_this->m0FD7C; + s32 i = 1; + part_s3* ppVar4 = &i_this->mParts[1]; + cMtx_YrotS(*calc_mtx, actor->shape_angle.y); + cMtx_XrotM(*calc_mtx, actor->shape_angle.x); + local_b0.set(0.0f, 0.0f, -i_this->m0FDBC); + MtxPosition(&local_b0, &local_c8); + for (i = 1; i < 10; i++, ppVar4++) { + fVar1 = (70.0f + REG0_F(19)) * ppVar4[-1].m00F4; + fVar2 = ppVar4->m00E8.y + (ppVar4->m00D4.y + dVar10); + if (fVar2 <= fVar1) { + fVar2 = fVar1; + } + fVar1 = local_c8.x + (ppVar4->m00E8.x + (ppVar4->m00D4.x - ppVar4[-1].m00D4.x)); + dVar11 = (fVar2 - ppVar4[-1].m00D4.y); + fVar2 = local_c8.z + (ppVar4->m00E8.z + (ppVar4->m00D4.z - ppVar4[-1].m00D4.z)); + ppVar4[-1].m00E2 = cM_atan2s(fVar1, fVar2); + ppVar4[-1].m00E0 = -cM_atan2s(dVar11, std::sqrtf(SQUARE(fVar1) + SQUARE(fVar2))); + cMtx_YrotS(*calc_mtx, ppVar4[-1].m00E2); + cMtx_XrotM(*calc_mtx, ppVar4[-1].m00E0); + local_b0.set(0.0f, 0.0f, dVar8 * ppVar4[-1].m00F4); + MtxPosition(&local_b0, &cStack_bc); + ppVar4->m00E8 = ppVar4->m00D4; + ppVar4->m00D4 = ppVar4[-1].m00D4 + cStack_bc; + ppVar4->m00E8.x = (dVar9 * (ppVar4->m00D4.x - ppVar4->m00E8.x)); + ppVar4->m00E8.y = (dVar9 * (ppVar4->m00D4.y - ppVar4->m00E8.y)); + ppVar4->m00E8.z = (dVar9 * (ppVar4->m00D4.z - ppVar4->m00E8.z)); + } + cLib_addCalc2(&i_this->m0FDB8, l_HIO.m38, 1.0f, 0.002f); + cLib_addCalc2(&i_this->m0FDBC, l_HIO.m34, 1.0f, 0.5f); } /* 000013D0-00001800 .text checkWall__FP10bgn3_class */ -void checkWall(bgn3_class*) { - /* Nonmatching */ +static s32 checkWall(bgn3_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + f32 fVar5; + cXyz local_ac; + cXyz cStack_b8; + + local_ac = actor->current.pos - actor->old.pos; + local_ac.y = 0.0f; + fVar5 = local_ac.abs(); + if (fVar5 > 0.0f) { + dBgS_LinChk local_a0; + cMtx_YrotS(*calc_mtx, cM_atan2s(local_ac.x, local_ac.z)); + local_ac.x = 0.0f; + local_ac.y = 100.0f; + local_ac.z = REG0_F(4) + 150.0f; + MtxPosition(&local_ac, &cStack_b8); + cStack_b8 += actor->current.pos; + local_ac = actor->current.pos; + local_ac.y += 100.0f; + local_a0.Set(&local_ac, &cStack_b8, actor); + if (dComIfG_Bgsp()->LineCross(&local_a0)) { + actor->current.pos.x = actor->old.pos.x; + actor->current.pos.z = actor->old.pos.z; + return TRUE; + } + } + return FALSE; } /* 00001800-00001848 .text checkGround__FP10bgn3_class */ -void checkGround(bgn3_class*) { - /* Nonmatching */ +static s32 checkGround(bgn3_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + if (actor->current.pos.y <= REG0_F(9) + 150.0f) { + actor->current.pos.y = REG0_F(9) + 150.0f; + actor->speed.y = 0.0f; + return TRUE; + } + return FALSE; } /* 00001848-000018EC .text pos_move__FP10bgn3_class */ -void pos_move(bgn3_class*) { - /* Nonmatching */ +static void pos_move(bgn3_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + cXyz local_1c; + cXyz local_28; + + local_1c.x = 0.0f; + local_1c.y = 0.0f; + local_1c.z = actor->speedF; + cMtx_YrotS(*calc_mtx, actor->current.angle.y); + MtxPosition(&local_1c, &local_28); + actor->speed.x = local_28.x; + actor->speed.z = local_28.z; + actor->current.pos += actor->speed; + actor->speed.y += REG0_F(3) + -5.0f; } /* 000018EC-00001D64 .text move0__FP10bgn3_class */ -void move0(bgn3_class*) { - /* Nonmatching */ +static void move0(bgn3_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); + s8 bVar1; + s16 maxSpeed; + s16 sVar3; + s16 sVar5; + f32 dVar6; + f32 fVar7; + cXyz local_4c; + + if (esa != NULL) { + i_this->m0FD90 = 2; + } + if ((int)i_this->m0FD90 != 0) { + i_this->m0FD90--; + maxSpeed = i_this->m0FD8E; + if (maxSpeed < 0) { + maxSpeed *= -1; + } + if (i_this->m0FDB0 != 0) { + sVar3 = (s16)cM_atan2s(-actor->current.pos.x, -actor->current.pos.z); + } else if (esa != NULL) { + local_4c = esa->current.pos - actor->current.pos; + sVar3 = (s16)cM_atan2s(local_4c.x, local_4c.z); + maxSpeed *= 2; + } else { + dVar6 = cM_ssin(i_this->m0FD88 * (REG0_S(9) + 0x900)); + sVar3 = fopAcM_searchPlayerAngleY(actor); + sVar3 = sVar3 + (s16)((REG0_F(18) + 4000.0f) * dVar6); + } + cLib_addCalcAngleS2(&actor->current.angle.y, sVar3, 4, maxSpeed); + } else { + actor->current.angle.y += i_this->m0FD8E; + } + if (actor->health == 3) { + fVar7 = l_HIO.m08; + } else if (actor->health == 2) { + fVar7 = l_HIO.m10; + } else { + fVar7 = l_HIO.m18; + } + cLib_addCalc2(&actor->speedF, fVar7, 1.0f, 3.0f); + pos_move(i_this); + checkGround(i_this); + bVar1 = false; + if ((checkWall(i_this)) && (i_this->m0FDAA[1] == 0)) { + i_this->m0FD90 = 0; + actor->current.angle.y += 0x8000; + i_this->m0FDB8 = REG0_F(5) + 0.9f; + bVar1 = true; + i_this->m0FDAA[1] = 0x14; + dComIfGp_getVibration().StartShock(REG0_S(2) + 5, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + fopAcM_seStart(actor, JA_SE_CM_BGN_M_HIT_WALL, 0); + i_this->m100AC = l_HIO.m3C; + if (actor->health == 3) { + sVar5 = l_HIO.m0E; + } else if (actor->health == 2) { + sVar5 = l_HIO.m16; + } else { + sVar5 = l_HIO.m1E; + } + i_this->m0FD92++; + if (i_this->m0FD92 >= sVar5) { + i_this->m0FD92 = 0; + if (actor->health == 3) { + i_this->m0FD90 = l_HIO.m20; + } else if (actor->health == 2) { + i_this->m0FD90 = l_HIO.m22; + } else { + i_this->m0FD90 = l_HIO.m24; + } + } + } + if (i_this->m0FDAE == 0) { + i_this->m0FDAE = cM_rndF(50.0f) + 30.0f; + bVar1 = true; + } + if (bVar1) { + if (actor->health == 3) { + i_this->m0FD8E = l_HIO.m0C; + } else if (actor->health == 2) { + i_this->m0FD8E = l_HIO.m14; + } else { + i_this->m0FD8E = l_HIO.m1C; + } + if (cM_rndF(1.0f) < 0.5f) { + i_this->m0FD8E *= -1; + } + } + i_this->m0FF28.OnAtSetBit(); + i_this->m0FDFC.OnAtSetBit(); + actor->current.angle.x = 0; } /* 00001D64-00001E6C .text mahi__FP10bgn3_class */ -void mahi(bgn3_class*) { - /* Nonmatching */ +static void mahi(bgn3_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + switch (i_this->m0FD8C) { + case 0: + i_this->m0FD8C = 1; + // fallthrough + case 1: + i_this->mpMorf->play(&actor->current.pos, 0, 0); + if (i_this->m0FDAA[0] == 0) { + i_this->m0FD8A = 0; + i_this->m0FD8C = 0; + } + break; + } + cLib_addCalc0(&actor->speedF, 1.0f, 3.0f); + pos_move(i_this); + actor->current.angle.x = 0; + checkGround(i_this); + if ((checkWall(i_this)) && (i_this->m0FDAA[1] == 0)) { + i_this->m0FD90 = 0; + actor->current.angle.y += 0x8000; + i_this->m0FDB8 = REG0_F(5) + 0.9f; + } } /* 00001E6C-00002100 .text damage__FP10bgn3_class */ -void damage(bgn3_class*) { - /* Nonmatching */ +static void damage(bgn3_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + cXyz local_34; + + switch (i_this->m0FD8C) { + case 0: + actor->speed.y = 150.0f; + actor->speedF = 30.0f; + i_this->m0FD8C = 1; + i_this->m0FDB8 = 1.0f; + break; + case 1: + cLib_addCalc2(&i_this->m100A0, REG0_F(9) + 350.0f, 1.0f, REG0_F(10) + 50.0f); + if (checkGround(i_this)) { + actor->speed.y = 50.0f; + i_this->m0FD8C = 2; + actor->current.angle.y = cM_rndF(65536.0f); + i_this->m0FDB8 = 1.0f; + dComIfGp_getVibration().StartShock(REG0_S(2) + 5, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + drop_eff_set(i_this); + } + break; + case 2: + if (checkGround(i_this)) { + i_this->m0FD8A = 0; + i_this->m0FD8C = 0; + } + break; + } + pos_move(i_this); + local_34 = actor->current.pos - actor->old.pos; + actor->current.angle.x = -cM_atan2s(local_34.y, std::sqrtf(SQUARE(local_34.x) + SQUARE(local_34.z))); + if (actor->current.angle.x > 0x3000) { + actor->current.angle.x = 0x3000; + } else if (actor->current.angle.x < -0x3000) { + actor->current.angle.x = -0x3000; + } + checkGround(i_this); + if ((checkWall(i_this)) && (i_this->m0FDAA[1] == 0)) { + actor->current.angle.y += 0x8000; + i_this->m0FDAA[1] = 0x14; + } + i_this->m0FF28.OffAtSetBit(); + i_this->m0FDFC.OffAtSetBit(); } /* 00002100-00002524 .text end__FP10bgn3_class */ -void end(bgn3_class*) { - /* Nonmatching */ +static void end(bgn3_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + cXyz local_44; + + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); + switch (i_this->m0FD8C) { + case 0: + actor->speed.y = 150.0f; + actor->speedF = 0.0f; + i_this->m0FD8C = 1; + bgn->mCSMode = 20; + i_this->m0FDB8 = 1.0f; + fopAcM_monsSeStart(player, JA_SE_CV_BK_SURPRISE, 0); + break; + case 1: + case 2: + case 3: + case 4: + i_this->m100A0 = actor->current.pos.y - 150.0f; + if (i_this->m100A0 > 350.0f) { + i_this->m100A0 = 350.0f; + } + if (checkGround(i_this)) { + i_this->m0FD8C++; + actor->current.angle.y = cM_rndF(65536.0f); + i_this->m0FDB8 = 1.0f; + dComIfGp_getVibration().StartShock(REG0_S(2) + 5, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + drop_eff_set(i_this); + actor->speed.y = REG0_F(11) + 130.0f; + actor->speedF = 0.0f; + actor->current.angle.y = cM_rndF(65536.0f); + fopAcM_monsSeStart(actor, JA_SE_CV_BGN_HIT_1, 0); + } + if ((i_this->m0FD8C == 4) && (actor->speed.y <= -30.0f)) { + i_this->m0FD8C = 5; + i_this->m0FD8E = 0; + } + break; + case 5: + actor->speed.y += REG0_F(12) + 5.5f; +#if VERSION > VERSION_DEMO + if (actor->speed.y > 0.0f) { + cLib_addCalc2(&i_this->m10060, 1.0f, 1.0f, 0.015f); + } +#endif + actor->current.angle.y = actor->current.angle.y + i_this->m0FD8E; + actor->shape_angle.y = actor->shape_angle.y + i_this->m0FD8E; + cLib_addCalcAngleS2(&i_this->m0FD8E, 5000, 4, 100); + cLib_addCalc2(&i_this->m0FDBC, REG0_F(6) + 50.0f, 1.0f, 1.0f); + cLib_addCalc0(&i_this->m100A0, 1.0f, REG0_F(10) + DEMO_SELECT(100.0f, 50.0f)); + break; + } + pos_move(i_this); + local_44 = actor->current.pos - actor->old.pos; + actor->current.angle.x = -cM_atan2s(local_44.y, std::sqrtf(SQUARE(local_44.x) + SQUARE(local_44.z))); + if (actor->current.angle.x > 0x3000) { + actor->current.angle.x = 0x3000; + } else if (actor->current.angle.x < -0x3000) { + actor->current.angle.x = -0x3000; + } + checkGround(i_this); + i_this->m0FF28.OffAtSetBit(); + i_this->m0FDFC.OffAtSetBit(); +#if VERSION == VERSION_DEMO + cLib_addCalc0(&actor->current.pos.x, 0.05f, 30.0f); + cLib_addCalc0(&actor->current.pos.z, 0.05f, 30.0f); +#else + cLib_addCalc2(&actor->current.pos.x, -15.0f, 0.05f, 30.0f); + cLib_addCalc2(&actor->current.pos.z, 375.17f, 0.05f, 30.0f); +#endif } /* 00002524-00002C18 .text damage_check__FP10bgn3_class */ -void damage_check(bgn3_class*) { - /* Nonmatching */ +static void damage_check(bgn3_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); + char cVar5; + JPABaseEmitter* emitter; + s16 sVar7; + s8 bVar10; + f32 dVar11; + csXyz local_78; + cXyz local_58; + CcAtInfo atInfo; + + if (i_this->m0FDB4 == 0) { + atInfo.pParticlePos = NULL; + if (i_this->m0FDFC.ChkTgHit()) { + atInfo.mpObj = i_this->m0FDFC.GetTgHitObj(); + atInfo.mpActor = at_power_check(&atInfo); + fopAcM_monsSeStart(actor, JA_SE_CV_BGN_M_HIT_FACE, 0); + fopAcM_seStart(actor, JA_SE_CM_BGN_M_FACE_HIT, 0); + if (atInfo.mResultingAttackType == 9) { + bVar10 = 6; + dComIfGp_getVibration().StartShock(REG0_S(2) + 3, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + dScnPly_ply_c::nextPauseTimer = 5; + i_this->m100A8 = 0x1e; + sVar7 = l_HIO.m30; + } else if (atInfo.mResultingAttackType == 2) { + bVar10 = 5; + i_this->m100A8 = 0x19; + sVar7 = l_HIO.m2E; + } else if (atInfo.mResultingAttackType == 1) { + if ((dCcD_GetGObjInf(atInfo.mpObj)->GetAtSpl()) == 1) { + bVar10 = 4; + dScnPly_ply_c::nextPauseTimer = 3; + i_this->m100A8 = 0x14; + sVar7 = l_HIO.m2C; + } else { + bVar10 = 3; + dScnPly_ply_c::nextPauseTimer = 2; + i_this->m100A8 = 0xf; + sVar7 = l_HIO.m2A; + } + } else if (fopAcM_GetName(atInfo.mpActor) == PROC_ARROW) { + bVar10 = 2; + i_this->m100A8 = 10; + sVar7 = l_HIO.m28; + } else { + bVar10 = 1; + i_this->m100A8 = 7; + sVar7 = l_HIO.m26; + } + if (bVar10 != 0) { + if (i_this->m0FD8A != 1) { + i_this->m0FDAA[0] = sVar7; + i_this->m0FD8A = 1; + } + i_this->m0FD8C = 0; + i_this->m0FDB4 = 0x14; + if (bVar10 >= 4) { + dComIfGp_particle_set(dPa_name::ID_AK_JN_CRITICALHITFLASH, i_this->m0FDFC.GetTgHitPosP()); + local_58.z = 2.0f; + local_58.y = 2.0f; + local_58.x = 2.0f; + local_78.z = 0; + local_78.x = 0; + local_78.y = fopAcM_searchPlayerAngleY(actor); + dComIfGp_particle_set(dPa_name::ID_AK_JN_OK, i_this->m0FDFC.GetTgHitPosP(), &local_78, &local_58); + dKy_SordFlush_set(*i_this->m0FDFC.GetTgHitPosP(), 1); + } + def_se_set(actor, atInfo.mpObj, 0x40); + return; + } + } + if (i_this->mParts[8].mPart3Sph.ChkTgHit()) { + i_this->m0FDB4 = 0x14; +#if VERSION > VERSION_DEMO + i_this->m0FD9E = 1; +#endif + i_this->m0FD8A = 2; + i_this->m0FD8C = 0; + if (actor->health != 0) { + actor->health--; +#if VERSION > VERSION_DEMO + mDoAud_seStart(JA_SE_LK_ARROW_HIT, NULL, 0x35, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); +#endif + dVar11 = (REG0_F(5) + 2.0f); + if (actor->health == 0) { + mDoAud_bgmStop(30); + emitter = dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTBREAKWEAKPOINT00, &i_this->m10054); + if (emitter != NULL) { + JGeometry::TVec3 scale(dVar11, dVar11, dVar11); + emitter->setGlobalScale(scale); + } + emitter = dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTBREAKWEAKPOINT01, &i_this->m10054); + if (emitter != NULL) { + JGeometry::TVec3 scale(dVar11, dVar11, dVar11); + emitter->setGlobalScale(scale); + } + i_this->m0FD8A = 3; + i_this->m0FD8C = 0; + i_this->m0FDB4 = 10000; +#if VERSION == VERSION_DEMO + fopAcM_monsSeStart(actor, JA_SE_CV_BGN_HIT_LAST, 0); + fopAcM_seStart(actor, JA_SE_CM_BGN_M_BRK_ORB, 0); +#else + mDoAud_monsSeStart(JA_SE_CV_BGN_HIT_LAST, NULL, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + mDoAud_seStart(JA_SE_CM_BGN_M_BRK_ORB, NULL, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); +#endif + } else { + emitter = dComIfGp_particle_set(dPa_name::ID_AK_SN_KGTHITWEAKPOINT00, &i_this->m10054); + if (emitter != NULL) { + JGeometry::TVec3 scale(dVar11, dVar11, dVar11); + emitter->setGlobalScale(scale); + } +#if VERSION == VERSION_DEMO + fopAcM_monsSeStart(actor, JA_SE_CV_BGN_HIT_1, 0); +#else + mDoAud_monsSeStart(JA_SE_CV_BGN_HIT_1, NULL, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); +#endif + } + } + } + cVar5 = 0; + if (i_this->m0FF28.ChkTgHit()) { + atInfo.mpObj = i_this->m0FF28.GetTgHitObj(); + cVar5 = 1; + } + for (s32 i = 0; i < 8; i++) { + if (i_this->mParts[i].mPart3Sph.ChkTgHit()) { + atInfo.mpObj = i_this->mParts[i].mPart3Sph.GetTgHitObj(); + cVar5 = 2; + } + } + if ((cVar5 != 0) && (i_this->m0FDB6 == 0)) { + i_this->m0FDB6 = 10; + def_se_set(actor, atInfo.mpObj, 0x44); + } + } } /* 00002C18-00002E4C .text ke_control__FP9bgn3_ke_sif */ -void ke_control(bgn3_ke_s*, int, float) { - /* Nonmatching */ +static void ke_control(bgn3_ke_s* param_1, int, f32 param_3) { + f32 fVar_x; + f32 fVar_y; + f32 fVar_z; + cXyz local_90; + cXyz local_9c; + cXyz local_a8; + + s32 i = 1; + cXyz* pcVar3 = ¶m_1->m00[1]; + local_90.x = 0.0f; + local_90.y = 0.0f; + local_90.z = param_3; + for (i = 1; i < 5; i++, pcVar3++) { + f32 fVar1 = (0.1f * (s32)(5 - i)); + local_a8.x = param_1->m78.x * fVar1; + local_a8.y = param_1->m78.y * fVar1; + local_a8.z = param_1->m78.z * fVar1; + fVar_y = local_a8.x + (pcVar3->x - pcVar3[-1].x); + fVar_z = local_a8.z + (pcVar3->z - pcVar3[-1].z); + fVar_x = (l_HIO.m4C + (pcVar3->y + local_a8.y)) - pcVar3[-1].y; + s16 iVar4 = -cM_atan2s(fVar_x, fVar_z); + int iVar5 = cM_atan2s(fVar_y, std::sqrtf(SQUARE(fVar_x) + SQUARE(fVar_z))); + cMtx_XrotS(*calc_mtx, iVar4); + cMtx_YrotM(*calc_mtx, iVar5); + MtxPosition(&local_90, &local_9c); + pcVar3->x = pcVar3[-1].x + local_9c.x; + pcVar3->y = pcVar3[-1].y + local_9c.y; + pcVar3->z = pcVar3[-1].z + local_9c.z; + } } /* 00002E4C-00002EE4 .text ke_move__FP19mDoExt_3DlineMat0_cP9bgn3_ke_sif */ -void ke_move(mDoExt_3DlineMat0_c*, bgn3_ke_s*, int, float) { - /* Nonmatching */ +static void ke_move(mDoExt_3DlineMat0_c* param_1, bgn3_ke_s* param_2, int param_3, f32 param_4) { + cXyz* pcVar3; + + if (l_HIO.m3E != 0) { + ke_control(param_2, param_3, param_4); + pcVar3 = param_1->getPos(param_3); + for (s32 i = 0; i < 5; i++, pcVar3++) { + pcVar3->x = param_2->m00[i].x; + pcVar3->y = param_2->m00[i].y; + pcVar3->z = param_2->m00[i].z; + } + } } /* 00002EE4-00003110 .text move_se_set__FP10bgn3_class */ -void move_se_set(bgn3_class*) { - /* Nonmatching */ +static void move_se_set(bgn3_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + u32 uVar2; + cXyz local_28; + + local_28 = actor->current.pos - actor->old.pos; + local_28.y = 0.0f; + uVar2 = local_28.abs() * 3.5f; + if (uVar2 > 100) { + uVar2 = 100; + } + fopAcM_seStart(actor, JA_SE_CM_BGN_MECHA_ROTATE, uVar2); + local_28 = actor->current.pos - actor->old.pos; + local_28.z = 0.0f; + local_28.x = 0.0f; + uVar2 = local_28.abs() * 2.0f; + if (uVar2 > 100) { + uVar2 = 100; + } + fopAcM_seStart(actor, JA_SE_CM_BGN_MECHA_ROPE, uVar2); } /* 00003110-00004058 .text move__FP10bgn3_class */ -void move(bgn3_class*) { - /* Nonmatching */ +static void move(bgn3_class* i_this) { +#if VERSION > VERSION_DEMO + static s16 fl_check_d[] = {0x0015, 0x0013, 0x0011, 0x000F, 0x000D, 0x000B, 0x0009, 0x0007, 0x0005}; +#endif + fopAc_ac_c* actor = &i_this->actor; + f32 fVar1; + BOOL bVar5; + J3DModel* model; + f32 dVar22; + cXyz local_d8; + cXyz local_e4; + cXyz cStack_f0; + + bVar5 = false; + if (l_HIO.m05 == 0) { + switch (i_this->m0FD8A) { + case 10: + break; + case 0: + move0(i_this); + if (actor->speedF > 10.0f) { + bVar5 = true; + move_splash_set(i_this); + fopAcM_seStart(actor, JA_SE_CM_BGN_M_CRAWL, 0); + move_se_set(i_this); + } + break; + case 1: + mahi(i_this); + break; + case 2: + damage(i_this); + break; + case 3: + end(i_this); + break; + } + } + tail_eff_set(i_this); + damage_check(i_this); + cLib_addCalcAngleS2(&actor->shape_angle.y, actor->current.angle.y, 4, 0x1000); + cLib_addCalcAngleS2(&actor->shape_angle.x, actor->current.angle.x, 8, 0x400); + cMtx_YrotS(*calc_mtx, actor->shape_angle.y); + cMtx_XrotM(*calc_mtx, actor->shape_angle.x); + local_d8.set(0.0f, 0.0f, REG0_F(3) + -300.0f); + MtxPosition(&local_d8, &local_e4); + i_this->m0FD7C = actor->current.pos + local_e4; + for (s32 i = 0; i < 9; i++) { + i_this->mParts[i].m00F4 = (REG0_F(11) + 1.7f) * size_d[i]; + } + part_control(i_this); + i_this->mpMorf->play(&actor->current.pos, 0, 0); + i_this->mJyakutenCBrkAnm->play(); + i_this->mJyakutenBBrkAnm->play(); + MtxTrans(actor->current.pos.x, actor->current.pos.y, actor->current.pos.z, false); + cMtx_YrotM(*calc_mtx, actor->shape_angle.y); + cMtx_XrotM(*calc_mtx, actor->shape_angle.x); + cMtx_ZrotM(*calc_mtx, actor->shape_angle.z); + MtxPush(); + model = i_this->m002CC; + MtxScale(REG0_F(10) + 2.0f, REG0_F(10) + 2.0f, REG0_F(10) + 2.0f, true); + model->setBaseTRMtx(*calc_mtx); + local_d8.setall(0.0f); + MtxPosition(&local_d8, &local_e4); + i_this->m0FF28.SetC(local_e4); + i_this->m0FF28.SetR(REG0_F(1) + 200.0f); + dComIfG_Ccsp()->Set(&i_this->m0FF28); +#if VERSION > VERSION_DEMO + if (i_this->m0FD9E == 0x17) { + i_this->mArrowHitFlashTimer = 50; + i_this->mArrowHitEffectTimer = 100; + } + if (i_this->mArrowHitEffectTimer != 0) { + i_this->mArrowHitEffectTimer--; + fVar1 = i_this->mArrowHitEffectTimer * 100.0f * (REG8_F(8) + 0.001f); + if (i_this->mpArrowHitEmitter1 == NULL) { + i_this->mpArrowHitEmitter1 = dComIfGp_particle_set(dPa_name::ID_AK_JN_CCTHUNDER00, &local_e4); + } else { + i_this->mpArrowHitEmitter1->setGlobalTranslation(local_e4.x, local_e4.y, local_e4.z); + JGeometry::TVec3 scale(fVar1, fVar1, fVar1); + i_this->mpArrowHitEmitter1->setGlobalScale(scale); + } + if (i_this->mpArrowHitEmitter2 == NULL) { + local_d8.setall(fVar1); + i_this->mpArrowHitEmitter2 = dComIfGp_particle_set(dPa_name::ID_AK_JN_CCTHUNDER01, &local_e4); + } else { + i_this->mpArrowHitEmitter2->setGlobalTranslation(local_e4.x, local_e4.y, local_e4.z); + JGeometry::TVec3 scale(fVar1, fVar1, fVar1); + i_this->mpArrowHitEmitter2->setGlobalScale(scale); + } + } else { + if (i_this->mpArrowHitEmitter1 != NULL) { + i_this->mpArrowHitEmitter1->becomeInvalidEmitter(); + i_this->mpArrowHitEmitter1 = NULL; + } + if (i_this->mpArrowHitEmitter2 != NULL) { + i_this->mpArrowHitEmitter2->becomeInvalidEmitter(); + i_this->mpArrowHitEmitter2 = NULL; + } + } +#endif + MtxPull(); + for (s32 i = 0; i < 40; i++) { + MtxPush(); + cMtx_XrotM(*calc_mtx, -((REG0_S(5) + 0x3FFF & (s32)i * (REG0_S(4) + 1000)) - (REG0_S(6) + 0x2000))); + cMtx_ZrotM(*calc_mtx, -((REG0_S(8) + 0xFFF & (s32)i * (REG0_S(7) + 5000)) - (REG0_S(9) + 0x800))); + local_d8.y = (100.0f + REG13_F(13)); + MtxPosition(&local_d8, i_this->mHairs[i].m00); + local_d8.y = l_HIO.m40; + MtxPosition(&local_d8, &i_this->mHairs[i].m78); + i_this->mHairs[i].m78 -= local_e4; + ke_move(&i_this->mLineMat, &i_this->mHairs[i], i, 2.0f * l_HIO.m44); + MtxPull(); + } + MtxTrans(0.0f, 0.0f, REG0_F(2) + 250.0f, true); + if (i_this->m100A8 != 0) { + i_this->m100A8--; + } + dVar22 = i_this->m100A8 * (REG0_F(14) + 500.0f); + s16 y = dVar22 * cM_ssin(i_this->m0FD88 * 0x2100); + s16 x = dVar22 * cM_scos(i_this->m0FD88 * 0x2300); + cMtx_YrotM(*calc_mtx, y); + cMtx_XrotM(*calc_mtx, x); + model = i_this->mpMorf->getModel(); + model->setBaseTRMtx(*calc_mtx); + local_d8.setall(0.0f); + MtxPosition(&local_d8, &local_e4); + i_this->m0FDFC.SetC(local_e4); + i_this->m0FDFC.SetR(REG0_F(0) + 150.0f); + dComIfG_Ccsp()->Set(&i_this->m0FDFC); + actor->eyePos = local_e4; + actor->attention_info.position = actor->eyePos; + actor->attention_info.position.y += REG0_F(7) + 100.0f; + i_this->mpMorf->calc(); +#if VERSION > VERSION_DEMO + if (i_this->m0FD9E != 0) { + i_this->m0FD9E++; + if (i_this->m0FD9E > 100) { + i_this->m0FD9E = 0; + } + } +#endif + part_s3* ppVar18 = i_this->mParts; + for (s32 i = 0; i < 9; i++, ppVar18++) { + MtxTrans(ppVar18->m00D4.x, ppVar18->m00D4.y, ppVar18->m00D4.z, false); + cMtx_YrotM(*calc_mtx, ppVar18->m00E2); + cMtx_XrotM(*calc_mtx, ppVar18->m00E0); + MtxPush(); + MtxScale(ppVar18->m00F4, ppVar18->m00F4, ppVar18->m00F4, true); + local_d8.setall(0.0f); + MtxPosition(&local_d8, &local_e4); + if (i == 8) { + if (actor->health == 3) { + ppVar18->mpPart3Model = i_this->mpJyakutenAModel; + } else if (actor->health == 2) { + ppVar18->mpPart3Model = i_this->mpJyakutenBModel; + } else if (actor->health == 1) { + ppVar18->mpPart3Model = i_this->mpJyakutenCModel; + } else { + ppVar18->mpPart3Model = NULL; + } + i_this->m10054 = local_e4; + } + if (ppVar18->mpPart3Model != NULL) { + ppVar18->mpPart3Model->setBaseTRMtx(*calc_mtx); + } + ppVar18->mPart3Sph.SetC(local_e4); + ppVar18->mPart3Sph.SetR(ppVar18->m00F4 * (100.0f + REG0_F(12))); + if (bVar5) { + ppVar18->mPart3Sph.OnAtSetBit(); + } else { + ppVar18->mPart3Sph.OffAtSetBit(); + } + dComIfG_Ccsp()->Set(&ppVar18->mPart3Sph); + MtxPull(); + if ((i < 7) && (l_HIO.m3E != 0)) { + for (s32 j = 0; j < ke_max[i]; j++) { + MtxPush(); + cMtx_XrotM(*calc_mtx, (REG0_S(5) + 0x3FFF & j * (REG0_S(4) + 1000)) - (REG0_S(6) + 0x2000)); + cMtx_ZrotM(*calc_mtx, (REG0_S(8) + 0xFFF & j * (REG0_S(7) + 5000)) - (REG0_S(9) + 0x800)); + local_d8.y = 100.0f + REG13_F(13); + local_d8.y = ppVar18->m00F4 * (60.0f + REG13_F(12)); + MtxPosition(&local_d8, ppVar18->mPart3Hairs[j].m00); + local_d8.y = l_HIO.m40; + MtxPosition(&local_d8, &ppVar18->mPart3Hairs[j].m78); + ppVar18->mPart3Hairs[j].m78 -= local_e4; + ke_move(&ppVar18->mPart3LineMat, &ppVar18->mPart3Hairs[j], j, ppVar18->m00F4 * l_HIO.m44); + MtxPull(); + } + } +#if VERSION > VERSION_DEMO + if (i_this->m0FD9E == fl_check_d[i]) { + ppVar18->mPart3ArrowHitFlashTimer = 50; + ppVar18->mPart3ArrowHitEffectTimer = 100; + } + if (ppVar18->mPart3ArrowHitFlashTimer != 0) { + ppVar18->mPart3ArrowHitFlashTimer--; + } + if (ppVar18->mPart3ArrowHitEffectTimer != 0) { + ppVar18->mPart3ArrowHitEffectTimer--; + fVar1 = (REG8_F(0) + 0.04f) * (ppVar18->m00F4 * ppVar18->mPart3ArrowHitEffectTimer); + if (ppVar18->mpPart3ArrowHitEmitter1 == NULL) { + ppVar18->mpPart3ArrowHitEmitter1 = dComIfGp_particle_set(dPa_name::ID_AK_JN_CCTHUNDER00, &ppVar18->m00D4); + } else { + ppVar18->mpPart3ArrowHitEmitter1->setGlobalTranslation(ppVar18->m00D4.x, ppVar18->m00D4.y, ppVar18->m00D4.z); + JGeometry::TVec3 scale(fVar1, fVar1, fVar1); + ppVar18->mpPart3ArrowHitEmitter1->setGlobalScale(scale); + } + if (ppVar18->mpPart3ArrowHitEmitter2 == NULL) { + local_d8.setall(fVar1); + ppVar18->mpPart3ArrowHitEmitter2 = dComIfGp_particle_set(dPa_name::ID_AK_JN_CCTHUNDER01, &ppVar18->m00D4); + } else { + ppVar18->mpPart3ArrowHitEmitter2->setGlobalTranslation(ppVar18->m00D4.x, ppVar18->m00D4.y, ppVar18->m00D4.z); + JGeometry::TVec3 scale(fVar1, fVar1, fVar1); + ppVar18->mpPart3ArrowHitEmitter2->setGlobalScale(scale); + } + } else { + if (ppVar18->mpPart3ArrowHitEmitter1 != NULL) { + ppVar18->mpPart3ArrowHitEmitter1->becomeInvalidEmitter(); + ppVar18->mpPart3ArrowHitEmitter1 = NULL; + } + if (ppVar18->mpPart3ArrowHitEmitter2 != NULL) { + ppVar18->mpPart3ArrowHitEmitter2->becomeInvalidEmitter(); + ppVar18->mpPart3ArrowHitEmitter2 = NULL; + } + } +#endif + } + if (bVar5) { + i_this->m0FDFC.OnAtSetBit(); + i_this->m0FF28.OnAtSetBit(); + } else { + i_this->m0FDFC.OffAtSetBit(); + i_this->m0FF28.OffAtSetBit(); + } + MTXCopy(i_this->m002CC->getBaseTRMtx(), *calc_mtx); + local_d8.setall(0.0f); + MtxPosition(&local_d8, &cStack_f0); + cLib_addCalc0(&i_this->m100A0, 1.0f, 25.0f); + cXyz* pcVar13 = i_this->mRedRopeMat.getPos(0); + u8* pcVar14 = i_this->mRedRopeMat.getSize(0); + for (s32 i = 0; i < 60; i++, pcVar13++, pcVar14++) { + fVar1 = i_this->m100A0 * cM_ssin(cM_rad2s(0.053247336f * (f32)(i))); + fVar1 *= (0.01666667f * (f32)(0x3B - i)); + local_d8.x = fVar1 * cM_ssin(i_this->m0FD88 * (REG0_S(3) + 300) + i * (REG0_S(4) + 2000)); + local_d8.y = 0.0f; + local_d8.z = fVar1 * cM_ssin(i_this->m0FD88 * (REG0_S(5) + 0xfa) + i * (REG0_S(6) + 2000)); + *pcVar13 = cStack_f0 + local_d8; + *pcVar14 = REG0_S(3) + 10; + cStack_f0.y += 50.0f; + } } +#if VERSION == VERSION_DEMO +/* 000001F4-00000240 .text bgn_s_sub__FPvPv */ +static void* bgn_s_sub(void* param_1, void*) { + if ((fopAc_IsActor(param_1)) && (fopAcM_GetName(param_1) == PROC_BGN)) { + return param_1; + } else { + return NULL; + } +} +#endif + /* 00004058-000040B0 .text ki_c_sub__FPvPv */ -void ki_c_sub(void*, void*) { - /* Nonmatching */ +static void* ki_c_sub(void* param_1, void*) { + if ((fopAc_IsActor(param_1)) && (fopAcM_GetName(param_1) == PROC_KS)) { + ki_all_count++; + } + return NULL; } /* 000040B0-000040F4 .text ki_check__FP10bgn3_class */ -void ki_check(bgn3_class*) { - /* Nonmatching */ +static s32 ki_check(bgn3_class* i_this) { + ki_all_count = 0; + fpcM_Search(ki_c_sub, i_this); + return ki_all_count; } /* 000040F4-00004358 .text daBgn3_Execute__FP10bgn3_class */ -static BOOL daBgn3_Execute(bgn3_class*) { - /* Nonmatching */ +static BOOL daBgn3_Execute(bgn3_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + cXyz local_28; + + bgn = (bgn_class*)fpcM_Search(bgn_s_sub, i_this); + if (bgn == NULL) { + return TRUE; + } + if (l_HIO.m06 != 0) { + actor->health = l_HIO.m06; + } + esa = (esa_class*)fpcEx_Search(esa_s_sub, i_this); + if (bgn->m02B5 != 2) { + i_this->m0FD8A = 10; + actor->current.pos.x = 0.0f; + actor->current.pos.y = 30000.0f; + actor->current.pos.z = 0.0f; + fopAcM_OffStatus(actor, 0); + actor->attention_info.flags = 0; + return TRUE; + } + if (i_this->m0FD8A == 10) { + actor->current.pos = actor->home.pos; + i_this->m0FD8A = 0; + i_this->m0FD90 = DEMO_SELECT(90, 180); + i_this->m0FDB0 = DEMO_SELECT(90, 180); + } + actor->attention_info.flags = fopAc_Attn_LOCKON_BATTLE_e; + cLib_addCalc2(&i_this->m10060, 0.0f, 1.0f, 0.01f); + i_this->m0FD88++; + actor->attention_info.distances[fopAc_Attn_TYPE_BATTLE_e] = 0x22; + for (s32 i = 0; i < 5; i++) { + if (i_this->m0FDAA[i] != 0) { + i_this->m0FDAA[i]--; + } + } + if (i_this->m0FDB4 != 0) { + i_this->m0FDB4--; + } + if (i_this->m0FDB6 != 0) { + i_this->m0FDB6--; + } + if (i_this->m0FD94 != 0) { + i_this->m0FD94--; + } +#if VERSION > VERSION_DEMO + if (i_this->mArrowHitFlashTimer != 0) { + i_this->mArrowHitFlashTimer--; + } +#endif + move(i_this); + if (i_this->m100AC != 0) { + i_this->m100AC--; + if (ki_check(i_this) < 0x14) { + local_28.x = cM_rndFX(2500.0f); + local_28.y = cM_rndF(500.0f) + 3500.0f; + local_28.z = cM_rndFX(2500.0f); + fopAcM_create(PROC_KS, 3, &local_28, fopAcM_GetRoomNo(actor)); + } + } + return TRUE; } /* 00004358-00004360 .text daBgn3_IsDelete__FP10bgn3_class */ @@ -135,18 +1138,101 @@ static BOOL daBgn3_IsDelete(bgn3_class*) { } /* 00004360-000043EC .text daBgn3_Delete__FP10bgn3_class */ -static BOOL daBgn3_Delete(bgn3_class*) { - /* Nonmatching */ +static BOOL daBgn3_Delete(bgn3_class* i_this) { + dComIfG_resDeleteDemo(&i_this->mPhase, "Bgn"); + if (i_this->m100B0 != 0) { + hio_set = false; + mDoHIO_deleteChild(l_HIO.mNo); + } + mDoAud_seDeleteObject(&i_this->m10054); + return TRUE; } /* 000043EC-00004848 .text useHeapInit__FP10fopAc_ac_c */ -static BOOL useHeapInit(fopAc_ac_c*) { - /* Nonmatching */ +static BOOL useHeapInit(fopAc_ac_c* a_this) { + J3DModelData* modelData; + J3DAnmTevRegKey* pBrk; + ResTIMG* pBti; + bgn3_class* i_this = (bgn3_class*)a_this; + + i_this->mpMorf = new mDoExt_McaMorf( + (J3DModelData*)dComIfG_getObjectRes("Bgn", BGN_BDL_BGN_HEAD1), + NULL, + NULL, + (J3DAnmTransformKey*)dComIfG_getObjectRes("Bgn", BGN_BCK_BGN_HEAD1), + J3DFrameCtrl::EMode_LOOP, + 1.0f, + 0, + -1, + 1, + NULL, + 0, + 0x11020203 + ); + if ((i_this->mpMorf == NULL) || (i_this->mpMorf->getModel() == NULL)) { + return FALSE; + } + modelData = (J3DModelData*)dComIfG_getObjectRes("Bgn", BGN_BDL_BGN_DEKU1); + i_this->m002CC = mDoExt_J3DModel__create(modelData, 0, 0x11020203); + if (i_this->m002CC == NULL) { + return FALSE; + } + if (!i_this->mLineMat.init(0x28, 5, 0)) { + return FALSE; + } + for (s32 i = 0; i < 9; i++) { + i_this->mParts[i].mpPart3Model = mDoExt_J3DModel__create(modelData, 0, 0x11020203); + if (i_this->mParts[i].mpPart3Model == 0) { + return false; + } + if ((i < 7) && (!i_this->mParts[i].mPart3LineMat.init(ke_max[i], 5, 0))) { + return false; + } + } + modelData = (J3DModelData*)dComIfG_getObjectRes("Bgn", DEMO_SELECT(BGN_BDL_BGN_JYAKUTENA, BGN_BDL_BGN_JYAKUTENA3)); + i_this->mpJyakutenAModel = mDoExt_J3DModel__create(modelData, DEMO_SELECT(0x80000, 0), DEMO_SELECT(0x11000022, 0x11020203)); + if (i_this->mpJyakutenAModel == NULL) { + return FALSE; + } + modelData = (J3DModelData*)dComIfG_getObjectRes("Bgn", DEMO_SELECT(BGN_BDL_BGN_JYAKUTENB, BGN_BDL_BGN_JYAKUTENB3)); + i_this->mpJyakutenBModel = mDoExt_J3DModel__create(modelData, DEMO_SELECT(0x80000, 0), DEMO_SELECT(0x11000022, 0x11020203)); + if (i_this->mpJyakutenBModel == NULL) { + return FALSE; + } + i_this->mJyakutenBBrkAnm = new mDoExt_brkAnm(); +#if VERSION > VERSION_DEMO + if (i_this->mJyakutenBBrkAnm == NULL) { + return FALSE; + } +#endif + pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bgn", DEMO_SELECT(BGN_BRK_BGN_JYAKUTENBC, BGN_BRK_BGN_JYAKUTENB3)); + if (!i_this->mJyakutenBBrkAnm->init(modelData, pBrk, true, J3DFrameCtrl::EMode_LOOP)) { + return FALSE; + } + modelData = (J3DModelData*)dComIfG_getObjectRes("Bgn", DEMO_SELECT(BGN_BDL_BGN_JYAKUTENC, BGN_BDL_BGN_JYAKUTENC3)); + i_this->mpJyakutenCModel = mDoExt_J3DModel__create(modelData, DEMO_SELECT(0x80000, 0), DEMO_SELECT(0x11000022, 0x11020203)); + if (i_this->mpJyakutenCModel == NULL) { + return FALSE; + } + i_this->mJyakutenCBrkAnm = new mDoExt_brkAnm(); +#if VERSION > VERSION_DEMO + if (i_this->mJyakutenCBrkAnm == NULL) { + return FALSE; + } +#endif + pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bgn", DEMO_SELECT(BGN_BRK_BGN_JYAKUTENBC, BGN_BRK_BGN_JYAKUTENC3)); + if (!i_this->mJyakutenCBrkAnm->init(modelData, pBrk, true, J3DFrameCtrl::EMode_LOOP)) { + return FALSE; + } + pBti = (ResTIMG*)dComIfG_getObjectRes("Bgn", BGN_BTI_NOT_CUT1); + if (!i_this->mRedRopeMat.init(1, 0x3c, pBti, 1)) { + return FALSE; + } + return TRUE; } /* 00004890-00004BC0 .text daBgn3_Create__FP10fopAc_ac_c */ -static cPhs_State daBgn3_Create(fopAc_ac_c*) { - /* Nonmatching */ +static cPhs_State daBgn3_Create(fopAc_ac_c* a_this) { static dCcD_SrcSph cc_sph_src = { // dCcD_SrcGObjInf { @@ -203,6 +1289,54 @@ static cPhs_State daBgn3_Create(fopAc_ac_c*) { /* Radius */ 70.0f, }}, }; + +#if VERSION > VERSION_DEMO + fopAcM_SetupActor(a_this, bgn3_class); +#endif + bgn3_class* i_this = (bgn3_class*)a_this; + cPhs_State res = dComIfG_resLoad(&i_this->mPhase, "Bgn"); + if (res == cPhs_COMPLEATE_e) { +#if VERSION == VERSION_DEMO + fopAcM_SetupActor(a_this, bgn3_class); +#endif + if (!fopAcM_entrySolidHeap(a_this, useHeapInit, 0x96000)) { + return cPhs_ERROR_e; + } + if (hio_set == false) { + i_this->m100B0 = 1; + hio_set = true; + l_HIO.mNo = mDoHIO_createChild("G(ハヤムシ)", &l_HIO); // G (Fast worm) + } + i_this->mStts.Init(0xFF, 0xFF, a_this); + i_this->m0FF28.Set(cc_sph_src); + i_this->m0FF28.SetStts(&i_this->mStts); + i_this->m0FF28.OffAtSetBit(); + i_this->m0FDFC.Set(cc_sph_src); + i_this->m0FDFC.SetStts(&i_this->mStts); + i_this->m0FDFC.OffAtSetBit(); + for (s32 i = 0; i < 9; i++) { + if (i == 8) { + i_this->mParts[i].mPart3Sph.Set(core_sph_src); + } else { + i_this->mParts[i].mPart3Sph.Set(cc_sph_src); + } + i_this->mParts[i].mPart3Sph.SetStts(&i_this->mStts); + i_this->mParts[i].mPart3Sph.OffAtSetBit(); + } + a_this->health = 3; + a_this->max_health = 3; + ke_color.r = l_HIO.m50; + ke_color.g = l_HIO.m52; + ke_color.b = l_HIO.m54; + ke_color.a = 0xFF; +#if VERSION > VERSION_DEMO + for (s32 i = 0; i < 9; i++) { + i_this->mParts[i].mPart3TevStr = a_this->tevStr; + } +#endif + daBgn3_Execute(i_this); + } + return res; } static actor_method_class l_daBgn3_Method = {